@ponythewhite/base-context 1.0.13 → 1.0.15
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 +18 -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/amazon-bedrock.js +3 -3
- package/dist/bundle/{anthropic-BJVPUMPB.js → anthropic-AXUXEET7.js} +1 -1
- package/dist/bundle/{azure-openai-responses-ERRMAXK6.js → azure-openai-responses-J3NTJKEO.js} +2 -2
- package/dist/bundle/{bundled-modules-URKVA3UB.js → bundled-modules-O67MEO74.js} +5 -5
- package/dist/bundle/{chunk-FOGKLC7V.js → chunk-72LSQYUV.js} +1 -1
- package/dist/bundle/{chunk-TXVF6Q5H.js → chunk-DGO66I3L.js} +87 -51
- package/dist/bundle/{chunk-MUFZODP5.js → chunk-EGFIZABJ.js} +1 -1
- package/dist/bundle/{chunk-AEMRBMI2.js → chunk-IEM74GZ5.js} +9 -9
- package/dist/bundle/{chunk-25VYRAC6.js → chunk-JKKXN6JE.js} +72 -0
- package/dist/bundle/{chunk-TKOBEJ5E.js → chunk-RQFC34FM.js} +151 -51
- package/dist/bundle/{chunk-Q6UAHLII.js → chunk-V6LOBH6X.js} +2 -2
- package/dist/bundle/{cli-main-ZTJM5EEH.js → cli-main-2RER6PBE.js} +4 -4
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/{google-4GA4YMUX.js → google-QLKV2ZLC.js} +2 -2
- package/dist/bundle/{google-vertex-7AMALD7D.js → google-vertex-UGLUZV6B.js} +2 -2
- package/dist/bundle/{main-53I74INO.js → main-YERLD3T4.js} +5 -5
- package/dist/bundle/{mistral-74BXMNRM.js → mistral-2ITSLHYF.js} +1 -1
- package/dist/bundle/{openai-codex-responses-COXNC4IH.js → openai-codex-responses-FRREQXS3.js} +5 -4
- package/dist/bundle/{openai-completions-BCSA5Q6S.js → openai-completions-HF6UPPLW.js} +1 -1
- package/dist/bundle/{openai-responses-ONCIZSJS.js → openai-responses-LRTMBDFW.js} +2 -2
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +42 -25
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/autonomous.d.ts +2 -0
- package/dist/core/autonomous.d.ts.map +1 -1
- package/dist/core/autonomous.js +4 -0
- package/dist/core/autonomous.js.map +1 -1
- package/dist/core/canonical-context.d.ts.map +1 -1
- package/dist/core/canonical-context.js +7 -0
- package/dist/core/canonical-context.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +1 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +11 -9
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/inference-coordinator.d.ts.map +1 -1
- package/dist/core/inference-coordinator.js +13 -2
- package/dist/core/inference-coordinator.js.map +1 -1
- package/dist/core/kernel/repl-manager.d.ts.map +1 -1
- package/dist/core/kernel/repl-manager.js +5 -0
- package/dist/core/kernel/repl-manager.js.map +1 -1
- package/dist/core/public-context.d.ts.map +1 -1
- package/dist/core/public-context.js +2 -0
- package/dist/core/public-context.js.map +1 -1
- package/dist/core/session-manager.d.ts +8 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +57 -0
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/view-units.d.ts.map +1 -1
- package/dist/core/view-units.js +3 -0
- package/dist/core/view-units.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +1 -1
- package/dist/main.js.map +1 -1
- package/dist/modes/daemon/daemon-mode.d.ts.map +1 -1
- package/dist/modes/daemon/daemon-mode.js +21 -20
- package/dist/modes/daemon/daemon-mode.js.map +1 -1
- package/dist/modes/daemon/daemon-supervisor.d.ts.map +1 -1
- package/dist/modes/daemon/daemon-supervisor.js +11 -5
- package/dist/modes/daemon/daemon-supervisor.js.map +1 -1
- package/dist/modes/daemon/daemon-worker-client.d.ts +1 -0
- package/dist/modes/daemon/daemon-worker-client.d.ts.map +1 -1
- package/dist/modes/daemon/daemon-worker-client.js +8 -0
- package/dist/modes/daemon/daemon-worker-client.js.map +1 -1
- package/dist/modes/daemon/daemon-worker-protocol.d.ts +3 -0
- package/dist/modes/daemon/daemon-worker-protocol.d.ts.map +1 -1
- package/dist/modes/daemon/daemon-worker-protocol.js +2 -0
- package/dist/modes/daemon/daemon-worker-protocol.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +2 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +29 -4
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/print-mode.d.ts.map +1 -1
- package/dist/modes/print-mode.js +24 -21
- package/dist/modes/print-mode.js.map +1 -1
- package/docs/json.md +14 -1
- package/docs/long-running-agents.md +23 -2
- package/docs/providers.md +17 -0
- package/docs/upstream-1.0.15.md +83 -0
- package/package.json +4 -4
|
@@ -8703,6 +8703,42 @@ var MODELS = {
|
|
|
8703
8703
|
contextWindow: 105e4,
|
|
8704
8704
|
maxTokens: 128e3
|
|
8705
8705
|
},
|
|
8706
|
+
"gpt-6-luna": {
|
|
8707
|
+
id: "gpt-6-luna",
|
|
8708
|
+
name: "GPT-6 Luna",
|
|
8709
|
+
api: "openai-responses",
|
|
8710
|
+
provider: "openai",
|
|
8711
|
+
baseUrl: "https://api.openai.com/v1",
|
|
8712
|
+
reasoning: true,
|
|
8713
|
+
thinkingLevelMap: { "off": "none", "minimal": null, "xhigh": "xhigh", "max": "max" },
|
|
8714
|
+
input: ["text", "image"],
|
|
8715
|
+
cost: {
|
|
8716
|
+
input: 0.1,
|
|
8717
|
+
output: 0.5,
|
|
8718
|
+
cacheRead: 0.01,
|
|
8719
|
+
cacheWrite: 0.125
|
|
8720
|
+
},
|
|
8721
|
+
contextWindow: 105e4,
|
|
8722
|
+
maxTokens: 128e3
|
|
8723
|
+
},
|
|
8724
|
+
"gpt-6-sol": {
|
|
8725
|
+
id: "gpt-6-sol",
|
|
8726
|
+
name: "GPT-6 Sol",
|
|
8727
|
+
api: "openai-responses",
|
|
8728
|
+
provider: "openai",
|
|
8729
|
+
baseUrl: "https://api.openai.com/v1",
|
|
8730
|
+
reasoning: true,
|
|
8731
|
+
thinkingLevelMap: { "off": "none", "minimal": null, "xhigh": "xhigh", "max": "max" },
|
|
8732
|
+
input: ["text", "image"],
|
|
8733
|
+
cost: {
|
|
8734
|
+
input: 2,
|
|
8735
|
+
output: 10,
|
|
8736
|
+
cacheRead: 0.2,
|
|
8737
|
+
cacheWrite: 2.5
|
|
8738
|
+
},
|
|
8739
|
+
contextWindow: 105e4,
|
|
8740
|
+
maxTokens: 128e3
|
|
8741
|
+
},
|
|
8706
8742
|
"gpt-realtime-2.1": {
|
|
8707
8743
|
id: "gpt-realtime-2.1",
|
|
8708
8744
|
name: "GPT-Realtime-2.1",
|
|
@@ -9073,6 +9109,42 @@ var MODELS = {
|
|
|
9073
9109
|
},
|
|
9074
9110
|
contextWindow: 272e3,
|
|
9075
9111
|
maxTokens: 128e3
|
|
9112
|
+
},
|
|
9113
|
+
"gpt-6-luna": {
|
|
9114
|
+
id: "gpt-6-luna",
|
|
9115
|
+
name: "GPT-6 Luna",
|
|
9116
|
+
api: "openai-codex-responses",
|
|
9117
|
+
provider: "openai-codex",
|
|
9118
|
+
baseUrl: "https://chatgpt.com/backend-api",
|
|
9119
|
+
reasoning: true,
|
|
9120
|
+
thinkingLevelMap: { "off": null, "minimal": null, "xhigh": "xhigh", "max": "max" },
|
|
9121
|
+
input: ["text", "image"],
|
|
9122
|
+
cost: {
|
|
9123
|
+
input: 0.1,
|
|
9124
|
+
output: 0.5,
|
|
9125
|
+
cacheRead: 0.01,
|
|
9126
|
+
cacheWrite: 0.125
|
|
9127
|
+
},
|
|
9128
|
+
contextWindow: 872e3,
|
|
9129
|
+
maxTokens: 128e3
|
|
9130
|
+
},
|
|
9131
|
+
"gpt-6-sol": {
|
|
9132
|
+
id: "gpt-6-sol",
|
|
9133
|
+
name: "GPT-6 Sol",
|
|
9134
|
+
api: "openai-codex-responses",
|
|
9135
|
+
provider: "openai-codex",
|
|
9136
|
+
baseUrl: "https://chatgpt.com/backend-api",
|
|
9137
|
+
reasoning: true,
|
|
9138
|
+
thinkingLevelMap: { "off": null, "minimal": null, "xhigh": "xhigh", "max": "max" },
|
|
9139
|
+
input: ["text", "image"],
|
|
9140
|
+
cost: {
|
|
9141
|
+
input: 2,
|
|
9142
|
+
output: 10,
|
|
9143
|
+
cacheRead: 0.2,
|
|
9144
|
+
cacheWrite: 2.5
|
|
9145
|
+
},
|
|
9146
|
+
contextWindow: 872e3,
|
|
9147
|
+
maxTokens: 128e3
|
|
9076
9148
|
}
|
|
9077
9149
|
},
|
|
9078
9150
|
"opencode": {
|
|
@@ -32,7 +32,7 @@ import {
|
|
|
32
32
|
typebox_exports,
|
|
33
33
|
validateToolArguments,
|
|
34
34
|
waitForChildProcess
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-IEM74GZ5.js";
|
|
36
36
|
import {
|
|
37
37
|
cleanupSessionResources,
|
|
38
38
|
registerSessionResourceCleanup
|
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
requestTokenRouteIdentity,
|
|
68
68
|
supportsFastMode,
|
|
69
69
|
withRequestBody
|
|
70
|
-
} from "./chunk-
|
|
70
|
+
} from "./chunk-JKKXN6JE.js";
|
|
71
71
|
import {
|
|
72
72
|
__commonJS,
|
|
73
73
|
__export,
|
|
@@ -27268,7 +27268,7 @@ function formatPathRelativeToCwdOrAbsolute(filePath, cwd) {
|
|
|
27268
27268
|
}
|
|
27269
27269
|
|
|
27270
27270
|
// dist/core/session-manager.js
|
|
27271
|
-
import { isDeepStrictEqual as
|
|
27271
|
+
import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
|
|
27272
27272
|
import { randomUUID as randomUUID7 } from "crypto";
|
|
27273
27273
|
import { existsSync as existsSync8, readdirSync as readdirSync4, readFileSync as readFileSync6, realpathSync as realpathSync3, statSync as statSync5 } from "fs";
|
|
27274
27274
|
import { opendir, open as openFile, stat } from "fs/promises";
|
|
@@ -27688,6 +27688,7 @@ function stringifyBoundedJson(value, maxBytes) {
|
|
|
27688
27688
|
// dist/core/inference-coordinator.js
|
|
27689
27689
|
import { randomUUID as randomUUID5 } from "node:crypto";
|
|
27690
27690
|
import { setTimeout as delay2 } from "node:timers/promises";
|
|
27691
|
+
import { isDeepStrictEqual } from "node:util";
|
|
27691
27692
|
|
|
27692
27693
|
// dist/core/resource-view.js
|
|
27693
27694
|
var RESOURCE_VIEW_CUSTOM_TYPE = "native_resource_view";
|
|
@@ -28483,6 +28484,8 @@ ${data}`,
|
|
|
28483
28484
|
function renderPublicHistory(message2, entryId, maxBytes) {
|
|
28484
28485
|
if (message2.role !== "assistant" && message2.role !== "toolResult")
|
|
28485
28486
|
return message2;
|
|
28487
|
+
if (message2.role === "assistant" && (message2.stopReason === "error" || message2.stopReason === "aborted"))
|
|
28488
|
+
return message2;
|
|
28486
28489
|
const content = [];
|
|
28487
28490
|
for (const part of message2.content) {
|
|
28488
28491
|
switch (part.type) {
|
|
@@ -31328,6 +31331,8 @@ function bindMessageReplayUnits(messages, units, limits, policy = "complete-cont
|
|
|
31328
31331
|
}
|
|
31329
31332
|
if (message2.role === "assistant") {
|
|
31330
31333
|
closeCalls();
|
|
31334
|
+
if (message2.stopReason === "error" || message2.stopReason === "aborted")
|
|
31335
|
+
continue;
|
|
31331
31336
|
for (const part of message2.content)
|
|
31332
31337
|
if (part.type === "toolCall") {
|
|
31333
31338
|
if (calls.has(part.id))
|
|
@@ -31459,6 +31464,8 @@ function preparePublicContextWindow(messages, firstMessageIndex = 0) {
|
|
|
31459
31464
|
for (const [index, message2] of captured.entries()) {
|
|
31460
31465
|
if (index < firstMessageIndex || message2.role !== "assistant" && message2.role !== "toolResult")
|
|
31461
31466
|
continue;
|
|
31467
|
+
if (message2.role === "assistant" && (message2.stopReason === "error" || message2.stopReason === "aborted"))
|
|
31468
|
+
continue;
|
|
31462
31469
|
if (message2.content.some((part) => !["text", "toolCall", "thinking"].includes(part.type)))
|
|
31463
31470
|
return;
|
|
31464
31471
|
const reference = references[index];
|
|
@@ -32346,6 +32353,8 @@ ${JSON.stringify(selections.map((skill) => ({
|
|
|
32346
32353
|
...actual ? { result: { id: actual.id, sequence: actual.sequence, revision: actual.revision } } : {}
|
|
32347
32354
|
});
|
|
32348
32355
|
}
|
|
32356
|
+
if ((candidate.message.stopReason === "error" || candidate.message.stopReason === "aborted") && calls.every((call) => call.admission === "absent"))
|
|
32357
|
+
continue;
|
|
32349
32358
|
toolContinuations.push({ assistantEntryId: candidate.reference.ref.entryId, calls });
|
|
32350
32359
|
pendingPublicMessageGroups.push(members.sort((left, right) => left - right));
|
|
32351
32360
|
}
|
|
@@ -33696,6 +33705,7 @@ var InferenceCoordinator = class _InferenceCoordinator {
|
|
|
33696
33705
|
}) : void 0;
|
|
33697
33706
|
let publicAccepted = false;
|
|
33698
33707
|
let selectedContextEpoch;
|
|
33708
|
+
let preparedRequest;
|
|
33699
33709
|
const attempts = {
|
|
33700
33710
|
...responsesMessageIds ? { responsesMessageIds } : {},
|
|
33701
33711
|
...requiredPublic ? {
|
|
@@ -33707,6 +33717,9 @@ var InferenceCoordinator = class _InferenceCoordinator {
|
|
|
33707
33717
|
...budget || canSelect ? {
|
|
33708
33718
|
prepareRequest: async (representation, projection, countInput) => {
|
|
33709
33719
|
try {
|
|
33720
|
+
if (!projection && preparedRequest && isDeepStrictEqual(representation, preparedRequest))
|
|
33721
|
+
return;
|
|
33722
|
+
preparedRequest = void 0;
|
|
33710
33723
|
selectedContextEpoch = void 0;
|
|
33711
33724
|
publicAccepted = false;
|
|
33712
33725
|
if (JSON.parse(representation.body).model !== model.id)
|
|
@@ -33724,8 +33737,10 @@ var InferenceCoordinator = class _InferenceCoordinator {
|
|
|
33724
33737
|
if (budget && assessment)
|
|
33725
33738
|
budget.assert(assessment);
|
|
33726
33739
|
const accepted = await prepareFixedRequestView(boundary, representation, projection, assessment);
|
|
33727
|
-
if (accepted)
|
|
33740
|
+
if (accepted) {
|
|
33728
33741
|
selectedContextEpoch = Object.freeze({ ...accepted });
|
|
33742
|
+
preparedRequest = structuredClone(representation);
|
|
33743
|
+
}
|
|
33729
33744
|
return;
|
|
33730
33745
|
}
|
|
33731
33746
|
return await selectRequestView({
|
|
@@ -33733,8 +33748,10 @@ var InferenceCoordinator = class _InferenceCoordinator {
|
|
|
33733
33748
|
...responsesMessageIds ? { responseItemIdentity: this.work.responsesIdentity } : {},
|
|
33734
33749
|
commit: async (candidate) => {
|
|
33735
33750
|
const accepted = await boundary.commit(candidate);
|
|
33736
|
-
if (accepted)
|
|
33751
|
+
if (accepted) {
|
|
33737
33752
|
selectedContextEpoch = Object.freeze({ ...accepted });
|
|
33753
|
+
preparedRequest = structuredClone(candidate.request);
|
|
33754
|
+
}
|
|
33738
33755
|
publicAccepted = Boolean(accepted && candidate.publicMessages && candidate.projection.publicWindow && !candidate.projection.pendingPublicMessageGroups?.length);
|
|
33739
33756
|
return accepted || void 0;
|
|
33740
33757
|
}
|
|
@@ -34504,18 +34521,20 @@ ${previousSummary}
|
|
|
34504
34521
|
const textContent = response.content.filter((c) => c.type === "text").map((c) => c.text).join("\n");
|
|
34505
34522
|
return captureSummarySlice({ summary: textContent, usage: response.usage }, requests, completion, "history");
|
|
34506
34523
|
}
|
|
34507
|
-
function prepareViewCompaction(messages, entryIds, pathEntries, settings, maxCutEntryId, allowShortSession = false, budgetPressure = false) {
|
|
34524
|
+
function prepareViewCompaction(messages, entryIds, pathEntries, settings, maxCutEntryId, allowShortSession = false, budgetPressure = false, capturedSuffixAnchors) {
|
|
34508
34525
|
if (messages.length !== entryIds.length)
|
|
34509
34526
|
throw new Error("Compaction views do not match their source anchors");
|
|
34510
34527
|
const selectedIds = new Set(entryIds);
|
|
34511
|
-
const suffixAnchors =
|
|
34512
|
-
|
|
34513
|
-
|
|
34514
|
-
|
|
34515
|
-
|
|
34516
|
-
|
|
34517
|
-
|
|
34518
|
-
|
|
34528
|
+
const suffixAnchors = new Set(capturedSuffixAnchors);
|
|
34529
|
+
if (!capturedSuffixAnchors) {
|
|
34530
|
+
for (let index = pathEntries.length - 1; index >= 0; index--) {
|
|
34531
|
+
const entry = pathEntries[index];
|
|
34532
|
+
if (!getMessageFromEntryForCompaction(entry))
|
|
34533
|
+
continue;
|
|
34534
|
+
if (!selectedIds.has(entry.id))
|
|
34535
|
+
break;
|
|
34536
|
+
suffixAnchors.add(entry.id);
|
|
34537
|
+
}
|
|
34519
34538
|
}
|
|
34520
34539
|
let cuts = messages.flatMap((message2, index) => entryIds[index] && suffixAnchors.has(entryIds[index]) && message2.role !== "toolResult" && message2.role !== "compactionSummary" ? [index] : []);
|
|
34521
34540
|
let relaxRetention = false;
|
|
@@ -34786,7 +34805,7 @@ ${TURN_PREFIX_SUMMARIZATION_PROMPT}`;
|
|
|
34786
34805
|
}
|
|
34787
34806
|
|
|
34788
34807
|
// dist/core/context-epoch-copy.js
|
|
34789
|
-
import { isDeepStrictEqual } from "node:util";
|
|
34808
|
+
import { isDeepStrictEqual as isDeepStrictEqual2 } from "node:util";
|
|
34790
34809
|
var readCopiedEpochSource = /* @__PURE__ */ Symbol("readCopiedEpochSource");
|
|
34791
34810
|
function captureEpochCopyEntry(entry, source) {
|
|
34792
34811
|
const updateTarget = entry.type === "message" ? entry.message.role === "assistant" ? { kind: "assistant-usage", targetId: entry.id } : entry.message.role === "toolResult" && entry.message.toolName === "ipython" ? { kind: "ipython-sent-message", toolCallId: entry.message.toolCallId } : void 0 : void 0;
|
|
@@ -34887,7 +34906,7 @@ async function rebuildCopiedContextEpoch(history, copied, limits, metadataMaxByt
|
|
|
34887
34906
|
await prefix(checkpoint.source);
|
|
34888
34907
|
const copyReference = async (pinned) => {
|
|
34889
34908
|
const old = oldById.get(pinned.ref.entryId);
|
|
34890
|
-
if (!old || old.revision !== pinned.ref.revision || old.sequence !== pinned.ref.sequence || old.kind !== pinned.ref.kind || !
|
|
34909
|
+
if (!old || old.revision !== pinned.ref.revision || old.sequence !== pinned.ref.sequence || old.kind !== pinned.ref.kind || !isDeepStrictEqual2(old.locator, pinned.ref.locator))
|
|
34891
34910
|
throw new Error("Copied epoch recipe does not match its captured source");
|
|
34892
34911
|
const read2 = await prefix(pinned.source);
|
|
34893
34912
|
const actual = await read2.get(old.id);
|
|
@@ -34910,7 +34929,7 @@ async function rebuildCopiedContextEpoch(history, copied, limits, metadataMaxByt
|
|
|
34910
34929
|
throw new Error("Copied epoch frozen revisions are unavailable");
|
|
34911
34930
|
const updates = old.updateTarget ? (await read2.contextUpdates(old.updateTarget)).refs : [];
|
|
34912
34931
|
const expected = original.slice(1).map((revision) => oldByRevision.get(revision));
|
|
34913
|
-
if (expected.some((source) => !source || source.sequence > pinned.source.sourceSequence) || !
|
|
34932
|
+
if (expected.some((source) => !source || source.sequence > pinned.source.sourceSequence) || !isDeepStrictEqual2(expected.map((source) => source.id), updates.map((source) => source.entryId)))
|
|
34914
34933
|
throw new Error("Copied epoch update sources were not preserved");
|
|
34915
34934
|
sourceRevision = JSON.stringify([actual.revision, ...updates.map((update) => update.revision)]);
|
|
34916
34935
|
} else if (pinned.sourceRevision !== old.revision || pinned.retainedMessageCount === void 0) {
|
|
@@ -37858,6 +37877,10 @@ var SessionManager = class _SessionManager {
|
|
|
37858
37877
|
isCurrent: () => isCurrent(currentRevision),
|
|
37859
37878
|
readHistory: (read2) => sink.readHistory((history) => read2(history.branchContext)),
|
|
37860
37879
|
[readCopiedEpochSource]: (read2) => sink.readHistory(read2),
|
|
37880
|
+
readCompactionEntries: (entryIds) => {
|
|
37881
|
+
const ids = [...new Set(entryIds)];
|
|
37882
|
+
return sink.readHistory((history) => this._readCompactionEntriesAt(history, ids, capturedLimits));
|
|
37883
|
+
},
|
|
37861
37884
|
readBranch: async () => {
|
|
37862
37885
|
if (indexed)
|
|
37863
37886
|
return sink.readHistory(async (history) => (await this._readBranchesAt(history, [history.source.leafId], capturedLimits)).branches[0]);
|
|
@@ -37964,7 +37987,7 @@ var SessionManager = class _SessionManager {
|
|
|
37964
37987
|
throw new Error("Session journal requires explicit legacy migration");
|
|
37965
37988
|
const snapshot = await source;
|
|
37966
37989
|
const request = JSON.parse(stringifyBoundedJson(event, 1024 * 1024));
|
|
37967
|
-
if (!
|
|
37990
|
+
if (!isDeepStrictEqual3(request.source, snapshot))
|
|
37968
37991
|
throw new Error("Request event does not match its bound source");
|
|
37969
37992
|
const id = `${request.attemptId}:${request.type}`;
|
|
37970
37993
|
const entry = {
|
|
@@ -37977,7 +38000,7 @@ var SessionManager = class _SessionManager {
|
|
|
37977
38000
|
const json = stringifyBoundedJson(entry, 1024 * 1024 - 1);
|
|
37978
38001
|
if (indexed) {
|
|
37979
38002
|
await this._appendIndexedEntry(state, entry, true, void 0, (existing) => {
|
|
37980
|
-
if (existing.type !== "request" || !
|
|
38003
|
+
if (existing.type !== "request" || !isDeepStrictEqual3(existing.request, request))
|
|
37981
38004
|
throw new Error(`Conflicting request event: ${id}`);
|
|
37982
38005
|
return existing;
|
|
37983
38006
|
}, false);
|
|
@@ -37986,7 +38009,7 @@ var SessionManager = class _SessionManager {
|
|
|
37986
38009
|
await this._enqueue(state, Buffer.byteLength(json), async () => {
|
|
37987
38010
|
const existing = byId.get(id);
|
|
37988
38011
|
if (existing) {
|
|
37989
|
-
if (existing.type !== "request" || !
|
|
38012
|
+
if (existing.type !== "request" || !isDeepStrictEqual3(existing.request, request))
|
|
37990
38013
|
throw new Error(`Conflicting request event: ${id}`);
|
|
37991
38014
|
return;
|
|
37992
38015
|
}
|
|
@@ -38009,7 +38032,7 @@ var SessionManager = class _SessionManager {
|
|
|
38009
38032
|
};
|
|
38010
38033
|
if (persistent && indexed && writer?.format === "framed") {
|
|
38011
38034
|
const capture = (association) => {
|
|
38012
|
-
if (!outputSource || !ownsOutputSource() || !
|
|
38035
|
+
if (!outputSource || !ownsOutputSource() || !isDeepStrictEqual3(association.source, outputSource))
|
|
38013
38036
|
return void 0;
|
|
38014
38037
|
return structuredClone(association);
|
|
38015
38038
|
};
|
|
@@ -38703,6 +38726,54 @@ var SessionManager = class _SessionManager {
|
|
|
38703
38726
|
return entries;
|
|
38704
38727
|
});
|
|
38705
38728
|
}
|
|
38729
|
+
async _readCompactionEntriesAt(history, entryIds, limits) {
|
|
38730
|
+
const { maxEntries, maxSourceBytes } = limits;
|
|
38731
|
+
if (!Number.isSafeInteger(maxEntries) || maxEntries <= 0 || !Number.isSafeInteger(maxSourceBytes) || maxSourceBytes <= 0)
|
|
38732
|
+
throw new Error("Invalid compaction source limits");
|
|
38733
|
+
if (entryIds.length > maxEntries)
|
|
38734
|
+
throw new Error("Compaction entry budget exceeded");
|
|
38735
|
+
const selected = new Set(entryIds);
|
|
38736
|
+
const references = [];
|
|
38737
|
+
for (const id of entryIds) {
|
|
38738
|
+
const reference = await history.branchContext.get(id);
|
|
38739
|
+
if (!reference)
|
|
38740
|
+
throw new Error("Compaction entry is outside its captured branch");
|
|
38741
|
+
references.push(reference);
|
|
38742
|
+
}
|
|
38743
|
+
references.sort((a, b2) => a.sequence - b2.sequence);
|
|
38744
|
+
const suffixAnchors = /* @__PURE__ */ new Set();
|
|
38745
|
+
const visited = /* @__PURE__ */ new Set();
|
|
38746
|
+
let current = history.source.leafId;
|
|
38747
|
+
let leafKind;
|
|
38748
|
+
while (current !== null) {
|
|
38749
|
+
if (visited.has(current))
|
|
38750
|
+
throw new Error("Compaction parent path is unresolved");
|
|
38751
|
+
visited.add(current);
|
|
38752
|
+
const reference = await history.branchContext.get(current);
|
|
38753
|
+
if (!reference)
|
|
38754
|
+
throw new Error("Compaction parent path is unresolved");
|
|
38755
|
+
leafKind ??= reference.kind;
|
|
38756
|
+
if (["message", "custom_message", "branch_summary"].includes(reference.kind)) {
|
|
38757
|
+
if (!selected.has(reference.id))
|
|
38758
|
+
break;
|
|
38759
|
+
suffixAnchors.add(reference.id);
|
|
38760
|
+
}
|
|
38761
|
+
current = reference.parentId;
|
|
38762
|
+
}
|
|
38763
|
+
const entries = [];
|
|
38764
|
+
let sourceBytes = 0;
|
|
38765
|
+
for (const reference of references) {
|
|
38766
|
+
const remaining = maxSourceBytes - sourceBytes;
|
|
38767
|
+
sourceBytes += reference.locator.length;
|
|
38768
|
+
if (sourceBytes > maxSourceBytes)
|
|
38769
|
+
throw new Error("Compaction source byte budget exceeded");
|
|
38770
|
+
const value = await history.hydrateEntry(reference.id, remaining);
|
|
38771
|
+
if (!value)
|
|
38772
|
+
throw new Error("Compaction entry source is unavailable");
|
|
38773
|
+
entries.push(withEntryRetention(value.entry, value.source.retention, value.source.qualification));
|
|
38774
|
+
}
|
|
38775
|
+
return { entries, suffixAnchors, leafKind };
|
|
38776
|
+
}
|
|
38706
38777
|
async _readBranchesAt(history, leafIds, limits) {
|
|
38707
38778
|
const { maxEntries, maxSourceBytes } = limits;
|
|
38708
38779
|
if (!Number.isSafeInteger(maxEntries) || maxEntries <= 0 || !Number.isSafeInteger(maxSourceBytes) || maxSourceBytes <= 0)
|
|
@@ -41475,6 +41546,7 @@ var DAEMON_WORKER_INSTANCE_ID_ENV = "BASE_CONTEXT_INTERNAL_DAEMON_WORKER_INSTANC
|
|
|
41475
41546
|
var DAEMON_WORKER_ACTIVE_SESSION_ID_ENV = "BASE_CONTEXT_INTERNAL_DAEMON_WORKER_ACTIVE_SESSION_ID";
|
|
41476
41547
|
var DAEMON_WORKER_SUPERVISOR_SOCKET_ENV = "BASE_CONTEXT_INTERNAL_DAEMON_SUPERVISOR_SOCKET";
|
|
41477
41548
|
var DAEMON_WORKER_RECOVERY_JOURNAL_ENV = "BASE_CONTEXT_INTERNAL_DAEMON_WORKER_RECOVERY_JOURNAL";
|
|
41549
|
+
var DAEMON_WORKER_RLM_LEDGER_SESSION_DIR_ENV = "BASE_CONTEXT_INTERNAL_DAEMON_WORKER_RLM_LEDGER_SESSION_DIR";
|
|
41478
41550
|
var DAEMON_WORKER_STARTUP_GATE_FD_ENV = "BASE_CONTEXT_INTERNAL_DAEMON_WORKER_STARTUP_GATE_FD";
|
|
41479
41551
|
var DAEMON_WORKER_STARTUP_GATE_COMMIT = "start\n";
|
|
41480
41552
|
var DAEMON_WORKER_ROSTER_CAPABILITY = "agent_roster";
|
|
@@ -41510,6 +41582,7 @@ function durableDaemonWorkerDescriptor(descriptor2) {
|
|
|
41510
41582
|
...descriptor2.rootSessionId !== void 0 ? { rootSessionId: descriptor2.rootSessionId } : {},
|
|
41511
41583
|
...descriptor2.sessionFile !== void 0 ? { sessionFile: descriptor2.sessionFile } : {},
|
|
41512
41584
|
...sessionDir !== void 0 ? { sessionDir } : {},
|
|
41585
|
+
...descriptor2.rlmLedgerSessionDir !== void 0 ? { rlmLedgerSessionDir: descriptor2.rlmLedgerSessionDir } : {},
|
|
41513
41586
|
createdAt: descriptor2.createdAt,
|
|
41514
41587
|
updatedAt: descriptor2.updatedAt,
|
|
41515
41588
|
lifecycle: descriptor2.lifecycle,
|
|
@@ -41575,7 +41648,7 @@ import { randomUUID as randomUUID12 } from "node:crypto";
|
|
|
41575
41648
|
import { existsSync as existsSync24, mkdirSync as mkdirSync8, mkdtempSync as mkdtempSync2 } from "node:fs";
|
|
41576
41649
|
import { tmpdir as tmpdir9 } from "node:os";
|
|
41577
41650
|
import { basename as basename10, dirname as dirname18, join as join29, resolve as resolve13 } from "node:path";
|
|
41578
|
-
import { isDeepStrictEqual as
|
|
41651
|
+
import { isDeepStrictEqual as isDeepStrictEqual5 } from "node:util";
|
|
41579
41652
|
|
|
41580
41653
|
// dist/utils/sleep.js
|
|
41581
41654
|
function sleep(ms, signal) {
|
|
@@ -42390,6 +42463,9 @@ function autonomousLimitReason(state, now2 = Date.now()) {
|
|
|
42390
42463
|
if (state.continuationsUsed >= state.limits.maxContinuations) {
|
|
42391
42464
|
return "maxContinuations";
|
|
42392
42465
|
}
|
|
42466
|
+
return autonomousRunLimitReason(state, now2);
|
|
42467
|
+
}
|
|
42468
|
+
function autonomousRunLimitReason(state, now2 = Date.now()) {
|
|
42393
42469
|
if (state.turnsUsed >= state.limits.maxTurns) {
|
|
42394
42470
|
return "maxTurns";
|
|
42395
42471
|
}
|
|
@@ -46083,7 +46159,7 @@ async function loadExtensionModule(extensionPath) {
|
|
|
46083
46159
|
// (file-path aliases would load a second, divergent copy of each package).
|
|
46084
46160
|
// Also disable tryNative so jiti handles ALL imports (not just the entry point)
|
|
46085
46161
|
// Node/dev must also share the native AI registry and implementation identities.
|
|
46086
|
-
...isBunBinary || isBundledCli ? { virtualModules: (await import("./bundled-modules-
|
|
46162
|
+
...isBunBinary || isBundledCli ? { virtualModules: (await import("./bundled-modules-O67MEO74.js")).VIRTUAL_MODULES, tryNative: false } : {
|
|
46087
46163
|
alias: getAliases(),
|
|
46088
46164
|
virtualModules: {
|
|
46089
46165
|
"@ponythewhite/base-context-ai": src_exports,
|
|
@@ -47374,7 +47450,7 @@ import { randomUUID as randomUUID11 } from "node:crypto";
|
|
|
47374
47450
|
import { closeSync as closeSync5, existsSync as existsSync18, fstatSync as fstatSync2, mkdirSync as mkdirSync6, openSync as openSync4, readSync as readSync3, renameSync as renameSync4, statSync as statSync9, unlinkSync as unlinkSync2, writeFileSync as writeFileSync6 } from "node:fs";
|
|
47375
47451
|
import { appendFile, mkdir as mkdir2 } from "node:fs/promises";
|
|
47376
47452
|
import { join as join25 } from "node:path";
|
|
47377
|
-
import { isDeepStrictEqual as
|
|
47453
|
+
import { isDeepStrictEqual as isDeepStrictEqual4 } from "node:util";
|
|
47378
47454
|
var REFINEMENT_CUSTOM_TYPE = "prime-agent.refinement";
|
|
47379
47455
|
var REFINE_SKILL_NAME = "refine";
|
|
47380
47456
|
var HARNESS_STATE_DIR_NAME = "harness";
|
|
@@ -48101,7 +48177,7 @@ function applyRefinementProposal(state, proposal, options) {
|
|
|
48101
48177
|
rollbackOf: options.rollbackOf,
|
|
48102
48178
|
scope: options.scope
|
|
48103
48179
|
};
|
|
48104
|
-
if (application && state === application.state && options.id === application.native.id && options.scope === application.scope && options.rollbackOf === void 0 && options.baselineState === application.native.baselineState && matchesNativePlannerPlan(application.plan, application.native) && matchesPlannerOptions(application.options, application.native.options) &&
|
|
48180
|
+
if (application && state === application.state && options.id === application.native.id && options.scope === application.scope && options.rollbackOf === void 0 && options.baselineState === application.native.baselineState && matchesNativePlannerPlan(application.plan, application.native) && matchesPlannerOptions(application.options, application.native.options) && isDeepStrictEqual4(proposal, application.projection)) {
|
|
48105
48181
|
nativePlannerResults.set(result, { native: application.native, scope: application.scope, edits: appliedEdits });
|
|
48106
48182
|
}
|
|
48107
48183
|
return result;
|
|
@@ -48149,7 +48225,7 @@ var nativePlannerPlans = /* @__PURE__ */ new WeakMap();
|
|
|
48149
48225
|
var nativePlannerApplications = /* @__PURE__ */ new WeakMap();
|
|
48150
48226
|
var nativePlannerResults = /* @__PURE__ */ new WeakMap();
|
|
48151
48227
|
function matchesNativePlannerPlan(plan, native) {
|
|
48152
|
-
return plan.proposal === native.proposal && plan.id === native.id && plan.rollbackOf === void 0 && plan.rollbackScope === void 0 && plan.baselineState === native.baselineState &&
|
|
48228
|
+
return plan.proposal === native.proposal && plan.id === native.id && plan.rollbackOf === void 0 && plan.rollbackScope === void 0 && plan.baselineState === native.baselineState && isDeepStrictEqual4(plan.proposal, native.projection);
|
|
48153
48229
|
}
|
|
48154
48230
|
function matchesPlannerOptions(options, captured) {
|
|
48155
48231
|
return options.instructions === captured.instructions && options.global === captured.global && options.rollbackId === captured.rollbackId;
|
|
@@ -57231,6 +57307,11 @@ var ReplKernelManager = class {
|
|
|
57231
57307
|
return;
|
|
57232
57308
|
this.appendKernelDiagnostic(`kernel stdout error: ${errorMessage3(error)}`);
|
|
57233
57309
|
});
|
|
57310
|
+
child.stderr?.on("error", (error) => {
|
|
57311
|
+
if (this.child !== child)
|
|
57312
|
+
return;
|
|
57313
|
+
this.appendKernelDiagnostic(`kernel stderr error: ${errorMessage3(error)}`);
|
|
57314
|
+
});
|
|
57234
57315
|
child.once("exit", () => {
|
|
57235
57316
|
globalThis.setImmediate(() => child.stderr?.destroy());
|
|
57236
57317
|
});
|
|
@@ -61106,6 +61187,8 @@ var AgentSession = class _AgentSession {
|
|
|
61106
61187
|
return (await this._getTurnOutcome({ ...context, hasMoreToolCalls: !!last && last.role !== "assistant" })).kind !== "proceed";
|
|
61107
61188
|
}
|
|
61108
61189
|
async _getTurnOutcome(context, signal) {
|
|
61190
|
+
if (this._autonomousState.enabled)
|
|
61191
|
+
await this._agentEventQueue;
|
|
61109
61192
|
const sourceOwner = signal ? this._invocationCompactionOwner : this._captureCompactionOwner();
|
|
61110
61193
|
if (!sourceOwner || signal?.aborted || signal && sourceOwner.signal !== signal || !this._isCompactionSourceOwnerCurrent(sourceOwner))
|
|
61111
61194
|
return { kind: "cancelled" };
|
|
@@ -61123,6 +61206,8 @@ var AgentSession = class _AgentSession {
|
|
|
61123
61206
|
return { kind: "finish" };
|
|
61124
61207
|
if (!current())
|
|
61125
61208
|
return { kind: "cancelled" };
|
|
61209
|
+
if (this._autonomousState.enabled && autonomousRunLimitReason(this._autonomousState))
|
|
61210
|
+
return { kind: "finish" };
|
|
61126
61211
|
try {
|
|
61127
61212
|
if (await this._accountGoalUsageForAssistantMessage(context.message, goalOwner)) {
|
|
61128
61213
|
this._assertGoalContinuationOwner(goalOwner);
|
|
@@ -61675,7 +61760,7 @@ var AgentSession = class _AgentSession {
|
|
|
61675
61760
|
const { state, snapshot: original, arrivalEpoch, cwd } = capture;
|
|
61676
61761
|
const before = this._snapshotAutonomousRuntimeState(original);
|
|
61677
61762
|
const candidate = structuredClone(original);
|
|
61678
|
-
const current = () => this._isCompactionOwnerCurrent(owner) && this._autonomousState === state &&
|
|
61763
|
+
const current = () => this._isCompactionOwnerCurrent(owner) && this._autonomousState === state && isDeepStrictEqual5(state, original);
|
|
61679
61764
|
if (!current())
|
|
61680
61765
|
return void 0;
|
|
61681
61766
|
let messageToQueue;
|
|
@@ -61785,7 +61870,7 @@ var AgentSession = class _AgentSession {
|
|
|
61785
61870
|
const actions = new Set(current.map((continuation) => continuation.action));
|
|
61786
61871
|
const cancelled = this._cancelSessionActions((action) => actions.has(action), new Error("Queued autonomous continuation was cleared before delivery."));
|
|
61787
61872
|
if (options.restoreAutonomousState) {
|
|
61788
|
-
const continuation = current.find((candidate) => this._isCompactionOwnerCurrent(candidate.owner) && cancelled.includes(candidate.action) && !primaryDeliveryRecord(candidate.action).durable && this._autonomousState === candidate.state &&
|
|
61873
|
+
const continuation = current.find((candidate) => this._isCompactionOwnerCurrent(candidate.owner) && cancelled.includes(candidate.action) && !primaryDeliveryRecord(candidate.action).durable && this._autonomousState === candidate.state && isDeepStrictEqual5(candidate.state, candidate.after));
|
|
61789
61874
|
if (continuation)
|
|
61790
61875
|
this._restoreAutonomousRuntimeSnapshot(continuation.before);
|
|
61791
61876
|
}
|
|
@@ -61866,12 +61951,14 @@ var AgentSession = class _AgentSession {
|
|
|
61866
61951
|
this._assertCompactionOwner(owner);
|
|
61867
61952
|
const compaction = owner.manager.bindCompactionSink();
|
|
61868
61953
|
const captured = owner.requests.capture(compaction);
|
|
61869
|
-
let branch;
|
|
61870
61954
|
let preparation;
|
|
61955
|
+
let leafKind;
|
|
61871
61956
|
try {
|
|
61872
|
-
|
|
61873
|
-
|
|
61874
|
-
|
|
61957
|
+
if (this.isStreaming) {
|
|
61958
|
+
const prepared = await this._prepareCapturedCompaction(settings, captured, compaction, owner);
|
|
61959
|
+
preparation = prepared.preparation;
|
|
61960
|
+
leafKind = prepared.leafKind;
|
|
61961
|
+
}
|
|
61875
61962
|
} catch (error) {
|
|
61876
61963
|
try {
|
|
61877
61964
|
await captured.dispose();
|
|
@@ -61890,10 +61977,9 @@ var AgentSession = class _AgentSession {
|
|
|
61890
61977
|
reason: "no active turn; compaction can only be requested while a turn is running"
|
|
61891
61978
|
};
|
|
61892
61979
|
if (!preparation) {
|
|
61893
|
-
const lastEntry = branch.at(-1);
|
|
61894
61980
|
return {
|
|
61895
61981
|
scheduled: false,
|
|
61896
|
-
reason:
|
|
61982
|
+
reason: leafKind === "compaction" ? "already compacted" : "session is too short to compact"
|
|
61897
61983
|
};
|
|
61898
61984
|
}
|
|
61899
61985
|
this._assertContextOptimizationAllowed();
|
|
@@ -62220,7 +62306,7 @@ var AgentSession = class _AgentSession {
|
|
|
62220
62306
|
const autonomousState = this._autonomousState;
|
|
62221
62307
|
const autonomousSnapshot = structuredClone(autonomousState);
|
|
62222
62308
|
const cwd = this._cwd;
|
|
62223
|
-
const autonomousOwnerIsCurrent = () => this._autonomousState === autonomousState &&
|
|
62309
|
+
const autonomousOwnerIsCurrent = () => this._autonomousState === autonomousState && isDeepStrictEqual5(autonomousState, autonomousSnapshot);
|
|
62224
62310
|
const goalOutcome = await this._getGoalContinuationMessages(context, signal, owner);
|
|
62225
62311
|
if (!this._isGoalContinuationOwnerCurrent(owner))
|
|
62226
62312
|
return this._stoppedContinuationOutcome(signal);
|
|
@@ -64811,8 +64897,9 @@ ${parsed.args}` : block;
|
|
|
64811
64897
|
actionId: action.id,
|
|
64812
64898
|
submittedText: input.submitted?.text
|
|
64813
64899
|
};
|
|
64900
|
+
const clearedGoal = Boolean(this._goalState.objective) && this._parseGoalSlashCommand(input.text)?.kind === "clear";
|
|
64814
64901
|
await this._handleGoalSlashCommand(input.text, input.images, goalOrigin);
|
|
64815
|
-
resultText = this._goalState.objective ? `Goal ${this._goalState.status}: ${this._goalState.objective}` : "No active goal.";
|
|
64902
|
+
resultText = this._goalState.objective ? `Goal ${this._goalState.status}: ${this._goalState.objective}` : clearedGoal ? "Goal cleared." : "No active goal.";
|
|
64816
64903
|
break;
|
|
64817
64904
|
}
|
|
64818
64905
|
case "autonomous":
|
|
@@ -65985,14 +66072,12 @@ ${parsed.args}` : block;
|
|
|
65985
66072
|
const semanticEdges = owner.semanticEdges;
|
|
65986
66073
|
compaction = owner.manager.bindCompactionSink();
|
|
65987
66074
|
requests = owner.requests.capture(compaction);
|
|
65988
|
-
const pathEntries = await compaction.readBranch();
|
|
65989
66075
|
this._assertCompactionOwner(owner);
|
|
65990
66076
|
const { apiKey, headers } = await this._getRequiredRequestAuth(model);
|
|
65991
66077
|
this._assertCompactionOwner(owner);
|
|
65992
66078
|
committed = await this._performCompaction({
|
|
65993
66079
|
model,
|
|
65994
66080
|
thinkingLevel,
|
|
65995
|
-
pathEntries,
|
|
65996
66081
|
settings,
|
|
65997
66082
|
requests,
|
|
65998
66083
|
compaction,
|
|
@@ -66076,30 +66161,46 @@ ${parsed.args}` : block;
|
|
|
66076
66161
|
}
|
|
66077
66162
|
}
|
|
66078
66163
|
/** A private compiled context keeps extension summary edits separate from retained source recipes. */
|
|
66079
|
-
async _prepareCapturedCompaction(
|
|
66164
|
+
async _prepareCapturedCompaction(settings, requests, compaction, owner = this._captureCompactionOwner(), allowShortSession = false, budgetPressure = false, capacity) {
|
|
66080
66165
|
this._assertCompactionOwner(owner);
|
|
66081
66166
|
const limits = this.settingsManager.getCanonicalContextLimits();
|
|
66082
66167
|
const resource = this._captureKernelResource();
|
|
66083
66168
|
const source = await compaction.source;
|
|
66084
66169
|
this._assertCompactionOwner(owner);
|
|
66085
|
-
if (!source.persistent)
|
|
66170
|
+
if (!source.persistent) {
|
|
66171
|
+
const pathEntries = await compaction.readBranch();
|
|
66172
|
+
this._assertCompactionOwner(owner);
|
|
66086
66173
|
return {
|
|
66087
66174
|
preparation: prepareCompaction(pathEntries, settings, allowShortSession),
|
|
66175
|
+
pathEntries,
|
|
66176
|
+
leafKind: pathEntries.at(-1)?.type,
|
|
66088
66177
|
maxSourceBytes: limits.maxSourceBytes
|
|
66089
66178
|
};
|
|
66179
|
+
}
|
|
66090
66180
|
return requests.readHistory(async (view) => {
|
|
66091
66181
|
const messages = await new CanonicalContextCompiler().compile(view, limits, void 0, {}, resource, this._initialContextMode, false, "read");
|
|
66092
66182
|
this._assertCompactionOwner(owner);
|
|
66093
66183
|
const context = getCanonicalEpochContext(messages);
|
|
66094
|
-
|
|
66095
|
-
|
|
66184
|
+
const entryIds = context.references.map((ref) => ref?.ref.entryId);
|
|
66185
|
+
const selected = await compaction.readCompactionEntries(entryIds.filter((id) => id !== void 0));
|
|
66186
|
+
this._assertCompactionOwner(owner);
|
|
66187
|
+
const pathEntries = selected.entries;
|
|
66188
|
+
if (context.checkpoint?.includeSummary && selected.leafKind === "compaction")
|
|
66189
|
+
return {
|
|
66190
|
+
preparation: void 0,
|
|
66191
|
+
pathEntries,
|
|
66192
|
+
leafKind: selected.leafKind,
|
|
66193
|
+
maxSourceBytes: limits.maxSourceBytes
|
|
66194
|
+
};
|
|
66096
66195
|
const authorization = getRecoveryCompactionAuthorization(capacity);
|
|
66097
66196
|
const boundary = canonicalRecoveryBoundary(messages, authorization);
|
|
66098
|
-
const preparation =
|
|
66197
|
+
const preparation = prepareViewCompaction(messages, entryIds, pathEntries, settings, boundary, allowShortSession, budgetPressure, selected.suffixAnchors);
|
|
66099
66198
|
if (preparation)
|
|
66100
66199
|
prepareRecoveryCompaction(messages, preparation.firstKeptEntryId, limits.maxSourceBytes, authorization);
|
|
66101
66200
|
return {
|
|
66102
66201
|
preparation,
|
|
66202
|
+
pathEntries,
|
|
66203
|
+
leafKind: selected.leafKind,
|
|
66103
66204
|
messages,
|
|
66104
66205
|
resource: context.resourceRevision !== void 0 ? resource : void 0,
|
|
66105
66206
|
maxSourceBytes: limits.maxSourceBytes
|
|
@@ -66112,15 +66213,15 @@ ${parsed.args}` : block;
|
|
|
66112
66213
|
* Error("Compaction cancelled") on abort or extension cancel.
|
|
66113
66214
|
*/
|
|
66114
66215
|
async _performCompaction(options) {
|
|
66115
|
-
const { model, apiKey, headers, customInstructions, signal, thinkingLevel, requests, compaction, semanticEdges,
|
|
66116
|
-
const prepared = await this._prepareCapturedCompaction(
|
|
66216
|
+
const { model, apiKey, headers, customInstructions, signal, thinkingLevel, requests, compaction, semanticEdges, settings, owner = this._captureCompactionOwner(), allowShortSession = false, budgetPressure = false } = options;
|
|
66217
|
+
const prepared = await this._prepareCapturedCompaction(settings, requests, compaction, owner, allowShortSession, budgetPressure, options.capacity);
|
|
66117
66218
|
this._assertCompactionOwner(owner);
|
|
66118
66219
|
if (prepared.resource)
|
|
66119
66220
|
assertResourceCurrent(prepared.resource);
|
|
66120
66221
|
const preparation = prepared.preparation;
|
|
66222
|
+
const pathEntries = prepared.pathEntries;
|
|
66121
66223
|
if (!preparation) {
|
|
66122
|
-
|
|
66123
|
-
if (lastEntry?.type === "compaction") {
|
|
66224
|
+
if (prepared.leafKind === "compaction") {
|
|
66124
66225
|
throw new CompactionSkippedError("Already compacted");
|
|
66125
66226
|
}
|
|
66126
66227
|
throw new CompactionSkippedError("Session is too short to compact \u2014 try again once it grows");
|
|
@@ -66782,7 +66883,7 @@ ${parsed.args}` : block;
|
|
|
66782
66883
|
const harnessState = this._loadMergedHarnessState();
|
|
66783
66884
|
const evidence = await this._autoRefineEvidence(harnessState);
|
|
66784
66885
|
signal?.throwIfAborted();
|
|
66785
|
-
if (
|
|
66886
|
+
if (isDeepStrictEqual5(evidence, this._lastAutoRefineEvidence))
|
|
66786
66887
|
return { shouldRefine: false, rationale: "No new task evidence since the previous automatic review." };
|
|
66787
66888
|
this._lastAutoRefineEvidence = evidence;
|
|
66788
66889
|
if (this._autoRefineReviewer)
|
|
@@ -67359,7 +67460,6 @@ This compaction outcome could not be saved to session history: ${persistenceErro
|
|
|
67359
67460
|
const semanticEdges = owner.semanticEdges;
|
|
67360
67461
|
compaction = owner.manager.bindCompactionSink();
|
|
67361
67462
|
requests = owner.requests.capture(compaction);
|
|
67362
|
-
const pathEntries = await compaction.readBranch();
|
|
67363
67463
|
this._assertCompactionOwner(owner);
|
|
67364
67464
|
const authResult = model ? await this._modelRegistry.getApiKeyAndHeaders(model) : void 0;
|
|
67365
67465
|
this._assertCompactionOwner(owner);
|
|
@@ -67374,7 +67474,6 @@ This compaction outcome could not be saved to session history: ${persistenceErro
|
|
|
67374
67474
|
committed = await this._performCompaction({
|
|
67375
67475
|
model,
|
|
67376
67476
|
thinkingLevel,
|
|
67377
|
-
pathEntries,
|
|
67378
67477
|
settings,
|
|
67379
67478
|
requests,
|
|
67380
67479
|
compaction,
|
|
@@ -70912,7 +71011,7 @@ import { resolve as resolve15 } from "node:path";
|
|
|
70912
71011
|
var BASE_CONTEXT_BUILD_ID_ENV = "BASE_CONTEXT_BUILD_ID";
|
|
70913
71012
|
var BASE_CONTEXT_LAUNCHER_PATH_ENV = "BASE_CONTEXT_LAUNCHER_PATH";
|
|
70914
71013
|
function bundledBuildId() {
|
|
70915
|
-
return false ? void 0 : "v1.0.
|
|
71014
|
+
return false ? void 0 : "v1.0.14-2-g7486ffe2b";
|
|
70916
71015
|
}
|
|
70917
71016
|
function getDaemonRuntimeIdentity(environment = process.env) {
|
|
70918
71017
|
const entrypoint = process.argv[1];
|
|
@@ -71720,6 +71819,7 @@ export {
|
|
|
71720
71819
|
DAEMON_WORKER_ACTIVE_SESSION_ID_ENV,
|
|
71721
71820
|
DAEMON_WORKER_SUPERVISOR_SOCKET_ENV,
|
|
71722
71821
|
DAEMON_WORKER_RECOVERY_JOURNAL_ENV,
|
|
71822
|
+
DAEMON_WORKER_RLM_LEDGER_SESSION_DIR_ENV,
|
|
71723
71823
|
DAEMON_WORKER_STARTUP_GATE_FD_ENV,
|
|
71724
71824
|
DAEMON_WORKER_STARTUP_GATE_COMMIT,
|
|
71725
71825
|
DAEMON_WORKER_ROSTER_CAPABILITY,
|
|
@@ -2,11 +2,11 @@ import { createRequire as __piBundleCreateRequire } from 'node:module'; const re
|
|
|
2
2
|
import {
|
|
3
3
|
appendRotatingLog,
|
|
4
4
|
getAgentLogPath
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-IEM74GZ5.js";
|
|
6
6
|
import {
|
|
7
7
|
setLogSink,
|
|
8
8
|
stringifyLogEntry
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-JKKXN6JE.js";
|
|
10
10
|
|
|
11
11
|
// dist/core/logging.js
|
|
12
12
|
var AGENT_LOG_MAX_BYTES = 20 * 1024 * 1024;
|