@zhixuan92/multi-model-agent 3.0.1 → 3.1.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 (56) hide show
  1. package/README.md +7 -3
  2. package/dist/cli/index.d.ts.map +1 -1
  3. package/dist/cli/index.js +76 -5
  4. package/dist/cli/index.js.map +1 -1
  5. package/dist/cli/info.d.ts +22 -0
  6. package/dist/cli/info.d.ts.map +1 -0
  7. package/dist/cli/info.js +100 -0
  8. package/dist/cli/info.js.map +1 -0
  9. package/dist/cli/install-skill.d.ts.map +1 -1
  10. package/dist/cli/install-skill.js +44 -39
  11. package/dist/cli/install-skill.js.map +1 -1
  12. package/dist/cli/logs.d.ts +15 -0
  13. package/dist/cli/logs.d.ts.map +1 -0
  14. package/dist/cli/logs.js +102 -0
  15. package/dist/cli/logs.js.map +1 -0
  16. package/dist/cli/serve.d.ts +0 -17
  17. package/dist/cli/serve.d.ts.map +1 -1
  18. package/dist/cli/serve.js +117 -2
  19. package/dist/cli/serve.js.map +1 -1
  20. package/dist/cli/update-skills.d.ts +16 -0
  21. package/dist/cli/update-skills.d.ts.map +1 -0
  22. package/dist/cli/update-skills.js +127 -0
  23. package/dist/cli/update-skills.js.map +1 -0
  24. package/dist/http/async-dispatch.d.ts.map +1 -1
  25. package/dist/http/async-dispatch.js +17 -0
  26. package/dist/http/async-dispatch.js.map +1 -1
  27. package/dist/http/execution-context.d.ts.map +1 -1
  28. package/dist/http/execution-context.js +34 -1
  29. package/dist/http/execution-context.js.map +1 -1
  30. package/dist/http/handlers/control/batch.d.ts +8 -10
  31. package/dist/http/handlers/control/batch.d.ts.map +1 -1
  32. package/dist/http/handlers/control/batch.js +55 -49
  33. package/dist/http/handlers/control/batch.js.map +1 -1
  34. package/dist/http/handlers/introspection/health.d.ts +9 -8
  35. package/dist/http/handlers/introspection/health.d.ts.map +1 -1
  36. package/dist/http/handlers/introspection/health.js +13 -9
  37. package/dist/http/handlers/introspection/health.js.map +1 -1
  38. package/dist/http/server.js +4 -5
  39. package/dist/http/server.js.map +1 -1
  40. package/dist/install/manifest.d.ts +8 -4
  41. package/dist/install/manifest.d.ts.map +1 -1
  42. package/dist/install/manifest.js +76 -18
  43. package/dist/install/manifest.js.map +1 -1
  44. package/dist/skills/_shared/polling.md +50 -23
  45. package/dist/skills/mma-audit/SKILL.md +12 -3
  46. package/dist/skills/mma-clarifications/SKILL.md +13 -5
  47. package/dist/skills/mma-context-blocks/SKILL.md +13 -4
  48. package/dist/skills/mma-debug/SKILL.md +12 -3
  49. package/dist/skills/mma-delegate/SKILL.md +13 -3
  50. package/dist/skills/mma-execute-plan/SKILL.md +13 -3
  51. package/dist/skills/mma-retry/SKILL.md +11 -3
  52. package/dist/skills/mma-review/SKILL.md +11 -3
  53. package/dist/skills/mma-verify/SKILL.md +10 -3
  54. package/dist/skills/multi-model-agent/SKILL.md +23 -6
  55. package/package.json +7 -4
  56. package/scripts/postinstall.js +36 -0
@@ -3,38 +3,65 @@
3
3
  After a tool call returns a `batchId`, poll `GET /batch/:id` until the batch
4
4
  reaches a terminal state.
5
5
 
6
- ### Terminal states
6
+ ### HTTP response shapes (3.1.0)
7
7
 
