@axiom-lattice/core 1.0.45 → 1.0.50
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 +231 -2
- package/dist/index.d.ts +231 -2
- package/dist/index.js +375 -26
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +372 -32
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -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,318 @@ 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 InMemoryChunkBuffer = class extends ChunkBuffer {
|
|
2257
|
+
constructor(config) {
|
|
2258
|
+
super();
|
|
2259
|
+
this.buffers = /* @__PURE__ */ new Map();
|
|
2260
|
+
this.config = {
|
|
2261
|
+
ttl: config?.ttl ?? 60 * 60 * 1e3,
|
|
2262
|
+
cleanupInterval: config?.cleanupInterval ?? 0
|
|
2263
|
+
};
|
|
2264
|
+
if (this.config.cleanupInterval > 0) {
|
|
2265
|
+
this.startCleanupTimer();
|
|
2266
|
+
}
|
|
2267
|
+
}
|
|
2268
|
+
/**
|
|
2269
|
+
* Start automatic periodic cleanup timer
|
|
2270
|
+
*/
|
|
2271
|
+
startCleanupTimer() {
|
|
2272
|
+
if (this.config.cleanupInterval <= 0) return;
|
|
2273
|
+
this.cleanupTimer = setInterval(() => {
|
|
2274
|
+
this.cleanupExpiredThreads().catch(console.error);
|
|
2275
|
+
}, this.config.cleanupInterval);
|
|
2276
|
+
if (this.cleanupTimer.unref) {
|
|
2277
|
+
this.cleanupTimer.unref();
|
|
2278
|
+
}
|
|
2279
|
+
}
|
|
2280
|
+
/**
|
|
2281
|
+
* Stop cleanup timer (for cleanup/shutdown)
|
|
2282
|
+
*/
|
|
2283
|
+
stopCleanupTimer() {
|
|
2284
|
+
if (this.cleanupTimer) {
|
|
2285
|
+
clearInterval(this.cleanupTimer);
|
|
2286
|
+
this.cleanupTimer = void 0;
|
|
2287
|
+
}
|
|
2288
|
+
}
|
|
2289
|
+
/**
|
|
2290
|
+
* Check if a buffer is expired (lazy cleanup helper)
|
|
2291
|
+
*/
|
|
2292
|
+
isExpired(buffer) {
|
|
2293
|
+
return buffer.expiresAt <= Date.now();
|
|
2294
|
+
}
|
|
2295
|
+
/**
|
|
2296
|
+
* Get buffer if valid, perform lazy cleanup if expired
|
|
2297
|
+
*/
|
|
2298
|
+
getBufferIfValid(threadId) {
|
|
2299
|
+
const buffer = this.buffers.get(threadId);
|
|
2300
|
+
if (buffer && this.isExpired(buffer)) {
|
|
2301
|
+
this.buffers.delete(threadId);
|
|
2302
|
+
return void 0;
|
|
2303
|
+
}
|
|
2304
|
+
return buffer;
|
|
2305
|
+
}
|
|
2306
|
+
/**
|
|
2307
|
+
* Create or get thread buffer
|
|
2308
|
+
*/
|
|
2309
|
+
getOrCreateBuffer(threadId) {
|
|
2310
|
+
let buffer = this.getBufferIfValid(threadId);
|
|
2311
|
+
if (!buffer) {
|
|
2312
|
+
const now = Date.now();
|
|
2313
|
+
buffer = {
|
|
2314
|
+
threadId,
|
|
2315
|
+
chunks: [],
|
|
2316
|
+
status: "active" /* ACTIVE */,
|
|
2317
|
+
createdAt: now,
|
|
2318
|
+
updatedAt: now,
|
|
2319
|
+
expiresAt: now + this.config.ttl
|
|
2320
|
+
};
|
|
2321
|
+
this.buffers.set(threadId, buffer);
|
|
2322
|
+
}
|
|
2323
|
+
return buffer;
|
|
2324
|
+
}
|
|
2325
|
+
async addChunk(threadId, content) {
|
|
2326
|
+
const buffer = this.getOrCreateBuffer(threadId);
|
|
2327
|
+
const chunk = content;
|
|
2328
|
+
buffer.chunks.push(chunk);
|
|
2329
|
+
buffer.updatedAt = Date.now();
|
|
2330
|
+
buffer.expiresAt = Date.now() + this.config.ttl;
|
|
2331
|
+
}
|
|
2332
|
+
async getChunks(threadId) {
|
|
2333
|
+
const buffer = this.getBufferIfValid(threadId);
|
|
2334
|
+
return buffer ? [...buffer.chunks] : [];
|
|
2335
|
+
}
|
|
2336
|
+
async getAccumulatedContent(threadId) {
|
|
2337
|
+
const buffer = this.getBufferIfValid(threadId);
|
|
2338
|
+
if (!buffer) return "";
|
|
2339
|
+
return buffer.chunks.map((chunk) => chunk.data?.content).join("");
|
|
2340
|
+
}
|
|
2341
|
+
async getChunksByMessageId(threadId, messageId) {
|
|
2342
|
+
const buffer = this.getBufferIfValid(threadId);
|
|
2343
|
+
if (!buffer) return [];
|
|
2344
|
+
return buffer.chunks.filter((chunk) => chunk.data?.id === messageId);
|
|
2345
|
+
}
|
|
2346
|
+
async completeThread(threadId) {
|
|
2347
|
+
const buffer = this.getBufferIfValid(threadId);
|
|
2348
|
+
if (buffer) {
|
|
2349
|
+
buffer.status = "completed" /* COMPLETED */;
|
|
2350
|
+
buffer.updatedAt = Date.now();
|
|
2351
|
+
}
|
|
2352
|
+
}
|
|
2353
|
+
async abortThread(threadId) {
|
|
2354
|
+
const buffer = this.getBufferIfValid(threadId);
|
|
2355
|
+
if (buffer) {
|
|
2356
|
+
buffer.status = "aborted" /* ABORTED */;
|
|
2357
|
+
buffer.updatedAt = Date.now();
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
2360
|
+
async isThreadActive(threadId) {
|
|
2361
|
+
const buffer = this.getBufferIfValid(threadId);
|
|
2362
|
+
return buffer?.status === "active" /* ACTIVE */;
|
|
2363
|
+
}
|
|
2364
|
+
async getThreadStatus(threadId) {
|
|
2365
|
+
return this.getBufferIfValid(threadId)?.status;
|
|
2366
|
+
}
|
|
2367
|
+
async getThreadBuffer(threadId) {
|
|
2368
|
+
const buffer = this.getBufferIfValid(threadId);
|
|
2369
|
+
if (!buffer) return void 0;
|
|
2370
|
+
return {
|
|
2371
|
+
...buffer,
|
|
2372
|
+
chunks: [...buffer.chunks]
|
|
2373
|
+
};
|
|
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
|
+
/**
|
|
2421
|
+
* Extend thread TTL
|
|
2422
|
+
*/
|
|
2423
|
+
async extendThreadTTL(threadId, additionalMs) {
|
|
2424
|
+
const buffer = this.getBufferIfValid(threadId);
|
|
2425
|
+
if (buffer) {
|
|
2426
|
+
const extension = additionalMs ?? this.config.ttl;
|
|
2427
|
+
buffer.expiresAt = Date.now() + extension;
|
|
2428
|
+
buffer.updatedAt = Date.now();
|
|
2429
|
+
}
|
|
2430
|
+
}
|
|
2431
|
+
/**
|
|
2432
|
+
* Get new chunks since known content
|
|
2433
|
+
* Used for resuming streams from a known position
|
|
2434
|
+
* Matches the known content and returns chunks after that position
|
|
2435
|
+
* Continues to yield new chunks as they are added until thread completes/aborts
|
|
2436
|
+
*/
|
|
2437
|
+
async *getNewChunksSinceContent(threadId, messageId, knownContent) {
|
|
2438
|
+
let buffer = this.getBufferIfValid(threadId);
|
|
2439
|
+
if (!buffer) return;
|
|
2440
|
+
let lastYieldedIndex = -1;
|
|
2441
|
+
let accumulatedContent = "";
|
|
2442
|
+
for (let i = 0; i < buffer.chunks.length; i++) {
|
|
2443
|
+
const chunk = buffer.chunks[i];
|
|
2444
|
+
if (chunk.data?.id === messageId) {
|
|
2445
|
+
accumulatedContent += chunk.data?.content || "";
|
|
2446
|
+
if (accumulatedContent === knownContent) {
|
|
2447
|
+
lastYieldedIndex = i;
|
|
2448
|
+
break;
|
|
2449
|
+
}
|
|
2450
|
+
if (accumulatedContent.length > knownContent.length) {
|
|
2451
|
+
if (accumulatedContent.startsWith(knownContent)) {
|
|
2452
|
+
lastYieldedIndex = i;
|
|
2453
|
+
break;
|
|
2454
|
+
}
|
|
2455
|
+
}
|
|
2456
|
+
}
|
|
2457
|
+
}
|
|
2458
|
+
const pollingInterval = 100;
|
|
2459
|
+
while (true) {
|
|
2460
|
+
buffer = this.getBufferIfValid(threadId);
|
|
2461
|
+
if (!buffer) break;
|
|
2462
|
+
let hasNewChunks = false;
|
|
2463
|
+
for (let i = lastYieldedIndex + 1; i < buffer.chunks.length; i++) {
|
|
2464
|
+
const chunk = buffer.chunks[i];
|
|
2465
|
+
if (chunk.data?.id === messageId) {
|
|
2466
|
+
yield chunk;
|
|
2467
|
+
lastYieldedIndex = i;
|
|
2468
|
+
hasNewChunks = true;
|
|
2469
|
+
}
|
|
2470
|
+
}
|
|
2471
|
+
if (buffer.status === "completed" /* COMPLETED */ || buffer.status === "aborted" /* ABORTED */) {
|
|
2472
|
+
break;
|
|
2473
|
+
}
|
|
2474
|
+
if (!hasNewChunks) {
|
|
2475
|
+
await new Promise((resolve) => setTimeout(resolve, pollingInterval));
|
|
2476
|
+
}
|
|
2477
|
+
}
|
|
2478
|
+
}
|
|
2479
|
+
/**
|
|
2480
|
+
* Get statistics about the buffer
|
|
2481
|
+
*/
|
|
2482
|
+
getStats() {
|
|
2483
|
+
let activeCount = 0;
|
|
2484
|
+
let completedCount = 0;
|
|
2485
|
+
let abortedCount = 0;
|
|
2486
|
+
let totalChunks = 0;
|
|
2487
|
+
const validBuffers = [];
|
|
2488
|
+
for (const [threadId, buffer] of this.buffers.entries()) {
|
|
2489
|
+
if (this.isExpired(buffer)) {
|
|
2490
|
+
this.buffers.delete(threadId);
|
|
2491
|
+
} else {
|
|
2492
|
+
validBuffers.push(buffer);
|
|
2493
|
+
}
|
|
2494
|
+
}
|
|
2495
|
+
for (const buffer of validBuffers) {
|
|
2496
|
+
totalChunks += buffer.chunks.length;
|
|
2497
|
+
switch (buffer.status) {
|
|
2498
|
+
case "active" /* ACTIVE */:
|
|
2499
|
+
activeCount++;
|
|
2500
|
+
break;
|
|
2501
|
+
case "completed" /* COMPLETED */:
|
|
2502
|
+
completedCount++;
|
|
2503
|
+
break;
|
|
2504
|
+
case "aborted" /* ABORTED */:
|
|
2505
|
+
abortedCount++;
|
|
2506
|
+
break;
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
return {
|
|
2510
|
+
totalThreads: validBuffers.length,
|
|
2511
|
+
activeThreads: activeCount,
|
|
2512
|
+
completedThreads: completedCount,
|
|
2513
|
+
abortedThreads: abortedCount,
|
|
2514
|
+
totalChunks,
|
|
2515
|
+
config: this.config
|
|
2516
|
+
};
|
|
2517
|
+
}
|
|
2518
|
+
/**
|
|
2519
|
+
* Cleanup method for graceful shutdown
|
|
2520
|
+
*/
|
|
2521
|
+
dispose() {
|
|
2522
|
+
this.stopCleanupTimer();
|
|
2523
|
+
this.buffers.clear();
|
|
2524
|
+
}
|
|
2525
|
+
};
|
|
2526
|
+
|
|
2527
|
+
// src/chunk_buffer_lattice/ChunkBufferLatticeManager.ts
|
|
2528
|
+
var ChunkBufferLatticeManager = class _ChunkBufferLatticeManager extends BaseLatticeManager {
|
|
2529
|
+
/**
|
|
2530
|
+
* Private constructor for singleton pattern
|
|
2531
|
+
*/
|
|
2532
|
+
constructor() {
|
|
2533
|
+
super();
|
|
2534
|
+
}
|
|
2535
|
+
/**
|
|
2536
|
+
* Get singleton instance
|
|
2537
|
+
*/
|
|
2538
|
+
static getInstance() {
|
|
2539
|
+
if (!_ChunkBufferLatticeManager.instance) {
|
|
2540
|
+
_ChunkBufferLatticeManager.instance = new _ChunkBufferLatticeManager();
|
|
2541
|
+
}
|
|
2542
|
+
return _ChunkBufferLatticeManager.instance;
|
|
2543
|
+
}
|
|
2544
|
+
/**
|
|
2545
|
+
* Get Lattice type identifier
|
|
2546
|
+
*/
|
|
2547
|
+
getLatticeType() {
|
|
2548
|
+
return "chunk_buffer";
|
|
2549
|
+
}
|
|
2550
|
+
};
|
|
2551
|
+
var getChunkBuffer = (key) => ChunkBufferLatticeManager.getInstance().get(key);
|
|
2552
|
+
var registerChunkBuffer = (key, buffer) => ChunkBufferLatticeManager.getInstance().register(key, buffer);
|
|
2553
|
+
var hasChunkBuffer = (key) => ChunkBufferLatticeManager.getInstance().has(key);
|
|
2554
|
+
|
|
2213
2555
|
// src/index.ts
|
|
2214
2556
|
var Protocols = __toESM(require("@axiom-lattice/protocols"));
|
|
2215
2557
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -2217,11 +2559,15 @@ var Protocols = __toESM(require("@axiom-lattice/protocols"));
|
|
|
2217
2559
|
AgentConfig,
|
|
2218
2560
|
AgentLatticeManager,
|
|
2219
2561
|
AgentType,
|
|
2562
|
+
ChunkBuffer,
|
|
2563
|
+
ChunkBufferLatticeManager,
|
|
2220
2564
|
GraphBuildOptions,
|
|
2565
|
+
InMemoryChunkBuffer,
|
|
2221
2566
|
MemoryLatticeManager,
|
|
2222
2567
|
MemoryType,
|
|
2223
2568
|
ModelLatticeManager,
|
|
2224
2569
|
Protocols,
|
|
2570
|
+
ThreadStatus,
|
|
2225
2571
|
ToolLatticeManager,
|
|
2226
2572
|
agentLatticeManager,
|
|
2227
2573
|
getAgentClient,
|
|
@@ -2230,14 +2576,17 @@ var Protocols = __toESM(require("@axiom-lattice/protocols"));
|
|
|
2230
2576
|
getAllAgentConfigs,
|
|
2231
2577
|
getAllToolDefinitions,
|
|
2232
2578
|
getCheckpointSaver,
|
|
2579
|
+
getChunkBuffer,
|
|
2233
2580
|
getModelLattice,
|
|
2234
2581
|
getToolClient,
|
|
2235
2582
|
getToolDefinition,
|
|
2236
2583
|
getToolLattice,
|
|
2584
|
+
hasChunkBuffer,
|
|
2237
2585
|
modelLatticeManager,
|
|
2238
2586
|
registerAgentLattice,
|
|
2239
2587
|
registerAgentLattices,
|
|
2240
2588
|
registerCheckpointSaver,
|
|
2589
|
+
registerChunkBuffer,
|
|
2241
2590
|
registerModelLattice,
|
|
2242
2591
|
registerToolLattice,
|
|
2243
2592
|
toolLatticeManager,
|