@zhixuan92/multi-model-agent-mcp 0.1.3 → 0.2.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
@@ -54,22 +54,24 @@ Provider auth:
54
54
 
55
55
  ### Claude Code
56
56
 
57
- One command — the client will spawn the server on demand:
57
+ One command — the client will spawn the server on demand. Use `-s user` so the server is available in **every** project on your machine, not just the directory where you ran the command:
58
58
 
59
59
  ```bash
60
- claude mcp add multi-model-agent -- npx -y @zhixuan92/multi-model-agent-mcp serve
60
+ claude mcp add multi-model-agent -s user -- npx -y @zhixuan92/multi-model-agent-mcp serve
61
61
  ```
62
62
 
63
63
  If your providers need environment variables:
64
64
 
65
65
  ```bash
66
- claude mcp add multi-model-agent \
66
+ claude mcp add multi-model-agent -s user \
67
67
  -e OPENAI_API_KEY=sk-... \
68
68
  -e ANTHROPIC_API_KEY=sk-ant-... \
69
69
  -e MINIMAX_API_KEY=... \
70
70
  -- npx -y @zhixuan92/multi-model-agent-mcp serve
71
71
  ```
72
72
 
73
+ Without `-s user`, `claude mcp add` defaults to local scope and only registers the server in the current project.
74
+
73
75
  ### Claude Desktop
74
76
 
75
77
  Add to `claude_desktop_config.json`:
@@ -92,6 +94,20 @@ Add to `claude_desktop_config.json`:
92
94
 
93
95
  Restart your MCP client after changing config.
94
96
 
