agentfootprint 9.75.0 → 9.76.1
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/CHANGELOG.md +94 -0
- package/CLAUDE.md +22 -18
- package/dist/artifacts/index.js +3 -1
- package/dist/artifacts/index.js.map +1 -1
- package/dist/artifacts/recordingArtifact.js +47 -1
- package/dist/artifacts/recordingArtifact.js.map +1 -1
- package/dist/core/Agent.js +30 -0
- package/dist/core/Agent.js.map +1 -1
- package/dist/core/agent/stages/toolCalls.js +42 -0
- package/dist/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/core/agent/toolDispatch.js +101 -0
- package/dist/core/agent/toolDispatch.js.map +1 -0
- package/dist/core/flowchartAsTool.js +9 -2
- package/dist/core/flowchartAsTool.js.map +1 -1
- package/dist/core/runbook/coverage.js +162 -0
- package/dist/core/runbook/coverage.js.map +1 -0
- package/dist/core/runbook/dispatch.js +119 -0
- package/dist/core/runbook/dispatch.js.map +1 -0
- package/dist/core/runbook/index.js +24 -0
- package/dist/core/runbook/index.js.map +1 -0
- package/dist/core/runbook/report.js +69 -0
- package/dist/core/runbook/report.js.map +1 -0
- package/dist/core/runbook/runbookAsTool.js +381 -0
- package/dist/core/runbook/runbookAsTool.js.map +1 -0
- package/dist/core/runbook/types.js +22 -0
- package/dist/core/runbook/types.js.map +1 -0
- package/dist/core/runbook/verdicts.js +156 -0
- package/dist/core/runbook/verdicts.js.map +1 -0
- package/dist/core/runbook/walk.js +115 -0
- package/dist/core/runbook/walk.js.map +1 -0
- package/dist/core/tools.js +55 -1
- package/dist/core/tools.js.map +1 -1
- package/dist/esm/artifacts/index.d.ts +1 -1
- package/dist/esm/artifacts/index.js +1 -1
- package/dist/esm/artifacts/index.js.map +1 -1
- package/dist/esm/artifacts/recordingArtifact.d.ts +36 -0
- package/dist/esm/artifacts/recordingArtifact.js +45 -0
- package/dist/esm/artifacts/recordingArtifact.js.map +1 -1
- package/dist/esm/core/Agent.js +30 -0
- package/dist/esm/core/Agent.js.map +1 -1
- package/dist/esm/core/agent/stages/toolCalls.js +42 -0
- package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
- package/dist/esm/core/agent/toolDispatch.d.ts +50 -0
- package/dist/esm/core/agent/toolDispatch.js +97 -0
- package/dist/esm/core/agent/toolDispatch.js.map +1 -0
- package/dist/esm/core/flowchartAsTool.d.ts +6 -0
- package/dist/esm/core/flowchartAsTool.js +9 -2
- package/dist/esm/core/flowchartAsTool.js.map +1 -1
- package/dist/esm/core/runbook/coverage.d.ts +69 -0
- package/dist/esm/core/runbook/coverage.js +155 -0
- package/dist/esm/core/runbook/coverage.js.map +1 -0
- package/dist/esm/core/runbook/dispatch.d.ts +69 -0
- package/dist/esm/core/runbook/dispatch.js +112 -0
- package/dist/esm/core/runbook/dispatch.js.map +1 -0
- package/dist/esm/core/runbook/index.d.ts +9 -0
- package/dist/esm/core/runbook/index.js +9 -0
- package/dist/esm/core/runbook/index.js.map +1 -0
- package/dist/esm/core/runbook/report.d.ts +52 -0
- package/dist/esm/core/runbook/report.js +64 -0
- package/dist/esm/core/runbook/report.js.map +1 -0
- package/dist/esm/core/runbook/runbookAsTool.d.ts +90 -0
- package/dist/esm/core/runbook/runbookAsTool.js +377 -0
- package/dist/esm/core/runbook/runbookAsTool.js.map +1 -0
- package/dist/esm/core/runbook/types.d.ts +203 -0
- package/dist/esm/core/runbook/types.js +21 -0
- package/dist/esm/core/runbook/types.js.map +1 -0
- package/dist/esm/core/runbook/verdicts.d.ts +78 -0
- package/dist/esm/core/runbook/verdicts.js +148 -0
- package/dist/esm/core/runbook/verdicts.js.map +1 -0
- package/dist/esm/core/runbook/walk.d.ts +72 -0
- package/dist/esm/core/runbook/walk.js +110 -0
- package/dist/esm/core/runbook/walk.js.map +1 -0
- package/dist/esm/core/tools.d.ts +112 -0
- package/dist/esm/core/tools.js +52 -0
- package/dist/esm/core/tools.js.map +1 -1
- package/dist/esm/index.d.ts +4 -3
- package/dist/esm/index.js +19 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/mcp/toolExtras.d.ts +8 -0
- package/dist/esm/lib/mcp/toolExtras.js +7 -1
- package/dist/esm/lib/mcp/toolExtras.js.map +1 -1
- package/dist/index.js +97 -66
- package/dist/index.js.map +1 -1
- package/dist/lib/mcp/toolExtras.js +6 -0
- package/dist/lib/mcp/toolExtras.js.map +1 -1
- package/dist/types/artifacts/index.d.ts +1 -1
- package/dist/types/artifacts/index.d.ts.map +1 -1
- package/dist/types/artifacts/recordingArtifact.d.ts +36 -0
- package/dist/types/artifacts/recordingArtifact.d.ts.map +1 -1
- package/dist/types/core/Agent.d.ts.map +1 -1
- package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
- package/dist/types/core/agent/toolDispatch.d.ts +51 -0
- package/dist/types/core/agent/toolDispatch.d.ts.map +1 -0
- package/dist/types/core/flowchartAsTool.d.ts +6 -0
- package/dist/types/core/flowchartAsTool.d.ts.map +1 -1
- package/dist/types/core/runbook/coverage.d.ts +70 -0
- package/dist/types/core/runbook/coverage.d.ts.map +1 -0
- package/dist/types/core/runbook/dispatch.d.ts +70 -0
- package/dist/types/core/runbook/dispatch.d.ts.map +1 -0
- package/dist/types/core/runbook/index.d.ts +10 -0
- package/dist/types/core/runbook/index.d.ts.map +1 -0
- package/dist/types/core/runbook/report.d.ts +53 -0
- package/dist/types/core/runbook/report.d.ts.map +1 -0
- package/dist/types/core/runbook/runbookAsTool.d.ts +91 -0
- package/dist/types/core/runbook/runbookAsTool.d.ts.map +1 -0
- package/dist/types/core/runbook/types.d.ts +204 -0
- package/dist/types/core/runbook/types.d.ts.map +1 -0
- package/dist/types/core/runbook/verdicts.d.ts +79 -0
- package/dist/types/core/runbook/verdicts.d.ts.map +1 -0
- package/dist/types/core/runbook/walk.d.ts +73 -0
- package/dist/types/core/runbook/walk.d.ts.map +1 -0
- package/dist/types/core/tools.d.ts +112 -0
- package/dist/types/core/tools.d.ts.map +1 -1
- package/dist/types/index.d.ts +4 -3
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/lib/mcp/toolExtras.d.ts +8 -0
- package/dist/types/lib/mcp/toolExtras.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* runbookAsTool — turn a written operational procedure into a tool whose
|
|
3
|
+
* every answer is EVIDENCE: who decided what, against which threshold, on
|
|
4
|
+
* which rule version, with the recorded walk to check it against.
|
|
5
|
+
*
|
|
6
|
+
* The standard bridge from a footprintjs chart to the Agent's tool surface.
|
|
7
|
+
* Where `flowchartAsTool` returns bare `JSON.stringify(values)`,
|
|
8
|
+
* runbookAsTool supplies the missing middle — the honesty envelope every
|
|
9
|
+
* hand-rolled triage tool was building for itself:
|
|
10
|
+
*
|
|
11
|
+
* THE MANDATORY SPINE (every runbook, whatever its shape):
|
|
12
|
+
* - `af_coverage` — the three-list ledger, with every INNER tool's own
|
|
13
|
+
* ledger folded upward through the run's dispatch, plus the sentence
|
|
14
|
+
* naming the rule set and version;
|
|
15
|
+
* - `result.af_provenance` — re-emitted FIRST (a carried `LOCAL SEED`
|
|
16
|
+
* confession survives composition);
|
|
17
|
+
* - `result.rule_version` — the declared rules' version, or the honest
|
|
18
|
+
* `'undeclared'`;
|
|
19
|
+
* - `result.walk` — the recorded walk's descriptor. The walk itself
|
|
20
|
+
* ships as an artifact ticket (kind `recording/chart-walk`), never as
|
|
21
|
+
* bytes; when it does not fit, the CONTROL FLOW survives and the
|
|
22
|
+
* projection is declared.
|
|
23
|
+
*
|
|
24
|
+
* THE OPTIONAL PROJECTION (selected by `resultKind: 'verdict/*'`):
|
|
25
|
+
* verdict rows off the chart's `verdicts` state key, capped with
|
|
26
|
+
* truthful counters, a pre-rendered table over the SAME rows, and
|
|
27
|
+
* `verdict_meanings` GENERATED from the decider's declared branches +
|
|
28
|
+
* the rule labels this run's decide() evidence carried.
|
|
29
|
+
*
|
|
30
|
+
* THREE OUTCOMES, honestly: a clean envelope; an inner ABSENCE passed
|
|
31
|
+
* through verbatim (the framework still reads it as an absence); and
|
|
32
|
+
* DECLINED rows counted into the ledger as not-checked ground.
|
|
33
|
+
*
|
|
34
|
+
* The procedure is a FACTORY invoked per call with the run's own tool
|
|
35
|
+
* dispatch (`ctx.tools`) — fresh chart every run, stages close over the
|
|
36
|
+
* dispatch, and every inner tool's honesty ledger folds into this tool's
|
|
37
|
+
* answer.
|
|
38
|
+
*
|
|
39
|
+
* Reserved state keys the bridge reads off the final scope:
|
|
40
|
+
* - `verdicts` — the rowset (verdict projection only);
|
|
41
|
+
* - `coverage` — chart-declared coverage entries (`{checked?, not_checked?,
|
|
42
|
+
* cannot_cover?}`);
|
|
43
|
+
* - `report` — the app's own result fields, spread into `result` verbatim
|
|
44
|
+
* BESIDE the spine, never over it: the envelope's own names (the spine
|
|
45
|
+
* plus the projection this run assembled) are reserved, and a report
|
|
46
|
+
* field spelling one of them is discarded and NAMED in `report_note`.
|
|
47
|
+
*
|
|
48
|
+
* Pause: NOT yet bridged. A paused inner chart throws with the checkpoint
|
|
49
|
+
* attached, exactly like `flowchartAsTool` — the approval-gate integration
|
|
50
|
+
* is the next phase of the runbook program.
|
|
51
|
+
*
|
|
52
|
+
* @example the smallest legal call — still yields the honest spine
|
|
53
|
+
* const tool = runbookAsTool({
|
|
54
|
+
* name: 'restart_check',
|
|
55
|
+
* description: 'Run the restart-safety procedure.',
|
|
56
|
+
* procedure: () =>
|
|
57
|
+
* flowChart<{ safe: boolean }>('restart-safety', (scope) => {
|
|
58
|
+
* scope.safe = true;
|
|
59
|
+
* }, 'check').build(),
|
|
60
|
+
* });
|
|
61
|
+
*
|
|
62
|
+
* @example a triage runbook with rules, verdicts, and an inner tool
|
|
63
|
+
* const triage = runbookAsTool({
|
|
64
|
+
* name: 'backup_triage',
|
|
65
|
+
* description: 'Assess backup protection posture for every subject.',
|
|
66
|
+
* resultKind: 'verdict/backup-posture',
|
|
67
|
+
* rules: { name: 'health-signal', version: 'v1' },
|
|
68
|
+
* verdicts: { decider: 'posture' },
|
|
69
|
+
* composedOf: ['backup_inventory'],
|
|
70
|
+
* procedure: (tools) =>
|
|
71
|
+
* flowChart<TriageState>('backup-triage', async (scope) => {
|
|
72
|
+
* const inner = (await tools.call('backup_inventory', {})) as InventoryResult;
|
|
73
|
+
* scope.subjects = inner.result.rows;
|
|
74
|
+
* }, 'inventory')
|
|
75
|
+
* .addDeciderFunction('Posture', postureDecider, 'posture')
|
|
76
|
+
* .addFunctionBranch('protected', 'Protected', landProtected)
|
|
77
|
+
* .addFunctionBranch('unprotected', 'Unprotected', landUnprotected)
|
|
78
|
+
* .end()
|
|
79
|
+
* .build(),
|
|
80
|
+
* });
|
|
81
|
+
*/
|
|
82
|
+
import { type Tool } from '../tools.js';
|
|
83
|
+
import type { RunbookAsToolOptions } from './types.js';
|
|
84
|
+
/**
|
|
85
|
+
* Wrap a footprintjs procedure as a `Tool` whose every answer carries the
|
|
86
|
+
* honesty spine. See the module header for the envelope; see
|
|
87
|
+
* {@link RunbookAsToolOptions} for the full options bag. The smallest legal
|
|
88
|
+
* call is `{ name, description, procedure }`.
|
|
89
|
+
*/
|
|
90
|
+
export declare function runbookAsTool(opts: RunbookAsToolOptions): Tool;
|
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* runbookAsTool — turn a written operational procedure into a tool whose
|
|
3
|
+
* every answer is EVIDENCE: who decided what, against which threshold, on
|
|
4
|
+
* which rule version, with the recorded walk to check it against.
|
|
5
|
+
*
|
|
6
|
+
* The standard bridge from a footprintjs chart to the Agent's tool surface.
|
|
7
|
+
* Where `flowchartAsTool` returns bare `JSON.stringify(values)`,
|
|
8
|
+
* runbookAsTool supplies the missing middle — the honesty envelope every
|
|
9
|
+
* hand-rolled triage tool was building for itself:
|
|
10
|
+
*
|
|
11
|
+
* THE MANDATORY SPINE (every runbook, whatever its shape):
|
|
12
|
+
* - `af_coverage` — the three-list ledger, with every INNER tool's own
|
|
13
|
+
* ledger folded upward through the run's dispatch, plus the sentence
|
|
14
|
+
* naming the rule set and version;
|
|
15
|
+
* - `result.af_provenance` — re-emitted FIRST (a carried `LOCAL SEED`
|
|
16
|
+
* confession survives composition);
|
|
17
|
+
* - `result.rule_version` — the declared rules' version, or the honest
|
|
18
|
+
* `'undeclared'`;
|
|
19
|
+
* - `result.walk` — the recorded walk's descriptor. The walk itself
|
|
20
|
+
* ships as an artifact ticket (kind `recording/chart-walk`), never as
|
|
21
|
+
* bytes; when it does not fit, the CONTROL FLOW survives and the
|
|
22
|
+
* projection is declared.
|
|
23
|
+
*
|
|
24
|
+
* THE OPTIONAL PROJECTION (selected by `resultKind: 'verdict/*'`):
|
|
25
|
+
* verdict rows off the chart's `verdicts` state key, capped with
|
|
26
|
+
* truthful counters, a pre-rendered table over the SAME rows, and
|
|
27
|
+
* `verdict_meanings` GENERATED from the decider's declared branches +
|
|
28
|
+
* the rule labels this run's decide() evidence carried.
|
|
29
|
+
*
|
|
30
|
+
* THREE OUTCOMES, honestly: a clean envelope; an inner ABSENCE passed
|
|
31
|
+
* through verbatim (the framework still reads it as an absence); and
|
|
32
|
+
* DECLINED rows counted into the ledger as not-checked ground.
|
|
33
|
+
*
|
|
34
|
+
* The procedure is a FACTORY invoked per call with the run's own tool
|
|
35
|
+
* dispatch (`ctx.tools`) — fresh chart every run, stages close over the
|
|
36
|
+
* dispatch, and every inner tool's honesty ledger folds into this tool's
|
|
37
|
+
* answer.
|
|
38
|
+
*
|
|
39
|
+
* Reserved state keys the bridge reads off the final scope:
|
|
40
|
+
* - `verdicts` — the rowset (verdict projection only);
|
|
41
|
+
* - `coverage` — chart-declared coverage entries (`{checked?, not_checked?,
|
|
42
|
+
* cannot_cover?}`);
|
|
43
|
+
* - `report` — the app's own result fields, spread into `result` verbatim
|
|
44
|
+
* BESIDE the spine, never over it: the envelope's own names (the spine
|
|
45
|
+
* plus the projection this run assembled) are reserved, and a report
|
|
46
|
+
* field spelling one of them is discarded and NAMED in `report_note`.
|
|
47
|
+
*
|
|
48
|
+
* Pause: NOT yet bridged. A paused inner chart throws with the checkpoint
|
|
49
|
+
* attached, exactly like `flowchartAsTool` — the approval-gate integration
|
|
50
|
+
* is the next phase of the runbook program.
|
|
51
|
+
*
|
|
52
|
+
* @example the smallest legal call — still yields the honest spine
|
|
53
|
+
* const tool = runbookAsTool({
|
|
54
|
+
* name: 'restart_check',
|
|
55
|
+
* description: 'Run the restart-safety procedure.',
|
|
56
|
+
* procedure: () =>
|
|
57
|
+
* flowChart<{ safe: boolean }>('restart-safety', (scope) => {
|
|
58
|
+
* scope.safe = true;
|
|
59
|
+
* }, 'check').build(),
|
|
60
|
+
* });
|
|
61
|
+
*
|
|
62
|
+
* @example a triage runbook with rules, verdicts, and an inner tool
|
|
63
|
+
* const triage = runbookAsTool({
|
|
64
|
+
* name: 'backup_triage',
|
|
65
|
+
* description: 'Assess backup protection posture for every subject.',
|
|
66
|
+
* resultKind: 'verdict/backup-posture',
|
|
67
|
+
* rules: { name: 'health-signal', version: 'v1' },
|
|
68
|
+
* verdicts: { decider: 'posture' },
|
|
69
|
+
* composedOf: ['backup_inventory'],
|
|
70
|
+
* procedure: (tools) =>
|
|
71
|
+
* flowChart<TriageState>('backup-triage', async (scope) => {
|
|
72
|
+
* const inner = (await tools.call('backup_inventory', {})) as InventoryResult;
|
|
73
|
+
* scope.subjects = inner.result.rows;
|
|
74
|
+
* }, 'inventory')
|
|
75
|
+
* .addDeciderFunction('Posture', postureDecider, 'posture')
|
|
76
|
+
* .addFunctionBranch('protected', 'Protected', landProtected)
|
|
77
|
+
* .addFunctionBranch('unprotected', 'Unprotected', landUnprotected)
|
|
78
|
+
* .end()
|
|
79
|
+
* .build(),
|
|
80
|
+
* });
|
|
81
|
+
*/
|
|
82
|
+
import { FlowChartExecutor, narrative } from 'footprintjs';
|
|
83
|
+
import { controlDepRecorder } from 'footprintjs/trace';
|
|
84
|
+
import { DEFAULT_INNER_RUN_LIMIT, INNER_RUN_RECORDS, innerRunStore, } from '../../lib/trace-toolpack/innerRunRecords.js';
|
|
85
|
+
import { defineTool } from '../tools.js';
|
|
86
|
+
import { carriedProvenanceOf, chartCoverageOf, composeLedger, foldInnerCoverage, } from './coverage.js';
|
|
87
|
+
import { absenceSignalOf, probeDispatch, recordingDispatch } from './dispatch.js';
|
|
88
|
+
import { admitReport, REPORT_NOTE_KEY, shadowedFieldsNote } from './report.js';
|
|
89
|
+
import { composeMeanings, DECLINED_VERDICT, DEFAULT_MAX_ROWS, meaningsRecorder, renderVerdictTable, resolveDecider, VERDICT_RENDER_NOTE, verdictRowsOf, } from './verdicts.js';
|
|
90
|
+
import { DEFAULT_WALK_CAP, mintWalk, projectWalk } from './walk.js';
|
|
91
|
+
/** The projection selector: a `resultKind` in the `verdict/` namespace gets
|
|
92
|
+
* the rowset projection; every other kind ships the spine plus the chart's
|
|
93
|
+
* own `report`. */
|
|
94
|
+
const VERDICT_KIND_PREFIX = 'verdict/';
|
|
95
|
+
function bagOf(value) {
|
|
96
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value)
|
|
97
|
+
? value
|
|
98
|
+
: undefined;
|
|
99
|
+
}
|
|
100
|
+
/** Lift the chart's declared input schema when it is a PLAIN JSON-Schema
|
|
101
|
+
* object. A parseable schema (`.safeParse`/`.parse` — zod et al.) validates
|
|
102
|
+
* at the executor but cannot be serialized for the model: skipped, default
|
|
103
|
+
* applies. */
|
|
104
|
+
function liftInputSchema(chart) {
|
|
105
|
+
const schema = bagOf(chart.inputSchema);
|
|
106
|
+
if (schema === undefined)
|
|
107
|
+
return undefined;
|
|
108
|
+
const parseable = typeof schema.safeParse === 'function' ||
|
|
109
|
+
typeof schema.parse === 'function';
|
|
110
|
+
return parseable ? undefined : schema;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Wrap a footprintjs procedure as a `Tool` whose every answer carries the
|
|
114
|
+
* honesty spine. See the module header for the envelope; see
|
|
115
|
+
* {@link RunbookAsToolOptions} for the full options bag. The smallest legal
|
|
116
|
+
* call is `{ name, description, procedure }`.
|
|
117
|
+
*/
|
|
118
|
+
export function runbookAsTool(opts) {
|
|
119
|
+
const label = `runbookAsTool(${opts.name || '?'})`;
|
|
120
|
+
if (!opts.name || opts.name.trim().length === 0) {
|
|
121
|
+
throw new Error('runbookAsTool: `name` is required and must be non-empty.');
|
|
122
|
+
}
|
|
123
|
+
if (!opts.description || opts.description.length === 0) {
|
|
124
|
+
throw new Error(`${label}: \`description\` is required — a description-less tool is invisible to the model.`);
|
|
125
|
+
}
|
|
126
|
+
if (typeof opts.procedure !== 'function') {
|
|
127
|
+
throw new Error(`${label}: \`procedure\` is required — a factory invoked per call with the run's ` +
|
|
128
|
+
`tool dispatch, returning a built chart. (Migrating from flowchartAsTool? Wrap ` +
|
|
129
|
+
`your chart: \`procedure: () => chart\` builds it fresh each run.)`);
|
|
130
|
+
}
|
|
131
|
+
if (opts.rules !== undefined) {
|
|
132
|
+
const { name, version } = opts.rules;
|
|
133
|
+
if (typeof name !== 'string' ||
|
|
134
|
+
name.trim() === '' ||
|
|
135
|
+
typeof version !== 'string' ||
|
|
136
|
+
version.trim() === '') {
|
|
137
|
+
throw new Error(`${label}: \`rules\` must carry a non-empty name and version — it is the provenance ` +
|
|
138
|
+
`stamp every evidence sentence names. Got ${JSON.stringify(opts.rules)}.`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
if (opts.verdicts !== undefined) {
|
|
142
|
+
if (typeof opts.verdicts.decider !== 'string' || opts.verdicts.decider.trim() === '') {
|
|
143
|
+
throw new Error(`${label}: \`verdicts.decider\` must name the decider stage whose branches generate ` +
|
|
144
|
+
`verdict_meanings. Got ${JSON.stringify(opts.verdicts.decider)}.`);
|
|
145
|
+
}
|
|
146
|
+
const maxRows = opts.verdicts.maxRows;
|
|
147
|
+
if (maxRows !== undefined && (!Number.isInteger(maxRows) || maxRows < 1)) {
|
|
148
|
+
throw new Error(`${label}: \`verdicts.maxRows\` must be a whole number of rows, at least 1 — got ` +
|
|
149
|
+
`${String(maxRows)}.`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
const cap = opts.walk?.cap;
|
|
153
|
+
if (cap !== undefined && (!Number.isInteger(cap) || cap < 1)) {
|
|
154
|
+
throw new Error(`${label}: \`walk.cap\` must be a whole number of rows, at least 1 — got ${String(cap)}.`);
|
|
155
|
+
}
|
|
156
|
+
if (opts.keepRecordLimit !== undefined) {
|
|
157
|
+
if (opts.keepRecord !== true) {
|
|
158
|
+
throw new Error(`${label}: \`keepRecordLimit\` caps records that are never kept — add ` +
|
|
159
|
+
`\`keepRecord: true\`, or drop the limit.`);
|
|
160
|
+
}
|
|
161
|
+
if (!Number.isInteger(opts.keepRecordLimit) || opts.keepRecordLimit < 1) {
|
|
162
|
+
throw new Error(`${label}: \`keepRecordLimit\` must be a whole number of invocations, at least 1 — ` +
|
|
163
|
+
`got ${String(opts.keepRecordLimit)}.`);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// ── Definition-time probe: read the chart's declared contract ─────────
|
|
167
|
+
let probeChart;
|
|
168
|
+
try {
|
|
169
|
+
probeChart = opts.procedure(probeDispatch(opts.name));
|
|
170
|
+
}
|
|
171
|
+
catch (err) {
|
|
172
|
+
throw new Error(`${label}: the procedure factory threw at the definition probe — ` +
|
|
173
|
+
`${err instanceof Error ? err.message : String(err)}. The factory is invoked once ` +
|
|
174
|
+
`at definition (stage bodies do not run) to read the chart's declared contract; ` +
|
|
175
|
+
`it must be side-effect-free at build.`);
|
|
176
|
+
}
|
|
177
|
+
if (probeChart === null ||
|
|
178
|
+
typeof probeChart !== 'object' ||
|
|
179
|
+
typeof probeChart.stageMap !== 'object') {
|
|
180
|
+
throw new Error(`${label}: \`procedure\` must return a BUILT chart (call .build() on the builder).`);
|
|
181
|
+
}
|
|
182
|
+
const inputSchema = opts.inputSchema ?? liftInputSchema(probeChart);
|
|
183
|
+
const isVerdictKind = opts.resultKind?.startsWith(VERDICT_KIND_PREFIX) === true;
|
|
184
|
+
const maxRows = opts.verdicts?.maxRows ?? DEFAULT_MAX_ROWS;
|
|
185
|
+
const walkCap = opts.walk?.cap ?? DEFAULT_WALK_CAP;
|
|
186
|
+
const store = opts.keepRecord === true
|
|
187
|
+
? innerRunStore(opts.keepRecordLimit ?? DEFAULT_INNER_RUN_LIMIT)
|
|
188
|
+
: undefined;
|
|
189
|
+
const tool = defineTool({
|
|
190
|
+
name: opts.name,
|
|
191
|
+
description: opts.description,
|
|
192
|
+
...(inputSchema !== undefined && { inputSchema }),
|
|
193
|
+
// GAP-8 closed: the rail-read declarations forward verbatim.
|
|
194
|
+
...(opts.resultKind !== undefined && { resultKind: opts.resultKind }),
|
|
195
|
+
...(opts.resultClass !== undefined && { resultClass: opts.resultClass }),
|
|
196
|
+
...(opts.owner !== undefined && { owner: opts.owner }),
|
|
197
|
+
...(opts.resultCeiling !== undefined && { resultCeiling: opts.resultCeiling }),
|
|
198
|
+
...(opts.wants !== undefined && { wants: opts.wants }),
|
|
199
|
+
...(opts.argumentsFrom !== undefined && { argumentsFrom: opts.argumentsFrom }),
|
|
200
|
+
...(opts.composedOf !== undefined && { composedOf: opts.composedOf }),
|
|
201
|
+
execute: async (args, ctx) => {
|
|
202
|
+
const dispatch = recordingDispatch(ctx.tools, opts.name);
|
|
203
|
+
const chart = opts.procedure(dispatch.tools);
|
|
204
|
+
const executor = new FlowChartExecutor(chart);
|
|
205
|
+
if (opts.redact)
|
|
206
|
+
executor.setRedactionPolicy(opts.redact);
|
|
207
|
+
for (const recorder of opts.recorders ?? []) {
|
|
208
|
+
executor.attachCombinedRecorder(recorder);
|
|
209
|
+
}
|
|
210
|
+
// Values off: the walk is about the DECISIONS — a per-key value dump
|
|
211
|
+
// would bury six branch choices under four hundred reads.
|
|
212
|
+
const walkRecorder = narrative({ includeValues: false });
|
|
213
|
+
executor.attachCombinedRecorder(walkRecorder);
|
|
214
|
+
// Meanings harvest — resolve the decider on THIS run's chart (a fresh
|
|
215
|
+
// chart per call; the static branches are the same, the resolution is
|
|
216
|
+
// cheap) and collect rule labels as the evidence fires.
|
|
217
|
+
const identity = opts.verdicts !== undefined ? resolveDecider(chart, opts.verdicts.decider) : undefined;
|
|
218
|
+
const harvest = identity !== undefined ? meaningsRecorder(identity) : undefined;
|
|
219
|
+
if (harvest !== undefined)
|
|
220
|
+
executor.attachCombinedRecorder(harvest.recorder);
|
|
221
|
+
const ctrl = store ? controlDepRecorder() : undefined;
|
|
222
|
+
if (ctrl)
|
|
223
|
+
executor.attachCombinedRecorder(ctrl);
|
|
224
|
+
const keepRecordOf = (outcome, known) => {
|
|
225
|
+
if (!store)
|
|
226
|
+
return;
|
|
227
|
+
try {
|
|
228
|
+
const snapshot = known ?? executor.getSnapshot();
|
|
229
|
+
const commitLog = snapshot.commitLog;
|
|
230
|
+
const lines = walkRecorder.getEntries()
|
|
231
|
+
.map((entry) => entry.text)
|
|
232
|
+
.filter((text) => typeof text === 'string' && text.length > 0);
|
|
233
|
+
store.keep({
|
|
234
|
+
toolCallId: ctx.toolCallId,
|
|
235
|
+
toolName: opts.name,
|
|
236
|
+
outcome,
|
|
237
|
+
steps: Array.isArray(commitLog) ? commitLog.length : 0,
|
|
238
|
+
recording: {
|
|
239
|
+
snapshot,
|
|
240
|
+
structure: chart.buildTimeStructure,
|
|
241
|
+
},
|
|
242
|
+
...(ctrl !== undefined && { controlDeps: ctrl.asLookup() }),
|
|
243
|
+
...(lines.length > 0 && { narrative: lines }),
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
catch (e) {
|
|
247
|
+
store.keep({
|
|
248
|
+
toolCallId: ctx.toolCallId,
|
|
249
|
+
toolName: opts.name,
|
|
250
|
+
outcome,
|
|
251
|
+
steps: 0,
|
|
252
|
+
problem: e instanceof Error ? e.message : String(e),
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
};
|
|
256
|
+
const env = {};
|
|
257
|
+
if (ctx.signal)
|
|
258
|
+
env.signal = ctx.signal;
|
|
259
|
+
try {
|
|
260
|
+
await executor.run({ input: args, env });
|
|
261
|
+
}
|
|
262
|
+
catch (e) {
|
|
263
|
+
const signal = absenceSignalOf(e);
|
|
264
|
+
if (signal !== undefined) {
|
|
265
|
+
// ABSENCE PASS-THROUGH: the inner source answered "I looked and
|
|
266
|
+
// there is nothing", and the runbook has nothing to add. It goes
|
|
267
|
+
// back EXACTLY as it arrived so the framework still reads it as an
|
|
268
|
+
// absence. The kept record files as 'error' — the closed outcome
|
|
269
|
+
// word nearest "the traversal ended on a thrown signal".
|
|
270
|
+
keepRecordOf('error');
|
|
271
|
+
return signal.absence;
|
|
272
|
+
}
|
|
273
|
+
keepRecordOf('error');
|
|
274
|
+
throw e;
|
|
275
|
+
}
|
|
276
|
+
if (executor.isPaused()) {
|
|
277
|
+
keepRecordOf('paused');
|
|
278
|
+
const err = new Error(`${label}: the inner chart paused. Approval-gate integration (typed resume ` +
|
|
279
|
+
`through agent.resume) is the runbook program's next phase; until it lands a ` +
|
|
280
|
+
`paused procedure cannot be resumed through the tool boundary. The checkpoint ` +
|
|
281
|
+
`is on err.checkpoint.`);
|
|
282
|
+
err.checkpoint = executor.getCheckpoint();
|
|
283
|
+
throw err;
|
|
284
|
+
}
|
|
285
|
+
const raw = executor.getSnapshot();
|
|
286
|
+
keepRecordOf('ok', raw);
|
|
287
|
+
const state = raw.sharedState ??
|
|
288
|
+
raw.values ??
|
|
289
|
+
{};
|
|
290
|
+
// ── The walk ────────────────────────────────────────────────────────
|
|
291
|
+
const entries = walkRecorder.getEntries();
|
|
292
|
+
const projected = projectWalk(entries, walkCap);
|
|
293
|
+
const walk = await mintWalk(ctx, projected, {
|
|
294
|
+
toolName: opts.name,
|
|
295
|
+
toolCallId: ctx.toolCallId,
|
|
296
|
+
...(ctx.runId !== undefined && { runId: ctx.runId }),
|
|
297
|
+
stepsExecuted: walkRecorder.stepCount,
|
|
298
|
+
});
|
|
299
|
+
// ── The projection (verdict kinds only) ─────────────────────────────
|
|
300
|
+
let rows;
|
|
301
|
+
let shown;
|
|
302
|
+
let declined;
|
|
303
|
+
if (isVerdictKind) {
|
|
304
|
+
rows = verdictRowsOf(state);
|
|
305
|
+
shown = rows.slice(0, maxRows);
|
|
306
|
+
declined = rows.filter((row) => row.verdict === DECLINED_VERDICT).length;
|
|
307
|
+
}
|
|
308
|
+
const meanings = identity !== undefined && harvest !== undefined
|
|
309
|
+
? composeMeanings(identity, harvest.observed)
|
|
310
|
+
: undefined;
|
|
311
|
+
// ── The ledger ──────────────────────────────────────────────────────
|
|
312
|
+
// The procedure's display name: the chart's own root name (what the
|
|
313
|
+
// author called it) — the tool name is the fallback, never the
|
|
314
|
+
// auto-generated multi-line description.
|
|
315
|
+
const chartName = chart.buildTimeStructure?.name ?? opts.name;
|
|
316
|
+
const ledger = composeLedger(foldInnerCoverage(dispatch.records), chartCoverageOf(state), {
|
|
317
|
+
chartName,
|
|
318
|
+
stepsExecuted: walkRecorder.stepCount,
|
|
319
|
+
...(opts.rules !== undefined && { rules: opts.rules }),
|
|
320
|
+
...(rows !== undefined && { rowsTotal: rows.length }),
|
|
321
|
+
...(declined !== undefined && { declinedRows: declined }),
|
|
322
|
+
});
|
|
323
|
+
// ── Provenance — re-emitted FIRST ───────────────────────────────────
|
|
324
|
+
const af_provenance = {
|
|
325
|
+
...carriedProvenanceOf(dispatch.records),
|
|
326
|
+
tool: opts.name,
|
|
327
|
+
toolCallId: ctx.toolCallId,
|
|
328
|
+
};
|
|
329
|
+
// ── The envelope ────────────────────────────────────────────────────
|
|
330
|
+
// The spine and the projection are assembled FIRST, and the chart's
|
|
331
|
+
// `report` is admitted against the names they took: spine keys win, as
|
|
332
|
+
// the contract says, by explicit precedence rather than by spread order
|
|
333
|
+
// (which had the report land on top of `af_provenance` and
|
|
334
|
+
// `rule_version`). A refused field is named in `report_note` — see
|
|
335
|
+
// report.ts for the law and why the refusal is spoken.
|
|
336
|
+
const spine = {
|
|
337
|
+
af_provenance,
|
|
338
|
+
rule_version: opts.rules?.version ?? 'undeclared',
|
|
339
|
+
walk,
|
|
340
|
+
};
|
|
341
|
+
const projection = shown !== undefined && rows !== undefined
|
|
342
|
+
? {
|
|
343
|
+
verdicts: shown,
|
|
344
|
+
rows_shown: shown.length,
|
|
345
|
+
rows_total: rows.length,
|
|
346
|
+
rows_complete: shown.length === rows.length,
|
|
347
|
+
table: renderVerdictTable(shown),
|
|
348
|
+
render_note: VERDICT_RENDER_NOTE,
|
|
349
|
+
...(meanings !== undefined && { verdict_meanings: meanings }),
|
|
350
|
+
}
|
|
351
|
+
: undefined;
|
|
352
|
+
const report = admitReport(bagOf(state.report) ?? {}, [
|
|
353
|
+
...Object.keys(spine),
|
|
354
|
+
...Object.keys(projection ?? {}),
|
|
355
|
+
]);
|
|
356
|
+
const envelope = {
|
|
357
|
+
af_coverage: ledger,
|
|
358
|
+
result: {
|
|
359
|
+
af_provenance: spine.af_provenance,
|
|
360
|
+
rule_version: spine.rule_version,
|
|
361
|
+
...report.fields,
|
|
362
|
+
...(projection ?? {}),
|
|
363
|
+
...(report.refused.length > 0 && {
|
|
364
|
+
[REPORT_NOTE_KEY]: shadowedFieldsNote(report.refused),
|
|
365
|
+
}),
|
|
366
|
+
walk: spine.walk,
|
|
367
|
+
},
|
|
368
|
+
};
|
|
369
|
+
return envelope;
|
|
370
|
+
},
|
|
371
|
+
});
|
|
372
|
+
if (store === undefined)
|
|
373
|
+
return tool;
|
|
374
|
+
const keepsRecords = { ...tool, [INNER_RUN_RECORDS]: store };
|
|
375
|
+
return keepsRecords;
|
|
376
|
+
}
|
|
377
|
+
//# sourceMappingURL=runbookAsTool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runbookAsTool.js","sourceRoot":"","sources":["../../../../src/core/runbook/runbookAsTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgFG;AAEH,OAAO,EAAE,iB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