agentfootprint 9.112.2 → 9.113.0
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 +296 -0
- package/CLAUDE.md +1 -0
- package/dist/adapters/observability/audit.js +8 -0
- package/dist/adapters/observability/audit.js.map +1 -1
- package/dist/adapters/observability/otel.js +44 -2
- package/dist/adapters/observability/otel.js.map +1 -1
- package/dist/adapters/observability/xray.js +19 -0
- package/dist/adapters/observability/xray.js.map +1 -1
- package/dist/adapters/types.js.map +1 -1
- package/dist/core/Agent.js +11 -1
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/agent/composeRequest.js +19 -11
- package/dist/core/agent/composeRequest.js.map +1 -1
- package/dist/core/agent/coverage/absent.js +163 -7
- package/dist/core/agent/coverage/absent.js.map +1 -1
- package/dist/core/agent/coverage/answer.js +3 -1
- package/dist/core/agent/coverage/answer.js.map +1 -1
- package/dist/core/agent/coverage/read.js +15 -11
- package/dist/core/agent/coverage/read.js.map +1 -1
- package/dist/core/agent/findings/ledger.js +27 -5
- package/dist/core/agent/findings/ledger.js.map +1 -1
- package/dist/core/agent/findings/offer.js +29 -9
- package/dist/core/agent/findings/offer.js.map +1 -1
- package/dist/core/agent/findings/serve.js +76 -7
- package/dist/core/agent/findings/serve.js.map +1 -1
- package/dist/core/agent/findings/types.js.map +1 -1
- package/dist/core/agent/findings/unsettled.js +276 -0
- package/dist/core/agent/findings/unsettled.js.map +1 -0
- package/dist/core/agent/stages/callLLM.js +30 -8
- package/dist/core/agent/stages/callLLM.js.map +1 -1
- package/dist/core/agent/stages/route.js +10 -2
- package/dist/core/agent/stages/route.js.map +1 -1
- package/dist/core/agent/stages/toolCalls.js +247 -31
- package/dist/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/core/agent/stages/window.js +5 -2
- package/dist/core/agent/stages/window.js.map +1 -1
- package/dist/core/agent/toolResultCap.js +0 -0
- package/dist/core/agent/toolResultCap.js.map +1 -1
- package/dist/core/agent/window/ledgerFactPins.js +13 -2
- package/dist/core/agent/window/ledgerFactPins.js.map +1 -1
- package/dist/core/agent/window/toolNames.js +17 -2
- package/dist/core/agent/window/toolNames.js.map +1 -1
- package/dist/core/checkin.js +5 -1
- package/dist/core/checkin.js.map +1 -1
- package/dist/core/runCheckpoint.js +26 -2
- package/dist/core/runCheckpoint.js.map +1 -1
- package/dist/esm/adapters/observability/audit.d.ts +8 -0
- package/dist/esm/adapters/observability/audit.js +8 -0
- package/dist/esm/adapters/observability/audit.js.map +1 -1
- package/dist/esm/adapters/observability/otel.d.ts +17 -2
- package/dist/esm/adapters/observability/otel.js +44 -2
- package/dist/esm/adapters/observability/otel.js.map +1 -1
- package/dist/esm/adapters/observability/xray.d.ts +8 -0
- package/dist/esm/adapters/observability/xray.js +19 -0
- package/dist/esm/adapters/observability/xray.js.map +1 -1
- package/dist/esm/adapters/types.d.ts +49 -0
- package/dist/esm/adapters/types.js.map +1 -1
- package/dist/esm/core/Agent.js +11 -1
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/agent/composeRequest.d.ts +10 -7
- package/dist/esm/core/agent/composeRequest.js +19 -11
- package/dist/esm/core/agent/composeRequest.js.map +1 -1
- package/dist/esm/core/agent/coverage/absent.d.ts +31 -4
- package/dist/esm/core/agent/coverage/absent.js +160 -6
- package/dist/esm/core/agent/coverage/absent.js.map +1 -1
- package/dist/esm/core/agent/coverage/answer.js +3 -1
- package/dist/esm/core/agent/coverage/answer.js.map +1 -1
- package/dist/esm/core/agent/coverage/index.d.ts +1 -1
- package/dist/esm/core/agent/coverage/read.d.ts +9 -1
- package/dist/esm/core/agent/coverage/read.js +16 -12
- package/dist/esm/core/agent/coverage/read.js.map +1 -1
- package/dist/esm/core/agent/coverage/types.d.ts +42 -0
- package/dist/esm/core/agent/findings/ledger.d.ts +23 -6
- package/dist/esm/core/agent/findings/ledger.js +27 -5
- package/dist/esm/core/agent/findings/ledger.js.map +1 -1
- package/dist/esm/core/agent/findings/offer.d.ts +23 -6
- package/dist/esm/core/agent/findings/offer.js +27 -8
- package/dist/esm/core/agent/findings/offer.js.map +1 -1
- package/dist/esm/core/agent/findings/serve.d.ts +19 -6
- package/dist/esm/core/agent/findings/serve.js +77 -8
- package/dist/esm/core/agent/findings/serve.js.map +1 -1
- package/dist/esm/core/agent/findings/types.d.ts +81 -1
- package/dist/esm/core/agent/findings/types.js.map +1 -1
- package/dist/esm/core/agent/findings/unsettled.d.ts +121 -0
- package/dist/esm/core/agent/findings/unsettled.js +271 -0
- package/dist/esm/core/agent/findings/unsettled.js.map +1 -0
- package/dist/esm/core/agent/stages/callLLM.js +30 -8
- package/dist/esm/core/agent/stages/callLLM.js.map +1 -1
- package/dist/esm/core/agent/stages/route.js +10 -2
- package/dist/esm/core/agent/stages/route.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls.d.ts +90 -2
- package/dist/esm/core/agent/stages/toolCalls.js +244 -31
- package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/esm/core/agent/stages/window.js +5 -2
- package/dist/esm/core/agent/stages/window.js.map +1 -1
- package/dist/esm/core/agent/toolResultCap.d.ts +4 -1
- package/dist/esm/core/agent/toolResultCap.js +0 -0
- package/dist/esm/core/agent/toolResultCap.js.map +1 -1
- package/dist/esm/core/agent/types.d.ts +5 -0
- package/dist/esm/core/agent/window/ledgerFactPins.d.ts +10 -1
- package/dist/esm/core/agent/window/ledgerFactPins.js +13 -2
- package/dist/esm/core/agent/window/ledgerFactPins.js.map +1 -1
- package/dist/esm/core/agent/window/strategy.d.ts +2 -1
- package/dist/esm/core/agent/window/toolNames.d.ts +16 -1
- package/dist/esm/core/agent/window/toolNames.js +17 -2
- package/dist/esm/core/agent/window/toolNames.js.map +1 -1
- package/dist/esm/core/checkin.js +5 -1
- package/dist/esm/core/checkin.js.map +1 -1
- package/dist/esm/core/runCheckpoint.js +26 -2
- package/dist/esm/core/runCheckpoint.js.map +1 -1
- package/dist/esm/events/payloads.d.ts +76 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/bug-report/transcript.d.ts +5 -0
- package/dist/esm/lib/bug-report/transcript.js +1 -0
- package/dist/esm/lib/bug-report/transcript.js.map +1 -1
- package/dist/esm/lib/semantics/projection.js +1 -0
- package/dist/esm/lib/semantics/projection.js.map +1 -1
- package/dist/esm/lib/time-travel/receipt.d.ts +4 -3
- package/dist/esm/lib/time-travel/receipt.js +4 -3
- package/dist/esm/lib/time-travel/receipt.js.map +1 -1
- package/dist/esm/lib/time-travel/servedView.js +13 -9
- package/dist/esm/lib/time-travel/servedView.js.map +1 -1
- package/dist/esm/lib/trace-toolpack/traceToolpack.js +130 -17
- package/dist/esm/lib/trace-toolpack/traceToolpack.js.map +1 -1
- package/dist/esm/memory/causal/evidenceRecorder.d.ts +2 -0
- package/dist/esm/memory/causal/evidenceRecorder.js +13 -0
- package/dist/esm/memory/causal/evidenceRecorder.js.map +1 -1
- package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.d.ts +2 -0
- package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.js +11 -0
- package/dist/esm/recorders/observability/AgentThinkingTraceRecorder.js.map +1 -1
- package/dist/esm/recorders/observability/BoundaryRecorder.d.ts +10 -1
- package/dist/esm/recorders/observability/BoundaryRecorder.js +9 -1
- package/dist/esm/recorders/observability/BoundaryRecorder.js.map +1 -1
- package/dist/esm/recorders/observability/FlowchartRecorder.d.ts +4 -1
- package/dist/esm/recorders/observability/FlowchartRecorder.js +13 -1
- package/dist/esm/recorders/observability/FlowchartRecorder.js.map +1 -1
- package/dist/esm/recorders/observability/LiveStateRecorder.d.ts +2 -0
- package/dist/esm/recorders/observability/LiveStateRecorder.js +9 -0
- package/dist/esm/recorders/observability/LiveStateRecorder.js.map +1 -1
- package/dist/esm/recorders/observability/RouteRecorder.js +5 -0
- package/dist/esm/recorders/observability/RouteRecorder.js.map +1 -1
- package/dist/esm/recorders/observability/StatusRecorder.js +7 -0
- package/dist/esm/recorders/observability/StatusRecorder.js.map +1 -1
- package/dist/esm/recorders/observability/ToolChoiceRecorder.js +5 -0
- package/dist/esm/recorders/observability/ToolChoiceRecorder.js.map +1 -1
- package/dist/esm/recorders/observability/commentary/commentaryTemplates.js +18 -2
- package/dist/esm/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
- package/dist/esm/recorders/observability/status/statusTemplates.js +5 -0
- package/dist/esm/recorders/observability/status/statusTemplates.js.map +1 -1
- package/dist/esm/security/extractSequence.d.ts +36 -5
- package/dist/esm/security/extractSequence.js +99 -26
- package/dist/esm/security/extractSequence.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/bug-report/transcript.js +1 -0
- package/dist/lib/bug-report/transcript.js.map +1 -1
- package/dist/lib/semantics/projection.js +1 -0
- package/dist/lib/semantics/projection.js.map +1 -1
- package/dist/lib/time-travel/receipt.js +4 -3
- package/dist/lib/time-travel/receipt.js.map +1 -1
- package/dist/lib/time-travel/servedView.js +13 -9
- package/dist/lib/time-travel/servedView.js.map +1 -1
- package/dist/lib/trace-toolpack/traceToolpack.js +130 -17
- package/dist/lib/trace-toolpack/traceToolpack.js.map +1 -1
- package/dist/memory/causal/evidenceRecorder.js +13 -0
- package/dist/memory/causal/evidenceRecorder.js.map +1 -1
- package/dist/recorders/observability/AgentThinkingTraceRecorder.js +11 -0
- package/dist/recorders/observability/AgentThinkingTraceRecorder.js.map +1 -1
- package/dist/recorders/observability/BoundaryRecorder.js +9 -1
- package/dist/recorders/observability/BoundaryRecorder.js.map +1 -1
- package/dist/recorders/observability/FlowchartRecorder.js +13 -1
- package/dist/recorders/observability/FlowchartRecorder.js.map +1 -1
- package/dist/recorders/observability/LiveStateRecorder.js +9 -0
- package/dist/recorders/observability/LiveStateRecorder.js.map +1 -1
- package/dist/recorders/observability/RouteRecorder.js +5 -0
- package/dist/recorders/observability/RouteRecorder.js.map +1 -1
- package/dist/recorders/observability/StatusRecorder.js +7 -0
- package/dist/recorders/observability/StatusRecorder.js.map +1 -1
- package/dist/recorders/observability/ToolChoiceRecorder.js +5 -0
- package/dist/recorders/observability/ToolChoiceRecorder.js.map +1 -1
- package/dist/recorders/observability/commentary/commentaryTemplates.js +18 -2
- package/dist/recorders/observability/commentary/commentaryTemplates.js.map +1 -1
- package/dist/recorders/observability/status/statusTemplates.js +5 -0
- package/dist/recorders/observability/status/statusTemplates.js.map +1 -1
- package/dist/security/extractSequence.js +99 -26
- package/dist/security/extractSequence.js.map +1 -1
- package/dist/types/adapters/observability/audit.d.ts +8 -0
- package/dist/types/adapters/observability/audit.d.ts.map +1 -1
- package/dist/types/adapters/observability/otel.d.ts +17 -2
- package/dist/types/adapters/observability/otel.d.ts.map +1 -1
- package/dist/types/adapters/observability/xray.d.ts +8 -0
- package/dist/types/adapters/observability/xray.d.ts.map +1 -1
- package/dist/types/adapters/types.d.ts +49 -0
- package/dist/types/adapters/types.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/agent/composeRequest.d.ts +10 -7
- package/dist/types/core/agent/composeRequest.d.ts.map +1 -1
- package/dist/types/core/agent/coverage/absent.d.ts +31 -4
- package/dist/types/core/agent/coverage/absent.d.ts.map +1 -1
- package/dist/types/core/agent/coverage/answer.d.ts.map +1 -1
- package/dist/types/core/agent/coverage/index.d.ts +1 -1
- package/dist/types/core/agent/coverage/index.d.ts.map +1 -1
- package/dist/types/core/agent/coverage/read.d.ts +9 -1
- package/dist/types/core/agent/coverage/read.d.ts.map +1 -1
- package/dist/types/core/agent/coverage/types.d.ts +42 -0
- package/dist/types/core/agent/coverage/types.d.ts.map +1 -1
- package/dist/types/core/agent/findings/ledger.d.ts +23 -6
- package/dist/types/core/agent/findings/ledger.d.ts.map +1 -1
- package/dist/types/core/agent/findings/offer.d.ts +23 -6
- package/dist/types/core/agent/findings/offer.d.ts.map +1 -1
- package/dist/types/core/agent/findings/serve.d.ts +19 -6
- package/dist/types/core/agent/findings/serve.d.ts.map +1 -1
- package/dist/types/core/agent/findings/types.d.ts +81 -1
- package/dist/types/core/agent/findings/types.d.ts.map +1 -1
- package/dist/types/core/agent/findings/unsettled.d.ts +122 -0
- package/dist/types/core/agent/findings/unsettled.d.ts.map +1 -0
- package/dist/types/core/agent/stages/callLLM.d.ts.map +1 -1
- package/dist/types/core/agent/stages/route.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls.d.ts +90 -2
- package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
- package/dist/types/core/agent/stages/window.d.ts.map +1 -1
- package/dist/types/core/agent/toolResultCap.d.ts +4 -1
- package/dist/types/core/agent/toolResultCap.d.ts.map +1 -1
- package/dist/types/core/agent/types.d.ts +5 -0
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/core/agent/window/ledgerFactPins.d.ts +10 -1
- package/dist/types/core/agent/window/ledgerFactPins.d.ts.map +1 -1
- package/dist/types/core/agent/window/strategy.d.ts +2 -1
- package/dist/types/core/agent/window/strategy.d.ts.map +1 -1
- package/dist/types/core/agent/window/toolNames.d.ts +16 -1
- package/dist/types/core/agent/window/toolNames.d.ts.map +1 -1
- package/dist/types/core/checkin.d.ts.map +1 -1
- package/dist/types/core/runCheckpoint.d.ts.map +1 -1
- package/dist/types/events/payloads.d.ts +76 -1
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/bug-report/transcript.d.ts +5 -0
- package/dist/types/lib/bug-report/transcript.d.ts.map +1 -1
- package/dist/types/lib/semantics/projection.d.ts.map +1 -1
- package/dist/types/lib/time-travel/receipt.d.ts +4 -3
- package/dist/types/lib/time-travel/receipt.d.ts.map +1 -1
- package/dist/types/lib/time-travel/servedView.d.ts.map +1 -1
- package/dist/types/lib/trace-toolpack/traceToolpack.d.ts.map +1 -1
- package/dist/types/memory/causal/evidenceRecorder.d.ts +2 -0
- package/dist/types/memory/causal/evidenceRecorder.d.ts.map +1 -1
- package/dist/types/recorders/observability/AgentThinkingTraceRecorder.d.ts +2 -0
- package/dist/types/recorders/observability/AgentThinkingTraceRecorder.d.ts.map +1 -1
- package/dist/types/recorders/observability/BoundaryRecorder.d.ts +10 -1
- package/dist/types/recorders/observability/BoundaryRecorder.d.ts.map +1 -1
- package/dist/types/recorders/observability/FlowchartRecorder.d.ts +4 -1
- package/dist/types/recorders/observability/FlowchartRecorder.d.ts.map +1 -1
- package/dist/types/recorders/observability/LiveStateRecorder.d.ts +2 -0
- package/dist/types/recorders/observability/LiveStateRecorder.d.ts.map +1 -1
- package/dist/types/recorders/observability/RouteRecorder.d.ts.map +1 -1
- package/dist/types/recorders/observability/ToolChoiceRecorder.d.ts.map +1 -1
- package/dist/types/recorders/observability/commentary/commentaryTemplates.d.ts.map +1 -1
- package/dist/types/recorders/observability/status/statusTemplates.d.ts.map +1 -1
- package/dist/types/security/extractSequence.d.ts +36 -5
- package/dist/types/security/extractSequence.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -10,7 +10,10 @@
|
|
|
10
10
|
* payload so footprintjs captures a checkpoint.
|
|
11
11
|
* • `resume` runs after the consumer supplies the human's answer.
|
|
12
12
|
* Treats that answer as the paused tool's result, appends to
|
|
13
|
-
* history, then continues the ReAct iteration loop.
|
|
13
|
+
* history, then continues the ReAct iteration loop. Calls the model
|
|
14
|
+
* batched AFTER the paused one were never dispatched; every resume
|
|
15
|
+
* path settles them with one fixed sentence each, a bracket and a
|
|
16
|
+
* count, and runs none of them ("── The batch settlement (9.113.0)").
|
|
14
17
|
*
|
|
15
18
|
* Dispatch resolution order (9.92.0 — DISPATCH FOLLOWS THE OFFER):
|
|
16
19
|
* 0. A name on THIS epoch's wire resolves to the party whose contract the
|
|
@@ -71,7 +74,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
71
74
|
return result;
|
|
72
75
|
};
|
|
73
76
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
74
|
-
exports.buildToolCallsHandler = exports.composeReadSkillRefusal = exports.unknownToolResult = exports.notServedResult = exports.atMountedCursor = void 0;
|
|
77
|
+
exports.buildToolCallsHandler = exports.producerCorpusOf = exports.notDispatchedResult = exports.pausedBatchOf = exports.composeReadSkillRefusal = exports.unknownToolResult = exports.notServedResult = exports.atMountedCursor = void 0;
|
|
75
78
|
const codeRunnerTool_js_1 = require("../../codeRunnerTool.js");
|
|
76
79
|
const footprintjs_1 = require("footprintjs");
|
|
77
80
|
const types_js_1 = require("../../../adapters/types.js");
|
|
@@ -101,6 +104,7 @@ const reserved_js_1 = require("../findings/reserved.js");
|
|
|
101
104
|
const offer_js_1 = require("../findings/offer.js");
|
|
102
105
|
const ledger_js_2 = require("../findings/ledger.js");
|
|
103
106
|
const contingent_js_1 = require("../findings/contingent.js");
|
|
107
|
+
const unsettled_js_1 = require("../findings/unsettled.js");
|
|
104
108
|
const evidenceIndex_js_1 = require("../evidence/evidenceIndex.js");
|
|
105
109
|
const repeatedCall_js_1 = require("../repeatedCall.js");
|
|
106
110
|
const toolArgsValidation_js_1 = require("../toolArgsValidation.js");
|
|
@@ -478,6 +482,130 @@ function argsForPausedCall(scope, toolCallId, peel = false) {
|
|
|
478
482
|
function appendBatchResult(scope, entry) {
|
|
479
483
|
scope.toolResults = [...(scope.toolResults ?? []), entry];
|
|
480
484
|
}
|
|
485
|
+
/**
|
|
486
|
+
* THE PAUSED BATCH (9.113.0) — the turn that proposed the paused call, and
|
|
487
|
+
* the calls on it that a pause left un-dispatched.
|
|
488
|
+
*
|
|
489
|
+
* The batch loop in `execute` dispatches a turn's calls one at a time, in the
|
|
490
|
+
* order the model proposed them, and every pause RETURNS from inside it: the
|
|
491
|
+
* checkpoint is taken on call k, and calls k+1..N were never reached — no
|
|
492
|
+
* gate judged them, no tool ran, no bracket opened. The resume paths used to
|
|
493
|
+
* answer call k and stop, so the next request carried N `tool_use` blocks and
|
|
494
|
+
* fewer `tool_result`s (a provider builds results only from `role: 'tool'`
|
|
495
|
+
* messages), and `iteration_end` counted one call.
|
|
496
|
+
*
|
|
497
|
+
* READ FROM `history`, NEVER CARRIED. Every pause site commits
|
|
498
|
+
* `scope.history = newHistory` before it returns, so the assistant turn that
|
|
499
|
+
* proposed the batch is on the checkpoint — and it is the very message a
|
|
500
|
+
* provider turns into the `tool_use` blocks the settlement must answer. It is
|
|
501
|
+
* therefore the one owner of "which calls does the next request carry", and
|
|
502
|
+
* the checkpoint gains no key: a checkpoint written before this release
|
|
503
|
+
* settles the same way. The window never removes the turn holding the paused
|
|
504
|
+
* call (`../window/turns.ts` · `refusalFor`, its `paused-tool` arm).
|
|
505
|
+
*
|
|
506
|
+
* The LATEST turn proposing the id is the paused one — the pause site commits
|
|
507
|
+
* that turn last, and a provider may reuse an id across turns. No such turn:
|
|
508
|
+
* `size: 0` and nothing to settle, the only answer a missing turn supports.
|
|
509
|
+
*
|
|
510
|
+
* A call after the paused one that history ALREADY answers — a `role: 'tool'`
|
|
511
|
+
* message for its id after that turn — is not un-dispatched, whoever wrote
|
|
512
|
+
* the answer. No library door writes one before the resume; a checkpoint is
|
|
513
|
+
* data, though, and an app may have patched results into a stored one.
|
|
514
|
+
* Settling such a call again would put a second result for its id on the
|
|
515
|
+
* next request, a shape a provider rejects.
|
|
516
|
+
*/
|
|
517
|
+
function pausedBatchOf(history, pausedToolCallId) {
|
|
518
|
+
for (let i = history.length - 1; i >= 0; i--) {
|
|
519
|
+
const message = history[i];
|
|
520
|
+
if (message?.role !== 'assistant')
|
|
521
|
+
continue;
|
|
522
|
+
const proposed = message.toolCalls ?? [];
|
|
523
|
+
const at = proposed.findIndex((call) => call.id === pausedToolCallId);
|
|
524
|
+
if (at < 0)
|
|
525
|
+
continue;
|
|
526
|
+
const answered = new Set(history.slice(i + 1).flatMap((m) => (m.role === 'tool' ? [m.toolCallId] : [])));
|
|
527
|
+
return {
|
|
528
|
+
size: proposed.length,
|
|
529
|
+
undispatched: proposed.slice(at + 1).filter((call) => !answered.has(call.id)),
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
return { size: 0, undispatched: [] };
|
|
533
|
+
}
|
|
534
|
+
exports.pausedBatchOf = pausedBatchOf;
|
|
535
|
+
// LENS · tool-result · persistent-history
|
|
536
|
+
// reads: toolName ← the un-dispatched call on the paused turn (`pausedBatchOf`); paused ← scope.pausedToolName + scope.pausedToolCallId, the checkpoint's own carriers
|
|
537
|
+
// law: may omit, never deny; every clause anchored to the call it was composed on; names no destination.
|
|
538
|
+
/**
|
|
539
|
+
* What a call the paused batch never dispatched gets back (9.113.0) — ONE
|
|
540
|
+
* fixed sentence, on all four resume paths.
|
|
541
|
+
*
|
|
542
|
+
* Every clause is a past fact about one finished event, anchored by name: the
|
|
543
|
+
* call this result answers ("that call"), the call the run paused on (by id
|
|
544
|
+
* and by tool), and the resume. It names no destination. The design page's draft
|
|
545
|
+
* (`docs/design/2026-09-honest-answer-ledger.md`, § 5.5, "The batch
|
|
546
|
+
* settlement") ended "propose it again if still needed" — an instruction about a LATER call,
|
|
547
|
+
* re-read on every call after this one, the tool-less wrap-up included.
|
|
548
|
+
* Whether the call is still needed is the model's to judge from the facts;
|
|
549
|
+
* the surfaces recomposed per request (the tool list, the system prompt) own
|
|
550
|
+
* the present tense. Precedents: the 9.86.1 resumed-call refusal in this file
|
|
551
|
+
* ("was not executed on that call, and the resumed dispatch had no second
|
|
552
|
+
* checkpoint…") and `../selfCallNotice.ts` · `selfCallNotice`.
|
|
553
|
+
*
|
|
554
|
+
* "The run paused ON call …", never "call … paused the run": on two of the
|
|
555
|
+
* four doors the pause was a gate's, not the call's — a middleware's `ask`, a
|
|
556
|
+
* credential's consent need — and on all four the run paused AT that call.
|
|
557
|
+
*
|
|
558
|
+
* The sentence is for the MODEL. The same fact as data rides the settled
|
|
559
|
+
* message as `LLMMessage.notDispatched` and both of its brackets as
|
|
560
|
+
* `notDispatched` (`notDispatchedMarker`), and a reader asking "did this call
|
|
561
|
+
* run?" reads that — never this text.
|
|
562
|
+
*
|
|
563
|
+
* Exported for the producer registry (`test/modelFacingSurfaces.test.ts`).
|
|
564
|
+
*/
|
|
565
|
+
function notDispatchedResult(toolName, paused) {
|
|
566
|
+
return (`Tool '${toolName}' was not executed on that call: the run paused on call ` +
|
|
567
|
+
`'${paused.toolCallId}' to '${paused.toolName}', earlier in the same batch, and resumed ` +
|
|
568
|
+
`without executing the calls that followed it in that batch.`);
|
|
569
|
+
}
|
|
570
|
+
exports.notDispatchedResult = notDispatchedResult;
|
|
571
|
+
/**
|
|
572
|
+
* The same fact as DATA (9.113.0) — the ONE composer of the settlement's
|
|
573
|
+
* marker, `{ pausedCall: { toolCallId, toolName } }`. The settled call's
|
|
574
|
+
* history message (`LLMMessage.notDispatched`) and both of its brackets
|
|
575
|
+
* (`ToolStartPayload.notDispatched`, `ToolEndPayload.notDispatched`) each take
|
|
576
|
+
* a fresh copy from here, so the three carriers can never disagree and no
|
|
577
|
+
* reader holds an object another reader holds.
|
|
578
|
+
*/
|
|
579
|
+
function notDispatchedMarker(paused) {
|
|
580
|
+
return { pausedCall: { toolCallId: paused.toolCallId, toolName: paused.toolName } };
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* The empty-lookup check's PRODUCER CORPUS (9.77.0) — every `role: 'tool'`
|
|
584
|
+
* RESULT in `history` from a tool the judged one names in `argumentsFrom`,
|
|
585
|
+
* as the run served it. The caller hands the history the judged call was
|
|
586
|
+
* served (the call itself is pushed after it), so a producer called earlier in
|
|
587
|
+
* the same batch is already in it — which is right: the model can only have
|
|
588
|
+
* taken a value from a result it had already been served.
|
|
589
|
+
*
|
|
590
|
+
* A message the batch settlement wrote (9.113.0) is no result: its ground
|
|
591
|
+
* never ran, so it produced nothing to take a value from. Read off the marker
|
|
592
|
+
* (`../findings/offer.ts` · `isResultMessage`), never the sentence.
|
|
593
|
+
*
|
|
594
|
+
* Exported for its unit test (`test/integrity/emptyLookup.test.ts`).
|
|
595
|
+
*/
|
|
596
|
+
function producerCorpusOf(history, argumentsFrom) {
|
|
597
|
+
const produced = [];
|
|
598
|
+
for (const message of history) {
|
|
599
|
+
if (!(0, offer_js_1.isResultMessage)(message))
|
|
600
|
+
continue;
|
|
601
|
+
const name = message.toolName;
|
|
602
|
+
if (typeof name !== 'string' || !argumentsFrom.includes(name))
|
|
603
|
+
continue;
|
|
604
|
+
produced.push({ toolName: name, text: message.content });
|
|
605
|
+
}
|
|
606
|
+
return produced;
|
|
607
|
+
}
|
|
608
|
+
exports.producerCorpusOf = producerCorpusOf;
|
|
481
609
|
/**
|
|
482
610
|
* The judge's turn on ONE landed result (9.104.0) — called at the five
|
|
483
611
|
* places a result joins the batch (the execute loop and the four resume
|
|
@@ -740,6 +868,13 @@ function buildToolCallsHandler(deps) {
|
|
|
740
868
|
checked,
|
|
741
869
|
...(notChecked.length > 0 && { notChecked }),
|
|
742
870
|
...(cannotCover.length > 0 && { cannotCover }),
|
|
871
|
+
// The suggestion, as declared (9.113.0): the sentence, and the
|
|
872
|
+
// typed tool as a copy (`tryInsteadToolOfAbsence`). The EVENT only:
|
|
873
|
+
// it is advice about a call not yet made, not ground the answer
|
|
874
|
+
// stands on, so the tracked row below and the block composed from
|
|
875
|
+
// it never carry it.
|
|
876
|
+
...(facts.tryInstead !== undefined && { tryInstead: facts.tryInstead }),
|
|
877
|
+
...(facts.tryInsteadTool !== undefined && { tryInsteadTool: facts.tryInsteadTool }),
|
|
743
878
|
});
|
|
744
879
|
}
|
|
745
880
|
else {
|
|
@@ -807,20 +942,9 @@ function buildToolCallsHandler(deps) {
|
|
|
807
942
|
ledger?.note('empty-lookup', 'write', 'not-applicable');
|
|
808
943
|
return;
|
|
809
944
|
}
|
|
810
|
-
// The producer corpus:
|
|
811
|
-
//
|
|
812
|
-
|
|
813
|
-
// in the same batch is already in it — which is right: the model can only
|
|
814
|
-
// have taken a value from a result it had already been served.
|
|
815
|
-
const produced = [];
|
|
816
|
-
for (const message of history) {
|
|
817
|
-
if (message.role !== 'tool')
|
|
818
|
-
continue;
|
|
819
|
-
const name = message.toolName;
|
|
820
|
-
if (typeof name !== 'string' || !argumentsFrom.includes(name))
|
|
821
|
-
continue;
|
|
822
|
-
produced.push({ toolName: name, text: message.content });
|
|
823
|
-
}
|
|
945
|
+
// The producer corpus: the earlier RESULTS from a tool THIS tool declares
|
|
946
|
+
// as one of its grounds — never a settled message (`producerCorpusOf`).
|
|
947
|
+
const produced = producerCorpusOf(history, argumentsFrom);
|
|
824
948
|
const { findings, disposition } = (0, check_js_1.emptyLookupOf)({
|
|
825
949
|
toolName: call.toolName,
|
|
826
950
|
toolCallId: call.toolCallId,
|
|
@@ -2029,6 +2153,68 @@ function buildToolCallsHandler(deps) {
|
|
|
2029
2153
|
(0, ledger_js_1.recordDecisions)(scope, verdict.decisions);
|
|
2030
2154
|
return verdict.kind === 'deny' ? verdict.reason : verdict.result;
|
|
2031
2155
|
};
|
|
2156
|
+
const settleBatch = (answered, paused) => {
|
|
2157
|
+
const batch = pausedBatchOf(answered, paused.toolCallId);
|
|
2158
|
+
if (batch.undispatched.length === 0)
|
|
2159
|
+
return { history: answered, settled: [], size: batch.size, paused };
|
|
2160
|
+
const settled = batch.undispatched.map((call) => ({
|
|
2161
|
+
call,
|
|
2162
|
+
result: notDispatchedResult(call.name, paused),
|
|
2163
|
+
}));
|
|
2164
|
+
return {
|
|
2165
|
+
history: [
|
|
2166
|
+
...answered,
|
|
2167
|
+
...settled.map(({ call, result }) => ({
|
|
2168
|
+
role: 'tool',
|
|
2169
|
+
content: result,
|
|
2170
|
+
toolCallId: call.id,
|
|
2171
|
+
toolName: call.name,
|
|
2172
|
+
notDispatched: notDispatchedMarker(paused),
|
|
2173
|
+
})),
|
|
2174
|
+
],
|
|
2175
|
+
settled,
|
|
2176
|
+
size: batch.size,
|
|
2177
|
+
paused,
|
|
2178
|
+
};
|
|
2179
|
+
};
|
|
2180
|
+
/**
|
|
2181
|
+
* Each settled sibling's bracket, after the paused call's own `tool_end` —
|
|
2182
|
+
* the ONE site that stamps `notDispatched` on the stream: `tool_start` with
|
|
2183
|
+
* the args the call would have run with (the batch loop's peel, so
|
|
2184
|
+
* `_findings` never shows on a bracket), then `tool_end` carrying the
|
|
2185
|
+
* sentence and `durationMs: 0`. Both carry the marker the history message
|
|
2186
|
+
* carries (`notDispatchedMarker`), and no other bracket in the library ever
|
|
2187
|
+
* does.
|
|
2188
|
+
*
|
|
2189
|
+
* No `error`. It says a call FAILED — the tool threw, or the call itself
|
|
2190
|
+
* could not run as written (an args rejection, a `wants` block, a consent
|
|
2191
|
+
* the tool needed and did not get, an unknown name). A settled call did not
|
|
2192
|
+
* fail: the library decided not to dispatch it, as it does for a call a
|
|
2193
|
+
* permission policy denies or halts, and those brackets carry no `error`
|
|
2194
|
+
* either. Stamped here, it would register a tool failure in every
|
|
2195
|
+
* error-rate reader (a span status, a dashboard, an alert) on every
|
|
2196
|
+
* mid-batch pause, and say a second, false thing beside the marker, which
|
|
2197
|
+
* is the one owner of why there is no result (`src/core/README.md` · "One
|
|
2198
|
+
* owner of 'never dispatched' — in history and on the stream", the reader
|
|
2199
|
+
* table). No `status` either: that field is the TOOL's own word.
|
|
2200
|
+
*/
|
|
2201
|
+
const bracketSettled = (scope, settlement) => {
|
|
2202
|
+
for (const { call, result } of settlement.settled) {
|
|
2203
|
+
(0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.stream.tool_start', {
|
|
2204
|
+
toolName: call.name,
|
|
2205
|
+
toolCallId: call.id,
|
|
2206
|
+
args: peelCall(call).args,
|
|
2207
|
+
parallelCount: settlement.size,
|
|
2208
|
+
notDispatched: notDispatchedMarker(settlement.paused),
|
|
2209
|
+
});
|
|
2210
|
+
(0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.stream.tool_end', {
|
|
2211
|
+
toolCallId: call.id,
|
|
2212
|
+
result,
|
|
2213
|
+
durationMs: 0,
|
|
2214
|
+
notDispatched: notDispatchedMarker(settlement.paused),
|
|
2215
|
+
});
|
|
2216
|
+
}
|
|
2217
|
+
};
|
|
2032
2218
|
// Resolve a tool's declared credential (declare-and-push) and execute it,
|
|
2033
2219
|
// emitting the same credential.* events as the main loop. Used by the
|
|
2034
2220
|
// check-in RESUME path when a human APPROVES — the tool never ran at pause
|
|
@@ -2354,15 +2540,24 @@ function buildToolCallsHandler(deps) {
|
|
|
2354
2540
|
// came from (9.102.0; before, only the last batch resolved and an
|
|
2355
2541
|
// offered older id filed as `unknownId`). Read through the same
|
|
2356
2542
|
// per-call peel the loop below applies (a tool that owns the name
|
|
2357
|
-
// declares nothing).
|
|
2543
|
+
// declares nothing). A ruled-out standing whose result THIS door
|
|
2544
|
+
// recorded as an absence (`declareCoverage`'s rows on
|
|
2545
|
+
// `coverageDeclared`, never a second reading of a return) AND the
|
|
2546
|
+
// model was served as one (the served string — the door records the
|
|
2547
|
+
// return before the after-tool chain, the ceiling and placement act,
|
|
2548
|
+
// so a denied, refused or ticketed result files nothing) gets its
|
|
2549
|
+
// `unsettled-by-absence` row immediately after it, in the same write,
|
|
2550
|
+
// worded from what was served (9.113.0, `findings/unsettled.ts`; the
|
|
2551
|
+
// key is read only for such a standing); the standing rows pass
|
|
2552
|
+
// through untouched. Gated: unarmed, not one line runs.
|
|
2358
2553
|
if (deps.findings === true) {
|
|
2359
2554
|
const known = (0, offer_js_1.knownResults)([...(scope.history ?? [])], [...(scope.toolResults ?? [])]);
|
|
2360
|
-
(0, ledger_js_2.recordFindings)(scope, toolCalls.flatMap((tc) => {
|
|
2555
|
+
(0, ledger_js_2.recordFindings)(scope, (0, unsettled_js_1.withUnsettledRows)(toolCalls.flatMap((tc) => {
|
|
2361
2556
|
const declared = peelCall(tc).findings;
|
|
2362
2557
|
return declared?.previous !== undefined
|
|
2363
2558
|
? (0, ledger_js_2.standingRowsFrom)(known, declared, { toolCallId: tc.id }, iteration)
|
|
2364
2559
|
: [];
|
|
2365
|
-
}));
|
|
2560
|
+
}), known, () => [...(scope.coverageDeclared ?? [])]));
|
|
2366
2561
|
}
|
|
2367
2562
|
scope.toolResults = [];
|
|
2368
2563
|
// ── THE TOWERS AT DISPATCH (9.110.0) — one corpus per batch ────────
|
|
@@ -3934,10 +4129,13 @@ function buildToolCallsHandler(deps) {
|
|
|
3934
4129
|
askResultStr += applyToolEffects(scope, { toolName, toolCallId, iteration }, resumeEnvelope, askTransition);
|
|
3935
4130
|
emitTransitionConflict(scope, iteration, askTransition);
|
|
3936
4131
|
}
|
|
3937
|
-
|
|
4132
|
+
// The batch settlement (9.113.0): the answered call's result, then the
|
|
4133
|
+
// siblings the pause left un-dispatched, each settled — never run.
|
|
4134
|
+
const askSettlement = settleBatch([
|
|
3938
4135
|
...scope.history,
|
|
3939
4136
|
{ role: 'tool', content: askResultStr, toolCallId, toolName },
|
|
3940
|
-
];
|
|
4137
|
+
], { toolName, toolCallId });
|
|
4138
|
+
const askHistory = askSettlement.history;
|
|
3941
4139
|
scope.history = askHistory;
|
|
3942
4140
|
scope.lastToolResult = {
|
|
3943
4141
|
toolName,
|
|
@@ -3958,10 +4156,14 @@ function buildToolCallsHandler(deps) {
|
|
|
3958
4156
|
...(error === true && { error: true }),
|
|
3959
4157
|
...(resumeEnvelope?.status !== undefined && { status: resumeEnvelope.status }),
|
|
3960
4158
|
});
|
|
4159
|
+
bracketSettled(scope, askSettlement);
|
|
3961
4160
|
(0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.agent.iteration_end', {
|
|
3962
4161
|
turnIndex: 0,
|
|
3963
4162
|
iterIndex: iteration,
|
|
3964
|
-
|
|
4163
|
+
// The brackets THIS leg closed: the answered call's, plus one per
|
|
4164
|
+
// settled sibling. The calls before the paused one closed theirs on
|
|
4165
|
+
// the leg that paused, which ended in a checkpoint, not here.
|
|
4166
|
+
toolCallCount: 1 + askSettlement.settled.length,
|
|
3965
4167
|
history: askHistory,
|
|
3966
4168
|
});
|
|
3967
4169
|
scope.iteration = iteration + 1;
|
|
@@ -4078,10 +4280,12 @@ function buildToolCallsHandler(deps) {
|
|
|
4078
4280
|
decisionResultStr += applyToolEffects(scope, { toolName, toolCallId, iteration }, resumeEnvelope, decisionTransition);
|
|
4079
4281
|
emitTransitionConflict(scope, iteration, decisionTransition);
|
|
4080
4282
|
}
|
|
4081
|
-
|
|
4283
|
+
// The batch settlement (9.113.0) — the ask path's twin.
|
|
4284
|
+
const decisionSettlement = settleBatch([
|
|
4082
4285
|
...scope.history,
|
|
4083
4286
|
{ role: 'tool', content: decisionResultStr, toolCallId, toolName },
|
|
4084
|
-
];
|
|
4287
|
+
], { toolName, toolCallId });
|
|
4288
|
+
const decisionHistory = decisionSettlement.history;
|
|
4085
4289
|
scope.history = decisionHistory;
|
|
4086
4290
|
// Drives `on-tool-return` triggers, same as the execute path.
|
|
4087
4291
|
scope.lastToolResult = {
|
|
@@ -4103,10 +4307,12 @@ function buildToolCallsHandler(deps) {
|
|
|
4103
4307
|
...(error === true && { error: true }),
|
|
4104
4308
|
...(resumeEnvelope?.status !== undefined && { status: resumeEnvelope.status }),
|
|
4105
4309
|
});
|
|
4310
|
+
bracketSettled(scope, decisionSettlement);
|
|
4106
4311
|
(0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.agent.iteration_end', {
|
|
4107
4312
|
turnIndex: 0,
|
|
4108
4313
|
iterIndex: iteration,
|
|
4109
|
-
|
|
4314
|
+
// The brackets this leg closed — see the ask path's twin.
|
|
4315
|
+
toolCallCount: 1 + decisionSettlement.settled.length,
|
|
4110
4316
|
history: decisionHistory,
|
|
4111
4317
|
});
|
|
4112
4318
|
scope.iteration = iteration + 1;
|
|
@@ -4188,10 +4394,12 @@ function buildToolCallsHandler(deps) {
|
|
|
4188
4394
|
consentResultStr += applyToolEffects(scope, { toolName, toolCallId, iteration }, consentEnvelope, consentTransition);
|
|
4189
4395
|
emitTransitionConflict(scope, iteration, consentTransition);
|
|
4190
4396
|
}
|
|
4191
|
-
|
|
4397
|
+
// The batch settlement (9.113.0) — the ask path's twin.
|
|
4398
|
+
const consentSettlement = settleBatch([
|
|
4192
4399
|
...scope.history,
|
|
4193
4400
|
{ role: 'tool', content: consentResultStr, toolCallId, toolName },
|
|
4194
|
-
];
|
|
4401
|
+
], { toolName, toolCallId });
|
|
4402
|
+
const consentHistory = consentSettlement.history;
|
|
4195
4403
|
scope.history = consentHistory;
|
|
4196
4404
|
scope.lastToolResult = {
|
|
4197
4405
|
toolName,
|
|
@@ -4212,10 +4420,12 @@ function buildToolCallsHandler(deps) {
|
|
|
4212
4420
|
...(error === true && { error: true }),
|
|
4213
4421
|
...(consentEnvelope?.status !== undefined && { status: consentEnvelope.status }),
|
|
4214
4422
|
});
|
|
4423
|
+
bracketSettled(scope, consentSettlement);
|
|
4215
4424
|
(0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.agent.iteration_end', {
|
|
4216
4425
|
turnIndex: 0,
|
|
4217
4426
|
iterIndex: iteration,
|
|
4218
|
-
|
|
4427
|
+
// The brackets this leg closed — see the ask path's twin.
|
|
4428
|
+
toolCallCount: 1 + consentSettlement.settled.length,
|
|
4219
4429
|
history: consentHistory,
|
|
4220
4430
|
});
|
|
4221
4431
|
scope.iteration = iteration + 1;
|
|
@@ -4293,7 +4503,10 @@ function buildToolCallsHandler(deps) {
|
|
|
4293
4503
|
if (deps.stepPlanFor) {
|
|
4294
4504
|
resultStr += applyStepReturn(scope, { toolName, toolCallId, iteration });
|
|
4295
4505
|
}
|
|
4296
|
-
|
|
4506
|
+
// The batch settlement (9.113.0) — the door a `requestInput` answer
|
|
4507
|
+
// comes back through, and the one most likely to meet a batch: a tool
|
|
4508
|
+
// that asks a person mid-lookup, batched with the lookups after it.
|
|
4509
|
+
const pauseSettlement = settleBatch([
|
|
4297
4510
|
...scope.history,
|
|
4298
4511
|
{
|
|
4299
4512
|
role: 'tool',
|
|
@@ -4301,7 +4514,8 @@ function buildToolCallsHandler(deps) {
|
|
|
4301
4514
|
toolCallId,
|
|
4302
4515
|
toolName,
|
|
4303
4516
|
},
|
|
4304
|
-
];
|
|
4517
|
+
], { toolName, toolCallId });
|
|
4518
|
+
const newHistory = pauseSettlement.history;
|
|
4305
4519
|
scope.history = newHistory;
|
|
4306
4520
|
// Drives `on-tool-return` triggers, same as every other dispatch path.
|
|
4307
4521
|
scope.lastToolResult = { toolName, result: resultStr };
|
|
@@ -4317,10 +4531,12 @@ function buildToolCallsHandler(deps) {
|
|
|
4317
4531
|
result: pauseCapped.result,
|
|
4318
4532
|
durationMs: Date.now() - startMs,
|
|
4319
4533
|
});
|
|
4534
|
+
bracketSettled(scope, pauseSettlement);
|
|
4320
4535
|
(0, typedEmit_js_1.typedEmit)(scope, 'agentfootprint.agent.iteration_end', {
|
|
4321
4536
|
turnIndex: 0,
|
|
4322
4537
|
iterIndex: iteration,
|
|
4323
|
-
|
|
4538
|
+
// The brackets this leg closed — see the ask path's twin.
|
|
4539
|
+
toolCallCount: 1 + pauseSettlement.settled.length,
|
|
4324
4540
|
// Plain local array — see the matching note on the execute path.
|
|
4325
4541
|
history: newHistory,
|
|
4326
4542
|
});
|