Unified · Split
| @@ -40,10 +40,10 @@ · 39 unmodified lines | ||
| 40 | 40 | "@executor/executor-mcp": "workspace:*", |
| 41 | 41 | "@executor/plugin-google-discovery-sdk": "workspace:*", |
| 42 | 42 | "@executor/plugin-graphql-sdk": "workspace:*", |
| 43 | + "@executor/plugin-internal-sdk": "workspace:*", | |
| 43 | 44 | "@executor/plugin-mcp-sdk": "workspace:*", |
| 44 | 45 | "@executor/plugin-openapi-sdk": "workspace:*", |
| 45 | 46 | "@executor/platform-api": "workspace:*", |
| 46 | − "@executor/platform-internal": "workspace:*", | |
| 47 | 47 | "@executor/platform-sdk": "workspace:*", |
| 48 | 48 | "@executor/platform-sdk-file": "workspace:*", |
| 49 | 49 | "@executor/server": "workspace:*", |
| @@ -20,13 +20,15 @@ import { · 19 unmodified lines | ||
| 20 | 20 | import { |
| 21 | 21 | graphqlSdkPlugin, |
| 22 | 22 | } from "@executor/plugin-graphql-sdk"; |
| 23 | +import { | |
| 24 | + internalSdkPlugin, | |
| 25 | +} from "@executor/plugin-internal-sdk"; | |
| 23 | 26 | import { |
| 24 | 27 | mcpSdkPlugin, |
| 25 | 28 | } from "@executor/plugin-mcp-sdk"; |
| 26 | 29 | import { |
| 27 | 30 | openApiSdkPlugin, |
| 28 | 31 | } from "@executor/plugin-openapi-sdk"; |
| 29 | −import { createWorkspaceExecutorAdminToolMap } from "@executor/platform-internal"; | |
| 30 | 32 | import { |
| 31 | 33 | getExecutorSourcesAddHelpLines, |
| 32 | 34 | RuntimeExecutionResolverService, |
| @@ -303,6 +305,7 @@ const loadRunWorkflowText = (): Effect.Effect<string, Error, never> => · 270 unmodified lines | ||
| 303 | 305 | localDataDir: DEFAULT_LOCAL_DATA_DIR, |
| 304 | 306 | }), |
| 305 | 307 | plugins: [ |
| 308 | + internalSdkPlugin(), | |
| 306 | 309 | graphqlSdkPlugin({ |
| 307 | 310 | storage: createFileGraphqlSourceStorage({ |
| 308 | 311 | rootDir: `${DEFAULT_LOCAL_DATA_DIR}/plugins/graphql/sources`, |
| @@ -330,7 +333,6 @@ const loadRunWorkflowText = (): Effect.Effect<string, Error, never> => · 21 unmodified lines | ||
| 330 | 333 | }), |
| 331 | 334 | }), |
| 332 | 335 | ] as const, |
| 333 | − createInternalToolMap: createWorkspaceExecutorAdminToolMap, | |
| 334 | 336 | }).pipe(Effect.mapError(toError)), |
| 335 | 337 | (executor) => |
| 336 | 338 | Effect.gen(function* () { |
| @@ -29,11 +29,11 @@ · 28 unmodified lines | ||
| 29 | 29 | "@executor/codemode-core": "workspace:*", |
| 30 | 30 | "@executor/executor-mcp": "workspace:*", |
| 31 | 31 | "@executor/platform-api": "workspace:*", |
| 32 | − "@executor/platform-internal": "workspace:*", | |
| 33 | 32 | "@executor/platform-sdk": "workspace:*", |
| 34 | 33 | "@executor/platform-sdk-file": "workspace:*", |
| 35 | 34 | "@executor/plugin-google-discovery-sdk": "workspace:*", |
| 36 | 35 | "@executor/plugin-graphql-sdk": "workspace:*", |
| 36 | + "@executor/plugin-internal-sdk": "workspace:*", | |
| 37 | 37 | "@executor/plugin-mcp-sdk": "workspace:*", |
| 38 | 38 | "@executor/plugin-openapi-sdk": "workspace:*", |
| 39 | 39 | "@executor/server": "workspace:*", |
| @@ -308,20 +308,6 @@ · 268 unmodified lines | ||
| 308 | 308 | "vitest": "catalog:", |
| 309 | 309 | }, |
| 310 | 310 | }, |
| 311 | − "packages/platform/internal": { | |
| 312 | − "name": "@executor/platform-internal", | |
| 313 | − "version": "0.0.0", | |
| 314 | − "dependencies": { | |
| 315 | − "@executor/codemode-core": "workspace:*", | |
| 316 | − "@executor/platform-sdk": "workspace:*", | |
| 317 | − "effect": "catalog:", | |
| 318 | − }, | |
| 319 | − "devDependencies": { | |
| 320 | − "@types/node": "catalog:", | |
| 321 | − "bun-types": "catalog:", | |
| 322 | − "typescript": "^5.9.3", | |
| 323 | − }, | |
| 324 | − }, | |
| 325 | 311 | "packages/platform/sdk": { |
| 326 | 312 | "name": "@executor/platform-sdk", |
| 327 | 313 | "version": "0.0.0", |
| @@ -379,7 +365,6 @@ · 51 unmodified lines | ||
| 379 | 365 | "@effect/platform-node": "catalog:", |
| 380 | 366 | "@executor/executor-mcp": "workspace:*", |
| 381 | 367 | "@executor/platform-api": "workspace:*", |
| 382 | − "@executor/platform-internal": "workspace:*", | |
| 383 | 368 | "@executor/platform-sdk": "workspace:*", |
| 384 | 369 | "@executor/platform-sdk-file": "workspace:*", |
| 385 | 370 | "@executor/plugin-google-discovery-http": "workspace:*", |
| @@ -388,6 +373,7 @@ · 2 unmodified lines | ||
| 388 | 373 | "@executor/plugin-graphql-http": "workspace:*", |
| 389 | 374 | "@executor/plugin-graphql-sdk": "workspace:*", |
| 390 | 375 | "@executor/plugin-graphql-shared": "workspace:*", |
| 376 | + "@executor/plugin-internal-sdk": "workspace:*", | |
| 391 | 377 | "@executor/plugin-mcp-http": "workspace:*", |
| 392 | 378 | "@executor/plugin-mcp-sdk": "workspace:*", |
| 393 | 379 | "@executor/plugin-mcp-shared": "workspace:*", |
| @@ -541,6 +527,19 @@ · 147 unmodified lines | ||
| 541 | 527 | "bun-types": "catalog:", |
| 542 | 528 | }, |
| 543 | 529 | }, |
| 530 | + "plugins/internal/sdk": { | |
| 531 | + "name": "@executor/plugin-internal-sdk", | |
| 532 | + "version": "0.0.0", | |
| 533 | + "dependencies": { | |
| 534 | + "@executor/platform-sdk": "workspace:*", | |
| 535 | + "@executor/source-core": "workspace:*", | |
| 536 | + "effect": "catalog:", | |
| 537 | + }, | |
| 538 | + "devDependencies": { | |
| 539 | + "@types/node": "catalog:", | |
| 540 | + "bun-types": "catalog:", | |
| 541 | + }, | |
| 542 | + }, | |
| 544 | 543 | "plugins/mcp/http": { |
| 545 | 544 | "name": "@executor/plugin-mcp-http", |
| 546 | 545 | "version": "0.0.0", |
| @@ -886,8 +885,6 @@ · 339 unmodified lines | ||
| 886 | 885 | |
| 887 | 886 | "@executor/platform-api": ["@executor/platform-api@workspace:packages/platform/api"], |
| 888 | 887 | |
| 889 | − "@executor/platform-internal": ["@executor/platform-internal@workspace:packages/platform/internal"], | |
| 890 | − | |
| 891 | 888 | "@executor/platform-sdk": ["@executor/platform-sdk@workspace:packages/platform/sdk"], |
| 892 | 889 | |
| 893 | 890 | "@executor/platform-sdk-file": ["@executor/platform-sdk-file@workspace:packages/platform/sdk-file"], |
| @@ -908,6 +905,8 @@ · 14 unmodified lines | ||
| 908 | 905 | |
| 909 | 906 | "@executor/plugin-graphql-shared": ["@executor/plugin-graphql-shared@workspace:plugins/graphql/shared"], |
| 910 | 907 | |
| 908 | + "@executor/plugin-internal-sdk": ["@executor/plugin-internal-sdk@workspace:plugins/internal/sdk"], | |
| 909 | + | |
| 911 | 910 | "@executor/plugin-mcp-http": ["@executor/plugin-mcp-http@workspace:plugins/mcp/http"], |
| 912 | 911 | |
| 913 | 912 | "@executor/plugin-mcp-react": ["@executor/plugin-mcp-react@workspace:plugins/mcp/react"], |
| @@ -1 +0,0 @@ | ||
| 1 | −export * from "./tools/executor-admin"; | |
| @@ -1,758 +0,0 @@ | ||
| 1 | −import { toTool, type ToolMap } from "@executor/codemode-core"; | |
| 2 | −import type { Executor } from "@executor/platform-sdk"; | |
| 3 | −import { | |
| 4 | − type ScopeId as AccountId, | |
| 5 | − LocalInstallationSchema, | |
| 6 | − LocalScopePolicySchema, | |
| 7 | − SourceIdSchema, | |
| 8 | − SourceInspectionDiscoverPayloadSchema, | |
| 9 | − SourceInspectionDiscoverResultSchema, | |
| 10 | − SourceInspectionSchema, | |
| 11 | − SourceInspectionToolDetailSchema, | |
| 12 | − SourceSchema, | |
| 13 | − type ScopeId as WorkspaceId, | |
| 14 | −} from "@executor/platform-sdk/schema"; | |
| 15 | −import * as Effect from "effect/Effect"; | |
| 16 | −import * as Layer from "effect/Layer"; | |
| 17 | −import * as Schema from "effect/Schema"; | |
| 18 | − | |
| 19 | −import { | |
| 20 | − ExecutorStateStore, | |
| 21 | − LocalInstanceConfigService, | |
| 22 | − SecretMaterialDeleterService, | |
| 23 | − SecretMaterialStorerService, | |
| 24 | − SecretMaterialUpdaterService, | |
| 25 | − type ExecutorStateStoreShape, | |
| 26 | − type ScopeInternalToolContext as WorkspaceInternalToolContext, | |
| 27 | − RuntimeSourceCatalogSyncService, | |
| 28 | − RuntimeSourceStore, | |
| 29 | − RuntimeSourceStoreService, | |
| 30 | −} from "@executor/platform-sdk/runtime"; | |
| 31 | −import { | |
| 32 | − type RuntimeLocalScopeState, | |
| 33 | − provideOptionalRuntimeLocalScope, | |
| 34 | −} from "../../../sdk/src/runtime/scope/runtime-context"; | |
| 35 | −import { | |
| 36 | − SourceArtifactStore, | |
| 37 | − type SourceArtifactStoreShape, | |
| 38 | − ScopeConfigStore, | |
| 39 | − type ScopeConfigStoreShape, | |
| 40 | − ScopeStateStore, | |
| 41 | − type ScopeStateStoreShape, | |
| 42 | − makeScopeStorageLayer, | |
| 43 | −} from "../../../sdk/src/runtime/scope/storage"; | |
| 44 | −import { | |
| 45 | − CreateSecretPayloadSchema, | |
| 46 | − CreateSecretResultSchema, | |
| 47 | − type CreateSecretPayload, | |
| 48 | − DeleteSecretResultSchema, | |
| 49 | − InstanceConfigSchema, | |
| 50 | − SecretListItemSchema, | |
| 51 | − UpdateSecretPayloadSchema, | |
| 52 | − UpdateSecretResultSchema, | |
| 53 | − type UpdateSecretPayload, | |
| 54 | −} from "@executor/platform-sdk/contracts"; | |
| 55 | −import { | |
| 56 | − createLocalSecret, | |
| 57 | − createPolicy, | |
| 58 | − deleteLocalSecret, | |
| 59 | − discoverSourceInspectionTools, | |
| 60 | − getPolicy, | |
| 61 | − getSource, | |
| 62 | − getSourceInspection, | |
| 63 | − getSourceInspectionToolDetail, | |
| 64 | − listLocalSecrets, | |
| 65 | − listPolicies, | |
| 66 | − listSources, | |
| 67 | − removePolicy, | |
| 68 | − removeSource, | |
| 69 | − updateLocalSecret, | |
| 70 | − updatePolicy, | |
| 71 | −} from "@executor/platform-sdk/operations"; | |
| 72 | −import { | |
| 73 | − CreatePolicyPayloadSchema, | |
| 74 | − type CreatePolicyPayload, | |
| 75 | − type UpdatePolicyPayload, | |
| 76 | − UpdatePolicyPayloadSchema, | |
| 77 | −} from "@executor/platform-sdk/contracts"; | |
| 78 | −const emptyInputSchema = Schema.standardSchemaV1(Schema.Struct({})); | |
| 79 | −const localInstallationOutputSchema = Schema.standardSchemaV1( | |
| 80 | − LocalInstallationSchema, | |
| 81 | −); | |
| 82 | −const instanceConfigOutputSchema = | |
| 83 | − Schema.standardSchemaV1(InstanceConfigSchema); | |
| 84 | −const secretListOutputSchema = Schema.standardSchemaV1( | |
| 85 | − Schema.Array(SecretListItemSchema), | |
| 86 | −); | |
| 87 | −const createSecretInputSchema = Schema.standardSchemaV1( | |
| 88 | − CreateSecretPayloadSchema, | |
| 89 | −); | |
| 90 | −const updateSecretInputSchema = Schema.standardSchemaV1( | |
| 91 | − Schema.Struct({ | |
| 92 | − secretId: Schema.String, | |
| 93 | − payload: UpdateSecretPayloadSchema, | |
| 94 | − }), | |
| 95 | −); | |
| 96 | −const removeSecretInputSchema = Schema.standardSchemaV1( | |
| 97 | − Schema.Struct({ | |
| 98 | − secretId: Schema.String, | |
| 99 | − }), | |
| 100 | −); | |
| 101 | −const removeResultSchema = Schema.standardSchemaV1( | |
| 102 | − Schema.Struct({ | |
| 103 | − removed: Schema.Boolean, | |
| 104 | − }), | |
| 105 | −); | |
| 106 | −const listSourcesOutputSchema = Schema.standardSchemaV1( | |
| 107 | − Schema.Array(SourceSchema), | |
| 108 | −); | |
| 109 | −const getSourceInputSchema = Schema.standardSchemaV1( | |
| 110 | − Schema.Struct({ | |
| 111 | − sourceId: SourceIdSchema, | |
| 112 | − }), | |
| 113 | −); | |
| 114 | −const inspectToolInputSchema = Schema.standardSchemaV1( | |
| 115 | − Schema.Struct({ | |
| 116 | − sourceId: SourceIdSchema, | |
| 117 | − toolPath: Schema.String, | |
| 118 | − }), | |
| 119 | −); | |
| 120 | −const inspectDiscoverInputSchema = Schema.standardSchemaV1( | |
| 121 | − Schema.Struct({ | |
| 122 | − sourceId: SourceIdSchema, | |
| 123 | − payload: SourceInspectionDiscoverPayloadSchema, | |
| 124 | − }), | |
| 125 | −); | |
| 126 | −const listPoliciesOutputSchema = Schema.standardSchemaV1( | |
| 127 | − Schema.Array(LocalScopePolicySchema), | |
| 128 | −); | |
| 129 | −const policyIdInputSchema = Schema.standardSchemaV1( | |
| 130 | − Schema.Struct({ | |
| 131 | − policyId: Schema.String, | |
| 132 | − }), | |
| 133 | −); | |
| 134 | −const createPolicyInputSchema = Schema.standardSchemaV1( | |
| 135 | − CreatePolicyPayloadSchema, | |
| 136 | −); | |
| 137 | −const updatePolicyInputSchema = Schema.standardSchemaV1( | |
| 138 | − Schema.Struct({ | |
| 139 | − policyId: Schema.String, | |
| 140 | − payload: UpdatePolicyPayloadSchema, | |
| 141 | − }), | |
| 142 | −); | |
| 143 | −const sourceOutputSchema = Schema.standardSchemaV1(SourceSchema); | |
| 144 | −const sourceInspectionOutputSchema = Schema.standardSchemaV1( | |
| 145 | − SourceInspectionSchema, | |
| 146 | −); | |
| 147 | −const sourceInspectionToolOutputSchema = Schema.standardSchemaV1( | |
| 148 | − SourceInspectionToolDetailSchema, | |
| 149 | −); | |
| 150 | −const sourceInspectionDiscoverOutputSchema = Schema.standardSchemaV1( | |
| 151 | − SourceInspectionDiscoverResultSchema, | |
| 152 | −); | |
| 153 | −const localScopePolicyOutputSchema = Schema.standardSchemaV1( | |
| 154 | − LocalScopePolicySchema, | |
| 155 | −); | |
| 156 | − | |
| 157 | −const makeRuntimeLayer = (input: { | |
| 158 | − executorStateStore: ExecutorStateStoreShape; | |
| 159 | − sourceStore: RuntimeSourceStore; | |
| 160 | − sourceCatalogSyncService: Effect.Effect.Success< | |
| 161 | − typeof RuntimeSourceCatalogSyncService | |
| 162 | − >; | |
| 163 | − scopeConfigStore: ScopeConfigStoreShape; | |
| 164 | − scopeStateStore: ScopeStateStoreShape; | |
| 165 | − sourceArtifactStore: SourceArtifactStoreShape; | |
| 166 | − instanceConfigResolver: WorkspaceInternalToolContext["instanceConfigResolver"]; | |
| 167 | − storeSecretMaterial: WorkspaceInternalToolContext["storeSecretMaterial"]; | |
| 168 | − deleteSecretMaterial: WorkspaceInternalToolContext["deleteSecretMaterial"]; | |
| 169 | − updateSecretMaterial: WorkspaceInternalToolContext["updateSecretMaterial"]; | |
| 170 | −}) => | |
| 171 | − Layer.mergeAll( | |
| 172 | − Layer.succeed(ExecutorStateStore, input.executorStateStore), | |
| 173 | − Layer.succeed(RuntimeSourceStoreService, input.sourceStore), | |
| 174 | − Layer.succeed( | |
| 175 | − RuntimeSourceCatalogSyncService, | |
| 176 | − input.sourceCatalogSyncService, | |
| 177 | − ), | |
| 178 | − Layer.succeed(LocalInstanceConfigService, input.instanceConfigResolver), | |
| 179 | − Layer.succeed(SecretMaterialStorerService, input.storeSecretMaterial), | |
| 180 | − Layer.succeed(SecretMaterialDeleterService, input.deleteSecretMaterial), | |
| 181 | − Layer.succeed(SecretMaterialUpdaterService, input.updateSecretMaterial), | |
| 182 | − makeScopeStorageLayer({ | |
| 183 | − scopeConfigStore: input.scopeConfigStore, | |
| 184 | − scopeStateStore: input.scopeStateStore, | |
| 185 | − sourceArtifactStore: input.sourceArtifactStore, | |
| 186 | − }), | |
| 187 | − ); | |
| 188 | − | |
| 189 | −const runRuntimeEffect = <A, E, R>(input: { | |
| 190 | − effect: Effect.Effect<A, E, R>; | |
| 191 | − runtimeLayer: Layer.Layer< | |
| 192 | − | ExecutorStateStore | |
| 193 | − | LocalInstanceConfigService | |
| 194 | − | RuntimeSourceStoreService | |
| 195 | − | RuntimeSourceCatalogSyncService | |
| 196 | − | SecretMaterialStorerService | |
| 197 | − | SecretMaterialDeleterService | |
| 198 | − | SecretMaterialUpdaterService | |
| 199 | − | ScopeConfigStore | |
| 200 | − | ScopeStateStore | |
| 201 | − | SourceArtifactStore, | |
| 202 | − never, | |
| 203 | − never | |
| 204 | − >; | |
| 205 | − runtimeLocalScope: RuntimeLocalScopeState | null; | |
| 206 | −}) => | |
| 207 | − Effect.runPromise( | |
| 208 | − provideOptionalRuntimeLocalScope( | |
| 209 | − input.effect.pipe(Effect.provide(input.runtimeLayer)), | |
| 210 | − input.runtimeLocalScope, | |
| 211 | − ) as Effect.Effect<A, E, never>, | |
| 212 | − ); | |
| 213 | − | |
| 214 | −const runScopeStorageEffect = <A, E, R>(input: { | |
| 215 | − effect: Effect.Effect<A, E, R>; | |
| 216 | − scopeStorageLayer: Layer.Layer< | |
| 217 | − ScopeConfigStore | ScopeStateStore | SourceArtifactStore, | |
| 218 | − never, | |
| 219 | − never | |
| 220 | − >; | |
| 221 | − runtimeLocalScope: RuntimeLocalScopeState | null; | |
| 222 | −}) => | |
| 223 | − Effect.runPromise( | |
| 224 | − provideOptionalRuntimeLocalScope( | |
| 225 | − input.effect.pipe(Effect.provide(input.scopeStorageLayer)), | |
| 226 | − input.runtimeLocalScope, | |
| 227 | − ) as Effect.Effect<A, E, never>, | |
| 228 | − ); | |
| 229 | − | |
| 230 | −export const createWorkspaceExecutorAdminToolMap = ( | |
| 231 | − input: WorkspaceInternalToolContext, | |
| 232 | −): ToolMap => { | |
| 233 | − const runtimeLayer = makeRuntimeLayer({ | |
| 234 | − executorStateStore: input.executorStateStore, | |
| 235 | − sourceStore: input.sourceStore, | |
| 236 | − sourceCatalogSyncService: input.sourceCatalogSyncService, | |
| 237 | − scopeConfigStore: input.scopeConfigStore, | |
| 238 | − scopeStateStore: input.scopeStateStore, | |
| 239 | − sourceArtifactStore: input.sourceArtifactStore, | |
| 240 | − instanceConfigResolver: input.instanceConfigResolver, | |
| 241 | − storeSecretMaterial: input.storeSecretMaterial, | |
| 242 | − deleteSecretMaterial: input.deleteSecretMaterial, | |
| 243 | − updateSecretMaterial: input.updateSecretMaterial, | |
| 244 | − }); | |
| 245 | − const scopeStorageLayer = makeScopeStorageLayer({ | |
| 246 | − scopeConfigStore: input.scopeConfigStore, | |
| 247 | − scopeStateStore: input.scopeStateStore, | |
| 248 | − sourceArtifactStore: input.sourceArtifactStore, | |
| 249 | − }); | |
| 250 | − | |
| 251 | − const metadata = { | |
| 252 | − sourceKey: "executor", | |
| 253 | − interaction: "auto" as const, | |
| 254 | − }; | |
| 255 | − | |
| 256 | − return { | |
| 257 | − "executor.local.installation.get": toTool({ | |
| 258 | − tool: { | |
| 259 | − description: | |
| 260 | − "Get the active local executor installation account and workspace ids.", | |
| 261 | − inputSchema: emptyInputSchema, | |
| 262 | − outputSchema: localInstallationOutputSchema, | |
| 263 | − execute: async () => ({ | |
| 264 | − scopeId: input.scopeId, | |
| 265 | − actorScopeId: input.actorScopeId, | |
| 266 | − }), | |
| 267 | − }, | |
| 268 | − metadata, | |
| 269 | − }), | |
| 270 | − "executor.local.config.get": toTool({ | |
| 271 | − tool: { | |
| 272 | − description: | |
| 273 | − "Get local instance config such as supported secret providers.", | |
| 274 | − inputSchema: emptyInputSchema, | |
| 275 | − outputSchema: instanceConfigOutputSchema, | |
| 276 | − execute: () => Effect.runPromise(input.instanceConfigResolver()), | |
| 277 | − }, | |
| 278 | − metadata, | |
| 279 | − }), | |
| 280 | − "executor.secrets.list": toTool({ | |
| 281 | − tool: { | |
| 282 | − description: | |
| 283 | − "List locally stored secrets and the sources linked to them.", | |
| 284 | − inputSchema: emptyInputSchema, | |
| 285 | − outputSchema: secretListOutputSchema, | |
| 286 | − execute: () => | |
| 287 | − runRuntimeEffect({ | |
| 288 | − effect: listLocalSecrets(), | |
| 289 | − runtimeLayer, | |
| 290 | − runtimeLocalScope: input.runtimeLocalScope, | |
| 291 | − }), | |
| 292 | − }, | |
| 293 | − metadata, | |
| 294 | − }), | |
| 295 | − "executor.secrets.create": toTool({ | |
| 296 | − tool: { | |
| 297 | − description: | |
| 298 | − "Create a local secret without putting the raw value into source config.", | |
| 299 | − inputSchema: createSecretInputSchema, | |
| 300 | − outputSchema: Schema.standardSchemaV1(CreateSecretResultSchema), | |
| 301 | − execute: (payload: CreateSecretPayload) => | |
| 302 | − runRuntimeEffect({ | |
| 303 | − effect: createLocalSecret(payload), | |
| 304 | − runtimeLayer, | |
| 305 | − runtimeLocalScope: input.runtimeLocalScope, | |
| 306 | − }), | |
| 307 | − }, | |
| 308 | − metadata, | |
| 309 | − }), | |
| 310 | − "executor.secrets.update": toTool({ | |
| 311 | − tool: { | |
| 312 | − description: | |
| 313 | − "Update a stored secret name and optionally rotate its value.", | |
| 314 | − inputSchema: updateSecretInputSchema, | |
| 315 | − outputSchema: Schema.standardSchemaV1(UpdateSecretResultSchema), | |
| 316 | − execute: (payload: { | |
| 317 | − secretId: string; | |
| 318 | − payload: UpdateSecretPayload; | |
| 319 | − }) => | |
| 320 | − runRuntimeEffect({ | |
| 321 | − effect: updateLocalSecret(payload), | |
| 322 | − runtimeLayer, | |
| 323 | − runtimeLocalScope: input.runtimeLocalScope, | |
| 324 | − }), | |
| 325 | − }, | |
| 326 | − metadata, | |
| 327 | − }), | |
| 328 | − "executor.secrets.remove": toTool({ | |
| 329 | − tool: { | |
| 330 | − description: "Remove a stored local secret.", | |
| 331 | − inputSchema: removeSecretInputSchema, | |
| 332 | − outputSchema: Schema.standardSchemaV1(DeleteSecretResultSchema), | |
| 333 | − execute: ({ secretId }: { secretId: string }) => | |
| 334 | − runRuntimeEffect({ | |
| 335 | − effect: deleteLocalSecret(secretId), | |
| 336 | − runtimeLayer, | |
| 337 | − runtimeLocalScope: input.runtimeLocalScope, | |
| 338 | − }), | |
| 339 | − }, | |
| 340 | − metadata, | |
| 341 | − }), | |
| 342 | − "executor.sources.list": toTool({ | |
| 343 | − tool: { | |
| 344 | − description: "List sources connected in the current workspace.", | |
| 345 | − inputSchema: emptyInputSchema, | |
| 346 | − outputSchema: listSourcesOutputSchema, | |
| 347 | − execute: () => | |
| 348 | − runRuntimeEffect({ | |
| 349 | − effect: listSources({ | |
| 350 | − scopeId: input.scopeId, | |
| 351 | − actorScopeId: input.actorScopeId as never, | |
| 352 | − }), | |
| 353 | − runtimeLayer, | |
| 354 | − runtimeLocalScope: input.runtimeLocalScope, | |
| 355 | − }), | |
| 356 | − }, | |
| 357 | − metadata, | |
| 358 | − }), | |
| 359 | − "executor.sources.get": toTool({ | |
| 360 | − tool: { | |
| 361 | − description: "Get one source by id.", | |
| 362 | − inputSchema: getSourceInputSchema, | |
| 363 | − outputSchema: sourceOutputSchema, | |
| 364 | − execute: ({ sourceId }: { sourceId: string }) => | |
| 365 | − runRuntimeEffect({ | |
| 366 | − effect: getSource({ | |
| 367 | − scopeId: input.scopeId, | |
| 368 | − sourceId: sourceId as never, | |
| 369 | − actorScopeId: input.actorScopeId as never, | |
| 370 | − }), | |
| 371 | − runtimeLayer, | |
| 372 | − runtimeLocalScope: input.runtimeLocalScope, | |
| 373 | − }), | |
| 374 | − }, | |
| 375 | − metadata, | |
| 376 | − }), | |
| 377 | − "executor.sources.remove": toTool({ | |
| 378 | − tool: { | |
| 379 | − description: "Remove a source from the current workspace.", | |
| 380 | − inputSchema: getSourceInputSchema, | |
| 381 | − outputSchema: removeResultSchema, | |
| 382 | − execute: ({ sourceId }: { sourceId: string }) => | |
| 383 | − runRuntimeEffect({ | |
| 384 | − effect: removeSource({ | |
| 385 | − scopeId: input.scopeId, | |
| 386 | − sourceId: sourceId as never, | |
| 387 | − }), | |
| 388 | − runtimeLayer, | |
| 389 | − runtimeLocalScope: input.runtimeLocalScope, | |
| 390 | − }), | |
| 391 | − }, | |
| 392 | − metadata, | |
| 393 | − }), | |
| 394 | − "executor.sources.inspect.get": toTool({ | |
| 395 | − tool: { | |
| 396 | − description: "Inspect the tool model for one connected source.", | |
| 397 | − inputSchema: getSourceInputSchema, | |
| 398 | − outputSchema: sourceInspectionOutputSchema, | |
| 399 | − execute: ({ sourceId }: { sourceId: string }) => | |
| 400 | − runRuntimeEffect({ | |
| 401 | − effect: getSourceInspection({ | |
| 402 | − scopeId: input.scopeId, | |
| 403 | − sourceId: sourceId as never, | |
| 404 | − }), | |
| 405 | − runtimeLayer, | |
| 406 | − runtimeLocalScope: input.runtimeLocalScope, | |
| 407 | − }), | |
| 408 | − }, | |
| 409 | − metadata, | |
| 410 | − }), | |
| 411 | − "executor.sources.inspect.tool": toTool({ | |
| 412 | − tool: { | |
| 413 | − description: "Inspect one tool inside a connected source.", | |
| 414 | − inputSchema: inspectToolInputSchema, | |
| 415 | − outputSchema: sourceInspectionToolOutputSchema, | |
| 416 | − execute: ({ | |
| 417 | − sourceId, | |
| 418 | − toolPath, | |
| 419 | − }: { | |
| 420 | − sourceId: string; | |
| 421 | − toolPath: string; | |
| 422 | − }) => | |
| 423 | − runRuntimeEffect({ | |
| 424 | − effect: getSourceInspectionToolDetail({ | |
| 425 | − scopeId: input.scopeId, | |
| 426 | − sourceId: sourceId as never, | |
| 427 | − toolPath, | |
| 428 | − }), | |
| 429 | − runtimeLayer, | |
| 430 | − runtimeLocalScope: input.runtimeLocalScope, | |
| 431 | − }), | |
| 432 | − }, | |
| 433 | − metadata, | |
| 434 | − }), | |
| 435 | − "executor.sources.inspect.discover": toTool({ | |
| 436 | − tool: { | |
| 437 | − description: "Search within a single source's inspected tools.", | |
| 438 | − inputSchema: inspectDiscoverInputSchema, | |
| 439 | − outputSchema: sourceInspectionDiscoverOutputSchema, | |
| 440 | − execute: ({ | |
| 441 | − sourceId, | |
| 442 | − payload, | |
| 443 | − }: { | |
| 444 | − sourceId: string; | |
| 445 | − payload: { query: string; limit?: number }; | |
| 446 | − }) => | |
| 447 | − runRuntimeEffect({ | |
| 448 | − effect: discoverSourceInspectionTools({ | |
| 449 | − scopeId: input.scopeId, | |
| 450 | − sourceId: sourceId as never, | |
| 451 | − payload: payload as never, | |
| 452 | − }), | |
| 453 | − runtimeLayer, | |
| 454 | − runtimeLocalScope: input.runtimeLocalScope, | |
| 455 | − }), | |
| 456 | − }, | |
| 457 | − metadata, | |
| 458 | − }), | |
| 459 | − "executor.policies.list": toTool({ | |
| 460 | − tool: { | |
| 461 | − description: "List local workspace policies.", | |
| 462 | − inputSchema: emptyInputSchema, | |
| 463 | − outputSchema: listPoliciesOutputSchema, | |
| 464 | − execute: () => | |
| 465 | − runRuntimeEffect({ | |
| 466 | − effect: listPolicies(input.scopeId), | |
| 467 | − runtimeLayer, | |
| 468 | − runtimeLocalScope: input.runtimeLocalScope, | |
| 469 | − }), | |
| 470 | − }, | |
| 471 | − metadata, | |
| 472 | − }), | |
| 473 | − "executor.policies.create": toTool({ | |
| 474 | − tool: { | |
| 475 | − description: "Create a local workspace policy.", | |
| 476 | − inputSchema: createPolicyInputSchema, | |
| 477 | − outputSchema: localScopePolicyOutputSchema, | |
| 478 | − execute: (payload: CreatePolicyPayload) => | |
| 479 | − runRuntimeEffect({ | |
| 480 | − effect: createPolicy({ | |
| 481 | − scopeId: input.scopeId, | |
| 482 | − payload, | |
| 483 | − }), | |
| 484 | − runtimeLayer, | |
| 485 | − runtimeLocalScope: input.runtimeLocalScope, | |
| 486 | − }), | |
| 487 | − }, | |
| 488 | − metadata, | |
| 489 | − }), | |
| 490 | − "executor.policies.get": toTool({ | |
| 491 | − tool: { | |
| 492 | − description: "Get one local workspace policy by id.", | |
| 493 | − inputSchema: policyIdInputSchema, | |
| 494 | − outputSchema: localScopePolicyOutputSchema, | |
| 495 | − execute: ({ policyId }: { policyId: string }) => | |
| 496 | − runRuntimeEffect({ | |
| 497 | − effect: getPolicy({ | |
| 498 | − scopeId: input.scopeId, | |
| 499 | − policyId: policyId as never, | |
| 500 | − }), | |
| 501 | − runtimeLayer, | |
| 502 | − runtimeLocalScope: input.runtimeLocalScope, | |
| 503 | − }), | |
| 504 | − }, | |
| 505 | − metadata, | |
| 506 | − }), | |
| 507 | − "executor.policies.update": toTool({ | |
| 508 | − tool: { | |
| 509 | − description: "Update a local workspace policy.", | |
| 510 | − inputSchema: updatePolicyInputSchema, | |
| 511 | − outputSchema: localScopePolicyOutputSchema, | |
| 512 | − execute: ({ | |
| 513 | − policyId, | |
| 514 | − payload, | |
| 515 | − }: { | |
| 516 | − policyId: string; | |
| 517 | − payload: UpdatePolicyPayload; | |
| 518 | − }) => | |
| 519 | − runRuntimeEffect({ | |
| 520 | − effect: updatePolicy({ | |
| 521 | − scopeId: input.scopeId, | |
| 522 | − policyId: policyId as never, | |
| 523 | − payload, | |
| 524 | − }), | |
| 525 | − runtimeLayer, | |
| 526 | − runtimeLocalScope: input.runtimeLocalScope, | |
| 527 | − }), | |
| 528 | − }, | |
| 529 | − metadata, | |
| 530 | − }), | |
| 531 | − "executor.policies.remove": toTool({ | |
| 532 | − tool: { | |
| 533 | − description: "Remove a local workspace policy.", | |
| 534 | − inputSchema: policyIdInputSchema, | |
| 535 | − outputSchema: removeResultSchema, | |
| 536 | − execute: ({ policyId }: { policyId: string }) => | |
| 537 | − runRuntimeEffect({ | |
| 538 | − effect: removePolicy({ | |
| 539 | − scopeId: input.scopeId, | |
| 540 | − policyId: policyId as never, | |
| 541 | − }), | |
| 542 | − runtimeLayer, | |
| 543 | − runtimeLocalScope: input.runtimeLocalScope, | |
| 544 | − }), | |
| 545 | − }, | |
| 546 | − metadata, | |
| 547 | − }), | |
| 548 | − }; | |
| 549 | −}; | |
| 550 | − | |
| 551 | −export const createExecutorAdminToolMap = (input: { | |
| 552 | − executor: Executor; | |
| 553 | −}): ToolMap => { | |
| 554 | − const metadata = { | |
| 555 | − sourceKey: "executor", | |
| 556 | − interaction: "auto" as const, | |
| 557 | − }; | |
| 558 | − | |
| 559 | − return { | |
| 560 | − "executor.local.installation.get": toTool({ | |
| 561 | − tool: { | |
| 562 | − description: | |
| 563 | − "Get the active local executor installation account and workspace ids.", | |
| 564 | − inputSchema: emptyInputSchema, | |
| 565 | − outputSchema: localInstallationOutputSchema, | |
| 566 | − execute: () => Promise.resolve(input.executor.installation), | |
| 567 | − }, | |
| 568 | − metadata, | |
| 569 | − }), | |
| 570 | − "executor.local.config.get": toTool({ | |
| 571 | − tool: { | |
| 572 | − description: | |
| 573 | − "Get local instance config such as supported secret providers.", | |
| 574 | − inputSchema: emptyInputSchema, | |
| 575 | − outputSchema: instanceConfigOutputSchema, | |
| 576 | − execute: () => input.executor.local.config(), | |
| 577 | − }, | |
| 578 | − metadata, | |
| 579 | − }), | |
| 580 | − "executor.secrets.list": toTool({ | |
| 581 | − tool: { | |
| 582 | − description: | |
| 583 | − "List locally stored secrets and the sources linked to them.", | |
| 584 | − inputSchema: emptyInputSchema, | |
| 585 | − outputSchema: secretListOutputSchema, | |
| 586 | − execute: () => input.executor.secrets.list(), | |
| 587 | − }, | |
| 588 | − metadata, | |
| 589 | − }), | |
| 590 | − "executor.secrets.create": toTool({ | |
| 591 | − tool: { | |
| 592 | − description: | |
| 593 | − "Create a local secret without putting the raw value into source config.", | |
| 594 | − inputSchema: createSecretInputSchema, | |
| 595 | − outputSchema: Schema.standardSchemaV1(CreateSecretResultSchema), | |
| 596 | − execute: (payload: CreateSecretPayload) => | |
| 597 | − input.executor.secrets.create(payload), | |
| 598 | − }, | |
| 599 | − metadata, | |
| 600 | − }), | |
| 601 | − "executor.secrets.update": toTool({ | |
| 602 | − tool: { | |
| 603 | − description: | |
| 604 | − "Update a stored secret name and optionally rotate its value.", | |
| 605 | − inputSchema: updateSecretInputSchema, | |
| 606 | − outputSchema: Schema.standardSchemaV1(UpdateSecretResultSchema), | |
| 607 | − execute: (payload: { | |
| 608 | − secretId: string; | |
| 609 | − payload: UpdateSecretPayload; | |
| 610 | − }) => input.executor.secrets.update(payload), | |
| 611 | − }, | |
| 612 | − metadata, | |
| 613 | − }), | |
| 614 | − "executor.secrets.remove": toTool({ | |
| 615 | − tool: { | |
| 616 | − description: "Remove a stored local secret.", | |
| 617 | − inputSchema: removeSecretInputSchema, | |
| 618 | − outputSchema: Schema.standardSchemaV1(DeleteSecretResultSchema), | |
| 619 | − execute: ({ secretId }: { secretId: string }) => | |
| 620 | − input.executor.secrets.remove(secretId), | |
| 621 | − }, | |
| 622 | − metadata, | |
| 623 | − }), | |
| 624 | − "executor.sources.list": toTool({ | |
| 625 | − tool: { | |
| 626 | − description: "List sources connected in the current workspace.", | |
| 627 | − inputSchema: emptyInputSchema, | |
| 628 | − outputSchema: listSourcesOutputSchema, | |
| 629 | − execute: () => input.executor.sources.list(), | |
| 630 | − }, | |
| 631 | − metadata, | |
| 632 | − }), | |
| 633 | − "executor.sources.get": toTool({ | |
| 634 | − tool: { | |
| 635 | − description: "Get one source by id.", | |
| 636 | − inputSchema: getSourceInputSchema, | |
| 637 | − outputSchema: sourceOutputSchema, | |
| 638 | − execute: ({ sourceId }: { sourceId: string }) => | |
| 639 | − input.executor.sources.get(sourceId as never), | |
| 640 | − }, | |
| 641 | − metadata, | |
| 642 | − }), | |
| 643 | − "executor.sources.remove": toTool({ | |
| 644 | − tool: { | |
| 645 | − description: "Remove a source from the current workspace.", | |
| 646 | − inputSchema: getSourceInputSchema, | |
| 647 | − outputSchema: removeResultSchema, | |
| 648 | − execute: async ({ sourceId }: { sourceId: string }) => ({ | |
| 649 | − removed: await input.executor.sources.remove(sourceId as never), | |
| 650 | − }), | |
| 651 | − }, | |
| 652 | − metadata, | |
| 653 | − }), | |
| 654 | − "executor.sources.inspect.get": toTool({ | |
| 655 | − tool: { | |
| 656 | − description: "Inspect the tool model for one connected source.", | |
| 657 | − inputSchema: getSourceInputSchema, | |
| 658 | − outputSchema: sourceInspectionOutputSchema, | |
| 659 | − execute: ({ sourceId }: { sourceId: string }) => | |
| 660 | − input.executor.sources.inspection.get(sourceId as never), | |
| 661 | − }, | |
| 662 | − metadata, | |
| 663 | − }), | |
| 664 | − "executor.sources.inspect.tool": toTool({ | |
| 665 | − tool: { | |
| 666 | − description: "Inspect one tool inside a connected source.", | |
| 667 | − inputSchema: inspectToolInputSchema, | |
| 668 | − outputSchema: sourceInspectionToolOutputSchema, | |
| 669 | − execute: ({ | |
| 670 | − sourceId, | |
| 671 | − toolPath, | |
| 672 | − }: { | |
| 673 | − sourceId: string; | |
| 674 | − toolPath: string; | |
| 675 | − }) => | |
| 676 | − input.executor.sources.inspection.tool({ | |
| 677 | − sourceId: sourceId as never, | |
| 678 | − toolPath, | |
| 679 | − }), | |
| 680 | − }, | |
| 681 | − metadata, | |
| 682 | − }), | |
| 683 | − "executor.sources.inspect.discover": toTool({ | |
| 684 | − tool: { | |
| 685 | − description: "Search within a single source's inspected tools.", | |
| 686 | − inputSchema: inspectDiscoverInputSchema, | |
| 687 | − outputSchema: sourceInspectionDiscoverOutputSchema, | |
| 688 | − execute: ({ | |
| 689 | − sourceId, | |
| 690 | − payload, | |
| 691 | − }: { | |
| 692 | − sourceId: string; | |
| 693 | − payload: { query: string; limit?: number }; | |
| 694 | − }) => | |
| 695 | − input.executor.sources.inspection.discover({ | |
| 696 | − sourceId: sourceId as never, | |
| 697 | − payload: payload as never, | |
| 698 | − }), | |
| 699 | − }, | |
| 700 | − metadata, | |
| 701 | − }), | |
| 702 | − "executor.policies.list": toTool({ | |
| 703 | − tool: { | |
| 704 | − description: "List local workspace policies.", | |
| 705 | − inputSchema: emptyInputSchema, | |
| 706 | − outputSchema: listPoliciesOutputSchema, | |
| 707 | − execute: () => input.executor.policies.list(), | |
| 708 | − }, | |
| 709 | − metadata, | |
| 710 | − }), | |
| 711 | − "executor.policies.create": toTool({ | |
| 712 | − tool: { | |
| 713 | − description: "Create a local workspace policy.", | |
| 714 | − inputSchema: createPolicyInputSchema, | |
| 715 | − outputSchema: localScopePolicyOutputSchema, | |
| 716 | − execute: (payload: CreatePolicyPayload) => | |
| 717 | − input.executor.policies.create(payload), | |
| 718 | − }, | |
| 719 | − metadata, | |
| 720 | − }), | |
| 721 | − "executor.policies.get": toTool({ | |
| 722 | − tool: { | |
| 723 | − description: "Get one local workspace policy by id.", | |
| 724 | − inputSchema: policyIdInputSchema, | |
| 725 | − outputSchema: localScopePolicyOutputSchema, | |
| 726 | − execute: ({ policyId }: { policyId: string }) => | |
| 727 | − input.executor.policies.get(policyId), | |
| 728 | − }, | |
| 729 | − metadata, | |
| 730 | − }), | |
| 731 | − "executor.policies.update": toTool({ | |
| 732 | − tool: { | |
| 733 | − description: "Update a local workspace policy.", | |
| 734 | − inputSchema: updatePolicyInputSchema, | |
| 735 | − outputSchema: localScopePolicyOutputSchema, | |
| 736 | − execute: ({ | |
| 737 | − policyId, | |
| 738 | − payload, | |
| 739 | − }: { | |
| 740 | − policyId: string; | |
| 741 | − payload: UpdatePolicyPayload; | |
| 742 | − }) => input.executor.policies.update(policyId, payload), | |
| 743 | − }, | |
| 744 | − metadata, | |
| 745 | − }), | |
| 746 | − "executor.policies.remove": toTool({ | |
| 747 | − tool: { | |
| 748 | − description: "Remove a local workspace policy.", | |
| 749 | − inputSchema: policyIdInputSchema, | |
| 750 | − outputSchema: removeResultSchema, | |
| 751 | − execute: async ({ policyId }: { policyId: string }) => ({ | |
| 752 | − removed: await input.executor.policies.remove(policyId), | |
| 753 | − }), | |
| 754 | − }, | |
| 755 | − metadata, | |
| 756 | − }), | |
| 757 | − }; | |
| 758 | −}; | |
| @@ -313,7 +313,6 @@ export const createLocalExecutorRuntime = ( · 312 unmodified lines | ||
| 313 | 313 | ): Effect.Effect<ExecutorRuntime, Error> => |
| 314 | 314 | createLocalExecutorBackend(options).createRuntime({ |
| 315 | 315 | executionResolver: options.executionResolver, |
| 316 | − createInternalToolMap: options.createInternalToolMap, | |
| 317 | 316 | resolveSecretMaterial: options.resolveSecretMaterial, |
| 318 | 317 | getLocalServerBaseUrl: options.getLocalServerBaseUrl, |
| 319 | 318 | }); |
| @@ -336,7 +335,6 @@ export const createLocalExecutorEffect = < · 16 unmodified lines | ||
| 336 | 335 | backend: createLocalExecutorBackend(options), |
| 337 | 336 | plugins: options.plugins, |
| 338 | 337 | executionResolver: options.executionResolver, |
| 339 | − createInternalToolMap: options.createInternalToolMap, | |
| 340 | 338 | resolveSecretMaterial: options.resolveSecretMaterial, |
| 341 | 339 | getLocalServerBaseUrl: options.getLocalServerBaseUrl, |
| 342 | 340 | } satisfies CreateExecutorEffectOptions & { plugins?: TPlugins }); |
| @@ -350,7 +348,6 @@ export const createLocalExecutor = < · 7 unmodified lines | ||
| 350 | 348 | backend: createLocalExecutorBackend(options), |
| 351 | 349 | plugins: options.plugins, |
| 352 | 350 | executionResolver: options.executionResolver, |
| 353 | − createInternalToolMap: options.createInternalToolMap, | |
| 354 | 351 | resolveSecretMaterial: options.resolveSecretMaterial, |
| 355 | 352 | getLocalServerBaseUrl: options.getLocalServerBaseUrl, |
| 356 | 353 | }); |
| @@ -58,7 +58,6 @@ import { · 57 unmodified lines | ||
| 58 | 58 | import type { ExecutorBackend } from "./backend"; |
| 59 | 59 | import { |
| 60 | 60 | provideExecutorRuntime, |
| 61 | − type CreateScopeInternalToolMap, | |
| 62 | 61 | type ExecutorRuntime, |
| 63 | 62 | type ExecutorRuntimeOptions, |
| 64 | 63 | type ResolveExecutionEnvironment, |
| @@ -271,7 +270,6 @@ export const createExecutorEffect = < · 206 unmodified lines | ||
| 271 | 270 | return Effect.map( |
| 272 | 271 | options.backend.createRuntime({ |
| 273 | 272 | executionResolver: options.executionResolver, |
| 274 | − createInternalToolMap: options.createInternalToolMap, | |
| 275 | 273 | resolveSecretMaterial: options.resolveSecretMaterial, |
| 276 | 274 | getLocalServerBaseUrl: options.getLocalServerBaseUrl, |
| 277 | 275 | }), |
| @@ -26,12 +26,6 @@ import { · 25 unmodified lines | ||
| 26 | 26 | import { |
| 27 | 27 | getRuntimeLocalScopeOption, |
| 28 | 28 | } from "../../scope/runtime-context"; |
| 29 | −import { | |
| 30 | − LocalInstanceConfigService, | |
| 31 | − SecretMaterialDeleterService, | |
| 32 | − SecretMaterialStorerService, | |
| 33 | − SecretMaterialUpdaterService, | |
| 34 | −} from "../../scope/secret-material-providers"; | |
| 35 | 29 | import { |
| 36 | 30 | LocalToolRuntimeLoaderService, |
| 37 | 31 | type LocalToolRuntimeLoaderShape, |
| @@ -53,9 +47,6 @@ import { · 15 unmodified lines | ||
| 53 | 47 | import { |
| 54 | 48 | RuntimeSourceStoreService, |
| 55 | 49 | } from "../../sources/source-store"; |
| 56 | −import type { | |
| 57 | − CreateScopeInternalToolMap, | |
| 58 | −} from "./tool-invoker"; | |
| 59 | 50 | export { |
| 60 | 51 | createCodeExecutorForRuntime, |
| 61 | 52 | resolveConfiguredExecutionRuntime, |
| @@ -80,14 +71,9 @@ export const createScopeExecutionEnvironmentResolver = · 18 unmodified lines | ||
| 80 | 71 | >; |
| 81 | 72 | localToolRuntimeLoader: LocalToolRuntimeLoaderShape; |
| 82 | 73 | installationStore: InstallationStoreShape; |
| 83 | − instanceConfigResolver: Effect.Effect.Success<typeof LocalInstanceConfigService>; | |
| 84 | − storeSecretMaterial: Effect.Effect.Success<typeof SecretMaterialStorerService>; | |
| 85 | − deleteSecretMaterial: Effect.Effect.Success<typeof SecretMaterialDeleterService>; | |
| 86 | − updateSecretMaterial: Effect.Effect.Success<typeof SecretMaterialUpdaterService>; | |
| 87 | 74 | scopeConfigStore: ScopeConfigStoreShape; |
| 88 | 75 | scopeStateStore: ScopeStateStoreShape; |
| 89 | 76 | sourceArtifactStore: SourceArtifactStoreShape; |
| 90 | − createInternalToolMap?: CreateScopeInternalToolMap; | |
| 91 | 77 | }): ResolveExecutionEnvironment => |
| 92 | 78 | ({ scopeId, actorScopeId, onElicitation }) => |
| 93 | 79 | Effect.gen(function* () { |
| @@ -108,16 +94,11 @@ export const createScopeExecutionEnvironmentResolver = · 14 unmodified lines | ||
| 108 | 94 | sourceCatalogSyncService: input.sourceCatalogSyncService, |
| 109 | 95 | sourceCatalogStore: input.sourceCatalogStore, |
| 110 | 96 | installationStore: input.installationStore, |
| 111 | − instanceConfigResolver: input.instanceConfigResolver, | |
| 112 | − storeSecretMaterial: input.storeSecretMaterial, | |
| 113 | − deleteSecretMaterial: input.deleteSecretMaterial, | |
| 114 | − updateSecretMaterial: input.updateSecretMaterial, | |
| 115 | 97 | scopeConfigStore: input.scopeConfigStore, |
| 116 | 98 | scopeStateStore: input.scopeStateStore, |
| 117 | 99 | sourceArtifactStore: input.sourceArtifactStore, |
| 118 | 100 | runtimeLocalScope, |
| 119 | 101 | localToolRuntime, |
| 120 | − createInternalToolMap: input.createInternalToolMap, | |
| 121 | 102 | onElicitation, |
| 122 | 103 | }); |
| 123 | 104 | |
| @@ -142,7 +123,6 @@ export class RuntimeExecutionResolverService extends Context.Tag( · 18 unmodified lines | ||
| 142 | 123 | export const RuntimeExecutionResolverLive = ( |
| 143 | 124 | input: { |
| 144 | 125 | executionResolver?: ResolveExecutionEnvironment; |
| 145 | − createInternalToolMap?: CreateScopeInternalToolMap; | |
| 146 | 126 | } = {}, |
| 147 | 127 | ) => |
| 148 | 128 | input.executionResolver |
| @@ -157,10 +137,6 @@ export const RuntimeExecutionResolverLive = ( · 8 unmodified lines | ||
| 157 | 137 | const sourceCatalogStore = yield* RuntimeSourceCatalogStoreService; |
| 158 | 138 | const localToolRuntimeLoader = yield* LocalToolRuntimeLoaderService; |
| 159 | 139 | const installationStore = yield* InstallationStore; |
| 160 | − const instanceConfigResolver = yield* LocalInstanceConfigService; | |
| 161 | − const storeSecretMaterial = yield* SecretMaterialStorerService; | |
| 162 | − const deleteSecretMaterial = yield* SecretMaterialDeleterService; | |
| 163 | − const updateSecretMaterial = yield* SecretMaterialUpdaterService; | |
| 164 | 140 | const scopeConfigStore = yield* ScopeConfigStore; |
| 165 | 141 | const scopeStateStore = yield* ScopeStateStore; |
| 166 | 142 | const sourceArtifactStore = yield* SourceArtifactStore; |
| @@ -172,14 +148,9 @@ export const RuntimeExecutionResolverLive = ( · 5 unmodified lines | ||
| 172 | 148 | sourceCatalogStore, |
| 173 | 149 | localToolRuntimeLoader, |
| 174 | 150 | installationStore, |
| 175 | − instanceConfigResolver, | |
| 176 | − storeSecretMaterial, | |
| 177 | − deleteSecretMaterial, | |
| 178 | − updateSecretMaterial, | |
| 179 | 151 | scopeConfigStore, |
| 180 | 152 | scopeStateStore, |
| 181 | 153 | sourceArtifactStore, |
| 182 | − createInternalToolMap: input.createInternalToolMap, | |
| 183 | 154 | }); |
| 184 | 155 | }), |
| 185 | 156 | ); |
| @@ -30,12 +30,6 @@ import { · 29 unmodified lines | ||
| 30 | 30 | type ScopeConfigStoreShape, |
| 31 | 31 | type ScopeStateStoreShape, |
| 32 | 32 | } from "../../scope/storage"; |
| 33 | −import type { | |
| 34 | − DeleteSecretMaterial, | |
| 35 | − ResolveInstanceConfig, | |
| 36 | − StoreSecretMaterial, | |
| 37 | − UpdateSecretMaterial, | |
| 38 | −} from "../../scope/secret-material-providers"; | |
| 39 | 33 | import type { |
| 40 | 34 | ExecutorStateStoreShape, |
| 41 | 35 | } from "../../executor-state-store"; |
| @@ -66,29 +60,6 @@ import { · 24 unmodified lines | ||
| 66 | 60 | runtimeEffectError, |
| 67 | 61 | } from "../../effect-errors"; |
| 68 | 62 | |
| 69 | −export type ScopeInternalToolContext = { | |
| 70 | − scopeId: Source["scopeId"]; | |
| 71 | − actorScopeId: ScopeId; | |
| 72 | − executorStateStore: ExecutorStateStoreShape; | |
| 73 | − sourceStore: RuntimeSourceStore; | |
| 74 | − sourceCatalogSyncService: Effect.Effect.Success< | |
| 75 | − typeof RuntimeSourceCatalogSyncService | |
| 76 | − >; | |
| 77 | − installationStore: InstallationStoreShape; | |
| 78 | − instanceConfigResolver: ResolveInstanceConfig; | |
| 79 | − storeSecretMaterial: StoreSecretMaterial; | |
| 80 | − deleteSecretMaterial: DeleteSecretMaterial; | |
| 81 | − updateSecretMaterial: UpdateSecretMaterial; | |
| 82 | − scopeConfigStore: ScopeConfigStoreShape; | |
| 83 | − scopeStateStore: ScopeStateStoreShape; | |
| 84 | − sourceArtifactStore: SourceArtifactStoreShape; | |
| 85 | − runtimeLocalScope: RuntimeLocalScopeState | null; | |
| 86 | −}; | |
| 87 | − | |
| 88 | −export type CreateScopeInternalToolMap = ( | |
| 89 | − input: ScopeInternalToolContext, | |
| 90 | −) => ToolMap; | |
| 91 | − | |
| 92 | 63 | export const createScopeToolInvoker = (input: { |
| 93 | 64 | scopeId: Source["scopeId"]; |
| 94 | 65 | actorScopeId: ScopeId; |
| @@ -101,16 +72,11 @@ export const createScopeToolInvoker = (input: { · 6 unmodified lines | ||
| 101 | 72 | typeof RuntimeSourceCatalogStoreService |
| 102 | 73 | >; |
| 103 | 74 | installationStore: InstallationStoreShape; |
| 104 | − instanceConfigResolver: ResolveInstanceConfig; | |
| 105 | − storeSecretMaterial: StoreSecretMaterial; | |
| 106 | − deleteSecretMaterial: DeleteSecretMaterial; | |
| 107 | − updateSecretMaterial: UpdateSecretMaterial; | |
| 108 | 75 | scopeConfigStore: ScopeConfigStoreShape; |
| 109 | 76 | scopeStateStore: ScopeStateStoreShape; |
| 110 | 77 | sourceArtifactStore: SourceArtifactStoreShape; |
| 111 | 78 | runtimeLocalScope: RuntimeLocalScopeState | null; |
| 112 | 79 | localToolRuntime: LocalToolRuntime; |
| 113 | − createInternalToolMap?: CreateScopeInternalToolMap; | |
| 114 | 80 | onElicitation?: Parameters< |
| 115 | 81 | typeof makeToolInvokerFromTools |
| 116 | 82 | >[0]["onElicitation"]; |
| @@ -138,23 +104,6 @@ export const createScopeToolInvoker = (input: { · 21 unmodified lines | ||
| 138 | 104 | sourceArtifactStore: input.sourceArtifactStore, |
| 139 | 105 | runtimeLocalScope: input.runtimeLocalScope, |
| 140 | 106 | }); |
| 141 | − const internalTools = | |
| 142 | − input.createInternalToolMap?.({ | |
| 143 | − scopeId: input.scopeId, | |
| 144 | − actorScopeId: input.actorScopeId, | |
| 145 | − executorStateStore: input.executorStateStore, | |
| 146 | − sourceStore: input.sourceStore, | |
| 147 | − sourceCatalogSyncService: input.sourceCatalogSyncService, | |
| 148 | − installationStore: input.installationStore, | |
| 149 | − instanceConfigResolver: input.instanceConfigResolver, | |
| 150 | − storeSecretMaterial: input.storeSecretMaterial, | |
| 151 | − deleteSecretMaterial: input.deleteSecretMaterial, | |
| 152 | − updateSecretMaterial: input.updateSecretMaterial, | |
| 153 | − scopeConfigStore: input.scopeConfigStore, | |
| 154 | − scopeStateStore: input.scopeStateStore, | |
| 155 | − sourceArtifactStore: input.sourceArtifactStore, | |
| 156 | − runtimeLocalScope: input.runtimeLocalScope, | |
| 157 | − }) ?? {}; | |
| 158 | 107 | const sourceCatalog = createScopeSourceCatalog({ |
| 159 | 108 | scopeId: input.scopeId, |
| 160 | 109 | actorScopeId: input.actorScopeId, |
| @@ -177,7 +126,6 @@ export const createScopeToolInvoker = (input: { · 16 unmodified lines | ||
| 177 | 126 | const authoredTools = mergeToolMaps([ |
| 178 | 127 | systemTools, |
| 179 | 128 | executorTools, |
| 180 | − internalTools, | |
| 181 | 129 | input.localToolRuntime.tools, |
| 182 | 130 | ]); |
| 183 | 131 | const authoredCatalog = createToolCatalogFromTools({ |
| @@ -31,10 +31,6 @@ import { · 30 unmodified lines | ||
| 31 | 31 | import { |
| 32 | 32 | RuntimeExecutionResolverLive, |
| 33 | 33 | } from "./execution/scope/environment"; |
| 34 | −import type { | |
| 35 | − CreateScopeInternalToolMap, | |
| 36 | − ScopeInternalToolContext, | |
| 37 | −} from "./execution/scope/tool-invoker"; | |
| 38 | 34 | import type { |
| 39 | 35 | LoadedLocalExecutorConfig, |
| 40 | 36 | } from "./scope-config"; |
| @@ -104,10 +100,6 @@ export * from "./executor-state-store"; · 63 unmodified lines | ||
| 104 | 100 | export * from "./execution/scope/environment"; |
| 105 | 101 | export * from "../sources/inspection"; |
| 106 | 102 | export * from "./execution/service"; |
| 107 | −export type { | |
| 108 | − CreateScopeInternalToolMap, | |
| 109 | − ScopeInternalToolContext, | |
| 110 | −} from "./execution/scope/tool-invoker"; | |
| 111 | 103 | export { |
| 112 | 104 | LocalInstanceConfigService, |
| 113 | 105 | SecretMaterialDeleterService, |
| @@ -133,7 +125,6 @@ export { · 19 unmodified lines | ||
| 133 | 125 | |
| 134 | 126 | export type ExecutorRuntimeOptions = { |
| 135 | 127 | executionResolver?: ResolveExecutionEnvironment; |
| 136 | − createInternalToolMap?: CreateScopeInternalToolMap; | |
| 137 | 128 | resolveSecretMaterial?: ResolveSecretMaterial; |
| 138 | 129 | getLocalServerBaseUrl?: () => string | undefined; |
| 139 | 130 | }; |
| @@ -362,7 +353,6 @@ export const createExecutorRuntimeLayer = ( · 222 unmodified lines | ||
| 362 | 353 | |
| 363 | 354 | const executionResolverLayer = RuntimeExecutionResolverLive({ |
| 364 | 355 | executionResolver: input.executionResolver, |
| 365 | − createInternalToolMap: input.createInternalToolMap, | |
| 366 | 356 | }).pipe( |
| 367 | 357 | Layer.provide( |
| 368 | 358 | Layer.mergeAll( |
| @@ -3,26 +3,17 @@ import { · 2 unmodified lines | ||
| 3 | 3 | type ExecutorSdkPlugin, |
| 4 | 4 | } from "../../../plugins"; |
| 5 | 5 | |
| 6 | −import { | |
| 7 | − InternalSourceSdkPlugin, | |
| 8 | −} from "./internal"; | |
| 9 | − | |
| 10 | −let configuredExternalSourcePlugins: readonly ExecutorSdkPlugin[] = []; | |
| 11 | −let registry = registerExecutorSdkPlugins([ | |
| 12 | − InternalSourceSdkPlugin, | |
| 13 | −]); | |
| 6 | +let configuredSourcePlugins: readonly ExecutorSdkPlugin[] = []; | |
| 7 | +let registry = registerExecutorSdkPlugins(configuredSourcePlugins); | |
| 14 | 8 | |
| 15 | 9 | const refreshRegistry = () => { |
| 16 | − registry = registerExecutorSdkPlugins([ | |
| 17 | − ...configuredExternalSourcePlugins, | |
| 18 | − InternalSourceSdkPlugin, | |
| 19 | − ]); | |
| 10 | + registry = registerExecutorSdkPlugins(configuredSourcePlugins); | |
| 20 | 11 | }; |
| 21 | 12 | |
| 22 | 13 | export const configureExecutorSourcePlugins = ( |
| 23 | 14 | plugins: readonly ExecutorSdkPlugin[], |
| 24 | 15 | ): void => { |
| 25 | − configuredExternalSourcePlugins = plugins; | |
| 16 | + configuredSourcePlugins = plugins; | |
| 26 | 17 | refreshRegistry(); |
| 27 | 18 | }; |
| 28 | 19 | |
| @@ -39,4 +30,4 @@ export const isInternalSourcePluginKind = (kind: string) => · 10 unmodified lines | ||
| 39 | 30 | registry.isInternalSourcePluginKind(kind); |
| 40 | 31 | |
| 41 | 32 | export const hasRegisteredExternalSourcePlugins = () => |
| 42 | − configuredExternalSourcePlugins.length > 0; | |
| 33 | + configuredSourcePlugins.length > 0; | |
| @@ -15,6 +15,7 @@ · 14 unmodified lines | ||
| 15 | 15 | "@effect/platform": "catalog:", |
| 16 | 16 | "@effect/platform-node": "catalog:", |
| 17 | 17 | "@executor/executor-mcp": "workspace:*", |
| 18 | + "@executor/plugin-internal-sdk": "workspace:*", | |
| 18 | 19 | "@executor/plugin-google-discovery-http": "workspace:*", |
| 19 | 20 | "@executor/plugin-google-discovery-shared": "workspace:*", |
| 20 | 21 | "@executor/plugin-google-discovery-sdk": "workspace:*", |
| @@ -28,7 +29,6 @@ · 7 unmodified lines | ||
| 28 | 29 | "@executor/plugin-openapi-shared": "workspace:*", |
| 29 | 30 | "@executor/plugin-openapi-sdk": "workspace:*", |
| 30 | 31 | "@executor/platform-api": "workspace:*", |
| 31 | − "@executor/platform-internal": "workspace:*", | |
| 32 | 32 | "@executor/platform-sdk": "workspace:*", |
| 33 | 33 | "@executor/platform-sdk-file": "workspace:*", |
| 34 | 34 | "@opentelemetry/api": "^1.9.0", |
| @@ -8,6 +8,7 @@ import { dirname, extname, resolve } from "node:path"; · 7 unmodified lines | ||
| 8 | 8 | import { Readable } from "node:stream"; |
| 9 | 9 | import { FileSystem, HttpApiBuilder, HttpServer } from "@effect/platform"; |
| 10 | 10 | import { NodeFileSystem } from "@effect/platform-node"; |
| 11 | +import { internalSdkPlugin } from "@executor/plugin-internal-sdk"; | |
| 11 | 12 | import { googleDiscoveryHttpPlugin } from "@executor/plugin-google-discovery-http"; |
| 12 | 13 | import { googleDiscoverySdkPlugin } from "@executor/plugin-google-discovery-sdk"; |
| 13 | 14 | import { graphqlHttpPlugin } from "@executor/plugin-graphql-http"; |
| @@ -22,7 +23,6 @@ import { · 8 unmodified lines | ||
| 22 | 23 | createExecutorApiLayer, |
| 23 | 24 | } from "@executor/platform-api/http"; |
| 24 | 25 | import { createExecutorMcpRequestHandler } from "@executor/executor-mcp"; |
| 25 | −import { createWorkspaceExecutorAdminToolMap } from "@executor/platform-internal"; | |
| 26 | 26 | import { |
| 27 | 27 | createExecutorEffect, |
| 28 | 28 | type ExecutorEffect as Executor, |
| @@ -155,6 +155,7 @@ const createExecutorRuntime = ( · 126 unmodified lines | ||
| 155 | 155 | localDataDir, |
| 156 | 156 | }), |
| 157 | 157 | plugins: [ |
| 158 | + internalSdkPlugin(), | |
| 158 | 159 | graphqlSdkPlugin({ |
| 159 | 160 | storage: createFileGraphqlSourceStorage({ |
| 160 | 161 | rootDir: resolve(localDataDir, "plugins", "graphql", "sources"), |
| @@ -183,7 +184,6 @@ const createExecutorRuntime = ( · 22 unmodified lines | ||
| 183 | 184 | }), |
| 184 | 185 | ] as const, |
| 185 | 186 | executionResolver: options.executionResolver, |
| 186 | − createInternalToolMap: createWorkspaceExecutorAdminToolMap, | |
| 187 | 187 | resolveSecretMaterial: options.resolveSecretMaterial, |
| 188 | 188 | getLocalServerBaseUrl, |
| 189 | 189 | }).pipe( |
| @@ -4,11 +4,9 @@ import { · 3 unmodified lines | ||
| 4 | 4 | createCatalogImportMetadata, |
| 5 | 5 | createSourceCatalogSyncResult, |
| 6 | 6 | } from "@executor/source-core"; |
| 7 | −import type { ExecutorSdkPlugin } from "../../../plugins"; | |
| 7 | +import type { ExecutorSdkPlugin } from "@executor/platform-sdk/plugins"; | |
| 8 | 8 | |
| 9 | −import { runtimeEffectError } from "../../effect-errors"; | |
| 10 | − | |
| 11 | −export const InternalSourceSdkPlugin = { | |
| 9 | +export const internalSdkPlugin = (): ExecutorSdkPlugin<"internal"> => ({ | |
| 12 | 10 | key: "internal", |
| 13 | 11 | sources: [ |
| 14 | 12 | { |
| @@ -38,11 +36,8 @@ export const InternalSourceSdkPlugin = { · 23 unmodified lines | ||
| 38 | 36 | ), |
| 39 | 37 | invoke: () => |
| 40 | 38 | Effect.fail( |
| 41 | − runtimeEffectError( | |
| 42 | − "sources/source-plugins/internal", | |
| 43 | − "Internal sources do not support persisted plugin invocation", | |
| 44 | − ), | |
| 39 | + new Error("Internal sources do not support persisted plugin invocation"), | |
| 45 | 40 | ), |
| 46 | 41 | }, |
| 47 | 42 | ], |
| 48 | −} satisfies ExecutorSdkPlugin<"internal">; | |
| 43 | +}); | |
| @@ -1,22 +1,24 @@ | ||
| 1 | 1 | { |
| 2 | − "name": "@executor/platform-internal", | |
| 2 | + "name": "@executor/plugin-internal-sdk", | |
| 3 | 3 | "private": true, |
| 4 | 4 | "type": "module", |
| 5 | 5 | "exports": { |
| 6 | − ".": "./src/index.ts" | |
| 6 | + ".": "./index.ts" | |
| 7 | 7 | }, |
| 8 | + "files": [ | |
| 9 | + "*.ts" | |
| 10 | + ], | |
| 8 | 11 | "scripts": { |
| 9 | 12 | "typecheck": "bunx tsc --noEmit -p tsconfig.json" |
| 10 | 13 | }, |
| 11 | 14 | "dependencies": { |
| 12 | − "@executor/codemode-core": "workspace:*", | |
| 13 | 15 | "@executor/platform-sdk": "workspace:*", |
| 16 | + "@executor/source-core": "workspace:*", | |
| 14 | 17 | "effect": "catalog:" |
| 15 | 18 | }, |
| 16 | 19 | "devDependencies": { |
| 17 | 20 | "@types/node": "catalog:", |
| 18 | − "bun-types": "catalog:", | |
| 19 | − "typescript": "^5.9.3" | |
| 21 | + "bun-types": "catalog:" | |
| 20 | 22 | }, |
| 21 | 23 | "version": "0.0.0" |
| 22 | 24 | } |
| @@ -6,8 +6,8 @@ · 5 unmodified lines | ||
| 6 | 6 | "strict": true, |
| 7 | 7 | "skipLibCheck": true, |
| 8 | 8 | "noEmit": true, |
| 9 | − "lib": ["ES2022"], | |
| 9 | + "lib": ["ES2022", "DOM"], | |
| 10 | 10 | "types": ["bun-types", "node"] |
| 11 | 11 | }, |
| 12 | − "include": ["src/**/*.ts"] | |
| 12 | + "include": ["*.ts"] | |
| 13 | 13 | } |