@botbotgo/agent-harness 0.0.170 → 0.0.172

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.169";
1
+ export declare const AGENT_HARNESS_VERSION = "0.0.171";
@@ -1 +1 @@
1
- export const AGENT_HARNESS_VERSION = "0.0.169";
1
+ export const AGENT_HARNESS_VERSION = "0.0.171";
@@ -14,5 +14,7 @@ export declare function wrapResolvedToolWithModelFacingName<T>(resolvedTool: T,
14
14
  export declare function hasCallableToolHandler(value: unknown): value is ResolvedToolLike;
15
15
  export declare function normalizeResolvedToolSchema(resolvedTool: ResolvedToolLike): Record<string, unknown> | {
16
16
  parse?: (input: unknown) => unknown;
17
- } | z.ZodObject<{}, z.core.$loose> | undefined;
17
+ } | z.ZodObject<{
18
+ [x: string]: z.ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
19
+ }, z.core.$strip> | z.ZodObject<{}, z.core.$loose> | undefined;
18
20
  export declare function asStructuredExecutableTool(resolvedTool: unknown, modelFacingName: string, description: string): unknown;
@@ -1,5 +1,15 @@
1
1
  import { z } from "zod";
2
2
  import { tool as createLangChainTool } from "@langchain/core/tools";
3
+ function isZodSchemaLike(value) {
4
+ return typeof value === "object" && value !== null && typeof value.parse === "function";
5
+ }
6
+ function isZodRawShape(value) {
7
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
8
+ return false;
9
+ }
10
+ const entries = Object.values(value);
11
+ return entries.length > 0 && entries.every((entry) => isZodSchemaLike(entry));
12
+ }
3
13
  export function asRecord(value) {
4
14
  return typeof value === "object" && value !== null && !Array.isArray(value)
5
15
  ? { ...value }
@@ -38,9 +48,12 @@ export function hasCallableToolHandler(value) {
38
48
  }
39
49
  export function normalizeResolvedToolSchema(resolvedTool) {
40
50
  const schema = resolvedTool.schema;
41
- if (schema && typeof schema.parse === "function" && "_def" in schema) {
51
+ if (isZodSchemaLike(schema) && "_def" in schema) {
42
52
  return resolvedTool.schema;
43
53
  }
54
+ if (isZodRawShape(schema)) {
55
+ return z.object(schema);
56
+ }
44
57
  if (schema && (schema.type === "object" || typeof schema.properties === "object")) {
45
58
  return schema;
46
59
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botbotgo/agent-harness",
3
- "version": "0.0.170",
3
+ "version": "0.0.172",
4
4
  "description": "Workspace runtime for multi-agent applications",
5
5
  "type": "module",
6
6
  "packageManager": "npm@10.9.2",