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
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
import { execFile } from "node:child_process";
|
|
2
|
+
import { createHash } from "node:crypto";
|
|
3
|
+
import { mkdir, mkdtemp, readFile, writeFile } from "node:fs/promises";
|
|
4
|
+
import os from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { fileURLToPath } from "node:url";
|
|
7
|
+
import { promisify } from "node:util";
|
|
8
|
+
import { gzipSync } from "node:zlib";
|
|
9
|
+
const execFileAsync = promisify(execFile);
|
|
10
|
+
const recipeArchiveCache = new Map();
|
|
11
|
+
export async function createRecipeArchive(opts) {
|
|
12
|
+
const normalizedTags = opts?.tags ? [...opts.tags].toSorted() : undefined;
|
|
13
|
+
const cacheKey = JSON.stringify({
|
|
14
|
+
id: opts?.id ?? "viewer",
|
|
15
|
+
version: opts?.version ?? "1.2.3",
|
|
16
|
+
name: opts?.name ?? "Viewer",
|
|
17
|
+
summary: opts?.summary ?? "Preview task artifacts",
|
|
18
|
+
description: opts?.description ?? "Provides a local viewer for task artifacts.",
|
|
19
|
+
tags: normalizedTags,
|
|
20
|
+
format: opts?.format ?? "tar",
|
|
21
|
+
wrapDir: opts?.wrapDir ?? false,
|
|
22
|
+
});
|
|
23
|
+
const cached = recipeArchiveCache.get(cacheKey);
|
|
24
|
+
if (cached)
|
|
25
|
+
return cached;
|
|
26
|
+
const baseDir = await mkdtemp(path.join(os.tmpdir(), "agentplane-recipe-"));
|
|
27
|
+
const recipeDir = path.join(baseDir, opts?.wrapDir ? "bundle" : "recipe");
|
|
28
|
+
await mkdir(recipeDir, { recursive: true });
|
|
29
|
+
const manifest = {
|
|
30
|
+
schema_version: "1",
|
|
31
|
+
id: opts?.id ?? "viewer",
|
|
32
|
+
version: opts?.version ?? "1.2.3",
|
|
33
|
+
name: opts?.name ?? "Viewer",
|
|
34
|
+
summary: opts?.summary ?? "Preview task artifacts",
|
|
35
|
+
description: opts?.description ?? "Provides a local viewer for task artifacts.",
|
|
36
|
+
compatibility: {
|
|
37
|
+
min_agentplane_version: "0.3.5",
|
|
38
|
+
manifest_api_version: "1",
|
|
39
|
+
scenario_api_version: "1",
|
|
40
|
+
runtime_api_version: "1",
|
|
41
|
+
platforms: ["darwin", "linux"],
|
|
42
|
+
repo_types: ["generic"],
|
|
43
|
+
},
|
|
44
|
+
skills: [
|
|
45
|
+
{
|
|
46
|
+
id: "RECIPE_SKILL",
|
|
47
|
+
summary: "Recipe analysis skill",
|
|
48
|
+
file: "skills/analysis.md",
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
|
+
agents: [
|
|
52
|
+
{
|
|
53
|
+
id: "RECIPE_AGENT",
|
|
54
|
+
display_name: "Recipe Agent",
|
|
55
|
+
role: "executor",
|
|
56
|
+
summary: "Recipe agent",
|
|
57
|
+
skills: ["RECIPE_SKILL"],
|
|
58
|
+
tools: ["RECIPE_TOOL"],
|
|
59
|
+
file: "agents/recipe.md",
|
|
60
|
+
},
|
|
61
|
+
],
|
|
62
|
+
tools: [
|
|
63
|
+
{ id: "RECIPE_TOOL", summary: "Recipe tool", runtime: "node", entrypoint: "tools/run.js" },
|
|
64
|
+
],
|
|
65
|
+
scenarios: [
|
|
66
|
+
{
|
|
67
|
+
id: "RECIPE_SCENARIO",
|
|
68
|
+
name: "Recipe Scenario",
|
|
69
|
+
summary: "Recipe scenario",
|
|
70
|
+
use_when: ["Task artifacts need local preview"],
|
|
71
|
+
required_inputs: ["task_id"],
|
|
72
|
+
outputs: ["report"],
|
|
73
|
+
permissions: ["filesystem-write"],
|
|
74
|
+
artifacts: ["artifact.txt"],
|
|
75
|
+
agents_involved: ["RECIPE_AGENT"],
|
|
76
|
+
skills_used: ["RECIPE_SKILL"],
|
|
77
|
+
tools_used: ["RECIPE_TOOL"],
|
|
78
|
+
run_profile: {
|
|
79
|
+
mode: "analysis",
|
|
80
|
+
sandbox: "workspace-write",
|
|
81
|
+
writes_artifacts_to: ["logs/", "reports/"],
|
|
82
|
+
},
|
|
83
|
+
file: "scenarios/recipe-scenario.json",
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
};
|
|
87
|
+
if (normalizedTags) {
|
|
88
|
+
manifest.tags = normalizedTags;
|
|
89
|
+
}
|
|
90
|
+
await writeFile(path.join(recipeDir, "manifest.json"), JSON.stringify(manifest, null, 2), "utf8");
|
|
91
|
+
const agentsDir = path.join(recipeDir, "agents");
|
|
92
|
+
await mkdir(agentsDir, { recursive: true });
|
|
93
|
+
await writeFile(path.join(agentsDir, "recipe.md"), [
|
|
94
|
+
"# Recipe Agent",
|
|
95
|
+
"",
|
|
96
|
+
"Role: executor",
|
|
97
|
+
"",
|
|
98
|
+
"Instructions:",
|
|
99
|
+
"- Use recipe local policy.",
|
|
100
|
+
"- Materialize the declared scenario artifacts.",
|
|
101
|
+
].join("\n"), "utf8");
|
|
102
|
+
const skillsDir = path.join(recipeDir, "skills");
|
|
103
|
+
await mkdir(skillsDir, { recursive: true });
|
|
104
|
+
await writeFile(path.join(skillsDir, "analysis.md"), [
|
|
105
|
+
"# Recipe Skill",
|
|
106
|
+
"",
|
|
107
|
+
"- Inspect the generated bundle before acting.",
|
|
108
|
+
"- Keep recipe-owned artifacts inside the declared output paths.",
|
|
109
|
+
].join("\n"), "utf8");
|
|
110
|
+
const toolsDir = path.join(recipeDir, "tools");
|
|
111
|
+
await mkdir(toolsDir, { recursive: true });
|
|
112
|
+
await writeFile(path.join(toolsDir, "run.js"), [
|
|
113
|
+
'const fs = require("node:fs");',
|
|
114
|
+
'fs.writeFileSync(process.env.AGENTPLANE_RUN_DIR + "/artifact.txt", "ok");',
|
|
115
|
+
].join("\n"), "utf8");
|
|
116
|
+
const scenariosDir = path.join(recipeDir, "scenarios");
|
|
117
|
+
await mkdir(scenariosDir, { recursive: true });
|
|
118
|
+
await writeFile(path.join(scenariosDir, "recipe-scenario.json"), JSON.stringify({
|
|
119
|
+
schema_version: "1",
|
|
120
|
+
id: "RECIPE_SCENARIO",
|
|
121
|
+
summary: "Recipe scenario",
|
|
122
|
+
goal: "Preview installed tasks.",
|
|
123
|
+
task_template: {
|
|
124
|
+
title: "Recipe scenario task",
|
|
125
|
+
description: "Materialize a task from the recipe scenario.",
|
|
126
|
+
owner: "CODER",
|
|
127
|
+
priority: "med",
|
|
128
|
+
tags: ["code", "recipes"],
|
|
129
|
+
verify: ["bunx vitest run packages/agentplane/src/commands/recipes.scenario.test.ts"],
|
|
130
|
+
doc: {
|
|
131
|
+
summary: "Recipe-backed task execution.",
|
|
132
|
+
scope: "Run the scenario without task materialization heuristics.",
|
|
133
|
+
plan: "1. Materialize the task. 2. Execute the shared runner.",
|
|
134
|
+
verify_steps: "1. Run scenario execution tests.",
|
|
135
|
+
rollback_plan: "Revert the generated task and runner artifacts.",
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
inputs: [{ name: "task_id", type: "string" }],
|
|
139
|
+
outputs: [{ name: "report", type: "html" }],
|
|
140
|
+
steps: [{ tool: "RECIPE_TOOL" }],
|
|
141
|
+
}, null, 2), "utf8");
|
|
142
|
+
const format = opts?.format ?? "tar";
|
|
143
|
+
const archivePath = format === "zip" ? path.join(baseDir, "recipe.zip") : path.join(baseDir, "recipe.tar.gz");
|
|
144
|
+
if (format === "zip") {
|
|
145
|
+
await (opts?.wrapDir
|
|
146
|
+
? execFileAsync("zip", ["-qr", archivePath, path.basename(recipeDir)], { cwd: baseDir })
|
|
147
|
+
: execFileAsync("zip", ["-qr", archivePath, "."], { cwd: recipeDir }));
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
await (opts?.wrapDir
|
|
151
|
+
? execFileAsync("tar", ["-czf", archivePath, "-C", baseDir, path.basename(recipeDir)])
|
|
152
|
+
: execFileAsync("tar", ["-czf", archivePath, "-C", recipeDir, "."]));
|
|
153
|
+
}
|
|
154
|
+
const payload = { archivePath, manifest };
|
|
155
|
+
recipeArchiveCache.set(cacheKey, payload);
|
|
156
|
+
return payload;
|
|
157
|
+
}
|
|
158
|
+
export async function createRecipeArchiveWithManifest(opts) {
|
|
159
|
+
const baseDir = await mkdtemp(path.join(os.tmpdir(), "agentplane-recipe-bad-"));
|
|
160
|
+
const recipeDir = path.join(baseDir, opts.wrapDir ? "bundle" : "recipe");
|
|
161
|
+
await mkdir(recipeDir, { recursive: true });
|
|
162
|
+
await writeFile(path.join(recipeDir, "manifest.json"), JSON.stringify(opts.manifest, null, 2));
|
|
163
|
+
if (opts.files) {
|
|
164
|
+
for (const [relPath, content] of Object.entries(opts.files)) {
|
|
165
|
+
const fullPath = path.join(recipeDir, relPath);
|
|
166
|
+
await mkdir(path.dirname(fullPath), { recursive: true });
|
|
167
|
+
await writeFile(fullPath, content, "utf8");
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const format = opts.format ?? "tar";
|
|
171
|
+
const archivePath = format === "zip" ? path.join(baseDir, "recipe.zip") : path.join(baseDir, "recipe.tar.gz");
|
|
172
|
+
if (format === "zip") {
|
|
173
|
+
await (opts.wrapDir
|
|
174
|
+
? execFileAsync("zip", ["-qr", archivePath, path.basename(recipeDir)], { cwd: baseDir })
|
|
175
|
+
: execFileAsync("zip", ["-qr", archivePath, "."], { cwd: recipeDir }));
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
await (opts.wrapDir
|
|
179
|
+
? execFileAsync("tar", ["-czf", archivePath, "-C", baseDir, path.basename(recipeDir)])
|
|
180
|
+
: execFileAsync("tar", ["-czf", archivePath, "-C", recipeDir, "."]));
|
|
181
|
+
}
|
|
182
|
+
return archivePath;
|
|
183
|
+
}
|
|
184
|
+
export async function createUnsafeRecipeArchive(opts) {
|
|
185
|
+
const baseDir = await mkdtemp(path.join(os.tmpdir(), "agentplane-recipe-unsafe-"));
|
|
186
|
+
const recipeDir = path.join(baseDir, "recipe");
|
|
187
|
+
await mkdir(recipeDir, { recursive: true });
|
|
188
|
+
const manifest = {
|
|
189
|
+
schema_version: "1",
|
|
190
|
+
id: "unsafe",
|
|
191
|
+
version: "0.0.1",
|
|
192
|
+
name: "Unsafe",
|
|
193
|
+
summary: "Unsafe recipe",
|
|
194
|
+
description: "Used for archive validation tests.",
|
|
195
|
+
skills: [
|
|
196
|
+
{
|
|
197
|
+
id: "RECIPE_SKILL",
|
|
198
|
+
summary: "Recipe skill",
|
|
199
|
+
file: "skills/recipe.md",
|
|
200
|
+
},
|
|
201
|
+
],
|
|
202
|
+
agents: [
|
|
203
|
+
{
|
|
204
|
+
id: "RECIPE_AGENT",
|
|
205
|
+
display_name: "Recipe Agent",
|
|
206
|
+
role: "executor",
|
|
207
|
+
summary: "Recipe agent",
|
|
208
|
+
skills: ["RECIPE_SKILL"],
|
|
209
|
+
tools: ["RECIPE_TOOL"],
|
|
210
|
+
file: "agents/recipe.md",
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
tools: [
|
|
214
|
+
{ id: "RECIPE_TOOL", summary: "Recipe tool", runtime: "bash", entrypoint: "tools/run.sh" },
|
|
215
|
+
],
|
|
216
|
+
scenarios: [
|
|
217
|
+
{
|
|
218
|
+
id: "RECIPE_SCENARIO",
|
|
219
|
+
name: "Recipe Scenario",
|
|
220
|
+
summary: "Recipe scenario",
|
|
221
|
+
use_when: ["Unsafe validation fixture"],
|
|
222
|
+
required_inputs: [],
|
|
223
|
+
outputs: [],
|
|
224
|
+
permissions: [],
|
|
225
|
+
artifacts: [],
|
|
226
|
+
agents_involved: ["RECIPE_AGENT"],
|
|
227
|
+
skills_used: ["RECIPE_SKILL"],
|
|
228
|
+
tools_used: ["RECIPE_TOOL"],
|
|
229
|
+
run_profile: { mode: "analysis" },
|
|
230
|
+
file: "scenarios/recipe-scenario.json",
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
};
|
|
234
|
+
await writeFile(path.join(recipeDir, "manifest.json"), JSON.stringify(manifest, null, 2), "utf8");
|
|
235
|
+
const agentsDir = path.join(recipeDir, "agents");
|
|
236
|
+
await mkdir(agentsDir, { recursive: true });
|
|
237
|
+
await writeFile(path.join(agentsDir, "recipe.md"), "# Recipe Agent\n\nFollow the unsafe archive validation path.\n", "utf8");
|
|
238
|
+
const skillsDir = path.join(recipeDir, "skills");
|
|
239
|
+
await mkdir(skillsDir, { recursive: true });
|
|
240
|
+
await writeFile(path.join(skillsDir, "recipe.md"), "# Recipe Skill\n\nInspect archive contents before materialization.\n", "utf8");
|
|
241
|
+
const toolsDir = path.join(recipeDir, "tools");
|
|
242
|
+
await mkdir(toolsDir, { recursive: true });
|
|
243
|
+
await writeFile(path.join(toolsDir, "run.sh"), "#!/usr/bin/env bash\n", "utf8");
|
|
244
|
+
const scenariosDir = path.join(recipeDir, "scenarios");
|
|
245
|
+
await mkdir(scenariosDir, { recursive: true });
|
|
246
|
+
await writeFile(path.join(scenariosDir, "recipe-scenario.json"), JSON.stringify({
|
|
247
|
+
schema_version: "1",
|
|
248
|
+
id: "RECIPE_SCENARIO",
|
|
249
|
+
summary: "Recipe scenario",
|
|
250
|
+
goal: "Exercise unsafe archive validation.",
|
|
251
|
+
task_template: {
|
|
252
|
+
title: "Unsafe archive task",
|
|
253
|
+
description: "Validate unsafe archive handling.",
|
|
254
|
+
owner: "CODER",
|
|
255
|
+
},
|
|
256
|
+
inputs: [],
|
|
257
|
+
outputs: [],
|
|
258
|
+
steps: [{ tool: "RECIPE_TOOL" }],
|
|
259
|
+
}, null, 2), "utf8");
|
|
260
|
+
const entryPath = opts.entryPath ?? "../evil.txt";
|
|
261
|
+
await writeFile(path.join(baseDir, "evil.txt"), "evil", "utf8");
|
|
262
|
+
const archivePath = opts.format === "zip" ? path.join(baseDir, "unsafe.zip") : path.join(baseDir, "unsafe.tar.gz");
|
|
263
|
+
if (opts.format === "zip") {
|
|
264
|
+
await execFileAsync("zip", ["-qr", archivePath, ".", entryPath], { cwd: recipeDir });
|
|
265
|
+
return archivePath;
|
|
266
|
+
}
|
|
267
|
+
const tar = buildTar([
|
|
268
|
+
{
|
|
269
|
+
name: "./manifest.json",
|
|
270
|
+
data: Buffer.from(JSON.stringify(manifest, null, 2) + "\n", "utf8"),
|
|
271
|
+
},
|
|
272
|
+
{ name: entryPath, data: Buffer.from("evil\n", "utf8") },
|
|
273
|
+
]);
|
|
274
|
+
const gz = gzipSync(tar);
|
|
275
|
+
await writeFile(archivePath, gz);
|
|
276
|
+
return archivePath;
|
|
277
|
+
}
|
|
278
|
+
function buildTar(entries) {
|
|
279
|
+
const out = [];
|
|
280
|
+
for (const ent of entries) {
|
|
281
|
+
const header = tarHeader({
|
|
282
|
+
name: ent.name,
|
|
283
|
+
size: ent.data.length,
|
|
284
|
+
mtime: 0,
|
|
285
|
+
typeflag: "0",
|
|
286
|
+
});
|
|
287
|
+
out.push(header, ent.data, zeroPadTo512(ent.data.length));
|
|
288
|
+
}
|
|
289
|
+
out.push(Buffer.alloc(1024, 0));
|
|
290
|
+
return Buffer.concat(out);
|
|
291
|
+
}
|
|
292
|
+
function zeroPadTo512(n) {
|
|
293
|
+
const rem = n % 512;
|
|
294
|
+
if (rem === 0)
|
|
295
|
+
return Buffer.alloc(0);
|
|
296
|
+
return Buffer.alloc(512 - rem, 0);
|
|
297
|
+
}
|
|
298
|
+
function tarHeader(opts) {
|
|
299
|
+
const buf = Buffer.alloc(512, 0);
|
|
300
|
+
writeTarString(buf, 0, 100, opts.name);
|
|
301
|
+
writeTarOctal(buf, 100, 8, 0o644);
|
|
302
|
+
writeTarOctal(buf, 108, 8, 0);
|
|
303
|
+
writeTarOctal(buf, 116, 8, 0);
|
|
304
|
+
writeTarOctal(buf, 124, 12, opts.size);
|
|
305
|
+
writeTarOctal(buf, 136, 12, opts.mtime);
|
|
306
|
+
buf.fill(0x20, 148, 156);
|
|
307
|
+
writeTarString(buf, 156, 1, opts.typeflag);
|
|
308
|
+
writeTarString(buf, 257, 6, "ustar");
|
|
309
|
+
writeTarString(buf, 263, 2, "00");
|
|
310
|
+
const sum = buf.reduce((acc, b) => acc + b, 0);
|
|
311
|
+
writeTarChecksum(buf, sum);
|
|
312
|
+
return buf;
|
|
313
|
+
}
|
|
314
|
+
function writeTarString(buf, offset, length, value) {
|
|
315
|
+
const b = Buffer.from(value, "utf8");
|
|
316
|
+
b.copy(buf, offset, 0, Math.min(length, b.length));
|
|
317
|
+
}
|
|
318
|
+
function writeTarOctal(buf, offset, length, value) {
|
|
319
|
+
const raw = Math.max(0, value).toString(8);
|
|
320
|
+
const padded = raw.padStart(length - 1, "0") + "\0";
|
|
321
|
+
writeTarString(buf, offset, length, padded);
|
|
322
|
+
}
|
|
323
|
+
function writeTarChecksum(buf, sum) {
|
|
324
|
+
const raw = Math.max(0, sum).toString(8).padStart(6, "0");
|
|
325
|
+
writeTarString(buf, 148, 8, `${raw}\0 `);
|
|
326
|
+
}
|
|
327
|
+
export async function createUpgradeBundle(files) {
|
|
328
|
+
const manifestUrl = new URL("../../../assets/framework.manifest.json", import.meta.url);
|
|
329
|
+
const manifestText = typeof files["framework.manifest.json"] === "string"
|
|
330
|
+
? files["framework.manifest.json"]
|
|
331
|
+
: await readFile(fileURLToPath(manifestUrl), "utf8");
|
|
332
|
+
const manifest = JSON.parse(manifestText);
|
|
333
|
+
const normalizedFiles = {};
|
|
334
|
+
for (const [relPath, content] of Object.entries(files)) {
|
|
335
|
+
const mapped = relPath.startsWith(".agentplane/agents/")
|
|
336
|
+
? relPath.replace(/^\.agentplane\/agents\//, "agents/")
|
|
337
|
+
: relPath;
|
|
338
|
+
normalizedFiles[mapped] = content;
|
|
339
|
+
}
|
|
340
|
+
normalizedFiles["framework.manifest.json"] ??= manifestText;
|
|
341
|
+
if (manifest.schema_version === 1 && Array.isArray(manifest.files)) {
|
|
342
|
+
for (const entry of manifest.files) {
|
|
343
|
+
if (!entry?.required)
|
|
344
|
+
continue;
|
|
345
|
+
const sourceRel = (entry.source_path ?? entry.path ?? "").trim();
|
|
346
|
+
if (!sourceRel)
|
|
347
|
+
continue;
|
|
348
|
+
if (normalizedFiles[sourceRel] !== undefined)
|
|
349
|
+
continue;
|
|
350
|
+
if (entry.type === "json")
|
|
351
|
+
normalizedFiles[sourceRel] = "{}\n";
|
|
352
|
+
else if (sourceRel.endsWith(".md"))
|
|
353
|
+
normalizedFiles[sourceRel] = "# AGENTS\n";
|
|
354
|
+
else
|
|
355
|
+
normalizedFiles[sourceRel] = "\n";
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
const baseDir = await mkdtemp(path.join(os.tmpdir(), "agentplane-upgrade-bundle-"));
|
|
359
|
+
const bundleDir = path.join(baseDir, "bundle");
|
|
360
|
+
await mkdir(bundleDir, { recursive: true });
|
|
361
|
+
for (const [relPath, content] of Object.entries(normalizedFiles)) {
|
|
362
|
+
const fullPath = path.join(bundleDir, relPath);
|
|
363
|
+
await mkdir(path.dirname(fullPath), { recursive: true });
|
|
364
|
+
await writeFile(fullPath, content, "utf8");
|
|
365
|
+
}
|
|
366
|
+
const bundlePath = path.join(baseDir, "agentplane-upgrade.tar.gz");
|
|
367
|
+
await execFileAsync("tar", ["-czf", bundlePath, "-C", bundleDir, "."]);
|
|
368
|
+
const checksum = createHash("sha256")
|
|
369
|
+
.update(await readFile(bundlePath))
|
|
370
|
+
.digest("hex");
|
|
371
|
+
const checksumPath = `${bundlePath}.sha256`;
|
|
372
|
+
await writeFile(checksumPath, `${checksum} agentplane-upgrade.tar.gz\n`, "utf8");
|
|
373
|
+
return { bundlePath, checksumPath };
|
|
374
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export type AgentJsonEnvelope = {
|
|
2
|
+
schema_version?: number;
|
|
3
|
+
mode?: string;
|
|
4
|
+
command?: string;
|
|
5
|
+
ok?: boolean;
|
|
6
|
+
exit_code?: number;
|
|
7
|
+
stdout?: string;
|
|
8
|
+
stderr?: string;
|
|
9
|
+
data?: unknown;
|
|
10
|
+
};
|
|
11
|
+
export declare function captureStdIO(): {
|
|
12
|
+
readonly stdout: string;
|
|
13
|
+
readonly stderr: string;
|
|
14
|
+
restore(): void;
|
|
15
|
+
};
|
|
16
|
+
export declare function splitOutputLines(text: string): string[];
|
|
17
|
+
export declare function parseAgentJsonEnvelope(stdout: string): AgentJsonEnvelope;
|
|
18
|
+
export declare function expectAgentJsonEnvelope(payload: AgentJsonEnvelope, opts: {
|
|
19
|
+
command: string;
|
|
20
|
+
ok: boolean;
|
|
21
|
+
exitCode: number;
|
|
22
|
+
hasData?: boolean;
|
|
23
|
+
}): void;
|
|
24
|
+
export declare function silenceStdIO(): () => void;
|
|
25
|
+
export declare function runCliSilent(args: string[]): Promise<number>;
|
|
26
|
+
//# sourceMappingURL=stdio.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../../../src/testing/cli-harness/stdio.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,OAAO,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,wBAAgB,YAAY;;;;EAgC3B;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAMvD;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAExE;AAED,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,iBAAiB,EAC1B,IAAI,EAAE;IACJ,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,OAAO,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GACA,IAAI,CAYN;AAED,wBAAgB,YAAY,IAAI,MAAM,IAAI,CAkBzC;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAOlE"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { expect } from "vitest";
|
|
2
|
+
import { runCli } from "../../cli/run-cli.js";
|
|
3
|
+
const originalStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
4
|
+
const originalStderrWrite = process.stderr.write.bind(process.stderr);
|
|
5
|
+
let stdioSilenceDepth = 0;
|
|
6
|
+
export function captureStdIO() {
|
|
7
|
+
let stdout = "";
|
|
8
|
+
let stderr = "";
|
|
9
|
+
const origStdoutWrite = process.stdout.write.bind(process.stdout);
|
|
10
|
+
const origStderrWrite = process.stderr.write.bind(process.stderr);
|
|
11
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
|
+
process.stdout.write = (chunk) => {
|
|
13
|
+
stdout += String(chunk);
|
|
14
|
+
return true;
|
|
15
|
+
};
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
+
process.stderr.write = (chunk) => {
|
|
18
|
+
stderr += String(chunk);
|
|
19
|
+
return true;
|
|
20
|
+
};
|
|
21
|
+
return {
|
|
22
|
+
get stdout() {
|
|
23
|
+
return stdout;
|
|
24
|
+
},
|
|
25
|
+
get stderr() {
|
|
26
|
+
return stderr;
|
|
27
|
+
},
|
|
28
|
+
restore() {
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
|
+
process.stdout.write = origStdoutWrite;
|
|
31
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
32
|
+
process.stderr.write = origStderrWrite;
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export function splitOutputLines(text) {
|
|
37
|
+
return text
|
|
38
|
+
.trim()
|
|
39
|
+
.split(/\r?\n/)
|
|
40
|
+
.map((line) => line.trimEnd())
|
|
41
|
+
.filter(Boolean);
|
|
42
|
+
}
|
|
43
|
+
export function parseAgentJsonEnvelope(stdout) {
|
|
44
|
+
return JSON.parse(stdout);
|
|
45
|
+
}
|
|
46
|
+
export function expectAgentJsonEnvelope(payload, opts) {
|
|
47
|
+
expect(payload.schema_version).toBe(1);
|
|
48
|
+
expect(payload.mode).toBe("agent_json_v1");
|
|
49
|
+
expect(payload.command).toBe(opts.command);
|
|
50
|
+
expect(payload.ok).toBe(opts.ok);
|
|
51
|
+
expect(payload.exit_code).toBe(opts.exitCode);
|
|
52
|
+
expect(Object.keys(payload)).toEqual(opts.hasData
|
|
53
|
+
? ["schema_version", "mode", "command", "ok", "exit_code", "stdout", "stderr", "data"]
|
|
54
|
+
: ["schema_version", "mode", "command", "ok", "exit_code", "stdout", "stderr"]);
|
|
55
|
+
expect(Object.hasOwn(payload, "data")).toBe(opts.hasData ?? false);
|
|
56
|
+
}
|
|
57
|
+
export function silenceStdIO() {
|
|
58
|
+
if (stdioSilenceDepth === 0) {
|
|
59
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
60
|
+
process.stdout.write = () => true;
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
62
|
+
process.stderr.write = () => true;
|
|
63
|
+
}
|
|
64
|
+
stdioSilenceDepth += 1;
|
|
65
|
+
return () => {
|
|
66
|
+
stdioSilenceDepth -= 1;
|
|
67
|
+
if (stdioSilenceDepth <= 0) {
|
|
68
|
+
stdioSilenceDepth = 0;
|
|
69
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
70
|
+
process.stdout.write = originalStdoutWrite;
|
|
71
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
72
|
+
process.stderr.write = originalStderrWrite;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
export async function runCliSilent(args) {
|
|
77
|
+
const io = captureStdIO();
|
|
78
|
+
try {
|
|
79
|
+
return await runCli(args);
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
io.restore();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { defaultConfig } from "@agentplaneorg/core";
|
|
2
|
+
import type { TaskBackend } from "../backends/task-backend.js";
|
|
3
|
+
export * from "./cli-harness/recipe-archives.js";
|
|
4
|
+
export * from "./cli-harness/stdio.js";
|
|
5
|
+
export declare function registerAgentplaneHome(): void;
|
|
6
|
+
export declare function installRunCliIntegrationHarness(): void;
|
|
7
|
+
export declare function getAgentplaneHome(): string | null;
|
|
8
|
+
export declare function stubTaskBackend(overrides?: Partial<TaskBackend>): TaskBackend;
|
|
9
|
+
export declare function mkGitRepoRoot(): Promise<string>;
|
|
10
|
+
export declare function mkTempDir(): Promise<string>;
|
|
11
|
+
export declare function writeDefaultConfig(root: string): Promise<void>;
|
|
12
|
+
export declare function writeAndConfigureRoot(): Promise<string>;
|
|
13
|
+
export declare function approveTaskPlan(root: string, taskId: string): Promise<void>;
|
|
14
|
+
export declare function recordVerificationOk(root: string, taskId: string): Promise<void>;
|
|
15
|
+
export declare function writeConfig(root: string, config: ReturnType<typeof defaultConfig>): Promise<void>;
|
|
16
|
+
export declare function resetAgentplaneHomeRecipes(): Promise<void>;
|
|
17
|
+
export declare function mkGitRepoRootWithBranch(branch: string): Promise<string>;
|
|
18
|
+
export declare function configureGitUser(root: string): Promise<void>;
|
|
19
|
+
export declare function cleanGitEnv(): NodeJS.ProcessEnv;
|
|
20
|
+
export declare function pathExists(filePath: string): Promise<boolean>;
|
|
21
|
+
export declare function gitBranchExists(root: string, branch: string): Promise<boolean>;
|
|
22
|
+
export declare function commitAll(root: string, message: string): Promise<void>;
|
|
23
|
+
export declare function commitPathsIfChanged(root: string, paths: string[], message: string): Promise<boolean>;
|
|
24
|
+
export declare function stageGitignoreIfPresent(root: string): Promise<void>;
|
|
25
|
+
//# sourceMappingURL=cli-harness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli-harness.d.ts","sourceRoot":"","sources":["../../src/testing/cli-harness.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAG/D,cAAc,kCAAkC,CAAC;AACjD,cAAc,wBAAwB,CAAC;AA8CvC,wBAAgB,sBAAsB,IAAI,IAAI,CAuD7C;AAED,wBAAgB,+BAA+B,IAAI,IAAI,CAYtD;AAED,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAEjD;AAED,wBAAgB,eAAe,CAAC,SAAS,GAAE,OAAO,CAAC,WAAW,CAAM,GAAG,WAAW,CAsBjF;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAMrD;AAED,wBAAsB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAIjD;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKpE;AAED,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,MAAM,CAAC,CAI7D;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBjF;AAED,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBtF;AAED,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,GACvC,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,wBAAsB,0BAA0B,IAAI,OAAO,CAAC,IAAI,CAAC,CAKhE;AAED,wBAAsB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAI7E;AAED,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CASlE;AAED,wBAAgB,WAAW,IAAI,MAAM,CAAC,UAAU,CAgB/C;AAED,wBAAsB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOnE;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAYpF;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAM5E;AAED,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,CAAC,CAgBlB;AAED,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIzE"}
|