@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,97 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run context-index metadata, deterministic references and admitted publication.
|
|
3
|
+
* Owns: bounded identity/index reads, role schema, regular references and admitted index publication.
|
|
4
|
+
* Excludes: role-body reads/creation/redaction, model exposure authorization, lifecycle admission and native authority.
|
|
5
|
+
*/
|
|
6
|
+
export declare const RUN_CONTEXT_INDEX_FILE = "context-index.json";
|
|
7
|
+
export declare const RUN_CONTEXT_INDEX_METADATA_MAX_BYTES: number;
|
|
8
|
+
/** Canonical run.json input, not an index/marker/model-output allowance. */
|
|
9
|
+
export declare const RUN_CONTEXT_SOURCE_METADATA_MAX_BYTES: number;
|
|
10
|
+
declare const EXPORTS: {
|
|
11
|
+
readonly recipe: readonly ["recipe.json", "application/json", false];
|
|
12
|
+
readonly result: readonly ["result.json", "application/json", false];
|
|
13
|
+
readonly trace: readonly ["trace.jsonl", "application/x-ndjson", true];
|
|
14
|
+
readonly control: readonly ["control.json", "application/json", true];
|
|
15
|
+
readonly execution: readonly ["execution.json", "application/json", true];
|
|
16
|
+
readonly artifacts: readonly ["artifacts.json", "application/json", false];
|
|
17
|
+
readonly sessions: readonly ["sessions.json", "application/json", true];
|
|
18
|
+
readonly stdout: readonly ["stdout.log", "text/plain", true];
|
|
19
|
+
readonly stderr: readonly ["stderr.log", "text/plain", true];
|
|
20
|
+
};
|
|
21
|
+
export type RunContextRole = keyof typeof EXPORTS;
|
|
22
|
+
export declare function runContextExportPath(role: RunContextRole): string;
|
|
23
|
+
export interface RunContextIndexIdentity {
|
|
24
|
+
readonly run: string;
|
|
25
|
+
readonly run_instance_id: string;
|
|
26
|
+
readonly ownerId?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface RunContextCoverage {
|
|
29
|
+
readonly truncated: boolean;
|
|
30
|
+
readonly redacted: boolean;
|
|
31
|
+
readonly history_complete?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export type RunContextEntry = {
|
|
34
|
+
readonly availability: "available";
|
|
35
|
+
readonly path: string;
|
|
36
|
+
readonly media_type: string;
|
|
37
|
+
readonly bytes_total: number;
|
|
38
|
+
readonly mutable: boolean;
|
|
39
|
+
readonly coverage: Readonly<RunContextCoverage>;
|
|
40
|
+
} | {
|
|
41
|
+
readonly availability: "pending" | "not_applicable";
|
|
42
|
+
readonly path: null;
|
|
43
|
+
} | {
|
|
44
|
+
readonly availability: "unavailable";
|
|
45
|
+
readonly path: null;
|
|
46
|
+
readonly reason: string;
|
|
47
|
+
};
|
|
48
|
+
export interface RunContextIndex {
|
|
49
|
+
readonly schema: "run-context-index-v1";
|
|
50
|
+
readonly run: string;
|
|
51
|
+
readonly run_instance_id: string;
|
|
52
|
+
readonly updated_at: string;
|
|
53
|
+
readonly entries: Readonly<Record<RunContextRole, Readonly<RunContextEntry>>>;
|
|
54
|
+
}
|
|
55
|
+
export type RunContextIndexReading = {
|
|
56
|
+
readonly state: "available";
|
|
57
|
+
readonly index: Readonly<RunContextIndex>;
|
|
58
|
+
readonly identity: Readonly<RunContextIndexIdentity>;
|
|
59
|
+
readonly local_path: string;
|
|
60
|
+
} | {
|
|
61
|
+
readonly state: "unavailable";
|
|
62
|
+
readonly reason: "identity_unavailable" | "identity_mismatch" | "index_unavailable" | "index_invalid" | "role_unavailable" | "observation_changed";
|
|
63
|
+
};
|
|
64
|
+
export type RunContextIdentityReading = {
|
|
65
|
+
readonly state: "available";
|
|
66
|
+
readonly identity: Readonly<RunContextIndexIdentity>;
|
|
67
|
+
readonly local_path: string;
|
|
68
|
+
readonly unchanged: () => boolean;
|
|
69
|
+
} | {
|
|
70
|
+
readonly state: "unavailable";
|
|
71
|
+
readonly reason: "identity_unavailable" | "identity_mismatch" | "observation_changed";
|
|
72
|
+
};
|
|
73
|
+
export type RunContextExportLocationReading = {
|
|
74
|
+
readonly state: "available";
|
|
75
|
+
readonly identity: Readonly<RunContextIndexIdentity>;
|
|
76
|
+
readonly path: string;
|
|
77
|
+
readonly local_path: string;
|
|
78
|
+
readonly bytes_total: number;
|
|
79
|
+
readonly mutable: true;
|
|
80
|
+
readonly unchanged: () => boolean;
|
|
81
|
+
} | {
|
|
82
|
+
readonly state: "unavailable";
|
|
83
|
+
readonly reason: "role_invalid" | "identity_unavailable" | "identity_mismatch" | "observation_changed" | "export_missing" | "export_unavailable" | "export_size_unrepresentable";
|
|
84
|
+
};
|
|
85
|
+
/** Shared readonly owner/generation observation without requiring an index or granting body/work authority. */
|
|
86
|
+
export declare function readRunContextIdentity(stateDir: string, expected: unknown): Readonly<RunContextIdentityReading>;
|
|
87
|
+
/** Physical fixed-role location only: no index/producer, role-body reads or curated publication certification. */
|
|
88
|
+
export declare function observeRunContextExportLocation(stateDir: string, expected: unknown, role: unknown): Readonly<RunContextExportLocationReading>;
|
|
89
|
+
/** Kernel-local metadata, not proof that bodies are redacted/immutable or permission to expose local_path. */
|
|
90
|
+
export declare function readRunContextIndex(stateDir: string, expected: unknown): Readonly<RunContextIndexReading>;
|
|
91
|
+
export interface RunContextIndexPublication {
|
|
92
|
+
readonly index: Readonly<RunContextIndex>;
|
|
93
|
+
readonly local_path: string;
|
|
94
|
+
}
|
|
95
|
+
/** Trusted persistence only: the caller must hold evidence admission and supply authorized export-owner metadata, not actor flags. */
|
|
96
|
+
export declare function writeRunContextIndexUnderLock(stateDir: string, expected: unknown, updates: unknown): Readonly<RunContextIndexPublication>;
|
|
97
|
+
export {};
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run context-index metadata, deterministic references and admitted publication.
|
|
3
|
+
* Owns: bounded identity/index reads, role schema, regular references and admitted index publication.
|
|
4
|
+
* Excludes: role-body reads/creation/redaction, model exposure authorization, lifecycle admission and native authority.
|
|
5
|
+
*/
|
|
6
|
+
import { closeSync, constants, fstatSync, lstatSync, openSync, readSync } from "node:fs";
|
|
7
|
+
import { isAbsolute, join, resolve } from "node:path";
|
|
8
|
+
import { writeTextAtomic } from "./file-state.js";
|
|
9
|
+
import { readOwnedRunStateDirectory, RUN_STATE_OWNERSHIP_FILE } from "./runs-ownership.js";
|
|
10
|
+
export const RUN_CONTEXT_INDEX_FILE = "context-index.json";
|
|
11
|
+
export const RUN_CONTEXT_INDEX_METADATA_MAX_BYTES = 16 * 1024;
|
|
12
|
+
/** Canonical run.json input, not an index/marker/model-output allowance. */
|
|
13
|
+
export const RUN_CONTEXT_SOURCE_METADATA_MAX_BYTES = 1024 * 1024;
|
|
14
|
+
const EXPORTS = {
|
|
15
|
+
recipe: ["recipe.json", "application/json", false],
|
|
16
|
+
result: ["result.json", "application/json", false],
|
|
17
|
+
trace: ["trace.jsonl", "application/x-ndjson", true],
|
|
18
|
+
control: ["control.json", "application/json", true],
|
|
19
|
+
execution: ["execution.json", "application/json", true],
|
|
20
|
+
artifacts: ["artifacts.json", "application/json", false],
|
|
21
|
+
sessions: ["sessions.json", "application/json", true],
|
|
22
|
+
stdout: ["stdout.log", "text/plain", true],
|
|
23
|
+
stderr: ["stderr.log", "text/plain", true],
|
|
24
|
+
};
|
|
25
|
+
export function runContextExportPath(role) {
|
|
26
|
+
return "evidence/" + EXPORTS[role][0];
|
|
27
|
+
}
|
|
28
|
+
function unavailable(reason) {
|
|
29
|
+
return Object.freeze({ state: "unavailable", reason });
|
|
30
|
+
}
|
|
31
|
+
function object(value) {
|
|
32
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : undefined;
|
|
33
|
+
}
|
|
34
|
+
function own(value, key) {
|
|
35
|
+
return value && Object.hasOwn(value, key) ? value[key] : undefined;
|
|
36
|
+
}
|
|
37
|
+
function known(value, keys) {
|
|
38
|
+
return Object.keys(value).every(key => keys.includes(key));
|
|
39
|
+
}
|
|
40
|
+
function text(value) {
|
|
41
|
+
return typeof value === "string" && value.length > 0 && value.length <= RUN_CONTEXT_INDEX_METADATA_MAX_BYTES;
|
|
42
|
+
}
|
|
43
|
+
function identity(value) {
|
|
44
|
+
const source = object(value);
|
|
45
|
+
const run = own(source, "run");
|
|
46
|
+
const generation = own(source, "run_instance_id");
|
|
47
|
+
if (!text(run) || /[^A-Za-z0-9_.-]/u.test(run) || !text(generation))
|
|
48
|
+
return undefined;
|
|
49
|
+
if (source && Object.hasOwn(source, "ownerId")) {
|
|
50
|
+
return text(source.ownerId) ? { run, run_instance_id: generation, ownerId: source.ownerId } : undefined;
|
|
51
|
+
}
|
|
52
|
+
return source?.ownerId === undefined ? { run, run_instance_id: generation } : undefined;
|
|
53
|
+
}
|
|
54
|
+
function sameIdentity(left, right) {
|
|
55
|
+
return left.run === right.run && left.run_instance_id === right.run_instance_id && left.ownerId === right.ownerId;
|
|
56
|
+
}
|
|
57
|
+
function sameObject(left, right) {
|
|
58
|
+
return left.dev === right.dev && left.ino === right.ino;
|
|
59
|
+
}
|
|
60
|
+
function sameFile(left, right) {
|
|
61
|
+
return right.isFile() && sameObject(left, right) && left.size === right.size &&
|
|
62
|
+
left.mtimeNs === right.mtimeNs && left.ctimeNs === right.ctimeNs;
|
|
63
|
+
}
|
|
64
|
+
/** Retain the opened object for bounded JSON reads or readability-only role checks; never read role bytes. */
|
|
65
|
+
function inspectFile(path, metadataMaxBytes) {
|
|
66
|
+
let fd;
|
|
67
|
+
try {
|
|
68
|
+
const before = lstatSync(path, { bigint: true });
|
|
69
|
+
if (!before.isFile() || (metadataMaxBytes !== undefined && before.size > BigInt(metadataMaxBytes)))
|
|
70
|
+
return undefined;
|
|
71
|
+
fd = openSync(path, constants.O_RDONLY | (constants.O_NOFOLLOW ?? 0) | (constants.O_NONBLOCK ?? 0));
|
|
72
|
+
const opened = fstatSync(fd, { bigint: true });
|
|
73
|
+
if (!sameFile(before, opened))
|
|
74
|
+
return undefined;
|
|
75
|
+
let value;
|
|
76
|
+
if (metadataMaxBytes !== undefined) {
|
|
77
|
+
const bytes = Buffer.alloc(Number(opened.size));
|
|
78
|
+
let offset = 0;
|
|
79
|
+
while (offset < bytes.length) {
|
|
80
|
+
const read = readSync(fd, bytes, offset, bytes.length - offset, offset);
|
|
81
|
+
if (!read)
|
|
82
|
+
break;
|
|
83
|
+
offset += read;
|
|
84
|
+
}
|
|
85
|
+
if (offset !== bytes.length)
|
|
86
|
+
return undefined;
|
|
87
|
+
try {
|
|
88
|
+
value = JSON.parse(new TextDecoder("utf-8", { fatal: true }).decode(bytes));
|
|
89
|
+
}
|
|
90
|
+
catch {
|
|
91
|
+
value = undefined;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (!sameFile(opened, fstatSync(fd, { bigint: true })) || !sameFile(opened, lstatSync(path, { bigint: true })))
|
|
95
|
+
return undefined;
|
|
96
|
+
return { stamp: opened, value };
|
|
97
|
+
}
|
|
98
|
+
catch {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
finally {
|
|
102
|
+
if (fd !== undefined)
|
|
103
|
+
closeSync(fd);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function decodeEntry(value, role) {
|
|
107
|
+
const entry = object(value);
|
|
108
|
+
if (!entry)
|
|
109
|
+
return undefined;
|
|
110
|
+
const availability = own(entry, "availability");
|
|
111
|
+
const path = own(entry, "path");
|
|
112
|
+
if (availability === "pending" || availability === "not_applicable") {
|
|
113
|
+
return path === null && known(entry, ["availability", "path"]) ? Object.freeze({ availability, path }) : undefined;
|
|
114
|
+
}
|
|
115
|
+
if (availability === "unavailable") {
|
|
116
|
+
const reason = own(entry, "reason");
|
|
117
|
+
return path === null && typeof reason === "string" && /^[a-z][a-z0-9_]{0,63}$/u.test(reason) &&
|
|
118
|
+
!/[\r\n]/u.test(reason) && known(entry, ["availability", "path", "reason"])
|
|
119
|
+
? Object.freeze({ availability, path, reason }) : undefined;
|
|
120
|
+
}
|
|
121
|
+
const [, media, temporal] = EXPORTS[role];
|
|
122
|
+
const mediaType = own(entry, "media_type");
|
|
123
|
+
const bytes = own(entry, "bytes_total");
|
|
124
|
+
const mutable = own(entry, "mutable");
|
|
125
|
+
const coverage = object(own(entry, "coverage"));
|
|
126
|
+
if (availability !== "available" || path !== runContextExportPath(role) || typeof mediaType !== "string" ||
|
|
127
|
+
(mediaType !== media && !(media === "text/plain" && mediaType === "text/plain; charset=utf-8")) ||
|
|
128
|
+
typeof bytes !== "number" || !Number.isSafeInteger(bytes) || bytes < 0 || typeof mutable !== "boolean" || !coverage ||
|
|
129
|
+
!known(entry, ["availability", "path", "media_type", "bytes_total", "mutable", "coverage"]) ||
|
|
130
|
+
!known(coverage, ["truncated", "redacted", "history_complete"]) ||
|
|
131
|
+
typeof own(coverage, "truncated") !== "boolean" || typeof own(coverage, "redacted") !== "boolean" ||
|
|
132
|
+
((temporal || Object.hasOwn(coverage, "history_complete")) && typeof own(coverage, "history_complete") !== "boolean"))
|
|
133
|
+
return undefined;
|
|
134
|
+
return Object.freeze({ availability, path, media_type: mediaType, bytes_total: bytes, mutable,
|
|
135
|
+
coverage: Object.freeze({ truncated: coverage.truncated, redacted: coverage.redacted,
|
|
136
|
+
...(typeof coverage.history_complete === "boolean" ? { history_complete: coverage.history_complete } : {}) }) });
|
|
137
|
+
}
|
|
138
|
+
function decodeIndex(value, expected) {
|
|
139
|
+
const source = object(value);
|
|
140
|
+
const entries = object(own(source, "entries"));
|
|
141
|
+
const updated = own(source, "updated_at");
|
|
142
|
+
const time = typeof updated === "string" ? Date.parse(updated) : NaN;
|
|
143
|
+
if (!source || !known(source, ["schema", "run", "run_instance_id", "updated_at", "entries"]) ||
|
|
144
|
+
own(source, "schema") !== "run-context-index-v1" || own(source, "run") !== expected.run ||
|
|
145
|
+
own(source, "run_instance_id") !== expected.run_instance_id || !entries ||
|
|
146
|
+
!Number.isSafeInteger(time) || new Date(time).toISOString() !== updated || !known(entries, Object.keys(EXPORTS)))
|
|
147
|
+
return undefined;
|
|
148
|
+
const decoded = {};
|
|
149
|
+
for (const role of Object.keys(EXPORTS)) {
|
|
150
|
+
const entry = decodeEntry(own(entries, role), role);
|
|
151
|
+
if (!entry)
|
|
152
|
+
return undefined;
|
|
153
|
+
decoded[role] = entry;
|
|
154
|
+
}
|
|
155
|
+
return Object.freeze({ schema: "run-context-index-v1", run: expected.run, run_instance_id: expected.run_instance_id,
|
|
156
|
+
updated_at: updated, entries: Object.freeze(decoded) });
|
|
157
|
+
}
|
|
158
|
+
function readContextOwner(stateDir, request) {
|
|
159
|
+
try {
|
|
160
|
+
const root = resolve(stateDir);
|
|
161
|
+
const directory = lstatSync(root, { bigint: true });
|
|
162
|
+
const marker = lstatSync(join(root, RUN_STATE_OWNERSHIP_FILE), { bigint: true });
|
|
163
|
+
if (!directory.isDirectory() || !marker.isFile() || marker.size > BigInt(RUN_CONTEXT_INDEX_METADATA_MAX_BYTES)) {
|
|
164
|
+
return unavailable("identity_unavailable");
|
|
165
|
+
}
|
|
166
|
+
const owned = readOwnedRunStateDirectory(root, { maxBytes: RUN_CONTEXT_INDEX_METADATA_MAX_BYTES });
|
|
167
|
+
if (owned.run !== request.run)
|
|
168
|
+
return unavailable("identity_mismatch");
|
|
169
|
+
const meta = inspectFile(join(owned.stateDir, "run.json"), RUN_CONTEXT_SOURCE_METADATA_MAX_BYTES);
|
|
170
|
+
const value = object(meta?.value);
|
|
171
|
+
const actual = identity(value);
|
|
172
|
+
if (!meta || !value || !actual)
|
|
173
|
+
return unavailable("identity_unavailable");
|
|
174
|
+
if (!sameIdentity(request, actual) || own(value, "state_dir") !== owned.stateDir)
|
|
175
|
+
return unavailable("identity_mismatch");
|
|
176
|
+
return { state: "available", owner: { root: owned.stateDir, directory, marker, meta: meta.stamp } };
|
|
177
|
+
}
|
|
178
|
+
catch {
|
|
179
|
+
return unavailable("identity_unavailable");
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
function ownerUnchanged(owner) {
|
|
183
|
+
const current = lstatSync(owner.root, { bigint: true });
|
|
184
|
+
return current.isDirectory() && sameObject(owner.directory, current) &&
|
|
185
|
+
sameFile(owner.marker, lstatSync(join(owner.root, RUN_STATE_OWNERSHIP_FILE), { bigint: true })) &&
|
|
186
|
+
sameFile(owner.meta, lstatSync(join(owner.root, "run.json"), { bigint: true }));
|
|
187
|
+
}
|
|
188
|
+
/** Shared readonly owner/generation observation without requiring an index or granting body/work authority. */
|
|
189
|
+
export function readRunContextIdentity(stateDir, expected) {
|
|
190
|
+
const request = identity(expected);
|
|
191
|
+
if (!request || !isAbsolute(stateDir))
|
|
192
|
+
return Object.freeze({ state: "unavailable", reason: "identity_unavailable" });
|
|
193
|
+
const admission = readContextOwner(stateDir, request);
|
|
194
|
+
if (admission.state === "unavailable")
|
|
195
|
+
return Object.freeze({ state: "unavailable",
|
|
196
|
+
reason: admission.reason === "identity_mismatch" ? "identity_mismatch" : "identity_unavailable" });
|
|
197
|
+
const unchanged = () => { try {
|
|
198
|
+
return ownerUnchanged(admission.owner);
|
|
199
|
+
}
|
|
200
|
+
catch {
|
|
201
|
+
return false;
|
|
202
|
+
} };
|
|
203
|
+
if (!unchanged())
|
|
204
|
+
return Object.freeze({ state: "unavailable", reason: "observation_changed" });
|
|
205
|
+
return Object.freeze({ state: "available", identity: Object.freeze({ ...request }), local_path: admission.owner.root, unchanged });
|
|
206
|
+
}
|
|
207
|
+
function inspectExport(root, entry) {
|
|
208
|
+
try {
|
|
209
|
+
const directory = lstatSync(join(root, "evidence"), { bigint: true });
|
|
210
|
+
if (!directory.isDirectory() || directory.isSymbolicLink())
|
|
211
|
+
return undefined;
|
|
212
|
+
const path = join(root, entry.path);
|
|
213
|
+
const observed = inspectFile(path);
|
|
214
|
+
return observed && observed.stamp.size === BigInt(entry.bytes_total) ? { path, stamp: observed.stamp, directory } : undefined;
|
|
215
|
+
}
|
|
216
|
+
catch {
|
|
217
|
+
return undefined;
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function exportsUnchanged(root, exports) {
|
|
221
|
+
return exports.every(file => {
|
|
222
|
+
const directory = lstatSync(join(root, "evidence"), { bigint: true });
|
|
223
|
+
return directory.isDirectory() && !directory.isSymbolicLink() && sameObject(file.directory, directory) &&
|
|
224
|
+
sameFile(file.stamp, lstatSync(file.path, { bigint: true }));
|
|
225
|
+
});
|
|
226
|
+
}
|
|
227
|
+
/** Physical fixed-role location only: no index/producer, role-body reads or curated publication certification. */
|
|
228
|
+
export function observeRunContextExportLocation(stateDir, expected, role) {
|
|
229
|
+
const refused = (reason) => Object.freeze({ state: "unavailable", reason });
|
|
230
|
+
if (typeof role !== "string" || !Object.hasOwn(EXPORTS, role))
|
|
231
|
+
return refused("role_invalid");
|
|
232
|
+
const owner = readRunContextIdentity(stateDir, expected);
|
|
233
|
+
if (owner.state === "unavailable")
|
|
234
|
+
return owner;
|
|
235
|
+
const relative = runContextExportPath(role);
|
|
236
|
+
try {
|
|
237
|
+
const directory = lstatSync(join(owner.local_path, "evidence"), { bigint: true });
|
|
238
|
+
if (!directory.isDirectory() || directory.isSymbolicLink())
|
|
239
|
+
return refused("export_unavailable");
|
|
240
|
+
const path = join(owner.local_path, relative);
|
|
241
|
+
const stamp = lstatSync(path, { bigint: true });
|
|
242
|
+
if (!stamp.isFile())
|
|
243
|
+
return refused("export_unavailable");
|
|
244
|
+
if (stamp.size < 0n || stamp.size > BigInt(Number.MAX_SAFE_INTEGER))
|
|
245
|
+
return refused("export_size_unrepresentable");
|
|
246
|
+
const observed = { path, stamp, directory };
|
|
247
|
+
const unchanged = () => {
|
|
248
|
+
try {
|
|
249
|
+
return owner.unchanged() && exportsUnchanged(owner.local_path, [observed]);
|
|
250
|
+
}
|
|
251
|
+
catch {
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
if (!unchanged())
|
|
256
|
+
return refused("observation_changed");
|
|
257
|
+
return Object.freeze({ state: "available", identity: owner.identity, path: relative, local_path: path,
|
|
258
|
+
bytes_total: Number(stamp.size), mutable: true, unchanged });
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
return refused(error.code === "ENOENT" ? "export_missing" : "export_unavailable");
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
/** Kernel-local metadata, not proof that bodies are redacted/immutable or permission to expose local_path. */
|
|
265
|
+
export function readRunContextIndex(stateDir, expected) {
|
|
266
|
+
const request = identity(expected);
|
|
267
|
+
if (!request || !isAbsolute(stateDir))
|
|
268
|
+
return unavailable("identity_unavailable");
|
|
269
|
+
try {
|
|
270
|
+
const admission = readContextOwner(stateDir, request);
|
|
271
|
+
if (admission.state === "unavailable")
|
|
272
|
+
return admission;
|
|
273
|
+
const owner = admission.owner;
|
|
274
|
+
const indexPath = join(owner.root, RUN_CONTEXT_INDEX_FILE);
|
|
275
|
+
const captured = inspectFile(indexPath, RUN_CONTEXT_INDEX_METADATA_MAX_BYTES);
|
|
276
|
+
if (!captured)
|
|
277
|
+
return unavailable("index_unavailable");
|
|
278
|
+
const index = decodeIndex(captured.value, request);
|
|
279
|
+
if (!index)
|
|
280
|
+
return unavailable("index_invalid");
|
|
281
|
+
const admitted = [];
|
|
282
|
+
for (const entry of Object.values(index.entries)) {
|
|
283
|
+
if (entry.availability !== "available")
|
|
284
|
+
continue;
|
|
285
|
+
const observed = inspectExport(owner.root, entry);
|
|
286
|
+
if (!observed)
|
|
287
|
+
return unavailable("role_unavailable");
|
|
288
|
+
admitted.push(observed);
|
|
289
|
+
}
|
|
290
|
+
// These rechecks reject observed change, not a multi-file atomic-snapshot or sandbox guarantee.
|
|
291
|
+
if (!ownerUnchanged(owner) || !sameFile(captured.stamp, lstatSync(indexPath, { bigint: true })) ||
|
|
292
|
+
!exportsUnchanged(owner.root, admitted))
|
|
293
|
+
return unavailable("observation_changed");
|
|
294
|
+
return Object.freeze({ state: "available", index, identity: Object.freeze({ ...request }), local_path: indexPath });
|
|
295
|
+
}
|
|
296
|
+
catch {
|
|
297
|
+
return unavailable("index_unavailable");
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
/** Trusted persistence only: the caller must hold evidence admission and supply authorized export-owner metadata, not actor flags. */
|
|
301
|
+
export function writeRunContextIndexUnderLock(stateDir, expected, updates) {
|
|
302
|
+
const request = identity(expected);
|
|
303
|
+
const changes = object(updates);
|
|
304
|
+
if (!request || !isAbsolute(stateDir) || !changes || !known(changes, Object.keys(EXPORTS))) {
|
|
305
|
+
throw new Error("Run context index publication input is invalid.");
|
|
306
|
+
}
|
|
307
|
+
const admission = readContextOwner(stateDir, request);
|
|
308
|
+
if (admission.state === "unavailable")
|
|
309
|
+
throw new Error("Run context index owner is unavailable or changed.");
|
|
310
|
+
const owner = admission.owner;
|
|
311
|
+
const path = join(owner.root, RUN_CONTEXT_INDEX_FILE);
|
|
312
|
+
let prior;
|
|
313
|
+
let priorStamp;
|
|
314
|
+
try {
|
|
315
|
+
const existing = lstatSync(path, { bigint: true });
|
|
316
|
+
if (!existing.isFile())
|
|
317
|
+
throw new Error("Run context index target is unavailable or invalid.");
|
|
318
|
+
const captured = inspectFile(path, RUN_CONTEXT_INDEX_METADATA_MAX_BYTES);
|
|
319
|
+
if (!captured || !(prior = decodeIndex(captured.value, request))) {
|
|
320
|
+
throw new Error("Run context index is unavailable, invalid or belongs to another generation.");
|
|
321
|
+
}
|
|
322
|
+
priorStamp = captured.stamp;
|
|
323
|
+
}
|
|
324
|
+
catch (error) {
|
|
325
|
+
if (error.code !== "ENOENT")
|
|
326
|
+
throw error;
|
|
327
|
+
}
|
|
328
|
+
const entries = Object.fromEntries(Object.keys(EXPORTS).map(role => [
|
|
329
|
+
role, Object.hasOwn(changes, role) ? changes[role] : prior?.entries[role] ??
|
|
330
|
+
{ availability: "unavailable", path: null, reason: "export_not_published" },
|
|
331
|
+
]));
|
|
332
|
+
const candidate = decodeIndex({ schema: "run-context-index-v1", run: request.run, run_instance_id: request.run_instance_id,
|
|
333
|
+
updated_at: new Date().toISOString(), entries }, request);
|
|
334
|
+
if (!candidate)
|
|
335
|
+
throw new Error("Run context index role metadata is invalid.");
|
|
336
|
+
const admitted = [];
|
|
337
|
+
const finalEntries = { ...candidate.entries };
|
|
338
|
+
for (const role of Object.keys(EXPORTS)) {
|
|
339
|
+
const entry = candidate.entries[role];
|
|
340
|
+
if (entry.availability !== "available")
|
|
341
|
+
continue;
|
|
342
|
+
const observed = inspectExport(owner.root, entry);
|
|
343
|
+
if (observed)
|
|
344
|
+
admitted.push(observed);
|
|
345
|
+
else
|
|
346
|
+
finalEntries[role] = Object.freeze({ availability: "unavailable", path: null, reason: "export_unavailable" });
|
|
347
|
+
}
|
|
348
|
+
const index = Object.freeze({ ...candidate, entries: Object.freeze(finalEntries) });
|
|
349
|
+
const content = JSON.stringify(index, null, 2) + "\n";
|
|
350
|
+
if (Buffer.byteLength(content, "utf8") > RUN_CONTEXT_INDEX_METADATA_MAX_BYTES) {
|
|
351
|
+
throw new Error("Run context index exceeds its bounded metadata limit.");
|
|
352
|
+
}
|
|
353
|
+
writeTextAtomic(path, content, { onBeforeReplace() {
|
|
354
|
+
let current;
|
|
355
|
+
try {
|
|
356
|
+
current = lstatSync(path, { bigint: true });
|
|
357
|
+
}
|
|
358
|
+
catch (error) {
|
|
359
|
+
if (error.code !== "ENOENT")
|
|
360
|
+
throw error;
|
|
361
|
+
}
|
|
362
|
+
if (!ownerUnchanged(owner) || !exportsUnchanged(owner.root, admitted) ||
|
|
363
|
+
(priorStamp ? !current || !sameFile(priorStamp, current) : current !== undefined)) {
|
|
364
|
+
throw new Error("Run context index observation changed before publication.");
|
|
365
|
+
}
|
|
366
|
+
} });
|
|
367
|
+
return Object.freeze({ index, local_path: path });
|
|
368
|
+
}
|
|
@@ -42,13 +42,27 @@ function sendToFifo(endpoint, payload) {
|
|
|
42
42
|
throw new Error(`Run Control endpoint is not a FIFO: ${endpoint.path}`);
|
|
43
43
|
}
|
|
44
44
|
let fd;
|
|
45
|
+
let writeFailed = false, writeFailure;
|
|
45
46
|
try {
|
|
46
47
|
fd = openSync(endpoint.path, constants.O_WRONLY | constants.O_NONBLOCK);
|
|
47
48
|
return writeSync(fd, payload);
|
|
48
49
|
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
writeFailed = true;
|
|
52
|
+
writeFailure = error;
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
49
55
|
finally {
|
|
50
|
-
if (fd !== undefined)
|
|
51
|
-
|
|
56
|
+
if (fd !== undefined) {
|
|
57
|
+
try {
|
|
58
|
+
closeSync(fd);
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
if (writeFailed)
|
|
62
|
+
throw new AggregateError([writeFailure, error], "Run Control FIFO write and close failed", { cause: writeFailure });
|
|
63
|
+
throw error;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
52
66
|
}
|
|
53
67
|
}
|
|
54
68
|
function sendToNamedPipe(endpoint, payload, send) {
|
|
@@ -78,6 +92,9 @@ function sendToNamedPipe(endpoint, payload, send) {
|
|
|
78
92
|
socket.on("connect", () => socket.end(payload, () => finish()));
|
|
79
93
|
});
|
|
80
94
|
}
|
|
95
|
+
function aggregateControlFailure(failure, causes, recording) {
|
|
96
|
+
return Object.assign(new AggregateError([...causes, recording], failure.message, { cause: causes[0] }), failure);
|
|
97
|
+
}
|
|
81
98
|
export async function deliverRunControl(run, stateDir, request, options = {}) {
|
|
82
99
|
const action = Control.normalizeControlAction(request.action);
|
|
83
100
|
const input = request.input === undefined
|
|
@@ -96,14 +113,20 @@ export async function deliverRunControl(run, stateDir, request, options = {}) {
|
|
|
96
113
|
const control = appendRunControlInStateDir(stateDir, normalizedRequest);
|
|
97
114
|
const endpoint = readRunControlEndpoint(stateDir, request.run_instance_id);
|
|
98
115
|
if (!endpoint) {
|
|
99
|
-
|
|
100
|
-
throw Object.assign(new Error("Run Control endpoint is not ready."), {
|
|
116
|
+
const failure = Object.assign(new Error("Run Control endpoint is not ready."), {
|
|
101
117
|
action,
|
|
102
118
|
control_id: control.id,
|
|
103
119
|
reason: "endpoint_not_ready",
|
|
104
120
|
run,
|
|
105
121
|
run_instance_id: request.run_instance_id,
|
|
106
122
|
});
|
|
123
|
+
try {
|
|
124
|
+
updateRunControlStatusInStateDir(stateDir, control.id, "failed", { error: "control endpoint is not ready for this Run generation" }, ["queued", "delivered"]);
|
|
125
|
+
}
|
|
126
|
+
catch (recordingError) {
|
|
127
|
+
throw aggregateControlFailure(failure, [failure], recordingError);
|
|
128
|
+
}
|
|
129
|
+
throw failure;
|
|
107
130
|
}
|
|
108
131
|
try {
|
|
109
132
|
const { bytes, payload } = encodeRunControlWire({
|
|
@@ -136,9 +159,18 @@ export async function deliverRunControl(run, stateDir, request, options = {}) {
|
|
|
136
159
|
};
|
|
137
160
|
}
|
|
138
161
|
catch (error) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
162
|
+
let reason;
|
|
163
|
+
const causes = [error];
|
|
164
|
+
try {
|
|
165
|
+
reason = String(error instanceof Error ? error.message : error);
|
|
166
|
+
}
|
|
167
|
+
catch (formattingError) {
|
|
168
|
+
reason = "failure text unavailable";
|
|
169
|
+
causes.push(formattingError);
|
|
170
|
+
}
|
|
171
|
+
const message = `Run Control delivery failed: ${reason}`;
|
|
172
|
+
const failure = Object.assign(causes.length === 1 ? new Error(message, { cause: error })
|
|
173
|
+
: new AggregateError(causes, message, { cause: error }), {
|
|
142
174
|
action,
|
|
143
175
|
control_id: control.id,
|
|
144
176
|
endpoint_type: endpoint.type,
|
|
@@ -146,5 +178,12 @@ export async function deliverRunControl(run, stateDir, request, options = {}) {
|
|
|
146
178
|
run,
|
|
147
179
|
run_instance_id: request.run_instance_id,
|
|
148
180
|
});
|
|
181
|
+
try {
|
|
182
|
+
updateRunControlStatusInStateDir(stateDir, control.id, "failed", { error: reason }, ["queued", "delivered"]);
|
|
183
|
+
}
|
|
184
|
+
catch (recordingError) {
|
|
185
|
+
throw aggregateControlFailure(failure, causes, recordingError);
|
|
186
|
+
}
|
|
187
|
+
throw failure;
|
|
149
188
|
}
|
|
150
189
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Async run process control primitives.
|
|
3
|
-
* Owns: platform
|
|
3
|
+
* Owns: platform signalling, stop-request admission, evidence-only member/preparation recovery, and terminal control markers.
|
|
4
|
+
* Excludes: deadline eligibility and proof of complete owned-scope termination.
|
|
4
5
|
*/
|
|
5
6
|
import { spawnSync } from "node:child_process";
|
|
6
|
-
import { type
|
|
7
|
+
import { type RunDescendantLaunchIntent, type RunDescendantLaunchRequest } from "./runs-descendant-launches.ts";
|
|
8
|
+
import { type RunNativeLaunchAbsenceSettlement, type RunNativeLaunchSettlement } from "./runs-native-launches.ts";
|
|
9
|
+
import { type RunStopClaim, type RunStopReason } from "./runs-outcomes.ts";
|
|
10
|
+
import { type RunProcessExitDeps, type RunProcessIdentity, type RunProcessIdentityResult } from "./runs-process.ts";
|
|
7
11
|
export interface RunProcessSignalPlan {
|
|
8
12
|
args?: string[];
|
|
9
13
|
command?: string;
|
|
@@ -17,5 +21,77 @@ export interface RunProcessSignalDeps {
|
|
|
17
21
|
verifyIdentity?: (pid: number, expected: RunProcessIdentity, runtimePlatform: NodeJS.Platform) => RunProcessIdentityResult;
|
|
18
22
|
}
|
|
19
23
|
export declare function signalOwnedRunProcess(pid: number, signal: NodeJS.Signals, expectedIdentity?: RunProcessIdentity, deps?: RunProcessSignalDeps): RunProcessSignalPlan;
|
|
24
|
+
export interface RunStopClaimRequest {
|
|
25
|
+
runInstanceId: string;
|
|
26
|
+
ownerId?: string;
|
|
27
|
+
reason: RunStopReason;
|
|
28
|
+
}
|
|
29
|
+
export type RunStopClaimResult = {
|
|
30
|
+
status: "stop_requested";
|
|
31
|
+
stopped: false;
|
|
32
|
+
reused: boolean;
|
|
33
|
+
claim: Readonly<RunStopClaim>;
|
|
34
|
+
} | {
|
|
35
|
+
status: "already_terminal";
|
|
36
|
+
terminal_status: "done" | "failed";
|
|
37
|
+
} | {
|
|
38
|
+
status: "rejected";
|
|
39
|
+
code: string;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* Requests only: no signal, handled marker, or claim of physical termination.
|
|
43
|
+
* The supervisor owns deadline eligibility; this owner revalidates configuration and identity.
|
|
44
|
+
* Legacy producers cannot participate until they bind the serialized outcome protocol.
|
|
45
|
+
*/
|
|
46
|
+
export declare function claimRunStop(stateDir: string, request: RunStopClaimRequest, deps?: RunProcessSignalDeps & {
|
|
47
|
+
onLockContention?: () => void;
|
|
48
|
+
}): RunStopClaimResult;
|
|
49
|
+
export interface RunNativeMemberRecoveryRequest {
|
|
50
|
+
runInstanceId: string;
|
|
51
|
+
ownerId?: string;
|
|
52
|
+
intentId: string;
|
|
53
|
+
}
|
|
54
|
+
export type RunNativeMemberRecoveryResult = {
|
|
55
|
+
status: "recorded";
|
|
56
|
+
settlement: Readonly<RunNativeLaunchAbsenceSettlement>;
|
|
57
|
+
} | {
|
|
58
|
+
status: "already_recorded";
|
|
59
|
+
settlement: Readonly<RunNativeLaunchSettlement>;
|
|
60
|
+
} | {
|
|
61
|
+
status: "unproven";
|
|
62
|
+
reason: string;
|
|
63
|
+
} | {
|
|
64
|
+
status: "rejected";
|
|
65
|
+
code: string;
|
|
66
|
+
};
|
|
67
|
+
/** Evidence only after producer exit; never repair birth, dispatch signals, reopen work, or finalize a scope. */
|
|
68
|
+
export declare function recoverRunNativeMemberExit(stateDir: string, request: RunNativeMemberRecoveryRequest, deps?: RunProcessExitDeps & {
|
|
69
|
+
onLockContention?: () => void;
|
|
70
|
+
}): RunNativeMemberRecoveryResult;
|
|
71
|
+
export interface RunDescendantPreparationRecoveryRequest {
|
|
72
|
+
runInstanceId: string;
|
|
73
|
+
ownerId?: string;
|
|
74
|
+
child: RunDescendantLaunchRequest;
|
|
75
|
+
}
|
|
76
|
+
export interface RunDescendantRecoveryCleanupFailure {
|
|
77
|
+
readonly status: "release_unproven";
|
|
78
|
+
readonly error_code: string;
|
|
79
|
+
}
|
|
80
|
+
export type RunDescendantPreparationRecoveryResult = ({
|
|
81
|
+
status: "recorded" | "already_recorded";
|
|
82
|
+
intent: Readonly<RunDescendantLaunchIntent>;
|
|
83
|
+
} | {
|
|
84
|
+
status: "unproven";
|
|
85
|
+
reason: string;
|
|
86
|
+
} | {
|
|
87
|
+
status: "rejected";
|
|
88
|
+
code: string;
|
|
89
|
+
}) & {
|
|
90
|
+
readonly cleanup?: Readonly<RunDescendantRecoveryCleanupFailure>;
|
|
91
|
+
};
|
|
92
|
+
/** Post-producer metadata evidence only; never recreate a producer, launch work, invent exits, or release scope guards. */
|
|
93
|
+
export declare function recoverRunDescendantPreparation(stateDir: string, request: RunDescendantPreparationRecoveryRequest, deps?: RunProcessExitDeps & {
|
|
94
|
+
onLockContention?: () => void;
|
|
95
|
+
}): Readonly<RunDescendantPreparationRecoveryResult>;
|
|
20
96
|
export declare function markTerminalHandled(stateDir: string, details: Record<string, unknown>): void;
|
|
21
97
|
export declare function buildTerminalProgress(existing: Record<string, unknown> | undefined, phase: "cancelled" | "killed"): Record<string, unknown>;
|