adaptive-memory-multi-model-router 1.9.4 → 2.0.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.
Files changed (130) hide show
  1. package/.github/ISSUE_TEMPLATE/bug_report.md +50 -0
  2. package/.github/ISSUE_TEMPLATE/config.yml +11 -0
  3. package/.github/ISSUE_TEMPLATE/feature_request.md +37 -0
  4. package/.github/PULL_REQUEST_TEMPLATE.md +44 -0
  5. package/.github/workflows/npm-stats-validation.yml +152 -0
  6. package/.github/workflows/pages.yml +37 -0
  7. package/CHANGELOG.md +122 -0
  8. package/CODE_OF_CONDUCT.md +128 -0
  9. package/CONTRIBUTING.md +110 -0
  10. package/LAUNCH-PAIN-DRIVEN.md +339 -0
  11. package/LAUNCH.md +575 -0
  12. package/POPULARITY_BOOSTERS.md +285 -0
  13. package/README.md +231 -300
  14. package/SECURITY.md +69 -0
  15. package/articles/CONTENT_STRUCTURE.md +292 -0
  16. package/articles/DEVTO_COST_GUIDE.md +473 -0
  17. package/articles/DEVTO_FINAL.md +416 -0
  18. package/articles/DEVTO_MULTI_PROVIDER.md +542 -0
  19. package/articles/HN_10X_BETTER.md +430 -0
  20. package/articles/HN_CHINESE_STYLE.md +308 -0
  21. package/articles/HN_FINAL.md +199 -0
  22. package/articles/HN_POSTED_VERSION.md +56 -0
  23. package/articles/HN_RESEARCH.md +364 -0
  24. package/articles/PAIN-DRIVEN-devto-v2.md +308 -0
  25. package/articles/PAIN-DRIVEN-devto-v3.md +268 -0
  26. package/articles/PAIN-DRIVEN-devto.md +242 -0
  27. package/articles/PAIN-DRIVEN-hackernews-v2.md +138 -0
  28. package/articles/PAIN-DRIVEN-hackernews-v3.md +151 -0
  29. package/articles/PAIN-DRIVEN-hackernews.md +131 -0
  30. package/articles/PAIN-DRIVEN-reddit-v2.md +301 -0
  31. package/articles/PAIN-DRIVEN-reddit-v3.md +236 -0
  32. package/articles/PAIN-DRIVEN-reddit.md +218 -0
  33. package/articles/PAIN-DRIVEN-twitter-v2.md +110 -0
  34. package/articles/PAIN-DRIVEN-twitter-v3.md +121 -0
  35. package/articles/PAIN-DRIVEN-twitter.md +120 -0
  36. package/articles/PORTKEY_VS_A3M.md +147 -0
  37. package/articles/REDDIT_FINAL.md +232 -0
  38. package/articles/TWITTER_FINAL.md +167 -0
  39. package/articles/WHY_10X_BETTER.md +261 -0
  40. package/articles/WHY_CHINESE_STYLE_BETTER.md +323 -0
  41. package/articles/ai-discoverability-llm-routing.md +210 -0
  42. package/articles/devto-llm-routing.md +109 -0
  43. package/articles/hackernews-show-hn.md +65 -0
  44. package/articles/hashnode-llm-cost-optimization.md +125 -0
  45. package/articles/medium-building-llm-router.md +205 -0
  46. package/articles/reddit-ml.md +86 -0
  47. package/articles/twitter-thread-cost-savings.md +98 -0
  48. package/articles/youtube-tutorial-script.md +262 -0
  49. package/assets/banner.svg +109 -0
  50. package/assets/logo.svg +68 -0
  51. package/assets/social-preview.svg +64 -0
  52. package/demo/demo-script.md +53 -0
  53. package/dist/analytics/costAnalytics.d.ts +77 -0
  54. package/dist/analytics/costAnalytics.d.ts.map +1 -0
  55. package/dist/analytics/costAnalytics.js +219 -0
  56. package/dist/analytics/costAnalytics.js.map +1 -0
  57. package/dist/cache/semanticCache.d.ts +62 -0
  58. package/dist/cache/semanticCache.d.ts.map +1 -0
  59. package/dist/cache/semanticCache.js +176 -0
  60. package/dist/cache/semanticCache.js.map +1 -0
  61. package/dist/cli.js +35 -0
  62. package/dist/geo/generativeEngineOptimization.js +321 -0
  63. package/dist/geo/geoRouter.js +387 -0
  64. package/dist/index.d.ts +4 -723
  65. package/dist/index.js +11 -344
  66. package/dist/index.js.map +1 -1
  67. package/dist/integrations/langchainAdapter.d.ts +146 -0
  68. package/dist/integrations/langchainAdapter.d.ts.map +1 -0
  69. package/dist/integrations/langchainAdapter.js +731 -0
  70. package/dist/integrations/langchainAdapter.js.map +1 -0
  71. package/dist/integrations/oauth.d.ts +69 -0
  72. package/dist/integrations/oauth.d.ts.map +1 -0
  73. package/dist/integrations/oauth.js +225 -21
  74. package/dist/integrations/oauth.js.map +1 -0
  75. package/dist/memory/autoFetch.d.ts +39 -0
  76. package/dist/memory/autoFetch.d.ts.map +1 -0
  77. package/dist/memory/autoFetch.js +80 -88
  78. package/dist/memory/autoFetch.js.map +1 -0
  79. package/dist/memory/memoryTree.d.ts +76 -0
  80. package/dist/memory/memoryTree.d.ts.map +1 -0
  81. package/dist/memory/memoryTree.js +185 -130
  82. package/dist/memory/memoryTree.js.map +1 -0
  83. package/dist/memory/obsidianVault.d.ts +71 -0
  84. package/dist/memory/obsidianVault.d.ts.map +1 -0
  85. package/dist/memory/obsidianVault.js +207 -22
  86. package/dist/memory/obsidianVault.js.map +1 -0
  87. package/dist/providers/providerConfig.d.ts +49 -0
  88. package/dist/providers/providerConfig.d.ts.map +1 -0
  89. package/dist/providers/providerConfig.js +806 -401
  90. package/dist/providers/providerConfig.js.map +1 -0
  91. package/dist/security/guardrails.d.ts +76 -0
  92. package/dist/security/guardrails.d.ts.map +1 -0
  93. package/dist/security/guardrails.js +479 -0
  94. package/dist/security/guardrails.js.map +1 -0
  95. package/dist/security/inputValidation.js +351 -0
  96. package/dist/server/dashboard.d.ts +58 -0
  97. package/dist/server/dashboard.d.ts.map +1 -0
  98. package/dist/server/dashboard.js +553 -0
  99. package/dist/server/dashboard.js.map +1 -0
  100. package/dist/server/modelMapper.d.ts +43 -0
  101. package/dist/server/modelMapper.d.ts.map +1 -0
  102. package/dist/server/modelMapper.js +154 -0
  103. package/dist/server/modelMapper.js.map +1 -0
  104. package/dist/server/proxyServer.d.ts +41 -0
  105. package/dist/server/proxyServer.d.ts.map +1 -0
  106. package/dist/server/proxyServer.js +932 -0
  107. package/dist/server/proxyServer.js.map +1 -0
  108. package/dist/skills/__tests__/skill_manager.test.d.ts +2 -0
  109. package/dist/skills/__tests__/skill_manager.test.d.ts.map +1 -0
  110. package/dist/skills/__tests__/skill_manager.test.js +268 -0
  111. package/dist/skills/__tests__/skill_manager.test.js.map +1 -0
  112. package/docs/geo/GENERATIVE_ENGINE_OPTIMIZATION.md +232 -0
  113. package/docs-site/index.html +347 -0
  114. package/llms.txt +138 -0
  115. package/package.json +72 -7
  116. package/playground/README.md +51 -0
  117. package/playground/codesandbox.json +12 -0
  118. package/playground/index.js +39 -0
  119. package/scripts/update-npm-badges.js +158 -0
  120. package/src/analytics/costAnalytics.ts +304 -0
  121. package/src/cache/semanticCache.ts +221 -0
  122. package/src/index.ts +6 -0
  123. package/src/integrations/langchainAdapter.ts +955 -0
  124. package/src/providers/providerConfig.ts +923 -0
  125. package/src/security/guardrails.ts +585 -0
  126. package/src/server/dashboard.ts +610 -0
  127. package/src/server/modelMapper.ts +182 -0
  128. package/src/server/proxyServer.ts +1105 -0
  129. package/src/types/langchain.d.ts +83 -0
  130. package/tsconfig.build.json +20 -0
