Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

fix(claude): leave the size pins as main has them; the long-folder test reads the path on any platform

刘伟33f8e49e93b6
diff --git a/scripts/testing/file-size-ratchet.test.ts b/scripts/testing/file-size-ratchet.test.ts
index 7f267f7afa..8723f7b5b2 100644
--- a/scripts/testing/file-size-ratchet.test.ts
+++ b/scripts/testing/file-size-ratchet.test.ts
@@ -20,9 +20,9 @@ const LINES: Record<string, number> = {
"src/state/store.tsx": 3285,
"electron/main.mjs": 3124,
"server/store.ts": 2265,
- "src/components/Sidebar.tsx": 1674,
- "server/drivers/claude.ts": 2073,
- "server/drivers/acp/core.ts": 1654,
+ "src/components/Sidebar.tsx": 1672,
+ "server/drivers/claude.ts": 2069,
+ "server/drivers/acp/core.ts": 1611,
"server/drivers/codex.ts": 1593,
"server/routines.ts": 1553,
"src/components/ComputerPanel.tsx": 1782,
diff --git a/server/drivers/claude-transcript-images.test.ts b/server/drivers/claude-transcript-images.test.ts
index 43676ea4cf..f3061861d9 100644
--- a/server/drivers/claude-transcript-images.test.ts
+++ b/server/drivers/claude-transcript-images.test.ts
@@ -124,8 +124,8 @@ test("the transcript is found where Claude Code writes it: a linked working dire
const longName = transcriptPath(configDir, long, "s1");
assert.equal(longName, join(configDir, "projects", `${resolvedLong.replace(/[^A-Za-z0-9]/g, "-").slice(0, 200)}-${suffix(resolvedLong)}`, "s1.jsonl"));
// the CLI's own shape: the cut name, then '-' and a short base-36 hash
- assert.equal(longName.split("/").at(-2)!.length, 200 + 1 + suffix(resolvedLong).length);
- assert.match(longName.split("/").at(-2)!, /-[0-9a-z]+$/);
+ assert.equal(basename(dirname(longName)).length, 200 + 1 + suffix(resolvedLong).length);
+ assert.match(basename(dirname(longName)), /-[0-9a-z]+$/);
// reached through a link, the same folder: the resolution happens inside transcriptPath
const longLink = join(dirname(long), "link-" + basename(long).slice(0, 40));
symlinkSync(long, longLink);
diff --git a/server/drivers/claude.ts b/server/drivers/claude.ts
index a7ddf01326..c2029b4b86 100644
--- a/server/drivers/claude.ts
+++ b/server/drivers/claude.ts
@@ -60,8 +60,7 @@ import type { KeepWarmContract } from "./claude-keepwarm.ts"; import { claudeFor
import { BACKGROUND_CALL_TIMEOUT_MS, backgroundCallArgs, spawnBackgroundCall } from "./claude-background.ts"; import { withEndpointFolder } from "./claude-endpoint-folder.ts";
import { permissionLaunchCwd, shellRequest } from "./permission-command.ts"; import { readToolPaths } from "../own-file-reads.ts";
import { SPAWNED_PROXIES } from "../proxy-paths.ts"; import { OWN_APPS_SERVER } from "../../shared/own-apps.ts";
-import { extractMcpImages } from "../mcp-tool-images.ts"; import { claudeToolDraft } from "./tool-progress.ts"; import { redactSecretsInText } from "../../shared/redact.ts";
-import { foldTranscriptImages, transcriptImagesOver } from "./claude-transcript-images.ts";
+import { extractMcpImages } from "../mcp-tool-images.ts"; import { claudeToolDraft } from "./tool-progress.ts"; import { redactSecretsInText } from "../../shared/redact.ts"; import { foldTranscriptImages, transcriptImagesOver } from "./claude-transcript-images.ts";
import {
ASK_USER_QUESTION_TOOL,
ASK_USER_TOOL,
@@ -1214,9 +1213,7 @@ export const ClaudeDriver: ProviderDriver<ClaudeConfig> = {
// A process started ahead is taken once it has started up and has listed again the tools the harness serves only during a turn.
const ahead = sessions.get(threadId);
if (!spare && ahead?.spare && !ahead.closing && ahead.argsKey === argsKey && !(ahead.tools?.ready && await ahead.tools.relist(Object.keys(mcpServers)))) closeSession(threadId, "never used");
- const live = sessions.get(threadId), transcript = { configDir: env.CLAUDE_CONFIG_DIR?.trim() || resolveClaudeConfigDir(undefined, env), cwd };
- // A warm process resends every image it holds: past the endpoints' limit a fresh one resumes the folded transcript (claude-transcript-images.ts).
- const imagesOver = !turn.sessionReset && !!sessionId && live?.sessionId === sessionId && !live.turn && transcriptImagesOver({ ...transcript, sessionId }, turn.images?.length ?? 0);
+ const live = sessions.get(threadId), transcript = { configDir: env.CLAUDE_CONFIG_DIR?.trim() || resolveClaudeConfigDir(undefined, env), cwd }, imagesOver = !turn.sessionReset && !!sessionId && live?.sessionId === sessionId && !live.turn && transcriptImagesOver({ ...transcript, sessionId }, turn.images?.length ?? 0);
if (!turn.sessionReset && !imagesOver && live && !live.turn && !live.closing && live.child.exitCode === null && live.argsKey === argsKey && (!sessionId || sessionId === live.sessionId)) {
stopIdleClose(`${instanceId}\0${threadId}`, live.idleTimer); // busy again: no longer idle
if (live.spare) { live.spare = false; live.take?.(turnId); appendNative(threadId, { dir: "out", source: "claude.session", msg: { took: "prestarted" } }); }
@@ -1333,8 +1330,7 @@ export const ClaudeDriver: ProviderDriver<ClaudeConfig> = {
if (authSettingsPath) {
writeFileSync(authSettingsPath, JSON.stringify(settings), { mode: 0o600 });
}
- // A resumed thread resends every image of its past turns: older ones become a note, leaving room for this turn's own.
- if (sessionId) { foldTranscriptImages({ ...transcript, sessionId, incoming: turn.images?.length ?? 0 }); args.push("--resume", sessionId); }
+ if (sessionId) { foldTranscriptImages({ ...transcript, sessionId, incoming: turn.images?.length ?? 0 }); args.push("--resume", sessionId); } // a resumed thread resends every past image: older ones become a note, leaving room for this turn's own
else args.push("--session-id", newSessionId!);
} catch (error) {
cleanupUnownedLaunch();