opencode-orchestrator 1.0.76 → 1.2.1
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 +46 -47
- package/dist/agents/prompts/01_philosophy/execution_assurance.d.ts +1 -0
- package/dist/agents/prompts/01_philosophy/index.d.ts +5 -0
- package/dist/agents/prompts/01_philosophy/metadata.d.ts +19 -0
- package/dist/agents/prompts/02_discovery/agents/discovery_commander.d.ts +5 -0
- package/dist/agents/prompts/02_discovery/agents/discovery_planner.d.ts +5 -0
- package/dist/agents/prompts/02_discovery/agents/index.d.ts +2 -0
- package/dist/agents/prompts/02_discovery/discovery_core.d.ts +8 -0
- package/dist/agents/prompts/02_discovery/index.d.ts +6 -0
- package/dist/agents/prompts/03_planning/agents/index.d.ts +3 -0
- package/dist/agents/prompts/03_planning/agents/planning_commander.d.ts +5 -0
- package/dist/agents/prompts/03_planning/index.d.ts +11 -0
- package/dist/agents/prompts/03_planning/planning_core.d.ts +8 -0
- package/dist/agents/prompts/04_execution/agents/execution_commander.d.ts +5 -0
- package/dist/agents/prompts/04_execution/agents/execution_worker.d.ts +5 -0
- package/dist/agents/prompts/04_execution/agents/index.d.ts +2 -0
- package/dist/agents/prompts/04_execution/execution_core.d.ts +8 -0
- package/dist/agents/prompts/04_execution/execution_error_handling.d.ts +5 -0
- package/dist/agents/prompts/04_execution/index.d.ts +12 -0
- package/dist/agents/prompts/05_verification/agents/index.d.ts +2 -0
- package/dist/agents/prompts/05_verification/agents/verification_commander.d.ts +5 -0
- package/dist/agents/prompts/05_verification/index.d.ts +11 -0
- package/dist/agents/prompts/05_verification/verification_build.d.ts +5 -0
- package/dist/agents/prompts/05_verification/verification_core.d.ts +8 -0
- package/dist/agents/prompts/05_verification/verification_test.d.ts +5 -0
- package/dist/agents/prompts/06_mission/agents/index.d.ts +1 -0
- package/dist/agents/prompts/06_mission/agents/mission_commander.d.ts +5 -0
- package/dist/agents/prompts/06_mission/index.d.ts +7 -0
- package/dist/agents/prompts/06_mission/mission_core.d.ts +8 -0
- package/dist/agents/prompts/06_mission/mission_lifecycle.d.ts +5 -0
- package/dist/agents/prompts/07_agents/commander/commander_mandate.d.ts +5 -0
- package/dist/agents/prompts/07_agents/commander/index.d.ts +5 -0
- package/dist/agents/prompts/07_agents/planner/index.d.ts +4 -0
- package/dist/agents/prompts/07_agents/planner/planner_mandate.d.ts +5 -0
- package/dist/agents/prompts/07_agents/reviewer/index.d.ts +4 -0
- package/dist/agents/prompts/07_agents/reviewer/reviewer_mandate.d.ts +5 -0
- package/dist/agents/prompts/07_agents/worker/index.d.ts +4 -0
- package/dist/agents/prompts/07_agents/worker/worker_mandate.d.ts +5 -0
- package/dist/agents/prompts/08_tools/agents/index.d.ts +2 -0
- package/dist/agents/prompts/08_tools/index.d.ts +8 -0
- package/dist/agents/prompts/08_tools/tools_code_editing.d.ts +5 -0
- package/dist/agents/prompts/08_tools/tools_core.d.ts +8 -0
- package/dist/agents/prompts/08_tools/tools_testing.d.ts +5 -0
- package/dist/agents/prompts/index.d.ts +26 -14
- package/dist/core/agents/interfaces/session-pool.interface.d.ts +4 -0
- package/dist/core/agents/session-pool.d.ts +4 -0
- package/dist/core/loop/mission-loop.d.ts +8 -0
- package/dist/core/loop/todo-manager.d.ts +8 -4
- package/dist/core/todo/todo-manager.d.ts +36 -0
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/registry.d.ts +9 -6
- package/dist/hooks/types.d.ts +7 -0
- package/dist/index.js +1869 -1440
- package/package.json +1 -1
- package/dist/agents/prompts/discovery/index.d.ts +0 -3
- package/dist/agents/prompts/execution/index.d.ts +0 -9
- package/dist/agents/prompts/mission/index.d.ts +0 -4
- package/dist/agents/prompts/philosophy/execution-assurance.d.ts +0 -2
- package/dist/agents/prompts/philosophy/index.d.ts +0 -4
- package/dist/agents/prompts/planning/index.d.ts +0 -8
- package/dist/agents/prompts/roles/commander/index.d.ts +0 -4
- package/dist/agents/prompts/roles/planner/index.d.ts +0 -3
- package/dist/agents/prompts/roles/reviewer/index.d.ts +0 -3
- package/dist/agents/prompts/roles/worker/index.d.ts +0 -3
- package/dist/agents/prompts/tools/index.d.ts +0 -5
- package/dist/agents/prompts/verification/index.d.ts +0 -7
- /package/dist/agents/prompts/{philosophy/anti-hallucination.d.ts → 01_philosophy/anti_hallucination.d.ts} +0 -0
- /package/dist/agents/prompts/{philosophy → 01_philosophy}/core.d.ts +0 -0
- /package/dist/agents/prompts/{philosophy → 01_philosophy}/modularity.d.ts +0 -0
- /package/dist/agents/prompts/{discovery/environment.d.ts → 02_discovery/discovery_environment.d.ts} +0 -0
- /package/dist/agents/prompts/{discovery/skills.d.ts → 02_discovery/discovery_skills.d.ts} +0 -0
- /package/dist/agents/prompts/{discovery/workspace.d.ts → 02_discovery/discovery_workspace.d.ts} +0 -0
- /package/dist/agents/prompts/{planning/planner-todo.d.ts → 03_planning/agents/planning_planner.d.ts} +0 -0
- /package/dist/agents/prompts/{planning/reviewer-todo-update.d.ts → 03_planning/agents/planning_reviewer.d.ts} +0 -0
- /package/dist/agents/prompts/{planning/decomposition.d.ts → 03_planning/planning_decomposition.d.ts} +0 -0
- /package/dist/agents/prompts/{planning/file-planning.d.ts → 03_planning/planning_file_planning.d.ts} +0 -0
- /package/dist/agents/prompts/{execution/parallel.d.ts → 03_planning/planning_parallel.d.ts} +0 -0
- /package/dist/agents/prompts/{planning/research.d.ts → 03_planning/planning_research.d.ts} +0 -0
- /package/dist/agents/prompts/{planning/todo-format.d.ts → 03_planning/planning_todo_format.d.ts} +0 -0
- /package/dist/agents/prompts/{planning/todo-rules.d.ts → 03_planning/planning_todo_rules.d.ts} +0 -0
- /package/dist/agents/prompts/{planning/todo-sync.d.ts → 03_planning/planning_todo_sync.d.ts} +0 -0
- /package/dist/agents/prompts/{execution/delegation.d.ts → 04_execution/execution_delegation.d.ts} +0 -0
- /package/dist/agents/prompts/{execution/file-assignment.d.ts → 04_execution/execution_file_assignment.d.ts} +0 -0
- /package/dist/agents/prompts/{execution/hyper-parallel.d.ts → 04_execution/execution_hyper_parallel.d.ts} +0 -0
- /package/dist/agents/prompts/{execution/isolation.d.ts → 04_execution/execution_isolation.d.ts} +0 -0
- /package/dist/agents/prompts/{execution/quality.d.ts → 04_execution/execution_quality.d.ts} +0 -0
- /package/dist/agents/prompts/{execution/strategy.d.ts → 04_execution/execution_strategy.d.ts} +0 -0
- /package/dist/agents/prompts/{execution/tdd.d.ts → 04_execution/execution_tdd.d.ts} +0 -0
- /package/dist/agents/prompts/{execution/workflow.d.ts → 04_execution/execution_workflow.d.ts} +0 -0
- /package/dist/agents/prompts/{verification/reviewer-process.d.ts → 05_verification/agents/verification_reviewer.d.ts} +0 -0
- /package/dist/agents/prompts/{verification/async-monitoring.d.ts → 05_verification/verification_async_monitoring.d.ts} +0 -0
- /package/dist/agents/prompts/{verification/evidence.d.ts → 05_verification/verification_evidence.d.ts} +0 -0
- /package/dist/agents/prompts/{verification/integration.d.ts → 05_verification/verification_integration.d.ts} +0 -0
- /package/dist/agents/prompts/{verification/process.d.ts → 05_verification/verification_strategy.d.ts} +0 -0
- /package/dist/agents/prompts/{verification/sync-check.d.ts → 05_verification/verification_sync_check.d.ts} +0 -0
- /package/dist/agents/prompts/{verification/sync-handling.d.ts → 05_verification/verification_sync_handling.d.ts} +0 -0
- /package/dist/agents/prompts/{mission/completion-conditions.d.ts → 06_mission/mission_completion_conditions.d.ts} +0 -0
- /package/dist/agents/prompts/{mission/loop-continuation.d.ts → 06_mission/mission_loop_continuation.d.ts} +0 -0
- /package/dist/agents/prompts/{mission/recovery.d.ts → 06_mission/mission_recovery.d.ts} +0 -0
- /package/dist/agents/prompts/{mission/status-tracking.d.ts → 06_mission/mission_status_tracking.d.ts} +0 -0
- /package/dist/agents/prompts/{roles/commander/forbidden.d.ts → 07_agents/commander/commander_forbidden.d.ts} +0 -0
- /package/dist/agents/prompts/{roles/commander/identity.d.ts → 07_agents/commander/commander_identity.d.ts} +0 -0
- /package/dist/agents/prompts/{roles/commander/required.d.ts → 07_agents/commander/commander_required.d.ts} +0 -0
- /package/dist/agents/prompts/{roles/commander/role.d.ts → 07_agents/commander/commander_role.d.ts} +0 -0
- /package/dist/agents/prompts/{roles/planner/forbidden.d.ts → 07_agents/planner/planner_forbidden.d.ts} +0 -0
- /package/dist/agents/prompts/{roles/planner/identity.d.ts → 07_agents/planner/planner_identity.d.ts} +0 -0
- /package/dist/agents/prompts/{roles/planner/required.d.ts → 07_agents/planner/planner_required.d.ts} +0 -0
- /package/dist/agents/prompts/{roles/reviewer/forbidden.d.ts → 07_agents/reviewer/reviewer_forbidden.d.ts} +0 -0
- /package/dist/agents/prompts/{roles/reviewer/identity.d.ts → 07_agents/reviewer/reviewer_identity.d.ts} +0 -0
- /package/dist/agents/prompts/{roles/reviewer/required.d.ts → 07_agents/reviewer/reviewer_required.d.ts} +0 -0
- /package/dist/agents/prompts/{roles/worker/forbidden.d.ts → 07_agents/worker/worker_forbidden.d.ts} +0 -0
- /package/dist/agents/prompts/{roles/worker/identity.d.ts → 07_agents/worker/worker_identity.d.ts} +0 -0
- /package/dist/agents/prompts/{roles/worker/required.d.ts → 07_agents/worker/worker_required.d.ts} +0 -0
- /package/dist/agents/prompts/{tools/reviewer-lsp.d.ts → 08_tools/agents/tools_reviewer.d.ts} +0 -0
- /package/dist/agents/prompts/{tools/worker-lsp.d.ts → 08_tools/agents/tools_worker.d.ts} +0 -0
- /package/dist/agents/prompts/{tools/ast.d.ts → 08_tools/tools_ast.d.ts} +0 -0
- /package/dist/agents/prompts/{tools/lsp.d.ts → 08_tools/tools_lsp.d.ts} +0 -0
- /package/dist/agents/prompts/{tools/search.d.ts → 08_tools/tools_search.d.ts} +0 -0
package/dist/index.js
CHANGED
|
@@ -2397,43 +2397,12 @@ var init_shared = __esm({
|
|
|
2397
2397
|
}
|
|
2398
2398
|
});
|
|
2399
2399
|
|
|
2400
|
-
// src/agents/prompts/
|
|
2401
|
-
var CORE_PHILOSOPHY;
|
|
2402
|
-
var init_core2 = __esm({
|
|
2403
|
-
"src/agents/prompts/philosophy/core.ts"() {
|
|
2404
|
-
"use strict";
|
|
2405
|
-
init_constants();
|
|
2406
|
-
init_shared();
|
|
2407
|
-
CORE_PHILOSOPHY = `${PROMPT_TAGS.CORE_PHILOSOPHY.open}
|
|
2408
|
-
## Core Philosophy: ${PHILOSOPHY_TAGLINE}
|
|
2409
|
-
|
|
2410
|
-
> ${PHILOSOPHY_QUOTE}
|
|
2411
|
-
|
|
2412
|
-
| Phase | Action | Key Behavior |
|
|
2413
|
-
|:-----:|:-------|:-------------|
|
|
2414
|
-
| [EXPLORE] **${PHILOSOPHY_PHASES.EXPLORE}** | Scan unknown territory | Detect environment, never assume |
|
|
2415
|
-
| [LEARN] **${PHILOSOPHY_PHASES.LEARN}** | Document discoveries | Record patterns for future use |
|
|
2416
|
-
| [ADAPT] **${PHILOSOPHY_PHASES.ADAPT}** | Adjust to findings | Match project's style and context |
|
|
2417
|
-
| [ACT] **${PHILOSOPHY_PHASES.ACT}** | Execute with confidence | Build, test, verify, conclude |
|
|
2418
|
-
|
|
2419
|
-
**${PHILOSOPHY_LEARN_PRINCIPLE}**
|
|
2420
|
-
|
|
2421
|
-
### Agent Focus:
|
|
2422
|
-
- [COMMANDER] **${AGENT_NAMES.COMMANDER}**: All phases (orchestrate the full cycle)
|
|
2423
|
-
- [PLANNER] **${AGENT_NAMES.PLANNER}**: ${PHILOSOPHY_PHASES.EXPLORE} \u2192 ${PHILOSOPHY_PHASES.LEARN} (research and document)
|
|
2424
|
-
- [WORKER] **${AGENT_NAMES.WORKER}**: ${PHILOSOPHY_PHASES.ADAPT} \u2192 ${PHILOSOPHY_PHASES.ACT} (implement with fit)
|
|
2425
|
-
- [REVIEWER] **${AGENT_NAMES.REVIEWER}**: ${PHILOSOPHY_PHASES.EXPLORE} \u2192 ${PHILOSOPHY_PHASES.LEARN} \u2192 ${PHILOSOPHY_PHASES.ACT} (verify with evidence)
|
|
2426
|
-
${PROMPT_TAGS.CORE_PHILOSOPHY.close}`;
|
|
2427
|
-
}
|
|
2428
|
-
});
|
|
2429
|
-
|
|
2430
|
-
// src/agents/prompts/philosophy/execution-assurance.ts
|
|
2400
|
+
// src/agents/prompts/01_philosophy/execution_assurance.ts
|
|
2431
2401
|
var EXECUTION_ASSURANCE;
|
|
2432
2402
|
var init_execution_assurance = __esm({
|
|
2433
|
-
"src/agents/prompts/
|
|
2403
|
+
"src/agents/prompts/01_philosophy/execution_assurance.ts"() {
|
|
2434
2404
|
"use strict";
|
|
2435
2405
|
init_shared();
|
|
2436
|
-
init_shared();
|
|
2437
2406
|
EXECUTION_ASSURANCE = wrapTag(PROMPT_TAGS.EXECUTION_ASSURANCE, `
|
|
2438
2407
|
## L0-L7 Execution Assurance Levels
|
|
2439
2408
|
|
|
@@ -2454,10 +2423,10 @@ var init_execution_assurance = __esm({
|
|
|
2454
2423
|
}
|
|
2455
2424
|
});
|
|
2456
2425
|
|
|
2457
|
-
// src/agents/prompts/
|
|
2426
|
+
// src/agents/prompts/01_philosophy/anti_hallucination.ts
|
|
2458
2427
|
var ANTI_HALLUCINATION_CORE;
|
|
2459
2428
|
var init_anti_hallucination = __esm({
|
|
2460
|
-
"src/agents/prompts/
|
|
2429
|
+
"src/agents/prompts/01_philosophy/anti_hallucination.ts"() {
|
|
2461
2430
|
"use strict";
|
|
2462
2431
|
init_shared();
|
|
2463
2432
|
ANTI_HALLUCINATION_CORE = `${PROMPT_TAGS.ANTI_HALLUCINATION.open}
|
|
@@ -2512,10 +2481,40 @@ ${PROMPT_TAGS.ANTI_HALLUCINATION.close}`;
|
|
|
2512
2481
|
}
|
|
2513
2482
|
});
|
|
2514
2483
|
|
|
2515
|
-
// src/agents/prompts/
|
|
2484
|
+
// src/agents/prompts/01_philosophy/core.ts
|
|
2485
|
+
var CORE_PHILOSOPHY;
|
|
2486
|
+
var init_core2 = __esm({
|
|
2487
|
+
"src/agents/prompts/01_philosophy/core.ts"() {
|
|
2488
|
+
"use strict";
|
|
2489
|
+
init_constants();
|
|
2490
|
+
init_shared();
|
|
2491
|
+
CORE_PHILOSOPHY = `${PROMPT_TAGS.CORE_PHILOSOPHY.open}
|
|
2492
|
+
## Core Philosophy: ${PHILOSOPHY_TAGLINE}
|
|
2493
|
+
|
|
2494
|
+
> ${PHILOSOPHY_QUOTE}
|
|
2495
|
+
|
|
2496
|
+
| Phase | Action | Key Behavior |
|
|
2497
|
+
|:-----:|:-------|:-------------|
|
|
2498
|
+
| [EXPLORE] **${PHILOSOPHY_PHASES.EXPLORE}** | Scan unknown territory | Detect environment, never assume |
|
|
2499
|
+
| [LEARN] **${PHILOSOPHY_PHASES.LEARN}** | Document discoveries | Record patterns for future use |
|
|
2500
|
+
| [ADAPT] **${PHILOSOPHY_PHASES.ADAPT}** | Adjust to findings | Match project's style and context |
|
|
2501
|
+
| [ACT] **${PHILOSOPHY_PHASES.ACT}** | Execute with confidence | Build, test, verify, conclude |
|
|
2502
|
+
|
|
2503
|
+
**${PHILOSOPHY_LEARN_PRINCIPLE}**
|
|
2504
|
+
|
|
2505
|
+
### Agent Focus:
|
|
2506
|
+
- [COMMANDER] **${AGENT_NAMES.COMMANDER}**: All phases (orchestrate the full cycle)
|
|
2507
|
+
- [PLANNER] **${AGENT_NAMES.PLANNER}**: ${PHILOSOPHY_PHASES.EXPLORE} \u2192 ${PHILOSOPHY_PHASES.LEARN} (research and document)
|
|
2508
|
+
- [WORKER] **${AGENT_NAMES.WORKER}**: ${PHILOSOPHY_PHASES.ADAPT} \u2192 ${PHILOSOPHY_PHASES.ACT} (implement with fit)
|
|
2509
|
+
- [REVIEWER] **${AGENT_NAMES.REVIEWER}**: ${PHILOSOPHY_PHASES.EXPLORE} \u2192 ${PHILOSOPHY_PHASES.LEARN} \u2192 ${PHILOSOPHY_PHASES.ACT} (verify with evidence)
|
|
2510
|
+
${PROMPT_TAGS.CORE_PHILOSOPHY.close}`;
|
|
2511
|
+
}
|
|
2512
|
+
});
|
|
2513
|
+
|
|
2514
|
+
// src/agents/prompts/01_philosophy/modularity.ts
|
|
2516
2515
|
var MODULARITY_ENFORCEMENT;
|
|
2517
2516
|
var init_modularity = __esm({
|
|
2518
|
-
"src/agents/prompts/
|
|
2517
|
+
"src/agents/prompts/01_philosophy/modularity.ts"() {
|
|
2519
2518
|
"use strict";
|
|
2520
2519
|
init_shared();
|
|
2521
2520
|
MODULARITY_ENFORCEMENT = `${PROMPT_TAGS.QUALITY_CHECKLIST.open}
|
|
@@ -2547,585 +2546,399 @@ ${PROMPT_TAGS.QUALITY_CHECKLIST.close}`;
|
|
|
2547
2546
|
}
|
|
2548
2547
|
});
|
|
2549
2548
|
|
|
2550
|
-
// src/agents/prompts/
|
|
2549
|
+
// src/agents/prompts/01_philosophy/metadata.ts
|
|
2550
|
+
var init_metadata = __esm({
|
|
2551
|
+
"src/agents/prompts/01_philosophy/metadata.ts"() {
|
|
2552
|
+
"use strict";
|
|
2553
|
+
}
|
|
2554
|
+
});
|
|
2555
|
+
|
|
2556
|
+
// src/agents/prompts/01_philosophy/index.ts
|
|
2551
2557
|
var init_philosophy2 = __esm({
|
|
2552
|
-
"src/agents/prompts/
|
|
2558
|
+
"src/agents/prompts/01_philosophy/index.ts"() {
|
|
2553
2559
|
"use strict";
|
|
2554
|
-
init_core2();
|
|
2555
2560
|
init_execution_assurance();
|
|
2556
2561
|
init_anti_hallucination();
|
|
2562
|
+
init_core2();
|
|
2557
2563
|
init_modularity();
|
|
2564
|
+
init_metadata();
|
|
2558
2565
|
}
|
|
2559
2566
|
});
|
|
2560
2567
|
|
|
2561
|
-
// src/agents/prompts/
|
|
2562
|
-
var
|
|
2563
|
-
var
|
|
2564
|
-
"src/agents/prompts/
|
|
2568
|
+
// src/agents/prompts/02_discovery/discovery_workspace.ts
|
|
2569
|
+
var SHARED_WORKSPACE;
|
|
2570
|
+
var init_discovery_workspace = __esm({
|
|
2571
|
+
"src/agents/prompts/02_discovery/discovery_workspace.ts"() {
|
|
2565
2572
|
"use strict";
|
|
2566
2573
|
init_shared();
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
> **IMPORTANT**: You (Commander) conclude the mission ONLY when every hierarchical task is verified.
|
|
2571
|
-
> You must rely on ${AGENT_NAMES.REVIEWER} for the final quality gate.
|
|
2574
|
+
SHARED_WORKSPACE = `${PROMPT_TAGS.SHARED_WORKSPACE.open}
|
|
2575
|
+
${PATHS.OPENCODE}/ - Shared Context Directory (Real-time State)
|
|
2572
2576
|
|
|
2573
|
-
|
|
2577
|
+
\`\`\`
|
|
2578
|
+
${PATHS.OPENCODE}/
|
|
2579
|
+
\u251C\u2500\u2500 ${PATHS.TODO.split("/").pop()} - Master task list (single source of truth)
|
|
2580
|
+
\u251C\u2500\u2500 ${PATHS.CONTEXT.split("/").pop()} - Project context summary (<150 lines)
|
|
2581
|
+
\u251C\u2500\u2500 ${PATHS.WORK_LOG.split("/").pop()} - REAL-TIME work status (ALL agents read/write)
|
|
2582
|
+
\u2502 # - Active sessions & assigned files
|
|
2583
|
+
\u2502 # - Unit test completion records
|
|
2584
|
+
\u2502 # - Pending integration items
|
|
2585
|
+
\u251C\u2500\u2500 ${PATHS.UNIT_TESTS.split("/").pop()}/ - Unit test records (preserved after deletion)
|
|
2586
|
+
\u2502 \u2514\u2500\u2500 [timestamp]-[file].md # Test content, results, deleted test code
|
|
2587
|
+
\u251C\u2500\u2500 ${PATHS.SYNC_ISSUES.split("/").pop()} - File sync issues (Reviewer writes)
|
|
2588
|
+
\u251C\u2500\u2500 ${PATHS.INTEGRATION_STATUS.split("/").pop()} - Integration test results & sync status
|
|
2589
|
+
\u251C\u2500\u2500 ${PATHS.DOCS.split("/").pop()}/ - Cached documentation
|
|
2590
|
+
\u2514\u2500\u2500 ${PATHS.ARCHIVE.split("/").pop()}/ - Old context
|
|
2591
|
+
\`\`\`
|
|
2574
2592
|
|
|
2575
|
-
Finalize only when ALL of the following are true:
|
|
2576
|
-
- \u2705 **Hierarchical Completeness**: Every milestone, task, and sub-task in ${PATHS.TODO} is marked [x].
|
|
2577
|
-
- \u2705 **Verified Outcome**: You have received confirmation from ${AGENT_NAMES.REVIEWER} that all tests and builds pass.
|
|
2578
|
-
- \u2705 **Zero Regression**: No unresolved issues in ${PATHS.SYNC_ISSUES}.
|
|
2579
2593
|
|
|
2580
|
-
### Final Verification Workflow
|
|
2581
2594
|
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2595
|
+
## ID Formats (no digit limit):
|
|
2596
|
+
- Session: ${ID_PREFIX.SESSION}N (e.g., ${ID_PREFIX.SESSION}1, ${ID_PREFIX.SESSION}42)
|
|
2597
|
+
- Sync Issue: ${ID_PREFIX.SYNC_ISSUE}N (e.g., ${ID_PREFIX.SYNC_ISSUE}1, ${ID_PREFIX.SYNC_ISSUE}100)
|
|
2598
|
+
- Unit Test: ${ID_PREFIX.UNIT_TEST}N (e.g., ${ID_PREFIX.UNIT_TEST}1, ${ID_PREFIX.UNIT_TEST}50)
|
|
2586
2599
|
|
|
2587
|
-
|
|
2588
|
-
-
|
|
2589
|
-
-
|
|
2590
|
-
-
|
|
2600
|
+
## Status Values:
|
|
2601
|
+
- Action: ${WORK_STATUS.ACTION.CREATE} | ${WORK_STATUS.ACTION.MODIFY} | ${WORK_STATUS.ACTION.DELETE} | ${WORK_STATUS.ACTION.FIX}
|
|
2602
|
+
- Status: ${WORK_STATUS.STATUS.PENDING} | ${WORK_STATUS.STATUS.IN_PROGRESS} | ${WORK_STATUS.STATUS.DONE}
|
|
2603
|
+
- Test: ${WORK_STATUS.TEST_RESULT.PASS} | ${WORK_STATUS.TEST_RESULT.FAIL}
|
|
2591
2604
|
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2595
|
-
- \u274C Skip the final integration build/test pass.
|
|
2596
|
-
`;
|
|
2597
|
-
}
|
|
2598
|
-
});
|
|
2605
|
+
## ${PATHS.WORK_LOG} FORMAT:
|
|
2606
|
+
\`\`\`markdown
|
|
2607
|
+
# Work Log
|
|
2599
2608
|
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
"src/agents/prompts/mission/loop-continuation.ts"() {
|
|
2604
|
-
"use strict";
|
|
2605
|
-
init_shared();
|
|
2606
|
-
COMMANDER_LOOP_CONTINUATION = `${PROMPT_TAGS.LOOP_CONTINUATION.open}
|
|
2607
|
-
## LOOP CONTINUATION PROTOCOL
|
|
2609
|
+
## Active Sessions
|
|
2610
|
+
- [ ] ${ID_PREFIX.SESSION}1 (${AGENT_NAMES.WORKER}): \`src/auth/login.ts\` - ${WORK_STATUS.STATUS.IN_PROGRESS}
|
|
2611
|
+
- [x] ${ID_PREFIX.SESSION}2 (${AGENT_NAMES.WORKER}): \`src/utils/hash.ts\` - ${WORK_STATUS.SESSION.COMPLETED}
|
|
2608
2612
|
|
|
2609
|
-
|
|
2613
|
+
## Completed Units (Ready for Integration)
|
|
2614
|
+
| File | Session | Unit Test | Timestamp |
|
|
2615
|
+
|------|---------|-----------|-----------|
|
|
2616
|
+
| src/utils/hash.ts | ${ID_PREFIX.SESSION}2 | ${WORK_STATUS.TEST_RESULT.PASS} | 2026-01-18T09:00:00 |
|
|
2610
2617
|
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
cat ${PATHS.STATUS} 2>/dev/null || echo "No status yet"
|
|
2614
|
-
cat ${PATHS.TODO}
|
|
2615
|
-
cat ${PATHS.SYNC_ISSUES} 2>/dev/null || echo "No sync issues"
|
|
2618
|
+
## Pending Integration
|
|
2619
|
+
- src/utils/hash.ts
|
|
2616
2620
|
\`\`\`
|
|
2617
2621
|
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
| ${PATHS.TODO} Status | ${PATHS.SYNC_ISSUES} | Action |
|
|
2623
|
-
|--------|--------|--------|
|
|
2624
|
-
| Incomplete items | Any | Continue work |
|
|
2625
|
-
| All [x] | Issues exist | Fix sync issues |
|
|
2626
|
-
| All [x] | Empty | Conclude mission |
|
|
2627
|
-
|
|
2628
|
-
### When All Work Complete
|
|
2629
|
-
When ALL TODO items are [x] and NO sync issues:
|
|
2630
|
-
\u2192 Ensure a final "${VERIFICATION_SIGNALS.FINAL_PASS}" task was performed by ${AGENT_NAMES.REVIEWER}
|
|
2631
|
-
\u2192 If all checks pass, you may conclude the mission
|
|
2632
|
-
\u2192 If any check fails, address issues and repeat verification
|
|
2633
|
-
|
|
2634
|
-
${PROMPT_TAGS.LOOP_CONTINUATION.close}
|
|
2622
|
+
## PATH NOTES:
|
|
2623
|
+
- File paths use forward slash '/' in examples
|
|
2624
|
+
- On Windows, paths may use backslash '\\\\'
|
|
2625
|
+
- Use path.normalize() or similar when comparing paths programmatically
|
|
2635
2626
|
|
|
2627
|
+
RULES:
|
|
2628
|
+
- ALL agents MUST read ${PATHS.WORK_LOG} before starting
|
|
2629
|
+
- ${AGENT_NAMES.WORKER} updates ${PATHS.WORK_LOG} when starting/completing file work
|
|
2630
|
+
- ${AGENT_NAMES.REVIEWER} monitors ${PATHS.WORK_LOG} for completed units
|
|
2631
|
+
- ${AGENT_NAMES.COMMANDER} reads ${PATHS.WORK_LOG} in each loop iteration
|
|
2632
|
+
- ${PATHS.SYNC_ISSUES} = ${AGENT_NAMES.REVIEWER} writes issues for next iteration
|
|
2633
|
+
${PROMPT_TAGS.SHARED_WORKSPACE.close}
|
|
2636
2634
|
`;
|
|
2637
2635
|
}
|
|
2638
2636
|
});
|
|
2639
2637
|
|
|
2640
|
-
// src/agents/prompts/
|
|
2641
|
-
var
|
|
2642
|
-
|
|
2643
|
-
"src/agents/prompts/mission/status-tracking.ts"() {
|
|
2638
|
+
// src/agents/prompts/02_discovery/discovery_core.ts
|
|
2639
|
+
var init_discovery_core = __esm({
|
|
2640
|
+
"src/agents/prompts/02_discovery/discovery_core.ts"() {
|
|
2644
2641
|
"use strict";
|
|
2645
|
-
init_shared();
|
|
2646
|
-
MISSION_STATUS_FORMAT = `
|
|
2647
|
-
# Mission Status
|
|
2648
|
-
|
|
2649
|
-
## Progress
|
|
2650
|
-
- ${PATHS.TODO}: [N]/[Total] ([X]%)
|
|
2651
|
-
- Issues: [N] unresolved
|
|
2652
|
-
- ${AGENT_NAMES.WORKER}s: [N] active
|
|
2653
|
-
- Verification Strategy: [High-level plan from ${AGENT_NAMES.REVIEWER}]
|
|
2654
|
-
- Execution Status: ${WORK_STATUS.E2E_STATUS.NOT_STARTED} | ${WORK_STATUS.E2E_STATUS.RUNNING} | ${WORK_STATUS.E2E_STATUS.PASS} | ${WORK_STATUS.E2E_STATUS.FAIL}
|
|
2655
|
-
|
|
2656
|
-
## Current Phase
|
|
2657
|
-
[Phase Name]
|
|
2658
|
-
`;
|
|
2659
2642
|
}
|
|
2660
2643
|
});
|
|
2661
2644
|
|
|
2662
|
-
// src/agents/prompts/
|
|
2663
|
-
var
|
|
2664
|
-
var
|
|
2665
|
-
"src/agents/prompts/
|
|
2645
|
+
// src/agents/prompts/02_discovery/discovery_environment.ts
|
|
2646
|
+
var ENVIRONMENT_DISCOVERY;
|
|
2647
|
+
var init_discovery_environment = __esm({
|
|
2648
|
+
"src/agents/prompts/02_discovery/discovery_environment.ts"() {
|
|
2666
2649
|
"use strict";
|
|
2667
2650
|
init_shared();
|
|
2668
|
-
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
When any agent fails, times out, or gets stuck:
|
|
2651
|
+
ENVIRONMENT_DISCOVERY = `${PROMPT_TAGS.ENVIRONMENT_DISCOVERY.open}
|
|
2652
|
+
**MANDATORY FIRST STEP** - Before any planning or coding:
|
|
2672
2653
|
|
|
2673
|
-
|
|
2674
|
-
|
|
2654
|
+
## \u26A1 Direct Discovery (Efficient)
|
|
2655
|
+
Read the project directly - this is faster and cheaper than delegating to parallel scouts:
|
|
2656
|
+
1. **Read** project structure, config files, and documentation directly.
|
|
2657
|
+
2. **Document** all findings to \`${PATHS.CONTEXT}\`.
|
|
2658
|
+
3. **Verify** findings against existing codebase.
|
|
2675
2659
|
|
|
2676
|
-
|
|
2677
|
-
- For repetitive changes, use ${TOOL_NAMES.SED_REPLACE} or shell tools
|
|
2660
|
+
[NOTE]: Direct reading saves tokens and avoids parallel wait overhead.
|
|
2678
2661
|
|
|
2679
|
-
|
|
2680
|
-
|
|
2681
|
-
|
|
2682
|
-
-
|
|
2683
|
-
-
|
|
2684
|
-
-
|
|
2662
|
+
## 1. Project Structure Discovery
|
|
2663
|
+
Explore the project root to understand its organization:
|
|
2664
|
+
\`\`\`bash
|
|
2665
|
+
ls -la # Root contents
|
|
2666
|
+
find . -maxdepth 2 -type d | head -${LIMITS.DEFAULT_SCAN_LIMIT} # Directory structure
|
|
2667
|
+
find . -maxdepth 1 -type f # Root files
|
|
2668
|
+
\`\`\`
|
|
2685
2669
|
|
|
2686
|
-
### Level 3: ${RECOVERY_LEVEL.ASK_USER}
|
|
2687
|
-
If re-planning fails or requires human judgment:
|
|
2688
|
-
- Clearly explain the situation and what was tried
|
|
2689
|
-
- Present 2-3 options with pros/cons
|
|
2690
|
-
- Ask user for direction
|
|
2691
|
-
- Proceed based on user input
|
|
2692
2670
|
|
|
2693
|
-
|
|
2694
|
-
|
|
2695
|
-
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
2699
|
-
| Critical decision needed | Level 3: ${RECOVERY_LEVEL.ASK_USER} |
|
|
2700
|
-
| All attempts failed | Level 3: ${RECOVERY_LEVEL.ASK_USER} |
|
|
2671
|
+
**Look for patterns, NOT specific files:**
|
|
2672
|
+
- Source directories (src/, lib/, app/, pkg/, internal/, cmd/)
|
|
2673
|
+
- Test directories (tests/, test/, spec/, __tests__/, *_test/)
|
|
2674
|
+
- Build artifacts (dist/, build/, target/, out/, bin/)
|
|
2675
|
+
- Documentation (docs/, doc/, README*, CONTRIBUTING*, CHANGELOG*)
|
|
2676
|
+
- Configuration (hidden files, *.config.*, *.json, *.yaml, *.toml)
|
|
2701
2677
|
|
|
2702
|
-
|
|
2703
|
-
|
|
2704
|
-
}
|
|
2705
|
-
});
|
|
2678
|
+
## 2. Environment Detection (Adaptive)
|
|
2679
|
+
**DO NOT assume technology stack. DETECT it:**
|
|
2706
2680
|
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2681
|
+
| Indicator Files | Likely Environment |
|
|
2682
|
+
|----------------|-------------------|
|
|
2683
|
+
| package.json, tsconfig.json | Node.js / TypeScript |
|
|
2684
|
+
| Cargo.toml, Cargo.lock | Rust |
|
|
2685
|
+
| go.mod, go.sum | Go |
|
|
2686
|
+
| requirements.txt, pyproject.toml, setup.py | Python |
|
|
2687
|
+
| pom.xml, build.gradle | Java / JVM |
|
|
2688
|
+
| Gemfile, *.rb | Ruby |
|
|
2689
|
+
| composer.json | PHP |
|
|
2690
|
+
| CMakeLists.txt, Makefile | C/C++ |
|
|
2691
|
+
| *.csproj, *.sln | .NET / C# |
|
|
2692
|
+
| pubspec.yaml | Dart / Flutter |
|
|
2717
2693
|
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
init_shared();
|
|
2724
|
-
VERIFICATION_REQUIREMENTS = `${PROMPT_TAGS.VERIFICATION.open}
|
|
2725
|
-
VERIFICATION CHECKLIST
|
|
2726
|
-
|
|
2727
|
-
## Code Verification
|
|
2728
|
-
- [ ] lsp_diagnostics clean (no errors/warnings)
|
|
2729
|
-
- [ ] Build passes (use project's build command from ${PATHS.CONTEXT})
|
|
2730
|
-
- [ ] Tests pass (use project's test command from ${PATHS.CONTEXT})
|
|
2731
|
-
- [ ] No untyped variables (language-appropriate)
|
|
2732
|
-
- [ ] No debug logging left (console.log, print, etc.)
|
|
2733
|
-
|
|
2734
|
-
## Documentation Verification
|
|
2735
|
-
- [ ] Implementation matches ${PATHS.DOCS}/
|
|
2736
|
-
- [ ] API usage matches official docs
|
|
2737
|
-
- [ ] Version compatibility confirmed
|
|
2694
|
+
**For each detected config file, read it to find:**
|
|
2695
|
+
- Build commands
|
|
2696
|
+
- Test commands
|
|
2697
|
+
- Entry points
|
|
2698
|
+
- Dependencies
|
|
2738
2699
|
|
|
2739
|
-
##
|
|
2740
|
-
|
|
2741
|
-
|
|
2742
|
-
|
|
2700
|
+
## 3. Infrastructure Detection
|
|
2701
|
+
\`\`\`bash
|
|
2702
|
+
# Container/orchestration
|
|
2703
|
+
ls Dockerfile* docker-compose* 2>/dev/null
|
|
2704
|
+
ls kubernetes/ k8s/ helm/ 2>/dev/null
|
|
2743
2705
|
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
`;
|
|
2747
|
-
}
|
|
2748
|
-
});
|
|
2706
|
+
# CI/CD
|
|
2707
|
+
ls .github/workflows/ .gitlab-ci.yml .circleci/ Jenkinsfile 2>/dev/null
|
|
2749
2708
|
|
|
2750
|
-
|
|
2751
|
-
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
"use strict";
|
|
2755
|
-
init_shared();
|
|
2756
|
-
REVIEWER_INTEGRATION_TESTING = `${PROMPT_TAGS.INTEGRATION_TESTING.open}
|
|
2757
|
-
## INTEGRATION TESTING (Full System)
|
|
2709
|
+
# Cloud/IaC
|
|
2710
|
+
ls terraform/ cloudformation/ pulumi/ 2>/dev/null
|
|
2711
|
+
ls serverless.yml sam.yaml 2>/dev/null
|
|
2712
|
+
\`\`\`
|
|
2758
2713
|
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
-
|
|
2762
|
-
|
|
2763
|
-
-
|
|
2714
|
+
## 4. Existing Context Check
|
|
2715
|
+
\`\`\`bash
|
|
2716
|
+
ls -la ${PATHS.OPENCODE}/ 2>/dev/null || echo "No existing context"
|
|
2717
|
+
\`\`\`
|
|
2718
|
+
- If ${PATHS.OPENCODE}/ exists \u2192 ASK user to continue or start fresh
|
|
2719
|
+
- If not \u2192 Create fresh context
|
|
2764
2720
|
|
|
2765
|
-
|
|
2766
|
-
|
|
2721
|
+
## 5. Context Summary (SAVE TO ${PATHS.CONTEXT})
|
|
2722
|
+
\`\`\`markdown
|
|
2723
|
+
# Project Context
|
|
2767
2724
|
|
|
2768
|
-
|
|
2725
|
+
## Environment
|
|
2726
|
+
- Language: [DETECTED from files]
|
|
2727
|
+
- Runtime: [DETECTED version if available]
|
|
2728
|
+
- Build: [DETECTED build command]
|
|
2729
|
+
- Test: [DETECTED test command]
|
|
2730
|
+
- Package Manager: [DETECTED from lockfiles]
|
|
2769
2731
|
|
|
2770
|
-
|
|
2771
|
-
-
|
|
2772
|
-
-
|
|
2732
|
+
## Project Type
|
|
2733
|
+
- [ ] Library/Package
|
|
2734
|
+
- [ ] Application (CLI/Web/Mobile/Desktop)
|
|
2735
|
+
- [ ] Microservice
|
|
2736
|
+
- [ ] Monorepo
|
|
2737
|
+
- [ ] Other: [describe]
|
|
2773
2738
|
|
|
2774
|
-
|
|
2775
|
-
-
|
|
2776
|
-
-
|
|
2739
|
+
## Infrastructure
|
|
2740
|
+
- Container: [None / Docker / Podman]
|
|
2741
|
+
- Orchestration: [None / K8s / Docker Compose]
|
|
2742
|
+
- CI/CD: [DETECTED from config files]
|
|
2743
|
+
- Cloud: [DETECTED or None]
|
|
2777
2744
|
|
|
2778
|
-
|
|
2779
|
-
|
|
2745
|
+
## Structure
|
|
2746
|
+
- Source: [DETECTED path]
|
|
2747
|
+
- Tests: [DETECTED path]
|
|
2748
|
+
- Docs: [DETECTED path]
|
|
2749
|
+
- Entry: [DETECTED main file]
|
|
2780
2750
|
|
|
2781
|
-
|
|
2782
|
-
|
|
2783
|
-
|
|
2784
|
-
|
|
2785
|
-
|
|
2751
|
+
## Conventions (OBSERVE from existing code)
|
|
2752
|
+
- Naming: [camelCase / snake_case / PascalCase]
|
|
2753
|
+
- Imports: [relative / absolute / aliases]
|
|
2754
|
+
- Error handling: [exceptions / Result type / error codes]
|
|
2755
|
+
- Testing: [unit / integration / e2e patterns]
|
|
2786
2756
|
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2757
|
+
## Notes
|
|
2758
|
+
- [Any unique patterns or requirements observed]
|
|
2759
|
+
\`\`\`
|
|
2790
2760
|
|
|
2791
|
-
|
|
2761
|
+
## CRITICAL RULES:
|
|
2762
|
+
1. NEVER assume - always VERIFY by reading files
|
|
2763
|
+
2. ADAPT to what you find, don't force expectations
|
|
2764
|
+
3. If uncertain, ASK the user for clarification
|
|
2765
|
+
4. Document EVERYTHING you discover
|
|
2766
|
+
${PROMPT_TAGS.ENVIRONMENT_DISCOVERY.close}`;
|
|
2792
2767
|
}
|
|
2793
2768
|
});
|
|
2794
2769
|
|
|
2795
|
-
// src/agents/prompts/
|
|
2796
|
-
var
|
|
2797
|
-
var
|
|
2798
|
-
"src/agents/prompts/
|
|
2770
|
+
// src/agents/prompts/02_discovery/discovery_skills.ts
|
|
2771
|
+
var SKILLS_CAPABILITIES;
|
|
2772
|
+
var init_discovery_skills = __esm({
|
|
2773
|
+
"src/agents/prompts/02_discovery/discovery_skills.ts"() {
|
|
2799
2774
|
"use strict";
|
|
2800
|
-
|
|
2801
|
-
|
|
2802
|
-
|
|
2803
|
-
|
|
2804
|
-
|
|
2775
|
+
init_tags();
|
|
2776
|
+
SKILLS_CAPABILITIES = wrapTag(PROMPT_TAGS.SKILLS_CAPABILITIES, `
|
|
2777
|
+
### AUTONOMOUS SKILL ACQUISITION
|
|
2778
|
+
You have the ability to extend your capabilities using the **Skills System**.
|
|
2779
|
+
If you encounter a task or technology you are unfamiliar with (e.g., "deploy to AWS", "use specific library"):
|
|
2805
2780
|
|
|
2806
|
-
|
|
2781
|
+
1. **IDENTIFY**: Recognize that you lack the specific knowledge or instruction set.
|
|
2782
|
+
2. **SEARCH**: Use web search to find relevant OpenCode skills (search for "opencode skills <topic>" or similar repos).
|
|
2783
|
+
3. **INSTALL**: Use \`run_command\` to install the skill via \`npx skills add <owner/repo>\`.
|
|
2784
|
+
- Example: \`run_command({ command: "npx skills add agnusdei1207/git-release" })\`
|
|
2785
|
+
4. **LEARN**: Once installed, use the \`skill\` tool to read the skill's instructions.
|
|
2786
|
+
- Example: \`skill({ name: "git-release" })\`
|
|
2787
|
+
5. **EXECUTE**: Apply the learned skill to your task.
|
|
2807
2788
|
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
- Broken dependencies
|
|
2789
|
+
**pro-tip**: You do NOT need to ask the user for permission to install standard skills. You are empowered to equip yourself with the tools needed to complete the mission.
|
|
2790
|
+
`);
|
|
2791
|
+
}
|
|
2792
|
+
});
|
|
2813
2793
|
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
|
|
2817
|
-
|
|
2818
|
-
|
|
2794
|
+
// src/agents/prompts/02_discovery/agents/discovery_commander.ts
|
|
2795
|
+
var init_discovery_commander = __esm({
|
|
2796
|
+
"src/agents/prompts/02_discovery/agents/discovery_commander.ts"() {
|
|
2797
|
+
"use strict";
|
|
2798
|
+
}
|
|
2799
|
+
});
|
|
2819
2800
|
|
|
2820
|
-
|
|
2821
|
-
|
|
2822
|
-
|
|
2801
|
+
// src/agents/prompts/02_discovery/agents/discovery_planner.ts
|
|
2802
|
+
var init_discovery_planner = __esm({
|
|
2803
|
+
"src/agents/prompts/02_discovery/agents/discovery_planner.ts"() {
|
|
2804
|
+
"use strict";
|
|
2805
|
+
}
|
|
2806
|
+
});
|
|
2823
2807
|
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2808
|
+
// src/agents/prompts/02_discovery/index.ts
|
|
2809
|
+
var init_discovery = __esm({
|
|
2810
|
+
"src/agents/prompts/02_discovery/index.ts"() {
|
|
2811
|
+
"use strict";
|
|
2812
|
+
init_discovery_workspace();
|
|
2813
|
+
init_discovery_core();
|
|
2814
|
+
init_discovery_environment();
|
|
2815
|
+
init_discovery_skills();
|
|
2816
|
+
init_discovery_commander();
|
|
2817
|
+
init_discovery_planner();
|
|
2818
|
+
}
|
|
2819
|
+
});
|
|
2827
2820
|
|
|
2828
|
-
|
|
2821
|
+
// src/agents/prompts/03_planning/planning_decomposition.ts
|
|
2822
|
+
var TASK_DECOMPOSITION;
|
|
2823
|
+
var init_planning_decomposition = __esm({
|
|
2824
|
+
"src/agents/prompts/03_planning/planning_decomposition.ts"() {
|
|
2825
|
+
"use strict";
|
|
2826
|
+
init_shared();
|
|
2827
|
+
TASK_DECOMPOSITION = wrapTag(PROMPT_TAGS.DECOMPOSITION_RULES, `
|
|
2828
|
+
## Task Decomposition Rules
|
|
2829
2829
|
|
|
2830
|
-
|
|
2830
|
+
When a task is too large or complex:
|
|
2831
|
+
1. **Break it down** into atomic steps (max 1 file or 1 logical unit per step).
|
|
2832
|
+
2. **Update TODO**: Replace the large task with subtasks T[N.1], T[N.2], etc.
|
|
2833
|
+
3. **Verify Atomic Success**: Each subtask must be verifiable independently (L2+).
|
|
2831
2834
|
|
|
2832
|
-
|
|
2833
|
-
-
|
|
2834
|
-
-
|
|
2835
|
-
-
|
|
2835
|
+
If stuck:
|
|
2836
|
+
- Do not retry the same failing action more than twice.
|
|
2837
|
+
- Decompose the problem into smaller investigation steps.
|
|
2838
|
+
- Create a specific "Research" task to find the root cause.`);
|
|
2839
|
+
}
|
|
2840
|
+
});
|
|
2836
2841
|
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2842
|
+
// src/agents/prompts/03_planning/planning_parallel.ts
|
|
2843
|
+
var COMMANDER_PARALLEL;
|
|
2844
|
+
var init_planning_parallel = __esm({
|
|
2845
|
+
"src/agents/prompts/03_planning/planning_parallel.ts"() {
|
|
2846
|
+
"use strict";
|
|
2847
|
+
init_shared();
|
|
2848
|
+
COMMANDER_PARALLEL = `${PROMPT_TAGS.PARALLEL_EXECUTION.open}
|
|
2849
|
+
YOUR 3 SUPERPOWERS - USE AGGRESSIVELY:
|
|
2840
2850
|
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
- Status: ${WORK_STATUS.STATUS.PENDING}
|
|
2851
|
+
1. PARALLEL AGENTS
|
|
2852
|
+
\`\`\`
|
|
2853
|
+
${TOOL_NAMES.DELEGATE_TASK}({ ${PARALLEL_PARAMS.AGENT}: "${AGENT_NAMES.PLANNER}", ${PARALLEL_PARAMS.PROMPT}: "Research X", ${PARALLEL_PARAMS.BACKGROUND}: true })
|
|
2854
|
+
${TOOL_NAMES.DELEGATE_TASK}({ ${PARALLEL_PARAMS.AGENT}: "${AGENT_NAMES.PLANNER}", ${PARALLEL_PARAMS.PROMPT}: "Research Y", ${PARALLEL_PARAMS.BACKGROUND}: true })
|
|
2855
|
+
// 2x faster!
|
|
2847
2856
|
\`\`\`
|
|
2848
2857
|
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
---
|
|
2857
|
-
|
|
2858
|
-
### Loop Continuation
|
|
2859
|
-
If sync issues exist:
|
|
2860
|
-
1. Write ONLY unresolved issues to ${PATHS.SYNC_ISSUES}
|
|
2861
|
-
2. Delete resolved issues from file
|
|
2862
|
-
3. Update ${PATHS.WORK_LOG} with required rework
|
|
2863
|
-
4. Report status to ${AGENT_NAMES.COMMANDER}
|
|
2864
|
-
|
|
2865
|
-
### CRITICAL:
|
|
2866
|
-
- Always check sync AFTER integration tests
|
|
2867
|
-
- DELETE resolved issues immediately
|
|
2868
|
-
- Keep ${PATHS.SYNC_ISSUES} as short as possible
|
|
2869
|
-
- Ensure ${AGENT_NAMES.COMMANDER} only sees what needs fixing
|
|
2858
|
+
2. BACKGROUND COMMANDS
|
|
2859
|
+
\`\`\`
|
|
2860
|
+
${TOOL_NAMES.RUN_BACKGROUND}({ command: "npm run build" })
|
|
2861
|
+
// ...continue other work...
|
|
2862
|
+
${TOOL_NAMES.CHECK_BACKGROUND}({ ${PARALLEL_PARAMS.TASK_ID}: "xxx" })
|
|
2863
|
+
\`\`\`
|
|
2870
2864
|
|
|
2871
|
-
|
|
2865
|
+
3. SESSION RESUME
|
|
2866
|
+
\`\`\`
|
|
2867
|
+
${TOOL_NAMES.DELEGATE_TASK}({ ${PARALLEL_PARAMS.PROMPT}: "Continue work", ${PARALLEL_PARAMS.RESUME}: "session_abc" })
|
|
2868
|
+
\`\`\`
|
|
2869
|
+
${PROMPT_TAGS.PARALLEL_EXECUTION.close}`;
|
|
2872
2870
|
}
|
|
2873
2871
|
});
|
|
2874
2872
|
|
|
2875
|
-
// src/agents/prompts/
|
|
2876
|
-
var
|
|
2877
|
-
var
|
|
2878
|
-
"src/agents/prompts/
|
|
2873
|
+
// src/agents/prompts/03_planning/planning_todo_sync.ts
|
|
2874
|
+
var PLANNER_TODO_SYNC;
|
|
2875
|
+
var init_planning_todo_sync = __esm({
|
|
2876
|
+
"src/agents/prompts/03_planning/planning_todo_sync.ts"() {
|
|
2879
2877
|
"use strict";
|
|
2880
2878
|
init_shared();
|
|
2881
|
-
|
|
2882
|
-
## SYNC
|
|
2879
|
+
PLANNER_TODO_SYNC = `${PROMPT_TAGS.TODO_SYNC.open}
|
|
2880
|
+
## TODO SYNC & DOCUMENT MAINTENANCE
|
|
2883
2881
|
|
|
2884
|
-
When ${AGENT_NAMES.
|
|
2882
|
+
When ${AGENT_NAMES.COMMANDER} detects sync issues, you update TODO and maintain docs.
|
|
2885
2883
|
|
|
2886
|
-
### Step 1: Read
|
|
2884
|
+
### Step 1: Read Current State
|
|
2887
2885
|
\`\`\`bash
|
|
2888
|
-
cat ${PATHS.
|
|
2886
|
+
cat ${PATHS.STATUS} # Current progress %
|
|
2887
|
+
cat ${PATHS.SYNC_ISSUES} # Unresolved issues
|
|
2888
|
+
cat ${PATHS.TODO} # Task list
|
|
2889
2889
|
\`\`\`
|
|
2890
2890
|
|
|
2891
|
-
### Step 2:
|
|
2892
|
-
|
|
2893
|
-
- Which files are involved?
|
|
2894
|
-
- What's the root cause?
|
|
2895
|
-
- What's the fix?
|
|
2896
|
-
|
|
2897
|
-
### Step 3: Instruct Planner
|
|
2898
|
-
Delegate to ${AGENT_NAMES.PLANNER} with SPECIFIC instructions:
|
|
2899
|
-
|
|
2900
|
-
\`\`\`
|
|
2901
|
-
${TOOL_NAMES.DELEGATE_TASK}(
|
|
2902
|
-
task: "Update TODO for sync fix ${ID_PREFIX.SYNC_ISSUE}1",
|
|
2903
|
-
agent: ${AGENT_NAMES.PLANNER},
|
|
2904
|
-
instructions: "
|
|
2905
|
-
Read ${PATHS.SYNC_ISSUES} for ${ID_PREFIX.SYNC_ISSUE}1.
|
|
2906
|
-
Add FIX tasks for: src/auth/login.ts, src/api/users.ts.
|
|
2907
|
-
Issue: Import mismatch - login.ts exports 'login' but users.ts imports 'authenticate'.
|
|
2908
|
-
Fix: Update users.ts to import 'login' instead of 'authenticate'.
|
|
2909
|
-
Update ${PATHS.WORK_LOG} file status.
|
|
2910
|
-
"
|
|
2911
|
-
)
|
|
2912
|
-
\`\`\`
|
|
2913
|
-
|
|
2914
|
-
### Step 4: Instruct ${AGENT_NAMES.WORKER}s
|
|
2915
|
-
After ${AGENT_NAMES.PLANNER} updates ${PATHS.TODO}, delegate fixes:
|
|
2916
|
-
|
|
2917
|
-
\`\`\`
|
|
2918
|
-
${TOOL_NAMES.DELEGATE_TASK}(
|
|
2919
|
-
task: "Fix ${ID_PREFIX.SYNC_ISSUE}1 in src/api/users.ts",
|
|
2920
|
-
agent: ${AGENT_NAMES.WORKER},
|
|
2921
|
-
file: "src/api/users.ts",
|
|
2922
|
-
instructions: "
|
|
2923
|
-
Read ${PATHS.SYNC_ISSUES} ${ID_PREFIX.SYNC_ISSUE}1.
|
|
2924
|
-
Read ${PATHS.WORK_LOG} for context.
|
|
2925
|
-
Fix: Change 'import { authenticate }' to 'import { login }'.
|
|
2926
|
-
Run isolated test.
|
|
2927
|
-
Update ${PATHS.WORK_LOG}.
|
|
2928
|
-
",
|
|
2929
|
-
background: true
|
|
2930
|
-
)
|
|
2931
|
-
\`\`\`
|
|
2932
|
-
|
|
2933
|
-
### Step 5: Invoke ${AGENT_NAMES.REVIEWER} Again
|
|
2934
|
-
After all fix ${AGENT_NAMES.WORKER}s complete:
|
|
2935
|
-
|
|
2936
|
-
\`\`\`
|
|
2937
|
-
${TOOL_NAMES.DELEGATE_TASK}(
|
|
2938
|
-
task: "Re-verify after ${ID_PREFIX.SYNC_ISSUE}1 fixes",
|
|
2939
|
-
agent: ${AGENT_NAMES.REVIEWER},
|
|
2940
|
-
instructions: "
|
|
2941
|
-
Verify ${ID_PREFIX.SYNC_ISSUE}1 is resolved.
|
|
2942
|
-
Run integration tests.
|
|
2943
|
-
Clear resolved issues from ${PATHS.SYNC_ISSUES}.
|
|
2944
|
-
Update ${PATHS.INTEGRATION_STATUS}.
|
|
2945
|
-
"
|
|
2946
|
-
)
|
|
2947
|
-
\`\`\`
|
|
2948
|
-
|
|
2949
|
-
### Communication Flow
|
|
2950
|
-
\`\`\`
|
|
2951
|
-
${AGENT_NAMES.COMMANDER}: "${AGENT_NAMES.PLANNER}, sync issue found. Update TODO"
|
|
2952
|
-
\u2193
|
|
2953
|
-
${AGENT_NAMES.PLANNER}: (Add FIX task to ${PATHS.TODO}, update ${PATHS.WORK_LOG})
|
|
2954
|
-
\u2193
|
|
2955
|
-
${AGENT_NAMES.COMMANDER}: "${AGENT_NAMES.WORKER}, fix this file like this" (Multiple ${AGENT_NAMES.WORKER}s in parallel)
|
|
2956
|
-
\u2193
|
|
2957
|
-
${AGENT_NAMES.WORKER}s: (Fix each file + unit test + update ${PATHS.WORK_LOG})
|
|
2958
|
-
\u2193
|
|
2959
|
-
${AGENT_NAMES.COMMANDER}: "${AGENT_NAMES.REVIEWER}, verify again"
|
|
2960
|
-
\u2193
|
|
2961
|
-
${AGENT_NAMES.REVIEWER}: (Integration test + sync check + clear ${PATHS.SYNC_ISSUES})
|
|
2962
|
-
\`\`\`
|
|
2963
|
-
|
|
2964
|
-
### CRITICAL:
|
|
2965
|
-
- ALWAYS read ${PATHS.SYNC_ISSUES} at loop start
|
|
2966
|
-
- NEVER skip Planner when fixing - TODO must be updated
|
|
2967
|
-
- ALWAYS include specific instructions in ${TOOL_NAMES.DELEGATE_TASK}
|
|
2968
|
-
- Workers need: file path + issue ID + exact fix instructions
|
|
2969
|
-
${PROMPT_TAGS.SYNC_ISSUE_HANDLING.close}`;
|
|
2970
|
-
}
|
|
2971
|
-
});
|
|
2972
|
-
|
|
2973
|
-
// src/agents/prompts/verification/evidence.ts
|
|
2974
|
-
var EVIDENCE_FORMAT;
|
|
2975
|
-
var init_evidence = __esm({
|
|
2976
|
-
"src/agents/prompts/verification/evidence.ts"() {
|
|
2977
|
-
"use strict";
|
|
2978
|
-
init_shared();
|
|
2979
|
-
EVIDENCE_FORMAT = `${PROMPT_TAGS.OUTPUT_FORMAT.open}
|
|
2980
|
-
VERIFICATION: T[N]
|
|
2981
|
-
|
|
2982
|
-
## Pass Example:
|
|
2983
|
-
PASS
|
|
2984
|
-
Evidence:
|
|
2985
|
-
- lsp_diagnostics: clean
|
|
2986
|
-
- build: pass
|
|
2987
|
-
- tests: 15 passed
|
|
2988
|
-
- docs match: .opencode/docs/api.md
|
|
2989
|
-
|
|
2990
|
-
## Fail Example:
|
|
2991
|
-
FAIL
|
|
2992
|
-
Issue: Tests failing - 2 failed, 13 passed
|
|
2993
|
-
Fix: Check src/api.ts line 45, missing null check
|
|
2994
|
-
Action: ${AGENT_NAMES.WORKER} to fix, then re-verify
|
|
2995
|
-
${PROMPT_TAGS.OUTPUT_FORMAT.close}`;
|
|
2996
|
-
}
|
|
2997
|
-
});
|
|
2998
|
-
|
|
2999
|
-
// src/agents/prompts/verification/async-monitoring.ts
|
|
3000
|
-
var REVIEWER_ASYNC_MONITORING;
|
|
3001
|
-
var init_async_monitoring = __esm({
|
|
3002
|
-
"src/agents/prompts/verification/async-monitoring.ts"() {
|
|
3003
|
-
"use strict";
|
|
3004
|
-
init_shared();
|
|
3005
|
-
REVIEWER_ASYNC_MONITORING = `${PROMPT_TAGS.ASYNC_MONITORING.open}
|
|
3006
|
-
## ASYNC PARALLEL WORK MONITORING
|
|
3007
|
-
|
|
3008
|
-
You monitor ${AGENT_NAMES.WORKER} sessions running in PARALLEL.
|
|
3009
|
-
Do NOT block - check status asynchronously and wait for completion.
|
|
3010
|
-
|
|
3011
|
-
### Monitoring Loop
|
|
3012
|
-
1. Read ${PATHS.WORK_LOG} to check active sessions:
|
|
3013
|
-
\`\`\`bash
|
|
3014
|
-
cat ${PATHS.WORK_LOG}
|
|
3015
|
-
\`\`\`
|
|
3016
|
-
|
|
3017
|
-
2. Identify completed units (marked [x] in Active Sessions)
|
|
3018
|
-
|
|
3019
|
-
3. For each completed unit:
|
|
3020
|
-
- Verify unit test record exists in ${PATHS.UNIT_TESTS}/
|
|
3021
|
-
- Check isolated test file was deleted
|
|
3022
|
-
- Verify implementation quality
|
|
3023
|
-
|
|
3024
|
-
4. Wait for ALL parallel workers to complete before integration test
|
|
3025
|
-
|
|
3026
|
-
### Status Check Pattern
|
|
3027
|
-
\`\`\`markdown
|
|
3028
|
-
## Current Status Check
|
|
3029
|
-
- Total active workers: [N]
|
|
3030
|
-
- Completed units: [list]
|
|
3031
|
-
- Still running: [list]
|
|
3032
|
-
- Ready for integration: [YES/NO]
|
|
3033
|
-
\`\`\`
|
|
3034
|
-
|
|
3035
|
-
### Non-Blocking Wait Strategy
|
|
3036
|
-
1. If workers still running:
|
|
3037
|
-
- Report current status
|
|
3038
|
-
- DO NOT block or wait indefinitely
|
|
3039
|
-
- Schedule next check (${AGENT_NAMES.COMMANDER} will re-invoke)
|
|
3040
|
-
|
|
3041
|
-
2. If all workers complete:
|
|
3042
|
-
- Proceed to integration testing
|
|
3043
|
-
- Update ${PATHS.INTEGRATION_STATUS}
|
|
3044
|
-
|
|
3045
|
-
### ${PATHS.WORK_LOG.split("/").pop()} Interpretation
|
|
2891
|
+
### Step 2: Add Fix Tasks
|
|
2892
|
+
Add NEW subtasks for sync fixes:
|
|
3046
2893
|
\`\`\`markdown
|
|
3047
|
-
|
|
3048
|
-
- [ ]
|
|
3049
|
-
- [
|
|
3050
|
-
\`\`\`
|
|
3051
|
-
|
|
3052
|
-
### CRITICAL:
|
|
3053
|
-
- NEVER verify a file before worker marks [x]
|
|
3054
|
-
- NEVER block waiting for workers
|
|
3055
|
-
- Always update ${PATHS.WORK_LOG} with your monitoring status
|
|
3056
|
-
|
|
3057
|
-
${PROMPT_TAGS.ASYNC_MONITORING.close}`;
|
|
3058
|
-
}
|
|
3059
|
-
});
|
|
3060
|
-
|
|
3061
|
-
// src/agents/prompts/verification/reviewer-process.ts
|
|
3062
|
-
var REVIEWER_VERIFICATION;
|
|
3063
|
-
var init_reviewer_process = __esm({
|
|
3064
|
-
"src/agents/prompts/verification/reviewer-process.ts"() {
|
|
3065
|
-
"use strict";
|
|
3066
|
-
init_shared();
|
|
3067
|
-
REVIEWER_VERIFICATION = `${PROMPT_TAGS.VERIFICATION_PROCESS.open}
|
|
3068
|
-
**ADAPTIVE VERIFICATION PROCESS**
|
|
3069
|
-
|
|
3070
|
-
|
|
3071
|
-
## Step 1: Read Project Context
|
|
3072
|
-
\`\`\`bash
|
|
3073
|
-
cat ${PATHS.CONTEXT} # Get build/test commands
|
|
2894
|
+
### T3: Sync Fixes | parallel-group:3
|
|
2895
|
+
- [ ] S3.1: ${WORK_STATUS.ACTION.FIX} \`src/auth/login.ts\` | issue:${ID_PREFIX.SYNC_ISSUE}1
|
|
2896
|
+
- [ ] S3.2: ${WORK_STATUS.ACTION.FIX} \`src/api/users.ts\` | issue:${ID_PREFIX.SYNC_ISSUE}1
|
|
3074
2897
|
\`\`\`
|
|
3075
|
-
- Identify the BUILD command for this project
|
|
3076
|
-
- Identify the TEST command for this project
|
|
3077
|
-
- Note any project-specific verification requirements
|
|
3078
2898
|
|
|
3079
|
-
|
|
3080
|
-
${TOOL_NAMES.LSP_DIAGNOSTICS} - Must show NO errors or warnings
|
|
2899
|
+
---
|
|
3081
2900
|
|
|
3082
|
-
##
|
|
3083
|
-
- Run the project's BUILD command (from ${PATHS.CONTEXT})
|
|
3084
|
-
- Must pass without errors
|
|
3085
|
-
- Watch for deprecation warnings
|
|
2901
|
+
## \u{1F4CB} DOCUMENT MAINTENANCE RULES
|
|
3086
2902
|
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
2903
|
+
### Keep ${PATHS.OPENCODE}/ Minimal:
|
|
2904
|
+
| File | Rule |
|
|
2905
|
+
|------|------|
|
|
2906
|
+
| ${PATHS.STATUS} | Overwrite each loop (no history) |
|
|
2907
|
+
| ${PATHS.TODO} | Keep only uncompleted tasks |
|
|
2908
|
+
| ${PATHS.SYNC_ISSUES} | Delete resolved issues immediately |
|
|
2909
|
+
| ${PATHS.WORK_LOG} | Archive completed, keep active only |
|
|
3091
2910
|
|
|
3092
|
-
|
|
3093
|
-
-
|
|
3094
|
-
-
|
|
3095
|
-
-
|
|
2911
|
+
### Summarize & Clean:
|
|
2912
|
+
- **Completed tasks**: Move to archive or delete
|
|
2913
|
+
- **Resolved issues**: DELETE from ${PATHS.SYNC_ISSUES.split("/").pop()}
|
|
2914
|
+
- **Old status**: Overwrite with current (no append)
|
|
2915
|
+
- **Long descriptions**: Summarize to 1-2 lines
|
|
3096
2916
|
|
|
3097
|
-
|
|
3098
|
-
-
|
|
3099
|
-
-
|
|
3100
|
-
-
|
|
2917
|
+
### What to DELETE:
|
|
2918
|
+
- Resolved sync issues
|
|
2919
|
+
- Completed TODO items (mark [x] first, then remove in next cycle)
|
|
2920
|
+
- Old status updates
|
|
2921
|
+
- Verbose explanations
|
|
3101
2922
|
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
-
|
|
2923
|
+
### What to KEEP:
|
|
2924
|
+
- Active/pending tasks
|
|
2925
|
+
- Unresolved issues
|
|
2926
|
+
- Current phase info
|
|
2927
|
+
- Blockers
|
|
3105
2928
|
|
|
3106
|
-
|
|
3107
|
-
${
|
|
3108
|
-
|
|
3109
|
-
});
|
|
2929
|
+
### CRITICAL:
|
|
2930
|
+
- ${AGENT_NAMES.COMMANDER} should NOT see old/resolved content
|
|
2931
|
+
- Only current state matters
|
|
3110
2932
|
|
|
3111
|
-
|
|
3112
|
-
|
|
3113
|
-
"src/agents/prompts/verification/index.ts"() {
|
|
3114
|
-
"use strict";
|
|
3115
|
-
init_process();
|
|
3116
|
-
init_integration();
|
|
3117
|
-
init_sync_check();
|
|
3118
|
-
init_sync_handling();
|
|
3119
|
-
init_evidence();
|
|
3120
|
-
init_async_monitoring();
|
|
3121
|
-
init_reviewer_process();
|
|
2933
|
+
- Less context = faster decisions
|
|
2934
|
+
${PROMPT_TAGS.TODO_SYNC.close}`;
|
|
3122
2935
|
}
|
|
3123
2936
|
});
|
|
3124
2937
|
|
|
3125
|
-
// src/agents/prompts/
|
|
2938
|
+
// src/agents/prompts/03_planning/planning_todo_format.ts
|
|
3126
2939
|
var COMMANDER_TODO_FORMAT;
|
|
3127
|
-
var
|
|
3128
|
-
"src/agents/prompts/
|
|
2940
|
+
var init_planning_todo_format = __esm({
|
|
2941
|
+
"src/agents/prompts/03_planning/planning_todo_format.ts"() {
|
|
3129
2942
|
"use strict";
|
|
3130
2943
|
init_shared();
|
|
3131
2944
|
COMMANDER_TODO_FORMAT = `${PROMPT_TAGS.TODO_FORMAT.open}
|
|
@@ -3171,10 +2984,17 @@ ${PROMPT_TAGS.TODO_FORMAT.close}`;
|
|
|
3171
2984
|
}
|
|
3172
2985
|
});
|
|
3173
2986
|
|
|
3174
|
-
// src/agents/prompts/
|
|
2987
|
+
// src/agents/prompts/03_planning/planning_core.ts
|
|
2988
|
+
var init_planning_core = __esm({
|
|
2989
|
+
"src/agents/prompts/03_planning/planning_core.ts"() {
|
|
2990
|
+
"use strict";
|
|
2991
|
+
}
|
|
2992
|
+
});
|
|
2993
|
+
|
|
2994
|
+
// src/agents/prompts/03_planning/planning_todo_rules.ts
|
|
3175
2995
|
var TODO_RULES;
|
|
3176
|
-
var
|
|
3177
|
-
"src/agents/prompts/
|
|
2996
|
+
var init_planning_todo_rules = __esm({
|
|
2997
|
+
"src/agents/prompts/03_planning/planning_todo_rules.ts"() {
|
|
3178
2998
|
"use strict";
|
|
3179
2999
|
init_shared();
|
|
3180
3000
|
TODO_RULES = `${PROMPT_TAGS.TODO_RULES.open}
|
|
@@ -3236,20 +3056,87 @@ ${PROMPT_TAGS.TODO_RULES.close}`;
|
|
|
3236
3056
|
}
|
|
3237
3057
|
});
|
|
3238
3058
|
|
|
3239
|
-
// src/agents/prompts/
|
|
3240
|
-
var
|
|
3241
|
-
var
|
|
3242
|
-
"src/agents/prompts/
|
|
3059
|
+
// src/agents/prompts/03_planning/planning_research.ts
|
|
3060
|
+
var PLANNER_RESEARCH;
|
|
3061
|
+
var init_planning_research = __esm({
|
|
3062
|
+
"src/agents/prompts/03_planning/planning_research.ts"() {
|
|
3243
3063
|
"use strict";
|
|
3244
3064
|
init_shared();
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
Before any work begins, you MUST identify ALL files:
|
|
3065
|
+
PLANNER_RESEARCH = `${PROMPT_TAGS.RESEARCH_WORKFLOW.open}
|
|
3066
|
+
\u{1F52C} ADAPTIVE RESEARCH WORKFLOW
|
|
3249
3067
|
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3068
|
+
## Available Research Tools
|
|
3069
|
+
| Tool | Usage | Purpose |
|
|
3070
|
+
|------|-------|---------|
|
|
3071
|
+
| ${TOOL_NAMES.WEBSEARCH} | websearch({ query: "..." }) | Search web for docs, tutorials |
|
|
3072
|
+
| ${TOOL_NAMES.WEBFETCH} | webfetch({ url: "..." }) | Fetch full content from URL |
|
|
3073
|
+
| ${TOOL_NAMES.CODESEARCH} | codesearch({ query: "..." }) | Search GitHub for examples |
|
|
3074
|
+
| ${TOOL_NAMES.CACHE_DOCS} | cache_docs({ url, topic }) | Save docs to ${PATHS.DOCS}/ |
|
|
3075
|
+
|
|
3076
|
+
## Step 1: Identify What to Research
|
|
3077
|
+
- What technology/library/API is needed?
|
|
3078
|
+
- What version is the project using? (check ${PATHS.CONTEXT})
|
|
3079
|
+
- What specific syntax/pattern is unclear?
|
|
3080
|
+
|
|
3081
|
+
## Step 2: Prioritize Sources (in order)
|
|
3082
|
+
1. **Project's own docs** - Check ${PATHS.DOCS}/ first
|
|
3083
|
+
2. **Official documentation** - [framework].dev, docs.[library].com
|
|
3084
|
+
3. **GitHub repo** - README, examples, source code
|
|
3085
|
+
4. **Package registry** - npm, PyPI, crates.io
|
|
3086
|
+
5. **Community** - Stack Overflow, Discord (lowest priority)
|
|
3087
|
+
|
|
3088
|
+
## Step 3: Search Strategy
|
|
3089
|
+
\`\`\`
|
|
3090
|
+
${TOOL_NAMES.WEBSEARCH} "[topic] official documentation [detected version]"
|
|
3091
|
+
${TOOL_NAMES.WEBSEARCH} "[topic] [language] example"
|
|
3092
|
+
${TOOL_NAMES.WEBFETCH} "[result URL from search]"
|
|
3093
|
+
${TOOL_NAMES.CACHE_DOCS} "{ url, topic }"
|
|
3094
|
+
\`\`\`
|
|
3095
|
+
|
|
3096
|
+
## Step 4: Validate & Extract
|
|
3097
|
+
- Is this the CORRECT version for this project?
|
|
3098
|
+
- Extract EXACT syntax (never paraphrase)
|
|
3099
|
+
- Note any version-specific differences
|
|
3100
|
+
|
|
3101
|
+
## Step 5: Cache Research
|
|
3102
|
+
Save to ${PATHS.DOCS}/[topic].md:
|
|
3103
|
+
|
|
3104
|
+
\`\`\`markdown
|
|
3105
|
+
# Research: [topic]
|
|
3106
|
+
Date: [timestamp]
|
|
3107
|
+
Source: [official URL]
|
|
3108
|
+
Confidence: ${WORK_STATUS.CONFIDENCE.HIGH}/${WORK_STATUS.CONFIDENCE.MEDIUM}/${WORK_STATUS.CONFIDENCE.LOW}
|
|
3109
|
+
Version: [detected version from project]
|
|
3110
|
+
|
|
3111
|
+
## Context
|
|
3112
|
+
Why this is needed: [brief explanation]
|
|
3113
|
+
|
|
3114
|
+
## Exact Syntax
|
|
3115
|
+
\`\`\`[detected language]
|
|
3116
|
+
[code from official docs - VERBATIM]
|
|
3117
|
+
\`\`\`
|
|
3118
|
+
|
|
3119
|
+
## Usage Notes
|
|
3120
|
+
- [any gotchas or important details]
|
|
3121
|
+
\`\`\`
|
|
3122
|
+
${PROMPT_TAGS.RESEARCH_WORKFLOW.close}`;
|
|
3123
|
+
}
|
|
3124
|
+
});
|
|
3125
|
+
|
|
3126
|
+
// src/agents/prompts/03_planning/planning_file_planning.ts
|
|
3127
|
+
var PLANNER_FILE_PLANNING;
|
|
3128
|
+
var init_planning_file_planning = __esm({
|
|
3129
|
+
"src/agents/prompts/03_planning/planning_file_planning.ts"() {
|
|
3130
|
+
"use strict";
|
|
3131
|
+
init_shared();
|
|
3132
|
+
PLANNER_FILE_PLANNING = `${PROMPT_TAGS.FILE_LEVEL_PLANNING.open}
|
|
3133
|
+
## FILE-LEVEL PLANNING (MANDATORY)
|
|
3134
|
+
|
|
3135
|
+
Before any work begins, you MUST identify ALL files:
|
|
3136
|
+
|
|
3137
|
+
### Step 1: Analyze Requirements
|
|
3138
|
+
- What needs to be built/changed?
|
|
3139
|
+
- What existing files are affected?
|
|
3253
3140
|
|
|
3254
3141
|
### Step 2: Create File Manifest
|
|
3255
3142
|
Write to ${PATHS.TODO}:
|
|
@@ -3316,96 +3203,79 @@ ${PROMPT_TAGS.FILE_LEVEL_PLANNING.close}`;
|
|
|
3316
3203
|
}
|
|
3317
3204
|
});
|
|
3318
3205
|
|
|
3319
|
-
// src/agents/prompts/
|
|
3320
|
-
var
|
|
3321
|
-
|
|
3322
|
-
"src/agents/prompts/planning/decomposition.ts"() {
|
|
3206
|
+
// src/agents/prompts/03_planning/agents/planning_commander.ts
|
|
3207
|
+
var init_planning_commander = __esm({
|
|
3208
|
+
"src/agents/prompts/03_planning/agents/planning_commander.ts"() {
|
|
3323
3209
|
"use strict";
|
|
3324
|
-
init_shared();
|
|
3325
|
-
TASK_DECOMPOSITION = wrapTag(PROMPT_TAGS.DECOMPOSITION_RULES, `
|
|
3326
|
-
## Task Decomposition Rules
|
|
3327
|
-
|
|
3328
|
-
When a task is too large or complex:
|
|
3329
|
-
1. **Break it down** into atomic steps (max 1 file or 1 logical unit per step).
|
|
3330
|
-
2. **Update TODO**: Replace the large task with subtasks T[N.1], T[N.2], etc.
|
|
3331
|
-
3. **Verify Atomic Success**: Each subtask must be verifiable independently (L2+).
|
|
3332
|
-
|
|
3333
|
-
If stuck:
|
|
3334
|
-
- Do not retry the same failing action more than twice.
|
|
3335
|
-
- Decompose the problem into smaller investigation steps.
|
|
3336
|
-
- Create a specific "Research" task to find the root cause.`);
|
|
3337
3210
|
}
|
|
3338
3211
|
});
|
|
3339
3212
|
|
|
3340
|
-
// src/agents/prompts/
|
|
3341
|
-
var
|
|
3342
|
-
var
|
|
3343
|
-
"src/agents/prompts/
|
|
3213
|
+
// src/agents/prompts/03_planning/agents/planning_planner.ts
|
|
3214
|
+
var PLANNER_TODO_FORMAT;
|
|
3215
|
+
var init_planning_planner = __esm({
|
|
3216
|
+
"src/agents/prompts/03_planning/agents/planning_planner.ts"() {
|
|
3344
3217
|
"use strict";
|
|
3345
3218
|
init_shared();
|
|
3346
|
-
|
|
3347
|
-
|
|
3219
|
+
PLANNER_TODO_FORMAT = `${PROMPT_TAGS.PLANNING_FORMAT.open}
|
|
3220
|
+
OUTPUT TO: ${PATHS.TODO}
|
|
3348
3221
|
|
|
3349
|
-
|
|
3222
|
+
## Hierarchical Task Decomposition
|
|
3223
|
+
Break down the complex request into as many levels as needed to achieve atomic work units.
|
|
3224
|
+
Each level must be clearly indented and uniquely numbered.
|
|
3350
3225
|
|
|
3351
|
-
###
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
cat ${PATHS.TODO} # Task list
|
|
3356
|
-
\`\`\`
|
|
3226
|
+
### Level N - Parent Task/Epic/Story
|
|
3227
|
+
- Represents a high-level goal or a logical grouping of work.
|
|
3228
|
+
- Status: ${WORK_STATUS.TODO_STATUS.PENDING} | [dependencies]
|
|
3229
|
+
- **COMPLETION RULE**: Satisfied only when ALL child tasks are marked as [x].
|
|
3357
3230
|
|
|
3358
|
-
###
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
- [ ] S3.1: ${WORK_STATUS.ACTION.FIX} \`src/auth/login.ts\` | issue:${ID_PREFIX.SYNC_ISSUE}1
|
|
3363
|
-
- [ ] S3.2: ${WORK_STATUS.ACTION.FIX} \`src/api/users.ts\` | issue:${ID_PREFIX.SYNC_ISSUE}1
|
|
3364
|
-
\`\`\`
|
|
3231
|
+
### Level N+1 - Actionable Subtasks
|
|
3232
|
+
- Represents specific, atomic actions (15-60 min).
|
|
3233
|
+
- Format: \`- [ ] ID: [description] | agent:[Name] | [metadata]\`
|
|
3234
|
+
- Metadata options: \`depends:[ID]\`, \`file:[path]\`, \`size:[XS/S/M/L]\`
|
|
3365
3235
|
|
|
3366
|
-
|
|
3236
|
+
## Template Example
|
|
3237
|
+
\`\`\`markdown
|
|
3238
|
+
# Mission: [goal]
|
|
3367
3239
|
|
|
3368
|
-
##
|
|
3240
|
+
## Project Context
|
|
3241
|
+
...
|
|
3369
3242
|
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
| ${PATHS.TODO} | Keep only uncompleted tasks |
|
|
3375
|
-
| ${PATHS.SYNC_ISSUES} | Delete resolved issues immediately |
|
|
3376
|
-
| ${PATHS.WORK_LOG} | Archive completed, keep active only |
|
|
3243
|
+
## G1: [The Goal] | status: ${WORK_STATUS.TODO_STATUS.PENDING}
|
|
3244
|
+
### P1.1: [Feature Project] | agent:${AGENT_NAMES.PLANNER}
|
|
3245
|
+
- [ ] T1.1.1: [Atomic Research] | size:S
|
|
3246
|
+
- [ ] T1.1.2: [Detailed Design] | size:M
|
|
3377
3247
|
|
|
3378
|
-
###
|
|
3379
|
-
|
|
3380
|
-
-
|
|
3381
|
-
-
|
|
3382
|
-
- **Long descriptions**: Summarize to 1-2 lines
|
|
3248
|
+
### P1.2: [Implementation Block] | agent:${AGENT_NAMES.WORKER} | depends:P1.1
|
|
3249
|
+
#### P1.2.1: [Sub-module A]
|
|
3250
|
+
- [ ] T1.2.1.1: [Draft code] | file:src/a.ts | size:M
|
|
3251
|
+
- [ ] T1.2.1.2: [Tests for A] | file:tests/a.test.ts | size:S
|
|
3383
3252
|
|
|
3384
|
-
|
|
3385
|
-
-
|
|
3386
|
-
-
|
|
3387
|
-
- Old status updates
|
|
3388
|
-
- Verbose explanations
|
|
3253
|
+
#### P1.2.2: [Sub-module B] | depends:P1.2.1
|
|
3254
|
+
- [ ] T1.2.2.1: [Draft code] | file:src/b.ts | size:M
|
|
3255
|
+
- [ ] T1.2.2.2: [Tests for B] | file:tests/b.test.ts | size:S
|
|
3389
3256
|
|
|
3390
|
-
###
|
|
3391
|
-
-
|
|
3392
|
-
-
|
|
3393
|
-
|
|
3394
|
-
- Blockers
|
|
3257
|
+
### P1.3: [Final Quality Pass] | agent:${AGENT_NAMES.REVIEWER} | depends:P1.2
|
|
3258
|
+
- [ ] T1.3.1: [Visual E2E] | size:M
|
|
3259
|
+
- [ ] T1.3.2: [Release Build] | size:S
|
|
3260
|
+
\`\`\`
|
|
3395
3261
|
|
|
3396
|
-
|
|
3397
|
-
-
|
|
3398
|
-
- Only
|
|
3262
|
+
## Planning Rules
|
|
3263
|
+
- **No Limit on Depth**: If a task is too big for one person or session, break it down further.
|
|
3264
|
+
- **Atomic Execution**: Only the leaf nodes (the innermost tasks with checkboxes) are directly executed.
|
|
3265
|
+
- **Parent Propagation**: When you find all children of a parent header are checked, update the parent status to ${WORK_STATUS.TODO_STATUS.COMPLETE}.
|
|
3266
|
+
- **Max Parallelism**: Identify tasks that don't depend on each other and mark them as such to allow multiple Workers to run in parallel.
|
|
3267
|
+
- Size: ${WORK_STATUS.TASK_SIZE.XS}(<5min), ${WORK_STATUS.TASK_SIZE.S}(5-15min), ${WORK_STATUS.TASK_SIZE.M}(15-30min), ${WORK_STATUS.TASK_SIZE.L}(30-60min)
|
|
3268
|
+
- If any task is L or larger, it MUST be broken into subtasks.
|
|
3399
3269
|
|
|
3400
|
-
|
|
3401
|
-
${PROMPT_TAGS.
|
|
3270
|
+
ALL items MUST start with [ ] (unchecked) unless already finished.
|
|
3271
|
+
${PROMPT_TAGS.PLANNING_FORMAT.close}`;
|
|
3402
3272
|
}
|
|
3403
3273
|
});
|
|
3404
3274
|
|
|
3405
|
-
// src/agents/prompts/
|
|
3275
|
+
// src/agents/prompts/03_planning/agents/planning_reviewer.ts
|
|
3406
3276
|
var REVIEWER_TODO_UPDATE;
|
|
3407
|
-
var
|
|
3408
|
-
"src/agents/prompts/
|
|
3277
|
+
var init_planning_reviewer = __esm({
|
|
3278
|
+
"src/agents/prompts/03_planning/agents/planning_reviewer.ts"() {
|
|
3409
3279
|
"use strict";
|
|
3410
3280
|
init_shared();
|
|
3411
3281
|
REVIEWER_TODO_UPDATE = `${PROMPT_TAGS.TODO_MANAGEMENT.open}
|
|
@@ -3452,185 +3322,83 @@ ${PROMPT_TAGS.TODO_MANAGEMENT.close}`;
|
|
|
3452
3322
|
}
|
|
3453
3323
|
});
|
|
3454
3324
|
|
|
3455
|
-
// src/agents/prompts/
|
|
3456
|
-
var
|
|
3457
|
-
|
|
3458
|
-
"src/agents/prompts/planning/research.ts"() {
|
|
3325
|
+
// src/agents/prompts/03_planning/index.ts
|
|
3326
|
+
var init_planning = __esm({
|
|
3327
|
+
"src/agents/prompts/03_planning/index.ts"() {
|
|
3459
3328
|
"use strict";
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
|
|
3329
|
+
init_planning_decomposition();
|
|
3330
|
+
init_planning_parallel();
|
|
3331
|
+
init_planning_todo_sync();
|
|
3332
|
+
init_planning_todo_format();
|
|
3333
|
+
init_planning_core();
|
|
3334
|
+
init_planning_todo_rules();
|
|
3335
|
+
init_planning_research();
|
|
3336
|
+
init_planning_file_planning();
|
|
3337
|
+
init_planning_commander();
|
|
3338
|
+
init_planning_planner();
|
|
3339
|
+
init_planning_reviewer();
|
|
3340
|
+
}
|
|
3341
|
+
});
|
|
3471
3342
|
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
3475
|
-
|
|
3343
|
+
// src/agents/prompts/04_execution/execution_quality.ts
|
|
3344
|
+
var WORKER_QUALITY;
|
|
3345
|
+
var init_execution_quality = __esm({
|
|
3346
|
+
"src/agents/prompts/04_execution/execution_quality.ts"() {
|
|
3347
|
+
"use strict";
|
|
3348
|
+
init_shared();
|
|
3349
|
+
WORKER_QUALITY = `${PROMPT_TAGS.QUALITY_CHECKLIST.open}
|
|
3350
|
+
\u{1F4CB} QUALITY CHECKLIST (Adaptive)
|
|
3476
3351
|
|
|
3477
|
-
|
|
3478
|
-
1. **Project's own docs** - Check ${PATHS.DOCS}/ first
|
|
3479
|
-
2. **Official documentation** - [framework].dev, docs.[library].com
|
|
3480
|
-
3. **GitHub repo** - README, examples, source code
|
|
3481
|
-
4. **Package registry** - npm, PyPI, crates.io
|
|
3482
|
-
5. **Community** - Stack Overflow, Discord (lowest priority)
|
|
3352
|
+
Before reporting complete, verify against PROJECT-SPECIFIC standards:
|
|
3483
3353
|
|
|
3484
|
-
##
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
${TOOL_NAMES.WEBSEARCH} "[topic] [language] example"
|
|
3488
|
-
${TOOL_NAMES.WEBFETCH} "[result URL from search]"
|
|
3489
|
-
${TOOL_NAMES.CACHE_DOCS} "{ url, topic }"
|
|
3490
|
-
\`\`\`
|
|
3354
|
+
## 1. Static Analysis
|
|
3355
|
+
- lsp_diagnostics shows NO errors
|
|
3356
|
+
- Follow linting rules discovered in project (if any)
|
|
3491
3357
|
|
|
3492
|
-
##
|
|
3493
|
-
-
|
|
3494
|
-
-
|
|
3495
|
-
- Note any version-specific differences
|
|
3358
|
+
## 2. Build Verification
|
|
3359
|
+
- Run the BUILD command from ${PATHS.CONTEXT}
|
|
3360
|
+
- Must complete without errors
|
|
3496
3361
|
|
|
3497
|
-
##
|
|
3498
|
-
|
|
3362
|
+
## 3. Test Verification
|
|
3363
|
+
- Tests written for new/changed code
|
|
3364
|
+
- Run the TEST command from ${PATHS.CONTEXT}
|
|
3365
|
+
- All tests must pass
|
|
3499
3366
|
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
|
|
3503
|
-
|
|
3504
|
-
|
|
3505
|
-
Version: [detected version from project]
|
|
3367
|
+
## 4. Code Quality (OBSERVE existing patterns)
|
|
3368
|
+
- Match naming conventions found in codebase
|
|
3369
|
+
- Match error handling patterns found in codebase
|
|
3370
|
+
- No debug logging left (console.log, print, logger.debug, etc.)
|
|
3371
|
+
- No hardcoded values that should be config
|
|
3506
3372
|
|
|
3507
|
-
##
|
|
3508
|
-
|
|
3373
|
+
## 5. Documentation Compliance
|
|
3374
|
+
- Implementation matches ${PATHS.DOCS}/ patterns
|
|
3375
|
+
- API usage matches official documentation
|
|
3509
3376
|
|
|
3510
|
-
##
|
|
3511
|
-
\`\`\`[detected language]
|
|
3512
|
-
[code from official docs - VERBATIM]
|
|
3377
|
+
## OUTPUT FORMAT:
|
|
3513
3378
|
\`\`\`
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3379
|
+
TASK: T[N]
|
|
3380
|
+
CHANGED: [files] ([lines])
|
|
3381
|
+
BUILD: [command used] \u2192 [result]
|
|
3382
|
+
TEST: [command used] \u2192 [result]
|
|
3383
|
+
PATTERNS_FOLLOWED: [list observed conventions]
|
|
3384
|
+
DOCS_USED: ${PATHS.DOCS}/[file]
|
|
3385
|
+
Ready for ${AGENT_NAMES.REVIEWER} verification
|
|
3517
3386
|
\`\`\`
|
|
3518
|
-
${PROMPT_TAGS.
|
|
3387
|
+
${PROMPT_TAGS.QUALITY_CHECKLIST.close}`;
|
|
3519
3388
|
}
|
|
3520
3389
|
});
|
|
3521
3390
|
|
|
3522
|
-
// src/agents/prompts/
|
|
3523
|
-
var
|
|
3524
|
-
|
|
3525
|
-
"src/agents/prompts/planning/planner-todo.ts"() {
|
|
3391
|
+
// src/agents/prompts/04_execution/execution_error_handling.ts
|
|
3392
|
+
var init_execution_error_handling = __esm({
|
|
3393
|
+
"src/agents/prompts/04_execution/execution_error_handling.ts"() {
|
|
3526
3394
|
"use strict";
|
|
3527
|
-
init_shared();
|
|
3528
|
-
PLANNER_TODO_FORMAT = `${PROMPT_TAGS.PLANNING_FORMAT.open}
|
|
3529
|
-
OUTPUT TO: ${PATHS.TODO}
|
|
3530
|
-
|
|
3531
|
-
## Hierarchical Task Decomposition
|
|
3532
|
-
Break down the complex request into as many levels as needed to achieve atomic work units.
|
|
3533
|
-
Each level must be clearly indented and uniquely numbered.
|
|
3534
|
-
|
|
3535
|
-
### Level N - Parent Task/Epic/Story
|
|
3536
|
-
- Represents a high-level goal or a logical grouping of work.
|
|
3537
|
-
- Status: ${WORK_STATUS.TODO_STATUS.PENDING} | [dependencies]
|
|
3538
|
-
- **COMPLETION RULE**: Satisfied only when ALL child tasks are marked as [x].
|
|
3539
|
-
|
|
3540
|
-
### Level N+1 - Actionable Subtasks
|
|
3541
|
-
- Represents specific, atomic actions (15-60 min).
|
|
3542
|
-
- Format: \`- [ ] ID: [description] | agent:[Name] | [metadata]\`
|
|
3543
|
-
- Metadata options: \`depends:[ID]\`, \`file:[path]\`, \`size:[XS/S/M/L]\`
|
|
3544
|
-
|
|
3545
|
-
## Template Example
|
|
3546
|
-
\`\`\`markdown
|
|
3547
|
-
# Mission: [goal]
|
|
3548
|
-
|
|
3549
|
-
## Project Context
|
|
3550
|
-
...
|
|
3551
|
-
|
|
3552
|
-
## G1: [The Goal] | status: ${WORK_STATUS.TODO_STATUS.PENDING}
|
|
3553
|
-
### P1.1: [Feature Project] | agent:${AGENT_NAMES.PLANNER}
|
|
3554
|
-
- [ ] T1.1.1: [Atomic Research] | size:S
|
|
3555
|
-
- [ ] T1.1.2: [Detailed Design] | size:M
|
|
3556
|
-
|
|
3557
|
-
### P1.2: [Implementation Block] | agent:${AGENT_NAMES.WORKER} | depends:P1.1
|
|
3558
|
-
#### P1.2.1: [Sub-module A]
|
|
3559
|
-
- [ ] T1.2.1.1: [Draft code] | file:src/a.ts | size:M
|
|
3560
|
-
- [ ] T1.2.1.2: [Tests for A] | file:tests/a.test.ts | size:S
|
|
3561
|
-
|
|
3562
|
-
#### P1.2.2: [Sub-module B] | depends:P1.2.1
|
|
3563
|
-
- [ ] T1.2.2.1: [Draft code] | file:src/b.ts | size:M
|
|
3564
|
-
- [ ] T1.2.2.2: [Tests for B] | file:tests/b.test.ts | size:S
|
|
3565
|
-
|
|
3566
|
-
### P1.3: [Final Quality Pass] | agent:${AGENT_NAMES.REVIEWER} | depends:P1.2
|
|
3567
|
-
- [ ] T1.3.1: [Visual E2E] | size:M
|
|
3568
|
-
- [ ] T1.3.2: [Release Build] | size:S
|
|
3569
|
-
\`\`\`
|
|
3570
|
-
|
|
3571
|
-
## Planning Rules
|
|
3572
|
-
- **No Limit on Depth**: If a task is too big for one person or session, break it down further.
|
|
3573
|
-
- **Atomic Execution**: Only the leaf nodes (the innermost tasks with checkboxes) are directly executed.
|
|
3574
|
-
- **Parent Propagation**: When you find all children of a parent header are checked, update the parent status to ${WORK_STATUS.TODO_STATUS.COMPLETE}.
|
|
3575
|
-
- **Max Parallelism**: Identify tasks that don't depend on each other and mark them as such to allow multiple Workers to run in parallel.
|
|
3576
|
-
- Size: ${WORK_STATUS.TASK_SIZE.XS}(<5min), ${WORK_STATUS.TASK_SIZE.S}(5-15min), ${WORK_STATUS.TASK_SIZE.M}(15-30min), ${WORK_STATUS.TASK_SIZE.L}(30-60min)
|
|
3577
|
-
- If any task is L or larger, it MUST be broken into subtasks.
|
|
3578
|
-
|
|
3579
|
-
ALL items MUST start with [ ] (unchecked) unless already finished.
|
|
3580
|
-
${PROMPT_TAGS.PLANNING_FORMAT.close}`;
|
|
3581
|
-
}
|
|
3582
|
-
});
|
|
3583
|
-
|
|
3584
|
-
// src/agents/prompts/planning/index.ts
|
|
3585
|
-
var init_planning = __esm({
|
|
3586
|
-
"src/agents/prompts/planning/index.ts"() {
|
|
3587
|
-
"use strict";
|
|
3588
|
-
init_todo_format();
|
|
3589
|
-
init_todo_rules();
|
|
3590
|
-
init_file_planning();
|
|
3591
|
-
init_decomposition();
|
|
3592
|
-
init_todo_sync();
|
|
3593
|
-
init_reviewer_todo_update();
|
|
3594
|
-
init_research();
|
|
3595
|
-
init_planner_todo();
|
|
3596
|
-
}
|
|
3597
|
-
});
|
|
3598
|
-
|
|
3599
|
-
// src/agents/prompts/execution/parallel.ts
|
|
3600
|
-
var COMMANDER_PARALLEL;
|
|
3601
|
-
var init_parallel4 = __esm({
|
|
3602
|
-
"src/agents/prompts/execution/parallel.ts"() {
|
|
3603
|
-
"use strict";
|
|
3604
|
-
init_shared();
|
|
3605
|
-
COMMANDER_PARALLEL = `${PROMPT_TAGS.PARALLEL_EXECUTION.open}
|
|
3606
|
-
YOUR 3 SUPERPOWERS - USE AGGRESSIVELY:
|
|
3607
|
-
|
|
3608
|
-
1. PARALLEL AGENTS
|
|
3609
|
-
\`\`\`
|
|
3610
|
-
${TOOL_NAMES.DELEGATE_TASK}({ ${PARALLEL_PARAMS.AGENT}: "${AGENT_NAMES.PLANNER}", ${PARALLEL_PARAMS.PROMPT}: "Research X", ${PARALLEL_PARAMS.BACKGROUND}: true })
|
|
3611
|
-
${TOOL_NAMES.DELEGATE_TASK}({ ${PARALLEL_PARAMS.AGENT}: "${AGENT_NAMES.PLANNER}", ${PARALLEL_PARAMS.PROMPT}: "Research Y", ${PARALLEL_PARAMS.BACKGROUND}: true })
|
|
3612
|
-
// 2x faster!
|
|
3613
|
-
\`\`\`
|
|
3614
|
-
|
|
3615
|
-
2. BACKGROUND COMMANDS
|
|
3616
|
-
\`\`\`
|
|
3617
|
-
${TOOL_NAMES.RUN_BACKGROUND}({ command: "npm run build" })
|
|
3618
|
-
// ...continue other work...
|
|
3619
|
-
${TOOL_NAMES.CHECK_BACKGROUND}({ ${PARALLEL_PARAMS.TASK_ID}: "xxx" })
|
|
3620
|
-
\`\`\`
|
|
3621
|
-
|
|
3622
|
-
3. SESSION RESUME
|
|
3623
|
-
\`\`\`
|
|
3624
|
-
${TOOL_NAMES.DELEGATE_TASK}({ ${PARALLEL_PARAMS.PROMPT}: "Continue work", ${PARALLEL_PARAMS.RESUME}: "session_abc" })
|
|
3625
|
-
\`\`\`
|
|
3626
|
-
${PROMPT_TAGS.PARALLEL_EXECUTION.close}`;
|
|
3627
3395
|
}
|
|
3628
3396
|
});
|
|
3629
3397
|
|
|
3630
|
-
// src/agents/prompts/
|
|
3398
|
+
// src/agents/prompts/04_execution/execution_delegation.ts
|
|
3631
3399
|
var DELEGATION_RULES;
|
|
3632
|
-
var
|
|
3633
|
-
"src/agents/prompts/
|
|
3400
|
+
var init_execution_delegation = __esm({
|
|
3401
|
+
"src/agents/prompts/04_execution/execution_delegation.ts"() {
|
|
3634
3402
|
"use strict";
|
|
3635
3403
|
init_shared();
|
|
3636
3404
|
DELEGATION_RULES = `${PROMPT_TAGS.AGENTS.open}
|
|
@@ -3644,10 +3412,10 @@ ${PROMPT_TAGS.AGENTS.close}`;
|
|
|
3644
3412
|
}
|
|
3645
3413
|
});
|
|
3646
3414
|
|
|
3647
|
-
// src/agents/prompts/
|
|
3415
|
+
// src/agents/prompts/04_execution/execution_file_assignment.ts
|
|
3648
3416
|
var WORKER_FILE_ASSIGNMENT;
|
|
3649
|
-
var
|
|
3650
|
-
"src/agents/prompts/
|
|
3417
|
+
var init_execution_file_assignment = __esm({
|
|
3418
|
+
"src/agents/prompts/04_execution/execution_file_assignment.ts"() {
|
|
3651
3419
|
"use strict";
|
|
3652
3420
|
init_shared();
|
|
3653
3421
|
WORKER_FILE_ASSIGNMENT = `${PROMPT_TAGS.FILE_ASSIGNMENT.open}
|
|
@@ -3730,10 +3498,10 @@ ${PROMPT_TAGS.FILE_ASSIGNMENT.close}`;
|
|
|
3730
3498
|
}
|
|
3731
3499
|
});
|
|
3732
3500
|
|
|
3733
|
-
// src/agents/prompts/
|
|
3501
|
+
// src/agents/prompts/04_execution/execution_workflow.ts
|
|
3734
3502
|
var WORKER_WORKFLOW;
|
|
3735
|
-
var
|
|
3736
|
-
"src/agents/prompts/
|
|
3503
|
+
var init_execution_workflow = __esm({
|
|
3504
|
+
"src/agents/prompts/04_execution/execution_workflow.ts"() {
|
|
3737
3505
|
"use strict";
|
|
3738
3506
|
init_shared();
|
|
3739
3507
|
WORKER_WORKFLOW = `${PROMPT_TAGS.WORKFLOW.open}
|
|
@@ -3777,28 +3545,64 @@ ${PROMPT_TAGS.WORKFLOW.close}`;
|
|
|
3777
3545
|
}
|
|
3778
3546
|
});
|
|
3779
3547
|
|
|
3780
|
-
// src/agents/prompts/
|
|
3781
|
-
var
|
|
3782
|
-
|
|
3783
|
-
|
|
3548
|
+
// src/agents/prompts/04_execution/execution_core.ts
|
|
3549
|
+
var init_execution_core = __esm({
|
|
3550
|
+
"src/agents/prompts/04_execution/execution_core.ts"() {
|
|
3551
|
+
"use strict";
|
|
3552
|
+
}
|
|
3553
|
+
});
|
|
3554
|
+
|
|
3555
|
+
// src/agents/prompts/04_execution/execution_strategy.ts
|
|
3556
|
+
var COMMANDER_EXECUTION;
|
|
3557
|
+
var init_execution_strategy = __esm({
|
|
3558
|
+
"src/agents/prompts/04_execution/execution_strategy.ts"() {
|
|
3784
3559
|
"use strict";
|
|
3785
3560
|
init_shared();
|
|
3786
|
-
|
|
3787
|
-
|
|
3561
|
+
COMMANDER_EXECUTION = `${PROMPT_TAGS.EXECUTION_STRATEGY.open}
|
|
3562
|
+
## ${PHASES.PHASE_0.ID}: ${PHASES.PHASE_0.NAME} (Direct Discovery)
|
|
3563
|
+
${PHASE_0_DIRECT_DISCOVERY}
|
|
3788
3564
|
|
|
3789
|
-
|
|
3565
|
+
## ${PHASES.PHASE_1.ID}: ${PHASES.PHASE_1.NAME} (Mandatory - Never Skip!)
|
|
3566
|
+
**THINK FIRST**: As ${AGENT_NAMES.COMMANDER}, think about ORCHESTRATION and synthesis before action.
|
|
3790
3567
|
|
|
3791
|
-
${
|
|
3568
|
+
${PHASE_1_THINK_ANALYSIS}
|
|
3792
3569
|
|
|
3793
|
-
|
|
3794
|
-
|
|
3570
|
+
**ANTI-PATTERNS**: Sequential execution when parallel is possible. Doing work yourself instead of delegating. Starting without clear decomposition or intellectual synthesis.
|
|
3571
|
+
|
|
3572
|
+
## ${PHASES.PHASE_2.ID}: ${PHASES.PHASE_2.NAME}
|
|
3573
|
+
| Type | Signal | Approach |
|
|
3574
|
+
|------|--------|----------|
|
|
3575
|
+
| ${WORK_STATUS.TRIAGE.TYPE.SIMPLE} | ${WORK_STATUS.TRIAGE.SIGNAL.ONE_FILE} | ${WORK_STATUS.TRIAGE.APPROACH.DIRECT} |
|
|
3576
|
+
| ${WORK_STATUS.TRIAGE.TYPE.MEDIUM} | ${WORK_STATUS.TRIAGE.SIGNAL.MULTI_FILE} | ${WORK_STATUS.TRIAGE.APPROACH.PLAN_EXECUTE_VERIFY} |
|
|
3577
|
+
| ${WORK_STATUS.TRIAGE.TYPE.COMPLEX} | ${WORK_STATUS.TRIAGE.SIGNAL.LARGE_SCOPE} | ${WORK_STATUS.TRIAGE.APPROACH.RESEARCH_PLAN_PARALLEL} |
|
|
3578
|
+
|
|
3579
|
+
## ${PHASES.PHASE_3.ID}: ${PHASES.PHASE_3.NAME} (for ${WORK_STATUS.TRIAGE.TYPE.MEDIUM}/${WORK_STATUS.TRIAGE.TYPE.COMPLEX})
|
|
3580
|
+
${AGENT_NAMES.PLANNER} creates ${PATHS.TODO} with parallel groups
|
|
3581
|
+
|
|
3582
|
+
## ${PHASES.PHASE_4.ID}: ${PHASES.PHASE_4.NAME}
|
|
3583
|
+
1. LAUNCH all independent tasks simultaneously (background=true)
|
|
3584
|
+
2. MONITOR with ${TOOL_NAMES.LIST_TASKS}
|
|
3585
|
+
3. COLLECT results with ${TOOL_NAMES.GET_TASK_RESULT}
|
|
3586
|
+
4. CONTINUE with dependent tasks
|
|
3587
|
+
5. REPEAT until all [ ] become [x]
|
|
3588
|
+
|
|
3589
|
+
## ${PHASES.PHASE_5.ID}: ${PHASES.PHASE_5.NAME}
|
|
3590
|
+
${PHASE_5_MSVP}
|
|
3591
|
+
|
|
3592
|
+
## ${PHASES.PHASE_6.ID}: ${PHASES.PHASE_6.NAME}
|
|
3593
|
+
When ALL work is complete:
|
|
3594
|
+
1. Verify ALL TODO items in ${PATHS.TODO} are marked [x].
|
|
3595
|
+
2. Delegate a final "${VERIFICATION_SIGNALS.FINAL_PASS}" task to ${AGENT_NAMES.REVIEWER}.
|
|
3596
|
+
3. Conclude the mission ONLY after ${AGENT_NAMES.REVIEWER} confirms zero regressions and all tests pass.
|
|
3597
|
+
4. If failures are reported, address them immediately and repeat verification.
|
|
3598
|
+
${PROMPT_TAGS.EXECUTION_STRATEGY.close}`;
|
|
3795
3599
|
}
|
|
3796
3600
|
});
|
|
3797
3601
|
|
|
3798
|
-
// src/agents/prompts/
|
|
3602
|
+
// src/agents/prompts/04_execution/execution_tdd.ts
|
|
3799
3603
|
var WORKER_TDD_WORKFLOW;
|
|
3800
|
-
var
|
|
3801
|
-
"src/agents/prompts/
|
|
3604
|
+
var init_execution_tdd = __esm({
|
|
3605
|
+
"src/agents/prompts/04_execution/execution_tdd.ts"() {
|
|
3802
3606
|
"use strict";
|
|
3803
3607
|
init_shared();
|
|
3804
3608
|
WORKER_TDD_WORKFLOW = `${PROMPT_TAGS.TDD_WORKFLOW.open}
|
|
@@ -3875,10 +3679,10 @@ ${PROMPT_TAGS.TDD_WORKFLOW.close}`;
|
|
|
3875
3679
|
}
|
|
3876
3680
|
});
|
|
3877
3681
|
|
|
3878
|
-
// src/agents/prompts/
|
|
3682
|
+
// src/agents/prompts/04_execution/execution_isolation.ts
|
|
3879
3683
|
var WORKER_ISOLATION_TESTING;
|
|
3880
|
-
var
|
|
3881
|
-
"src/agents/prompts/
|
|
3684
|
+
var init_execution_isolation = __esm({
|
|
3685
|
+
"src/agents/prompts/04_execution/execution_isolation.ts"() {
|
|
3882
3686
|
"use strict";
|
|
3883
3687
|
init_shared();
|
|
3884
3688
|
WORKER_ISOLATION_TESTING = `${PROMPT_TAGS.ISOLATION_TESTING.open}
|
|
@@ -3968,474 +3772,709 @@ ${PROMPT_TAGS.ISOLATION_TESTING.close}`;
|
|
|
3968
3772
|
}
|
|
3969
3773
|
});
|
|
3970
3774
|
|
|
3971
|
-
// src/agents/prompts/
|
|
3972
|
-
var
|
|
3973
|
-
var
|
|
3974
|
-
"src/agents/prompts/
|
|
3775
|
+
// src/agents/prompts/04_execution/execution_hyper_parallel.ts
|
|
3776
|
+
var HYPER_PARALLEL_ENFORCEMENT;
|
|
3777
|
+
var init_execution_hyper_parallel = __esm({
|
|
3778
|
+
"src/agents/prompts/04_execution/execution_hyper_parallel.ts"() {
|
|
3975
3779
|
"use strict";
|
|
3976
3780
|
init_shared();
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
${PHASE_0_DIRECT_DISCOVERY}
|
|
3980
|
-
|
|
3981
|
-
## ${PHASES.PHASE_1.ID}: ${PHASES.PHASE_1.NAME} (Mandatory - Never Skip!)
|
|
3982
|
-
**THINK FIRST**: As ${AGENT_NAMES.COMMANDER}, think about ORCHESTRATION and synthesis before action.
|
|
3983
|
-
|
|
3984
|
-
${PHASE_1_THINK_ANALYSIS}
|
|
3985
|
-
|
|
3986
|
-
**ANTI-PATTERNS**: Sequential execution when parallel is possible. Doing work yourself instead of delegating. Starting without clear decomposition or intellectual synthesis.
|
|
3987
|
-
|
|
3988
|
-
## ${PHASES.PHASE_2.ID}: ${PHASES.PHASE_2.NAME}
|
|
3989
|
-
| Type | Signal | Approach |
|
|
3990
|
-
|------|--------|----------|
|
|
3991
|
-
| ${WORK_STATUS.TRIAGE.TYPE.SIMPLE} | ${WORK_STATUS.TRIAGE.SIGNAL.ONE_FILE} | ${WORK_STATUS.TRIAGE.APPROACH.DIRECT} |
|
|
3992
|
-
| ${WORK_STATUS.TRIAGE.TYPE.MEDIUM} | ${WORK_STATUS.TRIAGE.SIGNAL.MULTI_FILE} | ${WORK_STATUS.TRIAGE.APPROACH.PLAN_EXECUTE_VERIFY} |
|
|
3993
|
-
| ${WORK_STATUS.TRIAGE.TYPE.COMPLEX} | ${WORK_STATUS.TRIAGE.SIGNAL.LARGE_SCOPE} | ${WORK_STATUS.TRIAGE.APPROACH.RESEARCH_PLAN_PARALLEL} |
|
|
3994
|
-
|
|
3995
|
-
## ${PHASES.PHASE_3.ID}: ${PHASES.PHASE_3.NAME} (for ${WORK_STATUS.TRIAGE.TYPE.MEDIUM}/${WORK_STATUS.TRIAGE.TYPE.COMPLEX})
|
|
3996
|
-
${AGENT_NAMES.PLANNER} creates ${PATHS.TODO} with parallel groups
|
|
3781
|
+
HYPER_PARALLEL_ENFORCEMENT = `${PROMPT_TAGS.QUALITY_CHECKLIST.open}
|
|
3782
|
+
\u{1F680} HYPER-PARALLEL COGNITIVE ARCHITECTURE (HPFA)
|
|
3997
3783
|
|
|
3998
|
-
|
|
3999
|
-
1. LAUNCH all independent tasks simultaneously (background=true)
|
|
4000
|
-
2. MONITOR with ${TOOL_NAMES.LIST_TASKS}
|
|
4001
|
-
3. COLLECT results with ${TOOL_NAMES.GET_TASK_RESULT}
|
|
4002
|
-
4. CONTINUE with dependent tasks
|
|
4003
|
-
5. REPEAT until all [ ] become [x]
|
|
3784
|
+
To achieve maximum velocity, you MUST leverage these advanced parallel execution patterns:
|
|
4004
3785
|
|
|
4005
|
-
|
|
4006
|
-
${PHASE_5_MSVP}
|
|
3786
|
+
${HPFA_RULES}
|
|
4007
3787
|
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
1. Verify ALL TODO items in ${PATHS.TODO} are marked [x].
|
|
4011
|
-
2. Delegate a final "${VERIFICATION_SIGNALS.FINAL_PASS}" task to ${AGENT_NAMES.REVIEWER}.
|
|
4012
|
-
3. Conclude the mission ONLY after ${AGENT_NAMES.REVIEWER} confirms zero regressions and all tests pass.
|
|
4013
|
-
4. If failures are reported, address them immediately and repeat verification.
|
|
4014
|
-
${PROMPT_TAGS.EXECUTION_STRATEGY.close}`;
|
|
3788
|
+
[CRITICAL]: Sequential execution when parallel is possible is a mission failure.
|
|
3789
|
+
${PROMPT_TAGS.QUALITY_CHECKLIST.close}`;
|
|
4015
3790
|
}
|
|
4016
3791
|
});
|
|
4017
3792
|
|
|
4018
|
-
// src/agents/prompts/
|
|
4019
|
-
var
|
|
4020
|
-
|
|
4021
|
-
"src/agents/prompts/execution/quality.ts"() {
|
|
3793
|
+
// src/agents/prompts/04_execution/agents/execution_worker.ts
|
|
3794
|
+
var init_execution_worker = __esm({
|
|
3795
|
+
"src/agents/prompts/04_execution/agents/execution_worker.ts"() {
|
|
4022
3796
|
"use strict";
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
\u{1F4CB} QUALITY CHECKLIST (Adaptive)
|
|
4026
|
-
|
|
4027
|
-
Before reporting complete, verify against PROJECT-SPECIFIC standards:
|
|
4028
|
-
|
|
4029
|
-
## 1. Static Analysis
|
|
4030
|
-
- lsp_diagnostics shows NO errors
|
|
4031
|
-
- Follow linting rules discovered in project (if any)
|
|
4032
|
-
|
|
4033
|
-
## 2. Build Verification
|
|
4034
|
-
- Run the BUILD command from ${PATHS.CONTEXT}
|
|
4035
|
-
- Must complete without errors
|
|
4036
|
-
|
|
4037
|
-
## 3. Test Verification
|
|
4038
|
-
- Tests written for new/changed code
|
|
4039
|
-
- Run the TEST command from ${PATHS.CONTEXT}
|
|
4040
|
-
- All tests must pass
|
|
4041
|
-
|
|
4042
|
-
## 4. Code Quality (OBSERVE existing patterns)
|
|
4043
|
-
- Match naming conventions found in codebase
|
|
4044
|
-
- Match error handling patterns found in codebase
|
|
4045
|
-
- No debug logging left (console.log, print, logger.debug, etc.)
|
|
4046
|
-
- No hardcoded values that should be config
|
|
4047
|
-
|
|
4048
|
-
## 5. Documentation Compliance
|
|
4049
|
-
- Implementation matches ${PATHS.DOCS}/ patterns
|
|
4050
|
-
- API usage matches official documentation
|
|
3797
|
+
}
|
|
3798
|
+
});
|
|
4051
3799
|
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
BUILD: [command used] \u2192 [result]
|
|
4057
|
-
TEST: [command used] \u2192 [result]
|
|
4058
|
-
PATTERNS_FOLLOWED: [list observed conventions]
|
|
4059
|
-
DOCS_USED: ${PATHS.DOCS}/[file]
|
|
4060
|
-
Ready for ${AGENT_NAMES.REVIEWER} verification
|
|
4061
|
-
\`\`\`
|
|
4062
|
-
${PROMPT_TAGS.QUALITY_CHECKLIST.close}`;
|
|
3800
|
+
// src/agents/prompts/04_execution/agents/execution_commander.ts
|
|
3801
|
+
var init_execution_commander = __esm({
|
|
3802
|
+
"src/agents/prompts/04_execution/agents/execution_commander.ts"() {
|
|
3803
|
+
"use strict";
|
|
4063
3804
|
}
|
|
4064
3805
|
});
|
|
4065
3806
|
|
|
4066
|
-
// src/agents/prompts/
|
|
3807
|
+
// src/agents/prompts/04_execution/index.ts
|
|
4067
3808
|
var init_execution = __esm({
|
|
4068
|
-
"src/agents/prompts/
|
|
3809
|
+
"src/agents/prompts/04_execution/index.ts"() {
|
|
4069
3810
|
"use strict";
|
|
4070
|
-
|
|
4071
|
-
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4078
|
-
|
|
3811
|
+
init_execution_quality();
|
|
3812
|
+
init_execution_error_handling();
|
|
3813
|
+
init_execution_delegation();
|
|
3814
|
+
init_execution_file_assignment();
|
|
3815
|
+
init_execution_workflow();
|
|
3816
|
+
init_execution_core();
|
|
3817
|
+
init_execution_strategy();
|
|
3818
|
+
init_execution_tdd();
|
|
3819
|
+
init_execution_isolation();
|
|
3820
|
+
init_execution_hyper_parallel();
|
|
3821
|
+
init_execution_worker();
|
|
3822
|
+
init_execution_commander();
|
|
3823
|
+
}
|
|
3824
|
+
});
|
|
3825
|
+
|
|
3826
|
+
// src/agents/prompts/05_verification/verification_evidence.ts
|
|
3827
|
+
var EVIDENCE_FORMAT;
|
|
3828
|
+
var init_verification_evidence = __esm({
|
|
3829
|
+
"src/agents/prompts/05_verification/verification_evidence.ts"() {
|
|
3830
|
+
"use strict";
|
|
3831
|
+
init_shared();
|
|
3832
|
+
EVIDENCE_FORMAT = `${PROMPT_TAGS.OUTPUT_FORMAT.open}
|
|
3833
|
+
VERIFICATION: T[N]
|
|
3834
|
+
|
|
3835
|
+
## Pass Example:
|
|
3836
|
+
PASS
|
|
3837
|
+
Evidence:
|
|
3838
|
+
- lsp_diagnostics: clean
|
|
3839
|
+
- build: pass
|
|
3840
|
+
- tests: 15 passed
|
|
3841
|
+
- docs match: .opencode/docs/api.md
|
|
3842
|
+
|
|
3843
|
+
## Fail Example:
|
|
3844
|
+
FAIL
|
|
3845
|
+
Issue: Tests failing - 2 failed, 13 passed
|
|
3846
|
+
Fix: Check src/api.ts line 45, missing null check
|
|
3847
|
+
Action: ${AGENT_NAMES.WORKER} to fix, then re-verify
|
|
3848
|
+
${PROMPT_TAGS.OUTPUT_FORMAT.close}`;
|
|
4079
3849
|
}
|
|
4080
3850
|
});
|
|
4081
3851
|
|
|
4082
|
-
// src/agents/prompts/
|
|
4083
|
-
var
|
|
4084
|
-
var
|
|
4085
|
-
"src/agents/prompts/
|
|
3852
|
+
// src/agents/prompts/05_verification/verification_sync_check.ts
|
|
3853
|
+
var REVIEWER_SYNC_VERIFICATION;
|
|
3854
|
+
var init_verification_sync_check = __esm({
|
|
3855
|
+
"src/agents/prompts/05_verification/verification_sync_check.ts"() {
|
|
4086
3856
|
"use strict";
|
|
4087
3857
|
init_shared();
|
|
4088
|
-
|
|
4089
|
-
|
|
3858
|
+
REVIEWER_SYNC_VERIFICATION = `${PROMPT_TAGS.SYNC_VERIFICATION.open}
|
|
3859
|
+
## FILE SYNC VERIFICATION
|
|
4090
3860
|
|
|
4091
|
-
|
|
4092
|
-
Read the project directly - this is faster and cheaper than delegating to parallel scouts:
|
|
4093
|
-
1. **Read** project structure, config files, and documentation directly.
|
|
4094
|
-
2. **Document** all findings to \`${PATHS.CONTEXT}\`.
|
|
4095
|
-
3. **Verify** findings against existing codebase.
|
|
3861
|
+
After integration, verify all files are properly synchronized.
|
|
4096
3862
|
|
|
4097
|
-
|
|
3863
|
+
### Sync Check Areas
|
|
4098
3864
|
|
|
4099
|
-
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
find . -maxdepth 1 -type f # Root files
|
|
4105
|
-
\`\`\`
|
|
3865
|
+
#### 1. Import/Export Consistency
|
|
3866
|
+
Run the project's **build command** and check for:
|
|
3867
|
+
- Missing imports/includes
|
|
3868
|
+
- Missing exports/declarations
|
|
3869
|
+
- Broken dependencies
|
|
4106
3870
|
|
|
3871
|
+
#### 2. Type/Interface Consistency
|
|
3872
|
+
Run the project's **type check command** (if applicable) and check for:
|
|
3873
|
+
- Type mismatches across files
|
|
3874
|
+
- Interface implementation errors
|
|
3875
|
+
- Signature mismatches
|
|
4107
3876
|
|
|
4108
|
-
|
|
4109
|
-
-
|
|
4110
|
-
-
|
|
4111
|
-
- Build artifacts (dist/, build/, target/, out/, bin/)
|
|
4112
|
-
- Documentation (docs/, doc/, README*, CONTRIBUTING*, CHANGELOG*)
|
|
4113
|
-
- Configuration (hidden files, *.config.*, *.json, *.yaml, *.toml)
|
|
3877
|
+
#### 3. Interface Implementation
|
|
3878
|
+
- Check implemented interfaces match declarations
|
|
3879
|
+
- Verify function signatures match calls
|
|
4114
3880
|
|
|
4115
|
-
|
|
4116
|
-
|
|
3881
|
+
#### 4. Shared State Consistency
|
|
3882
|
+
- Check constants used across files
|
|
3883
|
+
- Verify shared types are consistent
|
|
4117
3884
|
|
|
4118
|
-
|
|
4119
|
-
|----------------|-------------------|
|
|
4120
|
-
| package.json, tsconfig.json | Node.js / TypeScript |
|
|
4121
|
-
| Cargo.toml, Cargo.lock | Rust |
|
|
4122
|
-
| go.mod, go.sum | Go |
|
|
4123
|
-
| requirements.txt, pyproject.toml, setup.py | Python |
|
|
4124
|
-
| pom.xml, build.gradle | Java / JVM |
|
|
4125
|
-
| Gemfile, *.rb | Ruby |
|
|
4126
|
-
| composer.json | PHP |
|
|
4127
|
-
| CMakeLists.txt, Makefile | C/C++ |
|
|
4128
|
-
| *.csproj, *.sln | .NET / C# |
|
|
4129
|
-
| pubspec.yaml | Dart / Flutter |
|
|
3885
|
+
---
|
|
4130
3886
|
|
|
4131
|
-
|
|
4132
|
-
- Build commands
|
|
4133
|
-
- Test commands
|
|
4134
|
-
- Entry points
|
|
4135
|
-
- Dependencies
|
|
3887
|
+
## ISSUE MANAGEMENT RULES (CRITICAL)
|
|
4136
3888
|
|
|
4137
|
-
|
|
4138
|
-
|
|
4139
|
-
|
|
4140
|
-
|
|
4141
|
-
ls kubernetes/ k8s/ helm/ 2>/dev/null
|
|
3889
|
+
### ${PATHS.SYNC_ISSUES} Contains UNRESOLVED ONLY
|
|
3890
|
+
- **Delete resolved issues immediately** (keep file clean)
|
|
3891
|
+
- **Keep only unresolved** (only what ${AGENT_NAMES.COMMANDER} needs to read)
|
|
3892
|
+
- **Summarize if too long** (archive old issues)
|
|
4142
3893
|
|
|
4143
|
-
|
|
4144
|
-
|
|
3894
|
+
### Issue Format (Minimal)
|
|
3895
|
+
\`\`\`markdown
|
|
3896
|
+
# Sync Issues (Unresolved Only)
|
|
4145
3897
|
|
|
4146
|
-
|
|
4147
|
-
|
|
4148
|
-
|
|
3898
|
+
## ${ID_PREFIX.SYNC_ISSUE}N
|
|
3899
|
+
- Severity: ${WORK_STATUS.SEVERITY.HIGH}
|
|
3900
|
+
- Files: src/file1.ts \u2194 src/file2.ts
|
|
3901
|
+
- Problem: [concise description]
|
|
3902
|
+
- Fix: [specific solution]
|
|
3903
|
+
- Status: ${WORK_STATUS.STATUS.PENDING}
|
|
4149
3904
|
\`\`\`
|
|
4150
3905
|
|
|
4151
|
-
|
|
3906
|
+
### After Fix Verification
|
|
3907
|
+
When re-verifying after fixes:
|
|
3908
|
+
1. Check if issue is resolved
|
|
3909
|
+
2. If resolved: **DELETE the issue from ${PATHS.SYNC_ISSUES}**
|
|
3910
|
+
3. If not resolved: Update issue status, add notes
|
|
3911
|
+
4. Keep file minimal
|
|
3912
|
+
|
|
3913
|
+
---
|
|
3914
|
+
|
|
3915
|
+
### Loop Continuation
|
|
3916
|
+
If sync issues exist:
|
|
3917
|
+
1. Write ONLY unresolved issues to ${PATHS.SYNC_ISSUES}
|
|
3918
|
+
2. Delete resolved issues from file
|
|
3919
|
+
3. Update ${PATHS.WORK_LOG} with required rework
|
|
3920
|
+
4. Report status to ${AGENT_NAMES.COMMANDER}
|
|
3921
|
+
|
|
3922
|
+
### CRITICAL:
|
|
3923
|
+
- Always check sync AFTER integration tests
|
|
3924
|
+
- DELETE resolved issues immediately
|
|
3925
|
+
- Keep ${PATHS.SYNC_ISSUES} as short as possible
|
|
3926
|
+
- Ensure ${AGENT_NAMES.COMMANDER} only sees what needs fixing
|
|
3927
|
+
|
|
3928
|
+
${PROMPT_TAGS.SYNC_VERIFICATION.close}`;
|
|
3929
|
+
}
|
|
3930
|
+
});
|
|
3931
|
+
|
|
3932
|
+
// src/agents/prompts/05_verification/verification_integration.ts
|
|
3933
|
+
var REVIEWER_INTEGRATION_TESTING;
|
|
3934
|
+
var init_verification_integration = __esm({
|
|
3935
|
+
"src/agents/prompts/05_verification/verification_integration.ts"() {
|
|
3936
|
+
"use strict";
|
|
3937
|
+
init_shared();
|
|
3938
|
+
REVIEWER_INTEGRATION_TESTING = `${PROMPT_TAGS.INTEGRATION_TESTING.open}
|
|
3939
|
+
## INTEGRATION TESTING (Full System)
|
|
3940
|
+
|
|
3941
|
+
### Scope
|
|
3942
|
+
${AGENT_NAMES.REVIEWER} handles ALL integration levels:
|
|
3943
|
+
- **Module Level**: Cross-file imports, shared types, interface contracts.
|
|
3944
|
+
- **System Level**: Multi-module interactions, comprehensive E2E verification.
|
|
3945
|
+
- **Environment**: Build systems, runtime configurations, deployment readiness.
|
|
3946
|
+
|
|
3947
|
+
### Verification Mandate
|
|
3948
|
+
As the **Final Quality Gate**, you are responsible for ensuring the system works as a cohesive whole.
|
|
3949
|
+
|
|
3950
|
+
### Integration Workflow
|
|
3951
|
+
|
|
3952
|
+
#### Step 1: Check Dependencies
|
|
3953
|
+
- Verify all imports work across the entire project.
|
|
3954
|
+
- Ensure shared types are consistent and exported correctly.
|
|
3955
|
+
|
|
3956
|
+
#### Step 2: System Build & Test
|
|
3957
|
+
- Run the full project build command (e.g., \`npm run build\`).
|
|
3958
|
+
- Execute the complete test suite including E2E tests.
|
|
3959
|
+
|
|
3960
|
+
#### Step 3: Record Sync Issues
|
|
3961
|
+
If any regressions or integration failures are found, document them in ${PATHS.SYNC_ISSUES} for immediate resolution.
|
|
3962
|
+
|
|
3963
|
+
### Final Verification Gate
|
|
3964
|
+
When instructed by ${AGENT_NAMES.COMMANDER} for a "${VERIFICATION_SIGNALS.FINAL_PASS}":
|
|
3965
|
+
1. Check the ENTIRE hierarchical TODO tree.
|
|
3966
|
+
2. Ensure every task has evidence of success.
|
|
3967
|
+
3. Mark high-level Tasks/Milestones as [x] only after comprehensive proof.
|
|
3968
|
+
|
|
3969
|
+
### After Verification
|
|
3970
|
+
1. Mark [x] for reviewed items in TODO.
|
|
3971
|
+
2. Provide a definitive "PASSED" or "FAILED" status to ${AGENT_NAMES.COMMANDER}.
|
|
3972
|
+
|
|
3973
|
+
${PROMPT_TAGS.INTEGRATION_TESTING.close}`;
|
|
3974
|
+
}
|
|
3975
|
+
});
|
|
3976
|
+
|
|
3977
|
+
// src/agents/prompts/05_verification/verification_sync_handling.ts
|
|
3978
|
+
var COMMANDER_SYNC_HANDLING;
|
|
3979
|
+
var init_verification_sync_handling = __esm({
|
|
3980
|
+
"src/agents/prompts/05_verification/verification_sync_handling.ts"() {
|
|
3981
|
+
"use strict";
|
|
3982
|
+
init_shared();
|
|
3983
|
+
COMMANDER_SYNC_HANDLING = `${PROMPT_TAGS.SYNC_ISSUE_HANDLING.open}
|
|
3984
|
+
## SYNC ISSUE HANDLING
|
|
3985
|
+
|
|
3986
|
+
When ${AGENT_NAMES.REVIEWER} reports sync issues, YOU must direct fixes.
|
|
3987
|
+
|
|
3988
|
+
### Step 1: Read Sync Issues
|
|
4152
3989
|
\`\`\`bash
|
|
4153
|
-
|
|
3990
|
+
cat ${PATHS.SYNC_ISSUES}
|
|
4154
3991
|
\`\`\`
|
|
4155
|
-
- If ${PATHS.OPENCODE}/ exists \u2192 ASK user to continue or start fresh
|
|
4156
|
-
- If not \u2192 Create fresh context
|
|
4157
3992
|
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
3993
|
+
### Step 2: Analyze Each Issue
|
|
3994
|
+
For each ${ID_PREFIX.SYNC_ISSUE}N issue:
|
|
3995
|
+
- Which files are involved?
|
|
3996
|
+
- What's the root cause?
|
|
3997
|
+
- What's the fix?
|
|
4161
3998
|
|
|
4162
|
-
|
|
4163
|
-
|
|
4164
|
-
- Runtime: [DETECTED version if available]
|
|
4165
|
-
- Build: [DETECTED build command]
|
|
4166
|
-
- Test: [DETECTED test command]
|
|
4167
|
-
- Package Manager: [DETECTED from lockfiles]
|
|
3999
|
+
### Step 3: Instruct Planner
|
|
4000
|
+
Delegate to ${AGENT_NAMES.PLANNER} with SPECIFIC instructions:
|
|
4168
4001
|
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
|
|
4174
|
-
|
|
4002
|
+
\`\`\`
|
|
4003
|
+
${TOOL_NAMES.DELEGATE_TASK}(
|
|
4004
|
+
task: "Update TODO for sync fix ${ID_PREFIX.SYNC_ISSUE}1",
|
|
4005
|
+
agent: ${AGENT_NAMES.PLANNER},
|
|
4006
|
+
instructions: "
|
|
4007
|
+
Read ${PATHS.SYNC_ISSUES} for ${ID_PREFIX.SYNC_ISSUE}1.
|
|
4008
|
+
Add FIX tasks for: src/auth/login.ts, src/api/users.ts.
|
|
4009
|
+
Issue: Import mismatch - login.ts exports 'login' but users.ts imports 'authenticate'.
|
|
4010
|
+
Fix: Update users.ts to import 'login' instead of 'authenticate'.
|
|
4011
|
+
Update ${PATHS.WORK_LOG} file status.
|
|
4012
|
+
"
|
|
4013
|
+
)
|
|
4014
|
+
\`\`\`
|
|
4175
4015
|
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
- Orchestration: [None / K8s / Docker Compose]
|
|
4179
|
-
- CI/CD: [DETECTED from config files]
|
|
4180
|
-
- Cloud: [DETECTED or None]
|
|
4016
|
+
### Step 4: Instruct ${AGENT_NAMES.WORKER}s
|
|
4017
|
+
After ${AGENT_NAMES.PLANNER} updates ${PATHS.TODO}, delegate fixes:
|
|
4181
4018
|
|
|
4182
|
-
|
|
4183
|
-
|
|
4184
|
-
|
|
4185
|
-
|
|
4186
|
-
|
|
4019
|
+
\`\`\`
|
|
4020
|
+
${TOOL_NAMES.DELEGATE_TASK}(
|
|
4021
|
+
task: "Fix ${ID_PREFIX.SYNC_ISSUE}1 in src/api/users.ts",
|
|
4022
|
+
agent: ${AGENT_NAMES.WORKER},
|
|
4023
|
+
file: "src/api/users.ts",
|
|
4024
|
+
instructions: "
|
|
4025
|
+
Read ${PATHS.SYNC_ISSUES} ${ID_PREFIX.SYNC_ISSUE}1.
|
|
4026
|
+
Read ${PATHS.WORK_LOG} for context.
|
|
4027
|
+
Fix: Change 'import { authenticate }' to 'import { login }'.
|
|
4028
|
+
Run isolated test.
|
|
4029
|
+
Update ${PATHS.WORK_LOG}.
|
|
4030
|
+
",
|
|
4031
|
+
background: true
|
|
4032
|
+
)
|
|
4033
|
+
\`\`\`
|
|
4187
4034
|
|
|
4188
|
-
|
|
4189
|
-
|
|
4190
|
-
- Imports: [relative / absolute / aliases]
|
|
4191
|
-
- Error handling: [exceptions / Result type / error codes]
|
|
4192
|
-
- Testing: [unit / integration / e2e patterns]
|
|
4035
|
+
### Step 5: Invoke ${AGENT_NAMES.REVIEWER} Again
|
|
4036
|
+
After all fix ${AGENT_NAMES.WORKER}s complete:
|
|
4193
4037
|
|
|
4194
|
-
|
|
4195
|
-
|
|
4038
|
+
\`\`\`
|
|
4039
|
+
${TOOL_NAMES.DELEGATE_TASK}(
|
|
4040
|
+
task: "Re-verify after ${ID_PREFIX.SYNC_ISSUE}1 fixes",
|
|
4041
|
+
agent: ${AGENT_NAMES.REVIEWER},
|
|
4042
|
+
instructions: "
|
|
4043
|
+
Verify ${ID_PREFIX.SYNC_ISSUE}1 is resolved.
|
|
4044
|
+
Run integration tests.
|
|
4045
|
+
Clear resolved issues from ${PATHS.SYNC_ISSUES}.
|
|
4046
|
+
Update ${PATHS.INTEGRATION_STATUS}.
|
|
4047
|
+
"
|
|
4048
|
+
)
|
|
4196
4049
|
\`\`\`
|
|
4197
4050
|
|
|
4198
|
-
|
|
4199
|
-
|
|
4200
|
-
|
|
4201
|
-
|
|
4202
|
-
|
|
4203
|
-
|
|
4051
|
+
### Communication Flow
|
|
4052
|
+
\`\`\`
|
|
4053
|
+
${AGENT_NAMES.COMMANDER}: "${AGENT_NAMES.PLANNER}, sync issue found. Update TODO"
|
|
4054
|
+
\u2193
|
|
4055
|
+
${AGENT_NAMES.PLANNER}: (Add FIX task to ${PATHS.TODO}, update ${PATHS.WORK_LOG})
|
|
4056
|
+
\u2193
|
|
4057
|
+
${AGENT_NAMES.COMMANDER}: "${AGENT_NAMES.WORKER}, fix this file like this" (Multiple ${AGENT_NAMES.WORKER}s in parallel)
|
|
4058
|
+
\u2193
|
|
4059
|
+
${AGENT_NAMES.WORKER}s: (Fix each file + unit test + update ${PATHS.WORK_LOG})
|
|
4060
|
+
\u2193
|
|
4061
|
+
${AGENT_NAMES.COMMANDER}: "${AGENT_NAMES.REVIEWER}, verify again"
|
|
4062
|
+
\u2193
|
|
4063
|
+
${AGENT_NAMES.REVIEWER}: (Integration test + sync check + clear ${PATHS.SYNC_ISSUES})
|
|
4064
|
+
\`\`\`
|
|
4065
|
+
|
|
4066
|
+
### CRITICAL:
|
|
4067
|
+
- ALWAYS read ${PATHS.SYNC_ISSUES} at loop start
|
|
4068
|
+
- NEVER skip Planner when fixing - TODO must be updated
|
|
4069
|
+
- ALWAYS include specific instructions in ${TOOL_NAMES.DELEGATE_TASK}
|
|
4070
|
+
- Workers need: file path + issue ID + exact fix instructions
|
|
4071
|
+
${PROMPT_TAGS.SYNC_ISSUE_HANDLING.close}`;
|
|
4204
4072
|
}
|
|
4205
4073
|
});
|
|
4206
4074
|
|
|
4207
|
-
// src/agents/prompts/
|
|
4208
|
-
var
|
|
4209
|
-
var
|
|
4210
|
-
"src/agents/prompts/
|
|
4075
|
+
// src/agents/prompts/05_verification/verification_strategy.ts
|
|
4076
|
+
var VERIFICATION_REQUIREMENTS;
|
|
4077
|
+
var init_verification_strategy = __esm({
|
|
4078
|
+
"src/agents/prompts/05_verification/verification_strategy.ts"() {
|
|
4211
4079
|
"use strict";
|
|
4212
4080
|
init_shared();
|
|
4213
|
-
|
|
4214
|
-
|
|
4081
|
+
VERIFICATION_REQUIREMENTS = `${PROMPT_TAGS.VERIFICATION.open}
|
|
4082
|
+
VERIFICATION CHECKLIST
|
|
4215
4083
|
|
|
4216
|
-
|
|
4217
|
-
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
\u2502 # - Unit test completion records
|
|
4223
|
-
\u2502 # - Pending integration items
|
|
4224
|
-
\u251C\u2500\u2500 ${PATHS.UNIT_TESTS.split("/").pop()}/ - Unit test records (preserved after deletion)
|
|
4225
|
-
\u2502 \u2514\u2500\u2500 [timestamp]-[file].md # Test content, results, deleted test code
|
|
4226
|
-
\u251C\u2500\u2500 ${PATHS.SYNC_ISSUES.split("/").pop()} - File sync issues (Reviewer writes)
|
|
4227
|
-
\u251C\u2500\u2500 ${PATHS.INTEGRATION_STATUS.split("/").pop()} - Integration test results & sync status
|
|
4228
|
-
\u251C\u2500\u2500 ${PATHS.DOCS.split("/").pop()}/ - Cached documentation
|
|
4229
|
-
\u2514\u2500\u2500 ${PATHS.ARCHIVE.split("/").pop()}/ - Old context
|
|
4230
|
-
\`\`\`
|
|
4084
|
+
## Code Verification
|
|
4085
|
+
- [ ] lsp_diagnostics clean (no errors/warnings)
|
|
4086
|
+
- [ ] Build passes (use project's build command from ${PATHS.CONTEXT})
|
|
4087
|
+
- [ ] Tests pass (use project's test command from ${PATHS.CONTEXT})
|
|
4088
|
+
- [ ] No untyped variables (language-appropriate)
|
|
4089
|
+
- [ ] No debug logging left (console.log, print, etc.)
|
|
4231
4090
|
|
|
4091
|
+
## Documentation Verification
|
|
4092
|
+
- [ ] Implementation matches ${PATHS.DOCS}/
|
|
4093
|
+
- [ ] API usage matches official docs
|
|
4094
|
+
- [ ] Version compatibility confirmed
|
|
4232
4095
|
|
|
4096
|
+
## Security Verification
|
|
4097
|
+
- [ ] No hardcoded secrets/passwords/API keys
|
|
4098
|
+
- [ ] Input validation present
|
|
4099
|
+
- [ ] Error messages don't leak sensitive info
|
|
4233
4100
|
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
|
|
4101
|
+
ONLY mark complete after ALL checks pass!
|
|
4102
|
+
${PROMPT_TAGS.VERIFICATION.close}
|
|
4103
|
+
`;
|
|
4104
|
+
}
|
|
4105
|
+
});
|
|
4238
4106
|
|
|
4239
|
-
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4107
|
+
// src/agents/prompts/05_verification/verification_build.ts
|
|
4108
|
+
var init_verification_build = __esm({
|
|
4109
|
+
"src/agents/prompts/05_verification/verification_build.ts"() {
|
|
4110
|
+
"use strict";
|
|
4111
|
+
}
|
|
4112
|
+
});
|
|
4243
4113
|
|
|
4244
|
-
|
|
4114
|
+
// src/agents/prompts/05_verification/verification_test.ts
|
|
4115
|
+
var init_verification_test = __esm({
|
|
4116
|
+
"src/agents/prompts/05_verification/verification_test.ts"() {
|
|
4117
|
+
"use strict";
|
|
4118
|
+
}
|
|
4119
|
+
});
|
|
4120
|
+
|
|
4121
|
+
// src/agents/prompts/05_verification/verification_core.ts
|
|
4122
|
+
var init_verification_core = __esm({
|
|
4123
|
+
"src/agents/prompts/05_verification/verification_core.ts"() {
|
|
4124
|
+
"use strict";
|
|
4125
|
+
}
|
|
4126
|
+
});
|
|
4127
|
+
|
|
4128
|
+
// src/agents/prompts/05_verification/verification_async_monitoring.ts
|
|
4129
|
+
var REVIEWER_ASYNC_MONITORING;
|
|
4130
|
+
var init_verification_async_monitoring = __esm({
|
|
4131
|
+
"src/agents/prompts/05_verification/verification_async_monitoring.ts"() {
|
|
4132
|
+
"use strict";
|
|
4133
|
+
init_shared();
|
|
4134
|
+
REVIEWER_ASYNC_MONITORING = `${PROMPT_TAGS.ASYNC_MONITORING.open}
|
|
4135
|
+
## ASYNC PARALLEL WORK MONITORING
|
|
4136
|
+
|
|
4137
|
+
You monitor ${AGENT_NAMES.WORKER} sessions running in PARALLEL.
|
|
4138
|
+
Do NOT block - check status asynchronously and wait for completion.
|
|
4139
|
+
|
|
4140
|
+
### Monitoring Loop
|
|
4141
|
+
1. Read ${PATHS.WORK_LOG} to check active sessions:
|
|
4142
|
+
\`\`\`bash
|
|
4143
|
+
cat ${PATHS.WORK_LOG}
|
|
4144
|
+
\`\`\`
|
|
4145
|
+
|
|
4146
|
+
2. Identify completed units (marked [x] in Active Sessions)
|
|
4147
|
+
|
|
4148
|
+
3. For each completed unit:
|
|
4149
|
+
- Verify unit test record exists in ${PATHS.UNIT_TESTS}/
|
|
4150
|
+
- Check isolated test file was deleted
|
|
4151
|
+
- Verify implementation quality
|
|
4152
|
+
|
|
4153
|
+
4. Wait for ALL parallel workers to complete before integration test
|
|
4154
|
+
|
|
4155
|
+
### Status Check Pattern
|
|
4245
4156
|
\`\`\`markdown
|
|
4246
|
-
|
|
4157
|
+
## Current Status Check
|
|
4158
|
+
- Total active workers: [N]
|
|
4159
|
+
- Completed units: [list]
|
|
4160
|
+
- Still running: [list]
|
|
4161
|
+
- Ready for integration: [YES/NO]
|
|
4162
|
+
\`\`\`
|
|
4247
4163
|
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
-
|
|
4164
|
+
### Non-Blocking Wait Strategy
|
|
4165
|
+
1. If workers still running:
|
|
4166
|
+
- Report current status
|
|
4167
|
+
- DO NOT block or wait indefinitely
|
|
4168
|
+
- Schedule next check (${AGENT_NAMES.COMMANDER} will re-invoke)
|
|
4251
4169
|
|
|
4252
|
-
|
|
4253
|
-
|
|
4254
|
-
|
|
4255
|
-
| src/utils/hash.ts | ${ID_PREFIX.SESSION}2 | ${WORK_STATUS.TEST_RESULT.PASS} | 2026-01-18T09:00:00 |
|
|
4170
|
+
2. If all workers complete:
|
|
4171
|
+
- Proceed to integration testing
|
|
4172
|
+
- Update ${PATHS.INTEGRATION_STATUS}
|
|
4256
4173
|
|
|
4257
|
-
|
|
4258
|
-
|
|
4174
|
+
### ${PATHS.WORK_LOG.split("/").pop()} Interpretation
|
|
4175
|
+
\`\`\`markdown
|
|
4176
|
+
# Reading ${PATHS.WORK_LOG.split("/").pop()}:
|
|
4177
|
+
- [ ] = Still in progress, DO NOT verify yet
|
|
4178
|
+
- [x] = Unit complete, READY for verification
|
|
4259
4179
|
\`\`\`
|
|
4260
4180
|
|
|
4261
|
-
|
|
4262
|
-
-
|
|
4263
|
-
-
|
|
4264
|
-
-
|
|
4181
|
+
### CRITICAL:
|
|
4182
|
+
- NEVER verify a file before worker marks [x]
|
|
4183
|
+
- NEVER block waiting for workers
|
|
4184
|
+
- Always update ${PATHS.WORK_LOG} with your monitoring status
|
|
4185
|
+
|
|
4186
|
+
${PROMPT_TAGS.ASYNC_MONITORING.close}`;
|
|
4187
|
+
}
|
|
4188
|
+
});
|
|
4189
|
+
|
|
4190
|
+
// src/agents/prompts/05_verification/agents/verification_reviewer.ts
|
|
4191
|
+
var REVIEWER_VERIFICATION;
|
|
4192
|
+
var init_verification_reviewer = __esm({
|
|
4193
|
+
"src/agents/prompts/05_verification/agents/verification_reviewer.ts"() {
|
|
4194
|
+
"use strict";
|
|
4195
|
+
init_shared();
|
|
4196
|
+
REVIEWER_VERIFICATION = `${PROMPT_TAGS.VERIFICATION_PROCESS.open}
|
|
4197
|
+
**ADAPTIVE VERIFICATION PROCESS**
|
|
4198
|
+
|
|
4199
|
+
|
|
4200
|
+
## Step 1: Read Project Context
|
|
4201
|
+
\`\`\`bash
|
|
4202
|
+
cat ${PATHS.CONTEXT} # Get build/test commands
|
|
4203
|
+
\`\`\`
|
|
4204
|
+
- Identify the BUILD command for this project
|
|
4205
|
+
- Identify the TEST command for this project
|
|
4206
|
+
- Note any project-specific verification requirements
|
|
4207
|
+
|
|
4208
|
+
## Step 2: Static Analysis
|
|
4209
|
+
${TOOL_NAMES.LSP_DIAGNOSTICS} - Must show NO errors or warnings
|
|
4210
|
+
|
|
4211
|
+
## Step 3: Build Verification
|
|
4212
|
+
- Run the project's BUILD command (from ${PATHS.CONTEXT})
|
|
4213
|
+
- Must pass without errors
|
|
4214
|
+
- Watch for deprecation warnings
|
|
4215
|
+
|
|
4216
|
+
## Step 4: Test Verification
|
|
4217
|
+
- Run the project's TEST command (from ${PATHS.CONTEXT})
|
|
4218
|
+
- ALL tests must pass
|
|
4219
|
+
- New code MUST have corresponding tests
|
|
4220
|
+
|
|
4221
|
+
## Step 5: Documentation Compliance
|
|
4222
|
+
- Compare implementation with ${PATHS.DOCS}/
|
|
4223
|
+
- API usage must match official documentation
|
|
4224
|
+
- Check for breaking changes
|
|
4225
|
+
|
|
4226
|
+
## Step 6: Pattern Verification
|
|
4227
|
+
- Does the code follow EXISTING patterns in codebase?
|
|
4228
|
+
- Naming conventions consistent?
|
|
4229
|
+
- Error handling consistent?
|
|
4230
|
+
|
|
4231
|
+
## Step 7: Mark Complete (ONLY after ALL pass)
|
|
4232
|
+
In ${PATHS.TODO}:
|
|
4233
|
+
- [x] T1: [task] | verified | evidence: [build/test results]
|
|
4265
4234
|
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
- ${AGENT_NAMES.WORKER} updates ${PATHS.WORK_LOG} when starting/completing file work
|
|
4269
|
-
- ${AGENT_NAMES.REVIEWER} monitors ${PATHS.WORK_LOG} for completed units
|
|
4270
|
-
- ${AGENT_NAMES.COMMANDER} reads ${PATHS.WORK_LOG} in each loop iteration
|
|
4271
|
-
- ${PATHS.SYNC_ISSUES} = ${AGENT_NAMES.REVIEWER} writes issues for next iteration
|
|
4272
|
-
${PROMPT_TAGS.SHARED_WORKSPACE.close}
|
|
4273
|
-
`;
|
|
4235
|
+
**CRITICAL**: NEVER mark [x] without running ACTUAL verification commands!
|
|
4236
|
+
${PROMPT_TAGS.VERIFICATION_PROCESS.close}`;
|
|
4274
4237
|
}
|
|
4275
4238
|
});
|
|
4276
4239
|
|
|
4277
|
-
// src/agents/prompts/
|
|
4278
|
-
var
|
|
4279
|
-
|
|
4280
|
-
"src/agents/prompts/discovery/skills.ts"() {
|
|
4240
|
+
// src/agents/prompts/05_verification/agents/verification_commander.ts
|
|
4241
|
+
var init_verification_commander = __esm({
|
|
4242
|
+
"src/agents/prompts/05_verification/agents/verification_commander.ts"() {
|
|
4281
4243
|
"use strict";
|
|
4282
|
-
init_tags();
|
|
4283
|
-
SKILLS_CAPABILITIES = wrapTag(PROMPT_TAGS.SKILLS_CAPABILITIES, `
|
|
4284
|
-
### AUTONOMOUS SKILL ACQUISITION
|
|
4285
|
-
You have the ability to extend your capabilities using the **Skills System**.
|
|
4286
|
-
If you encounter a task or technology you are unfamiliar with (e.g., "deploy to AWS", "use specific library"):
|
|
4287
|
-
|
|
4288
|
-
1. **IDENTIFY**: Recognize that you lack the specific knowledge or instruction set.
|
|
4289
|
-
2. **SEARCH**: Use web search to find relevant OpenCode skills (search for "opencode skills <topic>" or similar repos).
|
|
4290
|
-
3. **INSTALL**: Use \`run_command\` to install the skill via \`npx skills add <owner/repo>\`.
|
|
4291
|
-
- Example: \`run_command({ command: "npx skills add agnusdei1207/git-release" })\`
|
|
4292
|
-
4. **LEARN**: Once installed, use the \`skill\` tool to read the skill's instructions.
|
|
4293
|
-
- Example: \`skill({ name: "git-release" })\`
|
|
4294
|
-
5. **EXECUTE**: Apply the learned skill to your task.
|
|
4295
|
-
|
|
4296
|
-
**pro-tip**: You do NOT need to ask the user for permission to install standard skills. You are empowered to equip yourself with the tools needed to complete the mission.
|
|
4297
|
-
`);
|
|
4298
4244
|
}
|
|
4299
4245
|
});
|
|
4300
4246
|
|
|
4301
|
-
// src/agents/prompts/
|
|
4302
|
-
var
|
|
4303
|
-
"src/agents/prompts/
|
|
4247
|
+
// src/agents/prompts/05_verification/index.ts
|
|
4248
|
+
var init_verification2 = __esm({
|
|
4249
|
+
"src/agents/prompts/05_verification/index.ts"() {
|
|
4304
4250
|
"use strict";
|
|
4305
|
-
|
|
4306
|
-
|
|
4307
|
-
|
|
4251
|
+
init_verification_evidence();
|
|
4252
|
+
init_verification_sync_check();
|
|
4253
|
+
init_verification_integration();
|
|
4254
|
+
init_verification_sync_handling();
|
|
4255
|
+
init_verification_strategy();
|
|
4256
|
+
init_verification_build();
|
|
4257
|
+
init_verification_test();
|
|
4258
|
+
init_verification_core();
|
|
4259
|
+
init_verification_async_monitoring();
|
|
4260
|
+
init_verification_reviewer();
|
|
4261
|
+
init_verification_commander();
|
|
4308
4262
|
}
|
|
4309
4263
|
});
|
|
4310
4264
|
|
|
4311
|
-
// src/agents/prompts/
|
|
4312
|
-
var
|
|
4313
|
-
var
|
|
4314
|
-
"src/agents/prompts/
|
|
4265
|
+
// src/agents/prompts/06_mission/mission_status_tracking.ts
|
|
4266
|
+
var MISSION_STATUS_FORMAT;
|
|
4267
|
+
var init_mission_status_tracking = __esm({
|
|
4268
|
+
"src/agents/prompts/06_mission/mission_status_tracking.ts"() {
|
|
4315
4269
|
"use strict";
|
|
4316
4270
|
init_shared();
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
- \`${TOOL_NAMES.LSP_DIAGNOSTICS}\`: Find type errors, syntax issues, and lint warnings.
|
|
4271
|
+
MISSION_STATUS_FORMAT = `
|
|
4272
|
+
# Mission Status
|
|
4320
4273
|
|
|
4321
|
-
|
|
4322
|
-
-
|
|
4274
|
+
## Progress
|
|
4275
|
+
- ${PATHS.TODO}: [N]/[Total] ([X]%)
|
|
4276
|
+
- Issues: [N] unresolved
|
|
4277
|
+
- ${AGENT_NAMES.WORKER}s: [N] active
|
|
4278
|
+
- Verification Strategy: [High-level plan from ${AGENT_NAMES.REVIEWER}]
|
|
4279
|
+
- Execution Status: ${WORK_STATUS.E2E_STATUS.NOT_STARTED} | ${WORK_STATUS.E2E_STATUS.RUNNING} | ${WORK_STATUS.E2E_STATUS.PASS} | ${WORK_STATUS.E2E_STATUS.FAIL}
|
|
4280
|
+
|
|
4281
|
+
## Current Phase
|
|
4282
|
+
[Phase Name]
|
|
4283
|
+
`;
|
|
4323
4284
|
}
|
|
4324
4285
|
});
|
|
4325
4286
|
|
|
4326
|
-
// src/agents/prompts/
|
|
4327
|
-
var
|
|
4328
|
-
var
|
|
4329
|
-
"src/agents/prompts/
|
|
4287
|
+
// src/agents/prompts/06_mission/mission_completion_conditions.ts
|
|
4288
|
+
var COMPLETION_CONDITIONS;
|
|
4289
|
+
var init_mission_completion_conditions = __esm({
|
|
4290
|
+
"src/agents/prompts/06_mission/mission_completion_conditions.ts"() {
|
|
4330
4291
|
"use strict";
|
|
4331
4292
|
init_shared();
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
- \`${TOOL_NAMES.AST_SEARCH}\`: Find code by syntax patterns (e.g., finding all function calls with specific arguments).
|
|
4335
|
-
- \`${TOOL_NAMES.AST_REPLACE}\`: Perform structural refactoring using syntax patterns.
|
|
4293
|
+
COMPLETION_CONDITIONS = `
|
|
4294
|
+
## \u26A0\uFE0F MISSION COMPLETION PROTOCOL
|
|
4336
4295
|
|
|
4337
|
-
**
|
|
4338
|
-
|
|
4339
|
-
- \`$$$ARGS\`: Matches multiple elements or statements.
|
|
4340
|
-
- \`___ \`: Wildcard for any node.
|
|
4296
|
+
> **IMPORTANT**: You (Commander) conclude the mission ONLY when every hierarchical task is verified.
|
|
4297
|
+
> You must rely on ${AGENT_NAMES.REVIEWER} for the final quality gate.
|
|
4341
4298
|
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4299
|
+
### When to Conclude
|
|
4300
|
+
|
|
4301
|
+
Finalize only when ALL of the following are true:
|
|
4302
|
+
- \u2705 **Hierarchical Completeness**: Every milestone, task, and sub-task in ${PATHS.TODO} is marked [x].
|
|
4303
|
+
- \u2705 **Verified Outcome**: You have received confirmation from ${AGENT_NAMES.REVIEWER} that all tests and builds pass.
|
|
4304
|
+
- \u2705 **Zero Regression**: No unresolved issues in ${PATHS.SYNC_ISSUES}.
|
|
4305
|
+
|
|
4306
|
+
### Final Verification Workflow
|
|
4307
|
+
|
|
4308
|
+
1. **Unit Reviews**: As Workers complete Grade 3 sub-tasks, delegate to ${AGENT_NAMES.REVIEWER} for individual file/module verification.
|
|
4309
|
+
2. **Integration Pass**: Once all segments are done, delegate a final "${VERIFICATION_SIGNALS.FINAL_PASS}" task to ${AGENT_NAMES.REVIEWER}.
|
|
4310
|
+
3. **Execution Gate**: The Reviewer MUST run the full build and E2E test suite.
|
|
4311
|
+
4. **Correction**: If Reviewer reports failure, address it immediately. Do not claim completion.
|
|
4312
|
+
|
|
4313
|
+
### Autonomous Loop Enforcement
|
|
4314
|
+
- THE SYSTEM MONITOR: An autonomous process monitors ${PATHS.TODO} and ${PATHS.CONTEXT}.
|
|
4315
|
+
- FORCED RESTART: If you attempt to stop while \`[ ]\` remain, the system will automatically inject a continuation prompt and increment the loop counter.
|
|
4316
|
+
- RESOLUTION: You are only "released" when the system verifies 100% check-off of the hierarchical plan.
|
|
4317
|
+
|
|
4318
|
+
### DO NOT
|
|
4319
|
+
- \u274C Declare mission success based on partial output.
|
|
4320
|
+
- \u274C Stop if any Grade 1, 2, or 3 items are still \`[ ]\`.
|
|
4321
|
+
- \u274C Skip the final integration build/test pass.
|
|
4322
|
+
`;
|
|
4345
4323
|
}
|
|
4346
4324
|
});
|
|
4347
4325
|
|
|
4348
|
-
// src/agents/prompts/
|
|
4349
|
-
var
|
|
4350
|
-
var
|
|
4351
|
-
"src/agents/prompts/
|
|
4326
|
+
// src/agents/prompts/06_mission/mission_loop_continuation.ts
|
|
4327
|
+
var COMMANDER_LOOP_CONTINUATION;
|
|
4328
|
+
var init_mission_loop_continuation = __esm({
|
|
4329
|
+
"src/agents/prompts/06_mission/mission_loop_continuation.ts"() {
|
|
4352
4330
|
"use strict";
|
|
4353
4331
|
init_shared();
|
|
4354
|
-
|
|
4355
|
-
##
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
|
|
4361
|
-
|
|
4362
|
-
|
|
4363
|
-
|
|
4364
|
-
|
|
4332
|
+
COMMANDER_LOOP_CONTINUATION = `${PROMPT_TAGS.LOOP_CONTINUATION.open}
|
|
4333
|
+
## LOOP CONTINUATION PROTOCOL
|
|
4334
|
+
|
|
4335
|
+
At the START of each loop iteration, ${AGENT_NAMES.COMMANDER} MUST read shared state:
|
|
4336
|
+
|
|
4337
|
+
### Step 1: Read Status Summary
|
|
4338
|
+
\`\`\`bash
|
|
4339
|
+
cat ${PATHS.STATUS} 2>/dev/null || echo "No status yet"
|
|
4340
|
+
cat ${PATHS.TODO}
|
|
4341
|
+
cat ${PATHS.SYNC_ISSUES} 2>/dev/null || echo "No sync issues"
|
|
4342
|
+
\`\`\`
|
|
4343
|
+
|
|
4344
|
+
---
|
|
4345
|
+
|
|
4346
|
+
## Decision Matrix
|
|
4347
|
+
|
|
4348
|
+
| ${PATHS.TODO} Status | ${PATHS.SYNC_ISSUES} | Action |
|
|
4349
|
+
|--------|--------|--------|
|
|
4350
|
+
| Incomplete items | Any | Continue work |
|
|
4351
|
+
| All [x] | Issues exist | Fix sync issues |
|
|
4352
|
+
| All [x] | Empty | Conclude mission |
|
|
4353
|
+
|
|
4354
|
+
### When All Work Complete
|
|
4355
|
+
When ALL TODO items are [x] and NO sync issues:
|
|
4356
|
+
\u2192 Ensure a final "${VERIFICATION_SIGNALS.FINAL_PASS}" task was performed by ${AGENT_NAMES.REVIEWER}
|
|
4357
|
+
\u2192 If all checks pass, you may conclude the mission
|
|
4358
|
+
\u2192 If any check fails, address issues and repeat verification
|
|
4359
|
+
|
|
4360
|
+
${PROMPT_TAGS.LOOP_CONTINUATION.close}
|
|
4361
|
+
|
|
4362
|
+
`;
|
|
4365
4363
|
}
|
|
4366
4364
|
});
|
|
4367
4365
|
|
|
4368
|
-
// src/agents/prompts/
|
|
4369
|
-
var
|
|
4370
|
-
var
|
|
4371
|
-
"src/agents/prompts/
|
|
4366
|
+
// src/agents/prompts/06_mission/mission_recovery.ts
|
|
4367
|
+
var COMMANDER_RECOVERY;
|
|
4368
|
+
var init_mission_recovery = __esm({
|
|
4369
|
+
"src/agents/prompts/06_mission/mission_recovery.ts"() {
|
|
4372
4370
|
"use strict";
|
|
4373
4371
|
init_shared();
|
|
4374
|
-
|
|
4375
|
-
##
|
|
4372
|
+
COMMANDER_RECOVERY = `${PROMPT_TAGS.RECOVERY.open}
|
|
4373
|
+
## RECOVERY: Agent Failure Handling
|
|
4376
4374
|
|
|
4377
|
-
|
|
4378
|
-
Use \`${TOOL_NAMES.LSP_DIAGNOSTICS}\` when verifying ${AGENT_NAMES.WORKER} output.
|
|
4375
|
+
When any agent fails, times out, or gets stuck:
|
|
4379
4376
|
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
2. Run \`${TOOL_NAMES.LSP_DIAGNOSTICS}({ file: "*" })\` on affected files
|
|
4383
|
-
3. Zero errors = ${STATUS_LABEL.PASS.toUpperCase()}, Errors = ${STATUS_LABEL.FAIL.toUpperCase()} + return to ${AGENT_NAMES.WORKER}
|
|
4377
|
+
### Level 1: ${RECOVERY_LEVEL.DECOMPOSE}
|
|
4378
|
+
- Task is too big \u2192 Split into smaller units (< ${LIMITS.TASK_TIME_LIMIT_MIN} min each)
|
|
4384
4379
|
|
|
4385
|
-
|
|
4386
|
-
-
|
|
4387
|
-
- ${OUTPUT_LABEL.WARNING} = ${STATUS_LABEL.WARNING.toUpperCase()} (note but proceed)
|
|
4388
|
-
- Clean = ${STATUS_LABEL.CLEAN.toUpperCase()} (approve)
|
|
4380
|
+
- Delegate smaller pieces to fresh agents
|
|
4381
|
+
- For repetitive changes, use ${TOOL_NAMES.SED_REPLACE} or shell tools
|
|
4389
4382
|
|
|
4390
|
-
|
|
4391
|
-
|
|
4392
|
-
|
|
4383
|
+
### Level 2: ${RECOVERY_LEVEL.RE_PLAN}
|
|
4384
|
+
If decomposition still fails:
|
|
4385
|
+
- Step back and re-analyze the problem
|
|
4386
|
+
- Write ${PATHS.OPENCODE}/escalation.md with analysis
|
|
4387
|
+
- Call ${AGENT_NAMES.PLANNER} to create new strategy
|
|
4388
|
+
- Try different approach
|
|
4389
|
+
|
|
4390
|
+
### Level 3: ${RECOVERY_LEVEL.ASK_USER}
|
|
4391
|
+
If re-planning fails or requires human judgment:
|
|
4392
|
+
- Clearly explain the situation and what was tried
|
|
4393
|
+
- Present 2-3 options with pros/cons
|
|
4394
|
+
- Ask user for direction
|
|
4395
|
+
- Proceed based on user input
|
|
4396
|
+
|
|
4397
|
+
### Decision Guide
|
|
4398
|
+
| Situation | Action |
|
|
4399
|
+
|-----------|--------|
|
|
4400
|
+
| Task too big | Level 1: ${RECOVERY_LEVEL.DECOMPOSE} |
|
|
4401
|
+
| Wrong approach | Level 2: ${RECOVERY_LEVEL.RE_PLAN} |
|
|
4402
|
+
| Ambiguous requirements | Level 3: ${RECOVERY_LEVEL.ASK_USER} |
|
|
4403
|
+
| Critical decision needed | Level 3: ${RECOVERY_LEVEL.ASK_USER} |
|
|
4404
|
+
| All attempts failed | Level 3: ${RECOVERY_LEVEL.ASK_USER} |
|
|
4405
|
+
|
|
4406
|
+
PRINCIPLE: ${RECOVERY_PRINCIPLE}
|
|
4407
|
+
${PROMPT_TAGS.RECOVERY.close}`;
|
|
4393
4408
|
}
|
|
4394
4409
|
});
|
|
4395
4410
|
|
|
4396
|
-
// src/agents/prompts/
|
|
4397
|
-
var
|
|
4398
|
-
|
|
4399
|
-
"src/agents/prompts/tools/worker-lsp.ts"() {
|
|
4411
|
+
// src/agents/prompts/06_mission/mission_lifecycle.ts
|
|
4412
|
+
var init_mission_lifecycle = __esm({
|
|
4413
|
+
"src/agents/prompts/06_mission/mission_lifecycle.ts"() {
|
|
4400
4414
|
"use strict";
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
## LSP Tools for Code Verification
|
|
4415
|
+
}
|
|
4416
|
+
});
|
|
4404
4417
|
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4418
|
+
// src/agents/prompts/06_mission/mission_core.ts
|
|
4419
|
+
var init_mission_core = __esm({
|
|
4420
|
+
"src/agents/prompts/06_mission/mission_core.ts"() {
|
|
4421
|
+
"use strict";
|
|
4422
|
+
}
|
|
4423
|
+
});
|
|
4409
4424
|
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4425
|
+
// src/agents/prompts/06_mission/agents/mission_commander.ts
|
|
4426
|
+
var init_mission_commander = __esm({
|
|
4427
|
+
"src/agents/prompts/06_mission/agents/mission_commander.ts"() {
|
|
4428
|
+
"use strict";
|
|
4429
|
+
}
|
|
4430
|
+
});
|
|
4414
4431
|
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
|
|
4419
|
-
|
|
4432
|
+
// src/agents/prompts/06_mission/index.ts
|
|
4433
|
+
var init_mission2 = __esm({
|
|
4434
|
+
"src/agents/prompts/06_mission/index.ts"() {
|
|
4435
|
+
"use strict";
|
|
4436
|
+
init_mission_status_tracking();
|
|
4437
|
+
init_mission_completion_conditions();
|
|
4438
|
+
init_mission_loop_continuation();
|
|
4439
|
+
init_mission_recovery();
|
|
4440
|
+
init_mission_lifecycle();
|
|
4441
|
+
init_mission_core();
|
|
4442
|
+
init_mission_commander();
|
|
4420
4443
|
}
|
|
4421
4444
|
});
|
|
4422
4445
|
|
|
4423
|
-
// src/agents/prompts/
|
|
4424
|
-
var
|
|
4425
|
-
|
|
4446
|
+
// src/agents/prompts/07_agents/commander/commander_role.ts
|
|
4447
|
+
var COMMANDER_ROLE;
|
|
4448
|
+
var init_commander_role = __esm({
|
|
4449
|
+
"src/agents/prompts/07_agents/commander/commander_role.ts"() {
|
|
4426
4450
|
"use strict";
|
|
4427
|
-
|
|
4428
|
-
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4451
|
+
init_shared();
|
|
4452
|
+
COMMANDER_ROLE = `${PROMPT_TAGS.ROLE.open}
|
|
4453
|
+
You are ${AGENT_NAMES.COMMANDER}. Autonomous mission controller.
|
|
4454
|
+
|
|
4455
|
+
## Core Philosophy: ${PHILOSOPHY_TAGLINE}
|
|
4456
|
+
(See CORE_PHILOSOPHY for full details - you orchestrate ALL phases)
|
|
4457
|
+
|
|
4458
|
+
## Your Identity
|
|
4459
|
+
- You ORCHESTRATE - explore, learn, delegate, verify
|
|
4460
|
+
- You NEVER stop until the mission is verified 100% complete
|
|
4461
|
+
- You READ and WRITE ${PATHS.CONTEXT} to share learnings
|
|
4462
|
+
- You ADAPT your approach to what the project requires
|
|
4463
|
+
|
|
4464
|
+
## \u{1F680} AUTONOMOUS EXECUTION MODE
|
|
4465
|
+
- Complete the ENTIRE mission without asking questions
|
|
4466
|
+
- Make decisions yourself - don't present options to user
|
|
4467
|
+
- If uncertain, make the BEST choice and proceed
|
|
4468
|
+
- Conclude ONLY after ${AGENT_NAMES.REVIEWER} verifies the full system
|
|
4469
|
+
- Only stop when everything is verified or truly blocked
|
|
4470
|
+
${PROMPT_TAGS.ROLE.close}`;
|
|
4432
4471
|
}
|
|
4433
4472
|
});
|
|
4434
4473
|
|
|
4435
|
-
// src/agents/prompts/
|
|
4474
|
+
// src/agents/prompts/07_agents/commander/commander_identity.ts
|
|
4436
4475
|
var COMMANDER_IDENTITY;
|
|
4437
|
-
var
|
|
4438
|
-
"src/agents/prompts/
|
|
4476
|
+
var init_commander_identity = __esm({
|
|
4477
|
+
"src/agents/prompts/07_agents/commander/commander_identity.ts"() {
|
|
4439
4478
|
"use strict";
|
|
4440
4479
|
init_shared();
|
|
4441
4480
|
COMMANDER_IDENTITY = `${PROMPT_TAGS.IDENTITY.open}
|
|
@@ -4448,10 +4487,10 @@ ${PROMPT_TAGS.IDENTITY.close}`;
|
|
|
4448
4487
|
}
|
|
4449
4488
|
});
|
|
4450
4489
|
|
|
4451
|
-
// src/agents/prompts/
|
|
4490
|
+
// src/agents/prompts/07_agents/commander/commander_forbidden.ts
|
|
4452
4491
|
var COMMANDER_FORBIDDEN;
|
|
4453
|
-
var
|
|
4454
|
-
"src/agents/prompts/
|
|
4492
|
+
var init_commander_forbidden = __esm({
|
|
4493
|
+
"src/agents/prompts/07_agents/commander/commander_forbidden.ts"() {
|
|
4455
4494
|
"use strict";
|
|
4456
4495
|
init_shared();
|
|
4457
4496
|
COMMANDER_FORBIDDEN = `${PROMPT_TAGS.FORBIDDEN_ACTIONS.open}
|
|
@@ -4485,10 +4524,10 @@ ${PROMPT_TAGS.FORBIDDEN_ACTIONS.close}`;
|
|
|
4485
4524
|
}
|
|
4486
4525
|
});
|
|
4487
4526
|
|
|
4488
|
-
// src/agents/prompts/
|
|
4527
|
+
// src/agents/prompts/07_agents/commander/commander_required.ts
|
|
4489
4528
|
var COMMANDER_REQUIRED;
|
|
4490
|
-
var
|
|
4491
|
-
"src/agents/prompts/
|
|
4529
|
+
var init_commander_required = __esm({
|
|
4530
|
+
"src/agents/prompts/07_agents/commander/commander_required.ts"() {
|
|
4492
4531
|
"use strict";
|
|
4493
4532
|
init_shared();
|
|
4494
4533
|
COMMANDER_REQUIRED = `${PROMPT_TAGS.REQUIRED_ACTIONS.open}
|
|
@@ -4502,57 +4541,25 @@ var init_required = __esm({
|
|
|
4502
4541
|
- MAXIMIZE parallel execution
|
|
4503
4542
|
- DELEGATE to specialized agents
|
|
4504
4543
|
|
|
4505
|
-
## Verification
|
|
4506
|
-
- ALWAYS verify with ${AGENT_NAMES.REVIEWER} before concluding
|
|
4507
|
-
- ALWAYS check ${PATHS.TODO} for incomplete items
|
|
4508
|
-
- ALWAYS save context to ${PATHS.CONTEXT}
|
|
4509
|
-
${PROMPT_TAGS.REQUIRED_ACTIONS.close}`;
|
|
4510
|
-
}
|
|
4511
|
-
});
|
|
4512
|
-
|
|
4513
|
-
// src/agents/prompts/roles/commander/role.ts
|
|
4514
|
-
var COMMANDER_ROLE;
|
|
4515
|
-
var init_role = __esm({
|
|
4516
|
-
"src/agents/prompts/roles/commander/role.ts"() {
|
|
4517
|
-
"use strict";
|
|
4518
|
-
init_shared();
|
|
4519
|
-
COMMANDER_ROLE = `${PROMPT_TAGS.ROLE.open}
|
|
4520
|
-
You are ${AGENT_NAMES.COMMANDER}. Autonomous mission controller.
|
|
4521
|
-
|
|
4522
|
-
## Core Philosophy: ${PHILOSOPHY_TAGLINE}
|
|
4523
|
-
(See CORE_PHILOSOPHY for full details - you orchestrate ALL phases)
|
|
4524
|
-
|
|
4525
|
-
## Your Identity
|
|
4526
|
-
- You ORCHESTRATE - explore, learn, delegate, verify
|
|
4527
|
-
- You NEVER stop until the mission is verified 100% complete
|
|
4528
|
-
- You READ and WRITE ${PATHS.CONTEXT} to share learnings
|
|
4529
|
-
- You ADAPT your approach to what the project requires
|
|
4530
|
-
|
|
4531
|
-
## \u{1F680} AUTONOMOUS EXECUTION MODE
|
|
4532
|
-
- Complete the ENTIRE mission without asking questions
|
|
4533
|
-
- Make decisions yourself - don't present options to user
|
|
4534
|
-
- If uncertain, make the BEST choice and proceed
|
|
4535
|
-
- Conclude ONLY after ${AGENT_NAMES.REVIEWER} verifies the full system
|
|
4536
|
-
- Only stop when everything is verified or truly blocked
|
|
4537
|
-
${PROMPT_TAGS.ROLE.close}`;
|
|
4544
|
+
## Verification
|
|
4545
|
+
- ALWAYS verify with ${AGENT_NAMES.REVIEWER} before concluding
|
|
4546
|
+
- ALWAYS check ${PATHS.TODO} for incomplete items
|
|
4547
|
+
- ALWAYS save context to ${PATHS.CONTEXT}
|
|
4548
|
+
${PROMPT_TAGS.REQUIRED_ACTIONS.close}`;
|
|
4538
4549
|
}
|
|
4539
4550
|
});
|
|
4540
4551
|
|
|
4541
|
-
// src/agents/prompts/
|
|
4542
|
-
var
|
|
4543
|
-
"src/agents/prompts/
|
|
4552
|
+
// src/agents/prompts/07_agents/commander/commander_mandate.ts
|
|
4553
|
+
var init_commander_mandate = __esm({
|
|
4554
|
+
"src/agents/prompts/07_agents/commander/commander_mandate.ts"() {
|
|
4544
4555
|
"use strict";
|
|
4545
|
-
init_identity();
|
|
4546
|
-
init_forbidden();
|
|
4547
|
-
init_required();
|
|
4548
|
-
init_role();
|
|
4549
4556
|
}
|
|
4550
4557
|
});
|
|
4551
4558
|
|
|
4552
|
-
// src/agents/prompts/
|
|
4559
|
+
// src/agents/prompts/07_agents/planner/planner_identity.ts
|
|
4553
4560
|
var PLANNER_ROLE;
|
|
4554
|
-
var
|
|
4555
|
-
"src/agents/prompts/
|
|
4561
|
+
var init_planner_identity = __esm({
|
|
4562
|
+
"src/agents/prompts/07_agents/planner/planner_identity.ts"() {
|
|
4556
4563
|
"use strict";
|
|
4557
4564
|
init_shared();
|
|
4558
4565
|
PLANNER_ROLE = `${PROMPT_TAGS.ROLE.open}
|
|
@@ -4570,10 +4577,10 @@ ${PROMPT_TAGS.ROLE.close}`;
|
|
|
4570
4577
|
}
|
|
4571
4578
|
});
|
|
4572
4579
|
|
|
4573
|
-
// src/agents/prompts/
|
|
4580
|
+
// src/agents/prompts/07_agents/planner/planner_forbidden.ts
|
|
4574
4581
|
var PLANNER_FORBIDDEN;
|
|
4575
|
-
var
|
|
4576
|
-
"src/agents/prompts/
|
|
4582
|
+
var init_planner_forbidden = __esm({
|
|
4583
|
+
"src/agents/prompts/07_agents/planner/planner_forbidden.ts"() {
|
|
4577
4584
|
"use strict";
|
|
4578
4585
|
init_shared();
|
|
4579
4586
|
PLANNER_FORBIDDEN = `${PROMPT_TAGS.FORBIDDEN_ACTIONS.open}
|
|
@@ -4608,10 +4615,10 @@ ${PROMPT_TAGS.FORBIDDEN_ACTIONS.close}`;
|
|
|
4608
4615
|
}
|
|
4609
4616
|
});
|
|
4610
4617
|
|
|
4611
|
-
// src/agents/prompts/
|
|
4618
|
+
// src/agents/prompts/07_agents/planner/planner_required.ts
|
|
4612
4619
|
var PLANNER_REQUIRED;
|
|
4613
|
-
var
|
|
4614
|
-
"src/agents/prompts/
|
|
4620
|
+
var init_planner_required = __esm({
|
|
4621
|
+
"src/agents/prompts/07_agents/planner/planner_required.ts"() {
|
|
4615
4622
|
"use strict";
|
|
4616
4623
|
init_shared();
|
|
4617
4624
|
PLANNER_REQUIRED = `${PROMPT_TAGS.REQUIRED_ACTIONS.open}
|
|
@@ -4634,20 +4641,17 @@ ${PROMPT_TAGS.REQUIRED_ACTIONS.close}`;
|
|
|
4634
4641
|
}
|
|
4635
4642
|
});
|
|
4636
4643
|
|
|
4637
|
-
// src/agents/prompts/
|
|
4638
|
-
var
|
|
4639
|
-
"src/agents/prompts/
|
|
4644
|
+
// src/agents/prompts/07_agents/planner/planner_mandate.ts
|
|
4645
|
+
var init_planner_mandate = __esm({
|
|
4646
|
+
"src/agents/prompts/07_agents/planner/planner_mandate.ts"() {
|
|
4640
4647
|
"use strict";
|
|
4641
|
-
init_identity2();
|
|
4642
|
-
init_forbidden2();
|
|
4643
|
-
init_required2();
|
|
4644
4648
|
}
|
|
4645
4649
|
});
|
|
4646
4650
|
|
|
4647
|
-
// src/agents/prompts/
|
|
4651
|
+
// src/agents/prompts/07_agents/worker/worker_identity.ts
|
|
4648
4652
|
var WORKER_ROLE;
|
|
4649
|
-
var
|
|
4650
|
-
"src/agents/prompts/
|
|
4653
|
+
var init_worker_identity = __esm({
|
|
4654
|
+
"src/agents/prompts/07_agents/worker/worker_identity.ts"() {
|
|
4651
4655
|
"use strict";
|
|
4652
4656
|
init_shared();
|
|
4653
4657
|
WORKER_ROLE = `${PROMPT_TAGS.ROLE.open}
|
|
@@ -4665,10 +4669,10 @@ ${PROMPT_TAGS.ROLE.close}`;
|
|
|
4665
4669
|
}
|
|
4666
4670
|
});
|
|
4667
4671
|
|
|
4668
|
-
// src/agents/prompts/
|
|
4672
|
+
// src/agents/prompts/07_agents/worker/worker_forbidden.ts
|
|
4669
4673
|
var WORKER_FORBIDDEN;
|
|
4670
|
-
var
|
|
4671
|
-
"src/agents/prompts/
|
|
4674
|
+
var init_worker_forbidden = __esm({
|
|
4675
|
+
"src/agents/prompts/07_agents/worker/worker_forbidden.ts"() {
|
|
4672
4676
|
"use strict";
|
|
4673
4677
|
init_shared();
|
|
4674
4678
|
WORKER_FORBIDDEN = `${PROMPT_TAGS.FORBIDDEN_ACTIONS.open}
|
|
@@ -4705,10 +4709,10 @@ ${PROMPT_TAGS.FORBIDDEN_ACTIONS.close}`;
|
|
|
4705
4709
|
}
|
|
4706
4710
|
});
|
|
4707
4711
|
|
|
4708
|
-
// src/agents/prompts/
|
|
4712
|
+
// src/agents/prompts/07_agents/worker/worker_required.ts
|
|
4709
4713
|
var WORKER_REQUIRED;
|
|
4710
|
-
var
|
|
4711
|
-
"src/agents/prompts/
|
|
4714
|
+
var init_worker_required = __esm({
|
|
4715
|
+
"src/agents/prompts/07_agents/worker/worker_required.ts"() {
|
|
4712
4716
|
"use strict";
|
|
4713
4717
|
init_shared();
|
|
4714
4718
|
WORKER_REQUIRED = `${PROMPT_TAGS.REQUIRED_ACTIONS.open}
|
|
@@ -4745,20 +4749,17 @@ ${PROMPT_TAGS.REQUIRED_ACTIONS.close}`;
|
|
|
4745
4749
|
}
|
|
4746
4750
|
});
|
|
4747
4751
|
|
|
4748
|
-
// src/agents/prompts/
|
|
4749
|
-
var
|
|
4750
|
-
"src/agents/prompts/
|
|
4752
|
+
// src/agents/prompts/07_agents/worker/worker_mandate.ts
|
|
4753
|
+
var init_worker_mandate = __esm({
|
|
4754
|
+
"src/agents/prompts/07_agents/worker/worker_mandate.ts"() {
|
|
4751
4755
|
"use strict";
|
|
4752
|
-
init_identity3();
|
|
4753
|
-
init_forbidden3();
|
|
4754
|
-
init_required3();
|
|
4755
4756
|
}
|
|
4756
4757
|
});
|
|
4757
4758
|
|
|
4758
|
-
// src/agents/prompts/
|
|
4759
|
+
// src/agents/prompts/07_agents/reviewer/reviewer_identity.ts
|
|
4759
4760
|
var REVIEWER_ROLE;
|
|
4760
|
-
var
|
|
4761
|
-
"src/agents/prompts/
|
|
4761
|
+
var init_reviewer_identity = __esm({
|
|
4762
|
+
"src/agents/prompts/07_agents/reviewer/reviewer_identity.ts"() {
|
|
4762
4763
|
"use strict";
|
|
4763
4764
|
init_shared();
|
|
4764
4765
|
REVIEWER_ROLE = `${PROMPT_TAGS.ROLE.open}
|
|
@@ -4794,10 +4795,10 @@ ${PROMPT_TAGS.ROLE.close}`;
|
|
|
4794
4795
|
}
|
|
4795
4796
|
});
|
|
4796
4797
|
|
|
4797
|
-
// src/agents/prompts/
|
|
4798
|
+
// src/agents/prompts/07_agents/reviewer/reviewer_forbidden.ts
|
|
4798
4799
|
var REVIEWER_FORBIDDEN;
|
|
4799
|
-
var
|
|
4800
|
-
"src/agents/prompts/
|
|
4800
|
+
var init_reviewer_forbidden = __esm({
|
|
4801
|
+
"src/agents/prompts/07_agents/reviewer/reviewer_forbidden.ts"() {
|
|
4801
4802
|
"use strict";
|
|
4802
4803
|
init_shared();
|
|
4803
4804
|
REVIEWER_FORBIDDEN = `${PROMPT_TAGS.FORBIDDEN_ACTIONS.open}
|
|
@@ -4831,10 +4832,10 @@ ${PROMPT_TAGS.FORBIDDEN_ACTIONS.close}`;
|
|
|
4831
4832
|
}
|
|
4832
4833
|
});
|
|
4833
4834
|
|
|
4834
|
-
// src/agents/prompts/
|
|
4835
|
+
// src/agents/prompts/07_agents/reviewer/reviewer_required.ts
|
|
4835
4836
|
var REVIEWER_REQUIRED;
|
|
4836
|
-
var
|
|
4837
|
-
"src/agents/prompts/
|
|
4837
|
+
var init_reviewer_required = __esm({
|
|
4838
|
+
"src/agents/prompts/07_agents/reviewer/reviewer_required.ts"() {
|
|
4838
4839
|
"use strict";
|
|
4839
4840
|
init_shared();
|
|
4840
4841
|
REVIEWER_REQUIRED = `${PROMPT_TAGS.REQUIRED_ACTIONS.open}
|
|
@@ -4858,13 +4859,158 @@ ${PROMPT_TAGS.REQUIRED_ACTIONS.close}
|
|
|
4858
4859
|
}
|
|
4859
4860
|
});
|
|
4860
4861
|
|
|
4861
|
-
// src/agents/prompts/
|
|
4862
|
-
var
|
|
4863
|
-
"src/agents/prompts/
|
|
4862
|
+
// src/agents/prompts/07_agents/reviewer/reviewer_mandate.ts
|
|
4863
|
+
var init_reviewer_mandate = __esm({
|
|
4864
|
+
"src/agents/prompts/07_agents/reviewer/reviewer_mandate.ts"() {
|
|
4865
|
+
"use strict";
|
|
4866
|
+
}
|
|
4867
|
+
});
|
|
4868
|
+
|
|
4869
|
+
// src/agents/prompts/08_tools/tools_core.ts
|
|
4870
|
+
var init_tools_core = __esm({
|
|
4871
|
+
"src/agents/prompts/08_tools/tools_core.ts"() {
|
|
4872
|
+
"use strict";
|
|
4873
|
+
}
|
|
4874
|
+
});
|
|
4875
|
+
|
|
4876
|
+
// src/agents/prompts/08_tools/tools_search.ts
|
|
4877
|
+
var SEARCH_TOOLS;
|
|
4878
|
+
var init_tools_search = __esm({
|
|
4879
|
+
"src/agents/prompts/08_tools/tools_search.ts"() {
|
|
4880
|
+
"use strict";
|
|
4881
|
+
init_shared();
|
|
4882
|
+
SEARCH_TOOLS = `${PROMPT_TAGS.TOOLS.open}
|
|
4883
|
+
## Research & Search Tools
|
|
4884
|
+
| Tool | Purpose | When |
|
|
4885
|
+
|------|---------|------|
|
|
4886
|
+
| ${TOOL_NAMES.WEBSEARCH} | Web search | Find docs, tutorials, solutions |
|
|
4887
|
+
| ${TOOL_NAMES.WEBFETCH} | Fetch URL | Read full content from URL |
|
|
4888
|
+
| ${TOOL_NAMES.CODESEARCH} | Search GitHub | Find code examples |
|
|
4889
|
+
| ${TOOL_NAMES.CACHE_DOCS} | Cache docs | Save research to .opencode/docs/ |
|
|
4890
|
+
| ${TOOL_NAMES.GREP_SEARCH} | Code search | Find patterns in codebase |
|
|
4891
|
+
| ${TOOL_NAMES.GLOB_SEARCH} | File search | Find files by pattern |
|
|
4892
|
+
${PROMPT_TAGS.TOOLS.close}`;
|
|
4893
|
+
}
|
|
4894
|
+
});
|
|
4895
|
+
|
|
4896
|
+
// src/agents/prompts/08_tools/tools_testing.ts
|
|
4897
|
+
var init_tools_testing = __esm({
|
|
4898
|
+
"src/agents/prompts/08_tools/tools_testing.ts"() {
|
|
4899
|
+
"use strict";
|
|
4900
|
+
}
|
|
4901
|
+
});
|
|
4902
|
+
|
|
4903
|
+
// src/agents/prompts/08_tools/tools_lsp.ts
|
|
4904
|
+
var SHARED_LSP_TOOLS;
|
|
4905
|
+
var init_tools_lsp = __esm({
|
|
4906
|
+
"src/agents/prompts/08_tools/tools_lsp.ts"() {
|
|
4907
|
+
"use strict";
|
|
4908
|
+
init_shared();
|
|
4909
|
+
SHARED_LSP_TOOLS = wrapTag(PROMPT_TAGS.LSP_TOOLS, `
|
|
4910
|
+
### LSP (Language Server Protocol) Tools
|
|
4911
|
+
- \`${TOOL_NAMES.LSP_DIAGNOSTICS}\`: Find type errors, syntax issues, and lint warnings.
|
|
4912
|
+
|
|
4913
|
+
**Rules**:
|
|
4914
|
+
- **Verification**: ALWAYS run \`${TOOL_NAMES.LSP_DIAGNOSTICS}({ file: "*" })\` before marking a task or TODO as complete.`);
|
|
4915
|
+
}
|
|
4916
|
+
});
|
|
4917
|
+
|
|
4918
|
+
// src/agents/prompts/08_tools/tools_ast.ts
|
|
4919
|
+
var SHARED_AST_TOOLS;
|
|
4920
|
+
var init_tools_ast = __esm({
|
|
4921
|
+
"src/agents/prompts/08_tools/tools_ast.ts"() {
|
|
4922
|
+
"use strict";
|
|
4923
|
+
init_shared();
|
|
4924
|
+
SHARED_AST_TOOLS = wrapTag(PROMPT_TAGS.AST_TOOLS, `
|
|
4925
|
+
### AST (Structural) Tools
|
|
4926
|
+
- \`${TOOL_NAMES.AST_SEARCH}\`: Find code by syntax patterns (e.g., finding all function calls with specific arguments).
|
|
4927
|
+
- \`${TOOL_NAMES.AST_REPLACE}\`: Perform structural refactoring using syntax patterns.
|
|
4928
|
+
|
|
4929
|
+
**Pattern Syntax**:
|
|
4930
|
+
- \`$VAR\`: Matches a single identifier/node.
|
|
4931
|
+
- \`$$$ARGS\`: Matches multiple elements or statements.
|
|
4932
|
+
- \`___ \`: Wildcard for any node.
|
|
4933
|
+
|
|
4934
|
+
**Usage Guidelines**:
|
|
4935
|
+
- Use **AST** when you need to find or change code based on its logical structure where regex is too blunt.
|
|
4936
|
+
- Always verify structural changes with \`${TOOL_NAMES.LSP_DIAGNOSTICS}\`.`);
|
|
4937
|
+
}
|
|
4938
|
+
});
|
|
4939
|
+
|
|
4940
|
+
// src/agents/prompts/08_tools/tools_code_editing.ts
|
|
4941
|
+
var init_tools_code_editing = __esm({
|
|
4942
|
+
"src/agents/prompts/08_tools/tools_code_editing.ts"() {
|
|
4943
|
+
"use strict";
|
|
4944
|
+
}
|
|
4945
|
+
});
|
|
4946
|
+
|
|
4947
|
+
// src/agents/prompts/08_tools/agents/tools_reviewer.ts
|
|
4948
|
+
var REVIEWER_LSP_TOOLS;
|
|
4949
|
+
var init_tools_reviewer = __esm({
|
|
4950
|
+
"src/agents/prompts/08_tools/agents/tools_reviewer.ts"() {
|
|
4951
|
+
"use strict";
|
|
4952
|
+
init_shared();
|
|
4953
|
+
REVIEWER_LSP_TOOLS = `<lsp_tools>
|
|
4954
|
+
## LSP Tools for Verification
|
|
4955
|
+
|
|
4956
|
+
**MANDATORY VERIFICATION TOOL**:
|
|
4957
|
+
Use \`${TOOL_NAMES.LSP_DIAGNOSTICS}\` when verifying ${AGENT_NAMES.WORKER} output.
|
|
4958
|
+
|
|
4959
|
+
**VERIFICATION WORKFLOW**:
|
|
4960
|
+
1. ${AGENT_NAMES.WORKER} claims completion
|
|
4961
|
+
2. Run \`${TOOL_NAMES.LSP_DIAGNOSTICS}({ file: "*" })\` on affected files
|
|
4962
|
+
3. Zero errors = ${STATUS_LABEL.PASS.toUpperCase()}, Errors = ${STATUS_LABEL.FAIL.toUpperCase()} + return to ${AGENT_NAMES.WORKER}
|
|
4963
|
+
|
|
4964
|
+
**OUTPUT INTERPRETATION**:
|
|
4965
|
+
- ${OUTPUT_LABEL.ERROR} = ${STATUS_LABEL.ERROR.toUpperCase()} (blocking)
|
|
4966
|
+
- ${OUTPUT_LABEL.WARNING} = ${STATUS_LABEL.WARNING.toUpperCase()} (note but proceed)
|
|
4967
|
+
- Clean = ${STATUS_LABEL.CLEAN.toUpperCase()} (approve)
|
|
4968
|
+
|
|
4969
|
+
**GATEKEEPER RULE**:
|
|
4970
|
+
Do NOT mark [x] in ${PATHS.TODO} without clean ${TOOL_NAMES.LSP_DIAGNOSTICS}.
|
|
4971
|
+
</lsp_tools>`;
|
|
4972
|
+
}
|
|
4973
|
+
});
|
|
4974
|
+
|
|
4975
|
+
// src/agents/prompts/08_tools/agents/tools_worker.ts
|
|
4976
|
+
var WORKER_LSP_TOOLS;
|
|
4977
|
+
var init_tools_worker = __esm({
|
|
4978
|
+
"src/agents/prompts/08_tools/agents/tools_worker.ts"() {
|
|
4979
|
+
"use strict";
|
|
4980
|
+
init_shared();
|
|
4981
|
+
WORKER_LSP_TOOLS = `<lsp_tools>
|
|
4982
|
+
## LSP Tools for Code Verification
|
|
4983
|
+
|
|
4984
|
+
**AVAILABLE TOOLS**:
|
|
4985
|
+
- \`${TOOL_NAMES.LSP_DIAGNOSTICS}\`: Get errors/warnings BEFORE marking work complete
|
|
4986
|
+
- \`${TOOL_NAMES.AST_SEARCH}\`: Structural code search for pattern matching
|
|
4987
|
+
- \`${TOOL_NAMES.AST_REPLACE}\`: Safe structural code refactoring
|
|
4988
|
+
|
|
4989
|
+
**WHEN TO USE**:
|
|
4990
|
+
1. After completing file edits \u2192 \`${TOOL_NAMES.LSP_DIAGNOSTICS}({ file: "your-file.ts" })\`
|
|
4991
|
+
2. Before marking TODO complete \u2192 \`${TOOL_NAMES.LSP_DIAGNOSTICS}({ file: "*" })\`
|
|
4992
|
+
3. For safe refactoring \u2192 \`${TOOL_NAMES.AST_REPLACE}\`
|
|
4993
|
+
|
|
4994
|
+
**VERIFICATION RULE**:
|
|
4995
|
+
- NEVER claim "done" without running \`${TOOL_NAMES.LSP_DIAGNOSTICS}\`
|
|
4996
|
+
- Zero errors required before completion
|
|
4997
|
+
- Warnings acceptable but should be noted
|
|
4998
|
+
</lsp_tools>`;
|
|
4999
|
+
}
|
|
5000
|
+
});
|
|
5001
|
+
|
|
5002
|
+
// src/agents/prompts/08_tools/index.ts
|
|
5003
|
+
var init_tools2 = __esm({
|
|
5004
|
+
"src/agents/prompts/08_tools/index.ts"() {
|
|
4864
5005
|
"use strict";
|
|
4865
|
-
|
|
4866
|
-
|
|
4867
|
-
|
|
5006
|
+
init_tools_core();
|
|
5007
|
+
init_tools_search();
|
|
5008
|
+
init_tools_testing();
|
|
5009
|
+
init_tools_lsp();
|
|
5010
|
+
init_tools_ast();
|
|
5011
|
+
init_tools_code_editing();
|
|
5012
|
+
init_tools_reviewer();
|
|
5013
|
+
init_tools_worker();
|
|
4868
5014
|
}
|
|
4869
5015
|
});
|
|
4870
5016
|
|
|
@@ -4873,16 +5019,30 @@ var init_prompts2 = __esm({
|
|
|
4873
5019
|
"src/agents/prompts/index.ts"() {
|
|
4874
5020
|
"use strict";
|
|
4875
5021
|
init_philosophy2();
|
|
4876
|
-
|
|
4877
|
-
|
|
5022
|
+
init_shared();
|
|
5023
|
+
init_discovery();
|
|
4878
5024
|
init_planning();
|
|
4879
5025
|
init_execution();
|
|
4880
|
-
|
|
5026
|
+
init_verification2();
|
|
5027
|
+
init_mission2();
|
|
5028
|
+
init_commander_role();
|
|
5029
|
+
init_commander_identity();
|
|
5030
|
+
init_commander_forbidden();
|
|
5031
|
+
init_commander_required();
|
|
5032
|
+
init_commander_mandate();
|
|
5033
|
+
init_planner_identity();
|
|
5034
|
+
init_planner_forbidden();
|
|
5035
|
+
init_planner_required();
|
|
5036
|
+
init_planner_mandate();
|
|
5037
|
+
init_worker_identity();
|
|
5038
|
+
init_worker_forbidden();
|
|
5039
|
+
init_worker_required();
|
|
5040
|
+
init_worker_mandate();
|
|
5041
|
+
init_reviewer_identity();
|
|
5042
|
+
init_reviewer_forbidden();
|
|
5043
|
+
init_reviewer_required();
|
|
5044
|
+
init_reviewer_mandate();
|
|
4881
5045
|
init_tools2();
|
|
4882
|
-
init_commander();
|
|
4883
|
-
init_planner();
|
|
4884
|
-
init_worker();
|
|
4885
|
-
init_reviewer();
|
|
4886
5046
|
}
|
|
4887
5047
|
});
|
|
4888
5048
|
|
|
@@ -4892,7 +5052,7 @@ __export(commander_exports, {
|
|
|
4892
5052
|
commander: () => commander
|
|
4893
5053
|
});
|
|
4894
5054
|
var systemPrompt, commander;
|
|
4895
|
-
var
|
|
5055
|
+
var init_commander = __esm({
|
|
4896
5056
|
"src/agents/commander.ts"() {
|
|
4897
5057
|
"use strict";
|
|
4898
5058
|
init_constants();
|
|
@@ -5794,15 +5954,15 @@ function mergeDefs(...defs) {
|
|
|
5794
5954
|
function cloneDef(schema) {
|
|
5795
5955
|
return mergeDefs(schema._zod.def);
|
|
5796
5956
|
}
|
|
5797
|
-
function getElementAtPath(obj,
|
|
5798
|
-
if (!
|
|
5957
|
+
function getElementAtPath(obj, path10) {
|
|
5958
|
+
if (!path10)
|
|
5799
5959
|
return obj;
|
|
5800
|
-
return
|
|
5960
|
+
return path10.reduce((acc, key) => acc?.[key], obj);
|
|
5801
5961
|
}
|
|
5802
5962
|
function promiseAllObject(promisesObj) {
|
|
5803
5963
|
const keys = Object.keys(promisesObj);
|
|
5804
|
-
const
|
|
5805
|
-
return Promise.all(
|
|
5964
|
+
const promises2 = keys.map((key) => promisesObj[key]);
|
|
5965
|
+
return Promise.all(promises2).then((results) => {
|
|
5806
5966
|
const resolvedObj = {};
|
|
5807
5967
|
for (let i = 0; i < keys.length; i++) {
|
|
5808
5968
|
resolvedObj[keys[i]] = results[i];
|
|
@@ -6158,11 +6318,11 @@ function aborted(x, startIndex = 0) {
|
|
|
6158
6318
|
}
|
|
6159
6319
|
return false;
|
|
6160
6320
|
}
|
|
6161
|
-
function prefixIssues(
|
|
6321
|
+
function prefixIssues(path10, issues) {
|
|
6162
6322
|
return issues.map((iss) => {
|
|
6163
6323
|
var _a;
|
|
6164
6324
|
(_a = iss).path ?? (_a.path = []);
|
|
6165
|
-
iss.path.unshift(
|
|
6325
|
+
iss.path.unshift(path10);
|
|
6166
6326
|
return iss;
|
|
6167
6327
|
});
|
|
6168
6328
|
}
|
|
@@ -6330,7 +6490,7 @@ function treeifyError(error45, _mapper) {
|
|
|
6330
6490
|
return issue2.message;
|
|
6331
6491
|
};
|
|
6332
6492
|
const result = { errors: [] };
|
|
6333
|
-
const processError = (error46,
|
|
6493
|
+
const processError = (error46, path10 = []) => {
|
|
6334
6494
|
var _a, _b;
|
|
6335
6495
|
for (const issue2 of error46.issues) {
|
|
6336
6496
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
@@ -6340,7 +6500,7 @@ function treeifyError(error45, _mapper) {
|
|
|
6340
6500
|
} else if (issue2.code === "invalid_element") {
|
|
6341
6501
|
processError({ issues: issue2.issues }, issue2.path);
|
|
6342
6502
|
} else {
|
|
6343
|
-
const fullpath = [...
|
|
6503
|
+
const fullpath = [...path10, ...issue2.path];
|
|
6344
6504
|
if (fullpath.length === 0) {
|
|
6345
6505
|
result.errors.push(mapper(issue2));
|
|
6346
6506
|
continue;
|
|
@@ -6372,8 +6532,8 @@ function treeifyError(error45, _mapper) {
|
|
|
6372
6532
|
}
|
|
6373
6533
|
function toDotPath(_path) {
|
|
6374
6534
|
const segs = [];
|
|
6375
|
-
const
|
|
6376
|
-
for (const seg of
|
|
6535
|
+
const path10 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
6536
|
+
for (const seg of path10) {
|
|
6377
6537
|
if (typeof seg === "number")
|
|
6378
6538
|
segs.push(`[${seg}]`);
|
|
6379
6539
|
else if (typeof seg === "symbol")
|
|
@@ -17487,7 +17647,7 @@ tool.schema = external_exports;
|
|
|
17487
17647
|
|
|
17488
17648
|
// src/agents/definitions.ts
|
|
17489
17649
|
init_constants();
|
|
17490
|
-
|
|
17650
|
+
init_commander();
|
|
17491
17651
|
|
|
17492
17652
|
// src/agents/subagents/planner.ts
|
|
17493
17653
|
init_constants();
|
|
@@ -18398,10 +18558,11 @@ var ConcurrencyController = class {
|
|
|
18398
18558
|
const streak = (this.successStreak.get(key) ?? 0) + 1;
|
|
18399
18559
|
this.successStreak.set(key, streak);
|
|
18400
18560
|
this.failureCount.set(key, 0);
|
|
18401
|
-
if (streak
|
|
18561
|
+
if (streak >= 3) {
|
|
18402
18562
|
const currentLimit = this.getConcurrencyLimit(key);
|
|
18403
18563
|
if (currentLimit < PARALLEL_TASK.MAX_CONCURRENCY) {
|
|
18404
18564
|
this.setLimit(key, currentLimit + 1);
|
|
18565
|
+
this.successStreak.set(key, 0);
|
|
18405
18566
|
log(`[concurrency] Auto-scaling UP for ${key}: ${currentLimit + 1}`);
|
|
18406
18567
|
}
|
|
18407
18568
|
}
|
|
@@ -18414,6 +18575,7 @@ var ConcurrencyController = class {
|
|
|
18414
18575
|
const minLimit = 1;
|
|
18415
18576
|
if (currentLimit > minLimit) {
|
|
18416
18577
|
this.setLimit(key, currentLimit - 1);
|
|
18578
|
+
this.failureCount.set(key, 0);
|
|
18417
18579
|
log(`[concurrency] Auto-scaling DOWN for ${key}: ${currentLimit - 1} (due to ${failures} failures)`);
|
|
18418
18580
|
}
|
|
18419
18581
|
}
|
|
@@ -20077,6 +20239,7 @@ var SessionPool = class _SessionPool {
|
|
|
20077
20239
|
await this.deleteSession(oldest.id);
|
|
20078
20240
|
}
|
|
20079
20241
|
}
|
|
20242
|
+
await this.resetSession(sessionId);
|
|
20080
20243
|
session.inUse = false;
|
|
20081
20244
|
log(`[SessionPool] Released session ${sessionId.slice(0, 8)}... to pool`);
|
|
20082
20245
|
}
|
|
@@ -20153,6 +20316,22 @@ var SessionPool = class _SessionPool {
|
|
|
20153
20316
|
// =========================================================================
|
|
20154
20317
|
// Private Methods
|
|
20155
20318
|
// =========================================================================
|
|
20319
|
+
/**
|
|
20320
|
+
* Reset/Compact a session to clear context for next reuse.
|
|
20321
|
+
*/
|
|
20322
|
+
async resetSession(sessionId) {
|
|
20323
|
+
const session = this.sessionsById.get(sessionId);
|
|
20324
|
+
if (!session) return;
|
|
20325
|
+
log(`[SessionPool] Resetting session ${sessionId.slice(0, 8)}...`);
|
|
20326
|
+
try {
|
|
20327
|
+
await this.client.session.compact?.({ path: { id: sessionId } });
|
|
20328
|
+
session.lastResetAt = /* @__PURE__ */ new Date();
|
|
20329
|
+
session.health = "healthy";
|
|
20330
|
+
} catch (error45) {
|
|
20331
|
+
log(`[SessionPool] Failed to reset session ${sessionId.slice(0, 8)}: ${error45}`);
|
|
20332
|
+
session.health = "degraded";
|
|
20333
|
+
}
|
|
20334
|
+
}
|
|
20156
20335
|
getPoolKey(agentName) {
|
|
20157
20336
|
return agentName;
|
|
20158
20337
|
}
|
|
@@ -20180,7 +20359,9 @@ var SessionPool = class _SessionPool {
|
|
|
20180
20359
|
createdAt: /* @__PURE__ */ new Date(),
|
|
20181
20360
|
lastUsedAt: /* @__PURE__ */ new Date(),
|
|
20182
20361
|
reuseCount: 0,
|
|
20183
|
-
inUse: true
|
|
20362
|
+
inUse: true,
|
|
20363
|
+
health: "healthy",
|
|
20364
|
+
lastResetAt: /* @__PURE__ */ new Date()
|
|
20184
20365
|
};
|
|
20185
20366
|
const poolKey = this.getPoolKey(agentName);
|
|
20186
20367
|
const agentPool = this.pool.get(poolKey) || [];
|
|
@@ -20250,33 +20431,122 @@ var TerminalMonitor = class _TerminalMonitor {
|
|
|
20250
20431
|
// src/core/agents/manager.ts
|
|
20251
20432
|
init_core2();
|
|
20252
20433
|
|
|
20253
|
-
// src/core/
|
|
20434
|
+
// src/core/todo/todo-manager.ts
|
|
20254
20435
|
init_shared();
|
|
20255
|
-
import
|
|
20256
|
-
import
|
|
20436
|
+
import * as fs5 from "node:fs";
|
|
20437
|
+
import * as path5 from "node:path";
|
|
20438
|
+
import * as crypto2 from "node:crypto";
|
|
20257
20439
|
var TodoManager = class _TodoManager {
|
|
20258
|
-
static
|
|
20440
|
+
static _instance;
|
|
20259
20441
|
directory = "";
|
|
20442
|
+
todoPath = "";
|
|
20443
|
+
versionPath = "";
|
|
20444
|
+
historyPath = "";
|
|
20445
|
+
updateMutex = Promise.resolve();
|
|
20260
20446
|
constructor() {
|
|
20261
20447
|
}
|
|
20262
|
-
static getInstance() {
|
|
20263
|
-
if (!_TodoManager.
|
|
20264
|
-
_TodoManager.
|
|
20448
|
+
static getInstance(directory) {
|
|
20449
|
+
if (!_TodoManager._instance) {
|
|
20450
|
+
_TodoManager._instance = new _TodoManager();
|
|
20451
|
+
}
|
|
20452
|
+
if (directory) {
|
|
20453
|
+
_TodoManager._instance.setDirectory(directory);
|
|
20265
20454
|
}
|
|
20266
|
-
return _TodoManager.
|
|
20455
|
+
return _TodoManager._instance;
|
|
20267
20456
|
}
|
|
20268
20457
|
setDirectory(dir) {
|
|
20269
20458
|
this.directory = dir;
|
|
20459
|
+
this.todoPath = path5.join(this.directory, PATHS.TODO);
|
|
20460
|
+
this.versionPath = path5.join(this.directory, ".opencode/todo.version.json");
|
|
20461
|
+
this.historyPath = path5.join(this.directory, ".opencode/archive/todo_history.jsonl");
|
|
20462
|
+
const archiveDir = path5.dirname(this.historyPath);
|
|
20463
|
+
if (!fs5.existsSync(archiveDir)) {
|
|
20464
|
+
fs5.mkdirSync(archiveDir, { recursive: true });
|
|
20465
|
+
}
|
|
20466
|
+
}
|
|
20467
|
+
async readWithVersion() {
|
|
20468
|
+
if (!this.directory) throw new Error("Directory not set");
|
|
20469
|
+
try {
|
|
20470
|
+
const content = fs5.existsSync(this.todoPath) ? await fs5.promises.readFile(this.todoPath, "utf-8") : "";
|
|
20471
|
+
let versionInfo = {
|
|
20472
|
+
version: 0,
|
|
20473
|
+
timestamp: Date.now(),
|
|
20474
|
+
author: "system"
|
|
20475
|
+
};
|
|
20476
|
+
if (fs5.existsSync(this.versionPath)) {
|
|
20477
|
+
try {
|
|
20478
|
+
const data = await fs5.promises.readFile(this.versionPath, "utf-8");
|
|
20479
|
+
versionInfo = JSON.parse(data);
|
|
20480
|
+
} catch (e) {
|
|
20481
|
+
log(`[TodoManager] Failed to parse version file: ${e}`);
|
|
20482
|
+
}
|
|
20483
|
+
}
|
|
20484
|
+
return { content, version: versionInfo };
|
|
20485
|
+
} catch (error45) {
|
|
20486
|
+
log(`[TodoManager] Error reading TODO: ${error45}`);
|
|
20487
|
+
return { content: "", version: { version: 0, timestamp: Date.now(), author: "system" } };
|
|
20488
|
+
}
|
|
20270
20489
|
}
|
|
20271
20490
|
/**
|
|
20272
|
-
* Update
|
|
20491
|
+
* Update TODO with both MVCC (for logical consistency) and Mutex (for atomicity)
|
|
20273
20492
|
*/
|
|
20274
|
-
|
|
20275
|
-
|
|
20276
|
-
|
|
20277
|
-
|
|
20278
|
-
|
|
20279
|
-
|
|
20493
|
+
async update(expectedVersion, updater, author) {
|
|
20494
|
+
return new Promise((resolve2, reject) => {
|
|
20495
|
+
this.updateMutex = this.updateMutex.then(async () => {
|
|
20496
|
+
try {
|
|
20497
|
+
const result = await this._internalUpdate(expectedVersion, updater, author);
|
|
20498
|
+
resolve2(result);
|
|
20499
|
+
} catch (e) {
|
|
20500
|
+
reject(e);
|
|
20501
|
+
}
|
|
20502
|
+
}).catch((e) => {
|
|
20503
|
+
log(`[TodoManager] Mutex error: ${e}`);
|
|
20504
|
+
});
|
|
20505
|
+
});
|
|
20506
|
+
}
|
|
20507
|
+
async _internalUpdate(expectedVersion, updater, author) {
|
|
20508
|
+
const MAX_RETRIES2 = 3;
|
|
20509
|
+
const RETRY_DELAY = 50;
|
|
20510
|
+
for (let attempt = 0; attempt < MAX_RETRIES2; attempt++) {
|
|
20511
|
+
try {
|
|
20512
|
+
const current = await this.readWithVersion();
|
|
20513
|
+
if (current.version.version !== expectedVersion) {
|
|
20514
|
+
log(`[TodoManager] Conflict: expected v${expectedVersion}, found v${current.version.version}`);
|
|
20515
|
+
return {
|
|
20516
|
+
success: false,
|
|
20517
|
+
currentVersion: current.version.version,
|
|
20518
|
+
conflict: true
|
|
20519
|
+
};
|
|
20520
|
+
}
|
|
20521
|
+
const newContent = updater(current.content);
|
|
20522
|
+
const newVersion = current.version.version + 1;
|
|
20523
|
+
const tmpPath = `${this.todoPath}.tmp.${Date.now()}.${Math.random().toString(36).slice(2)}`;
|
|
20524
|
+
await fs5.promises.writeFile(tmpPath, newContent, "utf-8");
|
|
20525
|
+
await fs5.promises.writeFile(
|
|
20526
|
+
this.versionPath,
|
|
20527
|
+
JSON.stringify({
|
|
20528
|
+
version: newVersion,
|
|
20529
|
+
timestamp: Date.now(),
|
|
20530
|
+
author
|
|
20531
|
+
}),
|
|
20532
|
+
"utf-8"
|
|
20533
|
+
);
|
|
20534
|
+
await fs5.promises.rename(tmpPath, this.todoPath);
|
|
20535
|
+
this.logChange(newVersion, newContent, author).catch(() => {
|
|
20536
|
+
});
|
|
20537
|
+
log(`[TodoManager] Updated TODO to v${newVersion} by ${author}`);
|
|
20538
|
+
return { success: true, currentVersion: newVersion };
|
|
20539
|
+
} catch (error45) {
|
|
20540
|
+
if (attempt === MAX_RETRIES2 - 1) throw error45;
|
|
20541
|
+
await new Promise((r) => setTimeout(r, RETRY_DELAY));
|
|
20542
|
+
}
|
|
20543
|
+
}
|
|
20544
|
+
throw new Error("Failed to update TODO");
|
|
20545
|
+
}
|
|
20546
|
+
async updateItem(searchText, newStatus, author = "system") {
|
|
20547
|
+
let retries = 5;
|
|
20548
|
+
while (retries-- > 0) {
|
|
20549
|
+
const data = await this.readWithVersion();
|
|
20280
20550
|
const statusMap = {
|
|
20281
20551
|
[TODO_CONSTANTS.STATUS.PENDING]: TODO_CONSTANTS.MARKERS.PENDING,
|
|
20282
20552
|
[TODO_CONSTANTS.STATUS.COMPLETED]: TODO_CONSTANTS.MARKERS.COMPLETED,
|
|
@@ -20284,57 +20554,63 @@ var TodoManager = class _TodoManager {
|
|
|
20284
20554
|
[TODO_CONSTANTS.STATUS.FAILED]: TODO_CONSTANTS.MARKERS.FAILED
|
|
20285
20555
|
};
|
|
20286
20556
|
const marker = statusMap[newStatus] || TODO_CONSTANTS.MARKERS.PENDING;
|
|
20287
|
-
|
|
20288
|
-
|
|
20289
|
-
|
|
20290
|
-
|
|
20291
|
-
|
|
20292
|
-
|
|
20293
|
-
|
|
20294
|
-
|
|
20295
|
-
|
|
20296
|
-
|
|
20297
|
-
|
|
20298
|
-
|
|
20299
|
-
|
|
20300
|
-
return false;
|
|
20301
|
-
|
|
20302
|
-
log(`[TodoManager] Error updating TODO: ${error45}`);
|
|
20303
|
-
return false;
|
|
20557
|
+
const result = await this.update(data.version.version, (content) => {
|
|
20558
|
+
const lines = content.split("\n");
|
|
20559
|
+
let updated = false;
|
|
20560
|
+
const newLines = lines.map((line) => {
|
|
20561
|
+
if (line.includes(searchText) && /\[[ x\/\-]\]/.test(line)) {
|
|
20562
|
+
updated = true;
|
|
20563
|
+
return line.replace(/\[[ x\/\-]\]/, marker);
|
|
20564
|
+
}
|
|
20565
|
+
return line;
|
|
20566
|
+
});
|
|
20567
|
+
return updated ? newLines.join("\n") : content;
|
|
20568
|
+
}, author);
|
|
20569
|
+
if (result.success) return true;
|
|
20570
|
+
if (!result.conflict) return false;
|
|
20571
|
+
await new Promise((r) => setTimeout(r, 50));
|
|
20304
20572
|
}
|
|
20573
|
+
return false;
|
|
20305
20574
|
}
|
|
20306
|
-
|
|
20307
|
-
|
|
20308
|
-
|
|
20309
|
-
|
|
20310
|
-
|
|
20311
|
-
|
|
20312
|
-
|
|
20313
|
-
|
|
20314
|
-
|
|
20315
|
-
|
|
20316
|
-
|
|
20317
|
-
|
|
20318
|
-
|
|
20319
|
-
|
|
20320
|
-
|
|
20321
|
-
|
|
20322
|
-
|
|
20323
|
-
|
|
20324
|
-
|
|
20325
|
-
|
|
20326
|
-
|
|
20327
|
-
|
|
20328
|
-
|
|
20329
|
-
|
|
20330
|
-
|
|
20331
|
-
|
|
20332
|
-
|
|
20333
|
-
return false;
|
|
20334
|
-
} catch (error45) {
|
|
20335
|
-
log(`[TodoManager] Error adding sub-task: ${error45}`);
|
|
20336
|
-
return false;
|
|
20575
|
+
async addSubTask(parentText, subTaskText, author = "system") {
|
|
20576
|
+
let retries = 5;
|
|
20577
|
+
while (retries-- > 0) {
|
|
20578
|
+
const data = await this.readWithVersion();
|
|
20579
|
+
const result = await this.update(data.version.version, (content) => {
|
|
20580
|
+
const lines = content.split("\n");
|
|
20581
|
+
let parentIndex = -1;
|
|
20582
|
+
let parentIndent = "";
|
|
20583
|
+
for (let i = 0; i < lines.length; i++) {
|
|
20584
|
+
if (lines[i].includes(parentText)) {
|
|
20585
|
+
parentIndex = i;
|
|
20586
|
+
const match = lines[i].match(/^(\s*)/);
|
|
20587
|
+
parentIndent = match ? match[1] : "";
|
|
20588
|
+
break;
|
|
20589
|
+
}
|
|
20590
|
+
}
|
|
20591
|
+
if (parentIndex !== -1) {
|
|
20592
|
+
const subTaskIndent = parentIndent + " ";
|
|
20593
|
+
const newLine = `${subTaskIndent}- ${TODO_CONSTANTS.MARKERS.PENDING} ${subTaskText}`;
|
|
20594
|
+
lines.splice(parentIndex + 1, 0, newLine);
|
|
20595
|
+
return lines.join("\n");
|
|
20596
|
+
}
|
|
20597
|
+
return content;
|
|
20598
|
+
}, author);
|
|
20599
|
+
if (result.success) return true;
|
|
20600
|
+
if (!result.conflict) return false;
|
|
20601
|
+
await new Promise((r) => setTimeout(r, 50));
|
|
20337
20602
|
}
|
|
20603
|
+
return false;
|
|
20604
|
+
}
|
|
20605
|
+
async logChange(version2, content, author) {
|
|
20606
|
+
const entry = {
|
|
20607
|
+
version: version2,
|
|
20608
|
+
timestamp: Date.now(),
|
|
20609
|
+
author,
|
|
20610
|
+
contentHash: crypto2.createHash("sha256").update(content).digest("hex"),
|
|
20611
|
+
size: content.length
|
|
20612
|
+
};
|
|
20613
|
+
await fs5.promises.appendFile(this.historyPath, JSON.stringify(entry) + "\n", "utf-8");
|
|
20338
20614
|
}
|
|
20339
20615
|
};
|
|
20340
20616
|
|
|
@@ -21093,11 +21369,11 @@ var createUpdateTodoTool = () => tool({
|
|
|
21093
21369
|
const manager = TodoManager.getInstance();
|
|
21094
21370
|
if (args.action === "update") {
|
|
21095
21371
|
if (!args.status) return `${OUTPUT_LABEL.ERROR} 'status' is required for update action.`;
|
|
21096
|
-
const success2 = manager.updateItem(args.task, args.status);
|
|
21372
|
+
const success2 = await manager.updateItem(args.task, args.status);
|
|
21097
21373
|
return success2 ? `${OUTPUT_LABEL.DONE} Updated task status: "${args.task}" -> ${args.status}` : `${OUTPUT_LABEL.ERROR} Task not found: "${args.task}"`;
|
|
21098
21374
|
} else {
|
|
21099
21375
|
if (!args.subtask) return `${OUTPUT_LABEL.ERROR} 'subtask' is required for add action.`;
|
|
21100
|
-
const success2 = manager.addSubTask(args.task, args.subtask);
|
|
21376
|
+
const success2 = await manager.addSubTask(args.task, args.subtask);
|
|
21101
21377
|
return success2 ? `${OUTPUT_LABEL.DONE} Added sub-task: "${args.subtask}" under "${args.task}"` : `${OUTPUT_LABEL.ERROR} Parent task not found: "${args.task}"`;
|
|
21102
21378
|
}
|
|
21103
21379
|
}
|
|
@@ -21168,15 +21444,15 @@ var METADATA_FILE = PATHS.DOC_METADATA;
|
|
|
21168
21444
|
var DEFAULT_TTL_MS = CACHE.DEFAULT_TTL_MS;
|
|
21169
21445
|
|
|
21170
21446
|
// src/core/cache/operations.ts
|
|
21171
|
-
import * as
|
|
21172
|
-
import * as
|
|
21447
|
+
import * as fs7 from "node:fs/promises";
|
|
21448
|
+
import * as path6 from "node:path";
|
|
21173
21449
|
|
|
21174
21450
|
// src/core/cache/utils.ts
|
|
21175
|
-
import * as
|
|
21451
|
+
import * as fs6 from "node:fs/promises";
|
|
21176
21452
|
import { existsSync as existsSync4 } from "node:fs";
|
|
21177
21453
|
async function ensureCacheDir() {
|
|
21178
21454
|
if (!existsSync4(CACHE_DIR)) {
|
|
21179
|
-
await
|
|
21455
|
+
await fs6.mkdir(CACHE_DIR, { recursive: true });
|
|
21180
21456
|
}
|
|
21181
21457
|
}
|
|
21182
21458
|
function urlToFilename(url2) {
|
|
@@ -21191,7 +21467,7 @@ function urlToFilename(url2) {
|
|
|
21191
21467
|
}
|
|
21192
21468
|
async function readMetadata() {
|
|
21193
21469
|
try {
|
|
21194
|
-
const content = await
|
|
21470
|
+
const content = await fs6.readFile(METADATA_FILE, "utf-8");
|
|
21195
21471
|
return JSON.parse(content);
|
|
21196
21472
|
} catch {
|
|
21197
21473
|
return { documents: {}, lastUpdated: (/* @__PURE__ */ new Date()).toISOString() };
|
|
@@ -21200,7 +21476,7 @@ async function readMetadata() {
|
|
|
21200
21476
|
async function writeMetadata(metadata) {
|
|
21201
21477
|
await ensureCacheDir();
|
|
21202
21478
|
metadata.lastUpdated = (/* @__PURE__ */ new Date()).toISOString();
|
|
21203
|
-
await
|
|
21479
|
+
await fs6.writeFile(METADATA_FILE, JSON.stringify(metadata, null, 2));
|
|
21204
21480
|
}
|
|
21205
21481
|
|
|
21206
21482
|
// src/core/cache/operations.ts
|
|
@@ -21214,8 +21490,8 @@ async function get2(url2) {
|
|
|
21214
21490
|
return null;
|
|
21215
21491
|
}
|
|
21216
21492
|
try {
|
|
21217
|
-
const filepath =
|
|
21218
|
-
const content = await
|
|
21493
|
+
const filepath = path6.join(CACHE_DIR, filename);
|
|
21494
|
+
const content = await fs7.readFile(filepath, "utf-8");
|
|
21219
21495
|
return { ...entry, content };
|
|
21220
21496
|
} catch {
|
|
21221
21497
|
return null;
|
|
@@ -21226,8 +21502,8 @@ async function getByFilename(filename) {
|
|
|
21226
21502
|
const entry = metadata.documents[filename];
|
|
21227
21503
|
if (!entry) return null;
|
|
21228
21504
|
try {
|
|
21229
|
-
const filepath =
|
|
21230
|
-
const content = await
|
|
21505
|
+
const filepath = path6.join(CACHE_DIR, filename);
|
|
21506
|
+
const content = await fs7.readFile(filepath, "utf-8");
|
|
21231
21507
|
return { ...entry, content };
|
|
21232
21508
|
} catch {
|
|
21233
21509
|
return null;
|
|
@@ -21236,7 +21512,7 @@ async function getByFilename(filename) {
|
|
|
21236
21512
|
async function set2(url2, content, title, ttlMs = DEFAULT_TTL_MS) {
|
|
21237
21513
|
await ensureCacheDir();
|
|
21238
21514
|
const filename = urlToFilename(url2);
|
|
21239
|
-
const filepath =
|
|
21515
|
+
const filepath = path6.join(CACHE_DIR, filename);
|
|
21240
21516
|
const now = /* @__PURE__ */ new Date();
|
|
21241
21517
|
const header = `# ${title}
|
|
21242
21518
|
|
|
@@ -21247,7 +21523,7 @@ async function set2(url2, content, title, ttlMs = DEFAULT_TTL_MS) {
|
|
|
21247
21523
|
|
|
21248
21524
|
`;
|
|
21249
21525
|
const fullContent = header + content;
|
|
21250
|
-
await
|
|
21526
|
+
await fs7.writeFile(filepath, fullContent);
|
|
21251
21527
|
const metadata = await readMetadata();
|
|
21252
21528
|
metadata.documents[filename] = {
|
|
21253
21529
|
url: url2,
|
|
@@ -21261,9 +21537,9 @@ async function set2(url2, content, title, ttlMs = DEFAULT_TTL_MS) {
|
|
|
21261
21537
|
}
|
|
21262
21538
|
async function remove(url2) {
|
|
21263
21539
|
const filename = urlToFilename(url2);
|
|
21264
|
-
const filepath =
|
|
21540
|
+
const filepath = path6.join(CACHE_DIR, filename);
|
|
21265
21541
|
try {
|
|
21266
|
-
await
|
|
21542
|
+
await fs7.unlink(filepath);
|
|
21267
21543
|
const metadata = await readMetadata();
|
|
21268
21544
|
delete metadata.documents[filename];
|
|
21269
21545
|
await writeMetadata(metadata);
|
|
@@ -21285,9 +21561,9 @@ async function clear3() {
|
|
|
21285
21561
|
const metadata = await readMetadata();
|
|
21286
21562
|
const count = Object.keys(metadata.documents).length;
|
|
21287
21563
|
for (const filename of Object.keys(metadata.documents)) {
|
|
21288
|
-
const filepath =
|
|
21564
|
+
const filepath = path6.join(CACHE_DIR, filename);
|
|
21289
21565
|
try {
|
|
21290
|
-
await
|
|
21566
|
+
await fs7.unlink(filepath);
|
|
21291
21567
|
} catch {
|
|
21292
21568
|
}
|
|
21293
21569
|
}
|
|
@@ -21948,8 +22224,8 @@ ${r.content}
|
|
|
21948
22224
|
});
|
|
21949
22225
|
|
|
21950
22226
|
// src/tools/lsp/diagnostics-cache.ts
|
|
21951
|
-
import
|
|
21952
|
-
import
|
|
22227
|
+
import fs8 from "fs/promises";
|
|
22228
|
+
import path7 from "path";
|
|
21953
22229
|
var DiagnosticsCache = class {
|
|
21954
22230
|
cache = /* @__PURE__ */ new Map();
|
|
21955
22231
|
defaultTTL = 3e4;
|
|
@@ -21992,10 +22268,10 @@ var DiagnosticsCache = class {
|
|
|
21992
22268
|
}
|
|
21993
22269
|
async getFilesMtime(directory, file2) {
|
|
21994
22270
|
if (file2 && file2 !== "*") {
|
|
21995
|
-
const stats3 = await
|
|
22271
|
+
const stats3 = await fs8.stat(path7.join(directory, file2));
|
|
21996
22272
|
return stats3.mtimeMs;
|
|
21997
22273
|
}
|
|
21998
|
-
const stats2 = await
|
|
22274
|
+
const stats2 = await fs8.stat(directory);
|
|
21999
22275
|
return stats2.mtimeMs;
|
|
22000
22276
|
}
|
|
22001
22277
|
};
|
|
@@ -22068,20 +22344,76 @@ var HookRegistry = class _HookRegistry {
|
|
|
22068
22344
|
}
|
|
22069
22345
|
return _HookRegistry.instance;
|
|
22070
22346
|
}
|
|
22071
|
-
registerPreTool(hook) {
|
|
22072
|
-
this.preToolHooks.push(hook);
|
|
22347
|
+
registerPreTool(hook, metadata) {
|
|
22348
|
+
this.preToolHooks.push({ hook, metadata: this.prepareMetadata(hook.name, metadata) });
|
|
22349
|
+
this.sortHooks(this.preToolHooks);
|
|
22350
|
+
}
|
|
22351
|
+
registerPostTool(hook, metadata) {
|
|
22352
|
+
this.postToolHooks.push({ hook, metadata: this.prepareMetadata(hook.name, metadata) });
|
|
22353
|
+
this.sortHooks(this.postToolHooks);
|
|
22073
22354
|
}
|
|
22074
|
-
|
|
22075
|
-
this.
|
|
22355
|
+
registerChat(hook, metadata) {
|
|
22356
|
+
this.chatHooks.push({ hook, metadata: this.prepareMetadata(hook.name, metadata) });
|
|
22357
|
+
this.sortHooks(this.chatHooks);
|
|
22076
22358
|
}
|
|
22077
|
-
|
|
22078
|
-
this.
|
|
22359
|
+
registerDone(hook, metadata) {
|
|
22360
|
+
this.doneHooks.push({ hook, metadata: this.prepareMetadata(hook.name, metadata) });
|
|
22361
|
+
this.sortHooks(this.doneHooks);
|
|
22362
|
+
}
|
|
22363
|
+
prepareMetadata(name, metadata) {
|
|
22364
|
+
return {
|
|
22365
|
+
name: metadata?.name || name,
|
|
22366
|
+
priority: metadata?.priority ?? 50,
|
|
22367
|
+
phase: metadata?.phase || "normal",
|
|
22368
|
+
dependencies: metadata?.dependencies || [],
|
|
22369
|
+
errorHandling: metadata?.errorHandling || "continue"
|
|
22370
|
+
};
|
|
22079
22371
|
}
|
|
22080
|
-
|
|
22081
|
-
|
|
22372
|
+
sortHooks(registrations) {
|
|
22373
|
+
registrations.sort((a, b) => {
|
|
22374
|
+
const phaseOrder = { early: 0, normal: 1, late: 2 };
|
|
22375
|
+
const phaseA = phaseOrder[a.metadata.phase || "normal"];
|
|
22376
|
+
const phaseB = phaseOrder[b.metadata.phase || "normal"];
|
|
22377
|
+
if (phaseA !== phaseB) return phaseA - phaseB;
|
|
22378
|
+
return a.metadata.priority - b.metadata.priority;
|
|
22379
|
+
});
|
|
22380
|
+
try {
|
|
22381
|
+
const sorted = this.topologicalSort(registrations);
|
|
22382
|
+
registrations.length = 0;
|
|
22383
|
+
registrations.push(...sorted);
|
|
22384
|
+
} catch (e) {
|
|
22385
|
+
log(`[HookRegistry] Dependency sort failed: ${e}`);
|
|
22386
|
+
throw e;
|
|
22387
|
+
}
|
|
22388
|
+
}
|
|
22389
|
+
topologicalSort(registrations) {
|
|
22390
|
+
const sorted = [];
|
|
22391
|
+
const visited = /* @__PURE__ */ new Set();
|
|
22392
|
+
const visiting = /* @__PURE__ */ new Set();
|
|
22393
|
+
const nameToReg = new Map(registrations.map((r) => [r.metadata.name, r]));
|
|
22394
|
+
const visit = (name) => {
|
|
22395
|
+
if (visiting.has(name)) {
|
|
22396
|
+
throw new Error(`Circular dependency detected in hooks: ${name}`);
|
|
22397
|
+
}
|
|
22398
|
+
if (visited.has(name)) return;
|
|
22399
|
+
visiting.add(name);
|
|
22400
|
+
const reg = nameToReg.get(name);
|
|
22401
|
+
if (reg) {
|
|
22402
|
+
for (const dep of reg.metadata.dependencies || []) {
|
|
22403
|
+
visit(dep);
|
|
22404
|
+
}
|
|
22405
|
+
}
|
|
22406
|
+
visiting.delete(name);
|
|
22407
|
+
visited.add(name);
|
|
22408
|
+
if (reg) sorted.push(reg);
|
|
22409
|
+
};
|
|
22410
|
+
for (const reg of registrations) {
|
|
22411
|
+
visit(reg.metadata.name);
|
|
22412
|
+
}
|
|
22413
|
+
return sorted;
|
|
22082
22414
|
}
|
|
22083
22415
|
async executePreTool(ctx, tool2, args) {
|
|
22084
|
-
for (const hook of this.preToolHooks) {
|
|
22416
|
+
for (const { hook, metadata } of this.preToolHooks) {
|
|
22085
22417
|
try {
|
|
22086
22418
|
const result = await hook.execute(ctx, tool2, args);
|
|
22087
22419
|
if (result.action === HOOK_ACTIONS.BLOCK) return result;
|
|
@@ -22089,26 +22421,28 @@ var HookRegistry = class _HookRegistry {
|
|
|
22089
22421
|
args = result.modifiedArgs;
|
|
22090
22422
|
}
|
|
22091
22423
|
} catch (e) {
|
|
22092
|
-
log(`[HookRegistry] Error in PreTool hook ${
|
|
22424
|
+
log(`[HookRegistry] Error in PreTool hook ${metadata.name}`, e);
|
|
22425
|
+
if (metadata.errorHandling === "stop") throw e;
|
|
22093
22426
|
}
|
|
22094
22427
|
}
|
|
22095
22428
|
return { action: HOOK_ACTIONS.ALLOW, modifiedArgs: args };
|
|
22096
22429
|
}
|
|
22097
22430
|
async executePostTool(ctx, tool2, input, output) {
|
|
22098
|
-
for (const hook of this.postToolHooks) {
|
|
22431
|
+
for (const { hook, metadata } of this.postToolHooks) {
|
|
22099
22432
|
try {
|
|
22100
22433
|
const result = await hook.execute(ctx, tool2, input, output);
|
|
22101
22434
|
if (result?.output) {
|
|
22102
22435
|
output.output = result.output;
|
|
22103
22436
|
}
|
|
22104
22437
|
} catch (e) {
|
|
22105
|
-
log(`[HookRegistry] Error in PostTool hook ${
|
|
22438
|
+
log(`[HookRegistry] Error in PostTool hook ${metadata.name}`, e);
|
|
22439
|
+
if (metadata.errorHandling === "stop") throw e;
|
|
22106
22440
|
}
|
|
22107
22441
|
}
|
|
22108
22442
|
}
|
|
22109
22443
|
async executeChat(ctx, message) {
|
|
22110
22444
|
let currentMessage = message;
|
|
22111
|
-
for (const hook of this.chatHooks) {
|
|
22445
|
+
for (const { hook, metadata } of this.chatHooks) {
|
|
22112
22446
|
try {
|
|
22113
22447
|
const result = await hook.execute(ctx, currentMessage);
|
|
22114
22448
|
if (result.action === HOOK_ACTIONS.INTERCEPT) {
|
|
@@ -22118,13 +22452,14 @@ var HookRegistry = class _HookRegistry {
|
|
|
22118
22452
|
currentMessage = result.modifiedMessage;
|
|
22119
22453
|
}
|
|
22120
22454
|
} catch (e) {
|
|
22121
|
-
log(`[HookRegistry] Error in Chat hook ${
|
|
22455
|
+
log(`[HookRegistry] Error in Chat hook ${metadata.name}`, e);
|
|
22456
|
+
if (metadata.errorHandling === "stop") throw e;
|
|
22122
22457
|
}
|
|
22123
22458
|
}
|
|
22124
22459
|
return { action: HOOK_ACTIONS.PROCESS, modifiedMessage: currentMessage };
|
|
22125
22460
|
}
|
|
22126
22461
|
async executeDone(ctx, finalText) {
|
|
22127
|
-
for (const hook of this.doneHooks) {
|
|
22462
|
+
for (const { hook, metadata } of this.doneHooks) {
|
|
22128
22463
|
try {
|
|
22129
22464
|
const result = await hook.execute(ctx, finalText);
|
|
22130
22465
|
if (result.action === HOOK_ACTIONS.STOP) {
|
|
@@ -22134,7 +22469,8 @@ var HookRegistry = class _HookRegistry {
|
|
|
22134
22469
|
return result;
|
|
22135
22470
|
}
|
|
22136
22471
|
} catch (e) {
|
|
22137
|
-
log(`[HookRegistry] Error in Done hook ${
|
|
22472
|
+
log(`[HookRegistry] Error in Done hook ${metadata.name}`, e);
|
|
22473
|
+
if (metadata.errorHandling === "stop") throw e;
|
|
22138
22474
|
}
|
|
22139
22475
|
}
|
|
22140
22476
|
return { action: HOOK_ACTIONS.CONTINUE };
|
|
@@ -22262,7 +22598,7 @@ function checkOutputSanity(text) {
|
|
|
22262
22598
|
init_shared();
|
|
22263
22599
|
|
|
22264
22600
|
// src/core/loop/mission-loop.ts
|
|
22265
|
-
import { existsSync as existsSync5, readFileSync
|
|
22601
|
+
import { existsSync as existsSync5, readFileSync, writeFileSync, unlinkSync, mkdirSync as mkdirSync2 } from "node:fs";
|
|
22266
22602
|
import { join as join7 } from "node:path";
|
|
22267
22603
|
init_shared();
|
|
22268
22604
|
|
|
@@ -22316,8 +22652,11 @@ var CONTINUE_INSTRUCTION = `<auto_continue>
|
|
|
22316
22652
|
<rules>
|
|
22317
22653
|
1. DO NOT stop - mission is incomplete
|
|
22318
22654
|
2. DO NOT wait for user input
|
|
22319
|
-
3. If
|
|
22320
|
-
|
|
22655
|
+
3. **PROACTIVE THINKING MANDATORY**: If background tasks are running, use the time to:
|
|
22656
|
+
- Run \`check_background_task\` to audit logs and ensure no deadlocks.
|
|
22657
|
+
- speculatively plan the next steps or prepare necessary code templates.
|
|
22658
|
+
- execute independent sub-tasks from the TODO list.
|
|
22659
|
+
4. If previous action failed, try different approach
|
|
22321
22660
|
5. Breakdown abstract tasks into Grade 3 sub-tasks before execution
|
|
22322
22661
|
</rules>
|
|
22323
22662
|
|
|
@@ -22349,7 +22688,7 @@ function readLoopState(directory) {
|
|
|
22349
22688
|
return null;
|
|
22350
22689
|
}
|
|
22351
22690
|
try {
|
|
22352
|
-
const content =
|
|
22691
|
+
const content = readFileSync(filePath, "utf-8");
|
|
22353
22692
|
return JSON.parse(content);
|
|
22354
22693
|
} catch (error45) {
|
|
22355
22694
|
log(`[${MISSION_CONTROL.LOG_SOURCE}] Failed to read state: ${error45}`);
|
|
@@ -22361,9 +22700,9 @@ function writeLoopState(directory, state2) {
|
|
|
22361
22700
|
const dirPath = join7(directory, PATHS.OPENCODE);
|
|
22362
22701
|
try {
|
|
22363
22702
|
if (!existsSync5(dirPath)) {
|
|
22364
|
-
|
|
22703
|
+
mkdirSync2(dirPath, { recursive: true });
|
|
22365
22704
|
}
|
|
22366
|
-
|
|
22705
|
+
writeFileSync(filePath, JSON.stringify(state2, null, 2), "utf-8");
|
|
22367
22706
|
return true;
|
|
22368
22707
|
} catch (error45) {
|
|
22369
22708
|
log(`[${MISSION_CONTROL.LOG_SOURCE}] Failed to write state: ${error45}`);
|
|
@@ -22443,6 +22782,18 @@ ${state2.prompt}
|
|
|
22443
22782
|
**NOW**: Continue executing!
|
|
22444
22783
|
</mission_loop>`;
|
|
22445
22784
|
}
|
|
22785
|
+
var STAGNATION_INTERVENTION = `
|
|
22786
|
+
<system_intervention type="stagnation_detected">
|
|
22787
|
+
\u26A0\uFE0F **\uACBD\uACE0: \uC9C4\uD589 \uC815\uCCB4 \uAC10\uC9C0 (STAGNATION DETECTED)**
|
|
22788
|
+
\uCD5C\uADFC \uC5EC\uB7EC \uD134 \uB3D9\uC548 \uC2E4\uC9C8\uC801\uC778 \uC9C4\uC804\uC774 \uAC10\uC9C0\uB418\uC9C0 \uC54A\uC558\uC2B5\uB2C8\uB2E4. \uB2E8\uC21C "\uBAA8\uB2C8\uD130\uB9C1"\uC774\uB098 \uAC19\uC740 \uD589\uB3D9\uC744 \uBC18\uBCF5\uD558\uB294 \uAC83\uC740 \uAE08\uC9C0\uB429\uB2C8\uB2E4.
|
|
22789
|
+
|
|
22790
|
+
**\uC790\uC728\uC801 \uC9C4\uB2E8 \uBC0F \uD574\uACB0 \uC9C0\uCE68:**
|
|
22791
|
+
1. **\uC2E4\uC2DC\uAC04 \uB85C\uADF8 \uD655\uC778**: \`check_background_task\` \uB610\uB294 \`read_file\`\uC744 \uC0AC\uC6A9\uD558\uC5EC \uC9C4\uD589 \uC911\uC778 \uC791\uC5C5\uC758 \uCD9C\uB825 \uB85C\uADF8\uB97C \uC9C1\uC811 \uD655\uC778\uD558\uC2ED\uC2DC\uC624.
|
|
22792
|
+
2. **\uD504\uB85C\uC138\uC2A4 \uC0DD\uC874 \uC9C4\uB2E8**: \uC791\uC5C5\uC774 \uC880\uBE44 \uC0C1\uD0DC\uC774\uAC70\uB098 \uBA48\uCD98 \uAC83 \uAC19\uB2E4\uBA74 \uACFC\uAC10\uD558\uAC8C \`kill\`\uD558\uACE0 \uB2E8\uACC4\uB97C \uC138\uBD84\uD654\uD558\uC5EC \uB2E4\uC2DC \uC2E4\uD589\uD558\uC2ED\uC2DC\uC624.
|
|
22793
|
+
3. **\uC804\uB7B5 \uC804\uD658**: \uB3D9\uC77C\uD55C \uC811\uADFC \uBC29\uC2DD\uC774 \uC2E4\uD328\uD558\uACE0 \uC788\uB2E4\uBA74, \uB2E4\uB978 \uB3C4\uAD6C\uB098 \uBC29\uBC95\uC744 \uC0AC\uC6A9\uD558\uC5EC \uBAA9\uD45C\uC5D0 \uB3C4\uB2EC\uD558\uC2ED\uC2DC\uC624.
|
|
22794
|
+
|
|
22795
|
+
**\uC9C0\uAE08 \uBC14\uB85C \uB2A5\uB3D9\uC801\uC73C\uB85C \uAC1C\uC785\uD558\uC2ED\uC2DC\uC624. \uB300\uAE30\uD558\uC9C0 \uB9C8\uC2ED\uC2DC\uC624.**
|
|
22796
|
+
</system_intervention>`;
|
|
22446
22797
|
|
|
22447
22798
|
// src/core/orchestrator/session-manager.ts
|
|
22448
22799
|
function ensureSessionInitialized(sessions, sessionID, directory) {
|
|
@@ -22659,7 +23010,7 @@ function formatElapsedTime(startMs, endMs = Date.now()) {
|
|
|
22659
23010
|
|
|
22660
23011
|
// src/core/loop/verification.ts
|
|
22661
23012
|
init_shared();
|
|
22662
|
-
import { existsSync as existsSync6, readFileSync as
|
|
23013
|
+
import { existsSync as existsSync6, readFileSync as readFileSync2 } from "node:fs";
|
|
22663
23014
|
import { join as join8 } from "node:path";
|
|
22664
23015
|
var CHECKLIST_FILE = CHECKLIST.FILE;
|
|
22665
23016
|
function parseChecklistLine(line, currentCategory) {
|
|
@@ -22730,7 +23081,7 @@ function readChecklist(directory) {
|
|
|
22730
23081
|
return [];
|
|
22731
23082
|
}
|
|
22732
23083
|
try {
|
|
22733
|
-
const content =
|
|
23084
|
+
const content = readFileSync2(filePath, "utf-8");
|
|
22734
23085
|
return parseChecklist(content);
|
|
22735
23086
|
} catch (error45) {
|
|
22736
23087
|
log(`[checklist] Failed to read checklist: ${error45}`);
|
|
@@ -22827,7 +23178,7 @@ function verifyMissionCompletion(directory) {
|
|
|
22827
23178
|
const todoPath = join8(directory, PATHS.TODO);
|
|
22828
23179
|
if (existsSync6(todoPath)) {
|
|
22829
23180
|
try {
|
|
22830
|
-
const content =
|
|
23181
|
+
const content = readFileSync2(todoPath, "utf-8");
|
|
22831
23182
|
const incompleteCount = countMatches(content, TODO_INCOMPLETE_PATTERN);
|
|
22832
23183
|
const completeCount = countMatches(content, TODO_COMPLETE_PATTERN);
|
|
22833
23184
|
const total = incompleteCount + completeCount;
|
|
@@ -22852,7 +23203,7 @@ function verifyMissionCompletion(directory) {
|
|
|
22852
23203
|
const syncPath = join8(directory, PATHS.SYNC_ISSUES);
|
|
22853
23204
|
if (existsSync6(syncPath)) {
|
|
22854
23205
|
try {
|
|
22855
|
-
const content =
|
|
23206
|
+
const content = readFileSync2(syncPath, "utf-8");
|
|
22856
23207
|
result.syncIssuesEmpty = !hasRealSyncIssues(content);
|
|
22857
23208
|
if (!result.syncIssuesEmpty) {
|
|
22858
23209
|
const issueLines = content.split("\n").filter(
|
|
@@ -22991,10 +23342,10 @@ async function resolveCommandPath(key, commandName) {
|
|
|
22991
23342
|
const currentPending = pending.get(key);
|
|
22992
23343
|
if (currentPending) return currentPending;
|
|
22993
23344
|
const promise2 = (async () => {
|
|
22994
|
-
const
|
|
22995
|
-
cache[key] =
|
|
23345
|
+
const path10 = await findCommand(commandName);
|
|
23346
|
+
cache[key] = path10;
|
|
22996
23347
|
pending.delete(key);
|
|
22997
|
-
return
|
|
23348
|
+
return path10;
|
|
22998
23349
|
})();
|
|
22999
23350
|
pending.set(key, promise2);
|
|
23000
23351
|
return promise2;
|
|
@@ -23003,21 +23354,21 @@ async function resolveCommandPath(key, commandName) {
|
|
|
23003
23354
|
// src/core/notification/os-notify/notifier.ts
|
|
23004
23355
|
var execAsync2 = promisify2(exec2);
|
|
23005
23356
|
async function notifyDarwin(title, message) {
|
|
23006
|
-
const
|
|
23357
|
+
const path10 = await resolveCommandPath(
|
|
23007
23358
|
NOTIFICATION_COMMAND_KEYS.OSASCRIPT,
|
|
23008
23359
|
NOTIFICATION_COMMANDS.OSASCRIPT
|
|
23009
23360
|
);
|
|
23010
|
-
if (!
|
|
23361
|
+
if (!path10) return;
|
|
23011
23362
|
const escT = title.replace(/"/g, '\\"');
|
|
23012
23363
|
const escM = message.replace(/"/g, '\\"');
|
|
23013
|
-
await execAsync2(`${
|
|
23364
|
+
await execAsync2(`${path10} -e 'display notification "${escM}" with title "${escT}" sound name "Glass"'`);
|
|
23014
23365
|
}
|
|
23015
23366
|
async function notifyLinux(title, message) {
|
|
23016
|
-
const
|
|
23367
|
+
const path10 = await resolveCommandPath(
|
|
23017
23368
|
NOTIFICATION_COMMAND_KEYS.NOTIFY_SEND,
|
|
23018
23369
|
NOTIFICATION_COMMANDS.NOTIFY_SEND
|
|
23019
23370
|
);
|
|
23020
|
-
if (
|
|
23371
|
+
if (path10) await execAsync2(`${path10} "${title}" "${message}" 2>/dev/null`);
|
|
23021
23372
|
}
|
|
23022
23373
|
async function notifyWindows(title, message) {
|
|
23023
23374
|
const ps = await resolveCommandPath(
|
|
@@ -23064,11 +23415,11 @@ init_os();
|
|
|
23064
23415
|
async function playDarwin(soundPath) {
|
|
23065
23416
|
if (!soundPath) return;
|
|
23066
23417
|
try {
|
|
23067
|
-
const
|
|
23418
|
+
const path10 = await resolveCommandPath(
|
|
23068
23419
|
NOTIFICATION_COMMAND_KEYS.AFPLAY,
|
|
23069
23420
|
NOTIFICATION_COMMANDS.AFPLAY
|
|
23070
23421
|
);
|
|
23071
|
-
if (
|
|
23422
|
+
if (path10) exec3(`"${path10}" "${soundPath}"`);
|
|
23072
23423
|
} catch (err) {
|
|
23073
23424
|
log(`[session-notify] Error playing sound (Darwin): ${err}`);
|
|
23074
23425
|
}
|
|
@@ -23187,13 +23538,27 @@ var MissionControlHook = class {
|
|
|
23187
23538
|
if (verification.passed) {
|
|
23188
23539
|
return this.handleMissionComplete(directory, verification);
|
|
23189
23540
|
}
|
|
23190
|
-
|
|
23191
|
-
|
|
23192
|
-
|
|
23193
|
-
|
|
23541
|
+
const loopState = readLoopState(directory);
|
|
23542
|
+
let isStagnant = false;
|
|
23543
|
+
if (loopState && loopState.active && loopState.sessionID === sessionID) {
|
|
23544
|
+
const currentProgress = verification.todoProgress;
|
|
23545
|
+
if (loopState.lastProgress === currentProgress) {
|
|
23546
|
+
loopState.stagnationCount = (loopState.stagnationCount || 0) + 1;
|
|
23547
|
+
if (loopState.stagnationCount >= 2) {
|
|
23548
|
+
isStagnant = true;
|
|
23549
|
+
}
|
|
23550
|
+
} else {
|
|
23551
|
+
loopState.stagnationCount = 0;
|
|
23552
|
+
}
|
|
23553
|
+
loopState.lastProgress = currentProgress;
|
|
23554
|
+
writeLoopState(directory, loopState);
|
|
23555
|
+
}
|
|
23194
23556
|
const failurePrompt = verification.checklistProgress !== "0/0" ? buildVerificationFailurePrompt(verification) : buildTodoIncompletePrompt(verification);
|
|
23195
23557
|
const continuation = this.buildContinuationResponse(session, sessionID);
|
|
23196
23558
|
const prompts = [failurePrompt];
|
|
23559
|
+
if (isStagnant) {
|
|
23560
|
+
prompts.push(STAGNATION_INTERVENTION);
|
|
23561
|
+
}
|
|
23197
23562
|
if (continuation.action === HOOK_ACTIONS.INJECT) {
|
|
23198
23563
|
prompts.push(...continuation.prompts);
|
|
23199
23564
|
}
|
|
@@ -24043,26 +24408,93 @@ function initializeHooks() {
|
|
|
24043
24408
|
const userActivity = new UserActivityHook();
|
|
24044
24409
|
const memoryGate = new MemoryGateHook();
|
|
24045
24410
|
const metricsHook = new MetricsHook();
|
|
24046
|
-
registry2.registerChat(userActivity
|
|
24047
|
-
|
|
24048
|
-
|
|
24049
|
-
|
|
24050
|
-
|
|
24051
|
-
registry2.
|
|
24052
|
-
|
|
24053
|
-
|
|
24054
|
-
|
|
24055
|
-
|
|
24056
|
-
|
|
24057
|
-
|
|
24058
|
-
registry2.
|
|
24059
|
-
|
|
24060
|
-
|
|
24411
|
+
registry2.registerChat(userActivity, {
|
|
24412
|
+
name: "user-activity",
|
|
24413
|
+
priority: 10,
|
|
24414
|
+
phase: "early"
|
|
24415
|
+
});
|
|
24416
|
+
registry2.registerChat(missionControl, {
|
|
24417
|
+
name: "mission-control",
|
|
24418
|
+
priority: 20,
|
|
24419
|
+
phase: "early",
|
|
24420
|
+
dependencies: ["user-activity"],
|
|
24421
|
+
errorHandling: "stop"
|
|
24422
|
+
});
|
|
24423
|
+
registry2.registerPreTool(roleGuard, {
|
|
24424
|
+
name: "role-guard",
|
|
24425
|
+
priority: 10,
|
|
24426
|
+
phase: "early",
|
|
24427
|
+
errorHandling: "stop"
|
|
24428
|
+
});
|
|
24429
|
+
registry2.registerPreTool(metricsHook, {
|
|
24430
|
+
name: "metrics-pre",
|
|
24431
|
+
priority: 90,
|
|
24432
|
+
phase: "late"
|
|
24433
|
+
});
|
|
24434
|
+
registry2.registerPostTool(sanityCheck, {
|
|
24435
|
+
name: "sanity-check",
|
|
24436
|
+
priority: 10,
|
|
24437
|
+
phase: "early",
|
|
24438
|
+
errorHandling: "stop"
|
|
24439
|
+
});
|
|
24440
|
+
registry2.registerPostTool(secretScanner, {
|
|
24441
|
+
name: "secret-scanner",
|
|
24442
|
+
priority: 20,
|
|
24443
|
+
phase: "early",
|
|
24444
|
+
dependencies: ["sanity-check"],
|
|
24445
|
+
errorHandling: "stop"
|
|
24446
|
+
});
|
|
24447
|
+
registry2.registerPostTool(agentUI, {
|
|
24448
|
+
name: "agent-ui",
|
|
24449
|
+
priority: 40,
|
|
24450
|
+
phase: "normal"
|
|
24451
|
+
});
|
|
24452
|
+
registry2.registerPostTool(resourceControl, {
|
|
24453
|
+
name: "resource-control",
|
|
24454
|
+
priority: 50,
|
|
24455
|
+
phase: "normal"
|
|
24456
|
+
});
|
|
24457
|
+
registry2.registerPostTool(memoryGate, {
|
|
24458
|
+
name: "memory-gate",
|
|
24459
|
+
priority: 60,
|
|
24460
|
+
phase: "normal"
|
|
24461
|
+
});
|
|
24462
|
+
registry2.registerPostTool(metricsHook, {
|
|
24463
|
+
name: "metrics-post",
|
|
24464
|
+
priority: 90,
|
|
24465
|
+
phase: "late",
|
|
24466
|
+
dependencies: ["metrics-pre"]
|
|
24467
|
+
});
|
|
24468
|
+
registry2.registerDone(sanityCheck, {
|
|
24469
|
+
name: "sanity-check",
|
|
24470
|
+
priority: 10,
|
|
24471
|
+
phase: "early"
|
|
24472
|
+
});
|
|
24473
|
+
registry2.registerDone(missionControl, {
|
|
24474
|
+
name: "mission-control",
|
|
24475
|
+
priority: 20,
|
|
24476
|
+
phase: "early"
|
|
24477
|
+
});
|
|
24478
|
+
registry2.registerDone(resourceControl, {
|
|
24479
|
+
name: "resource-control",
|
|
24480
|
+
priority: 50,
|
|
24481
|
+
phase: "normal"
|
|
24482
|
+
});
|
|
24483
|
+
registry2.registerDone(memoryGate, {
|
|
24484
|
+
name: "memory-gate",
|
|
24485
|
+
priority: 60,
|
|
24486
|
+
phase: "normal"
|
|
24487
|
+
});
|
|
24488
|
+
registry2.registerDone(metricsHook, {
|
|
24489
|
+
name: "metrics-done",
|
|
24490
|
+
priority: 90,
|
|
24491
|
+
phase: "late"
|
|
24492
|
+
});
|
|
24061
24493
|
}
|
|
24062
24494
|
|
|
24063
24495
|
// src/core/plugins/plugin-manager.ts
|
|
24064
|
-
import * as
|
|
24065
|
-
import * as
|
|
24496
|
+
import * as fs9 from "fs/promises";
|
|
24497
|
+
import * as path8 from "path";
|
|
24066
24498
|
init_shared();
|
|
24067
24499
|
var PluginManager = class _PluginManager {
|
|
24068
24500
|
static instance;
|
|
@@ -24086,13 +24518,13 @@ var PluginManager = class _PluginManager {
|
|
|
24086
24518
|
*/
|
|
24087
24519
|
async loadPlugins() {
|
|
24088
24520
|
if (!this.directory) return;
|
|
24089
|
-
const pluginsDir =
|
|
24521
|
+
const pluginsDir = path8.join(this.directory, PATHS.PLUGINS);
|
|
24090
24522
|
try {
|
|
24091
|
-
await
|
|
24092
|
-
const files = await
|
|
24523
|
+
await fs9.mkdir(pluginsDir, { recursive: true });
|
|
24524
|
+
const files = await fs9.readdir(pluginsDir);
|
|
24093
24525
|
for (const file2 of files) {
|
|
24094
24526
|
if (file2.endsWith(".js") || file2.endsWith(".mjs")) {
|
|
24095
|
-
await this.loadPlugin(
|
|
24527
|
+
await this.loadPlugin(path8.join(pluginsDir, file2));
|
|
24096
24528
|
}
|
|
24097
24529
|
}
|
|
24098
24530
|
} catch (error45) {
|
|
@@ -24201,17 +24633,17 @@ function createChatMessageHandler(ctx) {
|
|
|
24201
24633
|
init_shared();
|
|
24202
24634
|
|
|
24203
24635
|
// src/utils/compatibility/claude.ts
|
|
24204
|
-
import
|
|
24205
|
-
import
|
|
24636
|
+
import fs10 from "fs";
|
|
24637
|
+
import path9 from "path";
|
|
24206
24638
|
function findClaudeRules(startDir = process.cwd()) {
|
|
24207
24639
|
try {
|
|
24208
24640
|
let currentDir = startDir;
|
|
24209
|
-
const root =
|
|
24641
|
+
const root = path9.parse(startDir).root;
|
|
24210
24642
|
while (true) {
|
|
24211
|
-
const claudeMdPath =
|
|
24212
|
-
if (
|
|
24643
|
+
const claudeMdPath = path9.join(currentDir, "CLAUDE.md");
|
|
24644
|
+
if (fs10.existsSync(claudeMdPath)) {
|
|
24213
24645
|
try {
|
|
24214
|
-
const content =
|
|
24646
|
+
const content = fs10.readFileSync(claudeMdPath, "utf-8");
|
|
24215
24647
|
log(`[compatibility] Loaded CLAUDE.md from ${claudeMdPath}`);
|
|
24216
24648
|
return formatRules("CLAUDE.md", content);
|
|
24217
24649
|
} catch (e) {
|
|
@@ -24219,11 +24651,11 @@ function findClaudeRules(startDir = process.cwd()) {
|
|
|
24219
24651
|
}
|
|
24220
24652
|
}
|
|
24221
24653
|
if (currentDir === root) break;
|
|
24222
|
-
currentDir =
|
|
24654
|
+
currentDir = path9.dirname(currentDir);
|
|
24223
24655
|
}
|
|
24224
|
-
const copilotPath =
|
|
24225
|
-
if (
|
|
24226
|
-
return formatRules("Copilot Instructions",
|
|
24656
|
+
const copilotPath = path9.join(startDir, ".github", "copilot-instructions.md");
|
|
24657
|
+
if (fs10.existsSync(copilotPath)) {
|
|
24658
|
+
return formatRules("Copilot Instructions", fs10.readFileSync(copilotPath, "utf-8"));
|
|
24227
24659
|
}
|
|
24228
24660
|
return null;
|
|
24229
24661
|
} catch (error45) {
|
|
@@ -24352,22 +24784,6 @@ function hasRunningBackgroundTasks2(parentSessionID) {
|
|
|
24352
24784
|
return false;
|
|
24353
24785
|
}
|
|
24354
24786
|
}
|
|
24355
|
-
async function showCountdownToast2(client, seconds, iteration, maxIterations) {
|
|
24356
|
-
try {
|
|
24357
|
-
const tuiClient2 = client;
|
|
24358
|
-
if (tuiClient2.tui?.showToast) {
|
|
24359
|
-
await tuiClient2.tui.showToast({
|
|
24360
|
-
body: {
|
|
24361
|
-
title: "\u{1F504} Mission Loop",
|
|
24362
|
-
message: `Continuing in ${seconds}s... (iteration ${iteration}/${maxIterations})`,
|
|
24363
|
-
variant: TOAST_VARIANTS.WARNING,
|
|
24364
|
-
duration: TOAST_DURATION.EXTRA_SHORT
|
|
24365
|
-
}
|
|
24366
|
-
});
|
|
24367
|
-
}
|
|
24368
|
-
} catch {
|
|
24369
|
-
}
|
|
24370
|
-
}
|
|
24371
24787
|
async function showCompletedToast(client, state2) {
|
|
24372
24788
|
try {
|
|
24373
24789
|
const tuiClient2 = client;
|
|
@@ -24384,7 +24800,7 @@ async function showCompletedToast(client, state2) {
|
|
|
24384
24800
|
} catch {
|
|
24385
24801
|
}
|
|
24386
24802
|
}
|
|
24387
|
-
async function injectContinuation2(client, directory, sessionID, loopState) {
|
|
24803
|
+
async function injectContinuation2(client, directory, sessionID, loopState, customPrompt) {
|
|
24388
24804
|
const handlerState = getState4(sessionID);
|
|
24389
24805
|
if (handlerState.isAborting) return;
|
|
24390
24806
|
if (hasRunningBackgroundTasks2(sessionID)) return;
|
|
@@ -24395,7 +24811,12 @@ async function injectContinuation2(client, directory, sessionID, loopState) {
|
|
|
24395
24811
|
return;
|
|
24396
24812
|
}
|
|
24397
24813
|
const summary = buildVerificationSummary(verification);
|
|
24398
|
-
|
|
24814
|
+
let prompt = generateMissionContinuationPrompt(loopState, summary);
|
|
24815
|
+
if (customPrompt) {
|
|
24816
|
+
prompt = `${customPrompt}
|
|
24817
|
+
|
|
24818
|
+
${prompt}`;
|
|
24819
|
+
}
|
|
24399
24820
|
try {
|
|
24400
24821
|
client.session.prompt({
|
|
24401
24822
|
path: { id: sessionID },
|
|
@@ -24456,19 +24877,27 @@ async function handleMissionIdle(client, directory, sessionID, mainSessionID) {
|
|
|
24456
24877
|
await handleMissionComplete(client, directory, loopState);
|
|
24457
24878
|
return;
|
|
24458
24879
|
}
|
|
24459
|
-
|
|
24460
|
-
|
|
24461
|
-
|
|
24462
|
-
|
|
24463
|
-
|
|
24464
|
-
|
|
24880
|
+
const currentProgress = verification.todoProgress;
|
|
24881
|
+
let isStagnant = false;
|
|
24882
|
+
if (loopState.lastProgress === currentProgress) {
|
|
24883
|
+
loopState.stagnationCount = (loopState.stagnationCount || 0) + 1;
|
|
24884
|
+
if (loopState.stagnationCount >= 2) {
|
|
24885
|
+
isStagnant = true;
|
|
24886
|
+
log(`[${MISSION_CONTROL.LOG_SOURCE}-handler] Stagnation detected for ${sessionID} (${currentProgress}). Intervention ready.`);
|
|
24887
|
+
}
|
|
24888
|
+
} else {
|
|
24889
|
+
loopState.stagnationCount = 0;
|
|
24465
24890
|
}
|
|
24891
|
+
loopState.lastProgress = currentProgress;
|
|
24466
24892
|
const newState = incrementIteration(directory);
|
|
24467
24893
|
if (!newState) return;
|
|
24468
|
-
|
|
24894
|
+
newState.lastProgress = currentProgress;
|
|
24895
|
+
newState.stagnationCount = loopState.stagnationCount;
|
|
24896
|
+
writeLoopState(directory, newState);
|
|
24897
|
+
const countdownMsg = isStagnant ? "Stagnation Detected! Intervening..." : `Continuing in ${MISSION_CONTROL.DEFAULT_COUNTDOWN_SECONDS}s... (iteration ${newState.iteration}/${newState.maxIterations})`;
|
|
24469
24898
|
handlerState.countdownTimer = setTimeout(async () => {
|
|
24470
24899
|
cancelCountdown2(sessionID);
|
|
24471
|
-
await injectContinuation2(client, directory, sessionID, newState);
|
|
24900
|
+
await injectContinuation2(client, directory, sessionID, newState, isStagnant ? STAGNATION_INTERVENTION : void 0);
|
|
24472
24901
|
}, MISSION_CONTROL.DEFAULT_COUNTDOWN_SECONDS * 1e3);
|
|
24473
24902
|
}
|
|
24474
24903
|
function handleUserMessage2(sessionID) {
|
|
@@ -24761,7 +25190,7 @@ function createSystemTransformHandler(ctx) {
|
|
|
24761
25190
|
}
|
|
24762
25191
|
const systemAdditions = [];
|
|
24763
25192
|
if (isActiveLoop && loopState) {
|
|
24764
|
-
const { commander: commander2 } = await Promise.resolve().then(() => (
|
|
25193
|
+
const { commander: commander2 } = await Promise.resolve().then(() => (init_commander(), commander_exports));
|
|
24765
25194
|
systemAdditions.push(commander2.systemPrompt);
|
|
24766
25195
|
systemAdditions.push(buildMissionLoopSystemPrompt(loopState.iteration, loopState.maxIterations));
|
|
24767
25196
|
}
|