Skip to content

Your team of AI agents, on your Mac, Windows or Linux. Agents that talk in channels, write code, review each other and use your tools, on the Claude Code, Codex, OpenCode or Pi you already have. Anything that touches the real world waits for your yes.

The connector store for the iPhone app, served by the Tucano (#200)

Eduardo Machado2ae22a02f4c2
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1cb7e7c..9b31ea4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@ What changed in each version of Tucano. The format follows [Keep a Changelog](ht
## [Unreleased]
> **Em português:**
+> - **A loja de conectores no iPhone.** Gmail, Agenda, Notion, Linear e os outros 44, com busca e login de um toque, como no computador.
> - **Avisos no iPhone com o app fechado.** Aprovações, perguntas e respostas prontas chegam como notificação mesmo com o app fechado, e tocar abre a conversa.
> - **Entrar na IA pelo navegador ou pelo iPhone, num Tucano em servidor.** O botão Entrar roda o login da própria IA no servidor e mostra a tela dele numa janela: a página pra abrir, o código pra digitar e um campo pra colar o código de volta. Sem SSH.
>
@@ -14,6 +15,7 @@ What changed in each version of Tucano. The format follows [Keep a Changelog](ht
- **Sign a harness in on a server from the browser or the phone, with no SSH.** On Tucano as a server, **Sign in** (Settings › Models and the accounts) used to show a command to run in the server's terminal. Now the server runs the harness's own login in a terminal of its own (through `script`, on Linux) and the browser shows it in a window: the screen as text, **Open the sign-in page**, the code to type there with a copy button, a field to paste a code back, and arrows, Enter and Esc for a menu. Each harness signs in the way that works with no browser on the server: Codex and Grok with a device code, Claude Code by pasting the code its page shows, Cursor by approving its page, OpenCode and Gemini in their own menus, Pi with `/login`. The window closes the login once the harness checks as signed in, and a login left open ends after 15 minutes. Tucano passes keys and shows the screen; the harness saves the login where it always does. The iPhone app shows the same window (in its next version). On a desktop, **Sign in** opens a terminal as before.
- **Notifications on the iPhone with the app closed.** Approvals, questions and finished replies used to reach the Tucano app only while it was open. Now a phone that allows notifications gives its Tucano (a server, or the computer at home) a handle, and the Tucano asks a relay at tucano.sh to deliver through Apple. The handle is the phone's Apple token sealed by the relay, which alone holds the app's push key: a Tucano can reach only the phones that connected to it, and a disconnected device stops getting them. The relay passes on the title and the line, as the desktop's notification shows them, and stores nothing. `TUCANO_PUSH_URL` points at another relay, or `off`. Tapping a notification opens its conversation, on the right Tucano (in the next version of the app).
+- **The connector store on the iPhone.** The phone app could only add a connector by its MCP address. Now it gets the same store as the computer (48 services, by category, found by name or by what they do) from the Tucano itself, so the list is always the one that Tucano can connect: a tap connects, and a service that signs in with its account opens its page right there; one that asks something first (a token, your own instance's address) or warns that the data goes through a third party shows a short form; Google's and Slack's connectors walk through making your own app, with a link per step. New core calls: `connectorCatalog`, `addCatalogConnector` (the core fills the entry in, as the desktop's form does) and `ownAppGuide`. The computer's own-app window now reads the same steps (in the iPhone app's next version).
### Fixed
diff --git a/src/core/index.ts b/src/core/index.ts
index b847cc6..d66cf83 100644
--- a/src/core/index.ts
+++ b/src/core/index.ts
@@ -33,6 +33,7 @@ import { accountDir, accountStatus, adoptLoginShellPath, detectEngines } from '.
import { detectEngine, EngineCheck, type EngineFindings } from './engine-check'
import { EngineSetup, SETUP_ENGINES, type SetupEngine, type SetupState } from './engine-setup'
import { codexEnv } from './engines/codex'
+import { CATALOG, CATEGORIES, catalogInput, catalogView, entryOf, ownAppGuide } from '../shared/connector-catalog'
import { LoginTerminal, type LoginKey } from './login-terminal'
import { Push, pushUrl } from './push'
import { fakeEngine } from './engines/fake'
@@ -1597,6 +1598,21 @@ const api: Handlers = {
bg(connectors.connect(id), 'reconnectConnector')
},
setConnectorToken: ({ id, token }) => connectors.setToken(id, token),
+ // The store for a screen without the catalog's file (the iPhone app): its entries as data, in the
+ // person's language; a connector added by its entry and the values asked, filled in here.
+ connectorCatalog: () => ({ categories: CATEGORIES(), entries: catalogView(), added: connectors.list().map((c) => entryOf(c)?.id).filter((id): id is string => !!id) }),
+ addCatalogConnector: async ({ id, values }, ctx) => {
+ const entry = CATALOG.find((c) => c.id === id)
+ if (!entry) throw new Error(L('Esse conector não está mais na loja.', 'That connector is no longer in the store.'))
+ const input = catalogInput(entry, Object.fromEntries(Object.entries(values ?? {}).filter((v): v is [string, string] => typeof v[1] === 'string')))
+ const added = await connectors.add(input, !serverMode)
+ record(ctx, 'connector.created', added, { name: input.name })
+ return added
+ },
+ ownAppGuide: async ({ provider }) => {
+ const app = await connectors.ownApp(provider)
+ return { guide: ownAppGuide(provider, app.redirectUrl), ...(app.clientId ? { clientId: app.clientId } : {}) }
+ },
ownApp: ({ provider }) => connectors.ownApp(provider),
setOwnApp: ({ provider, clientId, clientSecret }) => connectors.setOwnApp(provider, { clientId, clientSecret }),
authorizeConnector: async ({ id }) => {
diff --git a/src/core/policy-people.ts b/src/core/policy-people.ts
index e6186df..b1dd5cc 100644
--- a/src/core/policy-people.ts
+++ b/src/core/policy-people.ts
@@ -192,6 +192,9 @@ export const NEEDS: Record<Method, Need> = {
removeConnector: 'admin',
reconnectConnector: 'admin',
setConnectorToken: 'admin',
+ connectorCatalog: 'admin',
+ addCatalogConnector: 'admin',
+ ownAppGuide: 'admin',
ownApp: 'admin',
setOwnApp: 'admin',
authorizeConnector: 'admin',
diff --git a/src/renderer/src/components/ConnectorStore.tsx b/src/renderer/src/components/ConnectorStore.tsx
index b24eea6..c47cdee 100644
--- a/src/renderer/src/components/ConnectorStore.tsx
+++ b/src/renderer/src/components/ConnectorStore.tsx
@@ -4,7 +4,7 @@
// Google's and Slack's sign in with an app the person makes once, which the first Connect walks them through.
import { useEffect, useState, type ReactNode } from 'react'
import { L } from '../../../shared/lang'
-import { catalogInput, CATEGORIES, entryOf, GOOGLE_APIS, searchCatalog, slackAppLink, type AppProvider, type CatalogEntry } from '../../../shared/connector-catalog'
+import { catalogInput, CATEGORIES, entryOf, ownAppGuide, searchCatalog, type AppProvider, type CatalogEntry } from '../../../shared/connector-catalog'
import { LOGOS } from '../connector-logos'
import { addConnector, authorizeConnector, openExternal, ownApp, setOwnApp, useStore, type Connector } from '../store'
import { Modal } from './Modal'
@@ -282,8 +282,6 @@ function ConnectorSetup({ entry, onClose, onAdded }: { entry: CatalogEntry; onCl
)
}
-const cloud = (path: string): string => `https://console.cloud.google.com/${path}`
-
// The person's own app, step by step: Google and Slack sign in only apps registered with them, and
// Tucano's own isn't (Google's verification, Slack's directory). Made once, it serves all of that
// provider's connectors. Also opened from a connector's page, to change it.
@@ -310,84 +308,31 @@ export function OwnAppSetup({ provider, connecting = false, onClose, onSaved }:
.finally(() => setBusy(false))
}
const google = provider === 'google'
+ const guide = ownAppGuide(provider, current?.redirectUrl ?? '')
return (
- <Modal title={google ? L('Seu app do Google', 'Your Google app') : L('Seu app do Slack', 'Your Slack app')} onClose={onClose} className="google-setup">
- <p className="muted small modal__lead">
- {google
- ? L(
- 'O Google só deixa entrar apps cadastrados nele. Você cria o seu uma vez, em uns 10 minutos, e o Gmail, o Drive, o Calendar, o Docs e o Sheets entram com ele. Fica tudo na sua conta: os dados vão do Google direto pro seu computador.',
- 'Google only lets in apps registered with it. You make yours once, in about 10 minutes, and Gmail, Drive, Calendar, Docs and Sheets sign in with it. It all stays in your account: the data goes from Google straight to your computer.'
- )
- : L(
- 'O Slack só deixa usar o servidor MCP dele apps do diretório ou apps internos de um workspace. Você cria o seu, interno, em uns 2 minutos: o link já traz tudo preenchido. Os dados vão do Slack direto pro seu computador.',
- "Slack lets only directory apps or a workspace's internal apps use its MCP server. You make yours, internal, in about 2 minutes: the link brings it all filled in. The data goes from Slack straight to your computer."
- )}
- </p>
- {google ? (
- <ol className="google-setup__steps">
- <li>
- {link(cloud('projectcreate'), L('Crie um projeto no Google Cloud', 'Create a project in Google Cloud'))}
- {L(', com o nome que quiser (Tucano, por exemplo).', ', named as you like (Tucano, say).')}
- </li>
- <li>
- {link(cloud(`flows/enableapi?apiid=${GOOGLE_APIS.join(',')}`), L('Ative as APIs', 'Turn on the APIs'))}
- {L(': com o projeto escolhido no topo, clique em Próxima e em Ativar. São as do Gmail, Drive, Calendar, Docs e Sheets e a MCP de cada um.', ': with the project chosen at the top, click Next and Enable. They are Gmail, Drive, Calendar, Docs and Sheets, and the MCP one of each.')}
- </li>
- <li>
- {link('https://developers.google.com/workspace/preview', L('Inscreva o projeto no Developer Preview', 'Enroll the project in the Developer Preview'))}
- {L(
- ': os servidores MCP do Google ainda estão em prévia e só atendem projetos inscritos no Google Workspace Developer Preview Program. O formulário pede o número do projeto (no painel do projeto). A aprovação costuma levar uns dias: siga os passos e salve, mas até lá os conectores do Google falham.',
- ": Google's MCP servers are still in preview and only serve projects enrolled in the Google Workspace Developer Preview Program. The form asks for the project number (on the project's dashboard). Approval usually takes a couple of days: go on with the steps and save, but until then the Google connectors fail."
- )}
- </li>
- <li>
- {link(cloud('auth/overview'), L('Configure a tela de login', 'Set up the sign-in screen'))}
- {L(
- ' (Google Auth Platform › Começar): o nome do app e o seu e-mail; em Público-alvo, Externo (ou Interno, numa conta Google Workspace de empresa). Depois, em Público-alvo › Usuários de teste, adicione o seu e-mail.',
- ' (Google Auth Platform › Get started): the app name and your email; under Audience, External (or Internal, in a company Google Workspace account). Then, under Audience › Test users, add your email.'
- )}
+ <Modal title={guide.title} onClose={onClose} className="google-setup">
+ <p className="muted small modal__lead">{guide.lead}</p>
+ <ol className="google-setup__steps">
+ {guide.steps.map((st, i) => (
+ <li key={i}>
+ {st.link && st.linkText && (google || current ? link(st.link, st.linkText) : st.linkText)}
+ {st.text}
</li>
- <li>
- {link(cloud('auth/clients/create'), L('Crie o cliente', 'Create the client'))}
- {L(': em Tipo de aplicativo, App para computador; marque ', ': under Application type, Desktop app; tick ')}
- <b>{L('Usar este cliente para um agente com IA', 'Use this client for an AI-powered agent')}</b>
- {L(' (sem isso o Google recusa os conectores) e clique em Criar.', ' (without it Google turns the connectors away) and click Create.')}
- </li>
- <li>{L('Copie o ID do cliente e a chave secreta do cliente que aparecem e cole aqui:', 'Copy the client ID and the client secret it shows and paste them here:')}</li>
- </ol>
- ) : (
- <ol className="google-setup__steps">
- <li>
- {current ? link(slackAppLink(current.redirectUrl), L('Crie o app no Slack', 'Create the app in Slack')) : L('Crie o app no Slack', 'Create the app in Slack')}
- {L(': escolha o seu workspace, clique em Próximo e em Criar. O nome, as permissões, o endereço de volta e o MCP já vêm preenchidos.', ': choose your workspace, click Next and Create. The name, the permissions, the return address and MCP come filled in.')}
- </li>
- <li>{L('Em Basic Information › App Credentials, copie o Client ID e o Client Secret (Show) e cole aqui:', 'Under Basic Information › App Credentials, copy the Client ID and the Client Secret (Show) and paste them here:')}</li>
- </ol>
- )}
+ ))}
+ </ol>
<label className="field">
- <span className="field__label">{google ? L('ID do cliente', 'Client ID') : 'Client ID'}</span>
- <input autoFocus spellCheck={false} disabled={busy} value={clientId} placeholder={google ? '1234567890-abc….apps.googleusercontent.com' : '1234567890.1234567890123'} onChange={(e) => setClientId(e.target.value)} />
+ <span className="field__label">{guide.idLabel}</span>
+ <input autoFocus spellCheck={false} disabled={busy} value={clientId} placeholder={guide.idPlaceholder} onChange={(e) => setClientId(e.target.value)} />
</label>
<label className="field">
- <span className="field__label">{google ? L('Chave secreta do cliente', 'Client secret') : 'Client Secret'}</span>
- <input type="password" spellCheck={false} disabled={busy} value={secret} placeholder={current?.clientId ? L('A mesma, ou uma nova', 'The same, or a new one') : google ? 'GOCSPX-…' : ''} onChange={(e) => setSecret(e.target.value)} onKeyDown={(e) => e.key === 'Enter' && !busy && (e.preventDefault(), save())} />
+ <span className="field__label">{guide.secretLabel}</span>
+ <input type="password" spellCheck={false} disabled={busy} value={secret} placeholder={current?.clientId ? L('A mesma, ou uma nova', 'The same, or a new one') : guide.secretPlaceholder} onChange={(e) => setSecret(e.target.value)} onKeyDown={(e) => e.key === 'Enter' && !busy && (e.preventDefault(), save())} />
</label>
- <p className="muted small">
- {google
- ? L(
- 'Com o app em teste, o Google pede pra entrar de novo a cada 7 dias. Pra não pedir, em Público-alvo clique em Publicar app: no login vai aparecer “O Google não verificou este app”. É o seu próprio app: clique em Avançado e continue.',
- 'While the app is in testing, Google asks you to sign in again every 7 days. To stop that, click Publish app under Audience: the sign-in will say “Google hasn’t verified this app”. It’s your own app: click Advanced and go on.'
- )
- : L(
- 'Num workspace de empresa, o admin pode precisar aprovar o app antes: o Slack avisa no login, e o pedido vai pra ele.',
- 'In a company workspace, an admin may need to approve the app first: Slack says so at sign-in, and the request goes to them.'
- )}
- </p>
- {google && (
- <p className="muted small">
- {L('Prefere não configurar? A Composio, na loja, conecta o Google sem isso, mas seus dados passam pelos servidores dela.', "Rather not set this up? Composio, in the store, connects Google without it, but your data goes through its servers.")}
+ {guide.notes.map((n, i) => (
+ <p key={i} className="muted small">
+ {n}
</p>
- )}
+ ))}
{error && <p className="catalog__error small">{error}</p>}
<div className="modal__foot">
<button className="btn btn--ghost" onClick={onClose}>
diff --git a/src/shared/connector-catalog.ts b/src/shared/connector-catalog.ts
index 9f34114..310711b 100644
--- a/src/shared/connector-catalog.ts
+++ b/src/shared/connector-catalog.ts
@@ -282,3 +282,110 @@ export const ownAppOf = (url: string | undefined): CatalogEntry['app'] => CATALO
// What the person turns on in their Google Cloud project, in one page: each service's API and its MCP API.
export const GOOGLE_APIS = ['gmail', 'calendar-json', 'drive', 'docs', 'sheets'].flatMap((a) => [`${a}.googleapis.com`, `${a === 'calendar-json' ? 'calendar' : a}mcp.googleapis.com`])
+
+// ---------- the catalog as data, for a screen that doesn't have this file (the iPhone app) ----------
+
+export interface CatalogView {
+ id: string
+ name: string
+ category: CatalogCategory
+ about: string
+ auth: CatalogEntry['auth']
+ fields?: { id: string; label: string; placeholder: string; hint?: string; secret?: boolean }[]
+ app?: AppProvider // signs in with the person's own app (ownAppGuide)
+ warning?: string
+ runs?: string // a server of the service's that runs on the Tucano's machine: its command
+}
+
+export function catalogView(entries: CatalogEntry[] = CATALOG): CatalogView[] {
+ return entries.map((c) => ({
+ id: c.id,
+ name: c.name,
+ category: c.category,
+ about: c.about(),
+ auth: c.auth,
+ ...(c.fields?.length ? { fields: c.fields.map((f) => ({ id: f.id, label: f.label(), placeholder: f.placeholder, ...(f.hint ? { hint: f.hint() } : {}), ...(f.secret ? { secret: true } : {}) })) } : {}),
+ ...(c.app ? { app: c.app.provider } : {}),
+ ...(c.warning ? { warning: c.warning() } : {}),
+ ...(c.local ? { runs: [c.local.command, ...c.local.args.filter((a) => !a.includes('{'))].join(' ') } : {})
+ }))
+}
+
+// The person's own app, step by step (Google and Slack sign in only apps registered with them; see
+// OwnAppSetup): what the desktop's window and the phone's sheet both say.
+export interface OwnAppGuide {
+ title: string
+ lead: string
+ steps: { text: string; link?: string; linkText?: string }[] // linkText opens link, then text follows
+ idLabel: string
+ idPlaceholder: string
+ secretLabel: string
+ secretPlaceholder: string
+ notes: string[]
+}
+
+const cloud = (path: string): string => `https://console.cloud.google.com/${path}`
+
+export function ownAppGuide(provider: AppProvider, redirectUrl: string): OwnAppGuide {
+ if (provider === 'slack')
+ return {
+ title: L('Seu app do Slack', 'Your Slack app'),
+ lead: L(
+ 'O Slack só deixa usar o servidor MCP dele apps do diretório ou apps internos de um workspace. Você cria o seu, interno, em uns 2 minutos: o link já traz tudo preenchido. Os dados vão do Slack direto pro seu Tucano.',
+ "Slack lets only directory apps or a workspace's internal apps use its MCP server. You make yours, internal, in about 2 minutes: the link brings it all filled in. The data goes from Slack straight to your Tucano."
+ ),
+ steps: [
+ { link: slackAppLink(redirectUrl), linkText: L('Crie o app no Slack', 'Create the app in Slack'), text: L(': escolha o seu workspace, clique em Próximo e em Criar. O nome, as permissões, o endereço de volta e o MCP já vêm preenchidos.', ': choose your workspace, click Next and Create. The name, the permissions, the return address and MCP come filled in.') },
+ { text: L('Em Basic Information › App Credentials, copie o Client ID e o Client Secret (Show) e cole aqui:', 'Under Basic Information › App Credentials, copy the Client ID and the Client Secret (Show) and paste them here:') }
+ ],
+ idLabel: 'Client ID',
+ idPlaceholder: '1234567890.1234567890123',
+ secretLabel: 'Client Secret',
+ secretPlaceholder: '',
+ notes: [L('Num workspace de empresa, o admin pode precisar aprovar o app antes: o Slack avisa no login, e o pedido vai pra ele.', 'In a company workspace, an admin may need to approve the app first: Slack says so at sign-in, and the request goes to them.')]
+ }
+ return {
+ title: L('Seu app do Google', 'Your Google app'),
+ lead: L(
+ 'O Google só deixa entrar apps cadastrados nele. Você cria o seu uma vez, em uns 10 minutos, e o Gmail, o Drive, o Calendar, o Docs e o Sheets entram com ele. Fica tudo na sua conta: os dados vão do Google direto pro seu Tucano.',
+ 'Google only lets in apps registered with it. You make yours once, in about 10 minutes, and Gmail, Drive, Calendar, Docs and Sheets sign in with it. It all stays in your account: the data goes from Google straight to your Tucano.'
+ ),
+ steps: [
+ { link: cloud('projectcreate'), linkText: L('Crie um projeto no Google Cloud', 'Create a project in Google Cloud'), text: L(', com o nome que quiser (Tucano, por exemplo).', ', named as you like (Tucano, say).') },
+ { link: cloud(`flows/enableapi?apiid=${GOOGLE_APIS.join(',')}`), linkText: L('Ative as APIs', 'Turn on the APIs'), text: L(': com o projeto escolhido no topo, clique em Próxima e em Ativar. São as do Gmail, Drive, Calendar, Docs e Sheets e a MCP de cada um.', ': with the project chosen at the top, click Next and Enable. They are Gmail, Drive, Calendar, Docs and Sheets, and the MCP one of each.') },
+ {
+ link: 'https://developers.google.com/workspace/preview',
+ linkText: L('Inscreva o projeto no Developer Preview', 'Enroll the project in the Developer Preview'),
+ text: L(
+ ': os servidores MCP do Google ainda estão em prévia e só atendem projetos inscritos no Google Workspace Developer Preview Program. O formulário pede o número do projeto (no painel do projeto). A aprovação costuma levar uns dias: siga os passos e salve, mas até lá os conectores do Google falham.',
+ ": Google's MCP servers are still in preview and only serve projects enrolled in the Google Workspace Developer Preview Program. The form asks for the project number (on the project's dashboard). Approval usually takes a couple of days: go on with the steps and save, but until then the Google connectors fail."
+ )
+ },
+ {
+ link: cloud('auth/overview'),
+ linkText: L('Configure a tela de login', 'Set up the sign-in screen'),
+ text: L(
+ ' (Google Auth Platform › Começar): o nome do app e o seu e-mail; em Público-alvo, Externo (ou Interno, numa conta Google Workspace de empresa). Depois, em Público-alvo › Usuários de teste, adicione o seu e-mail.',
+ ' (Google Auth Platform › Get started): the app name and your email; under Audience, External (or Internal, in a company Google Workspace account). Then, under Audience › Test users, add your email.'
+ )
+ },
+ {
+ link: cloud('auth/clients/create'),
+ linkText: L('Crie o cliente', 'Create the client'),
+ text: L(': em Tipo de aplicativo, App para computador; marque “Usar este cliente para um agente com IA” (sem isso o Google recusa os conectores) e clique em Criar.', ': under Application type, Desktop app; tick “Use this client for an AI-powered agent” (without it Google turns the connectors away) and click Create.')
+ },
+ { text: L('Copie o ID do cliente e a chave secreta do cliente que aparecem e cole aqui:', 'Copy the client ID and the client secret it shows and paste them here:') }
+ ],
+ idLabel: L('ID do cliente', 'Client ID'),
+ idPlaceholder: '1234567890-abc….apps.googleusercontent.com',
+ secretLabel: L('Chave secreta do cliente', 'Client secret'),
+ secretPlaceholder: 'GOCSPX-…',
+ notes: [
+ L(
+ 'Com o app em teste, o Google pede pra entrar de novo a cada 7 dias. Pra não pedir, em Público-alvo clique em Publicar app: no login vai aparecer “O Google não verificou este app”. É o seu próprio app: clique em Avançado e continue.',
+ 'While the app is in testing, Google asks you to sign in again every 7 days. To stop that, click Publish app under Audience: the sign-in will say “Google hasn’t verified this app”. It’s your own app: click Advanced and go on.'
+ ),
+ L('Prefere não configurar? A Composio, na loja, conecta o Google sem isso, mas seus dados passam pelos servidores dela.', "Rather not set this up? Composio, in the store, connects Google without it, but your data goes through its servers.")
+ ]
+ }
+}
diff --git a/src/shared/rpc-shapes.ts b/src/shared/rpc-shapes.ts
index 461c46b..a424f42 100644
--- a/src/shared/rpc-shapes.ts
+++ b/src/shared/rpc-shapes.ts
@@ -60,6 +60,9 @@ export const SHAPES: Record<Method, Record<string, string>> = {
removeConnector: { id: 's' },
reconnectConnector: { id: 's' },
setConnectorToken: { id: 's', token: 's' },
+ connectorCatalog: {},
+ addCatalogConnector: { id: 's', values: 'o?' },
+ ownAppGuide: { provider: '[google,slack]' },
ownApp: { provider: 's' },
setOwnApp: { provider: 's', clientId: 's', clientSecret: 's' },
authorizeConnector: { id: 's' },
diff --git a/src/shared/rpc.ts b/src/shared/rpc.ts
index 461ed54..9422d1b 100644
--- a/src/shared/rpc.ts
+++ b/src/shared/rpc.ts
@@ -1,7 +1,7 @@
// The contract between the renderer and the core, carried over a MessagePort.
import type { Answer } from './questions'
import type { WikiChange, WikiHit, WikiPage, WikiImport, WikiPageInfo, WikiReview, WikiSource, WikiVersion } from './types'
-import type { AppProvider } from './connector-catalog'
+import type { AppProvider, CatalogCategory, CatalogView, OwnAppGuide } from './connector-catalog'
import type { Os, Account, AccountEngine, ActivityEntry, Device, Inbox, Agent, BrowserInput, Approval, Artifact, ImageUpload, BrowserView, ComputerInfo, Connector, ConnectorInput, ConnectorTool, HarnessMcp, Conversation, EngineId, Invite, Memory, Person, Role, MemoryScope, Message, Routine, RoutineInput, Report, Settings, SetupState, LoginKey, LoginScreen, LocalSkill, Skill, SkillInput, SkillVersion, Trigger, UsageReport, LocalInfo, VoiceModelId, VoiceStatus } from './types'
export interface Snapshot {
@@ -87,6 +87,9 @@ export interface Api {
removeConnector(p: { id: string }): void
reconnectConnector(p: { id: string }): void
setConnectorToken(p: { id: string; token: string }): Promise<void>
+ connectorCatalog(): { categories: { id: CatalogCategory; name: string }[]; entries: CatalogView[]; added: string[] } // the store, as data (the phone); added: the entries already connected
+ addCatalogConnector(p: { id: string; values?: Record<string, string> }): Promise<string> // a store entry, with what it asks, filled in by the core
+ ownAppGuide(p: { provider: AppProvider }): Promise<{ guide: OwnAppGuide; clientId?: string }> // the steps to make one's own Google or Slack app (the phone)
ownApp(p: { provider: AppProvider }): Promise<{ clientId?: string; redirectUrl: string }> // the person's app (Google's, Slack's) its connectors sign in with; its secret stays in the core
setOwnApp(p: { provider: AppProvider; clientId: string; clientSecret: string }): Promise<void>
authorizeConnector(p: { id: string }): Promise<{ url?: string }> // url: on a server, the page to open in the person's browser
diff --git a/test/catalog-view.test.ts b/test/catalog-view.test.ts
new file mode 100644
index 0000000..038967a
--- /dev/null
+++ b/test/catalog-view.test.ts
@@ -0,0 +1,39 @@
+import { describe, expect, it } from 'vitest'
+import { CATALOG, catalogInput, catalogView, ownAppGuide, slackAppLink } from '../src/shared/connector-catalog'
+
+describe('catalogView', () => {
+ const view = catalogView()
+
+ it('has every entry of the store, as plain data', () => {
+ expect(view.map((v) => v.id)).toEqual(CATALOG.map((c) => c.id))
+ expect(JSON.parse(JSON.stringify(view))).toEqual(view) // nothing a phone can't read
+ })
+
+ it('says what each asks, which own app it needs and what runs on the machine', () => {
+ const github = view.find((v) => v.id === 'github')!
+ expect(github.auth).toBe('token')
+ expect(github.fields).toEqual([expect.objectContaining({ id: 'token', secret: true, label: expect.any(String), placeholder: 'github_pat_…' })])
+ expect(view.find((v) => v.id === 'gmail')).toMatchObject({ app: 'google', auth: 'oauth' })
+ expect(view.find((v) => v.id === 'azure-devops')?.runs).toBe('npx -y @azure-devops/mcp')
+ expect(view.find((v) => v.id === 'linear')).toEqual({ id: 'linear', name: 'Linear', category: 'dev', about: expect.any(String), auth: 'oauth' })
+ })
+
+ it('an entry added from the phone becomes the same input as on the desktop', () => {
+ const azure = CATALOG.find((c) => c.id === 'azure-devops')!
+ expect(catalogInput(azure, { organization: 'https://dev.azure.com/contoso/' })).toMatchObject({ kind: 'stdio', args: ['-y', '@azure-devops/mcp', 'contoso'] })
+ })
+})
+
+describe('ownAppGuide', () => {
+ it('walks through Google with a link per step and the fields to paste', () => {
+ const g = ownAppGuide('google', 'http://127.0.0.1:7391/oauth/callback')
+ expect(g.steps.filter((s) => s.link)).toHaveLength(5)
+ expect(g.steps[1]!.link).toContain('gmailmcp.googleapis.com')
+ expect(g.idPlaceholder).toMatch(/apps\.googleusercontent\.com/)
+ })
+
+ it("gives Slack's app link with the Tucano's own return address", () => {
+ const url = 'https://ana.tucano.sh/oauth/callback'
+ expect(ownAppGuide('slack', url).steps[0]!.link).toBe(slackAppLink(url))
+ })
+})