@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
|
@@ -1,10 +1,145 @@
|
|
|
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
|
*/
|
|
6
7
|
|
|
8
|
+
import { Document, isScalar, visit } from "yaml";
|
|
7
9
|
import * as Limits from "./limits.ts";
|
|
10
|
+
import type { RunSnapshot } from "./runs-snapshot.ts";
|
|
11
|
+
|
|
12
|
+
export type YamlMetadataRendering =
|
|
13
|
+
| { readonly state: "available"; readonly text: string }
|
|
14
|
+
| { readonly state: "unavailable"; readonly reason: "budget_invalid" | "metadata_invalid" | "metadata_too_large" };
|
|
15
|
+
|
|
16
|
+
function yamlMetadataText(value: unknown): string {
|
|
17
|
+
const document = new Document(value, { version: "1.2", schema: "core", aliasDuplicateObjects: false });
|
|
18
|
+
// yaml's plain-key preference otherwise treats a leading BOM as document whitespace.
|
|
19
|
+
visit(document, { Pair(_key, pair) {
|
|
20
|
+
if (isScalar(pair.key) && typeof pair.key.value === "string" && pair.key.value.includes("\uFEFF")) pair.key.type = "QUOTE_DOUBLE";
|
|
21
|
+
} });
|
|
22
|
+
return document.toString({ collectionStyle: "block", indent: 2, lineWidth: 0, directives: false,
|
|
23
|
+
defaultKeyType: "PLAIN", defaultStringType: "QUOTE_DOUBLE", doubleQuotedAsJSON: true });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/** Pure selected-metadata formatting, not admission or authority. */
|
|
27
|
+
export function renderYamlMetadata(value: unknown, byteBudget: number): YamlMetadataRendering {
|
|
28
|
+
// Execution ceiling, not a caller allowance. The caller still owns its smaller policy budget.
|
|
29
|
+
if (!Number.isSafeInteger(byteBudget) || byteBudget <= 0 || byteBudget > 49152) return { state: "unavailable", reason: "budget_invalid" };
|
|
30
|
+
let remaining = byteBudget;
|
|
31
|
+
let reason: "metadata_invalid" | "metadata_too_large" = "metadata_invalid";
|
|
32
|
+
const active = new Set<object>();
|
|
33
|
+
const charge = (bytes: number): boolean => {
|
|
34
|
+
remaining -= bytes;
|
|
35
|
+
if (remaining >= 0) return true;
|
|
36
|
+
reason = "metadata_too_large";
|
|
37
|
+
return false;
|
|
38
|
+
};
|
|
39
|
+
const string = (text: string): boolean => {
|
|
40
|
+
if (text.length > remaining) { reason = "metadata_too_large"; return false; }
|
|
41
|
+
return text.isWellFormed() && charge(Buffer.byteLength(text, "utf8"));
|
|
42
|
+
};
|
|
43
|
+
const copy = (input: unknown, depth: number): { value: unknown } | undefined => {
|
|
44
|
+
if (!charge(1)) return undefined;
|
|
45
|
+
if (typeof input === "string") return string(input) ? { value: input } : undefined;
|
|
46
|
+
if (input === null || typeof input === "boolean") return { value: input };
|
|
47
|
+
// Refuse -0 explicitly: default YAML numeric serialization would erase its sign.
|
|
48
|
+
if (typeof input === "number") return Number.isFinite(input) && !Object.is(input, -0) ? { value: input } : undefined;
|
|
49
|
+
if (!input || typeof input !== "object") return undefined;
|
|
50
|
+
// Small explicit supported-input ceiling protects the library's recursive AST/stringifier.
|
|
51
|
+
if (depth > 64 || active.has(input)) return undefined;
|
|
52
|
+
const array = Array.isArray(input), prototype = Object.getPrototypeOf(input);
|
|
53
|
+
if (array ? prototype !== Array.prototype : prototype !== Object.prototype && prototype !== null) return undefined;
|
|
54
|
+
active.add(input);
|
|
55
|
+
const result: unknown[] | Record<string, unknown> = array ? [] : Object.create(null);
|
|
56
|
+
const length = array ? Object.getOwnPropertyDescriptor(input, "length") : undefined;
|
|
57
|
+
if (array && (!length || !Object.hasOwn(length, "value") || !Number.isSafeInteger(length.value) || length.value < 0)) return undefined;
|
|
58
|
+
if (array && length!.value > remaining) { reason = "metadata_too_large"; return undefined; }
|
|
59
|
+
let count = 0;
|
|
60
|
+
// ownKeys is necessarily atomic reflection; descriptor/value walks stop at the budget.
|
|
61
|
+
for (const key of Reflect.ownKeys(input)) {
|
|
62
|
+
if (array && key === "length") continue;
|
|
63
|
+
if (typeof key !== "string" || (array && key !== String(count))) return undefined;
|
|
64
|
+
const descriptor = Object.getOwnPropertyDescriptor(input, key);
|
|
65
|
+
if (!descriptor || !Object.hasOwn(descriptor, "value") || !descriptor.enumerable) return undefined;
|
|
66
|
+
if (!array && !string(key)) return undefined;
|
|
67
|
+
const child = copy(descriptor.value, depth + 1);
|
|
68
|
+
if (!child) return undefined;
|
|
69
|
+
Object.defineProperty(result, key, { value: child.value, enumerable: true, configurable: true, writable: true });
|
|
70
|
+
count++;
|
|
71
|
+
}
|
|
72
|
+
if (array && count !== length!.value) return undefined;
|
|
73
|
+
active.delete(input);
|
|
74
|
+
return { value: result };
|
|
75
|
+
};
|
|
76
|
+
try {
|
|
77
|
+
if (!value || typeof value !== "object") return { state: "unavailable", reason: "metadata_invalid" };
|
|
78
|
+
const copied = copy(value, 0);
|
|
79
|
+
if (!copied) return { state: "unavailable", reason };
|
|
80
|
+
const text = yamlMetadataText(copied.value);
|
|
81
|
+
return Buffer.byteLength(text, "utf8") <= byteBudget ? { state: "available", text } : { state: "unavailable", reason: "metadata_too_large" };
|
|
82
|
+
} catch {
|
|
83
|
+
return { state: "unavailable", reason: "metadata_invalid" };
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export function formatMarkdownField(key: string, value: string, depth = 0): string {
|
|
88
|
+
const indent = " ".repeat(depth);
|
|
89
|
+
return /[\r\n]/u.test(value)
|
|
90
|
+
? `${indent}- ${key}:\n${indent} ${value.replaceAll(/\r\n|\r|\n/gu, newline => `${newline}${indent} `)}`
|
|
91
|
+
: `${indent}- ${key}: ${value}`;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function formatInspectNextAction(target: string, view: string, verbose?: boolean): string {
|
|
95
|
+
return ["- next:", formatMarkdownField("tool", "inspect", 1), formatMarkdownField("target", target, 1),
|
|
96
|
+
formatMarkdownField("view", view, 1), ...(verbose === undefined ? [] : [formatMarkdownField("verbose", String(verbose), 1)])].join("\n");
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function formatLiteralBlock(value: string): string {
|
|
100
|
+
let length = 3;
|
|
101
|
+
for (const run of value.matchAll(/`+/gu)) length = Math.max(length, run[0].length + 1);
|
|
102
|
+
const fence = "`".repeat(length);
|
|
103
|
+
return `${fence}text\n${value}\n${fence}`;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export type RunSnapshotRendering =
|
|
107
|
+
| { readonly state: "available"; readonly text: string }
|
|
108
|
+
| { readonly state: "unavailable"; readonly reason: "snapshot_invalid" | "snapshot_too_large" | "format_invalid" | "render_too_large" };
|
|
109
|
+
|
|
110
|
+
/** Pure formatting of already-admitted snapshots. DTO/schema validity is NOT source, timing, visibility or lifecycle authority. */
|
|
111
|
+
export function renderRunSnapshot(value: unknown, format: "text" | "json" = "text"): Readonly<RunSnapshotRendering> {
|
|
112
|
+
const unavailable = (reason: Extract<RunSnapshotRendering, { state: "unavailable" }>["reason"]): Readonly<RunSnapshotRendering> => Object.freeze({ state: "unavailable", reason });
|
|
113
|
+
if (format !== "text" && format !== "json") return unavailable("format_invalid");
|
|
114
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) return unavailable("snapshot_invalid");
|
|
115
|
+
const fields: Record<string, unknown> = Object.create(null);
|
|
116
|
+
for (const key of ["kind", "run", "run_instance_id", "captured_at", "elapsed_ms", "status", "phase", "cwd", "evidence", "evidence_error"]) {
|
|
117
|
+
const field = Object.getOwnPropertyDescriptor(value, key);
|
|
118
|
+
if (!field) { if (key !== "phase" && key !== "evidence_error") return unavailable("snapshot_invalid"); continue; }
|
|
119
|
+
if (!Object.hasOwn(field, "value")) return unavailable("snapshot_invalid");
|
|
120
|
+
if (typeof field.value === "string" && field.value.length > Limits.RUN_DELIVERY_MODEL_MAX_BYTES) return unavailable("snapshot_too_large");
|
|
121
|
+
fields[key] = field.value;
|
|
122
|
+
}
|
|
123
|
+
const { kind, run, run_instance_id, captured_at, elapsed_ms, status, phase, cwd, evidence, evidence_error } = fields;
|
|
124
|
+
const scalar = (text: unknown): text is string => typeof text === "string" && text.length > 0 && Buffer.from(text).toString("utf8") === text;
|
|
125
|
+
const reference = (text: unknown): text is string => scalar(text) && !/[\u0000-\u001f\u007f]/u.test(text);
|
|
126
|
+
if (evidence !== null && !reference(evidence)) return unavailable("snapshot_invalid");
|
|
127
|
+
if (kind !== "run_snapshot" || !scalar(run) || /[^A-Za-z0-9_.-]/u.test(run) || !scalar(run_instance_id) || /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/u.test(run_instance_id) ||
|
|
128
|
+
!scalar(captured_at) || !Number.isSafeInteger(Date.parse(captured_at)) || new Date(Date.parse(captured_at)).toISOString() !== captured_at ||
|
|
129
|
+
typeof elapsed_ms !== "number" || !Number.isSafeInteger(elapsed_ms) || elapsed_ms < 0 || (status !== "running" && status !== "done" && status !== "failed") ||
|
|
130
|
+
(phase !== undefined && (status !== "running" || phase !== "stopping")) || !reference(cwd) ||
|
|
131
|
+
(evidence === null ? evidence_error !== "index_unavailable" : evidence_error !== undefined)) return unavailable("snapshot_invalid");
|
|
132
|
+
const snapshot: Readonly<RunSnapshot> = Object.freeze({ kind, run, run_instance_id, captured_at, elapsed_ms, status,
|
|
133
|
+
...(phase === "stopping" ? { phase } as const : {}), cwd, evidence,
|
|
134
|
+
...(evidence === null ? { evidence_error: "index_unavailable" } as const : {}) });
|
|
135
|
+
// Compact JSON preserves the same bounded payload without a second pretty-print allowance or implicit fallback.
|
|
136
|
+
const json = JSON.stringify(snapshot);
|
|
137
|
+
if (Buffer.byteLength(json, "utf8") > Limits.RUN_DELIVERY_MODEL_MAX_BYTES) return unavailable("snapshot_too_large");
|
|
138
|
+
const text = format === "json" ? json
|
|
139
|
+
: `run:${snapshot.run} · ${snapshot.status}${snapshot.phase ? ` (${snapshot.phase})` : ""} · elapsed=${snapshot.elapsed_ms}ms\ngeneration:\n${formatLiteralBlock(snapshot.run_instance_id)}` +
|
|
140
|
+
`\ncaptured_at: ${snapshot.captured_at}\ncwd:\n${formatLiteralBlock(snapshot.cwd)}\nevidence:${snapshot.evidence === null ? " unavailable (index_unavailable)" : `\n${formatLiteralBlock(snapshot.evidence)}`}`;
|
|
141
|
+
return Buffer.byteLength(text, "utf8") > Limits.RUN_DELIVERY_MODEL_MAX_BYTES ? unavailable("render_too_large") : Object.freeze({ state: "available", text });
|
|
142
|
+
}
|
|
8
143
|
|
|
9
144
|
export function withLeadingLineBreak(text: string): string {
|
|
10
145
|
return `\n${text.replace(/^\n+/, "")}`;
|
|
@@ -71,23 +206,31 @@ function formatFailureCount(value: unknown): number | undefined {
|
|
|
71
206
|
return Array.isArray(value) ? value.length : undefined;
|
|
72
207
|
}
|
|
73
208
|
|
|
74
|
-
function
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
209
|
+
function launchModelPolicy(value: unknown): Record<string, unknown> {
|
|
210
|
+
const policy = asRecord(value), fields: Record<string, unknown> = {};
|
|
211
|
+
for (const key of ["model", "thinking"]) {
|
|
212
|
+
const axis = asRecord(policy[key]);
|
|
213
|
+
if (typeof axis.source !== "string" || !axis.source || axis.source === "unused") continue;
|
|
214
|
+
const source = axis.source;
|
|
215
|
+
// Retain legacy coercion/error behavior for unstable getter-produced values.
|
|
216
|
+
formatMarkdownField("source", source as string, 1);
|
|
217
|
+
const selected: Record<string, unknown> = { source };
|
|
218
|
+
if (typeof axis.value === "string" && axis.value.trim()) {
|
|
219
|
+
const text = axis.value.trim();
|
|
220
|
+
formatMarkdownField("value", text, 1);
|
|
221
|
+
selected.value = text;
|
|
222
|
+
}
|
|
223
|
+
fields[key] = Object.values(selected).every(field => typeof field === "string" && field.isWellFormed())
|
|
224
|
+
? selected : { state: "unavailable", reason: "metadata_invalid" };
|
|
225
|
+
}
|
|
226
|
+
return fields;
|
|
83
227
|
}
|
|
84
228
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
].filter((token): token is string => Boolean(token));
|
|
229
|
+
const RUN_FILE_INVESTIGATION_COMMAND = "inspect target=runtime view=runs verbose=true";
|
|
230
|
+
|
|
231
|
+
/** Frozen older completion-format text: new launch layout must not change this shared packet helper. */
|
|
232
|
+
export function formatRunFileNavigationHandoff(): string {
|
|
233
|
+
return `Files (optional; current session):\n\`${RUN_FILE_INVESTIGATION_COMMAND}\``;
|
|
91
234
|
}
|
|
92
235
|
|
|
93
236
|
export function runNextActions(run: unknown): string[] {
|
|
@@ -97,42 +240,83 @@ export function runNextActions(run: unknown): string[] {
|
|
|
97
240
|
`inspect target=run:${id} view=recipe`,
|
|
98
241
|
`inspect target=run:${id} view=trace`,
|
|
99
242
|
`inspect target=run:${id} view=control`,
|
|
243
|
+
RUN_FILE_INVESTIGATION_COMMAND,
|
|
100
244
|
];
|
|
101
245
|
}
|
|
102
246
|
|
|
103
247
|
export function compactAsyncRunStatus(value: unknown): string {
|
|
104
|
-
const status = asRecord(value);
|
|
105
|
-
const
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (status
|
|
113
|
-
if (status.
|
|
114
|
-
if (status.
|
|
115
|
-
|
|
116
|
-
if (Number(
|
|
117
|
-
if (progress.phase && progress.phase !== status.status)
|
|
118
|
-
tokens.push(`phase=${String(progress.phase)}`);
|
|
119
|
-
if (Number(progress.activeSubagents) > 0)
|
|
120
|
-
tokens.push(`active=${Number(progress.activeSubagents)}`);
|
|
121
|
-
if (Number(progress.completed) > 0)
|
|
122
|
-
tokens.push(`completed=${Number(progress.completed)}`);
|
|
248
|
+
const status = asRecord(value), progress = asRecord(status.progress), result = asRecord(status.result);
|
|
249
|
+
const run = String(status.run ?? "<unknown>"), displayRun = run.startsWith("run:") ? run.slice(4) : run;
|
|
250
|
+
const core: Record<string, unknown> = { run: displayRun, state: String(status.status ?? "unknown") };
|
|
251
|
+
if (status.launch_kind) core.launch_kind = String(status.launch_kind);
|
|
252
|
+
if (status.reused === true) core.launch = "existing Run reused";
|
|
253
|
+
const catalog = asRecord(status.catalog_registration);
|
|
254
|
+
if (catalog.state === "unavailable" && catalog.reason === "catalog_registration_failed") core.catalog = "unavailable";
|
|
255
|
+
const fields: Record<string, unknown> = { ...core, ...launchModelPolicy(status.model_policy ?? progress.model_policy) };
|
|
256
|
+
for (const key of ["tool", "recipe", "retire_when"]) if (status[key]) fields[key] = String(status[key]);
|
|
257
|
+
if (Number(status.pid) > 0) fields.pid = Number(status.pid);
|
|
258
|
+
if (progress.phase && progress.phase !== status.status) fields.phase = String(progress.phase);
|
|
259
|
+
if (Number(progress.activeSubagents) > 0) fields.active_subagents = Number(progress.activeSubagents);
|
|
260
|
+
if (Number(progress.completed) > 0) fields.completed = Number(progress.completed);
|
|
123
261
|
const failures = formatFailureCount(progress.failures);
|
|
124
|
-
if (failures !== undefined && failures > 0)
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
262
|
+
if (failures !== undefined && failures > 0) fields.failures = failures;
|
|
263
|
+
if (result.code !== undefined) {
|
|
264
|
+
const code = result.code, text = String(code);
|
|
265
|
+
fields.code = typeof code === "number" || typeof code === "boolean" ? code : text;
|
|
266
|
+
}
|
|
267
|
+
if (result.killed === true) fields.killed = true;
|
|
268
|
+
if (status.draft_recipe) fields.draft_recipe = String(status.draft_recipe);
|
|
269
|
+
const hint = { file_investigation: "optional; current session", next: { tool: "inspect", target: "runtime", view: "runs", verbose: true } };
|
|
270
|
+
const hasNavigation = Object.hasOwn(status, "file_navigation");
|
|
271
|
+
let navigation: unknown;
|
|
272
|
+
if (hasNavigation) {
|
|
273
|
+
// Preserve the original JSON selection (including hooks and thrown errors), once only.
|
|
274
|
+
const json = JSON.stringify(status.file_navigation ?? { state: "unavailable", reason: "navigation_unavailable" });
|
|
275
|
+
if (json === undefined) formatLiteralBlock(json!);
|
|
276
|
+
navigation = JSON.parse(json!);
|
|
277
|
+
}
|
|
278
|
+
const direct = hasNavigation && asRecord(status.file_navigation).state === "available" && asRecord(navigation).state === "available";
|
|
279
|
+
const budget = Limits.RUN_DELIVERY_MODEL_MAX_BYTES - 1;
|
|
280
|
+
const render = (metadata: Record<string, unknown>): string | undefined => {
|
|
281
|
+
const rendered = renderYamlMetadata(metadata, budget);
|
|
282
|
+
return rendered.state === "available" ? withLeadingLineBreak(rendered.text) : undefined;
|
|
283
|
+
};
|
|
284
|
+
// Invalid selected scalars are unavailable whole values, never repaired strings/paths.
|
|
285
|
+
for (const group of [core, fields]) {
|
|
286
|
+
for (const key of Object.keys(group)) {
|
|
287
|
+
const field = group[key];
|
|
288
|
+
if ((typeof field === "string" && !field.isWellFormed()) ||
|
|
289
|
+
(typeof field === "number" && (!Number.isFinite(field) || Object.is(field, -0)))) {
|
|
290
|
+
group[key] = { state: "unavailable", reason: "metadata_invalid" };
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
// Validate only runtime-selected JSON facts, never walk the original navigation again.
|
|
295
|
+
const navigationRendering = hasNavigation ? renderYamlMetadata({ run_files: navigation }, budget) : undefined;
|
|
296
|
+
const invalidNavigation = navigationRendering?.state === "unavailable" && navigationRendering.reason === "metadata_invalid";
|
|
297
|
+
const locations = !hasNavigation ? {} : { run_files: invalidNavigation
|
|
298
|
+
? { state: "unavailable", reason: "metadata_invalid" } : navigation,
|
|
299
|
+
run_files_observation: "Observed locations; mutable." };
|
|
300
|
+
const full = render({ ...fields, ...locations, ...(direct && !invalidNavigation ? {} : hint) });
|
|
301
|
+
if (full !== undefined) return full;
|
|
302
|
+
const omitted = !hasNavigation ? {} : { run_files: { state: "omitted", reason: "response_too_large", shown: 0, omitted: 1, total: 1 } };
|
|
303
|
+
const withoutRow = render({ ...fields, ...omitted, ...hint });
|
|
304
|
+
if (withoutRow !== undefined) return withoutRow;
|
|
305
|
+
// Keep the original fallback observation order; no rereads on successful full receipts.
|
|
306
|
+
const fallback = { ...core };
|
|
307
|
+
if (typeof status.run_instance_id === "string") {
|
|
308
|
+
const generation = status.run_instance_id;
|
|
309
|
+
formatMarkdownField("run_instance_id", generation as string);
|
|
310
|
+
fallback.run_instance_id = typeof generation === "string" && generation.isWellFormed()
|
|
311
|
+
? generation : { state: "unavailable", reason: "metadata_invalid" };
|
|
312
|
+
}
|
|
313
|
+
if (Number(status.pid) > 0) {
|
|
314
|
+
const pid = Number(status.pid);
|
|
315
|
+
fallback.pid = Number.isFinite(pid) && !Object.is(pid, -0) ? pid : { state: "unavailable", reason: "metadata_invalid" };
|
|
316
|
+
}
|
|
317
|
+
const omission = { launch_fields: "omitted", launch_omission: "response_too_large" };
|
|
318
|
+
return render({ ...omission, ...fallback, ...omitted, ...hint }) ??
|
|
319
|
+
render({ ...omission, ...omitted, ...hint })!;
|
|
136
320
|
}
|
|
137
321
|
|
|
138
322
|
export function maybeJsonText(
|
|
@@ -143,6 +327,33 @@ export function maybeJsonText(
|
|
|
143
327
|
return verbose ? jsonText(value) : compact;
|
|
144
328
|
}
|
|
145
329
|
|
|
330
|
+
function unavailableSpawnProjection(reason: "malformed_selected_text" | "yaml_projection_failed"): string {
|
|
331
|
+
return `projection: unavailable\nreason: ${reason}\nwarning: "Full metadata is not shown. Launch or attachment processing preceded this projection; this is not a workload-failure or no-effects receipt. Do not repeat automatically."\n`;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/** Full spawn metadata retains legacy JSON selection; projection is not launch or source authority. */
|
|
335
|
+
export function spawnMetadataText(value: unknown, verbose: boolean | undefined, compact: string): string {
|
|
336
|
+
if (!verbose) return compact;
|
|
337
|
+
// Original selection faults remain exact, outside the recoverable projection boundary.
|
|
338
|
+
const selected = JSON.stringify(value, null, 2);
|
|
339
|
+
if (selected === undefined) return `\n${unavailableSpawnProjection("yaml_projection_failed")}`;
|
|
340
|
+
try {
|
|
341
|
+
const clone: unknown = JSON.parse(selected), pending: unknown[] = [clone];
|
|
342
|
+
// Only the JSON clone is walked; full metadata borrows no bounded emitter allowance.
|
|
343
|
+
while (pending.length) {
|
|
344
|
+
const current = pending.pop();
|
|
345
|
+
if (typeof current === "string" && !current.isWellFormed()) return `\n${unavailableSpawnProjection("malformed_selected_text")}`;
|
|
346
|
+
if (current && typeof current === "object") for (const [key, child] of Object.entries(current)) {
|
|
347
|
+
if (!key.isWellFormed()) return `\n${unavailableSpawnProjection("malformed_selected_text")}`;
|
|
348
|
+
pending.push(child);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
return `\n${yamlMetadataText(clone)}`;
|
|
352
|
+
} catch {
|
|
353
|
+
return `\n${unavailableSpawnProjection("yaml_projection_failed")}`;
|
|
354
|
+
}
|
|
355
|
+
}
|
|
356
|
+
|
|
146
357
|
export function compactRecipeImports(summary: Record<string, unknown>): string {
|
|
147
358
|
const active = Array.isArray(summary.active)
|
|
148
359
|
? (summary.active as Array<Record<string, unknown>>)
|
|
@@ -252,6 +463,14 @@ export function recipeRegistryNextActions(
|
|
|
252
463
|
return [...new Set(actions)].slice(0, 4);
|
|
253
464
|
}
|
|
254
465
|
|
|
466
|
+
/** Only these existing read-only inspection hints become action nodes; other advice stays content. */
|
|
467
|
+
export function formatInspectionHint(action: string): string {
|
|
468
|
+
if (action === "inspect target=recipes view=doctor") return formatInspectNextAction("recipes", "doctor");
|
|
469
|
+
if (action === "inspect target=recipes view=imports verbose=true") return formatInspectNextAction("recipes", "imports", true);
|
|
470
|
+
if (action === "inspect target=recipes view=summary verbose=true") return formatInspectNextAction("recipes", "summary", true);
|
|
471
|
+
return formatMarkdownField("instruction", action);
|
|
472
|
+
}
|
|
473
|
+
|
|
255
474
|
export function compactRecipeRegistry(
|
|
256
475
|
summary: Record<string, unknown>,
|
|
257
476
|
): string {
|
|
@@ -279,7 +498,11 @@ export function compactRecipeRegistry(
|
|
|
279
498
|
const nextActions = Array.isArray(summary.next_actions)
|
|
280
499
|
? (summary.next_actions as string[])
|
|
281
500
|
: [];
|
|
282
|
-
|
|
501
|
+
const fields = [formatMarkdownField("recipes", "registry"), ...Object.entries({ active, drafts, shadowed, invalid, disabled,
|
|
502
|
+
current_policy: currentPolicy, skill_catalog_partial: skillCatalogPartial, recommendations, diagnostics })
|
|
503
|
+
.map(([key, value]) => formatMarkdownField(key, String(value)))];
|
|
504
|
+
if (nextActions.length) fields.push(formatInspectionHint(nextActions[0]));
|
|
505
|
+
return "\n" + fields.join("\n");
|
|
283
506
|
}
|
|
284
507
|
|
|
285
508
|
export const DEFAULT_INSPECT_LINES = Limits.DEFAULT_INSPECT_LINES;
|
|
@@ -9,22 +9,25 @@ import { join } from "node:path";
|
|
|
9
9
|
|
|
10
10
|
import * as AsyncRuns from "./async-runs.ts";
|
|
11
11
|
import { withFileMutationLock } from "./file-state.ts";
|
|
12
|
+
import * as Limits from "./limits.ts";
|
|
12
13
|
import * as ModelContext from "./model-context.ts";
|
|
13
14
|
import * as Paths from "./paths.ts";
|
|
14
15
|
import type * as RecipeResolution from "./recipes-context.ts";
|
|
15
|
-
import * as RecipesReferences from "./recipes-references.ts";
|
|
16
16
|
import * as RecipesUsage from "./recipes-usage.ts";
|
|
17
17
|
import * as Schema from "./schema.ts";
|
|
18
18
|
import * as ToolsResponse from "./tools-response.ts";
|
|
19
|
+
import { readRunFileNavigationForContext } from "./tools-access.ts";
|
|
19
20
|
|
|
20
21
|
export interface SpawnToolContext extends ModelContext.CurrentModelContext {
|
|
21
22
|
recipeResolutionContext?: RecipeResolution.RecipeResolutionContext;
|
|
22
23
|
cwd: string;
|
|
24
|
+
/** Kernel-injected only; never sourced from tool input/actor values. */
|
|
25
|
+
onSupervisionClockCaptured?: AsyncRuns.AsyncRunStartOptions["onSupervisionClockCaptured"];
|
|
23
26
|
sessionManager?: { getSessionId?: () => string };
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
const asRecord = ToolsResponse.asRecord;
|
|
27
|
-
const
|
|
30
|
+
const spawnMetadataText = ToolsResponse.spawnMetadataText;
|
|
28
31
|
|
|
29
32
|
function getRunOwnerId(ctx: SpawnToolContext): string | undefined {
|
|
30
33
|
return ctx.sessionManager?.getSessionId?.();
|
|
@@ -79,14 +82,33 @@ function writeSpawnDraftRecipe(
|
|
|
79
82
|
return path;
|
|
80
83
|
}
|
|
81
84
|
|
|
85
|
+
/** Compiler-owned pre-launch diagnostics only; selected caller values are not admitted Run ids. */
|
|
86
|
+
function spawnGuardText(kind: "state_dir" | "namespace" | "id", value?: string): string {
|
|
87
|
+
const field = ToolsResponse.formatMarkdownField;
|
|
88
|
+
const facts = kind === "state_dir"
|
|
89
|
+
? [field("result", "unsupported field"), field("reason", "Run state is runtime-owned; run:<id> remains addressable and retention-safe.")]
|
|
90
|
+
: [field("result", kind === "namespace" ? "unsupported Run target" : "invalid Run target"), field("accepted_format", "run:<id>"),
|
|
91
|
+
...(kind === "id" ? [field("id_rule", "nonempty ASCII letters, digits, underscore, dot or hyphen")] : [])];
|
|
92
|
+
const render = (selected?: string) => ToolsResponse.withLeadingLineBreak(
|
|
93
|
+
[field("field", kind === "state_dir" ? "state_dir" : "as"), ...(selected === undefined ? [] : [selected]), ...facts].join("\n"));
|
|
94
|
+
if (value === undefined) return render();
|
|
95
|
+
const wellFormed = value.isWellFormed();
|
|
96
|
+
if (wellFormed) {
|
|
97
|
+
const complete = render(field("value", value));
|
|
98
|
+
if (Buffer.byteLength(complete) <= Limits.RUN_DELIVERY_MODEL_MAX_BYTES) return complete;
|
|
99
|
+
}
|
|
100
|
+
const reason = wellFormed ? "response_too_large" : "malformed_selected_text";
|
|
101
|
+
return render(`- value: [${reason === "response_too_large" ? "omitted" : "unavailable"}]\n- value_omission:\n - reason: ${reason}\n - shown: 0\n - omitted: 1\n - total: 1`);
|
|
102
|
+
}
|
|
103
|
+
|
|
82
104
|
function runIdFromTarget(target: string | undefined): string | undefined {
|
|
83
105
|
if (!target) return undefined;
|
|
84
106
|
if (!target.startsWith("run:")) {
|
|
85
|
-
throw new Error(
|
|
107
|
+
throw new Error(spawnGuardText("namespace", `${target}`));
|
|
86
108
|
}
|
|
87
109
|
const run = target.slice(4);
|
|
88
110
|
if (!run || !/^[A-Za-z0-9_.-]+$/.test(run)) {
|
|
89
|
-
throw new Error(
|
|
111
|
+
throw new Error(spawnGuardText("id", `${target}`));
|
|
90
112
|
}
|
|
91
113
|
return run;
|
|
92
114
|
}
|
|
@@ -127,7 +149,7 @@ export function createSpawnToolDefinition<
|
|
|
127
149
|
"Optional originating transport route preserved for detached terminal follow-up, e.g. Telegram chat_id and thread_id.",
|
|
128
150
|
),
|
|
129
151
|
verbose: Schema.booleanSchema(
|
|
130
|
-
"Return full
|
|
152
|
+
"Return full YAML instead of compact text.",
|
|
131
153
|
),
|
|
132
154
|
},
|
|
133
155
|
[],
|
|
@@ -141,9 +163,7 @@ export function createSpawnToolDefinition<
|
|
|
141
163
|
) {
|
|
142
164
|
const input = asRecord(params);
|
|
143
165
|
if (input.state_dir !== undefined) {
|
|
144
|
-
throw new Error(
|
|
145
|
-
"spawn.state_dir is not supported; run state is runtime-owned so run:<id> remains addressable and retention-safe.",
|
|
146
|
-
);
|
|
166
|
+
throw new Error(spawnGuardText("state_dir"));
|
|
147
167
|
}
|
|
148
168
|
const runId = runIdFromTarget(
|
|
149
169
|
typeof input.as === "string" ? input.as : undefined,
|
|
@@ -185,12 +205,13 @@ export function createSpawnToolDefinition<
|
|
|
185
205
|
: {}),
|
|
186
206
|
},
|
|
187
207
|
ctx.cwd,
|
|
188
|
-
{ skillContext: ctx.recipeResolutionContext?.activeSkills },
|
|
208
|
+
{ skillContext: ctx.recipeResolutionContext?.activeSkills, onSupervisionClockCaptured: ctx.onSupervisionClockCaptured },
|
|
189
209
|
);
|
|
190
210
|
const draftRecipe = writeSpawnDraftRecipe(input, meta);
|
|
191
211
|
const nextActions = ToolsResponse.runNextActions(meta.run);
|
|
192
212
|
const details = {
|
|
193
213
|
...meta,
|
|
214
|
+
file_navigation: readRunFileNavigationForContext(meta, ctx),
|
|
194
215
|
...(draftRecipe ? { draft_recipe: draftRecipe } : {}),
|
|
195
216
|
next_actions: nextActions,
|
|
196
217
|
};
|
|
@@ -198,7 +219,7 @@ export function createSpawnToolDefinition<
|
|
|
198
219
|
content: [
|
|
199
220
|
{
|
|
200
221
|
type: "text" as const,
|
|
201
|
-
text:
|
|
222
|
+
text: spawnMetadataText(
|
|
202
223
|
details,
|
|
203
224
|
input.verbose === true,
|
|
204
225
|
ToolsResponse.compactAsyncRunStatus(details),
|