@botbotgo/agent-harness 0.0.100 → 0.0.101
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/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/resource/resource-impl.js +78 -76
- package/dist/runtime/agent-runtime-adapter.d.ts +1 -12
- package/dist/runtime/agent-runtime-adapter.js +33 -148
- package/dist/runtime/harness/run/recovery.d.ts +42 -0
- package/dist/runtime/harness/run/recovery.js +139 -0
- package/dist/runtime/harness.d.ts +2 -17
- package/dist/runtime/harness.js +306 -473
- package/dist/runtime/support/runtime-factories.js +2 -2
- package/dist/workspace/object-loader.js +40 -78
- package/package.json +1 -1
- package/dist/runtime/checkpoint-maintenance.d.ts +0 -1
- package/dist/runtime/checkpoint-maintenance.js +0 -1
- package/dist/runtime/file-checkpoint-saver.d.ts +0 -1
- package/dist/runtime/file-checkpoint-saver.js +0 -1
- package/dist/runtime/sqlite-maintained-checkpoint-saver.d.ts +0 -1
- package/dist/runtime/sqlite-maintained-checkpoint-saver.js +0 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { MemorySaver } from "@langchain/langgraph";
|
|
3
3
|
import { SqliteSaver } from "@langchain/langgraph-checkpoint-sqlite";
|
|
4
|
-
import { FileCheckpointSaver } from "../file-checkpoint-saver.js";
|
|
5
|
-
import { ManagedSqliteSaver } from "../sqlite-maintained-checkpoint-saver.js";
|
|
4
|
+
import { FileCheckpointSaver } from "../maintenance/file-checkpoint-saver.js";
|
|
5
|
+
import { ManagedSqliteSaver } from "../maintenance/sqlite-maintained-checkpoint-saver.js";
|
|
6
6
|
import { createInMemoryStore, FileBackedStore } from "../harness/system/store.js";
|
|
7
7
|
export function createStoreForConfig(storeConfig, runRoot) {
|
|
8
8
|
const kind = typeof storeConfig.kind === "string" ? storeConfig.kind : "FileStore";
|
|
@@ -235,12 +235,29 @@ function readCapabilities(value) {
|
|
|
235
235
|
};
|
|
236
236
|
return Object.keys(capabilities).length > 0 ? capabilities : undefined;
|
|
237
237
|
}
|
|
238
|
+
const CONSUMED_AGENT_CONFIG_KEYS = [
|
|
239
|
+
"systemPrompt",
|
|
240
|
+
"checkpointer",
|
|
241
|
+
"interruptOn",
|
|
242
|
+
"stateSchema",
|
|
243
|
+
"responseFormat",
|
|
244
|
+
"contextSchema",
|
|
245
|
+
"includeAgentName",
|
|
246
|
+
"version",
|
|
247
|
+
"middleware",
|
|
248
|
+
"backend",
|
|
249
|
+
"store",
|
|
250
|
+
"runtimeMemory",
|
|
251
|
+
"taskDescription",
|
|
252
|
+
"generalPurposeAgent",
|
|
253
|
+
"filesystem",
|
|
254
|
+
];
|
|
238
255
|
function readExecutionConfig(value) {
|
|
239
256
|
return asMutableObject(value);
|
|
240
257
|
}
|
|
241
|
-
function
|
|
258
|
+
function readExecutionValue(item, key, reader) {
|
|
242
259
|
const execution = readExecutionConfig(item.execution);
|
|
243
|
-
return
|
|
260
|
+
return reader(execution?.[key]);
|
|
244
261
|
}
|
|
245
262
|
function readRuntimeConfig(item) {
|
|
246
263
|
return asMutableObject(item.runtime);
|
|
@@ -323,21 +340,13 @@ function resolveExecutionBackend(item, current) {
|
|
|
323
340
|
}
|
|
324
341
|
return undefined;
|
|
325
342
|
}
|
|
326
|
-
function
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}
|
|
334
|
-
function readExecutionPathArray(item, key) {
|
|
335
|
-
const execution = readExecutionConfig(item.execution);
|
|
336
|
-
return readPathArray(execution?.[key]);
|
|
337
|
-
}
|
|
338
|
-
function readExecutionObjectArray(item, key) {
|
|
339
|
-
const execution = readExecutionConfig(item.execution);
|
|
340
|
-
return readObjectArray(execution?.[key]);
|
|
343
|
+
function readSharedAgentConfigFields(config) {
|
|
344
|
+
return {
|
|
345
|
+
...(typeof config.store === "object" && config.store ? { store: config.store } : {}),
|
|
346
|
+
...(typeof config.runtimeMemory === "object" && config.runtimeMemory ? { runtimeMemory: config.runtimeMemory } : {}),
|
|
347
|
+
...(typeof config.taskDescription === "string" && config.taskDescription.trim() ? { taskDescription: config.taskDescription } : {}),
|
|
348
|
+
...(typeof config.generalPurposeAgent === "boolean" ? { generalPurposeAgent: config.generalPurposeAgent } : {}),
|
|
349
|
+
};
|
|
341
350
|
}
|
|
342
351
|
function readSharedAgentConfig(config) {
|
|
343
352
|
const middleware = readMiddlewareArray(config.middleware);
|
|
@@ -359,67 +368,20 @@ function readSharedAgentConfig(config) {
|
|
|
359
368
|
...(middleware ? { middleware } : {}),
|
|
360
369
|
};
|
|
361
370
|
}
|
|
362
|
-
function
|
|
363
|
-
const config =
|
|
364
|
-
const passthrough = readPassthroughConfig(config, [
|
|
365
|
-
"systemPrompt",
|
|
366
|
-
"checkpointer",
|
|
367
|
-
"interruptOn",
|
|
368
|
-
"stateSchema",
|
|
369
|
-
"responseFormat",
|
|
370
|
-
"contextSchema",
|
|
371
|
-
"includeAgentName",
|
|
372
|
-
"version",
|
|
373
|
-
"middleware",
|
|
374
|
-
"backend",
|
|
375
|
-
"store",
|
|
376
|
-
"runtimeMemory",
|
|
377
|
-
"taskDescription",
|
|
378
|
-
"generalPurposeAgent",
|
|
379
|
-
"filesystem",
|
|
380
|
-
]);
|
|
371
|
+
function readAgentConfig(item, options = {}) {
|
|
372
|
+
const config = readExecutionValue(item, "config", asMutableObject) ?? {};
|
|
373
|
+
const passthrough = readPassthroughConfig(config, [...CONSUMED_AGENT_CONFIG_KEYS]);
|
|
381
374
|
return {
|
|
382
375
|
...readSharedAgentConfig(config),
|
|
383
|
-
...(
|
|
384
|
-
...(typeof config.
|
|
385
|
-
...(typeof config.taskDescription === "string" && config.taskDescription.trim() ? { taskDescription: config.taskDescription } : {}),
|
|
386
|
-
...(typeof config.generalPurposeAgent === "boolean" ? { generalPurposeAgent: config.generalPurposeAgent } : {}),
|
|
387
|
-
...(passthrough ? { passthrough } : {}),
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
function readDeepAgentConfig(item) {
|
|
391
|
-
const config = readExecutionAgentConfig(item);
|
|
392
|
-
const passthrough = readPassthroughConfig(config, [
|
|
393
|
-
"systemPrompt",
|
|
394
|
-
"checkpointer",
|
|
395
|
-
"interruptOn",
|
|
396
|
-
"stateSchema",
|
|
397
|
-
"responseFormat",
|
|
398
|
-
"contextSchema",
|
|
399
|
-
"includeAgentName",
|
|
400
|
-
"version",
|
|
401
|
-
"middleware",
|
|
402
|
-
"backend",
|
|
403
|
-
"store",
|
|
404
|
-
"runtimeMemory",
|
|
405
|
-
"taskDescription",
|
|
406
|
-
"generalPurposeAgent",
|
|
407
|
-
"filesystem",
|
|
408
|
-
]);
|
|
409
|
-
return {
|
|
410
|
-
...readSharedAgentConfig(config),
|
|
411
|
-
...(typeof config.backend === "object" && config.backend ? { backend: config.backend } : {}),
|
|
412
|
-
...(typeof config.store === "object" && config.store ? { store: config.store } : {}),
|
|
413
|
-
...(typeof config.runtimeMemory === "object" && config.runtimeMemory ? { runtimeMemory: config.runtimeMemory } : {}),
|
|
414
|
-
...(typeof config.taskDescription === "string" && config.taskDescription.trim() ? { taskDescription: config.taskDescription } : {}),
|
|
415
|
-
...(typeof config.generalPurposeAgent === "boolean" ? { generalPurposeAgent: config.generalPurposeAgent } : {}),
|
|
376
|
+
...readSharedAgentConfigFields(config),
|
|
377
|
+
...(options.includeObjectBackend && typeof config.backend === "object" && config.backend ? { backend: config.backend } : {}),
|
|
416
378
|
...(passthrough ? { passthrough } : {}),
|
|
417
379
|
};
|
|
418
380
|
}
|
|
419
381
|
export function parseAgentItem(item, sourcePath) {
|
|
420
382
|
const moduleRoot = moduleRootForSourcePath(sourcePath, "agents");
|
|
421
|
-
const subagentRefs =
|
|
422
|
-
const subagentPathRefs =
|
|
383
|
+
const subagentRefs = readExecutionValue(item, "subagents", readRefArray);
|
|
384
|
+
const subagentPathRefs = readExecutionValue(item, "subagents", readPathArray).map((entry) => resolveModuleRelativePath(entry, moduleRoot));
|
|
423
385
|
const executionMode = String(resolveExecutionBackend(item) ?? "deepagent");
|
|
424
386
|
const runtime = readRuntimeConfig(item);
|
|
425
387
|
return {
|
|
@@ -430,16 +392,16 @@ export function parseAgentItem(item, sourcePath) {
|
|
|
430
392
|
? { delegation: true, memory: true }
|
|
431
393
|
: { delegation: true, memory: true }),
|
|
432
394
|
description: String(item.description ?? ""),
|
|
433
|
-
modelRef:
|
|
395
|
+
modelRef: readExecutionValue(item, "modelRef", readSingleRef) ?? "",
|
|
434
396
|
runRoot: typeof runtime?.runRoot === "string" ? runtime.runRoot : undefined,
|
|
435
|
-
toolRefs:
|
|
436
|
-
mcpServers:
|
|
437
|
-
skillPathRefs:
|
|
438
|
-
memorySources:
|
|
397
|
+
toolRefs: readExecutionValue(item, "tools", readRefArray),
|
|
398
|
+
mcpServers: readExecutionValue(item, "mcpServers", readObjectArray),
|
|
399
|
+
skillPathRefs: readExecutionValue(item, "skills", readPathArray).map((entry) => resolveModuleRelativePath(entry, moduleRoot)),
|
|
400
|
+
memorySources: readExecutionValue(item, "memory", readPathArray).map((entry) => resolveModuleRelativePath(entry, moduleRoot)),
|
|
439
401
|
subagentRefs,
|
|
440
402
|
subagentPathRefs,
|
|
441
|
-
langchainAgentConfig: normalizeModuleAgentConfig(
|
|
442
|
-
deepAgentConfig: normalizeModuleAgentConfig(
|
|
403
|
+
langchainAgentConfig: normalizeModuleAgentConfig(readAgentConfig(item), moduleRoot),
|
|
404
|
+
deepAgentConfig: normalizeModuleAgentConfig(readAgentConfig(item, { includeObjectBackend: true }), moduleRoot),
|
|
443
405
|
sourcePath,
|
|
444
406
|
};
|
|
445
407
|
}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./maintenance/checkpoint-maintenance.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./maintenance/checkpoint-maintenance.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./maintenance/file-checkpoint-saver.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./maintenance/file-checkpoint-saver.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./maintenance/sqlite-maintained-checkpoint-saver.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./maintenance/sqlite-maintained-checkpoint-saver.js";
|