History

Add GitHub sync and self-host custom tools wiring

Rhys Sullivan committed 4 months ago

Commit 275446e1 parent 41eb3ae19 files · +1665 −40Browse files

Showing the changes to packages/core (2 of 19 files). Show all

Unified · Split

2 files
  1. packages/core/sdk/src/executor.ts +2 −0
  2. packages/core/sdk/src/plugin.ts +9 −0
packages/core/sdk/src/executor.ts+2−0
@@ -2071,6 +2071,7 @@ export const createExecutor = <const TPlugins extends readonly AnyPlugin[] = rea · 2070 unmodified lines
2071 2071
2072 const result: ResolveToolsResult = yield* runtime.plugin2072 const result: ResolveToolsResult = yield* runtime.plugin
2073 .resolveTools({2073 .resolveTools({
2074 ctx: runtime.ctx,
2074 integration: rowToIntegration(integrationRow),2075 integration: rowToIntegration(integrationRow),
2075 config: decodeJsonColumn(integrationRow.config),2076 config: decodeJsonColumn(integrationRow.config),
2076 httpClientLayer: runtime.ctx.httpClientLayer,2077 httpClientLayer: runtime.ctx.httpClientLayer,
@@ -3732,6 +3733,7 @@ export const createExecutor = <const TPlugins extends readonly AnyPlugin[] = rea · 1655 unmodified lines
3732 items: (key) => providersItems(key),3733 items: (key) => providersItems(key),
3733 },3734 },
3734 oauth,3735 oauth,
3736 execute: (address, args) => execute(address, args),
3735 transaction: <A, E>(effect: Effect.Effect<A, E>) => transaction(effect),3737 transaction: <A, E>(effect: Effect.Effect<A, E>) => transaction(effect),
3736 };3738 };
3737 3739
packages/core/sdk/src/plugin.ts+9−0
@@ -29,6 +29,7 @@ import type { · 28 unmodified lines
29 ProviderKey,29 ProviderKey,
30 Subject,30 Subject,
31 Tenant,31 Tenant,
32 ToolAddress,
32} from "./ids";33} from "./ids";
33import type { IntegrationDetectionResult } from "./types";34import type { IntegrationDetectionResult } from "./types";
34import type {35import type {
@@ -38,6 +39,7 @@ import type { · 3 unmodified lines
38 ElicitationResponse,39 ElicitationResponse,
39} from "./elicitation";40} from "./elicitation";
40import type {41import type {
42 ExecuteError,
41 ConnectionNotFoundError,43 ConnectionNotFoundError,
42 CredentialProviderNotRegisteredError,44 CredentialProviderNotRegisteredError,
43 IntegrationNotFoundError,45 IntegrationNotFoundError,
@@ -249,6 +251,12 @@ export interface PluginCtx<TStore = unknown> { · 205 unmodified lines
249 /** Shared OAuth service. */251 /** Shared OAuth service. */
250 readonly oauth: OAuthService;252 readonly oauth: OAuthService;
251 253
254 /** Invoke another catalog tool through the same executor request context:
255 * policy, approval, credential resolution, and plugin dispatch all stay in
256 * the core path. Intended for plugin sandboxes that expose higher-level
257 * virtual tools over existing integration tools. */
258 readonly execute: (address: ToolAddress, args: unknown) => Effect.Effect<unknown, ExecuteError>;
259
252 /** Run `effect` inside a FumaDB transaction (atomic across plugin storage +260 /** Run `effect` inside a FumaDB transaction (atomic across plugin storage +
253 * core integration/tool writes). */261 * core integration/tool writes). */
254 readonly transaction: <A, E>(effect: Effect.Effect<A, E>) => Effect.Effect<A, E | StorageFailure>;262 readonly transaction: <A, E>(effect: Effect.Effect<A, E>) => Effect.Effect<A, E | StorageFailure>;
@@ -261,6 +269,7 @@ export interface PluginCtx<TStore = unknown> { · 6 unmodified lines
261// ---------------------------------------------------------------------------269// ---------------------------------------------------------------------------
262 270
263export interface ResolveToolsInput<TStore = unknown> {271export interface ResolveToolsInput<TStore = unknown> {
272 readonly ctx?: PluginCtx<TStore>;
264 /** The catalog record (public projection) whose connection is being resolved. */273 /** The catalog record (public projection) whose connection is being resolved. */
265 readonly integration: Integration;274 readonly integration: Integration;
266 /** The plugin's stored opaque config for that integration. */275 /** The plugin's stored opaque config for that integration. */