@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,111 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry path helpers
|
|
3
|
+
* Zones: paths, registry config, temp directory
|
|
4
|
+
* Owns agent directory, tools config, recipe root, and actor run state root resolution
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { existsSync } from "node:fs";
|
|
8
|
+
import { homedir } from "node:os";
|
|
9
|
+
import { dirname, join, resolve } from "node:path";
|
|
10
|
+
import { fileURLToPath } from "node:url";
|
|
11
|
+
|
|
12
|
+
export function getAgentDir(
|
|
13
|
+
env: Record<string, string | undefined> = process.env,
|
|
14
|
+
): string {
|
|
15
|
+
return env.PI_CODING_AGENT_DIR
|
|
16
|
+
? resolve(env.PI_CODING_AGENT_DIR)
|
|
17
|
+
: join(homedir(), ".pi", "agent");
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export function isAutomaticRecipeReviewEnabled(
|
|
21
|
+
env: Record<string, string | undefined> = process.env,
|
|
22
|
+
): boolean {
|
|
23
|
+
const value = env.PI_ACTORS_AUTOMATIC_REVIEW?.trim().toLowerCase();
|
|
24
|
+
return value === undefined || !["0", "false", "off"].includes(value);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface ExtensionRuntimePaths {
|
|
28
|
+
configPath: string;
|
|
29
|
+
runStateRoot: string;
|
|
30
|
+
tempDir: string;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function getConfigPath(agentDir = getAgentDir()): string {
|
|
34
|
+
return join(agentDir, "tool-registry.json");
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function getExtensionTmpDir(
|
|
38
|
+
agentDir = getAgentDir(),
|
|
39
|
+
extensionName = "pi-actors",
|
|
40
|
+
): string {
|
|
41
|
+
return join(agentDir, "tmp", extensionName);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function getRunStateRoot(agentDir = getAgentDir()): string {
|
|
45
|
+
return join(getExtensionTmpDir(agentDir), "runs");
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export function getDraftSleepRoot(agentDir = getAgentDir()): string {
|
|
49
|
+
return join(getExtensionTmpDir(agentDir), "draft-sleep");
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function getDraftSleepStatePath(agentDir = getAgentDir()): string {
|
|
53
|
+
return join(getDraftSleepRoot(agentDir), "state.json");
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function getDraftSleepBatchDir(
|
|
57
|
+
batchId: string,
|
|
58
|
+
agentDir = getAgentDir(),
|
|
59
|
+
): string {
|
|
60
|
+
if (!/^[a-f0-9-]{36}$/u.test(batchId)) {
|
|
61
|
+
throw new Error("Invalid draft sleep batch id.");
|
|
62
|
+
}
|
|
63
|
+
return join(getDraftSleepRoot(agentDir), "batches", batchId);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export function getToolReviewRoot(agentDir = getAgentDir()): string {
|
|
67
|
+
return join(getExtensionTmpDir(agentDir), "tool-review");
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function getToolReviewStatePath(agentDir = getAgentDir()): string {
|
|
71
|
+
return join(getToolReviewRoot(agentDir), "state.json");
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function getToolReviewBatchDir(
|
|
75
|
+
reviewId: string,
|
|
76
|
+
agentDir = getAgentDir(),
|
|
77
|
+
): string {
|
|
78
|
+
if (!/^[a-f0-9-]{36}$/u.test(reviewId)) {
|
|
79
|
+
throw new Error("Invalid tool review id.");
|
|
80
|
+
}
|
|
81
|
+
return join(getToolReviewRoot(agentDir), "batches", reviewId);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export function getExtensionRuntimePaths(
|
|
85
|
+
agentDir = getAgentDir(),
|
|
86
|
+
): ExtensionRuntimePaths {
|
|
87
|
+
return {
|
|
88
|
+
configPath: getConfigPath(agentDir),
|
|
89
|
+
runStateRoot: getRunStateRoot(agentDir),
|
|
90
|
+
tempDir: getExtensionTmpDir(agentDir),
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const EXTENSION_RUNTIME_PATHS = getExtensionRuntimePaths();
|
|
95
|
+
|
|
96
|
+
export function getExtensionSkillsDir(extensionUrl: string): string {
|
|
97
|
+
return join(dirname(fileURLToPath(extensionUrl)), "skills");
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function getExistingExtensionSkillPaths(extensionUrl: string): string[] {
|
|
101
|
+
const skillsDir = getExtensionSkillsDir(extensionUrl);
|
|
102
|
+
return existsSync(skillsDir) ? [skillsDir] : [];
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
export function getRecipeRoot(agentDir = getAgentDir()): string {
|
|
106
|
+
return join(agentDir, "recipes");
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function getRecipeDraftRoot(agentDir = getAgentDir()): string {
|
|
110
|
+
return join(getRecipeRoot(agentDir), "drafts");
|
|
111
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pi SDK adapter boundary.
|
|
3
|
+
* Zones: pi agent sdk boundary, extension host adapters
|
|
4
|
+
* Owns direct pi SDK imports and exposes narrow pi-actors-facing helpers/types for the composition root.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type {
|
|
8
|
+
ExtensionAPI,
|
|
9
|
+
ExtensionContext,
|
|
10
|
+
} from "@earendil-works/pi-coding-agent";
|
|
11
|
+
|
|
12
|
+
export type { ExtensionAPI, ExtensionContext };
|
|
13
|
+
|
|
14
|
+
export interface PiNotificationSink {
|
|
15
|
+
notify(message: string, level: "info" | "warning" | "error"): void;
|
|
16
|
+
sendFollowUp(message: {
|
|
17
|
+
customType: string;
|
|
18
|
+
content: string;
|
|
19
|
+
display: false;
|
|
20
|
+
details: unknown;
|
|
21
|
+
}): void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function getSessionId(ctx: ExtensionContext): string {
|
|
25
|
+
return ctx.sessionManager.getSessionId();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function createNotificationSink(
|
|
29
|
+
pi: ExtensionAPI,
|
|
30
|
+
ctx: ExtensionContext,
|
|
31
|
+
): PiNotificationSink {
|
|
32
|
+
return {
|
|
33
|
+
notify: (message, level) => ctx.ui.notify(message, level),
|
|
34
|
+
sendFollowUp: (message) =>
|
|
35
|
+
pi.sendMessage(message, {
|
|
36
|
+
deliverAs: "followUp",
|
|
37
|
+
triggerTurn: true,
|
|
38
|
+
}),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function registerToolDefinitions(
|
|
43
|
+
pi: ExtensionAPI,
|
|
44
|
+
definitions: Iterable<unknown>,
|
|
45
|
+
): void {
|
|
46
|
+
for (const definition of definitions) pi.registerTool(definition as never);
|
|
47
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Review preflight diagnostics
|
|
3
|
+
* Zones: recipe diagnostics, subagent launch policy
|
|
4
|
+
* Owns compact classification of failed review-pipeline preflight commands.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export type ReviewPreflightErrorClass =
|
|
8
|
+
| "auth_or_key"
|
|
9
|
+
| "model_unavailable"
|
|
10
|
+
| "quota_or_balance"
|
|
11
|
+
| "rate_limited"
|
|
12
|
+
| "timeout"
|
|
13
|
+
| "transport"
|
|
14
|
+
| "unknown_provider_failure";
|
|
15
|
+
|
|
16
|
+
export interface ReviewPreflightDiagnosticInput {
|
|
17
|
+
args: readonly string[];
|
|
18
|
+
code?: number;
|
|
19
|
+
killed?: boolean;
|
|
20
|
+
promptFile?: string;
|
|
21
|
+
promptText?: string;
|
|
22
|
+
stderr?: string;
|
|
23
|
+
stdout?: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ReviewPreflightDiagnostic {
|
|
27
|
+
errorClass: ReviewPreflightErrorClass;
|
|
28
|
+
model?: string;
|
|
29
|
+
promptFile?: string;
|
|
30
|
+
stage: string;
|
|
31
|
+
suggestedOverrideArgs: string;
|
|
32
|
+
thinking?: string;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const PREFLIGHT_STAGE_PATTERN = /Preflight check for stage\s+([^\s.]+)\.?/i;
|
|
36
|
+
|
|
37
|
+
function getFlagValue(args: readonly string[], flag: string): string | undefined {
|
|
38
|
+
const inlinePrefix = `${flag}=`;
|
|
39
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
40
|
+
const value = args[index];
|
|
41
|
+
if (value === flag) return args[index + 1];
|
|
42
|
+
if (value?.startsWith(inlinePrefix)) return value.slice(inlinePrefix.length);
|
|
43
|
+
}
|
|
44
|
+
return undefined;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function getToolPolicy(args: readonly string[]): string {
|
|
48
|
+
if (args.includes("--no-tools")) return "<tool-policy>";
|
|
49
|
+
return getFlagValue(args, "--tools") ?? "<tool-policy>";
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function extractReviewPreflightStage(
|
|
53
|
+
promptText: string | undefined,
|
|
54
|
+
): string | undefined {
|
|
55
|
+
return promptText?.match(PREFLIGHT_STAGE_PATTERN)?.[1];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function classifyReviewPreflightError(
|
|
59
|
+
text: string,
|
|
60
|
+
killed = false,
|
|
61
|
+
): ReviewPreflightErrorClass {
|
|
62
|
+
if (killed) return "timeout";
|
|
63
|
+
const normalized = text.toLowerCase();
|
|
64
|
+
if (/insufficient[_ -]?quota|\bquota\b|balance|billing|credits?|payment/.test(normalized)) {
|
|
65
|
+
return "quota_or_balance";
|
|
66
|
+
}
|
|
67
|
+
if (/api[_ -]?key|unauthori[sz]ed|forbidden|permission|\b401\b|\b403\b|auth/.test(normalized)) {
|
|
68
|
+
return "auth_or_key";
|
|
69
|
+
}
|
|
70
|
+
if (/\b404\b|not found|unknown model|model .*not (exist|found)|invalid model|unsupported model/.test(normalized)) {
|
|
71
|
+
return "model_unavailable";
|
|
72
|
+
}
|
|
73
|
+
if (/rate limit|\b429\b|too many requests/.test(normalized)) {
|
|
74
|
+
return "rate_limited";
|
|
75
|
+
}
|
|
76
|
+
if (/network|econn|enotfound|etimedout|fetch failed|socket|\btls\b/.test(normalized)) {
|
|
77
|
+
return "transport";
|
|
78
|
+
}
|
|
79
|
+
return "unknown_provider_failure";
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function getStageModelArg(stage: string): string {
|
|
83
|
+
if (
|
|
84
|
+
stage === "reviewer" ||
|
|
85
|
+
stage === "verifier" ||
|
|
86
|
+
stage === "merger" ||
|
|
87
|
+
stage === "judge"
|
|
88
|
+
) {
|
|
89
|
+
return `${stage}_model`;
|
|
90
|
+
}
|
|
91
|
+
return "model";
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
function buildSuggestedOverrideArgs(stage: string, args: readonly string[]): string {
|
|
95
|
+
return `${getStageModelArg(stage)}=<working-model> thinking=<supported-level> tools=${getToolPolicy(args)}`;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export function buildReviewPreflightDiagnostic(
|
|
99
|
+
input: ReviewPreflightDiagnosticInput,
|
|
100
|
+
): ReviewPreflightDiagnostic | undefined {
|
|
101
|
+
const stage = extractReviewPreflightStage(input.promptText);
|
|
102
|
+
if (!stage) return undefined;
|
|
103
|
+
return {
|
|
104
|
+
errorClass: classifyReviewPreflightError(
|
|
105
|
+
[input.stderr, input.stdout].filter(Boolean).join("\n"),
|
|
106
|
+
input.killed,
|
|
107
|
+
),
|
|
108
|
+
...(getFlagValue(input.args, "--model")
|
|
109
|
+
? { model: getFlagValue(input.args, "--model") }
|
|
110
|
+
: {}),
|
|
111
|
+
...(input.promptFile ? { promptFile: input.promptFile } : {}),
|
|
112
|
+
stage,
|
|
113
|
+
suggestedOverrideArgs: buildSuggestedOverrideArgs(stage, input.args),
|
|
114
|
+
...(getFlagValue(input.args, "--thinking")
|
|
115
|
+
? { thinking: getFlagValue(input.args, "--thinking") }
|
|
116
|
+
: {}),
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function formatReviewPreflightDiagnostic(
|
|
121
|
+
diagnostic: ReviewPreflightDiagnostic,
|
|
122
|
+
): string {
|
|
123
|
+
return [
|
|
124
|
+
"ACTOR_PREFLIGHT_FAILED",
|
|
125
|
+
`stage=${diagnostic.stage}`,
|
|
126
|
+
...(diagnostic.model ? [`model=${diagnostic.model}`] : []),
|
|
127
|
+
...(diagnostic.thinking ? [`thinking=${diagnostic.thinking}`] : []),
|
|
128
|
+
`error_class=${diagnostic.errorClass}`,
|
|
129
|
+
...(diagnostic.promptFile ? [`prompt_file=${diagnostic.promptFile}`] : []),
|
|
130
|
+
`suggested_override_args=\"${diagnostic.suggestedOverrideArgs}\"`,
|
|
131
|
+
].join(" ");
|
|
132
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt and schema copy helpers
|
|
3
|
+
* Zones: prompts, onboarding, tool schema copy
|
|
4
|
+
* Owns LLM-facing descriptions, prompt snippets, guidelines, and parameter descriptions
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export const REGISTER_TOOL_DESCRIPTION =
|
|
8
|
+
"Register a persistent custom tool from one maintained Recipe, command template, or captured draft. " +
|
|
9
|
+
"Use from for Recipe specialization, template for trusted commands, or draft for promotion. " +
|
|
10
|
+
"Definitions persist under ~/.pi/agent/recipes; activation is reported separately.";
|
|
11
|
+
|
|
12
|
+
export const REGISTER_TOOL_PROMPT_SNIPPET =
|
|
13
|
+
"Register persistent Recipes or command templates as agent-callable tools";
|
|
14
|
+
|
|
15
|
+
export const REGISTER_TOOL_GUIDELINES = [
|
|
16
|
+
"Use register_tool from=<skill>/<recipe> with defaults={...} to specialize a maintained Recipe without copying its contract.",
|
|
17
|
+
"Use register_tool template only for trusted command templates, and use register_tool draft only for captured draft promotion.",
|
|
18
|
+
"After register_tool succeeds, trust its callable_now and activation result; persistence alone is not callability.",
|
|
19
|
+
'Set template=null or template="" in register_tool to delete a persisted tool.',
|
|
20
|
+
"Set update=true in register_tool to overwrite an existing tool registration.",
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
export const ONBOARDING_SYSTEM_PROMPT = `pi-actors Skill routing:
|
|
24
|
+
- Treat active bundled Skills as the operating authority.
|
|
25
|
+
- For non-trivial pi-actors operation, diagnosis, or development, load and read the actors Skill before acting.
|
|
26
|
+
- For work requiring multiple actors or subagents, additionally load and read the swarm Skill.
|
|
27
|
+
- For capability-specific selection or constraints, load the owning capability Skill; actors owns generic mechanics and swarm owns multi-actor methodology.
|
|
28
|
+
- Keep a Skill Recipe distinct from a registered tool and a Recipe spawn distinct from registered-tool invocation; actors owns the proof rules.
|
|
29
|
+
- Treat persistence or registration as distinct from current callability; actors owns activation proof.
|
|
30
|
+
- On failure or disagreement, preserve the logical Recipe identity, stop, and follow actors diagnosis; never bypass the owning Skills with copied contracts, helper paths, shell evaluation, or background-process workarounds.
|
|
31
|
+
- If a capability Skill conflicts with actors about generic mechanics, follow actors and report the stale capability guidance.
|
|
32
|
+
- README and docs are human-facing references, not the normal agent operating path.
|
|
33
|
+
- AGENTS, source, and tests are implementation protocol and evidence; use them when changing or debugging the extension, not as substitutes for operating Skills.`;
|
|
34
|
+
|
|
35
|
+
export const REGISTER_TOOL_PARAM_DESCRIPTIONS = {
|
|
36
|
+
name: "Tool name in snake_case (e.g., 'transcribe')",
|
|
37
|
+
description:
|
|
38
|
+
"Describe what the tool does for the LLM. Required unless deleting; omitted updates keep the old description.",
|
|
39
|
+
from:
|
|
40
|
+
"Recipe to specialize by canonical <skill>/<recipe> identity or explicit .json/.md path. Inherits async, args/types, source defaults, artifacts, Control, and runtime origins.",
|
|
41
|
+
defaults:
|
|
42
|
+
"Optional caller-owned defaults. Keys and values must satisfy the effective source or command-template argument contract.",
|
|
43
|
+
draft:
|
|
44
|
+
"Promote a captured draft Recipe path from ~/.pi/agent/recipes/drafts. This is a source mode; do not combine it with from or template.",
|
|
45
|
+
async:
|
|
46
|
+
"Set true for a co-located async template recipe. Omit for ordinary command templates or file-backed recipe references.",
|
|
47
|
+
template:
|
|
48
|
+
"Trusted command template with {arg} or {arg=default} placeholders. To specialize a Recipe, use from instead. Omitted updates keep the old template; empty string deletes the tool.",
|
|
49
|
+
templateArray:
|
|
50
|
+
"Sequential command-template composition array. Leaves may be strings or objects with template/defaults/timeout/retry/failure/recover.",
|
|
51
|
+
templateNull: "Delete the tool when template is null.",
|
|
52
|
+
args: "Optional comma-separated placeholder declarations. Usually omit because args are derived from template placeholders. Interactive shorthand defaults are accepted and normalized. Example: file,lang,mode=fast",
|
|
53
|
+
update: "Set to true to overwrite an existing tool registration.",
|
|
54
|
+
} as const;
|
|
55
|
+
|
|
56
|
+
export function formatRegisteredToolPromptSnippet(template: unknown): string {
|
|
57
|
+
const rendered =
|
|
58
|
+
typeof template === "string" ? template : JSON.stringify(template);
|
|
59
|
+
return `Execute command template: ${rendered}`;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export function formatRecipeToolPromptSnippet(
|
|
63
|
+
recipe: string,
|
|
64
|
+
asyncRecipe: boolean,
|
|
65
|
+
): string {
|
|
66
|
+
return asyncRecipe
|
|
67
|
+
? `Start async template recipe: ${recipe}`
|
|
68
|
+
: `Execute template recipe: ${recipe}`;
|
|
69
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recipe Control contract.
|
|
3
|
+
* Zones: actor-local action declarations, normalization, reserved-action fencing
|
|
4
|
+
* Owns pure Recipe control validation; Recipe loading and Run capture stay in recipe/run domains.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as Control from "./control.ts";
|
|
8
|
+
import * as Limits from "./limits.ts";
|
|
9
|
+
|
|
10
|
+
const RUNTIME_RUN_ACTIONS = new Set(["archive", "kill", "prune"]);
|
|
11
|
+
|
|
12
|
+
export function normalizeRecipeControl(value: unknown): string[] | undefined {
|
|
13
|
+
if (value === undefined) return undefined;
|
|
14
|
+
if (!Array.isArray(value)) {
|
|
15
|
+
throw new Error("recipe.control must be an array of action strings");
|
|
16
|
+
}
|
|
17
|
+
const actions: string[] = [];
|
|
18
|
+
const seen = new Set<string>();
|
|
19
|
+
for (const raw of value) {
|
|
20
|
+
if (typeof raw !== "string" || !raw.trim()) {
|
|
21
|
+
throw new Error("recipe.control actions must be non-empty strings");
|
|
22
|
+
}
|
|
23
|
+
const action = raw.trim();
|
|
24
|
+
if (!Control.isControlAction(action)) {
|
|
25
|
+
throw new Error(`invalid recipe.control action: ${action}`);
|
|
26
|
+
}
|
|
27
|
+
if (action.length > Limits.CONTROL_ACTION_MAX_LENGTH) {
|
|
28
|
+
throw new Error(
|
|
29
|
+
`recipe.control action exceeds ${Limits.CONTROL_ACTION_MAX_LENGTH} ASCII characters: ${action}`,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
if (RUNTIME_RUN_ACTIONS.has(action)) {
|
|
33
|
+
throw new Error(
|
|
34
|
+
`recipe.control action is runtime-reserved and must not be declared: ${action}`,
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
if (seen.has(action)) {
|
|
38
|
+
throw new Error(`duplicate recipe.control action: ${action}`);
|
|
39
|
+
}
|
|
40
|
+
seen.add(action);
|
|
41
|
+
actions.push(action);
|
|
42
|
+
}
|
|
43
|
+
return actions;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function assertRecipeHasNoMailbox(recipe: Record<string, unknown>): void {
|
|
47
|
+
if (Object.hasOwn(recipe, "mailbox")) {
|
|
48
|
+
throw new Error(
|
|
49
|
+
"recipe.mailbox was removed; replace it with control: [\"action\"] for actor-local inputs and emit Trace events for outputs",
|
|
50
|
+
);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recipe context contracts and prompt assembly.
|
|
3
|
+
* Zones: live session resolution, async runner prompt context, recipe provenance, LLM child launches
|
|
4
|
+
* Owns the immutable live Recipe environment and compact actor context appended to child-agent prompts.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { createHash } from "node:crypto";
|
|
8
|
+
import { writeFileSync } from "node:fs";
|
|
9
|
+
import { basename, resolve } from "node:path";
|
|
10
|
+
|
|
11
|
+
import type { CommandTemplateActorRecipeContext } from "./command-templates.ts";
|
|
12
|
+
import * as RecipesReferences from "./recipes-references.ts";
|
|
13
|
+
import type { TemplateRecipeContextRecord } from "./recipes-references.ts";
|
|
14
|
+
|
|
15
|
+
export interface RecipeResolutionContext {
|
|
16
|
+
readonly activeSkills: RecipesReferences.ActiveSkillRecipeContext;
|
|
17
|
+
readonly cwd: string;
|
|
18
|
+
readonly generation: string;
|
|
19
|
+
readonly sessionId: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function createRecipeResolutionContext(
|
|
23
|
+
sessionId: string,
|
|
24
|
+
cwd: string,
|
|
25
|
+
activeSkills: RecipesReferences.ActiveSkillRecipeContext,
|
|
26
|
+
): RecipeResolutionContext {
|
|
27
|
+
const normalizedSessionId = sessionId.trim();
|
|
28
|
+
if (!normalizedSessionId) throw new Error("Recipe resolution session id is required.");
|
|
29
|
+
const normalizedCwd = resolve(cwd);
|
|
30
|
+
const generation = createHash("sha256")
|
|
31
|
+
.update(
|
|
32
|
+
JSON.stringify({
|
|
33
|
+
activeSkills: RecipesReferences.getActiveSkillRecipeNamespaces(activeSkills),
|
|
34
|
+
cwd: normalizedCwd,
|
|
35
|
+
sessionId: normalizedSessionId,
|
|
36
|
+
}),
|
|
37
|
+
)
|
|
38
|
+
.digest("hex");
|
|
39
|
+
return Object.freeze({
|
|
40
|
+
activeSkills,
|
|
41
|
+
cwd: normalizedCwd,
|
|
42
|
+
generation,
|
|
43
|
+
sessionId: normalizedSessionId,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export function createEmptyRecipeResolutionContext(
|
|
48
|
+
sessionId: string,
|
|
49
|
+
cwd: string,
|
|
50
|
+
): RecipeResolutionContext {
|
|
51
|
+
return createRecipeResolutionContext(
|
|
52
|
+
sessionId,
|
|
53
|
+
cwd,
|
|
54
|
+
RecipesReferences.EMPTY_ACTIVE_SKILL_RECIPE_CONTEXT,
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface MarkedRecipeContextRecord extends TemplateRecipeContextRecord {
|
|
59
|
+
you_are_here?: true;
|
|
60
|
+
you_are_here_path?: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function commandName(command: string): string {
|
|
64
|
+
return basename(command).toLowerCase();
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function isPiCommand(command: string): boolean {
|
|
68
|
+
return commandName(command) === "pi";
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
const PI_PRINT_FLAGS = new Set(["-p", "--print"]);
|
|
72
|
+
const PI_VALUE_OPTIONS = new Set([
|
|
73
|
+
"--api-key",
|
|
74
|
+
"--append-system-prompt",
|
|
75
|
+
"--exclude-tools",
|
|
76
|
+
"--extension",
|
|
77
|
+
"--fork",
|
|
78
|
+
"--mode",
|
|
79
|
+
"--model",
|
|
80
|
+
"--models",
|
|
81
|
+
"--name",
|
|
82
|
+
"--prompt-template",
|
|
83
|
+
"--provider",
|
|
84
|
+
"--session",
|
|
85
|
+
"--session-dir",
|
|
86
|
+
"--skill",
|
|
87
|
+
"--system-prompt",
|
|
88
|
+
"--theme",
|
|
89
|
+
"--thinking",
|
|
90
|
+
"--tools",
|
|
91
|
+
]);
|
|
92
|
+
const PI_SHORT_VALUE_OPTIONS = new Set(["-e", "-n", "-t", "-xt"]);
|
|
93
|
+
|
|
94
|
+
function isPiPrintFlag(arg: string): boolean {
|
|
95
|
+
return PI_PRINT_FLAGS.has(arg);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
function isPiOption(arg: string): boolean {
|
|
99
|
+
return arg.startsWith("-") && arg !== "-";
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
function piOptionConsumesNextArg(arg: string): boolean {
|
|
103
|
+
if (arg.includes("=")) return false;
|
|
104
|
+
return PI_VALUE_OPTIONS.has(arg) || PI_SHORT_VALUE_OPTIONS.has(arg);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function isPiFileArgument(arg: string): boolean {
|
|
108
|
+
return arg.startsWith("@") && arg.length > 1;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function findPiPrintPromptIndexes(args: string[]): number[] {
|
|
112
|
+
let printMode = false;
|
|
113
|
+
let positionalOnly = false;
|
|
114
|
+
const promptIndexes: number[] = [];
|
|
115
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
116
|
+
const arg = args[index];
|
|
117
|
+
if (!positionalOnly && arg === "--") {
|
|
118
|
+
positionalOnly = true;
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
if (!positionalOnly && isPiPrintFlag(arg)) {
|
|
122
|
+
printMode = true;
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
if (!positionalOnly && isPiOption(arg)) {
|
|
126
|
+
if (piOptionConsumesNextArg(arg)) index += 1;
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
if (!printMode || isPiFileArgument(arg)) continue;
|
|
130
|
+
promptIndexes.push(index);
|
|
131
|
+
}
|
|
132
|
+
return promptIndexes;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function findPiPrintPromptIndex(args: string[]): number | undefined {
|
|
136
|
+
return findPiPrintPromptIndexes(args).at(-1);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function matchesActorContext(
|
|
140
|
+
record: TemplateRecipeContextRecord,
|
|
141
|
+
context: CommandTemplateActorRecipeContext | undefined,
|
|
142
|
+
): boolean {
|
|
143
|
+
if (!context) return record.role === "entry";
|
|
144
|
+
if (context.file && context.file === record.source_file) return true;
|
|
145
|
+
if (context.name && context.name === record.name) return true;
|
|
146
|
+
if (context.alias && context.alias === record.alias) return true;
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function contextPath(
|
|
151
|
+
record: TemplateRecipeContextRecord,
|
|
152
|
+
context: CommandTemplateActorRecipeContext | undefined,
|
|
153
|
+
): string {
|
|
154
|
+
return record.import_path.join(".") || context?.path || record.name;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
export function markRecipeContextRecords(
|
|
158
|
+
records: TemplateRecipeContextRecord[],
|
|
159
|
+
context?: CommandTemplateActorRecipeContext,
|
|
160
|
+
): MarkedRecipeContextRecord[] {
|
|
161
|
+
let marked = false;
|
|
162
|
+
const result = records.map((record) => {
|
|
163
|
+
if (marked || !matchesActorContext(record, context)) return record;
|
|
164
|
+
marked = true;
|
|
165
|
+
return {
|
|
166
|
+
...record,
|
|
167
|
+
you_are_here: true as const,
|
|
168
|
+
you_are_here_path: contextPath(record, context),
|
|
169
|
+
};
|
|
170
|
+
});
|
|
171
|
+
return result;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export function formatRecipeContextJsonl(
|
|
175
|
+
records: TemplateRecipeContextRecord[],
|
|
176
|
+
context?: CommandTemplateActorRecipeContext,
|
|
177
|
+
): string {
|
|
178
|
+
return markRecipeContextRecords(records, context)
|
|
179
|
+
.map(({ source_file: _sourceFile, ...record }) => JSON.stringify(record))
|
|
180
|
+
.join("\n");
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export function buildRecipeContextPromptBlock(
|
|
184
|
+
records: TemplateRecipeContextRecord[],
|
|
185
|
+
context?: CommandTemplateActorRecipeContext,
|
|
186
|
+
): string {
|
|
187
|
+
const jsonl = formatRecipeContextJsonl(records, context);
|
|
188
|
+
if (!jsonl) return "";
|
|
189
|
+
return [
|
|
190
|
+
"Actor recipe context bundle follows as JSONL.",
|
|
191
|
+
'Each line is one recipe/context record; `"you_are_here": true` marks the recipe node that launched this actor.',
|
|
192
|
+
"Use this as workflow/composition context, while the task prompt remains authoritative.",
|
|
193
|
+
"```jsonl",
|
|
194
|
+
jsonl,
|
|
195
|
+
"```",
|
|
196
|
+
].join("\n");
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export function appendRecipeContextToPiArgs(
|
|
200
|
+
command: string,
|
|
201
|
+
args: string[],
|
|
202
|
+
records: TemplateRecipeContextRecord[] | undefined,
|
|
203
|
+
context?: CommandTemplateActorRecipeContext,
|
|
204
|
+
): string[] {
|
|
205
|
+
if (!records || records.length === 0 || !isPiCommand(command)) return args;
|
|
206
|
+
const promptIndex = findPiPrintPromptIndex(args);
|
|
207
|
+
if (promptIndex === undefined) return args;
|
|
208
|
+
const block = buildRecipeContextPromptBlock(records, context);
|
|
209
|
+
if (!block) return args;
|
|
210
|
+
const next = [...args];
|
|
211
|
+
next[promptIndex] = `${next[promptIndex]}\n\n${block}`;
|
|
212
|
+
return next;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export interface ManagedPiSessionArgs {
|
|
216
|
+
args: string[];
|
|
217
|
+
sessionDir?: string;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
const PI_SESSION_POLICY_FLAGS = new Set([
|
|
221
|
+
"--fork",
|
|
222
|
+
"--no-session",
|
|
223
|
+
"--session",
|
|
224
|
+
"--session-dir",
|
|
225
|
+
"--session-id",
|
|
226
|
+
]);
|
|
227
|
+
|
|
228
|
+
export function attachPiSessionDir(
|
|
229
|
+
command: string,
|
|
230
|
+
args: string[],
|
|
231
|
+
sessionDir: string,
|
|
232
|
+
): ManagedPiSessionArgs {
|
|
233
|
+
if (!isPiCommand(command) || findPiPrintPromptIndex(args) === undefined) {
|
|
234
|
+
return { args };
|
|
235
|
+
}
|
|
236
|
+
if (args.some((arg) => PI_SESSION_POLICY_FLAGS.has(arg))) return { args };
|
|
237
|
+
return { args: ["--session-dir", sessionDir, ...args], sessionDir };
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
export interface MaterializedPiPrintPromptArgs {
|
|
241
|
+
args: string[];
|
|
242
|
+
promptBytes?: number;
|
|
243
|
+
promptFile?: string;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
export function materializePiPrintPromptArg(
|
|
247
|
+
command: string,
|
|
248
|
+
args: string[],
|
|
249
|
+
promptFile: string | (() => string),
|
|
250
|
+
): MaterializedPiPrintPromptArgs {
|
|
251
|
+
if (!isPiCommand(command)) return { args };
|
|
252
|
+
const promptIndexes = findPiPrintPromptIndexes(args);
|
|
253
|
+
if (promptIndexes.length === 0) return { args };
|
|
254
|
+
const prompt = promptIndexes.map((index) => args[index]).join(" ");
|
|
255
|
+
const path = typeof promptFile === "function" ? promptFile() : promptFile;
|
|
256
|
+
writeFileSync(path, prompt, "utf8");
|
|
257
|
+
const promptIndexSet = new Set(promptIndexes);
|
|
258
|
+
const firstPromptIndex = promptIndexes[0];
|
|
259
|
+
const next = args.flatMap((arg, index) => {
|
|
260
|
+
if (index === firstPromptIndex) return [`@${path}`];
|
|
261
|
+
return promptIndexSet.has(index) ? [] : [arg];
|
|
262
|
+
});
|
|
263
|
+
return {
|
|
264
|
+
args: next,
|
|
265
|
+
promptBytes: Buffer.byteLength(prompt),
|
|
266
|
+
promptFile: path,
|
|
267
|
+
};
|
|
268
|
+
}
|