@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
|
@@ -0,0 +1,501 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical Run clock binding and explicit runtime-local supervision ownership.
|
|
3
|
+
* Owns: bounded readonly clock/frame admission, origin/reference retention, first-natural timing freezes, composed snapshots and cooperative same-origin controller claims.
|
|
4
|
+
* Excludes: origin creation/backfill, global/cross-runtime leases, independent supervision/recovery, work/native authority and actuation.
|
|
5
|
+
*/
|
|
6
|
+
import { lstatSync } from "node:fs";
|
|
7
|
+
import { isAbsolute, join, resolve } from "node:path";
|
|
8
|
+
import { readRunSupervisionClock, createRunSupervisionController, createRunSupervisionTimebase } from "./run-supervision.js";
|
|
9
|
+
import { readRunContextIdentity, RUN_CONTEXT_SOURCE_METADATA_MAX_BYTES, RUN_CONTEXT_INDEX_METADATA_MAX_BYTES } from "./runs-context-index.js";
|
|
10
|
+
import { readOwnedRunStateDirectory, RUN_STATE_OWNERSHIP_FILE } from "./runs-ownership.js";
|
|
11
|
+
import { readJsonFileResilient } from "./state-readers.js";
|
|
12
|
+
import { admitRunSnapshotReferenceReader } from "./runs-context-exports.js";
|
|
13
|
+
import { readRunSnapshotFacts } from "./runs-status.js";
|
|
14
|
+
import { projectRunSnapshot } from "./runs-snapshot.js";
|
|
15
|
+
import { withRunNaturalResultTimingAdmission, readRunNaturalResultTimingAcceptance } from "./runs-results.js";
|
|
16
|
+
function unavailable(reason) { return Object.freeze({ state: "unavailable", reason }); }
|
|
17
|
+
function sameObject(a, b) { return a.dev === b.dev && a.ino === b.ino; }
|
|
18
|
+
function sameFile(a, b) {
|
|
19
|
+
return b.isFile() && sameObject(a, b) && a.size === b.size && a.mtimeNs === b.mtimeNs && a.ctimeNs === b.ctimeNs;
|
|
20
|
+
}
|
|
21
|
+
function observeBinding(stateDir, expected) {
|
|
22
|
+
const owner = readRunContextIdentity(stateDir, expected);
|
|
23
|
+
if (owner.state === "unavailable")
|
|
24
|
+
return owner;
|
|
25
|
+
try {
|
|
26
|
+
const root = owner.local_path;
|
|
27
|
+
const path = join(root, "run.json");
|
|
28
|
+
const markerPath = join(root, RUN_STATE_OWNERSHIP_FILE);
|
|
29
|
+
const directory = lstatSync(root, { bigint: true });
|
|
30
|
+
const marker = lstatSync(markerPath, { bigint: true });
|
|
31
|
+
const before = lstatSync(path, { bigint: true });
|
|
32
|
+
if (!directory.isDirectory() || !marker.isFile() || !before.isFile() || before.size > BigInt(RUN_CONTEXT_SOURCE_METADATA_MAX_BYTES))
|
|
33
|
+
return unavailable("clock_metadata_unavailable");
|
|
34
|
+
const read = readJsonFileResilient(path, undefined, { maxBytes: RUN_CONTEXT_SOURCE_METADATA_MAX_BYTES, strictUtf8: true });
|
|
35
|
+
const unchanged = () => {
|
|
36
|
+
try {
|
|
37
|
+
return owner.unchanged() && sameFile(before, lstatSync(path, { bigint: true }));
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
if (!unchanged())
|
|
44
|
+
return unavailable("observation_changed");
|
|
45
|
+
if (read.diagnostics.length || !read.value || typeof read.value !== "object" || Array.isArray(read.value))
|
|
46
|
+
return unavailable("clock_metadata_unavailable");
|
|
47
|
+
const meta = read.value;
|
|
48
|
+
if (meta.run !== owner.identity.run || meta.run_instance_id !== owner.identity.run_instance_id || meta.ownerId !== owner.identity.ownerId || meta.state_dir !== root)
|
|
49
|
+
return unavailable("identity_mismatch");
|
|
50
|
+
let decoded;
|
|
51
|
+
try {
|
|
52
|
+
decoded = readRunSupervisionClock(meta);
|
|
53
|
+
}
|
|
54
|
+
catch {
|
|
55
|
+
return unavailable("clock_invalid");
|
|
56
|
+
}
|
|
57
|
+
if (!decoded)
|
|
58
|
+
return unavailable("clock_unconfigured");
|
|
59
|
+
const clock = Object.freeze({ started_at: decoded.started_at, supervision: Object.freeze({ ...decoded.supervision }) });
|
|
60
|
+
const frameUnchanged = () => {
|
|
61
|
+
try {
|
|
62
|
+
const current = lstatSync(root, { bigint: true });
|
|
63
|
+
return current.isDirectory() && sameObject(directory, current) && sameFile(marker, lstatSync(markerPath, { bigint: true }));
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
if (!unchanged() || !frameUnchanged())
|
|
70
|
+
return unavailable("observation_changed");
|
|
71
|
+
return Object.freeze({ state: "available", identity: owner.identity, clock, unchanged, frameUnchanged });
|
|
72
|
+
}
|
|
73
|
+
catch {
|
|
74
|
+
return unavailable("clock_metadata_unavailable");
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/** Curated metadata only; no current-time read, clock repair, lifecycle/native observation or role body. */
|
|
78
|
+
export function readRunSupervisionBinding(stateDir, expected) {
|
|
79
|
+
const observed = observeBinding(stateDir, expected);
|
|
80
|
+
return observed.state === "unavailable" ? observed : Object.freeze({ state: "available", identity: observed.identity, clock: observed.clock, unchanged: observed.unchanged });
|
|
81
|
+
}
|
|
82
|
+
/** Does not start automatically; origin must be the genuine reference retained from generation admission. */
|
|
83
|
+
export function createRunSupervisionControllerFromState(stateDir, expected, origin, ports) {
|
|
84
|
+
const initial = observeBinding(stateDir, expected);
|
|
85
|
+
if (initial.state === "unavailable")
|
|
86
|
+
return initial;
|
|
87
|
+
const timebase = createRunSupervisionTimebase(initial.clock, origin);
|
|
88
|
+
if (timebase.state === "unavailable")
|
|
89
|
+
return timebase;
|
|
90
|
+
if (!initial.unchanged())
|
|
91
|
+
return unavailable("observation_changed");
|
|
92
|
+
const controller = createRunSupervisionController(initial.identity, timebase.timebase, {
|
|
93
|
+
...ports,
|
|
94
|
+
readCurrent: () => {
|
|
95
|
+
if (!initial.frameUnchanged())
|
|
96
|
+
return null;
|
|
97
|
+
const current = observeBinding(stateDir, initial.identity);
|
|
98
|
+
if (current.state === "unavailable" || !current.unchanged() || !initial.frameUnchanged())
|
|
99
|
+
return null;
|
|
100
|
+
return Object.freeze({ identity: current.identity, clock: current.clock });
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
return Object.freeze({ state: "available", controller });
|
|
104
|
+
}
|
|
105
|
+
// Cooperative claims share only genuine origins in this module/runtime, never persisted or native scope authority.
|
|
106
|
+
const sharedOriginClaims = new WeakMap();
|
|
107
|
+
function own(value, key) {
|
|
108
|
+
return value && typeof value === "object" && !Array.isArray(value) ? Object.getOwnPropertyDescriptor(value, key)?.value : undefined;
|
|
109
|
+
}
|
|
110
|
+
function ownerIdentity(value) {
|
|
111
|
+
const run = own(value, "run");
|
|
112
|
+
const generation = own(value, "run_instance_id");
|
|
113
|
+
const descriptor = value && typeof value === "object" ? Object.getOwnPropertyDescriptor(value, "ownerId") : undefined;
|
|
114
|
+
const owner = descriptor?.value;
|
|
115
|
+
if (typeof run !== "string" || !run || /[^A-Za-z0-9_.-]/u.test(run) || typeof generation !== "string" || !generation ||
|
|
116
|
+
(descriptor && !Object.hasOwn(descriptor, "value")) || (owner !== undefined && (typeof owner !== "string" || !owner)))
|
|
117
|
+
return undefined;
|
|
118
|
+
return Object.freeze({ run, run_instance_id: generation, ...(owner === undefined ? {} : { ownerId: owner }) });
|
|
119
|
+
}
|
|
120
|
+
function ownerKey(identity) { return JSON.stringify([identity.run, identity.run_instance_id, identity.ownerId ?? null]); }
|
|
121
|
+
function retainAdmissionFrame(stateDir, run) {
|
|
122
|
+
try {
|
|
123
|
+
const directory = lstatSync(stateDir, { bigint: true });
|
|
124
|
+
const markerPath = join(stateDir, RUN_STATE_OWNERSHIP_FILE);
|
|
125
|
+
const marker = lstatSync(markerPath, { bigint: true });
|
|
126
|
+
if (!directory.isDirectory() || !marker.isFile())
|
|
127
|
+
return undefined;
|
|
128
|
+
const unchanged = () => {
|
|
129
|
+
try {
|
|
130
|
+
const current = lstatSync(stateDir, { bigint: true });
|
|
131
|
+
return current.isDirectory() && sameObject(directory, current) && sameFile(marker, lstatSync(markerPath, { bigint: true }));
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
const owned = readOwnedRunStateDirectory(stateDir, { maxBytes: RUN_CONTEXT_INDEX_METADATA_MAX_BYTES });
|
|
138
|
+
return owned.run === run && owned.stateDir === stateDir && unchanged() ? unchanged : undefined;
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
return undefined;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
/** Explicit retention with cooperative same-origin claims; no default watcher, cross-process lease or independent supervisor. */
|
|
145
|
+
export function createRunSupervisionOwner(ports) {
|
|
146
|
+
const schedule = ports.schedule;
|
|
147
|
+
const notify = ports.onDeadlineDue;
|
|
148
|
+
if (typeof notify !== "function" || (schedule !== undefined && typeof schedule !== "function"))
|
|
149
|
+
throw new Error("Run supervision owner requires synchronous controller ports.");
|
|
150
|
+
const retainedPorts = Object.freeze({ onDeadlineDue: notify.bind(ports), ...(schedule === undefined ? {} : { schedule: schedule.bind(ports) }) });
|
|
151
|
+
const records = new Map();
|
|
152
|
+
const origins = new WeakMap();
|
|
153
|
+
let closed = false;
|
|
154
|
+
let cleanupUnproven = false;
|
|
155
|
+
const absent = (reason) => Object.freeze({ state: "unavailable", reason });
|
|
156
|
+
const find = (expected) => {
|
|
157
|
+
if (closed)
|
|
158
|
+
return absent("owner_closed");
|
|
159
|
+
const identity = ownerIdentity(expected);
|
|
160
|
+
if (!identity)
|
|
161
|
+
return absent("identity_invalid");
|
|
162
|
+
return records.get(ownerKey(identity)) ?? absent("origin_not_retained");
|
|
163
|
+
};
|
|
164
|
+
const view = (record) => {
|
|
165
|
+
const controller = record.controller?.snapshot();
|
|
166
|
+
return record.stopped ? Object.freeze({ state: "stopped", identity: record.identity, ...(controller ? { controller } : {}) })
|
|
167
|
+
: controller ? Object.freeze({ state: "controlled", identity: record.identity, controller })
|
|
168
|
+
: Object.freeze({ state: "retained", identity: record.identity });
|
|
169
|
+
};
|
|
170
|
+
const snapshot = (expected) => { const record = find(expected); return "state" in record ? record : view(record); };
|
|
171
|
+
const rememberCleanup = (record) => { if (record.controller?.snapshot().timer_cleanup === "unproven")
|
|
172
|
+
cleanupUnproven = true; };
|
|
173
|
+
const releaseClaim = (record) => { if (record.claim.holder === record.token)
|
|
174
|
+
record.claim.holder = undefined; };
|
|
175
|
+
const stopRecord = (record) => {
|
|
176
|
+
if (record.stopped)
|
|
177
|
+
return;
|
|
178
|
+
record.stopped = true;
|
|
179
|
+
record.controller?.stop();
|
|
180
|
+
rememberCleanup(record);
|
|
181
|
+
};
|
|
182
|
+
const revokedRecord = (record) => {
|
|
183
|
+
if (closed)
|
|
184
|
+
return absent("owner_closed");
|
|
185
|
+
if (records.get(ownerKey(record.identity)) !== record)
|
|
186
|
+
return absent("origin_not_retained");
|
|
187
|
+
if (record.stopped)
|
|
188
|
+
return Object.freeze({ state: "unavailable", reason: "owner_stopped" });
|
|
189
|
+
if (!record.frameUnchanged())
|
|
190
|
+
return absent("observation_changed");
|
|
191
|
+
// Frame ports are synchronous, but can reenter this owner; never let their last read hide revocation.
|
|
192
|
+
if (closed)
|
|
193
|
+
return absent("owner_closed");
|
|
194
|
+
if (records.get(ownerKey(record.identity)) !== record)
|
|
195
|
+
return absent("origin_not_retained");
|
|
196
|
+
return record.stopped ? Object.freeze({ state: "unavailable", reason: "owner_stopped" }) : undefined;
|
|
197
|
+
};
|
|
198
|
+
const owner = Object.freeze({
|
|
199
|
+
onSupervisionClockCaptured: (capture) => {
|
|
200
|
+
if (closed)
|
|
201
|
+
throw new Error("Run supervision owner is closed.");
|
|
202
|
+
const identity = ownerIdentity(own(capture, "identity"));
|
|
203
|
+
const stateDir = own(capture, "state_dir");
|
|
204
|
+
const origin = own(capture, "origin");
|
|
205
|
+
const metadata = own(capture, "clock");
|
|
206
|
+
if (own(capture, "kind") !== "run_clock_origin_captured" || own(capture, "visibility") !== "kernel_only" ||
|
|
207
|
+
own(capture, "publication") !== "unpublished" || own(capture, "work_started") !== false ||
|
|
208
|
+
!identity || typeof stateDir !== "string" || !isAbsolute(stateDir) || resolve(stateDir) !== stateDir || !origin || typeof origin !== "object") {
|
|
209
|
+
throw new Error("Run supervision clock capture is invalid.");
|
|
210
|
+
}
|
|
211
|
+
const referenceDescriptor = Object.getOwnPropertyDescriptor(capture, "snapshot_references");
|
|
212
|
+
const references = referenceDescriptor && Object.hasOwn(referenceDescriptor, "value")
|
|
213
|
+
? admitRunSnapshotReferenceReader(stateDir, identity, referenceDescriptor.value) : undefined;
|
|
214
|
+
if (referenceDescriptor && !references)
|
|
215
|
+
throw new Error("Run supervision snapshot-reference capture is invalid.");
|
|
216
|
+
const key = ownerKey(identity);
|
|
217
|
+
const existing = records.get(key);
|
|
218
|
+
let decoded;
|
|
219
|
+
const policy = own(metadata, "supervision");
|
|
220
|
+
try {
|
|
221
|
+
decoded = readRunSupervisionClock({ started_at: own(metadata, "started_at"), supervision: {
|
|
222
|
+
report_every_ms: own(policy, "report_every_ms"), max_runtime_ms: own(policy, "max_runtime_ms"), deadline_at: own(policy, "deadline_at"),
|
|
223
|
+
}, ...(metadata && typeof metadata === "object" && Object.hasOwn(metadata, "createdAt") ? { createdAt: own(metadata, "createdAt") } : {}) });
|
|
224
|
+
}
|
|
225
|
+
catch {
|
|
226
|
+
throw new Error("Run supervision clock capture is invalid.");
|
|
227
|
+
}
|
|
228
|
+
if (!decoded)
|
|
229
|
+
throw new Error("Run supervision clock capture is invalid.");
|
|
230
|
+
const clockKey = JSON.stringify(decoded);
|
|
231
|
+
if (existing) {
|
|
232
|
+
if (existing.origin !== origin || existing.stateDir !== stateDir || existing.clockKey !== clockKey || existing.references !== references || !existing.frameUnchanged()) {
|
|
233
|
+
throw new Error("Run supervision clock capture conflicts with retained identity, state or origin.");
|
|
234
|
+
}
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
if (origins.has(origin))
|
|
238
|
+
throw new Error("Run supervision origin is already retained or released by this owner.");
|
|
239
|
+
const timebase = createRunSupervisionTimebase(decoded, origin);
|
|
240
|
+
if (timebase.state === "unavailable")
|
|
241
|
+
throw new Error("Run supervision clock capture origin is unavailable or incompatible.");
|
|
242
|
+
const frameUnchanged = retainAdmissionFrame(stateDir, identity.run);
|
|
243
|
+
if (!frameUnchanged)
|
|
244
|
+
throw new Error("Run supervision admission state frame is unavailable or changed.");
|
|
245
|
+
const binding = JSON.stringify([stateDir, key]);
|
|
246
|
+
let claim = sharedOriginClaims.get(origin);
|
|
247
|
+
if (claim && claim.binding !== binding)
|
|
248
|
+
throw new Error("Run supervision origin binding already belongs to another identity or state.");
|
|
249
|
+
if (claim && !claim.frameUnchanged())
|
|
250
|
+
throw new Error("Run supervision origin admission frame changed.");
|
|
251
|
+
if (closed)
|
|
252
|
+
throw new Error("Run supervision owner is closed.");
|
|
253
|
+
if (records.has(key) || origins.has(origin))
|
|
254
|
+
throw new Error("Run supervision origin is already retained or released by this owner.");
|
|
255
|
+
if (!claim) {
|
|
256
|
+
claim = { binding, frameUnchanged };
|
|
257
|
+
sharedOriginClaims.set(origin, claim);
|
|
258
|
+
}
|
|
259
|
+
records.set(key, { identity, stateDir, origin, clockKey, references, frameUnchanged: claim.frameUnchanged, claim, token: {}, stopped: false });
|
|
260
|
+
origins.set(origin, key);
|
|
261
|
+
},
|
|
262
|
+
start: (expected) => {
|
|
263
|
+
const record = find(expected);
|
|
264
|
+
if ("state" in record)
|
|
265
|
+
return record;
|
|
266
|
+
if (record.stopped)
|
|
267
|
+
return view(record);
|
|
268
|
+
if (!record.controller) {
|
|
269
|
+
if (!record.frameUnchanged())
|
|
270
|
+
return absent("observation_changed");
|
|
271
|
+
if (record.claim.holder && record.claim.holder !== record.token)
|
|
272
|
+
return absent("controller_claimed");
|
|
273
|
+
record.claim.holder = record.token;
|
|
274
|
+
try {
|
|
275
|
+
const scheduleWake = retainedPorts.schedule;
|
|
276
|
+
const controllerPorts = scheduleWake ? { ...retainedPorts, schedule: (wake, milliseconds) => scheduleWake(() => { try {
|
|
277
|
+
wake();
|
|
278
|
+
}
|
|
279
|
+
finally {
|
|
280
|
+
rememberCleanup(record);
|
|
281
|
+
} }, milliseconds) } : retainedPorts;
|
|
282
|
+
const reading = createRunSupervisionControllerFromState(record.stateDir, record.identity, record.origin, controllerPorts);
|
|
283
|
+
if (reading.state === "unavailable")
|
|
284
|
+
return reading;
|
|
285
|
+
if (!record.frameUnchanged()) {
|
|
286
|
+
reading.controller.stop();
|
|
287
|
+
return absent("observation_changed");
|
|
288
|
+
}
|
|
289
|
+
if (closed || records.get(ownerKey(record.identity)) !== record || record.stopped) {
|
|
290
|
+
reading.controller.stop();
|
|
291
|
+
return snapshot(expected);
|
|
292
|
+
}
|
|
293
|
+
record.controller = reading.controller;
|
|
294
|
+
}
|
|
295
|
+
finally {
|
|
296
|
+
if (!record.controller)
|
|
297
|
+
releaseClaim(record);
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
record.controller.start();
|
|
301
|
+
rememberCleanup(record);
|
|
302
|
+
return snapshot(expected);
|
|
303
|
+
},
|
|
304
|
+
stop: (expected) => { const record = find(expected); if ("state" in record)
|
|
305
|
+
return record; stopRecord(record); return view(record); },
|
|
306
|
+
release: (expected) => {
|
|
307
|
+
const record = find(expected);
|
|
308
|
+
if ("state" in record)
|
|
309
|
+
return record;
|
|
310
|
+
stopRecord(record);
|
|
311
|
+
releaseClaim(record);
|
|
312
|
+
records.delete(ownerKey(record.identity));
|
|
313
|
+
const controller = record.controller?.snapshot();
|
|
314
|
+
return Object.freeze({ state: "released", identity: record.identity, ...(controller ? { controller } : {}) });
|
|
315
|
+
},
|
|
316
|
+
snapshot,
|
|
317
|
+
observeReferences: (expected, stateDir) => {
|
|
318
|
+
const record = find(expected);
|
|
319
|
+
if ("state" in record)
|
|
320
|
+
return record;
|
|
321
|
+
if (stateDir !== undefined && stateDir !== record.stateDir)
|
|
322
|
+
return absent("identity_mismatch");
|
|
323
|
+
const revoked = () => revokedRecord(record);
|
|
324
|
+
const initial = revoked();
|
|
325
|
+
if (initial)
|
|
326
|
+
return initial;
|
|
327
|
+
if (!record.references)
|
|
328
|
+
return Object.freeze({ state: "unavailable", reason: "references_not_retained" });
|
|
329
|
+
const reading = record.references.read();
|
|
330
|
+
const afterRead = revoked();
|
|
331
|
+
if (afterRead)
|
|
332
|
+
return afterRead;
|
|
333
|
+
if (reading.state === "unavailable")
|
|
334
|
+
return reading;
|
|
335
|
+
const unchanged = () => !revoked() && reading.unchanged() && !revoked() &&
|
|
336
|
+
!closed && records.get(ownerKey(record.identity)) === record && !record.stopped;
|
|
337
|
+
if (!unchanged())
|
|
338
|
+
return revoked() ?? absent("observation_changed");
|
|
339
|
+
return Object.freeze({ ...reading, unchanged });
|
|
340
|
+
},
|
|
341
|
+
captureNaturalTime: (expected, producer, admission, stateDir) => {
|
|
342
|
+
const record = find(expected);
|
|
343
|
+
if ("state" in record)
|
|
344
|
+
return record;
|
|
345
|
+
if (stateDir !== undefined && stateDir !== record.stateDir)
|
|
346
|
+
return absent("identity_mismatch");
|
|
347
|
+
const initial = revokedRecord(record);
|
|
348
|
+
if (initial)
|
|
349
|
+
return initial;
|
|
350
|
+
let attempt;
|
|
351
|
+
let staged;
|
|
352
|
+
let stable;
|
|
353
|
+
try {
|
|
354
|
+
const refused = withRunNaturalResultTimingAdmission(record.stateDir, producer, admission, acceptance => {
|
|
355
|
+
if (ownerKey(acceptance.identity) !== ownerKey(record.identity))
|
|
356
|
+
return absent("identity_mismatch");
|
|
357
|
+
const existing = record.claim.natural;
|
|
358
|
+
if (existing)
|
|
359
|
+
return existing.admission !== admission || existing.producer !== producer
|
|
360
|
+
? Object.freeze({ state: "unavailable", reason: "natural_acceptance_mismatch" }) : undefined;
|
|
361
|
+
attempt = Object.freeze({ state: "capturing", producer, admission });
|
|
362
|
+
record.claim.natural = attempt;
|
|
363
|
+
const observed = owner.observeTime(record.identity, record.stateDir);
|
|
364
|
+
if (observed.state === "available" && observed.timing.state === "available") {
|
|
365
|
+
stable = observed.unchanged;
|
|
366
|
+
staged = Object.freeze({ state: "frozen", producer, admission, acceptance, elapsed_ms: observed.timing.elapsed_ms });
|
|
367
|
+
}
|
|
368
|
+
return undefined;
|
|
369
|
+
});
|
|
370
|
+
if (refused)
|
|
371
|
+
return refused;
|
|
372
|
+
if (attempt && record.claim.natural === attempt) {
|
|
373
|
+
const revoked = revokedRecord(record);
|
|
374
|
+
if (!staged || !stable || !stable() || revoked || revokedRecord(record)) {
|
|
375
|
+
record.claim.natural = Object.freeze({ state: "unproven", producer, admission });
|
|
376
|
+
return revoked ?? revokedRecord(record) ?? Object.freeze({ state: "unavailable", reason: "natural_time_unproven" });
|
|
377
|
+
}
|
|
378
|
+
record.claim.natural = staged;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
catch (error) {
|
|
382
|
+
if (attempt && record.claim.natural === attempt)
|
|
383
|
+
record.claim.natural = Object.freeze({ state: "unproven", producer, admission });
|
|
384
|
+
throw error;
|
|
385
|
+
}
|
|
386
|
+
return owner.observeFrozenNaturalTime(record.identity, record.stateDir);
|
|
387
|
+
},
|
|
388
|
+
observeFrozenNaturalTime: (expected, stateDir) => {
|
|
389
|
+
const record = find(expected);
|
|
390
|
+
if ("state" in record)
|
|
391
|
+
return record;
|
|
392
|
+
if (stateDir !== undefined && stateDir !== record.stateDir)
|
|
393
|
+
return absent("identity_mismatch");
|
|
394
|
+
const initial = revokedRecord(record);
|
|
395
|
+
if (initial)
|
|
396
|
+
return initial;
|
|
397
|
+
const frozen = record.claim.natural;
|
|
398
|
+
if (!frozen)
|
|
399
|
+
return Object.freeze({ state: "unavailable", reason: "natural_time_not_captured" });
|
|
400
|
+
if (frozen.state !== "frozen")
|
|
401
|
+
return Object.freeze({ state: "unavailable", reason: frozen.state === "capturing" ? "natural_time_capturing" : "natural_time_unproven" });
|
|
402
|
+
const acceptance = readRunNaturalResultTimingAcceptance(record.stateDir, frozen.producer, frozen.admission);
|
|
403
|
+
if (acceptance !== frozen.acceptance)
|
|
404
|
+
return Object.freeze({ state: "unavailable", reason: "natural_acceptance_mismatch" });
|
|
405
|
+
const binding = observeBinding(record.stateDir, record.identity);
|
|
406
|
+
const afterRead = revokedRecord(record);
|
|
407
|
+
if (afterRead)
|
|
408
|
+
return afterRead;
|
|
409
|
+
if (binding.state === "unavailable")
|
|
410
|
+
return binding;
|
|
411
|
+
if (JSON.stringify(binding.clock) !== record.clockKey)
|
|
412
|
+
return absent("clock_changed");
|
|
413
|
+
const unchanged = () => !revokedRecord(record) && record.claim.natural === frozen && binding.unchanged() && binding.frameUnchanged() &&
|
|
414
|
+
!revokedRecord(record) && !closed && records.get(ownerKey(record.identity)) === record && !record.stopped;
|
|
415
|
+
if (!unchanged())
|
|
416
|
+
return revokedRecord(record) ?? absent("observation_changed");
|
|
417
|
+
return Object.freeze({ state: "available", basis: "first_natural_acceptance", identity: record.identity, elapsed_ms: frozen.elapsed_ms,
|
|
418
|
+
natural_acceptance: Object.freeze({ code: acceptance.code, recorded_status: acceptance.recorded_status, completed_at: acceptance.completed_at }), unchanged });
|
|
419
|
+
},
|
|
420
|
+
observeSnapshot: (expected, capturedAt, stateDir) => {
|
|
421
|
+
const record = find(expected);
|
|
422
|
+
if ("state" in record)
|
|
423
|
+
return record;
|
|
424
|
+
if (stateDir !== undefined && stateDir !== record.stateDir)
|
|
425
|
+
return absent("identity_mismatch");
|
|
426
|
+
const initial = revokedRecord(record);
|
|
427
|
+
if (initial)
|
|
428
|
+
return initial;
|
|
429
|
+
const references = owner.observeReferences(record.identity, record.stateDir);
|
|
430
|
+
const afterReferences = revokedRecord(record);
|
|
431
|
+
if (afterReferences)
|
|
432
|
+
return afterReferences;
|
|
433
|
+
if (references.state === "unavailable")
|
|
434
|
+
return references;
|
|
435
|
+
if (references.references.cwd === null)
|
|
436
|
+
return Object.freeze({ state: "unavailable", reason: "references_unavailable" });
|
|
437
|
+
const facts = readRunSnapshotFacts(record.stateDir, record.identity, capturedAt, owner.observeTime, owner.observeFrozenNaturalTime);
|
|
438
|
+
const afterFacts = revokedRecord(record);
|
|
439
|
+
if (afterFacts)
|
|
440
|
+
return afterFacts;
|
|
441
|
+
if (facts.state === "unavailable")
|
|
442
|
+
return facts;
|
|
443
|
+
const unchanged = () => !revokedRecord(record) && references.unchanged() && facts.unchanged() &&
|
|
444
|
+
!closed && records.get(ownerKey(record.identity)) === record && !record.stopped;
|
|
445
|
+
if (!unchanged())
|
|
446
|
+
return revokedRecord(record) ?? absent("observation_changed");
|
|
447
|
+
// Canonical lifecycle/time are facts, not permission to expose their mutable cwd/index fields.
|
|
448
|
+
const projected = projectRunSnapshot(record.identity, { identity: facts.facts.identity, captured_at: facts.facts.captured_at,
|
|
449
|
+
lifecycle: facts.facts.lifecycle, timing: facts.facts.timing, cwd: references.references.cwd,
|
|
450
|
+
...(references.references.context_index ? { context_index: references.references.context_index } : {}) });
|
|
451
|
+
if (!unchanged())
|
|
452
|
+
return revokedRecord(record) ?? absent("observation_changed");
|
|
453
|
+
return projected.state === "unavailable" ? projected : Object.freeze({ ...projected, unchanged });
|
|
454
|
+
},
|
|
455
|
+
observeTime: (expected, stateDir) => {
|
|
456
|
+
const record = find(expected);
|
|
457
|
+
if ("state" in record)
|
|
458
|
+
return record;
|
|
459
|
+
if (stateDir !== undefined && stateDir !== record.stateDir)
|
|
460
|
+
return absent("identity_mismatch");
|
|
461
|
+
const revoked = () => revokedRecord(record);
|
|
462
|
+
const initial = revoked();
|
|
463
|
+
if (initial)
|
|
464
|
+
return initial;
|
|
465
|
+
const binding = observeBinding(record.stateDir, record.identity);
|
|
466
|
+
const afterRead = revoked();
|
|
467
|
+
if (afterRead)
|
|
468
|
+
return afterRead;
|
|
469
|
+
if (binding.state === "unavailable")
|
|
470
|
+
return binding;
|
|
471
|
+
if (JSON.stringify(binding.clock) !== record.clockKey)
|
|
472
|
+
return absent("clock_changed");
|
|
473
|
+
const timebase = createRunSupervisionTimebase(binding.clock, record.origin);
|
|
474
|
+
if (timebase.state === "unavailable")
|
|
475
|
+
return timebase;
|
|
476
|
+
const unchanged = () => !revoked() && binding.unchanged() && binding.frameUnchanged() &&
|
|
477
|
+
!closed && records.get(ownerKey(record.identity)) === record && !record.stopped;
|
|
478
|
+
if (!unchanged())
|
|
479
|
+
return revoked() ?? absent("observation_changed");
|
|
480
|
+
const timing = timebase.timebase.observe();
|
|
481
|
+
const afterSample = revoked();
|
|
482
|
+
if (afterSample)
|
|
483
|
+
return afterSample;
|
|
484
|
+
if (!unchanged())
|
|
485
|
+
return revoked() ?? absent("observation_changed");
|
|
486
|
+
return Object.freeze({ state: "available", basis: "since_admission", identity: record.identity, timing, unchanged });
|
|
487
|
+
},
|
|
488
|
+
close: () => {
|
|
489
|
+
if (!closed) {
|
|
490
|
+
closed = true;
|
|
491
|
+
for (const record of records.values()) {
|
|
492
|
+
stopRecord(record);
|
|
493
|
+
releaseClaim(record);
|
|
494
|
+
}
|
|
495
|
+
records.clear();
|
|
496
|
+
}
|
|
497
|
+
return Object.freeze({ state: "closed", ...(cleanupUnproven ? { timer_cleanup: "unproven" } : {}) });
|
|
498
|
+
},
|
|
499
|
+
});
|
|
500
|
+
return owner;
|
|
501
|
+
}
|
|
@@ -54,6 +54,12 @@ function hasExactFields(record, fields) {
|
|
|
54
54
|
const keys = Object.keys(record);
|
|
55
55
|
return keys.length === fields.size && keys.every((key) => fields.has(key));
|
|
56
56
|
}
|
|
57
|
+
function clipTraceSummary(summary) {
|
|
58
|
+
const last = summary.charCodeAt(999), next = summary.charCodeAt(1_000);
|
|
59
|
+
// Keep the UTF-16 allowance without bisecting an original surrogate pair.
|
|
60
|
+
const end = last >= 0xd800 && last <= 0xdbff && next >= 0xdc00 && next <= 0xdfff ? 999 : 1_000;
|
|
61
|
+
return summary.slice(0, end);
|
|
62
|
+
}
|
|
57
63
|
function normalizeTraceEventInput(input) {
|
|
58
64
|
if (!input || typeof input !== "object" || Array.isArray(input)) {
|
|
59
65
|
throw new Error("Trace event must be an object");
|
|
@@ -91,7 +97,7 @@ function normalizeTraceEventInput(input) {
|
|
|
91
97
|
return {
|
|
92
98
|
kind: record.kind,
|
|
93
99
|
...(record.summary !== undefined
|
|
94
|
-
? { summary: record.summary
|
|
100
|
+
? { summary: clipTraceSummary(record.summary) }
|
|
95
101
|
: {}),
|
|
96
102
|
...(record.data !== undefined ? { data: record.data } : {}),
|
|
97
103
|
...(record.level !== undefined
|
|
@@ -424,6 +430,7 @@ export function readRunTraceJournal(stateDir) {
|
|
|
424
430
|
path,
|
|
425
431
|
}],
|
|
426
432
|
events: [],
|
|
433
|
+
omittedEvents: 0,
|
|
427
434
|
fileBytes: 0,
|
|
428
435
|
omittedPrefixBytes: 0,
|
|
429
436
|
readBytes: 0,
|
|
@@ -432,6 +439,7 @@ export function readRunTraceJournal(stateDir) {
|
|
|
432
439
|
const diagnostics = [];
|
|
433
440
|
let events = [];
|
|
434
441
|
let eventHead = 0;
|
|
442
|
+
let omittedEvents = 0;
|
|
435
443
|
let ordinal = window.leadingPartialLines;
|
|
436
444
|
const diagnose = (message, line) => {
|
|
437
445
|
diagnostics.push({ message, path, ...(line === undefined ? {} : { line }) });
|
|
@@ -440,8 +448,10 @@ export function readRunTraceJournal(stateDir) {
|
|
|
440
448
|
};
|
|
441
449
|
const retain = (event) => {
|
|
442
450
|
events.push({ event, ordinal });
|
|
443
|
-
if (events.length - eventHead > Limits.TRACE_JOURNAL_MAX_EVENTS)
|
|
451
|
+
if (events.length - eventHead > Limits.TRACE_JOURNAL_MAX_EVENTS) {
|
|
444
452
|
eventHead += 1;
|
|
453
|
+
omittedEvents += 1;
|
|
454
|
+
}
|
|
445
455
|
if (eventHead > Limits.TRACE_JOURNAL_MAX_EVENTS) {
|
|
446
456
|
events = events.slice(eventHead);
|
|
447
457
|
eventHead = 0;
|
|
@@ -469,6 +479,7 @@ export function readRunTraceJournal(stateDir) {
|
|
|
469
479
|
return {
|
|
470
480
|
diagnostics,
|
|
471
481
|
events: events.slice(eventHead),
|
|
482
|
+
omittedEvents,
|
|
472
483
|
fileBytes: window.fileBytes,
|
|
473
484
|
omittedPrefixBytes: window.omittedPrefixBytes,
|
|
474
485
|
readBytes: window.readBytes,
|
|
@@ -476,7 +487,7 @@ export function readRunTraceJournal(stateDir) {
|
|
|
476
487
|
}
|
|
477
488
|
export function summarizeRunTraceJournal(read) {
|
|
478
489
|
const marker = [...read.events].reverse().map(({ event }) => markerData(event)).find(Boolean);
|
|
479
|
-
const incomplete = Boolean(marker) || read.omittedPrefixBytes > 0;
|
|
490
|
+
const incomplete = Boolean(marker) || read.omittedPrefixBytes > 0 || read.omittedEvents > 0 || read.diagnostics.length > 0;
|
|
480
491
|
return {
|
|
481
492
|
history_complete: !incomplete, compacted: Boolean(marker),
|
|
482
493
|
compactions_total: marker?.compactions_total ?? 0,
|
|
@@ -10,6 +10,7 @@ import * as RecipesDiscovery from "./recipes-discovery.js";
|
|
|
10
10
|
import * as RecipesReferences from "./recipes-references.js";
|
|
11
11
|
import * as RecipesUsage from "./recipes-usage.js";
|
|
12
12
|
import * as ToolsLocal from "./tools-local.js";
|
|
13
|
+
import * as ToolsResponse from "./tools-response.js";
|
|
13
14
|
export function createAutoToolsRuntime(deps) {
|
|
14
15
|
const tools = new Map();
|
|
15
16
|
const runtimeToolFingerprints = new Map();
|
|
@@ -109,20 +110,38 @@ export function createAutoToolsRuntime(deps) {
|
|
|
109
110
|
const skipped = warnings.filter((warning) => warning.includes(" could not be exposed as a tool:"));
|
|
110
111
|
const other = warnings.filter((warning) => !shadowed.includes(warning) && !skipped.includes(warning));
|
|
111
112
|
const lines = ["pi-actors recipe registry warning"];
|
|
113
|
+
const groups = [];
|
|
112
114
|
if (shadowed.length > 0) {
|
|
113
115
|
lines.push("User recipes shadow lower-priority user sources:");
|
|
116
|
+
const start = lines.length;
|
|
114
117
|
lines.push(...shadowed.map((warning) => `• ${warning}`));
|
|
118
|
+
groups[groups.length] = ["shadowed_sources", start, lines.length];
|
|
115
119
|
}
|
|
116
120
|
if (skipped.length > 0) {
|
|
117
121
|
lines.push("Recipes skipped from tool exposure:");
|
|
122
|
+
const start = lines.length;
|
|
118
123
|
lines.push(...skipped.map((warning) => `• ${warning}`));
|
|
124
|
+
groups[groups.length] = ["skipped_tool_exposure", start, lines.length];
|
|
119
125
|
}
|
|
120
126
|
if (other.length > 0) {
|
|
121
127
|
lines.push("Other registry diagnostics:");
|
|
128
|
+
const start = lines.length;
|
|
122
129
|
lines.push(...other.map((warning) => `• ${warning}`));
|
|
130
|
+
groups[groups.length] = ["other_diagnostics", start, lines.length];
|
|
123
131
|
}
|
|
124
132
|
lines.push("Next: inspect target=recipes view=doctor");
|
|
125
|
-
|
|
133
|
+
// Preserve the original layout join/coercion and its faults before projecting owned warning slots.
|
|
134
|
+
void `${lines.join("\n")}\n`;
|
|
135
|
+
let text = ToolsResponse.formatMarkdownField("report", "pi-actors recipe registry warning");
|
|
136
|
+
for (const [key, start, end] of groups) {
|
|
137
|
+
text += `\n- ${key}:`;
|
|
138
|
+
for (let index = start; index < end; index++) {
|
|
139
|
+
const value = lines[index].slice(2);
|
|
140
|
+
text += "\n" + (value.isWellFormed() ? ToolsResponse.formatMarkdownField("warning", value, 1)
|
|
141
|
+
: " - warning:\n - result: unavailable\n - reason: malformed_selected_text");
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
return text + "\n" + ToolsResponse.formatMarkdownField("instruction", "Next: inspect target=recipes view=doctor") + "\n";
|
|
126
145
|
}
|
|
127
146
|
function loadTools(ctx, resolutionContext) {
|
|
128
147
|
const warnings = [];
|
|
@@ -252,7 +271,7 @@ export function createRecipeToolReloadWatcher(runtime, deps = {}) {
|
|
|
252
271
|
failureNotified = true;
|
|
253
272
|
setWatchStatus("failed");
|
|
254
273
|
try {
|
|
255
|
-
ctx.ui.notify("Recipe live reload watcher failed
|
|
274
|
+
ctx.ui.notify("- report: Recipe live reload watcher failed\n- instruction: restart the session or use register_tool again to refresh recipe tools.", "warning");
|
|
256
275
|
}
|
|
257
276
|
catch (error) {
|
|
258
277
|
reportCallbackError(error);
|
|
@@ -268,7 +287,7 @@ export function createRecipeToolReloadWatcher(runtime, deps = {}) {
|
|
|
268
287
|
try {
|
|
269
288
|
runtime.loadTools(ctx, deps.getResolutionContext?.());
|
|
270
289
|
if (notifyAfterReload) {
|
|
271
|
-
ctx.ui.notify("Recipe tools refreshed from ~/.pi/agent/recipes", "info");
|
|
290
|
+
ctx.ui.notify("- report: Recipe tools refreshed from ~/.pi/agent/recipes", "info");
|
|
272
291
|
}
|
|
273
292
|
notifyAfterReload = false;
|
|
274
293
|
}
|