takt 0.3.9 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +364 -325
- package/dist/agents/index.d.ts +1 -1
- package/dist/agents/index.d.ts.map +1 -1
- package/dist/agents/index.js +1 -1
- package/dist/agents/index.js.map +1 -1
- package/dist/agents/runner.d.ts +0 -1
- package/dist/agents/runner.d.ts.map +1 -1
- package/dist/agents/runner.js +6 -5
- package/dist/agents/runner.js.map +1 -1
- package/dist/agents/types.d.ts +3 -1
- package/dist/agents/types.d.ts.map +1 -1
- package/dist/app/cli/commands.d.ts +1 -1
- package/dist/app/cli/commands.js +9 -1
- package/dist/app/cli/commands.js.map +1 -1
- package/dist/app/cli/routing.js +1 -0
- package/dist/app/cli/routing.js.map +1 -1
- package/dist/core/models/index.d.ts +1 -1
- package/dist/core/models/index.d.ts.map +1 -1
- package/dist/core/models/schemas.d.ts +8 -6
- package/dist/core/models/schemas.d.ts.map +1 -1
- package/dist/core/models/schemas.js +16 -15
- package/dist/core/models/schemas.js.map +1 -1
- package/dist/core/models/types.d.ts +1 -1
- package/dist/core/models/types.d.ts.map +1 -1
- package/dist/core/models/workflow-types.d.ts +26 -24
- package/dist/core/models/workflow-types.d.ts.map +1 -1
- package/dist/core/workflow/constants.d.ts +7 -7
- package/dist/core/workflow/constants.d.ts.map +1 -1
- package/dist/core/workflow/constants.js +7 -7
- package/dist/core/workflow/constants.js.map +1 -1
- package/dist/core/workflow/engine/MovementExecutor.d.ts +59 -0
- package/dist/core/workflow/engine/MovementExecutor.d.ts.map +1 -0
- package/dist/core/workflow/engine/{StepExecutor.js → MovementExecutor.js} +30 -25
- package/dist/core/workflow/engine/MovementExecutor.js.map +1 -0
- package/dist/core/workflow/engine/OptionsBuilder.d.ts +6 -6
- package/dist/core/workflow/engine/OptionsBuilder.d.ts.map +1 -1
- package/dist/core/workflow/engine/OptionsBuilder.js +8 -3
- package/dist/core/workflow/engine/OptionsBuilder.js.map +1 -1
- package/dist/core/workflow/engine/ParallelRunner.d.ts +12 -10
- package/dist/core/workflow/engine/ParallelRunner.d.ts.map +1 -1
- package/dist/core/workflow/engine/ParallelRunner.js +46 -41
- package/dist/core/workflow/engine/ParallelRunner.js.map +1 -1
- package/dist/core/workflow/engine/WorkflowEngine.d.ts +16 -16
- package/dist/core/workflow/engine/WorkflowEngine.d.ts.map +1 -1
- package/dist/core/workflow/engine/WorkflowEngine.js +105 -92
- package/dist/core/workflow/engine/WorkflowEngine.js.map +1 -1
- package/dist/core/workflow/engine/blocked-handler.d.ts +3 -3
- package/dist/core/workflow/engine/blocked-handler.d.ts.map +1 -1
- package/dist/core/workflow/engine/blocked-handler.js +2 -2
- package/dist/core/workflow/engine/blocked-handler.js.map +1 -1
- package/dist/core/workflow/engine/index.d.ts +2 -1
- package/dist/core/workflow/engine/index.d.ts.map +1 -1
- package/dist/core/workflow/engine/index.js +1 -1
- package/dist/core/workflow/engine/index.js.map +1 -1
- package/dist/core/workflow/engine/loop-detector.d.ts +5 -5
- package/dist/core/workflow/engine/loop-detector.d.ts.map +1 -1
- package/dist/core/workflow/engine/loop-detector.js +8 -8
- package/dist/core/workflow/engine/loop-detector.js.map +1 -1
- package/dist/core/workflow/engine/parallel-logger.d.ts +15 -15
- package/dist/core/workflow/engine/parallel-logger.d.ts.map +1 -1
- package/dist/core/workflow/engine/parallel-logger.js +22 -21
- package/dist/core/workflow/engine/parallel-logger.js.map +1 -1
- package/dist/core/workflow/engine/state-manager.d.ts +6 -6
- package/dist/core/workflow/engine/state-manager.d.ts.map +1 -1
- package/dist/core/workflow/engine/state-manager.js +15 -16
- package/dist/core/workflow/engine/state-manager.js.map +1 -1
- package/dist/core/workflow/engine/transitions.d.ts +5 -5
- package/dist/core/workflow/engine/transitions.d.ts.map +1 -1
- package/dist/core/workflow/engine/transitions.js +4 -4
- package/dist/core/workflow/engine/transitions.js.map +1 -1
- package/dist/core/workflow/evaluation/AggregateEvaluator.d.ts +15 -15
- package/dist/core/workflow/evaluation/AggregateEvaluator.d.ts.map +1 -1
- package/dist/core/workflow/evaluation/AggregateEvaluator.js +35 -33
- package/dist/core/workflow/evaluation/AggregateEvaluator.js.map +1 -1
- package/dist/core/workflow/evaluation/RuleEvaluator.d.ts +8 -8
- package/dist/core/workflow/evaluation/RuleEvaluator.d.ts.map +1 -1
- package/dist/core/workflow/evaluation/RuleEvaluator.js +18 -14
- package/dist/core/workflow/evaluation/RuleEvaluator.js.map +1 -1
- package/dist/core/workflow/evaluation/index.d.ts +4 -4
- package/dist/core/workflow/evaluation/index.d.ts.map +1 -1
- package/dist/core/workflow/evaluation/index.js +1 -1
- package/dist/core/workflow/evaluation/index.js.map +1 -1
- package/dist/core/workflow/evaluation/rule-utils.d.ts +4 -4
- package/dist/core/workflow/evaluation/rule-utils.d.ts.map +1 -1
- package/dist/core/workflow/evaluation/rule-utils.js +2 -2
- package/dist/core/workflow/evaluation/rule-utils.js.map +1 -1
- package/dist/core/workflow/index.d.ts +6 -6
- package/dist/core/workflow/index.d.ts.map +1 -1
- package/dist/core/workflow/index.js +5 -5
- package/dist/core/workflow/index.js.map +1 -1
- package/dist/core/workflow/instruction/InstructionBuilder.d.ts +17 -15
- package/dist/core/workflow/instruction/InstructionBuilder.d.ts.map +1 -1
- package/dist/core/workflow/instruction/InstructionBuilder.js +105 -120
- package/dist/core/workflow/instruction/InstructionBuilder.js.map +1 -1
- package/dist/core/workflow/instruction/ReportInstructionBuilder.d.ts +10 -11
- package/dist/core/workflow/instruction/ReportInstructionBuilder.d.ts.map +1 -1
- package/dist/core/workflow/instruction/ReportInstructionBuilder.js +38 -84
- package/dist/core/workflow/instruction/ReportInstructionBuilder.js.map +1 -1
- package/dist/core/workflow/instruction/StatusJudgmentBuilder.d.ts +6 -5
- package/dist/core/workflow/instruction/StatusJudgmentBuilder.d.ts.map +1 -1
- package/dist/core/workflow/instruction/StatusJudgmentBuilder.js +14 -22
- package/dist/core/workflow/instruction/StatusJudgmentBuilder.js.map +1 -1
- package/dist/core/workflow/instruction/escape.d.ts +3 -3
- package/dist/core/workflow/instruction/escape.d.ts.map +1 -1
- package/dist/core/workflow/instruction/escape.js +3 -3
- package/dist/core/workflow/instruction/escape.js.map +1 -1
- package/dist/core/workflow/instruction/instruction-context.d.ts +16 -49
- package/dist/core/workflow/instruction/instruction-context.d.ts.map +1 -1
- package/dist/core/workflow/instruction/instruction-context.js +17 -62
- package/dist/core/workflow/instruction/instruction-context.js.map +1 -1
- package/dist/core/workflow/instruction/status-rules.d.ts +19 -14
- package/dist/core/workflow/instruction/status-rules.d.ts.map +1 -1
- package/dist/core/workflow/instruction/status-rules.js +47 -66
- package/dist/core/workflow/instruction/status-rules.js.map +1 -1
- package/dist/core/workflow/phase-runner.d.ts +14 -8
- package/dist/core/workflow/phase-runner.d.ts.map +1 -1
- package/dist/core/workflow/phase-runner.js +75 -78
- package/dist/core/workflow/phase-runner.js.map +1 -1
- package/dist/core/workflow/types.d.ts +15 -12
- package/dist/core/workflow/types.d.ts.map +1 -1
- package/dist/features/config/ejectBuiltin.js +3 -3
- package/dist/features/config/ejectBuiltin.js.map +1 -1
- package/dist/features/interactive/interactive.d.ts.map +1 -1
- package/dist/features/interactive/interactive.js +38 -169
- package/dist/features/interactive/interactive.js.map +1 -1
- package/dist/features/prompt/index.d.ts +5 -0
- package/dist/features/prompt/index.d.ts.map +1 -0
- package/dist/features/prompt/index.js +5 -0
- package/dist/features/prompt/index.js.map +1 -0
- package/dist/features/prompt/preview.d.ts +14 -0
- package/dist/features/prompt/preview.d.ts.map +1 -0
- package/dist/features/prompt/preview.js +74 -0
- package/dist/features/prompt/preview.js.map +1 -0
- package/dist/features/tasks/add/index.d.ts +6 -9
- package/dist/features/tasks/add/index.d.ts.map +1 -1
- package/dist/features/tasks/add/index.js +23 -55
- package/dist/features/tasks/add/index.js.map +1 -1
- package/dist/features/tasks/execute/selectAndExecute.d.ts.map +1 -1
- package/dist/features/tasks/execute/selectAndExecute.js +1 -0
- package/dist/features/tasks/execute/selectAndExecute.js.map +1 -1
- package/dist/features/tasks/execute/taskExecution.d.ts.map +1 -1
- package/dist/features/tasks/execute/taskExecution.js +4 -3
- package/dist/features/tasks/execute/taskExecution.js.map +1 -1
- package/dist/features/tasks/execute/types.d.ts +13 -0
- package/dist/features/tasks/execute/types.d.ts.map +1 -1
- package/dist/features/tasks/execute/workflowExecution.d.ts.map +1 -1
- package/dist/features/tasks/execute/workflowExecution.js +63 -18
- package/dist/features/tasks/execute/workflowExecution.js.map +1 -1
- package/dist/features/tasks/index.d.ts +1 -1
- package/dist/features/tasks/index.d.ts.map +1 -1
- package/dist/features/tasks/index.js +1 -1
- package/dist/features/tasks/index.js.map +1 -1
- package/dist/features/tasks/list/index.d.ts.map +1 -1
- package/dist/features/tasks/list/index.js +0 -1
- package/dist/features/tasks/list/index.js.map +1 -1
- package/dist/features/tasks/list/taskActions.d.ts +1 -0
- package/dist/features/tasks/list/taskActions.d.ts.map +1 -1
- package/dist/features/tasks/list/taskActions.js +24 -1
- package/dist/features/tasks/list/taskActions.js.map +1 -1
- package/dist/features/workflowSelection/index.js +1 -1
- package/dist/features/workflowSelection/index.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/infra/claude/client.d.ts +1 -1
- package/dist/infra/claude/client.d.ts.map +1 -1
- package/dist/infra/claude/client.js +6 -24
- package/dist/infra/claude/client.js.map +1 -1
- package/dist/infra/claude/executor.d.ts +0 -1
- package/dist/infra/claude/executor.d.ts.map +1 -1
- package/dist/infra/claude/executor.js +0 -2
- package/dist/infra/claude/executor.js.map +1 -1
- package/dist/infra/claude/index.js +2 -2
- package/dist/infra/claude/index.js.map +1 -1
- package/dist/infra/claude/options-builder.js +4 -4
- package/dist/infra/claude/options-builder.js.map +1 -1
- package/dist/infra/claude/process.d.ts +1 -1
- package/dist/infra/claude/process.d.ts.map +1 -1
- package/dist/infra/claude/process.js +1 -1
- package/dist/infra/claude/process.js.map +1 -1
- package/dist/infra/claude/query-manager.d.ts +1 -1
- package/dist/infra/claude/query-manager.d.ts.map +1 -1
- package/dist/infra/claude/query-manager.js +1 -2
- package/dist/infra/claude/query-manager.js.map +1 -1
- package/dist/infra/claude/stream-converter.d.ts +2 -2
- package/dist/infra/claude/stream-converter.js +2 -2
- package/dist/infra/claude/types.d.ts +1 -1
- package/dist/infra/claude/types.d.ts.map +1 -1
- package/dist/infra/codex/client.d.ts.map +1 -1
- package/dist/infra/codex/client.js +0 -1
- package/dist/infra/codex/client.js.map +1 -1
- package/dist/infra/config/global/globalConfig.d.ts.map +1 -1
- package/dist/infra/config/global/globalConfig.js +0 -1
- package/dist/infra/config/global/globalConfig.js.map +1 -1
- package/dist/infra/config/loaders/agentLoader.d.ts +1 -1
- package/dist/infra/config/loaders/agentLoader.d.ts.map +1 -1
- package/dist/infra/config/loaders/agentLoader.js +6 -5
- package/dist/infra/config/loaders/agentLoader.js.map +1 -1
- package/dist/infra/config/loaders/loader.d.ts +1 -1
- package/dist/infra/config/loaders/loader.js +1 -1
- package/dist/infra/config/loaders/workflowParser.d.ts.map +1 -1
- package/dist/infra/config/loaders/workflowParser.js +9 -5
- package/dist/infra/config/loaders/workflowParser.js.map +1 -1
- package/dist/infra/config/loaders/workflowResolver.d.ts +4 -4
- package/dist/infra/config/loaders/workflowResolver.js +11 -11
- package/dist/infra/config/loaders/workflowResolver.js.map +1 -1
- package/dist/infra/config/paths.d.ts +4 -4
- package/dist/infra/config/paths.d.ts.map +1 -1
- package/dist/infra/config/paths.js +7 -7
- package/dist/infra/config/paths.js.map +1 -1
- package/dist/infra/config/project/index.d.ts +1 -1
- package/dist/infra/config/project/index.d.ts.map +1 -1
- package/dist/infra/config/project/index.js.map +1 -1
- package/dist/infra/config/project/projectConfig.d.ts +2 -2
- package/dist/infra/config/project/projectConfig.d.ts.map +1 -1
- package/dist/infra/config/types.d.ts +0 -2
- package/dist/infra/config/types.d.ts.map +1 -1
- package/dist/infra/fs/index.d.ts +1 -1
- package/dist/infra/fs/index.d.ts.map +1 -1
- package/dist/infra/fs/index.js.map +1 -1
- package/dist/infra/fs/session.d.ts +1 -1
- package/dist/infra/fs/session.d.ts.map +1 -1
- package/dist/infra/fs/session.js +0 -1
- package/dist/infra/fs/session.js.map +1 -1
- package/dist/infra/providers/index.d.ts.map +1 -1
- package/dist/infra/providers/index.js +0 -1
- package/dist/infra/providers/index.js.map +1 -1
- package/dist/infra/task/autoCommit.js +1 -1
- package/dist/infra/task/autoCommit.js.map +1 -1
- package/dist/infra/task/branchList.d.ts +4 -2
- package/dist/infra/task/branchList.d.ts.map +1 -1
- package/dist/infra/task/branchList.js +87 -9
- package/dist/infra/task/branchList.js.map +1 -1
- package/dist/infra/task/clone.js +1 -1
- package/dist/infra/task/clone.js.map +1 -1
- package/dist/infra/task/parser.d.ts +1 -1
- package/dist/infra/task/parser.js +1 -1
- package/dist/infra/task/summarize.d.ts.map +1 -1
- package/dist/infra/task/summarize.js +3 -15
- package/dist/infra/task/summarize.js.map +1 -1
- package/dist/infra/task/types.d.ts +1 -0
- package/dist/infra/task/types.d.ts.map +1 -1
- package/dist/shared/context.d.ts.map +1 -1
- package/dist/shared/context.js +0 -1
- package/dist/shared/context.js.map +1 -1
- package/dist/shared/i18n/index.d.ts +31 -0
- package/dist/shared/i18n/index.d.ts.map +1 -0
- package/dist/shared/i18n/index.js +97 -0
- package/dist/shared/i18n/index.js.map +1 -0
- package/dist/shared/i18n/labels_en.yaml +37 -0
- package/dist/shared/i18n/labels_ja.yaml +37 -0
- package/dist/shared/prompt/select.d.ts +0 -3
- package/dist/shared/prompt/select.d.ts.map +1 -1
- package/dist/shared/prompt/select.js +5 -20
- package/dist/shared/prompt/select.js.map +1 -1
- package/dist/shared/prompts/en/perform_agent_system_prompt.md +7 -0
- package/dist/shared/prompts/en/perform_builtin_agent_system_prompt.md +7 -0
- package/dist/shared/prompts/en/perform_judge_message.md +24 -0
- package/dist/shared/prompts/en/perform_phase1_message.md +45 -0
- package/dist/shared/prompts/en/perform_phase2_message.md +31 -0
- package/dist/shared/prompts/en/perform_phase3_message.md +19 -0
- package/dist/shared/prompts/en/score_interactive_system_prompt.md +53 -0
- package/dist/shared/prompts/en/score_slug_system_prompt.md +19 -0
- package/dist/shared/prompts/en/score_summary_system_prompt.md +25 -0
- package/dist/shared/prompts/index.d.ts +27 -0
- package/dist/shared/prompts/index.d.ts.map +1 -0
- package/dist/shared/prompts/index.js +111 -0
- package/dist/shared/prompts/index.js.map +1 -0
- package/dist/shared/prompts/ja/perform_agent_system_prompt.md +7 -0
- package/dist/shared/prompts/ja/perform_builtin_agent_system_prompt.md +7 -0
- package/dist/shared/prompts/ja/perform_judge_message.md +24 -0
- package/dist/shared/prompts/ja/perform_phase1_message.md +44 -0
- package/dist/shared/prompts/ja/perform_phase2_message.md +30 -0
- package/dist/shared/prompts/ja/perform_phase3_message.md +19 -0
- package/dist/shared/prompts/ja/score_interactive_system_prompt.md +59 -0
- package/dist/shared/prompts/ja/score_slug_system_prompt.md +19 -0
- package/dist/shared/prompts/ja/score_summary_system_prompt.md +32 -0
- package/dist/shared/ui/LogManager.d.ts +1 -1
- package/dist/shared/ui/LogManager.d.ts.map +1 -1
- package/dist/shared/ui/LogManager.js +1 -2
- package/dist/shared/ui/LogManager.js.map +1 -1
- package/dist/shared/utils/debug.js +1 -1
- package/dist/shared/utils/debug.js.map +1 -1
- package/dist/shared/utils/types.d.ts +29 -1
- package/dist/shared/utils/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/resources/global/en/{workflows → pieces}/default.yaml +16 -16
- package/resources/global/en/{workflows → pieces}/expert-cqrs.yaml +17 -17
- package/resources/global/en/{workflows → pieces}/expert.yaml +20 -20
- package/resources/global/en/{workflows → pieces}/magi.yaml +4 -4
- package/resources/global/en/{workflows → pieces}/minimal.yaml +7 -7
- package/resources/global/en/{workflows → pieces}/research.yaml +11 -11
- package/resources/global/en/{workflows → pieces}/review-fix-minimal.yaml +8 -8
- package/resources/global/en/{workflows → pieces}/review-only.yaml +7 -7
- package/resources/global/ja/agents/default/architecture-reviewer.md +3 -3
- package/resources/global/ja/agents/default/supervisor.md +1 -1
- package/resources/global/ja/agents/templates/planner.md +1 -1
- package/resources/global/ja/{workflows → pieces}/default.yaml +12 -12
- package/resources/global/ja/{workflows → pieces}/expert-cqrs.yaml +18 -18
- package/resources/global/ja/{workflows → pieces}/expert.yaml +15 -15
- package/resources/global/ja/{workflows → pieces}/magi.yaml +4 -4
- package/resources/global/ja/{workflows → pieces}/minimal.yaml +8 -8
- package/resources/global/ja/{workflows → pieces}/research.yaml +11 -11
- package/resources/global/ja/{workflows → pieces}/review-fix-minimal.yaml +8 -8
- package/resources/global/ja/{workflows → pieces}/review-only.yaml +7 -7
- package/dist/core/workflow/engine/StepExecutor.d.ts +0 -52
- package/dist/core/workflow/engine/StepExecutor.d.ts.map +0 -1
- package/dist/core/workflow/engine/StepExecutor.js.map +0 -1
|
@@ -1,76 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Phase 1 instruction builder
|
|
3
3
|
*
|
|
4
|
-
* Builds the instruction string for main agent execution
|
|
5
|
-
*
|
|
6
|
-
* User Request, Previous Response, Additional User Inputs, Instructions header,
|
|
7
|
-
* Status Output Rules)
|
|
8
|
-
* 2. Replacing template placeholders with actual values
|
|
4
|
+
* Builds the instruction string for main agent execution.
|
|
5
|
+
* Assembles template variables and renders a single complete template.
|
|
9
6
|
*/
|
|
10
|
-
import {
|
|
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
|
-
*
|
|
86
|
-
*
|
|
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
|
-
|
|
91
|
-
const
|
|
92
|
-
//
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
//
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
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
|
-
|
|
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
|
|
149
|
-
const
|
|
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
|
-
`- ${
|
|
122
|
+
`- ${reportDirectory}: ${reportDir}/`,
|
|
152
123
|
];
|
|
153
124
|
if (typeof report === 'string') {
|
|
154
|
-
lines.push(`- ${
|
|
125
|
+
lines.push(`- ${reportFile}: ${reportDir}/${report}`);
|
|
155
126
|
}
|
|
156
127
|
else if (isReportObjectConfig(report)) {
|
|
157
|
-
lines.push(`- ${
|
|
128
|
+
lines.push(`- ${reportFile}: ${reportDir}/${report.name}`);
|
|
158
129
|
}
|
|
159
130
|
else {
|
|
160
|
-
lines.push(`- ${
|
|
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
|
|
169
|
-
* Returns
|
|
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
|
|
174
|
-
const s = REPORT_OUTPUT_STRINGS[language];
|
|
144
|
+
return '';
|
|
175
145
|
const isMulti = Array.isArray(step.report);
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
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
|
|
1
|
+
{"version":3,"file":"InstructionBuilder.js","sourceRoot":"","sources":["../../../../src/core/workflow/instruction/InstructionBuilder.ts"],"names":[],"mappings":"AAAA;;;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I,EAAE,CAAC,CAAC;QAC7D,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,6BAA6B,CAC3C,IAAsB,EACtB,OAA2B,EAC3B,QAAkB;IAElB,IAAI,CAAC,IAAI,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,SAAS;QAAE,OAAO,EAAE,CAAC;IAElD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAE3C,IAAI,OAAe,CAAC;IACpB,IAAI,UAAkB,CAAC;IACvB,IAAI,UAAkB,CAAC;IAEvB,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QACtB,OAAO,GAAG,OAAO;YACf,CAAC,CAAC,qCAAqC;YACvC,CAAC,CAAC,sCAAsC,CAAC;QAC3C,UAAU,GAAG,sBAAsB,CAAC;QACpC,UAAU,GAAG,iCAAiC,OAAO,CAAC,iBAAiB,aAAa,CAAC;IACvF,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,OAAO;YACf,CAAC,CAAC,kEAAkE;YACpE,CAAC,CAAC,iEAAiE,CAAC;QACtE,UAAU,GAAG,2CAA2C,CAAC;QACzD,UAAU,GAAG,gDAAgD,OAAO,CAAC,iBAAiB,YAAY,CAAC;IACrG,CAAC;IAED,OAAO,GAAG,OAAO,KAAK,UAAU,KAAK,UAAU,EAAE,CAAC;AACpD,CAAC"}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Phase 2 instruction builder (report output)
|
|
3
3
|
*
|
|
4
|
-
* Builds the instruction for the report output phase.
|
|
5
|
-
*
|
|
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 {
|
|
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
|
-
/**
|
|
22
|
-
|
|
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:
|
|
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
|
|
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.
|
|
5
|
-
*
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
|
|
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
|
-
|
|
103
|
-
|
|
104
|
-
instrParts.push(processedOrder);
|
|
50
|
+
reportOutput = replaceTemplatePlaceholders(this.step.report.order.trimEnd(), this.step, instrContext);
|
|
51
|
+
hasReportOutput = true;
|
|
105
52
|
}
|
|
106
|
-
else {
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
109
|
-
|
|
110
|
-
|
|
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
|
-
//
|
|
60
|
+
// Build report format
|
|
61
|
+
let reportFormat = '';
|
|
62
|
+
let hasReportFormat = false;
|
|
114
63
|
if (isReportObjectConfig(this.step.report) && this.step.report.format) {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
instrParts.push(processedFormat);
|
|
64
|
+
reportFormat = replaceTemplatePlaceholders(this.step.report.format.trimEnd(), this.step, instrContext);
|
|
65
|
+
hasReportFormat = true;
|
|
118
66
|
}
|
|
119
|
-
|
|
120
|
-
|
|
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
|
|
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;aAAM,CAAC;YACN,aAAa,GAAG,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAChF,CAAC;QAED,kCAAkC;QAClC,IAAI,YAAY,GAAG,EAAE,CAAC;QACtB,IAAI,eAAe,GAAG,KAAK,CAAC;QAC5B,MAAM,YA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,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
|
-
*
|
|
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 type {
|
|
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:
|
|
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
|
|
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"}
|