takt 0.2.2 → 0.3.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.
Files changed (210) hide show
  1. package/README.md +223 -166
  2. package/dist/agents/runner.d.ts +2 -4
  3. package/dist/agents/runner.d.ts.map +1 -1
  4. package/dist/agents/runner.js +6 -35
  5. package/dist/agents/runner.js.map +1 -1
  6. package/dist/claude/client.d.ts +31 -6
  7. package/dist/claude/client.d.ts.map +1 -1
  8. package/dist/claude/client.js +78 -30
  9. package/dist/claude/client.js.map +1 -1
  10. package/dist/claude/index.d.ts +1 -1
  11. package/dist/claude/index.d.ts.map +1 -1
  12. package/dist/claude/index.js +1 -1
  13. package/dist/claude/index.js.map +1 -1
  14. package/dist/cli.d.ts +4 -3
  15. package/dist/cli.d.ts.map +1 -1
  16. package/dist/cli.js +41 -20
  17. package/dist/cli.js.map +1 -1
  18. package/dist/codex/client.d.ts +0 -1
  19. package/dist/codex/client.d.ts.map +1 -1
  20. package/dist/codex/client.js +3 -6
  21. package/dist/codex/client.js.map +1 -1
  22. package/dist/commands/addTask.d.ts.map +1 -1
  23. package/dist/commands/addTask.js +23 -7
  24. package/dist/commands/addTask.js.map +1 -1
  25. package/dist/commands/eject.d.ts +13 -0
  26. package/dist/commands/eject.d.ts.map +1 -0
  27. package/dist/commands/eject.js +105 -0
  28. package/dist/commands/eject.js.map +1 -0
  29. package/dist/commands/help.d.ts.map +1 -1
  30. package/dist/commands/help.js +12 -5
  31. package/dist/commands/help.js.map +1 -1
  32. package/dist/commands/index.d.ts +2 -1
  33. package/dist/commands/index.d.ts.map +1 -1
  34. package/dist/commands/index.js +2 -1
  35. package/dist/commands/index.js.map +1 -1
  36. package/dist/commands/listTasks.d.ts +45 -0
  37. package/dist/commands/listTasks.d.ts.map +1 -0
  38. package/dist/commands/{reviewTasks.js → listTasks.js} +93 -73
  39. package/dist/commands/listTasks.js.map +1 -0
  40. package/dist/commands/refreshBuiltin.d.ts +4 -4
  41. package/dist/commands/refreshBuiltin.d.ts.map +1 -1
  42. package/dist/commands/refreshBuiltin.js +13 -29
  43. package/dist/commands/refreshBuiltin.js.map +1 -1
  44. package/dist/commands/taskExecution.d.ts +7 -5
  45. package/dist/commands/taskExecution.d.ts.map +1 -1
  46. package/dist/commands/taskExecution.js +21 -14
  47. package/dist/commands/taskExecution.js.map +1 -1
  48. package/dist/commands/workflowExecution.d.ts.map +1 -1
  49. package/dist/commands/workflowExecution.js +88 -21
  50. package/dist/commands/workflowExecution.js.map +1 -1
  51. package/dist/config/agentLoader.d.ts +3 -1
  52. package/dist/config/agentLoader.d.ts.map +1 -1
  53. package/dist/config/agentLoader.js +17 -24
  54. package/dist/config/agentLoader.js.map +1 -1
  55. package/dist/config/globalConfig.d.ts +2 -0
  56. package/dist/config/globalConfig.d.ts.map +1 -1
  57. package/dist/config/globalConfig.js +18 -0
  58. package/dist/config/globalConfig.js.map +1 -1
  59. package/dist/config/initialization.d.ts +7 -5
  60. package/dist/config/initialization.d.ts.map +1 -1
  61. package/dist/config/initialization.js +23 -21
  62. package/dist/config/initialization.js.map +1 -1
  63. package/dist/config/paths.d.ts +5 -0
  64. package/dist/config/paths.d.ts.map +1 -1
  65. package/dist/config/paths.js +9 -0
  66. package/dist/config/paths.js.map +1 -1
  67. package/dist/config/workflowLoader.d.ts +6 -4
  68. package/dist/config/workflowLoader.d.ts.map +1 -1
  69. package/dist/config/workflowLoader.js +190 -35
  70. package/dist/config/workflowLoader.js.map +1 -1
  71. package/dist/github/issue.d.ts +72 -0
  72. package/dist/github/issue.d.ts.map +1 -0
  73. package/dist/github/issue.js +143 -0
  74. package/dist/github/issue.js.map +1 -0
  75. package/dist/models/index.d.ts +1 -1
  76. package/dist/models/index.d.ts.map +1 -1
  77. package/dist/models/index.js.map +1 -1
  78. package/dist/models/schemas.d.ts +165 -90
  79. package/dist/models/schemas.d.ts.map +1 -1
  80. package/dist/models/schemas.js +79 -51
  81. package/dist/models/schemas.js.map +1 -1
  82. package/dist/models/types.d.ts +53 -20
  83. package/dist/models/types.d.ts.map +1 -1
  84. package/dist/providers/claude.js +2 -2
  85. package/dist/providers/claude.js.map +1 -1
  86. package/dist/providers/codex.d.ts.map +1 -1
  87. package/dist/providers/codex.js +0 -2
  88. package/dist/providers/codex.js.map +1 -1
  89. package/dist/providers/index.d.ts +2 -1
  90. package/dist/providers/index.d.ts.map +1 -1
  91. package/dist/providers/index.js.map +1 -1
  92. package/dist/resources/index.d.ts +3 -22
  93. package/dist/resources/index.d.ts.map +1 -1
  94. package/dist/resources/index.js +9 -76
  95. package/dist/resources/index.js.map +1 -1
  96. package/dist/task/autoCommit.d.ts +9 -6
  97. package/dist/task/autoCommit.d.ts.map +1 -1
  98. package/dist/task/autoCommit.js +21 -12
  99. package/dist/task/autoCommit.js.map +1 -1
  100. package/dist/task/branchList.d.ts +55 -0
  101. package/dist/task/branchList.d.ts.map +1 -0
  102. package/dist/task/branchList.js +131 -0
  103. package/dist/task/branchList.js.map +1 -0
  104. package/dist/task/clone.d.ts +53 -0
  105. package/dist/task/clone.d.ts.map +1 -0
  106. package/dist/task/clone.js +181 -0
  107. package/dist/task/clone.js.map +1 -0
  108. package/dist/task/index.d.ts +3 -2
  109. package/dist/task/index.d.ts.map +1 -1
  110. package/dist/task/index.js +3 -2
  111. package/dist/task/index.js.map +1 -1
  112. package/dist/task/schema.d.ts +4 -4
  113. package/dist/task/schema.js +4 -4
  114. package/dist/task/summarize.d.ts +7 -5
  115. package/dist/task/summarize.d.ts.map +1 -1
  116. package/dist/task/summarize.js +62 -29
  117. package/dist/task/summarize.js.map +1 -1
  118. package/dist/utils/session.d.ts +74 -10
  119. package/dist/utils/session.d.ts.map +1 -1
  120. package/dist/utils/session.js +101 -51
  121. package/dist/utils/session.js.map +1 -1
  122. package/dist/utils/updateNotifier.d.ts +6 -0
  123. package/dist/utils/updateNotifier.d.ts.map +1 -0
  124. package/dist/utils/updateNotifier.js +17 -0
  125. package/dist/utils/updateNotifier.js.map +1 -0
  126. package/dist/workflow/engine.d.ts +35 -2
  127. package/dist/workflow/engine.d.ts.map +1 -1
  128. package/dist/workflow/engine.js +238 -38
  129. package/dist/workflow/engine.js.map +1 -1
  130. package/dist/workflow/index.d.ts +1 -1
  131. package/dist/workflow/index.d.ts.map +1 -1
  132. package/dist/workflow/index.js +1 -1
  133. package/dist/workflow/index.js.map +1 -1
  134. package/dist/workflow/instruction-builder.d.ts +89 -20
  135. package/dist/workflow/instruction-builder.d.ts.map +1 -1
  136. package/dist/workflow/instruction-builder.js +404 -61
  137. package/dist/workflow/instruction-builder.js.map +1 -1
  138. package/dist/workflow/parallel-logger.d.ts +76 -0
  139. package/dist/workflow/parallel-logger.d.ts.map +1 -0
  140. package/dist/workflow/parallel-logger.js +173 -0
  141. package/dist/workflow/parallel-logger.js.map +1 -0
  142. package/dist/workflow/phase-runner.d.ts +40 -0
  143. package/dist/workflow/phase-runner.d.ts.map +1 -0
  144. package/dist/workflow/phase-runner.js +69 -0
  145. package/dist/workflow/phase-runner.js.map +1 -0
  146. package/dist/workflow/rule-evaluator.d.ts +64 -0
  147. package/dist/workflow/rule-evaluator.d.ts.map +1 -0
  148. package/dist/workflow/rule-evaluator.js +178 -0
  149. package/dist/workflow/rule-evaluator.js.map +1 -0
  150. package/dist/workflow/rule-utils.d.ts +13 -0
  151. package/dist/workflow/rule-utils.d.ts.map +1 -0
  152. package/dist/workflow/rule-utils.js +17 -0
  153. package/dist/workflow/rule-utils.js.map +1 -0
  154. package/dist/workflow/transitions.d.ts +5 -13
  155. package/dist/workflow/transitions.d.ts.map +1 -1
  156. package/dist/workflow/transitions.js +8 -78
  157. package/dist/workflow/transitions.js.map +1 -1
  158. package/dist/workflow/types.d.ts +2 -1
  159. package/dist/workflow/types.d.ts.map +1 -1
  160. package/package.json +4 -1
  161. package/resources/global/en/agents/default/ai-antipattern-reviewer.md +193 -0
  162. package/resources/global/en/agents/default/{architect.md → architecture-reviewer.md} +144 -44
  163. package/resources/global/en/agents/default/coder.md +7 -7
  164. package/resources/global/en/agents/default/planner.md +29 -9
  165. package/resources/global/en/agents/default/{security.md → security-reviewer.md} +23 -5
  166. package/resources/global/en/agents/default/supervisor.md +13 -2
  167. package/resources/global/en/agents/expert/frontend-reviewer.md +0 -17
  168. package/resources/global/en/agents/expert/qa-reviewer.md +0 -16
  169. package/resources/global/en/agents/expert/security-reviewer.md +0 -16
  170. package/resources/global/en/agents/expert-cqrs/cqrs-es-reviewer.md +0 -17
  171. package/resources/global/en/agents/templates/coder.md +128 -0
  172. package/resources/global/en/agents/templates/planner.md +44 -0
  173. package/resources/global/en/agents/templates/reviewer.md +57 -0
  174. package/resources/global/en/agents/templates/supervisor.md +64 -0
  175. package/resources/global/en/workflows/default.yaml +235 -770
  176. package/resources/global/en/workflows/expert-cqrs.yaml +325 -697
  177. package/resources/global/en/workflows/expert.yaml +354 -722
  178. package/resources/global/en/workflows/magi.yaml +45 -52
  179. package/resources/global/en/workflows/research.yaml +18 -99
  180. package/resources/global/en/workflows/simple.yaml +156 -421
  181. package/resources/global/ja/agents/default/{ai-reviewer.md → ai-antipattern-reviewer.md} +92 -15
  182. package/resources/global/ja/agents/default/{architect.md → architecture-reviewer.md} +148 -48
  183. package/resources/global/ja/agents/default/coder.md +7 -7
  184. package/resources/global/ja/agents/default/planner.md +29 -9
  185. package/resources/global/ja/agents/default/{security.md → security-reviewer.md} +23 -5
  186. package/resources/global/ja/agents/default/supervisor.md +13 -2
  187. package/resources/global/ja/agents/expert/frontend-reviewer.md +0 -18
  188. package/resources/global/ja/agents/expert/qa-reviewer.md +0 -16
  189. package/resources/global/ja/agents/expert/security-reviewer.md +0 -16
  190. package/resources/global/ja/agents/expert-cqrs/cqrs-es-reviewer.md +0 -18
  191. package/resources/global/ja/agents/templates/coder.md +128 -0
  192. package/resources/global/ja/agents/templates/planner.md +44 -0
  193. package/resources/global/ja/agents/templates/reviewer.md +57 -0
  194. package/resources/global/ja/agents/templates/supervisor.md +64 -0
  195. package/resources/global/ja/workflows/default.yaml +230 -771
  196. package/resources/global/ja/workflows/expert-cqrs.yaml +316 -832
  197. package/resources/global/ja/workflows/expert.yaml +331 -711
  198. package/resources/global/ja/workflows/magi.yaml +45 -52
  199. package/resources/global/ja/workflows/research.yaml +18 -99
  200. package/resources/global/ja/workflows/simple.yaml +149 -415
  201. package/resources/project/dotgitignore +10 -0
  202. package/resources/project/tasks/TASK-FORMAT +37 -0
  203. package/dist/commands/reviewTasks.d.ts +0 -43
  204. package/dist/commands/reviewTasks.d.ts.map +0 -1
  205. package/dist/commands/reviewTasks.js.map +0 -1
  206. package/dist/task/worktree.d.ts +0 -70
  207. package/dist/task/worktree.d.ts.map +0 -1
  208. package/dist/task/worktree.js +0 -221
  209. package/dist/task/worktree.js.map +0 -1
  210. package/resources/global/en/agents/default/ai-reviewer.md +0 -116
