mini: add reconnect, forms, and shared targets (#37811)

Centralize session target resolution for mini and noninteractive
run paths. Recover from transport drops, replace questions with
forms, and keep tool/catalog state location-scoped with live
progress and theme discovery.
This commit is contained in:
Simon Klee 2026-07-19 22:45:10 +02:00 committed by GitHub
commit 925c2423de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
65 changed files with 5631 additions and 4292 deletions

View file

@ -145,11 +145,11 @@ describe("Mini CLI host", () => {
expect(process.listenerCount("SIGUSR2")).toBe(sigusr2)
})
test("passes paths, platform, timing, and diagnostic context", async () => {
test("passes frontend host capabilities", async () => {
const directory = await root()
const input = host({ stdin: stream(true), cleanup() {} }, directory)
expect(input.paths).toEqual({ home: directory, state: directory, log: directory })
expect(input.paths).toEqual({ home: directory })
expect(input.platform).toBe(process.platform)
expect(typeof input.files.readText).toBe("function")
const file = path.join(directory, "attachment.txt")
@ -157,7 +157,6 @@ describe("Mini CLI host", () => {
expect(await input.files.readText(pathToFileURL(file).href)).toBe("attachment contents")
expect(typeof input.startup.showTiming).toBe("boolean")
expect(typeof input.startup.now()).toBe("number")
expect(input.diagnostics).toMatchObject({ pid: process.pid, cwd: directory })
})
test("merges, clears, and repairs persisted model variants", async () => {
@ -186,6 +185,9 @@ describe("Mini CLI host", () => {
variant: { "openai/gpt-4.1": "low" },
})
await Bun.write(file, JSON.stringify({ variant: { "openai/gpt-5": "default" } }))
expect(await input.preferences.resolveVariant(model)).toBeUndefined()
await Bun.write(file, "{")
await input.preferences.saveVariant(model, "high")
expect(await Bun.file(file).json()).toEqual({ variant: { "openai/gpt-5": "high" } })