8
- | State | Meaning |
9
- |---|---|
10
- | `complete` | All tasks finishedread results |
11
- | `failed` | Batch failedread error details |
12
- | `expired` | Batch TTL exceededretry if needed |
8
+ | Status | Content-Type | Meaning |
9
+ |---|---|---|
10
+ | `202` | `text/plain` | Still working body is the running headline (e.g. `1/1 running, 47s elapsed`) |
11
+ | `200` | `application/json` | Terminal body is the uniform 7-field envelope (see `response-shape.md`) |
12
+ | `404` / `401` / other | | Errorstop polling |
13
+
14
+ ### Terminal envelope states
13
15
 
14
- ### Awaiting clarification
16
+ Every terminal envelope has the same seven fields; inspect these to tell
17
+ which terminal state you're in:
15
18
 
16
- If `GET /batch/:id` returns `state: 'awaiting_clarification'`, the service
17
- needs your confirmation before it can continue. Read `proposedInterpretation`
18
- from the response, then call `POST /clarifications/confirm` with your chosen
19
- `interpretation` (accept or correct the proposal).
19
+ | Shape | Meaning |
20
+ |---|---|
21
+ | `error` is a real object | Batch failed — read `error.code` + `error.message` |
22
+ | `proposedInterpretation` is a string | Batch is awaiting clarification — invoke `mma-clarifications` |
23
+ | Both are `{kind: "not_applicable", ...}` | Batch succeeded — read `results` |
20
24
 
21
- ### Poll loop (shell)
25
+ ### Poll loop (POSIX sh)
22
26
 
23
27
  ```bash
24
28
  DELAY=1
29
+ START=$(date +%s)
30
+ TIMEOUT_S=${MMAGENT_POLL_TIMEOUT_S:-1800}
31
+ BODY_FILE=$(mktemp -t mmagent-poll.XXXXXX)
32
+ trap 'rm -f "$BODY_FILE"' EXIT
33
+
25
34
  while true; do
26
- RESP=$(curl -sf -H "Authorization: Bearer $TOKEN" \
27
- "http://localhost:$PORT/batch/$BATCH_ID")
28
- STATE=$(echo "$RESP" | jq -r '.state')
29
- case "$STATE" in
30
- complete|failed|expired) echo "$RESP"; break ;;
31
- awaiting_clarification)
32
- # Invoke mma-clarifications to confirm interpretation, then continue
33
- break ;;
34
- *) sleep $DELAY; DELAY=$(( DELAY < 5 ? DELAY * 2 : 5 )) ;;
35
+ NOW=$(date +%s)
36
+ if [ $((NOW - START)) -ge "$TIMEOUT_S" ]; then
37
+ echo "mmagent: poll timed out after ${TIMEOUT_S}s" >&2
38
+ exit 124
39
+ fi
40
+
41
+ STATUS=$(curl -f --show-error -o "$BODY_FILE" -w "%{http_code}" -s \
42
+ -H "Authorization: Bearer $TOKEN" \
43
+ "http://127.0.0.1:$PORT/batch/$BATCH_ID" || true)
44
+
45
+ case "$STATUS" in
46
+ 202)
47
+ cat "$BODY_FILE"; echo
48
+ sleep "$DELAY"
49
+ DELAY=$(( DELAY < 30 ? DELAY * 2 : 30 ))
50
+ ;;
51
+ 200)
52
+ cat "$BODY_FILE"
53
+ exit 0
54
+ ;;
55
+ "")
56
+ echo "mmagent: unreachable (curl failed)" >&2; exit 1 ;;
57
+ *)
58
+ echo "mmagent: HTTP $STATUS"; cat "$BODY_FILE" >&2; exit 1 ;;
35
59
  esac
36
60
  done
37
61
  ```
38
62
 
39
- Start at 1 s, double each iteration, cap at 5 s. Most batches complete in
40
- under 60 s; long tasks may take several minutes.
63
+ Start at 1 s, double each iteration, cap at 30 s. The 1800-second client-side
64
+ timeout is a safety cap; most batches complete in under 60 s. Discover `$PORT`
65
+ at runtime with `mmagent info --json | jq -r .port` (default: 7337).
66
+
67
+ Windows/PowerShell equivalent is planned for a later release.
@@ -1,7 +1,16 @@
1
1
  ---
