@zhixuan92/multi-model-agent-mcp 0.1.4 → 0.3.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 CHANGED
@@ -1,6 +1,17 @@
1
1
  # @zhixuan92/multi-model-agent-mcp
2
2
 
3
- MCP stdio server for [`multi-model-agent`](https://github.com/zhixuan312/multi-model-agent). Exposes one tool — `delegate_tasks` — that runs work in parallel across multiple LLM providers (Claude, Codex, OpenAI-compatible) and auto-routes each task to the cheapest provider that can handle it.
3
+ MCP stdio server for [`multi-model-agent`](https://github.com/zhixuan312/multi-model-agent). Exposes four tools — `delegate_tasks`, `register_context_block`, `retry_tasks`, and `get_task_output` — that run work in parallel across multiple LLM providers (Claude, Codex, OpenAI-compatible) and auto-route each task to the cheapest provider that can handle it.
4
+
5
+ ## Features
6
+
7
+ - **Auto-routing**: routes each task by capability filter → quality tier → cheapest qualifying provider
8
+ - **Parallel execution**: independent tasks run concurrently via `Promise.all`
9
+ - **Escalation on failure**: auto-routed tasks walk the full provider chain on failure, stopping at the first success
10
+ - **Scratchpad salvage**: every termination path (incomplete, max_turns, timeout, error) populates output from the runner's scratchpad — no bare failures
11
+ - **Response pagination**: configurable `responseMode` (full/summary/auto) prevents Claude Code inline rendering limits on large combined outputs; use `get_task_output` to fetch individual results from summary-mode batches
12
+ - **Declare enumerable-deliverable coverage** (`expectedCoverage`) and get semantic incompleteness detection via re-prompting
13
+ - **Bounded post-hoc progress traces** (`includeProgressTrace`) for long-running task debugging
14
+ - **Visible cost and time savings**: `parentModel` + `savedCostUSD` per task; `timings` and `aggregateCost` batch-level aggregates for delegation ROI visibility
4
15
 
5
16
  ## How it works
6
17
 
@@ -121,27 +132,48 @@ Accepts an array of tasks and runs them concurrently. Auto-routes each task by c
121
132
  "tier": "reasoning",
122
133
  "requiredCapabilities": ["file_read", "file_write"],
123
134
  "tools": "full",
124
- "cwd": "/path/to/project"
135
+ "cwd": "/path/to/project",
136
+ "parentModel": "claude-sonnet-4-5",
137
+ "includeProgressTrace": true
125
138
  },
126
139
  {
127
140
  "prompt": "Write tests for the auth module.",
128
141
  "tier": "standard",
129
142
  "requiredCapabilities": ["file_read", "file_write", "grep"],
130
143
  "tools": "full",
131
- "cwd": "/path/to/project"
144
+ "cwd": "/path/to/project",
145
+ "expectedCoverage": {
146
+ "minSections": 3,
147
+ "sectionPattern": "^Test \\d+:",
148
+ "requiredMarkers": ["happy path", "edge case"]
149
+ }
132
150
  }
133
151
  ]
134
152
  }
