@botbotgo/agent-harness 0.0.107 → 0.0.109
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/runtime/adapter/execution-context.d.ts +34 -0
- package/dist/runtime/adapter/execution-context.js +52 -0
- package/dist/runtime/adapter/middleware-assembly.js +29 -14
- package/dist/runtime/adapter/runnable-config.d.ts +57 -0
- package/dist/runtime/adapter/runnable-config.js +64 -0
- package/dist/runtime/adapter/runtime-adapter-support.d.ts +0 -1
- package/dist/runtime/adapter/runtime-adapter-support.js +5 -8
- package/dist/runtime/agent-runtime-adapter.js +28 -34
- package/dist/runtime/harness/background-runtime.d.ts +13 -0
- package/dist/runtime/harness/background-runtime.js +8 -0
- package/dist/runtime/harness/bindings.d.ts +14 -0
- package/dist/runtime/harness/bindings.js +23 -0
- package/dist/runtime/harness/events/listener-runtime.d.ts +18 -0
- package/dist/runtime/harness/events/listener-runtime.js +9 -0
- package/dist/runtime/harness/events/runtime-event-operations.d.ts +17 -0
- package/dist/runtime/harness/events/runtime-event-operations.js +9 -0
- package/dist/runtime/harness/run/recovery.d.ts +1 -1
- package/dist/runtime/harness/run/resume-runtime.d.ts +55 -0
- package/dist/runtime/harness/run/resume-runtime.js +26 -0
- package/dist/runtime/harness/run/routing.d.ts +8 -0
- package/dist/runtime/harness/run/routing.js +21 -0
- package/dist/runtime/harness/run/run-operations.d.ts +47 -0
- package/dist/runtime/harness/run/run-operations.js +67 -0
- package/dist/runtime/harness/run/start-run.d.ts +82 -0
- package/dist/runtime/harness/run/start-run.js +88 -0
- package/dist/runtime/harness/run/startup-runtime.d.ts +2 -1
- package/dist/runtime/harness/run/startup-runtime.js +38 -3
- package/dist/runtime/harness/run/stream-runtime.d.ts +48 -0
- package/dist/runtime/harness/run/stream-runtime.js +14 -0
- package/dist/runtime/harness.d.ts +5 -6
- package/dist/runtime/harness.js +186 -299
- package/dist/runtime/support/compiled-binding.d.ts +14 -0
- package/dist/runtime/support/compiled-binding.js +14 -10
- package/dist/runtime/support/runtime-adapter-options.d.ts +17 -0
- package/dist/runtime/support/runtime-adapter-options.js +29 -0
- package/package.json +1 -1
- package/dist/runtime/adapter/deepagent-runnable-config.d.ts +0 -30
- package/dist/runtime/adapter/deepagent-runnable-config.js +0 -22
- package/dist/runtime/adapter/langchain-runnable-config.d.ts +0 -25
- package/dist/runtime/adapter/langchain-runnable-config.js +0 -19
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import type { CompiledAgentBinding, CompiledModel, CompiledTool, DeepAgentParams, LangChainAgentParams, RuntimeModelSlot } from "../../contracts/types.js";
|
|
2
|
+
export type BindingExecutionView = {
|
|
3
|
+
adapterKind: string;
|
|
4
|
+
adapterConfig: Record<string, unknown>;
|
|
5
|
+
langchainParams?: LangChainAgentParams;
|
|
6
|
+
deepAgentParams?: DeepAgentParams;
|
|
7
|
+
executionParams?: LangChainAgentParams | DeepAgentParams;
|
|
8
|
+
primaryTools: CompiledTool[];
|
|
9
|
+
primaryModel?: CompiledModel;
|
|
10
|
+
systemPrompt?: string;
|
|
11
|
+
middlewareConfigs?: Array<Record<string, unknown>>;
|
|
12
|
+
interruptCompatibilityRules?: Record<string, boolean | object>;
|
|
13
|
+
storeConfig?: Record<string, unknown>;
|
|
14
|
+
};
|
|
15
|
+
export declare function getBindingExecutionView(binding: CompiledAgentBinding): BindingExecutionView;
|
|
2
16
|
export declare function getBindingAdapterKind(binding: CompiledAgentBinding): string;
|
|
3
17
|
export declare function getBindingAdapterConfig(binding: CompiledAgentBinding): Record<string, unknown>;
|
|
4
18
|
export declare function getBindingLangChainParams(binding: CompiledAgentBinding): LangChainAgentParams | undefined;
|
|
@@ -24,6 +24,7 @@ function deriveBindingExecutionView(binding) {
|
|
|
24
24
|
adapterConfig,
|
|
25
25
|
langchainParams,
|
|
26
26
|
deepAgentParams,
|
|
27
|
+
executionParams: langchainParams ?? deepAgentParams,
|
|
27
28
|
primaryTools,
|
|
28
29
|
primaryModel: langchainParams?.model ?? deepAgentParams?.model,
|
|
29
30
|
systemPrompt: langchainParams?.systemPrompt ?? deepAgentParams?.systemPrompt,
|
|
@@ -35,17 +36,20 @@ function deriveBindingExecutionView(binding) {
|
|
|
35
36
|
bindingExecutionViewCache.set(binding, view);
|
|
36
37
|
return view;
|
|
37
38
|
}
|
|
39
|
+
export function getBindingExecutionView(binding) {
|
|
40
|
+
return deriveBindingExecutionView(binding);
|
|
41
|
+
}
|
|
38
42
|
export function getBindingAdapterKind(binding) {
|
|
39
|
-
return
|
|
43
|
+
return getBindingExecutionView(binding).adapterKind;
|
|
40
44
|
}
|
|
41
45
|
export function getBindingAdapterConfig(binding) {
|
|
42
|
-
return
|
|
46
|
+
return getBindingExecutionView(binding).adapterConfig;
|
|
43
47
|
}
|
|
44
48
|
export function getBindingLangChainParams(binding) {
|
|
45
|
-
return
|
|
49
|
+
return getBindingExecutionView(binding).langchainParams;
|
|
46
50
|
}
|
|
47
51
|
export function getBindingDeepAgentParams(binding) {
|
|
48
|
-
return
|
|
52
|
+
return getBindingExecutionView(binding).deepAgentParams;
|
|
49
53
|
}
|
|
50
54
|
export function isLangChainBinding(binding) {
|
|
51
55
|
return getBindingAdapterKind(binding) === "langchain-v1" || Boolean(binding.langchainAgentParams);
|
|
@@ -54,28 +58,28 @@ export function isDeepAgentBinding(binding) {
|
|
|
54
58
|
return getBindingAdapterKind(binding) === "deepagent" || Boolean(binding.deepAgentParams);
|
|
55
59
|
}
|
|
56
60
|
export function getBindingPrimaryTools(binding) {
|
|
57
|
-
return
|
|
61
|
+
return getBindingExecutionView(binding).primaryTools;
|
|
58
62
|
}
|
|
59
63
|
export function getBindingPrimaryModel(binding) {
|
|
60
|
-
return
|
|
64
|
+
return getBindingExecutionView(binding).primaryModel;
|
|
61
65
|
}
|
|
62
66
|
export function getBindingRuntimeModel(binding, slot) {
|
|
63
67
|
return binding.harnessRuntime.models?.[slot];
|
|
64
68
|
}
|
|
65
69
|
export function getBindingSystemPrompt(binding) {
|
|
66
|
-
return
|
|
70
|
+
return getBindingExecutionView(binding).systemPrompt;
|
|
67
71
|
}
|
|
68
72
|
export function getBindingMiddlewareConfigs(binding) {
|
|
69
|
-
return
|
|
73
|
+
return getBindingExecutionView(binding).middlewareConfigs;
|
|
70
74
|
}
|
|
71
75
|
export function getBindingInterruptCompatibilityRules(binding) {
|
|
72
|
-
return
|
|
76
|
+
return getBindingExecutionView(binding).interruptCompatibilityRules;
|
|
73
77
|
}
|
|
74
78
|
export function getBindingModelInit(binding) {
|
|
75
79
|
return getBindingPrimaryModel(binding)?.init;
|
|
76
80
|
}
|
|
77
81
|
export function getBindingStoreConfig(binding) {
|
|
78
|
-
return
|
|
82
|
+
return getBindingExecutionView(binding).storeConfig;
|
|
79
83
|
}
|
|
80
84
|
export function bindingHasSubagents(binding) {
|
|
81
85
|
return (getBindingDeepAgentParams(binding)?.subagents.length ?? 0) > 0;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { CompiledAgentBinding, RuntimeAdapterOptions, WorkspaceBundle } from "../../contracts/types.js";
|
|
2
|
+
import type { StoreLike } from "../harness/system/store.js";
|
|
3
|
+
export declare function createBindingStoreResolver(input: {
|
|
4
|
+
stores: Map<string, StoreLike>;
|
|
5
|
+
defaultStore: StoreLike;
|
|
6
|
+
getDefaultRunRoot: () => string;
|
|
7
|
+
}): (binding?: CompiledAgentBinding) => StoreLike;
|
|
8
|
+
export declare function resolveRuntimeAdapterOptions(input: {
|
|
9
|
+
workspace: WorkspaceBundle;
|
|
10
|
+
runtimeAdapterOptions: RuntimeAdapterOptions;
|
|
11
|
+
checkpointers: Map<string, unknown>;
|
|
12
|
+
stores: Map<string, StoreLike>;
|
|
13
|
+
defaultStore: StoreLike;
|
|
14
|
+
embeddingModels: Map<string, unknown>;
|
|
15
|
+
vectorStores: Map<string, unknown>;
|
|
16
|
+
getDefaultRunRoot: () => string;
|
|
17
|
+
}): RuntimeAdapterOptions;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { createResourceBackendResolver, createResourceToolResolver } from "../../resource/resource.js";
|
|
2
|
+
import { resolveCheckpointer, resolveEmbeddingModel, resolveStore, resolveVectorStore, } from "../harness/run/resources.js";
|
|
3
|
+
import { getBindingStoreConfig } from "./compiled-binding.js";
|
|
4
|
+
export function createBindingStoreResolver(input) {
|
|
5
|
+
return (binding) => resolveStore(input.stores, input.defaultStore, input.getDefaultRunRoot(), (currentBinding) => currentBinding ? getBindingStoreConfig(currentBinding) : undefined, binding);
|
|
6
|
+
}
|
|
7
|
+
export function resolveRuntimeAdapterOptions(input) {
|
|
8
|
+
const { workspace, runtimeAdapterOptions, checkpointers, stores, defaultStore, embeddingModels, vectorStores, getDefaultRunRoot, } = input;
|
|
9
|
+
const storeResolver = runtimeAdapterOptions.storeResolver ??
|
|
10
|
+
createBindingStoreResolver({
|
|
11
|
+
stores,
|
|
12
|
+
defaultStore,
|
|
13
|
+
getDefaultRunRoot,
|
|
14
|
+
});
|
|
15
|
+
return {
|
|
16
|
+
...runtimeAdapterOptions,
|
|
17
|
+
toolResolver: runtimeAdapterOptions.toolResolver ??
|
|
18
|
+
createResourceToolResolver(workspace, {
|
|
19
|
+
getStore: (binding) => binding ? storeResolver(binding) : defaultStore,
|
|
20
|
+
getEmbeddingModel: (embeddingModelRef) => resolveEmbeddingModel(workspace, embeddingModels, embeddingModelRef, runtimeAdapterOptions),
|
|
21
|
+
getVectorStore: (vectorStoreRef) => resolveVectorStore(workspace, vectorStores, vectorStoreRef, runtimeAdapterOptions),
|
|
22
|
+
}),
|
|
23
|
+
checkpointerResolver: runtimeAdapterOptions.checkpointerResolver ??
|
|
24
|
+
((binding) => resolveCheckpointer(checkpointers, binding)),
|
|
25
|
+
storeResolver,
|
|
26
|
+
backendResolver: runtimeAdapterOptions.backendResolver ??
|
|
27
|
+
((binding) => createResourceBackendResolver(workspace)(binding)),
|
|
28
|
+
};
|
|
29
|
+
}
|
package/package.json
CHANGED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { DeepAgentParams } from "../../contracts/types.js";
|
|
2
|
-
export declare function buildDeepAgentRunnableConfig(params: {
|
|
3
|
-
compatibleParams: DeepAgentParams;
|
|
4
|
-
resolvedModel: unknown;
|
|
5
|
-
resolvedTools: unknown[];
|
|
6
|
-
resolvedMiddleware: unknown[];
|
|
7
|
-
resolvedSubagents: unknown[];
|
|
8
|
-
resolvedCheckpointer: unknown;
|
|
9
|
-
resolvedStore: unknown;
|
|
10
|
-
resolvedBackend: unknown;
|
|
11
|
-
resolvedInterruptOn: unknown;
|
|
12
|
-
resolvedSkills: string[];
|
|
13
|
-
}): {
|
|
14
|
-
model: never;
|
|
15
|
-
tools: never;
|
|
16
|
-
systemPrompt: string | undefined;
|
|
17
|
-
responseFormat: never;
|
|
18
|
-
contextSchema: never;
|
|
19
|
-
middleware: never;
|
|
20
|
-
subagents: never;
|
|
21
|
-
checkpointer: never;
|
|
22
|
-
store: never;
|
|
23
|
-
backend: never;
|
|
24
|
-
interruptOn: never;
|
|
25
|
-
name: string;
|
|
26
|
-
memory: string[];
|
|
27
|
-
skills: string[];
|
|
28
|
-
generalPurposeAgent: boolean | undefined;
|
|
29
|
-
taskDescription: string | undefined;
|
|
30
|
-
};
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export function buildDeepAgentRunnableConfig(params) {
|
|
2
|
-
const { compatibleParams, resolvedModel, resolvedTools, resolvedMiddleware, resolvedSubagents, resolvedCheckpointer, resolvedStore, resolvedBackend, resolvedInterruptOn, resolvedSkills, } = params;
|
|
3
|
-
return {
|
|
4
|
-
...(compatibleParams.passthrough ?? {}),
|
|
5
|
-
model: resolvedModel,
|
|
6
|
-
tools: resolvedTools,
|
|
7
|
-
systemPrompt: compatibleParams.systemPrompt,
|
|
8
|
-
responseFormat: compatibleParams.responseFormat,
|
|
9
|
-
contextSchema: compatibleParams.contextSchema,
|
|
10
|
-
middleware: resolvedMiddleware,
|
|
11
|
-
subagents: resolvedSubagents,
|
|
12
|
-
checkpointer: resolvedCheckpointer,
|
|
13
|
-
store: resolvedStore,
|
|
14
|
-
backend: resolvedBackend,
|
|
15
|
-
interruptOn: resolvedInterruptOn,
|
|
16
|
-
name: compatibleParams.name,
|
|
17
|
-
memory: compatibleParams.memory,
|
|
18
|
-
skills: resolvedSkills,
|
|
19
|
-
generalPurposeAgent: compatibleParams.generalPurposeAgent,
|
|
20
|
-
taskDescription: compatibleParams.taskDescription,
|
|
21
|
-
};
|
|
22
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import type { LangChainAgentParams } from "../../contracts/types.js";
|
|
2
|
-
export declare function buildLangChainRunnableConfig(params: {
|
|
3
|
-
langchainParams: LangChainAgentParams;
|
|
4
|
-
resolvedModel: unknown;
|
|
5
|
-
resolvedTools: unknown[];
|
|
6
|
-
resolvedMiddleware: unknown[];
|
|
7
|
-
resolvedCheckpointer: unknown;
|
|
8
|
-
resolvedStore: unknown;
|
|
9
|
-
passthroughOverride?: Record<string, unknown>;
|
|
10
|
-
systemPromptOverride?: string;
|
|
11
|
-
}): {
|
|
12
|
-
model: never;
|
|
13
|
-
tools: never;
|
|
14
|
-
systemPrompt: string | undefined;
|
|
15
|
-
stateSchema: never;
|
|
16
|
-
responseFormat: never;
|
|
17
|
-
contextSchema: never;
|
|
18
|
-
middleware: never;
|
|
19
|
-
checkpointer: never;
|
|
20
|
-
store: never;
|
|
21
|
-
includeAgentName: "inline" | undefined;
|
|
22
|
-
version: "v1" | "v2" | undefined;
|
|
23
|
-
name: string | undefined;
|
|
24
|
-
description: string;
|
|
25
|
-
};
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
export function buildLangChainRunnableConfig(params) {
|
|
2
|
-
const { langchainParams, resolvedModel, resolvedTools, resolvedMiddleware, resolvedCheckpointer, resolvedStore, passthroughOverride, systemPromptOverride, } = params;
|
|
3
|
-
return {
|
|
4
|
-
...(passthroughOverride ?? langchainParams.passthrough ?? {}),
|
|
5
|
-
model: resolvedModel,
|
|
6
|
-
tools: resolvedTools,
|
|
7
|
-
systemPrompt: systemPromptOverride ?? langchainParams.systemPrompt,
|
|
8
|
-
stateSchema: langchainParams.stateSchema,
|
|
9
|
-
responseFormat: langchainParams.responseFormat,
|
|
10
|
-
contextSchema: langchainParams.contextSchema,
|
|
11
|
-
middleware: resolvedMiddleware,
|
|
12
|
-
checkpointer: resolvedCheckpointer,
|
|
13
|
-
store: resolvedStore,
|
|
14
|
-
includeAgentName: langchainParams.includeAgentName,
|
|
15
|
-
version: langchainParams.version,
|
|
16
|
-
name: langchainParams.name,
|
|
17
|
-
description: langchainParams.description,
|
|
18
|
-
};
|
|
19
|
-
}
|