takt 0.49.0 → 0.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/builtins/en/config.yaml +6 -0
- package/builtins/en/facets/instructions/ai-antipattern-review.md +5 -0
- package/builtins/en/facets/instructions/findings-manager.md +6 -2
- package/builtins/en/facets/instructions/loop-monitor-fix-replan.md +21 -0
- package/builtins/en/facets/instructions/loop-monitor-replan.md +10 -0
- package/builtins/en/facets/instructions/plan-maintenance.md +10 -7
- package/builtins/en/facets/instructions/plan.md +17 -8
- package/builtins/en/facets/instructions/review-arch.md +5 -0
- package/builtins/en/facets/instructions/review-coding.md +15 -6
- package/builtins/en/facets/instructions/review-cqrs-es.md +9 -0
- package/builtins/en/facets/instructions/review-implementation-semantics.md +18 -0
- package/builtins/en/facets/instructions/review-merge-readiness.md +14 -0
- package/builtins/en/facets/instructions/supervise-maintenance.md +2 -2
- package/builtins/en/facets/instructions/supervise.md +8 -3
- package/builtins/en/facets/instructions/write-tests-first.md +23 -3
- package/builtins/en/facets/knowledge/architecture.md +25 -0
- package/builtins/en/facets/knowledge/cqrs-es.md +718 -235
- package/builtins/en/facets/knowledge/implementation-semantics.md +104 -0
- package/builtins/en/facets/knowledge/takt.md +10 -2
- package/builtins/en/facets/knowledge/unit-testing.md +14 -0
- package/builtins/en/facets/output-contracts/ai-antipattern-review.md +11 -1
- package/builtins/en/facets/output-contracts/architecture-review.md +6 -1
- package/builtins/en/facets/output-contracts/coding-review.md +11 -1
- package/builtins/en/facets/output-contracts/findings-manager.md +14 -0
- package/builtins/en/facets/output-contracts/implementation-semantics-review-finding-contract.md +28 -0
- package/builtins/en/facets/output-contracts/implementation-semantics-review.md +50 -0
- package/builtins/en/facets/output-contracts/{pure-review-finding-contract.md → merge-readiness-review-finding-contract.md} +14 -8
- package/builtins/en/facets/output-contracts/{pure-review.md → merge-readiness-review.md} +17 -11
- package/builtins/en/facets/output-contracts/supervisor-validation.md +6 -2
- package/builtins/en/facets/output-contracts/test-report.md +25 -0
- package/builtins/en/facets/personas/implementation-semantics-reviewer.md +27 -0
- package/builtins/en/facets/personas/merge-readiness-reviewer.md +28 -0
- package/builtins/en/facets/personas/supervisor.md +1 -1
- package/builtins/en/facets/policies/ai-antipattern.md +18 -0
- package/builtins/en/facets/policies/review.md +15 -0
- package/builtins/en/facets/policies/testing.md +3 -2
- package/builtins/en/workflow-categories.yaml +13 -1
- package/builtins/en/workflows/audit-architecture-backend.yaml +1 -0
- package/builtins/en/workflows/audit-architecture-dual.yaml +1 -0
- package/builtins/en/workflows/audit-architecture-frontend.yaml +1 -0
- package/builtins/en/workflows/audit-architecture.yaml +1 -0
- package/builtins/en/workflows/audit-e2e.yaml +1 -0
- package/builtins/en/workflows/audit-security.yaml +1 -0
- package/builtins/en/workflows/audit-unit.yaml +1 -0
- package/builtins/en/workflows/backend-cqrs-for-local-llm.yaml +288 -0
- package/builtins/en/workflows/backend-cqrs-mini.yaml +1 -0
- package/builtins/en/workflows/backend-cqrs.yaml +28 -84
- package/builtins/en/workflows/backend-for-local-llm.yaml +284 -0
- package/builtins/en/workflows/backend-maintenance.yaml +32 -89
- package/builtins/en/workflows/backend-mini.yaml +1 -0
- package/builtins/en/workflows/backend.yaml +25 -83
- package/builtins/en/workflows/{takt-default-with-fc.yaml → cli.yaml} +16 -4
- package/builtins/en/workflows/deep-research.yaml +1 -0
- package/builtins/en/workflows/default-high.yaml +3 -32
- package/builtins/en/workflows/default-peer-review.yaml +16 -52
- package/builtins/en/workflows/default.yaml +2 -1
- package/builtins/en/workflows/dual-cqrs-mini.yaml +1 -0
- package/builtins/en/workflows/dual-cqrs.yaml +28 -87
- package/builtins/en/workflows/dual-for-local-llm.yaml +312 -0
- package/builtins/en/workflows/dual-mini.yaml +1 -0
- package/builtins/en/workflows/dual.yaml +29 -57
- package/builtins/en/workflows/frontend-for-local-llm.yaml +289 -0
- package/builtins/en/workflows/frontend-maintenance.yaml +34 -91
- package/builtins/en/workflows/frontend-mini.yaml +1 -0
- package/builtins/en/workflows/frontend.yaml +27 -85
- package/builtins/en/workflows/merge-readiness-dual-final-gate.yaml +92 -0
- package/builtins/en/workflows/merge-readiness-final-gate.yaml +79 -0
- package/builtins/en/workflows/{peer-review-with-fc.yaml → peer-review-for-local-llm.yaml} +48 -37
- package/builtins/en/workflows/peer-review.yaml +25 -20
- package/builtins/en/workflows/research.yaml +1 -0
- package/builtins/en/workflows/review-backend-cqrs.yaml +63 -35
- package/builtins/en/workflows/review-backend.yaml +63 -35
- package/builtins/en/workflows/review-default.yaml +138 -107
- package/builtins/en/workflows/review-dual-cqrs.yaml +63 -35
- package/builtins/en/workflows/review-dual.yaml +63 -35
- package/builtins/en/workflows/review-fix-backend-cqrs.yaml +27 -87
- package/builtins/en/workflows/review-fix-backend.yaml +25 -86
- package/builtins/en/workflows/review-fix-default.yaml +17 -87
- package/builtins/en/workflows/review-fix-dual-cqrs.yaml +29 -90
- package/builtins/en/workflows/review-fix-dual.yaml +27 -89
- package/builtins/en/workflows/review-fix-frontend.yaml +25 -87
- package/builtins/en/workflows/review-fix-takt-default.yaml +67 -362
- package/builtins/en/workflows/review-frontend.yaml +63 -35
- package/builtins/en/workflows/review-takt-default.yaml +140 -109
- package/builtins/en/workflows/takt-default-for-local-llm.yaml +283 -0
- package/builtins/en/workflows/takt-default-refresh-all.yaml +20 -58
- package/builtins/en/workflows/takt-default-refresh-fast.yaml +19 -56
- package/builtins/en/workflows/takt-default.yaml +3 -25
- package/builtins/en/workflows/terraform.yaml +81 -44
- package/builtins/ja/config.yaml +6 -0
- package/builtins/ja/facets/instructions/ai-antipattern-review.md +5 -0
- package/builtins/ja/facets/instructions/findings-manager.md +6 -2
- package/builtins/ja/facets/instructions/implement-maintenance.md +4 -15
- package/builtins/ja/facets/instructions/implement.md +2 -14
- package/builtins/ja/facets/instructions/loop-monitor-fix-replan.md +21 -0
- package/builtins/ja/facets/instructions/loop-monitor-replan.md +10 -0
- package/builtins/ja/facets/instructions/plan-maintenance.md +10 -7
- package/builtins/ja/facets/instructions/plan.md +9 -6
- package/builtins/ja/facets/instructions/review-arch.md +5 -0
- package/builtins/ja/facets/instructions/review-coding.md +15 -6
- package/builtins/ja/facets/instructions/review-cqrs-es.md +9 -0
- package/builtins/ja/facets/instructions/review-implementation-semantics.md +17 -0
- package/builtins/ja/facets/instructions/review-merge-readiness.md +14 -0
- package/builtins/ja/facets/instructions/supervise-maintenance.md +2 -2
- package/builtins/ja/facets/instructions/supervise.md +8 -3
- package/builtins/ja/facets/instructions/write-tests-first.md +23 -3
- package/builtins/ja/facets/knowledge/architecture.md +25 -0
- package/builtins/ja/facets/knowledge/cqrs-es.md +211 -16
- package/builtins/ja/facets/knowledge/implementation-semantics.md +104 -0
- package/builtins/ja/facets/knowledge/takt.md +10 -2
- package/builtins/ja/facets/knowledge/unit-testing.md +14 -0
- package/builtins/ja/facets/output-contracts/ai-antipattern-review.md +11 -1
- package/builtins/ja/facets/output-contracts/architecture-review.md +6 -1
- package/builtins/ja/facets/output-contracts/coding-review.md +11 -1
- package/builtins/ja/facets/output-contracts/findings-manager.md +14 -0
- package/builtins/ja/facets/output-contracts/implementation-semantics-review-finding-contract.md +24 -0
- package/builtins/ja/facets/output-contracts/implementation-semantics-review.md +50 -0
- package/builtins/ja/facets/output-contracts/{pure-review-finding-contract.md → merge-readiness-review-finding-contract.md} +14 -8
- package/builtins/ja/facets/output-contracts/{pure-review.md → merge-readiness-review.md} +17 -11
- package/builtins/ja/facets/output-contracts/supervisor-validation.md +6 -2
- package/builtins/ja/facets/output-contracts/test-report.md +25 -0
- package/builtins/ja/facets/partials/instructions/implement-common.md +13 -0
- package/builtins/ja/facets/personas/implementation-semantics-reviewer.md +27 -0
- package/builtins/ja/facets/personas/merge-readiness-reviewer.md +28 -0
- package/builtins/ja/facets/personas/supervisor.md +1 -1
- package/builtins/ja/facets/policies/ai-antipattern.md +18 -0
- package/builtins/ja/facets/policies/coding.md +1 -0
- package/builtins/ja/facets/policies/review.md +15 -0
- package/builtins/ja/facets/policies/testing.md +8 -4
- package/builtins/ja/workflow-categories.yaml +13 -1
- package/builtins/ja/workflows/audit-architecture-backend.yaml +1 -0
- package/builtins/ja/workflows/audit-architecture-dual.yaml +1 -0
- package/builtins/ja/workflows/audit-architecture-frontend.yaml +1 -0
- package/builtins/ja/workflows/audit-architecture.yaml +1 -0
- package/builtins/ja/workflows/audit-e2e.yaml +1 -0
- package/builtins/ja/workflows/audit-security.yaml +1 -0
- package/builtins/ja/workflows/audit-unit.yaml +1 -0
- package/builtins/ja/workflows/backend-cqrs-for-local-llm.yaml +287 -0
- package/builtins/ja/workflows/backend-cqrs-mini.yaml +1 -0
- package/builtins/ja/workflows/backend-cqrs.yaml +28 -84
- package/builtins/ja/workflows/backend-for-local-llm.yaml +283 -0
- package/builtins/ja/workflows/backend-maintenance.yaml +32 -89
- package/builtins/ja/workflows/backend-mini.yaml +1 -0
- package/builtins/ja/workflows/backend.yaml +25 -83
- package/builtins/ja/workflows/{takt-default-with-fc.yaml → cli.yaml} +16 -4
- package/builtins/ja/workflows/deep-research.yaml +1 -0
- package/builtins/ja/workflows/default-high.yaml +3 -32
- package/builtins/ja/workflows/default-peer-review.yaml +16 -52
- package/builtins/ja/workflows/default.yaml +2 -1
- package/builtins/ja/workflows/dual-cqrs-mini.yaml +1 -0
- package/builtins/ja/workflows/dual-cqrs.yaml +28 -87
- package/builtins/ja/workflows/dual-for-local-llm.yaml +311 -0
- package/builtins/ja/workflows/dual-mini.yaml +1 -0
- package/builtins/ja/workflows/dual.yaml +29 -57
- package/builtins/ja/workflows/frontend-for-local-llm.yaml +288 -0
- package/builtins/ja/workflows/frontend-maintenance.yaml +34 -91
- package/builtins/ja/workflows/frontend-mini.yaml +1 -0
- package/builtins/ja/workflows/frontend.yaml +27 -85
- package/builtins/ja/workflows/merge-readiness-dual-final-gate.yaml +92 -0
- package/builtins/ja/workflows/merge-readiness-final-gate.yaml +79 -0
- package/builtins/ja/workflows/{peer-review-with-fc.yaml → peer-review-for-local-llm.yaml} +48 -37
- package/builtins/ja/workflows/peer-review.yaml +25 -20
- package/builtins/ja/workflows/research.yaml +1 -0
- package/builtins/ja/workflows/review-backend-cqrs.yaml +63 -35
- package/builtins/ja/workflows/review-backend.yaml +63 -35
- package/builtins/ja/workflows/review-default.yaml +111 -79
- package/builtins/ja/workflows/review-dual-cqrs.yaml +63 -35
- package/builtins/ja/workflows/review-dual.yaml +63 -35
- package/builtins/ja/workflows/review-fix-backend-cqrs.yaml +27 -87
- package/builtins/ja/workflows/review-fix-backend.yaml +25 -86
- package/builtins/ja/workflows/review-fix-default.yaml +17 -87
- package/builtins/ja/workflows/review-fix-dual-cqrs.yaml +29 -90
- package/builtins/ja/workflows/review-fix-dual.yaml +27 -89
- package/builtins/ja/workflows/review-fix-frontend.yaml +25 -87
- package/builtins/ja/workflows/review-fix-takt-default.yaml +67 -362
- package/builtins/ja/workflows/review-frontend.yaml +63 -35
- package/builtins/ja/workflows/review-takt-default.yaml +112 -80
- package/builtins/ja/workflows/takt-default-for-local-llm.yaml +282 -0
- package/builtins/ja/workflows/takt-default-refresh-all.yaml +20 -58
- package/builtins/ja/workflows/takt-default-refresh-fast.yaml +19 -56
- package/builtins/ja/workflows/takt-default.yaml +3 -25
- package/builtins/ja/workflows/terraform.yaml +81 -44
- package/dist/agents/decompose-task-usecase.d.ts +1 -0
- package/dist/agents/decompose-task-usecase.d.ts.map +1 -1
- package/dist/agents/decompose-task-usecase.js +2 -0
- package/dist/agents/decompose-task-usecase.js.map +1 -1
- package/dist/agents/judge-utils.d.ts.map +1 -1
- package/dist/agents/judge-utils.js +4 -3
- package/dist/agents/judge-utils.js.map +1 -1
- package/dist/agents/structured-caller/prompt-based-structured-caller.d.ts.map +1 -1
- package/dist/agents/structured-caller/prompt-based-structured-caller.js +2 -0
- package/dist/agents/structured-caller/prompt-based-structured-caller.js.map +1 -1
- package/dist/app/acp/agent.d.ts +28 -0
- package/dist/app/acp/agent.d.ts.map +1 -0
- package/dist/app/acp/agent.js +279 -0
- package/dist/app/acp/agent.js.map +1 -0
- package/dist/app/acp/confirmationBridge.d.ts +5 -0
- package/dist/app/acp/confirmationBridge.d.ts.map +1 -0
- package/dist/app/acp/confirmationBridge.js +194 -0
- package/dist/app/acp/confirmationBridge.js.map +1 -0
- package/dist/app/acp/conversationFactory.d.ts +4 -0
- package/dist/app/acp/conversationFactory.d.ts.map +1 -0
- package/dist/app/acp/conversationFactory.js +33 -0
- package/dist/app/acp/conversationFactory.js.map +1 -0
- package/dist/app/acp/enqueue.d.ts +33 -0
- package/dist/app/acp/enqueue.d.ts.map +1 -0
- package/dist/app/acp/enqueue.js +45 -0
- package/dist/app/acp/enqueue.js.map +1 -0
- package/dist/app/acp/index.d.ts +7 -0
- package/dist/app/acp/index.d.ts.map +1 -0
- package/dist/app/acp/index.js +125 -0
- package/dist/app/acp/index.js.map +1 -0
- package/dist/app/acp/intent.d.ts +10 -0
- package/dist/app/acp/intent.d.ts.map +1 -0
- package/dist/app/acp/intent.js +210 -0
- package/dist/app/acp/intent.js.map +1 -0
- package/dist/app/acp/mcpServers.d.ts +4 -0
- package/dist/app/acp/mcpServers.d.ts.map +1 -0
- package/dist/app/acp/mcpServers.js +51 -0
- package/dist/app/acp/mcpServers.js.map +1 -0
- package/dist/app/acp/promptContent.d.ts +3 -0
- package/dist/app/acp/promptContent.d.ts.map +1 -0
- package/dist/app/acp/promptContent.js +23 -0
- package/dist/app/acp/promptContent.js.map +1 -0
- package/dist/app/acp/sessionStore.d.ts +19 -0
- package/dist/app/acp/sessionStore.d.ts.map +1 -0
- package/dist/app/acp/sessionStore.js +50 -0
- package/dist/app/acp/sessionStore.js.map +1 -0
- package/dist/app/acp/sessionUpdates.d.ts +8 -0
- package/dist/app/acp/sessionUpdates.d.ts.map +1 -0
- package/dist/app/acp/sessionUpdates.js +108 -0
- package/dist/app/acp/sessionUpdates.js.map +1 -0
- package/dist/app/acp/taskContext.d.ts +17 -0
- package/dist/app/acp/taskContext.d.ts.map +1 -0
- package/dist/app/acp/taskContext.js +81 -0
- package/dist/app/acp/taskContext.js.map +1 -0
- package/dist/app/acp/types.d.ts +33 -0
- package/dist/app/acp/types.d.ts.map +1 -0
- package/dist/app/acp/types.js +2 -0
- package/dist/app/acp/types.js.map +1 -0
- package/dist/app/cli/program.d.ts.map +1 -1
- package/dist/app/cli/program.js +2 -3
- package/dist/app/cli/program.js.map +1 -1
- package/dist/app/mcp/index.d.ts +3 -0
- package/dist/app/mcp/index.d.ts.map +1 -0
- package/dist/app/mcp/index.js +16 -0
- package/dist/app/mcp/index.js.map +1 -0
- package/dist/app/mcp/server.d.ts +2 -0
- package/dist/app/mcp/server.d.ts.map +1 -0
- package/dist/app/mcp/server.js +2 -0
- package/dist/app/mcp/server.js.map +1 -0
- package/dist/core/config/provider-resolution.d.ts +1 -0
- package/dist/core/config/provider-resolution.d.ts.map +1 -1
- package/dist/core/config/provider-resolution.js +19 -0
- package/dist/core/config/provider-resolution.js.map +1 -1
- package/dist/core/models/finding-schemas.d.ts +129 -10
- package/dist/core/models/finding-schemas.d.ts.map +1 -1
- package/dist/core/models/finding-schemas.js +79 -9
- package/dist/core/models/finding-schemas.js.map +1 -1
- package/dist/core/models/finding-types.d.ts +39 -2
- package/dist/core/models/finding-types.d.ts.map +1 -1
- package/dist/core/models/finding-types.js +3 -2
- package/dist/core/models/finding-types.js.map +1 -1
- package/dist/core/models/workflow-condition-expression.d.ts +17 -0
- package/dist/core/models/workflow-condition-expression.d.ts.map +1 -1
- package/dist/core/models/workflow-condition-expression.js +85 -2
- package/dist/core/models/workflow-condition-expression.js.map +1 -1
- package/dist/core/models/workflow-schemas.d.ts +18 -6
- package/dist/core/models/workflow-schemas.d.ts.map +1 -1
- package/dist/core/models/workflow-schemas.js +1 -1
- package/dist/core/models/workflow-schemas.js.map +1 -1
- package/dist/core/models/workflow-types.d.ts +6 -0
- package/dist/core/models/workflow-types.d.ts.map +1 -1
- package/dist/core/runtime/runtime-environment.d.ts.map +1 -1
- package/dist/core/runtime/runtime-environment.js +19 -0
- package/dist/core/runtime/runtime-environment.js.map +1 -1
- package/dist/core/workflow/engine/OptionsBuilder.d.ts +14 -5
- package/dist/core/workflow/engine/OptionsBuilder.d.ts.map +1 -1
- package/dist/core/workflow/engine/OptionsBuilder.js +70 -5
- package/dist/core/workflow/engine/OptionsBuilder.js.map +1 -1
- package/dist/core/workflow/engine/ParallelRunner.d.ts +2 -0
- package/dist/core/workflow/engine/ParallelRunner.d.ts.map +1 -1
- package/dist/core/workflow/engine/ParallelRunner.js +131 -23
- package/dist/core/workflow/engine/ParallelRunner.js.map +1 -1
- package/dist/core/workflow/engine/StepExecutor.d.ts +10 -0
- package/dist/core/workflow/engine/StepExecutor.d.ts.map +1 -1
- package/dist/core/workflow/engine/StepExecutor.js +86 -30
- package/dist/core/workflow/engine/StepExecutor.js.map +1 -1
- package/dist/core/workflow/engine/TeamLeaderRunner.d.ts.map +1 -1
- package/dist/core/workflow/engine/TeamLeaderRunner.js +3 -0
- package/dist/core/workflow/engine/TeamLeaderRunner.js.map +1 -1
- package/dist/core/workflow/engine/WorkflowEngine.d.ts.map +1 -1
- package/dist/core/workflow/engine/WorkflowEngine.js +8 -3
- package/dist/core/workflow/engine/WorkflowEngine.js.map +1 -1
- package/dist/core/workflow/engine/WorkflowEngineSetup.d.ts.map +1 -1
- package/dist/core/workflow/engine/WorkflowEngineSetup.js +3 -1
- package/dist/core/workflow/engine/WorkflowEngineSetup.js.map +1 -1
- package/dist/core/workflow/engine/WorkflowValidator.d.ts.map +1 -1
- package/dist/core/workflow/engine/WorkflowValidator.js +9 -6
- package/dist/core/workflow/engine/WorkflowValidator.js.map +1 -1
- package/dist/core/workflow/engine/engine-provider-options.d.ts +1 -0
- package/dist/core/workflow/engine/engine-provider-options.d.ts.map +1 -1
- package/dist/core/workflow/engine/engine-provider-options.js +12 -0
- package/dist/core/workflow/engine/engine-provider-options.js.map +1 -1
- package/dist/core/workflow/engine/team-leader-part-runner.d.ts.map +1 -1
- package/dist/core/workflow/engine/team-leader-part-runner.js +3 -1
- package/dist/core/workflow/engine/team-leader-part-runner.js.map +1 -1
- package/dist/core/workflow/evaluation/RuleEvaluator.d.ts +0 -1
- package/dist/core/workflow/evaluation/RuleEvaluator.d.ts.map +1 -1
- package/dist/core/workflow/evaluation/RuleEvaluator.js +22 -34
- package/dist/core/workflow/evaluation/RuleEvaluator.js.map +1 -1
- package/dist/core/workflow/evaluation/rule-utils.d.ts +33 -1
- package/dist/core/workflow/evaluation/rule-utils.d.ts.map +1 -1
- package/dist/core/workflow/evaluation/rule-utils.js +77 -5
- package/dist/core/workflow/evaluation/rule-utils.js.map +1 -1
- package/dist/core/workflow/evaluation/when-evaluator.d.ts +1 -0
- package/dist/core/workflow/evaluation/when-evaluator.d.ts.map +1 -1
- package/dist/core/workflow/evaluation/when-evaluator.js +18 -40
- package/dist/core/workflow/evaluation/when-evaluator.js.map +1 -1
- package/dist/core/workflow/findings/context.d.ts +4 -0
- package/dist/core/workflow/findings/context.d.ts.map +1 -1
- package/dist/core/workflow/findings/context.js +27 -0
- package/dist/core/workflow/findings/context.js.map +1 -1
- package/dist/core/workflow/findings/manager-output-validation.d.ts +2 -0
- package/dist/core/workflow/findings/manager-output-validation.d.ts.map +1 -1
- package/dist/core/workflow/findings/manager-output-validation.js +145 -8
- package/dist/core/workflow/findings/manager-output-validation.js.map +1 -1
- package/dist/core/workflow/findings/manager-runner.d.ts +13 -3
- package/dist/core/workflow/findings/manager-runner.d.ts.map +1 -1
- package/dist/core/workflow/findings/manager-runner.js +19 -2
- package/dist/core/workflow/findings/manager-runner.js.map +1 -1
- package/dist/core/workflow/findings/reconciler.d.ts +1 -0
- package/dist/core/workflow/findings/reconciler.d.ts.map +1 -1
- package/dist/core/workflow/findings/reconciler.js +90 -4
- package/dist/core/workflow/findings/reconciler.js.map +1 -1
- package/dist/core/workflow/instruction/InstructionBuilder.d.ts.map +1 -1
- package/dist/core/workflow/instruction/InstructionBuilder.js +17 -1
- package/dist/core/workflow/instruction/InstructionBuilder.js.map +1 -1
- package/dist/core/workflow/instruction/instruction-context.d.ts +4 -0
- package/dist/core/workflow/instruction/instruction-context.d.ts.map +1 -1
- package/dist/core/workflow/instruction/instruction-context.js.map +1 -1
- package/dist/core/workflow/instruction/status-rules.d.ts.map +1 -1
- package/dist/core/workflow/instruction/status-rules.js +7 -2
- package/dist/core/workflow/instruction/status-rules.js.map +1 -1
- package/dist/core/workflow/phase-runner.d.ts +17 -10
- package/dist/core/workflow/phase-runner.d.ts.map +1 -1
- package/dist/core/workflow/phase-runner.js +1 -1
- package/dist/core/workflow/phase-runner.js.map +1 -1
- package/dist/core/workflow/provider-model-requirements.d.ts +6 -0
- package/dist/core/workflow/provider-model-requirements.d.ts.map +1 -0
- package/dist/core/workflow/provider-model-requirements.js +15 -0
- package/dist/core/workflow/provider-model-requirements.js.map +1 -0
- package/dist/core/workflow/report-phase-runner.d.ts +5 -2
- package/dist/core/workflow/report-phase-runner.d.ts.map +1 -1
- package/dist/core/workflow/report-phase-runner.js +135 -43
- package/dist/core/workflow/report-phase-runner.js.map +1 -1
- package/dist/core/workflow/status-judgment-phase.d.ts +2 -2
- package/dist/core/workflow/status-judgment-phase.d.ts.map +1 -1
- package/dist/core/workflow/status-judgment-phase.js +1 -7
- package/dist/core/workflow/status-judgment-phase.js.map +1 -1
- package/dist/core/workflow/system/system-step-effect-runner.js +2 -2
- package/dist/core/workflow/system/system-step-effect-runner.js.map +1 -1
- package/dist/core/workflow/system/system-step-services.d.ts +101 -0
- package/dist/core/workflow/system/system-step-services.d.ts.map +1 -1
- package/dist/core/workflow/types.d.ts +7 -3
- package/dist/core/workflow/types.d.ts.map +1 -1
- package/dist/features/analytics/events.d.ts +2 -1
- package/dist/features/analytics/events.d.ts.map +1 -1
- package/dist/features/exec/assistantSession.js +1 -1
- package/dist/features/exec/assistantSession.js.map +1 -1
- package/dist/features/exec/configOps.d.ts.map +1 -1
- package/dist/features/exec/configOps.js +4 -4
- package/dist/features/exec/configOps.js.map +1 -1
- package/dist/features/exec/configValidation.d.ts +1 -1
- package/dist/features/exec/configValidation.d.ts.map +1 -1
- package/dist/features/exec/configValidation.js +9 -13
- package/dist/features/exec/configValidation.js.map +1 -1
- package/dist/features/exec/setupMenu.js +2 -2
- package/dist/features/exec/setupMenu.js.map +1 -1
- package/dist/features/exec/workflowTemplate.d.ts.map +1 -1
- package/dist/features/exec/workflowTemplate.js +4 -4
- package/dist/features/exec/workflowTemplate.js.map +1 -1
- package/dist/features/interactive/aiCaller.d.ts +2 -0
- package/dist/features/interactive/aiCaller.d.ts.map +1 -1
- package/dist/features/interactive/aiCaller.js +31 -10
- package/dist/features/interactive/aiCaller.js.map +1 -1
- package/dist/features/interactive/conversationSession.d.ts +44 -0
- package/dist/features/interactive/conversationSession.d.ts.map +1 -0
- package/dist/features/interactive/conversationSession.js +133 -0
- package/dist/features/interactive/conversationSession.js.map +1 -0
- package/dist/features/interactive/index.d.ts +1 -0
- package/dist/features/interactive/index.d.ts.map +1 -1
- package/dist/features/interactive/index.js +1 -0
- package/dist/features/interactive/index.js.map +1 -1
- package/dist/features/interactive/interactive.d.ts +5 -4
- package/dist/features/interactive/interactive.d.ts.map +1 -1
- package/dist/features/interactive/interactive.js +10 -4
- package/dist/features/interactive/interactive.js.map +1 -1
- package/dist/features/interactive/interactiveApplication.d.ts +5 -0
- package/dist/features/interactive/interactiveApplication.d.ts.map +1 -0
- package/dist/features/interactive/interactiveApplication.js +10 -0
- package/dist/features/interactive/interactiveApplication.js.map +1 -0
- package/dist/features/mcp/operations.d.ts +25 -0
- package/dist/features/mcp/operations.d.ts.map +1 -0
- package/dist/features/mcp/operations.js +150 -0
- package/dist/features/mcp/operations.js.map +1 -0
- package/dist/features/mcp/schemas.d.ts +50 -0
- package/dist/features/mcp/schemas.d.ts.map +1 -0
- package/dist/features/mcp/schemas.js +59 -0
- package/dist/features/mcp/schemas.js.map +1 -0
- package/dist/features/mcp/server.d.ts +7 -0
- package/dist/features/mcp/server.d.ts.map +1 -0
- package/dist/features/mcp/server.js +36 -0
- package/dist/features/mcp/server.js.map +1 -0
- package/dist/features/tasks/add/index.d.ts +8 -20
- package/dist/features/tasks/add/index.d.ts.map +1 -1
- package/dist/features/tasks/add/index.js +42 -61
- package/dist/features/tasks/add/index.js.map +1 -1
- package/dist/features/tasks/attachments.d.ts +2 -5
- package/dist/features/tasks/attachments.d.ts.map +1 -1
- package/dist/features/tasks/attachments.js +11 -35
- package/dist/features/tasks/attachments.js.map +1 -1
- package/dist/features/tasks/execute/outputFns.d.ts +1 -1
- package/dist/features/tasks/execute/outputFns.d.ts.map +1 -1
- package/dist/features/tasks/execute/outputFns.js +17 -1
- package/dist/features/tasks/execute/outputFns.js.map +1 -1
- package/dist/features/tasks/execute/postExecution.d.ts +4 -1
- package/dist/features/tasks/execute/postExecution.d.ts.map +1 -1
- package/dist/features/tasks/execute/postExecution.js +33 -14
- package/dist/features/tasks/execute/postExecution.js.map +1 -1
- package/dist/features/tasks/execute/resolveTask.d.ts +9 -3
- package/dist/features/tasks/execute/resolveTask.d.ts.map +1 -1
- package/dist/features/tasks/execute/resolveTask.js +45 -13
- package/dist/features/tasks/execute/resolveTask.js.map +1 -1
- package/dist/features/tasks/execute/runTaskExecution.d.ts +7 -1
- package/dist/features/tasks/execute/runTaskExecution.d.ts.map +1 -1
- package/dist/features/tasks/execute/runTaskExecution.js +11 -8
- package/dist/features/tasks/execute/runTaskExecution.js.map +1 -1
- package/dist/features/tasks/execute/taskExecution.d.ts +12 -3
- package/dist/features/tasks/execute/taskExecution.d.ts.map +1 -1
- package/dist/features/tasks/execute/taskExecution.js +63 -16
- package/dist/features/tasks/execute/taskExecution.js.map +1 -1
- package/dist/features/tasks/execute/taskResultHandler.d.ts +2 -2
- package/dist/features/tasks/execute/taskResultHandler.d.ts.map +1 -1
- package/dist/features/tasks/execute/taskResultHandler.js +8 -4
- package/dist/features/tasks/execute/taskResultHandler.js.map +1 -1
- package/dist/features/tasks/execute/taskWorkflowExecution.d.ts.map +1 -1
- package/dist/features/tasks/execute/taskWorkflowExecution.js +60 -9
- package/dist/features/tasks/execute/taskWorkflowExecution.js.map +1 -1
- package/dist/features/tasks/execute/traceTaskMetadata.js +3 -6
- package/dist/features/tasks/execute/traceTaskMetadata.js.map +1 -1
- package/dist/features/tasks/execute/types.d.ts +95 -2
- package/dist/features/tasks/execute/types.d.ts.map +1 -1
- package/dist/features/tasks/execute/workflowExecution.d.ts +3 -1
- package/dist/features/tasks/execute/workflowExecution.d.ts.map +1 -1
- package/dist/features/tasks/execute/workflowExecution.js +41 -3
- package/dist/features/tasks/execute/workflowExecution.js.map +1 -1
- package/dist/features/tasks/execute/workflowExecutionApi.d.ts +6 -0
- package/dist/features/tasks/execute/workflowExecutionApi.d.ts.map +1 -0
- package/dist/features/tasks/execute/workflowExecutionApi.js +25 -0
- package/dist/features/tasks/execute/workflowExecutionApi.js.map +1 -0
- package/dist/features/tasks/execute/workflowExecutionBootstrap.d.ts +2 -1
- package/dist/features/tasks/execute/workflowExecutionBootstrap.d.ts.map +1 -1
- package/dist/features/tasks/execute/workflowExecutionBootstrap.js +18 -14
- package/dist/features/tasks/execute/workflowExecutionBootstrap.js.map +1 -1
- package/dist/features/tasks/execute/workflowExecutionEvents.d.ts +14 -1
- package/dist/features/tasks/execute/workflowExecutionEvents.d.ts.map +1 -1
- package/dist/features/tasks/execute/workflowExecutionEvents.js +241 -2
- package/dist/features/tasks/execute/workflowExecutionEvents.js.map +1 -1
- package/dist/features/tasks/list/requeueHelpers.d.ts +1 -0
- package/dist/features/tasks/list/requeueHelpers.d.ts.map +1 -1
- package/dist/features/tasks/list/requeueHelpers.js +3 -0
- package/dist/features/tasks/list/requeueHelpers.js.map +1 -1
- package/dist/features/tasks/list/taskInstructionActions.d.ts.map +1 -1
- package/dist/features/tasks/list/taskInstructionActions.js +2 -2
- package/dist/features/tasks/list/taskInstructionActions.js.map +1 -1
- package/dist/features/tasks/list/taskRetryActions.d.ts.map +1 -1
- package/dist/features/tasks/list/taskRetryActions.js +1 -4
- package/dist/features/tasks/list/taskRetryActions.js.map +1 -1
- package/dist/features/tasks/taskContextValidation.d.ts +10 -0
- package/dist/features/tasks/taskContextValidation.d.ts.map +1 -0
- package/dist/features/tasks/taskContextValidation.js +73 -0
- package/dist/features/tasks/taskContextValidation.js.map +1 -0
- package/dist/infra/codex/client.d.ts.map +1 -1
- package/dist/infra/codex/client.js +5 -0
- package/dist/infra/codex/client.js.map +1 -1
- package/dist/infra/config/configNormalizers.js +4 -4
- package/dist/infra/config/configNormalizers.js.map +1 -1
- package/dist/infra/config/global/globalConfigCore.js +2 -2
- package/dist/infra/config/global/globalConfigCore.js.map +1 -1
- package/dist/infra/config/loaders/resource-resolver.d.ts.map +1 -1
- package/dist/infra/config/loaders/resource-resolver.js +22 -7
- package/dist/infra/config/loaders/resource-resolver.js.map +1 -1
- package/dist/infra/config/loaders/workflowCallContracts.d.ts.map +1 -1
- package/dist/infra/config/loaders/workflowCallContracts.js +5 -0
- package/dist/infra/config/loaders/workflowCallContracts.js.map +1 -1
- package/dist/infra/config/loaders/workflowCallableArgResolver.d.ts.map +1 -1
- package/dist/infra/config/loaders/workflowCallableArgResolver.js +27 -0
- package/dist/infra/config/loaders/workflowCallableArgResolver.js.map +1 -1
- package/dist/infra/config/loaders/workflowCallableRuleValidation.d.ts.map +1 -1
- package/dist/infra/config/loaders/workflowCallableRuleValidation.js +5 -0
- package/dist/infra/config/loaders/workflowCallableRuleValidation.js.map +1 -1
- package/dist/infra/config/loaders/workflowLoopMonitorNormalizer.d.ts.map +1 -1
- package/dist/infra/config/loaders/workflowLoopMonitorNormalizer.js +9 -1
- package/dist/infra/config/loaders/workflowLoopMonitorNormalizer.js.map +1 -1
- package/dist/infra/config/loaders/workflowPackageScope.d.ts +1 -0
- package/dist/infra/config/loaders/workflowPackageScope.d.ts.map +1 -1
- package/dist/infra/config/loaders/workflowPackageScope.js +20 -2
- package/dist/infra/config/loaders/workflowPackageScope.js.map +1 -1
- package/dist/infra/config/loaders/workflowParser.d.ts.map +1 -1
- package/dist/infra/config/loaders/workflowParser.js +11 -6
- package/dist/infra/config/loaders/workflowParser.js.map +1 -1
- package/dist/infra/config/loaders/workflowRuleNormalizer.d.ts +10 -0
- package/dist/infra/config/loaders/workflowRuleNormalizer.d.ts.map +1 -1
- package/dist/infra/config/loaders/workflowRuleNormalizer.js +70 -1
- package/dist/infra/config/loaders/workflowRuleNormalizer.js.map +1 -1
- package/dist/infra/config/loaders/workflowStepNormalizer.d.ts.map +1 -1
- package/dist/infra/config/loaders/workflowStepNormalizer.js +15 -1
- package/dist/infra/config/loaders/workflowStepNormalizer.js.map +1 -1
- package/dist/infra/config/project/sessionStore.d.ts +2 -2
- package/dist/infra/config/project/sessionStore.d.ts.map +1 -1
- package/dist/infra/config/project/sessionStore.js +12 -4
- package/dist/infra/config/project/sessionStore.js.map +1 -1
- package/dist/infra/config/providerModelRequirements.d.ts +2 -0
- package/dist/infra/config/providerModelRequirements.d.ts.map +1 -0
- package/dist/infra/config/providerModelRequirements.js +2 -0
- package/dist/infra/config/providerModelRequirements.js.map +1 -0
- package/dist/infra/git/format.d.ts +1 -0
- package/dist/infra/git/format.d.ts.map +1 -1
- package/dist/infra/git/format.js +21 -0
- package/dist/infra/git/format.js.map +1 -1
- package/dist/infra/git/index.d.ts +1 -1
- package/dist/infra/git/index.d.ts.map +1 -1
- package/dist/infra/git/types.d.ts +16 -4
- package/dist/infra/git/types.d.ts.map +1 -1
- package/dist/infra/github/GitHubProvider.d.ts +2 -1
- package/dist/infra/github/GitHubProvider.d.ts.map +1 -1
- package/dist/infra/github/GitHubProvider.js +4 -1
- package/dist/infra/github/GitHubProvider.js.map +1 -1
- package/dist/infra/github/issue.d.ts +2 -1
- package/dist/infra/github/issue.d.ts.map +1 -1
- package/dist/infra/github/issue.js +23 -2
- package/dist/infra/github/issue.js.map +1 -1
- package/dist/infra/gitlab/GitLabProvider.d.ts +2 -1
- package/dist/infra/gitlab/GitLabProvider.d.ts.map +1 -1
- package/dist/infra/gitlab/GitLabProvider.js +4 -1
- package/dist/infra/gitlab/GitLabProvider.js.map +1 -1
- package/dist/infra/gitlab/issue.d.ts +2 -1
- package/dist/infra/gitlab/issue.d.ts.map +1 -1
- package/dist/infra/gitlab/issue.js +30 -2
- package/dist/infra/gitlab/issue.js.map +1 -1
- package/dist/infra/opencode/OpenCodeStreamHandler.d.ts +4 -0
- package/dist/infra/opencode/OpenCodeStreamHandler.d.ts.map +1 -1
- package/dist/infra/opencode/OpenCodeStreamHandler.js.map +1 -1
- package/dist/infra/opencode/allowedTools.d.ts.map +1 -1
- package/dist/infra/opencode/allowedTools.js +0 -1
- package/dist/infra/opencode/allowedTools.js.map +1 -1
- package/dist/infra/opencode/client.d.ts +2 -0
- package/dist/infra/opencode/client.d.ts.map +1 -1
- package/dist/infra/opencode/client.js +346 -169
- package/dist/infra/opencode/client.js.map +1 -1
- package/dist/infra/opencode/types.d.ts +34 -0
- package/dist/infra/opencode/types.d.ts.map +1 -1
- package/dist/infra/opencode/types.js +88 -1
- package/dist/infra/opencode/types.js.map +1 -1
- package/dist/infra/opencode/unavailable-tool-loop.d.ts +13 -0
- package/dist/infra/opencode/unavailable-tool-loop.d.ts.map +1 -1
- package/dist/infra/opencode/unavailable-tool-loop.js +46 -0
- package/dist/infra/opencode/unavailable-tool-loop.js.map +1 -1
- package/dist/infra/providers/claude-headless.d.ts.map +1 -1
- package/dist/infra/providers/claude-headless.js +0 -2
- package/dist/infra/providers/claude-headless.js.map +1 -1
- package/dist/infra/providers/claude-terminal.d.ts.map +1 -1
- package/dist/infra/providers/claude-terminal.js +0 -2
- package/dist/infra/providers/claude-terminal.js.map +1 -1
- package/dist/infra/providers/claude.d.ts.map +1 -1
- package/dist/infra/providers/claude.js +0 -2
- package/dist/infra/providers/claude.js.map +1 -1
- package/dist/infra/providers/opencode.d.ts +1 -1
- package/dist/infra/providers/opencode.d.ts.map +1 -1
- package/dist/infra/providers/opencode.js +2 -1
- package/dist/infra/providers/opencode.js.map +1 -1
- package/dist/infra/task/clone-exec.d.ts.map +1 -1
- package/dist/infra/task/clone-exec.js +31 -0
- package/dist/infra/task/clone-exec.js.map +1 -1
- package/dist/infra/task/enqueueService.d.ts +115 -0
- package/dist/infra/task/enqueueService.d.ts.map +1 -0
- package/dist/infra/task/enqueueService.js +191 -0
- package/dist/infra/task/enqueueService.js.map +1 -0
- package/dist/infra/task/enqueuedTaskFile.d.ts +6 -0
- package/dist/infra/task/enqueuedTaskFile.d.ts.map +1 -0
- package/dist/infra/task/enqueuedTaskFile.js +55 -0
- package/dist/infra/task/enqueuedTaskFile.js.map +1 -0
- package/dist/infra/task/issueTask.d.ts +20 -0
- package/dist/infra/task/issueTask.d.ts.map +1 -0
- package/dist/{features/tasks/add → infra/task}/issueTask.js +61 -43
- package/dist/infra/task/issueTask.js.map +1 -0
- package/dist/infra/task/listSerializer.d.ts +1 -0
- package/dist/infra/task/listSerializer.d.ts.map +1 -1
- package/dist/infra/task/listSerializer.js +1 -0
- package/dist/infra/task/listSerializer.js.map +1 -1
- package/dist/infra/task/mapper.d.ts.map +1 -1
- package/dist/infra/task/mapper.js +1 -0
- package/dist/infra/task/mapper.js.map +1 -1
- package/dist/infra/task/taskExecutionSchemas.d.ts +3 -0
- package/dist/infra/task/taskExecutionSchemas.d.ts.map +1 -1
- package/dist/infra/task/taskExecutionSchemas.js +4 -2
- package/dist/infra/task/taskExecutionSchemas.js.map +1 -1
- package/dist/infra/task/taskRecordSchemas.d.ts +2 -0
- package/dist/infra/task/taskRecordSchemas.d.ts.map +1 -1
- package/dist/infra/workflow/system/DefaultSystemStepServices.d.ts.map +1 -1
- package/dist/infra/workflow/system/DefaultSystemStepServices.js +7 -7
- package/dist/infra/workflow/system/DefaultSystemStepServices.js.map +1 -1
- package/dist/infra/workflow/system/system-enqueue-effect.d.ts.map +1 -1
- package/dist/infra/workflow/system/system-enqueue-effect.js +78 -20
- package/dist/infra/workflow/system/system-enqueue-effect.js.map +1 -1
- package/dist/infra/workflow/system/system-git-context.d.ts +6 -6
- package/dist/infra/workflow/system/system-git-context.d.ts.map +1 -1
- package/dist/infra/workflow/system/system-git-context.js +13 -13
- package/dist/infra/workflow/system/system-git-context.js.map +1 -1
- package/dist/infra/workflow/system/system-issue-input-resolver.d.ts +3 -3
- package/dist/infra/workflow/system/system-issue-input-resolver.d.ts.map +1 -1
- package/dist/infra/workflow/system/system-issue-input-resolver.js +8 -8
- package/dist/infra/workflow/system/system-issue-input-resolver.js.map +1 -1
- package/dist/infra/workflow/system/system-pr-effects.d.ts.map +1 -1
- package/dist/infra/workflow/system/system-pr-effects.js +6 -3
- package/dist/infra/workflow/system/system-pr-effects.js.map +1 -1
- package/dist/infra/workflow/system/system-pr-input-resolver.d.ts +3 -3
- package/dist/infra/workflow/system/system-pr-input-resolver.d.ts.map +1 -1
- package/dist/infra/workflow/system/system-pr-input-resolver.js +8 -8
- package/dist/infra/workflow/system/system-pr-input-resolver.js.map +1 -1
- package/dist/infra/workflow/system/system-sync-effects.js +2 -2
- package/dist/infra/workflow/system/system-sync-effects.js.map +1 -1
- package/dist/shared/package-info.d.ts +2 -0
- package/dist/shared/package-info.d.ts.map +1 -0
- package/dist/shared/package-info.js +5 -0
- package/dist/shared/package-info.js.map +1 -0
- package/dist/shared/prompts/en/finding_manager_instruction.md +9 -2
- package/dist/shared/prompts/en/opencode_review_agent_prompt.md +20 -23
- package/dist/shared/prompts/ja/finding_manager_instruction.md +9 -2
- package/dist/shared/prompts/ja/opencode_review_agent_prompt.md +20 -23
- package/dist/shared/utils/entrypoint.d.ts +2 -0
- package/dist/shared/utils/entrypoint.d.ts.map +1 -0
- package/dist/shared/utils/entrypoint.js +15 -0
- package/dist/shared/utils/entrypoint.js.map +1 -0
- package/dist/shared/utils/index.d.ts +1 -0
- package/dist/shared/utils/index.d.ts.map +1 -1
- package/dist/shared/utils/index.js +1 -0
- package/dist/shared/utils/index.js.map +1 -1
- package/dist/shared/utils/safeExternalErrorMessage.d.ts +2 -0
- package/dist/shared/utils/safeExternalErrorMessage.d.ts.map +1 -0
- package/dist/shared/utils/safeExternalErrorMessage.js +22 -0
- package/dist/shared/utils/safeExternalErrorMessage.js.map +1 -0
- package/package.json +29 -10
- package/builtins/en/facets/instructions/review-pure.md +0 -9
- package/builtins/en/facets/personas/pure-reviewer.md +0 -22
- package/builtins/ja/facets/instructions/review-pure.md +0 -9
- package/builtins/ja/facets/personas/pure-reviewer.md +0 -22
- package/dist/core/workflow/claude-effort-compatibility.d.ts +0 -3
- package/dist/core/workflow/claude-effort-compatibility.d.ts.map +0 -1
- package/dist/core/workflow/claude-effort-compatibility.js +0 -28
- package/dist/core/workflow/claude-effort-compatibility.js.map +0 -1
- package/dist/core/workflow/provider-model-compatibility.d.ts +0 -6
- package/dist/core/workflow/provider-model-compatibility.d.ts.map +0 -1
- package/dist/core/workflow/provider-model-compatibility.js +0 -20
- package/dist/core/workflow/provider-model-compatibility.js.map +0 -1
- package/dist/features/tasks/add/issueTask.d.ts +0 -7
- package/dist/features/tasks/add/issueTask.d.ts.map +0 -1
- package/dist/features/tasks/add/issueTask.js.map +0 -1
- package/dist/infra/config/providerModelCompatibility.d.ts +0 -2
- package/dist/infra/config/providerModelCompatibility.d.ts.map +0 -1
- package/dist/infra/config/providerModelCompatibility.js +0 -2
- package/dist/infra/config/providerModelCompatibility.js.map +0 -1
|
@@ -9,16 +9,37 @@ import { createServer } from 'node:net';
|
|
|
9
9
|
import { loadTemplate } from '../../shared/prompts/index.js';
|
|
10
10
|
import { mapsToOpenCodeEditPermission } from './allowedTools.js';
|
|
11
11
|
import { AskUserQuestionDeniedError } from '../../core/workflow/ask-user-question-error.js';
|
|
12
|
+
import { parseLastJsonBlock } from '../../agents/structured-caller/shared.js';
|
|
12
13
|
import { createLogger, getErrorMessage, createStreamDiagnostics } from '../../shared/utils/index.js';
|
|
13
14
|
import { getNestedObservabilityEnvFingerprint, runWithNestedObservabilityProcessEnv, } from '../../shared/telemetry/index.js';
|
|
14
15
|
import { parseProviderModel } from '../../shared/utils/providerModel.js';
|
|
15
|
-
import { buildOpenCodePermissionRuleset, resolveOpenCodePermissionReply, } from './types.js';
|
|
16
|
+
import { buildOpenCodePermissionRuleset, buildOpenCodePromptTools, buildOpenCodeSessionPermission, resolveOpenCodePermissionReply, } from './types.js';
|
|
16
17
|
import { createStreamTrackingState, emitInit, emitText, emitPermissionAsked, emitPermissionSummary, emitResult, handlePartUpdated, } from './OpenCodeStreamHandler.js';
|
|
17
|
-
import { UnavailableToolLoopDetector } from './unavailable-tool-loop.js';
|
|
18
|
+
import { InvalidToolArgumentLoopDetector, UnavailableToolLoopDetector } from './unavailable-tool-loop.js';
|
|
18
19
|
import { buildRateLimitedResponseFields, containsRateLimitError } from '../rate-limit/detection.js';
|
|
19
20
|
const TAKT_AGENT = 'takt';
|
|
20
21
|
const TAKT_AGENT_REVIEW = 'takt-review';
|
|
21
22
|
const TAKT_AGENT_REPORT = 'takt-report';
|
|
23
|
+
/**
|
|
24
|
+
* イベントが属するセッション ID を取り出す。イベントバスはサーバ全体で
|
|
25
|
+
* 共有されるため、無音検出のリセットは「自セッションの進捗」だけに
|
|
26
|
+
* 反応させる必要がある(LSP・ファイルウォッチャ・兄弟セッションの
|
|
27
|
+
* イベントでリセットすると、生成が死んでいても永遠にハングする)。
|
|
28
|
+
*/
|
|
29
|
+
function extractEventSessionId(event) {
|
|
30
|
+
const props = event.properties;
|
|
31
|
+
if (!props)
|
|
32
|
+
return undefined;
|
|
33
|
+
if (typeof props.sessionID === 'string')
|
|
34
|
+
return props.sessionID;
|
|
35
|
+
const part = props.part;
|
|
36
|
+
if (part !== undefined && typeof part.sessionID === 'string')
|
|
37
|
+
return part.sessionID;
|
|
38
|
+
const info = props.info;
|
|
39
|
+
if (info !== undefined && typeof info.sessionID === 'string')
|
|
40
|
+
return info.sessionID;
|
|
41
|
+
return undefined;
|
|
42
|
+
}
|
|
22
43
|
function selectTaktAgent(allowedTools) {
|
|
23
44
|
if (allowedTools !== undefined && allowedTools.length === 0) {
|
|
24
45
|
return TAKT_AGENT_REPORT;
|
|
@@ -33,7 +54,11 @@ function selectTaktAgent(allowedTools) {
|
|
|
33
54
|
return TAKT_AGENT_REVIEW;
|
|
34
55
|
}
|
|
35
56
|
const log = createLogger('opencode-sdk');
|
|
36
|
-
|
|
57
|
+
/** 呼び出し時に評価する(テストや実験で env から上書きできるようにする) */
|
|
58
|
+
function resolveStreamIdleTimeoutMs() {
|
|
59
|
+
const fromEnv = Number(process.env.TAKT_OPENCODE_STREAM_IDLE_TIMEOUT_MS);
|
|
60
|
+
return fromEnv > 0 ? fromEnv : 10 * 60 * 1000;
|
|
61
|
+
}
|
|
37
62
|
const OPENCODE_STREAM_ABORTED_MESSAGE = 'OpenCode execution aborted';
|
|
38
63
|
const OPENCODE_RETRY_MAX_ATTEMPTS = 3;
|
|
39
64
|
const OPENCODE_RETRY_BASE_DELAY_MS = 250;
|
|
@@ -95,6 +120,14 @@ async function createSharedServer(model, apiKey, childProcessEnv) {
|
|
|
95
120
|
config: {
|
|
96
121
|
model,
|
|
97
122
|
small_model: model,
|
|
123
|
+
// Session-level permission rules are rewritten whenever a prompt
|
|
124
|
+
// carries a tools map (OpenCode materializes the map into
|
|
125
|
+
// session.permission), so session-scoped denies do not survive the
|
|
126
|
+
// first prompt. Server-config permission is outside that rewrite and
|
|
127
|
+
// is the only layer that reliably keeps out-of-workspace access a
|
|
128
|
+
// soft tool error instead of an ask (which would depend on the
|
|
129
|
+
// user's global OpenCode config).
|
|
130
|
+
permission: { external_directory: 'deny' },
|
|
98
131
|
...(apiKey ? { provider: { opencode: { options: { apiKey } } } } : {}),
|
|
99
132
|
agent: {
|
|
100
133
|
[TAKT_AGENT]: {
|
|
@@ -163,6 +196,19 @@ export async function getOpenCodeSessionSnapshot(model, sessionID, directory, ap
|
|
|
163
196
|
release();
|
|
164
197
|
}
|
|
165
198
|
}
|
|
199
|
+
export async function getOpenCodeSessionMessages(model, sessionID, directory, apiKey) {
|
|
200
|
+
const { client, release } = await acquireClient(model, apiKey, undefined);
|
|
201
|
+
try {
|
|
202
|
+
const result = await client.session.messages({ sessionID, directory });
|
|
203
|
+
if (!result.data) {
|
|
204
|
+
throw new Error(`OpenCode session messages not found: ${sessionID}`);
|
|
205
|
+
}
|
|
206
|
+
return result.data;
|
|
207
|
+
}
|
|
208
|
+
finally {
|
|
209
|
+
release();
|
|
210
|
+
}
|
|
211
|
+
}
|
|
166
212
|
function releaseClient(server) {
|
|
167
213
|
const next = server.queue.shift();
|
|
168
214
|
if (next) {
|
|
@@ -371,10 +417,19 @@ export class OpenCodeClient {
|
|
|
371
417
|
}
|
|
372
418
|
/** Call OpenCode with an agent prompt */
|
|
373
419
|
async call(agentType, prompt, options) {
|
|
374
|
-
|
|
420
|
+
// native format(StructuredOutput ツール)をモデルが呼ばない個体が
|
|
421
|
+
// あるため、その失敗を検出したら format なし(手書き JSON + 下流の
|
|
422
|
+
// 是正リトライ)へフォールバックする。
|
|
423
|
+
let disableNativeStructuredOutput = false;
|
|
424
|
+
// フォールバック(format なし再試行)は transient 再試行の予算とは別枠で
|
|
425
|
+
// 1回だけ確保する: 先行の transient エラーで予算を使い切っていても、
|
|
426
|
+
// 最終試行の format 失敗から救済できるようにする。
|
|
427
|
+
let maxAttempts = OPENCODE_RETRY_MAX_ATTEMPTS;
|
|
428
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
375
429
|
let idleTimeoutId;
|
|
376
430
|
const streamAbortController = new AbortController();
|
|
377
|
-
const
|
|
431
|
+
const streamIdleTimeoutMs = resolveStreamIdleTimeoutMs();
|
|
432
|
+
const timeoutMessage = `OpenCode stream timed out after ${Math.round(streamIdleTimeoutMs / 60000)} minutes of inactivity`;
|
|
378
433
|
let abortCause;
|
|
379
434
|
let diagRef;
|
|
380
435
|
let release;
|
|
@@ -418,9 +473,10 @@ export class OpenCodeClient {
|
|
|
418
473
|
}
|
|
419
474
|
idleTimeoutId = setTimeout(() => {
|
|
420
475
|
diagRef?.onIdleTimeoutFired();
|
|
476
|
+
log.warn(timeoutMessage, { sessionId, model: options.model });
|
|
421
477
|
abortCause = 'timeout';
|
|
422
478
|
streamAbortController.abort();
|
|
423
|
-
},
|
|
479
|
+
}, streamIdleTimeoutMs);
|
|
424
480
|
};
|
|
425
481
|
const onExternalAbort = () => {
|
|
426
482
|
abortCause = 'external';
|
|
@@ -455,23 +511,17 @@ export class OpenCodeClient {
|
|
|
455
511
|
throw new Error(OPENCODE_STREAM_ABORTED_MESSAGE);
|
|
456
512
|
}
|
|
457
513
|
const permissionRuleset = buildOpenCodePermissionRuleset(options.permissionMode, options.networkAccess, options.allowedTools);
|
|
458
|
-
|
|
459
|
-
|
|
514
|
+
// The session is created once per step and reused across phases: a
|
|
515
|
+
// session-scoped deny can never be escalated later, and recreating the
|
|
516
|
+
// session drops the conversation history the report/judgment phases
|
|
517
|
+
// depend on. Per-phase tool restriction rides on the explicit prompt
|
|
518
|
+
// tools map below instead.
|
|
519
|
+
const appliedPermissionRuleset = sessionId === undefined;
|
|
520
|
+
const sessionPermission = buildOpenCodeSessionPermission(options.permissionMode, options.networkAccess, options.allowedTools);
|
|
460
521
|
if (sessionId === undefined) {
|
|
461
522
|
const sessionResult = await opencodeApiClient.session.create({
|
|
462
523
|
directory: options.cwd,
|
|
463
|
-
permission:
|
|
464
|
-
});
|
|
465
|
-
sessionId = sessionResult.data?.id;
|
|
466
|
-
if (!sessionId) {
|
|
467
|
-
throw new Error('Failed to create OpenCode session');
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
else if (options.allowedTools !== undefined) {
|
|
471
|
-
const sessionResult = await opencodeApiClient.session.create({
|
|
472
|
-
directory: options.cwd,
|
|
473
|
-
parentID: sessionId,
|
|
474
|
-
permission: permissionRuleset,
|
|
524
|
+
permission: sessionPermission,
|
|
475
525
|
});
|
|
476
526
|
sessionId = sessionResult.data?.id;
|
|
477
527
|
if (!sessionId) {
|
|
@@ -491,21 +541,32 @@ export class OpenCodeClient {
|
|
|
491
541
|
...(options.permissionMode !== undefined ? { permissionMode: options.permissionMode } : {}),
|
|
492
542
|
...(options.allowedTools !== undefined ? { allowedTools: options.allowedTools } : {}),
|
|
493
543
|
...(options.networkAccess !== undefined ? { networkAccess: options.networkAccess } : {}),
|
|
494
|
-
resolvedPermissions:
|
|
544
|
+
resolvedPermissions: sessionPermission,
|
|
495
545
|
});
|
|
496
546
|
}
|
|
497
547
|
const agentName = selectTaktAgent(options.allowedTools);
|
|
548
|
+
// OpenCode persists the last explicit tools map on the session, so
|
|
549
|
+
// every prompt sends the full map for its own phase (see
|
|
550
|
+
// buildOpenCodePromptTools).
|
|
551
|
+
const promptTools = buildOpenCodePromptTools(options.permissionMode, options.networkAccess, options.allowedTools);
|
|
498
552
|
log.debug('Selecting OpenCode agent', {
|
|
499
553
|
agentName,
|
|
500
554
|
allowedTools: options.allowedTools,
|
|
555
|
+
promptTools,
|
|
501
556
|
});
|
|
502
557
|
const promptPayload = {
|
|
503
558
|
sessionID: activeSessionId,
|
|
504
559
|
directory: options.cwd,
|
|
505
560
|
model: parsedModel,
|
|
561
|
+
tools: promptTools,
|
|
506
562
|
...(agentName !== undefined ? { agent: agentName } : {}),
|
|
507
563
|
...(options.variant !== undefined ? { variant: options.variant } : {}),
|
|
508
564
|
...(options.systemPrompt !== undefined ? { system: options.systemPrompt } : {}),
|
|
565
|
+
// ネイティブ構造化出力: OpenCode がスキーマのキー構造を強制する
|
|
566
|
+
// (enum 等の値制約までは保証されないため、下流のスキーマ検証は維持)。
|
|
567
|
+
...(options.outputSchema !== undefined && !disableNativeStructuredOutput
|
|
568
|
+
? { format: { type: 'json_schema', schema: options.outputSchema, retryCount: 2 } }
|
|
569
|
+
: {}),
|
|
509
570
|
parts: [{ type: 'text', text: prompt }],
|
|
510
571
|
};
|
|
511
572
|
const promptPayloadForSdk = promptPayload;
|
|
@@ -521,9 +582,11 @@ export class OpenCodeClient {
|
|
|
521
582
|
emitInit(options.onStream, options.model, activeSessionId);
|
|
522
583
|
let content = '';
|
|
523
584
|
let success = true;
|
|
585
|
+
let capturedStructuredOutput;
|
|
524
586
|
let failureMessage = '';
|
|
525
587
|
const state = createStreamTrackingState();
|
|
526
588
|
const unavailableToolLoopDetector = new UnavailableToolLoopDetector();
|
|
589
|
+
const invalidArgumentLoopDetector = new InvalidToolArgumentLoopDetector();
|
|
527
590
|
const echoState = { remainingPrompts: buildPromptEchoCandidates(prompt, options.systemPrompt) };
|
|
528
591
|
const textOffsets = new Map();
|
|
529
592
|
const textContentParts = new Map();
|
|
@@ -544,198 +607,267 @@ export class OpenCodeClient {
|
|
|
544
607
|
const prevOffset = textOffsets.get(partId) ?? 0;
|
|
545
608
|
textOffsets.set(partId, prevOffset + rawDelta.length);
|
|
546
609
|
};
|
|
547
|
-
for
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
consumeTextDelta(textPart.id, rawDelta);
|
|
565
|
-
continue;
|
|
610
|
+
// for-await 単体だと、タイマーが abort してもイベントが来るまで
|
|
611
|
+
// 待ちから戻らない(SDK が signal を尊重しない場合は永久待機)。
|
|
612
|
+
// イテレータと abort をレースさせ、タイマー発火で必ず脱出する。
|
|
613
|
+
const streamIterator = stream[Symbol.asyncIterator]();
|
|
614
|
+
const streamAborted = new Promise((_, reject) => {
|
|
615
|
+
streamAbortController.signal.addEventListener('abort', () => {
|
|
616
|
+
reject(new Error(timeoutMessage));
|
|
617
|
+
}, { once: true });
|
|
618
|
+
});
|
|
619
|
+
streamAborted.catch(() => { });
|
|
620
|
+
try {
|
|
621
|
+
while (true) {
|
|
622
|
+
if (streamAbortController.signal.aborted)
|
|
623
|
+
break;
|
|
624
|
+
let iteration;
|
|
625
|
+
try {
|
|
626
|
+
iteration = await Promise.race([streamIterator.next(), streamAborted]);
|
|
566
627
|
}
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
const loopError = toolPart.state.status === 'error'
|
|
570
|
-
? unavailableToolLoopDetector.observe(toolPart.callID || toolPart.id, toolPart.tool, toolPart.state.error)
|
|
571
|
-
: undefined;
|
|
572
|
-
if (toolPart.state.status === 'completed') {
|
|
573
|
-
unavailableToolLoopDetector.reset();
|
|
574
|
-
}
|
|
575
|
-
handlePartUpdated(part, delta, options.onStream, state);
|
|
576
|
-
if (loopError !== undefined) {
|
|
577
|
-
success = false;
|
|
578
|
-
failureMessage = loopError;
|
|
579
|
-
diag.onStreamError('message.part.updated', loopError);
|
|
628
|
+
catch (raceError) {
|
|
629
|
+
if (streamAbortController.signal.aborted)
|
|
580
630
|
break;
|
|
581
|
-
|
|
631
|
+
throw raceError;
|
|
632
|
+
}
|
|
633
|
+
if (iteration.done)
|
|
634
|
+
break;
|
|
635
|
+
const event = iteration.value;
|
|
636
|
+
const sseEvent = event;
|
|
637
|
+
// セッション帰属が判明していて自分でないイベントは処理しない。
|
|
638
|
+
// サーバプールは同一モデルで共有されるため(並列レビュー等)、
|
|
639
|
+
// 兄弟セッションの text/tool 更新を通すと content と検出器が
|
|
640
|
+
// 汚染される。帰属不明のイベントは種別ごとの処理に委ねるが、
|
|
641
|
+
// 無音検出のリセット(延命)は自セッションのイベントに限る。
|
|
642
|
+
const eventSessionId = extractEventSessionId(sseEvent);
|
|
643
|
+
if (eventSessionId !== undefined && eventSessionId !== activeSessionId) {
|
|
582
644
|
continue;
|
|
583
645
|
}
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
}
|
|
587
|
-
if (sseEvent.type === 'message.part.delta') {
|
|
588
|
-
const deltaProps = sseEvent.properties;
|
|
589
|
-
if (deltaProps.field === 'text' && deltaProps.delta) {
|
|
590
|
-
unavailableToolLoopDetector.reset();
|
|
591
|
-
consumeTextDelta(deltaProps.partID, deltaProps.delta);
|
|
646
|
+
if (eventSessionId === activeSessionId) {
|
|
647
|
+
resetIdleTimeout();
|
|
592
648
|
}
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
649
|
+
diag.onFirstEvent(sseEvent.type);
|
|
650
|
+
diag.onEvent(sseEvent.type);
|
|
651
|
+
if (sseEvent.type === 'message.part.updated') {
|
|
652
|
+
const props = sseEvent.properties;
|
|
653
|
+
const part = props.part;
|
|
654
|
+
const delta = props.delta;
|
|
655
|
+
if (part.type === 'text') {
|
|
656
|
+
unavailableToolLoopDetector.reset();
|
|
657
|
+
const textPart = part;
|
|
658
|
+
const prev = textOffsets.get(textPart.id) ?? 0;
|
|
659
|
+
const rawDelta = delta
|
|
660
|
+
?? (textPart.text.length > prev ? textPart.text.slice(prev) : '');
|
|
661
|
+
consumeTextDelta(textPart.id, rawDelta);
|
|
662
|
+
continue;
|
|
663
|
+
}
|
|
664
|
+
if (part.type === 'tool') {
|
|
665
|
+
const toolPart = part;
|
|
666
|
+
let loopError;
|
|
667
|
+
if (toolPart.state.status === 'error') {
|
|
668
|
+
// 両検出器に必ず観測させる(?? 短絡だと invalid 側が
|
|
669
|
+
// unavailable エラーを見逃し、連続性の判定が狂う)
|
|
670
|
+
const unavailableError = unavailableToolLoopDetector.observe(toolPart.callID || toolPart.id, toolPart.tool, toolPart.state.error);
|
|
671
|
+
const invalidArgumentError = invalidArgumentLoopDetector.observe(toolPart.callID || toolPart.id, toolPart.tool, toolPart.state.error);
|
|
672
|
+
loopError = unavailableError ?? invalidArgumentError;
|
|
673
|
+
}
|
|
674
|
+
if (toolPart.state.status === 'completed') {
|
|
675
|
+
unavailableToolLoopDetector.reset();
|
|
676
|
+
invalidArgumentLoopDetector.reset();
|
|
677
|
+
}
|
|
678
|
+
handlePartUpdated(part, delta, options.onStream, state);
|
|
679
|
+
if (loopError !== undefined) {
|
|
614
680
|
success = false;
|
|
615
|
-
failureMessage =
|
|
681
|
+
failureMessage = loopError;
|
|
682
|
+
diag.onStreamError('message.part.updated', loopError);
|
|
616
683
|
break;
|
|
617
684
|
}
|
|
685
|
+
continue;
|
|
618
686
|
}
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
687
|
+
handlePartUpdated(part, delta, options.onStream, state);
|
|
688
|
+
continue;
|
|
689
|
+
}
|
|
690
|
+
if (sseEvent.type === 'message.part.delta') {
|
|
691
|
+
const deltaProps = sseEvent.properties;
|
|
692
|
+
if (deltaProps.field === 'text' && deltaProps.delta) {
|
|
693
|
+
unavailableToolLoopDetector.reset();
|
|
694
|
+
consumeTextDelta(deltaProps.partID, deltaProps.delta);
|
|
623
695
|
}
|
|
696
|
+
continue;
|
|
624
697
|
}
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
const questionProps = sseEvent.properties;
|
|
629
|
-
if (questionProps.sessionID === activeSessionId) {
|
|
630
|
-
const rejectQuestion = () => withTimeout((signal) => opencodeApiClient.question.reject({
|
|
631
|
-
requestID: questionProps.id,
|
|
632
|
-
directory: options.cwd,
|
|
633
|
-
}, { signal }), interactionTimeoutMs, 'OpenCode question reject timed out');
|
|
634
|
-
if (!options.onAskUserQuestion) {
|
|
698
|
+
if (sseEvent.type === 'permission.asked') {
|
|
699
|
+
const permProps = sseEvent.properties;
|
|
700
|
+
if (permProps.sessionID === activeSessionId) {
|
|
635
701
|
try {
|
|
636
|
-
|
|
702
|
+
const reply = resolveOpenCodePermissionReply(options.permissionMode, permProps.permission, options.allowedTools !== undefined ? permissionRuleset : undefined);
|
|
703
|
+
emitPermissionAsked(options.onStream, {
|
|
704
|
+
requestId: permProps.id,
|
|
705
|
+
sessionId: permProps.sessionID,
|
|
706
|
+
permission: permProps.permission ?? '',
|
|
707
|
+
patterns: Array.isArray(permProps.patterns) ? permProps.patterns : [],
|
|
708
|
+
always: Array.isArray(permProps.always) ? permProps.always : [],
|
|
709
|
+
reply,
|
|
710
|
+
});
|
|
711
|
+
await withTimeout((signal) => opencodeApiClient.permission.reply({
|
|
712
|
+
requestID: permProps.id,
|
|
713
|
+
directory: options.cwd,
|
|
714
|
+
reply,
|
|
715
|
+
}, { signal }), interactionTimeoutMs, 'OpenCode permission reply timed out');
|
|
716
|
+
if (reply === 'reject') {
|
|
717
|
+
// A rejected permission is a per-tool failure, not a fatal
|
|
718
|
+
// one: OpenCode returns the rejection to the model as a tool
|
|
719
|
+
// error and generation continues (verified against a live
|
|
720
|
+
// server). Aborting here used to turn a single stray
|
|
721
|
+
// out-of-workspace access into a whole-step failure.
|
|
722
|
+
log.info(buildPermissionRejectedMessage(permProps.permission), {
|
|
723
|
+
permission: permProps.permission,
|
|
724
|
+
patterns: permProps.patterns,
|
|
725
|
+
});
|
|
726
|
+
}
|
|
637
727
|
}
|
|
638
728
|
catch (e) {
|
|
639
729
|
success = false;
|
|
640
730
|
failureMessage = getErrorMessage(e);
|
|
641
731
|
break;
|
|
642
732
|
}
|
|
643
|
-
continue;
|
|
644
733
|
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
734
|
+
continue;
|
|
735
|
+
}
|
|
736
|
+
if (sseEvent.type === 'question.asked') {
|
|
737
|
+
const questionProps = sseEvent.properties;
|
|
738
|
+
if (questionProps.sessionID === activeSessionId) {
|
|
739
|
+
const rejectQuestion = () => withTimeout((signal) => opencodeApiClient.question.reject({
|
|
648
740
|
requestID: questionProps.id,
|
|
649
741
|
directory: options.cwd,
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
}
|
|
653
|
-
catch (e) {
|
|
654
|
-
if (e instanceof AskUserQuestionDeniedError) {
|
|
742
|
+
}, { signal }), interactionTimeoutMs, 'OpenCode question reject timed out');
|
|
743
|
+
if (!options.onAskUserQuestion) {
|
|
655
744
|
try {
|
|
656
745
|
await rejectQuestion();
|
|
657
746
|
}
|
|
658
|
-
catch (
|
|
747
|
+
catch (e) {
|
|
748
|
+
success = false;
|
|
749
|
+
failureMessage = getErrorMessage(e);
|
|
750
|
+
break;
|
|
751
|
+
}
|
|
752
|
+
continue;
|
|
753
|
+
}
|
|
754
|
+
try {
|
|
755
|
+
const answers = await options.onAskUserQuestion(toQuestionInput(questionProps));
|
|
756
|
+
await withTimeout((signal) => opencodeApiClient.question.reply({
|
|
757
|
+
requestID: questionProps.id,
|
|
758
|
+
directory: options.cwd,
|
|
759
|
+
answers: toQuestionAnswers(questionProps, answers),
|
|
760
|
+
}, { signal }), interactionTimeoutMs, 'OpenCode question reply timed out');
|
|
761
|
+
}
|
|
762
|
+
catch (e) {
|
|
763
|
+
if (e instanceof AskUserQuestionDeniedError) {
|
|
764
|
+
try {
|
|
765
|
+
await rejectQuestion();
|
|
766
|
+
}
|
|
767
|
+
catch (rejectErr) {
|
|
768
|
+
success = false;
|
|
769
|
+
failureMessage = getErrorMessage(rejectErr);
|
|
770
|
+
break;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
else {
|
|
659
774
|
success = false;
|
|
660
|
-
failureMessage = getErrorMessage(
|
|
775
|
+
failureMessage = getErrorMessage(e);
|
|
661
776
|
break;
|
|
662
777
|
}
|
|
663
778
|
}
|
|
664
|
-
|
|
779
|
+
}
|
|
780
|
+
continue;
|
|
781
|
+
}
|
|
782
|
+
if (sseEvent.type === 'message.updated') {
|
|
783
|
+
const messageProps = sseEvent.properties;
|
|
784
|
+
const info = messageProps.info;
|
|
785
|
+
const isCurrentAssistantMessage = info?.sessionID === activeSessionId && info?.role === 'assistant';
|
|
786
|
+
if (isCurrentAssistantMessage) {
|
|
787
|
+
if (info?.structured !== undefined && info.structured !== null && typeof info.structured === 'object' && !Array.isArray(info.structured)) {
|
|
788
|
+
capturedStructuredOutput = info.structured;
|
|
789
|
+
}
|
|
790
|
+
const streamError = extractOpenCodeErrorMessage(info?.error);
|
|
791
|
+
if (streamError) {
|
|
665
792
|
success = false;
|
|
666
|
-
failureMessage =
|
|
793
|
+
failureMessage = streamError;
|
|
794
|
+
diag.onStreamError('message.updated', streamError);
|
|
667
795
|
break;
|
|
668
796
|
}
|
|
669
797
|
}
|
|
798
|
+
continue;
|
|
670
799
|
}
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
800
|
+
if (sseEvent.type === 'message.completed') {
|
|
801
|
+
const completedProps = sseEvent.properties;
|
|
802
|
+
const info = completedProps.info;
|
|
803
|
+
const isCurrentAssistantMessage = info?.sessionID === activeSessionId && info?.role === 'assistant';
|
|
804
|
+
if (isCurrentAssistantMessage) {
|
|
805
|
+
if (info?.structured !== undefined && info.structured !== null && typeof info.structured === 'object' && !Array.isArray(info.structured)) {
|
|
806
|
+
capturedStructuredOutput = info.structured;
|
|
807
|
+
}
|
|
808
|
+
const streamError = extractOpenCodeErrorMessage(info?.error);
|
|
809
|
+
if (streamError) {
|
|
810
|
+
success = false;
|
|
811
|
+
failureMessage = streamError;
|
|
812
|
+
diag.onStreamError('message.completed', streamError);
|
|
813
|
+
break;
|
|
814
|
+
}
|
|
684
815
|
}
|
|
816
|
+
continue;
|
|
685
817
|
}
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
const isCurrentAssistantMessage = info?.sessionID === activeSessionId && info?.role === 'assistant';
|
|
692
|
-
if (isCurrentAssistantMessage) {
|
|
693
|
-
const streamError = extractOpenCodeErrorMessage(info?.error);
|
|
694
|
-
if (streamError) {
|
|
818
|
+
if (sseEvent.type === 'message.failed') {
|
|
819
|
+
const failedProps = sseEvent.properties;
|
|
820
|
+
const info = failedProps.info;
|
|
821
|
+
const isCurrentAssistantMessage = info?.sessionID === activeSessionId && info?.role === 'assistant';
|
|
822
|
+
if (isCurrentAssistantMessage) {
|
|
695
823
|
success = false;
|
|
696
|
-
failureMessage =
|
|
697
|
-
diag.onStreamError('message.
|
|
824
|
+
failureMessage = extractOpenCodeErrorMessage(info?.error) ?? 'OpenCode message failed';
|
|
825
|
+
diag.onStreamError('message.failed', failureMessage);
|
|
698
826
|
break;
|
|
699
827
|
}
|
|
828
|
+
continue;
|
|
700
829
|
}
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
if (isCurrentAssistantMessage) {
|
|
708
|
-
success = false;
|
|
709
|
-
failureMessage = extractOpenCodeErrorMessage(info?.error) ?? 'OpenCode message failed';
|
|
710
|
-
diag.onStreamError('message.failed', failureMessage);
|
|
711
|
-
break;
|
|
830
|
+
if (sseEvent.type === 'session.status') {
|
|
831
|
+
const statusProps = sseEvent.properties;
|
|
832
|
+
if (statusProps.sessionID === activeSessionId && statusProps.status?.type === 'idle') {
|
|
833
|
+
break;
|
|
834
|
+
}
|
|
835
|
+
continue;
|
|
712
836
|
}
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
837
|
+
if (sseEvent.type === 'session.idle') {
|
|
838
|
+
const idleProps = sseEvent.properties;
|
|
839
|
+
if (idleProps.sessionID === activeSessionId) {
|
|
840
|
+
break;
|
|
841
|
+
}
|
|
842
|
+
continue;
|
|
719
843
|
}
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
844
|
+
if (sseEvent.type === 'session.error') {
|
|
845
|
+
const errorProps = sseEvent.properties;
|
|
846
|
+
if (!errorProps.sessionID || errorProps.sessionID === activeSessionId) {
|
|
847
|
+
success = false;
|
|
848
|
+
failureMessage = extractOpenCodeErrorMessage(errorProps.error) ?? 'OpenCode session error';
|
|
849
|
+
diag.onStreamError('session.error', failureMessage);
|
|
850
|
+
break;
|
|
851
|
+
}
|
|
852
|
+
continue;
|
|
726
853
|
}
|
|
727
|
-
continue;
|
|
728
854
|
}
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
diag.onStreamError('session.error', failureMessage);
|
|
735
|
-
break;
|
|
736
|
-
}
|
|
737
|
-
continue;
|
|
855
|
+
}
|
|
856
|
+
finally {
|
|
857
|
+
// for-await が break 時に行っていた後始末(SSE クローズ)を再現する
|
|
858
|
+
try {
|
|
859
|
+
await streamIterator.return?.(undefined);
|
|
738
860
|
}
|
|
861
|
+
catch { /* クローズ失敗は結果に影響させない */ }
|
|
862
|
+
}
|
|
863
|
+
// The idle watchdog and external aborts cancel the stream. If the
|
|
864
|
+
// iterator ends without throwing, the loop falls through with
|
|
865
|
+
// success still true - do not let a timed-out or aborted stream
|
|
866
|
+
// pass as a completed call (a stalled stream after a rejected
|
|
867
|
+
// permission would otherwise be reported as done).
|
|
868
|
+
if (success && streamAbortController.signal.aborted && (abortCause === 'timeout' || abortCause === 'external')) {
|
|
869
|
+
success = false;
|
|
870
|
+
failureMessage = abortCause === 'timeout' ? timeoutMessage : OPENCODE_STREAM_ABORTED_MESSAGE;
|
|
739
871
|
}
|
|
740
872
|
content = [...textContentParts.values()].join('\n');
|
|
741
873
|
if (!success && !streamAbortController.signal.aborted) {
|
|
@@ -759,6 +891,27 @@ export class OpenCodeClient {
|
|
|
759
891
|
emitResult(options.onStream, false, rateLimitedResponse.error ?? rateLimitedResponse.content, activeSessionId);
|
|
760
892
|
return rateLimitedResponse;
|
|
761
893
|
}
|
|
894
|
+
const lowerMessage = message.toLowerCase();
|
|
895
|
+
// Failures that point at the native json_schema request itself: a
|
|
896
|
+
// model that never emits the StructuredOutput tool ("did not produce
|
|
897
|
+
// structured output"), or a gateway/model that rejects the json_schema
|
|
898
|
+
// response format outright (surfaced as an upstream request error).
|
|
899
|
+
// These fall back to formatless structured output; generic transient
|
|
900
|
+
// errors (transport/network) must not, or they would burn the one-shot
|
|
901
|
+
// fallback budget before a real format failure arrives.
|
|
902
|
+
const isNativeStructuredOutputFailure = lowerMessage.includes('did not produce structured output')
|
|
903
|
+
|| lowerMessage.includes('upstream request failed');
|
|
904
|
+
if (options.outputSchema !== undefined
|
|
905
|
+
&& !disableNativeStructuredOutput
|
|
906
|
+
&& isNativeStructuredOutputFailure) {
|
|
907
|
+
// Fall back to formatless structured output once — hand-written JSON
|
|
908
|
+
// validated by the downstream correction retry — before giving up.
|
|
909
|
+
disableNativeStructuredOutput = true;
|
|
910
|
+
maxAttempts = Math.max(maxAttempts, attempt + 1);
|
|
911
|
+
log.info('Native structured output failed; retrying without json_schema format', { agentType, attempt, message });
|
|
912
|
+
await this.waitForRetryDelay(attempt, options.abortSignal);
|
|
913
|
+
continue;
|
|
914
|
+
}
|
|
762
915
|
const retriable = this.isRetriableError(message, streamAbortController.signal.aborted, abortCause);
|
|
763
916
|
if (retriable && attempt < OPENCODE_RETRY_MAX_ATTEMPTS) {
|
|
764
917
|
log.info('Retrying OpenCode call after transient failure', { agentType, attempt, message });
|
|
@@ -770,18 +923,41 @@ export class OpenCodeClient {
|
|
|
770
923
|
persona: agentType,
|
|
771
924
|
status: 'error',
|
|
772
925
|
content: message,
|
|
926
|
+
error: message,
|
|
773
927
|
timestamp: new Date(),
|
|
774
928
|
sessionId: activeSessionId,
|
|
775
929
|
};
|
|
776
930
|
}
|
|
777
931
|
const trimmed = content.trim();
|
|
778
932
|
emitResult(options.onStream, true, trimmed, activeSessionId);
|
|
933
|
+
// format 要求時に structured がイベントで捕捉できなかった場合は、
|
|
934
|
+
// 本文の末尾 JSON をフォールバックとして採取する(検証は下流で行う)。
|
|
935
|
+
if (capturedStructuredOutput === undefined && options.outputSchema !== undefined) {
|
|
936
|
+
try {
|
|
937
|
+
const parsed = parseLastJsonBlock(trimmed);
|
|
938
|
+
if (typeof parsed === 'object' && parsed !== null && !Array.isArray(parsed)) {
|
|
939
|
+
capturedStructuredOutput = parsed;
|
|
940
|
+
}
|
|
941
|
+
else {
|
|
942
|
+
log.debug('Structured output fallback found non-object JSON', { agentType });
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
catch (fallbackError) {
|
|
946
|
+
// フォールバック採取の失敗は握りつぶすが、調査用に痕跡は残す
|
|
947
|
+
// (下流の検証と是正リトライに委ねる)。
|
|
948
|
+
log.debug('Structured output fallback extraction failed', {
|
|
949
|
+
agentType,
|
|
950
|
+
error: getErrorMessage(fallbackError),
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
}
|
|
779
954
|
return {
|
|
780
955
|
persona: agentType,
|
|
781
956
|
status: 'done',
|
|
782
957
|
content: trimmed,
|
|
783
958
|
timestamp: new Date(),
|
|
784
959
|
sessionId: activeSessionId,
|
|
960
|
+
...(capturedStructuredOutput !== undefined ? { structuredOutput: capturedStructuredOutput } : {}),
|
|
785
961
|
};
|
|
786
962
|
}
|
|
787
963
|
catch (error) {
|
|
@@ -814,6 +990,7 @@ export class OpenCodeClient {
|
|
|
814
990
|
persona: agentType,
|
|
815
991
|
status: 'error',
|
|
816
992
|
content: errorMessage,
|
|
993
|
+
error: errorMessage,
|
|
817
994
|
timestamp: new Date(),
|
|
818
995
|
sessionId,
|
|
819
996
|
};
|