import { OtpStartResponse, OtpVerifyResponse, SignInUrlOptions, SignInReturnDestinationResult, SignInReturnDestinationList, RegisterMessageLineOptions, RegisterMessageLineResult, ListMessageLinesResult, RevokeMessageLineOptions, RevokeMessageLineResult, SignInExchangeResult, SignInTokenValidationResult, SignInPhoneRecognitionResult, CreateMessageSignInUrlOptions, CreateMessageSignInUrlResult, MessageIdentityResolveOptions, MessageIdentity, ImportProfilesRequest, ImportJob, ListConnectorsResponse, ConnectorType, ConnectConnectorResponse, ConfirmConnectorResponse, SyncConnectorResponse, SearchOptions, SearchEmailsResponse, EmailProvider, SearchCalendarResponse, SearchFilesResponse, SearchNotesResponse, SearchSpreadsheetsResponse, GetSheetValuesResponse, SearchWebResponse, FetchUrlResponse, CreateEventResponse, SheetValuesMutationInput, UpdateSheetValuesResponse, AppendSheetValuesResponse, CreateSpreadsheetResponse, AddSheetResponse, SendEmailResponse, ProfileRuntimeOptions, ProfileReadOptions, ProfileReadResult, ProfileSearchOptions, ProfileSearchResult, RememberOptions, RememberResponse, ImportResponse, McpSessionOptions, McpSessionResponse, ConnectApp, ConnectCapability, ConnectResponse, ForgetSelector, ForgetResponse, ProfileCommitInput, ProfileCommitResult, GenerateDocumentsResponse, McpAuthOptions, McpSessionProvider, ProfileToolsOptions, ConfigureToolDefinition, ConfigureToolCall, ConfigureOptions } from './types.js'; /** * Authentication, hosted sign-in, and message-agent identity helpers. */ declare class AuthModule { private baseUrl; private appKey; private fetchFn; private timeout?; private agent?; constructor(baseUrl: string, appKey: string, fetchFn: typeof fetch, timeout?: number, agent?: string); private createAbortSignal; private requestHeaders; /** * Server/headless OTP method. Browser integrations should use `Configure.link()` * from the hosted iframe script instead. * * Sends an OTP to a phone number. * @param phone - Phone number in E.164 format (e.g., "+14155551234") */ sendOtp(phone: string): Promise; /** * Server/headless OTP method. Browser integrations should use `Configure.link()` * from the hosted iframe script instead. * * Verifies an OTP code. * @param phone - Phone number in E.164 format * @param code - 6-digit OTP code */ verifyOtp(phone: string, code: string, options?: { externalId?: string; embed?: boolean; }): Promise; /** * Build a plain hosted sign-in URL for web, deep-link, account-link, or * fallback message handoffs. * * Message-aware agents should prefer `createMessageSignInUrl()` when the * runtime wants Configure to own message URL orchestration. */ signInUrl(options?: SignInUrlOptions): string; /** * Allowlist a return destination for the hosted sign-in code flow. * Requires a server-side `sk_` key. */ allowSignInReturnTo(returnTo: string): Promise; /** * List allowlisted hosted sign-in return destinations for the acting agent. */ listSignInReturnDestinations(): Promise; /** * Remove an allowlisted hosted sign-in return destination. */ removeSignInReturnTo(returnTo: string): Promise; /** * Register an agent-owned message return line for hosted message sign-in. * * Requires a server-side `sk_` key. Configure stores only a hash and last4; * the raw phone is sent at request time so the backend can verify ownership * before reflecting it in a hosted sign-in URL. */ registerMessageLine(options: RegisterMessageLineOptions): Promise; /** * List active agent-owned message return lines. */ listMessageLines(): Promise; /** * Revoke an agent-owned message return line. */ revokeMessageLine(options: RevokeMessageLineOptions): Promise; /** * Exchange a short-lived hosted sign-in code for an agent-scoped token. * Requires a server-side `sk_` key. */ exchangeSignInCode(code: string): Promise; /** * Validate a stored Configure agent token for the acting agent. */ validateSignInToken(token: string): Promise; /** * Recognize a message-channel sender by phone-like candidates and return an * agent token when the user already approved this agent. */ recognizePhone(candidates: string | string[]): Promise; /** * Create a hosted message sign-in/reconnect URL for a message-channel sender. * * Requires a server-side `sk_` key. Code-bearing URLs are returned only when * the backend can verify signed message sender proof; otherwise the result * is `mode: "plain"` with the normal `https://sign-in.me/{agent}` fallback. */ createMessageSignInUrl(options: CreateMessageSignInUrlOptions): Promise; /** * Resolve the identity for a message-based agent turn. * * The result can be passed directly to `configure.profile(identity)`: linked * users use the stored/recognized token, and everyone else falls back to the * developer-scoped `externalId`. */ resolveMessageIdentity(options: MessageIdentityResolveOptions): Promise; private postJson; private requestJson; } interface FileEntry { path: string; type: 'markdown' | 'json' | 'ref'; metadata: Record; updated_at: string; } interface FileListResult { entries: FileEntry[]; count: number; } interface FileListOperationOptions { /** Listing depth (default: 1) */ depth?: number; /** Max entries (default: 100) */ limit?: number; } interface FileReadResult { path: string; content: string; type: 'markdown' | 'json' | 'ref'; metadata: Record; tokens: number; is_directory: boolean; } interface FileWriteOperationOptions { /** Content type (default: 'markdown') */ type?: 'markdown' | 'json'; /** Write mode (default: 'overwrite') */ mode?: 'overwrite' | 'append' | 'merge'; } interface FileWriteResult { path: string; created: boolean; tokens: number; } interface FileSearchHit { path: string; type: 'markdown' | 'json' | 'ref'; snippet?: string; score: number; } interface FileSearchResult { results: FileSearchHit[]; count: number; } interface FileSearchOperationOptions { /** Limit to path prefix (default: '/') */ scope?: string; /** Max results (default: 10) */ limit?: number; /** Return only matching paths without snippets (default: false) */ filesOnly?: boolean; } interface FileDeleteResult { deleted: number; } type FileUserOptions = { token?: string; /** Developer app-local user ID for unlinked profiles. */ externalId?: string; /** Advanced raw file routes may still require an explicit Configure user id. */ userId?: string; }; type FileReadOptions = FileUserOptions & { path: string; }; type FileWriteOptions = FileUserOptions & FileWriteOperationOptions & { path: string; content: string; }; type FileListOptions = FileUserOptions & FileListOperationOptions & { path?: string; }; type FileSearchOptions = FileUserOptions & FileSearchOperationOptions & { path?: string; query: string; }; type FileDeleteOptions = FileUserOptions & { path: string; }; declare class FilesModule { private baseUrl; private appKey; private fetchFn; private timeout?; private defaultExternalId?; constructor(baseUrl: string, appKey: string, fetchFn: typeof fetch, timeout?: number | undefined, defaultExternalId?: string | undefined); private getHeaders; private resolveUserId; private profileUrl; private createAbortSignal; list(options?: FileListOptions): Promise; read(options: FileReadOptions): Promise; write(options: FileWriteOptions): Promise; search(options: FileSearchOptions): Promise; delete(options: FileDeleteOptions): Promise; } declare class ImportRequester { private baseUrl; private apiKey; private fetchFn; private timeout?; constructor(baseUrl: string, apiKey: string, fetchFn: typeof fetch, timeout?: number | undefined); importProfiles(input: ImportProfilesRequest): Promise; getJob(jobId: string): Promise; private request; private createAbortSignal; } declare class ImportJobsModule { private requester; constructor(requester: ImportRequester); get(jobId: string): Promise; } /** * Connector module for managing connected services and live external operations * Handles Gmail, Calendar, Drive, Notion integrations + search/action methods */ declare class ConnectorsModule { private baseUrl; private appKey; private fetchFn; private timeout?; constructor(baseUrl: string, appKey: string, fetchFn: typeof fetch, timeout?: number); private getHeaders; private createAbortSignal; /** * List all available connectors and their connection status */ list(authToken: string, options?: { includeOutlook?: boolean; }): Promise; /** * Start connecting a connector (initiates OAuth flow) * * @example * ```typescript * const { url, connectionRequestId } = await configure.connectors.connect(token, 'gmail', 'myapp://callback'); * ``` */ connect(authToken: string, connector: ConnectorType, callbackUrl?: string, forceNew?: boolean): Promise; /** * Confirm connector connection after OAuth callback */ confirm(authToken: string, connector: ConnectorType, connectionRequestId: string): Promise; /** * Sync a connected connector to refresh data */ sync(authToken: string, connector: ConnectorType): Promise; /** * Sync all connected connectors to refresh profile data. * Triggers data pull from Gmail, Calendar, Drive, Notion into the user's profile. */ syncAll(authToken: string, connectors?: ConnectorType[]): Promise<{ userId: string; synced: Record; }>; /** * Disconnect a connector */ disconnect(authToken: string, connector: ConnectorType): Promise; /** * Disconnect all connectors */ disconnectAll(authToken: string): Promise; /** * Search the user's Gmail * Results are automatically saved to the user's profile. * * @example * ```typescript * const results = await configure.connectors.searchEmails(token, 'flight confirmation'); * ``` */ searchEmails(authToken: string, query: string, options?: SearchOptions): Promise; /** Search permitted Gmail and Outlook accounts through the provider-neutral endpoint. */ searchHostedEmails(authToken: string, query: string, options?: SearchOptions & { provider?: EmailProvider; }): Promise; /** * Get the user's calendar events * Results are automatically saved to the user's profile. */ getCalendar(authToken: string, range?: 'today' | 'tomorrow' | 'week' | 'month'): Promise; /** * Search the user's Google Drive files * Results are automatically saved to the user's profile. */ searchFiles(authToken: string, query: string, options?: SearchOptions): Promise; /** * Search the user's Notion pages * Results are automatically saved to the user's profile. */ searchNotes(authToken: string, query: string, options?: SearchOptions): Promise; /** * Search the user's Google Sheets spreadsheets by title. */ searchSpreadsheets(authToken: string, query: string, options?: SearchOptions): Promise; /** * Read bounded A1 ranges from a Google Sheets spreadsheet. */ getSheetValues(authToken: string, spreadsheetId: string, ranges: string[]): Promise; /** * Search the web. * Results are automatically saved to the user's profile. * No user connection required — works for all authenticated users. */ searchWeb(authToken: string, query: string, options?: SearchOptions): Promise; /** * Fetch a web page's content by URL. * Returns the page title and readable text content. * No user connection required — works for all authenticated users. */ fetchUrl(authToken: string, url: string, options?: { maxLength?: number; }): Promise; /** * Create a calendar event for the user * Requires the user to have Google Calendar connected. */ createCalendarEvent(authToken: string, event: { title: string; startTime: string; endTime: string; description?: string; location?: string; }): Promise; /** * Update values in a specific A1 range in a Google Sheets spreadsheet. */ updateSheetValues(authToken: string, input: SheetValuesMutationInput): Promise; /** * Append rows to a Google Sheets spreadsheet range. */ appendSheetValues(authToken: string, input: SheetValuesMutationInput): Promise; /** * Create a Google Sheets spreadsheet. */ createSpreadsheet(authToken: string, title: string): Promise; /** * Add a worksheet tab to an existing Google Sheets spreadsheet. */ addSheet(authToken: string, input: { spreadsheetId: string; title: string; rowCount?: number; columnCount?: number; }): Promise; /** * Send an email on behalf of the user * Requires the user to have Gmail connected. */ sendEmail(authToken: string, email: { to: string; subject: string; body: string; account?: string; }): Promise; /** Send through a specifically selected or unambiguous hosted email provider. */ sendHostedEmail(authToken: string, email: { to: string; subject: string; body: string; provider?: EmailProvider; account?: string; }): Promise; } interface PrivateRuntimeCorrelation { sessionId: string; runtimeScopeId: string; readId?: string; } declare class ProfileRequester { private baseUrl; private appKey; private fetchFn; private timeout?; private defaultExternalId?; constructor(baseUrl: string, appKey: string, fetchFn: typeof fetch, timeout?: number | undefined, defaultExternalId?: string | undefined); private getHeaders; private resolveSubject; private createAbortSignal; read(runtime: ProfileRuntimeOptions, options?: ProfileReadOptions, correlation?: PrivateRuntimeCorrelation): Promise; search(runtime: ProfileRuntimeOptions, options?: ProfileSearchOptions | string, correlation?: PrivateRuntimeCorrelation): Promise; remember(runtime: ProfileRuntimeOptions, fact: string, options?: RememberOptions): Promise; import(runtime: ProfileRuntimeOptions, text: string, options?: { box?: string; kind?: 'memories' | 'context'; }): Promise; mcpSession(runtime: ProfileRuntimeOptions, options?: McpSessionOptions): Promise; connect(runtime: ProfileRuntimeOptions, options?: { app?: ConnectApp; capability?: ConnectCapability; purpose?: string; client?: string; client_name?: string; returnUrl?: string; }): Promise; forget(runtime: ProfileRuntimeOptions, selector: string | ForgetSelector, options?: { date?: string; reason?: 'correction' | 'user_request'; }): Promise; commit(runtime: ProfileRuntimeOptions, input: ProfileCommitInput, correlation?: PrivateRuntimeCorrelation): Promise; /** * Refresh the user's generated profile documents. Gated server-side: * serves cached documents unless profile inputs changed since the last * generation, and refreshes at most once per user per day — check * `cached` on the result. Raw memories and facts are always current on * reads regardless; only the prose documents are gated. */ generateDocuments(runtime: ProfileRuntimeOptions, documents?: ('user.md' | 'soul.md' | 'preferences.md' | 'context.md' | 'all')[]): Promise; } declare class ProfileRuntime { private requester; private connectorRequester; private filesRequester; private runtime; private enabledToolNames; private readonly sessionId; private runtimeScopeId; private pendingReadIds; constructor(requester: ProfileRequester, connectorRequester: ConnectorsModule, filesRequester: FilesModule, runtime: ProfileRuntimeOptions); read: (options?: ProfileReadOptions) => Promise; search: (options?: ProfileSearchOptions | string) => Promise; remember: (fact: string, options?: RememberOptions) => Promise; /** * Delete memories this agent wrote. Parity with the MCP `configure_profile_forget` * tool: pass a memory id string for a single delete, or a selector object to * delete by content (`match`, with `confirm: true` to go past the preview), * undo one import (`import_id`), or clear your own writes in bulk (`scope`). */ forget: (selector: string | ForgetSelector, options?: { date?: string; reason?: "correction" | "user_request"; }) => Promise; import: (text: string, options?: { box?: string; kind?: "memories" | "context"; }) => Promise; /** * Mint a Configure-hosted connect link. Parity with the MCP `configure_connect` * tool: with no options it mints a sign-in link; `app` targets a connector (or * `import`); `capability` asks for a specific scope upgrade (e.g. `gmail:send`). * Include the returned `connect_url` verbatim in your reply; never build links * yourself. * * `returnUrl` (https only) sends the user back into your product when the * hosted flow finishes — pass the page they were on. Configure forwards * automatically when the destination matches your app's known domain, and * otherwise shows them a button naming the host. */ connect: (options?: { app?: ConnectApp; capability?: ConnectCapability; purpose?: string; client?: string; client_name?: string; returnUrl?: string; }) => Promise; /** * Mint a SHORT-LIVED (15m) single-bearer MCP session for this user, so an * MCP-capable agent runtime can hold its own connection to Configure — * drop `mcp_servers` straight into the model call or the runtime's MCP * config. Mint per conversation; never store the token. `linked: false` * means the user has not approved this agent yet: personal tools fail * closed and configure_connect mints the sign-in link. * * If your runtime outlives one token, prefer `mcpAuth()` — it refreshes * for you. Refreshing by hand? Pass the token you are replacing as * `previousToken` so a read done on the old session can still be committed * on the new one. */ mcpSession: (options?: McpSessionOptions) => Promise; /** * A self-refreshing MCP session for runtimes that outlive one 15-minute * token (daemons, workers, long agent loops). Call `mcpServers()` before * EVERY model call — it returns the cached session while fresh and * transparently re-mints near expiry, carrying read/commit correlation * forward via `previousToken`. On an unexpected 401 from the MCP server, * call `invalidate()` and retry once. Nothing here extends a token's life: * every refresh is a fresh 15-minute mint under your live credential, so * revoking your key still cuts everything off within one TTL. * * Create ONE provider per user runtime and hold onto it. A new provider per * request has an empty cache every time, which means a mint per model call: * exactly the stampede the provider exists to prevent. */ mcpAuth: (options?: McpAuthOptions) => McpSessionProvider; commit: (input: ProfileCommitInput) => Promise; tools: (options?: ProfileToolsOptions) => ConfigureToolDefinition[]; /** * Execute one Configure tool call. * * `options.allow` names the tools THIS caller enabled, instead of relying on * the handle's set. That matters because `tools()` rewrites handle state, so * two consumers of one handle otherwise fight over it: whoever called * `tools()` last decides what everyone else may execute, and the loser gets * ACCESS_DENIED. Passing an allow-list keeps a caller's own selection local * and mutates nothing. */ executeTool: (toolCall: ConfigureToolCall, options?: { allow?: Iterable; }) => Promise; private correlation; private recordObligations; } declare function validateAgentHandle(agent: string): string; declare class Configure { /** Server/headless authentication helpers. Browser integrations should use Configure Link. */ readonly auth: AuthModule; /** Connector management and direct connector operations. */ readonly connectors: ConnectorsModule; /** Advanced raw profile file operations. */ readonly files: FilesModule; /** Server-side profile import/backfill job status helpers. */ readonly importJobs: ImportJobsModule; private readonly profileRequester; private readonly importRequester; constructor(options?: ConfigureOptions); profile(options?: ProfileRuntimeOptions): ProfileRuntime; importProfiles(input: ImportProfilesRequest): Promise; } export { Configure as C, type FileDeleteOptions as F, type FileDeleteResult as a, type FileEntry as b, type FileListOperationOptions as c, type FileListOptions as d, type FileListResult as e, type FileReadOptions as f, type FileReadResult as g, type FileSearchHit as h, type FileSearchOperationOptions as i, type FileSearchOptions as j, type FileSearchResult as k, type FileWriteOperationOptions as l, type FileWriteOptions as m, type FileWriteResult as n, validateAgentHandle as v };