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.
Files changed (118) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/CLAUDE.md +22 -18
  3. package/dist/artifacts/index.js +3 -1
  4. package/dist/artifacts/index.js.map +1 -1
  5. package/dist/artifacts/recordingArtifact.js +47 -1
  6. package/dist/artifacts/recordingArtifact.js.map +1 -1
  7. package/dist/core/Agent.js +30 -0
  8. package/dist/core/Agent.js.map +1 -1
  9. package/dist/core/agent/stages/toolCalls.js +42 -0
  10. package/dist/core/agent/stages/toolCalls.js.map +1 -1
  11. package/dist/core/agent/toolDispatch.js +101 -0
  12. package/dist/core/agent/toolDispatch.js.map +1 -0
  13. package/dist/core/flowchartAsTool.js +9 -2
  14. package/dist/core/flowchartAsTool.js.map +1 -1
  15. package/dist/core/runbook/coverage.js +162 -0
  16. package/dist/core/runbook/coverage.js.map +1 -0
  17. package/dist/core/runbook/dispatch.js +119 -0
  18. package/dist/core/runbook/dispatch.js.map +1 -0
  19. package/dist/core/runbook/index.js +24 -0
  20. package/dist/core/runbook/index.js.map +1 -0
  21. package/dist/core/runbook/report.js +69 -0
  22. package/dist/core/runbook/report.js.map +1 -0
  23. package/dist/core/runbook/runbookAsTool.js +381 -0
  24. package/dist/core/runbook/runbookAsTool.js.map +1 -0
  25. package/dist/core/runbook/types.js +22 -0
  26. package/dist/core/runbook/types.js.map +1 -0
  27. package/dist/core/runbook/verdicts.js +156 -0
  28. package/dist/core/runbook/verdicts.js.map +1 -0
  29. package/dist/core/runbook/walk.js +115 -0
  30. package/dist/core/runbook/walk.js.map +1 -0
  31. package/dist/core/tools.js +55 -1
  32. package/dist/core/tools.js.map +1 -1
  33. package/dist/esm/artifacts/index.d.ts +1 -1
  34. package/dist/esm/artifacts/index.js +1 -1
  35. package/dist/esm/artifacts/index.js.map +1 -1
  36. package/dist/esm/artifacts/recordingArtifact.d.ts +36 -0
  37. package/dist/esm/artifacts/recordingArtifact.js +45 -0
  38. package/dist/esm/artifacts/recordingArtifact.js.map +1 -1
  39. package/dist/esm/core/Agent.js +30 -0
  40. package/dist/esm/core/Agent.js.map +1 -1
  41. package/dist/esm/core/agent/stages/toolCalls.js +42 -0
  42. package/dist/esm/core/agent/stages/toolCalls.js.map +1 -1
  43. package/dist/esm/core/agent/toolDispatch.d.ts +50 -0
  44. package/dist/esm/core/agent/toolDispatch.js +97 -0
  45. package/dist/esm/core/agent/toolDispatch.js.map +1 -0
  46. package/dist/esm/core/flowchartAsTool.d.ts +6 -0
  47. package/dist/esm/core/flowchartAsTool.js +9 -2
  48. package/dist/esm/core/flowchartAsTool.js.map +1 -1
  49. package/dist/esm/core/runbook/coverage.d.ts +69 -0
  50. package/dist/esm/core/runbook/coverage.js +155 -0
  51. package/dist/esm/core/runbook/coverage.js.map +1 -0
  52. package/dist/esm/core/runbook/dispatch.d.ts +69 -0
  53. package/dist/esm/core/runbook/dispatch.js +112 -0
  54. package/dist/esm/core/runbook/dispatch.js.map +1 -0
  55. package/dist/esm/core/runbook/index.d.ts +9 -0
  56. package/dist/esm/core/runbook/index.js +9 -0
  57. package/dist/esm/core/runbook/index.js.map +1 -0
  58. package/dist/esm/core/runbook/report.d.ts +52 -0
  59. package/dist/esm/core/runbook/report.js +64 -0
  60. package/dist/esm/core/runbook/report.js.map +1 -0
  61. package/dist/esm/core/runbook/runbookAsTool.d.ts +90 -0
  62. package/dist/esm/core/runbook/runbookAsTool.js +377 -0
  63. package/dist/esm/core/runbook/runbookAsTool.js.map +1 -0
  64. package/dist/esm/core/runbook/types.d.ts +203 -0
  65. package/dist/esm/core/runbook/types.js +21 -0
  66. package/dist/esm/core/runbook/types.js.map +1 -0
  67. package/dist/esm/core/runbook/verdicts.d.ts +78 -0
  68. package/dist/esm/core/runbook/verdicts.js +148 -0
  69. package/dist/esm/core/runbook/verdicts.js.map +1 -0
  70. package/dist/esm/core/runbook/walk.d.ts +72 -0
  71. package/dist/esm/core/runbook/walk.js +110 -0
  72. package/dist/esm/core/runbook/walk.js.map +1 -0
  73. package/dist/esm/core/tools.d.ts +112 -0
  74. package/dist/esm/core/tools.js +52 -0
  75. package/dist/esm/core/tools.js.map +1 -1
  76. package/dist/esm/index.d.ts +4 -3
  77. package/dist/esm/index.js +19 -2
  78. package/dist/esm/index.js.map +1 -1
  79. package/dist/esm/lib/mcp/toolExtras.d.ts +8 -0
  80. package/dist/esm/lib/mcp/toolExtras.js +7 -1
  81. package/dist/esm/lib/mcp/toolExtras.js.map +1 -1
  82. package/dist/index.js +97 -66
  83. package/dist/index.js.map +1 -1
  84. package/dist/lib/mcp/toolExtras.js +6 -0
  85. package/dist/lib/mcp/toolExtras.js.map +1 -1
  86. package/dist/types/artifacts/index.d.ts +1 -1
  87. package/dist/types/artifacts/index.d.ts.map +1 -1
  88. package/dist/types/artifacts/recordingArtifact.d.ts +36 -0
  89. package/dist/types/artifacts/recordingArtifact.d.ts.map +1 -1
  90. package/dist/types/core/Agent.d.ts.map +1 -1
  91. package/dist/types/core/agent/stages/toolCalls.d.ts.map +1 -1
  92. package/dist/types/core/agent/toolDispatch.d.ts +51 -0
  93. package/dist/types/core/agent/toolDispatch.d.ts.map +1 -0
  94. package/dist/types/core/flowchartAsTool.d.ts +6 -0
  95. package/dist/types/core/flowchartAsTool.d.ts.map +1 -1
  96. package/dist/types/core/runbook/coverage.d.ts +70 -0
  97. package/dist/types/core/runbook/coverage.d.ts.map +1 -0
  98. package/dist/types/core/runbook/dispatch.d.ts +70 -0
  99. package/dist/types/core/runbook/dispatch.d.ts.map +1 -0
  100. package/dist/types/core/runbook/index.d.ts +10 -0
  101. package/dist/types/core/runbook/index.d.ts.map +1 -0
  102. package/dist/types/core/runbook/report.d.ts +53 -0
  103. package/dist/types/core/runbook/report.d.ts.map +1 -0
  104. package/dist/types/core/runbook/runbookAsTool.d.ts +91 -0
  105. package/dist/types/core/runbook/runbookAsTool.d.ts.map +1 -0
  106. package/dist/types/core/runbook/types.d.ts +204 -0
  107. package/dist/types/core/runbook/types.d.ts.map +1 -0
  108. package/dist/types/core/runbook/verdicts.d.ts +79 -0
  109. package/dist/types/core/runbook/verdicts.d.ts.map +1 -0
  110. package/dist/types/core/runbook/walk.d.ts +73 -0
  111. package/dist/types/core/runbook/walk.d.ts.map +1 -0
  112. package/dist/types/core/tools.d.ts +112 -0
  113. package/dist/types/core/tools.d.ts.map +1 -1
  114. package/dist/types/index.d.ts +4 -3
  115. package/dist/types/index.d.ts.map +1 -1
  116. package/dist/types/lib/mcp/toolExtras.d.ts +8 -0
  117. package/dist/types/lib/mcp/toolExtras.d.ts.map +1 -1
  118. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"flowchartAsTool.js","sourceRoot":"","sources":["../../../src/core/flowchartAsTool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqHG;AAEH,OAAO,EACL,iBAAiB,GAIlB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAEvD,OAAO,EACL,uBAAuB,EACvB,iBAAiB,EACjB,aAAa,GAId,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAiJxC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,eAAe,CAAC,IAA4B;IAC1D,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChD,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAChF,CAAC;IACD,IAAI,CAAC,IAAI,CAAC,WAAW,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM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AC;QACH,CAAC;KACF,CAAC,CAAC;IAEH,sEAAsE;IACtE,sEAAsE;IACtE,oEAAoE;IACpE,+DAA+D;IAC/D,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACrC,MAAM,YAAY,GAA0B,EAAE,GAAG,IAAI,EAAE,CAAC,iBAAiB,CAAC,EAAE,KAAK,EAAE,CAAC;IACpF,OAAO,YAAY,CAAC;AACtB,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,gBAAgB,CACvB,GAAY,EACZ,QAAwE;IAExE,IAAI,QAAQ,IAAI,OAAO,QAAQ,CAAC,mBAAmB,KAAK,UAAU,EAAE,CAAC;QACnE,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,QAAQ,CAAC,mBAAmB,EAAE,CAAC;YAC/C,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC3B,OAAO,OAAwE,CAAC;YAClF,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,iCAAiC;QACnC,CAAC;IACH,CAAC;IACD,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,EAAE,CAAC;IAC/C,MAAM,SAAS,GACZ,GAA+B,CAAC,SAAS;QACzC,GAAsC,CAAC,gBAAgB,CAAC;IAC3D,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;QAC7B,OAAO,SAA0E,CAAC;IACpF,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * runbook/coverage — the spine's ledger: inner folds + chart-declared
3
+ * entries + the bridge's own, and the sentence naming the rules.
4
+ *
5
+ * Pattern: pure fold over three sources, reusing the coverage primitives'
6
+ * own recognizer and merge — no second grammar.
7
+ * Role: core/runbook.
8
+ * Emits: N/A.
9
+ *
10
+ * The three sources, in the order they land:
11
+ * 1. INNER LEDGERS — every recorded inner call's result is read by the
12
+ * same `readCoverageResult` funnel the dispatch loop uses, and its
13
+ * three lists fold upward. An inner tool's honesty is carried, never
14
+ * re-authored.
15
+ * 2. THE CHART'S OWN — the procedure states run-specific coverage by
16
+ * writing a `coverage` state key (`{ checked?, not_checked?,
17
+ * cannot_cover? }`, items as `{what, why?}` bags or bare strings).
18
+ * This is the app's vocabulary (which counters mean "not assessed" is
19
+ * the chart's to know); the ENVELOPE is the bridge's.
20
+ * 3. THE BRIDGE'S OWN — one `checked` entry naming the procedure, its
21
+ * recorded step count and the rule set it ran under; and, for a
22
+ * verdict-shaped runbook, a `not_checked` entry counting DECLINED rows
23
+ * (the three-outcome honesty: a row that reached no classification is
24
+ * ground the answer does not cover).
25
+ */
26
+ import type { CoverageItem } from '../agent/coverage/types.js';
27
+ import type { InnerCallRecord } from './dispatch.js';
28
+ import type { RunbookRules } from './types.js';
29
+ /** The three lists, mid-fold. */
30
+ export interface LedgerLists {
31
+ readonly checked: readonly CoverageItem[];
32
+ readonly notChecked: readonly CoverageItem[];
33
+ readonly cannotCover: readonly CoverageItem[];
34
+ }
35
+ /** Fold every recorded inner call's declared coverage upward. */
36
+ export declare function foldInnerCoverage(records: readonly InnerCallRecord[]): LedgerLists;
37
+ /** The chart-declared lists, read off the final state's `coverage` key.
38
+ * Accepts both spellings of the two-word keys (state is often snake_case,
39
+ * the declaration camelCase) — one reader, no drift. */
40
+ export declare function chartCoverageOf(state: Readonly<Record<string, unknown>>): LedgerLists;
41
+ /** What the composed ledger needs to know about this run. */
42
+ export interface LedgerFacts {
43
+ readonly chartName: string;
44
+ readonly stepsExecuted: number;
45
+ readonly rules?: RunbookRules;
46
+ /** Rowset facts — present only for a verdict-shaped runbook. */
47
+ readonly rowsTotal?: number;
48
+ readonly declinedRows?: number;
49
+ }
50
+ /** The composed `af_coverage` value: three merged lists + the static law
51
+ * note + this run's own sentence. */
52
+ export interface ComposedLedger {
53
+ readonly checked?: readonly CoverageItem[];
54
+ readonly not_checked?: readonly CoverageItem[];
55
+ readonly cannot_cover?: readonly CoverageItem[];
56
+ readonly note: string;
57
+ readonly sentence: string;
58
+ }
59
+ /** Compose the whole ledger. Inner folds land first, chart-declared second,
60
+ * the bridge's own last — provenance order, so a reader meets the sources
61
+ * before the summary. */
62
+ export declare function composeLedger(inner: LedgerLists, chart: LedgerLists, facts: LedgerFacts): ComposedLedger;
63
+ /**
64
+ * The carried provenance stamp: the FIRST inner result that declared an
65
+ * `af_provenance` (on its unwrapped payload, or at its top level — both are
66
+ * read, in that order). A derived answer is still an answer, and a source's
67
+ * confession (`source: 'LOCAL SEED'`) must survive composition.
68
+ */
69
+ export declare function carriedProvenanceOf(records: readonly InnerCallRecord[]): Record<string, unknown> | undefined;
@@ -0,0 +1,155 @@
1
+ /**
2
+ * runbook/coverage — the spine's ledger: inner folds + chart-declared
3
+ * entries + the bridge's own, and the sentence naming the rules.
4
+ *
5
+ * Pattern: pure fold over three sources, reusing the coverage primitives'
6
+ * own recognizer and merge — no second grammar.
7
+ * Role: core/runbook.
8
+ * Emits: N/A.
9
+ *
10
+ * The three sources, in the order they land:
11
+ * 1. INNER LEDGERS — every recorded inner call's result is read by the
12
+ * same `readCoverageResult` funnel the dispatch loop uses, and its
13
+ * three lists fold upward. An inner tool's honesty is carried, never
14
+ * re-authored.
15
+ * 2. THE CHART'S OWN — the procedure states run-specific coverage by
16
+ * writing a `coverage` state key (`{ checked?, not_checked?,
17
+ * cannot_cover? }`, items as `{what, why?}` bags or bare strings).
18
+ * This is the app's vocabulary (which counters mean "not assessed" is
19
+ * the chart's to know); the ENVELOPE is the bridge's.
20
+ * 3. THE BRIDGE'S OWN — one `checked` entry naming the procedure, its
21
+ * recorded step count and the rule set it ran under; and, for a
22
+ * verdict-shaped runbook, a `not_checked` entry counting DECLINED rows
23
+ * (the three-outcome honesty: a row that reached no classification is
24
+ * ground the answer does not cover).
25
+ */
26
+ import { readCoverageResult } from '../agent/coverage/read.js';
27
+ import { mergeItems } from '../agent/coverage/items.js';
28
+ import { COVERAGE_NOTE } from '../agent/coverage/ledger.js';
29
+ const EMPTY = { checked: [], notChecked: [], cannotCover: [] };
30
+ /** Fold every recorded inner call's declared coverage upward. */
31
+ export function foldInnerCoverage(records) {
32
+ const checked = [];
33
+ const notChecked = [];
34
+ const cannotCover = [];
35
+ for (const record of records) {
36
+ if (record.result === undefined)
37
+ continue;
38
+ const reading = readCoverageResult(record.result);
39
+ for (const declared of reading?.declared ?? []) {
40
+ checked.push(declared.coverage.checked);
41
+ notChecked.push(declared.coverage.notChecked);
42
+ cannotCover.push(declared.coverage.cannotCover);
43
+ }
44
+ }
45
+ return {
46
+ checked: mergeItems(checked),
47
+ notChecked: mergeItems(notChecked),
48
+ cannotCover: mergeItems(cannotCover),
49
+ };
50
+ }
51
+ /** One list off the chart's `coverage` state key, normalized leniently —
52
+ * this is state the chart wrote, not a foreign wire; a malformed entry is
53
+ * dropped rather than refused (the run already happened). */
54
+ function stateList(value) {
55
+ if (!Array.isArray(value))
56
+ return [];
57
+ const items = [];
58
+ for (const entry of value) {
59
+ if (typeof entry === 'string' && entry.trim() !== '') {
60
+ items.push({ what: entry.trim() });
61
+ }
62
+ else if (entry !== null &&
63
+ typeof entry === 'object' &&
64
+ typeof entry.what === 'string') {
65
+ const what = entry.what;
66
+ const why = entry.why;
67
+ items.push({ what, ...(typeof why === 'string' && { why }) });
68
+ }
69
+ }
70
+ return items;
71
+ }
72
+ /** The chart-declared lists, read off the final state's `coverage` key.
73
+ * Accepts both spellings of the two-word keys (state is often snake_case,
74
+ * the declaration camelCase) — one reader, no drift. */
75
+ export function chartCoverageOf(state) {
76
+ const bag = state.coverage;
77
+ if (bag === null || typeof bag !== 'object' || Array.isArray(bag))
78
+ return EMPTY;
79
+ const rec = bag;
80
+ return {
81
+ checked: stateList(rec.checked),
82
+ notChecked: stateList(rec.not_checked ?? rec.notChecked),
83
+ cannotCover: stateList(rec.cannot_cover ?? rec.cannotCover),
84
+ };
85
+ }
86
+ /** The rules clause every sentence carries — or the honest silence. */
87
+ function rulesClause(rules) {
88
+ return rules !== undefined ? ` under ${rules.name} ${rules.version}` : '';
89
+ }
90
+ /** Compose the whole ledger. Inner folds land first, chart-declared second,
91
+ * the bridge's own last — provenance order, so a reader meets the sources
92
+ * before the summary. */
93
+ export function composeLedger(inner, chart, facts) {
94
+ const own = [
95
+ {
96
+ what: `the declared procedure '${facts.chartName}' — ${facts.stepsExecuted} step(s) ` +
97
+ `recorded${rulesClause(facts.rules)}`,
98
+ ...(facts.rowsTotal !== undefined && {
99
+ why: `${facts.rowsTotal} row(s) assessed, one decider pass per row`,
100
+ }),
101
+ },
102
+ ];
103
+ const declinedEntries = facts.declinedRows !== undefined && facts.declinedRows > 0
104
+ ? [
105
+ {
106
+ what: `${facts.declinedRows} row(s) that reached NO classification (verdict 'declined')`,
107
+ why: 'the declared rules could not be read for them; they are in the rowset with ' +
108
+ 'everything that IS known, and nothing was guessed to fill the gap',
109
+ },
110
+ ]
111
+ : [];
112
+ const checked = mergeItems([inner.checked, chart.checked, own]);
113
+ const notChecked = mergeItems([inner.notChecked, chart.notChecked, declinedEntries]);
114
+ const cannotCover = mergeItems([inner.cannotCover, chart.cannotCover]);
115
+ const rowsPart = facts.rowsTotal !== undefined
116
+ ? `; ${facts.rowsTotal} row(s) assessed` +
117
+ (facts.declinedRows !== undefined && facts.declinedRows > 0
118
+ ? `, ${facts.declinedRows} declined (no classification reached)`
119
+ : '')
120
+ : '';
121
+ const gapsPart = notChecked.length > 0 ? `; ${notChecked.length} not-checked item(s) declared` : '';
122
+ const sentence = `Ran '${facts.chartName}'${rulesClause(facts.rules)} — ` +
123
+ `${facts.stepsExecuted} step(s) recorded${rowsPart}${gapsPart}.`;
124
+ return {
125
+ ...(checked.length > 0 && { checked }),
126
+ ...(notChecked.length > 0 && { not_checked: notChecked }),
127
+ ...(cannotCover.length > 0 && { cannot_cover: cannotCover }),
128
+ note: COVERAGE_NOTE,
129
+ sentence,
130
+ };
131
+ }
132
+ /**
133
+ * The carried provenance stamp: the FIRST inner result that declared an
134
+ * `af_provenance` (on its unwrapped payload, or at its top level — both are
135
+ * read, in that order). A derived answer is still an answer, and a source's
136
+ * confession (`source: 'LOCAL SEED'`) must survive composition.
137
+ */
138
+ export function carriedProvenanceOf(records) {
139
+ const bagOf = (value) => value !== null && typeof value === 'object' && !Array.isArray(value)
140
+ ? value
141
+ : undefined;
142
+ for (const record of records) {
143
+ const top = bagOf(record.result);
144
+ if (top === undefined)
145
+ continue;
146
+ const payload = bagOf(top.result);
147
+ for (const candidate of [payload, top]) {
148
+ const stamp = bagOf(candidate?.af_provenance);
149
+ if (stamp !== undefined)
150
+ return stamp;
151
+ }
152
+ }
153
+ return undefined;
154
+ }
155
+ //# sourceMappingURL=coverage.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"coverage.js","sourceRoot":"","sources":["../../../../src/core/runbook/coverage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAY5D,MAAM,KAAK,GAAgB,EAAE,OAAO,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,WAAW,EAAE,EAAE,EAAE,CAAC;AAE5E,iEAAiE;AACjE,MAAM,UAAU,iBAAiB,CAAC,OAAmC;IACnE,MAAM,OAAO,GAAgC,EAAE,CAAC;IAChD,MAAM,UAAU,GAAgC,EAAE,CAAC;IACnD,MAAM,WAAW,GAAgC,EAAE,CAAC;IACpD,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,IAAI,MAAM,CAAC,MAAM,KAAK,SAAS;YAAE,SAAS;QAC1C,MAAM,OAAO,GAAG,kBAAkB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAClD,KAAK,MAAM,QAAQ,IAAI,OAAO,EAAE,QAA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D,GAAG,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC;QAC5D,IAAI,EAAE,aAAa;QACnB,QAAQ;KACT,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CACjC,OAAmC;IAEnC,MAAM,KAAK,GAAG,CAAC,KAAc,EAAuC,EAAE,CACpE,KAAK,KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAClE,CAAC,CAAE,KAAiC;QACpC,CAAC,CAAC,SAAS,CAAC;IAChB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QACjC,IAAI,GAAG,KAAK,SAAS;YAAE,SAAS;QAChC,MAAM,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAClC,KAAK,MAAM,SAAS,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC;YACvC,MAAM,KAAK,GAAG,KAAK,CAAC,SAAS,EAAE,aAAa,CAAC,CAAC;YAC9C,IAAI,KAAK,KAAK,SAAS;gBAAE,OAAO,KAAK,CAAC;QACxC,CAAC;IACH,CAAC;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"}
@@ -0,0 +1,69 @@
1
+ /**
2
+ * runbook/dispatch — the bridge's wrapper over `ctx.tools`.
3
+ *
4
+ * Pattern: decorator over {@link ToolDispatch}. The RAW dispatch (delivered
5
+ * by the agent) returns every result untouched; POLICY about what a
6
+ * result means belongs to the consumer — and this is the runbook's
7
+ * policy: every inner outcome is RECORDED (for the coverage fold and
8
+ * the provenance carry), and an inner ABSENCE short-circuits the
9
+ * procedure unless the call site declared it survivable.
10
+ * Role: core/runbook, pure.
11
+ * Emits: N/A.
12
+ *
13
+ * WHY an absence short-circuits: "the inventory found nothing" IS the
14
+ * runbook's answer, and it must go back EXACTLY as it arrived so the
15
+ * framework still reads it as an absence — a verdict reached over a source
16
+ * that answered "nothing here" would be the confident-partial-answer failure
17
+ * this whole envelope exists to prevent. A stage that can genuinely carry on
18
+ * without the source says so at the call site (`{ allowAbsent: true }`) and
19
+ * owns stating the gap (usually as a coverage entry).
20
+ */
21
+ import type { ToolAbsence } from '../agent/coverage/types.js';
22
+ import type { ToolDispatch } from '../tools.js';
23
+ /** One inner call, as the bridge recorded it. */
24
+ export interface InnerCallRecord {
25
+ readonly tool: string;
26
+ readonly outcome: 'ok' | 'absent' | 'error';
27
+ /** The raw returned value (`'ok'` and `'absent'` outcomes). */
28
+ readonly result?: unknown;
29
+ }
30
+ /** The marker property that survives any error wrapping between a stage and
31
+ * the bridge's catch. */
32
+ declare const ABSENCE_SIGNAL: "af_runbook_absence";
33
+ /**
34
+ * The control signal an un-survivable inner absence throws through the
35
+ * chart. The engine commits staged state and rethrows (commit-on-error is
36
+ * the law upstream), so the bridge catches this at `executor.run` and
37
+ * returns the absence verbatim.
38
+ */
39
+ export declare class RunbookAbsenceSignal extends Error {
40
+ readonly absence: ToolAbsence;
41
+ readonly [ABSENCE_SIGNAL] = true;
42
+ constructor(absence: ToolAbsence, innerTool: string);
43
+ }
44
+ /** Recognize the signal on an error OR anywhere down its `cause` chain — an
45
+ * engine layer that wraps the stage's throw must not defeat the pass-through. */
46
+ export declare function absenceSignalOf(err: unknown): RunbookAbsenceSignal | undefined;
47
+ /** What `recordingDispatch` hands back: the dispatch the procedure closes
48
+ * over, and the record the envelope folds. */
49
+ export interface RecordedDispatch {
50
+ readonly tools: ToolDispatch;
51
+ readonly records: readonly InnerCallRecord[];
52
+ }
53
+ /**
54
+ * Wrap the delivered dispatch (or its absence) for one runbook invocation.
55
+ *
56
+ * With NO dispatch delivered (`ctx.tools` absent — a hand-built context, a
57
+ * door with no dispatch map) the wrapper is the fail-closed teacher: `has`
58
+ * answers false and `call` refuses naming the fix, so a procedure that needs
59
+ * inner tools fails loudly at its first call instead of half-running.
60
+ */
61
+ export declare function recordingDispatch(delivered: ToolDispatch | undefined, runbookName: string): RecordedDispatch;
62
+ /**
63
+ * The definition-time probe dispatch — handed to the procedure factory ONCE
64
+ * at `runbookAsTool(...)` so the bridge can read the chart's declared
65
+ * contract. Stage bodies do not run at build; a factory that calls tools at
66
+ * build time hears exactly why that cannot work.
67
+ */
68
+ export declare function probeDispatch(runbookName: string): ToolDispatch;
69
+ export {};
@@ -0,0 +1,112 @@
1
+ /**
2
+ * runbook/dispatch — the bridge's wrapper over `ctx.tools`.
3
+ *
4
+ * Pattern: decorator over {@link ToolDispatch}. The RAW dispatch (delivered
5
+ * by the agent) returns every result untouched; POLICY about what a
6
+ * result means belongs to the consumer — and this is the runbook's
7
+ * policy: every inner outcome is RECORDED (for the coverage fold and
8
+ * the provenance carry), and an inner ABSENCE short-circuits the
9
+ * procedure unless the call site declared it survivable.
10
+ * Role: core/runbook, pure.
11
+ * Emits: N/A.
12
+ *
13
+ * WHY an absence short-circuits: "the inventory found nothing" IS the
14
+ * runbook's answer, and it must go back EXACTLY as it arrived so the
15
+ * framework still reads it as an absence — a verdict reached over a source
16
+ * that answered "nothing here" would be the confident-partial-answer failure
17
+ * this whole envelope exists to prevent. A stage that can genuinely carry on
18
+ * without the source says so at the call site (`{ allowAbsent: true }`) and
19
+ * owns stating the gap (usually as a coverage entry).
20
+ */
21
+ import { readAbsence } from '../agent/coverage/absent.js';
22
+ /** The marker property that survives any error wrapping between a stage and
23
+ * the bridge's catch. */
24
+ const ABSENCE_SIGNAL = 'af_runbook_absence';
25
+ /**
26
+ * The control signal an un-survivable inner absence throws through the
27
+ * chart. The engine commits staged state and rethrows (commit-on-error is
28
+ * the law upstream), so the bridge catches this at `executor.run` and
29
+ * returns the absence verbatim.
30
+ */
31
+ export class RunbookAbsenceSignal extends Error {
32
+ absence;
33
+ [ABSENCE_SIGNAL] = true;
34
+ constructor(absence, innerTool) {
35
+ super(`runbook inner tool '${innerTool}' answered with an absence — the runbook's answer ` +
36
+ `IS that absence, passed through verbatim. (Declare the call survivable with ` +
37
+ `{ allowAbsent: true } if the procedure can carry on without this source.)`);
38
+ this.absence = absence;
39
+ this.name = 'RunbookAbsenceSignal';
40
+ }
41
+ }
42
+ /** Recognize the signal on an error OR anywhere down its `cause` chain — an
43
+ * engine layer that wraps the stage's throw must not defeat the pass-through. */
44
+ export function absenceSignalOf(err) {
45
+ let current = err;
46
+ for (let hops = 0; hops < 8 && current !== null && typeof current === 'object'; hops += 1) {
47
+ if (current[ABSENCE_SIGNAL] === true) {
48
+ return current;
49
+ }
50
+ current = current.cause;
51
+ }
52
+ return undefined;
53
+ }
54
+ /**
55
+ * Wrap the delivered dispatch (or its absence) for one runbook invocation.
56
+ *
57
+ * With NO dispatch delivered (`ctx.tools` absent — a hand-built context, a
58
+ * door with no dispatch map) the wrapper is the fail-closed teacher: `has`
59
+ * answers false and `call` refuses naming the fix, so a procedure that needs
60
+ * inner tools fails loudly at its first call instead of half-running.
61
+ */
62
+ export function recordingDispatch(delivered, runbookName) {
63
+ const records = [];
64
+ const tools = {
65
+ has(name) {
66
+ return delivered?.has(name) ?? false;
67
+ },
68
+ async call(name, args, opts) {
69
+ if (delivered === undefined) {
70
+ throw new Error(`runbookAsTool('${runbookName}'): the procedure called tools.call('${name}') but ` +
71
+ `no dispatch was delivered on ctx.tools. Register this runbook on an Agent ` +
72
+ `(agent dispatch delivers ctx.tools at execute time), or supply a ToolDispatch ` +
73
+ `on the execution context when invoking the tool directly.`);
74
+ }
75
+ let raw;
76
+ try {
77
+ raw = await delivered.call(name, args, opts);
78
+ }
79
+ catch (err) {
80
+ records.push({ tool: name, outcome: 'error' });
81
+ throw err;
82
+ }
83
+ const absence = readAbsence(raw);
84
+ if (absence !== undefined) {
85
+ records.push({ tool: name, outcome: 'absent', result: raw });
86
+ if (opts?.allowAbsent === true)
87
+ return raw;
88
+ throw new RunbookAbsenceSignal(absence, name);
89
+ }
90
+ records.push({ tool: name, outcome: 'ok', result: raw });
91
+ return raw;
92
+ },
93
+ };
94
+ return { tools, records };
95
+ }
96
+ /**
97
+ * The definition-time probe dispatch — handed to the procedure factory ONCE
98
+ * at `runbookAsTool(...)` so the bridge can read the chart's declared
99
+ * contract. Stage bodies do not run at build; a factory that calls tools at
100
+ * build time hears exactly why that cannot work.
101
+ */
102
+ export function probeDispatch(runbookName) {
103
+ return {
104
+ has: () => false,
105
+ call: (name) => {
106
+ throw new Error(`runbookAsTool('${runbookName}'): tools.call('${name}') was invoked while BUILDING ` +
107
+ `the chart. The dispatch only exists at execute time — call tools from inside ` +
108
+ `stage functions (which close over it), never from the factory body.`);
109
+ },
110
+ };
111
+ }
112
+ //# sourceMappingURL=dispatch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../../../../src/core/runbook/dispatch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAY1D;0BAC0B;AAC1B,MAAM,cAAc,GAAG,oBAA6B,CAAC;AAErD;;;;;GAKG;AACH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAExB;IADZ,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;IACjC,YAAqB,OAAoB,EAAE,SAAiB;QAC1D,KAAK,CACH,uBAAuB,SAAS,oDAAoD;YAClF,8EAA8E;YAC9E,2EAA2E,CAC9E,CAAC;QALiB,YAAO,GAAP,OAAO,CAAa;QAMvC,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF;AAED;kFACkF;AAClF,MAAM,UAAU,eAAe,CAAC,GAAY;IAC1C,IAAI,OAAO,GAAY,GAAG,CAAC;IAC3B,KAAK,IAAI,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,OAAO,KAAK,QAAQ,E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BAC7D,IAAI,IAAI,EAAE,WAAW,KAAK,IAAI;oBAAE,OAAO,GAAG,CAAC;gBAC3C,MAAM,IAAI,oBAAoB,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;YAChD,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;YACzD,OAAO,GAAG,CAAC;QACb,CAAC;KACF,CAAC;IACF,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAC5B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,WAAmB;IAC/C,OAAO;QACL,GAAG,EAAE,GAAG,EAAE,CAAC,KAAK;QAChB,IAAI,EAAE,CAAC,IAAY,EAAE,EAAE;YACrB,MAAM,IAAI,KAAK,CACb,kBAAkB,WAAW,mBAAmB,IAAI,gCAAgC;gBAClF,+EAA+E;gBAC/E,qEAAqE,CACxE,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * runbook — the standard bridge from a footprintjs procedure to an Agent
3
+ * tool with the mandatory honesty spine. See README.md in this folder.
4
+ */
5
+ export { runbookAsTool } from './runbookAsTool.js';
6
+ export { absenceSignalOf, probeDispatch, recordingDispatch, RunbookAbsenceSignal, type InnerCallRecord, type RecordedDispatch, } from './dispatch.js';
7
+ export { DECLINED_VERDICT, DEFAULT_MAX_ROWS, renderVerdictTable, VERDICT_RENDER_NOTE, verdictRowsOf, } from './verdicts.js';
8
+ export { DEFAULT_WALK_CAP, projectWalk, type ProjectedWalk, type WalkRow } from './walk.js';
9
+ export type { RunbookAsToolOptions, RunbookEnvelope, RunbookProcedure, RunbookRules, RunbookVerdictsOptions, RunbookWalkOptions, VerdictRow, WalkDescriptor, } from './types.js';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * runbook — the standard bridge from a footprintjs procedure to an Agent
3
+ * tool with the mandatory honesty spine. See README.md in this folder.
4
+ */
5
+ export { runbookAsTool } from './runbookAsTool.js';
6
+ export { absenceSignalOf, probeDispatch, recordingDispatch, RunbookAbsenceSignal, } from './dispatch.js';
7
+ export { DECLINED_VERDICT, DEFAULT_MAX_ROWS, renderVerdictTable, VERDICT_RENDER_NOTE, verdictRowsOf, } from './verdicts.js';
8
+ export { DEFAULT_WALK_CAP, projectWalk } from './walk.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/runbook/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EACL,eAAe,EACf,aAAa,EACb,iBAAiB,EACjB,oBAAoB,GAGrB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EAClB,mBAAmB,EACnB,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAoC,MAAM,WAAW,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * runbook/report — the chart's own `report` bag, admitted UNDER the envelope.
3
+ *
4
+ * Pattern: one pure partition (admitted fields / refused names) plus the
5
+ * sentence that names what was refused. No behavior beyond the law.
6
+ * Role: core/runbook. `runbookAsTool.ts` consumes at assembly time.
7
+ * Emits: N/A.
8
+ *
9
+ * THE PRECEDENCE LAW: the names the envelope itself assembles — the honesty
10
+ * spine, and the projection keys this run actually produced — are RESERVED.
11
+ * A chart's `report` may add fields BESIDE them; it may never replace one.
12
+ * The spine is the boundary of the answer, and a boundary a chart can
13
+ * overwrite is a boundary that reports whatever the chart says about itself:
14
+ * a seeded number could arrive stamped as a sourced one, or an answer
15
+ * produced under one reading of the rules could name a version it never ran.
16
+ * A `report` key spelled `af_coverage` is refused too — it lands one level
17
+ * under the real ledger, which is exactly where a decoy would want to sit.
18
+ *
19
+ * AND WHY THE REFUSAL IS SPOKEN, not silent: every other reduction this
20
+ * envelope performs is declared out loud — the walk's `projection`, the
21
+ * rowset's `rows_complete`, declined rows counted into the ledger. Dropping
22
+ * a field the chart wrote with no trace would be the one silent edit in an
23
+ * envelope whose whole argument is that reductions are declared, and the
24
+ * author would debug "where did my field go?" against a shape that never
25
+ * mentions it. So a collision costs one `report_note` naming every refused
26
+ * field — present ONLY when something was actually refused, so the clean
27
+ * path (every real runbook) pays nothing.
28
+ */
29
+ /** The ledger's key. It lives at the ENVELOPE's top level, and is reserved
30
+ * inside `result` too — see the module header. */
31
+ export declare const LEDGER_KEY = "af_coverage";
32
+ /** The key the refusal note ships under — itself reserved, because a
33
+ * chart-authored `report_note` is a forged receipt for a refusal that
34
+ * never happened. */
35
+ export declare const REPORT_NOTE_KEY = "report_note";
36
+ /** The chart's `report`, partitioned against the names the envelope owns. */
37
+ export interface AdmittedReport {
38
+ /** The fields that may be spread into `result`, in the chart's own order. */
39
+ readonly fields: Record<string, unknown>;
40
+ /** The names refused, in the chart's own order — empty on the clean path. */
41
+ readonly refused: readonly string[];
42
+ }
43
+ /**
44
+ * Partition the chart's `report` against the names this envelope assembled.
45
+ * `assembled` is read from the actual spine and projection objects, never
46
+ * from a hand-listed copy — a spine field added later is protected the day
47
+ * it lands.
48
+ */
49
+ export declare function admitReport(report: Readonly<Record<string, unknown>>, assembled: Iterable<string>): AdmittedReport;
50
+ /** The sentence for a refused collision: which fields were discarded, whose
51
+ * the surviving values are, and what is safe to read. */
52
+ export declare function shadowedFieldsNote(refused: readonly string[]): string;
@@ -0,0 +1,64 @@
1
+ /**
2
+ * runbook/report — the chart's own `report` bag, admitted UNDER the envelope.
3
+ *
4
+ * Pattern: one pure partition (admitted fields / refused names) plus the
5
+ * sentence that names what was refused. No behavior beyond the law.
6
+ * Role: core/runbook. `runbookAsTool.ts` consumes at assembly time.
7
+ * Emits: N/A.
8
+ *
9
+ * THE PRECEDENCE LAW: the names the envelope itself assembles — the honesty
10
+ * spine, and the projection keys this run actually produced — are RESERVED.
11
+ * A chart's `report` may add fields BESIDE them; it may never replace one.
12
+ * The spine is the boundary of the answer, and a boundary a chart can
13
+ * overwrite is a boundary that reports whatever the chart says about itself:
14
+ * a seeded number could arrive stamped as a sourced one, or an answer
15
+ * produced under one reading of the rules could name a version it never ran.
16
+ * A `report` key spelled `af_coverage` is refused too — it lands one level
17
+ * under the real ledger, which is exactly where a decoy would want to sit.
18
+ *
19
+ * AND WHY THE REFUSAL IS SPOKEN, not silent: every other reduction this
20
+ * envelope performs is declared out loud — the walk's `projection`, the
21
+ * rowset's `rows_complete`, declined rows counted into the ledger. Dropping
22
+ * a field the chart wrote with no trace would be the one silent edit in an
23
+ * envelope whose whole argument is that reductions are declared, and the
24
+ * author would debug "where did my field go?" against a shape that never
25
+ * mentions it. So a collision costs one `report_note` naming every refused
26
+ * field — present ONLY when something was actually refused, so the clean
27
+ * path (every real runbook) pays nothing.
28
+ */
29
+ /** The ledger's key. It lives at the ENVELOPE's top level, and is reserved
30
+ * inside `result` too — see the module header. */
31
+ export const LEDGER_KEY = 'af_coverage';
32
+ /** The key the refusal note ships under — itself reserved, because a
33
+ * chart-authored `report_note` is a forged receipt for a refusal that
34
+ * never happened. */
35
+ export const REPORT_NOTE_KEY = 'report_note';
36
+ /**
37
+ * Partition the chart's `report` against the names this envelope assembled.
38
+ * `assembled` is read from the actual spine and projection objects, never
39
+ * from a hand-listed copy — a spine field added later is protected the day
40
+ * it lands.
41
+ */
42
+ export function admitReport(report, assembled) {
43
+ const reserved = new Set([LEDGER_KEY, REPORT_NOTE_KEY, ...assembled]);
44
+ // Own enumerable string keys, DEFINED not assigned — the same two rules the
45
+ // spread this replaced followed, so an admitted field lands exactly as it
46
+ // used to (a `__proto__` key stays a key instead of reaching a setter).
47
+ const entries = Object.entries(report);
48
+ return {
49
+ fields: Object.fromEntries(entries.filter(([key]) => !reserved.has(key))),
50
+ refused: entries.filter(([key]) => reserved.has(key)).map(([key]) => key),
51
+ };
52
+ }
53
+ /** The sentence for a refused collision: which fields were discarded, whose
54
+ * the surviving values are, and what is safe to read. */
55
+ export function shadowedFieldsNote(refused) {
56
+ const names = refused.map((name) => `\`${name}\``).join(', ');
57
+ return (`${refused.length} field(s) the chart's \`report\` wrote were DISCARDED: ${names}. ` +
58
+ `Those names belong to this envelope — the honesty spine (\`af_coverage\`, ` +
59
+ `\`af_provenance\`, \`rule_version\`, \`walk\`) and the projection this run ` +
60
+ `assembled — so the values you are reading under them are the bridge's, not the ` +
61
+ `chart's. A report adds fields beside the spine; it never replaces one. Every ` +
62
+ `other report field is here verbatim.`);
63
+ }
64
+ //# sourceMappingURL=report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report.js","sourceRoot":"","sources":["../../../../src/core/runbook/report.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH;mDACmD;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG,aAAa,CAAC;AAExC;;sBAEsB;AACtB,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAC;AAU7C;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CACzB,MAAyC,EACzC,SAA2B;IAE3B,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAS,CAAC,UAAU,EAAE,eAAe,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC;IAC9E,4EAA4E;IAC5E,0EAA0E;IAC1E,wEAAwE;IACxE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACvC,OAAO;QACL,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;QACzE,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,E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