mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-21 02:43:25 +01:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Plugins can now add connector types to the Connectors catalog (#22004), but only for transports the host already runs (remote MCP, local stdio) > - A plugin cannot yet serve a connector's tools itself, and legacy plugin tools (top-level manifest `tools`) still reach every agent without a connection or install > - A plugin should be able to ship a full connector: settings, credentials, tools, grants, policies and audit, like a built-in one > - This pull request adds the `plugin` transport, the SDK API to serve it, and moves legacy plugin tools under the same activation rules without changing today's access > - The benefit is that any connector can live in a plugin, and agents get plugin tools only when an operator enables them ## Linked Issues or Issue Description Refs #22004 **Subsystem affected** Plugins (SDK, worker protocol, manifest), Connectors (tool access, catalog discovery), tool gateway, database. **Problem or motivation** A plugin connector can only describe an existing transport. There is no way for a plugin worker to serve a connector's tools with per-connection settings and credentials. Legacy plugin tools are visible to every agent as soon as the plugin is enabled, which is the opposite of the connector activation rules. **Proposed solution** Add a `plugin` transport. The gateway keeps every decision (grant, policy, approval, rate limit, audit) and calls the plugin worker with the connection, its settings and a per-call credential. Legacy top-level tools become one implicit connector per plugin. Existing installations keep exactly their current access through a one-time migration. **Alternatives considered** Move legacy tools to connection tool names (`app.<connection>:<tool>`). Rejected: names change, so existing tool policies and agent instructions that name `plugin:tool` would stop matching (a possible widening or loss). Legacy tools keep their names and handlers; only their visibility is now gated by an install of the implicit connector. ## What Changed - `packages/db`: migration `0491` widens `tool_connections_transport_check` with `plugin` (`NOT VALID`, annotated `online_compatible`), and adds `plugin_connector_legacy_access`, seeded with one row per installed legacy-tools plugin and company. - `packages/shared`: method schema gains `settingsSchema` and `tools` (`{ kind: "static", list: [{ name, displayName?, description?, risk, parametersSchema }] } | { kind: "dynamic" }`), only for `transport: "plugin"`; tool names must match `[a-z0-9_]`; plugin-served methods use `none` or `api_key`. The connect API accepts `settings`. - `packages/plugins/sdk`: `ToolRunContext.connection` (`id`, `appSlug`, `methodKey`, `grantId`, `settings`, `credential?`); `ctx.connectors.register(appSlug, toolName, fn)` and `ctx.connectors.listTools(appSlug, fn)`; new `listConnectorTools` RPC; `executeTool` routes connector calls by `appSlug`. A worker refuses to start when a declared static tool (or dynamic lister) has no handler. The test harness gains `executeConnectorTool` and `listConnectorTools`. - `server/src/services/plugin-connector-runtime.ts`: routes one call to the plugin's worker; a stopped worker is a `PluginWorkerUnavailableError`. - Connect flow (`tool-access.ts`): a `plugin` method creates a `paperclip_plugin` application and a `plugin` connection with `config = { sourceTemplateKey, connectionMethodKey, settings }`, validated against `settingsSchema`. Credentials, grants, credential policy, installs and profiles use the existing code. - Catalog: static tools come from the definition, dynamic tools from `listConnectorTools`, with the existing version hashing and retirement. Tool risk comes from the declaration. - Gateway: plugin connections join connected-tool discovery and both execution paths (direct and approved actions). For each call the gateway resolves the grant and, for `api_key`, the credential for that call only. The run context comes only from the session. A stopped worker returns `503 plugin_connector_unavailable` with `retryable: true`. The token broker refuses to export plugin connector credentials. - Legacy tools: a plugin with top-level `tools` and no `apps` gets an implicit connector (slug `default`, named after the plugin, no authentication). Its tools keep their names, handlers and today's access decision, and an agent sees them only when a connection of that connector is installed for it or for the company. The connector's saved action rules (Off, Ask first) can only restrict them. `completeLegacyPluginToolAccess` turns each migration row into such a connection with a company install, at boot and when a disabled plugin is enabled again; it is single-flight across servers, resumes a draft left by an interrupted attempt, and never overrides an operator's later changes. - Catalog: tools a dynamic connector stops offering are retired from discovery; `listConnectorTools` carries the connection's `companyId`, and uses the acting person's grant for personal connections. - Board: the setup flow renders `settingsSchema` with the shared JSON Schema form, sends `settings`, and restores saved settings on resume and reconnect. - `create-paperclip-plugin --template connector` now scaffolds a plugin connector (`apps` + `ctx.connectors.register` + a harness test). SDK README and `PLUGIN_SPEC.md` describe connectors; top-level `tools` stay documented as legacy. - `inferToolRisk` moves to `tool-risk-inference.ts` so the catalog can reuse it. Design notes where the spec left room: - OAuth for `plugin`-transport methods is not supported in this PR (`none` and `api_key` only); OAuth plugin connectors can use `mcp_remote` today. Noted as follow-up. - Board "Test" calls on a plugin connection pass an empty `agentId`/`runId`, because there is no agent run. - Companies created after the upgrade get no automatic legacy connection; they follow the normal activation rules. ## Verification - `server`: `npx vitest run src/__tests__/plugin-connectors-plugin-transport.test.ts` (new): - rules 1-3: a ready plugin and configured accounts give no tools; an install for agent A gives only A the tools; agent B is denied on invocation; - the worker receives `runContext.connection` with the right id, method, grant, settings and the call's credential; spoofed arguments do not change it; each account calls with its own key; results do not contain the key; - invalid settings are rejected (422); a stopped worker is `503 plugin_connector_unavailable` (retryable); a disabled plugin hides the tools; - dynamic tools are listed through the worker and a tool it stops offering is retired; - rule 5: a new installation of a legacy-tools plugin gives no tools; an installation recorded by the migration keeps the same tool names for every agent, through one company-wide connection (two concurrent carry-overs make one; an interrupted draft is finished; a retry keeps an operator's restriction), and is not also exposed as connection tools; Ask first and Off on the implicit connector restrict the legacy tools; - the token broker refuses to export a plugin connection's credential. - Existing gateway plugin-tool tests (`tool-gateway`, `tool-gateway-service`, `prompt-injection-gateway`) now set up the legacy grant an existing installation has, and pass unchanged otherwise. - Regression: `plugin-connectors-circleback-parity`, `tool-gateway`, `tool-gateway-service`, `prompt-injection-gateway`, `tool-access-service` (846 passed), plus `connector-tool-policy`, `plugin-lifecycle-restart`, `remote-mcp-connectors`, `ai-connection-router` in an earlier run. - UI: `AppsConnect.test.tsx` covers sending plugin settings from the settings schema. - SDK: `tests/worker-rpc-host.test.ts` (start refusal without handlers, connector routing, tool listing). Scaffold: `entrypoints.test.ts`. - `packages/db`: `pnpm typecheck` including `check:migrations`; server layered typecheck (sources and tests); `tsc --noEmit` for shared, SDK, scaffold and UI. ## Risks - Behavior change for new installations: legacy plugin tools no longer reach agents until an operator connects the plugin's connector. Installations that exist at upgrade time keep their tools through the migration rows. - The migration widens a check constraint (`NOT VALID`) and copies plugin × company rows into a new table. Both are fast; the previous release never writes `plugin`. - Calls depend on the plugin worker; when it is down the agent gets a retryable error. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used - Claude Opus 5.5 (`claude-opus-5-5`), Anthropic, used through Claude Code with tool use (shell, file editing, test execution). ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [ ] All Paperclip CI gates are green - [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
507 lines
17 KiB
TypeScript
507 lines
17 KiB
TypeScript
/**
|
|
* `@paperclipai/plugin-sdk` — Paperclip plugin worker-side SDK.
|
|
*
|
|
* This is the main entrypoint for plugin worker code. For plugin UI bundles,
|
|
* import from `@paperclipai/plugin-sdk/ui` instead.
|
|
*
|
|
* @example
|
|
* ```ts
|
|
* // Plugin worker entrypoint (dist/worker.ts)
|
|
* import { definePlugin, runWorker, z } from "@paperclipai/plugin-sdk";
|
|
*
|
|
* const plugin = definePlugin({
|
|
* async setup(ctx) {
|
|
* ctx.logger.info("Plugin starting up");
|
|
*
|
|
* ctx.events.on("issue.created", async (event) => {
|
|
* ctx.logger.info("Issue created", { issueId: event.entityId });
|
|
* });
|
|
*
|
|
* ctx.jobs.register("full-sync", async (job) => {
|
|
* ctx.logger.info("Starting full sync", { runId: job.runId });
|
|
* // ... sync implementation
|
|
* });
|
|
*
|
|
* ctx.data.register("sync-health", async ({ companyId }) => {
|
|
* const state = await ctx.state.get({
|
|
* scopeKind: "company",
|
|
* scopeId: String(companyId),
|
|
* stateKey: "last-sync-at",
|
|
* });
|
|
* return { lastSync: state };
|
|
* });
|
|
* },
|
|
*
|
|
* async onHealth() {
|
|
* return { status: "ok" };
|
|
* },
|
|
* });
|
|
*
|
|
* export default plugin;
|
|
* runWorker(plugin, import.meta.url);
|
|
* ```
|
|
*
|
|
* @see PLUGIN_SPEC.md §14 — SDK Surface
|
|
* @see PLUGIN_SPEC.md §29.2 — SDK Versioning
|
|
*/
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Main factory
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export { definePlugin } from "./define-plugin.js";
|
|
export { createTestHarness, createEnvironmentTestHarness, createFakeEnvironmentDriver, filterEnvironmentEvents, assertEnvironmentEventOrder, assertLeaseLifecycle, assertWorkspaceRealizationLifecycle, assertExecutionLifecycle, assertEnvironmentError } from "./testing.js";
|
|
export { createPluginBundlerPresets } from "./bundlers.js";
|
|
export { startPluginDevServer, getUiBuildSnapshot } from "./dev-server.js";
|
|
export { startWorkerRpcHost, runWorker } from "./worker-rpc-host.js";
|
|
export {
|
|
createHostClientHandlers,
|
|
getRequiredCapability,
|
|
CapabilityDeniedError,
|
|
InvocationScopeDeniedError,
|
|
} from "./host-client-factory.js";
|
|
|
|
// JSON-RPC protocol helpers and constants
|
|
export {
|
|
JSONRPC_VERSION,
|
|
JSONRPC_ERROR_CODES,
|
|
PLUGIN_RPC_ERROR_CODES,
|
|
HOST_TO_WORKER_REQUIRED_METHODS,
|
|
HOST_TO_WORKER_OPTIONAL_METHODS,
|
|
MESSAGE_DELIMITER,
|
|
createRequest,
|
|
createSuccessResponse,
|
|
createErrorResponse,
|
|
createNotification,
|
|
isJsonRpcRequest,
|
|
isJsonRpcNotification,
|
|
isJsonRpcResponse,
|
|
isJsonRpcSuccessResponse,
|
|
isJsonRpcErrorResponse,
|
|
serializeMessage,
|
|
parseMessage,
|
|
JsonRpcParseError,
|
|
JsonRpcCallError,
|
|
LOGIN_PTY_OUTPUT_NOTIFICATION,
|
|
LOGIN_PTY_EXIT_NOTIFICATION,
|
|
DUPLEX_CHANNEL_DATA_NOTIFICATION,
|
|
DUPLEX_CHANNEL_EXIT_NOTIFICATION,
|
|
encodeChannelBytes,
|
|
decodeChannelBytes,
|
|
_resetIdCounter,
|
|
} from "./protocol.js";
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Type exports
|
|
// ---------------------------------------------------------------------------
|
|
|
|
// Plugin definition and lifecycle types
|
|
export type {
|
|
PluginDefinition,
|
|
PaperclipPlugin,
|
|
PluginHealthDiagnostics,
|
|
PluginConfigChangeContext,
|
|
PluginConfigValidationResult,
|
|
PluginWebhookInput,
|
|
PluginApiRequestInput,
|
|
PluginApiResponse,
|
|
} from "./define-plugin.js";
|
|
export type {
|
|
TestHarness,
|
|
TestHarnessOptions,
|
|
TestHarnessLogEntry,
|
|
EnvironmentTestHarness,
|
|
EnvironmentTestHarnessOptions,
|
|
EnvironmentEventRecord,
|
|
FakeEnvironmentDriverOptions,
|
|
} from "./testing.js";
|
|
export type {
|
|
PluginBundlerPresetInput,
|
|
PluginBundlerPresets,
|
|
EsbuildLikeOptions,
|
|
RollupLikeConfig,
|
|
} from "./bundlers.js";
|
|
export type { PluginDevServer, PluginDevServerOptions } from "./dev-server.js";
|
|
export type {
|
|
WorkerRpcHostOptions,
|
|
WorkerRpcHost,
|
|
RunWorkerOptions,
|
|
} from "./worker-rpc-host.js";
|
|
export type {
|
|
HostServices,
|
|
HostClientFactoryOptions,
|
|
HostClientHandlers,
|
|
} from "./host-client-factory.js";
|
|
|
|
// JSON-RPC protocol types
|
|
export type {
|
|
JsonRpcId,
|
|
JsonRpcInvocationScope,
|
|
JsonRpcInvocationContext,
|
|
JsonRpcRequest,
|
|
JsonRpcSuccessResponse,
|
|
JsonRpcError,
|
|
JsonRpcErrorResponse,
|
|
JsonRpcResponse,
|
|
JsonRpcNotification,
|
|
JsonRpcMessage,
|
|
JsonRpcErrorCode,
|
|
PluginRpcErrorCode,
|
|
PluginInvocationScope,
|
|
PluginInvocationContext,
|
|
WorkerHostCallContext,
|
|
InitializeParams,
|
|
InitializeResult,
|
|
ConfigChangedParams,
|
|
ValidateConfigParams,
|
|
OnEventParams,
|
|
RunJobParams,
|
|
GetDataParams,
|
|
PerformActionParams,
|
|
PluginPerformActionActorType,
|
|
PluginPerformActionActorContext,
|
|
PluginPerformActionContext,
|
|
ExecuteToolParams,
|
|
ListConnectorToolsParams,
|
|
ListConnectorToolsResult,
|
|
PluginExternalObjectUrlCandidate,
|
|
PluginExternalObjectSourceContext,
|
|
DetectExternalObjectsParams,
|
|
PluginExternalObjectDetection,
|
|
DetectExternalObjectsResult,
|
|
PluginExternalObjectRecordSnapshot,
|
|
ResolveExternalObjectParams,
|
|
PluginExternalObjectResolvedSnapshot,
|
|
PluginExternalObjectResolveResult,
|
|
RefreshExternalObjectsParams,
|
|
RefreshExternalObjectsResult,
|
|
PluginEnvironmentDiagnostic,
|
|
PluginEnvironmentDriverBaseParams,
|
|
PluginEnvironmentValidateConfigParams,
|
|
PluginEnvironmentValidationResult,
|
|
PluginEnvironmentProbeParams,
|
|
PluginEnvironmentProbeResult,
|
|
PluginEnvironmentLease,
|
|
PluginEnvironmentWorkspaceAllocationFiles,
|
|
PluginEnvironmentAcquireLeaseParams,
|
|
PluginEnvironmentResumeLeaseParams,
|
|
PluginEnvironmentReleaseLeaseParams,
|
|
PluginEnvironmentTerminationReceipt,
|
|
PluginEnvironmentDestroyLeaseParams,
|
|
PluginEnvironmentInspectLeaseParams,
|
|
PluginEnvironmentLeaseObservation,
|
|
PluginEnvironmentRealizeWorkspaceParams,
|
|
PluginEnvironmentRealizeWorkspaceResult,
|
|
PluginEnvironmentExecuteParams,
|
|
PluginEnvironmentExecuteResult,
|
|
PluginEnvironmentRunnerIngressEndpointParams,
|
|
PluginEnvironmentRunnerIngressEndpoint,
|
|
PluginSyncFileMapping,
|
|
PluginPostUploadCommand,
|
|
PluginSyncOperation,
|
|
PluginEnvironmentSyncInParams,
|
|
PluginEnvironmentSyncOutParams,
|
|
PluginEnvironmentSyncResult,
|
|
PluginEnvironmentInteractiveSetupStatus,
|
|
PluginEnvironmentInteractiveSetupConnectionType,
|
|
PluginEnvironmentTemplateRefKind,
|
|
PluginEnvironmentInteractiveSetupConnectionSummary,
|
|
PluginEnvironmentInteractiveSetupConnectionPayload,
|
|
PluginEnvironmentInteractiveSetupSession,
|
|
PluginEnvironmentStartInteractiveSetupParams,
|
|
PluginEnvironmentGetInteractiveSetupParams,
|
|
PluginEnvironmentCaptureTemplateParams,
|
|
PluginEnvironmentCaptureTemplateResult,
|
|
PluginEnvironmentCancelInteractiveSetupParams,
|
|
PluginEnvironmentCancelInteractiveSetupResult,
|
|
PluginEnvironmentDeleteTemplateParams,
|
|
PluginEnvironmentDeleteTemplateResult,
|
|
PluginLoginCommandKey,
|
|
PluginLoginPtyOpenParams,
|
|
PluginLoginPtyOpenResult,
|
|
PluginLoginPtyInputParams,
|
|
PluginLoginPtyReadCredentialParams,
|
|
PluginLoginPtyReadCredentialResult,
|
|
PluginLoginPtyStopParams,
|
|
PluginLoginPtyCloseParams,
|
|
PluginLoginPtyCloseResult,
|
|
PluginModalBoundsRequest,
|
|
PluginRenderCloseEvent,
|
|
PluginLauncherRenderContextSnapshot,
|
|
HostToWorkerMethods,
|
|
HostToWorkerMethodName,
|
|
WorkerToHostMethods,
|
|
WorkerToHostMethodName,
|
|
HostToWorkerRequest,
|
|
HostToWorkerResponse,
|
|
WorkerToHostRequest,
|
|
WorkerToHostResponse,
|
|
WorkerToHostNotifications,
|
|
WorkerToHostNotificationName,
|
|
} from "./protocol.js";
|
|
|
|
// Plugin context and all client interfaces
|
|
export type {
|
|
PluginContext,
|
|
PluginConfigClient,
|
|
PluginLocalFolderProblem,
|
|
PluginLocalFolderStatus,
|
|
PluginLocalFolderConfigureInput,
|
|
PluginLocalFolderListOptions,
|
|
PluginLocalFolderEntry,
|
|
PluginLocalFolderListing,
|
|
PluginLocalFoldersClient,
|
|
PluginEventsClient,
|
|
ResourceLifecycleEvent,
|
|
ResourceLifecycleResult,
|
|
PluginJobsClient,
|
|
PluginLaunchersClient,
|
|
PluginHttpClient,
|
|
PluginSecretsClient,
|
|
PluginActivityClient,
|
|
PluginActivityLogEntry,
|
|
PluginStateClient,
|
|
PluginEntitiesClient,
|
|
PluginProjectsClient,
|
|
PluginExecutionWorkspacesClient,
|
|
PluginSkillsClient,
|
|
PluginCompaniesClient,
|
|
PluginIssuesClient,
|
|
PluginIssueMutationActor,
|
|
PluginIssueRelationsClient,
|
|
PluginIssueRelationSummary,
|
|
PluginIssueCheckoutOwnership,
|
|
PluginIssueWakeupResult,
|
|
PluginIssueWakeupBatchResult,
|
|
PluginIssueRunSummary,
|
|
PluginIssueApprovalSummary,
|
|
PluginIssueCostSummary,
|
|
PluginBudgetIncidentSummary,
|
|
PluginIssueInvocationBlockSummary,
|
|
PluginIssueOrchestrationSummary,
|
|
PluginIssueSubtreeOptions,
|
|
PluginIssueAssigneeSummary,
|
|
PluginIssueSubtree,
|
|
PluginIssueSummariesClient,
|
|
PluginAgentsClient,
|
|
PluginAgentRuntimeState,
|
|
PluginAgentRuntimeIdentity,
|
|
PluginAgentConnectionAssignments,
|
|
PluginAgentRuntimeSkill,
|
|
PluginAccessClient,
|
|
PluginAccessMembersClient,
|
|
PluginAccessInvitesClient,
|
|
PluginAccessMember,
|
|
PluginAccessInvite,
|
|
PluginAuthorizationClient,
|
|
PluginAuthorizationPolicySummary,
|
|
PluginAuthorizationPolicyRecord,
|
|
PluginAssignmentPreviewInput,
|
|
PluginAuthorizationDecisionResult,
|
|
PluginAuthorizationAuditEntry,
|
|
PluginAgentSessionsClient,
|
|
AgentSession,
|
|
AgentSessionEvent,
|
|
AgentSessionSendResult,
|
|
PluginGoalsClient,
|
|
PluginDataClient,
|
|
PluginActionsClient,
|
|
PluginStreamsClient,
|
|
PluginToolsClient,
|
|
PluginConnectorsClient,
|
|
ConnectionCredential,
|
|
ToolRunConnection,
|
|
ConnectorToolListConnection,
|
|
ConnectorToolDescriptor,
|
|
ConnectorToolRunContext,
|
|
PluginMetricsClient,
|
|
PluginTelemetryClient,
|
|
PluginLogger,
|
|
PluginTracer,
|
|
PluginSpan,
|
|
} from "./types.js";
|
|
|
|
// Tracer no-op default (a value, so it re-exports here, not in the type block).
|
|
export { NOOP_PLUGIN_TRACER, NOOP_PLUGIN_SPAN } from "./types.js";
|
|
|
|
// Supporting types for context clients
|
|
export type {
|
|
ScopeKey,
|
|
EventFilter,
|
|
PluginEvent,
|
|
PluginJobContext,
|
|
PluginLauncherRegistration,
|
|
ToolRunContext,
|
|
ToolResult,
|
|
PluginEntityUpsert,
|
|
PluginEntityRecord,
|
|
PluginEntityQuery,
|
|
PluginWorkspace,
|
|
PluginProjectSnapshot,
|
|
PluginExecutionWorkspaceMetadata,
|
|
Company,
|
|
Project,
|
|
Issue,
|
|
IssueComment,
|
|
IssueDocumentSummary,
|
|
Agent,
|
|
Goal,
|
|
PermissionKey,
|
|
PrincipalPermissionGrant,
|
|
PrincipalType,
|
|
PluginDatabaseClient,
|
|
HumanCompanyMembershipRole,
|
|
MembershipStatus,
|
|
EnvSecretRefBinding,
|
|
} from "./types.js";
|
|
|
|
// Manifest and constant types re-exported from @paperclipai/shared
|
|
// Plugin authors import manifest types from here so they have a single
|
|
// dependency (@paperclipai/plugin-sdk) for all plugin authoring needs.
|
|
export type {
|
|
PaperclipPluginManifestV1,
|
|
PluginJobDeclaration,
|
|
PluginWebhookDeclaration,
|
|
PluginToolDeclaration,
|
|
PluginEnvironmentDriverDeclaration,
|
|
PluginEnvironmentTemplateConfigBinding,
|
|
PluginManagedAgentDeclaration,
|
|
PluginManagedAgentResolution,
|
|
PluginManagedProjectDeclaration,
|
|
PluginManagedProjectResolution,
|
|
PluginManagedRoutineDeclaration,
|
|
PluginManagedRoutineResolution,
|
|
PluginManagedSkillDeclaration,
|
|
PluginManagedSkillFileDeclaration,
|
|
PluginManagedSkillResolution,
|
|
CompanySkill,
|
|
PluginManagedResourceKind,
|
|
PluginManagedResourceRef,
|
|
PluginUiSlotDeclaration,
|
|
PluginUiDeclaration,
|
|
PluginLauncherActionDeclaration,
|
|
PluginLauncherRenderDeclaration,
|
|
PluginLauncherDeclaration,
|
|
PluginMinimumHostVersion,
|
|
PluginDatabaseDeclaration,
|
|
PluginApiRouteCompanyResolution,
|
|
PluginApiRouteDeclaration,
|
|
PluginLocalFolderDeclaration,
|
|
PluginCompanySettings,
|
|
PluginObjectReferenceRefreshPolicy,
|
|
PluginObjectReferenceProviderDeclaration,
|
|
PluginRecord,
|
|
PluginDatabaseNamespaceRecord,
|
|
PluginMigrationRecord,
|
|
PluginConfig,
|
|
JsonSchema,
|
|
PluginStatus,
|
|
PluginCategory,
|
|
PluginCapability,
|
|
PluginUiSlotType,
|
|
PluginUiSlotEntityType,
|
|
PluginLauncherPlacementZone,
|
|
PluginLauncherAction,
|
|
PluginLauncherBounds,
|
|
PluginLauncherRenderEnvironment,
|
|
PluginStateScopeKind,
|
|
PluginJobStatus,
|
|
PluginJobRunStatus,
|
|
PluginJobRunTrigger,
|
|
PluginWebhookDeliveryStatus,
|
|
PluginDatabaseCoreReadTable,
|
|
PluginDatabaseMigrationStatus,
|
|
PluginDatabaseNamespaceMode,
|
|
PluginDatabaseNamespaceStatus,
|
|
PluginApiRouteAuthMode,
|
|
PluginApiRouteCheckoutPolicy,
|
|
PluginApiRouteMethod,
|
|
PluginEventType,
|
|
PluginBridgeErrorCode,
|
|
ConnectionIntentInteraction,
|
|
ConnectionIntentPayload,
|
|
ConnectionIntentResult,
|
|
ConnectionIntentSetupOptions,
|
|
ConnectionRequestResult,
|
|
ConnectionsSearchResult,
|
|
} from "./types.js";
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Zod re-export
|
|
// ---------------------------------------------------------------------------
|
|
|
|
/**
|
|
* Zod is re-exported for plugin authors to use when defining their
|
|
* `instanceConfigSchema` and tool `parametersSchema`.
|
|
*
|
|
* Plugin authors do not need to add a separate `zod` dependency.
|
|
*
|
|
* @see PLUGIN_SPEC.md §14.1 — Example SDK Shape
|
|
*
|
|
* @example
|
|
* ```ts
|
|
* import { z } from "@paperclipai/plugin-sdk";
|
|
*
|
|
* const configSchema = z.object({
|
|
* apiKey: z.string().describe("Your API key"),
|
|
* workspace: z.string().optional(),
|
|
* });
|
|
* ```
|
|
*/
|
|
export { z } from "zod";
|
|
|
|
// ---------------------------------------------------------------------------
|
|
// Constants re-exports (for plugin code that needs to check values at runtime)
|
|
// ---------------------------------------------------------------------------
|
|
|
|
export {
|
|
PLUGIN_API_VERSION,
|
|
PLUGIN_STATUSES,
|
|
PLUGIN_CATEGORIES,
|
|
PLUGIN_CAPABILITIES,
|
|
PLUGIN_UI_SLOT_TYPES,
|
|
PLUGIN_UI_SLOT_ENTITY_TYPES,
|
|
PLUGIN_RESERVED_COMPANY_SETTINGS_ROUTE_SEGMENTS,
|
|
PLUGIN_STATE_SCOPE_KINDS,
|
|
PLUGIN_JOB_STATUSES,
|
|
PLUGIN_JOB_RUN_STATUSES,
|
|
PLUGIN_JOB_RUN_TRIGGERS,
|
|
PLUGIN_WEBHOOK_DELIVERY_STATUSES,
|
|
PLUGIN_EVENT_TYPES,
|
|
PLUGIN_BRIDGE_ERROR_CODES,
|
|
PERMISSION_KEYS,
|
|
HUMAN_COMPANY_MEMBERSHIP_ROLES,
|
|
HUMAN_COMPANY_MEMBERSHIP_ROLE_LABELS,
|
|
MEMBERSHIP_STATUSES,
|
|
PRINCIPAL_TYPES,
|
|
} from "@paperclipai/shared";
|
|
|
|
export { PluginEnvironmentCreationCleanupError, environmentCreationCleanupErrorData, readEnvironmentCreationCleanupError, readEnvironmentAcquisitionDiagnostic, ENVIRONMENT_ACQUISITION_PROVIDER_STATES } from "./environment-creation-cleanup.js";
|
|
export type { PluginEnvironmentCreationCleanup, PluginEnvironmentAcquisitionDiagnostic, PluginEnvironmentAcquisitionProviderState } from "./environment-creation-cleanup.js";
|
|
export { preserveEnvironmentSyncErrorDiagnostic, environmentSyncErrorData, readEnvironmentSyncErrorDiagnostic, withEnvironmentSyncErrorCapture, withEnvironmentSyncTransferStep, recordEnvironmentSyncError } from "./environment-sync-error.js";
|
|
export type { PluginEnvironmentSyncErrorDiagnostic } from "./environment-sync-error.js";
|
|
export { PluginEnvironmentRunnerIngressError, environmentRunnerIngressErrorData, readEnvironmentRunnerIngressFailure } from "./environment-runner-ingress-error.js";
|
|
export type { PluginEnvironmentRunnerIngressFailure } from "./environment-runner-ingress-error.js";
|
|
export { ENVIRONMENT_TASK_ERROR_CODES, PluginEnvironmentTaskError, environmentTaskErrorCodeData, readEnvironmentTaskErrorCode } from "./environment-task-error.js";
|
|
export type { PluginEnvironmentTaskErrorCode } from "./environment-task-error.js";
|
|
export { WORKSPACE_OPERATION_FAILURE_REASONS, PluginWorkspaceOperationError, workspaceOperationErrorData, readWorkspaceOperationFailureReason } from "./workspace-operation-error.js";
|
|
export type { PluginWorkspaceOperationFailureReason } from "./workspace-operation-error.js";
|
|
export { PluginEnvironmentStopError, environmentStopErrorData, readEnvironmentStopFailure } from "./environment-stop-error.js";
|
|
export type { PluginEnvironmentStopFailure, PluginEnvironmentStopFailureReason } from "./environment-stop-error.js";
|
|
export { environmentResumeErrorData, readEnvironmentResumeErrorDiagnostic } from "./environment-resume-error.js";
|
|
export type { PluginEnvironmentResumeErrorDiagnostic } from "./environment-resume-error.js";
|
|
export { environmentAcquireErrorData, readEnvironmentAcquireErrorDiagnostic } from "./environment-acquire-error.js";
|
|
export type { PluginEnvironmentAcquireErrorDiagnostic } from "./environment-acquire-error.js";
|
|
export { environmentTaskErrorData, readEnvironmentTaskErrorDiagnostic } from "./environment-task-error.js";
|
|
export type { PluginEnvironmentTaskErrorDiagnostic } from "./environment-task-error.js";
|
|
|
|
export type { AiConnectionPool, AiConnectionPoolConfig, AiConnectionPoolMember, AiConnectionRouterRequest, AiConnectionRouterResult, AiConnectionRouterSelection } from "@paperclipai/shared";
|
|
|
|
export { MAX_ENVIRONMENT_TASK_FILE_BYTES, environmentRunnerLaunchRequirementsSchema, environmentTaskOperationSchema, environmentTaskResultSchema, environmentTaskCredentialSchema, environmentTaskConfiguredEnvironmentSchema, MAX_CONFIGURED_ENVIRONMENT_KEYS, MAX_CONFIGURED_ENVIRONMENT_ENTRY_BYTES, MAX_CONFIGURED_ENVIRONMENT_BYTES, parseEnvironmentTaskResult } from "./environment-tasks.js";
|
|
export type { PluginEnvironmentTaskOperation, PluginEnvironmentTaskParams, PluginEnvironmentTaskResult, PluginEnvironmentTaskCredential, PluginEnvironmentTaskConfiguredEnvironment, PluginEnvironmentTaskExecutionContext } from "./environment-tasks.js";
|
|
export type { AgentLifecycleRequest, AgentLifecycleResult } from "@paperclipai/shared";
|
|
|
|
export type { PluginEnvironmentRunnerLaunchRequirements, PluginEnvironmentPreparedLaunch } from "./environment-tasks.js";
|
|
|
|
export * from "./workspace-provider.js";
|