@axiom-lattice/core 1.0.46 → 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.
- package/README.md +104 -2
- package/dist/index.d.mts +198 -2
- package/dist/index.d.ts +198 -2
- package/dist/index.js +374 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +371 -32
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -33,11 +33,15 @@ __export(index_exports, {
|
|
|
33
33
|
AgentConfig: () => import_protocols.AgentConfig,
|
|
34
34
|
AgentLatticeManager: () => AgentLatticeManager,
|
|
35
35
|
AgentType: () => import_protocols.AgentType,
|
|
36
|
+
ChunkBuffer: () => ChunkBuffer,
|
|
37
|
+
ChunkBufferLatticeManager: () => ChunkBufferLatticeManager,
|
|
36
38
|
GraphBuildOptions: () => import_protocols.GraphBuildOptions,
|
|
39
|
+
InMemoryChunkBuffer: () => InMemoryChunkBuffer,
|
|
37
40
|
MemoryLatticeManager: () => MemoryLatticeManager,
|
|
38
41
|
MemoryType: () => import_protocols2.MemoryType,
|
|
39
42
|
ModelLatticeManager: () => ModelLatticeManager,
|
|
40
43
|
Protocols: () => Protocols,
|
|
44
|
+
ThreadStatus: () => ThreadStatus,
|
|
41
45
|
ToolLatticeManager: () => ToolLatticeManager,
|
|
42
46
|
agentLatticeManager: () => agentLatticeManager,
|
|
43
47
|
getAgentClient: () => getAgentClient,
|
|
@@ -46,14 +50,17 @@ __export(index_exports, {
|
|
|
46
50
|
getAllAgentConfigs: () => getAllAgentConfigs,
|
|
47
51
|
getAllToolDefinitions: () => getAllToolDefinitions,
|
|
48
52
|
getCheckpointSaver: () => getCheckpointSaver,
|
|
53
|
+
getChunkBuffer: () => getChunkBuffer,
|
|
49
54
|
getModelLattice: () => getModelLattice,
|
|
50
55
|
getToolClient: () => getToolClient,
|
|
51
56
|
getToolDefinition: () => getToolDefinition,
|
|
52
57
|
getToolLattice: () => getToolLattice,
|
|
58
|
+
hasChunkBuffer: () => hasChunkBuffer,
|
|
53
59
|
modelLatticeManager: () => modelLatticeManager,
|
|
54
60
|
registerAgentLattice: () => registerAgentLattice,
|
|
55
61
|
registerAgentLattices: () => registerAgentLattices,
|
|
56
62
|
registerCheckpointSaver: () => registerCheckpointSaver,
|
|
63
|
+
registerChunkBuffer: () => registerChunkBuffer,
|
|
57
64
|
registerModelLattice: () => registerModelLattice,
|
|
58
65
|
registerToolLattice: () => registerToolLattice,
|
|
59
66
|
toolLatticeManager: () => toolLatticeManager,
|
|
@@ -412,7 +419,42 @@ var import_zod = __toESM(require("zod"));
|
|
|
412
419
|
|
|
413
420
|
// src/tool_lattice/ToolLatticeManager.ts
|
|
414
421
|
var import_tools = require("@langchain/core/tools");
|
|
422
|
+
|
|
423
|
+
// src/util/genUIMarkdown.ts
|
|
424
|
+
var genUIMarkdown = (type, data) => {
|
|
425
|
+
return ["```" + type, JSON.stringify(data), "```"].join("\n");
|
|
426
|
+
};
|
|
427
|
+
|
|
428
|
+
// src/tool_lattice/createToolApproveWrapper.ts
|
|
415
429
|
var import_langgraph = require("@langchain/langgraph");
|
|
430
|
+
function createToolApproveWrapper(tool_config, toolExecutor) {
|
|
431
|
+
return async (input, exe_config) => {
|
|
432
|
+
const messagePrefix = "Tool execution requires approval";
|
|
433
|
+
const description = `${messagePrefix}
|
|
434
|
+
|
|
435
|
+
Tool: ${tool_config.name}
|
|
436
|
+
Args: ${JSON.stringify(input, null, 2)}`;
|
|
437
|
+
const md = genUIMarkdown("confirm", {
|
|
438
|
+
message: description,
|
|
439
|
+
tool_call: {
|
|
440
|
+
tool_call_id: exe_config.id,
|
|
441
|
+
tool_name: tool_config.name,
|
|
442
|
+
tool_args: input,
|
|
443
|
+
tool_config
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
const feedback = await (0, import_langgraph.interrupt)(md);
|
|
447
|
+
if (feedback.data.action === "yes") {
|
|
448
|
+
return await toolExecutor(input, exe_config);
|
|
449
|
+
} else {
|
|
450
|
+
return {
|
|
451
|
+
goto: import_langgraph.END
|
|
452
|
+
};
|
|
453
|
+
}
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
// src/tool_lattice/ToolLatticeManager.ts
|
|
416
458
|
var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
417
459
|
/**
|
|
418
460
|
* 获取ToolLatticeManager单例实例
|
|
@@ -436,26 +478,16 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
|
436
478
|
* @param executor 工具执行函数
|
|
437
479
|
*/
|
|
438
480
|
registerLattice(key, config, executor) {
|
|
439
|
-
let toolExecutor
|
|
440
|
-
const result = await executor(input, exe_config);
|
|
441
|
-
return result;
|
|
442
|
-
};
|
|
481
|
+
let toolExecutor;
|
|
443
482
|
if (config.needUserApprove) {
|
|
483
|
+
toolExecutor = createToolApproveWrapper(
|
|
484
|
+
config,
|
|
485
|
+
executor
|
|
486
|
+
);
|
|
487
|
+
} else {
|
|
444
488
|
toolExecutor = async (input, exe_config) => {
|
|
445
|
-
const
|
|
446
|
-
|
|
447
|
-
JSON.stringify({
|
|
448
|
-
message: "try to " + config.name + ",please confirm the action"
|
|
449
|
-
}),
|
|
450
|
-
"```"
|
|
451
|
-
].join("\n");
|
|
452
|
-
const feedback = await (0, import_langgraph.interrupt)(contents);
|
|
453
|
-
if (feedback.data.action === "yes") {
|
|
454
|
-
const result = await executor(input, exe_config);
|
|
455
|
-
return result;
|
|
456
|
-
} else {
|
|
457
|
-
return "user denied the action";
|
|
458
|
-
}
|
|
489
|
+
const result = await executor(input, exe_config);
|
|
490
|
+
return result;
|
|
459
491
|
};
|
|
460
492
|
}
|
|
461
493
|
const toolLattice = {
|
|
@@ -570,7 +602,7 @@ var validateToolInput = (key, input) => toolLatticeManager.validateToolInput(key
|
|
|
570
602
|
registerToolLattice(
|
|
571
603
|
"get_current_date_time",
|
|
572
604
|
{
|
|
573
|
-
name: "
|
|
605
|
+
name: "get_current_date_time",
|
|
574
606
|
description: "\u83B7\u53D6\u5F53\u524D\u65E5\u671F\u65F6\u95F4",
|
|
575
607
|
schema: import_zod.default.object({})
|
|
576
608
|
},
|
|
@@ -1015,11 +1047,6 @@ Results are returned using cat -n format, with line numbers starting at 1
|
|
|
1015
1047
|
You have the capability to call multiple tools in a single response. It is always better to speculatively read multiple files as a batch that are potentially useful.
|
|
1016
1048
|
If you read a file that exists but has empty contents you will receive a system reminder warning in place of file contents.`;
|
|
1017
1049
|
|
|
1018
|
-
// src/util/genUIMarkdown.ts
|
|
1019
|
-
var genUIMarkdown = (type, data) => {
|
|
1020
|
-
return ["```" + type, JSON.stringify(data), "```"].join("\n");
|
|
1021
|
-
};
|
|
1022
|
-
|
|
1023
1050
|
// src/deep_agent/tools.ts
|
|
1024
1051
|
var writeTodos = (0, import_tools2.tool)(
|
|
1025
1052
|
(input, config) => {
|
|
@@ -1200,7 +1227,8 @@ function createTaskTool(inputs) {
|
|
|
1200
1227
|
subagents,
|
|
1201
1228
|
tools = {},
|
|
1202
1229
|
model = getModelLattice("default")?.client,
|
|
1203
|
-
stateSchema
|
|
1230
|
+
stateSchema,
|
|
1231
|
+
postModelHook
|
|
1204
1232
|
} = inputs;
|
|
1205
1233
|
if (!model) {
|
|
1206
1234
|
throw new Error("Model not found");
|
|
@@ -1228,7 +1256,9 @@ function createTaskTool(inputs) {
|
|
|
1228
1256
|
tools: subagentTools,
|
|
1229
1257
|
stateSchema,
|
|
1230
1258
|
messageModifier: subagent.prompt,
|
|
1231
|
-
checkpointer: false
|
|
1259
|
+
// checkpointer: false,
|
|
1260
|
+
checkpointer: getCheckpointSaver("default"),
|
|
1261
|
+
postModelHook
|
|
1232
1262
|
});
|
|
1233
1263
|
agentsMap.set(subagent.name, reactAgent);
|
|
1234
1264
|
}
|
|
@@ -2210,6 +2240,317 @@ var getAllAgentConfigs = () => agentLatticeManager.getAllAgentConfigs();
|
|
|
2210
2240
|
var validateAgentInput = (key, input) => agentLatticeManager.validateAgentInput(key, input);
|
|
2211
2241
|
var getAgentClient = (key, options) => agentLatticeManager.initializeClient(key, options);
|
|
2212
2242
|
|
|
2243
|
+
// src/chunk_buffer_lattice/ChunkBuffer.ts
|
|
2244
|
+
var ChunkBuffer = class {
|
|
2245
|
+
};
|
|
2246
|
+
|
|
2247
|
+
// src/chunk_buffer_lattice/types.ts
|
|
2248
|
+
var ThreadStatus = /* @__PURE__ */ ((ThreadStatus2) => {
|
|
2249
|
+
ThreadStatus2["ACTIVE"] = "active";
|
|
2250
|
+
ThreadStatus2["COMPLETED"] = "completed";
|
|
2251
|
+
ThreadStatus2["ABORTED"] = "aborted";
|
|
2252
|
+
return ThreadStatus2;
|
|
2253
|
+
})(ThreadStatus || {});
|
|
2254
|
+
|
|
2255
|
+
// src/chunk_buffer_lattice/InMemoryChunkBuffer.ts
|
|
2256
|
+
var import_rxjs = require("rxjs");
|
|
2257
|
+
var InMemoryChunkBuffer = class extends ChunkBuffer {
|
|
2258
|
+
constructor(config) {
|
|
2259
|
+
super();
|
|
2260
|
+
this.buffers = /* @__PURE__ */ new Map();
|
|
2261
|
+
this.config = {
|
|
2262
|
+
ttl: config?.ttl ?? 60 * 60 * 1e3,
|
|
2263
|
+
cleanupInterval: config?.cleanupInterval ?? 0,
|
|
2264
|
+
maxChunks: config?.maxChunks ?? 1e3
|
|
2265
|
+
// Default max chunks per thread
|
|
2266
|
+
};
|
|
2267
|
+
if (this.config.cleanupInterval > 0) {
|
|
2268
|
+
this.startCleanupTimer();
|
|
2269
|
+
}
|
|
2270
|
+
}
|
|
2271
|
+
/**
|
|
2272
|
+
* Start automatic periodic cleanup timer
|
|
2273
|
+
*/
|
|
2274
|
+
startCleanupTimer() {
|
|
2275
|
+
if (this.config.cleanupInterval <= 0) return;
|
|
2276
|
+
this.cleanupTimer = setInterval(() => {
|
|
2277
|
+
this.cleanupExpiredThreads().catch(console.error);
|
|
2278
|
+
}, this.config.cleanupInterval);
|
|
2279
|
+
if (this.cleanupTimer.unref) {
|
|
2280
|
+
this.cleanupTimer.unref();
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
/**
|
|
2284
|
+
* Stop cleanup timer (for cleanup/shutdown)
|
|
2285
|
+
*/
|
|
2286
|
+
stopCleanupTimer() {
|
|
2287
|
+
if (this.cleanupTimer) {
|
|
2288
|
+
clearInterval(this.cleanupTimer);
|
|
2289
|
+
this.cleanupTimer = void 0;
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
/**
|
|
2293
|
+
* Check if a buffer is expired (lazy cleanup helper)
|
|
2294
|
+
*/
|
|
2295
|
+
isExpired(buffer) {
|
|
2296
|
+
return buffer.expiresAt <= Date.now();
|
|
2297
|
+
}
|
|
2298
|
+
/**
|
|
2299
|
+
* Get buffer if valid, perform lazy cleanup if expired
|
|
2300
|
+
*/
|
|
2301
|
+
getBufferIfValid(threadId) {
|
|
2302
|
+
const buffer = this.buffers.get(threadId);
|
|
2303
|
+
if (buffer && this.isExpired(buffer)) {
|
|
2304
|
+
this.buffers.delete(threadId);
|
|
2305
|
+
return void 0;
|
|
2306
|
+
}
|
|
2307
|
+
return buffer;
|
|
2308
|
+
}
|
|
2309
|
+
/**
|
|
2310
|
+
* Create or get thread buffer
|
|
2311
|
+
*/
|
|
2312
|
+
getOrCreateBuffer(threadId) {
|
|
2313
|
+
let buffer = this.getBufferIfValid(threadId);
|
|
2314
|
+
4;
|
|
2315
|
+
if (!buffer) {
|
|
2316
|
+
const now = Date.now();
|
|
2317
|
+
buffer = {
|
|
2318
|
+
threadId,
|
|
2319
|
+
chunks$: new import_rxjs.ReplaySubject(
|
|
2320
|
+
this.config.maxChunks ?? 1e4
|
|
2321
|
+
),
|
|
2322
|
+
status: "active" /* ACTIVE */,
|
|
2323
|
+
createdAt: now,
|
|
2324
|
+
updatedAt: now,
|
|
2325
|
+
expiresAt: now + this.config.ttl
|
|
2326
|
+
};
|
|
2327
|
+
this.buffers.set(threadId, buffer);
|
|
2328
|
+
}
|
|
2329
|
+
if (buffer.status !== "active" /* ACTIVE */) {
|
|
2330
|
+
buffer.status = "active" /* ACTIVE */;
|
|
2331
|
+
buffer.chunks$ = new import_rxjs.ReplaySubject(
|
|
2332
|
+
this.config.maxChunks ?? 1e4
|
|
2333
|
+
);
|
|
2334
|
+
buffer.updatedAt = Date.now();
|
|
2335
|
+
buffer.expiresAt = Date.now() + this.config.ttl;
|
|
2336
|
+
}
|
|
2337
|
+
return buffer;
|
|
2338
|
+
}
|
|
2339
|
+
async addChunk(threadId, content) {
|
|
2340
|
+
const buffer = this.getOrCreateBuffer(threadId);
|
|
2341
|
+
const chunk = content;
|
|
2342
|
+
buffer.chunks$.next(chunk);
|
|
2343
|
+
buffer.updatedAt = Date.now();
|
|
2344
|
+
buffer.expiresAt = Date.now() + this.config.ttl;
|
|
2345
|
+
buffer.status = "active" /* ACTIVE */;
|
|
2346
|
+
}
|
|
2347
|
+
async completeThread(threadId) {
|
|
2348
|
+
const buffer = this.getBufferIfValid(threadId);
|
|
2349
|
+
if (buffer) {
|
|
2350
|
+
buffer.status = "completed" /* COMPLETED */;
|
|
2351
|
+
buffer.updatedAt = Date.now();
|
|
2352
|
+
buffer.chunks$.complete();
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
async abortThread(threadId) {
|
|
2356
|
+
const buffer = this.getBufferIfValid(threadId);
|
|
2357
|
+
if (buffer) {
|
|
2358
|
+
buffer.status = "aborted" /* ABORTED */;
|
|
2359
|
+
buffer.updatedAt = Date.now();
|
|
2360
|
+
buffer.chunks$.error(new Error("Thread aborted"));
|
|
2361
|
+
}
|
|
2362
|
+
}
|
|
2363
|
+
async isThreadActive(threadId) {
|
|
2364
|
+
const buffer = this.getBufferIfValid(threadId);
|
|
2365
|
+
return buffer?.status === "active" /* ACTIVE */;
|
|
2366
|
+
}
|
|
2367
|
+
async getThreadStatus(threadId) {
|
|
2368
|
+
return this.getBufferIfValid(threadId)?.status;
|
|
2369
|
+
}
|
|
2370
|
+
async getThreadBuffer(threadId) {
|
|
2371
|
+
const buffer = this.getBufferIfValid(threadId);
|
|
2372
|
+
if (!buffer) return void 0;
|
|
2373
|
+
return buffer;
|
|
2374
|
+
}
|
|
2375
|
+
async clearThread(threadId) {
|
|
2376
|
+
this.buffers.delete(threadId);
|
|
2377
|
+
}
|
|
2378
|
+
async getActiveThreads() {
|
|
2379
|
+
const activeThreads = [];
|
|
2380
|
+
for (const [threadId, buffer] of this.buffers.entries()) {
|
|
2381
|
+
if (this.isExpired(buffer)) {
|
|
2382
|
+
this.buffers.delete(threadId);
|
|
2383
|
+
continue;
|
|
2384
|
+
}
|
|
2385
|
+
if (buffer.status === "active" /* ACTIVE */) {
|
|
2386
|
+
activeThreads.push(threadId);
|
|
2387
|
+
}
|
|
2388
|
+
}
|
|
2389
|
+
return activeThreads;
|
|
2390
|
+
}
|
|
2391
|
+
async getAllThreads() {
|
|
2392
|
+
const validThreads = [];
|
|
2393
|
+
for (const [threadId, buffer] of this.buffers.entries()) {
|
|
2394
|
+
if (this.isExpired(buffer)) {
|
|
2395
|
+
this.buffers.delete(threadId);
|
|
2396
|
+
} else {
|
|
2397
|
+
validThreads.push(threadId);
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
return validThreads;
|
|
2401
|
+
}
|
|
2402
|
+
async hasThread(threadId) {
|
|
2403
|
+
return this.getBufferIfValid(threadId) !== void 0;
|
|
2404
|
+
}
|
|
2405
|
+
/**
|
|
2406
|
+
* Cleanup expired threads based on TTL
|
|
2407
|
+
* Returns number of threads cleaned up
|
|
2408
|
+
*/
|
|
2409
|
+
async cleanupExpiredThreads() {
|
|
2410
|
+
const now = Date.now();
|
|
2411
|
+
let cleanedCount = 0;
|
|
2412
|
+
for (const [threadId, buffer] of this.buffers.entries()) {
|
|
2413
|
+
if (buffer.expiresAt <= now) {
|
|
2414
|
+
this.buffers.delete(threadId);
|
|
2415
|
+
cleanedCount++;
|
|
2416
|
+
}
|
|
2417
|
+
}
|
|
2418
|
+
return cleanedCount;
|
|
2419
|
+
}
|
|
2420
|
+
async extendThreadTTL(threadId, additionalMs) {
|
|
2421
|
+
const buffer = this.getBufferIfValid(threadId);
|
|
2422
|
+
if (buffer) {
|
|
2423
|
+
const extension = additionalMs ?? this.config.ttl;
|
|
2424
|
+
buffer.expiresAt = Date.now() + extension;
|
|
2425
|
+
buffer.updatedAt = Date.now();
|
|
2426
|
+
}
|
|
2427
|
+
}
|
|
2428
|
+
async *getNewChunksSinceContentIterator(threadId, messageId, knownContent) {
|
|
2429
|
+
const buffer = this.getBufferIfValid(threadId);
|
|
2430
|
+
if (!buffer) return;
|
|
2431
|
+
let accumulatedContent = "";
|
|
2432
|
+
const queue = [];
|
|
2433
|
+
let resolveNext = null;
|
|
2434
|
+
let errorNext = null;
|
|
2435
|
+
let isCompleted = false;
|
|
2436
|
+
const subscription = buffer.chunks$.subscribe({
|
|
2437
|
+
next: (chunk) => {
|
|
2438
|
+
queue.push(chunk);
|
|
2439
|
+
if (resolveNext) {
|
|
2440
|
+
const resolve = resolveNext;
|
|
2441
|
+
resolveNext = null;
|
|
2442
|
+
resolve();
|
|
2443
|
+
}
|
|
2444
|
+
},
|
|
2445
|
+
error: (err) => {
|
|
2446
|
+
if (errorNext) {
|
|
2447
|
+
const reject = errorNext;
|
|
2448
|
+
errorNext = null;
|
|
2449
|
+
reject(err);
|
|
2450
|
+
}
|
|
2451
|
+
},
|
|
2452
|
+
complete: () => {
|
|
2453
|
+
isCompleted = true;
|
|
2454
|
+
if (resolveNext) {
|
|
2455
|
+
const resolve = resolveNext;
|
|
2456
|
+
resolveNext = null;
|
|
2457
|
+
resolve();
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
});
|
|
2461
|
+
try {
|
|
2462
|
+
while (true) {
|
|
2463
|
+
if (queue.length === 0) {
|
|
2464
|
+
if (isCompleted) break;
|
|
2465
|
+
await new Promise((resolve, reject) => {
|
|
2466
|
+
resolveNext = resolve;
|
|
2467
|
+
errorNext = reject;
|
|
2468
|
+
});
|
|
2469
|
+
}
|
|
2470
|
+
while (queue.length > 0) {
|
|
2471
|
+
const chunk = queue.shift();
|
|
2472
|
+
if (!chunk) continue;
|
|
2473
|
+
if (chunk.data?.id === messageId) {
|
|
2474
|
+
accumulatedContent += chunk.data?.content || "";
|
|
2475
|
+
}
|
|
2476
|
+
if (accumulatedContent.length > knownContent.length) {
|
|
2477
|
+
if (accumulatedContent.startsWith(knownContent)) {
|
|
2478
|
+
yield chunk;
|
|
2479
|
+
}
|
|
2480
|
+
}
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2483
|
+
} finally {
|
|
2484
|
+
subscription.unsubscribe();
|
|
2485
|
+
}
|
|
2486
|
+
}
|
|
2487
|
+
getStats() {
|
|
2488
|
+
let activeCount = 0;
|
|
2489
|
+
let completedCount = 0;
|
|
2490
|
+
let abortedCount = 0;
|
|
2491
|
+
const validBuffers = [];
|
|
2492
|
+
for (const [threadId, buffer] of this.buffers.entries()) {
|
|
2493
|
+
if (this.isExpired(buffer)) {
|
|
2494
|
+
this.buffers.delete(threadId);
|
|
2495
|
+
} else {
|
|
2496
|
+
validBuffers.push(buffer);
|
|
2497
|
+
}
|
|
2498
|
+
}
|
|
2499
|
+
for (const buffer of validBuffers) {
|
|
2500
|
+
switch (buffer.status) {
|
|
2501
|
+
case "active" /* ACTIVE */:
|
|
2502
|
+
activeCount++;
|
|
2503
|
+
break;
|
|
2504
|
+
case "completed" /* COMPLETED */:
|
|
2505
|
+
completedCount++;
|
|
2506
|
+
break;
|
|
2507
|
+
case "aborted" /* ABORTED */:
|
|
2508
|
+
abortedCount++;
|
|
2509
|
+
break;
|
|
2510
|
+
}
|
|
2511
|
+
}
|
|
2512
|
+
return {
|
|
2513
|
+
totalThreads: validBuffers.length,
|
|
2514
|
+
activeThreads: activeCount,
|
|
2515
|
+
completedThreads: completedCount,
|
|
2516
|
+
abortedThreads: abortedCount,
|
|
2517
|
+
config: this.config
|
|
2518
|
+
};
|
|
2519
|
+
}
|
|
2520
|
+
dispose() {
|
|
2521
|
+
this.stopCleanupTimer();
|
|
2522
|
+
this.buffers.clear();
|
|
2523
|
+
}
|
|
2524
|
+
};
|
|
2525
|
+
|
|
2526
|
+
// src/chunk_buffer_lattice/ChunkBufferLatticeManager.ts
|
|
2527
|
+
var ChunkBufferLatticeManager = class _ChunkBufferLatticeManager extends BaseLatticeManager {
|
|
2528
|
+
/**
|
|
2529
|
+
* Private constructor for singleton pattern
|
|
2530
|
+
*/
|
|
2531
|
+
constructor() {
|
|
2532
|
+
super();
|
|
2533
|
+
}
|
|
2534
|
+
/**
|
|
2535
|
+
* Get singleton instance
|
|
2536
|
+
*/
|
|
2537
|
+
static getInstance() {
|
|
2538
|
+
if (!_ChunkBufferLatticeManager.instance) {
|
|
2539
|
+
_ChunkBufferLatticeManager.instance = new _ChunkBufferLatticeManager();
|
|
2540
|
+
}
|
|
2541
|
+
return _ChunkBufferLatticeManager.instance;
|
|
2542
|
+
}
|
|
2543
|
+
/**
|
|
2544
|
+
* Get Lattice type identifier
|
|
2545
|
+
*/
|
|
2546
|
+
getLatticeType() {
|
|
2547
|
+
return "chunk_buffer";
|
|
2548
|
+
}
|
|
2549
|
+
};
|
|
2550
|
+
var getChunkBuffer = (key) => ChunkBufferLatticeManager.getInstance().get(key);
|
|
2551
|
+
var registerChunkBuffer = (key, buffer) => ChunkBufferLatticeManager.getInstance().register(key, buffer);
|
|
2552
|
+
var hasChunkBuffer = (key) => ChunkBufferLatticeManager.getInstance().has(key);
|
|
2553
|
+
|
|
2213
2554
|
// src/index.ts
|
|
2214
2555
|
var Protocols = __toESM(require("@axiom-lattice/protocols"));
|
|
2215
2556
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -2217,11 +2558,15 @@ var Protocols = __toESM(require("@axiom-lattice/protocols"));
|
|
|
2217
2558
|
AgentConfig,
|
|
2218
2559
|
AgentLatticeManager,
|
|
2219
2560
|
AgentType,
|
|
2561
|
+
ChunkBuffer,
|
|
2562
|
+
ChunkBufferLatticeManager,
|
|
2220
2563
|
GraphBuildOptions,
|
|
2564
|
+
InMemoryChunkBuffer,
|
|
2221
2565
|
MemoryLatticeManager,
|
|
2222
2566
|
MemoryType,
|
|
2223
2567
|
ModelLatticeManager,
|
|
2224
2568
|
Protocols,
|
|
2569
|
+
ThreadStatus,
|
|
2225
2570
|
ToolLatticeManager,
|
|
2226
2571
|
agentLatticeManager,
|
|
2227
2572
|
getAgentClient,
|
|
@@ -2230,14 +2575,17 @@ var Protocols = __toESM(require("@axiom-lattice/protocols"));
|
|
|
2230
2575
|
getAllAgentConfigs,
|
|
2231
2576
|
getAllToolDefinitions,
|
|
2232
2577
|
getCheckpointSaver,
|
|
2578
|
+
getChunkBuffer,
|
|
2233
2579
|
getModelLattice,
|
|
2234
2580
|
getToolClient,
|
|
2235
2581
|
getToolDefinition,
|
|
2236
2582
|
getToolLattice,
|
|
2583
|
+
hasChunkBuffer,
|
|
2237
2584
|
modelLatticeManager,
|
|
2238
2585
|
registerAgentLattice,
|
|
2239
2586
|
registerAgentLattices,
|
|
2240
2587
|
registerCheckpointSaver,
|
|
2588
|
+
registerChunkBuffer,
|
|
2241
2589
|
registerModelLattice,
|
|
2242
2590
|
registerToolLattice,
|
|
2243
2591
|
toolLatticeManager,
|