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,84 @@
|
|
|
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 const MAX_INERT_POINTS = 64;
|
|
37
|
+
const FORMAT = /\p{Cf}/u;
|
|
38
|
+
/** Whether one code point must be written as `\u{…}`. */
|
|
39
|
+
function escapes(point, char) {
|
|
40
|
+
if (point < 0x20 || point === 0x7f || (point >= 0x80 && point <= 0x9f))
|
|
41
|
+
return true;
|
|
42
|
+
if (point === 0x2028 || point === 0x2029)
|
|
43
|
+
return true;
|
|
44
|
+
if (point >= 0xd800 && point <= 0xdfff)
|
|
45
|
+
return true;
|
|
46
|
+
return FORMAT.test(char);
|
|
47
|
+
}
|
|
48
|
+
/** The longest run of backticks in `text`. */
|
|
49
|
+
function longestBacktickRun(text) {
|
|
50
|
+
let longest = 0;
|
|
51
|
+
let run = 0;
|
|
52
|
+
for (let i = 0; i < text.length; i++) {
|
|
53
|
+
if (text.charCodeAt(i) === 0x60) {
|
|
54
|
+
run += 1;
|
|
55
|
+
if (run > longest)
|
|
56
|
+
longest = run;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
run = 0;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return longest;
|
|
63
|
+
}
|
|
64
|
+
/** `value` as an inline code span that stays on its line. */
|
|
65
|
+
export function inertCode(value) {
|
|
66
|
+
let shown = '';
|
|
67
|
+
let points = 0;
|
|
68
|
+
for (const char of value) {
|
|
69
|
+
if (points === MAX_INERT_POINTS) {
|
|
70
|
+
shown += '…';
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
points += 1;
|
|
74
|
+
const point = char.codePointAt(0);
|
|
75
|
+
shown += escapes(point, char) ? `\\u{${point.toString(16)}}` : char;
|
|
76
|
+
}
|
|
77
|
+
if (shown.length === 0)
|
|
78
|
+
return '`(empty)`';
|
|
79
|
+
const fence = '`'.repeat(longestBacktickRun(shown) + 1);
|
|
80
|
+
const edge = (c) => c === '`' || c === ' ';
|
|
81
|
+
const pad = edge(shown[0]) || edge(shown[shown.length - 1]) ? ' ' : '';
|
|
82
|
+
return `${fence}${pad}${shown}${pad}${fence}`;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=inert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inert.js","sourceRoot":"","sources":["../../../../../src/core/agent/scripts/inert.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,uDAAuD;AACvD,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEnC,MAAM,MAAM,GAAG,SAAS,CAAC;AAEzB,yDAAyD;AACzD,SAAS,OAAO,CAAC,KAAa,EAAE,IAAY;IAC1C,IAAI,KAAK,GAAG,IAAI,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,IAAI,KAAK,IAAI,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACpF,IAAI,KAAK,KAAK,MAAM,IAAI,KAAK,KAAK,MAAM;QAAE,OAAO,IAAI,CAAC;IACtD,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,MAAM;QAAE,OAAO,IAAI,CAAC;IACpD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC3B,CAAC;AAED,8CAA8C;AAC9C,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,6DAA6D;AAC7D,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,IAAI,KAAK,GAAG,EAAE,CAAC;IACf,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,MAAM,KAAK,gBAAgB,EAAE,CAAC;YAChC,KAAK,IAAI,GAAG,CAAC;YACb,MAAM;QACR,CAAC;QACD,MAAM,IAAI,CAAC,CAAC;QACZ,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC,CAAW,CAAC;QAC5C,KAAK,IAAI,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;IACtE,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,WAAW,CAAC;IAC3C,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,kBAAkB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,CAAC,CAAqB,EAAW,EAAE,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC;IACxE,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;IACvE,OAAO,GAAG,KAAK,GAAG,GAAG,GAAG,KAAK,GAAG,GAAG,GAAG,KAAK,EAAE,CAAC;AAChD,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/judge — the evidence gate's ONE judge, with the script match in
|
|
3
|
+
* front of it.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: Decorator over the judge closure `stages/route.ts` ·
|
|
6
|
+
* `judgeEvidence` builds (the gate bound to this run's evidence).
|
|
7
|
+
* Role: core/ layer. Built only under `.namesAndNumbersFromEvidence({
|
|
8
|
+
* code: 'match' })`, on a prose answer (a typed answer is read as
|
|
9
|
+
* today — design § 12). The same decorated closure judges the draft
|
|
10
|
+
* and, for `.answerValidation()`, the delivered candidate.
|
|
11
|
+
* Emits: N/A — the Route decider emits `evidence_checked`, now carrying
|
|
12
|
+
* `scripts` and each unsupported value's `region`.
|
|
13
|
+
*
|
|
14
|
+
* What it adds, and nothing else: the matched blocks are cut out of the text
|
|
15
|
+
* the gate reads (`match.ts`), the verdict carries `scripts`, and each
|
|
16
|
+
* unsupported value says where it sat — `'code'` when every occurrence of it
|
|
17
|
+
* is inside an unmatched block, `'prose'` otherwise. The corpus and the
|
|
18
|
+
* exempt corpus are untouched: a matched script grounds nothing.
|
|
19
|
+
*/
|
|
20
|
+
import type { EvidenceVerdict } from '../evidence/types.js';
|
|
21
|
+
import type { TurnScripts } from './rows.js';
|
|
22
|
+
/** The gate's judge with the script match in front of it. */
|
|
23
|
+
export declare function scriptJudge(input: {
|
|
24
|
+
/** The gate's judge — `checkAnswer` bound to this run's evidence. */
|
|
25
|
+
readonly judgeProse: (text: string) => EvidenceVerdict;
|
|
26
|
+
/**
|
|
27
|
+
* The values the gate's extractor reads in a text, spelled as a verdict
|
|
28
|
+
* reports them (normalized, clipped) — asked of the answer with every block
|
|
29
|
+
* cut out, to place each unsupported value.
|
|
30
|
+
*/
|
|
31
|
+
readonly valuesIn: (text: string) => ReadonlySet<string>;
|
|
32
|
+
/** This turn's script rows (`rows.ts` · `scriptRowsOfTurn`). */
|
|
33
|
+
readonly turn: TurnScripts;
|
|
34
|
+
/** `AgentState.scriptsDropped`, when calls past the per-turn cap were dropped. */
|
|
35
|
+
readonly scriptsDropped?: number;
|
|
36
|
+
}): (text: string) => EvidenceVerdict;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/judge — the evidence gate's ONE judge, with the script match in
|
|
3
|
+
* front of it.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: Decorator over the judge closure `stages/route.ts` ·
|
|
6
|
+
* `judgeEvidence` builds (the gate bound to this run's evidence).
|
|
7
|
+
* Role: core/ layer. Built only under `.namesAndNumbersFromEvidence({
|
|
8
|
+
* code: 'match' })`, on a prose answer (a typed answer is read as
|
|
9
|
+
* today — design § 12). The same decorated closure judges the draft
|
|
10
|
+
* and, for `.answerValidation()`, the delivered candidate.
|
|
11
|
+
* Emits: N/A — the Route decider emits `evidence_checked`, now carrying
|
|
12
|
+
* `scripts` and each unsupported value's `region`.
|
|
13
|
+
*
|
|
14
|
+
* What it adds, and nothing else: the matched blocks are cut out of the text
|
|
15
|
+
* the gate reads (`match.ts`), the verdict carries `scripts`, and each
|
|
16
|
+
* unsupported value says where it sat — `'code'` when every occurrence of it
|
|
17
|
+
* is inside an unmatched block, `'prose'` otherwise. The corpus and the
|
|
18
|
+
* exempt corpus are untouched: a matched script grounds nothing.
|
|
19
|
+
*/
|
|
20
|
+
import { readShownScripts } from './match.js';
|
|
21
|
+
/** The gate's judge with the script match in front of it. */
|
|
22
|
+
export function scriptJudge(input) {
|
|
23
|
+
return (text) => {
|
|
24
|
+
const shown = readShownScripts(text, input.turn, input.scriptsDropped);
|
|
25
|
+
const verdict = input.judgeProse(shown.prose);
|
|
26
|
+
const inProse = verdict.unsupported.length > 0 ? input.valuesIn(shown.outsideCode) : new Set();
|
|
27
|
+
return {
|
|
28
|
+
...verdict,
|
|
29
|
+
unsupported: verdict.unsupported.map((value) => ({
|
|
30
|
+
...value,
|
|
31
|
+
region: inProse.has(value.value) ? 'prose' : 'code',
|
|
32
|
+
})),
|
|
33
|
+
scripts: shown.verdict,
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=judge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"judge.js","sourceRoot":"","sources":["../../../../../src/core/agent/scripts/judge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAG9C,6DAA6D;AAC7D,MAAM,UAAU,WAAW,CAAC,KAa3B;IACC,OAAO,CAAC,IAAI,EAAE,EAAE;QACd,MAAM,KAAK,GAAG,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;QACvE,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC9C,MAAM,OAAO,GACX,OAAO,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,EAAU,CAAC;QACzF,OAAO;YACL,GAAG,OAAO;YACV,WAAW,EAAE,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;gBAC/C,GAAG,KAAK;gBACR,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAE,OAAiB,CAAC,CAAC,CAAE,MAAgB;aAC1E,CAAC,CAAC;YACH,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/label — the ONE rule that turns a code call's record into a label,
|
|
3
|
+
* and the label's words.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: pure function over two separate facts (design § 4.3).
|
|
6
|
+
* Role: core/ layer leaf. Asked by the dispatch loop when it files a call's
|
|
7
|
+
* `script` row (`rows.ts` · `scriptRowFor`); every sentence that names
|
|
8
|
+
* an outcome — the attachment's label line, the recovery clause, the
|
|
9
|
+
* answer account — reads the row's label through {@link labelWords}.
|
|
10
|
+
* Emits: N/A.
|
|
11
|
+
*
|
|
12
|
+
* ## Three facts, read in one order
|
|
13
|
+
*
|
|
14
|
+
* The record holds three facts about a code call, written by three mechanisms:
|
|
15
|
+
* EXECUTION evidence (the runner's facts — `codeRunnerTool.ts` ·
|
|
16
|
+
* `CodeRunFacts`, taken right after `tool.execute` returns), call SETTLEMENT
|
|
17
|
+
* (did the call return, throw, or never enter `execute`) and result DELIVERY
|
|
18
|
+
* (the tool's ceiling replaced the payload). A label is read from execution
|
|
19
|
+
* evidence first, then settlement, and NEVER from delivery: a withheld result
|
|
20
|
+
* does not undo a completed execution (it rides the row as `resultWithheld`).
|
|
21
|
+
*
|
|
22
|
+
* | the record says | label |
|
|
23
|
+
* |---|---|
|
|
24
|
+
* | an explicit `exitCode: 0` | `completed` |
|
|
25
|
+
* | an explicit non-zero `exitCode` (a whole number — {@link isExitCode}) | `completed-with-failure` |
|
|
26
|
+
* | `serviceError` and no exit code | `outcome-unknown` |
|
|
27
|
+
* | `ok: true`, no exit code | `reported-success` |
|
|
28
|
+
* | `ok: false`, no exit code, no service error (a stopped process included) | `reported-failure` |
|
|
29
|
+
* | facts that report no outcome (`ok` absent, no exit code) | — no execution evidence: the settlement decides |
|
|
30
|
+
* | no facts, the call returned | `returned` |
|
|
31
|
+
* | no facts, the call threw (a timeout, a cancellation, a staging refusal) | `outcome-unknown` |
|
|
32
|
+
* | the call never entered `execute` (or has not settled) | `submitted` |
|
|
33
|
+
*
|
|
34
|
+
* Only an explicit exit code proves the program reached an exit. `ok` is a
|
|
35
|
+
* VERDICT: it never yields `completed`, and no word here prints an exit number
|
|
36
|
+
* the record does not hold.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* scriptLabelOf({ settlement: 'returned', facts: { exitCode: 0 } }); // { label: 'completed', exitCode: 0 }
|
|
41
|
+
* scriptLabelOf({ settlement: 'returned', facts: { ok: false, serviceError: true } }); // { label: 'outcome-unknown', serviceError: true }
|
|
42
|
+
* scriptLabelOf({ settlement: 'threw' }); // { label: 'outcome-unknown' }
|
|
43
|
+
* labelWords('completed-with-failure', 7); // 'completed with failure, exit 7'
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
import type { ScriptLabel } from './types.js';
|
|
47
|
+
/** How a call settled, as the dispatch loop knows it. */
|
|
48
|
+
export type CallSettlement =
|
|
49
|
+
/** Never entered `execute`: not dispatched, refused before it, or still open. */
|
|
50
|
+
'not-entered'
|
|
51
|
+
/** `execute` returned a result. */
|
|
52
|
+
| 'returned'
|
|
53
|
+
/** `execute` was entered and threw (a timeout, a cancellation, any error). */
|
|
54
|
+
| 'threw';
|
|
55
|
+
/** The runner facts a label reads — `CodeRunFacts`' outcome half. */
|
|
56
|
+
export interface RunnerOutcome {
|
|
57
|
+
readonly ok?: boolean;
|
|
58
|
+
readonly exitCode?: number;
|
|
59
|
+
readonly serviceError?: true;
|
|
60
|
+
readonly terminatedBy?: string;
|
|
61
|
+
}
|
|
62
|
+
/** A label, with the facts it may print. */
|
|
63
|
+
export interface ScriptOutcome {
|
|
64
|
+
readonly label: ScriptLabel;
|
|
65
|
+
/** Exactly the runner's, only when it supplied one. */
|
|
66
|
+
readonly exitCode?: number;
|
|
67
|
+
/** The failure verdict was the service's, with no exit code. */
|
|
68
|
+
readonly serviceError?: true;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Whether `value` is an exit code: a whole number, as a process reports one
|
|
72
|
+
* (a negative one included — a signal, on some runtimes). THE rule for every
|
|
73
|
+
* writer and reader of a script's exit code — the label below, and the
|
|
74
|
+
* readers of a saved record (`rows.ts` · `scriptRowIsWellFormed`,
|
|
75
|
+
* `attachment.ts` · `recordedScripts`, `match.ts` · `recordedBlocks`), so the
|
|
76
|
+
* writer never files a row the checkpoint door refuses. A runner that reports
|
|
77
|
+
* anything else (`1.5`, `NaN`) reported no exit code.
|
|
78
|
+
*/
|
|
79
|
+
export declare const isExitCode: (value: unknown) => value is number;
|
|
80
|
+
/**
|
|
81
|
+
* Whether a recorded label and exit code agree, as {@link scriptLabelOf}
|
|
82
|
+
* writes them: an exit code rides exactly the two labels one proves — `0` on
|
|
83
|
+
* `completed`, any other on `completed-with-failure` — and no other label.
|
|
84
|
+
* A record where they disagree holds a value no writer of this library files.
|
|
85
|
+
*/
|
|
86
|
+
export declare function exitCodeFits(label: unknown, exitCode: unknown): boolean;
|
|
87
|
+
/**
|
|
88
|
+
* The label of one call — execution evidence first, then settlement. `facts`
|
|
89
|
+
* is ABSENT when the tool filed none (a declared tool that is not
|
|
90
|
+
* `codeRunnerTool`, or a call that never reached its runner).
|
|
91
|
+
*/
|
|
92
|
+
export declare function scriptLabelOf(input: {
|
|
93
|
+
readonly settlement: CallSettlement;
|
|
94
|
+
readonly facts?: RunnerOutcome;
|
|
95
|
+
}): ScriptOutcome;
|
|
96
|
+
/**
|
|
97
|
+
* The label's own words — the one phrase every library sentence about a call's
|
|
98
|
+
* outcome uses (design § 4.3). `exitCode` is printed only for
|
|
99
|
+
* `completed-with-failure`, and only the number the record holds.
|
|
100
|
+
*/
|
|
101
|
+
export declare function labelWords(label: ScriptLabel, exitCode?: number): string;
|
|
102
|
+
/** Every label, in the design's order — for a reader that validates one. */
|
|
103
|
+
export declare const SCRIPT_LABELS: readonly ScriptLabel[];
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/label — the ONE rule that turns a code call's record into a label,
|
|
3
|
+
* and the label's words.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: pure function over two separate facts (design § 4.3).
|
|
6
|
+
* Role: core/ layer leaf. Asked by the dispatch loop when it files a call's
|
|
7
|
+
* `script` row (`rows.ts` · `scriptRowFor`); every sentence that names
|
|
8
|
+
* an outcome — the attachment's label line, the recovery clause, the
|
|
9
|
+
* answer account — reads the row's label through {@link labelWords}.
|
|
10
|
+
* Emits: N/A.
|
|
11
|
+
*
|
|
12
|
+
* ## Three facts, read in one order
|
|
13
|
+
*
|
|
14
|
+
* The record holds three facts about a code call, written by three mechanisms:
|
|
15
|
+
* EXECUTION evidence (the runner's facts — `codeRunnerTool.ts` ·
|
|
16
|
+
* `CodeRunFacts`, taken right after `tool.execute` returns), call SETTLEMENT
|
|
17
|
+
* (did the call return, throw, or never enter `execute`) and result DELIVERY
|
|
18
|
+
* (the tool's ceiling replaced the payload). A label is read from execution
|
|
19
|
+
* evidence first, then settlement, and NEVER from delivery: a withheld result
|
|
20
|
+
* does not undo a completed execution (it rides the row as `resultWithheld`).
|
|
21
|
+
*
|
|
22
|
+
* | the record says | label |
|
|
23
|
+
* |---|---|
|
|
24
|
+
* | an explicit `exitCode: 0` | `completed` |
|
|
25
|
+
* | an explicit non-zero `exitCode` (a whole number — {@link isExitCode}) | `completed-with-failure` |
|
|
26
|
+
* | `serviceError` and no exit code | `outcome-unknown` |
|
|
27
|
+
* | `ok: true`, no exit code | `reported-success` |
|
|
28
|
+
* | `ok: false`, no exit code, no service error (a stopped process included) | `reported-failure` |
|
|
29
|
+
* | facts that report no outcome (`ok` absent, no exit code) | — no execution evidence: the settlement decides |
|
|
30
|
+
* | no facts, the call returned | `returned` |
|
|
31
|
+
* | no facts, the call threw (a timeout, a cancellation, a staging refusal) | `outcome-unknown` |
|
|
32
|
+
* | the call never entered `execute` (or has not settled) | `submitted` |
|
|
33
|
+
*
|
|
34
|
+
* Only an explicit exit code proves the program reached an exit. `ok` is a
|
|
35
|
+
* VERDICT: it never yields `completed`, and no word here prints an exit number
|
|
36
|
+
* the record does not hold.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* scriptLabelOf({ settlement: 'returned', facts: { exitCode: 0 } }); // { label: 'completed', exitCode: 0 }
|
|
41
|
+
* scriptLabelOf({ settlement: 'returned', facts: { ok: false, serviceError: true } }); // { label: 'outcome-unknown', serviceError: true }
|
|
42
|
+
* scriptLabelOf({ settlement: 'threw' }); // { label: 'outcome-unknown' }
|
|
43
|
+
* labelWords('completed-with-failure', 7); // 'completed with failure, exit 7'
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* Whether `value` is an exit code: a whole number, as a process reports one
|
|
48
|
+
* (a negative one included — a signal, on some runtimes). THE rule for every
|
|
49
|
+
* writer and reader of a script's exit code — the label below, and the
|
|
50
|
+
* readers of a saved record (`rows.ts` · `scriptRowIsWellFormed`,
|
|
51
|
+
* `attachment.ts` · `recordedScripts`, `match.ts` · `recordedBlocks`), so the
|
|
52
|
+
* writer never files a row the checkpoint door refuses. A runner that reports
|
|
53
|
+
* anything else (`1.5`, `NaN`) reported no exit code.
|
|
54
|
+
*/
|
|
55
|
+
export const isExitCode = (value) => Number.isInteger(value);
|
|
56
|
+
/**
|
|
57
|
+
* Whether a recorded label and exit code agree, as {@link scriptLabelOf}
|
|
58
|
+
* writes them: an exit code rides exactly the two labels one proves — `0` on
|
|
59
|
+
* `completed`, any other on `completed-with-failure` — and no other label.
|
|
60
|
+
* A record where they disagree holds a value no writer of this library files.
|
|
61
|
+
*/
|
|
62
|
+
export function exitCodeFits(label, exitCode) {
|
|
63
|
+
if (label === 'completed')
|
|
64
|
+
return exitCode === 0;
|
|
65
|
+
if (label === 'completed-with-failure')
|
|
66
|
+
return isExitCode(exitCode) && exitCode !== 0;
|
|
67
|
+
return exitCode === undefined;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* The label of one call — execution evidence first, then settlement. `facts`
|
|
71
|
+
* is ABSENT when the tool filed none (a declared tool that is not
|
|
72
|
+
* `codeRunnerTool`, or a call that never reached its runner).
|
|
73
|
+
*/
|
|
74
|
+
export function scriptLabelOf(input) {
|
|
75
|
+
const facts = input.facts;
|
|
76
|
+
if (facts !== undefined) {
|
|
77
|
+
if (isExitCode(facts.exitCode)) {
|
|
78
|
+
return {
|
|
79
|
+
label: facts.exitCode === 0 ? 'completed' : 'completed-with-failure',
|
|
80
|
+
exitCode: facts.exitCode,
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if (facts.serviceError === true)
|
|
84
|
+
return { label: 'outcome-unknown', serviceError: true };
|
|
85
|
+
if (facts.ok === true)
|
|
86
|
+
return { label: 'reported-success' };
|
|
87
|
+
if (facts.ok === false)
|
|
88
|
+
return { label: 'reported-failure' };
|
|
89
|
+
// Facts with no outcome in them — the runner reported neither an exit code
|
|
90
|
+
// nor a verdict — are no execution evidence: the settlement decides below.
|
|
91
|
+
}
|
|
92
|
+
switch (input.settlement) {
|
|
93
|
+
case 'not-entered':
|
|
94
|
+
return { label: 'submitted' };
|
|
95
|
+
case 'returned':
|
|
96
|
+
return { label: 'returned' };
|
|
97
|
+
case 'threw':
|
|
98
|
+
return { label: 'outcome-unknown' };
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* The label's own words — the one phrase every library sentence about a call's
|
|
103
|
+
* outcome uses (design § 4.3). `exitCode` is printed only for
|
|
104
|
+
* `completed-with-failure`, and only the number the record holds.
|
|
105
|
+
*/
|
|
106
|
+
export function labelWords(label, exitCode) {
|
|
107
|
+
switch (label) {
|
|
108
|
+
case 'submitted':
|
|
109
|
+
return 'submitted';
|
|
110
|
+
case 'returned':
|
|
111
|
+
return 'tool call returned; execution not confirmed';
|
|
112
|
+
case 'reported-success':
|
|
113
|
+
return 'runner reported success; no exit code';
|
|
114
|
+
case 'reported-failure':
|
|
115
|
+
return 'runner reported failure; no exit code';
|
|
116
|
+
case 'completed':
|
|
117
|
+
return 'completed, exit 0';
|
|
118
|
+
case 'completed-with-failure':
|
|
119
|
+
return exitCode === undefined
|
|
120
|
+
? 'completed with failure'
|
|
121
|
+
: `completed with failure, exit ${exitCode}`;
|
|
122
|
+
case 'outcome-unknown':
|
|
123
|
+
return 'outcome unknown';
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
/** Every label, in the design's order — for a reader that validates one. */
|
|
127
|
+
export const SCRIPT_LABELS = Object.freeze([
|
|
128
|
+
'submitted',
|
|
129
|
+
'returned',
|
|
130
|
+
'reported-success',
|
|
131
|
+
'reported-failure',
|
|
132
|
+
'completed',
|
|
133
|
+
'completed-with-failure',
|
|
134
|
+
'outcome-unknown',
|
|
135
|
+
]);
|
|
136
|
+
//# sourceMappingURL=label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label.js","sourceRoot":"","sources":["../../../../../src/core/agent/scripts/label.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AA8BH;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,KAAc,EAAmB,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;AAEvF;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,KAAc,EAAE,QAAiB;IAC5D,IAAI,KAAK,KAAK,WAAW;QAAE,OAAO,QAAQ,KAAK,CAAC,CAAC;IACjD,IAAI,KAAK,KAAK,wBAAwB;QAAE,OAAO,UAAU,CAAC,QAAQ,CAAC,IAAI,QAAQ,KAAK,CAAC,CAAC;IACtF,OAAO,QAAQ,KAAK,SAAS,CAAC;AAChC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,KAG7B;IACC,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAC1B,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,IAAI,UAAU,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/B,OAAO;gBACL,KAAK,EAAE,KAAK,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,wBAAwB;gBACpE,QAAQ,EAAE,KAAK,CAAC,QAAQ;aACzB,CAAC;QACJ,CAAC;QACD,IAAI,KAAK,CAAC,YAAY,KAAK,IAAI;YAAE,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC;QACzF,IAAI,KAAK,CAAC,EAAE,KAAK,IAAI;YAAE,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC;QAC5D,IAAI,KAAK,CAAC,EAAE,KAAK,KAAK;YAAE,OAAO,EAAE,KAAK,EAAE,kBAAkB,EAAE,CAAC;QAC7D,2EAA2E;QAC3E,2EAA2E;IAC7E,CAAC;IACD,QAAQ,KAAK,CAAC,UAAU,EAAE,CAAC;QACzB,KAAK,aAAa;YAChB,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;QAChC,KAAK,UAAU;YACb,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC;QAC/B,KAAK,OAAO;YACV,OAAO,EAAE,KAAK,EAAE,iBAAiB,EAAE,CAAC;IACxC,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,KAAkB,EAAE,QAAiB;IAC9D,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,WAAW;YACd,OAAO,WAAW,CAAC;QACrB,KAAK,UAAU;YACb,OAAO,6CAA6C,CAAC;QACvD,KAAK,kBAAkB;YACrB,OAAO,uCAAuC,CAAC;QACjD,KAAK,kBAAkB;YACrB,OAAO,uCAAuC,CAAC;QACjD,KAAK,WAAW;YACd,OAAO,mBAAmB,CAAC;QAC7B,KAAK,wBAAwB;YAC3B,OAAO,QAAQ,KAAK,SAAS;gBAC3B,CAAC,CAAC,wBAAwB;gBAC1B,CAAC,CAAC,gCAAgC,QAAQ,EAAE,CAAC;QACjD,KAAK,iBAAiB;YACpB,OAAO,iBAAiB,CAAC;IAC7B,CAAC;AACH,CAAC;AAED,4EAA4E;AAC5E,MAAM,CAAC,MAAM,aAAa,GAA2B,MAAM,CAAC,MAAM,CAAC;IACjE,WAAW;IACX,UAAU;IACV,kBAAkB;IAClB,kBAAkB;IAClB,WAAW;IACX,wBAAwB;IACxB,iBAAiB;CAClB,CAAC,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/match — is a fenced block the program ONE call of this turn
|
|
3
|
+
* submitted? Identity against the record, never evidence for a value.
|
|
4
|
+
*
|
|
5
|
+
* Pattern: pure function over the answer and this turn's rows.
|
|
6
|
+
* Role: core/ layer. Asked inside the ONE judge closure the Route decider
|
|
7
|
+
* builds (`stages/route.ts` · `judgeEvidence`, through `judge.ts`),
|
|
8
|
+
* before the names-and-numbers extractor reads the text — so the
|
|
9
|
+
* draft and the delivered candidate are read alike. Only under
|
|
10
|
+
* `.namesAndNumbersFromEvidence({ code: 'match' })`.
|
|
11
|
+
* Emits: N/A.
|
|
12
|
+
*
|
|
13
|
+
* ## The match rule: exact, after removing only the wrapper (design § 5.2)
|
|
14
|
+
*
|
|
15
|
+
* A block matches a call only when its content (`../evidence/codeRegions.ts`)
|
|
16
|
+
* equals the program the call SUBMITTED to the tool, byte for byte. Nothing is
|
|
17
|
+
* transformed: no trailing-space strip, no line-ending rewrite, no Unicode
|
|
18
|
+
* normalization, no shape, no edit distance — each can change a literal and so
|
|
19
|
+
* the program (`print(len("""A \nB"""))` prints 5, its copy without the two
|
|
20
|
+
* spaces 3; `"é"` written with a combining mark is one more character than its
|
|
21
|
+
* NFC form). The strings are compared as they hold the text (UTF-16 code
|
|
22
|
+
* units): for well-formed text that is UTF-8 byte equality, and for a lone
|
|
23
|
+
* surrogate it is stricter, the safe direction.
|
|
24
|
+
*
|
|
25
|
+
* - Against the rows of the CURRENT TURN only; earlier turns are counted
|
|
26
|
+
* (`earlierTurnRows`), never compared, and a miss says "no submission of
|
|
27
|
+
* this turn", never "no submission".
|
|
28
|
+
* - A block over `MAX_SCRIPT_BYTES` is `over-size`: no row keeps a program
|
|
29
|
+
* that long, so it is never compared.
|
|
30
|
+
* - Two calls that submitted byte-identical programs: the block names the
|
|
31
|
+
* LATEST, counts the rest (`alsoMatches`) and carries its label.
|
|
32
|
+
* - No nearest submission is ever named: a near match is a different program.
|
|
33
|
+
*
|
|
34
|
+
* WHAT A MATCH YIELDS. The block is script content: it is cut out of the text
|
|
35
|
+
* the extractor reads, so it yields no value candidates — and it grounds
|
|
36
|
+
* nothing: the evidence corpus is untouched, so a value in the prose that also
|
|
37
|
+
* sits in the script still needs a result. A MISS stays in the text and is
|
|
38
|
+
* checked as prose, exactly as today.
|
|
39
|
+
*
|
|
40
|
+
* COST. One linear scan of the answer (`codeRegionsOf`); each of at most
|
|
41
|
+
* `MAX_CODE_REGIONS` blocks is looked up once among at most `MAX_SCRIPT_ROWS`
|
|
42
|
+
* programs of at most `MAX_SCRIPT_BYTES` — within the 512 comparisons per
|
|
43
|
+
* judged answer of design § 4.4. Earlier turns add nothing.
|
|
44
|
+
*/
|
|
45
|
+
import { type TurnScripts } from './rows.js';
|
|
46
|
+
import type { ScriptBlockVerdict, ScriptsVerdict, UnmatchedReason } from './types.js';
|
|
47
|
+
/** One answer, read for its scripts. */
|
|
48
|
+
export interface ShownScripts {
|
|
49
|
+
/** The answer with every MATCHED block cut out — what the extractor reads. */
|
|
50
|
+
readonly prose: string;
|
|
51
|
+
/** The answer with EVERY block cut out — "the prose", for `unsupported[].region`. */
|
|
52
|
+
readonly outsideCode: string;
|
|
53
|
+
readonly verdict: ScriptsVerdict;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Read `answer`'s fenced blocks against this turn's submissions. Pure; the
|
|
57
|
+
* rows are `rows.ts` · `scriptRowsOfTurn`'s reading (last row per call).
|
|
58
|
+
*/
|
|
59
|
+
export declare function readShownScripts(answer: string, turn: TurnScripts, scriptsDropped?: number): ShownScripts;
|
|
60
|
+
/**
|
|
61
|
+
* A verdict as detached plain data — field by field, never a reference into
|
|
62
|
+
* state (a value read back through a TypedScope is a live view, and an event
|
|
63
|
+
* payload must be plain data).
|
|
64
|
+
*/
|
|
65
|
+
export declare function copyScriptsVerdict(verdict: ScriptsVerdict): ScriptsVerdict;
|
|
66
|
+
/** Every reason a block can be unmatched for. */
|
|
67
|
+
export declare const UNMATCHED_REASONS: readonly UnmatchedReason[];
|
|
68
|
+
/**
|
|
69
|
+
* One block verdict's fields, checked as {@link readShownScripts} writes them
|
|
70
|
+
* — a fresh copy, or `undefined` when any field is one no writer of this
|
|
71
|
+
* library files: a position or a dispatch that is not a whole number from 1,
|
|
72
|
+
* a label outside the vocabulary, an exit code its label does not carry
|
|
73
|
+
* (`label.ts` · `exitCodeFits`), an unmatched block that names a call, a
|
|
74
|
+
* matched one without its call. Fields beside these (a witness row's `kind`,
|
|
75
|
+
* `turn`, `iteration`) are not read.
|
|
76
|
+
*/
|
|
77
|
+
export declare function blockVerdictOf(value: unknown): ScriptBlockVerdict | undefined;
|
|
78
|
+
/** One block verdict read back, at its position in the record's `blocks`. */
|
|
79
|
+
export interface RecordedBlock {
|
|
80
|
+
readonly index: number;
|
|
81
|
+
readonly verdict: ScriptBlockVerdict;
|
|
82
|
+
}
|
|
83
|
+
/** A saved `evidence_checked.scripts`, read back. */
|
|
84
|
+
export interface RecordedBlocks {
|
|
85
|
+
/** The verdicts a writer of this library files, at their record position. */
|
|
86
|
+
readonly blocks: readonly RecordedBlock[];
|
|
87
|
+
/**
|
|
88
|
+
* What no writer files, counted once each: a verdict that does not read
|
|
89
|
+
* back, every verdict past `MAX_CODE_REGIONS` (the writer reads no more
|
|
90
|
+
* blocks), or a `scripts` value that is not `{ blocks: [...] }`.
|
|
91
|
+
*/
|
|
92
|
+
readonly unread: number;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* A saved `evidence_checked.scripts` — THE reader of the shape for a reader
|
|
96
|
+
* of a record. `undefined` when the event carries no scripts arm. Bounded by
|
|
97
|
+
* the writer's cap: no reader iterates more verdicts than a writer files.
|
|
98
|
+
*/
|
|
99
|
+
export declare function recordedBlocks(value: unknown): RecordedBlocks | undefined;
|