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,157 @@
|
|
|
1
|
+
# Mozart Community Adapter Template
|
|
2
|
+
|
|
3
|
+
This directory is a template for creating community Mozart adapters.
|
|
4
|
+
|
|
5
|
+
## Quick start
|
|
6
|
+
|
|
7
|
+
1. Create a new npm package: `mkdir mozart-router-adapter-mygateway && cd mozart-router-adapter-mygateway`
|
|
8
|
+
2. Copy this template
|
|
9
|
+
3. Implement the `GatewayAdapter` interface
|
|
10
|
+
4. Export a `mozartPlugin` object
|
|
11
|
+
5. Publish to npm: `npm publish`
|
|
12
|
+
|
|
13
|
+
## Package structure
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
mozart-router-adapter-mygateway/
|
|
17
|
+
package.json
|
|
18
|
+
src/
|
|
19
|
+
index.ts # Main entry — MUST export mozartPlugin
|
|
20
|
+
adapter.ts # Your GatewayAdapter implementation
|
|
21
|
+
README.md
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## package.json
|
|
25
|
+
|
|
26
|
+
```json
|
|
27
|
+
{
|
|
28
|
+
"name": "mozart-router-adapter-mygateway",
|
|
29
|
+
"version": "1.0.0",
|
|
30
|
+
"description": "Mozart adapter for MyGateway",
|
|
31
|
+
"main": "src/index.js",
|
|
32
|
+
"keywords": ["mozart", "adapter", "mygateway"],
|
|
33
|
+
"peerDependencies": {
|
|
34
|
+
"mozart-router": ">=0.1.0"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## src/adapter.ts
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
import {
|
|
43
|
+
GatewayAdapter,
|
|
44
|
+
DetectionResult,
|
|
45
|
+
Provider,
|
|
46
|
+
Model,
|
|
47
|
+
ExecutionTarget,
|
|
48
|
+
ExecutionRequest,
|
|
49
|
+
ExecutionResult,
|
|
50
|
+
RouteDecision,
|
|
51
|
+
} from 'mozart-router';
|
|
52
|
+
|
|
53
|
+
export class MyGatewayAdapter implements GatewayAdapter {
|
|
54
|
+
id = 'mygateway';
|
|
55
|
+
name = 'MyGateway';
|
|
56
|
+
|
|
57
|
+
async detect(): Promise<DetectionResult> {
|
|
58
|
+
// 1. Check if MyGateway is installed/configured
|
|
59
|
+
// 2. NEVER read raw API keys
|
|
60
|
+
// 3. Use apiKeyRef or apiKeyManagedBy for key tracking
|
|
61
|
+
// 4. Return detailed detection info
|
|
62
|
+
return {
|
|
63
|
+
detected: true,
|
|
64
|
+
gatewayId: this.id,
|
|
65
|
+
gatewayName: this.name,
|
|
66
|
+
status: 'active',
|
|
67
|
+
providersCount: 1,
|
|
68
|
+
modelsCount: 3,
|
|
69
|
+
details: ['MyGateway detected at ...'],
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async listProviders(): Promise<Provider[]> {
|
|
74
|
+
return [
|
|
75
|
+
{
|
|
76
|
+
id: 'mygateway',
|
|
77
|
+
name: 'MyGateway',
|
|
78
|
+
source: 'detected',
|
|
79
|
+
gateway: this.id,
|
|
80
|
+
privacyLevel: 'cloud',
|
|
81
|
+
status: 'available',
|
|
82
|
+
lastCheckedAt: new Date().toISOString(),
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
async listModels(): Promise<Model[]> {
|
|
88
|
+
return [
|
|
89
|
+
{
|
|
90
|
+
id: 'my-model',
|
|
91
|
+
providerId: 'mygateway',
|
|
92
|
+
gatewayId: this.id,
|
|
93
|
+
displayName: 'My Model',
|
|
94
|
+
modality: ['text'],
|
|
95
|
+
contextWindow: 8192,
|
|
96
|
+
latencyClass: 'medium',
|
|
97
|
+
qualityClass: 'medium',
|
|
98
|
+
strengths: [],
|
|
99
|
+
weaknesses: [],
|
|
100
|
+
privacyLevel: 'cloud',
|
|
101
|
+
availability: 'available',
|
|
102
|
+
sourceConfidence: 'high',
|
|
103
|
+
lastCheckedAt: new Date().toISOString(),
|
|
104
|
+
},
|
|
105
|
+
];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
async getExecutionTarget(decision: RouteDecision): Promise<ExecutionTarget> {
|
|
109
|
+
return {
|
|
110
|
+
adapter: this.id,
|
|
111
|
+
provider: decision.selectedProvider,
|
|
112
|
+
model: decision.selectedModel,
|
|
113
|
+
method: 'gateway_call',
|
|
114
|
+
apiKeyManagedBy: 'gateway',
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## src/index.ts
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
import { MozartPlugin } from 'mozart-router';
|
|
124
|
+
import { MyGatewayAdapter } from './adapter';
|
|
125
|
+
|
|
126
|
+
export const mozartPlugin: MozartPlugin = {
|
|
127
|
+
name: 'mozart-router-adapter-mygateway',
|
|
128
|
+
version: '1.0.0',
|
|
129
|
+
adapters: [new MyGatewayAdapter()],
|
|
130
|
+
async onRegister() {
|
|
131
|
+
console.log('MyGateway adapter registered');
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Rules for adapters
|
|
137
|
+
|
|
138
|
+
1. **Never store raw API keys.** Use `apiKeyRef` or `apiKeyManagedBy`.
|
|
139
|
+
2. **Never log secrets.** If you must reference keys, redact them.
|
|
140
|
+
3. **Detect don't configure.** Auto-detect the gateway, don't require manual setup.
|
|
141
|
+
4. **Delegate execution.** Let the gateway execute, Mozart decides.
|
|
142
|
+
5. **Graceful degradation.** If the gateway isn't available, return clean detection result.
|
|
143
|
+
6. **Test with mocks.** Provide at least unit tests with mocked gateway responses.
|
|
144
|
+
|
|
145
|
+
## Publishing
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
npm login
|
|
149
|
+
npm publish --access public
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Once published, Mozart's plugin system auto-discovers your adapter when the user runs `mozart doctor`.
|
|
153
|
+
|
|
154
|
+
## Support
|
|
155
|
+
|
|
156
|
+
- GitHub: https://github.com/ucav/mozart-router
|
|
157
|
+
- Issues: https://github.com/ucav/mozart-router/issues
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Generic Tools — Mozart
|
|
2
|
+
|
|
3
|
+
This directory contains a generic tool collection manifest for Mozart.
|
|
4
|
+
|
|
5
|
+
## Files
|
|
6
|
+
|
|
7
|
+
- `mozart-tools.json` — All 7 Mozart skills as generic tool definitions
|
|
8
|
+
|
|
9
|
+
## Usage
|
|
10
|
+
|
|
11
|
+
Use this manifest to integrate Mozart as a tool collection in any agent framework that supports JSON tool definitions:
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"tools": ["path/to/examples/generic-tools/mozart-tools.json"]
|
|
16
|
+
}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The manifest is framework-agnostic and follows the standard tool definition format used by most AI agent frameworks.
|
|
20
|
+
|
|
21
|
+
## SKills included
|
|
22
|
+
|
|
23
|
+
1. `mozart.route_model` — Choose best model/provider for a task
|
|
24
|
+
2. `mozart.explain_route` — Explain routing decisions
|
|
25
|
+
3. `mozart.estimate_cost` — Estimate cost before execution
|
|
26
|
+
4. `mozart.compress_context` — Optimize context for tokens
|
|
27
|
+
5. `mozart.privacy_check` — Scan for secrets before sending
|
|
28
|
+
6. `mozart.fallback_plan` — Generate fallback execution plans
|
|
29
|
+
7. `mozart.inventory` — List detected gateways, providers, models
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mozart-router",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "tool-collection",
|
|
5
|
+
"description": "Mozart tool collection for AI agents — route models, estimate costs, check privacy, compress context",
|
|
6
|
+
"tools": [
|
|
7
|
+
{
|
|
8
|
+
"name": "mozart.route_model",
|
|
9
|
+
"description": "Choose the best available model/provider/gateway for an AI task based on cost, context, latency, privacy, and capabilities.",
|
|
10
|
+
"parameters": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"properties": {
|
|
13
|
+
"task": { "type": "string", "description": "The task to route" },
|
|
14
|
+
"privacy_mode": { "type": "string", "enum": ["open", "balanced", "privacy_first", "local_only"] },
|
|
15
|
+
"budget_mode": { "type": "string", "enum": ["lowest", "balanced", "quality"] }
|
|
16
|
+
},
|
|
17
|
+
"required": ["task"]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
"name": "mozart.explain_route",
|
|
22
|
+
"description": "Explain why Mozart chose a specific model/provider for the last routing decision."
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "mozart.estimate_cost",
|
|
26
|
+
"description": "Estimate the token usage and cost for a given task before execution.",
|
|
27
|
+
"parameters": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"properties": {
|
|
30
|
+
"task": { "type": "string", "description": "Task description" },
|
|
31
|
+
"context": { "type": "string", "description": "Context to include" },
|
|
32
|
+
"model": { "type": "string", "description": "Target model (optional)" }
|
|
33
|
+
},
|
|
34
|
+
"required": ["task"]
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
"name": "mozart.compress_context",
|
|
39
|
+
"description": "Optimize and compress context to reduce token usage while preserving relevant information.",
|
|
40
|
+
"parameters": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"properties": {
|
|
43
|
+
"content": { "type": "string", "description": "Content to compress" },
|
|
44
|
+
"max_tokens": { "type": "number", "description": "Maximum tokens allowed" },
|
|
45
|
+
"strategy": { "type": "string", "enum": ["compress", "truncate", "summarize", "select_relevant"] }
|
|
46
|
+
},
|
|
47
|
+
"required": ["content"]
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "mozart.privacy_check",
|
|
52
|
+
"description": "Scan content for secrets, API keys, tokens, and sensitive data before sending to a model.",
|
|
53
|
+
"parameters": {
|
|
54
|
+
"type": "object",
|
|
55
|
+
"properties": {
|
|
56
|
+
"content": { "type": "string", "description": "Content to scan" },
|
|
57
|
+
"privacy_mode": { "type": "string", "enum": ["open", "balanced", "privacy_first", "local_only"] }
|
|
58
|
+
},
|
|
59
|
+
"required": ["content"]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
"name": "mozart.fallback_plan",
|
|
64
|
+
"description": "Generate a fallback execution plan in case the primary model/provider fails.",
|
|
65
|
+
"parameters": {
|
|
66
|
+
"type": "object",
|
|
67
|
+
"properties": {
|
|
68
|
+
"task": { "type": "string", "description": "Task description" },
|
|
69
|
+
"primary_model": { "type": "string", "description": "Primary model ID" }
|
|
70
|
+
},
|
|
71
|
+
"required": ["task"]
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"name": "mozart.inventory",
|
|
76
|
+
"description": "Return the current inventory of detected gateways, providers, and models available to Mozart."
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"integration": {
|
|
80
|
+
"package": "mozart-router",
|
|
81
|
+
"install": "npm install mozart-router",
|
|
82
|
+
"import": "import { Mozart } from 'mozart-router'",
|
|
83
|
+
"init": "const mozart = new Mozart()",
|
|
84
|
+
"usage": "const route = await mozart.recommend(task)"
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# Hermes Agent + Mozart
|
|
2
|
+
|
|
3
|
+
This directory contains the Mozart tool manifest for Hermes Agent.
|
|
4
|
+
|
|
5
|
+
## Files
|
|
6
|
+
|
|
7
|
+
- `mozart-tool.json` — Tool definition for Hermes Agent
|
|
8
|
+
|
|
9
|
+
## Integration
|
|
10
|
+
|
|
11
|
+
1. Install Mozart:
|
|
12
|
+
```bash
|
|
13
|
+
npm install mozart-router
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
2. Add the tool definition to your Hermes agent configuration
|
|
17
|
+
|
|
18
|
+
3. Call Mozart tools from your Hermes workflows:
|
|
19
|
+
```typescript
|
|
20
|
+
import { Mozart } from 'mozart-router';
|
|
21
|
+
const mozart = new Mozart();
|
|
22
|
+
const recommendation = await mozart.recommend(task);
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Status
|
|
26
|
+
|
|
27
|
+
Hermes Agent integration is currently a stub adapter with a full tool manifest. The adapter interface is complete and ready for integration, but real detection requires the Hermes Agent runtime environment.
|
|
28
|
+
|
|
29
|
+
This integration is community-maintained and is not officially affiliated with Hermes Agent.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "mozart.route_model",
|
|
3
|
+
"description": "Choose the best available model/provider/gateway for a task",
|
|
4
|
+
"version": "0.1.0",
|
|
5
|
+
"type": "tool",
|
|
6
|
+
"source": {
|
|
7
|
+
"package": "mozart-router",
|
|
8
|
+
"method": "sdk"
|
|
9
|
+
},
|
|
10
|
+
"parameters": {
|
|
11
|
+
"type": "object",
|
|
12
|
+
"properties": {
|
|
13
|
+
"task": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "The task to route"
|
|
16
|
+
},
|
|
17
|
+
"privacy_mode": {
|
|
18
|
+
"type": "string",
|
|
19
|
+
"description": "Privacy level",
|
|
20
|
+
"enum": ["open", "balanced", "privacy_first", "local_only"]
|
|
21
|
+
},
|
|
22
|
+
"budget_mode": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "Budget preference",
|
|
25
|
+
"enum": ["lowest", "balanced", "quality"]
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"required": ["task"]
|
|
29
|
+
},
|
|
30
|
+
"returns": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"properties": {
|
|
33
|
+
"selected_gateway": { "type": "string" },
|
|
34
|
+
"selected_provider": { "type": "string" },
|
|
35
|
+
"selected_model": { "type": "string" },
|
|
36
|
+
"confidence": { "type": "number" },
|
|
37
|
+
"estimated_cost": { "type": "number" },
|
|
38
|
+
"fallback_chain": { "type": "array" },
|
|
39
|
+
"explanation": { "type": "array" }
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"usage": {
|
|
43
|
+
"install": "npm install mozart-router",
|
|
44
|
+
"import": "import { Mozart } from 'mozart-router'",
|
|
45
|
+
"init": "const mozart = new Mozart()",
|
|
46
|
+
"call": "const result = await mozart.route(task)"
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# LiteLLM + Mozart
|
|
2
|
+
|
|
3
|
+
This directory contains an example LiteLLM configuration.
|
|
4
|
+
|
|
5
|
+
## Files
|
|
6
|
+
|
|
7
|
+
- `config.yaml` — Example LiteLLM config with Mozart integration notes
|
|
8
|
+
|
|
9
|
+
## Integration
|
|
10
|
+
|
|
11
|
+
Mozart detects LiteLLM automatically by scanning for `litellm_config.yaml` in common locations. When a config is found, Mozart reads the model entries and builds an inventory — **without accessing your raw API keys**.
|
|
12
|
+
|
|
13
|
+
1. Your existing `litellm_config.yaml` is all Mozart needs
|
|
14
|
+
2. Run `mozart doctor` to confirm detection
|
|
15
|
+
3. Mozart routes tasks to the best model in your LiteLLM config
|
|
16
|
+
|
|
17
|
+
## Status
|
|
18
|
+
|
|
19
|
+
LiteLLM integration is **real** — config detection, model extraction, and inventory building work. Execution is delegated to the LiteLLM proxy.
|
|
20
|
+
|
|
21
|
+
This integration is community-maintained. LiteLLM is its own project (https://github.com/BerriAI/litellm).
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# LiteLLM + Mozart integration
|
|
2
|
+
|
|
3
|
+
# Mozart detects this config automatically via LiteLLMAdapter.
|
|
4
|
+
# No changes needed to this file — Mozart reads it as-is.
|
|
5
|
+
|
|
6
|
+
model_list:
|
|
7
|
+
- model_name: gpt-4o
|
|
8
|
+
litellm_params:
|
|
9
|
+
model: openai/gpt-4o
|
|
10
|
+
api_key: ${OPENAI_API_KEY}
|
|
11
|
+
|
|
12
|
+
- model_name: claude-sonnet
|
|
13
|
+
litellm_params:
|
|
14
|
+
model: anthropic/claude-sonnet-4-20250514
|
|
15
|
+
api_key: ${ANTHROPIC_API_KEY}
|
|
16
|
+
|
|
17
|
+
- model_name: deepseek-chat
|
|
18
|
+
litellm_params:
|
|
19
|
+
model: deepseek/deepseek-chat
|
|
20
|
+
api_key: ${DEEPSEEK_API_KEY}
|
|
21
|
+
|
|
22
|
+
- model_name: qwen-local
|
|
23
|
+
litellm_params:
|
|
24
|
+
model: ollama/qwen2.5:7b
|
|
25
|
+
api_base: http://localhost:11434
|
|
26
|
+
|
|
27
|
+
litellm_settings:
|
|
28
|
+
drop_params: true
|
|
29
|
+
set_verbose: false
|
|
30
|
+
|
|
31
|
+
general_settings:
|
|
32
|
+
master_key: ${LITELLM_MASTER_KEY}
|
|
33
|
+
|
|
34
|
+
# How Mozart works with LiteLLM:
|
|
35
|
+
# 1. Detects this config file automatically
|
|
36
|
+
# 2. Reads model entries without accessing raw API keys
|
|
37
|
+
# 3. Builds inventory from existing configuration
|
|
38
|
+
# 4. Routes tasks to the best model via LiteLLM proxy
|
|
39
|
+
# 5. Never stores or manages your API keys
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# Ollama + Mozart
|
|
2
|
+
|
|
3
|
+
This directory contains an example of using Mozart with Ollama for local model routing.
|
|
4
|
+
|
|
5
|
+
## Files
|
|
6
|
+
|
|
7
|
+
- `usage.ts` — Full example code
|
|
8
|
+
|
|
9
|
+
## Integration
|
|
10
|
+
|
|
11
|
+
Mozart detects Ollama automatically via the `ollama` CLI. All locally pulled models are added to Mozart's inventory.
|
|
12
|
+
|
|
13
|
+
1. Install Ollama: https://ollama.com
|
|
14
|
+
2. Pull models: `ollama pull llama3.2`, `ollama pull qwen2.5`
|
|
15
|
+
3. Mozart detects them automatically: `mozart doctor`
|
|
16
|
+
4. Tasks are routed to local models when appropriate (free, private)
|
|
17
|
+
|
|
18
|
+
## Example
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { Mozart, OllamaAdapter } from 'mozart-router';
|
|
22
|
+
|
|
23
|
+
const mozart = new Mozart();
|
|
24
|
+
mozart.registry.registerAdapter(new OllamaAdapter());
|
|
25
|
+
await mozart.detectAll();
|
|
26
|
+
|
|
27
|
+
// Simple tasks → local model
|
|
28
|
+
const route = await mozart.recommend('hello');
|
|
29
|
+
console.log(route.selectedModel); // e.g. "llama3.2"
|
|
30
|
+
console.log(route.estimatedCost); // 0 (free)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Status
|
|
34
|
+
|
|
35
|
+
Ollama integration is **real** — CLI detection, model listing, and direct HTTP execution all work.
|
|
36
|
+
|
|
37
|
+
This integration is community-maintained. Ollama is its own project (https://ollama.com).
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// Example: Using Mozart with Ollama for local model routing
|
|
2
|
+
//
|
|
3
|
+
// This example demonstrates:
|
|
4
|
+
// 1. Creating a Mozart instance
|
|
5
|
+
// 2. Registering the Ollama adapter
|
|
6
|
+
// 3. Building an inventory from local models
|
|
7
|
+
// 4. Routing tasks to local vs cloud models
|
|
8
|
+
|
|
9
|
+
import { Mozart, OllamaAdapter, OpenRouterAdapter } from 'mozart-router';
|
|
10
|
+
|
|
11
|
+
async function main() {
|
|
12
|
+
const mozart = new Mozart();
|
|
13
|
+
|
|
14
|
+
// Register adapters - Mozart detects available gateways
|
|
15
|
+
mozart.registry.registerAdapter(new OllamaAdapter());
|
|
16
|
+
mozart.registry.registerAdapter(new OpenRouterAdapter());
|
|
17
|
+
|
|
18
|
+
// Detect all gateways and build inventory
|
|
19
|
+
for (const adapter of mozart.registry.listAdapters()) {
|
|
20
|
+
const detection = await adapter.detect();
|
|
21
|
+
mozart.registry.recordDetection(detection);
|
|
22
|
+
|
|
23
|
+
if (detection.detected) {
|
|
24
|
+
console.log(`Found: ${adapter.name} (${detection.status})`);
|
|
25
|
+
const providers = await adapter.listProviders();
|
|
26
|
+
const models = await adapter.listModels();
|
|
27
|
+
mozart.registry.mergeFromAdapter(adapter.id, providers, models);
|
|
28
|
+
console.log(` ${models.length} models available`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Show inventory
|
|
33
|
+
const snapshot = mozart.getInventory();
|
|
34
|
+
console.log(`\nTotal: ${snapshot.models.length} models`);
|
|
35
|
+
|
|
36
|
+
// Route a simple task - Mozart will prefer local models
|
|
37
|
+
const simpleRoute = await mozart.recommend('hello, how are you?');
|
|
38
|
+
console.log(`\nSimple task → ${simpleRoute.selectedModel} ($${simpleRoute.estimatedCost})`);
|
|
39
|
+
|
|
40
|
+
// Route a coding task - Mozart will select best coding model
|
|
41
|
+
const codeRoute = await mozart.recommend('write a function to sort an array');
|
|
42
|
+
console.log(`Code task → ${codeRoute.selectedModel} ($${codeRoute.estimatedCost})`);
|
|
43
|
+
|
|
44
|
+
// Full process with privacy and cost analysis
|
|
45
|
+
const response = await mozart.process({
|
|
46
|
+
input: 'debug the authentication flow',
|
|
47
|
+
budgetMode: 'balanced',
|
|
48
|
+
privacyMode: 'balanced',
|
|
49
|
+
executionMode: 'recommend',
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
console.log(`\nFull response:`);
|
|
53
|
+
console.log(` Selected: ${response.route.selectedModel}`);
|
|
54
|
+
console.log(` Cost: $${response.cost.totalCost.toFixed(4)}`);
|
|
55
|
+
console.log(` Privacy: ${response.privacy.action}`);
|
|
56
|
+
console.log(` ${response.explanation.length} explanation lines`);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
main().catch(console.error);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
# OpenClaw + Mozart
|
|
2
|
+
|
|
3
|
+
This directory contains the Mozart skill manifest for OpenClaw.
|
|
4
|
+
|
|
5
|
+
## Files
|
|
6
|
+
|
|
7
|
+
- `mozart-skill.yaml` — Skill definitions for OpenClaw
|
|
8
|
+
|
|
9
|
+
## Integration
|
|
10
|
+
|
|
11
|
+
Mozart detects OpenClaw automatically by reading `~/.openclaw/openclaw.json`. All configured providers and models are imported into Mozart's inventory.
|
|
12
|
+
|
|
13
|
+
1. Install Mozart:
|
|
14
|
+
```bash
|
|
15
|
+
npm install mozart-router
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
2. The skill manifest can be added to your OpenClaw configuration
|
|
19
|
+
|
|
20
|
+
3. Mozart reads your existing providers/models without accessing your API keys
|
|
21
|
+
|
|
22
|
+
## Status
|
|
23
|
+
|
|
24
|
+
OpenClaw integration is **real**. Mozart reads the OpenClaw config file, extracts all providers and models, and routes tasks using your existing OpenClaw infrastructure. The adapter never reads or stores raw API keys.
|
|
25
|
+
|
|
26
|
+
This integration is community-maintained.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Mozart skills for OpenClaw
|
|
2
|
+
|
|
3
|
+
skills:
|
|
4
|
+
- name: mozart.route_model
|
|
5
|
+
description: Choose the best available model/provider/gateway for a task
|
|
6
|
+
input:
|
|
7
|
+
task:
|
|
8
|
+
type: string
|
|
9
|
+
description: The task to route
|
|
10
|
+
required: true
|
|
11
|
+
privacy_mode:
|
|
12
|
+
type: string
|
|
13
|
+
description: Privacy level (open, balanced, privacy_first, local_only)
|
|
14
|
+
default: balanced
|
|
15
|
+
budget_mode:
|
|
16
|
+
type: string
|
|
17
|
+
description: Budget preference (lowest, balanced, quality)
|
|
18
|
+
default: balanced
|
|
19
|
+
output:
|
|
20
|
+
selected_gateway: string
|
|
21
|
+
selected_provider: string
|
|
22
|
+
selected_model: string
|
|
23
|
+
confidence: number
|
|
24
|
+
estimated_cost: number
|
|
25
|
+
fallback_chain: array
|
|
26
|
+
explanation: array
|
|
27
|
+
|
|
28
|
+
- name: mozart.estimate_cost
|
|
29
|
+
description: Estimate cost and tokens for a task before execution
|
|
30
|
+
input:
|
|
31
|
+
task:
|
|
32
|
+
type: string
|
|
33
|
+
description: Task description
|
|
34
|
+
required: true
|
|
35
|
+
context:
|
|
36
|
+
type: string
|
|
37
|
+
description: Context to include
|
|
38
|
+
output:
|
|
39
|
+
estimated_input_tokens: number
|
|
40
|
+
estimated_output_tokens: number
|
|
41
|
+
estimated_cost: number
|
|
42
|
+
currency: string
|
|
43
|
+
|
|
44
|
+
- name: mozart.compress_context
|
|
45
|
+
description: Optimize context to reduce token usage
|
|
46
|
+
input:
|
|
47
|
+
content:
|
|
48
|
+
type: string
|
|
49
|
+
description: Content to compress
|
|
50
|
+
required: true
|
|
51
|
+
max_tokens:
|
|
52
|
+
type: number
|
|
53
|
+
description: Maximum tokens
|
|
54
|
+
output:
|
|
55
|
+
strategy: string
|
|
56
|
+
original_tokens: number
|
|
57
|
+
compressed_tokens: number
|
|
58
|
+
compression_ratio: number
|
|
59
|
+
|
|
60
|
+
- name: mozart.privacy_check
|
|
61
|
+
description: Scan content for secrets before sending to models
|
|
62
|
+
input:
|
|
63
|
+
content:
|
|
64
|
+
type: string
|
|
65
|
+
description: Content to scan
|
|
66
|
+
required: true
|
|
67
|
+
output:
|
|
68
|
+
allowed: boolean
|
|
69
|
+
findings: array
|
|
70
|
+
action: string
|
|
71
|
+
redacted_content: string
|
|
72
|
+
|
|
73
|
+
- name: mozart.inventory
|
|
74
|
+
description: Return current inventory of detected gateways, providers, and models
|
|
75
|
+
|
|
76
|
+
# Integration instructions
|
|
77
|
+
# 1. Install: npm install mozart-router
|
|
78
|
+
# 2. Import in OpenClaw: import { Mozart } from 'mozart-router'
|
|
79
|
+
# 3. Initialize: const mozart = new Mozart()
|
|
80
|
+
# 4. Call skills: const route = await mozart.recommend(task)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# OpenCode + Mozart
|
|
2
|
+
|
|
3
|
+
This directory contains the Mozart skill manifest for OpenCode.
|
|
4
|
+
|
|
5
|
+
## Files
|
|
6
|
+
|
|
7
|
+
- `mozart-skill.json` — Skill definition for OpenCode
|
|
8
|
+
|
|
9
|
+
## Integration
|
|
10
|
+
|
|
11
|
+
1. Install Mozart:
|
|
12
|
+
```bash
|
|
13
|
+
npm install mozart-router
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
2. Copy the skill manifest to your OpenCode skills directory
|
|
17
|
+
|
|
18
|
+
3. Import and use in your agent code:
|
|
19
|
+
```typescript
|
|
20
|
+
import { Mozart } from 'mozart-router';
|
|
21
|
+
|
|
22
|
+
const mozart = new Mozart();
|
|
23
|
+
const route = await mozart.recommend('refactor the auth module');
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Status
|
|
27
|
+
|
|
28
|
+
OpenCode integration is a real detection adapter. Mozart detects OpenCode installation via environment variables and data directory. For full model routing, use Mozart alongside your existing OpenCode provider configuration.
|
|
29
|
+
|
|
30
|
+
This integration is community-maintained and is not officially affiliated with OpenCode.
|