bigtool-ts 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/LICENSE +21 -0
- package/README.md +641 -0
- package/dist/adapters/agent-protocol.d.ts +149 -0
- package/dist/adapters/agent-protocol.d.ts.map +1 -0
- package/dist/adapters/agent-protocol.js +133 -0
- package/dist/adapters/agent-protocol.js.map +1 -0
- package/dist/adapters/index.d.ts +39 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +42 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/inngest.d.ts +234 -0
- package/dist/adapters/inngest.d.ts.map +1 -0
- package/dist/adapters/inngest.js +276 -0
- package/dist/adapters/inngest.js.map +1 -0
- package/dist/adapters/mastra.d.ts +201 -0
- package/dist/adapters/mastra.d.ts.map +1 -0
- package/dist/adapters/mastra.js +250 -0
- package/dist/adapters/mastra.js.map +1 -0
- package/dist/adapters/types.d.ts +42 -0
- package/dist/adapters/types.d.ts.map +1 -0
- package/dist/adapters/types.js +6 -0
- package/dist/adapters/types.js.map +1 -0
- package/dist/adapters/vercel-ai.d.ts +176 -0
- package/dist/adapters/vercel-ai.d.ts.map +1 -0
- package/dist/adapters/vercel-ai.js +244 -0
- package/dist/adapters/vercel-ai.js.map +1 -0
- package/dist/catalog/index.d.ts +177 -0
- package/dist/catalog/index.d.ts.map +1 -0
- package/dist/catalog/index.js +244 -0
- package/dist/catalog/index.js.map +1 -0
- package/dist/graph/agent.d.ts +214 -0
- package/dist/graph/agent.d.ts.map +1 -0
- package/dist/graph/agent.js +196 -0
- package/dist/graph/agent.js.map +1 -0
- package/dist/graph/index.d.ts +5 -0
- package/dist/graph/index.d.ts.map +1 -0
- package/dist/graph/index.js +4 -0
- package/dist/graph/index.js.map +1 -0
- package/dist/graph/nodes.d.ts +100 -0
- package/dist/graph/nodes.d.ts.map +1 -0
- package/dist/graph/nodes.js +190 -0
- package/dist/graph/nodes.js.map +1 -0
- package/dist/graph/search-tool.d.ts +34 -0
- package/dist/graph/search-tool.d.ts.map +1 -0
- package/dist/graph/search-tool.js +54 -0
- package/dist/graph/search-tool.js.map +1 -0
- package/dist/graph/state.d.ts +26 -0
- package/dist/graph/state.d.ts.map +1 -0
- package/dist/graph/state.js +29 -0
- package/dist/graph/state.js.map +1 -0
- package/dist/index.d.ts +69 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +85 -0
- package/dist/index.js.map +1 -0
- package/dist/loader/index.d.ts +172 -0
- package/dist/loader/index.d.ts.map +1 -0
- package/dist/loader/index.js +179 -0
- package/dist/loader/index.js.map +1 -0
- package/dist/loader/loader.d.ts +114 -0
- package/dist/loader/loader.d.ts.map +1 -0
- package/dist/loader/loader.js +185 -0
- package/dist/loader/loader.js.map +1 -0
- package/dist/search/cache.d.ts +76 -0
- package/dist/search/cache.d.ts.map +1 -0
- package/dist/search/cache.js +135 -0
- package/dist/search/cache.js.map +1 -0
- package/dist/search/index.d.ts +63 -0
- package/dist/search/index.d.ts.map +1 -0
- package/dist/search/index.js +122 -0
- package/dist/search/index.js.map +1 -0
- package/dist/search/normalize.d.ts +104 -0
- package/dist/search/normalize.d.ts.map +1 -0
- package/dist/search/normalize.js +211 -0
- package/dist/search/normalize.js.map +1 -0
- package/dist/search/orama.d.ts +256 -0
- package/dist/search/orama.d.ts.map +1 -0
- package/dist/search/orama.js +511 -0
- package/dist/search/orama.js.map +1 -0
- package/dist/search/types.d.ts +96 -0
- package/dist/search/types.d.ts.map +1 -0
- package/dist/search/types.js +8 -0
- package/dist/search/types.js.map +1 -0
- package/dist/sources/dynamic.d.ts +200 -0
- package/dist/sources/dynamic.d.ts.map +1 -0
- package/dist/sources/dynamic.js +194 -0
- package/dist/sources/dynamic.js.map +1 -0
- package/dist/sources/index.d.ts +11 -0
- package/dist/sources/index.d.ts.map +1 -0
- package/dist/sources/index.js +14 -0
- package/dist/sources/index.js.map +1 -0
- package/dist/sources/local.d.ts +128 -0
- package/dist/sources/local.d.ts.map +1 -0
- package/dist/sources/local.js +155 -0
- package/dist/sources/local.js.map +1 -0
- package/dist/sources/mcp.d.ts +438 -0
- package/dist/sources/mcp.d.ts.map +1 -0
- package/dist/sources/mcp.js +438 -0
- package/dist/sources/mcp.js.map +1 -0
- package/dist/sources/types.d.ts +16 -0
- package/dist/sources/types.d.ts.map +1 -0
- package/dist/sources/types.js +7 -0
- package/dist/sources/types.js.map +1 -0
- package/dist/sources/with-metadata.d.ts +7 -0
- package/dist/sources/with-metadata.d.ts.map +1 -0
- package/dist/sources/with-metadata.js +7 -0
- package/dist/sources/with-metadata.js.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +8 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types.d.ts +700 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +97 -0
- package/dist/types.js.map +1 -0
- package/package.json +118 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToolLoader module.
|
|
3
|
+
*
|
|
4
|
+
* Provides lazy loading of tool implementations with LRU caching.
|
|
5
|
+
* The loader bridges the gap between tool metadata (catalog) and
|
|
6
|
+
* actual tool implementations (sources).
|
|
7
|
+
*
|
|
8
|
+
* @module loader
|
|
9
|
+
*/
|
|
10
|
+
import type { StructuredTool } from '@langchain/core/tools';
|
|
11
|
+
import type { ToolLoader, ToolCatalog } from '../types.js';
|
|
12
|
+
/**
|
|
13
|
+
* Configuration options for DefaultToolLoader.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const options: ToolLoaderOptions = {
|
|
18
|
+
* maxSize: 50, // Cache up to 50 tools
|
|
19
|
+
* ttl: 300000, // Expire after 5 minutes
|
|
20
|
+
* };
|
|
21
|
+
* ```
|
|
22
|
+
*/
|
|
23
|
+
export interface ToolLoaderOptions {
|
|
24
|
+
/**
|
|
25
|
+
* Maximum number of tools to cache.
|
|
26
|
+
*
|
|
27
|
+
* When the limit is reached, least recently used tools are evicted.
|
|
28
|
+
*
|
|
29
|
+
* @default 100
|
|
30
|
+
*/
|
|
31
|
+
maxSize?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Time-to-live for cached tools in milliseconds.
|
|
34
|
+
*
|
|
35
|
+
* After this time, tools are evicted from cache and reloaded
|
|
36
|
+
* from source on next access.
|
|
37
|
+
*
|
|
38
|
+
* @default undefined (no expiry)
|
|
39
|
+
*/
|
|
40
|
+
ttl?: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Default tool loader with LRU caching.
|
|
44
|
+
*
|
|
45
|
+
* Caches loaded tools to avoid repeated loading from sources.
|
|
46
|
+
* Uses an LRU (Least Recently Used) eviction policy when the
|
|
47
|
+
* cache is full.
|
|
48
|
+
*
|
|
49
|
+
* The loader:
|
|
50
|
+
* 1. Checks cache for existing tool
|
|
51
|
+
* 2. If not cached, looks up metadata in catalog
|
|
52
|
+
* 3. Gets the source from the catalog
|
|
53
|
+
* 4. Loads the tool from the source
|
|
54
|
+
* 5. Caches and returns the tool
|
|
55
|
+
*
|
|
56
|
+
* @example Basic usage
|
|
57
|
+
* ```typescript
|
|
58
|
+
* import { DefaultToolLoader } from '@repo/bigtool-ts';
|
|
59
|
+
*
|
|
60
|
+
* const loader = new DefaultToolLoader(catalog, { maxSize: 50 });
|
|
61
|
+
*
|
|
62
|
+
* // Load a tool
|
|
63
|
+
* const tool = await loader.load('github:create_pr');
|
|
64
|
+
*
|
|
65
|
+
* // Tool is now cached - subsequent loads are instant
|
|
66
|
+
* const sameTool = await loader.load('github:create_pr');
|
|
67
|
+
* ```
|
|
68
|
+
*
|
|
69
|
+
* @example With TTL
|
|
70
|
+
* ```typescript
|
|
71
|
+
* const loader = new DefaultToolLoader(catalog, {
|
|
72
|
+
* maxSize: 100,
|
|
73
|
+
* ttl: 5 * 60 * 1000, // 5 minutes
|
|
74
|
+
* });
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export declare class DefaultToolLoader implements ToolLoader {
|
|
78
|
+
/** @internal The tool catalog for metadata lookup */
|
|
79
|
+
private catalog;
|
|
80
|
+
/** @internal LRU cache for loaded tools */
|
|
81
|
+
private cache;
|
|
82
|
+
/**
|
|
83
|
+
* Creates a new DefaultToolLoader.
|
|
84
|
+
*
|
|
85
|
+
* @param catalog - The tool catalog for metadata and source lookup
|
|
86
|
+
* @param options - Cache configuration options
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* const loader = new DefaultToolLoader(catalog);
|
|
91
|
+
* const loaderWithOptions = new DefaultToolLoader(catalog, { maxSize: 50 });
|
|
92
|
+
* ```
|
|
93
|
+
*/
|
|
94
|
+
constructor(catalog: ToolCatalog, options?: ToolLoaderOptions);
|
|
95
|
+
/**
|
|
96
|
+
* Load a tool by ID.
|
|
97
|
+
*
|
|
98
|
+
* Returns cached tool if available, otherwise loads from source.
|
|
99
|
+
*
|
|
100
|
+
* @param id - The tool ID to load
|
|
101
|
+
* @returns Promise resolving to the loaded tool
|
|
102
|
+
* @throws Error if tool not found in catalog or source returns null
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const tool = await loader.load('github:create_pr');
|
|
107
|
+
* const result = await tool.invoke({ title: 'My PR' });
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
load(id: string): Promise<StructuredTool>;
|
|
111
|
+
/**
|
|
112
|
+
* Pre-load multiple tools in parallel.
|
|
113
|
+
*
|
|
114
|
+
* Useful for warming up the cache before a batch of operations.
|
|
115
|
+
* Errors are silently ignored—use load() for error handling.
|
|
116
|
+
*
|
|
117
|
+
* @param ids - Array of tool IDs to pre-load
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```typescript
|
|
121
|
+
* // Warm up cache with expected tools
|
|
122
|
+
* await loader.warmup([
|
|
123
|
+
* 'github:create_pr',
|
|
124
|
+
* 'github:list_repos',
|
|
125
|
+
* 'github:get_issues',
|
|
126
|
+
* ]);
|
|
127
|
+
* ```
|
|
128
|
+
*/
|
|
129
|
+
warmup(ids: string[]): Promise<void>;
|
|
130
|
+
/**
|
|
131
|
+
* Remove a tool from the cache.
|
|
132
|
+
*
|
|
133
|
+
* The tool will be reloaded from source on next access.
|
|
134
|
+
*
|
|
135
|
+
* @param id - The tool ID to evict
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* // Invalidate after tool update
|
|
140
|
+
* loader.evict('github:create_pr');
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
evict(id: string): void;
|
|
144
|
+
/**
|
|
145
|
+
* Clear the entire cache.
|
|
146
|
+
*
|
|
147
|
+
* All tools will be reloaded from source on next access.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```typescript
|
|
151
|
+
* // Clear cache after major changes
|
|
152
|
+
* loader.clear();
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
155
|
+
clear(): void;
|
|
156
|
+
/**
|
|
157
|
+
* Get cache statistics for monitoring.
|
|
158
|
+
*
|
|
159
|
+
* @returns Object with current size and max size
|
|
160
|
+
*
|
|
161
|
+
* @example
|
|
162
|
+
* ```typescript
|
|
163
|
+
* const stats = loader.getStats();
|
|
164
|
+
* console.log(`Cache: ${stats.size}/${stats.maxSize}`);
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
getStats(): {
|
|
168
|
+
size: number;
|
|
169
|
+
maxSize: number;
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/loader/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG3D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,iBAAiB;IAChC;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;;;OAOG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,qBAAa,iBAAkB,YAAW,UAAU;IAClD,qDAAqD;IACrD,OAAO,CAAC,OAAO,CAAc;IAE7B,2CAA2C;IAC3C,OAAO,CAAC,KAAK,CAAmC;IAEhD;;;;;;;;;;;OAWG;gBACS,OAAO,EAAE,WAAW,EAAE,OAAO,GAAE,iBAAsB;IAQjE;;;;;;;;;;;;;;OAcG;IACG,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IA8B/C;;;;;;;;;;;;;;;;;OAiBG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAI1C;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAIvB;;;;;;;;;;OAUG;IACH,KAAK,IAAI,IAAI;IAIb;;;;;;;;;;OAUG;IACH,QAAQ,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;CAM9C"}
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToolLoader module.
|
|
3
|
+
*
|
|
4
|
+
* Provides lazy loading of tool implementations with LRU caching.
|
|
5
|
+
* The loader bridges the gap between tool metadata (catalog) and
|
|
6
|
+
* actual tool implementations (sources).
|
|
7
|
+
*
|
|
8
|
+
* @module loader
|
|
9
|
+
*/
|
|
10
|
+
import { LRUCache } from 'lru-cache';
|
|
11
|
+
/**
|
|
12
|
+
* Default tool loader with LRU caching.
|
|
13
|
+
*
|
|
14
|
+
* Caches loaded tools to avoid repeated loading from sources.
|
|
15
|
+
* Uses an LRU (Least Recently Used) eviction policy when the
|
|
16
|
+
* cache is full.
|
|
17
|
+
*
|
|
18
|
+
* The loader:
|
|
19
|
+
* 1. Checks cache for existing tool
|
|
20
|
+
* 2. If not cached, looks up metadata in catalog
|
|
21
|
+
* 3. Gets the source from the catalog
|
|
22
|
+
* 4. Loads the tool from the source
|
|
23
|
+
* 5. Caches and returns the tool
|
|
24
|
+
*
|
|
25
|
+
* @example Basic usage
|
|
26
|
+
* ```typescript
|
|
27
|
+
* import { DefaultToolLoader } from '@repo/bigtool-ts';
|
|
28
|
+
*
|
|
29
|
+
* const loader = new DefaultToolLoader(catalog, { maxSize: 50 });
|
|
30
|
+
*
|
|
31
|
+
* // Load a tool
|
|
32
|
+
* const tool = await loader.load('github:create_pr');
|
|
33
|
+
*
|
|
34
|
+
* // Tool is now cached - subsequent loads are instant
|
|
35
|
+
* const sameTool = await loader.load('github:create_pr');
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @example With TTL
|
|
39
|
+
* ```typescript
|
|
40
|
+
* const loader = new DefaultToolLoader(catalog, {
|
|
41
|
+
* maxSize: 100,
|
|
42
|
+
* ttl: 5 * 60 * 1000, // 5 minutes
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
*/
|
|
46
|
+
export class DefaultToolLoader {
|
|
47
|
+
/** @internal The tool catalog for metadata lookup */
|
|
48
|
+
catalog;
|
|
49
|
+
/** @internal LRU cache for loaded tools */
|
|
50
|
+
cache;
|
|
51
|
+
/**
|
|
52
|
+
* Creates a new DefaultToolLoader.
|
|
53
|
+
*
|
|
54
|
+
* @param catalog - The tool catalog for metadata and source lookup
|
|
55
|
+
* @param options - Cache configuration options
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```typescript
|
|
59
|
+
* const loader = new DefaultToolLoader(catalog);
|
|
60
|
+
* const loaderWithOptions = new DefaultToolLoader(catalog, { maxSize: 50 });
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
constructor(catalog, options = {}) {
|
|
64
|
+
this.catalog = catalog;
|
|
65
|
+
this.cache = new LRUCache({
|
|
66
|
+
max: options.maxSize ?? 100,
|
|
67
|
+
ttl: options.ttl,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Load a tool by ID.
|
|
72
|
+
*
|
|
73
|
+
* Returns cached tool if available, otherwise loads from source.
|
|
74
|
+
*
|
|
75
|
+
* @param id - The tool ID to load
|
|
76
|
+
* @returns Promise resolving to the loaded tool
|
|
77
|
+
* @throws Error if tool not found in catalog or source returns null
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```typescript
|
|
81
|
+
* const tool = await loader.load('github:create_pr');
|
|
82
|
+
* const result = await tool.invoke({ title: 'My PR' });
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
async load(id) {
|
|
86
|
+
// Check cache first
|
|
87
|
+
const cached = this.cache.get(id);
|
|
88
|
+
if (cached) {
|
|
89
|
+
return cached;
|
|
90
|
+
}
|
|
91
|
+
// Get metadata to find the source
|
|
92
|
+
const metadata = this.catalog.getMetadata(id);
|
|
93
|
+
if (!metadata) {
|
|
94
|
+
throw new Error(`ToolLoader: Unknown tool '${id}'`);
|
|
95
|
+
}
|
|
96
|
+
// Get the source
|
|
97
|
+
const source = this.catalog.getSource(metadata.sourceId);
|
|
98
|
+
if (!source) {
|
|
99
|
+
throw new Error(`ToolLoader: No source found for tool '${id}'`);
|
|
100
|
+
}
|
|
101
|
+
// Load from source
|
|
102
|
+
const tool = await source.getTool(id);
|
|
103
|
+
if (!tool) {
|
|
104
|
+
throw new Error(`ToolLoader: Source returned null for tool '${id}'`);
|
|
105
|
+
}
|
|
106
|
+
// Cache and return
|
|
107
|
+
this.cache.set(id, tool);
|
|
108
|
+
return tool;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Pre-load multiple tools in parallel.
|
|
112
|
+
*
|
|
113
|
+
* Useful for warming up the cache before a batch of operations.
|
|
114
|
+
* Errors are silently ignored—use load() for error handling.
|
|
115
|
+
*
|
|
116
|
+
* @param ids - Array of tool IDs to pre-load
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* // Warm up cache with expected tools
|
|
121
|
+
* await loader.warmup([
|
|
122
|
+
* 'github:create_pr',
|
|
123
|
+
* 'github:list_repos',
|
|
124
|
+
* 'github:get_issues',
|
|
125
|
+
* ]);
|
|
126
|
+
* ```
|
|
127
|
+
*/
|
|
128
|
+
async warmup(ids) {
|
|
129
|
+
await Promise.all(ids.map(id => this.load(id).catch(() => null)));
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Remove a tool from the cache.
|
|
133
|
+
*
|
|
134
|
+
* The tool will be reloaded from source on next access.
|
|
135
|
+
*
|
|
136
|
+
* @param id - The tool ID to evict
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* // Invalidate after tool update
|
|
141
|
+
* loader.evict('github:create_pr');
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
evict(id) {
|
|
145
|
+
this.cache.delete(id);
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Clear the entire cache.
|
|
149
|
+
*
|
|
150
|
+
* All tools will be reloaded from source on next access.
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```typescript
|
|
154
|
+
* // Clear cache after major changes
|
|
155
|
+
* loader.clear();
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
clear() {
|
|
159
|
+
this.cache.clear();
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Get cache statistics for monitoring.
|
|
163
|
+
*
|
|
164
|
+
* @returns Object with current size and max size
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* const stats = loader.getStats();
|
|
169
|
+
* console.log(`Cache: ${stats.size}/${stats.maxSize}`);
|
|
170
|
+
* ```
|
|
171
|
+
*/
|
|
172
|
+
getStats() {
|
|
173
|
+
return {
|
|
174
|
+
size: this.cache.size,
|
|
175
|
+
maxSize: this.cache.max,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/loader/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAkCrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,MAAM,OAAO,iBAAiB;IAC5B,qDAAqD;IAC7C,OAAO,CAAc;IAE7B,2CAA2C;IACnC,KAAK,CAAmC;IAEhD;;;;;;;;;;;OAWG;IACH,YAAY,OAAoB,EAAE,UAA6B,EAAE;QAC/D,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,IAAI,QAAQ,CAAC;YACxB,GAAG,EAAE,OAAO,CAAC,OAAO,IAAI,GAAG;YAC3B,GAAG,EAAE,OAAO,CAAC,GAAG;SACjB,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,IAAI,CAAC,EAAU;QACnB,oBAAoB;QACpB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QAClC,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,MAAM,CAAC;QAChB,CAAC;QAED,kCAAkC;QAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;QAC9C,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC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,CAAC;CACF"}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToolLoader - Lazy loading of tool implementations with LRU caching.
|
|
3
|
+
*
|
|
4
|
+
* Handles the "last mile" of tool loading:
|
|
5
|
+
* - LocalSource: Tool already in memory, just return it
|
|
6
|
+
* - MCPSource: May need to prepare the tool wrapper
|
|
7
|
+
* - DynamicSource: Actually load/import the tool on demand
|
|
8
|
+
*/
|
|
9
|
+
import type { StructuredTool } from "@langchain/core/tools";
|
|
10
|
+
import type { ToolCatalog, ToolSource, ToolLoader } from "../types.js";
|
|
11
|
+
/**
|
|
12
|
+
* Configuration for ToolLoader.
|
|
13
|
+
*/
|
|
14
|
+
export interface ToolLoaderConfig {
|
|
15
|
+
/** Maximum number of tools to cache (default: 100) */
|
|
16
|
+
maxCacheSize?: number;
|
|
17
|
+
/** Time-to-live for cached tools in milliseconds (default: 5 minutes) */
|
|
18
|
+
ttl?: number;
|
|
19
|
+
/** The tool catalog to use for metadata */
|
|
20
|
+
catalog: ToolCatalog;
|
|
21
|
+
/** Map of source ID to source implementation */
|
|
22
|
+
sources: Map<string, ToolSource>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Error thrown when a tool cannot be found.
|
|
26
|
+
*/
|
|
27
|
+
export declare class ToolNotFoundError extends Error {
|
|
28
|
+
readonly toolId: string;
|
|
29
|
+
constructor(toolId: string, message?: string);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Error thrown when a source cannot be found.
|
|
33
|
+
*/
|
|
34
|
+
export declare class SourceNotFoundError extends Error {
|
|
35
|
+
readonly sourceId: string;
|
|
36
|
+
readonly toolId: string;
|
|
37
|
+
constructor(sourceId: string, toolId: string);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* ToolLoader implementation with LRU caching and concurrent load deduplication.
|
|
41
|
+
*/
|
|
42
|
+
export declare class ToolLoaderImpl implements ToolLoader {
|
|
43
|
+
private readonly cache;
|
|
44
|
+
private readonly catalog;
|
|
45
|
+
private readonly sources;
|
|
46
|
+
private readonly loading;
|
|
47
|
+
private unsubscribe?;
|
|
48
|
+
constructor(config: ToolLoaderConfig);
|
|
49
|
+
/**
|
|
50
|
+
* Load a tool by ID.
|
|
51
|
+
*
|
|
52
|
+
* Uses LRU cache for performance. Concurrent requests for the same
|
|
53
|
+
* tool are deduplicated to prevent multiple loads.
|
|
54
|
+
*
|
|
55
|
+
* @param id - The tool ID to load
|
|
56
|
+
* @returns The loaded StructuredTool
|
|
57
|
+
* @throws ToolNotFoundError if the tool doesn't exist
|
|
58
|
+
* @throws SourceNotFoundError if the tool's source isn't registered
|
|
59
|
+
*/
|
|
60
|
+
load(id: string): Promise<StructuredTool>;
|
|
61
|
+
/**
|
|
62
|
+
* Load a tool from its source.
|
|
63
|
+
*
|
|
64
|
+
* @param id - The tool ID to load
|
|
65
|
+
* @returns The loaded StructuredTool
|
|
66
|
+
* @throws ToolNotFoundError if the tool doesn't exist
|
|
67
|
+
* @throws SourceNotFoundError if the tool's source isn't registered
|
|
68
|
+
*/
|
|
69
|
+
private loadFromSource;
|
|
70
|
+
/**
|
|
71
|
+
* Pre-load multiple tools in parallel.
|
|
72
|
+
*
|
|
73
|
+
* This is useful for warming up the cache before a batch of operations.
|
|
74
|
+
* Errors are silently ignored - check individual tools with load() if
|
|
75
|
+
* you need error handling.
|
|
76
|
+
*
|
|
77
|
+
* @param ids - Array of tool IDs to pre-load
|
|
78
|
+
*/
|
|
79
|
+
warmup(ids: string[]): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Remove a tool from the cache.
|
|
82
|
+
*
|
|
83
|
+
* The tool will be reloaded from source on next access.
|
|
84
|
+
*
|
|
85
|
+
* @param id - The tool ID to evict
|
|
86
|
+
*/
|
|
87
|
+
evict(id: string): void;
|
|
88
|
+
/**
|
|
89
|
+
* Clear the entire cache.
|
|
90
|
+
*
|
|
91
|
+
* All tools will be reloaded from source on next access.
|
|
92
|
+
*/
|
|
93
|
+
clear(): void;
|
|
94
|
+
/**
|
|
95
|
+
* Get cache statistics for monitoring.
|
|
96
|
+
*/
|
|
97
|
+
get stats(): {
|
|
98
|
+
size: number;
|
|
99
|
+
maxSize: number;
|
|
100
|
+
loading: number;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Dispose of the loader and clean up resources.
|
|
104
|
+
*/
|
|
105
|
+
dispose(): void;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Create a new ToolLoader instance.
|
|
109
|
+
*
|
|
110
|
+
* @param config - Loader configuration
|
|
111
|
+
* @returns A new ToolLoader instance
|
|
112
|
+
*/
|
|
113
|
+
export declare function createToolLoader(config: ToolLoaderConfig): ToolLoader;
|
|
114
|
+
//# sourceMappingURL=loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../src/loader/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEvE;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,yEAAyE;IACzE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,OAAO,EAAE,WAAW,CAAC;IACrB,gDAAgD;IAChD,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;aAExB,MAAM,EAAE,MAAM;gBAAd,MAAM,EAAE,MAAM,EAC9B,OAAO,CAAC,EAAE,MAAM;CAKnB;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;aAE1B,QAAQ,EAAE,MAAM;aAChB,MAAM,EAAE,MAAM;gBADd,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM;CAKjC;AAUD;;GAEG;AACH,qBAAa,cAAe,YAAW,UAAU;IAC/C,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmC;IACzD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAc;IACtC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA0B;IAClD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAA8C;IACtE,OAAO,CAAC,WAAW,CAAC,CAAa;gBAErB,MAAM,EAAE,gBAAgB;IAgBpC;;;;;;;;;;OAUG;IACG,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IA0B/C;;;;;;;OAOG;YACW,cAAc;IAyB5B;;;;;;;;OAQG;IACG,MAAM,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAK1C;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAMvB;;;;OAIG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,IAAI,KAAK,IAAI;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAM9D;IAED;;OAEG;IACH,OAAO,IAAI,IAAI;CAIhB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,UAAU,CAErE"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ToolLoader - Lazy loading of tool implementations with LRU caching.
|
|
3
|
+
*
|
|
4
|
+
* Handles the "last mile" of tool loading:
|
|
5
|
+
* - LocalSource: Tool already in memory, just return it
|
|
6
|
+
* - MCPSource: May need to prepare the tool wrapper
|
|
7
|
+
* - DynamicSource: Actually load/import the tool on demand
|
|
8
|
+
*/
|
|
9
|
+
import { LRUCache } from "lru-cache";
|
|
10
|
+
/**
|
|
11
|
+
* Error thrown when a tool cannot be found.
|
|
12
|
+
*/
|
|
13
|
+
export class ToolNotFoundError extends Error {
|
|
14
|
+
toolId;
|
|
15
|
+
constructor(toolId, message) {
|
|
16
|
+
super(message ?? `Tool not found: ${toolId}`);
|
|
17
|
+
this.toolId = toolId;
|
|
18
|
+
this.name = "ToolNotFoundError";
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Error thrown when a source cannot be found.
|
|
23
|
+
*/
|
|
24
|
+
export class SourceNotFoundError extends Error {
|
|
25
|
+
sourceId;
|
|
26
|
+
toolId;
|
|
27
|
+
constructor(sourceId, toolId) {
|
|
28
|
+
super(`Source not found for tool: ${toolId} (expected source: ${sourceId})`);
|
|
29
|
+
this.sourceId = sourceId;
|
|
30
|
+
this.toolId = toolId;
|
|
31
|
+
this.name = "SourceNotFoundError";
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Default configuration values.
|
|
36
|
+
*/
|
|
37
|
+
const DEFAULTS = {
|
|
38
|
+
maxCacheSize: 100,
|
|
39
|
+
ttl: 5 * 60 * 1000, // 5 minutes
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* ToolLoader implementation with LRU caching and concurrent load deduplication.
|
|
43
|
+
*/
|
|
44
|
+
export class ToolLoaderImpl {
|
|
45
|
+
cache;
|
|
46
|
+
catalog;
|
|
47
|
+
sources;
|
|
48
|
+
loading = new Map();
|
|
49
|
+
unsubscribe;
|
|
50
|
+
constructor(config) {
|
|
51
|
+
this.cache = new LRUCache({
|
|
52
|
+
max: config.maxCacheSize ?? DEFAULTS.maxCacheSize,
|
|
53
|
+
ttl: config.ttl ?? DEFAULTS.ttl,
|
|
54
|
+
});
|
|
55
|
+
this.catalog = config.catalog;
|
|
56
|
+
this.sources = config.sources;
|
|
57
|
+
// Listen for catalog changes to invalidate cache
|
|
58
|
+
this.unsubscribe = this.catalog.onToolsChanged.subscribe(({ removed }) => {
|
|
59
|
+
for (const id of removed) {
|
|
60
|
+
this.evict(id);
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Load a tool by ID.
|
|
66
|
+
*
|
|
67
|
+
* Uses LRU cache for performance. Concurrent requests for the same
|
|
68
|
+
* tool are deduplicated to prevent multiple loads.
|
|
69
|
+
*
|
|
70
|
+
* @param id - The tool ID to load
|
|
71
|
+
* @returns The loaded StructuredTool
|
|
72
|
+
* @throws ToolNotFoundError if the tool doesn't exist
|
|
73
|
+
* @throws SourceNotFoundError if the tool's source isn't registered
|
|
74
|
+
*/
|
|
75
|
+
async load(id) {
|
|
76
|
+
// 1. Check cache first
|
|
77
|
+
const cached = this.cache.get(id);
|
|
78
|
+
if (cached) {
|
|
79
|
+
return cached;
|
|
80
|
+
}
|
|
81
|
+
// 2. Check if already loading (dedup concurrent requests)
|
|
82
|
+
const existing = this.loading.get(id);
|
|
83
|
+
if (existing) {
|
|
84
|
+
return existing;
|
|
85
|
+
}
|
|
86
|
+
// 3. Load from source
|
|
87
|
+
const loadPromise = this.loadFromSource(id);
|
|
88
|
+
this.loading.set(id, loadPromise);
|
|
89
|
+
try {
|
|
90
|
+
const tool = await loadPromise;
|
|
91
|
+
this.cache.set(id, tool);
|
|
92
|
+
return tool;
|
|
93
|
+
}
|
|
94
|
+
finally {
|
|
95
|
+
this.loading.delete(id);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Load a tool from its source.
|
|
100
|
+
*
|
|
101
|
+
* @param id - The tool ID to load
|
|
102
|
+
* @returns The loaded StructuredTool
|
|
103
|
+
* @throws ToolNotFoundError if the tool doesn't exist
|
|
104
|
+
* @throws SourceNotFoundError if the tool's source isn't registered
|
|
105
|
+
*/
|
|
106
|
+
async loadFromSource(id) {
|
|
107
|
+
// Get metadata to find the source
|
|
108
|
+
const metadata = this.catalog.getMetadata(id);
|
|
109
|
+
if (!metadata) {
|
|
110
|
+
throw new ToolNotFoundError(id);
|
|
111
|
+
}
|
|
112
|
+
// Get the source
|
|
113
|
+
const source = this.sources.get(metadata.sourceId);
|
|
114
|
+
if (!source) {
|
|
115
|
+
throw new SourceNotFoundError(metadata.sourceId, id);
|
|
116
|
+
}
|
|
117
|
+
// Load from source
|
|
118
|
+
const tool = await source.getTool(id);
|
|
119
|
+
if (!tool) {
|
|
120
|
+
throw new ToolNotFoundError(id, `Tool ${id} exists in catalog but source returned null`);
|
|
121
|
+
}
|
|
122
|
+
return tool;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Pre-load multiple tools in parallel.
|
|
126
|
+
*
|
|
127
|
+
* This is useful for warming up the cache before a batch of operations.
|
|
128
|
+
* Errors are silently ignored - check individual tools with load() if
|
|
129
|
+
* you need error handling.
|
|
130
|
+
*
|
|
131
|
+
* @param ids - Array of tool IDs to pre-load
|
|
132
|
+
*/
|
|
133
|
+
async warmup(ids) {
|
|
134
|
+
// Load all tools in parallel, ignoring failures
|
|
135
|
+
await Promise.allSettled(ids.map((id) => this.load(id)));
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Remove a tool from the cache.
|
|
139
|
+
*
|
|
140
|
+
* The tool will be reloaded from source on next access.
|
|
141
|
+
*
|
|
142
|
+
* @param id - The tool ID to evict
|
|
143
|
+
*/
|
|
144
|
+
evict(id) {
|
|
145
|
+
this.cache.delete(id);
|
|
146
|
+
// Also clear any in-progress loading (will be restarted on next load)
|
|
147
|
+
this.loading.delete(id);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Clear the entire cache.
|
|
151
|
+
*
|
|
152
|
+
* All tools will be reloaded from source on next access.
|
|
153
|
+
*/
|
|
154
|
+
clear() {
|
|
155
|
+
this.cache.clear();
|
|
156
|
+
this.loading.clear();
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Get cache statistics for monitoring.
|
|
160
|
+
*/
|
|
161
|
+
get stats() {
|
|
162
|
+
return {
|
|
163
|
+
size: this.cache.size,
|
|
164
|
+
maxSize: this.cache.max,
|
|
165
|
+
loading: this.loading.size,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Dispose of the loader and clean up resources.
|
|
170
|
+
*/
|
|
171
|
+
dispose() {
|
|
172
|
+
this.unsubscribe?.();
|
|
173
|
+
this.clear();
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Create a new ToolLoader instance.
|
|
178
|
+
*
|
|
179
|
+
* @param config - Loader configuration
|
|
180
|
+
* @returns A new ToolLoader instance
|
|
181
|
+
*/
|
|
182
|
+
export function createToolLoader(config) {
|
|
183
|
+
return new ToolLoaderImpl(config);
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=loader.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/loader/loader.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAkBrC;;GAEG;AACH,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAExB;IADlB,YACkB,MAAc,EAC9B,OAAgB;QAEhB,KAAK,CAAC,OAAO,IAAI,mBAAmB,MAAM,EAAE,CAAC,CAAC;QAH9B,WAAM,GAAN,MAAM,CAAQ;QAI9B,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAE1B;IACA;IAFlB,YACkB,QAAgB,EAChB,MAAc;QAE9B,KAAK,CAAC,8BAA8B,MAAM,sBAAsB,QAAQ,GAAG,CAAC,CAAC;QAH7D,aAAQ,GAAR,QAAQ,CAAQ;QAChB,WAAM,GAAN,MAAM,CAAQ;QAG9B,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAA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