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,226 @@
|
|
|
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 { codeRegionsOf, MAX_CODE_REGIONS } from '../evidence/codeRegions.js';
|
|
46
|
+
import { utf8Length } from '../../../lib/utf8.js';
|
|
47
|
+
import { exitCodeFits, SCRIPT_LABELS } from './label.js';
|
|
48
|
+
import { MAX_SCRIPT_BYTES } from './rows.js';
|
|
49
|
+
/** The text with `cut` regions removed, whole lines each (fence lines included). */
|
|
50
|
+
function without(text, cut) {
|
|
51
|
+
if (cut.length === 0)
|
|
52
|
+
return text;
|
|
53
|
+
const parts = [];
|
|
54
|
+
let from = 0;
|
|
55
|
+
for (const region of cut) {
|
|
56
|
+
parts.push(text.slice(from, region.start));
|
|
57
|
+
from = region.end;
|
|
58
|
+
}
|
|
59
|
+
parts.push(text.slice(from));
|
|
60
|
+
return parts.join('');
|
|
61
|
+
}
|
|
62
|
+
/** Whether a block's content is over the per-script bound — never compared then. */
|
|
63
|
+
function overSize(content) {
|
|
64
|
+
// Every UTF-16 unit is at least one UTF-8 byte: a long string is over at once.
|
|
65
|
+
return content.length > MAX_SCRIPT_BYTES || utf8Length(content) > MAX_SCRIPT_BYTES;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Read `answer`'s fenced blocks against this turn's submissions. Pure; the
|
|
69
|
+
* rows are `rows.ts` · `scriptRowsOfTurn`'s reading (last row per call).
|
|
70
|
+
*/
|
|
71
|
+
export function readShownScripts(answer, turn, scriptsDropped) {
|
|
72
|
+
const { regions, dropped } = codeRegionsOf(answer);
|
|
73
|
+
// The programs this turn submitted, each with every call that submitted it,
|
|
74
|
+
// in the order the calls were made — the last is "the latest".
|
|
75
|
+
const byProgram = new Map();
|
|
76
|
+
for (const row of turn.current) {
|
|
77
|
+
if (row.text === undefined)
|
|
78
|
+
continue;
|
|
79
|
+
const calls = byProgram.get(row.text);
|
|
80
|
+
if (calls === undefined)
|
|
81
|
+
byProgram.set(row.text, [row]);
|
|
82
|
+
else
|
|
83
|
+
calls.push(row);
|
|
84
|
+
}
|
|
85
|
+
const blocks = [];
|
|
86
|
+
const matched = [];
|
|
87
|
+
for (const region of regions) {
|
|
88
|
+
if (overSize(region.content)) {
|
|
89
|
+
blocks.push({ block: region.block, label: 'unmatched', reason: 'over-size' });
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
const calls = byProgram.get(region.content);
|
|
93
|
+
if (calls === undefined) {
|
|
94
|
+
blocks.push({ block: region.block, label: 'unmatched', reason: 'no-submission-this-turn' });
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
const latest = calls[calls.length - 1];
|
|
98
|
+
matched.push(region);
|
|
99
|
+
blocks.push({
|
|
100
|
+
block: region.block,
|
|
101
|
+
label: latest.outcome,
|
|
102
|
+
...(latest.exitCode !== undefined && { exitCode: latest.exitCode }),
|
|
103
|
+
toolCallId: latest.toolCallId,
|
|
104
|
+
tool: latest.tool,
|
|
105
|
+
dispatch: latest.dispatch,
|
|
106
|
+
...(calls.length > 1 && { alsoMatches: calls.length - 1 }),
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
return {
|
|
110
|
+
prose: without(answer, matched),
|
|
111
|
+
outsideCode: without(answer, regions),
|
|
112
|
+
verdict: {
|
|
113
|
+
blocks,
|
|
114
|
+
earlierTurnRows: turn.earlier,
|
|
115
|
+
regionsDropped: dropped,
|
|
116
|
+
...(scriptsDropped !== undefined && scriptsDropped > 0 && { scriptsDropped }),
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* A verdict as detached plain data — field by field, never a reference into
|
|
122
|
+
* state (a value read back through a TypedScope is a live view, and an event
|
|
123
|
+
* payload must be plain data).
|
|
124
|
+
*/
|
|
125
|
+
export function copyScriptsVerdict(verdict) {
|
|
126
|
+
return {
|
|
127
|
+
blocks: verdict.blocks.map((b) => b.label === 'unmatched'
|
|
128
|
+
? { block: b.block, label: 'unmatched', reason: b.reason }
|
|
129
|
+
: {
|
|
130
|
+
block: b.block,
|
|
131
|
+
label: b.label,
|
|
132
|
+
...(b.exitCode !== undefined && { exitCode: b.exitCode }),
|
|
133
|
+
toolCallId: b.toolCallId,
|
|
134
|
+
tool: b.tool,
|
|
135
|
+
dispatch: b.dispatch,
|
|
136
|
+
...(b.alsoMatches !== undefined && { alsoMatches: b.alsoMatches }),
|
|
137
|
+
}),
|
|
138
|
+
earlierTurnRows: verdict.earlierTurnRows,
|
|
139
|
+
regionsDropped: verdict.regionsDropped,
|
|
140
|
+
...(verdict.scriptsDropped !== undefined && { scriptsDropped: verdict.scriptsDropped }),
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
// ─── Reading a record back ────────────────────────────────────────────
|
|
144
|
+
//
|
|
145
|
+
// A saved verdict is JSON a reader is handed, not a value this library holds.
|
|
146
|
+
// ONE rule reads its fields for every reader of the shape — the answer
|
|
147
|
+
// account (`evidence_checked.scripts`) and the checkpoint door's
|
|
148
|
+
// `script-shown` witness row (`assessment/witness.ts`) — and it refuses
|
|
149
|
+
// exactly what no writer of this library files.
|
|
150
|
+
/** Every reason a block can be unmatched for. */
|
|
151
|
+
export const UNMATCHED_REASONS = Object.freeze([
|
|
152
|
+
'no-submission-this-turn',
|
|
153
|
+
'over-size',
|
|
154
|
+
'kept-out',
|
|
155
|
+
]);
|
|
156
|
+
const isObject = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
157
|
+
const isPositive = (value) => typeof value === 'number' && Number.isInteger(value) && value >= 1;
|
|
158
|
+
/**
|
|
159
|
+
* One block verdict's fields, checked as {@link readShownScripts} writes them
|
|
160
|
+
* — a fresh copy, or `undefined` when any field is one no writer of this
|
|
161
|
+
* library files: a position or a dispatch that is not a whole number from 1,
|
|
162
|
+
* a label outside the vocabulary, an exit code its label does not carry
|
|
163
|
+
* (`label.ts` · `exitCodeFits`), an unmatched block that names a call, a
|
|
164
|
+
* matched one without its call. Fields beside these (a witness row's `kind`,
|
|
165
|
+
* `turn`, `iteration`) are not read.
|
|
166
|
+
*/
|
|
167
|
+
export function blockVerdictOf(value) {
|
|
168
|
+
if (!isObject(value))
|
|
169
|
+
return undefined;
|
|
170
|
+
const { block, label, reason, toolCallId, tool, dispatch, exitCode, alsoMatches } = value;
|
|
171
|
+
if (!isPositive(block))
|
|
172
|
+
return undefined;
|
|
173
|
+
if (label === 'unmatched') {
|
|
174
|
+
const named = toolCallId !== undefined ||
|
|
175
|
+
tool !== undefined ||
|
|
176
|
+
dispatch !== undefined ||
|
|
177
|
+
exitCode !== undefined ||
|
|
178
|
+
alsoMatches !== undefined;
|
|
179
|
+
if (named || !UNMATCHED_REASONS.includes(reason))
|
|
180
|
+
return undefined;
|
|
181
|
+
return { block, label: 'unmatched', reason: reason };
|
|
182
|
+
}
|
|
183
|
+
if (reason !== undefined || !SCRIPT_LABELS.includes(label)) {
|
|
184
|
+
return undefined;
|
|
185
|
+
}
|
|
186
|
+
if (!exitCodeFits(label, exitCode))
|
|
187
|
+
return undefined;
|
|
188
|
+
if (typeof toolCallId !== 'string' || typeof tool !== 'string')
|
|
189
|
+
return undefined;
|
|
190
|
+
if (!isPositive(dispatch))
|
|
191
|
+
return undefined;
|
|
192
|
+
if (alsoMatches !== undefined && !isPositive(alsoMatches))
|
|
193
|
+
return undefined;
|
|
194
|
+
return {
|
|
195
|
+
block,
|
|
196
|
+
label: label,
|
|
197
|
+
...(exitCode !== undefined && { exitCode: exitCode }),
|
|
198
|
+
toolCallId,
|
|
199
|
+
tool,
|
|
200
|
+
dispatch,
|
|
201
|
+
...(alsoMatches !== undefined && { alsoMatches }),
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* A saved `evidence_checked.scripts` — THE reader of the shape for a reader
|
|
206
|
+
* of a record. `undefined` when the event carries no scripts arm. Bounded by
|
|
207
|
+
* the writer's cap: no reader iterates more verdicts than a writer files.
|
|
208
|
+
*/
|
|
209
|
+
export function recordedBlocks(value) {
|
|
210
|
+
if (value === undefined)
|
|
211
|
+
return undefined;
|
|
212
|
+
if (!isObject(value) || !Array.isArray(value.blocks))
|
|
213
|
+
return { blocks: [], unread: 1 };
|
|
214
|
+
const all = value.blocks;
|
|
215
|
+
const blocks = [];
|
|
216
|
+
let unread = Math.max(0, all.length - MAX_CODE_REGIONS);
|
|
217
|
+
for (let index = 0; index < Math.min(all.length, MAX_CODE_REGIONS); index++) {
|
|
218
|
+
const verdict = blockVerdictOf(all[index]);
|
|
219
|
+
if (verdict === undefined)
|
|
220
|
+
unread += 1;
|
|
221
|
+
else
|
|
222
|
+
blocks.push({ index, verdict });
|
|
223
|
+
}
|
|
224
|
+
return { blocks, unread };
|
|
225
|
+
}
|
|
226
|
+
//# sourceMappingURL=match.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"match.js","sourceRoot":"","sources":["../../../../../src/core/agent/scripts/match.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAEH,OAAO,EAAE,aAAa,EAAE,g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AC;QAAE,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,CAAC;IACvF,MAAM,GAAG,GAAuB,KAAK,CAAC,MAAM,CAAC;IAC7C,MAAM,MAAM,GAAoB,EAAE,CAAC;IACnC,IAAI,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,GAAG,gBAAgB,CAAC,CAAC;IACxD,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC;QAC5E,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;QAC3C,IAAI,OAAO,KAAK,SAAS;YAAE,MAAM,IAAI,CAAC,CAAC;;YAClC,MAAM,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,54 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,77 @@
|
|
|
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 { labelWords } from './label.js';
|
|
43
|
+
/** `run_code`, `` `a` or `b` `` — the tools named, quoted. */
|
|
44
|
+
function toolsNamed(tools) {
|
|
45
|
+
const quoted = tools.map((t) => `\`${t}\``);
|
|
46
|
+
if (quoted.length === 0)
|
|
47
|
+
return 'a code-running tool';
|
|
48
|
+
if (quoted.length === 1)
|
|
49
|
+
return quoted[0];
|
|
50
|
+
return `${quoted.slice(0, -1).join(', ')} or ${quoted[quoted.length - 1]}`;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* The clause(s) for one rejected draft — `''` when the verdict calls for
|
|
54
|
+
* none (no fenced block, or no flagged value the blocks bear on).
|
|
55
|
+
* `toolsThisTurn` names the code-running tools this turn's calls submitted
|
|
56
|
+
* to, in first-call order.
|
|
57
|
+
*/
|
|
58
|
+
export function scriptRecoveryClause(scripts, unsupported, toolsThisTurn) {
|
|
59
|
+
const clauses = [];
|
|
60
|
+
const unmatched = scripts.blocks.some((b) => b.label === 'unmatched');
|
|
61
|
+
if (unmatched && unsupported.some((v) => v.region === 'code')) {
|
|
62
|
+
clauses.push(`The fenced code in the rejected draft matched no submission to ${toolsNamed(toolsThisTurn)} recorded this turn, so its contents were checked as prose. Keep a script in the ` +
|
|
63
|
+
'answer: show the program exactly as it was submitted on that call, byte for byte, or ' +
|
|
64
|
+
'say that the code shown is not the one that was submitted. Fix the values in the prose.');
|
|
65
|
+
}
|
|
66
|
+
const matched = scripts.blocks.flatMap((b) => (b.label === 'unmatched' ? [] : [b]));
|
|
67
|
+
if (matched.length > 0 && unsupported.some((v) => v.region === 'prose')) {
|
|
68
|
+
const calls = matched.map((b) => `to \`${b.tool}\` on call ${b.toolCallId} (${labelWords(b.label, b.exitCode)})`);
|
|
69
|
+
clauses.push(matched.length === 1
|
|
70
|
+
? `The script shown is the one submitted ${calls[0]} and was not checked. Keep it. The ` +
|
|
71
|
+
'listed values were in the prose around it.'
|
|
72
|
+
: `The scripts shown are the ones submitted ${calls.join(' and ')} and were not checked. ` +
|
|
73
|
+
'Keep them. The listed values were in the prose around them.');
|
|
74
|
+
}
|
|
75
|
+
return clauses.join(' ');
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=recovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recovery.js","sourceRoot":"","sources":["../../../../../src/core/agent/scripts/recovery.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAQxC,8DAA8D;AAC9D,SAAS,UAAU,CAAC,KAAwB;IAC1C,MAAM,MAAM,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5C,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,qBAAqB,CAAC;IACtD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC,CAAC,CAAW,CAAC;IACpD,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAA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4C;YAChD,CAAC,CAAC,4CAA4C,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,yBAAyB;gBACtF,6DAA6D,CACpE,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3B,CAAC"}
|
|
@@ -0,0 +1,143 @@
|
|
|
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;
|