adaptive-memory-multi-model-router 1.2.2 → 1.3.1
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 +146 -66
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/integrations/airtable.js +20 -0
- package/dist/integrations/discord.js +18 -0
- package/dist/integrations/github.js +23 -0
- package/dist/integrations/gmail.js +19 -0
- package/dist/integrations/google-calendar.js +18 -0
- package/dist/integrations/index.js +61 -0
- package/dist/integrations/jira.js +21 -0
- package/dist/integrations/linear.js +19 -0
- package/dist/integrations/notion.js +19 -0
- package/dist/integrations/slack.js +18 -0
- package/dist/integrations/telegram.js +19 -0
- package/dist/providers/registry.js +7 -3
- package/docs/ARCHITECTURAL-IMPROVEMENTS-2025.md +1391 -0
- package/docs/ARCHITECTURAL-IMPROVEMENTS-REVISED-2025.md +1051 -0
- package/docs/CONFIGURATION.md +476 -0
- package/docs/COUNCIL_DECISION.json +308 -0
- package/docs/COUNCIL_SUMMARY.md +265 -0
- package/docs/COUNCIL_V2.2_DECISION.md +416 -0
- package/docs/IMPROVEMENT_ROADMAP.md +515 -0
- package/docs/LLM_COUNCIL_DECISION.md +508 -0
- package/docs/QUICK_START_VISIBILITY.md +782 -0
- package/docs/REDDIT_GAP_ANALYSIS.md +299 -0
- package/docs/RESEARCH_BACKED_IMPROVEMENTS.md +1180 -0
- package/docs/TMLPD_QNA.md +751 -0
- package/docs/TMLPD_V2.1_COMPLETE.md +763 -0
- package/docs/TMLPD_V2.2_RESEARCH_ROADMAP.md +754 -0
- package/docs/V2.2_IMPLEMENTATION_COMPLETE.md +446 -0
- package/docs/V2_IMPLEMENTATION_GUIDE.md +388 -0
- package/docs/VISIBILITY_ADOPTION_PLAN.md +1005 -0
- package/docs/launch-content/LAUNCH_EXECUTION_CHECKLIST.md +421 -0
- package/docs/launch-content/README.md +457 -0
- package/docs/launch-content/assets/cost_comparison_100_tasks.png +0 -0
- package/docs/launch-content/assets/cumulative_savings.png +0 -0
- package/docs/launch-content/assets/parallel_speedup.png +0 -0
- package/docs/launch-content/assets/provider_pricing_comparison.png +0 -0
- package/docs/launch-content/assets/task_breakdown_comparison.png +0 -0
- package/docs/launch-content/generate_charts.py +313 -0
- package/docs/launch-content/hn_show_post.md +139 -0
- package/docs/launch-content/partner_outreach_templates.md +745 -0
- package/docs/launch-content/reddit_posts.md +467 -0
- package/docs/launch-content/twitter_thread.txt +460 -0
- package/examples/QUICKSTART.md +1 -1
- package/openclaw-alexa-bridge/ALL_REMAINING_FIXES_PLAN.md +313 -0
- package/openclaw-alexa-bridge/REMAINING_FIXES_SUMMARY.md +277 -0
- package/openclaw-alexa-bridge/src/alexa_handler_no_tmlpd.js +1234 -0
- package/openclaw-alexa-bridge/test_fixes.js +77 -0
- package/package.json +120 -29
- package/package.json.tmp +0 -0
- package/qna/TMLPD_QNA.md +3 -3
- package/skill/SKILL.md +2 -2
- package/src/__tests__/integration/tmpld_integration.test.py +540 -0
- package/src/agents/skill_enhanced_agent.py +318 -0
- package/src/memory/__init__.py +15 -0
- package/src/memory/agentic_memory.py +353 -0
- package/src/memory/semantic_memory.py +444 -0
- package/src/memory/simple_memory.py +466 -0
- package/src/memory/working_memory.py +447 -0
- package/src/orchestration/__init__.py +52 -0
- package/src/orchestration/execution_engine.py +353 -0
- package/src/orchestration/halo_orchestrator.py +367 -0
- package/src/orchestration/mcts_workflow.py +498 -0
- package/src/orchestration/role_assigner.py +473 -0
- package/src/orchestration/task_planner.py +522 -0
- package/src/providers/__init__.py +67 -0
- package/src/providers/anthropic.py +304 -0
- package/src/providers/base.py +241 -0
- package/src/providers/cerebras.py +373 -0
- package/src/providers/registry.py +476 -0
- package/src/routing/__init__.py +30 -0
- package/src/routing/universal_router.py +621 -0
- package/src/skills/TMLPD-QUICKREF.md +210 -0
- package/src/skills/TMLPD-SETUP-SUMMARY.md +157 -0
- package/src/skills/TMLPD.md +540 -0
- package/src/skills/__tests__/skill_manager.test.ts +328 -0
- package/src/skills/skill_manager.py +385 -0
- package/src/skills/test-tmlpd.sh +108 -0
- package/src/skills/tmlpd-category.yaml +67 -0
- package/src/skills/tmlpd-monitoring.yaml +188 -0
- package/src/skills/tmlpd-phase.yaml +132 -0
- package/src/state/__init__.py +17 -0
- package/src/state/simple_checkpoint.py +508 -0
- package/src/tmlpd_agent.py +464 -0
- package/src/tmpld_v2.py +427 -0
- package/src/workflows/__init__.py +18 -0
- package/src/workflows/advanced_difficulty_classifier.py +377 -0
- package/src/workflows/chaining_executor.py +417 -0
- package/src/workflows/difficulty_integration.py +209 -0
- package/src/workflows/orchestrator.py +469 -0
- package/src/workflows/orchestrator_executor.py +456 -0
- package/src/workflows/parallelization_executor.py +382 -0
- package/src/workflows/router.py +311 -0
- package/test_integration_simple.py +86 -0
- package/test_mcts_workflow.py +150 -0
- package/test_templd_integration.py +262 -0
- package/test_universal_router.py +275 -0
- package/tmlpd-pi-extension/README.md +36 -0
- package/tmlpd-pi-extension/dist/cache/prefixCache.d.ts +114 -0
- package/tmlpd-pi-extension/dist/cache/prefixCache.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/cache/prefixCache.js +285 -0
- package/tmlpd-pi-extension/dist/cache/prefixCache.js.map +1 -0
- package/tmlpd-pi-extension/dist/cache/responseCache.d.ts +58 -0
- package/tmlpd-pi-extension/dist/cache/responseCache.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/cache/responseCache.js +153 -0
- package/tmlpd-pi-extension/dist/cache/responseCache.js.map +1 -0
- package/tmlpd-pi-extension/dist/cli.js +59 -0
- package/tmlpd-pi-extension/dist/cost/costTracker.d.ts +95 -0
- package/tmlpd-pi-extension/dist/cost/costTracker.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/cost/costTracker.js +240 -0
- package/tmlpd-pi-extension/dist/cost/costTracker.js.map +1 -0
- package/tmlpd-pi-extension/dist/index.d.ts +723 -0
- package/tmlpd-pi-extension/dist/index.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/index.js +239 -0
- package/tmlpd-pi-extension/dist/index.js.map +1 -0
- package/tmlpd-pi-extension/dist/memory/episodicMemory.d.ts +82 -0
- package/tmlpd-pi-extension/dist/memory/episodicMemory.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/memory/episodicMemory.js +145 -0
- package/tmlpd-pi-extension/dist/memory/episodicMemory.js.map +1 -0
- package/tmlpd-pi-extension/dist/orchestration/haloOrchestrator.d.ts +102 -0
- package/tmlpd-pi-extension/dist/orchestration/haloOrchestrator.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/orchestration/haloOrchestrator.js +207 -0
- package/tmlpd-pi-extension/dist/orchestration/haloOrchestrator.js.map +1 -0
- package/tmlpd-pi-extension/dist/orchestration/mctsWorkflow.d.ts +85 -0
- package/tmlpd-pi-extension/dist/orchestration/mctsWorkflow.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/orchestration/mctsWorkflow.js +210 -0
- package/tmlpd-pi-extension/dist/orchestration/mctsWorkflow.js.map +1 -0
- package/tmlpd-pi-extension/dist/providers/localProvider.d.ts +102 -0
- package/tmlpd-pi-extension/dist/providers/localProvider.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/providers/localProvider.js +338 -0
- package/tmlpd-pi-extension/dist/providers/localProvider.js.map +1 -0
- package/tmlpd-pi-extension/dist/providers/registry.d.ts +55 -0
- package/tmlpd-pi-extension/dist/providers/registry.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/providers/registry.js +138 -0
- package/tmlpd-pi-extension/dist/providers/registry.js.map +1 -0
- package/tmlpd-pi-extension/dist/routing/advancedRouter.d.ts +68 -0
- package/tmlpd-pi-extension/dist/routing/advancedRouter.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/routing/advancedRouter.js +332 -0
- package/tmlpd-pi-extension/dist/routing/advancedRouter.js.map +1 -0
- package/tmlpd-pi-extension/dist/tools/tmlpdTools.d.ts +101 -0
- package/tmlpd-pi-extension/dist/tools/tmlpdTools.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/tools/tmlpdTools.js +368 -0
- package/tmlpd-pi-extension/dist/tools/tmlpdTools.js.map +1 -0
- package/tmlpd-pi-extension/dist/utils/batchProcessor.d.ts +96 -0
- package/tmlpd-pi-extension/dist/utils/batchProcessor.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/utils/batchProcessor.js +170 -0
- package/tmlpd-pi-extension/dist/utils/batchProcessor.js.map +1 -0
- package/tmlpd-pi-extension/dist/utils/compression.d.ts +61 -0
- package/tmlpd-pi-extension/dist/utils/compression.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/utils/compression.js +281 -0
- package/tmlpd-pi-extension/dist/utils/compression.js.map +1 -0
- package/tmlpd-pi-extension/dist/utils/reliability.d.ts +74 -0
- package/tmlpd-pi-extension/dist/utils/reliability.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/utils/reliability.js +177 -0
- package/tmlpd-pi-extension/dist/utils/reliability.js.map +1 -0
- package/tmlpd-pi-extension/dist/utils/speculativeDecoding.d.ts +117 -0
- package/tmlpd-pi-extension/dist/utils/speculativeDecoding.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/utils/speculativeDecoding.js +246 -0
- package/tmlpd-pi-extension/dist/utils/speculativeDecoding.js.map +1 -0
- package/tmlpd-pi-extension/dist/utils/tokenUtils.d.ts +50 -0
- package/tmlpd-pi-extension/dist/utils/tokenUtils.d.ts.map +1 -0
- package/tmlpd-pi-extension/dist/utils/tokenUtils.js +124 -0
- package/tmlpd-pi-extension/dist/utils/tokenUtils.js.map +1 -0
- package/tmlpd-pi-extension/examples/QUICKSTART.md +183 -0
- package/tmlpd-pi-extension/package-lock.json +75 -0
- package/tmlpd-pi-extension/package.json +172 -0
- package/tmlpd-pi-extension/python/examples.py +53 -0
- package/tmlpd-pi-extension/python/integrations.py +330 -0
- package/tmlpd-pi-extension/python/setup.py +28 -0
- package/tmlpd-pi-extension/python/tmlpd.py +369 -0
- package/tmlpd-pi-extension/qna/REDDIT_GAP_ANALYSIS.md +299 -0
- package/tmlpd-pi-extension/qna/TMLPD_QNA.md +751 -0
- package/tmlpd-pi-extension/skill/SKILL.md +238 -0
- package/{src → tmlpd-pi-extension/src}/index.ts +1 -1
- package/tmlpd-pi-extension/tsconfig.json +18 -0
- package/demo/research-demo.js +0 -266
- package/notebooks/quickstart.ipynb +0 -157
- package/rust/tmlpd.h +0 -268
- package/src/cache/prefixCache.ts +0 -365
- package/src/routing/advancedRouter.ts +0 -406
- package/src/utils/speculativeDecoding.ts +0 -344
- /package/{src → tmlpd-pi-extension/src}/cache/responseCache.ts +0 -0
- /package/{src → tmlpd-pi-extension/src}/cost/costTracker.ts +0 -0
- /package/{src → tmlpd-pi-extension/src}/memory/episodicMemory.ts +0 -0
- /package/{src → tmlpd-pi-extension/src}/orchestration/haloOrchestrator.ts +0 -0
- /package/{src → tmlpd-pi-extension/src}/orchestration/mctsWorkflow.ts +0 -0
- /package/{src → tmlpd-pi-extension/src}/providers/localProvider.ts +0 -0
- /package/{src → tmlpd-pi-extension/src}/providers/registry.ts +0 -0
- /package/{src → tmlpd-pi-extension/src}/tools/tmlpdTools.ts +0 -0
- /package/{src → tmlpd-pi-extension/src}/utils/batchProcessor.ts +0 -0
- /package/{src → tmlpd-pi-extension/src}/utils/compression.ts +0 -0
- /package/{src → tmlpd-pi-extension/src}/utils/reliability.ts +0 -0
- /package/{src → tmlpd-pi-extension/src}/utils/tokenUtils.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAC1H,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,wBAIE"}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* TMLPD PI Extension - v1.1.0
|
|
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
|
+
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 reliability_1 = require("./utils/reliability");
|
|
38
|
+
Object.defineProperty(exports, "CircuitBreaker", { enumerable: true, get: function () { return reliability_1.CircuitBreaker; } });
|
|
39
|
+
Object.defineProperty(exports, "withRetry", { enumerable: true, get: function () { return reliability_1.withRetry; } });
|
|
40
|
+
Object.defineProperty(exports, "calculateRetryDelay", { enumerable: true, get: function () { return reliability_1.calculateRetryDelay; } });
|
|
41
|
+
Object.defineProperty(exports, "isRetryableStatus", { enumerable: true, get: function () { return reliability_1.isRetryableStatus; } });
|
|
42
|
+
Object.defineProperty(exports, "DEFAULT_RETRY_CONFIG", { enumerable: true, get: function () { return reliability_1.DEFAULT_RETRY_CONFIG; } });
|
|
43
|
+
const episodicMemory_1 = require("./memory/episodicMemory");
|
|
44
|
+
Object.defineProperty(exports, "EpisodicMemoryStore", { enumerable: true, get: function () { return episodicMemory_1.EpisodicMemoryStore; } });
|
|
45
|
+
const mctsWorkflow_1 = require("./orchestration/mctsWorkflow");
|
|
46
|
+
Object.defineProperty(exports, "MCTSWorkflowOptimizer", { enumerable: true, get: function () { return mctsWorkflow_1.MCTSWorkflowOptimizer; } });
|
|
47
|
+
const haloOrchestrator_1 = require("./orchestration/haloOrchestrator");
|
|
48
|
+
Object.defineProperty(exports, "HALOOrchestrator", { enumerable: true, get: function () { return haloOrchestrator_1.HALOOrchestrator; } });
|
|
49
|
+
const tokenUtils_1 = require("./utils/tokenUtils");
|
|
50
|
+
Object.defineProperty(exports, "countTokens", { enumerable: true, get: function () { return tokenUtils_1.countTokens; } });
|
|
51
|
+
Object.defineProperty(exports, "estimateCost", { enumerable: true, get: function () { return tokenUtils_1.estimateCost; } });
|
|
52
|
+
Object.defineProperty(exports, "estimateCostFromText", { enumerable: true, get: function () { return tokenUtils_1.estimateCostFromText; } });
|
|
53
|
+
Object.defineProperty(exports, "getModelCost", { enumerable: true, get: function () { return tokenUtils_1.getModelCost; } });
|
|
54
|
+
Object.defineProperty(exports, "listModelsByCost", { enumerable: true, get: function () { return tokenUtils_1.listModelsByCost; } });
|
|
55
|
+
Object.defineProperty(exports, "findCheapestModels", { enumerable: true, get: function () { return tokenUtils_1.findCheapestModels; } });
|
|
56
|
+
Object.defineProperty(exports, "MODEL_COSTS", { enumerable: true, get: function () { return tokenUtils_1.MODEL_COSTS; } });
|
|
57
|
+
const compression_1 = require("./utils/compression");
|
|
58
|
+
Object.defineProperty(exports, "isonEncode", { enumerable: true, get: function () { return compression_1.isonEncode; } });
|
|
59
|
+
Object.defineProperty(exports, "isonDecode", { enumerable: true, get: function () { return compression_1.isonDecode; } });
|
|
60
|
+
Object.defineProperty(exports, "compressText", { enumerable: true, get: function () { return compression_1.compressText; } });
|
|
61
|
+
Object.defineProperty(exports, "truncateMessages", { enumerable: true, get: function () { return compression_1.truncateMessages; } });
|
|
62
|
+
Object.defineProperty(exports, "truncateToTokenBudget", { enumerable: true, get: function () { return compression_1.truncateToTokenBudget; } });
|
|
63
|
+
Object.defineProperty(exports, "calculateCompressionRatio", { enumerable: true, get: function () { return compression_1.calculateCompressionRatio; } });
|
|
64
|
+
const localProvider_1 = require("./providers/localProvider");
|
|
65
|
+
Object.defineProperty(exports, "LocalProvider", { enumerable: true, get: function () { return localProvider_1.LocalProvider; } });
|
|
66
|
+
Object.defineProperty(exports, "LocalProviderManager", { enumerable: true, get: function () { return localProvider_1.LocalProviderManager; } });
|
|
67
|
+
Object.defineProperty(exports, "createOllamaProvider", { enumerable: true, get: function () { return localProvider_1.createOllamaProvider; } });
|
|
68
|
+
Object.defineProperty(exports, "createVLLMProvider", { enumerable: true, get: function () { return localProvider_1.createVLLMProvider; } });
|
|
69
|
+
Object.defineProperty(exports, "createLMStudioProvider", { enumerable: true, get: function () { return localProvider_1.createLMStudioProvider; } });
|
|
70
|
+
const batchProcessor_1 = require("./utils/batchProcessor");
|
|
71
|
+
Object.defineProperty(exports, "BatchProcessor", { enumerable: true, get: function () { return batchProcessor_1.BatchProcessor; } });
|
|
72
|
+
Object.defineProperty(exports, "executeBatch", { enumerable: true, get: function () { return batchProcessor_1.executeBatch; } });
|
|
73
|
+
const advancedRouter_1 = require("./routing/advancedRouter");
|
|
74
|
+
Object.defineProperty(exports, "routeQuery", { enumerable: true, get: function () { return advancedRouter_1.routeQuery; } });
|
|
75
|
+
Object.defineProperty(exports, "routeBatch", { enumerable: true, get: function () { return advancedRouter_1.routeBatch; } });
|
|
76
|
+
Object.defineProperty(exports, "recommendForTask", { enumerable: true, get: function () { return advancedRouter_1.recommendForTask; } });
|
|
77
|
+
Object.defineProperty(exports, "extractQueryFeatures", { enumerable: true, get: function () { return advancedRouter_1.extractQueryFeatures; } });
|
|
78
|
+
Object.defineProperty(exports, "updateModelProfile", { enumerable: true, get: function () { return advancedRouter_1.updateModelProfile; } });
|
|
79
|
+
Object.defineProperty(exports, "MODEL_PROFILES", { enumerable: true, get: function () { return advancedRouter_1.MODEL_PROFILES; } });
|
|
80
|
+
const prefixCache_1 = require("./cache/prefixCache");
|
|
81
|
+
Object.defineProperty(exports, "PrefixCache", { enumerable: true, get: function () { return prefixCache_1.PrefixCache; } });
|
|
82
|
+
Object.defineProperty(exports, "createWarmedCache", { enumerable: true, get: function () { return prefixCache_1.createWarmedCache; } });
|
|
83
|
+
const speculativeDecoding_1 = require("./utils/speculativeDecoding");
|
|
84
|
+
Object.defineProperty(exports, "SpeculativeDecoder", { enumerable: true, get: function () { return speculativeDecoding_1.SpeculativeDecoder; } });
|
|
85
|
+
Object.defineProperty(exports, "speculativeBatch", { enumerable: true, get: function () { return speculativeDecoding_1.speculativeBatch; } });
|
|
86
|
+
Object.defineProperty(exports, "estimateSpeedupPotential", { enumerable: true, get: function () { return speculativeDecoding_1.estimateSpeedupPotential; } });
|
|
87
|
+
Object.defineProperty(exports, "MedusaPredictor", { enumerable: true, get: function () { return speculativeDecoding_1.MedusaPredictor; } });
|
|
88
|
+
Object.defineProperty(exports, "EagleSpeculative", { enumerable: true, get: function () { return speculativeDecoding_1.EagleSpeculative; } });
|
|
89
|
+
// PI Tool definitions (for PI agent integration)
|
|
90
|
+
exports.TMLPD_PI_TOOLS = [
|
|
91
|
+
{
|
|
92
|
+
name: "tmlpd_execute",
|
|
93
|
+
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.",
|
|
94
|
+
inputSchema: {
|
|
95
|
+
type: "object",
|
|
96
|
+
properties: {
|
|
97
|
+
prompt: { type: "string", description: "The prompt to execute" },
|
|
98
|
+
models: { type: "array", items: { type: "string" }, description: "Optional model list (auto-selects if omitted)" },
|
|
99
|
+
streaming: { type: "object", properties: { enabled: { type: "boolean" }, chunk_size: { type: "number" } } }
|
|
100
|
+
},
|
|
101
|
+
required: ["prompt"]
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: "tmlpd_execute_single",
|
|
106
|
+
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.",
|
|
107
|
+
inputSchema: {
|
|
108
|
+
type: "object",
|
|
109
|
+
properties: {
|
|
110
|
+
prompt: { type: "string", description: "The prompt to execute" },
|
|
111
|
+
model: { type: "string", description: "Optional specific model" }
|
|
112
|
+
},
|
|
113
|
+
required: ["prompt"]
|
|
114
|
+
}
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "tmlpd_cost_summary",
|
|
118
|
+
description: "Get real-time cost tracking summary. Shows spending by provider, model, daily/monthly breakdowns, and remaining budget. Essential for cost monitoring in production.",
|
|
119
|
+
inputSchema: { type: "object", properties: {} }
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
name: "tmlpd_cache_stats",
|
|
123
|
+
description: "Get response cache statistics. Shows hit rate, cache size, and effectiveness. Cache hits cost $0 and provide instant responses.",
|
|
124
|
+
inputSchema: { type: "object", properties: {} }
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
name: "tmlpd_provider_status",
|
|
128
|
+
description: "Get status of all configured LLM providers. Shows readiness, cooldown status, failure counts. Use for debugging or selecting specific providers.",
|
|
129
|
+
inputSchema: { type: "object", properties: {} }
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: "tmlpd_invalidate_cache",
|
|
133
|
+
description: "Invalidate cached responses. Use when prompt content has changed and fresh response needed, or to clear stale cache entries.",
|
|
134
|
+
inputSchema: {
|
|
135
|
+
type: "object",
|
|
136
|
+
properties: { model: { type: "string", description: "Optional model to invalidate (all if omitted)" } }
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
name: "tmlpd_get_budget",
|
|
141
|
+
description: "Get remaining budget for cost controls. Returns daily, monthly, and per-model limits. Use for budget enforcement and alerting.",
|
|
142
|
+
inputSchema: { type: "object", properties: {} }
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: "tmlpd_halo_execute",
|
|
146
|
+
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.",
|
|
147
|
+
inputSchema: {
|
|
148
|
+
type: "object",
|
|
149
|
+
properties: {
|
|
150
|
+
task_description: { type: "string", description: "Task to execute" },
|
|
151
|
+
max_concurrent: { type: "number", description: "Max parallel executions (default: 3)" },
|
|
152
|
+
enable_mcts: { type: "boolean", description: "Enable MCTS optimization (slower but better)" }
|
|
153
|
+
},
|
|
154
|
+
required: ["task_description"]
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
name: "tmlpd_episodic_query",
|
|
159
|
+
description: "Query episodic memory for similar past tasks. Useful for learning from past executions and improving future routing decisions.",
|
|
160
|
+
inputSchema: {
|
|
161
|
+
type: "object",
|
|
162
|
+
properties: {
|
|
163
|
+
task_description: { type: "string", description: "Task to find similar executions for" },
|
|
164
|
+
limit: { type: "number", description: "Max results (default: 5)" }
|
|
165
|
+
},
|
|
166
|
+
required: ["task_description"]
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
name: "tmlpd_count_tokens",
|
|
171
|
+
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.",
|
|
172
|
+
inputSchema: {
|
|
173
|
+
type: "object",
|
|
174
|
+
properties: {
|
|
175
|
+
text: { type: "string", description: "Text to count tokens in" },
|
|
176
|
+
model: { type: "string", description: "Model for tokenization (default: gpt-4o)" }
|
|
177
|
+
},
|
|
178
|
+
required: ["text"]
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
name: "tmlpd_compress_context",
|
|
183
|
+
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.",
|
|
184
|
+
inputSchema: {
|
|
185
|
+
type: "object",
|
|
186
|
+
properties: {
|
|
187
|
+
messages: { type: "array", description: "Messages to compress", items: { type: "object" } },
|
|
188
|
+
strategy: { type: "string", enum: ["smart", "first", "last"], description: "Compression strategy (default: smart)" },
|
|
189
|
+
max_tokens: { type: "number", description: "Target token budget" }
|
|
190
|
+
},
|
|
191
|
+
required: ["messages"]
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
name: "tmlpd_local_generate",
|
|
196
|
+
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.",
|
|
197
|
+
inputSchema: {
|
|
198
|
+
type: "object",
|
|
199
|
+
properties: {
|
|
200
|
+
prompt: { type: "string", description: "Prompt for generation" },
|
|
201
|
+
runtime: { type: "string", enum: ["ollama", "vllm", "lmstudio"], description: "Local runtime type" },
|
|
202
|
+
model: { type: "string", description: "Model name (default: llama-3.3-70b)" }
|
|
203
|
+
},
|
|
204
|
+
required: ["prompt", "runtime"]
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
name: "tmlpd_batch_execute",
|
|
209
|
+
description: "Execute batch of prompts with concurrency control. Supports priority queuing, progress callbacks, rate limiting. Use for processing multiple prompts efficiently.",
|
|
210
|
+
inputSchema: {
|
|
211
|
+
type: "object",
|
|
212
|
+
properties: {
|
|
213
|
+
prompts: { type: "array", items: { type: "string" }, description: "Prompts to execute" },
|
|
214
|
+
concurrency: { type: "number", description: "Max parallel executions (default: 5)" },
|
|
215
|
+
model: { type: "string", description: "Model to use (default: gpt-4o)" }
|
|
216
|
+
},
|
|
217
|
+
required: ["prompts"]
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
];
|
|
221
|
+
/**
|
|
222
|
+
* Reference to Full TMLPD
|
|
223
|
+
*
|
|
224
|
+
* This package provides:
|
|
225
|
+
* - Core: streaming, caching, cost tracking, reliability
|
|
226
|
+
* - Reference: episodic memory, MCTS, HALO orchestrator
|
|
227
|
+
*
|
|
228
|
+
* For production with full features:
|
|
229
|
+
* - Python TMLPD: https://github.com/Das-rebel/tmlpd-skill
|
|
230
|
+
* - Full memory: 3-tier (episodic + semantic + working)
|
|
231
|
+
* - Full MCTS: UCB1, deterministic rollouts, strategy caching
|
|
232
|
+
* - Full HALO: NLP decomposition, capability matching, verification
|
|
233
|
+
*/
|
|
234
|
+
exports.default = {
|
|
235
|
+
createTMLPD: tmlpdTools_1.createTMLPD,
|
|
236
|
+
TMLPDTools: tmlpdTools_1.TMLPDTools,
|
|
237
|
+
TMLPD_PI_TOOLS: exports.TMLPD_PI_TOOLS
|
|
238
|
+
};
|
|
239
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,+FAjB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AAE,WAAW,EAAE,oBAAoB,EAAE;gBACpG,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,qCAAqC,EAAE;aAC9E;YACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;SAChC;KACF;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"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TMLPD Episodic Memory Store
|
|
3
|
+
*
|
|
4
|
+
* Stores specific task executions with full context.
|
|
5
|
+
* Reference implementation - for full features see TMLPD v2.x
|
|
6
|
+
*
|
|
7
|
+
* Full TMLPD includes:
|
|
8
|
+
* - JSON-based episodic storage with keyword indexing
|
|
9
|
+
* - Importance scoring and time-based decay
|
|
10
|
+
* - Episodic retrieval by task similarity
|
|
11
|
+
*/
|
|
12
|
+
export interface EpisodicEntry {
|
|
13
|
+
id: string;
|
|
14
|
+
timestamp: number;
|
|
15
|
+
task: {
|
|
16
|
+
description: string;
|
|
17
|
+
type: string;
|
|
18
|
+
complexity: number;
|
|
19
|
+
};
|
|
20
|
+
result: {
|
|
21
|
+
success: boolean;
|
|
22
|
+
output: string;
|
|
23
|
+
duration_ms: number;
|
|
24
|
+
};
|
|
25
|
+
agent: {
|
|
26
|
+
id: string;
|
|
27
|
+
model: string;
|
|
28
|
+
provider: string;
|
|
29
|
+
};
|
|
30
|
+
metadata: Record<string, any>;
|
|
31
|
+
importance: number;
|
|
32
|
+
}
|
|
33
|
+
export interface MemoryQuery {
|
|
34
|
+
task_type?: string;
|
|
35
|
+
keywords?: string[];
|
|
36
|
+
limit?: number;
|
|
37
|
+
}
|
|
38
|
+
export declare class EpisodicMemoryStore {
|
|
39
|
+
private entries;
|
|
40
|
+
private maxEntries;
|
|
41
|
+
private keywordIndex;
|
|
42
|
+
constructor(maxEntries?: number);
|
|
43
|
+
/**
|
|
44
|
+
* Store an episodic memory
|
|
45
|
+
*/
|
|
46
|
+
store(entry: Omit<EpisodicEntry, "id" | "timestamp">): string;
|
|
47
|
+
/**
|
|
48
|
+
* Query episodic memories
|
|
49
|
+
*/
|
|
50
|
+
query(query: MemoryQuery): EpisodicEntry[];
|
|
51
|
+
/**
|
|
52
|
+
* Get similar tasks (for learning)
|
|
53
|
+
*/
|
|
54
|
+
getSimilarTasks(taskDescription: string, limit?: number): EpisodicEntry[];
|
|
55
|
+
/**
|
|
56
|
+
* Get statistics
|
|
57
|
+
*/
|
|
58
|
+
getStats(): {
|
|
59
|
+
total_entries: number;
|
|
60
|
+
indexed_keywords: number;
|
|
61
|
+
success_rate: number;
|
|
62
|
+
avg_duration_ms: number;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Clear all memories
|
|
66
|
+
*/
|
|
67
|
+
clear(): void;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Reference to Full TMLPD Memory System
|
|
71
|
+
*
|
|
72
|
+
* For production use with full features:
|
|
73
|
+
* - Install: npm install tmlpd-skill (Python)
|
|
74
|
+
* - Or integrate with tmlpd-clean/src/memory/
|
|
75
|
+
*
|
|
76
|
+
* Full features include:
|
|
77
|
+
* - Semantic memory with ChromaDB vector embeddings
|
|
78
|
+
* - Time-based importance decay (A-Mem pattern)
|
|
79
|
+
* - Cross-session learning
|
|
80
|
+
* - Episodic + Semantic + Working 3-tier architecture
|
|
81
|
+
*/
|
|
82
|
+
//# sourceMappingURL=episodicMemory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"episodicMemory.d.ts","sourceRoot":"","sources":["../../src/memory/episodicMemory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE;QACJ,WAAW,EAAE,MAAM,CAAC;QACpB,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,MAAM,EAAE;QACN,OAAO,EAAE,OAAO,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,KAAK,EAAE;QACL,EAAE,EAAE,MAAM,CAAC;QACX,KAAK,EAAE,MAAM,CAAC;QACd,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,OAAO,CAAuB;IACtC,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,YAAY,CAAwB;gBAEhC,UAAU,SAAO;IAK7B;;OAEG;IACH,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,GAAG,WAAW,CAAC,GAAG,MAAM;IAyC7D;;OAEG;IACH,KAAK,CAAC,KAAK,EAAE,WAAW,GAAG,aAAa,EAAE;IAyB1C;;OAEG;IACH,eAAe,CAAC,eAAe,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,aAAa,EAAE;IAwBpE;;OAEG;IACH,QAAQ;;;;;;IASR;;OAEG;IACH,KAAK;CAIN;AAED;;;;;;;;;;;;GAYG"}
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* TMLPD Episodic Memory Store
|
|
4
|
+
*
|
|
5
|
+
* Stores specific task executions with full context.
|
|
6
|
+
* Reference implementation - for full features see TMLPD v2.x
|
|
7
|
+
*
|
|
8
|
+
* Full TMLPD includes:
|
|
9
|
+
* - JSON-based episodic storage with keyword indexing
|
|
10
|
+
* - Importance scoring and time-based decay
|
|
11
|
+
* - Episodic retrieval by task similarity
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.EpisodicMemoryStore = void 0;
|
|
15
|
+
const nanoid_1 = require("nanoid");
|
|
16
|
+
class EpisodicMemoryStore {
|
|
17
|
+
entries = [];
|
|
18
|
+
maxEntries;
|
|
19
|
+
keywordIndex;
|
|
20
|
+
constructor(maxEntries = 1000) {
|
|
21
|
+
this.maxEntries = maxEntries;
|
|
22
|
+
this.keywordIndex = new Map();
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Store an episodic memory
|
|
26
|
+
*/
|
|
27
|
+
store(entry) {
|
|
28
|
+
const id = (0, nanoid_1.nanoid)(12);
|
|
29
|
+
const fullEntry = {
|
|
30
|
+
...entry,
|
|
31
|
+
id,
|
|
32
|
+
timestamp: Date.now()
|
|
33
|
+
};
|
|
34
|
+
this.entries.push(fullEntry);
|
|
35
|
+
// Index keywords
|
|
36
|
+
if (entry.task.description) {
|
|
37
|
+
const words = entry.task.description.toLowerCase().split(/\s+/);
|
|
38
|
+
words.forEach(word => {
|
|
39
|
+
if (word.length > 3) {
|
|
40
|
+
const existing = this.keywordIndex.get(word) || [];
|
|
41
|
+
existing.push(id);
|
|
42
|
+
this.keywordIndex.set(word, existing);
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
// Evict oldest if at capacity
|
|
47
|
+
if (this.entries.length > this.maxEntries) {
|
|
48
|
+
const evicted = this.entries.shift();
|
|
49
|
+
if (evicted) {
|
|
50
|
+
// Clean up keyword index for evicted entry
|
|
51
|
+
for (const [word, ids] of this.keywordIndex.entries()) {
|
|
52
|
+
const filtered = ids.filter(existingId => existingId !== evicted.id);
|
|
53
|
+
if (filtered.length === 0) {
|
|
54
|
+
this.keywordIndex.delete(word);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
this.keywordIndex.set(word, filtered);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return id;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Query episodic memories
|
|
66
|
+
*/
|
|
67
|
+
query(query) {
|
|
68
|
+
let results = [...this.entries];
|
|
69
|
+
if (query.task_type) {
|
|
70
|
+
results = results.filter(e => e.task.type === query.task_type);
|
|
71
|
+
}
|
|
72
|
+
if (query.keywords && query.keywords.length > 0) {
|
|
73
|
+
const matchingIds = new Set();
|
|
74
|
+
query.keywords.forEach(kw => {
|
|
75
|
+
const lower = kw.toLowerCase();
|
|
76
|
+
for (const [word, ids] of this.keywordIndex.entries()) {
|
|
77
|
+
if (word.includes(lower)) {
|
|
78
|
+
ids.forEach(id => matchingIds.add(id));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
if (matchingIds.size > 0) {
|
|
83
|
+
results = results.filter(e => matchingIds.has(e.id));
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return results.slice(-(query.limit || 10));
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get similar tasks (for learning)
|
|
90
|
+
*/
|
|
91
|
+
getSimilarTasks(taskDescription, limit = 5) {
|
|
92
|
+
const words = taskDescription.toLowerCase().split(/\s+/);
|
|
93
|
+
const scores = new Map();
|
|
94
|
+
this.entries.forEach(entry => {
|
|
95
|
+
let score = 0;
|
|
96
|
+
const entryWords = entry.task.description.toLowerCase().split(/\s+/);
|
|
97
|
+
words.forEach(w => {
|
|
98
|
+
if (entryWords.includes(w))
|
|
99
|
+
score++;
|
|
100
|
+
});
|
|
101
|
+
if (score > 0) {
|
|
102
|
+
scores.set(entry.id, score);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
const sorted = Array.from(scores.entries())
|
|
106
|
+
.sort((a, b) => b[1] - a[1])
|
|
107
|
+
.slice(0, limit)
|
|
108
|
+
.map(([id]) => this.entries.find(e => e.id === id))
|
|
109
|
+
.filter(Boolean);
|
|
110
|
+
return sorted;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Get statistics
|
|
114
|
+
*/
|
|
115
|
+
getStats() {
|
|
116
|
+
return {
|
|
117
|
+
total_entries: this.entries.length,
|
|
118
|
+
indexed_keywords: this.keywordIndex.size,
|
|
119
|
+
success_rate: this.entries.filter(e => e.result.success).length / Math.max(1, this.entries.length),
|
|
120
|
+
avg_duration_ms: this.entries.reduce((sum, e) => sum + e.result.duration_ms, 0) / Math.max(1, this.entries.length)
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Clear all memories
|
|
125
|
+
*/
|
|
126
|
+
clear() {
|
|
127
|
+
this.entries = [];
|
|
128
|
+
this.keywordIndex.clear();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.EpisodicMemoryStore = EpisodicMemoryStore;
|
|
132
|
+
/**
|
|
133
|
+
* Reference to Full TMLPD Memory System
|
|
134
|
+
*
|
|
135
|
+
* For production use with full features:
|
|
136
|
+
* - Install: npm install tmlpd-skill (Python)
|
|
137
|
+
* - Or integrate with tmlpd-clean/src/memory/
|
|
138
|
+
*
|
|
139
|
+
* Full features include:
|
|
140
|
+
* - Semantic memory with ChromaDB vector embeddings
|
|
141
|
+
* - Time-based importance decay (A-Mem pattern)
|
|
142
|
+
* - Cross-session learning
|
|
143
|
+
* - Episodic + Semantic + Working 3-tier architecture
|
|
144
|
+
*/
|
|
145
|
+
//# sourceMappingURL=episodicMemory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"episodicMemory.js","sourceRoot":"","sources":["../../src/memory/episodicMemory.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAEH,mCAAgC;AA8BhC,MAAa,mBAAmB;IACtB,OAAO,GAAoB,EAAE,CAAC;IAC9B,UAAU,CAAS;IACnB,YAAY,CAAwB;IAE5C,YAAY,UAAU,GAAG,IAAI;QAC3B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,YAAY,GAAG,IAAI,GAAG,EAAE,CAAC;IAChC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAA8C;QAClD,MAAM,EAAE,GAAG,IAAA,eAAM,EAAC,EAAE,CAAC,CAAC;QACtB,MAAM,SAAS,GAAkB;YAC/B,GAAG,KAAK;YACR,EAAE;YACF,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;SACtB,CAAC;QAEF,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAE7B,iBAAiB;QACjB,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;YAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAChE,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBACnB,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACpB,MAAM,QAAQ,G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CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;SACnH,CAAC;IACJ,CAAC;IAED;;OAEG;IACH,KAAK;QACH,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;CACF;AAhID,kDAgIC;AAED;;;;;;;;;;;;GAYG"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TMLPD HALO Orchestrator Reference
|
|
3
|
+
*
|
|
4
|
+
* Hierarchical Autonomous Logic-Oriented Orchestration
|
|
5
|
+
*
|
|
6
|
+
* Reference implementation - for full features see TMLPD v2.x
|
|
7
|
+
*
|
|
8
|
+
* Full TMLPD includes:
|
|
9
|
+
* - 3-tier hierarchical planning
|
|
10
|
+
* - TaskPlanner: Decompose with dependencies
|
|
11
|
+
* - RoleAssigner: Specialized agent assignment
|
|
12
|
+
* - ExecutionEngine: Parallel with verification
|
|
13
|
+
* - 19.6% improvement on complex tasks
|
|
14
|
+
*/
|
|
15
|
+
export interface SubTask {
|
|
16
|
+
id: string;
|
|
17
|
+
description: string;
|
|
18
|
+
dependencies: string[];
|
|
19
|
+
estimatedComplexity: number;
|
|
20
|
+
}
|
|
21
|
+
export interface AgentAssignment {
|
|
22
|
+
subtaskId: string;
|
|
23
|
+
agentId: string;
|
|
24
|
+
model: string;
|
|
25
|
+
estimatedDuration: number;
|
|
26
|
+
}
|
|
27
|
+
export interface ExecutionResult {
|
|
28
|
+
subtaskId: string;
|
|
29
|
+
success: boolean;
|
|
30
|
+
output: string;
|
|
31
|
+
duration_ms: number;
|
|
32
|
+
}
|
|
33
|
+
export interface HALOConfig {
|
|
34
|
+
maxConcurrent: number;
|
|
35
|
+
optimizationTarget: "quality" | "cost" | "balanced";
|
|
36
|
+
enableMCTS: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* HALO Orchestrator
|
|
40
|
+
*
|
|
41
|
+
* Hierarchical orchestration with 3 tiers:
|
|
42
|
+
* 1. Plan: Decompose task into subtasks with dependencies
|
|
43
|
+
* 2. Assign: Match subtasks to optimal agents
|
|
44
|
+
* 3. Execute: Run in parallel with result verification
|
|
45
|
+
*/
|
|
46
|
+
export declare class HALOOrchestrator {
|
|
47
|
+
private config;
|
|
48
|
+
private memory;
|
|
49
|
+
private mcts;
|
|
50
|
+
constructor(config?: Partial<HALOConfig>);
|
|
51
|
+
/**
|
|
52
|
+
* Execute task with HALO orchestration
|
|
53
|
+
*/
|
|
54
|
+
execute(taskDescription: string, executeFn: (subtask: SubTask, agentId: string) => Promise<ExecutionResult>): Promise<{
|
|
55
|
+
success: boolean;
|
|
56
|
+
results: ExecutionResult[];
|
|
57
|
+
strategy: Record<string, string>;
|
|
58
|
+
metadata: any;
|
|
59
|
+
}>;
|
|
60
|
+
/**
|
|
61
|
+
* Decompose task into subtasks
|
|
62
|
+
*/
|
|
63
|
+
decomposeTask(taskDescription: string): SubTask[];
|
|
64
|
+
/**
|
|
65
|
+
* Classify task type
|
|
66
|
+
*/
|
|
67
|
+
classifyTask(description: string): string;
|
|
68
|
+
/**
|
|
69
|
+
* Quick agent assignment without MCTS
|
|
70
|
+
*/
|
|
71
|
+
quickAssign(subtasks: SubTask[]): Record<string, string>;
|
|
72
|
+
/**
|
|
73
|
+
* Optimize assignment with MCTS
|
|
74
|
+
*/
|
|
75
|
+
private optimizeWithMCTS;
|
|
76
|
+
/**
|
|
77
|
+
* Execute subtasks in parallel with concurrency limit
|
|
78
|
+
*/
|
|
79
|
+
private executeParallel;
|
|
80
|
+
/**
|
|
81
|
+
* Get memory statistics
|
|
82
|
+
*/
|
|
83
|
+
getMemoryStats(): {
|
|
84
|
+
total_entries: number;
|
|
85
|
+
indexed_keywords: number;
|
|
86
|
+
success_rate: number;
|
|
87
|
+
avg_duration_ms: number;
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Reference to Full TMLPD HALO
|
|
92
|
+
*
|
|
93
|
+
* Full implementation in tmlpd-clean/src/orchestration/halo_orchestrator.py
|
|
94
|
+
*
|
|
95
|
+
* Features:
|
|
96
|
+
* - NLP-based task decomposition
|
|
97
|
+
* - Dependency graph resolution
|
|
98
|
+
* - Agent capability matching
|
|
99
|
+
* - Result verification and retry
|
|
100
|
+
* - Multi-round refinement for low confidence
|
|
101
|
+
*/
|
|
102
|
+
//# sourceMappingURL=haloOrchestrator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"haloOrchestrator.d.ts","sourceRoot":"","sources":["../../src/orchestration/haloOrchestrator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,kBAAkB,EAAE,SAAS,GAAG,MAAM,GAAG,UAAU,CAAC;IACpD,UAAU,EAAE,OAAO,CAAC;CACrB;AAQD;;;;;;;GAOG;AACH,qBAAa,gBAAgB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