135
153
  ```
136
154
 
137
- Per-task fields: `prompt`, `tier`, `requiredCapabilities`, `provider?`, `tools?`, `maxTurns?`, `timeoutMs?`, `cwd?`, `effort?`, `sandboxPolicy?`.
155
+ Per-task fields: `prompt`, `tier`, `requiredCapabilities`, `provider?`, `tools?`, `maxTurns?`, `timeoutMs?`, `cwd?`, `effort?`, `sandboxPolicy?`, `contextBlockIds?`, `expectedCoverage?`, `includeProgressTrace?`, `parentModel?`.
156
+
157
+ `expectedCoverage` supports `minSections?`, `sectionPattern?`, and `requiredMarkers?`. `includeProgressTrace` opts a task into returning its bounded post-hoc progress trace. `parentModel` lets the server estimate `savedCostUSD` relative to the calling model.
138
158
 
139
159
  Capabilities: `file_read`, `file_write`, `grep`, `glob`, `shell`, `web_search`, `web_fetch`.
140
160
 
141
161
  ## Security
142
162
 
143
- - File tools enforce a `cwd-only` sandbox by default — paths are resolved via `fs.realpath` and rejected if outside the task's `cwd`.
144
- - `runShell` is hard-disabled under `cwd-only`. Set `sandboxPolicy: 'none'` per-provider or per-task to opt in.
163
+ ### Sandbox enforcement
164
+
165
+ The default `sandboxPolicy: "cwd-only"` confines delegated sub-agents to the task's working directory. The check runs inside every file-tool call in the core `assertWithinCwd` helper — violations are surfaced to the model as normal tool errors, so the model can retry with a valid path rather than silently failing.
166
+
167
+ 1. **File reads** are allowed only inside `cwd` and its descendants. Path traversal (`../`, absolute paths outside `cwd`) is rejected.
168
+ 2. **File writes** are subject to the same restriction.
169
+ 3. **Symlink resolution uses `fs.realpath`.** A symlink inside `cwd` that points outside `cwd` is treated as outside and rejected — the check runs on the resolved real path, not the literal path.
170
+ 4. **Nonexistent target paths** resolve by walking back to the nearest existing ancestor and re-applying the check, so symlinks in ancestor directories are still caught.
171
+ 5. **`runShell` is hard-disabled** under `cwd-only`. The tool returns an error telling the model to use `readFile` / `writeFile` / `grep` / `glob` / `listFiles` instead. Set `sandboxPolicy: "none"` per-provider or per-task to opt in to shell.
172
+ 6. **The check is per-call**, not per-session. Every tool invocation revalidates.
173
+ 7. **Errors are surfaced to the model**, not silently swallowed, so the model can observe the rejection and adjust.
174
+
175
+ ### Other hardening
176
+
145
177
  - `readFile` rejects targets larger than 50 MiB; `writeFile` rejects content larger than 100 MiB.
146
178
  - The server warns at config-load time if it sees an inline `apiKey` instead of `apiKeyEnv`.
147
179
  - The server warns once if `~/.codex/auth.json` is group- or world-readable.
package/dist/cli.d.ts CHANGED
@@ -2,18 +2,21 @@
2
2
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
3
  import { z } from 'zod';
4
4
  import { runTasks } from '@zhixuan92/multi-model-agent-core/run-tasks';
5
- import type { MultiModelConfig } from '@zhixuan92/multi-model-agent-core';
5
+ import type { MultiModelConfig, RunResult, BatchTimings, BatchProgress, BatchAggregateCost } from '@zhixuan92/multi-model-agent-core';
6
6
  export declare const SERVER_NAME = "multi-model-agent";
7
- export declare const SERVER_VERSION = "0.1.0";
7
+ export declare function computeTimings(wallClockMs: number, results: RunResult[]): BatchTimings;
8
+ export declare function computeBatchProgress(results: RunResult[]): BatchProgress;
9
+ export declare function computeAggregateCost(results: RunResult[]): BatchAggregateCost;
10
+ export declare const SERVER_VERSION: string;
8
11
  export declare function buildTaskSchema(availableProviders: [string, ...string[]]): z.ZodObject<{
9
12
  prompt: z.ZodString;
10
13
  provider: z.ZodOptional<z.ZodEnum<{
11
14
  [x: string]: string;
12
15
  }>>;
13
16
  tier: z.ZodEnum<{
14
- trivial: "trivial";
15
- standard: "standard";
16
17
  reasoning: "reasoning";
18
+ standard: "standard";
19
+ trivial: "trivial";
17
20
  }>;
18
21
  requiredCapabilities: z.ZodArray<z.ZodEnum<{
19
22
  file_read: "file_read";
@@ -25,24 +28,40 @@ export declare function buildTaskSchema(availableProviders: [string, ...string[]
25
28
  web_fetch: "web_fetch";
26
29
  }>>;
27
30
  tools: z.ZodOptional<z.ZodEnum<{
28
- none: "none";
29
31
  full: "full";
32
+ none: "none";
30
33
  }>>;
31
34
  maxTurns: z.ZodOptional<z.ZodNumber>;
32
35
  timeoutMs: z.ZodOptional<z.ZodNumber>;
33
36
  cwd: z.ZodOptional<z.ZodString>;
34
37
  effort: z.ZodOptional<z.ZodEnum<{
35
- low: "low";
36
- medium: "medium";
37
38
  high: "high";
39
+ medium: "medium";
40
+ low: "low";
38
41
  none: "none";
39
42
  }>>;
40
43
  sandboxPolicy: z.ZodOptional<z.ZodEnum<{
41
44
  none: "none";
42
45
  "cwd-only": "cwd-only";
43
46
  }>>;
47
+ contextBlockIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
48
+ expectedCoverage: z.ZodOptional<z.ZodObject<{
49
+ minSections: z.ZodOptional<z.ZodNumber>;
50
+ sectionPattern: z.ZodOptional<z.ZodString>;
51
+ requiredMarkers: z.ZodOptional<z.ZodArray<z.ZodString>>;
52
+ }, z.core.$strip>>;
53
+ includeProgressTrace: z.ZodOptional<z.ZodBoolean>;
54
+ parentModel: z.ZodOptional<z.ZodString>;
44
55
  }, z.core.$strip>;
45
- export declare function buildMcpServer(config: Parameters<typeof runTasks>[1]): McpServer;
56
+ export declare function buildMcpServer(config: Parameters<typeof runTasks>[1], options?: {
57
+ /** Character threshold that triggers auto-switch from 'full' to
58
+ * 'summary' response mode when the caller uses `responseMode: 'auto'`
59
+ * (the default). Defaults to 65_536, tuned for Claude Code's inline
60
+ * rendering limit. Precedence (highest first): env var
61
+ * MULTI_MODEL_LARGE_RESPONSE_THRESHOLD_CHARS > config file
62
+ * defaults.largeResponseThresholdChars > this option > default. */
63
+ largeResponseThresholdChars?: number;
64
+ }): McpServer;
46
65
  /**
47
66
  * MCP CLI config discovery (owned by MCP, not core):
48
67
  * 1. --config <path> argument (explicit)
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAMA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AACvE,OAAO,KAAK,EAAE,gBAAgB,EAAY,MAAM,mCAAmC,CAAC;AAGpF,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAC/C,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC,wBAAgB,eAAe,CAAC,kBAAkB,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAkBxE;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,aAyCpE;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAuBhE"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAQA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AAEvE,OAAO,KAAK,EACV,gBAAgB,EAGhB,SAAS,EACT,YAAY,EACZ,aAAa,EACb,kBAAkB,EACnB,MAAM,mCAAmC,CAAC;AAG3C,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAc/C,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,YAAY,CAItF;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,aAAa,CAgBxE;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,kBAAkB,CAyB7E;AAwFD,eAAO,MAAM,cAAc,QAAc,CAAC;AAE1C,wBAAgB,eAAe,CAAC,kBAAkB,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAwCxE;AAkCD,wBAAgB,cAAc,CAC5B,MAAM,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,EACtC,OAAO,CAAC,EAAE;IACR;;;;;wEAKoE;IACpE,2BAA2B,CAAC,EAAE,MAAM,CAAC;CACtC,aAoXF;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAuBhE"}
package/dist/cli.js CHANGED
@@ -2,6 +2,8 @@
2
2
  import fs from 'fs';
3
3
  import path from 'path';
4
4
  import os from 'os';
5
+ import { randomUUID, createHash } from 'node:crypto';
6
+ import { createRequire } from 'node:module';
5
7
  import { fileURLToPath } from 'url';
6
8
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
7
9
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
@@ -9,9 +11,128 @@ import { z } from 'zod';
9
11
  import { loadConfigFromFile } from '@zhixuan92/multi-model-agent-core/config/load';
10
12
  import { parseConfig } from '@zhixuan92/multi-model-agent-core/config/schema';
11
13
  import { runTasks } from '@zhixuan92/multi-model-agent-core/run-tasks';
14
+ import { InMemoryContextBlockStore } from '@zhixuan92/multi-model-agent-core';
12
15
  import { renderProviderRoutingMatrix } from './routing/render-provider-routing-matrix.js';
13
16
  export const SERVER_NAME = 'multi-model-agent';
14
- export const SERVER_VERSION = '0.1.0';
17
+ const DEFAULT_LARGE_RESPONSE_THRESHOLD_CHARS = 65_536;
18
+ function parsePositiveInt(s) {
19
+ if (!s)
20
+ return undefined;
21
+ const n = Number.parseInt(s, 10);
22
+ if (Number.isFinite(n) && n > 0 && String(n) === s.trim())
23
+ return n;
24
+ return undefined;
25
+ }
26
+ function sha256Hex(text) {
27
+ return createHash('sha256').update(text).digest('hex');
28
+ }
29
+ export function computeTimings(wallClockMs, results) {
30
+ const sumOfTaskMs = results.reduce((sum, r) => sum + (r.durationMs ?? 0), 0);
31
+ const estimatedParallelSavingsMs = Math.max(0, sumOfTaskMs - wallClockMs);
32
+ return { wallClockMs, sumOfTaskMs, estimatedParallelSavingsMs };
33
+ }
34
+ export function computeBatchProgress(results) {
35
+ const totalTasks = results.length;
36
+ const completedTasks = results.filter((r) => r.status === 'ok').length;
37
+ const incompleteTasks = results.filter((r) => r.status === 'incomplete' || r.status === 'max_turns' || r.status === 'timeout').length;
38
+ const failedTasks = results.filter((r) => r.status === 'error' ||
39
+ r.status === 'api_aborted' ||
40
+ r.status === 'api_error' ||
41
+ r.status === 'network_error').length;
42
+ const successPercent = totalTasks === 0 ? 0 : Math.round((completedTasks / totalTasks) * 1000) / 10;
43
+ return { totalTasks, completedTasks, incompleteTasks, failedTasks, successPercent };
44
+ }
45
+ export function computeAggregateCost(results) {
46
+ let totalActualCostUSD = 0;
47
+ let totalSavedCostUSD = 0;
48
+ let actualCostUnavailableTasks = 0;
49
+ let savedCostUnavailableTasks = 0;
50
+ for (const r of results) {
51
+ if (r.usage.costUSD === null || r.usage.costUSD === undefined) {
52
+ actualCostUnavailableTasks += 1;
53
+ }
54
+ else {
55
+ totalActualCostUSD += r.usage.costUSD;
56
+ }
57
+ if (r.usage.savedCostUSD === null || r.usage.savedCostUSD === undefined) {
58
+ savedCostUnavailableTasks += 1;
59
+ }
60
+ else {
61
+ totalSavedCostUSD += r.usage.savedCostUSD;
62
+ }
63
+ }
64
+ return {
65
+ totalActualCostUSD,
66
+ totalSavedCostUSD,
67
+ actualCostUnavailableTasks,
68
+ savedCostUnavailableTasks,
69
+ };
70
+ }
71
+ function buildFullResponse(batchId, tasks, results, aggregates) {
72
+ return {
73
+ batchId,
74
+ mode: 'full',
75
+ timings: aggregates.timings,
76
+ batchProgress: aggregates.batchProgress,
77
+ aggregateCost: aggregates.aggregateCost,
78
+ results: results.map((r, i) => ({
79
+ provider: tasks[i].provider ?? '(auto)',
80
+ status: r.status,
81
+ output: r.output,
82
+ turns: r.turns,
83
+ durationMs: r.durationMs,
84
+ filesRead: r.filesRead,
85
+ filesWritten: r.filesWritten,
86
+ directoriesListed: r.directoriesListed,
87
+ toolCalls: r.toolCalls,
88
+ escalationLog: r.escalationLog,
89
+ usage: r.usage,
90
+ ...(r.progressTrace && { progressTrace: r.progressTrace }),
91
+ ...(r.error && { error: r.error }),
92
+ })),
93
+ };
94
+ }
95
+ function buildSummaryResponse(batchId, tasks, results, opts) {
96
+ return {
97
+ batchId,
98
+ mode: 'summary',
99
+ ...(opts.autoEscaped && {
100
+ note: `Combined output was ${opts.totalOutputChars} chars (threshold: ${opts.threshold}). Auto-switched to summary mode. Use get_task_output({ batchId, taskIndex }) to fetch individual task outputs.`,
101
+ }),
102
+ timings: opts.timings,
103
+ batchProgress: opts.batchProgress,
104
+ aggregateCost: opts.aggregateCost,
105
+ results: results.map((r, i) => ({
106
+ taskIndex: i,
107
+ provider: tasks[i].provider ?? '(auto)',
108
+ status: r.status,
109
+ outputLength: r.output.length,
110
+ outputSha256: sha256Hex(r.output),
111
+ turns: r.turns,
112
+ durationMs: r.durationMs,
113
+ filesRead: r.filesRead,
114
+ filesWritten: r.filesWritten,
115
+ directoriesListed: r.directoriesListed,
116
+ toolCalls: r.toolCalls,
117
+ escalationLog: r.escalationLog,
118
+ usage: r.usage,
119
+ ...(r.progressTrace && { progressTrace: r.progressTrace }),
120
+ ...(r.error && { error: r.error }),
121
+ _fetchWith: `get_task_output({ batchId: "${batchId}", taskIndex: ${i} })`,
122
+ })),
123
+ };
124
+ }
125
+ // Read the version from package.json at module load so the MCP server
126
+ // metadata (and tests that assert against it) stays in lockstep with the
127
+ // published npm package version. `createRequire` keeps the JSON read
128
+ // outside tsc's `rootDir: src` constraint and avoids the `with { type:
129
+ // 'json' }` import attribute (which would force us to commit to a
130
+ // specific TS/Node module-resolution combination). The relative path is
131
+ // resolved from the compiled `dist/cli.js` — that sits one level below
132
+ // `packages/mcp/package.json`.
133
+ const packageRequire = createRequire(import.meta.url);
134
+ const pkg = packageRequire('../package.json');
135
+ export const SERVER_VERSION = pkg.version;
15
136
  export function buildTaskSchema(availableProviders) {
16
137
  return z.object({
17
138
  prompt: z.string().describe('Task prompt for the sub-agent'),
@@ -29,37 +150,358 @@ export function buildTaskSchema(availableProviders) {
29
150
  effort: z.enum(['none', 'low', 'medium', 'high']).optional()
30
151
  .describe("Reasoning effort."),
31
152
  sandboxPolicy: z.enum(['none', 'cwd-only']).optional().describe('File-system confinement policy. Default: cwd-only'),
153
+ contextBlockIds: z.array(z.string()).optional().describe('Optional context block ids previously stored via register_context_block. ' +
154
+ 'The server resolves each id to its stored content and prepends the blocks ' +
155
+ '(in order, separated by "\\n\\n---\\n\\n") to `prompt` before dispatch. ' +
156
+ 'Use this to avoid re-transmitting long briefs across multiple calls.'),
157
+ expectedCoverage: z.object({
158
+ minSections: z.number().int().positive().optional()
159
+ .describe('Minimum section count expected in the output.'),
160
+ sectionPattern: z.string().optional()
161
+ .describe('Regex for section headings, applied with the multiline flag.'),
162
+ requiredMarkers: z.array(z.string()).optional()
163
+ .describe('Substrings that must all appear somewhere in the output.'),
164
+ }).optional().describe('Optional caller-declared output expectations used for semantic incompleteness detection.'),
165
+ includeProgressTrace: z.boolean().optional().describe('Opt in to returning the bounded post-hoc progress trace for this task.'),
166
+ parentModel: z.string().optional().describe('Optional parent-session model identifier used to estimate savedCostUSD.'),
32
167
  });
33
168
  }
34
- export function buildMcpServer(config) {
169
+ /**
170
+ * Batch cache for `retry_tasks`. Every `delegate_tasks` call stashes the
171
+ * original `TaskSpec[]` under a UUID so the caller can later ask us to
172
+ * re-dispatch specific indices without re-transmitting the briefs. Two
173
+ * bounds:
174
+ *
175
+ * - TTL (30 min from creation): keeps stale batches from lingering
176
+ * through a long session. TTL is from-creation (not from-last-access),
177
+ * matching `InMemoryContextBlockStore` — a batch used at minute 29
178
+ * still dies at minute 30. Access does NOT refresh the expiry.
179
+ * - LRU cap (100 entries): prevents unbounded growth from a chatty
180
+ * caller that never retries. Eviction is true LRU (least-recently-
181
+ * *used*, not least-recently-inserted): a batch that is still being
182
+ * retried stays hot and a newer but unused batch will be evicted
183
+ * first. This matters when a caller is iterating on one task while
184
+ * dispatching unrelated batches in parallel.
185
+ *
186
+ * Eviction on TTL is lazy (checked on `retry_tasks` lookup). Eviction on
187
+ * the LRU cap is eager (runs after every `rememberBatch`).
188
+ *
189
+ * LRU implementation note: we use JavaScript's `Map` which preserves
190
+ * insertion order on iteration. To "touch" an entry on access, we
191
+ * `delete` it and re-`set` it, which moves it to the end of the
192
+ * iteration order. `Map.keys().next().value` is then the oldest-*accessed*
193
+ * entry (not the oldest-inserted entry), giving us O(1) LRU without a
194
+ * separate priority structure. The helpers `touchBatch` (on access) and
195
+ * the eviction loop in `rememberBatch` (on insert) are the only two
196
+ * places that mutate the Map.
197
+ */
198
+ const BATCH_TTL_MS = 30 * 60 * 1000;
199
+ const BATCH_MAX = 100;
200
+ export function buildMcpServer(config, options) {
35
201
  const providerKeys = Object.keys(config.providers);
36
202
  if (providerKeys.length === 0) {
37
203
  throw new Error('buildMcpServer requires at least one configured provider.');
38
204
  }
205
+ // Resolve the threshold once at server startup
206
+ const envThreshold = parsePositiveInt(process.env.MULTI_MODEL_LARGE_RESPONSE_THRESHOLD_CHARS);
207
+ if (process.env.MULTI_MODEL_LARGE_RESPONSE_THRESHOLD_CHARS !== undefined && envThreshold === undefined) {
208
+ process.stderr.write(`[multi-model-agent] warning: MULTI_MODEL_LARGE_RESPONSE_THRESHOLD_CHARS=${process.env.MULTI_MODEL_LARGE_RESPONSE_THRESHOLD_CHARS} is not a positive integer, ignoring\n`);
209
+ }
210
+ const resolvedThreshold = envThreshold
211
+ ?? config.defaults.largeResponseThresholdChars
212
+ ?? options?.largeResponseThresholdChars
213
+ ?? DEFAULT_LARGE_RESPONSE_THRESHOLD_CHARS;
39
214
  const server = new McpServer({
40
215
  name: SERVER_NAME,
41
216
  version: SERVER_VERSION,
42
217
  });
218
+ // One context-block store per server instance. Persists across calls
219
+ // within a single `buildMcpServer(...)` lifetime so `register_context_block`
220
+ // followed by multiple `delegate_tasks` with `contextBlockIds` works.
221
+ const contextBlockStore = new InMemoryContextBlockStore();
222
+ // Per-server batch cache for `retry_tasks`. See the LRU comment block
223
+ // above for eviction semantics.
224
+ const batchCache = new Map();
225
+ const rememberBatch = (tasks) => {
226
+ const id = randomUUID();
227
+ batchCache.set(id, { tasks, expiresAt: Date.now() + BATCH_TTL_MS });
228
+ // Evict the least-recently-USED entry (not least-recently-inserted).
229
+ // `touchBatch` below moves accessed entries to the end of insertion
230
+ // order, so `keys().next().value` is the true LRU head.
231
+ while (batchCache.size > BATCH_MAX) {
232
+ const lru = batchCache.keys().next().value;
233
+ if (lru)
234
+ batchCache.delete(lru);
235
+ else
236
+ break;
237
+ }
238
+ return id;
239
+ };
240
+ /**
241
+ * Mark a batch as recently used by reinserting it at the tail of the
242
+ * Map's iteration order. `touchBatch` is called on every successful
243
+ * `retry_tasks` lookup so a frequently-retried batch does not get
244
+ * evicted by `rememberBatch`'s LRU loop. Does NOT refresh the TTL —
245
+ * expiry stays at the original creation time.
246
+ */
247
+ const touchBatch = (id, entry) => {
248
+ batchCache.delete(id);
249
+ batchCache.set(id, entry);
250
+ };
43
251
  const availableProviders = providerKeys;
44
252
  server.tool('delegate_tasks', renderProviderRoutingMatrix(config), {
45
253
  tasks: z.array(buildTaskSchema(availableProviders)).describe('Array of tasks to execute in parallel'),
46
- }, async ({ tasks }) => {
47
- const results = await runTasks(tasks, config);
48
- const response = {
49
- results: results.map((r, i) => ({
50
- provider: tasks[i].provider ?? '(auto)',
51
- status: r.status,
52
- output: r.output,
53
- turns: r.turns,
54
- files: r.files,
55
- usage: r.usage,
56
- ...(r.error && { error: r.error }),
57
- })),
254
+ responseMode: z.enum(['full', 'summary', 'auto']).optional().describe(`How to shape the response envelope. 'full' (default via 'auto') includes each task's output inline. ` +
255
+ `'summary' returns per-task metadata + outputLength + outputSha256, with full outputs fetchable via ` +
256
+ `get_task_output. 'auto' (the default) returns 'full' when combined output fits under the server's ` +
257
+ `threshold (default 65 KB; configurable via env / config / buildMcpServer option), otherwise 'summary' ` +
258
+ `with an auto-escape note.`),
259
+ }, async ({ tasks, responseMode = 'auto' }, extra) => {
260
+ // --- OQ#6 resolution: MCP SDK progress notification API ---
261
+ //
262
+ // The @modelcontextprotocol/sdk >= 1.x exposes progress notifications
263
+ // on the tool-handler `extra` argument: the second parameter of the
264
+ // tool callback is `RequestHandlerExtra<ServerRequest, ServerNotification>`
265
+ // (see node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.d.ts
266
+ // line 173, and server/mcp.d.ts line 250 for `BaseToolCallback`).
267
+ //
268
+ // That type carries two things we need:
269
+ // 1. `extra._meta.progressToken?: string | number` — present iff the
270
+ // client opted in by sending `_meta.progressToken` with its
271
+ // `tools/call` request (MCP spec: notifications/progress).
272
+ // 2. `extra.sendNotification(notification)` — a request-scoped sender
273
+ // that emits `ServerNotification`s correlated with this call.
274
+ // `ServerNotification` is a union that includes
275
+ // `ProgressNotificationSchema` with method `"notifications/progress"`
276
+ // and params `{ progressToken, progress, total?, message? }`
277
+ // (types.d.ts line 954).
278
+ //
279
+ // So the bridge is: for each `ProgressEvent` we receive from core, if
280
+ // the client supplied a `progressToken`, emit one `notifications/progress`
281
+ // message whose `message` field is a JSON-encoded envelope. This is an
282
+ // opt-in channel — clients that don't send `progressToken` get zero
283
+ // notifications, preserving behavior for pre-streaming callers.
284
+ //
285
+ // Envelope schema (stable, documented here so clients can parse it):
286
+ //
287
+ // params: {
288
+ // progressToken, // echoed from the request _meta
289
+ // progress: <monotonic counter>,// ordinal of this event (1-based)
290
+ // message: JSON.stringify({
291
+ // taskIndex: <number>, // index in the original `tasks` array
292
+ // event: <ProgressEvent>, // full ProgressEvent union member
293
+ // }),
294
+ // }
295
+ //
296
+ // `total` is intentionally omitted: we don't know the final event count
297
+ // in advance. Runners emit events in Tasks 9-11; this commit is plumbing
298
+ // only and `escalation_start` (emitted by delegateWithEscalation itself)
299
+ // is the sole observable event in practice.
300
+ // Runtime guard instead of a raw cast: _meta is typed broadly at the
301
+ // SDK layer, and a bad client could in principle send a progressToken
302
+ // of any JSON type. Only `string` / `number` are valid per MCP spec.
303
+ const rawToken = extra._meta?.progressToken;
304
+ const progressToken = typeof rawToken === 'string' || typeof rawToken === 'number'
305
+ ? rawToken
306
+ : undefined;
307
+ let progressCounter = 0;
308
+ const sendProgress = progressToken !== undefined
309
+ ? (taskIndex, event) => {
310
+ progressCounter += 1;
311
+ // Fire-and-forget. We swallow rejections so a broken transport
312
+ // never corrupts the in-flight tool run — worst case the client
313
+ // misses a progress tick but still gets the final tool result.
314
+ extra
315
+ .sendNotification({
316
+ method: 'notifications/progress',
317
+ params: {
318
+ progressToken,
319
+ progress: progressCounter,
320
+ message: JSON.stringify({ taskIndex, event }),
321
+ },
322
+ })
323
+ .catch(() => {
324
+ /* ignore — progress is best-effort */
325
+ });
326
+ }
327
+ : undefined;
328
+ // Stash the original task specs in the batch cache BEFORE dispatch
329
+ // so the returned batchId is valid even if the dispatch itself
330
+ // throws (so callers can still retry the specific tasks that
331
+ // produced errors). The cache stores the raw TaskSpec[] — NOT the
332
+ // expanded forms — because `retry_tasks` will push the same specs
333
+ // through `runTasks` again, which re-expands against the current
334
+ // (possibly updated) context-block store.
335
+ const batchId = rememberBatch(tasks);
336
+ const batchStartMs = Date.now();
337
+ let results = [];
338
+ try {
339
+ results = await runTasks(tasks, config, {
340
+ onProgress: sendProgress,
341
+ runtime: { contextBlockStore },
342
+ });
343
+ }
344
+ finally {
345
+ // Always attach `results ?? []` so a mid-flight throw does not leave
346
+ // a dangling batchCache entry that `get_task_output` can't distinguish
347
+ // from "dispatch still in progress". Per spec §3.5 / §3.9 item 3.
348
+ const batchEntry = batchCache.get(batchId);
349
+ if (batchEntry)
350
+ batchEntry.results = results;
351
+ }
352
+ const wallClockMs = Date.now() - batchStartMs;
353
+ // Determine effective response mode based on the configurable threshold
354
+ const totalOutputChars = results.reduce((sum, r) => sum + r.output.length, 0);
355
+ const effectiveMode = responseMode === 'full'
356
+ ? 'full'
357
+ : responseMode === 'summary'
358
+ ? 'summary'
359
+ : totalOutputChars > resolvedThreshold
360
+ ? 'summary'
361
+ : 'full';
362
+ const timings = computeTimings(wallClockMs, results);
363
+ const batchProgress = computeBatchProgress(results);
364
+ const aggregateCost = computeAggregateCost(results);
365
+ const response = effectiveMode === 'full'
366
+ ? buildFullResponse(batchId, tasks, results, { timings, batchProgress, aggregateCost })
367
+ : buildSummaryResponse(batchId, tasks, results, {
368
+ autoEscaped: responseMode === 'auto' && totalOutputChars > resolvedThreshold,
369
+ totalOutputChars,
370
+ threshold: resolvedThreshold,
371
+ timings,
372
+ batchProgress,
373
+ aggregateCost,
374
+ });
375
+ return {
376
+ content: [{ type: 'text', text: JSON.stringify(response, null, 2) }],
377
+ };
378
+ });
379
+ server.tool('register_context_block', 'Store a content block under an id (or auto-generated UUID) for reuse in later delegate_tasks calls. ' +
380
+ 'Use this to avoid re-transmitting long briefs on every dispatch. Blocks are referenced from a ' +
381
+ 'task via its `contextBlockIds` array — the server resolves each id to its stored content and ' +
382
+ 'prepends the blocks to the task `prompt` at dispatch time. Blocks live in an in-memory store ' +
383
+ 'with a 30-minute TTL and a 100-entry LRU cap.', {
384
+ id: z.string().optional().describe('Optional id; auto-generated UUID if omitted'),
385
+ content: z.string().describe('The content to store'),
386
+ }, async ({ id, content }) => {
387
+ const result = contextBlockStore.register(content, { id });
388
+ return {
389
+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
58
390
  };
391
+ });
392
+ server.tool('retry_tasks', 'Re-run specific tasks from a previous delegate_tasks batch by their indices, without ' +
393
+ 're-transmitting the original briefs. Pass the `batchId` returned by delegate_tasks ' +
394
+ 'and an array of task indices (0-based) to re-dispatch. Batches live in an in-memory ' +
395
+ 'cache with a 30-minute TTL; if the batch has expired, re-dispatch the tasks explicitly ' +
396
+ 'via delegate_tasks.', {
397
+ batchId: z.string().describe('Batch id returned from a previous delegate_tasks call'),
398
+ taskIndices: z
399
+ .array(z.number().int().nonnegative())
400
+ .describe('Zero-based indices (into the original batch) of the tasks to re-run'),
401
+ responseMode: z.enum(['full', 'summary', 'auto']).optional().describe(`How to shape the response envelope for the retry batch. 'full' returns inline outputs. ` +
402
+ `'summary' returns outputLength + outputSha256. 'auto' (default) auto-escapes based on threshold.`),
403
+ }, async ({ batchId, taskIndices, responseMode = 'auto' }) => {
404
+ const batch = batchCache.get(batchId);
405
+ if (!batch || batch.expiresAt < Date.now()) {
406
+ // Proactively drop the expired entry so subsequent lookups see
407
+ // the same "unknown" result and the cache doesn't slowly fill
408
+ // with stale rows that are never touched again.
409
+ if (batch)
410
+ batchCache.delete(batchId);
411
+ throw new Error(`batch "${batchId}" is unknown or expired — re-dispatch with full task specs via delegate_tasks`);
412
+ }
413
+ // Mark this batch as recently used so the LRU eviction in
414
+ // `rememberBatch` doesn't drop a hot entry when newer batches
415
+ // arrive. Does NOT refresh TTL — a batch created 29 minutes ago
416
+ // still dies at minute 30 even if it's retried heavily.
417
+ touchBatch(batchId, batch);
418
+ for (const i of taskIndices) {
419
+ if (i < 0 || i >= batch.tasks.length) {
420
+ throw new Error(`index ${i} is out of range for batch ${batchId} (size ${batch.tasks.length})`);
421
+ }
422
+ }
423
+ const subset = taskIndices.map((i) => batch.tasks[i]);
424
+ // Create a fresh batch for the retried tasks so the original batch
425
+ // entry is preserved and get_task_output can still retrieve it.
426
+ const retryBatchId = rememberBatch(subset);
427
+ const batchStartMs = Date.now();
428
+ let results = [];
429
+ try {
430
+ results = await runTasks(subset, config, {
431
+ runtime: { contextBlockStore },
432
+ });
433
+ }
434
+ finally {
435
+ const retryEntry = batchCache.get(retryBatchId);
436
+ if (retryEntry)
437
+ retryEntry.results = results;
438
+ }
439
+ const wallClockMs = Date.now() - batchStartMs;
440
+ // Determine effective response mode
441
+ const totalOutputChars = results.reduce((sum, r) => sum + r.output.length, 0);
442
+ const effectiveMode = responseMode === 'full'
443
+ ? 'full'
444
+ : responseMode === 'summary'
445
+ ? 'summary'
446
+ : totalOutputChars > resolvedThreshold
447
+ ? 'summary'
448
+ : 'full';
449
+ const timings = computeTimings(wallClockMs, results);
450
+ const batchProgress = computeBatchProgress(results);
451
+ const aggregateCost = computeAggregateCost(results);
452
+ const response = effectiveMode === 'full'
453
+ ? {
454
+ ...buildFullResponse(retryBatchId, subset, results, { timings, batchProgress, aggregateCost }),
455
+ originalBatchId: batchId,
456
+ originalIndices: taskIndices,
457
+ }
458
+ : {
459
+ ...buildSummaryResponse(retryBatchId, subset, results, {
460
+ autoEscaped: responseMode === 'auto' && totalOutputChars > resolvedThreshold,
461
+ totalOutputChars,
462
+ threshold: resolvedThreshold,
463
+ timings,
464
+ batchProgress,
465
+ aggregateCost,
466
+ }),
467
+ originalBatchId: batchId,
468
+ originalIndices: taskIndices,
469
+ };
59
470
  return {
60
471
  content: [{ type: 'text', text: JSON.stringify(response, null, 2) }],
61
472
  };
62
473
  });
474
+ server.tool('get_task_output', `Retrieve the full text output of a specific task from a previous delegate_tasks batch.
475
+
476
+ Use this when a prior delegate_tasks response came back with mode: 'summary' and you
477
+ need the actual output of one specific task. The batchId is the one returned at the
478
+ top of that response; taskIndex is 0-based into the original tasks array.
479
+
480
+ Batches are cached in memory per MCP server instance with a 30-minute TTL from creation
481
+ and a 100-entry LRU cap. Access touches the LRU order but does not refresh TTL. If the
482
+ batch is expired or evicted, re-dispatch via delegate_tasks with the full specs.`, {
483
+ batchId: z.string().describe('Batch id returned from a previous delegate_tasks call'),
484
+ taskIndex: z.number().int().nonnegative().describe('Zero-based index of the task within the batch'),
485
+ }, async ({ batchId, taskIndex }) => {
486
+ const batch = batchCache.get(batchId);
487
+ if (!batch || batch.expiresAt < Date.now()) {
488
+ if (batch)
489
+ batchCache.delete(batchId);
490
+ throw new Error(`batch "${batchId}" is unknown or expired — re-dispatch with full task specs via delegate_tasks`);
491
+ }
492
+ // Touch LRU order but NOT TTL
493
+ touchBatch(batchId, batch);
494
+ if (batch.results === undefined) {
495
+ throw new Error(`batch "${batchId}" has no stored results — this may indicate a dispatch failure`);
496
+ }
497
+ if (taskIndex < 0 || taskIndex >= batch.results.length) {
498
+ throw new Error(`index ${taskIndex} is out of range for batch ${batchId} (size ${batch.results.length})`);
499
+ }
500
+ const result = batch.results[taskIndex];
501
+ return {
502
+ content: [{ type: 'text', text: JSON.stringify({ output: result.output }, null, 2) }],
503
+ };
504
+ });
63
505
  return server;
64
506
  }
65
507
  /**
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,iDAAiD,CAAC;AAC9E,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AAEvE,OAAO,EAAE,2BAA2B,EAAE,MAAM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AAuC;AACvC,MAAM,QAAQ,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChD,MAAM,WAAW,GAAG,CAAC,GAAG,EAAE;IACxB,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAAE,OAAO,KAAK,CAAC;IACnC,IAAI,CAAC;QACH,OAAO,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;IACxE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC,CAAC,EAAE,CAAC;AACL,IAAI,WAAW,EAAE,CAAC;IAChB,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACnB,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QAC7B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { buildMcpServer, buildTaskSchema, SERVER_NAME, SERVER_VERSION } from './cli.js';
1
+ export { buildMcpServer, buildTaskSchema, SERVER_NAME, SERVER_VERSION, computeTimings, computeBatchProgress, computeAggregateCost } from './cli.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,cAAc,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- export { buildMcpServer, buildTaskSchema, SERVER_NAME, SERVER_VERSION } from './cli.js';
1
+ export { buildMcpServer, buildTaskSchema, SERVER_NAME, SERVER_VERSION, computeTimings, computeBatchProgress, computeAggregateCost } from './cli.js';
2
2
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,cAAc,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"render-provider-routing-matrix.d.ts","sourceRoot":"","sources":["../../src/routing/render-provider-routing-matrix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,gBAAgB,EAAkB,MAAM,mCAAmC,CAAC;AAmDtG;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAkB5E"}
1
+ {"version":3,"file":"render-provider-routing-matrix.d.ts","sourceRoot":"","sources":["../../src/routing/render-provider-routing-matrix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAc,gBAAgB,EAAkB,MAAM,mCAAmC,CAAC;AA0JtG;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAoB5E"}
@@ -20,6 +20,108 @@ Optional 'effort' knob (per task):
20
20
  'medium' for balanced, 'low' for fast-but-shallow, 'none' to disable
21
21
  thinking entirely on providers that default it on. Omit the field on
22
22
  providers that do not support it.`;
23
+ const TOOL_NOTES = `Sub-agent tool notes (apply to every provider):
24
+ - 'grep' accepts a file OR a directory. When given a directory it searches
25
+ recursively (output is prefixed file:line). Prefer one recursive grep over
26
+ many readFile calls when the worker needs to find usages or patterns.
27
+ - Worker output is captured from the final assistant message when present,
28
+ otherwise salvaged from a running scratchpad. You ALWAYS get text back,
29
+ even on 'incomplete' / 'timeout' / 'api_error' / 'network_error' paths.
30
+ - Tasks that need shell ('pnpm', 'pytest', 'tsc', 'git') only work on
31
+ providers configured with sandboxPolicy: 'none'. Otherwise keep shell
32
+ work on the parent session, not in a delegated sub-agent.
33
+
34
+ Escalation, statuses, streaming, and batch helpers:
35
+ - Auto-routed tasks (no 'provider' set) walk the full capability+tier
36
+ chain cheapest-first on failure. The chain stops at the first 'ok'.
37
+ If every provider fails, the best salvage is returned and the
38
+ per-task 'escalationLog' shows every attempt. Explicit pins
39
+ ('provider' set) run as a single attempt — pinning opts out.
40
+ - Status values: 'ok', 'incomplete', 'max_turns', 'timeout',
41
+ 'api_aborted', 'api_error', 'network_error', 'error'.
42
+ 'incomplete' = scratchpad salvage after a degenerate completion;
43
+ 'api_aborted' = provider-side abort; 'api_error' = HTTP error with
44
+ a numeric .status; 'network_error' = transport failure
45
+ (ECONNREFUSED / ENOTFOUND / /network/i).
46
+ - Streaming: if your MCP client passes '_meta.progressToken' on the
47
+ tool call, delegate_tasks forwards per-task progress notifications
48
+ (turn_start, tool_call, text_emission, turn_complete, injection,
49
+ escalation_start, done) back over the MCP progress channel. No
50
+ opt-in needed beyond sending the token.
51
+ - Batch helpers: every delegate_tasks response carries a 'batchId'.
52
+ Use 'retry_tasks' with that batchId + a list of 0-based task
53
+ indices to re-run just the failing subset without re-transmitting
54
+ the original briefs. Cache is 30-minute TTL, 100-batch LRU.
55
+ - Long shared context: 'register_context_block' stores a blob of
56
+ text on the server and returns an id. Pass that id in
57
+ 'contextBlockIds' on any task (alongside 'prompt') and the server
58
+ prepends the blob to the prompt before dispatch — so long briefs
59
+ shared across multiple tasks are sent to the parent session only
60
+ once.
61
+
62
+ RESPONSE SHAPE (v0.3+): Every delegate_tasks response includes a top-level
63
+ batchId, mode ('full' or 'summary'), timings ({wallClockMs, sumOfTaskMs,
64
+ estimatedParallelSavingsMs}), batchProgress ({totalTasks, completedTasks,
65
+ incompleteTasks, failedTasks, successPercent}), and aggregateCost
66
+ ({totalActualCostUSD, totalSavedCostUSD, actualCostUnavailableTasks,
67
+ savedCostUnavailableTasks}). If the combined output across tasks is small,
68
+ mode: 'full' with inline outputs; if it exceeds the server's threshold
69
+ (default 64 KB, configurable via env MULTI_MODEL_LARGE_RESPONSE_THRESHOLD_CHARS
70
+ / config defaults.largeResponseThresholdChars / buildMcpServer option),
71
+ mode: 'summary' with per-task outputLength + outputSha256 + _fetchWith
72
+ hint — fetch individual outputs with get_task_output({ batchId, taskIndex }).
73
+ Set responseMode: 'full' to force inline, 'summary' to force summary, or
74
+ omit for auto-escape.
75
+
76
+ COVERAGE DECLARATION (v0.3+): For tasks with enumerable deliverables
77
+ (multi-file refactors, test generation across many functions, multi-PR
78
+ review, per-endpoint reports, per-function test stubs, audit checklists),
79
+ set expectedCoverage on the task spec with either minSections: N,
80
+ sectionPattern: '<regex>' (default ^##), or requiredMarkers: [...] — the
81
+ identifier strings that must all appear in the output. The supervision
82
+ layer will re-prompt the model with specific missing items and classify
83
+ thin responses as insufficient_coverage instead of silently accepting them.
84
+ Do NOT set expectedCoverage for one-shot tasks (bug fixes, single
85
+ implementations, prose, creative writing) — the field is opt-in and has
86
+ no meaning for deliverables you can't enumerate ahead of time.
87
+
88
+ COST + TIME VISIBILITY (v0.3+): Set parentModel on the task spec (e.g.
89
+ 'claude-opus-4-6') to get usage.savedCostUSD — the ESTIMATED cost
90
+ difference vs running the same token volume on that parent model.
91
+ Positive means delegation was cheaper. Both usage.costUSD (actual) and
92
+ usage.savedCostUSD (estimate) are estimates for budgeting and debugging,
93
+ not accounting numbers. Per-task durationMs is always populated.
94
+ Batch-level timings.estimatedParallelSavingsMs tells you how much
95
+ wall-clock time concurrent dispatch bought back vs a hypothetical
96
+ serial for-loop. batchProgress.successPercent is a clean-success rate
97
+ (the batch is always 100% done by the time you see the response —
98
+ successPercent measures how many finished cleanly, NOT progress).
99
+
100
+ PROGRESS TRACE (v0.3+): Set includeProgressTrace: true on the task spec
101
+ to receive a bounded, priority-trimmed trace of the execution timeline
102
+ in the final RunResult.progressTrace. Useful for post-hoc debugging of
103
+ long-running tasks — did the worker loop through supervision retries,
104
+ where did it stall, did it escalate across providers. The trace is
105
+ trimmed at 80 events and 16 KB; text_emission and tool_call events are
106
+ dropped first under pressure (their content is already in output /
107
+ toolCalls). Boundary events (turn_start, turn_complete, escalation_start,
108
+ injection, done) are never dropped. If trimming fired, a synthetic
109
+ _trimmed marker at the end of the trace reports the dropped count and
110
+ per-kind histogram.
111
+
112
+ NOTE: progress-events at the MCP protocol level (notifications/progress)
113
+ are emitted correctly by the server and delivered to the MCP client.
114
+ Whether your client renders them live depends on the client — some
115
+ render them as in-flight tool-call status lines, others don't surface
116
+ them to the calling LLM at all. includeProgressTrace gives you the
117
+ full timeline post-hoc regardless of your client's live-rendering
118
+ behavior.
119
+
120
+ AVAILABLE TOOLS: delegate_tasks (this one), register_context_block
121
+ (stash reusable brief content referenced via TaskSpec.contextBlockIds),
122
+ retry_tasks (re-dispatch specific indices from a previous batch),
123
+ get_task_output (fetch individual task outputs when a response was in
124
+ summary mode).`;
23
125
  function renderProviderBlock(name, config, capabilities, profile, costSource) {
24
126
  const cost = getEffectiveCostTier(config);
25
127
  const costSuffix = costSource === 'config' ? ' (from config)' : '';
@@ -58,6 +160,8 @@ export function renderProviderRoutingMatrix(config) {
58
160
  blocks.join('\n\n'),
59
161
  '',
60
162
  ROUTING_RECIPE,
163
+ '',
164
+ TOOL_NOTES,
61
165
  ].join('\n');
62
166
  }
63
167
  //# sourceMappingURL=render-provider-routing-matrix.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"render-provider-routing-matrix.js","sour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CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,cAAc,CAAC,EAAE,EAAE;QAC7E,MAAM,YAAY,GAAG,mBAAmB,CAAC,cAAc,CAAC,CAAC;QACzD,MAAM,OAAO,GAAG,gBAAgB,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QACvD,MAAM,UAAU,GAAyB,cAAc,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;QACxF,OAAO,mBAAmB,CAAC,IAAI,EAAE,cAAc,EAAE,YAAY,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IACtF,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,kEAAkE;QAClE,iCAAiC;QACjC,EAAE;QACF,sBAAsB;QACtB,EAAE;QACF,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;QACnB,EAAE;QACF,cAAc;KACf,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
1
+ {"version":3,"file":"render-provider-routing-matrix.js","sourceRoot":"","sources":["../../src/routing/render-provider-routing-matrix.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wDAAwD,CAAC;AAC7F,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,0DAA0D,CAAC;AAGlH,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;oCAmBa,CAAC;AAErC,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;eAqGJ,CAAC;AAEhB,SAAS,mBAAmB,CAC1B,IAAY,EACZ,MAAsB,EACtB,YAA0B,EAC1B,OAAqB,EACrB,UAAgC;IAEhC,MAAM,IAAI,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC1C,M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,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC;IACtF,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,kEAAkE;QAClE,iCAAiC;QACjC,EAAE;QACF,sBAAsB;QACtB,EAAE;QACF,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;QACnB,EAAE;QACF,cAAc;QACd,EAAE;QACF,UAAU;KACX,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhixuan92/multi-model-agent-mcp",
3
- "version": "0.1.4",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "MCP server for multi-model-agent. Exposes a delegate_tasks tool that routes work to Claude, Codex, or OpenAI-compatible sub-agents based on capability, quality tier, and cost.",
@@ -49,8 +49,8 @@
49
49
  "node": ">=22.0.0"
50
50
  },
51
51
  "dependencies": {
52
- "@zhixuan92/multi-model-agent-core": "^0.1.1",
53
52
  "@modelcontextprotocol/sdk": "^1.0.0",
53
+ "@zhixuan92/multi-model-agent-core": "^0.3.0",
54
54
  "zod": "^4.0.0"
55
55
  }
56
56
  }