Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"generate:expo-schema": "node scripts/fetch-expo-schema.ts"
},
"dependencies": {
"@anthropic-ai/claude-agent-sdk": "^0.3.276",
"@anthropic-ai/claude-agent-sdk": "^0.3.312",
"@cursor/sdk": "1.0.38",
"@effect/platform-node": "catalog:",
"@effect/platform-node-shared": "catalog:",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,43 @@ const writeClaudeSession = Effect.fnUntraced(function* (configDir: string) {
role: "assistant",
content: [{ type: "text", text: "hi" }],
}),
// A /compact that kept recent messages points at them by UUID. The chain is the
// SDK's rebuilt view; the CLI writes attachments between these entries.
{
...entry("aaaaaaaa-0000-4000-8000-000000000003", null, undefined),
type: "system",
subtype: "compact_boundary",
logicalParentUuid: "aaaaaaaa-0000-4000-8000-000000000002",
compactMetadata: {
trigger: "manual",
preTokens: 100,
preservedSegment: {
headUuid: "aaaaaaaa-0000-4000-8000-000000000001",
anchorUuid: "aaaaaaaa-0000-4000-8000-000000000004",
tailUuid: "aaaaaaaa-0000-4000-8000-000000000002",
},
preservedMessages: {
anchorUuid: "aaaaaaaa-0000-4000-8000-000000000004",
uuids: ["aaaaaaaa-0000-4000-8000-000000000001", "aaaaaaaa-0000-4000-8000-000000000002"],
allUuids: [
"aaaaaaaa-0000-4000-8000-000000000001",
"aaaaaaaa-0000-4000-8000-000000000002",
],
},
},
},
{
...entry("aaaaaaaa-0000-4000-8000-000000000004", "aaaaaaaa-0000-4000-8000-000000000003", {
role: "user",
content: "summary",
}),
type: "user",
isCompactSummary: true,
},
entry("aaaaaaaa-0000-4000-8000-000000000005", "aaaaaaaa-0000-4000-8000-000000000002", {
role: "assistant",
content: [{ type: "text", text: "after compact" }],
}),
]
.map((line) => JSON.stringify(line))
.join("\n"),
Expand Down Expand Up @@ -106,6 +143,26 @@ it.effect("forks a session stored under the instance's own CLAUDE_CONFIG_DIR", (
?.match(/"uuid"\s*:\s*"([^"]+)"/)?.[1];
assert.isString(inheritedHead);
assert.equal(forked.headMessageId, inheritedHead);
// Dangling UUIDs make Claude reload the whole pre-compaction history.
const entries = transcript
.trim()
.split("\n")
.map((line) => JSON.parse(line));
const head = entries.find((line) => line.message?.content === "hello")?.uuid;
const anchor = entries.find((line) => line.isCompactSummary === true)?.uuid;
const tail = entries.find((line) => line.message?.content?.[0]?.text === "hi")?.uuid;
assert.notEqual(head, "aaaaaaaa-0000-4000-8000-000000000001");
const metadata = entries.find((line) => line.subtype === "compact_boundary")?.compactMetadata;
assert.deepEqual(metadata?.preservedSegment, {
headUuid: head,
anchorUuid: anchor,
tailUuid: tail,
});
assert.deepEqual(metadata?.preservedMessages, {
anchorUuid: anchor,
uuids: [head, tail],
allUuids: [head, tail],
});
assert.equal(process.env.CLAUDE_CONFIG_DIR, hostConfigDir);
assert.equal(inProcessFork.mock.calls.length, 0);
}).pipe(Effect.provide(forkRunnerLayer)),
Expand Down
12 changes: 6 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ minimumReleaseAgeExclude:
- expo-sqlite@58.0.13
- expo-symbols@58.0.4
- electron@44.10.0
- "@anthropic-ai/claude-agent-sdk@0.3.276"
- "@anthropic-ai/claude-agent-sdk@0.3.312"
- "@shadcn/lint@0.1.5"
- cn@0.3.2
- uniwind@1.13.0
Expand Down
Loading