@llblab/pi-kit 0.1.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/AGENTS.md +35 -0
- package/BACKLOG.md +3 -0
- package/CHANGELOG.md +9 -0
- package/LICENSE +21 -0
- package/README.md +43 -0
- package/node_modules/@llblab/pi-actors/AGENTS.md +150 -0
- package/node_modules/@llblab/pi-actors/BACKLOG.md +6 -0
- package/node_modules/@llblab/pi-actors/CHANGELOG.md +865 -0
- package/node_modules/@llblab/pi-actors/README.md +231 -0
- package/node_modules/@llblab/pi-actors/banner.jpg +0 -0
- package/node_modules/@llblab/pi-actors/dist/fixtures/protocol/artifact-manifest.json +9 -0
- package/node_modules/@llblab/pi-actors/dist/fixtures/protocol/control-endpoint.json +6 -0
- package/node_modules/@llblab/pi-actors/dist/fixtures/protocol/control-record.json +9 -0
- package/node_modules/@llblab/pi-actors/dist/fixtures/protocol/recipe-summary.json +8 -0
- package/node_modules/@llblab/pi-actors/dist/fixtures/protocol/run-state.json +10 -0
- package/node_modules/@llblab/pi-actors/dist/fixtures/protocol/trace-event.json +9 -0
- package/node_modules/@llblab/pi-actors/dist/index.d.ts +7 -0
- package/node_modules/@llblab/pi-actors/dist/index.js +17 -0
- package/node_modules/@llblab/pi-actors/dist/lib/async-runs.d.ts +146 -0
- package/node_modules/@llblab/pi-actors/dist/lib/async-runs.js +800 -0
- package/node_modules/@llblab/pi-actors/dist/lib/automatic-review-runtime.d.ts +20 -0
- package/node_modules/@llblab/pi-actors/dist/lib/automatic-review-runtime.js +103 -0
- package/node_modules/@llblab/pi-actors/dist/lib/command-templates.d.ts +85 -0
- package/node_modules/@llblab/pi-actors/dist/lib/command-templates.js +804 -0
- package/node_modules/@llblab/pi-actors/dist/lib/config.d.ts +34 -0
- package/node_modules/@llblab/pi-actors/dist/lib/config.js +216 -0
- package/node_modules/@llblab/pi-actors/dist/lib/control-projection.d.ts +20 -0
- package/node_modules/@llblab/pi-actors/dist/lib/control-projection.js +66 -0
- package/node_modules/@llblab/pi-actors/dist/lib/control.d.ts +15 -0
- package/node_modules/@llblab/pi-actors/dist/lib/control.js +97 -0
- package/node_modules/@llblab/pi-actors/dist/lib/draft-consolidation-transaction.d.ts +65 -0
- package/node_modules/@llblab/pi-actors/dist/lib/draft-consolidation-transaction.js +610 -0
- package/node_modules/@llblab/pi-actors/dist/lib/draft-consolidation.d.ts +35 -0
- package/node_modules/@llblab/pi-actors/dist/lib/draft-consolidation.js +126 -0
- package/node_modules/@llblab/pi-actors/dist/lib/draft-review.d.ts +56 -0
- package/node_modules/@llblab/pi-actors/dist/lib/draft-review.js +254 -0
- package/node_modules/@llblab/pi-actors/dist/lib/draft-sleep.d.ts +65 -0
- package/node_modules/@llblab/pi-actors/dist/lib/draft-sleep.js +467 -0
- package/node_modules/@llblab/pi-actors/dist/lib/execution-output.d.ts +25 -0
- package/node_modules/@llblab/pi-actors/dist/lib/execution-output.js +88 -0
- package/node_modules/@llblab/pi-actors/dist/lib/execution-sessions.d.ts +17 -0
- package/node_modules/@llblab/pi-actors/dist/lib/execution-sessions.js +85 -0
- package/node_modules/@llblab/pi-actors/dist/lib/execution.d.ts +99 -0
- package/node_modules/@llblab/pi-actors/dist/lib/execution.js +725 -0
- package/node_modules/@llblab/pi-actors/dist/lib/extension-runtime.d.ts +21 -0
- package/node_modules/@llblab/pi-actors/dist/lib/extension-runtime.js +141 -0
- package/node_modules/@llblab/pi-actors/dist/lib/file-state.d.ts +18 -0
- package/node_modules/@llblab/pi-actors/dist/lib/file-state.js +310 -0
- package/node_modules/@llblab/pi-actors/dist/lib/identity.d.ts +9 -0
- package/node_modules/@llblab/pi-actors/dist/lib/identity.js +27 -0
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-actions.d.ts +16 -0
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-actions.js +57 -0
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-command.d.ts +7 -0
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-command.js +37 -0
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-overlay.d.ts +100 -0
- package/node_modules/@llblab/pi-actors/dist/lib/inspector-overlay.js +824 -0
- package/node_modules/@llblab/pi-actors/dist/lib/inspector.d.ts +20 -0
- package/node_modules/@llblab/pi-actors/dist/lib/inspector.js +136 -0
- package/node_modules/@llblab/pi-actors/dist/lib/limits.d.ts +28 -0
- package/node_modules/@llblab/pi-actors/dist/lib/limits.js +28 -0
- package/node_modules/@llblab/pi-actors/dist/lib/model-context.d.ts +56 -0
- package/node_modules/@llblab/pi-actors/dist/lib/model-context.js +220 -0
- package/node_modules/@llblab/pi-actors/dist/lib/observability.d.ts +186 -0
- package/node_modules/@llblab/pi-actors/dist/lib/observability.js +951 -0
- package/node_modules/@llblab/pi-actors/dist/lib/paths.d.ts +27 -0
- package/node_modules/@llblab/pi-actors/dist/lib/paths.js +72 -0
- package/node_modules/@llblab/pi-actors/dist/lib/pi.d.ts +19 -0
- package/node_modules/@llblab/pi-actors/dist/lib/pi.js +21 -0
- package/node_modules/@llblab/pi-actors/dist/lib/preflight-diagnostics.d.ts +27 -0
- package/node_modules/@llblab/pi-actors/dist/lib/preflight-diagnostics.js +86 -0
- package/node_modules/@llblab/pi-actors/dist/lib/prompts.d.ts +24 -0
- package/node_modules/@llblab/pi-actors/dist/lib/prompts.js +49 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipe-control.d.ts +7 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipe-control.js +43 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipes-context.d.ts +36 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipes-context.js +197 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipes-discovery.d.ts +77 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipes-discovery.js +783 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipes-references.d.ts +113 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipes-references.js +1108 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipes-usage.d.ts +21 -0
- package/node_modules/@llblab/pi-actors/dist/lib/recipes-usage.js +494 -0
- package/node_modules/@llblab/pi-actors/dist/lib/registry.d.ts +67 -0
- package/node_modules/@llblab/pi-actors/dist/lib/registry.js +504 -0
- package/node_modules/@llblab/pi-actors/dist/lib/review-control.d.ts +14 -0
- package/node_modules/@llblab/pi-actors/dist/lib/review-control.js +110 -0
- package/node_modules/@llblab/pi-actors/dist/lib/review-diagnostics.d.ts +11 -0
- package/node_modules/@llblab/pi-actors/dist/lib/review-diagnostics.js +148 -0
- package/node_modules/@llblab/pi-actors/dist/lib/review-projection.d.ts +14 -0
- package/node_modules/@llblab/pi-actors/dist/lib/review-projection.js +166 -0
- package/node_modules/@llblab/pi-actors/dist/lib/run-evidence-policy.d.ts +95 -0
- package/node_modules/@llblab/pi-actors/dist/lib/run-evidence-policy.js +177 -0
- package/node_modules/@llblab/pi-actors/dist/lib/run-ui-runtime.d.ts +18 -0
- package/node_modules/@llblab/pi-actors/dist/lib/run-ui-runtime.js +125 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-artifacts.d.ts +21 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-artifacts.js +68 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-control-delivery.d.ts +28 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-control-delivery.js +150 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-control.d.ts +21 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-control.js +89 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-controls.d.ts +39 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-controls.js +283 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-identity.d.ts +5 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-identity.js +11 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-index.d.ts +27 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-index.js +142 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-ownership.d.ts +7 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-ownership.js +96 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-parent-teardown.d.ts +51 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-parent-teardown.js +172 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-process.d.ts +22 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-process.js +125 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-retention.d.ts +18 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-retention.js +108 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-start.d.ts +12 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-start.js +68 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-status.d.ts +10 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-status.js +68 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-trace.d.ts +48 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runs-trace.js +491 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runtime-identity.d.ts +7 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runtime-identity.js +35 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runtime-triage.d.ts +29 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runtime-triage.js +60 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runtime.d.ts +69 -0
- package/node_modules/@llblab/pi-actors/dist/lib/runtime.js +339 -0
- package/node_modules/@llblab/pi-actors/dist/lib/schema.d.ts +60 -0
- package/node_modules/@llblab/pi-actors/dist/lib/schema.js +428 -0
- package/node_modules/@llblab/pi-actors/dist/lib/session-evidence.d.ts +45 -0
- package/node_modules/@llblab/pi-actors/dist/lib/session-evidence.js +204 -0
- package/node_modules/@llblab/pi-actors/dist/lib/state-readers.d.ts +21 -0
- package/node_modules/@llblab/pi-actors/dist/lib/state-readers.js +74 -0
- package/node_modules/@llblab/pi-actors/dist/lib/temp.d.ts +10 -0
- package/node_modules/@llblab/pi-actors/dist/lib/temp.js +90 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tool-review-lineage-transaction.d.ts +27 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tool-review-lineage-transaction.js +597 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tool-review-lineage.d.ts +24 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tool-review-lineage.js +98 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tool-review-scheduler.d.ts +80 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tool-review-scheduler.js +494 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tool-review-transaction.d.ts +50 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tool-review-transaction.js +362 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tool-review.d.ts +56 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tool-review.js +197 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-access.d.ts +19 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-access.js +44 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-inspect.d.ts +15 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-inspect.js +532 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-local.d.ts +17 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-local.js +191 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-message.d.ts +9 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-message.js +139 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-register.d.ts +18 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-register.js +41 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-response.d.ts +20 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-response.js +243 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-spawn.d.ts +15 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools-spawn.js +133 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools.d.ts +28 -0
- package/node_modules/@llblab/pi-actors/dist/lib/tools.js +49 -0
- package/node_modules/@llblab/pi-actors/dist/lib/trace-projection.d.ts +22 -0
- package/node_modules/@llblab/pi-actors/dist/lib/trace-projection.js +231 -0
- package/node_modules/@llblab/pi-actors/dist/pi-actors/index.js +1 -0
- package/node_modules/@llblab/pi-actors/dist/scripts/async-runner.mjs +555 -0
- package/node_modules/@llblab/pi-actors/dist/scripts/build-dist.mjs +60 -0
- package/node_modules/@llblab/pi-actors/dist/scripts/conformance.mjs +63 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/SKILL.md +126 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/command-validate.json +13 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/jsonl-tail.json +10 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/recipe-validate.json +11 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/resource-locker-snapshot.json +11 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/resource-locker.json +25 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/run-ops-snapshot.json +15 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/run-state-files.json +13 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/recipes/run-summary.json +9 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/references/diagnostics.md +44 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/references/persistent-tools.md +76 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/references/recipes.md +51 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/references/runs.md +41 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/scripts/resource-locker.mjs +425 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/scripts/run-utils.mjs +164 -0
- package/node_modules/@llblab/pi-actors/dist/skills/actors/scripts/validate-recipe.mjs +370 -0
- package/node_modules/@llblab/pi-actors/dist/skills/artifacts/SKILL.md +33 -0
- package/node_modules/@llblab/pi-actors/dist/skills/artifacts/recipes/bundle.json +77 -0
- package/node_modules/@llblab/pi-actors/dist/skills/artifacts/recipes/file-write.json +14 -0
- package/node_modules/@llblab/pi-actors/dist/skills/artifacts/recipes/manifest.json +14 -0
- package/node_modules/@llblab/pi-actors/dist/skills/artifacts/recipes/report.json +39 -0
- package/node_modules/@llblab/pi-actors/dist/skills/artifacts/recipes/write.json +53 -0
- package/node_modules/@llblab/pi-actors/dist/skills/artifacts/scripts/artifact-utils.mjs +63 -0
- package/node_modules/@llblab/pi-actors/dist/skills/music-player/SKILL.md +57 -0
- package/node_modules/@llblab/pi-actors/dist/skills/music-player/genapps/music-player.mjs +360 -0
- package/node_modules/@llblab/pi-actors/dist/skills/music-player/recipes/playback.json +29 -0
- package/node_modules/@llblab/pi-actors/dist/skills/music-player/scripts/playback-client.mjs +143 -0
- package/node_modules/@llblab/pi-actors/dist/skills/music-player/scripts/playback.mjs +1446 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/SKILL.md +37 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/changelog-head.json +11 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/changelog-section.json +11 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/docs-maintenance.json +66 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/git-log.json +11 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/git-status.json +9 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/markdown-index.json +14 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/package-summary.json +9 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/release-readiness.json +115 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/release-summary.json +74 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/repo-health.json +75 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/run-ops.json +56 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/recipes/skill-summary.json +11 -0
- package/node_modules/@llblab/pi-actors/dist/skills/project-work/scripts/project-utils.mjs +89 -0
- package/node_modules/@llblab/pi-actors/dist/skills/recipe-memory/SKILL.md +36 -0
- package/node_modules/@llblab/pi-actors/dist/skills/recipe-memory/recipes/draft-review.json +14 -0
- package/node_modules/@llblab/pi-actors/dist/skills/recipe-memory/recipes/tool-review.json +14 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/SKILL.md +84 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/architect.json +82 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/checkpoint-continuation.json +51 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/development-tasking.json +67 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/lens-review.json +63 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/quorum-review.json +65 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/research-synthesis.json +81 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/review-readiness.json +59 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-artifact.json +21 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-checkpoint.json +21 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-conflict-report.json +19 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-contradiction-map.json +20 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-critic.json +22 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-evidence-map.json +20 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-followup.json +21 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-judge.json +22 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-merge.json +24 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-normalize.json +20 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-plan.json +20 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-preflight.json +18 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-prompt.json +16 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-prompts.json +39 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-quorum.json +31 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-review-coordinator.json +170 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-review.json +26 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-task-card.json +22 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-tools.json +15 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/recipes/subagent-verify.json +23 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/references/development-swarm.md +189 -0
- package/node_modules/@llblab/pi-actors/dist/skills/swarm/references/review-swarms.md +115 -0
- package/node_modules/@llblab/pi-actors/docs/README.md +20 -0
- package/node_modules/@llblab/pi-actors/docs/actor-inspector.md +50 -0
- package/node_modules/@llblab/pi-actors/docs/async-runs.md +141 -0
- package/node_modules/@llblab/pi-actors/docs/command-templates.md +321 -0
- package/node_modules/@llblab/pi-actors/docs/recipe-library.md +89 -0
- package/node_modules/@llblab/pi-actors/docs/releasing.md +28 -0
- package/node_modules/@llblab/pi-actors/docs/template-recipes.md +175 -0
- package/node_modules/@llblab/pi-actors/docs/tool-registry.md +90 -0
- package/node_modules/@llblab/pi-actors/fixtures/protocol/artifact-manifest.json +9 -0
- package/node_modules/@llblab/pi-actors/fixtures/protocol/control-endpoint.json +6 -0
- package/node_modules/@llblab/pi-actors/fixtures/protocol/control-record.json +9 -0
- package/node_modules/@llblab/pi-actors/fixtures/protocol/recipe-summary.json +8 -0
- package/node_modules/@llblab/pi-actors/fixtures/protocol/run-state.json +10 -0
- package/node_modules/@llblab/pi-actors/fixtures/protocol/trace-event.json +9 -0
- package/node_modules/@llblab/pi-actors/index.ts +30 -0
- package/node_modules/@llblab/pi-actors/lib/async-runs.ts +1245 -0
- package/node_modules/@llblab/pi-actors/lib/automatic-review-runtime.ts +148 -0
- package/node_modules/@llblab/pi-actors/lib/command-templates.ts +1116 -0
- package/node_modules/@llblab/pi-actors/lib/config.ts +261 -0
- package/node_modules/@llblab/pi-actors/lib/control-projection.ts +105 -0
- package/node_modules/@llblab/pi-actors/lib/control.ts +117 -0
- package/node_modules/@llblab/pi-actors/lib/draft-consolidation-transaction.ts +821 -0
- package/node_modules/@llblab/pi-actors/lib/draft-consolidation.ts +181 -0
- package/node_modules/@llblab/pi-actors/lib/draft-review.ts +325 -0
- package/node_modules/@llblab/pi-actors/lib/draft-sleep.ts +575 -0
- package/node_modules/@llblab/pi-actors/lib/execution-output.ts +123 -0
- package/node_modules/@llblab/pi-actors/lib/execution-sessions.ts +111 -0
- package/node_modules/@llblab/pi-actors/lib/execution.ts +1153 -0
- package/node_modules/@llblab/pi-actors/lib/extension-runtime.ts +181 -0
- package/node_modules/@llblab/pi-actors/lib/file-state.ts +306 -0
- package/node_modules/@llblab/pi-actors/lib/identity.ts +29 -0
- package/node_modules/@llblab/pi-actors/lib/inspector-actions.ts +79 -0
- package/node_modules/@llblab/pi-actors/lib/inspector-command.ts +54 -0
- package/node_modules/@llblab/pi-actors/lib/inspector-overlay.ts +901 -0
- package/node_modules/@llblab/pi-actors/lib/inspector.ts +204 -0
- package/node_modules/@llblab/pi-actors/lib/limits.ts +29 -0
- package/node_modules/@llblab/pi-actors/lib/model-context.ts +359 -0
- package/node_modules/@llblab/pi-actors/lib/observability.ts +1337 -0
- package/node_modules/@llblab/pi-actors/lib/paths.ts +111 -0
- package/node_modules/@llblab/pi-actors/lib/pi.ts +47 -0
- package/node_modules/@llblab/pi-actors/lib/preflight-diagnostics.ts +132 -0
- package/node_modules/@llblab/pi-actors/lib/prompts.ts +69 -0
- package/node_modules/@llblab/pi-actors/lib/recipe-control.ts +52 -0
- package/node_modules/@llblab/pi-actors/lib/recipes-context.ts +268 -0
- package/node_modules/@llblab/pi-actors/lib/recipes-discovery.ts +1060 -0
- package/node_modules/@llblab/pi-actors/lib/recipes-references.ts +1598 -0
- package/node_modules/@llblab/pi-actors/lib/recipes-usage.ts +638 -0
- package/node_modules/@llblab/pi-actors/lib/registry.ts +806 -0
- package/node_modules/@llblab/pi-actors/lib/review-control.ts +136 -0
- package/node_modules/@llblab/pi-actors/lib/review-diagnostics.ts +164 -0
- package/node_modules/@llblab/pi-actors/lib/review-projection.ts +196 -0
- package/node_modules/@llblab/pi-actors/lib/run-evidence-policy.ts +242 -0
- package/node_modules/@llblab/pi-actors/lib/run-ui-runtime.ts +155 -0
- package/node_modules/@llblab/pi-actors/lib/runs-artifacts.ts +96 -0
- package/node_modules/@llblab/pi-actors/lib/runs-control-delivery.ts +209 -0
- package/node_modules/@llblab/pi-actors/lib/runs-control.ts +148 -0
- package/node_modules/@llblab/pi-actors/lib/runs-controls.ts +282 -0
- package/node_modules/@llblab/pi-actors/lib/runs-identity.ts +14 -0
- package/node_modules/@llblab/pi-actors/lib/runs-index.ts +192 -0
- package/node_modules/@llblab/pi-actors/lib/runs-ownership.ts +136 -0
- package/node_modules/@llblab/pi-actors/lib/runs-parent-teardown.ts +257 -0
- package/node_modules/@llblab/pi-actors/lib/runs-process.ts +174 -0
- package/node_modules/@llblab/pi-actors/lib/runs-retention.ts +140 -0
- package/node_modules/@llblab/pi-actors/lib/runs-start.ts +113 -0
- package/node_modules/@llblab/pi-actors/lib/runs-status.ts +101 -0
- package/node_modules/@llblab/pi-actors/lib/runs-trace.ts +611 -0
- package/node_modules/@llblab/pi-actors/lib/runtime-identity.ts +39 -0
- package/node_modules/@llblab/pi-actors/lib/runtime-triage.ts +106 -0
- package/node_modules/@llblab/pi-actors/lib/runtime.ts +430 -0
- package/node_modules/@llblab/pi-actors/lib/schema.ts +525 -0
- package/node_modules/@llblab/pi-actors/lib/session-evidence.ts +302 -0
- package/node_modules/@llblab/pi-actors/lib/state-readers.ts +93 -0
- package/node_modules/@llblab/pi-actors/lib/temp.ts +99 -0
- package/node_modules/@llblab/pi-actors/lib/tool-review-lineage-transaction.ts +881 -0
- package/node_modules/@llblab/pi-actors/lib/tool-review-lineage.ts +145 -0
- package/node_modules/@llblab/pi-actors/lib/tool-review-scheduler.ts +635 -0
- package/node_modules/@llblab/pi-actors/lib/tool-review-transaction.ts +563 -0
- package/node_modules/@llblab/pi-actors/lib/tool-review.ts +270 -0
- package/node_modules/@llblab/pi-actors/lib/tools-access.ts +68 -0
- package/node_modules/@llblab/pi-actors/lib/tools-inspect.ts +673 -0
- package/node_modules/@llblab/pi-actors/lib/tools-local.ts +303 -0
- package/node_modules/@llblab/pi-actors/lib/tools-message.ts +176 -0
- package/node_modules/@llblab/pi-actors/lib/tools-register.ts +63 -0
- package/node_modules/@llblab/pi-actors/lib/tools-response.ts +285 -0
- package/node_modules/@llblab/pi-actors/lib/tools-spawn.ts +212 -0
- package/node_modules/@llblab/pi-actors/lib/tools.ts +88 -0
- package/node_modules/@llblab/pi-actors/lib/trace-projection.ts +306 -0
- package/node_modules/@llblab/pi-actors/package.json +76 -0
- package/node_modules/@llblab/pi-actors/scripts/async-runner.mjs +555 -0
- package/node_modules/@llblab/pi-actors/scripts/build-dist.mjs +60 -0
- package/node_modules/@llblab/pi-actors/scripts/conformance.mjs +63 -0
- package/node_modules/@llblab/pi-actors/skills/actors/SKILL.md +126 -0
- package/node_modules/@llblab/pi-actors/skills/actors/recipes/command-validate.json +13 -0
- package/node_modules/@llblab/pi-actors/skills/actors/recipes/jsonl-tail.json +10 -0
- package/node_modules/@llblab/pi-actors/skills/actors/recipes/recipe-validate.json +11 -0
- package/node_modules/@llblab/pi-actors/skills/actors/recipes/resource-locker-snapshot.json +11 -0
- package/node_modules/@llblab/pi-actors/skills/actors/recipes/resource-locker.json +25 -0
- package/node_modules/@llblab/pi-actors/skills/actors/recipes/run-ops-snapshot.json +15 -0
- package/node_modules/@llblab/pi-actors/skills/actors/recipes/run-state-files.json +13 -0
- package/node_modules/@llblab/pi-actors/skills/actors/recipes/run-summary.json +9 -0
- package/node_modules/@llblab/pi-actors/skills/actors/references/diagnostics.md +44 -0
- package/node_modules/@llblab/pi-actors/skills/actors/references/persistent-tools.md +76 -0
- package/node_modules/@llblab/pi-actors/skills/actors/references/recipes.md +51 -0
- package/node_modules/@llblab/pi-actors/skills/actors/references/runs.md +41 -0
- package/node_modules/@llblab/pi-actors/skills/actors/scripts/resource-locker.mjs +425 -0
- package/node_modules/@llblab/pi-actors/skills/actors/scripts/run-utils.mjs +164 -0
- package/node_modules/@llblab/pi-actors/skills/actors/scripts/validate-recipe.mjs +370 -0
- package/node_modules/@llblab/pi-actors/skills/artifacts/SKILL.md +33 -0
- package/node_modules/@llblab/pi-actors/skills/artifacts/recipes/bundle.json +77 -0
- package/node_modules/@llblab/pi-actors/skills/artifacts/recipes/file-write.json +14 -0
- package/node_modules/@llblab/pi-actors/skills/artifacts/recipes/manifest.json +14 -0
- package/node_modules/@llblab/pi-actors/skills/artifacts/recipes/report.json +39 -0
- package/node_modules/@llblab/pi-actors/skills/artifacts/recipes/write.json +53 -0
- package/node_modules/@llblab/pi-actors/skills/artifacts/scripts/artifact-utils.mjs +63 -0
- package/node_modules/@llblab/pi-actors/skills/music-player/SKILL.md +57 -0
- package/node_modules/@llblab/pi-actors/skills/music-player/genapps/music-player.mjs +360 -0
- package/node_modules/@llblab/pi-actors/skills/music-player/recipes/playback.json +29 -0
- package/node_modules/@llblab/pi-actors/skills/music-player/scripts/playback-client.mjs +143 -0
- package/node_modules/@llblab/pi-actors/skills/music-player/scripts/playback.mjs +1446 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/SKILL.md +37 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/changelog-head.json +11 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/changelog-section.json +11 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/docs-maintenance.json +66 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/git-log.json +11 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/git-status.json +9 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/markdown-index.json +14 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/package-summary.json +9 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/release-readiness.json +115 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/release-summary.json +74 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/repo-health.json +75 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/run-ops.json +56 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/recipes/skill-summary.json +11 -0
- package/node_modules/@llblab/pi-actors/skills/project-work/scripts/project-utils.mjs +89 -0
- package/node_modules/@llblab/pi-actors/skills/recipe-memory/SKILL.md +36 -0
- package/node_modules/@llblab/pi-actors/skills/recipe-memory/recipes/draft-review.json +14 -0
- package/node_modules/@llblab/pi-actors/skills/recipe-memory/recipes/tool-review.json +14 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/SKILL.md +84 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/architect.json +82 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/checkpoint-continuation.json +51 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/development-tasking.json +67 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/lens-review.json +63 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/quorum-review.json +65 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/research-synthesis.json +81 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/review-readiness.json +59 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-artifact.json +21 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-checkpoint.json +21 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-conflict-report.json +19 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-contradiction-map.json +20 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-critic.json +22 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-evidence-map.json +20 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-followup.json +21 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-judge.json +22 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-merge.json +24 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-normalize.json +20 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-plan.json +20 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-preflight.json +18 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-prompt.json +16 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-prompts.json +39 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-quorum.json +31 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-review-coordinator.json +170 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-review.json +26 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-task-card.json +22 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-tools.json +15 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/recipes/subagent-verify.json +23 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/references/development-swarm.md +189 -0
- package/node_modules/@llblab/pi-actors/skills/swarm/references/review-swarms.md +115 -0
- package/node_modules/@llblab/pi-codex-usage/AGENTS.md +17 -0
- package/node_modules/@llblab/pi-codex-usage/BACKLOG.md +8 -0
- package/node_modules/@llblab/pi-codex-usage/CHANGELOG.md +80 -0
- package/node_modules/@llblab/pi-codex-usage/LICENSE +22 -0
- package/node_modules/@llblab/pi-codex-usage/README.md +113 -0
- package/node_modules/@llblab/pi-codex-usage/banner.jpg +0 -0
- package/node_modules/@llblab/pi-codex-usage/index.ts +1525 -0
- package/node_modules/@llblab/pi-codex-usage/package.json +59 -0
- package/node_modules/@llblab/pi-grow-loop/AGENTS.md +56 -0
- package/node_modules/@llblab/pi-grow-loop/BACKLOG.md +3 -0
- package/node_modules/@llblab/pi-grow-loop/CHANGELOG.md +126 -0
- package/node_modules/@llblab/pi-grow-loop/README.md +216 -0
- package/node_modules/@llblab/pi-grow-loop/banner.jpg +0 -0
- package/node_modules/@llblab/pi-grow-loop/index.ts +219 -0
- package/node_modules/@llblab/pi-grow-loop/package.json +64 -0
- package/node_modules/@llblab/pi-grow-loop/skills/grow-loop/SKILL.md +131 -0
- package/node_modules/@llblab/pi-grow-loop/skills/while-true/SKILL.md +233 -0
- package/node_modules/@llblab/pi-telegram/AGENTS.md +157 -0
- package/node_modules/@llblab/pi-telegram/BACKLOG.md +15 -0
- package/node_modules/@llblab/pi-telegram/CHANGELOG.md +886 -0
- package/node_modules/@llblab/pi-telegram/README.md +330 -0
- package/node_modules/@llblab/pi-telegram/api/activity.ts +15 -0
- package/node_modules/@llblab/pi-telegram/api/commands.ts +11 -0
- package/node_modules/@llblab/pi-telegram/api/delivery.ts +21 -0
- package/node_modules/@llblab/pi-telegram/api/inbound.ts +14 -0
- package/node_modules/@llblab/pi-telegram/api/keyboard.ts +11 -0
- package/node_modules/@llblab/pi-telegram/api/outbound.ts +11 -0
- package/node_modules/@llblab/pi-telegram/api/sections.ts +17 -0
- package/node_modules/@llblab/pi-telegram/api/status.ts +12 -0
- package/node_modules/@llblab/pi-telegram/api/updates.ts +16 -0
- package/node_modules/@llblab/pi-telegram/api/voice.ts +24 -0
- package/node_modules/@llblab/pi-telegram/docs/README.md +25 -0
- package/node_modules/@llblab/pi-telegram/docs/activity.md +304 -0
- package/node_modules/@llblab/pi-telegram/docs/architecture.md +418 -0
- package/node_modules/@llblab/pi-telegram/docs/callback-namespaces.md +48 -0
- package/node_modules/@llblab/pi-telegram/docs/command-templates.md +365 -0
- package/node_modules/@llblab/pi-telegram/docs/compact-matrix-literal.md +176 -0
- package/node_modules/@llblab/pi-telegram/docs/delivery.md +225 -0
- package/node_modules/@llblab/pi-telegram/docs/generative-apps.md +310 -0
- package/node_modules/@llblab/pi-telegram/docs/inbound.md +136 -0
- package/node_modules/@llblab/pi-telegram/docs/multi-instance-bus.md +467 -0
- package/node_modules/@llblab/pi-telegram/docs/outbound.md +193 -0
- package/node_modules/@llblab/pi-telegram/docs/public-api.md +599 -0
- package/node_modules/@llblab/pi-telegram/docs/sections.md +452 -0
- package/node_modules/@llblab/pi-telegram/docs/ui-style.md +256 -0
- package/node_modules/@llblab/pi-telegram/docs/updates.md +171 -0
- package/node_modules/@llblab/pi-telegram/docs/voice.md +217 -0
- package/node_modules/@llblab/pi-telegram/index.ts +1336 -0
- package/node_modules/@llblab/pi-telegram/lib/activity-verbosity.ts +714 -0
- package/node_modules/@llblab/pi-telegram/lib/activity.ts +782 -0
- package/node_modules/@llblab/pi-telegram/lib/agent-messages.ts +121 -0
- package/node_modules/@llblab/pi-telegram/lib/bindings.ts +1129 -0
- package/node_modules/@llblab/pi-telegram/lib/bus-api.ts +379 -0
- package/node_modules/@llblab/pi-telegram/lib/bus-follower.ts +1941 -0
- package/node_modules/@llblab/pi-telegram/lib/bus-leader.ts +2119 -0
- package/node_modules/@llblab/pi-telegram/lib/bus-transport.ts +244 -0
- package/node_modules/@llblab/pi-telegram/lib/bus.ts +2645 -0
- package/node_modules/@llblab/pi-telegram/lib/command-templates.ts +954 -0
- package/node_modules/@llblab/pi-telegram/lib/commands.ts +1854 -0
- package/node_modules/@llblab/pi-telegram/lib/config.ts +1143 -0
- package/node_modules/@llblab/pi-telegram/lib/delivery.ts +891 -0
- package/node_modules/@llblab/pi-telegram/lib/generative-app-worker.mjs +104 -0
- package/node_modules/@llblab/pi-telegram/lib/generative-apps.ts +958 -0
- package/node_modules/@llblab/pi-telegram/lib/inbound.ts +824 -0
- package/node_modules/@llblab/pi-telegram/lib/journal.ts +3140 -0
- package/node_modules/@llblab/pi-telegram/lib/keyboard.ts +59 -0
- package/node_modules/@llblab/pi-telegram/lib/lifecycle.ts +623 -0
- package/node_modules/@llblab/pi-telegram/lib/locks.ts +1422 -0
- package/node_modules/@llblab/pi-telegram/lib/logs.ts +393 -0
- package/node_modules/@llblab/pi-telegram/lib/media.ts +921 -0
- package/node_modules/@llblab/pi-telegram/lib/menu-model.ts +1182 -0
- package/node_modules/@llblab/pi-telegram/lib/menu-queue.ts +926 -0
- package/node_modules/@llblab/pi-telegram/lib/menu-settings.ts +876 -0
- package/node_modules/@llblab/pi-telegram/lib/menu-status.ts +274 -0
- package/node_modules/@llblab/pi-telegram/lib/menu-thinking.ts +185 -0
- package/node_modules/@llblab/pi-telegram/lib/menu.ts +867 -0
- package/node_modules/@llblab/pi-telegram/lib/model.ts +672 -0
- package/node_modules/@llblab/pi-telegram/lib/outbound-attachments.ts +981 -0
- package/node_modules/@llblab/pi-telegram/lib/outbound-buttons.ts +331 -0
- package/node_modules/@llblab/pi-telegram/lib/outbound-markup.ts +515 -0
- package/node_modules/@llblab/pi-telegram/lib/outbound-voice.ts +285 -0
- package/node_modules/@llblab/pi-telegram/lib/outbound.ts +1007 -0
- package/node_modules/@llblab/pi-telegram/lib/ownership.ts +298 -0
- package/node_modules/@llblab/pi-telegram/lib/paths.ts +127 -0
- package/node_modules/@llblab/pi-telegram/lib/pi.ts +197 -0
- package/node_modules/@llblab/pi-telegram/lib/polling.ts +1588 -0
- package/node_modules/@llblab/pi-telegram/lib/preview.ts +846 -0
- package/node_modules/@llblab/pi-telegram/lib/prompt-templates.ts +158 -0
- package/node_modules/@llblab/pi-telegram/lib/prompts.ts +218 -0
- package/node_modules/@llblab/pi-telegram/lib/queue.ts +3075 -0
- package/node_modules/@llblab/pi-telegram/lib/recovery.ts +464 -0
- package/node_modules/@llblab/pi-telegram/lib/rendering.ts +1213 -0
- package/node_modules/@llblab/pi-telegram/lib/replies.ts +892 -0
- package/node_modules/@llblab/pi-telegram/lib/routing.ts +2889 -0
- package/node_modules/@llblab/pi-telegram/lib/runtime.ts +628 -0
- package/node_modules/@llblab/pi-telegram/lib/sections.ts +710 -0
- package/node_modules/@llblab/pi-telegram/lib/setup.ts +220 -0
- package/node_modules/@llblab/pi-telegram/lib/skills.ts +21 -0
- package/node_modules/@llblab/pi-telegram/lib/status.ts +1550 -0
- package/node_modules/@llblab/pi-telegram/lib/sync.ts +883 -0
- package/node_modules/@llblab/pi-telegram/lib/target.ts +49 -0
- package/node_modules/@llblab/pi-telegram/lib/telegram-api.ts +1747 -0
- package/node_modules/@llblab/pi-telegram/lib/text-groups.ts +487 -0
- package/node_modules/@llblab/pi-telegram/lib/thread-reconciler.ts +1002 -0
- package/node_modules/@llblab/pi-telegram/lib/threads.ts +3183 -0
- package/node_modules/@llblab/pi-telegram/lib/time-injection.ts +78 -0
- package/node_modules/@llblab/pi-telegram/lib/turns.ts +753 -0
- package/node_modules/@llblab/pi-telegram/lib/updates.ts +4950 -0
- package/node_modules/@llblab/pi-telegram/lib/voice.ts +340 -0
- package/node_modules/@llblab/pi-telegram/package.json +83 -0
- package/node_modules/@llblab/pi-telegram/screenshot.png +0 -0
- package/node_modules/@llblab/pi-telegram/scripts/check-downgrade.mjs +435 -0
- package/node_modules/@llblab/pi-telegram/skills/generated-control-surface/SKILL.md +241 -0
- package/node_modules/@llblab/pi-telegram/skills/generative-apps/SKILL.md +114 -0
- package/node_modules/@llblab/pi-telegram/skills/telegram-bridge/SKILL.md +149 -0
- package/package.json +67 -0
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Actor Inspector evidence readers.
|
|
3
|
+
* Zones: owned actor-instance inventory and captured Recipe projection
|
|
4
|
+
* Owns actor-instance TUI evidence; Trace, Control, and execution parsing stay in their domains.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as fs from "node:fs";
|
|
8
|
+
import * as path from "node:path";
|
|
9
|
+
|
|
10
|
+
import * as SessionEvidence from "./session-evidence.ts";
|
|
11
|
+
import { readJsonFileResilient } from "./state-readers.ts";
|
|
12
|
+
|
|
13
|
+
export interface ActorInspectorRunItem {
|
|
14
|
+
run: string;
|
|
15
|
+
runInstanceId?: string;
|
|
16
|
+
status: string;
|
|
17
|
+
updatedAt?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function matchesOwner(stateDir: string, ownerId: string): boolean {
|
|
21
|
+
const meta = readJsonFileResilient<Record<string, unknown>>(
|
|
22
|
+
path.join(stateDir, "run.json"),
|
|
23
|
+
{},
|
|
24
|
+
).value;
|
|
25
|
+
return meta.ownerId === ownerId;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function readActorInspectorRuns(
|
|
29
|
+
stateRoot: string,
|
|
30
|
+
ownerId: string,
|
|
31
|
+
): ActorInspectorRunItem[] {
|
|
32
|
+
try {
|
|
33
|
+
return fs
|
|
34
|
+
.readdirSync(stateRoot, { withFileTypes: true })
|
|
35
|
+
.filter((entry) => entry.isDirectory())
|
|
36
|
+
.flatMap((entry) => {
|
|
37
|
+
const stateDir = path.join(stateRoot, entry.name);
|
|
38
|
+
if (!matchesOwner(stateDir, ownerId)) return [];
|
|
39
|
+
const runMeta = readJsonFileResilient<Record<string, unknown>>(
|
|
40
|
+
path.join(stateDir, "run.json"),
|
|
41
|
+
{},
|
|
42
|
+
).value;
|
|
43
|
+
const progress = readJsonFileResilient<Record<string, unknown>>(
|
|
44
|
+
path.join(stateDir, "progress.json"),
|
|
45
|
+
{},
|
|
46
|
+
).value;
|
|
47
|
+
const result = readJsonFileResilient<Record<string, unknown>>(
|
|
48
|
+
path.join(stateDir, "result.json"),
|
|
49
|
+
{},
|
|
50
|
+
).value;
|
|
51
|
+
return [{
|
|
52
|
+
run: entry.name,
|
|
53
|
+
...(typeof runMeta.run_instance_id === "string"
|
|
54
|
+
? { runInstanceId: runMeta.run_instance_id }
|
|
55
|
+
: {}),
|
|
56
|
+
status: String(
|
|
57
|
+
progress.phase ??
|
|
58
|
+
(Object.keys(result).length ? "terminal" : "unknown"),
|
|
59
|
+
),
|
|
60
|
+
...(typeof progress.updatedAt === "string"
|
|
61
|
+
? { updatedAt: progress.updatedAt }
|
|
62
|
+
: typeof result.completedAt === "string"
|
|
63
|
+
? { updatedAt: result.completedAt }
|
|
64
|
+
: {}),
|
|
65
|
+
}];
|
|
66
|
+
})
|
|
67
|
+
.sort((left, right) =>
|
|
68
|
+
String(right.updatedAt ?? "").localeCompare(String(left.updatedAt ?? "")) ||
|
|
69
|
+
right.run.localeCompare(left.run),
|
|
70
|
+
);
|
|
71
|
+
} catch {
|
|
72
|
+
return [];
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface ActorInspectorRecipeView {
|
|
77
|
+
composition: Array<Record<string, unknown>>;
|
|
78
|
+
definition?: Record<string, unknown>;
|
|
79
|
+
diagnostics: string[];
|
|
80
|
+
identity: Record<string, unknown>;
|
|
81
|
+
launch: Record<string, unknown>;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function readActorInspectorRecipe(
|
|
85
|
+
stateDir: string,
|
|
86
|
+
): ActorInspectorRecipeView {
|
|
87
|
+
const result = readJsonFileResilient<Record<string, unknown>>(
|
|
88
|
+
path.join(stateDir, "run.json"),
|
|
89
|
+
{},
|
|
90
|
+
);
|
|
91
|
+
const meta = result.value;
|
|
92
|
+
const contexts = Array.isArray(meta.recipe_context_records)
|
|
93
|
+
? meta.recipe_context_records.filter(
|
|
94
|
+
(entry): entry is Record<string, unknown> =>
|
|
95
|
+
Boolean(entry && typeof entry === "object" && !Array.isArray(entry)),
|
|
96
|
+
)
|
|
97
|
+
: [];
|
|
98
|
+
const primary = contexts.find((entry) => entry.depth === 0) ?? contexts[0];
|
|
99
|
+
const definition =
|
|
100
|
+
primary?.recipe &&
|
|
101
|
+
typeof primary.recipe === "object" &&
|
|
102
|
+
!Array.isArray(primary.recipe)
|
|
103
|
+
? (primary.recipe as Record<string, unknown>)
|
|
104
|
+
: undefined;
|
|
105
|
+
const stripPrivateOrigins = (value: unknown): unknown => {
|
|
106
|
+
if (Array.isArray(value)) return value.map(stripPrivateOrigins);
|
|
107
|
+
if (!value || typeof value !== "object") return value;
|
|
108
|
+
return Object.fromEntries(
|
|
109
|
+
Object.entries(value as Record<string, unknown>)
|
|
110
|
+
.filter(
|
|
111
|
+
([key, entry]) =>
|
|
112
|
+
entry !== undefined &&
|
|
113
|
+
key !== "recipe_dir" &&
|
|
114
|
+
key !== "skill_dir" &&
|
|
115
|
+
key !== "source_file",
|
|
116
|
+
)
|
|
117
|
+
.map(([key, entry]) => [
|
|
118
|
+
key,
|
|
119
|
+
key === "actorRecipeContext" && entry && typeof entry === "object"
|
|
120
|
+
? stripPrivateOrigins(
|
|
121
|
+
Object.fromEntries(
|
|
122
|
+
Object.entries(entry as Record<string, unknown>).filter(
|
|
123
|
+
([contextKey]) => contextKey !== "file",
|
|
124
|
+
),
|
|
125
|
+
),
|
|
126
|
+
)
|
|
127
|
+
: stripPrivateOrigins(entry),
|
|
128
|
+
]),
|
|
129
|
+
);
|
|
130
|
+
};
|
|
131
|
+
const redactedRecord = (value: Record<string, unknown>): Record<string, unknown> =>
|
|
132
|
+
SessionEvidence.redactSessionEvidenceValue(
|
|
133
|
+
stripPrivateOrigins(value),
|
|
134
|
+
) as Record<string, unknown>;
|
|
135
|
+
const primarySourceKind =
|
|
136
|
+
primary?.source_kind === "active_skill_component"
|
|
137
|
+
? "active_skill_component"
|
|
138
|
+
: primary?.source_kind === "user_registry_capability" ||
|
|
139
|
+
meta.launch_source === "tool"
|
|
140
|
+
? "user_registry_capability"
|
|
141
|
+
: "explicit_file_recipe";
|
|
142
|
+
const primaryLogicalReference =
|
|
143
|
+
typeof primary?.logical_reference === "string"
|
|
144
|
+
? primary.logical_reference
|
|
145
|
+
: typeof primary?.name === "string"
|
|
146
|
+
? primary.name
|
|
147
|
+
: typeof meta.recipe === "string"
|
|
148
|
+
? meta.recipe
|
|
149
|
+
: "unknown";
|
|
150
|
+
const launchValues =
|
|
151
|
+
meta.values && typeof meta.values === "object" && !Array.isArray(meta.values)
|
|
152
|
+
? Object.fromEntries(
|
|
153
|
+
Object.entries(meta.values as Record<string, unknown>).filter(
|
|
154
|
+
([key]) => key !== "recipe_dir" && key !== "skill_dir",
|
|
155
|
+
),
|
|
156
|
+
)
|
|
157
|
+
: meta.values;
|
|
158
|
+
return {
|
|
159
|
+
composition: contexts.map((entry) =>
|
|
160
|
+
redactedRecord({
|
|
161
|
+
...(typeof entry.alias === "string" ? { alias: entry.alias } : {}),
|
|
162
|
+
depth: entry.depth,
|
|
163
|
+
import_path: entry.import_path,
|
|
164
|
+
logical_reference: entry.logical_reference ?? entry.name,
|
|
165
|
+
recipe_stem: entry.name,
|
|
166
|
+
role: entry.role,
|
|
167
|
+
...(typeof entry.skill === "string" ? { skill: entry.skill } : {}),
|
|
168
|
+
source_kind:
|
|
169
|
+
entry.source_kind === "active_skill_component"
|
|
170
|
+
? "active_skill_component"
|
|
171
|
+
: entry.source_kind === "user_registry_capability" ||
|
|
172
|
+
(entry.depth === 0 && meta.launch_source === "tool")
|
|
173
|
+
? "user_registry_capability"
|
|
174
|
+
: "explicit_file_recipe",
|
|
175
|
+
}),
|
|
176
|
+
),
|
|
177
|
+
...(definition ? { definition: redactedRecord(definition) } : {}),
|
|
178
|
+
diagnostics: result.diagnostics.map((diagnostic) => diagnostic.message),
|
|
179
|
+
identity: redactedRecord({
|
|
180
|
+
run: meta.run,
|
|
181
|
+
recipe: meta.recipe,
|
|
182
|
+
recipe_stem: primary?.name ?? meta.recipe,
|
|
183
|
+
logical_reference: primaryLogicalReference,
|
|
184
|
+
...(typeof primary?.skill === "string" ? { skill: primary.skill } : {}),
|
|
185
|
+
source_kind: primarySourceKind,
|
|
186
|
+
launch_kind: meta.launch_kind ?? meta.launch_source,
|
|
187
|
+
launch_source: meta.launch_source,
|
|
188
|
+
...(meta.singleton === true
|
|
189
|
+
? { singleton: true, singleton_recipe_id: meta.singleton_recipe_id }
|
|
190
|
+
: {}),
|
|
191
|
+
}),
|
|
192
|
+
launch: redactedRecord({
|
|
193
|
+
cwd: meta.cwd,
|
|
194
|
+
template: meta.template,
|
|
195
|
+
values: launchValues,
|
|
196
|
+
model_policy: meta.model_policy,
|
|
197
|
+
control: meta.control,
|
|
198
|
+
artifacts: meta.artifacts,
|
|
199
|
+
notification_policy: meta.notification_policy,
|
|
200
|
+
retire_when: meta.retire_when,
|
|
201
|
+
singleton_values: meta.singleton_values,
|
|
202
|
+
}),
|
|
203
|
+
};
|
|
204
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared output, preview, and Control envelope limits.
|
|
3
|
+
* Zones: output governance, Trace previews, Inspect defaults, Control portability
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export const DEFAULT_INSPECT_LINES = 40;
|
|
7
|
+
export const TOOL_OUTPUT_MAX_BYTES = 50 * 1024;
|
|
8
|
+
export const TOOL_OUTPUT_MAX_LINES = 2_000;
|
|
9
|
+
export const COMPACT_PREVIEW_CHARS = 160;
|
|
10
|
+
export const CONTROL_ACTION_MAX_LENGTH = 64;
|
|
11
|
+
export const CONTROL_INPUT_MAX_BYTES = 380;
|
|
12
|
+
export const CONTROL_WIRE_MAX_BYTES = 512;
|
|
13
|
+
export const INSPECTOR_BODY_PREVIEW_CHARS = 320;
|
|
14
|
+
export const DOCTOR_ACTION_PREVIEW_CHARS = 72;
|
|
15
|
+
export const SESSION_EVIDENCE_MAX_TURNS = 100;
|
|
16
|
+
export const SESSION_EVIDENCE_TEXT_CHARS = 4_000;
|
|
17
|
+
export const SESSION_EVIDENCE_MAX_TOOL_CALLS = 100;
|
|
18
|
+
export const TRACE_EVENT_MAX_BYTES = 64 * 1024;
|
|
19
|
+
export const TRACE_EVENT_MAX_READ = 200;
|
|
20
|
+
export const TRACE_JOURNAL_MAX_EVENTS = 2_048;
|
|
21
|
+
export const TRACE_JOURNAL_TARGET_EVENTS = 1_536;
|
|
22
|
+
export const TRACE_JOURNAL_MAX_BYTES = 4 * 1024 * 1024;
|
|
23
|
+
export const TRACE_JOURNAL_TARGET_BYTES = 3 * 1024 * 1024;
|
|
24
|
+
export const RUN_CONTROL_PENDING_LIMIT = 64;
|
|
25
|
+
export const RUN_CONTROL_TERMINAL_LIMIT = 128;
|
|
26
|
+
export const RUN_CONTROL_ERROR_MAX_BYTES = 4 * 1024;
|
|
27
|
+
export const RUN_CONTROL_JOURNAL_MAX_BYTES = 1024 * 1024;
|
|
28
|
+
export const RUN_RETENTION_MAX_RECORDS = 256;
|
|
29
|
+
export const RUN_RETENTION_MAX_BYTES = 1024 * 1024;
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Current model/thinking propagation helpers
|
|
3
|
+
* Zones: pi session context, recipe inheritance
|
|
4
|
+
* Owns current model/thinking extraction from Pi tool contexts and implicit command-template values.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface CurrentModelContext {
|
|
8
|
+
currentThinking?: unknown;
|
|
9
|
+
getThinkingLevel?: () => unknown;
|
|
10
|
+
model?: {
|
|
11
|
+
id?: unknown;
|
|
12
|
+
modelId?: unknown;
|
|
13
|
+
provider?: unknown;
|
|
14
|
+
};
|
|
15
|
+
sessionManager?: {
|
|
16
|
+
getBranch?: () => unknown[];
|
|
17
|
+
getSessionId?: () => string;
|
|
18
|
+
};
|
|
19
|
+
thinkingLevel?: unknown;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const CURRENT_MODEL_VALUE_KEY = "current_model";
|
|
23
|
+
export const CURRENT_THINKING_VALUE_KEY = "current_thinking";
|
|
24
|
+
|
|
25
|
+
export type CurrentPolicySource =
|
|
26
|
+
| "explicit"
|
|
27
|
+
| "inherited"
|
|
28
|
+
| "mixed"
|
|
29
|
+
| "unresolved"
|
|
30
|
+
| "unused";
|
|
31
|
+
|
|
32
|
+
export interface CurrentPolicyAxisProvenance {
|
|
33
|
+
explicit_keys?: string[];
|
|
34
|
+
inherited_keys?: string[];
|
|
35
|
+
source: CurrentPolicySource;
|
|
36
|
+
unresolved_keys?: string[];
|
|
37
|
+
value?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface CurrentPolicyProvenance {
|
|
41
|
+
model: CurrentPolicyAxisProvenance;
|
|
42
|
+
thinking: CurrentPolicyAxisProvenance;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface CurrentPolicyRecipeSummary {
|
|
46
|
+
model?: {
|
|
47
|
+
inherited_defaults?: string[];
|
|
48
|
+
public_args?: string[];
|
|
49
|
+
};
|
|
50
|
+
thinking?: {
|
|
51
|
+
inherited_defaults?: string[];
|
|
52
|
+
public_args?: string[];
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function getCurrentModelPattern(
|
|
57
|
+
ctx: CurrentModelContext | undefined,
|
|
58
|
+
): string | undefined {
|
|
59
|
+
const provider = ctx?.model?.provider;
|
|
60
|
+
const id = ctx?.model?.id ?? ctx?.model?.modelId;
|
|
61
|
+
if (typeof provider !== "string" || !provider.trim()) return undefined;
|
|
62
|
+
if (typeof id !== "string" || !id.trim()) return undefined;
|
|
63
|
+
return `${provider.trim()}/${id.trim()}`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function normalizeThinkingLevel(value: unknown): string | undefined {
|
|
67
|
+
return typeof value === "string" && value.trim() ? value.trim() : undefined;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
function getSessionThinkingLevel(
|
|
71
|
+
ctx: CurrentModelContext | undefined,
|
|
72
|
+
): string | undefined {
|
|
73
|
+
const branch = ctx?.sessionManager?.getBranch?.();
|
|
74
|
+
if (!Array.isArray(branch)) return undefined;
|
|
75
|
+
for (const entry of [...branch].reverse()) {
|
|
76
|
+
if (!entry || typeof entry !== "object") continue;
|
|
77
|
+
const record = entry as Record<string, unknown>;
|
|
78
|
+
if (record.type !== "thinking_level_change") continue;
|
|
79
|
+
const level = normalizeThinkingLevel(record.thinkingLevel);
|
|
80
|
+
if (level) return level;
|
|
81
|
+
}
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export function getCurrentThinkingLevel(
|
|
86
|
+
ctx: CurrentModelContext | undefined,
|
|
87
|
+
): string | undefined {
|
|
88
|
+
return (
|
|
89
|
+
normalizeThinkingLevel(ctx?.currentThinking) ??
|
|
90
|
+
normalizeThinkingLevel(ctx?.thinkingLevel) ??
|
|
91
|
+
normalizeThinkingLevel(ctx?.getThinkingLevel?.()) ??
|
|
92
|
+
getSessionThinkingLevel(ctx)
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function withCurrentModelValues<T extends Record<string, unknown>>(
|
|
97
|
+
values: T,
|
|
98
|
+
ctx: CurrentModelContext | undefined,
|
|
99
|
+
): T & Record<string, unknown> {
|
|
100
|
+
const currentModel = getCurrentModelPattern(ctx);
|
|
101
|
+
const currentThinking = getCurrentThinkingLevel(ctx);
|
|
102
|
+
if (!currentModel && !currentThinking) return values;
|
|
103
|
+
return {
|
|
104
|
+
...values,
|
|
105
|
+
...(currentModel ? { [CURRENT_MODEL_VALUE_KEY]: currentModel } : {}),
|
|
106
|
+
...(currentThinking
|
|
107
|
+
? { [CURRENT_THINKING_VALUE_KEY]: currentThinking }
|
|
108
|
+
: {}),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function isRecord(value: unknown): value is Record<string, unknown> {
|
|
113
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function stringReferencesPlaceholder(
|
|
117
|
+
value: string,
|
|
118
|
+
placeholder: string,
|
|
119
|
+
): boolean {
|
|
120
|
+
return new RegExp(`\\{\\s*${placeholder}\\s*\\}`).test(value);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function modelPolicyKeyMatches(key: string): boolean {
|
|
124
|
+
return /(^|_)models?$/.test(key);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
function thinkingPolicyKeyMatches(key: string): boolean {
|
|
128
|
+
return /(^|_)(thinking|thinking_level)$/.test(key);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function argName(token: unknown): string | undefined {
|
|
132
|
+
if (typeof token !== "string") return undefined;
|
|
133
|
+
return token.split(":")[0]?.trim() || undefined;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function collectPolicyDefaults(
|
|
137
|
+
value: unknown,
|
|
138
|
+
placeholder: string,
|
|
139
|
+
path = "template",
|
|
140
|
+
keys = new Set<string>(),
|
|
141
|
+
): Set<string> {
|
|
142
|
+
if (Array.isArray(value)) {
|
|
143
|
+
value.forEach((item, index) =>
|
|
144
|
+
collectPolicyDefaults(item, placeholder, `${path}[${index}]`, keys),
|
|
145
|
+
);
|
|
146
|
+
return keys;
|
|
147
|
+
}
|
|
148
|
+
if (!isRecord(value)) return keys;
|
|
149
|
+
for (const [key, child] of Object.entries(value)) {
|
|
150
|
+
if (key === "defaults" && isRecord(child)) {
|
|
151
|
+
for (const [defaultKey, defaultValue] of Object.entries(child)) {
|
|
152
|
+
if (
|
|
153
|
+
typeof defaultValue === "string" &&
|
|
154
|
+
stringReferencesPlaceholder(defaultValue, placeholder)
|
|
155
|
+
) {
|
|
156
|
+
keys.add(defaultKey);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
161
|
+
collectPolicyDefaults(child, placeholder, `${path}.${key}`, keys);
|
|
162
|
+
}
|
|
163
|
+
return keys;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function collectPolicyDirectRefs(
|
|
167
|
+
value: unknown,
|
|
168
|
+
placeholder: string,
|
|
169
|
+
path = "template",
|
|
170
|
+
refs = new Set<string>(),
|
|
171
|
+
): Set<string> {
|
|
172
|
+
if (typeof value === "string") {
|
|
173
|
+
if (stringReferencesPlaceholder(value, placeholder)) refs.add(path);
|
|
174
|
+
return refs;
|
|
175
|
+
}
|
|
176
|
+
if (Array.isArray(value)) {
|
|
177
|
+
value.forEach((item, index) =>
|
|
178
|
+
collectPolicyDirectRefs(item, placeholder, `${path}[${index}]`, refs),
|
|
179
|
+
);
|
|
180
|
+
return refs;
|
|
181
|
+
}
|
|
182
|
+
if (!isRecord(value)) return refs;
|
|
183
|
+
for (const [key, child] of Object.entries(value)) {
|
|
184
|
+
if (key === "defaults") continue;
|
|
185
|
+
collectPolicyDirectRefs(child, placeholder, `${path}.${key}`, refs);
|
|
186
|
+
}
|
|
187
|
+
return refs;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function summarizePolicyAxis(input: {
|
|
191
|
+
currentValue?: string;
|
|
192
|
+
directRefKey: string;
|
|
193
|
+
explicitKeyMatches: (key: string) => boolean;
|
|
194
|
+
explicitValues: Record<string, unknown>;
|
|
195
|
+
inheritedDefaultKeys: Set<string>;
|
|
196
|
+
directRefs: Set<string>;
|
|
197
|
+
}): CurrentPolicyAxisProvenance {
|
|
198
|
+
const explicitKeys = Object.keys(input.explicitValues)
|
|
199
|
+
.filter(
|
|
200
|
+
(key) =>
|
|
201
|
+
key !== CURRENT_MODEL_VALUE_KEY &&
|
|
202
|
+
key !== CURRENT_THINKING_VALUE_KEY &&
|
|
203
|
+
input.explicitKeyMatches(key),
|
|
204
|
+
)
|
|
205
|
+
.sort();
|
|
206
|
+
const inheritedKeys = [...input.inheritedDefaultKeys]
|
|
207
|
+
.filter((key) => !Object.hasOwn(input.explicitValues, key))
|
|
208
|
+
.sort();
|
|
209
|
+
const directRefs = [...input.directRefs].length > 0 ? [input.directRefKey] : [];
|
|
210
|
+
const inheritedOrDirect = [...new Set([...inheritedKeys, ...directRefs])].sort();
|
|
211
|
+
const unresolvedKeys = input.currentValue ? [] : inheritedOrDirect;
|
|
212
|
+
const inheritedResolvedKeys = input.currentValue ? inheritedOrDirect : [];
|
|
213
|
+
const hasExplicit = explicitKeys.length > 0;
|
|
214
|
+
const hasInherited = inheritedResolvedKeys.length > 0;
|
|
215
|
+
const source: CurrentPolicySource = unresolvedKeys.length
|
|
216
|
+
? "unresolved"
|
|
217
|
+
: hasExplicit && hasInherited
|
|
218
|
+
? "mixed"
|
|
219
|
+
: hasExplicit
|
|
220
|
+
? "explicit"
|
|
221
|
+
: hasInherited
|
|
222
|
+
? "inherited"
|
|
223
|
+
: "unused";
|
|
224
|
+
const explicitValue = explicitKeys
|
|
225
|
+
.map((key) => input.explicitValues[key])
|
|
226
|
+
.find((value) => typeof value === "string" && value.trim());
|
|
227
|
+
const value = hasInherited
|
|
228
|
+
? input.currentValue
|
|
229
|
+
: typeof explicitValue === "string"
|
|
230
|
+
? explicitValue
|
|
231
|
+
: undefined;
|
|
232
|
+
return {
|
|
233
|
+
...(explicitKeys.length ? { explicit_keys: explicitKeys } : {}),
|
|
234
|
+
...(inheritedResolvedKeys.length
|
|
235
|
+
? { inherited_keys: inheritedResolvedKeys }
|
|
236
|
+
: {}),
|
|
237
|
+
source,
|
|
238
|
+
...(unresolvedKeys.length ? { unresolved_keys: unresolvedKeys } : {}),
|
|
239
|
+
...(value ? { value } : {}),
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
function collectPolicyDefaultsAcross(
|
|
244
|
+
items: unknown[],
|
|
245
|
+
placeholder: string,
|
|
246
|
+
): Set<string> {
|
|
247
|
+
return items.reduce<Set<string>>(
|
|
248
|
+
(keys, item) => collectPolicyDefaults(item, placeholder, "template", keys),
|
|
249
|
+
new Set<string>(),
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function collectPolicyDirectRefsAcross(
|
|
254
|
+
items: unknown[],
|
|
255
|
+
placeholder: string,
|
|
256
|
+
): Set<string> {
|
|
257
|
+
return items.reduce<Set<string>>(
|
|
258
|
+
(refs, item) => collectPolicyDirectRefs(item, placeholder, "template", refs),
|
|
259
|
+
new Set<string>(),
|
|
260
|
+
);
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export function describeCurrentPolicyProvenance(input: {
|
|
264
|
+
defaults?: Record<string, unknown>;
|
|
265
|
+
template: unknown;
|
|
266
|
+
values?: Record<string, unknown>;
|
|
267
|
+
}): CurrentPolicyProvenance {
|
|
268
|
+
const explicitValues = input.values ?? {};
|
|
269
|
+
const defaultsEnvelope = input.defaults ? { defaults: input.defaults } : {};
|
|
270
|
+
const templateAndDefaults = [defaultsEnvelope, input.template];
|
|
271
|
+
return {
|
|
272
|
+
model: summarizePolicyAxis({
|
|
273
|
+
currentValue:
|
|
274
|
+
typeof explicitValues[CURRENT_MODEL_VALUE_KEY] === "string"
|
|
275
|
+
? String(explicitValues[CURRENT_MODEL_VALUE_KEY])
|
|
276
|
+
: undefined,
|
|
277
|
+
directRefKey: CURRENT_MODEL_VALUE_KEY,
|
|
278
|
+
directRefs: collectPolicyDirectRefsAcross(
|
|
279
|
+
templateAndDefaults,
|
|
280
|
+
"current_model",
|
|
281
|
+
),
|
|
282
|
+
explicitKeyMatches: modelPolicyKeyMatches,
|
|
283
|
+
explicitValues,
|
|
284
|
+
inheritedDefaultKeys: collectPolicyDefaultsAcross(
|
|
285
|
+
templateAndDefaults,
|
|
286
|
+
"current_model",
|
|
287
|
+
),
|
|
288
|
+
}),
|
|
289
|
+
thinking: summarizePolicyAxis({
|
|
290
|
+
currentValue:
|
|
291
|
+
typeof explicitValues[CURRENT_THINKING_VALUE_KEY] === "string"
|
|
292
|
+
? String(explicitValues[CURRENT_THINKING_VALUE_KEY])
|
|
293
|
+
: undefined,
|
|
294
|
+
directRefKey: CURRENT_THINKING_VALUE_KEY,
|
|
295
|
+
directRefs: collectPolicyDirectRefsAcross(
|
|
296
|
+
templateAndDefaults,
|
|
297
|
+
"current_thinking",
|
|
298
|
+
),
|
|
299
|
+
explicitKeyMatches: thinkingPolicyKeyMatches,
|
|
300
|
+
explicitValues,
|
|
301
|
+
inheritedDefaultKeys: collectPolicyDefaultsAcross(
|
|
302
|
+
templateAndDefaults,
|
|
303
|
+
"current_thinking",
|
|
304
|
+
),
|
|
305
|
+
}),
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function publicPolicyArgs(
|
|
310
|
+
args: unknown,
|
|
311
|
+
matches: (key: string) => boolean,
|
|
312
|
+
): string[] {
|
|
313
|
+
return Array.isArray(args)
|
|
314
|
+
? args
|
|
315
|
+
.map(argName)
|
|
316
|
+
.filter((key): key is string => Boolean(key && matches(key)))
|
|
317
|
+
.sort()
|
|
318
|
+
: [];
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
function nonEmptyAxisRecipeSummary(
|
|
322
|
+
inheritedDefaults: string[],
|
|
323
|
+
publicArgs: string[],
|
|
324
|
+
): { inherited_defaults?: string[]; public_args?: string[] } | undefined {
|
|
325
|
+
if (inheritedDefaults.length === 0 && publicArgs.length === 0)
|
|
326
|
+
return undefined;
|
|
327
|
+
return {
|
|
328
|
+
...(inheritedDefaults.length
|
|
329
|
+
? { inherited_defaults: inheritedDefaults }
|
|
330
|
+
: {}),
|
|
331
|
+
...(publicArgs.length ? { public_args: publicArgs } : {}),
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export function describeRecipeCurrentPolicy(input: {
|
|
336
|
+
args?: unknown;
|
|
337
|
+
defaults?: Record<string, unknown>;
|
|
338
|
+
template: unknown;
|
|
339
|
+
}): CurrentPolicyRecipeSummary | undefined {
|
|
340
|
+
const templateAndDefaults = [
|
|
341
|
+
input.defaults ? { defaults: input.defaults } : {},
|
|
342
|
+
input.template,
|
|
343
|
+
];
|
|
344
|
+
const model = nonEmptyAxisRecipeSummary(
|
|
345
|
+
[...collectPolicyDefaultsAcross(templateAndDefaults, "current_model")].sort(),
|
|
346
|
+
publicPolicyArgs(input.args, modelPolicyKeyMatches),
|
|
347
|
+
);
|
|
348
|
+
const thinking = nonEmptyAxisRecipeSummary(
|
|
349
|
+
[
|
|
350
|
+
...collectPolicyDefaultsAcross(templateAndDefaults, "current_thinking"),
|
|
351
|
+
].sort(),
|
|
352
|
+
publicPolicyArgs(input.args, thinkingPolicyKeyMatches),
|
|
353
|
+
);
|
|
354
|
+
if (!model && !thinking) return undefined;
|
|
355
|
+
return {
|
|
356
|
+
...(model ? { model } : {}),
|
|
357
|
+
...(thinking ? { thinking } : {}),
|
|
358
|
+
};
|
|
359
|
+
}
|