MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / planViaModel

Method planViaModel

src/orchestration/engine.ts:130–143  ·  view source on GitHub ↗

Ask the planning model for the DAG as JSON.

(goal: string, signal?: AbortSignal)

Source from the content-addressed store, hash-verified

128
129 /** Ask the planning model for the DAG as JSON. */
130 private async planViaModel(goal: string, signal?: AbortSignal): Promise<RawPlan> {
131 const runner = getSubAgentRunner();
132 if (!runner) throw new Error('No sub-agent runner registered; orchestration requires the agent runtime.');
133
134 const prompt = `${PLANNER_SYSTEM}\n\n# Goal\n${goal}\n\nReturn the JSON plan now.`;
135 const res = await runner(prompt, {
136 maxIterations: 1,
137 signal,
138 sessionId: `orchestrator-plan-${Date.now()}`,
139 role: this.opts.plannerRole ?? 'planning',
140 });
141 if (!res.ok) throw new Error(`Planner failed: ${res.error ?? 'unknown'}`);
142 return parsePlanJson(res.finalText);
143 }
144
145 /** EXECUTE: run the DAG to completion. */
146 async execute(graph: TaskGraph, signal?: AbortSignal): Promise<ExecutionReport> {

Callers 1

decomposeMethod · 0.95

Calls 2

getSubAgentRunnerFunction · 0.85
parsePlanJsonFunction · 0.85

Tested by

no test coverage detected