@llblab/pi-kit 0.38.4 → 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 +5 -0
- package/README.md +1 -1
- 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/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 +2 -2
- 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,9 +1,11 @@
|
|
|
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
6
|
|
|
7
|
+
import { Container, Markdown, Spacer, Text, stripTerminalSequences } from "@earendil-works/pi-tui";
|
|
8
|
+
|
|
7
9
|
import * as AsyncRuns from "./async-runs.ts";
|
|
8
10
|
import * as Limits from "./limits.ts";
|
|
9
11
|
import * as Observability from "./observability.ts";
|
|
@@ -11,9 +13,12 @@ import * as Paths from "./paths.ts";
|
|
|
11
13
|
import * as Pi from "./pi.ts";
|
|
12
14
|
import * as RunDelivery from "./run-delivery.ts";
|
|
13
15
|
import * as RunDeliveryLineage from "./run-delivery-lineage.ts";
|
|
16
|
+
import * as RunIndex from "./runs-index.ts";
|
|
17
|
+
import { formatLiteralBlock, formatMarkdownField } from "./tools-response.ts";
|
|
14
18
|
|
|
15
19
|
export interface RunUiRuntime {
|
|
16
20
|
close(): void;
|
|
21
|
+
isCurrentSessionContext(ctx: Pi.ExtensionContext): boolean;
|
|
17
22
|
flushCompletionBatch(ctx: Pi.ExtensionContext): boolean;
|
|
18
23
|
onTurnEnd(event: Pi.TurnEndEvent, ctx: Pi.ExtensionContext): Pi.TurnEndEventResult | undefined;
|
|
19
24
|
projectContext(messages: unknown[], ctx: Pi.ExtensionContext): unknown[];
|
|
@@ -22,10 +27,13 @@ export interface RunUiRuntime {
|
|
|
22
27
|
ownerId: string | undefined,
|
|
23
28
|
ctx?: Pi.ExtensionContext,
|
|
24
29
|
): void;
|
|
25
|
-
start(ctx: Pi.ExtensionContext, ownerId: string): void;
|
|
30
|
+
start(ctx: Pi.ExtensionContext, ownerId: string, event?: Pi.SessionStartEvent): void;
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
export interface RunUiRuntimeDeps {
|
|
34
|
+
/** Trusted kernel opt-in for verified fresh creation; never actor data, continuity proof or bootstrap. */
|
|
35
|
+
completionStreamSessionAdmission?: (ctx: Pi.ExtensionContext, event: Pi.SessionStartEvent) => boolean;
|
|
36
|
+
captureCompletionBatch?: typeof RunDelivery.admitRunCompletionBatch;
|
|
29
37
|
animationIntervalMs?: number;
|
|
30
38
|
createRunStateWatcher?: typeof Observability.createRunStateWatcher;
|
|
31
39
|
createRunTerminalReconciliationLoop?:
|
|
@@ -39,10 +47,89 @@ export interface RunUiRuntimeDeps {
|
|
|
39
47
|
teardownRunsOwnedByParent?: typeof AsyncRuns.teardownRunsOwnedByParent;
|
|
40
48
|
}
|
|
41
49
|
|
|
50
|
+
function formatSteerDiagnosticMessage(eventId: string, stage: "admission" | "delivery", message: string): string {
|
|
51
|
+
const fields = [formatMarkdownField("event", eventId), formatMarkdownField("attention", "steer"),
|
|
52
|
+
formatMarkdownField("stage", stage), formatMarkdownField("result", stage === "admission" ? "remains retryable" : "request failed")];
|
|
53
|
+
if (stage === "delivery") fields.push(formatMarkdownField("delivery", "unconfirmed"), formatMarkdownField("presentation", "unconfirmed"));
|
|
54
|
+
let end = Math.min(message.length, 240);
|
|
55
|
+
const last = message.charCodeAt(end - 1), next = message.charCodeAt(end);
|
|
56
|
+
if (last >= 0xd800 && last <= 0xdbff && next >= 0xdc00 && next <= 0xdfff) end -= 1;
|
|
57
|
+
const preview = message.slice(0, end), clipped = end < message.length;
|
|
58
|
+
if (Buffer.from(preview).toString("utf8") !== preview) {
|
|
59
|
+
fields.push(formatMarkdownField("diagnostic", "unavailable"), formatMarkdownField("diagnostic_reason", "malformed legacy preview"),
|
|
60
|
+
formatMarkdownField("diagnostic_omission", "[omitted: unknown]"));
|
|
61
|
+
} else {
|
|
62
|
+
fields.push(formatMarkdownField("diagnostic", preview + (clipped ? "…" : "")));
|
|
63
|
+
if (clipped) fields.push(formatMarkdownField("diagnostic_omission", "[omitted: unknown]"));
|
|
64
|
+
}
|
|
65
|
+
return fields.join("\n");
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Transcript-only view of the exact delivered content; never re-read a Run or infer body labels. */
|
|
69
|
+
export function registerRunCompletionRenderer(pi: Pi.ExtensionAPI): void {
|
|
70
|
+
pi.registerMessageRenderer(Pi.RUN_COMPLETION_BATCH_CUSTOM_TYPE, (message, { expanded, outputPad }, theme) => {
|
|
71
|
+
if (typeof message.content !== "string") return undefined;
|
|
72
|
+
let presentation: unknown;
|
|
73
|
+
try { presentation = Object.getOwnPropertyDescriptor(message.details as object, "pi_actors_presentation")?.value; } catch { /* no layout hint */ }
|
|
74
|
+
const view = RunDelivery.readRunCompletionPresentation(message.content, presentation);
|
|
75
|
+
if (!view) return undefined;
|
|
76
|
+
if (!expanded && view.segments) {
|
|
77
|
+
const component = new Container(), markdownTheme = { ...Pi.getMarkdownTheme(), codeBlockIndent: "" };
|
|
78
|
+
component.addChild(new Spacer(1));
|
|
79
|
+
let pieces = 0;
|
|
80
|
+
for (const segment of view.segments) {
|
|
81
|
+
// Only compiler separator/marker chunks drive spacing; whitespace bodies remain Markdown.
|
|
82
|
+
if (segment.kind === "separator" || (segment.kind === "marker" && /^\n+$/u.test(segment.text))) continue;
|
|
83
|
+
if (pieces++) component.addChild(new Spacer(1));
|
|
84
|
+
const text = stripTerminalSequences(segment.text).replaceAll(/\r\n|\r/gu, "\n");
|
|
85
|
+
component.addChild(segment.kind === "body"
|
|
86
|
+
? new Markdown(text, outputPad, 0, markdownTheme, { color: value => theme.fg("customMessageText", value) })
|
|
87
|
+
: new Text(theme.fg("muted", text), outputPad, 0));
|
|
88
|
+
}
|
|
89
|
+
component.addChild(new Spacer(1));
|
|
90
|
+
component.addChild(new Text(theme.fg("muted", "Expand message for technical details."), outputPad, 0));
|
|
91
|
+
component.addChild(new Spacer(1));
|
|
92
|
+
return component;
|
|
93
|
+
}
|
|
94
|
+
if (!expanded && view.blocks) {
|
|
95
|
+
const component = new Container(), markdownTheme = { ...Pi.getMarkdownTheme(), codeBlockIndent: "" };
|
|
96
|
+
component.addChild(new Spacer(1));
|
|
97
|
+
for (const [index, [kind, start, end]] of view.blocks.entries()) {
|
|
98
|
+
if (index) component.addChild(new Spacer(1));
|
|
99
|
+
let text = stripTerminalSequences(message.content.slice(start, end)).replaceAll(/\r\n|\r/gu, "\n");
|
|
100
|
+
if (kind === "header") {
|
|
101
|
+
// Only validated compiler headers may hide whole reference rows; body lookalikes stay visible.
|
|
102
|
+
text = text.split("\n").filter(line => !line.startsWith("references: ") && !line.startsWith("run_files: ")).join("\n").replace(/\n$/u, "");
|
|
103
|
+
}
|
|
104
|
+
component.addChild(kind === "body"
|
|
105
|
+
? new Markdown(text, outputPad, 0, markdownTheme, { color: value => theme.fg("customMessageText", value) })
|
|
106
|
+
: new Text(theme.fg(kind === "header" || kind === "marker" ? "muted" : "customMessageText", text), outputPad, 0));
|
|
107
|
+
}
|
|
108
|
+
component.addChild(new Spacer(1));
|
|
109
|
+
component.addChild(new Text(theme.fg("muted", "Expand message for technical details."), outputPad, 0));
|
|
110
|
+
component.addChild(new Spacer(1));
|
|
111
|
+
return component;
|
|
112
|
+
}
|
|
113
|
+
const text = expanded ? message.content : view.text;
|
|
114
|
+
const label = view.yaml || (view.records && !view.single) ? "" : theme.fg("customMessageLabel", view.single ? "Run result" : "Run Batch") + "\n\n";
|
|
115
|
+
return new Text(label + theme.fg("customMessageText", stripTerminalSequences(text).replaceAll(/\r\n|\r/gu, "\n"))
|
|
116
|
+
+ (!expanded && view.compact ? "\n\n" + theme.fg("muted", "Expand message for technical details.") : ""), outputPad, 1);
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
|
|
42
120
|
export function createRunUiRuntime(deps: RunUiRuntimeDeps): RunUiRuntime {
|
|
121
|
+
if (deps.captureCompletionBatch && deps.completionStreamSessionAdmission) throw new Error("Candidate completion capture cannot use completion streams");
|
|
122
|
+
const fencedCompletionSession = Boolean(deps.captureCompletionBatch || deps.completionStreamSessionAdmission);
|
|
43
123
|
let activeContext: Pi.ExtensionContext | undefined;
|
|
44
124
|
let activeOwnerId: string | undefined;
|
|
125
|
+
let sessionTicket: object | undefined;
|
|
126
|
+
let sessionManager: Pi.ExtensionContext["sessionManager"] | undefined;
|
|
127
|
+
let streamSessionAdmitted = false;
|
|
128
|
+
const contextTickets = new WeakMap<Pi.ExtensionContext, object>();
|
|
129
|
+
const seenManagers = new WeakSet<Pi.ExtensionContext["sessionManager"]>();
|
|
45
130
|
let animationInterval: NodeJS.Timeout | undefined;
|
|
131
|
+
let displayRunningSubagents = 0;
|
|
132
|
+
let displayFrame = 0;
|
|
46
133
|
let deliveryTimeout: NodeJS.Timeout | undefined;
|
|
47
134
|
let notifyTimeout: NodeJS.Timeout | undefined;
|
|
48
135
|
let recoverQueuedSteers = false;
|
|
@@ -56,6 +143,11 @@ export function createRunUiRuntime(deps: RunUiRuntimeDeps): RunUiRuntime {
|
|
|
56
143
|
|
|
57
144
|
const close = (): void => {
|
|
58
145
|
running = false;
|
|
146
|
+
displayRunningSubagents = 0;
|
|
147
|
+
displayFrame = 0;
|
|
148
|
+
sessionTicket = undefined;
|
|
149
|
+
sessionManager = undefined;
|
|
150
|
+
streamSessionAdmitted = false;
|
|
59
151
|
activeContext = undefined;
|
|
60
152
|
activeOwnerId = undefined;
|
|
61
153
|
try {
|
|
@@ -92,7 +184,8 @@ export function createRunUiRuntime(deps: RunUiRuntimeDeps): RunUiRuntime {
|
|
|
92
184
|
}
|
|
93
185
|
const message = error instanceof Error ? error.message : String(error);
|
|
94
186
|
try {
|
|
95
|
-
expectedContext.ui.notify(
|
|
187
|
+
expectedContext.ui.notify([formatMarkdownField("callback", label), formatMarkdownField("result", "failed"),
|
|
188
|
+
formatMarkdownField("diagnostic", message)].join("\n"), "error");
|
|
96
189
|
} catch {
|
|
97
190
|
/* stale context or unavailable UI */
|
|
98
191
|
}
|
|
@@ -100,14 +193,15 @@ export function createRunUiRuntime(deps: RunUiRuntimeDeps): RunUiRuntime {
|
|
|
100
193
|
const runActiveCallback = (
|
|
101
194
|
label: string,
|
|
102
195
|
callback: (ctx: Pi.ExtensionContext, ownerId: string) => void,
|
|
196
|
+
expectedTicket: object | undefined,
|
|
103
197
|
): void => {
|
|
104
|
-
if (!running || !activeContext || !activeOwnerId) return;
|
|
198
|
+
if (expectedTicket !== sessionTicket || !running || !activeContext || !activeOwnerId) return;
|
|
105
199
|
const ctx = activeContext;
|
|
106
200
|
try {
|
|
107
201
|
if (deps.getActiveContext() !== ctx) return;
|
|
108
202
|
callback(ctx, activeOwnerId);
|
|
109
203
|
} catch (error) {
|
|
110
|
-
stopAfterCallbackFailure(label, error, ctx);
|
|
204
|
+
if (expectedTicket === sessionTicket) stopAfterCallbackFailure(label, error, ctx);
|
|
111
205
|
}
|
|
112
206
|
};
|
|
113
207
|
const retireCandidateRuns = (
|
|
@@ -172,16 +266,6 @@ export function createRunUiRuntime(deps: RunUiRuntimeDeps): RunUiRuntime {
|
|
|
172
266
|
if (steer.phase === "presented") finishPresentedSteer(ownerId, steer);
|
|
173
267
|
}
|
|
174
268
|
};
|
|
175
|
-
const boundedSteerContent = (event: Observability.RunAttentionEvent): string => {
|
|
176
|
-
const text = Observability.formatRunAttentionMessage(event);
|
|
177
|
-
if (Buffer.byteLength(text, "utf8") <= Limits.RUN_DELIVERY_STEER_MAX_BYTES) {
|
|
178
|
-
return text;
|
|
179
|
-
}
|
|
180
|
-
let end = Math.min(text.length, Limits.RUN_DELIVERY_STEER_MAX_BYTES - 3);
|
|
181
|
-
while (end > 0 && Buffer.byteLength(text.slice(0, end), "utf8") >
|
|
182
|
-
Limits.RUN_DELIVERY_STEER_MAX_BYTES - 3) end -= 1;
|
|
183
|
-
return `${text.slice(0, end)}…`;
|
|
184
|
-
};
|
|
185
269
|
const admitSteerEvents = (
|
|
186
270
|
ctx: Pi.ExtensionContext,
|
|
187
271
|
ownerId: string,
|
|
@@ -194,15 +278,17 @@ export function createRunUiRuntime(deps: RunUiRuntimeDeps): RunUiRuntime {
|
|
|
194
278
|
if (!steerDiagnostics.has(key)) {
|
|
195
279
|
steerDiagnostics.add(key);
|
|
196
280
|
ctx.ui.notify(
|
|
197
|
-
|
|
281
|
+
formatSteerDiagnosticMessage(event.id, "admission", "Run generation unavailable."),
|
|
198
282
|
"warning",
|
|
199
283
|
);
|
|
200
284
|
}
|
|
201
285
|
continue;
|
|
202
286
|
}
|
|
203
287
|
try {
|
|
288
|
+
if (journal(ownerId).steers.some(steer => steer.run === event.run && steer.state_dir === event.stateDir &&
|
|
289
|
+
steer.run_instance_id === event.runInstanceId && steer.event_id === event.id)) continue;
|
|
204
290
|
RunDelivery.admitRunSteerEnvelope({
|
|
205
|
-
content:
|
|
291
|
+
content: Observability.formatRunSteerMessage(event),
|
|
206
292
|
eventId: event.id,
|
|
207
293
|
kind: event.kind,
|
|
208
294
|
level: event.level,
|
|
@@ -220,7 +306,7 @@ export function createRunUiRuntime(deps: RunUiRuntimeDeps): RunUiRuntime {
|
|
|
220
306
|
if (!steerDiagnostics.has(key)) {
|
|
221
307
|
steerDiagnostics.add(key);
|
|
222
308
|
ctx.ui.notify(
|
|
223
|
-
|
|
309
|
+
formatSteerDiagnosticMessage(event.id, "admission", message),
|
|
224
310
|
"warning",
|
|
225
311
|
);
|
|
226
312
|
}
|
|
@@ -228,6 +314,7 @@ export function createRunUiRuntime(deps: RunUiRuntimeDeps): RunUiRuntime {
|
|
|
228
314
|
}
|
|
229
315
|
};
|
|
230
316
|
const admitCompletionTransitions = (
|
|
317
|
+
ctx: Pi.ExtensionContext,
|
|
231
318
|
ownerId: string,
|
|
232
319
|
snapshot: Observability.RunUiSnapshot,
|
|
233
320
|
): boolean => {
|
|
@@ -237,9 +324,25 @@ export function createRunUiRuntime(deps: RunUiRuntimeDeps): RunUiRuntime {
|
|
|
237
324
|
snapshot.transitions,
|
|
238
325
|
snapshot.summary.runs,
|
|
239
326
|
).slice(0, Limits.RUN_DELIVERY_BATCH_MAX_MEMBERS);
|
|
240
|
-
if (members.length === 0) return false;
|
|
241
|
-
RunDelivery.
|
|
327
|
+
if (members.length === 0 || !isCurrentOwner(ctx)) return false;
|
|
328
|
+
const fileNavigation: RunDelivery.RunCompletionFileNavigation[] = [];
|
|
329
|
+
for (const member of RunDelivery.orderRunCompletionMembers(members, true)) {
|
|
330
|
+
let locations: Readonly<RunIndex.RunDirectoryNavigation>;
|
|
331
|
+
try {
|
|
332
|
+
const observed = snapshot.summary.runs.find(run => run.run === member.run && run.runInstanceId === member.run_instance_id && run.stateDir === member.state_dir);
|
|
333
|
+
locations = !observed ? Object.freeze({ state: "unavailable", reason: "identity_unavailable" })
|
|
334
|
+
: observed.ownerId !== ownerId ? Object.freeze({ state: "unavailable", reason: "session_mismatch" })
|
|
335
|
+
: RunIndex.readRunDirectoryNavigation(member.state_dir, { run: member.run, run_instance_id: member.run_instance_id, ownerId: observed.ownerId }, Pi.getSessionId(ctx));
|
|
336
|
+
} catch { locations = Object.freeze({ state: "unavailable", reason: "navigation_unavailable" }); }
|
|
337
|
+
fileNavigation.push({ member_index: members.indexOf(member), locations });
|
|
338
|
+
if (Buffer.byteLength(JSON.stringify(fileNavigation), "utf8") > Limits.RUN_DELIVERY_MODEL_MAX_BYTES) { fileNavigation.pop(); break; }
|
|
339
|
+
}
|
|
340
|
+
if (!isCurrentOwner(ctx)) return false;
|
|
341
|
+
if (!canUseCompletionSession(ctx, ownerId)) return false;
|
|
342
|
+
const capture = deps.completionStreamSessionAdmission ? RunDelivery.captureRunCompletionStreamBatch : deps.captureCompletionBatch ?? RunDelivery.admitRunCompletionBatch;
|
|
343
|
+
capture({
|
|
242
344
|
members,
|
|
345
|
+
fileNavigation,
|
|
243
346
|
ownerId,
|
|
244
347
|
tempDir: Paths.EXTENSION_RUNTIME_PATHS.tempDir,
|
|
245
348
|
});
|
|
@@ -267,30 +370,48 @@ export function createRunUiRuntime(deps: RunUiRuntimeDeps): RunUiRuntime {
|
|
|
267
370
|
if (!completionDiagnostics.has(key)) {
|
|
268
371
|
completionDiagnostics.add(key);
|
|
269
372
|
ctx.ui.notify(
|
|
270
|
-
|
|
373
|
+
"\n" + [formatMarkdownField("batch", batch.batch_id), formatMarkdownField("stage", "completion recovery"),
|
|
374
|
+
formatMarkdownField("evidence", evidence.status), formatMarkdownField("phase", "pending"),
|
|
375
|
+
formatMarkdownField("reason", evidence.reason ?? "conflicting session evidence")].join("\n"),
|
|
271
376
|
"warning",
|
|
272
377
|
);
|
|
273
378
|
}
|
|
274
379
|
return true;
|
|
275
380
|
}
|
|
276
381
|
}
|
|
382
|
+
if (fencedCompletionSession && !canUseCompletionSession(ctx, ownerId)) return true;
|
|
277
383
|
return !acceptCompletionBatch(ownerId, batch.batch_id);
|
|
278
384
|
};
|
|
279
|
-
const pendingCompletionBatch = (ownerId: string): RunDelivery.RunCompletionBatch | undefined => {
|
|
385
|
+
const pendingCompletionBatch = (ctx: Pi.ExtensionContext, ownerId: string): RunDelivery.RunCompletionBatch | undefined => {
|
|
280
386
|
const existing = journal(ownerId).completion_batch;
|
|
281
387
|
if (existing) return existing;
|
|
282
388
|
const snapshot = Observability.readRunDeliverySnapshot(deliveryObservation, ownerId);
|
|
283
|
-
admitCompletionTransitions(ownerId, snapshot);
|
|
389
|
+
admitCompletionTransitions(ctx, ownerId, snapshot);
|
|
284
390
|
Observability.pruneRunUiObservationState(deliveryObservation, snapshot);
|
|
285
391
|
return journal(ownerId).completion_batch;
|
|
286
392
|
};
|
|
287
393
|
const isCurrentOwner = (ctx: Pi.ExtensionContext): boolean => {
|
|
288
394
|
if (!running || !activeOwnerId) return false;
|
|
289
|
-
|
|
290
|
-
return Pi.getSessionId(ctx) === activeOwnerId;
|
|
291
|
-
} catch {
|
|
292
|
-
return false;
|
|
395
|
+
if (!fencedCompletionSession) {
|
|
396
|
+
try { return Pi.getSessionId(ctx) === activeOwnerId; } catch { return false; }
|
|
293
397
|
}
|
|
398
|
+
const ticket = sessionTicket, ownerId = activeOwnerId, known = contextTickets.get(ctx);
|
|
399
|
+
if (!ticket || (known && known !== ticket)) return false;
|
|
400
|
+
try {
|
|
401
|
+
if (deps.getActiveContext() !== activeContext) return false;
|
|
402
|
+
const manager = ctx.sessionManager;
|
|
403
|
+
if (manager !== sessionManager || manager.getSessionId() !== ownerId || ticket !== sessionTicket || !running) return false;
|
|
404
|
+
contextTickets.set(ctx, ticket);
|
|
405
|
+
return true;
|
|
406
|
+
} catch { return false; }
|
|
407
|
+
};
|
|
408
|
+
const canUseCompletionSession = (ctx: Pi.ExtensionContext, ownerId: string): boolean => {
|
|
409
|
+
if (deps.captureCompletionBatch && !isCurrentOwner(ctx)) return false;
|
|
410
|
+
if (!deps.completionStreamSessionAdmission) return !journal(ownerId).completion_stream;
|
|
411
|
+
if (!isCurrentOwner(ctx)) return false;
|
|
412
|
+
const ticket = sessionTicket, state = journal(ownerId).completion_stream;
|
|
413
|
+
// No metadata is not disconnected. The opt-in path never bootstraps or falls back to local indices.
|
|
414
|
+
return streamSessionAdmitted && Boolean(state) && ticket === sessionTicket && isCurrentOwner(ctx);
|
|
294
415
|
};
|
|
295
416
|
const isIdle = (ctx: Pi.ExtensionContext): boolean =>
|
|
296
417
|
typeof ctx.isIdle !== "function" || ctx.isIdle();
|
|
@@ -320,7 +441,9 @@ export function createRunUiRuntime(deps: RunUiRuntimeDeps): RunUiRuntime {
|
|
|
320
441
|
if (!steerDiagnostics.has(key)) {
|
|
321
442
|
steerDiagnostics.add(key);
|
|
322
443
|
ctx.ui.notify(
|
|
323
|
-
|
|
444
|
+
[formatMarkdownField("event", steer.event_id), formatMarkdownField("attention", "steer"),
|
|
445
|
+
formatMarkdownField("stage", "recovery"), formatMarkdownField("evidence", evidence.status),
|
|
446
|
+
formatMarkdownField("phase", "queued"), formatMarkdownField("reason", evidence.reason ?? "conflicting session evidence")].join("\n"),
|
|
324
447
|
"warning",
|
|
325
448
|
);
|
|
326
449
|
}
|
|
@@ -349,7 +472,7 @@ export function createRunUiRuntime(deps: RunUiRuntimeDeps): RunUiRuntime {
|
|
|
349
472
|
});
|
|
350
473
|
const message = error instanceof Error ? error.message : String(error);
|
|
351
474
|
ctx.ui.notify(
|
|
352
|
-
|
|
475
|
+
formatSteerDiagnosticMessage(steer.event_id, "delivery", message),
|
|
353
476
|
"error",
|
|
354
477
|
);
|
|
355
478
|
continue;
|
|
@@ -365,12 +488,14 @@ export function createRunUiRuntime(deps: RunUiRuntimeDeps): RunUiRuntime {
|
|
|
365
488
|
};
|
|
366
489
|
const scheduleCompletionFlush = (): void => {
|
|
367
490
|
if (!running) return;
|
|
491
|
+
const ticket = sessionTicket;
|
|
368
492
|
if (deliveryTimeout) clearTimeout(deliveryTimeout);
|
|
369
493
|
deliveryTimeout = setTimeout(() => {
|
|
494
|
+
if (ticket !== sessionTicket) return;
|
|
370
495
|
deliveryTimeout = undefined;
|
|
371
496
|
runActiveCallback("completion delivery callback", (ctx) => {
|
|
372
497
|
flushCompletionBatch(ctx);
|
|
373
|
-
});
|
|
498
|
+
}, ticket);
|
|
374
499
|
}, deps.deliveryDebounceMs ?? 100);
|
|
375
500
|
deliveryTimeout.unref?.();
|
|
376
501
|
};
|
|
@@ -380,22 +505,30 @@ export function createRunUiRuntime(deps: RunUiRuntimeDeps): RunUiRuntime {
|
|
|
380
505
|
notify = false,
|
|
381
506
|
terminalOnly = false,
|
|
382
507
|
): boolean => {
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
508
|
+
// Derive both projections before any UI/retirement callback. The subsequent
|
|
509
|
+
// flush still observes afresh; these facts only drive display/candidate scheduling.
|
|
510
|
+
const ticket = sessionTicket;
|
|
511
|
+
const pair = notify && isDeliveryRoot(ownerId)
|
|
512
|
+
? Observability.readRunUiAndDeliverySnapshots(observation, deliveryObservation, ownerId)
|
|
513
|
+
: undefined;
|
|
514
|
+
const snapshot = pair?.ui ?? Observability.readRunUiSnapshot(observation, ownerId);
|
|
515
|
+
if (ticket !== sessionTicket || (fencedCompletionSession && !isCurrentOwner(ctx))) return false;
|
|
516
|
+
// Animation retains display data only; all admission paths continue observing independently.
|
|
517
|
+
displayRunningSubagents = snapshot.summary.runningSubagents;
|
|
518
|
+
displayFrame = 0;
|
|
519
|
+
const status = snapshot.status && ctx.mode === "tui" ? ctx.ui.theme.fg("dim", snapshot.status) : snapshot.status;
|
|
520
|
+
if (ticket !== sessionTicket) return false;
|
|
521
|
+
ctx.ui.setStatus("zz-pi-actors-runs", status);
|
|
522
|
+
if (ticket !== sessionTicket) return false;
|
|
523
|
+
if (!notify || (fencedCompletionSession && !isCurrentOwner(ctx))) return false;
|
|
389
524
|
const sink = Pi.createNotificationSink(deps.pi, ctx);
|
|
390
525
|
retireCandidateRuns(ctx, snapshot.summary);
|
|
391
|
-
const deliverySnapshot =
|
|
392
|
-
? Observability.readRunDeliverySnapshot(deliveryObservation, ownerId)
|
|
393
|
-
: undefined;
|
|
526
|
+
const deliverySnapshot = pair?.delivery;
|
|
394
527
|
const hasCompletionCandidates = deliverySnapshot
|
|
395
|
-
? Observability.
|
|
528
|
+
? Observability.hasRunCompletionBatchMembers(
|
|
396
529
|
deliverySnapshot.transitions,
|
|
397
530
|
deliverySnapshot.summary.runs,
|
|
398
|
-
)
|
|
531
|
+
)
|
|
399
532
|
: false;
|
|
400
533
|
const hasCompletionBatch = isDeliveryRoot(ownerId) &&
|
|
401
534
|
Boolean(journal(ownerId).completion_batch);
|
|
@@ -430,29 +563,31 @@ export function createRunUiRuntime(deps: RunUiRuntimeDeps): RunUiRuntime {
|
|
|
430
563
|
);
|
|
431
564
|
}
|
|
432
565
|
};
|
|
433
|
-
const scheduleUpdate = (): void => {
|
|
434
|
-
if (!running) return;
|
|
566
|
+
const scheduleUpdate = (ticket: object | undefined): void => {
|
|
567
|
+
if (ticket !== sessionTicket || !running) return;
|
|
435
568
|
if (notifyTimeout) clearTimeout(notifyTimeout);
|
|
436
569
|
notifyTimeout = setTimeout(() => {
|
|
570
|
+
if (ticket !== sessionTicket) return;
|
|
437
571
|
runActiveCallback("Run watcher callback", (ctx, ownerId) => {
|
|
438
572
|
watcher.refresh();
|
|
439
573
|
const completionDeferred = update(ctx, ownerId, true);
|
|
574
|
+
if (ticket !== sessionTicket) return;
|
|
440
575
|
if (!completionDeferred) deps.onRunEvent();
|
|
441
|
-
reportDiagnostics(ctx);
|
|
442
|
-
});
|
|
576
|
+
if (ticket === sessionTicket) reportDiagnostics(ctx);
|
|
577
|
+
}, ticket);
|
|
443
578
|
}, deps.notificationDelayMs ?? 50);
|
|
444
579
|
notifyTimeout.unref?.();
|
|
445
580
|
};
|
|
446
|
-
const
|
|
581
|
+
const createWatcher = (ticket: object | undefined) => (deps.createRunStateWatcher ?? Observability.createRunStateWatcher)({
|
|
447
582
|
stateRoot: Paths.EXTENSION_RUNTIME_PATHS.runStateRoot,
|
|
448
|
-
onChange: scheduleUpdate,
|
|
583
|
+
onChange: () => scheduleUpdate(ticket),
|
|
449
584
|
});
|
|
450
|
-
const
|
|
585
|
+
const createReconciliation = (ticket: object | undefined) => (
|
|
451
586
|
deps.createRunTerminalReconciliationLoop ??
|
|
452
587
|
Observability.createRunTerminalReconciliationLoop
|
|
453
588
|
)({
|
|
454
589
|
onError: (error) => {
|
|
455
|
-
if (!running || !activeContext) return;
|
|
590
|
+
if (ticket !== sessionTicket || !running || !activeContext) return;
|
|
456
591
|
stopAfterCallbackFailure(
|
|
457
592
|
"terminal reconciliation callback",
|
|
458
593
|
error,
|
|
@@ -463,27 +598,31 @@ export function createRunUiRuntime(deps: RunUiRuntimeDeps): RunUiRuntime {
|
|
|
463
598
|
runActiveCallback("terminal reconciliation callback", (ctx, ownerId) => {
|
|
464
599
|
update(ctx, ownerId, true);
|
|
465
600
|
reportDiagnostics(ctx);
|
|
466
|
-
});
|
|
601
|
+
}, ticket);
|
|
467
602
|
},
|
|
468
603
|
refreshWatcher: () => {
|
|
469
|
-
if (running) watcher.refresh();
|
|
604
|
+
if (ticket === sessionTicket && running) watcher.refresh();
|
|
470
605
|
},
|
|
471
606
|
});
|
|
607
|
+
let watcher = createWatcher(undefined);
|
|
608
|
+
let reconciliation = createReconciliation(undefined);
|
|
472
609
|
|
|
473
610
|
flushCompletionBatch = (ctx: Pi.ExtensionContext): boolean => {
|
|
474
611
|
const ownerId = activeOwnerId;
|
|
475
612
|
if (!ownerId || !isCurrentOwner(ctx)) return false;
|
|
476
613
|
if (flushSteers(ctx, ownerId)) return true;
|
|
477
614
|
if (!isDeliveryRoot(ownerId)) return false;
|
|
615
|
+
if (!canUseCompletionSession(ctx, ownerId)) return true;
|
|
478
616
|
if (reconcileCompletionBatch(ctx, ownerId)) return true;
|
|
479
|
-
const batch = pendingCompletionBatch(ownerId);
|
|
617
|
+
const batch = pendingCompletionBatch(ctx, ownerId);
|
|
480
618
|
if (!batch) return false;
|
|
481
619
|
if (!isIdle(ctx)) return true;
|
|
482
|
-
const
|
|
483
|
-
if (!isIdle(ctx)) return true;
|
|
620
|
+
const projected = RunDelivery.projectRunCompletionBatchPresentation(batch);
|
|
621
|
+
if (!isIdle(ctx) || !isCurrentOwner(ctx)) return true;
|
|
484
622
|
try {
|
|
485
|
-
Pi.sendRunCompletionBatch(deps.pi, batch.batch_id, content);
|
|
623
|
+
Pi.sendRunCompletionBatch(deps.pi, batch.batch_id, projected.content, projected.presentation);
|
|
486
624
|
} catch (error) {
|
|
625
|
+
if (fencedCompletionSession && !isCurrentOwner(ctx)) throw error;
|
|
487
626
|
RunDelivery.recordRunCompletionBatchDeliveryFailure({
|
|
488
627
|
batchId: batch.batch_id,
|
|
489
628
|
error,
|
|
@@ -492,18 +631,16 @@ export function createRunUiRuntime(deps: RunUiRuntimeDeps): RunUiRuntime {
|
|
|
492
631
|
});
|
|
493
632
|
throw error;
|
|
494
633
|
}
|
|
634
|
+
if (fencedCompletionSession && !canUseCompletionSession(ctx, ownerId)) return true;
|
|
495
635
|
if (!acceptCompletionBatch(ownerId, batch.batch_id)) {
|
|
496
636
|
throw new Error("Completion batch changed before durable acceptance");
|
|
497
637
|
}
|
|
498
|
-
ctx.ui.notify(
|
|
499
|
-
`Actor completions ready: ${batch.members.length}`,
|
|
500
|
-
"info",
|
|
501
|
-
);
|
|
502
638
|
return true;
|
|
503
639
|
};
|
|
504
640
|
|
|
505
641
|
return {
|
|
506
642
|
close,
|
|
643
|
+
isCurrentSessionContext: isCurrentOwner,
|
|
507
644
|
flushCompletionBatch,
|
|
508
645
|
onTurnEnd(event, ctx) {
|
|
509
646
|
const ownerId = activeOwnerId;
|
|
@@ -512,13 +649,12 @@ export function createRunUiRuntime(deps: RunUiRuntimeDeps): RunUiRuntime {
|
|
|
512
649
|
event.outcome !== "completed" || isIdle(ctx) || ctx.signal?.aborted ||
|
|
513
650
|
ctx.hasPendingMessages?.() || event.context.pendingMessages.length > 0
|
|
514
651
|
) return undefined;
|
|
515
|
-
if (flushSteers(ctx, ownerId) || reconcileCompletionBatch(ctx, ownerId)) return undefined;
|
|
516
|
-
const batch = pendingCompletionBatch(ownerId);
|
|
517
|
-
if (!batch) return undefined;
|
|
518
|
-
const
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
);
|
|
652
|
+
if (flushSteers(ctx, ownerId) || !canUseCompletionSession(ctx, ownerId) || reconcileCompletionBatch(ctx, ownerId)) return undefined;
|
|
653
|
+
const batch = pendingCompletionBatch(ctx, ownerId);
|
|
654
|
+
if (!batch || !isCurrentOwner(ctx)) return undefined;
|
|
655
|
+
const projected = RunDelivery.projectRunCompletionBatchPresentation(batch);
|
|
656
|
+
const entry = Pi.createRunCompletionBatchEntry(batch.batch_id, projected.content, projected.presentation);
|
|
657
|
+
if (!canUseCompletionSession(ctx, ownerId)) return undefined;
|
|
522
658
|
return { entries: [...event.entries, entry], continue: true };
|
|
523
659
|
},
|
|
524
660
|
projectContext(messages, ctx) {
|
|
@@ -553,6 +689,7 @@ export function createRunUiRuntime(deps: RunUiRuntimeDeps): RunUiRuntime {
|
|
|
553
689
|
item.steer_id === steer.steer_id);
|
|
554
690
|
if (durable) finishPresentedSteer(ownerId, durable);
|
|
555
691
|
}
|
|
692
|
+
if (!canUseCompletionSession(ctx, ownerId)) return contextMessages;
|
|
556
693
|
const projected = Pi.dedupeRunCompletionBatchContext(contextMessages);
|
|
557
694
|
const batch = journal(ownerId).completion_batch;
|
|
558
695
|
if (!batch) return projected.messages;
|
|
@@ -563,7 +700,7 @@ export function createRunUiRuntime(deps: RunUiRuntimeDeps): RunUiRuntime {
|
|
|
563
700
|
batch.batch_id,
|
|
564
701
|
);
|
|
565
702
|
}
|
|
566
|
-
acceptCompletionBatch(ownerId, batch.batch_id);
|
|
703
|
+
if (!fencedCompletionSession || canUseCompletionSession(ctx, ownerId)) acceptCompletionBatch(ownerId, batch.batch_id);
|
|
567
704
|
return projected.messages;
|
|
568
705
|
},
|
|
569
706
|
shutdown(eventReason, ownerId, ctx) {
|
|
@@ -578,30 +715,57 @@ export function createRunUiRuntime(deps: RunUiRuntimeDeps): RunUiRuntime {
|
|
|
578
715
|
if (teardown.failed === 0 || !ctx) return;
|
|
579
716
|
try {
|
|
580
717
|
ctx.ui.notify(
|
|
581
|
-
|
|
718
|
+
[formatMarkdownField("stage", "shutdown teardown"), formatMarkdownField("killed", String(teardown.killed)),
|
|
719
|
+
formatMarkdownField("failed", String(teardown.failed)), formatMarkdownField("skipped", String(teardown.skipped)),
|
|
720
|
+
formatMarkdownField("discovery_failed", String(teardown.discoveryFailed)),
|
|
721
|
+
formatMarkdownField("summary", teardown.summaryPath == null ? "unavailable" : formatLiteralBlock(teardown.summaryPath)),
|
|
722
|
+
formatMarkdownField("basis", "teardown report; not scope closure")].join("\n"),
|
|
582
723
|
"warning",
|
|
583
724
|
);
|
|
584
725
|
} catch {
|
|
585
726
|
/* stale shutdown context */
|
|
586
727
|
}
|
|
587
728
|
},
|
|
588
|
-
start(ctx, ownerId) {
|
|
729
|
+
start(ctx, ownerId, event) {
|
|
589
730
|
close();
|
|
731
|
+
const ticket = {};
|
|
732
|
+
sessionTicket = ticket;
|
|
590
733
|
activeContext = ctx;
|
|
591
734
|
activeOwnerId = ownerId;
|
|
592
735
|
recoverQueuedSteers = true;
|
|
593
736
|
running = true;
|
|
594
737
|
try {
|
|
595
|
-
|
|
738
|
+
if (fencedCompletionSession) {
|
|
739
|
+
sessionManager = ctx.sessionManager;
|
|
740
|
+
const fresh = !seenManagers.has(sessionManager) && !contextTickets.has(ctx);
|
|
741
|
+
seenManagers.add(sessionManager);
|
|
742
|
+
if (!contextTickets.has(ctx)) contextTickets.set(ctx, ticket);
|
|
743
|
+
if (deps.captureCompletionBatch && !fresh) sessionManager = undefined;
|
|
744
|
+
if (deps.completionStreamSessionAdmission && fresh && event && (event.reason === "new" || event.reason === "fork") && isCurrentOwner(ctx)) {
|
|
745
|
+
const admitted = deps.completionStreamSessionAdmission(ctx, event) === true && isCurrentOwner(ctx);
|
|
746
|
+
if (ticket !== sessionTicket) return;
|
|
747
|
+
streamSessionAdmitted = admitted;
|
|
748
|
+
}
|
|
749
|
+
}
|
|
750
|
+
if (ticket !== sessionTicket) return;
|
|
751
|
+
watcher = createWatcher(ticket);
|
|
752
|
+
reconciliation = createReconciliation(ticket);
|
|
753
|
+
if (canUseCompletionSession(ctx, ownerId)) recoverPresentedBatch(ownerId);
|
|
596
754
|
recoverPresentedSteers(ownerId);
|
|
597
755
|
Observability.primeRunAttentionState(observation, ownerId);
|
|
598
756
|
update(ctx, ownerId, true, true);
|
|
757
|
+
if (ticket !== sessionTicket) return;
|
|
599
758
|
watcher.refresh();
|
|
759
|
+
if (ticket !== sessionTicket) return;
|
|
600
760
|
reconciliation.start();
|
|
761
|
+
if (ticket !== sessionTicket || ctx.mode !== "tui") return;
|
|
601
762
|
animationInterval = setInterval(() => {
|
|
602
|
-
runActiveCallback("status animation callback", (current
|
|
603
|
-
|
|
604
|
-
|
|
763
|
+
runActiveCallback("status animation callback", (current) => {
|
|
764
|
+
const status = Observability.renderSubagentStatus(displayRunningSubagents, ++displayFrame);
|
|
765
|
+
const themed = status ? current.ui.theme.fg("dim", status) : status;
|
|
766
|
+
if (ticket !== sessionTicket) return;
|
|
767
|
+
current.ui.setStatus("zz-pi-actors-runs", themed);
|
|
768
|
+
}, ticket);
|
|
605
769
|
}, deps.animationIntervalMs ?? 1000);
|
|
606
770
|
animationInterval.unref?.();
|
|
607
771
|
} catch (error) {
|