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,125 @@
|
|
|
1
|
+
import { readFile, stat } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { docChanged, extractTaskDoc, mergeTaskDoc, normalizeTaskDocVersion, parseTaskReadme, renderTaskReadme, } from "@agentplaneorg/core";
|
|
4
|
+
import { taskRecordToData } from "../../../backends/task-backend.js";
|
|
5
|
+
import { exitCodeForError } from "../../../cli/exit-codes.js";
|
|
6
|
+
import { CliError } from "../../../shared/errors.js";
|
|
7
|
+
import { writeTextIfChanged } from "../../../shared/write-if-changed.js";
|
|
8
|
+
import { resolveDocUpdatedBy, taskDataToFrontmatter } from "../task-backend.js";
|
|
9
|
+
function taskReadmePath(ctx, taskId) {
|
|
10
|
+
return path.join(ctx.resolvedProject.gitRoot, ctx.config.paths.workflow_dir, taskId, "README.md");
|
|
11
|
+
}
|
|
12
|
+
export function normalizeTaskRevision(value, fallback = 1) {
|
|
13
|
+
return Number.isInteger(value) && Number(value) > 0 ? Number(value) : fallback;
|
|
14
|
+
}
|
|
15
|
+
export function readStoredTaskRevision(value) {
|
|
16
|
+
return Number.isInteger(value) && Number(value) > 0 ? Number(value) : null;
|
|
17
|
+
}
|
|
18
|
+
export function isConcurrentReadmeChangeError(err) {
|
|
19
|
+
return (err instanceof CliError &&
|
|
20
|
+
err.code === "E_IO" &&
|
|
21
|
+
err.message.startsWith("Task README changed concurrently:"));
|
|
22
|
+
}
|
|
23
|
+
export function throwTaskRevisionConflict(opts) {
|
|
24
|
+
throw new CliError({
|
|
25
|
+
exitCode: exitCodeForError("E_VALIDATION"),
|
|
26
|
+
code: "E_VALIDATION",
|
|
27
|
+
message: `Task revision changed concurrently: ${opts.taskId} ` +
|
|
28
|
+
`(expected revision ${opts.expectedRevision}, current revision ${opts.currentRevision})`,
|
|
29
|
+
context: {
|
|
30
|
+
task_id: opts.taskId,
|
|
31
|
+
expected_revision: opts.expectedRevision,
|
|
32
|
+
current_revision: opts.currentRevision,
|
|
33
|
+
reason_code: "task_revision_conflict",
|
|
34
|
+
},
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
export async function readTaskReadmeCached(opts) {
|
|
38
|
+
const readmePath = taskReadmePath(opts.ctx, opts.taskId);
|
|
39
|
+
let text;
|
|
40
|
+
let st;
|
|
41
|
+
try {
|
|
42
|
+
st = await stat(readmePath);
|
|
43
|
+
text = await readFile(readmePath, "utf8");
|
|
44
|
+
}
|
|
45
|
+
catch (err) {
|
|
46
|
+
const code = err?.code;
|
|
47
|
+
if (code === "ENOENT") {
|
|
48
|
+
throw new CliError({
|
|
49
|
+
exitCode: 4,
|
|
50
|
+
code: "E_IO",
|
|
51
|
+
message: `ENOENT: no such file or directory, open '${readmePath}'`,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
throw err;
|
|
55
|
+
}
|
|
56
|
+
const parsed = parseTaskReadme(text);
|
|
57
|
+
const task = taskRecordToData({
|
|
58
|
+
id: opts.taskId,
|
|
59
|
+
frontmatter: parsed.frontmatter,
|
|
60
|
+
body: parsed.body,
|
|
61
|
+
readmePath,
|
|
62
|
+
});
|
|
63
|
+
return { task, readmePath, mtimeMs: st.mtimeMs, parsed, rawText: text };
|
|
64
|
+
}
|
|
65
|
+
export async function ensureUnchangedOnDisk(opts) {
|
|
66
|
+
const st = await stat(opts.readmePath);
|
|
67
|
+
if (st.mtimeMs !== opts.expectedMtimeMs) {
|
|
68
|
+
throw new CliError({
|
|
69
|
+
exitCode: exitCodeForError("E_IO"),
|
|
70
|
+
code: "E_IO",
|
|
71
|
+
message: `Task README changed concurrently: ${opts.readmePath}`,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
export async function didReadmeChangeOnDisk(opts) {
|
|
76
|
+
try {
|
|
77
|
+
const st = await stat(opts.readmePath);
|
|
78
|
+
return st.mtimeMs !== opts.expectedMtimeMs;
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
const code = err?.code;
|
|
82
|
+
if (code === "ENOENT")
|
|
83
|
+
return true;
|
|
84
|
+
throw err;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
export async function writeTaskReadme(opts) {
|
|
88
|
+
const { entry, next } = opts;
|
|
89
|
+
const frontmatter = { ...entry.parsed.frontmatter, ...taskDataToFrontmatter(next) };
|
|
90
|
+
let body = entry.parsed.body ?? "";
|
|
91
|
+
const existingDoc = extractTaskDoc(body);
|
|
92
|
+
const now = new Date().toISOString();
|
|
93
|
+
const currentDocVersion = normalizeTaskDocVersion(entry.parsed.frontmatter.doc_version);
|
|
94
|
+
const requestedDocVersion = normalizeTaskDocVersion(next.doc_version, currentDocVersion);
|
|
95
|
+
if (next.doc !== undefined) {
|
|
96
|
+
const nextDoc = String(next.doc ?? "");
|
|
97
|
+
body = mergeTaskDoc(body, nextDoc);
|
|
98
|
+
if (docChanged(existingDoc, nextDoc) || !frontmatter.doc_updated_at) {
|
|
99
|
+
frontmatter.doc_version = requestedDocVersion;
|
|
100
|
+
frontmatter.doc_updated_at = now;
|
|
101
|
+
frontmatter.doc_updated_by = resolveDocUpdatedBy(next);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
frontmatter.doc_version = normalizeTaskDocVersion(frontmatter.doc_version, requestedDocVersion);
|
|
105
|
+
if (typeof frontmatter.doc_updated_at !== "string" || frontmatter.doc_updated_at.trim() === "") {
|
|
106
|
+
frontmatter.doc_updated_at = now;
|
|
107
|
+
}
|
|
108
|
+
if (typeof frontmatter.doc_updated_by !== "string" || frontmatter.doc_updated_by.trim() === "") {
|
|
109
|
+
frontmatter.doc_updated_by = resolveDocUpdatedBy(next);
|
|
110
|
+
}
|
|
111
|
+
const storedRevision = readStoredTaskRevision(entry.parsed.frontmatter.revision);
|
|
112
|
+
frontmatter.revision = storedRevision ?? 1;
|
|
113
|
+
let nextText = renderTaskReadme(frontmatter, body);
|
|
114
|
+
nextText = nextText.endsWith("\n") ? nextText : `${nextText}\n`;
|
|
115
|
+
if (storedRevision !== null && nextText !== entry.rawText) {
|
|
116
|
+
frontmatter.revision = storedRevision + 1;
|
|
117
|
+
nextText = renderTaskReadme(frontmatter, body);
|
|
118
|
+
nextText = nextText.endsWith("\n") ? nextText : `${nextText}\n`;
|
|
119
|
+
}
|
|
120
|
+
await ensureUnchangedOnDisk({
|
|
121
|
+
readmePath: entry.readmePath,
|
|
122
|
+
expectedMtimeMs: entry.mtimeMs,
|
|
123
|
+
});
|
|
124
|
+
return await writeTextIfChanged(entry.readmePath, nextText);
|
|
125
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { TaskData } from "../../../backends/task-backend.js";
|
|
2
|
+
import type { TaskStore as TaskStoreContract, TaskStoreContext, TaskStoreIntentResult, TaskStoreMutationOptions, TaskStorePatch } from "./types.js";
|
|
3
|
+
export declare class TaskStore implements TaskStoreContract {
|
|
4
|
+
private ctx;
|
|
5
|
+
private cache;
|
|
6
|
+
constructor(ctx: TaskStoreContext);
|
|
7
|
+
get(taskId: string): Promise<TaskData>;
|
|
8
|
+
update(taskId: string, updater: (current: TaskData) => Promise<TaskData> | TaskData, opts?: TaskStoreMutationOptions): Promise<{
|
|
9
|
+
changed: boolean;
|
|
10
|
+
task: TaskData;
|
|
11
|
+
}>;
|
|
12
|
+
patch(taskId: string, builder: (current: TaskData) => Promise<TaskStorePatch | null | undefined> | TaskStorePatch | null | undefined, opts?: TaskStoreMutationOptions): Promise<{
|
|
13
|
+
changed: boolean;
|
|
14
|
+
task: TaskData;
|
|
15
|
+
}>;
|
|
16
|
+
mutate(taskId: string, builder: (current: TaskData) => Promise<TaskStoreIntentResult> | TaskStoreIntentResult, opts?: TaskStoreMutationOptions): Promise<{
|
|
17
|
+
changed: boolean;
|
|
18
|
+
task: TaskData;
|
|
19
|
+
}>;
|
|
20
|
+
private getCached;
|
|
21
|
+
private runWithRetry;
|
|
22
|
+
private writeNextTask;
|
|
23
|
+
}
|
|
24
|
+
export declare function getTaskStore(ctx: TaskStoreContext): TaskStore;
|
|
25
|
+
export declare function backendIsLocalFileBackend(ctx: TaskStoreContext): boolean;
|
|
26
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../../src/commands/shared/task-store/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAiBlE,OAAO,KAAK,EAEV,SAAS,IAAI,iBAAiB,EAC9B,gBAAgB,EAChB,qBAAqB,EACrB,wBAAwB,EACxB,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,qBAAa,SAAU,YAAW,iBAAiB;IACjD,OAAO,CAAC,GAAG,CAAmB;IAC9B,OAAO,CAAC,KAAK,CAA0C;gBAE3C,GAAG,EAAE,gBAAgB;IAI3B,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAKtC,MAAM,CACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,EAC5D,IAAI,GAAE,wBAA6B,GAClC,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAC;IAM1C,KAAK,CACT,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,CACP,OAAO,EAAE,QAAQ,KACd,OAAO,CAAC,cAAc,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,cAAc,GAAG,IAAI,GAAG,SAAS,EACnF,IAAI,GAAE,wBAA6B,GAClC,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAC;IAQ1C,MAAM,CACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,qBAAqB,CAAC,GAAG,qBAAqB,EACtF,IAAI,GAAE,wBAA6B,GAClC,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAC;YAOlC,SAAS;YAmBT,YAAY;YAiDZ,aAAa;CAgB5B;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,gBAAgB,GAAG,SAAS,CAI7D;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAExE"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { exitCodeForError } from "../../../cli/exit-codes.js";
|
|
2
|
+
import { CliError } from "../../../shared/errors.js";
|
|
3
|
+
import { backendUsesLocalTaskStore } from "../task-backend.js";
|
|
4
|
+
import { applyTaskStoreIntents, resolveTaskStoreIntents, resolveTaskStorePatch, } from "./intents.js";
|
|
5
|
+
import { didReadmeChangeOnDisk, isConcurrentReadmeChangeError, normalizeTaskRevision, readTaskReadmeCached, throwTaskRevisionConflict, writeTaskReadme, } from "./readme.js";
|
|
6
|
+
export class TaskStore {
|
|
7
|
+
ctx;
|
|
8
|
+
cache = new Map();
|
|
9
|
+
constructor(ctx) {
|
|
10
|
+
this.ctx = ctx;
|
|
11
|
+
}
|
|
12
|
+
async get(taskId) {
|
|
13
|
+
const entry = await this.getCached(taskId);
|
|
14
|
+
return entry.task;
|
|
15
|
+
}
|
|
16
|
+
async update(taskId, updater, opts = {}) {
|
|
17
|
+
return await this.runWithRetry(taskId, opts, async (entry) => {
|
|
18
|
+
return await updater({ ...entry.task });
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
async patch(taskId, builder, opts = {}) {
|
|
22
|
+
return await this.mutate(taskId, async (current) => resolveTaskStorePatch(await builder(current)), opts);
|
|
23
|
+
}
|
|
24
|
+
async mutate(taskId, builder, opts = {}) {
|
|
25
|
+
return await this.runWithRetry(taskId, opts, async (entry) => {
|
|
26
|
+
const intents = resolveTaskStoreIntents(await builder({ ...entry.task }));
|
|
27
|
+
return applyTaskStoreIntents(entry, intents);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async getCached(taskId) {
|
|
31
|
+
const key = taskId.trim();
|
|
32
|
+
if (!key) {
|
|
33
|
+
throw new CliError({
|
|
34
|
+
exitCode: exitCodeForError("E_USAGE"),
|
|
35
|
+
code: "E_USAGE",
|
|
36
|
+
message: "task id is required",
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const existing = this.cache.get(key);
|
|
40
|
+
if (existing)
|
|
41
|
+
return await existing;
|
|
42
|
+
const load = (async () => {
|
|
43
|
+
return await readTaskReadmeCached({ ctx: this.ctx, taskId: key });
|
|
44
|
+
})();
|
|
45
|
+
this.cache.set(key, load);
|
|
46
|
+
return await load;
|
|
47
|
+
}
|
|
48
|
+
async runWithRetry(taskId, opts, computeNext) {
|
|
49
|
+
for (let attempt = 0; attempt < 2; attempt++) {
|
|
50
|
+
const entry = await this.getCached(taskId);
|
|
51
|
+
if (opts.expectedRevision !== undefined) {
|
|
52
|
+
const expectedRevision = normalizeTaskRevision(opts.expectedRevision);
|
|
53
|
+
const currentRevision = normalizeTaskRevision(entry.task.revision);
|
|
54
|
+
if (currentRevision !== expectedRevision) {
|
|
55
|
+
throwTaskRevisionConflict({ taskId, expectedRevision, currentRevision });
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
let next;
|
|
59
|
+
try {
|
|
60
|
+
next = await computeNext(entry);
|
|
61
|
+
}
|
|
62
|
+
catch (err) {
|
|
63
|
+
if (attempt === 0 &&
|
|
64
|
+
err instanceof CliError &&
|
|
65
|
+
err.code === "E_VALIDATION" &&
|
|
66
|
+
(await didReadmeChangeOnDisk({
|
|
67
|
+
readmePath: entry.readmePath,
|
|
68
|
+
expectedMtimeMs: entry.mtimeMs,
|
|
69
|
+
}))) {
|
|
70
|
+
this.cache.delete(taskId);
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
throw err;
|
|
74
|
+
}
|
|
75
|
+
try {
|
|
76
|
+
return await this.writeNextTask(taskId, entry, next);
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
if (attempt === 0 && isConcurrentReadmeChangeError(err)) {
|
|
80
|
+
this.cache.delete(taskId);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
83
|
+
throw err;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const task = await this.get(taskId);
|
|
87
|
+
return { changed: false, task };
|
|
88
|
+
}
|
|
89
|
+
async writeNextTask(taskId, entry, next) {
|
|
90
|
+
const changed = await writeTaskReadme({ entry, next });
|
|
91
|
+
this.cache.set(taskId, (async () => {
|
|
92
|
+
return await readTaskReadmeCached({ ctx: this.ctx, taskId });
|
|
93
|
+
})());
|
|
94
|
+
const updated = await this.get(taskId);
|
|
95
|
+
return { changed, task: updated };
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
export function getTaskStore(ctx) {
|
|
99
|
+
const memo = ctx.memo;
|
|
100
|
+
memo.taskStore ??= new TaskStore(ctx);
|
|
101
|
+
return memo.taskStore;
|
|
102
|
+
}
|
|
103
|
+
export function backendIsLocalFileBackend(ctx) {
|
|
104
|
+
return backendUsesLocalTaskStore(ctx);
|
|
105
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { ParsedTaskReadme } from "@agentplaneorg/core";
|
|
2
|
+
import type { TaskData, TaskEvent } from "../../../backends/task-backend.js";
|
|
3
|
+
import type { CommandContext } from "../task-backend.js";
|
|
4
|
+
export type CachedTask = {
|
|
5
|
+
task: TaskData;
|
|
6
|
+
readmePath: string;
|
|
7
|
+
mtimeMs: number;
|
|
8
|
+
parsed: ParsedTaskReadme;
|
|
9
|
+
rawText: string;
|
|
10
|
+
};
|
|
11
|
+
export type TaskComment = NonNullable<TaskData["comments"]>[number];
|
|
12
|
+
export type TaskDocState = {
|
|
13
|
+
comments: TaskData["comments"] | null;
|
|
14
|
+
doc: string;
|
|
15
|
+
doc_updated_at?: string;
|
|
16
|
+
doc_updated_by?: string;
|
|
17
|
+
doc_version: 2 | 3;
|
|
18
|
+
owner: string;
|
|
19
|
+
sections?: TaskData["sections"] | null;
|
|
20
|
+
};
|
|
21
|
+
export type TaskStoreTaskPatch = Partial<Omit<TaskData, "doc" | "comments" | "events" | "doc_version" | "doc_updated_at" | "doc_updated_by">>;
|
|
22
|
+
export type TaskStoreDocPatch = {
|
|
23
|
+
kind: "replace-doc";
|
|
24
|
+
doc: string;
|
|
25
|
+
expectedCurrentDoc?: string | null;
|
|
26
|
+
} | {
|
|
27
|
+
kind: "set-section";
|
|
28
|
+
section: string;
|
|
29
|
+
text: string;
|
|
30
|
+
requiredSections: string[];
|
|
31
|
+
expectedCurrentText?: string | null;
|
|
32
|
+
};
|
|
33
|
+
export type TaskStorePatch = {
|
|
34
|
+
task?: TaskStoreTaskPatch;
|
|
35
|
+
appendComments?: TaskComment[];
|
|
36
|
+
appendEvents?: TaskEvent[];
|
|
37
|
+
doc?: TaskStoreDocPatch;
|
|
38
|
+
docMeta?: {
|
|
39
|
+
touch?: boolean;
|
|
40
|
+
updatedBy?: string;
|
|
41
|
+
version?: 2 | 3;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
export type TaskStoreIntent = {
|
|
45
|
+
kind: "set-task-fields";
|
|
46
|
+
task: TaskStoreTaskPatch;
|
|
47
|
+
} | {
|
|
48
|
+
kind: "append-comments";
|
|
49
|
+
comments: TaskComment[];
|
|
50
|
+
} | {
|
|
51
|
+
kind: "append-events";
|
|
52
|
+
events: TaskEvent[];
|
|
53
|
+
} | {
|
|
54
|
+
kind: "replace-doc";
|
|
55
|
+
doc: string;
|
|
56
|
+
expectedCurrentDoc?: string | null;
|
|
57
|
+
} | {
|
|
58
|
+
kind: "set-section";
|
|
59
|
+
section: string;
|
|
60
|
+
text: string;
|
|
61
|
+
requiredSections: string[];
|
|
62
|
+
expectedCurrentText?: string | null;
|
|
63
|
+
} | {
|
|
64
|
+
kind: "touch-doc-meta";
|
|
65
|
+
updatedBy?: string;
|
|
66
|
+
version?: 2 | 3;
|
|
67
|
+
};
|
|
68
|
+
export type TaskStoreIntentResult = TaskStoreIntent | readonly TaskStoreIntent[] | null | undefined;
|
|
69
|
+
export type TaskStoreMutationOptions = {
|
|
70
|
+
expectedRevision?: number;
|
|
71
|
+
};
|
|
72
|
+
export type TaskStoreLike = Pick<TaskStore, "patch"> & {
|
|
73
|
+
mutate?: TaskStore["mutate"];
|
|
74
|
+
};
|
|
75
|
+
export type TaskStoreReader = {
|
|
76
|
+
get(taskId: string): Promise<TaskData>;
|
|
77
|
+
};
|
|
78
|
+
export interface TaskStore {
|
|
79
|
+
get(taskId: string): Promise<TaskData>;
|
|
80
|
+
update(taskId: string, updater: (current: TaskData) => Promise<TaskData> | TaskData, opts?: TaskStoreMutationOptions): Promise<{
|
|
81
|
+
changed: boolean;
|
|
82
|
+
task: TaskData;
|
|
83
|
+
}>;
|
|
84
|
+
patch(taskId: string, builder: (current: TaskData) => Promise<TaskStorePatch | null | undefined> | TaskStorePatch | null | undefined, opts?: TaskStoreMutationOptions): Promise<{
|
|
85
|
+
changed: boolean;
|
|
86
|
+
task: TaskData;
|
|
87
|
+
}>;
|
|
88
|
+
mutate(taskId: string, builder: (current: TaskData) => Promise<TaskStoreIntentResult> | TaskStoreIntentResult, opts?: TaskStoreMutationOptions): Promise<{
|
|
89
|
+
changed: boolean;
|
|
90
|
+
task: TaskData;
|
|
91
|
+
}>;
|
|
92
|
+
}
|
|
93
|
+
export type TaskStoreContext = CommandContext;
|
|
94
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/commands/shared/task-store/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,110 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export type TaskStoreTaskPatch = Partial<Omit<TaskData, "doc" | "comments" | "events" | "doc_version" | "doc_updated_at" | "doc_updated_by">>;
|
|
5
|
-
export type TaskStoreDocPatch = {
|
|
6
|
-
kind: "replace-doc";
|
|
7
|
-
doc: string;
|
|
8
|
-
expectedCurrentDoc?: string | null;
|
|
9
|
-
} | {
|
|
10
|
-
kind: "set-section";
|
|
11
|
-
section: string;
|
|
12
|
-
text: string;
|
|
13
|
-
requiredSections: string[];
|
|
14
|
-
expectedCurrentText?: string | null;
|
|
15
|
-
};
|
|
16
|
-
export type TaskStorePatch = {
|
|
17
|
-
task?: TaskStoreTaskPatch;
|
|
18
|
-
appendComments?: TaskComment[];
|
|
19
|
-
appendEvents?: TaskEvent[];
|
|
20
|
-
doc?: TaskStoreDocPatch;
|
|
21
|
-
docMeta?: {
|
|
22
|
-
touch?: boolean;
|
|
23
|
-
updatedBy?: string;
|
|
24
|
-
version?: 2 | 3;
|
|
25
|
-
};
|
|
26
|
-
};
|
|
27
|
-
export type TaskStoreIntent = {
|
|
28
|
-
kind: "set-task-fields";
|
|
29
|
-
task: TaskStoreTaskPatch;
|
|
30
|
-
} | {
|
|
31
|
-
kind: "append-comments";
|
|
32
|
-
comments: TaskComment[];
|
|
33
|
-
} | {
|
|
34
|
-
kind: "append-events";
|
|
35
|
-
events: TaskEvent[];
|
|
36
|
-
} | {
|
|
37
|
-
kind: "replace-doc";
|
|
38
|
-
doc: string;
|
|
39
|
-
expectedCurrentDoc?: string | null;
|
|
40
|
-
} | {
|
|
41
|
-
kind: "set-section";
|
|
42
|
-
section: string;
|
|
43
|
-
text: string;
|
|
44
|
-
requiredSections: string[];
|
|
45
|
-
expectedCurrentText?: string | null;
|
|
46
|
-
} | {
|
|
47
|
-
kind: "touch-doc-meta";
|
|
48
|
-
updatedBy?: string;
|
|
49
|
-
version?: 2 | 3;
|
|
50
|
-
};
|
|
51
|
-
export type TaskStoreIntentResult = TaskStoreIntent | readonly TaskStoreIntent[] | null | undefined;
|
|
52
|
-
export type TaskStoreMutationOptions = {
|
|
53
|
-
expectedRevision?: number;
|
|
54
|
-
};
|
|
55
|
-
export type TaskStoreLike = Pick<TaskStore, "patch"> & {
|
|
56
|
-
mutate?: TaskStore["mutate"];
|
|
57
|
-
};
|
|
58
|
-
export declare function setTaskFieldsIntent(task: TaskStoreTaskPatch): TaskStoreIntent;
|
|
59
|
-
export declare function appendTaskCommentsIntent(comments: TaskComment[]): TaskStoreIntent;
|
|
60
|
-
export declare function appendTaskCommentIntent(comment: TaskComment): TaskStoreIntent;
|
|
61
|
-
export declare function appendTaskEventsIntent(events: TaskEvent[]): TaskStoreIntent;
|
|
62
|
-
export declare function appendTaskEventIntent(event: TaskEvent): TaskStoreIntent;
|
|
63
|
-
export declare function replaceTaskDocIntent(opts: {
|
|
64
|
-
doc: string;
|
|
65
|
-
expectedCurrentDoc?: string | null;
|
|
66
|
-
}): TaskStoreIntent;
|
|
67
|
-
export declare function setTaskSectionIntent(opts: {
|
|
68
|
-
section: string;
|
|
69
|
-
text: string;
|
|
70
|
-
requiredSections: string[];
|
|
71
|
-
expectedCurrentText?: string | null;
|
|
72
|
-
}): TaskStoreIntent;
|
|
73
|
-
export declare function touchTaskDocMetaIntent(opts?: {
|
|
74
|
-
updatedBy?: string;
|
|
75
|
-
version?: 2 | 3;
|
|
76
|
-
}): TaskStoreIntent;
|
|
77
|
-
export declare function taskStorePatchFromIntents(intents: TaskStoreIntentResult): TaskStorePatch | null | undefined;
|
|
78
|
-
export declare function mutateTaskStore(store: TaskStoreLike, taskId: string, builder: (current: TaskData) => Promise<TaskStoreIntentResult> | TaskStoreIntentResult, opts?: TaskStoreMutationOptions): Promise<{
|
|
79
|
-
changed: boolean;
|
|
80
|
-
task: TaskData;
|
|
81
|
-
}>;
|
|
82
|
-
export declare function applyTaskStoreIntentsToTask(task: TaskData, intents: TaskStoreIntentResult, opts?: {
|
|
83
|
-
currentDocVersion?: 2 | 3;
|
|
84
|
-
docUpdatedAt?: string;
|
|
85
|
-
}): TaskData;
|
|
86
|
-
export declare class TaskStore {
|
|
87
|
-
private ctx;
|
|
88
|
-
private cache;
|
|
89
|
-
constructor(ctx: CommandContext);
|
|
90
|
-
get(taskId: string): Promise<TaskData>;
|
|
91
|
-
private getCached;
|
|
92
|
-
update(taskId: string, updater: (current: TaskData) => Promise<TaskData> | TaskData, opts?: TaskStoreMutationOptions): Promise<{
|
|
93
|
-
changed: boolean;
|
|
94
|
-
task: TaskData;
|
|
95
|
-
}>;
|
|
96
|
-
patch(taskId: string, builder: (current: TaskData) => Promise<TaskStorePatch | null | undefined> | TaskStorePatch | null | undefined, opts?: TaskStoreMutationOptions): Promise<{
|
|
97
|
-
changed: boolean;
|
|
98
|
-
task: TaskData;
|
|
99
|
-
}>;
|
|
100
|
-
mutate(taskId: string, builder: (current: TaskData) => Promise<TaskStoreIntentResult> | TaskStoreIntentResult, opts?: TaskStoreMutationOptions): Promise<{
|
|
101
|
-
changed: boolean;
|
|
102
|
-
task: TaskData;
|
|
103
|
-
}>;
|
|
104
|
-
private runWithRetry;
|
|
105
|
-
private writeNextTask;
|
|
106
|
-
}
|
|
107
|
-
export declare function getTaskStore(ctx: CommandContext): TaskStore;
|
|
108
|
-
export declare function backendIsLocalFileBackend(ctx: CommandContext): boolean;
|
|
109
|
-
export {};
|
|
1
|
+
export type { TaskStoreDocPatch, TaskStoreIntent, TaskStoreIntentResult, TaskStoreLike, TaskStoreMutationOptions, TaskStorePatch, TaskStoreTaskPatch, } from "./task-store/types.js";
|
|
2
|
+
export { appendTaskCommentIntent, appendTaskCommentsIntent, appendTaskEventIntent, appendTaskEventsIntent, applyTaskStoreIntentsToTask, mutateTaskStore, replaceTaskDocIntent, setTaskFieldsIntent, setTaskSectionIntent, taskStorePatchFromIntents, touchTaskDocMetaIntent, } from "./task-store/intents.js";
|
|
3
|
+
export { TaskStore, backendIsLocalFileBackend, getTaskStore } from "./task-store/store.js";
|
|
110
4
|
//# sourceMappingURL=task-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-store.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"task-store.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-store.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,iBAAiB,EACjB,eAAe,EACf,qBAAqB,EACrB,aAAa,EACb,wBAAwB,EACxB,cAAc,EACd,kBAAkB,GACnB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,qBAAqB,EACrB,sBAAsB,EACtB,2BAA2B,EAC3B,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,EACzB,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,SAAS,EAAE,yBAAyB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC"}
|