mozart-router 0.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/LICENSE +21 -0
- package/README.md +250 -0
- package/dist/adapters/cursor.d.ts +10 -0
- package/dist/adapters/cursor.d.ts.map +1 -0
- package/dist/adapters/cursor.js +39 -0
- package/dist/adapters/cursor.js.map +1 -0
- package/dist/adapters/generic.d.ts +24 -0
- package/dist/adapters/generic.d.ts.map +1 -0
- package/dist/adapters/generic.js +192 -0
- package/dist/adapters/generic.js.map +1 -0
- package/dist/adapters/hermes.d.ts +10 -0
- package/dist/adapters/hermes.d.ts.map +1 -0
- package/dist/adapters/hermes.js +170 -0
- package/dist/adapters/hermes.js.map +1 -0
- package/dist/adapters/index.d.ts +13 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +27 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/litellm.d.ts +15 -0
- package/dist/adapters/litellm.d.ts.map +1 -0
- package/dist/adapters/litellm.js +238 -0
- package/dist/adapters/litellm.js.map +1 -0
- package/dist/adapters/lmstudio.d.ts +12 -0
- package/dist/adapters/lmstudio.d.ts.map +1 -0
- package/dist/adapters/lmstudio.js +128 -0
- package/dist/adapters/lmstudio.js.map +1 -0
- package/dist/adapters/nim.d.ts +12 -0
- package/dist/adapters/nim.d.ts.map +1 -0
- package/dist/adapters/nim.js +163 -0
- package/dist/adapters/nim.js.map +1 -0
- package/dist/adapters/ollama.d.ts +12 -0
- package/dist/adapters/ollama.d.ts.map +1 -0
- package/dist/adapters/ollama.js +243 -0
- package/dist/adapters/ollama.js.map +1 -0
- package/dist/adapters/openclaw.d.ts +10 -0
- package/dist/adapters/openclaw.d.ts.map +1 -0
- package/dist/adapters/openclaw.js +197 -0
- package/dist/adapters/openclaw.js.map +1 -0
- package/dist/adapters/opencode.d.ts +10 -0
- package/dist/adapters/opencode.d.ts.map +1 -0
- package/dist/adapters/opencode.js +180 -0
- package/dist/adapters/opencode.js.map +1 -0
- package/dist/adapters/openrouter.d.ts +13 -0
- package/dist/adapters/openrouter.d.ts.map +1 -0
- package/dist/adapters/openrouter.js +173 -0
- package/dist/adapters/openrouter.js.map +1 -0
- package/dist/adapters/vllm.d.ts +12 -0
- package/dist/adapters/vllm.d.ts.map +1 -0
- package/dist/adapters/vllm.js +129 -0
- package/dist/adapters/vllm.js.map +1 -0
- package/dist/api/dashboard.d.ts +3 -0
- package/dist/api/dashboard.d.ts.map +1 -0
- package/dist/api/dashboard.js +98 -0
- package/dist/api/dashboard.js.map +1 -0
- package/dist/api/mcp.d.ts +32 -0
- package/dist/api/mcp.d.ts.map +1 -0
- package/dist/api/mcp.js +215 -0
- package/dist/api/mcp.js.map +1 -0
- package/dist/api/middleware.d.ts +20 -0
- package/dist/api/middleware.d.ts.map +1 -0
- package/dist/api/middleware.js +239 -0
- package/dist/api/middleware.js.map +1 -0
- package/dist/api/server.d.ts +26 -0
- package/dist/api/server.d.ts.map +1 -0
- package/dist/api/server.js +294 -0
- package/dist/api/server.js.map +1 -0
- package/dist/api/streaming.d.ts +19 -0
- package/dist/api/streaming.d.ts.map +1 -0
- package/dist/api/streaming.js +274 -0
- package/dist/api/streaming.js.map +1 -0
- package/dist/cli/config-init.d.ts +2 -0
- package/dist/cli/config-init.d.ts.map +1 -0
- package/dist/cli/config-init.js +73 -0
- package/dist/cli/config-init.js.map +1 -0
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +618 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/context/advanced-optimizer.d.ts +12 -0
- package/dist/context/advanced-optimizer.d.ts.map +1 -0
- package/dist/context/advanced-optimizer.js +64 -0
- package/dist/context/advanced-optimizer.js.map +1 -0
- package/dist/context/optimizer.d.ts +7 -0
- package/dist/context/optimizer.d.ts.map +1 -0
- package/dist/context/optimizer.js +101 -0
- package/dist/context/optimizer.js.map +1 -0
- package/dist/core/cache.d.ts +39 -0
- package/dist/core/cache.d.ts.map +1 -0
- package/dist/core/cache.js +90 -0
- package/dist/core/cache.js.map +1 -0
- package/dist/core/health.d.ts +32 -0
- package/dist/core/health.d.ts.map +1 -0
- package/dist/core/health.js +92 -0
- package/dist/core/health.js.map +1 -0
- package/dist/core/inventory.d.ts +28 -0
- package/dist/core/inventory.d.ts.map +1 -0
- package/dist/core/inventory.js +106 -0
- package/dist/core/inventory.js.map +1 -0
- package/dist/core/metrics.d.ts +48 -0
- package/dist/core/metrics.d.ts.map +1 -0
- package/dist/core/metrics.js +115 -0
- package/dist/core/metrics.js.map +1 -0
- package/dist/core/mozart.d.ts +39 -0
- package/dist/core/mozart.d.ts.map +1 -0
- package/dist/core/mozart.js +156 -0
- package/dist/core/mozart.js.map +1 -0
- package/dist/core/persistence.d.ts +13 -0
- package/dist/core/persistence.d.ts.map +1 -0
- package/dist/core/persistence.js +119 -0
- package/dist/core/persistence.js.map +1 -0
- package/dist/core/plugins.d.ts +18 -0
- package/dist/core/plugins.d.ts.map +1 -0
- package/dist/core/plugins.js +110 -0
- package/dist/core/plugins.js.map +1 -0
- package/dist/core/reliability.d.ts +23 -0
- package/dist/core/reliability.d.ts.map +1 -0
- package/dist/core/reliability.js +70 -0
- package/dist/core/reliability.js.map +1 -0
- package/dist/core/session.d.ts +17 -0
- package/dist/core/session.d.ts.map +1 -0
- package/dist/core/session.js +67 -0
- package/dist/core/session.js.map +1 -0
- package/dist/cost/dynamic-pricing.d.ts +24 -0
- package/dist/cost/dynamic-pricing.d.ts.map +1 -0
- package/dist/cost/dynamic-pricing.js +71 -0
- package/dist/cost/dynamic-pricing.js.map +1 -0
- package/dist/cost/estimator.d.ts +8 -0
- package/dist/cost/estimator.d.ts.map +1 -0
- package/dist/cost/estimator.js +48 -0
- package/dist/cost/estimator.js.map +1 -0
- package/dist/explain/engine.d.ts +6 -0
- package/dist/explain/engine.d.ts.map +1 -0
- package/dist/explain/engine.js +59 -0
- package/dist/explain/engine.js.map +1 -0
- package/dist/index.d.ts +59 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +112 -0
- package/dist/index.js.map +1 -0
- package/dist/logs/logger.d.ts +35 -0
- package/dist/logs/logger.d.ts.map +1 -0
- package/dist/logs/logger.js +73 -0
- package/dist/logs/logger.js.map +1 -0
- package/dist/logs/redactor.d.ts +6 -0
- package/dist/logs/redactor.d.ts.map +1 -0
- package/dist/logs/redactor.js +54 -0
- package/dist/logs/redactor.js.map +1 -0
- package/dist/policy/engine.d.ts +9 -0
- package/dist/policy/engine.d.ts.map +1 -0
- package/dist/policy/engine.js +55 -0
- package/dist/policy/engine.js.map +1 -0
- package/dist/policy/loader.d.ts +3 -0
- package/dist/policy/loader.d.ts.map +1 -0
- package/dist/policy/loader.js +27 -0
- package/dist/policy/loader.js.map +1 -0
- package/dist/policy/profiles.d.ts +11 -0
- package/dist/policy/profiles.d.ts.map +1 -0
- package/dist/policy/profiles.js +263 -0
- package/dist/policy/profiles.js.map +1 -0
- package/dist/policy/yaml-loader.d.ts +10 -0
- package/dist/policy/yaml-loader.d.ts.map +1 -0
- package/dist/policy/yaml-loader.js +160 -0
- package/dist/policy/yaml-loader.js.map +1 -0
- package/dist/privacy/guard.d.ts +8 -0
- package/dist/privacy/guard.d.ts.map +1 -0
- package/dist/privacy/guard.js +125 -0
- package/dist/privacy/guard.js.map +1 -0
- package/dist/routing/circuit-breaker.d.ts +23 -0
- package/dist/routing/circuit-breaker.d.ts.map +1 -0
- package/dist/routing/circuit-breaker.js +74 -0
- package/dist/routing/circuit-breaker.js.map +1 -0
- package/dist/routing/classifier.d.ts +5 -0
- package/dist/routing/classifier.d.ts.map +1 -0
- package/dist/routing/classifier.js +102 -0
- package/dist/routing/classifier.js.map +1 -0
- package/dist/routing/fallback.d.ts +27 -0
- package/dist/routing/fallback.d.ts.map +1 -0
- package/dist/routing/fallback.js +66 -0
- package/dist/routing/fallback.js.map +1 -0
- package/dist/routing/multistage.d.ts +49 -0
- package/dist/routing/multistage.d.ts.map +1 -0
- package/dist/routing/multistage.js +108 -0
- package/dist/routing/multistage.js.map +1 -0
- package/dist/routing/router.d.ts +22 -0
- package/dist/routing/router.d.ts.map +1 -0
- package/dist/routing/router.js +123 -0
- package/dist/routing/router.js.map +1 -0
- package/dist/routing/scorer.d.ts +8 -0
- package/dist/routing/scorer.d.ts.map +1 -0
- package/dist/routing/scorer.js +131 -0
- package/dist/routing/scorer.js.map +1 -0
- package/dist/skills/definitions.d.ts +10 -0
- package/dist/skills/definitions.d.ts.map +1 -0
- package/dist/skills/definitions.js +112 -0
- package/dist/skills/definitions.js.map +1 -0
- package/dist/skills/index.d.ts +3 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +14 -0
- package/dist/skills/index.js.map +1 -0
- package/dist/types/index.d.ts +298 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +34 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/canrunit.d.ts +26 -0
- package/dist/utils/canrunit.d.ts.map +1 -0
- package/dist/utils/canrunit.js +69 -0
- package/dist/utils/canrunit.js.map +1 -0
- package/dist/utils/dealsforge.d.ts +6 -0
- package/dist/utils/dealsforge.d.ts.map +1 -0
- package/dist/utils/dealsforge.js +105 -0
- package/dist/utils/dealsforge.js.map +1 -0
- package/docs/ADAPTERS.md +129 -0
- package/docs/ARCHITECTURE.md +113 -0
- package/docs/DELEGATED_EXECUTION.md +62 -0
- package/docs/FEATURE_MATRIX.md +113 -0
- package/docs/GATEWAY_FIRST_PRINCIPLES.md +66 -0
- package/docs/INTEGRATIONS.md +94 -0
- package/docs/LIMITATIONS.md +43 -0
- package/docs/RECOMMEND_ONLY_MODE.md +82 -0
- package/docs/ROADMAP.md +70 -0
- package/docs/SECURITY.md +74 -0
- package/docs/SKILLS_AND_TOOLS.md +141 -0
- package/examples/community-adapter/TEMPLATE.md +157 -0
- package/examples/generic-tools/README.md +29 -0
- package/examples/generic-tools/mozart-tools.json +86 -0
- package/examples/hermes/README.md +29 -0
- package/examples/hermes/mozart-tool.json +48 -0
- package/examples/litellm/README.md +21 -0
- package/examples/litellm/config.yaml +39 -0
- package/examples/ollama/README.md +37 -0
- package/examples/ollama/usage.ts +59 -0
- package/examples/openclaw/README.md +26 -0
- package/examples/openclaw/mozart-skill.yaml +80 -0
- package/examples/opencode/README.md +30 -0
- package/examples/opencode/SKILL.md +47 -0
- package/examples/opencode/mozart-skill.json +64 -0
- package/examples/openrouter/README.md +21 -0
- package/examples/openrouter/config.json +14 -0
- package/package.json +53 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Feature Matrix — Mozart Ultimate Core
|
|
2
|
+
|
|
3
|
+
## Detection & Inventory
|
|
4
|
+
|
|
5
|
+
| Feature | Status | Implementation | Notes |
|
|
6
|
+
|---------|--------|---------------|-------|
|
|
7
|
+
| Gateway/tool detection | implemented | 11 adapters: Ollama, LiteLLM, OpenRouter, OpenCode, OpenClaw, Hermes, Cursor, LM Studio, vLLM, NVIDIA NIM + Generic auto-discovery | Auto-discovers 11 common endpoints |
|
|
8
|
+
| Provider inventory | implemented | `InventoryRegistry` — merge, dedup, source tracking | Reads from gateways, never stores raw keys |
|
|
9
|
+
| Model inventory | implemented | `InventoryRegistry` — per-provider, per-gateway | Includes pricing, context window, capabilities |
|
|
10
|
+
| Generic OpenAI auto-discovery | implemented | `GenericOpenAIAdapter` + `discoverAllGenericAdapters()` | Plug-and-play for any OpenAI-compatible endpoint |
|
|
11
|
+
| DealsForge sync | implemented | `syncDealsForgeData()` — curated model catalog | Static data; future: live API |
|
|
12
|
+
| CanRunIt local scan | implemented | `scanLocalCapability()` — CPU, RAM, OS | GPU detection needs native module |
|
|
13
|
+
|
|
14
|
+
## Classification & Routing
|
|
15
|
+
|
|
16
|
+
| Feature | Status | Implementation | Notes |
|
|
17
|
+
|---------|--------|---------------|-------|
|
|
18
|
+
| Task classifier | implemented | `TaskClassifier` — 19 patterns, priority scoring, heuristic | Local, no LLM needed |
|
|
19
|
+
| Routing engine | implemented | `RoutingEngine` — 7-dimension scoring (quality, cost, latency, privacy, context, reliability, quota) | Produces fallback chain |
|
|
20
|
+
| Multi-stage routing | implemented | `MultiStageRouter` — classify→generate→review pipelines | 4-stage for debugging, 3-stage for code gen |
|
|
21
|
+
| Fallback manager | implemented | `FallbackManager` — retry, exponential backoff, event tracking | Max retries configurable |
|
|
22
|
+
| Cost/token estimator | implemented | `CostEstimator` — per-model pricing, token estimation, savings vs premium | Declares uncertainty when price unknown |
|
|
23
|
+
| Explainability engine | implemented | `ExplainabilityEngine` — full text explanation per route | Why selected, why others not, privacy reasoning |
|
|
24
|
+
|
|
25
|
+
## Policy & Privacy
|
|
26
|
+
|
|
27
|
+
| Feature | Status | Implementation | Notes |
|
|
28
|
+
|---------|--------|---------------|-------|
|
|
29
|
+
| Policy engine | implemented | `PolicyEngine` — privacy, budget, routing rules | 10 built-in profiles |
|
|
30
|
+
| Privacy guard | implemented | `PrivacyGuard` — API keys, tokens, private keys, passwords, .env | 5 actions: allow, redact, block_cloud, local_only, require_confirmation |
|
|
31
|
+
| Built-in profiles | implemented | 10 profiles: coding-agent, cheap-loops, privacy-first, long-context, startup-budget, max-quality, local-first, research-agent, reviewer-agent, multi-agent | Extensible via `mozart.config.yaml` |
|
|
32
|
+
| YAML config loading | implemented | `loadMozartConfig()` — parses mozart.config.yaml | Optional; Mozart works without it |
|
|
33
|
+
|
|
34
|
+
## Execution Modes
|
|
35
|
+
|
|
36
|
+
| Feature | Status | Implementation | Notes |
|
|
37
|
+
|---------|--------|---------------|-------|
|
|
38
|
+
| Recommend-only mode | implemented | All routing methods return decision without executing | Default mode |
|
|
39
|
+
| Delegated execution | implemented | `Mozart.delegate()` — routes to gateway adapter | Only executes if adapter supports it |
|
|
40
|
+
| OpenAI-compatible middleware | implemented | `MozartMiddleware` — `/v1/chat/completions` with auto-routing | Transparent proxy mode |
|
|
41
|
+
| HTTP API | implemented | `MozartApiServer` — 8 endpoints (health, inventory, route, simulate, explain, report, compress, policy) | Local-only by default |
|
|
42
|
+
|
|
43
|
+
## Context & Cache
|
|
44
|
+
|
|
45
|
+
| Feature | Status | Implementation | Notes |
|
|
46
|
+
|---------|--------|---------------|-------|
|
|
47
|
+
| Context optimizer | implemented | `ContextOptimizer` — 4 strategies (send_all, compress, truncate, select_relevant) | Token estimation, budget-aware |
|
|
48
|
+
| Result cache | implemented | `ResultCache` — TTL, LRU eviction, hit tracking | In-memory, configurable size |
|
|
49
|
+
|
|
50
|
+
## Logging & Persistence
|
|
51
|
+
|
|
52
|
+
| Feature | Status | Implementation | Notes |
|
|
53
|
+
|---------|--------|---------------|-------|
|
|
54
|
+
| Local logs | implemented | `Logger` — leveled, event-based, session references | In-memory |
|
|
55
|
+
| Secret redaction | implemented | `Redactor` — strips API keys, tokens, passwords | 10+ patterns covered |
|
|
56
|
+
| Disk persistence | implemented | `saveInventory`, `loadInventory`, `saveSession`, `loadSession`, `saveConfig`, `clearAllData` | JSON files in `~/.mozart/` |
|
|
57
|
+
|
|
58
|
+
## Adapters — Real
|
|
59
|
+
|
|
60
|
+
| Adapter | Status | Detection method |
|
|
61
|
+
|---------|--------|-----------------|
|
|
62
|
+
| Ollama | implemented | CLI: `ollama --version`, `ollama list` |
|
|
63
|
+
| OpenClaw | implemented | File: reads `~/.openclaw/openclaw.json` |
|
|
64
|
+
| OpenCode | implemented | Env vars + file: checks `OPENCODE_CLIENT`, data dir |
|
|
65
|
+
| LiteLLM | implemented | File: scans 6 paths for `litellm_config.yaml` |
|
|
66
|
+
| OpenRouter | implemented | Env: checks `OPENROUTER_API_KEY` |
|
|
67
|
+
| LM Studio | implemented | HTTP: queries `localhost:1234/v1/models` |
|
|
68
|
+
| vLLM | implemented | HTTP: queries `localhost:8000/v1/models` |
|
|
69
|
+
| NVIDIA NIM | implemented | Env + HTTP: checks `NVIDIA_API_KEY`, local endpoint |
|
|
70
|
+
| Generic OpenAI | implemented | HTTP: queries any `/v1/models` endpoint. Auto-discovers 11 endpoints |
|
|
71
|
+
|
|
72
|
+
## Adapters — Stubs
|
|
73
|
+
|
|
74
|
+
| Adapter | Status | Notes |
|
|
75
|
+
|---------|--------|-------|
|
|
76
|
+
| Hermes Agent | adapter stub | Full interface + manifest at `examples/hermes/mozart-tool.json` |
|
|
77
|
+
| Cursor | adapter stub | Full interface, documented integration path |
|
|
78
|
+
|
|
79
|
+
## Skills & Tools
|
|
80
|
+
|
|
81
|
+
| Feature | Status | Implementation |
|
|
82
|
+
|---------|--------|---------------|
|
|
83
|
+
| mozart.route_model | implemented | `SkillDefinition` with full I/O schema |
|
|
84
|
+
| mozart.explain_route | implemented | `SkillDefinition` |
|
|
85
|
+
| mozart.estimate_cost | implemented | `SkillDefinition` |
|
|
86
|
+
| mozart.compress_context | implemented | `SkillDefinition` |
|
|
87
|
+
| mozart.privacy_check | implemented | `SkillDefinition` |
|
|
88
|
+
| mozart.fallback_plan | implemented | `SkillDefinition` |
|
|
89
|
+
| mozart.inventory | implemented | `SkillDefinition` |
|
|
90
|
+
| OpenCode skill manifest | implemented | `examples/opencode/mozart-skill.json` |
|
|
91
|
+
| OpenClaw skill manifest | implemented | `examples/openclaw/mozart-skill.yaml` |
|
|
92
|
+
| Hermes tool manifest | implemented | `examples/hermes/mozart-tool.json` |
|
|
93
|
+
| Generic tool manifests | implemented | `examples/generic-tools/` |
|
|
94
|
+
|
|
95
|
+
## Developer Experience
|
|
96
|
+
|
|
97
|
+
| Feature | Status | Implementation |
|
|
98
|
+
|---------|--------|---------------|
|
|
99
|
+
| CLI | implemented | 13 commands |
|
|
100
|
+
| SDK | implemented | Full TypeScript exports |
|
|
101
|
+
| Tests | implemented | 102 tests, 15 files, Vitest |
|
|
102
|
+
| Docs | implemented | 12 docs files |
|
|
103
|
+
| Examples | implemented | 7 example directories |
|
|
104
|
+
| CI/Lint | implemented | `tsc --noEmit` |
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
**Status key:**
|
|
109
|
+
- **implemented** — Fully coded, tested, functional
|
|
110
|
+
- **partially implemented** — Core logic exists, some edges incomplete
|
|
111
|
+
- **adapter stub** — Full interface exists, requires target environment
|
|
112
|
+
- **documented** — Design docs exist, not yet coded
|
|
113
|
+
- **planned** — On roadmap, not yet started
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# Gateway-First Principles
|
|
2
|
+
|
|
3
|
+
## Core rule
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
Do not rebuild what the gateway already does.
|
|
7
|
+
Detect it, understand it, orchestrate it.
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## What gateways already do
|
|
11
|
+
|
|
12
|
+
Gateways like LiteLLM, OpenRouter, and agent tools like OpenCode already manage:
|
|
13
|
+
|
|
14
|
+
- API key storage and management
|
|
15
|
+
- Provider authentication
|
|
16
|
+
- Model inventory
|
|
17
|
+
- Low-level HTTP calls to LLM APIs
|
|
18
|
+
- Rate limiting and quota management
|
|
19
|
+
- Billing (in some cases)
|
|
20
|
+
- Fallback/retry (in some cases)
|
|
21
|
+
|
|
22
|
+
## What Mozart adds
|
|
23
|
+
|
|
24
|
+
Mozart adds intelligence on top of gateways without duplicating:
|
|
25
|
+
|
|
26
|
+
| Capability | In Gateway | Mozart adds |
|
|
27
|
+
|-------------|-----------|----------------------------------|
|
|
28
|
+
| API keys | Yes | Reference management only |
|
|
29
|
+
| Auth | Yes | Delegates to gateway |
|
|
30
|
+
| Providers | Yes | Enriched inventory from all gateways |
|
|
31
|
+
| Models | Yes | Scored and ranked per task |
|
|
32
|
+
| Execution | Yes | Routes to best gateway |
|
|
33
|
+
| Routing | Partial | Full intelligent routing |
|
|
34
|
+
| Privacy | No | Content scanning + policy |
|
|
35
|
+
| Cost | Basic | Estimation + optimization |
|
|
36
|
+
| Context | No | Token optimization + compression |
|
|
37
|
+
| Explanation | No | Full explainability |
|
|
38
|
+
| Policy | No | Configurable policies |
|
|
39
|
+
| Logging | Partial | Local logs with secret redaction |
|
|
40
|
+
|
|
41
|
+
## Anti-patterns to avoid
|
|
42
|
+
|
|
43
|
+
### DON'T: Create a new proxy that replaces gateways
|
|
44
|
+
Mozart should delegate to existing gateways, not become a new proxy.
|
|
45
|
+
|
|
46
|
+
### DON'T: Ask users to copy all their API keys
|
|
47
|
+
If a gateway manages keys, Mozart only references that relationship.
|
|
48
|
+
|
|
49
|
+
### DON'T: Rebuild provider/model management
|
|
50
|
+
Mozart reads from gateways and enriches with intelligence.
|
|
51
|
+
|
|
52
|
+
### DON'T: Build a desktop application
|
|
53
|
+
Mozart is primarily an importable SDK and CLI tool.
|
|
54
|
+
|
|
55
|
+
### DON'T: Force cloud dependency
|
|
56
|
+
All core processing is local-first.
|
|
57
|
+
|
|
58
|
+
## Gateway introspection pattern
|
|
59
|
+
|
|
60
|
+
Every adapter follows this pattern:
|
|
61
|
+
|
|
62
|
+
1. **Detect** — Find configuration files, environment variables, or running services
|
|
63
|
+
2. **Read** — Parse existing config without duplicating it
|
|
64
|
+
3. **List** — Enumerate available providers and models
|
|
65
|
+
4. **Reference** — Store abstract references, never raw secrets
|
|
66
|
+
5. **Delegate** — Route execution back to the gateway
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Integrations
|
|
2
|
+
|
|
3
|
+
Mozart integrates with multiple AI gateways, agents, and tools. Each integration follows the gateway-first principle: Mozart adds intelligence without duplicating functionality.
|
|
4
|
+
|
|
5
|
+
## Integration modes
|
|
6
|
+
|
|
7
|
+
### 1. Adapter mode (for gateways)
|
|
8
|
+
Mozart ships with adapters that detect and read from existing gateway configurations.
|
|
9
|
+
|
|
10
|
+
### 2. Skill mode (for agent tools)
|
|
11
|
+
Mozart exposes skills (route_model, estimate_cost, privacy_check, etc.) that agents can call.
|
|
12
|
+
|
|
13
|
+
### 3. Tool mode (for agent frameworks)
|
|
14
|
+
Mozart can be called as a tool within OpenClaw, Hermes, or custom agents.
|
|
15
|
+
|
|
16
|
+
### 4. Middleware mode (for pipelines)
|
|
17
|
+
Mozart can sit between an agent and its gateway, injecting routing decisions.
|
|
18
|
+
|
|
19
|
+
### 5. Recommend-only mode (universal)
|
|
20
|
+
Mozart can function in pure advisory mode, generating recommendations without execution.
|
|
21
|
+
|
|
22
|
+
## Supported integrations
|
|
23
|
+
|
|
24
|
+
### OpenCode
|
|
25
|
+
**Status:** Real detection + skill manifest available
|
|
26
|
+
|
|
27
|
+
Mozart detects:
|
|
28
|
+
- OpenCode installation via environment variables (OPENCODE_CLIENT, OPENCODE_SERVER_USERNAME)
|
|
29
|
+
- OpenCode data directory
|
|
30
|
+
|
|
31
|
+
Mozart provides:
|
|
32
|
+
- `examples/opencode/mozart-skill.json` — skill manifest
|
|
33
|
+
- Routing recommendations for coding tasks via the SDK
|
|
34
|
+
|
|
35
|
+
### OpenClaw
|
|
36
|
+
**Status:** Real detection — reads openclaw.json config
|
|
37
|
+
|
|
38
|
+
Mozart detects:
|
|
39
|
+
- OpenClaw config at `~/.openclaw/openclaw.json`
|
|
40
|
+
- All configured providers and models
|
|
41
|
+
- Gateway mode and port
|
|
42
|
+
|
|
43
|
+
Mozart provides:
|
|
44
|
+
- `examples/openclaw/mozart-skill.yaml` — skill definition
|
|
45
|
+
- Skills: route_model, estimate_cost, compress_context
|
|
46
|
+
- Multi-agent workflow support
|
|
47
|
+
|
|
48
|
+
### Hermes Agent
|
|
49
|
+
**Status:** Adapter stub + manifest available
|
|
50
|
+
|
|
51
|
+
Mozart provides:
|
|
52
|
+
- `examples/hermes/mozart-tool.json` — tool definition
|
|
53
|
+
- Provider decision layer
|
|
54
|
+
- Policy enforcement for agentic workflows
|
|
55
|
+
|
|
56
|
+
### LiteLLM
|
|
57
|
+
**Status:** Real adapter with config detection
|
|
58
|
+
|
|
59
|
+
Mozart detects:
|
|
60
|
+
- `litellm_config.yaml` / `litellm_config.yml` in common locations
|
|
61
|
+
- Parses model entries from config
|
|
62
|
+
- Delegates execution to LiteLLM proxy
|
|
63
|
+
|
|
64
|
+
### OpenRouter
|
|
65
|
+
**Status:** Real adapter with env detection
|
|
66
|
+
|
|
67
|
+
Mozart detects:
|
|
68
|
+
- `OPENROUTER_API_KEY`, `OR_API_KEY`, `OPENROUTER_KEY` in environment
|
|
69
|
+
- Provides curated model inventory with pricing data
|
|
70
|
+
- Routes via OpenRouter for cloud models
|
|
71
|
+
|
|
72
|
+
### Ollama
|
|
73
|
+
**Status:** Real adapter with CLI detection
|
|
74
|
+
|
|
75
|
+
Mozart detects:
|
|
76
|
+
- Ollama installation via `ollama --version`
|
|
77
|
+
- Local models via `ollama list`
|
|
78
|
+
- Provides execution target for local inference
|
|
79
|
+
|
|
80
|
+
### Cursor
|
|
81
|
+
**Status:** Adapter stub + documentation
|
|
82
|
+
|
|
83
|
+
Mozart can be used as:
|
|
84
|
+
- Advisory layer via CLI/SDK
|
|
85
|
+
- Local endpoint for model selection
|
|
86
|
+
- Context optimization for IDE usage
|
|
87
|
+
|
|
88
|
+
## Adding a new integration
|
|
89
|
+
|
|
90
|
+
1. Create a new adapter in `src/adapters/` implementing the `GatewayAdapter` interface
|
|
91
|
+
2. Register in `src/adapters/index.ts`
|
|
92
|
+
3. Add a manifest in `examples/<name>/`
|
|
93
|
+
4. Add documentation in `docs/INTEGRATIONS.md`
|
|
94
|
+
5. Write tests in `tests/<name>.test.ts`
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Limitations — Mozart v0.1.0
|
|
2
|
+
|
|
3
|
+
Mozart is honest about what it can and cannot do. This document lists all known limitations.
|
|
4
|
+
|
|
5
|
+
## Core limitations
|
|
6
|
+
|
|
7
|
+
| Area | Limitation | Why |
|
|
8
|
+
|------|-----------|-----|
|
|
9
|
+
| Context compression | Token estimation is approximate (4 chars ≈ 1 token) | Accurate tokenization requires model-specific tokenizers |
|
|
10
|
+
| Cost estimation | Estimates assume known pricing; returns "unknown" when pricing data is missing | Provider APIs don't always expose real-time pricing |
|
|
11
|
+
| Model capabilities | Defaults to 'unknown' for tools, JSON, vision unless known | Cannot test capabilities without executing against each model |
|
|
12
|
+
| Multi-stage routing | Works but requires manual pipeline definition per task type | Fully dynamic pipeline routing needs LLM-level planning |
|
|
13
|
+
|
|
14
|
+
## Adapter limitations
|
|
15
|
+
|
|
16
|
+
| Adapter | Limitation |
|
|
17
|
+
|---------|-----------|
|
|
18
|
+
| OpenCode | Detects installation but cannot read internal provider config (managed by OpenCode's proprietary format) |
|
|
19
|
+
| Hermes Agent | Stub — full interface exists but requires Hermes runtime for real detection |
|
|
20
|
+
| Cursor | Stub — integration depends on Cursor extension API which is not publicly documented |
|
|
21
|
+
| Ollama | If Ollama is not running, cannot detect models. Requires `ollama list` to work. |
|
|
22
|
+
| LiteLLM | Parses `litellm_config.yaml` structure but does not support all LiteLLM config variants |
|
|
23
|
+
| OpenRouter | Uses static curated model list; real-time model inventory would require API call |
|
|
24
|
+
| LM Studio / vLLM / NIM | Requires running server on expected port; cannot auto-discover non-standard ports |
|
|
25
|
+
|
|
26
|
+
## System limitations
|
|
27
|
+
|
|
28
|
+
| Area | Limitation |
|
|
29
|
+
|------|-----------|
|
|
30
|
+
| GPU/VRAM detection | Requires native Node.js addon; currently reports "not detected" |
|
|
31
|
+
| Session persistence | CLI invocations are stateless; each run creates a new session |
|
|
32
|
+
| npm publication | Not yet published to npm registry — requires `npm publish` |
|
|
33
|
+
| Windows paths | Some filesystem detection uses Unix-style paths; tested on Windows |
|
|
34
|
+
|
|
35
|
+
## Design decisions (not bugs)
|
|
36
|
+
|
|
37
|
+
| Decision | Rationale |
|
|
38
|
+
|----------|-----------|
|
|
39
|
+
| No API key storage | Gateways (LiteLLM, OpenRouter, etc.) already manage keys. Mozart doesn't duplicate. |
|
|
40
|
+
| No desktop application | Mozart is an SDK/CLI/skill, not a standalone app. |
|
|
41
|
+
| No mandatory cloud dependency | All core processing (classification, routing, privacy scanning) is local. |
|
|
42
|
+
| No official integration claims | Integrations with OpenCode, OpenClaw, Hermes, Cursor are community efforts unless otherwise stated. |
|
|
43
|
+
| Default recommend-only | Mozart decides; gateways execute. Execution is opt-in. |
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Recommend-Only Mode — Mozart
|
|
2
|
+
|
|
3
|
+
Mozart's default mode is **recommend-only** — it decides, it does not execute.
|
|
4
|
+
|
|
5
|
+
## Principle
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Gateways execute. Mozart decides.
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Mozart's purpose is to provide intelligent routing decisions. The actual execution is delegated to the gateway that the user already has configured. Mozart does not need to execute directly to be useful.
|
|
12
|
+
|
|
13
|
+
## How it works
|
|
14
|
+
|
|
15
|
+
When you call:
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
const route = await mozart.recommend('debug the authentication error');
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Mozart:
|
|
22
|
+
1. Classifies the task (type, complexity, context needs)
|
|
23
|
+
2. Scans for sensitive data (privacy guard)
|
|
24
|
+
3. Evaluates policies (budget, routing rules)
|
|
25
|
+
4. Scores all available models across 7 dimensions
|
|
26
|
+
5. Returns a `RouteDecision` with:
|
|
27
|
+
- Selected gateway, provider, model
|
|
28
|
+
- Confidence score
|
|
29
|
+
- Estimated cost and tokens
|
|
30
|
+
- Full explanation
|
|
31
|
+
- Fallback chain
|
|
32
|
+
|
|
33
|
+
**No execution happens.** Your existing gateway handles the actual API call.
|
|
34
|
+
|
|
35
|
+
## Why recommend-only?
|
|
36
|
+
|
|
37
|
+
1. **No key duplication.** Your gateways (LiteLLM, OpenRouter, Ollama) already manage API keys. Mozart doesn't need them.
|
|
38
|
+
2. **No new proxy.** Mozart adds intelligence without adding infrastructure.
|
|
39
|
+
3. **Universal compatibility.** Even agents that can't route through Mozart can still use its recommendations.
|
|
40
|
+
4. **Safe by default.** Until you explicitly configure execution, Mozart is read-only advisory.
|
|
41
|
+
|
|
42
|
+
## Enabling execution
|
|
43
|
+
|
|
44
|
+
If you want Mozart to execute:
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
const response = await mozart.process({
|
|
48
|
+
input: 'write a function',
|
|
49
|
+
executionMode: 'execute', // or 'delegate'
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Mozart will then attempt to execute via the selected gateway adapter. If the adapter doesn't support execution, it falls back to recommend-only.
|
|
54
|
+
|
|
55
|
+
## CLI
|
|
56
|
+
|
|
57
|
+
All CLI commands are recommend-only by default:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
npm run mozart -- simulate "debug my build" # Simulates, doesn't execute
|
|
61
|
+
npm run mozart -- route "write tests" # Routes, doesn't execute
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## API
|
|
65
|
+
|
|
66
|
+
The HTTP API also defaults to recommend-only:
|
|
67
|
+
|
|
68
|
+
```json
|
|
69
|
+
POST /v1/route
|
|
70
|
+
{
|
|
71
|
+
"task": "refactor auth module",
|
|
72
|
+
"execution_mode": "recommend"
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Design intent
|
|
77
|
+
|
|
78
|
+
Recommend-only mode is not a limitation — it's the core design decision that makes Mozart:
|
|
79
|
+
- Lightweight (no provider logic)
|
|
80
|
+
- Secure (no key management)
|
|
81
|
+
- Compatible (works with any gateway)
|
|
82
|
+
- Honest (never claims it executes when it recommends)
|
package/docs/ROADMAP.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Roadmap
|
|
2
|
+
|
|
3
|
+
## Phase Alpha — Core (v0.1.0) ✅
|
|
4
|
+
|
|
5
|
+
All core features implemented, tested, and documented.
|
|
6
|
+
- [x] Core types and interfaces (28+)
|
|
7
|
+
- [x] CLI (14 commands)
|
|
8
|
+
- [x] SDK importable (full exports)
|
|
9
|
+
- [x] Provider/Model registry with merge, dedup, persistence
|
|
10
|
+
- [x] Ollama detection (real — CLI + HTTP)
|
|
11
|
+
- [x] LiteLLM config detection (real — YAML parsing)
|
|
12
|
+
- [x] OpenRouter env detection (real)
|
|
13
|
+
- [x] OpenCode detection (real — config + models cache reading)
|
|
14
|
+
- [x] OpenClaw detection (real — full openclaw.json parsing)
|
|
15
|
+
- [x] Hermes Agent detection (real — config file scanning)
|
|
16
|
+
- [x] LM Studio detection (real — HTTP)
|
|
17
|
+
- [x] vLLM detection (real — HTTP)
|
|
18
|
+
- [x] NVIDIA NIM detection (real — env + HTTP)
|
|
19
|
+
- [x] Generic OpenAI auto-discovery (11 endpoints)
|
|
20
|
+
- [x] Task classifier (19 patterns, priority scoring)
|
|
21
|
+
- [x] Policy engine (10 built-in profiles)
|
|
22
|
+
- [x] Privacy guard (6 detection types, 5 actions)
|
|
23
|
+
- [x] Context optimizer (4 strategies)
|
|
24
|
+
- [x] Cost/token estimator
|
|
25
|
+
- [x] Explainability engine
|
|
26
|
+
- [x] Routing engine (7-dimension scoring)
|
|
27
|
+
- [x] Fallback manager (retry, backoff, circuit breaker)
|
|
28
|
+
- [x] Multi-stage routing (classify → generate → review)
|
|
29
|
+
- [x] Local logs with secret redaction (10+ patterns)
|
|
30
|
+
- [x] Recommend-only mode
|
|
31
|
+
- [x] Delegated execution model
|
|
32
|
+
- [x] Skill manifests (7 skills)
|
|
33
|
+
- [x] Tool manifests (OpenCode, OpenClaw, Hermes, generic)
|
|
34
|
+
- [x] Cursor endpoint documentation
|
|
35
|
+
- [x] Config YAML loading (mozart.config.yaml)
|
|
36
|
+
- [x] Disk persistence (inventory, session, config)
|
|
37
|
+
- [x] Result cache (TTL, LRU eviction)
|
|
38
|
+
- [x] HTTP API server (8 endpoints + dashboard)
|
|
39
|
+
- [x] OpenAI-compatible middleware proxy (streaming SSE support)
|
|
40
|
+
- [x] MCP server (6 tools, stdio)
|
|
41
|
+
- [x] Plugin system (auto-discovery of mozart-router-adapter-*)
|
|
42
|
+
- [x] Metrics export (JSON + Prometheus)
|
|
43
|
+
- [x] Health check background (circuit breaker)
|
|
44
|
+
- [x] Docker support (Dockerfile + docker-compose)
|
|
45
|
+
- [x] CI/CD (GitHub Actions)
|
|
46
|
+
- [x] Tests (118 tests, 19 files)
|
|
47
|
+
- [x] Full documentation (12 docs)
|
|
48
|
+
- [x] Integration examples (7 directories with READMEs)
|
|
49
|
+
- [x] OpenCode SKILL.md integration
|
|
50
|
+
|
|
51
|
+
## Phase Beta — Polish (v0.2.0)
|
|
52
|
+
|
|
53
|
+
- [ ] npm publication (`npm publish`)
|
|
54
|
+
- [ ] DealsForge live sync (when API available)
|
|
55
|
+
- [ ] CanRunIt GPU detection (native addon)
|
|
56
|
+
- [ ] Advanced context optimizer (local LLM summarization)
|
|
57
|
+
- [ ] Dynamic pricing updates (live pricing API)
|
|
58
|
+
- [ ] Source confidence scoring improvements
|
|
59
|
+
- [ ] Agent workflow profiles refinement
|
|
60
|
+
- [ ] Provider reliability learning (ML-based trust scoring)
|
|
61
|
+
- [ ] Community adapters ecosystem
|
|
62
|
+
|
|
63
|
+
## Phase 1.0 — Stable
|
|
64
|
+
|
|
65
|
+
- [ ] npm package published and stable
|
|
66
|
+
- [ ] Demo video
|
|
67
|
+
- [ ] Community contributions
|
|
68
|
+
- [ ] Production usage reports
|
|
69
|
+
- [ ] Performance benchmarks
|
|
70
|
+
- [ ] Windows/Mac/Linux CI verified
|
package/docs/SECURITY.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Security
|
|
2
|
+
|
|
3
|
+
## Design principles
|
|
4
|
+
|
|
5
|
+
1. **Local-first** — All core processing happens locally. No cloud dependency.
|
|
6
|
+
2. **No cloud by default for sensitive data** — Privacy Guard prevents secrets from reaching cloud models.
|
|
7
|
+
3. **Secrets never logged** — Redactor strips API keys, tokens, and credentials from logs.
|
|
8
|
+
4. **Policies explicit** — Users configure privacy and budget policies explicitly.
|
|
9
|
+
5. **No mandatory telemetry** — Mozart sends no data anywhere without explicit user action.
|
|
10
|
+
6. **User owns their keys** — Mozart never stores or manages API keys that gateways already manage.
|
|
11
|
+
|
|
12
|
+
## Privacy Guard
|
|
13
|
+
|
|
14
|
+
The Privacy Guard scans all content before routing to detect:
|
|
15
|
+
|
|
16
|
+
- API keys (sk-*, etc.)
|
|
17
|
+
- OAuth/access tokens
|
|
18
|
+
- GitHub tokens (ghp_*, gho_*, etc.)
|
|
19
|
+
- Private keys (RSA/EC/DSA/SSH)
|
|
20
|
+
- Credentials and secrets
|
|
21
|
+
- Environment variable files (.env-like patterns)
|
|
22
|
+
|
|
23
|
+
### Actions
|
|
24
|
+
|
|
25
|
+
| Action | Behavior |
|
|
26
|
+
|--------|----------|
|
|
27
|
+
| `allow` | Content is safe, can be sent anywhere |
|
|
28
|
+
| `redact` | Secrets are masked before sending |
|
|
29
|
+
| `block_cloud` | Content must not be sent to cloud models |
|
|
30
|
+
| `local_only` | Content must only be processed locally |
|
|
31
|
+
| `require_confirmation` | User must approve before sending |
|
|
32
|
+
|
|
33
|
+
### Privacy modes
|
|
34
|
+
|
|
35
|
+
| Mode | Description |
|
|
36
|
+
|------|-------------|
|
|
37
|
+
| `open` | Minimal restrictions |
|
|
38
|
+
| `balanced` | Standard protection (default) |
|
|
39
|
+
| `privacy_first` | Aggressive protection |
|
|
40
|
+
| `local_only` | All processing must be local |
|
|
41
|
+
|
|
42
|
+
## Log redaction
|
|
43
|
+
|
|
44
|
+
All logs pass through the `Redactor` before being written. It strips:
|
|
45
|
+
|
|
46
|
+
- API key patterns (sk-, AIza, etc.)
|
|
47
|
+
- GitHub tokens (ghp_, gho_, ghu_, ghs_)
|
|
48
|
+
- Slack tokens (xoxb-, xoxp-, etc.)
|
|
49
|
+
- HuggingFace tokens (hf_)
|
|
50
|
+
- Common secret environment variables (API_KEY, SECRET, TOKEN, etc.)
|
|
51
|
+
|
|
52
|
+
## Key management policy
|
|
53
|
+
|
|
54
|
+
Mozart follows a strict key management hierarchy:
|
|
55
|
+
|
|
56
|
+
1. **Gateway-managed keys** — Reference only (`managed_by_litellm`, `managed_by_opencode`)
|
|
57
|
+
2. **Environment variables** — Reference the variable name, never the value
|
|
58
|
+
3. **Manual keys** — Only for providers not covered by any gateway
|
|
59
|
+
4. **No raw key storage** — Keys are never written to disk by Mozart
|
|
60
|
+
|
|
61
|
+
## Budget protection
|
|
62
|
+
|
|
63
|
+
- Daily spending limits configurable via policy
|
|
64
|
+
- Warning threshold at configurable percentage
|
|
65
|
+
- Premium models only allowed for critical tasks (configurable)
|
|
66
|
+
- Cost estimation before execution
|
|
67
|
+
|
|
68
|
+
## Best practices
|
|
69
|
+
|
|
70
|
+
1. Always run `mozart doctor` to understand your detected stack
|
|
71
|
+
2. Set budget limits appropriate for your use case
|
|
72
|
+
3. Use `privacy_first` mode when handling customer data
|
|
73
|
+
4. Review `mozart why` explanations for routing decisions
|
|
74
|
+
5. Run `mozart simulate` before executing expensive tasks
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
# Skills and Tools — Mozart
|
|
2
|
+
|
|
3
|
+
Mozart exposes 7 skills callable by agents. Each skill has a typed definition (input/output schema) and integration manifests for OpenClaw, OpenCode, and Hermes Agent.
|
|
4
|
+
|
|
5
|
+
## Skill definitions
|
|
6
|
+
|
|
7
|
+
Located in `src/skills/definitions.ts`. Each skill implements the `SkillDefinition` interface:
|
|
8
|
+
|
|
9
|
+
```typescript
|
|
10
|
+
interface SkillDefinition {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
input: Record<string, SkillInputField>;
|
|
14
|
+
output: Record<string, SkillOutputField>;
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Available skills
|
|
19
|
+
|
|
20
|
+
### mozart.route_model
|
|
21
|
+
|
|
22
|
+
Choose the best available model/provider/gateway for an AI task.
|
|
23
|
+
|
|
24
|
+
**Input:**
|
|
25
|
+
| Field | Type | Required |
|
|
26
|
+
|-------|------|----------|
|
|
27
|
+
| task | string | yes |
|
|
28
|
+
| context_size | number | no |
|
|
29
|
+
| privacy_mode | open \| balanced \| privacy_first \| local_only | no |
|
|
30
|
+
| budget_mode | lowest \| balanced \| quality | no |
|
|
31
|
+
|
|
32
|
+
**Output:** selected_gateway, selected_provider, selected_model, confidence, context_strategy, estimated_cost, fallback_chain, explanation
|
|
33
|
+
|
|
34
|
+
### mozart.explain_route
|
|
35
|
+
|
|
36
|
+
Explain why Mozart chose a specific model/provider for the last task.
|
|
37
|
+
|
|
38
|
+
**Output:** explanation (string)
|
|
39
|
+
|
|
40
|
+
### mozart.estimate_cost
|
|
41
|
+
|
|
42
|
+
Estimate token usage and cost for a task before execution.
|
|
43
|
+
|
|
44
|
+
**Input:** task, context (string), model (string, optional)
|
|
45
|
+
|
|
46
|
+
**Output:** estimated_input_tokens, estimated_output_tokens, estimated_cost, currency
|
|
47
|
+
|
|
48
|
+
### mozart.compress_context
|
|
49
|
+
|
|
50
|
+
Optimize and compress context to reduce token usage.
|
|
51
|
+
|
|
52
|
+
**Input:** content (string), max_tokens (number), strategy (string)
|
|
53
|
+
|
|
54
|
+
**Output:** strategy, original_tokens, compressed_tokens, compression_ratio
|
|
55
|
+
|
|
56
|
+
### mozart.privacy_check
|
|
57
|
+
|
|
58
|
+
Scan content for secrets, API keys, tokens before sending to models.
|
|
59
|
+
|
|
60
|
+
**Input:** content (string), privacy_mode (string, optional)
|
|
61
|
+
|
|
62
|
+
**Output:** allowed, findings (array), action, redacted_content
|
|
63
|
+
|
|
64
|
+
### mozart.fallback_plan
|
|
65
|
+
|
|
66
|
+
Generate a fallback execution plan.
|
|
67
|
+
|
|
68
|
+
**Input:** task (string), primary_model (string, optional)
|
|
69
|
+
|
|
70
|
+
**Output:** primary (object), fallbacks (array), retry_policy
|
|
71
|
+
|
|
72
|
+
### mozart.inventory
|
|
73
|
+
|
|
74
|
+
Return the current inventory of detected gateways, providers, and models.
|
|
75
|
+
|
|
76
|
+
**Output:** gateways (array), providers (array), models (array), generated_at
|
|
77
|
+
|
|
78
|
+
## Integration manifests
|
|
79
|
+
|
|
80
|
+
### OpenCode
|
|
81
|
+
|
|
82
|
+
Manifest: `examples/opencode/mozart-skill.json`
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"name": "mozart.route_model",
|
|
87
|
+
"type": "skill",
|
|
88
|
+
"integration": { "package": "mozart-router", "method": "sdk" }
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### OpenClaw
|
|
93
|
+
|
|
94
|
+
Manifest: `examples/openclaw/mozart-skill.yaml`
|
|
95
|
+
|
|
96
|
+
```yaml
|
|
97
|
+
skills:
|
|
98
|
+
- name: mozart.route_model
|
|
99
|
+
input: { task: { type: string, required: true } }
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Hermes Agent
|
|
103
|
+
|
|
104
|
+
Manifest: `examples/hermes/mozart-tool.json`
|
|
105
|
+
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"name": "mozart.route_model",
|
|
109
|
+
"type": "tool",
|
|
110
|
+
"source": { "package": "mozart-router", "method": "sdk" }
|
|
111
|
+
}
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Generic tools
|
|
115
|
+
|
|
116
|
+
Manifest: `examples/generic-tools/mozart-tools.json`
|
|
117
|
+
|
|
118
|
+
A collection of all 7 skills in a generic JSON format suitable for any agent framework.
|
|
119
|
+
|
|
120
|
+
## Using skills from code
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
import { Mozart, ALL_SKILLS } from 'mozart-router';
|
|
124
|
+
|
|
125
|
+
// Inspect skill definitions
|
|
126
|
+
for (const skill of ALL_SKILLS) {
|
|
127
|
+
console.log(skill.name, Object.keys(skill.input));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
// Use Mozart SDK directly
|
|
131
|
+
const mozart = new Mozart();
|
|
132
|
+
const route = await mozart.recommend('analyze this code for bugs');
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Adding a new skill
|
|
136
|
+
|
|
137
|
+
1. Add definition to `src/skills/definitions.ts`
|
|
138
|
+
2. Add to the `ALL_SKILLS` array
|
|
139
|
+
3. Implement the corresponding method in `Mozart` core
|
|
140
|
+
4. Add CLI command if needed
|
|
141
|
+
5. Update manifests in `examples/`
|