OpenAPI and GraphQL plugins now register their runtime tools under a single "built-in" source instead of separate executor.openapi / executor.graphql sources. Tool names are namespaced (openapi.addSource, graphql.addSource) so the tree UI nests them properly.
Unified · Split
| @@ -47,9 +47,9 @@ describe("SDK Executor", () => { · 46 unmodified lines | ||
| 47 | 47 | const sources = makeInMemorySourceRegistry(); |
| 48 | 48 | |
| 49 | 49 | yield* sources.registerRuntime(new Source({ |
| 50 | − id: "executor.openapi", | |
| 51 | − name: "OpenAPI", | |
| 52 | − kind: "openapi", | |
| 50 | + id: "built-in", | |
| 51 | + name: "Built In", | |
| 52 | + kind: "built-in", | |
| 53 | 53 | runtime: true, |
| 54 | 54 | canRemove: false, |
| 55 | 55 | canRefresh: false, |
| @@ -72,7 +72,7 @@ describe("SDK Executor", () => { · 16 unmodified lines | ||
| 72 | 72 | }); |
| 73 | 73 | |
| 74 | 74 | expect((yield* sources.list()).map((source) => source.id)).toEqual([ |
| 75 | − "executor.openapi", | |
| 75 | + "built-in", | |
| 76 | 76 | "vercel", |
| 77 | 77 | ]); |
| 78 | 78 | }), |
| @@ -153,12 +153,15 @@ describe("graphqlPlugin", () => { · 152 unmodified lines | ||
| 153 | 153 | ); |
| 154 | 154 | |
| 155 | 155 | const sources = await Effect.runPromise(executor.sources.list()); |
| 156 | − // 1 user source + 1 runtime source (executor.graphql) | |
| 156 | + // 1 user source + 1 built-in runtime source | |
| 157 | 157 | const gqlSources = sources.filter((s) => s.kind === "graphql"); |
| 158 | − expect(gqlSources).toHaveLength(2); | |
| 158 | + expect(gqlSources).toHaveLength(1); | |
| 159 | 159 | const userSource = gqlSources.find((s) => s.id === "my_gql"); |
| 160 | 160 | expect(userSource).toBeDefined(); |
| 161 | 161 | expect(userSource!.canRemove).toBe(true); |
| 162 | + const builtIn = sources.find((s) => s.id === "built-in"); | |
| 163 | + expect(builtIn).toBeDefined(); | |
| 164 | + expect(builtIn!.runtime).toBe(true); | |
| 162 | 165 | |
| 163 | 166 | await Effect.runPromise(executor.close()); |
| 164 | 167 | }); |
| @@ -371,13 +371,14 @@ export const graphqlPlugin = (options?: { · 370 unmodified lines | ||
| 371 | 371 | sources: ctx.sources, |
| 372 | 372 | pluginKey: "graphql", |
| 373 | 373 | source: { |
| 374 | − id: "executor.graphql", | |
| 375 | − name: "GraphQL", | |
| 374 | + id: "built-in", | |
| 375 | + name: "Built In", | |
| 376 | + kind: "built-in", | |
| 376 | 377 | }, |
| 377 | 378 | tools: [ |
| 378 | 379 | runtimeTool({ |
| 379 | − id: "executor.graphql.addSource", | |
| 380 | − name: "addSource", | |
| 380 | + id: "graphql.addSource", | |
| 381 | + name: "graphql.addSource", | |
| 381 | 382 | description: |
| 382 | 383 | "Add a GraphQL endpoint and register its operations as tools", |
| 383 | 384 | inputSchema: AddSourceInputSchema, |
| @@ -128,7 +128,7 @@ layer(TestLayer)("OpenAPI Plugin", (it) => { · 127 unmodified lines | ||
| 128 | 128 | }), |
| 129 | 129 | ); |
| 130 | 130 | |
| 131 | − it.effect("registers runtime executor.openapi tools", () => | |
| 131 | + it.effect("registers runtime openapi tools under built-in source", () => | |
| 132 | 132 | Effect.gen(function* () { |
| 133 | 133 | const httpClient = yield* HttpClient.HttpClient; |
| 134 | 134 | const clientLayer = Layer.succeed(HttpClient.HttpClient, httpClient); |
| @@ -143,12 +143,12 @@ layer(TestLayer)("OpenAPI Plugin", (it) => { · 8 unmodified lines | ||
| 143 | 143 | |
| 144 | 144 | const tools = yield* executor.tools.list(); |
| 145 | 145 | const ids = tools.map((t) => t.id); |
| 146 | − expect(ids).toContain("executor.openapi.previewSpec"); | |
| 147 | − expect(ids).toContain("executor.openapi.addSource"); | |
| 146 | + expect(ids).toContain("openapi.previewSpec"); | |
| 147 | + expect(ids).toContain("openapi.addSource"); | |
| 148 | 148 | }), |
| 149 | 149 | ); |
| 150 | 150 | |
| 151 | − it.effect("lists executor.openapi as a runtime source", () => | |
| 151 | + it.effect("lists built-in as a runtime source", () => | |
| 152 | 152 | Effect.gen(function* () { |
| 153 | 153 | const httpClient = yield* HttpClient.HttpClient; |
| 154 | 154 | const clientLayer = Layer.succeed(HttpClient.HttpClient, httpClient); |
| @@ -164,9 +164,9 @@ layer(TestLayer)("OpenAPI Plugin", (it) => { · 9 unmodified lines | ||
| 164 | 164 | const sources = yield* executor.sources.list(); |
| 165 | 165 | |
| 166 | 166 | expect(sources).toContainEqual(expect.objectContaining({ |
| 167 | − id: "executor.openapi", | |
| 168 | − name: "OpenAPI", | |
| 169 | − kind: "openapi", | |
| 167 | + id: "built-in", | |
| 168 | + name: "Built In", | |
| 169 | + kind: "built-in", | |
| 170 | 170 | runtime: true, |
| 171 | 171 | canRemove: false, |
| 172 | 172 | canRefresh: false, |
| @@ -239,7 +239,7 @@ layer(TestLayer)("OpenAPI Plugin", (it) => { · 66 unmodified lines | ||
| 239 | 239 | ); |
| 240 | 240 | |
| 241 | 241 | const result = yield* executor.tools.invoke( |
| 242 | − "executor.openapi.previewSpec", | |
| 242 | + "openapi.previewSpec", | |
| 243 | 243 | { spec: specJson }, |
| 244 | 244 | autoApprove, |
| 245 | 245 | ); |
| @@ -263,7 +263,7 @@ layer(TestLayer)("OpenAPI Plugin", (it) => { · 17 unmodified lines | ||
| 263 | 263 | ); |
| 264 | 264 | |
| 265 | 265 | const result = yield* executor.tools.invoke( |
| 266 | − "executor.openapi.addSource", | |
| 266 | + "openapi.addSource", | |
| 267 | 267 | { spec: specJson, namespace: "runtime" }, |
| 268 | 268 | autoApprove, |
| 269 | 269 | ); |
| @@ -459,8 +459,8 @@ layer(TestLayer)("OpenAPI Plugin", (it) => { · 189 unmodified lines | ||
| 459 | 459 | |
| 460 | 460 | const remaining = yield* executor.tools.list(); |
| 461 | 461 | expect(remaining.map((tool) => tool.id)).toEqual([ |
| 462 | − "executor.openapi.previewSpec", | |
| 463 | − "executor.openapi.addSource", | |
| 462 | + "openapi.previewSpec", | |
| 463 | + "openapi.addSource", | |
| 464 | 464 | ]); |
| 465 | 465 | }), |
| 466 | 466 | ); |
| @@ -295,13 +295,14 @@ export const openApiPlugin = (options?: { · 294 unmodified lines | ||
| 295 | 295 | sources: ctx.sources, |
| 296 | 296 | pluginKey: "openapi", |
| 297 | 297 | source: { |
| 298 | − id: "executor.openapi", | |
| 299 | − name: "OpenAPI", | |
| 298 | + id: "built-in", | |
| 299 | + name: "Built In", | |
| 300 | + kind: "built-in", | |
| 300 | 301 | }, |
| 301 | 302 | tools: [ |
| 302 | 303 | runtimeTool({ |
| 303 | − id: "executor.openapi.previewSpec", | |
| 304 | − name: "previewSpec", | |
| 304 | + id: "openapi.previewSpec", | |
| 305 | + name: "openapi.previewSpec", | |
| 305 | 306 | description: |
| 306 | 307 | "Preview an OpenAPI document before adding it as a source", |
| 307 | 308 | inputSchema: PreviewSpecInputSchema, |
| @@ -309,8 +310,8 @@ export const openApiPlugin = (options?: { · 1 unmodified line | ||
| 309 | 310 | handler: ({ spec }: PreviewSpecInput) => previewSpec(spec), |
| 310 | 311 | }), |
| 311 | 312 | runtimeTool({ |
| 312 | − id: "executor.openapi.addSource", | |
| 313 | − name: "addSource", | |
| 313 | + id: "openapi.addSource", | |
| 314 | + name: "openapi.addSource", | |
| 314 | 315 | description: |
| 315 | 316 | "Add an OpenAPI source and register its operations as tools", |
| 316 | 317 | inputSchema: AddSourceInputSchema, |
| @@ -217,8 +217,8 @@ describe("Real specs: Cloudflare API", () => { · 216 unmodified lines | ||
| 217 | 217 | |
| 218 | 218 | const remaining = yield* executor.tools.list(); |
| 219 | 219 | expect(remaining.map((tool) => tool.id)).toEqual([ |
| 220 | − "executor.openapi.previewSpec", | |
| 221 | − "executor.openapi.addSource", | |
| 220 | + "openapi.previewSpec", | |
| 221 | + "openapi.addSource", | |
| 222 | 222 | ]); |
| 223 | 223 | }), |
| 224 | 224 | ); |