@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,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public tool access and ownership checks
|
|
3
|
+
* Zones: session ownership, run visibility guards, tool authorization errors
|
|
4
|
+
* Owns consistent session-mismatch diagnostics for public tool execution paths
|
|
5
|
+
*/
|
|
6
|
+
import * as AsyncRuns from "./async-runs.js";
|
|
7
|
+
export function getContextSessionId(ctx) {
|
|
8
|
+
return ctx?.sessionManager?.getSessionId?.();
|
|
9
|
+
}
|
|
10
|
+
export function requireContextSessionId(ctx, actor) {
|
|
11
|
+
const sessionId = getContextSessionId(ctx);
|
|
12
|
+
if (!sessionId) {
|
|
13
|
+
throw new Error(`${actor} requires a current coordinator session; use session:<id> or session:all for explicit session inventory.`);
|
|
14
|
+
}
|
|
15
|
+
return sessionId;
|
|
16
|
+
}
|
|
17
|
+
export function sessionMismatchError(input) {
|
|
18
|
+
const ownerSession = input.expectedSession ?? "none";
|
|
19
|
+
const currentSession = input.currentSession ?? "none";
|
|
20
|
+
const actor = input.run ? `run:${input.run}` : (input.target ?? "session");
|
|
21
|
+
const hintTarget = input.expectedSession
|
|
22
|
+
? `session:${input.expectedSession}`
|
|
23
|
+
: "session:all";
|
|
24
|
+
return Object.assign(new Error(`${actor} reason=session_mismatch owner_session=${ownerSession} current_session=${currentSession} hint=inspect_session:${input.expectedSession ?? "all"}`), {
|
|
25
|
+
current_session: input.currentSession,
|
|
26
|
+
hint: `inspect target=${hintTarget} view=status`,
|
|
27
|
+
owner_session: input.expectedSession,
|
|
28
|
+
reason: "session_mismatch",
|
|
29
|
+
run: input.run,
|
|
30
|
+
target: input.target,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
export function assertRunAccessibleToContext(runId, ctx) {
|
|
34
|
+
const status = AsyncRuns.getRunStatus(runId);
|
|
35
|
+
const sessionId = getContextSessionId(ctx);
|
|
36
|
+
if (sessionId && status.ownerId && status.ownerId !== sessionId) {
|
|
37
|
+
throw sessionMismatchError({
|
|
38
|
+
currentSession: sessionId,
|
|
39
|
+
expectedSession: String(status.ownerId),
|
|
40
|
+
run: runId,
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
return status;
|
|
44
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public inspect tool behavior.
|
|
3
|
+
* Zones: Run Recipe/Trace/Control views and runtime/recipe/tool diagnostics
|
|
4
|
+
* Owns exact inspect target/view dispatch; source projection stays in domain modules.
|
|
5
|
+
*/
|
|
6
|
+
import * as Runtime from "./runtime.ts";
|
|
7
|
+
export interface InspectToolDeps<TContext = unknown> {
|
|
8
|
+
getRunStatus?: (runOrDir: string) => Record<string, any>;
|
|
9
|
+
getTool?: (name: string) => any | undefined;
|
|
10
|
+
getToolStatus?: (name: string) => Record<string, unknown> | undefined;
|
|
11
|
+
listRuns?: () => Array<Record<string, any>>;
|
|
12
|
+
recipeRoot?: string;
|
|
13
|
+
registryStatus?: () => Runtime.RecipeRegistryStatus;
|
|
14
|
+
}
|
|
15
|
+
export declare function createInspectToolDefinition<TContext = unknown>(deps?: InspectToolDeps<TContext>): any;
|
|
@@ -0,0 +1,532 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public inspect tool behavior.
|
|
3
|
+
* Zones: Run Recipe/Trace/Control views and runtime/recipe/tool diagnostics
|
|
4
|
+
* Owns exact inspect target/view dispatch; source projection stays in domain modules.
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync, statSync } from "node:fs";
|
|
7
|
+
import { isAbsolute, join, relative } from "node:path";
|
|
8
|
+
import * as AsyncRuns from "./async-runs.js";
|
|
9
|
+
import * as ControlProjection from "./control-projection.js";
|
|
10
|
+
import * as Inspector from "./inspector.js";
|
|
11
|
+
import * as Limits from "./limits.js";
|
|
12
|
+
import { computeRunControlCapacity } from "./run-evidence-policy.js";
|
|
13
|
+
import * as Paths from "./paths.js";
|
|
14
|
+
import * as RecipesDiscovery from "./recipes-discovery.js";
|
|
15
|
+
import * as RecipesReferences from "./recipes-references.js";
|
|
16
|
+
import * as ReviewDiagnostics from "./review-diagnostics.js";
|
|
17
|
+
import * as RunsControls from "./runs-controls.js";
|
|
18
|
+
import * as RunControlDelivery from "./runs-control-delivery.js";
|
|
19
|
+
import * as RunsTrace from "./runs-trace.js";
|
|
20
|
+
import * as RuntimeIdentity from "./runtime-identity.js";
|
|
21
|
+
import * as RuntimeTriage from "./runtime-triage.js";
|
|
22
|
+
import * as Schema from "./schema.js";
|
|
23
|
+
import * as ToolsAccess from "./tools-access.js";
|
|
24
|
+
import * as ToolsResponse from "./tools-response.js";
|
|
25
|
+
import * as TraceProjection from "./trace-projection.js";
|
|
26
|
+
const asRecord = ToolsResponse.asRecord;
|
|
27
|
+
const maybeJsonText = ToolsResponse.maybeJsonText;
|
|
28
|
+
function runtimeStatus() {
|
|
29
|
+
return {
|
|
30
|
+
automatic_review: process.env.PI_ACTORS_AUTOMATIC_REVIEW !== "off",
|
|
31
|
+
run_root: Paths.getRunStateRoot(),
|
|
32
|
+
state_schema: RuntimeIdentity.RUN_STATE_SCHEMA,
|
|
33
|
+
version: RuntimeIdentity.getPackageVersion(),
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function runtimeRuns(ctx, deps, status) {
|
|
37
|
+
const session = ToolsAccess.getContextSessionId(ctx);
|
|
38
|
+
const listed = deps.listRuns
|
|
39
|
+
? deps.listRuns()
|
|
40
|
+
: AsyncRuns.listRuns(undefined, status);
|
|
41
|
+
const runs = listed
|
|
42
|
+
.map((run) => {
|
|
43
|
+
try {
|
|
44
|
+
return deps.getRunStatus
|
|
45
|
+
? deps.getRunStatus(String(run.state_dir ?? run.run))
|
|
46
|
+
: AsyncRuns.getRunStatus(String(run.state_dir ?? run.run));
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return run;
|
|
50
|
+
}
|
|
51
|
+
})
|
|
52
|
+
.filter((run) => !session || !run.ownerId || run.ownerId === session);
|
|
53
|
+
return { ...(session ? { owner_session: session } : {}), runs };
|
|
54
|
+
}
|
|
55
|
+
function runtimeTriage(ctx, deps) {
|
|
56
|
+
const inventory = runtimeRuns(ctx, deps, undefined);
|
|
57
|
+
const runs = inventory.runs;
|
|
58
|
+
const failed = runs.filter((run) => run.status === "failed");
|
|
59
|
+
const pendingControls = [];
|
|
60
|
+
const staleControls = [];
|
|
61
|
+
const backpressuredRuns = [];
|
|
62
|
+
const controlDiagnostics = [];
|
|
63
|
+
const traceDiagnostics = [];
|
|
64
|
+
const nowMs = Date.now();
|
|
65
|
+
for (const run of runs) {
|
|
66
|
+
const stateDir = typeof run.state_dir === "string" ? run.state_dir : undefined;
|
|
67
|
+
if (!stateDir)
|
|
68
|
+
continue;
|
|
69
|
+
const runId = String(run.run ?? "unknown");
|
|
70
|
+
const journal = RunsControls.readRunControlJournalFromStateDir(stateDir);
|
|
71
|
+
const capacity = computeRunControlCapacity(journal.records);
|
|
72
|
+
controlDiagnostics.push(...journal.diagnostics.map((diagnostic) => ({
|
|
73
|
+
...(diagnostic.line === undefined ? {} : { line: diagnostic.line }),
|
|
74
|
+
reason: diagnostic.line === undefined ? "unreadable_control_journal" : "invalid_control_json", run: runId,
|
|
75
|
+
})));
|
|
76
|
+
if (capacity.backpressured)
|
|
77
|
+
backpressuredRuns.push({
|
|
78
|
+
run: runId, pending: capacity.pending, pending_limit: capacity.limit,
|
|
79
|
+
journal_bytes: statSync(RunsControls.runControlsFile(stateDir)).size,
|
|
80
|
+
});
|
|
81
|
+
const traceSummary = RunsTrace.summarizeRunTraceJournal(RunsTrace.readRunTraceJournal(stateDir));
|
|
82
|
+
if (!traceSummary.history_complete)
|
|
83
|
+
traceDiagnostics.push({ run: runId, ...traceSummary });
|
|
84
|
+
for (const control of journal.records) {
|
|
85
|
+
const classified = RuntimeTriage.classifyRuntimeControl({
|
|
86
|
+
run: runId,
|
|
87
|
+
...(typeof run.run_instance_id === "string"
|
|
88
|
+
? { runInstanceId: run.run_instance_id }
|
|
89
|
+
: {}),
|
|
90
|
+
status: String(run.status ?? "unknown"),
|
|
91
|
+
}, control, nowMs);
|
|
92
|
+
if (classified.pending)
|
|
93
|
+
pendingControls.push(classified.pending);
|
|
94
|
+
if (classified.stale)
|
|
95
|
+
staleControls.push(classified.stale);
|
|
96
|
+
if (classified.diagnostic)
|
|
97
|
+
controlDiagnostics.push({ ...classified.diagnostic });
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const attentionEvents = runs.flatMap((run) => {
|
|
101
|
+
const stateDir = typeof run.state_dir === "string" ? run.state_dir : undefined;
|
|
102
|
+
if (!stateDir)
|
|
103
|
+
return [];
|
|
104
|
+
return RunsTrace.readRunTraceEvents(stateDir)
|
|
105
|
+
.filter((event) => event.attention === "notify" || event.attention === "followup")
|
|
106
|
+
.map((event) => ({
|
|
107
|
+
run: run.run,
|
|
108
|
+
id: event.id,
|
|
109
|
+
kind: event.kind,
|
|
110
|
+
attention: event.attention,
|
|
111
|
+
summary: event.summary,
|
|
112
|
+
ts: event.ts,
|
|
113
|
+
}));
|
|
114
|
+
});
|
|
115
|
+
const boundedStaleControls = staleControls.slice(0, 40);
|
|
116
|
+
const staleKeys = new Set(boundedStaleControls.map((control) => `${control.run}\0${control.run_instance_id}\0${control.id}`));
|
|
117
|
+
const boundedPendingControls = [
|
|
118
|
+
...boundedStaleControls,
|
|
119
|
+
...pendingControls.filter((control) => !staleKeys.has(`${control.run}\0${control.run_instance_id}\0${control.id}`)),
|
|
120
|
+
].slice(0, 40);
|
|
121
|
+
return {
|
|
122
|
+
...inventory,
|
|
123
|
+
failed_runs: failed,
|
|
124
|
+
pending_control_count: pendingControls.length,
|
|
125
|
+
pending_controls: boundedPendingControls,
|
|
126
|
+
stale_control_count: staleControls.length,
|
|
127
|
+
stale_controls: boundedStaleControls,
|
|
128
|
+
backpressured_run_count: backpressuredRuns.length, backpressured_runs: backpressuredRuns.slice(0, 40),
|
|
129
|
+
control_diagnostic_count: controlDiagnostics.length, control_diagnostics: controlDiagnostics.slice(0, 40),
|
|
130
|
+
trace_diagnostic_count: traceDiagnostics.length, trace_diagnostics: traceDiagnostics.slice(0, 40),
|
|
131
|
+
attention_events: attentionEvents.slice(-40).reverse(),
|
|
132
|
+
next_actions: [
|
|
133
|
+
...(failed.length ? ["inspect target=runtime view=runs status=failed"] : []),
|
|
134
|
+
...new Set([...staleControls, ...backpressuredRuns].slice(0, 3).map((entry) => `inspect target=run:${entry.run} view=control`)),
|
|
135
|
+
...(attentionEvents.length
|
|
136
|
+
? attentionEvents.slice(-3).map((entry) => `inspect target=run:${String(entry.run)} view=trace source=runtime`)
|
|
137
|
+
: []),
|
|
138
|
+
],
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
function compactRuntime(view, details) {
|
|
142
|
+
if (view === "runs") {
|
|
143
|
+
return `\nruntime runs=${details.runs?.length ?? 0}`;
|
|
144
|
+
}
|
|
145
|
+
if (view === "triage") {
|
|
146
|
+
return `\nruntime failed=${details.failed_runs?.length ?? 0} pending_controls=${Number(details.pending_control_count ?? 0)} stale_controls=${Number(details.stale_control_count ?? 0)} backpressured=${Number(details.backpressured_run_count ?? 0)} incomplete_trace=${Number(details.trace_diagnostic_count ?? 0)} attention=${details.attention_events?.length ?? 0}`;
|
|
147
|
+
}
|
|
148
|
+
return `\nruntime version=${String(details.version)} state_schema=${String(details.state_schema)} automatic_review=${String(details.automatic_review)}`;
|
|
149
|
+
}
|
|
150
|
+
function inspectRuntime(view, input, ctx, deps) {
|
|
151
|
+
if (view === "status")
|
|
152
|
+
return runtimeStatus();
|
|
153
|
+
if (view === "runs") {
|
|
154
|
+
return runtimeRuns(ctx, deps, typeof input.status === "string" ? input.status : undefined);
|
|
155
|
+
}
|
|
156
|
+
if (view === "triage")
|
|
157
|
+
return runtimeTriage(ctx, deps);
|
|
158
|
+
throw new Error("inspect runtime supports view=status, view=runs, or view=triage.");
|
|
159
|
+
}
|
|
160
|
+
function portableSkillRecipePath(file, skill, namespaces) {
|
|
161
|
+
const root = namespaces[skill]?.[0];
|
|
162
|
+
if (!root)
|
|
163
|
+
return `<active-skill:${skill}>`;
|
|
164
|
+
const relation = relative(root, file);
|
|
165
|
+
return !relation.startsWith("..") && !isAbsolute(relation)
|
|
166
|
+
? `<active-skill:${skill}>/${relation.replaceAll("\\", "/")}`
|
|
167
|
+
: `<active-skill:${skill}>`;
|
|
168
|
+
}
|
|
169
|
+
function portableSkillRecipeDiagnosticReason(diagnostic, namespaces) {
|
|
170
|
+
let reason = diagnostic.reason;
|
|
171
|
+
if (diagnostic.file) {
|
|
172
|
+
reason = reason.replaceAll(diagnostic.file, portableSkillRecipePath(diagnostic.file, diagnostic.skill, namespaces));
|
|
173
|
+
}
|
|
174
|
+
for (const root of namespaces[diagnostic.skill] ?? []) {
|
|
175
|
+
reason = reason.replaceAll(root, `<active-skill:${diagnostic.skill}>`);
|
|
176
|
+
}
|
|
177
|
+
return reason;
|
|
178
|
+
}
|
|
179
|
+
function inspectRecipeIdentity(identity, resolutionContext, namespaces, inventory, registryStatus) {
|
|
180
|
+
const match = /^([a-z][a-z0-9]*(?:-[a-z0-9]+)*)\/([a-z][a-z0-9]*(?:-[a-z0-9]+)*)$/u.exec(identity);
|
|
181
|
+
const skill = match?.[1] ?? "";
|
|
182
|
+
const roots = skill ? namespaces[skill] ?? [] : [];
|
|
183
|
+
const skillActive = roots.length === 1;
|
|
184
|
+
const matchingComponent = inventory.components.find((component) => component.identity === identity);
|
|
185
|
+
const matchingRejection = inventory.rejected.find((diagnostic) => diagnostic.skill === skill &&
|
|
186
|
+
(diagnostic.stem === undefined || diagnostic.stem === match?.[2]));
|
|
187
|
+
let sourceLocation;
|
|
188
|
+
let rejectedReason;
|
|
189
|
+
let resolvable = false;
|
|
190
|
+
if (!match) {
|
|
191
|
+
rejectedReason =
|
|
192
|
+
"Identity must use canonical <skill>/<recipe> syntax.";
|
|
193
|
+
}
|
|
194
|
+
else if (roots.length === 0) {
|
|
195
|
+
rejectedReason = `Active Skill Recipe not found: ${identity}`;
|
|
196
|
+
}
|
|
197
|
+
else if (roots.length > 1) {
|
|
198
|
+
rejectedReason = matchingRejection
|
|
199
|
+
? portableSkillRecipeDiagnosticReason(matchingRejection, namespaces)
|
|
200
|
+
: `Duplicate active Skill identity ${skill}`;
|
|
201
|
+
}
|
|
202
|
+
else if (matchingRejection) {
|
|
203
|
+
rejectedReason = portableSkillRecipeDiagnosticReason(matchingRejection, namespaces);
|
|
204
|
+
if (matchingRejection.file) {
|
|
205
|
+
sourceLocation = portableSkillRecipePath(matchingRejection.file, skill, namespaces);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
try {
|
|
210
|
+
const file = RecipesReferences.resolveRecipeReferencePath(identity, resolutionContext?.cwd, resolutionContext?.activeSkills);
|
|
211
|
+
if (!file || !existsSync(file)) {
|
|
212
|
+
rejectedReason = `Skill Recipe component not found: ${identity}`;
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
sourceLocation = portableSkillRecipePath(file, skill, namespaces);
|
|
216
|
+
const recipe = RecipesReferences.readResolvedRecipeConfig(file, [], {
|
|
217
|
+
skillContext: resolutionContext?.activeSkills,
|
|
218
|
+
});
|
|
219
|
+
if (recipe)
|
|
220
|
+
resolvable = true;
|
|
221
|
+
else {
|
|
222
|
+
rejectedReason =
|
|
223
|
+
RecipesReferences.diagnoseRawRecipeConfigFailure(file) ??
|
|
224
|
+
`Recipe could not be resolved: ${identity}`;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
catch (error) {
|
|
229
|
+
rejectedReason = error instanceof Error ? error.message : String(error);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
const componentStatus = resolvable
|
|
233
|
+
? "available"
|
|
234
|
+
: !match
|
|
235
|
+
? "invalid_identity"
|
|
236
|
+
: roots.length === 0
|
|
237
|
+
? "skill_inactive"
|
|
238
|
+
: roots.length > 1
|
|
239
|
+
? "ambiguous_skill"
|
|
240
|
+
: matchingRejection
|
|
241
|
+
? "rejected"
|
|
242
|
+
: matchingComponent
|
|
243
|
+
? "unresolvable"
|
|
244
|
+
: "missing";
|
|
245
|
+
return {
|
|
246
|
+
identity,
|
|
247
|
+
skill_active: skillActive,
|
|
248
|
+
resolvable,
|
|
249
|
+
catalog_partial: inventory.partial,
|
|
250
|
+
component_status: componentStatus,
|
|
251
|
+
...(sourceLocation ? { source_location: sourceLocation } : {}),
|
|
252
|
+
resolution_generation: resolutionContext?.generation ?? registryStatus?.resolution_generation ?? "unavailable",
|
|
253
|
+
...(rejectedReason ? { rejected_reason: rejectedReason } : {}),
|
|
254
|
+
next_actions: resolvable
|
|
255
|
+
? [
|
|
256
|
+
`spawn recipe=${identity}`,
|
|
257
|
+
`register_tool name=<tool-name> from=${identity}`,
|
|
258
|
+
]
|
|
259
|
+
: roots.length === 0 && skill
|
|
260
|
+
? [
|
|
261
|
+
`activate Skill ${skill}`,
|
|
262
|
+
`inspect target=recipes view=doctor identity=${identity}`,
|
|
263
|
+
]
|
|
264
|
+
: ["inspect target=recipes view=imports verbose=true"],
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
function inspectRecipes(view, input, deps, context) {
|
|
268
|
+
if (view !== "status" &&
|
|
269
|
+
view !== "summary" &&
|
|
270
|
+
view !== "doctor" &&
|
|
271
|
+
view !== "imports" &&
|
|
272
|
+
view !== "reviews") {
|
|
273
|
+
throw new Error("inspect recipes supports view=status, view=summary, view=doctor, view=imports, or view=reviews.");
|
|
274
|
+
}
|
|
275
|
+
const recipeRoot = deps.recipeRoot ?? Paths.getRecipeRoot();
|
|
276
|
+
if (view === "reviews") {
|
|
277
|
+
return ReviewDiagnostics.readAutomaticReviewDiagnostics({ recipeRoot });
|
|
278
|
+
}
|
|
279
|
+
const discovered = RecipesDiscovery.discoverRecipeSources([
|
|
280
|
+
{ root: recipeRoot, defaultTool: true, mutableUsage: true },
|
|
281
|
+
]);
|
|
282
|
+
const resolutionContext = context && typeof context === "object" && "recipeResolutionContext" in context
|
|
283
|
+
? context.recipeResolutionContext
|
|
284
|
+
: undefined;
|
|
285
|
+
const activeSkillContext = resolutionContext?.activeSkills ??
|
|
286
|
+
RecipesReferences.EMPTY_ACTIVE_SKILL_RECIPE_CONTEXT;
|
|
287
|
+
const skillRecipeNamespaces = RecipesReferences.getActiveSkillRecipeNamespaces(activeSkillContext);
|
|
288
|
+
const skillInventory = RecipesReferences.inventoryActiveSkillRecipeComponents(activeSkillContext);
|
|
289
|
+
const registryStatus = deps.registryStatus?.();
|
|
290
|
+
const identity = typeof input.identity === "string" ? input.identity.trim() : "";
|
|
291
|
+
if (identity && view !== "doctor") {
|
|
292
|
+
throw new Error("inspect recipes identity is supported only with view=doctor.");
|
|
293
|
+
}
|
|
294
|
+
if (view === "doctor" && identity) {
|
|
295
|
+
return inspectRecipeIdentity(identity, resolutionContext, skillRecipeNamespaces, skillInventory, registryStatus);
|
|
296
|
+
}
|
|
297
|
+
const skillRecipeComponents = skillInventory.components.map((component) => ({
|
|
298
|
+
identity: component.identity,
|
|
299
|
+
source_kind: "active_skill_component",
|
|
300
|
+
skill: component.skill,
|
|
301
|
+
stem: component.stem,
|
|
302
|
+
imports: component.imports,
|
|
303
|
+
}));
|
|
304
|
+
const skillRecipeComponentDiagnostics = skillInventory.rejected.map((diagnostic) => ({
|
|
305
|
+
error: portableSkillRecipeDiagnosticReason(diagnostic, skillRecipeNamespaces),
|
|
306
|
+
...(diagnostic.file
|
|
307
|
+
? {
|
|
308
|
+
file: portableSkillRecipePath(diagnostic.file, diagnostic.skill, skillRecipeNamespaces),
|
|
309
|
+
}
|
|
310
|
+
: {}),
|
|
311
|
+
skill: diagnostic.skill,
|
|
312
|
+
...(diagnostic.stem ? { stem: diagnostic.stem } : {}),
|
|
313
|
+
}));
|
|
314
|
+
const discoverySummary = RecipesDiscovery.summarizeDiscovery(discovered);
|
|
315
|
+
const summary = {
|
|
316
|
+
...discoverySummary,
|
|
317
|
+
...(registryStatus
|
|
318
|
+
? {
|
|
319
|
+
...registryStatus,
|
|
320
|
+
watched_root: "~/.pi/agent/recipes",
|
|
321
|
+
}
|
|
322
|
+
: {}),
|
|
323
|
+
active: Array.isArray(discoverySummary.active)
|
|
324
|
+
? discoverySummary.active.map((entry) => ({
|
|
325
|
+
...entry,
|
|
326
|
+
source_kind: "user_registry_capability",
|
|
327
|
+
}))
|
|
328
|
+
: discoverySummary.active,
|
|
329
|
+
skill_recipe_components: skillRecipeComponents,
|
|
330
|
+
skill_recipe_component_diagnostics: skillRecipeComponentDiagnostics,
|
|
331
|
+
skill_recipe_catalog_partial: skillInventory.partial,
|
|
332
|
+
active_skill_recipe_identities: Object.keys(skillRecipeNamespaces).sort(),
|
|
333
|
+
skill_recipe_namespace_diagnostics: Object.entries(skillRecipeNamespaces)
|
|
334
|
+
.filter(([, roots]) => roots.length > 1)
|
|
335
|
+
.map(([name]) => ({
|
|
336
|
+
name,
|
|
337
|
+
error: `Ambiguous active Skill Recipe namespace ${name}`,
|
|
338
|
+
})),
|
|
339
|
+
drafts: RecipesDiscovery.listDraftRecipes(join(recipeRoot, "drafts")),
|
|
340
|
+
};
|
|
341
|
+
return {
|
|
342
|
+
...summary,
|
|
343
|
+
next_actions: ToolsResponse.recipeRegistryNextActions(summary, view),
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
function parseRunTarget(target) {
|
|
347
|
+
if (!target.startsWith("run:"))
|
|
348
|
+
return undefined;
|
|
349
|
+
const run = target.slice(4);
|
|
350
|
+
return run && /^[A-Za-z0-9_.-]+$/.test(run) ? run : undefined;
|
|
351
|
+
}
|
|
352
|
+
function inspectRun(run, view, input, ctx, deps) {
|
|
353
|
+
if (view !== "recipe" && view !== "trace" && view !== "control") {
|
|
354
|
+
throw new Error("inspect run:<id> supports view=recipe, view=trace, or view=control.");
|
|
355
|
+
}
|
|
356
|
+
const status = deps.getRunStatus
|
|
357
|
+
? deps.getRunStatus(run)
|
|
358
|
+
: ToolsAccess.assertRunAccessibleToContext(run, ctx);
|
|
359
|
+
const stateDir = String(status.state_dir);
|
|
360
|
+
if (view === "recipe") {
|
|
361
|
+
return Inspector.readActorInspectorRecipe(stateDir);
|
|
362
|
+
}
|
|
363
|
+
if (view === "trace") {
|
|
364
|
+
const source = typeof input.source === "string" ? input.source : "all";
|
|
365
|
+
if (source !== "all" &&
|
|
366
|
+
source !== "lifecycle" &&
|
|
367
|
+
source !== "control" &&
|
|
368
|
+
source !== "process" &&
|
|
369
|
+
source !== "agent" &&
|
|
370
|
+
source !== "artifact" &&
|
|
371
|
+
source !== "runtime") {
|
|
372
|
+
throw new Error(`unsupported Trace source: ${source}`);
|
|
373
|
+
}
|
|
374
|
+
return {
|
|
375
|
+
run, source,
|
|
376
|
+
summary: RunsTrace.summarizeRunTraceJournal(RunsTrace.readRunTraceJournal(stateDir)),
|
|
377
|
+
items: TraceProjection.projectRunTrace(stateDir, {
|
|
378
|
+
artifacts: status.artifacts,
|
|
379
|
+
limit: Number(input.lines || Limits.DEFAULT_INSPECT_LINES),
|
|
380
|
+
source,
|
|
381
|
+
}),
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
const runInstanceId = String(status.run_instance_id ?? "");
|
|
385
|
+
const journal = RunsControls.readRunControlJournalFromStateDir(stateDir);
|
|
386
|
+
const capacity = computeRunControlCapacity(journal.records);
|
|
387
|
+
const structuralDiagnostics = journal.records.flatMap((value) => {
|
|
388
|
+
const classified = RuntimeTriage.classifyRuntimeControl({ run,
|
|
389
|
+
runInstanceId: runInstanceId || undefined, status: String(status.status ?? "unknown") }, value, Date.now());
|
|
390
|
+
return classified.diagnostic ? [classified.diagnostic.reason] : [];
|
|
391
|
+
});
|
|
392
|
+
let journalBytes = 0;
|
|
393
|
+
try {
|
|
394
|
+
journalBytes = statSync(RunsControls.runControlsFile(stateDir)).size;
|
|
395
|
+
}
|
|
396
|
+
catch { }
|
|
397
|
+
const diagnostics = [...journal.diagnostics.map((item) => ({
|
|
398
|
+
...(item.line === undefined ? {} : { line: item.line }),
|
|
399
|
+
reason: item.line === undefined ? "unreadable_control_journal" : "invalid_control_json",
|
|
400
|
+
})), ...structuralDiagnostics.map((reason) => ({ reason }))].slice(0, 40);
|
|
401
|
+
const nowMs = Date.now();
|
|
402
|
+
const stalePending = journal.records.reduce((count, control) => count + Number(Boolean(RuntimeTriage.classifyRuntimeControl({ run, runInstanceId: runInstanceId || undefined,
|
|
403
|
+
status: String(status.status ?? "unknown") }, control, nowMs).stale)), 0);
|
|
404
|
+
return {
|
|
405
|
+
run,
|
|
406
|
+
run_instance_id: runInstanceId,
|
|
407
|
+
status: status.status,
|
|
408
|
+
pending: capacity.pending, pending_limit: capacity.limit,
|
|
409
|
+
available: capacity.available, backpressured: capacity.backpressured,
|
|
410
|
+
journal_bytes: journalBytes, journal_limit: Limits.RUN_CONTROL_JOURNAL_MAX_BYTES,
|
|
411
|
+
...(capacity.oldest_pending_at ? { oldest_pending_at: capacity.oldest_pending_at } : {}),
|
|
412
|
+
stale_pending: stalePending,
|
|
413
|
+
diagnostics,
|
|
414
|
+
actor_actions: Array.isArray(status.control) ? status.control : [],
|
|
415
|
+
runtime_actions: status.status === "running" ? ["kill"] : ["archive", "prune"],
|
|
416
|
+
endpoint: runInstanceId
|
|
417
|
+
? RunControlDelivery.readRunControlEndpoint(stateDir, runInstanceId)
|
|
418
|
+
: undefined,
|
|
419
|
+
recent_controls: journal.records.slice(-Math.max(1, Number(input.lines || 20))).reverse()
|
|
420
|
+
.map((control) => ControlProjection.projectRunControl(control)),
|
|
421
|
+
};
|
|
422
|
+
}
|
|
423
|
+
function inspectTool(name, view, deps) {
|
|
424
|
+
if (!name || !/^[A-Za-z0-9_.-]+$/.test(name)) {
|
|
425
|
+
throw new Error(`invalid tool target: tool:${name}`);
|
|
426
|
+
}
|
|
427
|
+
if (view !== "status" && view !== "schema") {
|
|
428
|
+
throw new Error("inspect tool:<name> supports view=status or view=schema.");
|
|
429
|
+
}
|
|
430
|
+
const tool = deps.getTool?.(name);
|
|
431
|
+
const status = deps.getToolStatus?.(name);
|
|
432
|
+
if (!tool && !status) {
|
|
433
|
+
throw new Error(`Registered tool not found: ${name}. Next: inspect target=recipes view=doctor; do not substitute spawn for tool invocation.`);
|
|
434
|
+
}
|
|
435
|
+
if (view === "schema" && !tool) {
|
|
436
|
+
throw new Error(`Tool "${name}" is registered but its callable schema is unavailable; callable_now=${String(status?.callable_now ?? false)}, activation_boundary=${String(status?.activation_boundary ?? "host_registration")}. Next: inspect target=tool:${name} view=status.`);
|
|
437
|
+
}
|
|
438
|
+
return {
|
|
439
|
+
name,
|
|
440
|
+
...(view === "status" ? status : {}),
|
|
441
|
+
...(tool
|
|
442
|
+
? {
|
|
443
|
+
description: tool.description,
|
|
444
|
+
parameters: tool.parameters,
|
|
445
|
+
promptSnippet: tool.promptSnippet,
|
|
446
|
+
}
|
|
447
|
+
: {}),
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
function compactResult(target, view, details) {
|
|
451
|
+
if (target === "runtime")
|
|
452
|
+
return compactRuntime(view, details);
|
|
453
|
+
if (target === "recipes" && typeof details.identity === "string") {
|
|
454
|
+
const lines = [
|
|
455
|
+
`recipes doctor identity=${details.identity} skill_active=${String(details.skill_active)} resolvable=${String(details.resolvable)} catalog_partial=${String(details.catalog_partial)} component_status=${String(details.component_status)}`,
|
|
456
|
+
...(details.source_location
|
|
457
|
+
? [`source=${String(details.source_location)}`]
|
|
458
|
+
: []),
|
|
459
|
+
`resolution_generation=${String(details.resolution_generation)}`,
|
|
460
|
+
...(details.rejected_reason
|
|
461
|
+
? [`rejected_reason=${String(details.rejected_reason)}`]
|
|
462
|
+
: []),
|
|
463
|
+
...(details.next_actions ?? []).map((action) => `next=${String(action)}`),
|
|
464
|
+
];
|
|
465
|
+
return `\n${lines.join("\n")}`;
|
|
466
|
+
}
|
|
467
|
+
if (target === "recipes")
|
|
468
|
+
return ToolsResponse.compactRecipeRegistry(details);
|
|
469
|
+
if (target.startsWith("tool:") && view === "status") {
|
|
470
|
+
const required = Array.isArray(details.required_args)
|
|
471
|
+
? details.required_args.map(String).join(",") || "none"
|
|
472
|
+
: "unknown";
|
|
473
|
+
const optional = Array.isArray(details.optional_args)
|
|
474
|
+
? details.optional_args.map(String).join(",") || "none"
|
|
475
|
+
: "unknown";
|
|
476
|
+
const next = Array.isArray(details.next_actions) && details.next_actions.length > 0
|
|
477
|
+
? String(details.next_actions[0])
|
|
478
|
+
: details.callable_now === true
|
|
479
|
+
? `call tool ${target.slice(5)}`
|
|
480
|
+
: `register_tool name=${target.slice(5)} update=true`;
|
|
481
|
+
return `\ntool=${target.slice(5)} source=${String(details.source ?? "unknown")} callable_now=${String(details.callable_now ?? false)} activation_boundary=${String(details.activation_boundary ?? "unknown")} required=${required} optional=${optional} launch_kind=${String(details.launch_kind ?? "none")} spawn_calls=${Number(details.spawn_calls ?? 0)} tool_calls=${Number(details.tool_calls ?? 0)} next=${next}`;
|
|
482
|
+
}
|
|
483
|
+
if (target.startsWith("tool:"))
|
|
484
|
+
return `\ntool=${target.slice(5)} view=${view}`;
|
|
485
|
+
return `\nrun=${target.slice(4)} view=${view}`;
|
|
486
|
+
}
|
|
487
|
+
export function createInspectToolDefinition(deps = {}) {
|
|
488
|
+
return {
|
|
489
|
+
name: "inspect",
|
|
490
|
+
label: "Inspect",
|
|
491
|
+
description: "Inspect a Run's Recipe, Trace, or Control evidence, or runtime/recipe/tool diagnostics.",
|
|
492
|
+
parameters: Schema.objectSchema({
|
|
493
|
+
identity: Schema.stringSchema("Optional canonical <skill>/<recipe> identity for focused Recipe doctor diagnosis."),
|
|
494
|
+
lines: Schema.stringSchema("Bounded item count for Trace or recent Controls."),
|
|
495
|
+
source: Schema.stringSchema("Optional Trace source: all, lifecycle, control, process, agent, artifact, or runtime."),
|
|
496
|
+
status: Schema.stringSchema("Optional runtime Run status filter."),
|
|
497
|
+
target: Schema.stringSchema("Target: run:<id>, runtime, recipes, or tool:<name>."),
|
|
498
|
+
verbose: Schema.booleanSchema("Return full JSON instead of compact text."),
|
|
499
|
+
view: Schema.stringSchema("Run view recipe|trace|control, or target-specific management view."),
|
|
500
|
+
}, ["target", "view"]),
|
|
501
|
+
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
502
|
+
const input = asRecord(params);
|
|
503
|
+
const target = String(input.target ?? "");
|
|
504
|
+
const view = String(input.view ?? "");
|
|
505
|
+
let details;
|
|
506
|
+
if (target === "runtime") {
|
|
507
|
+
details = inspectRuntime(view, input, ctx, deps);
|
|
508
|
+
}
|
|
509
|
+
else if (target === "recipes") {
|
|
510
|
+
details = inspectRecipes(view, input, deps, ctx);
|
|
511
|
+
}
|
|
512
|
+
else {
|
|
513
|
+
const run = parseRunTarget(target);
|
|
514
|
+
if (run)
|
|
515
|
+
details = inspectRun(run, view, input, ctx, deps);
|
|
516
|
+
else if (target.startsWith("tool:")) {
|
|
517
|
+
details = inspectTool(target.slice(5), view, deps);
|
|
518
|
+
}
|
|
519
|
+
else {
|
|
520
|
+
throw new Error(`unsupported inspect target: ${target}; use run:<id>, runtime, recipes, or tool:<name>`);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
return {
|
|
524
|
+
content: [{
|
|
525
|
+
type: "text",
|
|
526
|
+
text: maybeJsonText(details, input.verbose === true || (target.startsWith("tool:") && view === "schema"), compactResult(target, view, details)),
|
|
527
|
+
}],
|
|
528
|
+
details,
|
|
529
|
+
};
|
|
530
|
+
},
|
|
531
|
+
};
|
|
532
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local tool definition behavior
|
|
3
|
+
* Zones: user recipe tools, generated schemas, async recipe launch
|
|
4
|
+
* Owns wrapping saved local capabilities as executable pi tools
|
|
5
|
+
*/
|
|
6
|
+
import * as ModelContext from "./model-context.ts";
|
|
7
|
+
import type { RegisteredTool } from "./config.ts";
|
|
8
|
+
import * as Execution from "./execution.ts";
|
|
9
|
+
import type * as RecipeResolution from "./recipes-context.ts";
|
|
10
|
+
export interface RuntimeToolContext extends ModelContext.CurrentModelContext {
|
|
11
|
+
recipeResolutionContext?: RecipeResolution.RecipeResolutionContext;
|
|
12
|
+
cwd: string;
|
|
13
|
+
sessionManager?: {
|
|
14
|
+
getSessionId?: () => string;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
export declare function createRuntimeToolDefinition(cfg: RegisteredTool, exec: Execution.RegisteredToolExec): any;
|