@llblab/pi-kit 0.38.3 → 0.39.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/CHANGELOG.md +10 -0
- package/README.md +2 -2
- package/node_modules/@llblab/pi-actors/AGENTS.md +108 -20
- package/node_modules/@llblab/pi-actors/BACKLOG.md +207 -4
- package/node_modules/@llblab/pi-actors/CHANGELOG.md +13 -0
- package/node_modules/@llblab/pi-actors/README.md +31 -1
- package/node_modules/@llblab/pi-actors/dist/index.js +1 -1
- package/node_modules/@llblab/pi-actors/dist/lib/async-runs.d.ts +37 -0
- package/node_modules/@llblab/pi-actors/dist/lib/async-runs.js +131 -62
- package/node_modules/@llblab/pi-actors/dist/lib/automatic-review-runtime.d.ts +2 -0
- package/node_modules/@llblab/pi-actors/dist/lib/automatic-review-runtime.js +3 -2
- package/node_modules/@llblab/pi-actors/dist/lib/command-templates.d.ts +37 -0
- package/node_modules/@llblab/pi-actors/dist/lib/command-templates.js +263 -129
- package/node_modules/@llblab/pi-actors/dist/lib/execution-files.d.ts +32 -0
- package/node_modules/@llblab/pi-actors/dist/lib/execution-files.js +128 -0
- package/node_modules/@llblab/pi-actors/dist/lib/execution-output.js +5 -4
- package/node_modules/@llblab/pi-actors/dist/lib/execution-sessions.d.ts +19 -1
- package/node_modules/@llblab/pi-actors/dist/lib/execution-sessions.js +62 -26
- package/node_modules/@llblab/pi-actors/dist/lib/execution.d.ts +4 -1
- package/node_modules/@llblab/pi-actors/dist/lib/execution.js +6 -1
- package/node_modules/@llblab/pi-actors/dist/lib/extension-runtime.d.ts +9 -2
- package/node_modules/@llblab/pi-actors/dist/lib/extension-runtime.js +92 -14
- package/node_modules/@llblab/pi-actors/dist/lib/file-state.js +21 -2
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-command.js +2 -2
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-overlay.d.ts +25 -7
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-overlay.js +562 -262
- package/node_modules/@llblab/pi-actors/dist/lib/inspector.d.ts +20 -10
- package/node_modules/@llblab/pi-actors/dist/lib/inspector.js +80 -91
- package/node_modules/@llblab/pi-actors/dist/lib/limits.d.ts +1 -0
- package/node_modules/@llblab/pi-actors/dist/lib/limits.js +1 -0
- package/node_modules/@llblab/pi-actors/dist/lib/observability.d.ts +15 -1
- package/node_modules/@llblab/pi-actors/dist/lib/observability.js +216 -99
- package/node_modules/@llblab/pi-actors/dist/lib/pi.d.ts +5 -4
- package/node_modules/@llblab/pi-actors/dist/lib/pi.js +64 -10
- package/node_modules/@llblab/pi-actors/dist/lib/recipe-projection.d.ts +18 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipe-projection.js +220 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipes-context.d.ts +2 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipes-context.js +30 -6
- package/node_modules/@llblab/pi-actors/dist/lib/registry.js +270 -36
- package/node_modules/@llblab/pi-actors/dist/lib/run-delivery.d.ts +213 -5
- package/node_modules/@llblab/pi-actors/dist/lib/run-delivery.js +1909 -40
- package/node_modules/@llblab/pi-actors/dist/lib/run-supervision.d.ts +107 -0
- package/node_modules/@llblab/pi-actors/dist/lib/run-supervision.js +412 -0
- package/node_modules/@llblab/pi-actors/dist/lib/run-ui-runtime.d.ts +9 -2
- package/node_modules/@llblab/pi-actors/dist/lib/run-ui-runtime.js +283 -60
- package/node_modules/@llblab/pi-actors/dist/lib/runs-artifacts.d.ts +26 -1
- package/node_modules/@llblab/pi-actors/dist/lib/runs-artifacts.js +68 -2
- package/node_modules/@llblab/pi-actors/dist/lib/runs-context-exports.d.ts +451 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-context-exports.js +2315 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-context-index.d.ts +97 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-context-index.js +368 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-control-delivery.js +46 -7
- package/node_modules/@llblab/pi-actors/dist/lib/runs-control.d.ts +78 -2
- package/node_modules/@llblab/pi-actors/dist/lib/runs-control.js +334 -2
- package/node_modules/@llblab/pi-actors/dist/lib/runs-controls.js +4 -1
- package/node_modules/@llblab/pi-actors/dist/lib/runs-descendant-launches.d.ts +80 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-descendant-launches.js +287 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-execution-evidence.d.ts +110 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-execution-evidence.js +282 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-index.d.ts +66 -1
- package/node_modules/@llblab/pi-actors/dist/lib/runs-index.js +349 -13
- package/node_modules/@llblab/pi-actors/dist/lib/runs-native-launches.d.ts +73 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-native-launches.js +227 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-outcomes.d.ts +141 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-outcomes.js +292 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-ownership.d.ts +10 -1
- package/node_modules/@llblab/pi-actors/dist/lib/runs-ownership.js +36 -4
- package/node_modules/@llblab/pi-actors/dist/lib/runs-process-windows-mi.d.ts +46 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-process-windows-mi.js +114 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-process.d.ts +34 -1
- package/node_modules/@llblab/pi-actors/dist/lib/runs-process.js +158 -26
- package/node_modules/@llblab/pi-actors/dist/lib/runs-results.d.ts +116 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-results.js +518 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-retention.d.ts +15 -2
- package/node_modules/@llblab/pi-actors/dist/lib/runs-retention.js +148 -9
- package/node_modules/@llblab/pi-actors/dist/lib/runs-session-exports.d.ts +95 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-session-exports.js +470 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-snapshot.d.ts +58 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-snapshot.js +92 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-start.d.ts +2 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-start.js +44 -3
- package/node_modules/@llblab/pi-actors/dist/lib/runs-status.d.ts +15 -1
- package/node_modules/@llblab/pi-actors/dist/lib/runs-status.js +337 -13
- package/node_modules/@llblab/pi-actors/dist/lib/runs-supervision.d.ts +105 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-supervision.js +501 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-trace.d.ts +1 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-trace.js +14 -3
- package/node_modules/@llblab/pi-actors/dist/lib/runtime.js +22 -3
- package/node_modules/@llblab/pi-actors/dist/lib/session-evidence.d.ts +37 -0
- package/node_modules/@llblab/pi-actors/dist/lib/session-evidence.js +59 -3
- package/node_modules/@llblab/pi-actors/dist/lib/state-readers.d.ts +4 -1
- package/node_modules/@llblab/pi-actors/dist/lib/state-readers.js +14 -8
- package/node_modules/@llblab/pi-actors/dist/lib/temp.d.ts +2 -4
- package/node_modules/@llblab/pi-actors/dist/lib/temp.js +4 -56
- package/node_modules/@llblab/pi-actors/dist/lib/tools-access.d.ts +3 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-access.js +13 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-inspect.d.ts +1 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-inspect.js +110 -43
- package/node_modules/@llblab/pi-actors/dist/lib/tools-local.d.ts +3 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-local.js +18 -6
- package/node_modules/@llblab/pi-actors/dist/lib/tools-message.d.ts +4 -1
- package/node_modules/@llblab/pi-actors/dist/lib/tools-message.js +126 -31
- package/node_modules/@llblab/pi-actors/dist/lib/tools-response.d.ts +31 -3
- package/node_modules/@llblab/pi-actors/dist/lib/tools-response.js +311 -47
- package/node_modules/@llblab/pi-actors/dist/lib/tools-spawn.d.ts +3 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-spawn.js +29 -7
- package/node_modules/@llblab/pi-actors/dist/lib/trace-projection.d.ts +20 -0
- package/node_modules/@llblab/pi-actors/dist/lib/trace-projection.js +192 -43
- package/node_modules/@llblab/pi-actors/dist/scripts/async-runner.mjs +272 -194
- package/node_modules/@llblab/pi-actors/dist/scripts/conformance.mjs +14 -2
- package/node_modules/@llblab/pi-actors/dist/skills/actors/SKILL.md +46 -2
- package/node_modules/@llblab/pi-actors/dist/skills/actors/references/diagnostics.md +40 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/references/runs.md +55 -1
- package/node_modules/@llblab/pi-actors/docs/README.md +9 -1
- package/node_modules/@llblab/pi-actors/docs/actor-inspector.md +84 -15
- package/node_modules/@llblab/pi-actors/docs/agent-experience.md +216 -0
- package/node_modules/@llblab/pi-actors/docs/async-runs.md +18 -2
- package/node_modules/@llblab/pi-actors/docs/composition-transport.md +103 -0
- package/node_modules/@llblab/pi-actors/docs/coordinator-delivery.md +204 -4
- package/node_modules/@llblab/pi-actors/docs/inspection.md +38 -2
- package/node_modules/@llblab/pi-actors/docs/output-projection-map.md +130 -0
- package/node_modules/@llblab/pi-actors/docs/releasing.md +19 -2
- package/node_modules/@llblab/pi-actors/docs/run-supervision.md +1622 -0
- package/node_modules/@llblab/pi-actors/docs/template-recipes.md +4 -0
- package/node_modules/@llblab/pi-actors/docs/windows-process-observation.md +248 -0
- package/node_modules/@llblab/pi-actors/index.ts +1 -1
- package/node_modules/@llblab/pi-actors/lib/async-runs.ts +164 -73
- package/node_modules/@llblab/pi-actors/lib/automatic-review-runtime.ts +4 -2
- package/node_modules/@llblab/pi-actors/lib/command-templates.ts +287 -138
- package/node_modules/@llblab/pi-actors/lib/execution-files.ts +118 -0
- package/node_modules/@llblab/pi-actors/lib/execution-output.ts +4 -4
- package/node_modules/@llblab/pi-actors/lib/execution-sessions.ts +57 -27
- package/node_modules/@llblab/pi-actors/lib/execution.ts +8 -0
- package/node_modules/@llblab/pi-actors/lib/extension-runtime.ts +102 -12
- package/node_modules/@llblab/pi-actors/lib/file-state.ts +16 -2
- package/node_modules/@llblab/pi-actors/lib/inspector-command.ts +2 -2
- package/node_modules/@llblab/pi-actors/lib/inspector-overlay.ts +524 -261
- package/node_modules/@llblab/pi-actors/lib/inspector.ts +101 -130
- package/node_modules/@llblab/pi-actors/lib/limits.ts +1 -0
- package/node_modules/@llblab/pi-actors/lib/observability.ts +235 -116
- package/node_modules/@llblab/pi-actors/lib/pi.ts +59 -11
- package/node_modules/@llblab/pi-actors/lib/recipe-projection.ts +232 -0
- package/node_modules/@llblab/pi-actors/lib/recipes-context.ts +27 -6
- package/node_modules/@llblab/pi-actors/lib/registry.ts +266 -36
- package/node_modules/@llblab/pi-actors/lib/run-delivery.ts +1737 -49
- package/node_modules/@llblab/pi-actors/lib/run-supervision.ts +411 -0
- package/node_modules/@llblab/pi-actors/lib/run-ui-runtime.ts +237 -73
- package/node_modules/@llblab/pi-actors/lib/runs-artifacts.ts +73 -1
- package/node_modules/@llblab/pi-actors/lib/runs-context-exports.ts +1871 -0
- package/node_modules/@llblab/pi-actors/lib/runs-context-index.ts +372 -0
- package/node_modules/@llblab/pi-actors/lib/runs-control-delivery.ts +36 -18
- package/node_modules/@llblab/pi-actors/lib/runs-control.ts +297 -1
- package/node_modules/@llblab/pi-actors/lib/runs-controls.ts +3 -1
- package/node_modules/@llblab/pi-actors/lib/runs-descendant-launches.ts +338 -0
- package/node_modules/@llblab/pi-actors/lib/runs-execution-evidence.ts +302 -0
- package/node_modules/@llblab/pi-actors/lib/runs-index.ts +345 -17
- package/node_modules/@llblab/pi-actors/lib/runs-native-launches.ts +270 -0
- package/node_modules/@llblab/pi-actors/lib/runs-outcomes.ts +377 -0
- package/node_modules/@llblab/pi-actors/lib/runs-ownership.ts +37 -4
- package/node_modules/@llblab/pi-actors/lib/runs-process-windows-mi.ts +113 -0
- package/node_modules/@llblab/pi-actors/lib/runs-process.ts +210 -34
- package/node_modules/@llblab/pi-actors/lib/runs-results.ts +601 -0
- package/node_modules/@llblab/pi-actors/lib/runs-retention.ts +134 -10
- package/node_modules/@llblab/pi-actors/lib/runs-session-exports.ts +406 -0
- package/node_modules/@llblab/pi-actors/lib/runs-snapshot.ts +143 -0
- package/node_modules/@llblab/pi-actors/lib/runs-start.ts +44 -2
- package/node_modules/@llblab/pi-actors/lib/runs-status.ts +252 -10
- package/node_modules/@llblab/pi-actors/lib/runs-supervision.ts +394 -0
- package/node_modules/@llblab/pi-actors/lib/runs-trace.ts +14 -3
- package/node_modules/@llblab/pi-actors/lib/runtime.ts +22 -3
- package/node_modules/@llblab/pi-actors/lib/session-evidence.ts +76 -4
- package/node_modules/@llblab/pi-actors/lib/state-readers.ts +16 -7
- package/node_modules/@llblab/pi-actors/lib/temp.ts +3 -56
- package/node_modules/@llblab/pi-actors/lib/tools-access.ts +13 -0
- package/node_modules/@llblab/pi-actors/lib/tools-inspect.ts +110 -51
- package/node_modules/@llblab/pi-actors/lib/tools-local.ts +37 -24
- package/node_modules/@llblab/pi-actors/lib/tools-message.ts +120 -37
- package/node_modules/@llblab/pi-actors/lib/tools-response.ts +273 -50
- package/node_modules/@llblab/pi-actors/lib/tools-spawn.ts +31 -10
- package/node_modules/@llblab/pi-actors/lib/trace-projection.ts +165 -42
- package/node_modules/@llblab/pi-actors/package.json +10 -6
- package/node_modules/@llblab/pi-actors/scripts/async-runner.mjs +272 -194
- package/node_modules/@llblab/pi-actors/scripts/conformance.mjs +14 -2
- package/node_modules/@llblab/pi-actors/skills/actors/SKILL.md +46 -2
- package/node_modules/@llblab/pi-actors/skills/actors/references/diagnostics.md +40 -0
- package/node_modules/@llblab/pi-actors/skills/actors/references/runs.md +55 -1
- package/node_modules/@llblab/pi-codex-usage/AGENTS.md +2 -2
- package/node_modules/@llblab/pi-codex-usage/CHANGELOG.md +6 -0
- package/node_modules/@llblab/pi-codex-usage/README.md +9 -5
- package/node_modules/@llblab/pi-codex-usage/lib/query.ts +229 -50
- package/node_modules/@llblab/pi-codex-usage/lib/usage.ts +9 -1
- package/node_modules/@llblab/pi-codex-usage/package.json +1 -1
- package/node_modules/yaml/LICENSE +13 -0
- package/node_modules/yaml/README.md +172 -0
- package/node_modules/yaml/bin.mjs +11 -0
- package/node_modules/yaml/browser/dist/compose/compose-collection.js +88 -0
- package/node_modules/yaml/browser/dist/compose/compose-doc.js +43 -0
- package/node_modules/yaml/browser/dist/compose/compose-node.js +109 -0
- package/node_modules/yaml/browser/dist/compose/compose-scalar.js +86 -0
- package/node_modules/yaml/browser/dist/compose/composer.js +219 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +115 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +198 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +49 -0
- package/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +207 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +225 -0
- package/node_modules/yaml/browser/dist/compose/resolve-props.js +146 -0
- package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
- package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +26 -0
- package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
- package/node_modules/yaml/browser/dist/compose/util-map-includes.js +13 -0
- package/node_modules/yaml/browser/dist/doc/Document.js +335 -0
- package/node_modules/yaml/browser/dist/doc/anchors.js +71 -0
- package/node_modules/yaml/browser/dist/doc/applyReviver.js +55 -0
- package/node_modules/yaml/browser/dist/doc/createNode.js +88 -0
- package/node_modules/yaml/browser/dist/doc/directives.js +176 -0
- package/node_modules/yaml/browser/dist/errors.js +57 -0
- package/node_modules/yaml/browser/dist/index.js +17 -0
- package/node_modules/yaml/browser/dist/log.js +11 -0
- package/node_modules/yaml/browser/dist/nodes/Alias.js +116 -0
- package/node_modules/yaml/browser/dist/nodes/Collection.js +147 -0
- package/node_modules/yaml/browser/dist/nodes/Node.js +38 -0
- package/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/Scalar.js +24 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +144 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +113 -0
- package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +63 -0
- package/node_modules/yaml/browser/dist/nodes/identity.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/toJS.js +37 -0
- package/node_modules/yaml/browser/dist/parse/cst-scalar.js +214 -0
- package/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
- package/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
- package/node_modules/yaml/browser/dist/parse/cst.js +98 -0
- package/node_modules/yaml/browser/dist/parse/lexer.js +721 -0
- package/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
- package/node_modules/yaml/browser/dist/parse/parser.js +975 -0
- package/node_modules/yaml/browser/dist/public-api.js +102 -0
- package/node_modules/yaml/browser/dist/schema/Schema.js +37 -0
- package/node_modules/yaml/browser/dist/schema/common/map.js +17 -0
- package/node_modules/yaml/browser/dist/schema/common/null.js +15 -0
- package/node_modules/yaml/browser/dist/schema/common/seq.js +17 -0
- package/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
- package/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
- package/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
- package/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
- package/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
- package/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
- package/node_modules/yaml/browser/dist/schema/tags.js +96 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +58 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +67 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +74 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +78 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +39 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +93 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
- package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +146 -0
- package/node_modules/yaml/browser/dist/stringify/stringify.js +129 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +153 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +20 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +85 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +25 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +150 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyString.js +336 -0
- package/node_modules/yaml/browser/dist/util.js +11 -0
- package/node_modules/yaml/browser/dist/visit.js +233 -0
- package/node_modules/yaml/browser/index.js +5 -0
- package/node_modules/yaml/browser/package.json +3 -0
- package/node_modules/yaml/dist/cli.d.ts +8 -0
- package/node_modules/yaml/dist/cli.mjs +201 -0
- package/node_modules/yaml/dist/compose/compose-collection.d.ts +11 -0
- package/node_modules/yaml/dist/compose/compose-collection.js +90 -0
- package/node_modules/yaml/dist/compose/compose-doc.d.ts +7 -0
- package/node_modules/yaml/dist/compose/compose-doc.js +45 -0
- package/node_modules/yaml/dist/compose/compose-node.d.ts +29 -0
- package/node_modules/yaml/dist/compose/compose-node.js +112 -0
- package/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
- package/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
- package/node_modules/yaml/dist/compose/composer.d.ts +63 -0
- package/node_modules/yaml/dist/compose/composer.js +224 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +11 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
- package/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-end.js +39 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +227 -0
- package/node_modules/yaml/dist/compose/resolve-props.d.ts +23 -0
- package/node_modules/yaml/dist/compose/resolve-props.js +148 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +28 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
- package/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
- package/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
- package/node_modules/yaml/dist/doc/Document.d.ts +141 -0
- package/node_modules/yaml/dist/doc/Document.js +337 -0
- package/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
- package/node_modules/yaml/dist/doc/anchors.js +76 -0
- package/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
- package/node_modules/yaml/dist/doc/applyReviver.js +57 -0
- package/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
- package/node_modules/yaml/dist/doc/createNode.js +90 -0
- package/node_modules/yaml/dist/doc/directives.d.ts +49 -0
- package/node_modules/yaml/dist/doc/directives.js +178 -0
- package/node_modules/yaml/dist/errors.d.ts +21 -0
- package/node_modules/yaml/dist/errors.js +62 -0
- package/node_modules/yaml/dist/index.d.ts +25 -0
- package/node_modules/yaml/dist/index.js +50 -0
- package/node_modules/yaml/dist/log.d.ts +3 -0
- package/node_modules/yaml/dist/log.js +19 -0
- package/node_modules/yaml/dist/nodes/Alias.d.ts +29 -0
- package/node_modules/yaml/dist/nodes/Alias.js +118 -0
- package/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
- package/node_modules/yaml/dist/nodes/Collection.js +151 -0
- package/node_modules/yaml/dist/nodes/Node.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/Node.js +40 -0
- package/node_modules/yaml/dist/nodes/Pair.d.ts +22 -0
- package/node_modules/yaml/dist/nodes/Pair.js +39 -0
- package/node_modules/yaml/dist/nodes/Scalar.d.ts +47 -0
- package/node_modules/yaml/dist/nodes/Scalar.js +27 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +60 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +4 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.js +65 -0
- package/node_modules/yaml/dist/nodes/identity.d.ts +23 -0
- package/node_modules/yaml/dist/nodes/identity.js +53 -0
- package/node_modules/yaml/dist/nodes/toJS.d.ts +29 -0
- package/node_modules/yaml/dist/nodes/toJS.js +39 -0
- package/node_modules/yaml/dist/options.d.ts +350 -0
- package/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
- package/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
- package/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
- package/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
- package/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
- package/node_modules/yaml/dist/parse/cst-visit.js +99 -0
- package/node_modules/yaml/dist/parse/cst.d.ts +109 -0
- package/node_modules/yaml/dist/parse/cst.js +112 -0
- package/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
- package/node_modules/yaml/dist/parse/lexer.js +723 -0
- package/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
- package/node_modules/yaml/dist/parse/line-counter.js +41 -0
- package/node_modules/yaml/dist/parse/parser.d.ts +84 -0
- package/node_modules/yaml/dist/parse/parser.js +980 -0
- package/node_modules/yaml/dist/public-api.d.ts +44 -0
- package/node_modules/yaml/dist/public-api.js +107 -0
- package/node_modules/yaml/dist/schema/Schema.d.ts +17 -0
- package/node_modules/yaml/dist/schema/Schema.js +39 -0
- package/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/map.js +19 -0
- package/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
- package/node_modules/yaml/dist/schema/common/null.js +17 -0
- package/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/seq.js +19 -0
- package/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/string.js +16 -0
- package/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/bool.js +21 -0
- package/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/float.js +47 -0
- package/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/int.js +42 -0
- package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/core/schema.js +25 -0
- package/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
- package/node_modules/yaml/dist/schema/json/schema.js +64 -0
- package/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
- package/node_modules/yaml/dist/schema/tags.d.ts +48 -0
- package/node_modules/yaml/dist/schema/tags.js +99 -0
- package/node_modules/yaml/dist/schema/types.d.ts +92 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +70 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +9 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.js +71 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +22 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +28 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
- package/node_modules/yaml/dist/stringify/stringify.d.ts +21 -0
- package/node_modules/yaml/dist/stringify/stringify.js +132 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.js +155 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +4 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.js +27 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
- package/node_modules/yaml/dist/stringify/stringifyString.d.ts +9 -0
- package/node_modules/yaml/dist/stringify/stringifyString.js +338 -0
- package/node_modules/yaml/dist/test-events.d.ts +4 -0
- package/node_modules/yaml/dist/test-events.js +134 -0
- package/node_modules/yaml/dist/util.d.ts +16 -0
- package/node_modules/yaml/dist/util.js +28 -0
- package/node_modules/yaml/dist/visit.d.ts +102 -0
- package/node_modules/yaml/dist/visit.js +236 -0
- package/node_modules/yaml/package.json +97 -0
- package/node_modules/yaml/util.js +2 -0
- package/package.json +3 -3
- package/node_modules/@llblab/pi-actors/banner.jpg +0 -0
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-actions.d.ts +0 -16
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-actions.js +0 -57
- package/node_modules/@llblab/pi-actors/lib/inspector-actions.ts +0 -79
|
@@ -15,6 +15,7 @@ import * as RecipesDiscovery from "./recipes-discovery.js";
|
|
|
15
15
|
import * as RecipesReferences from "./recipes-references.js";
|
|
16
16
|
import * as ReviewDiagnostics from "./review-diagnostics.js";
|
|
17
17
|
import * as RunsControls from "./runs-controls.js";
|
|
18
|
+
import { readRunSessionNavigation } from "./runs-index.js";
|
|
18
19
|
import * as RunControlDelivery from "./runs-control-delivery.js";
|
|
19
20
|
import * as RunsTrace from "./runs-trace.js";
|
|
20
21
|
import * as RuntimeIdentity from "./runtime-identity.js";
|
|
@@ -33,24 +34,37 @@ function runtimeStatus() {
|
|
|
33
34
|
version: RuntimeIdentity.getPackageVersion(),
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
|
-
function runtimeRuns(ctx, deps, status) {
|
|
37
|
+
function runtimeRuns(ctx, deps, status, includeNavigation = false) {
|
|
37
38
|
const session = ToolsAccess.requireContextSessionId(ctx, "runtime Run inventory");
|
|
38
39
|
const listed = deps.listRuns
|
|
39
40
|
? deps.listRuns()
|
|
40
41
|
: AsyncRuns.listRuns(undefined, status);
|
|
42
|
+
const observedFailures = [];
|
|
41
43
|
const runs = listed
|
|
42
44
|
.map((run) => {
|
|
43
45
|
try {
|
|
44
|
-
|
|
46
|
+
const observed = deps.getRunStatus
|
|
45
47
|
? deps.getRunStatus(String(run.state_dir ?? run.run))
|
|
46
48
|
: AsyncRuns.getRunStatus(String(run.state_dir ?? run.run));
|
|
49
|
+
if (includeNavigation && observed.status === "failed" && typeof observed.run === "string" && typeof observed.run_instance_id === "string" &&
|
|
50
|
+
typeof observed.state_dir === "string" && observed.ownerId === session) {
|
|
51
|
+
observedFailures.push({ run: observed.run, run_instance_id: observed.run_instance_id, state_dir: observed.state_dir, ownerId: session });
|
|
52
|
+
}
|
|
53
|
+
return observed;
|
|
47
54
|
}
|
|
48
55
|
catch {
|
|
49
56
|
return run;
|
|
50
57
|
}
|
|
51
58
|
})
|
|
52
59
|
.filter((run) => run.ownerId === session);
|
|
53
|
-
|
|
60
|
+
const navigation = includeNavigation ? readRunSessionNavigation(deps.runStateRoot ?? Paths.getRunStateRoot(), session, {
|
|
61
|
+
root_order: status === "failed" ? "failed_subtrees_first" : "latest_registration",
|
|
62
|
+
failed: observedFailures,
|
|
63
|
+
}) : undefined;
|
|
64
|
+
const current = ToolsAccess.requireContextSessionId(ctx, "runtime Run inventory");
|
|
65
|
+
if (current !== session)
|
|
66
|
+
throw ToolsAccess.sessionMismatchError({ currentSession: current, expectedSession: session, target: "runtime" });
|
|
67
|
+
return { owner_session: session, runs, ...(navigation ? { navigation } : {}) };
|
|
54
68
|
}
|
|
55
69
|
function runtimeTriage(ctx, deps) {
|
|
56
70
|
const inventory = runtimeRuns(ctx, deps, undefined);
|
|
@@ -141,23 +155,55 @@ function runtimeTriage(ctx, deps) {
|
|
|
141
155
|
};
|
|
142
156
|
}
|
|
143
157
|
function compactRuntime(view, details) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
158
|
+
const fields = view === "runs" ? { runs: details.runs?.length ?? 0 }
|
|
159
|
+
: view === "triage" ? {
|
|
160
|
+
failed: details.failed_runs?.length ?? 0,
|
|
161
|
+
pending_controls: Number(details.pending_control_count ?? 0), stale_controls: Number(details.stale_control_count ?? 0),
|
|
162
|
+
backpressured: Number(details.backpressured_run_count ?? 0), incomplete_trace: Number(details.trace_diagnostic_count ?? 0),
|
|
163
|
+
attention: details.attention_events?.length ?? 0,
|
|
164
|
+
} : { version: String(details.version), state_schema: String(details.state_schema), automatic_review: String(details.automatic_review) };
|
|
165
|
+
return "\n" + [ToolsResponse.formatMarkdownField("runtime", view),
|
|
166
|
+
...Object.entries(fields).map(([key, value]) => ToolsResponse.formatMarkdownField(key, String(value)))].join("\n");
|
|
167
|
+
}
|
|
168
|
+
// Projects local refusals only; does not intercept other throws or change existing catches.
|
|
169
|
+
function formatInspectFailure(fields, next) {
|
|
170
|
+
// The unchanged public adapter adds exactly one leading LF to these Error messages.
|
|
171
|
+
const budget = Limits.RUN_DELIVERY_MODEL_MAX_BYTES - 1;
|
|
172
|
+
const omitted = (key) => `- ${key}:\n - state: omitted\n - reason: response_too_large\n - shown: 0\n - omitted: 1\n - total: 1`;
|
|
173
|
+
const field = ([key, value]) => typeof value === "string"
|
|
174
|
+
? ToolsResponse.formatMarkdownField(key, value)
|
|
175
|
+
: `- ${key}:\n${value.map(item => ` - ${item}`).join("\n")}`;
|
|
176
|
+
// Unmarked fields are bounded compiler literals/lists. Short values seed full so admission only grows.
|
|
177
|
+
const formatted = fields.map(field);
|
|
178
|
+
const projected = fields.map((item, index) => {
|
|
179
|
+
const full = formatted[index], fallback = omitted(item[0]);
|
|
180
|
+
return item[2] && Buffer.byteLength(full, "utf8") > Buffer.byteLength(fallback, "utf8") ? fallback : full;
|
|
181
|
+
});
|
|
182
|
+
let action = next ? ToolsResponse.formatInspectNextAction(next[0], next[1]) : "";
|
|
183
|
+
const text = () => [...projected, ...(action ? [action] : [])].join("\n");
|
|
184
|
+
if (next && Buffer.byteLength(text(), "utf8") > budget)
|
|
185
|
+
action = omitted("next_action");
|
|
186
|
+
fields.forEach((item, index) => {
|
|
187
|
+
if (!item[2])
|
|
188
|
+
return;
|
|
189
|
+
const fallback = projected[index];
|
|
190
|
+
projected[index] = formatted[index];
|
|
191
|
+
if (Buffer.byteLength(text(), "utf8") > budget)
|
|
192
|
+
projected[index] = fallback;
|
|
193
|
+
});
|
|
194
|
+
return text();
|
|
151
195
|
}
|
|
152
196
|
function inspectRuntime(view, input, ctx, deps) {
|
|
153
197
|
if (view === "status")
|
|
154
198
|
return runtimeStatus();
|
|
155
199
|
if (view === "runs") {
|
|
156
|
-
return runtimeRuns(ctx, deps, typeof input.status === "string" ? input.status : undefined);
|
|
200
|
+
return runtimeRuns(ctx, deps, typeof input.status === "string" ? input.status : undefined, input.verbose === true);
|
|
157
201
|
}
|
|
158
202
|
if (view === "triage")
|
|
159
203
|
return runtimeTriage(ctx, deps);
|
|
160
|
-
throw new Error(
|
|
204
|
+
throw new Error(formatInspectFailure([
|
|
205
|
+
["target_kind", "runtime"], ["result", "unsupported view"], ["supported_views", ["status", "runs", "triage"]],
|
|
206
|
+
]));
|
|
161
207
|
}
|
|
162
208
|
function portableSkillRecipePath(file, skill, namespaces) {
|
|
163
209
|
const root = namespaces[skill]?.[0];
|
|
@@ -272,7 +318,10 @@ function inspectRecipes(view, input, deps, context) {
|
|
|
272
318
|
view !== "doctor" &&
|
|
273
319
|
view !== "imports" &&
|
|
274
320
|
view !== "reviews") {
|
|
275
|
-
throw new Error(
|
|
321
|
+
throw new Error(formatInspectFailure([
|
|
322
|
+
["target_kind", "recipes"], ["result", "unsupported view"],
|
|
323
|
+
["supported_views", ["status", "summary", "doctor", "imports", "reviews"]],
|
|
324
|
+
]));
|
|
276
325
|
}
|
|
277
326
|
const recipeRoot = deps.recipeRoot ?? Paths.getRecipeRoot();
|
|
278
327
|
if (view === "reviews") {
|
|
@@ -291,7 +340,7 @@ function inspectRecipes(view, input, deps, context) {
|
|
|
291
340
|
const registryStatus = deps.registryStatus?.();
|
|
292
341
|
const identity = typeof input.identity === "string" ? input.identity.trim() : "";
|
|
293
342
|
if (identity && view !== "doctor") {
|
|
294
|
-
throw new Error("
|
|
343
|
+
throw new Error(formatInspectFailure([["target_kind", "recipes"], ["result", "identity requires view=doctor"]]));
|
|
295
344
|
}
|
|
296
345
|
if (view === "doctor" && identity) {
|
|
297
346
|
return inspectRecipeIdentity(identity, resolutionContext, skillRecipeNamespaces, skillInventory, registryStatus);
|
|
@@ -353,7 +402,9 @@ function parseRunTarget(target) {
|
|
|
353
402
|
}
|
|
354
403
|
function inspectRun(run, view, input, ctx, deps) {
|
|
355
404
|
if (view !== "recipe" && view !== "trace" && view !== "control") {
|
|
356
|
-
throw new Error(
|
|
405
|
+
throw new Error(formatInspectFailure([
|
|
406
|
+
["target_kind", "run"], ["result", "unsupported view"], ["supported_views", ["recipe", "trace", "control"]],
|
|
407
|
+
]));
|
|
357
408
|
}
|
|
358
409
|
const status = deps.getRunStatus
|
|
359
410
|
? ToolsAccess.assertRunStatusAccessibleToContext(run, deps.getRunStatus(run), ctx)
|
|
@@ -371,7 +422,10 @@ function inspectRun(run, view, input, ctx, deps) {
|
|
|
371
422
|
source !== "agent" &&
|
|
372
423
|
source !== "artifact" &&
|
|
373
424
|
source !== "runtime") {
|
|
374
|
-
throw new Error(
|
|
425
|
+
throw new Error(formatInspectFailure([
|
|
426
|
+
["target_kind", "run"], ["source", source, true], ["result", "unsupported Trace source"],
|
|
427
|
+
["supported_sources", ["all", "lifecycle", "control", "process", "agent", "artifact", "runtime"]],
|
|
428
|
+
]));
|
|
375
429
|
}
|
|
376
430
|
return {
|
|
377
431
|
run, source,
|
|
@@ -424,18 +478,26 @@ function inspectRun(run, view, input, ctx, deps) {
|
|
|
424
478
|
}
|
|
425
479
|
function inspectTool(name, view, deps) {
|
|
426
480
|
if (!name || !/^[A-Za-z0-9_.-]+$/.test(name)) {
|
|
427
|
-
throw new Error(
|
|
481
|
+
throw new Error(formatInspectFailure([["target", `tool:${name}`, true], ["result", "invalid tool target"]]));
|
|
428
482
|
}
|
|
429
483
|
if (view !== "status" && view !== "schema") {
|
|
430
|
-
throw new Error(
|
|
484
|
+
throw new Error(formatInspectFailure([
|
|
485
|
+
["target_kind", "tool"], ["result", "unsupported view"], ["supported_views", ["status", "schema"]],
|
|
486
|
+
]));
|
|
431
487
|
}
|
|
432
488
|
const tool = deps.getTool?.(name);
|
|
433
489
|
const status = deps.getToolStatus?.(name);
|
|
434
490
|
if (!tool && !status) {
|
|
435
|
-
throw new Error(
|
|
491
|
+
throw new Error(formatInspectFailure([
|
|
492
|
+
["tool", name, true], ["result", "registered tool not found"], ["safety", "Do not substitute spawn for tool invocation."],
|
|
493
|
+
], ["recipes", "doctor"]));
|
|
436
494
|
}
|
|
437
495
|
if (view === "schema" && !tool) {
|
|
438
|
-
throw new Error(
|
|
496
|
+
throw new Error(formatInspectFailure([
|
|
497
|
+
["tool", name, true], ["result", "registered; callable schema unavailable"],
|
|
498
|
+
["callable_now", String(status?.callable_now ?? false), true],
|
|
499
|
+
["activation_boundary", String(status?.activation_boundary ?? "host_registration"), true],
|
|
500
|
+
], [`tool:${name}`, "status"]));
|
|
439
501
|
}
|
|
440
502
|
return {
|
|
441
503
|
name,
|
|
@@ -453,38 +515,40 @@ function compactResult(target, view, details) {
|
|
|
453
515
|
if (target === "runtime")
|
|
454
516
|
return compactRuntime(view, details);
|
|
455
517
|
if (target === "recipes" && typeof details.identity === "string") {
|
|
456
|
-
const
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
];
|
|
467
|
-
return `\n${lines.join("\n")}`;
|
|
518
|
+
const fields = [ToolsResponse.formatMarkdownField("recipes", "doctor"),
|
|
519
|
+
...["identity", "skill_active", "resolvable", "catalog_partial", "component_status"]
|
|
520
|
+
.map(key => ToolsResponse.formatMarkdownField(key, String(details[key]))),
|
|
521
|
+
...(details.source_location ? [ToolsResponse.formatMarkdownField("source_location", ToolsResponse.formatLiteralBlock(String(details.source_location)))] : []),
|
|
522
|
+
ToolsResponse.formatMarkdownField("resolution_generation", String(details.resolution_generation)),
|
|
523
|
+
...(details.rejected_reason ? [ToolsResponse.formatMarkdownField("rejected_reason", String(details.rejected_reason))] : [])];
|
|
524
|
+
const actions = details.next_actions;
|
|
525
|
+
if (actions?.length)
|
|
526
|
+
fields.push(ToolsResponse.formatInspectionHint(String(actions[0])));
|
|
527
|
+
return "\n" + fields.join("\n");
|
|
468
528
|
}
|
|
469
529
|
if (target === "recipes")
|
|
470
530
|
return ToolsResponse.compactRecipeRegistry(details);
|
|
471
531
|
if (target.startsWith("tool:") && view === "status") {
|
|
472
|
-
const
|
|
473
|
-
?
|
|
474
|
-
: "unknown";
|
|
475
|
-
const optional = Array.isArray(details.optional_args)
|
|
476
|
-
? details.optional_args.map(String).join(",") || "none"
|
|
477
|
-
: "unknown";
|
|
532
|
+
const argumentsField = (key, value) => Array.isArray(value) && value.length
|
|
533
|
+
? "- " + key + ":\n" + value.map(item => " - " + String(item).replace(/\r\n|\r|\n/gu, match => match + " ")).join("\n")
|
|
534
|
+
: ToolsResponse.formatMarkdownField(key, Array.isArray(value) ? "none" : "unknown");
|
|
478
535
|
const next = Array.isArray(details.next_actions) && details.next_actions.length > 0
|
|
479
536
|
? String(details.next_actions[0])
|
|
480
537
|
: details.callable_now === true
|
|
481
538
|
? `call tool ${target.slice(5)}`
|
|
482
539
|
: `register_tool name=${target.slice(5)} update=true`;
|
|
483
|
-
return
|
|
540
|
+
return "\n" + [ToolsResponse.formatMarkdownField("tool", target.slice(5)),
|
|
541
|
+
ToolsResponse.formatMarkdownField("source", String(details.source ?? "unknown")),
|
|
542
|
+
ToolsResponse.formatMarkdownField("callable_now", String(details.callable_now ?? false)),
|
|
543
|
+
ToolsResponse.formatMarkdownField("activation_boundary", String(details.activation_boundary ?? "unknown")),
|
|
544
|
+
argumentsField("required_args", details.required_args), argumentsField("optional_args", details.optional_args),
|
|
545
|
+
ToolsResponse.formatMarkdownField("launch_kind", String(details.launch_kind ?? "none")),
|
|
546
|
+
ToolsResponse.formatMarkdownField("spawn_calls", String(Number(details.spawn_calls ?? 0))),
|
|
547
|
+
ToolsResponse.formatMarkdownField("tool_calls", String(Number(details.tool_calls ?? 0))), ToolsResponse.formatInspectionHint(next)].join("\n");
|
|
484
548
|
}
|
|
485
549
|
if (target.startsWith("tool:"))
|
|
486
|
-
return
|
|
487
|
-
return
|
|
550
|
+
return "\n" + ToolsResponse.formatMarkdownField("tool", target.slice(5)) + "\n" + ToolsResponse.formatMarkdownField("view", view);
|
|
551
|
+
return "\n" + ToolsResponse.formatMarkdownField("run", target.slice(4)) + "\n" + ToolsResponse.formatMarkdownField("view", view);
|
|
488
552
|
}
|
|
489
553
|
export function createInspectToolDefinition(deps = {}) {
|
|
490
554
|
return {
|
|
@@ -495,7 +559,7 @@ export function createInspectToolDefinition(deps = {}) {
|
|
|
495
559
|
identity: Schema.stringSchema("Optional canonical <skill>/<recipe> identity for focused Recipe doctor diagnosis."),
|
|
496
560
|
lines: Schema.stringSchema("Bounded item count for Trace or recent Controls."),
|
|
497
561
|
source: Schema.stringSchema("Optional Trace source: all, lifecycle, control, process, agent, artifact, or runtime."),
|
|
498
|
-
status: Schema.stringSchema("Optional runtime Run status filter."),
|
|
562
|
+
status: Schema.stringSchema("Optional runtime Run status filter. With verbose runs, failed prioritizes observed failed subtrees without filtering the navigation map."),
|
|
499
563
|
target: Schema.stringSchema("Target: run:<id>, runtime, recipes, or tool:<name>."),
|
|
500
564
|
verbose: Schema.booleanSchema("Return full JSON instead of compact text."),
|
|
501
565
|
view: Schema.stringSchema("Run view recipe|trace|control, or target-specific management view."),
|
|
@@ -519,7 +583,10 @@ export function createInspectToolDefinition(deps = {}) {
|
|
|
519
583
|
details = inspectTool(target.slice(5), view, deps);
|
|
520
584
|
}
|
|
521
585
|
else {
|
|
522
|
-
throw new Error(
|
|
586
|
+
throw new Error(formatInspectFailure([
|
|
587
|
+
["target", target, true], ["result", "unsupported inspect target"],
|
|
588
|
+
["supported_targets", ["run:<id>", "runtime", "recipes", "tool:<name>"]],
|
|
589
|
+
]));
|
|
523
590
|
}
|
|
524
591
|
}
|
|
525
592
|
return {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* Zones: user recipe tools, generated schemas, async recipe launch
|
|
4
4
|
* Owns wrapping saved local capabilities as executable pi tools
|
|
5
5
|
*/
|
|
6
|
+
import * as AsyncRuns from "./async-runs.ts";
|
|
6
7
|
import * as ModelContext from "./model-context.ts";
|
|
7
8
|
import type { RegisteredTool } from "./config.ts";
|
|
8
9
|
import * as Execution from "./execution.ts";
|
|
@@ -10,6 +11,8 @@ import type * as RecipeResolution from "./recipes-context.ts";
|
|
|
10
11
|
export interface RuntimeToolContext extends ModelContext.CurrentModelContext {
|
|
11
12
|
recipeResolutionContext?: RecipeResolution.RecipeResolutionContext;
|
|
12
13
|
cwd: string;
|
|
14
|
+
/** Kernel-injected only; never sourced from tool input/actor values. */
|
|
15
|
+
onSupervisionClockCaptured?: AsyncRuns.AsyncRunStartOptions["onSupervisionClockCaptured"];
|
|
13
16
|
sessionManager?: {
|
|
14
17
|
getSessionId?: () => string;
|
|
15
18
|
};
|
|
@@ -11,6 +11,7 @@ import * as RecipesReferences from "./recipes-references.js";
|
|
|
11
11
|
import * as RecipesUsage from "./recipes-usage.js";
|
|
12
12
|
import * as Schema from "./schema.js";
|
|
13
13
|
import * as ToolsResponse from "./tools-response.js";
|
|
14
|
+
import { readRunFileNavigationForContext } from "./tools-access.js";
|
|
14
15
|
function getRunOwnerId(ctx) {
|
|
15
16
|
return ctx.sessionManager?.getSessionId?.();
|
|
16
17
|
}
|
|
@@ -138,6 +139,11 @@ export function createRuntimeToolDefinition(cfg, exec) {
|
|
|
138
139
|
? Prompts.formatRecipeToolPromptSnippet(cfg.recipe?.name ?? String(cfg.template), isAsyncRecipe)
|
|
139
140
|
: Prompts.formatRegisteredToolPromptSnippet(cfg.template),
|
|
140
141
|
async execute(toolCallId, params, signal, _onUpdate, ctx) {
|
|
142
|
+
let dispatchEntered = false;
|
|
143
|
+
const execute = (...args) => {
|
|
144
|
+
dispatchEntered = true;
|
|
145
|
+
return exec(...args);
|
|
146
|
+
};
|
|
141
147
|
try {
|
|
142
148
|
if (cfg.sourcePath &&
|
|
143
149
|
!RecipesUsage.recordRecipeLaunch(cfg.sourcePath, new Date(), "tool")) {
|
|
@@ -152,7 +158,7 @@ export function createRuntimeToolDefinition(cfg, exec) {
|
|
|
152
158
|
: typeof run_id === "string" && run_id.trim()
|
|
153
159
|
? run_id.trim()
|
|
154
160
|
: `${cfg.name}-${Date.now()}`;
|
|
155
|
-
const
|
|
161
|
+
const startParams = {
|
|
156
162
|
...base,
|
|
157
163
|
launch_source: "tool",
|
|
158
164
|
launch_correlation: { tool_call_id: toolCallId },
|
|
@@ -167,23 +173,29 @@ export function createRuntimeToolDefinition(cfg, exec) {
|
|
|
167
173
|
tool: cfg.name,
|
|
168
174
|
policy_values: ModelContext.withCurrentModelValues({ ...(cfg.recipe?.values ?? {}), ...values }, ctx),
|
|
169
175
|
values: resolveRecipeToolValues(cfg, values, ctx),
|
|
170
|
-
}
|
|
176
|
+
};
|
|
177
|
+
dispatchEntered = true;
|
|
178
|
+
const meta = AsyncRuns.startRun(startParams, ctx.cwd, { skillContext: ctx.recipeResolutionContext?.activeSkills, onSupervisionClockCaptured: ctx.onSupervisionClockCaptured });
|
|
179
|
+
const details = { ...meta, file_navigation: readRunFileNavigationForContext(meta, ctx) };
|
|
171
180
|
return {
|
|
172
181
|
content: [
|
|
173
182
|
{
|
|
174
183
|
type: "text",
|
|
175
|
-
text: ToolsResponse.compactAsyncRunStatus(
|
|
184
|
+
text: ToolsResponse.compactAsyncRunStatus(details),
|
|
176
185
|
},
|
|
177
186
|
],
|
|
178
|
-
details
|
|
187
|
+
details,
|
|
179
188
|
};
|
|
180
189
|
}
|
|
181
190
|
if (isRecipe && recipeTemplate) {
|
|
182
|
-
return await Execution.executeRegisteredTool({ ...cfg, template: recipeTemplate }, resolveRecipeToolValues(cfg, params, ctx),
|
|
191
|
+
return await Execution.executeRegisteredTool({ ...cfg, template: recipeTemplate }, resolveRecipeToolValues(cfg, params, ctx), execute, ctx.cwd, signal);
|
|
183
192
|
}
|
|
184
|
-
return await Execution.executeRegisteredTool(cfg, Schema.normalizeRuntimeValues(ModelContext.withCurrentModelValues(params, ctx), cfg.argTypes),
|
|
193
|
+
return await Execution.executeRegisteredTool(cfg, Schema.normalizeRuntimeValues(ModelContext.withCurrentModelValues(params, ctx), cfg.argTypes), execute, ctx.cwd, signal);
|
|
185
194
|
}
|
|
186
195
|
catch (error) {
|
|
196
|
+
// Dispatch entry is not effect/closure proof; matching error text cannot justify argument repair or retry.
|
|
197
|
+
if (dispatchEntered)
|
|
198
|
+
throw error;
|
|
187
199
|
throw formatRuntimeToolArgumentError(cfg, error, required, isAsyncRecipe && !isSingletonRecipe);
|
|
188
200
|
}
|
|
189
201
|
},
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Public Control facade under the stable `message` tool name.
|
|
3
|
-
* Zones: Control request validation, Run/runtime dispatch,
|
|
3
|
+
* Zones: Control request validation, Run/runtime dispatch, recipient-scoped receipts
|
|
4
4
|
* Owns public Control execution; journaling, delivery, and lifecycle mutation stay in Run domains.
|
|
5
5
|
*/
|
|
6
|
+
import * as Control from "./control.ts";
|
|
7
|
+
/** Pure first-layer copy; legacy stopped/killed flags are not scope-closure proof. */
|
|
8
|
+
export declare function compactControlResult(request: Control.ControlRequest, result: Record<string, unknown>): string;
|
|
6
9
|
export interface ControlToolDeps {
|
|
7
10
|
getRunStatus?: (run: string) => Record<string, unknown>;
|
|
8
11
|
handleRuntimeControl?: (action: string, input: unknown) => Record<string, unknown>;
|
|
@@ -1,41 +1,109 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Public Control facade under the stable `message` tool name.
|
|
3
|
-
* Zones: Control request validation, Run/runtime dispatch,
|
|
3
|
+
* Zones: Control request validation, Run/runtime dispatch, recipient-scoped receipts
|
|
4
4
|
* Owns public Control execution; journaling, delivery, and lifecycle mutation stay in Run domains.
|
|
5
5
|
*/
|
|
6
6
|
import * as AsyncRuns from "./async-runs.js";
|
|
7
7
|
import * as Control from "./control.js";
|
|
8
8
|
import * as Schema from "./schema.js";
|
|
9
9
|
import * as ToolsAccess from "./tools-access.js";
|
|
10
|
+
import * as Limits from "./limits.js";
|
|
10
11
|
import * as ToolsResponse from "./tools-response.js";
|
|
11
12
|
function asRecord(value) {
|
|
12
13
|
return value && typeof value === "object" && !Array.isArray(value)
|
|
13
14
|
? value
|
|
14
15
|
: {};
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
]
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
.
|
|
17
|
+
const controlField = ToolsResponse.formatMarkdownField;
|
|
18
|
+
/** Only the four compiler-owned guard sites below; never wraps dispatch/dependency errors. */
|
|
19
|
+
function controlGuardText(request, result, options) {
|
|
20
|
+
const key = request.target === "runtime" ? "target" : "run";
|
|
21
|
+
const identity = controlField(key, request.target === "runtime" ? request.target : request.target.slice(4));
|
|
22
|
+
const omittedIdentity = `- ${key}: [omitted]\n- ${key}_omission:\n - reason: response_too_large\n - shown: 0\n - omitted: 1\n - total: 1`;
|
|
23
|
+
const fixed = [controlField("action", request.action), controlField("result", result)];
|
|
24
|
+
let fullOptions = "", omittedOptions = "";
|
|
25
|
+
if (options) {
|
|
26
|
+
const rows = [];
|
|
27
|
+
let malformed = false;
|
|
28
|
+
// Values were selected by the original string filter, not by a new action grammar.
|
|
29
|
+
for (let index = 0; index < options.values.length; index++) {
|
|
30
|
+
const value = options.values[index];
|
|
31
|
+
if (!value.isWellFormed()) {
|
|
32
|
+
malformed = true;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
rows.push(" - " + value.replaceAll(/\r\n|\r|\n/gu, newline => newline + " "));
|
|
36
|
+
}
|
|
37
|
+
omittedOptions = `- ${options.key}: [${malformed ? "unavailable" : "omitted"}]\n- ${options.key}_omission:\n - reason: ${malformed ? "malformed_selected_text" : "response_too_large"}\n - shown: 0\n - omitted: ${options.values.length}\n - total: ${options.values.length}`;
|
|
38
|
+
fullOptions = malformed ? omittedOptions : rows.length ? `- ${options.key}:\n${rows.join("\n")}` : controlField(options.key, "none");
|
|
30
39
|
}
|
|
31
|
-
|
|
40
|
+
// Start with the shorter complete-or-omitted rendering: adding an omission scaffold must
|
|
41
|
+
// never manufacture overflow when the complete small field would fit. Then grow only.
|
|
42
|
+
let selectedIdentity = Buffer.byteLength(identity) <= Buffer.byteLength(omittedIdentity) ? identity : omittedIdentity;
|
|
43
|
+
let selectedOptions = Buffer.byteLength(fullOptions) <= Buffer.byteLength(omittedOptions) ? fullOptions : omittedOptions;
|
|
44
|
+
const render = (target, choices) => ToolsResponse.withLeadingLineBreak([target, ...fixed, ...(options ? [choices] : [])].join("\n"));
|
|
45
|
+
if (Buffer.byteLength(render(identity, selectedOptions)) <= Limits.RUN_DELIVERY_MODEL_MAX_BYTES)
|
|
46
|
+
selectedIdentity = identity;
|
|
47
|
+
if (options && Buffer.byteLength(render(selectedIdentity, fullOptions)) <= Limits.RUN_DELIVERY_MODEL_MAX_BYTES)
|
|
48
|
+
selectedOptions = fullOptions;
|
|
49
|
+
return render(selectedIdentity, selectedOptions);
|
|
50
|
+
}
|
|
51
|
+
function controlNext(action) {
|
|
52
|
+
const inspect = /^inspect target=([^\s]+) view=([^\s]+)$/u.exec(action);
|
|
53
|
+
return inspect ? ToolsResponse.formatInspectNextAction(inspect[1], inspect[2])
|
|
54
|
+
: "- next:\n" + controlField("instruction", action, 1);
|
|
55
|
+
}
|
|
56
|
+
/** Pure first-layer copy; legacy stopped/killed flags are not scope-closure proof. */
|
|
57
|
+
export function compactControlResult(request, result) {
|
|
58
|
+
const fields = [request.target.startsWith("run:") ? controlField("run", request.target.slice(4)) : controlField("target", request.target),
|
|
59
|
+
controlField("action", request.action)];
|
|
60
|
+
if (result.stopped === false || result.archived === false || result.pruned === false) {
|
|
61
|
+
fields.push(controlField("result", "not applied"));
|
|
62
|
+
if (typeof result.reason === "string")
|
|
63
|
+
fields.push(controlField("reason", result.reason));
|
|
64
|
+
const observed = asRecord(result.status);
|
|
65
|
+
if (result.reason === "not running" && typeof observed.status === "string")
|
|
66
|
+
fields.push(controlField("state", observed.status));
|
|
67
|
+
}
|
|
68
|
+
else if (request.action === "kill" && result.stopped === true) {
|
|
69
|
+
fields.push(controlField("result", "kill attempted"), controlField("termination", "unconfirmed"));
|
|
70
|
+
}
|
|
71
|
+
else if (result.archived === true) {
|
|
72
|
+
fields.push(controlField("result", "archived"));
|
|
73
|
+
}
|
|
74
|
+
else if (result.pruned === true) {
|
|
75
|
+
fields.push(controlField("result", "pruned"));
|
|
76
|
+
}
|
|
77
|
+
else if (result.delivery === "queued" || result.delivery === "delivered") {
|
|
78
|
+
fields.push(controlField("delivery", result.delivery), controlField("handling", "unconfirmed"));
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
fields.push(controlField(typeof result.delivery === "string" ? "delivery" : "result", typeof result.delivery === "string" ? result.delivery : typeof result.status === "string" ? result.status : "accepted"));
|
|
82
|
+
if (typeof result.reason === "string")
|
|
83
|
+
fields.push(controlField("reason", result.reason));
|
|
84
|
+
}
|
|
85
|
+
if (typeof result.control_id === "string")
|
|
86
|
+
fields.push(controlField("control_id", result.control_id));
|
|
87
|
+
const actions = Array.isArray(result.next_actions) ? result.next_actions
|
|
88
|
+
: request.target.startsWith("run:") ? runNextActions(request.target.slice(4), result) : [];
|
|
89
|
+
const next = actions.find((action) => typeof action === "string" && action.length > 0);
|
|
90
|
+
if (next)
|
|
91
|
+
fields.push(controlNext(next));
|
|
92
|
+
return ToolsResponse.withLeadingLineBreak(fields.join("\n"));
|
|
32
93
|
}
|
|
33
94
|
function runNextActions(run, result) {
|
|
95
|
+
if (result.stopped === true)
|
|
96
|
+
return [`inspect target=run:${run} view=trace`];
|
|
97
|
+
if (result.stopped === false || result.archived === false || result.pruned === false) {
|
|
98
|
+
if (result.reason === "ownership changed" || result.reason === "run generation changed") {
|
|
99
|
+
return ["inspect target=runtime view=runs"];
|
|
100
|
+
}
|
|
101
|
+
if (result.stopped === false && result.reason !== "not running")
|
|
102
|
+
return [`inspect target=run:${run} view=trace`];
|
|
103
|
+
}
|
|
34
104
|
if (result.delivery === "queued" || result.delivery === "delivered") {
|
|
35
105
|
return [`inspect target=run:${run} view=control`];
|
|
36
106
|
}
|
|
37
|
-
if (result.stopped === true)
|
|
38
|
-
return [`inspect target=run:${run} view=control`];
|
|
39
107
|
return [];
|
|
40
108
|
}
|
|
41
109
|
export function createControlToolDefinition(deps = {}) {
|
|
@@ -58,10 +126,12 @@ export function createControlToolDefinition(deps = {}) {
|
|
|
58
126
|
let result;
|
|
59
127
|
if (request.target === "runtime") {
|
|
60
128
|
if (request.action !== "review.retry" && request.action !== "review.reset") {
|
|
61
|
-
throw new Error(
|
|
129
|
+
throw new Error(controlGuardText(request, "unsupported runtime Control action", {
|
|
130
|
+
key: "supported_actions", values: ["review.retry", "review.reset"],
|
|
131
|
+
}));
|
|
62
132
|
}
|
|
63
133
|
if (!deps.handleRuntimeControl) {
|
|
64
|
-
throw new Error("runtime Control is unavailable");
|
|
134
|
+
throw new Error(controlGuardText(request, "runtime Control is unavailable"));
|
|
65
135
|
}
|
|
66
136
|
result = deps.handleRuntimeControl(request.action, request.input);
|
|
67
137
|
}
|
|
@@ -74,7 +144,7 @@ export function createControlToolDefinition(deps = {}) {
|
|
|
74
144
|
? status.run_instance_id
|
|
75
145
|
: undefined;
|
|
76
146
|
if (!runInstanceId)
|
|
77
|
-
throw new Error(
|
|
147
|
+
throw new Error(controlGuardText(request, "Run generation unavailable"));
|
|
78
148
|
if (request.action === "kill") {
|
|
79
149
|
result = AsyncRuns.killRun(run, {
|
|
80
150
|
...(typeof status.ownerId === "string"
|
|
@@ -108,17 +178,42 @@ export function createControlToolDefinition(deps = {}) {
|
|
|
108
178
|
? status.control.filter((action) => typeof action === "string")
|
|
109
179
|
: [];
|
|
110
180
|
if (!declared.includes(request.action)) {
|
|
111
|
-
|
|
181
|
+
// The old join/template evaluation may itself throw or have observable hooks.
|
|
182
|
+
// Preserve it before the new presentation; it is not an action-list parser.
|
|
183
|
+
void `${declared.join(",") || "none"}`;
|
|
184
|
+
throw new Error(controlGuardText(request, "undeclared Run Control action", {
|
|
185
|
+
key: "available_actions", values: declared,
|
|
186
|
+
}));
|
|
112
187
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
188
|
+
try {
|
|
189
|
+
result = await AsyncRuns.sendRunControl(run, {
|
|
190
|
+
action: request.action,
|
|
191
|
+
...(request.input !== undefined ? { input: request.input } : {}),
|
|
192
|
+
run_instance_id: runInstanceId,
|
|
193
|
+
}, {
|
|
194
|
+
...(typeof status.ownerId === "string"
|
|
195
|
+
? { ownerId: status.ownerId }
|
|
196
|
+
: {}),
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
catch (cause) {
|
|
200
|
+
// Admission-era correlation is not current reply-scope proof after an awaited dispatch.
|
|
201
|
+
const summary = [controlField("action", request.action), controlField("result", "request failed"),
|
|
202
|
+
controlField("delivery", "unconfirmed"), controlField("handling", "unconfirmed"),
|
|
203
|
+
controlField("warning", "Effects may already exist.\nDo not repeat automatically."),
|
|
204
|
+
controlNext("inspect target=runtime view=runs")].join("\n");
|
|
205
|
+
// Reserve both line breaks; display one whole caller-owned id or explicit whole-id omission.
|
|
206
|
+
const identity = controlField("run", run);
|
|
207
|
+
const target = Buffer.byteLength(identity) <= Limits.RUN_DELIVERY_MODEL_MAX_BYTES - Buffer.byteLength(summary) - 2
|
|
208
|
+
? identity
|
|
209
|
+
: "- run: [omitted]\n- run_omission:\n - reason: response_too_large\n - shown: 0\n - omitted: 1\n - total: 1";
|
|
210
|
+
throw new Error(ToolsResponse.withLeadingLineBreak(target + "\n" + summary), { cause });
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// A refused identity change must not publish the replacement's status, even in verbose/details.
|
|
214
|
+
if (result.reason === "ownership changed" || result.reason === "run generation changed") {
|
|
215
|
+
result = { ...result };
|
|
216
|
+
delete result.status;
|
|
122
217
|
}
|
|
123
218
|
const nextActions = runNextActions(run, result);
|
|
124
219
|
if (nextActions.length > 0)
|
|
@@ -1,8 +1,30 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
* Zones: compact text summaries,
|
|
4
|
-
* Owns model-facing
|
|
2
|
+
* Shared response formatting.
|
|
3
|
+
* Zones: compact text summaries, snapshot/literal rendering, JSON switching, next-action rendering.
|
|
4
|
+
* Owns model-facing formatting shared by tool and coordinator delivery paths.
|
|
5
|
+
* Excludes: evidence reads/admission, source visibility, clock measurement and lifecycle/delivery authority.
|
|
5
6
|
*/
|
|
7
|
+
export type YamlMetadataRendering = {
|
|
8
|
+
readonly state: "available";
|
|
9
|
+
readonly text: string;
|
|
10
|
+
} | {
|
|
11
|
+
readonly state: "unavailable";
|
|
12
|
+
readonly reason: "budget_invalid" | "metadata_invalid" | "metadata_too_large";
|
|
13
|
+
};
|
|
14
|
+
/** Pure selected-metadata formatting, not admission or authority. */
|
|
15
|
+
export declare function renderYamlMetadata(value: unknown, byteBudget: number): YamlMetadataRendering;
|
|
16
|
+
export declare function formatMarkdownField(key: string, value: string, depth?: number): string;
|
|
17
|
+
export declare function formatInspectNextAction(target: string, view: string, verbose?: boolean): string;
|
|
18
|
+
export declare function formatLiteralBlock(value: string): string;
|
|
19
|
+
export type RunSnapshotRendering = {
|
|
20
|
+
readonly state: "available";
|
|
21
|
+
readonly text: string;
|
|
22
|
+
} | {
|
|
23
|
+
readonly state: "unavailable";
|
|
24
|
+
readonly reason: "snapshot_invalid" | "snapshot_too_large" | "format_invalid" | "render_too_large";
|
|
25
|
+
};
|
|
26
|
+
/** Pure formatting of already-admitted snapshots. DTO/schema validity is NOT source, timing, visibility or lifecycle authority. */
|
|
27
|
+
export declare function renderRunSnapshot(value: unknown, format?: "text" | "json"): Readonly<RunSnapshotRendering>;
|
|
6
28
|
export declare function withLeadingLineBreak(text: string): string;
|
|
7
29
|
export declare function spaceToolResult<T>(result: T): T;
|
|
8
30
|
export declare function spaceToolError(error: unknown): unknown;
|
|
@@ -10,11 +32,17 @@ export declare function asRecord(value: unknown): Record<string, unknown>;
|
|
|
10
32
|
export declare function jsonText(value: unknown): string;
|
|
11
33
|
export declare function compactPreview(value: unknown, maxLength?: number): string | undefined;
|
|
12
34
|
export declare function compactNextActions(actions: string[]): string;
|
|
35
|
+
/** Frozen older completion-format text: new launch layout must not change this shared packet helper. */
|
|
36
|
+
export declare function formatRunFileNavigationHandoff(): string;
|
|
13
37
|
export declare function runNextActions(run: unknown): string[];
|
|
14
38
|
export declare function compactAsyncRunStatus(value: unknown): string;
|
|
15
39
|
export declare function maybeJsonText(value: unknown, verbose: boolean | undefined, compact: string): string;
|
|
40
|
+
/** Full spawn metadata retains legacy JSON selection; projection is not launch or source authority. */
|
|
41
|
+
export declare function spawnMetadataText(value: unknown, verbose: boolean | undefined, compact: string): string;
|
|
16
42
|
export declare function compactRecipeImports(summary: Record<string, unknown>): string;
|
|
17
43
|
export declare function compactRecipeDoctor(summary: Record<string, unknown>): string;
|
|
18
44
|
export declare function recipeRegistryNextActions(summary: Record<string, unknown>, view: string): string[];
|
|
45
|
+
/** Only these existing read-only inspection hints become action nodes; other advice stays content. */
|
|
46
|
+
export declare function formatInspectionHint(action: string): string;
|
|
19
47
|
export declare function compactRecipeRegistry(summary: Record<string, unknown>): string;
|
|
20
48
|
export declare const DEFAULT_INSPECT_LINES = 40;
|