@@ -1,42 +1,101 @@
1
1
  /**
2
2
  * Instruction template builder for workflow steps
3
3
  *
4
- * Builds the instruction string for agent execution by replacing
5
- * template placeholders with actual values.
4
+ * Builds the instruction string for agent execution by:
5
+ * 1. Auto-injecting standard sections (Execution Context, Workflow Context,
6
+ * User Request, Previous Response, Additional User Inputs, Instructions header,
7
+ * Status Output Rules)
8
+ * 2. Replacing template placeholders with actual values
9
+ *
10
+ * Status rules are injected into Phase 1 for tag-based detection,
11
+ * and also used in Phase 3 (buildStatusJudgmentInstruction) as a dedicated follow-up.
6
12
  */
7
- import { join } from 'node:path';
8
- import { getGitDiff } from '../agents/runner.js';
13
+ import { hasTagBasedRules } from './rule-utils.js';
9
14
  /**
10
- * Build execution metadata from instruction context.
15
+ * Build execution metadata from instruction context and step config.
11
16
  *
12
- * Pure function: InstructionContext → ExecutionMetadata.
17
+ * Pure function: (InstructionContext, edit?) → ExecutionMetadata.
13
18
  */
14
- export function buildExecutionMetadata(context) {
19
+ export function buildExecutionMetadata(context, edit) {
15
20
  return {
16
21
  workingDirectory: context.cwd,
17
22
  language: context.language ?? 'en',
23
+ edit,
18
24
  };
19
25
  }
20
- /** Localized strings for status rules header */
21
- const STATUS_RULES_HEADER_STRINGS = {
26
+ /** Localized strings for rules-based status prompt */
27
+ const RULES_PROMPT_STRINGS = {
22
28
  en: {
23
- heading: '# ⚠️ Required: Status Output Rules ⚠️',
24
- warning: '**The workflow will stop without this tag.**',
25
- instruction: 'Your final output MUST include a status tag following the rules below.',
29
+ criteriaHeading: '## Decision Criteria',
30
+ headerNum: '#',
31
+ headerCondition: 'Condition',
32
+ headerTag: 'Tag',
33
+ outputHeading: '## Output Format',
34
+ outputInstruction: 'Output the tag corresponding to your decision:',
35
+ appendixHeading: '### Appendix Template',
36
+ appendixInstruction: 'When outputting `[{tag}]`, append the following:',
26
37
  },
27
38
  ja: {
28
- heading: '# ⚠️ 必須: ステータス出力ルール ⚠️',
29
- warning: '**このタグがないとワークフローが停止します。**',
30
- instruction: '最終出力には必ず以下のルールに従ったステータスタグを含めてください。',
39
+ criteriaHeading: '## 判定基準',
40
+ headerNum: '#',
41
+ headerCondition: '状況',
42
+ headerTag: 'タグ',
43
+ outputHeading: '## 出力フォーマット',
44
+ outputInstruction: '判定に対応するタグを出力してください:',
45
+ appendixHeading: '### 追加出力テンプレート',
46
+ appendixInstruction: '`[{tag}]` を出力する場合、以下を追記してください:',
31
47
  },
32
48
  };
33
49
  /**
34
- * Render status rules header.
35
- * Prepended to status_rules_prompt when it exists.
50
+ * Generate status rules prompt from rules configuration.
51
+ * Creates a structured prompt that tells the agent which numbered tags to output.
52
+ *
53
+ * Example output for step "plan" with 3 rules:
54
+ * ## 判定基準
55
+ * | # | 状況 | タグ |
56
+ * |---|------|------|
57
+ * | 1 | 要件が明確で実装可能 | `[PLAN:1]` |
58
+ * | 2 | ユーザーが質問をしている | `[PLAN:2]` |
59
+ * | 3 | 要件が不明確、情報不足 | `[PLAN:3]` |
36
60
  */
37
- export function renderStatusRulesHeader(language) {
38
- const strings = STATUS_RULES_HEADER_STRINGS[language];
39
- return [strings.heading, '', strings.warning, strings.instruction, ''].join('\n');
61
+ export function generateStatusRulesFromRules(stepName, rules, language) {
62
+ const tag = stepName.toUpperCase();
63
+ const strings = RULES_PROMPT_STRINGS[language];
64
+ const lines = [];
65
+ // Criteria table
66
+ lines.push(strings.criteriaHeading);
67
+ lines.push('');
68
+ lines.push(`| ${strings.headerNum} | ${strings.headerCondition} | ${strings.headerTag} |`);
69
+ lines.push('|---|------|------|');
70
+ for (const [i, rule] of rules.entries()) {
71
+ lines.push(`| ${i + 1} | ${rule.condition} | \`[${tag}:${i + 1}]\` |`);
72
+ }
73
+ lines.push('');
74
+ // Output format
75
+ lines.push(strings.outputHeading);
76
+ lines.push('');
77
+ lines.push(strings.outputInstruction);
78
+ lines.push('');
79
+ for (const [i, rule] of rules.entries()) {
80
+ lines.push(`- \`[${tag}:${i + 1}]\` — ${rule.condition}`);
81
+ }
82
+ // Appendix templates (if any rules have appendix)
83
+ const rulesWithAppendix = rules.filter((r) => r.appendix);
84
+ if (rulesWithAppendix.length > 0) {
85
+ lines.push('');
86
+ lines.push(strings.appendixHeading);
87
+ for (const [i, rule] of rules.entries()) {
88
+ if (!rule.appendix)
89
+ continue;
90
+ const tagStr = `[${tag}:${i + 1}]`;
91
+ lines.push('');
92
+ lines.push(strings.appendixInstruction.replace('{tag}', tagStr));
93
+ lines.push('```');
94
+ lines.push(rule.appendix.trimEnd());
95
+ lines.push('```');
96
+ }
97
+ }
98
+ return lines.join('\n');
40
99
  }
41
100
  /** Localized strings for execution metadata rendering */
42
101
  const METADATA_STRINGS = {
@@ -46,6 +105,8 @@ const METADATA_STRINGS = {
46
105
  rulesHeading: '## Execution Rules',
47
106
  noCommit: '**Do NOT run git commit.** Commits are handled automatically by the system after workflow completion.',
48
107
  noCd: '**Do NOT use `cd` in Bash commands.** Your working directory is already set correctly. Run commands directly without changing directories.',
108
+ editEnabled: '**Editing is ENABLED for this step.** You may create, modify, and delete files as needed to fulfill the user\'s request.',
109
+ editDisabled: '**Editing is DISABLED for this step.** Do NOT create, modify, or delete any project source files. You may only read/search code and write to report files in the Report Directory.',
49
110
  note: 'Note: This section is metadata. Follow the language used in the rest of the prompt.',
50
111
  },
51
112
  ja: {
@@ -54,6 +115,8 @@ const METADATA_STRINGS = {
54
115
  rulesHeading: '## 実行ルール',
55
116
  noCommit: '**git commit を実行しないでください。** コミットはワークフロー完了後にシステムが自動で行います。',
56
117
  noCd: '**Bashコマンドで `cd` を使用しないでください。** 作業ディレクトリは既に正しく設定されています。ディレクトリを変更せずにコマンドを実行してください。',
118
+ editEnabled: '**このステップでは編集が許可されています。** ユーザーの要求に応じて、ファイルの作成・変更・削除を行ってください。',
119
+ editDisabled: '**このステップでは編集が禁止されています。** プロジェクトのソースファイルを作成・変更・削除しないでください。コードの読み取り・検索と、Report Directoryへのレポート出力のみ行えます。',
57
120
  note: '',
58
121
  },
59
122
  };
@@ -74,6 +137,12 @@ export function renderExecutionMetadata(metadata) {
74
137
  `- ${strings.noCommit}`,
75
138
  `- ${strings.noCd}`,
76
139
  ];
140
+ if (metadata.edit === true) {
141
+ lines.push(`- ${strings.editEnabled}`);
142
+ }
143
+ else if (metadata.edit === false) {
144
+ lines.push(`- ${strings.editDisabled}`);
145
+ }
77
146
  if (strings.note) {
78
147
  lines.push('');
79
148
  lines.push(strings.note);
@@ -88,60 +157,334 @@ function escapeTemplateChars(str) {
88
157
  return str.replace(/\{/g, '{').replace(/\}/g, '}');
89
158
  }
90
159
  /**
91
- * Build instruction from template with context values.
160
+ * Check if a report config is the object form (ReportObjectConfig).
161
+ */
162
+ export function isReportObjectConfig(report) {
163
+ return typeof report === 'object' && !Array.isArray(report) && 'name' in report;
164
+ }
165
+ /** Localized strings for auto-injected sections */
166
+ const SECTION_STRINGS = {
167
+ en: {
168
+ workflowContext: '## Workflow Context',
169
+ iteration: 'Iteration',
170
+ iterationWorkflowWide: '(workflow-wide)',
171
+ stepIteration: 'Step Iteration',
172
+ stepIterationTimes: '(times this step has run)',
173
+ step: 'Step',
174
+ reportDirectory: 'Report Directory',
175
+ reportFile: 'Report File',
176
+ reportFiles: 'Report Files',
177
+ userRequest: '## User Request',
178
+ previousResponse: '## Previous Response',
179
+ additionalUserInputs: '## Additional User Inputs',
180
+ instructions: '## Instructions',
181
+ },
182
+ ja: {
183
+ workflowContext: '## Workflow Context',
184
+ iteration: 'Iteration',
185
+ iterationWorkflowWide: '(ワークフロー全体)',
186
+ stepIteration: 'Step Iteration',
187
+ stepIterationTimes: '(このステップの実行回数)',
188
+ step: 'Step',
189
+ reportDirectory: 'Report Directory',
190
+ reportFile: 'Report File',
191
+ reportFiles: 'Report Files',
192
+ userRequest: '## User Request',
193
+ previousResponse: '## Previous Response',
194
+ additionalUserInputs: '## Additional User Inputs',
195
+ instructions: '## Instructions',
196
+ },
197
+ };
198
+ /** Localized strings for auto-generated report output instructions */
199
+ const REPORT_OUTPUT_STRINGS = {
200
+ en: {
201
+ singleHeading: '**Report output:** Output to the `Report File` specified above.',
202
+ multiHeading: '**Report output:** Output to the `Report Files` specified above.',
203
+ createRule: '- If file does not exist: Create new file',
204
+ appendRule: '- If file exists: Append with `## Iteration {step_iteration}` section',
205
+ },
206
+ ja: {
207
+ singleHeading: '**レポート出力:** `Report File` に出力してください。',
208
+ multiHeading: '**レポート出力:** Report Files に出力してください。',
209
+ createRule: '- ファイルが存在しない場合: 新規作成',
210
+ appendRule: '- ファイルが存在する場合: `## Iteration {step_iteration}` セクションを追記',
211
+ },
212
+ };
213
+ /**
214
+ * Generate report output instructions from step.report config.
215
+ * Returns undefined if step has no report or no reportDir.
92
216
  *
93
- * Supported placeholders:
94
- * - {task} - The main task/prompt
95
- * - {iteration} - Current iteration number (workflow-wide turn count)
96
- * - {max_iterations} - Maximum iterations allowed
97
- * - {step_iteration} - Current step's iteration number (how many times this step has been executed)
98
- * - {previous_response} - Output from previous step (if passPreviousResponse is true)
99
- * - {git_diff} - Current git diff output
100
- * - {user_inputs} - Accumulated user inputs
101
- * - {report_dir} - Report directory name (e.g., "20250126-143052-task-summary")
217
+ * This replaces the manual `order:` fields and instruction_template
218
+ * report output blocks that were previously hand-written in each YAML.
102
219
  */
103
- export function buildInstruction(step, context) {
104
- let instruction = step.instructionTemplate;
220
+ function renderReportOutputInstruction(step, context, language) {
221
+ if (!step.report || !context.reportDir)
222
+ return undefined;
223
+ const s = REPORT_OUTPUT_STRINGS[language];
224
+ const isMulti = Array.isArray(step.report);
225
+ const heading = isMulti ? s.multiHeading : s.singleHeading;
226
+ const appendRule = s.appendRule.replace('{step_iteration}', String(context.stepIteration));
227
+ return [heading, s.createRule, appendRule].join('\n');
228
+ }
229
+ /**
230
+ * Render the Workflow Context section.
231
+ */
232
+ function renderWorkflowContext(step, context, language) {
233
+ const s = SECTION_STRINGS[language];
234
+ const lines = [
235
+ s.workflowContext,
236
+ `- ${s.iteration}: ${context.iteration}/${context.maxIterations}${s.iterationWorkflowWide}`,
237
+ `- ${s.stepIteration}: ${context.stepIteration}${s.stepIterationTimes}`,
238
+ `- ${s.step}: ${step.name}`,
239
+ ];
240
+ return lines.join('\n');
241
+ }
242
+ /**
243
+ * Render report info for the Workflow Context section.
244
+ * Used only by buildReportInstruction() (phase 2).
245
+ */
246
+ function renderReportContext(report, reportDir, language) {
247
+ const s = SECTION_STRINGS[language];
248
+ const lines = [
249
+ `- ${s.reportDirectory}: ${reportDir}/`,
250
+ ];
251
+ if (typeof report === 'string') {
252
+ lines.push(`- ${s.reportFile}: ${reportDir}/${report}`);
253
+ }
254
+ else if (isReportObjectConfig(report)) {
255
+ lines.push(`- ${s.reportFile}: ${reportDir}/${report.name}`);
256
+ }
257
+ else {
258
+ lines.push(`- ${s.reportFiles}:`);
259
+ for (const file of report) {
260
+ lines.push(` - ${file.label}: ${reportDir}/${file.path}`);
261
+ }
262
+ }
263
+ return lines.join('\n');
264
+ }
265
+ /**
266
+ * Replace template placeholders in the instruction_template body.
267
+ *
268
+ * These placeholders may still be used in instruction_template for
269
+ * backward compatibility or special cases.
270
+ */
271
+ function replaceTemplatePlaceholders(template, step, context) {
272
+ let result = template;
273
+ // These placeholders are also covered by auto-injected sections
274
+ // (User Request, Previous Response, Additional User Inputs), but kept here
275
+ // for backward compatibility with workflows that still embed them in
276
+ // instruction_template (e.g., research.yaml, magi.yaml).
277
+ // New workflows should NOT use {task} or {user_inputs} in instruction_template
278
+ // since they are auto-injected as separate sections.
105
279
  // Replace {task}
106
- instruction = instruction.replace(/\{task\}/g, escapeTemplateChars(context.task));
280
+ result = result.replace(/\{task\}/g, escapeTemplateChars(context.task));
107
281
  // Replace {iteration}, {max_iterations}, and {step_iteration}
108
- instruction = instruction.replace(/\{iteration\}/g, String(context.iteration));
109
- instruction = instruction.replace(/\{max_iterations\}/g, String(context.maxIterations));
110
- instruction = instruction.replace(/\{step_iteration\}/g, String(context.stepIteration));
282
+ result = result.replace(/\{iteration\}/g, String(context.iteration));
283
+ result = result.replace(/\{max_iterations\}/g, String(context.maxIterations));
284
+ result = result.replace(/\{step_iteration\}/g, String(context.stepIteration));
111
285
  // Replace {previous_response}
112
286
  if (step.passPreviousResponse) {
113
287
  if (context.previousOutput) {
114
- instruction = instruction.replace(/\{previous_response\}/g, escapeTemplateChars(context.previousOutput.content));
288
+ result = result.replace(/\{previous_response\}/g, escapeTemplateChars(context.previousOutput.content));
115
289
  }
116
290
  else {
117
- instruction = instruction.replace(/\{previous_response\}/g, '');
291
+ result = result.replace(/\{previous_response\}/g, '');
118
292
  }
119
293
  }
120
- // Replace {git_diff}
121
- const gitDiff = getGitDiff(context.cwd);
122
- instruction = instruction.replace(/\{git_diff\}/g, gitDiff);
123
294
  // Replace {user_inputs}
124
295
  const userInputsStr = context.userInputs.join('\n');
125
- instruction = instruction.replace(/\{user_inputs\}/g, escapeTemplateChars(userInputsStr));
126
- // Replace .takt/reports/{report_dir} with absolute path first,
127
- // then replace standalone {report_dir} with the directory name.
128
- // This ensures agents always use the correct project root for reports,
129
- // even when their cwd is a worktree.
296
+ result = result.replace(/\{user_inputs\}/g, escapeTemplateChars(userInputsStr));
297
+ // Replace {report_dir}
298
+ if (context.reportDir) {
299
+ result = result.replace(/\{report_dir\}/g, context.reportDir);
300
+ }
301
+ // Replace {report:filename} with reportDir/filename
130
302
  if (context.reportDir) {
131
- const projectRoot = context.projectCwd ?? context.cwd;
132
- const reportDirFullPath = join(projectRoot, '.takt', 'reports', context.reportDir);
133
- instruction = instruction.replace(/\.takt\/reports\/\{report_dir\}/g, reportDirFullPath);
134
- instruction = instruction.replace(/\{report_dir\}/g, context.reportDir);
135
- }
136
- // Append status_rules_prompt with localized header if present
137
- if (step.statusRulesPrompt) {
138
- const statusHeader = renderStatusRulesHeader(context.language ?? 'en');
139
- instruction = `${instruction}\n\n${statusHeader}\n${step.statusRulesPrompt}`;
140
- }
141
- // Prepend execution context metadata so agents see it first.
142
- // Now language-aware, so no need to hide it at the end.
143
- const metadata = buildExecutionMetadata(context);
144
- instruction = `${renderExecutionMetadata(metadata)}\n${instruction}`;
145
- return instruction;
303
+ result = result.replace(/\{report:([^}]+)\}/g, (_match, filename) => {
304
+ return `${context.reportDir}/${filename}`;
305
+ });
306
+ }
307
+ return result;
308
+ }
309
+ /**
310
+ * Build instruction from template with context values.
311
+ *
312
+ * Generates a complete instruction by auto-injecting standard sections
313
+ * around the step-specific instruction_template content:
314
+ *
315
+ * 1. Execution Context (working directory, rules) — always
316
+ * 2. Workflow Context (iteration, step, report info) — always
317
+ * 3. User Request ({task}) — unless template contains {task}
318
+ * 4. Previous Response — if passPreviousResponse and has content, unless template contains {previous_response}
319
+ * 5. Additional User Inputs — unless template contains {user_inputs}
320
+ * 6. Instructions header + instruction_template content — always
321
+ * 7. Status Output Rules — when step has tag-based rules (not all ai()/aggregate)
322
+ *
323
+ * Template placeholders ({task}, {previous_response}, etc.) are still replaced
324
+ * within the instruction_template body for backward compatibility.
325
+ * When a placeholder is present in the template, the corresponding
326
+ * auto-injected section is skipped to avoid duplication.
327
+ */
328
+ export function buildInstruction(step, context) {
329
+ const language = context.language ?? 'en';
330
+ const s = SECTION_STRINGS[language];
331
+ const sections = [];
332
+ // 1. Execution context metadata (working directory + rules + edit permission)
333
+ const metadata = buildExecutionMetadata(context, step.edit);
334
+ sections.push(renderExecutionMetadata(metadata));
335
+ // 2. Workflow Context (iteration, step, report info)
336
+ sections.push(renderWorkflowContext(step, context, language));
337
+ // Skip auto-injection for sections whose placeholders exist in the template,
338
+ // to avoid duplicate content. Templates using placeholders handle their own layout.
339
+ const tmpl = step.instructionTemplate;
340
+ const hasTaskPlaceholder = tmpl.includes('{task}');
341
+ const hasPreviousResponsePlaceholder = tmpl.includes('{previous_response}');
342
+ const hasUserInputsPlaceholder = tmpl.includes('{user_inputs}');
343
+ // 3. User Request (skip if template embeds {task} directly)
344
+ if (!hasTaskPlaceholder) {
345
+ sections.push(`${s.userRequest}\n${escapeTemplateChars(context.task)}`);
346
+ }
347
+ // 4. Previous Response (skip if template embeds {previous_response} directly)
348
+ if (step.passPreviousResponse && context.previousOutput && !hasPreviousResponsePlaceholder) {
349
+ sections.push(`${s.previousResponse}\n${escapeTemplateChars(context.previousOutput.content)}`);
350
+ }
351
+ // 5. Additional User Inputs (skip if template embeds {user_inputs} directly)
352
+ if (!hasUserInputsPlaceholder) {
353
+ const userInputsStr = context.userInputs.join('\n');
354
+ sections.push(`${s.additionalUserInputs}\n${escapeTemplateChars(userInputsStr)}`);
355
+ }
356
+ // 6. Instructions header + instruction_template content
357
+ const processedTemplate = replaceTemplatePlaceholders(step.instructionTemplate, step, context);
358
+ sections.push(`${s.instructions}\n${processedTemplate}`);
359
+ // 7. Status Output Rules (for tag-based detection in Phase 1)
360
+ // Skip if all rules are ai() or aggregate conditions (no tags needed)
361
+ if (hasTagBasedRules(step)) {
362
+ const statusRulesPrompt = generateStatusRulesFromRules(step.name, step.rules, language);
363
+ sections.push(statusRulesPrompt);
364
+ }
365
+ return sections.join('\n\n');
366
+ }
367
+ /** Localized strings for report phase execution rules */
368
+ const REPORT_PHASE_STRINGS = {
369
+ en: {
370
+ noSourceEdit: '**Do NOT modify project source files.** Only output report files.',
371
+ instructionBody: 'Output the results of your previous work as a report.',
372
+ },
373
+ ja: {
374
+ noSourceEdit: '**プロジェクトのソースファイルを変更しないでください。** レポートファイルのみ出力してください。',
375
+ instructionBody: '前のステップの作業結果をレポートとして出力してください。',
376
+ },
377
+ };
378
+ /**
379
+ * Build instruction for phase 2 (report output).
380
+ *
381
+ * Separate from buildInstruction() — only includes:
382
+ * - Execution Context (cwd + rules)
383
+ * - Workflow Context (report info only)
384
+ * - Report output instruction + format
385
+ *
386
+ * Does NOT include: User Request, Previous Response, User Inputs,
387
+ * Status rules, instruction_template.
388
+ */
389
+ export function buildReportInstruction(step, context) {
390
+ if (!step.report) {
391
+ throw new Error(`buildReportInstruction called for step "${step.name}" which has no report config`);
392
+ }
393
+ const language = context.language ?? 'en';
394
+ const s = SECTION_STRINGS[language];
395
+ const r = REPORT_PHASE_STRINGS[language];
396
+ const m = METADATA_STRINGS[language];
397
+ const sections = [];
398
+ // 1. Execution Context
399
+ const execLines = [
400
+ m.heading,
401
+ `- ${m.workingDirectory}: ${context.cwd}`,
402
+ '',
403
+ m.rulesHeading,
404
+ `- ${m.noCommit}`,
405
+ `- ${m.noCd}`,
406
+ `- ${r.noSourceEdit}`,
407
+ ];
408
+ if (m.note) {
409
+ execLines.push('');
410
+ execLines.push(m.note);
411
+ }
412
+ execLines.push('');
413
+ sections.push(execLines.join('\n'));
414
+ // 2. Workflow Context (report info only)
415
+ const workflowLines = [
416
+ s.workflowContext,
417
+ renderReportContext(step.report, context.reportDir, language),
418
+ ];
419
+ sections.push(workflowLines.join('\n'));
420
+ // 3. Instructions + report output instruction + format
421
+ const instrParts = [
422
+ `${s.instructions}`,
423
+ r.instructionBody,
424
+ ];
425
+ // Report output instruction (auto-generated or explicit order)
426
+ const reportContext = {
427
+ task: '',
428
+ iteration: 0,
429
+ maxIterations: 0,
430
+ stepIteration: context.stepIteration,
431
+ cwd: context.cwd,
432
+ userInputs: [],
433
+ reportDir: context.reportDir,
434
+ language,
435
+ };
436
+ if (isReportObjectConfig(step.report) && step.report.order) {
437
+ const processedOrder = replaceTemplatePlaceholders(step.report.order.trimEnd(), step, reportContext);
438
+ instrParts.push('');
439
+ instrParts.push(processedOrder);
440
+ }
441
+ else {
442
+ const reportInstruction = renderReportOutputInstruction(step, reportContext, language);
443
+ if (reportInstruction) {
444
+ instrParts.push('');
445
+ instrParts.push(reportInstruction);
446
+ }
447
+ }
448
+ // Report format
449
+ if (isReportObjectConfig(step.report) && step.report.format) {
450
+ const processedFormat = replaceTemplatePlaceholders(step.report.format.trimEnd(), step, reportContext);
451
+ instrParts.push('');
452
+ instrParts.push(processedFormat);
453
+ }
454
+ sections.push(instrParts.join('\n'));
455
+ return sections.join('\n\n');
456
+ }
457
+ /** Localized strings for status judgment phase (Phase 3) */
458
+ const STATUS_JUDGMENT_STRINGS = {
459
+ en: {
460
+ header: 'Review your work results and determine the status. Do NOT perform any additional work.',
461
+ },
462
+ ja: {
463
+ header: '作業結果を振り返り、ステータスを判定してください。追加の作業は行わないでください。',
464
+ },
465
+ };
466
+ /**
467
+ * Build instruction for Phase 3 (status judgment).
468
+ *
469
+ * Resumes the agent session and asks it to evaluate its work
470
+ * and output the appropriate status tag. No tools are allowed.
471
+ *
472
+ * Includes:
473
+ * - Header instruction (review and determine status)
474
+ * - Status rules (criteria table + output format) from generateStatusRulesFromRules()
475
+ */
476
+ export function buildStatusJudgmentInstruction(step, context) {
477
+ if (!step.rules || step.rules.length === 0) {
478
+ throw new Error(`buildStatusJudgmentInstruction called for step "${step.name}" which has no rules`);
479
+ }
480
+ const language = context.language ?? 'en';
481
+ const s = STATUS_JUDGMENT_STRINGS[language];
482
+ const sections = [];
483
+ // Header
484
+ sections.push(s.header);
485
+ // Status rules (criteria table + output format)
486
+ const generatedPrompt = generateStatusRulesFromRules(step.name, step.rules, language);
487
+ sections.push(generatedPrompt);
488
+ return sections.join('\n\n');
146
489
  }
147
490
  //# sourceMappingURL=instruction-builder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"instruction-builder.js","sourceR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1
+ /**
2
+ * Parallel step log display
3
+ *
4
+ * Provides prefixed, color-coded interleaved output for parallel sub-steps.
5
+ * Each sub-step's stream output gets a `[name]` prefix with right-padding
6
+ * aligned to the longest sub-step name.
7
+ */
8
+ import type { StreamCallback } from '../claude/types.js';
9
+ export interface ParallelLoggerOptions {
10
+ /** Sub-step names (used to calculate prefix width) */
11
+ subStepNames: string[];
12
+ /** Parent onStream callback to delegate non-prefixed events */
13
+ parentOnStream?: StreamCallback;
14
+ /** Override process.stdout.write for testing */
15
+ writeFn?: (text: string) => void;
16
+ }
17
+ /**
18
+ * Logger for parallel step execution.
19
+ *
20
+ * Creates per-sub-step StreamCallback wrappers that:
21
+ * - Buffer partial lines until newline
22
+ * - Prepend colored `[name]` prefix to each complete line
23
+ * - Delegate init/result/error events to the parent callback
24
+ */
25
+ export declare class ParallelLogger {
26
+ private readonly maxNameLength;
27
+ private readonly lineBuffers;
28
+ private readonly parentOnStream?;
29
+ private readonly writeFn;
30
+ constructor(options: ParallelLoggerOptions);
31
+ /**
32
+ * Build the colored prefix string for a sub-step.
33
+ * Format: `\x1b[COLORm[name]\x1b[0m` + padding spaces
34
+ */
35
+ buildPrefix(name: string, index: number): string;
36
+ /**
37
+ * Create a StreamCallback wrapper for a specific sub-step.
38
+ *
39
+ * - `text`: buffered line-by-line with prefix
40
+ * - `tool_use`, `tool_result`, `tool_output`, `thinking`: prefixed per-line, no buffering
41
+ * - `init`, `result`, `error`: delegated to parent callback (no prefix)
42
+ */
43
+ createStreamHandler(subStepName: string, index: number): StreamCallback;
44
+ /**
45
+ * Handle text event with line buffering.
46
+ * Buffer until newline, then output prefixed complete lines.
47
+ * Empty lines get no prefix per spec.
48
+ */
49
+ private handleTextEvent;
50
+ /**
51
+ * Handle block events (tool_use, tool_result, tool_output, thinking).
52
+ * Output with prefix, splitting multi-line content.
53
+ */
54
+ private handleBlockEvent;
55
+ /**
56
+ * Flush remaining line buffers for all sub-steps.
57
+ * Call after all sub-steps complete to output any trailing partial lines.
58
+ */
59
+ flush(): void;
60
+ /**
61
+ * Print completion summary after all sub-steps finish.
62
+ *
63
+ * Format:
64
+ * ```
65
+ * ── parallel-review results ──
66
+ * arch-review: approved
67
+ * security-review: rejected
68
+ * ──────────────────────────────
69
+ * ```
70
+ */
71
+ printSummary(parentStepName: string, results: Array<{
72
+ name: string;
73
+ condition: string | undefined;
74
+ }>): void;
75
+ }
76
+ //# sourceMappingURL=parallel-logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parallel-logger.d.ts","sourceRoot":"","sources":["../../src/workflow/parallel-logger.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAe,MAAM,oBAAoB,CAAC;AAMtE,MAAM,WAAW,qBAAqB;IACpC,sDAAsD;IACtD,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,+DAA+D;IAC/D,cAAc,CAAC,EAAE,cAAc,CAAC;IAChC,gDAAgD;IAChD,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAClC;AAED;;;;;;;GAOG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAS;IACvC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAkC;IAC9D,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAiB;IACjD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAyB;gBAErC,OAAO,EAAE,qBAAqB;IAU1C;;;OAGG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAMhD;;;;;;OAMG;IACH,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,cAAc;IA0BvE;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAkBvB;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IA4BxB;;;OAGG;IACH,KAAK,IAAI,IAAI;IAeb;;;;;;;;;;OAUG;IACH,YAAY,CACV,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,GAAG,SAAS,CAAA;KAAE,CAAC,GAC9D,IAAI;CA2BR"}