agentfootprint 12.2.0 → 13.0.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/CAPABILITIES.md +1 -0
- package/dist/adapters/code/output.js +8 -29
- package/dist/adapters/code/output.js.map +1 -1
- package/dist/adapters/observability/audit.js +151 -159
- package/dist/adapters/observability/audit.js.map +1 -1
- package/dist/adapters/observability/auditBounding.js +411 -0
- package/dist/adapters/observability/auditBounding.js.map +1 -0
- package/dist/adapters/observability/auditKeptByContract.js +107 -0
- package/dist/adapters/observability/auditKeptByContract.js.map +1 -0
- package/dist/adapters/observability/auditShapes.js +1731 -0
- package/dist/adapters/observability/auditShapes.js.map +1 -0
- package/dist/answer-account/account.js +92 -15
- package/dist/answer-account/account.js.map +1 -1
- package/dist/answer-account/facts/calls.js +7 -9
- package/dist/answer-account/facts/calls.js.map +1 -1
- package/dist/answer-account/facts/checked.js +2 -2
- package/dist/answer-account/facts/checked.js.map +1 -1
- package/dist/answer-account/facts/common.js +40 -7
- package/dist/answer-account/facts/common.js.map +1 -1
- package/dist/answer-account/facts/found.js +1 -1
- package/dist/answer-account/facts/found.js.map +1 -1
- package/dist/answer-account/facts/howSure.js +21 -3
- package/dist/answer-account/facts/howSure.js.map +1 -1
- package/dist/answer-account/facts/inView.js +3 -4
- package/dist/answer-account/facts/inView.js.map +1 -1
- package/dist/answer-account/facts/pausedLeg.js +1 -1
- package/dist/answer-account/facts/pausedLeg.js.map +1 -1
- package/dist/answer-account/facts/scripts.js +222 -0
- package/dist/answer-account/facts/scripts.js.map +1 -0
- package/dist/answer-account/facts/understood.js +5 -5
- package/dist/answer-account/facts/understood.js.map +1 -1
- package/dist/answer-account/pointerKey.js +1 -1
- package/dist/answer-account/shown.js +25 -7
- package/dist/answer-account/shown.js.map +1 -1
- package/dist/answer-account/signals.js +1 -1
- package/dist/answer-account/signals.js.map +1 -1
- package/dist/answer-account/size.js +152 -0
- package/dist/answer-account/size.js.map +1 -0
- package/dist/answer-account/templates.js +39 -1
- package/dist/answer-account/templates.js.map +1 -1
- package/dist/core/Agent.js +25 -1
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/agent/AgentBuilder.js +85 -1
- package/dist/core/agent/AgentBuilder.js.map +1 -1
- package/dist/core/agent/arguments/ask.js +85 -2
- package/dist/core/agent/arguments/ask.js.map +1 -1
- package/dist/core/agent/arguments/partialWindow.js +120 -0
- package/dist/core/agent/arguments/partialWindow.js.map +1 -0
- package/dist/core/agent/assessment/assess.js +37 -0
- package/dist/core/agent/assessment/assess.js.map +1 -1
- package/dist/core/agent/assessment/compose.js +5 -1
- package/dist/core/agent/assessment/compose.js.map +1 -1
- package/dist/core/agent/assessment/reasons.js +7 -0
- package/dist/core/agent/assessment/reasons.js.map +1 -1
- package/dist/core/agent/assessment/witness.js +37 -4
- package/dist/core/agent/assessment/witness.js.map +1 -1
- package/dist/core/agent/buildAgentChart.js.map +1 -1
- package/dist/core/agent/evidence/codeRegions.js +279 -0
- package/dist/core/agent/evidence/codeRegions.js.map +1 -0
- package/dist/core/agent/evidence/gate.js +13 -2
- package/dist/core/agent/evidence/gate.js.map +1 -1
- package/dist/core/agent/evidence/recovery.js +11 -2
- package/dist/core/agent/evidence/recovery.js.map +1 -1
- package/dist/core/agent/findings/types.js.map +1 -1
- package/dist/core/agent/scripts/attachment.js +375 -0
- package/dist/core/agent/scripts/attachment.js.map +1 -0
- package/dist/core/agent/scripts/inert.js +88 -0
- package/dist/core/agent/scripts/inert.js.map +1 -0
- package/dist/core/agent/scripts/judge.js +41 -0
- package/dist/core/agent/scripts/judge.js.map +1 -0
- package/dist/core/agent/scripts/label.js +143 -0
- package/dist/core/agent/scripts/label.js.map +1 -0
- package/dist/core/agent/scripts/match.js +233 -0
- package/dist/core/agent/scripts/match.js.map +1 -0
- package/dist/core/agent/scripts/recovery.js +81 -0
- package/dist/core/agent/scripts/recovery.js.map +1 -0
- package/dist/core/agent/scripts/rows.js +221 -0
- package/dist/core/agent/scripts/rows.js.map +1 -0
- package/dist/core/agent/scripts/types.js +22 -0
- package/dist/core/agent/scripts/types.js.map +1 -0
- package/dist/core/agent/scripts/wrapper.js +63 -0
- package/dist/core/agent/scripts/wrapper.js.map +1 -0
- package/dist/core/agent/stages/argumentAsk.js +161 -19
- package/dist/core/agent/stages/argumentAsk.js.map +1 -1
- package/dist/core/agent/stages/evidenceRecheck.js +4 -1
- package/dist/core/agent/stages/evidenceRecheck.js.map +1 -1
- package/dist/core/agent/stages/prepareFinal.js +65 -10
- package/dist/core/agent/stages/prepareFinal.js.map +1 -1
- package/dist/core/agent/stages/route.js +53 -3
- package/dist/core/agent/stages/route.js.map +1 -1
- package/dist/core/agent/stages/seed.js +14 -1
- package/dist/core/agent/stages/seed.js.map +1 -1
- package/dist/core/agent/stages/toolCalls.js +339 -18
- package/dist/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/core/codeRunnerTool.js +32 -3
- package/dist/core/codeRunnerTool.js.map +1 -1
- package/dist/core/runCheckpoint.js +19 -6
- package/dist/core/runCheckpoint.js.map +1 -1
- package/dist/esm/adapters/code/output.d.ts +1 -4
- package/dist/esm/adapters/code/output.js +3 -24
- package/dist/esm/adapters/code/output.js.map +1 -1
- package/dist/esm/adapters/observability/audit.d.ts +79 -12
- package/dist/esm/adapters/observability/audit.js +132 -142
- package/dist/esm/adapters/observability/audit.js.map +1 -1
- package/dist/esm/adapters/observability/auditBounding.d.ts +215 -0
- package/dist/esm/adapters/observability/auditBounding.js +390 -0
- package/dist/esm/adapters/observability/auditBounding.js.map +1 -0
- package/dist/esm/adapters/observability/auditKeptByContract.d.ts +65 -0
- package/dist/esm/adapters/observability/auditKeptByContract.js +103 -0
- package/dist/esm/adapters/observability/auditKeptByContract.js.map +1 -0
- package/dist/esm/adapters/observability/auditShapes.d.ts +78 -0
- package/dist/esm/adapters/observability/auditShapes.js +1726 -0
- package/dist/esm/adapters/observability/auditShapes.js.map +1 -0
- package/dist/esm/answer-account/account.js +91 -14
- package/dist/esm/answer-account/account.js.map +1 -1
- package/dist/esm/answer-account/facts/calls.d.ts +0 -2
- package/dist/esm/answer-account/facts/calls.js +1 -3
- package/dist/esm/answer-account/facts/calls.js.map +1 -1
- package/dist/esm/answer-account/facts/checked.js +2 -2
- package/dist/esm/answer-account/facts/checked.js.map +1 -1
- package/dist/esm/answer-account/facts/common.d.ts +16 -4
- package/dist/esm/answer-account/facts/common.js +38 -6
- package/dist/esm/answer-account/facts/common.js.map +1 -1
- package/dist/esm/answer-account/facts/found.js +2 -2
- package/dist/esm/answer-account/facts/found.js.map +1 -1
- package/dist/esm/answer-account/facts/howSure.d.ts +1 -1
- package/dist/esm/answer-account/facts/howSure.js +22 -4
- package/dist/esm/answer-account/facts/howSure.js.map +1 -1
- package/dist/esm/answer-account/facts/inView.js +1 -2
- package/dist/esm/answer-account/facts/inView.js.map +1 -1
- package/dist/esm/answer-account/facts/pausedLeg.js +2 -2
- package/dist/esm/answer-account/facts/pausedLeg.js.map +1 -1
- package/dist/esm/answer-account/facts/scripts.d.ts +34 -0
- package/dist/esm/answer-account/facts/scripts.js +218 -0
- package/dist/esm/answer-account/facts/scripts.js.map +1 -0
- package/dist/esm/answer-account/facts/understood.js +2 -2
- package/dist/esm/answer-account/facts/understood.js.map +1 -1
- package/dist/esm/answer-account/pointerKey.d.ts +1 -1
- package/dist/esm/answer-account/pointerKey.js +1 -1
- package/dist/esm/answer-account/shown.d.ts +9 -2
- package/dist/esm/answer-account/shown.js +25 -7
- package/dist/esm/answer-account/shown.js.map +1 -1
- package/dist/esm/answer-account/signals.js +2 -2
- package/dist/esm/answer-account/signals.js.map +1 -1
- package/dist/esm/answer-account/size.d.ts +59 -0
- package/dist/esm/answer-account/size.js +147 -0
- package/dist/esm/answer-account/size.js.map +1 -0
- package/dist/esm/answer-account/templates.d.ts +29 -1
- package/dist/esm/answer-account/templates.js +39 -1
- package/dist/esm/answer-account/templates.js.map +1 -1
- package/dist/esm/core/Agent.d.ts +8 -1
- package/dist/esm/core/Agent.js +25 -1
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/agent/AgentBuilder.d.ts +52 -0
- package/dist/esm/core/agent/AgentBuilder.js +85 -1
- package/dist/esm/core/agent/AgentBuilder.js.map +1 -1
- package/dist/esm/core/agent/arguments/ask.d.ts +11 -0
- package/dist/esm/core/agent/arguments/ask.js +83 -1
- package/dist/esm/core/agent/arguments/ask.js.map +1 -1
- package/dist/esm/core/agent/arguments/partialWindow.d.ts +42 -0
- package/dist/esm/core/agent/arguments/partialWindow.js +111 -0
- package/dist/esm/core/agent/arguments/partialWindow.js.map +1 -0
- package/dist/esm/core/agent/assessment/assess.js +37 -0
- package/dist/esm/core/agent/assessment/assess.js.map +1 -1
- package/dist/esm/core/agent/assessment/compose.d.ts +3 -1
- package/dist/esm/core/agent/assessment/compose.js +5 -1
- package/dist/esm/core/agent/assessment/compose.js.map +1 -1
- package/dist/esm/core/agent/assessment/reasons.js +7 -0
- package/dist/esm/core/agent/assessment/reasons.js.map +1 -1
- package/dist/esm/core/agent/assessment/types.d.ts +12 -2
- package/dist/esm/core/agent/assessment/witness.d.ts +44 -4
- package/dist/esm/core/agent/assessment/witness.js +35 -3
- package/dist/esm/core/agent/assessment/witness.js.map +1 -1
- package/dist/esm/core/agent/buildAgentChart.d.ts +9 -0
- package/dist/esm/core/agent/buildAgentChart.js.map +1 -1
- package/dist/esm/core/agent/evidence/codeRegions.d.ts +130 -0
- package/dist/esm/core/agent/evidence/codeRegions.js +275 -0
- package/dist/esm/core/agent/evidence/codeRegions.js.map +1 -0
- package/dist/esm/core/agent/evidence/gate.d.ts +3 -0
- package/dist/esm/core/agent/evidence/gate.js +12 -2
- package/dist/esm/core/agent/evidence/gate.js.map +1 -1
- package/dist/esm/core/agent/evidence/recovery.d.ts +5 -1
- package/dist/esm/core/agent/evidence/recovery.js +11 -2
- package/dist/esm/core/agent/evidence/recovery.js.map +1 -1
- package/dist/esm/core/agent/evidence/types.d.ts +35 -0
- package/dist/esm/core/agent/findings/types.d.ts +3 -2
- package/dist/esm/core/agent/findings/types.js.map +1 -1
- package/dist/esm/core/agent/scripts/attachment.d.ts +179 -0
- package/dist/esm/core/agent/scripts/attachment.js +361 -0
- package/dist/esm/core/agent/scripts/attachment.js.map +1 -0
- package/dist/esm/core/agent/scripts/inert.d.ts +38 -0
- package/dist/esm/core/agent/scripts/inert.js +84 -0
- package/dist/esm/core/agent/scripts/inert.js.map +1 -0
- package/dist/esm/core/agent/scripts/judge.d.ts +36 -0
- package/dist/esm/core/agent/scripts/judge.js +37 -0
- package/dist/esm/core/agent/scripts/judge.js.map +1 -0
- package/dist/esm/core/agent/scripts/label.d.ts +103 -0
- package/dist/esm/core/agent/scripts/label.js +136 -0
- package/dist/esm/core/agent/scripts/label.js.map +1 -0
- package/dist/esm/core/agent/scripts/match.d.ts +99 -0
- package/dist/esm/core/agent/scripts/match.js +226 -0
- package/dist/esm/core/agent/scripts/match.js.map +1 -0
- package/dist/esm/core/agent/scripts/recovery.d.ts +54 -0
- package/dist/esm/core/agent/scripts/recovery.js +77 -0
- package/dist/esm/core/agent/scripts/recovery.js.map +1 -0
- package/dist/esm/core/agent/scripts/rows.d.ts +143 -0
- package/dist/esm/core/agent/scripts/rows.js +211 -0
- package/dist/esm/core/agent/scripts/rows.js.map +1 -0
- package/dist/esm/core/agent/scripts/types.d.ts +91 -0
- package/dist/esm/core/agent/scripts/types.js +21 -0
- package/dist/esm/core/agent/scripts/types.js.map +1 -0
- package/dist/esm/core/agent/scripts/wrapper.d.ts +36 -0
- package/dist/esm/core/agent/scripts/wrapper.js +58 -0
- package/dist/esm/core/agent/scripts/wrapper.js.map +1 -0
- package/dist/esm/core/agent/stages/argumentAsk.d.ts +4 -1
- package/dist/esm/core/agent/stages/argumentAsk.js +164 -22
- package/dist/esm/core/agent/stages/argumentAsk.js.map +1 -1
- package/dist/esm/core/agent/stages/evidenceRecheck.js +4 -1
- package/dist/esm/core/agent/stages/evidenceRecheck.js.map +1 -1
- package/dist/esm/core/agent/stages/prepareFinal.d.ts +11 -0
- package/dist/esm/core/agent/stages/prepareFinal.js +65 -10
- package/dist/esm/core/agent/stages/prepareFinal.js.map +1 -1
- package/dist/esm/core/agent/stages/route.js +53 -3
- package/dist/esm/core/agent/stages/route.js.map +1 -1
- package/dist/esm/core/agent/stages/seed.js +14 -1
- package/dist/esm/core/agent/stages/seed.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls.d.ts +14 -0
- package/dist/esm/core/agent/stages/toolCalls.js +337 -16
- package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/esm/core/agent/types.d.ts +41 -0
- package/dist/esm/core/codeRunnerTool.d.ts +23 -0
- package/dist/esm/core/codeRunnerTool.js +31 -2
- package/dist/esm/core/codeRunnerTool.js.map +1 -1
- package/dist/esm/core/runCheckpoint.js +16 -3
- package/dist/esm/core/runCheckpoint.js.map +1 -1
- package/dist/esm/events/payloads.d.ts +46 -1
- package/dist/esm/hosting/answerAccounts.js +4 -2
- package/dist/esm/hosting/answerAccounts.js.map +1 -1
- package/dist/esm/hosting/artifactWire.d.ts +3 -2
- package/dist/esm/hosting/artifactWire.js.map +1 -1
- package/dist/esm/index.d.ts +3 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/boundedJson.d.ts +24 -0
- package/dist/esm/lib/boundedJson.js +45 -2
- package/dist/esm/lib/boundedJson.js.map +1 -1
- package/dist/esm/lib/scriptRecord.d.ts +139 -0
- package/dist/esm/lib/scriptRecord.js +18 -0
- package/dist/esm/lib/scriptRecord.js.map +1 -0
- package/dist/esm/lib/utf8.d.ts +36 -0
- package/dist/esm/lib/utf8.js +70 -0
- package/dist/esm/lib/utf8.js.map +1 -0
- package/dist/esm/mcp/toolExtras.d.ts +9 -0
- package/dist/esm/mcp/toolExtras.js +6 -0
- package/dist/esm/mcp/toolExtras.js.map +1 -1
- package/dist/esm/redaction/conversation.js +10 -0
- package/dist/esm/redaction/conversation.js.map +1 -1
- package/dist/esm/redaction/knownStrings.js +34 -0
- package/dist/esm/redaction/knownStrings.js.map +1 -1
- package/dist/esm/semantics/coverage/answer.d.ts +12 -1
- package/dist/esm/semantics/coverage/answer.js +26 -3
- package/dist/esm/semantics/coverage/answer.js.map +1 -1
- package/dist/esm/tools/script.d.ts +85 -0
- package/dist/esm/tools/script.js +157 -0
- package/dist/esm/tools/script.js.map +1 -0
- package/dist/esm/tools/tools.d.ts +30 -0
- package/dist/esm/tools/tools.js +4 -0
- package/dist/esm/tools/tools.js.map +1 -1
- package/dist/hosting/answerAccounts.js +4 -2
- package/dist/hosting/answerAccounts.js.map +1 -1
- package/dist/hosting/artifactWire.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/lib/boundedJson.js +48 -3
- package/dist/lib/boundedJson.js.map +1 -1
- package/dist/lib/scriptRecord.js +19 -0
- package/dist/lib/scriptRecord.js.map +1 -0
- package/dist/lib/utf8.js +77 -0
- package/dist/lib/utf8.js.map +1 -0
- package/dist/mcp/toolExtras.js +6 -0
- package/dist/mcp/toolExtras.js.map +1 -1
- package/dist/redaction/conversation.js +10 -0
- package/dist/redaction/conversation.js.map +1 -1
- package/dist/redaction/knownStrings.js +34 -0
- package/dist/redaction/knownStrings.js.map +1 -1
- package/dist/semantics/coverage/answer.js +26 -3
- package/dist/semantics/coverage/answer.js.map +1 -1
- package/dist/tools/script.js +163 -0
- package/dist/tools/script.js.map +1 -0
- package/dist/tools/tools.js +4 -0
- package/dist/tools/tools.js.map +1 -1
- package/dist/types/adapters/code/output.d.ts +1 -4
- package/dist/types/adapters/code/output.d.ts.map +1 -1
- package/dist/types/adapters/observability/audit.d.ts +79 -12
- package/dist/types/adapters/observability/audit.d.ts.map +1 -1
- package/dist/types/adapters/observability/auditBounding.d.ts +216 -0
- package/dist/types/adapters/observability/auditBounding.d.ts.map +1 -0
- package/dist/types/adapters/observability/auditKeptByContract.d.ts +66 -0
- package/dist/types/adapters/observability/auditKeptByContract.d.ts.map +1 -0
- package/dist/types/adapters/observability/auditShapes.d.ts +79 -0
- package/dist/types/adapters/observability/auditShapes.d.ts.map +1 -0
- package/dist/types/answer-account/account.d.ts.map +1 -1
- package/dist/types/answer-account/facts/calls.d.ts +0 -2
- package/dist/types/answer-account/facts/calls.d.ts.map +1 -1
- package/dist/types/answer-account/facts/checked.d.ts.map +1 -1
- package/dist/types/answer-account/facts/common.d.ts +16 -4
- package/dist/types/answer-account/facts/common.d.ts.map +1 -1
- package/dist/types/answer-account/facts/found.d.ts.map +1 -1
- package/dist/types/answer-account/facts/howSure.d.ts +1 -1
- package/dist/types/answer-account/facts/howSure.d.ts.map +1 -1
- package/dist/types/answer-account/facts/inView.d.ts.map +1 -1
- package/dist/types/answer-account/facts/pausedLeg.d.ts.map +1 -1
- package/dist/types/answer-account/facts/scripts.d.ts +35 -0
- package/dist/types/answer-account/facts/scripts.d.ts.map +1 -0
- package/dist/types/answer-account/facts/understood.d.ts.map +1 -1
- package/dist/types/answer-account/pointerKey.d.ts +1 -1
- package/dist/types/answer-account/shown.d.ts +9 -2
- package/dist/types/answer-account/shown.d.ts.map +1 -1
- package/dist/types/answer-account/signals.d.ts.map +1 -1
- package/dist/types/answer-account/size.d.ts +60 -0
- package/dist/types/answer-account/size.d.ts.map +1 -0
- package/dist/types/answer-account/templates.d.ts +29 -1
- package/dist/types/answer-account/templates.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts +8 -1
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/agent/AgentBuilder.d.ts +52 -0
- package/dist/types/core/agent/AgentBuilder.d.ts.map +1 -1
- package/dist/types/core/agent/arguments/ask.d.ts +11 -0
- package/dist/types/core/agent/arguments/ask.d.ts.map +1 -1
- package/dist/types/core/agent/arguments/partialWindow.d.ts +43 -0
- package/dist/types/core/agent/arguments/partialWindow.d.ts.map +1 -0
- package/dist/types/core/agent/assessment/assess.d.ts.map +1 -1
- package/dist/types/core/agent/assessment/compose.d.ts +3 -1
- package/dist/types/core/agent/assessment/compose.d.ts.map +1 -1
- package/dist/types/core/agent/assessment/reasons.d.ts.map +1 -1
- package/dist/types/core/agent/assessment/types.d.ts +12 -2
- package/dist/types/core/agent/assessment/types.d.ts.map +1 -1
- package/dist/types/core/agent/assessment/witness.d.ts +44 -4
- package/dist/types/core/agent/assessment/witness.d.ts.map +1 -1
- package/dist/types/core/agent/buildAgentChart.d.ts +9 -0
- package/dist/types/core/agent/buildAgentChart.d.ts.map +1 -1
- package/dist/types/core/agent/evidence/codeRegions.d.ts +131 -0
- package/dist/types/core/agent/evidence/codeRegions.d.ts.map +1 -0
- package/dist/types/core/agent/evidence/gate.d.ts +3 -0
- package/dist/types/core/agent/evidence/gate.d.ts.map +1 -1
- package/dist/types/core/agent/evidence/recovery.d.ts +5 -1
- package/dist/types/core/agent/evidence/recovery.d.ts.map +1 -1
- package/dist/types/core/agent/evidence/types.d.ts +35 -0
- package/dist/types/core/agent/evidence/types.d.ts.map +1 -1
- package/dist/types/core/agent/findings/types.d.ts +3 -2
- package/dist/types/core/agent/findings/types.d.ts.map +1 -1
- package/dist/types/core/agent/scripts/attachment.d.ts +180 -0
- package/dist/types/core/agent/scripts/attachment.d.ts.map +1 -0
- package/dist/types/core/agent/scripts/inert.d.ts +39 -0
- package/dist/types/core/agent/scripts/inert.d.ts.map +1 -0
- package/dist/types/core/agent/scripts/judge.d.ts +37 -0
- package/dist/types/core/agent/scripts/judge.d.ts.map +1 -0
- package/dist/types/core/agent/scripts/label.d.ts +104 -0
- package/dist/types/core/agent/scripts/label.d.ts.map +1 -0
- package/dist/types/core/agent/scripts/match.d.ts +100 -0
- package/dist/types/core/agent/scripts/match.d.ts.map +1 -0
- package/dist/types/core/agent/scripts/recovery.d.ts +55 -0
- package/dist/types/core/agent/scripts/recovery.d.ts.map +1 -0
- package/dist/types/core/agent/scripts/rows.d.ts +144 -0
- package/dist/types/core/agent/scripts/rows.d.ts.map +1 -0
- package/dist/types/core/agent/scripts/types.d.ts +92 -0
- package/dist/types/core/agent/scripts/types.d.ts.map +1 -0
- package/dist/types/core/agent/scripts/wrapper.d.ts +37 -0
- package/dist/types/core/agent/scripts/wrapper.d.ts.map +1 -0
- package/dist/types/core/agent/stages/argumentAsk.d.ts +4 -1
- package/dist/types/core/agent/stages/argumentAsk.d.ts.map +1 -1
- package/dist/types/core/agent/stages/evidenceRecheck.d.ts.map +1 -1
- package/dist/types/core/agent/stages/prepareFinal.d.ts +11 -0
- package/dist/types/core/agent/stages/prepareFinal.d.ts.map +1 -1
- package/dist/types/core/agent/stages/route.d.ts.map +1 -1
- package/dist/types/core/agent/stages/seed.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls.d.ts +14 -0
- package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
- package/dist/types/core/agent/types.d.ts +41 -0
- package/dist/types/core/agent/types.d.ts.map +1 -1
- package/dist/types/core/codeRunnerTool.d.ts +23 -0
- package/dist/types/core/codeRunnerTool.d.ts.map +1 -1
- package/dist/types/core/runCheckpoint.d.ts.map +1 -1
- package/dist/types/events/payloads.d.ts +46 -1
- package/dist/types/events/payloads.d.ts.map +1 -1
- package/dist/types/hosting/answerAccounts.d.ts.map +1 -1
- package/dist/types/hosting/artifactWire.d.ts +3 -2
- package/dist/types/hosting/artifactWire.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/boundedJson.d.ts +24 -0
- package/dist/types/lib/boundedJson.d.ts.map +1 -1
- package/dist/types/lib/scriptRecord.d.ts +140 -0
- package/dist/types/lib/scriptRecord.d.ts.map +1 -0
- package/dist/types/lib/utf8.d.ts +37 -0
- package/dist/types/lib/utf8.d.ts.map +1 -0
- package/dist/types/mcp/toolExtras.d.ts +9 -0
- package/dist/types/mcp/toolExtras.d.ts.map +1 -1
- package/dist/types/redaction/conversation.d.ts.map +1 -1
- package/dist/types/redaction/knownStrings.d.ts.map +1 -1
- package/dist/types/semantics/coverage/answer.d.ts +12 -1
- package/dist/types/semantics/coverage/answer.d.ts.map +1 -1
- package/dist/types/tools/script.d.ts +86 -0
- package/dist/types/tools/script.d.ts.map +1 -0
- package/dist/types/tools/tools.d.ts +30 -0
- package/dist/types/tools/tools.d.ts.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/label — the ONE rule that turns a code call's record into a label,
|
|
3
|
+
* and the label's words.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: pure function over two separate facts (design § 4.3).
|
|
6
|
+
* Role: core/ layer leaf. Asked by the dispatch loop when it files a call's
|
|
7
|
+
* `script` row (`rows.ts` · `scriptRowFor`); every sentence that names
|
|
8
|
+
* an outcome — the attachment's label line, the recovery clause, the
|
|
9
|
+
* answer account — reads the row's label through {@link labelWords}.
|
|
10
|
+
* Emits: N/A.
|
|
11
|
+
*
|
|
12
|
+
* ## Three facts, read in one order
|
|
13
|
+
*
|
|
14
|
+
* The record holds three facts about a code call, written by three mechanisms:
|
|
15
|
+
* EXECUTION evidence (the runner's facts — `codeRunnerTool.ts` ·
|
|
16
|
+
* `CodeRunFacts`, taken right after `tool.execute` returns), call SETTLEMENT
|
|
17
|
+
* (did the call return, throw, or never enter `execute`) and result DELIVERY
|
|
18
|
+
* (the tool's ceiling replaced the payload). A label is read from execution
|
|
19
|
+
* evidence first, then settlement, and NEVER from delivery: a withheld result
|
|
20
|
+
* does not undo a completed execution (it rides the row as `resultWithheld`).
|
|
21
|
+
*
|
|
22
|
+
* | the record says | label |
|
|
23
|
+
* |---|---|
|
|
24
|
+
* | an explicit `exitCode: 0` | `completed` |
|
|
25
|
+
* | an explicit non-zero `exitCode` (a whole number — {@link isExitCode}) | `completed-with-failure` |
|
|
26
|
+
* | `serviceError` and no exit code | `outcome-unknown` |
|
|
27
|
+
* | `ok: true`, no exit code | `reported-success` |
|
|
28
|
+
* | `ok: false`, no exit code, no service error (a stopped process included) | `reported-failure` |
|
|
29
|
+
* | facts that report no outcome (`ok` absent, no exit code) | — no execution evidence: the settlement decides |
|
|
30
|
+
* | no facts, the call returned | `returned` |
|
|
31
|
+
* | no facts, the call threw (a timeout, a cancellation, a staging refusal) | `outcome-unknown` |
|
|
32
|
+
* | the call never entered `execute` (or has not settled) | `submitted` |
|
|
33
|
+
*
|
|
34
|
+
* Only an explicit exit code proves the program reached an exit. `ok` is a
|
|
35
|
+
* VERDICT: it never yields `completed`, and no word here prints an exit number
|
|
36
|
+
* the record does not hold.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* scriptLabelOf({ settlement: 'returned', facts: { exitCode: 0 } }); // { label: 'completed', exitCode: 0 }
|
|
41
|
+
* scriptLabelOf({ settlement: 'returned', facts: { ok: false, serviceError: true } }); // { label: 'outcome-unknown', serviceError: true }
|
|
42
|
+
* scriptLabelOf({ settlement: 'threw' }); // { label: 'outcome-unknown' }
|
|
43
|
+
* labelWords('completed-with-failure', 7); // 'completed with failure, exit 7'
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
import type { ScriptLabel } from './types.js';
|
|
47
|
+
/** How a call settled, as the dispatch loop knows it. */
|
|
48
|
+
export type CallSettlement =
|
|
49
|
+
/** Never entered `execute`: not dispatched, refused before it, or still open. */
|
|
50
|
+
'not-entered'
|
|
51
|
+
/** `execute` returned a result. */
|
|
52
|
+
| 'returned'
|
|
53
|
+
/** `execute` was entered and threw (a timeout, a cancellation, any error). */
|
|
54
|
+
| 'threw';
|
|
55
|
+
/** The runner facts a label reads — `CodeRunFacts`' outcome half. */
|
|
56
|
+
export interface RunnerOutcome {
|
|
57
|
+
readonly ok?: boolean;
|
|
58
|
+
readonly exitCode?: number;
|
|
59
|
+
readonly serviceError?: true;
|
|
60
|
+
readonly terminatedBy?: string;
|
|
61
|
+
}
|
|
62
|
+
/** A label, with the facts it may print. */
|
|
63
|
+
export interface ScriptOutcome {
|
|
64
|
+
readonly label: ScriptLabel;
|
|
65
|
+
/** Exactly the runner's, only when it supplied one. */
|
|
66
|
+
readonly exitCode?: number;
|
|
67
|
+
/** The failure verdict was the service's, with no exit code. */
|
|
68
|
+
readonly serviceError?: true;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Whether `value` is an exit code: a whole number, as a process reports one
|
|
72
|
+
* (a negative one included — a signal, on some runtimes). THE rule for every
|
|
73
|
+
* writer and reader of a script's exit code — the label below, and the
|
|
74
|
+
* readers of a saved record (`rows.ts` · `scriptRowIsWellFormed`,
|
|
75
|
+
* `attachment.ts` · `recordedScripts`, `match.ts` · `recordedBlocks`), so the
|
|
76
|
+
* writer never files a row the checkpoint door refuses. A runner that reports
|
|
77
|
+
* anything else (`1.5`, `NaN`) reported no exit code.
|
|
78
|
+
*/
|
|
79
|
+
export declare const isExitCode: (value: unknown) => value is number;
|
|
80
|
+
/**
|
|
81
|
+
* Whether a recorded label and exit code agree, as {@link scriptLabelOf}
|
|
82
|
+
* writes them: an exit code rides exactly the two labels one proves — `0` on
|
|
83
|
+
* `completed`, any other on `completed-with-failure` — and no other label.
|
|
84
|
+
* A record where they disagree holds a value no writer of this library files.
|
|
85
|
+
*/
|
|
86
|
+
export declare function exitCodeFits(label: unknown, exitCode: unknown): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* The label of one call — execution evidence first, then settlement. `facts`
|
|
89
|
+
* is ABSENT when the tool filed none (a declared tool that is not
|
|
90
|
+
* `codeRunnerTool`, or a call that never reached its runner).
|
|
91
|
+
*/
|
|
92
|
+
export declare function scriptLabelOf(input: {
|
|
93
|
+
readonly settlement: CallSettlement;
|
|
94
|
+
readonly facts?: RunnerOutcome;
|
|
95
|
+
}): ScriptOutcome;
|
|
96
|
+
/**
|
|
97
|
+
* The label's own words — the one phrase every library sentence about a call's
|
|
98
|
+
* outcome uses (design § 4.3). `exitCode` is printed only for
|
|
99
|
+
* `completed-with-failure`, and only the number the record holds.
|
|
100
|
+
*/
|
|
101
|
+
export declare function labelWords(label: ScriptLabel, exitCode?: number): string;
|
|
102
|
+
/** Every label, in the design's order — for a reader that validates one. */
|
|
103
|
+
export declare const SCRIPT_LABELS: readonly ScriptLabel[];
|
|
104
|
+
//# sourceMappingURL=label.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/scripts/label.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,yDAAyD;AACzD,MAAM,MAAM,cAAc;AACxB,iFAAiF;AAC/E,aAAa;AACf,mCAAmC;GACjC,UAAU;AACZ,8EAA8E;GAC5E,OAAO,CAAC;AAEZ,qEAAqE;AACrE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC;IAC7B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,4CAA4C;AAC5C,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAC;IAC5B,uDAAuD;IACvD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,gEAAgE;IAChE,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC;CAC9B;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,UAAU,UAAW,OAAO,oBAA6C,CAAC;AAEvF;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAIvE;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE;IACnC,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC;CAChC,GAAG,aAAa,CAuBhB;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAmBxE;AAED,4EAA4E;AAC5E,eAAO,MAAM,aAAa,EAAE,SAAS,WAAW,EAQ9C,CAAC"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/match — is a fenced block the program ONE call of this turn
|
|
3
|
+
* submitted? Identity against the record, never evidence for a value.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: pure function over the answer and this turn's rows.
|
|
6
|
+
* Role: core/ layer. Asked inside the ONE judge closure the Route decider
|
|
7
|
+
* builds (`stages/route.ts` · `judgeEvidence`, through `judge.ts`),
|
|
8
|
+
* before the names-and-numbers extractor reads the text — so the
|
|
9
|
+
* draft and the delivered candidate are read alike. Only under
|
|
10
|
+
* `.namesAndNumbersFromEvidence({ code: 'match' })`.
|
|
11
|
+
* Emits: N/A.
|
|
12
|
+
*
|
|
13
|
+
* ## The match rule: exact, after removing only the wrapper (design § 5.2)
|
|
14
|
+
*
|
|
15
|
+
* A block matches a call only when its content (`../evidence/codeRegions.ts`)
|
|
16
|
+
* equals the program the call SUBMITTED to the tool, byte for byte. Nothing is
|
|
17
|
+
* transformed: no trailing-space strip, no line-ending rewrite, no Unicode
|
|
18
|
+
* normalization, no shape, no edit distance — each can change a literal and so
|
|
19
|
+
* the program (`print(len("""A \nB"""))` prints 5, its copy without the two
|
|
20
|
+
* spaces 3; `"é"` written with a combining mark is one more character than its
|
|
21
|
+
* NFC form). The strings are compared as they hold the text (UTF-16 code
|
|
22
|
+
* units): for well-formed text that is UTF-8 byte equality, and for a lone
|
|
23
|
+
* surrogate it is stricter, the safe direction.
|
|
24
|
+
*
|
|
25
|
+
* - Against the rows of the CURRENT TURN only; earlier turns are counted
|
|
26
|
+
* (`earlierTurnRows`), never compared, and a miss says "no submission of
|
|
27
|
+
* this turn", never "no submission".
|
|
28
|
+
* - A block over `MAX_SCRIPT_BYTES` is `over-size`: no row keeps a program
|
|
29
|
+
* that long, so it is never compared.
|
|
30
|
+
* - Two calls that submitted byte-identical programs: the block names the
|
|
31
|
+
* LATEST, counts the rest (`alsoMatches`) and carries its label.
|
|
32
|
+
* - No nearest submission is ever named: a near match is a different program.
|
|
33
|
+
*
|
|
34
|
+
* WHAT A MATCH YIELDS. The block is script content: it is cut out of the text
|
|
35
|
+
* the extractor reads, so it yields no value candidates — and it grounds
|
|
36
|
+
* nothing: the evidence corpus is untouched, so a value in the prose that also
|
|
37
|
+
* sits in the script still needs a result. A MISS stays in the text and is
|
|
38
|
+
* checked as prose, exactly as today.
|
|
39
|
+
*
|
|
40
|
+
* COST. One linear scan of the answer (`codeRegionsOf`); each of at most
|
|
41
|
+
* `MAX_CODE_REGIONS` blocks is looked up once among at most `MAX_SCRIPT_ROWS`
|
|
42
|
+
* programs of at most `MAX_SCRIPT_BYTES` — within the 512 comparisons per
|
|
43
|
+
* judged answer of design § 4.4. Earlier turns add nothing.
|
|
44
|
+
*/
|
|
45
|
+
import { type TurnScripts } from './rows.js';
|
|
46
|
+
import type { ScriptBlockVerdict, ScriptsVerdict, UnmatchedReason } from './types.js';
|
|
47
|
+
/** One answer, read for its scripts. */
|
|
48
|
+
export interface ShownScripts {
|
|
49
|
+
/** The answer with every MATCHED block cut out — what the extractor reads. */
|
|
50
|
+
readonly prose: string;
|
|
51
|
+
/** The answer with EVERY block cut out — "the prose", for `unsupported[].region`. */
|
|
52
|
+
readonly outsideCode: string;
|
|
53
|
+
readonly verdict: ScriptsVerdict;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Read `answer`'s fenced blocks against this turn's submissions. Pure; the
|
|
57
|
+
* rows are `rows.ts` · `scriptRowsOfTurn`'s reading (last row per call).
|
|
58
|
+
*/
|
|
59
|
+
export declare function readShownScripts(answer: string, turn: TurnScripts, scriptsDropped?: number): ShownScripts;
|
|
60
|
+
/**
|
|
61
|
+
* A verdict as detached plain data — field by field, never a reference into
|
|
62
|
+
* state (a value read back through a TypedScope is a live view, and an event
|
|
63
|
+
* payload must be plain data).
|
|
64
|
+
*/
|
|
65
|
+
export declare function copyScriptsVerdict(verdict: ScriptsVerdict): ScriptsVerdict;
|
|
66
|
+
/** Every reason a block can be unmatched for. */
|
|
67
|
+
export declare const UNMATCHED_REASONS: readonly UnmatchedReason[];
|
|
68
|
+
/**
|
|
69
|
+
* One block verdict's fields, checked as {@link readShownScripts} writes them
|
|
70
|
+
* — a fresh copy, or `undefined` when any field is one no writer of this
|
|
71
|
+
* library files: a position or a dispatch that is not a whole number from 1,
|
|
72
|
+
* a label outside the vocabulary, an exit code its label does not carry
|
|
73
|
+
* (`label.ts` · `exitCodeFits`), an unmatched block that names a call, a
|
|
74
|
+
* matched one without its call. Fields beside these (a witness row's `kind`,
|
|
75
|
+
* `turn`, `iteration`) are not read.
|
|
76
|
+
*/
|
|
77
|
+
export declare function blockVerdictOf(value: unknown): ScriptBlockVerdict | undefined;
|
|
78
|
+
/** One block verdict read back, at its position in the record's `blocks`. */
|
|
79
|
+
export interface RecordedBlock {
|
|
80
|
+
readonly index: number;
|
|
81
|
+
readonly verdict: ScriptBlockVerdict;
|
|
82
|
+
}
|
|
83
|
+
/** A saved `evidence_checked.scripts`, read back. */
|
|
84
|
+
export interface RecordedBlocks {
|
|
85
|
+
/** The verdicts a writer of this library files, at their record position. */
|
|
86
|
+
readonly blocks: readonly RecordedBlock[];
|
|
87
|
+
/**
|
|
88
|
+
* What no writer files, counted once each: a verdict that does not read
|
|
89
|
+
* back, every verdict past `MAX_CODE_REGIONS` (the writer reads no more
|
|
90
|
+
* blocks), or a `scripts` value that is not `{ blocks: [...] }`.
|
|
91
|
+
*/
|
|
92
|
+
readonly unread: number;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* A saved `evidence_checked.scripts` — THE reader of the shape for a reader
|
|
96
|
+
* of a record. `undefined` when the event carries no scripts arm. Bounded by
|
|
97
|
+
* the writer's cap: no reader iterates more verdicts than a writer files.
|
|
98
|
+
*/
|
|
99
|
+
export declare function recordedBlocks(value: unknown): RecordedBlocks | undefined;
|
|
100
|
+
//# sourceMappingURL=match.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/scripts/match.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAKH,OAAO,EAAoB,KAAK,WAAW,EAAE,MAAM,WAAW,CAAC;AAC/D,OAAO,KAAK,EACV,kBAAkB,EAGlB,cAAc,EACd,eAAe,EAChB,MAAM,YAAY,CAAC;AAEpB,wCAAwC;AACxC,MAAM,WAAW,YAAY;IAC3B,8EAA8E;IAC9E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,qFAAqF;IACrF,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;CAClC;AAqBD;;;GAGG;AACH,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,WAAW,EACjB,cAAc,CAAC,EAAE,MAAM,GACtB,YAAY,CA6Cd;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,cAAc,CAmB1E;AAUD,iDAAiD;AACjD,eAAO,MAAM,iBAAiB,EAAE,SAAS,eAAe,EAItD,CAAC;AAOH;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,kBAAkB,GAAG,SAAS,CA8B7E;AAED,6EAA6E;AAC7E,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,kBAAkB,CAAC;CACtC;AAED,qDAAqD;AACrD,MAAM,WAAW,cAAc;IAC7B,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAE,SAAS,aAAa,EAAE,CAAC;IAC1C;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,GAAG,SAAS,CAYzE"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/recovery — the one clause the evidence revision request gains under
|
|
3
|
+
* `code: 'match'`: keep the script, fix the values.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: Lens — a library sentence about a FINISHED call, composed from the
|
|
6
|
+
* match's verdict, in the past tense, naming no tool as where to go
|
|
7
|
+
* next (`core/agent/README.md`, the correction law). Request-only:
|
|
8
|
+
* it rides the internal recovery instruction (`../evidence/recovery.ts`
|
|
9
|
+
* · `buildEvidenceRecovery`), never history.
|
|
10
|
+
* Role: core/ layer. Composed by the Route decider, which holds this turn's
|
|
11
|
+
* rows, and carried to the recheck stage on `evidenceUnsupported`.
|
|
12
|
+
* Emits: N/A.
|
|
13
|
+
*
|
|
14
|
+
* Two clauses, chosen by what the verdict holds (design § 7):
|
|
15
|
+
*
|
|
16
|
+
* - a block that matched no submission, and a flagged value that sat only in
|
|
17
|
+
* such a block — its contents were checked as prose: keep a script, show it
|
|
18
|
+
* exactly as submitted, or say the code shown is not the one submitted, and
|
|
19
|
+
* fix the values in the prose;
|
|
20
|
+
* - a block that matched a call, with values flagged in the prose — the
|
|
21
|
+
* script was not checked: keep it; the listed values were in the prose.
|
|
22
|
+
*
|
|
23
|
+
* The parenthesis carries the call's ACTUAL label in its words
|
|
24
|
+
* (`label.ts` · `labelWords`) — never a fixed "executed", never an exit
|
|
25
|
+
* number the record does not hold.
|
|
26
|
+
*
|
|
27
|
+
* WHAT IT CANNOT DO, stated: deleting an unmatched block removes its
|
|
28
|
+
* candidates and the `script-unmatched` reason, so a draft without the script
|
|
29
|
+
* can pass the check. No sentence makes a model keep a script; mandatory
|
|
30
|
+
* display comes from `.scriptTravelsWithTheAnswer()`, which needs no
|
|
31
|
+
* cooperation from the model.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* scriptRecoveryClause({ blocks: [{ block: 1, label: 'completed-with-failure', exitCode: 7,
|
|
36
|
+
* toolCallId: 'c1', tool: 'run_code' }], earlierTurnRows: 0, regionsDropped: 0 },
|
|
37
|
+
* [{ value: '1200', shape: 'number', region: 'prose' }], ['run_code']);
|
|
38
|
+
* // 'The script shown is the one submitted to `run_code` on call c1 (completed with failure,
|
|
39
|
+
* // exit 7) and was not checked. Keep it. The listed values were in the prose around it.'
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
import type { ScriptsVerdict } from './types.js';
|
|
43
|
+
/** A flagged value as the clause reads it — its region under `code: 'match'`. */
|
|
44
|
+
interface FlaggedValue {
|
|
45
|
+
readonly region?: 'prose' | 'code';
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* The clause(s) for one rejected draft — `''` when the verdict calls for
|
|
49
|
+
* none (no fenced block, or no flagged value the blocks bear on).
|
|
50
|
+
* `toolsThisTurn` names the code-running tools this turn's calls submitted
|
|
51
|
+
* to, in first-call order.
|
|
52
|
+
*/
|
|
53
|
+
export declare function scriptRecoveryClause(scripts: ScriptsVerdict, unsupported: readonly FlaggedValue[], toolsThisTurn: readonly string[]): string;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=recovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recovery.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/scripts/recovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjD,iFAAiF;AACjF,UAAU,YAAY;IACpB,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACpC;AAUD;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,SAAS,YAAY,EAAE,EACpC,aAAa,EAAE,SAAS,MAAM,EAAE,GAC/B,MAAM,CA0BR"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/rows — the `script` row: built from one call, filed through ONE
|
|
3
|
+
* writer, read back per turn, and bounded.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: Map + one writer (the `findings/ledger.ts` · `recordFindings`
|
|
6
|
+
* twin for this kind): `scriptRowFor` builds, `recordScriptRow` is
|
|
7
|
+
* the only thing that writes a `script` row, `scriptRowsOfTurn` is
|
|
8
|
+
* the one reader the match and the attachment share.
|
|
9
|
+
* Role: core/ layer leaf. Called by the dispatch loop (`stages/toolCalls.ts`)
|
|
10
|
+
* at each place a call of a declared code-running tool pauses or
|
|
11
|
+
* settles; read by the Route decider's judge and the final branch.
|
|
12
|
+
* Emits: N/A — the row is state; the runner's facts already rode
|
|
13
|
+
* `agentfootprint.tools.code_run`, which never carries the code.
|
|
14
|
+
*
|
|
15
|
+
* ## One unit, and the bounds (design § 4.4)
|
|
16
|
+
*
|
|
17
|
+
* UTF-8 payload bytes of the program, measured at record time
|
|
18
|
+
* (`lib/utf8.ts` · `utf8Length`) — never characters: 32,768 characters of a
|
|
19
|
+
* 3-byte character are 98,304 bytes.
|
|
20
|
+
*
|
|
21
|
+
* - **Per script.** A program over {@link MAX_SCRIPT_BYTES} keeps a row with
|
|
22
|
+
* `bytes`, `lines` and the outcome, and no `text`: it can be neither matched
|
|
23
|
+
* nor attached.
|
|
24
|
+
* - **Per turn.** {@link MAX_SCRIPT_ROWS} calls keep a row; a further call of
|
|
25
|
+
* the turn files none and is counted in `AgentState.scriptsDropped`.
|
|
26
|
+
* - **Eligible text.** A row's `text` lives for its own turn: the seed stage's
|
|
27
|
+
* restore drops it from every earlier turn's row (`withoutEarlierScriptText`),
|
|
28
|
+
* so the text the ledger holds is at most 16 × 32,768 bytes = 512 KiB before
|
|
29
|
+
* serialization, whatever the conversation's length. That bounds eligible
|
|
30
|
+
* text only — prior turns' metadata, history and the answers that carried an
|
|
31
|
+
* attached script are outside it.
|
|
32
|
+
*
|
|
33
|
+
* ## Append only, last wins
|
|
34
|
+
*
|
|
35
|
+
* A call PAUSED before it settles (a check-in, a consent, an ask, a tool that
|
|
36
|
+
* asked a person) files a `submitted` row at the pause, WITHOUT its text: the
|
|
37
|
+
* settled row filed when the call resumes is the one that carries it, so a
|
|
38
|
+
* program is never held twice. A reader takes the LAST row per call of the
|
|
39
|
+
* turn (the ledger's own law). A row that never settles stays `submitted`.
|
|
40
|
+
*/
|
|
41
|
+
import type { ToolScript } from '../../../tools/script.js';
|
|
42
|
+
import type { FindingsLedger } from '../findings/types.js';
|
|
43
|
+
import { type CallSettlement, type RunnerOutcome } from './label.js';
|
|
44
|
+
import type { ScriptRow } from './types.js';
|
|
45
|
+
/** A program longer than this (UTF-8 bytes) keeps a row with no text. Design § 4.4. */
|
|
46
|
+
export declare const MAX_SCRIPT_BYTES = 32768;
|
|
47
|
+
/** Calls per turn that keep a row; the rest are counted. Design § 4.4. */
|
|
48
|
+
export declare const MAX_SCRIPT_ROWS = 16;
|
|
49
|
+
/** Lines of a program: LF-separated, `0` for an empty one. */
|
|
50
|
+
export declare function linesOf(program: string): number;
|
|
51
|
+
/** One call of a declared code-running tool, as the dispatch loop knows it. */
|
|
52
|
+
export interface ScriptCall {
|
|
53
|
+
readonly script: ToolScript;
|
|
54
|
+
/** The name the model called. */
|
|
55
|
+
readonly tool: string;
|
|
56
|
+
readonly toolCallId: string;
|
|
57
|
+
readonly iteration: number;
|
|
58
|
+
/** `AgentState.turnNumber`. */
|
|
59
|
+
readonly turn: number;
|
|
60
|
+
/**
|
|
61
|
+
* The declared argument's VALUE as the model proposed it — read once, as
|
|
62
|
+
* the call arrived, before any before-tool rule ran (`programIn`). A string
|
|
63
|
+
* is immutable: no code that runs later can change what was captured.
|
|
64
|
+
*/
|
|
65
|
+
readonly proposed: unknown;
|
|
66
|
+
/**
|
|
67
|
+
* The declared argument's value as handed to `execute` — read once, just
|
|
68
|
+
* before the tool ran, after every rule. Absent: the call never got there,
|
|
69
|
+
* and the proposal stands.
|
|
70
|
+
*/
|
|
71
|
+
readonly submitted?: unknown;
|
|
72
|
+
readonly settlement: CallSettlement;
|
|
73
|
+
/** The runner's facts, when the tool filed them. */
|
|
74
|
+
readonly facts?: RunnerOutcome;
|
|
75
|
+
/** The tool's own ceiling replaced the delivered result. */
|
|
76
|
+
readonly withheld?: boolean;
|
|
77
|
+
/** A pause: the row is filed without its text (the settled row carries it). */
|
|
78
|
+
readonly paused?: boolean;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The declared argument's value in `args` — the one read a call's program is
|
|
82
|
+
* captured with. Read it at the boundary it names (as the call arrives; just
|
|
83
|
+
* before `execute`) and keep the value: never the arguments object, which app
|
|
84
|
+
* code may edit after it was handed over.
|
|
85
|
+
*/
|
|
86
|
+
export declare function programIn(script: ToolScript, args: Readonly<Record<string, unknown>> | undefined): unknown;
|
|
87
|
+
/** A row before the writer gives it its dispatch identity. */
|
|
88
|
+
export type ScriptRowDraft = Omit<ScriptRow, 'dispatch'>;
|
|
89
|
+
/**
|
|
90
|
+
* The row for one call, or `undefined` when the call carried no program — the
|
|
91
|
+
* declared argument is not a string (an argument check refuses such a call;
|
|
92
|
+
* there is nothing to record as "the program submitted").
|
|
93
|
+
*/
|
|
94
|
+
export declare function scriptRowFor(call: ScriptCall): ScriptRowDraft | undefined;
|
|
95
|
+
/** The scope surface the writer needs. Structurally a `TypedScope<AgentState>`. */
|
|
96
|
+
export interface ScriptScope {
|
|
97
|
+
findingsLedger?: FindingsLedger;
|
|
98
|
+
scriptsDropped?: number;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* THE ONE WRITER of a `script` row, and the one place a call gets its
|
|
102
|
+
* DISPATCH identity: the 1-based order of the actual dispatch within its turn.
|
|
103
|
+
* A call is a dispatch, never a provider id: a later call that reuses an id is
|
|
104
|
+
* a new dispatch. `options.dispatch` names a dispatch that already has a row
|
|
105
|
+
* (a paused call, settling): its row joins that dispatch.
|
|
106
|
+
*
|
|
107
|
+
* Appended, unless the turn already holds {@link MAX_SCRIPT_ROWS} other
|
|
108
|
+
* dispatches — then the call files nothing and `scriptsDropped` counts it
|
|
109
|
+
* (value-conditional: absent until a call is dropped). A dispatch that already
|
|
110
|
+
* has a row is never dropped, and a PAUSE is never counted (`paused`): its call
|
|
111
|
+
* is counted once, when it settles. Returns the dispatch the row was filed
|
|
112
|
+
* under, `undefined` when it was dropped. Synchronous: one read, one write, no
|
|
113
|
+
* await between.
|
|
114
|
+
*/
|
|
115
|
+
export declare function recordScriptRow(scope: ScriptScope, draft: ScriptRowDraft, options?: {
|
|
116
|
+
readonly paused?: boolean;
|
|
117
|
+
readonly dispatch?: number;
|
|
118
|
+
}): number | undefined;
|
|
119
|
+
/** This turn's calls — the LAST row of each dispatch, in the order those rows were filed. */
|
|
120
|
+
export interface TurnScripts {
|
|
121
|
+
readonly current: readonly ScriptRow[];
|
|
122
|
+
/** Calls of EARLIER turns on the ledger: counted, never compared. */
|
|
123
|
+
readonly earlier: number;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* The one reader of a turn's script rows: the last row per DISPATCH wins, and
|
|
127
|
+
* a dispatch sits where its last row was filed — execution order, so a call
|
|
128
|
+
* that settles after a later one ran is read after it. Earlier turns counted.
|
|
129
|
+
*/
|
|
130
|
+
export declare function scriptRowsOfTurn(ledger: readonly unknown[] | undefined, turn: number): TurnScripts;
|
|
131
|
+
/**
|
|
132
|
+
* The restore door's half of the bound (seed): every `script` row of a turn
|
|
133
|
+
* BEFORE `turn` keeps its facts — ids, counts, outcome — and loses its `text`.
|
|
134
|
+
* The same reference when there is nothing to drop, so a ledger without
|
|
135
|
+
* script text is restored byte for byte.
|
|
136
|
+
*/
|
|
137
|
+
export declare function withoutEarlierScriptText<T>(ledger: readonly T[], turn: number): readonly T[];
|
|
138
|
+
/**
|
|
139
|
+
* Whether a value read from a stored checkpoint is a `script` row this library
|
|
140
|
+
* could have written — the checkpoint door's arm (`core/runCheckpoint.ts`).
|
|
141
|
+
* An older runtime refuses a checkpoint carrying one.
|
|
142
|
+
*/
|
|
143
|
+
export declare function scriptRowIsWellFormed(r: Readonly<Record<string, unknown>>): boolean;
|
|
144
|
+
//# sourceMappingURL=rows.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rows.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/scripts/rows.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/types — the row a call of a code-running tool files, and the
|
|
3
|
+
* attachment's options. The vocabulary the event payloads share (the label,
|
|
4
|
+
* the block verdict, the attached script) lives in `lib/scriptRecord.ts` and
|
|
5
|
+
* is re-exported here.
|
|
6
|
+
*
|
|
7
|
+
* Pattern: plain row and verdict types, no logic (`label.ts` decides a label,
|
|
8
|
+
* `rows.ts` files a row, `match.ts` judges a block, `attachment.ts`
|
|
9
|
+
* composes what travels).
|
|
10
|
+
* Role: core/ layer leaf of the script record (design:
|
|
11
|
+
* docs/design/2026-10-script-artifact.md).
|
|
12
|
+
* Emits: N/A.
|
|
13
|
+
*
|
|
14
|
+
* FOUR FACTS, KEPT APART. F1 "this is the script submitted" and F2 "this
|
|
15
|
+
* script ran" are facts about a CALL, on one `script` row per call. F3 "a tool
|
|
16
|
+
* returned this value" is the evidence gate's verdict, from `role: 'tool'`
|
|
17
|
+
* results only — nothing here ever enters the evidence or exempt corpus. F4
|
|
18
|
+
* "this claim holds" has no row. No sentence joins them.
|
|
19
|
+
*/
|
|
20
|
+
import type { ScriptLabel } from '../../../lib/scriptRecord.js';
|
|
21
|
+
export type { ScriptBlockVerdict, ScriptLabel, ScriptsVerdict, ShownScript, TurnEndScripts, UnmatchedReason, } from '../../../lib/scriptRecord.js';
|
|
22
|
+
/**
|
|
23
|
+
* One call of a declared code-running tool (`Tool.script`), on the findings
|
|
24
|
+
* ledger — F1 (the program submitted) and F2 (what its execution record
|
|
25
|
+
* proves), and nothing about any value.
|
|
26
|
+
*
|
|
27
|
+
* Filed by the dispatch loop (`stages/toolCalls.ts`) while
|
|
28
|
+
* `.namesAndNumbersFromEvidence({ code: 'match' })` or
|
|
29
|
+
* `.scriptTravelsWithTheAnswer()` is on, through ONE writer (`rows.ts` ·
|
|
30
|
+
* `recordScriptRow`): the call's row is KEPT CURRENT — its outcome is written
|
|
31
|
+
* when the call settles, and a row that never settles stays `submitted`. At
|
|
32
|
+
* the next turn boundary (seed) the row keeps its facts and loses its `text`.
|
|
33
|
+
*/
|
|
34
|
+
export interface ScriptRow {
|
|
35
|
+
readonly kind: 'script';
|
|
36
|
+
/** The provider's id for the call — display only; two calls may share one. */
|
|
37
|
+
readonly toolCallId: string;
|
|
38
|
+
/**
|
|
39
|
+
* The library's identity for the call: the 1-based order of the actual
|
|
40
|
+
* dispatch within its turn (`rows.ts` · `recordScriptRow`). A pause and its
|
|
41
|
+
* settlement share it; a later call that reuses the provider id is a new
|
|
42
|
+
* dispatch. Rows are counted, read and matched by it.
|
|
43
|
+
*/
|
|
44
|
+
readonly dispatch: number;
|
|
45
|
+
/** The name the model called. */
|
|
46
|
+
readonly tool: string;
|
|
47
|
+
/** The declared argument that carried the program. */
|
|
48
|
+
readonly argument: string;
|
|
49
|
+
/** The declared language, when the tool declared one. */
|
|
50
|
+
readonly language?: string;
|
|
51
|
+
/** UTF-8 bytes of the program submitted to the tool. */
|
|
52
|
+
readonly bytes: number;
|
|
53
|
+
/** Lines of that program (LF-separated; `0` for an empty program). */
|
|
54
|
+
readonly lines: number;
|
|
55
|
+
/**
|
|
56
|
+
* The program submitted to the tool, byte for byte. ABSENT over
|
|
57
|
+
* `MAX_SCRIPT_BYTES`, and after the row's turn ended.
|
|
58
|
+
*/
|
|
59
|
+
readonly text?: string;
|
|
60
|
+
readonly outcome: ScriptLabel;
|
|
61
|
+
/** Exactly the runner's exit code, only when it supplied one. */
|
|
62
|
+
readonly exitCode?: number;
|
|
63
|
+
/** The runner's failure verdict was the service's, with no exit code. */
|
|
64
|
+
readonly serviceError?: true;
|
|
65
|
+
/** The tool's own `resultCeiling` replaced the delivered result. */
|
|
66
|
+
readonly resultWithheld?: 'over-ceiling';
|
|
67
|
+
/** A before-tool rule changed the program before dispatch; the earlier text is on no row. */
|
|
68
|
+
readonly rewritten?: true;
|
|
69
|
+
/** `AgentState.turnNumber` when the call was made. */
|
|
70
|
+
readonly turn: number;
|
|
71
|
+
readonly iteration: number;
|
|
72
|
+
}
|
|
73
|
+
/** `.scriptTravelsWithTheAnswer()` options. */
|
|
74
|
+
export interface ScriptTravelOptions {
|
|
75
|
+
/**
|
|
76
|
+
* `'last'` (default) — the last call of the turn that reached the tool;
|
|
77
|
+
* `'all'` — every call of the turn that reached it, at most
|
|
78
|
+
* `MAX_ATTACHED_SCRIPTS`, the rest counted as `omitted`.
|
|
79
|
+
*/
|
|
80
|
+
readonly which?: 'last' | 'all';
|
|
81
|
+
/**
|
|
82
|
+
* UTF-8 bytes of each program shown (default 4,000). A longer program is
|
|
83
|
+
* cut at a code-point boundary and says it is incomplete.
|
|
84
|
+
*/
|
|
85
|
+
readonly maxBytes?: number;
|
|
86
|
+
}
|
|
87
|
+
/** The resolved arm the chart carries. @internal */
|
|
88
|
+
export interface ResolvedScriptTravel {
|
|
89
|
+
readonly which: 'last' | 'all';
|
|
90
|
+
readonly maxBytes: number;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/scripts/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAGhE,YAAY,EACV,kBAAkB,EAClB,WAAW,EACX,cAAc,EACd,WAAW,EACX,cAAc,EACd,eAAe,GAChB,MAAM,8BAA8B,CAAC;AAEtC;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,8EAA8E;IAC9E,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B;;;;;OAKG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,iCAAiC;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,sDAAsD;IACtD,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,yDAAyD;IACzD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,wDAAwD;IACxD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,sEAAsE;IACtE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,iEAAiE;IACjE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,yEAAyE;IACzE,QAAQ,CAAC,YAAY,CAAC,EAAE,IAAI,CAAC;IAC7B,oEAAoE;IACpE,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc,CAAC;IACzC,6FAA6F;IAC7F,QAAQ,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC;IAC1B,sDAAsD;IACtD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,+CAA+C;AAC/C,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC;IAChC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,oDAAoD;AACpD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/wrapper — the Markdown wrapper the library puts around a program,
|
|
3
|
+
* with both of its line terminators pinned.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: pure leaf. The renderer half of the wrapper law; the reader half is
|
|
6
|
+
* `../evidence/codeRegions.ts`, and the two agree byte for byte
|
|
7
|
+
* (`test/core/agent/evidence/script-wrapper.test.ts`).
|
|
8
|
+
* Role: core/ layer leaf, asked by the attachment (`attachment.ts`).
|
|
9
|
+
* Emits: N/A.
|
|
10
|
+
*
|
|
11
|
+
* THE LAW (design § 4.2, § 5.2). The fence is `max(3, longestRun + 1)`
|
|
12
|
+
* backticks, where `longestRun` is the longest run of backticks inside the
|
|
13
|
+
* program (the CommonMark closing rule), so a program that holds ```` ``` ````
|
|
14
|
+
* cannot close the library's block early. The renderer writes the opening
|
|
15
|
+
* fence line, ONE LF, the program's bytes unchanged, ONE LF, then the closing
|
|
16
|
+
* fence line. The two LFs are the wrapper's; what sits between them is the
|
|
17
|
+
* program exactly — so a program ending in a line break shows an empty line
|
|
18
|
+
* before the closing fence, and a program ending in a lone CR, in LF or in
|
|
19
|
+
* CRLF reads back unchanged.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* ```ts
|
|
23
|
+
* wrapProgram('print(1)', 'python'); // '```python\nprint(1)\n```'
|
|
24
|
+
* fenceFor('s = "```"'); // '````'
|
|
25
|
+
* codeRegionsOf(wrapProgram(p)).regions[0].content === p; // for every p
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
/** The fence for `program`: `max(3, longestRun + 1)` backticks. */
|
|
29
|
+
export declare function fenceFor(program: string): string;
|
|
30
|
+
/**
|
|
31
|
+
* The program inside the library's fence: opening line (fence + `language` as
|
|
32
|
+
* the info string), LF, the program unchanged, LF, closing fence. `language`
|
|
33
|
+
* is a declared token (`tools/script.ts` refuses a backtick or line break in
|
|
34
|
+
* it), so the info string cannot end the opening line early.
|
|
35
|
+
*/
|
|
36
|
+
export declare function wrapProgram(program: string, language?: string): string;
|
|
37
|
+
//# sourceMappingURL=wrapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapper.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/scripts/wrapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAiBH,mEAAmE;AACnE,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAGtE"}
|
|
@@ -39,13 +39,16 @@
|
|
|
39
39
|
* again, and the call's own step pauses in that batch, which asked nothing.
|
|
40
40
|
*/
|
|
41
41
|
import { type TypedScope } from 'footprintjs';
|
|
42
|
-
import type
|
|
42
|
+
import { type ArgumentResolution, type ToolOf } from '../arguments/resolve.js';
|
|
43
43
|
import type { AgentState } from '../types.js';
|
|
44
44
|
import type { ZoneName } from '../../../time/zone.js';
|
|
45
45
|
import type { TimeAskMessages } from '../../../time/ask.js';
|
|
46
46
|
import type { TimePolicy } from '../../../time/resolve.js';
|
|
47
47
|
/** What the dispatch stage hands the ask — closures, never scope. */
|
|
48
48
|
export interface ArgumentAskDeps {
|
|
49
|
+
/** Already refused calls do not acquire new obligations. */
|
|
50
|
+
readonly excludedCallIds?: readonly string[];
|
|
51
|
+
readonly argumentSources?: true;
|
|
49
52
|
/** The implementation that will answer a name — the shared dispatch resolver's. */
|
|
50
53
|
readonly toolOf: ToolOf;
|
|
51
54
|
/** The run id a stamped request id carries; absent → the turn's start time. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"argumentAsk.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/argumentAsk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAoC,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"argumentAsk.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/argumentAsk.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAoC,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAmBhF,OAAO,EAIL,KAAK,kBAAkB,EAEvB,KAAK,MAAM,EACZ,MAAM,yBAAyB,CAAC;AAgBjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAI5D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAqF3D,qEAAqE;AACrE,MAAM,WAAW,eAAe;IAC9B,4DAA4D;IAC5D,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC7C,QAAQ,CAAC,eAAe,CAAC,EAAE,IAAI,CAAC;IAChC,mFAAmF;IACnF,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+EAA+E;IAC/E,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,MAAM,GAAG,SAAS,CAAC;IAC1C,8EAA8E;IAC9E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,OAAO,CAAC;IACrC;;;;;;;;OAQG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE;QACd,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC;QAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE;YAChB,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;YAC5B,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;SAC9C,CAAC;KACH,CAAC;CACH;AAED,yCAAyC;AACzC,MAAM,WAAW,UAAU;IACzB,wGAAwG;IACxG,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC;IAC9D,6FAA6F;IAC7F,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC5B;AAkGD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,EAC7B,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,kBAAkB,CAAC,EACpD,IAAI,EAAE,eAAe,GACpB,UAAU,CAmOZ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evidenceRecheck.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/evidenceRecheck.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"evidenceRecheck.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/evidenceRecheck.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAM9C,OAAO,KAAK,EAAE,oBAAoB,EAAoB,MAAM,sBAAsB,CAAC;AAEnF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC,gEAAgE;IAChE,QAAQ,CAAC,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC;IAC3D;;gCAE4B;IAC5B,QAAQ,CAAC,eAAe,EAAE,MAAM,SAAS,MAAM,EAAE,CAAC;CACnD;AAED;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,CACvC,IAAI,EAAE,oBAAoB,EAC1B,UAAU,CAAC,EAAE,sBAAsB,GAClC,CAAC,KAAK,EAAE,UAAU,CAAC,UAAU,CAAC,KAAK,IAAI,CAgGzC"}
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
*/
|
|
27
27
|
import type { TypedScope } from 'footprintjs';
|
|
28
28
|
import type { AgentState } from '../types.js';
|
|
29
|
+
import type { ResolvedScriptTravel } from '../scripts/types.js';
|
|
29
30
|
type FinalStage = (scope: TypedScope<AgentState>) => void | Promise<void>;
|
|
30
31
|
export declare const prepareFinalStage: (scope: TypedScope<AgentState>) => void;
|
|
31
32
|
/**
|
|
@@ -108,6 +109,16 @@ export interface FinalStageArms {
|
|
|
108
109
|
* has always mounted, same reference, same bytes.
|
|
109
110
|
*/
|
|
110
111
|
readonly displayNameOf?: DisplayNameOf;
|
|
112
|
+
/**
|
|
113
|
+
* `.scriptTravelsWithTheAnswer()` — the recorded programs of this turn's
|
|
114
|
+
* code-running calls travel with the answer: as `turn_end.scripts` always,
|
|
115
|
+
* and as text after the `---` separator on a prose answer (`typed` — the
|
|
116
|
+
* answer has an output schema — gets the data only). Absent → the stage
|
|
117
|
+
* each combination of arms has always mounted, same reference, same bytes.
|
|
118
|
+
*/
|
|
119
|
+
readonly scriptTravel?: ResolvedScriptTravel & {
|
|
120
|
+
readonly typed?: true;
|
|
121
|
+
};
|
|
111
122
|
}
|
|
112
123
|
/** A tool's registered name → the app's words for a call of it, when its tool declares them. */
|
|
113
124
|
export type DisplayNameOf = (toolName: string) => string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareFinal.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/prepareFinal.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAS9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"prepareFinal.d.ts","sourceRoot":"","sources":["../../../../../src/core/agent/stages/prepareFinal.ts"],"names":[],"mappings":"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"}
|