2
2
  name: mma-audit
3
- description: Audit a document for security, performance, correctness, or style issues. Sub-agents run in parallel per file.
4
- when_to_use: When you need to audit a spec, design doc, or configuration file for correctness, security, style, or performance issues.
3
+ description: >-
4
+ Audit a document, spec, or config for security, performance, correctness, or
5
+ style issues via the local mmagent HTTP service. Sub-agents run in parallel
6
+ per file — no context pollution in the main model.
7
+ when_to_use: >-
8
+ The user asks to audit a document, spec, or config (for security, correctness,
9
+ performance, or style) OR a methodology skill
10
+ (superpowers:dispatching-parallel-agents, /security-review) points at an audit
11
+ task. Delegate via mmagent so the audit runs on independent workers — your
12
+ main context stays free to synthesize findings.
13
+ version: 3.1.0
5
14
  ---
6
15
 
7
16
  ## mma-audit
@@ -38,7 +47,7 @@ Either `document` or `filePaths` (or both) must be provided.
38
47
  ### Full example
39
48
 
40
49
  ```bash
41
- BATCH=$(curl -sf -X POST \
50
+ BATCH=$(curl -f --show-error -s -X POST \
42
51
  -H "Authorization: Bearer $TOKEN" \
43
52
  -H "Content-Type: application/json" \
44
53
  -d '{"auditType":"correctness","filePaths":["/project/docs/api-spec.md"]}' \
@@ -1,7 +1,15 @@
1
1
  ---
2
2
  name: mma-clarifications
3
- description: Confirm or correct the service's proposed interpretation when a batch is awaiting clarification before it can proceed.
4
- when_to_use: When polling GET /batch/:id returns state 'awaiting_clarification'. Read proposedInterpretation, then call this skill to confirm or correct it.
3
+ description: >-
4
+ Confirm or correct mmagent's proposed interpretation when a batch is awaiting
5
+ clarification before it can proceed. Paired skill to every mma-* task
6
+ dispatcher.
7
+ when_to_use: >-
8
+ A previous mma-delegate / mma-audit / mma-review / mma-execute-plan / etc.
9
+ terminal envelope has `proposedInterpretation` as a string (not a
10
+ NotApplicable sentinel). Read the proposal and call this skill to accept or
11
+ correct it. The batch resumes after the POST returns.
12
+ version: 3.1.0
5
13
  ---
6
14
 
7
15
  ## mma-clarifications
@@ -46,15 +54,15 @@ executor was already waiting and finishes immediately.
46
54
 
47
55
  ```bash
48
56
  # 1. Poll until awaiting_clarification
