@botbotgo/agent-harness 0.0.244 → 0.0.246
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.245";
|
package/dist/package-version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.245";
|
|
@@ -158,6 +158,13 @@ export async function* streamHarnessRun(options) {
|
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
160
|
await options.appendAssistantMessage(options.threadId, options.runId, assistantOutput);
|
|
161
|
+
const completedEvent = await options.setRunStateAndEmit(options.threadId, options.runId, 6, "completed", {
|
|
162
|
+
previousState: "running",
|
|
163
|
+
});
|
|
164
|
+
yield {
|
|
165
|
+
type: "event",
|
|
166
|
+
event: completedEvent,
|
|
167
|
+
};
|
|
161
168
|
yield {
|
|
162
169
|
type: "result",
|
|
163
170
|
result: {
|
|
@@ -169,12 +176,6 @@ export async function* streamHarnessRun(options) {
|
|
|
169
176
|
finalMessageText: assistantOutput,
|
|
170
177
|
},
|
|
171
178
|
};
|
|
172
|
-
yield {
|
|
173
|
-
type: "event",
|
|
174
|
-
event: await options.setRunStateAndEmit(options.threadId, options.runId, 6, "completed", {
|
|
175
|
-
previousState: "running",
|
|
176
|
-
}),
|
|
177
|
-
};
|
|
178
179
|
}
|
|
179
180
|
catch (error) {
|
|
180
181
|
const shouldRetryAfterStreamingCompatibilityError = streamActivityObserved &&
|
|
@@ -251,6 +252,13 @@ export async function* streamHarnessRun(options) {
|
|
|
251
252
|
if (Array.isArray(actual.contentBlocks) && actual.contentBlocks.length > 0) {
|
|
252
253
|
yield createContentBlocksItem(options.threadId, options.runId, options.selectedAgentId, actual.contentBlocks);
|
|
253
254
|
}
|
|
255
|
+
const terminalEvent = await options.setRunStateAndEmit(options.threadId, options.runId, 6, actual.state, {
|
|
256
|
+
previousState: "running",
|
|
257
|
+
});
|
|
258
|
+
yield {
|
|
259
|
+
type: "event",
|
|
260
|
+
event: terminalEvent,
|
|
261
|
+
};
|
|
254
262
|
yield {
|
|
255
263
|
type: "result",
|
|
256
264
|
result: {
|
|
@@ -264,12 +272,6 @@ export async function* streamHarnessRun(options) {
|
|
|
264
272
|
},
|
|
265
273
|
},
|
|
266
274
|
};
|
|
267
|
-
yield {
|
|
268
|
-
type: "event",
|
|
269
|
-
event: await options.setRunStateAndEmit(options.threadId, options.runId, 6, actual.state, {
|
|
270
|
-
previousState: "running",
|
|
271
|
-
}),
|
|
272
|
-
};
|
|
273
275
|
return;
|
|
274
276
|
}
|
|
275
277
|
catch (invokeError) {
|
package/dist/upstream-events.js
CHANGED
|
@@ -31,8 +31,17 @@ function readEventContext(event) {
|
|
|
31
31
|
function containsSemanticHint(values, hint) {
|
|
32
32
|
return values.some((value) => hint.test(value));
|
|
33
33
|
}
|
|
34
|
+
function normalizeSemanticHint(value) {
|
|
35
|
+
return value
|
|
36
|
+
.replace(/([a-z0-9])([A-Z])/g, "$1 $2")
|
|
37
|
+
.replace(/[.:/]+/g, " ")
|
|
38
|
+
.replace(/[_-]+/g, " ")
|
|
39
|
+
.replace(/\s+/g, " ")
|
|
40
|
+
.trim()
|
|
41
|
+
.toLowerCase();
|
|
42
|
+
}
|
|
34
43
|
function classifyStepCategory(context) {
|
|
35
|
-
const hints = [context.name, context.runType, ...context.tags, ...context.ns].map(
|
|
44
|
+
const hints = [context.name, context.runType, ...context.tags, ...context.ns].map(normalizeSemanticHint);
|
|
36
45
|
if (containsSemanticHint(hints, /\b(skill|skills)\b/)) {
|
|
37
46
|
return "skill";
|
|
38
47
|
}
|
|
@@ -616,7 +616,7 @@ async function loadModuleAgentsForRoot(root, mergedAgents) {
|
|
|
616
616
|
async function loadConventionalObjectsForRoot(root, mergedObjects) {
|
|
617
617
|
for (const directory of CONVENTIONAL_OBJECT_DIRECTORIES) {
|
|
618
618
|
for (const objectRoot of conventionalDirectoryRoots(root, directory)) {
|
|
619
|
-
for (const { item, sourcePath } of await
|
|
619
|
+
for (const { item, sourcePath } of await readYamlItemsIgnoringNodeModules(objectRoot)) {
|
|
620
620
|
const workspaceObject = parseWorkspaceObject(item, sourcePath);
|
|
621
621
|
if (!workspaceObject) {
|
|
622
622
|
continue;
|
|
@@ -633,6 +633,32 @@ async function loadConventionalObjectsForRoot(root, mergedObjects) {
|
|
|
633
633
|
}
|
|
634
634
|
}
|
|
635
635
|
}
|
|
636
|
+
async function readYamlItemsIgnoringNodeModules(root) {
|
|
637
|
+
if (!(await fileExists(root))) {
|
|
638
|
+
return [];
|
|
639
|
+
}
|
|
640
|
+
const records = [];
|
|
641
|
+
const pending = [root];
|
|
642
|
+
while (pending.length > 0) {
|
|
643
|
+
const current = pending.shift();
|
|
644
|
+
const entries = await readdir(current, { withFileTypes: true });
|
|
645
|
+
for (const entry of entries.sort((left, right) => left.name.localeCompare(right.name))) {
|
|
646
|
+
const entryPath = path.join(current, entry.name);
|
|
647
|
+
if (entry.isDirectory()) {
|
|
648
|
+
if (entry.name === "node_modules") {
|
|
649
|
+
continue;
|
|
650
|
+
}
|
|
651
|
+
pending.push(entryPath);
|
|
652
|
+
continue;
|
|
653
|
+
}
|
|
654
|
+
if (!entry.isFile() || (!entry.name.endsWith(".yaml") && !entry.name.endsWith(".yml"))) {
|
|
655
|
+
continue;
|
|
656
|
+
}
|
|
657
|
+
records.push(...(await readNamedYamlItems(current, [entry.name])));
|
|
658
|
+
}
|
|
659
|
+
}
|
|
660
|
+
return records;
|
|
661
|
+
}
|
|
636
662
|
async function readModuleToolItems(root) {
|
|
637
663
|
const modulesRoot = moduleCollectionRoot(root, "tools");
|
|
638
664
|
if (!(await fileExists(modulesRoot))) {
|