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
20712071
20722072 const result: ResolveToolsResult = yield* runtime.plugin
20732073 .resolveTools({
2074+ ctx: runtime.ctx,
20742075 integration: rowToIntegration(integrationRow),
20752076 config: decodeJsonColumn(integrationRow.config),
20762077 httpClientLayer: runtime.ctx.httpClientLayer,
@@ -3732,6 +3733,7 @@ export const createExecutor = <const TPlugins extends readonly AnyPlugin[] = rea · 1655 unmodified lines
37323733 items: (key) => providersItems(key),
37333734 },
37343735 oauth,
3736+ execute: (address, args) => execute(address, args),
37353737 transaction: <A, E>(effect: Effect.Effect<A, E>) => transaction(effect),
37363738 };
37373739
packages/core/sdk/src/plugin.ts+9−0
@@ -29,6 +29,7 @@ import type { · 28 unmodified lines
2929 ProviderKey,
3030 Subject,
3131 Tenant,
32+ ToolAddress,
3233 } from "./ids";
3334 import type { IntegrationDetectionResult } from "./types";
3435 import type {
@@ -38,6 +39,7 @@ import type { · 3 unmodified lines
3839 ElicitationResponse,
3940 } from "./elicitation";
4041 import type {
42+ ExecuteError,
4143 ConnectionNotFoundError,
4244 CredentialProviderNotRegisteredError,
4345 IntegrationNotFoundError,
@@ -249,6 +251,12 @@ export interface PluginCtx<TStore = unknown> { · 205 unmodified lines
249251 /** Shared OAuth service. */
250252 readonly oauth: OAuthService;
251253
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+
252260 /** Run `effect` inside a FumaDB transaction (atomic across plugin storage +
253261 * core integration/tool writes). */
254262 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
261269 // ---------------------------------------------------------------------------
262270
263271 export interface ResolveToolsInput<TStore = unknown> {
272+ readonly ctx?: PluginCtx<TStore>;
264273 /** The catalog record (public projection) whose connection is being resolved. */
265274 readonly integration: Integration;
266275 /** The plugin's stored opaque config for that integration. */