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.
Files changed (309) hide show
  1. package/README.md +364 -325
  2. package/dist/agents/index.d.ts +1 -1
  3. package/dist/agents/index.d.ts.map +1 -1
  4. package/dist/agents/index.js +1 -1
  5. package/dist/agents/index.js.map +1 -1
  6. package/dist/agents/runner.d.ts +0 -1
  7. package/dist/agents/runner.d.ts.map +1 -1
  8. package/dist/agents/runner.js +6 -5
  9. package/dist/agents/runner.js.map +1 -1
  10. package/dist/agents/types.d.ts +3 -1
  11. package/dist/agents/types.d.ts.map +1 -1
  12. package/dist/app/cli/commands.d.ts +1 -1
  13. package/dist/app/cli/commands.js +9 -1
  14. package/dist/app/cli/commands.js.map +1 -1
  15. package/dist/app/cli/routing.js +1 -0
  16. package/dist/app/cli/routing.js.map +1 -1
  17. package/dist/core/models/index.d.ts +1 -1
  18. package/dist/core/models/index.d.ts.map +1 -1
  19. package/dist/core/models/schemas.d.ts +8 -6
  20. package/dist/core/models/schemas.d.ts.map +1 -1
  21. package/dist/core/models/schemas.js +16 -15
  22. package/dist/core/models/schemas.js.map +1 -1
  23. package/dist/core/models/types.d.ts +1 -1
  24. package/dist/core/models/types.d.ts.map +1 -1
  25. package/dist/core/models/workflow-types.d.ts +26 -24
  26. package/dist/core/models/workflow-types.d.ts.map +1 -1
  27. package/dist/core/workflow/constants.d.ts +7 -7
  28. package/dist/core/workflow/constants.d.ts.map +1 -1
  29. package/dist/core/workflow/constants.js +7 -7
  30. package/dist/core/workflow/constants.js.map +1 -1
  31. package/dist/core/workflow/engine/MovementExecutor.d.ts +59 -0
  32. package/dist/core/workflow/engine/MovementExecutor.d.ts.map +1 -0
  33. package/dist/core/workflow/engine/{StepExecutor.js → MovementExecutor.js} +30 -25
  34. package/dist/core/workflow/engine/MovementExecutor.js.map +1 -0
  35. package/dist/core/workflow/engine/OptionsBuilder.d.ts +6 -6
  36. package/dist/core/workflow/engine/OptionsBuilder.d.ts.map +1 -1
  37. package/dist/core/workflow/engine/OptionsBuilder.js +8 -3
  38. package/dist/core/workflow/engine/OptionsBuilder.js.map +1 -1
  39. package/dist/core/workflow/engine/ParallelRunner.d.ts +12 -10
  40. package/dist/core/workflow/engine/ParallelRunner.d.ts.map +1 -1
  41. package/dist/core/workflow/engine/ParallelRunner.js +46 -41
  42. package/dist/core/workflow/engine/ParallelRunner.js.map +1 -1
  43. package/dist/core/workflow/engine/WorkflowEngine.d.ts +16 -16
  44. package/dist/core/workflow/engine/WorkflowEngine.d.ts.map +1 -1
  45. package/dist/core/workflow/engine/WorkflowEngine.js +105 -92
  46. package/dist/core/workflow/engine/WorkflowEngine.js.map +1 -1
  47. package/dist/core/workflow/engine/blocked-handler.d.ts +3 -3
  48. package/dist/core/workflow/engine/blocked-handler.d.ts.map +1 -1
  49. package/dist/core/workflow/engine/blocked-handler.js +2 -2
  50. package/dist/core/workflow/engine/blocked-handler.js.map +1 -1
  51. package/dist/core/workflow/engine/index.d.ts +2 -1
  52. package/dist/core/workflow/engine/index.d.ts.map +1 -1
  53. package/dist/core/workflow/engine/index.js +1 -1
  54. package/dist/core/workflow/engine/index.js.map +1 -1
  55. package/dist/core/workflow/engine/loop-detector.d.ts +5 -5
  56. package/dist/core/workflow/engine/loop-detector.d.ts.map +1 -1
  57. package/dist/core/workflow/engine/loop-detector.js +8 -8
  58. package/dist/core/workflow/engine/loop-detector.js.map +1 -1
  59. package/dist/core/workflow/engine/parallel-logger.d.ts +15 -15
  60. package/dist/core/workflow/engine/parallel-logger.d.ts.map +1 -1
  61. package/dist/core/workflow/engine/parallel-logger.js +22 -21
  62. package/dist/core/workflow/engine/parallel-logger.js.map +1 -1
  63. package/dist/core/workflow/engine/state-manager.d.ts +6 -6
  64. package/dist/core/workflow/engine/state-manager.d.ts.map +1 -1
  65. package/dist/core/workflow/engine/state-manager.js +15 -16
  66. package/dist/core/workflow/engine/state-manager.js.map +1 -1
  67. package/dist/core/workflow/engine/transitions.d.ts +5 -5
  68. package/dist/core/workflow/engine/transitions.d.ts.map +1 -1
  69. package/dist/core/workflow/engine/transitions.js +4 -4
  70. package/dist/core/workflow/engine/transitions.js.map +1 -1
  71. package/dist/core/workflow/evaluation/AggregateEvaluator.d.ts +15 -15
  72. package/dist/core/workflow/evaluation/AggregateEvaluator.d.ts.map +1 -1
  73. package/dist/core/workflow/evaluation/AggregateEvaluator.js +35 -33
  74. package/dist/core/workflow/evaluation/AggregateEvaluator.js.map +1 -1
  75. package/dist/core/workflow/evaluation/RuleEvaluator.d.ts +8 -8
  76. package/dist/core/workflow/evaluation/RuleEvaluator.d.ts.map +1 -1
  77. package/dist/core/workflow/evaluation/RuleEvaluator.js +18 -14
  78. package/dist/core/workflow/evaluation/RuleEvaluator.js.map +1 -1
  79. package/dist/core/workflow/evaluation/index.d.ts +4 -4
  80. package/dist/core/workflow/evaluation/index.d.ts.map +1 -1
  81. package/dist/core/workflow/evaluation/index.js +1 -1
  82. package/dist/core/workflow/evaluation/index.js.map +1 -1
  83. package/dist/core/workflow/evaluation/rule-utils.d.ts +4 -4
  84. package/dist/core/workflow/evaluation/rule-utils.d.ts.map +1 -1
  85. package/dist/core/workflow/evaluation/rule-utils.js +2 -2
  86. package/dist/core/workflow/evaluation/rule-utils.js.map +1 -1
  87. package/dist/core/workflow/index.d.ts +6 -6
  88. package/dist/core/workflow/index.d.ts.map +1 -1
  89. package/dist/core/workflow/index.js +5 -5
  90. package/dist/core/workflow/index.js.map +1 -1
  91. package/dist/core/workflow/instruction/InstructionBuilder.d.ts +17 -15
  92. package/dist/core/workflow/instruction/InstructionBuilder.d.ts.map +1 -1
  93. package/dist/core/workflow/instruction/InstructionBuilder.js +105 -120
  94. package/dist/core/workflow/instruction/InstructionBuilder.js.map +1 -1
  95. package/dist/core/workflow/instruction/ReportInstructionBuilder.d.ts +10 -11
  96. package/dist/core/workflow/instruction/ReportInstructionBuilder.d.ts.map +1 -1
  97. package/dist/core/workflow/instruction/ReportInstructionBuilder.js +38 -84
  98. package/dist/core/workflow/instruction/ReportInstructionBuilder.js.map +1 -1
  99. package/dist/core/workflow/instruction/StatusJudgmentBuilder.d.ts +6 -5
  100. package/dist/core/workflow/instruction/StatusJudgmentBuilder.d.ts.map +1 -1
  101. package/dist/core/workflow/instruction/StatusJudgmentBuilder.js +14 -22
  102. package/dist/core/workflow/instruction/StatusJudgmentBuilder.js.map +1 -1
  103. package/dist/core/workflow/instruction/escape.d.ts +3 -3
  104. package/dist/core/workflow/instruction/escape.d.ts.map +1 -1
  105. package/dist/core/workflow/instruction/escape.js +3 -3
  106. package/dist/core/workflow/instruction/escape.js.map +1 -1
  107. package/dist/core/workflow/instruction/instruction-context.d.ts +16 -49
  108. package/dist/core/workflow/instruction/instruction-context.d.ts.map +1 -1
  109. package/dist/core/workflow/instruction/instruction-context.js +17 -62
  110. package/dist/core/workflow/instruction/instruction-context.js.map +1 -1
  111. package/dist/core/workflow/instruction/status-rules.d.ts +19 -14
  112. package/dist/core/workflow/instruction/status-rules.d.ts.map +1 -1
  113. package/dist/core/workflow/instruction/status-rules.js +47 -66
  114. package/dist/core/workflow/instruction/status-rules.js.map +1 -1
  115. package/dist/core/workflow/phase-runner.d.ts +14 -8
  116. package/dist/core/workflow/phase-runner.d.ts.map +1 -1
  117. package/dist/core/workflow/phase-runner.js +75 -78
  118. package/dist/core/workflow/phase-runner.js.map +1 -1
  119. package/dist/core/workflow/types.d.ts +15 -12
  120. package/dist/core/workflow/types.d.ts.map +1 -1
  121. package/dist/features/config/ejectBuiltin.js +3 -3
  122. package/dist/features/config/ejectBuiltin.js.map +1 -1
  123. package/dist/features/interactive/interactive.d.ts.map +1 -1
  124. package/dist/features/interactive/interactive.js +38 -169
  125. package/dist/features/interactive/interactive.js.map +1 -1
  126. package/dist/features/prompt/index.d.ts +5 -0
  127. package/dist/features/prompt/index.d.ts.map +1 -0
  128. package/dist/features/prompt/index.js +5 -0
  129. package/dist/features/prompt/index.js.map +1 -0
  130. package/dist/features/prompt/preview.d.ts +14 -0
  131. package/dist/features/prompt/preview.d.ts.map +1 -0
  132. package/dist/features/prompt/preview.js +74 -0
  133. package/dist/features/prompt/preview.js.map +1 -0
  134. package/dist/features/tasks/add/index.d.ts +6 -9
  135. package/dist/features/tasks/add/index.d.ts.map +1 -1
  136. package/dist/features/tasks/add/index.js +23 -55
  137. package/dist/features/tasks/add/index.js.map +1 -1
  138. package/dist/features/tasks/execute/selectAndExecute.d.ts.map +1 -1
  139. package/dist/features/tasks/execute/selectAndExecute.js +1 -0
  140. package/dist/features/tasks/execute/selectAndExecute.js.map +1 -1
  141. package/dist/features/tasks/execute/taskExecution.d.ts.map +1 -1
  142. package/dist/features/tasks/execute/taskExecution.js +4 -3
  143. package/dist/features/tasks/execute/taskExecution.js.map +1 -1
  144. package/dist/features/tasks/execute/types.d.ts +13 -0
  145. package/dist/features/tasks/execute/types.d.ts.map +1 -1
  146. package/dist/features/tasks/execute/workflowExecution.d.ts.map +1 -1
  147. package/dist/features/tasks/execute/workflowExecution.js +63 -18
  148. package/dist/features/tasks/execute/workflowExecution.js.map +1 -1
  149. package/dist/features/tasks/index.d.ts +1 -1
  150. package/dist/features/tasks/index.d.ts.map +1 -1
  151. package/dist/features/tasks/index.js +1 -1
  152. package/dist/features/tasks/index.js.map +1 -1
  153. package/dist/features/tasks/list/index.d.ts.map +1 -1
  154. package/dist/features/tasks/list/index.js +0 -1
  155. package/dist/features/tasks/list/index.js.map +1 -1
  156. package/dist/features/tasks/list/taskActions.d.ts +1 -0
  157. package/dist/features/tasks/list/taskActions.d.ts.map +1 -1
  158. package/dist/features/tasks/list/taskActions.js +24 -1
  159. package/dist/features/tasks/list/taskActions.js.map +1 -1
  160. package/dist/features/workflowSelection/index.js +1 -1
  161. package/dist/features/workflowSelection/index.js.map +1 -1
  162. package/dist/index.d.ts +3 -3
  163. package/dist/index.d.ts.map +1 -1
  164. package/dist/index.js +1 -1
  165. package/dist/index.js.map +1 -1
  166. package/dist/infra/claude/client.d.ts +1 -1
  167. package/dist/infra/claude/client.d.ts.map +1 -1
  168. package/dist/infra/claude/client.js +6 -24
  169. package/dist/infra/claude/client.js.map +1 -1
  170. package/dist/infra/claude/executor.d.ts +0 -1
  171. package/dist/infra/claude/executor.d.ts.map +1 -1
  172. package/dist/infra/claude/executor.js +0 -2
  173. package/dist/infra/claude/executor.js.map +1 -1
  174. package/dist/infra/claude/index.js +2 -2
  175. package/dist/infra/claude/index.js.map +1 -1
  176. package/dist/infra/claude/options-builder.js +4 -4
  177. package/dist/infra/claude/options-builder.js.map +1 -1
  178. package/dist/infra/claude/process.d.ts +1 -1
  179. package/dist/infra/claude/process.d.ts.map +1 -1
  180. package/dist/infra/claude/process.js +1 -1
  181. package/dist/infra/claude/process.js.map +1 -1
  182. package/dist/infra/claude/query-manager.d.ts +1 -1
  183. package/dist/infra/claude/query-manager.d.ts.map +1 -1
  184. package/dist/infra/claude/query-manager.js +1 -2
  185. package/dist/infra/claude/query-manager.js.map +1 -1
  186. package/dist/infra/claude/stream-converter.d.ts +2 -2
  187. package/dist/infra/claude/stream-converter.js +2 -2
  188. package/dist/infra/claude/types.d.ts +1 -1
  189. package/dist/infra/claude/types.d.ts.map +1 -1
  190. package/dist/infra/codex/client.d.ts.map +1 -1
  191. package/dist/infra/codex/client.js +0 -1
  192. package/dist/infra/codex/client.js.map +1 -1
  193. package/dist/infra/config/global/globalConfig.d.ts.map +1 -1
  194. package/dist/infra/config/global/globalConfig.js +0 -1
  195. package/dist/infra/config/global/globalConfig.js.map +1 -1
  196. package/dist/infra/config/loaders/agentLoader.d.ts +1 -1
  197. package/dist/infra/config/loaders/agentLoader.d.ts.map +1 -1
  198. package/dist/infra/config/loaders/agentLoader.js +6 -5
  199. package/dist/infra/config/loaders/agentLoader.js.map +1 -1
  200. package/dist/infra/config/loaders/loader.d.ts +1 -1
  201. package/dist/infra/config/loaders/loader.js +1 -1
  202. package/dist/infra/config/loaders/workflowParser.d.ts.map +1 -1
  203. package/dist/infra/config/loaders/workflowParser.js +9 -5
  204. package/dist/infra/config/loaders/workflowParser.js.map +1 -1
  205. package/dist/infra/config/loaders/workflowResolver.d.ts +4 -4
  206. package/dist/infra/config/loaders/workflowResolver.js +11 -11
  207. package/dist/infra/config/loaders/workflowResolver.js.map +1 -1
  208. package/dist/infra/config/paths.d.ts +4 -4
  209. package/dist/infra/config/paths.d.ts.map +1 -1
  210. package/dist/infra/config/paths.js +7 -7
  211. package/dist/infra/config/paths.js.map +1 -1
  212. package/dist/infra/config/project/index.d.ts +1 -1
  213. package/dist/infra/config/project/index.d.ts.map +1 -1
  214. package/dist/infra/config/project/index.js.map +1 -1
  215. package/dist/infra/config/project/projectConfig.d.ts +2 -2
  216. package/dist/infra/config/project/projectConfig.d.ts.map +1 -1
  217. package/dist/infra/config/types.d.ts +0 -2
  218. package/dist/infra/config/types.d.ts.map +1 -1
  219. package/dist/infra/fs/index.d.ts +1 -1
  220. package/dist/infra/fs/index.d.ts.map +1 -1
  221. package/dist/infra/fs/index.js.map +1 -1
  222. package/dist/infra/fs/session.d.ts +1 -1
  223. package/dist/infra/fs/session.d.ts.map +1 -1
  224. package/dist/infra/fs/session.js +0 -1
  225. package/dist/infra/fs/session.js.map +1 -1
  226. package/dist/infra/providers/index.d.ts.map +1 -1
  227. package/dist/infra/providers/index.js +0 -1
  228. package/dist/infra/providers/index.js.map +1 -1
  229. package/dist/infra/task/autoCommit.js +1 -1
  230. package/dist/infra/task/autoCommit.js.map +1 -1
  231. package/dist/infra/task/branchList.d.ts +4 -2
  232. package/dist/infra/task/branchList.d.ts.map +1 -1
  233. package/dist/infra/task/branchList.js +87 -9
  234. package/dist/infra/task/branchList.js.map +1 -1
  235. package/dist/infra/task/clone.js +1 -1
  236. package/dist/infra/task/clone.js.map +1 -1
  237. package/dist/infra/task/parser.d.ts +1 -1
  238. package/dist/infra/task/parser.js +1 -1
  239. package/dist/infra/task/summarize.d.ts.map +1 -1
  240. package/dist/infra/task/summarize.js +3 -15
  241. package/dist/infra/task/summarize.js.map +1 -1
  242. package/dist/infra/task/types.d.ts +1 -0
  243. package/dist/infra/task/types.d.ts.map +1 -1
  244. package/dist/shared/context.d.ts.map +1 -1
  245. package/dist/shared/context.js +0 -1
  246. package/dist/shared/context.js.map +1 -1
  247. package/dist/shared/i18n/index.d.ts +31 -0
  248. package/dist/shared/i18n/index.d.ts.map +1 -0
  249. package/dist/shared/i18n/index.js +97 -0
  250. package/dist/shared/i18n/index.js.map +1 -0
  251. package/dist/shared/i18n/labels_en.yaml +37 -0
  252. package/dist/shared/i18n/labels_ja.yaml +37 -0
  253. package/dist/shared/prompt/select.d.ts +0 -3
  254. package/dist/shared/prompt/select.d.ts.map +1 -1
  255. package/dist/shared/prompt/select.js +5 -20
  256. package/dist/shared/prompt/select.js.map +1 -1
  257. package/dist/shared/prompts/en/perform_agent_system_prompt.md +7 -0
  258. package/dist/shared/prompts/en/perform_builtin_agent_system_prompt.md +7 -0
  259. package/dist/shared/prompts/en/perform_judge_message.md +24 -0
  260. package/dist/shared/prompts/en/perform_phase1_message.md +45 -0
  261. package/dist/shared/prompts/en/perform_phase2_message.md +31 -0
  262. package/dist/shared/prompts/en/perform_phase3_message.md +19 -0
  263. package/dist/shared/prompts/en/score_interactive_system_prompt.md +53 -0
  264. package/dist/shared/prompts/en/score_slug_system_prompt.md +19 -0
  265. package/dist/shared/prompts/en/score_summary_system_prompt.md +25 -0
  266. package/dist/shared/prompts/index.d.ts +27 -0
  267. package/dist/shared/prompts/index.d.ts.map +1 -0
  268. package/dist/shared/prompts/index.js +111 -0
  269. package/dist/shared/prompts/index.js.map +1 -0
  270. package/dist/shared/prompts/ja/perform_agent_system_prompt.md +7 -0
  271. package/dist/shared/prompts/ja/perform_builtin_agent_system_prompt.md +7 -0
  272. package/dist/shared/prompts/ja/perform_judge_message.md +24 -0
  273. package/dist/shared/prompts/ja/perform_phase1_message.md +44 -0
  274. package/dist/shared/prompts/ja/perform_phase2_message.md +30 -0
  275. package/dist/shared/prompts/ja/perform_phase3_message.md +19 -0
  276. package/dist/shared/prompts/ja/score_interactive_system_prompt.md +59 -0
  277. package/dist/shared/prompts/ja/score_slug_system_prompt.md +19 -0
  278. package/dist/shared/prompts/ja/score_summary_system_prompt.md +32 -0
  279. package/dist/shared/ui/LogManager.d.ts +1 -1
  280. package/dist/shared/ui/LogManager.d.ts.map +1 -1
  281. package/dist/shared/ui/LogManager.js +1 -2
  282. package/dist/shared/ui/LogManager.js.map +1 -1
  283. package/dist/shared/utils/debug.js +1 -1
  284. package/dist/shared/utils/debug.js.map +1 -1
  285. package/dist/shared/utils/types.d.ts +29 -1
  286. package/dist/shared/utils/types.d.ts.map +1 -1
  287. package/package.json +2 -2
  288. package/resources/global/en/{workflows → pieces}/default.yaml +16 -16
  289. package/resources/global/en/{workflows → pieces}/expert-cqrs.yaml +17 -17
  290. package/resources/global/en/{workflows → pieces}/expert.yaml +20 -20
  291. package/resources/global/en/{workflows → pieces}/magi.yaml +4 -4
  292. package/resources/global/en/{workflows → pieces}/minimal.yaml +7 -7
  293. package/resources/global/en/{workflows → pieces}/research.yaml +11 -11
  294. package/resources/global/en/{workflows → pieces}/review-fix-minimal.yaml +8 -8
  295. package/resources/global/en/{workflows → pieces}/review-only.yaml +7 -7
  296. package/resources/global/ja/agents/default/architecture-reviewer.md +3 -3
  297. package/resources/global/ja/agents/default/supervisor.md +1 -1
  298. package/resources/global/ja/agents/templates/planner.md +1 -1
  299. package/resources/global/ja/{workflows → pieces}/default.yaml +12 -12
  300. package/resources/global/ja/{workflows → pieces}/expert-cqrs.yaml +18 -18
  301. package/resources/global/ja/{workflows → pieces}/expert.yaml +15 -15
  302. package/resources/global/ja/{workflows → pieces}/magi.yaml +4 -4
  303. package/resources/global/ja/{workflows → pieces}/minimal.yaml +8 -8
  304. package/resources/global/ja/{workflows → pieces}/research.yaml +11 -11
  305. package/resources/global/ja/{workflows → pieces}/review-fix-minimal.yaml +8 -8
  306. package/resources/global/ja/{workflows → pieces}/review-only.yaml +7 -7
  307. package/dist/core/workflow/engine/StepExecutor.d.ts +0 -52
  308. package/dist/core/workflow/engine/StepExecutor.d.ts.map +0 -1
  309. package/dist/core/workflow/engine/StepExecutor.js.map +0 -1
