adaptive-memory-multi-model-router 2.2.6 → 2.2.7
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 +132 -94
- package/assets/benchmark-results.png +0 -0
- package/assets/complexity-scoring-v2.png +0 -0
- package/assets/complexity-scoring.png +0 -0
- package/assets/cost-comparison-chart.png +0 -0
- package/assets/cost-comparison-v2.png +0 -0
- package/assets/feature-comparison-v2.png +0 -0
- package/assets/feature-comparison-v3.png +0 -0
- package/assets/provider-health-chart.png +0 -0
- package/assets/provider-health-v2.png +0 -0
- package/assets/routing-flow-v2.png +0 -0
- package/assets/routing-flow-v3.png +0 -0
- package/assets/routing-flow.png +0 -0
- package/assets/tier-distribution.png +0 -0
- package/benchmark-results.json +620 -46
- package/dist/analytics/costAnalytics.d.ts +0 -1
- package/dist/cache/semanticCache.d.ts +0 -41
- package/dist/cache/semanticCache.d.ts.map +1 -1
- package/dist/cache/semanticCache.js +0 -142
- package/dist/cache/semanticCache.js.map +1 -1
- package/dist/cli.js +478 -35
- package/dist/cost/costTracker.js +3 -0
- package/dist/index.d.ts +0 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +64 -264
- package/dist/index.js.map +1 -1
- package/dist/integrations/langchainAdapter.d.ts +0 -1
- package/dist/integrations/oauth.d.ts +0 -1
- package/dist/memory/autoFetch.d.ts +0 -1
- package/dist/memory/memoryTree.d.ts +0 -1
- package/dist/memory/obsidianVault.d.ts +0 -1
- package/dist/providers/providerConfig.d.ts +0 -1
- package/dist/providers/providerConfig.js +0 -2
- package/dist/providers/registry.js +128 -126
- package/dist/routing/advancedRouter.js +427 -310
- package/dist/sdk.js +100 -109
- package/dist/security/guardrails.d.ts +0 -1
- package/dist/server/dashboard.d.ts +0 -1
- package/dist/server/modelMapper.d.ts +0 -1
- package/dist/server/proxyServer.d.ts +0 -1
- package/package.json +3 -325
- package/scripts/run-mmlu-benchmark.js +176 -0
- package/scripts/run-provider-benchmark.js +244 -0
- package/src/cache/semanticCache.ts +0 -148
- package/src/index.ts +99 -0
- package/test/provider-test.js +70 -91
- package/test.js +41 -67
- package/tsconfig.json +5 -15
package/dist/index.js
CHANGED
|
@@ -1,39 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* Parallel Multi-LLM Processing with Streaming, Caching, Cost Tracking, Reliability
|
|
6
|
-
* + Reference Architecture to Full TMLPD (Episodic Memory, MCTS, HALO)
|
|
7
|
-
*
|
|
8
|
-
* @example
|
|
9
|
-
* ```typescript
|
|
10
|
-
* import { createTMLPD, HALOOrchestrator, EpisodicMemoryStore } from "tmlpd-pi";
|
|
11
|
-
*
|
|
12
|
-
* // Lightweight usage (core features)
|
|
13
|
-
* const tmlpd = createTMLPD({ cache: { ttl_seconds: 3600 } });
|
|
14
|
-
* const result = await tmlpd.executeParallel(prompt, ["gpt-4o", "claude"]);
|
|
15
|
-
*
|
|
16
|
-
* // Advanced: HALO orchestration with episodic memory
|
|
17
|
-
* const halo = new HALOOrchestrator({ maxConcurrent: 3, enableMCTS: true });
|
|
18
|
-
* const haloResult = await halo.execute("Build a REST API", async (subtask, agent) => {
|
|
19
|
-
* // Execute via agent
|
|
20
|
-
* });
|
|
21
|
-
*
|
|
22
|
-
* // Query episodic memory
|
|
23
|
-
* const similar = memory.getSimilarTasks("Python async API", 5);
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
2
|
+
// A3M Router - Main Entry Point
|
|
3
|
+
// Version: 2.0.0
|
|
26
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Object.defineProperty(exports, "
|
|
35
|
-
|
|
36
|
-
|
|
5
|
+
exports.createProxyServer = exports.CostAnalytics = exports.GuardrailEngine = exports.SemanticCache = exports.MODEL_COSTS = exports.estimateTokens = exports.countTokens = exports.MemoryTree = exports.CostTracker = exports.saveConfig = exports.loadConfig = exports.findFastestAvailableProvider = exports.findCheapestAvailableProvider = exports.checkAllProviders = exports.healthCheck = exports.updateProvider = exports.deregisterProvider = exports.registerProvider = exports.getAvailableProviders = exports.DEFAULT_PROVIDERS = exports.getProviderHealth = exports.updateModelProfile = exports.MODEL_PROFILES = exports.extractQueryFeatures = exports.recommendForTask = exports.routeBatch = exports.routeQuery = void 0;
|
|
6
|
+
exports.createA3MRouter = createA3MRouter;
|
|
7
|
+
// ============================================================
|
|
8
|
+
// ROUTING ENGINE
|
|
9
|
+
// ============================================================
|
|
10
|
+
var advancedRouter_1 = require("./routing/advancedRouter");
|
|
11
|
+
Object.defineProperty(exports, "routeQuery", { enumerable: true, get: function () { return advancedRouter_1.routeQuery; } });
|
|
12
|
+
Object.defineProperty(exports, "routeBatch", { enumerable: true, get: function () { return advancedRouter_1.routeBatch; } });
|
|
13
|
+
Object.defineProperty(exports, "recommendForTask", { enumerable: true, get: function () { return advancedRouter_1.recommendForTask; } });
|
|
14
|
+
Object.defineProperty(exports, "extractQueryFeatures", { enumerable: true, get: function () { return advancedRouter_1.extractQueryFeatures; } });
|
|
15
|
+
Object.defineProperty(exports, "MODEL_PROFILES", { enumerable: true, get: function () { return advancedRouter_1.MODEL_PROFILES; } });
|
|
16
|
+
Object.defineProperty(exports, "updateModelProfile", { enumerable: true, get: function () { return advancedRouter_1.updateModelProfile; } });
|
|
17
|
+
Object.defineProperty(exports, "getProviderHealth", { enumerable: true, get: function () { return advancedRouter_1.getProviderHealth; } });
|
|
18
|
+
// ============================================================
|
|
19
|
+
// PROVIDERS
|
|
20
|
+
// ============================================================
|
|
21
|
+
var providerConfig_1 = require("./providers/providerConfig");
|
|
37
22
|
Object.defineProperty(exports, "DEFAULT_PROVIDERS", { enumerable: true, get: function () { return providerConfig_1.DEFAULT_PROVIDERS; } });
|
|
38
23
|
Object.defineProperty(exports, "getAvailableProviders", { enumerable: true, get: function () { return providerConfig_1.getAvailableProviders; } });
|
|
39
24
|
Object.defineProperty(exports, "registerProvider", { enumerable: true, get: function () { return providerConfig_1.registerProvider; } });
|
|
@@ -45,241 +30,56 @@ Object.defineProperty(exports, "findCheapestAvailableProvider", { enumerable: tr
|
|
|
45
30
|
Object.defineProperty(exports, "findFastestAvailableProvider", { enumerable: true, get: function () { return providerConfig_1.findFastestAvailableProvider; } });
|
|
46
31
|
Object.defineProperty(exports, "loadConfig", { enumerable: true, get: function () { return providerConfig_1.loadConfig; } });
|
|
47
32
|
Object.defineProperty(exports, "saveConfig", { enumerable: true, get: function () { return providerConfig_1.saveConfig; } });
|
|
48
|
-
Object.defineProperty(exports, "providerConfig", { enumerable: true, get: function () { return providerConfig_1; } });
|
|
49
|
-
|
|
50
|
-
Object.defineProperty(exports, "ProviderRegistry", { enumerable: true, get: function () { return registry_1.ProviderRegistry; } });
|
|
51
|
-
const reliability_1 = require("./utils/reliability");
|
|
52
|
-
Object.defineProperty(exports, "CircuitBreaker", { enumerable: true, get: function () { return reliability_1.CircuitBreaker; } });
|
|
53
|
-
Object.defineProperty(exports, "withRetry", { enumerable: true, get: function () { return reliability_1.withRetry; } });
|
|
54
|
-
Object.defineProperty(exports, "calculateRetryDelay", { enumerable: true, get: function () { return reliability_1.calculateRetryDelay; } });
|
|
55
|
-
Object.defineProperty(exports, "isRetryableStatus", { enumerable: true, get: function () { return reliability_1.isRetryableStatus; } });
|
|
56
|
-
Object.defineProperty(exports, "DEFAULT_RETRY_CONFIG", { enumerable: true, get: function () { return reliability_1.DEFAULT_RETRY_CONFIG; } });
|
|
57
|
-
const episodicMemory_1 = require("./memory/episodicMemory");
|
|
58
|
-
Object.defineProperty(exports, "EpisodicMemoryStore", { enumerable: true, get: function () { return episodicMemory_1.EpisodicMemoryStore; } });
|
|
59
|
-
const mctsWorkflow_1 = require("./orchestration/mctsWorkflow");
|
|
60
|
-
Object.defineProperty(exports, "MCTSWorkflowOptimizer", { enumerable: true, get: function () { return mctsWorkflow_1.MCTSWorkflowOptimizer; } });
|
|
61
|
-
const haloOrchestrator_1 = require("./orchestration/haloOrchestrator");
|
|
62
|
-
|
|
63
|
-
|
|
64
33
|
// ============================================================
|
|
65
|
-
//
|
|
34
|
+
// COST TRACKING
|
|
35
|
+
// ============================================================
|
|
36
|
+
var costTracker_1 = require("./cost/costTracker");
|
|
37
|
+
Object.defineProperty(exports, "CostTracker", { enumerable: true, get: function () { return costTracker_1.CostTracker; } });
|
|
38
|
+
// ============================================================
|
|
39
|
+
// MEMORY
|
|
40
|
+
// ============================================================
|
|
41
|
+
var memoryTree_1 = require("./memory/memoryTree");
|
|
42
|
+
Object.defineProperty(exports, "MemoryTree", { enumerable: true, get: function () { return memoryTree_1.MemoryTree; } });
|
|
43
|
+
// ============================================================
|
|
44
|
+
// UTILITIES
|
|
45
|
+
// ============================================================
|
|
46
|
+
var tokenUtils_1 = require("./utils/tokenUtils");
|
|
47
|
+
Object.defineProperty(exports, "countTokens", { enumerable: true, get: function () { return tokenUtils_1.countTokens; } });
|
|
48
|
+
Object.defineProperty(exports, "estimateTokens", { enumerable: true, get: function () { return tokenUtils_1.estimateTokens; } });
|
|
49
|
+
var tokenUtils_2 = require("./utils/tokenUtils");
|
|
50
|
+
Object.defineProperty(exports, "MODEL_COSTS", { enumerable: true, get: function () { return tokenUtils_2.MODEL_COSTS; } });
|
|
66
51
|
// ============================================================
|
|
52
|
+
// v2.0.0 FEATURES
|
|
53
|
+
// ============================================================
|
|
54
|
+
var semanticCache_1 = require("./cache/semanticCache");
|
|
55
|
+
Object.defineProperty(exports, "SemanticCache", { enumerable: true, get: function () { return semanticCache_1.SemanticCache; } });
|
|
56
|
+
var guardrails_1 = require("./security/guardrails");
|
|
57
|
+
Object.defineProperty(exports, "GuardrailEngine", { enumerable: true, get: function () { return guardrails_1.GuardrailEngine; } });
|
|
58
|
+
var costAnalytics_1 = require("./analytics/costAnalytics");
|
|
59
|
+
Object.defineProperty(exports, "CostAnalytics", { enumerable: true, get: function () { return costAnalytics_1.CostAnalytics; } });
|
|
60
|
+
var proxyServer_1 = require("./server/proxyServer");
|
|
61
|
+
Object.defineProperty(exports, "createProxyServer", { enumerable: true, get: function () { return proxyServer_1.createProxyServer; } });
|
|
62
|
+
// ============================================================
|
|
63
|
+
// CONVENIENCE: Create a router instance
|
|
64
|
+
// ============================================================
|
|
65
|
+
const advancedRouter_2 = require("./routing/advancedRouter");
|
|
66
|
+
const providerConfig_2 = require("./providers/providerConfig");
|
|
67
|
+
const costTracker_2 = require("./cost/costTracker");
|
|
68
|
+
const memoryTree_2 = require("./memory/memoryTree");
|
|
67
69
|
function createA3MRouter(options) {
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
const costTracker = new costTracker_1.CostTracker();
|
|
71
|
-
const provRegistry = new registry_1.ProviderRegistry();
|
|
72
|
-
|
|
70
|
+
const costTracker = new costTracker_2.CostTracker();
|
|
71
|
+
const memoryTree = new memoryTree_2.MemoryTree();
|
|
73
72
|
return {
|
|
74
|
-
route:
|
|
75
|
-
routeBatch:
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
costTracker
|
|
80
|
-
|
|
81
|
-
compression: { compress: function(s) { return s; }, decompress: function(s) { return s; } },
|
|
82
|
-
vault: { store: function() { return Promise.resolve(); }, retrieve: function() { return Promise.resolve(null); } },
|
|
83
|
-
autoFetch: true,
|
|
84
|
-
oauth: true,
|
|
73
|
+
route: advancedRouter_2.routeQuery,
|
|
74
|
+
routeBatch: advancedRouter_2.routeBatch,
|
|
75
|
+
recommendForTask: advancedRouter_2.recommendForTask,
|
|
76
|
+
getAvailableProviders: providerConfig_2.getAvailableProviders,
|
|
77
|
+
healthCheck: providerConfig_2.healthCheck,
|
|
78
|
+
costTracker,
|
|
79
|
+
memoryTree,
|
|
85
80
|
options: options || {},
|
|
86
81
|
};
|
|
87
82
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
Object.defineProperty(exports, "HALOOrchestrator", { enumerable: true, get: function () { return haloOrchestrator_1.HALOOrchestrator; } });
|
|
91
|
-
const tokenUtils_1 = require("./utils/tokenUtils");
|
|
92
|
-
Object.defineProperty(exports, "countTokens", { enumerable: true, get: function () { return tokenUtils_1.countTokens; } });
|
|
93
|
-
Object.defineProperty(exports, "estimateCost", { enumerable: true, get: function () { return tokenUtils_1.estimateCost; } });
|
|
94
|
-
Object.defineProperty(exports, "estimateCostFromText", { enumerable: true, get: function () { return tokenUtils_1.estimateCostFromText; } });
|
|
95
|
-
Object.defineProperty(exports, "getModelCost", { enumerable: true, get: function () { return tokenUtils_1.getModelCost; } });
|
|
96
|
-
Object.defineProperty(exports, "listModelsByCost", { enumerable: true, get: function () { return tokenUtils_1.listModelsByCost; } });
|
|
97
|
-
Object.defineProperty(exports, "findCheapestModels", { enumerable: true, get: function () { return tokenUtils_1.findCheapestModels; } });
|
|
98
|
-
Object.defineProperty(exports, "MODEL_COSTS", { enumerable: true, get: function () { return tokenUtils_1.MODEL_COSTS; } });
|
|
99
|
-
const compression_1 = require("./utils/compression");
|
|
100
|
-
Object.defineProperty(exports, "isonEncode", { enumerable: true, get: function () { return compression_1.isonEncode; } });
|
|
101
|
-
Object.defineProperty(exports, "isonDecode", { enumerable: true, get: function () { return compression_1.isonDecode; } });
|
|
102
|
-
Object.defineProperty(exports, "compressText", { enumerable: true, get: function () { return compression_1.compressText; } });
|
|
103
|
-
Object.defineProperty(exports, "truncateMessages", { enumerable: true, get: function () { return compression_1.truncateMessages; } });
|
|
104
|
-
Object.defineProperty(exports, "truncateToTokenBudget", { enumerable: true, get: function () { return compression_1.truncateToTokenBudget; } });
|
|
105
|
-
Object.defineProperty(exports, "calculateCompressionRatio", { enumerable: true, get: function () { return compression_1.calculateCompressionRatio; } });
|
|
106
|
-
const localProvider_1 = require("./providers/localProvider");
|
|
107
|
-
Object.defineProperty(exports, "LocalProvider", { enumerable: true, get: function () { return localProvider_1.LocalProvider; } });
|
|
108
|
-
Object.defineProperty(exports, "LocalProviderManager", { enumerable: true, get: function () { return localProvider_1.LocalProviderManager; } });
|
|
109
|
-
Object.defineProperty(exports, "createOllamaProvider", { enumerable: true, get: function () { return localProvider_1.createOllamaProvider; } });
|
|
110
|
-
Object.defineProperty(exports, "createVLLMProvider", { enumerable: true, get: function () { return localProvider_1.createVLLMProvider; } });
|
|
111
|
-
Object.defineProperty(exports, "createLMStudioProvider", { enumerable: true, get: function () { return localProvider_1.createLMStudioProvider; } });
|
|
112
|
-
const batchProcessor_1 = require("./utils/batchProcessor");
|
|
113
|
-
Object.defineProperty(exports, "BatchProcessor", { enumerable: true, get: function () { return batchProcessor_1.BatchProcessor; } });
|
|
114
|
-
Object.defineProperty(exports, "executeBatch", { enumerable: true, get: function () { return batchProcessor_1.executeBatch; } });
|
|
115
|
-
const advancedRouter_1 = require("./routing/advancedRouter");
|
|
116
|
-
Object.defineProperty(exports, "routeQuery", { enumerable: true, get: function () { return advancedRouter_1.routeQuery; } });
|
|
117
|
-
Object.defineProperty(exports, "routeBatch", { enumerable: true, get: function () { return advancedRouter_1.routeBatch; } });
|
|
118
|
-
Object.defineProperty(exports, "recommendForTask", { enumerable: true, get: function () { return advancedRouter_1.recommendForTask; } });
|
|
119
|
-
Object.defineProperty(exports, "extractQueryFeatures", { enumerable: true, get: function () { return advancedRouter_1.extractQueryFeatures; } });
|
|
120
|
-
Object.defineProperty(exports, "updateModelProfile", { enumerable: true, get: function () { return advancedRouter_1.updateModelProfile; } });
|
|
121
|
-
Object.defineProperty(exports, "MODEL_PROFILES", { enumerable: true, get: function () { return advancedRouter_1.MODEL_PROFILES; } });
|
|
122
|
-
const prefixCache_1 = require("./cache/prefixCache");
|
|
123
|
-
const memoryTree_1 = require("./memory/memoryTree");
|
|
124
|
-
const semanticCache_1 = require("./cache/semanticCache");
|
|
125
|
-
Object.defineProperty(exports, "PrefixCache", { enumerable: true, get: function () { return prefixCache_1.PrefixCache; } });
|
|
126
|
-
Object.defineProperty(exports, "MemoryTree", { enumerable: true, get: function () { return memoryTree_1.MemoryTree; } });
|
|
127
|
-
Object.defineProperty(exports, "SemanticCache", { enumerable: true, get: function () { return semanticCache_1.SemanticCache; } });
|
|
128
|
-
Object.defineProperty(exports, "createWarmedCache", { enumerable: true, get: function () { return prefixCache_1.createWarmedCache; } });
|
|
129
|
-
const speculativeDecoding_1 = require("./utils/speculativeDecoding");
|
|
130
|
-
Object.defineProperty(exports, "SpeculativeDecoder", { enumerable: true, get: function () { return speculativeDecoding_1.SpeculativeDecoder; } });
|
|
131
|
-
Object.defineProperty(exports, "speculativeBatch", { enumerable: true, get: function () { return speculativeDecoding_1.speculativeBatch; } });
|
|
132
|
-
Object.defineProperty(exports, "estimateSpeedupPotential", { enumerable: true, get: function () { return speculativeDecoding_1.estimateSpeedupPotential; } });
|
|
133
|
-
Object.defineProperty(exports, "MedusaPredictor", { enumerable: true, get: function () { return speculativeDecoding_1.MedusaPredictor; } });
|
|
134
|
-
Object.defineProperty(exports, "EagleSpeculative", { enumerable: true, get: function () { return speculativeDecoding_1.EagleSpeculative; } });
|
|
135
|
-
// PI Tool definitions (for PI agent integration)
|
|
136
|
-
exports.TMLPD_PI_TOOLS = [
|
|
137
|
-
{
|
|
138
|
-
name: "tmlpd_execute",
|
|
139
|
-
description: "Execute prompt across multiple LLM providers in parallel. Optimizes for cost-quality tradeoff with automatic model selection. Use when comparing multiple AI responses or needing faster results via parallel execution.",
|
|
140
|
-
inputSchema: {
|
|
141
|
-
type: "object",
|
|
142
|
-
properties: {
|
|
143
|
-
prompt: { type: "string", description: "The prompt to execute" },
|
|
144
|
-
models: { type: "array", items: { type: "string" }, description: "Optional model list (auto-selects if omitted)" },
|
|
145
|
-
streaming: { type: "object", properties: { enabled: { type: "boolean" }, chunk_size: { type: "number" } } }
|
|
146
|
-
},
|
|
147
|
-
required: ["prompt"]
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
name: "tmlpd_execute_single",
|
|
152
|
-
description: "Execute with single model via smart routing. Analyzes prompt to select optimal agent based on task type (coding, explanation, analysis, etc.) with cost-quality optimization.",
|
|
153
|
-
inputSchema: {
|
|
154
|
-
type: "object",
|
|
155
|
-
properties: {
|
|
156
|
-
prompt: { type: "string", description: "The prompt to execute" },
|
|
157
|
-
model: { type: "string", description: "Optional specific model" }
|
|
158
|
-
},
|
|
159
|
-
required: ["prompt"]
|
|
160
|
-
}
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
name: "tmlpd_cost_summary",
|
|
164
|
-
description: "Get real-time cost tracking summary. Shows spending by provider, model, daily/monthly breakdowns, and remaining budget. Essential for cost monitoring in production.",
|
|
165
|
-
inputSchema: { type: "object", properties: {} }
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
name: "tmlpd_cache_stats",
|
|
169
|
-
description: "Get response cache statistics. Shows hit rate, cache size, and effectiveness. Cache hits cost $0 and provide instant responses.",
|
|
170
|
-
inputSchema: { type: "object", properties: {} }
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
name: "tmlpd_provider_status",
|
|
174
|
-
description: "Get status of all configured LLM providers. Shows readiness, cooldown status, failure counts. Use for debugging or selecting specific providers.",
|
|
175
|
-
inputSchema: { type: "object", properties: {} }
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
name: "tmlpd_invalidate_cache",
|
|
179
|
-
description: "Invalidate cached responses. Use when prompt content has changed and fresh response needed, or to clear stale cache entries.",
|
|
180
|
-
inputSchema: {
|
|
181
|
-
type: "object",
|
|
182
|
-
properties: { model: { type: "string", description: "Optional model to invalidate (all if omitted)" } }
|
|
183
|
-
}
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
name: "tmlpd_get_budget",
|
|
187
|
-
description: "Get remaining budget for cost controls. Returns daily, monthly, and per-model limits. Use for budget enforcement and alerting.",
|
|
188
|
-
inputSchema: { type: "object", properties: {} }
|
|
189
|
-
},
|
|
190
|
-
{
|
|
191
|
-
name: "tmlpd_halo_execute",
|
|
192
|
-
description: "Execute via HALO (Hierarchical Autonomous Logic-Oriented) orchestrator with 3-tier planning: decompose → assign → execute. Includes episodic memory for learning from past executions. For complex multi-step tasks.",
|
|
193
|
-
inputSchema: {
|
|
194
|
-
type: "object",
|
|
195
|
-
properties: {
|
|
196
|
-
task_description: { type: "string", description: "Task to execute" },
|
|
197
|
-
max_concurrent: { type: "number", description: "Max parallel executions (default: 3)" },
|
|
198
|
-
enable_mcts: { type: "boolean", description: "Enable MCTS optimization (slower but better)" }
|
|
199
|
-
},
|
|
200
|
-
required: ["task_description"]
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
{
|
|
204
|
-
name: "tmlpd_episodic_query",
|
|
205
|
-
description: "Query episodic memory for similar past tasks. Useful for learning from past executions and improving future routing decisions.",
|
|
206
|
-
inputSchema: {
|
|
207
|
-
type: "object",
|
|
208
|
-
properties: {
|
|
209
|
-
task_description: { type: "string", description: "Task to find similar executions for" },
|
|
210
|
-
limit: { type: "number", description: "Max results (default: 5)" }
|
|
211
|
-
},
|
|
212
|
-
required: ["task_description"]
|
|
213
|
-
}
|
|
214
|
-
},
|
|
215
|
-
{
|
|
216
|
-
name: "tmlpd_count_tokens",
|
|
217
|
-
description: "Count tokens in text for cost estimation. Supports all major models (GPT-4, Claude, Gemini, Llama). Use for estimating costs before execution or calculating context window usage.",
|
|
218
|
-
inputSchema: {
|
|
219
|
-
type: "object",
|
|
220
|
-
properties: {
|
|
221
|
-
text: { type: "string", description: "Text to count tokens in" },
|
|
222
|
-
model: { type: "string", description: "Model for tokenization (default: gpt-4o)" }
|
|
223
|
-
},
|
|
224
|
-
required: ["text"]
|
|
225
|
-
}
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
name: "tmlpd_compress_context",
|
|
229
|
-
description: "Compress context/messages using ISON encoding for token reduction. Reduces context by ~20-40% while preserving meaning. Useful for fitting more content in context windows.",
|
|
230
|
-
inputSchema: {
|
|
231
|
-
type: "object",
|
|
232
|
-
properties: {
|
|
233
|
-
messages: { type: "array", description: "Messages to compress", items: { type: "object" } },
|
|
234
|
-
strategy: { type: "string", enum: ["smart", "first", "last"], description: "Compression strategy (default: smart)" },
|
|
235
|
-
max_tokens: { type: "number", description: "Target token budget" }
|
|
236
|
-
},
|
|
237
|
-
required: ["messages"]
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
name: "tmlpd_local_generate",
|
|
242
|
-
description: "Generate using local LLM runtime (Ollama, vLLM, LM Studio). Zero cost, privacy-preserving. Use for development, testing, or when local GPU available. Falls back to cloud if local unavailable.",
|
|
243
|
-
inputSchema: {
|
|
244
|
-
type: "object",
|
|
245
|
-
properties: {
|
|
246
|
-
prompt: { type: "string", description: "Prompt for generation" },
|
|
247
|
-
runtime: { type: "string", enum: ["ollama", "vllm", "lmstudio"], description: "Local runtime type" },
|
|
248
|
-
model: { type: "string", description: "Model name (default: llama-3.3-70b)" }
|
|
249
|
-
},
|
|
250
|
-
required: ["prompt", "runtime"]
|
|
251
|
-
}
|
|
252
|
-
},
|
|
253
|
-
{
|
|
254
|
-
name: "tmlpd_batch_execute",
|
|
255
|
-
description: "Execute batch of prompts with concurrency control. Supports priority queuing, progress callbacks, rate limiting. Use for processing multiple prompts efficiently.",
|
|
256
|
-
inputSchema: {
|
|
257
|
-
type: "object",
|
|
258
|
-
properties: {
|
|
259
|
-
prompts: { type: "array", items: { type: "string" }, description: "Prompts to execute" },
|
|
260
|
-
concurrency: { type: "number", description: "Max parallel executions (default: 5)" },
|
|
261
|
-
model: { type: "string", description: "Model to use (default: gpt-4o)" }
|
|
262
|
-
},
|
|
263
|
-
required: ["prompts"]
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
];
|
|
267
|
-
/**
|
|
268
|
-
* Reference to Full TMLPD
|
|
269
|
-
*
|
|
270
|
-
* This package provides:
|
|
271
|
-
* - Core: streaming, caching, cost tracking, reliability
|
|
272
|
-
* - Reference: episodic memory, MCTS, HALO orchestrator
|
|
273
|
-
*
|
|
274
|
-
* For production with full features:
|
|
275
|
-
* - Python TMLPD: https://github.com/Das-rebel/tmlpd-skill
|
|
276
|
-
* - Full memory: 3-tier (episodic + semantic + working)
|
|
277
|
-
* - Full MCTS: UCB1, deterministic rollouts, strategy caching
|
|
278
|
-
* - Full HALO: NLP decomposition, capability matching, verification
|
|
279
|
-
*/
|
|
280
|
-
exports.default = {
|
|
281
|
-
createTMLPD: tmlpdTools_1.createTMLPD,
|
|
282
|
-
TMLPDTools: tmlpdTools_1.TMLPDTools,
|
|
283
|
-
TMLPD_PI_TOOLS: exports.TMLPD_PI_TOOLS
|
|
284
|
-
};
|
|
83
|
+
// Default export
|
|
84
|
+
exports.default = createA3MRouter;
|
|
285
85
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,gCAAgC;AAChC,iBAAiB;;;AAgFjB,0CAcC;AA5FD,+DAA+D;AAC/D,iBAAiB;AACjB,+DAA+D;AAC/D,2DAQkC;AAPhC,4GAAA,UAAU,OAAA;AACV,4GAAA,UAAU,OAAA;AACV,kHAAA,gBAAgB,OAAA;AAChB,sHAAA,oBAAoB,OAAA;AACpB,gHAAA,cAAc,OAAA;AACd,oHAAA,kBAAkB,OAAA;AAClB,mHAAA,iBAAiB,OAAA;AAGnB,+DAA+D;AAC/D,YAAY;AACZ,+DAA+D;AAC/D,6DAYoC;AAXlC,mHAAA,iBAAiB,OAAA;AACjB,uHAAA,qBAAqB,OAAA;AACrB,kHAAA,gBAAgB,OAAA;AAChB,oHAAA,kBAAkB,OAAA;AAClB,gHAAA,cAAc,OAAA;AACd,6GAAA,WAAW,OAAA;AACX,mHAAA,iBAAiB,OAAA;AACjB,+HAAA,6BAA6B,OAAA;AAC7B,8HAAA,4BAA4B,OAAA;AAC5B,4GAAA,UAAU,OAAA;AACV,4GAAA,UAAU,OAAA;AAWZ,+DAA+D;AAC/D,gBAAgB;AAChB,+DAA+D;AAC/D,kDAAiD;AAAxC,0GAAA,WAAW,OAAA;AAEpB,+DAA+D;AAC/D,SAAS;AACT,+DAA+D;AAC/D,kDAAiD;AAAxC,wGAAA,UAAU,OAAA;AAGnB,+DAA+D;AAC/D,YAAY;AACZ,+DAA+D;AAC/D,iDAAiE;AAAxD,yGAAA,WAAW,OAAA;AAAE,4GAAA,cAAc,OAAA;AACpC,iDAAiD;AAAxC,yGAAA,WAAW,OAAA;AAEpB,+DAA+D;AAC/D,kBAAkB;AAClB,+DAA+D;AAC/D,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AACtB,oDAAwD;AAA/C,6GAAA,eAAe,OAAA;AACxB,2DAA0D;AAAjD,8GAAA,aAAa,OAAA;AACtB,oDAAyD;AAAhD,gHAAA,iBAAiB,OAAA;AAE1B,+DAA+D;AAC/D,wCAAwC;AACxC,+DAA+D;AAC/D,6DAAoF;AACpF,+DAAgF;AAChF,oDAAiD;AACjD,oDAAiD;AASjD,SAAgB,eAAe,CAAC,OAA0B;IACxD,MAAM,WAAW,GAAG,IAAI,yBAAW,EAAE,CAAC;IACtC,MAAM,UAAU,GAAG,IAAI,uBAAU,EAAE,CAAC;IAEpC,OAAO;QACL,KAAK,EAAE,2BAAU;QACjB,UAAU,EAAV,2BAAU;QACV,gBAAgB,EAAhB,iCAAgB;QAChB,qBAAqB,EAArB,sCAAqB;QACrB,WAAW,EAAX,4BAAW;QACX,WAAW;QACX,UAAU;QACV,OAAO,EAAE,OAAO,IAAI,EAAE;KACvB,CAAC;AACJ,CAAC;AAED,iBAAiB;AACjB,kBAAe,eAAe,CAAC"}
|
|
@@ -144,4 +144,3 @@ export declare function createA3MChatModel(provider: string, options?: Omit<A3MC
|
|
|
144
144
|
* Create an A3MChatModel with automatic routing
|
|
145
145
|
*/
|
|
146
146
|
export declare function createAutoRoutingChatModel(options?: Omit<A3MChatModelOptions, 'modelName'>): A3MChatModel;
|
|
147
|
-
//# sourceMappingURL=langchainAdapter.d.ts.map
|
|
@@ -47,4 +47,3 @@ export declare function checkAllProviders(): Promise<Record<string, any>>;
|
|
|
47
47
|
export declare function findCheapestAvailableProvider(model?: string): ProviderDefinition | null;
|
|
48
48
|
export declare function findFastestAvailableProvider(): ProviderDefinition | null;
|
|
49
49
|
export declare function saveConfig(configPath?: string): string;
|
|
50
|
-
//# sourceMappingURL=providerConfig.d.ts.map
|
|
@@ -54,8 +54,6 @@ exports.checkAllProviders = checkAllProviders;
|
|
|
54
54
|
exports.findCheapestAvailableProvider = findCheapestAvailableProvider;
|
|
55
55
|
exports.findFastestAvailableProvider = findFastestAvailableProvider;
|
|
56
56
|
exports.saveConfig = saveConfig;
|
|
57
|
-
Object.defineProperty(exports, '_registeredProviders', { get: () => _registeredProviders });
|
|
58
|
-
Object.defineProperty(exports, '_providers', { get: () => _registeredProviders });
|
|
59
57
|
const fs = __importStar(require("fs"));
|
|
60
58
|
const path = __importStar(require("path"));
|
|
61
59
|
// ============================================================
|