/** * Connect targets — where `synap connect --target=X` can drop credentials, * skills, and MCP configs for each supported AI surface. * * Each target knows: * - how to describe itself to the user * - where its skills directory lives (if it reads Agent Skills) * - where its MCP config lives (if it supports MCP) * - how to render a one-shot install for the given pod + API key */ export type TargetName = "claude-code" | "claude-desktop" | "cursor" | "raycast" | "openclaw" | "openwebui" | "codex" | "opencode" | "aider" | "windsurf" | "goose" | "zed" | "vscode" | "generic"; export interface TargetConnectionConfig { podUrl: string; apiKey: string; workspaceId?: string; projectId?: string; agentUserId?: string; skills?: string[]; } export interface TargetInfo { name: TargetName; label: string; description?: string; supports: { skills: boolean; mcp: boolean; }; skillsDir?: () => string; mcpConfigPath?: () => string; } export declare const TARGETS: Record; export declare function isTargetName(value: string): value is TargetName; /** * Build the pod's /mcp URL with optional scope lenses: * ?workspaceId= — workspace lens (an app-lens of a project) * ?projectId= — project focus lens (orthogonal; narrows every tool call) * Both are opt-in and compose. Omitting both = pod-wide. */ export declare function buildMcpUrl(podUrl: string, workspaceId?: string, projectId?: string): string; export declare function configureAgentContext(podUrl: string, apiKey: string, agentType: string, agentUserId: string, info?: TargetInfo): Promise; export declare function listTargets(): void; /** * Run the install flow for a target. Returns true on success. * Throws only on unexpected errors — recoverable failures are logged + return false. */ export declare function installForTarget(target: TargetName, cfg: TargetConnectionConfig): Promise; /** * Fetch the pod's accessible workspaces and prompt the user to pick one for * MCP URL scoping. Falls back silently to the workspaceId already in cfg * if the fetch fails or the user skips. */ export declare function resolveWorkspaceId(cfg: TargetConnectionConfig): Promise; /** * Write (or update) Synap env vars AND optionally the MCP server entry in ~/.claude/settings.json. * Called both by installClaudeCode and by `synap pods use` to propagate switches. * * Claude Code reads mcpServers natively from settings.json using the HTTP transport * format: { url, headers }. The URL optionally carries ?workspaceId= so all tool * calls are pre-scoped to one workspace without the model having to pass it. * * @param writeMcp — set false to skip the mcpServers entry (skills-only installs) */ export declare function writeClaudeCodeEnv(cfg: Pick, { writeMcp }?: { writeMcp?: boolean; }): Promise; /** * Provision an agent-owned API key for the given surface via POST /api/hub/setup/agent. * When requireApproval is true the key is created inactive; the user must approve in the * browser before this function returns. * Throws on failure — callers must not silently fall back to a human key. */ export declare function provisionAgentKey(podUrl: string, humanApiKey: string, agentType: string, { requireApproval, idempotent, }?: { requireApproval?: boolean; idempotent?: boolean; }): Promise<{ hubApiKey: string; agentUserId: string; reused: boolean; }>; /** * Enroll an agent user into the caller's workspaces via POST /api/hub/workspaces/enroll-agent. * Non-fatal — logs on failure so connect flow is never blocked by enrollment errors. * * @param callerKey The key of the user whose workspaces to enroll into (pod profile key). * @param agentUserId The agent user to enroll. * @param workspaceId When set, enroll in that one workspace only; omit for all. * @param opts.role Workspace role to grant the agent. Defaults to "editor" — the * one safe default callers get unless they explicitly ask for another role. */ export declare function enrollAgentIfNeeded(podUrl: string, callerKey: string, agentUserId: string, workspaceId?: string, opts?: { quiet?: boolean; role?: string; }): Promise; interface McpServerConfig { url?: string; command?: string; args?: string[]; headers?: Record; env?: Record; } export interface ProviderInfo { providerId: string; name: string; models: Array<{ id: string; contextWindow?: number; }>; } export interface ProviderInstallConfig { podUrl: string; apiKey: string; } export declare function installOpencode(cfg: ProviderInstallConfig & { workspaceId?: string; projectId?: string; }): Promise; export declare function installAider(cfg: ProviderInstallConfig): Promise; export declare function writeMcpServerEntry(configPath: string, serverName: string, server: McpServerConfig): void; /** * Idempotent workspace governance prompt. Checks if the workspace already has * aiGovernance configured — skips if set. Otherwise prompts for safe/normal/crazy * and applies via PATCH /workspaces/:id/governance. */ export type GovernancePreset = "safe" | "normal" | "crazy"; export declare function ensureAgentGovernance(cfg: { podUrl: string; apiKey: string; }, agentUserId: string, presetMode?: GovernancePreset): Promise; export {};