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,102 +1,60 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { stat } from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
-
import {
|
|
3
|
+
import { normalizeRecipeTags, readRecipeManifest, } from "@agentplaneorg/recipes";
|
|
4
4
|
import { invalidFieldMessage, missingFileMessage } from "../../../cli/output.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { resolveProjectInstalledRecipeDir, resolveProjectRecipeInstallMetaPath, resolveProjectRecipesDir, } from "./paths.js";
|
|
8
|
-
import { readRecipeManifest } from "./manifest.js";
|
|
9
|
-
import { normalizeRecipeTags } from "./normalize.js";
|
|
10
|
-
function validateRecipeInstallMetadata(raw) {
|
|
11
|
-
if (!isRecord(raw))
|
|
12
|
-
throw new Error(invalidFieldMessage("recipe install metadata", "object"));
|
|
13
|
-
const id = typeof raw.id === "string" ? raw.id.trim() : "";
|
|
14
|
-
const version = typeof raw.version === "string" ? raw.version.trim() : "";
|
|
15
|
-
const source = typeof raw.source === "string" ? raw.source.trim() : "";
|
|
16
|
-
const installedAt = typeof raw.installed_at === "string" ? raw.installed_at.trim() : "";
|
|
17
|
-
const installMode = raw.install_mode === undefined || raw.install_mode === "project-local"
|
|
18
|
-
? raw.install_mode
|
|
19
|
-
: null;
|
|
20
|
-
if (raw.schema_version !== 1) {
|
|
21
|
-
throw new Error(invalidFieldMessage("recipe install metadata.schema_version", "1"));
|
|
22
|
-
}
|
|
23
|
-
if (!id || !version || !source || !installedAt) {
|
|
24
|
-
throw new Error(invalidFieldMessage("recipe install metadata", "id, version, source, installed_at"));
|
|
25
|
-
}
|
|
26
|
-
if (installMode === null) {
|
|
27
|
-
throw new Error(invalidFieldMessage("recipe install metadata.install_mode", '"project-local"'));
|
|
28
|
-
}
|
|
29
|
-
const tags = normalizeRecipeTags(raw.tags ?? []);
|
|
30
|
-
return {
|
|
31
|
-
schema_version: 1,
|
|
32
|
-
id,
|
|
33
|
-
version,
|
|
34
|
-
source,
|
|
35
|
-
installed_at: installedAt,
|
|
36
|
-
tags,
|
|
37
|
-
install_mode: installMode,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
5
|
+
import { readProjectRecipesRegistry } from "./project-registry.js";
|
|
6
|
+
import { resolveProjectRecipesDir } from "./paths.js";
|
|
40
7
|
function sortInstalledRecipes(entries) {
|
|
41
|
-
return [...entries].toSorted((
|
|
8
|
+
return [...entries].toSorted((left, right) => left.id.localeCompare(right.id));
|
|
42
9
|
}
|
|
43
|
-
|
|
10
|
+
async function pathExistsAsKind(filePath, kind) {
|
|
44
11
|
try {
|
|
45
|
-
const
|
|
46
|
-
return
|
|
12
|
+
const stats = await stat(filePath);
|
|
13
|
+
return kind === "dir" ? stats.isDirectory() : stats.isFile();
|
|
47
14
|
}
|
|
48
|
-
catch
|
|
49
|
-
|
|
50
|
-
if (code === "ENOENT")
|
|
51
|
-
return null;
|
|
52
|
-
throw err;
|
|
15
|
+
catch {
|
|
16
|
+
return false;
|
|
53
17
|
}
|
|
54
18
|
}
|
|
55
|
-
export async function
|
|
56
|
-
|
|
57
|
-
await writeJsonStableIfChanged(filePath, metadata);
|
|
58
|
-
}
|
|
59
|
-
export async function readProjectInstalledRecipes(opts) {
|
|
60
|
-
const recipesDir = resolveProjectRecipesDir(opts);
|
|
61
|
-
if ((await getPathKind(recipesDir)) !== "dir") {
|
|
19
|
+
export async function readProjectInstalledRecipesFromRegistry(opts, registry) {
|
|
20
|
+
if (registry.recipes.length === 0) {
|
|
62
21
|
return { schema_version: 1, updated_at: "", recipes: [] };
|
|
63
22
|
}
|
|
64
23
|
const entries = [];
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
if (!
|
|
68
|
-
|
|
69
|
-
|
|
24
|
+
for (const registryEntry of registry.recipes) {
|
|
25
|
+
const recipeDir = path.join(resolveProjectRecipesDir(opts), registryEntry.path);
|
|
26
|
+
if (!(await pathExistsAsKind(recipeDir, "dir"))) {
|
|
27
|
+
throw new Error(missingFileMessage("vendored recipe directory", recipeDir));
|
|
28
|
+
}
|
|
70
29
|
const manifestPath = path.join(recipeDir, "manifest.json");
|
|
71
|
-
if (!(await
|
|
30
|
+
if (!(await pathExistsAsKind(manifestPath, "file"))) {
|
|
72
31
|
throw new Error(missingFileMessage("installed recipe manifest", manifestPath));
|
|
73
32
|
}
|
|
74
33
|
const manifest = await readRecipeManifest(manifestPath);
|
|
75
|
-
if (manifest.id !==
|
|
76
|
-
throw new Error(invalidFieldMessage(`installed recipe directory ${
|
|
77
|
-
}
|
|
78
|
-
const metadata = await readRecipeInstallMetadata(resolveProjectRecipeInstallMetaPath(opts, dirent.name));
|
|
79
|
-
if (metadata && (metadata.id !== manifest.id || metadata.version !== manifest.version)) {
|
|
80
|
-
throw new Error(invalidFieldMessage(`recipe install metadata ${dirent.name}`, "id/version matching manifest"));
|
|
34
|
+
if (manifest.id !== registryEntry.id || manifest.version !== registryEntry.version) {
|
|
35
|
+
throw new Error(invalidFieldMessage(`installed recipe directory ${registryEntry.id}`, `manifest.id=${registryEntry.id} and manifest.version=${registryEntry.version}`));
|
|
81
36
|
}
|
|
82
37
|
entries.push({
|
|
83
38
|
id: manifest.id,
|
|
84
39
|
version: manifest.version,
|
|
85
|
-
source:
|
|
86
|
-
|
|
87
|
-
|
|
40
|
+
source: registryEntry.source_ref,
|
|
41
|
+
source_ref: registryEntry.source_ref,
|
|
42
|
+
source_sha256: registryEntry.source_sha256,
|
|
43
|
+
vendored_sha256: registryEntry.vendored_sha256,
|
|
44
|
+
materialization: registryEntry.materialization,
|
|
45
|
+
installed_at: registryEntry.installed_at,
|
|
46
|
+
project_path: registryEntry.path,
|
|
47
|
+
tags: normalizeRecipeTags(registryEntry.tags ?? manifest.tags ?? []),
|
|
88
48
|
manifest,
|
|
89
49
|
});
|
|
90
50
|
}
|
|
91
|
-
const sorted = sortInstalledRecipes(entries);
|
|
92
|
-
const updatedAt = sorted
|
|
93
|
-
.map((entry) => entry.installed_at)
|
|
94
|
-
.filter(Boolean)
|
|
95
|
-
.toSorted()
|
|
96
|
-
.at(-1);
|
|
97
51
|
return {
|
|
98
52
|
schema_version: 1,
|
|
99
|
-
updated_at:
|
|
100
|
-
recipes:
|
|
53
|
+
updated_at: registry.updated_at,
|
|
54
|
+
recipes: sortInstalledRecipes(entries),
|
|
101
55
|
};
|
|
102
56
|
}
|
|
57
|
+
export async function readProjectInstalledRecipes(opts) {
|
|
58
|
+
const registry = await readProjectRecipesRegistry(opts);
|
|
59
|
+
return await readProjectInstalledRecipesFromRegistry(opts, registry);
|
|
60
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ProjectInstalledRecipeEntry, ProjectRecipeState } from "@agentplaneorg/recipes";
|
|
2
|
+
export declare function hashRecipeTree(rootDir: string): Promise<string>;
|
|
3
|
+
export type ProjectRecipeInspection = {
|
|
4
|
+
entry: ProjectInstalledRecipeEntry;
|
|
5
|
+
recipe_dir: string;
|
|
6
|
+
source_dir: string;
|
|
7
|
+
cache_present: boolean;
|
|
8
|
+
current_source_sha256?: string;
|
|
9
|
+
current_vendored_sha256: string;
|
|
10
|
+
state: ProjectRecipeState;
|
|
11
|
+
};
|
|
12
|
+
export declare function inspectProjectRecipe(opts: {
|
|
13
|
+
project: {
|
|
14
|
+
agentplaneDir: string;
|
|
15
|
+
};
|
|
16
|
+
recipeId: string;
|
|
17
|
+
}): Promise<ProjectRecipeInspection>;
|
|
18
|
+
//# sourceMappingURL=project-recipe-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-recipe-state.d.ts","sourceRoot":"","sources":["../../../../src/commands/recipes/impl/project-recipe-state.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,2BAA2B,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AA+B9F,wBAAsB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAIrE;AAED,MAAM,MAAM,uBAAuB,GAAG;IACpC,KAAK,EAAE,2BAA2B,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC;IACvB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,uBAAuB,EAAE,MAAM,CAAC;IAChC,KAAK,EAAE,kBAAkB,CAAC;CAC3B,CAAC;AA2BF,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,OAAO,EAAE;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAwCnC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { lstat, readFile, readdir } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { readProjectInstalledRecipes } from "./project-installed-recipes.js";
|
|
5
|
+
import { resolveInstalledRecipeDir, resolveProjectVendoredRecipeDir } from "./paths.js";
|
|
6
|
+
async function hashTreeEntry(rootDir, relativeDir, hash) {
|
|
7
|
+
const directoryPath = relativeDir ? path.join(rootDir, relativeDir) : rootDir;
|
|
8
|
+
const directoryEntries = await readdir(directoryPath, { withFileTypes: true });
|
|
9
|
+
const entries = directoryEntries.toSorted((left, right) => left.name.localeCompare(right.name));
|
|
10
|
+
for (const entry of entries) {
|
|
11
|
+
const relativePath = relativeDir ? path.posix.join(relativeDir, entry.name) : entry.name;
|
|
12
|
+
const absolutePath = path.join(rootDir, relativePath);
|
|
13
|
+
if (entry.isDirectory()) {
|
|
14
|
+
hash.update(`dir:${relativePath}\n`);
|
|
15
|
+
await hashTreeEntry(rootDir, relativePath, hash);
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
if (entry.isSymbolicLink()) {
|
|
19
|
+
hash.update(`symlink:${relativePath}\n`);
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
const data = await readFile(absolutePath);
|
|
23
|
+
hash.update(`file:${relativePath}\n`);
|
|
24
|
+
hash.update(data);
|
|
25
|
+
hash.update("\n");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export async function hashRecipeTree(rootDir) {
|
|
29
|
+
const hash = createHash("sha256");
|
|
30
|
+
await hashTreeEntry(rootDir, "", hash);
|
|
31
|
+
return hash.digest("hex");
|
|
32
|
+
}
|
|
33
|
+
function classifyRecipeState(opts) {
|
|
34
|
+
if (opts.entry.materialization === "link" && !opts.vendoredPathIsSymlink) {
|
|
35
|
+
return "modified";
|
|
36
|
+
}
|
|
37
|
+
const vendoredModified = opts.currentVendoredSha256 !== opts.entry.vendored_sha256;
|
|
38
|
+
const cacheDiverged = opts.cachePresent && opts.currentSourceSha256 !== undefined
|
|
39
|
+
? opts.currentSourceSha256 !== opts.entry.source_sha256
|
|
40
|
+
: false;
|
|
41
|
+
if (opts.entry.materialization === "link") {
|
|
42
|
+
if (cacheDiverged)
|
|
43
|
+
return "diverged_from_cache";
|
|
44
|
+
if (vendoredModified)
|
|
45
|
+
return "modified";
|
|
46
|
+
return "clean";
|
|
47
|
+
}
|
|
48
|
+
if (vendoredModified)
|
|
49
|
+
return "modified";
|
|
50
|
+
if (cacheDiverged)
|
|
51
|
+
return "diverged_from_cache";
|
|
52
|
+
return "clean";
|
|
53
|
+
}
|
|
54
|
+
export async function inspectProjectRecipe(opts) {
|
|
55
|
+
const installed = await readProjectInstalledRecipes(opts.project);
|
|
56
|
+
const entry = installed.recipes.find((recipe) => recipe.id === opts.recipeId);
|
|
57
|
+
if (!entry) {
|
|
58
|
+
throw new Error(`Recipe not installed: ${opts.recipeId}`);
|
|
59
|
+
}
|
|
60
|
+
const recipeDir = resolveProjectVendoredRecipeDir(opts.project, entry.id);
|
|
61
|
+
const sourceDir = resolveInstalledRecipeDir({ id: entry.id, version: entry.version });
|
|
62
|
+
const vendoredPathStat = await lstat(recipeDir);
|
|
63
|
+
const vendoredPathIsSymlink = vendoredPathStat.isSymbolicLink();
|
|
64
|
+
const currentVendoredSha256 = await hashRecipeTree(recipeDir);
|
|
65
|
+
let cachePresent = false;
|
|
66
|
+
let currentSourceSha256;
|
|
67
|
+
try {
|
|
68
|
+
const sourceStat = await lstat(sourceDir);
|
|
69
|
+
if (sourceStat.isDirectory() || sourceStat.isSymbolicLink()) {
|
|
70
|
+
cachePresent = true;
|
|
71
|
+
currentSourceSha256 = await hashRecipeTree(sourceDir);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
const code = error?.code;
|
|
76
|
+
if (code !== "ENOENT")
|
|
77
|
+
throw error;
|
|
78
|
+
}
|
|
79
|
+
return {
|
|
80
|
+
entry,
|
|
81
|
+
recipe_dir: recipeDir,
|
|
82
|
+
source_dir: sourceDir,
|
|
83
|
+
cache_present: cachePresent,
|
|
84
|
+
current_source_sha256: currentSourceSha256,
|
|
85
|
+
current_vendored_sha256: currentVendoredSha256,
|
|
86
|
+
state: classifyRecipeState({
|
|
87
|
+
entry,
|
|
88
|
+
cachePresent,
|
|
89
|
+
currentSourceSha256,
|
|
90
|
+
currentVendoredSha256,
|
|
91
|
+
vendoredPathIsSymlink,
|
|
92
|
+
}),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type ProjectRecipeRegistryEntry, type ProjectRecipesRegistryFile } from "@agentplaneorg/recipes";
|
|
2
|
+
export declare function stampProjectRecipesRegistry(file: ProjectRecipesRegistryFile, updatedAt?: string): ProjectRecipesRegistryFile;
|
|
3
|
+
export declare function replaceProjectRecipeRegistryEntry(registry: ProjectRecipesRegistryFile, entry: ProjectRecipeRegistryEntry): ProjectRecipesRegistryFile;
|
|
4
|
+
export declare function removeProjectRecipeRegistryEntryFromFile(registry: ProjectRecipesRegistryFile, recipeId: string): ProjectRecipesRegistryFile;
|
|
5
|
+
export declare function setProjectRecipeActiveInFile(registry: ProjectRecipesRegistryFile, recipeId: string, active: boolean): ProjectRecipesRegistryFile;
|
|
6
|
+
export declare function readProjectRecipesRegistry(opts: {
|
|
7
|
+
agentplaneDir: string;
|
|
8
|
+
}): Promise<ProjectRecipesRegistryFile>;
|
|
9
|
+
export declare function writeProjectRecipesRegistry(opts: {
|
|
10
|
+
agentplaneDir: string;
|
|
11
|
+
}, file: ProjectRecipesRegistryFile): Promise<void>;
|
|
12
|
+
export declare function upsertProjectRecipeRegistryEntry(opts: {
|
|
13
|
+
project: {
|
|
14
|
+
agentplaneDir: string;
|
|
15
|
+
};
|
|
16
|
+
entry: ProjectRecipeRegistryEntry;
|
|
17
|
+
}): Promise<ProjectRecipesRegistryFile>;
|
|
18
|
+
export declare function removeProjectRecipeRegistryEntry(opts: {
|
|
19
|
+
project: {
|
|
20
|
+
agentplaneDir: string;
|
|
21
|
+
};
|
|
22
|
+
recipeId: string;
|
|
23
|
+
}): Promise<ProjectRecipesRegistryFile>;
|
|
24
|
+
//# sourceMappingURL=project-registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-registry.d.ts","sourceRoot":"","sources":["../../../../src/commands/recipes/impl/project-registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAIL,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAChC,MAAM,wBAAwB,CAAC;AA2DhC,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,0BAA0B,EAChC,SAAS,SAA2B,GACnC,0BAA0B,CAM5B;AAED,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,0BAA0B,EACpC,KAAK,EAAE,0BAA0B,GAChC,0BAA0B,CAQ5B;AAED,wBAAgB,wCAAwC,CACtD,QAAQ,EAAE,0BAA0B,EACpC,QAAQ,EAAE,MAAM,GACf,0BAA0B,CAM5B;AAED,wBAAgB,4BAA4B,CAC1C,QAAQ,EAAE,0BAA0B,EACpC,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,OAAO,GACd,0BAA0B,CAQ5B;AAED,wBAAsB,0BAA0B,CAAC,IAAI,EAAE;IACrD,aAAa,EAAE,MAAM,CAAC;CACvB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAwBtC;AAED,wBAAsB,2BAA2B,CAC/C,IAAI,EAAE;IAAE,aAAa,EAAE,MAAM,CAAA;CAAE,EAC/B,IAAI,EAAE,0BAA0B,GAC/B,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,wBAAsB,gCAAgC,CAAC,IAAI,EAAE;IAC3D,OAAO,EAAE;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,KAAK,EAAE,0BAA0B,CAAC;CACnC,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAKtC;AAED,wBAAsB,gCAAgC,CAAC,IAAI,EAAE;IAC3D,OAAO,EAAE;QAAE,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAKtC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { mkdir, readFile } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { normalizeRecipeId, normalizeRecipeTags, } from "@agentplaneorg/recipes";
|
|
4
|
+
import { invalidFieldMessage } from "../../../cli/output.js";
|
|
5
|
+
import { isRecord } from "../../../shared/guards.js";
|
|
6
|
+
import { writeJsonStableIfChanged } from "../../../shared/write-if-changed.js";
|
|
7
|
+
import { resolveProjectRecipesRegistryPath } from "./paths.js";
|
|
8
|
+
function validateMaterialization(raw) {
|
|
9
|
+
if (raw === "copy" || raw === "link")
|
|
10
|
+
return raw;
|
|
11
|
+
throw new Error(invalidFieldMessage("recipes registry materialization", '"copy" | "link"'));
|
|
12
|
+
}
|
|
13
|
+
function validateRegistryEntry(raw) {
|
|
14
|
+
if (!isRecord(raw))
|
|
15
|
+
throw new Error(invalidFieldMessage("recipes registry entry", "object"));
|
|
16
|
+
const id = normalizeRecipeId(typeof raw.id === "string" ? raw.id.trim() : "");
|
|
17
|
+
const version = typeof raw.version === "string" ? raw.version.trim() : "";
|
|
18
|
+
const entryPath = typeof raw.path === "string" ? raw.path.trim() : "";
|
|
19
|
+
const sourceRef = typeof raw.source_ref === "string" ? raw.source_ref.trim() : "";
|
|
20
|
+
const sourceSha256 = typeof raw.source_sha256 === "string" ? raw.source_sha256.trim() : "";
|
|
21
|
+
const vendoredSha256 = typeof raw.vendored_sha256 === "string" ? raw.vendored_sha256.trim() : "";
|
|
22
|
+
const installedAt = typeof raw.installed_at === "string" ? raw.installed_at.trim() : "";
|
|
23
|
+
if (!id ||
|
|
24
|
+
!version ||
|
|
25
|
+
!entryPath ||
|
|
26
|
+
!sourceRef ||
|
|
27
|
+
!sourceSha256 ||
|
|
28
|
+
!vendoredSha256 ||
|
|
29
|
+
!installedAt) {
|
|
30
|
+
throw new Error(invalidFieldMessage("recipes registry entry", "id, version, path, source_ref, source_sha256, vendored_sha256, installed_at"));
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
id,
|
|
34
|
+
version,
|
|
35
|
+
path: entryPath,
|
|
36
|
+
active: raw.active === true,
|
|
37
|
+
materialization: validateMaterialization(raw.materialization),
|
|
38
|
+
source_ref: sourceRef,
|
|
39
|
+
source_sha256: sourceSha256,
|
|
40
|
+
vendored_sha256: vendoredSha256,
|
|
41
|
+
installed_at: installedAt,
|
|
42
|
+
tags: normalizeRecipeTags(raw.tags ?? []),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function sortRegistry(file) {
|
|
46
|
+
return {
|
|
47
|
+
schema_version: 1,
|
|
48
|
+
updated_at: file.updated_at,
|
|
49
|
+
recipes: [...file.recipes].toSorted((left, right) => left.id.localeCompare(right.id)),
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
export function stampProjectRecipesRegistry(file, updatedAt = new Date().toISOString()) {
|
|
53
|
+
return sortRegistry({
|
|
54
|
+
schema_version: 1,
|
|
55
|
+
updated_at: updatedAt,
|
|
56
|
+
recipes: file.recipes,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
export function replaceProjectRecipeRegistryEntry(registry, entry) {
|
|
60
|
+
const recipes = registry.recipes.filter((candidate) => candidate.id !== entry.id);
|
|
61
|
+
recipes.push(entry);
|
|
62
|
+
return sortRegistry({
|
|
63
|
+
schema_version: 1,
|
|
64
|
+
updated_at: registry.updated_at,
|
|
65
|
+
recipes,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
export function removeProjectRecipeRegistryEntryFromFile(registry, recipeId) {
|
|
69
|
+
return sortRegistry({
|
|
70
|
+
schema_version: 1,
|
|
71
|
+
updated_at: registry.updated_at,
|
|
72
|
+
recipes: registry.recipes.filter((entry) => entry.id !== recipeId),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
export function setProjectRecipeActiveInFile(registry, recipeId, active) {
|
|
76
|
+
return sortRegistry({
|
|
77
|
+
schema_version: 1,
|
|
78
|
+
updated_at: registry.updated_at,
|
|
79
|
+
recipes: registry.recipes.map((entry) => entry.id === recipeId ? { ...entry, active } : entry),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
export async function readProjectRecipesRegistry(opts) {
|
|
83
|
+
try {
|
|
84
|
+
const raw = JSON.parse(await readFile(resolveProjectRecipesRegistryPath(opts), "utf8"));
|
|
85
|
+
if (!isRecord(raw))
|
|
86
|
+
throw new Error(invalidFieldMessage("recipes registry", "object"));
|
|
87
|
+
if (raw.schema_version !== 1) {
|
|
88
|
+
throw new Error(invalidFieldMessage("recipes registry.schema_version", "1"));
|
|
89
|
+
}
|
|
90
|
+
if (!Array.isArray(raw.recipes)) {
|
|
91
|
+
throw new Error(invalidFieldMessage("recipes registry.recipes", "array"));
|
|
92
|
+
}
|
|
93
|
+
return sortRegistry({
|
|
94
|
+
schema_version: 1,
|
|
95
|
+
updated_at: typeof raw.updated_at === "string" ? raw.updated_at : "",
|
|
96
|
+
recipes: raw.recipes.map((entry) => validateRegistryEntry(entry)),
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
const code = err?.code;
|
|
101
|
+
if (code === "ENOENT") {
|
|
102
|
+
return { schema_version: 1, updated_at: "", recipes: [] };
|
|
103
|
+
}
|
|
104
|
+
throw err;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export async function writeProjectRecipesRegistry(opts, file) {
|
|
108
|
+
const sorted = stampProjectRecipesRegistry(file);
|
|
109
|
+
const filePath = resolveProjectRecipesRegistryPath(opts);
|
|
110
|
+
await mkdir(path.dirname(filePath), { recursive: true });
|
|
111
|
+
await writeJsonStableIfChanged(filePath, sorted);
|
|
112
|
+
}
|
|
113
|
+
export async function upsertProjectRecipeRegistryEntry(opts) {
|
|
114
|
+
const registry = await readProjectRecipesRegistry(opts.project);
|
|
115
|
+
const next = replaceProjectRecipeRegistryEntry(registry, opts.entry);
|
|
116
|
+
await writeProjectRecipesRegistry(opts.project, next);
|
|
117
|
+
return readProjectRecipesRegistry(opts.project);
|
|
118
|
+
}
|
|
119
|
+
export async function removeProjectRecipeRegistryEntry(opts) {
|
|
120
|
+
const registry = await readProjectRecipesRegistry(opts.project);
|
|
121
|
+
const next = removeProjectRecipeRegistryEntryFromFile(registry, opts.recipeId);
|
|
122
|
+
await writeProjectRecipesRegistry(opts.project, next);
|
|
123
|
+
return readProjectRecipesRegistry(opts.project);
|
|
124
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ResolvedProject } from "@agentplaneorg/core";
|
|
2
|
-
import { type RecipeCompatibility, type RecipeResolverCompatibility, type RecipeResolverContext, type RecipeScenarioDescriptor, type ResolveRecipeScenarioSelectionFlags, type ResolvedRecipeRunProfile, type ResolvedRecipeScenario, type ResolvedRecipeScenarioSelection } from "
|
|
2
|
+
import { type RecipeCompatibility, type RecipeResolverCompatibility, type RecipeResolverContext, type RecipeScenarioDescriptor, type ResolveRecipeScenarioSelectionFlags, type ResolvedRecipeRunProfile, type ResolvedRecipeScenario, type ResolvedRecipeScenarioSelection } from "@agentplaneorg/recipes";
|
|
3
3
|
export declare function buildRecipeResolverContext(opts: {
|
|
4
4
|
project: ResolvedProject;
|
|
5
5
|
}): Promise<RecipeResolverContext>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../../../src/commands/recipes/impl/resolver.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../../../src/commands/recipes/impl/resolver.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,2BAA2B,EAEhC,KAAK,qBAAqB,EAE1B,KAAK,wBAAwB,EAE7B,KAAK,mCAAmC,EACxC,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,+BAA+B,EACrC,MAAM,wBAAwB,CAAC;AA8BhC,wBAAsB,0BAA0B,CAAC,IAAI,EAAE;IACrD,OAAO,EAAE,eAAe,CAAC;CAC1B,GAAG,OAAO,CAAC,qBAAqB,CAAC,CASjC;AAYD,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,aAAa,CAAC,EAAE,mBAAmB,CAAC;IACpC,OAAO,EAAE,qBAAqB,CAAC;CAChC,GAAG,2BAA2B,CAkG9B;AAED,wBAAgB,iCAAiC,CAC/C,QAAQ,EAAE,wBAAwB,GACjC,wBAAwB,CAO1B;AAqDD,wBAAsB,2BAA2B,CAAC,IAAI,EAAE;IACtD,OAAO,EAAE,eAAe,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC,CAsBpC;AAED,wBAAsB,8BAA8B,CAAC,IAAI,EAAE;IACzD,OAAO,EAAE,eAAe,CAAC;IACzB,KAAK,EAAE,mCAAmC,CAAC;CAC5C,GAAG,OAAO,CAAC,+BAA+B,CAAC,CA6D3C"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
+
import { readScenarioDefinition, } from "@agentplaneorg/recipes";
|
|
2
3
|
import { fileExists } from "../../../cli/fs-utils.js";
|
|
3
4
|
import { getVersion } from "../../../meta/version.js";
|
|
4
5
|
import { dedupeStrings } from "../../../shared/strings.js";
|
|
5
6
|
import { compareVersions } from "../../../shared/version-compare.js";
|
|
6
|
-
import { resolveProjectInstalledRecipeDir } from "./paths.js";
|
|
7
|
+
import { resolveProjectRecipesDir, resolveProjectInstalledRecipeDir } from "./paths.js";
|
|
7
8
|
import { readProjectInstalledRecipes } from "./project-installed-recipes.js";
|
|
8
|
-
import { readScenarioDefinition } from "./scenario.js";
|
|
9
9
|
const SUPPORTED_MANIFEST_API_VERSION = "1";
|
|
10
10
|
const SUPPORTED_SCENARIO_API_VERSION = "1";
|
|
11
11
|
const SUPPORTED_RUNTIME_API_VERSION = "1";
|
|
@@ -109,8 +109,10 @@ export function normalizeResolvedRecipeRunProfile(scenario) {
|
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
111
|
function toResolvedRecipeScenarios(opts) {
|
|
112
|
-
const recipeDir =
|
|
113
|
-
|
|
112
|
+
const recipeDir = opts.entry.project_path
|
|
113
|
+
? path.join(resolveProjectRecipesDir(opts.project), opts.entry.project_path)
|
|
114
|
+
: resolveProjectInstalledRecipeDir(opts.project, opts.entry.id);
|
|
115
|
+
return (opts.entry.manifest.scenarios ?? [])
|
|
114
116
|
.map((scenario) => ({
|
|
115
117
|
recipe_id: opts.entry.id,
|
|
116
118
|
recipe_version: opts.entry.version,
|