@@ -1,76 +1,23 @@
1
1
  /**
2
2
  * Phase 1 instruction builder
3
3
  *
4
- * Builds the instruction string for main 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
4
+ * Builds the instruction string for main agent execution.
5
+ * Assembles template variables and renders a single complete template.
9
6
  */
10
- import { hasTagBasedRules } from '../evaluation/rule-utils.js';
11
- import { buildExecutionMetadata, renderExecutionMetadata } from './instruction-context.js';
12
- import { generateStatusRulesFromRules } from './status-rules.js';
7
+ import { buildEditRule } from './instruction-context.js';
13
8
  import { escapeTemplateChars, replaceTemplatePlaceholders } from './escape.js';
9
+ import { loadTemplate } from '../../../shared/prompts/index.js';
14
10
  /**
15
11
  * Check if a report config is the object form (ReportObjectConfig).
16
12
  */
17
13
  export function isReportObjectConfig(report) {
18
14
  return typeof report === 'object' && !Array.isArray(report) && 'name' in report;
19
15
  }
20
- /** Localized strings for auto-injected sections */
21
- const SECTION_STRINGS = {
22
- en: {
23
- workflowContext: '## Workflow Context',
24
- iteration: 'Iteration',
25
- iterationWorkflowWide: '(workflow-wide)',
26
- stepIteration: 'Step Iteration',
27
- stepIterationTimes: '(times this step has run)',
28
- step: 'Step',
29
- reportDirectory: 'Report Directory',
30
- reportFile: 'Report File',
31
- reportFiles: 'Report Files',
32
- phaseNote: '**Note:** This is Phase 1 (main work). After you complete your work, Phase 2 will automatically generate the report based on your findings.',
33
- userRequest: '## User Request',
34
- previousResponse: '## Previous Response',
35
- additionalUserInputs: '## Additional User Inputs',
36
- instructions: '## Instructions',
37
- },
38
- ja: {
39
- workflowContext: '## Workflow Context',
40
- iteration: 'Iteration',
41
- iterationWorkflowWide: '(ワークフロー全体)',
42
- stepIteration: 'Step Iteration',
43
- stepIterationTimes: '(このステップの実行回数)',
44
- step: 'Step',
45
- reportDirectory: 'Report Directory',
46
- reportFile: 'Report File',
47
- reportFiles: 'Report Files',
48
- phaseNote: '**注意:** これはPhase 1(本来の作業)です。作業完了後、Phase 2で自動的にレポートを生成します。',
49
- userRequest: '## User Request',
50
- previousResponse: '## Previous Response',
51
- additionalUserInputs: '## Additional User Inputs',
52
- instructions: '## Instructions',
53
- },
54
- };
55
- /** Localized strings for auto-generated report output instructions */
56
- const REPORT_OUTPUT_STRINGS = {
57
- en: {
58
- singleHeading: '**Report output:** Output to the `Report File` specified above.',
59
- multiHeading: '**Report output:** Output to the `Report Files` specified above.',
60
- createRule: '- If file does not exist: Create new file',
61
- appendRule: '- If file exists: Append with `## Iteration {step_iteration}` section',
62
- },
63
- ja: {
64
- singleHeading: '**レポート出力:** `Report File` に出力してください。',
65
- multiHeading: '**レポート出力:** Report Files に出力してください。',
66
- createRule: '- ファイルが存在しない場合: 新規作成',
67
- appendRule: '- ファイルが存在する場合: `## Iteration {step_iteration}` セクションを追記',
68
- },
69
- };
70
16
  /**
71
17
  * Builds Phase 1 instructions for agent execution.
72
18
  *
73
19
  * Stateless builder — all data is passed via constructor context.
20
+ * Renders a single complete template with all variables.
74
21
  */
