@effect-agent/testing 0.1.0-beta.19 → 0.1.0-beta.21

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@effect-agent/testing",
3
- "version": "0.1.0-beta.19",
3
+ "version": "0.1.0-beta.21",
4
4
  "exports": {
5
5
  ".": {
6
6
  "types": "./dist/index.d.mts",
@@ -8,15 +8,15 @@
8
8
  }
9
9
  },
10
10
  "dependencies": {
11
- "@effect-agent/capabilities": "0.1.0-beta.19",
12
- "@effect-agent/core": "0.1.0-beta.19",
13
- "@effect-agent/engine": "0.1.0-beta.19",
14
- "@effect-agent/platform-node": "0.1.0-beta.19",
15
- "@effect-agent/sandbox": "0.1.0-beta.19",
16
- "@effect-agent/session": "0.1.0-beta.19",
17
- "@effect-agent/storage-memory": "0.1.0-beta.19",
18
- "@effect-agent/storage-sqlite": "0.1.0-beta.19",
19
- "effect": "4.0.0-beta.107"
11
+ "@effect-agent/capabilities": "0.1.0-beta.21",
12
+ "@effect-agent/core": "0.1.0-beta.21",
13
+ "@effect-agent/engine": "0.1.0-beta.21",
14
+ "@effect-agent/platform-node": "0.1.0-beta.21",
15
+ "@effect-agent/sandbox": "0.1.0-beta.21",
16
+ "@effect-agent/session": "0.1.0-beta.21",
17
+ "@effect-agent/storage-memory": "0.1.0-beta.21",
18
+ "@effect-agent/storage-sqlite": "0.1.0-beta.21",
19
+ "effect": "4.0.0-rc.110"
20
20
  },
21
21
  "description": "Scripted models, deterministic fixtures, and adapter conformance kits for testing Effect Agent applications.",
22
22
  "license": "MIT",
@@ -39,9 +39,9 @@
39
39
  "test": "vp test --passWithNoTests"
40
40
  },
41
41
  "devDependencies": {
42
- "@effect/platform-node": "4.0.0-beta.107",
43
- "@effect/sql-sqlite-node": "4.0.0-beta.107",
44
- "@effect/vitest": "4.0.0-beta.107",
42
+ "@effect/platform-node": "4.0.0-rc.110",
43
+ "@effect/sql-sqlite-node": "4.0.0-rc.110",
44
+ "@effect/vitest": "4.0.0-rc.110",
45
45
  "typescript": "7.0.2",
46
46
  "vite-plus": "0.2.6"
47
47
  }
@@ -5,7 +5,7 @@ import {
5
5
  McpToolkitMismatch,
6
6
  type McpConnection,
7
7
  } from "@effect-agent/capabilities";
8
- import { Effect, Layer, Schema } from "effect";
8
+ import { Effect, JsonSchema, Layer, Schema } from "effect";
9
9
  import { Tool } from "effect/unstable/ai";
10
10
  import * as McpSchema from "effect/unstable/ai/McpSchema";
11
11
 
@@ -37,10 +37,35 @@ export const docsMcpIdentity = McpServerIdentity.make({
37
37
  }),
38
38
  });
39
39
 
40
+ /**
41
+ * `Tool.getJsonSchema` produces a `$ref`/`$defs`-shaped schema for
42
+ * `FetchDocument`'s named, refined parameters type, but `McpSchema.Tool`'s
43
+ * `inputSchema` requires a flat `{ type: "object", ... }` root — the shape a
44
+ * real MCP server advertises on the wire. This inlines the single top-level
45
+ * `$ref` so the derivation described above still holds byte-for-byte.
46
+ */
47
+ const flattenTopLevelRef = (schema: JsonSchema.JsonSchema): McpSchema.ToolJsonSchema => {
48
+ const ref = schema["$ref"];
49
+ const defs = schema["$defs"] as JsonSchema.Definitions | undefined;
50
+ if (typeof ref !== "string" || defs === undefined) return schema as McpSchema.ToolJsonSchema;
51
+
52
+ const resolved = JsonSchema.resolve$ref(ref, defs);
53
+ return (resolved ?? schema) as McpSchema.ToolJsonSchema;
54
+ };
55
+
56
+ const fetchDocumentOutputSchema = flattenTopLevelRef(
57
+ Tool.getJsonSchemaFromSchema(FetchDocument.successSchema),
58
+ );
59
+
40
60
  const discoveredFetchDocument = McpSchema.Tool.make({
41
61
  name: FetchDocument.name,
42
62
  description: "Fetch one bounded research document by its identifier.",
43
- inputSchema: Tool.getJsonSchema(FetchDocument),
63
+ inputSchema: flattenTopLevelRef(Tool.getJsonSchema(FetchDocument)),
64
+ // `validateMcpDiscovery` only compares an `outputSchema` derived down to an
65
+ // object type; mirror that so this fixture stays a real round-trip check.
66
+ ...(fetchDocumentOutputSchema.type === "object"
67
+ ? { outputSchema: fetchDocumentOutputSchema }
68
+ : {}),
44
69
  });
45
70
 
46
71
  const scriptedConnector = (tools: ReadonlyArray<McpSchema.Tool>): Layer.Layer<McpConnector> =>