@botbotgo/agent-harness 0.0.89 → 0.0.90
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/contracts/types.d.ts +1 -1
- package/dist/package-version.d.ts +1 -1
- package/dist/package-version.js +1 -1
- package/dist/runtime/harness.js +5 -4
- package/dist/runtime/inventory.d.ts +1 -1
- package/dist/runtime/inventory.js +3 -2
- package/dist/runtime/policy-engine.js +3 -2
- package/dist/runtime/support/harness-support.js +7 -6
- package/dist/runtime/support/runtime-entry.d.ts +2 -0
- package/dist/runtime/support/runtime-entry.js +3 -0
- package/dist/workspace/agent-binding-compiler.js +1 -1
- package/dist/workspace/compile.js +5 -5
- package/package.json +1 -1
|
@@ -200,7 +200,7 @@ export type CompiledAgentBinding = {
|
|
|
200
200
|
harnessRuntime: {
|
|
201
201
|
runRoot: string;
|
|
202
202
|
workspaceRoot?: string;
|
|
203
|
-
|
|
203
|
+
runtimeEntry: boolean;
|
|
204
204
|
capabilities?: RuntimeCapabilities;
|
|
205
205
|
resilience?: Record<string, unknown>;
|
|
206
206
|
checkpointer?: Record<string, unknown> | boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.89";
|
package/dist/package-version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.89";
|
package/dist/runtime/harness.js
CHANGED
|
@@ -18,6 +18,7 @@ import { HealthMonitor } from "./health-monitor.js";
|
|
|
18
18
|
import { extractMessageText, normalizeMessageContent } from "../utils/message-content.js";
|
|
19
19
|
import { createToolMcpServerFromTools, serveToolsOverStdioFromHarness } from "../mcp.js";
|
|
20
20
|
import { getBindingAdapterKind, getBindingPrimaryTools, getBindingStoreConfig, isDeepAgentBinding } from "./support/compiled-binding.js";
|
|
21
|
+
import { isRuntimeEntryBinding } from "./support/runtime-entry.js";
|
|
21
22
|
import { describeWorkspaceInventory, listAgentSkills as listWorkspaceAgentSkills, } from "./inventory.js";
|
|
22
23
|
export class AgentHarnessRuntime {
|
|
23
24
|
workspace;
|
|
@@ -87,7 +88,7 @@ export class AgentHarnessRuntime {
|
|
|
87
88
|
}
|
|
88
89
|
getDefaultHostAgentId() {
|
|
89
90
|
const orchestraBinding = this.workspace.bindings.get(AgentHarnessRuntime.DEFAULT_HOST_AGENT_ID);
|
|
90
|
-
if (orchestraBinding && orchestraBinding
|
|
91
|
+
if (orchestraBinding && isRuntimeEntryBinding(orchestraBinding)) {
|
|
91
92
|
return orchestraBinding.agent.id;
|
|
92
93
|
}
|
|
93
94
|
return this.heuristicRoute("");
|
|
@@ -119,7 +120,7 @@ export class AgentHarnessRuntime {
|
|
|
119
120
|
if (threadId) {
|
|
120
121
|
const thread = await this.getSession(threadId);
|
|
121
122
|
const threadBinding = thread ? this.workspace.bindings.get(thread.agentId) : undefined;
|
|
122
|
-
if (thread?.agentId && threadBinding
|
|
123
|
+
if (thread?.agentId && threadBinding && isRuntimeEntryBinding(threadBinding)) {
|
|
123
124
|
return thread.agentId;
|
|
124
125
|
}
|
|
125
126
|
}
|
|
@@ -394,7 +395,7 @@ export class AgentHarnessRuntime {
|
|
|
394
395
|
const configuredRule = this.routingRules.find((rule) => matchRoutingRule(rawInput, rule, options));
|
|
395
396
|
if (configuredRule) {
|
|
396
397
|
const configuredBinding = this.workspace.bindings.get(configuredRule.agentId);
|
|
397
|
-
if (configuredBinding && configuredBinding
|
|
398
|
+
if (configuredBinding && isRuntimeEntryBinding(configuredBinding)) {
|
|
398
399
|
return configuredBinding.agent.id;
|
|
399
400
|
}
|
|
400
401
|
}
|
|
@@ -402,7 +403,7 @@ export class AgentHarnessRuntime {
|
|
|
402
403
|
const defaultBinding = this.routingDefaultAgentId
|
|
403
404
|
? this.workspace.bindings.get(this.routingDefaultAgentId)
|
|
404
405
|
: primaryBinding;
|
|
405
|
-
if (defaultBinding && defaultBinding
|
|
406
|
+
if (defaultBinding && isRuntimeEntryBinding(defaultBinding)) {
|
|
406
407
|
return defaultBinding.agent.id;
|
|
407
408
|
}
|
|
408
409
|
}
|
|
@@ -20,7 +20,7 @@ export type InventorySkillRecord = {
|
|
|
20
20
|
export type InventoryAgentRecord = {
|
|
21
21
|
id: string;
|
|
22
22
|
description: string;
|
|
23
|
-
role: "
|
|
23
|
+
role: "runtime-entry" | "specialist";
|
|
24
24
|
tools: InventoryToolRecord[];
|
|
25
25
|
skills: InventorySkillRecord[];
|
|
26
26
|
};
|
|
@@ -2,8 +2,9 @@ import { readSkillMetadata } from "./support/skill-metadata.js";
|
|
|
2
2
|
import { getBindingPrimaryTools } from "./support/compiled-binding.js";
|
|
3
3
|
import { assessSkillRequirements, } from "./skill-requirements.js";
|
|
4
4
|
import { createRuntimeEnv } from "./support/runtime-env.js";
|
|
5
|
+
import { isRuntimeEntryBinding } from "./support/runtime-entry.js";
|
|
5
6
|
function listHostBindings(workspace) {
|
|
6
|
-
return Array.from(workspace.bindings.values()).filter((binding) => binding
|
|
7
|
+
return Array.from(workspace.bindings.values()).filter((binding) => isRuntimeEntryBinding(binding));
|
|
7
8
|
}
|
|
8
9
|
export function findAgentBinding(workspace, agentId) {
|
|
9
10
|
return workspace.bindings.get(agentId);
|
|
@@ -95,7 +96,7 @@ export function listAvailableAgents(workspace, options = {}) {
|
|
|
95
96
|
const topLevel = listHostBindings(workspace).map((binding) => ({
|
|
96
97
|
id: binding.agent.id,
|
|
97
98
|
description: binding.agent.description,
|
|
98
|
-
role: "
|
|
99
|
+
role: "runtime-entry",
|
|
99
100
|
tools: listAgentTools(workspace, binding.agent.id),
|
|
100
101
|
skills: listAgentSkills(workspace, binding.agent.id, options),
|
|
101
102
|
}));
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { getPolicyEvaluators } from "../extensions.js";
|
|
2
|
+
import { isRuntimeEntryBinding } from "./support/runtime-entry.js";
|
|
2
3
|
export class PolicyEngine {
|
|
3
4
|
evaluate(binding) {
|
|
4
5
|
const reasons = [];
|
|
5
6
|
let allowed = true;
|
|
6
|
-
if (!binding
|
|
7
|
+
if (!isRuntimeEntryBinding(binding)) {
|
|
7
8
|
allowed = false;
|
|
8
|
-
reasons.push("internal subagents cannot be used as
|
|
9
|
+
reasons.push("internal subagents cannot be used as runtime entry agents");
|
|
9
10
|
}
|
|
10
11
|
for (const evaluator of getPolicyEvaluators()) {
|
|
11
12
|
const decision = evaluator.evaluate(binding);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createPersistentId } from "../../utils/id.js";
|
|
2
2
|
import { isDelegationCapableBinding } from "../../workspace/support/agent-capabilities.js";
|
|
3
|
+
import { isRuntimeEntryBinding } from "./runtime-entry.js";
|
|
3
4
|
export function renderRuntimeFailure(error) {
|
|
4
5
|
const message = error instanceof Error ? error.message : String(error);
|
|
5
6
|
return `runtime_error=${message}`.trim();
|
|
@@ -129,9 +130,9 @@ export function createPendingApproval(threadId, runId, checkpointRef, input, int
|
|
|
129
130
|
};
|
|
130
131
|
}
|
|
131
132
|
export function inferRoutingBindings(workspace) {
|
|
132
|
-
const
|
|
133
|
-
const deepAgentHosts =
|
|
134
|
-
const routingHosts = deepAgentHosts.length > 0 ? deepAgentHosts :
|
|
133
|
+
const runtimeEntryBindings = Array.from(workspace.bindings.values()).filter((binding) => isRuntimeEntryBinding(binding));
|
|
134
|
+
const deepAgentHosts = runtimeEntryBindings.filter((binding) => binding.agent.executionMode === "deepagent" || Boolean(binding.deepAgentParams));
|
|
135
|
+
const routingHosts = deepAgentHosts.length > 0 ? deepAgentHosts : runtimeEntryBindings;
|
|
135
136
|
const researchBinding = routingHosts.find((binding) => binding.agent.id === "research-lite" || binding.agent.id === "research");
|
|
136
137
|
const directBinding = routingHosts.find((binding) => binding.agent.id === "direct");
|
|
137
138
|
const delegationHosts = routingHosts.filter((binding) => isDelegationCapableBinding(binding));
|
|
@@ -142,7 +143,7 @@ export function inferRoutingBindings(workspace) {
|
|
|
142
143
|
const delegationPreferredSecondary = delegationHosts.find((binding) => (binding.deepAgentParams?.subagents.length ?? 0) > 0) ??
|
|
143
144
|
delegationHosts[0];
|
|
144
145
|
const genericLightweightHost = lightweightHosts.find((binding) => binding.agent.id !== researchBinding?.agent.id);
|
|
145
|
-
const primaryBinding = defaultOrchestratingHost ?? directBinding ?? genericLightweightHost ?? routingHosts[0] ??
|
|
146
|
+
const primaryBinding = defaultOrchestratingHost ?? directBinding ?? genericLightweightHost ?? routingHosts[0] ?? runtimeEntryBindings[0];
|
|
146
147
|
const secondaryBinding = genericLightweightHost && genericLightweightHost.agent.id !== primaryBinding?.agent.id
|
|
147
148
|
? genericLightweightHost
|
|
148
149
|
: directBinding && directBinding.agent.id !== primaryBinding?.agent.id
|
|
@@ -150,6 +151,6 @@ export function inferRoutingBindings(workspace) {
|
|
|
150
151
|
: delegationPreferredSecondary && delegationPreferredSecondary.agent.id !== primaryBinding?.agent.id
|
|
151
152
|
? delegationPreferredSecondary
|
|
152
153
|
: routingHosts.find((binding) => binding.agent.id !== primaryBinding?.agent.id) ??
|
|
153
|
-
(deepAgentHosts.length > 0 ? undefined :
|
|
154
|
-
return { primaryBinding, secondaryBinding, researchBinding, hostBindings };
|
|
154
|
+
(deepAgentHosts.length > 0 ? undefined : runtimeEntryBindings.find((binding) => binding.agent.id !== primaryBinding?.agent.id));
|
|
155
|
+
return { primaryBinding, secondaryBinding, researchBinding, hostBindings: runtimeEntryBindings };
|
|
155
156
|
}
|
|
@@ -263,7 +263,7 @@ export function compileBinding(workspaceRoot, agent, agents, referencedSubagentI
|
|
|
263
263
|
harnessRuntime: {
|
|
264
264
|
runRoot,
|
|
265
265
|
workspaceRoot,
|
|
266
|
-
|
|
266
|
+
runtimeEntry: !internalSubagent,
|
|
267
267
|
capabilities: inferAgentCapabilities(agent),
|
|
268
268
|
resilience,
|
|
269
269
|
...(checkpointer ? { checkpointer: checkpointer.config } : {}),
|
|
@@ -71,16 +71,16 @@ function compileBindings(workspaceRoot, refs, agentsList, models, tools) {
|
|
|
71
71
|
return bindings;
|
|
72
72
|
}
|
|
73
73
|
function validateRoutingTargets(refs, agentsList) {
|
|
74
|
-
const
|
|
74
|
+
const runtimeEntryAgentIds = new Set(agentsList
|
|
75
75
|
.filter((agent) => !agentsList.some((owner) => owner.subagentRefs.some((ref) => resolveRefId(ref) === agent.id)))
|
|
76
76
|
.map((agent) => agent.id));
|
|
77
77
|
const defaultAgentId = getRoutingDefaultAgentId(refs);
|
|
78
|
-
if (defaultAgentId && !
|
|
79
|
-
throw new Error(`Runtime routing.defaultAgentId references unknown
|
|
78
|
+
if (defaultAgentId && !runtimeEntryAgentIds.has(defaultAgentId)) {
|
|
79
|
+
throw new Error(`Runtime routing.defaultAgentId references unknown runtime entry agent ${defaultAgentId}`);
|
|
80
80
|
}
|
|
81
81
|
for (const rule of getRoutingRules(refs)) {
|
|
82
|
-
if (!
|
|
83
|
-
throw new Error(`Runtime routing.rules references unknown
|
|
82
|
+
if (!runtimeEntryAgentIds.has(rule.agentId)) {
|
|
83
|
+
throw new Error(`Runtime routing.rules references unknown runtime entry agent ${rule.agentId}`);
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
}
|