@zhixuan92/multi-model-agent-mcp 0.3.1 → 1.0.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.
Files changed (38) hide show
  1. package/README.md +30 -28
  2. package/dist/cli.d.ts +19 -17
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/cli.js +233 -81
  5. package/dist/cli.js.map +1 -1
  6. package/dist/headline.d.ts +30 -0
  7. package/dist/headline.d.ts.map +1 -0
  8. package/dist/headline.js +73 -0
  9. package/dist/headline.js.map +1 -0
  10. package/dist/index.d.ts +2 -0
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +1 -0
  13. package/dist/index.js.map +1 -1
  14. package/dist/routing/render-provider-routing-matrix.d.ts +1 -1
  15. package/dist/routing/render-provider-routing-matrix.d.ts.map +1 -1
  16. package/dist/routing/render-provider-routing-matrix.js +37 -65
  17. package/dist/routing/render-provider-routing-matrix.js.map +1 -1
  18. package/dist/tools/audit-document.d.ts +19 -0
  19. package/dist/tools/audit-document.d.ts.map +1 -0
  20. package/dist/tools/audit-document.js +30 -0
  21. package/dist/tools/audit-document.js.map +1 -0
  22. package/dist/tools/debug-task.d.ts +15 -0
  23. package/dist/tools/debug-task.d.ts.map +1 -0
  24. package/dist/tools/debug-task.js +33 -0
  25. package/dist/tools/debug-task.js.map +1 -0
  26. package/dist/tools/execute-plan-task.d.ts +26 -0
  27. package/dist/tools/execute-plan-task.d.ts.map +1 -0
  28. package/dist/tools/execute-plan-task.js +49 -0
  29. package/dist/tools/execute-plan-task.js.map +1 -0
  30. package/dist/tools/review-code.d.ts +19 -0
  31. package/dist/tools/review-code.d.ts.map +1 -0
  32. package/dist/tools/review-code.js +31 -0
  33. package/dist/tools/review-code.js.map +1 -0
  34. package/dist/tools/verify-work.d.ts +14 -0
  35. package/dist/tools/verify-work.d.ts.map +1 -0
  36. package/dist/tools/verify-work.js +32 -0
  37. package/dist/tools/verify-work.js.map +1 -0
  38. package/package.json +22 -2
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Format a USD amount as `$X.YZ` — two decimals, no trailing-zero trimming
3
+ * beyond two. Matches the currency-rendering rule in spec §1.
4
+ */
5
+ export function formatCurrency(usd) {
6
+ return `$${usd.toFixed(2)}`;
7
+ }
8
+ /**
9
+ * Format a duration in ms using unit-aware human-readable rules:
10
+ * d < 1m → "Ns" (sub-minute: seconds only)
11
+ * 1m ≤ d < 1h → "Nm Ns" (minute-scale: minutes and seconds, no zero-pad)
12
+ * d ≥ 1h → "Nh Nm" (hour-scale: hours and minutes, seconds dropped)
13
+ * Seconds are truncated (Math.floor) to avoid overstating wall-clock.
14
+ */
15
+ export function formatDuration(ms) {
16
+ const totalSeconds = Math.floor(ms / 1000);
17
+ if (totalSeconds < 60)
18
+ return `${totalSeconds}s`;
19
+ const totalMinutes = Math.floor(totalSeconds / 60);
20
+ if (totalMinutes < 60) {
21
+ const s = totalSeconds - totalMinutes * 60;
22
+ return `${totalMinutes}m ${s}s`;
23
+ }
24
+ const hours = Math.floor(totalMinutes / 60);
25
+ const m = totalMinutes - hours * 60;
26
+ return `${hours}h ${m}m`;
27
+ }
28
+ /**
29
+ * Compose the one-line ROI headline. See spec §1 for the decision table.
30
+ */
31
+ export function composeHeadline(input) {
32
+ const { timings, batchProgress, aggregateCost, taskSpecs } = input;
33
+ const parts = [];
34
+ // Task count + success rate
35
+ parts.push(`${batchProgress.totalTasks} tasks, ${batchProgress.completedTasks}/${batchProgress.totalTasks} ok (${batchProgress.successPercent.toFixed(1)}%)`);
36
+ // Wall clock
37
+ parts.push(`wall ${formatDuration(timings.wallClockMs)}`);
38
+ // Divide-by-zero guard — before any other cost or savings clause.
39
+ // If totalActualCostUSD === 0, we collapse to "$0.00 actual" regardless
40
+ // of parentModel set size (rows 6, 7, 8). This check must come BEFORE the
41
+ // parallel savings clause so we don't emit "saved ~Xs" for zero-cost batches.
42
+ if (aggregateCost.totalActualCostUSD === 0) {
43
+ parts.push(`${formatCurrency(aggregateCost.totalActualCostUSD)} actual`);
44
+ return parts.join(', ');
45
+ }
46
+ // Parallel savings clause — omitted when single task or savings <= 0
47
+ if (taskSpecs.length > 1 && timings.estimatedParallelSavingsMs > 0) {
48
+ parts.push(`saved ~${formatDuration(timings.estimatedParallelSavingsMs)} vs serial`);
49
+ }
50
+ // Cost clause — six-branch decision table from spec §1.
51
+ const parentSet = new Set(taskSpecs
52
+ .map((t) => t.parentModel)
53
+ .filter((m) => typeof m === 'string' && m.length > 0));
54
+ if (parentSet.size === 0) {
55
+ // Row 2: no parentModel declared, positive cost. Show actual only.
56
+ parts.push(`${formatCurrency(aggregateCost.totalActualCostUSD)} actual`);
57
+ }
58
+ else if (parentSet.size === 1) {
59
+ // Rows 1, 3, 4: single baseline, positive cost. Emit full clause with ROI.
60
+ const parentLabel = [...parentSet][0];
61
+ const ratio = (aggregateCost.totalActualCostUSD + aggregateCost.totalSavedCostUSD) /
62
+ aggregateCost.totalActualCostUSD;
63
+ parts.push(`${formatCurrency(aggregateCost.totalActualCostUSD)} actual / ${formatCurrency(aggregateCost.totalSavedCostUSD)} saved vs ${parentLabel} (${ratio.toFixed(1)}x ROI)`);
64
+ }
65
+ else {
66
+ // Row 5: mixed baselines, positive cost. ROI multiplier is NOT coherent
67
+ // across different parent baselines (different denominators), so we drop
68
+ // it. The $saved number is still valid as an additive dollar quantity.
69
+ parts.push(`${formatCurrency(aggregateCost.totalActualCostUSD)} actual / ${formatCurrency(aggregateCost.totalSavedCostUSD)} saved vs multiple baselines`);
70
+ }
71
+ return parts.join(', ');
72
+ }
73
+ //# sourceMappingURL=headline.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"headline.js","sourceRoot":"","sources":["../src/headline.ts"],"names":[],"mappings":"AAmBA;;;GAGG;AACH,MAAM,UAAU,cAAc,CAAC,GAAW;IACxC,OAAO,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;AAC9B,CAAC;AAED;;;;;;GAMG;AACH,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;SAAM,CAAC;QACN,wEAAwE;QACxE,yEAAyE;QACzE,uEAAuE;QACvE,KAAK,CAAC,IAAI,CACR,GAAG,cAAc,CAAC,aAAa,CAAC,kBAAkB,CAAC,aAAa,cAAc,CAAC,aAAa,CAAC,iBAAiB,CAAC,8BAA8B,CAC9I,CAAC;IACJ,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
1
  export { buildMcpServer, buildTaskSchema, SERVER_NAME, SERVER_VERSION, computeTimings, computeBatchProgress, computeAggregateCost } from './cli.js';
