@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
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Descendant Run launch-intent evidence.
|
|
3
|
+
* Owns: declared/prepared parent-child generation facts, strict persistence, and unresolved-scope mutation fences.
|
|
4
|
+
* Excludes: authenticating child birth/membership, work/control authority, exhaustive scope, and termination.
|
|
5
|
+
*/
|
|
6
|
+
import { randomUUID } from "node:crypto";
|
|
7
|
+
import { lstatSync, readFileSync } from "node:fs";
|
|
8
|
+
import { isAbsolute, join, resolve } from "node:path";
|
|
9
|
+
import { writeJsonAtomic } from "./file-state.js";
|
|
10
|
+
import { assertOwnedRunStateDirectory } from "./runs-ownership.js";
|
|
11
|
+
import { readJsonFileResilient } from "./state-readers.js";
|
|
12
|
+
export const RUN_DESCENDANT_LAUNCH_FILE = "descendant-launches.json";
|
|
13
|
+
export const RUN_DESCENDANT_PREPARATION_FILE = "descendant-preparation.json";
|
|
14
|
+
export const RUN_DESCENDANT_PREPARED_META_FILE = "prepared-run.json";
|
|
15
|
+
const SCHEMA = "run-descendant-launches-v1";
|
|
16
|
+
const PREPARATION_SCHEMA = "run-descendant-preparation-v1";
|
|
17
|
+
function record(value) {
|
|
18
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
19
|
+
}
|
|
20
|
+
function onlyKeys(value, keys) {
|
|
21
|
+
return Object.keys(value).every((key) => keys.includes(key));
|
|
22
|
+
}
|
|
23
|
+
function required(value, keys) {
|
|
24
|
+
return keys.every((key) => Object.hasOwn(value, key));
|
|
25
|
+
}
|
|
26
|
+
function text(value) {
|
|
27
|
+
return typeof value === "string" && value.length > 0;
|
|
28
|
+
}
|
|
29
|
+
function optionalText(value, key) {
|
|
30
|
+
return !(key in value) || (Object.hasOwn(value, key) && (value[key] === undefined || text(value[key])));
|
|
31
|
+
}
|
|
32
|
+
function validOwner(value) {
|
|
33
|
+
if (!record(value) || !required(value, ["run", "runInstanceId", "pid"]) ||
|
|
34
|
+
!text(value.run) || !text(value.runInstanceId) || !Number.isSafeInteger(value.pid) || Number(value.pid) <= 0 ||
|
|
35
|
+
!optionalText(value, "ownerId"))
|
|
36
|
+
return false;
|
|
37
|
+
return !("processIdentityDigest" in value) || (Object.hasOwn(value, "processIdentityDigest") &&
|
|
38
|
+
(value.processIdentityDigest === undefined || (typeof value.processIdentityDigest === "string" &&
|
|
39
|
+
/^[a-f0-9]{64}$/.exec(value.processIdentityDigest)?.[0] === value.processIdentityDigest)));
|
|
40
|
+
}
|
|
41
|
+
function intentId(value) {
|
|
42
|
+
return typeof value === "string" &&
|
|
43
|
+
/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/.exec(value)?.[0] === value;
|
|
44
|
+
}
|
|
45
|
+
function timestamp(value) {
|
|
46
|
+
if (!text(value))
|
|
47
|
+
return false;
|
|
48
|
+
try {
|
|
49
|
+
return new Date(value).toISOString() === value;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function decodeReference(value) {
|
|
56
|
+
if (!record(value) || !onlyKeys(value, ["run", "run_instance_id", "ownerId", "state_dir"]) ||
|
|
57
|
+
!required(value, ["run", "run_instance_id", "state_dir"]) || typeof value.run !== "string" ||
|
|
58
|
+
/^[A-Za-z0-9_.-]+$/.exec(value.run)?.[0] !== value.run || !text(value.run_instance_id) ||
|
|
59
|
+
!optionalText(value, "ownerId") || !text(value.state_dir) || !isAbsolute(value.state_dir) ||
|
|
60
|
+
resolve(value.state_dir) !== value.state_dir)
|
|
61
|
+
return undefined;
|
|
62
|
+
// A normalized declaration is not filesystem identity, existence, or child ownership proof.
|
|
63
|
+
return Object.freeze({ run: value.run, run_instance_id: value.run_instance_id,
|
|
64
|
+
...(value.ownerId === undefined ? {} : { ownerId: String(value.ownerId) }), state_dir: value.state_dir });
|
|
65
|
+
}
|
|
66
|
+
function decodeTarget(value, owner, stateDir) {
|
|
67
|
+
const target = decodeReference(value);
|
|
68
|
+
return target && target.run_instance_id !== owner.runInstanceId && target.state_dir !== stateDir ? target : undefined;
|
|
69
|
+
}
|
|
70
|
+
function decodePreparedFact(value) {
|
|
71
|
+
if (!record(value) || !onlyKeys(value, ["preparation_id", "prepared_at"]) ||
|
|
72
|
+
!intentId(value.preparation_id) || !timestamp(value.prepared_at))
|
|
73
|
+
return undefined;
|
|
74
|
+
return Object.freeze({ preparation_id: value.preparation_id, prepared_at: value.prepared_at });
|
|
75
|
+
}
|
|
76
|
+
function decodeProducerBinding(value) {
|
|
77
|
+
if (!record(value) || !onlyKeys(value, ["pid", "process_identity_digest"]) ||
|
|
78
|
+
!required(value, ["pid", "process_identity_digest"]) || !Number.isSafeInteger(value.pid) || Number(value.pid) <= 0 ||
|
|
79
|
+
(value.process_identity_digest !== null && (typeof value.process_identity_digest !== "string" ||
|
|
80
|
+
/^[a-f0-9]{64}$/.exec(value.process_identity_digest)?.[0] !== value.process_identity_digest)))
|
|
81
|
+
return undefined;
|
|
82
|
+
return Object.freeze({ pid: Number(value.pid), process_identity_digest: value.process_identity_digest });
|
|
83
|
+
}
|
|
84
|
+
function decodePreparation(value) {
|
|
85
|
+
if (!record(value) || !onlyKeys(value, ["schema", "preparation_id", "prepared_at", "parent", "child", "parent_producer"]) ||
|
|
86
|
+
value.schema !== PREPARATION_SCHEMA || !intentId(value.preparation_id) || !timestamp(value.prepared_at))
|
|
87
|
+
return undefined;
|
|
88
|
+
const parent = decodeReference(value.parent);
|
|
89
|
+
const child = decodeReference(value.child);
|
|
90
|
+
const producer = Object.hasOwn(value, "parent_producer") ? decodeProducerBinding(value.parent_producer) : undefined;
|
|
91
|
+
if (!parent || !child || parent.run_instance_id === child.run_instance_id || parent.state_dir === child.state_dir ||
|
|
92
|
+
("parent_producer" in value && (!Object.hasOwn(value, "parent_producer") || !producer)))
|
|
93
|
+
return undefined;
|
|
94
|
+
return Object.freeze({ schema: PREPARATION_SCHEMA, preparation_id: value.preparation_id, prepared_at: value.prepared_at, parent, child,
|
|
95
|
+
...(producer ? { parent_producer: producer } : {}) });
|
|
96
|
+
}
|
|
97
|
+
function sameReference(a, b) {
|
|
98
|
+
return a.run === b.run && a.run_instance_id === b.run_instance_id && a.ownerId === b.ownerId && a.state_dir === b.state_dir;
|
|
99
|
+
}
|
|
100
|
+
/** Validated reference data only; resolving a target never grants work or membership authority. */
|
|
101
|
+
export function resolveRunDescendantLaunchTarget(value, owner, stateDir) {
|
|
102
|
+
if (!record(value) || !onlyKeys(value, ["run", "runInstanceId", "ownerId", "stateDir"]) ||
|
|
103
|
+
!required(value, ["run", "runInstanceId", "stateDir"]) || !optionalText(value, "ownerId"))
|
|
104
|
+
return undefined;
|
|
105
|
+
return decodeTarget({ run: value.run, run_instance_id: value.runInstanceId,
|
|
106
|
+
...(value.ownerId === undefined ? {} : { ownerId: value.ownerId }), state_dir: value.stateDir }, owner, stateDir);
|
|
107
|
+
}
|
|
108
|
+
function decode(value, owner, stateDir) {
|
|
109
|
+
if (!record(value) || !onlyKeys(value, ["schema", "run", "run_instance_id", "ownerId", "runner_pid", "runner_identity_digest", "intents"]) ||
|
|
110
|
+
value.schema !== SCHEMA || value.run !== owner.run || value.run_instance_id !== owner.runInstanceId ||
|
|
111
|
+
value.ownerId !== owner.ownerId || value.runner_pid !== owner.pid ||
|
|
112
|
+
value.runner_identity_digest !== (owner.processIdentityDigest ?? null) || !Array.isArray(value.intents))
|
|
113
|
+
return undefined;
|
|
114
|
+
const ids = new Set();
|
|
115
|
+
const generations = new Set();
|
|
116
|
+
const preparations = new Set();
|
|
117
|
+
const intents = [];
|
|
118
|
+
for (const item of value.intents) {
|
|
119
|
+
if (!record(item) || !onlyKeys(item, ["intent_id", "admitted_at", "child", "preparation"]) || !intentId(item.intent_id) ||
|
|
120
|
+
ids.has(item.intent_id) || !timestamp(item.admitted_at))
|
|
121
|
+
return undefined;
|
|
122
|
+
const child = decodeTarget(item.child, owner, stateDir);
|
|
123
|
+
const preparation = item.preparation === undefined ? undefined : decodePreparedFact(item.preparation);
|
|
124
|
+
if (!child || generations.has(child.run_instance_id) || (item.preparation !== undefined && !preparation) ||
|
|
125
|
+
(preparation && preparations.has(preparation.preparation_id)))
|
|
126
|
+
return undefined;
|
|
127
|
+
ids.add(item.intent_id);
|
|
128
|
+
generations.add(child.run_instance_id);
|
|
129
|
+
if (preparation)
|
|
130
|
+
preparations.add(preparation.preparation_id);
|
|
131
|
+
intents.push(Object.freeze({ intent_id: item.intent_id, admitted_at: item.admitted_at, child,
|
|
132
|
+
...(preparation ? { preparation } : {}) }));
|
|
133
|
+
}
|
|
134
|
+
return Object.freeze({ schema: SCHEMA, run: owner.run, run_instance_id: owner.runInstanceId,
|
|
135
|
+
...(owner.ownerId === undefined ? {} : { ownerId: owner.ownerId }), runner_pid: owner.pid,
|
|
136
|
+
runner_identity_digest: owner.processIdentityDigest ?? null, intents: Object.freeze(intents) });
|
|
137
|
+
}
|
|
138
|
+
/** Only ENOENT permits mutation; an empty or invalid journal is not closure proof. */
|
|
139
|
+
export function assertNoRetainedDescendantLaunchScope(stateDir) {
|
|
140
|
+
assertNoRetainedDescendantFiles(stateDir, [RUN_DESCENDANT_LAUNCH_FILE, RUN_DESCENDANT_PREPARATION_FILE, RUN_DESCENDANT_PREPARED_META_FILE]);
|
|
141
|
+
}
|
|
142
|
+
function assertNoRetainedDescendantFiles(stateDir, files) {
|
|
143
|
+
for (const file of files) {
|
|
144
|
+
try {
|
|
145
|
+
lstatSync(join(stateDir, file));
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
if (error.code === "ENOENT")
|
|
149
|
+
continue;
|
|
150
|
+
}
|
|
151
|
+
throw new Error("Run descendant launch scope is unproven; confirm the complete owned scope before replacing or retiring its state.");
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
/** Declared generations and paths confer no child work/control authority or exhaustive membership. */
|
|
155
|
+
export function readRunDescendantLaunchLedger(stateDir, owner) {
|
|
156
|
+
if (!validOwner(owner))
|
|
157
|
+
return { state: "invalid" };
|
|
158
|
+
let canonical;
|
|
159
|
+
try {
|
|
160
|
+
canonical = assertOwnedRunStateDirectory(stateDir, owner.run);
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return { state: "invalid" };
|
|
164
|
+
}
|
|
165
|
+
const path = join(canonical, RUN_DESCENDANT_LAUNCH_FILE);
|
|
166
|
+
try {
|
|
167
|
+
if (!lstatSync(path).isFile())
|
|
168
|
+
return { state: "invalid" };
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
return { state: error.code === "ENOENT" ? "absent" : "invalid" };
|
|
172
|
+
}
|
|
173
|
+
const read = readJsonFileResilient(path, undefined);
|
|
174
|
+
if (read.diagnostics.length)
|
|
175
|
+
return { state: "invalid" };
|
|
176
|
+
const ledger = decode(read.value, owner, canonical);
|
|
177
|
+
return ledger ? { state: "available", ledger } : { state: "invalid" };
|
|
178
|
+
}
|
|
179
|
+
/** Retained preparation data is evidence, never a native-start or membership capability. */
|
|
180
|
+
export function readRunDescendantPreparation(stateDir, child, parent) {
|
|
181
|
+
try {
|
|
182
|
+
const canonical = assertOwnedRunStateDirectory(stateDir, child.run);
|
|
183
|
+
const path = join(canonical, RUN_DESCENDANT_PREPARATION_FILE);
|
|
184
|
+
if (!lstatSync(path).isFile())
|
|
185
|
+
return undefined;
|
|
186
|
+
const value = decodePreparation(JSON.parse(readFileSync(path, "utf8")));
|
|
187
|
+
return value && child.state_dir === canonical && sameReference(value.child, child) && sameReference(value.parent, parent) ? value : undefined;
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
return undefined;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/** Fresh evidence checks only, not a capability reconstructed from staged metadata. */
|
|
194
|
+
export function assertRunDescendantPreparedMetadata(stateDir, child) {
|
|
195
|
+
const canonical = assertOwnedRunStateDirectory(stateDir, child.run);
|
|
196
|
+
let unpublished = false;
|
|
197
|
+
try {
|
|
198
|
+
lstatSync(join(canonical, "run.json"));
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
unpublished = error.code === "ENOENT";
|
|
202
|
+
}
|
|
203
|
+
if (!unpublished)
|
|
204
|
+
throw new Error("Run descendant preparation is published or unavailable.");
|
|
205
|
+
const path = join(canonical, RUN_DESCENDANT_PREPARED_META_FILE);
|
|
206
|
+
if (!lstatSync(path).isFile())
|
|
207
|
+
throw new Error("Run descendant prepared metadata is unavailable or invalid.");
|
|
208
|
+
const meta = JSON.parse(readFileSync(path, "utf8"));
|
|
209
|
+
if (!record(meta) || meta.run !== child.run || meta.run_instance_id !== child.run_instance_id ||
|
|
210
|
+
meta.ownerId !== child.ownerId || meta.state_dir !== canonical || child.state_dir !== canonical ||
|
|
211
|
+
meta.pid !== 0 || meta.process_identity !== undefined) {
|
|
212
|
+
throw new Error("Run descendant prepared metadata is unavailable or invalid.");
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
/** Storage only: the kernel prepare-only branch owns child creation and holds parent then child lifecycle locks. */
|
|
216
|
+
export function recordRunDescendantPreparationUnderLock(stateDir, child, parent, producer) {
|
|
217
|
+
const parentReference = decodeReference(parent);
|
|
218
|
+
if (!validOwner(producer) || !parentReference || parentReference.run !== producer.run ||
|
|
219
|
+
parentReference.run_instance_id !== producer.runInstanceId || parentReference.ownerId !== producer.ownerId) {
|
|
220
|
+
throw new Error("Run descendant preparation producer binding is invalid.");
|
|
221
|
+
}
|
|
222
|
+
const canonical = assertOwnedRunStateDirectory(stateDir, child.run);
|
|
223
|
+
assertNoRetainedDescendantFiles(canonical, [RUN_DESCENDANT_LAUNCH_FILE, RUN_DESCENDANT_PREPARATION_FILE]);
|
|
224
|
+
assertRunDescendantPreparedMetadata(canonical, child);
|
|
225
|
+
const preparation = decodePreparation({ schema: PREPARATION_SCHEMA, preparation_id: randomUUID(),
|
|
226
|
+
prepared_at: new Date().toISOString(), child, parent: parentReference,
|
|
227
|
+
parent_producer: { pid: producer.pid, process_identity_digest: producer.processIdentityDigest ?? null } });
|
|
228
|
+
if (!preparation || preparation.child.state_dir !== canonical)
|
|
229
|
+
throw new Error("Run descendant preparation binding is invalid.");
|
|
230
|
+
writeJsonAtomic(join(canonical, RUN_DESCENDANT_PREPARATION_FILE), preparation);
|
|
231
|
+
return preparation;
|
|
232
|
+
}
|
|
233
|
+
/** Storage only: bare intents require work admission; prepared facts may use evidence admission. Validate child evidence under its lock. */
|
|
234
|
+
export function recordRunDescendantLaunchIntentUnderLock(stateDir, owner, request, preparation) {
|
|
235
|
+
if (!validOwner(owner))
|
|
236
|
+
throw new Error("Run descendant launch identity or request is invalid.");
|
|
237
|
+
const canonical = assertOwnedRunStateDirectory(stateDir, owner.run);
|
|
238
|
+
const child = resolveRunDescendantLaunchTarget(request, owner, canonical);
|
|
239
|
+
if (!child)
|
|
240
|
+
throw new Error("Run descendant launch identity or request is invalid.");
|
|
241
|
+
const current = readRunDescendantLaunchLedger(canonical, owner);
|
|
242
|
+
if (current.state === "invalid")
|
|
243
|
+
throw new Error("Run descendant launch evidence is unavailable or invalid.");
|
|
244
|
+
const prior = current.state === "available" ? current.ledger.intents : [];
|
|
245
|
+
const index = prior.findIndex((item) => item.child.run_instance_id === child.run_instance_id);
|
|
246
|
+
const existing = prior[index];
|
|
247
|
+
if (existing && preparation === undefined)
|
|
248
|
+
throw new Error("Run descendant launch generation is already retained.");
|
|
249
|
+
if (existing && !sameReference(existing.child, child))
|
|
250
|
+
throw new Error("Run descendant preparation target changed.");
|
|
251
|
+
let prepared;
|
|
252
|
+
if (preparation !== undefined) {
|
|
253
|
+
const parent = { run: owner.run, run_instance_id: owner.runInstanceId,
|
|
254
|
+
...(owner.ownerId === undefined ? {} : { ownerId: owner.ownerId }), state_dir: canonical };
|
|
255
|
+
const claimed = decodePreparation(preparation);
|
|
256
|
+
if (!claimed || !sameReference(claimed.parent, parent) || !sameReference(claimed.child, child)) {
|
|
257
|
+
throw new Error("Run descendant preparation binding changed or is unavailable.");
|
|
258
|
+
}
|
|
259
|
+
if (existing?.preparation && (existing.preparation.preparation_id !== claimed.preparation_id ||
|
|
260
|
+
existing.preparation.prepared_at !== claimed.prepared_at)) {
|
|
261
|
+
throw new Error("Run descendant preparation binding changed or is unavailable.");
|
|
262
|
+
}
|
|
263
|
+
const retained = readRunDescendantPreparation(child.state_dir, child, parent);
|
|
264
|
+
if (!retained || JSON.stringify(claimed) !== JSON.stringify(retained)) {
|
|
265
|
+
throw new Error("Run descendant preparation binding changed or is unavailable.");
|
|
266
|
+
}
|
|
267
|
+
assertRunDescendantPreparedMetadata(child.state_dir, child);
|
|
268
|
+
if (existing?.preparation)
|
|
269
|
+
return existing;
|
|
270
|
+
if (!retained.parent_producer || retained.parent_producer.pid !== owner.pid ||
|
|
271
|
+
retained.parent_producer.process_identity_digest !== (owner.processIdentityDigest ?? null)) {
|
|
272
|
+
throw new Error("Run descendant preparation producer binding changed or is unavailable.");
|
|
273
|
+
}
|
|
274
|
+
prepared = Object.freeze({ preparation_id: retained.preparation_id, prepared_at: retained.prepared_at });
|
|
275
|
+
}
|
|
276
|
+
const intent = existing ? Object.freeze({ ...existing, preparation: prepared })
|
|
277
|
+
: Object.freeze({ intent_id: randomUUID(), admitted_at: new Date().toISOString(), child,
|
|
278
|
+
...(prepared ? { preparation: prepared } : {}) });
|
|
279
|
+
const intents = existing ? prior.map((item, i) => i === index ? intent : item) : [...prior, intent];
|
|
280
|
+
const updated = decode({ schema: SCHEMA, run: owner.run, run_instance_id: owner.runInstanceId,
|
|
281
|
+
...(owner.ownerId === undefined ? {} : { ownerId: owner.ownerId }), runner_pid: owner.pid,
|
|
282
|
+
runner_identity_digest: owner.processIdentityDigest ?? null, intents }, owner, canonical);
|
|
283
|
+
if (!updated)
|
|
284
|
+
throw new Error("Run descendant launch evidence is unavailable or invalid.");
|
|
285
|
+
writeJsonAtomic(join(canonical, RUN_DESCENDANT_LAUNCH_FILE), updated);
|
|
286
|
+
return updated.intents[existing ? index : updated.intents.length - 1];
|
|
287
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { type RunContextIndexIdentity } from "./runs-context-index.ts";
|
|
2
|
+
export interface ExecutionCaptureView {
|
|
3
|
+
readonly reported_saved_bytes: number | null;
|
|
4
|
+
readonly persistence: "incomplete" | "reported_complete" | "unproven";
|
|
5
|
+
readonly reported_observed_bytes?: number;
|
|
6
|
+
readonly error?: "capture_write_failed";
|
|
7
|
+
}
|
|
8
|
+
export interface ExecutionAttemptView {
|
|
9
|
+
readonly attempt: number;
|
|
10
|
+
readonly code: number;
|
|
11
|
+
readonly native_exit_code?: number | null;
|
|
12
|
+
readonly native_signal?: string;
|
|
13
|
+
readonly reported_killed?: boolean;
|
|
14
|
+
readonly stdout: Readonly<ExecutionCaptureView>;
|
|
15
|
+
readonly stderr: Readonly<ExecutionCaptureView>;
|
|
16
|
+
}
|
|
17
|
+
export interface ExecutionCommandView {
|
|
18
|
+
readonly id: string;
|
|
19
|
+
readonly reported_status: string;
|
|
20
|
+
readonly attempts: readonly Readonly<ExecutionAttemptView>[];
|
|
21
|
+
readonly stage?: string;
|
|
22
|
+
readonly command?: string;
|
|
23
|
+
readonly label?: string;
|
|
24
|
+
readonly occurrence?: number;
|
|
25
|
+
readonly branch_index?: number;
|
|
26
|
+
readonly prompt_bytes?: number;
|
|
27
|
+
readonly started_at?: string;
|
|
28
|
+
readonly completed_at?: string;
|
|
29
|
+
readonly semantic_acceptance?: string;
|
|
30
|
+
readonly exit_code?: number;
|
|
31
|
+
readonly effective_exit_code?: number;
|
|
32
|
+
readonly native_exit_code?: number | null;
|
|
33
|
+
readonly reported_killed?: boolean;
|
|
34
|
+
readonly interruption?: string;
|
|
35
|
+
readonly reported_session_file_count?: number;
|
|
36
|
+
}
|
|
37
|
+
export interface RunExecutionView {
|
|
38
|
+
readonly reported_status: string;
|
|
39
|
+
readonly updated_at: string;
|
|
40
|
+
readonly reported_active_subagents: number;
|
|
41
|
+
readonly commands_total: number;
|
|
42
|
+
readonly settled_attempts_reported: number;
|
|
43
|
+
readonly commands: readonly Readonly<ExecutionCommandView>[];
|
|
44
|
+
}
|
|
45
|
+
export type RunExecutionProjection = {
|
|
46
|
+
readonly state: "available";
|
|
47
|
+
readonly view: Readonly<RunExecutionView>;
|
|
48
|
+
} | {
|
|
49
|
+
readonly state: "unavailable";
|
|
50
|
+
readonly reason: "manifest_invalid" | "identity_mismatch";
|
|
51
|
+
};
|
|
52
|
+
/** Already-captured metadata is data, never a reconstructed producer/work/close capability. */
|
|
53
|
+
export declare function projectRunExecutionManifest(expected: {
|
|
54
|
+
readonly run: string;
|
|
55
|
+
readonly run_instance_id: string;
|
|
56
|
+
}, value: unknown, recipe?: Record<string, unknown>, redactEvidence?: (value: unknown) => unknown): Readonly<RunExecutionProjection>;
|
|
57
|
+
export type KernelRunStreamSourceReading = {
|
|
58
|
+
readonly state: "available";
|
|
59
|
+
readonly identity: Readonly<RunContextIndexIdentity>;
|
|
60
|
+
readonly stream: "stdout" | "stderr";
|
|
61
|
+
readonly source_scope: "canonical_runner_stream";
|
|
62
|
+
readonly visibility: "kernel_only";
|
|
63
|
+
readonly capture_completeness: "not_asserted";
|
|
64
|
+
readonly bytes_total: number;
|
|
65
|
+
readonly text: string;
|
|
66
|
+
readonly unchanged: () => boolean;
|
|
67
|
+
} | {
|
|
68
|
+
readonly state: "unavailable";
|
|
69
|
+
readonly reason: "stream_invalid" | "identity_unavailable" | "identity_mismatch" | "observation_changed" | "stream_missing" | "stream_unavailable" | "stream_too_large" | "stream_invalid_text";
|
|
70
|
+
};
|
|
71
|
+
/** Never serialize this raw source as tool/model evidence: an export owner still owes a fixed privacy projection. */
|
|
72
|
+
export declare function readRunStreamSource(stateDir: string, expected: unknown, stream: unknown): Readonly<KernelRunStreamSourceReading>;
|
|
73
|
+
export type RunExecutionReferenceRequest = {
|
|
74
|
+
readonly kind: "capture";
|
|
75
|
+
readonly command_id: string;
|
|
76
|
+
readonly attempt: number;
|
|
77
|
+
readonly stream: "stdout" | "stderr";
|
|
78
|
+
} | {
|
|
79
|
+
readonly kind: "session";
|
|
80
|
+
readonly command_id: string;
|
|
81
|
+
readonly path: string;
|
|
82
|
+
};
|
|
83
|
+
interface ExecutionReferenceMetadata {
|
|
84
|
+
readonly command_id: string;
|
|
85
|
+
readonly path: string;
|
|
86
|
+
readonly local_path: string;
|
|
87
|
+
readonly bytes_total: number;
|
|
88
|
+
readonly mutable: true;
|
|
89
|
+
}
|
|
90
|
+
export type RunExecutionReference = ExecutionReferenceMetadata & ({
|
|
91
|
+
readonly kind: "capture";
|
|
92
|
+
readonly attempt: number;
|
|
93
|
+
readonly stream: "stdout" | "stderr";
|
|
94
|
+
readonly capture: Readonly<ExecutionCaptureView>;
|
|
95
|
+
} | {
|
|
96
|
+
readonly kind: "session";
|
|
97
|
+
});
|
|
98
|
+
export type RunExecutionReferenceReading = {
|
|
99
|
+
readonly state: "available";
|
|
100
|
+
readonly identity: Readonly<RunContextIndexIdentity>;
|
|
101
|
+
readonly source_updated_at: string;
|
|
102
|
+
readonly reference: Readonly<RunExecutionReference>;
|
|
103
|
+
readonly unchanged: () => boolean;
|
|
104
|
+
} | {
|
|
105
|
+
readonly state: "unavailable";
|
|
106
|
+
readonly reason: "request_invalid" | "identity_unavailable" | "identity_mismatch" | "observation_changed" | "manifest_absent" | "manifest_unavailable" | "manifest_invalid" | "manifest_identity_mismatch" | "reference_not_recorded" | "reference_invalid" | "reference_missing" | "reference_unavailable" | "reference_changed" | "reference_size_unrepresentable" | "capture_size_mismatch";
|
|
107
|
+
};
|
|
108
|
+
/** Local paths and unchanged callbacks describe data only, never readable-body exposure or native capabilities. */
|
|
109
|
+
export declare function readRunExecutionReference(stateDir: string, expected: unknown, query: unknown): Readonly<RunExecutionReferenceReading>;
|
|
110
|
+
export {};
|