Continue Antigravity IDE and 2.0 history in new CLI conversations (#24692)

* feat(antigravity): bridge IDE history into new CLI conversations

* fix(antigravity): preserve fresh-launch model and environment for IDE references

* fix(antigravity): forward IDE history opt-in through desktop IPC

* fix(antigravity): rebuild remote IDE reference startup on its host

* fix(antigravity): register IDE continuation action labels

* fix(antigravity): confine IDE references and bound metadata reads

* fix(antigravity): localize IDE continuation badges

* Preserve scanner service cache assertions and refresh Antigravity opening metadata

* Preserve Antigravity opening joins and target folder runtime authority
This commit is contained in:
Neil
2026-10-02 23:01:12 -07:00
committed by GitHub
parent 8f26bfad22
commit 055871ade6
67 changed files with 2257 additions and 147 deletions
+27 -6
View File
@@ -1,5 +1,5 @@
import { closeSync, fstatSync, openSync, readSync, type Stats } from 'node:fs'
import { open, type FileHandle } from 'node:fs/promises'
import { closeSync, constants, fstatSync, openSync, readSync, type Stats } from 'node:fs'
import { open, stat, type FileHandle } from 'node:fs/promises'
const MIN_GROWTH_BYTES = 64 * 1024
@@ -20,6 +20,8 @@ export type BoundedNodeFileRead = {
stats: Stats
}
type NodeFileReadOptions = { regularFileOnly?: boolean; signal?: AbortSignal }
function validateSize(size: number, maxBytes: number): void {
if (!Number.isSafeInteger(size) || size < 0) {
throw new Error('File has an invalid byte size')
@@ -31,11 +33,21 @@ function validateSize(size: number, maxBytes: number): void {
export async function readNodeFileWithinLimit(
filePath: string,
maxBytes: number
maxBytes: number,
options: NodeFileReadOptions = {}
): Promise<BoundedNodeFileRead> {
const handle = await open(filePath, 'r')
options.signal?.throwIfAborted()
if (options.regularFileOnly && !(await stat(filePath)).isFile()) {
throw new Error('Expected a regular file')
}
options.signal?.throwIfAborted()
// Nonblocking open fences replacement with a FIFO after the path check.
const flags = options.regularFileOnly
? constants.O_RDONLY | (process.platform === 'win32' ? 0 : constants.O_NONBLOCK)
: 'r'
const handle = await open(filePath, flags)
try {
return await readNodeFileHandleWithinLimit(handle, maxBytes)
return await readNodeFileHandleWithinLimit(handle, maxBytes, options)
} finally {
await handle.close()
}
@@ -43,20 +55,28 @@ export async function readNodeFileWithinLimit(
export async function readNodeFileHandleWithinLimit(
handle: FileHandle,
maxBytes: number
maxBytes: number,
options: NodeFileReadOptions = {}
): Promise<BoundedNodeFileRead> {
if (!Number.isSafeInteger(maxBytes) || maxBytes < 0) {
throw new RangeError('File read limit must be a non-negative safe integer')
}
options.signal?.throwIfAborted()
const stats = await handle.stat()
options.signal?.throwIfAborted()
if (options.regularFileOnly && !stats.isFile()) {
throw new Error('Expected a regular file')
}
validateSize(stats.size, maxBytes)
let buffer = Buffer.allocUnsafe(stats.size)
let offset = 0
while (true) {
options.signal?.throwIfAborted()
while (offset < buffer.length) {
const { bytesRead } = await handle.read(buffer, offset, buffer.length - offset, offset)
options.signal?.throwIfAborted()
if (bytesRead === 0) {
return { buffer: buffer.subarray(0, offset), stats }
}
@@ -65,6 +85,7 @@ export async function readNodeFileHandleWithinLimit(
const probe = Buffer.allocUnsafe(1)
const { bytesRead } = await handle.read(probe, 0, 1, offset)
options.signal?.throwIfAborted()
if (bytesRead === 0) {
return { buffer: buffer.subarray(0, offset), stats }
}