Stop paying the multimodal tax. Your AI agent keeps every image it has seen but only sends the ones it needs: lighter chats, no endless reconnecting, no starting over. Works with Codex, Claude Code, Cline, Gemini CLI, OpenCode, WorkBuddy and more. Install once, forget it.
TypeScript ai-agentsai-imageclaude-codeclaude-code-pluginclinecodexcodex-plugincomputer-usecontext-engineeringcontext-managementdeveloper-toolsgemini-cliimage-generationmcpmultimodalmultimodal-aiopencodeqwen-codetoken-optimizationvision-language-model
test(selftest): 两个自测加上“勾回再问”
chipfightera4f6fdcf09d8
diff --git a/spike/src/v01-needs-selftest.ts b/spike/src/v01-needs-selftest.tsindex 3b6aff8..03b84bd 100644--- a/spike/src/v01-needs-selftest.ts+++ b/spike/src/v01-needs-selftest.ts@@ -62,6 +62,8 @@ const SCRIPT = {lookNow: "你能看看图片,现在设置如何的?",whichImages: "你需要哪些图片?",detail: "之前你截的视频设置页里,右上角那个图形是什么颜色?",+ recheck: "我已经勾上了。那个图形是什么颜色?",+ color: /橙/,newShots: /截图|截个图|截一张|发.{0,6}图|重新截/,},en: {@@ -74,6 +76,8 @@ const SCRIPT = {lookNow: "Can you look at the images? How are the settings now?",whichImages: "Which images do you need?",detail: "In the video settings page you took a screenshot of earlier, what color is the shape in the top-right corner?",+ recheck: "Checked it. What color is the shape?",+ color: /orange/i,newShots: /screenshot|send (me )?(a |an |the )?(new |fresh )?(image|picture)/i,},};@@ -123,7 +127,7 @@ async function main(): Promise<void> {// thread/resume takes a history only from a client that opts into the experimental API.await server.initialize({ experimentalApi: true, requestAttestation: false });// Starts a thread holding the history, with every screenshot unchecked, and asks the questions in turn.- const run = async (n: number, questions: Array<[string, string]>) => {+ const run = async (n: number, questions: Array<[string, string]>, recheck = false) => {const { thread } = await server.request<{ thread: Json }>("thread/resume", { threadId: randomUUID(), history: history(words), model: TEST_MODEL, cwd: work, approvalPolicy: "never", sandbox: "read-only" });const threadId: string = thread.id;created.push(threadId);@@ -148,12 +152,23 @@ async function main(): Promise<void> {await sleep(2500);entry.images = index.images.map((image) => `${image.id}:${image.kind}:${image.name ?? "-"}`);for (const [name, prompt] of questions) entry.turns[name] = await runTurn(server, threadId, [text(prompt)]);+ // v0.1-25 (user 2026-09-28): the user checks only the images the model asked for, the others stay unchecked, and+ // asks again; the model must now answer from the image (GPT-6 Luna kept saying it could not see it).+ const asked = askedIn(String(entry.turns[questions[questions.length - 1][0]]?.reply ?? ""));+ if (recheck && asked.length) {+ writeSelection({ threadId, unchecked: Object.fromEntries(Object.entries(unchecked).filter(([, value]) => !asked.includes(value.id))) }, selectionDirOf(data));+ await sleep(2500);+ entry.rechecked = asked;+ entry.turns.recheck = await runTurn(server, threadId, [text(words.recheck)]);+ }+ // The engine records a request once its response has ended, which can be just after the turn completes.+ await sleep(1500);entry.lastRequest = readRequestStats(threadId, join(data, "state", "requests"))?.lastHttp?.rewrite ?? null;result.threads.push(entry);return entry;};await run(1, [["lookNow", words.lookNow], ["whichImages", words.whichImages], ["detail", words.detail]]);- await run(2, [["detail", words.detail]]);+ await run(2, [["detail", words.detail]], true);} finally {result.notArchived = await archiveThreads(server, created);await server.stop();@@ -170,6 +185,7 @@ async function main(): Promise<void> {panelSees: askedIn(String(t.reply)), ids: [...new Set(String(t.reply).match(/IMG-\d{3}/g) ?? [])], asksForNewShots: words.newShots.test(t.reply),// v0.1-24: whether the reply uses the words the note asks for ("需要 IMG-xxx" / "need IMG-xxx").writesNeed: /需要\s*[“"*]*\s*IMG-\d{3}|\bneed\s*[“"*]*\s*IMG-\d{3}/i.test(String(t.reply)),+ ...(name === "recheck" ? { rechecked: entry.rechecked, answersColor: words.color.test(String(t.reply)) } : {}),tools: t.tools, status: t.status, errors: t.errors, reply: t.reply,}])),}));diff --git a/spike/src/v01-placeholder-selftest.ts b/spike/src/v01-placeholder-selftest.tsindex 30bd499..a08b3d9 100644--- a/spike/src/v01-placeholder-selftest.ts+++ b/spike/src/v01-placeholder-selftest.ts@@ -4,6 +4,8 @@// Runs a test engine of this checkout on its own port and data folder, so the user's running engine is not touched.// v0.1-14 — --lang en runs the same turns in English, with the engine told the panel shows English, so the English// text for the model is checked the same way.+// v0.1-25 — then the user checks a.png again while b.png, from the same message, is left out, and asks the detail+// again: the model must answer from the image, not say it cannot see it (GPT-6 Luna did, user 2026-09-28).// Input: [--label name] [--port 17899] [--lang zh|en]. Output: local/v01/placeholder-<label>.json (synthetic test thread// only).@@ -38,10 +40,13 @@ const SCRIPT = {canYouSee: "现在能看到a.png吗?",recall: "你刚才说 a.png 的背景是什么颜色、中间是什么形状?",newDetail: "a.png 里那个红色正方形的四个角,是直角还是圆角?",+ recheck: "我已经重新勾上 a.png 了。那个红色正方形的四个角,是直角还是圆角?",colors: [/白/, /红/, /黑/],recalled: [/白/, /(方|正方)/],retraction: RETRACTION,asks: (id: string) => new RegExp(`需要\\s*[“"*]*\\s*${id}`),+ corners: /直角|尖角/,+ cannotSee: /看不到|无法看到|没有看到|看不见/,},en: {name: (label: string) => `[CAM test] v0.1 placeholder self-test ${label}`,@@ -50,10 +55,13 @@ const SCRIPT = {canYouSee: "Can you see a.png now?",recall: "What did you say earlier about the background color of a.png and the shape in the middle?",newDetail: "Are the four corners of the red square in a.png sharp right angles or rounded?",+ recheck: "I checked a.png again. Are the four corners of the red square sharp right angles or rounded?",colors: [/white/i, /red/i, /black/i],recalled: [/white/i, /square/i],retraction: RETRACTION_EN,asks: (id: string) => new RegExp(`need\\s*["“*]*\\s*${id}`, "i"),+ corners: /sharp|right angle|square corners|90/i,+ cannotSee: /can[’']?t see|cannot see|can not see|not visible|don[’']?t see|unable to see/i,},};@@ -97,7 +105,15 @@ async function main(): Promise<void> {await turn("canYouSee", words.canYouSee);await turn("recall", words.recall);await turn("newDetail", words.newDetail);- result.lastRequest = readRequestStats(threadId, join(data, "state", "requests"))?.lastHttp?.rewrite ?? null;+ // The engine records a request once its response has ended, which can be just after the turn completes.+ const lastRewrite = async () => { await sleep(1500); return readRequestStats(threadId, join(data, "state", "requests"))?.lastHttp?.rewrite ?? null; };+ result.lastRequest = await lastRewrite();+ const b = index.images.find((image) => image.name === "b.png")!;+ result.bId = b.id;+ writeSelection({ threadId, unchecked: { [b.key]: { id: b.id, at: new Date().toISOString() } } }, selectionDirOf(data));+ await sleep(2500);+ await turn("recheck", words.recheck);+ result.recheckRequest = await lastRewrite();} finally {if (result.threadId) result.notArchived = await archiveThreads(server, [result.threadId]);await server.stop();@@ -111,6 +127,8 @@ async function main(): Promise<void> {recallKeepsEarlierAnswer: words.recalled.every((word) => word.test(reply("recall"))) && !words.retraction.test(reply("recall")),newDetailAsksForImage: words.asks(result.aId).test(reply("newDetail")),lastRequestReplacedA: JSON.stringify(result.lastRequest?.replaced?.map((r: Json) => `${r.id}:${r.mode}`)) === JSON.stringify([`${result.aId}:plain`]),+ recheckRequestSentA: JSON.stringify(result.recheckRequest?.replaced?.map((r: Json) => `${r.id}:${r.mode}`)) === JSON.stringify([`${result.bId}:plain`]),+ recheckAnswersFromImage: words.corners.test(reply("recheck")) && !words.cannotSee.test(reply("recheck")),noErrors: Object.values(result.turns as Record<string, Json>).every((t) => t.status === "completed" && !t.errors.length),};writeFileSync(join(root, `placeholder-${label}.json`), JSON.stringify(result, null, 2));