History

disable admin tools

Rhys Sullivan committed 7 months ago

Commit f2797e51 parent f2a7b1116 files · +43 −909Browse files

Unified · Split

16 files
  1. apps/executor/package.json +1 −1
  2. apps/executor/src/cli/main.ts +4 −2
  3. bun.lock +17 −18
  4. packages/platform/internal/src/index.ts +0 −1
  5. packages/platform/internal/src/tools/executor-admin.ts +0 −758
  6. packages/platform/sdk-file/src/index.ts +0 −3
  7. packages/platform/sdk/src/executor-effect.ts +0 −2
  8. packages/platform/sdk/src/runtime/execution/scope/environment.ts +0 −29
  9. packages/platform/sdk/src/runtime/execution/scope/tool-invoker.ts +0 −52
  10. packages/platform/sdk/src/runtime/index.ts +0 −10
  11. packages/platform/sdk/src/runtime/sources/source-plugins/index.ts +5 −14
  12. packages/platform/server/package.json +1 −1
  13. packages/platform/server/src/index.ts +2 −2
  14. plugins/internal/sdk/index.ts +4 −9
  15. plugins/internal/sdk/package.json +7 −5
  16. plugins/internal/sdk/tsconfig.json +2 −2
apps/executor/package.json+1−1
@@ -40,10 +40,10 @@ · 39 unmodified lines
40 "@executor/executor-mcp": "workspace:*",40 "@executor/executor-mcp": "workspace:*",
41 "@executor/plugin-google-discovery-sdk": "workspace:*",41 "@executor/plugin-google-discovery-sdk": "workspace:*",
42 "@executor/plugin-graphql-sdk": "workspace:*",42 "@executor/plugin-graphql-sdk": "workspace:*",
43 "@executor/plugin-internal-sdk": "workspace:*",
43 "@executor/plugin-mcp-sdk": "workspace:*",44 "@executor/plugin-mcp-sdk": "workspace:*",
44 "@executor/plugin-openapi-sdk": "workspace:*",45 "@executor/plugin-openapi-sdk": "workspace:*",
45 "@executor/platform-api": "workspace:*",46 "@executor/platform-api": "workspace:*",
46 "@executor/platform-internal": "workspace:*",
47 "@executor/platform-sdk": "workspace:*",47 "@executor/platform-sdk": "workspace:*",
48 "@executor/platform-sdk-file": "workspace:*",48 "@executor/platform-sdk-file": "workspace:*",
49 "@executor/server": "workspace:*",49 "@executor/server": "workspace:*",
apps/executor/src/cli/main.ts+4−2
@@ -20,13 +20,15 @@ import { · 19 unmodified lines
20import {20import {
21 graphqlSdkPlugin,21 graphqlSdkPlugin,
22} from "@executor/plugin-graphql-sdk";22} from "@executor/plugin-graphql-sdk";
23import {
24 internalSdkPlugin,
25} from "@executor/plugin-internal-sdk";
23import {26import {
24 mcpSdkPlugin,27 mcpSdkPlugin,
25} from "@executor/plugin-mcp-sdk";28} from "@executor/plugin-mcp-sdk";
26import {29import {
27 openApiSdkPlugin,30 openApiSdkPlugin,
28} from "@executor/plugin-openapi-sdk";31} from "@executor/plugin-openapi-sdk";
29import { createWorkspaceExecutorAdminToolMap } from "@executor/platform-internal";
30import {32import {
31 getExecutorSourcesAddHelpLines,33 getExecutorSourcesAddHelpLines,
32 RuntimeExecutionResolverService,34 RuntimeExecutionResolverService,
@@ -303,6 +305,7 @@ const loadRunWorkflowText = (): Effect.Effect<string, Error, never> => · 270 unmodified lines
303 localDataDir: DEFAULT_LOCAL_DATA_DIR,305 localDataDir: DEFAULT_LOCAL_DATA_DIR,
304 }),306 }),
305 plugins: [307 plugins: [
308 internalSdkPlugin(),
306 graphqlSdkPlugin({309 graphqlSdkPlugin({
307 storage: createFileGraphqlSourceStorage({310 storage: createFileGraphqlSourceStorage({
308 rootDir: `${DEFAULT_LOCAL_DATA_DIR}/plugins/graphql/sources`,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 ] as const,335 ] as const,
333 createInternalToolMap: createWorkspaceExecutorAdminToolMap,
334 }).pipe(Effect.mapError(toError)),336 }).pipe(Effect.mapError(toError)),
335 (executor) =>337 (executor) =>
336 Effect.gen(function* () {338 Effect.gen(function* () {
bun.lock+17−18
@@ -29,11 +29,11 @@ · 28 unmodified lines
29 "@executor/codemode-core": "workspace:*",29 "@executor/codemode-core": "workspace:*",
30 "@executor/executor-mcp": "workspace:*",30 "@executor/executor-mcp": "workspace:*",
31 "@executor/platform-api": "workspace:*",31 "@executor/platform-api": "workspace:*",
32 "@executor/platform-internal": "workspace:*",
33 "@executor/platform-sdk": "workspace:*",32 "@executor/platform-sdk": "workspace:*",
34 "@executor/platform-sdk-file": "workspace:*",33 "@executor/platform-sdk-file": "workspace:*",
35 "@executor/plugin-google-discovery-sdk": "workspace:*",34 "@executor/plugin-google-discovery-sdk": "workspace:*",
36 "@executor/plugin-graphql-sdk": "workspace:*",35 "@executor/plugin-graphql-sdk": "workspace:*",
36 "@executor/plugin-internal-sdk": "workspace:*",
37 "@executor/plugin-mcp-sdk": "workspace:*",37 "@executor/plugin-mcp-sdk": "workspace:*",
38 "@executor/plugin-openapi-sdk": "workspace:*",38 "@executor/plugin-openapi-sdk": "workspace:*",
39 "@executor/server": "workspace:*",39 "@executor/server": "workspace:*",
@@ -308,20 +308,6 @@ · 268 unmodified lines
308 "vitest": "catalog:",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 "packages/platform/sdk": {311 "packages/platform/sdk": {
326 "name": "@executor/platform-sdk",312 "name": "@executor/platform-sdk",
327 "version": "0.0.0",313 "version": "0.0.0",
@@ -379,7 +365,6 @@ · 51 unmodified lines
379 "@effect/platform-node": "catalog:",365 "@effect/platform-node": "catalog:",
380 "@executor/executor-mcp": "workspace:*",366 "@executor/executor-mcp": "workspace:*",
381 "@executor/platform-api": "workspace:*",367 "@executor/platform-api": "workspace:*",
382 "@executor/platform-internal": "workspace:*",
383 "@executor/platform-sdk": "workspace:*",368 "@executor/platform-sdk": "workspace:*",
384 "@executor/platform-sdk-file": "workspace:*",369 "@executor/platform-sdk-file": "workspace:*",
385 "@executor/plugin-google-discovery-http": "workspace:*",370 "@executor/plugin-google-discovery-http": "workspace:*",
@@ -388,6 +373,7 @@ · 2 unmodified lines
388 "@executor/plugin-graphql-http": "workspace:*",373 "@executor/plugin-graphql-http": "workspace:*",
389 "@executor/plugin-graphql-sdk": "workspace:*",374 "@executor/plugin-graphql-sdk": "workspace:*",
390 "@executor/plugin-graphql-shared": "workspace:*",375 "@executor/plugin-graphql-shared": "workspace:*",
376 "@executor/plugin-internal-sdk": "workspace:*",
391 "@executor/plugin-mcp-http": "workspace:*",377 "@executor/plugin-mcp-http": "workspace:*",
392 "@executor/plugin-mcp-sdk": "workspace:*",378 "@executor/plugin-mcp-sdk": "workspace:*",
393 "@executor/plugin-mcp-shared": "workspace:*",379 "@executor/plugin-mcp-shared": "workspace:*",
@@ -541,6 +527,19 @@ · 147 unmodified lines
541 "bun-types": "catalog:",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 "plugins/mcp/http": {543 "plugins/mcp/http": {
545 "name": "@executor/plugin-mcp-http",544 "name": "@executor/plugin-mcp-http",
546 "version": "0.0.0",545 "version": "0.0.0",
@@ -886,8 +885,6 @@ · 339 unmodified lines
886 885
887 "@executor/platform-api": ["@executor/platform-api@workspace:packages/platform/api"],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 "@executor/platform-sdk": ["@executor/platform-sdk@workspace:packages/platform/sdk"],888 "@executor/platform-sdk": ["@executor/platform-sdk@workspace:packages/platform/sdk"],
892 889
893 "@executor/platform-sdk-file": ["@executor/platform-sdk-file@workspace:packages/platform/sdk-file"],890 "@executor/platform-sdk-file": ["@executor/platform-sdk-file@workspace:packages/platform/sdk-file"],
@@ -908,6 +905,8 @@ · 14 unmodified lines
908 905
909 "@executor/plugin-graphql-shared": ["@executor/plugin-graphql-shared@workspace:plugins/graphql/shared"],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 "@executor/plugin-mcp-http": ["@executor/plugin-mcp-http@workspace:plugins/mcp/http"],910 "@executor/plugin-mcp-http": ["@executor/plugin-mcp-http@workspace:plugins/mcp/http"],
912 911
913 "@executor/plugin-mcp-react": ["@executor/plugin-mcp-react@workspace:plugins/mcp/react"],912 "@executor/plugin-mcp-react": ["@executor/plugin-mcp-react@workspace:plugins/mcp/react"],
packages/platform/internal/src/index.ts+0−1
@@ -1 +0,0 @@
1export * from "./tools/executor-admin";
packages/platform/internal/src/tools/executor-admin.ts+0−758
@@ -1,758 +0,0 @@
1import { toTool, type ToolMap } from "@executor/codemode-core";
2import type { Executor } from "@executor/platform-sdk";
3import {
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";
15import * as Effect from "effect/Effect";
16import * as Layer from "effect/Layer";
17import * as Schema from "effect/Schema";
18
19import {
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";
31import {
32 type RuntimeLocalScopeState,
33 provideOptionalRuntimeLocalScope,
34} from "../../../sdk/src/runtime/scope/runtime-context";
35import {
36 SourceArtifactStore,
37 type SourceArtifactStoreShape,
38 ScopeConfigStore,
39 type ScopeConfigStoreShape,
40 ScopeStateStore,
41 type ScopeStateStoreShape,
42 makeScopeStorageLayer,
43} from "../../../sdk/src/runtime/scope/storage";
44import {
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";
55import {
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";
72import {
73 CreatePolicyPayloadSchema,
74 type CreatePolicyPayload,
75 type UpdatePolicyPayload,
76 UpdatePolicyPayloadSchema,
77} from "@executor/platform-sdk/contracts";
78const emptyInputSchema = Schema.standardSchemaV1(Schema.Struct({}));
79const localInstallationOutputSchema = Schema.standardSchemaV1(
80 LocalInstallationSchema,
81);
82const instanceConfigOutputSchema =
83 Schema.standardSchemaV1(InstanceConfigSchema);
84const secretListOutputSchema = Schema.standardSchemaV1(
85 Schema.Array(SecretListItemSchema),
86);
87const createSecretInputSchema = Schema.standardSchemaV1(
88 CreateSecretPayloadSchema,
89);
90const updateSecretInputSchema = Schema.standardSchemaV1(
91 Schema.Struct({
92 secretId: Schema.String,
93 payload: UpdateSecretPayloadSchema,
94 }),
95);
96const removeSecretInputSchema = Schema.standardSchemaV1(
97 Schema.Struct({
98 secretId: Schema.String,
99 }),
100);
101const removeResultSchema = Schema.standardSchemaV1(
102 Schema.Struct({
103 removed: Schema.Boolean,
104 }),
105);
106const listSourcesOutputSchema = Schema.standardSchemaV1(
107 Schema.Array(SourceSchema),
108);
109const getSourceInputSchema = Schema.standardSchemaV1(
110 Schema.Struct({
111 sourceId: SourceIdSchema,
112 }),
113);
114const inspectToolInputSchema = Schema.standardSchemaV1(
115 Schema.Struct({
116 sourceId: SourceIdSchema,
117 toolPath: Schema.String,
118 }),
119);
120const inspectDiscoverInputSchema = Schema.standardSchemaV1(
121 Schema.Struct({
122 sourceId: SourceIdSchema,
123 payload: SourceInspectionDiscoverPayloadSchema,
124 }),
125);
126const listPoliciesOutputSchema = Schema.standardSchemaV1(
127 Schema.Array(LocalScopePolicySchema),
128);
129const policyIdInputSchema = Schema.standardSchemaV1(
130 Schema.Struct({
131 policyId: Schema.String,
132 }),
133);
134const createPolicyInputSchema = Schema.standardSchemaV1(
135 CreatePolicyPayloadSchema,
136);
137const updatePolicyInputSchema = Schema.standardSchemaV1(
138 Schema.Struct({
139 policyId: Schema.String,
140 payload: UpdatePolicyPayloadSchema,
141 }),
142);
143const sourceOutputSchema = Schema.standardSchemaV1(SourceSchema);
144const sourceInspectionOutputSchema = Schema.standardSchemaV1(
145 SourceInspectionSchema,
146);
147const sourceInspectionToolOutputSchema = Schema.standardSchemaV1(
148 SourceInspectionToolDetailSchema,
149);
150const sourceInspectionDiscoverOutputSchema = Schema.standardSchemaV1(
151 SourceInspectionDiscoverResultSchema,
152);
153const localScopePolicyOutputSchema = Schema.standardSchemaV1(
154 LocalScopePolicySchema,
155);
156
157const 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
189const 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
214const 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
230export 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
551export 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};
packages/platform/sdk-file/src/index.ts+0−3
@@ -313,7 +313,6 @@ export const createLocalExecutorRuntime = ( · 312 unmodified lines
313): Effect.Effect<ExecutorRuntime, Error> =>313): Effect.Effect<ExecutorRuntime, Error> =>
314 createLocalExecutorBackend(options).createRuntime({314 createLocalExecutorBackend(options).createRuntime({
315 executionResolver: options.executionResolver,315 executionResolver: options.executionResolver,
316 createInternalToolMap: options.createInternalToolMap,
317 resolveSecretMaterial: options.resolveSecretMaterial,316 resolveSecretMaterial: options.resolveSecretMaterial,
318 getLocalServerBaseUrl: options.getLocalServerBaseUrl,317 getLocalServerBaseUrl: options.getLocalServerBaseUrl,
319 });318 });
@@ -336,7 +335,6 @@ export const createLocalExecutorEffect = < · 16 unmodified lines
336 backend: createLocalExecutorBackend(options),335 backend: createLocalExecutorBackend(options),
337 plugins: options.plugins,336 plugins: options.plugins,
338 executionResolver: options.executionResolver,337 executionResolver: options.executionResolver,
339 createInternalToolMap: options.createInternalToolMap,
340 resolveSecretMaterial: options.resolveSecretMaterial,338 resolveSecretMaterial: options.resolveSecretMaterial,
341 getLocalServerBaseUrl: options.getLocalServerBaseUrl,339 getLocalServerBaseUrl: options.getLocalServerBaseUrl,
342 } satisfies CreateExecutorEffectOptions & { plugins?: TPlugins });340 } satisfies CreateExecutorEffectOptions & { plugins?: TPlugins });
@@ -350,7 +348,6 @@ export const createLocalExecutor = < · 7 unmodified lines
350 backend: createLocalExecutorBackend(options),348 backend: createLocalExecutorBackend(options),
351 plugins: options.plugins,349 plugins: options.plugins,
352 executionResolver: options.executionResolver,350 executionResolver: options.executionResolver,
353 createInternalToolMap: options.createInternalToolMap,
354 resolveSecretMaterial: options.resolveSecretMaterial,351 resolveSecretMaterial: options.resolveSecretMaterial,
355 getLocalServerBaseUrl: options.getLocalServerBaseUrl,352 getLocalServerBaseUrl: options.getLocalServerBaseUrl,
356 });353 });
packages/platform/sdk/src/executor-effect.ts+0−2
@@ -58,7 +58,6 @@ import { · 57 unmodified lines
58import type { ExecutorBackend } from "./backend";58import type { ExecutorBackend } from "./backend";
59import {59import {
60 provideExecutorRuntime,60 provideExecutorRuntime,
61 type CreateScopeInternalToolMap,
62 type ExecutorRuntime,61 type ExecutorRuntime,
63 type ExecutorRuntimeOptions,62 type ExecutorRuntimeOptions,
64 type ResolveExecutionEnvironment,63 type ResolveExecutionEnvironment,
@@ -271,7 +270,6 @@ export const createExecutorEffect = < · 206 unmodified lines
271 return Effect.map(270 return Effect.map(
272 options.backend.createRuntime({271 options.backend.createRuntime({
273 executionResolver: options.executionResolver,272 executionResolver: options.executionResolver,
274 createInternalToolMap: options.createInternalToolMap,
275 resolveSecretMaterial: options.resolveSecretMaterial,273 resolveSecretMaterial: options.resolveSecretMaterial,
276 getLocalServerBaseUrl: options.getLocalServerBaseUrl,274 getLocalServerBaseUrl: options.getLocalServerBaseUrl,
277 }),275 }),
packages/platform/sdk/src/runtime/execution/scope/environment.ts+0−29
@@ -26,12 +26,6 @@ import { · 25 unmodified lines
26import {26import {
27 getRuntimeLocalScopeOption,27 getRuntimeLocalScopeOption,
28} from "../../scope/runtime-context";28} from "../../scope/runtime-context";
29import {
30 LocalInstanceConfigService,
31 SecretMaterialDeleterService,
32 SecretMaterialStorerService,
33 SecretMaterialUpdaterService,
34} from "../../scope/secret-material-providers";
35import {29import {
36 LocalToolRuntimeLoaderService,30 LocalToolRuntimeLoaderService,
37 type LocalToolRuntimeLoaderShape,31 type LocalToolRuntimeLoaderShape,
@@ -53,9 +47,6 @@ import { · 15 unmodified lines
53import {47import {
54 RuntimeSourceStoreService,48 RuntimeSourceStoreService,
55} from "../../sources/source-store";49} from "../../sources/source-store";
56import type {
57 CreateScopeInternalToolMap,
58} from "./tool-invoker";
59export {50export {
60 createCodeExecutorForRuntime,51 createCodeExecutorForRuntime,
61 resolveConfiguredExecutionRuntime,52 resolveConfiguredExecutionRuntime,
@@ -80,14 +71,9 @@ export const createScopeExecutionEnvironmentResolver = · 18 unmodified lines
80 >;71 >;
81 localToolRuntimeLoader: LocalToolRuntimeLoaderShape;72 localToolRuntimeLoader: LocalToolRuntimeLoaderShape;
82 installationStore: InstallationStoreShape;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 scopeConfigStore: ScopeConfigStoreShape;74 scopeConfigStore: ScopeConfigStoreShape;
88 scopeStateStore: ScopeStateStoreShape;75 scopeStateStore: ScopeStateStoreShape;
89 sourceArtifactStore: SourceArtifactStoreShape;76 sourceArtifactStore: SourceArtifactStoreShape;
90 createInternalToolMap?: CreateScopeInternalToolMap;
91 }): ResolveExecutionEnvironment =>77 }): ResolveExecutionEnvironment =>
92 ({ scopeId, actorScopeId, onElicitation }) =>78 ({ scopeId, actorScopeId, onElicitation }) =>
93 Effect.gen(function* () {79 Effect.gen(function* () {
@@ -108,16 +94,11 @@ export const createScopeExecutionEnvironmentResolver = · 14 unmodified lines
108 sourceCatalogSyncService: input.sourceCatalogSyncService,94 sourceCatalogSyncService: input.sourceCatalogSyncService,
109 sourceCatalogStore: input.sourceCatalogStore,95 sourceCatalogStore: input.sourceCatalogStore,
110 installationStore: input.installationStore,96 installationStore: input.installationStore,
111 instanceConfigResolver: input.instanceConfigResolver,
112 storeSecretMaterial: input.storeSecretMaterial,
113 deleteSecretMaterial: input.deleteSecretMaterial,
114 updateSecretMaterial: input.updateSecretMaterial,
115 scopeConfigStore: input.scopeConfigStore,97 scopeConfigStore: input.scopeConfigStore,
116 scopeStateStore: input.scopeStateStore,98 scopeStateStore: input.scopeStateStore,
117 sourceArtifactStore: input.sourceArtifactStore,99 sourceArtifactStore: input.sourceArtifactStore,
118 runtimeLocalScope,100 runtimeLocalScope,
119 localToolRuntime,101 localToolRuntime,
120 createInternalToolMap: input.createInternalToolMap,
121 onElicitation,102 onElicitation,
122 });103 });
123 104
@@ -142,7 +123,6 @@ export class RuntimeExecutionResolverService extends Context.Tag( · 18 unmodified lines
142export const RuntimeExecutionResolverLive = (123export const RuntimeExecutionResolverLive = (
143 input: {124 input: {
144 executionResolver?: ResolveExecutionEnvironment;125 executionResolver?: ResolveExecutionEnvironment;
145 createInternalToolMap?: CreateScopeInternalToolMap;
146 } = {},126 } = {},
147) =>127) =>
148 input.executionResolver128 input.executionResolver
@@ -157,10 +137,6 @@ export const RuntimeExecutionResolverLive = ( · 8 unmodified lines
157 const sourceCatalogStore = yield* RuntimeSourceCatalogStoreService;137 const sourceCatalogStore = yield* RuntimeSourceCatalogStoreService;
158 const localToolRuntimeLoader = yield* LocalToolRuntimeLoaderService;138 const localToolRuntimeLoader = yield* LocalToolRuntimeLoaderService;
159 const installationStore = yield* InstallationStore;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 const scopeConfigStore = yield* ScopeConfigStore;140 const scopeConfigStore = yield* ScopeConfigStore;
165 const scopeStateStore = yield* ScopeStateStore;141 const scopeStateStore = yield* ScopeStateStore;
166 const sourceArtifactStore = yield* SourceArtifactStore;142 const sourceArtifactStore = yield* SourceArtifactStore;
@@ -172,14 +148,9 @@ export const RuntimeExecutionResolverLive = ( · 5 unmodified lines
172 sourceCatalogStore,148 sourceCatalogStore,
173 localToolRuntimeLoader,149 localToolRuntimeLoader,
174 installationStore,150 installationStore,
175 instanceConfigResolver,
176 storeSecretMaterial,
177 deleteSecretMaterial,
178 updateSecretMaterial,
179 scopeConfigStore,151 scopeConfigStore,
180 scopeStateStore,152 scopeStateStore,
181 sourceArtifactStore,153 sourceArtifactStore,
182 createInternalToolMap: input.createInternalToolMap,
183 });154 });
184 }),155 }),
185 );156 );
packages/platform/sdk/src/runtime/execution/scope/tool-invoker.ts+0−52
@@ -30,12 +30,6 @@ import { · 29 unmodified lines
30 type ScopeConfigStoreShape,30 type ScopeConfigStoreShape,
31 type ScopeStateStoreShape,31 type ScopeStateStoreShape,
32} from "../../scope/storage";32} from "../../scope/storage";
33import type {
34 DeleteSecretMaterial,
35 ResolveInstanceConfig,
36 StoreSecretMaterial,
37 UpdateSecretMaterial,
38} from "../../scope/secret-material-providers";
39import type {33import type {
40 ExecutorStateStoreShape,34 ExecutorStateStoreShape,
41} from "../../executor-state-store";35} from "../../executor-state-store";
@@ -66,29 +60,6 @@ import { · 24 unmodified lines
66 runtimeEffectError,60 runtimeEffectError,
67} from "../../effect-errors";61} from "../../effect-errors";
68 62
69export 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
88export type CreateScopeInternalToolMap = (
89 input: ScopeInternalToolContext,
90) => ToolMap;
91
92export const createScopeToolInvoker = (input: {63export const createScopeToolInvoker = (input: {
93 scopeId: Source["scopeId"];64 scopeId: Source["scopeId"];
94 actorScopeId: ScopeId;65 actorScopeId: ScopeId;
@@ -101,16 +72,11 @@ export const createScopeToolInvoker = (input: { · 6 unmodified lines
101 typeof RuntimeSourceCatalogStoreService72 typeof RuntimeSourceCatalogStoreService
102 >;73 >;
103 installationStore: InstallationStoreShape;74 installationStore: InstallationStoreShape;
104 instanceConfigResolver: ResolveInstanceConfig;
105 storeSecretMaterial: StoreSecretMaterial;
106 deleteSecretMaterial: DeleteSecretMaterial;
107 updateSecretMaterial: UpdateSecretMaterial;
108 scopeConfigStore: ScopeConfigStoreShape;75 scopeConfigStore: ScopeConfigStoreShape;
109 scopeStateStore: ScopeStateStoreShape;76 scopeStateStore: ScopeStateStoreShape;
110 sourceArtifactStore: SourceArtifactStoreShape;77 sourceArtifactStore: SourceArtifactStoreShape;
111 runtimeLocalScope: RuntimeLocalScopeState | null;78 runtimeLocalScope: RuntimeLocalScopeState | null;
112 localToolRuntime: LocalToolRuntime;79 localToolRuntime: LocalToolRuntime;
113 createInternalToolMap?: CreateScopeInternalToolMap;
114 onElicitation?: Parameters<80 onElicitation?: Parameters<
115 typeof makeToolInvokerFromTools81 typeof makeToolInvokerFromTools
116 >[0]["onElicitation"];82 >[0]["onElicitation"];
@@ -138,23 +104,6 @@ export const createScopeToolInvoker = (input: { · 21 unmodified lines
138 sourceArtifactStore: input.sourceArtifactStore,104 sourceArtifactStore: input.sourceArtifactStore,
139 runtimeLocalScope: input.runtimeLocalScope,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 const sourceCatalog = createScopeSourceCatalog({107 const sourceCatalog = createScopeSourceCatalog({
159 scopeId: input.scopeId,108 scopeId: input.scopeId,
160 actorScopeId: input.actorScopeId,109 actorScopeId: input.actorScopeId,
@@ -177,7 +126,6 @@ export const createScopeToolInvoker = (input: { · 16 unmodified lines
177 const authoredTools = mergeToolMaps([126 const authoredTools = mergeToolMaps([
178 systemTools,127 systemTools,
179 executorTools,128 executorTools,
180 internalTools,
181 input.localToolRuntime.tools,129 input.localToolRuntime.tools,
182 ]);130 ]);
183 const authoredCatalog = createToolCatalogFromTools({131 const authoredCatalog = createToolCatalogFromTools({
packages/platform/sdk/src/runtime/index.ts+0−10
@@ -31,10 +31,6 @@ import { · 30 unmodified lines
31import {31import {
32 RuntimeExecutionResolverLive,32 RuntimeExecutionResolverLive,
33} from "./execution/scope/environment";33} from "./execution/scope/environment";
34import type {
35 CreateScopeInternalToolMap,
36 ScopeInternalToolContext,
37} from "./execution/scope/tool-invoker";
38import type {34import type {
39 LoadedLocalExecutorConfig,35 LoadedLocalExecutorConfig,
40} from "./scope-config";36} from "./scope-config";
@@ -104,10 +100,6 @@ export * from "./executor-state-store"; · 63 unmodified lines
104export * from "./execution/scope/environment";100export * from "./execution/scope/environment";
105export * from "../sources/inspection";101export * from "../sources/inspection";
106export * from "./execution/service";102export * from "./execution/service";
107export type {
108 CreateScopeInternalToolMap,
109 ScopeInternalToolContext,
110} from "./execution/scope/tool-invoker";
111export {103export {
112 LocalInstanceConfigService,104 LocalInstanceConfigService,
113 SecretMaterialDeleterService,105 SecretMaterialDeleterService,
@@ -133,7 +125,6 @@ export { · 19 unmodified lines
133 125
134export type ExecutorRuntimeOptions = {126export type ExecutorRuntimeOptions = {
135 executionResolver?: ResolveExecutionEnvironment;127 executionResolver?: ResolveExecutionEnvironment;
136 createInternalToolMap?: CreateScopeInternalToolMap;
137 resolveSecretMaterial?: ResolveSecretMaterial;128 resolveSecretMaterial?: ResolveSecretMaterial;
138 getLocalServerBaseUrl?: () => string | undefined;129 getLocalServerBaseUrl?: () => string | undefined;
139};130};
@@ -362,7 +353,6 @@ export const createExecutorRuntimeLayer = ( · 222 unmodified lines
362 353
363 const executionResolverLayer = RuntimeExecutionResolverLive({354 const executionResolverLayer = RuntimeExecutionResolverLive({
364 executionResolver: input.executionResolver,355 executionResolver: input.executionResolver,
365 createInternalToolMap: input.createInternalToolMap,
366 }).pipe(356 }).pipe(
367 Layer.provide(357 Layer.provide(
368 Layer.mergeAll(358 Layer.mergeAll(
packages/platform/sdk/src/runtime/sources/source-plugins/index.ts+5−14
@@ -3,26 +3,17 @@ import { · 2 unmodified lines
3 type ExecutorSdkPlugin,3 type ExecutorSdkPlugin,
4} from "../../../plugins";4} from "../../../plugins";
5 5
6import {6let configuredSourcePlugins: readonly ExecutorSdkPlugin[] = [];
7 InternalSourceSdkPlugin,7let registry = registerExecutorSdkPlugins(configuredSourcePlugins);
8} from "./internal";
9
10let configuredExternalSourcePlugins: readonly ExecutorSdkPlugin[] = [];
11let registry = registerExecutorSdkPlugins([
12 InternalSourceSdkPlugin,
13]);
14 8
15const refreshRegistry = () => {9const refreshRegistry = () => {
16 registry = registerExecutorSdkPlugins([10 registry = registerExecutorSdkPlugins(configuredSourcePlugins);
17 ...configuredExternalSourcePlugins,
18 InternalSourceSdkPlugin,
19 ]);
20};11};
21 12
22export const configureExecutorSourcePlugins = (13export const configureExecutorSourcePlugins = (
23 plugins: readonly ExecutorSdkPlugin[],14 plugins: readonly ExecutorSdkPlugin[],
24): void => {15): void => {
25 configuredExternalSourcePlugins = plugins;16 configuredSourcePlugins = plugins;
26 refreshRegistry();17 refreshRegistry();
27};18};
28 19
@@ -39,4 +30,4 @@ export const isInternalSourcePluginKind = (kind: string) => · 10 unmodified lines
39 registry.isInternalSourcePluginKind(kind);30 registry.isInternalSourcePluginKind(kind);
40 31
41export const hasRegisteredExternalSourcePlugins = () =>32export const hasRegisteredExternalSourcePlugins = () =>
42 configuredExternalSourcePlugins.length > 0;33 configuredSourcePlugins.length > 0;
packages/platform/server/package.json+1−1
@@ -15,6 +15,7 @@ · 14 unmodified lines
15 "@effect/platform": "catalog:",15 "@effect/platform": "catalog:",
16 "@effect/platform-node": "catalog:",16 "@effect/platform-node": "catalog:",
17 "@executor/executor-mcp": "workspace:*",17 "@executor/executor-mcp": "workspace:*",
18 "@executor/plugin-internal-sdk": "workspace:*",
18 "@executor/plugin-google-discovery-http": "workspace:*",19 "@executor/plugin-google-discovery-http": "workspace:*",
19 "@executor/plugin-google-discovery-shared": "workspace:*",20 "@executor/plugin-google-discovery-shared": "workspace:*",
20 "@executor/plugin-google-discovery-sdk": "workspace:*",21 "@executor/plugin-google-discovery-sdk": "workspace:*",
@@ -28,7 +29,6 @@ · 7 unmodified lines
28 "@executor/plugin-openapi-shared": "workspace:*",29 "@executor/plugin-openapi-shared": "workspace:*",
29 "@executor/plugin-openapi-sdk": "workspace:*",30 "@executor/plugin-openapi-sdk": "workspace:*",
30 "@executor/platform-api": "workspace:*",31 "@executor/platform-api": "workspace:*",
31 "@executor/platform-internal": "workspace:*",
32 "@executor/platform-sdk": "workspace:*",32 "@executor/platform-sdk": "workspace:*",
33 "@executor/platform-sdk-file": "workspace:*",33 "@executor/platform-sdk-file": "workspace:*",
34 "@opentelemetry/api": "^1.9.0",34 "@opentelemetry/api": "^1.9.0",
packages/platform/server/src/index.ts+2−2
@@ -8,6 +8,7 @@ import { dirname, extname, resolve } from "node:path"; · 7 unmodified lines
8import { Readable } from "node:stream";8import { Readable } from "node:stream";
9import { FileSystem, HttpApiBuilder, HttpServer } from "@effect/platform";9import { FileSystem, HttpApiBuilder, HttpServer } from "@effect/platform";
10import { NodeFileSystem } from "@effect/platform-node";10import { NodeFileSystem } from "@effect/platform-node";
11import { internalSdkPlugin } from "@executor/plugin-internal-sdk";
11import { googleDiscoveryHttpPlugin } from "@executor/plugin-google-discovery-http";12import { googleDiscoveryHttpPlugin } from "@executor/plugin-google-discovery-http";
12import { googleDiscoverySdkPlugin } from "@executor/plugin-google-discovery-sdk";13import { googleDiscoverySdkPlugin } from "@executor/plugin-google-discovery-sdk";
13import { graphqlHttpPlugin } from "@executor/plugin-graphql-http";14import { graphqlHttpPlugin } from "@executor/plugin-graphql-http";
@@ -22,7 +23,6 @@ import { · 8 unmodified lines
22 createExecutorApiLayer,23 createExecutorApiLayer,
23} from "@executor/platform-api/http";24} from "@executor/platform-api/http";
24import { createExecutorMcpRequestHandler } from "@executor/executor-mcp";25import { createExecutorMcpRequestHandler } from "@executor/executor-mcp";
25import { createWorkspaceExecutorAdminToolMap } from "@executor/platform-internal";
26import {26import {
27 createExecutorEffect,27 createExecutorEffect,
28 type ExecutorEffect as Executor,28 type ExecutorEffect as Executor,
@@ -155,6 +155,7 @@ const createExecutorRuntime = ( · 126 unmodified lines
155 localDataDir,155 localDataDir,
156 }),156 }),
157 plugins: [157 plugins: [
158 internalSdkPlugin(),
158 graphqlSdkPlugin({159 graphqlSdkPlugin({
159 storage: createFileGraphqlSourceStorage({160 storage: createFileGraphqlSourceStorage({
160 rootDir: resolve(localDataDir, "plugins", "graphql", "sources"),161 rootDir: resolve(localDataDir, "plugins", "graphql", "sources"),
@@ -183,7 +184,6 @@ const createExecutorRuntime = ( · 22 unmodified lines
183 }),184 }),
184 ] as const,185 ] as const,
185 executionResolver: options.executionResolver,186 executionResolver: options.executionResolver,
186 createInternalToolMap: createWorkspaceExecutorAdminToolMap,
187 resolveSecretMaterial: options.resolveSecretMaterial,187 resolveSecretMaterial: options.resolveSecretMaterial,
188 getLocalServerBaseUrl,188 getLocalServerBaseUrl,
189 }).pipe(189 }).pipe(
plugins/internal/sdk/index.tsrenamed from packages/platform/sdk/src/runtime/sources/source-plugins/internal.ts+4−9
@@ -4,11 +4,9 @@ import { · 3 unmodified lines
4 createCatalogImportMetadata,4 createCatalogImportMetadata,
5 createSourceCatalogSyncResult,5 createSourceCatalogSyncResult,
6} from "@executor/source-core";6} from "@executor/source-core";
7import type { ExecutorSdkPlugin } from "../../../plugins";7import type { ExecutorSdkPlugin } from "@executor/platform-sdk/plugins";
8 8
9import { runtimeEffectError } from "../../effect-errors";9export const internalSdkPlugin = (): ExecutorSdkPlugin<"internal"> => ({
10
11export const InternalSourceSdkPlugin = {
12 key: "internal",10 key: "internal",
13 sources: [11 sources: [
14 {12 {
@@ -38,11 +36,8 @@ export const InternalSourceSdkPlugin = { · 23 unmodified lines
38 ),36 ),
39 invoke: () =>37 invoke: () =>
40 Effect.fail(38 Effect.fail(
41 runtimeEffectError(39 new Error("Internal sources do not support persisted plugin invocation"),
42 "sources/source-plugins/internal",
43 "Internal sources do not support persisted plugin invocation",
44 ),
45 ),40 ),
46 },41 },
47 ],42 ],
48} satisfies ExecutorSdkPlugin<"internal">;43});
plugins/internal/sdk/package.jsonrenamed from packages/platform/internal/package.json+7−5
@@ -1,22 +1,24 @@
1{1{
2 "name": "@executor/platform-internal",2 "name": "@executor/plugin-internal-sdk",
3 "private": true,3 "private": true,
4 "type": "module",4 "type": "module",
5 "exports": {5 "exports": {
6 ".": "./src/index.ts"6 ".": "./index.ts"
7 },7 },
8 "files": [
9 "*.ts"
10 ],
8 "scripts": {11 "scripts": {
9 "typecheck": "bunx tsc --noEmit -p tsconfig.json"12 "typecheck": "bunx tsc --noEmit -p tsconfig.json"
10 },13 },
11 "dependencies": {14 "dependencies": {
12 "@executor/codemode-core": "workspace:*",
13 "@executor/platform-sdk": "workspace:*",15 "@executor/platform-sdk": "workspace:*",
16 "@executor/source-core": "workspace:*",
14 "effect": "catalog:"17 "effect": "catalog:"
15 },18 },
16 "devDependencies": {19 "devDependencies": {
17 "@types/node": "catalog:",20 "@types/node": "catalog:",
18 "bun-types": "catalog:",21 "bun-types": "catalog:"
19 "typescript": "^5.9.3"
20 },22 },
21 "version": "0.0.0"23 "version": "0.0.0"
22}24}
plugins/internal/sdk/tsconfig.jsonrenamed from packages/platform/internal/tsconfig.json+2−2
@@ -6,8 +6,8 @@ · 5 unmodified lines
6 "strict": true,6 "strict": true,
7 "skipLibCheck": true,7 "skipLibCheck": true,
8 "noEmit": true,8 "noEmit": true,
9 "lib": ["ES2022"],9 "lib": ["ES2022", "DOM"],
10 "types": ["bun-types", "node"]10 "types": ["bun-types", "node"]
11 },11 },
12 "include": ["src/**/*.ts"]12 "include": ["*.ts"]
13}13}