Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion IMPLEMENTATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ names both halves, not a bare error.

## Canva MCP connect (shipped)

Canva is the `canva` MCP preset (`packages/connections/src/mcp-presets.ts`):
Canva is the `canva` MCP preset (`templates/connectors.ts`):
`https://mcp.canva.com/mcp`, `connectionMode: "oauth"`, with the 16
advertised PRM scopes space-joined onto RFC 7591 DCR `clientMetadata.scope`
(`createMcpOAuthProvider` in `packages/connections/src/mcp-oauth.ts`).
Expand Down
2 changes: 1 addition & 1 deletion apps/hub/src/connection-live-reconcile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// and not persist-only. `createHub` is not booted here; this is the
// hook body `apps/hub/src/index.ts` fires from `settleServiceConnection`.
import { describe, expect, test } from "bun:test";
import { CONNECTOR_REGISTRY } from "@corbits/connections/registry";
import { CONNECTOR_REGISTRY } from "@workbench/templates/connectors";
import { reconcilePinnedToolPackagesAfterConnect } from "./connection-live-reconcile";

describe("reconcilePinnedToolPackagesAfterConnect", () => {
Expand Down
2 changes: 1 addition & 1 deletion apps/hub/src/connection-live-reconcile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// until this pass relaunches it. Persist-only (stamp the pin onto the
// launch row and leave the run) is the bug: the sidecar keeps the old
// snapshot.
import { CONNECTOR_REGISTRY } from "@corbits/connections/registry";
import { CONNECTOR_REGISTRY } from "@workbench/templates/connectors";

export type PinnedToolPackageReconcile = {
reconcilePinnedToolPackages(
Expand Down
12 changes: 11 additions & 1 deletion apps/hub/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,10 @@ import {
listMcpServerConnections,
} from "@corbits/connections";
import type { ServiceConnectedHook } from "@corbits/connections";
import { CONNECTOR_REGISTRY } from "@corbits/connections/registry";
import {
CONNECTOR_REGISTRY,
MCP_PRESETS,
} from "@workbench/templates/connectors";
import {
createProviderHealthPort,
createProviderHealthStore,
Expand Down Expand Up @@ -1415,6 +1418,7 @@ export async function createHub(config: HubConfig) {
approvals: createApprovalStore(db),
recordActivity: chatPlatform.recordActivity,
claims: writeClaims,
connectorRegistry: CONNECTOR_REGISTRY,
};
if (memoryHandle !== undefined) {
chatOrchestratorDeps.memory = memoryHandle.memory;
Expand Down Expand Up @@ -2275,6 +2279,7 @@ export async function createHub(config: HubConfig) {
`${TENANT_PREFIX}/connections`,
createConnectionRoutes({
hubUrl: config.baseUrl,
registry: CONNECTOR_REGISTRY,
requireGrant: createRequireGrant({
grantStore: chatGrantStore,
conditionRegistry: chatConditionRegistry,
Expand Down Expand Up @@ -2349,6 +2354,7 @@ export async function createHub(config: HubConfig) {
hubUrl: config.baseUrl,
log: (line) => log.info`${line}`,
credentialCipher,
registry: CONNECTOR_REGISTRY,
// Same env bag `GET .../connections/oauth-configured` reads above.
oauthEnv: {
huggingfaceClientId: config.huggingfaceOAuthClientId,
Expand All @@ -2360,6 +2366,7 @@ export async function createHub(config: HubConfig) {
connectCredential: createTenantConnectCredential({
hubUrl: config.baseUrl,
log: (line) => log.info`${line}`,
registry: CONNECTOR_REGISTRY,
providerHealth: providerHealthStore,
}),
onConnected: settleServiceConnection,
Expand Down Expand Up @@ -2646,6 +2653,7 @@ export async function createHub(config: HubConfig) {
conditionRegistry: chatConditionRegistry,
}),
log: (line) => log.info`${line}`,
presets: MCP_PRESETS,
onConnected: settleServiceConnection,
}),
);
Expand All @@ -2663,6 +2671,7 @@ export async function createHub(config: HubConfig) {
}),
log: (line) => log.info`${line}`,
credentialCipher,
presets: MCP_PRESETS,
onConnected: settleServiceConnection,
// `/w/` for the same reason as the connections/oauth mount above.
returnPathAllowlist: [
Expand All @@ -2680,6 +2689,7 @@ export async function createHub(config: HubConfig) {
"/api/workflow-connections",
createWorkflowConnectionRoutes({
authenticator: createWorkflowRunAuthenticator({ db }),
registry: CONNECTOR_REGISTRY,
// Same `isConnectorConnected` the pinned-package factory is wired
// with above (CL-6492).
isConnectorConnected,
Expand Down
2 changes: 1 addition & 1 deletion apps/hub/src/pinned-package-credential-bindings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import type { CredentialBinding } from "@intx/types";
import type { ToolPackagePin } from "@intx/types/tool-packages";
import type { PinnedPackageCredentialBindingsFor } from "@corbits/folded-runs";
import { CONNECTOR_REGISTRY } from "@corbits/connections/registry";
import { CONNECTOR_REGISTRY } from "@workbench/templates/connectors";

export type IsConnectorConnected = (
tenantId: string,
Expand Down
11 changes: 7 additions & 4 deletions apps/web/src/connect-service-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ import {
listMcpPresets,
McpServersApiError,
} from "@corbits/plugins-ui";
import { CONNECTOR_REGISTRY } from "@corbits/connections/registry";
import { mcpPresetBySlug } from "@corbits/connections/mcp-presets";
import {
CONNECTOR_REGISTRY,
MCP_PRESETS,
} from "@workbench/templates/connectors";

function bareConnectorId(connectorId: string): string {
return connectorId.startsWith("mcp:")
Expand All @@ -48,7 +51,7 @@ export function createChatConnectServiceActions(

async function readState(connectorId: string): Promise<ConnectServiceQuery> {
const slug = bareConnectorId(connectorId);
const preset = mcpPresetBySlug(slug);
const preset = mcpPresetBySlug(MCP_PRESETS, slug);
if (preset !== undefined) {
const presets = await listMcpPresets(tenantId);
const listed = presets.find((entry) => entry.slug === preset.slug);
Expand Down Expand Up @@ -115,7 +118,7 @@ export function createChatConnectServiceActions(
},
async connect(connectorId) {
const slug = bareConnectorId(connectorId);
const preset = mcpPresetBySlug(slug);
const preset = mcpPresetBySlug(MCP_PRESETS, slug);
if (preset !== undefined && preset.connectionMode === "keyless") {
try {
await connectMcpPreset(tenantId, preset.slug, undefined);
Expand All @@ -134,7 +137,7 @@ export function createChatConnectServiceActions(
},
async submitKey(connectorId, key) {
const slug = bareConnectorId(connectorId);
const preset = mcpPresetBySlug(slug);
const preset = mcpPresetBySlug(MCP_PRESETS, slug);
if (preset !== undefined && preset.connectionMode === "token") {
try {
await connectMcpPreset(tenantId, preset.slug, key);
Expand Down
8 changes: 5 additions & 3 deletions apps/web/src/pages/plugins-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ import {
} from "@corbits/plugins-ui";
import type { ResolvedPlugin } from "@corbits/connections/plugins";
import { listPluginsForTenant } from "@corbits/connections/plugins";
import { CONNECTOR_REGISTRY } from "@corbits/connections/registry";
import { MCP_PRESETS } from "@corbits/connections/mcp-presets";
import {
CONNECTOR_REGISTRY,
MCP_PRESETS,
} from "@workbench/templates/connectors";
import { Plus, SquaresFour, Warning } from "@corbits/icons";
import { useCallback, useEffect, useRef, useState } from "react";

Expand Down Expand Up @@ -130,7 +132,7 @@ export function PluginsRoute({
const isTenantChange = pluginsLoadedTenantRef.current !== selectedTenantId;
pluginsLoadedTenantRef.current = selectedTenantId;
if (isTenantChange) setPluginsState({ status: "loading" });
listPluginsForTenant(selectedTenantId)
listPluginsForTenant(selectedTenantId, CONNECTOR_REGISTRY)
.then((plugins) => {
if (!cancelled) setPluginsState({ status: "ready", plugins });
})
Expand Down
5 changes: 4 additions & 1 deletion apps/web/src/shell/provider-health-banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import { Button } from "@corbits/react-ui";
import { connectorDescriptors } from "@corbits/connections/registry";
import type { ClassifiedInferenceFailureCategory } from "@corbits/connections/provider-health";
import { CONNECTOR_REGISTRY } from "@workbench/templates/connectors";
import { Warning, X } from "@corbits/icons";
import { useEffect, useState } from "react";

Expand Down Expand Up @@ -57,7 +58,9 @@ const POLL_ERROR_COPY = "Couldn't check provider health. Try again shortly.";
// expected in practice, but a caller should still see something rather
// than nothing).
function providerDisplayName(provider: string): string {
const descriptor = connectorDescriptors().find((d) => d.id === provider);
const descriptor = connectorDescriptors(CONNECTOR_REGISTRY).find(
(d) => d.id === provider,
);
return descriptor?.displayName ?? provider;
}

Expand Down
18 changes: 13 additions & 5 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion docs/connect-cards.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ own template card does not ride that path.
## Gmail

`gmail` is a pure hosted-OAuth connector
(`packages/connections/src/gmail-connect.ts` + the registry entry):
(`packages/connections/src/gmail-connect.ts` + its descriptor in
`templates/connectors.ts`):
Google's code flow with PKCE, the `gmail.modify` scope, and
`access_type=offline` so the exchange captures a refresh token — stored
as the credential row's `refreshSecret` next to the one-hour access
Expand Down
11 changes: 6 additions & 5 deletions docs/credential-wiring.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,12 @@ All five plugins the sidecar registers mirror the same origin-pinning and
`redirect: "manual"` protections; only the injected header (or its
absence, for keyless MCP) differs.

`packages/connections` (the Connections-surface registry) is the other
place this plugin id needs to be correct: whatever seeds or registers a
Linear provider row there must set `plugin: "http-raw-authorization"`,
and a Manus row must set `plugin: "http-x-manus-api-key"`, matching this
doc, not the `"http"` default other connectors use.
`templates/connectors.ts` (the concrete connector set a build passes into
`@corbits/connections`) is the other place this plugin id needs to be
correct: a Linear connector descriptor there must set
`plugin: "http-raw-authorization"`, and a Manus one must set
`plugin: "http-x-manus-api-key"`, matching this doc, not the `"http"`
default other connectors use.

## Trust boundary

Expand Down
11 changes: 10 additions & 1 deletion packages/chat/src/chat-orchestrator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,16 @@ describe("createReplyPartsAccumulator", () => {
});

test("a missing-credential detail renders the connect-service block naming the connector", () => {
const acc = createReplyPartsAccumulator();
const acc = createReplyPartsAccumulator({
github: {
id: "github",
displayName: "GitHub",
authKind: "api-key",
credentialPlugin: "http",
docsUrl: "https://github.com/settings/tokens",
feedsTools: ["@corbits/github-tools"],
},
});
acc.onInferenceDone(AGENT_ADDRESS, [toolCallBlock("call_1")]);
acc.onToolDone(AGENT_ADDRESS, {
callId: "call_1",
Expand Down
16 changes: 12 additions & 4 deletions packages/chat/src/chat-orchestrator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ import {
type ProviderHealthPort,
} from "@corbits/connections/provider-health";
import {
CONNECTOR_REGISTRY,
parseMissingCredentialDetail,
type ConnectorRegistry,
} from "@corbits/connections/registry";
import { artifactPartsForFinalizedTurn } from "./artifact-delivery";
import type { ApproveBlockData } from "./blocks";
Expand All @@ -69,6 +69,12 @@ const log = getLogger(["chat", "orchestrator"]);

export type ChatOrchestratorDeps = {
db: DB["db"];
/** The connector set this build ships (`@corbits/connections` carries
* none of its own, CL-7384) — used only to resolve a missing
* credential's `displayName` for the in-turn connect card. Absent
* falls back to the raw connector id, same as
* `MissingCredentialError`'s own default. */
connectorRegistry?: ConnectorRegistry;
store: Pick<ChatStore, "listWorkbenchSettings">;
/**
* The room timeline every poster below writes to (CL-6327): an agent's
Expand Down Expand Up @@ -227,7 +233,9 @@ function turnKeyFor(agentAddress: string, sessionId: string): string {
* turn (see `turnKeyFor` below): reset the moment a turn's
* `connector.reply` or turn-drop notice consumes it.
*/
export function createReplyPartsAccumulator(): {
export function createReplyPartsAccumulator(
connectorRegistry?: ConnectorRegistry,
): {
onInferenceDone(turnKey: string, blocks: ReplyContentBlock[]): void;
onToolDone(
turnKey: string,
Expand Down Expand Up @@ -290,7 +298,7 @@ export function createReplyPartsAccumulator(): {
: undefined;
if (missingCredential !== undefined) {
const displayName =
CONNECTOR_REGISTRY[missingCredential.connectorId]?.displayName ??
connectorRegistry?.[missingCredential.connectorId]?.displayName ??
missingCredential.connectorId;
parts.push({
kind: "block",
Expand Down Expand Up @@ -1130,7 +1138,7 @@ export function createChatOrchestrator(
>({ ttlMs: AGENT_TURN_STALE_MS, now });

// See `createReplyPartsAccumulator`'s own doc comment above.
const replyParts = createReplyPartsAccumulator();
const replyParts = createReplyPartsAccumulator(deps.connectorRegistry);

const unsubscribe = deps.events.on(
"agent.event",
Expand Down
Loading
Loading