History

Move product access rules out of the SDK

Rhys Sullivan committed 1 month ago

Commit c676e561 parent a72e51d161 files · +3935 −867Browse files

Showing the changes to examples (6 of 161 files). Show all

Unified · Split

6 files
  1. examples/all-plugins/package.json +1 −0
  2. examples/all-plugins/src/main.ts +3 −0
  3. examples/docs-sdk-quickstart/package.json +1 −0
  4. examples/docs-sdk-quickstart/src/main.ts +4 −0
  5. examples/promise-sdk/package.json +1 −0
  6. examples/promise-sdk/src/main.ts +4 −0
examples/all-plugins/package.json+1−0
@@ -16,6 +16,7 @@ · 15 unmodified lines
16 "@executor-js/plugin-onepassword": "workspace:*",16 "@executor-js/plugin-onepassword": "workspace:*",
17 "@executor-js/plugin-openapi": "workspace:*",17 "@executor-js/plugin-openapi": "workspace:*",
18 "@executor-js/plugin-workos-vault": "workspace:*",18 "@executor-js/plugin-workos-vault": "workspace:*",
19 "@executor-js/product-access": "workspace:*",
19 "@executor-js/sdk": "workspace:*",20 "@executor-js/sdk": "workspace:*",
20 "effect": "catalog:"21 "effect": "catalog:"
21 },22 },
examples/all-plugins/src/main.ts+3−0
@@ -31,6 +31,7 @@ import { · 30 unmodified lines
31 ToolAddress,31 ToolAddress,
32 type CredentialProvider,32 type CredentialProvider,
33} from "@executor-js/sdk";33} from "@executor-js/sdk";
34import { workspaceServiceAccess } from "@executor-js/product-access";
34 35
35import { fileSecretsPlugin } from "@executor-js/plugin-file-secrets";36import { fileSecretsPlugin } from "@executor-js/plugin-file-secrets";
36import {37import {
@@ -192,6 +193,8 @@ const program = Effect.gen(function* () { · 155 unmodified lines
192 193
193 const executor = yield* createExecutor({194 const executor = yield* createExecutor({
194 tenant: Tenant.make("example-tenant"),195 tenant: Tenant.make("example-tenant"),
196 // Subject-less single-workspace example: org partition, writes allowed.
197 access: workspaceServiceAccess(),
195 plugins,198 plugins,
196 providers: [memoryProvider],199 providers: [memoryProvider],
197 onElicitation: "accept-all" as const,200 onElicitation: "accept-all" as const,
examples/docs-sdk-quickstart/package.json+1−0
@@ -10,6 +10,7 @@ · 9 unmodified lines
10 },10 },
11 "dependencies": {11 "dependencies": {
12 "@executor-js/plugin-openapi": "workspace:*",12 "@executor-js/plugin-openapi": "workspace:*",
13 "@executor-js/product-access": "workspace:*",
13 "@executor-js/sdk": "workspace:*",14 "@executor-js/sdk": "workspace:*",
14 "effect": "catalog:"15 "effect": "catalog:"
15 },16 },
examples/docs-sdk-quickstart/src/main.ts+4−0
@@ -8,6 +8,7 @@ import { · 7 unmodified lines
8 type CredentialProvider,8 type CredentialProvider,
9} from "@executor-js/sdk/promise";9} from "@executor-js/sdk/promise";
10import { openApiPlugin, variable } from "@executor-js/plugin-openapi/promise";10import { openApiPlugin, variable } from "@executor-js/plugin-openapi/promise";
11import { workspaceServiceAccess } from "@executor-js/product-access";
11 12
12const inventoryApi = {13const inventoryApi = {
13 openapi: "3.0.0",14 openapi: "3.0.0",
@@ -92,6 +93,9 @@ const memoryProvider: CredentialProvider = { · 78 unmodified lines
92};93};
93 94
94const executor = await createExecutor({95const executor = await createExecutor({
96 // Subject-less single-workspace embedder: the product posture is stated
97 // explicitly — the SDK ships no default.
98 access: workspaceServiceAccess(),
95 plugins: [openApiPlugin()],99 plugins: [openApiPlugin()],
96 providers: [memoryProvider],100 providers: [memoryProvider],
97 onElicitation: "accept-all",101 onElicitation: "accept-all",
examples/promise-sdk/package.json+1−0
@@ -12,6 +12,7 @@ · 11 unmodified lines
12 "@executor-js/plugin-graphql": "workspace:*",12 "@executor-js/plugin-graphql": "workspace:*",
13 "@executor-js/plugin-mcp": "workspace:*",13 "@executor-js/plugin-mcp": "workspace:*",
14 "@executor-js/plugin-openapi": "workspace:*",14 "@executor-js/plugin-openapi": "workspace:*",
15 "@executor-js/product-access": "workspace:*",
15 "@executor-js/sdk": "workspace:*"16 "@executor-js/sdk": "workspace:*"
16 },17 },
17 "devDependencies": {18 "devDependencies": {
examples/promise-sdk/src/main.ts+4−0
@@ -20,6 +20,7 @@ import { Effect } from "effect"; · 19 unmodified lines
20import { mcpPlugin } from "@executor-js/plugin-mcp/promise";20import { mcpPlugin } from "@executor-js/plugin-mcp/promise";
21import { openApiPlugin, variable } from "@executor-js/plugin-openapi/promise";21import { openApiPlugin, variable } from "@executor-js/plugin-openapi/promise";
22import { graphqlPlugin } from "@executor-js/plugin-graphql/promise";22import { graphqlPlugin } from "@executor-js/plugin-graphql/promise";
23import { workspaceServiceAccess } from "@executor-js/product-access";
23 24
24// ---------------------------------------------------------------------------25// ---------------------------------------------------------------------------
25// 1. Create the executor with all plugins26// 1. Create the executor with all plugins
@@ -44,6 +45,9 @@ const memoryProvider: CredentialProvider = { · 18 unmodified lines
44};45};
45 46
46const executor = await createExecutor({47const executor = await createExecutor({
48 // Subject-less single-workspace embedder: the product posture is stated
49 // explicitly — the SDK ships no default.
50 access: workspaceServiceAccess(),
47 plugins,51 plugins,
48 providers: [memoryProvider],52 providers: [memoryProvider],
49 onElicitation: "accept-all",53 onElicitation: "accept-all",