75
22
  export class InstructionBuilder {
76
23
  step;
@@ -82,82 +29,106 @@ export class InstructionBuilder {
82
29
  /**
83
30
  * Build the complete instruction string.
84
31
  *
85
- * Generates a complete instruction by auto-injecting standard sections
86
- * around the step-specific instruction_template content.
32
+ * Assembles all template variables and renders the Phase 1 template
33
+ * in a single loadTemplate() call.
87
34
  */
88
35
  build() {
89
36
  const language = this.context.language ?? 'en';
90
- const s = SECTION_STRINGS[language];
91
- const sections = [];
92
- // 1. Execution context metadata (working directory + rules + edit permission)
93
- const metadata = buildExecutionMetadata(this.context, this.step.edit);
94
- sections.push(renderExecutionMetadata(metadata));
95
- // 2. Workflow Context (iteration, step, report info)
96
- sections.push(this.renderWorkflowContext(language));
97
- // Skip auto-injection for sections whose placeholders exist in the template,
98
- // to avoid duplicate content.
37
+ // Execution context variables
38
+ const editRule = buildEditRule(this.step.edit, language);
39
+ // Workflow structure (loop expansion done in code)
40
+ const workflowStructure = this.buildWorkflowStructure(language);
41
+ // Report info
42
+ const hasReport = !!(this.step.report && this.context.reportDir);
43
+ let reportInfo = '';
44
+ let phaseNote = '';
45
+ if (hasReport && this.step.report && this.context.reportDir) {
46
+ reportInfo = renderReportContext(this.step.report, this.context.reportDir);
47
+ phaseNote = language === 'ja'
48
+ ? '**注意:** これはPhase 1(本来の作業)です。作業完了後、Phase 2で自動的にレポートを生成します。'
49
+ : '**Note:** This is Phase 1 (main work). After you complete your work, Phase 2 will automatically generate the report based on your findings.';
50
+ }
51
+ // Skip auto-injection for sections whose placeholders exist in the template
99
52
  const tmpl = this.step.instructionTemplate;
100
53
  const hasTaskPlaceholder = tmpl.includes('{task}');
101
54
  const hasPreviousResponsePlaceholder = tmpl.includes('{previous_response}');
102
55
  const hasUserInputsPlaceholder = tmpl.includes('{user_inputs}');
103
- // 3. User Request (skip if template embeds {task} directly)
104
- if (!hasTaskPlaceholder) {
105
- sections.push(`${s.userRequest}\n${escapeTemplateChars(this.context.task)}`);
106
- }
107
- // 4. Previous Response (skip if template embeds {previous_response} directly)
108
- if (this.step.passPreviousResponse && this.context.previousOutput && !hasPreviousResponsePlaceholder) {
109
- sections.push(`${s.previousResponse}\n${escapeTemplateChars(this.context.previousOutput.content)}`);
110
- }
111
- // 5. Additional User Inputs (skip if template embeds {user_inputs} directly)
112
- if (!hasUserInputsPlaceholder) {
113
- const userInputsStr = this.context.userInputs.join('\n');
114
- sections.push(`${s.additionalUserInputs}\n${escapeTemplateChars(userInputsStr)}`);
115
- }
116
- // 6. Instructions header + instruction_template content
117
- const processedTemplate = replaceTemplatePlaceholders(this.step.instructionTemplate, this.step, this.context);
118
- sections.push(`${s.instructions}\n${processedTemplate}`);
119
- // 7. Status Output Rules (for tag-based detection in Phase 1)
120
- if (hasTagBasedRules(this.step)) {
121
- const statusRulesPrompt = generateStatusRulesFromRules(this.step.name, this.step.rules, language, { interactive: this.context.interactive });
122
- sections.push(statusRulesPrompt);
123
- }
124
- return sections.join('\n\n');
56
+ // User Request
57
+ const hasTaskSection = !hasTaskPlaceholder;
58
+ const userRequest = hasTaskSection ? escapeTemplateChars(this.context.task) : '';
59
+ // Previous Response
60
+ const hasPreviousResponse = !!(this.step.passPreviousResponse &&
61
+ this.context.previousOutput &&
62
+ !hasPreviousResponsePlaceholder);
63
+ const previousResponse = hasPreviousResponse && this.context.previousOutput
64
+ ? escapeTemplateChars(this.context.previousOutput.content)
65
+ : '';
66
+ // User Inputs
67
+ const hasUserInputs = !hasUserInputsPlaceholder;
68
+ const userInputs = hasUserInputs
69
+ ? escapeTemplateChars(this.context.userInputs.join('\n'))
70
+ : '';
71
+ // Instructions (instruction_template processed)
72
+ const instructions = replaceTemplatePlaceholders(this.step.instructionTemplate, this.step, this.context);
73
+ return loadTemplate('perform_phase1_message', language, {
74
+ workingDirectory: this.context.cwd,
75
+ editRule,
76
+ workflowStructure,
77
+ iteration: `${this.context.iteration}/${this.context.maxIterations}`,
78
+ movementIteration: String(this.context.movementIteration),
79
+ movement: this.step.name,
80
+ hasReport,
81
+ reportInfo,
82
+ phaseNote,
83
+ hasTaskSection,
84
+ userRequest,
85
+ hasPreviousResponse,
86
+ previousResponse,
87
+ hasUserInputs,
88
+ userInputs,
89
+ instructions,
90
+ });
125
91
  }
126
- renderWorkflowContext(language) {
127
- const s = SECTION_STRINGS[language];
128
- const lines = [
129
- s.workflowContext,
130
- `- ${s.iteration}: ${this.context.iteration}/${this.context.maxIterations}${s.iterationWorkflowWide}`,
131
- `- ${s.stepIteration}: ${this.context.stepIteration}${s.stepIterationTimes}`,
132
- `- ${s.step}: ${this.step.name}`,
133
- ];
134
- // If step has report config, include Report Directory path and phase note
135
- if (this.step.report && this.context.reportDir) {
136
- const reportContext = renderReportContext(this.step.report, this.context.reportDir, language);
137
- lines.push(reportContext);
138
- lines.push('');
139
- lines.push(s.phaseNote);
92
+ /**
93
+ * Build the workflow structure display string.
94
+ * Returns empty string if no workflow movements are available.
95
+ */
96
+ buildWorkflowStructure(language) {
97
+ if (!this.context.workflowMovements || this.context.workflowMovements.length === 0) {
98
+ return '';
140
99
  }
141
- return lines.join('\n');
100
+ const currentMovementMarker = language === 'ja' ? '現在' : 'current';
101
+ const structureHeader = language === 'ja'
102
+ ? `このワークフローは${this.context.workflowMovements.length}ムーブメントで構成されています:`
103
+ : `This workflow consists of ${this.context.workflowMovements.length} movements:`;
104
+ const movementLines = this.context.workflowMovements.map((ws, index) => {
105
+ const isCurrent = index === this.context.currentMovementIndex;
106
+ const marker = isCurrent ? ` ← ${currentMovementMarker}` : '';
107
+ const desc = ws.description ? `(${ws.description})` : '';
108
+ return `- Movement ${index + 1}: ${ws.name}${desc}${marker}`;
109
+ });
110
+ return [structureHeader, ...movementLines].join('\n');
142
111
  }
143
112
  }
144
113
  /**
145
114
  * Render report context info for Workflow Context section.
146
- * Used by ReportInstructionBuilder.
115
+ * Used by InstructionBuilder and ReportInstructionBuilder.
147
116
  */
148
- export function renderReportContext(report, reportDir, language) {
149
- const s = SECTION_STRINGS[language];
117
+ export function renderReportContext(report, reportDir) {
118
+ const reportDirectory = 'Report Directory';
119
+ const reportFile = 'Report File';
120
+ const reportFiles = 'Report Files';
150
121
  const lines = [
151
- `- ${s.reportDirectory}: ${reportDir}/`,
122
+ `- ${reportDirectory}: ${reportDir}/`,
152
123
  ];
153
124
  if (typeof report === 'string') {
154
- lines.push(`- ${s.reportFile}: ${reportDir}/${report}`);
125
+ lines.push(`- ${reportFile}: ${reportDir}/${report}`);
155
126
  }
156
127
  else if (isReportObjectConfig(report)) {
157
- lines.push(`- ${s.reportFile}: ${reportDir}/${report.name}`);
128
+ lines.push(`- ${reportFile}: ${reportDir}/${report.name}`);
158
129
  }
159
130
  else {
160
- lines.push(`- ${s.reportFiles}:`);
131
+ lines.push(`- ${reportFiles}:`);
161
132
  for (const file of report) {
162
133
  lines.push(` - ${file.label}: ${reportDir}/${file.path}`);
163
134
  }
@@ -165,16 +136,30 @@ export function renderReportContext(report, reportDir, language) {
165
136
  return lines.join('\n');
166
137
  }
167
138
  /**
168
- * Generate report output instructions from step.report config.
169
- * Returns undefined if step has no report or no reportDir.
139
+ * Generate report output instructions from movement's report config.
140
+ * Returns empty string if movement has no report or no reportDir.
170
141
  */
171
142
  export function renderReportOutputInstruction(step, context, language) {
172
143
  if (!step.report || !context.reportDir)
173
- return undefined;
174
- const s = REPORT_OUTPUT_STRINGS[language];
144
+ return '';
175
145
  const isMulti = Array.isArray(step.report);
176
- const heading = isMulti ? s.multiHeading : s.singleHeading;
177
- const appendRule = s.appendRule.replace('{step_iteration}', String(context.stepIteration));
178
- return [heading, s.createRule, appendRule].join('\n');
146
+ let heading;
147
+ let createRule;
148
+ let appendRule;
149
+ if (language === 'ja') {
150
+ heading = isMulti
151
+ ? '**レポート出力:** Report Files に出力してください。'
152
+ : '**レポート出力:** `Report File` に出力してください。';
153
+ createRule = '- ファイルが存在しない場合: 新規作成';
154
+ appendRule = `- ファイルが存在する場合: \`## Iteration ${context.movementIteration}\` セクションを追記`;
155
+ }
156
+ else {
157
+ heading = isMulti
158
+ ? '**Report output:** Output to the `Report Files` specified above.'
159
+ : '**Report output:** Output to the `Report File` specified above.';
160
+ createRule = '- If file does not exist: Create new file';
161
+ appendRule = `- If file exists: Append with \`## Iteration ${context.movementIteration}\` section`;
162
+ }
163
+ return `${heading}\n${createRule}\n${appendRule}`;
179
164
  }
180
165
  //# sourceMappingURL=InstructionBuilder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InstructionBuilder.js","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/InstructionBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,sBAAsB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)
3
3
  *
4
- * Builds the instruction for the report output phase. Includes:
5
- * - Execution Context (cwd + rules)
6
- * - Workflow Context (report info only)
7
- * - Report output instruction + format
8
- *
9
- * Does NOT include: User Request, Previous Response, User Inputs,
10
- * Status rules, instruction_template.
4
+ * Builds the instruction for the report output phase.
5
+ * Assembles template variables and renders a single complete template.
11
6
  */
12
- import type { WorkflowStep, Language } from '../../models/types.js';
7
+ import type { WorkflowMovement, Language } from '../../models/types.js';
13
8
  /**
14
9
  * Context for building report phase instruction.
15
10
  */
@@ -18,18 +13,22 @@ export interface ReportInstructionContext {
18
13
  cwd: string;
19
14
  /** Report directory path */
20
15
  reportDir: string;
21
- /** Step iteration (for {step_iteration} replacement) */
22
- stepIteration: number;
16
+ /** Movement iteration (for {movement_iteration} replacement) */
17
+ movementIteration: number;
23
18
  /** Language */
24
19
  language?: Language;
20
+ /** Target report file name (when generating a single report) */
21
+ targetFile?: string;
25
22
  }
26
23
  /**
27
24
  * Builds Phase 2 (report output) instructions.
25
+ *
26
+ * Renders a single complete template with all variables.
28
27
  */
29
28
  export declare class ReportInstructionBuilder {
30
29
  private readonly step;
31
30
  private readonly context;
32
- constructor(step: WorkflowStep, context: ReportInstructionContext);
31
+ constructor(step: WorkflowMovement, context: ReportInstructionContext);
33
32
  build(): string;
34
33
  }
35
34
  //# sourceMappingURL=ReportInstructionBuilder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReportInstructionBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/ReportInstructionBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAgCpE;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,aAAa,EAAE,MAAM,CAAC;IACtB,eAAe;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED;;GAEG;AACH,qBAAa,wBAAwB;IAEjC,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,wBAAwB;IAGpD,KAAK,IAAI,MAAM;CAiFhB"}
1
+ {"version":3,"file":"ReportInstructionBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/ReportInstructionBuilder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAMxE;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,4BAA4B;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,gEAAgE;IAChE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,gEAAgE;IAChE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;GAIG;AACH,qBAAa,wBAAwB;IAEjC,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,wBAAwB;IAGpD,KAAK,IAAI,MAAM;CA0DhB"}
@@ -1,43 +1,16 @@
1
1
  /**
2
2
  * Phase 2 instruction builder (report output)
3
3
  *
4
- * Builds the instruction for the report output phase. Includes:
5
- * - Execution Context (cwd + rules)
6
- * - Workflow Context (report info only)
7
- * - Report output instruction + format
8
- *
9
- * Does NOT include: User Request, Previous Response, User Inputs,
10
- * Status rules, instruction_template.
4
+ * Builds the instruction for the report output phase.
5
+ * Assembles template variables and renders a single complete template.
11
6
  */
12
- import { METADATA_STRINGS } from './instruction-context.js';
13
7
  import { replaceTemplatePlaceholders } from './escape.js';
14
8
  import { isReportObjectConfig, renderReportContext, renderReportOutputInstruction } from './InstructionBuilder.js';
15
- /** Localized strings for report phase execution rules */
16
- const REPORT_PHASE_STRINGS = {
17
- en: {
18
- noSourceEdit: '**Do NOT modify project source files.** Only output report files.',
19
- reportDirOnly: '**Use only the Report Directory files shown above.** Do not search or open reports outside that directory.',
20
- instructionBody: 'Output the results of your previous work as a report.',
21
- reportJsonFormat: 'JSON format is optional. If you use JSON, map report file names to content (file name key only).',
22
- reportPlainAllowed: 'You may output plain text. If there are multiple report files, the same content will be written to each file.',
23
- reportOnlyOutput: 'Output only the report content (no status tags, no commentary).',
24
- },
25
- ja: {
26
- noSourceEdit: '**プロジェクトのソースファイルを変更しないでください。** レポートファイルのみ出力してください。',
27
- reportDirOnly: '**上記のReport Directory内のファイルのみ使用してください。** 他のレポートディレクトリは検索/参照しないでください。',
28
- instructionBody: '前のステップの作業結果をレポートとして出力してください。',
29
- reportJsonFormat: 'JSON形式は任意です。JSONを使う場合は「レポートファイル名→内容」のオブジェクトにしてください(キーはファイル名のみ)。',
30
- reportPlainAllowed: '本文のみの出力も可です。複数ファイルの場合は同じ内容が各ファイルに書き込まれます。',
31
- reportOnlyOutput: 'レポート本文のみを出力してください(ステータスタグやコメントは禁止)。',
32
- },
33
- };
34
- /** Localized section strings (shared subset) */
35
- const SECTION_STRINGS = {
36
- en: { workflowContext: '## Workflow Context', instructions: '## Instructions' },
37
- ja: { workflowContext: '## Workflow Context', instructions: '## Instructions' },
38
- };
9
+ import { loadTemplate } from '../../../shared/prompts/index.js';
39
10
  /**
40
11
  * Builds Phase 2 (report output) instructions.
12
+ *
13
+ * Renders a single complete template with all variables.
41
14
  */
42
15
  export class ReportInstructionBuilder {
43
16
  step;
@@ -48,50 +21,25 @@ export class ReportInstructionBuilder {
48
21
  }
49
22
  build() {
50
23
  if (!this.step.report) {
51
- throw new Error(`ReportInstructionBuilder called for step "${this.step.name}" which has no report config`);
24
+ throw new Error(`ReportInstructionBuilder called for movement "${this.step.name}" which has no report config`);
52
25
  }
53
26
  const language = this.context.language ?? 'en';
54
- const s = SECTION_STRINGS[language];
55
- const r = REPORT_PHASE_STRINGS[language];
56
- const m = METADATA_STRINGS[language];
57
- const sections = [];
58
- // 1. Execution Context
59
- const execLines = [
60
- m.heading,
61
- `- ${m.workingDirectory}: ${this.context.cwd}`,
62
- '',
63
- m.rulesHeading,
64
- `- ${m.noCommit}`,
65
- `- ${m.noCd}`,
66
- `- ${r.noSourceEdit}`,
67
- `- ${r.reportDirOnly}`,
68
- ];
69
- if (m.note) {
70
- execLines.push('');
71
- execLines.push(m.note);
27
+ // Build report context for Workflow Context section
28
+ let reportContext;
29
+ if (this.context.targetFile) {
30
+ reportContext = `- Report Directory: ${this.context.reportDir}/\n- Report File: ${this.context.reportDir}/${this.context.targetFile}`;
72
31
  }
73
- execLines.push('');
74
- sections.push(execLines.join('\n'));
75
- // 2. Workflow Context (report info only)
76
- const workflowLines = [
77
- s.workflowContext,
78
- renderReportContext(this.step.report, this.context.reportDir, language),
79
- ];
80
- sections.push(workflowLines.join('\n'));
81
- // 3. Instructions + report output instruction + format
82
- const instrParts = [
83
- s.instructions,
84
- r.instructionBody,
85
- r.reportJsonFormat,
86
- ];
87
- instrParts.push(r.reportPlainAllowed);
88
- instrParts.push(r.reportOnlyOutput);
89
- // Report output instruction (auto-generated or explicit order)
90
- const reportContext = {
32
+ else {
33
+ reportContext = renderReportContext(this.step.report, this.context.reportDir);
34
+ }
35
+ // Build report output instruction
36
+ let reportOutput = '';
37
+ let hasReportOutput = false;
38
+ const instrContext = {
91
39
  task: '',
92
40
  iteration: 0,
93
41
  maxIterations: 0,
94
- stepIteration: this.context.stepIteration,
42
+ movementIteration: this.context.movementIteration,
95
43
  cwd: this.context.cwd,
96
44
  projectCwd: this.context.cwd,
97
45
  userInputs: [],
@@ -99,25 +47,31 @@ export class ReportInstructionBuilder {
99
47
  language,
100
48
  };
101
49
  if (isReportObjectConfig(this.step.report) && this.step.report.order) {
102
- const processedOrder = replaceTemplatePlaceholders(this.step.report.order.trimEnd(), this.step, reportContext);
103
- instrParts.push('');
104
- instrParts.push(processedOrder);
50
+ reportOutput = replaceTemplatePlaceholders(this.step.report.order.trimEnd(), this.step, instrContext);
51
+ hasReportOutput = true;
105
52
  }
106
- else {
107
- const reportInstruction = renderReportOutputInstruction(this.step, reportContext, language);
108
- if (reportInstruction) {
109
- instrParts.push('');
110
- instrParts.push(reportInstruction);
53
+ else if (!this.context.targetFile) {
54
+ const output = renderReportOutputInstruction(this.step, instrContext, language);
55
+ if (output) {
56
+ reportOutput = output;
57
+ hasReportOutput = true;
111
58
  }
112
59
  }
113
- // Report format
60
+ // Build report format
61
+ let reportFormat = '';
62
+ let hasReportFormat = false;
114
63
  if (isReportObjectConfig(this.step.report) && this.step.report.format) {
115
- const processedFormat = replaceTemplatePlaceholders(this.step.report.format.trimEnd(), this.step, reportContext);
116
- instrParts.push('');
117
- instrParts.push(processedFormat);
64
+ reportFormat = replaceTemplatePlaceholders(this.step.report.format.trimEnd(), this.step, instrContext);
65
+ hasReportFormat = true;
118
66
  }
119
- sections.push(instrParts.join('\n'));
120
- return sections.join('\n\n');
67
+ return loadTemplate('perform_phase2_message', language, {
68
+ workingDirectory: this.context.cwd,
69
+ reportContext,
70
+ hasReportOutput,
71
+ reportOutput,
72
+ hasReportFormat,
73
+ reportFormat,
74
+ });
121
75
  }
122
76
  }
123
77
  //# sourceMappingURL=ReportInstructionBuilder.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ReportInstructionBuilder.js","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/ReportInstructionBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,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YACjH,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YACpB,UAAU,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QACnC,CAAC;QAED,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAErC,OAAO,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAC/B,CAAC;CACF"}
1
+ {"version":3,"file":"ReportInstructionBuilder.js","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/ReportInstructionBuilder.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,6BAA6B,EAAE,MAAM,yBAAyB,CAAC;AACnH,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAkBhE;;;;GAIG;AACH,MAAM,OAAO,wBAAwB;IAEhB;IACA;IAFnB,YACmB,IAAsB,EACtB,OAAiC;QADjC,SAAI,GAAJ,IAAI,CAAkB;QACtB,YAAO,GAAP,OAAO,CAA0B;IACjD,CAAC;IAEJ,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACtB,MAAM,IAAI,KAAK,CAAC,iDAAiD,IAAI,CAAC,IAAI,CAAC,IAAI,8BAA8B,CAAC,CAAC;QACjH,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,IAAI,IAAI,CAAC;QAE/C,oDAAoD;QACpD,IAAI,aAAqB,CAAC;QAC1B,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;YAC5B,aAAa,GAAG,uBAAuB,IAAI,CAAC,OAAO,CAAC,SAAS,qBAAqB,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC;QACxI,CAAC;aAA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BAAoB,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACtE,YAAY,GAAG,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;YACvG,eAAe,GAAG,IAAI,CAAC;QACzB,CAAC;QAED,OAAO,YAAY,CAAC,wBAAwB,EAAE,QAAQ,EAAE;YACtD,gBAAgB,EAAE,IAAI,CAAC,OAAO,CAAC,GAAG;YAClC,aAAa;YACb,eAAe;YACf,YAAY;YACZ,eAAe;YACf,YAAY;SACb,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -4,11 +4,10 @@
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
- * Includes:
8
- * - Header instruction (review and determine status)
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 type { WorkflowStep, Language } from '../../models/types.js';
10
+ import type { WorkflowMovement, Language } from '../../models/types.js';
12
11
  /**
13
12
  * Context for building status judgment instruction.
14
13
  */
@@ -20,11 +19,13 @@ export interface StatusJudgmentContext {
20
19
  }
21
20
  /**
22
21
  * Builds Phase 3 (status judgment) instructions.
22
+ *
23
+ * Renders a single complete template with all variables.
23
24
  */
24
25
  export declare class StatusJudgmentBuilder {
25
26
  private readonly step;
26
27
  private readonly context;
27
- constructor(step: WorkflowStep, context: StatusJudgmentContext);
28
+ constructor(step: WorkflowMovement, context: StatusJudgmentContext);
28
29
  build(): string;
29
30
  }
30
31
  //# sourceMappingURL=StatusJudgmentBuilder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"StatusJudgmentBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/StatusJudgmentBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAapE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,eAAe;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,iDAAiD;IACjD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;GAEG;AACH,qBAAa,qBAAqB;IAE9B,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,IAAI,EAAE,YAAY,EAClB,OAAO,EAAE,qBAAqB;IAGjD,KAAK,IAAI,MAAM;CAuBhB"}
1
+ {"version":3,"file":"StatusJudgmentBuilder.d.ts","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/StatusJudgmentBuilder.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAIxE;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,eAAe;IACf,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,iDAAiD;IACjD,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;GAIG;AACH,qBAAa,qBAAqB;IAE9B,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBADP,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,qBAAqB;IAGjD,KAAK,IAAI,MAAM;CAqBhB"}