49
- STATE=$(curl -sf -H "Authorization: Bearer $TOKEN" \
57
+ STATE=$(curl -f --show-error -s -H "Authorization: Bearer $TOKEN" \
50
58
  "http://localhost:$PORT/batch/$BATCH_ID" | jq -r '.state')
51
59
 
52
60
  # 2. Read the proposal
53
- PROPOSAL=$(curl -sf -H "Authorization: Bearer $TOKEN" \
61
+ PROPOSAL=$(curl -f --show-error -s -H "Authorization: Bearer $TOKEN" \
54
62
  "http://localhost:$PORT/batch/$BATCH_ID" | jq -r '.proposedInterpretation')
55
63
 
56
64
  # 3. Confirm (accept proposal or supply corrected text)
57
- curl -sf -X POST \
65
+ curl -f --show-error -s -X POST \
58
66
  -H "Authorization: Bearer $TOKEN" \
59
67
  -H "Content-Type: application/json" \
60
68
  -d "{\"batchId\":\"$BATCH_ID\",\"interpretation\":\"$PROPOSAL\"}" \
@@ -1,7 +1,16 @@
1
1
  ---
2
2
  name: mma-context-blocks
3
- description: Register large reused documents as context blocks and reference them by ID across multiple tool calls. Avoids re-sending the same content repeatedly.
4
- when_to_use: When the same large document (spec, plan, codebase summary) needs to be referenced by multiple mma-* calls. Register once, reference by ID.
3
+ description: >-
4
+ Register large reused documents (spec, plan, codebase summary) as a context
5
+ block the mmagent service caches, then reference it by ID across multiple
6
+ mma-* calls. Avoids re-uploading the same content on every task.
7
+ when_to_use: >-
8
+ A document larger than ~2 KB will be referenced by two or more mma-* calls in
9
+ a row. Register once here, then pass the returned ID via the contextBlockIds
10
+ field on mma-delegate / mma-execute-plan / mma-audit / mma-review / mma-verify
11
+ / mma-debug. Cheaper and faster than inlining the same content in every
12
+ request body.
13
+ version: 3.1.0
5
14
  ---
6
15
 
7
16
  ## mma-context-blocks
@@ -52,14 +61,14 @@ wait for those batches to complete before deleting.
52
61
 
53
62
  ```bash
54
63
  # Register spec document
55
- ID=$(curl -sf -X POST \
64
+ ID=$(curl -f --show-error -s -X POST \
56
65
  -H "Authorization: Bearer $TOKEN" \
57
66
  -H "Content-Type: application/json" \
58
67
  -d "{\"content\":$(jq -Rs . < /project/docs/spec.md)}" \
59
68
  "http://localhost:$PORT/context-blocks?cwd=/project" | jq -r '.id')
60
69
 
61
70
  # Use in a delegate call
62
- curl -sf -X POST \
71
+ curl -f --show-error -s -X POST \
63
72
  -H "Authorization: Bearer $TOKEN" \
64
73
  -H "Content-Type: application/json" \
65
74
  -d "{\"tasks\":[{\"prompt\":\"Implement per spec\",\"contextBlockIds\":[\"$ID\"]}]}" \
@@ -1,7 +1,16 @@
1
1
  ---
2
2
  name: mma-debug
3
- description: Debug a failure using a structured hypothesis. All provided files are investigated together in a single task.
4
- when_to_use: When a test fails, a build breaks, or unexpected behavior appears and you need a structured investigation with a hypothesis.
3
+ description: >-
4
+ Debug a failure using a structured hypothesis via the local mmagent HTTP
5
+ service. All provided files are investigated together in a single task on a
6
+ worker.
7
+ when_to_use: >-
8
+ A test fails, a build breaks, or behavior is unexpected AND you need to read
9
+ files, reproduce the failure, or narrow root cause OR a methodology skill
10
+ (superpowers:systematic-debugging) points at the investigation step. Delegate
11
+ the read/reproduce/trace work to a mmagent worker so your main context stays
12
+ focused on the hypothesis and the fix.
13
+ version: 3.1.0
5
14
  ---
6
15
 
7
16
  ## mma-debug
@@ -42,7 +51,7 @@ in a single task (not parallelised per file).
42
51
  ### Full example
43
52
 
44
53
  ```bash
45
- BATCH=$(curl -sf -X POST \
54
+ BATCH=$(curl -f --show-error -s -X POST \
46
55
  -H "Authorization: Bearer $TOKEN" \
47
56
  -H "Content-Type: application/json" \
48
57
  -d '{"problem":"Tests fail on CI only","hypothesis":"Missing env var","filePaths":["/project/src/config.ts"]}' \
@@ -1,7 +1,17 @@
1
1
  ---
2
2
  name: mma-delegate
3
- description: Fan out ad-hoc implementation or research tasks to sub-agents in parallel. Use when there is no plan file on disk.
4
- when_to_use: When you need to delegate one or more implementation or research tasks to sub-agents without a pre-existing plan file. Each task runs in parallel.
3
+ description: >-
4
+ Fan out ad-hoc implementation or research tasks to sub-agents in parallel via
5
+ the local mmagent HTTP service. Tasks run on cheap workers that don't consume
6
+ your main-model context window.
7
+ when_to_use: >-
8
+ You have one or more ad-hoc implementation or research tasks WITHOUT a plan
9
+ file on disk AND mmagent is running. Prefer this over inline Agent dispatches
10
+ or superpowers:dispatching-parallel-agents — delegated workers are cheaper,
11
+ parallel-safe, and keep main context free. If a plan file exists, use
12
+ mma-execute-plan; if the task is an audit/review/verify/debug, prefer the
13
+ matching mma-* skill instead.
14
+ version: 3.1.0
5
15
  ---
6
16
 
7
17
  ## mma-delegate
@@ -46,7 +56,7 @@ Use `agentType: "complex"` for ambiguous scope or security-sensitive tasks.
46
56
  ### Full example
47
57
 
48
58
  ```bash
49
- BATCH=$(curl -sf -X POST \
59
+ BATCH=$(curl -f --show-error -s -X POST \
50
60
  -H "Authorization: Bearer $TOKEN" \
51
61
  -H "Content-Type: application/json" \
52
62
  -d '{"tasks":[{"prompt":"Refactor utils.ts to remove dead code","filePaths":["/project/src/utils.ts"]}]}' \
@@ -1,7 +1,17 @@
1
1
  ---
2
2
  name: mma-execute-plan
3
- description: Implement tasks from a plan or spec file on disk. Task descriptors match plan headings; tasks run in parallel.
4
- when_to_use: When you have a written plan or spec file and want sub-agents to implement specific tasks from it.
3
+ description: >-
4
+ Execute tasks from a plan or spec file on disk via the local mmagent HTTP
5
+ service. Delegates to cheap sub-agents that don't consume your main-model
6
+ context window. Task descriptors match plan headings; tasks run in parallel.
7
+ when_to_use: >-
8
+ A plan file exists on disk (any markdown with numbered task headings —
9
+ docs/superpowers/plans/*.md, a TODO list, a spec doc) AND you need to
10
+ implement one or more tasks from it. Prefer this over inline Agent dispatches
11
+ or superpowers:subagent-driven-development / superpowers:executing-plans when
12
+ mmagent is running — delegated workers are cheaper and don't pollute main
13
+ context. Task descriptors must match the plan headings verbatim.
14
+ version: 3.1.0
5
15
  ---
6
16
 
7
17
  ## mma-execute-plan
@@ -46,7 +56,7 @@ to confirm or correct the proposed interpretation.
46
56
  ### Full example
47
57
 
48
58
  ```bash
49
- BATCH=$(curl -sf -X POST \
59
+ BATCH=$(curl -f --show-error -s -X POST \
50
60
  -H "Authorization: Bearer $TOKEN" \
51
61
  -H "Content-Type: application/json" \
52
62
  -d '{"tasks":["3. Migrate database schema"],"filePaths":["/project/docs/plan.md"]}' \
@@ -1,7 +1,15 @@
1
1
  ---
2
2
  name: mma-retry
3
- description: Re-run specific failed or incomplete tasks from a previous batch by index.
4
- when_to_use: When some tasks in a previous batch failed or returned incomplete results and you want to re-run only those tasks without re-running the whole batch.
3
+ description: >-
4
+ Re-run specific failed or incomplete tasks from a previous mmagent batch by
5
+ index. Preserves the original task specs and only re-executes the named
6
+ indices.
7
+ when_to_use: >-
8
+ A previous mma-delegate / mma-execute-plan batch returned partial results and
9
+ you want to re-try the failed indices only. Prefer this over redispatching the
10
+ whole batch or inline-retrying — it's idempotent and keeps the original
11
+ batch's diagnostics intact.
12
+ version: 3.1.0
5
13
  ---
6
14
 
7
15
  ## mma-retry
@@ -37,7 +45,7 @@ indices from `0` to `tasks.length - 1`.
37
45
 
38
46
  ```bash
39
47
  # Original batch had 4 tasks; re-run tasks at index 1 and 3
40
- BATCH=$(curl -sf -X POST \
48
+ BATCH=$(curl -f --show-error -s -X POST \
41
49
  -H "Authorization: Bearer $TOKEN" \
42
50
  -H "Content-Type: application/json" \
43
51
  -d '{"batchId":"550e8400-e29b-41d4-a716-446655440000","taskIndices":[1,3]}' \
@@ -1,7 +1,15 @@
1
1
  ---
2
2
  name: mma-review
3
- description: Review code for quality, security, performance, or correctness. Sub-agents run in parallel per file.
4
- when_to_use: When you need an independent code review after implementing a feature or fix, or before merging a branch.
3
+ description: >-
4
+ Review code for quality, security, performance, or correctness via the local
5
+ mmagent HTTP service. Sub-agents run in parallel per file, independent
6
+ context.
7
+ when_to_use: >-
8
+ The user asks for a code review, pre-merge check, or quality pass over one or
9
+ more files OR a methodology skill (superpowers:requesting-code-review,
10
+ /review, /security-review) points at a review task. Delegate the reviewer pass
11
+ to mmagent workers — your main context stays free to decide what to merge.
12
+ version: 3.1.0
5
13
  ---
6
14
 
7
15
  ## mma-review
@@ -38,7 +46,7 @@ Either `code` or `filePaths` (or both) must be provided.
38
46
  ### Full example
39
47
 
40
48
  ```bash
41
- BATCH=$(curl -sf -X POST \
49
+ BATCH=$(curl -f --show-error -s -X POST \
42
50
  -H "Authorization: Bearer $TOKEN" \
43
51
  -H "Content-Type: application/json" \
44
52
  -d '{"focus":["security","correctness"],"filePaths":["/project/src/auth/login.ts"]}' \
@@ -1,7 +1,14 @@
1
1
  ---
2
2
  name: mma-verify
3
- description: Verify work against a checklist. Sub-agents check each item independently.
4
- when_to_use: When you need to confirm that implemented work meets a set of acceptance criteria or a review checklist before claiming completion.
3
+ description: >-
4
+ Verify work against a checklist via the local mmagent HTTP service. Sub-agents
5
+ check each item independently.
6
+ when_to_use: >-
7
+ The user (or a methodology skill like
8
+ superpowers:verification-before-completion) wants acceptance-criteria checked
9
+ against implemented work. Delegate the evidence-gathering to mmagent workers —
10
+ each checklist item is verified independently and in parallel.
11
+ version: 3.1.0
5
12
  ---
6
13
 
7
14
  ## mma-verify
@@ -40,7 +47,7 @@ Each checklist item is verified in parallel; results are index-aligned.
40
47
  ### Full example
41
48
 
42
49
  ```bash
43
- BATCH=$(curl -sf -X POST \
50
+ BATCH=$(curl -f --show-error -s -X POST \
44
51
  -H "Authorization: Bearer $TOKEN" \
45
52
  -H "Content-Type: application/json" \
46
53
  -d '{"checklist":["Error handler exists","Tests pass"],"filePaths":["/project/src/handler.ts"]}' \
@@ -1,7 +1,17 @@
1
1
  ---
2
2
  name: multi-model-agent
3
- description: Overview of the multi-model-agent local service. Use this skill to understand which specialized mma-* skill to invoke for a given task.
4
- when_to_use: When the user asks about delegating tool-using work, or when auth/setup issues arise before a specific mma-* skill can run.
3
+ description: >-
4
+ Router for the multi-model-agent local service. Use first when you're about to
5
+ delegate any tool-using work — picks the right mma-* skill for the task
6
+ (audit, review, verify, debug, plan execution, ad-hoc delegation) instead of
7
+ defaulting to inline Agent dispatches.
8
+ when_to_use: >-
9
+ The user asks for work you'd normally delegate — audit, code review, checklist
10
+ verification, debugging, plan execution, or ad-hoc parallel tasks — AND
11
+ mmagent is running. Read this once, pick the matching mma-* skill, and
12
+ delegate there. Applies equally whether the user invoked a superpowers
13
+ methodology skill or just asked directly.
14
+ version: 3.1.0
5
15
  ---
6
16
 
7
17
  ## multi-model-agent overview
@@ -48,8 +58,15 @@ Every request requires `Authorization: Bearer <token>`.
48
58
  ### General flow
49
59
 
50
60
  1. Call the appropriate `mma-*` skill → receive `{ batchId }`.
51
- 2. Poll `GET /batch/:id` until `state` is terminal.
52
- 3. Read `results` from the completed batch.
61
+ 2. Poll `GET /batch/:id`: `202 text/plain` while pending (body is the running headline), `200 application/json` on terminal.
62
+ 3. Read `results` / `error` / `proposedInterpretation` from the terminal envelope.
53
63
 
54
- If the batch reaches `awaiting_clarification`, use `mma-clarifications`
55
- to confirm or correct the proposed interpretation before the batch resumes.
64
+ If the terminal envelope has `proposedInterpretation` as a string, use `mma-clarifications` to confirm or correct it.
65
+
66
+ ### Diagnosing slow tasks
67
+
68
+ Start the server with `mmagent serve --verbose` (or set `diagnostics.verbose: true` in config) to record `tool_call` and `llm_turn` events. Then tail them:
69
+
70
+ ```bash
71
+ mmagent logs --follow --batch=$BATCH_ID
72
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhixuan92/multi-model-agent",
3
- "version": "3.0.1",
3
+ "version": "3.1.0",
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.",
@@ -23,7 +23,8 @@
23
23
  "homepage": "https://github.com/zhixuan312/multi-model-agent#readme",
24
24
  "bugs": "https://github.com/zhixuan312/multi-model-agent/issues",
25
25
  "files": [
26
- "dist"
26
+ "dist",
27
+ "scripts/postinstall.js"
27
28
  ],
28
29
  "main": "dist/index.js",
29
30
  "types": "dist/index.d.ts",
@@ -42,7 +43,8 @@
42
43
  }
43
44
  },
44
45
  "scripts": {
45
- "build": "tsc && rm -rf dist/skills && cp -R src/skills dist/skills && chmod +x dist/cli/index.js",
46
+ "build": "tsc && rm -rf dist/skills && cp -R src/skills dist/skills && node scripts/inject-skill-version.mjs && chmod +x dist/cli/index.js",
47
+ "postinstall": "node scripts/postinstall.js",
46
48
  "prepublishOnly": "npm run build"
47
49
  },
48
50
  "engines": {
@@ -50,7 +52,8 @@
50
52
  },
51
53
  "dependencies": {
52
54
  "@asteasolutions/zod-to-openapi": "^8.5.0",
53
- "@zhixuan92/multi-model-agent-core": "^3.0.1",
55
+ "@zhixuan92/multi-model-agent-core": "^3.1.0",
56
+ "gray-matter": "^4.0.3",
54
57
  "minimist": "^1.2.8",
55
58
  "zod": "^4.0.0"
56
59
  },
@@ -0,0 +1,36 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * postinstall.js — stable wrapper.
4
+ *
5
+ * Runs on every `npm install @zhixuan92/multi-model-agent`.
6
+ *
7
+ * Calls `mmagent update-skills --if-exists --silent --best-effort` so that
8
+ * users who previously installed skills get their Claude Code / Gemini /
9
+ * Codex / Cursor copies refreshed to match this release. Exits 0 on every
10
+ * failure mode so npm install never breaks the user's environment.
11
+ *
12
+ * The wrapper is committed (always present) so publishing does not
13
+ * accidentally bundle a CLI build step that references a missing file.
14
+ */
15
+ import { existsSync } from 'node:fs';
16
+ import { spawn } from 'node:child_process';
17
+ import { dirname, join } from 'node:path';
18
+ import { fileURLToPath } from 'node:url';
19
+
20
+ const here = dirname(fileURLToPath(import.meta.url));
21
+ const cli = join(here, '..', 'dist', 'cli', 'index.js');
22
+
23
+ // If dist hasn't been built yet (e.g. during the repo's own install before
24
+ // build), do nothing — the published tarball always includes dist.
25
+ if (!existsSync(cli)) {
26
+ process.exit(0);
27
+ }
28
+
29
+ const child = spawn(
30
+ process.execPath,
31
+ [cli, 'update-skills', '--if-exists', '--silent', '--best-effort'],
32
+ { stdio: 'inherit' },
33
+ );
34
+
35
+ child.on('exit', (code) => process.exit(code ?? 0));
36
+ child.on('error', () => process.exit(0));