takt 0.3.9 → 0.4.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 +364 -325
- package/dist/agents/index.d.ts +1 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +1 -1
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/runner.d.ts +0 -1
- package/dist/agents/runner.d.ts.map +1 -1
- package/dist/agents/runner.js +6 -5
- package/dist/agents/runner.js.map +1 -1
- package/dist/agents/types.d.ts +3 -1
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/app/cli/commands.d.ts +1 -1
- package/dist/app/cli/commands.js +9 -1
- package/dist/app/cli/commands.js.map +1 -1
- package/dist/app/cli/routing.js +1 -0
- package/dist/app/cli/routing.js.map +1 -1
- package/dist/core/models/index.d.ts +1 -1
- package/dist/core/models/index.d.ts.map +1 -1
- package/dist/core/models/schemas.d.ts +8 -6
- package/dist/core/models/schemas.d.ts.map +1 -1
- package/dist/core/models/schemas.js +16 -15
- package/dist/core/models/schemas.js.map +1 -1
- package/dist/core/models/types.d.ts +1 -1
- package/dist/core/models/types.d.ts.map +1 -1
- package/dist/core/models/workflow-types.d.ts +26 -24
- package/dist/core/models/workflow-types.d.ts.map +1 -1
- package/dist/core/workflow/constants.d.ts +7 -7
- package/dist/core/workflow/constants.d.ts.map +1 -1
- package/dist/core/workflow/constants.js +7 -7
- package/dist/core/workflow/constants.js.map +1 -1
- package/dist/core/workflow/engine/MovementExecutor.d.ts +59 -0
- package/dist/core/workflow/engine/MovementExecutor.d.ts.map +1 -0
- package/dist/core/workflow/engine/{StepExecutor.js → MovementExecutor.js} +30 -25
- package/dist/core/workflow/engine/MovementExecutor.js.map +1 -0
- package/dist/core/workflow/engine/OptionsBuilder.d.ts +6 -6
- package/dist/core/workflow/engine/OptionsBuilder.d.ts.map +1 -1
- package/dist/core/workflow/engine/OptionsBuilder.js +8 -3
- package/dist/core/workflow/engine/OptionsBuilder.js.map +1 -1
- package/dist/core/workflow/engine/ParallelRunner.d.ts +12 -10
- package/dist/core/workflow/engine/ParallelRunner.d.ts.map +1 -1
- package/dist/core/workflow/engine/ParallelRunner.js +46 -41
- package/dist/core/workflow/engine/ParallelRunner.js.map +1 -1
- package/dist/core/workflow/engine/WorkflowEngine.d.ts +16 -16
- package/dist/core/workflow/engine/WorkflowEngine.d.ts.map +1 -1
- package/dist/core/workflow/engine/WorkflowEngine.js +105 -92
- package/dist/core/workflow/engine/WorkflowEngine.js.map +1 -1
- package/dist/core/workflow/engine/blocked-handler.d.ts +3 -3
- package/dist/core/workflow/engine/blocked-handler.d.ts.map +1 -1
- package/dist/core/workflow/engine/blocked-handler.js +2 -2
- package/dist/core/workflow/engine/blocked-handler.js.map +1 -1
- package/dist/core/workflow/engine/index.d.ts +2 -1
- package/dist/core/workflow/engine/index.d.ts.map +1 -1
- package/dist/core/workflow/engine/index.js +1 -1
- package/dist/core/workflow/engine/index.js.map +1 -1
- package/dist/core/workflow/engine/loop-detector.d.ts +5 -5
- package/dist/core/workflow/engine/loop-detector.d.ts.map +1 -1
- package/dist/core/workflow/engine/loop-detector.js +8 -8
- package/dist/core/workflow/engine/loop-detector.js.map +1 -1
- package/dist/core/workflow/engine/parallel-logger.d.ts +15 -15
- package/dist/core/workflow/engine/parallel-logger.d.ts.map +1 -1
- package/dist/core/workflow/engine/parallel-logger.js +22 -21
- package/dist/core/workflow/engine/parallel-logger.js.map +1 -1
- package/dist/core/workflow/engine/state-manager.d.ts +6 -6
- package/dist/core/workflow/engine/state-manager.d.ts.map +1 -1
- package/dist/core/workflow/engine/state-manager.js +15 -16
- package/dist/core/workflow/engine/state-manager.js.map +1 -1
- package/dist/core/workflow/engine/transitions.d.ts +5 -5
- package/dist/core/workflow/engine/transitions.d.ts.map +1 -1
- package/dist/core/workflow/engine/transitions.js +4 -4
- package/dist/core/workflow/engine/transitions.js.map +1 -1
- package/dist/core/workflow/evaluation/AggregateEvaluator.d.ts +15 -15
- package/dist/core/workflow/evaluation/AggregateEvaluator.d.ts.map +1 -1
- package/dist/core/workflow/evaluation/AggregateEvaluator.js +35 -33
- package/dist/core/workflow/evaluation/AggregateEvaluator.js.map +1 -1
- package/dist/core/workflow/evaluation/RuleEvaluator.d.ts +8 -8
- package/dist/core/workflow/evaluation/RuleEvaluator.d.ts.map +1 -1
- package/dist/core/workflow/evaluation/RuleEvaluator.js +18 -14
- package/dist/core/workflow/evaluation/RuleEvaluator.js.map +1 -1
- package/dist/core/workflow/evaluation/index.d.ts +4 -4
- package/dist/core/workflow/evaluation/index.d.ts.map +1 -1
- package/dist/core/workflow/evaluation/index.js +1 -1
- package/dist/core/workflow/evaluation/index.js.map +1 -1
- package/dist/core/workflow/evaluation/rule-utils.d.ts +4 -4
- package/dist/core/workflow/evaluation/rule-utils.d.ts.map +1 -1
- package/dist/core/workflow/evaluation/rule-utils.js +2 -2
- package/dist/core/workflow/evaluation/rule-utils.js.map +1 -1
- package/dist/core/workflow/index.d.ts +6 -6
- package/dist/core/workflow/index.d.ts.map +1 -1
- package/dist/core/workflow/index.js +5 -5
- package/dist/core/workflow/index.js.map +1 -1
- package/dist/core/workflow/instruction/InstructionBuilder.d.ts +17 -15
- package/dist/core/workflow/instruction/InstructionBuilder.d.ts.map +1 -1
- package/dist/core/workflow/instruction/InstructionBuilder.js +105 -120
- package/dist/core/workflow/instruction/InstructionBuilder.js.map +1 -1
- package/dist/core/workflow/instruction/ReportInstructionBuilder.d.ts +10 -11
- package/dist/core/workflow/instruction/ReportInstructionBuilder.d.ts.map +1 -1
- package/dist/core/workflow/instruction/ReportInstructionBuilder.js +38 -84
- package/dist/core/workflow/instruction/ReportInstructionBuilder.js.map +1 -1
- package/dist/core/workflow/instruction/StatusJudgmentBuilder.d.ts +6 -5
- package/dist/core/workflow/instruction/StatusJudgmentBuilder.d.ts.map +1 -1
- package/dist/core/workflow/instruction/StatusJudgmentBuilder.js +14 -22
- package/dist/core/workflow/instruction/StatusJudgmentBuilder.js.map +1 -1
- package/dist/core/workflow/instruction/escape.d.ts +3 -3
- package/dist/core/workflow/instruction/escape.d.ts.map +1 -1
- package/dist/core/workflow/instruction/escape.js +3 -3
- package/dist/core/workflow/instruction/escape.js.map +1 -1
- package/dist/core/workflow/instruction/instruction-context.d.ts +16 -49
- package/dist/core/workflow/instruction/instruction-context.d.ts.map +1 -1
- package/dist/core/workflow/instruction/instruction-context.js +17 -62
- package/dist/core/workflow/instruction/instruction-context.js.map +1 -1
- package/dist/core/workflow/instruction/status-rules.d.ts +19 -14
- package/dist/core/workflow/instruction/status-rules.d.ts.map +1 -1
- package/dist/core/workflow/instruction/status-rules.js +47 -66
- package/dist/core/workflow/instruction/status-rules.js.map +1 -1
- package/dist/core/workflow/phase-runner.d.ts +14 -8
- package/dist/core/workflow/phase-runner.d.ts.map +1 -1
- package/dist/core/workflow/phase-runner.js +75 -78
- package/dist/core/workflow/phase-runner.js.map +1 -1
- package/dist/core/workflow/types.d.ts +15 -12
- package/dist/core/workflow/types.d.ts.map +1 -1
- package/dist/features/config/ejectBuiltin.js +3 -3
- package/dist/features/config/ejectBuiltin.js.map +1 -1
- package/dist/features/interactive/interactive.d.ts.map +1 -1
- package/dist/features/interactive/interactive.js +38 -169
- package/dist/features/interactive/interactive.js.map +1 -1
- package/dist/features/prompt/index.d.ts +5 -0
- package/dist/features/prompt/index.d.ts.map +1 -0
- package/dist/features/prompt/index.js +5 -0
- package/dist/features/prompt/index.js.map +1 -0
- package/dist/features/prompt/preview.d.ts +14 -0
- package/dist/features/prompt/preview.d.ts.map +1 -0
- package/dist/features/prompt/preview.js +74 -0
- package/dist/features/prompt/preview.js.map +1 -0
- package/dist/features/tasks/add/index.d.ts +6 -9
- package/dist/features/tasks/add/index.d.ts.map +1 -1
- package/dist/features/tasks/add/index.js +23 -55
- package/dist/features/tasks/add/index.js.map +1 -1
- package/dist/features/tasks/execute/selectAndExecute.d.ts.map +1 -1
- package/dist/features/tasks/execute/selectAndExecute.js +1 -0
- package/dist/features/tasks/execute/selectAndExecute.js.map +1 -1
- package/dist/features/tasks/execute/taskExecution.d.ts.map +1 -1
- package/dist/features/tasks/execute/taskExecution.js +4 -3
- package/dist/features/tasks/execute/taskExecution.js.map +1 -1
- package/dist/features/tasks/execute/types.d.ts +13 -0
- package/dist/features/tasks/execute/types.d.ts.map +1 -1
- package/dist/features/tasks/execute/workflowExecution.d.ts.map +1 -1
- package/dist/features/tasks/execute/workflowExecution.js +63 -18
- package/dist/features/tasks/execute/workflowExecution.js.map +1 -1
- package/dist/features/tasks/index.d.ts +1 -1
- package/dist/features/tasks/index.d.ts.map +1 -1
- package/dist/features/tasks/index.js +1 -1
- package/dist/features/tasks/index.js.map +1 -1
- package/dist/features/tasks/list/index.d.ts.map +1 -1
- package/dist/features/tasks/list/index.js +0 -1
- package/dist/features/tasks/list/index.js.map +1 -1
- package/dist/features/tasks/list/taskActions.d.ts +1 -0
- package/dist/features/tasks/list/taskActions.d.ts.map +1 -1
- package/dist/features/tasks/list/taskActions.js +24 -1
- package/dist/features/tasks/list/taskActions.js.map +1 -1
- package/dist/features/workflowSelection/index.js +1 -1
- package/dist/features/workflowSelection/index.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/infra/claude/client.d.ts +1 -1
- package/dist/infra/claude/client.d.ts.map +1 -1
- package/dist/infra/claude/client.js +6 -24
- package/dist/infra/claude/client.js.map +1 -1
- package/dist/infra/claude/executor.d.ts +0 -1
- package/dist/infra/claude/executor.d.ts.map +1 -1
- package/dist/infra/claude/executor.js +0 -2
- package/dist/infra/claude/executor.js.map +1 -1
- package/dist/infra/claude/index.js +2 -2
- package/dist/infra/claude/index.js.map +1 -1
- package/dist/infra/claude/options-builder.js +4 -4
- package/dist/infra/claude/options-builder.js.map +1 -1
- package/dist/infra/claude/process.d.ts +1 -1
- package/dist/infra/claude/process.d.ts.map +1 -1
- package/dist/infra/claude/process.js +1 -1
- package/dist/infra/claude/process.js.map +1 -1
- package/dist/infra/claude/query-manager.d.ts +1 -1
- package/dist/infra/claude/query-manager.d.ts.map +1 -1
- package/dist/infra/claude/query-manager.js +1 -2
- package/dist/infra/claude/query-manager.js.map +1 -1
- package/dist/infra/claude/stream-converter.d.ts +2 -2
- package/dist/infra/claude/stream-converter.js +2 -2
- package/dist/infra/claude/types.d.ts +1 -1
- package/dist/infra/claude/types.d.ts.map +1 -1
- package/dist/infra/codex/client.d.ts.map +1 -1
- package/dist/infra/codex/client.js +0 -1
- package/dist/infra/codex/client.js.map +1 -1
- package/dist/infra/config/global/globalConfig.d.ts.map +1 -1
- package/dist/infra/config/global/globalConfig.js +0 -1
- package/dist/infra/config/global/globalConfig.js.map +1 -1
- package/dist/infra/config/loaders/agentLoader.d.ts +1 -1
- package/dist/infra/config/loaders/agentLoader.d.ts.map +1 -1
- package/dist/infra/config/loaders/agentLoader.js +6 -5
- package/dist/infra/config/loaders/agentLoader.js.map +1 -1
- package/dist/infra/config/loaders/loader.d.ts +1 -1
- package/dist/infra/config/loaders/loader.js +1 -1
- package/dist/infra/config/loaders/workflowParser.d.ts.map +1 -1
- package/dist/infra/config/loaders/workflowParser.js +9 -5
- package/dist/infra/config/loaders/workflowParser.js.map +1 -1
- package/dist/infra/config/loaders/workflowResolver.d.ts +4 -4
- package/dist/infra/config/loaders/workflowResolver.js +11 -11
- package/dist/infra/config/loaders/workflowResolver.js.map +1 -1
- package/dist/infra/config/paths.d.ts +4 -4
- package/dist/infra/config/paths.d.ts.map +1 -1
- package/dist/infra/config/paths.js +7 -7
- package/dist/infra/config/paths.js.map +1 -1
- package/dist/infra/config/project/index.d.ts +1 -1
- package/dist/infra/config/project/index.d.ts.map +1 -1
- package/dist/infra/config/project/index.js.map +1 -1
- package/dist/infra/config/project/projectConfig.d.ts +2 -2
- package/dist/infra/config/project/projectConfig.d.ts.map +1 -1
- package/dist/infra/config/types.d.ts +0 -2
- package/dist/infra/config/types.d.ts.map +1 -1
- package/dist/infra/fs/index.d.ts +1 -1
- package/dist/infra/fs/index.d.ts.map +1 -1
- package/dist/infra/fs/index.js.map +1 -1
- package/dist/infra/fs/session.d.ts +1 -1
- package/dist/infra/fs/session.d.ts.map +1 -1
- package/dist/infra/fs/session.js +0 -1
- package/dist/infra/fs/session.js.map +1 -1
- package/dist/infra/providers/index.d.ts.map +1 -1
- package/dist/infra/providers/index.js +0 -1
- package/dist/infra/providers/index.js.map +1 -1
- package/dist/infra/task/autoCommit.js +1 -1
- package/dist/infra/task/autoCommit.js.map +1 -1
- package/dist/infra/task/branchList.d.ts +4 -2
- package/dist/infra/task/branchList.d.ts.map +1 -1
- package/dist/infra/task/branchList.js +87 -9
- package/dist/infra/task/branchList.js.map +1 -1
- package/dist/infra/task/clone.js +1 -1
- package/dist/infra/task/clone.js.map +1 -1
- package/dist/infra/task/parser.d.ts +1 -1
- package/dist/infra/task/parser.js +1 -1
- package/dist/infra/task/summarize.d.ts.map +1 -1
- package/dist/infra/task/summarize.js +3 -15
- package/dist/infra/task/summarize.js.map +1 -1
- package/dist/infra/task/types.d.ts +1 -0
- package/dist/infra/task/types.d.ts.map +1 -1
- package/dist/shared/context.d.ts.map +1 -1
- package/dist/shared/context.js +0 -1
- package/dist/shared/context.js.map +1 -1
- package/dist/shared/i18n/index.d.ts +31 -0
- package/dist/shared/i18n/index.d.ts.map +1 -0
- package/dist/shared/i18n/index.js +97 -0
- package/dist/shared/i18n/index.js.map +1 -0
- package/dist/shared/i18n/labels_en.yaml +37 -0
- package/dist/shared/i18n/labels_ja.yaml +37 -0
- package/dist/shared/prompt/select.d.ts +0 -3
- package/dist/shared/prompt/select.d.ts.map +1 -1
- package/dist/shared/prompt/select.js +5 -20
- package/dist/shared/prompt/select.js.map +1 -1
- package/dist/shared/prompts/en/perform_agent_system_prompt.md +7 -0
- package/dist/shared/prompts/en/perform_builtin_agent_system_prompt.md +7 -0
- package/dist/shared/prompts/en/perform_judge_message.md +24 -0
- package/dist/shared/prompts/en/perform_phase1_message.md +45 -0
- package/dist/shared/prompts/en/perform_phase2_message.md +31 -0
- package/dist/shared/prompts/en/perform_phase3_message.md +19 -0
- package/dist/shared/prompts/en/score_interactive_system_prompt.md +53 -0
- package/dist/shared/prompts/en/score_slug_system_prompt.md +19 -0
- package/dist/shared/prompts/en/score_summary_system_prompt.md +25 -0
- package/dist/shared/prompts/index.d.ts +27 -0
- package/dist/shared/prompts/index.d.ts.map +1 -0
- package/dist/shared/prompts/index.js +111 -0
- package/dist/shared/prompts/index.js.map +1 -0
- package/dist/shared/prompts/ja/perform_agent_system_prompt.md +7 -0
- package/dist/shared/prompts/ja/perform_builtin_agent_system_prompt.md +7 -0
- package/dist/shared/prompts/ja/perform_judge_message.md +24 -0
- package/dist/shared/prompts/ja/perform_phase1_message.md +44 -0
- package/dist/shared/prompts/ja/perform_phase2_message.md +30 -0
- package/dist/shared/prompts/ja/perform_phase3_message.md +19 -0
- package/dist/shared/prompts/ja/score_interactive_system_prompt.md +59 -0
- package/dist/shared/prompts/ja/score_slug_system_prompt.md +19 -0
- package/dist/shared/prompts/ja/score_summary_system_prompt.md +32 -0
- package/dist/shared/ui/LogManager.d.ts +1 -1
- package/dist/shared/ui/LogManager.d.ts.map +1 -1
- package/dist/shared/ui/LogManager.js +1 -2
- package/dist/shared/ui/LogManager.js.map +1 -1
- package/dist/shared/utils/debug.js +1 -1
- package/dist/shared/utils/debug.js.map +1 -1
- package/dist/shared/utils/types.d.ts +29 -1
- package/dist/shared/utils/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/resources/global/en/{workflows → pieces}/default.yaml +16 -16
- package/resources/global/en/{workflows → pieces}/expert-cqrs.yaml +17 -17
- package/resources/global/en/{workflows → pieces}/expert.yaml +20 -20
- package/resources/global/en/{workflows → pieces}/magi.yaml +4 -4
- package/resources/global/en/{workflows → pieces}/minimal.yaml +7 -7
- package/resources/global/en/{workflows → pieces}/research.yaml +11 -11
- package/resources/global/en/{workflows → pieces}/review-fix-minimal.yaml +8 -8
- package/resources/global/en/{workflows → pieces}/review-only.yaml +7 -7
- package/resources/global/ja/agents/default/architecture-reviewer.md +3 -3
- package/resources/global/ja/agents/default/supervisor.md +1 -1
- package/resources/global/ja/agents/templates/planner.md +1 -1
- package/resources/global/ja/{workflows → pieces}/default.yaml +12 -12
- package/resources/global/ja/{workflows → pieces}/expert-cqrs.yaml +18 -18
- package/resources/global/ja/{workflows → pieces}/expert.yaml +15 -15
- package/resources/global/ja/{workflows → pieces}/magi.yaml +4 -4
- package/resources/global/ja/{workflows → pieces}/minimal.yaml +8 -8
- package/resources/global/ja/{workflows → pieces}/research.yaml +11 -11
- package/resources/global/ja/{workflows → pieces}/review-fix-minimal.yaml +8 -8
- package/resources/global/ja/{workflows → pieces}/review-only.yaml +7 -7
- package/dist/core/workflow/engine/StepExecutor.d.ts +0 -52
- package/dist/core/workflow/engine/StepExecutor.d.ts.map +0 -1
- package/dist/core/workflow/engine/StepExecutor.js.map +0 -1
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Aggregate condition evaluator for parallel workflow
|
|
2
|
+
* Aggregate condition evaluator for parallel workflow movements
|
|
3
3
|
*
|
|
4
|
-
* Evaluates all()/any() aggregate conditions against sub-
|
|
4
|
+
* Evaluates all()/any() aggregate conditions against sub-movement results.
|
|
5
5
|
*/
|
|
6
6
|
import { createLogger } from '../../../shared/utils/index.js';
|
|
7
7
|
const log = createLogger('aggregate-evaluator');
|
|
8
8
|
/**
|
|
9
|
-
* Evaluates aggregate conditions (all()/any()) for parallel parent
|
|
9
|
+
* Evaluates aggregate conditions (all()/any()) for parallel parent movements.
|
|
10
10
|
*
|
|
11
|
-
* For each aggregate rule, checks the matched condition text of sub-
|
|
12
|
-
* - all("X"): true when ALL sub-
|
|
13
|
-
* - all("A", "B"): true when 1st sub-
|
|
14
|
-
* - any("X"): true when at least ONE sub-
|
|
15
|
-
* - any("A", "B"): true when at least ONE sub-
|
|
11
|
+
* For each aggregate rule, checks the matched condition text of sub-movements:
|
|
12
|
+
* - all("X"): true when ALL sub-movements have matched condition === X
|
|
13
|
+
* - all("A", "B"): true when 1st sub-movement matches "A" AND 2nd sub-movement matches "B" (order-based)
|
|
14
|
+
* - any("X"): true when at least ONE sub-movement has matched condition === X
|
|
15
|
+
* - any("A", "B"): true when at least ONE sub-movement matches "A" OR "B"
|
|
16
16
|
*
|
|
17
17
|
* Edge cases per spec:
|
|
18
|
-
* - Sub-
|
|
19
|
-
* - No sub-
|
|
20
|
-
* - Non-parallel
|
|
21
|
-
* - all("A", "B") with wrong number of sub-
|
|
18
|
+
* - Sub-movement with no matched rule: all() → false, any() → skip that sub-movement
|
|
19
|
+
* - No sub-movements (0 件): both → false
|
|
20
|
+
* - Non-parallel movement: both → false
|
|
21
|
+
* - all("A", "B") with wrong number of sub-movements: false (logged as error)
|
|
22
22
|
*/
|
|
23
23
|
export class AggregateEvaluator {
|
|
24
24
|
step;
|
|
@@ -29,31 +29,33 @@ export class AggregateEvaluator {
|
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Evaluate aggregate conditions.
|
|
32
|
-
* Returns the 0-based rule index in the
|
|
32
|
+
* Returns the 0-based rule index in the movement's rules array, or -1 if no match.
|
|
33
33
|
*/
|
|
34
34
|
evaluate() {
|
|
35
35
|
if (!this.step.rules || !this.step.parallel || this.step.parallel.length === 0)
|
|
36
36
|
return -1;
|
|
37
37
|
for (let i = 0; i < this.step.rules.length; i++) {
|
|
38
38
|
const rule = this.step.rules[i];
|
|
39
|
+
if (!rule)
|
|
40
|
+
continue;
|
|
39
41
|
if (!rule.isAggregateCondition || !rule.aggregateType || !rule.aggregateConditionText) {
|
|
40
42
|
continue;
|
|
41
43
|
}
|
|
42
|
-
const
|
|
44
|
+
const subMovements = this.step.parallel;
|
|
43
45
|
const targetCondition = rule.aggregateConditionText;
|
|
44
46
|
if (rule.aggregateType === 'all') {
|
|
45
|
-
// Multiple conditions: order-based matching (1st sub-
|
|
47
|
+
// Multiple conditions: order-based matching (1st sub-movement matches 1st condition, etc.)
|
|
46
48
|
if (Array.isArray(targetCondition)) {
|
|
47
|
-
if (targetCondition.length !==
|
|
49
|
+
if (targetCondition.length !== subMovements.length) {
|
|
48
50
|
log.error('all() condition count mismatch', {
|
|
49
|
-
|
|
51
|
+
movement: this.step.name,
|
|
50
52
|
conditionCount: targetCondition.length,
|
|
51
|
-
|
|
53
|
+
subMovementCount: subMovements.length,
|
|
52
54
|
});
|
|
53
55
|
continue;
|
|
54
56
|
}
|
|
55
|
-
const allMatch =
|
|
56
|
-
const output = this.state.
|
|
57
|
+
const allMatch = subMovements.every((sub, idx) => {
|
|
58
|
+
const output = this.state.movementOutputs.get(sub.name);
|
|
57
59
|
if (!output || output.matchedRuleIndex == null || !sub.rules)
|
|
58
60
|
return false;
|
|
59
61
|
const matchedRule = sub.rules[output.matchedRuleIndex];
|
|
@@ -63,21 +65,21 @@ export class AggregateEvaluator {
|
|
|
63
65
|
return matchedRule?.condition === expectedCondition;
|
|
64
66
|
});
|
|
65
67
|
if (allMatch) {
|
|
66
|
-
log.debug('Aggregate all() matched (multi-condition)', {
|
|
68
|
+
log.debug('Aggregate all() matched (multi-condition)', { movement: this.step.name, conditions: targetCondition, ruleIndex: i });
|
|
67
69
|
return i;
|
|
68
70
|
}
|
|
69
71
|
}
|
|
70
72
|
else {
|
|
71
|
-
// Single condition: all sub-
|
|
72
|
-
const allMatch =
|
|
73
|
-
const output = this.state.
|
|
73
|
+
// Single condition: all sub-movements must match the same condition
|
|
74
|
+
const allMatch = subMovements.every((sub) => {
|
|
75
|
+
const output = this.state.movementOutputs.get(sub.name);
|
|
74
76
|
if (!output || output.matchedRuleIndex == null || !sub.rules)
|
|
75
77
|
return false;
|
|
76
78
|
const matchedRule = sub.rules[output.matchedRuleIndex];
|
|
77
79
|
return matchedRule?.condition === targetCondition;
|
|
78
80
|
});
|
|
79
81
|
if (allMatch) {
|
|
80
|
-
log.debug('Aggregate all() matched', {
|
|
82
|
+
log.debug('Aggregate all() matched', { movement: this.step.name, condition: targetCondition, ruleIndex: i });
|
|
81
83
|
return i;
|
|
82
84
|
}
|
|
83
85
|
}
|
|
@@ -85,30 +87,30 @@ export class AggregateEvaluator {
|
|
|
85
87
|
else {
|
|
86
88
|
// 'any'
|
|
87
89
|
if (Array.isArray(targetCondition)) {
|
|
88
|
-
// Multiple conditions: at least one sub-
|
|
89
|
-
const anyMatch =
|
|
90
|
-
const output = this.state.
|
|
90
|
+
// Multiple conditions: at least one sub-movement matches at least one condition
|
|
91
|
+
const anyMatch = subMovements.some((sub) => {
|
|
92
|
+
const output = this.state.movementOutputs.get(sub.name);
|
|
91
93
|
if (!output || output.matchedRuleIndex == null || !sub.rules)
|
|
92
94
|
return false;
|
|
93
95
|
const matchedRule = sub.rules[output.matchedRuleIndex];
|
|
94
96
|
return targetCondition.includes(matchedRule?.condition ?? '');
|
|
95
97
|
});
|
|
96
98
|
if (anyMatch) {
|
|
97
|
-
log.debug('Aggregate any() matched (multi-condition)', {
|
|
99
|
+
log.debug('Aggregate any() matched (multi-condition)', { movement: this.step.name, conditions: targetCondition, ruleIndex: i });
|
|
98
100
|
return i;
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
103
|
else {
|
|
102
|
-
// Single condition: at least one sub-
|
|
103
|
-
const anyMatch =
|
|
104
|
-
const output = this.state.
|
|
104
|
+
// Single condition: at least one sub-movement matches the condition
|
|
105
|
+
const anyMatch = subMovements.some((sub) => {
|
|
106
|
+
const output = this.state.movementOutputs.get(sub.name);
|
|
105
107
|
if (!output || output.matchedRuleIndex == null || !sub.rules)
|
|
106
108
|
return false;
|
|
107
109
|
const matchedRule = sub.rules[output.matchedRuleIndex];
|
|
108
110
|
return matchedRule?.condition === targetCondition;
|
|
109
111
|
});
|
|
110
112
|
if (anyMatch) {
|
|
111
|
-
log.debug('Aggregate any() matched', {
|
|
113
|
+
log.debug('Aggregate any() matched', { movement: this.step.name, condition: targetCondition, ruleIndex: i });
|
|
112
114
|
return i;
|
|
113
115
|
}
|
|
114
116
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AggregateEvaluator.js","sourceRoot":"","sources":["../../../../src/core/workflow/evaluation/AggregateEvaluator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,MAAM,GAAG,GAAG,YAAY,CAAC,qBAAqB,CAAC,CAAC;AAEhD;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,kBAAkB;IAEV;IACA;IAFnB,YACmB,
|
|
1
|
+
{"version":3,"file":"AggregateEvaluator.js","sourceRoot":"","sources":["../../../../src/core/workflow/evaluation/AggregateEvaluator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,MAAM,GAAG,GAAG,YAAY,CAAC,qBAAqB,CAAC,CAAC;AAEhD;;;;;;;;;;;;;;GAcG;AACH,MAAM,OAAO,kBAAkB;IAEV;IACA;IAFnB,YACmB,IAAsB,EACtB,KAAoB;QADpB,SAAI,GAAJ,IAAI,CAAkB;QACtB,UAAK,GAAL,KAAK,CAAe;IACpC,CAAC;IAEJ;;;OAGG;IACH,QAAQ;QACN,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,CAAC,CAAC,CAAC;QAE1F,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAChD,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YAChC,IAAI,CAAC,IAAI;gBAAE,SAAS;YACpB,IAAI,CAAC,I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CAAC,CAAC;wBAC7G,OAAO,CAAC,CAAC;oBACX,CAAC;gBACH,CAAC;YACH,CAAC;QACH,CAAC;QAED,OAAO,CAAC,CAAC,CAAC;IACZ,CAAC;CACF"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Rule evaluation logic for workflow
|
|
2
|
+
* Rule evaluation logic for workflow movements
|
|
3
3
|
*
|
|
4
|
-
* Evaluates workflow
|
|
4
|
+
* Evaluates workflow movement rules to determine the matched rule index.
|
|
5
5
|
* Supports tag-based detection, ai() conditions, aggregate conditions,
|
|
6
6
|
* and AI judge fallback.
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
8
|
+
import type { WorkflowMovement, WorkflowState, RuleMatchMethod } from '../../models/types.js';
|
|
9
9
|
import type { AiJudgeCaller, RuleIndexDetector } from '../types.js';
|
|
10
10
|
export interface RuleMatch {
|
|
11
11
|
index: number;
|
|
12
12
|
method: RuleMatchMethod;
|
|
13
13
|
}
|
|
14
14
|
export interface RuleEvaluatorContext {
|
|
15
|
-
/** Workflow state (for accessing
|
|
15
|
+
/** Workflow state (for accessing movementOutputs in aggregate evaluation) */
|
|
16
16
|
state: WorkflowState;
|
|
17
17
|
/** Working directory (for AI judge calls) */
|
|
18
18
|
cwd: string;
|
|
@@ -24,22 +24,22 @@ export interface RuleEvaluatorContext {
|
|
|
24
24
|
callAiJudge: AiJudgeCaller;
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
|
-
* Evaluates rules for a workflow
|
|
27
|
+
* Evaluates rules for a workflow movement to determine the next transition.
|
|
28
28
|
*
|
|
29
29
|
* Evaluation order (first match wins):
|
|
30
|
-
* 1. Aggregate conditions: all()/any() — evaluate sub-
|
|
30
|
+
* 1. Aggregate conditions: all()/any() — evaluate sub-movement results
|
|
31
31
|
* 2. Tag detection from Phase 3 output
|
|
32
32
|
* 3. Tag detection from Phase 1 output (fallback)
|
|
33
33
|
* 4. ai() condition evaluation via AI judge
|
|
34
34
|
* 5. All-conditions AI judge (final fallback)
|
|
35
35
|
*
|
|
36
|
-
* Returns undefined for
|
|
36
|
+
* Returns undefined for movements without rules.
|
|
37
37
|
* Throws if rules exist but no rule matched (Fail Fast).
|
|
38
38
|
*/
|
|
39
39
|
export declare class RuleEvaluator {
|
|
40
40
|
private readonly step;
|
|
41
41
|
private readonly ctx;
|
|
42
|
-
constructor(step:
|
|
42
|
+
constructor(step: WorkflowMovement, ctx: RuleEvaluatorContext);
|
|
43
43
|
evaluate(agentContent: string, tagContent: string): Promise<RuleMatch | undefined>;
|
|
44
44
|
/**
|
|
45
45
|
* Evaluate ai() conditions via AI judge.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuleEvaluator.d.ts","sourceRoot":"","sources":["../../../../src/core/workflow/evaluation/RuleEvaluator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"RuleEvaluator.d.ts","sourceRoot":"","sources":["../../../../src/core/workflow/evaluation/RuleEvaluator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,aAAa,EACb,eAAe,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAMpE,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,eAAe,CAAC;CACzB;AAED,MAAM,WAAW,oBAAoB;IACnC,6EAA6E;IAC7E,KAAK,EAAE,aAAa,CAAC;IACrB,6CAA6C;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,iDAAiD;IACjD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,8BAA8B;IAC9B,eAAe,EAAE,iBAAiB,CAAC;IACnC,sBAAsB;IACtB,WAAW,EAAE,aAAa,CAAC;CAC5B;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,aAAa;IAEtB,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,GAAG;gBADH,IAAI,EAAE,gBAAgB,EACtB,GAAG,EAAE,oBAAoB;IAGtC,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;IAoDxF;;;OAGG;YACW,oBAAoB;IAyClC;;;OAGG;YACW,+BAA+B;CA4B9C"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Rule evaluation logic for workflow
|
|
2
|
+
* Rule evaluation logic for workflow movements
|
|
3
3
|
*
|
|
4
|
-
* Evaluates workflow
|
|
4
|
+
* Evaluates workflow movement rules to determine the matched rule index.
|
|
5
5
|
* Supports tag-based detection, ai() conditions, aggregate conditions,
|
|
6
6
|
* and AI judge fallback.
|
|
7
7
|
*/
|
|
@@ -9,16 +9,16 @@ import { createLogger } from '../../../shared/utils/index.js';
|
|
|
9
9
|
import { AggregateEvaluator } from './AggregateEvaluator.js';
|
|
10
10
|
const log = createLogger('rule-evaluator');
|
|
11
11
|
/**
|
|
12
|
-
* Evaluates rules for a workflow
|
|
12
|
+
* Evaluates rules for a workflow movement to determine the next transition.
|
|
13
13
|
*
|
|
14
14
|
* Evaluation order (first match wins):
|
|
15
|
-
* 1. Aggregate conditions: all()/any() — evaluate sub-
|
|
15
|
+
* 1. Aggregate conditions: all()/any() — evaluate sub-movement results
|
|
16
16
|
* 2. Tag detection from Phase 3 output
|
|
17
17
|
* 3. Tag detection from Phase 1 output (fallback)
|
|
18
18
|
* 4. ai() condition evaluation via AI judge
|
|
19
19
|
* 5. All-conditions AI judge (final fallback)
|
|
20
20
|
*
|
|
21
|
-
* Returns undefined for
|
|
21
|
+
* Returns undefined for movements without rules.
|
|
22
22
|
* Throws if rules exist but no rule matched (Fail Fast).
|
|
23
23
|
*/
|
|
24
24
|
export class RuleEvaluator {
|
|
@@ -32,7 +32,7 @@ export class RuleEvaluator {
|
|
|
32
32
|
if (!this.step.rules || this.step.rules.length === 0)
|
|
33
33
|
return undefined;
|
|
34
34
|
const interactiveEnabled = this.ctx.interactive === true;
|
|
35
|
-
// 1. Aggregate conditions (all/any) — only meaningful for parallel parent
|
|
35
|
+
// 1. Aggregate conditions (all/any) — only meaningful for parallel parent movements
|
|
36
36
|
const aggEvaluator = new AggregateEvaluator(this.step, this.ctx.state);
|
|
37
37
|
const aggIndex = aggEvaluator.evaluate();
|
|
38
38
|
if (aggIndex >= 0) {
|
|
@@ -74,7 +74,7 @@ export class RuleEvaluator {
|
|
|
74
74
|
if (fallbackIndex >= 0) {
|
|
75
75
|
return { index: fallbackIndex, method: 'ai_judge_fallback' };
|
|
76
76
|
}
|
|
77
|
-
throw new Error(`Status not found for
|
|
77
|
+
throw new Error(`Status not found for movement "${this.step.name}": no rule matched after all detection phases`);
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
80
80
|
* Evaluate ai() conditions via AI judge.
|
|
@@ -86,6 +86,8 @@ export class RuleEvaluator {
|
|
|
86
86
|
const aiConditions = [];
|
|
87
87
|
for (let i = 0; i < this.step.rules.length; i++) {
|
|
88
88
|
const rule = this.step.rules[i];
|
|
89
|
+
if (!rule)
|
|
90
|
+
continue;
|
|
89
91
|
if (rule.interactiveOnly && this.ctx.interactive !== true) {
|
|
90
92
|
continue;
|
|
91
93
|
}
|
|
@@ -96,22 +98,24 @@ export class RuleEvaluator {
|
|
|
96
98
|
if (aiConditions.length === 0)
|
|
97
99
|
return -1;
|
|
98
100
|
log.debug('Evaluating ai() conditions via judge', {
|
|
99
|
-
|
|
101
|
+
movement: this.step.name,
|
|
100
102
|
conditionCount: aiConditions.length,
|
|
101
103
|
});
|
|
102
104
|
const judgeConditions = aiConditions.map((c, i) => ({ index: i, text: c.text }));
|
|
103
105
|
const judgeResult = await this.ctx.callAiJudge(agentOutput, judgeConditions, { cwd: this.ctx.cwd });
|
|
104
106
|
if (judgeResult >= 0 && judgeResult < aiConditions.length) {
|
|
105
107
|
const matched = aiConditions[judgeResult];
|
|
108
|
+
if (!matched)
|
|
109
|
+
return -1;
|
|
106
110
|
log.debug('AI judge matched condition', {
|
|
107
|
-
|
|
111
|
+
movement: this.step.name,
|
|
108
112
|
judgeResult,
|
|
109
113
|
originalRuleIndex: matched.index,
|
|
110
114
|
condition: matched.text,
|
|
111
115
|
});
|
|
112
116
|
return matched.index;
|
|
113
117
|
}
|
|
114
|
-
log.debug('AI judge did not match any condition', {
|
|
118
|
+
log.debug('AI judge did not match any condition', { movement: this.step.name });
|
|
115
119
|
return -1;
|
|
116
120
|
}
|
|
117
121
|
/**
|
|
@@ -126,19 +130,19 @@ export class RuleEvaluator {
|
|
|
126
130
|
.filter((rule) => this.ctx.interactive === true || !rule.interactiveOnly)
|
|
127
131
|
.map((rule) => ({ index: rule.index, text: rule.text }));
|
|
128
132
|
log.debug('Evaluating all conditions via AI judge (final fallback)', {
|
|
129
|
-
|
|
133
|
+
movement: this.step.name,
|
|
130
134
|
conditionCount: conditions.length,
|
|
131
135
|
});
|
|
132
136
|
const judgeResult = await this.ctx.callAiJudge(agentOutput, conditions, { cwd: this.ctx.cwd });
|
|
133
137
|
if (judgeResult >= 0 && judgeResult < conditions.length) {
|
|
134
138
|
log.debug('AI judge (fallback) matched condition', {
|
|
135
|
-
|
|
139
|
+
movement: this.step.name,
|
|
136
140
|
ruleIndex: judgeResult,
|
|
137
|
-
condition: conditions[judgeResult]
|
|
141
|
+
condition: conditions[judgeResult]?.text,
|
|
138
142
|
});
|
|
139
143
|
return judgeResult;
|
|
140
144
|
}
|
|
141
|
-
log.debug('AI judge (fallback) did not match any condition', {
|
|
145
|
+
log.debug('AI judge (fallback) did not match any condition', { movement: this.step.name });
|
|
142
146
|
return -1;
|
|
143
147
|
}
|
|
144
148
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RuleEvaluator.js","sourceRoot":"","sources":["../../../../src/core/workflow/evaluation/RuleEvaluator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,GAAG,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAAC;AAoB3C;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,aAAa;IAEL;IACA;IAFnB,YACmB,
|
|
1
|
+
{"version":3,"file":"RuleEvaluator.js","sourceRoot":"","sources":["../../../../src/core/workflow/evaluation/RuleEvaluator.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,MAAM,GAAG,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAAC;AAoB3C;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,aAAa;IAEL;IACA;IAFnB,YACmB,IAAsB,EACtB,GAAyB;QADzB,SAAI,GAAJ,IAAI,CAAkB;QACtB,QAAG,GAAH,GAAG,CAAsB;IACzC,CAAC;IAEJ,KAAK,CAAC,QAAQ,CAAC,YAAoB,EAAE,UAAkB;QACrD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO,SAAS,CAAC;QACvE,MAAM,kBAAkB,GAAG,IAAI,CAAC,GAAG,CAAC,WAAW,KAAK,IAAI,CAAC;QAEzD,oFAAoF;QACpF,MAAM,YAAY,GAAG,IAAI,kBAAkB,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QACvE,MAAM,QAAQ,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;QACzC,IAAI,QAAQ,IAAI,CAAC,EAAE,CAA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AG,CAAC,KAAK,CAAC,iDAAiD,EAAE,EAAE,QAAQ,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAC3F,OAAO,CAAC,CAAC,CAAC;IACZ,CAAC;CAEF"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Rule evaluation - barrel exports
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { WorkflowMovement, WorkflowState } from '../../models/types.js';
|
|
5
5
|
export { RuleEvaluator, type RuleMatch, type RuleEvaluatorContext } from './RuleEvaluator.js';
|
|
6
6
|
export { AggregateEvaluator } from './AggregateEvaluator.js';
|
|
7
7
|
import type { RuleMatch, RuleEvaluatorContext } from './RuleEvaluator.js';
|
|
8
8
|
/**
|
|
9
|
-
* Detect matched rule for a
|
|
9
|
+
* Detect matched rule for a movement's response.
|
|
10
10
|
* Function facade over RuleEvaluator class.
|
|
11
11
|
*/
|
|
12
|
-
export declare function detectMatchedRule(step:
|
|
12
|
+
export declare function detectMatchedRule(step: WorkflowMovement, agentContent: string, tagContent: string, ctx: RuleEvaluatorContext): Promise<RuleMatch | undefined>;
|
|
13
13
|
/**
|
|
14
14
|
* Evaluate aggregate conditions.
|
|
15
15
|
* Function facade over AggregateEvaluator class.
|
|
16
16
|
*/
|
|
17
|
-
export declare function evaluateAggregateConditions(step:
|
|
17
|
+
export declare function evaluateAggregateConditions(step: WorkflowMovement, state: WorkflowState): number;
|
|
18
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/workflow/evaluation/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/core/workflow/evaluation/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAI7E,OAAO,EAAE,aAAa,EAAE,KAAK,SAAS,EAAE,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAI7D,OAAO,KAAK,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE1E;;;GAGG;AACH,wBAAsB,iBAAiB,CACrC,IAAI,EAAE,gBAAgB,EACtB,YAAY,EAAE,MAAM,EACpB,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,oBAAoB,GACxB,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC,CAEhC;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,aAAa,GAAG,MAAM,CAEhG"}
|
|
@@ -6,7 +6,7 @@ import { AggregateEvaluator } from './AggregateEvaluator.js';
|
|
|
6
6
|
export { RuleEvaluator } from './RuleEvaluator.js';
|
|
7
7
|
export { AggregateEvaluator } from './AggregateEvaluator.js';
|
|
8
8
|
/**
|
|
9
|
-
* Detect matched rule for a
|
|
9
|
+
* Detect matched rule for a movement's response.
|
|
10
10
|
* Function facade over RuleEvaluator class.
|
|
11
11
|
*/
|
|
12
12
|
export async function detectMatchedRule(step, agentContent, tagContent, ctx) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/workflow/evaluation/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,aAAa,EAA6C,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAM7D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/core/workflow/evaluation/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAE7D,OAAO,EAAE,aAAa,EAA6C,MAAM,oBAAoB,CAAC;AAC9F,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAM7D;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,IAAsB,EACtB,YAAoB,EACpB,UAAkB,EAClB,GAAyB;IAEzB,OAAO,IAAI,aAAa,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;AACzE,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CAAC,IAAsB,EAAE,KAAoB;IACtF,OAAO,IAAI,kBAAkB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,QAAQ,EAAE,CAAC;AACxD,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Shared rule utility functions used by both engine.ts and instruction-builder.ts.
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
4
|
+
import type { WorkflowMovement } from '../../models/types.js';
|
|
5
5
|
/**
|
|
6
|
-
* Check whether a
|
|
7
|
-
* [
|
|
6
|
+
* Check whether a movement has tag-based rules (i.e., rules that require
|
|
7
|
+
* [MOVEMENT:N] tag output for detection).
|
|
8
8
|
*
|
|
9
9
|
* Returns false when all rules are ai() or aggregate conditions,
|
|
10
10
|
* meaning no tag-based status output is needed.
|
|
11
11
|
*/
|
|
12
|
-
export declare function hasTagBasedRules(step:
|
|
12
|
+
export declare function hasTagBasedRules(step: WorkflowMovement): boolean;
|
|
13
13
|
//# sourceMappingURL=rule-utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-utils.d.ts","sourceRoot":"","sources":["../../../../src/core/workflow/evaluation/rule-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"rule-utils.d.ts","sourceRoot":"","sources":["../../../../src/core/workflow/evaluation/rule-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAIhE"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Shared rule utility functions used by both engine.ts and instruction-builder.ts.
|
|
3
3
|
*/
|
|
4
4
|
/**
|
|
5
|
-
* Check whether a
|
|
6
|
-
* [
|
|
5
|
+
* Check whether a movement has tag-based rules (i.e., rules that require
|
|
6
|
+
* [MOVEMENT:N] tag output for detection).
|
|
7
7
|
*
|
|
8
8
|
* Returns false when all rules are ai() or aggregate conditions,
|
|
9
9
|
* meaning no tag-based status output is needed.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-utils.js","sourceRoot":"","sources":["../../../../src/core/workflow/evaluation/rule-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,
|
|
1
|
+
{"version":3,"file":"rule-utils.js","sourceRoot":"","sources":["../../../../src/core/workflow/evaluation/rule-utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH;;;;;;GAMG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAsB;IACrD,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACzD,MAAM,mBAAmB,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,IAAI,CAAC,CAAC,oBAAoB,CAAC,CAAC;IAC/F,OAAO,CAAC,mBAAmB,CAAC;AAC9B,CAAC"}
|
|
@@ -5,18 +5,18 @@
|
|
|
5
5
|
* from the workflow module.
|
|
6
6
|
*/
|
|
7
7
|
export { WorkflowEngine } from './engine/index.js';
|
|
8
|
-
export {
|
|
9
|
-
export type { WorkflowEvents, UserInputRequest, IterationLimitRequest, SessionUpdateCallback, IterationLimitCallback, WorkflowEngineOptions, LoopCheckResult, StreamEvent, StreamCallback, PermissionHandler, PermissionResult, AskUserQuestionHandler, ProviderType, } from './types.js';
|
|
10
|
-
export {
|
|
8
|
+
export { COMPLETE_MOVEMENT, ABORT_MOVEMENT, ERROR_MESSAGES } from './constants.js';
|
|
9
|
+
export type { WorkflowEvents, PhaseName, UserInputRequest, IterationLimitRequest, SessionUpdateCallback, IterationLimitCallback, WorkflowEngineOptions, LoopCheckResult, StreamEvent, StreamCallback, PermissionHandler, PermissionResult, AskUserQuestionHandler, ProviderType, } from './types.js';
|
|
10
|
+
export { determineNextMovementByRules, extractBlockedPrompt } from './engine/transitions.js';
|
|
11
11
|
export { LoopDetector } from './engine/loop-detector.js';
|
|
12
|
-
export { createInitialState, addUserInput, getPreviousOutput, } from './engine/state-manager.js';
|
|
12
|
+
export { createInitialState, addUserInput, getPreviousOutput, incrementMovementIteration, } from './engine/state-manager.js';
|
|
13
13
|
export { handleBlocked, type BlockedHandlerResult } from './engine/blocked-handler.js';
|
|
14
14
|
export { ParallelLogger } from './engine/parallel-logger.js';
|
|
15
15
|
export { InstructionBuilder, isReportObjectConfig } from './instruction/InstructionBuilder.js';
|
|
16
16
|
export { ReportInstructionBuilder, type ReportInstructionContext } from './instruction/ReportInstructionBuilder.js';
|
|
17
17
|
export { StatusJudgmentBuilder, type StatusJudgmentContext } from './instruction/StatusJudgmentBuilder.js';
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
18
|
+
export { buildEditRule, type InstructionContext } from './instruction/instruction-context.js';
|
|
19
|
+
export { generateStatusRulesComponents, type StatusRulesComponents } from './instruction/status-rules.js';
|
|
20
20
|
export { RuleEvaluator, type RuleMatch, type RuleEvaluatorContext, detectMatchedRule, evaluateAggregateConditions } from './evaluation/index.js';
|
|
21
21
|
export { AggregateEvaluator } from './evaluation/AggregateEvaluator.js';
|
|
22
22
|
export { needsStatusJudgmentPhase, runReportPhase, runStatusJudgmentPhase } from './phase-runner.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/workflow/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/workflow/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAGnD,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGnF,YAAY,EACV,cAAc,EACd,SAAS,EACT,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,EACf,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,YAAY,GACb,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,4BAA4B,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAG7F,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,2BAA2B,CAAC;AAGnC,OAAO,EAAE,aAAa,EAAE,KAAK,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGvF,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAG7D,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC/F,OAAO,EAAE,wBAAwB,EAAE,KAAK,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACpH,OAAO,EAAE,qBAAqB,EAAE,KAAK,qBAAqB,EAAE,MAAM,wCAAwC,CAAC;AAC3G,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,6BAA6B,EAAE,KAAK,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAG1G,OAAO,EAAE,aAAa,EAAE,KAAK,SAAS,EAAE,KAAK,oBAAoB,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACjJ,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAGxE,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -7,13 +7,13 @@
|
|
|
7
7
|
// Main engine
|
|
8
8
|
export { WorkflowEngine } from './engine/index.js';
|
|
9
9
|
// Constants
|
|
10
|
-
export {
|
|
10
|
+
export { COMPLETE_MOVEMENT, ABORT_MOVEMENT, ERROR_MESSAGES } from './constants.js';
|
|
11
11
|
// Transitions (engine/)
|
|
12
|
-
export {
|
|
12
|
+
export { determineNextMovementByRules, extractBlockedPrompt } from './engine/transitions.js';
|
|
13
13
|
// Loop detection (engine/)
|
|
14
14
|
export { LoopDetector } from './engine/loop-detector.js';
|
|
15
15
|
// State management (engine/)
|
|
16
|
-
export { createInitialState, addUserInput, getPreviousOutput, } from './engine/state-manager.js';
|
|
16
|
+
export { createInitialState, addUserInput, getPreviousOutput, incrementMovementIteration, } from './engine/state-manager.js';
|
|
17
17
|
// Blocked handling (engine/)
|
|
18
18
|
export { handleBlocked } from './engine/blocked-handler.js';
|
|
19
19
|
// Parallel logger (engine/)
|
|
@@ -22,8 +22,8 @@ export { ParallelLogger } from './engine/parallel-logger.js';
|
|
|
22
22
|
export { InstructionBuilder, isReportObjectConfig } from './instruction/InstructionBuilder.js';
|
|
23
23
|
export { ReportInstructionBuilder } from './instruction/ReportInstructionBuilder.js';
|
|
24
24
|
export { StatusJudgmentBuilder } from './instruction/StatusJudgmentBuilder.js';
|
|
25
|
-
export {
|
|
26
|
-
export {
|
|
25
|
+
export { buildEditRule } from './instruction/instruction-context.js';
|
|
26
|
+
export { generateStatusRulesComponents } from './instruction/status-rules.js';
|
|
27
27
|
// Rule evaluation
|
|
28
28
|
export { RuleEvaluator, detectMatchedRule, evaluateAggregateConditions } from './evaluation/index.js';
|
|
29
29
|
export { AggregateEvaluator } from './evaluation/AggregateEvaluator.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/workflow/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc;AACd,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,YAAY;AACZ,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/workflow/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc;AACd,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,YAAY;AACZ,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAoBnF,wBAAwB;AACxB,OAAO,EAAE,4BAA4B,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE7F,2BAA2B;AAC3B,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAEzD,6BAA6B;AAC7B,OAAO,EACL,kBAAkB,EAClB,YAAY,EACZ,iBAAiB,EACjB,0BAA0B,GAC3B,MAAM,2BAA2B,CAAC;AAEnC,6BAA6B;AAC7B,OAAO,EAAE,aAAa,EAA6B,MAAM,6BAA6B,CAAC;AAEvF,4BAA4B;AAC5B,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,uBAAuB;AACvB,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAC/F,OAAO,EAAE,wBAAwB,EAAiC,MAAM,2CAA2C,CAAC;AACpH,OAAO,EAAE,qBAAqB,EAA8B,MAAM,wCAAwC,CAAC;AAC3G,OAAO,EAAE,aAAa,EAA2B,MAAM,sCAAsC,CAAC;AAC9F,OAAO,EAAE,6BAA6B,EAA8B,MAAM,+BAA+B,CAAC;AAE1G,kBAAkB;AAClB,OAAO,EAAE,aAAa,EAA6C,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AACjJ,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AAExE,eAAe;AACf,OAAO,EAAE,wBAAwB,EAAE,cAAc,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Phase 1 instruction builder
|
|
3
3
|
*
|
|
4
|
-
* Builds the instruction string for main agent execution
|
|
5
|
-
*
|
|
6
|
-
* User Request, Previous Response, Additional User Inputs, Instructions header,
|
|
7
|
-
* Status Output Rules)
|
|
8
|
-
* 2. Replacing template placeholders with actual values
|
|
4
|
+
* Builds the instruction string for main agent execution.
|
|
5
|
+
* Assembles template variables and renders a single complete template.
|
|
9
6
|
*/
|
|
10
|
-
import type {
|
|
7
|
+
import type { WorkflowMovement, Language, ReportConfig, ReportObjectConfig } from '../../models/types.js';
|
|
11
8
|
import type { InstructionContext } from './instruction-context.js';
|
|
12
9
|
/**
|
|
13
10
|
* Check if a report config is the object form (ReportObjectConfig).
|
|
@@ -17,28 +14,33 @@ export declare function isReportObjectConfig(report: string | ReportConfig[] | R
|
|
|
17
14
|
* Builds Phase 1 instructions for agent execution.
|
|
18
15
|
*
|
|
19
16
|
* Stateless builder — all data is passed via constructor context.
|
|
17
|
+
* Renders a single complete template with all variables.
|
|
20
18
|
*/
|
|
21
19
|
export declare class InstructionBuilder {
|
|
22
20
|
private readonly step;
|
|
23
21
|
private readonly context;
|
|
24
|
-
constructor(step:
|
|
22
|
+
constructor(step: WorkflowMovement, context: InstructionContext);
|
|
25
23
|
/**
|
|
26
24
|
* Build the complete instruction string.
|
|
27
25
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
26
|
+
* Assembles all template variables and renders the Phase 1 template
|
|
27
|
+
* in a single loadTemplate() call.
|
|
30
28
|
*/
|
|
31
29
|
build(): string;
|
|
32
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Build the workflow structure display string.
|
|
32
|
+
* Returns empty string if no workflow movements are available.
|
|
33
|
+
*/
|
|
34
|
+
private buildWorkflowStructure;
|
|
33
35
|
}
|
|
34
36
|
/**
|
|
35
37
|
* Render report context info for Workflow Context section.
|
|
36
|
-
* Used by ReportInstructionBuilder.
|
|
38
|
+
* Used by InstructionBuilder and ReportInstructionBuilder.
|
|
37
39
|
*/
|
|
38
|
-
export declare function renderReportContext(report: string | ReportConfig[] | ReportObjectConfig, reportDir: string
|
|
40
|
+
export declare function renderReportContext(report: string | ReportConfig[] | ReportObjectConfig, reportDir: string): string;
|
|
39
41
|
/**
|
|
40
|
-
* Generate report output instructions from
|
|
41
|
-
* Returns
|
|
42
|
+
* Generate report output instructions from movement's report config.
|
|
43
|
+
* Returns empty string if movement has no report or no reportDir.
|
|
42
44
|
*/
|
|
43
|
-
export declare function renderReportOutputInstruction(step:
|
|
45
|
+
export declare function renderReportOutputInstruction(step: WorkflowMovement, context: InstructionContext, language: Language): string;
|
|
44
46
|
//# sourceMappingURL=InstructionBuilder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstructionBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/InstructionBuilder.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"InstructionBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/InstructionBuilder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC1G,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAKnE;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,EAAE,GAAG,kBAAkB,GAAG,MAAM,IAAI,kBAAkB,CAEvH;AAED;;;;;GAKG;AACH,qBAAa,kBAAkB;IAE3B,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,kBAAkB;IAG9C;;;;;OAKG;IACH,KAAK,IAAI,MAAM;IAyEf;;;OAGG;IACH,OAAO,CAAC,sBAAsB;CAiB/B;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,GAAG,YAAY,EAAE,GAAG,kBAAkB,EACpD,SAAS,EAAE,MAAM,GAChB,MAAM,CAqBR;AAED;;;GAGG;AACH,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,kBAAkB,EAC3B,QAAQ,EAAE,QAAQ,GACjB,MAAM,CAwBR"}
|