package/dist/index.js CHANGED
@@ -1,346 +1,13 @@
1
1
  "use strict";
2
- /**
3
- * A3M Router - Adaptive Memory Multi-Model Router v1.7.1
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
- */
26
2
  Object.defineProperty(exports, "__esModule", { value: true });
27
- exports.TMLPD_PI_TOOLS = exports.EagleSpeculative = exports.MedusaPredictor = exports.estimateSpeedupPotential = exports.speculativeBatch = exports.SpeculativeDecoder = exports.createWarmedCache = exports.PrefixCache = exports.MODEL_PROFILES = exports.updateModelProfile = exports.extractQueryFeatures = exports.recommendForTask = exports.routeBatch = exports.routeQuery = exports.executeBatch = exports.BatchProcessor = exports.createLMStudioProvider = exports.createVLLMProvider = exports.createOllamaProvider = exports.LocalProviderManager = exports.LocalProvider = exports.calculateCompressionRatio = exports.truncateToTokenBudget = exports.truncateMessages = exports.compressText = exports.isonDecode = exports.isonEncode = exports.MODEL_COSTS = exports.findCheapestModels = exports.listModelsByCost = exports.getModelCost = exports.estimateCostFromText = exports.estimateCost = exports.countTokens = exports.HALOOrchestrator = exports.MCTSWorkflowOptimizer = exports.EpisodicMemoryStore = exports.DEFAULT_RETRY_CONFIG = exports.isRetryableStatus = exports.calculateRetryDelay = exports.withRetry = exports.CircuitBreaker = exports.ProviderRegistry = exports.CostTracker = exports.ResponseCache = exports.TMLPDTools = exports.createTMLPD = void 0;
28
- const tmlpdTools_1 = require("./tools/tmlpdTools");
29
- Object.defineProperty(exports, "createTMLPD", { enumerable: true, get: function () { return tmlpdTools_1.createTMLPD; } });
30
- Object.defineProperty(exports, "TMLPDTools", { enumerable: true, get: function () { return tmlpdTools_1.TMLPDTools; } });
31
- const responseCache_1 = require("./cache/responseCache");
32
- Object.defineProperty(exports, "ResponseCache", { enumerable: true, get: function () { return responseCache_1.ResponseCache; } });
33
- const costTracker_1 = require("./cost/costTracker");
34
- Object.defineProperty(exports, "CostTracker", { enumerable: true, get: function () { return costTracker_1.CostTracker; } });
35
- const registry_1 = require("./providers/registry");
36
- Object.defineProperty(exports, "ProviderRegistry", { enumerable: true, get: function () { return registry_1.ProviderRegistry; } });
37
- const providerConfig_1 = require("./providers/providerConfig");
38
- Object.defineProperty(exports, "loadProviders", { enumerable: true, get: function () { return providerConfig_1.loadProviders; } });
39
- Object.defineProperty(exports, "getAvailableProviders", { enumerable: true, get: function () { return providerConfig_1.getAvailableProviders; } });
40
- Object.defineProperty(exports, "healthCheckProvider", { enumerable: true, get: function () { return providerConfig_1.healthCheck; } });
41
- Object.defineProperty(exports, "registerProvider", { enumerable: true, get: function () { return providerConfig_1.registerProvider; } });
42
- Object.defineProperty(exports, "deregisterProvider", { enumerable: true, get: function () { return providerConfig_1.deregisterProvider; } });
43
- Object.defineProperty(exports, "findCheapestAvailableProvider", { enumerable: true, get: function () { return providerConfig_1.findCheapestAvailableProvider; } });
44
- Object.defineProperty(exports, "findFastestAvailableProvider", { enumerable: true, get: function () { return providerConfig_1.findFastestAvailableProvider; } });
45
- Object.defineProperty(exports, "DEFAULT_PROVIDERS", { enumerable: true, get: function () { return providerConfig_1.DEFAULT_PROVIDERS; } });
46
- const reliability_1 = require("./utils/reliability");
47
- Object.defineProperty(exports, "CircuitBreaker", { enumerable: true, get: function () { return reliability_1.CircuitBreaker; } });
48
- Object.defineProperty(exports, "withRetry", { enumerable: true, get: function () { return reliability_1.withRetry; } });
49
- Object.defineProperty(exports, "calculateRetryDelay", { enumerable: true, get: function () { return reliability_1.calculateRetryDelay; } });
50
- Object.defineProperty(exports, "isRetryableStatus", { enumerable: true, get: function () { return reliability_1.isRetryableStatus; } });
51
- Object.defineProperty(exports, "DEFAULT_RETRY_CONFIG", { enumerable: true, get: function () { return reliability_1.DEFAULT_RETRY_CONFIG; } });
52
- const episodicMemory_1 = require("./memory/episodicMemory");
53
- Object.defineProperty(exports, "EpisodicMemoryStore", { enumerable: true, get: function () { return episodicMemory_1.EpisodicMemoryStore; } });
54
- const mctsWorkflow_1 = require("./orchestration/mctsWorkflow");
55
- Object.defineProperty(exports, "MCTSWorkflowOptimizer", { enumerable: true, get: function () { return mctsWorkflow_1.MCTSWorkflowOptimizer; } });
56
- const haloOrchestrator_1 = require("./orchestration/haloOrchestrator");
57
- Object.defineProperty(exports, "HALOOrchestrator", { enumerable: true, get: function () { return haloOrchestrator_1.HALOOrchestrator; } });
58
- const tokenUtils_1 = require("./utils/tokenUtils");
59
- Object.defineProperty(exports, "countTokens", { enumerable: true, get: function () { return tokenUtils_1.countTokens; } });
60
- Object.defineProperty(exports, "estimateCost", { enumerable: true, get: function () { return tokenUtils_1.estimateCost; } });
61
- Object.defineProperty(exports, "estimateCostFromText", { enumerable: true, get: function () { return tokenUtils_1.estimateCostFromText; } });
62
- Object.defineProperty(exports, "getModelCost", { enumerable: true, get: function () { return tokenUtils_1.getModelCost; } });
63
- Object.defineProperty(exports, "listModelsByCost", { enumerable: true, get: function () { return tokenUtils_1.listModelsByCost; } });
64
- Object.defineProperty(exports, "findCheapestModels", { enumerable: true, get: function () { return tokenUtils_1.findCheapestModels; } });
65
- Object.defineProperty(exports, "MODEL_COSTS", { enumerable: true, get: function () { return tokenUtils_1.MODEL_COSTS; } });
66
- const compression_1 = require("./utils/compression");
67
- Object.defineProperty(exports, "isonEncode", { enumerable: true, get: function () { return compression_1.isonEncode; } });
68
- Object.defineProperty(exports, "isonDecode", { enumerable: true, get: function () { return compression_1.isonDecode; } });
69
- Object.defineProperty(exports, "compressText", { enumerable: true, get: function () { return compression_1.compressText; } });
70
- Object.defineProperty(exports, "truncateMessages", { enumerable: true, get: function () { return compression_1.truncateMessages; } });
71
- Object.defineProperty(exports, "truncateToTokenBudget", { enumerable: true, get: function () { return compression_1.truncateToTokenBudget; } });
72
- Object.defineProperty(exports, "calculateCompressionRatio", { enumerable: true, get: function () { return compression_1.calculateCompressionRatio; } });
73
- const localProvider_1 = require("./providers/localProvider");
74
- Object.defineProperty(exports, "LocalProvider", { enumerable: true, get: function () { return localProvider_1.LocalProvider; } });
75
- Object.defineProperty(exports, "LocalProviderManager", { enumerable: true, get: function () { return localProvider_1.LocalProviderManager; } });
76
- Object.defineProperty(exports, "createOllamaProvider", { enumerable: true, get: function () { return localProvider_1.createOllamaProvider; } });
77
- Object.defineProperty(exports, "createVLLMProvider", { enumerable: true, get: function () { return localProvider_1.createVLLMProvider; } });
78
- Object.defineProperty(exports, "createLMStudioProvider", { enumerable: true, get: function () { return localProvider_1.createLMStudioProvider; } });
79
- const batchProcessor_1 = require("./utils/batchProcessor");
80
- Object.defineProperty(exports, "BatchProcessor", { enumerable: true, get: function () { return batchProcessor_1.BatchProcessor; } });
81
- Object.defineProperty(exports, "executeBatch", { enumerable: true, get: function () { return batchProcessor_1.executeBatch; } });
82
- const advancedRouter_1 = require("./routing/advancedRouter");
83
- Object.defineProperty(exports, "routeQuery", { enumerable: true, get: function () { return advancedRouter_1.routeQuery; } });
84
- Object.defineProperty(exports, "routeBatch", { enumerable: true, get: function () { return advancedRouter_1.routeBatch; } });
85
- Object.defineProperty(exports, "recommendForTask", { enumerable: true, get: function () { return advancedRouter_1.recommendForTask; } });
86
- Object.defineProperty(exports, "extractQueryFeatures", { enumerable: true, get: function () { return advancedRouter_1.extractQueryFeatures; } });
87
- Object.defineProperty(exports, "updateModelProfile", { enumerable: true, get: function () { return advancedRouter_1.updateModelProfile; } });
88
- Object.defineProperty(exports, "MODEL_PROFILES", { enumerable: true, get: function () { return advancedRouter_1.MODEL_PROFILES; } });
89
- const prefixCache_1 = require("./cache/prefixCache");
90
- Object.defineProperty(exports, "PrefixCache", { enumerable: true, get: function () { return prefixCache_1.PrefixCache; } });
91
- Object.defineProperty(exports, "createWarmedCache", { enumerable: true, get: function () { return prefixCache_1.createWarmedCache; } });
92
- const speculativeDecoding_1 = require("./utils/speculativeDecoding");
93
- Object.defineProperty(exports, "SpeculativeDecoder", { enumerable: true, get: function () { return speculativeDecoding_1.SpeculativeDecoder; } });
94
- Object.defineProperty(exports, "speculativeBatch", { enumerable: true, get: function () { return speculativeDecoding_1.speculativeBatch; } });
95
- Object.defineProperty(exports, "estimateSpeedupPotential", { enumerable: true, get: function () { return speculativeDecoding_1.estimateSpeedupPotential; } });
96
- Object.defineProperty(exports, "MedusaPredictor", { enumerable: true, get: function () { return speculativeDecoding_1.MedusaPredictor; } });
97
- Object.defineProperty(exports, "EagleSpeculative", { enumerable: true, get: function () { return speculativeDecoding_1.EagleSpeculative; } });
98
- // PI Tool definitions (for PI agent integration)
99
- exports.TMLPD_PI_TOOLS = [
100
- {
101
- name: "tmlpd_execute",
102
- 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.",
103
- inputSchema: {
104
- type: "object",
105
- properties: {
106
- prompt: { type: "string", description: "The prompt to execute" },
107
- models: { type: "array", items: { type: "string" }, description: "Optional model list (auto-selects if omitted)" },
108
- streaming: { type: "object", properties: { enabled: { type: "boolean" }, chunk_size: { type: "number" } } }
109
- },
110
- required: ["prompt"]
111
- }
112
- },
113
- {
114
- name: "tmlpd_execute_single",
115
- 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.",
116
- inputSchema: {
117
- type: "object",
118
- properties: {
119
- prompt: { type: "string", description: "The prompt to execute" },
120
- model: { type: "string", description: "Optional specific model" }
121
- },
122
- required: ["prompt"]
123
- }
124
- },
125
- {
126
- name: "tmlpd_cost_summary",
127
- description: "Get real-time cost tracking summary. Shows spending by provider, model, daily/monthly breakdowns, and remaining budget. Essential for cost monitoring in production.",
128
- inputSchema: { type: "object", properties: {} }
129
- },
130
- {
131
- name: "tmlpd_cache_stats",
132
- description: "Get response cache statistics. Shows hit rate, cache size, and effectiveness. Cache hits cost $0 and provide instant responses.",
133
- inputSchema: { type: "object", properties: {} }
134
- },
135
- {
136
- name: "tmlpd_provider_status",
137
- description: "Get status of all configured LLM providers. Shows readiness, cooldown status, failure counts. Use for debugging or selecting specific providers.",
138
- inputSchema: { type: "object", properties: {} }
139
- },
140
- {
141
- name: "tmlpd_invalidate_cache",
142
- description: "Invalidate cached responses. Use when prompt content has changed and fresh response needed, or to clear stale cache entries.",
143
- inputSchema: {
144
- type: "object",
145
- properties: { model: { type: "string", description: "Optional model to invalidate (all if omitted)" } }
146
- }
147
- },
148
- {
149
- name: "tmlpd_get_budget",
150
- description: "Get remaining budget for cost controls. Returns daily, monthly, and per-model limits. Use for budget enforcement and alerting.",
151
- inputSchema: { type: "object", properties: {} }
152
- },
153
- {
154
- name: "tmlpd_halo_execute",
155
- 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.",
156
- inputSchema: {
157
- type: "object",
158
- properties: {
159
- task_description: { type: "string", description: "Task to execute" },
160
- max_concurrent: { type: "number", description: "Max parallel executions (default: 3)" },
161
- enable_mcts: { type: "boolean", description: "Enable MCTS optimization (slower but better)" }
162
- },
163
- required: ["task_description"]
164
- }
165
- },
166
- {
167
- name: "tmlpd_episodic_query",
168
- description: "Query episodic memory for similar past tasks. Useful for learning from past executions and improving future routing decisions.",
169
- inputSchema: {
170
- type: "object",
171
- properties: {
172
- task_description: { type: "string", description: "Task to find similar executions for" },
173
- limit: { type: "number", description: "Max results (default: 5)" }
174
- },
175
- required: ["task_description"]
176
- }
177
- },
178
- {
179
- name: "tmlpd_count_tokens",
180
- 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.",
181
- inputSchema: {
182
- type: "object",
183
- properties: {
184
- text: { type: "string", description: "Text to count tokens in" },
185
- model: { type: "string", description: "Model for tokenization (default: gpt-4o)" }
186
- },
187
- required: ["text"]
188
- }
189
- },
190
- {
191
- name: "tmlpd_compress_context",
192
- 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.",
193
- inputSchema: {
194
- type: "object",
195
- properties: {
196
- messages: { type: "array", description: "Messages to compress", items: { type: "object" } },
197
- strategy: { type: "string", enum: ["smart", "first", "last"], description: "Compression strategy (default: smart)" },
198
- max_tokens: { type: "number", description: "Target token budget" }
199
- },
200
- required: ["messages"]
201
- }
202
- },
203
- {
204
- name: "tmlpd_local_generate",
205
- 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.",
206
- inputSchema: {
207
- type: "object",
208
- properties: {
209
- prompt: { type: "string", description: "Prompt for generation" },
210
- runtime: { type: "string", enum: ["ollama", "vllm", "lmstudio"], description: "Local runtime type" },
211
- model: { type: "string", description: "Model name (default: llama-3.3-70b)" }
212
- },
213
- required: ["prompt", "runtime"]
214
- }
215
- },
216
- {
217
- name: "tmlpd_batch_execute",
218
- description: "Execute batch of prompts with concurrency control. Supports priority queuing, progress callbacks, rate limiting. Use for processing multiple prompts efficiently.",
219
- inputSchema: {
220
- type: "object",
221
- properties: {
222
- prompts: { type: "array", items: { type: "string" }, description: "Prompts to execute" },
223
- concurrency: { type: "number", description: "Max parallel executions (default: 5)" },
224
- model: { type: "string", description: "Model to use (default: gpt-4o)" }
225
- },
226
- required: ["prompts"]
227
- }
228
- }
229
- ];
230
- /**
231
- * Reference to Full TMLPD
232
- *
233
- * This package provides:
234
- * - Core: streaming, caching, cost tracking, reliability
235
- * - Reference: episodic memory, MCTS, HALO orchestrator
236
- *
237
- * For production with full features:
238
- * - Python TMLPD: https://github.com/Das-rebel/tmlpd-skill
239
- * - Full memory: 3-tier (episodic + semantic + working)
240
- * - Full MCTS: UCB1, deterministic rollouts, strategy caching
241
- * - Full HALO: NLP decomposition, capability matching, verification
242
- */
243
- exports.default = {
244
- createTMLPD: tmlpdTools_1.createTMLPD,
245
- TMLPDTools: tmlpdTools_1.TMLPDTools,
246
- TMLPD_PI_TOOLS: exports.TMLPD_PI_TOOLS
247
- };
248
- //# sourceMappingURL=index.js.map
249
- // ============================================
250
- // A3M Router - Adaptive Memory Multi-Model Router
251
- // Re-exports for the A3M Router package
252
- // ============================================
253
-
254
- // Memory
255
- const memoryTree_1 = require("./memory/memoryTree");
256
- Object.defineProperty(exports, "MemoryTree", { enumerable: true, get: function () { return memoryTree_1.MemoryTree; } });
257
-
258
- const autoFetch_1 = require("./memory/autoFetch");
259
- Object.defineProperty(exports, "AutoFetch", { enumerable: true, get: function () { return autoFetch_1.AutoFetch; } });
260
-
261
- const obsidianVault_1 = require("./memory/obsidianVault");
262
- Object.defineProperty(exports, "ObsidianVault", { enumerable: true, get: function () { return obsidianVault_1.ObsidianVault; } });
263
-
264
- const enhancedCompression_1 = require("./utils/enhancedCompression");
265
- Object.defineProperty(exports, "EnhancedCompression", { enumerable: true, get: function () { return enhancedCompression_1.EnhancedCompression; } });
266
-
267
- // OAuth
268
- const oauth_1 = require("./integrations/oauth");
269
- Object.defineProperty(exports, "OAuthManager", { enumerable: true, get: function () { return oauth_1.OAuthManager; } });
270
- Object.defineProperty(exports, "OAUTH_PROVIDERS", { enumerable: true, get: function () { return oauth_1.OAUTH_PROVIDERS; } });
271
-
272
- // Integrations
273
- const integrations_1 = require("./integrations/index");
274
- Object.defineProperty(exports, "GitHubIntegration", { enumerable: true, get: function () { return integrations_1.GitHubIntegration; } });
275
- Object.defineProperty(exports, "SlackIntegration", { enumerable: true, get: function () { return integrations_1.SlackIntegration; } });
276
- Object.defineProperty(exports, "TelegramIntegration", { enumerable: true, get: function () { return integrations_1.TelegramIntegration; } });
277
- Object.defineProperty(exports, "NotionIntegration", { enumerable: true, get: function () { return integrations_1.NotionIntegration; } });
278
- Object.defineProperty(exports, "LinearIntegration", { enumerable: true, get: function () { return integrations_1.LinearIntegration; } });
279
- Object.defineProperty(exports, "JiraIntegration", { enumerable: true, get: function () { return integrations_1.JiraIntegration; } });
280
- Object.defineProperty(exports, "GmailIntegration", { enumerable: true, get: function () { return integrations_1.GmailIntegration; } });
281
- Object.defineProperty(exports, "DiscordIntegration", { enumerable: true, get: function () { return integrations_1.DiscordIntegration; } });
282
- Object.defineProperty(exports, "AirtableIntegration", { enumerable: true, get: function () { return integrations_1.AirtableIntegration; } });
283
- Object.defineProperty(exports, "GoogleCalendarIntegration", { enumerable: true, get: function () { return integrations_1.GoogleCalendarIntegration; } });
284
- Object.defineProperty(exports, "createIntegration", { enumerable: true, get: function () { return integrations_1.createIntegration; } });
285
-
286
- // Convenience: createA3MRouter factory
287
- /**
288
- * Create a configured A3M Router instance
289
- * @param {Object} config - Router configuration
290
- * @param {Object} config.providers - LLM provider configs
291
- * @param {Object} config.memory - Memory settings
292
- * @param {Object} config.cache - Cache settings
293
- * @param {Object} config.cost - Cost tracking settings
294
- * @returns {Object} Router instance with route(), routeBatch(), recommend(), memory, cache, compression, oauth, vault, providers properties
295
- */
296
- function createA3MRouter(config = {}) {
297
- const { providers = {}, memory = {}, cache = {}, cost = {} } = config;
298
-
299
- const memoryTree = new memoryTree_1.MemoryTree(memory);
300
- const prefixCache = new (require("./cache/prefixCache").PrefixCache)(cache);
301
- const costTracker = new (require("./cost/costTracker").CostTracker)(cost);
302
- // Alias getSummary as getStatus for convenience
303
- if (typeof costTracker.getSummary === "function" && !costTracker.getStatus) {
304
- costTracker.getStatus = costTracker.getSummary.bind(costTracker);
305
- }
306
- const autoFetch = new autoFetch_1.AutoFetch(memory);
307
- const compression = new enhancedCompression_1.EnhancedCompression();
308
- const oauth = new oauth_1.OAuthManager();
309
- const vault = new obsidianVault_1.ObsidianVault();
310
-
311
- return {
312
- // Routing
313
- route: (query, options) => (0, require("./routing/advancedRouter").routeQuery)(query, options),
314
- routeBatch: (queries, options) => (0, require("./routing/advancedRouter").routeBatch)(queries, options),
315
- recommend: (task) => (0, require("./routing/advancedRouter").recommendForTask)(task),
316
-
317
- // Memory
318
- memory: memoryTree,
319
- autoFetch,
320
- vault,
321
- compression,
322
-
323
- // Cache & Cost
324
- cache: prefixCache,
325
- costTracker,
326
-
327
- // Auth
328
- oauth,
329
-
330
- // Providers (from existing TMLPD)
331
- providers: new (require("./providers/registry").ProviderRegistry)(),
332
-
333
- // Integrations
334
- createIntegration: integrations_1.createIntegration,
335
-
336
- // Utils
337
- countTokens: require("./utils/tokenUtils").countTokens,
338
- estimateCost: require("./utils/tokenUtils").estimateCost,
339
- };
340
- }
341
- exports.createA3MRouter = createA3MRouter;
342
-
343
- // Provider Configuration (generic, user-configurable) - additional exports
344
- const providerConfig = require("./providers/providerConfig");
345
- Object.defineProperty(exports, "providerConfig", { enumerable: true, get: function () { return providerConfig; } });
346
- Object.defineProperty(exports, "saveProviderConfig", { enumerable: true, get: function () { return providerConfig.saveConfig; } });
3
+ exports.ProxyServer = exports.CostAnalytics = exports.GuardrailEngine = exports.SemanticCache = void 0;
4
+ // v2.0.0 additions
5
+ var semanticCache_1 = require("./cache/semanticCache");
6
+ Object.defineProperty(exports, "SemanticCache", { enumerable: true, get: function () { return semanticCache_1.SemanticCache; } });
7
+ var guardrails_1 = require("./security/guardrails");
8
+ Object.defineProperty(exports, "GuardrailEngine", { enumerable: true, get: function () { return guardrails_1.GuardrailEngine; } });
9
+ var costAnalytics_1 = require("./analytics/costAnalytics");
10
+ Object.defineProperty(exports, "CostAnalytics", { enumerable: true, get: function () { return costAnalytics_1.CostAnalytics; } });
11
+ var proxyServer_1 = require("./server/proxyServer");
12
+ Object.defineProperty(exports, "ProxyServer", { enumerable: true, get: function () { return proxyServer_1.ProxyServer; } });
13
+ //# 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;;;;;;;;;;;;;;;;;;;;;;;GAuBG;;;AAEH,mDAA0H;AAiBjH,4FAjBA,wBAAW,OAiBA;AAAE,2FAjBA,uBAAU,OAiBA;AAhBhC,yDAA+E;AAiBtE,8FAjBA,6BAAa,OAiBA;AAhBtB,oDAAqG;AAiB5F,4FAjBA,yBAAW,OAiBA;AAhBpB,mDAAgG;AAiBvF,iGAjBA,2BAAgB,OAiBA;AAhBzB,qDAAyJ;AAiBhJ,+FAjBA,4BAAc,OAiBA;AAAE,0FAjBA,uBAAS,OAiBA;AAA6B,oGAjBA,iCAAmB,OAiBA;AAAE,kGAjBA,+BAAiB,OAiBA;AAAE,qGAjBA,kCAAoB,OAiBA;AAhB3H,4DAA0F;AAiBjF,oGAjBA,oC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F;IACD;QACE,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EAAE,mKAAmK;QAChL,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,oBAAoB,EAAE;gBACxF,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,sCAAsC,EAAE;gBACpF,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,gCAAgC,EAAE;aACzE;YACD,QAAQ,EAAE,CAAC,SAAS,CAAC;SACtB;KACF;CACF,CAAC;AAEF;;;;;;;;;;;;GAYG;AAEH,kBAAe;IACb,WAAW,EAAE,wBAAW;IACxB,UAAU,EAAE,uBAAU;IACtB,cAAc,EAAE,sBAAc;CAC/B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,mBAAmB;AACnB,uDAAsD;AAA7C,8GAAA,aAAa,OAAA;AACtB,oDAAwD;AAA/C,6GAAA,eAAe,OAAA;AACxB,2DAA0D;AAAjD,8GAAA,aAAa,OAAA;AACtB,oDAAmD;AAA1C,0GAAA,WAAW,OAAA"}
@@ -0,0 +1,146 @@
1
+ /**
2
+ * A3M Router - LangChain Adapter
3
+ *
4
+ * Drop-in replacement for ChatOpenAI from @langchain/openai.
5
+ * Routes all LLM calls through the A3M Router for cost optimization,
6
+ * load balancing, and intelligent provider selection.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { A3MChatModel } from 'adaptive-memory-multi-model-router/langchain';
11
+ * import { HumanMessage } from '@langchain/core/messages';
12
+ *
13
+ * const model = new A3MChatModel({
14
+ * modelName: 'auto', // or 'groq/llama-3.3-70b-versatile'
15
+ * temperature: 0.7,
16
+ * });
17
+ *
18
+ * const response = await model.invoke([
19
+ * new HumanMessage("What is 2+2?")
20
+ * ]);
21
+ *
22
+ * // Streaming
23
+ * const stream = await model.stream([
24
+ * new HumanMessage("Tell me a story")
25
+ * ]);
26
+ * for await (const chunk of stream) {
27
+ * process.stdout.write(chunk.content as string);
28
+ * }
29
+ * ```
30
+ *
31
+ * LangChain is a PEER DEPENDENCY. Install it separately:
32
+ * npm install @langchain/core @langchain/openai
33
+ */
34
+ import type { BaseChatModelCallOptions } from '@langchain/core/language_models/chat_models';
35
+ import type { BaseMessage } from '@langchain/core/messages';
36
+ import type { ChatGenerationChunk, ChatResult } from '@langchain/core/outputs';
37
+ import type { StructuredOutputMethodParams } from '@langchain/core/language_models/structured_output';
38
+ import { type ProviderDefinition } from '../providers/providerConfig.js';
39
+ export interface A3MChatModelOptions {
40
+ /** A3M router instance (creates default if not provided) */
41
+ router?: any;
42
+ /** Model to use: 'auto' for router selection, or 'provider/model' */
43
+ modelName?: string;
44
+ /** Temperature (0-2) */
45
+ temperature?: number;
46
+ /** Max output tokens */
47
+ maxTokens?: number;
48
+ /** Top-p sampling */
49
+ topP?: number;
50
+ /** Frequency penalty (-2 to 2) */
51
+ frequencyPenalty?: number;
52
+ /** Presence penalty (-2 to 2) */
53
+ presencePenalty?: number;
54
+ /** Stop sequences */
55
+ stop?: string[];
56
+ /** Timeout in ms */
57
+ timeout?: number;
58
+ /** API key override (uses env vars if not set) */
59
+ apiKey?: string;
60
+ /** Base URL override */
61
+ baseUrl?: string;
62
+ /** Provider format hint */
63
+ format?: 'openai' | 'anthropic' | 'google';
64
+ /** Extra headers to send with requests */
65
+ headers?: Record<string, string>;
66
+ /** Tags for tracing */
67
+ tags?: string[];
68
+ /** Metadata for tracing */
69
+ metadata?: Record<string, any>;
70
+ /** Verbose logging */
71
+ verbose?: boolean;
72
+ }
73
+ export interface A3MToolCall {
74
+ id: string;
75
+ type: 'function';
76
+ function: {
77
+ name: string;
78
+ arguments: string;
79
+ };
80
+ }
81
+ export declare class A3MChatModel {
82
+ lc_namespace: string[];
83
+ lc_sequential: boolean;
84
+ lc_runnable: boolean;
85
+ private modelName;
86
+ private temperature;
87
+ private maxTokens;
88
+ private topP?;
89
+ private frequencyPenalty?;
90
+ private presencePenalty?;
91
+ private stop?;
92
+ private timeout;
93
+ private apiKey?;
94
+ private baseUrl?;
95
+ private format?;
96
+ private extraHeaders?;
97
+ private verbose;
98
+ private boundTools;
99
+ private registry;
100
+ constructor(options?: A3MChatModelOptions & Record<string, any>);
101
+ get model(): string;
102
+ get identifyingParams(): Record<string, any>;
103
+ get lc_aliases(): Record<string, string>;
104
+ toJSON(): Record<string, any>;
105
+ static deserialize(data: Record<string, any>): Promise<A3MChatModel>;
106
+ _generate(messages: BaseMessage[], options?: BaseChatModelCallOptions & {
107
+ tools?: any[];
108
+ }): Promise<ChatResult>;
109
+ invoke(input: BaseMessage[] | string, options?: BaseChatModelCallOptions & {
110
+ tools?: any[];
111
+ }): Promise<any>;
112
+ _streamResponseChunks(messages: BaseMessage[], options?: BaseChatModelCallOptions & {
113
+ tools?: any[];
114
+ }): AsyncGenerator<ChatGenerationChunk>;
115
+ stream(input: BaseMessage[] | string, options?: BaseChatModelCallOptions & {
116
+ tools?: any[];
117
+ }): AsyncGenerator<any>;
118
+ bindTools(tools: any[]): A3MChatModel;
119
+ withStructuredOutput<T extends Record<string, any>>(schema: any, config?: StructuredOutputMethodParams | boolean): any;
120
+ /**
121
+ * Get the list of available providers
122
+ */
123
+ getAvailableProviders(): Record<string, ProviderDefinition>;
124
+ /**
125
+ * Get provider status from the registry
126
+ */
127
+ getProviderStatus(): any;
128
+ /**
129
+ * Switch the model at runtime
130
+ */
131
+ withModel(modelName: string): A3MChatModel;
132
+ /**
133
+ * Set temperature
134
+ */
135
+ withTemperature(temperature: number): A3MChatModel;
136
+ /** LLM type identifier for LangChain compatibility */
137
+ _llmType(): string;
138
+ }
139
+ /**
140
+ * Create an A3MChatModel pre-configured for a specific provider
141
+ */
142
+ export declare function createA3MChatModel(provider: string, options?: Omit<A3MChatModelOptions, 'modelName'>): A3MChatModel;
143
+ /**
144
+ * Create an A3MChatModel with automatic routing
145
+ */
146
+ export declare function createAutoRoutingChatModel(options?: Omit<A3MChatModelOptions, 'modelName'>): A3MChatModel;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"langchainAdapter.d.ts","sourceRoot":"","sources":["../../src/integrations/langchainAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAMH,OAAO,KAAK,EAEV,wBAAwB,EACzB,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EACV,WAAW,EAIZ,MAAM,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAEV,mBAAmB,EACnB,UAAU,EACX,MAAM,yBAAyB,CAAC;AAMjC,OAAO,KAAK,EACV,4BAA4B,EAC7B,MAAM,mDAAmD,CAAC;AAM3D,OAAO,EACL,KAAK,kBAAkB,EAKxB,MAAM,gCAAgC,CAAC;AAQxC,MAAM,WAAW,mBAAmB;IAClC,4DAA4D;IAC5D,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,qEAAqE;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wBAAwB;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,wBAAwB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kCAAkC;IAClC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,iCAAiC;IACjC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB;IACrB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kDAAkD;IAClD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wBAAwB;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2BAA2B;IAC3B,MAAM,CAAC,EAAE,QAAQ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