@botbotgo/agent-harness 0.0.428 → 0.0.429
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,2 +1,2 @@
|
|
|
1
|
-
export declare const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export declare const AGENT_HARNESS_VERSION = "0.0.429";
|
|
2
2
|
export declare const AGENT_HARNESS_RELEASE_DATE = "2026-05-03";
|
package/dist/package-version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const AGENT_HARNESS_VERSION = "0.0.
|
|
1
|
+
export const AGENT_HARNESS_VERSION = "0.0.429";
|
|
2
2
|
export const AGENT_HARNESS_RELEASE_DATE = "2026-05-03";
|
|
@@ -180,19 +180,52 @@ function extractUrls(value) {
|
|
|
180
180
|
return [...new Set((value.match(/https?:\/\/[^\s<>"')\]}]+/giu) ?? [])
|
|
181
181
|
.map((url) => url.replace(/[.,;:!?]+$/u, "")))];
|
|
182
182
|
}
|
|
183
|
-
function
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
183
|
+
function readSchemaObjectShape(schema) {
|
|
184
|
+
if (!isRecord(schema)) {
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
if (isRecord(schema.properties)) {
|
|
188
|
+
return schema.properties;
|
|
189
|
+
}
|
|
190
|
+
const candidates = [
|
|
191
|
+
schema._def?.shape,
|
|
192
|
+
schema._zod?.def?.shape,
|
|
193
|
+
schema.def?.shape,
|
|
194
|
+
];
|
|
195
|
+
for (const candidate of candidates) {
|
|
196
|
+
const shape = typeof candidate === "function" ? candidate() : candidate;
|
|
197
|
+
if (isRecord(shape)) {
|
|
198
|
+
return shape;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return undefined;
|
|
202
|
+
}
|
|
203
|
+
function buildUrlSourceArgs(urls) {
|
|
204
|
+
return urls.map((url) => ({ type: "url", url, timeoutMs: 30000 }));
|
|
205
|
+
}
|
|
206
|
+
function buildEvidenceToolArgs(tool, taskText, evidenceText = taskText) {
|
|
207
|
+
const urls = extractUrls(evidenceText);
|
|
208
|
+
if (urls.length === 0) {
|
|
209
|
+
return {};
|
|
210
|
+
}
|
|
211
|
+
const shape = readSchemaObjectShape(tool.schema);
|
|
212
|
+
if (!shape) {
|
|
213
|
+
return {};
|
|
214
|
+
}
|
|
215
|
+
const args = {};
|
|
216
|
+
if ("sources" in shape) {
|
|
217
|
+
args.sources = buildUrlSourceArgs(urls);
|
|
218
|
+
}
|
|
219
|
+
if ("url" in shape) {
|
|
220
|
+
args.url = urls[0];
|
|
221
|
+
}
|
|
222
|
+
if ("urls" in shape) {
|
|
223
|
+
args.urls = urls;
|
|
224
|
+
}
|
|
225
|
+
if ("question" in shape) {
|
|
226
|
+
args.question = taskText.trim() || evidenceText.trim();
|
|
194
227
|
}
|
|
195
|
-
return
|
|
228
|
+
return args;
|
|
196
229
|
}
|
|
197
230
|
function resolveCommittedEvidenceTools(input) {
|
|
198
231
|
const availableTools = readResolvedEvidenceTools(input.resolvedTools)
|
|
@@ -200,15 +233,16 @@ function resolveCommittedEvidenceTools(input) {
|
|
|
200
233
|
if (availableTools.length === 0) {
|
|
201
234
|
return [];
|
|
202
235
|
}
|
|
203
|
-
const stateText = `${input.taskText}\n${stringifyTaskState(readMessages(input.result))}
|
|
236
|
+
const stateText = `${input.taskText}\n${stringifyTaskState(readMessages(input.result))}`;
|
|
237
|
+
const selectionText = stateText.toLowerCase();
|
|
204
238
|
const selected = [];
|
|
205
239
|
for (const tool of availableTools) {
|
|
206
|
-
if (!
|
|
240
|
+
if (!selectionText.includes(tool.name.toLowerCase())) {
|
|
207
241
|
continue;
|
|
208
242
|
}
|
|
209
243
|
selected.push({
|
|
210
244
|
tool,
|
|
211
|
-
args: buildEvidenceToolArgs(tool, stateText),
|
|
245
|
+
args: buildEvidenceToolArgs(tool, input.taskText, stateText),
|
|
212
246
|
});
|
|
213
247
|
}
|
|
214
248
|
if (selected.length > 0) {
|