2
+ export { composeHeadline, formatCurrency, formatDuration } from './headline.js';
3
+ export type { ComposeHeadlineInput } from './headline.js';
2
4
  //# 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,cAAc,EAAE,oBAAoB,EAAE,oBAAoB,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;AACpJ,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAChF,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export { buildMcpServer, buildTaskSchema, SERVER_NAME, SERVER_VERSION, computeTimings, computeBatchProgress, computeAggregateCost } from './cli.js';
2
+ export { composeHeadline, formatCurrency, formatDuration } from './headline.js';
2
3
  //# 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,cAAc,EAAE,oBAAoB,EAAE,oBAAoB,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;AACpJ,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import type { MultiModelConfig } from '@zhixuan92/multi-model-agent-core';
2
2
  /**
3
3
  * Renders the full routing matrix for the MCP tool description.
4
- * Helps the consuming LLM understand provider capabilities and routing rules.
4
+ * Helps the consuming LLM understand agent capabilities and routing rules.
5
5
  */
6
6
  export declare function renderProviderRoutingMatrix(config: MultiModelConfig): string;
7
7
  //# sourceMappingURL=render-provider-routing-matrix.d.ts.map
@@ -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;AA0JtG;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAoB5E"}
1
+ {"version":3,"file":"render-provider-routing-matrix.d.ts","sourceRoot":"","sources":["../../src/routing/render-provider-routing-matrix.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AA2HvF;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAuB5E"}
@@ -1,26 +1,19 @@
1
- import { getBaseCapabilities } from '@zhixuan92/multi-model-agent-core/routing/capabilities';
2
- import { findModelProfile, getEffectiveCostTier } from '@zhixuan92/multi-model-agent-core/routing/model-profiles';
1
+ import { findModelCapabilities, findModelProfile } from '@zhixuan92/multi-model-agent-core/routing/model-profiles';
3
2
  const ROUTING_RECIPE = `How to route a task:
4
- 1. Capability filter (HARD): exclude providers missing any required capability.
5
- 2. Quality filter: exclude providers whose tier is below the task's tier.
6
- Tier ordering: trivial < standard < reasoning.
7
- 3. Cost preference (STRONG): among the remainder, prefer the cheapest tier.
8
- If a 'free' provider qualifies, pick it. Only escalate to paid tiers when
9
- the task tier or required capabilities demand it.
3
+ 1. Select the agent type based on required capabilities.
4
+ 2. If the selected agent lacks required capabilities, auto-escalate to the other agent type.
5
+ 3. Among available agents, prefer the one that meets capability requirements.
10
6
 
11
- Tier guidance for the consumer LLM:
12
- - 'trivial' — well-defined edits, lookups, formatting. One obvious answer.
7
+ Agent guidance:
13
8
  - 'standard' — most code work. Clear spec, multiple valid approaches.
14
- - 'reasoning' — ambiguous, architectural, research, or high-stakes.
15
- Use when requirements are unclear or judgment is required.
9
+ - 'complex' — ambiguous, architectural, research, or high-stakes tasks requiring more reasoning.
16
10
 
17
11
  Optional 'effort' knob (per task):
18
- - Only providers marked 'effort: supported' in the matrix honor this field.
19
- - Use 'high' for reasoning-tier tasks when you want maximum depth,
12
+ - Only agents marked 'effort: supported' in the matrix honor this field.
13
+ - Use 'high' for complex tasks when you want maximum depth,
20
14
  'medium' for balanced, 'low' for fast-but-shallow, 'none' to disable
21
- thinking entirely on providers that default it on. Omit the field on
22
- providers that do not support it.`;
23
- const TOOL_NOTES = `Sub-agent tool notes (apply to every provider):
15
+ thinking entirely on agents that default it on.`;
16
+ const TOOL_NOTES = `Sub-agent tool notes (apply to every agent):
24
17
  - 'grep' accepts a file OR a directory. When given a directory it searches
25
18
  recursively (output is prefixed file:line). Prefer one recursive grep over
26
19
  many readFile calls when the worker needs to find usages or patterns.
@@ -28,19 +21,18 @@ const TOOL_NOTES = `Sub-agent tool notes (apply to every provider):
28
21
  otherwise salvaged from a running scratchpad. You ALWAYS get text back,
29
22
  even on 'incomplete' / 'timeout' / 'api_error' / 'network_error' paths.
30
23
  - Tasks that need shell ('pnpm', 'pytest', 'tsc', 'git') only work on
31
- providers configured with sandboxPolicy: 'none'. Otherwise keep shell
24
+ agents configured with sandboxPolicy: 'none'. Otherwise keep shell
32
25
  work on the parent session, not in a delegated sub-agent.
33
26
 
34
27
  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.
28
+ - Auto-routed tasks (no 'agentType' set) use 'standard' agent.
29
+ - If the selected agent lacks required capabilities, auto-escalate to 'complex'.
30
+ - If every agent fails, the best salvage is returned and the
31
+ per-task 'escalationLog' shows every attempt.
40
32
  - Status values: 'ok', 'incomplete', 'max_turns', 'timeout',
41
33
  'api_aborted', 'api_error', 'network_error', 'error'.
42
34
  'incomplete' = scratchpad salvage after a degenerate completion;
43
- 'api_aborted' = provider-side abort; 'api_error' = HTTP error with
35
+ 'api_aborted' = agent-side abort; 'api_error' = HTTP error with
44
36
  a numeric .status; 'network_error' = transport failure
45
37
  (ECONNREFUSED / ENOTFOUND / /network/i).
46
38
  - Streaming: if your MCP client passes '_meta.progressToken' on the
@@ -59,21 +51,21 @@ Escalation, statuses, streaming, and batch helpers:
59
51
  shared across multiple tasks are sent to the parent session only
60
52
  once.
61
53
 
62
- RESPONSE SHAPE (v0.3+): Every delegate_tasks response includes a top-level
54
+ RESPONSE SHAPE (v1.0+): Every delegate_tasks response includes a top-level
63
55
  batchId, mode ('full' or 'summary'), timings ({wallClockMs, sumOfTaskMs,
64
56
  estimatedParallelSavingsMs}), batchProgress ({totalTasks, completedTasks,
65
57
  incompleteTasks, failedTasks, successPercent}), and aggregateCost
66
- ({totalActualCostUSD, totalSavedCostUSD, actualCostUnavailableTasks,
67
- savedCostUnavailableTasks}). If the combined output across tasks is small,
58
+ ({totalActualCostUSD, totalSavedCostUSD}). If the combined output across tasks is small,
68
59
  mode: 'full' with inline outputs; if it exceeds the server's threshold
69
60
  (default 64 KB, configurable via env MULTI_MODEL_LARGE_RESPONSE_THRESHOLD_CHARS
70
61
  / config defaults.largeResponseThresholdChars / buildMcpServer option),
71
62
  mode: 'summary' with per-task outputLength + outputSha256 + _fetchWith
72
- hint — fetch individual outputs with get_task_output({ batchId, taskIndex }).
63
+ hint — fetch individual outputs with get_batch_slice({ batchId, slice: 'output', taskIndex }),
64
+ or per-task details with get_batch_slice({ batchId, slice: 'detail', taskIndex }).
73
65
  Set responseMode: 'full' to force inline, 'summary' to force summary, or
74
66
  omit for auto-escape.
75
67
 
76
- COVERAGE DECLARATION (v0.3+): For tasks with enumerable deliverables
68
+ COVERAGE DECLARATION (v1.0+): For tasks with enumerable deliverables
77
69
  (multi-file refactors, test generation across many functions, multi-PR
78
70
  review, per-endpoint reports, per-function test stubs, audit checklists),
79
71
  set expectedCoverage on the task spec with either minSections: N,
@@ -85,7 +77,7 @@ Do NOT set expectedCoverage for one-shot tasks (bug fixes, single
85
77
  implementations, prose, creative writing) — the field is opt-in and has
86
78
  no meaning for deliverables you can't enumerate ahead of time.
87
79
 
88
- COST + TIME VISIBILITY (v0.3+): Set parentModel on the task spec (e.g.
80
+ COST + TIME VISIBILITY (v1.0+): Set parentModel on the task spec (e.g.
89
81
  'claude-opus-4-6') to get usage.savedCostUSD — the ESTIMATED cost
90
82
  difference vs running the same token volume on that parent model.
91
83
  Positive means delegation was cheaper. Both usage.costUSD (actual) and
@@ -97,39 +89,17 @@ serial for-loop. batchProgress.successPercent is a clean-success rate
97
89
  (the batch is always 100% done by the time you see the response —
98
90
  successPercent measures how many finished cleanly, NOT progress).
99
91
 
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
92
  AVAILABLE TOOLS: delegate_tasks (this one), register_context_block
121
93
  (stash reusable brief content referenced via TaskSpec.contextBlockIds),
122
94
  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).`;
125
- function renderProviderBlock(name, config, capabilities, profile, costSource) {
126
- const cost = getEffectiveCostTier(config);
127
- const costSuffix = costSource === 'config' ? ' (from config)' : '';
95
+ get_batch_slice (fetch outputs/details/telemetry when a response was in
96
+ summary mode or for per-task introspection).`;
97
+ function renderAgentBlock(name, config, capabilities, profile) {
128
98
  const effortLabel = profile.supportsEffort ? 'supported' : 'not supported';
129
99
  const lines = [
130
100
  `${name} (${config.model})`,
131
- ` tools: ${capabilities.join(', ')}`,
132
- ` tier: ${profile.tier} | cost: ${cost}${costSuffix} | effort: ${effortLabel}`,
101
+ ` capabilities: ${capabilities.join(', ') || '(none)'}`,
102
+ ` cost: ${profile.defaultCost} | effort: ${effortLabel}`,
133
103
  ` best for: ${profile.bestFor}`,
134
104
  ];
135
105
  if (profile.notes) {
@@ -142,20 +112,22 @@ function renderProviderBlock(name, config, capabilities, profile, costSource) {
142
112
  }
143
113
  /**
144
114
  * Renders the full routing matrix for the MCP tool description.
145
- * Helps the consuming LLM understand provider capabilities and routing rules.
115
+ * Helps the consuming LLM understand agent capabilities and routing rules.
146
116
  */
147
117
  export function renderProviderRoutingMatrix(config) {
148
- const blocks = Object.entries(config.providers).map(([name, providerConfig]) => {
149
- const capabilities = getBaseCapabilities(providerConfig);
150
- const profile = findModelProfile(providerConfig.model);
151
- const costSource = providerConfig.costTier ? 'config' : 'default';
152
- return renderProviderBlock(name, providerConfig, capabilities, profile, costSource);
118
+ if (!config.agents) {
119
+ return 'No agents configured.';
120
+ }
121
+ const blocks = Object.entries(config.agents).map(([name, agentConfig]) => {
122
+ const capabilities = agentConfig.capabilities ?? findModelCapabilities(agentConfig.model);
123
+ const profile = findModelProfile(agentConfig.model);
124
+ return renderAgentBlock(name, agentConfig, capabilities, profile);
153
125
  });
154
126
  return [
155
- 'Delegate tasks to sub-agents running on different LLM providers.',
127
+ 'Delegate tasks to sub-agents running on different LLM models.',
156
128
  'All tasks execute concurrently.',
157
129
  '',
158
- 'Available providers:',
130
+ 'Available agents:',
159
131
  '',
160
132
  blocks.join('\n\n'),
161
133
  '',
@@ -1 +1 @@
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,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yB,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;QACd,EAAE;QACF,UAAU;KACX,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,qBAAqB,EAAE,gBAAgB,EAAE,MAAM,0DAA0D,CAAC;AAGnH,MAAM,cAAc,GAAG;;;;;;;;;;;;;kDAa2B,CAAC;AAEnD,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;6CAgF0B,CAAC;AAE9C,SAAS,gBAAgB,CACvB,IAAY,EACZ,MAAmB,EACnB,YAA4C,EAC5C,OAAqB;IAErB,MAAM,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,eAAe,CAAC;IAC3E,MAAM,KAAK,GAAG;QACZ,GAAG,IAAI,KAAK,MAAM,CAAC,KAAK,GAAG;QAC3B,mBAAmB,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,QAAQ,EAAE;QACxD,WAAW,OAAO,CAAC,WAAW,cAAc,WAAW,EAAE;QACzD,eAAe,OAAO,CAAC,OAAO,EAAE;KACjC,CAAC;IACF,IAAI,OAAO,CAAC,KAAK,EAAE,CAAC;QAClB,KAAK,CAAC,IAAI,CAAC,WAAW,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;IACzC,CAAC;IACD,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;QACrB,KAAK,CAAC,IAAI,CAAC,gBAAgB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACjD,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,2BAA2B,CAAC,MAAwB;IAClE,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACnB,OAAO,uBAAuB,CAAC;IACjC,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE,EAAE;QACvE,MAAM,YAAY,GAAG,WAAW,CAAC,YAAY,IAAI,qBAAqB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC1F,MAAM,OAAO,GAAG,gBAAgB,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACpD,OAAO,gBAAgB,CAAC,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,+DAA+D;QAC/D,iCAAiC;QACjC,EAAE;QACF,mBAAmB;QACnB,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"}
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import type { MultiModelConfig } from '@zhixuan92/multi-model-agent-core';
4
+ export declare const auditDocumentSchema: z.ZodObject<{
5
+ document: z.ZodString;
6
+ auditType: z.ZodEnum<{
7
+ security: "security";
8
+ performance: "performance";
9
+ correctness: "correctness";
10
+ style: "style";
11
+ }>;
12
+ agentType: z.ZodOptional<z.ZodEnum<{
13
+ standard: "standard";
14
+ complex: "complex";
15
+ }>>;
16
+ }, z.core.$strip>;
17
+ export type AuditDocumentParams = z.infer<typeof auditDocumentSchema>;
18
+ export declare function registerAuditDocument(server: McpServer, config: MultiModelConfig): void;
19
+ //# sourceMappingURL=audit-document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-document.d.ts","sourceRoot":"","sources":["../../src/tools/audit-document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAG1E,eAAO,MAAM,mBAAmB;;;;;;;;;;;;iBAI9B,CAAC;AAEH,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEtE,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,QA8BhF"}
@@ -0,0 +1,30 @@
1
+ import { z } from 'zod';
2
+ import { runTasks } from '@zhixuan92/multi-model-agent-core/run-tasks';
3
+ export const auditDocumentSchema = z.object({
4
+ document: z.string().describe('The document to audit'),
5
+ auditType: z.enum(['security', 'performance', 'correctness', 'style']).describe('Type of audit'),
6
+ agentType: z.enum(['standard', 'complex']).optional(),
7
+ });
8
+ export function registerAuditDocument(server, config) {
9
+ server.tool('audit_document', 'Audit a document for security, performance, correctness, or style issues using a single agent (defaults to complex).', auditDocumentSchema.shape, async (params) => {
10
+ const agentType = params.agentType ?? 'complex';
11
+ const prompt = `Audit this document for ${params.auditType}:\n\n${params.document}\n\n` +
12
+ `Provide a structured audit report with findings and severity.`;
13
+ try {
14
+ const results = await runTasks([{ prompt, agentType, reviewPolicy: 'off' }], config);
15
+ const result = results[0];
16
+ return {
17
+ content: [
18
+ { type: 'text', text: result.output },
19
+ ],
20
+ };
21
+ }
22
+ catch (err) {
23
+ return {
24
+ content: [{ type: 'text', text: `Error: ${err instanceof Error ? err.message : String(err)}` }],
25
+ isError: true,
26
+ };
27
+ }
28
+ });
29
+ }
30
+ //# sourceMappingURL=audit-document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"audit-document.js","sourceRoot":"","sources":["../../src/tools/audit-document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AAEvE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC1C,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,uBAAuB,CAAC;IACtD,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,aAAa,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,eAAe,CAAC;IAChG,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE;CACtD,CAAC,CAAC;AAIH,MAAM,UAAU,qBAAqB,CAAC,MAAiB,EAAE,MAAwB;IAC/E,MAAM,CAAC,IAAI,CACT,gBAAgB,EAChB,sHAAsH,EACtH,mBAAmB,CAAC,KAAK,EACzB,KAAK,EAAE,MAA2B,EAAE,EAAE;QACpC,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,IAAI,SAAS,CAAC;QAChD,MAAM,MAAM,GAAG,2BAA2B,MAAM,CAAC,SAAS,QAAQ,MAAM,CAAC,QAAQ,MAAM;YACrF,+DAA+D,CAAC;QAElE,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,MAAM,QAAQ,CAC5B,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,CAAC,EAC5C,MAAM,CACP,CAAC;YAEF,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAC1B,OAAO;gBACL,OAAO,EAAE;oBACP,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE;iBAC/C;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,UAAU,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;gBACxG,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { z } from 'zod';
2
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import type { MultiModelConfig } from '@zhixuan92/multi-model-agent-core';
4
+ export declare const debugTaskSchema: z.ZodObject<{
5
+ problem: z.ZodString;
6
+ context: z.ZodOptional<z.ZodString>;
7
+ hypothesis: z.ZodOptional<z.ZodString>;
8
+ agentType: z.ZodOptional<z.ZodEnum<{
9
+ standard: "standard";
10
+ complex: "complex";
11
+ }>>;
12
+ }, z.core.$strip>;
13
+ export type DebugTaskParams = z.infer<typeof debugTaskSchema>;
14
+ export declare function registerDebugTask(server: McpServer, config: MultiModelConfig): void;
15
+ //# sourceMappingURL=debug-task.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-task.d.ts","sourceRoot":"","sources":["../../src/tools/debug-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAG1E,eAAO,MAAM,eAAe;;;;;;;;iBAK1B,CAAC;AAEH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAE9D,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,QAgC5E"}
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import { runTasks } from '@zhixuan92/multi-model-agent-core/run-tasks';
3
+ export const debugTaskSchema = z.object({
4
+ problem: z.string().describe('Description of the problem to debug'),
5
+ context: z.string().optional().describe('Additional context about the problem'),
6
+ hypothesis: z.string().optional().describe('Initial hypothesis about the cause'),
7
+ agentType: z.enum(['standard', 'complex']).optional(),
8
+ });
9
+ export function registerDebugTask(server, config) {
10
+ server.tool('debug_task', 'Debug a problem using hypothesis-driven approach with two attempts.', debugTaskSchema.shape, async (params) => {
11
+ const agentType = params.agentType ?? 'complex';
12
+ const prompt = `Debug this problem:\n\n${params.problem}\n\n` +
13
+ (params.context ? `Context: ${params.context}\n\n` : '') +
14
+ (params.hypothesis ? `Initial hypothesis: ${params.hypothesis}\n\n` : '') +
15
+ `Use hypothesis-driven debugging: identify root cause, propose fix, verify.`;
16
+ try {
17
+ const results = await runTasks([{ prompt, agentType, maxReviewRounds: 1 }], config);
18
+ const result = results[0];
19
+ return {
20
+ content: [
21
+ { type: 'text', text: result.output },
22
+ ],
23
+ };
24
+ }
25
+ catch (err) {
26
+ return {
27
+ content: [{ type: 'text', text: `Error: ${err instanceof Error ? err.message : String(err)}` }],
28
+ isError: true,
29
+ };
30
+ }
31
+ });
32
+ }
33
+ //# sourceMappingURL=debug-task.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"debug-task.js","sourceRoot":"","sources":["../../src/tools/debug-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGx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O;gBACL,OAAO,EAAE;oBACP,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE;iBAC/C;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,UAAU,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;gBACxG,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { z } from 'zod';
2
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import type { MultiModelConfig } from '@zhixuan92/multi-model-agent-core';
4
+ export declare const executePlanTaskSchema: z.ZodObject<{
5
+ prompt: z.ZodString;
6
+ agentType: z.ZodOptional<z.ZodEnum<{
7
+ standard: "standard";
8
+ complex: "complex";
9
+ }>>;
10
+ requiredCapabilities: z.ZodOptional<z.ZodArray<z.ZodEnum<{
11
+ web_search: "web_search";
12
+ web_fetch: "web_fetch";
13
+ }>>>;
14
+ maxTurns: z.ZodOptional<z.ZodNumber>;
15
+ timeoutMs: z.ZodOptional<z.ZodNumber>;
16
+ cwd: z.ZodOptional<z.ZodString>;
17
+ reviewPolicy: z.ZodOptional<z.ZodEnum<{
18
+ full: "full";
19
+ spec_only: "spec_only";
20
+ off: "off";
21
+ }>>;
22
+ maxReviewRounds: z.ZodOptional<z.ZodNumber>;
23
+ }, z.core.$strip>;
24
+ export type ExecutePlanTaskParams = z.infer<typeof executePlanTaskSchema>;
25
+ export declare function registerExecutePlanTask(server: McpServer, config: MultiModelConfig): void;
26
+ //# sourceMappingURL=execute-plan-task.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute-plan-task.d.ts","sourceRoot":"","sources":["../../src/tools/execute-plan-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAG1E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;iBAShC,CAAC;AAEH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE1E,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,QA2ClF"}
@@ -0,0 +1,49 @@
1
+ import { z } from 'zod';
2
+ import { runTasks } from '@zhixuan92/multi-model-agent-core/run-tasks';
3
+ export const executePlanTaskSchema = z.object({
4
+ prompt: z.string().describe('Task prompt for the sub-agent'),
5
+ agentType: z.enum(['standard', 'complex']).optional().describe('Which labor agent to use'),
6
+ requiredCapabilities: z.array(z.enum(['web_search', 'web_fetch'])).optional(),
7
+ maxTurns: z.number().optional(),
8
+ timeoutMs: z.number().optional(),
9
+ cwd: z.string().optional(),
10
+ reviewPolicy: z.enum(['full', 'spec_only', 'off']).optional(),
11
+ maxReviewRounds: z.number().optional(),
12
+ });
13
+ export function registerExecutePlanTask(server, config) {
14
+ server.tool('execute_plan_task', 'Execute a single task with optional TDD awareness. ' +
15
+ 'The task is run through the reviewed execution pipeline.', executePlanTaskSchema.shape, async (params) => {
16
+ try {
17
+ const results = await runTasks([{
18
+ prompt: params.prompt,
19
+ agentType: params.agentType ?? 'standard',
20
+ requiredCapabilities: params.requiredCapabilities,
21
+ maxTurns: params.maxTurns,
22
+ timeoutMs: params.timeoutMs,
23
+ cwd: params.cwd,
24
+ reviewPolicy: params.reviewPolicy,
25
+ maxReviewRounds: params.maxReviewRounds,
26
+ }], config);
27
+ const result = results[0];
28
+ return {
29
+ content: [
30
+ { type: 'text', text: result.output },
31
+ { type: 'text', text: JSON.stringify({
32
+ status: result.status,
33
+ workerStatus: result.workerStatus,
34
+ specReviewStatus: result.specReviewStatus,
35
+ qualityReviewStatus: result.qualityReviewStatus,
36
+ usage: result.usage,
37
+ }, null, 2) },
38
+ ],
39
+ };
40
+ }
41
+ catch (err) {
42
+ return {
43
+ content: [{ type: 'text', text: `Error: ${err instanceof Error ? err.message : String(err)}` }],
44
+ isError: true,
45
+ };
46
+ }
47
+ });
48
+ }
49
+ //# sourceMappingURL=execute-plan-task.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execute-plan-task.js","sourceRoot":"","sources":["../../src/tools/execute-plan-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AAEvE,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;IAC5D,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0BAA0B,CAAC;IAC1F,oBAAoB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IAC7E,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC/B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAChC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,YAAY,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC,CAAC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YACb,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,UAAU,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;gBACxG,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { z } from 'zod';
2
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import type { MultiModelConfig } from '@zhixuan92/multi-model-agent-core';
4
+ export declare const reviewCodeSchema: z.ZodObject<{
5
+ code: z.ZodString;
6
+ focus: z.ZodOptional<z.ZodArray<z.ZodEnum<{
7
+ security: "security";
8
+ performance: "performance";
9
+ correctness: "correctness";
10
+ style: "style";
11
+ }>>>;
12
+ agentType: z.ZodOptional<z.ZodEnum<{
13
+ standard: "standard";
14
+ complex: "complex";
15
+ }>>;
16
+ }, z.core.$strip>;
17
+ export type ReviewCodeParams = z.infer<typeof reviewCodeSchema>;
18
+ export declare function registerReviewCode(server: McpServer, config: MultiModelConfig): void;
19
+ //# sourceMappingURL=review-code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review-code.d.ts","sourceRoot":"","sources":["../../src/tools/review-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAG1E,eAAO,MAAM,gBAAgB;;;;;;;;;;;;iBAI3B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,QA+B7E"}
@@ -0,0 +1,31 @@
1
+ import { z } from 'zod';
2
+ import { runTasks } from '@zhixuan92/multi-model-agent-core/run-tasks';
3
+ export const reviewCodeSchema = z.object({
4
+ code: z.string().describe('The code to review'),
5
+ focus: z.array(z.enum(['security', 'performance', 'correctness', 'style'])).optional(),
6
+ agentType: z.enum(['standard', 'complex']).optional(),
7
+ });
8
+ export function registerReviewCode(server, config) {
9
+ server.tool('review_code', 'Review code using a cross-model approach (standard agent implements, complex agent reviews).', reviewCodeSchema.shape, async (params) => {
10
+ const agentType = params.agentType ?? 'complex';
11
+ const focusText = params.focus ? `Focus areas: ${params.focus.join(', ')}.` : '';
12
+ const prompt = `Review this code:\n\n\`\`\`\n${params.code}\n\`\`\`\n\n${focusText}\n\n` +
13
+ `Provide a structured review with findings and recommendations.`;
14
+ try {
15
+ const results = await runTasks([{ prompt, agentType, reviewPolicy: 'full' }], config);
16
+ const result = results[0];
17
+ return {
18
+ content: [
19
+ { type: 'text', text: result.output },
20
+ ],
21
+ };
22
+ }
23
+ catch (err) {
24
+ return {
25
+ content: [{ type: 'text', text: `Error: ${err instanceof Error ? err.message : String(err)}` }],
26
+ isError: true,
27
+ };
28
+ }
29
+ });
30
+ }
31
+ //# sourceMappingURL=review-code.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review-code.js","sourceRoot":"","sources":["../../src/tools/review-code.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,QAAQ,EAAE,MAAM,6CAA6C,CAAC;AAEvE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC;IAC/C,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,aAAa,EAAE,aAAa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d,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
+ import type { MultiModelConfig } from '@zhixuan92/multi-model-agent-core';
4
+ export declare const verifyWorkSchema: z.ZodObject<{
5
+ work: z.ZodString;
6
+ checklist: z.ZodArray<z.ZodString>;
7
+ agentType: z.ZodOptional<z.ZodEnum<{
8
+ standard: "standard";
9
+ complex: "complex";
10
+ }>>;
11
+ }, z.core.$strip>;
12
+ export type VerifyWorkParams = z.infer<typeof verifyWorkSchema>;
13
+ export declare function registerVerifyWork(server: McpServer, config: MultiModelConfig): void;
14
+ //# sourceMappingURL=verify-work.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"verify-work.d.ts","sourceRoot":"","sources":["../../src/tools/verify-work.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAG1E,eAAO,MAAM,gBAAgB;;;;;;;iBAI3B,CAAC;AAEH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEhE,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,gBAAgB,QAgC7E"}