@zhixuan92/multi-model-agent 5.0.1 → 5.0.3
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 +8 -9
- 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 +8 -0
- package/dist/http/handlers/tools/journal-record.d.ts.map +1 -0
- package/dist/http/handlers/tools/journal-record.js +40 -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 +73 -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/journal-lock.d.ts +4 -0
- package/dist/http/journal-lock.d.ts.map +1 -0
- package/dist/http/journal-lock.js +34 -0
- package/dist/http/journal-lock.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
|
@@ -10,7 +10,7 @@ Local HTTP daemon that delegates tool-using work to sub-agents on different LLM
|
|
|
10
10
|
|
|
11
11
|
Your flagship model reasoning about architecture is money well spent. That same model grepping files, writing boilerplate, and running tests is waste.
|
|
12
12
|
|
|
13
|
-
| Project | MMA — MiniMax-
|
|
13
|
+
| Project | MMA — MiniMax-M3 | MMA — DeepSeek V4 Pro | Flagship: Claude Opus 4.8 |
|
|
14
14
|
|---|---|---|---|
|
|
15
15
|
| Feature impl (30 files, ~50 tasks) | **$1.50** · **33× ROI** · ~35 min | **~$2.50** · **20× ROI** · ~15 min | $50 · 1× · *baseline* |
|
|
16
16
|
| Full web SPA (59 tasks) | **$5.65** · **12× ROI** · ~50 min | **~$9** · **7.5× ROI** · ~22 min | $68 · 1× · *baseline* |
|
|
@@ -25,7 +25,7 @@ Four steps, in order.
|
|
|
25
25
|
### 1. Install CLI + skills
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
npm i -g @zhixuan92/multi-model-agent #
|
|
28
|
+
npm i -g @zhixuan92/multi-model-agent # requires Node ≥ 22
|
|
29
29
|
mmagent sync-skills # auto-detect all clients (idempotent install + update)
|
|
30
30
|
# or pin a specific target:
|
|
31
31
|
mmagent sync-skills --target=claude-code # claude-code | gemini-cli | codex-cli | cursor
|
|
@@ -42,7 +42,7 @@ mmagent sync-skills --target=claude-code # claude-code | gemini-cli | codex-c
|
|
|
42
42
|
|
|
43
43
|
Your **main model** is **the model you'd use without mmagent** — the cost baseline for every per-task headline (`$X actual / $Y saved vs <mainModel> (Z× ROI)`).
|
|
44
44
|
|
|
45
|
-
- Heavy Claude Code user → `claude-opus-4-
|
|
45
|
+
- Heavy Claude Code user → `claude-opus-4-8`
|
|
46
46
|
- ChatGPT-led workflow → `gpt-5.5`
|
|
47
47
|
- Gemini-led workflow → `gemini-3.1-pro`
|
|
48
48
|
|
|
@@ -50,7 +50,7 @@ Both `X-MMA-Client` and `X-MMA-Main-Model` are required on tool routes (`400 cli
|
|
|
50
50
|
|
|
51
51
|
```bash
|
|
52
52
|
export MMAGENT_CLIENT=claude-code # or codex-cli, gemini-cli, cursor
|
|
53
|
-
export MMAGENT_MAIN_MODEL=claude-opus-4-
|
|
53
|
+
export MMAGENT_MAIN_MODEL=claude-opus-4-8 # whatever your calling agent runs on
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
### 3. Write the config
|
|
@@ -141,10 +141,10 @@ You: "Execute tasks 3, 4, and 5 from docs/plans/auth-rewrite.md"
|
|
|
141
141
|
↓
|
|
142
142
|
Client picks mma-execute-plan (plan file on disk, multiple independent tasks)
|
|
143
143
|
↓
|
|
144
|
-
mmagent dispatches 3 workers in parallel on the standard agent (e.g. MiniMax-
|
|
144
|
+
mmagent dispatches 3 workers in parallel on the standard agent (e.g. MiniMax-M3),
|
|
145
145
|
each runs cross-agent review on the complex agent, returns a structured report.
|
|
146
146
|
↓
|
|
147
|
-
You see one consolidated headline: "$0.04 actual / $1.20 saved vs claude-opus-4-
|
|
147
|
+
You see one consolidated headline: "$0.04 actual / $1.20 saved vs claude-opus-4-8 (30× ROI)"
|
|
148
148
|
```
|
|
149
149
|
|
|
150
150
|
**Sample 2 — debug a failing test (multiple skills chained)**
|
|
@@ -233,7 +233,7 @@ Generated on first `mmagent serve`. Retrieve with `mmagent print-token`, or set
|
|
|
233
233
|
|
|
234
234
|
## REST API
|
|
235
235
|
|
|
236
|
-
|
|
236
|
+
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.
|
|
237
237
|
|
|
238
238
|
| Endpoint | Purpose |
|
|
239
239
|
|---|---|
|
|
@@ -250,7 +250,6 @@ Generated on first `mmagent serve`. Retrieve with `mmagent print-token`, or set
|
|
|
250
250
|
| `GET /batch/:id[?taskIndex=N]` | Poll a batch: `202 text/plain` (pending) or `200 application/json` (terminal). `?taskIndex=N` slices on complete state |
|
|
251
251
|
| `POST /context-blocks?cwd=<abs>` | Register a reusable context block |
|
|
252
252
|
| `DELETE /context-blocks/:id?cwd=<abs>` | Delete a context block |
|
|
253
|
-
| `POST /control/batch-slice` | Slice an in-flight batch — return a subset of its tasks by index |
|
|
254
253
|
| `GET /health` | Liveness probe (unauthenticated, loopback-only) |
|
|
255
254
|
| `GET /status` | Server status (authenticated, loopback-only) |
|
|
256
255
|
|
|
@@ -289,7 +288,7 @@ Full design rationale: [DIRECTION.md](https://github.com/zhixuan312/multi-model-
|
|
|
289
288
|
| Skill version mismatch | `mmagent sync-skills` and restart your client |
|
|
290
289
|
| `401 unauthorized` from a skill | `export MMAGENT_AUTH_TOKEN=$(mmagent print-token)` |
|
|
291
290
|
| `pkill` reports success but `mmagent info` still shows the old PID | The pattern didn't match — try `kill <pid-from-mmagent-info>` directly |
|
|
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 process re-resolves |
|
|
291
|
+
| 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 |
|
|
293
292
|
| 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 |
|
|
294
293
|
|
|
295
294
|
## What's new in 4.9.0
|
|
@@ -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,GA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|
+
* 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
|
|
@@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C,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"}
|
package/dist/cli/info.js
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* info.ts — `mmagent info` subcommand.
|
|
3
|
+
*
|
|
4
|
+
* One-shot identity probe: emits CLI version, configured bind/port, token
|
|
5
|
+
* fingerprint (sha256 first 8 hex chars), and — if the daemon is reachable —
|
|
6
|
+
* daemon version/pid/startedAt/uptimeMs from GET /health. Designed to be
|
|
7
|
+
* parseable with --json for scripts and human-readable without it.
|
|
8
|
+
*
|
|
9
|
+
* Usage:
|
|
10
|
+
* mmagent info [--config <path>] [--json]
|
|
11
|
+
*/
|
|
12
|
+
import * as crypto from 'node:crypto';
|
|
13
|
+
import * as os from 'node:os';
|
|
14
|
+
import * as path from 'node:path';
|
|
15
|
+
import { readFileSync } from 'node:fs';
|
|
16
|
+
import { notApplicable } from '@zhixuan92/multi-model-agent-core';
|
|
17
|
+
function fingerprint(token) {
|
|
18
|
+
return crypto.createHash('sha256').update(token).digest('hex').slice(0, 8);
|
|
19
|
+
}
|
|
20
|
+
function resolveHome(p, homeDir) {
|
|
21
|
+
return p.startsWith('~/') ? path.join(homeDir, p.slice(2)) : p;
|
|
22
|
+
}
|
|
23
|
+
export async function runInfo(deps) {
|
|
24
|
+
const stdout = deps.stdout ?? process.stdout.write.bind(process.stdout);
|
|
25
|
+
const stderr = deps.stderr ?? process.stderr.write.bind(process.stderr);
|
|
26
|
+
const fetcher = deps.fetch ?? fetch;
|
|
27
|
+
const homeDir = deps.homeDir ?? os.homedir();
|
|
28
|
+
const json = deps.json ?? false;
|
|
29
|
+
const resolvedTokenFile = resolveHome(deps.tokenFile, homeDir);
|
|
30
|
+
let tokenFp;
|
|
31
|
+
try {
|
|
32
|
+
const token = readFileSync(resolvedTokenFile, 'utf-8').trim();
|
|
33
|
+
if (token.length === 0) {
|
|
34
|
+
stderr(`mmagent info: auth token file is empty: ${resolvedTokenFile}\n`);
|
|
35
|
+
return 1;
|
|
36
|
+
}
|
|
37
|
+
tokenFp = fingerprint(token);
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
const code = err.code;
|
|
41
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
42
|
+
if (code === 'ENOENT') {
|
|
43
|
+
stderr(`mmagent info: auth token file not found: ${resolvedTokenFile}\n`);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
stderr(`mmagent info: cannot read auth token file: ${msg}\n`);
|
|
47
|
+
}
|
|
48
|
+
return 1;
|
|
49
|
+
}
|
|
50
|
+
const host = (deps.bind === '0.0.0.0' || deps.bind === '::') ? '127.0.0.1' : deps.bind;
|
|
51
|
+
const healthUrl = `http://${host}:${deps.port}/health`;
|
|
52
|
+
let running = false;
|
|
53
|
+
let health = null;
|
|
54
|
+
try {
|
|
55
|
+
const res = await fetcher(healthUrl, { signal: AbortSignal.timeout(2000) });
|
|
56
|
+
if (res.ok) {
|
|
57
|
+
health = await res.json();
|
|
58
|
+
running = true;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
// daemon not running — leave running=false
|
|
63
|
+
}
|
|
64
|
+
const fromHealth = (key, validate) => {
|
|
65
|
+
if (!running)
|
|
66
|
+
return notApplicable('daemon not running');
|
|
67
|
+
const v = health?.[key];
|
|
68
|
+
if (validate(v))
|
|
69
|
+
return v;
|
|
70
|
+
return notApplicable('daemon version predates info fields');
|
|
71
|
+
};
|
|
72
|
+
const info = {
|
|
73
|
+
cliVersion: deps.cliVersion,
|
|
74
|
+
daemonVersion: fromHealth('version', (v) => typeof v === 'string' && v.length > 0),
|
|
75
|
+
bind: deps.bind,
|
|
76
|
+
port: deps.port,
|
|
77
|
+
pid: fromHealth('pid', (v) => typeof v === 'number'),
|
|
78
|
+
uptimeMs: fromHealth('uptimeMs', (v) => typeof v === 'number'),
|
|
79
|
+
startedAt: fromHealth('startedAt', (v) => typeof v === 'number'),
|
|
80
|
+
tokenFingerprint: tokenFp,
|
|
81
|
+
running,
|
|
82
|
+
};
|
|
83
|
+
if (json) {
|
|
84
|
+
stdout(JSON.stringify(info, null, 2) + '\n');
|
|
85
|
+
return 0;
|
|
86
|
+
}
|
|
87
|
+
const parts = [`mmagent cli=${info.cliVersion}`];
|
|
88
|
+
if (typeof info.daemonVersion === 'string')
|
|
89
|
+
parts.push(`daemon=${info.daemonVersion}`);
|
|
90
|
+
parts.push(`bind=${info.bind}:${info.port}`);
|
|
91
|
+
if (typeof info.pid === 'number')
|
|
92
|
+
parts.push(`pid=${info.pid}`);
|
|
93
|
+
if (typeof info.uptimeMs === 'number')
|
|
94
|
+
parts.push(`uptime=${Math.floor(info.uptimeMs / 1000)}s`);
|
|
95
|
+
parts.push(`token=${info.tokenFingerprint}`);
|
|
96
|
+
parts.push(`running=${info.running ? 'yes' : 'no'}`);
|
|
97
|
+
stdout(parts.join(' ') + '\n');
|
|
98
|
+
return 0;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"info.js","sourceRoot":"","sources":["../../src/cli/info.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,aAAa,EAAsB,MAAM,mCAAmC,CAAC;AAmCtF,SAAS,WAAW,CAAC,KAAa;IAChC,OAAO,MAAM,CAAC,U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AAI,CAAC,QAAQ,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;IAC7C,IAAI,OAAO,IAAI,CAAC,GAAG,KAAK,QAAQ;QAAE,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;IAChE,IAAI,OAAO,IAAI,CAAC,QAAQ,KAAK,QAAQ;QAAE,KAAK,CAAC,IAAI,CAAC,UAAU,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IACjG,KAAK,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC7C,KAAK,CAAC,IAAI,CAAC,WAAW,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IACrD,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;IAChC,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { MultiModelConfig } from '@zhixuan92/multi-model-agent-core';
|
|
2
|
+
export interface LogsDeps {
|
|
3
|
+
config: MultiModelConfig;
|
|
4
|
+
homeDir?: string;
|
|
5
|
+
follow?: boolean;
|
|
6
|
+
batchId?: string;
|
|
7
|
+
/** Polling interval when --follow; defaults to 300ms. */
|
|
8
|
+
pollMs?: number;
|
|
9
|
+
/** Max time to wait for the log file to appear under --follow; defaults to 30s. */
|
|
10
|
+
waitForLogMs?: number;
|
|
11
|
+
stdout?: (s: string) => boolean;
|
|
12
|
+
stderr?: (s: string) => boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function runLogs(deps: LogsDeps): Promise<number>;
|
|
15
|
+
//# sourceMappingURL=logs.d.ts.map
|