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
|
@@ -4,22 +4,15 @@
|
|
|
4
4
|
* Resumes the agent session and asks it to evaluate its work
|
|
5
5
|
* and output the appropriate status tag. No tools are allowed.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* - Status rules (criteria table + output format)
|
|
7
|
+
* Renders a single complete template combining the judgment header
|
|
8
|
+
* and status rules (criteria table + output format).
|
|
10
9
|
*/
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
const STATUS_JUDGMENT_STRINGS = {
|
|
14
|
-
en: {
|
|
15
|
-
header: 'Review your work results and determine the status. Do NOT perform any additional work.',
|
|
16
|
-
},
|
|
17
|
-
ja: {
|
|
18
|
-
header: '作業結果を振り返り、ステータスを判定してください。追加の作業は行わないでください。',
|
|
19
|
-
},
|
|
20
|
-
};
|
|
10
|
+
import { generateStatusRulesComponents } from './status-rules.js';
|
|
11
|
+
import { loadTemplate } from '../../../shared/prompts/index.js';
|
|
21
12
|
/**
|
|
22
13
|
* Builds Phase 3 (status judgment) instructions.
|
|
14
|
+
*
|
|
15
|
+
* Renders a single complete template with all variables.
|
|
23
16
|
*/
|
|
24
17
|
export class StatusJudgmentBuilder {
|
|
25
18
|
step;
|
|
@@ -30,17 +23,16 @@ export class StatusJudgmentBuilder {
|
|
|
30
23
|
}
|
|
31
24
|
build() {
|
|
32
25
|
if (!this.step.rules || this.step.rules.length === 0) {
|
|
33
|
-
throw new Error(`StatusJudgmentBuilder called for
|
|
26
|
+
throw new Error(`StatusJudgmentBuilder called for movement "${this.step.name}" which has no rules`);
|
|
34
27
|
}
|
|
35
28
|
const language = this.context.language ?? 'en';
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
return sections.join('\n\n');
|
|
29
|
+
const components = generateStatusRulesComponents(this.step.name, this.step.rules, language, { interactive: this.context.interactive });
|
|
30
|
+
return loadTemplate('perform_phase3_message', language, {
|
|
31
|
+
criteriaTable: components.criteriaTable,
|
|
32
|
+
outputList: components.outputList,
|
|
33
|
+
hasAppendix: components.hasAppendix,
|
|
34
|
+
appendixContent: components.appendixContent,
|
|
35
|
+
});
|
|
44
36
|
}
|
|
45
37
|
}
|
|
46
38
|
//# sourceMappingURL=StatusJudgmentBuilder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusJudgmentBuilder.js","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/StatusJudgmentBuilder.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"StatusJudgmentBuilder.js","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/StatusJudgmentBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAYhE;;;;GAIG;AACH,MAAM,OAAO,qBAAqB;IAEb;IACA;IAFnB,YACmB,IAAsB,EACtB,OAA8B;QAD9B,SAAI,GAAJ,IAAI,CAAkB;QACtB,YAAO,GAAP,OAAO,CAAuB;IAC9C,CAAC;IAEJ,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACrD,MAAM,IAAI,KAAK,CAAC,8CAA8C,IAAI,CAAC,IAAI,CAAC,IAAI,sBAAsB,CAAC,CAAC;QACtG,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC;QAE/C,MAAM,UAAU,GAAG,6BAA6B,CAC9C,IAAI,CAAC,IAAI,CAAC,IAAI,EACd,IAAI,CAAC,IAAI,CAAC,KAAK,EACf,QAAQ,EACR,EAAE,WAAW,EAAE,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAC1C,CAAC;QAEF,OAAO,YAAY,CAAC,wBAAwB,EAAE,QAAQ,EAAE;YACtD,aAAa,EAAE,UAAU,CAAC,aAAa;YACvC,UAAU,EAAE,UAAU,CAAC,UAAU;YACjC,WAAW,EAAE,UAAU,CAAC,WAAW;YACnC,eAAe,EAAE,UAAU,CAAC,eAAe;SAC5C,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Used by instruction builders to process instruction_template content.
|
|
5
5
|
*/
|
|
6
|
-
import type {
|
|
6
|
+
import type { WorkflowMovement } from '../../models/types.js';
|
|
7
7
|
import type { InstructionContext } from './instruction-context.js';
|
|
8
8
|
/**
|
|
9
9
|
* Escape special characters in dynamic content to prevent template injection.
|
|
@@ -13,7 +13,7 @@ export declare function escapeTemplateChars(str: string): string;
|
|
|
13
13
|
* Replace template placeholders in the instruction_template body.
|
|
14
14
|
*
|
|
15
15
|
* These placeholders may still be used in instruction_template for
|
|
16
|
-
*
|
|
16
|
+
* special cases or legacy templates.
|
|
17
17
|
*/
|
|
18
|
-
export declare function replaceTemplatePlaceholders(template: string, step:
|
|
18
|
+
export declare function replaceTemplatePlaceholders(template: string, step: WorkflowMovement, context: InstructionContext): string;
|
|
19
19
|
//# sourceMappingURL=escape.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escape.d.ts","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/escape.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"escape.d.ts","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/escape.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEvD;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,kBAAkB,GAC1B,MAAM,CA2CR"}
|
|
@@ -13,16 +13,16 @@ export function escapeTemplateChars(str) {
|
|
|
13
13
|
* Replace template placeholders in the instruction_template body.
|
|
14
14
|
*
|
|
15
15
|
* These placeholders may still be used in instruction_template for
|
|
16
|
-
*
|
|
16
|
+
* special cases or legacy templates.
|
|
17
17
|
*/
|
|
18
18
|
export function replaceTemplatePlaceholders(template, step, context) {
|
|
19
19
|
let result = template;
|
|
20
20
|
// Replace {task}
|
|
21
21
|
result = result.replace(/\{task\}/g, escapeTemplateChars(context.task));
|
|
22
|
-
// Replace {iteration}, {max_iterations}, and {
|
|
22
|
+
// Replace {iteration}, {max_iterations}, and {movement_iteration}
|
|
23
23
|
result = result.replace(/\{iteration\}/g, String(context.iteration));
|
|
24
24
|
result = result.replace(/\{max_iterations\}/g, String(context.maxIterations));
|
|
25
|
-
result = result.replace(/\{
|
|
25
|
+
result = result.replace(/\{movement_iteration\}/g, String(context.movementIteration));
|
|
26
26
|
// Replace {previous_response}
|
|
27
27
|
if (step.passPreviousResponse) {
|
|
28
28
|
if (context.previousOutput) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"escape.js","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/escape.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACrD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CACzC,QAAgB,EAChB,
|
|
1
|
+
{"version":3,"file":"escape.js","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/escape.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,MAAM,UAAU,mBAAmB,CAAC,GAAW;IAC7C,OAAO,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACrD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,2BAA2B,CACzC,QAAgB,EAChB,IAAsB,EACtB,OAA2B;IAE3B,IAAI,MAAM,GAAG,QAAQ,CAAC;IAEtB,iBAAiB;IACjB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,mBAAmB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IAExE,kEAAkE;IAClE,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC;IACrE,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,qBAAq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|
|
3
3
|
*
|
|
4
|
-
* Defines the context structures used by instruction builders
|
|
5
|
-
* and renders execution metadata (working directory, rules) as markdown.
|
|
4
|
+
* Defines the context structures used by instruction builders.
|
|
6
5
|
*/
|
|
7
6
|
import type { AgentResponse, Language } from '../../models/types.js';
|
|
8
7
|
/**
|
|
@@ -15,15 +14,15 @@ export interface InstructionContext {
|
|
|
15
14
|
iteration: number;
|
|
16
15
|
/** Maximum iterations allowed */
|
|
17
16
|
maxIterations: number;
|
|
18
|
-
/** Current
|
|
19
|
-
|
|
17
|
+
/** Current movement's iteration number (how many times this movement has been executed) */
|
|
18
|
+
movementIteration: number;
|
|
20
19
|
/** Working directory (agent work dir, may be a clone) */
|
|
21
20
|
cwd: string;
|
|
22
21
|
/** Project root directory (where .takt/ lives). */
|
|
23
22
|
projectCwd: string;
|
|
24
23
|
/** User inputs accumulated during workflow */
|
|
25
24
|
userInputs: string[];
|
|
26
|
-
/** Previous
|
|
25
|
+
/** Previous movement output if available */
|
|
27
26
|
previousOutput?: AgentResponse;
|
|
28
27
|
/** Report directory path */
|
|
29
28
|
reportDir?: string;
|
|
@@ -31,51 +30,19 @@ export interface InstructionContext {
|
|
|
31
30
|
language?: Language;
|
|
32
31
|
/** Whether interactive-only rules are enabled */
|
|
33
32
|
interactive?: boolean;
|
|
33
|
+
/** Top-level workflow movements for workflow structure display */
|
|
34
|
+
workflowMovements?: ReadonlyArray<{
|
|
35
|
+
name: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
}>;
|
|
38
|
+
/** Index of the current movement in workflowMovements (0-based) */
|
|
39
|
+
currentMovementIndex?: number;
|
|
34
40
|
}
|
|
35
|
-
/** Execution environment metadata prepended to agent instructions */
|
|
36
|
-
export interface ExecutionMetadata {
|
|
37
|
-
/** The agent's working directory (may be a clone) */
|
|
38
|
-
readonly workingDirectory: string;
|
|
39
|
-
/** Language for metadata rendering */
|
|
40
|
-
readonly language: Language;
|
|
41
|
-
/** Whether file editing is allowed for this step (undefined = no prompt) */
|
|
42
|
-
readonly edit?: boolean;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Build execution metadata from instruction context and step config.
|
|
46
|
-
*
|
|
47
|
-
* Pure function: (InstructionContext, edit?) → ExecutionMetadata.
|
|
48
|
-
*/
|
|
49
|
-
export declare function buildExecutionMetadata(context: InstructionContext, edit?: boolean): ExecutionMetadata;
|
|
50
|
-
/** Localized strings for execution metadata rendering */
|
|
51
|
-
export declare const METADATA_STRINGS: {
|
|
52
|
-
readonly en: {
|
|
53
|
-
readonly heading: "## Execution Context";
|
|
54
|
-
readonly workingDirectory: "Working Directory";
|
|
55
|
-
readonly rulesHeading: "## Execution Rules";
|
|
56
|
-
readonly noCommit: "**Do NOT run git commit.** Commits are handled automatically by the system after workflow completion.";
|
|
57
|
-
readonly noCd: "**Do NOT use `cd` in Bash commands.** Your working directory is already set correctly. Run commands directly without changing directories.";
|
|
58
|
-
readonly editEnabled: "**Editing is ENABLED for this step.** You may create, modify, and delete files as needed to fulfill the user's request.";
|
|
59
|
-
readonly editDisabled: "**Editing is DISABLED for this step.** Do NOT create, modify, or delete any project source files. You may only read and search code. Report output will be handled automatically in a later phase.";
|
|
60
|
-
readonly note: "Note: This section is metadata. Follow the language used in the rest of the prompt.";
|
|
61
|
-
};
|
|
62
|
-
readonly ja: {
|
|
63
|
-
readonly heading: "## 実行コンテキスト";
|
|
64
|
-
readonly workingDirectory: "作業ディレクトリ";
|
|
65
|
-
readonly rulesHeading: "## 実行ルール";
|
|
66
|
-
readonly noCommit: "**git commit を実行しないでください。** コミットはワークフロー完了後にシステムが自動で行います。";
|
|
67
|
-
readonly noCd: "**Bashコマンドで `cd` を使用しないでください。** 作業ディレクトリは既に正しく設定されています。ディレクトリを変更せずにコマンドを実行してください。";
|
|
68
|
-
readonly editEnabled: "**このステップでは編集が許可されています。** ユーザーの要求に応じて、ファイルの作成・変更・削除を行ってください。";
|
|
69
|
-
readonly editDisabled: "**このステップでは編集が禁止されています。** プロジェクトのソースファイルを作成・変更・削除しないでください。コードの読み取り・検索のみ行ってください。レポート出力は後のフェーズで自動的に行われます。";
|
|
70
|
-
readonly note: "";
|
|
71
|
-
};
|
|
72
|
-
};
|
|
73
41
|
/**
|
|
74
|
-
*
|
|
42
|
+
* Build the edit rule string for the execution context section.
|
|
75
43
|
*
|
|
76
|
-
*
|
|
77
|
-
*
|
|
78
|
-
* Language determines the output language; 'en' includes a note about language consistency.
|
|
44
|
+
* Returns a localized string describing the edit permission for this movement.
|
|
45
|
+
* Returns empty string when edit is undefined (no explicit permission).
|
|
79
46
|
*/
|
|
80
|
-
export declare function
|
|
47
|
+
export declare function buildEditRule(edit: boolean | undefined, language: Language): string;
|
|
81
48
|
//# sourceMappingURL=instruction-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instruction-context.d.ts","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/instruction-context.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"instruction-context.d.ts","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/instruction-context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,0DAA0D;IAC1D,SAAS,EAAE,MAAM,CAAC;IAClB,iCAAiC;IACjC,aAAa,EAAE,MAAM,CAAC;IACtB,2FAA2F;IAC3F,iBAAiB,EAAE,MAAM,CAAC;IAC1B,yDAAyD;IACzD,GAAG,EAAE,MAAM,CAAC;IACZ,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,4CAA4C;IAC5C,cAAc,CAAC,EAAE,aAAa,CAAC;IAC/B,4BAA4B;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,iDAAiD;IACjD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,kEAAkE;IAClE,iBAAiB,CAAC,EAAE,aAAa,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1E,mEAAmE;IACnE,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,GAAG,SAAS,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAcnF"}
|
|
@@ -1,72 +1,27 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Instruction context types and
|
|
2
|
+
* Instruction context types and edit rule generation
|
|
3
3
|
*
|
|
4
|
-
* Defines the context structures used by instruction builders
|
|
5
|
-
* and renders execution metadata (working directory, rules) as markdown.
|
|
4
|
+
* Defines the context structures used by instruction builders.
|
|
6
5
|
*/
|
|
7
6
|
/**
|
|
8
|
-
* Build
|
|
7
|
+
* Build the edit rule string for the execution context section.
|
|
9
8
|
*
|
|
10
|
-
*
|
|
9
|
+
* Returns a localized string describing the edit permission for this movement.
|
|
10
|
+
* Returns empty string when edit is undefined (no explicit permission).
|
|
11
11
|
*/
|
|
12
|
-
export function
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
19
|
-
/** Localized strings for execution metadata rendering */
|
|
20
|
-
export const METADATA_STRINGS = {
|
|
21
|
-
en: {
|
|
22
|
-
heading: '## Execution Context',
|
|
23
|
-
workingDirectory: 'Working Directory',
|
|
24
|
-
rulesHeading: '## Execution Rules',
|
|
25
|
-
noCommit: '**Do NOT run git commit.** Commits are handled automatically by the system after workflow completion.',
|
|
26
|
-
noCd: '**Do NOT use `cd` in Bash commands.** Your working directory is already set correctly. Run commands directly without changing directories.',
|
|
27
|
-
editEnabled: '**Editing is ENABLED for this step.** You may create, modify, and delete files as needed to fulfill the user\'s request.',
|
|
28
|
-
editDisabled: '**Editing is DISABLED for this step.** Do NOT create, modify, or delete any project source files. You may only read and search code. Report output will be handled automatically in a later phase.',
|
|
29
|
-
note: 'Note: This section is metadata. Follow the language used in the rest of the prompt.',
|
|
30
|
-
},
|
|
31
|
-
ja: {
|
|
32
|
-
heading: '## 実行コンテキスト',
|
|
33
|
-
workingDirectory: '作業ディレクトリ',
|
|
34
|
-
rulesHeading: '## 実行ルール',
|
|
35
|
-
noCommit: '**git commit を実行しないでください。** コミットはワークフロー完了後にシステムが自動で行います。',
|
|
36
|
-
noCd: '**Bashコマンドで `cd` を使用しないでください。** 作業ディレクトリは既に正しく設定されています。ディレクトリを変更せずにコマンドを実行してください。',
|
|
37
|
-
editEnabled: '**このステップでは編集が許可されています。** ユーザーの要求に応じて、ファイルの作成・変更・削除を行ってください。',
|
|
38
|
-
editDisabled: '**このステップでは編集が禁止されています。** プロジェクトのソースファイルを作成・変更・削除しないでください。コードの読み取り・検索のみ行ってください。レポート出力は後のフェーズで自動的に行われます。',
|
|
39
|
-
note: '',
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Render execution metadata as a markdown string.
|
|
44
|
-
*
|
|
45
|
-
* Pure function: ExecutionMetadata → string.
|
|
46
|
-
* Always includes heading + Working Directory + Execution Rules.
|
|
47
|
-
* Language determines the output language; 'en' includes a note about language consistency.
|
|
48
|
-
*/
|
|
49
|
-
export function renderExecutionMetadata(metadata) {
|
|
50
|
-
const strings = METADATA_STRINGS[metadata.language];
|
|
51
|
-
const lines = [
|
|
52
|
-
strings.heading,
|
|
53
|
-
`- ${strings.workingDirectory}: ${metadata.workingDirectory}`,
|
|
54
|
-
'',
|
|
55
|
-
strings.rulesHeading,
|
|
56
|
-
`- ${strings.noCommit}`,
|
|
57
|
-
`- ${strings.noCd}`,
|
|
58
|
-
];
|
|
59
|
-
if (metadata.edit === true) {
|
|
60
|
-
lines.push(`- ${strings.editEnabled}`);
|
|
61
|
-
}
|
|
62
|
-
else if (metadata.edit === false) {
|
|
63
|
-
lines.push(`- ${strings.editDisabled}`);
|
|
12
|
+
export function buildEditRule(edit, language) {
|
|
13
|
+
if (edit === true) {
|
|
14
|
+
if (language === 'ja') {
|
|
15
|
+
return '**このムーブメントでは編集が許可されています。** ユーザーの要求に応じて、ファイルの作成・変更・削除を行ってください。';
|
|
16
|
+
}
|
|
17
|
+
return '**Editing is ENABLED for this movement.** You may create, modify, and delete files as needed to fulfill the user\'s request.';
|
|
64
18
|
}
|
|
65
|
-
if (
|
|
66
|
-
|
|
67
|
-
|
|
19
|
+
if (edit === false) {
|
|
20
|
+
if (language === 'ja') {
|
|
21
|
+
return '**このムーブメントでは編集が禁止されています。** プロジェクトのソースファイルを作成・変更・削除しないでください。コードの読み取り・検索のみ行ってください。レポート出力は後のフェーズで自動的に行われます。';
|
|
22
|
+
}
|
|
23
|
+
return '**Editing is DISABLED for this movement.** Do NOT create, modify, or delete any project source files. You may only read and search code. Report output will be handled automatically in a later phase.';
|
|
68
24
|
}
|
|
69
|
-
|
|
70
|
-
return lines.join('\n');
|
|
25
|
+
return '';
|
|
71
26
|
}
|
|
72
27
|
//# sourceMappingURL=instruction-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instruction-context.js","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/instruction-context.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;
|
|
1
|
+
{"version":3,"file":"instruction-context.js","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/instruction-context.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoCH;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,IAAyB,EAAE,QAAkB;IACzE,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACtB,OAAO,+DAA+D,CAAC;QACzE,CAAC;QACD,OAAO,8HAA8H,CAAC;IACxI,CAAC;IACD,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;QACnB,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACtB,OAAO,0GAA0G,CAAC;QACpH,CAAC;QACD,OAAO,wMAAwM,CAAC;IAClN,CAAC;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"}
|
|
@@ -1,23 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Status rules prompt generation for workflow
|
|
2
|
+
* Status rules prompt generation for workflow movements
|
|
3
3
|
*
|
|
4
|
-
* Generates structured
|
|
5
|
-
* based on the
|
|
4
|
+
* Generates structured status rules content that tells agents which
|
|
5
|
+
* numbered tags to output based on the movement's rule configuration.
|
|
6
|
+
*
|
|
7
|
+
* Returns individual components (criteriaTable, outputList, appendix)
|
|
8
|
+
* that are passed as template variables to Phase 1/Phase 3 templates.
|
|
6
9
|
*/
|
|
7
10
|
import type { WorkflowRule, Language } from '../../models/types.js';
|
|
11
|
+
/** Components of the generated status rules */
|
|
12
|
+
export interface StatusRulesComponents {
|
|
13
|
+
criteriaTable: string;
|
|
14
|
+
outputList: string;
|
|
15
|
+
hasAppendix: boolean;
|
|
16
|
+
appendixContent: string;
|
|
17
|
+
}
|
|
8
18
|
/**
|
|
9
|
-
* Generate status rules
|
|
10
|
-
* Creates a structured prompt that tells the agent which numbered tags to output.
|
|
19
|
+
* Generate status rules components from rules configuration.
|
|
11
20
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* |---|------|------|
|
|
16
|
-
* | 1 | 要件が明確で実装可能 | `[PLAN:1]` |
|
|
17
|
-
* | 2 | ユーザーが質問をしている | `[PLAN:2]` |
|
|
18
|
-
* | 3 | 要件が不明確、情報不足 | `[PLAN:3]` |
|
|
21
|
+
* Loop expansion (criteria table rows, output list items, appendix blocks)
|
|
22
|
+
* is done in code and returned as individual string components.
|
|
23
|
+
* These are passed as template variables to the Phase 1/Phase 3 templates.
|
|
19
24
|
*/
|
|
20
|
-
export declare function
|
|
25
|
+
export declare function generateStatusRulesComponents(movementName: string, rules: WorkflowRule[], language: Language, options?: {
|
|
21
26
|
interactive?: boolean;
|
|
22
|
-
}):
|
|
27
|
+
}): StatusRulesComponents;
|
|
23
28
|
//# sourceMappingURL=status-rules.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-rules.d.ts","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/status-rules.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"status-rules.d.ts","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/status-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEpE,+CAA+C;AAC/C,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,MAAM,CAAC;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;IACrB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAC3C,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,YAAY,EAAE,EACrB,QAAQ,EAAE,QAAQ,EAClB,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,GAClC,qBAAqB,CA2DvB"}
|
|
@@ -1,85 +1,66 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Status rules prompt generation for workflow
|
|
2
|
+
* Status rules prompt generation for workflow movements
|
|
3
3
|
*
|
|
4
|
-
* Generates structured
|
|
5
|
-
* based on the
|
|
4
|
+
* Generates structured status rules content that tells agents which
|
|
5
|
+
* numbered tags to output based on the movement's rule configuration.
|
|
6
|
+
*
|
|
7
|
+
* Returns individual components (criteriaTable, outputList, appendix)
|
|
8
|
+
* that are passed as template variables to Phase 1/Phase 3 templates.
|
|
6
9
|
*/
|
|
7
|
-
/** Localized strings for rules-based status prompt */
|
|
8
|
-
const RULES_PROMPT_STRINGS = {
|
|
9
|
-
en: {
|
|
10
|
-
criteriaHeading: '## Decision Criteria',
|
|
11
|
-
headerNum: '#',
|
|
12
|
-
headerCondition: 'Condition',
|
|
13
|
-
headerTag: 'Tag',
|
|
14
|
-
outputHeading: '## Output Format',
|
|
15
|
-
outputInstruction: 'Output the tag corresponding to your decision:',
|
|
16
|
-
appendixHeading: '### Appendix Template',
|
|
17
|
-
appendixInstruction: 'When outputting `[{tag}]`, append the following:',
|
|
18
|
-
},
|
|
19
|
-
ja: {
|
|
20
|
-
criteriaHeading: '## 判定基準',
|
|
21
|
-
headerNum: '#',
|
|
22
|
-
headerCondition: '状況',
|
|
23
|
-
headerTag: 'タグ',
|
|
24
|
-
outputHeading: '## 出力フォーマット',
|
|
25
|
-
outputInstruction: '判定に対応するタグを出力してください:',
|
|
26
|
-
appendixHeading: '### 追加出力テンプレート',
|
|
27
|
-
appendixInstruction: '`[{tag}]` を出力する場合、以下を追記してください:',
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
10
|
/**
|
|
31
|
-
* Generate status rules
|
|
32
|
-
* Creates a structured prompt that tells the agent which numbered tags to output.
|
|
11
|
+
* Generate status rules components from rules configuration.
|
|
33
12
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
* |---|------|------|
|
|
38
|
-
* | 1 | 要件が明確で実装可能 | `[PLAN:1]` |
|
|
39
|
-
* | 2 | ユーザーが質問をしている | `[PLAN:2]` |
|
|
40
|
-
* | 3 | 要件が不明確、情報不足 | `[PLAN:3]` |
|
|
13
|
+
* Loop expansion (criteria table rows, output list items, appendix blocks)
|
|
14
|
+
* is done in code and returned as individual string components.
|
|
15
|
+
* These are passed as template variables to the Phase 1/Phase 3 templates.
|
|
41
16
|
*/
|
|
42
|
-
export function
|
|
43
|
-
const tag =
|
|
44
|
-
const strings = RULES_PROMPT_STRINGS[language];
|
|
17
|
+
export function generateStatusRulesComponents(movementName, rules, language, options) {
|
|
18
|
+
const tag = movementName.toUpperCase();
|
|
45
19
|
const interactiveEnabled = options?.interactive;
|
|
46
20
|
const visibleRules = rules
|
|
47
21
|
.map((rule, index) => ({ rule, index }))
|
|
48
22
|
.filter(({ rule }) => interactiveEnabled !== false || !rule.interactiveOnly);
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
//
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
23
|
+
// Build criteria table rows
|
|
24
|
+
const headerNum = '#';
|
|
25
|
+
const headerCondition = language === 'ja' ? '状況' : 'Condition';
|
|
26
|
+
const headerTag = language === 'ja' ? 'タグ' : 'Tag';
|
|
27
|
+
const tableLines = [
|
|
28
|
+
`| ${headerNum} | ${headerCondition} | ${headerTag} |`,
|
|
29
|
+
'|---|------|------|',
|
|
30
|
+
...visibleRules.map(({ rule, index }) => `| ${index + 1} | ${rule.condition} | \`[${tag}:${index + 1}]\` |`),
|
|
31
|
+
];
|
|
32
|
+
const criteriaTable = tableLines.join('\n');
|
|
33
|
+
// Build output list
|
|
34
|
+
const outputInstruction = language === 'ja'
|
|
35
|
+
? '判定に対応するタグを出力してください:'
|
|
36
|
+
: 'Output the tag corresponding to your decision:';
|
|
37
|
+
const outputLines = [
|
|
38
|
+
outputInstruction,
|
|
39
|
+
'',
|
|
40
|
+
...visibleRules.map(({ rule, index }) => `- \`[${tag}:${index + 1}]\` — ${rule.condition}`),
|
|
41
|
+
];
|
|
42
|
+
const outputList = outputLines.join('\n');
|
|
43
|
+
// Build appendix content
|
|
68
44
|
const rulesWithAppendix = visibleRules.filter(({ rule }) => rule.appendix);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
45
|
+
const hasAppendix = rulesWithAppendix.length > 0;
|
|
46
|
+
let appendixContent = '';
|
|
47
|
+
if (hasAppendix) {
|
|
48
|
+
const appendixInstructionTemplate = language === 'ja'
|
|
49
|
+
? '`[{tag}]` を出力する場合、以下を追記してください:'
|
|
50
|
+
: 'When outputting `[{tag}]`, append the following:';
|
|
51
|
+
const appendixBlocks = [];
|
|
72
52
|
for (const { rule, index } of visibleRules) {
|
|
73
53
|
if (!rule.appendix)
|
|
74
54
|
continue;
|
|
75
55
|
const tagStr = `[${tag}:${index + 1}]`;
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
56
|
+
appendixBlocks.push('');
|
|
57
|
+
appendixBlocks.push(appendixInstructionTemplate.replace('{tag}', tagStr));
|
|
58
|
+
appendixBlocks.push('```');
|
|
59
|
+
appendixBlocks.push(rule.appendix.trimEnd());
|
|
60
|
+
appendixBlocks.push('```');
|
|
81
61
|
}
|
|
62
|
+
appendixContent = appendixBlocks.join('\n');
|
|
82
63
|
}
|
|
83
|
-
return
|
|
64
|
+
return { criteriaTable, outputList, hasAppendix, appendixContent };
|
|
84
65
|
}
|
|
85
66
|
//# sourceMappingURL=status-rules.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status-rules.js","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/status-rules.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"status-rules.js","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/status-rules.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAYH;;;;;;GAMG;AACH,MAAM,UAAU,6BAA6B,CAC3C,YAAoB,EACpB,KAAqB,EACrB,QAAkB,EAClB,OAAmC;IAEnC,MAAM,GAAG,GAAG,YAAY,CAAC,WAAW,EAAE,CAAC;IACvC,MAAM,kBAAkB,GAAG,OAAO,EAAE,WAAW,CAA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operations.
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
7
|
+
import type { WorkflowMovement, Language } from '../models/types.js';
|
|
8
|
+
import type { PhaseName } from './types.js';
|
|
8
9
|
import { type RunAgentOptions } from '../../agents/runner.js';
|
|
9
10
|
export interface PhaseRunnerContext {
|
|
10
11
|
/** Working directory (agent work dir, may be a clone) */
|
|
@@ -17,26 +18,31 @@ export interface PhaseRunnerContext {
|
|
|
17
18
|
interactive?: boolean;
|
|
18
19
|
/** Get agent session ID */
|
|
19
20
|
getSessionId: (agent: string) => string | undefined;
|
|
20
|
-
/** Build resume options for a
|
|
21
|
-
buildResumeOptions: (step:
|
|
21
|
+
/** Build resume options for a movement */
|
|
22
|
+
buildResumeOptions: (step: WorkflowMovement, sessionId: string, overrides: Pick<RunAgentOptions, 'allowedTools' | 'maxTurns'>) => RunAgentOptions;
|
|
22
23
|
/** Update agent session after a phase run */
|
|
23
24
|
updateAgentSession: (agent: string, sessionId: string | undefined) => void;
|
|
25
|
+
/** Callback for phase lifecycle logging */
|
|
26
|
+
onPhaseStart?: (step: WorkflowMovement, phase: 1 | 2 | 3, phaseName: PhaseName, instruction: string) => void;
|
|
27
|
+
/** Callback for phase completion logging */
|
|
28
|
+
onPhaseComplete?: (step: WorkflowMovement, phase: 1 | 2 | 3, phaseName: PhaseName, content: string, status: string, error?: string) => void;
|
|
24
29
|
}
|
|
25
30
|
/**
|
|
26
|
-
* Check if a
|
|
31
|
+
* Check if a movement needs Phase 3 (status judgment).
|
|
27
32
|
* Returns true when at least one rule requires tag-based detection.
|
|
28
33
|
*/
|
|
29
|
-
export declare function needsStatusJudgmentPhase(step:
|
|
34
|
+
export declare function needsStatusJudgmentPhase(step: WorkflowMovement): boolean;
|
|
30
35
|
/**
|
|
31
36
|
* Phase 2: Report output.
|
|
32
37
|
* Resumes the agent session with no tools to request report content.
|
|
33
|
-
*
|
|
38
|
+
* Each report file is generated individually in a loop.
|
|
39
|
+
* Plain text responses are written directly to files (no JSON parsing).
|
|
34
40
|
*/
|
|
35
|
-
export declare function runReportPhase(step:
|
|
41
|
+
export declare function runReportPhase(step: WorkflowMovement, movementIteration: number, ctx: PhaseRunnerContext): Promise<void>;
|
|
36
42
|
/**
|
|
37
43
|
* Phase 3: Status judgment.
|
|
38
44
|
* Resumes the agent session with no tools to ask the agent to output a status tag.
|
|
39
45
|
* Returns the Phase 3 response content (containing the status tag).
|
|
40
46
|
*/
|
|
41
|
-
export declare function runStatusJudgmentPhase(step:
|
|
47
|
+
export declare function runStatusJudgmentPhase(step: WorkflowMovement, ctx: PhaseRunnerContext): Promise<string>;
|
|
42
48
|
//# sourceMappingURL=phase-runner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phase-runner.d.ts","sourceRoot":"","sources":["../../../src/core/workflow/phase-runner.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"phase-runner.d.ts","sourceRoot":"","sources":["../../../src/core/workflow/phase-runner.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAY,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AASxE,MAAM,WAAW,kBAAkB;IACjC,yDAAyD;IACzD,GAAG,EAAE,MAAM,CAAC;IACZ,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,gCAAgC;IAChC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,iDAAiD;IACjD,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,2BAA2B;IAC3B,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IACpD,0CAA0C;IAC1C,kBAAkB,EAAE,CAAC,IAAI,EAAE,gBAAgB,E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