History

Add hosted outbound HTTP policy

Route hosted plugin outbound requests through a shared Effect HttpClient layer that blocks local/private/metadata targets and re-checks redirects. Thread the executor-provided HTTP client through OpenAPI, GraphQL, MCP probing, and OAuth discovery, keep local harnesses on the normal fetch client, and split the restored security coverage into the relevant existing suites. Fix cloud migration scripts to invoke the local Drizzle binary under op run.

Rhys Sullivan committed 6 months ago

Commit 5fc67cd1 parent 745deac19 files · +559 −36Browse files

Showing the changes to packages (10 of 19 files). Show all

Unified · Split

10 files
  1. packages/core/sdk/src/executor.ts +6 −2
  2. packages/core/sdk/src/hosted-http-client.test.ts +69 −0
  3. packages/core/sdk/src/hosted-http-client.ts +135 −0
  4. packages/core/sdk/src/index.ts +7 −0
  5. packages/core/sdk/src/oauth-service.ts +8 −3
  6. packages/core/sdk/src/plugin.ts +2 −0
  7. packages/plugins/graphql/src/sdk/plugin.ts +6 −5
  8. packages/plugins/mcp/src/sdk/plugin.ts +17 −2
  9. packages/plugins/mcp/src/sdk/probe-shape.ts +3 −2
  10. packages/plugins/openapi/src/sdk/plugin.ts +6 −4
