@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
|
@@ -27,7 +27,18 @@ export interface SessionEvidenceToolCall {
|
|
|
27
27
|
resultError?: boolean;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
// Non-JSON provenance data. The enumerable Symbol survives turn copies; it grants no source/lifecycle authority.
|
|
31
|
+
export const SESSION_TURN_IDENTITY = Symbol("session-turn-identity");
|
|
32
|
+
interface SessionTurnIdentity {
|
|
33
|
+
basis: "entry" | "record";
|
|
34
|
+
entryId?: string;
|
|
35
|
+
sessionId?: string;
|
|
36
|
+
role: "assistant" | "user";
|
|
37
|
+
ordinal?: number;
|
|
38
|
+
}
|
|
39
|
+
|
|
30
40
|
export interface SessionEvidenceTurn {
|
|
41
|
+
[SESSION_TURN_IDENTITY]?: Readonly<SessionTurnIdentity>;
|
|
31
42
|
assistantEntryId?: string;
|
|
32
43
|
assistantText?: string;
|
|
33
44
|
error?: string;
|
|
@@ -44,7 +55,20 @@ export interface SessionEvidenceTurn {
|
|
|
44
55
|
userText?: string;
|
|
45
56
|
}
|
|
46
57
|
|
|
58
|
+
export const SESSION_EVIDENCE_CHRONOLOGY = Symbol("session-evidence-chronology");
|
|
59
|
+
export interface SessionChronologyEntry {
|
|
60
|
+
ordinal: number;
|
|
61
|
+
timestamp: string;
|
|
62
|
+
identity: Readonly<SessionTurnIdentity>;
|
|
63
|
+
}
|
|
64
|
+
export type SessionChronologyReason = "source_unavailable" | "identity_unavailable" | "timestamp_unavailable" | "metadata_too_large";
|
|
65
|
+
export type SessionChronology = Readonly<{
|
|
66
|
+
basis: "recorded_branch_metadata";
|
|
67
|
+
entries: readonly Readonly<SessionChronologyEntry>[];
|
|
68
|
+
} & ({ state: "available" } | { state: "unavailable"; reason: SessionChronologyReason })>;
|
|
69
|
+
|
|
47
70
|
export interface SessionEvidence {
|
|
71
|
+
[SESSION_EVIDENCE_CHRONOLOGY]?: SessionChronology;
|
|
48
72
|
activeLeafId?: string;
|
|
49
73
|
diagnostics: StateReadDiagnostic[];
|
|
50
74
|
path: string;
|
|
@@ -289,7 +313,8 @@ function contentText(
|
|
|
289
313
|
return boundedText(text, maxChars);
|
|
290
314
|
}
|
|
291
315
|
|
|
292
|
-
|
|
316
|
+
/** Physical last-leaf ancestry, not current model context or a claim about a live SessionManager leaf. */
|
|
317
|
+
export function selectLastRecordedSessionBranch(
|
|
293
318
|
entries: SessionEntry[],
|
|
294
319
|
path: string,
|
|
295
320
|
diagnostics: StateReadDiagnostic[],
|
|
@@ -345,6 +370,28 @@ function toolCalls(
|
|
|
345
370
|
}));
|
|
346
371
|
}
|
|
347
372
|
|
|
373
|
+
function sessionChronology(turns: readonly SessionEvidenceTurn[], sourceAvailable: boolean): SessionChronology {
|
|
374
|
+
const basis = "recorded_branch_metadata" as const;
|
|
375
|
+
const unavailable = (reason: SessionChronologyReason): SessionChronology => Object.freeze({
|
|
376
|
+
state: "unavailable", basis, reason, entries: Object.freeze([]),
|
|
377
|
+
});
|
|
378
|
+
if (!sourceAvailable) return unavailable("source_unavailable");
|
|
379
|
+
const entries: Readonly<SessionChronologyEntry>[] = [];
|
|
380
|
+
let bytes = Buffer.byteLength(JSON.stringify({ state: "available", basis, entries: [] }));
|
|
381
|
+
for (const turn of turns) {
|
|
382
|
+
const identity = turn[SESSION_TURN_IDENTITY];
|
|
383
|
+
if (identity?.basis !== "entry") return unavailable("identity_unavailable");
|
|
384
|
+
const timestamp = turn.timestamp;
|
|
385
|
+
if (typeof timestamp !== "string" || timestamp.length !== 24 || !Number.isFinite(Date.parse(timestamp)) ||
|
|
386
|
+
new Date(timestamp).toISOString() !== timestamp || redactSessionEvidenceValue(timestamp) !== timestamp) return unavailable("timestamp_unavailable");
|
|
387
|
+
const entry = Object.freeze({ ordinal: turn.index, timestamp, identity });
|
|
388
|
+
bytes += Buffer.byteLength(JSON.stringify(entry)) + Number(entries.length > 0);
|
|
389
|
+
if (bytes > Limits.SESSION_EVIDENCE_MAX_BYTES) return unavailable("metadata_too_large");
|
|
390
|
+
entries.push(entry);
|
|
391
|
+
}
|
|
392
|
+
return Object.freeze({ state: "available", basis, entries: Object.freeze(entries) });
|
|
393
|
+
}
|
|
394
|
+
|
|
348
395
|
export function readSessionEvidence(
|
|
349
396
|
path: string,
|
|
350
397
|
options: SessionEvidenceReadOptions = {},
|
|
@@ -368,9 +415,27 @@ export function readSessionEvidence(
|
|
|
368
415
|
const read = readJsonlFileResilient<SessionEntry>(path, { maxBytes });
|
|
369
416
|
const diagnostics = [...read.diagnostics];
|
|
370
417
|
const header = read.records.find((entry) => entry.type === "session");
|
|
371
|
-
const branch =
|
|
418
|
+
const branch = selectLastRecordedSessionBranch(read.records, path, diagnostics);
|
|
419
|
+
const ordinals = new Map<SessionEntry, number>(branch.map(entry => [entry, 0]));
|
|
420
|
+
const idCounts = new Map(branch.map(entry => [String(entry.id), 0]));
|
|
421
|
+
let sessionHeaders = 0;
|
|
422
|
+
for (const [index, entry] of read.records.entries()) {
|
|
423
|
+
if (entry.type === "session") sessionHeaders++;
|
|
424
|
+
if (ordinals.has(entry)) ordinals.set(entry, index + 1);
|
|
425
|
+
if (entry.type !== "session" && typeof entry.id === "string" && idCounts.has(entry.id)) {
|
|
426
|
+
idCounts.set(entry.id, idCounts.get(entry.id)! + 1);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
const sessionId = sessionHeaders === 1 && typeof header?.id === "string" && header.id &&
|
|
430
|
+
redactSessionEvidenceValue(header.id, maxTextChars) === header.id ? header.id : undefined;
|
|
431
|
+
const identity = (entry: SessionEntry, role: "assistant" | "user"): Readonly<SessionTurnIdentity> => {
|
|
432
|
+
const entryId = typeof entry.id === "string" ? entry.id : "";
|
|
433
|
+
const basis = sessionId && entryId && idCounts.get(entryId) === 1 && diagnostics.length === 0 &&
|
|
434
|
+
redactSessionEvidenceValue(entryId, maxTextChars) === entryId ? "entry" : "record";
|
|
435
|
+
return Object.freeze({ basis, role, ...(basis === "entry" ? { sessionId, entryId } : { ordinal: ordinals.get(entry)! }) });
|
|
436
|
+
};
|
|
372
437
|
const turns: SessionEvidenceTurn[] = [];
|
|
373
|
-
let pendingUser: { id: string; text?: string } | undefined;
|
|
438
|
+
let pendingUser: { id: string; text?: string; identity: Readonly<SessionTurnIdentity> } | undefined;
|
|
374
439
|
let currentTurn: SessionEvidenceTurn | undefined;
|
|
375
440
|
for (const entry of branch) {
|
|
376
441
|
if (entry.type !== "message") continue;
|
|
@@ -379,6 +444,7 @@ export function readSessionEvidence(
|
|
|
379
444
|
if (role === "user") {
|
|
380
445
|
pendingUser = {
|
|
381
446
|
id: String(entry.id),
|
|
447
|
+
identity: identity(entry, "user"),
|
|
382
448
|
text: contentText(message, "text", maxTextChars),
|
|
383
449
|
};
|
|
384
450
|
currentTurn = undefined;
|
|
@@ -386,6 +452,7 @@ export function readSessionEvidence(
|
|
|
386
452
|
}
|
|
387
453
|
if (role === "assistant") {
|
|
388
454
|
currentTurn = {
|
|
455
|
+
[SESSION_TURN_IDENTITY]: identity(entry, "assistant"),
|
|
389
456
|
...(typeof entry.id === "string" ? { assistantEntryId: entry.id } : {}),
|
|
390
457
|
...(contentText(message, "text", maxTextChars)
|
|
391
458
|
? { assistantText: contentText(message, "text", maxTextChars) }
|
|
@@ -440,6 +507,7 @@ export function readSessionEvidence(
|
|
|
440
507
|
toolCalls: [],
|
|
441
508
|
unmatchedToolResults: 0,
|
|
442
509
|
userEntryId: pendingUser.id,
|
|
510
|
+
[SESSION_TURN_IDENTITY]: pendingUser.identity,
|
|
443
511
|
...(pendingUser.text ? { userText: pendingUser.text } : {}),
|
|
444
512
|
});
|
|
445
513
|
}
|
|
@@ -448,7 +516,7 @@ export function readSessionEvidence(
|
|
|
448
516
|
...turn,
|
|
449
517
|
index: firstVisibleIndex + index + 1,
|
|
450
518
|
}));
|
|
451
|
-
|
|
519
|
+
const evidence: SessionEvidence = {
|
|
452
520
|
...(branch.at(-1)?.id ? { activeLeafId: String(branch.at(-1)?.id) } : {}),
|
|
453
521
|
diagnostics,
|
|
454
522
|
path,
|
|
@@ -457,4 +525,8 @@ export function readSessionEvidence(
|
|
|
457
525
|
truncated: read.truncated === true || turns.length > visibleTurns.length,
|
|
458
526
|
turns: visibleTurns,
|
|
459
527
|
};
|
|
528
|
+
Object.defineProperty(evidence, SESSION_EVIDENCE_CHRONOLOGY, {
|
|
529
|
+
value: sessionChronology(turns, sessionId !== undefined && read.truncated !== true && diagnostics.length === 0),
|
|
530
|
+
});
|
|
531
|
+
return evidence;
|
|
460
532
|
}
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
import {
|
|
8
8
|
closeSync,
|
|
9
|
+
constants,
|
|
9
10
|
fstatSync,
|
|
10
11
|
openSync,
|
|
11
12
|
readFileSync,
|
|
@@ -41,12 +42,14 @@ function diagnosticMessage(error: unknown): string {
|
|
|
41
42
|
return error instanceof Error ? error.message : String(error);
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
function readTextFileCapped(path: string, maxBytes: number | undefined): string {
|
|
45
|
-
if (maxBytes === undefined) return readFileSync(path, "utf8");
|
|
45
|
+
function readTextFileCapped(path: string, maxBytes: number | undefined, strictUtf8 = false): string {
|
|
46
|
+
if (maxBytes === undefined) return strictUtf8 ? new TextDecoder("utf-8", { fatal: true }).decode(readFileSync(path)) : readFileSync(path, "utf8");
|
|
46
47
|
const limit = Math.max(0, Math.floor(maxBytes));
|
|
47
|
-
const fd = openSync(path, "r");
|
|
48
|
+
const fd = openSync(path, strictUtf8 ? constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0) : "r");
|
|
48
49
|
try {
|
|
49
|
-
const
|
|
50
|
+
const opened = fstatSync(fd);
|
|
51
|
+
if (strictUtf8 && !opened.isFile()) throw new Error("bounded strict read requires a regular file");
|
|
52
|
+
const size = opened.size;
|
|
50
53
|
if (size > limit) {
|
|
51
54
|
throw Object.assign(
|
|
52
55
|
new Error(`file exceeds bounded read limit (${size} > ${limit} bytes)`),
|
|
@@ -60,17 +63,23 @@ function readTextFileCapped(path: string, maxBytes: number | undefined): string
|
|
|
60
63
|
if (bytesRead === 0) break;
|
|
61
64
|
offset += bytesRead;
|
|
62
65
|
}
|
|
63
|
-
|
|
66
|
+
if (strictUtf8 && offset !== size) throw new Error("file ended before its bounded strict read completed");
|
|
67
|
+
const observed = content.subarray(0, offset);
|
|
68
|
+
return strictUtf8 ? new TextDecoder("utf-8", { fatal: true }).decode(observed) : observed.toString("utf8");
|
|
64
69
|
} finally {
|
|
65
70
|
closeSync(fd);
|
|
66
71
|
}
|
|
67
72
|
}
|
|
68
73
|
|
|
69
|
-
export function readJsonFileResilient<T>(
|
|
74
|
+
export function readJsonFileResilient<T>(
|
|
75
|
+
path: string,
|
|
76
|
+
fallback: T,
|
|
77
|
+
options: { maxBytes?: number; strictUtf8?: boolean } = {},
|
|
78
|
+
): JsonReadResult<T> {
|
|
70
79
|
try {
|
|
71
80
|
return {
|
|
72
81
|
diagnostics: [],
|
|
73
|
-
value: JSON.parse(
|
|
82
|
+
value: JSON.parse(readTextFileCapped(path, options.maxBytes, options.strictUtf8)) as T,
|
|
74
83
|
};
|
|
75
84
|
} catch (error) {
|
|
76
85
|
if (isEnoent(error)) return { diagnostics: [], value: fallback };
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Extension temp-directory helpers
|
|
3
3
|
* Zones: temp directory, cleanup, runtime files
|
|
4
|
-
* Owns pi-agent tmp directory preparation and stale-entry cleanup
|
|
4
|
+
* Owns ordinary pi-agent tmp directory preparation and stale-entry cleanup; Run retirement is separate.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { mkdir, readdir,
|
|
7
|
+
import { mkdir, readdir, rm, stat } from "node:fs/promises";
|
|
8
8
|
import { join } from "node:path";
|
|
9
9
|
|
|
10
10
|
export const DEFAULT_TEMP_MAX_AGE_MS = 24 * 60 * 60 * 1000;
|
|
11
|
-
export const DEFAULT_RUN_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1000;
|
|
12
11
|
|
|
13
12
|
export async function cleanupStaleTempEntries(
|
|
14
13
|
tempDir: string,
|
|
@@ -38,62 +37,10 @@ export async function cleanupStaleTempEntries(
|
|
|
38
37
|
return removed;
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
function isPidAlive(pid: number): boolean {
|
|
42
|
-
try {
|
|
43
|
-
process.kill(pid, 0);
|
|
44
|
-
return true;
|
|
45
|
-
} catch {
|
|
46
|
-
return false;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async function isRunEntryAlive(path: string): Promise<boolean> {
|
|
51
|
-
try {
|
|
52
|
-
const raw = await readFile(join(path, "run.json"), "utf8");
|
|
53
|
-
const meta = JSON.parse(raw) as Record<string, unknown>;
|
|
54
|
-
const pid = Number(meta.pid || 0);
|
|
55
|
-
return pid > 0 && isPidAlive(pid);
|
|
56
|
-
} catch {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export async function cleanupStaleRunEntries(
|
|
62
|
-
runsDir: string,
|
|
63
|
-
maxAgeMs = DEFAULT_RUN_MAX_AGE_MS,
|
|
64
|
-
now = Date.now(),
|
|
65
|
-
): Promise<number> {
|
|
66
|
-
let entries: Array<{ name: string; isDirectory(): boolean }>;
|
|
67
|
-
let removed = 0;
|
|
68
|
-
try {
|
|
69
|
-
entries = await readdir(runsDir, { withFileTypes: true });
|
|
70
|
-
} catch {
|
|
71
|
-
return 0;
|
|
72
|
-
}
|
|
73
|
-
for (const entry of entries) {
|
|
74
|
-
if (!entry.isDirectory()) continue;
|
|
75
|
-
const path = join(runsDir, entry.name);
|
|
76
|
-
try {
|
|
77
|
-
const info = await stat(path);
|
|
78
|
-
const timestamp = Math.min(info.birthtimeMs || info.mtimeMs, info.mtimeMs);
|
|
79
|
-
if (now - timestamp <= maxAgeMs) continue;
|
|
80
|
-
if (await isRunEntryAlive(path)) continue;
|
|
81
|
-
await rm(path, { force: true, recursive: true });
|
|
82
|
-
removed += 1;
|
|
83
|
-
} catch {
|
|
84
|
-
// Ignore temp cleanup races.
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return removed;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
40
|
export async function prepareExtensionTempDir(
|
|
91
41
|
tempDir: string,
|
|
92
42
|
maxAgeMs = DEFAULT_TEMP_MAX_AGE_MS,
|
|
93
|
-
runMaxAgeMs = DEFAULT_RUN_MAX_AGE_MS,
|
|
94
43
|
): Promise<number> {
|
|
95
44
|
await mkdir(tempDir, { recursive: true });
|
|
96
|
-
|
|
97
|
-
const removedRuns = await cleanupStaleRunEntries(join(tempDir, "runs"), runMaxAgeMs);
|
|
98
|
-
return removedTemp + removedRuns;
|
|
45
|
+
return cleanupStaleTempEntries(tempDir, maxAgeMs);
|
|
99
46
|
}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import * as AsyncRuns from "./async-runs.ts";
|
|
8
|
+
import * as RunIndex from "./runs-index.ts";
|
|
8
9
|
|
|
9
10
|
export interface SessionContext {
|
|
10
11
|
sessionManager?: { getSessionId?: () => string };
|
|
@@ -14,6 +15,18 @@ export function getContextSessionId(ctx: unknown): string | undefined {
|
|
|
14
15
|
return (ctx as SessionContext | undefined)?.sessionManager?.getSessionId?.();
|
|
15
16
|
}
|
|
16
17
|
|
|
18
|
+
/** Optional post-launch navigation never fails or rolls back work already admitted by the launch owner. */
|
|
19
|
+
export function readRunFileNavigationForContext(status: object, ctx: unknown): Readonly<RunIndex.RunDirectoryNavigation> {
|
|
20
|
+
try {
|
|
21
|
+
const sessionId = getContextSessionId(ctx);
|
|
22
|
+
const directory = Object.getOwnPropertyDescriptor(status, "state_dir");
|
|
23
|
+
const navigation = RunIndex.readRunDirectoryNavigation(typeof directory?.value === "string" ? directory.value : "", status, sessionId);
|
|
24
|
+
return getContextSessionId(ctx) === sessionId ? navigation : Object.freeze({ state: "unavailable", reason: "session_changed" });
|
|
25
|
+
} catch {
|
|
26
|
+
return Object.freeze({ state: "unavailable", reason: "navigation_unavailable" });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
17
30
|
export function requireContextSessionId(ctx: unknown, actor: string): string {
|
|
18
31
|
const sessionId = getContextSessionId(ctx);
|
|
19
32
|
if (!sessionId) {
|
|
@@ -18,6 +18,7 @@ import * as RecipesDiscovery from "./recipes-discovery.ts";
|
|
|
18
18
|
import * as RecipesReferences from "./recipes-references.ts";
|
|
19
19
|
import * as ReviewDiagnostics from "./review-diagnostics.ts";
|
|
20
20
|
import * as RunsControls from "./runs-controls.ts";
|
|
21
|
+
import { readRunSessionNavigation, type RunNavigationPriority } from "./runs-index.ts";
|
|
21
22
|
import * as RunControlDelivery from "./runs-control-delivery.ts";
|
|
22
23
|
import * as RunsTrace from "./runs-trace.ts";
|
|
23
24
|
import * as Runtime from "./runtime.ts";
|
|
@@ -37,6 +38,7 @@ export interface InspectToolDeps<TContext = unknown> {
|
|
|
37
38
|
getToolStatus?: (name: string) => Record<string, unknown> | undefined;
|
|
38
39
|
listRuns?: () => Array<Record<string, any>>;
|
|
39
40
|
recipeRoot?: string;
|
|
41
|
+
runStateRoot?: string;
|
|
40
42
|
registryStatus?: () => Runtime.RecipeRegistryStatus;
|
|
41
43
|
}
|
|
42
44
|
|
|
@@ -53,23 +55,36 @@ function runtimeRuns(
|
|
|
53
55
|
ctx: unknown,
|
|
54
56
|
deps: InspectToolDeps,
|
|
55
57
|
status: string | undefined,
|
|
58
|
+
includeNavigation = false,
|
|
56
59
|
): Record<string, unknown> {
|
|
57
60
|
const session = ToolsAccess.requireContextSessionId(ctx, "runtime Run inventory");
|
|
58
61
|
const listed = deps.listRuns
|
|
59
62
|
? deps.listRuns()
|
|
60
63
|
: AsyncRuns.listRuns(undefined, status);
|
|
64
|
+
const observedFailures: RunNavigationPriority["failed"][number][] = [];
|
|
61
65
|
const runs = listed
|
|
62
66
|
.map((run) => {
|
|
63
67
|
try {
|
|
64
|
-
|
|
68
|
+
const observed = deps.getRunStatus
|
|
65
69
|
? deps.getRunStatus(String(run.state_dir ?? run.run))
|
|
66
70
|
: AsyncRuns.getRunStatus(String(run.state_dir ?? run.run));
|
|
71
|
+
if (includeNavigation && observed.status === "failed" && typeof observed.run === "string" && typeof observed.run_instance_id === "string" &&
|
|
72
|
+
typeof observed.state_dir === "string" && observed.ownerId === session) {
|
|
73
|
+
observedFailures.push({ run: observed.run, run_instance_id: observed.run_instance_id, state_dir: observed.state_dir, ownerId: session });
|
|
74
|
+
}
|
|
75
|
+
return observed;
|
|
67
76
|
} catch {
|
|
68
77
|
return run;
|
|
69
78
|
}
|
|
70
79
|
})
|
|
71
80
|
.filter((run) => run.ownerId === session);
|
|
72
|
-
|
|
81
|
+
const navigation = includeNavigation ? readRunSessionNavigation(deps.runStateRoot ?? Paths.getRunStateRoot(), session, {
|
|
82
|
+
root_order: status === "failed" ? "failed_subtrees_first" : "latest_registration",
|
|
83
|
+
failed: observedFailures,
|
|
84
|
+
}) : undefined;
|
|
85
|
+
const current = ToolsAccess.requireContextSessionId(ctx, "runtime Run inventory");
|
|
86
|
+
if (current !== session) throw ToolsAccess.sessionMismatchError({ currentSession: current, expectedSession: session, target: "runtime" });
|
|
87
|
+
return { owner_session: session, runs, ...(navigation ? { navigation } : {}) };
|
|
73
88
|
}
|
|
74
89
|
|
|
75
90
|
function runtimeTriage(
|
|
@@ -171,13 +186,44 @@ function runtimeTriage(
|
|
|
171
186
|
}
|
|
172
187
|
|
|
173
188
|
function compactRuntime(view: string, details: Record<string, unknown>): string {
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
189
|
+
const fields = view === "runs" ? { runs: (details.runs as unknown[] | undefined)?.length ?? 0 }
|
|
190
|
+
: view === "triage" ? {
|
|
191
|
+
failed: (details.failed_runs as unknown[] | undefined)?.length ?? 0,
|
|
192
|
+
pending_controls: Number(details.pending_control_count ?? 0), stale_controls: Number(details.stale_control_count ?? 0),
|
|
193
|
+
backpressured: Number(details.backpressured_run_count ?? 0), incomplete_trace: Number(details.trace_diagnostic_count ?? 0),
|
|
194
|
+
attention: (details.attention_events as unknown[] | undefined)?.length ?? 0,
|
|
195
|
+
} : { version: String(details.version), state_schema: String(details.state_schema), automatic_review: String(details.automatic_review) };
|
|
196
|
+
return "\n" + [ToolsResponse.formatMarkdownField("runtime", view),
|
|
197
|
+
...Object.entries(fields).map(([key, value]) => ToolsResponse.formatMarkdownField(key, String(value)))].join("\n");
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
// Projects local refusals only; does not intercept other throws or change existing catches.
|
|
201
|
+
function formatInspectFailure(
|
|
202
|
+
fields: readonly (readonly [key: string, value: string | readonly string[], omittable?: true])[],
|
|
203
|
+
next?: readonly [target: string, view: string],
|
|
204
|
+
): string {
|
|
205
|
+
// The unchanged public adapter adds exactly one leading LF to these Error messages.
|
|
206
|
+
const budget = Limits.RUN_DELIVERY_MODEL_MAX_BYTES - 1;
|
|
207
|
+
const omitted = (key: string) => `- ${key}:\n - state: omitted\n - reason: response_too_large\n - shown: 0\n - omitted: 1\n - total: 1`;
|
|
208
|
+
const field = ([key, value]: (typeof fields)[number]) => typeof value === "string"
|
|
209
|
+
? ToolsResponse.formatMarkdownField(key, value)
|
|
210
|
+
: `- ${key}:\n${value.map(item => ` - ${item}`).join("\n")}`;
|
|
211
|
+
// Unmarked fields are bounded compiler literals/lists. Short values seed full so admission only grows.
|
|
212
|
+
const formatted = fields.map(field);
|
|
213
|
+
const projected = fields.map((item, index) => {
|
|
214
|
+
const full = formatted[index]!, fallback = omitted(item[0]);
|
|
215
|
+
return item[2] && Buffer.byteLength(full, "utf8") > Buffer.byteLength(fallback, "utf8") ? fallback : full;
|
|
216
|
+
});
|
|
217
|
+
let action = next ? ToolsResponse.formatInspectNextAction(next[0], next[1]) : "";
|
|
218
|
+
const text = () => [...projected, ...(action ? [action] : [])].join("\n");
|
|
219
|
+
if (next && Buffer.byteLength(text(), "utf8") > budget) action = omitted("next_action");
|
|
220
|
+
fields.forEach((item, index) => {
|
|
221
|
+
if (!item[2]) return;
|
|
222
|
+
const fallback = projected[index]!;
|
|
223
|
+
projected[index] = formatted[index]!;
|
|
224
|
+
if (Buffer.byteLength(text(), "utf8") > budget) projected[index] = fallback;
|
|
225
|
+
});
|
|
226
|
+
return text();
|
|
181
227
|
}
|
|
182
228
|
|
|
183
229
|
function inspectRuntime(
|
|
@@ -192,10 +238,13 @@ function inspectRuntime(
|
|
|
192
238
|
ctx,
|
|
193
239
|
deps,
|
|
194
240
|
typeof input.status === "string" ? input.status : undefined,
|
|
241
|
+
input.verbose === true,
|
|
195
242
|
);
|
|
196
243
|
}
|
|
197
244
|
if (view === "triage") return runtimeTriage(ctx, deps);
|
|
198
|
-
throw new Error(
|
|
245
|
+
throw new Error(formatInspectFailure([
|
|
246
|
+
["target_kind", "runtime"], ["result", "unsupported view"], ["supported_views", ["status", "runs", "triage"]],
|
|
247
|
+
]));
|
|
199
248
|
}
|
|
200
249
|
|
|
201
250
|
function portableSkillRecipePath(
|
|
@@ -350,9 +399,10 @@ function inspectRecipes(
|
|
|
350
399
|
view !== "imports" &&
|
|
351
400
|
view !== "reviews"
|
|
352
401
|
) {
|
|
353
|
-
throw new Error(
|
|
354
|
-
"
|
|
355
|
-
|
|
402
|
+
throw new Error(formatInspectFailure([
|
|
403
|
+
["target_kind", "recipes"], ["result", "unsupported view"],
|
|
404
|
+
["supported_views", ["status", "summary", "doctor", "imports", "reviews"]],
|
|
405
|
+
]));
|
|
356
406
|
}
|
|
357
407
|
const recipeRoot = deps.recipeRoot ?? Paths.getRecipeRoot();
|
|
358
408
|
if (view === "reviews") {
|
|
@@ -379,7 +429,7 @@ function inspectRecipes(
|
|
|
379
429
|
const identity =
|
|
380
430
|
typeof input.identity === "string" ? input.identity.trim() : "";
|
|
381
431
|
if (identity && view !== "doctor") {
|
|
382
|
-
throw new Error("
|
|
432
|
+
throw new Error(formatInspectFailure([["target_kind", "recipes"], ["result", "identity requires view=doctor"]]));
|
|
383
433
|
}
|
|
384
434
|
if (view === "doctor" && identity) {
|
|
385
435
|
return inspectRecipeIdentity(
|
|
@@ -463,7 +513,9 @@ function inspectRun(
|
|
|
463
513
|
deps: InspectToolDeps,
|
|
464
514
|
): Record<string, unknown> {
|
|
465
515
|
if (view !== "recipe" && view !== "trace" && view !== "control") {
|
|
466
|
-
throw new Error(
|
|
516
|
+
throw new Error(formatInspectFailure([
|
|
517
|
+
["target_kind", "run"], ["result", "unsupported view"], ["supported_views", ["recipe", "trace", "control"]],
|
|
518
|
+
]));
|
|
467
519
|
}
|
|
468
520
|
const status = deps.getRunStatus
|
|
469
521
|
? ToolsAccess.assertRunStatusAccessibleToContext(
|
|
@@ -487,7 +539,10 @@ function inspectRun(
|
|
|
487
539
|
source !== "artifact" &&
|
|
488
540
|
source !== "runtime"
|
|
489
541
|
) {
|
|
490
|
-
throw new Error(
|
|
542
|
+
throw new Error(formatInspectFailure([
|
|
543
|
+
["target_kind", "run"], ["source", source, true], ["result", "unsupported Trace source"],
|
|
544
|
+
["supported_sources", ["all", "lifecycle", "control", "process", "agent", "artifact", "runtime"]],
|
|
545
|
+
]));
|
|
491
546
|
}
|
|
492
547
|
return {
|
|
493
548
|
run, source,
|
|
@@ -545,22 +600,26 @@ function inspectTool(
|
|
|
545
600
|
deps: InspectToolDeps,
|
|
546
601
|
): Record<string, unknown> {
|
|
547
602
|
if (!name || !/^[A-Za-z0-9_.-]+$/.test(name)) {
|
|
548
|
-
throw new Error(
|
|
603
|
+
throw new Error(formatInspectFailure([["target", `tool:${name}`, true], ["result", "invalid tool target"]]));
|
|
549
604
|
}
|
|
550
605
|
if (view !== "status" && view !== "schema") {
|
|
551
|
-
throw new Error(
|
|
606
|
+
throw new Error(formatInspectFailure([
|
|
607
|
+
["target_kind", "tool"], ["result", "unsupported view"], ["supported_views", ["status", "schema"]],
|
|
608
|
+
]));
|
|
552
609
|
}
|
|
553
610
|
const tool = deps.getTool?.(name);
|
|
554
611
|
const status = deps.getToolStatus?.(name);
|
|
555
612
|
if (!tool && !status) {
|
|
556
|
-
throw new Error(
|
|
557
|
-
|
|
558
|
-
);
|
|
613
|
+
throw new Error(formatInspectFailure([
|
|
614
|
+
["tool", name, true], ["result", "registered tool not found"], ["safety", "Do not substitute spawn for tool invocation."],
|
|
615
|
+
], ["recipes", "doctor"]));
|
|
559
616
|
}
|
|
560
617
|
if (view === "schema" && !tool) {
|
|
561
|
-
throw new Error(
|
|
562
|
-
|
|
563
|
-
|
|
618
|
+
throw new Error(formatInspectFailure([
|
|
619
|
+
["tool", name, true], ["result", "registered; callable schema unavailable"],
|
|
620
|
+
["callable_now", String(status?.callable_now ?? false), true],
|
|
621
|
+
["activation_boundary", String(status?.activation_boundary ?? "host_registration"), true],
|
|
622
|
+
], [`tool:${name}`, "status"]));
|
|
564
623
|
}
|
|
565
624
|
return {
|
|
566
625
|
name,
|
|
@@ -578,38 +637,37 @@ function inspectTool(
|
|
|
578
637
|
function compactResult(target: string, view: string, details: Record<string, unknown>): string {
|
|
579
638
|
if (target === "runtime") return compactRuntime(view, details);
|
|
580
639
|
if (target === "recipes" && typeof details.identity === "string") {
|
|
581
|
-
const
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
...((details.next_actions as unknown[] | undefined) ?? []).map(
|
|
591
|
-
(action) => `next=${String(action)}`,
|
|
592
|
-
),
|
|
593
|
-
];
|
|
594
|
-
return `\n${lines.join("\n")}`;
|
|
640
|
+
const fields = [ToolsResponse.formatMarkdownField("recipes", "doctor"),
|
|
641
|
+
...["identity", "skill_active", "resolvable", "catalog_partial", "component_status"]
|
|
642
|
+
.map(key => ToolsResponse.formatMarkdownField(key, String(details[key]))),
|
|
643
|
+
...(details.source_location ? [ToolsResponse.formatMarkdownField("source_location", ToolsResponse.formatLiteralBlock(String(details.source_location)))] : []),
|
|
644
|
+
ToolsResponse.formatMarkdownField("resolution_generation", String(details.resolution_generation)),
|
|
645
|
+
...(details.rejected_reason ? [ToolsResponse.formatMarkdownField("rejected_reason", String(details.rejected_reason))] : [])];
|
|
646
|
+
const actions = details.next_actions as unknown[] | undefined;
|
|
647
|
+
if (actions?.length) fields.push(ToolsResponse.formatInspectionHint(String(actions[0])));
|
|
648
|
+
return "\n" + fields.join("\n");
|
|
595
649
|
}
|
|
596
650
|
if (target === "recipes") return ToolsResponse.compactRecipeRegistry(details);
|
|
597
651
|
if (target.startsWith("tool:") && view === "status") {
|
|
598
|
-
const
|
|
599
|
-
?
|
|
600
|
-
: "unknown";
|
|
601
|
-
const optional = Array.isArray(details.optional_args)
|
|
602
|
-
? details.optional_args.map(String).join(",") || "none"
|
|
603
|
-
: "unknown";
|
|
652
|
+
const argumentsField = (key: string, value: unknown): string => Array.isArray(value) && value.length
|
|
653
|
+
? "- " + key + ":\n" + value.map(item => " - " + String(item).replace(/\r\n|\r|\n/gu, match => match + " ")).join("\n")
|
|
654
|
+
: ToolsResponse.formatMarkdownField(key, Array.isArray(value) ? "none" : "unknown");
|
|
604
655
|
const next = Array.isArray(details.next_actions) && details.next_actions.length > 0
|
|
605
656
|
? String(details.next_actions[0])
|
|
606
657
|
: details.callable_now === true
|
|
607
658
|
? `call tool ${target.slice(5)}`
|
|
608
659
|
: `register_tool name=${target.slice(5)} update=true`;
|
|
609
|
-
return
|
|
660
|
+
return "\n" + [ToolsResponse.formatMarkdownField("tool", target.slice(5)),
|
|
661
|
+
ToolsResponse.formatMarkdownField("source", String(details.source ?? "unknown")),
|
|
662
|
+
ToolsResponse.formatMarkdownField("callable_now", String(details.callable_now ?? false)),
|
|
663
|
+
ToolsResponse.formatMarkdownField("activation_boundary", String(details.activation_boundary ?? "unknown")),
|
|
664
|
+
argumentsField("required_args", details.required_args), argumentsField("optional_args", details.optional_args),
|
|
665
|
+
ToolsResponse.formatMarkdownField("launch_kind", String(details.launch_kind ?? "none")),
|
|
666
|
+
ToolsResponse.formatMarkdownField("spawn_calls", String(Number(details.spawn_calls ?? 0))),
|
|
667
|
+
ToolsResponse.formatMarkdownField("tool_calls", String(Number(details.tool_calls ?? 0))), ToolsResponse.formatInspectionHint(next)].join("\n");
|
|
610
668
|
}
|
|
611
|
-
if (target.startsWith("tool:")) return
|
|
612
|
-
return
|
|
669
|
+
if (target.startsWith("tool:")) return "\n" + ToolsResponse.formatMarkdownField("tool", target.slice(5)) + "\n" + ToolsResponse.formatMarkdownField("view", view);
|
|
670
|
+
return "\n" + ToolsResponse.formatMarkdownField("run", target.slice(4)) + "\n" + ToolsResponse.formatMarkdownField("view", view);
|
|
613
671
|
}
|
|
614
672
|
|
|
615
673
|
export function createInspectToolDefinition<TContext = unknown>(
|
|
@@ -629,7 +687,7 @@ export function createInspectToolDefinition<TContext = unknown>(
|
|
|
629
687
|
source: Schema.stringSchema(
|
|
630
688
|
"Optional Trace source: all, lifecycle, control, process, agent, artifact, or runtime.",
|
|
631
689
|
),
|
|
632
|
-
status: Schema.stringSchema("Optional runtime Run status filter."),
|
|
690
|
+
status: Schema.stringSchema("Optional runtime Run status filter. With verbose runs, failed prioritizes observed failed subtrees without filtering the navigation map."),
|
|
633
691
|
target: Schema.stringSchema("Target: run:<id>, runtime, recipes, or tool:<name>."),
|
|
634
692
|
verbose: Schema.booleanSchema("Return full JSON instead of compact text."),
|
|
635
693
|
view: Schema.stringSchema(
|
|
@@ -659,9 +717,10 @@ export function createInspectToolDefinition<TContext = unknown>(
|
|
|
659
717
|
else if (target.startsWith("tool:")) {
|
|
660
718
|
details = inspectTool(target.slice(5), view, deps);
|
|
661
719
|
} else {
|
|
662
|
-
throw new Error(
|
|
663
|
-
|
|
664
|
-
|
|
720
|
+
throw new Error(formatInspectFailure([
|
|
721
|
+
["target", target, true], ["result", "unsupported inspect target"],
|
|
722
|
+
["supported_targets", ["run:<id>", "runtime", "recipes", "tool:<name>"]],
|
|
723
|
+
]));
|
|
665
724
|
}
|
|
666
725
|
}
|
|
667
726
|
return {
|