97
+ ## Recommended: delegation rule for Claude Code
98
+
99
+ Claude Code's native `Task` / `Agent` subagents inherit your parent session's expensive model and eat its context window. We ship a drop-in rule file that teaches Claude Code **when** to delegate work through `delegate_tasks` instead — mechanical edits go to free providers, reasoning-tier work escalates only when needed, and independent tasks run in parallel.
100
+
101
+ Install globally:
102
+
103
+ ```bash
104
+ mkdir -p ~/.claude/rules
105
+ curl -o ~/.claude/rules/multi-model-delegation.md \
106
+ https://raw.githubusercontent.com/zhixuan312/multi-model-agent/HEAD/docs/claude-code-delegation-rule.md
107
+ ```
108
+
109
+ Restart Claude Code after installing. The full rule — judgment-vs-labor principle, decision procedure, provider routing table, dispatch shape, verification, escalation ladder — lives at [`docs/claude-code-delegation-rule.md`](https://github.com/zhixuan312/multi-model-agent/blob/HEAD/docs/claude-code-delegation-rule.md). Read that file before adapting it to your own provider names.
110
+
95
111
  ## The `delegate_tasks` tool
96
112
 
97
113
  Accepts an array of tasks and runs them concurrently. Auto-routes each task by capability filter → quality tier filter → cheapest remaining provider, or pin a task to a specific provider.
@@ -124,8 +140,20 @@ Capabilities: `file_read`, `file_write`, `grep`, `glob`, `shell`, `web_search`,
124
140
 
125
141
  ## Security
126
142
 
127
- - File tools enforce a `cwd-only` sandbox by default — paths are resolved via `fs.realpath` and rejected if outside the task's `cwd`.
128
- - `runShell` is hard-disabled under `cwd-only`. Set `sandboxPolicy: 'none'` per-provider or per-task to opt in.
143
+ ### Sandbox enforcement
144
+
145
+ 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.
146
+
147
+ 1. **File reads** are allowed only inside `cwd` and its descendants. Path traversal (`../`, absolute paths outside `cwd`) is rejected.
148
+ 2. **File writes** are subject to the same restriction.
149
+ 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.
150
+ 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.
151
+ 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.
152
+ 6. **The check is per-call**, not per-session. Every tool invocation revalidates.
153
+ 7. **Errors are surfaced to the model**, not silently swallowed, so the model can observe the rejection and adjust.
154
+
155
+ ### Other hardening
156
+
129
157
  - `readFile` rejects targets larger than 50 MiB; `writeFile` rejects content larger than 100 MiB.
130
158
  - The server warns at config-load time if it sees an inline `apiKey` instead of `apiKeyEnv`.
131
159
  - The server warns once if `~/.codex/auth.json` is group- or world-readable.
package/dist/cli.d.ts CHANGED
@@ -4,7 +4,7 @@ import { z } from 'zod';
4
4
  import { runTasks } from '@zhixuan92/multi-model-agent-core/run-tasks';
5
5
  import type { MultiModelConfig } 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 const SERVER_VERSION: string;
8
8
  export declare function buildTaskSchema(availableProviders: [string, ...string[]]): z.ZodObject<{
9
9
  prompt: z.ZodString;
10
10
  provider: z.ZodOptional<z.ZodEnum<{
@@ -41,6 +41,7 @@ export declare function buildTaskSchema(availableProviders: [string, ...string[]
41
41
  none: "none";
42
42
  "cwd-only": "cwd-only";
43
43
  }>>;
44
+ contextBlockIds: z.ZodOptional<z.ZodArray<z.ZodString>>;
44
45
  }, z.core.$strip>;
45
46
  export declare function buildMcpServer(config: Parameters<typeof runTasks>[1]): McpServer;
46
47
  /**
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,EAGjB,MAAM,mCAAmC,CAAC;AAG3C,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAW/C,eAAO,MAAM,cAAc,QAAc,CAAC;AAE1C,wBAAgB,eAAe,CAAC,kBAAkB,EAAE,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAwBxE;AAkCD,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,aAsPpE;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 } 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,20 @@ 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
+ // Read the version from package.json at module load so the MCP server
18
+ // metadata (and tests that assert against it) stays in lockstep with the
19
+ // published npm package version. `createRequire` keeps the JSON read
20
+ // outside tsc's `rootDir: src` constraint and avoids the `with { type:
21
+ // 'json' }` import attribute (which would force us to commit to a
22
+ // specific TS/Node module-resolution combination). The relative path is
23
+ // resolved from the compiled `dist/cli.js` — that sits one level below
24
+ // `packages/mcp/package.json`.
25
+ const packageRequire = createRequire(import.meta.url);
26
+ const pkg = packageRequire('../package.json');
27
+ export const SERVER_VERSION = pkg.version;
15
28
  export function buildTaskSchema(availableProviders) {
16
29
  return z.object({
17
30
  prompt: z.string().describe('Task prompt for the sub-agent'),
@@ -29,8 +42,43 @@ export function buildTaskSchema(availableProviders) {
29
42
  effort: z.enum(['none', 'low', 'medium', 'high']).optional()
30
43
  .describe("Reasoning effort."),
31
44
  sandboxPolicy: z.enum(['none', 'cwd-only']).optional().describe('File-system confinement policy. Default: cwd-only'),
45
+ contextBlockIds: z.array(z.string()).optional().describe('Optional context block ids previously stored via register_context_block. ' +
46
+ 'The server resolves each id to its stored content and prepends the blocks ' +
47
+ '(in order, separated by "\\n\\n---\\n\\n") to `prompt` before dispatch. ' +
48
+ 'Use this to avoid re-transmitting long briefs across multiple calls.'),
32
49
  });
33
50
  }
51
+ /**
52
+ * Batch cache for `retry_tasks`. Every `delegate_tasks` call stashes the
53
+ * original `TaskSpec[]` under a UUID so the caller can later ask us to
54
+ * re-dispatch specific indices without re-transmitting the briefs. Two
55
+ * bounds:
56
+ *
57
+ * - TTL (30 min from creation): keeps stale batches from lingering
58
+ * through a long session. TTL is from-creation (not from-last-access),
59
+ * matching `InMemoryContextBlockStore` — a batch used at minute 29
60
+ * still dies at minute 30. Access does NOT refresh the expiry.
61
+ * - LRU cap (100 entries): prevents unbounded growth from a chatty
62
+ * caller that never retries. Eviction is true LRU (least-recently-
63
+ * *used*, not least-recently-inserted): a batch that is still being
64
+ * retried stays hot and a newer but unused batch will be evicted
65
+ * first. This matters when a caller is iterating on one task while
66
+ * dispatching unrelated batches in parallel.
67
+ *
68
+ * Eviction on TTL is lazy (checked on `retry_tasks` lookup). Eviction on
69
+ * the LRU cap is eager (runs after every `rememberBatch`).
70
+ *
71
+ * LRU implementation note: we use JavaScript's `Map` which preserves
72
+ * insertion order on iteration. To "touch" an entry on access, we
73
+ * `delete` it and re-`set` it, which moves it to the end of the
74
+ * iteration order. `Map.keys().next().value` is then the oldest-*accessed*
75
+ * entry (not the oldest-inserted entry), giving us O(1) LRU without a
76
+ * separate priority structure. The helpers `touchBatch` (on access) and
77
+ * the eviction loop in `rememberBatch` (on insert) are the only two
78
+ * places that mutate the Map.
79
+ */
80
+ const BATCH_TTL_MS = 30 * 60 * 1000;
81
+ const BATCH_MAX = 100;
34
82
  export function buildMcpServer(config) {
35
83
  const providerKeys = Object.keys(config.providers);
36
84
  if (providerKeys.length === 0) {
@@ -40,18 +88,200 @@ export function buildMcpServer(config) {
40
88
  name: SERVER_NAME,
41
89
  version: SERVER_VERSION,
42
90
  });
91
+ // One context-block store per server instance. Persists across calls
92
+ // within a single `buildMcpServer(...)` lifetime so `register_context_block`
93
+ // followed by multiple `delegate_tasks` with `contextBlockIds` works.
94
+ const contextBlockStore = new InMemoryContextBlockStore();
95
+ // Per-server batch cache for `retry_tasks`. See the LRU comment block
96
+ // above for eviction semantics.
97
+ const batchCache = new Map();
98
+ const rememberBatch = (tasks) => {
99
+ const id = randomUUID();
100
+ batchCache.set(id, { tasks, expiresAt: Date.now() + BATCH_TTL_MS });
101
+ // Evict the least-recently-USED entry (not least-recently-inserted).
102
+ // `touchBatch` below moves accessed entries to the end of insertion
103
+ // order, so `keys().next().value` is the true LRU head.
104
+ while (batchCache.size > BATCH_MAX) {
105
+ const lru = batchCache.keys().next().value;
106
+ if (lru)
107
+ batchCache.delete(lru);
108
+ else
109
+ break;
110
+ }
111
+ return id;
112
+ };
113
+ /**
114
+ * Mark a batch as recently used by reinserting it at the tail of the
115
+ * Map's iteration order. `touchBatch` is called on every successful
116
+ * `retry_tasks` lookup so a frequently-retried batch does not get
117
+ * evicted by `rememberBatch`'s LRU loop. Does NOT refresh the TTL —
118
+ * expiry stays at the original creation time.
119
+ */
120
+ const touchBatch = (id, entry) => {
121
+ batchCache.delete(id);
122
+ batchCache.set(id, entry);
123
+ };
43
124
  const availableProviders = providerKeys;
44
125
  server.tool('delegate_tasks', renderProviderRoutingMatrix(config), {
45
126
  tasks: z.array(buildTaskSchema(availableProviders)).describe('Array of tasks to execute in parallel'),
46
- }, async ({ tasks }) => {
47
- const results = await runTasks(tasks, config);
127
+ }, async ({ tasks }, extra) => {
128
+ // --- OQ#6 resolution: MCP SDK progress notification API ---
129
+ //
130
+ // The @modelcontextprotocol/sdk >= 1.x exposes progress notifications
131
+ // on the tool-handler `extra` argument: the second parameter of the
132
+ // tool callback is `RequestHandlerExtra<ServerRequest, ServerNotification>`
133
+ // (see node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.d.ts
134
+ // line 173, and server/mcp.d.ts line 250 for `BaseToolCallback`).
135
+ //
136
+ // That type carries two things we need:
137
+ // 1. `extra._meta.progressToken?: string | number` — present iff the
138
+ // client opted in by sending `_meta.progressToken` with its
139
+ // `tools/call` request (MCP spec: notifications/progress).
140
+ // 2. `extra.sendNotification(notification)` — a request-scoped sender
141
+ // that emits `ServerNotification`s correlated with this call.
142
+ // `ServerNotification` is a union that includes
143
+ // `ProgressNotificationSchema` with method `"notifications/progress"`
144
+ // and params `{ progressToken, progress, total?, message? }`
145
+ // (types.d.ts line 954).
146
+ //
147
+ // So the bridge is: for each `ProgressEvent` we receive from core, if
148
+ // the client supplied a `progressToken`, emit one `notifications/progress`
149
+ // message whose `message` field is a JSON-encoded envelope. This is an
150
+ // opt-in channel — clients that don't send `progressToken` get zero
151
+ // notifications, preserving behavior for pre-streaming callers.
152
+ //
153
+ // Envelope schema (stable, documented here so clients can parse it):
154
+ //
155
+ // params: {
156
+ // progressToken, // echoed from the request _meta
157
+ // progress: <monotonic counter>,// ordinal of this event (1-based)
158
+ // message: JSON.stringify({
159
+ // taskIndex: <number>, // index in the original `tasks` array
160
+ // event: <ProgressEvent>, // full ProgressEvent union member
161
+ // }),
162
+ // }
163
+ //
164
+ // `total` is intentionally omitted: we don't know the final event count
165
+ // in advance. Runners emit events in Tasks 9-11; this commit is plumbing
166
+ // only and `escalation_start` (emitted by delegateWithEscalation itself)
167
+ // is the sole observable event in practice.
168
+ // Runtime guard instead of a raw cast: _meta is typed broadly at the
169
+ // SDK layer, and a bad client could in principle send a progressToken
170
+ // of any JSON type. Only `string` / `number` are valid per MCP spec.
171
+ const rawToken = extra._meta?.progressToken;
172
+ const progressToken = typeof rawToken === 'string' || typeof rawToken === 'number'
173
+ ? rawToken
174
+ : undefined;
175
+ let progressCounter = 0;
176
+ const sendProgress = progressToken !== undefined
177
+ ? (taskIndex, event) => {
178
+ progressCounter += 1;
179
+ // Fire-and-forget. We swallow rejections so a broken transport
180
+ // never corrupts the in-flight tool run — worst case the client
181
+ // misses a progress tick but still gets the final tool result.
182
+ extra
183
+ .sendNotification({
184
+ method: 'notifications/progress',
185
+ params: {
186
+ progressToken,
187
+ progress: progressCounter,
188
+ message: JSON.stringify({ taskIndex, event }),
189
+ },
190
+ })
191
+ .catch(() => {
192
+ /* ignore — progress is best-effort */
193
+ });
194
+ }
195
+ : undefined;
196
+ // Stash the original task specs in the batch cache BEFORE dispatch
197
+ // so the returned batchId is valid even if the dispatch itself
198
+ // throws (so callers can still retry the specific tasks that
199
+ // produced errors). The cache stores the raw TaskSpec[] — NOT the
200
+ // expanded forms — because `retry_tasks` will push the same specs
201
+ // through `runTasks` again, which re-expands against the current
202
+ // (possibly updated) context-block store.
203
+ const batchId = rememberBatch(tasks);
204
+ const results = await runTasks(tasks, config, {
205
+ onProgress: sendProgress,
206
+ runtime: { contextBlockStore },
207
+ });
48
208
  const response = {
209
+ batchId,
49
210
  results: results.map((r, i) => ({
50
211
  provider: tasks[i].provider ?? '(auto)',
51
212
  status: r.status,
52
213
  output: r.output,
53
214
  turns: r.turns,
54
- files: r.files,
215
+ filesRead: r.filesRead,
216
+ filesWritten: r.filesWritten,
217
+ toolCalls: r.toolCalls,
218
+ escalationLog: r.escalationLog,
219
+ usage: r.usage,
220
+ ...(r.error && { error: r.error }),
221
+ })),
222
+ };
223
+ return {
224
+ content: [{ type: 'text', text: JSON.stringify(response, null, 2) }],
225
+ };
226
+ });
227
+ server.tool('register_context_block', 'Store a content block under an id (or auto-generated UUID) for reuse in later delegate_tasks calls. ' +
228
+ 'Use this to avoid re-transmitting long briefs on every dispatch. Blocks are referenced from a ' +
229
+ 'task via its `contextBlockIds` array — the server resolves each id to its stored content and ' +
230
+ 'prepends the blocks to the task `prompt` at dispatch time. Blocks live in an in-memory store ' +
231
+ 'with a 30-minute TTL and a 100-entry LRU cap.', {
232
+ id: z.string().optional().describe('Optional id; auto-generated UUID if omitted'),
233
+ content: z.string().describe('The content to store'),
234
+ }, async ({ id, content }) => {
235
+ const result = contextBlockStore.register(content, { id });
236
+ return {
237
+ content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
238
+ };
239
+ });
240
+ server.tool('retry_tasks', 'Re-run specific tasks from a previous delegate_tasks batch by their indices, without ' +
241
+ 're-transmitting the original briefs. Pass the `batchId` returned by delegate_tasks ' +
242
+ 'and an array of task indices (0-based) to re-dispatch. Batches live in an in-memory ' +
243
+ 'cache with a 30-minute TTL; if the batch has expired, re-dispatch the tasks explicitly ' +
244
+ 'via delegate_tasks.', {
245
+ batchId: z.string().describe('Batch id returned from a previous delegate_tasks call'),
246
+ taskIndices: z
247
+ .array(z.number().int().nonnegative())
248
+ .describe('Zero-based indices (into the original batch) of the tasks to re-run'),
249
+ }, async ({ batchId, taskIndices }) => {
250
+ const batch = batchCache.get(batchId);
251
+ if (!batch || batch.expiresAt < Date.now()) {
252
+ // Proactively drop the expired entry so subsequent lookups see
253
+ // the same "unknown" result and the cache doesn't slowly fill
254
+ // with stale rows that are never touched again.
255
+ if (batch)
256
+ batchCache.delete(batchId);
257
+ throw new Error(`batch "${batchId}" is unknown or expired — re-dispatch with full task specs via delegate_tasks`);
258
+ }
259
+ // Mark this batch as recently used so the LRU eviction in
260
+ // `rememberBatch` doesn't drop a hot entry when newer batches
261
+ // arrive. Does NOT refresh TTL — a batch created 29 minutes ago
262
+ // still dies at minute 30 even if it's retried heavily.
263
+ touchBatch(batchId, batch);
264
+ for (const i of taskIndices) {
265
+ if (i < 0 || i >= batch.tasks.length) {
266
+ throw new Error(`index ${i} is out of range for batch ${batchId} (size ${batch.tasks.length})`);
267
+ }
268
+ }
269
+ const subset = taskIndices.map((i) => batch.tasks[i]);
270
+ const results = await runTasks(subset, config, {
271
+ runtime: { contextBlockStore },
272
+ });
273
+ const response = {
274
+ batchId,
275
+ results: results.map((r, i) => ({
276
+ originalIndex: taskIndices[i],
277
+ provider: subset[i].provider ?? '(auto)',
278
+ status: r.status,
279
+ output: r.output,
280
+ turns: r.turns,
281
+ filesRead: r.filesRead,
282
+ filesWritten: r.filesWritten,
283
+ toolCalls: r.toolCalls,
284
+ escalationLog: r.escalationLog,
55
285
  usage: r.usage,
56
286
  ...(r.error && { error: r.error }),
57
287
  })),
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,M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E,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"}
@@ -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;AA0FtG;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAoB5E"}
@@ -20,6 +20,44 @@ 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.`;
23
61
  function renderProviderBlock(name, config, capabilities, profile, costSource) {
24
62
  const cost = getEffectiveCostTier(config);
25
63
  const costSuffix = costSource === 'config' ? ' (from config)' : '';
@@ -58,6 +96,8 @@ export function renderProviderRoutingMatrix(config) {
58
96
  blocks.join('\n\n'),
59
97
  '',
60
98
  ROUTING_RECIPE,
99
+ '',
100
+ TOOL_NOTES,
61
101
  ].join('\n');
62
102
  }
63
103
  //# sourceMappingURL=render-provider-routing-matrix.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"render-provider-routing-matrix.js","sourceRoot":"","sources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,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAqCX,CAAC;AAET,SAAS,mBAAmB,CAC1B,IAAY,EACZ,MAAsB,EACtB,YAA0B,EAC1B,OAAqB,EACrB,UAAgC;IAEhC,MAAM,IAAI,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAC;IAC1C,MAAM,UAAU,GAAG,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAC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,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.3",
3
+ "version": "0.2.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,7 +49,7 @@
49
49
  "node": ">=22.0.0"
50
50
  },
51
51
  "dependencies": {
52
- "@zhixuan92/multi-model-agent-core": "^0.1.1",
52
+ "@zhixuan92/multi-model-agent-core": "^0.2.0",
53
53
  "@modelcontextprotocol/sdk": "^1.0.0",
54
54
  "zod": "^4.0.0"
55
55
  }