packages/core/sdk/src/executor.ts+6−2
@@ -1,4 +1,5 @@
1−import { Context, Deferred, Effect, Option, Result, Schema, Semaphore } from "effect";
1+import { Context, Deferred, Effect, Layer, Option, Result, Schema, Semaphore } from "effect";
2+import { FetchHttpClient, type HttpClient } from "effect/unstable/http";
23 import { generateKeyBetween } from "fractional-indexing";
34 import {
45 StorageError,
@@ -341,6 +342,7 @@ export interface ExecutorConfig<TPlugins extends readonly AnyPlugin[] = []> { · 336 unmodified lines
341342 * an options arg.
342343 */
343344 readonly onElicitation: OnElicitation;
345+ readonly httpClientLayer?: Layer.Layer<HttpClient.HttpClient>;
344346 }
345347
346348 // ---------------------------------------------------------------------------
@@ -2456,7 +2458,7 @@ export const createExecutor = <const TPlugins extends readonly AnyPlugin[] = []> · 2109 unmodified lines
24562458 usagesForConnection: credentialBindingUsagesForConnection,
24572459 };
24582460
2459− const oauthBundle = makeOAuth2Service({
2461+ const oauthBundle = makeOAuth2Service({
24602462 adapter: core,
24612463 rawAdapter: adapter,
24622464 secretsGet: (id) =>
@@ -2465,6 +2467,7 @@ export const createExecutor = <const TPlugins extends readonly AnyPlugin[] = []> · 2 unmodified lines
24652467 ),
24662468 secretsSet: (input) => secretsSet(input),
24672469 connectionsCreate: (input) => connectionsCreate(input),
2470+ httpClientLayer: config.httpClientLayer,
24682471 });
24692472 connectionProviders.set(oauthBundle.connectionProvider.key, oauthBundle.connectionProvider);
24702473
@@ -2502,6 +2505,7 @@ export const createExecutor = <const TPlugins extends readonly AnyPlugin[] = []> · 31 unmodified lines
25022505 const ctx: PluginCtx<unknown> = {
25032506 scopes,
25042507 storage,
2508+ httpClientLayer: config.httpClientLayer ?? FetchHttpClient.layer,
25052509 core: {
25062510 sources: {
25072511 register: (input: SourceInput) =>
packages/core/sdk/src/hosted-http-client.test.ts+69−0
@@ -0,0 +1,69 @@
1+import { describe, expect, it } from "@effect/vitest";
2+import { Effect, Result } from "effect";
3+import { HttpClient, HttpClientRequest } from "effect/unstable/http";
4+
5+import {
6+ HostedOutboundRequestBlocked,
7+ makeHostedHttpClientLayer,
8+ validateHostedOutboundUrl,
9+} from "./hosted-http-client";
10+
11+describe("hosted outbound HTTP client", () => {
12+ it.effect("allows public HTTP and HTTPS URLs", () =>
13+ Effect.gen(function* () {
14+ yield* validateHostedOutboundUrl("https://example.com/openapi.json");
15+ yield* validateHostedOutboundUrl("http://example.com/graphql");
16+ }),
17+ );
18+
19+ it.effect("rejects local and private network URLs", () =>
20+ Effect.gen(function* () {
21+ for (const url of [
22+ "http://localhost:3000",
23+ "http://127.0.0.1:3000",
24+ "http://10.0.0.1/openapi.json",
25+ "http://172.16.0.1/graphql",
26+ "http://192.168.1.10/mcp",
27+ "http://169.254.169.254/latest/meta-data/",
28+ ]) {
29+ const result = yield* validateHostedOutboundUrl(url).pipe(Effect.result);
30+ expect(Result.isFailure(result)).toBe(true);
31+ if (Result.isFailure(result)) {
32+ expect(result.failure).toBeInstanceOf(HostedOutboundRequestBlocked);
33+ }
34+ }
35+ }),
36+ );
37+
38+ it.effect("can allow local network URLs explicitly", () =>
39+ Effect.gen(function* () {
40+ yield* validateHostedOutboundUrl("http://127.0.0.1:3000", {
41+ allowLocalNetwork: true,
42+ });
43+ }),
44+ );
45+
46+ it.effect("checks redirected URLs before following them", () =>
47+ Effect.gen(function* () {
48+ let calls = 0;
49+ const fakeFetch: typeof globalThis.fetch = (async (input) => {
50+ calls++;
51+ const url = input instanceof Request ? input.url : String(input);
52+ if (url === "https://public.example/start") {
53+ return new Response(null, {
54+ status: 302,
55+ headers: { location: "http://127.0.0.1:3000/internal" },
56+ });
57+ }
58+ return new Response("unexpected", { status: 200 });
59+ }) as typeof globalThis.fetch;
60+ const result = yield* Effect.gen(function* () {
61+ const client = yield* HttpClient.HttpClient;
62+ return yield* client.execute(HttpClientRequest.get("https://public.example/start"));
63+ }).pipe(Effect.provide(makeHostedHttpClientLayer({ fetch: fakeFetch })), Effect.result);
64+
65+ expect(Result.isFailure(result)).toBe(true);
66+ expect(calls).toBe(1);
67+ }),
68+ );
69+});
packages/core/sdk/src/hosted-http-client.ts+135−0
@@ -0,0 +1,135 @@
1+import { Effect, Layer, Schema } from "effect";
2+import { FetchHttpClient, HttpClient } from "effect/unstable/http";
3+
4+export class HostedOutboundRequestBlocked extends Schema.TaggedErrorClass<HostedOutboundRequestBlocked>()(
5+ "HostedOutboundRequestBlocked",
6+ {
7+ url: Schema.String,
8+ reason: Schema.String,
9+ },
10+) {}
11+
12+export interface HostedHttpClientOptions {
13+ readonly allowLocalNetwork?: boolean;
14+ readonly maxRedirects?: number;
15+ readonly fetch?: typeof globalThis.fetch;
16+}
17+
18+const parseIpv4 = (hostname: string): readonly [number, number, number, number] | null => {
19+ const parts = hostname.split(".");
20+ if (parts.length !== 4) return null;
21+ const parsed: number[] = [];
22+ for (const part of parts) {
23+ if (!/^\d+$/.test(part)) return null;
24+ const value = Number(part);
25+ if (!Number.isInteger(value) || value < 0 || value > 255) return null;
26+ parsed.push(value);
27+ }
28+ return parsed as [number, number, number, number];
29+};
30+
31+const isPrivateIpv4 = ([a, b]: readonly [number, number, number, number]): boolean =>
32+ a === 0 ||
33+ a === 10 ||
34+ a === 127 ||
35+ (a === 169 && b === 254) ||
36+ (a === 172 && b >= 16 && b <= 31) ||
37+ (a === 192 && b === 168);
38+
39+const isBlockedMetadataHostname = (hostname: string): boolean => {
40+ const normalized = hostname.toLowerCase();
41+ return (
42+ normalized === "metadata.google.internal" ||
43+ normalized === "metadata" ||
44+ normalized === "instance-data" ||
45+ normalized === "169.254.169.254"
46+ );
47+};
48+
49+const isLocalOrPrivateHostname = (hostname: string): boolean => {
50+ const normalized = hostname.toLowerCase().replace(/^\[|\]$/g, "");
51+ if (normalized === "localhost" || normalized.endsWith(".localhost")) return true;
52+ const ipv4 = parseIpv4(normalized);
53+ if (ipv4) return isPrivateIpv4(ipv4);
54+ return (
55+ normalized === "::1" ||
56+ normalized.startsWith("fe80:") ||
57+ normalized.startsWith("fc") ||
58+ normalized.startsWith("fd")
59+ );
60+};
61+
62+export const validateHostedOutboundUrl = (
63+ value: string,
64+ options: HostedHttpClientOptions = {},
65+): Effect.Effect<void, HostedOutboundRequestBlocked> =>
66+ Effect.gen(function* () {
67+ const url = yield* Effect.try({
68+ try: () => new URL(value),
69+ catch: () =>
70+ new HostedOutboundRequestBlocked({
71+ url: value,
72+ reason: "URL is invalid",
73+ }),
74+ });
75+
76+ if (url.protocol !== "http:" && url.protocol !== "https:") {
77+ return yield* new HostedOutboundRequestBlocked({
78+ url: value,
79+ reason: "Only HTTP and HTTPS outbound requests are allowed",
80+ });
81+ }
82+
83+ if (isBlockedMetadataHostname(url.hostname)) {
84+ return yield* new HostedOutboundRequestBlocked({
85+ url: value,
86+ reason: "Metadata service addresses are not allowed",
87+ });
88+ }
89+
90+ if (!options.allowLocalNetwork && isLocalOrPrivateHostname(url.hostname)) {
91+ return yield* new HostedOutboundRequestBlocked({
92+ url: value,
93+ reason: "Local and private network addresses are not allowed",
94+ });
95+ }
96+ });
97+
98+const guardFetch = (
99+ fetch: typeof globalThis.fetch,
100+ options: HostedHttpClientOptions,
101+): typeof globalThis.fetch =>
102+ (async (input, init) => {
103+ const maxRedirects = options.maxRedirects ?? 10;
104+ let current: Parameters<typeof globalThis.fetch>[0] | URL = input;
105+ for (let redirects = 0; redirects <= maxRedirects; redirects++) {
106+ const url = current instanceof Request ? current.url : String(current);
107+ Effect.runSync(validateHostedOutboundUrl(url, options));
108+ const response = await fetch(current, { ...init, redirect: "manual" });
109+ if (
110+ response.status >= 300 &&
111+ response.status < 400 &&
112+ response.headers.has("location") &&
113+ redirects < maxRedirects
114+ ) {
115+ current = new URL(response.headers.get("location")!, url).toString();
116+ continue;
117+ }
118+ return response;
119+ }
120+ return fetch(current, { ...init, redirect: "manual" });
121+ }) as typeof globalThis.fetch;
122+
123+export const makeHostedHttpClientLayer = (
124+ options: HostedHttpClientOptions = {},
125+): Layer.Layer<HttpClient.HttpClient> =>
126+ FetchHttpClient.layer.pipe(
127+ Layer.provide(
128+ options.fetch
129+ ? Layer.succeed(FetchHttpClient.Fetch)(guardFetch(options.fetch, options))
130+ : Layer.effect(
131+ FetchHttpClient.Fetch,
132+ Effect.map(Effect.service(FetchHttpClient.Fetch), (fetch) => guardFetch(fetch, options)),
133+ ),
134+ ),
135+ );
packages/core/sdk/src/index.ts+7−0
@@ -232,6 +232,13 @@ export { · 231 unmodified lines
232232 export { makeOAuth2Service, type OAuthServiceDeps } from "./oauth-service";
233233 export type { ScopedDBAdapter, ScopedTypedAdapter } from "./scoped-adapter";
234234
235+export {
236+ HostedOutboundRequestBlocked,
237+ makeHostedHttpClientLayer,
238+ validateHostedOutboundUrl,
239+ type HostedHttpClientOptions,
240+} from "./hosted-http-client";
241+
235242 export {
236243 OAuthDiscoveryError,
237244 OAuthAuthorizationServerMetadataSchema,
packages/core/sdk/src/oauth-service.ts+8−3
@@ -35,7 +35,7 @@ · 34 unmodified lines
3535 // every strategy because refresh semantics are strategy-independent.
3636 // ---------------------------------------------------------------------------
3737
38−import { Duration, Effect, Option, Schema } from "effect";
38+import { Duration, Effect, Layer, Option, Schema } from "effect";
3939 import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/unstable/http";
4040
4141 import type { StorageFailure, TypedAdapter } from "@executor-js/storage-core";
@@ -183,6 +183,8 @@ export interface OAuthServiceDeps { · 141 unmodified lines
183183 readonly newSessionId?: () => string;
184184 /** `Date.now()` substitute — tests override to drive TTL behavior. */
185185 readonly now?: () => number;
186+ /** Outbound HTTP client used for OAuth metadata/DCR probes. */
187+ readonly httpClientLayer?: Layer.Layer<HttpClient.HttpClient>;
186188 }
187189
188190 const defaultSessionId = (): string => {
@@ -225,6 +227,7 @@ export const makeOAuth2Service = ( · 36 unmodified lines
225227 ): { readonly service: OAuthService; readonly connectionProvider: ConnectionProvider } => {
226228 const now = deps.now ?? (() => Date.now());
227229 const newSessionId = deps.newSessionId ?? defaultSessionId;
230+ const httpClientLayer = deps.httpClientLayer;
228231
229232 // -------------------------------------------------------------------
230233 // probe
@@ -232,6 +235,7 @@ export const makeOAuth2Service = ( · 1 unmodified line
232235 const probe = (input: OAuthProbeInput): Effect.Effect<OAuthProbeResult, OAuthProbeError> =>
233236 Effect.gen(function* () {
234237 const resource = yield* discoverProtectedResourceMetadata(input.endpoint, {
238+ httpClientLayer,
235239 resourceHeaders: input.headers,
236240 resourceQueryParams: input.queryParams,
237241 }).pipe(
@@ -257,7 +261,7 @@ export const makeOAuth2Service = ( · 19 unmodified lines
257261 })();
258262
259263 const authServer = authorizationServerUrl
260− ? yield* discoverAuthorizationServerMetadata(authorizationServerUrl).pipe(
264+ ? yield* discoverAuthorizationServerMetadata(authorizationServerUrl, { httpClientLayer }).pipe(
261265 Effect.catchTag("OAuthDiscoveryError", () => Effect.succeed(null)),
262266 )
263267 : null;
@@ -312,7 +316,7 @@ export const makeOAuth2Service = ( · 48 unmodified lines
312316 response.headers["www-authenticate"] ?? response.headers["WWW-Authenticate"];
313317 return !!wwwAuth && /^\s*bearer\b/i.test(wwwAuth);
314318 }).pipe(
315− Effect.provide(FetchHttpClient.layer),
319+ Effect.provide(httpClientLayer ?? FetchHttpClient.layer),
316320 Effect.catch(() => Effect.succeed(false)),
317321 );
318322
@@ -344,6 +348,7 @@ export const makeOAuth2Service = ( · 25 unmodified lines
344348 scopes: strategy.scopes,
345349 },
346350 {
351+ httpClientLayer,
347352 resourceHeaders: input.headers,
348353 resourceQueryParams: input.queryParams,
349354 },
packages/core/sdk/src/plugin.ts+2−0
@@ -1,4 +1,5 @@
11 import type { Context, Effect, Layer } from "effect";
2+import type { HttpClient } from "effect/unstable/http";
23 import type { HttpApiGroup } from "effect/unstable/httpapi";
34 import type { DBSchema, StorageFailure } from "@executor-js/storage-core";
45
@@ -102,6 +103,7 @@ export interface PluginCtx<TStore = unknown> { · 97 unmodified lines
102103 */
103104 readonly scopes: readonly Scope[];
104105 readonly storage: TStore;
106+ readonly httpClientLayer: Layer.Layer<HttpClient.HttpClient>;
105107
106108 readonly core: {
107109 readonly sources: {
packages/plugins/graphql/src/sdk/plugin.ts+6−5
@@ -1,6 +1,6 @@
11 import { Effect, Option, Schema } from "effect";
22 import type { Layer } from "effect";
3−import { FetchHttpClient, HttpClient } from "effect/unstable/http";
3+import { HttpClient } from "effect/unstable/http";
44
55 import { GraphqlGroup } from "../api/group";
66 import { GraphqlExtensionService, GraphqlHandlers } from "../api/handlers";
@@ -916,15 +916,14 @@ const makeGraphqlExtension = ( · 909 unmodified lines
916916 export type GraphqlPluginExtension = ReturnType<typeof makeGraphqlExtension>;
917917
918918 export const graphqlPlugin = definePlugin((options?: GraphqlPluginOptions) => {
919− const httpClientLayer = options?.httpClientLayer ?? FetchHttpClient.layer;
920−
921919 return {
922920 id: "graphql" as const,
923921 packageName: "@executor-js/plugin-graphql",
924922 schema: graphqlSchema,
925923 storage: (deps): GraphqlStore => makeDefaultGraphqlStore(deps),
926924
927− extension: (ctx) => makeGraphqlExtension(ctx, httpClientLayer, options?.configFile),
925+ extension: (ctx) =>
926+ makeGraphqlExtension(ctx, options?.httpClientLayer ?? ctx.httpClientLayer, options?.configFile),
928927
929928 staticSources: (self) => [
930929 {
@@ -969,6 +968,7 @@ export const graphqlPlugin = definePlugin((options?: GraphqlPluginOptions) => { · 38 unmodified lines
969968
970969 invokeTool: ({ ctx, toolRow, args }) =>
971970 Effect.gen(function* () {
971+ const httpClientLayer = options?.httpClientLayer ?? ctx.httpClientLayer;
972972 // toolRow.scope_id is the resolved owning scope of the tool
973973 // (innermost-wins from the executor's stack). The matching
974974 // graphql_operation + graphql_source rows live at the same
@@ -1081,8 +1081,9 @@ export const graphqlPlugin = definePlugin((options?: GraphqlPluginOptions) => { · 106 unmodified lines
10811081
10821082 usagesForConnection: () => Effect.succeed([]),
10831083
1084− detect: ({ url }) =>
1084+ detect: ({ ctx, url }) =>
10851085 Effect.gen(function* () {
1086+ const httpClientLayer = options?.httpClientLayer ?? ctx.httpClientLayer;
10861087 const trimmed = url.trim();
10871088 if (!trimmed) return null;
10881089 const parsed = yield* Effect.try({
packages/plugins/mcp/src/sdk/plugin.ts+17−2
@@ -1,4 +1,15 @@
1−import { Duration, Effect, Exit, Option, Predicate, Result, Scope, ScopedCache } from "effect";
1+import {
2+ Duration,
3+ Effect,
4+ Exit,
5+ Layer,
6+ Option,
7+ Predicate,
8+ Result,
9+ Scope,
10+ ScopedCache,
11+} from "effect";
12+import type { HttpClient } from "effect/unstable/http";
213
314 import type { OAuthClientProvider } from "@modelcontextprotocol/sdk/client/auth.js";
415
@@ -848,6 +859,7 @@ export interface McpPluginOptions { · 843 unmodified lines
848859 * `process.env`. Only enable for trusted single-user contexts.
849860 */
850861 readonly dangerouslyAllowStdioMCP?: boolean;
862+ readonly httpClientLayer?: Layer.Layer<HttpClient.HttpClient>;
851863 /** If provided, source add/remove is mirrored to executor.jsonc
852864 * (best-effort — file errors are logged, not raised). */
853865 readonly configFile?: ConfigFileSink;
@@ -937,6 +949,7 @@ export const mcpPlugin = definePlugin((options?: McpPluginOptions) => { · 83 unmodified lines
937949 storage: (deps): McpBindingStore => makeMcpStore(deps),
938950
939951 extension: (ctx) => {
952+ const httpClientLayer = options?.httpClientLayer ?? ctx.httpClientLayer;
940953 const probeEndpoint = (input: string | McpProbeEndpointInput) =>
941954 Effect.gen(function* () {
942955 const endpoint = typeof input === "string" ? input : input.endpoint;
@@ -994,6 +1007,7 @@ export const mcpPlugin = definePlugin((options?: McpPluginOptions) => { · 51 unmodified lines
9941007 // probe and be misclassified as MCP. The shape probe rejects
9951008 // anything whose initialize response isn't 2xx or 401+Bearer.
9961009 const shape = yield* probeMcpEndpointShape(trimmed, {
1010+ httpClientLayer,
9971011 headers: probeHeaders,
9981012 queryParams: probeQueryParams,
9991013 });
@@ -1575,6 +1589,7 @@ export const mcpPlugin = definePlugin((options?: McpPluginOptions) => { · 575 unmodified lines
15751589
15761590 detect: ({ ctx, url }) =>
15771591 Effect.gen(function* () {
1592+ const httpClientLayer = options?.httpClientLayer ?? ctx.httpClientLayer;
15781593 const trimmed = url.trim();
15791594 if (!trimmed) return null;
15801595
@@ -1610,7 +1625,7 @@ export const mcpPlugin = definePlugin((options?: McpPluginOptions) => { · 29 unmodified lines
16101625
16111626 // host publishes RFC 9728 + 8414 metadata) would be classified
16121627 // as MCP whenever the cross-plugin detector fans out to us.
1613− const shape = yield* probeMcpEndpointShape(trimmed);
1628+ const shape = yield* probeMcpEndpointShape(trimmed, { httpClientLayer });
16141629 if (shape.kind !== "mcp") return null;
16151630
16161631 // Confirm OAuth metadata is actually reachable. The shape
packages/plugins/mcp/src/sdk/probe-shape.ts+3−2
@@ -30,7 +30,7 @@ · 29 unmodified lines
3030 // round-trip, no DCR — every non-MCP endpoint exits here.
3131 // ---------------------------------------------------------------------------
3232
33−import { Data, Duration, Effect, Option, Schema } from "effect";
33+import { Data, Duration, Effect, Layer, Option, Schema } from "effect";
3434 import { FetchHttpClient, HttpClient, HttpClientRequest } from "effect/unstable/http";
3535
3636 /** MCP initialize request body used as the shape probe. Any real MCP
@@ -97,6 +97,7 @@ export type McpShapeProbeResult = · 60 unmodified lines
9797 export interface ProbeOptions {
9898 /** Abort the request after this many ms. Default 8000. */
9999 readonly timeoutMs?: number;
100+ readonly httpClientLayer?: Layer.Layer<HttpClient.HttpClient>;
100101 readonly headers?: Record<string, string>;
101102 readonly queryParams?: Record<string, string>;
102103 }
@@ -191,7 +192,7 @@ export const probeMcpEndpointShape = ( · 88 unmodified lines
191192 reason: `unexpected status ${postResponse.status} for initialize`,
192193 } as const;
193194 }).pipe(
194− Effect.provide(FetchHttpClient.layer),
195+ Effect.provide(options.httpClientLayer ?? FetchHttpClient.layer),
195196 Effect.mapError(
196197 (cause) =>
197198 new ProbeTransportError({
packages/plugins/openapi/src/sdk/plugin.ts+6−4
@@ -1,6 +1,6 @@
11 import { Effect, Option, Predicate, Schema } from "effect";
22 import type { Layer } from "effect";
3−import { FetchHttpClient, HttpClient } from "effect/unstable/http";
3+import { HttpClient } from "effect/unstable/http";
44
55 import { OpenApiGroup } from "../api/group";
66 import { OpenApiExtensionService, OpenApiHandlers } from "../api/handlers";
@@ -754,8 +754,6 @@ const toOpenApiSourceConfig = ( · 747 unmodified lines
754754 const isHttpUrl = (s: string): boolean => s.startsWith("http://") || s.startsWith("https://");
755755
756756 export const openApiPlugin = definePlugin((options?: OpenApiPluginOptions) => {
757− const httpClientLayer = options?.httpClientLayer ?? FetchHttpClient.layer;
758−
759757 type RebuildInput = {
760758 readonly specText: string;
761759 readonly scope: string;
@@ -902,6 +900,7 @@ export const openApiPlugin = definePlugin((options?: OpenApiPluginOptions) => { · 140 unmodified lines
902900 // than surface a 500 through the unwhitelisted error channel.
903901 const refreshSourceInternal = (ctx: PluginCtx<OpenapiStore>, sourceId: string, scope: string) =>
904902 Effect.gen(function* () {
903+ const httpClientLayer = options?.httpClientLayer ?? ctx.httpClientLayer;
905904 const existing = yield* ctx.storage.getSource(sourceId, scope);
906905 if (!existing) return;
907906 const effective = yield* resolveEffectiveSourceConfig(ctx, existing);
@@ -938,6 +937,7 @@ export const openApiPlugin = definePlugin((options?: OpenApiPluginOptions) => { · 30 unmodified lines
938937 storage: (deps): OpenapiStore => makeDefaultOpenapiStore(deps),
939938
940939 extension: (ctx) => {
940+ const httpClientLayer = options?.httpClientLayer ?? ctx.httpClientLayer;
941941 const addSpecInternal = (config: OpenApiSpecConfig) =>
942942 Effect.gen(function* () {
943943 // Resolve URL → text and parse BEFORE opening a transaction.
@@ -1173,6 +1173,7 @@ export const openApiPlugin = definePlugin((options?: OpenApiPluginOptions) => { · 229 unmodified lines
11731173
11741174 invokeTool: ({ ctx, toolRow, args }) =>
11751175 Effect.gen(function* () {
1176+ const httpClientLayer = options?.httpClientLayer ?? ctx.httpClientLayer;
11761177 // toolRow.scope_id is the resolved owning scope of the tool
11771178 // (innermost-wins from the executor's stack). The matching
11781179 // openapi_operation + openapi_source rows live at the same
@@ -1313,8 +1314,9 @@ export const openApiPlugin = definePlugin((options?: OpenApiPluginOptions) => { · 134 unmodified lines
13131314 // means stale UI state, which is worth surfacing to the caller.
13141315 refreshSource: ({ ctx, sourceId, scope }) => refreshSourceInternal(ctx, sourceId, scope),
13151316
1316− detect: ({ url }) =>
1317+ detect: ({ ctx, url }) =>
13171318 Effect.gen(function* () {
1319+ const httpClientLayer = options?.httpClientLayer ?? ctx.httpClientLayer;
13181320 const trimmed = url.trim();
13191321 if (!trimmed) return null;
13201322 const parsed = yield* Effect.try({

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t