@llblab/pi-kit 0.38.3 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +2 -2
- package/node_modules/@llblab/pi-actors/AGENTS.md +108 -20
- package/node_modules/@llblab/pi-actors/BACKLOG.md +207 -4
- package/node_modules/@llblab/pi-actors/CHANGELOG.md +13 -0
- package/node_modules/@llblab/pi-actors/README.md +31 -1
- package/node_modules/@llblab/pi-actors/dist/index.js +1 -1
- package/node_modules/@llblab/pi-actors/dist/lib/async-runs.d.ts +37 -0
- package/node_modules/@llblab/pi-actors/dist/lib/async-runs.js +131 -62
- package/node_modules/@llblab/pi-actors/dist/lib/automatic-review-runtime.d.ts +2 -0
- package/node_modules/@llblab/pi-actors/dist/lib/automatic-review-runtime.js +3 -2
- package/node_modules/@llblab/pi-actors/dist/lib/command-templates.d.ts +37 -0
- package/node_modules/@llblab/pi-actors/dist/lib/command-templates.js +263 -129
- package/node_modules/@llblab/pi-actors/dist/lib/execution-files.d.ts +32 -0
- package/node_modules/@llblab/pi-actors/dist/lib/execution-files.js +128 -0
- package/node_modules/@llblab/pi-actors/dist/lib/execution-output.js +5 -4
- package/node_modules/@llblab/pi-actors/dist/lib/execution-sessions.d.ts +19 -1
- package/node_modules/@llblab/pi-actors/dist/lib/execution-sessions.js +62 -26
- package/node_modules/@llblab/pi-actors/dist/lib/execution.d.ts +4 -1
- package/node_modules/@llblab/pi-actors/dist/lib/execution.js +6 -1
- package/node_modules/@llblab/pi-actors/dist/lib/extension-runtime.d.ts +9 -2
- package/node_modules/@llblab/pi-actors/dist/lib/extension-runtime.js +92 -14
- package/node_modules/@llblab/pi-actors/dist/lib/file-state.js +21 -2
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-command.js +2 -2
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-overlay.d.ts +25 -7
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-overlay.js +562 -262
- package/node_modules/@llblab/pi-actors/dist/lib/inspector.d.ts +20 -10
- package/node_modules/@llblab/pi-actors/dist/lib/inspector.js +80 -91
- package/node_modules/@llblab/pi-actors/dist/lib/limits.d.ts +1 -0
- package/node_modules/@llblab/pi-actors/dist/lib/limits.js +1 -0
- package/node_modules/@llblab/pi-actors/dist/lib/observability.d.ts +15 -1
- package/node_modules/@llblab/pi-actors/dist/lib/observability.js +216 -99
- package/node_modules/@llblab/pi-actors/dist/lib/pi.d.ts +5 -4
- package/node_modules/@llblab/pi-actors/dist/lib/pi.js +64 -10
- package/node_modules/@llblab/pi-actors/dist/lib/recipe-projection.d.ts +18 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipe-projection.js +220 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipes-context.d.ts +2 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipes-context.js +30 -6
- package/node_modules/@llblab/pi-actors/dist/lib/registry.js +270 -36
- package/node_modules/@llblab/pi-actors/dist/lib/run-delivery.d.ts +213 -5
- package/node_modules/@llblab/pi-actors/dist/lib/run-delivery.js +1909 -40
- package/node_modules/@llblab/pi-actors/dist/lib/run-supervision.d.ts +107 -0
- package/node_modules/@llblab/pi-actors/dist/lib/run-supervision.js +412 -0
- package/node_modules/@llblab/pi-actors/dist/lib/run-ui-runtime.d.ts +9 -2
- package/node_modules/@llblab/pi-actors/dist/lib/run-ui-runtime.js +283 -60
- package/node_modules/@llblab/pi-actors/dist/lib/runs-artifacts.d.ts +26 -1
- package/node_modules/@llblab/pi-actors/dist/lib/runs-artifacts.js +68 -2
- package/node_modules/@llblab/pi-actors/dist/lib/runs-context-exports.d.ts +451 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-context-exports.js +2315 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-context-index.d.ts +97 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-context-index.js +368 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-control-delivery.js +46 -7
- package/node_modules/@llblab/pi-actors/dist/lib/runs-control.d.ts +78 -2
- package/node_modules/@llblab/pi-actors/dist/lib/runs-control.js +334 -2
- package/node_modules/@llblab/pi-actors/dist/lib/runs-controls.js +4 -1
- package/node_modules/@llblab/pi-actors/dist/lib/runs-descendant-launches.d.ts +80 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-descendant-launches.js +287 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-execution-evidence.d.ts +110 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-execution-evidence.js +282 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-index.d.ts +66 -1
- package/node_modules/@llblab/pi-actors/dist/lib/runs-index.js +349 -13
- package/node_modules/@llblab/pi-actors/dist/lib/runs-native-launches.d.ts +73 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-native-launches.js +227 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-outcomes.d.ts +141 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-outcomes.js +292 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-ownership.d.ts +10 -1
- package/node_modules/@llblab/pi-actors/dist/lib/runs-ownership.js +36 -4
- package/node_modules/@llblab/pi-actors/dist/lib/runs-process-windows-mi.d.ts +46 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-process-windows-mi.js +114 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-process.d.ts +34 -1
- package/node_modules/@llblab/pi-actors/dist/lib/runs-process.js +158 -26
- package/node_modules/@llblab/pi-actors/dist/lib/runs-results.d.ts +116 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-results.js +518 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-retention.d.ts +15 -2
- package/node_modules/@llblab/pi-actors/dist/lib/runs-retention.js +148 -9
- package/node_modules/@llblab/pi-actors/dist/lib/runs-session-exports.d.ts +95 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-session-exports.js +470 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-snapshot.d.ts +58 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-snapshot.js +92 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-start.d.ts +2 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-start.js +44 -3
- package/node_modules/@llblab/pi-actors/dist/lib/runs-status.d.ts +15 -1
- package/node_modules/@llblab/pi-actors/dist/lib/runs-status.js +337 -13
- package/node_modules/@llblab/pi-actors/dist/lib/runs-supervision.d.ts +105 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-supervision.js +501 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-trace.d.ts +1 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-trace.js +14 -3
- package/node_modules/@llblab/pi-actors/dist/lib/runtime.js +22 -3
- package/node_modules/@llblab/pi-actors/dist/lib/session-evidence.d.ts +37 -0
- package/node_modules/@llblab/pi-actors/dist/lib/session-evidence.js +59 -3
- package/node_modules/@llblab/pi-actors/dist/lib/state-readers.d.ts +4 -1
- package/node_modules/@llblab/pi-actors/dist/lib/state-readers.js +14 -8
- package/node_modules/@llblab/pi-actors/dist/lib/temp.d.ts +2 -4
- package/node_modules/@llblab/pi-actors/dist/lib/temp.js +4 -56
- package/node_modules/@llblab/pi-actors/dist/lib/tools-access.d.ts +3 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-access.js +13 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-inspect.d.ts +1 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-inspect.js +110 -43
- package/node_modules/@llblab/pi-actors/dist/lib/tools-local.d.ts +3 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-local.js +18 -6
- package/node_modules/@llblab/pi-actors/dist/lib/tools-message.d.ts +4 -1
- package/node_modules/@llblab/pi-actors/dist/lib/tools-message.js +126 -31
- package/node_modules/@llblab/pi-actors/dist/lib/tools-response.d.ts +31 -3
- package/node_modules/@llblab/pi-actors/dist/lib/tools-response.js +311 -47
- package/node_modules/@llblab/pi-actors/dist/lib/tools-spawn.d.ts +3 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-spawn.js +29 -7
- package/node_modules/@llblab/pi-actors/dist/lib/trace-projection.d.ts +20 -0
- package/node_modules/@llblab/pi-actors/dist/lib/trace-projection.js +192 -43
- package/node_modules/@llblab/pi-actors/dist/scripts/async-runner.mjs +272 -194
- package/node_modules/@llblab/pi-actors/dist/scripts/conformance.mjs +14 -2
- package/node_modules/@llblab/pi-actors/dist/skills/actors/SKILL.md +46 -2
- package/node_modules/@llblab/pi-actors/dist/skills/actors/references/diagnostics.md +40 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/references/runs.md +55 -1
- package/node_modules/@llblab/pi-actors/docs/README.md +9 -1
- package/node_modules/@llblab/pi-actors/docs/actor-inspector.md +84 -15
- package/node_modules/@llblab/pi-actors/docs/agent-experience.md +216 -0
- package/node_modules/@llblab/pi-actors/docs/async-runs.md +18 -2
- package/node_modules/@llblab/pi-actors/docs/composition-transport.md +103 -0
- package/node_modules/@llblab/pi-actors/docs/coordinator-delivery.md +204 -4
- package/node_modules/@llblab/pi-actors/docs/inspection.md +38 -2
- package/node_modules/@llblab/pi-actors/docs/output-projection-map.md +130 -0
- package/node_modules/@llblab/pi-actors/docs/releasing.md +19 -2
- package/node_modules/@llblab/pi-actors/docs/run-supervision.md +1622 -0
- package/node_modules/@llblab/pi-actors/docs/template-recipes.md +4 -0
- package/node_modules/@llblab/pi-actors/docs/windows-process-observation.md +248 -0
- package/node_modules/@llblab/pi-actors/index.ts +1 -1
- package/node_modules/@llblab/pi-actors/lib/async-runs.ts +164 -73
- package/node_modules/@llblab/pi-actors/lib/automatic-review-runtime.ts +4 -2
- package/node_modules/@llblab/pi-actors/lib/command-templates.ts +287 -138
- package/node_modules/@llblab/pi-actors/lib/execution-files.ts +118 -0
- package/node_modules/@llblab/pi-actors/lib/execution-output.ts +4 -4
- package/node_modules/@llblab/pi-actors/lib/execution-sessions.ts +57 -27
- package/node_modules/@llblab/pi-actors/lib/execution.ts +8 -0
- package/node_modules/@llblab/pi-actors/lib/extension-runtime.ts +102 -12
- package/node_modules/@llblab/pi-actors/lib/file-state.ts +16 -2
- package/node_modules/@llblab/pi-actors/lib/inspector-command.ts +2 -2
- package/node_modules/@llblab/pi-actors/lib/inspector-overlay.ts +524 -261
- package/node_modules/@llblab/pi-actors/lib/inspector.ts +101 -130
- package/node_modules/@llblab/pi-actors/lib/limits.ts +1 -0
- package/node_modules/@llblab/pi-actors/lib/observability.ts +235 -116
- package/node_modules/@llblab/pi-actors/lib/pi.ts +59 -11
- package/node_modules/@llblab/pi-actors/lib/recipe-projection.ts +232 -0
- package/node_modules/@llblab/pi-actors/lib/recipes-context.ts +27 -6
- package/node_modules/@llblab/pi-actors/lib/registry.ts +266 -36
- package/node_modules/@llblab/pi-actors/lib/run-delivery.ts +1737 -49
- package/node_modules/@llblab/pi-actors/lib/run-supervision.ts +411 -0
- package/node_modules/@llblab/pi-actors/lib/run-ui-runtime.ts +237 -73
- package/node_modules/@llblab/pi-actors/lib/runs-artifacts.ts +73 -1
- package/node_modules/@llblab/pi-actors/lib/runs-context-exports.ts +1871 -0
- package/node_modules/@llblab/pi-actors/lib/runs-context-index.ts +372 -0
- package/node_modules/@llblab/pi-actors/lib/runs-control-delivery.ts +36 -18
- package/node_modules/@llblab/pi-actors/lib/runs-control.ts +297 -1
- package/node_modules/@llblab/pi-actors/lib/runs-controls.ts +3 -1
- package/node_modules/@llblab/pi-actors/lib/runs-descendant-launches.ts +338 -0
- package/node_modules/@llblab/pi-actors/lib/runs-execution-evidence.ts +302 -0
- package/node_modules/@llblab/pi-actors/lib/runs-index.ts +345 -17
- package/node_modules/@llblab/pi-actors/lib/runs-native-launches.ts +270 -0
- package/node_modules/@llblab/pi-actors/lib/runs-outcomes.ts +377 -0
- package/node_modules/@llblab/pi-actors/lib/runs-ownership.ts +37 -4
- package/node_modules/@llblab/pi-actors/lib/runs-process-windows-mi.ts +113 -0
- package/node_modules/@llblab/pi-actors/lib/runs-process.ts +210 -34
- package/node_modules/@llblab/pi-actors/lib/runs-results.ts +601 -0
- package/node_modules/@llblab/pi-actors/lib/runs-retention.ts +134 -10
- package/node_modules/@llblab/pi-actors/lib/runs-session-exports.ts +406 -0
- package/node_modules/@llblab/pi-actors/lib/runs-snapshot.ts +143 -0
- package/node_modules/@llblab/pi-actors/lib/runs-start.ts +44 -2
- package/node_modules/@llblab/pi-actors/lib/runs-status.ts +252 -10
- package/node_modules/@llblab/pi-actors/lib/runs-supervision.ts +394 -0
- package/node_modules/@llblab/pi-actors/lib/runs-trace.ts +14 -3
- package/node_modules/@llblab/pi-actors/lib/runtime.ts +22 -3
- package/node_modules/@llblab/pi-actors/lib/session-evidence.ts +76 -4
- package/node_modules/@llblab/pi-actors/lib/state-readers.ts +16 -7
- package/node_modules/@llblab/pi-actors/lib/temp.ts +3 -56
- package/node_modules/@llblab/pi-actors/lib/tools-access.ts +13 -0
- package/node_modules/@llblab/pi-actors/lib/tools-inspect.ts +110 -51
- package/node_modules/@llblab/pi-actors/lib/tools-local.ts +37 -24
- package/node_modules/@llblab/pi-actors/lib/tools-message.ts +120 -37
- package/node_modules/@llblab/pi-actors/lib/tools-response.ts +273 -50
- package/node_modules/@llblab/pi-actors/lib/tools-spawn.ts +31 -10
- package/node_modules/@llblab/pi-actors/lib/trace-projection.ts +165 -42
- package/node_modules/@llblab/pi-actors/package.json +10 -6
- package/node_modules/@llblab/pi-actors/scripts/async-runner.mjs +272 -194
- package/node_modules/@llblab/pi-actors/scripts/conformance.mjs +14 -2
- package/node_modules/@llblab/pi-actors/skills/actors/SKILL.md +46 -2
- package/node_modules/@llblab/pi-actors/skills/actors/references/diagnostics.md +40 -0
- package/node_modules/@llblab/pi-actors/skills/actors/references/runs.md +55 -1
- package/node_modules/@llblab/pi-codex-usage/AGENTS.md +2 -2
- package/node_modules/@llblab/pi-codex-usage/CHANGELOG.md +6 -0
- package/node_modules/@llblab/pi-codex-usage/README.md +9 -5
- package/node_modules/@llblab/pi-codex-usage/lib/query.ts +229 -50
- package/node_modules/@llblab/pi-codex-usage/lib/usage.ts +9 -1
- package/node_modules/@llblab/pi-codex-usage/package.json +1 -1
- package/node_modules/yaml/LICENSE +13 -0
- package/node_modules/yaml/README.md +172 -0
- package/node_modules/yaml/bin.mjs +11 -0
- package/node_modules/yaml/browser/dist/compose/compose-collection.js +88 -0
- package/node_modules/yaml/browser/dist/compose/compose-doc.js +43 -0
- package/node_modules/yaml/browser/dist/compose/compose-node.js +109 -0
- package/node_modules/yaml/browser/dist/compose/compose-scalar.js +86 -0
- package/node_modules/yaml/browser/dist/compose/composer.js +219 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-map.js +115 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-scalar.js +198 -0
- package/node_modules/yaml/browser/dist/compose/resolve-block-seq.js +49 -0
- package/node_modules/yaml/browser/dist/compose/resolve-end.js +37 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-collection.js +207 -0
- package/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +225 -0
- package/node_modules/yaml/browser/dist/compose/resolve-props.js +146 -0
- package/node_modules/yaml/browser/dist/compose/util-contains-newline.js +34 -0
- package/node_modules/yaml/browser/dist/compose/util-empty-scalar-position.js +26 -0
- package/node_modules/yaml/browser/dist/compose/util-flow-indent-check.js +15 -0
- package/node_modules/yaml/browser/dist/compose/util-map-includes.js +13 -0
- package/node_modules/yaml/browser/dist/doc/Document.js +335 -0
- package/node_modules/yaml/browser/dist/doc/anchors.js +71 -0
- package/node_modules/yaml/browser/dist/doc/applyReviver.js +55 -0
- package/node_modules/yaml/browser/dist/doc/createNode.js +88 -0
- package/node_modules/yaml/browser/dist/doc/directives.js +176 -0
- package/node_modules/yaml/browser/dist/errors.js +57 -0
- package/node_modules/yaml/browser/dist/index.js +17 -0
- package/node_modules/yaml/browser/dist/log.js +11 -0
- package/node_modules/yaml/browser/dist/nodes/Alias.js +116 -0
- package/node_modules/yaml/browser/dist/nodes/Collection.js +147 -0
- package/node_modules/yaml/browser/dist/nodes/Node.js +38 -0
- package/node_modules/yaml/browser/dist/nodes/Pair.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/Scalar.js +24 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLMap.js +144 -0
- package/node_modules/yaml/browser/dist/nodes/YAMLSeq.js +113 -0
- package/node_modules/yaml/browser/dist/nodes/addPairToJSMap.js +63 -0
- package/node_modules/yaml/browser/dist/nodes/identity.js +36 -0
- package/node_modules/yaml/browser/dist/nodes/toJS.js +37 -0
- package/node_modules/yaml/browser/dist/parse/cst-scalar.js +214 -0
- package/node_modules/yaml/browser/dist/parse/cst-stringify.js +61 -0
- package/node_modules/yaml/browser/dist/parse/cst-visit.js +97 -0
- package/node_modules/yaml/browser/dist/parse/cst.js +98 -0
- package/node_modules/yaml/browser/dist/parse/lexer.js +721 -0
- package/node_modules/yaml/browser/dist/parse/line-counter.js +39 -0
- package/node_modules/yaml/browser/dist/parse/parser.js +975 -0
- package/node_modules/yaml/browser/dist/public-api.js +102 -0
- package/node_modules/yaml/browser/dist/schema/Schema.js +37 -0
- package/node_modules/yaml/browser/dist/schema/common/map.js +17 -0
- package/node_modules/yaml/browser/dist/schema/common/null.js +15 -0
- package/node_modules/yaml/browser/dist/schema/common/seq.js +17 -0
- package/node_modules/yaml/browser/dist/schema/common/string.js +14 -0
- package/node_modules/yaml/browser/dist/schema/core/bool.js +19 -0
- package/node_modules/yaml/browser/dist/schema/core/float.js +43 -0
- package/node_modules/yaml/browser/dist/schema/core/int.js +38 -0
- package/node_modules/yaml/browser/dist/schema/core/schema.js +23 -0
- package/node_modules/yaml/browser/dist/schema/json/schema.js +62 -0
- package/node_modules/yaml/browser/dist/schema/tags.js +96 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/binary.js +58 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/bool.js +26 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/float.js +46 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/int.js +71 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +67 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/omap.js +74 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/pairs.js +78 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/schema.js +39 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/set.js +93 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/timestamp.js +101 -0
- package/node_modules/yaml/browser/dist/stringify/foldFlowLines.js +146 -0
- package/node_modules/yaml/browser/dist/stringify/stringify.js +129 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyCollection.js +153 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyComment.js +20 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyDocument.js +85 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +25 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyPair.js +150 -0
- package/node_modules/yaml/browser/dist/stringify/stringifyString.js +336 -0
- package/node_modules/yaml/browser/dist/util.js +11 -0
- package/node_modules/yaml/browser/dist/visit.js +233 -0
- package/node_modules/yaml/browser/index.js +5 -0
- package/node_modules/yaml/browser/package.json +3 -0
- package/node_modules/yaml/dist/cli.d.ts +8 -0
- package/node_modules/yaml/dist/cli.mjs +201 -0
- package/node_modules/yaml/dist/compose/compose-collection.d.ts +11 -0
- package/node_modules/yaml/dist/compose/compose-collection.js +90 -0
- package/node_modules/yaml/dist/compose/compose-doc.d.ts +7 -0
- package/node_modules/yaml/dist/compose/compose-doc.js +45 -0
- package/node_modules/yaml/dist/compose/compose-node.d.ts +29 -0
- package/node_modules/yaml/dist/compose/compose-node.js +112 -0
- package/node_modules/yaml/dist/compose/compose-scalar.d.ts +5 -0
- package/node_modules/yaml/dist/compose/compose-scalar.js +88 -0
- package/node_modules/yaml/dist/compose/composer.d.ts +63 -0
- package/node_modules/yaml/dist/compose/composer.js +224 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-map.js +117 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.d.ts +11 -0
- package/node_modules/yaml/dist/compose/resolve-block-scalar.js +200 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-block-seq.js +51 -0
- package/node_modules/yaml/dist/compose/resolve-end.d.ts +6 -0
- package/node_modules/yaml/dist/compose/resolve-end.js +39 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.d.ts +7 -0
- package/node_modules/yaml/dist/compose/resolve-flow-collection.js +209 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.d.ts +10 -0
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +227 -0
- package/node_modules/yaml/dist/compose/resolve-props.d.ts +23 -0
- package/node_modules/yaml/dist/compose/resolve-props.js +148 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-contains-newline.js +36 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.d.ts +2 -0
- package/node_modules/yaml/dist/compose/util-empty-scalar-position.js +28 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.d.ts +3 -0
- package/node_modules/yaml/dist/compose/util-flow-indent-check.js +17 -0
- package/node_modules/yaml/dist/compose/util-map-includes.d.ts +4 -0
- package/node_modules/yaml/dist/compose/util-map-includes.js +15 -0
- package/node_modules/yaml/dist/doc/Document.d.ts +141 -0
- package/node_modules/yaml/dist/doc/Document.js +337 -0
- package/node_modules/yaml/dist/doc/anchors.d.ts +24 -0
- package/node_modules/yaml/dist/doc/anchors.js +76 -0
- package/node_modules/yaml/dist/doc/applyReviver.d.ts +9 -0
- package/node_modules/yaml/dist/doc/applyReviver.js +57 -0
- package/node_modules/yaml/dist/doc/createNode.d.ts +17 -0
- package/node_modules/yaml/dist/doc/createNode.js +90 -0
- package/node_modules/yaml/dist/doc/directives.d.ts +49 -0
- package/node_modules/yaml/dist/doc/directives.js +178 -0
- package/node_modules/yaml/dist/errors.d.ts +21 -0
- package/node_modules/yaml/dist/errors.js +62 -0
- package/node_modules/yaml/dist/index.d.ts +25 -0
- package/node_modules/yaml/dist/index.js +50 -0
- package/node_modules/yaml/dist/log.d.ts +3 -0
- package/node_modules/yaml/dist/log.js +19 -0
- package/node_modules/yaml/dist/nodes/Alias.d.ts +29 -0
- package/node_modules/yaml/dist/nodes/Alias.js +118 -0
- package/node_modules/yaml/dist/nodes/Collection.d.ts +73 -0
- package/node_modules/yaml/dist/nodes/Collection.js +151 -0
- package/node_modules/yaml/dist/nodes/Node.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/Node.js +40 -0
- package/node_modules/yaml/dist/nodes/Pair.d.ts +22 -0
- package/node_modules/yaml/dist/nodes/Pair.js +39 -0
- package/node_modules/yaml/dist/nodes/Scalar.d.ts +47 -0
- package/node_modules/yaml/dist/nodes/Scalar.js +27 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.d.ts +53 -0
- package/node_modules/yaml/dist/nodes/YAMLMap.js +147 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.d.ts +60 -0
- package/node_modules/yaml/dist/nodes/YAMLSeq.js +115 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.d.ts +4 -0
- package/node_modules/yaml/dist/nodes/addPairToJSMap.js +65 -0
- package/node_modules/yaml/dist/nodes/identity.d.ts +23 -0
- package/node_modules/yaml/dist/nodes/identity.js +53 -0
- package/node_modules/yaml/dist/nodes/toJS.d.ts +29 -0
- package/node_modules/yaml/dist/nodes/toJS.js +39 -0
- package/node_modules/yaml/dist/options.d.ts +350 -0
- package/node_modules/yaml/dist/parse/cst-scalar.d.ts +64 -0
- package/node_modules/yaml/dist/parse/cst-scalar.js +218 -0
- package/node_modules/yaml/dist/parse/cst-stringify.d.ts +8 -0
- package/node_modules/yaml/dist/parse/cst-stringify.js +63 -0
- package/node_modules/yaml/dist/parse/cst-visit.d.ts +39 -0
- package/node_modules/yaml/dist/parse/cst-visit.js +99 -0
- package/node_modules/yaml/dist/parse/cst.d.ts +109 -0
- package/node_modules/yaml/dist/parse/cst.js +112 -0
- package/node_modules/yaml/dist/parse/lexer.d.ts +87 -0
- package/node_modules/yaml/dist/parse/lexer.js +723 -0
- package/node_modules/yaml/dist/parse/line-counter.d.ts +22 -0
- package/node_modules/yaml/dist/parse/line-counter.js +41 -0
- package/node_modules/yaml/dist/parse/parser.d.ts +84 -0
- package/node_modules/yaml/dist/parse/parser.js +980 -0
- package/node_modules/yaml/dist/public-api.d.ts +44 -0
- package/node_modules/yaml/dist/public-api.js +107 -0
- package/node_modules/yaml/dist/schema/Schema.d.ts +17 -0
- package/node_modules/yaml/dist/schema/Schema.js +39 -0
- package/node_modules/yaml/dist/schema/common/map.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/map.js +19 -0
- package/node_modules/yaml/dist/schema/common/null.d.ts +4 -0
- package/node_modules/yaml/dist/schema/common/null.js +17 -0
- package/node_modules/yaml/dist/schema/common/seq.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/seq.js +19 -0
- package/node_modules/yaml/dist/schema/common/string.d.ts +2 -0
- package/node_modules/yaml/dist/schema/common/string.js +16 -0
- package/node_modules/yaml/dist/schema/core/bool.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/bool.js +21 -0
- package/node_modules/yaml/dist/schema/core/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/float.js +47 -0
- package/node_modules/yaml/dist/schema/core/int.d.ts +4 -0
- package/node_modules/yaml/dist/schema/core/int.js +42 -0
- package/node_modules/yaml/dist/schema/core/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/core/schema.js +25 -0
- package/node_modules/yaml/dist/schema/json/schema.d.ts +2 -0
- package/node_modules/yaml/dist/schema/json/schema.js +64 -0
- package/node_modules/yaml/dist/schema/json-schema.d.ts +69 -0
- package/node_modules/yaml/dist/schema/tags.d.ts +48 -0
- package/node_modules/yaml/dist/schema/tags.js +99 -0
- package/node_modules/yaml/dist/schema/types.d.ts +92 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.d.ts +2 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/binary.js +70 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.d.ts +7 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/bool.js +29 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.d.ts +4 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/float.js +50 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.d.ts +5 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/int.js +76 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.d.ts +9 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.js +71 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.d.ts +22 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/omap.js +77 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.d.ts +10 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/pairs.js +82 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.d.ts +1 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/schema.js +41 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.d.ts +28 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/set.js +96 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.d.ts +6 -0
- package/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js +105 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.d.ts +34 -0
- package/node_modules/yaml/dist/stringify/foldFlowLines.js +151 -0
- package/node_modules/yaml/dist/stringify/stringify.d.ts +21 -0
- package/node_modules/yaml/dist/stringify/stringify.js +132 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.d.ts +17 -0
- package/node_modules/yaml/dist/stringify/stringifyCollection.js +155 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.d.ts +10 -0
- package/node_modules/yaml/dist/stringify/stringifyComment.js +24 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.d.ts +4 -0
- package/node_modules/yaml/dist/stringify/stringifyDocument.js +87 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.d.ts +2 -0
- package/node_modules/yaml/dist/stringify/stringifyNumber.js +27 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.d.ts +3 -0
- package/node_modules/yaml/dist/stringify/stringifyPair.js +152 -0
- package/node_modules/yaml/dist/stringify/stringifyString.d.ts +9 -0
- package/node_modules/yaml/dist/stringify/stringifyString.js +338 -0
- package/node_modules/yaml/dist/test-events.d.ts +4 -0
- package/node_modules/yaml/dist/test-events.js +134 -0
- package/node_modules/yaml/dist/util.d.ts +16 -0
- package/node_modules/yaml/dist/util.js +28 -0
- package/node_modules/yaml/dist/visit.d.ts +102 -0
- package/node_modules/yaml/dist/visit.js +236 -0
- package/node_modules/yaml/package.json +97 -0
- package/node_modules/yaml/util.js +2 -0
- package/package.json +3 -3
- package/node_modules/@llblab/pi-actors/banner.jpg +0 -0
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-actions.d.ts +0 -16
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-actions.js +0 -57
- package/node_modules/@llblab/pi-actors/lib/inspector-actions.ts +0 -79
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Ambient run observability runtime.
|
|
3
3
|
* Zones: run watcher lifecycle, terminal reconciliation, status animation, shutdown teardown
|
|
4
|
-
* Owns event-driven run UI coordination
|
|
4
|
+
* Owns event-driven run UI/delivery coordination and callback-generation fences; excludes actor execution semantics and public stream activation.
|
|
5
5
|
*/
|
|
6
|
+
import { Container, Markdown, Spacer, Text, stripTerminalSequences } from "@earendil-works/pi-tui";
|
|
6
7
|
import * as AsyncRuns from "./async-runs.js";
|
|
7
8
|
import * as Limits from "./limits.js";
|
|
8
9
|
import * as Observability from "./observability.js";
|
|
@@ -10,10 +11,101 @@ import * as Paths from "./paths.js";
|
|
|
10
11
|
import * as Pi from "./pi.js";
|
|
11
12
|
import * as RunDelivery from "./run-delivery.js";
|
|
12
13
|
import * as RunDeliveryLineage from "./run-delivery-lineage.js";
|
|
14
|
+
import * as RunIndex from "./runs-index.js";
|
|
15
|
+
import { formatLiteralBlock, formatMarkdownField } from "./tools-response.js";
|
|
16
|
+
function formatSteerDiagnosticMessage(eventId, stage, message) {
|
|
17
|
+
const fields = [formatMarkdownField("event", eventId), formatMarkdownField("attention", "steer"),
|
|
18
|
+
formatMarkdownField("stage", stage), formatMarkdownField("result", stage === "admission" ? "remains retryable" : "request failed")];
|
|
19
|
+
if (stage === "delivery")
|
|
20
|
+
fields.push(formatMarkdownField("delivery", "unconfirmed"), formatMarkdownField("presentation", "unconfirmed"));
|
|
21
|
+
let end = Math.min(message.length, 240);
|
|
22
|
+
const last = message.charCodeAt(end - 1), next = message.charCodeAt(end);
|
|
23
|
+
if (last >= 0xd800 && last <= 0xdbff && next >= 0xdc00 && next <= 0xdfff)
|
|
24
|
+
end -= 1;
|
|
25
|
+
const preview = message.slice(0, end), clipped = end < message.length;
|
|
26
|
+
if (Buffer.from(preview).toString("utf8") !== preview) {
|
|
27
|
+
fields.push(formatMarkdownField("diagnostic", "unavailable"), formatMarkdownField("diagnostic_reason", "malformed legacy preview"), formatMarkdownField("diagnostic_omission", "[omitted: unknown]"));
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
fields.push(formatMarkdownField("diagnostic", preview + (clipped ? "…" : "")));
|
|
31
|
+
if (clipped)
|
|
32
|
+
fields.push(formatMarkdownField("diagnostic_omission", "[omitted: unknown]"));
|
|
33
|
+
}
|
|
34
|
+
return fields.join("\n");
|
|
35
|
+
}
|
|
36
|
+
/** Transcript-only view of the exact delivered content; never re-read a Run or infer body labels. */
|
|
37
|
+
export function registerRunCompletionRenderer(pi) {
|
|
38
|
+
pi.registerMessageRenderer(Pi.RUN_COMPLETION_BATCH_CUSTOM_TYPE, (message, { expanded, outputPad }, theme) => {
|
|
39
|
+
if (typeof message.content !== "string")
|
|
40
|
+
return undefined;
|
|
41
|
+
let presentation;
|
|
42
|
+
try {
|
|
43
|
+
presentation = Object.getOwnPropertyDescriptor(message.details, "pi_actors_presentation")?.value;
|
|
44
|
+
}
|
|
45
|
+
catch { /* no layout hint */ }
|
|
46
|
+
const view = RunDelivery.readRunCompletionPresentation(message.content, presentation);
|
|
47
|
+
if (!view)
|
|
48
|
+
return undefined;
|
|
49
|
+
if (!expanded && view.segments) {
|
|
50
|
+
const component = new Container(), markdownTheme = { ...Pi.getMarkdownTheme(), codeBlockIndent: "" };
|
|
51
|
+
component.addChild(new Spacer(1));
|
|
52
|
+
let pieces = 0;
|
|
53
|
+
for (const segment of view.segments) {
|
|
54
|
+
// Only compiler separator/marker chunks drive spacing; whitespace bodies remain Markdown.
|
|
55
|
+
if (segment.kind === "separator" || (segment.kind === "marker" && /^\n+$/u.test(segment.text)))
|
|
56
|
+
continue;
|
|
57
|
+
if (pieces++)
|
|
58
|
+
component.addChild(new Spacer(1));
|
|
59
|
+
const text = stripTerminalSequences(segment.text).replaceAll(/\r\n|\r/gu, "\n");
|
|
60
|
+
component.addChild(segment.kind === "body"
|
|
61
|
+
? new Markdown(text, outputPad, 0, markdownTheme, { color: value => theme.fg("customMessageText", value) })
|
|
62
|
+
: new Text(theme.fg("muted", text), outputPad, 0));
|
|
63
|
+
}
|
|
64
|
+
component.addChild(new Spacer(1));
|
|
65
|
+
component.addChild(new Text(theme.fg("muted", "Expand message for technical details."), outputPad, 0));
|
|
66
|
+
component.addChild(new Spacer(1));
|
|
67
|
+
return component;
|
|
68
|
+
}
|
|
69
|
+
if (!expanded && view.blocks) {
|
|
70
|
+
const component = new Container(), markdownTheme = { ...Pi.getMarkdownTheme(), codeBlockIndent: "" };
|
|
71
|
+
component.addChild(new Spacer(1));
|
|
72
|
+
for (const [index, [kind, start, end]] of view.blocks.entries()) {
|
|
73
|
+
if (index)
|
|
74
|
+
component.addChild(new Spacer(1));
|
|
75
|
+
let text = stripTerminalSequences(message.content.slice(start, end)).replaceAll(/\r\n|\r/gu, "\n");
|
|
76
|
+
if (kind === "header") {
|
|
77
|
+
// Only validated compiler headers may hide whole reference rows; body lookalikes stay visible.
|
|
78
|
+
text = text.split("\n").filter(line => !line.startsWith("references: ") && !line.startsWith("run_files: ")).join("\n").replace(/\n$/u, "");
|
|
79
|
+
}
|
|
80
|
+
component.addChild(kind === "body"
|
|
81
|
+
? new Markdown(text, outputPad, 0, markdownTheme, { color: value => theme.fg("customMessageText", value) })
|
|
82
|
+
: new Text(theme.fg(kind === "header" || kind === "marker" ? "muted" : "customMessageText", text), outputPad, 0));
|
|
83
|
+
}
|
|
84
|
+
component.addChild(new Spacer(1));
|
|
85
|
+
component.addChild(new Text(theme.fg("muted", "Expand message for technical details."), outputPad, 0));
|
|
86
|
+
component.addChild(new Spacer(1));
|
|
87
|
+
return component;
|
|
88
|
+
}
|
|
89
|
+
const text = expanded ? message.content : view.text;
|
|
90
|
+
const label = view.yaml || (view.records && !view.single) ? "" : theme.fg("customMessageLabel", view.single ? "Run result" : "Run Batch") + "\n\n";
|
|
91
|
+
return new Text(label + theme.fg("customMessageText", stripTerminalSequences(text).replaceAll(/\r\n|\r/gu, "\n"))
|
|
92
|
+
+ (!expanded && view.compact ? "\n\n" + theme.fg("muted", "Expand message for technical details.") : ""), outputPad, 1);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
13
95
|
export function createRunUiRuntime(deps) {
|
|
96
|
+
if (deps.captureCompletionBatch && deps.completionStreamSessionAdmission)
|
|
97
|
+
throw new Error("Candidate completion capture cannot use completion streams");
|
|
98
|
+
const fencedCompletionSession = Boolean(deps.captureCompletionBatch || deps.completionStreamSessionAdmission);
|
|
14
99
|
let activeContext;
|
|
15
100
|
let activeOwnerId;
|
|
101
|
+
let sessionTicket;
|
|
102
|
+
let sessionManager;
|
|
103
|
+
let streamSessionAdmitted = false;
|
|
104
|
+
const contextTickets = new WeakMap();
|
|
105
|
+
const seenManagers = new WeakSet();
|
|
16
106
|
let animationInterval;
|
|
107
|
+
let displayRunningSubagents = 0;
|
|
108
|
+
let displayFrame = 0;
|
|
17
109
|
let deliveryTimeout;
|
|
18
110
|
let notifyTimeout;
|
|
19
111
|
let recoverQueuedSteers = false;
|
|
@@ -26,6 +118,11 @@ export function createRunUiRuntime(deps) {
|
|
|
26
118
|
const completionDiagnostics = new Set();
|
|
27
119
|
const close = () => {
|
|
28
120
|
running = false;
|
|
121
|
+
displayRunningSubagents = 0;
|
|
122
|
+
displayFrame = 0;
|
|
123
|
+
sessionTicket = undefined;
|
|
124
|
+
sessionManager = undefined;
|
|
125
|
+
streamSessionAdmitted = false;
|
|
29
126
|
activeContext = undefined;
|
|
30
127
|
activeOwnerId = undefined;
|
|
31
128
|
try {
|
|
@@ -65,14 +162,15 @@ export function createRunUiRuntime(deps) {
|
|
|
65
162
|
}
|
|
66
163
|
const message = error instanceof Error ? error.message : String(error);
|
|
67
164
|
try {
|
|
68
|
-
expectedContext.ui.notify(
|
|
165
|
+
expectedContext.ui.notify([formatMarkdownField("callback", label), formatMarkdownField("result", "failed"),
|
|
166
|
+
formatMarkdownField("diagnostic", message)].join("\n"), "error");
|
|
69
167
|
}
|
|
70
168
|
catch {
|
|
71
169
|
/* stale context or unavailable UI */
|
|
72
170
|
}
|
|
73
171
|
};
|
|
74
|
-
const runActiveCallback = (label, callback) => {
|
|
75
|
-
if (!running || !activeContext || !activeOwnerId)
|
|
172
|
+
const runActiveCallback = (label, callback, expectedTicket) => {
|
|
173
|
+
if (expectedTicket !== sessionTicket || !running || !activeContext || !activeOwnerId)
|
|
76
174
|
return;
|
|
77
175
|
const ctx = activeContext;
|
|
78
176
|
try {
|
|
@@ -81,7 +179,8 @@ export function createRunUiRuntime(deps) {
|
|
|
81
179
|
callback(ctx, activeOwnerId);
|
|
82
180
|
}
|
|
83
181
|
catch (error) {
|
|
84
|
-
|
|
182
|
+
if (expectedTicket === sessionTicket)
|
|
183
|
+
stopAfterCallbackFailure(label, error, ctx);
|
|
85
184
|
}
|
|
86
185
|
};
|
|
87
186
|
const retireCandidateRuns = (ctx, summary) => {
|
|
@@ -126,17 +225,6 @@ export function createRunUiRuntime(deps) {
|
|
|
126
225
|
finishPresentedSteer(ownerId, steer);
|
|
127
226
|
}
|
|
128
227
|
};
|
|
129
|
-
const boundedSteerContent = (event) => {
|
|
130
|
-
const text = Observability.formatRunAttentionMessage(event);
|
|
131
|
-
if (Buffer.byteLength(text, "utf8") <= Limits.RUN_DELIVERY_STEER_MAX_BYTES) {
|
|
132
|
-
return text;
|
|
133
|
-
}
|
|
134
|
-
let end = Math.min(text.length, Limits.RUN_DELIVERY_STEER_MAX_BYTES - 3);
|
|
135
|
-
while (end > 0 && Buffer.byteLength(text.slice(0, end), "utf8") >
|
|
136
|
-
Limits.RUN_DELIVERY_STEER_MAX_BYTES - 3)
|
|
137
|
-
end -= 1;
|
|
138
|
-
return `${text.slice(0, end)}…`;
|
|
139
|
-
};
|
|
140
228
|
const admitSteerEvents = (ctx, ownerId, events) => {
|
|
141
229
|
for (const event of events.filter(Observability.isRunSteerAttentionEvent)) {
|
|
142
230
|
if (!event.runInstanceId) {
|
|
@@ -144,13 +232,16 @@ export function createRunUiRuntime(deps) {
|
|
|
144
232
|
const key = `${event.stateDir}:${event.id}:missing_generation`;
|
|
145
233
|
if (!steerDiagnostics.has(key)) {
|
|
146
234
|
steerDiagnostics.add(key);
|
|
147
|
-
ctx.ui.notify(
|
|
235
|
+
ctx.ui.notify(formatSteerDiagnosticMessage(event.id, "admission", "Run generation unavailable."), "warning");
|
|
148
236
|
}
|
|
149
237
|
continue;
|
|
150
238
|
}
|
|
151
239
|
try {
|
|
240
|
+
if (journal(ownerId).steers.some(steer => steer.run === event.run && steer.state_dir === event.stateDir &&
|
|
241
|
+
steer.run_instance_id === event.runInstanceId && steer.event_id === event.id))
|
|
242
|
+
continue;
|
|
152
243
|
RunDelivery.admitRunSteerEnvelope({
|
|
153
|
-
content:
|
|
244
|
+
content: Observability.formatRunSteerMessage(event),
|
|
154
245
|
eventId: event.id,
|
|
155
246
|
kind: event.kind,
|
|
156
247
|
level: event.level,
|
|
@@ -168,20 +259,44 @@ export function createRunUiRuntime(deps) {
|
|
|
168
259
|
const key = `${event.stateDir}:${event.id}:${message}`;
|
|
169
260
|
if (!steerDiagnostics.has(key)) {
|
|
170
261
|
steerDiagnostics.add(key);
|
|
171
|
-
ctx.ui.notify(
|
|
262
|
+
ctx.ui.notify(formatSteerDiagnosticMessage(event.id, "admission", message), "warning");
|
|
172
263
|
}
|
|
173
264
|
}
|
|
174
265
|
}
|
|
175
266
|
};
|
|
176
|
-
const admitCompletionTransitions = (ownerId, snapshot) => {
|
|
267
|
+
const admitCompletionTransitions = (ctx, ownerId, snapshot) => {
|
|
177
268
|
const existing = journal(ownerId).completion_batch;
|
|
178
269
|
if (existing)
|
|
179
270
|
return true;
|
|
180
271
|
const members = Observability.collectRunCompletionBatchMembers(snapshot.transitions, snapshot.summary.runs).slice(0, Limits.RUN_DELIVERY_BATCH_MAX_MEMBERS);
|
|
181
|
-
if (members.length === 0)
|
|
272
|
+
if (members.length === 0 || !isCurrentOwner(ctx))
|
|
182
273
|
return false;
|
|
183
|
-
|
|
274
|
+
const fileNavigation = [];
|
|
275
|
+
for (const member of RunDelivery.orderRunCompletionMembers(members, true)) {
|
|
276
|
+
let locations;
|
|
277
|
+
try {
|
|
278
|
+
const observed = snapshot.summary.runs.find(run => run.run === member.run && run.runInstanceId === member.run_instance_id && run.stateDir === member.state_dir);
|
|
279
|
+
locations = !observed ? Object.freeze({ state: "unavailable", reason: "identity_unavailable" })
|
|
280
|
+
: observed.ownerId !== ownerId ? Object.freeze({ state: "unavailable", reason: "session_mismatch" })
|
|
281
|
+
: RunIndex.readRunDirectoryNavigation(member.state_dir, { run: member.run, run_instance_id: member.run_instance_id, ownerId: observed.ownerId }, Pi.getSessionId(ctx));
|
|
282
|
+
}
|
|
283
|
+
catch {
|
|
284
|
+
locations = Object.freeze({ state: "unavailable", reason: "navigation_unavailable" });
|
|
285
|
+
}
|
|
286
|
+
fileNavigation.push({ member_index: members.indexOf(member), locations });
|
|
287
|
+
if (Buffer.byteLength(JSON.stringify(fileNavigation), "utf8") > Limits.RUN_DELIVERY_MODEL_MAX_BYTES) {
|
|
288
|
+
fileNavigation.pop();
|
|
289
|
+
break;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
if (!isCurrentOwner(ctx))
|
|
293
|
+
return false;
|
|
294
|
+
if (!canUseCompletionSession(ctx, ownerId))
|
|
295
|
+
return false;
|
|
296
|
+
const capture = deps.completionStreamSessionAdmission ? RunDelivery.captureRunCompletionStreamBatch : deps.captureCompletionBatch ?? RunDelivery.admitRunCompletionBatch;
|
|
297
|
+
capture({
|
|
184
298
|
members,
|
|
299
|
+
fileNavigation,
|
|
185
300
|
ownerId,
|
|
186
301
|
tempDir: Paths.EXTENSION_RUNTIME_PATHS.tempDir,
|
|
187
302
|
});
|
|
@@ -212,32 +327,64 @@ export function createRunUiRuntime(deps) {
|
|
|
212
327
|
const key = `${batch.batch_id}:${evidence.status}:${evidence.reason ?? ""}`;
|
|
213
328
|
if (!completionDiagnostics.has(key)) {
|
|
214
329
|
completionDiagnostics.add(key);
|
|
215
|
-
ctx.ui.notify(
|
|
330
|
+
ctx.ui.notify("\n" + [formatMarkdownField("batch", batch.batch_id), formatMarkdownField("stage", "completion recovery"),
|
|
331
|
+
formatMarkdownField("evidence", evidence.status), formatMarkdownField("phase", "pending"),
|
|
332
|
+
formatMarkdownField("reason", evidence.reason ?? "conflicting session evidence")].join("\n"), "warning");
|
|
216
333
|
}
|
|
217
334
|
return true;
|
|
218
335
|
}
|
|
219
336
|
}
|
|
337
|
+
if (fencedCompletionSession && !canUseCompletionSession(ctx, ownerId))
|
|
338
|
+
return true;
|
|
220
339
|
return !acceptCompletionBatch(ownerId, batch.batch_id);
|
|
221
340
|
};
|
|
222
|
-
const pendingCompletionBatch = (ownerId) => {
|
|
341
|
+
const pendingCompletionBatch = (ctx, ownerId) => {
|
|
223
342
|
const existing = journal(ownerId).completion_batch;
|
|
224
343
|
if (existing)
|
|
225
344
|
return existing;
|
|
226
345
|
const snapshot = Observability.readRunDeliverySnapshot(deliveryObservation, ownerId);
|
|
227
|
-
admitCompletionTransitions(ownerId, snapshot);
|
|
346
|
+
admitCompletionTransitions(ctx, ownerId, snapshot);
|
|
228
347
|
Observability.pruneRunUiObservationState(deliveryObservation, snapshot);
|
|
229
348
|
return journal(ownerId).completion_batch;
|
|
230
349
|
};
|
|
231
350
|
const isCurrentOwner = (ctx) => {
|
|
232
351
|
if (!running || !activeOwnerId)
|
|
233
352
|
return false;
|
|
353
|
+
if (!fencedCompletionSession) {
|
|
354
|
+
try {
|
|
355
|
+
return Pi.getSessionId(ctx) === activeOwnerId;
|
|
356
|
+
}
|
|
357
|
+
catch {
|
|
358
|
+
return false;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
const ticket = sessionTicket, ownerId = activeOwnerId, known = contextTickets.get(ctx);
|
|
362
|
+
if (!ticket || (known && known !== ticket))
|
|
363
|
+
return false;
|
|
234
364
|
try {
|
|
235
|
-
|
|
365
|
+
if (deps.getActiveContext() !== activeContext)
|
|
366
|
+
return false;
|
|
367
|
+
const manager = ctx.sessionManager;
|
|
368
|
+
if (manager !== sessionManager || manager.getSessionId() !== ownerId || ticket !== sessionTicket || !running)
|
|
369
|
+
return false;
|
|
370
|
+
contextTickets.set(ctx, ticket);
|
|
371
|
+
return true;
|
|
236
372
|
}
|
|
237
373
|
catch {
|
|
238
374
|
return false;
|
|
239
375
|
}
|
|
240
376
|
};
|
|
377
|
+
const canUseCompletionSession = (ctx, ownerId) => {
|
|
378
|
+
if (deps.captureCompletionBatch && !isCurrentOwner(ctx))
|
|
379
|
+
return false;
|
|
380
|
+
if (!deps.completionStreamSessionAdmission)
|
|
381
|
+
return !journal(ownerId).completion_stream;
|
|
382
|
+
if (!isCurrentOwner(ctx))
|
|
383
|
+
return false;
|
|
384
|
+
const ticket = sessionTicket, state = journal(ownerId).completion_stream;
|
|
385
|
+
// No metadata is not disconnected. The opt-in path never bootstraps or falls back to local indices.
|
|
386
|
+
return streamSessionAdmitted && Boolean(state) && ticket === sessionTicket && isCurrentOwner(ctx);
|
|
387
|
+
};
|
|
241
388
|
const isIdle = (ctx) => typeof ctx.isIdle !== "function" || ctx.isIdle();
|
|
242
389
|
const isDeliveryRoot = (ownerId) => {
|
|
243
390
|
const inheritedOwner = RunDeliveryLineage.getProcessDeliveryOwnerId();
|
|
@@ -266,7 +413,9 @@ export function createRunUiRuntime(deps) {
|
|
|
266
413
|
const key = `${steer.steer_id}:${evidence.status}:${evidence.reason ?? ""}`;
|
|
267
414
|
if (!steerDiagnostics.has(key)) {
|
|
268
415
|
steerDiagnostics.add(key);
|
|
269
|
-
ctx.ui.notify(
|
|
416
|
+
ctx.ui.notify([formatMarkdownField("event", steer.event_id), formatMarkdownField("attention", "steer"),
|
|
417
|
+
formatMarkdownField("stage", "recovery"), formatMarkdownField("evidence", evidence.status),
|
|
418
|
+
formatMarkdownField("phase", "queued"), formatMarkdownField("reason", evidence.reason ?? "conflicting session evidence")].join("\n"), "warning");
|
|
270
419
|
}
|
|
271
420
|
continue;
|
|
272
421
|
}
|
|
@@ -295,7 +444,7 @@ export function createRunUiRuntime(deps) {
|
|
|
295
444
|
tempDir: Paths.EXTENSION_RUNTIME_PATHS.tempDir,
|
|
296
445
|
});
|
|
297
446
|
const message = error instanceof Error ? error.message : String(error);
|
|
298
|
-
ctx.ui.notify(
|
|
447
|
+
ctx.ui.notify(formatSteerDiagnosticMessage(steer.event_id, "delivery", message), "error");
|
|
299
448
|
continue;
|
|
300
449
|
}
|
|
301
450
|
RunDelivery.markRunSteerQueued({
|
|
@@ -310,28 +459,45 @@ export function createRunUiRuntime(deps) {
|
|
|
310
459
|
const scheduleCompletionFlush = () => {
|
|
311
460
|
if (!running)
|
|
312
461
|
return;
|
|
462
|
+
const ticket = sessionTicket;
|
|
313
463
|
if (deliveryTimeout)
|
|
314
464
|
clearTimeout(deliveryTimeout);
|
|
315
465
|
deliveryTimeout = setTimeout(() => {
|
|
466
|
+
if (ticket !== sessionTicket)
|
|
467
|
+
return;
|
|
316
468
|
deliveryTimeout = undefined;
|
|
317
469
|
runActiveCallback("completion delivery callback", (ctx) => {
|
|
318
470
|
flushCompletionBatch(ctx);
|
|
319
|
-
});
|
|
471
|
+
}, ticket);
|
|
320
472
|
}, deps.deliveryDebounceMs ?? 100);
|
|
321
473
|
deliveryTimeout.unref?.();
|
|
322
474
|
};
|
|
323
475
|
const update = (ctx, ownerId, notify = false, terminalOnly = false) => {
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
476
|
+
// Derive both projections before any UI/retirement callback. The subsequent
|
|
477
|
+
// flush still observes afresh; these facts only drive display/candidate scheduling.
|
|
478
|
+
const ticket = sessionTicket;
|
|
479
|
+
const pair = notify && isDeliveryRoot(ownerId)
|
|
480
|
+
? Observability.readRunUiAndDeliverySnapshots(observation, deliveryObservation, ownerId)
|
|
481
|
+
: undefined;
|
|
482
|
+
const snapshot = pair?.ui ?? Observability.readRunUiSnapshot(observation, ownerId);
|
|
483
|
+
if (ticket !== sessionTicket || (fencedCompletionSession && !isCurrentOwner(ctx)))
|
|
484
|
+
return false;
|
|
485
|
+
// Animation retains display data only; all admission paths continue observing independently.
|
|
486
|
+
displayRunningSubagents = snapshot.summary.runningSubagents;
|
|
487
|
+
displayFrame = 0;
|
|
488
|
+
const status = snapshot.status && ctx.mode === "tui" ? ctx.ui.theme.fg("dim", snapshot.status) : snapshot.status;
|
|
489
|
+
if (ticket !== sessionTicket)
|
|
490
|
+
return false;
|
|
491
|
+
ctx.ui.setStatus("zz-pi-actors-runs", status);
|
|
492
|
+
if (ticket !== sessionTicket)
|
|
493
|
+
return false;
|
|
494
|
+
if (!notify || (fencedCompletionSession && !isCurrentOwner(ctx)))
|
|
327
495
|
return false;
|
|
328
496
|
const sink = Pi.createNotificationSink(deps.pi, ctx);
|
|
329
497
|
retireCandidateRuns(ctx, snapshot.summary);
|
|
330
|
-
const deliverySnapshot =
|
|
331
|
-
? Observability.readRunDeliverySnapshot(deliveryObservation, ownerId)
|
|
332
|
-
: undefined;
|
|
498
|
+
const deliverySnapshot = pair?.delivery;
|
|
333
499
|
const hasCompletionCandidates = deliverySnapshot
|
|
334
|
-
? Observability.
|
|
500
|
+
? Observability.hasRunCompletionBatchMembers(deliverySnapshot.transitions, deliverySnapshot.summary.runs)
|
|
335
501
|
: false;
|
|
336
502
|
const hasCompletionBatch = isDeliveryRoot(ownerId) &&
|
|
337
503
|
Boolean(journal(ownerId).completion_batch);
|
|
@@ -357,30 +523,35 @@ export function createRunUiRuntime(deps) {
|
|
|
357
523
|
ctx.ui.notify(diagnostic.message, diagnostic.code === "rearmed" ? "info" : "warning");
|
|
358
524
|
}
|
|
359
525
|
};
|
|
360
|
-
const scheduleUpdate = () => {
|
|
361
|
-
if (!running)
|
|
526
|
+
const scheduleUpdate = (ticket) => {
|
|
527
|
+
if (ticket !== sessionTicket || !running)
|
|
362
528
|
return;
|
|
363
529
|
if (notifyTimeout)
|
|
364
530
|
clearTimeout(notifyTimeout);
|
|
365
531
|
notifyTimeout = setTimeout(() => {
|
|
532
|
+
if (ticket !== sessionTicket)
|
|
533
|
+
return;
|
|
366
534
|
runActiveCallback("Run watcher callback", (ctx, ownerId) => {
|
|
367
535
|
watcher.refresh();
|
|
368
536
|
const completionDeferred = update(ctx, ownerId, true);
|
|
537
|
+
if (ticket !== sessionTicket)
|
|
538
|
+
return;
|
|
369
539
|
if (!completionDeferred)
|
|
370
540
|
deps.onRunEvent();
|
|
371
|
-
|
|
372
|
-
|
|
541
|
+
if (ticket === sessionTicket)
|
|
542
|
+
reportDiagnostics(ctx);
|
|
543
|
+
}, ticket);
|
|
373
544
|
}, deps.notificationDelayMs ?? 50);
|
|
374
545
|
notifyTimeout.unref?.();
|
|
375
546
|
};
|
|
376
|
-
const
|
|
547
|
+
const createWatcher = (ticket) => (deps.createRunStateWatcher ?? Observability.createRunStateWatcher)({
|
|
377
548
|
stateRoot: Paths.EXTENSION_RUNTIME_PATHS.runStateRoot,
|
|
378
|
-
onChange: scheduleUpdate,
|
|
549
|
+
onChange: () => scheduleUpdate(ticket),
|
|
379
550
|
});
|
|
380
|
-
const
|
|
551
|
+
const createReconciliation = (ticket) => (deps.createRunTerminalReconciliationLoop ??
|
|
381
552
|
Observability.createRunTerminalReconciliationLoop)({
|
|
382
553
|
onError: (error) => {
|
|
383
|
-
if (!running || !activeContext)
|
|
554
|
+
if (ticket !== sessionTicket || !running || !activeContext)
|
|
384
555
|
return;
|
|
385
556
|
stopAfterCallbackFailure("terminal reconciliation callback", error, activeContext);
|
|
386
557
|
},
|
|
@@ -388,13 +559,15 @@ export function createRunUiRuntime(deps) {
|
|
|
388
559
|
runActiveCallback("terminal reconciliation callback", (ctx, ownerId) => {
|
|
389
560
|
update(ctx, ownerId, true);
|
|
390
561
|
reportDiagnostics(ctx);
|
|
391
|
-
});
|
|
562
|
+
}, ticket);
|
|
392
563
|
},
|
|
393
564
|
refreshWatcher: () => {
|
|
394
|
-
if (running)
|
|
565
|
+
if (ticket === sessionTicket && running)
|
|
395
566
|
watcher.refresh();
|
|
396
567
|
},
|
|
397
568
|
});
|
|
569
|
+
let watcher = createWatcher(undefined);
|
|
570
|
+
let reconciliation = createReconciliation(undefined);
|
|
398
571
|
flushCompletionBatch = (ctx) => {
|
|
399
572
|
const ownerId = activeOwnerId;
|
|
400
573
|
if (!ownerId || !isCurrentOwner(ctx))
|
|
@@ -403,20 +576,24 @@ export function createRunUiRuntime(deps) {
|
|
|
403
576
|
return true;
|
|
404
577
|
if (!isDeliveryRoot(ownerId))
|
|
405
578
|
return false;
|
|
579
|
+
if (!canUseCompletionSession(ctx, ownerId))
|
|
580
|
+
return true;
|
|
406
581
|
if (reconcileCompletionBatch(ctx, ownerId))
|
|
407
582
|
return true;
|
|
408
|
-
const batch = pendingCompletionBatch(ownerId);
|
|
583
|
+
const batch = pendingCompletionBatch(ctx, ownerId);
|
|
409
584
|
if (!batch)
|
|
410
585
|
return false;
|
|
411
586
|
if (!isIdle(ctx))
|
|
412
587
|
return true;
|
|
413
|
-
const
|
|
414
|
-
if (!isIdle(ctx))
|
|
588
|
+
const projected = RunDelivery.projectRunCompletionBatchPresentation(batch);
|
|
589
|
+
if (!isIdle(ctx) || !isCurrentOwner(ctx))
|
|
415
590
|
return true;
|
|
416
591
|
try {
|
|
417
|
-
Pi.sendRunCompletionBatch(deps.pi, batch.batch_id, content);
|
|
592
|
+
Pi.sendRunCompletionBatch(deps.pi, batch.batch_id, projected.content, projected.presentation);
|
|
418
593
|
}
|
|
419
594
|
catch (error) {
|
|
595
|
+
if (fencedCompletionSession && !isCurrentOwner(ctx))
|
|
596
|
+
throw error;
|
|
420
597
|
RunDelivery.recordRunCompletionBatchDeliveryFailure({
|
|
421
598
|
batchId: batch.batch_id,
|
|
422
599
|
error,
|
|
@@ -425,14 +602,16 @@ export function createRunUiRuntime(deps) {
|
|
|
425
602
|
});
|
|
426
603
|
throw error;
|
|
427
604
|
}
|
|
605
|
+
if (fencedCompletionSession && !canUseCompletionSession(ctx, ownerId))
|
|
606
|
+
return true;
|
|
428
607
|
if (!acceptCompletionBatch(ownerId, batch.batch_id)) {
|
|
429
608
|
throw new Error("Completion batch changed before durable acceptance");
|
|
430
609
|
}
|
|
431
|
-
ctx.ui.notify(`Actor completions ready: ${batch.members.length}`, "info");
|
|
432
610
|
return true;
|
|
433
611
|
};
|
|
434
612
|
return {
|
|
435
613
|
close,
|
|
614
|
+
isCurrentSessionContext: isCurrentOwner,
|
|
436
615
|
flushCompletionBatch,
|
|
437
616
|
onTurnEnd(event, ctx) {
|
|
438
617
|
const ownerId = activeOwnerId;
|
|
@@ -440,12 +619,15 @@ export function createRunUiRuntime(deps) {
|
|
|
440
619
|
event.outcome !== "completed" || isIdle(ctx) || ctx.signal?.aborted ||
|
|
441
620
|
ctx.hasPendingMessages?.() || event.context.pendingMessages.length > 0)
|
|
442
621
|
return undefined;
|
|
443
|
-
if (flushSteers(ctx, ownerId) || reconcileCompletionBatch(ctx, ownerId))
|
|
622
|
+
if (flushSteers(ctx, ownerId) || !canUseCompletionSession(ctx, ownerId) || reconcileCompletionBatch(ctx, ownerId))
|
|
444
623
|
return undefined;
|
|
445
|
-
const batch = pendingCompletionBatch(ownerId);
|
|
446
|
-
if (!batch)
|
|
624
|
+
const batch = pendingCompletionBatch(ctx, ownerId);
|
|
625
|
+
if (!batch || !isCurrentOwner(ctx))
|
|
626
|
+
return undefined;
|
|
627
|
+
const projected = RunDelivery.projectRunCompletionBatchPresentation(batch);
|
|
628
|
+
const entry = Pi.createRunCompletionBatchEntry(batch.batch_id, projected.content, projected.presentation);
|
|
629
|
+
if (!canUseCompletionSession(ctx, ownerId))
|
|
447
630
|
return undefined;
|
|
448
|
-
const entry = Pi.createRunCompletionBatchEntry(batch.batch_id, RunDelivery.formatRunCompletionBatchMessage(batch));
|
|
449
631
|
return { entries: [...event.entries, entry], continue: true };
|
|
450
632
|
},
|
|
451
633
|
projectContext(messages, ctx) {
|
|
@@ -478,6 +660,8 @@ export function createRunUiRuntime(deps) {
|
|
|
478
660
|
if (durable)
|
|
479
661
|
finishPresentedSteer(ownerId, durable);
|
|
480
662
|
}
|
|
663
|
+
if (!canUseCompletionSession(ctx, ownerId))
|
|
664
|
+
return contextMessages;
|
|
481
665
|
const projected = Pi.dedupeRunCompletionBatchContext(contextMessages);
|
|
482
666
|
const batch = journal(ownerId).completion_batch;
|
|
483
667
|
if (!batch)
|
|
@@ -486,7 +670,8 @@ export function createRunUiRuntime(deps) {
|
|
|
486
670
|
if (content !== RunDelivery.formatRunCompletionBatchMessage(batch)) {
|
|
487
671
|
return Pi.removeRunCompletionBatchFromContext(projected.messages, batch.batch_id);
|
|
488
672
|
}
|
|
489
|
-
|
|
673
|
+
if (!fencedCompletionSession || canUseCompletionSession(ctx, ownerId))
|
|
674
|
+
acceptCompletionBatch(ownerId, batch.batch_id);
|
|
490
675
|
return projected.messages;
|
|
491
676
|
},
|
|
492
677
|
shutdown(eventReason, ownerId, ctx) {
|
|
@@ -496,27 +681,65 @@ export function createRunUiRuntime(deps) {
|
|
|
496
681
|
if (teardown.failed === 0 || !ctx)
|
|
497
682
|
return;
|
|
498
683
|
try {
|
|
499
|
-
ctx.ui.notify(
|
|
684
|
+
ctx.ui.notify([formatMarkdownField("stage", "shutdown teardown"), formatMarkdownField("killed", String(teardown.killed)),
|
|
685
|
+
formatMarkdownField("failed", String(teardown.failed)), formatMarkdownField("skipped", String(teardown.skipped)),
|
|
686
|
+
formatMarkdownField("discovery_failed", String(teardown.discoveryFailed)),
|
|
687
|
+
formatMarkdownField("summary", teardown.summaryPath == null ? "unavailable" : formatLiteralBlock(teardown.summaryPath)),
|
|
688
|
+
formatMarkdownField("basis", "teardown report; not scope closure")].join("\n"), "warning");
|
|
500
689
|
}
|
|
501
690
|
catch {
|
|
502
691
|
/* stale shutdown context */
|
|
503
692
|
}
|
|
504
693
|
},
|
|
505
|
-
start(ctx, ownerId) {
|
|
694
|
+
start(ctx, ownerId, event) {
|
|
506
695
|
close();
|
|
696
|
+
const ticket = {};
|
|
697
|
+
sessionTicket = ticket;
|
|
507
698
|
activeContext = ctx;
|
|
508
699
|
activeOwnerId = ownerId;
|
|
509
700
|
recoverQueuedSteers = true;
|
|
510
701
|
running = true;
|
|
511
702
|
try {
|
|
512
|
-
|
|
703
|
+
if (fencedCompletionSession) {
|
|
704
|
+
sessionManager = ctx.sessionManager;
|
|
705
|
+
const fresh = !seenManagers.has(sessionManager) && !contextTickets.has(ctx);
|
|
706
|
+
seenManagers.add(sessionManager);
|
|
707
|
+
if (!contextTickets.has(ctx))
|
|
708
|
+
contextTickets.set(ctx, ticket);
|
|
709
|
+
if (deps.captureCompletionBatch && !fresh)
|
|
710
|
+
sessionManager = undefined;
|
|
711
|
+
if (deps.completionStreamSessionAdmission && fresh && event && (event.reason === "new" || event.reason === "fork") && isCurrentOwner(ctx)) {
|
|
712
|
+
const admitted = deps.completionStreamSessionAdmission(ctx, event) === true && isCurrentOwner(ctx);
|
|
713
|
+
if (ticket !== sessionTicket)
|
|
714
|
+
return;
|
|
715
|
+
streamSessionAdmitted = admitted;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
if (ticket !== sessionTicket)
|
|
719
|
+
return;
|
|
720
|
+
watcher = createWatcher(ticket);
|
|
721
|
+
reconciliation = createReconciliation(ticket);
|
|
722
|
+
if (canUseCompletionSession(ctx, ownerId))
|
|
723
|
+
recoverPresentedBatch(ownerId);
|
|
513
724
|
recoverPresentedSteers(ownerId);
|
|
514
725
|
Observability.primeRunAttentionState(observation, ownerId);
|
|
515
726
|
update(ctx, ownerId, true, true);
|
|
727
|
+
if (ticket !== sessionTicket)
|
|
728
|
+
return;
|
|
516
729
|
watcher.refresh();
|
|
730
|
+
if (ticket !== sessionTicket)
|
|
731
|
+
return;
|
|
517
732
|
reconciliation.start();
|
|
733
|
+
if (ticket !== sessionTicket || ctx.mode !== "tui")
|
|
734
|
+
return;
|
|
518
735
|
animationInterval = setInterval(() => {
|
|
519
|
-
runActiveCallback("status animation callback", (current
|
|
736
|
+
runActiveCallback("status animation callback", (current) => {
|
|
737
|
+
const status = Observability.renderSubagentStatus(displayRunningSubagents, ++displayFrame);
|
|
738
|
+
const themed = status ? current.ui.theme.fg("dim", status) : status;
|
|
739
|
+
if (ticket !== sessionTicket)
|
|
740
|
+
return;
|
|
741
|
+
current.ui.setStatus("zz-pi-actors-runs", themed);
|
|
742
|
+
}, ticket);
|
|
520
743
|
}, deps.animationIntervalMs ?? 1000);
|
|
521
744
|
animationInterval.unref?.();
|
|
522
745
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Async run artifact declarations and manifest resolution.
|
|
3
|
-
* Owns: artifact path
|
|
3
|
+
* Owns: artifact path expansion, captured-reference validation, body-free metadata observation and explicit hashing.
|
|
4
|
+
* Excludes: generation admission, export publication, directory scans and production/immutable-content proof.
|
|
4
5
|
*/
|
|
5
6
|
export type RunArtifactDeclaration = string | {
|
|
6
7
|
path: string;
|
|
@@ -17,5 +18,29 @@ export interface RunArtifactManifestEntry {
|
|
|
17
18
|
sha256?: string;
|
|
18
19
|
size?: number;
|
|
19
20
|
}
|
|
21
|
+
export interface RunArtifactReference {
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly path: string;
|
|
24
|
+
readonly kind?: string;
|
|
25
|
+
readonly media_type?: string;
|
|
26
|
+
readonly required?: boolean;
|
|
27
|
+
}
|
|
28
|
+
export type RunArtifactReferencesReading = {
|
|
29
|
+
readonly state: "available";
|
|
30
|
+
readonly references: readonly Readonly<RunArtifactReference>[];
|
|
31
|
+
} | {
|
|
32
|
+
readonly state: "unavailable";
|
|
33
|
+
readonly reason: "artifact_declarations_invalid" | "artifact_base_unavailable";
|
|
34
|
+
};
|
|
35
|
+
export type RunArtifactObservation = Readonly<RunArtifactReference & {
|
|
36
|
+
availability: "available" | "missing" | "unavailable";
|
|
37
|
+
bytes_total?: number;
|
|
38
|
+
modified_at?: string;
|
|
39
|
+
reason?: "artifact_not_regular" | "artifact_changed" | "artifact_unreadable" | "artifact_size_unavailable";
|
|
40
|
+
}>;
|
|
41
|
+
/** Captured paths only: no placeholder/environment expansion, directory discovery or fallback to this process's cwd. */
|
|
42
|
+
export declare function describeRunArtifactReferences(artifacts: unknown, cwd: unknown): RunArtifactReferencesReading;
|
|
43
|
+
/** Readability/stat evidence only. A declared file need not have been created by this Run and is never hashed here. */
|
|
44
|
+
export declare function observeRunArtifactReference(reference: Readonly<RunArtifactReference>): RunArtifactObservation;
|
|
20
45
|
export declare function resolveArtifactPaths(artifacts: Record<string, RunArtifactDeclaration> | undefined, values: Record<string, unknown>): Record<string, RunArtifactDeclaration> | undefined;
|
|
21
46
|
export declare function resolveArtifactManifest(artifacts: Record<string, RunArtifactDeclaration> | undefined): Record<string, RunArtifactManifestEntry> | undefined;
|