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,211 @@
|
|
|
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 { utf8Length } from '../../../lib/utf8.js';
|
|
42
|
+
import { exitCodeFits, SCRIPT_LABELS, scriptLabelOf, } from './label.js';
|
|
43
|
+
/** A program longer than this (UTF-8 bytes) keeps a row with no text. Design § 4.4. */
|
|
44
|
+
export const MAX_SCRIPT_BYTES = 32_768;
|
|
45
|
+
/** Calls per turn that keep a row; the rest are counted. Design § 4.4. */
|
|
46
|
+
export const MAX_SCRIPT_ROWS = 16;
|
|
47
|
+
/** Lines of a program: LF-separated, `0` for an empty one. */
|
|
48
|
+
export function linesOf(program) {
|
|
49
|
+
if (program.length === 0)
|
|
50
|
+
return 0;
|
|
51
|
+
let lines = 1;
|
|
52
|
+
for (let i = 0; i < program.length; i++)
|
|
53
|
+
if (program.charCodeAt(i) === 0x0a)
|
|
54
|
+
lines++;
|
|
55
|
+
return program.charCodeAt(program.length - 1) === 0x0a ? lines - 1 : lines;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The declared argument's value in `args` — the one read a call's program is
|
|
59
|
+
* captured with. Read it at the boundary it names (as the call arrives; just
|
|
60
|
+
* before `execute`) and keep the value: never the arguments object, which app
|
|
61
|
+
* code may edit after it was handed over.
|
|
62
|
+
*/
|
|
63
|
+
export function programIn(script, args) {
|
|
64
|
+
return args === undefined ? undefined : args[script.argument];
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The row for one call, or `undefined` when the call carried no program — the
|
|
68
|
+
* declared argument is not a string (an argument check refuses such a call;
|
|
69
|
+
* there is nothing to record as "the program submitted").
|
|
70
|
+
*/
|
|
71
|
+
export function scriptRowFor(call) {
|
|
72
|
+
const program = call.submitted !== undefined ? call.submitted : call.proposed;
|
|
73
|
+
if (typeof program !== 'string')
|
|
74
|
+
return undefined;
|
|
75
|
+
const bytes = utf8Length(program);
|
|
76
|
+
const outcome = call.paused
|
|
77
|
+
? { label: 'submitted' }
|
|
78
|
+
: scriptLabelOf({
|
|
79
|
+
settlement: call.settlement,
|
|
80
|
+
...(call.facts !== undefined && { facts: call.facts }),
|
|
81
|
+
});
|
|
82
|
+
const rewritten = call.submitted !== undefined && call.submitted !== call.proposed;
|
|
83
|
+
return {
|
|
84
|
+
kind: 'script',
|
|
85
|
+
toolCallId: call.toolCallId,
|
|
86
|
+
tool: call.tool,
|
|
87
|
+
argument: call.script.argument,
|
|
88
|
+
...(call.script.language !== undefined && { language: call.script.language }),
|
|
89
|
+
bytes,
|
|
90
|
+
lines: linesOf(program),
|
|
91
|
+
...(call.paused !== true && bytes <= MAX_SCRIPT_BYTES && { text: program }),
|
|
92
|
+
outcome: outcome.label,
|
|
93
|
+
...(outcome.exitCode !== undefined && { exitCode: outcome.exitCode }),
|
|
94
|
+
...(outcome.serviceError === true && { serviceError: true }),
|
|
95
|
+
...(call.withheld === true && { resultWithheld: 'over-ceiling' }),
|
|
96
|
+
...(rewritten && { rewritten: true }),
|
|
97
|
+
turn: call.turn,
|
|
98
|
+
iteration: call.iteration,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
const isScriptRow = (row) => row !== null && typeof row === 'object' && row.kind === 'script';
|
|
102
|
+
/**
|
|
103
|
+
* THE ONE WRITER of a `script` row, and the one place a call gets its
|
|
104
|
+
* DISPATCH identity: the 1-based order of the actual dispatch within its turn.
|
|
105
|
+
* A call is a dispatch, never a provider id: a later call that reuses an id is
|
|
106
|
+
* a new dispatch. `options.dispatch` names a dispatch that already has a row
|
|
107
|
+
* (a paused call, settling): its row joins that dispatch.
|
|
108
|
+
*
|
|
109
|
+
* Appended, unless the turn already holds {@link MAX_SCRIPT_ROWS} other
|
|
110
|
+
* dispatches — then the call files nothing and `scriptsDropped` counts it
|
|
111
|
+
* (value-conditional: absent until a call is dropped). A dispatch that already
|
|
112
|
+
* has a row is never dropped, and a PAUSE is never counted (`paused`): its call
|
|
113
|
+
* is counted once, when it settles. Returns the dispatch the row was filed
|
|
114
|
+
* under, `undefined` when it was dropped. Synchronous: one read, one write, no
|
|
115
|
+
* await between.
|
|
116
|
+
*/
|
|
117
|
+
export function recordScriptRow(scope, draft, options = {}) {
|
|
118
|
+
const prev = [...(scope.findingsLedger ?? [])];
|
|
119
|
+
const dispatches = new Set();
|
|
120
|
+
let highest = 0;
|
|
121
|
+
for (const r of prev) {
|
|
122
|
+
if (!isScriptRow(r) || r.turn !== draft.turn)
|
|
123
|
+
continue;
|
|
124
|
+
dispatches.add(r.dispatch);
|
|
125
|
+
if (r.dispatch > highest)
|
|
126
|
+
highest = r.dispatch;
|
|
127
|
+
}
|
|
128
|
+
const joins = options.dispatch !== undefined && dispatches.has(options.dispatch);
|
|
129
|
+
if (!joins && dispatches.size >= MAX_SCRIPT_ROWS) {
|
|
130
|
+
if (options.paused !== true) {
|
|
131
|
+
scope.scriptsDropped = (scope.scriptsDropped ?? 0) + 1;
|
|
132
|
+
}
|
|
133
|
+
return undefined;
|
|
134
|
+
}
|
|
135
|
+
const dispatch = joins ? options.dispatch : highest + 1;
|
|
136
|
+
const { kind, toolCallId, ...rest } = draft;
|
|
137
|
+
scope.findingsLedger = [...prev, { kind, toolCallId, dispatch, ...rest }];
|
|
138
|
+
return dispatch;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* The one reader of a turn's script rows: the last row per DISPATCH wins, and
|
|
142
|
+
* a dispatch sits where its last row was filed — execution order, so a call
|
|
143
|
+
* that settles after a later one ran is read after it. Earlier turns counted.
|
|
144
|
+
*/
|
|
145
|
+
export function scriptRowsOfTurn(ledger, turn) {
|
|
146
|
+
const latest = new Map();
|
|
147
|
+
const earlier = new Set();
|
|
148
|
+
for (const row of ledger ?? []) {
|
|
149
|
+
if (!isScriptRow(row))
|
|
150
|
+
continue;
|
|
151
|
+
if (row.turn === turn) {
|
|
152
|
+
latest.delete(row.dispatch);
|
|
153
|
+
latest.set(row.dispatch, row);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
earlier.add(`${row.turn}\u001f${row.dispatch}`);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return { current: [...latest.values()], earlier: earlier.size };
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* The restore door's half of the bound (seed): every `script` row of a turn
|
|
163
|
+
* BEFORE `turn` keeps its facts — ids, counts, outcome — and loses its `text`.
|
|
164
|
+
* The same reference when there is nothing to drop, so a ledger without
|
|
165
|
+
* script text is restored byte for byte.
|
|
166
|
+
*/
|
|
167
|
+
export function withoutEarlierScriptText(ledger, turn) {
|
|
168
|
+
let changed = false;
|
|
169
|
+
const out = ledger.map((row) => {
|
|
170
|
+
if (!isScriptRow(row) || row.turn >= turn || row.text === undefined)
|
|
171
|
+
return row;
|
|
172
|
+
changed = true;
|
|
173
|
+
const { text: _text, ...facts } = row;
|
|
174
|
+
void _text;
|
|
175
|
+
return facts;
|
|
176
|
+
});
|
|
177
|
+
return changed ? out : ledger;
|
|
178
|
+
}
|
|
179
|
+
const isCount = (v) => typeof v === 'number' && Number.isInteger(v) && v >= 0;
|
|
180
|
+
/**
|
|
181
|
+
* Whether a value read from a stored checkpoint is a `script` row this library
|
|
182
|
+
* could have written — the checkpoint door's arm (`core/runCheckpoint.ts`).
|
|
183
|
+
* An older runtime refuses a checkpoint carrying one.
|
|
184
|
+
*/
|
|
185
|
+
export function scriptRowIsWellFormed(r) {
|
|
186
|
+
const label = r.outcome;
|
|
187
|
+
return (r.kind === 'script' &&
|
|
188
|
+
typeof r.toolCallId === 'string' &&
|
|
189
|
+
Number.isInteger(r.dispatch) &&
|
|
190
|
+
r.dispatch >= 1 &&
|
|
191
|
+
typeof r.tool === 'string' &&
|
|
192
|
+
typeof r.argument === 'string' &&
|
|
193
|
+
(r.language === undefined || typeof r.language === 'string') &&
|
|
194
|
+
isCount(r.bytes) &&
|
|
195
|
+
isCount(r.lines) &&
|
|
196
|
+
// The text is the program the row measured, within the bound.
|
|
197
|
+
(r.text === undefined ||
|
|
198
|
+
(typeof r.text === 'string' &&
|
|
199
|
+
r.bytes === utf8Length(r.text) &&
|
|
200
|
+
r.bytes <= MAX_SCRIPT_BYTES)) &&
|
|
201
|
+
typeof label === 'string' &&
|
|
202
|
+
SCRIPT_LABELS.includes(label) &&
|
|
203
|
+
// An exit code rides exactly the two labels that one proves, as the label writes it.
|
|
204
|
+
exitCodeFits(label, r.exitCode) &&
|
|
205
|
+
(r.serviceError === undefined || (r.serviceError === true && label === 'outcome-unknown')) &&
|
|
206
|
+
(r.resultWithheld === undefined || r.resultWithheld === 'over-ceiling') &&
|
|
207
|
+
(r.rewritten === undefined || r.rewritten === true) &&
|
|
208
|
+
typeof r.turn === 'number' &&
|
|
209
|
+
typeof r.iteration === 'number');
|
|
210
|
+
}
|
|
211
|
+
//# sourceMappingURL=rows.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rows.js","sourceRoot":"","sources":["../../../../../src/core/agent/scripts/rows.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAGlD,OAAO,EACL,YAAY,EACZ,aAAa,EACb,aAAa,GAGd,MAAM,YAAY,CAAC;AAGpB,uFAAuF;AACvF,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC;AACvC,0E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aAAmC,CAAC,QAAQ,CAAC,KAAK,CAAC;QACpD,qFAAqF;QACrF,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,CAAC;QAC/B,CAAC,CAAC,CAAC,YAAY,KAAK,SAAS,IAAI,CAAC,CAAC,CAAC,YAAY,KAAK,IAAI,IAAI,KAAK,KAAK,iBAAiB,CAAC,CAAC;QAC1F,CAAC,CAAC,CAAC,cAAc,KAAK,SAAS,IAAI,CAAC,CAAC,cAAc,KAAK,cAAc,CAAC;QACvE,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,IAAI,CAAC,CAAC,SAAS,KAAK,IAAI,CAAC;QACnD,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ;QAC1B,OAAO,CAAC,CAAC,SAAS,KAAK,QAAQ,CAChC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/core/agent/scripts/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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;
|
|
@@ -0,0 +1,58 @@
|
|
|
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 longest run of backticks in `text` — one linear pass. */
|
|
29
|
+
function longestBacktickRun(text) {
|
|
30
|
+
let longest = 0;
|
|
31
|
+
let run = 0;
|
|
32
|
+
for (let i = 0; i < text.length; i++) {
|
|
33
|
+
if (text.charCodeAt(i) === 0x60) {
|
|
34
|
+
run += 1;
|
|
35
|
+
if (run > longest)
|
|
36
|
+
longest = run;
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
run = 0;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return longest;
|
|
43
|
+
}
|
|
44
|
+
/** The fence for `program`: `max(3, longestRun + 1)` backticks. */
|
|
45
|
+
export function fenceFor(program) {
|
|
46
|
+
return '`'.repeat(Math.max(3, longestBacktickRun(program) + 1));
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* The program inside the library's fence: opening line (fence + `language` as
|
|
50
|
+
* the info string), LF, the program unchanged, LF, closing fence. `language`
|
|
51
|
+
* is a declared token (`tools/script.ts` refuses a backtick or line break in
|
|
52
|
+
* it), so the info string cannot end the opening line early.
|
|
53
|
+
*/
|
|
54
|
+
export function wrapProgram(program, language) {
|
|
55
|
+
const fence = fenceFor(program);
|
|
56
|
+
return `${fence}${language ?? ''}\n${program}\n${fence}`;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=wrapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrapper.js","sourceRoot":"","sources":["../../../../../src/core/agent/scripts/wrapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,gEAAgE;AAChE,SAAS,kBAAkB,CAAC,IAAY;IACtC,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,IAAI,GAAG,GAAG,CAAC,CAAC;IACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,IAAI,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;YAChC,GAAG,IAAI,CAAC,CAAC;YACT,IAAI,GAAG,GAAG,OAAO;gBAAE,OAAO,GAAG,GAAG,CAAC;QACnC,CAAC;aAAM,CAAC;YACN,GAAG,GAAG,CAAC,CAAC;QACV,CAAC;IACH,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,QAAQ,CAAC,OAAe;IACtC,OAAO,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,kBAAkB,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAClE,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe,EAAE,QAAiB;IAC5D,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IAChC,OAAO,GAAG,KAAK,GAAG,QAAQ,IAAI,EAAE,KAAK,OAAO,KAAK,KAAK,EAAE,CAAC;AAC3D,CAAC"}
|
|
@@ -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. */
|