mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-12-02 02:30:43 +01:00
Merge master and reconcile Dot with the released MCP gateway
Reuse scoped browser and device consent, verified client metadata, signed event admissions and warm-standby gates. Preserve the dedicated agent resource and Runner authority. Regenerate the Dot-only migration after the merged gateway history and cover issuer, company, viewer and token isolation. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
commit
1be3f69703
1212 files changed
+142427
-60490
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { AGENT_COMMENTARY_MAX_LENGTH, submitAgentCommentarySchema } from "./validators/agent-commentary.js";
|
||||
|
||||
describe("agent commentary input", () => {
|
||||
const input = { kind: "complaint", body: "WHY 😭\n\nThis tool again.", idempotencyKey: "one" };
|
||||
it("preserves free-form text and the document-sized ceiling", () => {
|
||||
expect(submitAgentCommentarySchema.parse(input)).toEqual(input);
|
||||
const body = "🙂".repeat(AGENT_COMMENTARY_MAX_LENGTH / 2);
|
||||
expect(submitAgentCommentarySchema.parse({ ...input, kind: "suggestion", body }).body).toBe(body);
|
||||
expect(submitAgentCommentarySchema.safeParse({ ...input, body: body + "x" }).success).toBe(false);
|
||||
});
|
||||
it.each([
|
||||
{ body: " \n\t" }, { kind: "other" }, { idempotencyKey: "" }, { idempotencyKey: "x".repeat(241) },
|
||||
{ agentId: "spoof" }, { companyId: "spoof" }, { runId: "spoof" }, { issueId: "spoof" }, { category: "tooling" },
|
||||
])("rejects invalid or caller-owned fields: %j", (change) => {
|
||||
expect(submitAgentCommentarySchema.safeParse({ ...input, ...change }).success).toBe(false);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,48 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { AGGREGATOR_APP_CATALOG, COMPOSIO_APP_TOOLKITS, findComposioCatalogApp, findAggregatorApp } from "./aggregator-app-catalog.js";
|
||||
|
||||
describe("public aggregator app catalog", () => {
|
||||
it("indexes the full snapshots and merges provider routes for the same app", () => {
|
||||
expect(AGGREGATOR_APP_CATALOG.length).toBeGreaterThan(1500);
|
||||
const hubspot = findAggregatorApp("composio", "hubspot")!;
|
||||
expect(hubspot.routes.map((route) => route.provider)).toEqual(["composio", "arcade"]);
|
||||
expect(findAggregatorApp("arcade", "hubspot")).toBe(hubspot);
|
||||
expect(findAggregatorApp("composio", "made-up-toolkit")).toBeUndefined();
|
||||
expect(findAggregatorApp("executor", "hubspot")).toBeUndefined();
|
||||
});
|
||||
|
||||
it("retains every upstream toolkit variant for discovery and maps it to an app card", () => {
|
||||
expect(COMPOSIO_APP_TOOLKITS.length).toBeGreaterThan(1500);
|
||||
expect(COMPOSIO_APP_TOOLKITS.every(toolkit => findComposioCatalogApp(toolkit))).toBe(true);
|
||||
expect(findComposioCatalogApp("circleback_mcp")?.name).toBe("Circleback");
|
||||
expect(findComposioCatalogApp("notion")?.name).toBe("Notion");
|
||||
expect(findComposioCatalogApp("made-up-toolkit")).toBeUndefined();
|
||||
});
|
||||
|
||||
it("keeps real provider toolkit identifiers and public logo/evidence URLs", () => {
|
||||
expect(findAggregatorApp("composio", "active_campaign")?.routes[0]).toMatchObject({
|
||||
toolkit: "active_campaign", logoUrl: "https://logos.composio.dev/api/active_campaign",
|
||||
});
|
||||
for (const app of AGGREGATOR_APP_CATALOG) {
|
||||
expect(app.name).toBeTruthy();
|
||||
expect(new Set(app.routes.map((route) => route.provider)).size).toBe(app.routes.length);
|
||||
for (const route of app.routes) {
|
||||
expect(new URL(route.logoUrl).protocol).toBe("https:");
|
||||
expect(new URL(route.docsUrl).hostname).toBe(`docs.${route.provider}.dev`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
it.each([
|
||||
["close", "closeio"],
|
||||
["excel", "microsoft-excel"],
|
||||
["one_drive", "microsoft-onedrive"],
|
||||
["share_point", "microsoft-sharepoint"],
|
||||
["square", "squareup-api"],
|
||||
["twitter", "x"],
|
||||
])("merges the same service despite different provider branding (%s)", (composioToolkit, arcadeToolkit) => {
|
||||
const app = findAggregatorApp("composio", composioToolkit)!;
|
||||
expect(findAggregatorApp("arcade", arcadeToolkit)).toBe(app);
|
||||
expect(app.routes.map((route) => route.provider)).toEqual(["composio", "arcade"]);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,95 @@
|
||||
import composio from "./composio-search-catalog.json" with { type: "json" };
|
||||
import arcade from "./arcade-app-catalog.json" with { type: "json" };
|
||||
|
||||
export type AppCatalogAggregator = "composio" | "arcade" | "executor";
|
||||
|
||||
export interface AggregatorAppRoute {
|
||||
provider: AppCatalogAggregator;
|
||||
toolkit: string;
|
||||
logoUrl: string;
|
||||
docsUrl: string;
|
||||
}
|
||||
|
||||
export interface AggregatorAppCatalogEntry {
|
||||
slug: string;
|
||||
name: string;
|
||||
aliases: string[];
|
||||
routes: AggregatorAppRoute[];
|
||||
}
|
||||
|
||||
// The public catalogs use different brand names for these same services.
|
||||
const SERVICE_IDENTITY_ALIASES = new Map([
|
||||
["closeio", "close"],
|
||||
["microsoftexcel", "excel"],
|
||||
["microsoftonedrive", "onedrive"],
|
||||
["microsoftsharepoint", "sharepoint"],
|
||||
["squareup", "square"],
|
||||
["x", "twitter"],
|
||||
]);
|
||||
|
||||
/** Public discovery metadata only. A listing does not establish app authorization. */
|
||||
export function aggregatorAppIdentity(value: string): string {
|
||||
const identity = value.toLowerCase().replace(/\s+(mcp|api)$/i, "")
|
||||
.replace(/[^a-z0-9]/g, "");
|
||||
return SERVICE_IDENTITY_ALIASES.get(identity) ?? identity;
|
||||
}
|
||||
|
||||
const entries = new Map<string, AggregatorAppCatalogEntry>();
|
||||
function add(name: string, slug: string, aliases: string[], route: AggregatorAppRoute) {
|
||||
const identity = aggregatorAppIdentity(name);
|
||||
const existing = entries.get(identity);
|
||||
if (existing) {
|
||||
existing.aliases = [...new Set([...existing.aliases, name, slug, ...aliases])];
|
||||
// Prefer the ordinary toolkit over an API/MCP variant from the same provider.
|
||||
if (!existing.routes.some((candidate) => candidate.provider === route.provider)) {
|
||||
existing.routes.push(route);
|
||||
}
|
||||
return;
|
||||
}
|
||||
entries.set(identity, { slug, name: name.replace(/\s+(MCP|API)$/i, ""), aliases, routes: [route] });
|
||||
}
|
||||
|
||||
for (const [toolkit, name] of composio.toolkits) {
|
||||
add(name, toolkit.replaceAll("_", "-").replace(/^-+/, ""), [toolkit], {
|
||||
provider: "composio", toolkit,
|
||||
logoUrl: `https://logos.composio.dev/api/${toolkit}`,
|
||||
docsUrl: `https://docs.composio.dev/toolkits/${toolkit}`,
|
||||
});
|
||||
}
|
||||
for (const app of arcade.apps) {
|
||||
add(app.name, app.slug, app.aliases, {
|
||||
provider: "arcade", toolkit: app.toolkit, logoUrl: app.logoUrl, docsUrl: app.docsUrl,
|
||||
});
|
||||
}
|
||||
|
||||
export const AGGREGATOR_APP_CATALOG = [...entries.values()].sort((a, b) =>
|
||||
a.name.localeCompare(b.name, "en", { sensitivity: "base" }) || a.slug.localeCompare(b.slug));
|
||||
|
||||
/** Include provider variants and native overlaps when checking existing accounts. */
|
||||
export const COMPOSIO_APP_TOOLKITS = composio.toolkits.map(([toolkit]) => toolkit);
|
||||
|
||||
export function findComposioCatalogApp(toolkit: string) {
|
||||
return AGGREGATOR_APP_CATALOG.find(app => app.routes.some(route => route.provider === "composio")
|
||||
&& (app.aliases.includes(toolkit) || app.routes.some(route => route.provider === "composio" && route.toolkit === toolkit)));
|
||||
}
|
||||
|
||||
export function findAggregatorApp(provider: string, toolkit: string | null | undefined) {
|
||||
if (!toolkit) return undefined;
|
||||
return AGGREGATOR_APP_CATALOG.find((app) =>
|
||||
app.routes.some((route) => route.provider === provider)
|
||||
&& (app.routes.some(route => route.provider === provider && route.toolkit === toolkit) || app.aliases.includes(toolkit)));
|
||||
}
|
||||
|
||||
/** Executor supports custom integrations. Only exact known service identities share branding. */
|
||||
export function resolveAggregatorApp(provider: AppCatalogAggregator, toolkit: string, name?: string) {
|
||||
const known = provider === "composio" ? findComposioCatalogApp(toolkit) : findAggregatorApp(provider, toolkit)
|
||||
?? AGGREGATOR_APP_CATALOG.find(app => app.routes.some(route => route.provider === provider)
|
||||
&& [app.slug, ...app.aliases].some(alias => aggregatorAppIdentity(alias) === aggregatorAppIdentity(toolkit)));
|
||||
if (known) return { slug: known.slug, name: known.name };
|
||||
if (provider === "executor") {
|
||||
const identity = aggregatorAppIdentity(toolkit);
|
||||
const match = AGGREGATOR_APP_CATALOG.find(app => [app.slug, ...app.aliases].some(alias => aggregatorAppIdentity(alias) === identity));
|
||||
if (match) return { slug: match.slug, name: match.name };
|
||||
}
|
||||
return { slug: `${provider}:${toolkit}`, name: name || toolkit };
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
import { z } from "zod";
|
||||
import type { ComposioAppSnapshot, ComposioAppSyncState } from "./composio-app-setup.js";
|
||||
import type { AppCatalogAggregator } from "./aggregator-app-catalog.js";
|
||||
|
||||
export const AGGREGATOR_NAMES = { composio: "Composio", arcade: "Arcade", executor: "Executor" } as const;
|
||||
export function isAppAggregator(value: unknown): value is AppCatalogAggregator {
|
||||
return typeof value === "string" && Object.hasOwn(AGGREGATOR_NAMES, value);
|
||||
}
|
||||
|
||||
/** Cached upstream observations. These neither grant access nor create tool connections. */
|
||||
export interface AggregatorAppSnapshot extends ComposioAppSnapshot {
|
||||
provider: AppCatalogAggregator;
|
||||
appSlug: string;
|
||||
appName: string;
|
||||
freshness: "fresh" | "stale";
|
||||
}
|
||||
export interface AggregatorAppsResponse {
|
||||
provider: AppCatalogAggregator;
|
||||
apps: AggregatorAppSnapshot[];
|
||||
discovery: {
|
||||
availability: "available" | "setup_required" | "unsupported" | "disabled";
|
||||
message: string | null;
|
||||
};
|
||||
sync: Omit<ComposioAppSyncState, "coverage"> & {
|
||||
coverage: "supported_catalog" | "gateway_tools" | "visible_accounts";
|
||||
};
|
||||
}
|
||||
export const aggregatorAppsSyncSchema = z.object({ force: z.boolean().default(false) }).strict();
|
||||
export const aggregatorAppsRefreshSchema = z.object({
|
||||
toolkits: z.array(z.string().min(1).max(200)).max(64).default([]),
|
||||
}).strict();
|
||||
export const arcadeDiscoverySetupSchema = z.object({
|
||||
apiKey: z.string().trim().min(1).max(8192),
|
||||
userId: z.string().trim().min(1).max(500),
|
||||
}).strict();
|
||||
export type ArcadeDiscoverySetupInput = z.infer<typeof arcadeDiscoverySetupSchema>;
|
||||
|
||||
/** Only trustworthy browser destinations; never expose URL credentials or active schemes. */
|
||||
export function aggregatorManagementUrl(provider: AppCatalogAggregator, configured?: string | null): string | null {
|
||||
if (configured) {
|
||||
try {
|
||||
const url = new URL(configured);
|
||||
if (url.protocol !== "https:" || url.username || url.password || [...url.searchParams.keys()].some(key => /token|secret|api.?key|authorization|code/i.test(key))) return null;
|
||||
if (provider === "composio" && url.hostname !== "dashboard.composio.dev") return null;
|
||||
if (provider === "arcade" && url.hostname !== "app.arcade.dev") return null;
|
||||
return url.toString();
|
||||
} catch { return null; }
|
||||
}
|
||||
return provider === "composio" ? "https://dashboard.composio.dev/~/org/connect/apps"
|
||||
: provider === "arcade" ? "https://app.arcade.dev/" : null;
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
import { z } from "zod";
|
||||
import { aiConnectionBindingSchema, type AiConnectionBinding } from "./ai-connections.js";
|
||||
import type { AiConnectionUsage } from "./ai-connection-usage.js";
|
||||
|
||||
export const aiConnectionRouterBindingSchema = z.object({
|
||||
mode: z.literal("router"),
|
||||
connectionId: z.string().uuid(),
|
||||
}).strict();
|
||||
export const aiRuntimeConnectionBindingSchema = z.union([aiConnectionBindingSchema, aiConnectionRouterBindingSchema]);
|
||||
export type AiRuntimeConnectionBinding = z.infer<typeof aiRuntimeConnectionBindingSchema>;
|
||||
|
||||
export const aiConnectionPoolMemberSchema = z.object({
|
||||
id: z.string().uuid(),
|
||||
binding: aiConnectionBindingSchema.refine((v) => v.mode !== "responsible_user", "Select an explicit account grant"),
|
||||
profile: z.object({
|
||||
provider: z.enum(["codex", "acpx", "opencode"]),
|
||||
acpxAgent: z.enum(["claude", "grok"]).optional(),
|
||||
model: z.string().trim().min(1).max(256),
|
||||
effort: z.string().trim().min(1).max(32).optional(),
|
||||
}).strict(),
|
||||
}).strict();
|
||||
export const aiConnectionPoolConfigSchema = z.object({
|
||||
name: z.string().trim().min(1).max(160),
|
||||
enabled: z.boolean().default(false),
|
||||
mode: z.enum(["round_robin", "usage_aware"]).default("round_robin"),
|
||||
thresholdPercent: z.number().int().min(1).max(100).default(90),
|
||||
members: z.array(aiConnectionPoolMemberSchema).min(1).max(100),
|
||||
}).strict().superRefine((v, ctx) => {
|
||||
const ids = new Set<string>();
|
||||
const grants = new Set<string>();
|
||||
const connections = new Set<string>();
|
||||
for (const [index, member] of v.members.entries()) {
|
||||
const grant = `${member.binding.connectionId}:${member.binding.grantId}`;
|
||||
if (ids.has(member.id) || grants.has(grant) || connections.has(member.binding.connectionId)) ctx.addIssue({ code: "custom", path: ["members", index], message: "Duplicate pool member" });
|
||||
ids.add(member.id); grants.add(grant); connections.add(member.binding.connectionId);
|
||||
if (member.profile.provider === "acpx" && !member.profile.acpxAgent) ctx.addIssue({ code: "custom", path: ["members", index, "profile"], message: "Choose an ACP harness" });
|
||||
}
|
||||
});
|
||||
export type AiConnectionPoolMember = z.infer<typeof aiConnectionPoolMemberSchema>;
|
||||
export type AiConnectionPoolConfig = z.infer<typeof aiConnectionPoolConfigSchema>;
|
||||
export interface AiConnectionPool extends AiConnectionPoolConfig {
|
||||
id: string;
|
||||
companyId: string;
|
||||
pluginKey: string;
|
||||
revision: number;
|
||||
}
|
||||
/** Host-authorized metadata only. No credentials or raw provider responses. */
|
||||
export interface AiConnectionRouterRequest {
|
||||
companyId: string;
|
||||
pool: AiConnectionPool;
|
||||
agentId: string;
|
||||
taskKey: string;
|
||||
lastMemberId: string | null;
|
||||
cursorVersion: number;
|
||||
/** Opaque IDs preserve order without exposing unauthorized account metadata. */
|
||||
memberOrder: string[];
|
||||
pinnedMemberId?: string;
|
||||
candidates: Array<{ member: AiConnectionPoolMember; runtimeConfig: Record<string, unknown>; notes: string[]; usage?: AiConnectionUsage }>;
|
||||
now: string;
|
||||
}
|
||||
export type AiConnectionRouterResult =
|
||||
| { kind: "selected"; memberId: string; skipped?: Record<string, string> }
|
||||
| { kind: "exhausted"; retryAt: string; skipped: Record<string, string> }
|
||||
| { kind: "unavailable"; skipped: Record<string, string> };
|
||||
export interface AiConnectionPoolSaveInput {
|
||||
companyId: string;
|
||||
id?: string;
|
||||
expectedRevision?: number;
|
||||
config: AiConnectionPoolConfig;
|
||||
}
|
||||
export interface AiConnectionRouterSelection {
|
||||
poolId: string;
|
||||
memberId: string;
|
||||
binding: AiConnectionBinding;
|
||||
runtimeConfig: Record<string, unknown>;
|
||||
notes: string[];
|
||||
}
|
||||
|
||||
/** Stable, collision-free catalog identity across plugin reinstallations. */
|
||||
export function aiConnectionRouterSlug(pluginKey: string): string {
|
||||
return `ai-router-${Array.from(pluginKey, character => character.charCodeAt(0).toString(16).padStart(2, "0")).join("")}`;
|
||||
}
|
||||
|
||||
export function aiConnectionRouterAppDefinition(pluginKey: string, descriptor: { name: string; description: string }, availability = { available: true } as { available: boolean; reason?: string }): import("./types/app-definition.js").AppDefinition {
|
||||
return {
|
||||
schemaVersion: 1, slug: aiConnectionRouterSlug(pluginKey), ...descriptor,
|
||||
categories: ["ai"], branding: { logoUrl: "/brands/apps/connection-pool.svg" }, urlPatterns: [],
|
||||
aiConnectionRouter: { pluginKey }, availability,
|
||||
methods: [],
|
||||
};
|
||||
}
|
||||
|
||||
export function aiConnectionRouterPluginKey(connection: { config?: Record<string, unknown> | null }): string | null {
|
||||
const router = connection.config?.aiRouter;
|
||||
return router && typeof router === "object" && "pluginKey" in router && typeof router.pluginKey === "string" ? router.pluginKey : null;
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { z } from "zod";
|
||||
import { aiProviderRoutingSchema, aiRoutingHarness, isAiRoutingCompatible, type AiProviderRouting } from "./ai-provider-routing.js";
|
||||
|
||||
/** Runtime authentication is a separate transport, never a tool or channel. */
|
||||
export const connectionPurposeTransportSchema = z.discriminatedUnion(
|
||||
@@ -31,6 +32,7 @@ export const AI_PROVIDERS = [
|
||||
"openai",
|
||||
"openrouter",
|
||||
"xai",
|
||||
"google",
|
||||
] as const;
|
||||
export const aiProviderSchema = z.enum(AI_PROVIDERS);
|
||||
export const aiAuthMethodSchema = z.enum(["subscription", "api_key"]);
|
||||
@@ -56,7 +58,7 @@ export const aiConnectionBindingSchema = z.discriminatedUnion("mode", [
|
||||
z
|
||||
.object({
|
||||
...requirement,
|
||||
// Legacy wire format only; human access still applies. New UI never creates it.
|
||||
// Explicit personal selection. Human access still applies on every run.
|
||||
mode: z.literal("delegated"),
|
||||
connectionId: z.string().uuid(),
|
||||
grantId: z.string().uuid(),
|
||||
@@ -64,7 +66,7 @@ export const aiConnectionBindingSchema = z.discriminatedUnion("mode", [
|
||||
.strict(),
|
||||
]);
|
||||
export type AiConnectionBinding = z.infer<typeof aiConnectionBindingSchema>;
|
||||
export const aiConnectionMetadataSchema = z.object(requirement).strict();
|
||||
export const aiConnectionMetadataSchema = z.object({ ...requirement, routing: aiProviderRoutingSchema.optional() }).strict();
|
||||
export type AiConnectionMetadata = z.infer<typeof aiConnectionMetadataSchema>;
|
||||
|
||||
/** Existing integrations only. This table describes compatibility, never routing. */
|
||||
@@ -77,6 +79,7 @@ export const AI_CONNECTION_CAPABILITIES: Record<
|
||||
>;
|
||||
}
|
||||
> = {
|
||||
google: { name: "Google", methods: { api_key: { adapters: ["gemini_local"], envKey: "GEMINI_API_KEY" } } },
|
||||
anthropic: {
|
||||
name: "Claude",
|
||||
methods: {
|
||||
@@ -115,18 +118,12 @@ export function isAiConnectionCompatible(
|
||||
runnerProvider?: unknown,
|
||||
acpxAgent?: unknown,
|
||||
): boolean {
|
||||
if (adapterType === "paperclip_runner")
|
||||
adapterType =
|
||||
runnerProvider === "claude" ||
|
||||
(runnerProvider === "acpx" && acpxAgent === "claude")
|
||||
? "claude_local"
|
||||
: runnerProvider === "acpx" && acpxAgent === "grok"
|
||||
? "grok_local"
|
||||
: runnerProvider === "codex"
|
||||
? "codex_local"
|
||||
: runnerProvider === "opencode"
|
||||
? "opencode_local"
|
||||
: "unsupported";
|
||||
adapterType = aiRoutingHarness(adapterType, runnerProvider, acpxAgent);
|
||||
if ("routing" in requirement && requirement.routing) return requirement.method === "api_key" && isAiRoutingCompatible(requirement.routing, adapterType);
|
||||
// A fixed binding contains identity only. The service checks authoritative
|
||||
// connection metadata before resolving credentials or running the harness.
|
||||
if ("mode" in requirement && requirement.mode !== "responsible_user" && requirement.method === "api_key")
|
||||
return ["claude_local", "codex_local", "opencode_local", "hermes_local", "gemini_local", "grok_local"].includes(adapterType);
|
||||
const methods = AI_CONNECTION_CAPABILITIES[requirement.provider].methods;
|
||||
const candidates = "mode" in requirement && requirement.mode === "responsible_user"
|
||||
? Object.values(methods)
|
||||
@@ -165,6 +162,7 @@ export interface AiManagedConnectionSummary {
|
||||
provider: AiProvider;
|
||||
method: AiAuthMethod;
|
||||
name: string;
|
||||
routing?: AiProviderRouting;
|
||||
accountLabel?: string;
|
||||
ownership: "personal" | "shared";
|
||||
ownerUserId?: string;
|
||||
@@ -176,6 +174,7 @@ export interface AiManagedConnectionSummary {
|
||||
}
|
||||
export interface AiConnectionList {
|
||||
currentUserId: string;
|
||||
pools?: import("./ai-connection-router.js").AiConnectionPool[];
|
||||
canManageConnections: boolean;
|
||||
connections: AiManagedConnectionSummary[];
|
||||
}
|
||||
@@ -184,6 +183,7 @@ export const createAiConnectionSchema = z
|
||||
...requirement,
|
||||
name: z.string().trim().min(1).max(160),
|
||||
ownership: z.enum(["personal", "shared"]),
|
||||
routing: aiProviderRoutingSchema.optional(),
|
||||
apiKey: z.string().trim().min(1).max(32768).optional(),
|
||||
loginSessionId: z.string().max(128).optional(),
|
||||
connectionId: z.string().uuid().optional(),
|
||||
@@ -194,6 +194,14 @@ export const createAiConnectionSchema = z
|
||||
.superRefine((v, ctx) => {
|
||||
if (!AI_CONNECTION_CAPABILITIES[v.provider].methods[v.method])
|
||||
ctx.addIssue({ code: "custom", message: "Unsupported sign-in method" });
|
||||
if (v.routing && (v.method !== "api_key" || (v.routing.kind === "openrouter" && v.provider !== "openrouter") || (v.routing.kind === "bedrock" && v.provider !== "anthropic")))
|
||||
ctx.addIssue({ code: "custom", message: "Routing requires the matching provider and API authentication." });
|
||||
if (v.routing && ["gateway", "local"].includes(v.routing.kind) && v.provider !== (v.routing.protocol === "messages" ? "anthropic" : "openai"))
|
||||
ctx.addIssue({ code: "custom", message: "The provider must match the endpoint’s API format." });
|
||||
if (v.routing?.auth === "none") {
|
||||
if (v.apiKey || v.loginSessionId) ctx.addIssue({ code: "custom", message: "Provide only the selected authentication method." });
|
||||
return;
|
||||
}
|
||||
if (
|
||||
v.method === "api_key"
|
||||
? !v.apiKey || Boolean(v.loginSessionId)
|
||||
@@ -210,7 +218,7 @@ export type CreateAiConnection = z.infer<typeof createAiConnectionSchema>;
|
||||
|
||||
export const aiConnectionLoginIntentSchema = z
|
||||
.object({
|
||||
provider: aiProviderSchema,
|
||||
provider: z.enum(["anthropic", "openai", "xai"]),
|
||||
method: z.literal("subscription"),
|
||||
name: z.string().trim().min(1).max(160),
|
||||
ownership: z.enum(["personal", "shared"]),
|
||||
@@ -229,10 +237,14 @@ export const localAiConnectionSchema = aiConnectionLoginIntentSchema.extend({
|
||||
export const localAiLoginStartSchema = aiConnectionLoginIntentSchema.extend({ restart: z.boolean().optional() });
|
||||
export interface LocalAiLoginStatus {
|
||||
status: "ready" | "sign_in_required" | "expired";
|
||||
authorizationUrl?: string;
|
||||
code?: string;
|
||||
error?: string;
|
||||
}
|
||||
export interface LocalAiLoginAttempt {
|
||||
sessionId: string;
|
||||
command: string;
|
||||
/** Grok still uses terminal sign-in until it has an in-app login runner. */
|
||||
command?: string;
|
||||
expiresAt: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,158 @@
|
||||
import { z } from "zod";
|
||||
|
||||
/** Value-free routing stored on the connection, never supplied by an agent binding. */
|
||||
export const aiProviderRoutingSchema = z
|
||||
.object({
|
||||
kind: z.enum(["openrouter", "bedrock", "gateway", "local"]),
|
||||
protocol: z.enum(["responses", "messages", "chat", "bedrock"]),
|
||||
baseUrl: z.string().trim().max(2048).optional(),
|
||||
auth: z
|
||||
.enum(["bearer", "api_key", "none"])
|
||||
.default("bearer"),
|
||||
region: z
|
||||
.string()
|
||||
.regex(/^[a-z]{2}(?:-[a-z]+)+-\d$/)
|
||||
.optional(),
|
||||
models: z
|
||||
.array(
|
||||
z
|
||||
.object({
|
||||
id: z.string().trim().min(1).max(256),
|
||||
label: z.string().trim().max(160).optional(),
|
||||
})
|
||||
.strict(),
|
||||
)
|
||||
.max(200)
|
||||
.default([]),
|
||||
})
|
||||
.strict()
|
||||
.superRefine((route, ctx) => {
|
||||
const invalid = (message: string) =>
|
||||
ctx.addIssue({ code: "custom", message });
|
||||
if (route.kind === "bedrock") {
|
||||
if (
|
||||
route.protocol !== "bedrock" ||
|
||||
!route.region ||
|
||||
route.auth !== "bearer" ||
|
||||
route.baseUrl
|
||||
)
|
||||
invalid(
|
||||
"Bedrock requires a region and a Bedrock API key.",
|
||||
);
|
||||
} else if (
|
||||
route.protocol === "bedrock" ||
|
||||
route.region
|
||||
)
|
||||
invalid("AWS settings require Bedrock.");
|
||||
if (
|
||||
route.kind === "openrouter" &&
|
||||
(route.baseUrl || route.auth !== "bearer")
|
||||
)
|
||||
invalid("OpenRouter uses its official endpoint and an API key.");
|
||||
if (route.auth === "api_key" && route.protocol !== "messages")
|
||||
invalid("API-key header authentication requires Anthropic Messages.");
|
||||
if (route.kind === "gateway" || route.kind === "local") {
|
||||
try {
|
||||
const url = new URL(route.baseUrl ?? "");
|
||||
const loopback = ["localhost", "127.0.0.1", "[::1]"].includes(
|
||||
url.hostname,
|
||||
);
|
||||
if (
|
||||
url.username ||
|
||||
url.password ||
|
||||
url.search ||
|
||||
url.hash ||
|
||||
(url.protocol !== "https:" && !(url.protocol === "http:" && loopback))
|
||||
)
|
||||
throw new Error();
|
||||
if (route.kind === "local" && !loopback)
|
||||
invalid("A local endpoint must use localhost or a loopback address.");
|
||||
} catch {
|
||||
invalid(
|
||||
"Enter an HTTPS base URL without credentials, query parameters, or a fragment. Local endpoints may use HTTP.",
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
export type AiProviderRouting = z.infer<typeof aiProviderRoutingSchema>;
|
||||
export function aiRoutingHarness(
|
||||
adapter: string,
|
||||
provider?: unknown,
|
||||
acpxAgent?: unknown,
|
||||
): string {
|
||||
if (adapter !== "paperclip_runner") return adapter;
|
||||
const runner =
|
||||
provider === "acpx" && (acpxAgent === "claude" || acpxAgent === "grok")
|
||||
? acpxAgent
|
||||
: provider;
|
||||
return (
|
||||
(
|
||||
{
|
||||
claude: "claude_local",
|
||||
codex: "codex_local",
|
||||
opencode: "opencode_local",
|
||||
grok: "grok_local",
|
||||
} as Record<string, string>
|
||||
)[String(runner)] ?? "unsupported"
|
||||
);
|
||||
}
|
||||
export function isAiRoutingCompatible(
|
||||
route: AiProviderRouting,
|
||||
harness: string,
|
||||
): boolean {
|
||||
if (route.kind === "bedrock") return harness === "claude_local";
|
||||
if (route.kind === "openrouter")
|
||||
return [
|
||||
"claude_local",
|
||||
"codex_local",
|
||||
"opencode_local",
|
||||
"hermes_local",
|
||||
].includes(harness);
|
||||
if (route.protocol === "responses") return harness === "codex_local";
|
||||
if (route.protocol === "messages") return harness === "claude_local";
|
||||
return ["opencode_local", "hermes_local"].includes(harness);
|
||||
}
|
||||
export function aiRoutingBaseUrl(
|
||||
route: AiProviderRouting,
|
||||
harness: string,
|
||||
): string {
|
||||
return route.kind === "openrouter"
|
||||
? `https://openrouter.ai/api${harness === "claude_local" ? "" : "/v1"}`
|
||||
: (route.baseUrl ?? "").replace(/\/+$/, "");
|
||||
}
|
||||
|
||||
/** OpenCode names models with a provider prefix; other harnesses use the raw ID. */
|
||||
export function aiRoutingModel(
|
||||
route: AiProviderRouting,
|
||||
harness: string,
|
||||
model: string,
|
||||
): string {
|
||||
if (!model || harness !== "opencode_local") return model;
|
||||
const prefix = route.kind === "openrouter" ? "openrouter" : "paperclip";
|
||||
return model.startsWith(`${prefix}/`) ? model : `${prefix}/${model}`;
|
||||
}
|
||||
|
||||
/** Catalog identity is derived from routing, including accounts saved before these rows existed. */
|
||||
export function aiConnectionCatalogSlug(provider: string, routing?: Pick<AiProviderRouting, "kind" | "protocol">): string {
|
||||
if (routing?.kind === "gateway") {
|
||||
return routing.protocol === "messages" ? "messages-api"
|
||||
: routing.protocol === "chat" ? "chat-completions-api" : "responses-api";
|
||||
}
|
||||
return routing?.kind ?? provider;
|
||||
}
|
||||
|
||||
/** Direct catalog setup presets; legacy gateway links still open their existing setup. */
|
||||
export function aiProviderSetupPreset(source: string | null): {
|
||||
provider: "openrouter" | "bedrock" | "gateway" | "local" | "google";
|
||||
protocol?: AiProviderRouting["protocol"];
|
||||
label?: string;
|
||||
} | undefined {
|
||||
switch (source) {
|
||||
case "responses-api": return { provider: "gateway", protocol: "responses", label: "Responses API" };
|
||||
case "messages-api": return { provider: "gateway", protocol: "messages", label: "Messages API" };
|
||||
case "chat-completions-api": return { provider: "gateway", protocol: "chat", label: "Chat Completions API" };
|
||||
case "google-ai": return { provider: "google" };
|
||||
case "google": case "openrouter": case "bedrock": case "gateway": case "local": return { provider: source };
|
||||
default: return undefined;
|
||||
}
|
||||
}
|
||||
@@ -11,6 +11,7 @@ describe("tool app gallery URL matching", () => {
|
||||
expect(getAppDefinitionForUrl("https://github.com/paperclipai/paperclip/pull/1")?.slug).toBe("github");
|
||||
expect(getAppDefinitionForUrl("https://docs.google.com/spreadsheets/d/sheet_123/edit")?.slug).toBe("google-sheets");
|
||||
expect(getAppDefinitionForUrl("https://gmailmcp.googleapis.com/mcp/v1")?.slug).toBe("gmail");
|
||||
expect(getAppDefinitionForUrl("https://mcp.neon.tech/mcp")?.slug).toBe("neon");
|
||||
});
|
||||
|
||||
it("returns null for invalid or unknown links", () => {
|
||||
@@ -42,10 +43,19 @@ describe("tool app gallery URL matching", () => {
|
||||
});
|
||||
|
||||
it("keeps tool gallery entries reachable through at least one pattern", () => {
|
||||
for (const app of CONNECTABLE_APP_DEFINITIONS.filter((app) => app.methods.some((method) => method.purpose !== "channel"))) {
|
||||
for (const app of CONNECTABLE_APP_DEFINITIONS.filter((app) => app.methods.some((method) => method.purpose !== "channel" && method.purpose !== "ai"))) {
|
||||
const example = app.urlPatterns[0]?.replace("*", "example");
|
||||
expect(example, `${app.slug} has a pattern`).toBeTruthy();
|
||||
expect(getAppDefinitionForUrl(example!)?.slug).toBe(app.slug);
|
||||
}
|
||||
});
|
||||
|
||||
it("offers region and custom model connections without claiming arbitrary URLs", () => {
|
||||
for (const slug of ["bedrock", "responses-api", "messages-api", "chat-completions-api", "local"]) {
|
||||
const app = CONNECTABLE_APP_DEFINITIONS.find(app => app.slug === slug);
|
||||
expect(app?.methods.every(method => method.purpose === "ai")).toBe(true);
|
||||
expect(app?.urlPatterns).toEqual([]);
|
||||
}
|
||||
expect(getAppDefinitionForUrl("https://customer-gateway.example/v1")).toBeNull();
|
||||
});
|
||||
});
|
||||
@@ -20,64 +20,72 @@ import a18 from "./app-definitions/oauth-generic.json" with { type: "json" };
|
||||
import a19 from "./app-definitions/api-key-generic.json" with { type: "json" };
|
||||
import a20 from "./app-definitions/sentry.json" with { type: "json" };
|
||||
import a21 from "./app-definitions/vercel.json" with { type: "json" };
|
||||
import a22 from "./app-definitions/anthropic.json" with { type: "json" };
|
||||
import a23 from "./app-definitions/browser-use-cloud.json" with { type: "json" };
|
||||
import a24 from "./app-definitions/cognee.json" with { type: "json" };
|
||||
import a25 from "./app-definitions/jira.json" with { type: "json" };
|
||||
import a26 from "./app-definitions/airtable.json" with { type: "json" };
|
||||
import a27 from "./app-definitions/beehiiv.json" with { type: "json" };
|
||||
import a28 from "./app-definitions/bitly.json" with { type: "json" };
|
||||
import a29 from "./app-definitions/candid.json" with { type: "json" };
|
||||
import a30 from "./app-definitions/cloudflare.json" with { type: "json" };
|
||||
import a31 from "./app-definitions/cloudinary.json" with { type: "json" };
|
||||
import a32 from "./app-definitions/coda.json" with { type: "json" };
|
||||
import a33 from "./app-definitions/hugging-face.json" with { type: "json" };
|
||||
import a34 from "./app-definitions/kernel.json" with { type: "json" };
|
||||
import a35 from "./app-definitions/local-falcon.json" with { type: "json" };
|
||||
import a36 from "./app-definitions/make.json" with { type: "json" };
|
||||
import a37 from "./app-definitions/manufact.json" with { type: "json" };
|
||||
import a38 from "./app-definitions/miro.json" with { type: "json" };
|
||||
import a39 from "./app-definitions/netlify.json" with { type: "json" };
|
||||
import a40 from "./app-definitions/oreilly.json" with { type: "json" };
|
||||
import a41 from "./app-definitions/planetscale.json" with { type: "json" };
|
||||
import a42 from "./app-definitions/resend.json" with { type: "json" };
|
||||
import a43 from "./app-definitions/ticktick.json" with { type: "json" };
|
||||
import a44 from "./app-definitions/todoist.json" with { type: "json" };
|
||||
import a45 from "./app-definitions/webflow.json" with { type: "json" };
|
||||
import a46 from "./app-definitions/wix.json" with { type: "json" };
|
||||
import a47 from "./app-definitions/brex.json" with { type: "json" };
|
||||
import a48 from "./app-definitions/clickhouse.json" with { type: "json" };
|
||||
import a49 from "./app-definitions/egnyte.json" with { type: "json" };
|
||||
import a50 from "./app-definitions/embat.json" with { type: "json" };
|
||||
import a51 from "./app-definitions/mixpanel.json" with { type: "json" };
|
||||
import a52 from "./app-definitions/postman.json" with { type: "json" };
|
||||
import a53 from "./app-definitions/razorpay.json" with { type: "json" };
|
||||
import a54 from "./app-definitions/sanity.json" with { type: "json" };
|
||||
import a55 from "./app-definitions/stripe.json" with { type: "json" };
|
||||
import a56 from "./app-definitions/supabase.json" with { type: "json" };
|
||||
import a57 from "./app-definitions/ticket-tailor.json" with { type: "json" };
|
||||
import a58 from "./app-definitions/asana.json" with { type: "json" };
|
||||
import a59 from "./app-definitions/box.json" with { type: "json" };
|
||||
import a60 from "./app-definitions/mem0.json" with { type: "json" };
|
||||
import a61 from "./app-definitions/pagerduty.json" with { type: "json" };
|
||||
import a62 from "./app-definitions/similarweb.json" with { type: "json" };
|
||||
import a63 from "./app-definitions/xero.json" with { type: "json" };
|
||||
import a64 from "./app-definitions/youcom.json" with { type: "json" };
|
||||
import a65 from "./app-definitions/fireflies.json" with { type: "json" };
|
||||
import a66 from "./app-definitions/zep.json" with { type: "json" };
|
||||
import a67 from "./app-definitions/supermemory.json" with { type: "json" };
|
||||
import a68 from "./app-definitions/honcho.json" with { type: "json" };
|
||||
import a69 from "./app-definitions/gmail.json" with { type: "json" };
|
||||
import a70 from "./app-definitions/google-drive.json" with { type: "json" };
|
||||
import a71 from "./app-definitions/google-docs.json" with { type: "json" };
|
||||
import a72 from "./app-definitions/google-sheets.json" with { type: "json" };
|
||||
import a73 from "./app-definitions/google-slides.json" with { type: "json" };
|
||||
import a74 from "./app-definitions/google-calendar.json" with { type: "json" };
|
||||
import a75 from "./app-definitions/google-chat.json" with { type: "json" };
|
||||
import a76 from "./app-definitions/google-people.json" with { type: "json" };
|
||||
import a77 from "./app-definitions/google-workspace-search.json" with { type: "json" };
|
||||
import a78 from "./app-definitions/openai.json" with { type: "json" };
|
||||
import a79 from "./app-definitions/openrouter.json" with { type: "json" };
|
||||
import a80 from "./app-definitions/xai.json" with { type: "json" };
|
||||
import a22 from "./app-definitions/enterpret.json" with { type: "json" };
|
||||
import a23 from "./app-definitions/anthropic.json" with { type: "json" };
|
||||
import a24 from "./app-definitions/browser-use-cloud.json" with { type: "json" };
|
||||
import a25 from "./app-definitions/cognee.json" with { type: "json" };
|
||||
import a26 from "./app-definitions/jira.json" with { type: "json" };
|
||||
import a27 from "./app-definitions/airtable.json" with { type: "json" };
|
||||
import a28 from "./app-definitions/beehiiv.json" with { type: "json" };
|
||||
import a29 from "./app-definitions/bitly.json" with { type: "json" };
|
||||
import a30 from "./app-definitions/candid.json" with { type: "json" };
|
||||
import a31 from "./app-definitions/cloudflare.json" with { type: "json" };
|
||||
import a32 from "./app-definitions/cloudinary.json" with { type: "json" };
|
||||
import a33 from "./app-definitions/coda.json" with { type: "json" };
|
||||
import a34 from "./app-definitions/hugging-face.json" with { type: "json" };
|
||||
import a35 from "./app-definitions/kernel.json" with { type: "json" };
|
||||
import a36 from "./app-definitions/local-falcon.json" with { type: "json" };
|
||||
import a37 from "./app-definitions/make.json" with { type: "json" };
|
||||
import a38 from "./app-definitions/manufact.json" with { type: "json" };
|
||||
import a39 from "./app-definitions/miro.json" with { type: "json" };
|
||||
import a40 from "./app-definitions/netlify.json" with { type: "json" };
|
||||
import a41 from "./app-definitions/oreilly.json" with { type: "json" };
|
||||
import a42 from "./app-definitions/planetscale.json" with { type: "json" };
|
||||
import a43 from "./app-definitions/resend.json" with { type: "json" };
|
||||
import a44 from "./app-definitions/ticktick.json" with { type: "json" };
|
||||
import a45 from "./app-definitions/todoist.json" with { type: "json" };
|
||||
import a46 from "./app-definitions/webflow.json" with { type: "json" };
|
||||
import a47 from "./app-definitions/wix.json" with { type: "json" };
|
||||
import a48 from "./app-definitions/brex.json" with { type: "json" };
|
||||
import a49 from "./app-definitions/clickhouse.json" with { type: "json" };
|
||||
import a50 from "./app-definitions/egnyte.json" with { type: "json" };
|
||||
import a51 from "./app-definitions/embat.json" with { type: "json" };
|
||||
import a52 from "./app-definitions/mixpanel.json" with { type: "json" };
|
||||
import a53 from "./app-definitions/postman.json" with { type: "json" };
|
||||
import a54 from "./app-definitions/razorpay.json" with { type: "json" };
|
||||
import a55 from "./app-definitions/sanity.json" with { type: "json" };
|
||||
import a56 from "./app-definitions/stripe.json" with { type: "json" };
|
||||
import a57 from "./app-definitions/supabase.json" with { type: "json" };
|
||||
import a58 from "./app-definitions/ticket-tailor.json" with { type: "json" };
|
||||
import a59 from "./app-definitions/asana.json" with { type: "json" };
|
||||
import a60 from "./app-definitions/box.json" with { type: "json" };
|
||||
import a61 from "./app-definitions/mem0.json" with { type: "json" };
|
||||
import a62 from "./app-definitions/pagerduty.json" with { type: "json" };
|
||||
import a63 from "./app-definitions/similarweb.json" with { type: "json" };
|
||||
import a64 from "./app-definitions/xero.json" with { type: "json" };
|
||||
import a65 from "./app-definitions/youcom.json" with { type: "json" };
|
||||
import a66 from "./app-definitions/fireflies.json" with { type: "json" };
|
||||
import a67 from "./app-definitions/zep.json" with { type: "json" };
|
||||
import a68 from "./app-definitions/supermemory.json" with { type: "json" };
|
||||
import a69 from "./app-definitions/honcho.json" with { type: "json" };
|
||||
import a70 from "./app-definitions/neon.json" with { type: "json" };
|
||||
import a71 from "./app-definitions/gmail.json" with { type: "json" };
|
||||
import a72 from "./app-definitions/google-drive.json" with { type: "json" };
|
||||
import a73 from "./app-definitions/google-docs.json" with { type: "json" };
|
||||
import a74 from "./app-definitions/google-sheets.json" with { type: "json" };
|
||||
import a75 from "./app-definitions/google-slides.json" with { type: "json" };
|
||||
import a76 from "./app-definitions/google-calendar.json" with { type: "json" };
|
||||
import a77 from "./app-definitions/google-chat.json" with { type: "json" };
|
||||
import a78 from "./app-definitions/google-people.json" with { type: "json" };
|
||||
import a79 from "./app-definitions/google-workspace-search.json" with { type: "json" };
|
||||
import a80 from "./app-definitions/openai.json" with { type: "json" };
|
||||
import a81 from "./app-definitions/openrouter.json" with { type: "json" };
|
||||
import a82 from "./app-definitions/xai.json" with { type: "json" };
|
||||
import a83 from "./app-definitions/google.json" with { type: "json" };
|
||||
import a84 from "./app-definitions/bedrock.json" with { type: "json" };
|
||||
import a85 from "./app-definitions/responses-api.json" with { type: "json" };
|
||||
import a86 from "./app-definitions/messages-api.json" with { type: "json" };
|
||||
import a87 from "./app-definitions/chat-completions-api.json" with { type: "json" };
|
||||
import a88 from "./app-definitions/local.json" with { type: "json" };
|
||||
import type { AppDefinition } from "./types/app-definition.js";
|
||||
export const APP_DEFINITIONS=[a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42,a43,a44,a45,a46,a47,a48,a49,a50,a51,a52,a53,a54,a55,a56,a57,a58,a59,a60,a61,a62,a63,a64,a65,a66,a67,a68,a69,a70,a71,a72,a73,a74,a75,a76,a77,a78,a79,a80] as AppDefinition[];
|
||||
export const APP_DEFINITIONS=[a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10,a11,a12,a13,a14,a15,a16,a17,a18,a19,a20,a21,a22,a23,a24,a25,a26,a27,a28,a29,a30,a31,a32,a33,a34,a35,a36,a37,a38,a39,a40,a41,a42,a43,a44,a45,a46,a47,a48,a49,a50,a51,a52,a53,a54,a55,a56,a57,a58,a59,a60,a61,a62,a63,a64,a65,a66,a67,a68,a69,a70,a71,a72,a73,a74,a75,a76,a77,a78,a79,a80,a81,a82,a83,a84,a85,a86,a87,a88] as AppDefinition[];
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
CONNECTABLE_APP_DEFINITIONS,
|
||||
appSupportsCatalogSetup,
|
||||
getAvailableConnectionMethod,
|
||||
getAvailableConnectionMethods,
|
||||
getAppDefinitionForUrl,
|
||||
getConnectableAppDefinition,
|
||||
getRecommendedConnectionMethod,
|
||||
@@ -25,7 +26,8 @@ import {
|
||||
SELF_SERVE_MCP_CANDIDATES,
|
||||
SELF_SERVE_MCP_RESEARCH,
|
||||
} from "./self-serve-mcp-research.js";
|
||||
import { appDefinitionsSchema } from "./validators/app-definition.js";
|
||||
import { aiConnectionRouterAppDefinition } from "./ai-connection-router.js";
|
||||
import { appDefinitionSchema, appDefinitionsSchema } from "./validators/app-definition.js";
|
||||
|
||||
const googleScope = (scope: string) =>
|
||||
`https://www.googleapis.com/auth/${scope}`;
|
||||
@@ -232,6 +234,15 @@ describe("AppDefinition catalog", () => {
|
||||
|
||||
it("validates all Wave 1 definitions", () =>
|
||||
expect(() => appDefinitionsSchema.parse(APP_DEFINITIONS)).not.toThrow());
|
||||
it("lists model providers as regular tagged catalog entries", () => {
|
||||
const slugs = ["openai", "anthropic", "openrouter", "xai", "google", "bedrock", "responses-api", "messages-api", "chat-completions-api", "local"];
|
||||
expect(APP_STORE_DEFINITIONS.filter(app => app.tags?.includes("model-provider")).map(app => app.slug).sort()).toEqual(slugs.sort());
|
||||
for (const slug of slugs) {
|
||||
const app = APP_STORE_DEFINITIONS.find(app => app.slug === slug)!;
|
||||
expect(app.methods.some(method => method.purpose === "ai" && method.transport === "runtime_auth")).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
it("contains every established provider plus the reviewed self-serve catalog", () => {
|
||||
expect(APP_DEFINITIONS.map((app) => app.slug)).toEqual(
|
||||
expect.arrayContaining([
|
||||
@@ -262,7 +273,7 @@ describe("AppDefinition catalog", () => {
|
||||
"google-workspace-search",
|
||||
]),
|
||||
);
|
||||
expect(SELF_SERVE_MCP_CANDIDATES).toHaveLength(49);
|
||||
expect(SELF_SERVE_MCP_CANDIDATES).toHaveLength(50);
|
||||
expect(BLOCKED_MCP_PROVIDERS.map((entry) => entry.slug)).toEqual([
|
||||
"g2",
|
||||
"vercel",
|
||||
@@ -426,15 +437,15 @@ describe("AppDefinition catalog", () => {
|
||||
expect(channel("slack")?.guidanceMd).toContain("reactions");
|
||||
expect(channel("slack")?.guidanceMd).toContain("direct messages");
|
||||
});
|
||||
it("keeps a complete, unique, dated evidence ledger for all 52 researched MCP providers", () => {
|
||||
it("keeps a complete, unique, dated evidence ledger for all 53 researched MCP providers", () => {
|
||||
// Ledger-wide date reflects the last full re-verification (2026-08-26);
|
||||
// later provider additions carry their own research evidence, but
|
||||
// bumping the shared date would overstate freshness for the other providers.
|
||||
expect(SELF_SERVE_MCP_RESEARCH.verifiedAt).toBe("2026-08-26");
|
||||
expect(SELF_SERVE_MCP_RESEARCH.entries).toHaveLength(52);
|
||||
expect(SELF_SERVE_MCP_RESEARCH.entries).toHaveLength(53);
|
||||
expect(
|
||||
new Set(SELF_SERVE_MCP_RESEARCH.entries.map((entry) => entry.slug)),
|
||||
).toHaveProperty("size", 52);
|
||||
).toHaveProperty("size", 53);
|
||||
for (const entry of SELF_SERVE_MCP_RESEARCH.entries) {
|
||||
expect(new URL(entry.docsUrl).protocol).toBe("https:");
|
||||
expect(new URL(entry.serverUrl).protocol).toBe("https:");
|
||||
@@ -458,6 +469,76 @@ describe("AppDefinition catalog", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("supports organization tokens and OAuth for the official read-only Enterpret MCP", () => {
|
||||
const app = CONNECTABLE_APP_DEFINITIONS.find(
|
||||
(entry) => entry.slug === "enterpret",
|
||||
)!;
|
||||
expect(
|
||||
getAppDefinitionForUrl("https://wisdom-api.enterpret.com/server/mcp")
|
||||
?.slug,
|
||||
).toBe("enterpret");
|
||||
// Both methods target the official read-only MCP, not the beta Agent MCP.
|
||||
expect(app.methods.map((method) => method.key)).toEqual([
|
||||
"mcp-api-key",
|
||||
"mcp-oauth",
|
||||
]);
|
||||
expect(app.redirectConstraints).toBe("https-or-loopback-http");
|
||||
expect(APP_STORE_HIDDEN_SLUGS.has("enterpret")).toBe(false);
|
||||
expect(app.availability?.available).not.toBe(false);
|
||||
expect(app.ownershipAvailability?.dcr).not.toBe(false);
|
||||
expect(getAvailableConnectionMethods(app).map((method) => method.key)).toEqual([
|
||||
"mcp-api-key",
|
||||
"mcp-oauth",
|
||||
]);
|
||||
expect(getAvailableConnectionMethod(app)?.key).toBe("mcp-api-key");
|
||||
expect(getAvailableConnectionMethod(app, "mcp-oauth")?.key).toBe("mcp-oauth");
|
||||
expect(app.methods[0]).toMatchObject({
|
||||
transport: "mcp_remote",
|
||||
auth: "api_key",
|
||||
ownershipModes: ["customer"],
|
||||
grantKinds: ["organization"],
|
||||
riskTier: "S3",
|
||||
defaults: { serverUrl: "https://wisdom-api.enterpret.com/server/mcp" },
|
||||
credentialFields: [
|
||||
{ key: "authorization", type: "password", required: true, secret: true },
|
||||
],
|
||||
keyPlacement: {
|
||||
location: "header",
|
||||
name: "Authorization",
|
||||
prefix: "Bearer ",
|
||||
},
|
||||
});
|
||||
expect(app.methods[1]).toMatchObject({
|
||||
transport: "mcp_remote",
|
||||
auth: "oauth",
|
||||
// Enterpret documents no customer-registered OAuth app, only RFC 7591.
|
||||
ownershipModes: ["dcr"],
|
||||
grantKinds: ["user"],
|
||||
riskTier: "S3",
|
||||
defaults: {
|
||||
serverUrl: "https://wisdom-api.enterpret.com/server/mcp",
|
||||
// Narrower than the "mcp:read mcp:write" the 401 challenge advertises.
|
||||
scopesHint: ["mcp:read"],
|
||||
},
|
||||
});
|
||||
// RFC 9728 -> RFC 8414 discovery resolves from the challenge, so shipping a
|
||||
// complete endpoint pair would suppress discovery permanently.
|
||||
expect(app.methods[1].defaults?.authorizationEndpoint).toBeUndefined();
|
||||
expect(app.methods[1].defaults?.tokenEndpoint).toBeUndefined();
|
||||
expect(app.methods[1].label).toBe("Sign in with Enterpret");
|
||||
expect(app.methods[1].warnings?.some((w) => /broader OAuth scopes/i.test(w))).toBe(
|
||||
true,
|
||||
);
|
||||
// The definition records the placement of a credential, never a value.
|
||||
const serialized = JSON.stringify(app);
|
||||
expect(serialized).not.toMatch(/eyJ[A-Za-z0-9_-]{8,}/);
|
||||
// "Bearer " may appear only as the header prefix, never trailed by a value.
|
||||
expect(serialized.match(/Bearer[^"]*/g)).toEqual(["Bearer "]);
|
||||
for (const method of app.methods)
|
||||
for (const credentialField of method.credentialFields ?? [])
|
||||
expect(credentialField).not.toHaveProperty("defaultValue");
|
||||
});
|
||||
|
||||
it("uses the reviewed current endpoints and configuration modes", () => {
|
||||
const method = (slug: string, key?: string) =>
|
||||
APP_DEFINITIONS.find((app) => app.slug === slug)?.methods.find(
|
||||
@@ -626,13 +707,21 @@ describe("AppDefinition catalog", () => {
|
||||
APP_DEFINITIONS.find((app) => app.slug === "hugging-face")?.methods[0]
|
||||
?.defaults?.scopesHint,
|
||||
).toEqual(["read-mcp", "read-repos", "contribute-repos", "jobs"]));
|
||||
it("defaults every action, reads and writes, to allowed", () => {
|
||||
it("defaults every new connection action to allowed except Enterpret writes", () => {
|
||||
for (const app of APP_DEFINITIONS)
|
||||
for (const method of app.methods)
|
||||
for (const method of app.methods) {
|
||||
if (app.slug === "enterpret") {
|
||||
expect(recommendedDefaultsForApp(app, method.key)).toEqual({
|
||||
access: "all_agents",
|
||||
askFirstRiskLevels: ["write", "destructive"],
|
||||
});
|
||||
continue;
|
||||
}
|
||||
expect(recommendedDefaultsForApp(app, method.key)).toEqual({
|
||||
access: "all_agents",
|
||||
askFirstRiskLevels: [],
|
||||
});
|
||||
}
|
||||
});
|
||||
it("defaults explicit read/write capability groups to their write-capable method", () => {
|
||||
const drive = APP_DEFINITIONS.find((app) => app.slug === "google-drive")!;
|
||||
@@ -728,7 +817,7 @@ describe("AppDefinition catalog", () => {
|
||||
"ticktick",
|
||||
"xero",
|
||||
]);
|
||||
expect(APP_STORE_DEFINITIONS).toHaveLength(58);
|
||||
expect(APP_STORE_DEFINITIONS).toHaveLength(66);
|
||||
const connectableSlugs = new Set(
|
||||
CONNECTABLE_APP_DEFINITIONS.map((entry) => entry.slug),
|
||||
);
|
||||
@@ -938,6 +1027,81 @@ describe("AppDefinition catalog", () => {
|
||||
expect(method.guidanceMd).toContain("optional advanced controls");
|
||||
}
|
||||
});
|
||||
it("connects Neon's hosted server with optional project pinning and read-only mode", () => {
|
||||
const neon = APP_DEFINITIONS.find((app) => app.slug === "neon")!;
|
||||
expect(neon).toMatchObject({
|
||||
name: "Neon",
|
||||
categories: ["data"],
|
||||
urlPatterns: ["https://mcp.neon.tech/*"],
|
||||
docsUrl: "https://neon.com/docs/ai/neon-mcp-server",
|
||||
redirectConstraints: "https-or-loopback-http",
|
||||
branding: { logoUrl: "/brands/apps/neon.png" },
|
||||
});
|
||||
expect(neon.branding.darkLogoUrl).toBeUndefined();
|
||||
expect(APP_STORE_DEFINITIONS.some((app) => app.slug === "neon")).toBe(true);
|
||||
expect(neon.methods.map((candidate) => candidate.key)).toEqual([
|
||||
"mcp-oauth",
|
||||
"mcp-api-key",
|
||||
]);
|
||||
const [oauth, apiKey] = neon.methods;
|
||||
expect(oauth).toMatchObject({
|
||||
auth: "oauth",
|
||||
ownershipModes: ["dcr"],
|
||||
riskTier: "S4",
|
||||
requiredResourceFilters: ["project"],
|
||||
defaults: {
|
||||
serverUrl: "https://mcp.neon.tech/mcp",
|
||||
scopesHint: ["read", "write"],
|
||||
},
|
||||
});
|
||||
expect(apiKey).toMatchObject({
|
||||
auth: "api_key",
|
||||
ownershipModes: ["customer"],
|
||||
riskTier: "S4",
|
||||
defaults: { serverUrl: "https://mcp.neon.tech/mcp" },
|
||||
keyPlacement: {
|
||||
location: "header",
|
||||
name: "Authorization",
|
||||
prefix: "Bearer ",
|
||||
},
|
||||
consoleLinks: {
|
||||
keys: "https://console.neon.tech/app/settings/api-keys",
|
||||
},
|
||||
});
|
||||
expect(apiKey!.credentialFields).toEqual([
|
||||
expect.objectContaining({
|
||||
key: "authorization",
|
||||
type: "password",
|
||||
secret: true,
|
||||
required: true,
|
||||
}),
|
||||
]);
|
||||
for (const method of neon.methods) {
|
||||
// Nothing is required on the default path: both narrowing controls are
|
||||
// optional and folded under Advanced, and the provider enforces them.
|
||||
expect(method.tenantFields?.map((field) => field.key)).toEqual([
|
||||
"projectId",
|
||||
"readOnly",
|
||||
]);
|
||||
expect(method.tenantFields?.every((field) => field.advanced && !field.required)).toBe(true);
|
||||
expect(method.tenantFields?.[0]).toMatchObject({
|
||||
type: "text",
|
||||
validation: { pattern: "^[a-z0-9-]+$", maxLength: 64 },
|
||||
transport: { location: "query", name: "projectId" },
|
||||
});
|
||||
expect(method.tenantFields?.[1]).toMatchObject({
|
||||
type: "checkbox",
|
||||
defaultValue: false,
|
||||
transport: {
|
||||
location: "query",
|
||||
name: "readonly",
|
||||
format: "boolean",
|
||||
omitFalse: true,
|
||||
},
|
||||
});
|
||||
expect(method.warnings?.length).toBe(2);
|
||||
}
|
||||
});
|
||||
it("requires only reviewed provider or safety-boundary configuration on the default path", () => {
|
||||
const required = APP_DEFINITIONS.flatMap((app) =>
|
||||
app.methods.flatMap((method) =>
|
||||
@@ -951,6 +1115,7 @@ describe("AppDefinition catalog", () => {
|
||||
).sort();
|
||||
expect(required).toEqual([
|
||||
"clickhouse:mcp-oauth:serviceId",
|
||||
"honcho:mcp-api-key:workspaceId",
|
||||
"shopify:storefront-mcp:storeDomain",
|
||||
"shopify:ucp-commerce:storeDomain",
|
||||
"supabase:mcp-api-key:projectRef",
|
||||
@@ -1064,3 +1229,12 @@ describe("tool method permission review", () => {
|
||||
.toEqual(["read-mcp", "read-repos", "contribute-repos", "jobs"]);
|
||||
});
|
||||
});
|
||||
|
||||
it("validates native pool catalog entries without inventing an authentication method", () => {
|
||||
const entry = aiConnectionRouterAppDefinition("example.pool", { name: "AI connection pool", description: "Use saved connections" });
|
||||
expect(appDefinitionSchema.parse(entry)).toEqual(entry);
|
||||
expect(entry.methods).toEqual([]);
|
||||
expect(appDefinitionSchema.safeParse({ ...entry, aiConnectionRouter: undefined }).success).toBe(false);
|
||||
expect(appDefinitionSchema.safeParse({ ...entry, methods: APP_STORE_DEFINITIONS[0]!.methods }).success).toBe(false);
|
||||
expect(appDefinitionSchema.safeParse({ ...entry, categories: ["developer"] }).success).toBe(false);
|
||||
});
|
||||
@@ -4,11 +4,13 @@ import type { AppDefinition, ConnectionMethodDef, FieldDef } from "./types/app-d
|
||||
import type { ToolConnectionOwnership } from "./types/tool-access.js";
|
||||
|
||||
export const CONNECTABLE_APP_SLUGS = new Set([
|
||||
"anthropic", "openai", "openrouter", "xai",
|
||||
"anthropic", "openai", "openrouter", "xai", "google", "bedrock",
|
||||
"responses-api", "messages-api", "chat-completions-api", "local",
|
||||
"agentmail",
|
||||
"browser-use-cloud",
|
||||
"cognee",
|
||||
...SELF_SERVE_MCP_CANDIDATES.map((entry) => entry.slug),
|
||||
"enterpret",
|
||||
"zapier",
|
||||
"arcade",
|
||||
"executor",
|
||||
@@ -255,14 +257,20 @@ export function resolveConnectionMethodServerUrl(
|
||||
|
||||
export function recommendedDefaultsForApp(app: AppDefinition, methodKey?: string | null): Record<string, unknown> {
|
||||
// Keep the parameters in the public contract: callers resolve defaults for a
|
||||
// concrete app/method even though the initial policy is uniform. This is
|
||||
// an open default, not an approval bypass: connection finalization remains a
|
||||
// configure-authorized, audited operation, and Ask first stays available as
|
||||
// an operator-selected policy for any action after the connection is made.
|
||||
// The connect flow lands on the Permissions tab so that choice is the very
|
||||
// next screen (PAP-659: agents get full permissions unless someone narrows them).
|
||||
void app;
|
||||
// concrete app/method. Connection finalization remains a configure-authorized,
|
||||
// audited operation, and Ask first stays available as an operator-selected
|
||||
// policy for any action after the connection is made.
|
||||
void methodKey;
|
||||
// Enterpret's run_graph_query self-reports readOnlyHint but executes Cypher
|
||||
// and has not been established as read-only. Classify it as write (server
|
||||
// classifyRisk) and require Ask first so new token connections do not ship
|
||||
// that action as Allowed.
|
||||
if (app.slug === "enterpret") {
|
||||
return {
|
||||
access: "all_agents",
|
||||
askFirstRiskLevels: ["write", "destructive"],
|
||||
};
|
||||
}
|
||||
return {
|
||||
access: "all_agents",
|
||||
askFirstRiskLevels: [],
|
||||
|
||||
@@ -71,5 +71,8 @@
|
||||
"name": "ANTHROPIC_API_KEY"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"model-provider"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"slug": "bedrock",
|
||||
"name": "Amazon Bedrock",
|
||||
"description": "Use Claude through Amazon Bedrock with a Bedrock API key and AWS region.",
|
||||
"categories": [
|
||||
"ai"
|
||||
],
|
||||
"branding": {
|
||||
"logoUrl": "/brands/apps/bedrock.svg"
|
||||
},
|
||||
"urlPatterns": [],
|
||||
"methods": [
|
||||
{
|
||||
"key": "ai-api_key",
|
||||
"label": "Amazon Bedrock API key",
|
||||
"purpose": "ai",
|
||||
"transport": "runtime_auth",
|
||||
"auth": "api_key",
|
||||
"ai": {
|
||||
"provider": "anthropic",
|
||||
"method": "api_key"
|
||||
},
|
||||
"grantKinds": [
|
||||
"user",
|
||||
"organization"
|
||||
],
|
||||
"ownershipModes": [
|
||||
"customer"
|
||||
],
|
||||
"whenToUse": "Use Claude through Amazon Bedrock with a Bedrock API key and AWS region.",
|
||||
"guidanceMd": "Use your personal account or an explicitly shared company account.",
|
||||
"riskTier": "S3",
|
||||
"credentialFields": [
|
||||
{
|
||||
"key": "apiKey",
|
||||
"label": "API key",
|
||||
"type": "password",
|
||||
"required": true,
|
||||
"placeholder": "Enter API key",
|
||||
"secret": true
|
||||
}
|
||||
],
|
||||
"keyPlacement": {
|
||||
"location": "env",
|
||||
"name": "AWS_BEARER_TOKEN_BEDROCK"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"model-provider"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"slug": "chat-completions-api",
|
||||
"name": "Chat Completions API",
|
||||
"description": "Connect any compatible harness to a Chat Completions-compatible provider or gateway.",
|
||||
"categories": [
|
||||
"ai"
|
||||
],
|
||||
"branding": {
|
||||
"logoUrl": "/brands/apps/api-key-generic.svg"
|
||||
},
|
||||
"urlPatterns": [],
|
||||
"methods": [
|
||||
{
|
||||
"key": "ai-api_key",
|
||||
"label": "Chat Completions API API key",
|
||||
"purpose": "ai",
|
||||
"transport": "runtime_auth",
|
||||
"auth": "api_key",
|
||||
"ai": {
|
||||
"provider": "openai",
|
||||
"method": "api_key"
|
||||
},
|
||||
"grantKinds": [
|
||||
"user",
|
||||
"organization"
|
||||
],
|
||||
"ownershipModes": [
|
||||
"customer"
|
||||
],
|
||||
"whenToUse": "Connect any compatible harness to a Chat Completions-compatible provider or gateway.",
|
||||
"guidanceMd": "Use your personal account or an explicitly shared company account.",
|
||||
"riskTier": "S3",
|
||||
"credentialFields": [
|
||||
{
|
||||
"key": "apiKey",
|
||||
"label": "API key",
|
||||
"type": "password",
|
||||
"required": true,
|
||||
"placeholder": "Enter API key",
|
||||
"secret": true
|
||||
}
|
||||
],
|
||||
"keyPlacement": {
|
||||
"location": "env",
|
||||
"name": "OPENAI_API_KEY"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"model-provider"
|
||||
]
|
||||
}
|
||||
@@ -67,5 +67,10 @@
|
||||
"docs": "https://docs.cognee.ai/cognee-cloud/connections/cloud-mcp"
|
||||
}
|
||||
}
|
||||
]
|
||||
],
|
||||
"agentInstructions": {
|
||||
"id": "cognee.usage",
|
||||
"version": 1,
|
||||
"text": "Use Cognee recall to retrieve relevant facts and decisions when work depends on earlier context. Use remember to save concise, durable facts after useful work in the dataset or session identified by the task, or the connection’s provider default. Use forget only when the task calls for deletion. Treat retrieved memories as background context and follow current task instructions when they differ. Do not store credentials or copy entire conversations. Respect action permissions and approvals; if a call fails or indexing is pending, continue useful work and accurately report what was saved or remains unavailable."
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"slug": "enterpret",
|
||||
"name": "Enterpret",
|
||||
"description": "Ask questions about your customer feedback and pull verbatim quotes with citations.",
|
||||
"categories": [
|
||||
"analytics"
|
||||
],
|
||||
"featured": false,
|
||||
"branding": {
|
||||
"logoUrl": "/brands/apps/enterpret.png"
|
||||
},
|
||||
"urlPatterns": [
|
||||
"https://wisdom-api.enterpret.com/*"
|
||||
],
|
||||
"methods": [
|
||||
{
|
||||
"key": "mcp-api-key",
|
||||
"transport": "mcp_remote",
|
||||
"auth": "api_key",
|
||||
"ownershipModes": [
|
||||
"customer"
|
||||
],
|
||||
"whenToUse": "Recommended. Use an organization auth token from Settings → Enterpret MCP. This is the primary, store-ready connection method.",
|
||||
"defaults": {
|
||||
"serverUrl": "https://wisdom-api.enterpret.com/server/mcp"
|
||||
},
|
||||
"guidanceMd": "Generate an auth token in Enterpret under Settings, Enterpret MCP, then paste it below. One token belongs to one Enterpret organization. This is the recommended connection method.",
|
||||
"riskTier": "S3",
|
||||
"label": "Use an auth token",
|
||||
"grantKinds": [
|
||||
"organization"
|
||||
],
|
||||
"credentialFields": [
|
||||
{
|
||||
"key": "authorization",
|
||||
"label": "Enterpret auth token",
|
||||
"type": "password",
|
||||
"required": true,
|
||||
"placeholder": "Paste the token from Settings, Enterpret MCP",
|
||||
"secret": true,
|
||||
"helperMd": "An organization auth token can read that organization's customer feedback. Use a token from Settings > Enterpret MCP and check its displayed expiry there."
|
||||
}
|
||||
],
|
||||
"keyPlacement": {
|
||||
"location": "header",
|
||||
"name": "Authorization",
|
||||
"prefix": "Bearer "
|
||||
},
|
||||
"consoleLinks": {
|
||||
"docs": "https://enterpret.support.site/article/enterpret-mcp-server"
|
||||
},
|
||||
"warnings": [
|
||||
"Check your auth token's expiry in Enterpret Settings > Enterpret MCP and replace it before it lapses.",
|
||||
"This connection reads customer feedback, including verbatim quotes with speaker attribution.",
|
||||
"run_graph_query starts as Ask first. Cypher is not established as read-only even when Enterpret advertises readOnlyHint."
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "mcp-oauth",
|
||||
"transport": "mcp_remote",
|
||||
"auth": "oauth",
|
||||
"ownershipModes": [
|
||||
"dcr"
|
||||
],
|
||||
"whenToUse": "Use browser sign-in when each person should query feedback under their own Enterpret account.",
|
||||
"defaults": {
|
||||
"serverUrl": "https://wisdom-api.enterpret.com/server/mcp",
|
||||
"scopesHint": [
|
||||
"mcp:read"
|
||||
]
|
||||
},
|
||||
"guidanceMd": "Sign in to Enterpret in the browser to query the official read-only MCP. Each person connects with their own Enterpret account, and Enterpret attributes their queries individually.",
|
||||
"riskTier": "S3",
|
||||
"label": "Sign in with Enterpret",
|
||||
"grantKinds": [
|
||||
"user"
|
||||
],
|
||||
"consoleLinks": {
|
||||
"docs": "https://enterpret.support.site/article/enterpret-mcp-server"
|
||||
},
|
||||
"warnings": [
|
||||
"The official Enterpret MCP is read-only. Enterpret previously reported broader OAuth scopes, including mcp:write and email, than Paperclip requested. Enterpret is correcting this scope reporting; it does not establish access to the separate beta Agent MCP.",
|
||||
"After revocation, Enterpret may cache token validity for up to 24 hours. Disconnect this connection to stop Paperclip access immediately. Enterpret is reducing this delay.",
|
||||
"You need an Enterpret account with access to your organization's feedback.",
|
||||
"This connection reads customer feedback, including verbatim quotes with speaker attribution."
|
||||
]
|
||||
}
|
||||
],
|
||||
"docsUrl": "https://enterpret.support.site/article/enterpret-mcp-server",
|
||||
"redirectConstraints": "https-or-loopback-http"
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"slug": "google",
|
||||
"name": "Google Gemini",
|
||||
"description": "Connect Google Gemini accounts for your agents.",
|
||||
"categories": [
|
||||
"ai"
|
||||
],
|
||||
"branding": {
|
||||
"logoUrl": "/brands/apps/google.svg"
|
||||
},
|
||||
"urlPatterns": [
|
||||
"https://generativelanguage.googleapis.com/*"
|
||||
],
|
||||
"methods": [
|
||||
{
|
||||
"key": "ai-api_key",
|
||||
"label": "Google Gemini API key",
|
||||
"purpose": "ai",
|
||||
"transport": "runtime_auth",
|
||||
"auth": "api_key",
|
||||
"ai": {
|
||||
"provider": "google",
|
||||
"method": "api_key"
|
||||
},
|
||||
"grantKinds": [
|
||||
"user",
|
||||
"organization"
|
||||
],
|
||||
"ownershipModes": [
|
||||
"customer"
|
||||
],
|
||||
"whenToUse": "Authenticate an agent with this account.",
|
||||
"guidanceMd": "Use your personal account or an explicitly shared company account.",
|
||||
"riskTier": "S3",
|
||||
"credentialFields": [
|
||||
{
|
||||
"key": "apiKey",
|
||||
"label": "API key",
|
||||
"type": "password",
|
||||
"required": true,
|
||||
"placeholder": "Enter API key",
|
||||
"secret": true
|
||||
}
|
||||
],
|
||||
"keyPlacement": {
|
||||
"location": "env",
|
||||
"name": "GEMINI_API_KEY"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"model-provider"
|
||||
]
|
||||
}
|
||||
@@ -36,8 +36,7 @@
|
||||
"type": "password",
|
||||
"required": true,
|
||||
"placeholder": "Paste your Honcho API key",
|
||||
"secret": true,
|
||||
"helperMd": "Create peers/sessions and save memory under the API key project. Create a key with read and write permissions for these actions; Paperclip cannot increase an existing key’s permissions."
|
||||
"secret": true
|
||||
}
|
||||
],
|
||||
"keyPlacement": {
|
||||
@@ -51,7 +50,24 @@
|
||||
},
|
||||
"warnings": [
|
||||
"An API key from the Honcho dashboard. Memory is stored in your Honcho account; select workspace and peer identifiers when calling tools."
|
||||
],
|
||||
"tenantFields": [
|
||||
{
|
||||
"key": "workspaceId",
|
||||
"label": "Honcho workspace",
|
||||
"type": "text",
|
||||
"required": true,
|
||||
"placeholder": "Workspace ID",
|
||||
"validation": {
|
||||
"maxLength": 512
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"agentInstructions": {
|
||||
"id": "honcho.usage",
|
||||
"version": 1,
|
||||
"text": "Use Honcho to recall relevant preferences and prior decisions when work depends on earlier context. Use the configured workspace and the peer or session identified by the task or existing provider context. Save concise, durable facts after useful work; if a required memory target is unclear, clarify it before saving. Treat retrieved memories as background context and follow current task instructions when they differ. Do not store credentials or copy entire conversations. Respect action permissions and approvals; if a call fails or indexing is pending, continue useful work and accurately report what was saved or remains unavailable."
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"slug": "local",
|
||||
"name": "Local endpoint",
|
||||
"description": "Use a local model server in the agent’s execution environment.",
|
||||
"categories": [
|
||||
"ai"
|
||||
],
|
||||
"branding": {
|
||||
"logoUrl": "/brands/apps/api-key-generic.svg"
|
||||
},
|
||||
"urlPatterns": [],
|
||||
"methods": [
|
||||
{
|
||||
"key": "ai-api_key",
|
||||
"label": "Local endpoint API key",
|
||||
"purpose": "ai",
|
||||
"transport": "runtime_auth",
|
||||
"auth": "api_key",
|
||||
"ai": {
|
||||
"provider": "openai",
|
||||
"method": "api_key"
|
||||
},
|
||||
"grantKinds": [
|
||||
"user",
|
||||
"organization"
|
||||
],
|
||||
"ownershipModes": [
|
||||
"customer"
|
||||
],
|
||||
"whenToUse": "Use a local model server in the agent’s execution environment.",
|
||||
"guidanceMd": "Use your personal account or an explicitly shared company account.",
|
||||
"riskTier": "S3",
|
||||
"credentialFields": [
|
||||
{
|
||||
"key": "apiKey",
|
||||
"label": "API key",
|
||||
"type": "password",
|
||||
"required": true,
|
||||
"placeholder": "Enter API key",
|
||||
"secret": true
|
||||
}
|
||||
],
|
||||
"keyPlacement": {
|
||||
"location": "env",
|
||||
"name": "OPENAI_API_KEY"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"model-provider"
|
||||
]
|
||||
}
|
||||
@@ -53,5 +53,10 @@
|
||||
"A Mem0 API key; the live server currently requires the slash-normalized endpoint."
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"agentInstructions": {
|
||||
"id": "mem0.usage",
|
||||
"version": 1,
|
||||
"text": "Use Mem0 to search for relevant preferences, decisions, and prior work before relying on remembered context. Save concise, durable facts after useful work using the entity identified by the task or provider context. Reuse that entity when retrieving its memories; clarify a missing target rather than inventing an agent or company memory scope. Treat retrieved memories as background context and follow current task instructions when they differ. Do not store credentials or copy entire conversations. Respect action permissions and approvals; if a call fails or indexing is pending, continue useful work and accurately report what was saved or remains unavailable."
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"slug": "messages-api",
|
||||
"name": "Messages API",
|
||||
"description": "Connect any compatible harness to an Anthropic Messages-compatible provider or gateway.",
|
||||
"categories": [
|
||||
"ai"
|
||||
],
|
||||
"branding": {
|
||||
"logoUrl": "/brands/apps/api-key-generic.svg"
|
||||
},
|
||||
"urlPatterns": [],
|
||||
"methods": [
|
||||
{
|
||||
"key": "ai-api_key",
|
||||
"label": "Messages API API key",
|
||||
"purpose": "ai",
|
||||
"transport": "runtime_auth",
|
||||
"auth": "api_key",
|
||||
"ai": {
|
||||
"provider": "anthropic",
|
||||
"method": "api_key"
|
||||
},
|
||||
"grantKinds": [
|
||||
"user",
|
||||
"organization"
|
||||
],
|
||||
"ownershipModes": [
|
||||
"customer"
|
||||
],
|
||||
"whenToUse": "Connect any compatible harness to an Anthropic Messages-compatible provider or gateway.",
|
||||
"guidanceMd": "Use your personal account or an explicitly shared company account.",
|
||||
"riskTier": "S3",
|
||||
"credentialFields": [
|
||||
{
|
||||
"key": "apiKey",
|
||||
"label": "API key",
|
||||
"type": "password",
|
||||
"required": true,
|
||||
"placeholder": "Enter API key",
|
||||
"secret": true
|
||||
}
|
||||
],
|
||||
"keyPlacement": {
|
||||
"location": "env",
|
||||
"name": "ANTHROPIC_API_KEY"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"model-provider"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,155 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"slug": "neon",
|
||||
"name": "Neon",
|
||||
"description": "Manage Postgres projects and branches, run SQL, and inspect schemas in Neon.",
|
||||
"categories": [
|
||||
"data"
|
||||
],
|
||||
"featured": false,
|
||||
"branding": {
|
||||
"logoUrl": "/brands/apps/neon.png"
|
||||
},
|
||||
"urlPatterns": [
|
||||
"https://mcp.neon.tech/*"
|
||||
],
|
||||
"docsUrl": "https://neon.com/docs/ai/neon-mcp-server",
|
||||
"redirectConstraints": "https-or-loopback-http",
|
||||
"methods": [
|
||||
{
|
||||
"key": "mcp-oauth",
|
||||
"transport": "mcp_remote",
|
||||
"auth": "oauth",
|
||||
"ownershipModes": [
|
||||
"dcr"
|
||||
],
|
||||
"whenToUse": "Use browser sign-in for the provider-hosted MCP server.",
|
||||
"defaults": {
|
||||
"serverUrl": "https://mcp.neon.tech/mcp",
|
||||
"scopesHint": [
|
||||
"read",
|
||||
"write"
|
||||
]
|
||||
},
|
||||
"guidanceMd": "Connect Neon in the browser. Open Advanced to pin one project or enable read-only mode. Write tools start enabled and remain governed by Paperclip's action policies.",
|
||||
"riskTier": "S4",
|
||||
"label": "Sign in with Neon",
|
||||
"consoleLinks": {
|
||||
"docs": "https://neon.com/docs/ai/neon-mcp-server"
|
||||
},
|
||||
"warnings": [
|
||||
"A Neon account. The hosted server grants broad project and database management, so use a development project and review write actions before connecting production data.",
|
||||
"Neon recommends its hosted server for development and testing. Review write and destructive actions before execution."
|
||||
],
|
||||
"tenantFields": [
|
||||
{
|
||||
"key": "projectId",
|
||||
"label": "Pin to project ID",
|
||||
"type": "text",
|
||||
"advanced": true,
|
||||
"placeholder": "Optional Neon project ID",
|
||||
"helperMd": "Optional. Restrict this connection to one project. Copy the project ID from Neon Console → Project settings → General.",
|
||||
"validation": {
|
||||
"pattern": "^[a-z0-9-]+$",
|
||||
"maxLength": 64
|
||||
},
|
||||
"transport": {
|
||||
"location": "query",
|
||||
"name": "projectId"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "readOnly",
|
||||
"label": "Read-only mode",
|
||||
"type": "checkbox",
|
||||
"defaultValue": false,
|
||||
"helperMd": "Enable this to limit SQL to SELECT queries and schema inspection.",
|
||||
"transport": {
|
||||
"location": "query",
|
||||
"name": "readonly",
|
||||
"format": "boolean",
|
||||
"omitFalse": true
|
||||
},
|
||||
"advanced": true
|
||||
}
|
||||
],
|
||||
"requiredResourceFilters": [
|
||||
"project"
|
||||
]
|
||||
},
|
||||
{
|
||||
"key": "mcp-api-key",
|
||||
"transport": "mcp_remote",
|
||||
"auth": "api_key",
|
||||
"ownershipModes": [
|
||||
"customer"
|
||||
],
|
||||
"whenToUse": "Use a restricted customer-owned key when browser sign-in is not suitable.",
|
||||
"defaults": {
|
||||
"serverUrl": "https://mcp.neon.tech/mcp"
|
||||
},
|
||||
"guidanceMd": "Use a customer-created Neon API key. Prefer a project-scoped key for one development project; personal and organization keys reach every project they can access. Write tools start enabled and remain governed by Paperclip's action policies.",
|
||||
"riskTier": "S4",
|
||||
"label": "Use an API key",
|
||||
"credentialFields": [
|
||||
{
|
||||
"key": "authorization",
|
||||
"label": "Neon API key",
|
||||
"type": "password",
|
||||
"required": true,
|
||||
"placeholder": "napi_... or neon_project_key_...",
|
||||
"secret": true,
|
||||
"helperMd": "Project, branch, compute, snapshot, SQL and schema changes within the key’s reach. A project-scoped key limits access to one project with Editor rights; personal and organization keys reach every project they can access. Paperclip cannot increase an existing key’s permissions."
|
||||
}
|
||||
],
|
||||
"keyPlacement": {
|
||||
"location": "header",
|
||||
"name": "Authorization",
|
||||
"prefix": "Bearer "
|
||||
},
|
||||
"consoleLinks": {
|
||||
"keys": "https://console.neon.tech/app/settings/api-keys",
|
||||
"docs": "https://neon.com/docs/ai/neon-mcp-server"
|
||||
},
|
||||
"warnings": [
|
||||
"A Neon account. The hosted server grants broad project and database management, so use a development project and review write actions before connecting production data.",
|
||||
"Neon recommends its hosted server for development and testing. Review write and destructive actions before execution."
|
||||
],
|
||||
"tenantFields": [
|
||||
{
|
||||
"key": "projectId",
|
||||
"label": "Pin to project ID",
|
||||
"type": "text",
|
||||
"advanced": true,
|
||||
"placeholder": "Optional Neon project ID",
|
||||
"helperMd": "Optional. Restrict this connection to one project. Copy the project ID from Neon Console → Project settings → General.",
|
||||
"validation": {
|
||||
"pattern": "^[a-z0-9-]+$",
|
||||
"maxLength": 64
|
||||
},
|
||||
"transport": {
|
||||
"location": "query",
|
||||
"name": "projectId"
|
||||
}
|
||||
},
|
||||
{
|
||||
"key": "readOnly",
|
||||
"label": "Read-only mode",
|
||||
"type": "checkbox",
|
||||
"defaultValue": false,
|
||||
"helperMd": "Enable this to limit SQL to SELECT queries and schema inspection.",
|
||||
"transport": {
|
||||
"location": "query",
|
||||
"name": "readonly",
|
||||
"format": "boolean",
|
||||
"omitFalse": true
|
||||
},
|
||||
"advanced": true
|
||||
}
|
||||
],
|
||||
"requiredResourceFilters": [
|
||||
"project"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -70,5 +70,8 @@
|
||||
"name": "OPENAI_API_KEY"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"model-provider"
|
||||
]
|
||||
}
|
||||
@@ -49,5 +49,8 @@
|
||||
"name": "OPENROUTER_API_KEY"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"model-provider"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"slug": "responses-api",
|
||||
"name": "Responses API",
|
||||
"description": "Connect any compatible harness to an OpenAI Responses-compatible provider or gateway, including Emissary.",
|
||||
"categories": [
|
||||
"ai"
|
||||
],
|
||||
"branding": {
|
||||
"logoUrl": "/brands/apps/api-key-generic.svg"
|
||||
},
|
||||
"urlPatterns": [],
|
||||
"methods": [
|
||||
{
|
||||
"key": "ai-api_key",
|
||||
"label": "Responses API API key",
|
||||
"purpose": "ai",
|
||||
"transport": "runtime_auth",
|
||||
"auth": "api_key",
|
||||
"ai": {
|
||||
"provider": "openai",
|
||||
"method": "api_key"
|
||||
},
|
||||
"grantKinds": [
|
||||
"user",
|
||||
"organization"
|
||||
],
|
||||
"ownershipModes": [
|
||||
"customer"
|
||||
],
|
||||
"whenToUse": "Connect any compatible harness to an OpenAI Responses-compatible provider or gateway, including Emissary.",
|
||||
"guidanceMd": "Use your personal account or an explicitly shared company account.",
|
||||
"riskTier": "S3",
|
||||
"credentialFields": [
|
||||
{
|
||||
"key": "apiKey",
|
||||
"label": "API key",
|
||||
"type": "password",
|
||||
"required": true,
|
||||
"placeholder": "Enter API key",
|
||||
"secret": true
|
||||
}
|
||||
],
|
||||
"keyPlacement": {
|
||||
"location": "env",
|
||||
"name": "OPENAI_API_KEY"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"model-provider"
|
||||
]
|
||||
}
|
||||
@@ -46,5 +46,10 @@
|
||||
"user"
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"agentInstructions": {
|
||||
"id": "supermemory.usage",
|
||||
"version": 1,
|
||||
"text": "Use Supermemory to recall relevant preferences, decisions, and prior work from the workspace and tags authorized for this connection. Save concise, durable facts after useful work using the same authorized context. Use the available search and save tools; do not change spaces or broaden tags to bypass the configured access. Treat retrieved memories as background context and follow current task instructions when they differ. Do not store credentials or copy entire conversations. Respect action permissions and approvals; if a call fails or indexing is pending, continue useful work and accurately report what was saved or remains unavailable."
|
||||
}
|
||||
}
|
||||
@@ -70,5 +70,8 @@
|
||||
"name": "XAI_API_KEY"
|
||||
}
|
||||
}
|
||||
],
|
||||
"tags": [
|
||||
"model-provider"
|
||||
]
|
||||
}
|
||||
@@ -45,5 +45,10 @@
|
||||
"user"
|
||||
]
|
||||
}
|
||||
]
|
||||
],
|
||||
"agentInstructions": {
|
||||
"id": "zep.usage",
|
||||
"version": 1,
|
||||
"text": "Use Zep to search the connected identity’s memory when earlier decisions or preferences matter. Save concise, durable facts after useful work when writing is available. Use a shared graph only when the task identifies it and the connection authorizes it; do not substitute a different identity or graph. Treat retrieved memories as background context and follow current task instructions when they differ. Do not store credentials or copy entire conversations. Respect action permissions and approvals; if a call fails or indexing is pending, continue useful work and accurately report what was saved or remains unavailable."
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,64 @@
|
||||
import { z } from "zod";
|
||||
|
||||
export const composioAppSetupSchema = z.discriminatedUnion("action", [
|
||||
z.object({ action: z.literal("start") }).strict(),
|
||||
z.object({ action: z.literal("status") }).strict(),
|
||||
z.object({ action: z.literal("complete") }).strict(),
|
||||
]);
|
||||
export type ComposioAppSetupInput = z.infer<typeof composioAppSetupSchema>;
|
||||
export interface ComposioAppSetupResult {
|
||||
status: "not_connected" | "authorization_required" | "connected";
|
||||
authorizationUrl?: string;
|
||||
}
|
||||
|
||||
export interface ComposioAppAccount {
|
||||
id: string;
|
||||
alias: string | null;
|
||||
status: string;
|
||||
isDefault: boolean;
|
||||
/** Non-secret metadata for other aggregator inventories; absent in legacy Composio rows. */
|
||||
appSlug?: string;
|
||||
appName?: string;
|
||||
managementUrl?: string | null;
|
||||
healthCheckedAt?: string | null;
|
||||
}
|
||||
|
||||
/** Provider observations only; this never grants agent access. */
|
||||
export interface ComposioAppSnapshot {
|
||||
connectionId: string;
|
||||
toolkit: string;
|
||||
status: "connected" | "not_connected";
|
||||
accounts: ComposioAppAccount[];
|
||||
checkedAt: string;
|
||||
errorAt?: string | null;
|
||||
}
|
||||
|
||||
export interface ComposioAppSyncState {
|
||||
status: "idle" | "syncing" | "ready" | "error";
|
||||
/** Connect OAuth currently supports checks of catalog toolkits, not list-all enumeration. */
|
||||
coverage: "supported_catalog";
|
||||
checked: number;
|
||||
total: number;
|
||||
failed: number;
|
||||
lastCompletedAt: string | null;
|
||||
error: string | null;
|
||||
}
|
||||
|
||||
export interface ComposioAppsResponse {
|
||||
apps: ComposioAppSnapshot[];
|
||||
sync: ComposioAppSyncState;
|
||||
}
|
||||
|
||||
export const composioAppsSyncSchema = z.object({ force: z.boolean().default(false) }).strict();
|
||||
|
||||
export const composioAppsRefreshSchema = z.object({
|
||||
toolkits: z.array(z.string().min(1).max(200)).max(64).default([]),
|
||||
}).strict();
|
||||
|
||||
const accountId = z.string().min(1).max(200);
|
||||
export const composioAppAccountSchema = z.discriminatedUnion("action", [
|
||||
z.object({ action: z.literal("add") }).strict(),
|
||||
z.object({ action: z.literal("rename"), accountId, alias: z.string().trim().min(1).max(100) }).strict(),
|
||||
z.object({ action: z.literal("remove"), accountId }).strict(),
|
||||
]);
|
||||
export type ComposioAppAccountInput = z.infer<typeof composioAppAccountSchema>;
|
||||
@@ -0,0 +1,86 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { cpSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
||||
import { tmpdir } from "node:os";
|
||||
import { dirname, join } from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { connectionAgentInstructionsSchema, connectionInstructionContext, defaultConnectionAgentInstructions } from "./connection-instructions.js";
|
||||
import { getConnectableAppDefinition } from "./app-definitions.js";
|
||||
import { connectToolAppSchema, createToolConnectionSchema, finishToolAppSchema, updateToolConnectionSchema } from "./validators/tool-access.js";
|
||||
import { appDefinitionSchema } from "./validators/app-definition.js";
|
||||
|
||||
describe("generic connection instructions", () => {
|
||||
it.each(["honcho", "mem0", "zep", "supermemory", "cognee"])("validates and enables the reviewed %s default", (slug) => {
|
||||
const app = appDefinitionSchema.parse(getConnectableAppDefinition(slug));
|
||||
const settings = connectionAgentInstructionsSchema.parse(defaultConnectionAgentInstructions(app.agentInstructions));
|
||||
expect(settings.enabled).toBe(true);
|
||||
expect(settings.template?.version).toBeGreaterThan(0);
|
||||
expect(settings.text).toContain("current task");
|
||||
expect(settings.text).toContain("approvals");
|
||||
});
|
||||
it("supports non-memory templates and saved settings without a template", () => {
|
||||
const app = { ...getConnectableAppDefinition("notion")!, agentInstructions: { id: "handbook", version: 1, text: "Consult the current release checklist." } };
|
||||
expect(appDefinitionSchema.parse(app).agentInstructions).toEqual(app.agentInstructions);
|
||||
const value = { enabled: false, text: "Keep this custom paragraph." };
|
||||
expect(updateToolConnectionSchema.parse({ agentInstructions: value }).agentInstructions).toEqual(value);
|
||||
expect(connectToolAppSchema.parse({ galleryKey: "notion", agentInstructions: value }).agentInstructions).toEqual(value);
|
||||
expect(finishToolAppSchema.parse({ enabledCatalogEntryIds: [], askFirstCatalogEntryIds: [], access: "all_agents", agentInstructions: value }).agentInstructions).toEqual(value);
|
||||
expect(createToolConnectionSchema.parse({ name: "Handbook", transport: "mcp_remote", agentInstructions: value }).agentInstructions).toEqual(value);
|
||||
expect(defaultConnectionAgentInstructions(getConnectableAppDefinition("notion")?.agentInstructions)).toBeNull();
|
||||
});
|
||||
it("withholds unconfigured instructions and never includes secret fields", () => {
|
||||
const app = getConnectableAppDefinition("honcho")!;
|
||||
expect(connectionInstructionContext(app, { methodConfig: { workspaceId: " " } })).toBeNull();
|
||||
expect(connectionInstructionContext(app, { methodConfig: { workspaceId: " team ", apiKey: "secret" } })).toEqual({ workspaceId: "team" });
|
||||
});
|
||||
it("allows explicit clearing and rejects blank or unbounded text", () => {
|
||||
expect(updateToolConnectionSchema.parse({ agentInstructions: null }).agentInstructions).toBeNull();
|
||||
expect(connectionAgentInstructionsSchema.safeParse({ enabled: true, text: " " }).success).toBe(false);
|
||||
expect(connectionAgentInstructionsSchema.safeParse({ enabled: true, text: "a".repeat(2001) }).success).toBe(false);
|
||||
});
|
||||
|
||||
it("regenerates templates from each app definition, including non-memory edits and removal", () => {
|
||||
const root = fileURLToPath(new URL("../../../", import.meta.url));
|
||||
const fixture = mkdtempSync(join(tmpdir(), "paperclip-app-instructions-"));
|
||||
const definitions = join(fixture, "packages/shared/src/app-definitions");
|
||||
const readApp = (slug: string) => JSON.parse(readFileSync(join(definitions, `${slug}.json`), "utf8"));
|
||||
const writeApp = (slug: string, app: unknown) => writeFileSync(join(definitions, `${slug}.json`), JSON.stringify(app));
|
||||
const generate = () => execFileSync(process.execPath, [join(root, "scripts/ingest-app-definitions.mjs"), "--definitions-only"], { cwd: fixture, stdio: "pipe" });
|
||||
try {
|
||||
for (const source of [
|
||||
"ui/public/brands/apps/manifest.json",
|
||||
"packages/shared/src/self-serve-mcp-research.json",
|
||||
"doc/connections/tool-method-permission-reviews.json",
|
||||
"packages/shared/src/app-definitions",
|
||||
]) {
|
||||
mkdirSync(dirname(join(fixture, source)), { recursive: true });
|
||||
cpSync(join(root, source), join(fixture, source), { recursive: true });
|
||||
}
|
||||
const notion = readApp("notion");
|
||||
notion.agentInstructions = { id: "notion.handbook", version: 2, text: "Consult the current release checklist." };
|
||||
writeApp("notion", notion);
|
||||
generate();
|
||||
expect(readApp("notion").agentInstructions).toEqual(notion.agentInstructions);
|
||||
for (const slug of ["honcho", "mem0", "zep", "supermemory", "cognee"]) {
|
||||
expect(readApp(slug).agentInstructions).toEqual(getConnectableAppDefinition(slug)?.agentInstructions);
|
||||
}
|
||||
expect(readApp("linear").agentInstructions).toBeUndefined();
|
||||
|
||||
notion.agentInstructions.text = "Check the updated handbook before a release.";
|
||||
notion.agentInstructions.version++;
|
||||
writeApp("notion", notion);
|
||||
const mem0 = readApp("mem0");
|
||||
delete mem0.agentInstructions;
|
||||
writeApp("mem0", mem0);
|
||||
generate();
|
||||
expect(readApp("notion").agentInstructions).toEqual(notion.agentInstructions);
|
||||
expect(readApp("mem0").agentInstructions).toBeUndefined();
|
||||
|
||||
notion.agentInstructions.text = " ";
|
||||
writeApp("notion", notion);
|
||||
expect(generate).toThrow("notion: invalid agent instruction template");
|
||||
} finally {
|
||||
rmSync(fixture, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,66 @@
|
||||
import { z } from "zod";
|
||||
import type { AppDefinition } from "./types/app-definition.js";
|
||||
|
||||
export const CONNECTION_INSTRUCTIONS_MAX_LENGTH = 2000;
|
||||
|
||||
/** Optional catalog capability. It is independent of provider and transport. */
|
||||
export const connectionInstructionTemplateSchema = z.object({
|
||||
id: z.string().trim().min(1).max(160),
|
||||
version: z.number().int().positive(),
|
||||
text: z.string().trim().min(1).max(CONNECTION_INSTRUCTIONS_MAX_LENGTH),
|
||||
});
|
||||
export type ConnectionInstructionTemplate = z.infer<typeof connectionInstructionTemplateSchema>;
|
||||
|
||||
/** Connection-owned settings; custom connections need not have a template. */
|
||||
export const connectionAgentInstructionsSchema = z.object({
|
||||
enabled: z.boolean(),
|
||||
text: z.string().trim().min(1).max(CONNECTION_INSTRUCTIONS_MAX_LENGTH),
|
||||
template: z.object({
|
||||
id: z.string().trim().min(1).max(160),
|
||||
version: z.number().int().positive(),
|
||||
}).optional(),
|
||||
});
|
||||
export type ConnectionAgentInstructions = z.infer<typeof connectionAgentInstructionsSchema>;
|
||||
|
||||
export function defaultConnectionAgentInstructions(
|
||||
template: ConnectionInstructionTemplate | null | undefined,
|
||||
): ConnectionAgentInstructions | null {
|
||||
return template ? {
|
||||
enabled: true,
|
||||
text: template.text,
|
||||
template: { id: template.id, version: template.version },
|
||||
} : null;
|
||||
}
|
||||
|
||||
/** The server supplies this immutable snapshot, never the wake request author. */
|
||||
export interface ConnectionInstructionsSnapshot {
|
||||
text: string;
|
||||
digest: string;
|
||||
}
|
||||
|
||||
/** Older connections can retain catalog metadata only in transportConfig. */
|
||||
export function connectionInstructionsConfig(connection: {
|
||||
config?: Record<string, unknown> | null;
|
||||
transportConfig?: Record<string, unknown> | null;
|
||||
}): Record<string, unknown> {
|
||||
return { ...connection.transportConfig, ...connection.config };
|
||||
}
|
||||
|
||||
/** Only public configuration fields declared by the connector enter prompts. */
|
||||
export function connectionInstructionContext(
|
||||
app: AppDefinition | null | undefined,
|
||||
config: Record<string, unknown>,
|
||||
): Record<string, string | boolean> | null {
|
||||
const method = app?.methods.find((entry) => entry.key === config.connectionMethodKey) ?? app?.methods[0];
|
||||
const values = config.methodConfig && typeof config.methodConfig === "object" && !Array.isArray(config.methodConfig)
|
||||
? config.methodConfig as Record<string, unknown> : {};
|
||||
const context: Record<string, string | boolean> = {};
|
||||
for (const field of [...(method?.tenantFields ?? []), ...(method?.extensionFields ?? [])]) {
|
||||
if (field.secret || field.type === "password") continue;
|
||||
const value = values[field.key] ?? field.defaultValue;
|
||||
if (field.required && (value === undefined || value === null || (typeof value === "string" && !value.trim()))) return null;
|
||||
if (typeof value === "string" && value.trim()) context[field.key] = value.trim();
|
||||
else if (typeof value === "boolean") context[field.key] = value;
|
||||
}
|
||||
return context;
|
||||
}
|
||||
@@ -9,13 +9,14 @@ export const CONNECTION_INTENT_AGENT_GUIDANCE = [
|
||||
"Connection tools:",
|
||||
"- When the user asks to connect a service, call `connections_search` before any service tool, even if already installed. Also search when a task needs a service and usable access is uncertain. Search by its name or capability and follow the returned `instruction`.",
|
||||
"- Use the returned service identifiers and connection tools for setup. Respect recorded user choices; never invent access or ask for credentials in comments.",
|
||||
"- If installed tools are Off or the connection is not enabled for this agent, call `connection_request` with the saved connectionId and required toolNames. It creates a scoped human access card; never substitute a generic permission question or change permissions yourself.",
|
||||
"- When waiting for user action, finish independent work, then yield without retrying or polling. On continuation, follow the recorded outcome and use the installed connection.",
|
||||
"- Do not use connection tools for arbitrary MCP URLs or unrelated work.",
|
||||
].join("\n");
|
||||
|
||||
export const CONNECTIONS_SEARCH_TOOL_DESCRIPTION = "Search connections across tool, channel/email, and AI purposes with a service name or a natural-language description (up to 4000 characters). Results tolerate extra words, split names, and small typos. Choose the relevant match using its description and method purpose. Follow the returned instruction to present an inline setup card with connection_request or share the method's setupPath. Also discovers verified external aggregator apps. Use first when the user asks to connect a service, or when usable access is uncertain; follow the returned instruction and exact providerQuestion, if any. Do not use for arbitrary MCP URLs. Search is read-only.";
|
||||
|
||||
export const CONNECTION_REQUEST_TOOL_DESCRIPTION = "Request the service identifier returned by connections_search as available or needs_user_action. Follow the search instruction; aggregator routes require the saved provider-selection interaction ID. Only this tool creates the real setup card. If user action is needed, finish independent work, then yield without retrying or asking for credentials in comments.";
|
||||
export const CONNECTION_REQUEST_TOOL_DESCRIPTION = "Request the service identifier returned by connections_search. For an existing connection with missing agent access, pass connectionId and the exact required toolNames to create an embedded Grant access card; only the human can approve it. Follow the search instruction; aggregator routes require the saved provider-selection interaction ID. Only this tool creates the real setup card. If user action is needed, finish independent work, then yield without retrying or asking for credentials in comments.";
|
||||
|
||||
export const CONNECTION_RUNTIME_TOOL_NAMES = [
|
||||
"connections_search",
|
||||
|
||||
@@ -7,6 +7,8 @@ import {
|
||||
type RemoteMcpConnectorId,
|
||||
} from "./remote-mcp-connectors.js";
|
||||
import composioCatalog from "./composio-search-catalog.json" with { type: "json" };
|
||||
import arcadeCatalog from "./arcade-app-catalog.json" with { type: "json" };
|
||||
import { aggregatorAppIdentity } from "./aggregator-app-catalog.js";
|
||||
import { prepareConnectionSearch, scoreConnectionSearch } from "./connection-search.js";
|
||||
|
||||
export const AGGREGATOR_PRIORITY = [
|
||||
@@ -214,6 +216,19 @@ for (const [toolkit, name] of composioCatalog.toolkits as Array<[string, string]
|
||||
}
|
||||
}
|
||||
|
||||
for (const app of arcadeCatalog.apps) {
|
||||
const existing = AGGREGATOR_SUPPORT_INDEX.find((entry) =>
|
||||
entry.slug === app.slug || aggregatorAppIdentity(entry.name) === aggregatorAppIdentity(app.name));
|
||||
if (existing) {
|
||||
existing.aliases = [...new Set([...existing.aliases, app.slug, ...app.aliases])];
|
||||
existing.providers = { ...existing.providers, arcade: arcadeCatalog.verifiedAt };
|
||||
existing.evidenceUrls = { ...existing.evidenceUrls, arcade: app.docsUrl };
|
||||
} else {
|
||||
AGGREGATOR_SUPPORT_INDEX.push({ slug: app.slug, name: app.name, aliases: app.aliases,
|
||||
providers: { arcade: arcadeCatalog.verifiedAt }, evidenceUrls: { arcade: app.docsUrl } });
|
||||
}
|
||||
}
|
||||
|
||||
export function searchAggregatorServices(query: string | ReturnType<typeof prepareConnectionSearch>) {
|
||||
const prepared = typeof query === "string" ? prepareConnectionSearch(query) : query;
|
||||
return AGGREGATOR_SUPPORT_INDEX.map(service => ({ service,
|
||||
|
||||
@@ -1320,6 +1320,7 @@ export type PluginCategory = (typeof PLUGIN_CATEGORIES)[number];
|
||||
* @see PLUGIN_SPEC.md §15 — Capability Model
|
||||
*/
|
||||
export const PLUGIN_CAPABILITIES = [
|
||||
"ai.connections.route",
|
||||
// Data Read
|
||||
"companies.read",
|
||||
"projects.read",
|
||||
|
||||
@@ -50,6 +50,11 @@ export const INSTANCE_FEATURE_CATALOG: Record<InstanceFeatureKey, FeatureCatalog
|
||||
cloudDefault: false,
|
||||
selfHostedDefault: false,
|
||||
},
|
||||
enableAiConnectionRouters: {
|
||||
title: "AI connection routers",
|
||||
description: "Allow experimental plugin connections to choose task-pinned accounts and harnesses.",
|
||||
tier: "managed", cloudDefault: false, selfHostedDefault: false,
|
||||
},
|
||||
enableNativeRunner: {
|
||||
title: "Paperclip Runner",
|
||||
description:
|
||||
@@ -154,7 +159,16 @@ export const INSTANCE_FEATURE_CATALOG: Record<InstanceFeatureKey, FeatureCatalog
|
||||
},
|
||||
enableAgentChat: {
|
||||
title: "Agent Chat",
|
||||
description: "Persistent task-backed conversations that clarify goals and hand work off to tasks.",
|
||||
description:
|
||||
"Persistent task-backed conversations that clarify goals and hand work off to tasks. Chat leads the Work group with an agent rail, and each chat's side panel shows the agent's tasks and artifacts as cards.",
|
||||
tier: "managed",
|
||||
cloudDefault: false,
|
||||
selfHostedDefault: false,
|
||||
},
|
||||
enableCombinedInboxTasks: {
|
||||
title: "Combined Inbox + Task List",
|
||||
description:
|
||||
"Inbox becomes a set of views inside Tasks: one Tasks row in the nav carries the unread badge, and a Views menu reaches every inbox and task view.",
|
||||
tier: "managed",
|
||||
cloudDefault: false,
|
||||
selfHostedDefault: false,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export { composioAppSetupSchema, composioAppsRefreshSchema, composioAppsSyncSchema, composioAppAccountSchema, type ComposioAppSetupInput, type ComposioAppSetupResult, type ComposioAppAccountInput, type ComposioAppAccount, type ComposioAppSnapshot, type ComposioAppSyncState, type ComposioAppsResponse } from "./composio-app-setup.js";
|
||||
export { agentAdapterTypeSchema, optionalAgentAdapterTypeSchema } from "./adapter-type.js";
|
||||
export {
|
||||
RUNNER_GOAL_MAX_OBJECTIVE_CHARS,
|
||||
@@ -932,6 +933,7 @@ export type {
|
||||
AgentDetail,
|
||||
ClearAgentErrorResponse,
|
||||
AgentPermissions,
|
||||
AgentPublicIdentity,
|
||||
AgentInstructionsBundleMode,
|
||||
AgentInstructionsFileSummary,
|
||||
AgentInstructionsFileDetail,
|
||||
@@ -962,6 +964,8 @@ export type {
|
||||
SetupTokenTransportAdvisoryCode,
|
||||
AssetImage,
|
||||
Project,
|
||||
ProjectDiscoverySummary,
|
||||
ProjectDiscoveryPage,
|
||||
ProjectBudgetSummary,
|
||||
ProjectRepository,
|
||||
ProjectRepositoryOptions,
|
||||
@@ -1918,6 +1922,7 @@ export {
|
||||
type ResetAgentSession,
|
||||
type TestAdapterEnvironment,
|
||||
type UpdateAgentPermissions,
|
||||
projectDiscoverySchema,
|
||||
createProjectSchema,
|
||||
updateProjectSchema,
|
||||
createProjectWorkspaceSchema,
|
||||
@@ -2785,6 +2790,7 @@ export { EXECUTION_RECONCILIATION_CAUSES, requiresExecutionReconciliation } from
|
||||
|
||||
export * from "./agent-appearance.js";
|
||||
export * from "./ai-connections.js";
|
||||
export * from "./ai-connection-router.js";
|
||||
export * from "./ai-connection-usage.js";
|
||||
export * from "./types/email.js";
|
||||
export * from "./validators/email.js";
|
||||
@@ -2815,5 +2821,14 @@ export * from "./browser-use.js";
|
||||
|
||||
export * from "./types/skill-source.js";
|
||||
export * from "./validators/skill-source.js";
|
||||
export * from "./validators/agent-commentary.js";
|
||||
export * from "./github-skill-repository.js";
|
||||
export * from "./public-mcp.js";
|
||||
export * from "./mcp-setup.js";
|
||||
|
||||
|
||||
export * from "./ai-provider-routing.js";
|
||||
export { aiConnectionRouterSlug, aiConnectionRouterAppDefinition, aiConnectionRouterPluginKey } from "./ai-connection-router.js";
|
||||
export { isAppAggregator, aggregatorManagementUrl, aggregatorAppsSyncSchema, aggregatorAppsRefreshSchema, arcadeDiscoverySetupSchema, type AggregatorAppSnapshot, type AggregatorAppsResponse, type ArcadeDiscoverySetupInput } from "./aggregator-apps.js";
|
||||
|
||||
export * from "./connection-instructions.js";
|
||||
@@ -0,0 +1,62 @@
|
||||
import { PUBLIC_MCP_SCOPES } from "./public-mcp.js";
|
||||
|
||||
export type AssistantClient = "codex" | "claude" | "opencode" | "browser" | "headless" | "other";
|
||||
export const assistantClientNames: Record<AssistantClient, string> = {
|
||||
codex: "Codex", claude: "Claude Code", opencode: "OpenCode", browser: "ChatGPT / Claude web", headless: "Headless", other: "Other",
|
||||
};
|
||||
export function mcpSetupUrl(serverUrl: string, companyId?: string) {
|
||||
const url = new URL("/mcp/setup", serverUrl);
|
||||
if (companyId) url.searchParams.set("company", companyId);
|
||||
return url.toString();
|
||||
}
|
||||
export function mcpInvitation(serverUrl: string, company?: { id: string; name: string }) {
|
||||
return `Connect to my ${company ? `${company.name} ` : ""}Paperclip organization using the instructions at ${mcpSetupUrl(serverUrl, company?.id)}. Start authorization, give me the approval link, and verify the connection after I approve. This connects as me, not as a Paperclip agent.`;
|
||||
}
|
||||
export function mcpSetupSteps(serverUrl: string, assistant: AssistantClient) {
|
||||
const quoted = `'${serverUrl.replaceAll("'", "'\"'\"'")}'`;
|
||||
const scopes = PUBLIC_MCP_SCOPES.join(" ");
|
||||
switch (assistant) {
|
||||
case "codex": return [
|
||||
{ text: "Check for an existing Paperclip server first. Reuse it only if its URL matches this instance. Add the remote server with the Codex CLI.", code: `codex mcp add paperclip --url ${quoted}` },
|
||||
{ text: "Start browser authorization and give the user the approval link.", code: "codex mcp login paperclip --scopes paperclip:read,paperclip:write,offline_access" },
|
||||
{ text: "If the current conversation does not reload its MCP tools, start a new conversation or restart the client. Verify the connection with paperclip_connection before claiming success." },
|
||||
];
|
||||
case "claude": return [
|
||||
{ text: "Check existing servers and reuse a matching instance. Add the remote server using Claude Code.", code: `claude mcp add --transport http paperclip ${quoted}` },
|
||||
{ text: "In Claude Code, run /mcp, select paperclip, and choose Authenticate. Versions that offer `claude mcp login --help` can also start authorization with `claude mcp login paperclip`. Give the user the approval link." },
|
||||
{ text: "Reconnect through /mcp, or start a new session if needed. Verify the account and organization with paperclip_connection." },
|
||||
];
|
||||
case "opencode": return [
|
||||
{ text: "Check `opencode --version` and existing configuration. For OpenCode 1.x, merge this entry into opencode.json without replacing other settings. OpenCode 2.x uses mcp.servers; use that version's documented format instead.", code: JSON.stringify({ mcp: { paperclip: { type: "remote", url: serverUrl, enabled: true, oauth: { scope: scopes } } } }, null, 2) },
|
||||
{ text: "Run from the same project directory. OpenCode opens Paperclip's sign-in and consent page; give the user the approval link.", code: "opencode mcp auth paperclip" },
|
||||
{ text: "If OpenCode was already running, restart it to load the connection. For the browser app, use this command. Verify the tools with paperclip_connection.", code: "opencode web" },
|
||||
];
|
||||
case "browser": return [
|
||||
{ text: "Open your assistant's Apps / Connectors settings and add a custom remote MCP connection using this URL. Availability depends on the account and workspace policy. Reading this page in chat does not install a connector.", code: serverUrl },
|
||||
{ text: "Choose OAuth / browser sign-in. Approve the connection in Paperclip, then select the connector in your conversation. If custom connectors are unavailable, use a supported local client. Verify the connected account and organization before doing work." },
|
||||
];
|
||||
case "headless": return [
|
||||
{ text: "Use a Paperclip CLI version with `mcp login --device` support. This needs no callback listener; it prints a verification URL and user code, then waits for human approval.", code: `paperclipai mcp login --device --url ${quoted}` },
|
||||
{ text: "After approval, configure a local stdio MCP server running the command below. Credentials stay in the CLI's private credential store. Do not copy tokens or device codes into chat or project configuration.", code: `paperclipai mcp proxy --url ${quoted}` },
|
||||
{ text: "The user code is for the human to verify the request. The private device code remains inside the CLI. After connecting, call paperclip_connection to verify the account and organization." },
|
||||
];
|
||||
default: return [
|
||||
{ text: "Add a remote HTTP MCP server at this URL, then choose OAuth / browser sign-in.", code: serverUrl },
|
||||
{ text: "If the client cannot install MCP servers from chat, use its connection settings. If it cannot receive a browser callback, use the Headless instructions. After approval, verify the account and organization with paperclip_connection." },
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
export const mcpAuthorizationHandoffInstructions = "Authorization commands wait for human approval. When using an assistant shell tool, keep the command running in a persistent terminal or background process, capture its output privately, and share the approval URL immediately while it is still running. Client callback deadlines still apply. If the command timed out or stopped, start a fresh authorization request before sharing a link. If the host cannot keep the command alive across turns, ask the user to run it in their own terminal.";
|
||||
|
||||
export function mcpSetupMarkdown(serverUrl: string, companyId?: string) {
|
||||
return ["# Connect your assistant to Paperclip", "",
|
||||
"These are setup instructions, not an access credential. Ask the human to approve the identified client in Paperclip. Never approve on their behalf or reuse browser cookies as MCP credentials.", "",
|
||||
`MCP server: ${serverUrl}`, ...(companyId ? [`Requested organization ID: ${companyId} (a hint, not authority).`] : []), "",
|
||||
"Keep existing client settings. If the name paperclip already points elsewhere, use a distinct server name and the same name in the login command. Stop and explain if the host cannot configure MCP. A restart or new conversation may be required; do not claim tools are available until a real call succeeds.", "",
|
||||
mcpAuthorizationHandoffInstructions, "",
|
||||
...Object.entries(assistantClientNames).flatMap(([client, name]) => [`## ${name}`, "", ...mcpSetupSteps(serverUrl, client as AssistantClient).flatMap((step) => [step.text, ...(step.code ? ["", "```", step.code, "```"] : []), ""])]),
|
||||
"## After approval", "",
|
||||
"Call paperclip_connection, verify the human and organization, then summarize agents and open tasks. If the approved organization differs from the requested one, stop and reconnect. Do not create tasks or comments merely to test a connection. Creating tasks or comments can start paid agent work; do that only when requested. Access is governed by the consenting human's permissions, not a selected agent's identity.", "",
|
||||
].join("\n");
|
||||
}
|
||||
@@ -14,14 +14,24 @@ export interface McpConnectionRequest {
|
||||
id: string;
|
||||
clientName: string;
|
||||
redirectOrigin: string;
|
||||
requestedWrite: boolean;
|
||||
clientOrigin?: string | null;
|
||||
agentConnection?: boolean;
|
||||
requestedWrite: boolean;
|
||||
offlineAccess: boolean;
|
||||
requiresSignIn: boolean;
|
||||
companies: Array<{ id: string; name: string; canWrite: boolean }>;
|
||||
/** Fixed by the authorization request; null permits direct-instance selection. */
|
||||
requestedCompanyId: string | null;
|
||||
companies: Array<{ id: string; name: string; logoUrl: string | null; canWrite: boolean }>;
|
||||
setupUrl: string | null;
|
||||
}
|
||||
|
||||
export interface McpConnectionSetup {
|
||||
enabled: boolean;
|
||||
serverUrl: string;
|
||||
invitationUrl: string;
|
||||
invitation: string;
|
||||
}
|
||||
|
||||
export interface McpConnection {
|
||||
id: string;
|
||||
companyId: string;
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
{ "slug": "zomato", "name": "Zomato", "wave": "blocked", "status": "blocked", "docsUrl": "https://github.com/Zomato/mcp-server-manifest", "serverUrl": "https://mcp-server.zomato.com/mcp", "authMode": "provider_approval", "prerequisite": "Zomato currently limits third-party clients and requires redirect-URI allowlisting.", "riskTier": "S3" },
|
||||
{"slug": "zep", "name": "Zep", "wave": 3, "status": "self_serve", "docsUrl": "https://help.getzep.com/memory-mcp-server", "serverUrl": "https://api.getzep.com/mcp", "authMode": "dcr_cimd", "prerequisite": "A Zep project with Memory MCP enabled, available MCP seats, and Google Workspace or enterprise OIDC configured by its administrator. Project API keys do not authenticate Memory MCP.", "riskTier": "S3"},
|
||||
{"slug": "supermemory", "name": "Supermemory", "wave": 3, "status": "self_serve", "docsUrl": "https://supermemory.ai/docs/supermemory-mcp/mcp", "serverUrl": "https://mcp.supermemory.ai/mcp", "authMode": "dcr", "prerequisite": "Sign in to Supermemory and select the spaces this connection may access. The hosted MCP uses OAuth, not a developer API key.", "riskTier": "S3"},
|
||||
{"slug": "honcho", "name": "Honcho", "wave": 3, "status": "self_serve", "docsUrl": "https://honcho.dev/docs/v3/guides/integrations/mcp", "serverUrl": "https://mcp.honcho.dev", "authMode": "api_key", "prerequisite": "An API key from the Honcho dashboard. Memory is stored in your Honcho account; select workspace and peer identifiers when calling tools.", "riskTier": "S3"}
|
||||
{"slug": "honcho", "name": "Honcho", "wave": 3, "status": "self_serve", "docsUrl": "https://honcho.dev/docs/v3/guides/integrations/mcp", "serverUrl": "https://mcp.honcho.dev", "authMode": "api_key", "prerequisite": "An API key from the Honcho dashboard. Memory is stored in your Honcho account; select workspace and peer identifiers when calling tools.", "riskTier": "S3"},
|
||||
{ "slug": "neon", "name": "Neon", "wave": 4, "status": "self_serve", "docsUrl": "https://neon.com/docs/ai/neon-mcp-server", "serverUrl": "https://mcp.neon.tech/mcp", "authMode": "dcr_or_api_key", "prerequisite": "A Neon account. The hosted server grants broad project and database management, so use a development project and review write actions before connecting production data.", "riskTier": "S4" }
|
||||
]
|
||||
}
|
||||
@@ -25,7 +25,7 @@ export interface AgentPermissions extends Record<string, unknown> {
|
||||
}
|
||||
|
||||
export type AgentRuntimeConfig = Record<string, unknown> & {
|
||||
aiConnection?: import("../ai-connections.js").AiConnectionBinding;
|
||||
aiConnection?: import("../ai-connection-router.js").AiRuntimeConnectionBinding;
|
||||
};
|
||||
|
||||
export type AgentInstructionsBundleMode = "managed" | "external";
|
||||
@@ -415,3 +415,11 @@ export interface AgentInstructionCandidate {
|
||||
createdAt: string;
|
||||
updatedAt: string;
|
||||
}
|
||||
|
||||
/** Public cryptographic identity; private material is runtime-only. */
|
||||
export interface AgentPublicIdentity {
|
||||
algorithm: "Ed25519";
|
||||
keyId: string;
|
||||
publicKeyPem: string;
|
||||
createdAt: string;
|
||||
}
|
||||
@@ -3,7 +3,7 @@ export type AppCategory = "ai"|"analytics"|"commerce"|"communication"|"content"|
|
||||
export type OAuthRedirectConstraints = "https-or-loopback-http";
|
||||
export interface FieldDef { key:string; label:string; type:"text"|"password"|"textarea"|"datetime"|"select"|"checkbox"; required?:boolean; advanced?:boolean; hidden?:boolean; placeholder?:string; helperMd?:string; secret?:boolean; prefix?:string; defaultValue?:string|boolean; validation?:{pattern?:string;maxLength?:number}; options?:Array<{value:string;label:string}>; transport?:{location:"query"|"header";name:string;format?:"string"|"csv"|"boolean";omitFalse?:boolean} }
|
||||
export interface ConnectionMethodDef { ai?: import("../ai-connections.js").AiConnectionMetadata; key:string; label?:string; purpose?:ToolConnectionPurpose; provider?:"slack"|"github"|"discord"|"microsoft-teams"|"telegram"|"agentmail"|"imessage-photon"; transport:ToolConnectionTransport; auth:"oauth"|"api_key"|"none"; oauthStrategy?:"paperclip_cloud_connector"|"paperclip_id_connector"; connectorProfile?:string; oauthClientSecretRequired?:boolean; capabilityProfile?:{key:string;label:string;description?:string}; grantKinds?:ConnectionGrantKind[]; ownershipModes:ToolConnectionOwnership[]; whenToUse:string; defaults?:{serverUrl?:string;serverUrlTemplate?:string;discoveryUrl?:string|null;serviceHost?:string;templateKey?:string;authorizationEndpoint?:string;tokenEndpoint?:string;metadataUrl?:string;scopesHint?:string[];oauthAuthorizationParams?:{access_type?:"offline";prompt?:"consent"};toolArgumentDefaults?:Record<string,unknown>}; tenantFields?:FieldDef[]; extensionFields?:FieldDef[]; configRequirements?:{atLeastOneOf?:string[]}; credentialFields?:FieldDef[]; keyPlacement?:{location:"header"|"query"|"body_json"|"env";name:string;prefix?:string|null}; credentialSources?:{vercelConnect?:{services:string[];principalModes:VercelConnectPrincipalMode[];scopes:string[];header:{name:string;prefix?:string|null}}}; guidanceMd:string; consoleLinks?:{register?:string;keys?:string;settings?:string;docs?:string}; warnings?:string[]; variants?:Array<{key:string;label:string;whenToUse:string;tenantFields?:FieldDef[]}>; riskTier:"S1"|"S2"|"S3"|"S4"; requiredResourceFilters?:string[] }
|
||||
export interface AppDefinition { schemaVersion:1; slug:string; name:string; description:string; categories:AppCategory[]; featured?:boolean; branding:{logoUrl:string;darkLogoUrl?:string;backgroundColor?:string;accentColor?:string}; urlPatterns:string[]; docsUrl?:string; setupPrerequisite?:{title:string;description:string;steps?:string[];actionLabel:string;actionUrl:string}; redirectConstraints?:OAuthRedirectConstraints; methods:ConnectionMethodDef[]; suggestable?:boolean; availability?:{available:boolean;reason?:string;robotEmail?:string}; ownershipAvailability?:Partial<Record<ToolConnectionOwnership,boolean>> }
|
||||
export interface AppDefinition { aiConnectionRouter?: { pluginKey: string }; agentInstructions?: import("../connection-instructions.js").ConnectionInstructionTemplate; schemaVersion:1; slug:string; name:string; description:string; categories:AppCategory[]; tags?:string[]; featured?:boolean; branding:{logoUrl:string;darkLogoUrl?:string;backgroundColor?:string;accentColor?:string}; urlPatterns:string[]; docsUrl?:string; setupPrerequisite?:{title:string;description:string;steps?:string[];actionLabel:string;actionUrl:string}; redirectConstraints?:OAuthRedirectConstraints; methods:ConnectionMethodDef[]; suggestable?:boolean; availability?:{available:boolean;reason?:string;robotEmail?:string}; ownershipAvailability?:Partial<Record<ToolConnectionOwnership,boolean>> }
|
||||
|
||||
export type SelfServeMcpAuthMode =
|
||||
| "dcr"
|
||||
|
||||
@@ -62,6 +62,7 @@ export type ConnectionIntentSetupConnection = Pick<ToolConnection, "id" | "appli
|
||||
export interface ConnectionIntentSetupOptions {
|
||||
/** Resume this request's saved AgentMail account after a partial setup. */
|
||||
emailSetup?: { credentialConnectionId: string | null; readyConnectionId: string | null };
|
||||
canGrantAccess?: boolean;
|
||||
aiConnection?: import("../ai-connections.js").AiConnectionBinding;
|
||||
/** Legacy authentication stays unchanged until the normal validated agent update succeeds. */
|
||||
aiConnectionRequiresAdoption?: boolean;
|
||||
|
||||
@@ -9,6 +9,8 @@ export interface ExecutionBlocker {
|
||||
runError?: string | null;
|
||||
/** Candidate only: admission must still verify termination and all gates. */
|
||||
canContinue?: boolean;
|
||||
/** Explicit Retry candidate; the server rechecks stop proof and execution gates. */
|
||||
canRetry?: boolean;
|
||||
savedMessageCount?: number;
|
||||
}
|
||||
|
||||
|
||||
@@ -280,6 +280,7 @@ export type {
|
||||
AgentDetail,
|
||||
ClearAgentErrorResponse,
|
||||
AgentPermissions,
|
||||
AgentPublicIdentity,
|
||||
AgentRuntimeConfig,
|
||||
AgentInstructionsBundleMode,
|
||||
AgentInstructionsFileSummary,
|
||||
@@ -351,7 +352,7 @@ export type {
|
||||
DocumentTextRange,
|
||||
UpdateDocumentAnnotationThreadRequest,
|
||||
} from "./document-annotation.js";
|
||||
export type { Project, ProjectRepository, ProjectRepositoryOptions, ProjectBudgetSummary, ProjectCodebase, ProjectCodebaseOrigin, ProjectGoalRef, ProjectManagedByPlugin, ProjectWorkspace } from "./project.js";
|
||||
export type { Project, ProjectDiscoverySummary, ProjectDiscoveryPage, ProjectRepository, ProjectRepositoryOptions, ProjectBudgetSummary, ProjectCodebase, ProjectCodebaseOrigin, ProjectGoalRef, ProjectManagedByPlugin, ProjectWorkspace } from "./project.js";
|
||||
export type {
|
||||
CompanySearchCountType,
|
||||
CompanySearchExtractIssueResult,
|
||||
|
||||
@@ -46,6 +46,7 @@ export interface InstanceExperimentalSettings {
|
||||
* Existing native runs ignore later flag changes so they remain recoverable.
|
||||
*/
|
||||
enableNativeRunner: boolean;
|
||||
enableAiConnectionRouters: boolean;
|
||||
/**
|
||||
* Hide the local environment and run all agents in the platform-managed
|
||||
* sandbox environment. Run selection refuses local while this is on.
|
||||
@@ -79,6 +80,8 @@ export interface InstanceExperimentalSettings {
|
||||
enablePipelines: boolean;
|
||||
enableCases: boolean;
|
||||
enableAgentChat: boolean;
|
||||
/** Reorganized left nav, Inbox-as-Tasks-views, and the chat agent rail + task cards. */
|
||||
enableCombinedInboxTasks: boolean;
|
||||
enableConferenceRoomChat: boolean;
|
||||
enableClassicTaskInterface: boolean;
|
||||
enableIssuePlanDecompositions: boolean;
|
||||
|
||||
@@ -1358,6 +1358,17 @@ export type ConnectionIntentPhase = "requested" | "authorizing" | "needs_retry";
|
||||
*/
|
||||
export interface ConnectionIntentPayload {
|
||||
version: 1;
|
||||
/** Server-authored consent to a fixed set of tools on an existing connection. */
|
||||
accessRequest?: {
|
||||
connectionId: string;
|
||||
connectionName: string;
|
||||
tools: Array<{
|
||||
catalogEntryId: string;
|
||||
toolName: string;
|
||||
versionHash: string;
|
||||
permission: "allowed" | "ask_first";
|
||||
}>;
|
||||
};
|
||||
upstreamService?: { slug: string; name: string; selectionInteractionId?: string };
|
||||
/** AI authentication and inbox setup cannot be satisfied by tool credentials. */
|
||||
purpose?: "ai" | "channel";
|
||||
@@ -1516,6 +1527,8 @@ export interface IssueThreadInteractionBase extends IssueThreadInteractionActorF
|
||||
summary?: string | null;
|
||||
status: IssueThreadInteractionStatus;
|
||||
continuationPolicy: IssueThreadInteractionContinuationPolicy;
|
||||
/** Read-time acceptance gate; omitted when no workspace preparation is pending. */
|
||||
acceptanceBlocker?: "workspace_sync_pending";
|
||||
/** @deprecated Read requestedResolverPolicy. Kept for API compatibility. */
|
||||
resolverPolicy: IssueThreadInteractionCanonicalResolverPolicy;
|
||||
requestedResolverPolicy: IssueThreadInteractionCanonicalResolverPolicy;
|
||||
|
||||
@@ -687,6 +687,8 @@ export interface PaperclipPluginManifestV1 {
|
||||
minimumPaperclipVersion?: PluginMinimumHostVersion;
|
||||
/** Capabilities this plugin requires from the host. Enforced at runtime. */
|
||||
capabilities: PluginCapability[];
|
||||
/** Opt into the native pooled-connection catalog, setup, and management UI. */
|
||||
aiConnectionRouter?: { name: string; description: string };
|
||||
/** Entrypoint paths relative to the package root. */
|
||||
entrypoints: {
|
||||
/** Path to the worker entrypoint (required). */
|
||||
|
||||
@@ -75,6 +75,19 @@ export interface ProjectManagedByPlugin {
|
||||
updatedAt: Date;
|
||||
}
|
||||
|
||||
export interface ProjectDiscoverySummary {
|
||||
id: string;
|
||||
name: string;
|
||||
status: string;
|
||||
description: string | null;
|
||||
descriptionTruncated: boolean;
|
||||
}
|
||||
|
||||
export interface ProjectDiscoveryPage {
|
||||
projects: ProjectDiscoverySummary[];
|
||||
nextCursor: string | null;
|
||||
}
|
||||
|
||||
export interface Project {
|
||||
id: string;
|
||||
companyId: string;
|
||||
|
||||
@@ -165,6 +165,7 @@ export interface ToolApplication {
|
||||
}
|
||||
|
||||
export interface ToolConnection {
|
||||
agentInstructions?: import("../connection-instructions.js").ConnectionAgentInstructions | null;
|
||||
id: string;
|
||||
companyId: string;
|
||||
applicationId: string;
|
||||
@@ -218,6 +219,20 @@ export interface ConnectionGrant {
|
||||
strategy?: string;
|
||||
accessTokenExpiresAt?: string | null;
|
||||
scopes?: string[];
|
||||
/**
|
||||
* Whether `scopes` is what the provider asserted, or only what we requested.
|
||||
* `requested_fallback` means the token response carried no `scope`, so the value is
|
||||
* inferred from the request per RFC 6749 §5.1 and is not a provider assertion.
|
||||
*/
|
||||
scopeSource?: "provider" | "requested_fallback";
|
||||
/** Scopes the provider asserted that we never asked for. Empty unless it over-granted. */
|
||||
unrequestedScopes?: string[];
|
||||
/**
|
||||
* The scopes the authorization URL sent for *this* grant, kept per-grant because two
|
||||
* users can authorize the same connection with different scopes. A refresh has no fresh
|
||||
* request, so this is the baseline its response is judged against.
|
||||
*/
|
||||
requestedScopes?: string[];
|
||||
tokenType?: string;
|
||||
refreshTokenExpiresAt?: string;
|
||||
refreshedAt?: string;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
import { z } from "zod";
|
||||
|
||||
/** Same ceiling as an ordinary issue document; brevity is guidance, not a quota. */
|
||||
export const AGENT_COMMENTARY_MAX_LENGTH = 524_288;
|
||||
export const AGENT_COMMENTARY_KINDS = ["complaint", "suggestion"] as const;
|
||||
|
||||
export const agentCommentaryToolInputSchema = z.object({
|
||||
body: z.string().max(AGENT_COMMENTARY_MAX_LENGTH).refine((body) => body.trim().length > 0, "Feedback must not be empty"),
|
||||
idempotencyKey: z.string().trim().min(1).max(240),
|
||||
}).strict();
|
||||
|
||||
export const submitAgentCommentarySchema = agentCommentaryToolInputSchema.extend({
|
||||
kind: z.enum(AGENT_COMMENTARY_KINDS),
|
||||
}).strict();
|
||||
|
||||
export type AgentCommentaryKind = typeof AGENT_COMMENTARY_KINDS[number];
|
||||
export type SubmitAgentCommentary = z.infer<typeof submitAgentCommentarySchema>;
|
||||
export type AgentCommentaryAcknowledgement = {
|
||||
id: string;
|
||||
kind: AgentCommentaryKind;
|
||||
createdAt: string;
|
||||
replayed: boolean;
|
||||
};
|
||||
@@ -1,5 +1,5 @@
|
||||
import { agentAppearanceSchema } from "../agent-appearance.js";
|
||||
import { aiConnectionBindingSchema } from "../ai-connections.js";
|
||||
import { aiRuntimeConnectionBindingSchema as aiConnectionBindingSchema } from "../ai-connection-router.js";
|
||||
import { z } from "zod";
|
||||
import {
|
||||
AGENT_ICON_NAMES,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { z } from "zod";
|
||||
import { connectionInstructionTemplateSchema } from "../connection-instructions.js";
|
||||
import { AI_CONNECTION_CAPABILITIES, aiConnectionMetadataSchema } from "../ai-connections.js";
|
||||
import { connectionGrantKindSchema, toolConnectionOwnershipSchema, toolConnectionPurposeSchema, toolConnectionTransportSchema } from "./tool-access.js";
|
||||
const appBrandAssetUrlSchema=z.string().refine((value)=>{
|
||||
@@ -7,5 +8,12 @@ const appBrandAssetUrlSchema=z.string().refine((value)=>{
|
||||
},{message:"Brand assets must be HTTPS URLs or local /brands/apps SVG/PNG paths"});
|
||||
const field=z.object({key:z.string().min(1),label:z.string().min(1),type:z.enum(["text","password","textarea","datetime","select","checkbox"]),required:z.boolean().optional(),advanced:z.boolean().optional(),hidden:z.boolean().optional(),placeholder:z.string().optional(),helperMd:z.string().optional(),secret:z.boolean().optional(),prefix:z.string().optional(),defaultValue:z.union([z.string(),z.boolean()]).optional(),validation:z.object({pattern:z.string().optional(),maxLength:z.number().int().positive().optional()}).optional(),options:z.array(z.object({value:z.string(),label:z.string()})).optional(),transport:z.object({location:z.enum(["query","header"]),name:z.string().min(1),format:z.enum(["string","csv","boolean"]).optional(),omitFalse:z.boolean().optional()}).optional()}).superRefine((v,c)=>{if(v.required&&v.type!=="checkbox"&&!v.placeholder)c.addIssue({code:"custom",message:"Required fields need placeholders",path:["placeholder"]});if(v.type==="select"&&(!v.options||v.options.length===0))c.addIssue({code:"custom",message:"Select fields need options",path:["options"]});if(v.hidden&&v.defaultValue===undefined)c.addIssue({code:"custom",message:"Hidden fields need defaults",path:["defaultValue"]})});
|
||||
export const connectionMethodDefSchema=z.object({key:z.string().min(1),label:z.string().min(1).optional(),purpose:z.union([toolConnectionPurposeSchema,z.literal("ai")]).optional(),provider:z.enum(["slack","github","discord","microsoft-teams","telegram","agentmail","imessage-photon"]).optional(),transport:z.union([toolConnectionTransportSchema,z.literal("runtime_auth")]),ai:aiConnectionMetadataSchema.optional(),auth:z.enum(["oauth","api_key","none"]),oauthStrategy:z.enum(["paperclip_cloud_connector","paperclip_id_connector"]).optional(),connectorProfile:z.string().regex(/^[a-z0-9]+(?:[.-][a-z0-9]+)*$/).optional(),oauthClientSecretRequired:z.boolean().optional(),capabilityProfile:z.object({key:z.string().min(1),label:z.string().min(1),description:z.string().min(1).optional()}).optional(),grantKinds:z.array(connectionGrantKindSchema).min(1).optional(),ownershipModes:z.array(toolConnectionOwnershipSchema).min(1),whenToUse:z.string().min(1),defaults:z.object({serverUrl:z.string().url().optional(),serverUrlTemplate:z.string().regex(/^https:\/\//).optional(),discoveryUrl:z.string().url().nullable().optional(),serviceHost:z.string().optional(),templateKey:z.string().optional(),authorizationEndpoint:z.string().url().optional(),tokenEndpoint:z.string().url().optional(),metadataUrl:z.string().url().optional(),scopesHint:z.array(z.string()).optional(),oauthAuthorizationParams:z.object({access_type:z.literal("offline").optional(),prompt:z.literal("consent").optional()}).optional(),toolArgumentDefaults:z.record(z.string(),z.unknown()).optional()}).optional(),tenantFields:z.array(field).optional(),extensionFields:z.array(field).optional(),configRequirements:z.object({atLeastOneOf:z.array(z.string().min(1)).min(1).optional()}).optional(),credentialFields:z.array(field).optional(),keyPlacement:z.object({location:z.enum(["header","query","body_json","env"]),name:z.string().min(1),prefix:z.string().nullable().optional()}).optional(),credentialSources:z.object({vercelConnect:z.object({services:z.array(z.string().min(1)).min(1),principalModes:z.array(z.enum(["app","user"])).min(1),scopes:z.array(z.string().min(1)).min(1),header:z.object({name:z.string().min(1),prefix:z.string().nullable().optional()})}).optional()}).optional(),guidanceMd:z.string().min(1),consoleLinks:z.object({register:z.string().url().optional(),keys:z.string().url().optional(),settings:z.string().url().optional(),docs:z.string().url().optional()}).optional(),warnings:z.array(z.string()).optional(),variants:z.array(z.object({key:z.string(),label:z.string(),whenToUse:z.string(),tenantFields:z.array(field).optional()})).optional(),riskTier:z.enum(["S1","S2","S3","S4"]),requiredResourceFilters:z.array(z.string()).optional()}).superRefine((v,c)=>{if((v.transport==="runtime_auth")!==Boolean(v.ai))c.addIssue({code:"custom",message:"Runtime authentication requires AI metadata and AI metadata requires runtime_auth",path:["ai"]});if(v.ai&&!AI_CONNECTION_CAPABILITIES[v.ai.provider].methods[v.ai.method])c.addIssue({code:"custom",message:"Unsupported AI sign-in method",path:["ai","method"]});if(v.ai&&v.auth!==(v.ai.method==="subscription"?"oauth":"api_key"))c.addIssue({code:"custom",message:"AI sign-in method must match authentication",path:["auth"]});const purpose=v.purpose??"tool";if((purpose==="ai")!==(v.transport==="runtime_auth"))c.addIssue({code:"custom",message:"AI methods require runtime_auth and runtime_auth requires AI purpose",path:["purpose"]});if(v.transport==="chat_sdk"&&purpose!=="channel")c.addIssue({code:"custom",message:"Chat SDK methods must be channel connections",path:["purpose"]});if(purpose==="channel"&&v.transport!=="chat_sdk"&&!(v.provider==="agentmail"&&v.transport==="rest_api"))c.addIssue({code:"custom",message:"Channel connections must use the Chat SDK transport",path:["transport"]});if(purpose==="channel"&&!v.provider)c.addIssue({code:"custom",message:"Channel connections require a chat provider",path:["provider"]});if(v.auth==="api_key"&&!v.keyPlacement&&purpose!=="channel")c.addIssue({code:"custom",message:"API-key tool methods require keyPlacement",path:["keyPlacement"]});if(v.oauthStrategy&&v.auth!=="oauth")c.addIssue({code:"custom",message:"OAuth strategies require OAuth auth",path:["oauthStrategy"]});if(v.oauthStrategy&&!v.connectorProfile)c.addIssue({code:"custom",message:"Paperclip Cloud connector methods require connectorProfile",path:["connectorProfile"]});if(v.connectorProfile&&!v.oauthStrategy)c.addIssue({code:"custom",message:"connectorProfile requires a Paperclip Cloud OAuth strategy",path:["connectorProfile"]});if(v.credentialSources?.vercelConnect&&(v.transport!=="mcp_remote"||v.auth==="none"))c.addIssue({code:"custom",message:"Vercel Connect requires an authenticated remote MCP method",path:["credentialSources","vercelConnect"]});const keys=new Set([...(v.tenantFields??[]),...(v.extensionFields??[])].map((entry)=>entry.key));for(const key of v.configRequirements?.atLeastOneOf??[])if(!keys.has(key))c.addIssue({code:"custom",mLine truncated
|
||||
export const appDefinitionSchema=z.object({schemaVersion:z.literal(1),slug:z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),name:z.string().min(1),description:z.string().min(1),categories:z.array(z.enum(["ai","analytics","commerce","communication","content","data","developer","productivity","other"])).min(1),featured:z.boolean().optional(),branding:z.object({logoUrl:appBrandAssetUrlSchema,darkLogoUrl:appBrandAssetUrlSchema.optional(),backgroundColor:z.string().optional(),accentColor:z.string().optional()}),urlPatterns:z.array(z.string()),docsUrl:z.string().url().optional(),setupPrerequisite:z.object({title:z.string().min(1),description:z.string().min(1),steps:z.array(z.string().min(1)).min(1).optional(),actionLabel:z.string().min(1),actionUrl:z.string().url()} ).optional(),redirectConstraints:z.enum(["https-or-loopback-http"]).optional(),methods:z.array(connectionMethodDefSchema).min(1),suggestable:z.boolean().optional(),availability:z.object({available:z.boolean(),reason:z.string().optional(),robotEmail:z.string().optional()}).optional(),ownershipAvailability:z.object({platform_shared:z.boolean().optional(),platform_provisioned:z.boolean().optional(),customer:z.boolean().optional(),dcr:z.boolean().optional()}).optional()});
|
||||
export const appDefinitionSchema=z.object({agentInstructions:connectionInstructionTemplateSchema.optional(),aiConnectionRouter:z.object({pluginKey:z.string().min(1)}).optional(),schemaVersion:z.literal(1),slug:z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),name:z.string().min(1),description:z.string().min(1),categories:z.array(z.enum(["ai","analytics","commerce","communication","content","data","developer","productivity","other"])).min(1),tags:z.array(z.string().min(1)).optional(),featured:z.boolean().optional(),branding:z.object({logoUrl:appBrandAssetUrlSchema,darkLogoUrl:appBrandAssetUrlSchema.optional(),backgroundColor:z.string().optional(),accentColor:z.string().optional()}),urlPatterns:z.array(z.string()),docsUrl:z.string().url().optional(),setupPrerequisite:z.object({title:z.string().min(1),description:z.string().min(1),steps:z.array(z.string().min(1)).min(1).optional(),actionLabel:z.string().min(1),actionUrl:z.string().url()} ).optional(),redirectConstraints:z.enum(["https-or-loopback-http"]).optional(),methods:z.array(connectionMethodDefSchema),suggestable:z.boolean().optional(),availability:z.object({available:z.boolean(),reason:z.string().optional(),robotEmail:z.string().optional()}).optional(),ownershipAvailability:z.object({platform_shared:z.boolean().optional(),platform_provisioned:z.boolean().optional(),customer:z.boolean().optional(),dcr:z.boolean().optional()}).optional()}).superRefine((value, ctx) => {
|
||||
if (value.aiConnectionRouter) {
|
||||
if (value.methods.length !== 0) ctx.addIssue({ code: "custom", message: "Pooled connectors use existing connections, not authentication methods", path: ["methods"] });
|
||||
if (!value.categories.includes("ai")) ctx.addIssue({ code: "custom", message: "Pooled connectors must use the AI category", path: ["categories"] });
|
||||
} else if (value.methods.length === 0) {
|
||||
ctx.addIssue({ code: "custom", message: "Connectors require at least one connection method", path: ["methods"] });
|
||||
}
|
||||
});
|
||||
export const appDefinitionsSchema=z.array(appDefinitionSchema).superRefine((v,c)=>{const s=new Set<string>();v.forEach((a,i)=>{if(s.has(a.slug))c.addIssue({code:"custom",message:"Duplicate slug",path:[i,"slug"]});s.add(a.slug)})});
|
||||
@@ -13,6 +13,8 @@ export const companyArtifactGroupBySchema = z.enum(["none", "task", "parent_task
|
||||
export const companyArtifactsQuerySchema = z.object({
|
||||
kind: z.enum(["image", "video", "text", "document", "file", "all"]).optional().default("all"),
|
||||
projectId: z.string().guid().optional(),
|
||||
/** Only artifacts attributed to this agent (the `createdByAgent` on each result). */
|
||||
agentId: z.string().guid().optional(),
|
||||
q: z.string().trim().max(COMPANY_ARTIFACTS_MAX_QUERY_LENGTH).optional(),
|
||||
groupBy: companyArtifactGroupBySchema.optional().default("none"),
|
||||
groupIssueId: z.string().guid().optional(),
|
||||
|
||||
@@ -395,6 +395,8 @@ export const companySkillFileUpdateSchema = z.object({
|
||||
content: z.string(),
|
||||
encoding: z.enum(["utf8", "base64"]).optional(),
|
||||
executable: z.boolean().optional(),
|
||||
expectedVersionId: z.string().guid().nullable().optional(),
|
||||
idempotencyKey: z.string().min(1).max(240).optional(),
|
||||
});
|
||||
|
||||
export const companySkillFileDeleteSchema = z.object({
|
||||
|
||||
@@ -10,6 +10,12 @@ import {
|
||||
const agentId = "11111111-1111-4111-8111-111111111111";
|
||||
|
||||
describe("connection intent contracts", () => {
|
||||
it("accepts bounded exact access requests without caller-supplied agent identity", () => {
|
||||
expect(connectionRequestInputSchema.parse({ service: "composio", connectionId: agentId, toolNames: ["COMPOSIO_SEARCH_TOOLS"] })).toMatchObject({ connectionId: agentId });
|
||||
expect(connectionRequestInputSchema.safeParse({ service: "composio", toolNames: ["read", "read"] }).success).toBe(false);
|
||||
expect(connectionRequestInputSchema.safeParse({ service: "composio", toolNames: Array.from({ length: 21 }, (_, i) => `tool-${i}`) }).success).toBe(false);
|
||||
expect(connectionRequestInputSchema.safeParse({ service: "composio", agentId }).success).toBe(false);
|
||||
});
|
||||
it("accepts the versioned server-authored payload and safe phases", () => {
|
||||
expect(connectionIntentPayloadSchema.parse({
|
||||
version: 1,
|
||||
@@ -45,6 +51,18 @@ describe("connection intent contracts", () => {
|
||||
expect(connectionIntentResultSchema.parse({ version: 1, outcome: "declined" }).outcome).toBe("declined");
|
||||
});
|
||||
|
||||
it("bounds the server-authored grant and rejects duplicate or unreviewable tools", () => {
|
||||
const tool = { catalogEntryId: agentId, toolName: "search", versionHash: "v1", permission: "allowed" };
|
||||
const base = { version: 1, serviceSlug: "composio", serviceName: "Composio", requestingAgentId: agentId,
|
||||
requestingAgentName: "CEO", phase: "requested" };
|
||||
const payload = (tools: unknown[]) => ({ ...base, accessRequest: { connectionId: agentId, connectionName: "Account", tools } });
|
||||
expect(connectionIntentPayloadSchema.safeParse(payload([tool])).success).toBe(true);
|
||||
expect(connectionIntentPayloadSchema.safeParse(payload([])).success).toBe(false);
|
||||
expect(connectionIntentPayloadSchema.safeParse(payload([tool, tool])).success).toBe(false);
|
||||
expect(connectionIntentPayloadSchema.safeParse(payload([{ ...tool, versionHash: "" }])).success).toBe(false);
|
||||
expect(connectionIntentPayloadSchema.safeParse(payload([{ ...tool, permission: "allow_all" }])).success).toBe(false);
|
||||
});
|
||||
|
||||
it("keeps generic interaction creation closed to the server-owned kind", () => {
|
||||
expect(createIssueThreadInteractionSchema.safeParse({
|
||||
kind: "connection_intent",
|
||||
|
||||
@@ -7,6 +7,8 @@ export const connectionsSearchInputSchema = z.object({
|
||||
|
||||
export const connectionRequestInputSchema = z.object({
|
||||
service: z.string().trim().min(1).max(120),
|
||||
connectionId: z.string().guid().optional().describe("Reuse this saved connection; never create a replacement gateway"),
|
||||
toolNames: z.array(z.string().trim().min(1).max(160)).min(1).max(20).refine(names => new Set(names).size === names.length, "Requested tools must be unique").optional().describe("Exact indexed tool names needed by this agent; writes require approval"),
|
||||
selectionInteractionId: z.string().guid().optional(),
|
||||
targetService: z.string().regex(/^[a-z0-9][a-z0-9-]{0,79}$/).optional().describe("App slug returned by search only when the user explicitly named this external provider"),
|
||||
}).strict();
|
||||
|
||||
@@ -387,6 +387,7 @@ export {
|
||||
} from "./agent.js";
|
||||
|
||||
export {
|
||||
projectDiscoverySchema,
|
||||
createProjectSchema,
|
||||
updateProjectSchema,
|
||||
createProjectWorkspaceSchema,
|
||||
@@ -990,3 +991,4 @@ export * from "./email.js";
|
||||
export { restoreAgentInstructionSchema } from "./agent.js";
|
||||
|
||||
export * from "./skill-source.js";
|
||||
export * from "./agent-commentary.js";
|
||||
@@ -41,6 +41,7 @@ export const patchInstanceGeneralSettingsSchema = z
|
||||
export const instanceExperimentalSettingsSchema = z.object({
|
||||
enableEnvironments: z.boolean().default(false),
|
||||
enableNativeRunner: z.boolean().default(true),
|
||||
enableAiConnectionRouters: z.boolean().default(false),
|
||||
enableManagedSandboxOnly: z.boolean().default(false),
|
||||
enableIsolatedWorkspaces: z.boolean().default(false),
|
||||
enableIsolatedWorkspacesByDefault: z.boolean().default(false),
|
||||
@@ -58,6 +59,7 @@ export const instanceExperimentalSettingsSchema = z.object({
|
||||
enablePipelines: z.boolean().default(false),
|
||||
enableCases: z.boolean().default(false),
|
||||
enableAgentChat: z.boolean().default(false),
|
||||
enableCombinedInboxTasks: z.boolean().default(false),
|
||||
enableConferenceRoomChat: z.boolean().default(false),
|
||||
enableClassicTaskInterface: z.boolean().default(false),
|
||||
enableIssuePlanDecompositions: z.boolean().default(false),
|
||||
|
||||
@@ -1111,6 +1111,16 @@ const connectionIntentBrandAssetSchema = z
|
||||
|
||||
export const connectionIntentPayloadSchema = z
|
||||
.object({
|
||||
accessRequest: z.object({
|
||||
connectionId: z.string().guid(),
|
||||
connectionName: z.string().trim().min(1).max(160),
|
||||
tools: z.array(z.object({
|
||||
catalogEntryId: z.string().guid(),
|
||||
toolName: z.string().trim().min(1).max(160),
|
||||
versionHash: z.string().min(1).max(256),
|
||||
permission: z.enum(["allowed", "ask_first"]),
|
||||
}).strict()).min(1).max(20).refine(tools => new Set(tools.map(tool => tool.catalogEntryId)).size === tools.length, "Requested tools must be unique"),
|
||||
}).strict().optional(),
|
||||
upstreamService: z.object({ slug: z.string().min(1).max(120), name: z.string().min(1).max(160), selectionInteractionId: z.string().guid().optional() }).strict().optional(),
|
||||
purpose: z.enum(["ai", "channel"]).optional(),
|
||||
version: z.literal(1),
|
||||
|
||||
@@ -33,6 +33,11 @@ describe("plugin capability constants", () => {
|
||||
});
|
||||
|
||||
describe("plugin manifest validators", () => {
|
||||
it("requires routing authority for native pooled connector declarations without a custom UI bundle", () => {
|
||||
const manifest = { id: "example.pool", apiVersion: 1, version: "0.1.0", displayName: "Pool", description: "Pool", author: "Tests", categories: ["connector"], entrypoints: { worker: "worker.js" }, aiConnectionRouter: { name: "AI connection pool", description: "Use saved connections" } };
|
||||
expect(pluginManifestV1Schema.safeParse({ ...manifest, capabilities: ["ui.page.register"] }).success).toBe(false);
|
||||
expect(pluginManifestV1Schema.parse({ ...manifest, capabilities: ["ai.connections.route"] }).aiConnectionRouter).toEqual(manifest.aiConnectionRouter);
|
||||
});
|
||||
it("accepts existing-style plugins that do not request access or authorization capabilities", () => {
|
||||
const parsed = pluginManifestV1Schema.parse({
|
||||
id: "paperclip.compat-dashboard",
|
||||
|
||||
@@ -782,6 +782,7 @@ export const pluginManifestV1Schema = z.object({
|
||||
"minimumPaperclipVersion must follow semver (e.g. 1.0.0)",
|
||||
).optional(),
|
||||
capabilities: z.array(z.enum(PLUGIN_CAPABILITIES)).min(1),
|
||||
aiConnectionRouter: z.object({ name: z.string().trim().min(1).max(100), description: z.string().trim().min(1).max(500) }).strict().optional(),
|
||||
entrypoints: z.object({
|
||||
worker: z.string().min(1),
|
||||
ui: z.string().min(1).optional(),
|
||||
@@ -835,6 +836,10 @@ export const pluginManifestV1Schema = z.object({
|
||||
// declare every capability it needs up-front; silently having more features
|
||||
// than capabilities would cause runtime rejections.
|
||||
|
||||
if (manifest.aiConnectionRouter && !manifest.capabilities.includes("ai.connections.route")) {
|
||||
ctx.addIssue({ code: z.ZodIssueCode.custom, message: "ai.connections.route is required for aiConnectionRouter", path: ["capabilities"] });
|
||||
}
|
||||
|
||||
// tools require agent.tools.register (PLUGIN_SPEC.md §11)
|
||||
if (manifest.tools && manifest.tools.length > 0) {
|
||||
if (!manifest.capabilities.includes("agent.tools.register")) {
|
||||
|
||||
@@ -4,6 +4,11 @@ import { envConfigSchema } from "./secret.js";
|
||||
import { trustAuthorizationPolicySchema } from "./trust-policy.js";
|
||||
import { objectWithoutDefaults } from "./partial.js";
|
||||
|
||||
export const projectDiscoverySchema = z.object({
|
||||
limit: z.number().int().min(1).max(50).default(50),
|
||||
cursor: z.string().uuid().transform(value => value.toLowerCase()).optional(),
|
||||
}).strict();
|
||||
|
||||
const executionWorkspaceStrategySchema = z
|
||||
.object({
|
||||
type: z.enum(["project_primary", "git_worktree", "adapter_managed", "cloud_sandbox"]).optional(),
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { connectionAgentInstructionsSchema } from "../connection-instructions.js";
|
||||
import { isRemoteMcpConnectorMethod } from "../remote-mcp-connectors.js";
|
||||
import { z } from "zod";
|
||||
import {
|
||||
@@ -178,6 +179,7 @@ export const updateToolApplicationSchema = createToolApplicationSchema.partial()
|
||||
export type UpdateToolApplication = z.infer<typeof updateToolApplicationSchema>;
|
||||
|
||||
export const createToolConnectionSchema = z.object({
|
||||
agentInstructions: connectionAgentInstructionsSchema.nullable().optional(),
|
||||
applicationId: z.string().guid().optional(),
|
||||
applicationName: z.string().trim().min(1).max(160).optional(),
|
||||
name: z.string().trim().min(1).max(160),
|
||||
@@ -218,6 +220,9 @@ export const connectionGrantSchema = z.object({
|
||||
strategy: z.string().trim().min(1).max(100).optional(),
|
||||
accessTokenExpiresAt: z.string().datetime().nullable().optional(),
|
||||
scopes: z.array(z.string().trim().min(1).max(500)).max(20).optional(),
|
||||
scopeSource: z.enum(["provider", "requested_fallback"]).optional(),
|
||||
unrequestedScopes: z.array(z.string().trim().min(1).max(500)).max(20).optional(),
|
||||
requestedScopes: z.array(z.string().trim().min(1).max(500)).max(20).optional(),
|
||||
tokenType: z.string().trim().min(1).max(100).optional(),
|
||||
refreshTokenExpiresAt: z.string().datetime().optional(),
|
||||
refreshedAt: z.string().datetime().optional(),
|
||||
@@ -407,6 +412,7 @@ function rejectUnsafeHeaderCredentials(
|
||||
}
|
||||
|
||||
export const connectToolAppSchema = z.object({
|
||||
agentInstructions: connectionAgentInstructionsSchema.nullable().optional(),
|
||||
galleryKey: z.string().trim().min(1).max(120).optional(),
|
||||
connectionMethodKey: z.string().trim().min(1).max(120).optional(),
|
||||
link: z.string().trim().url().max(2000).optional(),
|
||||
@@ -488,6 +494,7 @@ export const reconnectToolAppSchema = z.object({
|
||||
export type ReconnectToolApp = z.infer<typeof reconnectToolAppSchema>;
|
||||
|
||||
export const finishToolAppSchema = z.object({
|
||||
agentInstructions: connectionAgentInstructionsSchema.nullable().optional(),
|
||||
/** Task setup adds access while preserving existing assignments and action policies. */
|
||||
preserveExistingAccess: z.boolean().optional(),
|
||||
enabledCatalogEntryIds: z.array(z.string().guid()).max(500).default([]),
|
||||
|
||||
Reference in new issue
Block a user