mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-21 08:22:20 +02:00
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - Connections is the subsystem that defines which external apps and MCP-style integrations operators can browse, configure, and run > - The v3 schema core in #9958 added stable connection identities, auth metadata, and grant-aware contracts, but the app catalog still used the older gallery shape > - The product needs a richer, typed AppDefinition catalog so browsing and setup can render provider-specific auth and configuration requirements consistently > - This pull request moves the Wave 1 app catalog onto generated AppDefinition data and carries that shape through shared types, server lookup paths, and app connection UI > - The benefit is that follow-up runtime and wizard work can build against one catalog contract instead of local-only mock/gallery data ## Linked Issues or Issue Description Refs #9958. No public GitHub issue exists for this branch. This is the catalog layer for the Connections v3 stack after the schema-core foundation in #9958. ## What Changed - Adds generated AppDefinition data for the Wave 1 catalog and ingestion reporting. - Replaces the legacy tool app gallery exports with AppDefinition-centered shared contracts, validators, and tests. - Updates server tool-access lookup behavior to use the AppDefinition catalog. - Updates app connection UI surfaces and tests to consume AppDefinition-backed catalog data. - Documents the catalog ingestion workflow in the connector playbook. ## Verification - `pnpm run preflight:workspace-links` - `pnpm exec vitest run packages/shared/src/app-definitions.test.ts packages/shared/src/app-definitions-url.test.ts ui/src/pages/apps/AppsConnect.test.tsx server/src/__tests__/tool-access-service.test.ts` ## Risks - Medium: this changes the catalog contract used by shared, server, and UI app connection surfaces. - Catalog data quality matters because generated definitions now drive browse/setup display. - Follow-up runtime and wizard PRs must rebase on this branch or on master after this lands. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used OpenAI GPT-5 Codex coding agent with repository tool use. ## Checklist - [x] I have included a thinking path that traces from project context to this change - [x] I have specified the model used (with version and capability details) - [x] I have checked ROADMAP.md and confirmed this PR does not duplicate planned core work - [x] I have searched GitHub for duplicate or related PRs and linked them above - [x] I have either (a) linked existing issues with `Fixes: #` / `Closes #` / `Refs #` OR (b) described the issue in-PR following the relevant issue template - [x] I have not referenced internal/instance-local Paperclip issues or links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip` URLs) - [x] My branch name describes the change (e.g. `docs/...`, `fix/...`) and contains no internal Paperclip ticket id or instance-derived details - [x] I have run tests locally and they pass - [x] I have added or updated tests where applicable - [x] I have updated relevant documentation to reflect my changes - [x] I have considered and documented any risks above - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge --------- Co-authored-by: Paperclip <noreply@paperclip.ing>
68 lines
2.1 KiB
TypeScript
68 lines
2.1 KiB
TypeScript
import { APP_DEFINITIONS } from "./app-definitions.generated.js";
|
|
import type { AppDefinition, ConnectionMethodDef, FieldDef } from "./types/app-definition.js";
|
|
import type { ToolConnectionOwnership } from "./types/tool-access.js";
|
|
|
|
const CONNECTABLE_APP_SLUGS = new Set([
|
|
"zapier",
|
|
"github",
|
|
"slack",
|
|
"notion",
|
|
"linear",
|
|
"google-sheets",
|
|
"context7",
|
|
]);
|
|
|
|
export const CONNECTABLE_APP_DEFINITIONS = APP_DEFINITIONS.filter((app) =>
|
|
CONNECTABLE_APP_SLUGS.has(app.slug)
|
|
);
|
|
|
|
export const DEFAULT_OWNERSHIP_AVAILABILITY: Record<ToolConnectionOwnership, boolean> = {
|
|
platform_shared: false,
|
|
platform_provisioned: false,
|
|
customer: true,
|
|
dcr: true,
|
|
};
|
|
|
|
export function getConnectableAppDefinition(slug: string): AppDefinition | null {
|
|
return CONNECTABLE_APP_DEFINITIONS.find((app) => app.slug === slug) ?? null;
|
|
}
|
|
|
|
function wildcardPatternToRegExp(pattern: string): RegExp {
|
|
const escaped = pattern.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
|
|
return new RegExp(`^${escaped}$`, "i");
|
|
}
|
|
|
|
export function getAppDefinitionForUrl(
|
|
link: string,
|
|
definitions: readonly AppDefinition[] = CONNECTABLE_APP_DEFINITIONS,
|
|
): AppDefinition | null {
|
|
let normalized: string;
|
|
try {
|
|
normalized = new URL(link.trim()).toString();
|
|
} catch {
|
|
return null;
|
|
}
|
|
return definitions.find((app) =>
|
|
app.urlPatterns.some((pattern) => wildcardPatternToRegExp(pattern).test(normalized))
|
|
) ?? null;
|
|
}
|
|
|
|
export function getAvailableConnectionMethod(app: AppDefinition): ConnectionMethodDef | null {
|
|
const availability = app.ownershipAvailability ?? DEFAULT_OWNERSHIP_AVAILABILITY;
|
|
return app.methods.find((method) =>
|
|
method.ownershipModes.some((ownership) => availability[ownership] !== false)
|
|
) ?? null;
|
|
}
|
|
|
|
export function credentialConfigPath(field: FieldDef): string {
|
|
return `credentials.${field.key}`;
|
|
}
|
|
|
|
export function recommendedDefaultsForApp(app: AppDefinition): Record<string, unknown> {
|
|
const method = getAvailableConnectionMethod(app);
|
|
return {
|
|
access: "all_agents",
|
|
askFirstRiskLevels: method?.riskTier === "S1" ? [] : ["write", "destructive"],
|
|
};
|
|
}
|