agentplane 0.3.12 → 0.3.14
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/assets/RUNNER.md +1 -1
- package/assets/agents/ORCHESTRATOR.json +1 -1
- package/assets/agents/SKILL_EXTRACTOR.json +31 -0
- package/assets/codex-plugin/assets/header.png +0 -0
- package/assets/codex-plugin/assets/icon.svg +1 -0
- package/assets/codex-plugin/assets/logo.svg +1 -0
- package/assets/codex-plugin/skills/agentplane/SKILL.md +35 -0
- package/assets/framework.manifest.json +7 -0
- package/assets/policy/governance.md +4 -2
- package/assets/policy/incidents.md +4 -19
- package/assets/policy/workflow.branch_pr.md +10 -5
- package/assets/policy/workflow.release.md +5 -2
- package/dist/.build-manifest.json +409 -219
- package/dist/cli/exit-codes.d.ts.map +1 -1
- package/dist/cli/exit-codes.js +1 -0
- package/dist/cli/output.d.ts +29 -0
- package/dist/cli/output.d.ts.map +1 -1
- package/dist/cli/output.js +33 -0
- package/dist/cli/reason-codes.d.ts +1 -1
- package/dist/cli/reason-codes.d.ts.map +1 -1
- package/dist/cli/reason-codes.js +12 -0
- package/dist/cli/run-cli/command-catalog/core.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/core.js +36 -78
- package/dist/cli/run-cli/command-catalog/lifecycle.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/lifecycle.js +4 -12
- package/dist/cli/run-cli/command-catalog/project.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/project.js +27 -31
- package/dist/cli/run-cli/command-catalog/shared.d.ts +9 -6
- package/dist/cli/run-cli/command-catalog/shared.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/shared.js +23 -6
- package/dist/cli/run-cli/command-catalog/task.d.ts.map +1 -1
- package/dist/cli/run-cli/command-catalog/task.js +6 -18
- package/dist/cli/run-cli/command-catalog.d.ts +1 -1
- package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/codex.d.ts +14 -0
- package/dist/cli/run-cli/commands/codex.d.ts.map +1 -0
- package/dist/cli/run-cli/commands/codex.js +100 -0
- package/dist/cli/run-cli/commands/core.d.ts +1 -0
- package/dist/cli/run-cli/commands/core.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/core.js +1 -0
- package/dist/cli/run-cli/commands/init/recipes.d.ts +9 -1
- package/dist/cli/run-cli/commands/init/recipes.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init/recipes.js +33 -22
- package/dist/cli/run-cli/commands/init.d.ts.map +1 -1
- package/dist/cli/run-cli/commands/init.js +26 -21
- package/dist/cli/run-cli/error-guidance.js +20 -0
- package/dist/cli/run-cli.js +1 -1
- package/dist/cli/run-cli.test-helpers.d.ts +1 -74
- package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
- package/dist/cli/run-cli.test-helpers.js +1 -766
- package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
- package/dist/commands/branch/cleanup-merged.js +5 -9
- package/dist/commands/branch/work-start.command.d.ts.map +1 -1
- package/dist/commands/branch/work-start.command.js +1 -0
- package/dist/commands/codex/plugin-install.d.ts +26 -0
- package/dist/commands/codex/plugin-install.d.ts.map +1 -0
- package/dist/commands/codex/plugin-install.js +209 -0
- package/dist/commands/commit.spec.d.ts.map +1 -1
- package/dist/commands/commit.spec.js +2 -0
- package/dist/commands/doctor/branch-pr.d.ts +1 -1
- package/dist/commands/doctor/branch-pr.d.ts.map +1 -1
- package/dist/commands/doctor/branch-pr.js +5 -2
- package/dist/commands/guard/impl/commands.d.ts.map +1 -1
- package/dist/commands/guard/impl/commands.js +4 -1
- package/dist/commands/guard/impl/comment-commit.d.ts.map +1 -1
- package/dist/commands/guard/impl/comment-commit.js +2 -1
- package/dist/commands/guard/impl/env.d.ts +6 -0
- package/dist/commands/guard/impl/env.d.ts.map +1 -1
- package/dist/commands/guard/impl/env.js +41 -0
- package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
- package/dist/commands/pr/integrate/cmd.js +81 -5
- package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
- package/dist/commands/pr/integrate/internal/prepare.js +38 -7
- package/dist/commands/pr/internal/auto-commit.d.ts.map +1 -1
- package/dist/commands/pr/internal/auto-commit.js +13 -7
- package/dist/commands/pr/internal/sync-branch.d.ts +36 -0
- package/dist/commands/pr/internal/sync-branch.d.ts.map +1 -0
- package/dist/commands/pr/internal/sync-branch.js +113 -0
- package/dist/commands/pr/internal/sync-github.d.ts +28 -0
- package/dist/commands/pr/internal/sync-github.d.ts.map +1 -0
- package/dist/commands/pr/internal/sync-github.js +178 -0
- package/dist/commands/pr/internal/sync-model.d.ts +36 -0
- package/dist/commands/pr/internal/sync-model.d.ts.map +1 -0
- package/dist/commands/pr/internal/sync-model.js +1 -0
- package/dist/commands/pr/internal/sync-open-step.d.ts +10 -0
- package/dist/commands/pr/internal/sync-open-step.d.ts.map +1 -0
- package/dist/commands/pr/internal/sync-open-step.js +128 -0
- package/dist/commands/pr/internal/sync-support.d.ts +7 -0
- package/dist/commands/pr/internal/sync-support.d.ts.map +1 -0
- package/dist/commands/pr/internal/sync-support.js +29 -0
- package/dist/commands/pr/internal/sync-update-step.d.ts +6 -0
- package/dist/commands/pr/internal/sync-update-step.d.ts.map +1 -0
- package/dist/commands/pr/internal/sync-update-step.js +68 -0
- package/dist/commands/pr/internal/sync.d.ts +2 -6
- package/dist/commands/pr/internal/sync.d.ts.map +1 -1
- package/dist/commands/pr/internal/sync.js +83 -525
- package/dist/commands/pr/open.d.ts.map +1 -1
- package/dist/commands/pr/open.js +62 -7
- package/dist/commands/pr/pr.command.d.ts.map +1 -1
- package/dist/commands/pr/pr.command.js +7 -2
- package/dist/commands/recipes/active.command.d.ts +7 -0
- package/dist/commands/recipes/active.command.d.ts.map +1 -0
- package/dist/commands/recipes/active.command.js +12 -0
- package/dist/commands/recipes/add.command.d.ts +8 -0
- package/dist/commands/recipes/add.command.d.ts.map +1 -0
- package/dist/commands/recipes/add.command.js +33 -0
- package/dist/commands/recipes/detach.command.d.ts +7 -0
- package/dist/commands/recipes/detach.command.d.ts.map +1 -0
- package/dist/commands/recipes/detach.command.js +19 -0
- package/dist/commands/recipes/disable.command.d.ts +7 -0
- package/dist/commands/recipes/disable.command.d.ts.map +1 -0
- package/dist/commands/recipes/disable.command.js +10 -0
- package/dist/commands/recipes/enable.command.d.ts +7 -0
- package/dist/commands/recipes/enable.command.d.ts.map +1 -0
- package/dist/commands/recipes/enable.command.js +10 -0
- package/dist/commands/recipes/explain-active.command.d.ts +5 -0
- package/dist/commands/recipes/explain-active.command.d.ts.map +1 -0
- package/dist/commands/recipes/explain-active.command.js +11 -0
- package/dist/commands/recipes/explain.command.d.ts.map +1 -1
- package/dist/commands/recipes/explain.command.js +4 -2
- package/dist/commands/recipes/impl/apply.d.ts +1 -1
- package/dist/commands/recipes/impl/apply.d.ts.map +1 -1
- package/dist/commands/recipes/impl/apply.js +34 -16
- package/dist/commands/recipes/impl/commands/active.d.ts +6 -0
- package/dist/commands/recipes/impl/commands/active.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/active.js +47 -0
- package/dist/commands/recipes/impl/commands/add.d.ts +8 -0
- package/dist/commands/recipes/impl/commands/add.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/add.js +105 -0
- package/dist/commands/recipes/impl/commands/detach.d.ts +6 -0
- package/dist/commands/recipes/impl/commands/detach.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/detach.js +99 -0
- package/dist/commands/recipes/impl/commands/disable.d.ts +6 -0
- package/dist/commands/recipes/impl/commands/disable.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/disable.js +23 -0
- package/dist/commands/recipes/impl/commands/enable.d.ts +6 -0
- package/dist/commands/recipes/impl/commands/enable.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/enable.js +41 -0
- package/dist/commands/recipes/impl/commands/explain-active.d.ts +5 -0
- package/dist/commands/recipes/impl/commands/explain-active.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/explain-active.js +20 -0
- package/dist/commands/recipes/impl/commands/explain.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/explain.js +83 -36
- package/dist/commands/recipes/impl/commands/info.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/info.js +39 -22
- package/dist/commands/recipes/impl/commands/install.d.ts +1 -1
- package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/install.js +35 -42
- package/dist/commands/recipes/impl/commands/list-remote.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/list-remote.js +2 -3
- package/dist/commands/recipes/impl/commands/list.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/list.js +13 -12
- package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands/remove.js +12 -2
- package/dist/commands/recipes/impl/commands/update.d.ts +7 -0
- package/dist/commands/recipes/impl/commands/update.d.ts.map +1 -0
- package/dist/commands/recipes/impl/commands/update.js +107 -0
- package/dist/commands/recipes/impl/commands.d.ts +7 -0
- package/dist/commands/recipes/impl/commands.d.ts.map +1 -1
- package/dist/commands/recipes/impl/commands.js +7 -0
- package/dist/commands/recipes/impl/constants.d.ts +1 -14
- package/dist/commands/recipes/impl/constants.d.ts.map +1 -1
- package/dist/commands/recipes/impl/constants.js +1 -18
- package/dist/commands/recipes/impl/index.d.ts +1 -1
- package/dist/commands/recipes/impl/index.d.ts.map +1 -1
- package/dist/commands/recipes/impl/installed-recipes.d.ts +1 -1
- package/dist/commands/recipes/impl/installed-recipes.d.ts.map +1 -1
- package/dist/commands/recipes/impl/installed-recipes.js +1 -2
- package/dist/commands/recipes/impl/mutation-transaction.d.ts +7 -0
- package/dist/commands/recipes/impl/mutation-transaction.d.ts.map +1 -0
- package/dist/commands/recipes/impl/mutation-transaction.js +47 -0
- package/dist/commands/recipes/impl/overlay-project.d.ts +48 -0
- package/dist/commands/recipes/impl/overlay-project.d.ts.map +1 -0
- package/dist/commands/recipes/impl/overlay-project.js +320 -0
- package/dist/commands/recipes/impl/paths.d.ts +17 -2
- package/dist/commands/recipes/impl/paths.d.ts.map +1 -1
- package/dist/commands/recipes/impl/paths.js +20 -5
- package/dist/commands/recipes/impl/project-installed-recipes.d.ts +5 -4
- package/dist/commands/recipes/impl/project-installed-recipes.d.ts.map +1 -1
- package/dist/commands/recipes/impl/project-installed-recipes.js +34 -76
- package/dist/commands/recipes/impl/project-recipe-state.d.ts +18 -0
- package/dist/commands/recipes/impl/project-recipe-state.d.ts.map +1 -0
- package/dist/commands/recipes/impl/project-recipe-state.js +94 -0
- package/dist/commands/recipes/impl/project-registry.d.ts +24 -0
- package/dist/commands/recipes/impl/project-registry.d.ts.map +1 -0
- package/dist/commands/recipes/impl/project-registry.js +124 -0
- package/dist/commands/recipes/impl/resolver.d.ts +1 -1
- package/dist/commands/recipes/impl/resolver.d.ts.map +1 -1
- package/dist/commands/recipes/impl/resolver.js +6 -4
- package/dist/commands/recipes/impl/types.d.ts +1 -240
- package/dist/commands/recipes/impl/types.d.ts.map +1 -1
- package/dist/commands/recipes/impl/version.d.ts +5 -0
- package/dist/commands/recipes/impl/version.d.ts.map +1 -0
- package/dist/commands/recipes/impl/version.js +9 -0
- package/dist/commands/recipes/info.command.js +2 -2
- package/dist/commands/recipes/install.spec.js +4 -4
- package/dist/commands/recipes/list.command.js +4 -4
- package/dist/commands/recipes/remove.command.js +2 -2
- package/dist/commands/recipes/update.command.d.ts +8 -0
- package/dist/commands/recipes/update.command.d.ts.map +1 -0
- package/dist/commands/recipes/update.command.js +35 -0
- package/dist/commands/recipes.d.ts +10 -6
- package/dist/commands/recipes.d.ts.map +1 -1
- package/dist/commands/recipes.js +8 -5
- package/dist/commands/recipes.test-helpers.d.ts +3 -3
- package/dist/commands/recipes.test-helpers.d.ts.map +1 -1
- package/dist/commands/recipes.test-helpers.js +105 -15
- package/dist/commands/release/apply.command.d.ts +1 -1
- package/dist/commands/release/apply.command.d.ts.map +1 -1
- package/dist/commands/release/apply.command.js +15 -379
- package/dist/commands/release/apply.mutation.d.ts +1 -0
- package/dist/commands/release/apply.mutation.d.ts.map +1 -1
- package/dist/commands/release/apply.mutation.js +24 -1
- package/dist/commands/release/apply.pipeline.d.ts +22 -0
- package/dist/commands/release/apply.pipeline.d.ts.map +1 -0
- package/dist/commands/release/apply.pipeline.js +371 -0
- package/dist/commands/release/apply.preflight.d.ts +2 -0
- package/dist/commands/release/apply.preflight.d.ts.map +1 -1
- package/dist/commands/release/apply.preflight.js +13 -4
- package/dist/commands/release/apply.types.d.ts +27 -0
- package/dist/commands/release/apply.types.d.ts.map +1 -1
- package/dist/commands/release.test-helpers.d.ts +4 -0
- package/dist/commands/release.test-helpers.d.ts.map +1 -1
- package/dist/commands/release.test-helpers.js +7 -0
- package/dist/commands/scenario/execute.command.js +4 -4
- package/dist/commands/scenario/impl/commands.js +4 -4
- package/dist/commands/scenario/info.command.js +4 -4
- package/dist/commands/scenario/list.command.js +3 -3
- package/dist/commands/scenario/run.command.js +5 -5
- package/dist/commands/scenario/scenario.command.js +7 -7
- package/dist/commands/shared/reconcile-check.d.ts.map +1 -1
- package/dist/commands/shared/reconcile-check.js +2 -2
- package/dist/commands/shared/task-backend.d.ts +6 -1
- package/dist/commands/shared/task-backend.d.ts.map +1 -1
- package/dist/commands/shared/task-backend.js +34 -2
- package/dist/commands/shared/task-handoff.d.ts +2 -1
- package/dist/commands/shared/task-handoff.d.ts.map +1 -1
- package/dist/commands/shared/task-handoff.js +15 -0
- package/dist/commands/shared/task-mutation.d.ts.map +1 -1
- package/dist/commands/shared/task-mutation.js +4 -4
- package/dist/commands/shared/task-store/intents.d.ts +34 -0
- package/dist/commands/shared/task-store/intents.d.ts.map +1 -0
- package/dist/commands/shared/task-store/intents.js +265 -0
- package/dist/commands/shared/task-store/readme.d.ts +28 -0
- package/dist/commands/shared/task-store/readme.d.ts.map +1 -0
- package/dist/commands/shared/task-store/readme.js +125 -0
- package/dist/commands/shared/task-store/store.d.ts +26 -0
- package/dist/commands/shared/task-store/store.d.ts.map +1 -0
- package/dist/commands/shared/task-store/store.js +105 -0
- package/dist/commands/shared/task-store/types.d.ts +94 -0
- package/dist/commands/shared/task-store/types.d.ts.map +1 -0
- package/dist/commands/shared/task-store/types.js +1 -0
- package/dist/commands/shared/task-store.d.ts +3 -109
- package/dist/commands/shared/task-store.d.ts.map +1 -1
- package/dist/commands/shared/task-store.js +2 -493
- package/dist/commands/task/block.d.ts.map +1 -1
- package/dist/commands/task/block.js +7 -2
- package/dist/commands/task/comment.d.ts.map +1 -1
- package/dist/commands/task/comment.js +7 -2
- package/dist/commands/task/finish-shared.d.ts.map +1 -1
- package/dist/commands/task/finish-shared.js +3 -3
- package/dist/commands/task/finish.d.ts.map +1 -1
- package/dist/commands/task/finish.js +102 -15
- package/dist/commands/task/handoff-show.command.d.ts.map +1 -1
- package/dist/commands/task/handoff-show.command.js +24 -0
- package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -1
- package/dist/commands/task/hosted-merge-sync.js +9 -4
- package/dist/commands/task/list.run.d.ts.map +1 -1
- package/dist/commands/task/list.run.js +14 -4
- package/dist/commands/task/new.command.d.ts.map +1 -1
- package/dist/commands/task/new.command.js +16 -2
- package/dist/commands/task/new.js +2 -2
- package/dist/commands/task/show.d.ts.map +1 -1
- package/dist/commands/task/show.js +3 -3
- package/dist/commands/task/update.d.ts.map +1 -1
- package/dist/commands/task/update.js +11 -3
- package/dist/runner/adapters/codex.d.ts.map +1 -1
- package/dist/runner/adapters/codex.js +3 -33
- package/dist/runner/adapters/custom.d.ts.map +1 -1
- package/dist/runner/adapters/custom.js +3 -30
- package/dist/runner/adapters/runtime-shared.d.ts +14 -0
- package/dist/runner/adapters/runtime-shared.d.ts.map +1 -0
- package/dist/runner/adapters/runtime-shared.js +36 -0
- package/dist/runner/context/base-prompt-sources.d.ts +30 -0
- package/dist/runner/context/base-prompt-sources.d.ts.map +1 -0
- package/dist/runner/context/base-prompt-sources.js +144 -0
- package/dist/runner/context/base-prompts.d.ts +5 -23
- package/dist/runner/context/base-prompts.d.ts.map +1 -1
- package/dist/runner/context/base-prompts.js +10 -358
- package/dist/runner/context/overlay-prompt-blocks.d.ts +7 -0
- package/dist/runner/context/overlay-prompt-blocks.d.ts.map +1 -0
- package/dist/runner/context/overlay-prompt-blocks.js +72 -0
- package/dist/runner/context/prompt-block-shared.d.ts +54 -0
- package/dist/runner/context/prompt-block-shared.d.ts.map +1 -0
- package/dist/runner/context/prompt-block-shared.js +106 -0
- package/dist/runner/context/recipe-context.d.ts +2 -1
- package/dist/runner/context/recipe-context.d.ts.map +1 -1
- package/dist/runner/context/recipe-context.js +41 -8
- package/dist/runner/context/recipe-prompt-blocks.d.ts +6 -0
- package/dist/runner/context/recipe-prompt-blocks.d.ts.map +1 -0
- package/dist/runner/context/recipe-prompt-blocks.js +143 -0
- package/dist/runner/types.d.ts +4 -0
- package/dist/runner/types.d.ts.map +1 -1
- package/dist/runner/usecases/scenario-materialize-task.js +2 -2
- package/dist/runner/usecases/task-run-inspect.js +2 -2
- package/dist/runner/usecases/task-run-lifecycle-shared.js +2 -2
- package/dist/runner/usecases/task-run.d.ts.map +1 -1
- package/dist/runner/usecases/task-run.js +6 -3
- package/dist/runtime/behavior/resolve.d.ts +2 -1
- package/dist/runtime/behavior/resolve.d.ts.map +1 -1
- package/dist/runtime/behavior/resolve.js +25 -5
- package/dist/runtime/behavior/types.d.ts +1 -0
- package/dist/runtime/behavior/types.d.ts.map +1 -1
- package/dist/runtime/capabilities/recipe.d.ts +2 -1
- package/dist/runtime/capabilities/recipe.d.ts.map +1 -1
- package/dist/runtime/capabilities/recipe.js +88 -28
- package/dist/runtime/execution-context.d.ts +63 -0
- package/dist/runtime/execution-context.d.ts.map +1 -0
- package/dist/{usecases/context/resolve-context.js → runtime/execution-context.js} +23 -26
- package/dist/runtime/incidents/advice-strategy.d.ts +15 -0
- package/dist/runtime/incidents/advice-strategy.d.ts.map +1 -0
- package/dist/runtime/incidents/advice-strategy.js +54 -0
- package/dist/runtime/incidents/plan-strategy.d.ts +9 -0
- package/dist/runtime/incidents/plan-strategy.d.ts.map +1 -0
- package/dist/runtime/incidents/plan-strategy.js +205 -0
- package/dist/runtime/incidents/registry-strategy.d.ts +6 -0
- package/dist/runtime/incidents/registry-strategy.d.ts.map +1 -0
- package/dist/runtime/incidents/registry-strategy.js +280 -0
- package/dist/runtime/incidents/resolve.d.ts +3 -25
- package/dist/runtime/incidents/resolve.d.ts.map +1 -1
- package/dist/runtime/incidents/resolve.js +3 -683
- package/dist/runtime/incidents/shared.d.ts +34 -0
- package/dist/runtime/incidents/shared.d.ts.map +1 -0
- package/dist/runtime/incidents/shared.js +171 -0
- package/dist/shared/errors.d.ts +1 -1
- package/dist/shared/errors.d.ts.map +1 -1
- package/dist/shared/runtime-source.d.ts.map +1 -1
- package/dist/shared/runtime-source.js +8 -3
- package/dist/testing/cli-harness/recipe-archives.d.ts +28 -0
- package/dist/testing/cli-harness/recipe-archives.d.ts.map +1 -0
- package/dist/testing/cli-harness/recipe-archives.js +374 -0
- package/dist/testing/cli-harness/stdio.d.ts +26 -0
- package/dist/testing/cli-harness/stdio.d.ts.map +1 -0
- package/dist/testing/cli-harness/stdio.js +84 -0
- package/dist/testing/cli-harness.d.ts +25 -0
- package/dist/testing/cli-harness.d.ts.map +1 -0
- package/dist/testing/cli-harness.js +313 -0
- package/dist/testing/index.d.ts +2 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +1 -0
- package/package.json +7 -3
- package/dist/cli/recipes-bundled.d.ts +0 -10
- package/dist/cli/recipes-bundled.d.ts.map +0 -1
- package/dist/cli/recipes-bundled.js +0 -36
- package/dist/commands/recipes/impl/manifest.d.ts +0 -4
- package/dist/commands/recipes/impl/manifest.d.ts.map +0 -1
- package/dist/commands/recipes/impl/manifest.js +0 -229
- package/dist/commands/recipes/impl/normalize.d.ts +0 -8
- package/dist/commands/recipes/impl/normalize.d.ts.map +0 -1
- package/dist/commands/recipes/impl/normalize.js +0 -54
- package/dist/commands/recipes/impl/scenario.d.ts +0 -16
- package/dist/commands/recipes/impl/scenario.d.ts.map +0 -1
- package/dist/commands/recipes/impl/scenario.js +0 -262
- package/dist/recipes/bundled-recipes.d.ts +0 -17
- package/dist/recipes/bundled-recipes.d.ts.map +0 -1
- package/dist/recipes/bundled-recipes.js +0 -15
- package/dist/usecases/context/resolve-context.d.ts +0 -68
- package/dist/usecases/context/resolve-context.d.ts.map +0 -1
- package/dist/usecases/task/task-list-usecase.d.ts +0 -9
- package/dist/usecases/task/task-list-usecase.d.ts.map +0 -1
- package/dist/usecases/task/task-list-usecase.js +0 -17
- package/dist/usecases/task/task-new-usecase.d.ts +0 -9
- package/dist/usecases/task/task-new-usecase.d.ts.map +0 -1
- package/dist/usecases/task/task-new-usecase.js +0 -17
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { mkdir, readFile } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { normalizeRecipeTags, validateRecipeManifest, } from "@agentplaneorg/recipes";
|
|
3
4
|
import { invalidFieldMessage } from "../../../cli/output.js";
|
|
4
5
|
import { isRecord } from "../../../shared/guards.js";
|
|
5
6
|
import { writeJsonStableIfChanged } from "../../../shared/write-if-changed.js";
|
|
6
|
-
import { validateRecipeManifest } from "./manifest.js";
|
|
7
|
-
import { normalizeRecipeTags } from "./normalize.js";
|
|
8
7
|
function validateInstalledRecipesFile(raw) {
|
|
9
8
|
if (!isRecord(raw))
|
|
10
9
|
throw new Error(invalidFieldMessage("recipes.json", "object"));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function runVendoredRecipeMutation<T>(opts: {
|
|
2
|
+
targetDir: string;
|
|
3
|
+
mode: "create" | "replace" | "remove";
|
|
4
|
+
materialize?: (targetDir: string) => Promise<void>;
|
|
5
|
+
commit: () => Promise<T>;
|
|
6
|
+
}): Promise<T>;
|
|
7
|
+
//# sourceMappingURL=mutation-transaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mutation-transaction.d.ts","sourceRoot":"","sources":["../../../../src/commands/recipes/impl/mutation-transaction.ts"],"names":[],"mappings":"AAmBA,wBAAsB,yBAAyB,CAAC,CAAC,EAAE,IAAI,EAAE;IACvD,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;IACtC,WAAW,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACnD,MAAM,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;CAC1B,GAAG,OAAO,CAAC,CAAC,CAAC,CA8Bb"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { lstat, rename, rm } from "node:fs/promises";
|
|
2
|
+
let recipeMutationNonce = 0;
|
|
3
|
+
async function pathExists(filePath) {
|
|
4
|
+
try {
|
|
5
|
+
await lstat(filePath);
|
|
6
|
+
return true;
|
|
7
|
+
}
|
|
8
|
+
catch (err) {
|
|
9
|
+
const code = err?.code;
|
|
10
|
+
if (code === "ENOENT")
|
|
11
|
+
return false;
|
|
12
|
+
throw err;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
function backupPath(targetDir) {
|
|
16
|
+
return `${targetDir}.agentplane-backup-${process.pid}-${Date.now()}-${recipeMutationNonce++}`;
|
|
17
|
+
}
|
|
18
|
+
export async function runVendoredRecipeMutation(opts) {
|
|
19
|
+
const existed = await pathExists(opts.targetDir);
|
|
20
|
+
const backupDir = existed && (opts.mode === "replace" || opts.mode === "remove")
|
|
21
|
+
? backupPath(opts.targetDir)
|
|
22
|
+
: null;
|
|
23
|
+
if (backupDir) {
|
|
24
|
+
await rename(opts.targetDir, backupDir);
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
if (opts.mode !== "remove") {
|
|
28
|
+
if (!opts.materialize)
|
|
29
|
+
throw new Error("materialize callback is required for create/replace");
|
|
30
|
+
await opts.materialize(opts.targetDir);
|
|
31
|
+
}
|
|
32
|
+
const result = await opts.commit();
|
|
33
|
+
if (backupDir) {
|
|
34
|
+
await rm(backupDir, { recursive: true, force: true });
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
if (opts.mode !== "remove") {
|
|
40
|
+
await rm(opts.targetDir, { recursive: true, force: true }).catch((_error) => null);
|
|
41
|
+
}
|
|
42
|
+
if (backupDir) {
|
|
43
|
+
await rename(backupDir, opts.targetDir).catch((_error) => null);
|
|
44
|
+
}
|
|
45
|
+
throw err;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type CompiledRecipeAssetRegistry, type CompiledOverlayBundle } from "@agentplaneorg/recipes";
|
|
2
|
+
import type { ProjectRecipesRegistryFile } from "./types.js";
|
|
3
|
+
export declare function readActiveRecipeIds(project: {
|
|
4
|
+
agentplaneDir: string;
|
|
5
|
+
}): Promise<string[]>;
|
|
6
|
+
export declare function readActiveRecipeIdsFromRegistry(registry: ProjectRecipesRegistryFile): string[];
|
|
7
|
+
export declare function setRecipeActive(opts: {
|
|
8
|
+
project: {
|
|
9
|
+
agentplaneDir: string;
|
|
10
|
+
};
|
|
11
|
+
recipeId: string;
|
|
12
|
+
active: boolean;
|
|
13
|
+
}): Promise<string[]>;
|
|
14
|
+
export declare function compileProjectOverlayArtifactsFromRegistry(project: {
|
|
15
|
+
agentplaneDir: string;
|
|
16
|
+
}, registry: ProjectRecipesRegistryFile): Promise<{
|
|
17
|
+
bundle: CompiledOverlayBundle;
|
|
18
|
+
assets: CompiledRecipeAssetRegistry;
|
|
19
|
+
}>;
|
|
20
|
+
export declare function compileProjectOverlayArtifacts(project: {
|
|
21
|
+
agentplaneDir: string;
|
|
22
|
+
}): Promise<{
|
|
23
|
+
bundle: CompiledOverlayBundle;
|
|
24
|
+
assets: CompiledRecipeAssetRegistry;
|
|
25
|
+
}>;
|
|
26
|
+
export declare function publishProjectRecipesState(opts: {
|
|
27
|
+
project: {
|
|
28
|
+
agentplaneDir: string;
|
|
29
|
+
};
|
|
30
|
+
registry: ProjectRecipesRegistryFile;
|
|
31
|
+
}): Promise<{
|
|
32
|
+
registry: ProjectRecipesRegistryFile;
|
|
33
|
+
bundle: CompiledOverlayBundle;
|
|
34
|
+
assets: CompiledRecipeAssetRegistry;
|
|
35
|
+
}>;
|
|
36
|
+
export declare function refreshProjectOverlayArtifacts(project: {
|
|
37
|
+
agentplaneDir: string;
|
|
38
|
+
}): Promise<{
|
|
39
|
+
bundle: CompiledOverlayBundle;
|
|
40
|
+
assets: CompiledRecipeAssetRegistry;
|
|
41
|
+
}>;
|
|
42
|
+
export declare function readProjectOverlayBundle(project: {
|
|
43
|
+
agentplaneDir: string;
|
|
44
|
+
}): Promise<CompiledOverlayBundle | null>;
|
|
45
|
+
export declare function readProjectRecipeAssetRegistry(project: {
|
|
46
|
+
agentplaneDir: string;
|
|
47
|
+
}): Promise<CompiledRecipeAssetRegistry | null>;
|
|
48
|
+
//# sourceMappingURL=overlay-project.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overlay-project.d.ts","sourceRoot":"","sources":["../../../../src/commands/recipes/impl/overlay-project.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,2BAA2B,EAChC,KAAK,qBAAqB,EAG3B,MAAM,wBAAwB,CAAC;AAoBhC,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,YAAY,CAAC;AAmL7D,wBAAsB,mBAAmB,CAAC,OAAO,EAAE;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAG/F;AAED,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE,0BAA0B,GAAG,MAAM,EAAE,CAK9F;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,OAAO,EAAE;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAKpB;AAED,wBAAsB,0CAA0C,CAC9D,OAAO,EAAE;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,EAClC,QAAQ,EAAE,0BAA0B,GACnC,OAAO,CAAC;IACT,MAAM,EAAE,qBAAqB,CAAC;IAC9B,MAAM,EAAE,2BAA2B,CAAC;CACrC,CAAC,CAqGD;AAED,wBAAsB,8BAA8B,CAAC,OAAO,EAAE;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC;IAChG,MAAM,EAAE,qBAAqB,CAAC;IAC9B,MAAM,EAAE,2BAA2B,CAAC;CACrC,CAAC,CAGD;AAED,wBAAsB,0BAA0B,CAAC,IAAI,EAAE;IACrD,OAAO,EAAE;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,QAAQ,EAAE,0BAA0B,CAAC;CACtC,GAAG,OAAO,CAAC;IACV,QAAQ,EAAE,0BAA0B,CAAC;IACrC,MAAM,EAAE,qBAAqB,CAAC;IAC9B,MAAM,EAAE,2BAA2B,CAAC;CACrC,CAAC,CASD;AAED,wBAAsB,8BAA8B,CAAC,OAAO,EAAE;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC;IAChG,MAAM,EAAE,qBAAqB,CAAC;IAC9B,MAAM,EAAE,2BAA2B,CAAC;CACrC,CAAC,CAQD;AAED,wBAAsB,wBAAwB,CAAC,OAAO,EAAE;IACtD,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,qBAAqB,GAAG,IAAI,CAAC,CAUxC;AAED,wBAAsB,8BAA8B,CAAC,OAAO,EAAE;IAC5D,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,2BAA2B,GAAG,IAAI,CAAC,CAU9C"}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { lstat, mkdir, readFile, rename, rm } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { createEmptyOverlayBundle, hashOverlayInputs, validateCompiledOverlayBundle, validateCompiledRecipeAssetRegistry, } from "@agentplaneorg/recipes";
|
|
4
|
+
import { atomicWriteFile, canonicalizeJson } from "@agentplaneorg/core";
|
|
5
|
+
import { writeJsonStableIfChanged } from "../../../shared/write-if-changed.js";
|
|
6
|
+
import { readProjectInstalledRecipesFromRegistry } from "./project-installed-recipes.js";
|
|
7
|
+
import { readProjectRecipesRegistry, setProjectRecipeActiveInFile, stampProjectRecipesRegistry, writeProjectRecipesRegistry, } from "./project-registry.js";
|
|
8
|
+
import { resolveProjectInstalledRecipeDir, resolveProjectOverlayBundlePath, resolveProjectRecipeAssetsPath, resolveProjectRecipesDir, resolveProjectRecipesRegistryPath, } from "./paths.js";
|
|
9
|
+
let projectRecipePublishNonce = 0;
|
|
10
|
+
function ensureTrailingNewline(text) {
|
|
11
|
+
return text.endsWith("\n") ? text : `${text}\n`;
|
|
12
|
+
}
|
|
13
|
+
function stripMarkdownFrontmatter(text) {
|
|
14
|
+
if (!text.startsWith("---\n"))
|
|
15
|
+
return text;
|
|
16
|
+
const end = text.indexOf("\n---\n", 4);
|
|
17
|
+
if (end === -1)
|
|
18
|
+
return text;
|
|
19
|
+
return text.slice(end + 5);
|
|
20
|
+
}
|
|
21
|
+
function normalizePromptContent(text) {
|
|
22
|
+
return ensureTrailingNewline(stripMarkdownFrontmatter(text).trim());
|
|
23
|
+
}
|
|
24
|
+
function normalizeRecipeAssetContent(text) {
|
|
25
|
+
return ensureTrailingNewline(text.trimEnd());
|
|
26
|
+
}
|
|
27
|
+
function uniqueById(items) {
|
|
28
|
+
const seen = new Set();
|
|
29
|
+
const result = [];
|
|
30
|
+
for (const item of items) {
|
|
31
|
+
if (seen.has(item.id))
|
|
32
|
+
continue;
|
|
33
|
+
seen.add(item.id);
|
|
34
|
+
result.push(item);
|
|
35
|
+
}
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
38
|
+
function jsonText(value) {
|
|
39
|
+
return `${JSON.stringify(canonicalizeJson(value), null, 2)}\n`;
|
|
40
|
+
}
|
|
41
|
+
async function pathExists(filePath) {
|
|
42
|
+
try {
|
|
43
|
+
await lstat(filePath);
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
const code = err?.code;
|
|
48
|
+
if (code === "ENOENT")
|
|
49
|
+
return false;
|
|
50
|
+
throw err;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
async function publishJsonFilesTransactional(files) {
|
|
54
|
+
const backups = [];
|
|
55
|
+
try {
|
|
56
|
+
for (const file of files) {
|
|
57
|
+
if (!(await pathExists(file.path)))
|
|
58
|
+
continue;
|
|
59
|
+
const backup = `${file.path}.bak-${process.pid}-${Date.now()}-${projectRecipePublishNonce++}`;
|
|
60
|
+
await rename(file.path, backup);
|
|
61
|
+
backups.push({ path: file.path, backup });
|
|
62
|
+
}
|
|
63
|
+
for (const file of files) {
|
|
64
|
+
await mkdir(path.dirname(file.path), { recursive: true });
|
|
65
|
+
await atomicWriteFile(file.path, jsonText(file.value), "utf8");
|
|
66
|
+
}
|
|
67
|
+
for (const entry of backups) {
|
|
68
|
+
await rm(entry.backup, { recursive: true, force: true });
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
for (const file of files) {
|
|
73
|
+
await rm(file.path, { recursive: true, force: true }).catch((_error) => null);
|
|
74
|
+
}
|
|
75
|
+
for (const entry of backups.toReversed()) {
|
|
76
|
+
await rename(entry.backup, entry.path).catch((_error) => null);
|
|
77
|
+
}
|
|
78
|
+
throw err;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function recipeAssetId(recipeId, kind, assetId) {
|
|
82
|
+
return `recipe:${recipeId}/${kind}:${assetId}`;
|
|
83
|
+
}
|
|
84
|
+
function relativeSource(project, absolutePath) {
|
|
85
|
+
return path.relative(project.agentplaneDir, absolutePath).replaceAll("\\", "/");
|
|
86
|
+
}
|
|
87
|
+
async function compileProjectRecipeAssets(opts) {
|
|
88
|
+
const entries = [];
|
|
89
|
+
for (const recipe of opts.installed.recipes) {
|
|
90
|
+
const recipeDir = recipe.project_path
|
|
91
|
+
? path.join(resolveProjectRecipesDir(opts.project), recipe.project_path)
|
|
92
|
+
: resolveProjectInstalledRecipeDir(opts.project, recipe.id);
|
|
93
|
+
const manifest = recipe.manifest;
|
|
94
|
+
for (const agent of manifest.agents ?? []) {
|
|
95
|
+
const sourcePath = path.join(recipeDir, agent.file);
|
|
96
|
+
entries.push({
|
|
97
|
+
id: recipeAssetId(recipe.id, "agent", agent.id),
|
|
98
|
+
kind: "agent",
|
|
99
|
+
recipe_id: recipe.id,
|
|
100
|
+
recipe_version: recipe.version,
|
|
101
|
+
recipe_name: manifest.name,
|
|
102
|
+
asset_id: agent.id,
|
|
103
|
+
source: relativeSource(opts.project, sourcePath),
|
|
104
|
+
summary: agent.summary,
|
|
105
|
+
definition: agent,
|
|
106
|
+
content: normalizeRecipeAssetContent(await readFile(sourcePath, "utf8")),
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
for (const skill of manifest.skills ?? []) {
|
|
110
|
+
const sourcePath = path.join(recipeDir, skill.file);
|
|
111
|
+
entries.push({
|
|
112
|
+
id: recipeAssetId(recipe.id, "skill", skill.id),
|
|
113
|
+
kind: "skill",
|
|
114
|
+
recipe_id: recipe.id,
|
|
115
|
+
recipe_version: recipe.version,
|
|
116
|
+
recipe_name: manifest.name,
|
|
117
|
+
asset_id: skill.id,
|
|
118
|
+
source: relativeSource(opts.project, sourcePath),
|
|
119
|
+
summary: skill.summary,
|
|
120
|
+
definition: skill,
|
|
121
|
+
content: normalizeRecipeAssetContent(await readFile(sourcePath, "utf8")),
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
for (const tool of manifest.tools ?? []) {
|
|
125
|
+
entries.push({
|
|
126
|
+
id: recipeAssetId(recipe.id, "tool", tool.id),
|
|
127
|
+
kind: "tool",
|
|
128
|
+
recipe_id: recipe.id,
|
|
129
|
+
recipe_version: recipe.version,
|
|
130
|
+
recipe_name: manifest.name,
|
|
131
|
+
asset_id: tool.id,
|
|
132
|
+
source: relativeSource(opts.project, path.join(recipeDir, tool.entrypoint)),
|
|
133
|
+
summary: tool.summary,
|
|
134
|
+
definition: tool,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
for (const scenario of manifest.scenarios ?? []) {
|
|
138
|
+
entries.push({
|
|
139
|
+
id: recipeAssetId(recipe.id, "scenario", scenario.id),
|
|
140
|
+
kind: "scenario",
|
|
141
|
+
recipe_id: recipe.id,
|
|
142
|
+
recipe_version: recipe.version,
|
|
143
|
+
recipe_name: manifest.name,
|
|
144
|
+
asset_id: scenario.id,
|
|
145
|
+
source: relativeSource(opts.project, path.join(recipeDir, scenario.file)),
|
|
146
|
+
summary: scenario.summary,
|
|
147
|
+
definition: scenario,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
for (const [templateKey, content] of Object.entries(manifest.templates ?? {})) {
|
|
151
|
+
entries.push({
|
|
152
|
+
id: recipeAssetId(recipe.id, "template", templateKey),
|
|
153
|
+
kind: "template",
|
|
154
|
+
recipe_id: recipe.id,
|
|
155
|
+
recipe_version: recipe.version,
|
|
156
|
+
recipe_name: manifest.name,
|
|
157
|
+
asset_id: templateKey,
|
|
158
|
+
source: relativeSource(opts.project, path.join(recipeDir, "manifest.json")),
|
|
159
|
+
content,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
return {
|
|
164
|
+
schema_version: 1,
|
|
165
|
+
kind: "recipe_asset_registry",
|
|
166
|
+
entries: uniqueById(entries).toSorted((left, right) => left.id.localeCompare(right.id)),
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
export async function readActiveRecipeIds(project) {
|
|
170
|
+
const registry = await readProjectRecipesRegistry(project);
|
|
171
|
+
return readActiveRecipeIdsFromRegistry(registry);
|
|
172
|
+
}
|
|
173
|
+
export function readActiveRecipeIdsFromRegistry(registry) {
|
|
174
|
+
return registry.recipes
|
|
175
|
+
.filter((entry) => entry.active)
|
|
176
|
+
.map((entry) => entry.id)
|
|
177
|
+
.toSorted();
|
|
178
|
+
}
|
|
179
|
+
export async function setRecipeActive(opts) {
|
|
180
|
+
const registry = await readProjectRecipesRegistry(opts.project);
|
|
181
|
+
const next = setProjectRecipeActiveInFile(registry, opts.recipeId, opts.active);
|
|
182
|
+
await writeProjectRecipesRegistry(opts.project, next);
|
|
183
|
+
return readActiveRecipeIdsFromRegistry(next);
|
|
184
|
+
}
|
|
185
|
+
export async function compileProjectOverlayArtifactsFromRegistry(project, registry) {
|
|
186
|
+
const activeIds = readActiveRecipeIdsFromRegistry(registry);
|
|
187
|
+
const installed = await readProjectInstalledRecipesFromRegistry(project, registry);
|
|
188
|
+
const bundle = createEmptyOverlayBundle();
|
|
189
|
+
for (const recipeId of activeIds) {
|
|
190
|
+
const entry = installed.recipes.find((candidate) => candidate.id === recipeId);
|
|
191
|
+
if (!entry) {
|
|
192
|
+
throw new Error(`Active overlay is not installed: ${recipeId}`);
|
|
193
|
+
}
|
|
194
|
+
if (entry.manifest.kind !== "project_overlay") {
|
|
195
|
+
throw new Error(`Active recipe ${recipeId} is not a project overlay`);
|
|
196
|
+
}
|
|
197
|
+
const manifest = entry.manifest;
|
|
198
|
+
const recipeDir = entry.project_path
|
|
199
|
+
? path.join(resolveProjectRecipesDir(project), entry.project_path)
|
|
200
|
+
: resolveProjectInstalledRecipeDir(project, entry.id);
|
|
201
|
+
const promptInputs = [];
|
|
202
|
+
if (manifest.requires) {
|
|
203
|
+
for (const required of manifest.requires) {
|
|
204
|
+
if (!activeIds.includes(required)) {
|
|
205
|
+
throw new Error(`Overlay ${manifest.id} requires active overlay ${required}`);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
if (manifest.conflicts) {
|
|
210
|
+
for (const conflict of manifest.conflicts) {
|
|
211
|
+
if (activeIds.includes(conflict.recipe_id)) {
|
|
212
|
+
throw new Error(`Overlay ${manifest.id} conflicts with ${conflict.recipe_id}: ${conflict.reason}`);
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
for (const fragment of manifest.prompts ?? []) {
|
|
217
|
+
const absPath = path.join(recipeDir, fragment.file);
|
|
218
|
+
const content = normalizePromptContent(await readFile(absPath, "utf8"));
|
|
219
|
+
promptInputs.push({ id: fragment.id, content });
|
|
220
|
+
bundle.surfaces[fragment.surface].push({
|
|
221
|
+
...fragment,
|
|
222
|
+
recipe_id: manifest.id,
|
|
223
|
+
recipe_version: manifest.version,
|
|
224
|
+
recipe_name: manifest.name,
|
|
225
|
+
summary: manifest.summary,
|
|
226
|
+
source: path.relative(project.agentplaneDir, absPath).replaceAll("\\", "/"),
|
|
227
|
+
content,
|
|
228
|
+
});
|
|
229
|
+
bundle.trace.push({
|
|
230
|
+
recipe_id: manifest.id,
|
|
231
|
+
recipe_version: manifest.version,
|
|
232
|
+
accepted: true,
|
|
233
|
+
reason: "compiled prompt fragment",
|
|
234
|
+
source: fragment.file,
|
|
235
|
+
surface: fragment.surface,
|
|
236
|
+
fragment_id: fragment.id,
|
|
237
|
+
});
|
|
238
|
+
}
|
|
239
|
+
for (const validator of manifest.validators ?? []) {
|
|
240
|
+
bundle.validators.push({
|
|
241
|
+
...validator,
|
|
242
|
+
recipe_id: manifest.id,
|
|
243
|
+
recipe_version: manifest.version,
|
|
244
|
+
});
|
|
245
|
+
bundle.trace.push({
|
|
246
|
+
recipe_id: manifest.id,
|
|
247
|
+
recipe_version: manifest.version,
|
|
248
|
+
accepted: true,
|
|
249
|
+
reason: "compiled validator",
|
|
250
|
+
validator_id: validator.id,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
bundle.active.push({
|
|
254
|
+
id: manifest.id,
|
|
255
|
+
version: manifest.version,
|
|
256
|
+
name: manifest.name,
|
|
257
|
+
summary: manifest.summary,
|
|
258
|
+
});
|
|
259
|
+
bundle.agents.push(...(manifest.agents ?? []));
|
|
260
|
+
bundle.tools.push(...(manifest.tools ?? []));
|
|
261
|
+
Object.assign(bundle.templates, manifest.templates ?? {});
|
|
262
|
+
void hashOverlayInputs({ manifest, prompts: promptInputs });
|
|
263
|
+
}
|
|
264
|
+
bundle.agents = uniqueById(bundle.agents);
|
|
265
|
+
bundle.tools = uniqueById(bundle.tools);
|
|
266
|
+
for (const surface of Object.keys(bundle.surfaces)) {
|
|
267
|
+
bundle.surfaces[surface] = bundle.surfaces[surface].toSorted((left, right) => (left.order ?? 0) - (right.order ?? 0) ||
|
|
268
|
+
left.recipe_id.localeCompare(right.recipe_id) ||
|
|
269
|
+
left.id.localeCompare(right.id));
|
|
270
|
+
}
|
|
271
|
+
return {
|
|
272
|
+
bundle,
|
|
273
|
+
assets: await compileProjectRecipeAssets({ project, installed }),
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
export async function compileProjectOverlayArtifacts(project) {
|
|
277
|
+
const registry = await readProjectRecipesRegistry(project);
|
|
278
|
+
return await compileProjectOverlayArtifactsFromRegistry(project, registry);
|
|
279
|
+
}
|
|
280
|
+
export async function publishProjectRecipesState(opts) {
|
|
281
|
+
const registry = stampProjectRecipesRegistry(opts.registry);
|
|
282
|
+
const compiled = await compileProjectOverlayArtifactsFromRegistry(opts.project, registry);
|
|
283
|
+
await publishJsonFilesTransactional([
|
|
284
|
+
{ path: resolveProjectOverlayBundlePath(opts.project), value: compiled.bundle },
|
|
285
|
+
{ path: resolveProjectRecipeAssetsPath(opts.project), value: compiled.assets },
|
|
286
|
+
{ path: resolveProjectRecipesRegistryPath(opts.project), value: registry },
|
|
287
|
+
]);
|
|
288
|
+
return { registry, ...compiled };
|
|
289
|
+
}
|
|
290
|
+
export async function refreshProjectOverlayArtifacts(project) {
|
|
291
|
+
const compiled = await compileProjectOverlayArtifacts(project);
|
|
292
|
+
const bundlePath = resolveProjectOverlayBundlePath(project);
|
|
293
|
+
const assetsPath = resolveProjectRecipeAssetsPath(project);
|
|
294
|
+
await mkdir(path.dirname(bundlePath), { recursive: true });
|
|
295
|
+
await writeJsonStableIfChanged(bundlePath, compiled.bundle);
|
|
296
|
+
await writeJsonStableIfChanged(assetsPath, compiled.assets);
|
|
297
|
+
return compiled;
|
|
298
|
+
}
|
|
299
|
+
export async function readProjectOverlayBundle(project) {
|
|
300
|
+
try {
|
|
301
|
+
return validateCompiledOverlayBundle(JSON.parse(await readFile(resolveProjectOverlayBundlePath(project), "utf8")));
|
|
302
|
+
}
|
|
303
|
+
catch (err) {
|
|
304
|
+
const code = err?.code;
|
|
305
|
+
if (code === "ENOENT")
|
|
306
|
+
return null;
|
|
307
|
+
throw err;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
export async function readProjectRecipeAssetRegistry(project) {
|
|
311
|
+
try {
|
|
312
|
+
return validateCompiledRecipeAssetRegistry(JSON.parse(await readFile(resolveProjectRecipeAssetsPath(project), "utf8")));
|
|
313
|
+
}
|
|
314
|
+
catch (err) {
|
|
315
|
+
const code = err?.code;
|
|
316
|
+
if (code === "ENOENT")
|
|
317
|
+
return null;
|
|
318
|
+
throw err;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
@@ -10,13 +10,28 @@ export declare function resolveInstalledRecipeDir(entry: {
|
|
|
10
10
|
export declare function resolveProjectRecipesDir(resolved: {
|
|
11
11
|
agentplaneDir: string;
|
|
12
12
|
}): string;
|
|
13
|
-
export declare function
|
|
13
|
+
export declare function resolveProjectRecipesPackagesDir(resolved: {
|
|
14
|
+
agentplaneDir: string;
|
|
15
|
+
}): string;
|
|
16
|
+
export declare function resolveProjectRecipesRegistryPath(resolved: {
|
|
17
|
+
agentplaneDir: string;
|
|
18
|
+
}): string;
|
|
19
|
+
export declare function resolveProjectVendoredRecipeDir(resolved: {
|
|
14
20
|
agentplaneDir: string;
|
|
15
21
|
}, recipeId: string): string;
|
|
16
|
-
export declare function
|
|
22
|
+
export declare function resolveProjectInstalledRecipeDir(resolved: {
|
|
17
23
|
agentplaneDir: string;
|
|
18
24
|
}, recipeId: string): string;
|
|
19
25
|
export declare function resolveProjectRecipesCacheDir(resolved: {
|
|
20
26
|
agentplaneDir: string;
|
|
21
27
|
}): string;
|
|
28
|
+
export declare function resolveProjectGeneratedDir(resolved: {
|
|
29
|
+
agentplaneDir: string;
|
|
30
|
+
}): string;
|
|
31
|
+
export declare function resolveProjectOverlayBundlePath(resolved: {
|
|
32
|
+
agentplaneDir: string;
|
|
33
|
+
}): string;
|
|
34
|
+
export declare function resolveProjectRecipeAssetsPath(resolved: {
|
|
35
|
+
agentplaneDir: string;
|
|
36
|
+
}): string;
|
|
22
37
|
//# sourceMappingURL=paths.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../../../src/commands/recipes/impl/paths.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../../../src/commands/recipes/impl/paths.ts"],"names":[],"mappings":"AAeA,wBAAgB,qBAAqB,IAAI,MAAM,CAI9C;AAED,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD;AAED,wBAAgB,2BAA2B,IAAI,MAAM,CAEpD;AAED,wBAAgB,4BAA4B,IAAI,MAAM,CAErD;AAED,wBAAgB,+BAA+B,IAAI,MAAM,CAExD;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAExF;AAED,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAEpF;AAED,wBAAgB,gCAAgC,CAAC,QAAQ,EAAE;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAE5F;AAED,wBAAgB,iCAAiC,CAAC,QAAQ,EAAE;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAE7F;AAED,wBAAgB,+BAA+B,CAC7C,QAAQ,EAAE;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,EACnC,QAAQ,EAAE,MAAM,GACf,MAAM,CAER;AAED,wBAAgB,gCAAgC,CAC9C,QAAQ,EAAE;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,EACnC,QAAQ,EAAE,MAAM,GACf,MAAM,CAER;AAED,wBAAgB,6BAA6B,CAAC,QAAQ,EAAE;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAEzF;AAED,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAEtF;AAED,wBAAgB,+BAA+B,CAAC,QAAQ,EAAE;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAE3F;AAED,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAE1F"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import os from "node:os";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import { AGENTPLANE_HOME_ENV, GLOBAL_RECIPES_DIR_NAME, INSTALLED_RECIPES_NAME,
|
|
3
|
+
import { AGENTPLANE_HOME_ENV, GLOBAL_RECIPES_DIR_NAME, INSTALLED_RECIPES_NAME, PROJECT_RECIPES_PACKAGES_DIR_NAME, PROJECT_RECIPES_REGISTRY_NAME, PROJECT_RECIPES_CACHE_DIR_NAME, RECIPES_DIR_NAME, RECIPES_REMOTE_INDEX_NAME, RECIPES_REMOTE_INDEX_SIG_NAME, } from "./constants.js";
|
|
4
4
|
export function resolveAgentplaneHome() {
|
|
5
5
|
const overridden = process.env[AGENTPLANE_HOME_ENV]?.trim();
|
|
6
6
|
if (overridden)
|
|
@@ -25,12 +25,27 @@ export function resolveInstalledRecipeDir(entry) {
|
|
|
25
25
|
export function resolveProjectRecipesDir(resolved) {
|
|
26
26
|
return path.join(resolved.agentplaneDir, RECIPES_DIR_NAME);
|
|
27
27
|
}
|
|
28
|
-
export function
|
|
29
|
-
return path.join(resolveProjectRecipesDir(resolved),
|
|
28
|
+
export function resolveProjectRecipesPackagesDir(resolved) {
|
|
29
|
+
return path.join(resolveProjectRecipesDir(resolved), PROJECT_RECIPES_PACKAGES_DIR_NAME);
|
|
30
|
+
}
|
|
31
|
+
export function resolveProjectRecipesRegistryPath(resolved) {
|
|
32
|
+
return path.join(resolveProjectRecipesDir(resolved), PROJECT_RECIPES_REGISTRY_NAME);
|
|
30
33
|
}
|
|
31
|
-
export function
|
|
32
|
-
return path.join(
|
|
34
|
+
export function resolveProjectVendoredRecipeDir(resolved, recipeId) {
|
|
35
|
+
return path.join(resolveProjectRecipesPackagesDir(resolved), recipeId);
|
|
36
|
+
}
|
|
37
|
+
export function resolveProjectInstalledRecipeDir(resolved, recipeId) {
|
|
38
|
+
return resolveProjectVendoredRecipeDir(resolved, recipeId);
|
|
33
39
|
}
|
|
34
40
|
export function resolveProjectRecipesCacheDir(resolved) {
|
|
35
41
|
return path.join(resolved.agentplaneDir, PROJECT_RECIPES_CACHE_DIR_NAME);
|
|
36
42
|
}
|
|
43
|
+
export function resolveProjectGeneratedDir(resolved) {
|
|
44
|
+
return path.join(resolved.agentplaneDir, "generated");
|
|
45
|
+
}
|
|
46
|
+
export function resolveProjectOverlayBundlePath(resolved) {
|
|
47
|
+
return path.join(resolveProjectGeneratedDir(resolved), "overlay-bundle.json");
|
|
48
|
+
}
|
|
49
|
+
export function resolveProjectRecipeAssetsPath(resolved) {
|
|
50
|
+
return path.join(resolveProjectGeneratedDir(resolved), "recipe-assets.json");
|
|
51
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type
|
|
2
|
-
export declare function
|
|
3
|
-
|
|
1
|
+
import { type ProjectInstalledRecipesFile, type ProjectRecipesRegistryFile } from "@agentplaneorg/recipes";
|
|
2
|
+
export declare function readProjectInstalledRecipesFromRegistry(opts: {
|
|
3
|
+
agentplaneDir: string;
|
|
4
|
+
}, registry: ProjectRecipesRegistryFile): Promise<ProjectInstalledRecipesFile>;
|
|
4
5
|
export declare function readProjectInstalledRecipes(opts: {
|
|
5
6
|
agentplaneDir: string;
|
|
6
|
-
}): Promise<
|
|
7
|
+
}): Promise<ProjectInstalledRecipesFile>;
|
|
7
8
|
//# sourceMappingURL=project-installed-recipes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-installed-recipes.d.ts","sourceRoot":"","sources":["../../../../src/commands/recipes/impl/project-installed-recipes.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"project-installed-recipes.d.ts","sourceRoot":"","sources":["../../../../src/commands/recipes/impl/project-installed-recipes.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,2BAA2B,EAChC,KAAK,0BAA0B,EAChC,MAAM,wBAAwB,CAAC;AAqBhC,wBAAsB,uCAAuC,CAC3D,IAAI,EAAE;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,EAC/B,QAAQ,EAAE,0BAA0B,GACnC,OAAO,CAAC,2BAA2B,CAAC,CA6CtC;AAED,wBAAsB,2BAA2B,CAAC,IAAI,EAAE;IACtD,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAGvC"}
|