Skip to content

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.

feat(panel): 面板数据加上场景和搜索文字;去掉子代理和旁聊的开关

chipfighter72262b8e9e41
diff --git a/plugin/src/notes.ts b/plugin/src/notes.ts
index 121f471..51a39a5 100644
--- a/plugin/src/notes.ts
+++ b/plugin/src/notes.ts
@@ -1,4 +1,4 @@
-// Purpose: v0.8 — the record lines the model writes at the end of a reply (docs/v0.8/plan.md): a feature line for each
+// Purpose: v0.8 — the record lines the model writes at the start of a reply (docs/v0.8/plan.md): a feature line for each
// image new in that turn, or a rating the user gave an image, each as a Markdown link definition, which neither Codex
// Desktop nor Claude Desktop shows (gate 1, 2026-10-19): `[//]: # (cam IMG-015 深蓝雨夜|近景,正脸)`,
// `[//]: # (cam IMG-003 评价:太暗)`; in English `… (cam IMG-003 rated: too dark)`.
@@ -26,6 +26,9 @@ export function addNotes(notes: Map<string, Notes>, text: string, turn: number |
}
}
+// A reply as the user reads it: without its record lines.
+export const withoutRecords = (text: string): string => text.replace(RECORD, "").trim();
+
// The scene: the feature line's first part, before "|" (or " | " in English).
export function sceneOf(line: string | null): string | null {
const scene = line?.split(/||\s\|\s/)[0]?.trim();
diff --git a/plugin/src/panel-state.ts b/plugin/src/panel-state.ts
index 9941208..58c0c0a 100644
--- a/plugin/src/panel-state.ts
+++ b/plugin/src/panel-state.ts
@@ -6,17 +6,20 @@
// v0.2 — each image's source, which the panel filters by.
// v0.3 — automatic selection: the switch, the checkboxes meaning "pinned" while it is on (kept apart from the manual
// checks), and the images the model fetched in the latest turn.
-// v0.7 — a Codex task's subagents and side chats (children.ts), each with its last request and whether automatic
-// selection manages it, and the task's switch for them.
+// v0.7 — a Codex task's subagents and side chats (children.ts), each with its last request. v0.8: always managed by
+// automatic selection; the task's switch for them is gone.
+// v0.8 — what the panel searches and groups by, and never shows (docs/v0.8/plan.md): each image's scene (its feature
+// line's first part) and the feature line and ratings the model noted; and per turn, what was said in it.
// Input: thread id, the sessions directory (rollouts are only read) and the tool's data directory.
// Output: PanelState as plain JSON; selection changes are written to <data dir>/selection/.
import { readChildren } from "./children.ts";
-import { claudeHome, claudeImageData, claudeStartedAt, loadClaudeIndex, type ClaudeIndex } from "./claude-index.ts";
+import { claudeHome, claudeImageData, claudeStartedAt, isPrompt, loadClaudeIndex, type ClaudeIndex, type ClaudeRecord } from "./claude-index.ts";
import type { ImageSource } from "./images.ts";
+import { sceneOf, withoutRecords } from "./notes.ts";
import { childrenDirOf, claudeRequestStatsDirOf, claudeSelectionDirOf, dataDir, requestStatsDirOf, selectionDirOf } from "./paths.ts";
import { readRequestStats, type RequestStats } from "./request-stats.ts";
-import { claudeSelection, effectiveSelection, sideChatSelection, writeSelection, type Mark, type Selection } from "./selection.ts";
+import { claudeSelection, effectiveSelection, writeSelection, type Mark, type Selection } from "./selection.ts";
import { buildIndex, imageData, readThreadHistory, sessionMetaOf, type IndexedImage, type ThreadIndex } from "./thread-index.ts";
import { threadTitle } from "./thread-names.ts";
import { pngThumbnail } from "./thumbnail.ts";
@@ -36,6 +39,9 @@ export type PanelImage = {
inLastRequest: boolean | null; inNextRequest: boolean;
// v0.5: from before a Claude Code compaction: Claude Code no longer sends it, the engine sends it again if checked.
compacted: boolean;
+ // v0.8: the scene the model named in its feature line (null: none noted), and the line and ratings themselves, for
+ // the search only.
+ scene: string | null; search: string;
};
export type SendInfo = {
// The last full HTTP request as Codex built it, before any rewrite: the baseline of the estimate.
@@ -53,17 +59,19 @@ export type SendInfo = {
// historyMissing: an earlier part of the history is gone for good (e.g. the task a fork came from was deleted), so the
// images in it are not listed (v0.1-13).
// auto: automatic selection is on (v0.3); fetched: the ids the model fetched in the latest turn.
-// childrenAuto: the task's switch for its subagents and side chats; children: those the engine has seen (v0.7).
+// children: the subagents and side chats the engine has seen (v0.7).
+// turnTexts: v0.8, what each turn said, by turn number, for the search only (turnTexts below).
export type PanelState = {
threadId: string; title: string | null; started: boolean; historyMissing: boolean; turns: number; images: PanelImage[]; requested: string[];
auto: boolean; fetched: string[];
totals: { images: number; unchecked: number; checkedBytes: number; allBytes: number };
send: SendInfo;
- childrenAuto: boolean; children: ChildInfo[];
+ children: ChildInfo[];
+ turnTexts: Record<string, string>;
};
-// v0.7: a subagent (name: its nickname in Codex) or side chat, when it first sent a request, whether automatic selection
-// manages it now, and its last full request (images: how many it carried, as Codex built it).
-export type ChildInfo = { threadId: string; kind: "subagent" | "side"; name: string | null; startedAt: string; auto: boolean; images: number | null; last: SendInfo["last"] };
+// v0.7: a subagent (name: its nickname in Codex) or side chat, when it first sent a request, and its last full request
+// (images: how many it carried, as Codex built it).
+export type ChildInfo = { threadId: string; kind: "subagent" | "side"; name: string | null; startedAt: string; images: number | null; last: SendInfo["last"] };
// The engine's reasons for forwarding a request unchanged, as codes the panel says in its language (v0.1-14).
export type SkipReason = "undecodable" | "unparsable" | "format" | "integer" | "index" | "other";
@@ -147,14 +155,62 @@ export function sameContent(index: ThreadIndex, image: IndexedImage): string[] {
.map((other) => other.id);
}
+// v0.8: what each turn said, for the search only: the user's own words, the model's replies without their record
+// lines, and what the tools were called with (a generation's prompt, a viewed path); each piece and each turn cut short,
+// so a long task does not make every read of the panel large. The turns are numbered as in the index.
+const PIECE = 200;
+const TURN_TEXT = 600;
+const joinTurns = (texts: Map<number, string[]>): Record<string, string> =>
+ Object.fromEntries([...texts].map(([turn, pieces]) => [String(turn), pieces.join(" ").slice(0, TURN_TEXT)]));
+const piece = (texts: Map<number, string[]>, turn: number, text: unknown) => {
+ // Text the client adds (instructions, the environment, an image's tag) starts with a tag or the AGENTS.md heading.
+ if (typeof text !== "string" || /^\s*(?:<|# AGENTS\.md)/.test(text)) return;
+ const said = withoutRecords(text).replace(/\s+/g, " ").trim().slice(0, PIECE);
+ if (said) texts.set(turn, [...(texts.get(turn) ?? []), said]);
+};
+export function codexTurnTexts(history: Record_[]): Record<string, string> {
+ const numbers = new Map<string, number>();
+ const texts = new Map<number, string[]>();
+ let turn: number | null = null;
+ for (const record of history) {
+ if (record.type === "event_msg" && record.payload.type === "task_started" && record.payload.turn_id) {
+ if (!numbers.has(record.payload.turn_id)) numbers.set(record.payload.turn_id, numbers.size + 1);
+ turn = numbers.get(record.payload.turn_id)!;
+ }
+ if (turn === null || record.type !== "response_item") continue;
+ const item = record.payload;
+ if (item.type === "message" && (item.role === "user" || item.role === "assistant") && Array.isArray(item.content)) for (const part of item.content) piece(texts, turn, part?.text);
+ else if (item.type === "function_call") piece(texts, turn, item.arguments);
+ else if (item.type === "custom_tool_call") piece(texts, turn, item.input);
+ else if (item.type === "image_generation_call") piece(texts, turn, item.revised_prompt);
+ }
+ return joinTurns(texts);
+}
+export function claudeTurnTexts(chain: ClaudeRecord[]): Record<string, string> {
+ const texts = new Map<number, string[]>();
+ let turn = 0;
+ for (const record of chain) {
+ if (record.type === "user" && isPrompt(record)) turn++;
+ const content = record.message?.content;
+ if (!turn || (record.type !== "user" && record.type !== "assistant") || record.isMeta || record.isCompactSummary) continue;
+ if (typeof content === "string") { piece(texts, turn, content); continue; }
+ if (!Array.isArray(content)) continue;
+ for (const block of content) {
+ if (block?.type === "text") piece(texts, turn, block.text);
+ else if (block?.type === "tool_use" && record.type === "assistant") piece(texts, turn, JSON.stringify(block.input ?? {}));
+ }
+ }
+ return joinTurns(texts);
+}
+
// `unchecked`: the keys whose box is not ticked (v0.3: with automatic selection on, every image not pinned).
export function panelState(threadId: string, history: Record_[], index: ThreadIndex, unchecked: Set<string>, stats: RequestStats | null, title: string | null = null, auto = false): PanelState {
- return panelStateOf(threadId, index, unchecked, stats, title, auto, requestedIds(history), history.length > 0);
+ return panelStateOf(threadId, index, unchecked, stats, title, auto, requestedIds(history), history.length > 0, codexTurnTexts(history));
}
// v0.4: the same for any index: Codex's (from a rollout) or Claude Code's (claude-index.ts), with the ids the model's
// latest reply asked for and whether the conversation has started.
-export function panelStateOf(threadId: string, index: ThreadIndex, unchecked: Set<string>, stats: RequestStats | null, title: string | null, auto: boolean, requested: string[], started: boolean): PanelState {
+export function panelStateOf(threadId: string, index: ThreadIndex, unchecked: Set<string>, stats: RequestStats | null, title: string | null, auto: boolean, requested: string[], started: boolean, turnTexts: Record<string, string> = {}): PanelState {
const fetched = [...new Set([...index.copies.values()].filter((copy) => copy.turn !== null && copy.turn === index.turns).map((copy) => copy.of))];
const carried: Record<string, number> | null = stats?.lastHttp?.imageSizes ?? null;
// Images after the last one that request carried, or from a later turn, were added since and go out next time.
@@ -164,6 +220,7 @@ export function panelStateOf(threadId: string, index: ThreadIndex, unchecked: Se
const inLast = carried ? image.key in carried : null;
// v0.5: Claude Code's images from before a compaction (claude-index.ts) go out again from the engine when checked.
const compacted = "compacted" in image && image.compacted === true;
+ const notes = index.notes?.get(image.id);
return {
id: image.id, kind: image.kind, name: image.name, label: image.label, turn: image.turn,
source: image.source, pdfPage: image.pdfPage, pdfName: image.pdfName,
@@ -176,6 +233,8 @@ export function panelStateOf(threadId: string, index: ThreadIndex, unchecked: Se
inLastRequest: inLast,
inNextRequest: compacted || inLast !== false || position > lastCarried || (lastTurn !== null && image.turn !== null && image.turn > lastTurn),
compacted,
+ scene: sceneOf(notes?.line ?? null),
+ search: [notes?.line, ...(notes?.ratings ?? []).map((rating) => rating.text)].filter(Boolean).join(" "),
};
});
return {
@@ -187,24 +246,22 @@ export function panelStateOf(threadId: string, index: ThreadIndex, unchecked: Se
allBytes: images.reduce((sum, image) => sum + image.bytes, 0),
},
send: sendInfo(stats),
- childrenAuto: true, children: [],
+ children: [],
+ turnTexts,
};
}
// v0.7: oldest first, as the engine first saw each one.
-function childrenOf(taskId: string, selection: Selection, options: PanelOptions): Pick<PanelState, "childrenAuto" | "children"> {
+function childrenOf(taskId: string, options: PanelOptions): ChildInfo[] {
const root = options.dataRoot ?? dataDir();
- const dir = selectionDirOf(root);
- const children = Object.entries(readChildren(taskId, childrenDirOf(root)))
+ return Object.entries(readChildren(taskId, childrenDirOf(root)))
.sort(([, a], [, b]) => a.at.localeCompare(b.at))
.map(([threadId, child]): ChildInfo => {
const stats = readRequestStats(threadId, requestStatsDirOf(root));
const spawn = child.kind === "subagent" ? sessionMetaOf(options.sessionsDir, threadId)?.source?.subagent?.thread_spawn : null;
- const auto = child.kind === "side" ? sideChatSelection(child.from, options.sessionsDir, dir) !== null : !!effectiveSelection(threadId, options.sessionsDir, dir).auto;
const images = stats?.lastHttp?.images;
- return { threadId, kind: child.kind, name: spawn?.agent_nickname ?? spawn?.agent_path?.split("/").pop() ?? null, startedAt: child.at, auto, images: typeof images === "number" ? images : null, last: sendInfo(stats).last };
+ return { threadId, kind: child.kind, name: spawn?.agent_nickname ?? spawn?.agent_path?.split("/").pop() ?? null, startedAt: child.at, images: typeof images === "number" ? images : null, last: sendInfo(stats).last };
});
- return { childrenAuto: selection.childrenAuto !== false, children };
}
// A thread with no rollout yet (new, or the panel opened outside a thread) simply has no images. An earlier part of
@@ -239,24 +296,23 @@ function offKeys(index: ThreadIndex, selection: Selection): Set<string> {
export function loadPanelState(threadId: string, options: PanelOptions): PanelState {
const { history, index, selection, stats, title, historyMissing } = load(threadId, options);
- return { ...panelState(threadId, history, index, offKeys(index, selection), stats, title, !!selection.auto), historyMissing, ...childrenOf(threadId, selection, options) };
+ return { ...panelState(threadId, history, index, offKeys(index, selection), stats, title, !!selection.auto), historyMissing, children: childrenOf(threadId, options) };
}
// v0.3: `auto` switches automatic selection; with `mode: "auto"` a tick pins an image instead of sending it, each kept
-// in its own record, so switching back finds the manual checks as they were. v0.7: `childrenAuto` switches it for the
-// task's subagents and side chats.
-export type SelectionChange = { uncheck?: string[]; check?: string[]; checkAll?: boolean; auto?: boolean; mode?: "manual" | "auto"; childrenAuto?: boolean };
+// in its own record, so switching back finds the manual checks as they were.
+export type SelectionChange = { uncheck?: string[]; check?: string[]; checkAll?: boolean; auto?: boolean; mode?: "manual" | "auto" };
export function applySelection(threadId: string, change: SelectionChange, options: PanelOptions): PanelState {
const { root, history, index, selection, stats, title, historyMissing } = load(threadId, options);
const next = changedSelection(threadId, index, selection, change);
writeSelection(next, selectionDirOf(root));
- return { ...panelState(threadId, history, index, offKeys(index, next), stats, title, !!next.auto), historyMissing, ...childrenOf(threadId, next, options) };
+ return { ...panelState(threadId, history, index, offKeys(index, next), stats, title, !!next.auto), historyMissing, children: childrenOf(threadId, options) };
}
// The selection after a change; nothing is written.
export function changedSelection(threadId: string, index: ThreadIndex, selection: Selection, change: SelectionChange): Selection {
const now = new Date().toISOString();
- let next: Selection = { ...selection, threadId, ...(typeof change.childrenAuto === "boolean" ? { childrenAuto: change.childrenAuto } : {}) };
+ let next: Selection = { ...selection, threadId };
// Switched on for the first time, the thread is marked: from then on its history may hold copies the model fetched.
if (typeof change.auto === "boolean" && change.auto !== !!selection.auto) next = { ...next, auto: change.auto, autoAt: now, autoSince: selection.autoSince ?? now };
const pins = change.mode === "auto";
@@ -308,7 +364,7 @@ function loadClaude(sessionId: string, options: ClaudePanelOptions) {
}
const claudeState = (sessionId: string, index: ClaudeIndex, selection: Selection, stats: RequestStats | null): PanelState =>
- panelStateOf(sessionId, index, offKeys(index, selection), stats, index.title, !!selection.auto, [...new Set(index.replies.flatMap(askedIn))], index.chain.length > 0);
+ panelStateOf(sessionId, index, offKeys(index, selection), stats, index.title, !!selection.auto, [...new Set(index.replies.flatMap(askedIn))], index.chain.length > 0, claudeTurnTexts(index.chain));
export function loadClaudePanelState(sessionId: string, options: ClaudePanelOptions = {}): PanelState {
const { index, selection, stats } = loadClaude(sessionId, options);
diff --git a/plugin/src/plugin-server.ts b/plugin/src/plugin-server.ts
index bea9432..9adc389 100644
--- a/plugin/src/plugin-server.ts
+++ b/plugin/src/plugin-server.ts
@@ -38,7 +38,7 @@ import { migrateDataOnce } from "./migrate-data.ts";
import { applySelection, claudeImageFor, imageFor, loadPanelState, type ClaudePanelOptions, type PanelState } from "./panel-state.ts";
import { claudeSelectionDirOf, dataDir, pixelCacheDirOf, selectionDirOf } from "./paths.ts";
import { fetchedLabel, fetchWords } from "./rewrite.ts";
-import { claudeSelection, effectiveSelection, ensureAutoDefault, sideChatSelection } from "./selection.ts";
+import { claudeSelection, effectiveSelection, ensureAutoDefault } from "./selection.ts";
import { connectDirectly, useEngine, usesEngine } from "./setup.ts";
import { hasRollout, loadThreadIndex, readThreadHistory, sessionMetaOf, setPixelCache, sideChatOrigin } from "./thread-index.ts";
import { threadTitle } from "./thread-names.ts";
@@ -68,7 +68,7 @@ export function toolsFor(lang: Lang) {
name: "cam_set_selection",
title: say(lang, "tool.select.title"),
description: say(lang, "tool.select.description"),
- inputSchema: { type: "object", properties: { ...shared, uncheck: { type: "array", items: { type: "string" } }, check: { type: "array", items: { type: "string" } }, checkAll: { type: "boolean" }, auto: { type: "boolean" }, mode: { type: "string", enum: ["manual", "auto"] }, childrenAuto: { type: "boolean" } } },
+ inputSchema: { type: "object", properties: { ...shared, uncheck: { type: "array", items: { type: "string" } }, check: { type: "array", items: { type: "string" } }, checkAll: { type: "boolean" }, auto: { type: "boolean" }, mode: { type: "string", enum: ["manual", "auto"] } } },
_meta: APP_ONLY,
},
{
@@ -189,7 +189,7 @@ export function callTool(name: string, args: Json, meta: Json | undefined, sessi
}
if (name === "cam_set_selection") {
if (fromModel(meta)) throw new Error(say(lang, "call.modelSelect"));
- const state = applySelection(threadId, { uncheck: args.uncheck, check: args.check, checkAll: args.checkAll, auto: typeof args.auto === "boolean" ? args.auto : undefined, mode: args.mode === "auto" ? "auto" : "manual", childrenAuto: typeof args.childrenAuto === "boolean" ? args.childrenAuto : undefined }, options);
+ const state = applySelection(threadId, { uncheck: args.uncheck, check: args.check, checkAll: args.checkAll, auto: typeof args.auto === "boolean" ? args.auto : undefined, mode: args.mode === "auto" ? "auto" : "manual" }, options);
return { content: [{ type: "text", text: summary(lang, state) }], structuredContent: panel(state) };
}
if (name === "cam_bind") {
@@ -217,7 +217,7 @@ export function callTool(name: string, args: Json, meta: Json | undefined, sessi
const origin = sideChatOrigin(threadId, meta?.["x-codex-turn-metadata"]?.forked_from_thread_id, sessionsDir);
const dir = selectionDirOf(dataDir());
// Only where the user switched automatic selection on; otherwise images come back only when the user checks them.
- if (origin ? !sideChatSelection(origin, sessionsDir, dir) : !effectiveSelection(threadId, sessionsDir, dir).auto) {
+ if (!origin && !effectiveSelection(threadId, sessionsDir, dir).auto) {
log({ event: "fetch", threadId, ...(origin ? { from: origin } : {}), ids, refused: "automatic selection is off" });
return { content: [{ type: "text", text: words.off }], isError: true };
}
diff --git a/plugin/src/proxy.ts b/plugin/src/proxy.ts
index 45fc0a4..ec734c2 100644
--- a/plugin/src/proxy.ts
+++ b/plugin/src/proxy.ts
@@ -254,12 +254,11 @@ export function hasUnchecked(threadId: string | null, dir = selectionDir, sessio
// Whether a thread's requests go through the rewrite (and so over HTTP): something unchecked, or automatic selection
// used at some point (v0.3), since from then on the history may hold copies the model fetched, left out of later turns.
-// v0.7: a side chat's, unless its task's switch for subagents and side chats is off.
+// v0.7: a side chat's, always (v0.8: the switch for subagents and side chats is gone).
export function needsRewrite(threadId: string | null, dir = selectionDir, sessionsDir = join(codexHome(), "sessions"), forkedFrom: string | null = null): boolean {
if (!threadId) return false;
try {
- const origin = sideChatOrigin(threadId, forkedFrom, sessionsDir);
- if (origin) return sideChatSelection(origin, sessionsDir, dir) !== null;
+ if (sideChatOrigin(threadId, forkedFrom, sessionsDir)) return true;
const selection = effectiveSelection(threadId, sessionsDir, dir);
return Object.keys(selection.unchecked).length > 0 || !!selection.autoSince;
} catch { return false; }
@@ -281,7 +280,6 @@ export function currentTurnOf(index: ThreadIndex, turnId: string | null): number
export function rewriteBody(original: Buffer, encoding: string | undefined, threadId: string, sessionsDir: string, dir = selectionDir, turnId: string | null = null, forkedFrom: string | null = null): { body: Buffer; report: Json } {
const origin = sideChatOrigin(threadId, forkedFrom, sessionsDir);
const side = origin ? sideChatSelection(origin, sessionsDir, dir) : null;
- if (origin && !side) return { body: original, report: { sideChatOf: origin, off: true } };
const decoded = decodeBody(original, encoding);
if (!decoded) return { body: original, report: { skipped: "undecodable body" } };
const text = decoded.toString("utf8");
diff --git a/plugin/src/selection.ts b/plugin/src/selection.ts
index ec5725b..469727b 100644
--- a/plugin/src/selection.ts
+++ b/plugin/src/selection.ts
@@ -10,11 +10,11 @@
// 2026-10-13: every new task and session, in Codex and Claude Code; the ones from before keep what they had). That
// time is written once next to the selections (auto-default.json); a thread's own switch always wins, and the default
// itself is never written down.
-// v0.7 — a task's subagents (started without history) and side chats get automatic selection unless the user turned
-// that off in the task's panel ("childrenAuto": false; user 2026-10-13), whatever the task's own switch says.
+// v0.7 — a task's subagents (started without history) and side chats get automatic selection, whatever the task's own
+// switch says. v0.8: always; the panel's switch for them is gone (user 2026-10-19), and a "childrenAuto": false that
+// v0.7 wrote is ignored.
// Input/Output: <data dir>/selection/<thread id>.json, e.g. { "threadId": "…", "unchecked": { "<key>": { "id": "IMG-003", "at": "…" } } },
-// plus "auto", "autoAt", "autoSince" and "pinned" (same shape as "unchecked") once automatic selection has been used,
-// and "childrenAuto" once the switch for subagents and side chats has been changed.
+// plus "auto", "autoAt", "autoSince" and "pinned" (same shape as "unchecked") once automatic selection has been used.
import { existsSync, mkdirSync, readFileSync, renameSync, statSync, writeFileSync } from "node:fs";
import { join } from "node:path";
@@ -22,7 +22,7 @@ import { selectionDirOf } from "./paths.ts";
import { forkOrigin, spawnParent, threadStartedAt } from "./thread-index.ts";
export type Mark = { id: string; at: string };
-export type Selection = { threadId: string; unchecked: Record<string, Mark>; auto?: boolean; autoAt?: string; autoSince?: string; pinned?: Record<string, Mark>; inheritedFrom?: string; childrenAuto?: boolean };
+export type Selection = { threadId: string; unchecked: Record<string, Mark>; auto?: boolean; autoAt?: string; autoSince?: string; pinned?: Record<string, Mark>; inheritedFrom?: string };
export const selectionDir = selectionDirOf();
const THREAD_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
@@ -95,11 +95,11 @@ export function claudeSelection(sessionId: string, dir: string, startedAt: strin
// (a fork of a fork asks its own parent in turn) and keeps them as its own file from then on. v0.3: likewise the
// pinned images and the switch, when it was turned on before the fork. v0.6: then the default applies, a fork
// counting from the thread it came from.
-// v0.7: a subagent without a switch of its own follows its task's switch for subagents and side chats instead.
+// v0.7: a subagent without a switch of its own has automatic selection instead.
export function effectiveSelection(threadId: string, sessionsDir: string, dir = selectionDir, depth = 0): Selection {
const own = ownSelection(threadId, sessionsDir, dir, depth);
- const main = typeof own.auto === "boolean" || depth > 16 ? null : mainTaskOf(sessionsDir, threadId);
- if (main) return childSelection(own, effectiveSelection(main, sessionsDir, dir, depth + 1), threadStartedAt(sessionsDir, threadId));
+ const subagent = typeof own.auto === "boolean" || depth > 16 ? false : mainTaskOf(sessionsDir, threadId) !== null;
+ if (subagent) return childSelection(own, threadStartedAt(sessionsDir, threadId));
return withAutoDefault(own, threadStartedAt(sessionsDir, threadId), autoDefaultSince(dir));
}
@@ -111,17 +111,14 @@ export function mainTaskOf(sessionsDir: string, threadId: string, depth = 0): st
return (depth < 16 ? mainTaskOf(sessionsDir, parent, depth + 1) : null) ?? parent;
}
-// v0.7: on, automatic selection from the subagent's start; off, none, so its requests go out as they are.
-export function childSelection(own: Selection, main: Selection, startedAt: string | null): Selection {
- if (main.childrenAuto === false) return { ...own, auto: false };
+// v0.7: automatic selection from the subagent's start.
+export function childSelection(own: Selection, startedAt: string | null): Selection {
return { ...own, auto: true, autoSince: own.autoSince ?? startedAt ?? new Date().toISOString() };
}
// v0.7: what a side chat forked from `origin` is sent with: the images of that task, every one of its turns counting as
-// earlier, so all of them are left out but the ones pinned there. null when its task's switch is off.
-export function sideChatSelection(origin: string, sessionsDir: string, dir = selectionDir): Selection | null {
- const main = mainTaskOf(sessionsDir, origin) ?? origin;
- if (effectiveSelection(main, sessionsDir, dir).childrenAuto === false) return null;
+// earlier, so all of them are left out but the ones pinned there.
+export function sideChatSelection(origin: string, sessionsDir: string, dir = selectionDir): Selection {
const from = effectiveSelection(origin, sessionsDir, dir);
return { threadId: origin, unchecked: {}, auto: true, autoSince: from.autoSince ?? new Date().toISOString(), ...(from.pinned ? { pinned: from.pinned } : {}) };
}
diff --git a/spike/src/notes.test.ts b/spike/src/notes.test.ts
index f151206..be97bc5 100644
--- a/spike/src/notes.test.ts
+++ b/spike/src/notes.test.ts
@@ -13,7 +13,9 @@ import { findImages, type ImageRef } from "../../plugin/src/images.ts";
import { addNotes, sceneOf, type Notes } from "../../plugin/src/notes.ts";
import { autoPlaceholder, clip, featureNote, plainPlaceholder, rewriteItems, type Described } from "../../plugin/src/rewrite.ts";
import { buildIndex, writesNotes, type Parsed } from "../../plugin/src/thread-index.ts";
+import { claudeTurnTexts, loadPanelState, panelStateOf } from "../../plugin/src/panel-state.ts";
import { image, pngA, pngB, text, transcript } from "./claude-fixtures.ts";
+import { assistant, line, sampleSessions, THREAD, turn } from "./testfixtures.ts";
import { png } from "./testkit.ts";
const notesOf = (text: string, turn: number | null = 1) => {
@@ -193,3 +195,36 @@ test("a subagent's model writes no feature lines; the user's own task does, also
assert.equal(writesNotes(sessions, forkedSub), false);
assert.equal(writesNotes(sessions, "01a15100-0000-7000-8000-000000000009"), true, "no rollout yet");
});
+
+// The panel searches and groups by these and never shows them (docs/v0.8/plan.md).
+test("the panel's data: each image's scene and noted words, and per turn what was said, without the record lines", () => {
+ const long = "很长的一段话".repeat(60);
+ const options = sampleSessions(
+ turn("t3") +
+ line("response_item", { type: "message", role: "user", content: [{ type: "input_text", text: "<environment_context>…</environment_context>" }, { type: "input_text", text: "第一张太暗了" }], internal_chat_message_metadata_passthrough: { turn_id: "t3" } }) +
+ line("response_item", { type: "function_call", name: "imagegen", arguments: "{\"prompt\":\"深蓝雨夜 近景\"}", call_id: "c1" }) +
+ assistant(`[//]: # (cam IMG-001 深蓝雨夜|近景,正脸)\n[//]: # (cam IMG-002 评价:太暗)\n\n明白。${long}`, "t3"),
+ );
+ const state = loadPanelState(THREAD, options);
+ assert.deepEqual(state.images.map((image) => [image.id, image.scene, image.search]), [
+ ["IMG-001", "深蓝雨夜", "深蓝雨夜|近景,正脸"],
+ ["IMG-002", null, "太暗"],
+ ["IMG-003", null, ""],
+ ]);
+ // Turn 1's own message holds only the images' tags; what the client adds is left out.
+ assert.deepEqual([state.turnTexts["1"], state.turnTexts["2"]], ["收到", "需要 IMG-001。IMG-003 与 IMG-002 相同。"]);
+ assert.match(state.turnTexts["3"], /^第一张太暗了 \{"prompt":"深蓝雨夜 近景"\} 明白。很长的一段话/);
+ assert.ok(!state.turnTexts["3"].includes("[//]") && !state.turnTexts["3"].includes("environment_context"));
+ assert.ok(state.turnTexts["3"].length <= 600, "cut short");
+
+ const t = transcript();
+ t.prompt([image(pngA), text("看这张")]);
+ t.assistant({ type: "tool_use", id: "toolu_1", name: "Read", input: { file_path: "C:\\work\\b.png" } });
+ t.assistant(text("[//]: # (cam IMG-001 white room | wide shot)\n\nA white room."));
+ t.prompt("<system-reminder>x</system-reminder>", { isMeta: true });
+ t.prompt("Too bright");
+ const index = buildClaudeIndex("s", t.records);
+ assert.deepEqual(claudeTurnTexts(index.chain), { "1": "看这张 {\"file_path\":\"C:\\\\work\\\\b.png\"} A white room.", "2": "Too bright" });
+ const claude = panelStateOf("s", index, new Set(), null, null, true, [], true, claudeTurnTexts(index.chain));
+ assert.deepEqual([claude.images[0].scene, claude.images[0].search], ["white room", "white room | wide shot"]);
+});
diff --git a/spike/src/panel-state.test.ts b/spike/src/panel-state.test.ts
index c08a4b1..4da71ed 100644
--- a/spike/src/panel-state.test.ts
+++ b/spike/src/panel-state.test.ts
@@ -243,27 +243,21 @@ test("a fork whose earlier history is gone lists the images left and says part o
});
// v0.7: the task's subagents and side chats, from the engine's record of them and their own requests.
-test("the task's panel lists its subagents and side chats with their last request, and the switch for them", () => {
+test("the task's panel lists its subagents and side chats with their last request", () => {
const options = sampleSessions();
const CHILD = "01a0d307-0000-7000-8000-0000000000e1";
const SIDE = "01a0d307-0000-7000-8000-0000000000e2";
- assert.deepEqual([loadPanelState(THREAD, options).childrenAuto, loadPanelState(THREAD, options).children], [true, []]);
+ assert.deepEqual(loadPanelState(THREAD, options).children, []);
// A subagent has a rollout naming its parent, started now (today's folder); a side chat has none.
startThread(options.sessionsDir, CHILD, { parent_thread_id: THREAD, source: { subagent: { thread_spawn: { parent_thread_id: THREAD, depth: 1, agent_path: "/root/reviewer", agent_nickname: "Franklin" } } }, thread_source: "subagent" });
const children = childrenDirOf(options.dataRoot);
recordChild(THREAD, SIDE, { kind: "side", from: THREAD, at: "2026-09-24T10:06:00Z" }, children);
recordChild(THREAD, CHILD, { kind: "subagent", from: THREAD, at: "2026-09-24T10:05:00Z" }, children);
recordRequest(SIDE, { at: "2026-09-24T10:07:00Z", transport: "http", images: 3, decodedBytes: 9000, rewrite: { images: 3, replaced: [{ id: "IMG-001" }, { id: "IMG-002" }, { id: "IMG-003" }], decodedAfter: 1000, auto: true, sideChatOf: THREAD } }, requestStatsDirOf(options.dataRoot));
- let state = loadPanelState(THREAD, options);
- assert.equal(state.childrenAuto, true);
+ const state = loadPanelState(THREAD, options);
// Oldest first; the subagent has sent nothing through the engine yet.
- assert.deepEqual(state.children.map((child) => [child.threadId, child.kind, child.name, child.startedAt, child.auto, child.images, child.last?.replaced ?? null, child.last?.bytesAfter ?? null]), [
- [CHILD, "subagent", "Franklin", "2026-09-24T10:05:00Z", true, null, null, null],
- [SIDE, "side", null, "2026-09-24T10:06:00Z", true, 3, 3, 1000],
+ assert.deepEqual(state.children.map((child) => [child.threadId, child.kind, child.name, child.startedAt, child.images, child.last?.replaced ?? null, child.last?.bytesAfter ?? null]), [
+ [CHILD, "subagent", "Franklin", "2026-09-24T10:05:00Z", null, null, null],
+ [SIDE, "side", null, "2026-09-24T10:06:00Z", 3, 3, 1000],
]);
- // Switched off in the panel: neither is managed; the task's own switch and checks stay as they were.
- state = applySelection(THREAD, { childrenAuto: false }, options);
- assert.deepEqual([state.childrenAuto, state.children.map((child) => child.auto)], [false, [false, false]]);
- assert.deepEqual(readSelection(THREAD, join(options.dataRoot, "selection")), { threadId: THREAD, unchecked: {}, childrenAuto: false });
- assert.deepEqual(applySelection(THREAD, { childrenAuto: true }, options).children.map((child) => child.auto), [true, true]);
});
diff --git a/spike/src/plugin-server.test.ts b/spike/src/plugin-server.test.ts
index 67c2432..4c4291c 100644
--- a/spike/src/plugin-server.test.ts
+++ b/spike/src/plugin-server.test.ts
@@ -93,7 +93,7 @@ test("the model fetches originals by id only where automatic selection is on (v0
});
// v0.7: Codex keeps a side chat in memory only; the model's calls there name the task it was forked from.
-test("in a side chat the model fetches the originals of the task it came from, unless the user turned that off", () => {
+test("in a side chat the model fetches the originals of the task it came from", () => {
const { sessionsDir, dataRoot } = sampleSessions();
process.env.CAM_DATA_DIR = dataRoot;
try {
@@ -104,13 +104,9 @@ test("in a side chat the model fetches the originals of the task it came from, u
assert.equal(on.isError, false);
assert.equal(on.content[0].text, "[图片 IMG-001 取回的原图|a.png|用户上传|第 1 轮|64×32]");
assert.equal(Buffer.from(on.content[1].data, "base64").equals(red), true);
- assert.equal(callTool("cam_panel", {}, panelMeta, sessionsDir).structuredContent.childrenAuto, true);
- // Only the user switches it, in the task's panel.
- assert.throws(() => callTool("cam_set_selection", { childrenAuto: false }, modelMeta, sessionsDir), /只有用户能勾选或取消/);
- assert.equal(callTool("cam_set_selection", { childrenAuto: false }, panelMeta, sessionsDir).structuredContent.childrenAuto, false);
- const off = callTool("cam_view_image", { ids: ["IMG-001"] }, sideMeta, sessionsDir);
- assert.equal(off.isError, true);
- assert.match(off.content[0].text, /没有开自动选图/);
+ // v0.8: no switch for side chats any more; one v0.7 turned off changes nothing.
+ writeSelection({ threadId: THREAD, unchecked: {}, childrenAuto: false } as Parameters<typeof writeSelection>[0], join(dataRoot, "selection"));
+ assert.equal(callTool("cam_view_image", { ids: ["IMG-001"] }, sideMeta, sessionsDir).isError, false);
} finally {
delete process.env.CAM_DATA_DIR;
}
diff --git a/spike/src/proxy.test.ts b/spike/src/proxy.test.ts
index 52e53e5..e633fc6 100644
--- a/spike/src/proxy.test.ts
+++ b/spike/src/proxy.test.ts
@@ -455,10 +455,10 @@ test("a side chat's request is rewritten with the images of the task it came fro
writeSelection({ threadId, unchecked: {}, auto: true, autoAt: "2026-10-06T10:00:00Z", autoSince: "2026-10-06T10:00:00Z", pinned }, selections);
const kept = zlib.zstdDecompressSync(rewriteBody(original, "zstd", SIDE, sessions, selections, "side-turn", threadId).body).toString("utf8");
assert.ok(!kept.includes(red.slice(30)) && kept.includes(blue.slice(30)));
- // Turned off in the task's panel.
- writeSelection({ threadId, unchecked: {}, auto: true, autoAt: "2026-10-06T10:00:00Z", autoSince: "2026-10-06T10:00:00Z", pinned, childrenAuto: false }, selections);
- assert.equal(needsRewrite(SIDE, selections, sessions, threadId), false);
- assert.equal(rewriteBody(original, "zstd", SIDE, sessions, selections, "side-turn", threadId).body, original);
+ // v0.8: a switch v0.7 turned off in the task's panel changes nothing.
+ writeSelection({ threadId, unchecked: {}, auto: true, autoAt: "2026-10-06T10:00:00Z", autoSince: "2026-10-06T10:00:00Z", pinned, childrenAuto: false } as Parameters<typeof writeSelection>[0], selections);
+ assert.equal(needsRewrite(SIDE, selections, sessions, threadId), true);
+ assert.notEqual(rewriteBody(original, "zstd", SIDE, sessions, selections, "side-turn", threadId).body, original);
// A thread with a rollout of its own is no side chat, whatever its requests say (a fork the user made).
assert.equal(needsRewrite(threadId, selections, sessions, "01a0d307-0000-7000-8000-0000000000b9"), true);
});
diff --git a/spike/src/selection.test.ts b/spike/src/selection.test.ts
index a91869f..2323e81 100644
--- a/spike/src/selection.test.ts
+++ b/spike/src/selection.test.ts
@@ -164,9 +164,9 @@ test("v0.7: a subagent started without history belongs to the task at the top of
for (const other of [FORKED_CHILD, MAIN, REVIEW, "01a0d307-0000-7000-8000-0000000000af"]) assert.equal(mainTaskOf(sessionsDir, other), null, other);
});
-test("v0.7: a subagent follows its task's switch for subagents and side chats, on unless the user turned it off", () => {
+test("v0.7: a subagent has automatic selection, whatever its task's own switch says", () => {
const { sessionsDir, dir } = family();
- // No default for the task itself here (no auto-default.json): the subagents' switch is on regardless.
+ // No default for the task itself here (no auto-default.json): its subagents have it regardless.
const child = effectiveSelection(CHILD, sessionsDir, dir);
assert.deepEqual([child.auto, child.autoSince], [true, "2026-09-24T10:05:00Z"], "from the subagent's start");
assert.equal(needsRewrite(CHILD, dir, sessionsDir), true);
@@ -174,25 +174,25 @@ test("v0.7: a subagent follows its task's switch for subagents and side chats, o
// The task's own switch is a different one.
writeSelection({ threadId: MAIN, unchecked: {}, auto: false, autoAt: "2026-09-24T10:01:00Z", autoSince: "2026-09-24T10:00:30Z" }, dir);
assert.equal(effectiveSelection(CHILD, sessionsDir, dir).auto, true);
- // Turned off: nothing is managed, so the requests go out as they are.
- writeSelection({ threadId: MAIN, unchecked: {}, childrenAuto: false }, dir);
- assert.equal(effectiveSelection(CHILD, sessionsDir, dir).auto, false);
- assert.equal(effectiveSelection(GRANDCHILD, sessionsDir, dir).auto, false);
- assert.equal(needsRewrite(CHILD, dir, sessionsDir), false);
+ // v0.8: the switch v0.7 had for them is gone; one it turned off stays without effect.
+ writeSelection({ threadId: MAIN, unchecked: {}, childrenAuto: false } as Parameters<typeof writeSelection>[0], dir);
+ assert.equal(effectiveSelection(CHILD, sessionsDir, dir).auto, true);
+ assert.equal(effectiveSelection(GRANDCHILD, sessionsDir, dir).auto, true);
+ assert.equal(needsRewrite(CHILD, dir, sessionsDir), true);
// A switch of the subagent's own wins.
writeSelection({ threadId: CHILD, unchecked: {}, auto: true, autoAt: "2026-09-24T10:10:00Z", autoSince: "2026-09-24T10:10:00Z" }, dir);
assert.equal(effectiveSelection(CHILD, sessionsDir, dir).auto, true);
});
-test("v0.7: a side chat uses the selection of the task it came from, keeping what is pinned there; none with the switch off", () => {
+test("v0.7: a side chat uses the selection of the task it came from, keeping what is pinned there", () => {
const { sessionsDir, dir } = family();
const pinned = { "msg_9#0": { id: "IMG-009", at: "2026-09-24T10:02:00Z" } };
writeSelection({ threadId: MAIN, unchecked: {}, auto: true, autoAt: "2026-09-24T10:01:00Z", autoSince: "2026-09-24T10:01:00Z", pinned }, dir);
const side = sideChatSelection(MAIN, sessionsDir, dir);
- assert.deepEqual([side?.threadId, side?.auto, side?.pinned], [MAIN, true, pinned]);
- // Forked from a subagent: its images, its task's switch.
- assert.deepEqual([sideChatSelection(CHILD, sessionsDir, dir)?.threadId, sideChatSelection(CHILD, sessionsDir, dir)?.auto], [CHILD, true]);
- writeSelection({ threadId: MAIN, unchecked: {}, auto: true, autoAt: "2026-09-24T10:01:00Z", autoSince: "2026-09-24T10:01:00Z", pinned, childrenAuto: false }, dir);
- assert.equal(sideChatSelection(MAIN, sessionsDir, dir), null);
- assert.equal(sideChatSelection(CHILD, sessionsDir, dir), null);
+ assert.deepEqual([side.threadId, side.auto, side.pinned], [MAIN, true, pinned]);
+ // Forked from a subagent: its images.
+ assert.deepEqual([sideChatSelection(CHILD, sessionsDir, dir).threadId, sideChatSelection(CHILD, sessionsDir, dir).auto], [CHILD, true]);
+ // v0.8: a switch v0.7 turned off changes nothing.
+ writeSelection({ threadId: MAIN, unchecked: {}, auto: true, autoAt: "2026-09-24T10:01:00Z", autoSince: "2026-09-24T10:01:00Z", pinned, childrenAuto: false } as Parameters<typeof writeSelection>[0], dir);
+ assert.deepEqual([sideChatSelection(MAIN, sessionsDir, dir).auto, sideChatSelection(CHILD, sessionsDir, dir).auto], [true, true]);
});
diff --git a/spike/src/v07-children-selftest.ts b/spike/src/v07-children-selftest.ts
index 686e7b9..cf309b7 100644
--- a/spike/src/v07-children-selftest.ts
+++ b/spike/src/v07-children-selftest.ts
@@ -1,7 +1,7 @@
// Purpose: v0.7 — subagents and side chats end to end (docs/v0.7/plan.md §5). A side chat's requests leave out the
// images of the task it came from, and the model there fetches one from that task when the answer needs it; a subagent
-// started without history has the images of its earlier turns left out and fetches one back; with the task's switch for
-// them off, their requests go out as they are; the task's panel lists them.
+// started without history has the images of its earlier turns left out and fetches one back; the task's panel lists
+// them. v0.8: the task's switch for them is gone, and with it thread O (the same with the switch off).
// Set up like v03-auto-selftest.ts: a test engine of this checkout (its own port and data folder), this checkout's
// plugin server attached to the test app-server for cam_view_image, Codex's multi_agent_v2 on (spawn_agent's
// fork_turns), the tools that act on the machine off, a read-only sandbox, and the tasks archived at the end (their
@@ -9,8 +9,8 @@
// fork), with a short instruction like the one Codex gives it.
// Thread S: a side chat asks a text question, then about a detail of an image. Thread C: a subagent views an image in
// its first turn and is asked about a detail of it in its second, which the main task gives it with followup_task
-// (Codex takes no input for a multi_agent_v2 subagent from the app-server). Thread O: the same with the switch off.
-// Input: [--label name] [--lang zh|en] [--port 17898] [--threads S,C,O]; CAM_TEST_MODEL, CAM_TEST_EFFORT.
+// (Codex takes no input for a multi_agent_v2 subagent from the app-server).
+// Input: [--label name] [--lang zh|en] [--port 17898] [--threads S,C]; CAM_TEST_MODEL, CAM_TEST_EFFORT.
// Output: local/v07/children-<label>.json (synthetic images only).
import { spawn } from "node:child_process";
@@ -23,9 +23,8 @@ import { codexHome } from "../../plugin/src/codexconfig.ts";
import { engineHealth } from "../../plugin/src/engine.ts";
import { languageFileOf, rememberLang, type Lang } from "../../plugin/src/language.ts";
import { loadPanelState } from "../../plugin/src/panel-state.ts";
-import { requestStatsDirOf, selectionDirOf } from "../../plugin/src/paths.ts";
+import { requestStatsDirOf } from "../../plugin/src/paths.ts";
import { readRequestStats } from "../../plugin/src/request-stats.ts";
-import { writeSelection } from "../../plugin/src/selection.ts";
import { loadThreadIndex, threadsStartedSince } from "../../plugin/src/thread-index.ts";
import { archiveThreads, CORNER_IMAGES, runTurn, says, TEST_EFFORT, TEST_MODEL, text } from "./testkit.ts";
@@ -60,7 +59,7 @@ async function main(): Promise<void> {
const label = option("--label", "run1");
const lang: Lang = option("--lang", "zh") === "en" ? "en" : "zh";
const port = Number(option("--port", "17898"));
- const only = option("--threads", "S,C,O").split(",");
+ const only = option("--threads", "S,C").split(",");
const words = SCRIPT[lang];
const root = join(localRoot, "v07");
const data = join(root, `data-${label}`);
@@ -136,24 +135,11 @@ async function main(): Promise<void> {
turns.childSecond = lastOf(child);
return { threadId: id, child, turns, childImages: loadThreadIndex(sessionsDir, child).images.map((image) => image.id), fetches: fetches().filter((entry) => entry.threadId === child) };
},
- O: async () => {
- const id = await start("O");
- const turns: Json = { upload: await turn(id, words.uploadTwo, ["a.png", "c.png"]) };
- // As the panel's switch does.
- writeSelection({ threadId: id, unchecked: {}, childrenAuto: false }, selectionDirOf(data));
- await sleep(2500);
- const side = await sideChat(id);
- turns.sideText = await turn(side, words.sideText);
- turns.spawn = await turn(id, words.spawn(join(work, "a.png")));
- const [child] = subagentsOf(id);
- if (child) turns.followup = await turn(id, words.followup);
- return { threadId: id, side, child: child ?? null, turns, childLast: child ? lastOf(child) : null };
- },
};
for (const name of only) if (threads[name]) result.threads[name] = await threads[name]();
// What each task's panel lists (as the panel would read it).
for (const thread of Object.values(result.threads) as Json[]) {
- thread.panel = loadPanelState(thread.threadId, { sessionsDir, dataRoot: data }).children.map((child) => ({ kind: child.kind, name: child.name, auto: child.auto, images: child.images, replaced: child.last?.replaced ?? null }));
+ thread.panel = loadPanelState(thread.threadId, { sessionsDir, dataRoot: data }).children.map((child) => ({ kind: child.kind, name: child.name, images: child.images, replaced: child.last?.replaced ?? null }));
}
} finally {
result.notArchived = await archiveThreads(server, created);
@@ -163,7 +149,6 @@ async function main(): Promise<void> {
const S = result.threads.S ?? null;
const C = result.threads.C ?? null;
- const O = result.threads.O ?? null;
const fetched = (thread: Json | null, id: string) => (thread?.fetches ?? []).some((entry: Json) => (entry.found ?? []).includes(id));
result.checks = {
...(S ? {
@@ -172,19 +157,14 @@ async function main(): Promise<void> {
sideTextNoFetch: !S.turns.sideText.tools.some((tool: string) => tool.startsWith("mcpToolCall")),
sideFetches: fetched(S, "IMG-001") && (S.fetches ?? []).every((entry: Json) => entry.from === S.threadId),
sideAnswers: says(S.turns.sideDetail.reply, 7),
- sideListed: S.panel.some((child: Json) => child.kind === "side" && child.auto),
+ sideListed: S.panel.some((child: Json) => child.kind === "side"),
} : {}),
...(C ? {
childAuto: C.turns.childSecond?.rewrite?.auto === true,
childLeavesOut: (C.childImages ?? []).length > 0 && !!C.turns.childSecond?.rewrite?.replaced?.includes(C.childImages[0]),
childFetches: fetched(C, C.childImages?.[0] ?? "IMG-001"),
childAnswers: says(C.turns.followup?.reply ?? "", 7),
- childListed: C.panel.some((child: Json) => child.kind === "subagent" && child.auto),
- } : {}),
- ...(O ? {
- offSideAsIs: !O.turns.sideText.last.rewrite?.replaced?.length && !O.turns.sideText.last.rewrite?.auto,
- offChildAsIs: !!O.childLast && (O.childLast.images ?? 1) > 0 && !O.childLast.rewrite?.replaced?.length && !O.childLast.rewrite?.auto,
- offListed: O.panel.length > 0 && O.panel.every((child: Json) => !child.auto),
+ childListed: C.panel.some((child: Json) => child.kind === "subagent"),
} : {}),
};
mkdirSync(root, { recursive: true });