@zhixuan92/multi-model-agent 3.10.1 → 3.10.2
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 +2 -2
- package/dist/skills/mma-audit/SKILL.md +1 -1
- package/dist/skills/mma-clarifications/SKILL.md +1 -1
- package/dist/skills/mma-context-blocks/SKILL.md +1 -1
- package/dist/skills/mma-debug/SKILL.md +1 -1
- package/dist/skills/mma-delegate/SKILL.md +1 -1
- package/dist/skills/mma-execute-plan/SKILL.md +1 -1
- package/dist/skills/mma-investigate/SKILL.md +1 -1
- package/dist/skills/mma-retry/SKILL.md +1 -1
- package/dist/skills/mma-review/SKILL.md +1 -1
- package/dist/skills/mma-verify/SKILL.md +1 -1
- package/dist/skills/multi-model-agent/SKILL.md +1 -1
- package/dist/telemetry/recorder.js +11 -2
- package/dist/telemetry/recorder.js.map +1 -1
- package/package.json +2 -2
- package/dist/circle.d.ts +0 -15
- package/dist/circle.d.ts.map +0 -1
- package/dist/circle.js +0 -20
- package/dist/circle.js.map +0 -1
- package/dist/utils/triangle.d.ts +0 -11
- package/dist/utils/triangle.d.ts.map +0 -1
- package/dist/utils/triangle.js +0 -22
- package/dist/utils/triangle.js.map +0 -1
package/README.md
CHANGED
|
@@ -84,7 +84,7 @@ Two ways — pick one:
|
|
|
84
84
|
|
|
85
85
|
```bash
|
|
86
86
|
mmagent serve # 127.0.0.1:7337 by default
|
|
87
|
-
curl -s http://localhost:7337/health # → {"ok":true,"version":"3.10.
|
|
87
|
+
curl -s http://localhost:7337/health # → {"ok":true,"version":"3.10.2",...}
|
|
88
88
|
```
|
|
89
89
|
|
|
90
90
|
For an always-on background install (survives reboots): [launchd / systemd templates](./scripts/README.md).
|
|
@@ -287,7 +287,7 @@ Full design rationale: [DIRECTION.md](https://github.com/zhixuan312/multi-model-
|
|
|
287
287
|
|
|
288
288
|
## What's new
|
|
289
289
|
|
|
290
|
-
Latest: **3.10.
|
|
290
|
+
Latest: **3.10.2** — telemetry data-correctness patch. Top-level token/cost totals now sum every stage in the V3 event (no longer drop reviewer + earlier-impl rounds). `spec_rework` / `quality_rework` entries appear in `stages[]` when the rework loop runs. `committing.filesCommittedCount` is wired (was hardcoded 0). Per-stage and top-level value clamping at V3 schema caps. V3 superRefine validation (R3, R10b) enforced at emit time — invalid events are dropped client-side. Full history: [CHANGELOG](https://github.com/zhixuan312/multi-model-agent/blob/master/CHANGELOG.md).
|
|
291
291
|
|
|
292
292
|
## Full documentation
|
|
293
293
|
|
|
@@ -8,7 +8,7 @@ when_to_use: >-
|
|
|
8
8
|
User asks for a doc/spec/config audit OR a methodology skill
|
|
9
9
|
(superpowers:dispatching-parallel-agents, /security-review) points at one AND
|
|
10
10
|
mmagent is running. Audit on PROSE/SPEC docs — use mma-review for source code.
|
|
11
|
-
version: 3.10.
|
|
11
|
+
version: 3.10.2
|
|
12
12
|
---
|
|
13
13
|
|
|
14
14
|
# mma-audit
|
|
@@ -12,7 +12,7 @@ when_to_use: >-
|
|
|
12
12
|
`proposedInterpretation` is a hard gate — the batch is paused, not
|
|
13
13
|
informational. The batch will not complete until the caller responds. Treating
|
|
14
14
|
it as advisory is the clarification-as-info anti-pattern (AP5).
|
|
15
|
-
version: 3.10.
|
|
15
|
+
version: 3.10.2
|
|
16
16
|
---
|
|
17
17
|
|
|
18
18
|
# mma-clarifications
|
|
@@ -12,7 +12,7 @@ when_to_use: >-
|
|
|
12
12
|
Register once here, then pass the ID via `contextBlockIds` on mma-delegate /
|
|
13
13
|
mma-execute-plan / mma-audit / mma-review / mma-verify / mma-debug /
|
|
14
14
|
mma-investigate. Cheaper and faster than inlining the same content N times.
|
|
15
|
-
version: 3.10.
|
|
15
|
+
version: 3.10.2
|
|
16
16
|
---
|
|
17
17
|
|
|
18
18
|
# mma-context-blocks
|
|
@@ -10,7 +10,7 @@ when_to_use: >-
|
|
|
10
10
|
read files, reproduce, trace — OR a methodology skill
|
|
11
11
|
(superpowers:systematic-debugging) points at the investigation step. Delegate
|
|
12
12
|
the read/reproduce/trace; the main agent stays on the hypothesis and the fix.
|
|
13
|
-
version: 3.10.
|
|
13
|
+
version: 3.10.2
|
|
14
14
|
---
|
|
15
15
|
|
|
16
16
|
# mma-debug
|
|
@@ -11,7 +11,7 @@ when_to_use: >-
|
|
|
11
11
|
and keep main context free. If a plan file exists → use mma-execute-plan. If
|
|
12
12
|
the task is audit / review / verify / debug / investigate → use the matching
|
|
13
13
|
specialized skill.
|
|
14
|
-
version: 3.10.
|
|
14
|
+
version: 3.10.2
|
|
15
15
|
---
|
|
16
16
|
|
|
17
17
|
# mma-delegate
|
|
@@ -10,7 +10,7 @@ when_to_use: >-
|
|
|
10
10
|
superpowers:subagent-driven-development / superpowers:executing-plans —
|
|
11
11
|
workers are cheaper and don't pollute main context. Task descriptors must
|
|
12
12
|
match plan headings verbatim.
|
|
13
|
-
version: 3.10.
|
|
13
|
+
version: 3.10.2
|
|
14
14
|
---
|
|
15
15
|
|
|
16
16
|
# mma-execute-plan
|
|
@@ -12,7 +12,7 @@ when_to_use: >-
|
|
|
12
12
|
git-history queries. OR you are about to read 3+ files / run any grep in main
|
|
13
13
|
context — that's the inline-labor-leakage anti-pattern (AP2); delegate to this
|
|
14
14
|
skill instead.
|
|
15
|
-
version: 3.10.
|
|
15
|
+
version: 3.10.2
|
|
16
16
|
---
|
|
17
17
|
|
|
18
18
|
# mma-investigate
|
|
@@ -10,7 +10,7 @@ when_to_use: >-
|
|
|
10
10
|
you want to re-try the failed indices only. Prefer this over re-dispatching
|
|
11
11
|
the whole batch or inline-retrying — it's idempotent and preserves the
|
|
12
12
|
original batch's diagnostics.
|
|
13
|
-
version: 3.10.
|
|
13
|
+
version: 3.10.2
|
|
14
14
|
---
|
|
15
15
|
|
|
16
16
|
# mma-retry
|
|
@@ -10,7 +10,7 @@ when_to_use: >-
|
|
|
10
10
|
AND mmagent is running. Delegate so each file reviews on its own worker; the
|
|
11
11
|
main agent only decides what to merge. Review on SOURCE CODE — use mma-audit
|
|
12
12
|
for prose specs / configs.
|
|
13
|
-
version: 3.10.
|
|
13
|
+
version: 3.10.2
|
|
14
14
|
---
|
|
15
15
|
|
|
16
16
|
# mma-review
|
|
@@ -10,7 +10,7 @@ when_to_use: >-
|
|
|
10
10
|
against implemented work BEFORE claiming success. Delegate so each checklist
|
|
11
11
|
item gets independent evidence-gathering on a worker. Use this BEFORE saying
|
|
12
12
|
"done" — never after.
|
|
13
|
-
version: 3.10.
|
|
13
|
+
version: 3.10.2
|
|
14
14
|
---
|
|
15
15
|
|
|
16
16
|
# mma-verify
|
|
@@ -11,7 +11,7 @@ when_to_use: >-
|
|
|
11
11
|
tasks — AND mmagent is running. Read this once, pick the matching mma-* skill,
|
|
12
12
|
and delegate there. Applies equally whether the user invoked a superpowers
|
|
13
13
|
methodology skill or asked directly.
|
|
14
|
-
version: 3.10.
|
|
14
|
+
version: 3.10.2
|
|
15
15
|
---
|
|
16
16
|
|
|
17
17
|
# multi-model-agent (router)
|
|
@@ -6,7 +6,7 @@ import { deleteInstallId } from './install-id.js';
|
|
|
6
6
|
import { buildInstallMeta } from './install-meta.js';
|
|
7
7
|
import { Queue } from './queue.js';
|
|
8
8
|
import { readGeneration, bumpGeneration } from './generation.js';
|
|
9
|
-
import { SCHEMA_VERSION } from '@zhixuan92/multi-model-agent-core/telemetry/types';
|
|
9
|
+
import { SCHEMA_VERSION, ValidatedTaskCompletedEventSchema } from '@zhixuan92/multi-model-agent-core/telemetry/types';
|
|
10
10
|
import { buildTaskCompletedEvent, } from '@zhixuan92/multi-model-agent-core/telemetry/event-builder';
|
|
11
11
|
let _recorder = null;
|
|
12
12
|
export function getRecorder() {
|
|
@@ -66,7 +66,16 @@ function _buildRecorder(opts) {
|
|
|
66
66
|
const d = decide(homeDir);
|
|
67
67
|
if (!d.enabled)
|
|
68
68
|
return;
|
|
69
|
-
|
|
69
|
+
const event = buildTaskCompletedEvent(ctx);
|
|
70
|
+
const parsed = ValidatedTaskCompletedEventSchema.safeParse(event);
|
|
71
|
+
if (!parsed.success) {
|
|
72
|
+
console.warn('mma-telemetry: dropping invalid event', {
|
|
73
|
+
eventId: event.eventId,
|
|
74
|
+
issues: parsed.error.issues.map((e) => ({ path: e.path.join('.'), message: e.message })),
|
|
75
|
+
});
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
enqueue(parsed.data);
|
|
70
79
|
}
|
|
71
80
|
catch {
|
|
72
81
|
dropped++;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recorder.js","sourceRoot":"","sources":["../../src/telemetry/recorder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjE,OAAO,EAAE,cAAc,EAAE,MAAM,mDAAmD,CAAC;
|
|
1
|
+
{"version":3,"file":"recorder.js","sourceRoot":"","sources":["../../src/telemetry/recorder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CA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AAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;qBACzF,CAAC,CAAC;oBACH,OAAO;gBACT,CAAC;gBACD,OAAO,CAAC,MAAM,CAAC,IAA+B,CAAC,CAAC;YAClD,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,EAAE,CAAC;YACZ,CAAC;QACH,CAAC;QAED,KAAK,CAAC,cAAc,CAAC,OAAO;YAC1B,MAAM,cAAc,CAAC,OAAO,CAAC,CAAC;YAC9B,UAAU,CAAC,KAAK,EAAE,CAAC;YACnB,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,EAAE,wBAAwB,CAAC,CAAC;YAC1D,IAAI,UAAU,CAAC,SAAS,CAAC;gBAAE,UAAU,CAAC,SAAS,CAAC,CAAC;YACjD,UAAU,GAAG,IAAI,CAAC;YAClB,IAAI,OAAO,EAAE,eAAe,EAAE,CAAC;gBAC7B,eAAe,CAAC,OAAO,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zhixuan92/multi-model-agent",
|
|
3
|
-
"version": "3.10.
|
|
3
|
+
"version": "3.10.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Standalone HTTP server for multi-model-agent. Routes tool-invocation work to Claude, Codex, or OpenAI-compatible sub-agents with async-polling REST dispatch and installable skills for Claude Code, Gemini CLI, Codex CLI, and Cursor.",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@asteasolutions/zod-to-openapi": "^8.5.0",
|
|
55
|
-
"@zhixuan92/multi-model-agent-core": "^3.10.
|
|
55
|
+
"@zhixuan92/multi-model-agent-core": "^3.10.2",
|
|
56
56
|
"gray-matter": "^4.0.3",
|
|
57
57
|
"minimist": "^1.2.8",
|
|
58
58
|
"proper-lockfile": "^4.1.2",
|
package/dist/circle.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calculates the area of a circle given its radius.
|
|
3
|
-
*
|
|
4
|
-
* @param radius - The radius of the circle (must be positive).
|
|
5
|
-
* @returns The area of the circle (π * radius²).
|
|
6
|
-
* @throws {RangeError} If `radius` is not a positive number.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* circleArea(1); // ≈ 3.14159
|
|
11
|
-
* circleArea(2.5); // ≈ 19.63495
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
export declare function circleArea(radius: number): number;
|
|
15
|
-
//# sourceMappingURL=circle.d.ts.map
|
package/dist/circle.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"circle.d.ts","sourceRoot":"","sources":["../src/circle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAMjD"}
|
package/dist/circle.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calculates the area of a circle given its radius.
|
|
3
|
-
*
|
|
4
|
-
* @param radius - The radius of the circle (must be positive).
|
|
5
|
-
* @returns The area of the circle (π * radius²).
|
|
6
|
-
* @throws {RangeError} If `radius` is not a positive number.
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```ts
|
|
10
|
-
* circleArea(1); // ≈ 3.14159
|
|
11
|
-
* circleArea(2.5); // ≈ 19.63495
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
export function circleArea(radius) {
|
|
15
|
-
if (radius <= 0) {
|
|
16
|
-
throw new RangeError(`radius must be a positive number, got ${radius}`);
|
|
17
|
-
}
|
|
18
|
-
return Math.PI * radius * radius;
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=circle.js.map
|
package/dist/circle.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"circle.js","sourceRoot":"","sources":["../src/circle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,UAAU,CAAC,MAAc;IACvC,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QAChB,MAAM,IAAI,UAAU,CAAC,yCAAyC,MAAM,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO,IAAI,CAAC,EAAE,GAAG,MAAM,GAAG,MAAM,CAAC;AACnC,CAAC"}
|
package/dist/utils/triangle.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calculates the area of a triangle given its base and height.
|
|
3
|
-
*
|
|
4
|
-
* @param base - The length of the triangle's base. Must be a positive number.
|
|
5
|
-
* @param height - The height of the triangle. Must be a positive number.
|
|
6
|
-
* @returns The area of the triangle (0.5 × base × height).
|
|
7
|
-
* @throws {TypeError} If either argument is not a finite number.
|
|
8
|
-
* @throws {RangeError} If either argument is not positive (> 0).
|
|
9
|
-
*/
|
|
10
|
-
export declare function triangleArea(base: number, height: number): number;
|
|
11
|
-
//# sourceMappingURL=triangle.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"triangle.d.ts","sourceRoot":"","sources":["../../src/utils/triangle.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAWjE"}
|
package/dist/utils/triangle.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Calculates the area of a triangle given its base and height.
|
|
3
|
-
*
|
|
4
|
-
* @param base - The length of the triangle's base. Must be a positive number.
|
|
5
|
-
* @param height - The height of the triangle. Must be a positive number.
|
|
6
|
-
* @returns The area of the triangle (0.5 × base × height).
|
|
7
|
-
* @throws {TypeError} If either argument is not a finite number.
|
|
8
|
-
* @throws {RangeError} If either argument is not positive (> 0).
|
|
9
|
-
*/
|
|
10
|
-
export function triangleArea(base, height) {
|
|
11
|
-
if (!Number.isFinite(base) || !Number.isFinite(height)) {
|
|
12
|
-
throw new TypeError('base and height must be finite numbers');
|
|
13
|
-
}
|
|
14
|
-
if (base <= 0) {
|
|
15
|
-
throw new RangeError(`base must be positive, received ${base}`);
|
|
16
|
-
}
|
|
17
|
-
if (height <= 0) {
|
|
18
|
-
throw new RangeError(`height must be positive, received ${height}`);
|
|
19
|
-
}
|
|
20
|
-
return (base * height) / 2;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=triangle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"triangle.js","sourceRoot":"","sources":["../../src/utils/triangle.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY,EAAE,MAAc;IACvD,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACvD,MAAM,IAAI,SAAS,CAAC,wCAAwC,CAAC,CAAC;IAChE,CAAC;IACD,IAAI,IAAI,IAAI,CAAC,EAAE,CAAC;QACd,MAAM,IAAI,UAAU,CAAC,mCAAmC,IAAI,EAAE,CAAC,CAAC;IAClE,CAAC;IACD,IAAI,MAAM,IAAI,CAAC,EAAE,CAAC;QAChB,MAAM,IAAI,UAAU,CAAC,qCAAqC,MAAM,EAAE,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AAC7B,CAAC"}
|