@botbotgo/agent-harness 0.0.267 → 0.0.269
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 +8 -0
- package/README.zh.md +7 -0
- package/dist/acp.js +2 -2
- package/dist/api.d.ts +6 -11
- package/dist/api.js +20 -23
- package/dist/contracts/runtime.d.ts +38 -70
- package/dist/flow/build-flow-graph.js +29 -45
- package/dist/flow/types.d.ts +0 -6
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/persistence/file-store.js +24 -17
- package/dist/persistence/sqlite-run-context-store.js +2 -2
- package/dist/persistence/sqlite-store.js +18 -16
- package/dist/protocol/a2a/http.js +48 -46
- package/dist/protocol/ag-ui/http.js +9 -9
- package/dist/runtime/adapter/invocation-result.js +2 -2
- package/dist/runtime/harness/events/listener-runtime.d.ts +2 -2
- package/dist/runtime/harness/events/streaming.d.ts +8 -8
- package/dist/runtime/harness/events/streaming.js +10 -10
- package/dist/runtime/harness/events/timeline.js +4 -4
- package/dist/runtime/harness/run/helpers.js +2 -2
- package/dist/runtime/harness/run/recovery.js +20 -20
- package/dist/runtime/harness/run/resume.js +3 -3
- package/dist/runtime/harness/run/run-lifecycle.js +5 -5
- package/dist/runtime/harness/run/run-operations.d.ts +2 -2
- package/dist/runtime/harness/run/run-operations.js +21 -21
- package/dist/runtime/harness/run/start-run.d.ts +3 -3
- package/dist/runtime/harness/run/start-run.js +3 -3
- package/dist/runtime/harness/run/startup-runtime.js +1 -1
- package/dist/runtime/harness/run/stream-run.js +37 -27
- package/dist/runtime/harness/run/thread-records.js +12 -33
- package/dist/runtime/harness/system/mem0-ingestion-sync.js +2 -2
- package/dist/runtime/harness/system/runtime-memory-manager.js +4 -4
- package/dist/runtime/harness/system/runtime-memory-records.js +6 -6
- package/dist/runtime/harness/system/runtime-memory-sync.js +6 -4
- package/dist/runtime/harness/system/thread-memory-sync.js +7 -5
- package/dist/runtime/harness.d.ts +2 -2
- package/dist/runtime/harness.js +161 -156
- package/dist/runtime/support/harness-support.js +4 -4
- package/dist/workspace/compile.js +6 -5
- package/dist/workspace/object-loader.d.ts +4 -1
- package/dist/workspace/object-loader.js +13 -5
- package/dist/workspace/support/workspace-ref-utils.d.ts +5 -0
- package/dist/workspace/support/workspace-ref-utils.js +9 -0
- package/dist/workspace/tool-hydration.d.ts +2 -1
- package/dist/workspace/tool-hydration.js +4 -4
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ParsedAgentObject, WorkspaceLoadOptions, WorkspaceObject } from "../contracts/types.js";
|
|
2
|
+
import type { ToolModuleDiscoveryScope } from "./support/workspace-ref-utils.js";
|
|
2
3
|
export { normalizeYamlItem, readYamlItems } from "./yaml-object-reader.js";
|
|
3
4
|
type RefMap = Map<string, WorkspaceObject | ParsedAgentObject>;
|
|
4
5
|
export type WorkspaceObjects = {
|
|
@@ -7,7 +8,9 @@ export type WorkspaceObjects = {
|
|
|
7
8
|
};
|
|
8
9
|
export declare function conventionalPackageRoots(root: string, relativeDir: "tools" | "skills"): string[];
|
|
9
10
|
export declare function parseAgentItem(item: Record<string, unknown>, sourcePath: string): ParsedAgentObject;
|
|
10
|
-
export declare function readToolModuleItems(root: string
|
|
11
|
+
export declare function readToolModuleItems(root: string, options?: {
|
|
12
|
+
scope?: ToolModuleDiscoveryScope;
|
|
13
|
+
}): Promise<Array<{
|
|
11
14
|
item: Record<string, unknown>;
|
|
12
15
|
sourcePath: string;
|
|
13
16
|
}>>;
|
|
@@ -613,7 +613,14 @@ async function loadModuleAgentsForRoot(root, mergedAgents) {
|
|
|
613
613
|
}
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
|
-
|
|
616
|
+
function getMergedToolModuleDiscoveryScope(mergedObjects) {
|
|
617
|
+
const runtimeDefaults = mergedObjects.get("runtime/default")?.item;
|
|
618
|
+
const toolModuleDiscovery = typeof runtimeDefaults?.toolModuleDiscovery === "object" && runtimeDefaults.toolModuleDiscovery
|
|
619
|
+
? runtimeDefaults.toolModuleDiscovery
|
|
620
|
+
: {};
|
|
621
|
+
return toolModuleDiscovery.scope === "top-level" ? "top-level" : "recursive";
|
|
622
|
+
}
|
|
623
|
+
async function loadConventionalObjectsForRoot(root, mergedObjects, toolModuleDiscoveryScope) {
|
|
617
624
|
for (const directory of CONVENTIONAL_OBJECT_DIRECTORIES) {
|
|
618
625
|
for (const objectRoot of conventionalDirectoryRoots(root, directory)) {
|
|
619
626
|
for (const { item, sourcePath } of await readYamlItemsIgnoringNodeModules(objectRoot)) {
|
|
@@ -623,7 +630,7 @@ async function loadConventionalObjectsForRoot(root, mergedObjects) {
|
|
|
623
630
|
}
|
|
624
631
|
mergeWorkspaceObjectRecord(mergedObjects, workspaceObject, item, sourcePath);
|
|
625
632
|
}
|
|
626
|
-
for (const { item, sourcePath } of await readToolModuleItems(objectRoot)) {
|
|
633
|
+
for (const { item, sourcePath } of await readToolModuleItems(objectRoot, { scope: toolModuleDiscoveryScope })) {
|
|
627
634
|
const workspaceObject = parseWorkspaceObject(item, sourcePath);
|
|
628
635
|
if (!workspaceObject) {
|
|
629
636
|
continue;
|
|
@@ -785,10 +792,11 @@ async function loadRootObjects(root, mergedObjects) {
|
|
|
785
792
|
function isAgentKind(kind) {
|
|
786
793
|
return kind === "agent";
|
|
787
794
|
}
|
|
788
|
-
export async function readToolModuleItems(root) {
|
|
795
|
+
export async function readToolModuleItems(root, options = {}) {
|
|
789
796
|
if (!(await fileExists(root))) {
|
|
790
797
|
return [];
|
|
791
798
|
}
|
|
799
|
+
const scope = options.scope === "top-level" ? "top-level" : "recursive";
|
|
792
800
|
const files = [];
|
|
793
801
|
const pending = [root];
|
|
794
802
|
while (pending.length > 0) {
|
|
@@ -798,7 +806,7 @@ export async function readToolModuleItems(root) {
|
|
|
798
806
|
const entryPath = path.join(current, entry.name);
|
|
799
807
|
const entryType = await resolveScanEntryType(entryPath, entry);
|
|
800
808
|
if (entryType === "directory") {
|
|
801
|
-
if (shouldSkipScanDirectory(entry.name)) {
|
|
809
|
+
if (shouldSkipScanDirectory(entry.name) || scope === "top-level") {
|
|
802
810
|
continue;
|
|
803
811
|
}
|
|
804
812
|
pending.push(entryPath);
|
|
@@ -886,7 +894,7 @@ export async function loadWorkspaceObjects(workspaceRoot, options = {}) {
|
|
|
886
894
|
const configRoot = conventionalConfigRoot(root) ?? root;
|
|
887
895
|
await loadConfigYamlForRoot(root, configRoot, mergedAgents, mergedObjects);
|
|
888
896
|
await loadModuleAgentsForRoot(root, mergedAgents);
|
|
889
|
-
await loadConventionalObjectsForRoot(root, mergedObjects);
|
|
897
|
+
await loadConventionalObjectsForRoot(root, mergedObjects, getMergedToolModuleDiscoveryScope(mergedObjects));
|
|
890
898
|
await loadModuleObjectsForRoot(root, mergedObjects);
|
|
891
899
|
await loadRootObjects(root, mergedObjects);
|
|
892
900
|
}
|
|
@@ -31,9 +31,14 @@ export type ProviderRetryConfig = {
|
|
|
31
31
|
export type ResilienceConfig = {
|
|
32
32
|
providerRetries: ProviderRetryConfig;
|
|
33
33
|
};
|
|
34
|
+
export type ToolModuleDiscoveryScope = "recursive" | "top-level";
|
|
35
|
+
export type ToolModuleDiscoveryConfig = {
|
|
36
|
+
scope: ToolModuleDiscoveryScope;
|
|
37
|
+
};
|
|
34
38
|
export declare function getWorkspaceObject(refs: Map<string, WorkspaceObject | ParsedAgentObject>, ref: string | undefined): WorkspaceObject | undefined;
|
|
35
39
|
export declare function getRuntimeDefaults(refs: Map<string, WorkspaceObject | ParsedAgentObject>): Record<string, unknown> | undefined;
|
|
36
40
|
export declare function getRuntimeResources(refs: Map<string, WorkspaceObject | ParsedAgentObject>): string[];
|
|
41
|
+
export declare function getToolModuleDiscoveryConfig(refs: Map<string, WorkspaceObject | ParsedAgentObject>): ToolModuleDiscoveryConfig;
|
|
37
42
|
export declare function getRuntimeMemoryDefaults(refs: Map<string, WorkspaceObject | ParsedAgentObject>): Record<string, unknown> | undefined;
|
|
38
43
|
export declare function getRecoveryConfig(refs: Map<string, WorkspaceObject | ParsedAgentObject>): RecoveryConfig;
|
|
39
44
|
export declare function getConcurrencyConfig(refs: Map<string, WorkspaceObject | ParsedAgentObject>): ConcurrencyConfig;
|
|
@@ -35,6 +35,15 @@ export function getRuntimeResources(refs) {
|
|
|
35
35
|
.filter((value) => typeof value === "string" && value.trim().length > 0)
|
|
36
36
|
.map((value) => value.trim());
|
|
37
37
|
}
|
|
38
|
+
export function getToolModuleDiscoveryConfig(refs) {
|
|
39
|
+
const runtimeDefaults = getRuntimeDefaults(refs);
|
|
40
|
+
const toolModuleDiscovery = typeof runtimeDefaults?.toolModuleDiscovery === "object" && runtimeDefaults.toolModuleDiscovery
|
|
41
|
+
? runtimeDefaults.toolModuleDiscovery
|
|
42
|
+
: {};
|
|
43
|
+
return {
|
|
44
|
+
scope: toolModuleDiscovery.scope === "top-level" ? "top-level" : "recursive",
|
|
45
|
+
};
|
|
46
|
+
}
|
|
38
47
|
export function getRuntimeMemoryDefaults(refs) {
|
|
39
48
|
const runtimeMemories = Array.from(refs.values()).filter((object) => !("executionMode" in object) && object.kind === "runtime-memory");
|
|
40
49
|
if (runtimeMemories.length === 0) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { ParsedAgentObject, ParsedMcpServerObject, ParsedToolObject } from "../contracts/types.js";
|
|
2
|
-
|
|
2
|
+
import type { ToolModuleDiscoveryScope } from "./support/workspace-ref-utils.js";
|
|
3
|
+
export declare function hydrateResourceAndExternalTools(tools: Map<string, ParsedToolObject>, toolSourceRefs: string[], workspaceRoot: string, toolModuleDiscoveryScope?: ToolModuleDiscoveryScope): Promise<void>;
|
|
3
4
|
export declare function hydrateAgentMcpTools(agents: ParsedAgentObject[], mcpServers: Map<string, ParsedMcpServerObject>, tools: Map<string, ParsedToolObject>): Promise<void>;
|
|
@@ -144,11 +144,11 @@ function mergeReferencedMcpServer(referencedServer, item, agentId, name, sourceP
|
|
|
144
144
|
sourcePath,
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
|
-
async function hydrateExternalToolSource(tools, source, workspaceRoot) {
|
|
147
|
+
async function hydrateExternalToolSource(tools, source, workspaceRoot, toolModuleDiscoveryScope) {
|
|
148
148
|
const externalRoot = await ensureExternalResourceSource(source, workspaceRoot);
|
|
149
149
|
const discoveredToolRefs = [];
|
|
150
150
|
const sourcePrefix = `external.${createHash("sha256").update(source).digest("hex").slice(0, 12)}`;
|
|
151
|
-
for (const { item, sourcePath } of await readToolModuleItems(path.join(externalRoot, "tools"))) {
|
|
151
|
+
for (const { item, sourcePath } of await readToolModuleItems(path.join(externalRoot, "tools"), { scope: toolModuleDiscoveryScope })) {
|
|
152
152
|
const toolId = typeof item.id === "string" ? item.id : undefined;
|
|
153
153
|
if (!toolId) {
|
|
154
154
|
continue;
|
|
@@ -179,10 +179,10 @@ async function hydrateExternalToolSource(tools, source, workspaceRoot) {
|
|
|
179
179
|
});
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
export async function hydrateResourceAndExternalTools(tools, toolSourceRefs, workspaceRoot) {
|
|
182
|
+
export async function hydrateResourceAndExternalTools(tools, toolSourceRefs, workspaceRoot, toolModuleDiscoveryScope = "recursive") {
|
|
183
183
|
for (const source of toolSourceRefs) {
|
|
184
184
|
if (isExternalSourceLocator(source)) {
|
|
185
|
-
await hydrateExternalToolSource(tools, source, workspaceRoot);
|
|
185
|
+
await hydrateExternalToolSource(tools, source, workspaceRoot, toolModuleDiscoveryScope);
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
188
|
for (const resourceTool of await listResourceTools(toolSourceRefs, workspaceRoot)) {
|