@ponythewhite/base-context 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/base-context-runtime/pyproject.toml +1 -1
- package/dist/base-context-runtime/uv.lock +1 -1
- package/dist/build-info.json +1 -1
- package/dist/bundle/{bundled-modules-5JRM6P4T.js → bundled-modules-MX6YNAM2.js} +2 -2
- package/dist/bundle/{chunk-NEHLB7JV.js → chunk-CDXQNS5P.js} +100 -22
- package/dist/bundle/{chunk-VVI3UKGR.js → chunk-UHLGPYMI.js} +20 -40
- package/dist/bundle/{cli-main-YUDBEYE2.js → cli-main-D7W3WWCV.js} +2 -2
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/{main-ZLGGAAGU.js → main-5J3QBZ5Y.js} +2 -2
- package/dist/core/canonical-context.d.ts.map +1 -1
- package/dist/core/canonical-context.js +115 -30
- package/dist/core/canonical-context.js.map +1 -1
- package/dist/core/context-epoch.d.ts +14 -3
- package/dist/core/context-epoch.d.ts.map +1 -1
- package/dist/core/context-epoch.js +5 -1
- package/dist/core/context-epoch.js.map +1 -1
- package/dist/core/public-context.d.ts.map +1 -1
- package/dist/core/public-context.js +20 -8
- package/dist/core/public-context.js.map +1 -1
- package/dist/modes/daemon/daemon-mode.d.ts.map +1 -1
- package/dist/modes/daemon/daemon-mode.js +15 -30
- package/dist/modes/daemon/daemon-mode.js.map +1 -1
- package/dist/modes/daemon/daemon-socket.d.ts +5 -0
- package/dist/modes/daemon/daemon-socket.d.ts.map +1 -1
- package/dist/modes/daemon/daemon-socket.js +19 -0
- package/dist/modes/daemon/daemon-socket.js.map +1 -1
- package/dist/modes/daemon/daemon-supervisor.d.ts.map +1 -1
- package/dist/modes/daemon/daemon-supervisor.js +6 -7
- package/dist/modes/daemon/daemon-supervisor.js.map +1 -1
- package/dist/modes/daemon/daemon-worker-client.d.ts.map +1 -1
- package/dist/modes/daemon/daemon-worker-client.js +5 -5
- package/dist/modes/daemon/daemon-worker-client.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.0.10] - 2026-09-19
|
|
4
|
+
|
|
5
|
+
- Fixed session attachment disconnecting during concurrent transcript updates.
|
|
6
|
+
- Fixed worker request timeouts and connection closure hanging behind blocked socket writes.
|
|
7
|
+
- Fixed daemon shutdown waiting indefinitely for half-open client connections.
|
|
8
|
+
- Fixed idle eviction blocking the release of an existing session input pause.
|
|
9
|
+
- Fixed cold resume after an interruption before tool admission, preserving incomplete tool calls as historical data without rerunning them.
|
|
10
|
+
|
|
3
11
|
## [1.0.9] - 2026-09-19
|
|
4
12
|
|
|
5
13
|
- Fixed compaction and context checkpoint adoption rejecting concurrent child usage and session bookkeeping updates as branch changes. Real conversation, source, and branch changes still invalidate stale summaries.
|
package/dist/build-info.json
CHANGED
|
@@ -51,7 +51,7 @@ import {
|
|
|
51
51
|
oauth_exports,
|
|
52
52
|
runPrintMode,
|
|
53
53
|
runRpcMode
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-UHLGPYMI.js";
|
|
55
55
|
import {
|
|
56
56
|
AgentSession,
|
|
57
57
|
CURRENT_SESSION_VERSION,
|
|
@@ -143,7 +143,7 @@ import {
|
|
|
143
143
|
withFileMutationQueue,
|
|
144
144
|
wrapRegisteredTool,
|
|
145
145
|
wrapRegisteredTools
|
|
146
|
-
} from "./chunk-
|
|
146
|
+
} from "./chunk-CDXQNS5P.js";
|
|
147
147
|
import "./chunk-CFNASUYO.js";
|
|
148
148
|
import "./chunk-QKIFBA7N.js";
|
|
149
149
|
import {
|
|
@@ -27737,6 +27737,7 @@ var CONTEXT_POLICY_EPOCH_RENDERER = "native-canonical-epoch/5";
|
|
|
27737
27737
|
var CONTEXT_TOOL_EPOCH_RENDERER = "native-canonical-epoch/6";
|
|
27738
27738
|
var CONTEXT_SKILL_EPOCH_RENDERER = "native-canonical-epoch/7";
|
|
27739
27739
|
var CONTEXT_TOOL_SUMMARY_RENDERER = "native-canonical-epoch/8";
|
|
27740
|
+
var CONTEXT_INTERRUPTED_TOOL_RENDERER = "native-canonical-epoch/9";
|
|
27740
27741
|
function contextEpochMode(checkpoint, initial = "on") {
|
|
27741
27742
|
return checkpoint ? checkpoint.version === 5 || checkpoint.version === 8 ? checkpoint.mode : "on" : initial;
|
|
27742
27743
|
}
|
|
@@ -27785,7 +27786,7 @@ function readContextEpoch(details, maxBytes) {
|
|
|
27785
27786
|
if (!details || typeof details !== "object" || !(CONTEXT_EPOCH_DETAIL in details))
|
|
27786
27787
|
return;
|
|
27787
27788
|
const value = details[CONTEXT_EPOCH_DETAIL];
|
|
27788
|
-
if (!value || typeof value !== "object" || !("version" in value) || !("renderer" in value) || !(value.version === 1 && value.renderer === "native-canonical-epoch/1" || value.version === 2 && value.renderer === "native-canonical-epoch/2" || value.version === 3 && value.renderer === "native-canonical-epoch/3" || value.version === 4 && value.renderer === "native-canonical-epoch/4" || value.version === 5 && value.renderer === CONTEXT_POLICY_EPOCH_RENDERER || value.version === 6 && value.renderer === CONTEXT_TOOL_EPOCH_RENDERER || value.version === 8 && value.renderer === CONTEXT_TOOL_SUMMARY_RENDERER || [4, 5, 6].includes(value.version) && value.renderer === CONTEXT_SKILL_EPOCH_RENDERER) || (value.renderer === CONTEXT_SKILL_EPOCH_RENDERER || value.version === 8 && "selectedSkills" in value ? !("selectedSkills" in value) || !Array.isArray(value.selectedSkills) || value.selectedSkills.length === 0 || value.selectedSkills.some((item) => !item || typeof item.name !== "string" || !item.view || !["custom_message", "custom"].includes(item.view.ref?.kind) || typeof item.view.sourceRevision !== "string") || new Set(value.selectedSkills.map((item) => item.name)).size !== value.selectedSkills.length : "selectedSkills" in value) || !("source" in value) || !value.source || !("views" in value) || !Array.isArray(value.views) || !("literalTailId" in value) || typeof value.literalTailId !== "string" || !("representation" in value) || (value.version === 5 || value.version === 8 ? !("mode" in value) || value.mode !== "on" && value.mode !== "off" : "mode" in value) || value.version === 8 && (value.representation !== null || !("includeSummary" in value) || value.includeSummary !== true) || value.version === 5 && (value.representation !== null || !("policyOnly" in value) || value.policyOnly !== true) || "policyOnly" in value && (value.version !== 5 || value.policyOnly !== true || value.representation !== null || "includeSummary" in value) || "pendingRequestContract" in value && (value.version !== 5 || !("mode" in value) || value.mode !== "off" || value.pendingRequestContract !== true || "requestContract" in value) || "requestContract" in value && (value.version !== 5 || !isRequestContract(value.requestContract)) || !(typeof value.representation === "string" || value.version === 5 && value.representation === null && "policyOnly" in value && value.policyOnly === true || (value.version === 2 || value.version === 3 || value.version === 4 || value.version === 8) && value.representation === null && "includeSummary" in value && value.includeSummary === true) || "includeSummary" in value && (value.version !== 2 && value.version !== 3 && value.version !== 4 && value.version !== 8 || value.includeSummary !== true || value.representation !== null) || "replayContract" in value && value.replayContract !== "complete-context" && value.replayContract !== "message-groups" || "resourceRevision" in value && (typeof value.resourceRevision !== "string" || Buffer.byteLength(value.resourceRevision, "utf8") > MAX_RESOURCE_REVISION_BYTES) || "publicWindow" in value && (value.version !== 3 && value.version !== 4 && value.version !== 5 && value.version !== 6 && value.version !== 8 || value.publicWindow !== true) || "toolContinuations" in value && value.version !== 6 && value.version !== 8 || (value.version === 6 || value.version === 8) && (!("toolContinuations" in value) || !Array.isArray(value.toolContinuations) || !value.toolContinuations.length || !("replayContract" in value) || value.version === 6 && (!("publicWindow" in value) || value.publicWindow !== true || value.replayContract !== "message-groups")) || "continuation" in value && (value.version !== 3 && value.version !== 4 && value.version !== 5 && value.version !== 6 && value.version !== 8 || !value.continuation || typeof value.continuation !== "object" || !("kind" in value.continuation) || value.continuation.kind !== "harness-summary" && (value.version !== 4 && value.version !== 5 && value.version !== 6 || value.continuation.kind !== "portable-checkpoint") || !("publicTailThrough" in value.continuation) || !value.continuation.publicTailThrough))
|
|
27789
|
+
if (!value || typeof value !== "object" || !("version" in value) || !("renderer" in value) || !(value.version === 1 && value.renderer === "native-canonical-epoch/1" || value.version === 2 && value.renderer === "native-canonical-epoch/2" || value.version === 3 && value.renderer === "native-canonical-epoch/3" || value.version === 4 && value.renderer === "native-canonical-epoch/4" || value.version === 5 && value.renderer === CONTEXT_POLICY_EPOCH_RENDERER || value.version === 6 && value.renderer === CONTEXT_TOOL_EPOCH_RENDERER || value.version === 8 && value.renderer === CONTEXT_TOOL_SUMMARY_RENDERER || [6, 8].includes(value.version) && value.renderer === CONTEXT_INTERRUPTED_TOOL_RENDERER || [4, 5, 6].includes(value.version) && value.renderer === CONTEXT_SKILL_EPOCH_RENDERER) || (value.renderer === CONTEXT_SKILL_EPOCH_RENDERER || (value.version === 8 || value.renderer === CONTEXT_INTERRUPTED_TOOL_RENDERER) && "selectedSkills" in value ? !("selectedSkills" in value) || !Array.isArray(value.selectedSkills) || value.selectedSkills.length === 0 || value.selectedSkills.some((item) => !item || typeof item.name !== "string" || !item.view || !["custom_message", "custom"].includes(item.view.ref?.kind) || typeof item.view.sourceRevision !== "string") || new Set(value.selectedSkills.map((item) => item.name)).size !== value.selectedSkills.length : "selectedSkills" in value) || !("source" in value) || !value.source || !("views" in value) || !Array.isArray(value.views) || !("literalTailId" in value) || typeof value.literalTailId !== "string" || !("representation" in value) || (value.version === 5 || value.version === 8 ? !("mode" in value) || value.mode !== "on" && value.mode !== "off" : "mode" in value) || value.version === 8 && (value.representation !== null || !("includeSummary" in value) || value.includeSummary !== true) || value.version === 5 && (value.representation !== null || !("policyOnly" in value) || value.policyOnly !== true) || "policyOnly" in value && (value.version !== 5 || value.policyOnly !== true || value.representation !== null || "includeSummary" in value) || "pendingRequestContract" in value && (value.version !== 5 || !("mode" in value) || value.mode !== "off" || value.pendingRequestContract !== true || "requestContract" in value) || "requestContract" in value && (value.version !== 5 || !isRequestContract(value.requestContract)) || !(typeof value.representation === "string" || value.version === 5 && value.representation === null && "policyOnly" in value && value.policyOnly === true || (value.version === 2 || value.version === 3 || value.version === 4 || value.version === 8) && value.representation === null && "includeSummary" in value && value.includeSummary === true) || "includeSummary" in value && (value.version !== 2 && value.version !== 3 && value.version !== 4 && value.version !== 8 || value.includeSummary !== true || value.representation !== null) || "replayContract" in value && value.replayContract !== "complete-context" && value.replayContract !== "message-groups" || "resourceRevision" in value && (typeof value.resourceRevision !== "string" || Buffer.byteLength(value.resourceRevision, "utf8") > MAX_RESOURCE_REVISION_BYTES) || "publicWindow" in value && (value.version !== 3 && value.version !== 4 && value.version !== 5 && value.version !== 6 && value.version !== 8 || value.publicWindow !== true) || "toolContinuations" in value && value.version !== 6 && value.version !== 8 || (value.version === 6 || value.version === 8) && (!("toolContinuations" in value) || !Array.isArray(value.toolContinuations) || !value.toolContinuations.length || !("replayContract" in value) || value.version === 6 && (!("publicWindow" in value) || value.publicWindow !== true || value.replayContract !== "message-groups")) || "continuation" in value && (value.version !== 3 && value.version !== 4 && value.version !== 5 && value.version !== 6 && value.version !== 8 || !value.continuation || typeof value.continuation !== "object" || !("kind" in value.continuation) || value.continuation.kind !== "harness-summary" && (value.version !== 4 && value.version !== 5 && value.version !== 6 || value.continuation.kind !== "portable-checkpoint") || !("publicTailThrough" in value.continuation) || !value.continuation.publicTailThrough))
|
|
27789
27790
|
throw new Error("Invalid committed context epoch");
|
|
27790
27791
|
return snapshotContextEpoch(value, maxBytes);
|
|
27791
27792
|
}
|
|
@@ -28443,19 +28444,27 @@ function renderToolContinuation(message2, entryId, source, group, maxBytes) {
|
|
|
28443
28444
|
role: message2.role,
|
|
28444
28445
|
content,
|
|
28445
28446
|
...message2.role === "assistant" ? {
|
|
28446
|
-
calls: group.calls.map((call) =>
|
|
28447
|
+
calls: group.calls.map((call, sourceOrder) => call.admission === "absent" ? {
|
|
28448
|
+
sourceOrder,
|
|
28449
|
+
admission: "not_recorded",
|
|
28450
|
+
capturedHistory: {
|
|
28451
|
+
sessionId: call.source.sessionId,
|
|
28452
|
+
leafId: call.source.leafId,
|
|
28453
|
+
sourceSequence: call.source.sourceSequence
|
|
28454
|
+
}
|
|
28455
|
+
} : {
|
|
28447
28456
|
executionId: call.executionId,
|
|
28448
28457
|
intentEntryId: call.intent.id,
|
|
28449
28458
|
intent: "recorded",
|
|
28450
28459
|
outcome: call.outcome,
|
|
28451
28460
|
...call.result ? { resultEntryId: call.result.id } : {}
|
|
28452
|
-
})
|
|
28461
|
+
})
|
|
28453
28462
|
} : {}
|
|
28454
28463
|
}, maxBytes);
|
|
28455
28464
|
const rendered = {
|
|
28456
28465
|
role: "custom",
|
|
28457
28466
|
customType: PUBLIC_TOOL_CONTINUATION_RENDERER,
|
|
28458
|
-
content: `Recorded tool continuation data. Intent acknowledgment records intent only; an absent finalized result leaves the outcome unknown.
|
|
28467
|
+
content: `Recorded tool continuation data. Intent acknowledgment records intent only; an absent finalized result leaves the outcome unknown.${group.calls.some((call) => call.admission === "absent") ? " For calls marked admission not recorded, no qualified admission or finalized result is recorded in that captured history; the outcome is unknown. This historical view does not authorize tool execution." : ""}
|
|
28459
28468
|
${data}`,
|
|
28460
28469
|
display: false,
|
|
28461
28470
|
timestamp: message2.timestamp
|
|
@@ -31549,7 +31558,7 @@ function prepareCanonicalEpoch(messages, selectedUnitIds, representation, maxByt
|
|
|
31549
31558
|
return {
|
|
31550
31559
|
checkpoint: snapshotContextEpoch({
|
|
31551
31560
|
version: context.toolContinuations?.length ? 6 : 4,
|
|
31552
|
-
renderer: context.selectedSkills?.length ? CONTEXT_SKILL_EPOCH_RENDERER : context.toolContinuations?.length ? CONTEXT_TOOL_EPOCH_RENDERER : CONTEXT_EPOCH_RENDERER,
|
|
31561
|
+
renderer: context.toolContinuations?.some((group) => group.calls.some((call) => call.admission === "absent")) ? CONTEXT_INTERRUPTED_TOOL_RENDERER : context.selectedSkills?.length ? CONTEXT_SKILL_EPOCH_RENDERER : context.toolContinuations?.length ? CONTEXT_TOOL_EPOCH_RENDERER : CONTEXT_EPOCH_RENDERER,
|
|
31553
31562
|
...context.selectedSkills?.length ? { selectedSkills: context.selectedSkills } : {},
|
|
31554
31563
|
...context.toolContinuations?.length ? { toolContinuations: context.toolContinuations } : {},
|
|
31555
31564
|
source: context.source,
|
|
@@ -31620,7 +31629,7 @@ function prepareRecoveryCompaction(messages, firstKeptEntryId, maxBytes) {
|
|
|
31620
31629
|
return;
|
|
31621
31630
|
return snapshotContextEpoch({
|
|
31622
31631
|
...toolGroups.size ? { version: 8, mode: context.mode } : { version: 4 },
|
|
31623
|
-
renderer: toolGroups.size ? CONTEXT_TOOL_SUMMARY_RENDERER : context.selectedSkills?.length ? CONTEXT_SKILL_EPOCH_RENDERER : CONTEXT_EPOCH_RENDERER,
|
|
31632
|
+
renderer: context.toolContinuations?.some((group) => group.calls.some((call) => call.admission === "absent")) ? CONTEXT_INTERRUPTED_TOOL_RENDERER : toolGroups.size ? CONTEXT_TOOL_SUMMARY_RENDERER : context.selectedSkills?.length ? CONTEXT_SKILL_EPOCH_RENDERER : CONTEXT_EPOCH_RENDERER,
|
|
31624
31633
|
...toolGroups.size ? { toolContinuations: context.toolContinuations } : {},
|
|
31625
31634
|
...context.selectedSkills?.length ? { selectedSkills: context.selectedSkills } : {},
|
|
31626
31635
|
source: context.source,
|
|
@@ -32110,6 +32119,10 @@ ${JSON.stringify(selections.map((skill) => ({
|
|
|
32110
32119
|
}
|
|
32111
32120
|
const replayUnits = bindMessageReplayUnits(messages, sourceUnits, unitLimits);
|
|
32112
32121
|
const frozenGroups = checkpoint?.toolContinuations ?? [];
|
|
32122
|
+
const assistantSequences = messages.flatMap((message2) => {
|
|
32123
|
+
const reference = epochReferences.get(message2);
|
|
32124
|
+
return message2.role === "assistant" && reference ? [reference.ref.sequence] : [];
|
|
32125
|
+
}).sort((left, right) => left - right);
|
|
32113
32126
|
const candidates = messages.flatMap((message2, index) => {
|
|
32114
32127
|
if (message2.role !== "assistant")
|
|
32115
32128
|
return [];
|
|
@@ -32125,6 +32138,8 @@ ${JSON.stringify(selections.map((skill) => ({
|
|
|
32125
32138
|
index,
|
|
32126
32139
|
reference,
|
|
32127
32140
|
prior,
|
|
32141
|
+
nextAssistantSequence: assistantSequences.find((sequence) => sequence > reference.ref.sequence) ?? Infinity,
|
|
32142
|
+
unqualifiedIntent: false,
|
|
32128
32143
|
intents: /* @__PURE__ */ new Map()
|
|
32129
32144
|
}
|
|
32130
32145
|
];
|
|
@@ -32140,48 +32155,63 @@ ${JSON.stringify(selections.map((skill) => ({
|
|
|
32140
32155
|
countBytes(metadata);
|
|
32141
32156
|
return hydrateCapturedHistoryEntry(metadata, maxSourceBytes, view.readPayload);
|
|
32142
32157
|
};
|
|
32143
|
-
const acceptIntent = async (metadata) => {
|
|
32144
|
-
if (metadata.kind !== "tool_intent"
|
|
32158
|
+
const acceptIntent = async (metadata, selected = candidates) => {
|
|
32159
|
+
if (metadata.kind !== "tool_intent")
|
|
32145
32160
|
return;
|
|
32146
32161
|
const hydrated = await readToolEvidence(metadata);
|
|
32147
32162
|
const entry = hydrated.entry;
|
|
32148
|
-
if (entry.type !== "tool_intent"
|
|
32163
|
+
if (entry.type !== "tool_intent")
|
|
32149
32164
|
return;
|
|
32150
|
-
const
|
|
32165
|
+
const invocation = entry.invocation;
|
|
32166
|
+
const ownerMatch = selected.find((item) => item.reference.ref.entryId === entry.assistant?.entryId);
|
|
32167
|
+
const candidate = ownerMatch ?? selected.find((item) => metadata.sequence > item.reference.ref.sequence && metadata.sequence < item.nextAssistantSequence && item.message.content.some((part) => part.type === "toolCall" && part.id === invocation.toolCallId && part.name === invocation.toolName));
|
|
32151
32168
|
if (!candidate)
|
|
32152
32169
|
return;
|
|
32153
|
-
|
|
32170
|
+
if (metadata.qualification !== "native-tool-execution" || metadata.retention === "retained-import" || entry.assistant?.sessionId !== view.source.sessionId || entry.assistant.sessionFile !== view.source.sessionFile || entry.assistant.entryId !== candidate.reference.ref.entryId) {
|
|
32171
|
+
candidate.unqualifiedIntent = true;
|
|
32172
|
+
return;
|
|
32173
|
+
}
|
|
32154
32174
|
const call = candidate.message.content.filter((part) => part.type === "toolCall")[invocation.sourceOrder];
|
|
32155
32175
|
if (!Number.isSafeInteger(invocation.sourceOrder) || !call || call.id !== invocation.toolCallId || call.name !== invocation.toolName || !invocation.executionId || entry.id !== `${invocation.executionId}:intent` || metadata.sequence <= candidate.reference.ref.sequence || candidate.intents.has(invocation.sourceOrder))
|
|
32156
32176
|
throw new Error("Tool continuation has ambiguous original intent");
|
|
32157
32177
|
candidate.intents.set(invocation.sourceOrder, hydrated);
|
|
32158
32178
|
};
|
|
32179
|
+
const absentPrefixes = /* @__PURE__ */ new Map();
|
|
32159
32180
|
for (const candidate of candidates) {
|
|
32160
32181
|
if (!candidate.prior)
|
|
32161
32182
|
continue;
|
|
32162
32183
|
if (!Array.isArray(candidate.prior.calls))
|
|
32163
32184
|
throw new Error("Invalid committed tool continuation");
|
|
32164
32185
|
for (const call of candidate.prior.calls) {
|
|
32186
|
+
if (call.admission === "absent") {
|
|
32187
|
+
if (checkpoint?.renderer !== CONTEXT_INTERRUPTED_TOOL_RENDERER || !call.source || call.source.sourceSequence < candidate.reference.ref.sequence || call.intent !== void 0 || call.executionId !== void 0 || call.outcome !== void 0 || call.result !== void 0)
|
|
32188
|
+
throw new Error("Invalid committed absent tool admission");
|
|
32189
|
+
const key2 = JSON.stringify(call.source);
|
|
32190
|
+
const prefix = absentPrefixes.get(key2) ?? { source: call.source, candidates: [] };
|
|
32191
|
+
if (!prefix.candidates.includes(candidate))
|
|
32192
|
+
prefix.candidates.push(candidate);
|
|
32193
|
+
absentPrefixes.set(key2, prefix);
|
|
32194
|
+
continue;
|
|
32195
|
+
}
|
|
32165
32196
|
const actual = await view.get(call.intent.id);
|
|
32166
32197
|
if (!actual || actual.revision !== call.intent.revision || actual.sequence !== call.intent.sequence)
|
|
32167
32198
|
throw new Error("Committed tool intent is unavailable on this captured branch");
|
|
32168
|
-
await acceptIntent(actual);
|
|
32199
|
+
await acceptIntent(actual, [candidate]);
|
|
32169
32200
|
}
|
|
32170
32201
|
}
|
|
32171
|
-
const
|
|
32172
|
-
|
|
32173
|
-
let after = Math.min(...newGroups.map((candidate) => candidate.reference.ref.sequence));
|
|
32202
|
+
const scanIntents = async (readView, selected) => {
|
|
32203
|
+
let after = Math.min(...selected.map((candidate) => candidate.reference.ref.sequence));
|
|
32174
32204
|
let scanned = 0;
|
|
32175
32205
|
for (; ; ) {
|
|
32176
|
-
const page = await
|
|
32206
|
+
const page = await readView.page(after, Math.min(128, maxMessages - scanned + 1));
|
|
32177
32207
|
scanned += page.events.length;
|
|
32178
32208
|
if (scanned > maxMessages)
|
|
32179
32209
|
throw new Error("Tool continuation source item budget exceeded");
|
|
32180
32210
|
if (page.coverage !== "complete")
|
|
32181
32211
|
throw new Error("Tool continuation source coverage is incomplete");
|
|
32182
32212
|
for (const metadata of page.events) {
|
|
32183
|
-
if (!
|
|
32184
|
-
await acceptIntent(metadata);
|
|
32213
|
+
if (!selected.some((candidate) => [...candidate.intents.values()].some((intent) => intent.source.id === metadata.id)))
|
|
32214
|
+
await acceptIntent(metadata, selected);
|
|
32185
32215
|
}
|
|
32186
32216
|
if (page.nextAfter === null)
|
|
32187
32217
|
break;
|
|
@@ -32189,21 +32219,51 @@ ${JSON.stringify(selections.map((skill) => ({
|
|
|
32189
32219
|
throw new Error("Tool continuation source page did not advance");
|
|
32190
32220
|
after = page.nextAfter;
|
|
32191
32221
|
}
|
|
32222
|
+
};
|
|
32223
|
+
const newGroups = candidates.filter((candidate) => !candidate.prior);
|
|
32224
|
+
if (newGroups.length)
|
|
32225
|
+
await scanIntents(view, newGroups);
|
|
32226
|
+
for (const prefix of absentPrefixes.values()) {
|
|
32227
|
+
if (!view.atSnapshot)
|
|
32228
|
+
throw new Error("Absent tool admission requires its captured source");
|
|
32229
|
+
await scanIntents(await view.atSnapshot(prefix.source), prefix.candidates);
|
|
32192
32230
|
}
|
|
32231
|
+
const checkAbsentScope = async (candidate) => {
|
|
32232
|
+
const entry = next.get(candidate.reference.ref.entryId)?.entry;
|
|
32233
|
+
const output = entry?.type === "message" ? entry.requestOutput : void 0;
|
|
32234
|
+
if (!output || typeof output.operationId !== "string" || !output.operationId || !Array.isArray(output.attemptIds) || output.attemptIds.some((id) => typeof id !== "string") || !output.source || output.source.sessionId !== view.source.sessionId || output.source.sessionFile !== view.source.sessionFile || !output.source.persistent || !Number.isSafeInteger(output.source.sourceSequence) || output.source.sourceSequence >= candidate.reference.ref.sequence || !view.atSnapshot)
|
|
32235
|
+
throw new Error("View-unit replay group is incomplete: original tool owner is unqualified");
|
|
32236
|
+
await view.atSnapshot(output.source);
|
|
32237
|
+
};
|
|
32193
32238
|
const toolContinuations = [];
|
|
32194
32239
|
const pendingPublicMessageGroups = [];
|
|
32195
32240
|
for (const candidate of candidates) {
|
|
32196
32241
|
const toolCalls = candidate.message.content.filter((part) => part.type === "toolCall");
|
|
32197
|
-
if (!toolCalls.length || candidate.
|
|
32242
|
+
if (!toolCalls.length || candidate.unqualifiedIntent || candidate.prior && candidate.prior.calls.length !== toolCalls.length)
|
|
32198
32243
|
throw new Error("View-unit replay group is incomplete: original tool owner is unqualified");
|
|
32244
|
+
if (candidate.intents.size !== toolCalls.length)
|
|
32245
|
+
await checkAbsentScope(candidate);
|
|
32199
32246
|
const members = [candidate.index];
|
|
32200
32247
|
const calls = [];
|
|
32201
32248
|
for (let order = 0; order < toolCalls.length; order++) {
|
|
32202
32249
|
const intent = candidate.intents.get(order);
|
|
32250
|
+
const original = candidate.prior?.calls[order];
|
|
32251
|
+
if (!intent) {
|
|
32252
|
+
if (original && original.admission !== "absent")
|
|
32253
|
+
throw new Error("Committed tool intent is unavailable on this captured branch");
|
|
32254
|
+
if (messages.some((message2) => {
|
|
32255
|
+
const sequence = epochReferences.get(message2)?.ref.sequence;
|
|
32256
|
+
return message2.role === "toolResult" && message2.toolCallId === toolCalls[order].id && sequence !== void 0 && sequence > candidate.reference.ref.sequence && sequence < candidate.nextAssistantSequence;
|
|
32257
|
+
}))
|
|
32258
|
+
throw new Error("Tool outcome lacks its original finalized owner");
|
|
32259
|
+
calls.push(original ?? { admission: "absent", source: { ...view.source } });
|
|
32260
|
+
continue;
|
|
32261
|
+
}
|
|
32262
|
+
if (original?.admission === "absent")
|
|
32263
|
+
throw new Error("Committed absent tool admission changed");
|
|
32203
32264
|
if (intent.entry.type !== "tool_intent")
|
|
32204
32265
|
throw new Error("Invalid native tool intent");
|
|
32205
32266
|
const invocation = intent.entry.invocation;
|
|
32206
|
-
const original = candidate.prior?.calls[order];
|
|
32207
32267
|
if (original && (original.executionId !== invocation.executionId || original.intent.id !== intent.source.id))
|
|
32208
32268
|
throw new Error("Committed tool execution identity changed");
|
|
32209
32269
|
const actual = await view.get(invocation.executionId);
|
|
@@ -40848,6 +40908,23 @@ var DaemonSocketPathLease = class {
|
|
|
40848
40908
|
}
|
|
40849
40909
|
}
|
|
40850
40910
|
};
|
|
40911
|
+
async function closeDaemonServer(server, clients) {
|
|
40912
|
+
const closingClients = [...clients];
|
|
40913
|
+
for (const client of closingClients) {
|
|
40914
|
+
client.detachInput();
|
|
40915
|
+
client.socket.end();
|
|
40916
|
+
}
|
|
40917
|
+
const timeout = setTimeout(() => {
|
|
40918
|
+
for (const client of closingClients)
|
|
40919
|
+
client.socket.destroy();
|
|
40920
|
+
}, 1e3);
|
|
40921
|
+
timeout.unref();
|
|
40922
|
+
try {
|
|
40923
|
+
await new Promise((resolveClose) => server?.close(() => resolveClose()) ?? resolveClose());
|
|
40924
|
+
} finally {
|
|
40925
|
+
clearTimeout(timeout);
|
|
40926
|
+
}
|
|
40927
|
+
}
|
|
40851
40928
|
function defaultDaemonSocketPath(packageDir = getPackageDir()) {
|
|
40852
40929
|
if (process.platform === "win32") {
|
|
40853
40930
|
return `\\\\.\\pipe\\${PRODUCT.command}-${daemonScopeId(packageDir)}`;
|
|
@@ -45482,7 +45559,7 @@ async function loadExtensionModule(extensionPath) {
|
|
|
45482
45559
|
// (file-path aliases would load a second, divergent copy of each package).
|
|
45483
45560
|
// Also disable tryNative so jiti handles ALL imports (not just the entry point)
|
|
45484
45561
|
// Node/dev must also share the native AI registry and implementation identities.
|
|
45485
|
-
...isBunBinary || isBundledCli ? { virtualModules: (await import("./bundled-modules-
|
|
45562
|
+
...isBunBinary || isBundledCli ? { virtualModules: (await import("./bundled-modules-MX6YNAM2.js")).VIRTUAL_MODULES, tryNative: false } : {
|
|
45486
45563
|
alias: getAliases(),
|
|
45487
45564
|
virtualModules: {
|
|
45488
45565
|
"@ponythewhite/base-context-ai": src_exports,
|
|
@@ -70013,7 +70090,7 @@ import { resolve as resolve15 } from "node:path";
|
|
|
70013
70090
|
var BASE_CONTEXT_BUILD_ID_ENV = "BASE_CONTEXT_BUILD_ID";
|
|
70014
70091
|
var BASE_CONTEXT_LAUNCHER_PATH_ENV = "BASE_CONTEXT_LAUNCHER_PATH";
|
|
70015
70092
|
function bundledBuildId() {
|
|
70016
|
-
return false ? void 0 : "v1.0.9";
|
|
70093
|
+
return false ? void 0 : "v1.0.9-1-ge86dce7cb";
|
|
70017
70094
|
}
|
|
70018
70095
|
function getDaemonRuntimeIdentity(environment = process.env) {
|
|
70019
70096
|
const entrypoint = process.argv[1];
|
|
@@ -70805,6 +70882,7 @@ export {
|
|
|
70805
70882
|
maybeRunOwnedSessionWorkerFrontend,
|
|
70806
70883
|
installOwnedSessionWorkerOwnerWatch,
|
|
70807
70884
|
closeOwnedSessionWorkerOwnerWatch,
|
|
70885
|
+
closeDaemonServer,
|
|
70808
70886
|
defaultDaemonSocketPath,
|
|
70809
70887
|
acquireDaemonSocketPathLease,
|
|
70810
70888
|
prepareDaemonSocketPath,
|
|
@@ -140,6 +140,7 @@ import {
|
|
|
140
140
|
clearOrphanProcessJournal,
|
|
141
141
|
clippedFullscreenDockHeight,
|
|
142
142
|
cloneUsage,
|
|
143
|
+
closeDaemonServer,
|
|
143
144
|
closeWatcher,
|
|
144
145
|
collectDaemonClientEnv,
|
|
145
146
|
collectDaemonLaunchEnv,
|
|
@@ -348,7 +349,7 @@ import {
|
|
|
348
349
|
watchWithErrorHandler,
|
|
349
350
|
workerRosterEntryFromSummary,
|
|
350
351
|
wrapTextWithAnsi
|
|
351
|
-
} from "./chunk-
|
|
352
|
+
} from "./chunk-CDXQNS5P.js";
|
|
352
353
|
import {
|
|
353
354
|
array,
|
|
354
355
|
boolean,
|
|
@@ -17361,16 +17362,14 @@ var DaemonWorkerClient = class {
|
|
|
17361
17362
|
}, timeoutMs);
|
|
17362
17363
|
this.pending.set(id, { resolve: resolve26, reject, timeout });
|
|
17363
17364
|
});
|
|
17364
|
-
|
|
17365
|
-
await this.channel.send({ kind: "command", requestId: id, commandType: command.type }, Buffer.from(serializeJsonLine(fullCommand)));
|
|
17366
|
-
} catch (error) {
|
|
17365
|
+
void this.channel.send({ kind: "command", requestId: id, commandType: command.type }, Buffer.from(serializeJsonLine(fullCommand))).catch((error) => {
|
|
17367
17366
|
const pending = this.pending.get(id);
|
|
17368
17367
|
if (pending) {
|
|
17369
17368
|
clearTimeout(pending.timeout);
|
|
17370
17369
|
this.pending.delete(id);
|
|
17371
17370
|
pending.reject(error instanceof Error ? error : new Error(String(error)));
|
|
17372
17371
|
}
|
|
17373
|
-
}
|
|
17372
|
+
});
|
|
17374
17373
|
return response;
|
|
17375
17374
|
}
|
|
17376
17375
|
handleFrame(frame) {
|
|
@@ -63467,7 +63466,7 @@ var AgentDaemon = class {
|
|
|
63467
63466
|
});
|
|
63468
63467
|
}
|
|
63469
63468
|
if (streamsSnapshot) {
|
|
63470
|
-
const snapshotId = `${
|
|
63469
|
+
const snapshotId = `${result.activeSessionId}-${result.lastEventCursor?.generation}-${result.lastEventSequence}`;
|
|
63471
63470
|
let transcript;
|
|
63472
63471
|
try {
|
|
63473
63472
|
transcript = createSnapshotTranscriptChunks({
|
|
@@ -64445,16 +64444,14 @@ var AgentDaemon = class {
|
|
|
64445
64444
|
}
|
|
64446
64445
|
async createAttachResult(client, state, command) {
|
|
64447
64446
|
const snapshot = await this.createSessionSnapshot(state);
|
|
64447
|
+
const { lastEventSequence, lastEventCursor } = snapshot;
|
|
64448
64448
|
const replay = command.resumeCursor?.activeSessionId && command.resumeCursor.activeSessionId !== state.activeSessionId ? {
|
|
64449
64449
|
status: "unavailable",
|
|
64450
64450
|
fromSequence: "sequence" in command.resumeCursor ? command.resumeCursor.sequence : command.resumeCursor.eventSequence,
|
|
64451
|
-
toSequence:
|
|
64452
|
-
toCursor:
|
|
64453
|
-
generation: state.eventGeneration,
|
|
64454
|
-
sequence: state.lastEventSequence
|
|
64455
|
-
},
|
|
64451
|
+
toSequence: lastEventSequence,
|
|
64452
|
+
toCursor: lastEventCursor,
|
|
64456
64453
|
reason: "resume_cursor_session_mismatch"
|
|
64457
|
-
} : createDaemonReplayInfo(command.resumeCursor,
|
|
64454
|
+
} : createDaemonReplayInfo(command.resumeCursor, lastEventSequence, lastEventCursor?.generation);
|
|
64458
64455
|
const capabilities = daemonClientCapabilitiesForSession(client, state.activeSessionId);
|
|
64459
64456
|
const slim = capabilities.has("slim_attach");
|
|
64460
64457
|
return {
|
|
@@ -64463,11 +64460,8 @@ var AgentDaemon = class {
|
|
|
64463
64460
|
...slim ? {} : { state: snapshot.summary, messages: snapshot.messages },
|
|
64464
64461
|
snapshot,
|
|
64465
64462
|
replay,
|
|
64466
|
-
lastEventSequence
|
|
64467
|
-
lastEventCursor
|
|
64468
|
-
generation: state.eventGeneration,
|
|
64469
|
-
sequence: state.lastEventSequence
|
|
64470
|
-
},
|
|
64463
|
+
lastEventSequence,
|
|
64464
|
+
lastEventCursor,
|
|
64471
64465
|
client: {
|
|
64472
64466
|
id: client.id,
|
|
64473
64467
|
capabilities: [...capabilities]
|
|
@@ -65780,9 +65774,8 @@ Use prime_context read/search with selected lines or a query.`;
|
|
|
65780
65774
|
}
|
|
65781
65775
|
}
|
|
65782
65776
|
beginReplacementSnapshot(client, state, message) {
|
|
65783
|
-
const snapshotId = `${state.activeSessionId}-${state.eventGeneration}-${state.lastEventSequence}`;
|
|
65784
65777
|
const snapshotSignal = markClientSnapshotStreaming(client, state.activeSessionId);
|
|
65785
|
-
void this.prepareReplacementSnapshot(client, state, message,
|
|
65778
|
+
void this.prepareReplacementSnapshot(client, state, message, snapshotSignal).catch((error) => {
|
|
65786
65779
|
finishClientSnapshotStreaming(client, state.activeSessionId);
|
|
65787
65780
|
this.log(`could not prepare replacement snapshot: ${String(error)}`);
|
|
65788
65781
|
if (!client.socket.destroyed && this.sessions.get(state.activeSessionId) === state) {
|
|
@@ -65793,7 +65786,7 @@ Use prime_context read/search with selected lines or a query.`;
|
|
|
65793
65786
|
}
|
|
65794
65787
|
});
|
|
65795
65788
|
}
|
|
65796
|
-
async prepareReplacementSnapshot(client, state, message,
|
|
65789
|
+
async prepareReplacementSnapshot(client, state, message, snapshotSignal) {
|
|
65797
65790
|
const result = await this.createAttachResult(client, state, {
|
|
65798
65791
|
type: "attach",
|
|
65799
65792
|
activeSessionId: state.activeSessionId
|
|
@@ -65805,6 +65798,7 @@ Use prime_context read/search with selected lines or a query.`;
|
|
|
65805
65798
|
}
|
|
65806
65799
|
return;
|
|
65807
65800
|
}
|
|
65801
|
+
const snapshotId = `${result.activeSessionId}-${result.lastEventCursor?.generation}-${result.lastEventSequence}`;
|
|
65808
65802
|
const transcript = createSnapshotTranscriptChunks({
|
|
65809
65803
|
activeSessionId: state.activeSessionId,
|
|
65810
65804
|
snapshotId,
|
|
@@ -66147,10 +66141,10 @@ Use prime_context read/search with selected lines or a query.`;
|
|
|
66147
66141
|
state: result.snapshot.state,
|
|
66148
66142
|
messages: [],
|
|
66149
66143
|
snapshotFollows: true,
|
|
66150
|
-
meta: createDaemonEventMeta(activeSessionId,
|
|
66144
|
+
meta: createDaemonEventMeta(activeSessionId, result.lastEventSequence, void 0, result.lastEventCursor?.generation)
|
|
66151
66145
|
});
|
|
66152
66146
|
}
|
|
66153
|
-
const snapshotId = `${activeSessionId}-${
|
|
66147
|
+
const snapshotId = `${result.activeSessionId}-${result.lastEventCursor?.generation}-${result.lastEventSequence}`;
|
|
66154
66148
|
const snapshotSignal = markClientSnapshotStreaming(client, activeSessionId);
|
|
66155
66149
|
let transcript;
|
|
66156
66150
|
try {
|
|
@@ -66177,7 +66171,7 @@ Use prime_context read/search with selected lines or a query.`;
|
|
|
66177
66171
|
}, transcript, purpose === "replacement" ? "replacement" : "catchup", snapshotSignal, true);
|
|
66178
66172
|
continue;
|
|
66179
66173
|
}
|
|
66180
|
-
const meta = createDaemonEventMeta(activeSessionId,
|
|
66174
|
+
const meta = createDaemonEventMeta(activeSessionId, result.lastEventSequence, void 0, result.lastEventCursor?.generation);
|
|
66181
66175
|
const catchup = purpose === "replacement" ? {
|
|
66182
66176
|
type: "session_replaced",
|
|
66183
66177
|
activeSessionId,
|
|
@@ -66341,17 +66335,7 @@ Use prime_context read/search with selected lines or a query.`;
|
|
|
66341
66335
|
shutdownFailure = true;
|
|
66342
66336
|
this.log(`RLM journal shutdown failed: ${error instanceof Error ? error.message : String(error)}`);
|
|
66343
66337
|
}
|
|
66344
|
-
|
|
66345
|
-
client.detachInput();
|
|
66346
|
-
client.socket.end();
|
|
66347
|
-
}
|
|
66348
|
-
await new Promise((resolveClose) => {
|
|
66349
|
-
if (!this.server) {
|
|
66350
|
-
resolveClose();
|
|
66351
|
-
return;
|
|
66352
|
-
}
|
|
66353
|
-
this.server.close(() => resolveClose());
|
|
66354
|
-
});
|
|
66338
|
+
await closeDaemonServer(this.server, this.clients);
|
|
66355
66339
|
this.cleanupSocketPath();
|
|
66356
66340
|
process.exit(exitCode || (shutdownFailure ? 1 : 0));
|
|
66357
66341
|
}
|
|
@@ -68077,7 +68061,7 @@ var DaemonSupervisor = class {
|
|
|
68077
68061
|
this.write(client, failure(command.id, command.type, "Daemon is preparing an update restart"));
|
|
68078
68062
|
return;
|
|
68079
68063
|
}
|
|
68080
|
-
if (mutation && !UPDATE_RESTART_DRAIN_COMMANDS.has(command.type)) {
|
|
68064
|
+
if (mutation && command.type !== "release_session_input_pause" && !UPDATE_RESTART_DRAIN_COMMANDS.has(command.type)) {
|
|
68081
68065
|
const idleEvictionFence = this.idleEvictionFence;
|
|
68082
68066
|
if (idleEvictionFence) {
|
|
68083
68067
|
await idleEvictionFence;
|
|
@@ -72477,11 +72461,7 @@ var DaemonSupervisor = class {
|
|
|
72477
72461
|
}
|
|
72478
72462
|
}
|
|
72479
72463
|
await this.catalog.stop();
|
|
72480
|
-
|
|
72481
|
-
client.detachInput();
|
|
72482
|
-
client.socket.end();
|
|
72483
|
-
}
|
|
72484
|
-
await new Promise((resolveClose) => this.server?.close(() => resolveClose()) ?? resolveClose());
|
|
72464
|
+
await closeDaemonServer(this.server, this.clients);
|
|
72485
72465
|
await this.runCleanupStep("daemon socket", () => this.cleanupSocket());
|
|
72486
72466
|
await this.runCleanupStep("supervisor cache", () => {
|
|
72487
72467
|
rmSync13(this.snapshotCacheRoot, { recursive: true, force: true });
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
isOwnedSessionWorkerProcess,
|
|
6
6
|
maybeRunOwnedSessionWorkerFrontend,
|
|
7
7
|
maybeStartDaemonEarly
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-CDXQNS5P.js";
|
|
9
9
|
import {
|
|
10
10
|
APP_NAME
|
|
11
11
|
} from "./chunk-2IPDSTDR.js";
|
|
@@ -39,7 +39,7 @@ async function runCli() {
|
|
|
39
39
|
}
|
|
40
40
|
const [{ EnvHttpProxyAgent, setGlobalDispatcher }, { main }] = await Promise.all([
|
|
41
41
|
import("undici"),
|
|
42
|
-
import("./main-
|
|
42
|
+
import("./main-5J3QBZ5Y.js")
|
|
43
43
|
]);
|
|
44
44
|
setGlobalDispatcher(new EnvHttpProxyAgent({ bodyTimeout: 0, headersTimeout: 0 }));
|
|
45
45
|
try {
|
package/dist/bundle/cli.js
CHANGED
|
@@ -17,8 +17,8 @@ import {
|
|
|
17
17
|
shouldUseDaemonClientRuntime,
|
|
18
18
|
shouldUseDaemonInteractive,
|
|
19
19
|
shouldUseEphemeralSessionManagerForDaemonInteractive
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-UHLGPYMI.js";
|
|
21
|
+
import "./chunk-CDXQNS5P.js";
|
|
22
22
|
import "./chunk-CFNASUYO.js";
|
|
23
23
|
import "./chunk-QKIFBA7N.js";
|
|
24
24
|
import "./chunk-2IPDSTDR.js";
|