@botbotgo/agent-harness 0.0.165 → 0.0.166

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 CHANGED
@@ -28,7 +28,7 @@
28
28
 
29
29
  <p align="center">
30
30
  <a href="https://botbotgo.github.io/agent-harness/development/">Developer docs</a>
31
- (multi-page static docs in <code>docs/development/</code>)
31
+ (<code>docs/development/</code>, English / 中文)
32
32
  </p>
33
33
 
34
34
  <p align="center">
package/README.zh.md CHANGED
@@ -28,7 +28,7 @@
28
28
 
29
29
  <p align="center">
30
30
  <a href="https://botbotgo.github.io/agent-harness/development/">开发文档</a>
31
- (多页面静态文档位于 <code>docs/development/</code>)
31
+ (多页面静态文档位于 <code>docs/development/</code>,支持 English / 中文)
32
32
  </p>
33
33
 
34
34
  <p align="center">
@@ -1 +1 @@
1
- export declare const AGENT_HARNESS_VERSION = "0.0.164";
1
+ export declare const AGENT_HARNESS_VERSION = "0.0.165";
@@ -1 +1 @@
1
- export const AGENT_HARNESS_VERSION = "0.0.164";
1
+ export const AGENT_HARNESS_VERSION = "0.0.165";
@@ -49,7 +49,7 @@ export async function runLocalToolInvocationLoop({ binding, request, primaryTool
49
49
  throw new Error(`Tool ${toolCall.name} is not configured for this agent.`);
50
50
  }
51
51
  const compiledTool = toolCatalog.get(toolCall.name) ?? toolCatalog.get(resolvedToolName);
52
- const normalizedArgs = normalizeToolArgsForSchema(toolCall.args, activeExecutable.schema);
52
+ const normalizedArgs = normalizeToolArgsForSchema(toolCall.args, activeExecutable.schema, toolCall.rawArgsInput);
53
53
  const toolResult = await activeExecutable.invoke(normalizedArgs);
54
54
  const memoryCandidates = compiledTool ? extractMemoryCandidatesFromToolOutput(compiledTool, toolResult) : [];
55
55
  executedToolResults.push({
@@ -1,7 +1,8 @@
1
1
  export declare function stringifyToolOutput(output: unknown): string;
2
- export declare function normalizeToolArgsForSchema(args: Record<string, unknown>, schema: unknown): Record<string, unknown>;
2
+ export declare function normalizeToolArgsForSchema(args: Record<string, unknown>, schema: unknown, rawArgsInput?: unknown): Record<string, unknown>;
3
3
  export declare function extractToolCallsFromResult(result: unknown): Array<{
4
4
  id?: string;
5
5
  name: string;
6
6
  args: Record<string, unknown>;
7
+ rawArgsInput?: unknown;
7
8
  }>;
@@ -14,7 +14,29 @@ export function stringifyToolOutput(output) {
14
14
  return `${String(output)}`;
15
15
  }
16
16
  }
17
- export function normalizeToolArgsForSchema(args, schema) {
17
+ function mapSingleFieldScalarArg(args, expectedKey, rawArgsInput) {
18
+ if (expectedKey in args) {
19
+ return args;
20
+ }
21
+ if (typeof rawArgsInput === "string") {
22
+ const trimmed = rawArgsInput.trim();
23
+ if (trimmed.length === 0) {
24
+ return args;
25
+ }
26
+ return {
27
+ ...args,
28
+ [expectedKey]: trimmed,
29
+ };
30
+ }
31
+ if (typeof rawArgsInput === "number" || typeof rawArgsInput === "boolean") {
32
+ return {
33
+ ...args,
34
+ [expectedKey]: rawArgsInput,
35
+ };
36
+ }
37
+ return args;
38
+ }
39
+ export function normalizeToolArgsForSchema(args, schema, rawArgsInput) {
18
40
  const schemaDef = isObject(schema) ? schema._def : undefined;
19
41
  const shape = schemaDef
20
42
  ? isRecord(schemaDef.shape)
@@ -34,19 +56,23 @@ export function normalizeToolArgsForSchema(args, schema) {
34
56
  if (expectedKey in args) {
35
57
  return args;
36
58
  }
59
+ const scalarMappedArgs = mapSingleFieldScalarArg(args, expectedKey, rawArgsInput);
60
+ if (expectedKey in scalarMappedArgs) {
61
+ return scalarMappedArgs;
62
+ }
37
63
  const aliasesByExpected = {
38
64
  city: ["location", "locality", "place"],
39
65
  location: ["city", "city_name"],
40
66
  query: ["question", "prompt", "text", "request"],
41
67
  };
42
68
  const aliases = aliasesByExpected[expectedKey] ?? [];
43
- const aliasKey = aliases.find((candidate) => candidate in args);
44
- if (!aliasKey || !(aliasKey in args)) {
45
- return args;
69
+ const aliasKey = aliases.find((candidate) => candidate in scalarMappedArgs);
70
+ if (!aliasKey || !(aliasKey in scalarMappedArgs)) {
71
+ return scalarMappedArgs;
46
72
  }
47
73
  return {
48
- ...args,
49
- [expectedKey]: args[aliasKey],
74
+ ...scalarMappedArgs,
75
+ [expectedKey]: scalarMappedArgs[aliasKey],
50
76
  };
51
77
  }
52
78
  export function extractToolCallsFromResult(result) {
@@ -75,12 +101,13 @@ export function extractToolCallsFromResult(result) {
75
101
  if (!name) {
76
102
  return null;
77
103
  }
78
- const rawArgs = salvageToolArgs(toolCall.args ?? functionPayload?.arguments) ?? {};
104
+ const rawArgsInput = toolCall.args ?? functionPayload?.arguments;
105
+ const rawArgs = salvageToolArgs(rawArgsInput) ?? {};
79
106
  if (!isObject(rawArgs)) {
80
107
  return null;
81
108
  }
82
109
  const id = typeof toolCall.id === "string" ? toolCall.id : undefined;
83
- return { id, name, args: rawArgs };
110
+ return { id, name, args: rawArgs, rawArgsInput };
84
111
  })
85
112
  .filter((item) => item !== null);
86
113
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botbotgo/agent-harness",
3
- "version": "0.0.165",
3
+ "version": "0.0.166",
4
4
  "description": "Workspace runtime for multi-agent applications",
5
5
  "type": "module",
6
6
  "packageManager": "npm@10.9.2",