aiwcli 0.15.7 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -1125
- package/bin/run.js +0 -4
- package/dist/capabilities/installation/control-plane/clear-command.d.ts +2 -0
- package/dist/capabilities/installation/control-plane/clear-command.js +32 -3
- package/dist/capabilities/installation/control-plane/init-command.js +2 -2
- package/dist/capabilities/launch/contracts.d.ts +39 -4
- package/dist/capabilities/launch/control-plane/execute-launch.js +158 -119
- package/dist/capabilities/launch/runtime-core/launch-decisions.d.ts +82 -0
- package/dist/capabilities/launch/runtime-core/launch-decisions.js +202 -0
- package/dist/commands/branch.d.ts +1 -1
- package/dist/commands/branch.js +1 -1
- package/dist/commands/launch.d.ts +0 -5
- package/dist/commands/launch.js +2 -37
- package/dist/lib/config.js +1 -2
- package/dist/lib/context/context-store.js +28 -2
- package/dist/lib/core-installer.d.ts +1 -1
- package/dist/lib/core-installer.js +6 -27
- package/dist/lib/debug.d.ts +0 -10
- package/dist/lib/debug.js +0 -10
- package/dist/lib/env-sanitizer.d.ts +25 -0
- package/dist/lib/env-sanitizer.js +46 -0
- package/dist/lib/errors.d.ts +0 -13
- package/dist/lib/errors.js +0 -15
- package/dist/lib/git-exclude-manager.js +1 -1
- package/dist/lib/hooks/context-monitor-logic.d.ts +6 -0
- package/dist/lib/hooks/context-monitor-logic.js +25 -0
- package/dist/lib/hooks/hook-utils.js +11 -0
- package/dist/lib/hooks/prompt-binding-logic.d.ts +7 -0
- package/dist/lib/hooks/prompt-binding-logic.js +50 -0
- package/dist/lib/hooks/session-end-logic.js +2 -14
- package/dist/lib/install-state.js +6 -13
- package/dist/lib/json-io.d.ts +12 -0
- package/dist/lib/json-io.js +30 -0
- package/dist/lib/multiplexer.d.ts +43 -35
- package/dist/lib/multiplexer.js +21 -2
- package/dist/lib/multiplexers/psmux.d.ts +14 -34
- package/dist/lib/multiplexers/psmux.js +70 -130
- package/dist/lib/multiplexers/tmux.d.ts +11 -19
- package/dist/lib/multiplexers/tmux.js +79 -120
- package/dist/lib/multiplexers/wezterm.d.ts +38 -0
- package/dist/lib/multiplexers/wezterm.js +225 -0
- package/dist/lib/mux-utils.d.ts +4 -3
- package/dist/lib/mux-utils.js +7 -13
- package/dist/lib/prompt-file-manager.d.ts +23 -0
- package/dist/lib/prompt-file-manager.js +41 -0
- package/dist/lib/runtime/agent-launcher.d.ts +67 -0
- package/dist/lib/runtime/agent-launcher.js +262 -0
- package/dist/lib/runtime/aiw-cli.d.ts +2 -0
- package/dist/lib/runtime/aiw-cli.js +3 -1
- package/dist/lib/runtime/cli-args.d.ts +5 -2
- package/dist/lib/runtime/cli-args.js +18 -3
- package/dist/lib/runtime/inference.js +3 -14
- package/dist/lib/runtime/models.d.ts +6 -0
- package/dist/lib/runtime/models.js +6 -0
- package/dist/lib/runtime/state-io.d.ts +2 -1
- package/dist/lib/runtime/state-io.js +9 -4
- package/dist/lib/runtime/utils.d.ts +8 -0
- package/dist/lib/runtime/utils.js +31 -1
- package/dist/lib/schemas.d.ts +250 -0
- package/dist/lib/schemas.js +216 -0
- package/dist/lib/sentinel-manager.d.ts +32 -0
- package/dist/lib/sentinel-manager.js +62 -0
- package/dist/lib/sentinel-wrapper.d.ts +1 -0
- package/dist/lib/sentinel-wrapper.js +12 -3
- package/dist/lib/settings-hierarchy.js +3 -20
- package/dist/lib/shell-adapters/bash-adapter.d.ts +18 -0
- package/dist/lib/shell-adapters/bash-adapter.js +69 -0
- package/dist/lib/shell-adapters/index.d.ts +5 -0
- package/dist/lib/shell-adapters/index.js +7 -0
- package/dist/lib/shell-adapters/powershell-adapter.d.ts +18 -0
- package/dist/lib/shell-adapters/powershell-adapter.js +62 -0
- package/dist/lib/shell-adapters/shell-adapter.d.ts +45 -0
- package/dist/lib/shell-adapters/shell-adapter.js +5 -0
- package/dist/lib/spawn-errors.d.ts +3 -0
- package/dist/lib/spawn-errors.js +15 -1
- package/dist/lib/spinner.d.ts +0 -5
- package/dist/lib/spinner.js +0 -16
- package/dist/lib/template-installer.d.ts +10 -0
- package/dist/lib/template-installer.js +4 -4
- package/dist/lib/terminal-strategy.d.ts +1 -0
- package/dist/lib/terminal-strategy.js +12 -6
- package/dist/lib/terminal.d.ts +7 -5
- package/dist/lib/terminal.js +42 -19
- package/dist/lib/tmux-primitives.d.ts +0 -2
- package/dist/lib/tmux-primitives.js +0 -4
- package/dist/lib/tmux-session.js +2 -1
- package/dist/lib/windsurf-hooks-hierarchy.js +6 -23
- package/dist/platform/launch.d.ts +2 -1
- package/dist/platform/launch.js +1 -0
- package/dist/templates/CLAUDE.md +0 -1
- package/dist/templates/cc-native/.claude/settings.json +0 -10
- package/dist/templates/cc-native/TEMPLATE-SCHEMA.md +11 -4
- package/dist/templates/cc-native/_cc-native/cc-native.config.json +3 -7
- package/dist/templates/cc-native/_cc-native/hooks/CLAUDE.md +26 -47
- package/dist/templates/cc-native/_cc-native/hooks/cc-native-plan-review.ts +7 -9
- package/dist/templates/cc-native/_cc-native/hooks/enhance_plan_post_write.ts +2 -3
- package/dist/templates/cc-native/_cc-native/hooks/mark_questions_asked.ts +2 -2
- package/dist/templates/cc-native/_cc-native/hooks/plan_questions_early.ts +0 -25
- package/dist/templates/cc-native/_cc-native/hooks/validate_task_prompt.ts +4 -4
- package/dist/templates/cc-native/_cc-native/lib-ts/.mocharc.json +9 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/aggregate-agents.test.ts +118 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/artifacts.test.ts +234 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/cc-native-state.test.ts +170 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/cli-output-parser.test.ts +73 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/config.test.ts +64 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/constants.test.ts +40 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/debug.test.ts +42 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/exports.test.ts +58 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/helpers.ts +107 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/hooks/add-plan-context.hook.test.ts +97 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/hooks/plan-questions.hook.test.ts +81 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/hooks/plan-review.hook.test.ts +71 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/json-parser.test.ts +99 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/orchestrator-agent.test.ts +288 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/orchestrator.test.ts +48 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/reviewers.test.ts +32 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/state.test.ts +124 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/__tests__/verdict.test.ts +93 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/agent-selection.ts +163 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/aggregate-agents.ts +6 -14
- package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/format.ts +597 -599
- package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/index.ts +26 -26
- package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/tracker.ts +106 -107
- package/dist/templates/cc-native/_cc-native/{artifacts/lib → lib-ts/artifacts}/write.ts +118 -119
- package/dist/templates/cc-native/_cc-native/lib-ts/artifacts.ts +21 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/cc-native-state.ts +16 -15
- package/dist/templates/cc-native/_cc-native/lib-ts/cli-output-parser.ts +132 -10
- package/dist/templates/cc-native/_cc-native/lib-ts/constants.ts +6 -6
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/corroboration.ts +119 -119
- package/dist/templates/cc-native/_cc-native/lib-ts/debug.ts +1 -2
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/graduation.ts +132 -132
- package/dist/templates/cc-native/_cc-native/lib-ts/index.ts +88 -86
- package/dist/templates/cc-native/_cc-native/lib-ts/json-parser.ts +5 -6
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/orchestrator.ts +70 -70
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/output-builder.ts +130 -121
- package/dist/templates/cc-native/_cc-native/lib-ts/package-lock.json +1679 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/package.json +24 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/plan-discovery.ts +4 -4
- package/dist/templates/cc-native/_cc-native/lib-ts/plan-enhancement.ts +1 -6
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/plan-questions.ts +101 -101
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/review-pipeline.ts +511 -543
- package/dist/templates/cc-native/_cc-native/lib-ts/reviewers/__tests__/agent-providers.test.ts +262 -0
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/agent.ts +71 -85
- package/dist/templates/{core/lib-ts/agent-exec → cc-native/_cc-native/lib-ts/reviewers/base}/base-agent.ts +138 -152
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/index.ts +12 -12
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/claude-agent.ts +66 -57
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/codex-agent.ts +185 -200
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/gemini-agent.ts +39 -40
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/providers/orchestrator-claude-agent.ts +196 -224
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/schemas.ts +201 -201
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/reviewers/types.ts +21 -23
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/__tests__/hyde.test.ts +365 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/__tests__/ollama-client.test.ts +223 -0
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/embedding-indexer.ts +12 -16
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/hyde.ts +3 -2
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/index.ts +31 -31
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/logger.ts +6 -7
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/ollama-client.ts +7 -9
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/retrieval-pipeline.ts +14 -17
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-indexer.ts +37 -41
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-loader.ts +33 -43
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/transcript-searcher.ts +20 -20
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/types.ts +8 -9
- package/dist/templates/cc-native/_cc-native/lib-ts/rlm/vector-store.ts +3 -4
- package/dist/templates/cc-native/_cc-native/lib-ts/settings.ts +50 -126
- package/dist/templates/cc-native/_cc-native/lib-ts/state.ts +19 -21
- package/dist/templates/cc-native/_cc-native/lib-ts/types.ts +13 -88
- package/dist/templates/cc-native/_cc-native/{plan-review/lib → lib-ts}/verdict.ts +72 -72
- package/dist/templates/cc-native/_cc-native/plan-review/CLAUDE.md +35 -0
- package/dist/templates/cc-native/_cc-native/plan-review/lib/agent-selection.ts +1 -1
- package/dist/templates/cc-native/_cc-native/scripts/council_debate.ts +242 -0
- package/dist/templates/cc-native/_cc-native/scripts/council_debate_simple.ts +294 -0
- package/dist/templates/cc-native/_cc-native/{plan-review/workflows → workflows}/specdev.md +9 -9
- package/dist/templates/core/.claude/skills/codex/SKILL.md +25 -0
- package/dist/templates/core/.claude/skills/devin/SKILL.md +25 -0
- package/dist/templates/core/.claude/skills/handoff/SKILL.md +11 -0
- package/dist/templates/core/.claude/skills/handoff-resume/SKILL.md +11 -0
- package/dist/templates/core/.claude/skills/meta-plan/SKILL.md +13 -0
- package/dist/templates/core/.codex/skills/codex/SKILL.md +13 -0
- package/dist/templates/core/.codex/skills/devin/SKILL.md +19 -0
- package/dist/templates/core/.codex/skills/handoff/SKILL.md +11 -0
- package/dist/templates/core/.codex/skills/handoff-resume/SKILL.md +11 -0
- package/dist/templates/core/.codex/{workflows/meta-plan.md → skills/meta-plan/SKILL.md} +6 -0
- package/dist/templates/core/{.cognition → .devin}/AGENTS.md +2 -2
- package/dist/templates/core/.devin/skills/codex/SKILL.md +19 -0
- package/dist/templates/core/.devin/skills/devin/SKILL.md +13 -0
- package/dist/templates/core/.devin/skills/handoff/SKILL.md +11 -0
- package/dist/templates/core/.devin/skills/handoff-resume/SKILL.md +11 -0
- package/dist/templates/core/.devin/skills/meta-plan/SKILL.md +13 -0
- package/dist/templates/core/.windsurf/workflows/handoff-resume.md +9 -0
- package/dist/templates/core/hooks-ts/archive_plan.ts +1 -21
- package/dist/templates/core/hooks-ts/file-suggestion.ts +1 -19
- package/dist/templates/core/hooks-ts/pre_compact.ts +5 -18
- package/dist/templates/core/lib-ts/context/context-store.ts +29 -2
- package/dist/templates/core/lib-ts/hooks/hook-utils.ts +11 -0
- package/dist/templates/core/lib-ts/hooks/session-end-logic.ts +2 -13
- package/dist/templates/core/lib-ts/runtime/agent-launcher.ts +74 -0
- package/dist/templates/core/lib-ts/runtime/aiw-cli.ts +4 -2
- package/dist/templates/core/lib-ts/runtime/cli-args.ts +18 -4
- package/dist/templates/core/lib-ts/runtime/inference.ts +3 -15
- package/dist/templates/core/lib-ts/runtime/models.ts +7 -0
- package/dist/templates/core/lib-ts/runtime/state-io.ts +9 -4
- package/dist/templates/core/lib-ts/runtime/utils.ts +30 -1
- package/dist/templates/core/lib-ts/schemas.ts +233 -0
- package/dist/templates/core/scripts/resolve-run.ts +34 -2
- package/dist/templates/core/scripts/status_line.ts +1 -1
- package/dist/templates/core/skills/codex/CLAUDE.md +9 -4
- package/dist/templates/core/skills/codex/SKILL.md +6 -0
- package/dist/templates/core/skills/codex/lib/codex-watcher.ts +3 -10
- package/dist/templates/core/skills/codex/scripts/launch-codex.ts +26 -26
- package/dist/templates/core/skills/devin/CLAUDE.md +63 -6
- package/dist/templates/core/skills/devin/lib/devin-watcher.ts +116 -96
- package/dist/templates/core/skills/devin/scripts/launch-devin.ts +22 -21
- package/dist/templates/core/skills/handoff-system/CLAUDE.md +1 -1
- package/oclif.manifest.json +4 -4
- package/package.json +4 -4
- package/dist/lib/base-command.d.ts +0 -1
- package/dist/lib/base-command.js +0 -1
- package/dist/lib/env-compat.d.ts +0 -18
- package/dist/lib/env-compat.js +0 -23
- package/dist/lib/launch-options.d.ts +0 -1
- package/dist/lib/launch-options.js +0 -1
- package/dist/lib/stdin.d.ts +0 -48
- package/dist/lib/stdin.js +0 -60
- package/dist/templates/cc-native/_cc-native/CLAUDE.md +0 -73
- package/dist/templates/cc-native/_cc-native/artifacts/CLAUDE.md +0 -64
- package/dist/templates/cc-native/_cc-native/lib-ts/CLAUDE.md +0 -70
- package/dist/templates/cc-native/_cc-native/plan-review/CODING-STANDARDS-CHECKLIST.md +0 -75
- package/dist/templates/cc-native/_cc-native/plan-review/agents/CLAUDE.md +0 -143
- package/dist/templates/cc-native/_cc-native/plan-review/agents/PLAN-ORCHESTRATOR.md +0 -213
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-questions/PLAN-QUESTIONER.md +0 -70
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-EVOLUTION.md +0 -62
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-PATTERNS.md +0 -61
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ARCH-STRUCTURE.md +0 -62
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/ASSUMPTION-TRACER.md +0 -56
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/CLARITY-AUDITOR.md +0 -53
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-FEASIBILITY.md +0 -66
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-GAPS.md +0 -70
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/COMPLETENESS-ORDERING.md +0 -62
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/CONSTRAINT-VALIDATOR.md +0 -72
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DESIGN-ADR-VALIDATOR.md +0 -61
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DESIGN-SCALE-MATCHER.md +0 -64
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DEVILS-ADVOCATE.md +0 -56
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/DOCUMENTATION-PHILOSOPHY.md +0 -86
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/HANDOFF-READINESS.md +0 -59
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/HIDDEN-COMPLEXITY.md +0 -58
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/INCREMENTAL-DELIVERY.md +0 -66
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-DEPENDENCY.md +0 -62
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-FMEA.md +0 -66
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-PREMORTEM.md +0 -71
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/RISK-REVERSIBILITY.md +0 -74
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SCOPE-BOUNDARY.md +0 -77
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SIMPLICITY-GUARDIAN.md +0 -62
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/SKEPTIC.md +0 -68
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-BEHAVIOR-AUDITOR.md +0 -61
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-CHARACTERIZATION.md +0 -71
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-FIRST-VALIDATOR.md +0 -61
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TESTDRIVEN-PYRAMID-ANALYZER.md +0 -61
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TRADEOFF-COSTS.md +0 -67
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/TRADEOFF-STAKEHOLDERS.md +0 -65
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/VERIFY-COVERAGE.md +0 -74
- package/dist/templates/cc-native/_cc-native/plan-review/agents/plan-review/VERIFY-STRENGTH.md +0 -69
- package/dist/templates/cc-native/_cc-native/plan-review/lib/reviewers/base/base-agent.ts +0 -7
- package/dist/templates/core/.codex/workflows/codex.md +0 -17
- package/dist/templates/core/.codex/workflows/handoff.md +0 -5
- package/dist/templates/core/lib-ts/agent-exec/backends/headless.ts +0 -34
- package/dist/templates/core/lib-ts/agent-exec/backends/index.ts +0 -6
- package/dist/templates/core/lib-ts/agent-exec/backends/tmux.ts +0 -148
- package/dist/templates/core/lib-ts/agent-exec/execution-backend.ts +0 -50
- package/dist/templates/core/lib-ts/agent-exec/index.ts +0 -6
- package/dist/templates/core/lib-ts/agent-exec/structured-output.ts +0 -165
- /package/dist/templates/core/{.cognition → .devin}/config.json +0 -0
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Graduation logic: pass eligibility, pass streaks, graduation threshold, iteration advancement.
|
|
3
|
-
* Extracted from cc-native-plan-review.ts.
|
|
4
|
-
*/
|
|
5
|
-
|
|
6
|
-
import type {
|
|
7
|
-
IterationState,
|
|
8
|
-
ReviewerResult,
|
|
9
|
-
CombinedReviewResult,
|
|
10
|
-
IterationAdvancement,
|
|
11
|
-
} from "
|
|
12
|
-
|
|
13
|
-
// ---------------------------------------------------------------------------
|
|
14
|
-
// Pass Eligibility
|
|
15
|
-
// ---------------------------------------------------------------------------
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Determine which agents are pass-eligible this iteration.
|
|
19
|
-
* Criteria: verdict === "pass" OR zero high-severity issues.
|
|
20
|
-
* Agents with "skip"/"error" are NOT eligible (no signal).
|
|
21
|
-
*/
|
|
22
|
-
export function computePassEligible(agentResults: Record<string, ReviewerResult>): string[] {
|
|
23
|
-
const eligible: string[] = [];
|
|
24
|
-
for (const [name, result] of Object.entries(agentResults)) {
|
|
25
|
-
if (result.verdict === "skip" || result.verdict === "error") continue;
|
|
26
|
-
if (result.verdict === "pass") { eligible.push(name); continue; }
|
|
27
|
-
const issues = Array.isArray(result.data?.issues)
|
|
28
|
-
? (result.data.issues as Array<{ severity?: string }>) : [];
|
|
29
|
-
if (issues.filter(i => i.severity === "high").length === 0) {
|
|
30
|
-
eligible.push(name);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return eligible;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// ---------------------------------------------------------------------------
|
|
37
|
-
// Tracker Issue Extraction
|
|
38
|
-
// ---------------------------------------------------------------------------
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* Extract top high-severity issues for the review tracker.
|
|
42
|
-
*/
|
|
43
|
-
export function extractTopIssuesForTracker(
|
|
44
|
-
combined: CombinedReviewResult,
|
|
45
|
-
maxCount = 5,
|
|
46
|
-
): string[] {
|
|
47
|
-
const allReviewers = Object.values(combined.agents);
|
|
48
|
-
const issues: string[] = [];
|
|
49
|
-
for (const r of allReviewers) {
|
|
50
|
-
if (!r.data) continue;
|
|
51
|
-
const issueList = r.data.issues as Array<Record<string, unknown>> | undefined;
|
|
52
|
-
if (!issueList) continue;
|
|
53
|
-
for (const issue of issueList) {
|
|
54
|
-
if (issue.severity === "high") {
|
|
55
|
-
const text = String(issue.issue ?? "").trim();
|
|
56
|
-
if (text) {
|
|
57
|
-
issues.push(`[${r.name}] ${text}`);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
if (issues.length >= maxCount) break;
|
|
62
|
-
}
|
|
63
|
-
return issues.slice(0, maxCount);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
// ---------------------------------------------------------------------------
|
|
67
|
-
// Iteration Advancement
|
|
68
|
-
// ---------------------------------------------------------------------------
|
|
69
|
-
|
|
70
|
-
const GRADUATION_THRESHOLD = 2;
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Advance iteration state after a review cycle. Returns a new state copy
|
|
74
|
-
* (does not mutate input).
|
|
75
|
-
*
|
|
76
|
-
* - On pass/warrant: sets current past max (stop iterating)
|
|
77
|
-
* - On deny: increments current toward max (safety valve)
|
|
78
|
-
* - Updates pass streaks and graduates agents that reached threshold
|
|
79
|
-
*/
|
|
80
|
-
export function advanceIterationState(
|
|
81
|
-
state: IterationState,
|
|
82
|
-
planHash: string,
|
|
83
|
-
planPath: string,
|
|
84
|
-
verdict: string,
|
|
85
|
-
shouldDeny: boolean,
|
|
86
|
-
passEligible: string[],
|
|
87
|
-
agentResults: Record<string, ReviewerResult>,
|
|
88
|
-
graduationThreshold = GRADUATION_THRESHOLD,
|
|
89
|
-
): IterationAdvancement {
|
|
90
|
-
const updated: IterationState = {
|
|
91
|
-
...state,
|
|
92
|
-
history: [...state.history, { hash: planHash, verdict, timestamp: new Date().toISOString() }],
|
|
93
|
-
lastPlanHash: planHash,
|
|
94
|
-
lastPlanPath: planPath,
|
|
95
|
-
graduated: [...state.graduated],
|
|
96
|
-
passStreaks: { ...state.passStreaks },
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
if (!shouldDeny) {
|
|
100
|
-
// Pass/warrant: stop iterating
|
|
101
|
-
updated.current = updated.max + 1;
|
|
102
|
-
} else {
|
|
103
|
-
// Deny: advance toward max
|
|
104
|
-
updated.current = state.current + 1;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
// Update pass streaks — only for agents that actually ran this iteration
|
|
108
|
-
const passEligibleSet = new Set(passEligible);
|
|
109
|
-
const graduatedSet = new Set(updated.graduated);
|
|
110
|
-
|
|
111
|
-
for (const name of Object.keys(agentResults)) {
|
|
112
|
-
if (graduatedSet.has(name)) continue;
|
|
113
|
-
if (passEligibleSet.has(name)) {
|
|
114
|
-
updated.passStreaks[name] = (updated.passStreaks[name] ?? 0) + 1;
|
|
115
|
-
} else {
|
|
116
|
-
updated.passStreaks[name] = 0;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// Graduate agents that reached threshold
|
|
121
|
-
const newGraduates: string[] = [];
|
|
122
|
-
for (const [name, streak] of Object.entries(updated.passStreaks)) {
|
|
123
|
-
if (streak >= graduationThreshold && !graduatedSet.has(name)) {
|
|
124
|
-
newGraduates.push(name);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
if (newGraduates.length > 0) {
|
|
128
|
-
updated.graduated = [...updated.graduated, ...newGraduates];
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
return { updatedState: updated, newGraduates };
|
|
132
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Graduation logic: pass eligibility, pass streaks, graduation threshold, iteration advancement.
|
|
3
|
+
* Extracted from cc-native-plan-review.ts.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
IterationState,
|
|
8
|
+
ReviewerResult,
|
|
9
|
+
CombinedReviewResult,
|
|
10
|
+
IterationAdvancement,
|
|
11
|
+
} from "./types.js";
|
|
12
|
+
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// Pass Eligibility
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Determine which agents are pass-eligible this iteration.
|
|
19
|
+
* Criteria: verdict === "pass" OR zero high-severity issues.
|
|
20
|
+
* Agents with "skip"/"error" are NOT eligible (no signal).
|
|
21
|
+
*/
|
|
22
|
+
export function computePassEligible(agentResults: Record<string, ReviewerResult>): string[] {
|
|
23
|
+
const eligible: string[] = [];
|
|
24
|
+
for (const [name, result] of Object.entries(agentResults)) {
|
|
25
|
+
if (result.verdict === "skip" || result.verdict === "error") continue;
|
|
26
|
+
if (result.verdict === "pass") { eligible.push(name); continue; }
|
|
27
|
+
const issues = Array.isArray(result.data?.issues)
|
|
28
|
+
? (result.data.issues as Array<{ severity?: string }>) : [];
|
|
29
|
+
if (issues.filter(i => i.severity === "high").length === 0) {
|
|
30
|
+
eligible.push(name);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
return eligible;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// ---------------------------------------------------------------------------
|
|
37
|
+
// Tracker Issue Extraction
|
|
38
|
+
// ---------------------------------------------------------------------------
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Extract top high-severity issues for the review tracker.
|
|
42
|
+
*/
|
|
43
|
+
export function extractTopIssuesForTracker(
|
|
44
|
+
combined: CombinedReviewResult,
|
|
45
|
+
maxCount = 5,
|
|
46
|
+
): string[] {
|
|
47
|
+
const allReviewers = Object.values(combined.agents);
|
|
48
|
+
const issues: string[] = [];
|
|
49
|
+
for (const r of allReviewers) {
|
|
50
|
+
if (!r.data) continue;
|
|
51
|
+
const issueList = r.data.issues as Array<Record<string, unknown>> | undefined;
|
|
52
|
+
if (!issueList) continue;
|
|
53
|
+
for (const issue of issueList) {
|
|
54
|
+
if (issue.severity === "high") {
|
|
55
|
+
const text = String(issue.issue ?? "").trim();
|
|
56
|
+
if (text) {
|
|
57
|
+
issues.push(`[${r.name}] ${text}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (issues.length >= maxCount) break;
|
|
62
|
+
}
|
|
63
|
+
return issues.slice(0, maxCount);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// ---------------------------------------------------------------------------
|
|
67
|
+
// Iteration Advancement
|
|
68
|
+
// ---------------------------------------------------------------------------
|
|
69
|
+
|
|
70
|
+
const GRADUATION_THRESHOLD = 2;
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Advance iteration state after a review cycle. Returns a new state copy
|
|
74
|
+
* (does not mutate input).
|
|
75
|
+
*
|
|
76
|
+
* - On pass/warrant: sets current past max (stop iterating)
|
|
77
|
+
* - On deny: increments current toward max (safety valve)
|
|
78
|
+
* - Updates pass streaks and graduates agents that reached threshold
|
|
79
|
+
*/
|
|
80
|
+
export function advanceIterationState(
|
|
81
|
+
state: IterationState,
|
|
82
|
+
planHash: string,
|
|
83
|
+
planPath: string,
|
|
84
|
+
verdict: string,
|
|
85
|
+
shouldDeny: boolean,
|
|
86
|
+
passEligible: string[],
|
|
87
|
+
agentResults: Record<string, ReviewerResult>,
|
|
88
|
+
graduationThreshold = GRADUATION_THRESHOLD,
|
|
89
|
+
): IterationAdvancement {
|
|
90
|
+
const updated: IterationState = {
|
|
91
|
+
...state,
|
|
92
|
+
history: [...state.history, { hash: planHash, verdict, timestamp: new Date().toISOString() }],
|
|
93
|
+
lastPlanHash: planHash,
|
|
94
|
+
lastPlanPath: planPath,
|
|
95
|
+
graduated: [...state.graduated],
|
|
96
|
+
passStreaks: { ...(state.passStreaks ?? {}) },
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
if (!shouldDeny) {
|
|
100
|
+
// Pass/warrant: stop iterating
|
|
101
|
+
updated.current = updated.max + 1;
|
|
102
|
+
} else {
|
|
103
|
+
// Deny: advance toward max
|
|
104
|
+
updated.current = state.current + 1;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Update pass streaks — only for agents that actually ran this iteration
|
|
108
|
+
const passEligibleSet = new Set(passEligible);
|
|
109
|
+
const graduatedSet = new Set(updated.graduated);
|
|
110
|
+
|
|
111
|
+
for (const name of Object.keys(agentResults)) {
|
|
112
|
+
if (graduatedSet.has(name)) continue;
|
|
113
|
+
if (passEligibleSet.has(name)) {
|
|
114
|
+
updated.passStreaks[name] = (updated.passStreaks[name] ?? 0) + 1;
|
|
115
|
+
} else {
|
|
116
|
+
updated.passStreaks[name] = 0;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Graduate agents that reached threshold
|
|
121
|
+
const newGraduates: string[] = [];
|
|
122
|
+
for (const [name, streak] of Object.entries(updated.passStreaks)) {
|
|
123
|
+
if (streak >= graduationThreshold && !graduatedSet.has(name)) {
|
|
124
|
+
newGraduates.push(name);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (newGraduates.length > 0) {
|
|
128
|
+
updated.graduated = [...updated.graduated, ...newGraduates];
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return { updatedState: updated, newGraduates };
|
|
132
|
+
}
|
|
@@ -3,114 +3,116 @@
|
|
|
3
3
|
* Re-exports the public API from all modules.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
//
|
|
7
|
-
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
// Agent aggregation
|
|
31
|
-
export {
|
|
32
|
-
aggregateAgents,
|
|
33
|
-
extractBody,
|
|
34
|
-
extractFrontmatter,
|
|
35
|
-
} from "./aggregate-agents.js";
|
|
6
|
+
// Types & schemas
|
|
7
|
+
export type {
|
|
8
|
+
Verdict,
|
|
9
|
+
ReviewDecision,
|
|
10
|
+
ComplexityCategory,
|
|
11
|
+
ReviewIssue,
|
|
12
|
+
ReviewData,
|
|
13
|
+
ReviewerResult,
|
|
14
|
+
OrchestratorResult,
|
|
15
|
+
CombinedReviewResult,
|
|
16
|
+
ReviewDecisionResult,
|
|
17
|
+
AgentConfig,
|
|
18
|
+
OrchestratorConfig,
|
|
19
|
+
IterationState,
|
|
20
|
+
IterationEntry,
|
|
21
|
+
CcNativeState,
|
|
22
|
+
PlanReviewState,
|
|
23
|
+
QuestionsAskedState,
|
|
24
|
+
StuckDetectionState,
|
|
25
|
+
PlanReviewConfig,
|
|
26
|
+
DisplaySettings,
|
|
27
|
+
ReviewOptions,
|
|
28
|
+
Reviewer,
|
|
29
|
+
} from "./types.js";
|
|
36
30
|
|
|
37
|
-
// CC-native state
|
|
38
31
|
export {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
} from "./cc-native-state.js";
|
|
47
|
-
|
|
48
|
-
// CLI output parsing
|
|
49
|
-
export { parseCliOutput } from "./cli-output-parser.js";
|
|
50
|
-
|
|
51
|
-
// Configuration
|
|
52
|
-
export { getDisplaySettings, loadConfig } from "./config.js";
|
|
32
|
+
REVIEW_SCHEMA,
|
|
33
|
+
ORCHESTRATOR_SCHEMA,
|
|
34
|
+
REVIEW_PROMPT_PREFIX,
|
|
35
|
+
AGENT_REVIEW_PROMPT_PREFIX,
|
|
36
|
+
DEFAULT_DISPLAY,
|
|
37
|
+
DEFAULT_SANITIZATION,
|
|
38
|
+
} from "./types.js";
|
|
53
39
|
|
|
54
40
|
// Constants & security
|
|
55
41
|
export {
|
|
56
|
-
ENABLE_PLAN_NOTIFICATIONS,
|
|
57
42
|
ENABLE_ROBUST_PLAN_WRITES,
|
|
58
|
-
|
|
43
|
+
ENABLE_PLAN_NOTIFICATIONS,
|
|
44
|
+
PLANS_DIR,
|
|
59
45
|
MAX_PLAN_PATH_LENGTH,
|
|
46
|
+
MAX_ERROR_FILE_SIZE,
|
|
60
47
|
MAX_RETRY_ATTEMPTS,
|
|
61
|
-
MAX_TOTAL_RETRY_TIME_MS,
|
|
62
|
-
PLANS_DIR,
|
|
63
48
|
RETRY_BACKOFF_MS,
|
|
49
|
+
MAX_TOTAL_RETRY_TIME_MS,
|
|
64
50
|
validatePlanPath,
|
|
65
51
|
} from "./constants.js";
|
|
66
52
|
|
|
67
|
-
//
|
|
68
|
-
export {
|
|
53
|
+
// Verdict aggregation
|
|
54
|
+
export { worstVerdict, computeReviewDecision } from "./verdict.js";
|
|
69
55
|
|
|
70
56
|
// JSON parsing
|
|
71
|
-
export {
|
|
57
|
+
export { parseJsonMaybe, coerceToReview } from "./json-parser.js";
|
|
58
|
+
|
|
59
|
+
// CLI output parsing
|
|
60
|
+
export { parseCliOutput } from "./cli-output-parser.js";
|
|
61
|
+
|
|
62
|
+
// Configuration
|
|
63
|
+
export { loadConfig, getDisplaySettings } from "./config.js";
|
|
64
|
+
|
|
65
|
+
// Debug logging
|
|
66
|
+
export { debugLog, debugRaw, getDebugDir, cleanupDebugFolder } from "./debug.js";
|
|
67
|
+
|
|
68
|
+
// CC-native state
|
|
69
|
+
export {
|
|
70
|
+
getCcNativeState,
|
|
71
|
+
saveCcNativeState,
|
|
72
|
+
isPlanAlreadyReviewed,
|
|
73
|
+
wasPlanPreviouslyDenied,
|
|
74
|
+
markPlanReviewed,
|
|
75
|
+
wasQuestionsAsked,
|
|
76
|
+
markQuestionsAsked,
|
|
77
|
+
getStuckDetectionState,
|
|
78
|
+
updateStuckDetectionState,
|
|
79
|
+
} from "./cc-native-state.js";
|
|
72
80
|
|
|
73
81
|
// Iteration state
|
|
74
82
|
export {
|
|
75
|
-
DEFAULT_REVIEW_ITERATIONS,
|
|
76
|
-
deleteState,
|
|
77
|
-
getIterationState,
|
|
78
83
|
getStateFilePath,
|
|
79
84
|
loadState,
|
|
80
85
|
saveStateToPlan,
|
|
81
|
-
|
|
86
|
+
deleteState,
|
|
87
|
+
getIterationState,
|
|
82
88
|
updateIterationState,
|
|
89
|
+
shouldContinueIterating,
|
|
83
90
|
} from "./state.js";
|
|
84
91
|
|
|
85
|
-
//
|
|
86
|
-
export
|
|
87
|
-
AgentConfig,
|
|
88
|
-
CcNativeState,
|
|
89
|
-
CombinedReviewResult,
|
|
90
|
-
ComplexityCategory,
|
|
91
|
-
DisplaySettings,
|
|
92
|
-
IterationEntry,
|
|
93
|
-
IterationState,
|
|
94
|
-
OrchestratorConfig,
|
|
95
|
-
OrchestratorResult,
|
|
96
|
-
PlanReviewConfig,
|
|
97
|
-
PlanReviewState,
|
|
98
|
-
QuestionsAskedState,
|
|
99
|
-
ReviewData,
|
|
100
|
-
ReviewDecision,
|
|
101
|
-
ReviewDecisionResult,
|
|
102
|
-
Reviewer,
|
|
103
|
-
ReviewerResult,
|
|
104
|
-
ReviewIssue,
|
|
105
|
-
ReviewOptions,
|
|
106
|
-
Verdict,
|
|
107
|
-
} from "./types.js";
|
|
92
|
+
// Orchestrator
|
|
93
|
+
export { runOrchestrator, buildOrchestratorSchema } from "./orchestrator.js";
|
|
108
94
|
|
|
95
|
+
// Agent aggregation
|
|
109
96
|
export {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
97
|
+
aggregateAgents,
|
|
98
|
+
extractFrontmatter,
|
|
99
|
+
extractBody,
|
|
100
|
+
} from "./aggregate-agents.js";
|
|
101
|
+
|
|
102
|
+
// Artifacts
|
|
103
|
+
export {
|
|
104
|
+
formatReviewMarkdown,
|
|
105
|
+
formatCombinedMarkdown,
|
|
106
|
+
buildInlineReviewSummary,
|
|
107
|
+
extractTopIssuesText,
|
|
108
|
+
buildHighIssuesDocument,
|
|
109
|
+
generateReviewIndex,
|
|
110
|
+
buildCombinedJson,
|
|
111
|
+
writeCombinedArtifacts,
|
|
112
|
+
} from "./artifacts.js";
|
|
113
|
+
|
|
114
|
+
// Reviewers
|
|
115
|
+
export {
|
|
116
|
+
AgentReviewer,
|
|
117
|
+
runAgentReview,
|
|
118
|
+
} from "./reviewers/index.js";
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
* See cc-native-plan-review-spec.md §4.10-4.11
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { ReviewData, Verdict } from "./types.js";
|
|
7
6
|
import { logDebug, logWarn } from "../../_core/lib-ts/runtime/logger.js";
|
|
7
|
+
import type { ReviewData, Verdict } from "./types.js";
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Try strict JSON parse. If that fails, attempt to extract the first {...} block.
|
|
@@ -16,12 +16,12 @@ import { logDebug, logWarn } from "../../_core/lib-ts/runtime/logger.js";
|
|
|
16
16
|
export function parseJsonMaybe(
|
|
17
17
|
text: string,
|
|
18
18
|
requireFields?: string[],
|
|
19
|
-
):
|
|
19
|
+
): Record<string, unknown> | null {
|
|
20
20
|
const trimmed = text.trim();
|
|
21
21
|
if (!trimmed) return null;
|
|
22
22
|
|
|
23
|
-
let obj:
|
|
24
|
-
let parseMethod:
|
|
23
|
+
let obj: Record<string, unknown> | null = null;
|
|
24
|
+
let parseMethod: string | null = null;
|
|
25
25
|
|
|
26
26
|
// Strict parse
|
|
27
27
|
try {
|
|
@@ -93,7 +93,7 @@ export function parseJsonMaybe(
|
|
|
93
93
|
* @returns Tuple of [ok, verdict, normalizedData]
|
|
94
94
|
*/
|
|
95
95
|
export function coerceToReview(
|
|
96
|
-
obj:
|
|
96
|
+
obj: Record<string, unknown> | null,
|
|
97
97
|
defaultFixMsg = "Retry or check configuration.",
|
|
98
98
|
): [boolean, Verdict, ReviewData] {
|
|
99
99
|
if (!obj) {
|
|
@@ -144,7 +144,6 @@ export function coerceToReview(
|
|
|
144
144
|
`verdict=${obj.verdict}, issues_count=${Array.isArray(obj.issues) ? (obj.issues as unknown[]).length : 0}`,
|
|
145
145
|
);
|
|
146
146
|
}
|
|
147
|
-
|
|
148
147
|
if (!obj.issues) {
|
|
149
148
|
logDebug("coerce", "issues array empty or missing");
|
|
150
149
|
}
|
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Plan orchestrator — analyzes complexity and selects reviewer agents.
|
|
3
|
-
* Uses OrchestratorClaudeAgent (BaseCliAgent framework) for subprocess execution.
|
|
4
|
-
* See cc-native-plan-review-spec.md §4.8
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
// Re-export for backward compatibility (moved to reviewers/schemas.ts)
|
|
12
|
-
export { buildOrchestratorSchema } from "./reviewers/schemas.js";
|
|
13
|
-
|
|
14
|
-
// ---------------------------------------------------------------------------
|
|
15
|
-
// Orchestrator
|
|
16
|
-
// ---------------------------------------------------------------------------
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Run the orchestrator agent to analyze plan complexity and select reviewers.
|
|
20
|
-
* Never throws — returns fallback OrchestratorResult on failure.
|
|
21
|
-
*/
|
|
22
|
-
export async function runOrchestrator(
|
|
23
|
-
plan: string,
|
|
24
|
-
agentLibrary: AgentConfig[],
|
|
25
|
-
config: OrchestratorConfig,
|
|
26
|
-
settings:
|
|
27
|
-
mandatoryNames?: Set<string>,
|
|
28
|
-
): Promise<OrchestratorResult> {
|
|
29
|
-
logInfo("orchestrator", "Starting plan analysis...");
|
|
30
|
-
|
|
31
|
-
const mandatory = mandatoryNames ?? new Set<string>();
|
|
32
|
-
|
|
33
|
-
// Create a synthetic AgentConfig for the orchestrator
|
|
34
|
-
const orchestratorAgent: AgentConfig = {
|
|
35
|
-
name: "orchestrator",
|
|
36
|
-
model: config.model,
|
|
37
|
-
provider:
|
|
38
|
-
focus: "plan analysis and agent selection",
|
|
39
|
-
categories: [],
|
|
40
|
-
description: "Plan orchestrator",
|
|
41
|
-
system_prompt: "",
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
try {
|
|
45
|
-
const agent = new OrchestratorClaudeAgent(
|
|
46
|
-
orchestratorAgent,
|
|
47
|
-
agentLibrary,
|
|
48
|
-
mandatory,
|
|
49
|
-
settings,
|
|
50
|
-
config.timeout,
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
const result = await agent.review(plan);
|
|
54
|
-
|
|
55
|
-
logInfo("orchestrator", `Result: complexity=${result.complexity}, category=${result.category}, agents=${JSON.stringify(result.selected_agents)}`);
|
|
56
|
-
|
|
57
|
-
return result;
|
|
58
|
-
} catch (
|
|
59
|
-
logWarn("orchestrator", `Unexpected error: ${
|
|
60
|
-
const nonMandatory = agentLibrary.filter((a) => !mandatory.has(a.name));
|
|
61
|
-
const fallbackCount = settings.agentSelection?.fallbackCount ?? 2;
|
|
62
|
-
return {
|
|
63
|
-
complexity: "medium",
|
|
64
|
-
category: "code",
|
|
65
|
-
selected_agents: nonMandatory.slice(0, fallbackCount).map((a) => a.name),
|
|
66
|
-
reasoning: `Orchestrator failed: ${
|
|
67
|
-
error: String(
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* Plan orchestrator — analyzes complexity and selects reviewer agents.
|
|
3
|
+
* Uses OrchestratorClaudeAgent (BaseCliAgent framework) for subprocess execution.
|
|
4
|
+
* See cc-native-plan-review-spec.md §4.8
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { logInfo, logWarn } from "../../_core/lib-ts/runtime/logger.js";
|
|
8
|
+
import type { AgentConfig, OrchestratorConfig, OrchestratorResult } from "./types.js";
|
|
9
|
+
import { OrchestratorClaudeAgent } from "./reviewers/providers/orchestrator-claude-agent.js";
|
|
10
|
+
|
|
11
|
+
// Re-export for backward compatibility (moved to reviewers/schemas.ts)
|
|
12
|
+
export { buildOrchestratorSchema } from "./reviewers/schemas.js";
|
|
13
|
+
|
|
14
|
+
// ---------------------------------------------------------------------------
|
|
15
|
+
// Orchestrator
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Run the orchestrator agent to analyze plan complexity and select reviewers.
|
|
20
|
+
* Never throws — returns fallback OrchestratorResult on failure.
|
|
21
|
+
*/
|
|
22
|
+
export async function runOrchestrator(
|
|
23
|
+
plan: string,
|
|
24
|
+
agentLibrary: AgentConfig[],
|
|
25
|
+
config: OrchestratorConfig,
|
|
26
|
+
settings: Record<string, unknown>,
|
|
27
|
+
mandatoryNames?: Set<string>,
|
|
28
|
+
): Promise<OrchestratorResult> {
|
|
29
|
+
logInfo("orchestrator", "Starting plan analysis...");
|
|
30
|
+
|
|
31
|
+
const mandatory = mandatoryNames ?? new Set<string>();
|
|
32
|
+
|
|
33
|
+
// Create a synthetic AgentConfig for the orchestrator
|
|
34
|
+
const orchestratorAgent: AgentConfig = {
|
|
35
|
+
name: "orchestrator",
|
|
36
|
+
model: config.model,
|
|
37
|
+
provider: "claude",
|
|
38
|
+
focus: "plan analysis and agent selection",
|
|
39
|
+
categories: [],
|
|
40
|
+
description: "Plan orchestrator",
|
|
41
|
+
system_prompt: "",
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
try {
|
|
45
|
+
const agent = new OrchestratorClaudeAgent(
|
|
46
|
+
orchestratorAgent,
|
|
47
|
+
agentLibrary,
|
|
48
|
+
mandatory,
|
|
49
|
+
settings,
|
|
50
|
+
config.timeout,
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const result = await agent.review(plan);
|
|
54
|
+
|
|
55
|
+
logInfo("orchestrator", `Result: complexity=${result.complexity}, category=${result.category}, agents=${JSON.stringify(result.selected_agents)}`);
|
|
56
|
+
|
|
57
|
+
return result;
|
|
58
|
+
} catch (e) {
|
|
59
|
+
logWarn("orchestrator", `Unexpected error: ${e}`);
|
|
60
|
+
const nonMandatory = agentLibrary.filter((a) => !mandatory.has(a.name));
|
|
61
|
+
const fallbackCount = ((settings.agentSelection as Record<string, unknown>)?.fallbackCount as number) ?? 2;
|
|
62
|
+
return {
|
|
63
|
+
complexity: "medium",
|
|
64
|
+
category: "code",
|
|
65
|
+
selected_agents: nonMandatory.slice(0, fallbackCount).map((a) => a.name),
|
|
66
|
+
reasoning: `Orchestrator failed: ${e}`,
|
|
67
|
+
error: String(e),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|