@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
|
@@ -7,14 +7,17 @@
|
|
|
7
7
|
import type {
|
|
8
8
|
ExtensionAPI,
|
|
9
9
|
ExtensionContext,
|
|
10
|
+
SessionStartEvent,
|
|
10
11
|
CustomMessageEntryDraft,
|
|
11
12
|
TurnEndEvent,
|
|
12
13
|
TurnEndEventResult,
|
|
13
14
|
} from "@earendil-works/pi-coding-agent";
|
|
14
15
|
|
|
15
16
|
import * as SessionEvidence from "./session-evidence.ts";
|
|
17
|
+
import * as RunDelivery from "./run-delivery.ts";
|
|
16
18
|
|
|
17
|
-
export type { ExtensionAPI, ExtensionContext, TurnEndEvent, TurnEndEventResult };
|
|
19
|
+
export type { ExtensionAPI, ExtensionContext, SessionStartEvent, TurnEndEvent, TurnEndEventResult };
|
|
20
|
+
export { getMarkdownTheme } from "@earendil-works/pi-coding-agent";
|
|
18
21
|
|
|
19
22
|
export const RUN_COMPLETION_BATCH_CUSTOM_TYPE = "pi-actors-run-batch";
|
|
20
23
|
export const RUN_STEER_CUSTOM_TYPE = "pi-actors-run-steer";
|
|
@@ -50,6 +53,7 @@ export function createNotificationSink(
|
|
|
50
53
|
export function createRunCompletionBatchEntry(
|
|
51
54
|
batchId: string,
|
|
52
55
|
content: string,
|
|
56
|
+
presentation?: unknown,
|
|
53
57
|
): CustomMessageEntryDraft {
|
|
54
58
|
return {
|
|
55
59
|
type: "custom_message",
|
|
@@ -61,6 +65,7 @@ export function createRunCompletionBatchEntry(
|
|
|
61
65
|
batch_id: batchId,
|
|
62
66
|
kind: "completion_batch",
|
|
63
67
|
},
|
|
68
|
+
...(presentation === undefined ? {} : { pi_actors_presentation: presentation }),
|
|
64
69
|
},
|
|
65
70
|
};
|
|
66
71
|
}
|
|
@@ -69,8 +74,9 @@ export function sendRunCompletionBatch(
|
|
|
69
74
|
pi: ExtensionAPI,
|
|
70
75
|
batchId: string,
|
|
71
76
|
content: string,
|
|
77
|
+
presentation?: unknown,
|
|
72
78
|
): void {
|
|
73
|
-
const { type: _type, ...message } = createRunCompletionBatchEntry(batchId, content);
|
|
79
|
+
const { type: _type, ...message } = createRunCompletionBatchEntry(batchId, content, presentation);
|
|
74
80
|
pi.sendMessage(message, { deliverAs: "followUp", triggerTurn: true });
|
|
75
81
|
}
|
|
76
82
|
|
|
@@ -95,9 +101,39 @@ export function sendRunSteer(
|
|
|
95
101
|
});
|
|
96
102
|
}
|
|
97
103
|
|
|
104
|
+
function hasCompletionFrontmatterPrefix(content: string): boolean {
|
|
105
|
+
const opening = /^\uFEFF?---[ \t]*(?:\r\n|\r|\n)/u.exec(content);
|
|
106
|
+
if (!opening) return false;
|
|
107
|
+
for (const line of content.slice(opening[0].length).split(/\r\n|\r|\n/u)) {
|
|
108
|
+
const field = line.trim();
|
|
109
|
+
if (field === "---") return false;
|
|
110
|
+
if (!field) continue;
|
|
111
|
+
if (/^(?:index|run|state|kind)[ \t]*:/iu.test(field) ||
|
|
112
|
+
["index", "run", "state", "kind"].some(key => key.startsWith(field.toLowerCase()))) return true;
|
|
113
|
+
// Continue through plausible metadata, not arbitrary thematic-break prose.
|
|
114
|
+
if (!/^[a-z_][a-z0-9_-]*[ \t]*:/iu.test(field)) return false;
|
|
115
|
+
}
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function unheaderedCompletionId(content: string): string | { malformed: true } | undefined {
|
|
120
|
+
// Preserve the existing legacy RegExp coercion before inspecting compiler-owned record framing.
|
|
121
|
+
const legacyId = /^Batch: `([^`]{1,128})`$/mu.exec(content)?.[1];
|
|
122
|
+
if (typeof content === "string") {
|
|
123
|
+
const core = RunDelivery.readCompletionYamlCarrier(content);
|
|
124
|
+
if (core.state === "available") return core.packet.batchId;
|
|
125
|
+
// Initial compiler headers only: never recover identity by scanning authored bodies.
|
|
126
|
+
if (/^(?:index: (?:\d+|"\?")\nrun: [^\n]*\nstate:|_completion:\n (?:codec|batch_id):)/u.test(content)) return { malformed: true };
|
|
127
|
+
}
|
|
128
|
+
if (typeof content === "string" && (hasCompletionFrontmatterPrefix(content) || /^(?:#|Run #|— Новый поток|- run:|- #0:\n|- result: omitted \(model byte limit\)\n|- omitted_results:)/u.test(content))) {
|
|
129
|
+
return RunDelivery.readRunCompletionRecordMarker(content)?.batchId ?? { malformed: true };
|
|
130
|
+
}
|
|
131
|
+
return legacyId;
|
|
132
|
+
}
|
|
133
|
+
|
|
98
134
|
function completionBatchMessage(
|
|
99
135
|
message: unknown,
|
|
100
|
-
): { batchId: string; content: string } | undefined {
|
|
136
|
+
): { batchId: string; content: string } | { malformed: true } | undefined {
|
|
101
137
|
if (!message || typeof message !== "object" || Array.isArray(message)) return undefined;
|
|
102
138
|
const record = message as Record<string, unknown>;
|
|
103
139
|
if (
|
|
@@ -115,9 +151,14 @@ function completionBatchMessage(
|
|
|
115
151
|
typeof envelope.batch_id === "string"
|
|
116
152
|
? envelope.batch_id
|
|
117
153
|
: undefined;
|
|
118
|
-
|
|
119
|
-
const
|
|
120
|
-
|
|
154
|
+
// Retained headers or the new closed footer identify delivery; authored labels never override either.
|
|
155
|
+
const contentId = record.content.startsWith("- completion:")
|
|
156
|
+
? /^- completion: ([^\r\n\u2028\u2029]{1,128})\n- presentation: ax_records\n/u.exec(record.content)?.[1]
|
|
157
|
+
: record.content.startsWith("- completions:")
|
|
158
|
+
? /^- completions: [1-9]\d{0,2}\n- batch: ([^\r\n\u2028\u2029]{1,128})\n/u.exec(record.content)?.[1]
|
|
159
|
+
: unheaderedCompletionId(record.content);
|
|
160
|
+
const batchId = detailedId ?? (typeof contentId === "string" ? contentId : undefined);
|
|
161
|
+
if (!batchId || batchId.length > 128) return contentId && typeof contentId === "object" ? contentId : undefined;
|
|
121
162
|
return { batchId, content: record.content };
|
|
122
163
|
}
|
|
123
164
|
|
|
@@ -131,7 +172,7 @@ export function dedupeRunCompletionBatchContext(messages: unknown[]): {
|
|
|
131
172
|
const conflicts = new Set<string>();
|
|
132
173
|
for (const message of messages) {
|
|
133
174
|
const batch = completionBatchMessage(message);
|
|
134
|
-
if (!batch) continue;
|
|
175
|
+
if (!batch || "malformed" in batch) continue;
|
|
135
176
|
const existing = batches.get(batch.batchId);
|
|
136
177
|
if (existing !== undefined && existing !== batch.content) {
|
|
137
178
|
conflicts.add(batch.batchId);
|
|
@@ -142,7 +183,7 @@ export function dedupeRunCompletionBatchContext(messages: unknown[]): {
|
|
|
142
183
|
const retained = new Set<string>();
|
|
143
184
|
const filtered = messages.filter((message) => {
|
|
144
185
|
const batch = completionBatchMessage(message);
|
|
145
|
-
if (!batch) return true;
|
|
186
|
+
if (!batch || "malformed" in batch) return true;
|
|
146
187
|
if (conflicts.has(batch.batchId) || retained.has(batch.batchId)) return false;
|
|
147
188
|
retained.add(batch.batchId);
|
|
148
189
|
return true;
|
|
@@ -155,8 +196,10 @@ export function removeRunCompletionBatchFromContext(
|
|
|
155
196
|
messages: unknown[],
|
|
156
197
|
batchId: string,
|
|
157
198
|
): unknown[] {
|
|
158
|
-
return messages.filter((message) =>
|
|
159
|
-
completionBatchMessage(message)
|
|
199
|
+
return messages.filter((message) => {
|
|
200
|
+
const batch = completionBatchMessage(message);
|
|
201
|
+
return !batch || "malformed" in batch || batch.batchId !== batchId;
|
|
202
|
+
});
|
|
160
203
|
}
|
|
161
204
|
|
|
162
205
|
function steerMessage(
|
|
@@ -232,15 +275,20 @@ export function inspectRunCompletionBatchSessionEvidence(
|
|
|
232
275
|
ctx: ExtensionContext,
|
|
233
276
|
input: { batchId: string; content: string },
|
|
234
277
|
): SessionEvidence.ActiveSessionEntryEvidence {
|
|
235
|
-
|
|
278
|
+
let unidentifiedRecord = false;
|
|
279
|
+
const evidence = SessionEvidence.inspectBoundedActiveSessionEntries({
|
|
236
280
|
getEntry: (id) => ctx.sessionManager.getEntry(id),
|
|
237
281
|
leaf: ctx.sessionManager.getLeafEntry(),
|
|
238
282
|
match: (entry) => {
|
|
239
283
|
const batch = completionBatchMessage(entry);
|
|
284
|
+
if (batch && "malformed" in batch) { unidentifiedRecord = true; return undefined; }
|
|
240
285
|
if (!batch || batch.batchId !== input.batchId) return undefined;
|
|
241
286
|
return batch.content === input.content ? "present" : "conflict";
|
|
242
287
|
},
|
|
243
288
|
});
|
|
289
|
+
// An unidentified new record may be this pending epoch; it cannot prove absence or permit replay.
|
|
290
|
+
return evidence.status === "absent" && unidentifiedRecord
|
|
291
|
+
? { ...evidence, status: "unknown", reason: "completion record correlation is unavailable" } : evidence;
|
|
244
292
|
}
|
|
245
293
|
|
|
246
294
|
export function inspectRunSteerSessionEvidence(
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Captured Recipe evidence projection.
|
|
3
|
+
* Owns: shared Recipe/launch privacy normalization, known runtime-origin scrubbing and pure captured-secret/reference comparison policy.
|
|
4
|
+
* Excludes: filesystem reads, identity admission, live Recipe resolution, export writes and native authority.
|
|
5
|
+
*/
|
|
6
|
+
import { isAbsolute, win32 } from "node:path";
|
|
7
|
+
import { isDeepStrictEqual } from "node:util";
|
|
8
|
+
import { redactSessionEvidenceValue } from "./session-evidence.ts";
|
|
9
|
+
|
|
10
|
+
function privateOriginScrubber(meta: Record<string, unknown>): (value: string) => string {
|
|
11
|
+
const origins = new Set<string>();
|
|
12
|
+
const collect = (value: unknown, actorContext = false): void => {
|
|
13
|
+
if (Array.isArray(value)) { value.forEach(item => collect(item)); return; }
|
|
14
|
+
if (!value || typeof value !== "object") return;
|
|
15
|
+
for (const [key, item] of Object.entries(value)) {
|
|
16
|
+
if ((["recipe_file", "source_file", "recipe_dir", "skill_dir"].includes(key) || (actorContext && key === "file")) &&
|
|
17
|
+
typeof item === "string" && item && (isAbsolute(item) || win32.isAbsolute(item))) origins.add(item);
|
|
18
|
+
collect(item, key === "actorRecipeContext");
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
collect({ recipe_file: meta.recipe_file, contexts: meta.recipe_context_records, values: meta.values,
|
|
22
|
+
template: meta.template, singleton_values: meta.singleton_values });
|
|
23
|
+
const longestFirst = [...origins].sort((a, b) => b.length - a.length);
|
|
24
|
+
// A directory suffix in a logical reference is not an absolute runtime-origin token.
|
|
25
|
+
return value => longestFirst.reduce((text, origin) => text.replaceAll(origin, (match, offset: number) =>
|
|
26
|
+
/[\p{L}\p{N}_.-]$/u.test(text.slice(0, offset)) ? match : "[PRIVATE_RECIPE_ORIGIN]"), value);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Pure Recipe-provenance privacy for captured evidence; this callback grants no runtime authority. */
|
|
30
|
+
export function createRunRecipeEvidenceRedactor(meta: Record<string, unknown>, maxTextChars?: number): (value: unknown) => unknown {
|
|
31
|
+
const scrubOrigin = privateOriginScrubber(meta);
|
|
32
|
+
const stripPrivateOrigins = (value: unknown): unknown => {
|
|
33
|
+
if (typeof value === "string") return scrubOrigin(value);
|
|
34
|
+
if (Array.isArray(value)) return value.map(stripPrivateOrigins);
|
|
35
|
+
if (!value || typeof value !== "object") return value;
|
|
36
|
+
return Object.fromEntries(
|
|
37
|
+
Object.entries(value as Record<string, unknown>)
|
|
38
|
+
.filter(
|
|
39
|
+
([key, entry]) =>
|
|
40
|
+
entry !== undefined &&
|
|
41
|
+
key !== "recipe_dir" &&
|
|
42
|
+
key !== "skill_dir" &&
|
|
43
|
+
key !== "source_file",
|
|
44
|
+
)
|
|
45
|
+
.map(([key, entry]) => [
|
|
46
|
+
scrubOrigin(key),
|
|
47
|
+
key === "actorRecipeContext" && entry && typeof entry === "object"
|
|
48
|
+
? stripPrivateOrigins(
|
|
49
|
+
Object.fromEntries(
|
|
50
|
+
Object.entries(entry as Record<string, unknown>).filter(
|
|
51
|
+
([contextKey]) => contextKey !== "file",
|
|
52
|
+
),
|
|
53
|
+
),
|
|
54
|
+
)
|
|
55
|
+
: stripPrivateOrigins(entry),
|
|
56
|
+
]),
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
return value => redactSessionEvidenceValue(stripPrivateOrigins(value), maxTextChars);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
function capturedSecretLiterals(meta: Record<string, unknown>): string[] {
|
|
63
|
+
const literals = new Set<string>();
|
|
64
|
+
const collect = (value: unknown, sensitive = false): void => {
|
|
65
|
+
if (typeof value === "string") { if (sensitive && value) literals.add(value); return; }
|
|
66
|
+
if (!value || typeof value !== "object") return;
|
|
67
|
+
for (const [key, child] of Object.entries(value)) {
|
|
68
|
+
const privateKey = (redactSessionEvidenceValue({ [key]: "" }) as Record<string, unknown>)[key] === "[REDACTED]";
|
|
69
|
+
collect(child, sensitive || privateKey);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
collect(meta);
|
|
73
|
+
return [...literals].sort((a, b) => b.length - a.length);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** Literal sensitive-key privacy from captured data; does not admit metadata, references or producers. */
|
|
77
|
+
export function capturedSecretMask(meta: Record<string, unknown>, replacement = "[REDACTED]"): (text: string) => string {
|
|
78
|
+
const escaped = capturedSecretLiterals(meta).map(value => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"));
|
|
79
|
+
const secrets = escaped.length ? new RegExp(escaped.join("|"), "gu") : undefined;
|
|
80
|
+
return text => secrets ? text.replace(secrets, () => replacement) : text;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function capturedBodyPolicy(meta: Record<string, unknown>) {
|
|
84
|
+
const project = createRunRecipeEvidenceRedactor(meta, Number.MAX_SAFE_INTEGER), mask = capturedSecretMask(meta), literals = capturedSecretLiterals(meta);
|
|
85
|
+
const encoded = (value: string): string | undefined => {
|
|
86
|
+
const bom = value.startsWith("\uFEFF"); let parsed: unknown;
|
|
87
|
+
try { parsed = JSON.parse(bom ? value.slice(1) : value); } catch { return undefined; }
|
|
88
|
+
const present = literals.filter(literal => value.includes(literal));
|
|
89
|
+
if (present.length) {
|
|
90
|
+
// Probe only: never emit masked JSON or use its altered keys for sensitive-key decisions.
|
|
91
|
+
if (present.some(literal => JSON.stringify(literal).slice(1, -1) !== literal)) return "[REDACTED]";
|
|
92
|
+
try { const masked = mask(value); JSON.parse(bom ? masked.slice(1) : masked); } catch { return "[REDACTED]"; }
|
|
93
|
+
}
|
|
94
|
+
// Decode structured text before generic masking can alter its syntax; nested encoded content follows the same policy.
|
|
95
|
+
const projected = full(parsed);
|
|
96
|
+
return JSON.stringify(projected) === JSON.stringify(parsed) ? value : (bom ? "\uFEFF" : "") + JSON.stringify(projected);
|
|
97
|
+
};
|
|
98
|
+
const prepare = (value: unknown): unknown => {
|
|
99
|
+
if (typeof value === "string") return encoded(value) ?? value;
|
|
100
|
+
if (Array.isArray(value)) return value.map(prepare);
|
|
101
|
+
if (value && typeof value === "object") return Object.fromEntries(Object.entries(value).map(([key, item]) => [key, prepare(item)]));
|
|
102
|
+
return value;
|
|
103
|
+
};
|
|
104
|
+
const scrub = (value: unknown): unknown => {
|
|
105
|
+
if (typeof value === "string") return mask(value);
|
|
106
|
+
if (Array.isArray(value)) return value.map(scrub);
|
|
107
|
+
if (value && typeof value === "object") return Object.fromEntries(Object.entries(value).map(([key, item]) => [mask(key), scrub(item)]));
|
|
108
|
+
return value;
|
|
109
|
+
};
|
|
110
|
+
const full = (value: unknown): unknown => scrub(project(prepare(value)));
|
|
111
|
+
return { full, encoded };
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Original-publication body policy for already-admitted data; defaults elsewhere remain per-call origin/generic privacy. */
|
|
115
|
+
export function createRunRecipeBodyRedactor(meta: Record<string, unknown>, maxTextChars?: number): (value: unknown) => unknown {
|
|
116
|
+
const { full } = capturedBodyPolicy(meta);
|
|
117
|
+
// All recorded content privacy precedes the existing display limit; no identity/source permission is minted.
|
|
118
|
+
return value => redactSessionEvidenceValue(full(value), maxTextChars);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/** Complete source text keeps public JSON spelling/BOM; never project its serialized protected JSON a second time. */
|
|
122
|
+
export function createRunRecipeTextRedactor(meta: Record<string, unknown>): (text: string) => string {
|
|
123
|
+
const { full, encoded } = capturedBodyPolicy(meta);
|
|
124
|
+
return text => {
|
|
125
|
+
const projected = encoded(text) ?? full(text);
|
|
126
|
+
if (typeof projected !== "string") throw new Error("Run captured text privacy must return text.");
|
|
127
|
+
return projected;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** Pure comparison for already-admitted closed reference data, never identity/source/body authority. */
|
|
132
|
+
export function createContextIdentityPrivacyCheck(original: Record<string, unknown>): (identity: object) => boolean {
|
|
133
|
+
const redact = createRunRecipeEvidenceRedactor(original, Number.MAX_SAFE_INTEGER), withoutSecrets = capturedSecretMask(original, "");
|
|
134
|
+
// Removal detects presence even when an original credential literally equals the display replacement token.
|
|
135
|
+
return identity => isDeepStrictEqual(redact(identity), identity) && Object.values(identity).every(value => typeof value !== "string" || withoutSecrets(value) === value);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface RunRecipeView {
|
|
139
|
+
composition: Array<Record<string, unknown>>;
|
|
140
|
+
definition?: Record<string, unknown>;
|
|
141
|
+
diagnostics: string[];
|
|
142
|
+
identity: Record<string, unknown>;
|
|
143
|
+
launch: Record<string, unknown>;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export function projectRunRecipe(meta: Record<string, unknown>, diagnostics: readonly string[] = [],
|
|
147
|
+
redactEvidence: (value: unknown) => unknown = createRunRecipeEvidenceRedactor(meta)): RunRecipeView {
|
|
148
|
+
const contexts = Array.isArray(meta.recipe_context_records)
|
|
149
|
+
? meta.recipe_context_records.filter(
|
|
150
|
+
(entry): entry is Record<string, unknown> =>
|
|
151
|
+
Boolean(entry && typeof entry === "object" && !Array.isArray(entry)),
|
|
152
|
+
)
|
|
153
|
+
: [];
|
|
154
|
+
const primary = contexts.find((entry) => entry.depth === 0) ?? contexts[0];
|
|
155
|
+
const definition =
|
|
156
|
+
primary?.recipe &&
|
|
157
|
+
typeof primary.recipe === "object" &&
|
|
158
|
+
!Array.isArray(primary.recipe)
|
|
159
|
+
? (primary.recipe as Record<string, unknown>)
|
|
160
|
+
: undefined;
|
|
161
|
+
const redactedRecord = (value: Record<string, unknown>): Record<string, unknown> =>
|
|
162
|
+
redactEvidence(value) as Record<string, unknown>;
|
|
163
|
+
const primarySourceKind =
|
|
164
|
+
primary?.source_kind === "active_skill_component"
|
|
165
|
+
? "active_skill_component"
|
|
166
|
+
: primary?.source_kind === "user_registry_capability" ||
|
|
167
|
+
meta.launch_source === "tool"
|
|
168
|
+
? "user_registry_capability"
|
|
169
|
+
: "explicit_file_recipe";
|
|
170
|
+
const primaryLogicalReference =
|
|
171
|
+
typeof primary?.logical_reference === "string"
|
|
172
|
+
? primary.logical_reference
|
|
173
|
+
: typeof primary?.name === "string"
|
|
174
|
+
? primary.name
|
|
175
|
+
: typeof meta.recipe === "string"
|
|
176
|
+
? meta.recipe
|
|
177
|
+
: "unknown";
|
|
178
|
+
const launchValues =
|
|
179
|
+
meta.values && typeof meta.values === "object" && !Array.isArray(meta.values)
|
|
180
|
+
? Object.fromEntries(
|
|
181
|
+
Object.entries(meta.values as Record<string, unknown>).filter(
|
|
182
|
+
([key]) => key !== "recipe_dir" && key !== "skill_dir",
|
|
183
|
+
),
|
|
184
|
+
)
|
|
185
|
+
: meta.values;
|
|
186
|
+
return {
|
|
187
|
+
composition: contexts.map((entry) =>
|
|
188
|
+
redactedRecord({
|
|
189
|
+
...(typeof entry.alias === "string" ? { alias: entry.alias } : {}),
|
|
190
|
+
depth: entry.depth,
|
|
191
|
+
import_path: entry.import_path,
|
|
192
|
+
logical_reference: entry.logical_reference ?? entry.name,
|
|
193
|
+
recipe_stem: entry.name,
|
|
194
|
+
role: entry.role,
|
|
195
|
+
...(typeof entry.skill === "string" ? { skill: entry.skill } : {}),
|
|
196
|
+
source_kind:
|
|
197
|
+
entry.source_kind === "active_skill_component"
|
|
198
|
+
? "active_skill_component"
|
|
199
|
+
: entry.source_kind === "user_registry_capability" ||
|
|
200
|
+
(entry.depth === 0 && meta.launch_source === "tool")
|
|
201
|
+
? "user_registry_capability"
|
|
202
|
+
: "explicit_file_recipe",
|
|
203
|
+
}),
|
|
204
|
+
),
|
|
205
|
+
...(definition ? { definition: redactedRecord(definition) } : {}),
|
|
206
|
+
diagnostics: diagnostics.map(value => redactEvidence(value) as string),
|
|
207
|
+
identity: redactedRecord({
|
|
208
|
+
run: meta.run,
|
|
209
|
+
recipe: meta.recipe,
|
|
210
|
+
recipe_stem: primary?.name ?? meta.recipe,
|
|
211
|
+
logical_reference: primaryLogicalReference,
|
|
212
|
+
...(typeof primary?.skill === "string" ? { skill: primary.skill } : {}),
|
|
213
|
+
source_kind: primarySourceKind,
|
|
214
|
+
launch_kind: meta.launch_kind ?? meta.launch_source,
|
|
215
|
+
launch_source: meta.launch_source,
|
|
216
|
+
...(meta.singleton === true
|
|
217
|
+
? { singleton: true, singleton_recipe_id: meta.singleton_recipe_id }
|
|
218
|
+
: {}),
|
|
219
|
+
}),
|
|
220
|
+
launch: redactedRecord({
|
|
221
|
+
cwd: meta.cwd,
|
|
222
|
+
template: meta.template,
|
|
223
|
+
values: launchValues,
|
|
224
|
+
model_policy: meta.model_policy,
|
|
225
|
+
control: meta.control,
|
|
226
|
+
artifacts: meta.artifacts,
|
|
227
|
+
notification_policy: meta.notification_policy,
|
|
228
|
+
retire_when: meta.retire_when,
|
|
229
|
+
singleton_values: meta.singleton_values,
|
|
230
|
+
}),
|
|
231
|
+
};
|
|
232
|
+
}
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
import { createHash } from "node:crypto";
|
|
8
8
|
import { writeFileSync } from "node:fs";
|
|
9
9
|
import { basename, resolve } from "node:path";
|
|
10
|
+
import { fileURLToPath } from "node:url";
|
|
10
11
|
|
|
11
12
|
import type { CommandTemplateActorRecipeContext } from "./command-templates.ts";
|
|
12
13
|
import * as RecipesReferences from "./recipes-references.ts";
|
|
@@ -64,8 +65,12 @@ function commandName(command: string): string {
|
|
|
64
65
|
return basename(command).toLowerCase();
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
|
|
68
|
-
|
|
68
|
+
const PI_NODE_CLI_PATHS = new Set(["./bundle/cli.js", "./cli.js"].map(path =>
|
|
69
|
+
fileURLToPath(new URL(path, import.meta.resolve("@earendil-works/pi-coding-agent")))));
|
|
70
|
+
|
|
71
|
+
function isPiCommand(command: string, args: string[]): boolean {
|
|
72
|
+
const name = commandName(command);
|
|
73
|
+
return name === "pi" || ((name === "node" || name === "node.exe") && PI_NODE_CLI_PATHS.has(args[0]));
|
|
69
74
|
}
|
|
70
75
|
|
|
71
76
|
const PI_PRINT_FLAGS = new Set(["-p", "--print"]);
|
|
@@ -136,6 +141,21 @@ export function findPiPrintPromptIndex(args: string[]): number | undefined {
|
|
|
136
141
|
return findPiPrintPromptIndexes(args).at(-1);
|
|
137
142
|
}
|
|
138
143
|
|
|
144
|
+
/** Pi text-print stdout (direct or resolved SDK CLI via Node) is the reply; JSON/RPC/interactive output is not. */
|
|
145
|
+
export function piPrintResponseMode(command: string, args: string[]): "text" | "unsupported" | undefined {
|
|
146
|
+
if (!isPiCommand(command, args)) return undefined;
|
|
147
|
+
let print = false, mode = "text";
|
|
148
|
+
for (let index = 0; index < args.length; index++) {
|
|
149
|
+
const arg = args[index]!;
|
|
150
|
+
if (arg === "--") break;
|
|
151
|
+
if (isPiPrintFlag(arg)) print = true;
|
|
152
|
+
else if (arg === "--mode") mode = args[++index] ?? "";
|
|
153
|
+
else if (arg.startsWith("--mode=")) mode = arg.slice(7);
|
|
154
|
+
else if (piOptionConsumesNextArg(arg)) index++;
|
|
155
|
+
}
|
|
156
|
+
return print && mode === "text" ? "text" : "unsupported";
|
|
157
|
+
}
|
|
158
|
+
|
|
139
159
|
function matchesActorContext(
|
|
140
160
|
record: TemplateRecipeContextRecord,
|
|
141
161
|
context: CommandTemplateActorRecipeContext | undefined,
|
|
@@ -202,7 +222,7 @@ export function appendRecipeContextToPiArgs(
|
|
|
202
222
|
records: TemplateRecipeContextRecord[] | undefined,
|
|
203
223
|
context?: CommandTemplateActorRecipeContext,
|
|
204
224
|
): string[] {
|
|
205
|
-
if (!records || records.length === 0 || !isPiCommand(command)) return args;
|
|
225
|
+
if (!records || records.length === 0 || !isPiCommand(command, args)) return args;
|
|
206
226
|
const promptIndex = findPiPrintPromptIndex(args);
|
|
207
227
|
if (promptIndex === undefined) return args;
|
|
208
228
|
const block = buildRecipeContextPromptBlock(records, context);
|
|
@@ -230,11 +250,12 @@ export function attachPiSessionDir(
|
|
|
230
250
|
args: string[],
|
|
231
251
|
sessionDir: string,
|
|
232
252
|
): ManagedPiSessionArgs {
|
|
233
|
-
if (!isPiCommand(command) || findPiPrintPromptIndex(args) === undefined) {
|
|
253
|
+
if (!isPiCommand(command, args) || findPiPrintPromptIndex(args) === undefined) {
|
|
234
254
|
return { args };
|
|
235
255
|
}
|
|
236
256
|
if (args.some((arg) => PI_SESSION_POLICY_FLAGS.has(arg))) return { args };
|
|
237
|
-
|
|
257
|
+
const prefix = commandName(command) === "pi" ? 0 : 1;
|
|
258
|
+
return { args: [...args.slice(0, prefix), "--session-dir", sessionDir, ...args.slice(prefix)], sessionDir };
|
|
238
259
|
}
|
|
239
260
|
|
|
240
261
|
export interface MaterializedPiPrintPromptArgs {
|
|
@@ -248,7 +269,7 @@ export function materializePiPrintPromptArg(
|
|
|
248
269
|
args: string[],
|
|
249
270
|
promptFile: string | (() => string),
|
|
250
271
|
): MaterializedPiPrintPromptArgs {
|
|
251
|
-
if (!isPiCommand(command)) return { args };
|
|
272
|
+
if (!isPiCommand(command, args)) return { args };
|
|
252
273
|
const promptIndexes = findPiPrintPromptIndexes(args);
|
|
253
274
|
if (promptIndexes.length === 0) return { args };
|
|
254
275
|
const prompt = promptIndexes.map((index) => args[index]).join(" ");
|