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
|
@@ -33,7 +33,8 @@ import type { Assertion } from '../../../integrity/assertion/types.js';
|
|
|
33
33
|
import type { ArgumentRow } from '../arguments/rows.js';
|
|
34
34
|
import type { DeclaredSource } from '../arguments/sources.js';
|
|
35
35
|
import type { PeriodRow } from '../../../semantics/coverage/period.js';
|
|
36
|
-
import type { GroundedRow, StepsUnfinishedRow } from '../assessment/witness.js';
|
|
36
|
+
import type { GroundedRow, ScriptShownRow, StepsUnfinishedRow } from '../assessment/witness.js';
|
|
37
|
+
import type { ScriptRow } from '../scripts/types.js';
|
|
37
38
|
import type { CallRow, CallWindowRow, ClockOnResumeRow, ClockRow, TimeAnswerRow, SourceClockRow, TimeDerivedRow, TimeReadingRow } from '../../../time/rows.js';
|
|
38
39
|
import type { CoverageItem } from '../../../semantics/coverage/types.js';
|
|
39
40
|
import type { ClaimVerificationRow } from './verificationTypes.js';
|
|
@@ -435,6 +436,6 @@ export type NegativeProseFinding = import('../../../integrity/negative-claim/typ
|
|
|
435
436
|
readonly iteration: number;
|
|
436
437
|
readonly turn?: number;
|
|
437
438
|
};
|
|
438
|
-
export type FindingsRow = import('./refusal.js').ReferenceRefusalRow | NegativeProseFinding | BasisRow | StandingRow | ConflictRow | JudgmentRow | JudgmentErrorRow | ContingentRow | UnsettledByAbsenceRow | ClaimVerificationRow | ArgumentRow | PeriodRow | GroundedRow | StepsUnfinishedRow | ClockRow | ClockOnResumeRow | CallRow | TimeReadingRow | CallWindowRow | TimeAnswerRow | TimeDerivedRow | SourceClockRow;
|
|
439
|
+
export type FindingsRow = import('./refusal.js').ReferenceRefusalRow | NegativeProseFinding | BasisRow | StandingRow | ConflictRow | JudgmentRow | JudgmentErrorRow | ContingentRow | UnsettledByAbsenceRow | ClaimVerificationRow | ArgumentRow | PeriodRow | GroundedRow | StepsUnfinishedRow | ScriptRow | ScriptShownRow | ClockRow | ClockOnResumeRow | CallRow | TimeReadingRow | CallWindowRow | TimeAnswerRow | TimeDerivedRow | SourceClockRow;
|
|
439
440
|
/** The committed key: flat, append-only, a fresh array on every write. */
|
|
440
441
|
export type FindingsLedger = readonly FindingsRow[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/core/agent/findings/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../src/core/agent/findings/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAqBH,kFAAkF;AAClF,MAAM,CAAC,MAAM,iBAAiB,GAAG,WAAoB,CAAC;AACtD,8EAA8E;AAC9E,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAoB,CAAC;AASxD,wEAAwE;AACxE,MAAM,CAAC,MAAM,YAAY,GAAqB,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC,CAAC;AACvF,MAAM,CAAC,MAAM,aAAa,GAAsB,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;AACzF,MAAM,CAAC,MAAM,eAAe,GAAwB,MAAM,CAAC,MAAM,CAAC;IAChE,MAAM;IACN,MAAM;IACN,OAAO;IACP,WAAW;CACZ,CAAC,CAAC;AAEH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAyJrC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AA0EvC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/attachment — `.scriptTravelsWithTheAnswer()`: the recorded program
|
|
3
|
+
* itself, under the answer, labelled from the execution record.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: composed by the FRAMEWORK, never requested from the model (the
|
|
6
|
+
* `.limitsTravelWithTheAnswer()` precedent, `semantics/coverage/
|
|
7
|
+
* answer.ts`). Pure: rows in, data and text out.
|
|
8
|
+
* Role: core/ layer. Read by the final branch (`stages/prepareFinal.ts`):
|
|
9
|
+
* the data rides `turn_end.scripts` on every answer under the arm;
|
|
10
|
+
* the text is appended to a PROSE answer through the one composer
|
|
11
|
+
* (`composeAnswerWithCoverage`), after the standing line and the
|
|
12
|
+
* limits block. A typed answer gets the data only — its bytes are
|
|
13
|
+
* never edited.
|
|
14
|
+
* Emits: N/A.
|
|
15
|
+
*
|
|
16
|
+
* ## Why the library attaches it
|
|
17
|
+
*
|
|
18
|
+
* An app's rule "always show the script" is a rule the model can break, and
|
|
19
|
+
* the cheapest revision that passes a names-and-numbers check is to delete
|
|
20
|
+
* the script. The attachment needs no cooperation from the model: the program
|
|
21
|
+
* comes from the record (the row's `text` — what was SUBMITTED to the tool),
|
|
22
|
+
* so there is nothing to retype and nothing to check. When the model also
|
|
23
|
+
* showed a matched copy, the attachment is still appended: the model's copy
|
|
24
|
+
* never decides whether the authoritative one is delivered.
|
|
25
|
+
*
|
|
26
|
+
* ## What is attached (design § 4.1, § 4.4)
|
|
27
|
+
*
|
|
28
|
+
* - `which: 'last'` (default): the last call of the turn that REACHED the tool
|
|
29
|
+
* (its label is not `submitted`); `'all'`: every such call, at most
|
|
30
|
+
* {@link MAX_ATTACHED_SCRIPTS}, the rest counted in `omitted`.
|
|
31
|
+
* - `maxBytes` (default 4,000 UTF-8 bytes) bounds each program shown, cut at a
|
|
32
|
+
* code-point boundary; a cut says so — `[incomplete: showing N of M bytes —
|
|
33
|
+
* not the whole program]` and `truncated.shownBytes` — and is never
|
|
34
|
+
* advertised as a complete, reproducible program.
|
|
35
|
+
* - A program over `MAX_SCRIPT_BYTES` has no text on its row: it is counted in
|
|
36
|
+
* `omitted` and the text says "one script of N bytes is over the bound and
|
|
37
|
+
* is not shown". Calls past `MAX_SCRIPT_ROWS` have no row: counted too.
|
|
38
|
+
*
|
|
39
|
+
* Every line is library-authored and past tense, names the CALL (never a
|
|
40
|
+
* destination), and uses the label's words (`label.ts` · `labelWords`).
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* const data = scriptsOfAnswer(scriptRowsOfTurn(ledger, turn).current, { which: 'last', maxBytes: 4000 });
|
|
45
|
+
* scriptsBlock(data);
|
|
46
|
+
* // Script submitted to run_code on call c1 — completed, exit 0. Attached by the library from the run record:
|
|
47
|
+
* //
|
|
48
|
+
* // ```python
|
|
49
|
+
* // print(41 + 1)
|
|
50
|
+
* // ```
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
import type { ResolvedScriptTravel, ScriptLabel, ScriptRow, ScriptTravelOptions, ShownScript, TurnEndScripts } from './types.js';
|
|
54
|
+
/** Scripts attached under `which: 'all'`; the rest are counted (`omitted`). Design § 4.1. */
|
|
55
|
+
export declare const MAX_ATTACHED_SCRIPTS = 8;
|
|
56
|
+
/** Default UTF-8 bytes of each program shown. Design § 4.1. */
|
|
57
|
+
export declare const DEFAULT_ATTACHED_BYTES = 4000;
|
|
58
|
+
/**
|
|
59
|
+
* Check `.scriptTravelsWithTheAnswer()`'s options once, at the call site, into
|
|
60
|
+
* the arm the chart carries. Refusals name the option and the fix.
|
|
61
|
+
*/
|
|
62
|
+
export declare function resolveScriptTravel(opts?: ScriptTravelOptions): ResolvedScriptTravel;
|
|
63
|
+
/**
|
|
64
|
+
* What travels with this turn's answer — the data form (`turn_end.scripts`).
|
|
65
|
+
* `rows` is this turn's reading (`rows.ts` · `scriptRowsOfTurn`); fresh plain
|
|
66
|
+
* objects, never a reference into the ledger.
|
|
67
|
+
*/
|
|
68
|
+
export declare function scriptsOfAnswer(rows: readonly ScriptRow[], travel: ResolvedScriptTravel, scriptsDropped?: number): TurnEndScripts & {
|
|
69
|
+
readonly overSize: readonly ScriptRow[];
|
|
70
|
+
};
|
|
71
|
+
/** The label line of one attached script — library words, past tense, the call named. */
|
|
72
|
+
export declare function scriptLabelLine(script: ShownScript): string;
|
|
73
|
+
/** The line that stands for a script whose program is kept out of the text (`withheldFromText`). */
|
|
74
|
+
export declare function scriptWithheldLine(script: ShownScript): string;
|
|
75
|
+
/** One attached script as text: its label line, then the program in the library's fence. */
|
|
76
|
+
export declare function shownScriptBlock(script: ShownScript): string;
|
|
77
|
+
/**
|
|
78
|
+
* What the text BEFORE the attachment leaves open, as a CommonMark renderer
|
|
79
|
+
* reads it — the rendering boundary (finding: a model answer that ends inside
|
|
80
|
+
* an unfinished fence would take the library's programs in, and a fence line
|
|
81
|
+
* inside a program would then close it, leaving the rest as prose).
|
|
82
|
+
*
|
|
83
|
+
* - `clean`: nothing the attachment could fall into.
|
|
84
|
+
* - `closed`: a fence is still open; the attachment begins by closing it
|
|
85
|
+
* (`fence`, the same character and length).
|
|
86
|
+
* - `unsettled`: the reader stopped (an indented fence, raw HTML, display
|
|
87
|
+
* math — `../evidence/codeRegions.ts`), so nothing says what a program would
|
|
88
|
+
* render inside. The programs stay out of the text; the data keeps them.
|
|
89
|
+
*
|
|
90
|
+
* `before` is exactly the text the attachment follows — the composer's
|
|
91
|
+
* (`semantics/coverage/answer.ts` · `composeAnswerWithCoverage`). Read with a
|
|
92
|
+
* line ending after it, as it is composed: an opening fence on its last line
|
|
93
|
+
* opens there.
|
|
94
|
+
*/
|
|
95
|
+
export type AttachmentBoundary = {
|
|
96
|
+
readonly kind: 'clean';
|
|
97
|
+
} | {
|
|
98
|
+
readonly kind: 'closed';
|
|
99
|
+
readonly fence: string;
|
|
100
|
+
} | {
|
|
101
|
+
readonly kind: 'unsettled';
|
|
102
|
+
};
|
|
103
|
+
/** The boundary after `before` (see {@link AttachmentBoundary}). */
|
|
104
|
+
export declare function attachmentBoundary(before: string): AttachmentBoundary;
|
|
105
|
+
export type RecordedBoundary = {
|
|
106
|
+
readonly kind: 'clean';
|
|
107
|
+
} | {
|
|
108
|
+
readonly kind: 'closed';
|
|
109
|
+
readonly char: 'backtick' | 'tilde';
|
|
110
|
+
readonly length: number;
|
|
111
|
+
} | {
|
|
112
|
+
readonly kind: 'unsettled';
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* The boundary to rebuild a recorded text behind — `undefined` when its fence
|
|
116
|
+
* is longer than `within`, the text it would have to be found in: the one
|
|
117
|
+
* repetition a reader makes is bounded by what it reads.
|
|
118
|
+
*/
|
|
119
|
+
export declare function rebuildBoundary(recorded: RecordedBoundary, within: number): AttachmentBoundary | undefined;
|
|
120
|
+
/** The label an attached script can carry: a call that never reached the tool is never attached (`reached`). */
|
|
121
|
+
export type AttachedLabel = Exclude<ScriptLabel, 'submitted'>;
|
|
122
|
+
/** An attached script as a reader gets it back: its label, by type, one an attached script can carry. */
|
|
123
|
+
export type RecordedScript = ShownScript & {
|
|
124
|
+
readonly label: AttachedLabel;
|
|
125
|
+
};
|
|
126
|
+
/** One attached script read back, at its position in the record's `shown`. */
|
|
127
|
+
export interface RecordedShown {
|
|
128
|
+
readonly index: number;
|
|
129
|
+
readonly script: RecordedScript;
|
|
130
|
+
}
|
|
131
|
+
/** A saved `turn_end.scripts`, read back. */
|
|
132
|
+
export interface RecordedScripts {
|
|
133
|
+
/** The entries a writer of this library files, at their record position. */
|
|
134
|
+
readonly shown: readonly RecordedShown[];
|
|
135
|
+
/**
|
|
136
|
+
* What no writer files, counted once each: an entry that does not read
|
|
137
|
+
* back, every entry past `MAX_ATTACHED_SCRIPTS` (the writer attaches no
|
|
138
|
+
* more), an `omitted` that is not a whole number, a boundary
|
|
139
|
+
* ({@link RecordedBoundary}) that is not one a writer states, or a
|
|
140
|
+
* `scripts` value that is not `{ shown: [...] }`. Zero means every field
|
|
141
|
+
* was read back — only then can the attached text be rebuilt.
|
|
142
|
+
*/
|
|
143
|
+
readonly unread: number;
|
|
144
|
+
/** `omitted`, when the record's is a whole number. */
|
|
145
|
+
readonly omitted?: number;
|
|
146
|
+
/** The rendering boundary, when the record's is one a writer states. */
|
|
147
|
+
readonly boundary?: RecordedBoundary;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* A saved `turn_end.scripts` — THE reader of the shape for a reader of a
|
|
151
|
+
* record. `undefined` when the event carries no scripts arm. `within` is the
|
|
152
|
+
* length of the answer the block was appended to (a fence longer than it is
|
|
153
|
+
* refused). Bounded by the writer's cap: no reader iterates more entries
|
|
154
|
+
* than a writer attaches.
|
|
155
|
+
*/
|
|
156
|
+
export declare function recordedScripts(value: unknown, within?: number): RecordedScripts | undefined;
|
|
157
|
+
/**
|
|
158
|
+
* The text form: one block per attached script, then one line per omission —
|
|
159
|
+
* `''` when nothing travels (the composer then appends nothing). Every cut and
|
|
160
|
+
* every omission is stated. Behind a `closed` boundary the block opens with
|
|
161
|
+
* the closing fence; behind an `unsettled` one each script is its label line
|
|
162
|
+
* alone (`scriptWithheldLine`) — the programs ride the data only.
|
|
163
|
+
*/
|
|
164
|
+
export declare function scriptsBlock(scripts: TurnEndScripts & {
|
|
165
|
+
readonly overSize?: readonly ScriptRow[];
|
|
166
|
+
}, boundary?: AttachmentBoundary): string;
|
|
167
|
+
/**
|
|
168
|
+
* The text form behind the boundary the text before it leaves — `''` when
|
|
169
|
+
* nothing travels (no boundary is then taken). The second value is the
|
|
170
|
+
* boundary the text was written behind: what `turn_end.scripts` records.
|
|
171
|
+
*/
|
|
172
|
+
export declare function scriptsBlockAfter(scripts: TurnEndScripts & {
|
|
173
|
+
readonly overSize?: readonly ScriptRow[];
|
|
174
|
+
}, before: string): {
|
|
175
|
+
readonly text: string;
|
|
176
|
+
readonly boundary: AttachmentBoundary;
|
|
177
|
+
};
|
|
178
|
+
/** The data form as detached plain data — what `turn_end.scripts` carries. */
|
|
179
|
+
export declare function turnEndScriptsOf(scripts: TurnEndScripts, boundary?: AttachmentBoundary): TurnEndScripts;
|
|
@@ -0,0 +1,361 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/attachment — `.scriptTravelsWithTheAnswer()`: the recorded program
|
|
3
|
+
* itself, under the answer, labelled from the execution record.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: composed by the FRAMEWORK, never requested from the model (the
|
|
6
|
+
* `.limitsTravelWithTheAnswer()` precedent, `semantics/coverage/
|
|
7
|
+
* answer.ts`). Pure: rows in, data and text out.
|
|
8
|
+
* Role: core/ layer. Read by the final branch (`stages/prepareFinal.ts`):
|
|
9
|
+
* the data rides `turn_end.scripts` on every answer under the arm;
|
|
10
|
+
* the text is appended to a PROSE answer through the one composer
|
|
11
|
+
* (`composeAnswerWithCoverage`), after the standing line and the
|
|
12
|
+
* limits block. A typed answer gets the data only — its bytes are
|
|
13
|
+
* never edited.
|
|
14
|
+
* Emits: N/A.
|
|
15
|
+
*
|
|
16
|
+
* ## Why the library attaches it
|
|
17
|
+
*
|
|
18
|
+
* An app's rule "always show the script" is a rule the model can break, and
|
|
19
|
+
* the cheapest revision that passes a names-and-numbers check is to delete
|
|
20
|
+
* the script. The attachment needs no cooperation from the model: the program
|
|
21
|
+
* comes from the record (the row's `text` — what was SUBMITTED to the tool),
|
|
22
|
+
* so there is nothing to retype and nothing to check. When the model also
|
|
23
|
+
* showed a matched copy, the attachment is still appended: the model's copy
|
|
24
|
+
* never decides whether the authoritative one is delivered.
|
|
25
|
+
*
|
|
26
|
+
* ## What is attached (design § 4.1, § 4.4)
|
|
27
|
+
*
|
|
28
|
+
* - `which: 'last'` (default): the last call of the turn that REACHED the tool
|
|
29
|
+
* (its label is not `submitted`); `'all'`: every such call, at most
|
|
30
|
+
* {@link MAX_ATTACHED_SCRIPTS}, the rest counted in `omitted`.
|
|
31
|
+
* - `maxBytes` (default 4,000 UTF-8 bytes) bounds each program shown, cut at a
|
|
32
|
+
* code-point boundary; a cut says so — `[incomplete: showing N of M bytes —
|
|
33
|
+
* not the whole program]` and `truncated.shownBytes` — and is never
|
|
34
|
+
* advertised as a complete, reproducible program.
|
|
35
|
+
* - A program over `MAX_SCRIPT_BYTES` has no text on its row: it is counted in
|
|
36
|
+
* `omitted` and the text says "one script of N bytes is over the bound and
|
|
37
|
+
* is not shown". Calls past `MAX_SCRIPT_ROWS` have no row: counted too.
|
|
38
|
+
*
|
|
39
|
+
* Every line is library-authored and past tense, names the CALL (never a
|
|
40
|
+
* destination), and uses the label's words (`label.ts` · `labelWords`).
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```ts
|
|
44
|
+
* const data = scriptsOfAnswer(scriptRowsOfTurn(ledger, turn).current, { which: 'last', maxBytes: 4000 });
|
|
45
|
+
* scriptsBlock(data);
|
|
46
|
+
* // Script submitted to run_code on call c1 — completed, exit 0. Attached by the library from the run record:
|
|
47
|
+
* //
|
|
48
|
+
* // ```python
|
|
49
|
+
* // print(41 + 1)
|
|
50
|
+
* // ```
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
import { utf8Length, utf8Prefix } from '../../../lib/utf8.js';
|
|
54
|
+
import { codeRegionsOf } from '../evidence/codeRegions.js';
|
|
55
|
+
import { inertCode } from './inert.js';
|
|
56
|
+
import { exitCodeFits, labelWords, SCRIPT_LABELS } from './label.js';
|
|
57
|
+
import { MAX_SCRIPT_BYTES } from './rows.js';
|
|
58
|
+
import { wrapProgram } from './wrapper.js';
|
|
59
|
+
/** Scripts attached under `which: 'all'`; the rest are counted (`omitted`). Design § 4.1. */
|
|
60
|
+
export const MAX_ATTACHED_SCRIPTS = 8;
|
|
61
|
+
/** Default UTF-8 bytes of each program shown. Design § 4.1. */
|
|
62
|
+
export const DEFAULT_ATTACHED_BYTES = 4_000;
|
|
63
|
+
const DOOR = 'AgentBuilder.scriptTravelsWithTheAnswer';
|
|
64
|
+
/**
|
|
65
|
+
* Check `.scriptTravelsWithTheAnswer()`'s options once, at the call site, into
|
|
66
|
+
* the arm the chart carries. Refusals name the option and the fix.
|
|
67
|
+
*/
|
|
68
|
+
export function resolveScriptTravel(opts = {}) {
|
|
69
|
+
if (opts === null || typeof opts !== 'object' || Array.isArray(opts)) {
|
|
70
|
+
throw new Error(`${DOOR}: options must be an object ({ which?, maxBytes? }).`);
|
|
71
|
+
}
|
|
72
|
+
const unknown = Object.keys(opts).filter((k) => k !== 'which' && k !== 'maxBytes');
|
|
73
|
+
if (unknown.length > 0) {
|
|
74
|
+
throw new Error(`${DOOR}: unknown option(s) ${unknown.map((k) => `'${k}'`).join(', ')}. ` +
|
|
75
|
+
"The options are which ('last' | 'all') and maxBytes (UTF-8 bytes shown per program).");
|
|
76
|
+
}
|
|
77
|
+
const which = opts.which ?? 'last';
|
|
78
|
+
if (which !== 'last' && which !== 'all') {
|
|
79
|
+
throw new Error(`${DOOR}: which '${String(which)}' is not one this version has. Use 'last' (the last ` +
|
|
80
|
+
"call of the turn that reached the tool — the default) or 'all' (every such call, at " +
|
|
81
|
+
`most ${MAX_ATTACHED_SCRIPTS}).`);
|
|
82
|
+
}
|
|
83
|
+
const maxBytes = opts.maxBytes ?? DEFAULT_ATTACHED_BYTES;
|
|
84
|
+
if (!Number.isInteger(maxBytes) || maxBytes < 1) {
|
|
85
|
+
throw new Error(`${DOOR}: maxBytes must be a whole number of at least 1 — got ${String(opts.maxBytes)}. ` +
|
|
86
|
+
`It bounds the UTF-8 bytes of each program shown (default ${DEFAULT_ATTACHED_BYTES}); ` +
|
|
87
|
+
'a longer program is cut and says so.');
|
|
88
|
+
}
|
|
89
|
+
return { which, maxBytes };
|
|
90
|
+
}
|
|
91
|
+
/** A call that reached the tool — the attachment's candidates. */
|
|
92
|
+
const reached = (row) => row.outcome !== 'submitted';
|
|
93
|
+
/** One row as an attached script, cut at `maxBytes`. */
|
|
94
|
+
function shownFrom(row, maxBytes) {
|
|
95
|
+
const cut = utf8Prefix(row.text, maxBytes);
|
|
96
|
+
const shownBytes = cut === row.text ? row.bytes : utf8Length(cut);
|
|
97
|
+
return {
|
|
98
|
+
toolCallId: row.toolCallId,
|
|
99
|
+
dispatch: row.dispatch,
|
|
100
|
+
tool: row.tool,
|
|
101
|
+
...(row.language !== undefined && { language: row.language }),
|
|
102
|
+
label: row.outcome,
|
|
103
|
+
...(row.exitCode !== undefined && { exitCode: row.exitCode }),
|
|
104
|
+
...(row.resultWithheld !== undefined && { resultWithheld: row.resultWithheld }),
|
|
105
|
+
...(row.rewritten === true && { rewritten: true }),
|
|
106
|
+
bytes: row.bytes,
|
|
107
|
+
lines: row.lines,
|
|
108
|
+
...(cut !== row.text && { truncated: { shownBytes } }),
|
|
109
|
+
text: cut,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* What travels with this turn's answer — the data form (`turn_end.scripts`).
|
|
114
|
+
* `rows` is this turn's reading (`rows.ts` · `scriptRowsOfTurn`); fresh plain
|
|
115
|
+
* objects, never a reference into the ledger.
|
|
116
|
+
*/
|
|
117
|
+
export function scriptsOfAnswer(rows, travel, scriptsDropped = 0) {
|
|
118
|
+
const candidates = rows.filter(reached);
|
|
119
|
+
const chosen = travel.which === 'last' ? candidates.slice(-1) : candidates;
|
|
120
|
+
const shown = [];
|
|
121
|
+
const overSize = [];
|
|
122
|
+
let omitted = scriptsDropped;
|
|
123
|
+
for (const row of chosen) {
|
|
124
|
+
if (row.text === undefined) {
|
|
125
|
+
overSize.push(row);
|
|
126
|
+
omitted += 1;
|
|
127
|
+
}
|
|
128
|
+
else if (shown.length < MAX_ATTACHED_SCRIPTS) {
|
|
129
|
+
shown.push(shownFrom(row, travel.maxBytes));
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
omitted += 1;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return { shown, omitted, overSize };
|
|
136
|
+
}
|
|
137
|
+
/** The call a line names, and what its record says — every dynamic value inert (`inert.ts`). */
|
|
138
|
+
function callSaid(script) {
|
|
139
|
+
const withheld = script.resultWithheld === 'over-ceiling'
|
|
140
|
+
? "; its result was withheld over the tool's ceiling"
|
|
141
|
+
: '';
|
|
142
|
+
const rewritten = script.rewritten === true ? '; a before-tool rule changed it before dispatch' : '';
|
|
143
|
+
return (`Script submitted to ${inertCode(script.tool)} on call ${inertCode(script.toolCallId)} — ` +
|
|
144
|
+
`${labelWords(script.label, script.exitCode)}${withheld}${rewritten}.`);
|
|
145
|
+
}
|
|
146
|
+
/** The label line of one attached script — library words, past tense, the call named. */
|
|
147
|
+
export function scriptLabelLine(script) {
|
|
148
|
+
return `${callSaid(script)} Attached by the library from the run record:`;
|
|
149
|
+
}
|
|
150
|
+
/** The line that stands for a script whose program is kept out of the text (`withheldFromText`). */
|
|
151
|
+
export function scriptWithheldLine(script) {
|
|
152
|
+
return (`${callSaid(script)} The program is not shown here: the formatting above could display ` +
|
|
153
|
+
'part of it as ordinary text. It is kept on the run record.');
|
|
154
|
+
}
|
|
155
|
+
/** One attached script as text: its label line, then the program in the library's fence. */
|
|
156
|
+
export function shownScriptBlock(script) {
|
|
157
|
+
const body = `${scriptLabelLine(script)}\n\n${wrapProgram(script.text, script.language)}`;
|
|
158
|
+
if (script.truncated === undefined)
|
|
159
|
+
return body;
|
|
160
|
+
return (`${body}\n[incomplete: showing ${script.truncated.shownBytes} of ${script.bytes} bytes — ` +
|
|
161
|
+
'not the whole program]');
|
|
162
|
+
}
|
|
163
|
+
const CLEAN = { kind: 'clean' };
|
|
164
|
+
/** The boundary after `before` (see {@link AttachmentBoundary}). */
|
|
165
|
+
export function attachmentBoundary(before) {
|
|
166
|
+
if (before.length === 0)
|
|
167
|
+
return CLEAN;
|
|
168
|
+
const read = codeRegionsOf(`${before}\n`);
|
|
169
|
+
if (read.stoppedAt !== undefined)
|
|
170
|
+
return { kind: 'unsettled' };
|
|
171
|
+
if (read.openFence !== undefined)
|
|
172
|
+
return { kind: 'closed', fence: read.openFence };
|
|
173
|
+
return CLEAN;
|
|
174
|
+
}
|
|
175
|
+
const isObject = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
176
|
+
const isCount = (value) => typeof value === 'number' && Number.isInteger(value) && value >= 0;
|
|
177
|
+
/**
|
|
178
|
+
* The boundary a `turn_end.scripts` record states — `undefined` when the
|
|
179
|
+
* record holds a value no writer of this library files: a `closedFence` that
|
|
180
|
+
* is not `{ char: 'backtick' | 'tilde', length }` with a whole length of at
|
|
181
|
+
* least 3 and at most `within` (the answer the closing fence was written into
|
|
182
|
+
* — a fence longer than the text cannot be in it), a `withheldFromText` that
|
|
183
|
+
* is not `true`, or both at once.
|
|
184
|
+
*/
|
|
185
|
+
function recordedBoundary(scripts, within) {
|
|
186
|
+
const withheld = scripts.withheldFromText;
|
|
187
|
+
const closed = scripts.closedFence;
|
|
188
|
+
if (withheld !== undefined && withheld !== true)
|
|
189
|
+
return undefined;
|
|
190
|
+
if (closed === undefined)
|
|
191
|
+
return withheld === true ? { kind: 'unsettled' } : { kind: 'clean' };
|
|
192
|
+
if (withheld === true || !isObject(closed))
|
|
193
|
+
return undefined;
|
|
194
|
+
const char = closed.char;
|
|
195
|
+
if ((char !== 'backtick' && char !== 'tilde') || !isCount(closed.length))
|
|
196
|
+
return undefined;
|
|
197
|
+
if (closed.length < 3 || closed.length > within)
|
|
198
|
+
return undefined;
|
|
199
|
+
return { kind: 'closed', char, length: closed.length };
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* The boundary to rebuild a recorded text behind — `undefined` when its fence
|
|
203
|
+
* is longer than `within`, the text it would have to be found in: the one
|
|
204
|
+
* repetition a reader makes is bounded by what it reads.
|
|
205
|
+
*/
|
|
206
|
+
export function rebuildBoundary(recorded, within) {
|
|
207
|
+
if (recorded.kind !== 'closed')
|
|
208
|
+
return recorded;
|
|
209
|
+
if (recorded.length > within)
|
|
210
|
+
return undefined;
|
|
211
|
+
return { kind: 'closed', fence: (recorded.char === 'tilde' ? '~' : '`').repeat(recorded.length) };
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* One `turn_end.scripts.shown` entry, checked against what `shownFrom` writes
|
|
215
|
+
* — a fresh copy, or `undefined` when any field is one no writer of this
|
|
216
|
+
* library files: a call that never reached the tool (`submitted` is never
|
|
217
|
+
* attached), an exit code its label does not carry (`label.ts` ·
|
|
218
|
+
* `exitCodeFits`), a program over `MAX_SCRIPT_BYTES`, or a text whose UTF-8
|
|
219
|
+
* length is not the bytes it says it shows (`truncated.shownBytes` when cut,
|
|
220
|
+
* and then fewer than `bytes`; else `bytes`).
|
|
221
|
+
*/
|
|
222
|
+
function shownScriptOf(value) {
|
|
223
|
+
if (!isObject(value))
|
|
224
|
+
return undefined;
|
|
225
|
+
const v = value;
|
|
226
|
+
const { toolCallId, tool, text, bytes, lines, dispatch, label, exitCode } = v;
|
|
227
|
+
if (typeof toolCallId !== 'string' || typeof tool !== 'string')
|
|
228
|
+
return undefined;
|
|
229
|
+
if (typeof text !== 'string' || !isCount(bytes) || !isCount(lines))
|
|
230
|
+
return undefined;
|
|
231
|
+
if (!isCount(dispatch) || dispatch < 1)
|
|
232
|
+
return undefined;
|
|
233
|
+
if (label === 'submitted' || !SCRIPT_LABELS.includes(label)) {
|
|
234
|
+
return undefined;
|
|
235
|
+
}
|
|
236
|
+
if (!exitCodeFits(label, exitCode))
|
|
237
|
+
return undefined;
|
|
238
|
+
if (v.language !== undefined && typeof v.language !== 'string')
|
|
239
|
+
return undefined;
|
|
240
|
+
if (v.resultWithheld !== undefined && v.resultWithheld !== 'over-ceiling')
|
|
241
|
+
return undefined;
|
|
242
|
+
if (v.rewritten !== undefined && v.rewritten !== true)
|
|
243
|
+
return undefined;
|
|
244
|
+
if (bytes > MAX_SCRIPT_BYTES)
|
|
245
|
+
return undefined;
|
|
246
|
+
const cut = v.truncated;
|
|
247
|
+
let shownBytes = bytes;
|
|
248
|
+
if (cut !== undefined) {
|
|
249
|
+
if (!isObject(cut) || !isCount(cut.shownBytes) || cut.shownBytes >= bytes)
|
|
250
|
+
return undefined;
|
|
251
|
+
shownBytes = cut.shownBytes;
|
|
252
|
+
}
|
|
253
|
+
// A UTF-8 encoding is never shorter than the string's length in code
|
|
254
|
+
// units: a longer string is refused before it is measured.
|
|
255
|
+
if (text.length > shownBytes || utf8Length(text) !== shownBytes)
|
|
256
|
+
return undefined;
|
|
257
|
+
return {
|
|
258
|
+
toolCallId,
|
|
259
|
+
dispatch,
|
|
260
|
+
tool,
|
|
261
|
+
...(v.language !== undefined && { language: v.language }),
|
|
262
|
+
label: label,
|
|
263
|
+
...(exitCode !== undefined && { exitCode: exitCode }),
|
|
264
|
+
...(v.resultWithheld !== undefined && { resultWithheld: 'over-ceiling' }),
|
|
265
|
+
...(v.rewritten !== undefined && { rewritten: true }),
|
|
266
|
+
bytes,
|
|
267
|
+
lines,
|
|
268
|
+
...(cut !== undefined && { truncated: { shownBytes } }),
|
|
269
|
+
text,
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* A saved `turn_end.scripts` — THE reader of the shape for a reader of a
|
|
274
|
+
* record. `undefined` when the event carries no scripts arm. `within` is the
|
|
275
|
+
* length of the answer the block was appended to (a fence longer than it is
|
|
276
|
+
* refused). Bounded by the writer's cap: no reader iterates more entries
|
|
277
|
+
* than a writer attaches.
|
|
278
|
+
*/
|
|
279
|
+
export function recordedScripts(value, within = Number.MAX_SAFE_INTEGER) {
|
|
280
|
+
if (value === undefined)
|
|
281
|
+
return undefined;
|
|
282
|
+
if (!isObject(value) || !Array.isArray(value.shown))
|
|
283
|
+
return { shown: [], unread: 1 };
|
|
284
|
+
const all = value.shown;
|
|
285
|
+
const shown = [];
|
|
286
|
+
let unread = Math.max(0, all.length - MAX_ATTACHED_SCRIPTS);
|
|
287
|
+
for (let index = 0; index < Math.min(all.length, MAX_ATTACHED_SCRIPTS); index++) {
|
|
288
|
+
const script = shownScriptOf(all[index]);
|
|
289
|
+
if (script === undefined)
|
|
290
|
+
unread += 1;
|
|
291
|
+
else
|
|
292
|
+
shown.push({ index, script });
|
|
293
|
+
}
|
|
294
|
+
const omitted = isCount(value.omitted) ? value.omitted : undefined;
|
|
295
|
+
if (omitted === undefined)
|
|
296
|
+
unread += 1;
|
|
297
|
+
const boundary = recordedBoundary(value, within);
|
|
298
|
+
if (boundary === undefined)
|
|
299
|
+
unread += 1;
|
|
300
|
+
return {
|
|
301
|
+
shown,
|
|
302
|
+
unread,
|
|
303
|
+
...(omitted !== undefined && { omitted }),
|
|
304
|
+
...(boundary !== undefined && { boundary }),
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* The text form: one block per attached script, then one line per omission —
|
|
309
|
+
* `''` when nothing travels (the composer then appends nothing). Every cut and
|
|
310
|
+
* every omission is stated. Behind a `closed` boundary the block opens with
|
|
311
|
+
* the closing fence; behind an `unsettled` one each script is its label line
|
|
312
|
+
* alone (`scriptWithheldLine`) — the programs ride the data only.
|
|
313
|
+
*/
|
|
314
|
+
export function scriptsBlock(scripts, boundary = CLEAN) {
|
|
315
|
+
const parts = boundary.kind === 'unsettled'
|
|
316
|
+
? scripts.shown.map(scriptWithheldLine)
|
|
317
|
+
: scripts.shown.map(shownScriptBlock);
|
|
318
|
+
const overSize = scripts.overSize ?? [];
|
|
319
|
+
for (const row of overSize) {
|
|
320
|
+
parts.push(`One script of ${row.bytes} bytes (${inertCode(row.tool)}, call ${inertCode(row.toolCallId)}) is over the bound and is not shown.`);
|
|
321
|
+
}
|
|
322
|
+
const others = scripts.omitted - overSize.length;
|
|
323
|
+
if (others > 0) {
|
|
324
|
+
parts.push(`${others} more script${others === 1 ? ' was' : 's were'} submitted this turn and ` +
|
|
325
|
+
`${others === 1 ? 'is' : 'are'} not shown here.`);
|
|
326
|
+
}
|
|
327
|
+
if (parts.length === 0)
|
|
328
|
+
return '';
|
|
329
|
+
if (boundary.kind === 'closed')
|
|
330
|
+
parts.unshift(boundary.fence);
|
|
331
|
+
return parts.join('\n\n');
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* The text form behind the boundary the text before it leaves — `''` when
|
|
335
|
+
* nothing travels (no boundary is then taken). The second value is the
|
|
336
|
+
* boundary the text was written behind: what `turn_end.scripts` records.
|
|
337
|
+
*/
|
|
338
|
+
export function scriptsBlockAfter(scripts, before) {
|
|
339
|
+
if (scriptsBlock(scripts) === '')
|
|
340
|
+
return { text: '', boundary: CLEAN };
|
|
341
|
+
const boundary = attachmentBoundary(before);
|
|
342
|
+
return { text: scriptsBlock(scripts, boundary), boundary };
|
|
343
|
+
}
|
|
344
|
+
/** The data form as detached plain data — what `turn_end.scripts` carries. */
|
|
345
|
+
export function turnEndScriptsOf(scripts, boundary = CLEAN) {
|
|
346
|
+
return {
|
|
347
|
+
shown: scripts.shown.map((s) => ({
|
|
348
|
+
...s,
|
|
349
|
+
...(s.truncated !== undefined && { truncated: { shownBytes: s.truncated.shownBytes } }),
|
|
350
|
+
})),
|
|
351
|
+
omitted: scripts.omitted,
|
|
352
|
+
...(boundary.kind === 'closed' && {
|
|
353
|
+
closedFence: {
|
|
354
|
+
char: boundary.fence.charCodeAt(0) === 0x7e ? 'tilde' : 'backtick',
|
|
355
|
+
length: boundary.fence.length,
|
|
356
|
+
},
|
|
357
|
+
}),
|
|
358
|
+
...(boundary.kind === 'unsettled' && { withheldFromText: true }),
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
//# sourceMappingURL=attachment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachment.js","sourceRoot":"","sources":["../../../../../src/core/agent/scripts/attachment.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;AAEH,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC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,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC/B,GAAG,CAAC;YACJ,GAAG,CAAC,CAAC,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,CAAC,CAAC,SAAS,CAAC,UAAU,EAAE,EAAE,CAAC;SACxF,CAAC,CAAC;QACH,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,GAAG,CAAC,QAAQ,CAAC,IAAI,KAAK,QAAQ,IAAI;YAChC,WAAW,EAAE;gBACX,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAE,OAAiB,CAAC,CAAC,CAAE,UAAoB;gBACxF,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM;aAC9B;SACF,CAAC;QACF,GAAG,CAAC,QAAQ,CAAC,IAAI,KAAK,WAAW,IAAI,EAAE,gBAAgB,EAAE,IAAa,EAAE,CAAC;KAC1E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/inert — a dynamic value (a tool's name, a provider's call id) written
|
|
3
|
+
* into a library line as an inline code span that cannot leave its line.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: pure leaf.
|
|
6
|
+
* Role: core/ layer leaf, asked by the attachment's lines (`attachment.ts`)
|
|
7
|
+
* for every name and id they print.
|
|
8
|
+
* Emits: N/A.
|
|
9
|
+
*
|
|
10
|
+
* THE RULE. A provider may hand the library any string as a call id: line
|
|
11
|
+
* breaks, a sentence, a fence. Interpolated as it is, a blank line in an id ends
|
|
12
|
+
* the library's label paragraph, and the rest of the id renders as a paragraph
|
|
13
|
+
* of its own — text nobody checked, under the answer, in the library's voice.
|
|
14
|
+
* So a value is written as inline code:
|
|
15
|
+
*
|
|
16
|
+
* - every character that can end a line, turn the line's direction or hide
|
|
17
|
+
* (C0 and C1 controls, DEL, U+2028 and U+2029, format characters such as a
|
|
18
|
+
* bidi override or a zero-width joiner, a lone surrogate) is written as
|
|
19
|
+
* `\u{…}`, its code point in hex;
|
|
20
|
+
* - at most {@link MAX_INERT_POINTS} code points are written, then `…`;
|
|
21
|
+
* - the delimiter is one backtick longer than the longest run inside, with a
|
|
22
|
+
* space at either end when the value begins or ends with a backtick or a
|
|
23
|
+
* space (CommonMark's code-span rule), so nothing inside can close it.
|
|
24
|
+
*
|
|
25
|
+
* Inside a code span nothing is Markdown: no emphasis, no link, no HTML, no
|
|
26
|
+
* line ending. The value is shown, never interpreted.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* inertCode('c1'); // '`c1`'
|
|
31
|
+
* inertCode('c1\n\nRevenue was 98765.'); // '`c1\u{a}\u{a}Revenue was 98765.`'
|
|
32
|
+
* inertCode('a`b'); // '``a`b``'
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
/** Code points of a value written; the rest is `…`. */
|
|
36
|
+
export declare const MAX_INERT_POINTS = 64;
|
|
37
|
+
/** `value` as an inline code span that stays on its line. */
|
|
38
|
+
export declare function inertCode(value: string): string;
|