@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,191 @@
|
|
|
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 AsyncRuns from "./async-runs.js";
|
|
7
|
+
import * as ModelContext from "./model-context.js";
|
|
8
|
+
import * as Execution from "./execution.js";
|
|
9
|
+
import * as Prompts from "./prompts.js";
|
|
10
|
+
import * as RecipesReferences from "./recipes-references.js";
|
|
11
|
+
import * as RecipesUsage from "./recipes-usage.js";
|
|
12
|
+
import * as Schema from "./schema.js";
|
|
13
|
+
import * as ToolsResponse from "./tools-response.js";
|
|
14
|
+
function getRunOwnerId(ctx) {
|
|
15
|
+
return ctx.sessionManager?.getSessionId?.();
|
|
16
|
+
}
|
|
17
|
+
function typedArgSchema(arg, type) {
|
|
18
|
+
const description = !type || type.kind === "string"
|
|
19
|
+
? `Argument: ${arg}`
|
|
20
|
+
: type.kind === "path"
|
|
21
|
+
? `Path argument: ${arg}`
|
|
22
|
+
: `${type.kind[0].toUpperCase()}${type.kind.slice(1)} argument: ${arg}`;
|
|
23
|
+
return Schema.typedArgSchema(description, type);
|
|
24
|
+
}
|
|
25
|
+
function sampleValueForArg(arg, type, defaults) {
|
|
26
|
+
if (Object.hasOwn(defaults, arg))
|
|
27
|
+
return defaults[arg];
|
|
28
|
+
if (!type || type.kind === "string")
|
|
29
|
+
return `<${arg}>`;
|
|
30
|
+
if (type.kind === "path")
|
|
31
|
+
return `./${arg}`;
|
|
32
|
+
if (type.kind === "int")
|
|
33
|
+
return 1;
|
|
34
|
+
if (type.kind === "number")
|
|
35
|
+
return 1.5;
|
|
36
|
+
if (type.kind === "bool")
|
|
37
|
+
return true;
|
|
38
|
+
if (type.kind === "array")
|
|
39
|
+
return [`<${arg}>`];
|
|
40
|
+
return type.values[0] ?? `<${arg}>`;
|
|
41
|
+
}
|
|
42
|
+
function shouldAddRuntimeToolUsageHint(error) {
|
|
43
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
44
|
+
return (/^Argument \S+ must /.test(message) || /^Missing .* value: /.test(message));
|
|
45
|
+
}
|
|
46
|
+
function formatRuntimeToolUsageHint(cfg, required, includeRunId) {
|
|
47
|
+
const optional = cfg.args.filter((arg) => !RecipesReferences.isRuntimeOwnedRecipeInput(arg) &&
|
|
48
|
+
!required.includes(arg));
|
|
49
|
+
const exampleDefaults = {
|
|
50
|
+
...Schema.getExplicitToolArgDefaults(cfg.recipe?.args),
|
|
51
|
+
...cfg.defaults,
|
|
52
|
+
...(cfg.recipe?.values ?? {}),
|
|
53
|
+
};
|
|
54
|
+
const example = {};
|
|
55
|
+
for (const arg of required)
|
|
56
|
+
example[arg] = sampleValueForArg(arg, cfg.argTypes?.[arg], exampleDefaults);
|
|
57
|
+
for (const arg of optional)
|
|
58
|
+
example[arg] = sampleValueForArg(arg, cfg.argTypes?.[arg], exampleDefaults);
|
|
59
|
+
if (includeRunId)
|
|
60
|
+
example.run_id = `${cfg.name}-1`;
|
|
61
|
+
const lines = [
|
|
62
|
+
`Expected call shape for ${cfg.name}:`,
|
|
63
|
+
`${cfg.name}(${JSON.stringify(example, null, 2)})`,
|
|
64
|
+
];
|
|
65
|
+
if (required.length)
|
|
66
|
+
lines.push(`Required: ${required.join(", ")}`);
|
|
67
|
+
if (optional.length || includeRunId)
|
|
68
|
+
lines.push(`Optional: ${[...optional, ...(includeRunId ? ["run_id"] : [])].join(", ")}`);
|
|
69
|
+
return lines.join("\n");
|
|
70
|
+
}
|
|
71
|
+
function resolveRecipeToolValues(cfg, callerValues, ctx) {
|
|
72
|
+
const recipeRuntimeValues = {
|
|
73
|
+
...(cfg.recipe?.recipe_dir
|
|
74
|
+
? { recipe_dir: cfg.recipe.recipe_dir }
|
|
75
|
+
: {}),
|
|
76
|
+
...(cfg.recipe?.skill_dir ? { skill_dir: cfg.recipe.skill_dir } : {}),
|
|
77
|
+
};
|
|
78
|
+
return Schema.normalizeRuntimeValues(ModelContext.withCurrentModelValues({
|
|
79
|
+
...Schema.getExplicitToolArgDefaults(cfg.recipe?.args),
|
|
80
|
+
...cfg.defaults,
|
|
81
|
+
...(cfg.recipe?.values ?? {}),
|
|
82
|
+
...callerValues,
|
|
83
|
+
...recipeRuntimeValues,
|
|
84
|
+
}, ctx), cfg.argTypes);
|
|
85
|
+
}
|
|
86
|
+
function formatRuntimeToolArgumentError(cfg, error, required, includeRunId) {
|
|
87
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
88
|
+
if (!shouldAddRuntimeToolUsageHint(error))
|
|
89
|
+
return error instanceof Error ? error : new Error(message);
|
|
90
|
+
return new Error(`Invalid arguments for tool "${cfg.name}": ${message}\n\n${formatRuntimeToolUsageHint(cfg, required, includeRunId)}`);
|
|
91
|
+
}
|
|
92
|
+
export function createRuntimeToolDefinition(cfg, exec) {
|
|
93
|
+
const paramSchema = {};
|
|
94
|
+
const required = [];
|
|
95
|
+
const isRecipe = RecipesReferences.isRecipeTool(cfg.template, cfg.recipe);
|
|
96
|
+
const isAsyncRecipe = cfg.recipe
|
|
97
|
+
? cfg.recipe.async === true
|
|
98
|
+
: RecipesReferences.isAsyncRecipeReference(cfg.template);
|
|
99
|
+
const isSingletonRecipe = cfg.recipe?.singleton === true;
|
|
100
|
+
const recipeTemplate = cfg.recipe?.template ?? RecipesReferences.getRecipeTemplate(cfg.template);
|
|
101
|
+
const requiredTemplate = recipeTemplate ?? cfg.template;
|
|
102
|
+
const requiredTemplateConfig = typeof requiredTemplate === "object" && !Array.isArray(requiredTemplate)
|
|
103
|
+
? {
|
|
104
|
+
...requiredTemplate,
|
|
105
|
+
args: cfg.args,
|
|
106
|
+
defaults: { ...(requiredTemplate.defaults ?? {}), ...cfg.defaults },
|
|
107
|
+
}
|
|
108
|
+
: {
|
|
109
|
+
args: cfg.args,
|
|
110
|
+
defaults: cfg.defaults,
|
|
111
|
+
template: requiredTemplate,
|
|
112
|
+
};
|
|
113
|
+
const recipeInlineDefaults = Schema.getExplicitToolArgDefaults(cfg.recipe?.args);
|
|
114
|
+
const requiredArgs = isRecipe && cfg.storedArgs !== undefined
|
|
115
|
+
? new Set(cfg.args.filter((arg) => !Object.hasOwn(cfg.defaults, arg) &&
|
|
116
|
+
!Object.hasOwn(recipeInlineDefaults, arg)))
|
|
117
|
+
: !cfg.recipe && RecipesReferences.isRecipeReference(cfg.template) && !recipeTemplate
|
|
118
|
+
? new Set(cfg.args.filter((arg) => !Object.hasOwn(cfg.defaults, arg)))
|
|
119
|
+
: Schema.getRequiredToolArgNames(requiredTemplateConfig);
|
|
120
|
+
for (const arg of cfg.args) {
|
|
121
|
+
if (RecipesReferences.isRuntimeOwnedRecipeInput(arg))
|
|
122
|
+
continue;
|
|
123
|
+
paramSchema[arg] = typedArgSchema(arg, cfg.argTypes?.[arg]);
|
|
124
|
+
if (requiredArgs.has(arg))
|
|
125
|
+
required.push(arg);
|
|
126
|
+
}
|
|
127
|
+
if (isAsyncRecipe && !isSingletonRecipe)
|
|
128
|
+
paramSchema.run_id = Schema.stringSchema("Optional run id override for this async template recipe invocation.");
|
|
129
|
+
if (isAsyncRecipe) {
|
|
130
|
+
paramSchema.transport_context = Schema.looseObjectSchema("Optional originating transport route preserved for detached terminal follow-up.");
|
|
131
|
+
}
|
|
132
|
+
return {
|
|
133
|
+
name: cfg.name,
|
|
134
|
+
label: cfg.name,
|
|
135
|
+
description: cfg.description,
|
|
136
|
+
parameters: Schema.objectSchema(paramSchema, required),
|
|
137
|
+
promptSnippet: isRecipe
|
|
138
|
+
? Prompts.formatRecipeToolPromptSnippet(cfg.recipe?.name ?? String(cfg.template), isAsyncRecipe)
|
|
139
|
+
: Prompts.formatRegisteredToolPromptSnippet(cfg.template),
|
|
140
|
+
async execute(toolCallId, params, signal, _onUpdate, ctx) {
|
|
141
|
+
try {
|
|
142
|
+
if (cfg.sourcePath &&
|
|
143
|
+
!RecipesUsage.recordRecipeLaunch(cfg.sourcePath, new Date(), "tool")) {
|
|
144
|
+
throw new Error(`Recipe launch rejected because its source changed during activation: ${cfg.sourcePath}. Reload recipe tools and retry.`);
|
|
145
|
+
}
|
|
146
|
+
if (isAsyncRecipe) {
|
|
147
|
+
const input = params;
|
|
148
|
+
const { run_id, transport_context, ...values } = input;
|
|
149
|
+
const base = cfg.recipe ? cfg.recipe : { file: String(cfg.template) };
|
|
150
|
+
const runId = isSingletonRecipe
|
|
151
|
+
? undefined
|
|
152
|
+
: typeof run_id === "string" && run_id.trim()
|
|
153
|
+
? run_id.trim()
|
|
154
|
+
: `${cfg.name}-${Date.now()}`;
|
|
155
|
+
const meta = AsyncRuns.startRun({
|
|
156
|
+
...base,
|
|
157
|
+
launch_source: "tool",
|
|
158
|
+
launch_correlation: { tool_call_id: toolCallId },
|
|
159
|
+
...(transport_context &&
|
|
160
|
+
typeof transport_context === "object" &&
|
|
161
|
+
!Array.isArray(transport_context)
|
|
162
|
+
? {
|
|
163
|
+
transport_context: transport_context,
|
|
164
|
+
} : {}),
|
|
165
|
+
ownerId: getRunOwnerId(ctx),
|
|
166
|
+
run_id: runId,
|
|
167
|
+
tool: cfg.name,
|
|
168
|
+
policy_values: ModelContext.withCurrentModelValues({ ...(cfg.recipe?.values ?? {}), ...values }, ctx),
|
|
169
|
+
values: resolveRecipeToolValues(cfg, values, ctx),
|
|
170
|
+
}, ctx.cwd, { skillContext: ctx.recipeResolutionContext?.activeSkills });
|
|
171
|
+
return {
|
|
172
|
+
content: [
|
|
173
|
+
{
|
|
174
|
+
type: "text",
|
|
175
|
+
text: ToolsResponse.compactAsyncRunStatus(meta),
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
details: meta,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
if (isRecipe && recipeTemplate) {
|
|
182
|
+
return await Execution.executeRegisteredTool({ ...cfg, template: recipeTemplate }, resolveRecipeToolValues(cfg, params, ctx), exec, ctx.cwd, signal);
|
|
183
|
+
}
|
|
184
|
+
return await Execution.executeRegisteredTool(cfg, Schema.normalizeRuntimeValues(ModelContext.withCurrentModelValues(params, ctx), cfg.argTypes), exec, ctx.cwd, signal);
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
throw formatRuntimeToolArgumentError(cfg, error, required, isAsyncRecipe && !isSingletonRecipe);
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public Control facade under the stable `message` tool name.
|
|
3
|
+
* Zones: Control request validation, Run/runtime dispatch, compact receipts
|
|
4
|
+
* Owns public Control execution; journaling, delivery, and lifecycle mutation stay in Run domains.
|
|
5
|
+
*/
|
|
6
|
+
export interface ControlToolDeps {
|
|
7
|
+
handleRuntimeControl?: (action: string, input: unknown) => Record<string, unknown>;
|
|
8
|
+
}
|
|
9
|
+
export declare function createControlToolDefinition<TContext = unknown>(deps?: ControlToolDeps): any;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public Control facade under the stable `message` tool name.
|
|
3
|
+
* Zones: Control request validation, Run/runtime dispatch, compact receipts
|
|
4
|
+
* Owns public Control execution; journaling, delivery, and lifecycle mutation stay in Run domains.
|
|
5
|
+
*/
|
|
6
|
+
import * as AsyncRuns from "./async-runs.js";
|
|
7
|
+
import * as Control from "./control.js";
|
|
8
|
+
import * as Schema from "./schema.js";
|
|
9
|
+
import * as ToolsAccess from "./tools-access.js";
|
|
10
|
+
import * as ToolsResponse from "./tools-response.js";
|
|
11
|
+
function asRecord(value) {
|
|
12
|
+
return value && typeof value === "object" && !Array.isArray(value)
|
|
13
|
+
? value
|
|
14
|
+
: {};
|
|
15
|
+
}
|
|
16
|
+
function compactControlResult(request, result) {
|
|
17
|
+
const tokens = [
|
|
18
|
+
`target=${request.target}`,
|
|
19
|
+
`action=${request.action}`,
|
|
20
|
+
`status=${String(result.delivery ?? result.status ?? (result.stopped === true ? "handled" : "accepted"))}`,
|
|
21
|
+
];
|
|
22
|
+
if (result.control_id)
|
|
23
|
+
tokens.push(`control=${String(result.control_id)}`);
|
|
24
|
+
if (result.reason)
|
|
25
|
+
tokens.push(`reason=${String(result.reason).replaceAll(/\s+/g, "_")}`);
|
|
26
|
+
if (Array.isArray(result.next_actions) && result.next_actions.length > 0) {
|
|
27
|
+
tokens.push(`next=${result.next_actions
|
|
28
|
+
.map((action) => action.replaceAll(/\s+/g, "_"))
|
|
29
|
+
.join("|")}`);
|
|
30
|
+
}
|
|
31
|
+
return `\n${tokens.join(" ")}`;
|
|
32
|
+
}
|
|
33
|
+
function runNextActions(run, result) {
|
|
34
|
+
if (result.delivery === "queued" || result.delivery === "delivered") {
|
|
35
|
+
return [`inspect target=run:${run} view=control`];
|
|
36
|
+
}
|
|
37
|
+
if (result.stopped === true)
|
|
38
|
+
return [`inspect target=run:${run} view=control`];
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
export function createControlToolDefinition(deps = {}) {
|
|
42
|
+
return {
|
|
43
|
+
name: "message",
|
|
44
|
+
label: "Control",
|
|
45
|
+
description: "Apply one Control action to an existing Run or the pi-actors runtime.",
|
|
46
|
+
parameters: Schema.objectSchema({
|
|
47
|
+
target: Schema.stringSchema("Run target run:<id>, or literal runtime."),
|
|
48
|
+
action: Schema.stringSchema("Lowercase ASCII Control action, at most 64 characters."),
|
|
49
|
+
input: Schema.unionSchema([
|
|
50
|
+
Schema.stringSchema("Optional Control input string; serialized JSON must fit 380 bytes."),
|
|
51
|
+
Schema.looseObjectSchema("Optional structured Control input; serialized JSON must fit 380 bytes."),
|
|
52
|
+
Schema.arraySchema("Optional structured Control input array; serialized JSON must fit 380 bytes."),
|
|
53
|
+
]),
|
|
54
|
+
verbose: Schema.booleanSchema("Return full JSON instead of compact text."),
|
|
55
|
+
}, ["target", "action"]),
|
|
56
|
+
async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
|
|
57
|
+
const request = Control.normalizeControlRequest(params);
|
|
58
|
+
let result;
|
|
59
|
+
if (request.target === "runtime") {
|
|
60
|
+
if (request.action !== "review.retry" && request.action !== "review.reset") {
|
|
61
|
+
throw new Error(`unsupported runtime Control action: ${request.action}; use review.retry or review.reset`);
|
|
62
|
+
}
|
|
63
|
+
if (!deps.handleRuntimeControl) {
|
|
64
|
+
throw new Error("runtime Control is unavailable");
|
|
65
|
+
}
|
|
66
|
+
result = deps.handleRuntimeControl(request.action, request.input);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
const run = request.target.slice(4);
|
|
70
|
+
const status = ToolsAccess.assertRunAccessibleToContext(run, ctx);
|
|
71
|
+
const runInstanceId = typeof status.run_instance_id === "string"
|
|
72
|
+
? status.run_instance_id
|
|
73
|
+
: undefined;
|
|
74
|
+
if (!runInstanceId)
|
|
75
|
+
throw new Error(`Run generation unavailable: ${run}`);
|
|
76
|
+
if (request.action === "kill") {
|
|
77
|
+
result = AsyncRuns.killRun(run, {
|
|
78
|
+
...(typeof status.ownerId === "string"
|
|
79
|
+
? { ownerId: status.ownerId }
|
|
80
|
+
: {}),
|
|
81
|
+
runInstanceId,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
else if (request.action === "archive") {
|
|
85
|
+
result = AsyncRuns.archiveRun(run, {
|
|
86
|
+
...(typeof status.ownerId === "string"
|
|
87
|
+
? { ownerId: status.ownerId }
|
|
88
|
+
: {}),
|
|
89
|
+
runInstanceId,
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
else if (request.action === "prune") {
|
|
93
|
+
const input = asRecord(request.input);
|
|
94
|
+
result = AsyncRuns.pruneRun(run, {
|
|
95
|
+
preserveArtifacts: input.preserve_artifacts === true ||
|
|
96
|
+
input.preserveArtifacts === true,
|
|
97
|
+
}, {
|
|
98
|
+
...(typeof status.ownerId === "string"
|
|
99
|
+
? { ownerId: status.ownerId }
|
|
100
|
+
: {}),
|
|
101
|
+
runInstanceId,
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
const declared = Array.isArray(status.control)
|
|
106
|
+
? status.control.filter((action) => typeof action === "string")
|
|
107
|
+
: [];
|
|
108
|
+
if (!declared.includes(request.action)) {
|
|
109
|
+
throw new Error(`undeclared Run Control action: ${request.action}; available=${declared.join(",") || "none"}`);
|
|
110
|
+
}
|
|
111
|
+
result = await AsyncRuns.sendRunControl(run, {
|
|
112
|
+
action: request.action,
|
|
113
|
+
...(request.input !== undefined ? { input: request.input } : {}),
|
|
114
|
+
run_instance_id: runInstanceId,
|
|
115
|
+
}, {
|
|
116
|
+
...(typeof status.ownerId === "string"
|
|
117
|
+
? { ownerId: status.ownerId }
|
|
118
|
+
: {}),
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
const nextActions = runNextActions(run, result);
|
|
122
|
+
if (nextActions.length > 0)
|
|
123
|
+
result = { ...result, next_actions: nextActions };
|
|
124
|
+
}
|
|
125
|
+
const response = { control: request, result };
|
|
126
|
+
return {
|
|
127
|
+
content: [
|
|
128
|
+
{
|
|
129
|
+
type: "text",
|
|
130
|
+
text: request.verbose === true
|
|
131
|
+
? ToolsResponse.jsonText(response)
|
|
132
|
+
: compactControlResult(request, result),
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
details: response,
|
|
136
|
+
};
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public register_tool behavior
|
|
3
|
+
* Zones: runtime tool registration, tool registry mutation, register_tool schema
|
|
4
|
+
* Owns the public register_tool definition that persists local agent capabilities
|
|
5
|
+
*/
|
|
6
|
+
import * as Registry from "./registry.ts";
|
|
7
|
+
import * as Schema from "./schema.ts";
|
|
8
|
+
export type RegisterToolInput = Registry.RegisterToolInput;
|
|
9
|
+
export type RegisterToolRuntimeDeps<TContext> = Registry.RegisterToolRuntimeDeps<TContext>;
|
|
10
|
+
export declare function createRegisterToolDefinition<TContext>(deps: RegisterToolRuntimeDeps<TContext>): {
|
|
11
|
+
name: string;
|
|
12
|
+
label: string;
|
|
13
|
+
description: string;
|
|
14
|
+
promptSnippet: string;
|
|
15
|
+
promptGuidelines: string[];
|
|
16
|
+
parameters: Schema.JsonSchema;
|
|
17
|
+
execute: (_toolCallId: string, params: unknown, _signal: AbortSignal | undefined, _onUpdate: unknown, ctx: TContext) => Promise<Registry.RegisterToolResult>;
|
|
18
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public register_tool behavior
|
|
3
|
+
* Zones: runtime tool registration, tool registry mutation, register_tool schema
|
|
4
|
+
* Owns the public register_tool definition that persists local agent capabilities
|
|
5
|
+
*/
|
|
6
|
+
import * as Prompts from "./prompts.js";
|
|
7
|
+
import * as Registry from "./registry.js";
|
|
8
|
+
import * as Schema from "./schema.js";
|
|
9
|
+
const stringSchema = Schema.stringSchema;
|
|
10
|
+
const booleanSchema = Schema.booleanSchema;
|
|
11
|
+
const nullSchema = Schema.nullSchema;
|
|
12
|
+
const arraySchema = Schema.arraySchema;
|
|
13
|
+
const unionSchema = Schema.unionSchema;
|
|
14
|
+
const objectSchema = Schema.objectSchema;
|
|
15
|
+
const looseObjectSchema = Schema.looseObjectSchema;
|
|
16
|
+
export function createRegisterToolDefinition(deps) {
|
|
17
|
+
return {
|
|
18
|
+
name: "register_tool",
|
|
19
|
+
label: "Register Tool",
|
|
20
|
+
description: Prompts.REGISTER_TOOL_DESCRIPTION,
|
|
21
|
+
promptSnippet: Prompts.REGISTER_TOOL_PROMPT_SNIPPET,
|
|
22
|
+
promptGuidelines: Prompts.REGISTER_TOOL_GUIDELINES,
|
|
23
|
+
parameters: objectSchema({
|
|
24
|
+
args: stringSchema(Prompts.REGISTER_TOOL_PARAM_DESCRIPTIONS.args),
|
|
25
|
+
async: booleanSchema(Prompts.REGISTER_TOOL_PARAM_DESCRIPTIONS.async),
|
|
26
|
+
description: stringSchema(Prompts.REGISTER_TOOL_PARAM_DESCRIPTIONS.description),
|
|
27
|
+
defaults: looseObjectSchema(Prompts.REGISTER_TOOL_PARAM_DESCRIPTIONS.defaults),
|
|
28
|
+
draft: stringSchema(Prompts.REGISTER_TOOL_PARAM_DESCRIPTIONS.draft),
|
|
29
|
+
from: stringSchema(Prompts.REGISTER_TOOL_PARAM_DESCRIPTIONS.from),
|
|
30
|
+
name: stringSchema(Prompts.REGISTER_TOOL_PARAM_DESCRIPTIONS.name),
|
|
31
|
+
template: unionSchema([
|
|
32
|
+
stringSchema(Prompts.REGISTER_TOOL_PARAM_DESCRIPTIONS.template),
|
|
33
|
+
looseObjectSchema(Prompts.REGISTER_TOOL_PARAM_DESCRIPTIONS.template),
|
|
34
|
+
arraySchema(Prompts.REGISTER_TOOL_PARAM_DESCRIPTIONS.templateArray),
|
|
35
|
+
nullSchema(Prompts.REGISTER_TOOL_PARAM_DESCRIPTIONS.templateNull),
|
|
36
|
+
]),
|
|
37
|
+
update: booleanSchema(Prompts.REGISTER_TOOL_PARAM_DESCRIPTIONS.update),
|
|
38
|
+
}, []),
|
|
39
|
+
execute: async (_toolCallId, params, _signal, _onUpdate, ctx) => Registry.executeRegisterTool(params, ctx, deps),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public tool response formatting
|
|
3
|
+
* Zones: compact text summaries, verbose JSON switching, next-action rendering
|
|
4
|
+
* Owns model-facing response helpers shared by public tool execution paths
|
|
5
|
+
*/
|
|
6
|
+
export declare function withLeadingLineBreak(text: string): string;
|
|
7
|
+
export declare function spaceToolResult<T>(result: T): T;
|
|
8
|
+
export declare function spaceToolError(error: unknown): unknown;
|
|
9
|
+
export declare function asRecord(value: unknown): Record<string, unknown>;
|
|
10
|
+
export declare function jsonText(value: unknown): string;
|
|
11
|
+
export declare function compactPreview(value: unknown, maxLength?: number): string | undefined;
|
|
12
|
+
export declare function compactNextActions(actions: string[]): string;
|
|
13
|
+
export declare function runNextActions(run: unknown): string[];
|
|
14
|
+
export declare function compactAsyncRunStatus(value: unknown): string;
|
|
15
|
+
export declare function maybeJsonText(value: unknown, verbose: boolean | undefined, compact: string): string;
|
|
16
|
+
export declare function compactRecipeImports(summary: Record<string, unknown>): string;
|
|
17
|
+
export declare function compactRecipeDoctor(summary: Record<string, unknown>): string;
|
|
18
|
+
export declare function recipeRegistryNextActions(summary: Record<string, unknown>, view: string): string[];
|
|
19
|
+
export declare function compactRecipeRegistry(summary: Record<string, unknown>): string;
|
|
20
|
+
export declare const DEFAULT_INSPECT_LINES = 40;
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public tool response formatting
|
|
3
|
+
* Zones: compact text summaries, verbose JSON switching, next-action rendering
|
|
4
|
+
* Owns model-facing response helpers shared by public tool execution paths
|
|
5
|
+
*/
|
|
6
|
+
import * as Limits from "./limits.js";
|
|
7
|
+
export function withLeadingLineBreak(text) {
|
|
8
|
+
return `\n${text.replace(/^\n+/, "")}`;
|
|
9
|
+
}
|
|
10
|
+
export function spaceToolResult(result) {
|
|
11
|
+
if (!result || typeof result !== "object")
|
|
12
|
+
return result;
|
|
13
|
+
const content = result.content;
|
|
14
|
+
if (!Array.isArray(content))
|
|
15
|
+
return result;
|
|
16
|
+
return {
|
|
17
|
+
...result,
|
|
18
|
+
content: content.map((item) => item &&
|
|
19
|
+
typeof item === "object" &&
|
|
20
|
+
item.type === "text" &&
|
|
21
|
+
typeof item.text === "string"
|
|
22
|
+
? {
|
|
23
|
+
...item,
|
|
24
|
+
text: withLeadingLineBreak(item.text),
|
|
25
|
+
}
|
|
26
|
+
: item),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function spaceToolError(error) {
|
|
30
|
+
if (error instanceof Error) {
|
|
31
|
+
error.message = withLeadingLineBreak(error.message);
|
|
32
|
+
return error;
|
|
33
|
+
}
|
|
34
|
+
return new Error(withLeadingLineBreak(String(error)));
|
|
35
|
+
}
|
|
36
|
+
export function asRecord(value) {
|
|
37
|
+
return value && typeof value === "object" && !Array.isArray(value)
|
|
38
|
+
? value
|
|
39
|
+
: {};
|
|
40
|
+
}
|
|
41
|
+
export function jsonText(value) {
|
|
42
|
+
return `\n${JSON.stringify(value, null, 2)}`;
|
|
43
|
+
}
|
|
44
|
+
export function compactPreview(value, maxLength = Limits.COMPACT_PREVIEW_CHARS) {
|
|
45
|
+
if (value === undefined)
|
|
46
|
+
return undefined;
|
|
47
|
+
const text = typeof value === "string" ? value : JSON.stringify(value, undefined, 0);
|
|
48
|
+
const compact = text.replaceAll(/\s+/g, "_");
|
|
49
|
+
return compact.length > maxLength
|
|
50
|
+
? `${compact.slice(0, Math.max(0, maxLength - 1))}…`
|
|
51
|
+
: compact;
|
|
52
|
+
}
|
|
53
|
+
export function compactNextActions(actions) {
|
|
54
|
+
return actions.length
|
|
55
|
+
? ` next=${actions.map((action) => action.replaceAll(/\s+/g, "_")).join("|")}`
|
|
56
|
+
: "";
|
|
57
|
+
}
|
|
58
|
+
function formatFailureCount(value) {
|
|
59
|
+
return Array.isArray(value) ? value.length : undefined;
|
|
60
|
+
}
|
|
61
|
+
function compactPolicyAxis(label, value) {
|
|
62
|
+
const axis = asRecord(value);
|
|
63
|
+
const source = typeof axis.source === "string" ? axis.source : undefined;
|
|
64
|
+
if (!source || source === "unused")
|
|
65
|
+
return undefined;
|
|
66
|
+
const renderedValue = typeof axis.value === "string" && axis.value.trim()
|
|
67
|
+
? `:${axis.value.trim()}`
|
|
68
|
+
: "";
|
|
69
|
+
return `${label}=${source}${renderedValue}`;
|
|
70
|
+
}
|
|
71
|
+
function compactModelPolicy(value) {
|
|
72
|
+
const policy = asRecord(value);
|
|
73
|
+
return [
|
|
74
|
+
compactPolicyAxis("model", policy.model),
|
|
75
|
+
compactPolicyAxis("thinking", policy.thinking),
|
|
76
|
+
].filter((token) => Boolean(token));
|
|
77
|
+
}
|
|
78
|
+
export function runNextActions(run) {
|
|
79
|
+
const id = String(run ?? "").trim();
|
|
80
|
+
if (!id)
|
|
81
|
+
return [];
|
|
82
|
+
return [
|
|
83
|
+
`inspect target=run:${id} view=recipe`,
|
|
84
|
+
`inspect target=run:${id} view=trace`,
|
|
85
|
+
`inspect target=run:${id} view=control`,
|
|
86
|
+
];
|
|
87
|
+
}
|
|
88
|
+
export function compactAsyncRunStatus(value) {
|
|
89
|
+
const status = asRecord(value);
|
|
90
|
+
const progress = asRecord(status.progress);
|
|
91
|
+
const result = asRecord(status.result);
|
|
92
|
+
const run = String(status.run ?? "<unknown>");
|
|
93
|
+
const tokens = [`run=${run}`, `status=${String(status.status ?? "unknown")}`];
|
|
94
|
+
if (status.launch_kind)
|
|
95
|
+
tokens.push(`launch_kind=${String(status.launch_kind)}`);
|
|
96
|
+
tokens.push(...compactModelPolicy(status.model_policy ?? progress.model_policy));
|
|
97
|
+
if (status.tool)
|
|
98
|
+
tokens.push(`tool=${String(status.tool)}`);
|
|
99
|
+
if (status.recipe)
|
|
100
|
+
tokens.push(`recipe=${String(status.recipe)}`);
|
|
101
|
+
if (status.retire_when)
|
|
102
|
+
tokens.push(`retire_when=${String(status.retire_when)}`);
|
|
103
|
+
if (Number(status.pid) > 0)
|
|
104
|
+
tokens.push(`pid=${Number(status.pid)}`);
|
|
105
|
+
if (progress.phase && progress.phase !== status.status)
|
|
106
|
+
tokens.push(`phase=${String(progress.phase)}`);
|
|
107
|
+
if (Number(progress.activeSubagents) > 0)
|
|
108
|
+
tokens.push(`active=${Number(progress.activeSubagents)}`);
|
|
109
|
+
if (Number(progress.completed) > 0)
|
|
110
|
+
tokens.push(`completed=${Number(progress.completed)}`);
|
|
111
|
+
const failures = formatFailureCount(progress.failures);
|
|
112
|
+
if (failures !== undefined && failures > 0)
|
|
113
|
+
tokens.push(`failures=${failures}`);
|
|
114
|
+
if (result.code !== undefined)
|
|
115
|
+
tokens.push(`code=${String(result.code)}`);
|
|
116
|
+
if (result.killed === true)
|
|
117
|
+
tokens.push("killed=true");
|
|
118
|
+
const draftRecipe = status.draft_recipe;
|
|
119
|
+
if (draftRecipe)
|
|
120
|
+
tokens.push(`draft_recipe=${String(draftRecipe)}`);
|
|
121
|
+
const nextActions = runNextActions(run);
|
|
122
|
+
if (nextActions.length > 0)
|
|
123
|
+
tokens.push(`next=${nextActions.map((action) => action.replaceAll(/\s+/g, "_")).join("|")}`);
|
|
124
|
+
return `\n${tokens.join(" ")}`;
|
|
125
|
+
}
|
|
126
|
+
export function maybeJsonText(value, verbose, compact) {
|
|
127
|
+
return verbose ? jsonText(value) : compact;
|
|
128
|
+
}
|
|
129
|
+
export function compactRecipeImports(summary) {
|
|
130
|
+
const active = Array.isArray(summary.active)
|
|
131
|
+
? summary.active
|
|
132
|
+
: [];
|
|
133
|
+
const lines = active.flatMap((entry) => {
|
|
134
|
+
const imports = asRecord(entry.imports);
|
|
135
|
+
return Object.entries(imports).map(([alias, value]) => {
|
|
136
|
+
const binding = typeof value === "string" ? { from: value } : asRecord(value);
|
|
137
|
+
return `recipe=${String(entry.id ?? "<unknown>")} alias=${alias} from=${String(binding.from ?? value)}`;
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
return lines.length ? `\n${lines.join("\n")}` : "\n(no recipe imports)";
|
|
141
|
+
}
|
|
142
|
+
export function compactRecipeDoctor(summary) {
|
|
143
|
+
const details = Array.isArray(summary.diagnostic_details)
|
|
144
|
+
? summary.diagnostic_details
|
|
145
|
+
: [];
|
|
146
|
+
const remediations = Array.isArray(summary.remediations)
|
|
147
|
+
? summary.remediations
|
|
148
|
+
: [];
|
|
149
|
+
const recommendations = Array.isArray(summary.recommendations)
|
|
150
|
+
? summary.recommendations
|
|
151
|
+
: [];
|
|
152
|
+
const riskSummary = Array.isArray(summary.risk_summary)
|
|
153
|
+
? summary.risk_summary
|
|
154
|
+
: [];
|
|
155
|
+
const counts = { error: 0, info: 0, warning: 0 };
|
|
156
|
+
for (const detail of details) {
|
|
157
|
+
const severity = String(detail.severity ?? "info");
|
|
158
|
+
if (severity === "error" || severity === "warning" || severity === "info")
|
|
159
|
+
counts[severity] += 1;
|
|
160
|
+
}
|
|
161
|
+
const riskCount = riskSummary.reduce((total, item) => total + Number(item.count ?? 0), 0);
|
|
162
|
+
const topRisks = riskSummary
|
|
163
|
+
.slice(0, 4)
|
|
164
|
+
.map((item) => `${String(item.label)}:${String(item.count ?? 0)}`)
|
|
165
|
+
.join(",");
|
|
166
|
+
const topAction = asRecord(summary.top_action);
|
|
167
|
+
const lines = [
|
|
168
|
+
`recipes doctor errors=${counts.error} warnings=${counts.warning} info=${counts.info} actions=${remediations.length} recommendations=${recommendations.length} risks=${riskCount}${topRisks ? ` top_risks=${topRisks}` : ""}`,
|
|
169
|
+
];
|
|
170
|
+
if (Object.keys(topAction).length > 0) {
|
|
171
|
+
const action = compactPreview(topAction.action, Limits.DOCTOR_ACTION_PREVIEW_CHARS);
|
|
172
|
+
lines.push(`top severity=${String(topAction.severity ?? "info")} kind=${String(topAction.kind ?? "inspect")} id=${String(topAction.id ?? "root")} action=${action ?? "inspect"}`);
|
|
173
|
+
}
|
|
174
|
+
for (const item of remediations.slice(0, 8)) {
|
|
175
|
+
const action = compactPreview(item.action, Limits.DOCTOR_ACTION_PREVIEW_CHARS);
|
|
176
|
+
const blocked = item.blocked_fallback
|
|
177
|
+
? ` blocked=${compactPreview(item.blocked_fallback, Limits.DOCTOR_ACTION_PREVIEW_CHARS)}`
|
|
178
|
+
: "";
|
|
179
|
+
const labels = Array.isArray(item.risk_labels)
|
|
180
|
+
? ` labels=${item.risk_labels.map(String).slice(0, 4).join(",")}`
|
|
181
|
+
: "";
|
|
182
|
+
lines.push(`${String(item.severity ?? "info")} kind=${String(item.kind ?? "inspect")} id=${String(item.id ?? "root")}${blocked}${labels} action=${action ?? "inspect"}`);
|
|
183
|
+
}
|
|
184
|
+
const nextActions = Array.isArray(summary.next_actions)
|
|
185
|
+
? summary.next_actions
|
|
186
|
+
: [];
|
|
187
|
+
if (nextActions.length > 0)
|
|
188
|
+
lines[0] = `${lines[0]}${compactNextActions(nextActions)}`;
|
|
189
|
+
return `\n${lines.join("\n")}`;
|
|
190
|
+
}
|
|
191
|
+
export function recipeRegistryNextActions(summary, view) {
|
|
192
|
+
const actions = [];
|
|
193
|
+
const drafts = Array.isArray(summary.drafts)
|
|
194
|
+
? summary.drafts
|
|
195
|
+
: [];
|
|
196
|
+
const invalid = Array.isArray(summary.invalid) ? summary.invalid.length : 0;
|
|
197
|
+
const diagnostics = Array.isArray(summary.diagnostics)
|
|
198
|
+
? summary.diagnostics.length
|
|
199
|
+
: 0;
|
|
200
|
+
const topAction = asRecord(summary.top_action);
|
|
201
|
+
if (view !== "doctor" && (invalid > 0 || diagnostics > 0)) {
|
|
202
|
+
actions.push("inspect target=recipes view=doctor");
|
|
203
|
+
}
|
|
204
|
+
if (view === "doctor" && typeof topAction.action === "string") {
|
|
205
|
+
actions.push(String(topAction.action));
|
|
206
|
+
}
|
|
207
|
+
if (summary.skill_recipe_catalog_partial === true) {
|
|
208
|
+
actions.push("inspect target=recipes view=imports verbose=true");
|
|
209
|
+
}
|
|
210
|
+
if (drafts.length > 0) {
|
|
211
|
+
actions.push("inspect target=recipes view=summary verbose=true");
|
|
212
|
+
const firstPath = typeof drafts[0]?.path === "string" ? drafts[0].path : undefined;
|
|
213
|
+
if (firstPath)
|
|
214
|
+
actions.push(`spawn file=${firstPath}`);
|
|
215
|
+
}
|
|
216
|
+
return [...new Set(actions)].slice(0, 4);
|
|
217
|
+
}
|
|
218
|
+
export function compactRecipeRegistry(summary) {
|
|
219
|
+
const active = Array.isArray(summary.active) ? summary.active.length : 0;
|
|
220
|
+
const shadowed = Array.isArray(summary.shadowed)
|
|
221
|
+
? summary.shadowed.length
|
|
222
|
+
: 0;
|
|
223
|
+
const invalid = Array.isArray(summary.invalid) ? summary.invalid.length : 0;
|
|
224
|
+
const disabled = Array.isArray(summary.disabled)
|
|
225
|
+
? summary.disabled.length
|
|
226
|
+
: 0;
|
|
227
|
+
const diagnostics = Array.isArray(summary.diagnostics)
|
|
228
|
+
? summary.diagnostics.length
|
|
229
|
+
: 0;
|
|
230
|
+
const drafts = Array.isArray(summary.drafts) ? summary.drafts.length : 0;
|
|
231
|
+
const recommendations = Array.isArray(summary.recommendations)
|
|
232
|
+
? summary.recommendations.length
|
|
233
|
+
: 0;
|
|
234
|
+
const skillCatalogPartial = summary.skill_recipe_catalog_partial === true;
|
|
235
|
+
const currentPolicy = Array.isArray(summary.active)
|
|
236
|
+
? summary.active.filter((entry) => entry.current_policy).length
|
|
237
|
+
: 0;
|
|
238
|
+
const nextActions = Array.isArray(summary.next_actions)
|
|
239
|
+
? summary.next_actions
|
|
240
|
+
: [];
|
|
241
|
+
return `\nrecipes active=${active} drafts=${drafts} shadowed=${shadowed} invalid=${invalid} disabled=${disabled} current_policy=${currentPolicy} skill_catalog_partial=${skillCatalogPartial} recommendations=${recommendations} diagnostics=${diagnostics}${compactNextActions(nextActions)}`;
|
|
242
|
+
}
|
|
243
|
+
export const DEFAULT_INSPECT_LINES = Limits.DEFAULT_INSPECT_LINES;
|