Showing the changes to plugins (5 of 21 files). Show all
Unified · Split
| @@ -18,7 +18,6 @@ import { · 17 unmodified lines | |||
| 18 | } from "@executor/platform-sdk/plugins"; | 18 | } from "@executor/platform-sdk/plugins"; |
| 19 | import { | 19 | import { |
| 20 | createPluginLocalConfigEntrySchema, | 20 | createPluginLocalConfigEntrySchema, |
| 21 | decodeCurrentOrLegacyLocalConfigAuth, | ||
| 22 | pluginLocalConfigSourceFromConfig, | 21 | pluginLocalConfigSourceFromConfig, |
| 23 | SecretMaterialDeleterService, | 22 | SecretMaterialDeleterService, |
| 24 | SecretMaterialResolverService, | 23 | SecretMaterialResolverService, |
| @@ -103,29 +102,6 @@ const decodeGoogleDiscoveryCurrentLocalConfigOption = Schema.decodeUnknownOption · 78 unmodified lines | |||
| 103 | config: GoogleDiscoveryStoredSourceDataSchema, | 102 | config: GoogleDiscoveryStoredSourceDataSchema, |
| 104 | }), | 103 | }), |
| 105 | ); | 104 | ); |
| 106 | const decodeGoogleDiscoveryLegacyLocalConfigOption = Schema.decodeUnknownOption( | ||
| 107 | Schema.Struct({ | ||
| 108 | kind: Schema.Literal(GOOGLE_DISCOVERY_SOURCE_KIND), | ||
| 109 | name: Schema.optional(Schema.String), | ||
| 110 | namespace: Schema.optional(Schema.String), | ||
| 111 | enabled: Schema.optional(Schema.Boolean), | ||
| 112 | connection: Schema.Struct({ | ||
| 113 | endpoint: Schema.optional(Schema.NullOr(Schema.String)), | ||
| 114 | auth: Schema.optional(Schema.Unknown), | ||
| 115 | }), | ||
| 116 | binding: Schema.Struct({ | ||
| 117 | service: Schema.String, | ||
| 118 | version: Schema.String, | ||
| 119 | discoveryUrl: Schema.optional(Schema.NullOr(Schema.String)), | ||
| 120 | defaultHeaders: Schema.optional( | ||
| 121 | Schema.NullOr(Schema.Record({ key: Schema.String, value: Schema.String })), | ||
| 122 | ), | ||
| 123 | scopes: Schema.optional(Schema.Array(Schema.String)), | ||
| 124 | }), | ||
| 125 | config: Schema.optional(Schema.Unknown), | ||
| 126 | }), | ||
| 127 | ); | ||
| 128 | |||
| 129 | export type GoogleDiscoverySourceStorage = { | 105 | export type GoogleDiscoverySourceStorage = { |
| 130 | get: (input: { | 106 | get: (input: { |
| 131 | scopeId: string; | 107 | scopeId: string; |
| @@ -582,32 +558,6 @@ const googleDiscoveryStoredSourceDataFromLocalConfig = (input: { · 450 unmodified lines | |||
| 582 | return current.value.config; | 558 | return current.value.config; |
| 583 | } | 559 | } |
| 584 | 560 | ||
| 585 | const legacy = decodeGoogleDiscoveryLegacyLocalConfigOption(input.config); | ||
| 586 | if (Option.isSome(legacy)) { | ||
| 587 | return storedSourceDataFromInput({ | ||
| 588 | name: | ||
| 589 | legacy.value.name | ||
| 590 | ?? `${legacy.value.binding.service} ${legacy.value.binding.version}`, | ||
| 591 | service: legacy.value.binding.service, | ||
| 592 | version: legacy.value.binding.version, | ||
| 593 | discoveryUrl: legacy.value.binding.discoveryUrl ?? null, | ||
| 594 | defaultHeaders: legacy.value.binding.defaultHeaders ?? null, | ||
| 595 | scopes: legacy.value.binding.scopes ?? [], | ||
| 596 | auth: decodeCurrentOrLegacyLocalConfigAuth({ | ||
| 597 | auth: legacy.value.connection.auth, | ||
| 598 | authSchema: GoogleDiscoveryConnectionAuthSchema, | ||
| 599 | loadedConfig: input.loadedConfig, | ||
| 600 | onLegacySecretRef: (tokenSecretRef) => ({ | ||
| 601 | kind: "bearer", | ||
| 602 | tokenSecretRef, | ||
| 603 | }), | ||
| 604 | fallback: { | ||
| 605 | kind: "none", | ||
| 606 | }, | ||
| 607 | }), | ||
| 608 | }); | ||
| 609 | } | ||
| 610 | |||
| 611 | throw new Error("Unsupported Google Discovery local source config."); | 561 | throw new Error("Unsupported Google Discovery local source config."); |
| 612 | }; | 562 | }; |
| 613 | 563 | ||
| @@ -24,7 +24,6 @@ import { · 23 unmodified lines | |||
| 24 | import { | 24 | import { |
| 25 | SecretMaterialResolverService, | 25 | SecretMaterialResolverService, |
| 26 | createPluginLocalConfigEntrySchema, | 26 | createPluginLocalConfigEntrySchema, |
| 27 | decodeCurrentOrLegacyLocalConfigAuth, | ||
| 28 | pluginLocalConfigSourceFromConfig, | 27 | pluginLocalConfigSourceFromConfig, |
| 29 | provideExecutorRuntime, | 28 | provideExecutorRuntime, |
| 30 | runtimeEffectError, | 29 | runtimeEffectError, |
| @@ -158,25 +157,6 @@ const decodeGraphqlCurrentLocalConfigOption = Schema.decodeUnknownOption( · 127 unmodified lines | |||
| 158 | }), | 157 | }), |
| 159 | ); | 158 | ); |
| 160 | 159 | ||
| 161 | const decodeGraphqlLegacyLocalConfigOption = Schema.decodeUnknownOption( | ||
| 162 | Schema.Struct({ | ||
| 163 | kind: Schema.Literal("graphql"), | ||
| 164 | name: Schema.optional(Schema.String), | ||
| 165 | namespace: Schema.optional(Schema.String), | ||
| 166 | enabled: Schema.optional(Schema.Boolean), | ||
| 167 | connection: Schema.Struct({ | ||
| 168 | endpoint: Schema.String, | ||
| 169 | auth: Schema.optional(Schema.Unknown), | ||
| 170 | }), | ||
| 171 | binding: Schema.Struct({ | ||
| 172 | defaultHeaders: Schema.optional( | ||
| 173 | Schema.NullOr(Schema.Record({ key: Schema.String, value: Schema.String })), | ||
| 174 | ), | ||
| 175 | }), | ||
| 176 | config: Schema.optional(Schema.Unknown), | ||
| 177 | }), | ||
| 178 | ); | ||
| 179 | |||
| 180 | const withoutUndefinedEntries = ( | 160 | const withoutUndefinedEntries = ( |
| 181 | record: Readonly<Record<string, unknown>>, | 161 | record: Readonly<Record<string, unknown>>, |
| 182 | ): Record<string, unknown> => | 162 | ): Record<string, unknown> => |
| @@ -363,29 +343,6 @@ const graphqlStoredSourceDataFromLocalConfig = (input: { · 180 unmodified lines | |||
| 363 | return normalizeStoredSourceData(current.value.config); | 343 | return normalizeStoredSourceData(current.value.config); |
| 364 | } | 344 | } |
| 365 | 345 | ||
| 366 | const legacy = decodeGraphqlLegacyLocalConfigOption(input.config); | ||
| 367 | if (Option.isSome(legacy)) { | ||
| 368 | return storedSourceDataFromInput({ | ||
| 369 | name: legacy.value.name ?? "GraphQL", | ||
| 370 | endpoint: legacy.value.connection.endpoint, | ||
| 371 | defaultHeaders: legacy.value.binding.defaultHeaders ?? null, | ||
| 372 | auth: decodeCurrentOrLegacyLocalConfigAuth({ | ||
| 373 | auth: legacy.value.connection.auth, | ||
| 374 | authSchema: GraphqlConnectionAuthSchema, | ||
| 375 | loadedConfig: input.loadedConfig, | ||
| 376 | onLegacySecretRef: (tokenSecretRef) => ({ | ||
| 377 | kind: "bearer", | ||
| 378 | tokenSecretRef, | ||
| 379 | headerName: null, | ||
| 380 | prefix: null, | ||
| 381 | }), | ||
| 382 | fallback: { | ||
| 383 | kind: "none", | ||
| 384 | }, | ||
| 385 | }), | ||
| 386 | }); | ||
| 387 | } | ||
| 388 | |||
| 389 | throw new Error("Unsupported GraphQL local source config."); | 346 | throw new Error("Unsupported GraphQL local source config."); |
| 390 | }; | 347 | }; |
| 391 | 348 | ||
| @@ -249,37 +249,12 @@ const normalizeStringArray = ( · 248 unmodified lines | |||
| 249 | return normalized.length > 0 ? normalized : null; | 249 | return normalized.length > 0 ? normalized : null; |
| 250 | }; | 250 | }; |
| 251 | 251 | ||
| 252 | const decodeMcpAuthOption = Schema.decodeUnknownOption(McpConnectionAuthSchema); | ||
| 253 | const decodeMcpCurrentLocalConfigOption = Schema.decodeUnknownOption( | 252 | const decodeMcpCurrentLocalConfigOption = Schema.decodeUnknownOption( |
| 254 | createPluginLocalConfigEntrySchema({ | 253 | createPluginLocalConfigEntrySchema({ |
| 255 | kind: "mcp", | 254 | kind: "mcp", |
| 256 | config: McpStoredSourceDataSchema, | 255 | config: McpStoredSourceDataSchema, |
| 257 | }), | 256 | }), |
| 258 | ); | 257 | ); |
| 259 | const decodeMcpLegacyLocalConfigOption = Schema.decodeUnknownOption( | ||
| 260 | Schema.Struct({ | ||
| 261 | kind: Schema.Literal("mcp"), | ||
| 262 | name: Schema.optional(Schema.String), | ||
| 263 | namespace: Schema.optional(Schema.String), | ||
| 264 | enabled: Schema.optional(Schema.Boolean), | ||
| 265 | connection: Schema.optional( | ||
| 266 | Schema.Struct({ | ||
| 267 | endpoint: Schema.optional(Schema.NullOr(Schema.String)), | ||
| 268 | auth: Schema.optional(Schema.Unknown), | ||
| 269 | }), | ||
| 270 | ), | ||
| 271 | binding: Schema.Struct({ | ||
| 272 | transport: Schema.optional(Schema.NullOr(SourceTransportSchema)), | ||
| 273 | queryParams: Schema.optional(Schema.NullOr(StringMapSchema)), | ||
| 274 | headers: Schema.optional(Schema.NullOr(StringMapSchema)), | ||
| 275 | command: Schema.optional(Schema.NullOr(Schema.String)), | ||
| 276 | args: Schema.optional(Schema.NullOr(StringArraySchema)), | ||
| 277 | env: Schema.optional(Schema.NullOr(StringMapSchema)), | ||
| 278 | cwd: Schema.optional(Schema.NullOr(Schema.String)), | ||
| 279 | }), | ||
| 280 | config: Schema.optional(Schema.Unknown), | ||
| 281 | }), | ||
| 282 | ); | ||
| 283 | 258 | ||
| 284 | const normalizeStoredSourceData = ( | 259 | const normalizeStoredSourceData = ( |
| 285 | input: McpConnectInput | McpSourceConfigPayload, | 260 | input: McpConnectInput | McpSourceConfigPayload, |
| @@ -399,37 +374,6 @@ const mcpStoredSourceDataFromLocalConfig = ( · 113 unmodified lines | |||
| 399 | return Effect.succeed(current.value.config); | 374 | return Effect.succeed(current.value.config); |
| 400 | } | 375 | } |
| 401 | 376 | ||
| 402 | const legacy = decodeMcpLegacyLocalConfigOption(config); | ||
| 403 | if (Option.isSome(legacy)) { | ||
| 404 | const auth = decodeMcpAuthOption(legacy.value.connection?.auth); | ||
| 405 | if ( | ||
| 406 | legacy.value.connection?.auth !== undefined && | ||
| 407 | Option.isNone(auth) | ||
| 408 | ) { | ||
| 409 | return runtimeEffectError( | ||
| 410 | "plugins/mcp/sdk", | ||
| 411 | "Unsupported MCP auth configuration in local source config.", | ||
| 412 | ); | ||
| 413 | } | ||
| 414 | |||
| 415 | return normalizeStoredSourceData({ | ||
| 416 | name: legacy.value.name ?? "MCP", | ||
| 417 | endpoint: legacy.value.connection?.endpoint ?? null, | ||
| 418 | transport: legacy.value.binding.transport ?? null, | ||
| 419 | queryParams: legacy.value.binding.queryParams ?? null, | ||
| 420 | headers: legacy.value.binding.headers ?? null, | ||
| 421 | command: legacy.value.binding.command ?? null, | ||
| 422 | args: legacy.value.binding.args ?? null, | ||
| 423 | env: legacy.value.binding.env ?? null, | ||
| 424 | cwd: legacy.value.binding.cwd ?? null, | ||
| 425 | auth: Option.isSome(auth) | ||
| 426 | ? auth.value | ||
| 427 | : { | ||
| 428 | kind: "none", | ||
| 429 | }, | ||
| 430 | }); | ||
| 431 | } | ||
| 432 | |||
| 433 | return runtimeEffectError( | 377 | return runtimeEffectError( |
| 434 | "plugins/mcp/sdk", | 378 | "plugins/mcp/sdk", |
| 435 | "Unsupported MCP local source config.", | 379 | "Unsupported MCP local source config.", |
| @@ -500,7 +500,7 @@ describe("codemode-mcp", () => { · 499 unmodified lines | |||
| 500 | action: "accept" as const, | 500 | action: "accept" as const, |
| 501 | }; | 501 | }; |
| 502 | }), | 502 | }), |
| 503 | path: "executor.sources.add" as ToolPath, | 503 | path: "executor.mcp.createSource" as ToolPath, |
| 504 | sourceKey: "executor", | 504 | sourceKey: "executor", |
| 505 | args: { | 505 | args: { |
| 506 | endpoint: "https://example.com/mcp", | 506 | endpoint: "https://example.com/mcp", |
| @@ -19,7 +19,6 @@ import { · 18 unmodified lines | |||
| 19 | } from "@executor/platform-sdk/plugins"; | 19 | } from "@executor/platform-sdk/plugins"; |
| 20 | import { | 20 | import { |
| 21 | createPluginLocalConfigEntrySchema, | 21 | createPluginLocalConfigEntrySchema, |
| 22 | decodeCurrentOrLegacyLocalConfigAuth, | ||
| 23 | pluginLocalConfigSourceFromConfig, | 22 | pluginLocalConfigSourceFromConfig, |
| 24 | runtimeEffectError, | 23 | runtimeEffectError, |
| 25 | SecretMaterialResolverService, | 24 | SecretMaterialResolverService, |
| @@ -163,26 +162,6 @@ const decodeOpenApiCurrentLocalConfigOption = Schema.decodeUnknownOption( · 137 unmodified lines | |||
| 163 | }), | 162 | }), |
| 164 | ); | 163 | ); |
| 165 | 164 | ||
| 166 | const decodeOpenApiLegacyLocalConfigOption = Schema.decodeUnknownOption( | ||
| 167 | Schema.Struct({ | ||
| 168 | kind: Schema.Literal("openapi"), | ||
| 169 | name: Schema.optional(Schema.String), | ||
| 170 | namespace: Schema.optional(Schema.String), | ||
| 171 | enabled: Schema.optional(Schema.Boolean), | ||
| 172 | connection: Schema.Struct({ | ||
| 173 | endpoint: Schema.optional(Schema.NullOr(Schema.String)), | ||
| 174 | auth: Schema.optional(Schema.Unknown), | ||
| 175 | }), | ||
| 176 | binding: Schema.Struct({ | ||
| 177 | specUrl: Schema.String, | ||
| 178 | defaultHeaders: Schema.optional( | ||
| 179 | Schema.NullOr(Schema.Record({ key: Schema.String, value: Schema.String })), | ||
| 180 | ), | ||
| 181 | }), | ||
| 182 | config: Schema.optional(Schema.Unknown), | ||
| 183 | }), | ||
| 184 | ); | ||
| 185 | |||
| 186 | const createStoredSourceData = ( | 165 | const createStoredSourceData = ( |
| 187 | input: OpenApiConnectInput, | 166 | input: OpenApiConnectInput, |
| 188 | ): OpenApiStoredSourceData => ({ | 167 | ): OpenApiStoredSourceData => ({ |
| @@ -224,31 +203,6 @@ const openApiStoredSourceDataFromLocalConfig = (input: { · 35 unmodified lines | |||
| 224 | }); | 203 | }); |
| 225 | } | 204 | } |
| 226 | 205 | ||
| 227 | const legacy = decodeOpenApiLegacyLocalConfigOption(input.config); | ||
| 228 | if (Option.isSome(legacy)) { | ||
| 229 | return normalizeStoredSourceData({ | ||
| 230 | specUrl: legacy.value.binding.specUrl.trim(), | ||
| 231 | baseUrl: legacy.value.connection.endpoint?.trim() || null, | ||
| 232 | auth: decodeCurrentOrLegacyLocalConfigAuth({ | ||
| 233 | auth: legacy.value.connection.auth, | ||
| 234 | authSchema: OpenApiConnectionAuthSchema, | ||
| 235 | loadedConfig: input.loadedConfig, | ||
| 236 | onLegacySecretRef: (tokenSecretRef) => ({ | ||
| 237 | kind: "bearer", | ||
| 238 | tokenSecretRef, | ||
| 239 | headerName: null, | ||
| 240 | prefix: null, | ||
| 241 | }), | ||
| 242 | fallback: { | ||
| 243 | kind: "none", | ||
| 244 | }, | ||
| 245 | }), | ||
| 246 | defaultHeaders: legacy.value.binding.defaultHeaders ?? null, | ||
| 247 | etag: null, | ||
| 248 | lastSyncAt: null, | ||
| 249 | }); | ||
| 250 | } | ||
| 251 | |||
| 252 | throw new Error("Unsupported OpenAPI local source config."); | 206 | throw new Error("Unsupported OpenAPI local source config."); |
| 253 | }; | 207 | }; |
| 254 | 208 | ||