@zhixuan92/multi-model-agent 5.0.2 → 5.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.
- package/README.md +14 -23
- package/dist/cli/index.d.ts +62 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +345 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/info.d.ts +22 -0
- package/dist/cli/info.d.ts.map +1 -0
- package/dist/cli/info.js +100 -0
- package/dist/cli/info.js.map +1 -0
- package/dist/cli/logs.d.ts +15 -0
- package/dist/cli/logs.d.ts.map +1 -0
- package/dist/cli/logs.js +102 -0
- package/dist/cli/logs.js.map +1 -0
- package/dist/cli/print-token.d.ts +18 -0
- package/dist/cli/print-token.d.ts.map +1 -0
- package/dist/cli/print-token.js +60 -0
- package/dist/cli/print-token.js.map +1 -0
- package/dist/cli/serve.d.ts +28 -0
- package/dist/cli/serve.d.ts.map +1 -0
- package/dist/cli/serve.js +405 -0
- package/dist/cli/serve.js.map +1 -0
- package/dist/cli/status.d.ts +49 -0
- package/dist/cli/status.d.ts.map +1 -0
- package/dist/cli/status.js +155 -0
- package/dist/cli/status.js.map +1 -0
- package/dist/cli/sync-skills.d.ts +58 -0
- package/dist/cli/sync-skills.d.ts.map +1 -0
- package/dist/cli/sync-skills.js +266 -0
- package/dist/cli/sync-skills.js.map +1 -0
- package/dist/cli/telemetry.d.ts +10 -0
- package/dist/cli/telemetry.d.ts.map +1 -0
- package/dist/cli/telemetry.js +161 -0
- package/dist/cli/telemetry.js.map +1 -0
- package/dist/cli/toggle.d.ts +26 -0
- package/dist/cli/toggle.d.ts.map +1 -0
- package/dist/cli/toggle.js +185 -0
- package/dist/cli/toggle.js.map +1 -0
- package/dist/http/async-dispatch.d.ts +44 -0
- package/dist/http/async-dispatch.d.ts.map +1 -0
- package/dist/http/async-dispatch.js +175 -0
- package/dist/http/async-dispatch.js.map +1 -0
- package/dist/http/auth.d.ts +20 -0
- package/dist/http/auth.d.ts.map +1 -0
- package/dist/http/auth.js +56 -0
- package/dist/http/auth.js.map +1 -0
- package/dist/http/canonicalize-file-paths.d.ts +8 -0
- package/dist/http/canonicalize-file-paths.d.ts.map +1 -0
- package/dist/http/canonicalize-file-paths.js +43 -0
- package/dist/http/canonicalize-file-paths.js.map +1 -0
- package/dist/http/cwd-validator.d.ts +11 -0
- package/dist/http/cwd-validator.d.ts.map +1 -0
- package/dist/http/cwd-validator.js +130 -0
- package/dist/http/cwd-validator.js.map +1 -0
- package/dist/http/errors.d.ts +4 -0
- package/dist/http/errors.d.ts.map +1 -0
- package/dist/http/errors.js +9 -0
- package/dist/http/errors.js.map +1 -0
- package/dist/http/execution-context.d.ts +18 -0
- package/dist/http/execution-context.d.ts.map +1 -0
- package/dist/http/execution-context.js +61 -0
- package/dist/http/execution-context.js.map +1 -0
- package/dist/http/handler-deps.d.ts +19 -0
- package/dist/http/handler-deps.d.ts.map +1 -0
- package/dist/http/handler-deps.js +2 -0
- package/dist/http/handler-deps.js.map +1 -0
- package/dist/http/handlers/control/batch-slice.d.ts +4 -0
- package/dist/http/handlers/control/batch-slice.d.ts.map +1 -0
- package/dist/http/handlers/control/batch-slice.js +40 -0
- package/dist/http/handlers/control/batch-slice.js.map +1 -0
- package/dist/http/handlers/control/batch.d.ts +23 -0
- package/dist/http/handlers/control/batch.d.ts.map +1 -0
- package/dist/http/handlers/control/batch.js +332 -0
- package/dist/http/handlers/control/batch.js.map +1 -0
- package/dist/http/handlers/control/context-blocks.d.ts +22 -0
- package/dist/http/handlers/control/context-blocks.d.ts.map +1 -0
- package/dist/http/handlers/control/context-blocks.js +111 -0
- package/dist/http/handlers/control/context-blocks.js.map +1 -0
- package/dist/http/handlers/introspection/health.d.ts +20 -0
- package/dist/http/handlers/introspection/health.d.ts.map +1 -0
- package/dist/http/handlers/introspection/health.js +18 -0
- package/dist/http/handlers/introspection/health.js.map +1 -0
- package/dist/http/handlers/introspection/status.d.ts +26 -0
- package/dist/http/handlers/introspection/status.d.ts.map +1 -0
- package/dist/http/handlers/introspection/status.js +136 -0
- package/dist/http/handlers/introspection/status.js.map +1 -0
- package/dist/http/handlers/tools/audit.d.ts +4 -0
- package/dist/http/handlers/tools/audit.d.ts.map +1 -0
- package/dist/http/handlers/tools/audit.js +43 -0
- package/dist/http/handlers/tools/audit.js.map +1 -0
- package/dist/http/handlers/tools/debug.d.ts +4 -0
- package/dist/http/handlers/tools/debug.d.ts.map +1 -0
- package/dist/http/handlers/tools/debug.js +43 -0
- package/dist/http/handlers/tools/debug.js.map +1 -0
- package/dist/http/handlers/tools/delegate.d.ts +4 -0
- package/dist/http/handlers/tools/delegate.d.ts.map +1 -0
- package/dist/http/handlers/tools/delegate.js +43 -0
- package/dist/http/handlers/tools/delegate.js.map +1 -0
- package/dist/http/handlers/tools/execute-plan.d.ts +4 -0
- package/dist/http/handlers/tools/execute-plan.d.ts.map +1 -0
- package/dist/http/handlers/tools/execute-plan.js +45 -0
- package/dist/http/handlers/tools/execute-plan.js.map +1 -0
- package/dist/http/handlers/tools/investigate.d.ts +4 -0
- package/dist/http/handlers/tools/investigate.d.ts.map +1 -0
- package/dist/http/handlers/tools/investigate.js +64 -0
- package/dist/http/handlers/tools/investigate.js.map +1 -0
- package/dist/http/handlers/tools/journal-recall.d.ts +4 -0
- package/dist/http/handlers/tools/journal-recall.d.ts.map +1 -0
- package/dist/http/handlers/tools/journal-recall.js +40 -0
- package/dist/http/handlers/tools/journal-recall.js.map +1 -0
- package/dist/http/handlers/tools/journal-record.d.ts +12 -0
- package/dist/http/handlers/tools/journal-record.d.ts.map +1 -0
- package/dist/http/handlers/tools/journal-record.js +43 -0
- package/dist/http/handlers/tools/journal-record.js.map +1 -0
- package/dist/http/handlers/tools/research.d.ts +4 -0
- package/dist/http/handlers/tools/research.d.ts.map +1 -0
- package/dist/http/handlers/tools/research.js +64 -0
- package/dist/http/handlers/tools/research.js.map +1 -0
- package/dist/http/handlers/tools/retry.d.ts +4 -0
- package/dist/http/handlers/tools/retry.d.ts.map +1 -0
- package/dist/http/handlers/tools/retry.js +49 -0
- package/dist/http/handlers/tools/retry.js.map +1 -0
- package/dist/http/handlers/tools/review.d.ts +4 -0
- package/dist/http/handlers/tools/review.d.ts.map +1 -0
- package/dist/http/handlers/tools/review.js +43 -0
- package/dist/http/handlers/tools/review.js.map +1 -0
- package/dist/http/middleware/body-reader.d.ts +16 -0
- package/dist/http/middleware/body-reader.d.ts.map +1 -0
- package/dist/http/middleware/body-reader.js +44 -0
- package/dist/http/middleware/body-reader.js.map +1 -0
- package/dist/http/middleware/caller-identity.d.ts +16 -0
- package/dist/http/middleware/caller-identity.d.ts.map +1 -0
- package/dist/http/middleware/caller-identity.js +16 -0
- package/dist/http/middleware/caller-identity.js.map +1 -0
- package/dist/http/middleware/decompress.d.ts +14 -0
- package/dist/http/middleware/decompress.d.ts.map +1 -0
- package/dist/http/middleware/decompress.js +51 -0
- package/dist/http/middleware/decompress.js.map +1 -0
- package/dist/http/project-registry.d.ts +54 -0
- package/dist/http/project-registry.d.ts.map +1 -0
- package/dist/http/project-registry.js +130 -0
- package/dist/http/project-registry.js.map +1 -0
- package/dist/http/request-observability.d.ts +8 -0
- package/dist/http/request-observability.d.ts.map +1 -0
- package/dist/http/request-observability.js +20 -0
- package/dist/http/request-observability.js.map +1 -0
- package/dist/http/request-pipeline.d.ts +16 -0
- package/dist/http/request-pipeline.d.ts.map +1 -0
- package/dist/http/request-pipeline.js +144 -0
- package/dist/http/request-pipeline.js.map +1 -0
- package/dist/http/server.d.ts +17 -0
- package/dist/http/server.d.ts.map +1 -0
- package/dist/http/server.js +300 -0
- package/dist/http/server.js.map +1 -0
- package/dist/http/types.d.ts +20 -0
- package/dist/http/types.d.ts.map +1 -0
- package/dist/http/types.js +2 -0
- package/dist/http/types.js.map +1 -0
- package/dist/skill-install/disabled-state.d.ts +35 -0
- package/dist/skill-install/disabled-state.d.ts.map +1 -0
- package/dist/skill-install/disabled-state.js +96 -0
- package/dist/skill-install/disabled-state.js.map +1 -0
- package/dist/skill-install/discover.d.ts +29 -0
- package/dist/skill-install/discover.d.ts.map +1 -0
- package/dist/skill-install/discover.js +104 -0
- package/dist/skill-install/discover.js.map +1 -0
- package/dist/skill-install/include-utils.d.ts +27 -0
- package/dist/skill-install/include-utils.d.ts.map +1 -0
- package/dist/skill-install/include-utils.js +90 -0
- package/dist/skill-install/include-utils.js.map +1 -0
- package/dist/skill-install/manifest.d.ts +82 -0
- package/dist/skill-install/manifest.d.ts.map +1 -0
- package/dist/skill-install/manifest.js +215 -0
- package/dist/skill-install/manifest.js.map +1 -0
- package/dist/skill-install/skill-installer-common.d.ts +26 -0
- package/dist/skill-install/skill-installer-common.d.ts.map +1 -0
- package/dist/skill-install/skill-installer-common.js +139 -0
- package/dist/skill-install/skill-installer-common.js.map +1 -0
- package/dist/skill-install/skill-installers/claude-code.d.ts +43 -0
- package/dist/skill-install/skill-installers/claude-code.d.ts.map +1 -0
- package/dist/skill-install/skill-installers/claude-code.js +65 -0
- package/dist/skill-install/skill-installers/claude-code.js.map +1 -0
- package/dist/skill-install/skill-installers/codex-cli.d.ts +27 -0
- package/dist/skill-install/skill-installers/codex-cli.d.ts.map +1 -0
- package/dist/skill-install/skill-installers/codex-cli.js +84 -0
- package/dist/skill-install/skill-installers/codex-cli.js.map +1 -0
- package/dist/skill-install/skill-installers/cursor.d.ts +72 -0
- package/dist/skill-install/skill-installers/cursor.d.ts.map +1 -0
- package/dist/skill-install/skill-installers/cursor.js +81 -0
- package/dist/skill-install/skill-installers/cursor.js.map +1 -0
- package/dist/skill-install/skill-installers/gemini-cli.d.ts +50 -0
- package/dist/skill-install/skill-installers/gemini-cli.d.ts.map +1 -0
- package/dist/skill-install/skill-installers/gemini-cli.js +72 -0
- package/dist/skill-install/skill-installers/gemini-cli.js.map +1 -0
- package/dist/skill-install/skill-manifest-sync.d.ts +11 -0
- package/dist/skill-install/skill-manifest-sync.d.ts.map +1 -0
- package/dist/skill-install/skill-manifest-sync.js +65 -0
- package/dist/skill-install/skill-manifest-sync.js.map +1 -0
- package/dist/skills/_shared/auth.md +41 -0
- package/dist/skills/_shared/error-handling.md +31 -0
- package/dist/skills/_shared/polling.md +88 -0
- package/dist/skills/_shared/response-shape.md +55 -0
- package/dist/skills/_shared/review-policy.md +15 -0
- package/dist/skills/mma-audit/SKILL.md +270 -0
- package/dist/skills/mma-context-blocks/SKILL.md +148 -0
- package/dist/skills/mma-debug/SKILL.md +208 -0
- package/dist/skills/mma-delegate/SKILL.md +216 -0
- package/dist/skills/mma-execute-plan/SKILL.md +214 -0
- package/dist/skills/mma-explore/SKILL.md +190 -0
- package/dist/skills/mma-investigate/SKILL.md +258 -0
- package/dist/skills/mma-journal-recall/SKILL.md +242 -0
- package/dist/skills/mma-journal-record/SKILL.md +202 -0
- package/dist/skills/mma-research/SKILL.md +223 -0
- package/dist/skills/mma-retry/SKILL.md +221 -0
- package/dist/skills/mma-review/SKILL.md +209 -0
- package/dist/skills/multi-model-agent/SKILL.md +206 -0
- package/dist/telemetry/consent.d.ts +4 -0
- package/dist/telemetry/consent.d.ts.map +1 -0
- package/dist/telemetry/consent.js +40 -0
- package/dist/telemetry/consent.js.map +1 -0
- package/dist/telemetry/flusher.d.ts +19 -0
- package/dist/telemetry/flusher.d.ts.map +1 -0
- package/dist/telemetry/flusher.js +277 -0
- package/dist/telemetry/flusher.js.map +1 -0
- package/dist/telemetry/generation.d.ts +9 -0
- package/dist/telemetry/generation.d.ts.map +1 -0
- package/dist/telemetry/generation.js +33 -0
- package/dist/telemetry/generation.js.map +1 -0
- package/dist/telemetry/identity.d.ts +9 -0
- package/dist/telemetry/identity.d.ts.map +1 -0
- package/dist/telemetry/identity.js +35 -0
- package/dist/telemetry/identity.js.map +1 -0
- package/dist/telemetry/install-id.d.ts +13 -0
- package/dist/telemetry/install-id.d.ts.map +1 -0
- package/dist/telemetry/install-id.js +49 -0
- package/dist/telemetry/install-id.js.map +1 -0
- package/dist/telemetry/install-meta.d.ts +10 -0
- package/dist/telemetry/install-meta.d.ts.map +1 -0
- package/dist/telemetry/install-meta.js +15 -0
- package/dist/telemetry/install-meta.js.map +1 -0
- package/dist/telemetry/queue.d.ts +35 -0
- package/dist/telemetry/queue.d.ts.map +1 -0
- package/dist/telemetry/queue.js +287 -0
- package/dist/telemetry/queue.js.map +1 -0
- package/dist/telemetry/recorder.d.ts +39 -0
- package/dist/telemetry/recorder.d.ts.map +1 -0
- package/dist/telemetry/recorder.js +173 -0
- package/dist/telemetry/recorder.js.map +1 -0
- package/package.json +43 -24
- package/scripts/postinstall.js +36 -0
- package/bin/mmagent.mjs +0 -47
- package/postinstall.mjs +0 -8
package/README.md
CHANGED
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@zhixuan92/multi-model-agent)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Local HTTP daemon that delegates tool-using work to sub-agents on different LLM providers. One process serves Claude Code, Codex CLI, Gemini CLI, and Cursor via installable skills.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
*Renamed from `@zhixuan92/multi-model-agent-mcp` in 3.0.0 — the package no longer uses MCP. North star: [DIRECTION.md](https://github.com/zhixuan312/multi-model-agent/blob/master/DIRECTION.md). See [CHANGELOG](https://github.com/zhixuan312/multi-model-agent/blob/master/CHANGELOG.md).*
|
|
7
|
+
*Renamed from `@zhixuan92/multi-model-agent-mcp` in 3.0.0 — the package no longer uses MCP. See [CHANGELOG](https://github.com/zhixuan312/multi-model-agent/blob/master/CHANGELOG.md).*
|
|
10
8
|
|
|
11
9
|
## Why
|
|
12
10
|
|
|
@@ -20,13 +18,6 @@ Your flagship model reasoning about architecture is money well spent. That same
|
|
|
20
18
|
|
|
21
19
|
Plus structural quality: implementation and review run on **different** model families — different blind spots, catches what self-review can't.
|
|
22
20
|
|
|
23
|
-
## How it works
|
|
24
|
-
|
|
25
|
-
- **Three layers.** Your own agent keeps the judgment on top; beneath it sit two labor slots you configure — `complex` and `standard` (labor *categories*, not fixed intelligence tiers).
|
|
26
|
-
- **AIDLC + rods.** Each tool is a *rod* — a gate over one stage of the AI Development Life Cycle: `investigate` / `research` feed the front, `audit` gates the spec and plan, `delegate` / `execute-plan` build, `review` / `debug` guard the output, `retry` closes the loop, `journal` remembers. The harness instruments the lifecycle; the engineer authors it.
|
|
27
|
-
- **Reviewed by default.** Write tasks run implement → spec review → quality review → rework with implementer and reviewer on **different agents**; read-only rods return findings and skip review.
|
|
28
|
-
- **Built on the providers' own runtimes.** Claude work runs through the **Claude Agent SDK**, OpenAI/Codex work through the official **Codex CLI** — when a provider deepens its runtime the harness gets better for free, and a Claude Code task can run on Codex underneath (or vice versa).
|
|
29
|
-
|
|
30
21
|
## Initial setup
|
|
31
22
|
|
|
32
23
|
Four steps, in order.
|
|
@@ -34,7 +25,7 @@ Four steps, in order.
|
|
|
34
25
|
### 1. Install CLI + skills
|
|
35
26
|
|
|
36
27
|
```bash
|
|
37
|
-
npm i -g @zhixuan92/multi-model-agent #
|
|
28
|
+
npm i -g @zhixuan92/multi-model-agent # requires Node ≥ 22
|
|
38
29
|
mmagent sync-skills # auto-detect all clients (idempotent install + update)
|
|
39
30
|
# or pin a specific target:
|
|
40
31
|
mmagent sync-skills --target=claude-code # claude-code | gemini-cli | codex-cli | cursor
|
|
@@ -121,14 +112,14 @@ Skills are the surface your AI client sees. `mmagent sync-skills` writes them to
|
|
|
121
112
|
|
|
122
113
|
| Skill | Target endpoint | Use when |
|
|
123
114
|
|---|---|---|
|
|
124
|
-
| `mma-delegate` | `POST /delegate` | Ad-hoc implementation or research tasks **without** a plan file — run them
|
|
115
|
+
| `mma-delegate` | `POST /delegate` | Ad-hoc implementation or research tasks **without** a plan file — run them on cheap workers as one goal-set (implement → review-fix). |
|
|
125
116
|
| `mma-execute-plan` | `POST /execute-plan` | A plan / spec markdown exists on disk with numbered task headings; implement one or more tasks from it. |
|
|
126
117
|
| `mma-investigate` | `POST /investigate` | Answer a question about *this* codebase ("how does X work", "where is Y called") without burning main-context tokens on grep + reads. |
|
|
127
118
|
| `mma-explore` | (orchestrator playbook — no dedicated route) | Fans out `mma-investigate` + `mma-research` + `mma-journal-recall` in parallel and synthesises 3–5 distinct directions. Run before `superpowers:brainstorming`. Not for "where is X" questions (use `mma-investigate`). |
|
|
128
119
|
| `mma-research` | `POST /research` | External multi-source research with citations — arxiv, semantic_scholar, github_search, brave-with-`site:`-filters — for a focused question. |
|
|
129
120
|
| `mma-debug` | `POST /debug` | A test fails, a build breaks, or behavior is unexpected — delegate the reproduce/trace, keep the hypothesis on the main agent. |
|
|
130
121
|
| `mma-review` | `POST /review` | Source-code review (pre-merge, post-implementation, security-focused). One worker per file, in parallel. |
|
|
131
|
-
| `mma-audit` | `POST /audit` | Audit a
|
|
122
|
+
| `mma-audit` | `POST /audit` | Audit a spec / plan / design doc / recommendation doc for executability blockers (contradictions, ambiguity, recommendation-coherence gaps). Default is the comprehensive sweep; `security` and `performance` are narrow opt-in lenses. |
|
|
132
123
|
| `mma-journal-record` | `POST /journal-record` | Record a durable project learning into the cross-agent journal — what was tried, what happened, the lesson — integrated into a graph of ADR "node" files under `.mmagent/journal/` (create / refine / supersede / merge with typed edges). |
|
|
133
124
|
| `mma-journal-recall` | `POST /journal-recall` | Recall relevant prior learnings from the journal for a question or situation — traverses the node graph rather than keyword-filtering. |
|
|
134
125
|
|
|
@@ -148,10 +139,11 @@ The `multi-model-agent` skill (no `mma-` prefix) is a top-level overview your cl
|
|
|
148
139
|
```
|
|
149
140
|
You: "Execute tasks 3, 4, and 5 from docs/plans/auth-rewrite.md"
|
|
150
141
|
↓
|
|
151
|
-
Client picks mma-execute-plan (plan file on disk, multiple
|
|
142
|
+
Client picks mma-execute-plan (plan file on disk, multiple tasks)
|
|
152
143
|
↓
|
|
153
|
-
mmagent
|
|
154
|
-
each
|
|
144
|
+
mmagent runs the tasks as one sequential goal-set: the standard agent (e.g. MiniMax-M3)
|
|
145
|
+
implements each task in order and commits it (`[task N] …`), then the complex agent
|
|
146
|
+
reviews every task and fixes anything left — returning one structured report.
|
|
155
147
|
↓
|
|
156
148
|
You see one consolidated headline: "$0.04 actual / $1.20 saved vs claude-opus-4-8 (30× ROI)"
|
|
157
149
|
```
|
|
@@ -242,7 +234,7 @@ Generated on first `mmagent serve`. Retrieve with `mmagent print-token`, or set
|
|
|
242
234
|
|
|
243
235
|
## REST API
|
|
244
236
|
|
|
245
|
-
|
|
237
|
+
15 endpoints. All tool endpoints are async: they return `202 { batchId, statusUrl }` immediately and the executor runs in the background. Poll `GET /batch/:id` for the terminal envelope.
|
|
246
238
|
|
|
247
239
|
| Endpoint | Purpose |
|
|
248
240
|
|---|---|
|
|
@@ -259,7 +251,6 @@ Generated on first `mmagent serve`. Retrieve with `mmagent print-token`, or set
|
|
|
259
251
|
| `GET /batch/:id[?taskIndex=N]` | Poll a batch: `202 text/plain` (pending) or `200 application/json` (terminal). `?taskIndex=N` slices on complete state |
|
|
260
252
|
| `POST /context-blocks?cwd=<abs>` | Register a reusable context block |
|
|
261
253
|
| `DELETE /context-blocks/:id?cwd=<abs>` | Delete a context block |
|
|
262
|
-
| `POST /control/batch-slice` | Slice an in-flight batch — return a subset of its tasks by index |
|
|
263
254
|
| `GET /health` | Liveness probe (unauthenticated, loopback-only) |
|
|
264
255
|
| `GET /status` | Server status (authenticated, loopback-only) |
|
|
265
256
|
|
|
@@ -285,7 +276,7 @@ mmagent telemetry dump-queue # print the locally-queued even
|
|
|
285
276
|
|
|
286
277
|
## Architecture
|
|
287
278
|
|
|
288
|
-
`mmagent serve` runs a loopback HTTP server.
|
|
279
|
+
`mmagent serve` runs a loopback HTTP server. Write tools (`delegate`, `execute-plan`, `retry`, `journal-record`) run the whole plan as one sequential **goal-set**: the standard agent implements every task in order and commits each (`[task N] …`), then the complex agent reviews and fixes — returning one structured report of the final per-task state. Read tools fan out per file/criterion. Each has a wall-clock timeout.
|
|
289
280
|
|
|
290
281
|
Full design rationale: [DIRECTION.md](https://github.com/zhixuan312/multi-model-agent/blob/master/DIRECTION.md). Layer map and request lifecycle: [docs/ARCHITECTURE.md](https://github.com/zhixuan312/multi-model-agent/blob/master/docs/ARCHITECTURE.md).
|
|
291
282
|
|
|
@@ -298,12 +289,12 @@ Full design rationale: [DIRECTION.md](https://github.com/zhixuan312/multi-model-
|
|
|
298
289
|
| Skill version mismatch | `mmagent sync-skills` and restart your client |
|
|
299
290
|
| `401 unauthorized` from a skill | `export MMAGENT_AUTH_TOKEN=$(mmagent print-token)` |
|
|
300
291
|
| `pkill` reports success but `mmagent info` still shows the old PID | The pattern didn't match — try `kill <pid-from-mmagent-info>` directly |
|
|
301
|
-
| TLS `handshake_failure` to a known-good telemetry endpoint | Local DNS cache is stale. `sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder` (macOS); restart the daemon so its process re-resolves |
|
|
292
|
+
| TLS `handshake_failure` to a known-good telemetry endpoint | Local DNS cache is stale. `sudo dscacheutil -flushcache && sudo killall -HUP mDNSResponder` (macOS); restart the daemon so its Node process re-resolves |
|
|
302
293
|
| Local telemetry queue stops draining | Daemon's flusher is in exponential backoff after a transport failure (capped at 1 hr). Restart the daemon to force an immediate boot-flush |
|
|
303
294
|
|
|
304
|
-
## What's new in
|
|
295
|
+
## What's new in 4.9.0
|
|
305
296
|
|
|
306
|
-
- **
|
|
297
|
+
- **Delegate skill passthrough.** `POST /delegate` tasks accept an optional `skills: string[]`. Each name is resolved from the caller's skill store (by `X-MMA-Client`), staged into an ephemeral per-task directory, and delivered natively — Claude workers via a local SDK plugin, Codex workers via an ephemeral `CODEX_HOME`. Unknown names hard-fail just that task; omitting `skills` is byte-for-byte the previous behavior.
|
|
307
298
|
|
|
308
299
|
Full history: [CHANGELOG](https://github.com/zhixuan312/multi-model-agent/blob/master/CHANGELOG.md).
|
|
309
300
|
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { type ParsedArgs } from 'minimist';
|
|
3
|
+
import { type MultiModelConfig } from '@zhixuan92/multi-model-agent-core';
|
|
4
|
+
/**
|
|
5
|
+
* Minimal I/O dependencies — allows tests to intercept stdout/stderr and
|
|
6
|
+
* override process.argv / process.exit.
|
|
7
|
+
*/
|
|
8
|
+
export interface CliDeps {
|
|
9
|
+
/**
|
|
10
|
+
* argv[0..] (not including node path or script path) passed to minimist.
|
|
11
|
+
* Defaults to process.argv.slice(2).
|
|
12
|
+
*/
|
|
13
|
+
argv?: () => string[];
|
|
14
|
+
/**
|
|
15
|
+
* Current working directory. Defaults to process.cwd().
|
|
16
|
+
* Used only for resolving the CWD/.multi-model-agent.json discovery path.
|
|
17
|
+
*/
|
|
18
|
+
cwd?: () => string;
|
|
19
|
+
/**
|
|
20
|
+
* Home directory. Defaults to os.homedir().
|
|
21
|
+
* Used only for resolving the ~/.multi-model/config.json discovery path.
|
|
22
|
+
*/
|
|
23
|
+
homeDir?: () => string;
|
|
24
|
+
/**
|
|
25
|
+
* Environment variable accessor. Defaults to process.env.
|
|
26
|
+
*/
|
|
27
|
+
env?: () => Record<string, string | undefined>;
|
|
28
|
+
/** Write to stdout. Defaults to process.stdout.write.bind(process.stdout). */
|
|
29
|
+
stdout?: (s: string) => boolean;
|
|
30
|
+
/** Write to stderr. Defaults to process.stderr.write.bind(process.stderr). */
|
|
31
|
+
stderr?: (s: string) => boolean;
|
|
32
|
+
/** Exit the process. Defaults to process.exit. */
|
|
33
|
+
exit?: (code: number) => never;
|
|
34
|
+
}
|
|
35
|
+
/** Parse minimist args from an argv array. */
|
|
36
|
+
export declare function parseArgs(argv: string[]): ParsedArgs;
|
|
37
|
+
/**
|
|
38
|
+
* Resolve the config file path using the discovery order:
|
|
39
|
+
* 1. --config <path> (explicit flag)
|
|
40
|
+
* 2. $MMAGENT_CONFIG (env var)
|
|
41
|
+
* 3. CWD/.multi-model-agent.json
|
|
42
|
+
* 4. ~/.multi-model/config.json
|
|
43
|
+
*
|
|
44
|
+
* Returns the first path that exists, or undefined if none exist.
|
|
45
|
+
* Does NOT validate or parse the file — caller uses loadConfigFromFile().
|
|
46
|
+
*/
|
|
47
|
+
export declare function resolveConfigPath(explicit: string | undefined, env: Record<string, string | undefined>, cwd: string, home: string): string | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Load config using the discovery order.
|
|
50
|
+
* Tries each candidate in priority order and returns the first successfully
|
|
51
|
+
* loaded config. Returns an error listing all attempted paths if none are found
|
|
52
|
+
* or every found file is unreadable/invalid.
|
|
53
|
+
*/
|
|
54
|
+
export declare function loadConfig(explicitPath: string | undefined, deps: Pick<CliDeps, 'cwd' | 'homeDir' | 'env'>): Promise<MultiModelConfig>;
|
|
55
|
+
/**
|
|
56
|
+
* Main entry point — exported so it can be unit-tested without subprocess spawning.
|
|
57
|
+
*
|
|
58
|
+
* @param deps I/O dependencies (defaults to real process globals).
|
|
59
|
+
*/
|
|
60
|
+
export declare function main(deps?: CliDeps): Promise<void>;
|
|
61
|
+
export type { MultiModelConfig };
|
|
62
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AA0BA,OAAiB,EAAE,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,mCAAmC,CAAC;AAU3C;;;GAGG;AACH,MAAM,WAAW,OAAO;IACtB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,MAAM,EAAE,CAAC;IACtB;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,MAAM,CAAC;IACvB;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAC/C,8EAA8E;IAC9E,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;IAChC,8EAA8E;IAC9E,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;IAChC,kDAAkD;IAClD,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,KAAK,CAAC;CAChC;AAED,8CAA8C;AAC9C,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CASpD;AA4BD;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EACvC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,GACX,MAAM,GAAG,SAAS,CAKpB;AAED;;;;;GAKG;AACH,wBAAsB,UAAU,CAC9B,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,KAAK,GAAG,SAAS,GAAG,KAAK,CAAC,GAC7C,OAAO,CAAC,gBAAgB,CAAC,CA0B3B;AAuCD;;;;GAIG;AACH,wBAAsB,IAAI,CAAC,IAAI,GAAE,OAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAuK5D;AA+BD,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* CLI entry point for `mmagent` / `multi-model-agent`.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* mmagent serve [--config <path>]
|
|
7
|
+
* mmagent --help
|
|
8
|
+
* mmagent --version
|
|
9
|
+
*
|
|
10
|
+
* Config discovery order (highest priority → lowest):
|
|
11
|
+
* 1. --config <path> (explicit flag)
|
|
12
|
+
* 2. $MMAGENT_CONFIG env var
|
|
13
|
+
* 3. CWD/.multi-model-agent.json
|
|
14
|
+
* 4. ~/.multi-model/config.json
|
|
15
|
+
*
|
|
16
|
+
* All side effects (process.exit, stdout/stderr writes) are contained in the
|
|
17
|
+
* bootstrap at the bottom of this file. The internal `main()` function is
|
|
18
|
+
* exported so it can be unit-tested without spawning subprocesses.
|
|
19
|
+
*
|
|
20
|
+
* Signal lifecycle is owned by `serve.ts` — this module delegates to
|
|
21
|
+
* `startServe()` which registers SIGTERM/SIGINT handlers and manages process.exit.
|
|
22
|
+
*/
|
|
23
|
+
import * as path from 'node:path';
|
|
24
|
+
import * as fs from 'node:fs';
|
|
25
|
+
import * as os from 'node:os';
|
|
26
|
+
import { fileURLToPath } from 'node:url';
|
|
27
|
+
import minimist from 'minimist';
|
|
28
|
+
import { loadConfigFromFile, } from '@zhixuan92/multi-model-agent-core';
|
|
29
|
+
import { startServe } from './serve.js';
|
|
30
|
+
import { printToken } from './print-token.js';
|
|
31
|
+
import { runStatus, buildServerUrl } from './status.js';
|
|
32
|
+
import { runInfo } from './info.js';
|
|
33
|
+
import { runSyncSkills } from './sync-skills.js';
|
|
34
|
+
import { runDisable, runEnable } from './toggle.js';
|
|
35
|
+
import { runLogs } from './logs.js';
|
|
36
|
+
import { runTelemetry } from './telemetry.js';
|
|
37
|
+
/** Parse minimist args from an argv array. */
|
|
38
|
+
export function parseArgs(argv) {
|
|
39
|
+
return minimist(argv, {
|
|
40
|
+
string: ['config', 'batch'],
|
|
41
|
+
boolean: ['help', 'version', 'json', 'dry-run', 'if-exists', 'silent', 'best-effort', 'follow', 'log'],
|
|
42
|
+
alias: { config: 'c', help: 'h', version: 'v', json: 'j' },
|
|
43
|
+
// Note: stopEarly is NOT set. With stopEarly:true, options after the first
|
|
44
|
+
// positional argument (the subcommand) would be silently dropped. E.g.
|
|
45
|
+
// `mmagent serve --config ./config.json` would lose --config.
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Build the ordered list of config-file candidates from discovery sources.
|
|
50
|
+
* Returns an array of resolved paths; callers filter for existence and
|
|
51
|
+
* iterate in priority order. This single builder ensures that
|
|
52
|
+
* resolveConfigPath() and loadConfig() cannot drift apart.
|
|
53
|
+
*/
|
|
54
|
+
function buildCandidatePaths(explicit, env, cwd, home) {
|
|
55
|
+
const paths = [];
|
|
56
|
+
if (explicit)
|
|
57
|
+
paths.push(explicit);
|
|
58
|
+
const envVal = (env['MMAGENT_CONFIG'] ?? '').trim();
|
|
59
|
+
if (envVal)
|
|
60
|
+
paths.push(envVal);
|
|
61
|
+
paths.push(path.join(cwd, '.multi-model-agent.json'));
|
|
62
|
+
paths.push(path.join(home, '.multi-model', 'config.json'));
|
|
63
|
+
return paths;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Resolve the config file path using the discovery order:
|
|
67
|
+
* 1. --config <path> (explicit flag)
|
|
68
|
+
* 2. $MMAGENT_CONFIG (env var)
|
|
69
|
+
* 3. CWD/.multi-model-agent.json
|
|
70
|
+
* 4. ~/.multi-model/config.json
|
|
71
|
+
*
|
|
72
|
+
* Returns the first path that exists, or undefined if none exist.
|
|
73
|
+
* Does NOT validate or parse the file — caller uses loadConfigFromFile().
|
|
74
|
+
*/
|
|
75
|
+
export function resolveConfigPath(explicit, env, cwd, home) {
|
|
76
|
+
for (const p of buildCandidatePaths(explicit, env, cwd, home)) {
|
|
77
|
+
if (p && fs.existsSync(p))
|
|
78
|
+
return p;
|
|
79
|
+
}
|
|
80
|
+
return undefined;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Load config using the discovery order.
|
|
84
|
+
* Tries each candidate in priority order and returns the first successfully
|
|
85
|
+
* loaded config. Returns an error listing all attempted paths if none are found
|
|
86
|
+
* or every found file is unreadable/invalid.
|
|
87
|
+
*/
|
|
88
|
+
export async function loadConfig(explicitPath, deps) {
|
|
89
|
+
const cwd = deps.cwd?.() ?? process.cwd();
|
|
90
|
+
const home = deps.homeDir?.() ?? os.homedir();
|
|
91
|
+
const env = deps.env?.() ?? process.env;
|
|
92
|
+
const attempted = [];
|
|
93
|
+
for (const p of buildCandidatePaths(explicitPath, env, cwd, home)) {
|
|
94
|
+
if (!p) {
|
|
95
|
+
attempted.push('<source: not set>');
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
attempted.push(p);
|
|
99
|
+
if (!fs.existsSync(p))
|
|
100
|
+
continue;
|
|
101
|
+
try {
|
|
102
|
+
return await loadConfigFromFile(p);
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
106
|
+
throw new Error(`Config error (${p}): ${msg}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
throw new Error(`No config file found. Tried:\n${attempted.join('\n')}\n` +
|
|
110
|
+
`Set one via --config, $MMAGENT_CONFIG, or place it at a default location above.`);
|
|
111
|
+
}
|
|
112
|
+
const HELP_TEXT = `\
|
|
113
|
+
mmagent — multi-model-agent HTTP server
|
|
114
|
+
|
|
115
|
+
Usage:
|
|
116
|
+
mmagent [command] [options]
|
|
117
|
+
|
|
118
|
+
Commands:
|
|
119
|
+
serve Start the HTTP server (default)
|
|
120
|
+
print-token Print the bearer auth token to stdout
|
|
121
|
+
info Print config + daemon identity (works offline)
|
|
122
|
+
status Show server status (requires a running server)
|
|
123
|
+
sync-skills Install + update + reconcile all shipped skills (single upsert command, replaces 4.0.x install-skill / update-skills)
|
|
124
|
+
disable Remove MMA skills from clients and pin them off (survives npm upgrades)
|
|
125
|
+
enable Restore MMA skills (clears a prior \`disable\`, then re-syncs)
|
|
126
|
+
logs Tail the diagnostic log (use --follow / --batch=<id>)
|
|
127
|
+
telemetry Manage telemetry consent (status|enable|disable|reset-id|dump-queue)
|
|
128
|
+
|
|
129
|
+
Global options:
|
|
130
|
+
--config, -c <path> Path to config file
|
|
131
|
+
--help, -h Show this help
|
|
132
|
+
--version, -v Show version
|
|
133
|
+
`;
|
|
134
|
+
/**
|
|
135
|
+
* Read the server package version from package.json, walking up from this file.
|
|
136
|
+
*/
|
|
137
|
+
function readServerVersion() {
|
|
138
|
+
try {
|
|
139
|
+
const thisDir = path.dirname(fileURLToPath(import.meta.url));
|
|
140
|
+
const pkgPath = path.join(thisDir, '..', '..', 'package.json');
|
|
141
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
|
|
142
|
+
return pkg.version ?? '0.0.0';
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return '0.0.0';
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Main entry point — exported so it can be unit-tested without subprocess spawning.
|
|
150
|
+
*
|
|
151
|
+
* @param deps I/O dependencies (defaults to real process globals).
|
|
152
|
+
*/
|
|
153
|
+
export async function main(deps = {}) {
|
|
154
|
+
const argv = deps.argv?.() ?? process.argv.slice(2);
|
|
155
|
+
const stdout = deps.stdout ?? process.stdout.write.bind(process.stdout);
|
|
156
|
+
const stderr = deps.stderr ?? process.stderr.write.bind(process.stderr);
|
|
157
|
+
const exit = deps.exit ?? process.exit.bind(process);
|
|
158
|
+
const opts = parseArgs(argv);
|
|
159
|
+
const positional = opts._;
|
|
160
|
+
const subcommand = positional[0] ?? 'serve';
|
|
161
|
+
const configArg = typeof opts['config'] === 'string' ? opts['config'] : undefined;
|
|
162
|
+
if (opts['help']) {
|
|
163
|
+
stdout(HELP_TEXT);
|
|
164
|
+
return;
|
|
165
|
+
}
|
|
166
|
+
if (opts['version']) {
|
|
167
|
+
stdout(readServerVersion() + '\n');
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
switch (subcommand) {
|
|
171
|
+
case 'serve': {
|
|
172
|
+
const config = await loadConfig(configArg, deps);
|
|
173
|
+
// Stderr event streaming is always on (4.7.3+; no --verbose flag).
|
|
174
|
+
// --log enables JSONL persistence to ~/.multi-model/logs/mmagent-YYYY-MM-DD.jsonl.
|
|
175
|
+
if (opts['log'] === true) {
|
|
176
|
+
if (!config.diagnostics)
|
|
177
|
+
config.diagnostics = { log: false };
|
|
178
|
+
config.diagnostics.log = true;
|
|
179
|
+
}
|
|
180
|
+
// startServe() blocks until a signal arrives and exits the process.
|
|
181
|
+
await startServe(config, exit);
|
|
182
|
+
break;
|
|
183
|
+
}
|
|
184
|
+
case 'print-token': {
|
|
185
|
+
const config = await loadConfig(configArg, deps).catch(() => null);
|
|
186
|
+
const tokenFile = config
|
|
187
|
+
? config.server.auth.tokenFile
|
|
188
|
+
: path.join(deps.homeDir?.() ?? os.homedir(), '.multi-model', 'auth-token');
|
|
189
|
+
const code = printToken({
|
|
190
|
+
homeDir: deps.homeDir?.() ?? os.homedir(),
|
|
191
|
+
tokenFile,
|
|
192
|
+
env: deps.env?.() ?? process.env,
|
|
193
|
+
stdout: deps.stdout,
|
|
194
|
+
stderr: deps.stderr,
|
|
195
|
+
});
|
|
196
|
+
exit(code);
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
case 'status': {
|
|
200
|
+
const jsonFlag = opts['json'] === true;
|
|
201
|
+
const config = await loadConfig(configArg, deps).catch(() => null);
|
|
202
|
+
const home = deps.homeDir?.() ?? os.homedir();
|
|
203
|
+
const tokenFile = config
|
|
204
|
+
? config.server.auth.tokenFile
|
|
205
|
+
: path.join(home, '.multi-model', 'auth-token');
|
|
206
|
+
const serverUrl = config
|
|
207
|
+
? buildServerUrl(config.server.bind, config.server.port)
|
|
208
|
+
: buildServerUrl('127.0.0.1', 7337);
|
|
209
|
+
const code = await runStatus({
|
|
210
|
+
serverUrl,
|
|
211
|
+
tokenFile,
|
|
212
|
+
json: jsonFlag,
|
|
213
|
+
env: deps.env?.() ?? process.env,
|
|
214
|
+
homeDir: home,
|
|
215
|
+
stdout: deps.stdout,
|
|
216
|
+
stderr: deps.stderr,
|
|
217
|
+
});
|
|
218
|
+
exit(code);
|
|
219
|
+
break;
|
|
220
|
+
}
|
|
221
|
+
case 'info': {
|
|
222
|
+
const jsonFlag = opts['json'] === true;
|
|
223
|
+
const config = await loadConfig(configArg, deps).catch(() => null);
|
|
224
|
+
if (!config) {
|
|
225
|
+
stderr(`mmagent info: cannot load config. Set --config or $MMAGENT_CONFIG.\n`);
|
|
226
|
+
exit(1);
|
|
227
|
+
break;
|
|
228
|
+
}
|
|
229
|
+
const code = await runInfo({
|
|
230
|
+
cliVersion: readServerVersion(),
|
|
231
|
+
bind: config.server.bind,
|
|
232
|
+
port: config.server.port,
|
|
233
|
+
tokenFile: config.server.auth.tokenFile,
|
|
234
|
+
homeDir: deps.homeDir?.() ?? os.homedir(),
|
|
235
|
+
json: jsonFlag,
|
|
236
|
+
stdout: deps.stdout,
|
|
237
|
+
stderr: deps.stderr,
|
|
238
|
+
});
|
|
239
|
+
exit(code);
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
case 'logs': {
|
|
243
|
+
const config = await loadConfig(configArg, deps).catch(() => null);
|
|
244
|
+
if (!config) {
|
|
245
|
+
stderr(`mmagent logs: cannot load config. Set --config or $MMAGENT_CONFIG.\n`);
|
|
246
|
+
exit(1);
|
|
247
|
+
break;
|
|
248
|
+
}
|
|
249
|
+
const code = await runLogs({
|
|
250
|
+
config,
|
|
251
|
+
homeDir: deps.homeDir?.() ?? os.homedir(),
|
|
252
|
+
follow: opts['follow'] === true,
|
|
253
|
+
batchId: typeof opts['batch'] === 'string' ? opts['batch'] : undefined,
|
|
254
|
+
stdout: deps.stdout,
|
|
255
|
+
stderr: deps.stderr,
|
|
256
|
+
});
|
|
257
|
+
exit(code);
|
|
258
|
+
break;
|
|
259
|
+
}
|
|
260
|
+
case 'sync-skills': {
|
|
261
|
+
// Forward argv tokens that come after the subcommand name so
|
|
262
|
+
// sync-skills' own minimist sees `--target=`, `--all-targets`, etc.
|
|
263
|
+
const subCmdIdx = argv.indexOf('sync-skills');
|
|
264
|
+
const subArgv = subCmdIdx >= 0 ? argv.slice(subCmdIdx + 1) : positional.slice(1);
|
|
265
|
+
const code = await runSyncSkills({
|
|
266
|
+
argv: subArgv,
|
|
267
|
+
homeDir: deps.homeDir?.() ?? os.homedir(),
|
|
268
|
+
ifExists: opts['if-exists'] === true,
|
|
269
|
+
silent: opts['silent'] === true,
|
|
270
|
+
bestEffort: opts['best-effort'] === true,
|
|
271
|
+
stdout: deps.stdout,
|
|
272
|
+
stderr: deps.stderr,
|
|
273
|
+
});
|
|
274
|
+
exit(code);
|
|
275
|
+
break;
|
|
276
|
+
}
|
|
277
|
+
case 'enable':
|
|
278
|
+
case 'disable': {
|
|
279
|
+
// Forward argv tokens after the subcommand name so toggle's own minimist
|
|
280
|
+
// sees --target=, --all-targets, --dry-run, --json.
|
|
281
|
+
const subCmdIdx = argv.indexOf(subcommand);
|
|
282
|
+
const subArgv = subCmdIdx >= 0 ? argv.slice(subCmdIdx + 1) : positional.slice(1);
|
|
283
|
+
const run = subcommand === 'disable' ? runDisable : runEnable;
|
|
284
|
+
const code = await run({
|
|
285
|
+
argv: subArgv,
|
|
286
|
+
homeDir: deps.homeDir?.() ?? os.homedir(),
|
|
287
|
+
cliVersion: readServerVersion(),
|
|
288
|
+
stdout: deps.stdout,
|
|
289
|
+
stderr: deps.stderr,
|
|
290
|
+
});
|
|
291
|
+
exit(code);
|
|
292
|
+
break;
|
|
293
|
+
}
|
|
294
|
+
case 'telemetry': {
|
|
295
|
+
const home = deps.homeDir?.() ?? path.join(os.homedir(), '.multi-model');
|
|
296
|
+
const telemetrySubcommand = positional[1] ?? 'status';
|
|
297
|
+
const validSubcommands = ['status', 'enable', 'disable', 'reset-id', 'dump-queue'];
|
|
298
|
+
if (!validSubcommands.includes(telemetrySubcommand)) {
|
|
299
|
+
stderr(`mmagent telemetry: unknown subcommand '${telemetrySubcommand}'\nValid: ${validSubcommands.join(', ')}\n`);
|
|
300
|
+
exit(1);
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
303
|
+
const code = await runTelemetry({
|
|
304
|
+
subcommand: telemetrySubcommand,
|
|
305
|
+
homeDir: home,
|
|
306
|
+
stdout: deps.stdout,
|
|
307
|
+
stderr: deps.stderr,
|
|
308
|
+
});
|
|
309
|
+
exit(code);
|
|
310
|
+
break;
|
|
311
|
+
}
|
|
312
|
+
default: {
|
|
313
|
+
stderr(`Unknown command: ${subcommand}\nRun 'mmagent --help' for usage.\n`);
|
|
314
|
+
exit(1);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
// ── Bootstrap ──────────────────────────────────────────────────────────────
|
|
319
|
+
// Only run main() when this module is executed as the CLI entry point.
|
|
320
|
+
// Tests import main() directly and pass CliDeps.
|
|
321
|
+
function isMain() {
|
|
322
|
+
try {
|
|
323
|
+
const argv1 = process.argv[1];
|
|
324
|
+
if (!argv1)
|
|
325
|
+
return false;
|
|
326
|
+
// Resolve to absolute path and follow symlinks — npm installs the bin as a
|
|
327
|
+
// symlink in node_modules/.bin/, so argv[1] points at the symlink, not the
|
|
328
|
+
// real file. fs.realpathSync follows the link so it matches import.meta.url.
|
|
329
|
+
const entryPath = import.meta.url.startsWith('file://')
|
|
330
|
+
? fileURLToPath(import.meta.url)
|
|
331
|
+
: path.resolve(argv1);
|
|
332
|
+
return fs.realpathSync(path.resolve(argv1)) === entryPath;
|
|
333
|
+
}
|
|
334
|
+
catch {
|
|
335
|
+
return false;
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
if (isMain()) {
|
|
339
|
+
void main().catch((err) => {
|
|
340
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
341
|
+
process.stderr.write(`mmagent: ${msg}\n`);
|
|
342
|
+
process.exit(1);
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE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;AAED,8EAA8E;AAE9E,uEAAuE;AACvE,iDAAiD;AACjD,SAAS,MAAM;IACb,IAAI,CAAC;QACH,MAAM,KAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC9B,IAAI,CAAC,KAAK;YAAE,OAAO,KAAK,CAAC;QACzB,2EAA2E;QAC3E,2EAA2E;QAC3E,6EAA6E;QAC7E,MAAM,SAAS,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,SAAS,CAAC;YACrD,CAAC,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;YAChC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QACxB,OAAO,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,KAAK,SAAS,CAAC;IAC5D,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,IAAI,MAAM,EAAE,EAAE,CAAC;IACb,KAAK,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;QACjC,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;QAC1C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export interface InfoDeps {
|
|
2
|
+
/** CLI package version (read from the server package.json at startup). */
|
|
3
|
+
cliVersion: string;
|
|
4
|
+
/** Config bind address (e.g. '127.0.0.1'). */
|
|
5
|
+
bind: string;
|
|
6
|
+
/** Config port (e.g. 7337). */
|
|
7
|
+
port: number;
|
|
8
|
+
/** Token file path (already resolved from config, no tilde expansion yet). */
|
|
9
|
+
tokenFile: string;
|
|
10
|
+
/** Home dir for tilde expansion. Defaults to os.homedir(). */
|
|
11
|
+
homeDir?: string;
|
|
12
|
+
/** Emit machine-readable JSON instead of a human summary. */
|
|
13
|
+
json?: boolean;
|
|
14
|
+
/** stdout writer (for testing). */
|
|
15
|
+
stdout?: (s: string) => boolean;
|
|
16
|
+
/** stderr writer (for testing). */
|
|
17
|
+
stderr?: (s: string) => boolean;
|
|
18
|
+
/** Injectable fetch for testing; defaults to global fetch. */
|
|
19
|
+
fetch?: typeof fetch;
|
|
20
|
+
}
|
|
21
|
+
export declare function runInfo(deps: InfoDeps): Promise<number>;
|
|
22
|
+
//# sourceMappingURL=info.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../src/cli/info.ts"],"names":[],"mappings":"AAiBA,MAAM,WAAW,QAAQ;IACvB,0EAA0E;IAC1E,UAAU,EAAE,MAAM,CAAC;IACnB,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,8EAA8E;IAC9E,SAAS,EAAE,MAAM,CAAC;IAClB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6DAA6D;IAC7D,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,mCAAmC;IACnC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;IAChC,mCAAmC;IACnC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;IAChC,8DAA8D;IAC9D,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB;AAsBD,wBAAsB,OAAO,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,CA2E7D"}
|