@ponythewhite/base-context 1.0.11 → 1.0.13
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 +15 -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-5PSCZEER.js → anthropic-BJVPUMPB.js} +2 -2
- package/dist/bundle/{azure-openai-responses-AYTLJR33.js → azure-openai-responses-ERRMAXK6.js} +4 -5
- package/dist/bundle/{bundled-modules-PEFT72QN.js → bundled-modules-URKVA3UB.js} +5 -5
- package/dist/bundle/{chunk-D3KOF57W.js → chunk-25VYRAC6.js} +14 -1
- package/dist/bundle/{chunk-2IPDSTDR.js → chunk-AEMRBMI2.js} +9 -9
- package/dist/bundle/{chunk-Q3MBSBEB.js → chunk-FOGKLC7V.js} +1 -1
- package/dist/bundle/{chunk-KT2BNEPE.js → chunk-MUFZODP5.js} +1 -1
- package/dist/bundle/{chunk-QKIFBA7N.js → chunk-Q6UAHLII.js} +2 -2
- package/dist/bundle/{chunk-TOOVREMP.js → chunk-TKOBEJ5E.js} +515 -107
- package/dist/bundle/{chunk-JZHGOOFM.js → chunk-TXVF6Q5H.js} +118 -22
- package/dist/bundle/{cli-main-BRXGYTGK.js → cli-main-ZTJM5EEH.js} +4 -4
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/{google-HTMCUJ7X.js → google-4GA4YMUX.js} +2 -2
- package/dist/bundle/{google-vertex-ZQO65AXF.js → google-vertex-7AMALD7D.js} +2 -2
- package/dist/bundle/{main-POUXGEL6.js → main-53I74INO.js} +5 -5
- package/dist/bundle/{mistral-SB7LU56G.js → mistral-74BXMNRM.js} +1 -1
- package/dist/bundle/{openai-codex-responses-5CEW4VN3.js → openai-codex-responses-COXNC4IH.js} +2 -2
- package/dist/bundle/{openai-completions-BAZJQSS2.js → openai-completions-BCSA5Q6S.js} +2 -2
- package/dist/bundle/{openai-responses-VHOE427P.js → openai-responses-ONCIZSJS.js} +3 -3
- package/dist/core/agent-session.d.ts +6 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +362 -103
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/compaction/compaction.d.ts +9 -1
- package/dist/core/compaction/compaction.d.ts.map +1 -1
- package/dist/core/compaction/compaction.js +29 -3
- package/dist/core/compaction/compaction.js.map +1 -1
- package/dist/core/context-tree.d.ts +13 -10
- package/dist/core/context-tree.d.ts.map +1 -1
- package/dist/core/context-tree.js +49 -3
- package/dist/core/context-tree.js.map +1 -1
- package/dist/core/inference-coordinator.d.ts +1 -1
- package/dist/core/inference-coordinator.d.ts.map +1 -1
- package/dist/core/inference-coordinator.js +18 -5
- package/dist/core/inference-coordinator.js.map +1 -1
- package/dist/core/messages.d.ts +2 -0
- package/dist/core/messages.d.ts.map +1 -1
- package/dist/core/messages.js +2 -0
- package/dist/core/messages.js.map +1 -1
- package/dist/core/refinement/refinement.d.ts +2 -0
- package/dist/core/refinement/refinement.d.ts.map +1 -1
- package/dist/core/refinement/refinement.js +10 -1
- package/dist/core/refinement/refinement.js.map +1 -1
- package/dist/core/request-usage.d.ts +34 -0
- package/dist/core/request-usage.d.ts.map +1 -0
- package/dist/core/request-usage.js +111 -0
- package/dist/core/request-usage.js.map +1 -0
- package/dist/core/settings-manager.d.ts +3 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +7 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/system-prompt.d.ts +2 -0
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +4 -2
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/modes/agent-connection/daemon-agent-connection.d.ts.map +1 -1
- package/dist/modes/agent-connection/daemon-agent-connection.js +8 -1
- package/dist/modes/agent-connection/daemon-agent-connection.js.map +1 -1
- package/dist/modes/daemon/daemon-protocol.d.ts +13 -3
- package/dist/modes/daemon/daemon-protocol.d.ts.map +1 -1
- package/dist/modes/daemon/daemon-protocol.js +10 -2
- package/dist/modes/daemon/daemon-protocol.js.map +1 -1
- package/dist/modes/daemon/daemon-session-summarizer.d.ts +3 -0
- package/dist/modes/daemon/daemon-session-summarizer.d.ts.map +1 -1
- package/dist/modes/daemon/daemon-session-summarizer.js +71 -32
- package/dist/modes/daemon/daemon-session-summarizer.js.map +1 -1
- package/dist/modes/interactive/components/context-tree-format.d.ts.map +1 -1
- package/dist/modes/interactive/components/context-tree-format.js +49 -0
- package/dist/modes/interactive/components/context-tree-format.js.map +1 -1
- package/docs/compaction.md +57 -4
- package/docs/context-management.md +23 -1
- package/docs/rlm.md +1 -1
- package/docs/settings.md +21 -0
- package/docs/usage.md +24 -1
- package/package.json +4 -4
|
@@ -116,6 +116,7 @@ import {
|
|
|
116
116
|
acquireDaemonSocketPathLease,
|
|
117
117
|
acquireSessionLease,
|
|
118
118
|
addAssistantUsage,
|
|
119
|
+
addRequestUsageTotals,
|
|
119
120
|
agentFamilyRelationship,
|
|
120
121
|
assertAgentFamilyReach,
|
|
121
122
|
assertAgentSessionNameAvailable,
|
|
@@ -173,6 +174,7 @@ import {
|
|
|
173
174
|
durableDaemonWorkerDescriptor,
|
|
174
175
|
emitSessionShutdownEvent,
|
|
175
176
|
emptyGoalState,
|
|
177
|
+
emptyRequestUsageTotals,
|
|
176
178
|
emptyUsage,
|
|
177
179
|
encodeJournalFrame,
|
|
178
180
|
encodeJournalFrameJson,
|
|
@@ -349,7 +351,7 @@ import {
|
|
|
349
351
|
watchWithErrorHandler,
|
|
350
352
|
workerRosterEntryFromSummary,
|
|
351
353
|
wrapTextWithAnsi
|
|
352
|
-
} from "./chunk-
|
|
354
|
+
} from "./chunk-TKOBEJ5E.js";
|
|
353
355
|
import {
|
|
354
356
|
array,
|
|
355
357
|
boolean,
|
|
@@ -368,7 +370,7 @@ import {
|
|
|
368
370
|
import {
|
|
369
371
|
installFileLogSink,
|
|
370
372
|
setLogContext
|
|
371
|
-
} from "./chunk-
|
|
373
|
+
} from "./chunk-Q6UAHLII.js";
|
|
372
374
|
import {
|
|
373
375
|
APP_NAME,
|
|
374
376
|
APP_TITLE,
|
|
@@ -414,7 +416,7 @@ import {
|
|
|
414
416
|
shouldUseWindowsShell,
|
|
415
417
|
signalProcessGroupOrProcess,
|
|
416
418
|
typebox_exports
|
|
417
|
-
} from "./chunk-
|
|
419
|
+
} from "./chunk-AEMRBMI2.js";
|
|
418
420
|
import {
|
|
419
421
|
PRODUCT,
|
|
420
422
|
PRODUCT_ENV
|
|
@@ -436,7 +438,7 @@ import {
|
|
|
436
438
|
getProviders,
|
|
437
439
|
modelsAreEqual,
|
|
438
440
|
supportsFastMode
|
|
439
|
-
} from "./chunk-
|
|
441
|
+
} from "./chunk-25VYRAC6.js";
|
|
440
442
|
import {
|
|
441
443
|
__commonJS,
|
|
442
444
|
__export,
|
|
@@ -6360,10 +6362,15 @@ var SettingsManager = class _SettingsManager {
|
|
|
6360
6362
|
return model === void 0 ? void 0 : structuredClone(model);
|
|
6361
6363
|
}
|
|
6362
6364
|
getCompactionSettings() {
|
|
6365
|
+
const targetTokens = this.settings.compaction?.targetTokens;
|
|
6366
|
+
if (targetTokens !== void 0 && targetTokens !== "model-limit" && (!Number.isSafeInteger(targetTokens) || targetTokens <= 0)) {
|
|
6367
|
+
throw new Error('compaction.targetTokens must be a positive safe integer or "model-limit"');
|
|
6368
|
+
}
|
|
6363
6369
|
return {
|
|
6364
6370
|
enabled: this.getCompactionEnabled(),
|
|
6365
6371
|
reserveTokens: this.getCompactionReserveTokens(),
|
|
6366
|
-
keepRecentTokens: this.getCompactionKeepRecentTokens()
|
|
6372
|
+
keepRecentTokens: this.getCompactionKeepRecentTokens(),
|
|
6373
|
+
...targetTokens === void 0 ? {} : { targetTokens }
|
|
6367
6374
|
};
|
|
6368
6375
|
}
|
|
6369
6376
|
/** Detached explicit configuration; the request path resolves and validates its model/effort. */
|
|
@@ -34609,10 +34616,17 @@ var DaemonAgentConnection = class _DaemonAgentConnection {
|
|
|
34609
34616
|
});
|
|
34610
34617
|
}
|
|
34611
34618
|
async getContextTree() {
|
|
34612
|
-
|
|
34619
|
+
const tree = await this.requestData({
|
|
34613
34620
|
type: "get_context_tree",
|
|
34614
34621
|
activeSessionId: this.activeSessionId
|
|
34615
34622
|
});
|
|
34623
|
+
if (this.client.supportsServerCapability("context_request_usage"))
|
|
34624
|
+
return tree;
|
|
34625
|
+
const legacy = (node) => {
|
|
34626
|
+
const { ownRequestUsage: _ignored, ...rest } = node;
|
|
34627
|
+
return { ...rest, children: node.children.map(legacy) };
|
|
34628
|
+
};
|
|
34629
|
+
return legacy(tree);
|
|
34616
34630
|
}
|
|
34617
34631
|
async getSessionContext() {
|
|
34618
34632
|
if (this.latestSnapshotIsFresh && this.latestSnapshot?.sessionContext) {
|
|
@@ -40813,8 +40827,50 @@ function sumOwnUsage(root) {
|
|
|
40813
40827
|
walk(root);
|
|
40814
40828
|
return total;
|
|
40815
40829
|
}
|
|
40830
|
+
var GOAL_SCOPE = "Goal budget: root successful main uncached input + output only; excludes cache, children and auxiliary requests";
|
|
40831
|
+
function formatReceiptContextTree(root, width) {
|
|
40832
|
+
const rows = flattenContextTree(root);
|
|
40833
|
+
const total = emptyRequestUsageTotals();
|
|
40834
|
+
const seen = /* @__PURE__ */ new Set();
|
|
40835
|
+
let missingNodes = 0;
|
|
40836
|
+
const lines = [theme.bold("Context"), "", "Generation receipts: captured sources, known usage only", ""];
|
|
40837
|
+
for (const { node, prefix } of rows) {
|
|
40838
|
+
const usage = node.ownRequestUsage;
|
|
40839
|
+
const label = truncateToWidth(`${prefix}${node.label}`, Math.max(16, width - 45), "...");
|
|
40840
|
+
if (!usage) {
|
|
40841
|
+
missingNodes++;
|
|
40842
|
+
lines.push(`${statusIcon(node.status)} ${label}: request usage unknown`);
|
|
40843
|
+
} else if (seen.has(usage.sessionId)) {
|
|
40844
|
+
lines.push(`${statusIcon(node.status)} ${label}: shared source (counted once)`);
|
|
40845
|
+
} else {
|
|
40846
|
+
seen.add(usage.sessionId);
|
|
40847
|
+
addRequestUsageTotals(total, usage.total);
|
|
40848
|
+
lines.push(`${statusIcon(node.status)} ${label}: ${formatTokenCount2(usage.total.processedTokens)} tokens \xB7 ${formatCost(usage.total.catalogEstimateUsd)} est.`);
|
|
40849
|
+
for (const [purpose, bucket] of Object.entries(usage.byPurpose)) {
|
|
40850
|
+
lines.push(` ${purpose}: ${bucket.processedTokens.toLocaleString()} tokens \xB7 $${bucket.catalogEstimateUsd.toFixed(4)} est. \xB7 ${bucket.settledAttempts} settled`);
|
|
40851
|
+
}
|
|
40852
|
+
}
|
|
40853
|
+
if (node.contextUsage)
|
|
40854
|
+
lines.push(` Context: ${formatContextColumn(node.contextUsage, node.id === "root")}`);
|
|
40855
|
+
}
|
|
40856
|
+
lines.push("", theme.bold("Captured family \u2014 known generation usage"));
|
|
40857
|
+
lines.push(`Sessions with receipts: ${seen.size}; request usage unavailable: ${missingNodes}`);
|
|
40858
|
+
lines.push(`Uncached input: ${total.input.toLocaleString()}`);
|
|
40859
|
+
lines.push(`Input total (including cache): ${total.inputTotal.toLocaleString()}`);
|
|
40860
|
+
lines.push(`Cache read: ${total.cacheRead.toLocaleString()}; cache write: ${total.cacheWrite.toLocaleString()}`);
|
|
40861
|
+
lines.push(`Output: ${total.output.toLocaleString()}`);
|
|
40862
|
+
lines.push(`Processed total: ${total.processedTokens.toLocaleString()}`);
|
|
40863
|
+
lines.push(`Catalog estimate (unvalidated rates, not an invoice): $${total.catalogEstimateUsd.toFixed(4)}`);
|
|
40864
|
+
lines.push(`Unknown usage: ${total.missingUsageAttempts} missing, ${total.partialUsageAttempts} partial, ${total.unsettledAttempts} unsettled attempts; ${total.unpricedAttempts} settled attempts unpriced`);
|
|
40865
|
+
lines.push("Missing fields are not zero. Totals exclude unavailable sessions and non-generation token-count requests.");
|
|
40866
|
+
lines.push("Captured sources are not a guarantee of complete historical family usage.");
|
|
40867
|
+
lines.push("", GOAL_SCOPE);
|
|
40868
|
+
return lines.join("\n");
|
|
40869
|
+
}
|
|
40816
40870
|
function formatContextTree(root, width) {
|
|
40817
40871
|
const rows = flattenContextTree(root);
|
|
40872
|
+
if (rows.some(({ node }) => node.ownRequestUsage))
|
|
40873
|
+
return formatReceiptContextTree(root, width);
|
|
40818
40874
|
const tokenCells = rows.map((row) => formatTokenCount2(spentTokens(row.node.ownUsage)));
|
|
40819
40875
|
const costCells = rows.map((row) => formatCost(row.node.ownUsage.cost.total));
|
|
40820
40876
|
const tokenHeader = "tokens";
|
|
@@ -40826,6 +40882,9 @@ function formatContextTree(root, width) {
|
|
|
40826
40882
|
const lines = [];
|
|
40827
40883
|
lines.push(theme.bold("Context"));
|
|
40828
40884
|
lines.push("");
|
|
40885
|
+
lines.push("Legacy conversation projection \u2014 request receipts unavailable; auxiliary usage may be missing");
|
|
40886
|
+
lines.push("Costs below are catalog estimates, not invoices");
|
|
40887
|
+
lines.push("");
|
|
40829
40888
|
if (root.model) {
|
|
40830
40889
|
lines.push(`${theme.fg("dim", "Model:")} ${root.model.provider}/${root.model.id}`);
|
|
40831
40890
|
lines.push("");
|
|
@@ -40871,6 +40930,7 @@ function formatContextTree(root, width) {
|
|
|
40871
40930
|
lines.push(`${theme.fg("dim", "Current:")} ${rootContext.tokens.toLocaleString()} / ${rootContext.contextWindow.toLocaleString()} (${percent})`);
|
|
40872
40931
|
}
|
|
40873
40932
|
}
|
|
40933
|
+
lines.push("", GOAL_SCOPE);
|
|
40874
40934
|
return lines.join("\n");
|
|
40875
40935
|
}
|
|
40876
40936
|
|
|
@@ -59637,6 +59697,7 @@ var DaemonRlmCapacityClient = class {
|
|
|
59637
59697
|
// dist/modes/daemon/daemon-session-summarizer.js
|
|
59638
59698
|
var SWEEP_INTERVAL_MS = 25e3;
|
|
59639
59699
|
var SETTLE_DEBOUNCE_MS = 2e3;
|
|
59700
|
+
var MIN_REFRESH_INTERVAL_MS = 6e4;
|
|
59640
59701
|
var SUMMARY_CONTEXT_MESSAGES = 8;
|
|
59641
59702
|
var SUMMARY_MAX_CHARS_PER_MESSAGE = 600;
|
|
59642
59703
|
var SUMMARY_MAX_TOKENS = 400;
|
|
@@ -59670,7 +59731,7 @@ function messageText(content) {
|
|
|
59670
59731
|
const type = block.type;
|
|
59671
59732
|
if (type === "text" && typeof block.text === "string") {
|
|
59672
59733
|
parts.push(block.text);
|
|
59673
|
-
} else if (type === "tool_use" || type === "toolUse") {
|
|
59734
|
+
} else if (type === "toolCall" || type === "tool_use" || type === "toolUse") {
|
|
59674
59735
|
const name = block.name;
|
|
59675
59736
|
if (typeof name === "string") {
|
|
59676
59737
|
tools.push(name);
|
|
@@ -59734,7 +59795,7 @@ function parseAgentStatusResponse(text, isWorking) {
|
|
|
59734
59795
|
return { summary, taskState };
|
|
59735
59796
|
}
|
|
59736
59797
|
async function generateAgentStatus(params) {
|
|
59737
|
-
const { registry, messages, isWorking, signal, requests, model: selectedModel } = params;
|
|
59798
|
+
const { registry, messages, isWorking, sessionId, signal, requests, model: selectedModel } = params;
|
|
59738
59799
|
if (messages.length === 0) {
|
|
59739
59800
|
return void 0;
|
|
59740
59801
|
}
|
|
@@ -59758,7 +59819,13 @@ async function generateAgentStatus(params) {
|
|
|
59758
59819
|
timestamp
|
|
59759
59820
|
}
|
|
59760
59821
|
]
|
|
59761
|
-
}, {
|
|
59822
|
+
}, {
|
|
59823
|
+
maxTokens: SUMMARY_MAX_TOKENS,
|
|
59824
|
+
apiKey: auth.apiKey,
|
|
59825
|
+
headers: auth.headers,
|
|
59826
|
+
signal,
|
|
59827
|
+
sessionId: sessionId ? `daemon-status:${sessionId}` : void 0
|
|
59828
|
+
}, { purpose: "native-control", purposeDetail: "daemon-status" });
|
|
59762
59829
|
if (response.stopReason === "error") {
|
|
59763
59830
|
return void 0;
|
|
59764
59831
|
}
|
|
@@ -59794,6 +59861,7 @@ var DaemonSessionSummarizer = class {
|
|
|
59794
59861
|
debounceTimers = /* @__PURE__ */ new Map();
|
|
59795
59862
|
// Controller per in-flight summary so a closing session can abort its write.
|
|
59796
59863
|
inFlight = /* @__PURE__ */ new Map();
|
|
59864
|
+
refreshes = /* @__PURE__ */ new Map();
|
|
59797
59865
|
tasks = /* @__PURE__ */ new Map();
|
|
59798
59866
|
forgotten = /* @__PURE__ */ new Set();
|
|
59799
59867
|
stopped = false;
|
|
@@ -59843,6 +59911,7 @@ var DaemonSessionSummarizer = class {
|
|
|
59843
59911
|
this.debounceTimers.delete(activeSessionId);
|
|
59844
59912
|
}
|
|
59845
59913
|
this.inFlight.get(activeSessionId)?.abort();
|
|
59914
|
+
this.refreshes.delete(activeSessionId);
|
|
59846
59915
|
this.rerunRequested.delete(activeSessionId);
|
|
59847
59916
|
await this.tasks.get(activeSessionId);
|
|
59848
59917
|
}
|
|
@@ -59859,6 +59928,9 @@ var DaemonSessionSummarizer = class {
|
|
|
59859
59928
|
}
|
|
59860
59929
|
/** Called when a session finishes a turn; debounce until the agent settles. */
|
|
59861
59930
|
notifyActivity(state) {
|
|
59931
|
+
this.schedule(state, SETTLE_DEBOUNCE_MS);
|
|
59932
|
+
}
|
|
59933
|
+
schedule(state, delay8) {
|
|
59862
59934
|
const id = state.activeSessionId;
|
|
59863
59935
|
if (this.stopped || this.forgotten.has(id))
|
|
59864
59936
|
return;
|
|
@@ -59869,7 +59941,7 @@ var DaemonSessionSummarizer = class {
|
|
|
59869
59941
|
const timer = setTimeout(() => {
|
|
59870
59942
|
this.debounceTimers.delete(id);
|
|
59871
59943
|
this.summarize(state);
|
|
59872
|
-
},
|
|
59944
|
+
}, delay8);
|
|
59873
59945
|
timer.unref?.();
|
|
59874
59946
|
this.debounceTimers.set(id, timer);
|
|
59875
59947
|
}
|
|
@@ -59903,33 +59975,54 @@ var DaemonSessionSummarizer = class {
|
|
|
59903
59975
|
const messageCount = messages.length;
|
|
59904
59976
|
const isWorking = isSessionWorking(state);
|
|
59905
59977
|
const previous = state.summaryState;
|
|
59906
|
-
const contentUnchanged = previous?.basedOnMessageCount === messageCount;
|
|
59907
59978
|
const owesIdleVerdict = !isWorking && previous?.taskState === void 0;
|
|
59908
59979
|
const owesSummary = !isWorking && !previous?.summary;
|
|
59909
59980
|
const turnError = !isWorking ? terminalTurnError(messages) : void 0;
|
|
59910
|
-
const
|
|
59911
|
-
|
|
59912
|
-
return;
|
|
59981
|
+
const contextMessages = () => {
|
|
59982
|
+
const streaming = isWorking ? session.state.streamingMessage : void 0;
|
|
59983
|
+
return streaming ? [...session.messages, streaming] : session.messages;
|
|
59984
|
+
};
|
|
59985
|
+
const input = buildStatusContext(contextMessages(), isWorking);
|
|
59986
|
+
const model = session.model;
|
|
59987
|
+
const isCurrentSource = () => state.runtime.session === session && session.sessionManager === sessionManager && sessionManager.getSessionId() === sessionId && sessionManager.getSessionFile() === sessionFile && session.model === model;
|
|
59988
|
+
let refresh = this.refreshes.get(id);
|
|
59989
|
+
if (!refresh?.isCurrentSource()) {
|
|
59990
|
+
refresh = { isCurrentSource };
|
|
59991
|
+
this.refreshes.set(id, refresh);
|
|
59992
|
+
}
|
|
59993
|
+
const finalTransition = !isWorking && refresh.wasWorking === true;
|
|
59994
|
+
refresh.wasWorking = isWorking;
|
|
59995
|
+
const reuse = turnError === void 0 && refresh.input === input && previous?.summary ? previous : void 0;
|
|
59996
|
+
if ((reuse || turnError !== void 0 && previous?.summary === turnError && previous.taskState === "needs_input") && previous?.basedOnMessageCount === messageCount) {
|
|
59997
|
+
return;
|
|
59998
|
+
}
|
|
59999
|
+
if (!reuse && turnError === void 0) {
|
|
60000
|
+
const remaining = MIN_REFRESH_INTERVAL_MS - (Date.now() - (refresh.attemptedAt ?? -Infinity));
|
|
60001
|
+
if (!finalTransition && remaining > 0) {
|
|
60002
|
+
this.schedule(state, remaining);
|
|
60003
|
+
return;
|
|
60004
|
+
}
|
|
60005
|
+
refresh.attemptedAt = Date.now();
|
|
59913
60006
|
}
|
|
59914
|
-
const streaming = isWorking ? session.state.streamingMessage : void 0;
|
|
59915
|
-
const contextMessages = streaming ? [...messages, streaming] : messages;
|
|
59916
60007
|
const controller = new AbortController();
|
|
59917
|
-
const isCurrent = () => !controller.signal.aborted && state
|
|
60008
|
+
const isCurrent = () => !controller.signal.aborted && isCurrentSource() && isSessionWorking(state) === isWorking && session.messages.length === messageCount && buildStatusContext(contextMessages(), isWorking) === input && (isWorking || terminalTurnError(session.messages) === turnError);
|
|
59918
60009
|
this.inFlight.set(id, controller);
|
|
59919
60010
|
let requests;
|
|
59920
60011
|
let status;
|
|
60012
|
+
let completedInput;
|
|
59921
60013
|
let changed = false;
|
|
59922
60014
|
try {
|
|
59923
|
-
if (turnError === void 0)
|
|
60015
|
+
if (!reuse && turnError === void 0)
|
|
59924
60016
|
requests = this.getRequests?.(session);
|
|
59925
|
-
const generated = turnError !== void 0 ? { summary: turnError, taskState: "needs_input" } : await this.generate({
|
|
60017
|
+
const generated = reuse ?? (turnError !== void 0 ? { summary: turnError, taskState: "needs_input" } : await this.generate({
|
|
59926
60018
|
registry: session.modelRegistry,
|
|
59927
|
-
model
|
|
59928
|
-
messages: contextMessages,
|
|
60019
|
+
model,
|
|
60020
|
+
messages: contextMessages(),
|
|
59929
60021
|
isWorking,
|
|
60022
|
+
sessionId,
|
|
59930
60023
|
signal: controller.signal,
|
|
59931
60024
|
requests
|
|
59932
|
-
});
|
|
60025
|
+
}));
|
|
59933
60026
|
await requests?.dispose();
|
|
59934
60027
|
const result = generated ?? (!isWorking && (owesIdleVerdict || owesSummary) ? { summary: previous?.summary ?? "", taskState: "needs_input" } : void 0);
|
|
59935
60028
|
if (!result) {
|
|
@@ -59938,6 +60031,8 @@ var DaemonSessionSummarizer = class {
|
|
|
59938
60031
|
if (!isCurrent()) {
|
|
59939
60032
|
return;
|
|
59940
60033
|
}
|
|
60034
|
+
if (generated && turnError === void 0)
|
|
60035
|
+
completedInput = input;
|
|
59941
60036
|
const taskState = result.taskState ?? (previous?.basedOnMessageCount === messageCount ? previous?.taskState : void 0);
|
|
59942
60037
|
status = {
|
|
59943
60038
|
summary: result.summary,
|
|
@@ -59958,6 +60053,7 @@ var DaemonSessionSummarizer = class {
|
|
|
59958
60053
|
}
|
|
59959
60054
|
}
|
|
59960
60055
|
if (status && isCurrent()) {
|
|
60056
|
+
refresh.input = completedInput;
|
|
59961
60057
|
state.summaryState = status;
|
|
59962
60058
|
if (changed)
|
|
59963
60059
|
this.onStatusChanged?.(state);
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
isOwnedSessionWorkerProcess,
|
|
6
6
|
maybeRunOwnedSessionWorkerFrontend,
|
|
7
7
|
maybeStartDaemonEarly
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-TKOBEJ5E.js";
|
|
9
9
|
import {
|
|
10
10
|
APP_NAME
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-AEMRBMI2.js";
|
|
12
12
|
import "./chunk-5QCJ5DQU.js";
|
|
13
13
|
import "./chunk-CRBVRZBV.js";
|
|
14
14
|
import "./chunk-GRJFXLBM.js";
|
|
@@ -16,7 +16,7 @@ import "./chunk-2T7M7VJ4.js";
|
|
|
16
16
|
import "./chunk-UIRUOAIQ.js";
|
|
17
17
|
import "./chunk-HXOBFFJX.js";
|
|
18
18
|
import "./chunk-DGNX7HQ3.js";
|
|
19
|
-
import "./chunk-
|
|
19
|
+
import "./chunk-25VYRAC6.js";
|
|
20
20
|
import "./chunk-BAWSWWEU.js";
|
|
21
21
|
|
|
22
22
|
// dist/cli-main.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-53I74INO.js")
|
|
43
43
|
]);
|
|
44
44
|
setGlobalDispatcher(new EnvHttpProxyAgent({ bodyTimeout: 0, headersTimeout: 0 }));
|
|
45
45
|
try {
|
package/dist/bundle/cli.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
mapToolChoice,
|
|
11
11
|
observeGoogleUsage,
|
|
12
12
|
retainThoughtSignature
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-FOGKLC7V.js";
|
|
14
14
|
import {
|
|
15
15
|
buildBaseOptions,
|
|
16
16
|
sanitizeSurrogates
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
formatStreamFailureMessage,
|
|
27
27
|
recordStreamFailure,
|
|
28
28
|
streamFailureFromStopReason
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-25VYRAC6.js";
|
|
30
30
|
import "./chunk-BAWSWWEU.js";
|
|
31
31
|
|
|
32
32
|
// ../ai/src/providers/google.ts
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
mapToolChoice,
|
|
13
13
|
observeGoogleUsage,
|
|
14
14
|
retainThoughtSignature
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-FOGKLC7V.js";
|
|
16
16
|
import {
|
|
17
17
|
buildBaseOptions,
|
|
18
18
|
sanitizeSurrogates
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
formatStreamFailureMessage,
|
|
26
26
|
recordStreamFailure,
|
|
27
27
|
streamFailureFromStopReason
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-25VYRAC6.js";
|
|
29
29
|
import "./chunk-BAWSWWEU.js";
|
|
30
30
|
|
|
31
31
|
// ../ai/src/providers/google-vertex.ts
|
|
@@ -17,11 +17,11 @@ import {
|
|
|
17
17
|
shouldUseDaemonClientRuntime,
|
|
18
18
|
shouldUseDaemonInteractive,
|
|
19
19
|
shouldUseEphemeralSessionManagerForDaemonInteractive
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-TXVF6Q5H.js";
|
|
21
|
+
import "./chunk-TKOBEJ5E.js";
|
|
22
22
|
import "./chunk-CFNASUYO.js";
|
|
23
|
-
import "./chunk-
|
|
24
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-Q6UAHLII.js";
|
|
24
|
+
import "./chunk-AEMRBMI2.js";
|
|
25
25
|
import "./chunk-5QCJ5DQU.js";
|
|
26
26
|
import "./chunk-CRBVRZBV.js";
|
|
27
27
|
import "./chunk-GRJFXLBM.js";
|
|
@@ -29,7 +29,7 @@ import "./chunk-2T7M7VJ4.js";
|
|
|
29
29
|
import "./chunk-UIRUOAIQ.js";
|
|
30
30
|
import "./chunk-HXOBFFJX.js";
|
|
31
31
|
import "./chunk-DGNX7HQ3.js";
|
|
32
|
-
import "./chunk-
|
|
32
|
+
import "./chunk-25VYRAC6.js";
|
|
33
33
|
import "./chunk-BAWSWWEU.js";
|
|
34
34
|
export {
|
|
35
35
|
createDefaultRuntimeFactory,
|
package/dist/bundle/{openai-codex-responses-5CEW4VN3.js → openai-codex-responses-COXNC4IH.js}
RENAMED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
convertResponsesTools,
|
|
9
9
|
observeResponsesEvent,
|
|
10
10
|
processResponsesStream
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-MUFZODP5.js";
|
|
12
12
|
import "./chunk-NQB5DCFC.js";
|
|
13
13
|
import {
|
|
14
14
|
headersToRecord
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
formatThrownValue,
|
|
34
34
|
isLocalRequestPreparationError,
|
|
35
35
|
recordStreamFailure
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-25VYRAC6.js";
|
|
37
37
|
import "./chunk-BAWSWWEU.js";
|
|
38
38
|
|
|
39
39
|
// ../ai/src/utils/abortable-delay.ts
|
|
@@ -36,7 +36,7 @@ import {
|
|
|
36
36
|
formatStreamFailureMessage,
|
|
37
37
|
recordStreamFailure,
|
|
38
38
|
withRequestBody
|
|
39
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-25VYRAC6.js";
|
|
40
40
|
import "./chunk-BAWSWWEU.js";
|
|
41
41
|
|
|
42
42
|
// ../ai/src/providers/openai-completions.ts
|
|
@@ -120,7 +120,7 @@ var streamOpenAICompletions = (model, context, options) => {
|
|
|
120
120
|
const cacheWriteCost = cacheControl && hasStandardAnthropicCachePricing(model) ? getAnthropicCacheWriteCost(model.cost.input, cacheControl.ttl === "1h" ? "1h" : "5m") : void 0;
|
|
121
121
|
const cacheSessionId = cacheRetention === "none" ? void 0 : options?.sessionId;
|
|
122
122
|
let client = createClient(model, context, apiKey, options?.headers, cacheSessionId, compat);
|
|
123
|
-
if (attempts.enabled) {
|
|
123
|
+
if (attempts.enabled || options?.signal) {
|
|
124
124
|
client = client.withOptions({});
|
|
125
125
|
client.fetchWithTimeout = attempts.wrapHttp(client.fetchWithTimeout.bind(client));
|
|
126
126
|
}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
convertResponsesMessages,
|
|
11
11
|
convertResponsesTools,
|
|
12
12
|
processResponsesStream
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-MUFZODP5.js";
|
|
14
14
|
import "./chunk-NQB5DCFC.js";
|
|
15
15
|
import {
|
|
16
16
|
OpenAI
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
openAIVisibleInput,
|
|
34
34
|
recordStreamFailure,
|
|
35
35
|
streamFailureFromStopReason
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-25VYRAC6.js";
|
|
37
37
|
import "./chunk-BAWSWWEU.js";
|
|
38
38
|
|
|
39
39
|
// ../ai/src/providers/openai-responses.ts
|
|
@@ -83,7 +83,7 @@ var streamOpenAIResponses = (model, context, options) => {
|
|
|
83
83
|
const cacheSessionId = cacheRetention === "none" ? void 0 : options?.sessionId;
|
|
84
84
|
let client = createClient(model, context, apiKey, options?.headers, cacheSessionId);
|
|
85
85
|
const preparationClient = client;
|
|
86
|
-
if (attempts.enabled) {
|
|
86
|
+
if (attempts.enabled || options?.signal) {
|
|
87
87
|
client = client.withOptions({});
|
|
88
88
|
client.fetchWithTimeout = attempts.wrapHttp(client.fetchWithTimeout.bind(client));
|
|
89
89
|
}
|
|
@@ -518,6 +518,8 @@ export declare class AgentSession {
|
|
|
518
518
|
private _rlmChildCleanupFailures;
|
|
519
519
|
private _deletingRlmChildren;
|
|
520
520
|
private _rlmChildUnsubscribes;
|
|
521
|
+
private _rlmChildUsageSources;
|
|
522
|
+
private _rlmParentUsageAttribution?;
|
|
521
523
|
/** Latest recap for this session, written by the daemon summarizer; read by a parent to label its child snapshots. */
|
|
522
524
|
private _currentRecap?;
|
|
523
525
|
private readonly _initialGoal;
|
|
@@ -834,6 +836,8 @@ export declare class AgentSession {
|
|
|
834
836
|
private _normalizePromptSnippet;
|
|
835
837
|
private _normalizePromptGuidelines;
|
|
836
838
|
private _rebuildSystemPrompt;
|
|
839
|
+
private _readHarnessSnapshot;
|
|
840
|
+
private _appendHarnessSnapshotIfChanged;
|
|
837
841
|
private _refreshExtensionSystemPrompt;
|
|
838
842
|
private _finishSubmissionNormalization;
|
|
839
843
|
private _normalizeSubmission;
|
|
@@ -1202,6 +1206,8 @@ export declare class AgentSession {
|
|
|
1202
1206
|
private _removeRlmSubagentTracking;
|
|
1203
1207
|
private _emitRlmSubagentRemoval;
|
|
1204
1208
|
private _deleteResolvedRlmSubagent;
|
|
1209
|
+
private _restoreRlmChildUsageSource;
|
|
1210
|
+
private _subscribeRlmChildEvents;
|
|
1205
1211
|
/**
|
|
1206
1212
|
* Retain a finished child session for the parent lifetime so inspectors and
|
|
1207
1213
|
* daemon-hosted agent messaging can keep addressing it. Returns false (and disposes
|