@opengeni/sdk 6.7.0 → 6.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { WorkspaceTranscriptionPolicy } from \"./transcription\";\nimport type { SessionUsageLimit } from \"@opengeni/contracts/session-usage-limits\";\nexport type {\n SessionUsageLimit,\n SessionUsageLimitHistory,\n SessionUsageLimitReachedRefusal,\n SessionUsageLimitStatus,\n SetSessionUsageLimitRequest,\n} from \"@opengeni/contracts/session-usage-limits\";\nexport type {\n InsightsUsageRange,\n InsightsUsageGroupBy,\n InsightsUsagePayer,\n InsightsUsageSource,\n InsightsUsageTokens,\n InsightsUsageClassMicros,\n InsightsUsageMeasures,\n InsightsUsageScope,\n InsightsUsageGroup,\n InsightsUsageSeriesPoint,\n InsightsUsageFacets,\n InsightsUsageResponse,\n InsightsCall,\n InsightsCallsResponse,\n InsightsUsageWindowOptions,\n WorkspaceInsightsUsageOptions,\n OrganizationInsightsUsageOptions,\n WorkspaceInsightsCallsOptions,\n OrganizationInsightsCallsOptions,\n InsightsCallsScope,\n} from \"./insights-usage\";\nimport type {\n ClientModelResidencyV1,\n ScheduledTaskEvents,\n ScheduledTaskEventsInput,\n ScheduledTaskRunEventOccurrence,\n ScheduledTaskSkill,\n SessionAutomationWaitSummary,\n SessionAvatar,\n} from \"@opengeni/contracts\";\nexport type { SessionAvatar, SessionAvatarIcon } from \"@opengeni/contracts\";\nexport type { ScheduledTaskSkill } from \"@opengeni/contracts\";\nexport type {\n McpElicitationAnswer,\n McpElicitationApprovalRequest,\n McpElicitationContent,\n McpElicitationField,\n McpElicitationRequestedSchema,\n McpElicitationValue,\n} from \"@opengeni/contracts\";\nimport type { McpElicitationApprovalRequest, McpElicitationContent } from \"@opengeni/contracts\";\nexport type {\n ClaudeSubscriptionOAuthStartResponse,\n ClaudeSubscriptionOAuthCompleteRequest,\n ClaudeSubscriptionOAuthCompleteResponse,\n} from \"@opengeni/contracts\";\nexport type {\n SessionMessageSearchRequest,\n SessionMessageSearchMatch,\n SessionMessageSearchResponse,\n SessionMessagePreview,\n SessionMessagePreviewReference,\n} from \"./session-message-search\";\n\nexport type BundledSkillId =\n | \"builtin:opengeni-help\"\n | \"builtin:opengeni-client\"\n | \"builtin:visualize\"\n | \"builtin:document-parsing\"\n | \"builtin:skill-management\"\n | \"builtin:projects\"\n | \"builtin:schedules\"\n | \"builtin:event-triggers\"\n | \"builtin:documents\"\n | \"builtin:spreadsheets\"\n | \"builtin:presentations\"\n | \"builtin:sites\"\n | \"builtin:video-generation\"\n | \"builtin:secrets\"\n | LegacyBundledSkillId;\n/**\n * @deprecated Renamed to the neutral ids above; still accepted and resolved to them.\n */\nexport type LegacyBundledSkillId =\n | \"builtin:opengeni-visualize\"\n | \"builtin:opengeni-skills\"\n | \"builtin:opengeni-projects\"\n | \"builtin:opengeni-schedules\"\n | \"builtin:opengeni-documents\"\n | \"builtin:opengeni-spreadsheets\"\n | \"builtin:opengeni-presentations\"\n | \"builtin:opengeni-sites\"\n | \"builtin:opengeni-video-generation\"\n | \"builtin:opengeni-secrets\";\n\n// Hand-written mirrors of the public wire shapes in `@opengeni/contracts`.\n// Ordinary SDK entries stay framework-agnostic and do not import the contracts\n// runtime; `test/contract-parity.test.ts` pins these types to the contracts\n// package so drift fails the gate instead of shipping.\n\nexport type CodexRealtimeWebrtcVersion = \"v3\";\nexport type CodexRealtimeVoice =\n | \"juniper\"\n | \"maple\"\n | \"spruce\"\n | \"ember\"\n | \"vale\"\n | \"breeze\"\n | \"arbor\"\n | \"sol\"\n | \"cove\";\n\nexport type CodexRealtimeWebrtcRequest = {\n realtimeId: string;\n operationId: string;\n browserInstanceId: string;\n ownerKey: string;\n expectedVersion: number;\n expectedConnectionEpoch: number;\n rotate: boolean;\n browserActivation?: \"required\" | undefined;\n sdp: string;\n version: CodexRealtimeWebrtcVersion;\n instructions?: string | undefined;\n voice?: CodexRealtimeVoice | undefined;\n};\n\nexport type CodexRealtimeWebrtcResponse = {\n sdp: string;\n version: CodexRealtimeWebrtcVersion;\n model: \"gpt-live-1-boulder-alpha\" | \"opengeni-azure/gpt-live-1\";\n connectionId: string;\n connectionEpoch: number;\n startupFenceSequence: number;\n modeVersion: number;\n replay: boolean;\n};\n\nexport type SessionRealtimeWebsocketRequest = {\n realtimeId: string;\n operationId: string;\n browserInstanceId: string;\n ownerKey: string;\n expectedVersion: number;\n expectedConnectionEpoch: number;\n rotate: boolean;\n /**\n * BCP 47 tag of the language the person speaks, for example `nb-NO`.\n * Providers that need a fixed conversation language use it; the others\n * detect the spoken language themselves.\n */\n language?: string | undefined;\n /**\n * Voice settings for this connection. Each set field overrides the\n * workspace's saved settings for the model; `voiceSettings.language` also\n * overrides `language`.\n */\n voiceSettings?: RealtimeVoiceSettings | undefined;\n};\n/** @deprecated Use SessionRealtimeWebsocketRequest. */\nexport type GatewayRealtimeConnectRequest = SessionRealtimeWebsocketRequest;\n\nexport type SessionRealtimeWebsocketInitialItem = {\n role: \"user\" | \"developer\" | \"assistant\";\n text: string;\n};\n/** @deprecated Use SessionRealtimeWebsocketInitialItem. */\nexport type GatewayRealtimeInitialItem = SessionRealtimeWebsocketInitialItem;\n\n/**\n * Wire protocol of a realtime WebSocket provider: the OpenAI Realtime protocol\n * (also spoken by xAI and ElevenLabs) or the AI Gateway's normalized protocol.\n */\nexport type RealtimeWebsocketProtocol = \"openai\" | \"ai-gateway\";\n\nexport type SessionRealtimeWebsocketResponse = {\n protocol: RealtimeWebsocketProtocol;\n /** WebSocket subprotocols to open the socket with; one carries the client secret. */\n protocols: string[];\n /** First client event to send once the socket opens; null when the mint configured it. */\n sessionUpdate: Record<string, unknown> | null;\n token: string;\n url: string;\n upstreamModelId: string;\n expiresAt: number | null;\n connectionId: string;\n connectionEpoch: number;\n startupFenceSequence: number;\n modeVersion: number;\n /**\n * @deprecated Always empty: the prior conversation travels in the\n * provider's session instructions. Kept for clients of earlier releases.\n */\n initialItems: SessionRealtimeWebsocketInitialItem[];\n instructions: string;\n /**\n * Assistant transcripts carry inline delivery tags such as `[calm]`, which\n * are spoken as tone, not words; clients drop them from transcripts.\n */\n transcriptAudioTags?: boolean | undefined;\n replay: false;\n};\n/** @deprecated Use SessionRealtimeWebsocketResponse. */\nexport type GatewayRealtimeConnectResponse = SessionRealtimeWebsocketResponse;\n\nexport type ToolGatewayIdentity = {\n serverId: string;\n toolName: string;\n};\n\nexport type ToolGatewayCatalogEntry = {\n identity: ToolGatewayIdentity;\n modelName: string;\n codemodePath: string[];\n title?: string | undefined;\n description?: string | undefined;\n inputSchema: Record<string, unknown>;\n outputSchema?: Record<string, unknown> | undefined;\n annotations?: Record<string, unknown> | undefined;\n icons?: Array<Record<string, unknown>> | undefined;\n source: \"opengeni\" | \"files\" | \"docs\" | \"mcp\" | \"codex_apps\" | \"interaction\";\n approval: \"none\" | \"human\" | \"policy\";\n};\n\nexport type ToolGatewayCatalog = {\n version: 1;\n accountId: string;\n workspaceId: string;\n generation: number;\n digest: string;\n createdAt: string;\n entries: ToolGatewayCatalogEntry[];\n};\n\nexport type ToolGatewayResult = {\n content: Array<{ type: string; [key: string]: unknown }>;\n structuredContent?: Record<string, unknown> | undefined;\n isError?: boolean | undefined;\n _meta?: Record<string, unknown> | undefined;\n [key: string]: unknown;\n};\n\nexport type ToolGatewayCallRequest = {\n operationId?: string | undefined;\n catalogDigest: string;\n identity: ToolGatewayIdentity;\n arguments: Record<string, unknown>;\n siteArtifactId?: string | undefined;\n siteVersionId?: string | undefined;\n approvalToken?: string | undefined;\n};\n\nexport type ToolGatewayApprovalRequest = {\n operationId: string;\n catalogDigest: string;\n identity: ToolGatewayIdentity;\n arguments: Record<string, unknown>;\n};\n\nexport type ToolGatewayApprovalResponse = {\n operationId: string;\n catalogDigest: string;\n identity: ToolGatewayIdentity;\n approvalToken: string;\n expiresAt: string;\n};\n\nexport type ToolGatewayCallResponse = {\n operationId: string;\n catalogDigest: string;\n result: ToolGatewayResult;\n};\n\nexport type ToolGatewayTarget = { identity: ToolGatewayIdentity } | { path: string[] };\nexport type ToolGatewayResolvedTool = {\n version: 1;\n definitionDigest: string;\n entry: ToolGatewayCatalogEntry;\n};\nexport type ToolGatewayResolveRequest = {\n target: ToolGatewayTarget;\n siteArtifactId?: string;\n siteVersionId?: string;\n};\nexport type ToolGatewayInvokeRequest = ToolGatewayResolveRequest & {\n operationId: string;\n arguments: Record<string, unknown>;\n expectedDefinitionDigest?: string;\n approvalToken?: string;\n};\nexport type ToolGatewayInvokeResponse = {\n operationId: string;\n tool: ToolGatewayResolvedTool;\n result: ToolGatewayResult;\n};\nexport type ToolGatewayTargetApprovalRequest = {\n identity: ToolGatewayIdentity;\n operationId: string;\n arguments: Record<string, unknown>;\n expectedDefinitionDigest: string;\n /** \"Always allow for this Site\" (this person, this Site, this tool and connection). Site context only. */\n rememberForSite?: boolean;\n siteArtifactId?: string;\n siteVersionId?: string;\n};\nexport type ToolGatewayTargetApprovalResponse = {\n bindingVersion: 2;\n operationId: string;\n tool: ToolGatewayResolvedTool;\n approvalToken: string;\n expiresAt: string;\n};\n/** The viewer's own accounts for a Site's declared tool (host code only). */\nexport type ToolGatewaySiteConsentRequest = {\n identity: ToolGatewayIdentity;\n siteArtifactId: string;\n siteVersionId: string;\n /** The exact arguments, to review what the call would do on the selected account. */\n arguments?: Record<string, unknown>;\n};\nexport type ToolGatewaySiteConsentAccount = {\n identity: ToolGatewayIdentity;\n connector: string;\n account: string;\n};\n/** The provider's own reading of the call (for Gmail, the message as it would be sent). */\nexport type ToolGatewaySiteConsentReview = {\n kind: \"generic\" | \"gmail\";\n email?: {\n from: string;\n to: string;\n cc: string;\n bcc: string;\n subject: string;\n attachments: number;\n };\n};\nexport type ToolGatewaySiteConsentResponse = {\n version: 1;\n accounts: ToolGatewaySiteConsentAccount[];\n selected: ToolGatewayIdentity | null;\n review: ToolGatewaySiteConsentReview | null;\n connect: { capabilityId: string | null; name: string; providerDomain: string } | null;\n};\nexport type ToolGatewayManifestRequest = {\n identities: ToolGatewayIdentity[];\n siteArtifactId?: string;\n siteVersionId?: string;\n};\nexport type ToolGatewayManifestResponse = {\n version: 1;\n digest: string;\n tools: ToolGatewayResolvedTool[];\n};\n\nexport type ToolGatewayDeclarationsResponse = {\n catalogDigest: string;\n moduleSpecifier: string;\n source: string;\n};\n\nexport type ActivateCodexRealtimeConnectionRequest = {\n operationId: string;\n browserInstanceId: string;\n ownerKey: string;\n connectionEpoch: number;\n expectedVersion: number;\n expectedConnectionEpoch: number;\n};\n\nexport type SessionRealtimeLedgerDirection = \"provider_in\" | \"provider_out\";\nexport type SessionRealtimeLedgerKind =\n | \"user_transcript\"\n | \"assistant_transcript\"\n | \"delegation_call\"\n | \"delegation_progress\"\n | \"delegation_result\"\n | \"interruption\"\n | \"session_update\"\n | \"error\";\n\nexport type SessionRealtimeLedgerEntry = {\n id: string;\n realtimeId: string;\n operationId: string;\n connectionEpoch: number;\n sequence: number;\n direction: SessionRealtimeLedgerDirection;\n kind: SessionRealtimeLedgerKind;\n role: \"user\" | \"assistant\" | null;\n providerEventId: string | null;\n delegationItemId: string | null;\n sourceUpdateId: string | null;\n historyItemId: string | null;\n turnId: string | null;\n text: string | null;\n payload: Record<string, unknown>;\n clientAckedAt: string | null;\n providerAckedAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type SessionRealtimeInboundEntry = {\n operationId: string;\n kind: Exclude<\n SessionRealtimeLedgerKind,\n \"delegation_progress\" | \"delegation_result\" | \"session_update\"\n >;\n role?: \"user\" | \"assistant\" | null | undefined;\n providerEventId?: string | null | undefined;\n delegationItemId?: string | null | undefined;\n text?: string | null | undefined;\n payload?: Record<string, unknown> | undefined;\n /** Model-visible application context attached to this exact realtime message. */\n modelContext?: string | undefined;\n};\n\nexport type SyncSessionRealtimeLedgerRequest = {\n browserInstanceId: string;\n ownerKey: string;\n expectedVersion: number;\n connectionId: string;\n connectionEpoch: number;\n entries?: SessionRealtimeInboundEntry[] | undefined;\n clientAckThroughSequence?: number | null | undefined;\n providerAckSequences?: number[] | undefined;\n providerStarted?:\n | { providerSessionId: string; providerEventId?: string | null | undefined }\n | undefined;\n};\n\nexport type SyncSessionRealtimeLedgerResponse = {\n accepted: Array<{ entry: SessionRealtimeLedgerEntry; replay: boolean }>;\n outbound: SessionRealtimeLedgerEntry[];\n};\n\nexport type SessionRealtimeModel =\n | \"opengeni-azure/gpt-live-1\"\n | \"gpt-live-1-boulder-alpha\"\n | \"supergrok/grok-voice-think-fast-2.0\"\n | \"opengeni-gateway/openai/gpt-realtime-2.1\"\n | \"opengeni-gateway/openai/gpt-realtime-mini\"\n | \"opengeni-gateway/xai/grok-voice-think-fast-2.0\"\n | \"workspace-gateway/openai/gpt-realtime-2.1\"\n | \"workspace-gateway/openai/gpt-realtime-mini\"\n | \"workspace-gateway/xai/grok-voice-think-fast-2.0\"\n | \"workspace-elevenlabs/eleven_realtime_v1_max\"\n | \"workspace-elevenlabs/eleven_realtime_v1_mini\";\n\nexport type WorkspaceRealtimeModelCatalogItem = {\n id: SessionRealtimeModel;\n label: string;\n provider:\n | \"OpenGeni\"\n | \"Connected Codex\"\n | \"Connected SuperGrok\"\n | \"Your Gateway\"\n | \"Your ElevenLabs\";\n description: string;\n available: boolean;\n unavailableReason: string | null;\n /** Machine-readable reason when unavailable, e.g. `insufficient_credits`. */\n unavailableCode?: string | null | undefined;\n recommended: boolean;\n /**\n * Languages a conversation with this model can be set to, as the provider's\n * language codes. Absent when the model detects the spoken language itself.\n */\n languages?: string[] | undefined;\n /** Voices this model can speak with. Absent when the voice cannot be chosen. */\n voices?: { id: string; label: string }[] | undefined;\n /** Whether any provider voice id is accepted as `voice`, beyond the listed `voices`. */\n customVoice?: boolean | undefined;\n /** Turn eagerness values this model accepts. Absent when it cannot be chosen. */\n turnEagerness?: RealtimeTurnEagerness[] | undefined;\n /** The provider's defaults for the settings it offers, other than language. */\n voiceDefaults?: RealtimeVoiceSettings | undefined;\n /** The workspace's saved voice settings for this model. */\n workspaceVoiceSettings?: RealtimeVoiceSettings | undefined;\n /** The organization's default voice settings for this model, used while the workspace has none. */\n organizationVoiceSettings?: RealtimeVoiceSettings | undefined;\n /** True on the model this workspace chose to start voice conversations with. */\n workspaceDefault?: boolean | undefined;\n /** True on the model the organization chose to start voice conversations with; a workspace's own choice wins. */\n organizationDefault?: boolean | undefined;\n};\n\n/** How readily a realtime voice model decides the speaker is done and answers. */\nexport type RealtimeTurnEagerness = \"low\" | \"medium\" | \"high\";\n\n/**\n * Voice settings for a realtime voice model. Unset fields keep the provider's\n * default. A model offers only the settings its catalog entry lists\n * (`voices`/`customVoice`, `languages`, `turnEagerness`); a value it does not\n * offer is ignored rather than failing the call.\n */\nexport type RealtimeVoiceSettings = {\n /** A listed voice id, or any provider voice id where `customVoice` is offered. */\n voice?: string | undefined;\n /** Conversation language (a catalog `languages` code or a BCP 47 tag), for models that need one. */\n language?: string | undefined;\n turnEagerness?: RealtimeTurnEagerness | undefined;\n};\n\nexport type WorkspaceRealtimeModelCatalogResponse = {\n models: WorkspaceRealtimeModelCatalogItem[];\n};\nexport type SessionRealtimeState = \"active\" | \"ended\";\nexport type SessionRealtimeEndReason =\n | \"user_stop\"\n | \"browser_unload\"\n | \"lease_expired\"\n | \"authority_revoked\";\n\nexport type SessionRealtimeMode = {\n id: string;\n sessionId: string;\n operationId: string;\n browserInstanceId: string;\n model: SessionRealtimeModel;\n state: SessionRealtimeState;\n version: number;\n connectionEpoch: number;\n leaseExpiresAt: string;\n lastHeartbeatAt: string;\n startedAt: string;\n endedAt: string | null;\n endReason: SessionRealtimeEndReason | null;\n};\n\nexport type BeginSessionRealtimeRequest = {\n operationId: string;\n browserInstanceId: string;\n ownerKey: string;\n model: SessionRealtimeModel;\n};\n\nexport type RenewSessionRealtimeRequest = {\n browserInstanceId: string;\n ownerKey: string;\n expectedVersion: number;\n};\n\nexport type EndSessionRealtimeRequest = RenewSessionRealtimeRequest & {\n reason: Extract<SessionRealtimeEndReason, \"user_stop\" | \"browser_unload\">;\n};\n\n/** Server instruction to end a live call now (for example, out of credits). */\nexport type SessionRealtimeStopInstruction = {\n code: string;\n message: string;\n};\n\nexport type SessionRealtimeMutationResponse = {\n mode: SessionRealtimeMode;\n replay: boolean;\n /** Present on a heartbeat when the server stopped extending the lease. */\n stop?: SessionRealtimeStopInstruction | undefined;\n};\n\nexport type SessionStatus =\n | \"queued\"\n | \"running\"\n | \"idle\"\n | \"requires_action\"\n | \"recovering\"\n | \"waiting_capacity\"\n | \"failed\"\n | \"cancelled\";\n\n// Mirror of `@opengeni/contracts` SandboxBackend (13 values; every member is\n// additive at the end). 3-way enum parity is pinned by\n// `test/contract-parity.test.ts`.\nexport type SandboxBackend =\n | \"docker\"\n | \"modal\"\n | \"local\"\n | \"none\"\n | \"daytona\"\n | \"runloop\"\n | \"e2b\"\n | \"blaxel\"\n | \"cloudflare\"\n | \"vercel\"\n | \"selfhosted\"\n | \"opensandbox\"\n | \"compute\";\n\n// Mirror of `@opengeni/contracts` SandboxOs. Only \"linux\" is reachable in v1.\nexport type SandboxOs = \"linux\" | \"macos\" | \"windows\";\n\n// Mirror of `@opengeni/contracts` SandboxCapabilityName.\nexport type SandboxCapabilityName =\n | \"FileSystem\"\n | \"Terminal\"\n | \"Git\"\n | \"DesktopStream\"\n | \"Recording\";\n\n// Mirror of `@opengeni/contracts` CapabilityUnavailableReason.\nexport type CapabilityUnavailableReason =\n | \"backend_unsupported\"\n | \"os_unsupported\"\n | \"not_provisioned\"\n | \"disabled_by_policy\"\n | \"lease_cold\"\n | \"tier_headless\"\n // selfhosted (bring-your-own-compute) negotiation states:\n | \"agent_offline\"\n | \"agent_reconnecting\"\n | \"consent_required\"\n | \"display_unavailable\";\n\n// Mirror of `@opengeni/contracts` SessionCapabilities (the negotiated handshake\n// document). The descriptor table itself is NOT mirrored — it lives in\n// contracts (P0.1) and is consumed by the SDK config in a later PR.\nexport type SessionCapabilities = {\n sessionId: string;\n backend: SandboxBackend;\n os: SandboxOs;\n liveness: \"cold\" | \"warming\" | \"warm\" | \"draining\";\n leaseEpoch: number;\n workspaceGeneration: number | null;\n archiveGeneration: number | null;\n archiveComplete: boolean;\n viewerHeartbeatIntervalMs: number;\n FileSystem: {\n available: boolean;\n readOnly: boolean;\n root: string;\n pathSep: \"/\" | \"\\\\\";\n treeMode: \"lazy\" | \"snapshot\";\n reason: CapabilityUnavailableReason | null;\n };\n Terminal: {\n transport: \"sse-events\" | \"pty-ws\" | \"relay-pty\" | null;\n ptyCapable: boolean;\n shell: string;\n url: string | null;\n token: string | null;\n expiresAt: string | null;\n reason: CapabilityUnavailableReason | null;\n };\n Git: {\n available: boolean;\n repos: string[];\n reason: CapabilityUnavailableReason | null;\n };\n DesktopStream: {\n // \"relay-frames\" + \"frames\": the selfhosted framebuffer stream — PNG-per-frame\n // protobuf datagrams over the relay, painted by a canvas client (NOT RFB).\n transport: \"vnc-ws\" | \"rdp-ws\" | \"webrtc\" | \"relay-frames\" | null;\n client: \"novnc\" | \"web-rdp\" | \"frames\" | null;\n mode: \"read-only\" | \"interactive\";\n url: string | null;\n token: string | null;\n expiresAt: string | null;\n resolution: [number, number];\n unredacted: boolean;\n requiresAcknowledgment: boolean;\n acknowledged: boolean;\n // Shared-exposure disclosure (addendum E.1): `shared` when the group has >1\n // session; `sharedSessionIds` lists the OTHER sessions' ids ONLY (never their\n // conversation/metadata).\n shared: boolean;\n sharedSessionIds: string[];\n reason: CapabilityUnavailableReason | null;\n };\n Recording: {\n available: boolean;\n modes: (\"manual\" | \"on-turn\" | \"on-verify\")[];\n codecs: (\"h264-mp4\" | \"vp9-webm\")[];\n reason: CapabilityUnavailableReason | null;\n };\n /** @deprecated Use the managed ComputerSession interaction tools. */\n ComputerUse: {\n available: boolean;\n readOnly: boolean;\n reason: CapabilityUnavailableReason | null;\n };\n negotiatedAt: string;\n};\n\n// Convenience aliases for the per-surface cells of `SessionCapabilities`, so the\n// client hooks/components can take a single cell without restating the inline\n// shape. These are exact structural views of the cells above.\nexport type FileSystemCapability = SessionCapabilities[\"FileSystem\"];\nexport type TerminalCapability = SessionCapabilities[\"Terminal\"];\nexport type GitCapability = SessionCapabilities[\"Git\"];\nexport type DesktopStreamCapability = SessionCapabilities[\"DesktopStream\"];\nexport type RecordingCapability = SessionCapabilities[\"Recording\"];\n/** @deprecated Use the managed ComputerSession interaction tools. */\nexport type ComputerUseCapability = SessionCapabilities[\"ComputerUse\"];\n\n// ── Stream-surfacing client surface (Phase 5) ───────────────────────────────\n// Mirrors of the contracts viewer-attach / acknowledge / heartbeat shapes that\n// the capability-gated client (`@opengeni/react`) drives. The desktop pixel\n// plane rides Channel B (direct-to-provider noVNC); the structured terminal/\n// files/git surfaces ride Channel A (the existing event spine + the synchronous\n// fs/git/terminal point queries above). These are TYPES only, so ordinary SDK\n// entries do not reach the contracts runtime; the contract-parity test pins them.\n\n// Mirror of `@opengeni/contracts` StreamUrlRotatedPayload — the Channel-A event\n// the client folds in to hot-swap its noVNC socket on a box rollover, fenced on\n// leaseEpoch.\nexport type StreamUrlRotatedPayload = {\n url: string;\n token: string | null;\n expiresAt: string | null;\n leaseEpoch: number;\n transport: \"vnc-ws\";\n viewerId: string | null;\n};\nexport type StreamOpenedPayload = {\n viewerId: string;\n shared: boolean;\n viewerCount: number;\n};\nexport type StreamClosedPayload = {\n viewerId: string;\n reason: \"client-disconnect\" | \"reaped\" | \"revoked\" | \"box-rollover\";\n viewerCount: number;\n};\nexport type StreamRevokedPayload = {\n viewerId: string | null;\n reason: \"grant-revoked\" | \"session-failed\" | \"admin\";\n};\n\n// Mirror of `@opengeni/contracts` AttachViewerRequest. Omitting `viewerId` mints\n// a fresh holder id (returned on the response, carried through heartbeat/detach).\n// Plane flags are exact: credentials are minted only for the requested live\n// surfaces and each surface enforces its own permission. An omitted plane set is\n// retained as the legacy terminal-only request; current clients send all flags.\nexport type AttachViewerRequest = {\n viewerId?: string | undefined;\n desktop?: boolean | undefined;\n terminal?: boolean | undefined;\n files?: boolean | undefined;\n};\n\n// Mirror of `@opengeni/contracts` ViewerHolder + the P4.2 desktop-stream fields\n// the POST /viewers handler folds in when the pixel plane is minted in-process.\nexport type ViewerHolder = {\n viewerId: string;\n sandboxGroupId: string;\n liveness: \"cold\" | \"warming\" | \"warm\" | \"draining\";\n leaseEpoch: number;\n workspaceGeneration: number | null;\n archiveGeneration: number | null;\n archiveComplete: boolean;\n viewerHeartbeatIntervalMs: number;\n dataPlaneUrl: string | null;\n};\nexport type AttachViewerResponse = ViewerHolder & {\n // The scoped desktop-stream address minted for THIS holder (P4.2). Null when\n // the deployment is headless / desktop is disabled / the mint degraded —\n // the client then falls back to the Channel-A surfaces only.\n streamToken: string | null;\n streamExpiresAt: string | null;\n resolution: [number, number] | null;\n transport: \"vnc-ws\" | \"relay-frames\" | null;\n client: \"novnc\" | \"frames\" | null;\n // The scoped ttyd PTY-over-websocket address minted for THIS holder — the REAL\n // interactive terminal, symmetric with the desktop pixel plane (same Modal\n // tunnel, same scoped stream token). Populated on a warm box; null when the\n // terminal mint degraded (headless / no secret / tunnel failure), in which case\n // the client falls back to the Channel-A read-only command-output firehose.\n // `terminalTransport` is \"pty-ws\" iff a live `terminalUrl` was minted.\n terminalUrl: string | null;\n terminalToken: string | null;\n terminalExpiresAt: string | null;\n terminalTransport: \"pty-ws\" | \"relay-pty\" | null;\n};\n\n// Mirror of `@opengeni/contracts` AcknowledgeStreamRequest/Response — the\n// un-redacted-pixel + shared-exposure consent gate (P3.2).\nexport type AcknowledgeStreamRequest = {\n acknowledgeUnredacted?: boolean | undefined;\n acknowledgeShared?: boolean | undefined;\n};\nexport type AcknowledgeStreamResponse = {\n acknowledged: boolean;\n acknowledgedShared: boolean;\n};\n\n// Mirror of `@opengeni/contracts` ViewerHeartbeatRequest/Response — the\n// Channel-A viewer-liveness ping, epoch-fenced (a stale-epoch beat → alive:false\n// → the client re-attaches).\nexport type ViewerHeartbeatRequest = { leaseEpoch: number };\nexport type ViewerHeartbeatResponse = { alive: boolean };\n\nexport type ReasoningEffort = \"none\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\nexport type LatencyMode = \"standard\" | \"priority\" | \"fast\" | \"ultrafast\";\nexport type GitCredentialProvider = \"github\" | \"gitlab\" | \"azure_devops\";\nexport type GitCredentialBindingId = string;\nexport type GitRepositoryAccess = \"read\" | \"write\";\n\nexport type RepositoryResourceRef = {\n kind: \"repository\";\n uri: string;\n ref: string;\n /** Exact immutable commit that repository materialization must produce. */\n expectedCommitSha?: string | undefined;\n /**\n * Optional workspace-relative override. When omitted, Opengeni persists\n * `repos/<encoded-host>/<owner>/<repo>` so equal names on different Git\n * providers do not collide. Explicit paths are portable, traversal-free, and\n * collision-checked case-insensitively before sandbox execution.\n */\n mountPath?: string | undefined;\n subpath?: string | undefined;\n provider?: GitCredentialProvider | undefined;\n connectionType?: \"github_personal\" | undefined;\n credentialBindingId?: GitCredentialBindingId | undefined;\n access?: GitRepositoryAccess | undefined;\n repositoryId?: number | string | undefined;\n installationId?: number | string | undefined;\n projectId?: number | string | undefined;\n connectionId?: string | undefined;\n githubInstallationId?: number | undefined;\n githubRepositoryId?: number | undefined;\n /**\n * Best-effort materialization: a failed clone logs a warning and the\n * session continues without this repository instead of failing sandbox\n * setup. Omit it to keep a failed clone fatal.\n */\n optional?: boolean | undefined;\n};\n\n/** Value mirror of `@opengeni/contracts`; parity-tested without importing it from ordinary SDK entries. */\nexport const DEFAULT_FILE_RESOURCE_MOUNT_ROOT = \".opengeni/files\" as const;\n\nexport type FileResourceRef = {\n kind: \"file\";\n fileId: string;\n /** Optional workspace-relative override; defaults to `.opengeni/files/<file-id>`. */\n mountPath?: string | undefined;\n};\n\nexport type ResourceRef = RepositoryResourceRef | FileResourceRef;\n\nexport type ToolRef = {\n kind: \"mcp\";\n id: string;\n /** Narrow this connection's authorized tool names; an empty list allows none. */\n allowedTools?: string[] | undefined;\n /** Skip this server when its connect/tools-list fails instead of failing the turn. */\n optional?: boolean | undefined;\n /**\n * Put tool schemas on the first model request instead of behind `tool_search`\n * progressive discovery: `true` for every tool of this server, or the exact\n * unprefixed names of its everyday tools (its other tools stay searchable).\n * A startup choice only; grants nothing, and names the server does not\n * authorize are ignored.\n */\n eager?: boolean | string[] | undefined;\n};\n\nexport type SessionToolPolicy = {\n mode: \"workspace_default\" | \"explicit\" | \"inherited\";\n inheritedFromSessionId: string | null;\n excludedMcpServerIds?: string[] | undefined;\n};\n\nexport type UpdateSessionToolPolicyRequest =\n | {\n mode: \"workspace_default\";\n excludedMcpServerIds?: string[] | undefined;\n expectedVersion: number;\n }\n | {\n mode: \"explicit\";\n tools: ToolRef[];\n firstPartyMcpTools: FirstPartyMcpToolName[];\n expectedVersion: number;\n };\n\n/**\n * The person finished setup from a capability card the agent posted in this\n * chat. The server wakes the agent once per card so it continues the request\n * that needed the capability. Name the capability from an agent's\n * recommendation card, or the connected account from that account's own card\n * (for example after allowing more access); the account continues only once\n * it is active and holds the access the card asked for.\n */\nexport type ContinueAfterCapabilitySetupRequest =\n | { capabilityId: string }\n | { connectionId: string };\n\n/** Why no continuation was sent. Each is a normal outcome, not an error. */\nexport type CapabilitySetupContinuationSkipReason =\n | \"no_card\"\n | \"later_message\"\n | \"not_ready\"\n | \"not_applicable\"\n | \"not_requester\"\n | \"session_closed\";\n\nexport type ContinueAfterCapabilitySetupResponse =\n | { outcome: \"queued\" | \"already_queued\"; updateId: string }\n | { outcome: \"not_needed\"; reason: CapabilitySetupContinuationSkipReason };\n\nexport type SessionEffectiveToolPolicy = {\n mode: SessionToolPolicy[\"mode\"];\n inheritedFromSessionId: string | null;\n selectedIds: string[];\n effectiveIds: string[];\n mandatoryIds: string[];\n lazyRouter: {\n state: \"required\" | \"disabled\";\n deferredIds: string[];\n };\n configuredIds: string[];\n droppedIds: string[];\n counts: {\n selected: number;\n effective: number;\n mandatory: number;\n deferred: number;\n configured: number;\n dropped: number;\n };\n idsTruncated: boolean;\n};\n\nexport type SessionGoalReportRequirement = { id: string; title: string };\nexport type SessionGoalReportDelivery = {\n requirementId: string;\n artifactId: string;\n inspectionReceiptId: string;\n};\n\nexport type GoalSpec = {\n text: string;\n successCriteria?: string | undefined;\n rootConstraints?: string[] | undefined;\n reportRequirements?: SessionGoalReportRequirement[] | undefined;\n maxAutoContinuations?: number | undefined;\n mutationPolicy?: SessionGoalMutationPolicy | undefined;\n};\n\nexport type SessionMcpServerInput = {\n id: string;\n name?: string | undefined;\n url: string;\n allowedTools?: string[] | undefined;\n /**\n * Tools the agent has from the first model request: `true` for every tool,\n * or exact unprefixed tool names (the rest stay searchable). Same as listing\n * this server in `tools` with `eager`, without turning an omitted `tools`\n * list into an explicit allow-list.\n */\n eager?: boolean | string[] | undefined;\n timeoutMs?: number | undefined;\n cacheToolsList?: boolean | undefined;\n /** Require human approval for every tool, or only the listed unprefixed tool names. */\n requireApproval?: boolean | string[] | undefined;\n headers?: Record<string, string> | undefined;\n connectionRef?: McpServerConnectionRef | undefined;\n};\n\nexport type SessionMcpCredentialUpdateInput = {\n id: string;\n headers: Record<string, string>;\n};\n\nexport type RotateSessionMcpCredentialsRequest = {\n operationKey: string;\n updates: Array<\n {\n id: string;\n expectedCredentialVersion: number;\n expectedServerUrl: string;\n } & (\n | { headers: Record<string, string> }\n | {\n nativeConnectionId: string;\n replacementServerUrl?: string | undefined;\n }\n )\n >;\n};\n\nexport type RotateSessionMcpCredentialsReceipt = {\n operationKey: string;\n sessionId: string;\n servers: Array<{ id: string; credentialVersion: number }>;\n appliedAt: string;\n};\n\nexport type SessionMcpApprovalPolicy = boolean | string[];\n\nexport type SessionMcpServerMetadata = {\n id: string;\n name: string | null;\n url: string;\n headerNames: string[];\n credentialVersion: number;\n requireApproval: SessionMcpApprovalPolicy;\n connectionRef: McpServerConnectionRef | null;\n};\n\nexport type UpdateSessionMcpApprovalPolicyRequest = {\n requireApproval: SessionMcpApprovalPolicy;\n};\n\nexport type UpdateSessionMcpApprovalPolicyResponse = {\n server: SessionMcpApprovalPolicyTarget;\n effectiveFrom: \"next_attempt\";\n};\n\nexport type SessionMcpApprovalPolicyTarget =\n | SessionMcpServerMetadata\n | {\n id: string;\n source: \"workspace\";\n requireApproval: SessionMcpApprovalPolicy;\n };\n\nexport type ConnectionKind = \"oauth2\" | \"api_key\" | \"app_install\" | \"delegated\";\nexport type ConnectionStatus = \"active\" | \"needs_reauth\" | \"revoked\" | \"error\";\n\nexport type UserResourceDelegation = {\n authorityId: string;\n grantId: string;\n organizationId: string;\n workspaceId: string;\n sessionId: string | null;\n action: string;\n mode: \"once\" | \"session\" | \"always\";\n context: \"user_private\" | \"workspace_shared\";\n authorityEpoch: number | null;\n authorityGeneration: number;\n grantGeneration: number;\n resourceVersionId?: string | null | undefined;\n};\n\nexport type McpConnectionAccountSelection = {\n serverId: string;\n connectionId: string;\n};\n\nexport type McpServerConnectionRef = {\n connectionId?: string | undefined;\n accountSelection?: \"all_eligible\" | undefined;\n authoritySource?: \"host\" | undefined;\n /** accepted_turn is configuration-only; each accepted owner must select a grant. */\n hostBinding?:\n | { bindingId: string; generation: number }\n | { selection: \"accepted_turn\" }\n | undefined;\n provider?: string | undefined;\n providerDomain: string;\n kind?: ConnectionKind | undefined;\n scopes?: string[] | undefined;\n resource?: string | undefined;\n selectedResources?:\n | Array<{\n id: string;\n kind: \"repository\";\n }>\n | undefined;\n subjectScope?: \"workspace\" | \"subject\" | undefined;\n};\n\nexport type McpPersonalConnectionDelegation = {\n serverId: string;\n connectionId: string;\n ownerSubjectId: string;\n providerDomain: string;\n kind?: ConnectionKind | undefined;\n};\n\nexport type McpPersonalConnectionSummary = Pick<\n McpPersonalConnectionDelegation,\n \"serverId\" | \"providerDomain\"\n>;\n\nexport type ConnectionMetadata = {\n id: string;\n authorityId?: string | undefined;\n accountId: string;\n workspaceId: string;\n subjectId: string | null;\n providerDomain: string;\n kind: ConnectionKind;\n status: ConnectionStatus;\n grantedScopes: string[];\n expiresAt: string | null;\n lastRefreshAt: string | null;\n lastUsedAt: string | null;\n lastError: string | null;\n version: number;\n verifiedInstallAt?: string | null;\n verifiedInstallVersion?: number | null;\n metadata: Record<string, unknown>;\n /**\n * Whether this OAuth MCP account can be told apart from another account of\n * the same service: `verified` (its account is known), `reconnect` (sign in\n * again once before adding another), or `single` (the service doesn't say\n * which account it is, so each person can connect one). Absent for other\n * connections and from older servers.\n */\n accountIdentity?: \"verified\" | \"reconnect\" | \"single\" | undefined;\n createdBySubjectId: string | null;\n updatedBySubjectId: string | null;\n createdAt: string;\n updatedAt: string;\n /**\n * Your own login only: whether it works for your messages in the workspace\n * this list was read from. It does in your Personal workspace and in each\n * shared workspace where it is turned on; it starts on where it was added.\n */\n turnedOnHere?: boolean | undefined;\n /**\n * The standing grant that turns your own login on here; revoke it with\n * `revokeUserResourceGrant` to stop using the login here. Null in your\n * Personal workspace, which needs none.\n */\n turnedOnHereGrantId?: string | null | undefined;\n};\n\n/** Where a brokered credential is written on each outbound provider request. */\nexport type ConnectionCredentialPlacement = {\n carrier: \"header\" | \"query\" | \"cookie\";\n name: string;\n value: string;\n /** Prepended to `value`, for example `\"Bearer \"` or `\"Token \"`. */\n prefix?: string | undefined;\n};\n\n/**\n * Write-only secret for a brokered `api_key` Connection (API Integrations and\n * MCP servers). The broker never infers a location: use exact `headers`, or\n * `placements` when the provider expects a query parameter or cookie (API\n * Integrations only) or a prefixed value. Match the carrier/name reported by\n * `previewApiIntegration().auth`. A bare `{ apiKey }` is rejected with 422.\n *\n * @example { headers: { Authorization: \"Token abc123\" } }\n * @example { placements: [{ carrier: \"header\", name: \"X-Api-Key\", value: \"abc123\" }] }\n */\nexport type ApiKeyConnectionCredential =\n | { headers: Record<string, string>; placements?: never }\n | { placements: ConnectionCredentialPlacement[]; headers?: never };\n\ntype CreateConnectionRequestBase = {\n providerDomain: string;\n ownership?: ConnectionOwnership | undefined;\n /** @deprecated use ownership */\n subjectId?: string | null | undefined;\n grantedScopes?: string[] | undefined;\n expiresAt?: string | null | undefined;\n operationId?: string | undefined;\n /** Direct OpenAI/Azure keys only: verify the provider/model before saving. */\n verifyModelAccess?: boolean | undefined;\n};\n\nexport type CreateConnectionRequest = CreateConnectionRequestBase &\n (\n | {\n kind: \"api_key\";\n credential: ApiKeyConnectionCredential;\n metadata?: Record<string, unknown> | undefined;\n }\n | {\n /**\n * Workspace model-provider key lane (Vercel AI Gateway / OpenRouter),\n * selected by `metadata.credentialRole`; not usable by integrations.\n */\n kind: \"api_key\";\n credential: { apiKey: string };\n metadata: { credentialRole: string } & Record<string, unknown>;\n }\n | {\n kind: Exclude<ConnectionKind, \"api_key\">;\n credential: Record<string, unknown>;\n metadata?: Record<string, unknown> | undefined;\n }\n );\n\nexport type PersonalGitHubConnectionMetadata = {\n credentialRole: \"opengeni_github_personal\";\n providerFamily: \"github\";\n providerPrincipalId: string;\n githubUserId: string;\n githubLogin: string;\n oauthEnvironment: string;\n oauthClientMarker: string;\n credentialBindingId: string;\n connectedAt: string;\n lastVerifiedAt: string;\n refreshTokenExpiresAt?: string | null | undefined;\n disconnectedAt?: string | null | undefined;\n [key: string]: unknown;\n};\n\nexport type PersonalGitHubOAuthStartRequest = {\n connectionId?: string | undefined;\n returnPath?: string | undefined;\n};\n\nexport type PersonalGitHubOAuthStartResponse = {\n authorizationUrl: string;\n expiresAt: string;\n};\n\nexport type PersonalGitHubConnectionStatusResponse = {\n enabled: boolean;\n connection: ConnectionMetadata | null;\n reviewUrl: string | null;\n};\n\nexport type PersonalGitHubDisconnectRequest = {\n expectedVersion: number;\n idempotencyKey: string;\n};\n\nexport type PersonalGitHubRepositoryAccess = \"read\" | \"write\";\n\nexport type PersonalGitHubRepositoryPermissions = {\n pull: boolean;\n push: boolean;\n admin: boolean;\n maintain: boolean;\n triage: boolean;\n};\n\nexport type PersonalGitHubRepository = {\n repositoryId: string;\n fullName: string;\n canonicalUrl: string;\n defaultBranch: string;\n visibility: \"public\" | \"private\" | \"internal\";\n private: boolean;\n archived: boolean;\n disabled: boolean;\n permissions: PersonalGitHubRepositoryPermissions;\n};\n\nexport type PersonalGitHubSelectedRepository = PersonalGitHubRepository & {\n selectedAccess: PersonalGitHubRepositoryAccess;\n selectionGeneration: number;\n selectedAt: string;\n lastVerifiedAt: string;\n};\n\nexport type PersonalGitHubRepositorySelectionState = {\n connectionAuthorityGeneration: number;\n credentialBindingId: string;\n providerPrincipalId: string;\n selectionGeneration: number;\n repositories: PersonalGitHubSelectedRepository[];\n};\n\nexport type PersonalGitHubRepositoryCatalogItem = PersonalGitHubRepository & {\n selectedAccess: PersonalGitHubRepositoryAccess | null;\n};\n\nexport type ListPersonalGitHubRepositoriesOptions = {\n cursor?: number | undefined;\n limit?: number | undefined;\n};\n\nexport type ListPersonalGitHubRepositoriesResponse = {\n repositories: PersonalGitHubRepositoryCatalogItem[];\n nextCursor: number | null;\n selection: PersonalGitHubRepositorySelectionState;\n};\n\nexport type PersonalGitHubRepositorySelectionInput = {\n repositoryId: string;\n fullName: string;\n access: PersonalGitHubRepositoryAccess;\n};\n\nexport type ReplacePersonalGitHubRepositorySelectionsRequest = {\n expectedConnectionAuthorityGeneration: number;\n expectedSelectionGeneration: number;\n idempotencyKey: string;\n repositories: PersonalGitHubRepositorySelectionInput[];\n};\n\nexport type VerifyPersonalGitHubRepositorySelectionsRequest = {\n expectedConnectionAuthorityGeneration: number;\n expectedSelectionGeneration: number;\n idempotencyKey: string;\n};\n\nexport type OpenGeniSlackBotInstallRequest = {\n /** Existing Opengeni Slack bot connection to reinstall in place. */\n connectionId?: string | undefined;\n};\n\nexport type AvailableOpenGeniSlackBots = {\n connections: ConnectionMetadata[];\n organizationSharedConnectionIds: string[];\n};\nexport type UpdateOpenGeniSlackBotOrganizationAccess = {\n enabled: boolean;\n workspaceIds?: string[] | null;\n};\nexport type OpenGeniSlackBotOrganizationAccess = {\n enabled: boolean;\n generation: number;\n workspaceIds?: string[] | null;\n};\n\nexport type FikenInstallRequest = {\n apiToken: string;\n defaultCompanySlug?: string | undefined;\n /** Existing Fiken connection to rewrite in place (reconnect). */\n connectionId?: string | undefined;\n};\n\nexport type FikenOAuthStartRequest = {\n returnPath?: string | undefined;\n /** Existing Fiken connection to re-authorize in place (reconnect). */\n connectionId?: string | undefined;\n};\n\nexport type FikenOAuthStartResponse = {\n authorizationUrl: string;\n expiresAt: string;\n};\n\nexport type OpenGeniSlackBotInstallStart = {\n authorizationUrl: string;\n expiresAt: string;\n};\n\nexport type SlackInstallationBindingState = \"active\" | \"quarantined\";\n\nexport type SlackInstallationBinding = {\n id: string;\n accountId: string;\n accountName: string;\n workspaceId: string;\n workspaceName: string;\n connectionId: string;\n connectionStatus: ConnectionStatus;\n connectionVersion: number;\n slackTeamId: string;\n slackTeamName: string;\n botId: string;\n botUserId: string;\n botDisplayName: \"Opengeni\" | \"Opengeni Staging\" | \"OpenGeni\" | \"OpenGeni Staging\";\n state: SlackInstallationBindingState;\n quarantineReason: string | null;\n version: number;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type ListSlackInstallationBindingsResponse = {\n bindings: SlackInstallationBinding[];\n};\n\nexport type GoogleDriveTargetScope = \"user\" | \"workspace\" | \"organization\";\nexport type ConnectorDocumentDestinationAuthority = \"organization\" | \"workspace\" | \"personal\";\nexport type ConnectorDocumentDestinationSelection = {\n authorityKind: ConnectorDocumentDestinationAuthority;\n collectionId: string | null;\n};\nexport type ConnectorDocumentDestination = ConnectorDocumentDestinationSelection & {\n authorityAccountId: string;\n authorityWorkspaceId: string | null;\n authoritySubjectId: string | null;\n};\nexport type GoogleDriveSyncCadence = \"manual\" | \"hourly\" | \"daily\";\nexport type GoogleDriveReadPolicy = \"allow\" | \"ask\" | \"block\";\nexport type GoogleDriveConnectionLifecycleState =\n | \"active\"\n | \"paused\"\n | \"token_revoked\"\n | \"app_removed\"\n | \"disconnected\"\n | \"reconnect_required\"\n | \"reconsent_required\";\n\nexport type GoogleDriveConnectionLifecycle =\n | {\n state: Exclude<GoogleDriveConnectionLifecycleState, \"app_removed\">;\n recoverable: true;\n observedAt: string;\n }\n | { state: \"app_removed\"; recoverable: false; observedAt: string };\n\nexport type GoogleDriveSelectedSource = {\n id: string;\n name: string;\n mimeType: string;\n driveId: string | null;\n destination?: ConnectorDocumentDestination | undefined;\n /** @deprecated Missing destinations resolve to the current workspace boundary. */\n targetScope?: GoogleDriveTargetScope | undefined;\n syncCadence: GoogleDriveSyncCadence;\n syncEnabled: boolean;\n configGeneration: number;\n readPolicy: GoogleDriveReadPolicy;\n selectedAt: string;\n};\n\nexport type GoogleDriveConnectionMetadata = {\n credentialRole: \"google_drive_metadata\";\n credentialLabel: \"Google Drive read-only source sync\" | \"Google Drive metadata browser\";\n googlePermissionId: string;\n googleEmail: string;\n googleDisplayName: string | null;\n verifiedAt: string;\n accessMode: \"file_only\" | \"metadata_readonly\" | \"readonly\";\n lifecycle?: GoogleDriveConnectionLifecycle | undefined;\n outputDestination?: GoogleDriveOutputDestination | undefined;\n documentDestination?: ConnectorDocumentDestination | undefined;\n selectedSources?: GoogleDriveSelectedSource[] | undefined;\n /** @deprecated Read selectedSources; retained while existing connections migrate. */\n selectedSource?: GoogleDriveSelectedSource | null | undefined;\n [key: string]: unknown;\n};\n\nexport type GoogleDriveOutputDestination = {\n folderId: string;\n folderName: string;\n driveId: string | null;\n location: \"my_drive\" | \"shared_drive\";\n selectedAt: string;\n};\n\nexport type GoogleDriveOAuthStartRequest = {\n connectionId?: string | undefined;\n capability?: \"source_read\" | \"publish\" | undefined;\n};\n\nexport type GoogleDriveOAuthStartResponse = {\n authorizationUrl: string;\n expiresAt: string;\n};\n\nexport type GoogleDriveLifecycleActionRequest = {\n action: \"pause\" | \"resume\";\n expectedVersion: number;\n};\n\nexport type GoogleDriveDisconnectRequest = {\n expectedVersion: number;\n idempotencyKey: string;\n};\n\nexport type GoogleDriveBrowseItem = {\n id: string;\n name: string;\n mimeType: string;\n kind: \"folder\" | \"file\";\n driveId: string | null;\n modifiedTime: string | null;\n size: string | null;\n webViewLink: string | null;\n};\n\nexport type GoogleDriveBrowseResponse = {\n connection: ConnectionMetadata;\n parentId: string;\n current: GoogleDriveBrowseItem | null;\n items: GoogleDriveBrowseItem[];\n nextPageToken: string | null;\n incompleteSearch: boolean;\n};\n\nexport type AtlassianSourceKind = \"jira_project\" | \"confluence_space\";\nexport type AtlassianSyncCadence = \"manual\" | \"hourly\" | \"daily\";\nexport type AtlassianReadPolicy = \"allow\" | \"ask\" | \"block\";\nexport type AtlassianConnectionLifecycle = {\n state:\n | \"active\"\n | \"paused\"\n | \"token_revoked\"\n | \"app_removed\"\n | \"disconnected\"\n | \"reconnect_required\"\n | \"reconsent_required\";\n recoverable: boolean;\n observedAt: string;\n};\nexport type AtlassianSelectedSource = {\n id: string;\n cloudId: string;\n siteName: string;\n siteUrl: string;\n resourceId: string;\n key: string;\n name: string;\n kind: AtlassianSourceKind;\n destination?: ConnectorDocumentDestination | undefined;\n syncCadence: AtlassianSyncCadence;\n syncEnabled: boolean;\n configGeneration: number;\n readPolicy: AtlassianReadPolicy;\n selectedAt: string;\n};\nexport type AtlassianConnectionMetadata = {\n credentialRole: \"atlassian_knowledge\";\n credentialLabel: \"Atlassian read-only knowledge sync\";\n atlassianAccountId: string;\n displayName: string;\n email?: string | null | undefined;\n sites: Array<{\n cloudId: string;\n name: string;\n url: string;\n products: Array<\"jira\" | \"confluence\">;\n }>;\n verifiedAt: string;\n accessMode: \"readonly\";\n lifecycle?: AtlassianConnectionLifecycle | undefined;\n documentDestination?: ConnectorDocumentDestination | undefined;\n selectedSources: AtlassianSelectedSource[];\n [key: string]: unknown;\n};\nexport type AtlassianOAuthStartResponse = {\n authorizationUrl: string;\n expiresAt: string;\n};\nexport type AtlassianLifecycleActionRequest = {\n action: \"pause\" | \"resume\";\n expectedVersion: number;\n};\nexport type AtlassianDisconnectRequest = {\n expectedVersion: number;\n idempotencyKey: string;\n};\nexport type AtlassianBrowseItem = {\n id: string;\n cloudId: string;\n siteName: string;\n siteUrl: string;\n resourceId: string;\n key: string;\n name: string;\n kind: AtlassianSourceKind;\n description: string | null;\n webUrl: string;\n};\nexport type AtlassianBrowseResponse = {\n connection: ConnectionMetadata;\n items: AtlassianBrowseItem[];\n};\n\nexport type SaveGoogleDriveSourceRequest = {\n sources: Array<Pick<GoogleDriveBrowseItem, \"id\" | \"name\" | \"mimeType\" | \"driveId\">>;\n destination?: ConnectorDocumentDestinationSelection | undefined;\n /** @deprecated Legacy requests resolve to workspace authority. */\n targetScope?: GoogleDriveTargetScope | undefined;\n syncCadence: GoogleDriveSyncCadence;\n syncEnabled: boolean;\n readPolicy: GoogleDriveReadPolicy;\n};\n\nexport type GoogleDriveKnowledgeSourceItem = {\n id: string;\n name: string;\n mimeType: string;\n driveId?: string | undefined;\n sourceKind: \"my_drive\" | \"shared_drive\" | \"folder\";\n includeDescendants: boolean;\n};\n\nexport type GoogleDriveKnowledgeSourceDestination = {\n authorityKind: ConnectorDocumentDestinationAuthority;\n authorityAccountId: string;\n authorityWorkspaceId?: string | undefined;\n authoritySubjectId?: string | undefined;\n collectionId?: string | undefined;\n};\n\nexport type GoogleDriveKnowledgeSourceConfig = {\n sources: GoogleDriveKnowledgeSourceItem[];\n destination: GoogleDriveKnowledgeSourceDestination;\n syncCadence: GoogleDriveSyncCadence;\n readPolicy: GoogleDriveReadPolicy;\n};\n\nexport type SaveGoogleDriveIntegrationSourceRequest = SaveGoogleDriveSourceRequest & {\n expectedVersion?: number | undefined;\n idempotencyKey: string;\n};\n\nexport type UpdateConnectionRequest = {\n providerDomain?: string | undefined;\n subjectId?: string | null | undefined;\n kind?: ConnectionKind | undefined;\n status?: ConnectionStatus | undefined;\n credential?: Record<string, unknown> | undefined;\n grantedScopes?: string[] | undefined;\n expiresAt?: string | null | undefined;\n metadata?: Record<string, unknown> | undefined;\n expectedVersion?: number | undefined;\n operationId?: string | undefined;\n};\n\nexport type ConnectionResponse = {\n connection: ConnectionMetadata;\n};\n\nexport type ListConnectionsResponse = {\n connections: ConnectionMetadata[];\n};\n\nexport type ConnectionOwnership = \"workspace\" | \"personal\";\n\nexport type OAuthStartRequest = {\n providerDomain?: string | undefined;\n mcpUrl?: string | undefined;\n resource?: string | undefined;\n requestedScopes?: string[] | undefined;\n returnPath?: string | undefined;\n /** Exact trusted-host destination; requires verified external-user mode. */\n returnUrl?: string | undefined;\n connectionId?: string | undefined;\n /** Sign in a further account instead of refreshing your existing active one.\n * Never combined with connectionId. */\n newAccount?: true | undefined;\n ownership?: ConnectionOwnership | undefined;\n oauthClient?:\n | {\n clientId: string;\n clientSecret?: string | undefined;\n tokenEndpointAuthMethod?: \"none\" | \"client_secret_post\" | \"client_secret_basic\" | undefined;\n }\n | undefined;\n};\n\nexport type OAuthStartResponse = {\n state: string;\n authorizationUrl: string | null;\n expiresAt: string;\n};\n\nexport type SocialProvider =\n | \"x\"\n | \"reddit\"\n | \"linkedin\"\n | \"instagram\"\n | \"facebook\"\n | \"tiktok\"\n | \"youtube\"\n | \"custom\";\n\nexport type SocialConnectionStatus = \"connected\" | \"needs_reauth\" | \"disabled\";\n\nexport type SocialConnection = {\n id: string;\n accountId: string;\n workspaceId: string;\n provider: SocialProvider;\n accountHandle: string;\n accountName: string | null;\n externalAccountId: string | null;\n ownership: \"workspace\" | \"personal\";\n status: SocialConnectionStatus;\n scopes: string[];\n credentialRef: string | null;\n tokenMetadata: Record<string, unknown>;\n metadata: Record<string, unknown>;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type SocialOAuthStartRequest = {\n provider: \"x\" | \"reddit\";\n ownership?: \"workspace\" | \"personal\" | undefined;\n scopes?: string[] | undefined;\n returnPath?: string | undefined;\n};\n\n/** The immutable principal whose authority accepted a session or turn. */\nexport type TurnInitiator = {\n kind: \"subject\" | \"service\";\n subjectId: string;\n /** Display-only snapshot; never an authorization input. */\n label?: string | undefined;\n};\n\n/** A trusted embedding host's causal machine/service principal. */\nexport type ServiceTurnInitiator = TurnInitiator & { kind: \"service\" };\n\nexport type TurnInitiatorContext = Record<string, unknown>;\n\n/** Bounded host provenance; Opengeni-owned lineage keys are reserved. */\nexport type ServiceTurnInitiatorContext = TurnInitiatorContext;\n\nexport type IntegrationClientMetadata = {\n client_id: string;\n client_name: \"Opengeni\" | \"OpenGeni\";\n redirect_uris: string[];\n token_endpoint_auth_method: \"none\";\n grant_types: Array<\"authorization_code\" | \"refresh_token\">;\n response_types: [\"code\"];\n};\n\nexport type SessionVisibility = \"private\" | \"workspace\";\n\nexport type SessionTenancyCreateCapabilities = {\n activated: boolean;\n canCreatePrivate: boolean;\n reason: \"available\" | \"not_activated\" | \"managed_session_required\" | \"unavailable\";\n /**\n * Who sees a new chat or schedule unless the person picks otherwise. Absent\n * from older servers, which means \"workspace\".\n */\n defaultVisibility?: SessionVisibility;\n};\n\nexport type SessionTenancyPublicProjection = {\n visibility: SessionVisibility;\n authorityEpoch: number;\n ownedByCurrentUser: boolean;\n fork: {\n sourceVisibility: SessionVisibility;\n sourceAuthorityEpoch: number;\n forkedAt: string;\n } | null;\n};\n\nexport type UpdateSessionVisibilityRequest = {\n visibility: SessionVisibility;\n expectedAuthorityEpoch: number;\n idempotencyKey: string;\n /**\n * \"Make private anyway\": stop the chat's work in progress (the running or\n * parked response, queued messages, an active goal) as part of the change.\n * Without it such work refuses the change with reason `active_work`.\n */\n stopActiveWork?: boolean;\n};\n\n/** What still refuses a visibility change after the chat's own work stops. */\nexport type SessionTenancyBlocker =\n | \"nonterminal_turn\"\n | \"nonterminal_attempt\"\n | \"unsettled_interruption\"\n | \"pending_system_update\"\n | \"pending_human_input\"\n | \"pending_tool_receipt\"\n | \"run_state\"\n | \"active_goal\"\n | \"capacity_waiter\"\n | \"active_realtime\"\n | \"active_scheduled_task\"\n | \"workspace_mutation_admission\"\n | \"retained_process\"\n | \"active_sandbox_access\"\n | \"shared_sandbox_group\";\n\n/**\n * What a change to Only me stops or removes when `stopActiveWork` is sent:\n * the chat's visible work and anything that carries another person's access.\n */\nexport type SessionVisibilityWork = {\n runningTurnCount: number;\n queuedTurnCount: number;\n activeGoal: boolean;\n /** A voice session is live in the chat. */\n liveVoice: boolean;\n /** Pending updates that carry another person's access. */\n otherPeoplePendingUpdateCount: number;\n /** Account choices for the chat that only another person may use. */\n otherPeopleAccountChoiceCount: number;\n};\n\nexport type SessionVisibilityChangePreview = {\n visibility: SessionVisibility;\n targetVisibility: SessionVisibility;\n authorityEpoch: number;\n /** Nothing else refuses the change; an empty value means it just happens. */\n work: SessionVisibilityWork;\n /** @deprecated Always `null`: nothing refuses a change to Only me any more. */\n blocker: SessionTenancyBlocker | null;\n};\n\nexport type UpdateSessionVisibilityResponse = {\n operationId: string;\n eventId: string | null;\n eventSequence: number | null;\n visibility: SessionVisibility;\n authorityEpoch: number;\n changed: boolean;\n replay: boolean;\n revokedGrantCount: number;\n};\n\n/** One message a share link shows: the person's or the reply, as text. */\nexport type SharedSessionMessage = {\n role: \"user\" | \"assistant\";\n text: string;\n /**\n * The name the chat shows for the person who sent a message, never an\n * email address or id. Absent for replies, and when the chat has no such\n * name for them.\n */\n sender?: string;\n};\n\n/** A chat's live read-only share link, as its owner sees it. */\nexport type SessionShareLink = {\n shareId: string;\n /** The page anyone with the link opens. */\n url: string;\n workspaceId: string;\n sessionId: string;\n title: string;\n /** Messages the link shows. */\n messageCount: number;\n createdAt: string;\n /** When the snapshot behind the link was last taken. */\n updatedAt: string;\n};\n\n/** Whether the person can share a chat here, and their live link. */\nexport type SessionShareLinkState = {\n /** False when this deployment has turned share links off. */\n enabled: boolean;\n link: SessionShareLink | null;\n};\n\nexport type SessionShareLinkList = {\n links: SessionShareLink[];\n};\n\n/** What anyone holding a share link reads, without signing in. */\nexport type SharedSession = {\n title: string;\n /** When the snapshot was taken. */\n sharedAt: string;\n messages: SharedSessionMessage[];\n /** Earlier messages left out to keep the snapshot within its size. */\n omittedMessageCount: number;\n};\n\nexport type ForkSessionRequest = {\n idempotencyKey: string;\n visibility: SessionVisibility;\n workspaceSharedAcknowledged: boolean;\n rigId?: string | null | undefined;\n};\n\nexport type ForkSessionResponse = {\n operationId: string;\n eventId: string;\n eventSequence: number;\n sessionId: string;\n workspaceId: string;\n visibility: SessionVisibility;\n authorityEpoch: 1;\n copiedHistoryItemCount: number;\n replay: boolean;\n};\n\nexport type SessionBackgroundCommandActivity = {\n unavailableCount?: number | undefined;\n state: \"running\" | \"stopping\";\n count: number;\n};\n\n/** Stored reconciliation checkpoints, not a live provider probe or native ACK. */\nexport type SessionBackgroundCommandReconciliation = {\n lastOutcome: string | null;\n attempts: number;\n dueAt: string;\n claimedAt: string | null;\n terminalProof:\n | { outcome: \"exited\"; exitCode: number; observedAt: string }\n | { outcome: \"lost\"; exitCode: null; observedAt: string }\n | null;\n};\n\nexport type SessionBackgroundCommand = {\n observationStatus?: \"unavailable\" | undefined;\n reconciliation?: SessionBackgroundCommandReconciliation | undefined;\n id: string;\n workspaceId: string;\n sessionId: string;\n provider: \"managed\" | \"connected_machine\";\n state: \"running\" | \"stopping\" | \"exited\" | \"lost\";\n commandPreview: string;\n commandText?: string | undefined;\n cancelRequestedAt: string | null;\n exitCode: number | null;\n settlementReason: string | null;\n startedAt: string;\n settledAt: string | null;\n updatedAt: string;\n};\n\nexport type SessionBackgroundCommandListResponse = {\n commands: SessionBackgroundCommand[];\n};\n\nexport type WorkspaceBackgroundCommand = SessionBackgroundCommand & {\n sessionTitle: string | null;\n machineName: string | null;\n};\n\nexport type WorkspaceBackgroundCommandListResponse = {\n commands: WorkspaceBackgroundCommand[];\n nextCursor: string | null;\n};\n\nexport type CancelSessionBackgroundCommandResult = {\n command: SessionBackgroundCommand;\n accepted: boolean;\n};\n\n/** Why the runtime refused to start a session's next turn. */\nexport type SessionAdmissionBlock = {\n reason:\n | \"database_claim_rejected\"\n | \"initiator_membership_required\"\n | \"personal_resource_grant_required\";\n sqlState: string | null;\n retryPolicy: \"explicit_recheck\";\n blockedAt: string;\n};\n\nexport type Session = {\n /** Detail-only dispatch evidence; delivery does not prove turn execution. */\n dispatchWait?:\n | {\n state: \"pending\" | \"acknowledged\" | \"unavailable\";\n attempts: number;\n nextAttemptAt: string | null;\n lastError: string | null;\n }\n | null\n | undefined;\n /** Detail-only failure evidence through lastSequence; independent of timeline paging. */\n failureDiagnostics?:\n | {\n eventId: string;\n sequence: number;\n turnId: string | null;\n occurredAt: string;\n payload: unknown;\n }\n | null\n | undefined;\n bundledSkillIds?: BundledSkillId[] | undefined;\n id: string;\n workspaceId: string;\n accountId: string;\n status: SessionStatus;\n backgroundCommandActivity?: SessionBackgroundCommandActivity | undefined;\n hasSchedules?: boolean | undefined;\n /** An active schedule targeting this session can still start a run. */\n hasUpcomingSchedules?: boolean | undefined;\n /** An active automation targeting this session will run when one of its events arrives. */\n waitingForEvents?: boolean | undefined;\n /**\n * What the automations the reader can see are waiting for before they\n * continue this session: the next scheduled run and the first event. Null\n * when none of them can start a run.\n */\n automationWait?: SessionAutomationWaitSummary | null | undefined;\n initialMessage: string;\n title: string | null;\n titleSource: \"user\" | \"agent\" | null;\n /** Display-only one-line description of what this chat is for. Never sent to the model. */\n description?: string | null | undefined;\n /** Display-only avatar. Never sent to the model. */\n avatar?: SessionAvatar | null | undefined;\n // Per-session agent persona/system instructions supplied at create; null when\n // the session carried none. Org-visible metadata, never a timeline event.\n instructions: string | null;\n /** Immutable normalized prompt-policy role; distinct from membership roles. */\n policyRole: string | null;\n resources: ResourceRef[];\n /**\n * Repositories a person removed from this chat, newest per repository. The\n * agent can't attach one again; a person attaching it again ends its record.\n */\n removedRepositories?: SessionRemovedRepository[] | undefined;\n skills: SessionSkill[];\n tools: ToolRef[];\n toolPolicy: SessionToolPolicy;\n toolPolicyVersion: number;\n effectiveToolPolicy?: SessionEffectiveToolPolicy | undefined;\n metadata: Record<string, unknown>;\n /** Present only when session-tenancy product activation is enabled for the organization. */\n tenancy?: SessionTenancyPublicProjection | undefined;\n /** Frozen creator fact; later turns carry their own independent initiator. */\n createdBy: TurnInitiator;\n createdByContext: Record<string, unknown>;\n model: string;\n reasoningEffort: ReasoningEffort;\n latencyMode: LatencyMode;\n sandboxBackend: SandboxBackend;\n sandboxOs: SandboxOs;\n sandboxGroupId: string;\n activeSandboxId: string | null;\n activeEpoch: number;\n /** Explicit connected-machine project root; null uses the agent launch root. */\n workingDir: string | null;\n // The rig + frozen rig version this session rides (M3). Both null for a\n // rig-less session. Frozen at create; a later rig promote never moves them.\n rigId: string | null;\n rigVersionId: string | null;\n /** Workspace channel the session is filed under; null = unfiled (inbox). */\n channelId: string | null;\n firstPartyMcpPermissions: string[] | null;\n firstPartyMcpTools: FirstPartyMcpToolName[];\n /**\n * Frozen agent configuration; null for sessions created without one (legacy\n * behavior). Omitted by older servers.\n */\n agent?: ResolvedAgentConfig | null | undefined;\n /** Capability-level view of what a configured session can use; null for legacy. */\n effectiveTools?: AgentEffectiveTools | null | undefined;\n mcpServers: SessionMcpServerMetadata[];\n mcpApprovalPolicies?: Record<string, SessionMcpApprovalPolicy> | undefined;\n parentSessionId: string | null;\n /** Immutable server-authored nested-agent lineage and policy snapshot. */\n rootSessionId: string;\n /**\n * The task root's usage limit and recorded API-equivalent model usage, on\n * detail reads and create responses. Omitted by older servers and list\n * reads: omission never means \"no limit\".\n */\n usageLimit?: SessionUsageLimit | undefined;\n nestedAgentDepth: number;\n maxNestedAgentDepthOverride: number | null;\n effectiveMaxNestedAgentDepth: number;\n nestedAgentDepthPolicySource: \"session\" | \"workspace\" | \"deployment\" | \"default\";\n nestedAgentDepthPolicySessionId: string | null;\n createIdempotencyKey: string | null;\n temporalWorkflowId: string | null;\n activeTurnId: string | null;\n queueVersion: number;\n queueHeadPosition: number;\n queueTailPosition: number;\n effectiveControl: EffectiveSessionControl;\n /** Current durable input wait; an elapsed deadline does not prove a new turn started. */\n inputWait?: { deadlineAt: string; reason: string } | null | undefined;\n lastSequence: number;\n /** Multi-account Codex (P1): the account this session is pinned to (null ⇒ follow workspace active). */\n codexPinnedCredentialId?: string | null;\n /** Multi-account Codex (P1): the account the most recent turn ran on (the \"Running on:\" indicator). */\n codexLastCredentialId?: string | null;\n /** Accepted current-turn account, separate from future session preferences. */\n codexCurrentSelection?: { credentialId: string | null; waiting: boolean } | null | undefined;\n /**\n * Frozen at create. `remote_v2` ⇒ Codex remote compaction + Codex-only model\n * admission; `portable` ⇒ plaintext compaction and free provider switching.\n */\n codexCompactionMode: \"remote_v2\" | \"portable\";\n /**\n * The `code_search` decision frozen at create. A turn gets the tool only when\n * this is true, the deployment still offers it, the workspace is not Off, and\n * the turn has POSIX compute.\n */\n codeSearchEnabled?: boolean;\n /** Personal (authenticated subject) workspace pin state, never workspace-global. */\n pinned?: boolean;\n /** Stable pin ordering key; null when this subject has not pinned the session. */\n pinnedAt?: string | null;\n /** Optimistic pin-state revision; zero represents an absent pin relation. */\n pinVersion?: number;\n /** Personal explicit acknowledgment state. */\n unread?: boolean;\n /** Personal actively-working label. */\n activelyWorking?: boolean;\n /** Optimistic unread/actively-working revision. */\n attentionVersion?: number;\n /** Personal archive state. */\n archived?: boolean;\n archivedAt?: string | null;\n /**\n * Read-only imported timeline, independent of personal archive/restore state.\n * Never model-facing conversation history.\n */\n importedArchive?: { importId: string; importedAt: string; readOnly: true } | undefined;\n /**\n * Idle-session archive state and keep-live exemption, workspace-wide and\n * independent of the personal `archived` flag. Absent on older servers.\n */\n retention?: SessionRetention | undefined;\n /**\n * Whether the next turns run unattended: no person will see or answer a\n * question until the task ends. Absent on older servers (attended).\n */\n unattended?: boolean | undefined;\n /** Optimistic archive-state revision. */\n archiveVersion?: number;\n /** Server-authoritative descendant counts populated by session-list reads. */\n treeStats?:\n | {\n directChildren: number;\n totalDescendants: number;\n runningDescendants: number;\n queuedDescendants: number;\n waitingDescendants?: number | undefined;\n attentionDescendants: number;\n pausedDescendants: number;\n failedDescendants: number;\n unreadDescendants?: number | undefined;\n unreadFailedDescendants?: number | undefined;\n activelyWorkingDescendants?: number | undefined;\n /**\n * Earliest moment one of the counted `attentionDescendants` entered\n * `requires_action`; null when none is waiting, absent on older servers.\n */\n attentionSince?: string | null | undefined;\n /** Counts are lower bounds rather than exact totals when true. */\n truncated: boolean;\n }\n | undefined;\n /**\n * When this session's own open turn entered `requires_action`. Populated by\n * list and lineage reads for `requires_action` sessions; null otherwise.\n */\n requiresActionSince?: string | null | undefined;\n /**\n * Set while the runtime refuses to start this session's next turn (status\n * `requires_action`, but nothing is asked of a person). Accepted work is\n * kept; Resume or a new Send/Steer rechecks admission. Absent on older servers.\n */\n admissionBlock?: SessionAdmissionBlock | null | undefined;\n /** Agent access scope; absent on servers before the agent-access release. */\n agentAccess?: SessionAgentAccess | undefined;\n /** Opaque end-user label; null when the session carries none. */\n scopeSubjectId?: SessionScopeSubjectId | null | undefined;\n /** Memory scope; absent on servers before the agent-access release. */\n memoryScope?: SessionMemoryScope | undefined;\n createdAt: string;\n updatedAt: string;\n};\n\n/** Additive receipt returned by POST /sessions. */\nexport type CreateSessionResponse = Session & {\n initialTurnId: string | null;\n};\n\nexport type SessionSummary = Session;\n\n/**\n * Compact list-only record, excluding prompts and execution configuration\n * other than the model and reasoning effort shown with a row.\n */\nexport type SessionListEntry = Pick<\n Session,\n | \"id\"\n | \"workspaceId\"\n | \"accountId\"\n | \"status\"\n | \"activeTurnId\"\n | \"backgroundCommandActivity\"\n | \"hasSchedules\"\n | \"hasUpcomingSchedules\"\n | \"waitingForEvents\"\n | \"automationWait\"\n | \"title\"\n | \"titleSource\"\n | \"description\"\n | \"avatar\"\n | \"createdBy\"\n | \"channelId\"\n | \"parentSessionId\"\n | \"rootSessionId\"\n | \"effectiveControl\"\n | \"inputWait\"\n | \"lastSequence\"\n | \"pinned\"\n | \"pinnedAt\"\n | \"pinVersion\"\n | \"unread\"\n | \"activelyWorking\"\n | \"attentionVersion\"\n | \"archived\"\n | \"archivedAt\"\n | \"importedArchive\"\n | \"retention\"\n | \"archiveVersion\"\n | \"treeStats\"\n | \"requiresActionSince\"\n | \"admissionBlock\"\n | \"createdAt\"\n | \"updatedAt\"\n> & {\n displayTitle: string;\n renameSeed: string;\n scheduledTaskId: string | null;\n siteOrigin: { siteId: string; title: string } | null;\n /**\n * Display-only: the latest started turn's model, or the session's stored\n * default when an explicit settings change is newer or no turn has started.\n * Rows the SDK projects from an older server's full pages carry the\n * session's effective model instead. `getSession` remains authoritative for\n * the composer default.\n */\n model?: string | undefined;\n reasoningEffort?: ReasoningEffort | undefined;\n /**\n * Newest turn in execution order: the last queued turn, else the executing\n * turn, else the most recently finished one. Null when the session has no\n * turn; absent from older servers and SDK-projected full pages.\n */\n latestTurn?: SessionListLatestTurn | null | undefined;\n};\n\nexport type SessionListLatestTurn = {\n id: string;\n status: SessionTurnStatus;\n startedAt: string | null;\n finishedAt: string | null;\n};\nexport type SessionListEntryResponse = Omit<SessionListResponse, \"pinned\" | \"sessions\"> & {\n projection: \"summary\";\n pinned: SessionListEntry[];\n sessions: SessionListEntry[];\n};\n\n/** Complete metadata for authorized roots and ordinary project trees. */\nexport type SessionListTotals = {\n needsYouCount: number;\n groups: Array<{\n channelId: string | null;\n total: number;\n attention: number;\n attentionSince: string | null;\n failed: number;\n active: number;\n queued: number;\n unread: number;\n activeWork: number;\n /** Idle sessions parked on their own wake-up; already included in `active`. */\n waiting?: number;\n }>;\n};\n\n/**\n * One Site row in one project (`siteConversations: \"group\"`): a Site with\n * the viewer's conversations, created by a chat they list, or opened by them.\n * Counts are complete for the viewer, independent of page size.\n */\nexport type SiteConversationGroup = {\n siteId: string;\n channelId: string | null;\n /** The Site's current title when the viewer can read it, else its creation label. */\n title: string;\n /** Root conversations in the group; 0 for a Site with none yet. */\n conversations: number;\n /** When the Site last got a new published version (creation is the first); for a viewer who cannot read the Site, when its first conversation here started. Its conversations, the chats that made it and opening it never move it. */\n updatedAt: string;\n /** Creation time of the group's newest conversation, else of the Site. */\n createdAt: string;\n total: number;\n attention: number;\n attentionSince: string | null;\n failed: number;\n active: number;\n queued: number;\n waiting: number;\n unread: number;\n activeWork: number;\n /** This person pinned the Site in their sidebar. Absent when not pinned. */\n pinned?: true;\n pinnedAt?: string | null;\n};\n\nexport type SessionListResponse = {\n totals?: SessionListTotals;\n needsYouOnly?: true;\n /** Receipt for the read-only (archived idle session) filter. */\n contentArchivedOnly?: true;\n /** Receipt for the started-or-messaged-by-you filter. */\n mineOnly?: true;\n /** Receipt for the `sessionIds` selection; older servers ignore that filter. */\n sessionIdsApplied?: true;\n pinned: Session[];\n /** True when the server omitted older pins from its bounded pinned section. */\n pinnedTruncated?: boolean;\n /** Present only when the server recognized and applied additive list filters. */\n filtersApplied?: true;\n /** Effective server ordering. Name: ASCII-space trim, ASCII case fold,\n * UTF-8 byte order, id ASC. Date keys and id ties are DESC. */\n sortBy?: \"updatedAt\" | \"createdAt\" | \"name\" | \"archivedAt\";\n archiveStatus?: \"active\" | \"archived\" | \"all\";\n /** Server-resolved Site origin filter, when requested. */\n originSiteId?: string;\n /** Server-resolved Site access filter, when requested. */\n siteAccessId?: string;\n /** Receipt for the requested Site conversation mode. */\n siteConversations?: \"include\" | \"group\";\n /** Complete Site rows for a `group` root page, newest activity first. */\n siteGroups?: SiteConversationGroup[];\n /** True when Site rows beyond the server bound were omitted. */\n siteGroupsTruncated?: true;\n sessions: Session[];\n nextCursor: string | null;\n};\n\nexport type WorkClaimSubjectType =\n | \"repository\"\n | \"branch\"\n | \"pull_request\"\n | \"issue\"\n | \"artifact\"\n | \"release\"\n | \"ci_run\"\n | \"other\";\n\nexport type WorkClaimDiscoverySummary = {\n id: string;\n sessionId: string;\n subject: {\n namespace: string;\n type: WorkClaimSubjectType;\n canonicalKey: string;\n displayLabel: string | null;\n };\n role: \"working\" | \"reviewing\" | \"monitoring\" | \"delivering\";\n state: \"active\" | \"released\" | \"superseded\" | \"stale\";\n revision: number;\n provenance:\n | \"explicit_agent\"\n | \"user_api\"\n | \"trusted_integration\"\n | \"session_resource\"\n | \"system_lifecycle\";\n version: {\n kind:\n | \"git_commit\"\n | \"branch_head\"\n | \"pull_request_head\"\n | \"artifact_version\"\n | \"release_version\"\n | \"ci_run\"\n | \"other\";\n value: string;\n } | null;\n observedAt: string;\n updatedAt: string;\n settledAt: string | null;\n};\n\nexport type WorkDiscoveryProjection = {\n claims: WorkClaimDiscoverySummary[];\n claimsTruncated: boolean;\n match: {\n class: \"exact_subject\" | \"title\" | \"goal\" | \"fuzzy\";\n field: \"subject\" | \"title\" | \"goal\" | \"claim_key\" | \"claim_label\";\n scoreBand: \"exact\" | \"strong\" | \"related\";\n claimId: string | null;\n } | null;\n possibleOverlap: boolean;\n advisoryOnly: true;\n noAdditionalAccess: true;\n};\n\n/** Compact, bounded session projection for workspace agent-topology browsers. */\nexport type AgentTopologySession = {\n id: string;\n title: string | null;\n titleTruncated: boolean;\n parentSessionId: string | null;\n rootSessionId: string;\n nestedAgentDepth: number;\n ancestorPath: Array<{\n id: string;\n title: string | null;\n titleTruncated: boolean;\n }>;\n status: SessionStatus;\n goal: {\n status: SessionGoalStatus;\n summary: string;\n summaryTruncated: boolean;\n } | null;\n pause: {\n state: \"active\" | \"paused\";\n additionalBlockerCount: number;\n source: {\n kind: \"session\" | \"workspace\";\n sessionId?: string | undefined;\n displayName: string;\n displayNameTruncated: boolean;\n } | null;\n };\n children: {\n directChildren: number;\n totalDescendants: number;\n runningDescendants: number;\n queuedDescendants: number;\n attentionDescendants: number;\n pausedDescendants: number;\n failedDescendants: number;\n truncated: boolean;\n };\n relatedWork: WorkDiscoveryProjection;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type AgentTopologyPageResponse = {\n sessions: AgentTopologySession[];\n total: number;\n hasMore: boolean;\n /** Operator rollout decision for human advisory presentation. */\n humanAdvisoriesEnabled?: boolean | undefined;\n nextCursor: string | null;\n};\n\nexport type UpdateSessionPinRequest = {\n pinned: boolean;\n expectedVersion?: number;\n};\n\nexport type UpdateSessionAttentionRequest = {\n unread?: boolean;\n acknowledgedThroughSequence?: number;\n activelyWorking?: boolean;\n expectedVersion?: number;\n};\n\n/**\n * Idle-session archive state. `archive` is null while the session is live; an\n * archived session keeps its readable timeline but is read-only.\n */\nexport type SessionRetention = {\n /** Never archive this session, however long it stays idle. */\n keepLive: boolean;\n archive: {\n state: \"archiving\" | \"archived\";\n archivedAt: string | null;\n } | null;\n};\n\nexport type UpdateSessionRetentionRequest = {\n keepLive: boolean;\n};\n\n/** Turn a chat's unattended mode on or off from its next turn. */\nexport type UpdateSessionUnattendedRequest = {\n unattended: boolean;\n};\n\nexport type UpdateSessionArchiveRequest = {\n archived: boolean;\n /** Ignored; kept for older clients. */\n clientEventId?: string;\n /** Ignored; there is one kind of archive. Kept for older clients. */\n mode?: \"pause_and_archive\" | \"hide_for_me\";\n /** Ignored; archiving stops running work itself. Kept for older clients. */\n confirmPause?: boolean;\n /** Ignored; kept for older clients. */\n expectedVersion?: number;\n};\n\nexport type LineageNode = {\n session: SessionSummary;\n children: LineageNode[];\n};\n\nexport type SessionLineageResponse = {\n sessionHasSchedules?: boolean | undefined;\n sessionHasUpcomingSchedules?: boolean | undefined;\n sessionWaitingForEvents?: boolean | undefined;\n /** What the automations continuing the requested session are waiting for. */\n sessionAutomationWait?: SessionAutomationWaitSummary | null | undefined;\n ancestors: SessionSummary[];\n children: LineageNode[];\n truncated: boolean;\n};\n\nexport type SessionTurnStatus =\n | \"queued\"\n | \"running\"\n | \"requires_action\"\n | \"recovering\"\n | \"waiting_capacity\"\n | \"completed\"\n | \"failed\"\n | \"cancelled\"\n | \"superseded\"\n | \"withdrawn_for_edit\";\n\nexport type SessionTurnSource =\n | \"user\"\n | \"scheduled_task\"\n | \"api\"\n | \"goal\"\n | \"system\"\n | \"compaction\";\n\nexport type TimelineAnnotationSourceKind = \"user_message\" | \"assistant_message\" | \"tool_output\";\n\nexport type TimelineAnnotationSourceEventType =\n | \"user.message\"\n | \"agent.message.completed\"\n | \"agent.toolCall.output\";\n\nexport type TimelineAnnotationSource = {\n kind: TimelineAnnotationSourceKind;\n eventId: string;\n eventType: TimelineAnnotationSourceEventType;\n sequence: number;\n turnId: string | null;\n startOffset: number;\n endOffset: number;\n contextBefore: string;\n contextAfter: string;\n label?: string | undefined;\n};\n\nexport type DraftTimelineAnnotation = {\n id: string;\n source: TimelineAnnotationSource;\n quote: string;\n note: string;\n};\n\nexport type SubmittedTimelineAnnotation = DraftTimelineAnnotation;\n\nexport type TimelineAnnotation = DraftTimelineAnnotation & {\n ordinal: number;\n};\n\nexport const PERSONAL_RESOURCE_SHARED_OUTPUT_WARNING_VERSION = 1 as const;\nexport const PERSONAL_RESOURCE_SHARED_OUTPUT_WARNING =\n \"Personal resources used in a workspace-shared session may influence outputs visible to other workspace members. The underlying credentials and secret values are not shared by the attachment itself.\";\n\nexport type PersonalResourceAttachmentIntent = {\n mode: \"once\" | \"session\" | \"always\";\n expectedAuthorityEpoch?: number | undefined;\n workspaceSharedAcknowledged?: boolean | undefined;\n sharedOutputWarningVersion: 1;\n};\n\nexport type PersonalResourceAttachmentSummary = {\n mode: \"once\" | \"session\" | \"always\";\n context: \"user_private\" | \"workspace_shared\";\n resourceCount: number;\n resourceKinds: Array<\"variable_set\" | \"rig\" | \"connected_machine\">;\n sharedOutputWarningVersion: 1;\n};\n\nexport type SessionTurn = {\n id: string;\n workspaceId: string;\n sessionId: string;\n triggerEventId: string;\n temporalWorkflowId: string;\n status: SessionTurnStatus;\n source: SessionTurnSource;\n position: number;\n prompt: string;\n annotations?: TimelineAnnotation[] | undefined;\n resources: ResourceRef[];\n tools: ToolRef[];\n toolsProvided?: boolean | undefined;\n model: string;\n reasoningEffort: ReasoningEffort;\n latencyMode: LatencyMode;\n sandboxBackend: SandboxBackend;\n sandboxOs: SandboxOs | null;\n metadata: Record<string, unknown>;\n version: number;\n executionGeneration: number;\n activeAttemptId: string | null;\n lineage: Record<string, unknown>;\n initiator: TurnInitiator;\n initiatorContext: Record<string, unknown>;\n personalConnections?: McpPersonalConnectionSummary[] | undefined;\n personalResources?: PersonalResourceAttachmentSummary | null | undefined;\n cancelledBy?: string | null;\n cancelReason?: string | null;\n startedAt: string | null;\n finishedAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type HumanInputQuestionKind = \"text\" | \"single_select\" | \"multi_select\" | \"secret\";\n\n/** Options for a generated password (see `@opengeni/contracts` GeneratePasswordSpec). */\nexport type GeneratePasswordSpec = {\n length?: number | undefined;\n lowercase?: boolean | undefined;\n uppercase?: boolean | undefined;\n digits?: boolean | undefined;\n symbols?: boolean | undefined;\n symbolSet?: string | undefined;\n excludeAmbiguous?: boolean | undefined;\n requireEachClass?: boolean | undefined;\n};\n\nexport type HumanInputSecretSaveTo = \"user\" | \"task\" | \"workspace\";\n\n/** A secret question's spec; the value is saved to a vault, never to the response. */\nexport type HumanInputSecretSpec = {\n item: string;\n field?: string | undefined;\n fieldKind?: \"concealed\" | \"totp\" | \"text\" | undefined;\n itemType?: \"login\" | \"api_key\" | \"note\" | \"card\" | \"identity\" | \"ssh_key\" | undefined;\n username?: { prompt: string; value?: string | null | undefined } | null | undefined;\n website?: string | null | undefined;\n looksLike?: string | null | undefined;\n pattern?: string | null | undefined;\n saveTo?: HumanInputSecretSaveTo | undefined;\n vault?: string | null | undefined;\n allowGenerate?: boolean | undefined;\n generate?: GeneratePasswordSpec | null | undefined;\n autocomplete?: \"current-password\" | \"new-password\" | \"one-time-code\" | \"off\" | undefined;\n};\n\n/** Write-only secret value for one secret question: exactly one of `value` or `generate`. */\nexport type HumanInputSecretAnswer = {\n questionId: string;\n value?: string | undefined;\n generate?: GeneratePasswordSpec | undefined;\n username?: string | undefined;\n saveTo: HumanInputSecretSaveTo;\n vaultId?: string | undefined;\n};\n\n/** What the agent and timeline see for an answered secret question. */\nexport type HumanInputSecretAnswerResult = {\n reference: string;\n username: string | null;\n vaultName: string;\n itemName: string;\n saveTo: HumanInputSecretSaveTo;\n};\n\nexport type HumanInputOption = {\n id: string;\n label: string;\n description?: string | null | undefined;\n /** The agent's suggestion; mark it, never pre-select it. */\n recommended?: boolean | null | undefined;\n /** A short sample of what the option produces, shown as-is (monospace). */\n preview?: string | null | undefined;\n};\n\nexport type SkillReviewReference = {\n removalOperationId?: string | undefined;\n sourceOperationId: string;\n skillId: string;\n revisionId: string;\n expectedRevisionId: string | null;\n expectedScopeVersion: number;\n};\n\nexport type HumanInputQuestion = {\n skillReview?: SkillReviewReference | null | undefined;\n id: string;\n kind: HumanInputQuestionKind;\n prompt: string;\n label?: string | null | undefined;\n helpText?: string | null | undefined;\n options: HumanInputOption[];\n /** Required exactly when `kind` is \"secret\"; null otherwise. */\n secret?: HumanInputSecretSpec | null | undefined;\n required: boolean;\n /**\n * A yes/no decision: a single_select with exactly two options, the action\n * first and the way out second, answered with two buttons.\n */\n confirm?: boolean | null | undefined;\n allowOther: boolean;\n validation?:\n | {\n minSelections?: number | null | undefined;\n maxSelections?: number | null | undefined;\n }\n | null\n | undefined;\n};\n\nexport type HumanInputAnswer = {\n questionId: string;\n values: string[];\n other?: string | null | undefined;\n /** Secret questions: the saved reference, never the value. */\n secret?: HumanInputSecretAnswerResult | undefined;\n};\n\nexport type HumanInputResponse =\n | { outcome: \"answered\"; answers: HumanInputAnswer[] }\n /** `agentDecides`: the person chose \"Let the agent decide\". */\n | { outcome: \"skipped\"; agentDecides?: true | undefined }\n | { outcome: \"expired\" | \"cancelled\" };\n\nexport type SubmitHumanInputResponseRequest =\n | {\n outcome: \"answered\";\n answers: HumanInputAnswer[];\n /** Write-only secret values; never echoed in events or responses. */\n secretAnswers?: HumanInputSecretAnswer[] | undefined;\n }\n /**\n * `agentDecides`: \"Let the agent decide\". The asking agent makes its own best\n * choice; accepted even when the request does not allow an ordinary skip, but\n * never for secret questions, Skill reviews or secret approvals.\n */\n | { outcome: \"skipped\"; agentDecides?: true | undefined };\n\nexport type SessionHumanInputRequest = {\n id: string;\n workspaceId: string;\n sessionId: string;\n turnId: string;\n turnGeneration: number;\n creationAttemptId: string;\n toolCallId: string;\n status: \"pending\" | \"answered\" | \"skipped\" | \"expired\" | \"cancelled\";\n /**\n * `secret_use_approval`: Opengeni's own approval card for a blocked secret\n * use, answerable after its turn ends. Absent from older servers, meaning\n * `tool_call`.\n */\n origin?: \"tool_call\" | \"secret_use_approval\" | undefined;\n questions: HumanInputQuestion[];\n allowSkip: boolean;\n response: HumanInputResponse | null;\n respondedBy: string | null;\n respondedAt: string | null;\n expiresAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport const SESSION_EVENT_TYPES = [\n \"usage.threshold_reached\",\n \"usage.exhausted\",\n \"usage.period_reset\",\n \"session.created\",\n \"session.variable_sets.updated\",\n \"session.runtime.configured\",\n // Defensive bounded projection for malformed/legacy oversized envelopes.\n \"session.event.envelope_omitted\",\n \"session.status.changed\",\n \"session.realtime.started\",\n \"session.realtime.ended\",\n \"session.requiresAction\",\n \"session.humanInput.requested\",\n \"session.notification.posted\",\n \"session.notification.withdrawn\",\n \"session.agentCall.ringing\",\n \"session.agentCall.settled\",\n \"session.context.compaction.requested\",\n \"session.context.compaction.started\",\n \"session.context.compacted\",\n \"session.context.compaction.skipped\",\n \"session.context.cleared\",\n \"user.message\",\n \"user.pause\",\n \"user.approvalDecision\",\n \"user.humanInputResponse\",\n \"turn.queued\",\n \"turn.started\",\n \"turn.completed\",\n \"turn.failed\",\n \"turn.cancelled\",\n \"turn.superseded\",\n \"turn.recovery.requested\",\n \"turn.dispatch.expired\",\n \"turn.capacity_waiting\",\n \"turn.startup.phase.started\",\n \"turn.startup.phase.completed\",\n \"turn.startup.phase.failed\",\n \"agent.message.delta\",\n \"agent.message.completed\",\n \"agent.reasoning.delta\",\n \"agent.toolCall.created\",\n \"agent.toolCall.output\",\n \"agent.model.request\",\n \"agent.model.usage\",\n \"tool.auth_needed\",\n \"credential.auth_needed\",\n \"agent.updated\",\n \"rig.setup.started\",\n \"rig.setup.completed\",\n \"rig.setup.skipped\",\n \"rig.setup.failed\",\n \"sandbox.operation.started\",\n \"sandbox.operation.completed\",\n \"sandbox.operation.failed\",\n \"sandbox.recovery.selected\",\n \"session.command.backgrounded\",\n \"session.command.finished\",\n \"session.wait.started\",\n \"session.wait.finished\",\n \"sandbox.command.output.delta\",\n \"artifact.created\",\n \"knowledge.confirmation.recovered\",\n \"instruction.confirmation.recovered\",\n \"knowledge.source.prepared\",\n \"knowledge.source.failed\",\n \"goal.set\",\n \"goal.updated\",\n \"goal.progress\",\n \"goal.rewrite.proposed\",\n \"goal.rewrite.rejected\",\n \"goal.completed\",\n \"goal.paused\",\n \"goal.resumed\",\n \"goal.cleared\",\n \"goal.held\",\n \"goal.continuation\",\n \"system.update.pending\",\n \"system.update.delivered\",\n \"system.update.superseded\",\n \"system.update.cancelled\",\n \"system.update.settled\",\n \"session.control.paused\",\n \"session.control.resumed\",\n \"session.control.steer_requested\",\n \"workspace.inference.paused\",\n \"workspace.inference.resumed\",\n \"session.queue.changed\",\n \"session.queue.prompt.cancelled\",\n \"session.queue.history\",\n \"turn.event.rejected_late\",\n \"memory.saved\",\n \"memory.corrected\",\n // Channel-B desktop pixel-plane signals (mirror of contracts SessionEventType;\n // the contract-parity test asserts sorted equality).\n \"stream.url.rotated\",\n \"stream.opened\",\n \"stream.closed\",\n \"stream.revoked\",\n // Channel-B recording signals (P4.3 — \"agent films itself proving the fix\").\n \"recording.started\",\n \"recording.available\",\n \"recording.failed\",\n // Channel-A structured-service notifications (P4.4; mirror of contracts\n // SessionEventType — the contract-parity test asserts sorted equality).\n \"fs.changed\",\n \"git.changed\",\n \"terminal.pty.started\",\n \"terminal.pty.output.delta\",\n \"terminal.pty.exited\",\n \"session.title_set\",\n \"session.profile_set\",\n \"session.visibility.changed\",\n \"session.personal_resources.attached\",\n \"session.mcp.approval_policy.updated\",\n \"session.tool_policy.updated\",\n \"session.agent.updated\",\n \"session.skills.updated\",\n \"session.resources.removed\",\n \"session.model_settings.updated\",\n // An authorized person or host changed the task root's usage limit.\n \"session.usage_limit.updated\",\n // Multi-account Codex (P1): the session's inference account changed.\n \"codex.account.switched\",\n \"subscription.account.selected\",\n \"subscription.account.switched\",\n \"codex.account.selection.changed\",\n // A person chose the session's account (any provider) or returned it to\n // automatic placement.\n \"model_account.selection.changed\",\n // credential allocator metadata-only per-turn credential selection audit.\n \"codex.credential.selected\",\n // Bounded, identity-free deterministic shadow/replay decision.\n \"codex.fleet.decision\",\n // credential allocator durable zero-capacity wait lifecycle. These are system/runtime\n // events, never synthetic user messages.\n \"codex.capacity.waiting\",\n \"codex.capacity.resumed\",\n \"codex.capacity.superseded\",\n // Sandbox durability observability (mirror of contracts SessionEventType):\n // box lifecycle + manifest-env drift, attributable from the DB alone.\n \"sandbox.box.created\",\n \"sandbox.box.lost\",\n \"sandbox.box.terminated\",\n \"sandbox.box.snapshot\",\n \"sandbox.env.drift\",\n // Active-sandbox pointer reconcile (issue #341; announce-only; mirror of contracts\n // SessionEventType — the contract-parity test asserts sorted equality).\n \"session.route.reconciled\",\n // Workbench v2 turn-end workspace capture (announce-only; mirror of contracts\n // SessionEventType — the contract-parity test asserts sorted equality).\n \"workspace.revision.captured\",\n \"workspace.revision.degraded\",\n // Connected Machine op-outcome observability (announce-only, quiet; mirror of\n // contracts SessionEventType — the contract-parity test asserts sorted equality).\n \"machine.op.failed\",\n \"machine.op.recovered\",\n // Connected Machine link-plane observability (announce-only, quiet; mirror of\n // contracts SessionEventType — the contract-parity test asserts sorted equality).\n \"machine.link.lost\",\n \"machine.link.restored\",\n \"machine.runner.restarted\",\n] as const;\n\nexport type KnownSessionEventType = (typeof SESSION_EVENT_TYPES)[number];\n\n/**\n * Event types the SDK knows about today, kept open so a newer Opengeni server\n * can introduce event types without breaking older SDK consumers.\n */\nexport type SessionEventType = KnownSessionEventType | (string & {});\n\nexport type SessionEvent = {\n id: string;\n workspaceId: string;\n sessionId: string;\n /** Per-session sequence number: positive, contiguous, strictly increasing. */\n sequence: number;\n /** Server-owned durable high-water mark for a synthetic compact event. */\n coveredThrough?: number | undefined;\n type: SessionEventType;\n payload: unknown;\n occurredAt: string;\n clientEventId?: string | null | undefined;\n turnId?: string | null | undefined;\n turnGeneration?: number | null | undefined;\n turnAttemptId?: string | null | undefined;\n turnAssociation?: \"current\" | \"late_rejected\" | \"duplicate\" | null | undefined;\n duplicateOfEventId?: string | null | undefined;\n duplicateReason?: string | null | undefined;\n};\n\nexport type SessionEventSemanticClass =\n | \"control\"\n | \"terminal\"\n | \"failure\"\n | \"checkpoint\"\n | \"tool_receipt\"\n | \"provider_account\";\nexport type SessionEventLatestClass = SessionEventSemanticClass | \"receipt\";\nexport type SessionEventPayloadMode = \"none\" | \"summary\" | \"full\";\nexport type SessionEventReadMode = \"monitoring\" | \"forensic\";\nexport type SessionEventReadDirection = \"after\" | \"before\";\nexport type SessionEventResultMode = \"events\" | \"compact\";\n\ntype SessionEventListCommonOptions = {\n after?: number;\n before?: number;\n limit?: number;\n compact?: boolean;\n mode?: SessionEventReadMode;\n direction?: SessionEventReadDirection;\n payloadMode?: SessionEventPayloadMode;\n resultMode?: \"events\";\n /**\n * With `excludeTypes` containing `agent.toolCall.created`, keep the created\n * rows of presented tools (images, published files, Skill changes). Servers\n * that predate this option ignore it and apply the plain type filter; a\n * server that applies it reports `SessionEventPage.conversationFilter`.\n */\n presentedToolCalls?: \"include\";\n /**\n * With `payloadMode: \"full\"`, return large `agent.toolCall.output` payloads\n * as bounded previews carrying an `outputPreview` fact (see\n * {@link SessionEventToolOutputPreview}). Read one row's exact output with\n * an ordinary full read around its sequence. Servers that predate this\n * option ignore it and return exact outputs.\n */\n toolOutputs?: \"preview\";\n};\n\n/**\n * The fact a previewed `agent.toolCall.output` payload carries in\n * `payload.outputPreview`. `structured` keeps the output's shape with long\n * strings shortened to their head and tail around an omission marker; `text`\n * replaces the output with the head and tail of its text.\n */\nexport type SessionEventToolOutputPreview = {\n truncated: true;\n reason: \"tool_output_preview\";\n shape: \"structured\" | \"text\";\n originalBytes: number;\n previewBytes: number;\n};\n\nexport type SessionEventListOptions = SessionEventListCommonOptions &\n (\n | {\n latest?: never;\n includeTypes?: SessionEventType[];\n excludeTypes?: SessionEventType[];\n includeClasses?: SessionEventSemanticClass[];\n excludeClasses?: SessionEventSemanticClass[];\n }\n | {\n /** Exclusive lookup for the newest event in exactly this semantic class. */\n latest: SessionEventLatestClass;\n includeTypes?: never;\n excludeTypes?: never;\n includeClasses?: never;\n excludeClasses?: never;\n }\n );\n\nexport type SessionEventCompactResult = {\n version: 1;\n semanticClass: SessionEventSemanticClass;\n source: {\n id: string;\n type: SessionEventType;\n sequence: number;\n occurredAt: string;\n turnId: string | null;\n turnGeneration: number | null;\n turnAttemptId: string | null;\n turnAssociation: SessionEvent[\"turnAssociation\"];\n };\n id: string;\n type: SessionEventType;\n sequence: number;\n occurredAt: string;\n turnId: string | null;\n turnGeneration: number | null;\n turnAttemptId: string | null;\n turnAssociation: SessionEvent[\"turnAssociation\"];\n coveredSequence: { first: number; last: number };\n status:\n | \"completed\"\n | \"failed\"\n | \"cancelled\"\n | \"superseded\"\n | \"checkpoint\"\n | \"receipt\"\n | \"unknown\";\n text: string | null;\n output: unknown;\n result: unknown;\n failure: {\n error: string | null;\n code: string | null;\n retryable: boolean | null;\n recovery: string | null;\n } | null;\n checkpoint: unknown;\n receipt: unknown;\n truncation: {\n truncated: boolean;\n fields: string[];\n originalBytes: number | null;\n deliveredBytes: number;\n };\n};\n\nexport type SessionEventCompactResultOptions = {\n latest: SessionEventLatestClass;\n resultMode: \"compact\";\n mode?: SessionEventReadMode;\n payloadMode?: SessionEventPayloadMode;\n};\n\nexport type SessionEventPage = {\n events: SessionEvent[];\n mode: SessionEventReadMode;\n payloadMode: SessionEventPayloadMode;\n direction: SessionEventReadDirection;\n bytes: number;\n maxBytes: number;\n truncated: boolean;\n hasMore: boolean;\n truncatedBy: \"count\" | \"bytes\" | \"http_bytes\" | null;\n coveredSequence: { first: number; last: number } | null;\n nextAfter: number | null;\n nextBefore: number | null;\n forensicExact: boolean;\n /**\n * The conversation-filter version the server applied to a\n * `presentedToolCalls: \"include\"` read (see\n * `SESSION_EVENT_CONVERSATION_FILTER_VERSION`), or null when it announced\n * none: an older server may have ignored `presentedToolCalls`.\n */\n conversationFilter?: number | null;\n};\n\nexport type ToolAuthNeededPayload = {\n serverId: string;\n /** Configured connector for recovery; serverId retains the execution alias. */\n canonicalServerId?: string | undefined;\n /** Scope of the exact failed account, not the canonical catalog default. */\n connectionSubjectScope?: \"workspace\" | \"subject\" | undefined;\n toolName?: string | null | undefined;\n providerDomain: string;\n provider?: string | undefined;\n connectionId?: string | null | undefined;\n authoritySource?: \"host\" | undefined;\n reason:\n | \"missing_connection\"\n | \"expired\"\n | \"insufficient_scope\"\n | \"refresh_failed\"\n | \"personal_authority_unavailable\"\n | \"unsupported_auth\"\n | \"resource_scope_unavailable\"\n | \"designated_credential_unavailable\";\n hostReason?:\n | \"missing_connection\"\n | \"expired\"\n | \"insufficient_scope\"\n | \"refresh_failed\"\n | \"personal_authority_unavailable\"\n | \"unsupported_auth\"\n | \"resource_scope_unavailable\"\n | \"designated_credential_unavailable\"\n | undefined;\n scopes?: string[] | undefined;\n resource?: string | undefined;\n selectedResources?: Array<{ id: string; kind: \"repository\" }> | undefined;\n authorizationUrl?: string | undefined;\n subjectId?: string | null | undefined;\n capability?:\n | {\n id: string;\n name: string;\n kind: CapabilityKind;\n source: CapabilitySource;\n action: \"connect\" | \"add_credentials\" | \"enable\";\n rationale: string;\n requiredVariables: string[];\n }\n | undefined;\n /** Agent suggestion; never a connection or permission grant. */\n setupRequest?:\n | {\n kind: \"mcp\";\n ownership?: \"personal\" | \"workspace\" | undefined;\n mcpSetup?: import(\"@opengeni/contracts/prepared-mcp-setup\").PreparedMcpSetup | undefined;\n name: string;\n endpointUrl: string;\n rationale: string;\n }\n | undefined;\n /** The Connected Machine the agent asked for; names the request, grants nothing. */\n requestedSandboxId?: string | undefined;\n /** `chrome`: a Connected Machine card posted because the agent needs the person's own Chrome. */\n purpose?: \"chrome\" | undefined;\n};\n\n// Payload shapes for the high-traffic event types. `SessionEvent.payload` is\n// `unknown` on the wire; these are the documented shapes producers emit today.\nexport type AgentTextDeltaPayload = { text: string };\nexport type AgentMessageCompletedPayload = { text: string };\nexport type AgentToolCallCreatedPayload = {\n id: string | null;\n name: string;\n arguments: unknown;\n raw?: unknown | undefined;\n /**\n * Content-free analytics family: an Opengeni first-party tool name,\n * `integration:<reviewed domain>`, or `custom`. Absent when unclassified.\n */\n toolFamily?: string | undefined;\n};\nexport type AgentToolCallOutputPayload = { id: string | null; output: unknown };\nexport type SessionStatusChangedPayload = { status: SessionStatus };\n\n// Adaptive-fleet shadow event. This is the typed, identity-free view\n// consumed by UI/manager tooling; the durable replay record also contains the\n// complete normalized policy/input needed for offline deterministic replay.\nexport type CodexFleetConfidence = \"unknown\" | \"low\" | \"medium\" | \"high\";\nexport type CodexFleetCacheState = \"unknown\" | \"healthy\" | \"collapsed\";\nexport type CodexFleetShadowComparison =\n | \"match\"\n | \"different_candidate\"\n | \"different_outcome\"\n | \"not_comparable_truncated\";\nexport type CodexFleetDecisionScore = {\n candidateKey: string;\n eligible: boolean;\n rejectionReason:\n | \"allocator_disabled\"\n | \"unavailable\"\n | \"cooling\"\n | \"quota_ceiling\"\n | \"overlay_isolation\"\n | null;\n quotaPressure: number;\n leasePressure: number;\n observedBurnPressure: number;\n inferredBurnPressure: number;\n runwayPressure: number;\n uncertaintyPressure: number;\n cacheAffinityBenefit: number;\n cacheState: CodexFleetCacheState;\n overlayPreferenceBenefit: number;\n total: number;\n confidence: CodexFleetConfidence;\n};\nexport type CodexFleetDecisionEventPayload = {\n schemaVersion: 1;\n mode: \"shadow\";\n actual: {\n outcome: \"selected\" | \"waiting\" | \"none\";\n candidateKey: string | null;\n reason:\n | \"lease_reused\"\n | \"pin\"\n | \"rotation\"\n | \"active\"\n | \"all_capped\"\n | \"allocator_disabled\"\n | \"none\";\n };\n comparison: CodexFleetShadowComparison;\n replay: {\n schemaVersion: 1;\n policyVersion: \"adaptive-shadow-v1\";\n mode: \"shadow\";\n input: { candidates: Array<{ key: string }> } & Record<string, unknown>;\n truncatedCandidateCount: number;\n inputFingerprint: string;\n decisionFingerprint: string;\n decision: {\n outcome: \"selected\" | \"paced\" | \"none\";\n selectedCandidateKey: string | null;\n reason:\n | \"fenced_in_flight\"\n | \"fenced_candidate_missing\"\n | \"admission_paced\"\n | \"no_eligible_candidate\"\n | \"overlay_isolated_empty\"\n | \"best_score\"\n | \"affinity_best\"\n | \"hysteresis_hold\";\n admission: {\n outcome: \"admit\" | \"pace\";\n reason:\n | \"fenced_in_flight\"\n | \"pacing_disabled\"\n | \"capacity_unknown\"\n | \"capacity_available\"\n | \"work_conserving_borrow\"\n | \"manager_priority\"\n | \"standard_starvation_bound\"\n | \"capacity_saturated\"\n | \"emergency_fuse\";\n borrowedIdleCapacity: boolean;\n };\n borrowedOverlayCapacity: boolean;\n strandedEligibleCount: number;\n confidence: CodexFleetConfidence;\n scores: CodexFleetDecisionScore[];\n };\n } & Record<string, unknown>;\n};\n\n// Recording payloads (P4.3 — plain TS mirror of the contracts Zod schemas).\n// These are TYPES, not Zod (F15), so ordinary SDK entries remain runtime-clean.\n// The contract-parity test asserts the event-type literals; these shapes\n// document the wire payloads.\nexport type RecordingMode = \"manual\" | \"on-turn\" | \"on-verify\";\nexport type RecordingCodec = \"h264-mp4\" | \"vp9-webm\";\nexport type RecordingContentType = \"video/mp4\" | \"video/webm\";\nexport type RecordingFailedReason =\n | \"ffmpeg-error\"\n | \"box-death\"\n | \"box-rollover\"\n | \"upload-failed\"\n | \"max-bytes-exceeded\"\n | \"display-unavailable\";\n\nexport type RecordingStartedPayload = {\n recordingId: string;\n turnId: string | null;\n mode: RecordingMode;\n codec: RecordingCodec;\n dimensions: [number, number];\n framerate: number;\n startedAt: string;\n reason?: string | null | undefined;\n};\nexport type RecordingAvailablePayload = {\n recordingId: string;\n turnId: string | null;\n codec: RecordingCodec;\n contentType: RecordingContentType;\n storageKey: string;\n durationSeconds: number | null;\n sizeBytes: number;\n dimensions: [number, number];\n};\nexport type RecordingFailedPayload = {\n recordingId: string;\n turnId: string | null;\n reason: RecordingFailedReason;\n detail?: string | null | undefined;\n};\n\n// ── Channel-A structured services (P4.4) — hand-written wire mirrors ─────────\n\n// A1 notification payloads.\nexport type SandboxCommandOutputDeltaPayload = {\n stream: \"stdout\" | \"stderr\";\n chunk: string;\n commandId?: string | undefined;\n seq?: number | undefined;\n};\nexport type FsChangeKind = \"created\" | \"modified\" | \"deleted\" | \"renamed\";\nexport type FsChangedPayload = {\n changes: {\n path: string;\n kind: FsChangeKind;\n isDir: boolean;\n sizeBytes: number | null;\n oldPath?: string | undefined;\n }[];\n source: \"write\" | \"watch\" | \"agent\";\n revision: number;\n leaseEpoch: number;\n};\nexport type GitChangedPayload = {\n head: string | null;\n dirty: boolean;\n ahead: number;\n behind: number;\n changedFileCount: number;\n reason: \"commit\" | \"checkout\" | \"stage\" | \"worktree\" | \"fetch\" | \"unknown\";\n revision: number;\n leaseEpoch: number;\n};\nexport type TerminalPtyStartedPayload = {\n ptyId: string;\n cols: number;\n rows: number;\n shell: string;\n cwd: string;\n};\nexport type TerminalPtyOutputDeltaPayload = {\n ptyId: string;\n stream: \"stdout\" | \"stderr\";\n chunk: string;\n seq: number;\n};\nexport type TerminalPtyExitedPayload = {\n ptyId: string;\n exitCode: number | null;\n reason: \"exit\" | \"killed\" | \"owner_gone\" | \"timeout\" | \"lost\";\n};\n\n// A2 FileSystem request/response.\nexport type FsNodeType = \"file\" | \"dir\" | \"symlink\" | \"other\";\nexport type FsTreeNode = {\n name: string;\n path: string;\n type: FsNodeType;\n sizeBytes: number | null;\n mtimeMs: number | null;\n mode: number | null;\n children?: FsTreeNode[] | undefined;\n truncated: boolean;\n};\nexport type FsEncoding = \"utf8\" | \"base64\";\nexport type FileSystemRouteIdentity = {\n epoch: number;\n root: string;\n};\nexport type FsListRequest = {\n path?: string;\n depth?: number;\n maxEntries?: number;\n includeHidden?: boolean;\n route?: FileSystemRouteIdentity;\n};\nexport type FsListResponse = {\n root: FsTreeNode;\n revision: number;\n truncated: boolean;\n};\nexport type FsListBatchRequest = { requests: FsListRequest[] };\nexport type FsListBatchResponse = { results: FsListResponse[] };\nexport type FsReadRequest = {\n path: string;\n /** Confine this read to the session's working directory, refusing symlinks. */\n workspaceOnly?: boolean;\n encoding?: FsEncoding;\n maxBytes?: number;\n route?: FileSystemRouteIdentity;\n};\nexport type FsReadResponse = {\n path: string;\n encoding: FsEncoding;\n content: string;\n sizeBytes: number;\n truncated: boolean;\n isBinary: boolean;\n revision: number;\n};\nexport const SANDBOX_FILE_ARTIFACT_MAX_BYTES = 5_000_000_000;\nexport type PublishSandboxFileArtifactRequest = {\n path: string;\n /** Who can open the file. Omitted: the chat's own audience. */\n visibility?: \"private\" | \"workspace\";\n};\nexport type SandboxFileArtifactReceipt = {\n type: \"sandbox_file\";\n sandboxPath: string;\n filename: string;\n artifact: RetainedArtifactReference;\n /** Who can open the file; absent from receipts made before files had audiences. */\n access?: FileAccess | undefined;\n};\nexport type FsWriteRequest = {\n path: string;\n encoding?: FsEncoding;\n content: string;\n overwrite?: boolean;\n createParents?: boolean;\n route?: FileSystemRouteIdentity;\n};\nexport type FsWriteResponse = {\n path: string;\n sizeBytes: number;\n revision: number;\n};\nexport type FsDeleteRequest = {\n path: string;\n recursive?: boolean;\n route?: FileSystemRouteIdentity;\n};\nexport type FsDeleteResponse = { revision: number };\nexport type FsMoveRequest = {\n path: string;\n newPath: string;\n overwrite?: boolean;\n createParents?: boolean;\n route?: FileSystemRouteIdentity;\n};\nexport type FsMoveResponse = {\n path: string;\n newPath: string;\n revision: number;\n};\nexport type FsMkdirRequest = {\n path: string;\n recursive?: boolean;\n route?: FileSystemRouteIdentity;\n};\nexport type FsMkdirResponse = { path: string; revision: number };\n\n// A2 Git request/response (the Pierre-diff feed).\nexport type GitFileStatusCode =\n | \"added\"\n | \"modified\"\n | \"deleted\"\n | \"renamed\"\n | \"copied\"\n | \"untracked\"\n | \"ignored\"\n | \"conflicted\"\n | \"typechange\";\nexport type GitFileStatus = {\n path: string;\n oldPath: string | null;\n index: GitFileStatusCode | null;\n worktree: GitFileStatusCode | null;\n isConflicted: boolean;\n};\nexport type GitStatusRequest = { path?: string };\nexport type GitStatusResponse = {\n isRepo: boolean;\n head: string | null;\n /** Exact commit object identity. null for unborn/non-repositories; absent on\n * legacy adapters. */\n headOid?: string | null | undefined;\n detached: boolean;\n upstream: string | null;\n ahead: number;\n behind: number;\n files: GitFileStatus[];\n revision: number;\n};\nexport type GitDiffLineType = \"context\" | \"add\" | \"del\" | \"meta\";\nexport type GitDiffLine = {\n type: GitDiffLineType;\n oldNo: number | null;\n newNo: number | null;\n text: string;\n};\nexport type GitDiffHunk = {\n oldStart: number;\n oldLines: number;\n newStart: number;\n newLines: number;\n header: string;\n lines: GitDiffLine[];\n};\nexport type GitFileDiff = {\n path: string;\n oldPath: string | null;\n status: GitFileStatusCode;\n isBinary: boolean;\n isImage: boolean;\n additions: number;\n deletions: number;\n hunks: GitDiffHunk[];\n truncated: boolean;\n};\nexport type GitDiffRequest = {\n path?: string;\n staged?: boolean;\n includeUntracked?: boolean;\n fromRef?: string;\n toRef?: string;\n pathspec?: string[];\n contextLines?: number;\n maxBytesPerFile?: number;\n};\nexport type GitDiffResponse = { files: GitFileDiff[]; revision: number };\nexport type GitReadBatchItemRequest = {\n status: GitStatusRequest;\n diff?: GitDiffRequest;\n};\nexport type GitReadBatchRequest = { requests: GitReadBatchItemRequest[] };\nexport type GitReadBatchItemResponse = {\n status: GitStatusResponse;\n diff?: GitDiffResponse;\n};\nexport type GitReadBatchResponse = { results: GitReadBatchItemResponse[] };\nexport type GitLogRequest = {\n path?: string;\n ref?: string;\n maxCount?: number;\n skip?: number;\n pathspec?: string[];\n};\nexport type GitCommit = {\n sha: string;\n shortSha: string;\n parents: string[];\n author: { name: string; email: string; timestamp: number };\n committer: { name: string; email: string; timestamp: number };\n subject: string;\n body: string;\n refs: string[];\n};\nexport type GitLogResponse = { commits: GitCommit[]; hasMore: boolean };\nexport type GitShowRequest = {\n path?: string;\n ref: string;\n filePath?: string;\n encoding?: FsEncoding;\n maxBytesPerFile?: number;\n};\nexport type GitShowResponse = {\n commit: GitCommit | null;\n files: GitFileDiff[];\n blob: {\n content: string;\n encoding: FsEncoding;\n sizeBytes: number;\n truncated: boolean;\n } | null;\n revision: number;\n};\n\n// Workbench v2 turn-end capture (mirror of `@opengeni/contracts` WorkspaceCapture*\n// + the M2 read-API response shapes). Reuses FsTreeNode /\n// GitFileStatus / GitFileDiff / GitFileStatusCode / FsEncoding above.\nexport type WorkspaceCaptureFile = {\n path: string;\n status: GitFileStatusCode;\n hash: string | null;\n baseHash: string | null;\n contentRef: string | null;\n sizeBytes: number;\n isBinary: boolean;\n tooLarge: boolean;\n deleted: boolean;\n};\nexport type WorkspaceCaptureRepo = {\n root: string;\n head: string | null;\n /** Exact HEAD commit object identity. null for unborn repositories; absent\n * on legacy captures. */\n headOid?: string | null | undefined;\n detached: boolean;\n upstream: string | null;\n ahead: number;\n behind: number;\n status: GitFileStatus[];\n diff: GitFileDiff[];\n /** Current branch vs the remote default branch. Absent on legacy captures or\n * repositories whose remote default ref could not be resolved. */\n branchDiff?: GitFileDiff[] | undefined;\n};\nexport type WorkspaceCaptureDegradedReason =\n | \"repository_discovery_command_failed\"\n | \"repository_discovery_timed_out\"\n | \"repository_discovery_result_limit_exceeded\"\n | \"repository_read_unavailable\";\nexport type WorkspaceCaptureStats = {\n repoCount: number;\n fileCount: number;\n additions: number;\n deletions: number;\n totalBytes: number;\n tooLargeCount: number;\n binaryCount: number;\n treeEntryCount: number;\n treeTruncated: boolean;\n durationMs: number;\n fingerprint?: string;\n};\nexport type WorkspaceCaptureManifest = {\n version: 1;\n revision: number;\n capturedAt: string;\n turnId: string | null;\n leaseEpoch: number;\n treeIndex: FsTreeNode;\n treeTruncated: boolean;\n repos: WorkspaceCaptureRepo[];\n files: WorkspaceCaptureFile[];\n stats: WorkspaceCaptureStats;\n};\nexport type WorkspaceRevisionCapturedPayload = {\n revision: number;\n turnId: string | null;\n capturedAt: string;\n leaseEpoch: number;\n stats: WorkspaceCaptureStats;\n};\nexport type WorkspaceRevisionDegradedPayload = {\n revision: number;\n turnId: string | null;\n capturedAt: string;\n leaseEpoch: number;\n reason: WorkspaceCaptureDegradedReason;\n};\nexport type WorkspaceCaptureSignedUrl = { url: string; expiresAt: string };\n// GET …/workspace/capture. Exactly one of manifest/manifestUrl is non-null.\nexport type GetWorkspaceCaptureResponse =\n | {\n available: false;\n degradedReason?: WorkspaceCaptureDegradedReason | null;\n revision?: number | null;\n capturedAt?: string | null;\n turnId?: string | null;\n leaseEpoch?: number | null;\n }\n | {\n available: true;\n revision: number;\n capturedAt: string;\n turnId: string | null;\n leaseEpoch: number;\n sizeBytes: number;\n stats: WorkspaceCaptureStats;\n manifest: WorkspaceCaptureManifest | null;\n manifestUrl: WorkspaceCaptureSignedUrl | null;\n };\n// GET …/workspace/capture/file. content inline (≤256KB) OR contentUrl OR marker\n// only (tooLarge / missing blob).\nexport type GetWorkspaceCaptureFileResponse = {\n path: string;\n revision: number;\n status: GitFileStatusCode;\n hash: string | null;\n baseHash: string | null;\n sizeBytes: number;\n isBinary: boolean;\n tooLarge: boolean;\n encoding: FsEncoding | null;\n content: string | null;\n contentUrl: WorkspaceCaptureSignedUrl | null;\n};\n\n// A2 Terminal exec + PTY.\nexport type TerminalExecRequest = {\n command: string;\n cwd?: string;\n timeoutMs?: number;\n emitStream?: boolean;\n};\nexport type TerminalExecResponse = {\n stdout: string;\n stderr: string;\n exitCode: number;\n running: false;\n wallTimeSeconds: number;\n};\nexport type PtyOpenRequest = {\n cols?: number;\n rows?: number;\n cwd?: string;\n shell?: string;\n};\nexport type PtyOpenResponse = {\n ptyId: string;\n streamVia: \"sse-events\";\n supportsInput: boolean;\n};\nexport type PtyWriteRequest = { ptyId: string; data: string };\nexport type PtyResizeRequest = { ptyId: string; cols: number; rows: number };\nexport type PtyCloseRequest = { ptyId: string };\n\nexport type SessionStructuredCapabilities = {\n FileSystem: { available: boolean; readOnly: boolean; root: string };\n Terminal: { events: boolean; exec: boolean; pty: { available: boolean } };\n Git: { available: boolean; repos: string[] };\n};\n\nexport type ScheduledTaskStatus = \"active\" | \"paused\";\n\nexport type ScheduledTaskRunMode = \"new_session_per_run\" | \"reusable_session\" | \"existing_session\";\n\nexport type ScheduledTaskOverlapPolicy = \"allow_concurrent\" | \"skip\" | \"buffer_one\" | \"steer\";\n\nexport type ScheduledTaskDayOfWeek =\n | \"SUNDAY\"\n | \"MONDAY\"\n | \"TUESDAY\"\n | \"WEDNESDAY\"\n | \"THURSDAY\"\n | \"FRIDAY\"\n | \"SATURDAY\";\n\nexport type ScheduledTaskScheduleSpec =\n | { type: \"manual\" }\n | { type: \"once\"; runAt: string; timeZone: string }\n | {\n type: \"interval\";\n everySeconds: number;\n startAt?: string | undefined;\n endAt?: string | undefined;\n }\n | {\n type: \"calendar\";\n timeZone: string;\n hour: number;\n minute: number;\n daysOfWeek?: ScheduledTaskDayOfWeek[] | undefined;\n };\n\nexport type IncidentTelemetrySeriesMetadata = {\n metric: string;\n labels: string[];\n};\n\nexport type IncidentTelemetryDataRoute =\n | { kind: \"mcp\"; serverId: string }\n | { kind: \"first_party\"; tool: FirstPartyMcpToolName }\n | { kind: \"vault\"; vaultName: string; secretNames: string[] }\n | { kind: \"rig_credential_hook\"; credentialHookId: string };\n\nexport type IncidentTelemetryPreflight = {\n requiredResources: ResourceRef[];\n requiredMcpServerIds: string[];\n requiredFirstPartyMcpTools: FirstPartyMcpToolName[];\n requiredFirstPartyMcpPermissions: KnownPermission[];\n requiredRig: { name: string; credentialHookIds: string[] } | null;\n requiredVaultNames: string[];\n requiredSecretNames: string[];\n dataSource: {\n kind: \"prometheus\";\n queryPath: \"/api/v1/query\" | \"/api/v1/query_range\";\n workspaceLabel: string;\n alertSelectorLabels: string[];\n route: IncidentTelemetryDataRoute;\n requiredSeries: IncidentTelemetrySeriesMetadata[];\n availableSeries: IncidentTelemetrySeriesMetadata[];\n };\n};\n\nexport type IncidentTelemetryPreflightInput = Omit<\n IncidentTelemetryPreflight,\n | \"requiredResources\"\n | \"requiredMcpServerIds\"\n | \"requiredFirstPartyMcpTools\"\n | \"requiredFirstPartyMcpPermissions\"\n | \"requiredRig\"\n | \"requiredVaultNames\"\n | \"requiredSecretNames\"\n> & {\n requiredResources?: ResourceRef[] | undefined;\n requiredMcpServerIds?: string[] | undefined;\n requiredFirstPartyMcpTools?: FirstPartyMcpToolName[] | undefined;\n requiredFirstPartyMcpPermissions?: KnownPermission[] | undefined;\n requiredRig?: { name: string; credentialHookIds?: string[] | undefined } | null | undefined;\n requiredVaultNames?: string[] | undefined;\n requiredSecretNames?: string[] | undefined;\n};\n\nexport type ScheduledTaskAgentConfig = {\n /** Agent configuration for every generated session; omitted keeps legacy behavior. */\n agent?: AgentConfigRequest | undefined;\n /**\n * Connector accounts a person pinned for a schedule that starts its own\n * session. Each pinned pair narrows its connector; every other connector\n * uses the owner's current accounts at each run.\n */\n pinnedAccounts?: McpConnectionAccountSelection[] | undefined;\n /** Skip an occurrence instead of running without an unusable pinned account. */\n pinnedAccountsRequired?: true | undefined;\n knowledgeSource?: Extract<ScheduledTaskAction, { kind: \"knowledge_source_sync\" }> | undefined;\n bundledSkillIds?: BundledSkillId[] | undefined;\n prompt: string;\n resources: ResourceRef[];\n tools: ToolRef[];\n /**\n * Present when runs follow the workspace's default connectors (minus the\n * excluded ones) plus `tools`; absent when runs get exactly `tools`.\n */\n toolPolicy?: ScheduledTaskToolPolicy | undefined;\n metadata: Record<string, unknown>;\n slackBotConnectionId?: string | undefined;\n /** Slack channel a person chose for this task's bot posts; requires slackBotConnectionId. */\n slackBotChannelId?: string | undefined;\n model?: string | undefined;\n reasoningEffort?: ReasoningEffort | undefined;\n sandboxBackend?: SandboxBackend | undefined;\n /** Follow the workspace machine when creating each new run chat. */\n executionTarget?: \"workspace_default\" | undefined;\n machineTarget?: { targetSandboxId: string; workingDir?: string | undefined } | undefined;\n goal?: GoalSpec | undefined;\n executionClass?: \"incident_telemetry\" | undefined;\n incidentTelemetryPreflight?: IncidentTelemetryPreflight | undefined;\n maxNestedAgentDepth?: number | undefined;\n /** Seconds a run may wait on a person before the scheduler answers for it. */\n approvalTimeoutSeconds?: number | undefined;\n /** Whether the chats this task starts run unattended; see the request type. */\n unattended?: boolean | undefined;\n /** Remote MCP servers attached to each chat the task starts. */\n mcpServers?: ScheduledTaskMcpServer[] | undefined;\n /** Memory, agent reach and inline Skills of each chat the task starts. */\n memoryScope?: SessionMemoryScope | undefined;\n agentAccess?: SessionAgentAccess | undefined;\n skills?: ScheduledTaskSkill[] | undefined;\n};\n\n/** A session-create MCP server without static headers, for chats a task starts. */\nexport type ScheduledTaskMcpServer = Omit<SessionMcpServerInput, \"headers\">;\n\nexport type ScopedKnowledgeScope =\n | { kind: \"organization\"; workspaceId: null; subjectId: null }\n | { kind: \"workspace\"; workspaceId: string; subjectId: null }\n | { kind: \"personal\"; workspaceId: string | null; subjectId: string };\n\nexport type KnowledgeSourceSyncLimits = {\n maxItems: number;\n maxBytes: number;\n maxFileBytes: number;\n maxProviderRequests: number;\n maxElapsedSeconds: number;\n maxConcurrency: number;\n maxFailureDetails: number;\n};\n\nexport type ScheduledTaskAction =\n | { kind: \"agent_turn\" }\n | {\n kind: \"knowledge_source_sync\";\n sourceId: string;\n sourceGeneration: number;\n sourceLifecycleGeneration: number;\n sourceConfigGeneration: number;\n controlWorkspaceId: string;\n providerCoordinationKey: string;\n connection: {\n connectionId: string;\n connectionVersion: number;\n providerDomain: string;\n kind: ConnectionKind;\n ownerSubjectId: string;\n };\n destination: ScopedKnowledgeScope;\n initiatingSubjectId: string;\n allDescendants: boolean;\n limits: KnowledgeSourceSyncLimits;\n };\n\nexport type ScheduledTask = {\n id: string;\n accountId: string;\n workspaceId: string;\n name: string;\n /** Immutable execution owner; null for workspace/service tasks. */\n ownerSubjectId: string | null;\n /**\n * Who can see this schedule. `workspace`: everyone in the workspace.\n * `private`: only its owner; its runs create Only me chats owned by them.\n */\n visibility: SessionVisibility;\n status: ScheduledTaskStatus;\n schedule: ScheduledTaskScheduleSpec;\n temporalScheduleId: string;\n runMode: ScheduledTaskRunMode;\n overlapPolicy: ScheduledTaskOverlapPolicy;\n action: ScheduledTaskAction;\n agentConfig: ScheduledTaskAgentConfig;\n createdBy?: TurnInitiator | undefined;\n createdByContext?: TurnInitiatorContext | undefined;\n authorityRevision: number;\n executionDigest: string;\n targetSessionId: string | null;\n reusableSessionId: string | null;\n // The rig each run binds to (M3); active version resolved per fire. Null ⇒ rig-less.\n rigId: string | null;\n /** Vaults every run may resolve secret references from (the task vault is always included). */\n vaultPolicy?: VaultPolicy | undefined;\n metadata: Record<string, unknown>;\n /**\n * Present and true when the task was created locked: only its creator (the\n * same key or signed service identity) can change, run, resume or delete\n * it, never an agent. A workspace admin can still pause it.\n */\n creatorLocked?: true | undefined;\n createdAt: string;\n updatedAt: string;\n /** Read-only: what `refreshScheduledTaskAccess` would change, for a viewer who can act on it. */\n policyDrift?: ScheduledTaskPolicyDrift | null | undefined;\n /** Read-only: which accounts a run would use if it started now, for a viewer who can act on it. */\n accountPlan?: ScheduledTaskAccountPlan | undefined;\n /** Read-only: why it paused itself, or why its owner was told its runs keep failing. */\n blocker?: ScheduledTaskBlocker | undefined;\n /** Read-only: its event triggers and event run policy; absent without event triggers. */\n events?: ScheduledTaskEvents | undefined;\n};\n\n/**\n * What blocks a schedule. `paused`: no later run could start until a person\n * acts, so it paused itself; resume it once the cause is fixed. `notified`:\n * its scheduled runs kept failing or being skipped and its owner was told\n * once; it keeps running. `message` says what would unblock it.\n */\nexport type ScheduledTaskBlocker = {\n state: \"paused\" | \"notified\";\n /** Stable machine reason, such as `scheduled_session_paused`; tolerate new ones. */\n reason: string;\n message: string;\n /** The run that showed the blocker (the first of a failing streak). */\n runId: string;\n since: string;\n};\n\n/**\n * What an admin sees of someone else's Only me schedule: that it exists, whose\n * it is, how often it runs and what it costs. Never its name, prompt, settings\n * or runs.\n */\nexport type PrivateScheduledTaskSummary = {\n id: string;\n ownerSubjectId: string;\n /** The owner's display name or email, when known. */\n ownerName: string | null;\n status: ScheduledTaskStatus;\n schedule: ScheduledTaskScheduleSpec;\n lastRunAt: string | null;\n /** Usage of this schedule's runs over the last 30 days. */\n last30Days: { runs: number; creditUsd: number; estimatedProviderUsd: number };\n createdAt: string;\n};\n\n/** One connector named in a scheduled task's access report. */\nexport type ScheduledTaskAccessConnector = {\n id: string;\n name: string;\n};\n\n/**\n * A schedule that follows the workspace's default connectors at each run,\n * the way a new chat does. Connectors a person turned off stay off.\n */\nexport type ScheduledTaskToolPolicy = {\n mode: \"workspace_default\";\n excludedMcpServerIds: string[];\n};\n\n/**\n * What a scheduled task's saved connectors and Opengeni tools lack compared\n * with what its owner would get by saving it again now, plus pinned accounts\n * that can no longer be used.\n */\nexport type ScheduledTaskPolicyDrift = {\n /** Workspace default connectors that new schedules get and this one lacks. */\n missingConnectors: ScheduledTaskAccessConnector[];\n /** Connectors this schedule names that this workspace no longer sets up; refresh drops them. */\n unavailableConnectors: ScheduledTaskAccessConnector[];\n /** Default Opengeni tools missing from an agent-created task's frozen tools. */\n missingOpenGeniTools: FirstPartyMcpToolName[];\n /** Connectors whose pinned account can no longer be used; runs continue without them. */\n unavailableAccounts: ScheduledTaskAccessConnector[];\n /** Whether this viewer may run the refresh (a signed-in person, not a key or agent). */\n canRefresh: boolean;\n};\n\n/** One connector account a scheduled run would act as. */\nexport type ScheduledTaskAccountPlanAccount = {\n connectionId: string;\n label: string;\n /** `personal`: the schedule owner's own account. `shared`: a workspace account. */\n scope: \"personal\" | \"shared\";\n};\n\nexport type ScheduledTaskAccountPlanConnector = {\n id: string;\n name: string;\n /** `default`: the owner's current accounts at each run. `pinned`: only the accounts a person chose. */\n mode: \"default\" | \"pinned\";\n /** Accounts a run would use if it started now; empty when none can be used. */\n accounts: ScheduledTaskAccountPlanAccount[];\n /** Pinned accounts that can no longer be used; always empty in `default` mode. */\n unavailablePins: Array<{ connectionId: string }>;\n};\n\n/**\n * Which connector accounts a run of this schedule would use if it started\n * now, resolved at read time from the owner's live connections. Nothing here\n * is stored.\n */\nexport type ScheduledTaskAccountPlan = {\n connectors: ScheduledTaskAccountPlanConnector[];\n};\n\n/** Re-freeze with the caller's current authority; `executionDigest` is the reviewed head. */\nexport type RefreshScheduledTaskAccessRequest = {\n executionDigest: string;\n /** Default connectors and Opengeni tools to keep off; only narrows what the refresh adds. */\n leaveOut?:\n | {\n connectors?: string[] | undefined;\n openGeniTools?: FirstPartyMcpToolName[] | undefined;\n }\n | undefined;\n};\n\nexport type CreateSessionRequest = {\n /** Omitted: defaults/inheritance; []: no bundled guidance. Children cannot widen. */\n bundledSkillIds?: BundledSkillId[] | undefined;\n excludedMcpServerIds?: string[] | undefined;\n // Optional UUID preallocated by an embedding host so it can durably link its\n // projection before Opengeni admits the initial turn. Replays must retain the\n // same UUID and idempotency key.\n requestedSessionId?: string | undefined;\n /**\n * Optional usage limit for a new root task in USD micros of API-equivalent\n * model usage (null/omitted: no limit; 0: stop before the first model\n * request). Person or trusted host only. `OpenGeniClient.createSession`\n * sends a limited create with `startMode: \"standard\"`, which servers that\n * predate usage limits reject before creating or starting anything; it then\n * throws `OpenGeniSessionUsageLimitUnsupportedError`, as it does for a\n * response that does not echo the requested limit.\n */\n usageLimitMicros?: number | null | undefined;\n visibility?: SessionVisibility | undefined;\n initialMessage?: string | undefined;\n /** Exempt the new session from the idle-session archive, e.g. for a persistent agent. */\n keepLive?: boolean | undefined;\n /**\n * No person will see or answer questions until the task ends (an API\n * automation or other headless run). The agent is told so and resolves open\n * choices itself instead of asking; tools that wait for a person are not\n * offered, and a call that needs someone's approval is refused instead of\n * waiting. A person's later message does not change it; turn it off with\n * `updateSessionUnattended`. Not inherited by child sessions, and a fork\n * reads as attended. Servers that predate it ignore it.\n */\n unattended?: boolean | undefined;\n /**\n * The new chat's name, description and avatar, as if a person set them (a\n * bot started from a template, for example). Display metadata only; never\n * sent to the model.\n */\n profile?:\n | {\n title?: string | undefined;\n description?: string | undefined;\n avatar?: SessionAvatar | undefined;\n }\n | undefined;\n /**\n * `realtime` creates an idle session shell so realtime voice can be the\n * first interaction. `standard` is the explicit default; `createSession`\n * sends it with a usage limit so servers that predate limits reject the\n * create instead of starting uncapped work.\n */\n startMode?: \"realtime\" | \"standard\" | undefined;\n /** Model-visible application context attached to the initial user message; omitted by standard timeline rendering. */\n modelContext?: string | undefined;\n /**\n * Tools `modelContext` is for, such as the tool that reaches the open\n * document it names, or the tools an application's MCP server publishes for\n * the record it names (by their published names). The first turn loads them\n * before its first model request, as a tool search by name would, so it can\n * use them without searching; the session's tools are unchanged. Decided\n * once at creation; names outside the session's tool selection are ignored.\n */\n modelContextTools?: string[] | undefined;\n /**\n * IANA time zone of the person sending `initialMessage` (for example\n * `Europe/Oslo`), so the model sees the message's local time. In a browser\n * or app the client fills in the device's zone when this is omitted;\n * invalid names are dropped.\n */\n timeZone?: string | undefined;\n // Per-session agent persona/system instructions (org-visible metadata, not a\n // secret). Delivered system-level, composed AFTER the per-workspace persona —\n // how a host supplies per-agent-type prompts without leaking them into the\n // user-visible timeline. Trimmed, non-empty, max 65536 chars.\n instructions?: string | undefined;\n /** Immutable normalized prompt-policy role; distinct from membership roles. */\n policyRole?: string | undefined;\n resources?: ResourceRef[] | undefined;\n /** Inline skills fixed onto this session; omitted children inherit them. */\n skills?: SessionSkillInput[] | undefined;\n /** Installed session-selected Skill identities to freeze onto this session at creation. */\n installedSkillIds?: string[] | undefined;\n /**\n * MCP servers to select. Omitted follows the workspace defaults; an explicit\n * array (including `[]`) is an exact allow-list over workspace/deployment\n * servers. Servers attached in this request's `mcpServers` are always\n * selected; list one here only to set `eager`/`optional`.\n */\n tools?: ToolRef[] | undefined;\n metadata?: Record<string, unknown> | undefined;\n model?: string | undefined;\n reasoningEffort?: ReasoningEffort | undefined;\n latencyMode?: LatencyMode | undefined;\n sandboxBackend?: SandboxBackend | undefined;\n // The enrolled machine (a sandbox id) to run this session on; seeds the\n // active-sandbox pointer at creation so the first turn lands on it.\n targetSandboxId?: string | undefined;\n // Host working directory for a connected-machine target (the agent runs here;\n // default = the machine's launch dir). Ignored for managed sandboxes.\n workingDir?: string | undefined;\n // The rig to bind this session to (M3). Its active version is frozen onto the\n // session at create. Omitted ⇒ the workspace default rig when set, else rig-less.\n rigId?: string | undefined;\n /**\n * The session goal. When omitted on a top-level `unattended: true` create\n * with an `initialMessage`, Opengeni sets a goal that stands for that\n * message, so the run keeps going until the agent completes or pauses it.\n * `null` creates the session without a goal.\n */\n goal?: GoalSpec | null | undefined;\n clientEventId?: string | undefined;\n // Workspace-scoped CREATE idempotency key: forward a STABLE value to make a\n // double-submit/retry of the same logical create collapse to one session.\n // Distinct from the per-call clientEventId.\n idempotencyKey?: string | undefined;\n // Exact actor-private pre-session draft revision represented by this create.\n // The server consumes only this revision after durable initialization.\n expectedNewSessionDraftRevision?: number | undefined;\n agentLearning?: import(\"@opengeni/contracts\").AgentLearningOverrides | undefined;\n maxNestedAgentDepth?: number | undefined;\n firstPartyMcpPermissions?: string[] | undefined;\n firstPartyMcpTools?: FirstPartyMcpToolName[] | undefined;\n /**\n * One agent configuration: capabilities, identity, instructions alias and\n * renderer. Omission keeps today's behavior (a child inherits its parent's).\n * Children may only narrow. Requires the server's admission switch.\n */\n agent?: AgentConfigRequest | undefined;\n mcpServers?: SessionMcpServerInput[] | undefined;\n mcpApprovalPolicies?: Record<string, SessionMcpApprovalPolicy> | undefined;\n connectionAccounts?: McpConnectionAccountSelection[] | undefined;\n /** Atomically attach the server-derived personal rig closure to the initial turn. */\n personalResourceAttachment?: PersonalResourceAttachmentIntent | undefined;\n // Shared-sandbox placement (mirror of `@opengeni/contracts` CreateSessionRequest.sandbox,\n // addendum 05 §D.1). Three-way union; OMITTED ⇒ the context-dependent server default\n // (from inside a session → \"shared\" with the creator's box, top-level → \"new\").\n // - \"shared\": join the CREATOR's box (requires a parent session; top-level → 422).\n // - \"new\": mint a fresh singleton box (group ≡ the new session's id).\n // - {groupId}: join a SPECIFIC sibling group in THIS workspace (manager fan-out).\n sandbox?: \"shared\" | \"new\" | { groupId: string } | undefined;\n // --- Agent access scope, end-user label, memory scope ---------------------\n // Mirror of the contracts additions that land with the session agent-access\n // release. Which other sessions the agent may reach; defaults to \"workspace\"\n // on the platform (the chat facade defaults to \"session\").\n agentAccess?: SessionAgentAccess | undefined;\n /** Opaque end-user label inside the workspace. Not a subject, not authority. */\n /** Select identity with server-side asUser(), not session creation data. */\n scopeSubjectId?: never;\n /** Which Memory the agent reads and where it saves; \"user\" requires `scopeSubjectId`. */\n memoryScope?: SessionMemoryScope | undefined;\n};\n\nexport type SessionAgentAccess = \"session\" | \"user\" | \"workspace\";\nexport type SessionScopeSubjectId = string;\nexport type SessionMemoryScope = \"workspace\" | \"user\" | \"off\";\n\n// --- Access, workspaces, API keys -------------------------------------------\n\nexport const KNOWN_PERMISSIONS = [\n \"account:read\",\n \"account:admin\",\n \"members:manage\",\n \"workspace:create\",\n \"billing:read\",\n \"billing:manage\",\n \"workspace:read\",\n \"workspace:admin\",\n \"sessions:create\",\n \"sessions:read\",\n \"sessions:control\",\n // sandbox workspace (mirror of @opengeni/contracts Permission). stream:view is\n // strictly broader than sessions:read (un-redacted pixels); stream:control is\n // the never-granted-v1 raw-input plane; stream:acknowledge is the secret-leak\n // consent gate.\n \"stream:view\",\n \"stream:control\",\n \"stream:acknowledge\",\n \"files:upload\",\n \"files:read\",\n \"files:write\",\n \"terminal:attach\",\n \"documents:manage\",\n \"documents:search\",\n \"scheduled_tasks:manage\",\n \"scheduled_tasks:run\",\n \"github:manage\",\n \"github:use\",\n \"api_keys:manage\",\n \"usage_allowances:manage\",\n \"connections:read\",\n \"connections:write\",\n \"connections:personal\",\n \"capabilities:manage\",\n \"environments:manage\",\n \"environments:use\",\n \"variable-sets:list\",\n \"variable-sets:read\",\n \"variable-sets:write\",\n \"variable-sets:manage\",\n \"variable-sets:attach\",\n \"variable-sets:use\",\n \"secrets:list\",\n \"secrets:read\",\n \"secrets:write\",\n \"secrets:use\",\n \"mcp_servers:attach\",\n \"codemode:call\",\n \"goals:manage\",\n \"enrollments:read\",\n \"enrollments:manage\",\n \"rigs:use\",\n \"rigs:manage\",\n \"artifacts:read\",\n \"artifacts:publish\",\n] as const;\n\nexport type KnownPermission = (typeof KNOWN_PERMISSIONS)[number];\n\n/**\n * Permissions the SDK knows about today, kept open so a newer Opengeni server\n * can introduce permissions without breaking older SDK consumers.\n */\nexport type Permission = KnownPermission | (string & {});\n\nexport type FirstPartyMcpToolName =\n | \"knowledge_search\"\n | \"knowledge_prepare_save\"\n | \"knowledge_get\"\n | \"knowledge_browse\"\n | \"knowledge_save\"\n | \"knowledge_retain_file\"\n | \"meetings_search\"\n | \"meeting_read\"\n | \"meeting_notes_save\"\n | \"knowledge_retain_message\"\n | \"knowledge_archive\"\n | \"instruction_policy_save\"\n | \"instruction_policy_get\"\n | \"set_session_title\"\n | \"notify_user\"\n | \"notification_withdraw\"\n | \"inbox_tidy\"\n | \"call_user\"\n | \"goal_set\"\n | \"goal_update\"\n | \"goal_progress\"\n | \"wait_for_input\"\n | \"goal_complete\"\n | \"goal_pause\"\n | \"goal_resume\"\n | \"memory_search\"\n | \"memory_save\"\n | \"memory_correct\"\n | \"preference_registry_summary\"\n | \"preference_registry_get\"\n | \"task_notes_list\"\n | \"task_note_save\"\n | \"task_note_archive\"\n | \"task_note_replace\"\n | \"work_claim_upsert\"\n | \"work_claim_release\"\n | \"knowledge_propose\"\n | \"knowledge_correct\"\n | \"task_note_promote_knowledge\"\n | \"task_note_promote_instruction_policy\"\n | \"task_note_promote_preference\"\n | \"instruction_policy_propose\"\n | \"preference_propose\"\n | \"remember\"\n | \"remember_confirm\"\n | \"company_profile_propose\"\n | \"company_profile_confirm\"\n | \"sandboxes_list\"\n | \"sandbox_attach\"\n | \"sandbox_swap\"\n | \"run_on\"\n | \"sandbox_provision\"\n | \"connected_machine_remove\"\n | \"connected_machine_enroll_token\"\n | \"connected_machine_enable_screen_control\"\n | \"project_list\"\n | \"project_get\"\n | \"project_create\"\n | \"project_update\"\n | \"project_reorder\"\n | \"project_delete\"\n | \"session_set_project\"\n | \"admin_actions_search\"\n | \"admin_action_describe\"\n | \"admin_action_call\"\n | \"rig_list\"\n | \"rig_get\"\n | \"rig_propose_change\"\n | \"rig_verify\"\n | \"rig_promote\"\n | \"sessions_list\"\n | \"session_get\"\n | \"session_set_model\"\n | \"session_events\"\n | \"session_wait\"\n | \"command_read\"\n | \"command_wait\"\n | \"session_create\"\n | \"session_send_message\"\n | \"session_message_status\"\n | \"session_target_get\"\n | \"session_target_set\"\n | \"session_pause\"\n | \"session_resume\"\n | \"session_steer\"\n | \"session_human_input_respond\"\n | \"set_other_session_title\"\n | \"bot_template_save\"\n | \"interaction_discover\"\n | \"browser_open\"\n | \"browser_tabs\"\n | \"browser_observe\"\n | \"browser_act\"\n | \"browser_read\"\n | \"browser_screenshot\"\n | \"browser_clipboard\"\n | \"browser_debug\"\n | \"browser_downloads\"\n | \"browser_download_save\"\n | \"browser_record\"\n | \"browser_auth\"\n | \"interaction_request_human\"\n | \"browser_identity\"\n | \"browser_publish\"\n | \"browser_lifecycle\"\n | \"computer_open\"\n | \"computer_targets\"\n | \"computer_observe\"\n | \"computer_clipboard\"\n | \"computer_act\"\n | \"computer_lifecycle\"\n | \"excel_run\"\n | \"secret_search\"\n | \"secret_save\"\n | \"secret_get\"\n | \"secret_move\"\n | \"secret_delete\"\n | \"secret_profile_get\"\n | \"secret_profile_set\"\n | \"variable_set_list\"\n | \"environment_list\"\n | \"variable_set_get_variable\"\n | \"variable_set_set_variable\"\n | \"environment_set_variable\"\n | \"capability_catalog_search\"\n | \"capability_authorization_request\"\n | \"custom_mcp_setup_request\"\n | \"github_connect_link\"\n | \"github_repositories_list\"\n | \"social_connections_list\"\n | \"social_posts_recent\"\n | \"social_daily_analysis_context\"\n | \"social_search_live\"\n | \"social_mentions_live\"\n | \"social_thread_fetch\"\n | \"social_posts_sync\"\n | \"social_post_reply\"\n | \"x_accounts_list\"\n | \"x_search_live\"\n | \"x_mentions_live\"\n | \"x_thread_fetch\"\n | \"x_posts_sync\"\n | \"x_post_reply\"\n | \"reddit_accounts_list\"\n | \"reddit_search_live\"\n | \"reddit_mentions_live\"\n | \"reddit_thread_fetch\"\n | \"reddit_posts_sync\"\n | \"reddit_post_reply\"\n | \"scheduled_tasks_list\"\n | \"scheduled_tasks_get\"\n | \"scheduled_tasks_create\"\n | \"scheduled_tasks_update\"\n | \"scheduled_tasks_pause\"\n | \"scheduled_tasks_resume\"\n | \"scheduled_tasks_trigger\"\n | \"scheduled_tasks_delete\"\n | \"scheduled_task_runs_list\"\n | \"event_sources_list\"\n | \"events_get\"\n | \"event_sources_create_webhook\"\n | \"event_sources_update\"\n | \"event_sources_delete\"\n | \"slack_bot_list_channels\"\n | \"slack_bot_search\"\n | \"slack_bot_channel_history\"\n | \"slack_bot_thread_replies\"\n | \"slack_bot_list_users\"\n | \"slack_bot_list_files\"\n | \"slack_bot_file_info\"\n | \"slack_bot_file_content\"\n | \"slack_bot_upload_file\"\n | \"slack_bot_post_message\"\n | \"slack_bot_delete_message\"\n | \"slack_bot_prepare_message\"\n | \"slack_bot_send_prepared_message\"\n | \"slack_agent_handoff\"\n | \"slack_agent_suggest\"\n | \"slack_agent_chats\"\n | \"slack_agent_propose\"\n | \"fiken_companies_list\"\n | \"fiken_contacts_list\"\n | \"fiken_contact_create\"\n | \"fiken_products_list\"\n | \"fiken_invoices_list\"\n | \"fiken_invoice_get\"\n | \"fiken_invoice_draft_create\"\n | \"fiken_bank_accounts_list\"\n | \"fiken_purchases_list\"\n | \"fiken_sales_list\"\n | \"atlassian_sources_list\"\n | \"atlassian_search\"\n | \"atlassian_get\"\n | \"sandbox_file_publish\"\n | \"artifacts_list\"\n | \"artifacts_get_source\"\n | \"artifacts_prepare_upload\"\n | \"artifacts_create\"\n | \"artifacts_publish\"\n | \"artifacts_rollback\"\n | \"artifacts_archive\"\n | \"artifacts_restore\"\n | \"site_data_describe\"\n | \"site_data_define_collection\"\n | \"site_data_query\"\n | \"site_data_write\"\n | \"site_data_import\"\n | \"site_data_export\"\n | \"site_data_reset\"\n | \"site_files_list\"\n | \"site_files_upload\"\n | \"site_files_delete\"\n | \"site_publication_get\"\n | \"site_publication_update\"\n | \"site_publication_apply_fix\"\n | \"site_hostname_check\"\n | \"site_sql_inspect\"\n | \"site_sql_enable\"\n | \"site_sql_migrate\"\n | \"site_sql_define_query\"\n | \"site_sql_query\"\n | \"site_sql_run\"\n | \"site_sql_execute\"\n | \"site_sql_export\"\n | \"site_sql_import\"\n | \"site_sql_reset\"\n | \"editable_artifact_list\"\n | \"editable_artifact_create\"\n | \"editable_artifact_import\"\n | \"editable_artifact_get\"\n | \"editable_artifact_inspect\"\n | \"editable_artifact_apply\"\n | \"editable_artifact_export\"\n | \"editable_artifact_export_status\";\n\nexport type ProductAccessMode = \"local\" | \"configured\" | \"managed\";\n\nexport type ModelCapabilitySupportV1 = \"supported\" | \"unsupported\" | \"unknown\";\n\nexport type ModelCapabilityStateV1 = {\n upstream: ModelCapabilitySupportV1;\n runnable: boolean;\n};\n\nexport type ModelCapabilitiesV1 = {\n reasoning: ModelCapabilityStateV1 & {\n efforts: ReasoningEffort[];\n defaultEffort: ReasoningEffort | null;\n required: boolean;\n };\n functionCalling: ModelCapabilityStateV1;\n structuredOutput: ModelCapabilityStateV1;\n hostedTools: {\n webSearch: ModelCapabilityStateV1;\n xSearch: ModelCapabilityStateV1;\n codeExecution: ModelCapabilityStateV1;\n };\n inputModalities: Array<\"text\" | \"image\" | \"audio\">;\n inputFileMediaTypes?: string[] | undefined;\n outputModalities: Array<\"text\" | \"image\" | \"audio\">;\n transports: {\n sse: ModelCapabilityStateV1;\n responsesWebSocket: ModelCapabilityStateV1;\n realtimeAudio: ModelCapabilityStateV1;\n };\n promptCaching?:\n | (ModelCapabilityStateV1 & {\n mode: \"implicit\" | \"automatic\" | \"none\";\n })\n | undefined;\n latencyModes: Array<{\n id: \"standard\" | \"priority\" | \"fast\" | \"ultrafast\";\n upstream: ModelCapabilitySupportV1;\n runnable: boolean;\n billingMultiplierBps?: number | undefined;\n }>;\n};\n\nexport type ModelCredentialSourceV1 =\n | { kind: \"deployment\"; mechanism: \"api_key\" | \"azure_ad_bearer\" }\n | { kind: \"connected_subscription\"; provider: \"codex\" | \"xai\" | \"claude\" }\n | { kind: \"workspace_connection\"; mechanism: \"api_key\" }\n | { kind: \"organization_connection\"; mechanism: \"api_key\" };\n\nexport type ModelBillingAttributionV1 = {\n upstreamPayer: \"deployment\" | \"workspace\" | \"organization\" | \"connected_subscription\";\n metering: \"opengeni_credits\" | \"external\";\n};\n\nexport type ModelCostClassV1 = \"free\" | \"credits\" | \"subscription\" | \"workspace\" | \"organization\";\n\nexport type ModelPricingV1 = {\n inputMicrosPerMillionTokens: number;\n cachedInputMicrosPerMillionTokens?: number | undefined;\n cacheWriteMicrosPerMillionTokens?: number | undefined;\n outputMicrosPerMillionTokens: number;\n marginBps?: number | undefined;\n};\n\nexport type ModelPricingScheduleV1 = {\n default: ModelPricingV1;\n inputTokenTiers?:\n | Array<{\n minimumInputTokens: number;\n pricing: ModelPricingV1;\n }>\n | undefined;\n};\n\n/**\n * One model a client may select at send time, plus the provider that serves it.\n * The wire API (`responses` | `chat`) lets a client reason about provider\n * capabilities; the provider id/label drive a picker's grouping. Mirrors the\n * `ClientModel` shape projected into `ClientConfig` by the server.\n */\nexport type ClientModel = {\n id: string;\n label: string;\n /** Optional curated compact label for dense UI (e.g. mobile composer). */\n shortLabel?: string | undefined;\n /** Optional HTTPS maker logo supplied by the model catalog. */\n logoUrl?: string | undefined;\n /** Provider id (e.g. `openai`, `azure`, or a registry provider id). */\n provider: string;\n providerLabel: string;\n api: \"responses\" | \"chat\" | \"anthropic-messages\";\n source?: \"opengeni\" | \"codex\" | \"supergrok\" | \"workspace_gateway\" | \"openrouter\" | undefined;\n contextWindowTokens?: number | undefined;\n schemaVersion?: 1 | undefined;\n aliases?: string[] | undefined;\n deployment?:\n | {\n upstreamModelId: string;\n wireApi: \"responses\" | \"chat\" | \"anthropic-messages\";\n }\n | undefined;\n executionLimits?:\n | {\n contextWindowTokens: number | null;\n effectiveContextWindowTokens: number | null;\n autoCompactTokenLimit: number | null;\n toolOutputTruncationTokens: number | null;\n }\n | undefined;\n credentialSource?: ModelCredentialSourceV1 | undefined;\n billing?: ModelBillingAttributionV1 | undefined;\n cost?: ModelCostClassV1 | undefined;\n capabilities?: ModelCapabilitiesV1 | undefined;\n pricing?: ModelPricingScheduleV1 | undefined;\n definitionVersion?: string | undefined;\n /**\n * Transient availability hint. `reason: \"region_restricted\"`: the workspace\n * is EU-only and this model's route is not EU by its residency record.\n */\n availability?: ModelAvailabilityV1 | undefined;\n /** Where this route processes data, and how that is known. Absent means unknown, never EU. */\n residency?: ClientModelResidencyV1 | undefined;\n};\n\nexport type ModelAvailabilityV1 = {\n status: \"available\" | \"unavailable\" | \"degraded\" | \"unknown\";\n selectable: boolean;\n reason:\n | \"missing_credential\"\n | \"needs_reauth\"\n | \"credential_not_ready\"\n | \"not_entitled\"\n | \"provider_unhealthy\"\n | \"policy_blocked\"\n | \"unsupported\"\n | \"credits_disabled\"\n | \"region_restricted\"\n | null;\n checkedAt: string | null;\n};\n\nexport type ModelCredentialReadinessV1 = {\n status: \"ready\" | \"not_ready\" | \"error\";\n reason:\n | \"missing_credential\"\n | \"needs_reauth\"\n | \"prerequisites_missing\"\n | \"resolver_error\"\n | \"observation_stale\"\n | null;\n basis: \"configuration\" | \"connection\" | \"resolver\";\n checkedAt: string | null;\n};\n\nexport type WorkspaceModelCatalogModel = ClientModel & {\n /** Workspace preference, separate from immutable model execution limits. */\n compactionPolicy?:\n | {\n defaultTokens: number;\n /** This workspace's own limit; null follows the organization's or the model's default. */\n overrideTokens: number | null;\n /** The organization's limit this workspace follows while it sets none. */\n organizationTokens?: number | null | undefined;\n effectiveTokens: number;\n minimumTokens: number;\n maximumTokens: number;\n }\n | undefined;\n credentialReadiness: ModelCredentialReadinessV1;\n creditFunding?: \"promotional\" | \"general\" | \"unavailable\" | undefined;\n /**\n * Exact verdict of the policy the workspace runs with (its own lists within\n * its organization's, and its credit switch), without exposing provider\n * identity.\n */\n policyAllowed?: boolean | undefined;\n /**\n * False when the organization's allowlist, a ceiling the workspace's own\n * list can't widen, excludes the model. Absent when the organization allows\n * every model, and from older servers. Ignores the credit switch.\n */\n organizationAllowed?: boolean | undefined;\n availability: ModelAvailabilityV1;\n};\n\n/** Why a new chat or scheduled task without an explicit model gets its default. */\nexport type DefaultModelSelectionSource =\n | \"workspace\"\n | \"organization\"\n | \"subscription\"\n | \"credits\"\n | \"deployment\";\n\nexport type DefaultModelSelection = {\n model: string;\n reasoningEffort: ReasoningEffort;\n source: DefaultModelSelectionSource;\n};\n\nexport type WorkspaceModelCatalogResponse = {\n models: WorkspaceModelCatalogModel[];\n /** Default for new chats and scheduled tasks that name no model. */\n defaultSelection?: DefaultModelSelection | undefined;\n /**\n * The default this workspace would use once its organization holds an\n * Opengeni credit balance. Null when the deployment does not bill credits.\n */\n creditsSelection?: DefaultModelSelection | null | undefined;\n};\n\nexport type WorkspaceGatewayCustomModel = {\n id: string;\n upstreamModelId: string;\n label: string | null;\n version: number;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type WorkspaceGatewayCustomModelsResponse = {\n models: WorkspaceGatewayCustomModel[];\n};\n\nexport type CreateWorkspaceGatewayCustomModelRequest = {\n operationId: string;\n upstreamModelId: string;\n label?: string | undefined;\n};\n\nexport type DeleteWorkspaceGatewayCustomModelRequest = {\n expectedVersion: number;\n operationId: string;\n};\n\nexport type WorkspaceOpenRouterCustomModel = WorkspaceGatewayCustomModel;\n\nexport type WorkspaceOpenRouterCustomModelsResponse = {\n models: WorkspaceOpenRouterCustomModel[];\n};\n\nexport type CreateWorkspaceOpenRouterCustomModelRequest = CreateWorkspaceGatewayCustomModelRequest;\n\nexport type DeleteWorkspaceOpenRouterCustomModelRequest = DeleteWorkspaceGatewayCustomModelRequest;\n\nexport type WorkspaceOpperCustomModel = WorkspaceGatewayCustomModel;\n\nexport type WorkspaceOpperCustomModelsResponse = {\n models: WorkspaceOpperCustomModel[];\n};\n\nexport type CreateWorkspaceOpperCustomModelRequest = CreateWorkspaceGatewayCustomModelRequest;\n\nexport type DeleteWorkspaceOpperCustomModelRequest = DeleteWorkspaceGatewayCustomModelRequest;\n\n/** Model connection kinds that carry a per-connection access policy. */\nexport type ModelConnectionAccessKind =\n | \"codex\"\n | \"supergrok\"\n | \"vercel_gateway\"\n | \"openrouter\"\n | \"anthropic\"\n | \"claude_subscription\"\n | \"opper\"\n | \"openai\"\n | \"azure_openai\";\n\nexport type OrganizationModelProviderKind =\n | \"vercel_gateway\"\n | \"openrouter\"\n | \"anthropic\"\n | \"claude_subscription\"\n | \"opper\"\n /** The organization's ElevenLabs key, for Eleven Realtime voices. */\n | \"elevenlabs\"\n | \"openai\"\n | \"azure_openai\";\n\n/** Organization providers whose key runs models, with custom models to choose. */\nexport type OrganizationModelCatalogProviderKind = Exclude<\n OrganizationModelProviderKind,\n \"elevenlabs\"\n>;\n\nexport type ClaudeUsageWindow = {\n id:\n | \"five_hour\"\n | \"seven_day\"\n | \"seven_day_opus\"\n | \"seven_day_sonnet\"\n | \"seven_day_overage_included\"\n | \"overage\";\n usedPercent: number | null;\n resetsAt: string | null;\n status: \"allowed\" | \"allowed_warning\" | \"rejected\" | null;\n observedAt: string;\n source?: \"response_headers\" | \"provider\" | undefined;\n};\nexport type ClaudeUsageRequestStatus = {\n status: ClaudeUsageWindow[\"status\"];\n resetsAt: string | null;\n representativeClaim: ClaudeUsageWindow[\"id\"] | null;\n overageStatus: ClaudeUsageWindow[\"status\"];\n overageResetsAt: string | null;\n upstreamModelId: string | null;\n observedAt: string;\n source?: \"response_headers\" | \"provider\" | undefined;\n};\nexport type { SubscriptionUsagePool, SubscriptionUsagePoolsResponse } from \"@opengeni/contracts\";\n\nexport type ClaudeSubscriptionUsage = {\n connected: boolean;\n credentialVersion: number | null;\n windows: ClaudeUsageWindow[];\n observedAt: string | null;\n source: \"response_headers\" | \"provider\" | null;\n refreshStatus: \"not_checked\" | \"available\" | \"scope_required\" | \"unavailable\" | \"reconnect\";\n refreshCheckedAt: string | null;\n requestStatus?: ClaudeUsageRequestStatus | null | undefined;\n requestRestrictions?: ClaudeUsageRequestStatus[] | undefined;\n};\n\nexport type OrganizationModelProviderConnection = {\n providerKind: OrganizationModelProviderKind;\n status: \"active\" | \"revoked\";\n version: number;\n /** Azure OpenAI only: the non-secret `https://<resource>.openai.azure.com/openai/v1` endpoint. */\n endpoint?: string | undefined;\n /** Azure OpenAI only: how the connection signs in. */\n authMethod?: OrganizationModelProviderAuthMethod | undefined;\n createdAt: string;\n updatedAt: string;\n};\n\n/**\n * How an organization connection signs in: an API key, or for Azure OpenAI\n * Microsoft Entra ID as the organization's own app or this deployment's\n * identity (only when the deployment operator offers it).\n */\nexport type OrganizationModelProviderAuthMethod =\n | \"api_key\"\n | \"entra_client_secret\"\n | \"entra_deployment_identity\";\n\n/** Azure OpenAI only: a Microsoft Entra ID sign-in sent instead of `apiKey`. */\nexport type OrganizationModelProviderEntraAuthentication =\n | { method: \"entra_client_secret\"; tenantId: string; clientId: string; clientSecret: string }\n | { method: \"entra_deployment_identity\" };\n\nexport type UpsertOrganizationModelProviderConnectionRequest = {\n operationId: string;\n expectedVersion?: number | undefined;\n /** The provider key. Send it, or `authentication`, not both. */\n apiKey?: string | undefined;\n /** Azure OpenAI only: sign in with Microsoft Entra ID instead of `apiKey`. */\n authentication?: OrganizationModelProviderEntraAuthentication | undefined;\n /** Required for `azure_openai` (its resource endpoint); refused for every other kind. */\n endpoint?: string | undefined;\n claudeIdentity?: { accountUuid: string; deviceId: string } | undefined;\n};\n\nexport type RevokeOrganizationModelProviderConnectionRequest = {\n operationId: string;\n expectedVersion: number;\n};\n\nexport type OrganizationProviderCustomModel = WorkspaceGatewayCustomModel;\nexport type OrganizationProviderCustomModelsResponse = {\n models: OrganizationProviderCustomModel[];\n};\nexport type CreateOrganizationProviderCustomModelRequest = CreateWorkspaceGatewayCustomModelRequest;\nexport type DeleteOrganizationProviderCustomModelRequest = DeleteWorkspaceGatewayCustomModelRequest;\n\n/**\n * The workspace's hard model/provider allowlist. `null` means unrestricted for\n * that dimension; an empty array is an explicit total block. A model runs only\n * when both this list and `organization` allow it.\n */\nexport type WorkspaceModelAccessPolicy = {\n allowedProviders: string[] | null;\n allowedModels: string[] | null;\n /**\n * Where the policy comes from: the workspace's own, the organization's\n * default it follows, or no restriction. Absent from older servers.\n */\n source?: \"workspace\" | \"organization\" | \"none\" | undefined;\n /**\n * The organization's list: what the workspace uses without its own policy,\n * and a ceiling its own policy can only narrow.\n */\n organization?: {\n allowedProviders: string[] | null;\n allowedModels: string[] | null;\n } | null;\n /**\n * The workspace's credit switch (its `allowCreditModels` setting). False\n * blocks every model billed in Opengeni credits, including ones added later,\n * whichever allowlist applies. Absent from older servers; treat as true.\n */\n allowCreditModels?: boolean | undefined;\n};\n\n/**\n * Model defaults every workspace in an organization follows until it sets its\n * own (`GET/PATCH /v1/organizations/:id/model-defaults`, owners and admins).\n * The allowlists are the exception: a ceiling every workspace stays within,\n * which a workspace's own allowlist can only narrow.\n */\nexport type OrganizationModelDefaults = {\n sessionDefaults: { model: string; reasoningEffort: ReasoningEffort } | null;\n allowedProviders: string[] | null;\n allowedModels: string[] | null;\n modelCompactionThresholds: Record<string, number>;\n /** Voice settings by realtime model id, for workspaces without their own. */\n realtimeVoice: Record<string, RealtimeVoiceSettings>;\n /**\n * The voice model new voice conversations start with in workspaces without\n * their own choice, until the person picks one; null leaves it automatic.\n */\n realtimeDefaultModel: string | null;\n updatedAt: string | null;\n};\n\n/**\n * Field-by-field update; compaction and voice settings merge by model id and\n * null resets one model. `realtimeDefaultModel: null` makes the voice model\n * automatic again.\n */\nexport type UpdateOrganizationModelDefaultsRequest = {\n sessionDefaults?: { model: string; reasoningEffort: ReasoningEffort } | null | undefined;\n modelPolicy?:\n | {\n allowedProviders?: string[] | null | undefined;\n allowedModels?: string[] | null;\n }\n | null\n | undefined;\n modelCompactionThresholds?: Record<string, number | null> | undefined;\n realtimeVoice?: Record<string, RealtimeVoiceSettings | null> | undefined;\n realtimeDefaultModel?: SessionRealtimeModel | null | undefined;\n};\n\n/** A model-account setting an organization sets, and may lock for every workspace. */\nexport type ModelAccountSettingKey =\n | \"rotation\"\n | \"providers\"\n | \"crossProviderFailover\"\n | \"fallbackOrder\"\n | \"personalConnectionsAllowed\"\n | \"personalFallbackAllowed\";\n\n/**\n * Where an effective value comes from: the organization, this workspace's\n * override, or the organization with a lock workspaces cannot override.\n */\nexport type ModelAccountSettingSource = \"organization\" | \"workspace\" | \"locked\";\n\nexport type ModelAccountRotationMode = \"spread\" | \"primary_first\";\n\n/** Effective model-account settings. */\nexport type ModelAccountSettingValues = {\n /** How the shared core spreads load across eligible accounts, per provider. */\n rotation: Record<\n string,\n {\n mode: ModelAccountRotationMode;\n primaryConnectionId?: string | null | undefined;\n }\n >;\n providers: Record<\n string,\n {\n /** @deprecated Never set: every account that reaches a workspace serves it. */\n inferenceSource?: \"automatic\" | \"workspace\" | \"organization\" | undefined;\n /** @deprecated Always true: every account that reaches a workspace serves it. */\n useOrganizationAccounts: boolean;\n enabled: boolean;\n }\n >;\n crossProviderFailover: boolean;\n /** Ordered fallback models for a preferred model. */\n fallbackOrder: Record<string, string[]>;\n personalConnectionsAllowed: boolean;\n /** Permit a person's opt-in fallback; accepted background work retains its captured authority. */\n personalFallbackAllowed: boolean;\n};\n\n/** One source per setting and, for map-valued settings, per entry. */\nexport type ModelAccountSettingsView = {\n values: ModelAccountSettingValues;\n sources: Record<ModelAccountSettingKey, ModelAccountSettingSource>;\n entrySources: {\n rotation: Record<string, \"organization\" | \"workspace\">;\n providers: Record<string, \"organization\" | \"workspace\">;\n fallbackOrder: Record<string, \"organization\" | \"workspace\">;\n };\n};\n\n/** `GET/PATCH /v1/organizations/:id/model-account-settings` (owners and admins). */\nexport type OrganizationModelAccountSettings = {\n organizationId: string;\n values: ModelAccountSettingValues;\n locked: ModelAccountSettingKey[];\n version: number;\n updatedAt: string | null;\n /**\n * False when this deployment doesn't switch models when subscriptions run\n * out, so `crossProviderFailover` has no effect here. Absent from older servers.\n */\n crossProviderFailoverAvailable?: boolean | undefined;\n};\n\n/**\n * Organization change: omitted fields are kept; `fallbackOrder` and `locked`\n * replace the stored value. Locking a setting clears every workspace override of it.\n */\nexport type UpdateOrganizationModelAccountSettingsRequest = {\n crossProviderFailover?: boolean | undefined;\n fallbackOrder?: Record<string, string[]> | undefined;\n personalConnectionsAllowed?: boolean | undefined;\n personalFallbackAllowed?: boolean | undefined;\n rotation?: Record<string, { mode: ModelAccountRotationMode }> | undefined;\n locked?: ModelAccountSettingKey[] | undefined;\n /** Refuse the write (409) if the settings changed since this version was read. */\n expectedVersion?: number | undefined;\n};\n\n/** `GET/PATCH /v1/workspaces/:id/model-account-settings`. */\nexport type WorkspaceModelAccountSettings = ModelAccountSettingsView & {\n workspaceId: string;\n locked: ModelAccountSettingKey[];\n /** The workspace's stored overrides; null follows the organization. */\n overrides: {\n rotation: Record<string, unknown> | null;\n providers: Record<string, unknown> | null;\n crossProviderFailover: boolean | null;\n fallbackOrder: Record<string, string[]> | null;\n personalConnectionsAllowed: boolean | null;\n personalFallbackAllowed: boolean | null;\n };\n version: number;\n updatedAt: string | null;\n canEdit: boolean;\n /** As on the organization's settings: false when switching models is off here. */\n crossProviderFailoverAvailable?: boolean | undefined;\n};\n\n/**\n * Workspace change: `null` follows the organization again; `fallbackOrder`\n * and `rotation` change entry by entry. A locked setting answers 409.\n */\nexport type UpdateWorkspaceModelAccountSettingsRequest = {\n crossProviderFailover?: boolean | null | undefined;\n personalConnectionsAllowed?: boolean | null | undefined;\n personalFallbackAllowed?: boolean | null | undefined;\n fallbackOrder?: Record<string, string[] | null> | null | undefined;\n rotation?: Record<string, { mode: ModelAccountRotationMode } | null> | null | undefined;\n expectedVersion?: number | undefined;\n};\n\n/** Every shared workspace's effective settings and sources, one page. */\nexport type ModelAccountSettingsOverview = {\n organization: OrganizationModelAccountSettings;\n workspaces: (ModelAccountSettingsView & {\n workspaceId: string;\n name: string;\n })[];\n nextCursor: string | null;\n};\n\n/** Why a listed model account cannot be chosen for this session. */\nexport type ModelAccountChoiceRefusal =\n | \"inactive\"\n | \"personal_not_allowed\"\n | \"personal_not_owner_work\"\n | \"session_has_no_owner\";\n\n/**\n * Cached usage, not a live check or a promise of available capacity. Source/time\n * describe the snapshot, not each retained window. A past reset does not prove replenishment.\n */\nexport type ModelAccountUsageSnapshot = {\n /** Snapshot-level time, not the observation time of every retained window. */\n observedAt: string | null;\n source: \"usage_endpoint\" | \"response_headers\" | \"refusal\" | null;\n windows: Array<{\n id: string;\n /** Null means unknown; values over 100 can represent overage. */\n usedPercent: number | null;\n resetsAt: string | null;\n status: \"ok\" | \"warning\" | \"exhausted\" | \"unknown\";\n }>;\n exhaustedUntil: string | null;\n exhaustedKind: \"quota\" | \"rate_limit\" | null;\n};\n\n/** An already-visible account, with optional cached usage (never an eligibility decision). */\nexport type ModelAccountChoiceOption = {\n provider: string;\n connectionId: string;\n label: string | null;\n accountEmail: string | null;\n planType: string | null;\n status: string;\n personal: boolean;\n source: \"workspace\" | \"organization\" | \"personal\";\n allowedModelIds: string[] | null;\n choosable: boolean;\n refusal: ModelAccountChoiceRefusal | null;\n /** Omitted on older servers; null means no decodable stored snapshot. Readings may be partial or stale. */\n usage?: ModelAccountUsageSnapshot | null | undefined;\n};\n\n/** A session's current account, what it may switch to, and the effective personal settings. */\nexport type SessionModelAccountChoiceResponse = {\n /** Last committed placement; neither queued account choices nor unplaced proposals are serving truth. */\n serving?:\n | {\n turnId: string;\n provider: string;\n connectionId: string | null;\n modelId: string;\n preferredModelId: string;\n reasoningEffort: ReasoningEffort;\n latencyMode: LatencyMode;\n }\n | null\n | undefined;\n /** The session's account when it has bindings for one provider only; else null (see `bindings`). */\n binding: {\n provider: string;\n connectionId: string | null;\n choice: \"explicit\" | \"automatic\";\n } | null;\n /** One binding per provider. */\n bindings: {\n provider: string;\n connectionId: string | null;\n choice: \"explicit\" | \"automatic\";\n }[];\n accounts: ModelAccountChoiceOption[];\n personal: {\n connectionsAllowed: boolean;\n fallbackAllowed: boolean;\n fallbackOptIn: boolean;\n };\n};\n\n/**\n * A connection becomes the choice for its provider; other providers' choices\n * stay. `connectionId: null` returns `provider`'s choice to automatic, or\n * every provider's when `provider` is omitted.\n */\nexport type SetSessionModelAccountChoiceRequest = {\n connectionId: string | null;\n provider?: string;\n};\n\nexport type SetSessionModelAccountChoiceResponse = {\n changed: boolean;\n appliedTo: \"waiting_turn\" | \"next_turn\";\n provider: string | null;\n connectionId: string | null;\n choice: \"explicit\" | \"automatic\";\n};\n\n/** The caller's own model-account preferences in an organization. */\nexport type ModelAccountPreferences = {\n personalFallbackOptIn: boolean;\n version: number;\n};\n\nexport type UpdateModelAccountPreferencesRequest = {\n personalFallbackOptIn: boolean;\n expectedVersion?: number;\n};\n\n/**\n * What agents may do in the app for a person, organization-wide.\n * `sessionAdminAccessAllowed`: members may give a session they started their\n * own full access (off by default; turning it off ends every session's full\n * access). `chatActionsAllowed`: in a chat a person started, the agent may do\n * what that person could do in the app's pages and settings, each change only\n * after the person confirms it in the chat (on by default).\n */\nexport type OrganizationAgentAdminAccess = {\n sessionAdminAccessAllowed: boolean;\n chatActionsAllowed: boolean;\n updatedAt: string | null;\n};\n\n/** Change either choice; an omitted one stays as it is. */\nexport type UpdateOrganizationAgentAdminAccessRequest = {\n sessionAdminAccessAllowed?: boolean;\n chatActionsAllowed?: boolean;\n};\n\n/**\n * The organization's EU-only inference setting. When on, every model call for\n * its workspaces runs on an EU route or not at all. Any member can read it;\n * owners and admins can turn it on, and only an owner or admin in the app in a\n * browser can turn it off (`canTurnOff`).\n */\nexport type OrganizationInferenceResidency = {\n organizationId: string;\n euOnly: boolean;\n /** 0 until the setting is first changed. */\n version: number;\n updatedAt: string | null;\n /** Whether the caller may turn EU-only off: only an owner or admin in a browser. */\n canTurnOff: boolean;\n changed?: boolean | undefined;\n};\n\n/**\n * Turn EU-only on or off. `expectedVersion` is the current `version` (a stale\n * one is `409`); `operationId` makes a retry safe. Changes answer `503` while\n * the deployment doesn't allow them yet.\n */\nexport type UpdateOrganizationInferenceResidencyRequest = {\n euOnly: boolean;\n expectedVersion: number;\n operationId: string;\n};\n\n/** Model-backed features besides the chat model, as reported in `ClientConfig.inferenceFeatures`. */\nexport type InferenceFeatureId =\n | \"web_search\"\n | \"image_generation\"\n | \"video_generation\"\n | \"realtime_voice\"\n | \"voice_input\"\n | \"meeting_transcription\"\n | \"live_transcription\"\n | \"knowledge_embeddings\"\n | \"code_search\";\n\n/**\n * Why the server switched a feature off. `region_restricted`: the workspace\n * is EU-only and the feature has no EU route here (\"Not supported in EU\").\n */\nexport type FeatureUnavailableReason = \"region_restricted\";\n\n/** One feature's availability for the caller's workspace. */\nexport type InferenceFeatureAvailability = {\n id: InferenceFeatureId;\n available: boolean;\n unavailableReason: FeatureUnavailableReason | null;\n};\n\n/**\n * An organization's privacy choices, after the deployment's limits. A product\n * that embeds Opengeni can only narrow these; `limits` says which are fixed.\n */\nexport type OrganizationPrivacySettings = {\n organizationId: string;\n /**\n * Whether members can connect machines of their own (Only me machines).\n * Off: only owners and admins can connect new ones; machines already\n * connected keep working. Older servers omit it: members can.\n */\n membersConnectOwnMachines?: boolean;\n /** Who sees new chats and schedules unless the person picks otherwise. */\n defaultVisibility: \"private\" | \"workspace\";\n /** Whether people have their own Personal workspace to see and work in. */\n personalWorkspaces: boolean;\n /**\n * The most each person can spend from the organization's credits in their\n * own Personal workspace each calendar month (UTC), in USD micros; null for\n * no limit. Work paid by their own model plans or keys doesn't count.\n */\n personalWorkspaceMonthlyCredits: number | null;\n /** Whether admins see that other people's Only me schedules exist, and can pause them. */\n adminsSeePrivateSchedules: boolean;\n limits: {\n /** False when this deployment turns Only me off in shared workspaces. */\n onlyMeAllowed: boolean;\n /** True when new chats and schedules always start as Workspace. */\n defaultVisibilityLocked: boolean;\n /** True when admins always see that other people's Only me schedules exist. */\n adminsSeePrivateSchedulesLocked: boolean;\n };\n updatedAt: string | null;\n};\n\nexport type UpdateOrganizationPrivacySettingsRequest = {\n /** Off: only owners and admins connect new machines of their own. */\n membersConnectOwnMachines?: boolean;\n defaultVisibility?: \"private\" | \"workspace\";\n adminsSeePrivateSchedules?: boolean;\n /** Off: people no longer see or start new work in their Personal workspace. */\n personalWorkspaces?: boolean;\n /** USD micros a month per person; null removes the limit. */\n personalWorkspaceMonthlyCredits?: number | null;\n};\n\n/**\n * A session's admin access as the viewer sees it. While `active`, the agent\n * in this session can do what `grantedBy` can manage across the\n * organization, checked live on every action.\n */\nexport type SessionAdminAccess = {\n active: boolean;\n grantedBy: { subjectId: string; name: string | null } | null;\n grantedAt: string | null;\n /** While active: when it ends by itself, or null for no time limit. */\n expiresAt: string | null;\n /** The organization allows admin access for sessions. */\n allowed: boolean;\n /**\n * The viewer may turn it on, or choose a new time limit while it is on: an\n * owner or admin, in person, on their own session.\n */\n canGrant: boolean;\n /** The viewer may turn it off. */\n canRevoke: boolean;\n};\n\n/**\n * How long a session's admin access lasts from now: whole hours from 1 to\n * 720, or null for no time limit. Omitted means one hour.\n */\nexport type GrantSessionAdminAccessRequest = {\n durationHours?: number | null;\n};\n\n/** Full replacement body for `PUT /v1/workspaces/:id/model-policy`. */\nexport type UpdateWorkspaceModelAccessPolicyRequest = {\n allowedProviders?: string[] | null | undefined;\n allowedModels?: string[] | null | undefined;\n};\n\n/**\n * Connection state of a workspace's Codex (ChatGPT) subscription, returned by\n * `GET /v1/workspaces/:id/codex/status`. `models` are the codex models the\n * workspace can select (projected as ClientModel under their own \"no credits\"\n * provider group), present only while connected.\n */\nexport type CodexConnectionStatus = {\n connected: boolean;\n plan?: string | null;\n valid?: boolean;\n expiresAt?: string | null;\n lastError?: string | null;\n models?: ClientModel[];\n /** The account a session runs on when unpinned (label for the in-session indicator). */\n activeAccount?: {\n id: string;\n label?: string | null;\n chatgptAccountId?: string | null;\n } | null;\n /** Live model-catalog probe result for the active account only. */\n activeAccountValid?: boolean;\n /** Cached readiness of any account in the effective worker pool. */\n poolReady?: boolean;\n /** Cached unpinned worker routability; rotation-off remains active-pointer-only. */\n workerRoutable?: boolean;\n /** How many Codex accounts the workspace has connected. */\n accountCount?: number;\n source?: WorkspaceCodexSubscriptionSource;\n};\n\n/**\n * `automatic`: Codex is on here; `disabled`: off. The older `workspace` and\n * `organization` values are accepted and mean on.\n */\nexport type WorkspaceCodexSubscriptionMode =\n | \"automatic\"\n | \"workspace\"\n | \"organization\"\n | \"disabled\";\n\nexport type WorkspaceCodexSubscriptionSource = {\n accountId: string;\n workspaceId: string;\n workspaceKind: \"personal\" | \"shared\";\n mode: WorkspaceCodexSubscriptionMode;\n effectiveSource: \"workspace\" | \"organization\" | \"disabled\";\n workspaceAvailable: boolean;\n organizationAvailable: boolean;\n /** @deprecated Always false: no account is set aside. Absent from older servers. */\n workspaceSetAside?: boolean;\n /**\n * How many organization accounts reach this workspace (accounts limited to\n * chosen people aside). Absent from older servers.\n */\n organizationCount?: number;\n};\n\n/**\n * One normalized Codex usage window (5h or weekly), camelCase end-to-end (the\n * route normalizes server-side; the web layer never re-hand-types snake_case).\n * `percent` is authoritative; used/limit/remaining are a synthesized 0–100 scale\n * (limit = 100) because the provider gives only a percentage. `remaining =\n * 100 - percent` is the P3 rotation key. Identify the window by `limitWindowSeconds`\n * (18000 ⇒ 5h, 604800 ⇒ weekly), never by position.\n */\nexport type CodexUsageWindow = {\n used: number;\n limit: number;\n remaining: number;\n percent: number;\n resetAt: string | null;\n resetAfterSeconds: number | null;\n limitWindowSeconds: number;\n};\n\n/** The normalized usage payload for one account — the P2/P3 contract. */\nexport type CodexUsagePayload = {\n status: \"ok\" | \"limit_reached\" | \"error\" | \"no-data\";\n planType: string | null;\n fiveHour: CodexUsageWindow | null;\n weekly: CodexUsageWindow | null;\n limitReached: boolean;\n fetchedAt: string;\n /** Authoritative count-only summary from /wham/usage; never synthesized rows. */\n rateLimitResetCredits?: { availableCount: number; credits: null } | null;\n /** Present only on an auth/refresh failure path. */\n reason?: \"needs_relogin\";\n additionalLimits?: Array<{\n limitName: string;\n meteredFeature: string;\n fiveHour: CodexUsageWindow | null;\n weekly: CodexUsageWindow | null;\n unknownWindowExhausted: boolean;\n }>;\n credits?: {\n hasCredits: boolean;\n unlimited: boolean;\n overageLimitReached: boolean;\n balance: string | null;\n };\n};\n\n/** One model a Codex account's current ChatGPT plan was proven not to include. */\nexport type CodexPlanExcludedModel = {\n /** Product model id, for example `codex/gpt-6-sol`. */\n model: string;\n /** Display name, for example \"GPT-6 Sol\". */\n label: string;\n excludedAt: string;\n retryAfter: string;\n};\n\n/** One connected Codex (ChatGPT) account in a workspace (multi-account P1). Metadata only. */\nexport type CodexAccount = {\n id: string;\n source?: \"workspace\" | \"organization\";\n /**\n * Organization list only: shared workspaces that list the account among\n * their own (it was connected there).\n */\n ownInWorkspaceIds?: string[];\n /** The organization's list only: who the account reaches. */\n reach?: SubscriptionAccountReach;\n /**\n * The workspace whose own account this is, or null for the organization's\n * and personal accounts. In another workspace's list it was shared there by\n * its owner, and that workspace can only remove it. Absent from older servers.\n */\n ownerWorkspaceId?: string | null;\n chatgptAccountId?: string | null;\n label?: string | null;\n email?: string | null;\n plan?: string | null;\n /** When the provider last confirmed `plan` (connect, token refresh, or usage read). */\n planCheckedAt?: string | null;\n /** Plan before the most recent observed plan change, and when that change was seen. */\n planChangedFrom?: string | null;\n planChangedAt?: string | null;\n /**\n * Models the current plan was proven not to include. Each is skipped by\n * automatic selection until `retryAfter` (one request then re-checks it), or\n * until a different plan is observed, for example after refreshing usage.\n */\n planExcludedModels?: CodexPlanExcludedModel[];\n status: \"active\" | \"needs_relogin\" | \"error\";\n active: boolean;\n expiresAt?: string | null;\n lastRefreshAt?: string | null;\n lastError?: string | null;\n // P2 CACHED usage (built from the persisted columns; renders bars off\n // listCodexAccounts with no second call). null until the first live refresh.\n fiveHour?: CodexUsageWindow | null;\n weekly?: CodexUsageWindow | null;\n usageCheckedAt?: string | null;\n // P3 rotation cooldown: ISO timestamp until which this account is cooling-down\n // (rotated-off after a usage cap). null/absent ⇒ not cooling.\n exhaustedUntil?: string | null;\n /** Controls only NEW automatic allocations. */\n extraCreditsEnabled?: boolean;\n extraCreditsVersion?: number;\n extraCreditsUpdatedAt?: string | null;\n allocatorEnabled: boolean;\n /** Independent OCC sequence; credential/token `version` is never exposed. */\n allocatorVersion: number;\n allocatorUpdatedAt?: string | null;\n /** Cached authoritative summary count, never detailed redemption authority. */\n resetCreditAvailableCount?: number | null;\n resetCreditsCheckedAt?: string | null;\n /** True when this exact credential is the workspace's independent Apps credential. */\n appsDesignated: boolean;\n /** True only for the scoped managed human who connected it. */\n canEnableApps: boolean;\n};\n\nexport type CodexResetCredit = {\n id: string;\n resetType: \"codexRateLimits\" | \"unknown\";\n status: \"available\" | \"redeeming\" | \"redeemed\" | \"unknown\";\n /** Unix seconds from the provider contract. */\n grantedAt: number;\n /** Unix seconds, or null when the provider reports no expiry. */\n expiresAt: number | null;\n title: string | null;\n description: string | null;\n /** True only for fresh, complete, owning-human provider detail. */\n actionable: boolean;\n};\n\n/** Owning-human recovery metadata. It contains no token, browser-session hash, or provider key. */\nexport type CodexResetRedemptionRecovery = {\n attemptId: string;\n creditId: string;\n status: \"provider_started\" | \"completed\";\n outcome: \"reset\" | \"nothingToReset\" | \"noCredit\" | \"alreadyRedeemed\" | null;\n providerStartedAt: string | null;\n completedAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type CodexAccountOverview = {\n accountId: string;\n usage: {\n source: \"provider\" | \"cache\" | \"none\";\n fetchedAt: string | null;\n stale: boolean;\n error: string | null;\n value: CodexUsagePayload | null;\n };\n resetCredits: {\n source: \"provider\" | \"cache\" | \"none\";\n fetchedAt: string | null;\n stale: boolean;\n error: string | null;\n detailState: \"detailed\" | \"count_only\" | \"capped\" | \"unsupported\" | \"unknown\" | \"error\";\n detailsComplete: boolean;\n availableCount: number | null;\n credits: CodexResetCredit[];\n };\n canRedeem: boolean;\n /** Secret-free reason redemption is owner-actionable or view-only. */\n redemptionAccess: {\n ownership: \"current_human\" | \"unowned\" | \"different_human\" | \"managed_human_unavailable\";\n /** A direct managed-cookie admin may claim only an unowned same-provider row by reconnecting. */\n canClaimUnownedViaReconnect: boolean;\n };\n /** Owning managed-cookie human may replay durable completion without a healthy provider token. */\n canResumeRedemption: boolean;\n /** Durable owner-scoped ambiguity/completion discovery; never redemption authority for agents. */\n redemptions: CodexResetRedemptionRecovery[];\n};\n\n/** Independently settled live overview keyed by workspace credential id. */\nexport type CodexOverviewResponse = {\n accounts: Record<string, CodexAccountOverview>;\n};\n\nexport type CodexAllocatorUpdate = {\n allocatorEnabled: boolean;\n allocatorVersion: number;\n allocatorUpdatedAt: string | null;\n changed: boolean;\n};\n\n/** Per-workspace Codex rotation/active settings. New servers return `sharded`. */\nexport type CodexRotationSettings = {\n rotationEnabled: boolean;\n rotationStrategy: \"sharded\" | \"most_remaining\" | \"round_robin\" | \"drain_then_next\";\n activeCredentialId: string | null;\n};\n\n/** GET /codex/accounts — the accounts list + the workspace active pointer + settings. */\nexport type CodexAccountsResponse = {\n accounts: CodexAccount[];\n activeAccountId: string | null;\n source?: WorkspaceCodexSubscriptionSource;\n /** Added by Apps-aware servers; absent on older same-major deployments. */\n apps?: {\n available: boolean;\n credentialId: string | null;\n version: number;\n designatedAt: string | null;\n canDisable: boolean;\n };\n settings: CodexRotationSettings;\n};\n\nexport type OrganizationCodexAccountsResponse = Omit<CodexAccountsResponse, \"apps\" | \"source\">;\n\n/** Session-authorized choices: the accepted pool for a capacity wait, otherwise\n * the current pool for the next turn. Current execution may use another pool. */\nexport type SessionCodexAccountsResponse = Omit<CodexAccountsResponse, \"apps\" | \"source\"> & {\n currentSelection: { credentialId: string | null; waiting: boolean } | null;\n currentAccount: CodexAccount | null;\n pinnedAccountId: string | null;\n lastAccountId: string | null;\n};\n\nexport type CodexAppsUpdate = {\n credentialId: string | null;\n version: number;\n designatedAt: string | null;\n changed: boolean;\n};\n\n/** Payload of a `codex.account.switched` session event. */\nexport type CodexAccountSwitchedPayload = {\n fromAccountId: string | null;\n toAccountId: string;\n reason: \"manual\" | \"exhausted\" | \"rotation\";\n};\n\n/** Device-code start: show `userCode` at `verificationUri`, then poll with `state`. */\nexport type CodexConnectStart = {\n userCode: string;\n verificationUri: string;\n intervalSeconds: number;\n state: string;\n};\n\n/** Poll result: keep polling on `pending`, restart on `expired`, done on `connected`. */\nexport type CodexConnectPoll =\n | { status: \"pending\" }\n | { status: \"expired\" }\n | {\n status: \"connected\";\n plan?: string | null;\n accountId?: string;\n isActive?: boolean;\n };\n\n/**\n * Who an account in the organization's list reaches: the workspace that owns\n * it (its own account, used only there), every workspace including new ones,\n * chosen shared workspaces, Personal workspaces, or chosen people.\n */\nexport type SubscriptionAccountReach = {\n /** The workspace whose own account this is, or null for an organization account. */\n ownerWorkspaceId: string | null;\n /** Every shared workspace, including ones created later. */\n everyWorkspace: boolean;\n /** The shared workspaces it reaches, when not every one. */\n workspaceIds: string[];\n /** Every Personal workspace. */\n personalWorkspaces: boolean;\n /** How many chosen people, or null when it is not limited to people. */\n people: number | null;\n};\n\n/** Explicit authority of one connected SuperGrok/xAI subscription account. */\nexport type SuperGrokAccountScope = \"workspace\" | \"user\" | \"organization\";\n\n/** Metadata-only connected SuperGrok account. Secret OAuth material never crosses the API. */\nexport type SuperGrokAccount = {\n id: string;\n /** The organization's list only: who the account reaches. */\n reach?: SubscriptionAccountReach;\n plan?: string | null;\n scope: SuperGrokAccountScope;\n subject: string;\n email?: string | null;\n label?: string | null;\n status: \"active\" | \"needs_relogin\" | \"error\";\n active: boolean;\n expiresAt?: string | null;\n lastRefreshAt?: string | null;\n lastError?: string | null;\n allocatorEnabled: boolean;\n allocatorVersion: number;\n allocatorUpdatedAt?: string | null;\n exhaustedUntil?: string | null;\n quota?: {\n usedPercent: number | null;\n periodStart: string | null;\n periodEnd: string | null;\n subscriptionTier: string | null;\n checkedAt: string | null;\n } | null;\n};\n\nexport type SuperGrokRotationSettings = {\n rotationEnabled: boolean;\n rotationStrategy: \"sharded\";\n activeCredentialId: string | null;\n};\n\n/** GET /supergrok/accounts — visible accounts plus the workspace active pointer. */\nexport type SuperGrokAccountsResponse = {\n source?: \"workspace\" | \"user\" | \"organization\";\n organizationId?: string;\n accounts: SuperGrokAccount[];\n activeAccountId: string | null;\n settings: SuperGrokRotationSettings;\n};\n\nexport type SuperGrokConnectionStatus = {\n connected: boolean;\n valid?: boolean;\n accountCount?: number;\n models?: ClientModel[];\n activeAccount?: {\n id: string;\n label?: string | null;\n subject?: string | null;\n scope: SuperGrokAccountScope;\n } | null;\n};\n\n/** Workspace is the deliberately simple/default connection authority. */\nexport type SuperGrokConnectStart = {\n userCode: string;\n verificationUri: string;\n verificationUriComplete?: string | null;\n intervalSeconds: number;\n expiresInSeconds: number;\n scope: SuperGrokAccountScope;\n state: string;\n};\n\nexport type SuperGrokConnectPoll =\n | { status: \"pending\" | \"slow_down\"; intervalSeconds?: number }\n | { status: \"expired\" | \"denied\" }\n | {\n status: \"connected\";\n accountId: string;\n scope: SuperGrokAccountScope;\n isActive: boolean;\n email?: string | null;\n };\n\nexport type SuperGrokAllocatorUpdate = {\n allocatorEnabled: boolean;\n allocatorVersion: number;\n allocatorUpdatedAt: string | null;\n changed: boolean;\n};\n\n/** Remaining usage/limits for one account. `usage` is the normalized P2 payload. */\nexport type CodexUsage = {\n status: \"ok\" | \"limit_reached\" | \"error\" | \"no-data\";\n usage: CodexUsagePayload | null;\n};\n\n/** Batched live-refresh response, keyed by credential id; each entry independently statused. */\nexport type CodexUsageMap = Record<string, CodexUsage>;\n\n/**\n * How a deployment expects clients to authenticate to it, surfaced so a UI can\n * wire up the right header/cookie without prior knowledge of the host setup.\n * Discriminated on `mode`; `none` is the back-compat default.\n */\nexport type ClientAuthConfig =\n | { mode: \"none\" }\n | { mode: \"deploymentKey\"; headerName: \"x-opengeni-access-key\" }\n | { mode: \"configuredToken\"; headerName: \"authorization\"; scheme: \"bearer\" }\n | {\n mode: \"managedSession\";\n session: \"cookie\";\n /** Defaults to true when omitted by an older deployment. */\n emailVerificationRequired?: boolean;\n /** Configured managed sign-in providers; omitted by older deployments. */\n socialProviders?: (\"google\" | \"github\")[];\n /**\n * False while the deployment has paused new account creation; existing\n * accounts can still sign in. Omitted (treat as true) by older deployments.\n */\n newSignupsEnabled?: boolean;\n signupChallengeSiteKey?: string | undefined;\n /** Sign in with a passkey, and add passkeys in Security; omitted (false) by older deployments. */\n passkeySignIn?: boolean;\n /** Create an account with only a name and a passkey; omitted (false) by older deployments. */\n passkeySignUp?: boolean;\n };\n\n// Kept value-identical to @opengeni/contracts and pinned by the SDK contract\n// parity suite. The SDK has no runtime dependency on the Zod contracts package.\nexport const OPENGENI_API_CONTRACT_REVISION = \"2026-09-plugins-and-skills-v1\" as const;\nexport const OPENGENI_API_CONTRACT_HEADER = \"x-opengeni-api-contract\" as const;\n/** Bounded request/response identifier shared by browser, ingress, and API diagnostics. */\nexport const OPENGENI_CORRELATION_HEADER = \"x-opengeni-correlation-id\" as const;\n\n/**\n * Public, unauthenticated-by-default client bootstrap config returned by\n * `GET /v1/config/client`: which models + reasoning efforts are exposed, the\n * MCP servers and file-upload limits a composer should offer, and how the\n * deployment expects the client to authenticate. `allowedModels` is kept for\n * back-compat; `models` carries the richer provider-grouped list for a picker.\n */\nexport type ClientConfig = {\n deploymentRevision: string;\n /**\n * The API's contract revision. Equals `OPENGENI_API_CONTRACT_REVISION` for a\n * `\"strict\"` client (it throws otherwise); a `\"compatible\"` client may\n * receive a newer revision from an additive deployment within its major.\n */\n apiContractRevision: string;\n serverVersion?: string | undefined;\n claudeSubscriptionEnabled?: boolean | undefined;\n /**\n * Organization admins may connect Azure OpenAI as this deployment's own\n * Microsoft Entra identity (the operator offers it). Absent otherwise.\n */\n azureOpenAIDeploymentIdentity?: boolean | undefined;\n /** Whether people can connect their own computers; absent on older servers. */\n connectedMachines?: boolean | undefined;\n /**\n * The Chrome extension people add to connect their own Chrome, and its\n * Chrome Web Store page; absent on older servers (Opengeni Browser).\n */\n browserExtension?: { name: string; installUrl: string } | undefined;\n defaultModel: string;\n allowedModels: string[];\n models: ClientModel[];\n defaultReasoningEffort: ReasoningEffort;\n allowedReasoningEfforts: ReasoningEffort[];\n defaultSandboxBackend?: SandboxBackend | undefined;\n mcpServers: { id: string; name: string }[];\n /** Deployment defaults and hard maximum for built-in Opengeni session tools. */\n firstPartyMcpTools?:\n | {\n default: FirstPartyMcpToolName[];\n allowed: FirstPartyMcpToolName[];\n }\n | undefined;\n fileUploads: { enabled: boolean; maxSizeBytes: number };\n /**\n * `false` when a host's session proxy fixes the model policy\n * (`createSessionProxyHandler({ modelSelection: false })`), so UIs hide the\n * model picker; `true` when the host explicitly offers end users model\n * choice (embedded stock UIs then show the picker). Opengeni itself omits it.\n */\n modelSelection?: boolean | undefined;\n /**\n * `false` when a host's session proxy owns chat setup (`createSession`), so\n * the browser cannot add a newly connected capability to a chat and stock\n * conversations leave the agent's capability cards to the host. Opengeni\n * itself omits it.\n */\n chatConnections?: boolean | undefined;\n /** Session proxy sandbox-path download opt-in; absent on native deployments. */\n sandboxFiles?: boolean | undefined;\n /**\n * `false` when a host's session proxy turns live voice off\n * (`createSessionProxyHandler({ realtimeVoice: false })`), so UIs hide the\n * voice button; `true` when the host explicitly offers it to end users\n * (embedded stock UIs then show the button). Otherwise absent: availability\n * comes from the workspace's realtime model catalog.\n */\n realtimeVoice?: boolean | undefined;\n /**\n * Session proxy only: the workspace the proxy resolved for this user, so a\n * browser pointed at the proxy (`<OpenGeniChat baseUrl=... />`) needs no\n * workspace id. Absent on native deployments and older proxies.\n */\n workspaceId?: string | undefined;\n /**\n * Session proxy capability for the embedded artifact viewer and inline Site\n * previews; absent on native deployments. The live socket is\n * ticket-authenticated and reached directly; the cache partition identifies\n * the proxied user. `false` when the proxy does not serve artifacts, so\n * stock UIs show Site previews as unavailable instead of failing on click.\n */\n artifacts?:\n | {\n editableLiveUrl: string;\n cachePartition: {\n accountId: string;\n principalId: string;\n authorizationEpoch: string;\n };\n }\n | false\n | undefined;\n /**\n * Session proxy only: whether the browser may start a chat (the proxy has a\n * `createSession` hook). Stock UIs hide \"New chat\" when `false`; absent on\n * native deployments and older proxies.\n */\n sessionCreation?: boolean | undefined;\n /**\n * Session proxy only: whether users may archive or restore their chats.\n * Stock UIs hide \"Archive\" when `false`; absent on native deployments.\n */\n archive?: boolean | undefined;\n /** Native browser microphone capture + server-side transcription capability. */\n voiceInput?: ClientVoiceInputConfig | undefined;\n /**\n * Whether the deployment offers the Jev-backed code_search agent tool and\n * what workspaces without their own setting get (`split` = half of sessions).\n */\n codeSearch?: { available: boolean; workspaceDefault: \"off\" | \"on\" | \"split\" } | undefined;\n /**\n * EU-only inference: each model-backed feature's region availability for the\n * caller's workspace. `unavailableReason: \"region_restricted\"` means the\n * workspace is EU-only and the feature has no EU route here. Absent on older\n * servers.\n */\n inferenceFeatures?: InferenceFeatureAvailability[] | undefined;\n /**\n * Present only when this deployment archives idle sessions: after `idleDays`\n * without activity a session (unless kept live) becomes read-only.\n */\n sessionArchive?: { enabled: true; idleDays: number } | undefined;\n /**\n * Present when the server records and enforces per-task usage limits.\n * `enabled: false` refuses new limits but still enforces and clears existing\n * ones. Omitted by older servers, which ignore `usageLimitMicros`.\n */\n sessionUsageLimits?: { enabled: boolean } | undefined;\n /**\n * Whether automations can have event triggers on this server: event sources,\n * the webhook intake and event runs. Omitted by older servers.\n */\n eventTriggers?: { enabled: boolean } | undefined;\n /** Agent configuration rollout and per-capability availability. */\n agentConfig?: ClientAgentConfig | undefined;\n productAccessMode: ProductAccessMode;\n /** Client-safe hint for whether the console should offer Stripe checkout. */\n billingMode?: BillingMode | undefined;\n managedAuthSessionSetMode: \"legacy\" | \"dual\" | \"broker\";\n auth: ClientAuthConfig;\n /**\n * Product documentation for a console Help link. `null` means the deployment\n * hides the link; absent means a server that predates the field.\n */\n documentationUrl?: string | null | undefined;\n analytics: {\n consentRequired: boolean;\n providers: {\n reo?: { clientId: string } | undefined;\n posthog?: { projectKey: string; host: string } | undefined;\n ga4?: { measurementId: string } | undefined;\n };\n };\n /** Operator-owned legal documents the signed-out console links to, when configured. */\n legal?:\n | {\n privacyPolicyUrl?: string | undefined;\n termsOfServiceUrl?: string | undefined;\n }\n | undefined;\n /** Operator support address the console offers as a mailto link, when configured. */\n supportEmail?: string | undefined;\n // Server-wide hint: does this deployment support Channel-A structured services\n // at all (P4.4). Per-session availability is negotiated on /stream-capabilities;\n // this is the coarse on/off the client uses to decide whether to even attempt\n // the fs/git/terminal panels.\n structuredServices: {\n fileSystem: boolean;\n git: boolean;\n terminalEvents: boolean;\n };\n};\n\n/** Client-safe voice-input capability projection. */\nexport type ClientVoiceInputConfig = {\n available: boolean;\n providers?: VoiceInputProviderId[] | undefined;\n /** Every model a dictation may name, of each ready provider. */\n models?: DictationModelOption[] | undefined;\n maxDurationSeconds: number;\n maxSizeBytes: number;\n acceptedMimeTypes: string[];\n resumable?: ClientResumableVoiceInputConfig | undefined;\n};\n\n/** A model a dictation can name, such as for one desktop dictation shortcut. */\nexport type DictationModelOption = {\n providerId: VoiceInputProviderId;\n providerName: string;\n model: string;\n name: string;\n};\n\nexport type ClientResumableVoiceInputConfig = {\n maxDurationSeconds: number;\n maxSizeBytes: number;\n maxChunkSizeBytes: number;\n providerSegmentSeconds: number;\n};\n\n/** Response from POST /v1/workspaces/:workspaceId/transcriptions. */\nexport type TranscribeAudioResponse = {\n text: string;\n languages: string[];\n};\n\nexport type AccountRole = \"owner\" | \"admin\" | \"member\";\n\nexport type AccessPrincipalKind =\n | \"human_session\"\n | \"agent_attempt\"\n | \"service\"\n | \"api_key\"\n | \"configured_key\";\n\nexport type AccountGrant = {\n accountId: string;\n subjectId: string;\n subjectLabel?: string | undefined;\n role?: AccountRole | undefined;\n permissions: Permission[];\n metadata?: Record<string, unknown> | undefined;\n};\n\nexport type AccessGrant = {\n workspaceId: string;\n accountId: string;\n subjectId: string;\n subjectLabel?: string | undefined;\n permissions: Permission[];\n /** Explicit policies never expand `workspace:admin` into unselected permissions. */\n permissionMode?: \"legacy\" | \"explicit\" | undefined;\n principalKind?: AccessPrincipalKind | undefined;\n metadata?: Record<string, unknown> | undefined;\n serviceInitiator?: ServiceTurnInitiator | undefined;\n serviceInitiatorContext?: ServiceTurnInitiatorContext | undefined;\n};\n\n/**\n * Authority of a directly used organization or workspace API key, separate\n * from the caller's account and workspace grants. Full organization keys can\n * provision shared workspaces, external members, and sessions through `asUser`;\n * those user requests additionally need the user's live membership.\n * Organization-key scope excludes Personal workspaces. Neither key kind bypasses\n * session visibility or the explicit `secrets:read` permission requirement.\n */\nexport type AccessCredential = {\n kind: \"organization_api_key\" | \"workspace_api_key\";\n /** Organization keys only; omitted for workspace keys. */\n access?: OrganizationApiKeyAccess | undefined;\n /** The key's organization id. */\n accountId: string;\n /** Null for an organization key; `workspaceScope` selects shared workspaces, never Personal. */\n workspaceId: string | null;\n /**\n * Effective workspace permissions, with admin expansion only for legacy keys. Excludes\n * account-only permissions and includes `secrets:read` only when explicitly\n * granted. Explicit policies grant exactly their selected permissions.\n */\n effectiveWorkspacePermissions: Permission[];\n /** Organization keys only; the preset label never adds permissions. */\n policy?: OrganizationAccessPolicy | undefined;\n /** Organization keys only; omitted on older servers. */\n workspaceScope?: OrganizationWorkspaceScope | undefined;\n /** Plain-language explanation of the key's scope and limits. */\n note: string;\n};\n\n/** Caller identity, grants, defaults, and optional direct API-key authority. */\nexport type AccessContext = {\n mode: ProductAccessMode;\n subjectId: string;\n subjectLabel?: string | undefined;\n accountGrants: AccountGrant[];\n workspaceGrants: AccessGrant[];\n defaultAccountId: string | null;\n defaultWorkspaceId: string | null;\n /**\n * Direct API-key authority; omitted for `asUser`/external actors, humans,\n * delegated tokens, other caller contexts, and older servers. Existing grants\n * are unchanged. Full organization keys can provision shared workspaces,\n * external members, and `asUser` sessions; user requests still need live\n * membership. Organization-key scope excludes Personal workspaces. Neither key\n * kind bypasses session visibility or the explicit `secrets:read` requirement.\n */\n credential?: AccessCredential | undefined;\n};\n\nexport type ManagedOrganizationMembership = {\n id: string;\n organizationId: string;\n status: \"active\";\n personalWorkspaceId: string;\n /**\n * False when the organization turned Personal workspaces off: the person no\n * longer sees or starts new work there. Absent means on.\n */\n personalWorkspacesEnabled?: boolean | undefined;\n /**\n * The person's current answer to \"How do you want to use Opengeni?\" for\n * this organization: get help with everyday things, add agents to a product,\n * or run agents in the cloud. Absent when the server keeps no answer for them.\n */\n signupUseCase?: \"everyday\" | \"embed\" | \"cloud\" | undefined;\n};\n\nexport type ListManagedOrganizationMembershipsResponse = {\n memberships: ManagedOrganizationMembership[];\n};\n\nexport type UserResourceKind =\n | \"connection\"\n | \"document\"\n | \"variable_set\"\n | \"rig\"\n | \"connected_machine\"\n | \"subscription_connection\";\nexport type UserResourceGrantAction =\n | \"connection.use\"\n | \"document.read\"\n | \"variable_set.use\"\n | \"rig.use\"\n | \"connected_machine.use\"\n | \"subscription_connection.use\";\nexport type UserResourceAuthorityGrant = {\n grantId: string;\n targetWorkspaceId: string;\n targetSessionId: string | null;\n action: UserResourceGrantAction;\n mode: \"once\" | \"session\" | \"always\";\n context: \"user_private\" | \"workspace_shared\";\n authorityEpoch: number | null;\n generation: number;\n status: \"active\" | \"consumed\" | \"revoked\" | \"expired\";\n expiresAt: string | null;\n delegation: UserResourceDelegation;\n};\nexport type UserResourceAuthoritySummary = {\n authorityId: string;\n resourceKind: UserResourceKind;\n resourceId: string;\n originWorkspaceId: string | null;\n generation: number;\n status: \"active\" | \"retained\" | \"revoked\";\n grants: UserResourceAuthorityGrant[];\n};\nexport type ListUserResourceAuthoritiesOptions = {\n resourceKind: Exclude<UserResourceKind, \"connection\">;\n cursor?: string | undefined;\n limit?: number | undefined;\n};\nexport type ListUserResourceAuthoritiesResponse = {\n scope: \"user\";\n authorities: UserResourceAuthoritySummary[];\n nextCursor: string | null;\n};\nexport type IssueUserResourceGrantRequest =\n | {\n scope: \"user\";\n resourceKind: Exclude<UserResourceKind, \"connection\">;\n mode: \"session\";\n context: \"user_private\" | \"workspace_shared\";\n sessionId: string;\n expectedAuthorityEpoch: number;\n workspaceSharedAcknowledged?: boolean | undefined;\n }\n | {\n scope: \"user\";\n /** `connection` turns your own login on for your messages in this\n * workspace (its `authorityId` from `listOwnConnectionAccounts`). */\n resourceKind: UserResourceKind;\n mode: \"always\";\n context: \"user_private\" | \"workspace_shared\";\n sessionId?: null | undefined;\n expectedAuthorityEpoch?: null | undefined;\n workspaceSharedAcknowledged?: boolean | undefined;\n };\nexport type UserResourceGrantMutationResponse = {\n scope: \"user\";\n grant: UserResourceAuthorityGrant;\n};\nexport type RevokeUserResourceGrantResponse = {\n scope: \"user\";\n grant: {\n grantId: string;\n generation: number;\n status: \"revoked\";\n revokedAt: string;\n };\n};\n/** Your own things that you turn on workspace by workspace. */\nexport type OwnResourceReachKind = \"connection\" | \"subscription_connection\" | \"connected_machine\";\n/** One of your workspaces in \"Where it works\" for your own login, plan or machine. */\nexport type OwnResourceReachWorkspace = {\n workspaceId: string;\n name: string;\n /** Your Personal workspace. */\n personal: boolean;\n /** The workspace this was asked from. */\n current: boolean;\n /** It works here for your own messages. Nobody else's messages ever use it. */\n on: boolean;\n /** Always on here: logins and plans in your Personal workspace. */\n alwaysOn: boolean;\n /** You may turn it on or off here. */\n canChange: boolean;\n};\nexport type OwnResourceReachResponse = {\n resourceKind: OwnResourceReachKind;\n resourceId: string;\n /** Your Personal workspace first, then by name. */\n workspaces: OwnResourceReachWorkspace[];\n};\nexport type SetOwnResourceReachRequest = {\n resourceKind: OwnResourceReachKind;\n resourceId: string;\n on: boolean;\n};\nexport type SetOwnResourceReachResponse = { workspace: OwnResourceReachWorkspace };\n/** One of your own logins, model plans or machines, with where it works. */\nexport type OwnResource = {\n resourceKind: OwnResourceReachKind;\n resourceId: string;\n /** A login's or plan's account (its email when known), or a machine's name. */\n name: string;\n /** Login: the service it signs in to. Plan: the provider (`codex`, `claude`, `xai`). Machine: null. */\n provider: string | null;\n /** Plan only: the plan the provider reports, when known. */\n plan: string | null;\n /** Your Personal workspace first, then by name. */\n workspaces: OwnResourceReachWorkspace[];\n};\nexport type OwnResourcesResponse = {\n /** Logins, then plans, then machines, each by name. */\n resources: OwnResource[];\n};\n\nexport type OrganizationMembershipRole = \"owner\" | \"admin\" | \"member\";\nexport type WorkspaceMemberRole = \"viewer\" | \"member\" | \"admin\" | \"custom\";\nexport type AssignableWorkspaceMemberRole = \"viewer\" | \"member\" | \"admin\";\nexport type OrganizationUserSetupDelivery = {\n id: string;\n state: \"pending\" | \"sent\" | \"failed\" | \"outcome_unknown\" | \"revoked\";\n attemptCount: number;\n revision: number;\n errorClass: string | null;\n retryState: \"available\" | \"reconciliation_required\" | \"unavailable\";\n sentAt: string | null;\n updatedAt: string;\n};\nexport type OrganizationInvitation = {\n id: string;\n organizationId: string;\n organizationName: string | null;\n targetEmail: string;\n targetName: string | null;\n initialWorkspaceIds: string[];\n role: OrganizationMembershipRole;\n status: \"pending\" | \"accepted\" | \"revoked\" | \"expired\";\n revision: number;\n expiresAt: string;\n acceptedMembershipId: string | null;\n createdAt: string;\n updatedAt: string;\n delivery: OrganizationUserSetupDelivery | null;\n};\nexport type OrganizationMember = {\n id: string;\n organizationId: string;\n subjectId: string;\n name: string | null;\n email: string | null;\n role: OrganizationMembershipRole;\n status: \"provisioning\" | \"active\" | \"suspended\" | \"revoked\";\n authorizationRevision: number;\n personalWorkspaceId: string | null;\n revokedAt: string | null;\n personalRetentionUntil: string | null;\n createdAt: string;\n updatedAt: string;\n};\nexport type OrganizationAdministrationMemberWorkspaceAccess = {\n workspaceId: string;\n workspaceName: string;\n membershipId: string;\n role: WorkspaceMemberRole;\n updatedAt: string;\n};\nexport type OrganizationAdministrationMember = {\n id: string;\n organizationId: string;\n subjectId: string;\n name: string | null;\n email: string | null;\n role: OrganizationMembershipRole;\n status: \"provisioning\" | \"active\" | \"suspended\" | \"revoked\";\n authorizationRevision: number;\n sharedWorkspaceAccess: OrganizationAdministrationMemberWorkspaceAccess[];\n revokedAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\nexport type OrganizationSummary = {\n id: string;\n name: string;\n createdAt: string;\n updatedAt: string;\n};\nexport type OrganizationWorkspaceAccessMember = {\n membershipId: string;\n organizationMembershipId: string | null;\n subjectId: string;\n name: string | null;\n email: string | null;\n subjectLabel: string | null;\n principalKind: \"human\" | \"service\";\n organizationRole: OrganizationMembershipRole | null;\n role: WorkspaceMemberRole;\n permissions: string[];\n createdAt: string;\n updatedAt: string;\n};\nexport type OrganizationWorkspaceAccess = {\n id: string;\n name: string;\n slug: string | null;\n createdAt: string;\n updatedAt: string;\n members: OrganizationWorkspaceAccessMember[];\n};\nexport type OrganizationAdministrationOverview = {\n organization: OrganizationSummary;\n roles: OrganizationWorkspaceRoleDefinition[];\n workspaces: OrganizationWorkspaceAccess[];\n};\nexport type OrganizationWorkspaceRoleDefinition = {\n role: AssignableWorkspaceMemberRole;\n label: string;\n description: string;\n permissions: Permission[];\n};\nexport type OrganizationPrivateSessionSettings = {\n organizationId: string;\n enabled: boolean;\n available: boolean;\n version: number;\n updatedAt: string;\n changed?: boolean;\n};\nexport type CreateOrganizationWorkspaceRequest = {\n name: string;\n operationId: string;\n};\nexport type UpdateOrganizationWorkspaceRequest = {\n name: string;\n expectedUpdatedAt: string;\n operationId: string;\n};\nexport type PutOrganizationWorkspaceMemberRequest =\n | {\n role: AssignableWorkspaceMemberRole;\n expectedUpdatedAt: string | null;\n operationId: string;\n }\n | {\n role: \"custom\";\n permissions: Permission[];\n expectedUpdatedAt: string | null;\n operationId: string;\n };\nexport type RevokeOrganizationWorkspaceMemberRequest = {\n expectedUpdatedAt: string;\n operationId: string;\n};\nexport type RevokeOrganizationWorkspaceMemberResponse = {\n removed: boolean;\n replay: boolean;\n};\nexport type CreateOrganizationRequest = {\n name: string;\n operationId: string;\n};\nexport type CreateOrganizationResponse = {\n organization: OrganizationSummary;\n workspaceId: string;\n};\nexport type CreateAdditionalOrganizationRequest = {\n name: string;\n workspaceName: string;\n operationId: string;\n};\nexport type CreateAdditionalOrganizationResponse = {\n organization: OrganizationSummary;\n workspaceId: string;\n personalWorkspaceId: string;\n};\nexport type UpdateOrganizationNameRequest = {\n name: string;\n expectedUpdatedAt: string;\n operationId: string;\n};\nexport type UpdateOrganizationPrivateSessionSettingsRequest = {\n enabled: boolean;\n expectedVersion: number;\n operationId: string;\n};\nexport type OrganizationRetentionPolicy = {\n organizationId: string;\n mode: \"retain\" | \"delete_after\";\n retentionDays: number | null;\n version: number;\n updatedAt: string;\n};\nexport type OrganizationRecoveryPolicyState =\n | \"pending_acceptance\"\n | \"active\"\n | \"degraded\"\n | \"superseded\"\n | \"disabled\";\nexport type OrganizationRecoveryOperationState =\n | \"collecting\"\n | \"cooling\"\n | \"executed\"\n | \"cancelled\"\n | \"expired\"\n | \"superseded\";\nexport type OrganizationRecoveryUnavailableReason =\n | \"no_policy\"\n | \"pending_acceptance\"\n | \"degraded\"\n | \"disabled\"\n | \"identity_unavailable\";\nexport type OrganizationRecoveryMemberSummary = {\n membershipId: string;\n name: string | null;\n email: string | null;\n};\nexport type OrganizationRecoveryCustodian = OrganizationRecoveryMemberSummary & {\n ordinal: number;\n enrollmentState: \"pending_acceptance\" | \"accepted\" | \"ineligible\";\n acceptedAt: string | null;\n};\nexport type OrganizationRecoveryPolicy = {\n id: string;\n organizationId: string;\n revision: number;\n state: OrganizationRecoveryPolicyState;\n custodians: OrganizationRecoveryCustodian[];\n createdAt: string;\n updatedAt: string;\n};\nexport type OrganizationRecoveryApproval = OrganizationRecoveryMemberSummary & {\n approvedAt: string;\n};\nexport type OrganizationRecoveryOperation = {\n id: string;\n organizationId: string;\n policyId: string;\n policyRevision: number;\n revision: number;\n state: OrganizationRecoveryOperationState;\n target: OrganizationRecoveryMemberSummary;\n approvals: OrganizationRecoveryApproval[];\n approvalCount: number;\n quorumAt: string | null;\n executableAt: string | null;\n expiresAt: string;\n executedAt: string | null;\n cancelledAt: string | null;\n notificationJournaled: boolean;\n createdAt: string;\n updatedAt: string;\n};\nexport type OrganizationRecoveryCapabilities = {\n configure: boolean;\n accept: boolean;\n disable: boolean;\n start: boolean;\n approve: boolean;\n cancel: boolean;\n execute: boolean;\n};\nexport type OrganizationRecoveryOverview = {\n organizationId: string;\n availability: \"available\" | \"recovery_unavailable\";\n unavailableReason: OrganizationRecoveryUnavailableReason | null;\n recentReauthenticationAt: string | null;\n eligibleMembers: OrganizationRecoveryMemberSummary[];\n policy: OrganizationRecoveryPolicy | null;\n operation: OrganizationRecoveryOperation | null;\n capabilities: OrganizationRecoveryCapabilities;\n};\nexport type ConfigureOrganizationRecoveryPolicyRequest = {\n custodianMembershipIds: [string, string, string];\n expectedPolicyRevision: number;\n operationId: string;\n};\nexport type AcceptOrganizationRecoveryCustodyRequest = {\n expectedPolicyRevision: number;\n operationId: string;\n};\nexport type DisableOrganizationRecoveryPolicyRequest = AcceptOrganizationRecoveryCustodyRequest;\nexport type StartOrganizationRecoveryOperationRequest = {\n targetMembershipId: string;\n expectedPolicyRevision: number;\n operationId: string;\n};\nexport type OrganizationRecoveryOperationCommandRequest = {\n expectedOperationRevision: number;\n operationId: string;\n};\nexport type OrganizationRecoveryMutationResponse = {\n replay: boolean;\n overview: OrganizationRecoveryOverview;\n};\nexport type CreateOrganizationInvitationRequest = {\n email: string;\n name?: string;\n initialWorkspaceIds?: string[];\n role?: OrganizationMembershipRole;\n expiresAt: string;\n operationId: string;\n};\nexport type AcceptOrganizationInvitationRequest = {\n expectedRevision: number;\n operationId: string;\n};\nexport type RevokeOrganizationInvitationRequest = AcceptOrganizationInvitationRequest;\nexport type PreviewOrganizationUserSetupRequest = { token: string };\nexport type OrganizationUserSetupPreview =\n | { state: \"unavailable\" | \"expired\" | \"revoked\" | \"completed\" }\n | {\n state: \"pending\";\n organizationId: string;\n organizationName: string;\n targetEmail: string;\n targetName: string | null;\n organizationRole: OrganizationMembershipRole;\n sharedWorkspaceAccess: Array<{\n workspaceId: string;\n workspaceName: string;\n role: AssignableWorkspaceMemberRole;\n }>;\n expiresAt: string;\n };\nexport type RetryOrganizationUserSetupDeliveryRequest = { operationId: string };\nexport type UpdateOrganizationMemberRequest = {\n kind: \"change_role\" | \"suspend\" | \"reactivate\" | \"offboard\";\n role?: OrganizationMembershipRole;\n expectedAuthorizationRevision: number;\n operationId: string;\n reason?: string;\n};\nexport type UpdateOrganizationRetentionPolicyRequest = {\n mode: \"retain\" | \"delete_after\";\n retentionDays: number | null;\n expectedVersion: number;\n operationId: string;\n};\nexport type ListOrganizationInvitationsPageResponse = {\n invitations: OrganizationInvitation[];\n nextCursor: string | null;\n};\nexport type ListOrganizationMembersResponse = {\n members: OrganizationAdministrationMember[];\n};\nexport type ListOrganizationAdministrationMembersResponse = {\n members: OrganizationAdministrationMember[];\n};\n/** An active person in the organization, by name only. */\nexport type OrganizationMemberName = {\n /** The organization membership id. */\n id: string;\n name: string | null;\n you: boolean;\n};\n/** `available` is false until the deployment's database grants the names list. */\nexport type ListOrganizationMemberNamesResponse = {\n available: boolean;\n members: OrganizationMemberName[];\n};\nexport type AcceptOrganizationInvitationResponse = {\n invitation: OrganizationInvitation;\n membership: OrganizationMember;\n};\n\nexport type Workspace = {\n id: string;\n accountId: string;\n kind: \"personal\" | \"shared\";\n name: string;\n slug: string | null;\n externalSource: string | null;\n externalId: string | null;\n agentInstructions: string | null;\n settings: Record<string, unknown>;\n inferenceControl: {\n timer?: WorkspacePauseTimer | null | undefined;\n serverTime?: string | undefined;\n state: \"active\" | \"paused\";\n revision: number;\n reason: string | null;\n changedBy: string | null;\n changedAt: string | null;\n };\n defaultRigId?: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type WorkspaceDefaultExecutionTarget =\n | { kind: \"managed\" }\n | { kind: \"machine\"; targetSandboxId: string };\n\n/**\n * `GET/PUT /v1/workspaces/:id/my-default-execution-target`: the caller's own\n * placement for the new chats they start in the workspace (\"Your default\n * machine\"). Null follows the workspace default. `usable` is false when the\n * saved machine is no longer available to them.\n */\nexport type MemberDefaultExecutionTarget = {\n target: WorkspaceDefaultExecutionTarget | null;\n usable: boolean;\n};\n\nexport type WorkspaceSettings = {\n /** Exact product-model preferences. Invalid/newer values are ignored per model. */\n modelCompactionThresholds?: unknown;\n memoryEnabled?: boolean | undefined;\n /** Reversible Memory V1 prompt composition rollout. */\n memoryPromptMode?: \"legacy_standing\" | \"retrieval_only\" | undefined;\n /** Model policy inherited by new chats and scheduled tasks. */\n sessionDefaults?: WorkspaceSessionDefaults | undefined;\n /** Exact capability selection inherited by new top-level sessions. */\n sessionToolDefaults?: WorkspaceSessionToolDefaults | undefined;\n /** Allowlisted sandbox image for new managed boxes; absent uses the deployment image. */\n defaultSandboxImage?: string | null | undefined;\n /** Placement for new chats; null follows the deployment default. */\n defaultExecutionTarget?: WorkspaceDefaultExecutionTarget | null | undefined;\n voiceInput?: WorkspaceVoiceInputSettings | undefined;\n transcription?: WorkspaceTranscriptionPolicy | undefined;\n maxNestedAgentDepth?: number | null | undefined;\n /** Default for new Codex sessions; absent ⇒ remote_v2. */\n codexCompactionDefault?: \"remote_v2\" | \"portable\" | undefined;\n /** Whether agents may invoke the built-in structured human-input tool. */\n agentHumanInputEnabled?: boolean | undefined;\n /**\n * What an ordinary Send does in the console composer while the agent is\n * working: `queue` (absent) runs it after the current turn, `steer` has the\n * agent read it at its next model step.\n */\n busySend?: \"queue\" | \"steer\" | undefined;\n /** Whether agents get the Jev-backed code_search tool; absent or null follows the deployment. */\n codeSearchEnabled?: boolean | null | undefined;\n /**\n * Realtime voice settings by realtime model id. Read one model's settings\n * from the realtime model catalog's `workspaceVoiceSettings`.\n */\n realtimeVoice?: Record<string, unknown> | undefined;\n /** The workspace's default realtime voice model; null or absent follows the organization. */\n realtimeDefaultModel?: string | null | undefined;\n slackReactionSummon?: WorkspaceSlackReactionSummonSettings | undefined;\n /** Slack orchestration notices; both default off when absent or invalid. */\n slackOrchestrationNotices?: WorkspaceSlackOrchestrationNoticeSettings | undefined;\n /** False blocks every model billed in Opengeni credits; absent allows them. */\n allowCreditModels?: boolean | undefined;\n [key: string]: unknown;\n};\n\nexport type WorkspaceSessionDefaults = {\n model: string;\n reasoningEffort: ReasoningEffort;\n};\n\nexport type WorkspaceSessionToolDefaults = {\n inheritConnectedMcpServers?: boolean | undefined;\n mcpServerIds?: string[];\n firstPartyMcpTools?: FirstPartyMcpToolName[];\n};\n\nexport type WorkspaceSlackReactionSummonSettings = {\n enabled: boolean;\n emoji: \"genie\";\n channelPolicy: { mode: \"bot_member\" } | { mode: \"allowlist\"; channelIds: string[] };\n};\n\n/**\n * Per-workspace switches for the two Slack orchestration notices. Both are off\n * unless the workspace explicitly turned them on.\n */\nexport type WorkspaceSlackOrchestrationNoticeSettings = {\n /** Post a pointer card when a child worker blocks on input or an approval. */\n childRequiresAction?: boolean | undefined;\n /** Post one line when a goal pauses for budget or the continuation cap. */\n goalPaused?: boolean | undefined;\n};\n\nexport type SlackReactionChannel = {\n id: string;\n name: string | null;\n isPrivate: boolean;\n};\n\nexport type SlackReactionChannelListResponse = {\n channels: SlackReactionChannel[];\n nextCursor: string | null;\n};\n\nexport type SlackChannelRoute = {\n slackChannelId: string;\n targetWorkspaceId: string;\n targetWorkspaceName: string | null;\n /** Set when a Slack agent answers in this channel. */\n slackAgentId?: string | null | undefined;\n slackAgentName?: string | null | undefined;\n source: \"picker\" | \"admin\";\n updatedAt: string;\n};\n\nexport type SlackChannelRouteListResponse = {\n routes: SlackChannelRoute[];\n routingEnabled: boolean;\n};\n\nexport type UpdateSlackChannelRoutesRequest = {\n connectionId: string;\n routes: Array<{\n slackChannelId: string;\n targetWorkspaceId: string | null;\n /** A Slack agent working in `targetWorkspaceId`; omitted or null is plain Opengeni. */\n slackAgentId?: string | null | undefined;\n }>;\n};\n\nexport type VoiceInputProviderId =\n | \"azure-mai\"\n | \"azure-speech\"\n | \"elevenlabs\"\n | \"supergrok-subscription\"\n | \"codex-subscription\"\n | \"openai\"\n | \"azure-openai\";\n\nexport type WorkspaceVoiceInputSettings = {\n enabled: boolean;\n preferredProvider?: VoiceInputProviderId | null | undefined;\n fallbackEnabled?: boolean | undefined;\n};\n\nexport type UpdateWorkspaceSettingsRequest = {\n /** Independent model patches; null restores that model's default. */\n modelCompactionThresholds?: Record<string, number | null>;\n memoryEnabled?: boolean | undefined;\n memoryPromptMode?: \"legacy_standing\" | \"retrieval_only\" | undefined;\n /** null removes the workspace's own default so it follows its organization's. */\n sessionDefaults?: WorkspaceSessionDefaults | null | undefined;\n sessionToolDefaults?:\n | {\n mcpServerIds?: string[] | null;\n firstPartyMcpTools?: FirstPartyMcpToolName[] | null;\n inheritConnectedMcpServers?: boolean | null;\n }\n | undefined;\n voiceInput?: WorkspaceVoiceInputSettings | undefined;\n transcription?: WorkspaceTranscriptionPolicy | undefined;\n maxNestedAgentDepth?: number | null | undefined;\n codexCompactionDefault?: \"remote_v2\" | \"portable\" | undefined;\n agentHumanInputEnabled?: boolean | undefined;\n busySend?: \"queue\" | \"steer\" | undefined;\n codeSearchEnabled?: boolean | null | undefined;\n /**\n * Voice settings by realtime model id, for example\n * `{ \"workspace-elevenlabs/eleven_realtime_v1_max\": { voice: \"<voice id>\", language: \"no\" } }`.\n * Each listed model's settings are replaced; null removes that model's\n * settings; models not listed keep theirs.\n */\n realtimeVoice?: Record<string, RealtimeVoiceSettings | null> | undefined;\n /**\n * The voice model new voice conversations in this workspace start with\n * until the person picks one; null follows the organization again.\n */\n realtimeDefaultModel?: SessionRealtimeModel | null | undefined;\n slackReactionSummon?: WorkspaceSlackReactionSummonSettings | undefined;\n slackOrchestrationNotices?: WorkspaceSlackOrchestrationNoticeSettings | undefined;\n /** One of `listWorkspaceSandboxImages().images`, or null for the deployment image. */\n defaultSandboxImage?: string | null | undefined;\n /** Placement for new chats; null follows the deployment default. */\n defaultExecutionTarget?: WorkspaceDefaultExecutionTarget | null | undefined;\n /** Agent defaults for new sessions; null clears. Requires the admission switch. */\n sessionAgentDefaults?: WorkspaceAgentDefaults | null | undefined;\n /**\n * False blocks every model billed in Opengeni credits in this workspace,\n * including ones added later; true allows them again.\n */\n allowCreditModels?: boolean | undefined;\n [key: string]: unknown;\n};\n\nexport type SetWorkspaceDefaultRigRequest = {\n rigId: string | null;\n};\n\nexport type CreateWorkspaceRequest = {\n accountId?: string | undefined;\n name: string;\n slug?: string | undefined;\n externalSource?: string | undefined;\n externalId?: string | undefined;\n agentInstructions?: string | null | undefined;\n};\n\nexport type EnsureWorkspaceRequest = {\n /**\n * Owning organization id. An organization API key may omit it and the\n * workspace is created in the key's own organization; every other caller\n * must send it.\n */\n accountId?: string | undefined;\n externalSource: string;\n externalId: string;\n name: string;\n slug?: string | undefined;\n agentInstructions?: string | null | undefined;\n};\n\nexport type EnsureWorkspaceResponse = {\n workspace: Workspace;\n created: boolean;\n};\n\nexport type UpdateWorkspaceRequest = {\n name?: string | undefined;\n slug?: string | null | undefined;\n agentInstructions?: string | null | undefined;\n};\n\n/**\n * Legacy organization API key access tier, derived by the server from the key's\n * permissions: `full` can provision shared workspaces, external members, and\n * `asUser` sessions (user requests additionally need live membership);\n * `read` only inventories shared workspaces and reads their sessions, events,\n * and files. `developer_setup` configures shared workspaces and budgets without\n * API-key management or credential delegation; its default expiry is 24 hours.\n * Organization-key scope excludes Personal workspaces and bypasses neither\n * session visibility nor the explicit `secrets:read` permission requirement.\n */\nexport type OrganizationApiKeyAccess = \"full\" | \"read\" | \"developer_setup\";\n\n/** Informational preset label; the server recomputes it from explicit permissions. */\nexport type OrganizationAccessPreset = \"read_only\" | \"full\" | \"custom\";\n\n/** Organization-key scope always excludes Personal workspaces. */\nexport type OrganizationWorkspaceScope =\n | { kind: \"all\" }\n | {\n kind: \"selected\";\n /** Up to 500 unique shared-workspace IDs in the same organization. Empty reaches none. */\n workspaceIds: string[];\n };\n\nexport type OrganizationAccessPolicy = {\n preset: OrganizationAccessPreset;\n /** Exact grants, including `workspace:admin` individually; no implicit wildcard. */\n permissions: Permission[];\n workspaceScope: OrganizationWorkspaceScope;\n};\n\nexport type OrganizationActor = \"user\" | \"organization\";\n\nexport type ApiKey = {\n id: string;\n accountId: string;\n workspaceId: string | null;\n name: string;\n description: string | null;\n prefix: string;\n permissions: Permission[];\n /** Organization keys only; omitted for workspace-scoped keys. */\n access?: OrganizationApiKeyAccess | undefined;\n policy?: OrganizationAccessPolicy | undefined;\n workspaceScope?: OrganizationWorkspaceScope | undefined;\n /** Legacy keys retain their historical workspace-admin wildcard. */\n permissionMode?: \"legacy\" | \"explicit\" | undefined;\n /** Organization keys: the service account that holds the key. */\n serviceAccount?:\n | { id: string; name: string; role: OrganizationServiceAccountRole }\n | null\n | undefined;\n expiresAt: string | null;\n revokedAt: string | null;\n lastUsedAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type CreateApiKeyRequest = {\n name: string;\n description?: string | undefined;\n permissions: Permission[];\n expiresAt?: string | undefined;\n};\n\nexport type CreateApiKeyResponse = {\n apiKey: ApiKey;\n /** The full secret token — shown once at creation, never returned again. */\n token: string;\n};\n\nexport type CreateOrganizationApiKeyRequest = {\n name: string;\n description?: string | undefined;\n expiresAt?: string | undefined;\n /** With no policy, omitted means legacy `full`. */\n access?: OrganizationApiKeyAccess | undefined;\n /** Optional creation alias for the developer_setup access tier. */\n preset?: \"developer_setup\" | undefined;\n /** Explicit grants and shared-workspace scope; do not combine with legacy access/preset. */\n policy?: OrganizationAccessPolicy | undefined;\n /** The service account that holds the key; omitted creates one named after the key. */\n serviceAccountId?: string | undefined;\n};\n\n/** The server requires at least one change. Omitted fields stay unchanged. */\nexport type UpdateOrganizationApiKeyRequest = {\n name?: string | undefined;\n description?: string | null | undefined;\n /** Replaces the policy and transitions a legacy key to explicit permission semantics. */\n policy?: OrganizationAccessPolicy | undefined;\n};\n\nexport type ListApiKeysResponse = {\n apiKeys: ApiKey[];\n};\n\n// --- Service accounts ----------------------------------------------------------------------------\n\n/** Up to admin, never owner. A member's keys never hold administrator permissions. */\nexport type OrganizationServiceAccountRole = \"admin\" | \"member\";\n\n/** An organization identity with no person behind it; it holds organization API keys. */\nexport type OrganizationServiceAccount = {\n id: string;\n organizationId: string;\n name: string;\n description: string | null;\n role: OrganizationServiceAccountRole;\n /** Keys that are not revoked, including expired ones. */\n activeKeyCount: number;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type ListOrganizationServiceAccountsResponse = {\n serviceAccounts: OrganizationServiceAccount[];\n};\n\nexport type CreateOrganizationServiceAccountRequest = {\n name: string;\n description?: string | undefined;\n /** Defaults to member. Only an organization administrator can choose admin. */\n role?: OrganizationServiceAccountRole | undefined;\n};\n\n/** The server requires at least one change. Making it a member narrows its keys. */\nexport type UpdateOrganizationServiceAccountRequest = {\n name?: string | undefined;\n description?: string | null | undefined;\n role?: OrganizationServiceAccountRole | undefined;\n};\n\n// --- Connected agents (organization MCP server) ------------------------------------------------\n\n/** An outside agent a person connected to the organization MCP server. */\nexport type OrganizationMcpConnection = {\n id: string;\n /** The name the client registered with (\"Claude Code\"). */\n clientName: string;\n /** Where its sign-in returned to (\"127.0.0.1:4567\", \"cursor.com\"). */\n clientHost: string | null;\n /** Signed-in agents act as the person who connected them. */\n actor: \"user\";\n connectedBy: { subjectId: string; name: string };\n /** What it can do and where. The person's own live access still caps it. */\n policy: OrganizationAccessPolicy;\n createdAt: string;\n lastUsedAt: string | null;\n expiresAt: string;\n revokedAt: null;\n /**\n * Listed agents: whether the caller can disconnect this one. Everyone\n * disconnects their own; owners and admins anyone's, except only an owner an\n * owner's.\n */\n canDisconnect?: boolean;\n};\n\nexport type OrganizationMcpConnectionList = {\n connections: OrganizationMcpConnection[];\n /** Owners and admins see and can disconnect everyone's agents. */\n canManageAll: boolean;\n};\n\nexport type UpdateOrganizationMcpConnectionRequest = {\n access: OrganizationAccessPolicy;\n};\n\n// --- Personal API keys ---------------------------------------------------------------------------\n\n/**\n * A key that acts as the person who created it: their live access in this\n * organization, capped by `access`. It stops working when they leave.\n */\nexport type PersonalApiKey = {\n id: string;\n organizationId: string;\n name: string;\n description: string | null;\n /** The first characters of the key, to recognize it. */\n prefix: string;\n access: OrganizationAccessPolicy;\n owner: { subjectId: string; name: string };\n expiresAt: string | null;\n lastUsedAt: string | null;\n createdAt: string;\n /**\n * Listed keys: whether the caller can revoke this one. Everyone revokes their\n * own; owners and admins anyone's, except only an owner an owner's.\n */\n canRevoke?: boolean;\n};\n\nexport type ListPersonalApiKeysResponse = {\n apiKeys: PersonalApiKey[];\n /** Owners and admins see everyone's keys and can revoke them. */\n canManageAll: boolean;\n};\n\nexport type CreatePersonalApiKeyRequest = {\n name: string;\n description?: string | undefined;\n access: OrganizationAccessPolicy;\n /** Omitted means the key never expires. */\n expiresAt?: string | undefined;\n};\n\nexport type CreatePersonalApiKeyResponse = {\n apiKey: PersonalApiKey;\n /** The full secret token, shown once at creation. */\n token: string;\n};\n\n/** A pending agent sign-in, as the web app's sign-in page shows it. */\nexport type McpConnectionRequest = {\n client: { name: string; host: string | null };\n person: { name: string | null };\n organizations: Array<{\n id: string;\n name: string;\n workspaces: Array<{ id: string; name: string; personal: boolean }>;\n /** Everything the person can do there; the most an agent can get. */\n grantable: Permission[];\n }>;\n defaultOrganizationId: string | null;\n};\n\nexport type McpConnectionDecision =\n | { decision: \"deny\" }\n | {\n decision: \"approve\";\n organizationId: string;\n access: OrganizationAccessPolicy;\n };\n\n// --- Inbox ---------------------------------------------------------------------------------------\n\n/** Why an inbox item waits on the person. */\nexport type InboxItemKind = \"question\" | \"approval\" | \"goal_paused\" | \"notification\" | \"reply\";\n\n/**\n * One thing that waits on the person: a question, an approval, a goal the agent\n * paused on them, or an agent's notification. It leaves the inbox when it is\n * answered, resolved, withdrawn or dismissed; it stays in the session's timeline.\n */\nexport type InboxItem = {\n id: string;\n workspaceId: string;\n sessionId: string;\n sessionTitle: string | null;\n kind: InboxItemKind;\n /** The question or approval id, or the notification key. */\n sourceKey: string;\n title: string;\n /** A notification's subtitle; empty otherwise. */\n subtitle: string;\n /** Plain text, or for a notification its message (paragraphs, \"- \" bullets, **bold**, `code`, links). */\n body: string;\n /** A notification's label/value facts (at most four); empty otherwise. */\n facts: InboxItemFact[];\n /** A notification's link outside the session, or null. */\n link: InboxItemLink | null;\n /**\n * The session event that opened or last updated the item: open the session\n * at this point. Null for items from before this was recorded.\n */\n eventSequence: number | null;\n /** One-tap answers for a single short choice question; empty otherwise. */\n choices: InboxItemChoice[];\n /**\n * An approval whose tool's MCP server asks the person a question in the\n * middle of the call: the title is then the server's question. A `confirm`\n * is answered with Allow or Deny (send `elicitationRound: round` with the\n * approval); a `form` is answered in the session, where the approval card\n * shows its fields. Null or absent otherwise.\n */\n serverQuestion?: InboxItemServerQuestion | null;\n urgency: \"normal\" | \"time_sensitive\";\n status: \"open\" | \"resolved\" | \"withdrawn\" | \"dismissed\";\n /** True while the person has not seen the item's current content. */\n unread: boolean;\n snoozedUntil: string | null;\n createdAt: string;\n updatedAt: string;\n resolvedAt: string | null;\n /** Another workspace member whose agent sent this notification; null for the person's own. */\n sender?: InboxItemSender | null;\n /**\n * Whether the person can open the session the item came from. False for\n * another member's private session: show no session link then.\n */\n sessionAvailable?: boolean;\n};\n\n/** The member an agent notified the person for. */\nexport type InboxItemSender = { subjectId: string; label: string };\n\n/** A short label and value an agent attached to a notification. */\nexport type InboxItemFact = { label: string; value: string };\n\n/** A place outside the session an agent's notification points to. */\nexport type InboxItemLink = { url: string; label: string };\n\n/** An option of the question behind an inbox item, answerable in one tap. */\nexport type InboxItemChoice = { id: string; label: string };\n\n/**\n * The MCP server asking about an approval in the inbox, how the person\n * answers (`confirm` has nothing to fill in, `form` has fields) and which of\n * the call's questions it is: send `round` back as `elicitationRound`.\n */\nexport type InboxItemServerQuestion = {\n server: string;\n kind: \"confirm\" | \"form\";\n round: number;\n};\n\nexport type ListInboxResponse = {\n items: InboxItem[];\n /** Open, unsnoozed items that need the person (questions, approvals, paused goals). */\n needsYouCount: number;\n /** Open, unsnoozed, unread items of any kind. */\n unreadCount: number;\n};\n\n/** The person's own attention on an item; answering happens in the session. */\nexport type UpdateInboxItemInput = {\n seen?: true;\n /** ISO time to hide the item until, or null to unsnooze. */\n snoozedUntil?: string | null;\n dismissed?: true;\n};\n\n/**\n * What agents may do in the person's inbox: tidy notifications (from their own\n * sessions, or any agent's), or `full_access` to see every open item and\n * snooze or dismiss it. Agents never answer or approve for the person.\n */\nexport type InboxTidyPolicy = \"own_sessions\" | \"any_agent\" | \"full_access\";\n\nexport type InboxSettings = {\n tidyPolicy: InboxTidyPolicy;\n /**\n * Goals an agent paused in the person's own sessions reach the inbox. Off by\n * default. Always present in responses; leave it out of an update to keep it.\n */\n pausedGoals?: boolean;\n /**\n * Keep each session's latest reply in the inbox until the person clears it.\n * Off by default. Always present in responses; leave it out to keep it.\n */\n replies?: boolean;\n /**\n * Alert the phone for the agent's questions and approvals as time-sensitive,\n * so they break through Focus on iPhone. Off by default. Always present in\n * responses; leave it out to keep it.\n */\n timeSensitiveNeedsYou?: boolean;\n};\n\n/**\n * The signed-in person's mute on one session. Muted replies neither reach the\n * inbox nor alert the phone; the agent's notifications, questions and\n * approvals still do. `scope` is \"schedule\" when the session is a run of a\n * schedule that starts a new session per run: the mute then covers every run\n * of that schedule. Older servers omit it.\n */\nexport type SessionInboxMute = {\n repliesMuted: boolean;\n scope?: \"session\" | \"schedule\";\n};\n\n/**\n * Whether other members' agents may notify the signed-in person in one\n * workspace. Each person decides for themselves; off by default.\n */\nexport type MemberNotificationsSetting = {\n allowOthers: boolean;\n};\n\n// --- Excel workbooks connected by an Office add-in -------------------------------------------\n\n/** A short-lived ticket that lets one add-in socket connect a workbook to a workspace. */\nexport type OfficeWorkbookTicket = {\n ticket: string;\n expiresAt: string;\n /** The socket's path on the Opengeni API, such as \"/v1/office/workbooks/live\". */\n path: string;\n /** The socket's full URL on the deployment's public API, when it has one. */\n url?: string;\n /** The WebSocket subprotocol the socket must offer. */\n protocol: string;\n};\n\n/** An open workbook the caller's agents in a workspace can reach with `excel_run`. */\nexport type OfficeWorkbook = {\n id: string;\n name: string;\n /** \"Excel on the web\", \"Excel for Mac\", \"Excel for Windows\"... */\n app: string;\n version: string | null;\n excelApi: string | null;\n connectedAt: string;\n};\n\n// --- Native app sign-in (authorization code + PKCE over the app's scheme) ----------------------\n\n/** `office`: the Opengeni add-in for Excel, signed in from its task pane. */\nexport type NativeAppPlatform = \"ios\" | \"android\" | \"macos\" | \"windows\" | \"linux\" | \"office\";\n\nexport type NativeAppAuthorizeInput = {\n /**\n * Exactly `<registered scheme>://auth/callback`, or for the Office add-in the\n * deployment's own `<web origin>/office/auth-callback.html`.\n */\n redirectUri: string;\n /** Base64url SHA-256 of the app's code verifier. */\n codeChallenge: string;\n codeChallengeMethod: \"S256\";\n state?: string;\n platform: NativeAppPlatform;\n deviceName?: string;\n};\n\nexport type NativeAppTokenInput = {\n code: string;\n codeVerifier: string;\n redirectUri: string;\n};\n\nexport type NativeAppToken = {\n /** Sent as `Authorization: Bearer <accessToken>` (the client's `apiKey`). */\n accessToken: string;\n tokenType: \"Bearer\";\n expiresAt: string;\n};\n\n/**\n * What a signed-in app is pushed about, for sessions its person started:\n * `needs_input` (a question or an approval), `reply_ready` (a turn finished),\n * `failed` (a turn failed) and `agent` (the agent chose to notify).\n */\nexport type NativePushRule =\n | \"needs_input\"\n | \"reply_ready\"\n | \"failed\"\n | \"agent\"\n /** Agents working for this person may ring this phone (off unless the person turns it on). */\n | \"call\"\n /** Agents of other members of a shared workspace may ring it too; needs `call`. */\n | \"call_members\";\n\nexport type RegisterNativePushDeviceInput = {\n platform: NativeAppPlatform;\n /** The app's bundle identifier (iOS) or package name (Android). */\n appId: string;\n /** APNs environment of the build; FCM ignores it. */\n environment: \"development\" | \"production\";\n /** The APNs device token (hex) or FCM registration token. */\n token: string;\n rules: NativePushRule[];\n /** iOS PushKit token that agent calls ring; iOS keeps no call rules without it. */\n voipToken?: string | null;\n};\n\n/** This app credential's push registration. */\nexport type NativePushDevice = {\n platform: NativeAppPlatform;\n appId: string;\n environment: \"development\" | \"production\";\n token: string;\n rules: NativePushRule[];\n voipToken?: string | null;\n updatedAt: string;\n};\n\n/** Where an agent's call to a person stands. */\nexport type AgentCallState = \"ringing\" | \"answered\" | \"declined\" | \"missed\" | \"cancelled\";\n\n/**\n * An agent ringing a person's phones (`call_user`). Only the person called can\n * read, answer or decline it. Answering opens the chat's voice call.\n */\nexport type AgentCall = {\n id: string;\n workspaceId: string;\n sessionId: string;\n /** Who the ring screen shows as calling. */\n callerLabel: string | null;\n /** Why the agent calls, in a few words. */\n reason: string;\n state: AgentCallState;\n ringUntil: string;\n createdAt: string;\n endedAt: string | null;\n /** Whether this phone (app credential) took the call; null when unknown. */\n answeredHere: boolean | null;\n};\n\n/**\n * Phones a product embedding Opengeni rings for agent calls itself, from the\n * `session.agentCall.ringing` webhook with its own push credentials. Agents\n * count them alongside the person's Opengeni app phones.\n */\nexport type AgentCallHostPhones = {\n /** How many of the person's phones the product rings for agents, 1..20. */\n phones: number;\n /** Whether agents working for other members of a shared workspace may ring them too. */\n teammates: boolean;\n updatedAt: string;\n};\n\n// --- Organization-wide session list (org API key or organization owner) -----------------------\n\nexport type ListOrganizationSessionsOptions = {\n /** Page size, 1..200; the server default is 50. */\n limit?: number | undefined;\n /** `nextCursor` from the previous page. */\n cursor?: string | undefined;\n /** Keep only sessions labelled with this exact end user. */\n scopeSubjectId?: string | undefined;\n /** Keep only sessions in this exact lifecycle state. */\n status?: SessionStatus | undefined;\n signal?: AbortSignal | undefined;\n};\n\n/**\n * One page of `GET /v1/organizations/:organizationId/sessions`. Rows come from\n * every shared workspace the caller may read, each carrying its\n * `workspaceId`; personal workspaces are never included and private sessions\n * stay invisible. A page may be shorter than `limit` while `nextCursor` is\n * still set, so follow `nextCursor` until it is null.\n */\nexport type OrganizationSessionListResponse = {\n sessions: Session[];\n nextCursor: string | null;\n};\n\n// A person (or API key) with access to a workspace. `subjectId` is\n// `user:<betterAuthUserId>` or `api_key:<id>`; the People surface lists the\n// `user:` subjects (api_key subjects belong to the API keys section).\nexport type WorkspaceMember = {\n subjectId: string;\n subjectLabel: string | null;\n role: string;\n permissions: Permission[];\n createdAt: string;\n};\n\nexport type ListWorkspaceMembersResponse = {\n members: WorkspaceMember[];\n};\n\nexport type WorkspaceMemberCandidate = {\n organizationMembershipId: string;\n subjectId: string;\n name: string | null;\n email: string | null;\n organizationRole: \"owner\" | \"admin\" | \"member\";\n};\n\nexport type ListWorkspaceMemberCandidatesResponse = {\n members: WorkspaceMemberCandidate[];\n};\n\nexport type AddWorkspaceMemberRequest = {\n organizationMembershipId: string;\n role?: string | undefined;\n permissions: Permission[];\n};\n\nexport type UpdateWorkspaceMemberRequest = {\n role?: string | undefined;\n permissions: Permission[];\n};\n\nexport type SlackUserLinkAccessRequestStatus =\n | \"prepared\"\n | \"pending\"\n | \"completed\"\n | \"denied\"\n | \"cancelled\"\n | \"expired\";\n\n/** Token-free durable projection of one signed Slack identity-link intent. */\nexport type SlackUserLinkAccessRequest = {\n id: string;\n workspaceId: string;\n workspaceDisplayName: string | null;\n subjectLabel: string | null;\n status: SlackUserLinkAccessRequestStatus;\n version: number;\n expiresAt: string;\n requestedAt: string | null;\n decidedAt: string | null;\n completedAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type PrepareSlackUserLinkAccessRequest = {\n linkToken: string;\n};\n\nexport type SlackUserLinkAccessMutationRequest = {\n expectedVersion: number;\n idempotencyKey: string;\n};\n\nexport type ApproveSlackUserLinkAccessRequest = SlackUserLinkAccessMutationRequest & {\n role?: string | undefined;\n permissions: Permission[];\n};\n\nexport type ListSlackUserLinkAccessRequestsResponse = {\n requests: SlackUserLinkAccessRequest[];\n};\n\n// --- Goals -------------------------------------------------------------------\n\nexport type SessionGoalStatus = \"active\" | \"paused\" | \"completed\";\n\nexport type SessionGoalCreatedBy = \"api\" | \"agent\" | \"scheduled_task\";\n\nexport type SessionGoalMutationPolicy =\n | \"review_changes\"\n | \"preserve_intent\"\n | \"autonomous_adaptation\";\n\nexport type SessionGoalChangeKind = \"refinement\" | \"adaptation\" | \"replacement\";\n\nexport type SessionGoalRevision = {\n id: string;\n accountId: string;\n workspaceId: string;\n sessionId: string;\n goalId: string;\n disposition: \"applied\" | \"proposed\" | \"rejected\";\n changeKind: SessionGoalChangeKind;\n baseObjectiveRevision: number;\n resultObjectiveRevision: number | null;\n text: string;\n successCriteria: string | null;\n rootConstraints: string[];\n mutationPolicy: SessionGoalMutationPolicy;\n rationale: string;\n actor: \"agent\" | \"api\" | \"scheduled_task\";\n actorTurnId: string | null;\n actorAttemptId: string | null;\n proposalId: string | null;\n rollbackOfRevisionId: string | null;\n createdAt: string;\n};\n\nexport type ApplySessionGoalRevisionRequest = {\n expectedObjectiveRevision: number;\n rationale?: string | undefined;\n};\n\nexport type ListSessionGoalRevisionsOptions = {\n limit?: number | undefined;\n before?: string | undefined;\n};\n\nexport type ListSessionGoalRevisionsResponse = {\n revisions: SessionGoalRevision[];\n hasMore: boolean;\n nextCursor: string | null;\n};\n\nexport type RejectSessionGoalRevisionRequest = {\n expectedObjectiveRevision: number;\n rationale: string;\n};\n\nexport type RejectSessionGoalRevisionResponse = {\n revision: SessionGoalRevision;\n replay: boolean;\n};\n\nexport type RollbackSessionGoalRevisionRequest = {\n expectedObjectiveRevision: number;\n rationale: string;\n};\n\nexport type SessionGoalContinuationState =\n | \"inactive\"\n | \"scheduled\"\n | \"running\"\n | \"blocked\"\n | \"invariant_broken\";\n\nexport type SessionGoalContinuationReason =\n | \"goal_inactive\"\n | \"wake_pending\"\n | \"continuation_pending\"\n | \"human_work_pending\"\n | \"goal_turn_running\"\n | \"human_turn_running\"\n | \"workstream_paused\"\n | \"approval_required\"\n | \"provider_backpressure\"\n | \"session_cancelled\"\n | \"system_work_pending\"\n | \"held_for_input\"\n | \"backoff_pending\"\n | \"missing_obligation\";\n\nexport type SessionGoalContinuation = {\n state: SessionGoalContinuationState;\n reason: SessionGoalContinuationReason;\n wakeRevision: number;\n observedRevision: number;\n nextAttemptAt: string | null;\n lastError: string | null;\n /** Agent-stated reason for a `wait_for_input` hold; null otherwise. */\n holdReason?: string | null | undefined;\n};\n\nexport type SessionGoal = {\n id: string;\n accountId: string;\n workspaceId: string;\n sessionId: string;\n status: SessionGoalStatus;\n text: string;\n successCriteria: string | null;\n rootConstraints: string[];\n /** Optional for older-server/source compatibility; current servers always supply this projection. */\n reportRequirements?: SessionGoalReportRequirement[] | undefined;\n evidence: string | null;\n rationale: string | null;\n pausedReason: string | null;\n createdBy: SessionGoalCreatedBy;\n version: number;\n objectiveRevision: number;\n mutationPolicy: SessionGoalMutationPolicy;\n autoContinuations: number;\n noProgressStreak: number;\n maxAutoContinuations: number | null;\n metadata: Record<string, unknown>;\n /** Optional for source compatibility; the API always supplies this projection. */\n continuation?: SessionGoalContinuation | undefined;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type UpdateSessionGoalRequest =\n | {\n status: \"paused\" | \"active\";\n rationale?: string | undefined;\n }\n | {\n text: string;\n successCriteria?: string | null | undefined;\n rootConstraints?: string[] | undefined;\n mutationPolicy?: SessionGoalMutationPolicy | undefined;\n rationale: string;\n expectedObjectiveRevision: number;\n };\n\nexport type UpdateSessionRequest = {\n title?: string | undefined;\n /** Empty string clears the description. */\n description?: string | null | undefined;\n avatar?: SessionAvatar | null | undefined;\n};\n\n// --- Operator context controls (/clear, /compact) ----------------------------\n\n/** Outcome of a manual /compact trigger. */\nexport type CompactSessionContextResult = {\n /** pending waits for the current safe boundary; completed ran while idle. */\n status: \"pending\" | \"completed\" | \"noop\";\n message: string;\n};\n\n// --- Turn queue --------------------------------------------------------------\n\nexport type EffectiveControlBlocker = {\n kind: \"session\" | \"workspace\";\n sessionId?: string | undefined;\n displayName: string;\n actor: string | null;\n reason: string | null;\n changedAt: string | null;\n revision: number;\n};\n\nexport type EffectiveControlResumeOption = {\n scope: \"selected\" | \"session\" | \"workspace\";\n targetId?: string | undefined;\n selectedStateAfter: \"active\" | \"paused\";\n remainingPrimaryBlocker?: EffectiveControlBlocker | undefined;\n impactCopy: string;\n};\n\nexport type EffectiveSessionControl = {\n state: \"active\" | \"paused\";\n controlVersion: number;\n controlEtag: string;\n directState: \"active\" | \"paused\";\n primaryBlocker: EffectiveControlBlocker | null;\n additionalBlockerCount: number;\n blockers: EffectiveControlBlocker[];\n resumeOptions: EffectiveControlResumeOption[];\n override: { rootSessionId: string; revision: number } | null;\n settlement: {\n state: \"stopping\";\n attemptCount: number;\n interruptionPendingCount: number;\n quiescencePendingCount: number;\n } | null;\n backgroundCommandSettlement?: { state: \"stopping\"; commandCount: number } | null | undefined;\n};\n\nexport type SessionCommandReceipt = {\n id: string;\n action: string;\n operationKey: string;\n targetSessionId: string | null;\n targetTurnId: string | null;\n appliedControlRevision: number | null;\n appliedQueueVersion: number | null;\n appliedTurnVersion: number | null;\n appliedDraftRevision: number | null;\n createdAt: string;\n};\n\nexport type SessionPromptRouting =\n | \"accepted_for_execution\"\n | \"queued_for_execution\"\n | \"accepted_for_steering\";\n\nexport type ComposerDraft = {\n revision: number;\n text: string;\n annotations?: DraftTimelineAnnotation[] | undefined;\n resources: ResourceRef[];\n model: string;\n reasoningEffort: ReasoningEffort;\n latencyMode: LatencyMode;\n /**\n * True when the draft has no model choice of its own: `model`,\n * `reasoningEffort` and `latencyMode` are then the chat's current settings\n * and follow every later change to them (for example by the agent). Send a\n * model with this draft only after the person picks one. Absent from\n * servers that predate it, which means false.\n */\n policyFollowsSession?: boolean | undefined;\n sourceTurnId: string | null;\n sourceTurnVersion: number | null;\n updatedAt: string | null;\n};\n\nexport type NewSessionDraftOptions = {\n agentLearning?: import(\"@opengeni/contracts\").AgentLearningOverrides | undefined;\n excludedMcpServerIds?: string[] | undefined;\n visibility?: SessionVisibility | undefined;\n sandboxBackend?: SandboxBackend | undefined;\n targetSandboxId?: string | undefined;\n workingDir?: string | undefined;\n rigId?: string | undefined;\n goal?: GoalSpec | undefined;\n firstPartyMcpPermissions?: Permission[] | undefined;\n firstPartyMcpTools?: FirstPartyMcpToolName[] | undefined;\n agent?: AgentConfigRequest | undefined;\n};\n\nexport type NewSessionSelectionHistory = {\n /** Most-recently used project first. Null channelId is the Default project. */\n projects: Array<{\n channelId: string | null;\n /** Null means the managed sandbox was used most recently in this project. */\n targetSandboxId: string | null;\n /** Most-recently used machine in this project first. */\n machines: Array<{ sandboxId: string; workingDir: string | null }>;\n }>;\n};\n\nexport type NewSessionDraft = {\n revision: number;\n text: string;\n resources: ResourceRef[];\n tools: ToolRef[];\n /** False inherits the workspace-default MCP policy; true preserves an explicit array. */\n toolsProvided: boolean;\n model: string;\n reasoningEffort: ReasoningEffort;\n latencyMode: LatencyMode;\n /**\n * True when the person chose this model policy; false follows the resolved\n * default for new chats. Absent from older servers.\n */\n modelProvided?: boolean | undefined;\n /** Absent on legacy drafts; null records an explicit Default-project selection. */\n selectedProjectChannelId?: string | null | undefined;\n options: NewSessionDraftOptions;\n selectionHistory: NewSessionSelectionHistory;\n /**\n * Read-only: the caller's own default placement for new chats (\"Your default\n * machine\") when usable now. A fresh form starts on it ahead of the\n * workspace default. Older servers omit it.\n */\n memberDefaultExecutionTarget?: WorkspaceDefaultExecutionTarget | null | undefined;\n updatedAt: string | null;\n};\n\nexport type SessionQueueSnapshot = {\n version: number;\n effectiveControl: EffectiveSessionControl;\n /** Secret-safe personal MCP summaries frozen on the exact active turn. */\n activePersonalConnections: McpPersonalConnectionSummary[];\n /** The latest interrupted attempt has not yet durably proved physical quiescence. */\n stoppingPreviousAttempt: boolean;\n items: SessionTurn[];\n /** Canonical pending machine inputs. Events only invalidate this snapshot. */\n pendingInputs: SessionPendingInputPreview[];\n /** Exact next bounded input batch that will join an already-waiting prompt. */\n pendingInputAttachment: {\n turnId: string;\n inputIds: string[];\n } | null;\n};\n\nexport type SessionPendingInputPreview = Pick<\n SessionSystemUpdate,\n \"id\" | \"sessionId\" | \"kind\" | \"classification\" | \"sourceId\" | \"summary\" | \"createdAt\"\n>;\n\nexport type SystemUpdateClassification = \"success\" | \"failure\" | \"action_required\" | \"info\";\n\nexport type SessionSystemUpdateKind =\n | \"scheduled_occurrence\"\n | \"goal_continuation\"\n | \"agent_message\"\n | \"agent_steer_instruction\"\n | \"session_wait_timeout\"\n | \"background_command_result\"\n | \"child_terminal_result\"\n | \"media_generation_result\"\n | \"child_requires_action\"\n | \"child_requires_action_resolved\"\n | \"child_paused\"\n | \"child_waiting_capacity\"\n | \"child_progress\"\n | \"secret_use_approval_decided\"\n | \"capability_setup_completed\";\n\nexport type SessionSystemUpdateState =\n | \"pending\"\n | \"delivered\"\n | \"cancelled\"\n | \"superseded\"\n | \"failed\";\n\nexport type SessionSystemUpdatePayload =\n | {\n type: \"session_wait_timeout\";\n waitTurnId: string;\n deadlineAt: string;\n reason: string;\n [key: string]: unknown;\n }\n | {\n type: \"background_command_result\";\n commandId: string;\n state: \"exited\" | \"lost\";\n exitCode: number | null;\n reason: string;\n outputLocator: {\n eventType: \"sandbox.command.output.delta\";\n commandId: string;\n };\n /** Bounded start and end of the output (absent for lost commands and older results). */\n output?: string | undefined;\n [key: string]: unknown;\n }\n | ({\n type: Exclude<SessionSystemUpdateKind, \"session_wait_timeout\" | \"background_command_result\">;\n } & Record<string, unknown>);\n\nexport type SessionSystemUpdate = {\n id: string;\n sessionId: string;\n kind: SessionSystemUpdateKind;\n classification: SystemUpdateClassification;\n sourceId: string;\n dedupeKey: string;\n summary: string;\n payload: SessionSystemUpdatePayload;\n lineage: Record<string, unknown>;\n state: SessionSystemUpdateState;\n deliveredTurnId: string | null;\n deliveredHistoryItemId: string | null;\n deliveredAt: string | null;\n createdAt: string;\n};\n\nexport type SessionRetryRequest = {\n clientEventId: string;\n failureEventId: string;\n model?: string;\n reasoningEffort?: ReasoningEffort;\n latencyMode?: LatencyMode;\n};\n\nexport type SandboxRecoverySelection = {\n version: 1;\n sessionId: string;\n sandboxGroupId: string;\n leaseId: string;\n routeEpoch: number;\n authorityEpoch: number;\n leaseEpoch: number;\n workspaceGeneration: number;\n archiveGeneration: number;\n artifactId: string;\n revision: string;\n capturedAt: string;\n};\n/** The checkpoint automatic recovery restores, native or portable.\n * `artifactId` is null for a portable archive. */\nexport type SandboxCheckpointSelection = Omit<SandboxRecoverySelection, \"artifactId\"> & {\n artifactId: string | null;\n};\nexport type SandboxRecoveryTarget = {\n sessionId: string;\n sandboxGroupId: string;\n leaseId: string;\n routeEpoch: number;\n authorityEpoch: number;\n leaseEpoch: number;\n workspaceGeneration: number;\n archiveGeneration: number | null;\n revision: string | null;\n restoreStatus: string;\n restoreCompletedAt: string | null;\n};\nexport type SandboxRecoveryProjection = {\n version: 1;\n status: \"unsupported\" | \"blocked\" | \"eligible\" | \"consent_accepted\" | \"restoring\" | \"restored\";\n reason: string | null;\n /** The registered native checkpoint a person can consent to restore, and for\n * an automatic Retry its checkpoint when that one is native. */\n checkpoint: SandboxRecoverySelection | null;\n operationId: string | null;\n target?: SandboxRecoveryTarget;\n retryAvailable?: boolean;\n freshWorkspaceAvailable?: boolean;\n groupSessionCount?: number;\n automaticAvailable?: boolean;\n /** What an automatic Retry does: restore `automaticCheckpoint`, or continue\n * on a new empty workspace because no usable checkpoint survived the loss. */\n automaticLane?: \"checkpoint\" | \"fresh_workspace\";\n /** The checkpoint an automatic Retry restores (lane `checkpoint`), native or\n * portable. `checkpoint` is set as well only when it is native. */\n automaticCheckpoint?: SandboxCheckpointSelection;\n /** For a timed recovery wait: the earliest time a Retry or a new message can\n * let Opengeni decide again. Nothing proceeds by itself before then. */\n availableAt?: string;\n};\nexport type SandboxRecoveryRequest =\n | {\n operationId: string;\n acceptHistoricalCheckpoint: true;\n selection: SandboxRecoverySelection;\n }\n | { operationId: string; action: \"retry\"; target: SandboxRecoveryTarget }\n | {\n operationId: string;\n action: \"continue_fresh\";\n acceptEmptyWorkspace: true;\n target: SandboxRecoveryTarget;\n };\nexport type SandboxRecoveryResponse = {\n outcome: \"accepted\" | \"replayed\";\n operationId: string;\n recovery: SandboxRecoveryProjection;\n};\n\nexport type SessionRetryResponse = {\n outcome: \"accepted\" | \"replayed\";\n turnId: string;\n failureEventId: string;\n};\n\nexport type SessionControlResponse = {\n receipt: SessionCommandReceipt;\n effectiveControl: EffectiveSessionControl;\n interruptionCount: number;\n wakeCount: number;\n cancelledSessionCount: number;\n cancelledTurnCount: number;\n};\n\nexport type WorkspacePauseTimer = {\n id: string;\n action: \"pause\" | \"resume\";\n dueAt: string;\n pauseForSeconds: number | null;\n};\nexport type WorkspacePauseTimerRequest = {\n action: \"set\" | \"cancel\";\n pauseInSeconds?: number | undefined;\n pauseForSeconds?: number | null | undefined;\n clientEventId: string;\n expectedRevision: number;\n};\n\nexport type WorkspaceInferenceControlResponse = {\n receipt: SessionCommandReceipt;\n state: \"active\" | \"paused\";\n revision: number;\n interruptionCount: number;\n wakeCount: number;\n};\n\nexport type WorkspaceControlEvent = {\n id: string;\n workspaceId: string;\n /** Same monotonic value as revision; named sequence for SSE resume cursors. */\n sequence: number;\n revision: number;\n type: \"workspace.control.changed\";\n scope: \"workspace\" | \"session\";\n rootSessionId: string | null;\n action: \"pause\" | \"resume\" | \"timer_set\" | \"timer_cancelled\";\n automatic: boolean;\n reason: string | null;\n actor: string;\n occurredAt: string;\n truncation?: {\n truncated: true;\n surface:\n | \"durable_control\"\n | \"database_guard\"\n | \"http_projection\"\n | \"nats_legacy_guard\"\n | \"sse_legacy_guard\";\n deliveredBytes: number;\n fields: Array<{\n field: \"reason\" | \"actor\";\n originalBytes: number;\n deliveredBytes: number;\n omittedBytes: number;\n }>;\n fullEvidence: {\n available: false;\n reason: \"not_retained\";\n };\n } | null;\n};\n\nexport type SessionQueueMutationResponse = {\n receipt: SessionCommandReceipt;\n snapshot: SessionQueueSnapshot;\n draft?: ComposerDraft;\n};\n\nexport type MoveSessionQueueItemRequest = {\n clientEventId: string;\n expectedQueueVersion: number;\n beforeTurnId: string | null;\n};\n\nexport type EditSessionQueueItemRequest = {\n clientEventId: string;\n expectedTurnVersion: number;\n expectedDraftRevision: number;\n replaceDraft: boolean;\n};\n\nexport type SteerSessionQueueItemRequest = {\n clientEventId: string;\n expectedTurnVersion: number;\n controlEtag?: string;\n /**\n * Interrupt the running turn now instead of at its next model step. Also\n * turns an already-waiting Steer into an immediate one.\n */\n interrupt?: boolean;\n};\n\nexport type DeleteSessionQueueItemRequest = {\n clientEventId: string;\n expectedTurnVersion: number;\n reason?: string;\n};\n\nexport type SaveComposerDraftRequest = Omit<\n ComposerDraft,\n | \"revision\"\n | \"sourceTurnId\"\n | \"sourceTurnVersion\"\n | \"updatedAt\"\n | \"policyFollowsSession\"\n | \"model\"\n | \"reasoningEffort\"\n | \"latencyMode\"\n> & {\n expectedRevision: number;\n /**\n * The person's pick in the composer. Omit all three to keep (or return)\n * the draft to the chat's own settings, so it follows later changes.\n */\n model?: string | undefined;\n reasoningEffort?: ReasoningEffort | undefined;\n latencyMode?: LatencyMode | undefined;\n};\n\nexport type SubmitComposerDraftRequest = Omit<SaveComposerDraftRequest, \"expectedRevision\"> & {\n expectedDraftRevision: number;\n clientEventId: string;\n delivery: \"send\" | \"steer\";\n controlEtag?: string;\n modelContext?: string;\n /** IANA time zone of the sender; see `UserMessageEventInput`. */\n timeZone?: string;\n mcpCredentialUpdates?: SessionMcpCredentialUpdateInput[];\n connectionAccounts?: McpConnectionAccountSelection[];\n personalResourceAttachment?: PersonalResourceAttachmentIntent;\n};\n\nexport type SubmitComposerDraftResponse = {\n accepted: SessionEvent;\n turn: SessionTurn;\n draft: ComposerDraft;\n receipt: SessionCommandReceipt;\n routing: SessionPromptRouting;\n interruptionCount: number;\n /** As on `SteerMessageResult`. Older servers omit it. */\n waitsForMachineOwner?: boolean | undefined;\n replay: boolean;\n};\n\nexport type SaveNewSessionDraftRequest = Omit<\n NewSessionDraft,\n \"revision\" | \"selectionHistory\" | \"updatedAt\" | \"memberDefaultExecutionTarget\"\n> & {\n expectedRevision: number;\n};\n\n// --- Scheduled tasks: requests + runs ----------------------------------------\n\n/** Input shape for agent config on create/update (server applies defaults). */\nexport type ScheduledTaskAgentConfigInput = {\n /**\n * Agent configuration frozen into the schedule and used by every run;\n * omitted runs follow the workspace's agent defaults.\n */\n agent?: AgentConfigRequest | undefined;\n knowledgeSource?: Extract<ScheduledTaskAction, { kind: \"knowledge_source_sync\" }> | undefined;\n prompt: string;\n resources?: ResourceRef[] | undefined;\n /**\n * Connectors added on top of the workspace defaults when `toolPolicy` is\n * set; otherwise the exact list. Omit both on a schedule that starts its\n * own session to follow the workspace defaults at each run.\n */\n tools?: ToolRef[] | undefined;\n /** Follow the workspace's default connectors at each run, except the excluded ones. */\n toolPolicy?: ScheduledTaskToolPolicy | undefined;\n metadata?: Record<string, unknown> | undefined;\n slackBotConnectionId?: string | undefined;\n /** Slack channel a person chose for this task's bot posts; requires slackBotConnectionId. */\n slackBotChannelId?: string | undefined;\n model?: string | undefined;\n reasoningEffort?: ReasoningEffort | undefined;\n sandboxBackend?: SandboxBackend | undefined;\n /** Follow the workspace machine when creating each new run chat. */\n executionTarget?: \"workspace_default\" | undefined;\n machineTarget?: { targetSandboxId: string; workingDir?: string | undefined } | undefined;\n goal?: GoalSpec | undefined;\n executionClass?: \"incident_telemetry\" | undefined;\n incidentTelemetryPreflight?: IncidentTelemetryPreflightInput | undefined;\n maxNestedAgentDepth?: number | undefined;\n /**\n * Seconds a run's own turn may wait on a person (tool approval or structured\n * question, 60 s - 30 days) before the scheduler rejects the approval / skips\n * the question as a labelled system decision. Omitted: waits indefinitely.\n */\n approvalTimeoutSeconds?: number | undefined;\n /**\n * Whether each chat this task starts runs unattended: no person answers\n * during the run, so the agent is told to settle open choices itself and\n * report what is left for a person, and calls that need someone's approval\n * are refused instead of waiting. `true` or `false` is a fixed choice.\n * Omitted: unattended by default, unless `approvalTimeoutSeconds` is set;\n * the default ends when a person writes in the chat. A task that posts into\n * an existing chat follows that chat.\n */\n unattended?: boolean | undefined;\n bundledSkillIds?: BundledSkillId[] | undefined;\n /**\n * Remote MCP servers attached to each chat the task starts, as on session\n * create. Static headers are not stored: credentials come from the\n * workspace credential provider or `connectionRef`.\n */\n mcpServers?: ScheduledTaskMcpServer[] | undefined;\n /**\n * Memory, agent reach and inline Skills of each chat the task starts, as on\n * session create. Only a task that starts its own chats can carry them.\n */\n memoryScope?: SessionMemoryScope | undefined;\n agentAccess?: SessionAgentAccess | undefined;\n skills?: ScheduledTaskSkill[] | undefined;\n};\n\nexport type CreateAgentScheduledTaskRequest = {\n agentLearning?: {\n scope: \"workspace\" | \"personal\";\n settings: import(\"./knowledge\").AgentLearningOverrides;\n };\n name: string;\n schedule: ScheduledTaskScheduleSpec;\n /** Who can see it. Omitted: everyone in the workspace. */\n visibility?: SessionVisibility | undefined;\n action?: { kind: \"agent_turn\" } | undefined;\n runMode?: ScheduledTaskRunMode | undefined;\n targetSessionId?: string | null | undefined;\n /**\n * Connector accounts a person pins for a schedule that starts its own\n * session (never an existing-chat schedule, never an agent).\n */\n pinnedAccounts?: McpConnectionAccountSelection[] | undefined;\n /** Skip an occurrence instead of running without an unusable pinned account. */\n pinnedAccountsRequired?: boolean | undefined;\n overlapPolicy?: ScheduledTaskOverlapPolicy | undefined;\n agentConfig: ScheduledTaskAgentConfigInput;\n /** Event triggers and the event run policy. Use schedule `{ type: \"manual\" }` for an event-only automation. */\n events?: ScheduledTaskEventsInput | undefined;\n status?: ScheduledTaskStatus | undefined;\n /**\n * Sandbox Environment each run binds to; its active version is resolved per\n * fire. Omit to resolve it once at create: the workspace default (none for a\n * Connected Machine task), or the target session's own environment for an\n * existing-session task. `null` means none.\n */\n rigId?: string | null | undefined;\n /** Vault narrowing for every run; omission adds none. */\n vaultPolicy?: VaultPolicy | undefined;\n metadata?: Record<string, unknown> | undefined;\n /**\n * Lock the task to its creator: only the same key or signed service\n * identity can later change, run, resume or delete it, and no agent can.\n * A workspace admin can still pause it. Set once at creation.\n */\n creatorLocked?: boolean | undefined;\n};\n\nexport type CreateKnowledgeSourceSyncScheduledTaskRequest = {\n name: string;\n schedule: ScheduledTaskScheduleSpec;\n action: Extract<ScheduledTaskAction, { kind: \"knowledge_source_sync\" }>;\n overlapPolicy?: \"skip\" | \"buffer_one\" | undefined;\n status?: ScheduledTaskStatus | undefined;\n metadata?: Record<string, unknown> | undefined;\n};\n\n/** Send a scheduled message using the destination chat’s current execution settings. */\nexport type CreateSessionScheduledTaskRequest = {\n name: string;\n schedule: ScheduledTaskScheduleSpec;\n prompt: string;\n targetSessionId: string;\n /** A schedule posting into an Only me chat is always Only me. */\n visibility?: SessionVisibility | undefined;\n runMode?: \"existing_session\" | undefined;\n overlapPolicy?: ScheduledTaskOverlapPolicy | undefined;\n status?: ScheduledTaskStatus | undefined;\n /** Event triggers that also post into the chat; `once` makes this a \"wake me when\". */\n events?: ScheduledTaskEventsInput | undefined;\n metadata?: Record<string, unknown> | undefined;\n /** Lock the task to its creator; see the agent-task request. */\n creatorLocked?: boolean | undefined;\n};\n\nexport type CreateScheduledTaskRequest =\n | CreateSessionScheduledTaskRequest\n | CreateAgentScheduledTaskRequest\n | CreateKnowledgeSourceSyncScheduledTaskRequest;\n\nexport type UpdateScheduledTaskRequest = {\n expectedExecutionDigest?: string | undefined;\n adoptSessionSettings?: true | undefined;\n /** Lossless message edit. All omitted configuration is preserved. */\n prompt?: string | undefined;\n name?: string | undefined;\n schedule?: ScheduledTaskScheduleSpec | undefined;\n runMode?: ScheduledTaskRunMode | undefined;\n targetSessionId?: string | null | undefined;\n /** Change who can see it. Only the owner can; a schedule posting into an Only me chat stays Only me. */\n visibility?: SessionVisibility | undefined;\n /** Replace the person-pinned accounts; `[]` unpins every connector. Omitted keeps the pins. */\n pinnedAccounts?: McpConnectionAccountSelection[] | undefined;\n /** Skip occurrences instead of running without an unusable pinned account. */\n pinnedAccountsRequired?: boolean | undefined;\n overlapPolicy?: ScheduledTaskOverlapPolicy | undefined;\n action?: ScheduledTaskAction | undefined;\n agentConfig?: ScheduledTaskAgentConfigInput | undefined;\n /** Lossless model defaults patch; cannot be combined with agentConfig replacement.\n * Existing target/reusable sessions retain their own model and reasoning. */\n agentConfigPatch?:\n | {\n prompt?: string | undefined;\n model?: string | undefined;\n reasoningEffort?: ReasoningEffort | undefined;\n }\n | undefined;\n status?: ScheduledTaskStatus | undefined;\n // The rig each run binds to (M3); active version resolved per fire.\n rigId?: string | null | undefined;\n /** Vault narrowing for every run. */\n vaultPolicy?: VaultPolicy | undefined;\n /** Replace the event triggers and event run policy; `{ triggers: [] }` removes every trigger. */\n events?: ScheduledTaskEventsInput | undefined;\n metadata?: Record<string, unknown> | undefined;\n};\n\nexport type ScheduledTaskRunStatus = \"queued\" | \"dispatched\" | \"succeeded\" | \"skipped\" | \"failed\";\n\nexport type KnowledgeSourceSyncRunSummary = {\n phase: \"queued\" | \"inventory\" | \"transfer\" | \"index\" | \"checkpoint\" | \"completed\" | \"failed\";\n scanned: number;\n imported: number;\n unchanged: number;\n skipped: number;\n failed: number;\n bytes: number;\n providerRequests: number;\n elapsedMs: number;\n indexed: number;\n aclPending: number;\n retryable: boolean;\n limitReached: \"items\" | \"bytes\" | \"file_bytes\" | \"provider_requests\" | \"elapsed_time\" | null;\n checkpointed: boolean;\n reconnectRequired: boolean;\n failures: Array<{\n externalObjectId: string;\n code:\n | \"authority_changed\"\n | \"connection_reconnect_required\"\n | \"provider_unavailable\"\n | \"provider_rejected\"\n | \"provider_payload_invalid\"\n | \"content_unsupported\"\n | \"content_too_large\"\n | \"resource_limit\"\n | \"item_processing_failed\"\n | \"indexing_failed\"\n | \"internal_failure\";\n retryable: boolean;\n message: string;\n }>;\n};\n\nexport type ScheduledTaskTriggerType =\n | \"scheduled\"\n | \"manual\"\n | \"initial\"\n | \"provider_event\"\n | \"retry\"\n | \"repair\"\n | \"event\";\n\nexport type ScheduledTaskRun = {\n id: string;\n accountId: string;\n workspaceId: string;\n taskId: string;\n taskAuthorityRevision: number | null;\n taskExecutionDigest: string | null;\n status: ScheduledTaskRunStatus;\n triggerType: ScheduledTaskTriggerType;\n scheduledAt: string | null;\n firedAt: string;\n sessionId: string | null;\n triggerEventId: string | null;\n actionKind: \"agent_turn\" | \"knowledge_source_sync\";\n knowledgeSyncRunId: string | null;\n knowledgeSummary: KnowledgeSourceSyncRunSummary | null;\n completedAt: string | null;\n error: string | null;\n admissionDiagnostic?:\n | {\n version: 1;\n reason:\n | \"selected_account_unavailable\"\n | \"owner_access_unavailable\"\n | \"ambiguous_account\"\n | \"parent_accounts_required\"\n | \"selection_unavailable\";\n accounts: Array<{\n serverId: string;\n connectionId: string | null;\n reason:\n | \"connector_unavailable\"\n | \"account_not_visible\"\n | \"account_inactive\"\n | \"account_mismatch\"\n | \"selection_unavailable\";\n }>;\n }\n | null\n | undefined;\n /**\n * Pinned connector accounts this run could not use. The run went ahead\n * without those connectors; no other account was used in their place.\n */\n degradedAccounts?:\n | Array<{\n serverId: string;\n connectionId: string | null;\n reason:\n | \"connector_unavailable\"\n | \"account_not_visible\"\n | \"account_inactive\"\n | \"account_mismatch\"\n | \"selection_unavailable\"\n | \"owner_access_unavailable\";\n }>\n | undefined;\n /**\n * Why the scheduler refused this occurrence before running it; `error`\n * equals `reason`. `retryable: true` (status `skipped`): a later occurrence\n * runs once the condition clears. `retryable: false` (status `failed`):\n * every occurrence is refused until the task or a resource it names changes.\n */\n admissionRefusal?: ScheduledTaskAdmissionRefusal | null | undefined;\n /**\n * This dispatched run's own turn is waiting on a person (tool approval or\n * structured question) since `since`; `expiresAt` is when the task's\n * `approvalTimeoutSeconds` answers for it (null: waits indefinitely).\n */\n awaitingHuman?: ScheduledTaskRunAwaitingHuman | null | undefined;\n createdAt: string;\n updatedAt: string;\n /** Connectors this run could not use; projected only for a viewer who can act on the task. */\n accessFailures?: ScheduledTaskRunAccessFailure[] | undefined;\n /** Event runs only: the trigger and events that caused the run. */\n eventOccurrence?: ScheduledTaskRunEventOccurrence | null | undefined;\n};\n\nexport type ScheduledTaskRunAwaitingHuman = {\n since: string;\n expiresAt: string | null;\n};\n\nexport type ScheduledTaskAdmissionRefusal = {\n version: 1;\n reason:\n | \"scheduled_authority_unavailable\"\n | \"machine_target_unavailable\"\n | \"machine_enrollment_inactive\"\n | \"variable_set_unavailable\"\n | \"rig_version_unavailable\"\n | \"scheduled_model_unavailable\"\n | \"insufficient_credits\"\n | \"monthly_model_cost_limit\"\n | \"monthly_agent_run_limit\"\n | (string & {});\n retryable: boolean;\n};\n\nexport type ScheduledTaskAccessFailureReason =\n | \"missing_connection\"\n | \"expired\"\n | \"insufficient_scope\"\n | \"refresh_failed\"\n | \"personal_authority_unavailable\"\n | \"unsupported_auth\"\n | \"resource_scope_unavailable\"\n | \"designated_credential_unavailable\";\n\n/** A connector a scheduled run's own turn could not use (a `tool.auth_needed` fact). */\nexport type ScheduledTaskRunAccessFailure = {\n serverId: string;\n name: string;\n providerDomain: string;\n reason: ScheduledTaskAccessFailureReason;\n count: number;\n firstOccurredAt: string;\n};\n\n/**\n * A schedule that needs its owner's attention: its latest run failed closed on\n * connector access (`runId`, `failures`), and/or a pinned connector account can\n * no longer be used (`unavailableAccounts`; runs continue without that\n * connector unless the schedule requires its pins; `runId` and `firedAt` are\n * null when only this applies).\n */\nexport type ScheduledTaskAccessAttention = {\n taskId: string;\n taskName: string;\n /** The task head this item was computed against; a new head is a new notice. */\n executionDigest: string;\n runId: string | null;\n firedAt: string | null;\n failures: ScheduledTaskRunAccessFailure[];\n unavailableAccounts: ScheduledTaskAccessConnector[];\n /** The latest run is waiting on a person (tool approval or question) right now. */\n awaitingHuman?: ScheduledTaskRunAwaitingHuman | null | undefined;\n};\n\nexport type ListScheduledTaskAccessAttentionResponse = {\n tasks: ScheduledTaskAccessAttention[];\n};\n\n// --- Rigs ---------------------------------------------------------------------\n// Workspace-scoped, versioned sandbox machine definitions. Versions are\n// append-only and content-immutable; exactly one is active per rig.\n\nexport type RigCheck = {\n name: string;\n command: string;\n};\n\nexport type RigProviderImageBuildStatus = \"building\" | \"ready\" | \"failed\" | \"unsupported\";\n\nexport type RigProviderImage = {\n backend: SandboxBackend;\n provider: string;\n status: RigProviderImageBuildStatus;\n contentHash: string;\n setupHash: string;\n sourceImage: string | null;\n buildRequestId: string;\n imageId: string | null;\n imageDigest: string | null;\n artifactId: string | null;\n providerBindingKeyHash: string | null;\n coldBootValidation?:\n | {\n version: 1;\n checkedAt: string;\n }\n | undefined;\n provenance: {\n kind: \"rig_verification\";\n targetKind: \"change\" | \"version\";\n targetId: string;\n };\n startedAt: string;\n finishedAt: string | null;\n error: {\n code: string;\n message: string;\n retryable: boolean;\n } | null;\n};\n\nexport type RigVersion = {\n id: string;\n rigId: string;\n version: number;\n image: string | null;\n setupScript: string | null;\n checks: RigCheck[];\n credentialHooks: string[];\n changelog: string | null;\n providerImages: Partial<Record<SandboxBackend, RigProviderImage>>;\n createdBy: string | null;\n active: boolean;\n createdAt: string;\n};\n\nexport type RigVerificationHealth = {\n checkHealth: \"passing\" | \"failing\" | \"unknown\";\n lastVerifiedAt: string | null;\n};\n\n/**\n * A project (\"channel\") organizing root sessions (\"workstreams\") by work type\n * in the rail. Pure organizational metadata, shared with the workspace or\n * Only me, like a chat.\n */\nexport type Channel = {\n id: string;\n accountId: string;\n workspaceId: string;\n name: string;\n description: string | null;\n /**\n * Shown to people instead of the folder icon, like a chat's avatar. Absent\n * from servers that predate project profiles.\n */\n avatar?: SessionAvatar | null | undefined;\n pinned: boolean;\n sortOrder: number;\n /**\n * Who sees it: the workspace, or only its owner (\"private\", Only me). An\n * Only me project holds only its owner's own Only me chats and Sites.\n * Absent from servers that predate project audiences, where every project\n * is shared.\n */\n visibility?: \"private\" | \"workspace\" | undefined;\n createdBy: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type CreateChannelRequest = {\n name: string;\n description?: string;\n avatar?: SessionAvatar | null;\n /**\n * Omitted, a person's project is shared with the workspace and an agent's\n * follows its chat: Only me when made in an Only me chat.\n */\n visibility?: \"private\" | \"workspace\";\n};\n\nexport type UpdateChannelRequest = {\n name?: string;\n description?: string | null;\n /** null clears it; omitted keeps it. */\n avatar?: SessionAvatar | null;\n pinned?: boolean;\n /**\n * \"workspace\" shares the owner's Only me project with the workspace. A\n * shared project cannot be made Only me; only its owner, signed in,\n * changes it.\n */\n visibility?: \"workspace\";\n};\n\n/** Complete workspace project order. It is replaced atomically after a drag. */\nexport type ReorderChannelsRequest = {\n channelIds: string[];\n};\n\n/** Re-files one session; null moves it back to the unfiled inbox. */\nexport type UpdateSessionChannelRequest = {\n channelId: string | null;\n};\n\nexport type Rig = {\n id: string;\n accountId: string;\n workspaceId: string;\n scope: ResourceAuthorityScope;\n generation: number;\n status: \"active\" | \"revoked\";\n name: string;\n description: string | null;\n createdBy: string | null;\n activeVersion: RigVersion | null;\n activeVersionHealth?: RigVerificationHealth | null;\n versionCount: number;\n createdAt: string;\n updatedAt: string;\n /** Where it works; present only for organization rigs. */\n reach?: OrganizationComputeReach | null | undefined;\n};\n\n/**\n * Where an organization machine or rig works: always in the workspace it was\n * connected from or made in (`homeWorkspaceId`), plus every shared workspace\n * of the organization (`allowedWorkspaceIds: null`) or the listed ones, and\n * members' Personal workspaces when `allowPersonalWorkspaces` is on.\n */\nexport type OrganizationComputeReach = {\n homeWorkspaceId: string;\n allowedWorkspaceIds: string[] | null;\n allowPersonalWorkspaces: boolean;\n};\n\n/** PUT .../machines/:enrollmentId/reach and PUT .../rigs/:rigId/reach body:\n * an organization owner or admin changes where an organization machine or rig\n * works. The ids are the organization's shared workspaces. */\nexport type UpdateOrganizationComputeReachRequest = {\n allowedWorkspaceIds: string[] | null;\n allowPersonalWorkspaces: boolean;\n};\n\nexport type OrganizationComputeReachResponse = {\n reach: OrganizationComputeReach;\n};\n\n/** An organization machine or rig, wherever it works: its name and where it\n * works. Machines carry the id of their sandbox, which machine pages open by. */\nexport type OrganizationComputeSummary = {\n id: string;\n name: string;\n sandboxId?: string | null | undefined;\n reach: OrganizationComputeReach;\n};\n\n/** GET .../organization-machines: every organization machine, wherever it\n * works, for organization owners. `complete` is false while the server can\n * only list the ones that work in the requested workspace. */\nexport type ListOrganizationMachinesResponse = {\n machines: OrganizationComputeSummary[];\n complete: boolean;\n};\n\n/** GET .../organization-rigs: every organization sandbox environment,\n * wherever it works, for organization owners. `complete` as for machines. */\nexport type ListOrganizationRigsResponse = {\n rigs: OrganizationComputeSummary[];\n complete: boolean;\n};\n\nexport type RigChangeKind = \"setup_append\" | \"definition_edit\";\n\nexport type RigChangeStatus = \"proposed\" | \"verifying\" | \"merged\" | \"rejected\" | \"failed\";\n\nexport type RigCheckResult = {\n name: string;\n command: string;\n exitCode: number | null;\n output?: string | undefined;\n};\n\nexport type RigChangeVerification = {\n startedAt?: string | undefined;\n finishedAt?: string | undefined;\n log?: string | undefined;\n platformCheckResults?: RigCheckResult[] | undefined;\n checkResults?: RigCheckResult[] | undefined;\n [key: string]: unknown;\n};\n\nexport type RigChange = {\n id: string;\n rigId: string;\n baseVersionId: string | null;\n kind: RigChangeKind;\n payload: Record<string, unknown>;\n status: RigChangeStatus;\n proposedBy: string | null;\n verification: RigChangeVerification | null;\n resultVersionId: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type CreateRigRequest = {\n scope?: ResourceAuthorityScope;\n name: string;\n description?: string | undefined;\n image?: never;\n setupScript?: string | undefined;\n checks?: RigCheck[] | undefined;\n credentialHooks?: string[] | undefined;\n};\n\nexport type UpdateRigRequest = {\n name?: string | undefined;\n description?: string | null | undefined;\n};\n\nexport type RigSetupAppendPayload = {\n command: string;\n note?: string | undefined;\n};\n\nexport type RigDefinitionEditPayload = {\n image?: never;\n setupScript?: string | null | undefined;\n checks?: RigCheck[] | undefined;\n credentialHooks?: string[] | undefined;\n changelog?: string | null | undefined;\n};\n\nexport type ProposeRigChangeRequest =\n | { kind: \"setup_append\"; payload: RigSetupAppendPayload }\n | { kind: \"definition_edit\"; payload: RigDefinitionEditPayload };\n\n// --- Files ---------------------------------------------------------------------\n\nexport type FileStatus = \"pending_upload\" | \"ready\" | \"failed\" | \"expired\" | \"deleted\";\n\nexport type FileListRequest = {\n scope?: \"all\" | \"workspace\" | \"personal\";\n limit?: number;\n cursor?: string;\n};\nexport type FileListResponse = {\n files: FileAsset[];\n nextCursor: string | null;\n};\n\n/**\n * Who can open a file: only its owner (\"private\", Only me) or everyone in the\n * workspace, with one plain sentence saying so.\n */\nexport type FileAccess = {\n visibility: \"private\" | \"workspace\";\n whoCanOpen: string;\n};\n\n/**\n * An app-shot: a screenshot of another app's window, sent from a desktop app,\n * with the window it shows and the text the window exposed. Stored with the\n * file once and never changed.\n */\nexport type AppShotCapture = {\n /** The app's name as the system shows it. */\n app: string;\n /** The app's stable identifier, where the system has one (macOS bundle id). */\n bundleId?: string | undefined;\n /** The window title; empty when the window has none. */\n title: string;\n /** ISO timestamp. */\n capturedAt: string;\n platform: \"macos\" | \"windows\" | \"linux\";\n /** Text read through accessibility, at most 32,000 characters. */\n text?: string | undefined;\n /** The window had more text than was kept. */\n textTruncated?: boolean | undefined;\n /** The window as the system identifies it. */\n window?: { processId: number; windowId: number } | undefined;\n /** The computer the window is on, when connected to this workspace. */\n computer?: { name: string; sandboxId?: string | undefined } | undefined;\n /**\n * A web browser window's page address (http or https) and, when the computer\n * is connected, the browser profiles connected from it (at most 10) by the\n * attached browser device id browser tools use.\n */\n browser?:\n | {\n url: string;\n profiles?: { deviceId: string; name: string }[] | undefined;\n }\n | undefined;\n};\n\nexport type FileAsset = {\n /** \"personal\" is Only me: only its owner can open it. */\n scope?: \"workspace\" | \"personal\" | undefined;\n /** The person who alone can share the file or limit it to themselves. */\n ownerSubjectId?: string | null | undefined;\n /**\n * An Only me file's other workspaces of the organization where it also\n * works, besides the one that stores it and its owner's Personal workspace;\n * null for every workspace. Absent for workspace files.\n */\n reachWorkspaceIds?: string[] | null | undefined;\n id: string;\n workspaceId: string;\n status: FileStatus;\n filename: string;\n safeFilename: string;\n contentType: string;\n sizeBytes: number;\n sha256: string | null;\n bucket: string;\n objectKey: string;\n createdAt: string;\n updatedAt: string;\n /** Present on upload, publish and sharing results: who can open the file. */\n access?: FileAccess | undefined;\n /** A screenshot sent as an app-shot: the window it shows and what it said. */\n appShot?: AppShotCapture | undefined;\n};\n\nexport type UpdateFileVisibilityRequest = {\n visibility: \"private\" | \"workspace\";\n};\nexport type UpdateFileVisibilityResponse = { file: FileAsset };\n\n/** Where an Only me file works besides its own workspace and its owner's Personal workspace. */\nexport type UpdateFileReachRequest = {\n /** The owner's other workspaces of this organization; null for all of them. */\n reachWorkspaceIds: string[] | null;\n};\nexport type UpdateFileReachResponse = { file: FileAsset };\n\n/** Mirrors the closed, provider-neutral retained-output contract. */\nexport const RETAINED_OUTPUT_DEFAULT_PAGE_BYTES = 256 * 1024;\nexport const RETAINED_OUTPUT_MAX_PAGE_BYTES = 1024 * 1024;\nexport const COMPUTER_SCREENSHOT_MAX_BYTES = 32 * 1024 * 1024;\nexport const GENERATED_IMAGE_MAX_BYTES = 64 * 1024 * 1024;\nexport const GENERATED_VIDEO_MAX_BYTES = 512 * 1024 * 1024;\n\nexport type RetainedOutputKind =\n | \"tool_result\"\n | \"assistant_completion\"\n | \"internal_update\"\n | \"event_media\"\n | \"computer_screenshot\"\n | \"browser_screenshot\"\n | \"generated_image\"\n | \"generated_video\"\n | \"file\";\n\nexport type RetainedOutputUnavailableReason =\n | \"not_retained\"\n | \"pending\"\n | \"failed\"\n | \"expired\"\n | \"deleted\"\n | \"missing_storage\"\n | \"storage_write_failed\"\n | \"quota_exceeded\"\n | \"invalid_content\"\n | \"oversized\"\n | \"unsupported\"\n /** The file exists but is Only me for someone else. */\n | \"private\";\n\nexport type RetainedArtifactReference = {\n available: true;\n artifactId: string;\n kind: RetainedOutputKind;\n contentType: string;\n originalBytes: number;\n sha256: string;\n retainedAt: string;\n dimensions?: { width: number; height: number } | undefined;\n retention:\n | { policy: \"workspace_file\"; expiresAt: null }\n | { policy: \"session_screenshot\"; expiresAt: string };\n retrieval: {\n method: \"GET\";\n path: string;\n acceptRanges: \"bytes\";\n maxRangeBytes: number;\n };\n};\n\nexport type RetainedArtifactUnavailable = {\n available: false;\n artifactId: string;\n reason: RetainedOutputUnavailableReason;\n};\n\nexport type RetainedArtifactMetadata = RetainedArtifactReference | RetainedArtifactUnavailable;\n\nexport type GeneratedImageReceipt = {\n type: \"generated_image\";\n artifact: RetainedArtifactReference;\n sandboxPath: string;\n};\n\nexport type VideoGenerationSourceMode =\n | \"text\"\n | \"first_frame\"\n | \"first_and_last_frames\"\n | \"image_reference\"\n | \"video_reference\";\n\nexport type VideoGenerationResolution = \"480p\" | \"720p\";\n\nexport type VideoGenerationAspectRatio =\n | \"16:9\"\n | \"4:3\"\n | \"1:1\"\n | \"3:4\"\n | \"9:16\"\n | \"21:9\"\n | \"adaptive\";\n\nexport type VideoGenerationModelCapability = {\n modelId: string;\n label: string;\n providerLabel: string;\n sourceModes: VideoGenerationSourceMode[];\n resolutions: VideoGenerationResolution[];\n aspectRatios: VideoGenerationAspectRatio[];\n duration: {\n minSeconds: number;\n maxSeconds: number;\n stepSeconds: number;\n };\n supportsAudio: boolean;\n};\n\nexport type VideoGenerationCapabilities = {\n schemaVersion: 1;\n capabilityRevision: string;\n defaultModelId: string;\n models: VideoGenerationModelCapability[];\n};\n\nexport type VideoGenerationPolicy = {\n schemaVersion: 1;\n revision: number;\n fundingSource: VideoGenerationFundingSource;\n enabledModelIds: string[];\n defaultModelId: string | null;\n};\n\nexport type UpdateVideoGenerationPolicyRequest = {\n expectedRevision: number;\n fundingSource: VideoGenerationFundingSource;\n enabledModelIds: string[];\n defaultModelId: string | null;\n};\n\nexport type VideoGenerationFundingSource =\n | \"opengeni_credits\"\n | \"workspace_gateway\"\n | \"supergrok_subscription\";\n\nexport type VideoGenerationFundingOption = {\n source: VideoGenerationFundingSource;\n label: string;\n description: string;\n available: boolean;\n unavailableReason: string | null;\n /** `region_restricted` when EU-only inference switched this source off. */\n unavailableCode?: FeatureUnavailableReason | undefined;\n};\n\nexport type WorkspaceVideoGenerationSettings = {\n schemaVersion: 1;\n policy: VideoGenerationPolicy;\n fundingOptions: VideoGenerationFundingOption[];\n availableModels: VideoGenerationModelCapability[];\n capabilities: VideoGenerationCapabilities | null;\n};\n\nexport type GeneratedVideoFacts = {\n durationSeconds: number;\n width: number;\n height: number;\n fps: number;\n hasAudio: boolean;\n videoCodec: \"h264\";\n audioCodec: \"aac\" | null;\n};\n\nexport type GeneratedVideoReceipt = {\n type: \"generated_video\";\n schemaVersion: 1;\n operationId: string;\n artifact: RetainedArtifactReference;\n video: GeneratedVideoFacts;\n sandboxPath: string;\n};\n\nexport type VideoGenerationTerminalFailureStatus =\n | \"provider_failed\"\n | \"retention_failed\"\n | \"cancelled_before_submit\"\n | \"outcome_unknown\";\n\nexport type MediaGenerationResult =\n | {\n type: \"media_generation_result\";\n schemaVersion: 1;\n status: \"ready\";\n operationId: string;\n receipt: GeneratedVideoReceipt;\n }\n | {\n type: \"media_generation_result\";\n schemaVersion: 1;\n status: VideoGenerationTerminalFailureStatus;\n operationId: string;\n boundedPublicReason: string;\n };\n\nexport type VideoGenerationPublicStatus =\n | \"preparing\"\n | \"prepared\"\n | \"accepted\"\n | \"provider_started\"\n | \"retaining\"\n | \"completed\"\n | VideoGenerationTerminalFailureStatus;\n\nexport type VideoGenerationOperationSummary = {\n schemaVersion: 1;\n operationId: string;\n modelId: string;\n status: VideoGenerationPublicStatus;\n createdAt: string;\n updatedAt: string;\n terminal: MediaGenerationResult | null;\n};\n\n/** Ephemeral source minted for native browser playback; never persist the URL. */\nexport type VideoArtifactPlaybackSource = {\n schemaVersion: 1;\n artifactId: string;\n url: string;\n expiresAt: string;\n contentType: \"video/mp4\";\n sizeBytes: number;\n sha256: string;\n acceptRanges: \"bytes\";\n};\n\nexport type RetainedArtifactContentOptions = {\n /** One RFC-style bytes range, for example `bytes=1048576-2097151`. */\n range?: string | undefined;\n signal?: AbortSignal | undefined;\n};\n\nexport type RetainedArtifactContent = {\n bytes: Uint8Array;\n status: 200 | 206;\n contentType: string;\n contentLength: number;\n contentRange: string | null;\n acceptRanges: \"bytes\";\n};\n\nexport type RetainedArtifactDownloadOptions = {\n signal?: AbortSignal | undefined;\n /** Retry transient range failures; bounded to 0..3, default 2. */\n maxRetries?: number | undefined;\n};\n\nexport type RetainedScreenshotDownloadOptions = RetainedArtifactDownloadOptions;\n\nexport type RetainedScreenshotDownload = {\n metadata: RetainedArtifactMetadata;\n /** Null when metadata truth says the screenshot is unavailable. */\n bytes: Uint8Array | null;\n};\n\nexport type RetainedArtifactDownload = {\n artifact: RetainedArtifactReference;\n bytes: Uint8Array;\n};\n\nexport type CreateFileUploadRequest = {\n scope?: \"workspace\" | \"personal\";\n filename: string;\n contentType: string;\n sizeBytes: number;\n sha256?: string | undefined;\n /** The upload is an app-shot (images only). */\n appShot?: AppShotCapture | undefined;\n};\n\nexport type CreateFileUploadResponse = {\n fileId: string;\n uploadId: string;\n /** Pre-signed PUT URL for the file bytes (direct to object storage). */\n putUrl: string;\n /** Headers that MUST be sent with the PUT for the signature to validate. */\n requiredHeaders: Record<string, string>;\n expiresAt: string;\n maxSizeBytes: number;\n /** Who will be able to open the file once uploaded. */\n access?: FileAccess | undefined;\n};\n\nexport type CompleteFileUploadResponse = {\n file: FileAsset;\n};\n\nexport type FileDownloadUrlResponse = {\n url: string;\n expiresAt: string;\n};\n\n/** Bytes accepted by the `uploadFile` helper. */\nexport type FileUploadData = Blob | ArrayBuffer | Uint8Array | string;\n\nexport type UploadFileInput = {\n scope?: \"workspace\" | \"personal\";\n filename: string;\n contentType: string;\n data: FileUploadData;\n sha256?: string | undefined;\n /** Optional deadline for the signed object-storage PUT. */\n timeoutMs?: number | undefined;\n /** The upload is an app-shot (images only): the window it shows and what it said. */\n appShot?: AppShotCapture | undefined;\n};\n\n// --- Documents -------------------------------------------------------------------\n\nexport type DocumentStatus = \"queued\" | \"indexing\" | \"ready\" | \"failed\";\nexport type KnowledgeSourceKind =\n | \"manual_upload\"\n | \"meeting_transcript\"\n | \"repository\"\n | \"email\"\n | \"chat\"\n | \"document\"\n | \"web\"\n | \"other\";\nexport type DocumentSearchMode = \"hybrid\" | \"vector\" | \"keyword\";\n\nexport type DocumentAuthorityKind = \"organization\" | \"workspace\" | \"personal\";\n\nexport type DocumentVisibility = \"workspace\" | \"private\";\n\nexport type DocumentCurationStatus = \"none\" | \"pending\" | \"suggested\" | \"auto_filed\" | \"failed\";\n\nexport type DocumentCuration = {\n suggestedBaseId: string | null;\n suggestedBaseName: string | null;\n confidence: number;\n reason: string | null;\n originalTitle: string | null;\n model: string | null;\n};\n\nexport type DocumentBase = {\n id: string;\n workspaceId: string;\n name: string;\n description: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type Document = {\n id: string;\n workspaceId: string;\n baseId: string;\n fileId: string;\n status: DocumentStatus;\n title: string;\n parser: string;\n chunkCount: number;\n error: string | null;\n sourceKind: KnowledgeSourceKind;\n sourceUri: string | null;\n sourceExternalId: string | null;\n sourceTitle: string | null;\n sourceAuthor: string | null;\n sourceCreatedAt: string | null;\n sourceUpdatedAt: string | null;\n sourceVersion: string | null;\n aclTags: string[];\n authorityKind: DocumentAuthorityKind;\n authorityWorkspaceId: string | null;\n authoritySubjectId: string | null;\n authorityId?: string | null | undefined;\n visibility: DocumentVisibility;\n createdBy: string | null;\n agentAccess: boolean;\n summary: string | null;\n topics: string[];\n curationStatus: DocumentCurationStatus;\n curation: DocumentCuration | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type DocumentSearchResult = {\n chunkId: string;\n workspaceId: string;\n documentId: string;\n baseId: string;\n fileId: string;\n title: string;\n text: string;\n score: number;\n matchType: DocumentSearchMode;\n vectorScore: number | null;\n keywordScore: number | null;\n chunkIndex: number;\n metadata: Record<string, unknown>;\n sourceKind: KnowledgeSourceKind;\n sourceUri: string | null;\n sourceExternalId: string | null;\n sourceTitle: string | null;\n sourceAuthor: string | null;\n sourceCreatedAt: string | null;\n sourceUpdatedAt: string | null;\n sourceVersion: string | null;\n aclTags: string[];\n authorityKind: DocumentAuthorityKind;\n authorityWorkspaceId: string | null;\n authoritySubjectId: string | null;\n};\n\nexport type CreateDocumentBaseRequest = {\n name: string;\n description?: string | undefined;\n};\n\nexport type AddDocumentRequest = {\n fileId: string;\n title?: string | undefined;\n sourceKind?: KnowledgeSourceKind | undefined;\n sourceUri?: string | undefined;\n sourceExternalId?: string | undefined;\n sourceTitle?: string | undefined;\n sourceAuthor?: string | undefined;\n sourceCreatedAt?: string | undefined;\n sourceUpdatedAt?: string | undefined;\n sourceVersion?: string | undefined;\n aclTags?: string[] | undefined;\n authorityKind?: DocumentAuthorityKind | undefined;\n visibility?: DocumentVisibility | undefined;\n agentAccess?: boolean | undefined;\n};\n\nexport type CreateKnowledgeDropRequest = {\n text?: string | undefined;\n fileId?: string | undefined;\n filename?: string | undefined;\n title?: string | undefined;\n authorityKind?: DocumentAuthorityKind | undefined;\n visibility?: DocumentVisibility | undefined;\n agentAccess?: boolean | undefined;\n};\n\nexport type MoveDocumentRequest = {\n targetBaseId?: string | undefined;\n};\n\nexport type DocumentAuthorityTuple = {\n kind: DocumentAuthorityKind;\n workspaceId: string | null;\n subjectId: string | null;\n authorityId: string | null;\n};\n\nexport type ReclassifyDocumentAuthorityRequest = {\n operationId: string;\n expectedAuthority: DocumentAuthorityTuple;\n targetAuthorityKind: DocumentAuthorityKind;\n};\n\nexport type DocumentAuthorityReclassification = {\n operationId: string;\n documentId: string;\n previousAuthority: DocumentAuthorityTuple;\n authority: DocumentAuthorityTuple;\n createdAt: string;\n};\n\nexport type ListDocumentAuthorityReclassificationsOptions = {\n limit?: number | undefined;\n cursor?: string | undefined;\n};\n\nexport type ListDocumentAuthorityReclassificationsResponse = {\n receipts: DocumentAuthorityReclassification[];\n hasMore: boolean;\n nextCursor: string | null;\n};\n\nexport type RunDocumentDefaultCollectionBackfillRequest = {\n runId: string;\n operationId: string;\n batchSize?: number | undefined;\n};\n\nexport type DocumentDefaultCollectionBackfill = {\n runId: string;\n operationId: string;\n status: \"running\" | \"completed\";\n lastWorkspaceId: string | null;\n processedCount: number;\n createdCount: number;\n adoptedCount: number;\n completedAt: string | null;\n};\n\nexport type DocumentDefaultCollectionBackfillRunAudit = Omit<\n DocumentDefaultCollectionBackfill,\n \"operationId\"\n> & {\n actorSubjectId: string;\n startedAt: string;\n updatedAt: string;\n};\n\nexport type DocumentDefaultCollectionBackfillOperationAudit = {\n operationId: string;\n result: DocumentDefaultCollectionBackfill;\n createdAt: string;\n};\n\nexport type DocumentDefaultCollectionBackfillReceiptAudit = {\n workspaceId: string;\n baseId: string;\n outcome: \"created\" | \"adopted\";\n createdAt: string;\n};\n\nexport type ListDocumentDefaultCollectionBackfillRunsResponse = {\n runs: DocumentDefaultCollectionBackfillRunAudit[];\n hasMore: boolean;\n nextCursor: string | null;\n};\n\nexport type DocumentDefaultCollectionBackfillAudit = {\n run: DocumentDefaultCollectionBackfillRunAudit;\n operations: DocumentDefaultCollectionBackfillOperationAudit[];\n receipts: DocumentDefaultCollectionBackfillReceiptAudit[];\n operationsHasMore: boolean;\n operationsNextCursor: string | null;\n receiptsHasMore: boolean;\n receiptsNextCursor: string | null;\n};\n\nexport type GetDocumentDefaultCollectionBackfillAuditOptions = {\n limit?: number | undefined;\n operationCursor?: string | undefined;\n receiptCursor?: string | undefined;\n};\n\nexport type OrganizationDocumentAuthorityReclassification = DocumentAuthorityReclassification & {\n actorSubjectId: string;\n requestWorkspaceId: string;\n};\n\nexport type ListOrganizationDocumentAuthorityReclassificationsResponse = {\n receipts: OrganizationDocumentAuthorityReclassification[];\n hasMore: boolean;\n nextCursor: string | null;\n};\n\nexport type DocumentSearchRequest = {\n query: string;\n baseIds?: string[] | undefined;\n mode?: DocumentSearchMode | undefined;\n sourceKinds?: KnowledgeSourceKind[] | undefined;\n authorityKinds?: DocumentAuthorityKind[] | undefined;\n aclTags?: string[] | undefined;\n limit?: number | undefined;\n};\n\nexport type DocumentSearchResponse = {\n results: DocumentSearchResult[];\n};\n\nexport type KnowledgeMemoryStatus =\n | \"proposed\"\n | \"approved\"\n | \"rejected\"\n | \"active\"\n | \"superseded\"\n | \"archived\";\nexport type KnowledgeMemoryKind =\n | \"semantic\"\n | \"episodic\"\n | \"procedural\"\n | \"decision\"\n | \"preference\";\n\nexport type KnowledgeSourceRef = {\n kind: \"document_chunk\" | \"document\" | \"session_event\" | \"memory\" | \"external\";\n id: string;\n uri?: string | undefined;\n title?: string | undefined;\n metadata?: Record<string, unknown> | undefined;\n};\n\nexport type KnowledgeMemory = {\n id: string;\n workspaceId: string;\n status: KnowledgeMemoryStatus;\n kind: KnowledgeMemoryKind;\n scope: string;\n text: string;\n sourceRefs: KnowledgeSourceRef[];\n confidence: number;\n metadata: Record<string, unknown>;\n createdBySessionId: string | null;\n reviewedBy: string | null;\n reviewedAt: string | null;\n pinned: boolean;\n usageCount: number;\n lastUsedAt: string | null;\n supersedesId: string | null;\n supersededById: string | null;\n validFrom: string;\n validUntil: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type CreateKnowledgeMemoryRequest = {\n status?: KnowledgeMemoryStatus | undefined;\n kind?: KnowledgeMemoryKind | undefined;\n scope?: string | undefined;\n text: string;\n sourceRefs?: KnowledgeSourceRef[] | undefined;\n confidence?: number | undefined;\n metadata?: Record<string, unknown> | undefined;\n createdBySessionId?: string | undefined;\n pinned?: boolean | undefined;\n replacesId?: string | undefined;\n};\n\nexport type UpdateKnowledgeMemoryRequest = {\n status?: KnowledgeMemoryStatus | undefined;\n kind?: KnowledgeMemoryKind | undefined;\n scope?: string | undefined;\n text?: string | undefined;\n sourceRefs?: KnowledgeSourceRef[] | undefined;\n confidence?: number | undefined;\n metadata?: Record<string, unknown> | undefined;\n reviewedBy?: string | undefined;\n pinned?: boolean | undefined;\n};\n\nexport type KnowledgeMemorySearchRequest = {\n query?: string | undefined;\n status?: KnowledgeMemoryStatus | undefined;\n kind?: KnowledgeMemoryKind | undefined;\n scope?: string | undefined;\n limit?: number | undefined;\n};\n\nexport type WorkspaceMemorySearchMode = \"hybrid\" | \"vector\" | \"keyword\";\n\nexport type WorkspaceMemorySearchRequest = {\n query: string;\n kind?: KnowledgeMemoryKind | undefined;\n limit?: number | undefined;\n mode?: WorkspaceMemorySearchMode | undefined;\n};\n\nexport type WorkspaceMemorySearchResult = {\n memory: KnowledgeMemory;\n score: number;\n matchType: WorkspaceMemorySearchMode;\n vectorScore: number | null;\n keywordScore: number | null;\n};\n\nexport type WorkspaceMemorySearchResponse = {\n results: WorkspaceMemorySearchResult[];\n};\n\nexport type SkillArtifactFile = {\n path: string;\n content: string;\n};\n\nexport type SkillArtifactDefinition = {\n name: string;\n description?: string | undefined;\n /** Omitted means workspace-wide; session_selected requires explicit session attachment. */\n activationMode?: \"workspace_managed\" | \"session_selected\" | undefined;\n files: SkillArtifactFile[];\n};\n\nexport type SessionSkill = Omit<SkillArtifactDefinition, \"activationMode\">;\n/** SKILL.md owns metadata; supplied legacy fields must exactly match it. */\nexport type SkillArtifactDefinitionInput = Omit<SkillArtifactDefinition, \"name\" | \"description\"> & {\n name?: string | undefined;\n description?: string | undefined;\n};\nexport type SessionSkillInput = Omit<SkillArtifactDefinitionInput, \"activationMode\">;\n\n// --- Capabilities ---------------------------------------------------------------\n\nexport type CapabilityKind = \"mcp\" | \"api\" | \"skill\" | \"plugin\";\n\nexport type CapabilitySource =\n | \"built_in\"\n | \"library\"\n | \"configured\"\n | \"public_registry\"\n | \"registry\"\n | \"manual\";\n\nexport type CapabilityInstallationStatus = \"active\" | \"disabled\";\n\nexport type CapabilityCatalogAuthKind = \"oauth2\" | \"api_key\" | \"none\" | \"unknown\";\n\nexport type CapabilityCatalogTier = \"verified\" | \"community\";\n\nexport type CapabilityLifecycleStatus =\n | \"available\"\n | \"installed\"\n | \"connected\"\n | \"ready\"\n | \"needs_attention\"\n | \"unavailable\"\n | \"managed\";\n\nexport type CapabilityReadiness = \"ready\" | \"setup_required\" | \"attention\" | \"unavailable\";\n\nexport type CapabilityAction =\n | \"install\"\n | \"connect\"\n | \"configure\"\n | \"update\"\n | \"repair\"\n | \"disconnect\"\n | \"uninstall\"\n | \"inspect\";\n\nexport type CapabilityLifecycle = {\n status: CapabilityLifecycleStatus;\n readiness: CapabilityReadiness;\n detail: string | null;\n managedBy: \"deployment\" | \"platform\" | \"workspace\" | \"organization\" | null;\n};\n\nexport type CapabilityRuntime = {\n available: boolean;\n mcpServerId?: string | undefined;\n transport?: string | undefined;\n notes: string | null;\n /** Secret-safe server-derived registry exposure state. */\n catalogTrust?:\n | {\n state: \"trusted\" | \"legacy_active\" | \"unverified\";\n reason:\n | \"trusted_source\"\n | \"verified_probe\"\n | \"active_installation_compatibility\"\n | \"missing_verification\";\n }\n | undefined;\n /**\n * Present when connecting needs an operator-registered OAuth client because\n * the provider refuses self-registration; `configured` is whether this\n * deployment has one. Connector surfaces offer the row only when true.\n */\n operatorOAuthClient?: { configured: boolean } | undefined;\n};\n\nexport type CapabilityCatalogItem = {\n id: string;\n accountId?: string | undefined;\n workspaceId?: string | undefined;\n kind: CapabilityKind;\n source: CapabilitySource;\n name: string;\n description: string | null;\n category: string;\n tags: string[];\n homepageUrl: string | null;\n endpointUrl: string | null;\n installUrl: string | null;\n authModel: string | null;\n providerDomain: string | null;\n surfaceType: string | null;\n transport: string | null;\n mcpUrl: string | null;\n authKind: CapabilityCatalogAuthKind | null;\n credentialFacts: Record<string, unknown>[];\n tier: CapabilityCatalogTier | null;\n provenance: string | null;\n logoAssetPath: string | null;\n importBatchId: string | null;\n stale: boolean;\n staleAt: string | null;\n tools: ToolRef[];\n runtime: CapabilityRuntime;\n lifecycle: CapabilityLifecycle;\n actions: CapabilityAction[];\n /** @deprecated Use lifecycle and actions. */\n enabled: boolean;\n /** @deprecated Use lifecycle.detail. */\n enabledReason: string | null;\n /** The connection backing this enabled installation, or null when none is involved. */\n connectionRef: {\n connectionId?: string | undefined;\n accountSelection?: \"all_eligible\" | undefined;\n authoritySource?: \"host\" | undefined;\n providerDomain: string;\n kind: string;\n subjectScope?: \"subject\" | \"workspace\" | undefined;\n } | null;\n metadata: Record<string, unknown>;\n createdAt?: string | undefined;\n updatedAt?: string | undefined;\n /**\n * Whether the viewer may remove this custom MCP server from the workspace\n * (`removeCapabilityInstallation` on the client): integration admins\n * remove any, a member only one they turned on, while it is on. Older\n * servers omit it.\n */\n canRemove?: boolean | undefined;\n};\n\nexport type CapabilityInstallation = {\n id: string;\n accountId: string;\n workspaceId: string;\n capabilityId: string;\n kind: CapabilityKind;\n status: CapabilityInstallationStatus;\n config: Record<string, unknown>;\n metadata: Record<string, unknown>;\n enabledAt: string;\n updatedAt: string;\n};\n\nexport type RemoveCapabilityInstallationResponse = {\n /** The installation that was removed. */\n removed: CapabilityInstallation;\n};\n\nexport type CapabilityCatalogResponse = {\n items: CapabilityCatalogItem[];\n installations: CapabilityInstallation[];\n /**\n * Who the organization lets turn integrations on: members (the default) or\n * only integration admins. Older servers omit it; treat that as members.\n */\n memberIntegrationSetup?: \"members\" | \"admins\" | undefined;\n};\n\nexport type CreateCapabilityCatalogItemRequest = {\n id?: string | undefined;\n kind: \"mcp\";\n source?: CapabilitySource | undefined;\n name: string;\n description?: string | undefined;\n category?: string | undefined;\n tags?: string[] | undefined;\n homepageUrl?: string | undefined;\n endpointUrl?: string | undefined;\n installUrl?: string | undefined;\n authModel?: string | undefined;\n metadata?: Record<string, unknown> | undefined;\n};\n\nexport type EnableCapabilityRequest = {\n onlyIfUninstalled?: boolean | undefined;\n config?: Record<string, unknown> | undefined;\n metadata?: Record<string, unknown> | undefined;\n connectionRef?: McpServerConnectionRef | undefined;\n /**\n * Credential headers for remote MCP capabilities. Write-only: encrypted at\n * rest, injected only into the runtime MCP client, never returned by the\n * API (responses expose header names only).\n */\n headers?: Record<string, string> | undefined;\n};\n\nexport type DiscoverMcpCapabilitiesResponse = {\n items: CapabilityCatalogItem[];\n source: \"official_mcp_registry\";\n sourceUrl: string;\n};\n\nexport type SkillImportSource = \"github\" | \"skills_sh\";\n\nexport type SkillInstallationSource = \"library\" | \"github\" | \"skills_sh\";\n\nexport type PreviewSkillImportRequest = {\n url: string;\n};\n\nexport type SkillImportFileSummary = {\n path: string;\n byteSize: number;\n contentSha256: string;\n};\n\nexport type SkillImportPreview = {\n markdown?: string;\n source: SkillImportSource;\n sourceUrl: string;\n repositoryUrl: string;\n owner: string;\n repository: string;\n sourcePath: string;\n sourceCommit: string;\n name: string;\n description: string;\n contentSha256: string;\n totalBytes: number;\n files: SkillImportFileSummary[];\n warnings: string[];\n installed: boolean;\n installationVersion: number | null;\n};\n\nexport type InstallSkillRequest = {\n url: string;\n expectedSourceCommit: string;\n expectedContentSha256: string;\n expectedInstallationVersion?: number | undefined;\n};\n\nexport type InstallLibrarySkillRequest = {\n expectedVersion: string;\n expectedContentSha256: string;\n expectedInstallationVersion?: number | undefined;\n};\n\nexport type InstalledSkill = {\n skillReceipt?: import(\"./skills\").SkillWriteReceipt | undefined;\n capabilityId: string;\n pluginId: string;\n pluginVersionId: string;\n facetId: string;\n pluginInstallationId: string;\n facetInstallationId: string;\n installationVersion: number;\n source: SkillInstallationSource;\n version: string;\n sourceUrl: string;\n sourceCommit: string;\n contentSha256: string;\n name: string;\n status: \"installed\";\n};\n\nexport type CapabilityComponentOwner = {\n kind: \"direct\" | \"plugin\" | \"migration\";\n id: string;\n removable: boolean;\n};\n\nexport type InstalledSkillSummary = {\n capabilityId: string;\n pluginKey: string;\n installationVersion: number;\n name: string;\n description: string;\n category: string;\n tags: string[];\n provenance: string;\n source: SkillInstallationSource;\n version: string;\n sourceUrl: string;\n repositoryUrl: string;\n sourceCommit: string;\n sourcePath: string;\n contentSha256: string;\n fileCount: number;\n totalBytes: number;\n license: string | null;\n installedAt: string;\n updatedAt: string;\n owners: CapabilityComponentOwner[];\n};\n\nexport type ListInstalledSkillsResponse = {\n skills: InstalledSkillSummary[];\n};\n\nexport type SkillUninstallPreview = {\n capabilityId: string;\n installed: boolean;\n installationVersion: number | null;\n directOwner: CapabilityComponentOwner | null;\n remainingOwners: CapabilityComponentOwner[];\n removesRuntimeSkill: boolean;\n};\n\nexport type UninstallSkillRequest = {\n expectedInstallationVersion: number;\n};\n\nexport type UninstallSkillResult = {\n skillReleases?: import(\"./skills\").SkillSourceReleaseReceipt[] | undefined;\n capabilityId: string;\n status: \"not_installed\" | \"uninstalled\" | \"retained_by_other_owners\";\n remainingOwners: CapabilityComponentOwner[];\n};\n\nexport type ApiIntegrationProtocol = \"openapi\" | \"graphql\";\nexport type IntegrationDefinitionProvenance = \"curated\" | \"workspace\";\n\nexport type IntegrationFacetKind =\n | \"tools\"\n | \"knowledge_source\"\n | \"inbound_trigger\"\n | \"delivery_destination\"\n | \"identity_link\";\n\nexport type IntegrationFacetStatus = \"active\" | \"paused\" | \"needs_attention\" | \"disabled\";\n\nexport type IntegrationFacetDefinitionSummary = {\n facetKey: string;\n kind: Exclude<IntegrationFacetKind, \"tools\">;\n configSchema: Record<string, unknown>;\n capabilities: Record<string, unknown>;\n};\n\nexport type IntegrationFacetBindingSummary = {\n id: string;\n facetKey: string;\n kind: Exclude<IntegrationFacetKind, \"tools\">;\n bindingKey: string;\n displayName: string;\n connectionId: string | null;\n status: IntegrationFacetStatus;\n config: Record<string, unknown>;\n version: number;\n hasCursor: boolean;\n lastSuccessAt: string | null;\n lastErrorCode: string | null;\n createdAt: string;\n updatedAt: string;\n directlyOwned: boolean;\n owners: CapabilityComponentOwner[];\n /**\n * Whether the caller may remove it: admins remove anything, a member only\n * what they added. Older servers omit it.\n */\n canRemove?: boolean | undefined;\n};\n\nexport type IntegrationInstanceFacetsResponse = {\n capabilityId: string;\n instanceKey: string;\n providerDomain: string;\n connectionId: string | null;\n facets: {\n definition: IntegrationFacetDefinitionSummary;\n binding: IntegrationFacetBindingSummary | null;\n }[];\n};\n\nexport type UpsertIntegrationFacetRequest = {\n displayName: string;\n config?: Record<string, unknown> | undefined;\n expectedVersion?: number | undefined;\n idempotencyKey: string;\n};\n\nexport type MutateIntegrationFacetRequest = {\n expectedVersion: number;\n idempotencyKey: string;\n};\n\nexport type IntegrationFacetMutationResult = {\n capabilityId: string;\n instanceKey: string;\n facetKey: string;\n status: \"configured\" | \"paused\" | \"active\";\n binding: IntegrationFacetBindingSummary;\n};\n\nexport type IntegrationFacetRemovalResult = {\n capabilityId: string;\n instanceKey: string;\n facetKey: string;\n status: \"not_configured\" | \"removed\" | \"retained_by_other_owners\";\n binding: IntegrationFacetBindingSummary | null;\n remainingOwners: CapabilityComponentOwner[];\n};\n\n/**\n * Presentation-only consent copy served with an integration or connector.\n * Never grants a scope or replaces server-side authorization; the UI keeps a\n * generic fallback for any omitted field.\n */\nexport type IntegrationPresentation = {\n providerName?: string | undefined;\n icon?: \"calendar\" | \"cloud\" | \"contacts\" | \"files\" | \"mail\" | undefined;\n introduction?: string | undefined;\n capabilities?: { title: string; description: string }[] | undefined;\n permissionSummary?: string | undefined;\n scopeLabels?: Record<string, { label: string; description: string }> | undefined;\n};\n\nexport type IntegrationDefinitionSummary = {\n id: string;\n name: string;\n summary: string;\n protocol: \"openapi\";\n provider: {\n id: \"google\" | \"microsoft\";\n domain: string;\n };\n authentication: {\n kind: \"oauth2\";\n scopes: string[];\n };\n presentation?: IntegrationPresentation | undefined;\n facets: IntegrationFacetDefinitionSummary[];\n};\n\nexport type ListIntegrationDefinitionsResponse = {\n definitions: IntegrationDefinitionSummary[];\n};\n\nexport type IntegrationSource =\n | { kind: \"definition\"; definitionId: string }\n | { kind: \"openapi\"; url: string; baseUrl?: string | undefined }\n | { kind: \"graphql\"; endpoint: string; name?: string | undefined }\n | { kind: \"auto\"; url: string; baseUrl?: string | undefined };\n\n/**\n * OpenAPI 3.x text (JSON or YAML, at most 8 MiB) sent in the request instead\n * of a URL. `sourceKey` is your stable identity for the Integration: reuse it\n * to update the same installation. Server URLs must be absolute or `baseUrl`\n * given. Calls still obey the deployment network policy, so an API on\n * localhost or a private address needs a public tunnel unless the operator\n * enables private targets. Send the same document again on install.\n */\nexport type InlineOpenApiDocumentSource = {\n kind: \"openapi_document\";\n sourceKey: string;\n document: string;\n baseUrl?: string | undefined;\n};\n\n/** Preview/install input sources. */\nexport type IntegrationSourceInput = IntegrationSource | InlineOpenApiDocumentSource;\n\n/** Preview echo: an inline document is reported by digest, never its text. */\nexport type IntegrationSourceProjection =\n | IntegrationSource\n | {\n kind: \"openapi_document\";\n sourceKey: string;\n documentSha256: string;\n baseUrl?: string | undefined;\n };\n\nexport type PreviewApiIntegrationRequest = {\n source: IntegrationSourceInput;\n connectionId?: string | undefined;\n ownership?: ConnectionOwnership | undefined;\n};\n\nexport type ApiIntegrationOAuthStartRequest = {\n definitionId: string;\n ownership?: ConnectionOwnership | undefined;\n connectionId?: string | undefined;\n returnPath?: string | undefined;\n};\n\nexport type ApiIntegrationAuthPreview =\n | { kind: \"none\" }\n | { kind: \"oauth2\"; providerDomain: string; scopes: string[] }\n | {\n kind: \"api_key\";\n providerDomain: string;\n carrier: \"header\" | \"query\" | \"cookie\";\n name: string;\n }\n | { kind: \"http\"; providerDomain: string; scheme: string };\n\nexport type ApiIntegrationToolPreview = {\n id: string;\n operationKey: string;\n name: string;\n description: string;\n safety: \"read\" | \"write\" | \"destructive\";\n approvalMode: \"never\" | \"ask\";\n deprecated: boolean;\n};\n\nexport type ApiIntegrationPreview = {\n source: IntegrationSourceProjection;\n definitionId: string;\n definitionProvenance: IntegrationDefinitionProvenance;\n protocol: ApiIntegrationProtocol;\n capabilityId: string;\n pluginKey: string;\n serverId: string;\n name: string;\n description: string | null;\n provider: string | null;\n providerDomain: string;\n baseUrl: string;\n sourceUrl: string | null;\n revisionId: string;\n contentSha256: string;\n auth: ApiIntegrationAuthPreview;\n connectionId: string | null;\n connectionOwnership: ConnectionOwnership | null;\n tools: ApiIntegrationToolPreview[];\n warnings: string[];\n};\n\nexport type InstallApiIntegrationRequest = {\n source: IntegrationSourceInput;\n expectedRevisionId: string;\n expectedContentSha256: string;\n connectionId?: string | undefined;\n ownership?: ConnectionOwnership | undefined;\n instanceKey?: string | undefined;\n displayName?: string | undefined;\n expectedInstanceVersion?: number | undefined;\n allowedTools?: string[] | undefined;\n /**\n * Selected tools whose preview `approvalMode` is `\"ask\"` that should run\n * without per-call human approval (for example in scheduled or other\n * unattended sessions). Needs `capabilities:manage`; a curated definition\n * may forbid exempting specific operations (422). Declarative: omit it and every write tool asks\n * again. Connector Block and session approval policies still apply.\n */\n autoApprovedTools?: string[] | undefined;\n};\n\nexport type InstalledApiIntegration = {\n capabilityId: string;\n pluginId: string;\n pluginVersionId: string;\n integrationFacetId: string;\n apiFacetId: string;\n pluginInstallationId: string;\n integrationFacetInstallationId: string;\n apiFacetInstallationId: string;\n installationVersion: number;\n instanceId: string;\n instanceKey: string;\n displayName: string;\n instanceVersion: number;\n revisionId: string;\n serverId: string;\n status: \"installed\";\n};\n\nexport type ApiIntegrationInstallationSummary = {\n capabilityId: string;\n pluginKey: string;\n installationVersion: number;\n instanceId: string;\n instanceKey: string;\n displayName: string;\n instanceVersion: number;\n serverId: string;\n name: string;\n description: string | null;\n protocol: ApiIntegrationProtocol;\n definitionId: string;\n definitionProvenance: IntegrationDefinitionProvenance;\n providerDomain: string;\n baseUrl: string;\n sourceUrl: string | null;\n connected: boolean;\n requiresConnection: boolean;\n connectionId: string | null;\n /** When the bound connection was last used, or null when never or unbound. */\n connectionLastUsedAt?: string | null;\n ownership: \"workspace\" | \"personal\" | \"none\";\n allowedTools: string[];\n toolCount: number;\n approvalRequiredToolCount: number;\n revisionId: string;\n contentSha256: string;\n /**\n * Set on an instance a Personal workspace carries for its owner from another\n * workspace where they connected it \"Only me\"; it is managed there.\n */\n personalExtension?: { originWorkspaceId: string; originWorkspaceName: string };\n /**\n * Set when the organization serves it here (organization settings manage\n * it); `enabledHere` is false while this workspace turned it off.\n */\n organizationConnector?: {\n connectorId: string;\n login: \"each_person\" | \"organization_key\" | \"none\";\n /** How the API authenticates: what a person adds when each person signs in. */\n auth: ApiIntegrationAuthPreview;\n enabledHere: boolean;\n };\n /**\n * Whether the caller may remove this instance: admins remove any, a member\n * only one they added. Older servers omit it.\n */\n canRemove?: boolean | undefined;\n};\n\nexport type ListApiIntegrationsResponse = {\n integrations: ApiIntegrationInstallationSummary[];\n};\n\nexport type ApiIntegrationUninstallPreview = {\n capabilityId: string;\n instanceKey: string;\n displayName: string | null;\n installed: boolean;\n installationVersion: number | null;\n instanceVersion: number | null;\n directOwner: CapabilityComponentOwner | null;\n remainingOwners: CapabilityComponentOwner[];\n removesRuntimeIntegration: boolean;\n removesDefinition: boolean;\n};\n\nexport type UninstallApiIntegrationRequest = {\n expectedInstallationVersion: number;\n expectedInstanceVersion: number;\n};\n\nexport type UninstallApiIntegrationResult = {\n capabilityId: string;\n instanceKey: string;\n status: \"not_installed\" | \"uninstalled\" | \"retained_by_other_owners\";\n remainingOwners: CapabilityComponentOwner[];\n definitionStatus: \"retained\" | \"disabled\";\n};\n\nexport type PluginManifestComponent =\n | { key: string; kind: \"skill\"; url: string }\n | { key: string; kind: \"integration\"; source: IntegrationSource }\n | { key: string; kind: \"mcp\"; serverId: string };\n\nexport type PluginManifest = {\n schemaVersion: 1;\n pluginKey: string;\n version: string;\n name: string;\n description: string;\n category: string;\n tags: string[];\n components: PluginManifestComponent[];\n};\n\nexport type PluginComponentBinding = {\n connectionId?: string | undefined;\n instanceKey?: string | undefined;\n displayName?: string | undefined;\n};\n\nexport type PreviewPluginRequest = {\n url: string;\n bindings?: Record<string, PluginComponentBinding> | undefined;\n};\n\nexport type PluginComponentPreview = {\n key: string;\n kind: \"skill\" | \"integration\" | \"mcp\";\n name: string;\n capabilityId: string;\n digest: string;\n connectionRequired: boolean;\n connectionId: string | null;\n instanceKey: string | null;\n displayName: string | null;\n facts: Record<string, unknown>;\n};\n\nexport type PluginUpdateDiff = {\n fromVersion: string | null;\n toVersion: string;\n added: string[];\n removed: string[];\n changed: string[];\n unchanged: string[];\n};\n\nexport type PluginPreview = {\n sourceUrl: string;\n manifest: PluginManifest;\n manifestDigest: string;\n installed: boolean;\n installationVersion: number | null;\n components: PluginComponentPreview[];\n diff: PluginUpdateDiff;\n};\n\nexport type InstallPluginRequest = {\n url: string;\n expectedManifestDigest: string;\n expectedComponents: Array<{ key: string; digest: string }>;\n bindings?: Record<string, PluginComponentBinding> | undefined;\n idempotencyKey: string;\n expectedInstallationVersion?: number | undefined;\n};\n\nexport type InstalledPlugin = {\n skillPublications?: import(\"./skills\").SkillPublicationReceipt[] | undefined;\n skillWrites?: import(\"./skills\").SkillWriteReceipt[] | undefined;\n skillReleases?: import(\"./skills\").SkillSourceReleaseReceipt[] | undefined;\n pluginKey: string;\n version: string;\n pluginId: string;\n pluginVersionId: string;\n pluginInstallationId: string;\n installationVersion: number;\n componentCount: number;\n status: \"installed\";\n};\n\nexport type PluginInstallationSummary = {\n pluginKey: string;\n version: string;\n name: string;\n description: string;\n category: string;\n tags: string[];\n logoUrl?: string | null | undefined;\n sourceUrl: string | null;\n manifestDigest: string;\n installationVersion: number;\n componentCount: number;\n status: \"active\" | \"needs_attention\";\n installedAt: string;\n updatedAt: string;\n /**\n * Whether the caller may remove this plugin: admins remove any, a member\n * only one they added. Older servers omit it.\n */\n canRemove?: boolean | undefined;\n};\n\nexport type ListInstalledPluginsResponse = {\n plugins: PluginInstallationSummary[];\n};\n\nexport type PluginUninstallComponentImpact = {\n capabilityId: string;\n kind: \"skill\" | \"integration\" | \"mcp\";\n retainedByOtherOwners: boolean;\n name: string;\n disposition: \"removed\" | \"retained\" | \"inactive\";\n retentionReasons: Array<\"other_owners\" | \"customized\" | \"re_scoped\" | \"registry_unavailable\">;\n remainingOwners: Array<{\n kind: \"direct\" | \"plugin\" | \"migration\";\n name: string;\n }>;\n skillId?: string | undefined;\n};\n\nexport type PluginUninstallPreview = {\n pluginKey: string;\n installed: boolean;\n version: string | null;\n installationVersion: number | null;\n previewToken?: string | undefined;\n components: PluginUninstallComponentImpact[];\n};\n\nexport type UninstallPluginRequest = {\n expectedInstallationVersion: number;\n expectedPreviewToken?: string | undefined;\n idempotencyKey: string;\n};\n\nexport type UninstallPluginResult = {\n skillReleases?: import(\"./skills\").SkillSourceReleaseReceipt[] | undefined;\n pluginKey: string;\n status: \"not_installed\" | \"uninstalled\";\n retainedComponents: string[];\n};\n\n// --- GitHub ---------------------------------------------------------------------\n\nexport type GitHubRepository = {\n id: number;\n installationId: number;\n fullName: string;\n name: string;\n private: boolean;\n htmlUrl: string;\n cloneUrl: string;\n defaultBranch: string;\n accountLogin: string;\n accountType: string | null;\n /** GitHub's archived flag, when the provider reported it. */\n archived?: boolean | undefined;\n /** GitHub's reported size in kilobytes, when reported. Zero means empty. */\n sizeKb?: number | undefined;\n};\n\nexport type GitHubRepositoryScope = \"all\" | \"selected\";\n\nexport type GitHubBindingStatus = \"disabled\" | \"unbound\" | \"bound\";\n\nexport type GitHubAppSetupMode = \"platform\" | \"operator\";\n\nexport type GitHubInstallationLifecycle = \"active\" | \"suspended\" | \"deleted\" | \"unverified\";\n\nexport type GitHubInstallationBinding = {\n installationId: number;\n githubAccountId: number | null;\n accountLogin: string | null;\n accountType: string | null;\n lifecycle: GitHubInstallationLifecycle;\n repositoryScope: GitHubRepositoryScope;\n repositoryCount: number;\n /** Opengeni-owned entry point for changing the installation's repository allowlist. */\n configureUrl: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type GitHubAppInfo = {\n configured: boolean;\n /** Truthful workspace binding state; server App credentials alone are not a binding. */\n status: GitHubBindingStatus;\n /** Platform deployments expose installation only; operator deployments may create an App. */\n setupMode: GitHubAppSetupMode;\n appId: string | null;\n clientId: string | null;\n appSlug: string | null;\n /** Fresh OAuth-first existing-installation discovery and install entry point. */\n installUrl: string | null;\n /** Compatibility alias for installUrl. */\n linkUrl: string | null;\n /** Installation bindings owned independently by this workspace. */\n installations: GitHubInstallationBinding[];\n /** Setting names still missing when `configured` is false. */\n missing: string[];\n};\n\nexport type GitHubRepositoriesResponse = {\n repositories: GitHubRepository[];\n};\n\nexport type GitHubActionPolicyDecision = \"allow\" | \"ask\" | \"block\";\nexport type GitHubActionPolicyEffectiveDecision = GitHubActionPolicyDecision | \"mixed\";\nexport type GitHubActionPolicyGroup = \"routine\" | \"review\" | \"merge\";\n\nexport type GitHubActionPolicyActor =\n | { kind: \"workspace_app\"; installationId: number }\n | { kind: \"personal\"; connectionId: string };\n\nexport type GitHubActionPolicyActorState = GitHubActionPolicyActor & {\n label: string;\n groups: Record<GitHubActionPolicyGroup, GitHubActionPolicyEffectiveDecision>;\n};\n\nexport type GitHubActionPoliciesResponse = {\n enabled: boolean;\n actors: GitHubActionPolicyActorState[];\n};\n\nexport type UpdateGitHubActionPolicyRequest = {\n actor: GitHubActionPolicyActor;\n group: GitHubActionPolicyGroup;\n decision: GitHubActionPolicyDecision;\n};\n\nexport type VerifyPublicGitHubRepositoryRefRequest = {\n url: string;\n ref: string;\n};\n\nexport type VerifyPublicGitHubRepositoryRefResponse = {\n owner: string;\n name: string;\n fullName: string;\n canonicalUrl: string;\n cloneUrl: string;\n defaultBranch: string;\n ref: string;\n commitSha: string;\n};\n\nexport type GitHubRepositoryBranch = {\n name: string;\n isDefault: boolean;\n};\n\nexport type ListGitHubRepositoryBranchesOptions = {\n cursor?: number | undefined;\n limit?: number | undefined;\n};\n\nexport type GitHubRepositoryBranchesResponse = {\n branches: GitHubRepositoryBranch[];\n nextCursor: number | null;\n};\n\nexport type CreateGitHubAppManifestRequest = {\n appName?: string | undefined;\n organization?: string | undefined;\n public?: boolean | undefined;\n includeCiPermissions?: boolean | undefined;\n};\n\nexport type CreateGitHubAppManifestResponse = {\n /** GitHub URL to POST the manifest to (personal or organization flow). */\n actionUrl: string;\n state: string;\n manifest: Record<string, unknown>;\n};\n\n// --- Billing --------------------------------------------------------------------\n\nexport type BillingMode = \"disabled\" | \"stripe\";\n\nexport type EntitlementsMode = \"none\" | \"static\" | \"managed\";\n\nexport type PromotionalCreditScope = {\n label: string;\n eligibleModelIds: string[];\n};\n\nexport type PromotionalCreditBalance = PromotionalCreditScope & {\n grantId: string;\n remainingMicros: number;\n /** Also pays for dictation and live voice, like general credits (signup credits). */\n coversVoice?: boolean | undefined;\n /** Monthly scoped allowance; allocated before other promotions. */\n planCredit?: boolean | undefined;\n /** Free funding unavailable for new admission under an active promotion hold. */\n held?: boolean | undefined;\n};\n\nexport type {\n BillingPlanBalance,\n SubscriptionPlan,\n SubscriptionPlanCatalog,\n BillingSubscriptionCatalog,\n CreateSubscriptionCheckoutRequest,\n CreateSubscriptionCheckoutResponse,\n ChangeBillingSubscriptionRequest,\n CancelBillingSubscriptionRequest,\n BillingSubscriptionChange,\n} from \"@opengeni/contracts\";\nimport type { BillingPlanBalance } from \"@opengeni/contracts\";\n\nexport type BillingBalance = {\n accountId: string;\n balanceMicros: number;\n currency: \"usd\";\n updatedAt: string;\n generalBalanceMicros?: number | undefined;\n /** Credits outside plan credit (top-ups, operator grants). API usage spends only this. */\n creditsMicros?: number | undefined;\n /** Credit debt from API usage. Plan credit never repays it. */\n apiDebtMicros?: number | undefined;\n /** Paid plan credit the own-key platform fee may draw (app use only). */\n paidPlanCreditMicros?: number | undefined;\n /** Paid-for credits the own-key platform fee may draw. */\n paidCreditsMicros?: number | undefined;\n /** Own-key platform fees charged this calendar month (UTC). */\n byokPlatformFeeMonthMicros?: number | undefined;\n /** Own-key fees that ran past paid credit; the next top-up repays it. */\n byokFeeDebtMicros?: number | undefined;\n promotionalCredits?: PromotionalCreditBalance[] | undefined;\n heldCreditMicros?: number | undefined;\n heldGeneralCreditMicros?: number | undefined;\n promotionDecision?: \"eligible\" | \"verification_required\" | \"held\" | \"denied\" | undefined;\n plan?: BillingPlanBalance | null | undefined;\n};\n\nexport const KNOWN_USAGE_EVENT_TYPES = [\n \"agent_run.created\",\n \"agent_run.completed\",\n \"model.tokens\",\n \"model.cost\",\n \"file.uploaded\",\n \"file.deleted\",\n \"document.indexed\",\n \"scheduled_task.fired\",\n \"knowledge_source_sync.fired\",\n \"knowledge_source_sync.completed\",\n \"knowledge_source_sync.items\",\n \"knowledge_source_sync.bytes\",\n \"api_key.request\",\n // sandbox warm-time metering (P2.1) — mirrors contracts UsageEventType.\n \"sandbox.warm_seconds\",\n \"sandbox.warm_cost\",\n] as const;\n\nexport type KnownUsageEventType = (typeof KNOWN_USAGE_EVENT_TYPES)[number];\n\nexport type UsageEventType = KnownUsageEventType | (string & {});\n\nexport type UsageEvent = {\n id: string;\n workspaceId: string;\n accountId: string;\n subjectId: string | null;\n eventType: UsageEventType;\n quantity: number;\n unit: string;\n sourceResourceType: string | null;\n sourceResourceId: string | null;\n idempotencyKey: string;\n occurredAt: string;\n recordedAt: string;\n exportedToBillingAt: string | null;\n billingProviderEventId: string | null;\n};\n\nexport type EntitlementValue = boolean | string | number | string[];\n\nexport type Entitlements = Record<string, EntitlementValue>;\n\nexport type BillingSummary = {\n mode: BillingMode;\n balance: BillingBalance;\n};\n\nexport type BillingUsageResponse = {\n balance: BillingBalance;\n usage: UsageEvent[];\n};\n\nexport type InsightsRange = \"today\" | \"week\" | \"month\" | \"ytd\";\n\nexport type InsightsBillingPath = \"opengeni_credits\" | \"external\";\n\nexport type InsightsPricingSource = \"configured_list_price\" | \"gateway_reported\";\n\nexport type InsightsModelUsageRow = {\n id: string;\n model: string;\n provider: string;\n billing: InsightsBillingPath;\n calls: number;\n inputTokens: number;\n outputTokens: number;\n cachedTokens: number;\n cacheInputTokens: number;\n cacheWriteTokens: number;\n reasoningTokens: number;\n totalTokens: number;\n tokenKnownCalls: number;\n cacheKnownCalls: number;\n creditUsd: number;\n estimatedProviderUsd: number;\n estimatedProviderCostKnownCalls: number;\n equivalentCreditUsd: number;\n equivalentCreditCostKnownCalls: number;\n};\n\nexport type InsightsSeriesPoint = {\n label: string;\n modelCostUsd: number;\n estimatedProviderUsd: number;\n estimatedProviderCostKnownCalls: number;\n equivalentCreditUsd: number;\n equivalentCreditCostKnownCalls: number;\n warmSeconds: number;\n inputTokens: number;\n outputTokens: number;\n cachedTokens: number;\n cacheInputTokens: number;\n cacheWriteTokens: number;\n reasoningTokens: number;\n totalTokens: number;\n tokenKnownCalls: number;\n cacheKnownCalls: number;\n cacheHitPct: number;\n calls: number;\n};\n\nexport type InsightsScope = {\n rootSessionId: string | null;\n sessionId: string | null;\n};\n\nexport type InsightsDepthBucket = {\n depth: number;\n sessions: number;\n};\n\nexport type InsightsModelFacet = {\n provider: string;\n model: string;\n};\n\nexport type InsightsSpendDriver = {\n id: string;\n groupBy: \"root_session\" | \"schedule\";\n label: string;\n creditUsd: number;\n estimatedProviderUsd: number;\n estimatedProviderCostKnownCalls: number;\n equivalentCreditUsd: number;\n equivalentCreditCostKnownCalls: number;\n tokens: number;\n cacheHitPct: number;\n pctOfCreditUsd: number;\n pctOfTokens: number;\n deltaUsdVsPrior: number;\n};\n\nexport type InsightsProjectRow = {\n id: string;\n kind: \"project\" | \"other\" | \"unfiled\" | \"unavailable\" | \"deleted\";\n label: string;\n projects: number;\n rootSessions: number;\n calls: number;\n creditUsd: number;\n estimatedProviderUsd: number;\n estimatedProviderCostKnownCalls: number;\n tokens: number;\n cacheHitPct: number | null;\n};\n\nexport type InsightsWarmGroupRow = {\n id: string;\n groupId: string;\n label: string;\n backend: string | null;\n warmSeconds: number;\n sessionsAttached: number;\n};\n\nexport type InsightsLiveWarmLease = {\n id: string;\n groupId: string;\n backend: string;\n turnHolders: number;\n viewerHolders: number;\n warmForLabel: string;\n warmSeconds: number;\n};\n\nexport type InsightsFloorSession = {\n id: string;\n title: string;\n state: \"running\" | \"paused\" | \"failed\" | \"idle\" | \"compacting\" | \"waiting\";\n depth: number;\n model: string | null;\n provider: string | null;\n ageLabel: string;\n cacheHitPct: number | null;\n route: string | null;\n};\n\nexport type InsightsScheduleRow = {\n id: string;\n name: string;\n fires: number;\n creditUsd: number | null;\n estimatedProviderUsd: number | null;\n estimatedProviderCostKnownCalls: number | null;\n equivalentCreditUsd: number | null;\n equivalentCreditCostKnownCalls: number | null;\n tokens: number | null;\n cacheHitPct: number | null;\n billing: InsightsBillingPath | null;\n};\n\nexport type InsightsModelCallRow = {\n id: string;\n occurredAt: string;\n recordedAt: string;\n sessionId: string;\n sessionTitle: string;\n turnId: string;\n provider: string;\n providerApi: string;\n model: string;\n billing: InsightsBillingPath;\n inputTokens: number | null;\n outputTokens: number | null;\n cachedTokens: number | null;\n cacheWriteTokens: number | null;\n reasoningTokens: number | null;\n totalTokens: number | null;\n creditUsd: number;\n estimatedProviderUsd: number | null;\n equivalentCreditUsd: number | null;\n pricingSource: InsightsPricingSource | null;\n};\n\nexport type ModelContextContributionSource =\n | \"workspace_instruction_policy\"\n | \"legacy_workspace_instructions\"\n | \"preference_registry_descriptor\"\n | \"company_profile\"\n | \"legacy_memory_v1\"\n | \"runtime_skill_catalog\";\n\nexport type InsightsPromptContributionRow = {\n source: ModelContextContributionSource;\n items: number;\n utf8Bytes: number;\n estimatedTokens: number;\n calls: number;\n};\n\nexport type InsightsPromptContributions = {\n estimatedTokens: number;\n utf8Bytes: number;\n coveredCalls: number;\n totalCalls: number;\n sources: InsightsPromptContributionRow[];\n};\n\nexport type WorkspaceInsightsSnapshot = {\n range: InsightsRange;\n rangeLabel: string;\n priorLabel: string;\n seriesLabel: string;\n cacheSeriesLabel: string;\n windowStart: string;\n windowEnd: string;\n generatedAt: string;\n timezone: \"UTC\";\n models: InsightsModelUsageRow[];\n facets: InsightsModelFacet[];\n series: InsightsSeriesPoint[];\n depth: InsightsDepthBucket[];\n drivers: InsightsSpendDriver[];\n projects: InsightsProjectRow[];\n privateChats: {\n ownerKey: string;\n name: string | null;\n you: boolean;\n calls: number;\n tokens: number;\n creditUsd: number;\n estimatedProviderUsd: number;\n estimatedProviderCostKnownCalls: number;\n }[];\n privateChatsTruncated: boolean;\n schedules: InsightsScheduleRow[];\n recentCalls: InsightsModelCallRow[];\n promptContributions: InsightsPromptContributions;\n warmSeconds: number;\n priorWarmSeconds: number;\n warmGroups: InsightsWarmGroupRow[];\n liveWarm: InsightsLiveWarmLease[];\n floor: InsightsFloorSession[];\n selfhostedEnabled: boolean;\n machinesOnline: number;\n workspaceCreditUsd: number;\n priorWorkspaceCreditUsd: number;\n creditUsd: number;\n priorCreditUsd: number;\n estimatedProviderUsd: number;\n priorEstimatedProviderUsd: number;\n estimatedProviderCostKnownCalls: number;\n priorEstimatedProviderCostKnownCalls: number;\n equivalentCreditUsd: number;\n priorEquivalentCreditUsd: number;\n equivalentCreditCostKnownCalls: number;\n priorEquivalentCreditCostKnownCalls: number;\n modelCalls: number;\n priorInputTokens: number;\n priorTotalTokens: number;\n priorCacheHitPct: number;\n priorCalls: number;\n goalsActive: number;\n goalsCompleted: number;\n sessionsTouched: number;\n rootSessions: number;\n deepestDepth: number;\n deepestSessionTitle: string;\n avgDepth: number;\n warmIdleNow: number;\n billableTokensUsed: number;\n billableTokenCap: number | null;\n agentRunsUsed: number;\n agentRunCap: number | null;\n modelFilterActive: boolean;\n dataThrough: string | null;\n cacheHitPct: number;\n scope: InsightsScope;\n driverGroups: number;\n driversTruncated: boolean;\n facetsTruncated: boolean;\n recentCallsTruncated: boolean;\n};\n\nexport type WorkspaceInsightsResponse = {\n snapshot: WorkspaceInsightsSnapshot;\n};\n\nexport type BillingEntitlementsResponse = {\n accountId: string;\n mode: EntitlementsMode;\n entitlements: Entitlements;\n};\n\nexport type CreateCheckoutRequest = {\n accountId?: string | undefined;\n /**\n * USD amount with cent precision (server enforces min/max). Required unless\n * `promotionCode` is given; a fixed-amount USD code then sets the amount.\n */\n amountUsd?: number | undefined;\n /** A Stripe promotion code to apply up front, as the customer typed it. */\n promotionCode?: string | undefined;\n successUrl?: string | undefined;\n cancelUrl?: string | undefined;\n};\n\nexport type CreateCheckoutResponse = {\n checkoutSessionId: string;\n url: string;\n /** The credits this checkout grants once it completes. */\n amountUsd?: number | undefined;\n promotionalScope?: PromotionalCreditScope | undefined;\n};\n\n/** Where one checkout stands, and whether its credits reached the balance. */\nexport type BillingCheckoutStatus = {\n checkoutSessionId: string;\n status: \"open\" | \"complete\" | \"expired\";\n credit: {\n state: \"pending\" | \"granted\";\n amountMicros: number;\n currency: \"usd\";\n /** True when a coupon covered the whole checkout, so nothing was charged. */\n free: boolean;\n promotionalScope?: PromotionalCreditScope | undefined;\n };\n balance: BillingBalance | null;\n};\n\nexport type CreateBillingPortalRequest = {\n accountId?: string | undefined;\n returnUrl?: string | undefined;\n};\n\nexport type CreateBillingPortalResponse = {\n portalSessionId: string;\n url: string;\n};\n\nexport type UserMessageEventInput = {\n type: \"user.message\";\n clientEventId?: string | undefined;\n payload: {\n text: string;\n annotations?: SubmittedTimelineAnnotation[] | undefined;\n modelContext?: string | undefined;\n /**\n * IANA time zone of the person sending the message (for example\n * `Europe/Oslo`), so the model sees the message's local time. In a\n * browser or app the client fills in the device's zone when this is\n * omitted; invalid names are dropped.\n */\n timeZone?: string | undefined;\n resources?: ResourceRef[] | undefined;\n model?: string | undefined;\n reasoningEffort?: ReasoningEffort | undefined;\n latencyMode?: LatencyMode | undefined;\n controlEtag?: string | undefined;\n expectedDraftRevision?: number | undefined;\n mcpCredentialUpdates?: SessionMcpCredentialUpdateInput[] | undefined;\n connectionAccounts?: McpConnectionAccountSelection[] | undefined;\n personalResourceAttachment?: PersonalResourceAttachmentIntent | undefined;\n };\n};\n\n/**\n * Stable fields of each `session.requiresAction` `payload.approvals[]` entry.\n * Entries also carry producer-specific compatibility fields (`rawItem` on a\n * turn's first pause, `raw` on later ones); read only these three. Events\n * written before these fields existed need `approvalsFromRequiresAction`\n * from `@opengeni/react` or `approvalIdentifier` from `@opengeni/contracts`.\n */\nexport type SessionApprovalRequest = {\n /** Pass as `sendApprovalDecision({ approvalId })`; this is the tool call id. */\n id: string;\n /** Model-visible tool name, for example `crm__update_record`. */\n name: string;\n /** Tool arguments as the model produced them (usually a JSON string). */\n arguments: unknown;\n /**\n * Present when the tool's MCP server stopped mid-call to ask the person\n * (form elicitation). Approving sends `elicitationRound: elicitation.round`\n * and the answers as `content`, keyed by `requests[].id` and then by field\n * name; omitted fields take the form's defaults. Rejecting tells the server\n * the person declined.\n */\n elicitation?: McpElicitationApprovalRequest | undefined;\n [compatibilityField: string]: unknown;\n};\n\nexport type UserApprovalDecisionEventInput = {\n type: \"user.approvalDecision\";\n clientEventId?: string | undefined;\n payload: {\n /** `session.requiresAction` `approvals[].id` (the pending tool call id). */\n approvalId: string;\n decision: \"approve\" | \"reject\";\n message?: string | undefined;\n /** Answers to the approval's `elicitation` forms; only with `approve`. */\n content?: McpElicitationContent | undefined;\n /** The `elicitation.round` an approval answers; required to approve one. */\n elicitationRound?: number | undefined;\n /** Server-owned header rotation applied atomically when the response is accepted. */\n mcpCredentialUpdates?: SessionMcpCredentialUpdateInput[] | undefined;\n };\n};\n\nexport type UserHumanInputResponseEventInput = {\n type: \"user.humanInputResponse\";\n clientEventId?: string | undefined;\n payload: {\n requestId: string;\n response: SubmitHumanInputResponseRequest;\n /** Server-owned header rotation applied atomically when the response is accepted. */\n mcpCredentialUpdates?: SessionMcpCredentialUpdateInput[] | undefined;\n };\n};\n\n/** Control/user events a client may POST to a session's event log. */\nexport type ClientSessionEventInput =\n | UserMessageEventInput\n | UserApprovalDecisionEventInput\n | UserHumanInputResponseEventInput;\n\n// ── Bring-your-own-compute: Machines dashboard + per-machine metrics (M10) ────\n// Hand-written mirrors of the `@opengeni/contracts` MetricSample / MachineView /\n// MachinesResponse / MachineMetricsSeriesResponse (pinned by contract-parity).\n// M9 imports THESE so the dashboard UI never drifts from the API.\n\n/** A point-in-time machine metrics sample. `gpuUtilPct`/`gpuMemBytes` are null\n * when no GPU was present (not-reported, never a real zero); the bytes/load are\n * numbers; `sampledAt` is an ISO-8601 instant. */\nexport type MetricSample = {\n cpuPct: number;\n load1: number;\n load5: number;\n load15: number;\n memUsedBytes: number;\n memTotalBytes: number;\n diskUsedBytes: number;\n diskTotalBytes: number;\n gpuUtilPct: number | null;\n gpuMemBytes: number | null;\n runQueue: number;\n sampledAt: string;\n};\n\n/** The derived dashboard state of a machine (M3 liveness + consent/display\n * reasons + the in-flight device-flow). */\nexport type MachineState =\n | \"online\"\n | \"reconnecting\"\n | \"offline\"\n | \"consent_required\"\n | \"display_unavailable\"\n | \"enrolling\";\n\nexport type MachineKind =\n | \"docker\"\n | \"modal\"\n | \"local\"\n | \"daytona\"\n | \"runloop\"\n | \"e2b\"\n | \"blaxel\"\n | \"cloudflare\"\n | \"vercel\"\n | \"selfhosted\"\n | \"opensandbox\"\n | \"compute\";\n\nexport type MachineConnectionAuthority = {\n state: \"not_applicable\" | \"unclaimed\" | \"active\" | \"expired\";\n generation: number;\n supersededCount: number;\n leaseExpiresAt: string | null;\n duplicateRunnerDeniedCount: number;\n duplicateRunnerDeniedAt: string | null;\n authenticationError?: \"credentials_expired\" | null | undefined;\n};\n\nexport type MachineRuntimeCapabilities = {\n exec: boolean;\n filesystem: boolean;\n git: boolean;\n pty: boolean;\n desktop: boolean;\n opStream: boolean;\n browserBridge: boolean;\n operationResourcePolicy: boolean;\n operationCpuQuota: boolean;\n transactionalFsWrite: boolean;\n /** The agent renews its credentials on request, so screen control turns on in place. */\n credentialRenew: boolean;\n /** The live agent's credentials carry screen-control consent; null when unknown. */\n screenControl: boolean | null;\n};\n\n/** The three macOS Privacy & Security grants desktop capture and input need. */\nexport type MachineMacPermissions = {\n screenRecording: boolean;\n accessibility: boolean;\n inputMonitoring: boolean;\n};\n\nexport type MachineUpdateStatus =\n | \"requested\"\n | \"accepted\"\n | \"waiting_for_idle\"\n | \"downloading\"\n | \"verifying\"\n | \"applying\"\n | \"restarting\"\n | \"succeeded\"\n | \"failed\";\n\nexport type MachineUpdateState = {\n operationId: string;\n status: MachineUpdateStatus;\n targetVersion: string;\n expectedBinarySha256: string | null;\n errorCode: string | null;\n blockers?: Array<{ kind: string; count: number }> | undefined;\n retryable: boolean;\n rolledBack: boolean;\n requestedAt: string;\n updatedAt: string;\n completedAt: string | null;\n};\n\nexport type MachineRuntime = {\n installedVersion: string | null;\n binarySha256: string | null;\n updateChannel: \"stable\" | \"beta\" | null;\n desiredVersion: string | null;\n versionState: \"unknown\" | \"current\" | \"outdated\" | \"ahead\" | \"updating\" | \"update_failed\";\n /** Required installer bootstrap when a legacy updater cannot safely replace the install. */\n updateBlockedReason?: string | null | undefined;\n capabilities: MachineRuntimeCapabilities;\n update: MachineUpdateState | null;\n /** Live macOS permissions; null off macOS or when the agent does not report them. */\n macPermissions: MachineMacPermissions | null;\n};\n\nexport type UpdateMachineAgentResponse = {\n operationId: string;\n accepted: boolean;\n targetVersion: string;\n};\n\n/** POST /v1/workspaces/:ws/machines/:enrollmentId/screen-control response.\n * active: on now. pending: allowed, and turns on by itself when the machine\n * reconnects (offline), after its agent update (agent_update_required), or on\n * a retry (renewal_failed). reconnect_required: run the connect command on the\n * machine again. */\nexport type EnableMachineScreenControlResponse = {\n status: \"active\" | \"pending\";\n reason: \"offline\" | \"agent_update_required\" | \"renewal_failed\" | \"reconnect_required\" | null;\n message: string | null;\n};\n\n/** macOS Privacy & Security panes the agent needs for desktop capture/input. */\nexport type MachinePrivacySettingsPane = \"screen_recording\" | \"accessibility\" | \"input_monitoring\";\n\n/** POST /v1/workspaces/:ws/machines/:enrollmentId/privacy-settings body. */\nexport type OpenMachinePrivacySettingsRequest = {\n pane: MachinePrivacySettingsPane;\n};\n\n/** Who can use a Connected Machine: everyone in its workspace, or one person. */\nexport type MachineAudience = \"workspace\" | \"only_me\";\n\n/** POST /v1/workspaces/:ws/machines/:enrollmentId/audience/preview body.\n * `ownerSubjectId` names who owns the machine as Only me (defaults to the\n * caller; naming someone else needs workspace admin). */\nexport type MachineAudiencePreviewRequest = {\n audience: MachineAudience;\n ownerSubjectId?: string;\n};\n\n/** PUT /v1/workspaces/:ws/machines/:enrollmentId/audience body: apply the\n * previewed plan at the generation it was read at. */\nexport type ChangeMachineAudienceRequest = MachineAudiencePreviewRequest & {\n expectedGeneration: number;\n};\n\n/** What the change does to one thing on the machine. `move_off`: the chat\n * leaves the machine (its history and files stay). `keep`: the owner's chat\n * stays. `pause`: another person's schedule that runs on the machine; the new\n * owner's own schedules keep running and are not listed. `make_only_me` is no\n * longer produced. `remove_first`: the same computer is connected a second\n * time. */\nexport type MachineAudienceAction = \"move_off\" | \"keep\" | \"make_only_me\" | \"pause\" | \"remove_first\";\n\n/** One thing an audience change affects. Another member's private chat or\n * schedule is listed without its title or owner. */\nexport type MachineAudienceItem = {\n kind: \"chat\" | \"schedule\" | \"duplicate_connection\";\n action: MachineAudienceAction;\n sessionId: string | null;\n scheduledTaskId: string | null;\n enrollmentId: string | null;\n workspaceId: string | null;\n relation: \"other_member\" | \"owner_shared\" | \"owner_private\" | \"other_workspace\" | null;\n visibility: \"user_private\" | \"workspace_shared\" | null;\n title: string | null;\n ownerSubjectId: string | null;\n /** A running turn in this chat stops for good. */\n stopsTurn: boolean;\n /** Agent commands still running in this chat that stop. */\n stopsCommands: number;\n};\n\n/** Counts of what one change does. */\nexport type MachineAudienceSummary = {\n keptChats: number;\n keptSharedChats: number;\n movedOffChats: number;\n /** No longer produced: always 0. */\n schedulesMadeOnlyMe: number;\n schedulesPaused: number;\n stoppedTurns: number;\n stoppedCommands: number;\n notifiedPeople: number;\n};\n\n/** POST .../audience/preview response: everything one confirmation does.\n * `ready` is false only while the same computer is also connected as a\n * separate machine. */\nexport type MachineAudiencePreview = {\n enrollmentId: string;\n sandboxId: string;\n machineName: string;\n currentAudience: MachineAudience;\n targetAudience: MachineAudience;\n generation: number;\n ownerSubjectId: string | null;\n summary: MachineAudienceSummary;\n items: MachineAudienceItem[];\n ready: boolean;\n};\n\n/** PUT .../audience response. The machine keeps its sandbox ID and connection. */\nexport type ChangeMachineAudienceResponse = {\n enrollmentId: string;\n sandboxId: string;\n previousAudience: MachineAudience;\n audience: MachineAudience;\n ownerSubjectId: string | null;\n generation: number;\n summary: MachineAudienceSummary;\n detachedSessionIds: string[];\n keptSessionIds: string[];\n};\n\n/** POST /v1/workspaces/:ws/machines/:enrollmentId/privacy-settings response. */\nexport type OpenMachinePrivacySettingsResponse = {\n opened: boolean;\n message: string | null;\n};\n\nexport type MachineOperationPolicy = {\n memoryMaxBytes: number | null;\n memoryHighBytes: number | null;\n cpuMaxMillicores: number | null;\n revision: number;\n updatedAt: string | null;\n};\n\nexport type UpdateMachineOperationPolicyRequest = {\n memoryMaxBytes: number | null;\n memoryHighBytes: number | null;\n /** Omitted preserves the current CPU limit for older/partial clients; null clears. */\n cpuMaxMillicores?: number | null;\n expectedRevision: number;\n};\n\n/** A machine as the Machines dashboard renders it (an enrolled selfhosted machine\n * or the session's synthetic Modal group box, `isSessionGroup: true`). */\nexport type MachineView = {\n sandboxId: string;\n enrollmentId: string | null;\n scope: ResourceAuthorityScope;\n generation: number;\n name: string;\n kind: MachineKind;\n state: MachineState;\n active: boolean;\n isSessionGroup: boolean;\n workspaceGeneration: number | null;\n archiveGeneration: number | null;\n archiveComplete: boolean;\n os: string;\n arch: string;\n hasDisplay: boolean;\n /** Non-null only when a display exists but capture is blocked (macOS Screen\n * Recording / TCC not granted) — the UI can surface \"display: capture not\n * granted\". null == capture permitted OR headless. */\n desktopUnavailableReason?: string | null | undefined;\n allowScreenControl: boolean;\n sharedSessionCount: number;\n lastSeenAt: string | null;\n /** Secret-free single-runner authority diagnostics. */\n connectionAuthority: MachineConnectionAuthority;\n /** Exact build/update truth. Null means the runner predates runtime Hello\n * reporting or this is a managed-session group without a connected agent. */\n runtime: MachineRuntime | null;\n /** Explicit per-enrollment command memory policy. Null only for managed\n * session boxes; null limits on a real machine mean unrestricted. */\n operationPolicy: MachineOperationPolicy | null;\n metrics: MetricSample | null;\n /** Where an organization machine works; null for every other machine. */\n reach?: OrganizationComputeReach | null;\n};\n\n/** GET /v1/workspaces/:ws/machines — the dashboard list + the active-sandbox\n * pointer (null activeSandboxId == the session's own group box is active). */\nexport type SessionMachineAccess = {\n sandboxId: string;\n machineName: string;\n ownerName: string | null;\n isOwner: boolean;\n queuedTurnBlocked: boolean;\n /** Results from other people's work (their workers' results and agent\n * messages) waiting because only the machine's owner may start work on it,\n * grouped by whose work it is. Older servers omit it. */\n waitingWork?: SessionWaitingWork[] | undefined;\n /** Messages other people sent here that wait because only the machine's\n * owner may start work on it, grouped by sender. The owner's next message\n * brings them to the agent; moving the chat to a machine the sender may\n * use runs them. Older servers omit it. */\n waitingMessages?: SessionWaitingMessages[] | undefined;\n /** The next saved message is the machine owner's own and was approved for\n * other machines, not this one, so it can't start here and no recheck\n * helps: it runs after the chat moves to a machine it was approved for, or\n * it is removed and sent again here. Older servers omit it. */\n queuedTurnNotApprovedHere?: boolean | undefined;\n /** Where that message may run: the owner's personal machines it was\n * approved for. Listed only for its sender; empty for everyone else. */\n queuedTurnApprovedMachines?: SessionApprovedMachine[] | undefined;\n};\n\nexport type SessionApprovedMachine = {\n sandboxId: string;\n machineName: string;\n};\n\nexport type SessionWaitingMessages = {\n /** The sender's display name, when known. */\n name: string | null;\n /** The caller sent them. */\n isYou: boolean;\n messages: number;\n};\n\nexport type SessionWaitingWork = {\n /** The person's display name, when known. */\n name: string | null;\n /** The waiting results come from the caller's own work. */\n isYou: boolean;\n results: number;\n};\n\n/** POST /v1/workspaces/:ws/sessions/:id/waiting-work/continue */\nexport type ContinueSessionWaitingWorkResponse = {\n /** How many waiting results the agent now continues with under your authority. */\n continued: number;\n};\n\nexport type MachinesResponse = {\n activeSandboxId: string | null;\n activeEpoch: number;\n machines: MachineView[];\n sessionMachineAccess?: SessionMachineAccess | null | undefined;\n /**\n * False when the organization lets only its owners and admins connect new\n * machines of their own: an Only me machine, or any machine in a Personal\n * workspace. Omitted for an agent listing its own chat, and by older servers.\n */\n canConnectOwnMachine?: boolean | undefined;\n};\n\n/** GET /v1/workspaces/:ws/machines/:enrollmentId/metrics/series — the downsampled\n * (~1/min) history the dashboard time-range reads. */\nexport type MachineMetricsSeriesResponse = {\n samples: MetricSample[];\n};\n\n/** POST /v1/workspaces/:ws/enrollments/:id/revoke body. */\nexport type RemoveEnrollmentRequest = {\n expectedUpdatedAt?: string;\n idempotencyKey?: string;\n};\n\n/** Typed removal/revocation outcome. Blocked outcomes preserve the exact\n * dependency and the action needed to make removal safe. */\nexport type RemoveEnrollmentResponse = {\n revoked: boolean;\n outcome: \"removed\" | \"already_removed\" | \"blocked\";\n enrollmentId: string;\n machineName: string | null;\n lastSeenAt: string | null;\n revokedAt: string | null;\n code:\n | \"active_route\"\n | \"active_commands\"\n | \"machine_home\"\n | \"active_lease\"\n | \"recovery_pending\"\n | \"not_selfhosted\"\n | null;\n message: string;\n action: string;\n dependentSessions: Array<{ id: string; title: string | null }>;\n};\n\n/** POST /v1/workspaces/:ws/sessions/:sessionId/active-sandbox — swap a session's\n * active sandbox. `target` is a `MachineView.sandboxId`, or \"session\"/\"default\"\n * to swap back to the session's own group box. */\nexport type SwapActiveSandboxRequest = {\n target: string;\n};\n\n/** The swap outcome (mirrors the server `FleetSwapResult`). `swapped` is true on a\n * successful repoint OR a no-op (already there); `reason` carries the failure\n * detail (unowned/offline target, or a lost epoch fence) when false. */\nexport type SwapActiveSandboxResponse = {\n swapped: boolean;\n activeSandboxId: string | null;\n activeEpoch: number;\n reason?: string;\n // Typed rejection discriminant (issue #341); present only when swapped is false.\n // Mirror of the `@opengeni/contracts` SwapActiveSandboxResponse.code enum.\n code?:\n | \"stale_pointer\"\n | \"offline_enrollment\"\n | \"unsupported_backend_context\"\n | \"transient_establishment\"\n | \"home_unavailable_this_turn\"\n | \"workspace_root_unavailable\"\n | \"invalid_working_directory\"\n | \"concurrent_swap\"\n | \"personal_machine_permission_required\"\n | \"personal_machine_not_permitted\"\n | \"recovery_in_progress\"\n | \"recovery_degraded\"\n | \"recovery_unrecoverable\";\n};\n\n// ── Self-hosted enrollment UX (design 11) ────────────────────────────────────\n// Hand-written mirrors of the `@opengeni/contracts` enrollment-UX request/response\n// shapes. They remain type-only so ordinary SDK entries do not reach the contracts\n// runtime. The click-Grant approve-page lookup/deny + the headless enroll-token\n// mint/exchange.\n\n/** Mirror of `@opengeni/contracts` EnrollmentOs. */\nexport type EnrollmentOs = \"linux\" | \"macos\" | \"windows\";\nexport type ResourceAuthorityScope = \"organization\" | \"workspace\" | \"user\";\n\n/** POST /v1/enrollments/device/lookup body. */\nexport type DeviceEnrollmentLookupRequest = {\n userCode: string;\n};\n\n/** The presentational machine details the consent screen renders. */\nexport type DeviceEnrollmentLookupMachine = {\n machineName: string | null;\n os: EnrollmentOs;\n arch: string;\n canOfferDisplay: boolean;\n requestsScreenControl: boolean;\n};\n\n/** POST /v1/enrollments/device/lookup response (no secrets, no device_code). */\nexport type DeviceEnrollmentLookupResponse = {\n workspaceId: string;\n userCode: string;\n machine: DeviceEnrollmentLookupMachine;\n expiresAt: string;\n};\n\n/** POST /v1/workspaces/:ws/enrollments/device/approve body. */\nexport type DeviceEnrollmentApproveRequest = {\n userCode: string;\n allowScreenControl?: boolean;\n scope?: ResourceAuthorityScope;\n};\n\n/** POST /v1/workspaces/:ws/enrollments/device/approve response. */\nexport type DeviceEnrollmentApproveResponse = {\n approved: boolean;\n enrollmentId: string;\n sandboxId: string;\n allowScreenControl: boolean;\n};\n\n/** POST /v1/workspaces/:ws/enrollments/device/deny body. */\nexport type DeviceEnrollmentDenyRequest = {\n userCode: string;\n};\n\n/** POST /v1/workspaces/:ws/enrollments/device/deny response. */\nexport type DeviceEnrollmentDenyResponse = {\n denied: boolean;\n};\n\n/** POST /v1/workspaces/:ws/enrollments/token body. */\nexport type MintEnrollTokenRequest = {\n allowScreenControl?: boolean;\n /**\n * Who can use the machine. `user` makes it the signed-in caller's own\n * machine (requires a verified person: someone signed in, or a credential\n * acting as them, such as a personal API key or an organization key acting\n * `asUser`; a key, service or agent acting as itself gets 422); `workspace`\n * shares it with this workspace's members. Omitted mints the original\n * workspace-shared token.\n */\n scope?: EnrollTokenScope;\n};\n\n/** Who can use a machine connected with an enroll token. */\nexport type EnrollTokenScope = \"user\" | \"workspace\";\n\n/** POST /v1/workspaces/:ws/enrollments/token response. The `token` is SECRET. */\nexport type MintEnrollTokenResponse = {\n token: string;\n expiresAt: string;\n expiresInSeconds: number;\n /** What the token grants. Absent from servers that predate scoped tokens,\n * which always mint workspace-shared tokens. */\n scope?: EnrollTokenScope;\n allowScreenControl?: boolean;\n};\n\n/** The credential payload the headless exchange returns (a subset of the agent's\n * EnrollmentCredentials — IDENTICAL to the device-flow poll authorized branch). */\nexport type EnrollmentCredentials = {\n agentId: string;\n workspaceId: string;\n bearer: string;\n subjectPrefix: string;\n natsUrls: string[];\n relayUrl: string;\n relayToken: string;\n natsAccountCreds: string;\n updatePublicKey: string;\n consentedWholeMachine: boolean;\n consentedScreenControl: boolean;\n};\n\n/** POST /v1/enrollments/token/exchange body (the headless / fleet enroll path). */\nexport type EnrollTokenExchangeRequest = {\n token: string;\n publicKey: string;\n os?: EnrollmentOs;\n arch?: string;\n machineName?: string;\n exposure?: \"whole-machine\";\n canOfferDisplay?: boolean;\n requestsScreenControl?: boolean;\n};\n\n/** POST /v1/enrollments/token/exchange response (wraps the credential shape). */\nexport type EnrollTokenExchangeResponse = {\n credentials: EnrollmentCredentials;\n};\n\nexport type ModelConnectionAccessPolicy = {\n allowedModels: string[] | null;\n /**\n * The shared workspaces that may use the account; null for every shared\n * workspace, including new ones. A workspace's own account always keeps\n * serving its workspace. On a workspace's own route this is the list of\n * workspaces it serves, and only workspaces the caller also administers\n * can be added.\n */\n allowedWorkspaces: string[] | null;\n allowPersonalWorkspaces: boolean;\n /**\n * The chosen people (organization membership ids), or null when the account\n * is not limited to people. Requires `allowedWorkspaces: []` and\n * `allowPersonalWorkspaces: false`.\n */\n allowedPeople?: string[] | null;\n /** Explicit owner consent to share a personal subscription with the organization. */\n sharePersonal?: true;\n /**\n * Explicit consent to make a workspace's own account the organization's, so\n * that workspace's admins no longer manage it. Required on the organization\n * route before it can serve every shared workspace, Personal workspaces or\n * chosen people.\n */\n moveToOrganization?: true;\n version: number;\n};\nexport type ModelConnectionAccessResponse = {\n policy: ModelConnectionAccessPolicy;\n models: Array<{ id: string; label: string }>;\n workspaces: Array<{ id: string; name: string }>;\n personalWorkspacesSupported: boolean;\n /** The account can be limited to chosen people. */\n peopleSupported?: boolean;\n /** Active members of the organization an administrator can choose. */\n people?: Array<{ id: string; name: string | null; email: string | null }>;\n /** Workspaces that use the account as their own; they always keep it for workspace choices. */\n localWorkspaceIds?: string[];\n /** The workspace whose administrators also manage the account, if any. */\n managedByWorkspaceId?: string | null;\n personalSharingSupported?: boolean;\n};\n\nexport type ConnectorToolPermission = \"allow\" | \"ask\" | \"block\";\nexport type ConnectorToolPermissionEntry = {\n name: string;\n title?: string | undefined;\n description?: string | undefined;\n group: \"read\" | \"write\" | \"other\";\n permission: ConnectorToolPermission;\n inherited: boolean;\n approvalRequired: boolean;\n source?: \"recommended\" | \"connector_default\" | \"tool\" | \"action\" | \"conflict\";\n conditional?: boolean;\n actionPermissions?: Array<{\n actionName: string;\n permission: ConnectorToolPermission;\n }>;\n};\nexport type ConnectorToolPermissionsResponse = {\n connectionId: string;\n serverId: string;\n defaultPermission: ConnectorToolPermission | null;\n tools: ConnectorToolPermissionEntry[];\n discoveryError: string | null;\n canManage: boolean;\n appliesTo?: \"next_attempt\";\n revision?: string;\n accountLabel?: string;\n instanceKey?: string;\n accounts?: Array<{\n connectionId: string;\n label: string;\n scope: \"personal\" | \"workspace\" | \"none\";\n instanceKey?: string;\n }>;\n};\nexport type UpdateConnectorToolPermissionsRequest = {\n connectionId: string;\n permission: ConnectorToolPermission | null;\n expectedRevision?: string;\n instanceKey?: string;\n} & (\n | { target: \"default\" }\n | { target: \"tools\"; toolNames: string[] }\n | { target: \"action\"; toolName: string; actionName: string }\n);\n\n/** Saved Allow/Ask/Block rules for a session MCP server the host attaches.\n * Tools without a rule follow `defaultPermission`, then the attaching session's\n * `requireApproval` recommendation (Ask), then Allow. */\nexport type SessionMcpToolPermissionsResponse = {\n connectionId: string;\n serverId: string;\n defaultPermission: ConnectorToolPermission | null;\n tools: Array<{ toolName: string; permission: ConnectorToolPermission }>;\n revision: string;\n canManage: boolean;\n appliesTo: \"next_attempt\";\n};\n/** `url` is the exact URL attached to sessions; `permission: null` resets. */\nexport type UpdateSessionMcpToolPermissionsRequest = {\n serverId: string;\n url: string;\n permission: ConnectorToolPermission | null;\n expectedRevision?: string;\n} & ({ target: \"default\" } | { target: \"tools\"; toolNames: string[] });\n\n/** Agent capability ids (see `@opengeni/contracts` agent-config). */\nexport type AgentCapabilityId =\n | \"webSearch\"\n | \"humanInput\"\n | \"skills\"\n | \"goals\"\n | \"subagents\"\n | \"knowledge\"\n | \"schedules\"\n | \"artifacts\"\n | \"browser\"\n | \"secrets\"\n | \"media\"\n | \"workspaceFiles\"\n | \"workspaceConnectors\"\n | \"workspaceAdmin\";\n\n/** `read` reads installed Skills; `manage` also changes them. */\nexport type AgentSkillsCapability = \"read\" | \"manage\" | false;\n\nexport type AgentCapabilityToggles = {\n webSearch?: boolean | undefined;\n humanInput?: boolean | undefined;\n skills?: AgentSkillsCapability | undefined;\n goals?: boolean | undefined;\n subagents?: boolean | undefined;\n knowledge?: boolean | undefined;\n schedules?: boolean | undefined;\n artifacts?: boolean | undefined;\n browser?: boolean | undefined;\n secrets?: boolean | undefined;\n media?: boolean | undefined;\n workspaceFiles?: boolean | undefined;\n workspaceConnectors?: boolean | undefined;\n workspaceAdmin?: boolean | undefined;\n};\n\n/**\n * `\"all\"`: everything this workspace offers (today's behavior). `\"none\"`: the\n * session's own tools plus essentials. An object starts from one and toggles.\n */\nexport type AgentCapabilities =\n | \"all\"\n | \"none\"\n | ({ from: \"all\" | \"none\" } & AgentCapabilityToggles);\n\nexport type AgentRenderer = \"opengeni\" | \"markdown\";\n\nexport type AgentConfigRequest = {\n capabilities?: AgentCapabilities | undefined;\n /** Replaces only Opengeni's identity lines (max 8,000 chars); null = default identity. */\n identity?: string | null | undefined;\n /** Alias of the session `instructions` field. */\n instructions?: string | undefined;\n renderer?: AgentRenderer | undefined;\n /** Vaults this session may use (input only); intersected with the parent's policy. */\n vaultPolicy?: VaultPolicy | undefined;\n};\n\n/** Which vaults a session or schedule may use (see `@opengeni/contracts` VaultPolicy). */\nexport type VaultPolicy = { mode: \"all\" } | { mode: \"selected\"; vaultIds: string[] };\n\nexport type WorkspaceAgentDefaults = {\n capabilities?: AgentCapabilities | undefined;\n identity?: string | null | undefined;\n renderer?: AgentRenderer | undefined;\n};\n\nexport type ResolvedAgentCapabilities = {\n webSearch: boolean;\n humanInput: boolean;\n skills: AgentSkillsCapability;\n goals: boolean;\n subagents: boolean;\n knowledge: boolean;\n schedules: boolean;\n artifacts: boolean;\n browser: boolean;\n secrets: boolean;\n media: boolean;\n workspaceFiles: boolean;\n workspaceConnectors: boolean;\n workspaceAdmin: boolean;\n};\n\nexport type ResolvedAgentConfig = {\n version: 1;\n from: \"all\" | \"none\";\n capabilities: ResolvedAgentCapabilities;\n /** Capabilities wanted on but not offered by this deployment. */\n unavailable: AgentCapabilityId[];\n /** Why each unavailable capability is off; present whenever `unavailable` is non-empty. */\n unavailableReasons?: Partial<Record<AgentCapabilityId, string>> | undefined;\n identity: string | null;\n renderer: AgentRenderer;\n source:\n | \"request\"\n | \"workspace_default\"\n | \"deployment_default\"\n | \"inherited\"\n | \"legacy_conversion\";\n};\n\nexport type AgentEffectiveTools = {\n capabilities: ResolvedAgentCapabilities;\n unavailable: AgentCapabilityId[];\n /** False until exact runtime media adapters (including credential identity) are resolved. */\n mediaToolsKnown?: boolean | undefined;\n tools: Array<{\n name: string;\n capability: AgentCapabilityId | \"runtime\" | \"sandbox\" | \"product\";\n source: \"first_party\" | \"runtime\" | \"hosted\" | \"sandbox\" | \"mcp\";\n visibility?: \"upfront\" | \"search\" | undefined;\n }>;\n mcpServers: Array<{\n id: string;\n capability: AgentCapabilityId | \"runtime\" | \"product\";\n toolsKnown: boolean;\n }>;\n};\n\n/**\n * `PUT .../sessions/:id/skills`. Replaces every Skill the session carries\n * itself; an empty list removes them all.\n */\nexport type UpdateSessionSkillsRequest = {\n skills: SessionSkillInput[];\n /** The session's current `toolPolicyVersion` (shared CAS). */\n expectedVersion: number;\n};\n\n/**\n * `POST .../sessions/:id/resources/remove`. Removes attached repositories from\n * the session and its child sessions. Access ends on the next Git or GitHub\n * call; the next turn removes the repository folders. Repositories that are\n * not attached are ignored.\n */\nexport type RemoveSessionResourcesRequest = {\n resources: Array<{ kind: \"repository\"; uri: string }>;\n};\n\n/** One repository removed from a session (`Session.removedRepositories`). */\nexport type SessionRemovedRepository = {\n id: string;\n resource: RepositoryResourceRef;\n removedAt: string;\n /** True until the next turn has removed the folder from the sandbox. */\n sandboxCleanupPending: boolean;\n};\n\n/** `PUT .../sessions/:id/agent`. Omitted agent fields keep their current values. */\nexport type UpdateSessionAgentRequest = {\n agent: AgentConfigRequest;\n /** The session's current `toolPolicyVersion` (shared CAS). */\n expectedVersion: number;\n};\n\nexport type ClientAgentConfig = {\n /** @deprecated Agent configuration is always on; current servers always report `true`. */\n enabled: boolean;\n /** @deprecated Omitted `agent` always resolves `{ capabilities: \"all\" }`; always `true`. */\n defaultForNewSessions: boolean;\n capabilities: Array<{\n id: AgentCapabilityId;\n available: boolean;\n reason?: string | undefined;\n /** `region_restricted` when EU-only inference switched it off (\"Not supported in EU\"). */\n code?: FeatureUnavailableReason | undefined;\n }>;\n};\n\n/** `error.details.code` of a 422 agent-configuration failure. */\nexport type AgentConfigErrorCode =\n | \"agent_capability_unavailable\"\n | \"agent_config_conflict\"\n | \"agent_config_widening\"\n /** Returned only by older servers that predate always-on agent configuration. */\n | \"agent_config_not_enabled\";\nexport type {\n ToolActionReview,\n ToolReviewDetailsPage,\n ToolReviewStatus,\n} from \"@opengeni/contracts\";\n"],"mappings":";AA+zBO,IAAM,mCAAmC;AA8pDzC,IAAM,kDAAkD;AACxD,IAAM,0CACX;AA2MK,IAAM,sBAAsB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AAAA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AACF;AA6eO,IAAM,kCAAkC;AA4xBxC,IAAM,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AA6/CO,IAAM,iCAAiC;AACvC,IAAM,+BAA+B;AAErC,IAAM,8BAA8B;AAm8FpC,IAAM,qCAAqC,MAAM;AACjD,IAAM,iCAAiC,OAAO;AAC9C,IAAM,gCAAgC,KAAK,OAAO;AAClD,IAAM,4BAA4B,KAAK,OAAO;AAC9C,IAAM,4BAA4B,MAAM,OAAO;AAumD/C,IAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/types.ts"],"sourcesContent":["import type { WorkspaceTranscriptionPolicy } from \"./transcription\";\nimport type { SessionUsageLimit } from \"@opengeni/contracts/session-usage-limits\";\nexport type {\n SessionUsageLimit,\n SessionUsageLimitHistory,\n SessionUsageLimitReachedRefusal,\n SessionUsageLimitStatus,\n SetSessionUsageLimitRequest,\n} from \"@opengeni/contracts/session-usage-limits\";\nexport type {\n InsightsUsageRange,\n InsightsUsageGroupBy,\n InsightsUsagePayer,\n InsightsUsageSource,\n InsightsUsageTokens,\n InsightsUsageClassMicros,\n InsightsUsageMeasures,\n InsightsUsageScope,\n InsightsUsageGroup,\n InsightsUsageSeriesPoint,\n InsightsUsageFacets,\n InsightsUsageResponse,\n InsightsCall,\n InsightsCallsResponse,\n InsightsUsageWindowOptions,\n WorkspaceInsightsUsageOptions,\n OrganizationInsightsUsageOptions,\n WorkspaceInsightsCallsOptions,\n OrganizationInsightsCallsOptions,\n InsightsCallsScope,\n} from \"./insights-usage\";\nimport type {\n ClientModelResidencyV1,\n ScheduledTaskEvents,\n ScheduledTaskEventsInput,\n ScheduledTaskRunEventOccurrence,\n ScheduledTaskSkill,\n SessionAutomationWaitSummary,\n SessionAvatar,\n} from \"@opengeni/contracts\";\nexport type { SessionAvatar, SessionAvatarIcon } from \"@opengeni/contracts\";\nexport type { ScheduledTaskSkill } from \"@opengeni/contracts\";\nexport type {\n McpElicitationAnswer,\n McpElicitationApprovalRequest,\n McpElicitationContent,\n McpElicitationField,\n McpElicitationRequestedSchema,\n McpElicitationValue,\n} from \"@opengeni/contracts\";\nimport type { McpElicitationApprovalRequest, McpElicitationContent } from \"@opengeni/contracts\";\nexport type {\n ClaudeSubscriptionOAuthStartResponse,\n ClaudeSubscriptionOAuthCompleteRequest,\n ClaudeSubscriptionOAuthCompleteResponse,\n} from \"@opengeni/contracts\";\nexport type {\n SessionMessageSearchRequest,\n SessionMessageSearchMatch,\n SessionMessageSearchResponse,\n SessionMessagePreview,\n SessionMessagePreviewReference,\n} from \"./session-message-search\";\n\nexport type BundledSkillId =\n | \"builtin:opengeni-help\"\n | \"builtin:opengeni-client\"\n | \"builtin:visualize\"\n | \"builtin:document-parsing\"\n | \"builtin:skill-management\"\n | \"builtin:projects\"\n | \"builtin:schedules\"\n | \"builtin:event-triggers\"\n | \"builtin:documents\"\n | \"builtin:spreadsheets\"\n | \"builtin:presentations\"\n | \"builtin:sites\"\n | \"builtin:video-generation\"\n | \"builtin:secrets\"\n | LegacyBundledSkillId;\n/**\n * @deprecated Renamed to the neutral ids above; still accepted and resolved to them.\n */\nexport type LegacyBundledSkillId =\n | \"builtin:opengeni-visualize\"\n | \"builtin:opengeni-skills\"\n | \"builtin:opengeni-projects\"\n | \"builtin:opengeni-schedules\"\n | \"builtin:opengeni-documents\"\n | \"builtin:opengeni-spreadsheets\"\n | \"builtin:opengeni-presentations\"\n | \"builtin:opengeni-sites\"\n | \"builtin:opengeni-video-generation\"\n | \"builtin:opengeni-secrets\";\n\n// Hand-written mirrors of the public wire shapes in `@opengeni/contracts`.\n// Ordinary SDK entries stay framework-agnostic and do not import the contracts\n// runtime; `test/contract-parity.test.ts` pins these types to the contracts\n// package so drift fails the gate instead of shipping.\n\nexport type CodexRealtimeWebrtcVersion = \"v3\";\nexport type CodexRealtimeVoice =\n | \"juniper\"\n | \"maple\"\n | \"spruce\"\n | \"ember\"\n | \"vale\"\n | \"breeze\"\n | \"arbor\"\n | \"sol\"\n | \"cove\";\n\nexport type CodexRealtimeWebrtcRequest = {\n realtimeId: string;\n operationId: string;\n browserInstanceId: string;\n ownerKey: string;\n expectedVersion: number;\n expectedConnectionEpoch: number;\n rotate: boolean;\n browserActivation?: \"required\" | undefined;\n sdp: string;\n version: CodexRealtimeWebrtcVersion;\n instructions?: string | undefined;\n voice?: CodexRealtimeVoice | undefined;\n};\n\nexport type CodexRealtimeWebrtcResponse = {\n sdp: string;\n version: CodexRealtimeWebrtcVersion;\n model: \"gpt-live-1-boulder-alpha\" | \"opengeni-azure/gpt-live-1\";\n connectionId: string;\n connectionEpoch: number;\n startupFenceSequence: number;\n modeVersion: number;\n replay: boolean;\n};\n\nexport type SessionRealtimeWebsocketRequest = {\n realtimeId: string;\n operationId: string;\n browserInstanceId: string;\n ownerKey: string;\n expectedVersion: number;\n expectedConnectionEpoch: number;\n rotate: boolean;\n /**\n * BCP 47 tag of the language the person speaks, for example `nb-NO`.\n * Providers that need a fixed conversation language use it; the others\n * detect the spoken language themselves.\n */\n language?: string | undefined;\n /**\n * Voice settings for this connection. Each set field overrides the\n * workspace's saved settings for the model; `voiceSettings.language` also\n * overrides `language`.\n */\n voiceSettings?: RealtimeVoiceSettings | undefined;\n};\n/** @deprecated Use SessionRealtimeWebsocketRequest. */\nexport type GatewayRealtimeConnectRequest = SessionRealtimeWebsocketRequest;\n\nexport type SessionRealtimeWebsocketInitialItem = {\n role: \"user\" | \"developer\" | \"assistant\";\n text: string;\n};\n/** @deprecated Use SessionRealtimeWebsocketInitialItem. */\nexport type GatewayRealtimeInitialItem = SessionRealtimeWebsocketInitialItem;\n\n/**\n * Wire protocol of a realtime WebSocket provider: the OpenAI Realtime protocol\n * (also spoken by xAI and ElevenLabs) or the AI Gateway's normalized protocol.\n */\nexport type RealtimeWebsocketProtocol = \"openai\" | \"ai-gateway\";\n\nexport type SessionRealtimeWebsocketResponse = {\n protocol: RealtimeWebsocketProtocol;\n /** WebSocket subprotocols to open the socket with; one carries the client secret. */\n protocols: string[];\n /** First client event to send once the socket opens; null when the mint configured it. */\n sessionUpdate: Record<string, unknown> | null;\n token: string;\n url: string;\n upstreamModelId: string;\n expiresAt: number | null;\n connectionId: string;\n connectionEpoch: number;\n startupFenceSequence: number;\n modeVersion: number;\n /**\n * @deprecated Always empty: the prior conversation travels in the\n * provider's session instructions. Kept for clients of earlier releases.\n */\n initialItems: SessionRealtimeWebsocketInitialItem[];\n instructions: string;\n /**\n * Assistant transcripts carry inline delivery tags such as `[calm]`, which\n * are spoken as tone, not words; clients drop them from transcripts.\n */\n transcriptAudioTags?: boolean | undefined;\n replay: false;\n};\n/** @deprecated Use SessionRealtimeWebsocketResponse. */\nexport type GatewayRealtimeConnectResponse = SessionRealtimeWebsocketResponse;\n\nexport type ToolGatewayIdentity = {\n serverId: string;\n toolName: string;\n};\n\nexport type ToolGatewayCatalogEntry = {\n identity: ToolGatewayIdentity;\n modelName: string;\n codemodePath: string[];\n title?: string | undefined;\n description?: string | undefined;\n inputSchema: Record<string, unknown>;\n outputSchema?: Record<string, unknown> | undefined;\n annotations?: Record<string, unknown> | undefined;\n icons?: Array<Record<string, unknown>> | undefined;\n source: \"opengeni\" | \"files\" | \"docs\" | \"mcp\" | \"codex_apps\" | \"interaction\";\n approval: \"none\" | \"human\" | \"policy\";\n};\n\nexport type ToolGatewayCatalog = {\n version: 1;\n accountId: string;\n workspaceId: string;\n generation: number;\n digest: string;\n createdAt: string;\n entries: ToolGatewayCatalogEntry[];\n};\n\nexport type ToolGatewayResult = {\n content: Array<{ type: string; [key: string]: unknown }>;\n structuredContent?: Record<string, unknown> | undefined;\n isError?: boolean | undefined;\n _meta?: Record<string, unknown> | undefined;\n [key: string]: unknown;\n};\n\nexport type ToolGatewayCallRequest = {\n operationId?: string | undefined;\n catalogDigest: string;\n identity: ToolGatewayIdentity;\n arguments: Record<string, unknown>;\n siteArtifactId?: string | undefined;\n siteVersionId?: string | undefined;\n approvalToken?: string | undefined;\n};\n\nexport type ToolGatewayApprovalRequest = {\n operationId: string;\n catalogDigest: string;\n identity: ToolGatewayIdentity;\n arguments: Record<string, unknown>;\n};\n\nexport type ToolGatewayApprovalResponse = {\n operationId: string;\n catalogDigest: string;\n identity: ToolGatewayIdentity;\n approvalToken: string;\n expiresAt: string;\n};\n\nexport type ToolGatewayCallResponse = {\n operationId: string;\n catalogDigest: string;\n result: ToolGatewayResult;\n};\n\nexport type ToolGatewayTarget = { identity: ToolGatewayIdentity } | { path: string[] };\nexport type ToolGatewayResolvedTool = {\n version: 1;\n definitionDigest: string;\n entry: ToolGatewayCatalogEntry;\n};\nexport type ToolGatewayResolveRequest = {\n target: ToolGatewayTarget;\n siteArtifactId?: string;\n siteVersionId?: string;\n};\nexport type ToolGatewayInvokeRequest = ToolGatewayResolveRequest & {\n operationId: string;\n arguments: Record<string, unknown>;\n expectedDefinitionDigest?: string;\n approvalToken?: string;\n};\nexport type ToolGatewayInvokeResponse = {\n operationId: string;\n tool: ToolGatewayResolvedTool;\n result: ToolGatewayResult;\n};\nexport type ToolGatewayTargetApprovalRequest = {\n identity: ToolGatewayIdentity;\n operationId: string;\n arguments: Record<string, unknown>;\n expectedDefinitionDigest: string;\n /** \"Always allow for this Site\" (this person, this Site, this tool and connection). Site context only. */\n rememberForSite?: boolean;\n siteArtifactId?: string;\n siteVersionId?: string;\n};\nexport type ToolGatewayTargetApprovalResponse = {\n bindingVersion: 2;\n operationId: string;\n tool: ToolGatewayResolvedTool;\n approvalToken: string;\n expiresAt: string;\n};\n/** The viewer's own accounts for a Site's declared tool (host code only). */\nexport type ToolGatewaySiteConsentRequest = {\n identity: ToolGatewayIdentity;\n siteArtifactId: string;\n siteVersionId: string;\n /** The exact arguments, to review what the call would do on the selected account. */\n arguments?: Record<string, unknown>;\n};\nexport type ToolGatewaySiteConsentAccount = {\n identity: ToolGatewayIdentity;\n connector: string;\n account: string;\n};\n/** The provider's own reading of the call (for Gmail, the message as it would be sent). */\nexport type ToolGatewaySiteConsentReview = {\n kind: \"generic\" | \"gmail\";\n email?: {\n from: string;\n to: string;\n cc: string;\n bcc: string;\n subject: string;\n attachments: number;\n };\n};\nexport type ToolGatewaySiteConsentResponse = {\n version: 1;\n accounts: ToolGatewaySiteConsentAccount[];\n selected: ToolGatewayIdentity | null;\n review: ToolGatewaySiteConsentReview | null;\n connect: { capabilityId: string | null; name: string; providerDomain: string } | null;\n};\nexport type ToolGatewayManifestRequest = {\n identities: ToolGatewayIdentity[];\n siteArtifactId?: string;\n siteVersionId?: string;\n};\nexport type ToolGatewayManifestResponse = {\n version: 1;\n digest: string;\n tools: ToolGatewayResolvedTool[];\n};\n\nexport type ToolGatewayDeclarationsResponse = {\n catalogDigest: string;\n moduleSpecifier: string;\n source: string;\n};\n\nexport type ActivateCodexRealtimeConnectionRequest = {\n operationId: string;\n browserInstanceId: string;\n ownerKey: string;\n connectionEpoch: number;\n expectedVersion: number;\n expectedConnectionEpoch: number;\n};\n\nexport type SessionRealtimeLedgerDirection = \"provider_in\" | \"provider_out\";\nexport type SessionRealtimeLedgerKind =\n | \"user_transcript\"\n | \"assistant_transcript\"\n | \"delegation_call\"\n | \"delegation_progress\"\n | \"delegation_result\"\n | \"interruption\"\n | \"session_update\"\n | \"error\";\n\nexport type SessionRealtimeLedgerEntry = {\n id: string;\n realtimeId: string;\n operationId: string;\n connectionEpoch: number;\n sequence: number;\n direction: SessionRealtimeLedgerDirection;\n kind: SessionRealtimeLedgerKind;\n role: \"user\" | \"assistant\" | null;\n providerEventId: string | null;\n delegationItemId: string | null;\n sourceUpdateId: string | null;\n historyItemId: string | null;\n turnId: string | null;\n text: string | null;\n payload: Record<string, unknown>;\n clientAckedAt: string | null;\n providerAckedAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type SessionRealtimeInboundEntry = {\n operationId: string;\n kind: Exclude<\n SessionRealtimeLedgerKind,\n \"delegation_progress\" | \"delegation_result\" | \"session_update\"\n >;\n role?: \"user\" | \"assistant\" | null | undefined;\n providerEventId?: string | null | undefined;\n delegationItemId?: string | null | undefined;\n text?: string | null | undefined;\n payload?: Record<string, unknown> | undefined;\n /** Model-visible application context attached to this exact realtime message. */\n modelContext?: string | undefined;\n};\n\nexport type SyncSessionRealtimeLedgerRequest = {\n browserInstanceId: string;\n ownerKey: string;\n expectedVersion: number;\n connectionId: string;\n connectionEpoch: number;\n entries?: SessionRealtimeInboundEntry[] | undefined;\n clientAckThroughSequence?: number | null | undefined;\n providerAckSequences?: number[] | undefined;\n providerStarted?:\n | { providerSessionId: string; providerEventId?: string | null | undefined }\n | undefined;\n};\n\nexport type SyncSessionRealtimeLedgerResponse = {\n accepted: Array<{ entry: SessionRealtimeLedgerEntry; replay: boolean }>;\n outbound: SessionRealtimeLedgerEntry[];\n};\n\nexport type SessionRealtimeModel =\n | \"opengeni-azure/gpt-live-1\"\n | \"gpt-live-1-boulder-alpha\"\n | \"supergrok/grok-voice-think-fast-2.0\"\n | \"opengeni-gateway/openai/gpt-realtime-2.1\"\n | \"opengeni-gateway/openai/gpt-realtime-mini\"\n | \"opengeni-gateway/xai/grok-voice-think-fast-2.0\"\n | \"workspace-gateway/openai/gpt-realtime-2.1\"\n | \"workspace-gateway/openai/gpt-realtime-mini\"\n | \"workspace-gateway/xai/grok-voice-think-fast-2.0\"\n | \"workspace-elevenlabs/eleven_realtime_v1_max\"\n | \"workspace-elevenlabs/eleven_realtime_v1_mini\";\n\nexport type WorkspaceRealtimeModelCatalogItem = {\n id: SessionRealtimeModel;\n label: string;\n provider:\n | \"OpenGeni\"\n | \"Connected Codex\"\n | \"Connected SuperGrok\"\n | \"Your Gateway\"\n | \"Your ElevenLabs\";\n description: string;\n available: boolean;\n unavailableReason: string | null;\n /** Machine-readable reason when unavailable, e.g. `insufficient_credits`. */\n unavailableCode?: string | null | undefined;\n recommended: boolean;\n /**\n * Languages a conversation with this model can be set to, as the provider's\n * language codes. Absent when the model detects the spoken language itself.\n */\n languages?: string[] | undefined;\n /** Voices this model can speak with. Absent when the voice cannot be chosen. */\n voices?: { id: string; label: string }[] | undefined;\n /** Whether any provider voice id is accepted as `voice`, beyond the listed `voices`. */\n customVoice?: boolean | undefined;\n /** Turn eagerness values this model accepts. Absent when it cannot be chosen. */\n turnEagerness?: RealtimeTurnEagerness[] | undefined;\n /** The provider's defaults for the settings it offers, other than language. */\n voiceDefaults?: RealtimeVoiceSettings | undefined;\n /** The workspace's saved voice settings for this model. */\n workspaceVoiceSettings?: RealtimeVoiceSettings | undefined;\n /** The organization's default voice settings for this model, used while the workspace has none. */\n organizationVoiceSettings?: RealtimeVoiceSettings | undefined;\n /** True on the model this workspace chose to start voice conversations with. */\n workspaceDefault?: boolean | undefined;\n /** True on the model the organization chose to start voice conversations with; a workspace's own choice wins. */\n organizationDefault?: boolean | undefined;\n};\n\n/** How readily a realtime voice model decides the speaker is done and answers. */\nexport type RealtimeTurnEagerness = \"low\" | \"medium\" | \"high\";\n\n/**\n * Voice settings for a realtime voice model. Unset fields keep the provider's\n * default. A model offers only the settings its catalog entry lists\n * (`voices`/`customVoice`, `languages`, `turnEagerness`); a value it does not\n * offer is ignored rather than failing the call.\n */\nexport type RealtimeVoiceSettings = {\n /** A listed voice id, or any provider voice id where `customVoice` is offered. */\n voice?: string | undefined;\n /** Conversation language (a catalog `languages` code or a BCP 47 tag), for models that need one. */\n language?: string | undefined;\n turnEagerness?: RealtimeTurnEagerness | undefined;\n};\n\nexport type WorkspaceRealtimeModelCatalogResponse = {\n models: WorkspaceRealtimeModelCatalogItem[];\n};\nexport type SessionRealtimeState = \"active\" | \"ended\";\nexport type SessionRealtimeEndReason =\n | \"user_stop\"\n | \"browser_unload\"\n | \"lease_expired\"\n | \"authority_revoked\";\n\nexport type SessionRealtimeMode = {\n id: string;\n sessionId: string;\n operationId: string;\n browserInstanceId: string;\n model: SessionRealtimeModel;\n state: SessionRealtimeState;\n version: number;\n connectionEpoch: number;\n leaseExpiresAt: string;\n lastHeartbeatAt: string;\n startedAt: string;\n endedAt: string | null;\n endReason: SessionRealtimeEndReason | null;\n};\n\nexport type BeginSessionRealtimeRequest = {\n operationId: string;\n browserInstanceId: string;\n ownerKey: string;\n model: SessionRealtimeModel;\n};\n\nexport type RenewSessionRealtimeRequest = {\n browserInstanceId: string;\n ownerKey: string;\n expectedVersion: number;\n};\n\nexport type EndSessionRealtimeRequest = RenewSessionRealtimeRequest & {\n reason: Extract<SessionRealtimeEndReason, \"user_stop\" | \"browser_unload\">;\n};\n\n/** Server instruction to end a live call now (for example, out of credits). */\nexport type SessionRealtimeStopInstruction = {\n code: string;\n message: string;\n};\n\nexport type SessionRealtimeMutationResponse = {\n mode: SessionRealtimeMode;\n replay: boolean;\n /** Present on a heartbeat when the server stopped extending the lease. */\n stop?: SessionRealtimeStopInstruction | undefined;\n};\n\nexport type SessionStatus =\n | \"queued\"\n | \"running\"\n | \"idle\"\n | \"requires_action\"\n | \"recovering\"\n | \"waiting_capacity\"\n | \"failed\"\n | \"cancelled\";\n\n// Mirror of `@opengeni/contracts` SandboxBackend (13 values; every member is\n// additive at the end). 3-way enum parity is pinned by\n// `test/contract-parity.test.ts`.\nexport type SandboxBackend =\n | \"docker\"\n | \"modal\"\n | \"local\"\n | \"none\"\n | \"daytona\"\n | \"runloop\"\n | \"e2b\"\n | \"blaxel\"\n | \"cloudflare\"\n | \"vercel\"\n | \"selfhosted\"\n | \"opensandbox\"\n | \"compute\";\n\n// Mirror of `@opengeni/contracts` SandboxOs. Only \"linux\" is reachable in v1.\nexport type SandboxOs = \"linux\" | \"macos\" | \"windows\";\n\n// Mirror of `@opengeni/contracts` SandboxCapabilityName.\nexport type SandboxCapabilityName =\n | \"FileSystem\"\n | \"Terminal\"\n | \"Git\"\n | \"DesktopStream\"\n | \"Recording\";\n\n// Mirror of `@opengeni/contracts` CapabilityUnavailableReason.\nexport type CapabilityUnavailableReason =\n | \"backend_unsupported\"\n | \"os_unsupported\"\n | \"not_provisioned\"\n | \"disabled_by_policy\"\n | \"lease_cold\"\n | \"tier_headless\"\n // selfhosted (bring-your-own-compute) negotiation states:\n | \"agent_offline\"\n | \"agent_reconnecting\"\n | \"consent_required\"\n | \"display_unavailable\";\n\n// Mirror of `@opengeni/contracts` SessionCapabilities (the negotiated handshake\n// document). The descriptor table itself is NOT mirrored — it lives in\n// contracts (P0.1) and is consumed by the SDK config in a later PR.\nexport type SessionCapabilities = {\n sessionId: string;\n backend: SandboxBackend;\n os: SandboxOs;\n liveness: \"cold\" | \"warming\" | \"warm\" | \"draining\";\n leaseEpoch: number;\n workspaceGeneration: number | null;\n archiveGeneration: number | null;\n archiveComplete: boolean;\n viewerHeartbeatIntervalMs: number;\n FileSystem: {\n available: boolean;\n readOnly: boolean;\n root: string;\n pathSep: \"/\" | \"\\\\\";\n treeMode: \"lazy\" | \"snapshot\";\n reason: CapabilityUnavailableReason | null;\n };\n Terminal: {\n transport: \"sse-events\" | \"pty-ws\" | \"relay-pty\" | null;\n ptyCapable: boolean;\n shell: string;\n url: string | null;\n token: string | null;\n expiresAt: string | null;\n reason: CapabilityUnavailableReason | null;\n };\n Git: {\n available: boolean;\n repos: string[];\n reason: CapabilityUnavailableReason | null;\n };\n DesktopStream: {\n // \"relay-frames\" + \"frames\": the selfhosted framebuffer stream — PNG-per-frame\n // protobuf datagrams over the relay, painted by a canvas client (NOT RFB).\n transport: \"vnc-ws\" | \"rdp-ws\" | \"webrtc\" | \"relay-frames\" | null;\n client: \"novnc\" | \"web-rdp\" | \"frames\" | null;\n mode: \"read-only\" | \"interactive\";\n url: string | null;\n token: string | null;\n expiresAt: string | null;\n resolution: [number, number];\n unredacted: boolean;\n requiresAcknowledgment: boolean;\n acknowledged: boolean;\n // Shared-exposure disclosure (addendum E.1): `shared` when the group has >1\n // session; `sharedSessionIds` lists the OTHER sessions' ids ONLY (never their\n // conversation/metadata).\n shared: boolean;\n sharedSessionIds: string[];\n reason: CapabilityUnavailableReason | null;\n };\n Recording: {\n available: boolean;\n modes: (\"manual\" | \"on-turn\" | \"on-verify\")[];\n codecs: (\"h264-mp4\" | \"vp9-webm\")[];\n reason: CapabilityUnavailableReason | null;\n };\n /** @deprecated Use the managed ComputerSession interaction tools. */\n ComputerUse: {\n available: boolean;\n readOnly: boolean;\n reason: CapabilityUnavailableReason | null;\n };\n negotiatedAt: string;\n};\n\n// Convenience aliases for the per-surface cells of `SessionCapabilities`, so the\n// client hooks/components can take a single cell without restating the inline\n// shape. These are exact structural views of the cells above.\nexport type FileSystemCapability = SessionCapabilities[\"FileSystem\"];\nexport type TerminalCapability = SessionCapabilities[\"Terminal\"];\nexport type GitCapability = SessionCapabilities[\"Git\"];\nexport type DesktopStreamCapability = SessionCapabilities[\"DesktopStream\"];\nexport type RecordingCapability = SessionCapabilities[\"Recording\"];\n/** @deprecated Use the managed ComputerSession interaction tools. */\nexport type ComputerUseCapability = SessionCapabilities[\"ComputerUse\"];\n\n// ── Stream-surfacing client surface (Phase 5) ───────────────────────────────\n// Mirrors of the contracts viewer-attach / acknowledge / heartbeat shapes that\n// the capability-gated client (`@opengeni/react`) drives. The desktop pixel\n// plane rides Channel B (direct-to-provider noVNC); the structured terminal/\n// files/git surfaces ride Channel A (the existing event spine + the synchronous\n// fs/git/terminal point queries above). These are TYPES only, so ordinary SDK\n// entries do not reach the contracts runtime; the contract-parity test pins them.\n\n// Mirror of `@opengeni/contracts` StreamUrlRotatedPayload — the Channel-A event\n// the client folds in to hot-swap its noVNC socket on a box rollover, fenced on\n// leaseEpoch.\nexport type StreamUrlRotatedPayload = {\n url: string;\n token: string | null;\n expiresAt: string | null;\n leaseEpoch: number;\n transport: \"vnc-ws\";\n viewerId: string | null;\n};\nexport type StreamOpenedPayload = {\n viewerId: string;\n shared: boolean;\n viewerCount: number;\n};\nexport type StreamClosedPayload = {\n viewerId: string;\n reason: \"client-disconnect\" | \"reaped\" | \"revoked\" | \"box-rollover\";\n viewerCount: number;\n};\nexport type StreamRevokedPayload = {\n viewerId: string | null;\n reason: \"grant-revoked\" | \"session-failed\" | \"admin\";\n};\n\n// Mirror of `@opengeni/contracts` AttachViewerRequest. Omitting `viewerId` mints\n// a fresh holder id (returned on the response, carried through heartbeat/detach).\n// Plane flags are exact: credentials are minted only for the requested live\n// surfaces and each surface enforces its own permission. An omitted plane set is\n// retained as the legacy terminal-only request; current clients send all flags.\nexport type AttachViewerRequest = {\n viewerId?: string | undefined;\n desktop?: boolean | undefined;\n terminal?: boolean | undefined;\n files?: boolean | undefined;\n};\n\n// Mirror of `@opengeni/contracts` ViewerHolder + the P4.2 desktop-stream fields\n// the POST /viewers handler folds in when the pixel plane is minted in-process.\nexport type ViewerHolder = {\n viewerId: string;\n sandboxGroupId: string;\n liveness: \"cold\" | \"warming\" | \"warm\" | \"draining\";\n leaseEpoch: number;\n workspaceGeneration: number | null;\n archiveGeneration: number | null;\n archiveComplete: boolean;\n viewerHeartbeatIntervalMs: number;\n dataPlaneUrl: string | null;\n};\nexport type AttachViewerResponse = ViewerHolder & {\n // The scoped desktop-stream address minted for THIS holder (P4.2). Null when\n // the deployment is headless / desktop is disabled / the mint degraded —\n // the client then falls back to the Channel-A surfaces only.\n streamToken: string | null;\n streamExpiresAt: string | null;\n resolution: [number, number] | null;\n transport: \"vnc-ws\" | \"relay-frames\" | null;\n client: \"novnc\" | \"frames\" | null;\n // The scoped ttyd PTY-over-websocket address minted for THIS holder — the REAL\n // interactive terminal, symmetric with the desktop pixel plane (same Modal\n // tunnel, same scoped stream token). Populated on a warm box; null when the\n // terminal mint degraded (headless / no secret / tunnel failure), in which case\n // the client falls back to the Channel-A read-only command-output firehose.\n // `terminalTransport` is \"pty-ws\" iff a live `terminalUrl` was minted.\n terminalUrl: string | null;\n terminalToken: string | null;\n terminalExpiresAt: string | null;\n terminalTransport: \"pty-ws\" | \"relay-pty\" | null;\n};\n\n// Mirror of `@opengeni/contracts` AcknowledgeStreamRequest/Response — the\n// un-redacted-pixel + shared-exposure consent gate (P3.2).\nexport type AcknowledgeStreamRequest = {\n acknowledgeUnredacted?: boolean | undefined;\n acknowledgeShared?: boolean | undefined;\n};\nexport type AcknowledgeStreamResponse = {\n acknowledged: boolean;\n acknowledgedShared: boolean;\n};\n\n// Mirror of `@opengeni/contracts` ViewerHeartbeatRequest/Response — the\n// Channel-A viewer-liveness ping, epoch-fenced (a stale-epoch beat → alive:false\n// → the client re-attaches).\nexport type ViewerHeartbeatRequest = { leaseEpoch: number };\nexport type ViewerHeartbeatResponse = { alive: boolean };\n\nexport type ReasoningEffort = \"none\" | \"minimal\" | \"low\" | \"medium\" | \"high\" | \"xhigh\" | \"max\";\nexport type LatencyMode = \"standard\" | \"priority\" | \"fast\" | \"ultrafast\";\nexport type GitCredentialProvider = \"github\" | \"gitlab\" | \"azure_devops\";\nexport type GitCredentialBindingId = string;\nexport type GitRepositoryAccess = \"read\" | \"write\";\n\nexport type RepositoryResourceRef = {\n kind: \"repository\";\n uri: string;\n ref: string;\n /** Exact immutable commit that repository materialization must produce. */\n expectedCommitSha?: string | undefined;\n /**\n * Optional workspace-relative override. When omitted, Opengeni persists\n * `repos/<encoded-host>/<owner>/<repo>` so equal names on different Git\n * providers do not collide. Explicit paths are portable, traversal-free, and\n * collision-checked case-insensitively before sandbox execution.\n */\n mountPath?: string | undefined;\n subpath?: string | undefined;\n provider?: GitCredentialProvider | undefined;\n connectionType?: \"github_personal\" | undefined;\n credentialBindingId?: GitCredentialBindingId | undefined;\n access?: GitRepositoryAccess | undefined;\n repositoryId?: number | string | undefined;\n installationId?: number | string | undefined;\n projectId?: number | string | undefined;\n connectionId?: string | undefined;\n githubInstallationId?: number | undefined;\n githubRepositoryId?: number | undefined;\n /**\n * Best-effort materialization: a failed clone logs a warning and the\n * session continues without this repository instead of failing sandbox\n * setup. Omit it to keep a failed clone fatal.\n */\n optional?: boolean | undefined;\n};\n\n/** Value mirror of `@opengeni/contracts`; parity-tested without importing it from ordinary SDK entries. */\nexport const DEFAULT_FILE_RESOURCE_MOUNT_ROOT = \".opengeni/files\" as const;\n\nexport type FileResourceRef = {\n kind: \"file\";\n fileId: string;\n /** Optional workspace-relative override; defaults to `.opengeni/files/<file-id>`. */\n mountPath?: string | undefined;\n};\n\nexport type ResourceRef = RepositoryResourceRef | FileResourceRef;\n\nexport type ToolRef = {\n kind: \"mcp\";\n id: string;\n /** Narrow this connection's authorized tool names; an empty list allows none. */\n allowedTools?: string[] | undefined;\n /** Skip this server when its connect/tools-list fails instead of failing the turn. */\n optional?: boolean | undefined;\n /**\n * Put tool schemas on the first model request instead of behind `tool_search`\n * progressive discovery: `true` for every tool of this server, or the exact\n * unprefixed names of its everyday tools (its other tools stay searchable).\n * A startup choice only; grants nothing, and names the server does not\n * authorize are ignored.\n */\n eager?: boolean | string[] | undefined;\n};\n\nexport type SessionToolPolicy = {\n mode: \"workspace_default\" | \"explicit\" | \"inherited\";\n inheritedFromSessionId: string | null;\n excludedMcpServerIds?: string[] | undefined;\n};\n\nexport type UpdateSessionToolPolicyRequest =\n | {\n mode: \"workspace_default\";\n excludedMcpServerIds?: string[] | undefined;\n expectedVersion: number;\n }\n | {\n mode: \"explicit\";\n tools: ToolRef[];\n firstPartyMcpTools: FirstPartyMcpToolName[];\n expectedVersion: number;\n };\n\n/**\n * The person finished setup from a capability card the agent posted in this\n * chat. The server wakes the agent once per card so it continues the request\n * that needed the capability. Name the capability from an agent's\n * recommendation card, or the connected account from that account's own card\n * (for example after allowing more access); the account continues only once\n * it is active and holds the access the card asked for.\n */\nexport type ContinueAfterCapabilitySetupRequest =\n | { capabilityId: string }\n | { connectionId: string };\n\n/** Why no continuation was sent. Each is a normal outcome, not an error. */\nexport type CapabilitySetupContinuationSkipReason =\n | \"no_card\"\n | \"later_message\"\n | \"not_ready\"\n | \"not_applicable\"\n | \"not_requester\"\n | \"session_closed\";\n\nexport type ContinueAfterCapabilitySetupResponse =\n | { outcome: \"queued\" | \"already_queued\"; updateId: string }\n | { outcome: \"not_needed\"; reason: CapabilitySetupContinuationSkipReason };\n\nexport type SessionEffectiveToolPolicy = {\n mode: SessionToolPolicy[\"mode\"];\n inheritedFromSessionId: string | null;\n selectedIds: string[];\n effectiveIds: string[];\n mandatoryIds: string[];\n lazyRouter: {\n state: \"required\" | \"disabled\";\n deferredIds: string[];\n };\n configuredIds: string[];\n droppedIds: string[];\n counts: {\n selected: number;\n effective: number;\n mandatory: number;\n deferred: number;\n configured: number;\n dropped: number;\n };\n idsTruncated: boolean;\n};\n\nexport type SessionGoalReportRequirement = { id: string; title: string };\nexport type SessionGoalReportDelivery = {\n requirementId: string;\n artifactId: string;\n inspectionReceiptId: string;\n};\n\nexport type GoalSpec = {\n text: string;\n successCriteria?: string | undefined;\n rootConstraints?: string[] | undefined;\n reportRequirements?: SessionGoalReportRequirement[] | undefined;\n maxAutoContinuations?: number | undefined;\n mutationPolicy?: SessionGoalMutationPolicy | undefined;\n};\n\nexport type SessionMcpServerInput = {\n id: string;\n name?: string | undefined;\n url: string;\n allowedTools?: string[] | undefined;\n /**\n * Tools the agent has from the first model request: `true` for every tool,\n * or exact unprefixed tool names (the rest stay searchable). Same as listing\n * this server in `tools` with `eager`, without turning an omitted `tools`\n * list into an explicit allow-list.\n */\n eager?: boolean | string[] | undefined;\n timeoutMs?: number | undefined;\n cacheToolsList?: boolean | undefined;\n /** Require human approval for every tool, or only the listed unprefixed tool names. */\n requireApproval?: boolean | string[] | undefined;\n headers?: Record<string, string> | undefined;\n connectionRef?: McpServerConnectionRef | undefined;\n};\n\nexport type SessionMcpCredentialUpdateInput = {\n id: string;\n headers: Record<string, string>;\n};\n\nexport type RotateSessionMcpCredentialsRequest = {\n operationKey: string;\n updates: Array<\n {\n id: string;\n expectedCredentialVersion: number;\n expectedServerUrl: string;\n } & (\n | { headers: Record<string, string> }\n | {\n nativeConnectionId: string;\n replacementServerUrl?: string | undefined;\n }\n )\n >;\n};\n\nexport type RotateSessionMcpCredentialsReceipt = {\n operationKey: string;\n sessionId: string;\n servers: Array<{ id: string; credentialVersion: number }>;\n appliedAt: string;\n};\n\nexport type SessionMcpApprovalPolicy = boolean | string[];\n\nexport type SessionMcpServerMetadata = {\n id: string;\n name: string | null;\n url: string;\n headerNames: string[];\n credentialVersion: number;\n requireApproval: SessionMcpApprovalPolicy;\n connectionRef: McpServerConnectionRef | null;\n};\n\nexport type UpdateSessionMcpApprovalPolicyRequest = {\n requireApproval: SessionMcpApprovalPolicy;\n};\n\nexport type UpdateSessionMcpApprovalPolicyResponse = {\n server: SessionMcpApprovalPolicyTarget;\n effectiveFrom: \"next_attempt\";\n};\n\nexport type SessionMcpApprovalPolicyTarget =\n | SessionMcpServerMetadata\n | {\n id: string;\n source: \"workspace\";\n requireApproval: SessionMcpApprovalPolicy;\n };\n\nexport type ConnectionKind = \"oauth2\" | \"api_key\" | \"app_install\" | \"delegated\";\nexport type ConnectionStatus = \"active\" | \"needs_reauth\" | \"revoked\" | \"error\";\n\nexport type UserResourceDelegation = {\n authorityId: string;\n grantId: string;\n organizationId: string;\n workspaceId: string;\n sessionId: string | null;\n action: string;\n mode: \"once\" | \"session\" | \"always\";\n context: \"user_private\" | \"workspace_shared\";\n authorityEpoch: number | null;\n authorityGeneration: number;\n grantGeneration: number;\n resourceVersionId?: string | null | undefined;\n};\n\nexport type McpConnectionAccountSelection = {\n serverId: string;\n connectionId: string;\n};\n\nexport type McpServerConnectionRef = {\n connectionId?: string | undefined;\n accountSelection?: \"all_eligible\" | undefined;\n authoritySource?: \"host\" | undefined;\n /** accepted_turn is configuration-only; each accepted owner must select a grant. */\n hostBinding?:\n | { bindingId: string; generation: number }\n | { selection: \"accepted_turn\" }\n | undefined;\n provider?: string | undefined;\n providerDomain: string;\n kind?: ConnectionKind | undefined;\n scopes?: string[] | undefined;\n resource?: string | undefined;\n selectedResources?:\n | Array<{\n id: string;\n kind: \"repository\";\n }>\n | undefined;\n subjectScope?: \"workspace\" | \"subject\" | undefined;\n};\n\nexport type McpPersonalConnectionDelegation = {\n serverId: string;\n connectionId: string;\n ownerSubjectId: string;\n providerDomain: string;\n kind?: ConnectionKind | undefined;\n};\n\nexport type McpPersonalConnectionSummary = Pick<\n McpPersonalConnectionDelegation,\n \"serverId\" | \"providerDomain\"\n>;\n\nexport type ConnectionMetadata = {\n id: string;\n authorityId?: string | undefined;\n accountId: string;\n workspaceId: string;\n subjectId: string | null;\n providerDomain: string;\n kind: ConnectionKind;\n status: ConnectionStatus;\n grantedScopes: string[];\n expiresAt: string | null;\n lastRefreshAt: string | null;\n lastUsedAt: string | null;\n lastError: string | null;\n version: number;\n verifiedInstallAt?: string | null;\n verifiedInstallVersion?: number | null;\n metadata: Record<string, unknown>;\n /**\n * Whether this OAuth MCP account can be told apart from another account of\n * the same service: `verified` (its account is known), `reconnect` (sign in\n * again once before adding another), or `single` (the service doesn't say\n * which account it is, so each person can connect one). Absent for other\n * connections and from older servers.\n */\n accountIdentity?: \"verified\" | \"reconnect\" | \"single\" | undefined;\n createdBySubjectId: string | null;\n updatedBySubjectId: string | null;\n createdAt: string;\n updatedAt: string;\n /**\n * Your own login only: whether it works for your messages in the workspace\n * this list was read from. It does in your Personal workspace and in each\n * shared workspace where it is turned on; it starts on where it was added.\n */\n turnedOnHere?: boolean | undefined;\n /**\n * The standing grant that turns your own login on here; revoke it with\n * `revokeUserResourceGrant` to stop using the login here. Null in your\n * Personal workspace, which needs none.\n */\n turnedOnHereGrantId?: string | null | undefined;\n};\n\n/** Where a brokered credential is written on each outbound provider request. */\nexport type ConnectionCredentialPlacement = {\n carrier: \"header\" | \"query\" | \"cookie\";\n name: string;\n value: string;\n /** Prepended to `value`, for example `\"Bearer \"` or `\"Token \"`. */\n prefix?: string | undefined;\n};\n\n/**\n * Write-only secret for a brokered `api_key` Connection (API Integrations and\n * MCP servers). The broker never infers a location: use exact `headers`, or\n * `placements` when the provider expects a query parameter or cookie (API\n * Integrations only) or a prefixed value. Match the carrier/name reported by\n * `previewApiIntegration().auth`. A bare `{ apiKey }` is rejected with 422.\n *\n * @example { headers: { Authorization: \"Token abc123\" } }\n * @example { placements: [{ carrier: \"header\", name: \"X-Api-Key\", value: \"abc123\" }] }\n */\nexport type ApiKeyConnectionCredential =\n | { headers: Record<string, string>; placements?: never }\n | { placements: ConnectionCredentialPlacement[]; headers?: never };\n\ntype CreateConnectionRequestBase = {\n providerDomain: string;\n ownership?: ConnectionOwnership | undefined;\n /** @deprecated use ownership */\n subjectId?: string | null | undefined;\n grantedScopes?: string[] | undefined;\n expiresAt?: string | null | undefined;\n operationId?: string | undefined;\n /** Direct OpenAI/Azure keys only: verify the provider/model before saving. */\n verifyModelAccess?: boolean | undefined;\n};\n\nexport type CreateConnectionRequest = CreateConnectionRequestBase &\n (\n | {\n kind: \"api_key\";\n credential: ApiKeyConnectionCredential;\n metadata?: Record<string, unknown> | undefined;\n }\n | {\n /**\n * Workspace model-provider key lane (Vercel AI Gateway / OpenRouter),\n * selected by `metadata.credentialRole`; not usable by integrations.\n */\n kind: \"api_key\";\n credential: { apiKey: string };\n metadata: { credentialRole: string } & Record<string, unknown>;\n }\n | {\n kind: Exclude<ConnectionKind, \"api_key\">;\n credential: Record<string, unknown>;\n metadata?: Record<string, unknown> | undefined;\n }\n );\n\nexport type PersonalGitHubConnectionMetadata = {\n credentialRole: \"opengeni_github_personal\";\n providerFamily: \"github\";\n providerPrincipalId: string;\n githubUserId: string;\n githubLogin: string;\n oauthEnvironment: string;\n oauthClientMarker: string;\n credentialBindingId: string;\n connectedAt: string;\n lastVerifiedAt: string;\n refreshTokenExpiresAt?: string | null | undefined;\n disconnectedAt?: string | null | undefined;\n [key: string]: unknown;\n};\n\nexport type PersonalGitHubOAuthStartRequest = {\n connectionId?: string | undefined;\n returnPath?: string | undefined;\n};\n\nexport type PersonalGitHubOAuthStartResponse = {\n authorizationUrl: string;\n expiresAt: string;\n};\n\nexport type PersonalGitHubConnectionStatusResponse = {\n enabled: boolean;\n connection: ConnectionMetadata | null;\n reviewUrl: string | null;\n};\n\nexport type PersonalGitHubDisconnectRequest = {\n expectedVersion: number;\n idempotencyKey: string;\n};\n\nexport type PersonalGitHubRepositoryAccess = \"read\" | \"write\";\n\nexport type PersonalGitHubRepositoryPermissions = {\n pull: boolean;\n push: boolean;\n admin: boolean;\n maintain: boolean;\n triage: boolean;\n};\n\nexport type PersonalGitHubRepository = {\n repositoryId: string;\n fullName: string;\n canonicalUrl: string;\n defaultBranch: string;\n visibility: \"public\" | \"private\" | \"internal\";\n private: boolean;\n archived: boolean;\n disabled: boolean;\n permissions: PersonalGitHubRepositoryPermissions;\n};\n\nexport type PersonalGitHubSelectedRepository = PersonalGitHubRepository & {\n selectedAccess: PersonalGitHubRepositoryAccess;\n selectionGeneration: number;\n selectedAt: string;\n lastVerifiedAt: string;\n};\n\nexport type PersonalGitHubRepositorySelectionState = {\n connectionAuthorityGeneration: number;\n credentialBindingId: string;\n providerPrincipalId: string;\n selectionGeneration: number;\n repositories: PersonalGitHubSelectedRepository[];\n};\n\nexport type PersonalGitHubRepositoryCatalogItem = PersonalGitHubRepository & {\n selectedAccess: PersonalGitHubRepositoryAccess | null;\n};\n\nexport type ListPersonalGitHubRepositoriesOptions = {\n cursor?: number | undefined;\n limit?: number | undefined;\n};\n\nexport type ListPersonalGitHubRepositoriesResponse = {\n repositories: PersonalGitHubRepositoryCatalogItem[];\n nextCursor: number | null;\n selection: PersonalGitHubRepositorySelectionState;\n};\n\nexport type PersonalGitHubRepositorySelectionInput = {\n repositoryId: string;\n fullName: string;\n access: PersonalGitHubRepositoryAccess;\n};\n\nexport type ReplacePersonalGitHubRepositorySelectionsRequest = {\n expectedConnectionAuthorityGeneration: number;\n expectedSelectionGeneration: number;\n idempotencyKey: string;\n repositories: PersonalGitHubRepositorySelectionInput[];\n};\n\nexport type VerifyPersonalGitHubRepositorySelectionsRequest = {\n expectedConnectionAuthorityGeneration: number;\n expectedSelectionGeneration: number;\n idempotencyKey: string;\n};\n\nexport type OpenGeniSlackBotInstallRequest = {\n /** Existing Opengeni Slack bot connection to reinstall in place. */\n connectionId?: string | undefined;\n};\n\nexport type AvailableOpenGeniSlackBots = {\n connections: ConnectionMetadata[];\n organizationSharedConnectionIds: string[];\n};\nexport type UpdateOpenGeniSlackBotOrganizationAccess = {\n enabled: boolean;\n workspaceIds?: string[] | null;\n};\nexport type OpenGeniSlackBotOrganizationAccess = {\n enabled: boolean;\n generation: number;\n workspaceIds?: string[] | null;\n};\n\nexport type FikenInstallRequest = {\n apiToken: string;\n defaultCompanySlug?: string | undefined;\n /** Existing Fiken connection to rewrite in place (reconnect). */\n connectionId?: string | undefined;\n};\n\nexport type FikenOAuthStartRequest = {\n returnPath?: string | undefined;\n /** Existing Fiken connection to re-authorize in place (reconnect). */\n connectionId?: string | undefined;\n};\n\nexport type FikenOAuthStartResponse = {\n authorizationUrl: string;\n expiresAt: string;\n};\n\nexport type OpenGeniSlackBotInstallStart = {\n authorizationUrl: string;\n expiresAt: string;\n};\n\nexport type SlackInstallationBindingState = \"active\" | \"quarantined\";\n\nexport type SlackInstallationBinding = {\n id: string;\n accountId: string;\n accountName: string;\n workspaceId: string;\n workspaceName: string;\n connectionId: string;\n connectionStatus: ConnectionStatus;\n connectionVersion: number;\n slackTeamId: string;\n slackTeamName: string;\n botId: string;\n botUserId: string;\n botDisplayName: \"Opengeni\" | \"Opengeni Staging\" | \"OpenGeni\" | \"OpenGeni Staging\";\n state: SlackInstallationBindingState;\n quarantineReason: string | null;\n version: number;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type ListSlackInstallationBindingsResponse = {\n bindings: SlackInstallationBinding[];\n};\n\nexport type GoogleDriveTargetScope = \"user\" | \"workspace\" | \"organization\";\nexport type ConnectorDocumentDestinationAuthority = \"organization\" | \"workspace\" | \"personal\";\nexport type ConnectorDocumentDestinationSelection = {\n authorityKind: ConnectorDocumentDestinationAuthority;\n collectionId: string | null;\n};\nexport type ConnectorDocumentDestination = ConnectorDocumentDestinationSelection & {\n authorityAccountId: string;\n authorityWorkspaceId: string | null;\n authoritySubjectId: string | null;\n};\nexport type GoogleDriveSyncCadence = \"manual\" | \"hourly\" | \"daily\";\nexport type GoogleDriveReadPolicy = \"allow\" | \"ask\" | \"block\";\nexport type GoogleDriveConnectionLifecycleState =\n | \"active\"\n | \"paused\"\n | \"token_revoked\"\n | \"app_removed\"\n | \"disconnected\"\n | \"reconnect_required\"\n | \"reconsent_required\";\n\nexport type GoogleDriveConnectionLifecycle =\n | {\n state: Exclude<GoogleDriveConnectionLifecycleState, \"app_removed\">;\n recoverable: true;\n observedAt: string;\n }\n | { state: \"app_removed\"; recoverable: false; observedAt: string };\n\nexport type GoogleDriveSelectedSource = {\n id: string;\n name: string;\n mimeType: string;\n driveId: string | null;\n destination?: ConnectorDocumentDestination | undefined;\n /** @deprecated Missing destinations resolve to the current workspace boundary. */\n targetScope?: GoogleDriveTargetScope | undefined;\n syncCadence: GoogleDriveSyncCadence;\n syncEnabled: boolean;\n configGeneration: number;\n readPolicy: GoogleDriveReadPolicy;\n selectedAt: string;\n};\n\nexport type GoogleDriveConnectionMetadata = {\n credentialRole: \"google_drive_metadata\";\n credentialLabel: \"Google Drive read-only source sync\" | \"Google Drive metadata browser\";\n googlePermissionId: string;\n googleEmail: string;\n googleDisplayName: string | null;\n verifiedAt: string;\n accessMode: \"file_only\" | \"metadata_readonly\" | \"readonly\";\n lifecycle?: GoogleDriveConnectionLifecycle | undefined;\n outputDestination?: GoogleDriveOutputDestination | undefined;\n documentDestination?: ConnectorDocumentDestination | undefined;\n selectedSources?: GoogleDriveSelectedSource[] | undefined;\n /** @deprecated Read selectedSources; retained while existing connections migrate. */\n selectedSource?: GoogleDriveSelectedSource | null | undefined;\n [key: string]: unknown;\n};\n\nexport type GoogleDriveOutputDestination = {\n folderId: string;\n folderName: string;\n driveId: string | null;\n location: \"my_drive\" | \"shared_drive\";\n selectedAt: string;\n};\n\nexport type GoogleDriveOAuthStartRequest = {\n connectionId?: string | undefined;\n capability?: \"source_read\" | \"publish\" | undefined;\n};\n\nexport type GoogleDriveOAuthStartResponse = {\n authorizationUrl: string;\n expiresAt: string;\n};\n\nexport type GoogleDriveLifecycleActionRequest = {\n action: \"pause\" | \"resume\";\n expectedVersion: number;\n};\n\nexport type GoogleDriveDisconnectRequest = {\n expectedVersion: number;\n idempotencyKey: string;\n};\n\nexport type GoogleDriveBrowseItem = {\n id: string;\n name: string;\n mimeType: string;\n kind: \"folder\" | \"file\";\n driveId: string | null;\n modifiedTime: string | null;\n size: string | null;\n webViewLink: string | null;\n};\n\nexport type GoogleDriveBrowseResponse = {\n connection: ConnectionMetadata;\n parentId: string;\n current: GoogleDriveBrowseItem | null;\n items: GoogleDriveBrowseItem[];\n nextPageToken: string | null;\n incompleteSearch: boolean;\n};\n\nexport type AtlassianSourceKind = \"jira_project\" | \"confluence_space\";\nexport type AtlassianSyncCadence = \"manual\" | \"hourly\" | \"daily\";\nexport type AtlassianReadPolicy = \"allow\" | \"ask\" | \"block\";\nexport type AtlassianConnectionLifecycle = {\n state:\n | \"active\"\n | \"paused\"\n | \"token_revoked\"\n | \"app_removed\"\n | \"disconnected\"\n | \"reconnect_required\"\n | \"reconsent_required\";\n recoverable: boolean;\n observedAt: string;\n};\nexport type AtlassianSelectedSource = {\n id: string;\n cloudId: string;\n siteName: string;\n siteUrl: string;\n resourceId: string;\n key: string;\n name: string;\n kind: AtlassianSourceKind;\n destination?: ConnectorDocumentDestination | undefined;\n syncCadence: AtlassianSyncCadence;\n syncEnabled: boolean;\n configGeneration: number;\n readPolicy: AtlassianReadPolicy;\n selectedAt: string;\n};\nexport type AtlassianConnectionMetadata = {\n credentialRole: \"atlassian_knowledge\";\n credentialLabel: \"Atlassian read-only knowledge sync\";\n atlassianAccountId: string;\n displayName: string;\n email?: string | null | undefined;\n sites: Array<{\n cloudId: string;\n name: string;\n url: string;\n products: Array<\"jira\" | \"confluence\">;\n }>;\n verifiedAt: string;\n accessMode: \"readonly\";\n lifecycle?: AtlassianConnectionLifecycle | undefined;\n documentDestination?: ConnectorDocumentDestination | undefined;\n selectedSources: AtlassianSelectedSource[];\n [key: string]: unknown;\n};\nexport type AtlassianOAuthStartResponse = {\n authorizationUrl: string;\n expiresAt: string;\n};\nexport type AtlassianLifecycleActionRequest = {\n action: \"pause\" | \"resume\";\n expectedVersion: number;\n};\nexport type AtlassianDisconnectRequest = {\n expectedVersion: number;\n idempotencyKey: string;\n};\nexport type AtlassianBrowseItem = {\n id: string;\n cloudId: string;\n siteName: string;\n siteUrl: string;\n resourceId: string;\n key: string;\n name: string;\n kind: AtlassianSourceKind;\n description: string | null;\n webUrl: string;\n};\nexport type AtlassianBrowseResponse = {\n connection: ConnectionMetadata;\n items: AtlassianBrowseItem[];\n};\n\nexport type SaveGoogleDriveSourceRequest = {\n sources: Array<Pick<GoogleDriveBrowseItem, \"id\" | \"name\" | \"mimeType\" | \"driveId\">>;\n destination?: ConnectorDocumentDestinationSelection | undefined;\n /** @deprecated Legacy requests resolve to workspace authority. */\n targetScope?: GoogleDriveTargetScope | undefined;\n syncCadence: GoogleDriveSyncCadence;\n syncEnabled: boolean;\n readPolicy: GoogleDriveReadPolicy;\n};\n\nexport type GoogleDriveKnowledgeSourceItem = {\n id: string;\n name: string;\n mimeType: string;\n driveId?: string | undefined;\n sourceKind: \"my_drive\" | \"shared_drive\" | \"folder\";\n includeDescendants: boolean;\n};\n\nexport type GoogleDriveKnowledgeSourceDestination = {\n authorityKind: ConnectorDocumentDestinationAuthority;\n authorityAccountId: string;\n authorityWorkspaceId?: string | undefined;\n authoritySubjectId?: string | undefined;\n collectionId?: string | undefined;\n};\n\nexport type GoogleDriveKnowledgeSourceConfig = {\n sources: GoogleDriveKnowledgeSourceItem[];\n destination: GoogleDriveKnowledgeSourceDestination;\n syncCadence: GoogleDriveSyncCadence;\n readPolicy: GoogleDriveReadPolicy;\n};\n\nexport type SaveGoogleDriveIntegrationSourceRequest = SaveGoogleDriveSourceRequest & {\n expectedVersion?: number | undefined;\n idempotencyKey: string;\n};\n\nexport type UpdateConnectionRequest = {\n providerDomain?: string | undefined;\n subjectId?: string | null | undefined;\n kind?: ConnectionKind | undefined;\n status?: ConnectionStatus | undefined;\n credential?: Record<string, unknown> | undefined;\n grantedScopes?: string[] | undefined;\n expiresAt?: string | null | undefined;\n metadata?: Record<string, unknown> | undefined;\n expectedVersion?: number | undefined;\n operationId?: string | undefined;\n};\n\nexport type ConnectionResponse = {\n connection: ConnectionMetadata;\n};\n\nexport type ListConnectionsResponse = {\n connections: ConnectionMetadata[];\n};\n\nexport type ConnectionOwnership = \"workspace\" | \"personal\";\n\nexport type OAuthStartRequest = {\n providerDomain?: string | undefined;\n mcpUrl?: string | undefined;\n resource?: string | undefined;\n requestedScopes?: string[] | undefined;\n returnPath?: string | undefined;\n /** Exact trusted-host destination; requires verified external-user mode. */\n returnUrl?: string | undefined;\n connectionId?: string | undefined;\n /** Sign in a further account instead of refreshing your existing active one.\n * Never combined with connectionId. */\n newAccount?: true | undefined;\n ownership?: ConnectionOwnership | undefined;\n oauthClient?:\n | {\n clientId: string;\n clientSecret?: string | undefined;\n tokenEndpointAuthMethod?: \"none\" | \"client_secret_post\" | \"client_secret_basic\" | undefined;\n }\n | undefined;\n};\n\nexport type OAuthStartResponse = {\n state: string;\n authorizationUrl: string | null;\n expiresAt: string;\n};\n\nexport type SocialProvider =\n | \"x\"\n | \"reddit\"\n | \"linkedin\"\n | \"instagram\"\n | \"facebook\"\n | \"tiktok\"\n | \"youtube\"\n | \"custom\";\n\nexport type SocialConnectionStatus = \"connected\" | \"needs_reauth\" | \"disabled\";\n\nexport type SocialConnection = {\n id: string;\n accountId: string;\n workspaceId: string;\n provider: SocialProvider;\n accountHandle: string;\n accountName: string | null;\n externalAccountId: string | null;\n ownership: \"workspace\" | \"personal\";\n status: SocialConnectionStatus;\n scopes: string[];\n credentialRef: string | null;\n tokenMetadata: Record<string, unknown>;\n metadata: Record<string, unknown>;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type SocialOAuthStartRequest = {\n provider: \"x\" | \"reddit\";\n ownership?: \"workspace\" | \"personal\" | undefined;\n scopes?: string[] | undefined;\n returnPath?: string | undefined;\n};\n\n/** The immutable principal whose authority accepted a session or turn. */\nexport type TurnInitiator = {\n kind: \"subject\" | \"service\";\n subjectId: string;\n /** Display-only snapshot; never an authorization input. */\n label?: string | undefined;\n};\n\n/** A trusted embedding host's causal machine/service principal. */\nexport type ServiceTurnInitiator = TurnInitiator & { kind: \"service\" };\n\nexport type TurnInitiatorContext = Record<string, unknown>;\n\n/** Bounded host provenance; Opengeni-owned lineage keys are reserved. */\nexport type ServiceTurnInitiatorContext = TurnInitiatorContext;\n\nexport type IntegrationClientMetadata = {\n client_id: string;\n client_name: \"Opengeni\" | \"OpenGeni\";\n redirect_uris: string[];\n token_endpoint_auth_method: \"none\";\n grant_types: Array<\"authorization_code\" | \"refresh_token\">;\n response_types: [\"code\"];\n};\n\nexport type SessionVisibility = \"private\" | \"workspace\";\n\nexport type SessionTenancyCreateCapabilities = {\n activated: boolean;\n canCreatePrivate: boolean;\n reason: \"available\" | \"not_activated\" | \"managed_session_required\" | \"unavailable\";\n /**\n * Who sees a new chat or schedule unless the person picks otherwise. Absent\n * from older servers, which means \"workspace\".\n */\n defaultVisibility?: SessionVisibility;\n};\n\nexport type SessionTenancyPublicProjection = {\n visibility: SessionVisibility;\n authorityEpoch: number;\n ownedByCurrentUser: boolean;\n fork: {\n sourceVisibility: SessionVisibility;\n sourceAuthorityEpoch: number;\n forkedAt: string;\n } | null;\n};\n\nexport type UpdateSessionVisibilityRequest = {\n visibility: SessionVisibility;\n expectedAuthorityEpoch: number;\n idempotencyKey: string;\n /**\n * \"Make private anyway\": stop the chat's work in progress (the running or\n * parked response, queued messages, an active goal) as part of the change.\n * Without it such work refuses the change with reason `active_work`.\n */\n stopActiveWork?: boolean;\n};\n\n/** What still refuses a visibility change after the chat's own work stops. */\nexport type SessionTenancyBlocker =\n | \"nonterminal_turn\"\n | \"nonterminal_attempt\"\n | \"unsettled_interruption\"\n | \"pending_system_update\"\n | \"pending_human_input\"\n | \"pending_tool_receipt\"\n | \"run_state\"\n | \"active_goal\"\n | \"capacity_waiter\"\n | \"active_realtime\"\n | \"active_scheduled_task\"\n | \"workspace_mutation_admission\"\n | \"retained_process\"\n | \"active_sandbox_access\"\n | \"shared_sandbox_group\";\n\n/**\n * What a change to Only me stops or removes when `stopActiveWork` is sent:\n * the chat's visible work and anything that carries another person's access.\n */\nexport type SessionVisibilityWork = {\n runningTurnCount: number;\n queuedTurnCount: number;\n activeGoal: boolean;\n /** A voice session is live in the chat. */\n liveVoice: boolean;\n /** Pending updates that carry another person's access. */\n otherPeoplePendingUpdateCount: number;\n /** Account choices for the chat that only another person may use. */\n otherPeopleAccountChoiceCount: number;\n};\n\nexport type SessionVisibilityChangePreview = {\n visibility: SessionVisibility;\n targetVisibility: SessionVisibility;\n authorityEpoch: number;\n /** Nothing else refuses the change; an empty value means it just happens. */\n work: SessionVisibilityWork;\n /** @deprecated Always `null`: nothing refuses a change to Only me any more. */\n blocker: SessionTenancyBlocker | null;\n};\n\nexport type UpdateSessionVisibilityResponse = {\n operationId: string;\n eventId: string | null;\n eventSequence: number | null;\n visibility: SessionVisibility;\n authorityEpoch: number;\n changed: boolean;\n replay: boolean;\n revokedGrantCount: number;\n};\n\n/** One message a share link shows: the person's or the reply, as text. */\nexport type SharedSessionMessage = {\n role: \"user\" | \"assistant\";\n text: string;\n /**\n * The name the chat shows for the person who sent a message, never an\n * email address or id. Absent for replies, and when the chat has no such\n * name for them.\n */\n sender?: string;\n};\n\n/** A chat's live read-only share link, as its owner sees it. */\nexport type SessionShareLink = {\n shareId: string;\n /** The page anyone with the link opens. */\n url: string;\n workspaceId: string;\n sessionId: string;\n title: string;\n /** Messages the link shows. */\n messageCount: number;\n createdAt: string;\n /** When the snapshot behind the link was last taken. */\n updatedAt: string;\n};\n\n/** Whether the person can share a chat here, and their live link. */\nexport type SessionShareLinkState = {\n /** False when this deployment has turned share links off. */\n enabled: boolean;\n link: SessionShareLink | null;\n};\n\nexport type SessionShareLinkList = {\n links: SessionShareLink[];\n};\n\n/** What anyone holding a share link reads, without signing in. */\nexport type SharedSession = {\n title: string;\n /** When the snapshot was taken. */\n sharedAt: string;\n messages: SharedSessionMessage[];\n /** Earlier messages left out to keep the snapshot within its size. */\n omittedMessageCount: number;\n};\n\nexport type ForkSessionRequest = {\n idempotencyKey: string;\n visibility: SessionVisibility;\n workspaceSharedAcknowledged: boolean;\n rigId?: string | null | undefined;\n};\n\nexport type ForkSessionResponse = {\n operationId: string;\n eventId: string;\n eventSequence: number;\n sessionId: string;\n workspaceId: string;\n visibility: SessionVisibility;\n authorityEpoch: 1;\n copiedHistoryItemCount: number;\n replay: boolean;\n};\n\nexport type SessionBackgroundCommandActivity = {\n unavailableCount?: number | undefined;\n state: \"running\" | \"stopping\";\n count: number;\n};\n\n/** Stored reconciliation checkpoints, not a live provider probe or native ACK. */\nexport type SessionBackgroundCommandReconciliation = {\n lastOutcome: string | null;\n attempts: number;\n dueAt: string;\n claimedAt: string | null;\n terminalProof:\n | { outcome: \"exited\"; exitCode: number; observedAt: string }\n | { outcome: \"lost\"; exitCode: null; observedAt: string }\n | null;\n};\n\nexport type SessionBackgroundCommand = {\n observationStatus?: \"unavailable\" | undefined;\n reconciliation?: SessionBackgroundCommandReconciliation | undefined;\n id: string;\n workspaceId: string;\n sessionId: string;\n provider: \"managed\" | \"connected_machine\";\n state: \"running\" | \"stopping\" | \"exited\" | \"lost\";\n commandPreview: string;\n commandText?: string | undefined;\n cancelRequestedAt: string | null;\n exitCode: number | null;\n settlementReason: string | null;\n startedAt: string;\n settledAt: string | null;\n updatedAt: string;\n};\n\nexport type SessionBackgroundCommandListResponse = {\n commands: SessionBackgroundCommand[];\n};\n\nexport type WorkspaceBackgroundCommand = SessionBackgroundCommand & {\n sessionTitle: string | null;\n machineName: string | null;\n};\n\nexport type WorkspaceBackgroundCommandListResponse = {\n commands: WorkspaceBackgroundCommand[];\n nextCursor: string | null;\n};\n\nexport type CancelSessionBackgroundCommandResult = {\n command: SessionBackgroundCommand;\n accepted: boolean;\n};\n\n/** Why the runtime refused to start a session's next turn. */\nexport type SessionAdmissionBlock = {\n reason:\n | \"database_claim_rejected\"\n | \"initiator_membership_required\"\n | \"personal_resource_grant_required\";\n sqlState: string | null;\n retryPolicy: \"explicit_recheck\";\n blockedAt: string;\n};\n\nexport type Session = {\n /** Detail-only dispatch evidence; delivery does not prove turn execution. */\n dispatchWait?:\n | {\n state: \"pending\" | \"acknowledged\" | \"unavailable\";\n attempts: number;\n nextAttemptAt: string | null;\n lastError: string | null;\n }\n | null\n | undefined;\n /** Detail-only failure evidence through lastSequence; independent of timeline paging. */\n failureDiagnostics?:\n | {\n eventId: string;\n sequence: number;\n turnId: string | null;\n occurredAt: string;\n payload: unknown;\n }\n | null\n | undefined;\n bundledSkillIds?: BundledSkillId[] | undefined;\n id: string;\n workspaceId: string;\n accountId: string;\n status: SessionStatus;\n backgroundCommandActivity?: SessionBackgroundCommandActivity | undefined;\n hasSchedules?: boolean | undefined;\n /** An active schedule targeting this session can still start a run. */\n hasUpcomingSchedules?: boolean | undefined;\n /** An active automation targeting this session will run when one of its events arrives. */\n waitingForEvents?: boolean | undefined;\n /**\n * What the automations the reader can see are waiting for before they\n * continue this session: the next scheduled run and the first event. Null\n * when none of them can start a run.\n */\n automationWait?: SessionAutomationWaitSummary | null | undefined;\n initialMessage: string;\n title: string | null;\n titleSource: \"user\" | \"agent\" | null;\n /** Display-only one-line description of what this chat is for. Never sent to the model. */\n description?: string | null | undefined;\n /** Display-only avatar. Never sent to the model. */\n avatar?: SessionAvatar | null | undefined;\n // Per-session agent persona/system instructions supplied at create; null when\n // the session carried none. Org-visible metadata, never a timeline event.\n instructions: string | null;\n /** Immutable normalized prompt-policy role; distinct from membership roles. */\n policyRole: string | null;\n resources: ResourceRef[];\n /**\n * Repositories a person removed from this chat, newest per repository. The\n * agent can't attach one again; a person attaching it again ends its record.\n */\n removedRepositories?: SessionRemovedRepository[] | undefined;\n skills: SessionSkill[];\n tools: ToolRef[];\n toolPolicy: SessionToolPolicy;\n toolPolicyVersion: number;\n effectiveToolPolicy?: SessionEffectiveToolPolicy | undefined;\n metadata: Record<string, unknown>;\n /** Present only when session-tenancy product activation is enabled for the organization. */\n tenancy?: SessionTenancyPublicProjection | undefined;\n /** Frozen creator fact; later turns carry their own independent initiator. */\n createdBy: TurnInitiator;\n createdByContext: Record<string, unknown>;\n model: string;\n reasoningEffort: ReasoningEffort;\n latencyMode: LatencyMode;\n sandboxBackend: SandboxBackend;\n sandboxOs: SandboxOs;\n sandboxGroupId: string;\n activeSandboxId: string | null;\n activeEpoch: number;\n /** Explicit connected-machine project root; null uses the agent launch root. */\n workingDir: string | null;\n // The rig + frozen rig version this session rides (M3). Both null for a\n // rig-less session. Frozen at create; a later rig promote never moves them.\n rigId: string | null;\n rigVersionId: string | null;\n /** Workspace channel the session is filed under; null = unfiled (inbox). */\n channelId: string | null;\n firstPartyMcpPermissions: string[] | null;\n firstPartyMcpTools: FirstPartyMcpToolName[];\n /**\n * Frozen agent configuration; null for sessions created without one (legacy\n * behavior). Omitted by older servers.\n */\n agent?: ResolvedAgentConfig | null | undefined;\n /** Capability-level view of what a configured session can use; null for legacy. */\n effectiveTools?: AgentEffectiveTools | null | undefined;\n mcpServers: SessionMcpServerMetadata[];\n mcpApprovalPolicies?: Record<string, SessionMcpApprovalPolicy> | undefined;\n parentSessionId: string | null;\n /** Immutable server-authored nested-agent lineage and policy snapshot. */\n rootSessionId: string;\n /**\n * The task root's usage limit and recorded API-equivalent model usage, on\n * detail reads and create responses. Omitted by older servers and list\n * reads: omission never means \"no limit\".\n */\n usageLimit?: SessionUsageLimit | undefined;\n nestedAgentDepth: number;\n maxNestedAgentDepthOverride: number | null;\n effectiveMaxNestedAgentDepth: number;\n nestedAgentDepthPolicySource: \"session\" | \"workspace\" | \"deployment\" | \"default\";\n nestedAgentDepthPolicySessionId: string | null;\n createIdempotencyKey: string | null;\n temporalWorkflowId: string | null;\n activeTurnId: string | null;\n queueVersion: number;\n queueHeadPosition: number;\n queueTailPosition: number;\n effectiveControl: EffectiveSessionControl;\n /** Current durable input wait; an elapsed deadline does not prove a new turn started. */\n inputWait?: { deadlineAt: string; reason: string } | null | undefined;\n lastSequence: number;\n /** Multi-account Codex (P1): the account this session is pinned to (null ⇒ follow workspace active). */\n codexPinnedCredentialId?: string | null;\n /** Multi-account Codex (P1): the account the most recent turn ran on (the \"Running on:\" indicator). */\n codexLastCredentialId?: string | null;\n /** Accepted current-turn account, separate from future session preferences. */\n codexCurrentSelection?: { credentialId: string | null; waiting: boolean } | null | undefined;\n /**\n * Frozen at create. `remote_v2` ⇒ Codex remote compaction + Codex-only model\n * admission; `portable` ⇒ plaintext compaction and free provider switching.\n */\n codexCompactionMode: \"remote_v2\" | \"portable\";\n /**\n * The `code_search` decision frozen at create. A turn gets the tool only when\n * this is true, the deployment still offers it, the workspace is not Off, and\n * the turn has POSIX compute.\n */\n codeSearchEnabled?: boolean;\n /** Personal (authenticated subject) workspace pin state, never workspace-global. */\n pinned?: boolean;\n /** Stable pin ordering key; null when this subject has not pinned the session. */\n pinnedAt?: string | null;\n /** Optimistic pin-state revision; zero represents an absent pin relation. */\n pinVersion?: number;\n /** Personal explicit acknowledgment state. */\n unread?: boolean;\n /** Personal actively-working label. */\n activelyWorking?: boolean;\n /** Optimistic unread/actively-working revision. */\n attentionVersion?: number;\n /** Personal archive state. */\n archived?: boolean;\n archivedAt?: string | null;\n /**\n * Read-only imported timeline, independent of personal archive/restore state.\n * Never model-facing conversation history.\n */\n importedArchive?: { importId: string; importedAt: string; readOnly: true } | undefined;\n /**\n * Idle-session archive state and keep-live exemption, workspace-wide and\n * independent of the personal `archived` flag. Absent on older servers.\n */\n retention?: SessionRetention | undefined;\n /**\n * Whether the next turns run unattended: no person will see or answer a\n * question until the task ends. Absent on older servers (attended).\n */\n unattended?: boolean | undefined;\n /** Optimistic archive-state revision. */\n archiveVersion?: number;\n /** Server-authoritative descendant counts populated by session-list reads. */\n treeStats?:\n | {\n directChildren: number;\n totalDescendants: number;\n runningDescendants: number;\n queuedDescendants: number;\n waitingDescendants?: number | undefined;\n attentionDescendants: number;\n pausedDescendants: number;\n failedDescendants: number;\n unreadDescendants?: number | undefined;\n unreadFailedDescendants?: number | undefined;\n activelyWorkingDescendants?: number | undefined;\n /**\n * Earliest moment one of the counted `attentionDescendants` entered\n * `requires_action`; null when none is waiting, absent on older servers.\n */\n attentionSince?: string | null | undefined;\n /** Counts are lower bounds rather than exact totals when true. */\n truncated: boolean;\n }\n | undefined;\n /**\n * When this session's own open turn entered `requires_action`. Populated by\n * list and lineage reads for `requires_action` sessions; null otherwise.\n */\n requiresActionSince?: string | null | undefined;\n /**\n * Set while the runtime refuses to start this session's next turn (status\n * `requires_action`, but nothing is asked of a person). Accepted work is\n * kept; Resume or a new Send/Steer rechecks admission. Absent on older servers.\n */\n admissionBlock?: SessionAdmissionBlock | null | undefined;\n /** Agent access scope; absent on servers before the agent-access release. */\n agentAccess?: SessionAgentAccess | undefined;\n /** Opaque end-user label; null when the session carries none. */\n scopeSubjectId?: SessionScopeSubjectId | null | undefined;\n /** Memory scope; absent on servers before the agent-access release. */\n memoryScope?: SessionMemoryScope | undefined;\n createdAt: string;\n updatedAt: string;\n};\n\n/** Additive receipt returned by POST /sessions. */\nexport type CreateSessionResponse = Session & {\n initialTurnId: string | null;\n};\n\nexport type SessionSummary = Session;\n\n/**\n * Compact list-only record, excluding prompts and execution configuration\n * other than the model and reasoning effort shown with a row.\n */\nexport type SessionListEntry = Pick<\n Session,\n | \"id\"\n | \"workspaceId\"\n | \"accountId\"\n | \"status\"\n | \"activeTurnId\"\n | \"backgroundCommandActivity\"\n | \"hasSchedules\"\n | \"hasUpcomingSchedules\"\n | \"waitingForEvents\"\n | \"automationWait\"\n | \"title\"\n | \"titleSource\"\n | \"description\"\n | \"avatar\"\n | \"createdBy\"\n | \"channelId\"\n | \"parentSessionId\"\n | \"rootSessionId\"\n | \"effectiveControl\"\n | \"inputWait\"\n | \"lastSequence\"\n | \"pinned\"\n | \"pinnedAt\"\n | \"pinVersion\"\n | \"unread\"\n | \"activelyWorking\"\n | \"attentionVersion\"\n | \"archived\"\n | \"archivedAt\"\n | \"importedArchive\"\n | \"retention\"\n | \"archiveVersion\"\n | \"treeStats\"\n | \"requiresActionSince\"\n | \"admissionBlock\"\n | \"createdAt\"\n | \"updatedAt\"\n> & {\n displayTitle: string;\n renameSeed: string;\n scheduledTaskId: string | null;\n siteOrigin: { siteId: string; title: string } | null;\n /**\n * Display-only: the latest started turn's model, or the session's stored\n * default when an explicit settings change is newer or no turn has started.\n * Rows the SDK projects from an older server's full pages carry the\n * session's effective model instead. `getSession` remains authoritative for\n * the composer default.\n */\n model?: string | undefined;\n reasoningEffort?: ReasoningEffort | undefined;\n /**\n * Newest turn in execution order: the last queued turn, else the executing\n * turn, else the most recently finished one. Null when the session has no\n * turn; absent from older servers and SDK-projected full pages.\n */\n latestTurn?: SessionListLatestTurn | null | undefined;\n};\n\nexport type SessionListLatestTurn = {\n id: string;\n status: SessionTurnStatus;\n startedAt: string | null;\n finishedAt: string | null;\n};\nexport type SessionListEntryResponse = Omit<SessionListResponse, \"pinned\" | \"sessions\"> & {\n projection: \"summary\";\n pinned: SessionListEntry[];\n sessions: SessionListEntry[];\n};\n\n/** Complete metadata for authorized roots and ordinary project trees. */\nexport type SessionListTotals = {\n needsYouCount: number;\n groups: Array<{\n channelId: string | null;\n total: number;\n attention: number;\n attentionSince: string | null;\n failed: number;\n active: number;\n queued: number;\n unread: number;\n activeWork: number;\n /** Idle sessions parked on their own wake-up; already included in `active`. */\n waiting?: number;\n }>;\n};\n\n/**\n * One Site row in one project (`siteConversations: \"group\"`): a Site with\n * the viewer's conversations, created by a chat they list, or opened by them.\n * Counts are complete for the viewer, independent of page size.\n */\nexport type SiteConversationGroup = {\n siteId: string;\n channelId: string | null;\n /** The Site's current title when the viewer can read it, else its creation label. */\n title: string;\n /** Root conversations in the group; 0 for a Site with none yet. */\n conversations: number;\n /** When the Site last got a new published version (creation is the first); for a viewer who cannot read the Site, when its first conversation here started. Its conversations, the chats that made it and opening it never move it. */\n updatedAt: string;\n /** Creation time of the group's newest conversation, else of the Site. */\n createdAt: string;\n total: number;\n attention: number;\n attentionSince: string | null;\n failed: number;\n active: number;\n queued: number;\n waiting: number;\n unread: number;\n activeWork: number;\n /** This person pinned the Site in their sidebar. Absent when not pinned. */\n pinned?: true;\n pinnedAt?: string | null;\n};\n\nexport type SessionListResponse = {\n totals?: SessionListTotals;\n needsYouOnly?: true;\n /** Receipt for the read-only (archived idle session) filter. */\n contentArchivedOnly?: true;\n /** Receipt for the started-or-messaged-by-you filter. */\n mineOnly?: true;\n /** Receipt for the `sessionIds` selection; older servers ignore that filter. */\n sessionIdsApplied?: true;\n pinned: Session[];\n /** True when the server omitted older pins from its bounded pinned section. */\n pinnedTruncated?: boolean;\n /** Present only when the server recognized and applied additive list filters. */\n filtersApplied?: true;\n /** Effective server ordering. Name: ASCII-space trim, ASCII case fold,\n * UTF-8 byte order, id ASC. Date keys and id ties are DESC. */\n sortBy?: \"updatedAt\" | \"createdAt\" | \"name\" | \"archivedAt\";\n archiveStatus?: \"active\" | \"archived\" | \"all\";\n /** Server-resolved Site origin filter, when requested. */\n originSiteId?: string;\n /** Server-resolved Site access filter, when requested. */\n siteAccessId?: string;\n /** Receipt for the requested Site conversation mode. */\n siteConversations?: \"include\" | \"group\";\n /** Complete Site rows for a `group` root page, newest activity first. */\n siteGroups?: SiteConversationGroup[];\n /** True when Site rows beyond the server bound were omitted. */\n siteGroupsTruncated?: true;\n sessions: Session[];\n nextCursor: string | null;\n};\n\nexport type WorkClaimSubjectType =\n | \"repository\"\n | \"branch\"\n | \"pull_request\"\n | \"issue\"\n | \"artifact\"\n | \"release\"\n | \"ci_run\"\n | \"other\";\n\nexport type WorkClaimDiscoverySummary = {\n id: string;\n sessionId: string;\n subject: {\n namespace: string;\n type: WorkClaimSubjectType;\n canonicalKey: string;\n displayLabel: string | null;\n };\n role: \"working\" | \"reviewing\" | \"monitoring\" | \"delivering\";\n state: \"active\" | \"released\" | \"superseded\" | \"stale\";\n revision: number;\n provenance:\n | \"explicit_agent\"\n | \"user_api\"\n | \"trusted_integration\"\n | \"session_resource\"\n | \"system_lifecycle\";\n version: {\n kind:\n | \"git_commit\"\n | \"branch_head\"\n | \"pull_request_head\"\n | \"artifact_version\"\n | \"release_version\"\n | \"ci_run\"\n | \"other\";\n value: string;\n } | null;\n observedAt: string;\n updatedAt: string;\n settledAt: string | null;\n};\n\nexport type WorkDiscoveryProjection = {\n claims: WorkClaimDiscoverySummary[];\n claimsTruncated: boolean;\n match: {\n class: \"exact_subject\" | \"title\" | \"goal\" | \"fuzzy\";\n field: \"subject\" | \"title\" | \"goal\" | \"claim_key\" | \"claim_label\";\n scoreBand: \"exact\" | \"strong\" | \"related\";\n claimId: string | null;\n } | null;\n possibleOverlap: boolean;\n advisoryOnly: true;\n noAdditionalAccess: true;\n};\n\n/** Compact, bounded session projection for workspace agent-topology browsers. */\nexport type AgentTopologySession = {\n id: string;\n title: string | null;\n titleTruncated: boolean;\n parentSessionId: string | null;\n rootSessionId: string;\n nestedAgentDepth: number;\n ancestorPath: Array<{\n id: string;\n title: string | null;\n titleTruncated: boolean;\n }>;\n status: SessionStatus;\n goal: {\n status: SessionGoalStatus;\n summary: string;\n summaryTruncated: boolean;\n } | null;\n pause: {\n state: \"active\" | \"paused\";\n additionalBlockerCount: number;\n source: {\n kind: \"session\" | \"workspace\";\n sessionId?: string | undefined;\n displayName: string;\n displayNameTruncated: boolean;\n } | null;\n };\n children: {\n directChildren: number;\n totalDescendants: number;\n runningDescendants: number;\n queuedDescendants: number;\n attentionDescendants: number;\n pausedDescendants: number;\n failedDescendants: number;\n truncated: boolean;\n };\n relatedWork: WorkDiscoveryProjection;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type AgentTopologyPageResponse = {\n sessions: AgentTopologySession[];\n total: number;\n hasMore: boolean;\n /** Operator rollout decision for human advisory presentation. */\n humanAdvisoriesEnabled?: boolean | undefined;\n nextCursor: string | null;\n};\n\nexport type UpdateSessionPinRequest = {\n pinned: boolean;\n expectedVersion?: number;\n};\n\nexport type UpdateSessionAttentionRequest = {\n unread?: boolean;\n acknowledgedThroughSequence?: number;\n activelyWorking?: boolean;\n expectedVersion?: number;\n};\n\n/**\n * Idle-session archive state. `archive` is null while the session is live; an\n * archived session keeps its readable timeline but is read-only.\n */\nexport type SessionRetention = {\n /** Never archive this session, however long it stays idle. */\n keepLive: boolean;\n archive: {\n state: \"archiving\" | \"archived\";\n archivedAt: string | null;\n } | null;\n};\n\nexport type UpdateSessionRetentionRequest = {\n keepLive: boolean;\n};\n\n/** Turn a chat's unattended mode on or off from its next turn. */\nexport type UpdateSessionUnattendedRequest = {\n unattended: boolean;\n};\n\nexport type UpdateSessionArchiveRequest = {\n archived: boolean;\n /** Ignored; kept for older clients. */\n clientEventId?: string;\n /** Ignored; there is one kind of archive. Kept for older clients. */\n mode?: \"pause_and_archive\" | \"hide_for_me\";\n /** Ignored; archiving stops running work itself. Kept for older clients. */\n confirmPause?: boolean;\n /** Ignored; kept for older clients. */\n expectedVersion?: number;\n};\n\nexport type LineageNode = {\n session: SessionSummary;\n children: LineageNode[];\n};\n\nexport type SessionLineageResponse = {\n sessionHasSchedules?: boolean | undefined;\n sessionHasUpcomingSchedules?: boolean | undefined;\n sessionWaitingForEvents?: boolean | undefined;\n /** What the automations continuing the requested session are waiting for. */\n sessionAutomationWait?: SessionAutomationWaitSummary | null | undefined;\n ancestors: SessionSummary[];\n children: LineageNode[];\n truncated: boolean;\n};\n\nexport type SessionTurnStatus =\n | \"queued\"\n | \"running\"\n | \"requires_action\"\n | \"recovering\"\n | \"waiting_capacity\"\n | \"completed\"\n | \"failed\"\n | \"cancelled\"\n | \"superseded\"\n | \"withdrawn_for_edit\";\n\nexport type SessionTurnSource =\n | \"user\"\n | \"scheduled_task\"\n | \"api\"\n | \"goal\"\n | \"system\"\n | \"compaction\";\n\nexport type TimelineAnnotationSourceKind = \"user_message\" | \"assistant_message\" | \"tool_output\";\n\nexport type TimelineAnnotationSourceEventType =\n | \"user.message\"\n | \"agent.message.completed\"\n | \"agent.toolCall.output\";\n\nexport type TimelineAnnotationSource = {\n kind: TimelineAnnotationSourceKind;\n eventId: string;\n eventType: TimelineAnnotationSourceEventType;\n sequence: number;\n turnId: string | null;\n startOffset: number;\n endOffset: number;\n contextBefore: string;\n contextAfter: string;\n label?: string | undefined;\n};\n\nexport type DraftTimelineAnnotation = {\n id: string;\n source: TimelineAnnotationSource;\n quote: string;\n note: string;\n};\n\nexport type SubmittedTimelineAnnotation = DraftTimelineAnnotation;\n\nexport type TimelineAnnotation = DraftTimelineAnnotation & {\n ordinal: number;\n};\n\nexport const PERSONAL_RESOURCE_SHARED_OUTPUT_WARNING_VERSION = 1 as const;\nexport const PERSONAL_RESOURCE_SHARED_OUTPUT_WARNING =\n \"Personal resources used in a workspace-shared session may influence outputs visible to other workspace members. The underlying credentials and secret values are not shared by the attachment itself.\";\n\nexport type PersonalResourceAttachmentIntent = {\n mode: \"once\" | \"session\" | \"always\";\n expectedAuthorityEpoch?: number | undefined;\n workspaceSharedAcknowledged?: boolean | undefined;\n sharedOutputWarningVersion: 1;\n};\n\nexport type PersonalResourceAttachmentSummary = {\n mode: \"once\" | \"session\" | \"always\";\n context: \"user_private\" | \"workspace_shared\";\n resourceCount: number;\n resourceKinds: Array<\"variable_set\" | \"rig\" | \"connected_machine\">;\n sharedOutputWarningVersion: 1;\n};\n\nexport type SessionTurn = {\n id: string;\n workspaceId: string;\n sessionId: string;\n triggerEventId: string;\n temporalWorkflowId: string;\n status: SessionTurnStatus;\n source: SessionTurnSource;\n position: number;\n prompt: string;\n annotations?: TimelineAnnotation[] | undefined;\n resources: ResourceRef[];\n tools: ToolRef[];\n toolsProvided?: boolean | undefined;\n model: string;\n reasoningEffort: ReasoningEffort;\n latencyMode: LatencyMode;\n sandboxBackend: SandboxBackend;\n sandboxOs: SandboxOs | null;\n metadata: Record<string, unknown>;\n version: number;\n executionGeneration: number;\n activeAttemptId: string | null;\n lineage: Record<string, unknown>;\n initiator: TurnInitiator;\n initiatorContext: Record<string, unknown>;\n personalConnections?: McpPersonalConnectionSummary[] | undefined;\n personalResources?: PersonalResourceAttachmentSummary | null | undefined;\n cancelledBy?: string | null;\n cancelReason?: string | null;\n startedAt: string | null;\n finishedAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type HumanInputQuestionKind = \"text\" | \"single_select\" | \"multi_select\" | \"secret\";\n\n/** Options for a generated password (see `@opengeni/contracts` GeneratePasswordSpec). */\nexport type GeneratePasswordSpec = {\n length?: number | undefined;\n lowercase?: boolean | undefined;\n uppercase?: boolean | undefined;\n digits?: boolean | undefined;\n symbols?: boolean | undefined;\n symbolSet?: string | undefined;\n excludeAmbiguous?: boolean | undefined;\n requireEachClass?: boolean | undefined;\n};\n\nexport type HumanInputSecretSaveTo = \"user\" | \"task\" | \"workspace\";\n\n/** A secret question's spec; the value is saved to a vault, never to the response. */\nexport type HumanInputSecretSpec = {\n item: string;\n field?: string | undefined;\n fieldKind?: \"concealed\" | \"totp\" | \"text\" | undefined;\n itemType?: \"login\" | \"api_key\" | \"note\" | \"card\" | \"identity\" | \"ssh_key\" | undefined;\n username?: { prompt: string; value?: string | null | undefined } | null | undefined;\n website?: string | null | undefined;\n looksLike?: string | null | undefined;\n pattern?: string | null | undefined;\n saveTo?: HumanInputSecretSaveTo | undefined;\n vault?: string | null | undefined;\n allowGenerate?: boolean | undefined;\n generate?: GeneratePasswordSpec | null | undefined;\n autocomplete?: \"current-password\" | \"new-password\" | \"one-time-code\" | \"off\" | undefined;\n};\n\n/** Write-only secret value for one secret question: exactly one of `value` or `generate`. */\nexport type HumanInputSecretAnswer = {\n questionId: string;\n value?: string | undefined;\n generate?: GeneratePasswordSpec | undefined;\n username?: string | undefined;\n saveTo: HumanInputSecretSaveTo;\n vaultId?: string | undefined;\n};\n\n/** What the agent and timeline see for an answered secret question. */\nexport type HumanInputSecretAnswerResult = {\n reference: string;\n username: string | null;\n vaultName: string;\n itemName: string;\n saveTo: HumanInputSecretSaveTo;\n};\n\nexport type HumanInputOption = {\n id: string;\n label: string;\n description?: string | null | undefined;\n /** The agent's suggestion; mark it, never pre-select it. */\n recommended?: boolean | null | undefined;\n /** A short sample of what the option produces, shown as-is (monospace). */\n preview?: string | null | undefined;\n};\n\nexport type SkillReviewReference = {\n removalOperationId?: string | undefined;\n sourceOperationId: string;\n skillId: string;\n revisionId: string;\n expectedRevisionId: string | null;\n expectedScopeVersion: number;\n};\n\nexport type HumanInputQuestion = {\n skillReview?: SkillReviewReference | null | undefined;\n id: string;\n kind: HumanInputQuestionKind;\n prompt: string;\n label?: string | null | undefined;\n helpText?: string | null | undefined;\n options: HumanInputOption[];\n /** Required exactly when `kind` is \"secret\"; null otherwise. */\n secret?: HumanInputSecretSpec | null | undefined;\n required: boolean;\n /**\n * A yes/no decision: a single_select with exactly two options, the action\n * first and the way out second, answered with two buttons.\n */\n confirm?: boolean | null | undefined;\n allowOther: boolean;\n validation?:\n | {\n minSelections?: number | null | undefined;\n maxSelections?: number | null | undefined;\n }\n | null\n | undefined;\n};\n\nexport type HumanInputAnswer = {\n questionId: string;\n values: string[];\n other?: string | null | undefined;\n /** Secret questions: the saved reference, never the value. */\n secret?: HumanInputSecretAnswerResult | undefined;\n};\n\nexport type HumanInputResponse =\n | { outcome: \"answered\"; answers: HumanInputAnswer[] }\n /** `agentDecides`: the person chose \"Let the agent decide\". */\n | { outcome: \"skipped\"; agentDecides?: true | undefined }\n | { outcome: \"expired\" | \"cancelled\" };\n\nexport type SubmitHumanInputResponseRequest =\n | {\n outcome: \"answered\";\n answers: HumanInputAnswer[];\n /** Write-only secret values; never echoed in events or responses. */\n secretAnswers?: HumanInputSecretAnswer[] | undefined;\n }\n /**\n * `agentDecides`: \"Let the agent decide\". The asking agent makes its own best\n * choice; accepted even when the request does not allow an ordinary skip, but\n * never for secret questions, Skill reviews or secret approvals.\n */\n | { outcome: \"skipped\"; agentDecides?: true | undefined };\n\nexport type SessionHumanInputRequest = {\n id: string;\n workspaceId: string;\n sessionId: string;\n turnId: string;\n turnGeneration: number;\n creationAttemptId: string;\n toolCallId: string;\n status: \"pending\" | \"answered\" | \"skipped\" | \"expired\" | \"cancelled\";\n /**\n * `secret_use_approval`: Opengeni's own approval card for a blocked secret\n * use, answerable after its turn ends. Absent from older servers, meaning\n * `tool_call`.\n */\n origin?: \"tool_call\" | \"secret_use_approval\" | undefined;\n questions: HumanInputQuestion[];\n allowSkip: boolean;\n response: HumanInputResponse | null;\n respondedBy: string | null;\n respondedAt: string | null;\n expiresAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport const SESSION_EVENT_TYPES = [\n \"usage.threshold_reached\",\n \"usage.exhausted\",\n \"usage.period_reset\",\n \"session.created\",\n \"session.variable_sets.updated\",\n \"session.runtime.configured\",\n // Defensive bounded projection for malformed/legacy oversized envelopes.\n \"session.event.envelope_omitted\",\n \"session.status.changed\",\n \"session.realtime.started\",\n \"session.realtime.ended\",\n \"session.requiresAction\",\n \"session.humanInput.requested\",\n \"session.notification.posted\",\n \"session.notification.withdrawn\",\n \"session.agentCall.ringing\",\n \"session.agentCall.settled\",\n \"session.context.compaction.requested\",\n \"session.context.compaction.started\",\n \"session.context.compacted\",\n \"session.context.compaction.skipped\",\n \"session.context.cleared\",\n \"user.message\",\n \"user.pause\",\n \"user.approvalDecision\",\n \"user.humanInputResponse\",\n \"turn.queued\",\n \"turn.started\",\n \"turn.completed\",\n \"turn.failed\",\n \"turn.cancelled\",\n \"turn.superseded\",\n \"turn.recovery.requested\",\n \"turn.dispatch.expired\",\n \"turn.capacity_waiting\",\n \"turn.startup.phase.started\",\n \"turn.startup.phase.completed\",\n \"turn.startup.phase.failed\",\n \"agent.message.delta\",\n \"agent.message.completed\",\n \"agent.reasoning.delta\",\n \"agent.toolCall.created\",\n \"agent.toolCall.output\",\n \"agent.model.request\",\n \"agent.model.usage\",\n \"tool.auth_needed\",\n \"credential.auth_needed\",\n \"agent.updated\",\n \"rig.setup.started\",\n \"rig.setup.completed\",\n \"rig.setup.skipped\",\n \"rig.setup.failed\",\n \"sandbox.operation.started\",\n \"sandbox.operation.completed\",\n \"sandbox.operation.failed\",\n \"sandbox.recovery.selected\",\n \"session.command.backgrounded\",\n \"session.command.finished\",\n \"session.wait.started\",\n \"session.wait.finished\",\n \"sandbox.command.output.delta\",\n \"artifact.created\",\n \"knowledge.confirmation.recovered\",\n \"instruction.confirmation.recovered\",\n \"knowledge.source.prepared\",\n \"knowledge.source.failed\",\n \"goal.set\",\n \"goal.updated\",\n \"goal.progress\",\n \"goal.rewrite.proposed\",\n \"goal.rewrite.rejected\",\n \"goal.completed\",\n \"goal.paused\",\n \"goal.resumed\",\n \"goal.cleared\",\n \"goal.held\",\n \"goal.continuation\",\n \"system.update.pending\",\n \"system.update.delivered\",\n \"system.update.superseded\",\n \"system.update.cancelled\",\n \"system.update.settled\",\n \"session.control.paused\",\n \"session.control.resumed\",\n \"session.control.steer_requested\",\n \"workspace.inference.paused\",\n \"workspace.inference.resumed\",\n \"session.queue.changed\",\n \"session.queue.prompt.cancelled\",\n \"session.queue.history\",\n \"turn.event.rejected_late\",\n \"memory.saved\",\n \"memory.corrected\",\n // Channel-B desktop pixel-plane signals (mirror of contracts SessionEventType;\n // the contract-parity test asserts sorted equality).\n \"stream.url.rotated\",\n \"stream.opened\",\n \"stream.closed\",\n \"stream.revoked\",\n // Channel-B recording signals (P4.3 — \"agent films itself proving the fix\").\n \"recording.started\",\n \"recording.available\",\n \"recording.failed\",\n // Channel-A structured-service notifications (P4.4; mirror of contracts\n // SessionEventType — the contract-parity test asserts sorted equality).\n \"fs.changed\",\n \"git.changed\",\n \"terminal.pty.started\",\n \"terminal.pty.output.delta\",\n \"terminal.pty.exited\",\n \"session.title_set\",\n \"session.profile_set\",\n \"session.visibility.changed\",\n \"session.personal_resources.attached\",\n \"session.mcp.approval_policy.updated\",\n \"session.tool_policy.updated\",\n \"session.agent.updated\",\n \"session.skills.updated\",\n \"session.resources.removed\",\n \"session.model_settings.updated\",\n // An authorized person or host changed the task root's usage limit.\n \"session.usage_limit.updated\",\n // Multi-account Codex (P1): the session's inference account changed.\n \"codex.account.switched\",\n \"subscription.account.selected\",\n \"subscription.account.switched\",\n \"codex.account.selection.changed\",\n // A person chose the session's account (any provider) or returned it to\n // automatic placement.\n \"model_account.selection.changed\",\n // credential allocator metadata-only per-turn credential selection audit.\n \"codex.credential.selected\",\n // Bounded, identity-free deterministic shadow/replay decision.\n \"codex.fleet.decision\",\n // credential allocator durable zero-capacity wait lifecycle. These are system/runtime\n // events, never synthetic user messages.\n \"codex.capacity.waiting\",\n \"codex.capacity.resumed\",\n \"codex.capacity.superseded\",\n // Sandbox durability observability (mirror of contracts SessionEventType):\n // box lifecycle + manifest-env drift, attributable from the DB alone.\n \"sandbox.box.created\",\n \"sandbox.box.lost\",\n \"sandbox.box.terminated\",\n \"sandbox.box.snapshot\",\n \"sandbox.env.drift\",\n // Active-sandbox pointer reconcile (issue #341; announce-only; mirror of contracts\n // SessionEventType — the contract-parity test asserts sorted equality).\n \"session.route.reconciled\",\n // Workbench v2 turn-end workspace capture (announce-only; mirror of contracts\n // SessionEventType — the contract-parity test asserts sorted equality).\n \"workspace.revision.captured\",\n \"workspace.revision.degraded\",\n // Connected Machine op-outcome observability (announce-only, quiet; mirror of\n // contracts SessionEventType — the contract-parity test asserts sorted equality).\n \"machine.op.failed\",\n \"machine.op.recovered\",\n // Connected Machine link-plane observability (announce-only, quiet; mirror of\n // contracts SessionEventType — the contract-parity test asserts sorted equality).\n \"machine.link.lost\",\n \"machine.link.restored\",\n \"machine.runner.restarted\",\n] as const;\n\nexport type KnownSessionEventType = (typeof SESSION_EVENT_TYPES)[number];\n\n/**\n * Event types the SDK knows about today, kept open so a newer Opengeni server\n * can introduce event types without breaking older SDK consumers.\n */\nexport type SessionEventType = KnownSessionEventType | (string & {});\n\nexport type SessionEvent = {\n id: string;\n workspaceId: string;\n sessionId: string;\n /** Per-session sequence number: positive, contiguous, strictly increasing. */\n sequence: number;\n /** Server-owned durable high-water mark for a synthetic compact event. */\n coveredThrough?: number | undefined;\n type: SessionEventType;\n payload: unknown;\n occurredAt: string;\n clientEventId?: string | null | undefined;\n turnId?: string | null | undefined;\n turnGeneration?: number | null | undefined;\n turnAttemptId?: string | null | undefined;\n turnAssociation?: \"current\" | \"late_rejected\" | \"duplicate\" | null | undefined;\n duplicateOfEventId?: string | null | undefined;\n duplicateReason?: string | null | undefined;\n};\n\nexport type SessionEventSemanticClass =\n | \"control\"\n | \"terminal\"\n | \"failure\"\n | \"checkpoint\"\n | \"tool_receipt\"\n | \"provider_account\";\nexport type SessionEventLatestClass = SessionEventSemanticClass | \"receipt\";\nexport type SessionEventPayloadMode = \"none\" | \"summary\" | \"full\";\nexport type SessionEventReadMode = \"monitoring\" | \"forensic\";\nexport type SessionEventReadDirection = \"after\" | \"before\";\nexport type SessionEventResultMode = \"events\" | \"compact\";\n\ntype SessionEventListCommonOptions = {\n after?: number;\n before?: number;\n limit?: number;\n compact?: boolean;\n mode?: SessionEventReadMode;\n direction?: SessionEventReadDirection;\n payloadMode?: SessionEventPayloadMode;\n resultMode?: \"events\";\n /**\n * With `excludeTypes` containing `agent.toolCall.created`, keep the created\n * rows of presented tools (images, published files, Skill changes). Servers\n * that predate this option ignore it and apply the plain type filter; a\n * server that applies it reports `SessionEventPage.conversationFilter`.\n */\n presentedToolCalls?: \"include\";\n /**\n * With `payloadMode: \"full\"`, return large `agent.toolCall.output` payloads\n * as bounded previews carrying an `outputPreview` fact (see\n * {@link SessionEventToolOutputPreview}). Read one row's exact output with\n * an ordinary full read around its sequence. Servers that predate this\n * option ignore it and return exact outputs.\n */\n toolOutputs?: \"preview\";\n};\n\n/**\n * The fact a previewed `agent.toolCall.output` payload carries in\n * `payload.outputPreview`. `structured` keeps the output's shape with long\n * strings shortened to their head and tail around an omission marker; `text`\n * replaces the output with the head and tail of its text.\n */\nexport type SessionEventToolOutputPreview = {\n truncated: true;\n reason: \"tool_output_preview\";\n shape: \"structured\" | \"text\";\n originalBytes: number;\n previewBytes: number;\n};\n\nexport type SessionEventListOptions = SessionEventListCommonOptions &\n (\n | {\n latest?: never;\n includeTypes?: SessionEventType[];\n excludeTypes?: SessionEventType[];\n includeClasses?: SessionEventSemanticClass[];\n excludeClasses?: SessionEventSemanticClass[];\n }\n | {\n /** Exclusive lookup for the newest event in exactly this semantic class. */\n latest: SessionEventLatestClass;\n includeTypes?: never;\n excludeTypes?: never;\n includeClasses?: never;\n excludeClasses?: never;\n }\n );\n\nexport type SessionEventCompactResult = {\n version: 1;\n semanticClass: SessionEventSemanticClass;\n source: {\n id: string;\n type: SessionEventType;\n sequence: number;\n occurredAt: string;\n turnId: string | null;\n turnGeneration: number | null;\n turnAttemptId: string | null;\n turnAssociation: SessionEvent[\"turnAssociation\"];\n };\n id: string;\n type: SessionEventType;\n sequence: number;\n occurredAt: string;\n turnId: string | null;\n turnGeneration: number | null;\n turnAttemptId: string | null;\n turnAssociation: SessionEvent[\"turnAssociation\"];\n coveredSequence: { first: number; last: number };\n status:\n | \"completed\"\n | \"failed\"\n | \"cancelled\"\n | \"superseded\"\n | \"checkpoint\"\n | \"receipt\"\n | \"unknown\";\n text: string | null;\n output: unknown;\n result: unknown;\n failure: {\n error: string | null;\n code: string | null;\n retryable: boolean | null;\n recovery: string | null;\n } | null;\n checkpoint: unknown;\n receipt: unknown;\n truncation: {\n truncated: boolean;\n fields: string[];\n originalBytes: number | null;\n deliveredBytes: number;\n };\n};\n\nexport type SessionEventCompactResultOptions = {\n latest: SessionEventLatestClass;\n resultMode: \"compact\";\n mode?: SessionEventReadMode;\n payloadMode?: SessionEventPayloadMode;\n};\n\nexport type SessionEventPage = {\n events: SessionEvent[];\n mode: SessionEventReadMode;\n payloadMode: SessionEventPayloadMode;\n direction: SessionEventReadDirection;\n bytes: number;\n maxBytes: number;\n truncated: boolean;\n hasMore: boolean;\n truncatedBy: \"count\" | \"bytes\" | \"http_bytes\" | null;\n coveredSequence: { first: number; last: number } | null;\n nextAfter: number | null;\n nextBefore: number | null;\n forensicExact: boolean;\n /**\n * The conversation-filter version the server applied to a\n * `presentedToolCalls: \"include\"` read (see\n * `SESSION_EVENT_CONVERSATION_FILTER_VERSION`), or null when it announced\n * none: an older server may have ignored `presentedToolCalls`.\n */\n conversationFilter?: number | null;\n};\n\nexport type ToolAuthNeededPayload = {\n serverId: string;\n /** Configured connector for recovery; serverId retains the execution alias. */\n canonicalServerId?: string | undefined;\n /** Scope of the exact failed account, not the canonical catalog default. */\n connectionSubjectScope?: \"workspace\" | \"subject\" | undefined;\n toolName?: string | null | undefined;\n providerDomain: string;\n provider?: string | undefined;\n connectionId?: string | null | undefined;\n authoritySource?: \"host\" | undefined;\n reason:\n | \"missing_connection\"\n | \"expired\"\n | \"insufficient_scope\"\n | \"refresh_failed\"\n | \"personal_authority_unavailable\"\n | \"unsupported_auth\"\n | \"resource_scope_unavailable\"\n | \"designated_credential_unavailable\";\n hostReason?:\n | \"missing_connection\"\n | \"expired\"\n | \"insufficient_scope\"\n | \"refresh_failed\"\n | \"personal_authority_unavailable\"\n | \"unsupported_auth\"\n | \"resource_scope_unavailable\"\n | \"designated_credential_unavailable\"\n | undefined;\n scopes?: string[] | undefined;\n resource?: string | undefined;\n selectedResources?: Array<{ id: string; kind: \"repository\" }> | undefined;\n authorizationUrl?: string | undefined;\n subjectId?: string | null | undefined;\n capability?:\n | {\n id: string;\n name: string;\n kind: CapabilityKind;\n source: CapabilitySource;\n action: \"connect\" | \"add_credentials\" | \"enable\";\n rationale: string;\n requiredVariables: string[];\n }\n | undefined;\n /** Agent suggestion; never a connection or permission grant. */\n setupRequest?:\n | {\n kind: \"mcp\";\n ownership?: \"personal\" | \"workspace\" | undefined;\n mcpSetup?: import(\"@opengeni/contracts/prepared-mcp-setup\").PreparedMcpSetup | undefined;\n name: string;\n endpointUrl: string;\n rationale: string;\n }\n | undefined;\n /** The Connected Machine the agent asked for; names the request, grants nothing. */\n requestedSandboxId?: string | undefined;\n /** `chrome`: a Connected Machine card posted because the agent needs the person's own Chrome. */\n purpose?: \"chrome\" | undefined;\n};\n\n// Payload shapes for the high-traffic event types. `SessionEvent.payload` is\n// `unknown` on the wire; these are the documented shapes producers emit today.\nexport type AgentTextDeltaPayload = { text: string };\nexport type AgentMessageCompletedPayload = { text: string };\nexport type AgentToolCallCreatedPayload = {\n id: string | null;\n name: string;\n arguments: unknown;\n raw?: unknown | undefined;\n /**\n * Content-free analytics family: an Opengeni first-party tool name,\n * `integration:<reviewed domain>`, or `custom`. Absent when unclassified.\n */\n toolFamily?: string | undefined;\n};\nexport type AgentToolCallOutputPayload = { id: string | null; output: unknown };\nexport type SessionStatusChangedPayload = { status: SessionStatus };\n\n// Adaptive-fleet shadow event. This is the typed, identity-free view\n// consumed by UI/manager tooling; the durable replay record also contains the\n// complete normalized policy/input needed for offline deterministic replay.\nexport type CodexFleetConfidence = \"unknown\" | \"low\" | \"medium\" | \"high\";\nexport type CodexFleetCacheState = \"unknown\" | \"healthy\" | \"collapsed\";\nexport type CodexFleetShadowComparison =\n | \"match\"\n | \"different_candidate\"\n | \"different_outcome\"\n | \"not_comparable_truncated\";\nexport type CodexFleetDecisionScore = {\n candidateKey: string;\n eligible: boolean;\n rejectionReason:\n | \"allocator_disabled\"\n | \"unavailable\"\n | \"cooling\"\n | \"quota_ceiling\"\n | \"overlay_isolation\"\n | null;\n quotaPressure: number;\n leasePressure: number;\n observedBurnPressure: number;\n inferredBurnPressure: number;\n runwayPressure: number;\n uncertaintyPressure: number;\n cacheAffinityBenefit: number;\n cacheState: CodexFleetCacheState;\n overlayPreferenceBenefit: number;\n total: number;\n confidence: CodexFleetConfidence;\n};\nexport type CodexFleetDecisionEventPayload = {\n schemaVersion: 1;\n mode: \"shadow\";\n actual: {\n outcome: \"selected\" | \"waiting\" | \"none\";\n candidateKey: string | null;\n reason:\n | \"lease_reused\"\n | \"pin\"\n | \"rotation\"\n | \"active\"\n | \"all_capped\"\n | \"allocator_disabled\"\n | \"none\";\n };\n comparison: CodexFleetShadowComparison;\n replay: {\n schemaVersion: 1;\n policyVersion: \"adaptive-shadow-v1\";\n mode: \"shadow\";\n input: { candidates: Array<{ key: string }> } & Record<string, unknown>;\n truncatedCandidateCount: number;\n inputFingerprint: string;\n decisionFingerprint: string;\n decision: {\n outcome: \"selected\" | \"paced\" | \"none\";\n selectedCandidateKey: string | null;\n reason:\n | \"fenced_in_flight\"\n | \"fenced_candidate_missing\"\n | \"admission_paced\"\n | \"no_eligible_candidate\"\n | \"overlay_isolated_empty\"\n | \"best_score\"\n | \"affinity_best\"\n | \"hysteresis_hold\";\n admission: {\n outcome: \"admit\" | \"pace\";\n reason:\n | \"fenced_in_flight\"\n | \"pacing_disabled\"\n | \"capacity_unknown\"\n | \"capacity_available\"\n | \"work_conserving_borrow\"\n | \"manager_priority\"\n | \"standard_starvation_bound\"\n | \"capacity_saturated\"\n | \"emergency_fuse\";\n borrowedIdleCapacity: boolean;\n };\n borrowedOverlayCapacity: boolean;\n strandedEligibleCount: number;\n confidence: CodexFleetConfidence;\n scores: CodexFleetDecisionScore[];\n };\n } & Record<string, unknown>;\n};\n\n// Recording payloads (P4.3 — plain TS mirror of the contracts Zod schemas).\n// These are TYPES, not Zod (F15), so ordinary SDK entries remain runtime-clean.\n// The contract-parity test asserts the event-type literals; these shapes\n// document the wire payloads.\nexport type RecordingMode = \"manual\" | \"on-turn\" | \"on-verify\";\nexport type RecordingCodec = \"h264-mp4\" | \"vp9-webm\";\nexport type RecordingContentType = \"video/mp4\" | \"video/webm\";\nexport type RecordingFailedReason =\n | \"ffmpeg-error\"\n | \"box-death\"\n | \"box-rollover\"\n | \"upload-failed\"\n | \"max-bytes-exceeded\"\n | \"display-unavailable\";\n\nexport type RecordingStartedPayload = {\n recordingId: string;\n turnId: string | null;\n mode: RecordingMode;\n codec: RecordingCodec;\n dimensions: [number, number];\n framerate: number;\n startedAt: string;\n reason?: string | null | undefined;\n};\nexport type RecordingAvailablePayload = {\n recordingId: string;\n turnId: string | null;\n codec: RecordingCodec;\n contentType: RecordingContentType;\n storageKey: string;\n durationSeconds: number | null;\n sizeBytes: number;\n dimensions: [number, number];\n};\nexport type RecordingFailedPayload = {\n recordingId: string;\n turnId: string | null;\n reason: RecordingFailedReason;\n detail?: string | null | undefined;\n};\n\n// ── Channel-A structured services (P4.4) — hand-written wire mirrors ─────────\n\n// A1 notification payloads.\nexport type SandboxCommandOutputDeltaPayload = {\n stream: \"stdout\" | \"stderr\";\n chunk: string;\n commandId?: string | undefined;\n seq?: number | undefined;\n};\nexport type FsChangeKind = \"created\" | \"modified\" | \"deleted\" | \"renamed\";\nexport type FsChangedPayload = {\n changes: {\n path: string;\n kind: FsChangeKind;\n isDir: boolean;\n sizeBytes: number | null;\n oldPath?: string | undefined;\n }[];\n source: \"write\" | \"watch\" | \"agent\";\n revision: number;\n leaseEpoch: number;\n};\nexport type GitChangedPayload = {\n head: string | null;\n dirty: boolean;\n ahead: number;\n behind: number;\n changedFileCount: number;\n reason: \"commit\" | \"checkout\" | \"stage\" | \"worktree\" | \"fetch\" | \"unknown\";\n revision: number;\n leaseEpoch: number;\n};\nexport type TerminalPtyStartedPayload = {\n ptyId: string;\n cols: number;\n rows: number;\n shell: string;\n cwd: string;\n};\nexport type TerminalPtyOutputDeltaPayload = {\n ptyId: string;\n stream: \"stdout\" | \"stderr\";\n chunk: string;\n seq: number;\n};\nexport type TerminalPtyExitedPayload = {\n ptyId: string;\n exitCode: number | null;\n reason: \"exit\" | \"killed\" | \"owner_gone\" | \"timeout\" | \"lost\";\n};\n\n// A2 FileSystem request/response.\nexport type FsNodeType = \"file\" | \"dir\" | \"symlink\" | \"other\";\nexport type FsTreeNode = {\n name: string;\n path: string;\n type: FsNodeType;\n sizeBytes: number | null;\n mtimeMs: number | null;\n mode: number | null;\n children?: FsTreeNode[] | undefined;\n truncated: boolean;\n};\nexport type FsEncoding = \"utf8\" | \"base64\";\nexport type FileSystemRouteIdentity = {\n epoch: number;\n root: string;\n};\nexport type FsListRequest = {\n path?: string;\n depth?: number;\n maxEntries?: number;\n includeHidden?: boolean;\n route?: FileSystemRouteIdentity;\n};\nexport type FsListResponse = {\n root: FsTreeNode;\n revision: number;\n truncated: boolean;\n};\nexport type FsListBatchRequest = { requests: FsListRequest[] };\nexport type FsListBatchResponse = { results: FsListResponse[] };\nexport type FsReadRequest = {\n path: string;\n /** Confine this read to the session's working directory, refusing symlinks. */\n workspaceOnly?: boolean;\n encoding?: FsEncoding;\n maxBytes?: number;\n route?: FileSystemRouteIdentity;\n};\nexport type FsReadResponse = {\n path: string;\n encoding: FsEncoding;\n content: string;\n sizeBytes: number;\n truncated: boolean;\n isBinary: boolean;\n revision: number;\n};\nexport const SANDBOX_FILE_ARTIFACT_MAX_BYTES = 5_000_000_000;\nexport type PublishSandboxFileArtifactRequest = {\n path: string;\n /** Who can open the file. Omitted: the chat's own audience. */\n visibility?: \"private\" | \"workspace\";\n};\nexport type SandboxFileArtifactReceipt = {\n type: \"sandbox_file\";\n sandboxPath: string;\n filename: string;\n artifact: RetainedArtifactReference;\n /** Who can open the file; absent from receipts made before files had audiences. */\n access?: FileAccess | undefined;\n};\nexport type FsWriteRequest = {\n path: string;\n encoding?: FsEncoding;\n content: string;\n overwrite?: boolean;\n createParents?: boolean;\n route?: FileSystemRouteIdentity;\n};\nexport type FsWriteResponse = {\n path: string;\n sizeBytes: number;\n revision: number;\n};\nexport type FsDeleteRequest = {\n path: string;\n recursive?: boolean;\n route?: FileSystemRouteIdentity;\n};\nexport type FsDeleteResponse = { revision: number };\nexport type FsMoveRequest = {\n path: string;\n newPath: string;\n overwrite?: boolean;\n createParents?: boolean;\n route?: FileSystemRouteIdentity;\n};\nexport type FsMoveResponse = {\n path: string;\n newPath: string;\n revision: number;\n};\nexport type FsMkdirRequest = {\n path: string;\n recursive?: boolean;\n route?: FileSystemRouteIdentity;\n};\nexport type FsMkdirResponse = { path: string; revision: number };\n\n// A2 Git request/response (the Pierre-diff feed).\nexport type GitFileStatusCode =\n | \"added\"\n | \"modified\"\n | \"deleted\"\n | \"renamed\"\n | \"copied\"\n | \"untracked\"\n | \"ignored\"\n | \"conflicted\"\n | \"typechange\";\nexport type GitFileStatus = {\n path: string;\n oldPath: string | null;\n index: GitFileStatusCode | null;\n worktree: GitFileStatusCode | null;\n isConflicted: boolean;\n};\nexport type GitStatusRequest = { path?: string };\nexport type GitStatusResponse = {\n isRepo: boolean;\n head: string | null;\n /** Exact commit object identity. null for unborn/non-repositories; absent on\n * legacy adapters. */\n headOid?: string | null | undefined;\n detached: boolean;\n upstream: string | null;\n ahead: number;\n behind: number;\n files: GitFileStatus[];\n revision: number;\n};\nexport type GitDiffLineType = \"context\" | \"add\" | \"del\" | \"meta\";\nexport type GitDiffLine = {\n type: GitDiffLineType;\n oldNo: number | null;\n newNo: number | null;\n text: string;\n};\nexport type GitDiffHunk = {\n oldStart: number;\n oldLines: number;\n newStart: number;\n newLines: number;\n header: string;\n lines: GitDiffLine[];\n};\nexport type GitFileDiff = {\n path: string;\n oldPath: string | null;\n status: GitFileStatusCode;\n isBinary: boolean;\n isImage: boolean;\n additions: number;\n deletions: number;\n hunks: GitDiffHunk[];\n truncated: boolean;\n};\nexport type GitDiffRequest = {\n path?: string;\n staged?: boolean;\n includeUntracked?: boolean;\n fromRef?: string;\n toRef?: string;\n pathspec?: string[];\n contextLines?: number;\n maxBytesPerFile?: number;\n};\nexport type GitDiffResponse = { files: GitFileDiff[]; revision: number };\nexport type GitReadBatchItemRequest = {\n status: GitStatusRequest;\n diff?: GitDiffRequest;\n};\nexport type GitReadBatchRequest = { requests: GitReadBatchItemRequest[] };\nexport type GitReadBatchItemResponse = {\n status: GitStatusResponse;\n diff?: GitDiffResponse;\n};\nexport type GitReadBatchResponse = { results: GitReadBatchItemResponse[] };\nexport type GitLogRequest = {\n path?: string;\n ref?: string;\n maxCount?: number;\n skip?: number;\n pathspec?: string[];\n};\nexport type GitCommit = {\n sha: string;\n shortSha: string;\n parents: string[];\n author: { name: string; email: string; timestamp: number };\n committer: { name: string; email: string; timestamp: number };\n subject: string;\n body: string;\n refs: string[];\n};\nexport type GitLogResponse = { commits: GitCommit[]; hasMore: boolean };\nexport type GitShowRequest = {\n path?: string;\n ref: string;\n filePath?: string;\n encoding?: FsEncoding;\n maxBytesPerFile?: number;\n};\nexport type GitShowResponse = {\n commit: GitCommit | null;\n files: GitFileDiff[];\n blob: {\n content: string;\n encoding: FsEncoding;\n sizeBytes: number;\n truncated: boolean;\n } | null;\n revision: number;\n};\n\n// Workbench v2 turn-end capture (mirror of `@opengeni/contracts` WorkspaceCapture*\n// + the M2 read-API response shapes). Reuses FsTreeNode /\n// GitFileStatus / GitFileDiff / GitFileStatusCode / FsEncoding above.\nexport type WorkspaceCaptureFile = {\n path: string;\n status: GitFileStatusCode;\n hash: string | null;\n baseHash: string | null;\n contentRef: string | null;\n sizeBytes: number;\n isBinary: boolean;\n tooLarge: boolean;\n deleted: boolean;\n};\nexport type WorkspaceCaptureRepo = {\n root: string;\n head: string | null;\n /** Exact HEAD commit object identity. null for unborn repositories; absent\n * on legacy captures. */\n headOid?: string | null | undefined;\n detached: boolean;\n upstream: string | null;\n ahead: number;\n behind: number;\n status: GitFileStatus[];\n diff: GitFileDiff[];\n /** Current branch vs the remote default branch. Absent on legacy captures or\n * repositories whose remote default ref could not be resolved. */\n branchDiff?: GitFileDiff[] | undefined;\n};\nexport type WorkspaceCaptureDegradedReason =\n | \"repository_discovery_command_failed\"\n | \"repository_discovery_timed_out\"\n | \"repository_discovery_result_limit_exceeded\"\n | \"repository_read_unavailable\";\nexport type WorkspaceCaptureStats = {\n repoCount: number;\n fileCount: number;\n additions: number;\n deletions: number;\n totalBytes: number;\n tooLargeCount: number;\n binaryCount: number;\n treeEntryCount: number;\n treeTruncated: boolean;\n durationMs: number;\n fingerprint?: string;\n};\nexport type WorkspaceCaptureManifest = {\n version: 1;\n revision: number;\n capturedAt: string;\n turnId: string | null;\n leaseEpoch: number;\n treeIndex: FsTreeNode;\n treeTruncated: boolean;\n repos: WorkspaceCaptureRepo[];\n files: WorkspaceCaptureFile[];\n stats: WorkspaceCaptureStats;\n};\nexport type WorkspaceRevisionCapturedPayload = {\n revision: number;\n turnId: string | null;\n capturedAt: string;\n leaseEpoch: number;\n stats: WorkspaceCaptureStats;\n};\nexport type WorkspaceRevisionDegradedPayload = {\n revision: number;\n turnId: string | null;\n capturedAt: string;\n leaseEpoch: number;\n reason: WorkspaceCaptureDegradedReason;\n};\nexport type WorkspaceCaptureSignedUrl = { url: string; expiresAt: string };\n// GET …/workspace/capture. Exactly one of manifest/manifestUrl is non-null.\nexport type GetWorkspaceCaptureResponse =\n | {\n available: false;\n degradedReason?: WorkspaceCaptureDegradedReason | null;\n revision?: number | null;\n capturedAt?: string | null;\n turnId?: string | null;\n leaseEpoch?: number | null;\n }\n | {\n available: true;\n revision: number;\n capturedAt: string;\n turnId: string | null;\n leaseEpoch: number;\n sizeBytes: number;\n stats: WorkspaceCaptureStats;\n manifest: WorkspaceCaptureManifest | null;\n manifestUrl: WorkspaceCaptureSignedUrl | null;\n };\n// GET …/workspace/capture/file. content inline (≤256KB) OR contentUrl OR marker\n// only (tooLarge / missing blob).\nexport type GetWorkspaceCaptureFileResponse = {\n path: string;\n revision: number;\n status: GitFileStatusCode;\n hash: string | null;\n baseHash: string | null;\n sizeBytes: number;\n isBinary: boolean;\n tooLarge: boolean;\n encoding: FsEncoding | null;\n content: string | null;\n contentUrl: WorkspaceCaptureSignedUrl | null;\n};\n\n// A2 Terminal exec + PTY.\nexport type TerminalExecRequest = {\n command: string;\n cwd?: string;\n timeoutMs?: number;\n emitStream?: boolean;\n};\nexport type TerminalExecResponse = {\n stdout: string;\n stderr: string;\n exitCode: number;\n running: false;\n wallTimeSeconds: number;\n};\nexport type PtyOpenRequest = {\n cols?: number;\n rows?: number;\n cwd?: string;\n shell?: string;\n};\nexport type PtyOpenResponse = {\n ptyId: string;\n streamVia: \"sse-events\";\n supportsInput: boolean;\n};\nexport type PtyWriteRequest = { ptyId: string; data: string };\nexport type PtyResizeRequest = { ptyId: string; cols: number; rows: number };\nexport type PtyCloseRequest = { ptyId: string };\n\nexport type SessionStructuredCapabilities = {\n FileSystem: { available: boolean; readOnly: boolean; root: string };\n Terminal: { events: boolean; exec: boolean; pty: { available: boolean } };\n Git: { available: boolean; repos: string[] };\n};\n\nexport type ScheduledTaskStatus = \"active\" | \"paused\";\n\nexport type ScheduledTaskRunMode = \"new_session_per_run\" | \"reusable_session\" | \"existing_session\";\n\nexport type ScheduledTaskOverlapPolicy = \"allow_concurrent\" | \"skip\" | \"buffer_one\" | \"steer\";\n\nexport type ScheduledTaskDayOfWeek =\n | \"SUNDAY\"\n | \"MONDAY\"\n | \"TUESDAY\"\n | \"WEDNESDAY\"\n | \"THURSDAY\"\n | \"FRIDAY\"\n | \"SATURDAY\";\n\nexport type ScheduledTaskScheduleSpec =\n | { type: \"manual\" }\n | { type: \"once\"; runAt: string; timeZone: string }\n | {\n type: \"interval\";\n everySeconds: number;\n startAt?: string | undefined;\n endAt?: string | undefined;\n }\n | {\n type: \"calendar\";\n timeZone: string;\n hour: number;\n minute: number;\n daysOfWeek?: ScheduledTaskDayOfWeek[] | undefined;\n };\n\nexport type IncidentTelemetrySeriesMetadata = {\n metric: string;\n labels: string[];\n};\n\nexport type IncidentTelemetryDataRoute =\n | { kind: \"mcp\"; serverId: string }\n | { kind: \"first_party\"; tool: FirstPartyMcpToolName }\n | { kind: \"vault\"; vaultName: string; secretNames: string[] }\n | { kind: \"rig_credential_hook\"; credentialHookId: string };\n\nexport type IncidentTelemetryPreflight = {\n requiredResources: ResourceRef[];\n requiredMcpServerIds: string[];\n requiredFirstPartyMcpTools: FirstPartyMcpToolName[];\n requiredFirstPartyMcpPermissions: KnownPermission[];\n requiredRig: { name: string; credentialHookIds: string[] } | null;\n requiredVaultNames: string[];\n requiredSecretNames: string[];\n dataSource: {\n kind: \"prometheus\";\n queryPath: \"/api/v1/query\" | \"/api/v1/query_range\";\n workspaceLabel: string;\n alertSelectorLabels: string[];\n route: IncidentTelemetryDataRoute;\n requiredSeries: IncidentTelemetrySeriesMetadata[];\n availableSeries: IncidentTelemetrySeriesMetadata[];\n };\n};\n\nexport type IncidentTelemetryPreflightInput = Omit<\n IncidentTelemetryPreflight,\n | \"requiredResources\"\n | \"requiredMcpServerIds\"\n | \"requiredFirstPartyMcpTools\"\n | \"requiredFirstPartyMcpPermissions\"\n | \"requiredRig\"\n | \"requiredVaultNames\"\n | \"requiredSecretNames\"\n> & {\n requiredResources?: ResourceRef[] | undefined;\n requiredMcpServerIds?: string[] | undefined;\n requiredFirstPartyMcpTools?: FirstPartyMcpToolName[] | undefined;\n requiredFirstPartyMcpPermissions?: KnownPermission[] | undefined;\n requiredRig?: { name: string; credentialHookIds?: string[] | undefined } | null | undefined;\n requiredVaultNames?: string[] | undefined;\n requiredSecretNames?: string[] | undefined;\n};\n\nexport type ScheduledTaskAgentConfig = {\n /** Agent configuration for every generated session; omitted keeps legacy behavior. */\n agent?: AgentConfigRequest | undefined;\n /**\n * Connector accounts a person pinned for a schedule that starts its own\n * session. Each pinned pair narrows its connector; every other connector\n * uses the owner's current accounts at each run.\n */\n pinnedAccounts?: McpConnectionAccountSelection[] | undefined;\n /** Skip an occurrence instead of running without an unusable pinned account. */\n pinnedAccountsRequired?: true | undefined;\n knowledgeSource?: Extract<ScheduledTaskAction, { kind: \"knowledge_source_sync\" }> | undefined;\n bundledSkillIds?: BundledSkillId[] | undefined;\n prompt: string;\n resources: ResourceRef[];\n tools: ToolRef[];\n /**\n * Present when runs follow the workspace's default connectors (minus the\n * excluded ones) plus `tools`; absent when runs get exactly `tools`.\n */\n toolPolicy?: ScheduledTaskToolPolicy | undefined;\n metadata: Record<string, unknown>;\n slackBotConnectionId?: string | undefined;\n /** Slack channel a person chose for this task's bot posts; requires slackBotConnectionId. */\n slackBotChannelId?: string | undefined;\n model?: string | undefined;\n reasoningEffort?: ReasoningEffort | undefined;\n sandboxBackend?: SandboxBackend | undefined;\n /** Follow the workspace machine when creating each new run chat. */\n executionTarget?: \"workspace_default\" | undefined;\n machineTarget?: { targetSandboxId: string; workingDir?: string | undefined } | undefined;\n goal?: GoalSpec | undefined;\n executionClass?: \"incident_telemetry\" | undefined;\n incidentTelemetryPreflight?: IncidentTelemetryPreflight | undefined;\n maxNestedAgentDepth?: number | undefined;\n /** Seconds a run may wait on a person before the scheduler answers for it. */\n approvalTimeoutSeconds?: number | undefined;\n /** Whether the chats this task starts run unattended; see the request type. */\n unattended?: boolean | undefined;\n /** Remote MCP servers attached to each chat the task starts. */\n mcpServers?: ScheduledTaskMcpServer[] | undefined;\n /** Memory, agent reach and inline Skills of each chat the task starts. */\n memoryScope?: SessionMemoryScope | undefined;\n agentAccess?: SessionAgentAccess | undefined;\n skills?: ScheduledTaskSkill[] | undefined;\n};\n\n/** A session-create MCP server without static headers, for chats a task starts. */\nexport type ScheduledTaskMcpServer = Omit<SessionMcpServerInput, \"headers\">;\n\nexport type ScopedKnowledgeScope =\n | { kind: \"organization\"; workspaceId: null; subjectId: null }\n | { kind: \"workspace\"; workspaceId: string; subjectId: null }\n | { kind: \"personal\"; workspaceId: string | null; subjectId: string };\n\nexport type KnowledgeSourceSyncLimits = {\n maxItems: number;\n maxBytes: number;\n maxFileBytes: number;\n maxProviderRequests: number;\n maxElapsedSeconds: number;\n maxConcurrency: number;\n maxFailureDetails: number;\n};\n\nexport type ScheduledTaskAction =\n | { kind: \"agent_turn\" }\n | {\n kind: \"knowledge_source_sync\";\n sourceId: string;\n sourceGeneration: number;\n sourceLifecycleGeneration: number;\n sourceConfigGeneration: number;\n controlWorkspaceId: string;\n providerCoordinationKey: string;\n connection: {\n connectionId: string;\n connectionVersion: number;\n providerDomain: string;\n kind: ConnectionKind;\n ownerSubjectId: string;\n };\n destination: ScopedKnowledgeScope;\n initiatingSubjectId: string;\n allDescendants: boolean;\n limits: KnowledgeSourceSyncLimits;\n };\n\nexport type ScheduledTask = {\n id: string;\n accountId: string;\n workspaceId: string;\n name: string;\n /** Immutable execution owner; null for workspace/service tasks. */\n ownerSubjectId: string | null;\n /**\n * Who can see this schedule. `workspace`: everyone in the workspace.\n * `private`: only its owner; its runs create Only me chats owned by them.\n */\n visibility: SessionVisibility;\n status: ScheduledTaskStatus;\n schedule: ScheduledTaskScheduleSpec;\n temporalScheduleId: string;\n runMode: ScheduledTaskRunMode;\n overlapPolicy: ScheduledTaskOverlapPolicy;\n action: ScheduledTaskAction;\n agentConfig: ScheduledTaskAgentConfig;\n createdBy?: TurnInitiator | undefined;\n createdByContext?: TurnInitiatorContext | undefined;\n authorityRevision: number;\n executionDigest: string;\n targetSessionId: string | null;\n reusableSessionId: string | null;\n // The rig each run binds to (M3); active version resolved per fire. Null ⇒ rig-less.\n rigId: string | null;\n /** Vaults every run may resolve secret references from (the task vault is always included). */\n vaultPolicy?: VaultPolicy | undefined;\n metadata: Record<string, unknown>;\n /**\n * Present and true when the task was created locked: only its creator (the\n * same key or signed service identity) can change, run, resume or delete\n * it, never an agent. A workspace admin can still pause it.\n */\n creatorLocked?: true | undefined;\n createdAt: string;\n updatedAt: string;\n /** Read-only: what `refreshScheduledTaskAccess` would change, for a viewer who can act on it. */\n policyDrift?: ScheduledTaskPolicyDrift | null | undefined;\n /** Read-only: which accounts a run would use if it started now, for a viewer who can act on it. */\n accountPlan?: ScheduledTaskAccountPlan | undefined;\n /** Read-only: why it paused itself, or why its owner was told its runs keep failing. */\n blocker?: ScheduledTaskBlocker | undefined;\n /** Read-only: its event triggers and event run policy; absent without event triggers. */\n events?: ScheduledTaskEvents | undefined;\n};\n\n/**\n * What blocks a schedule. `paused`: no later run could start until a person\n * acts, so it paused itself; resume it once the cause is fixed. `notified`:\n * its scheduled runs kept failing or being skipped and its owner was told\n * once; it keeps running. `message` says what would unblock it.\n */\nexport type ScheduledTaskBlocker = {\n state: \"paused\" | \"notified\";\n /** Stable machine reason, such as `scheduled_session_paused`; tolerate new ones. */\n reason: string;\n message: string;\n /** The run that showed the blocker (the first of a failing streak). */\n runId: string;\n since: string;\n};\n\n/**\n * What an admin sees of someone else's Only me schedule: that it exists, whose\n * it is, how often it runs and what it costs. Never its name, prompt, settings\n * or runs.\n */\nexport type PrivateScheduledTaskSummary = {\n id: string;\n ownerSubjectId: string;\n /** The owner's display name or email, when known. */\n ownerName: string | null;\n status: ScheduledTaskStatus;\n schedule: ScheduledTaskScheduleSpec;\n lastRunAt: string | null;\n /** Usage of this schedule's runs over the last 30 days. */\n last30Days: { runs: number; creditUsd: number; estimatedProviderUsd: number };\n createdAt: string;\n};\n\n/** One connector named in a scheduled task's access report. */\nexport type ScheduledTaskAccessConnector = {\n id: string;\n name: string;\n};\n\n/**\n * A schedule that follows the workspace's default connectors at each run,\n * the way a new chat does. Connectors a person turned off stay off.\n */\nexport type ScheduledTaskToolPolicy = {\n mode: \"workspace_default\";\n excludedMcpServerIds: string[];\n};\n\n/**\n * What a scheduled task's saved connectors and Opengeni tools lack compared\n * with what its owner would get by saving it again now, plus pinned accounts\n * that can no longer be used.\n */\nexport type ScheduledTaskPolicyDrift = {\n /** Workspace default connectors that new schedules get and this one lacks. */\n missingConnectors: ScheduledTaskAccessConnector[];\n /** Connectors this schedule names that this workspace no longer sets up; refresh drops them. */\n unavailableConnectors: ScheduledTaskAccessConnector[];\n /** Default Opengeni tools missing from an agent-created task's frozen tools. */\n missingOpenGeniTools: FirstPartyMcpToolName[];\n /** Connectors whose pinned account can no longer be used; runs continue without them. */\n unavailableAccounts: ScheduledTaskAccessConnector[];\n /** Whether this viewer may run the refresh (a signed-in person, not a key or agent). */\n canRefresh: boolean;\n};\n\n/** One connector account a scheduled run would act as. */\nexport type ScheduledTaskAccountPlanAccount = {\n connectionId: string;\n label: string;\n /** `personal`: the schedule owner's own account. `shared`: a workspace account. */\n scope: \"personal\" | \"shared\";\n};\n\nexport type ScheduledTaskAccountPlanConnector = {\n id: string;\n name: string;\n /** `default`: the owner's current accounts at each run. `pinned`: only the accounts a person chose. */\n mode: \"default\" | \"pinned\";\n /** Accounts a run would use if it started now; empty when none can be used. */\n accounts: ScheduledTaskAccountPlanAccount[];\n /** Pinned accounts that can no longer be used; always empty in `default` mode. */\n unavailablePins: Array<{ connectionId: string }>;\n};\n\n/**\n * Which connector accounts a run of this schedule would use if it started\n * now, resolved at read time from the owner's live connections. Nothing here\n * is stored.\n */\nexport type ScheduledTaskAccountPlan = {\n connectors: ScheduledTaskAccountPlanConnector[];\n};\n\n/** Re-freeze with the caller's current authority; `executionDigest` is the reviewed head. */\nexport type RefreshScheduledTaskAccessRequest = {\n executionDigest: string;\n /** Default connectors and Opengeni tools to keep off; only narrows what the refresh adds. */\n leaveOut?:\n | {\n connectors?: string[] | undefined;\n openGeniTools?: FirstPartyMcpToolName[] | undefined;\n }\n | undefined;\n};\n\nexport type CreateSessionRequest = {\n /** Omitted: defaults/inheritance; []: no bundled guidance. Children cannot widen. */\n bundledSkillIds?: BundledSkillId[] | undefined;\n excludedMcpServerIds?: string[] | undefined;\n // Optional UUID preallocated by an embedding host so it can durably link its\n // projection before Opengeni admits the initial turn. Replays must retain the\n // same UUID and idempotency key.\n requestedSessionId?: string | undefined;\n /**\n * Optional usage limit for a new root task in USD micros of API-equivalent\n * model usage (null/omitted: no limit; 0: stop before the first model\n * request). Person or trusted host only. `OpenGeniClient.createSession`\n * sends a limited create with `startMode: \"standard\"`, which servers that\n * predate usage limits reject before creating or starting anything; it then\n * throws `OpenGeniSessionUsageLimitUnsupportedError`, as it does for a\n * response that does not echo the requested limit.\n */\n usageLimitMicros?: number | null | undefined;\n visibility?: SessionVisibility | undefined;\n initialMessage?: string | undefined;\n /** Exempt the new session from the idle-session archive, e.g. for a persistent agent. */\n keepLive?: boolean | undefined;\n /**\n * No person will see or answer questions until the task ends (an API\n * automation or other headless run). The agent is told so and resolves open\n * choices itself instead of asking; tools that wait for a person are not\n * offered, and a call that needs someone's approval is refused instead of\n * waiting. A person's later message does not change it; turn it off with\n * `updateSessionUnattended`. Not inherited by child sessions, and a fork\n * reads as attended. Servers that predate it ignore it.\n */\n unattended?: boolean | undefined;\n /**\n * The new chat's name, description and avatar, as if a person set them (a\n * bot started from a template, for example). Display metadata only; never\n * sent to the model.\n */\n profile?:\n | {\n title?: string | undefined;\n description?: string | undefined;\n avatar?: SessionAvatar | undefined;\n }\n | undefined;\n /**\n * `realtime` creates an idle session shell so realtime voice can be the\n * first interaction. `standard` is the explicit default; `createSession`\n * sends it with a usage limit so servers that predate limits reject the\n * create instead of starting uncapped work.\n */\n startMode?: \"realtime\" | \"standard\" | undefined;\n /** Model-visible application context attached to the initial user message; omitted by standard timeline rendering. */\n modelContext?: string | undefined;\n /**\n * Tools `modelContext` is for, such as the tool that reaches the open\n * document it names, or the tools an application's MCP server publishes for\n * the record it names (by their published names). The first turn loads them\n * before its first model request, as a tool search by name would, so it can\n * use them without searching; the session's tools are unchanged. Decided\n * once at creation; names outside the session's tool selection are ignored.\n */\n modelContextTools?: string[] | undefined;\n /**\n * IANA time zone of the person sending `initialMessage` (for example\n * `Europe/Oslo`), so the model sees the message's local time. In a browser\n * or app the client fills in the device's zone when this is omitted;\n * invalid names are dropped.\n */\n timeZone?: string | undefined;\n // Per-session agent persona/system instructions (org-visible metadata, not a\n // secret). Delivered system-level, composed AFTER the per-workspace persona —\n // how a host supplies per-agent-type prompts without leaking them into the\n // user-visible timeline. Trimmed, non-empty, max 65536 chars.\n instructions?: string | undefined;\n /** Immutable normalized prompt-policy role; distinct from membership roles. */\n policyRole?: string | undefined;\n resources?: ResourceRef[] | undefined;\n /** Inline skills fixed onto this session; omitted children inherit them. */\n skills?: SessionSkillInput[] | undefined;\n /** Installed session-selected Skill identities to freeze onto this session at creation. */\n installedSkillIds?: string[] | undefined;\n /**\n * MCP servers to select. Omitted follows the workspace defaults; an explicit\n * array (including `[]`) is an exact allow-list over workspace/deployment\n * servers. Servers attached in this request's `mcpServers` are always\n * selected; list one here only to set `eager`/`optional`.\n */\n tools?: ToolRef[] | undefined;\n metadata?: Record<string, unknown> | undefined;\n model?: string | undefined;\n reasoningEffort?: ReasoningEffort | undefined;\n latencyMode?: LatencyMode | undefined;\n sandboxBackend?: SandboxBackend | undefined;\n // The enrolled machine (a sandbox id) to run this session on; seeds the\n // active-sandbox pointer at creation so the first turn lands on it.\n targetSandboxId?: string | undefined;\n // Host working directory for a connected-machine target (the agent runs here;\n // default = the machine's launch dir). Ignored for managed sandboxes.\n workingDir?: string | undefined;\n // The rig to bind this session to (M3). Its active version is frozen onto the\n // session at create. Omitted ⇒ the workspace default rig when set, else rig-less.\n rigId?: string | undefined;\n /**\n * The session goal. When omitted on a top-level `unattended: true` create\n * with an `initialMessage`, Opengeni sets a goal that stands for that\n * message, so the run keeps going until the agent completes or pauses it.\n * `null` creates the session without a goal.\n */\n goal?: GoalSpec | null | undefined;\n clientEventId?: string | undefined;\n // Workspace-scoped CREATE idempotency key: forward a STABLE value to make a\n // double-submit/retry of the same logical create collapse to one session.\n // Distinct from the per-call clientEventId.\n idempotencyKey?: string | undefined;\n // Exact actor-private pre-session draft revision represented by this create.\n // The server consumes only this revision after durable initialization.\n expectedNewSessionDraftRevision?: number | undefined;\n agentLearning?: import(\"@opengeni/contracts\").AgentLearningOverrides | undefined;\n maxNestedAgentDepth?: number | undefined;\n firstPartyMcpPermissions?: string[] | undefined;\n firstPartyMcpTools?: FirstPartyMcpToolName[] | undefined;\n /**\n * One agent configuration: capabilities, identity, instructions alias and\n * renderer. Omission keeps today's behavior (a child inherits its parent's).\n * Children may only narrow. Requires the server's admission switch.\n */\n agent?: AgentConfigRequest | undefined;\n mcpServers?: SessionMcpServerInput[] | undefined;\n mcpApprovalPolicies?: Record<string, SessionMcpApprovalPolicy> | undefined;\n connectionAccounts?: McpConnectionAccountSelection[] | undefined;\n /** Atomically attach the server-derived personal rig closure to the initial turn. */\n personalResourceAttachment?: PersonalResourceAttachmentIntent | undefined;\n // Shared-sandbox placement (mirror of `@opengeni/contracts` CreateSessionRequest.sandbox,\n // addendum 05 §D.1). Three-way union; OMITTED ⇒ the context-dependent server default\n // (from inside a session → \"shared\" with the creator's box, top-level → \"new\").\n // - \"shared\": join the CREATOR's box (requires a parent session; top-level → 422).\n // - \"new\": mint a fresh singleton box (group ≡ the new session's id).\n // - {groupId}: join a SPECIFIC sibling group in THIS workspace (manager fan-out).\n sandbox?: \"shared\" | \"new\" | { groupId: string } | undefined;\n // --- Agent access scope, end-user label, memory scope ---------------------\n // Mirror of the contracts additions that land with the session agent-access\n // release. Which other sessions the agent may reach; defaults to \"workspace\"\n // on the platform (the chat facade defaults to \"session\").\n agentAccess?: SessionAgentAccess | undefined;\n /** Opaque end-user label inside the workspace. Not a subject, not authority. */\n /** Select identity with server-side asUser(), not session creation data. */\n scopeSubjectId?: never;\n /** Which Memory the agent reads and where it saves; \"user\" requires `scopeSubjectId`. */\n memoryScope?: SessionMemoryScope | undefined;\n};\n\nexport type SessionAgentAccess = \"session\" | \"user\" | \"workspace\";\nexport type SessionScopeSubjectId = string;\nexport type SessionMemoryScope = \"workspace\" | \"user\" | \"off\";\n\n// --- Access, workspaces, API keys -------------------------------------------\n\nexport const KNOWN_PERMISSIONS = [\n \"account:read\",\n \"account:admin\",\n \"members:manage\",\n \"workspace:create\",\n \"billing:read\",\n \"billing:manage\",\n \"workspace:read\",\n \"workspace:admin\",\n \"sessions:create\",\n \"sessions:read\",\n \"sessions:control\",\n // sandbox workspace (mirror of @opengeni/contracts Permission). stream:view is\n // strictly broader than sessions:read (un-redacted pixels); stream:control is\n // the never-granted-v1 raw-input plane; stream:acknowledge is the secret-leak\n // consent gate.\n \"stream:view\",\n \"stream:control\",\n \"stream:acknowledge\",\n \"files:upload\",\n \"files:read\",\n \"files:write\",\n \"terminal:attach\",\n \"documents:manage\",\n \"documents:search\",\n \"scheduled_tasks:manage\",\n \"scheduled_tasks:run\",\n \"github:manage\",\n \"github:use\",\n \"api_keys:manage\",\n \"usage_allowances:manage\",\n \"connections:read\",\n \"connections:write\",\n \"connections:personal\",\n \"capabilities:manage\",\n \"environments:manage\",\n \"environments:use\",\n \"variable-sets:list\",\n \"variable-sets:read\",\n \"variable-sets:write\",\n \"variable-sets:manage\",\n \"variable-sets:attach\",\n \"variable-sets:use\",\n \"secrets:list\",\n \"secrets:read\",\n \"secrets:write\",\n \"secrets:use\",\n \"mcp_servers:attach\",\n \"codemode:call\",\n \"goals:manage\",\n \"enrollments:read\",\n \"enrollments:manage\",\n \"rigs:use\",\n \"rigs:manage\",\n \"artifacts:read\",\n \"artifacts:publish\",\n] as const;\n\nexport type KnownPermission = (typeof KNOWN_PERMISSIONS)[number];\n\n/**\n * Permissions the SDK knows about today, kept open so a newer Opengeni server\n * can introduce permissions without breaking older SDK consumers.\n */\nexport type Permission = KnownPermission | (string & {});\n\nexport type FirstPartyMcpToolName =\n | \"knowledge_search\"\n | \"knowledge_prepare_save\"\n | \"knowledge_get\"\n | \"knowledge_browse\"\n | \"knowledge_save\"\n | \"knowledge_retain_file\"\n | \"meetings_search\"\n | \"meeting_read\"\n | \"meeting_notes_save\"\n | \"knowledge_retain_message\"\n | \"knowledge_archive\"\n | \"instruction_policy_save\"\n | \"instruction_policy_get\"\n | \"set_session_title\"\n | \"notify_user\"\n | \"notification_withdraw\"\n | \"inbox_tidy\"\n | \"call_user\"\n | \"goal_set\"\n | \"goal_update\"\n | \"goal_progress\"\n | \"wait_for_input\"\n | \"goal_complete\"\n | \"goal_pause\"\n | \"goal_resume\"\n | \"memory_search\"\n | \"memory_save\"\n | \"memory_correct\"\n | \"preference_registry_summary\"\n | \"preference_registry_get\"\n | \"task_notes_list\"\n | \"task_note_save\"\n | \"task_note_archive\"\n | \"task_note_replace\"\n | \"work_claim_upsert\"\n | \"work_claim_release\"\n | \"knowledge_propose\"\n | \"knowledge_correct\"\n | \"task_note_promote_knowledge\"\n | \"task_note_promote_instruction_policy\"\n | \"task_note_promote_preference\"\n | \"instruction_policy_propose\"\n | \"preference_propose\"\n | \"remember\"\n | \"remember_confirm\"\n | \"company_profile_propose\"\n | \"company_profile_confirm\"\n | \"sandboxes_list\"\n | \"sandbox_attach\"\n | \"sandbox_swap\"\n | \"run_on\"\n | \"sandbox_provision\"\n | \"connected_machine_remove\"\n | \"connected_machine_enroll_token\"\n | \"connected_machine_enable_screen_control\"\n | \"project_list\"\n | \"project_get\"\n | \"project_create\"\n | \"project_update\"\n | \"project_reorder\"\n | \"project_delete\"\n | \"session_set_project\"\n | \"admin_actions_search\"\n | \"admin_action_describe\"\n | \"admin_action_call\"\n | \"rig_list\"\n | \"rig_get\"\n | \"rig_propose_change\"\n | \"rig_verify\"\n | \"rig_promote\"\n | \"sessions_list\"\n | \"session_get\"\n | \"session_set_model\"\n | \"session_events\"\n | \"session_wait\"\n | \"command_read\"\n | \"command_wait\"\n | \"session_create\"\n | \"session_send_message\"\n | \"session_message_status\"\n | \"session_target_get\"\n | \"session_target_set\"\n | \"session_pause\"\n | \"session_resume\"\n | \"session_steer\"\n | \"session_human_input_respond\"\n | \"set_other_session_title\"\n | \"bot_template_save\"\n | \"interaction_discover\"\n | \"browser_open\"\n | \"browser_tabs\"\n | \"browser_observe\"\n | \"browser_act\"\n | \"browser_read\"\n | \"browser_screenshot\"\n | \"browser_clipboard\"\n | \"browser_debug\"\n | \"browser_downloads\"\n | \"browser_download_save\"\n | \"browser_record\"\n | \"browser_auth\"\n | \"interaction_request_human\"\n | \"browser_identity\"\n | \"browser_publish\"\n | \"browser_lifecycle\"\n | \"computer_open\"\n | \"computer_targets\"\n | \"computer_observe\"\n | \"computer_clipboard\"\n | \"computer_act\"\n | \"computer_lifecycle\"\n | \"excel_run\"\n | \"secret_search\"\n | \"secret_save\"\n | \"secret_get\"\n | \"secret_move\"\n | \"secret_delete\"\n | \"secret_profile_get\"\n | \"secret_profile_set\"\n | \"variable_set_list\"\n | \"environment_list\"\n | \"variable_set_get_variable\"\n | \"variable_set_set_variable\"\n | \"environment_set_variable\"\n | \"capability_catalog_search\"\n | \"capability_authorization_request\"\n | \"custom_mcp_setup_request\"\n | \"github_connect_link\"\n | \"github_repositories_list\"\n | \"social_connections_list\"\n | \"social_posts_recent\"\n | \"social_daily_analysis_context\"\n | \"social_search_live\"\n | \"social_mentions_live\"\n | \"social_thread_fetch\"\n | \"social_posts_sync\"\n | \"social_post_reply\"\n | \"x_accounts_list\"\n | \"x_search_live\"\n | \"x_mentions_live\"\n | \"x_thread_fetch\"\n | \"x_posts_sync\"\n | \"x_post_reply\"\n | \"reddit_accounts_list\"\n | \"reddit_search_live\"\n | \"reddit_mentions_live\"\n | \"reddit_thread_fetch\"\n | \"reddit_posts_sync\"\n | \"reddit_post_reply\"\n | \"scheduled_tasks_list\"\n | \"scheduled_tasks_get\"\n | \"scheduled_tasks_create\"\n | \"scheduled_tasks_update\"\n | \"scheduled_tasks_pause\"\n | \"scheduled_tasks_resume\"\n | \"scheduled_tasks_trigger\"\n | \"scheduled_tasks_delete\"\n | \"scheduled_task_runs_list\"\n | \"event_sources_list\"\n | \"events_get\"\n | \"event_sources_create_webhook\"\n | \"event_sources_update\"\n | \"event_sources_delete\"\n | \"slack_bot_list_channels\"\n | \"slack_bot_search\"\n | \"slack_bot_channel_history\"\n | \"slack_bot_thread_replies\"\n | \"slack_bot_list_users\"\n | \"slack_bot_list_files\"\n | \"slack_bot_file_info\"\n | \"slack_bot_file_content\"\n | \"slack_bot_upload_file\"\n | \"slack_bot_post_message\"\n | \"slack_bot_delete_message\"\n | \"slack_bot_prepare_message\"\n | \"slack_bot_send_prepared_message\"\n | \"slack_agent_handoff\"\n | \"slack_agent_suggest\"\n | \"slack_agent_chats\"\n | \"slack_agent_propose\"\n | \"fiken_companies_list\"\n | \"fiken_contacts_list\"\n | \"fiken_contact_create\"\n | \"fiken_products_list\"\n | \"fiken_invoices_list\"\n | \"fiken_invoice_get\"\n | \"fiken_invoice_draft_create\"\n | \"fiken_bank_accounts_list\"\n | \"fiken_purchases_list\"\n | \"fiken_sales_list\"\n | \"atlassian_sources_list\"\n | \"atlassian_search\"\n | \"atlassian_get\"\n | \"sandbox_file_publish\"\n | \"artifacts_list\"\n | \"artifacts_get_source\"\n | \"artifacts_prepare_upload\"\n | \"artifacts_create\"\n | \"artifacts_publish\"\n | \"artifacts_rollback\"\n | \"artifacts_archive\"\n | \"artifacts_restore\"\n | \"site_data_describe\"\n | \"site_data_define_collection\"\n | \"site_data_query\"\n | \"site_data_write\"\n | \"site_data_import\"\n | \"site_data_export\"\n | \"site_data_reset\"\n | \"site_files_list\"\n | \"site_files_upload\"\n | \"site_files_delete\"\n | \"site_publication_get\"\n | \"site_publication_update\"\n | \"site_publication_apply_fix\"\n | \"site_hostname_check\"\n | \"site_sql_inspect\"\n | \"site_sql_enable\"\n | \"site_sql_migrate\"\n | \"site_sql_define_query\"\n | \"site_sql_query\"\n | \"site_sql_run\"\n | \"site_sql_execute\"\n | \"site_sql_export\"\n | \"site_sql_import\"\n | \"site_sql_reset\"\n | \"editable_artifact_list\"\n | \"editable_artifact_create\"\n | \"editable_artifact_import\"\n | \"editable_artifact_get\"\n | \"editable_artifact_inspect\"\n | \"editable_artifact_apply\"\n | \"editable_artifact_export\"\n | \"editable_artifact_export_status\";\n\nexport type ProductAccessMode = \"local\" | \"configured\" | \"managed\";\n\nexport type ModelCapabilitySupportV1 = \"supported\" | \"unsupported\" | \"unknown\";\n\nexport type ModelCapabilityStateV1 = {\n upstream: ModelCapabilitySupportV1;\n runnable: boolean;\n};\n\nexport type ModelCapabilitiesV1 = {\n reasoning: ModelCapabilityStateV1 & {\n efforts: ReasoningEffort[];\n defaultEffort: ReasoningEffort | null;\n required: boolean;\n };\n functionCalling: ModelCapabilityStateV1;\n structuredOutput: ModelCapabilityStateV1;\n hostedTools: {\n webSearch: ModelCapabilityStateV1;\n xSearch: ModelCapabilityStateV1;\n codeExecution: ModelCapabilityStateV1;\n };\n inputModalities: Array<\"text\" | \"image\" | \"audio\">;\n inputFileMediaTypes?: string[] | undefined;\n outputModalities: Array<\"text\" | \"image\" | \"audio\">;\n transports: {\n sse: ModelCapabilityStateV1;\n responsesWebSocket: ModelCapabilityStateV1;\n realtimeAudio: ModelCapabilityStateV1;\n };\n promptCaching?:\n | (ModelCapabilityStateV1 & {\n mode: \"implicit\" | \"automatic\" | \"none\";\n })\n | undefined;\n latencyModes: Array<{\n id: \"standard\" | \"priority\" | \"fast\" | \"ultrafast\";\n upstream: ModelCapabilitySupportV1;\n runnable: boolean;\n billingMultiplierBps?: number | undefined;\n }>;\n};\n\nexport type ModelCredentialSourceV1 =\n | { kind: \"deployment\"; mechanism: \"api_key\" | \"azure_ad_bearer\" }\n | { kind: \"connected_subscription\"; provider: \"codex\" | \"xai\" | \"claude\" }\n | { kind: \"workspace_connection\"; mechanism: \"api_key\" }\n | { kind: \"organization_connection\"; mechanism: \"api_key\" };\n\nexport type ModelBillingAttributionV1 = {\n upstreamPayer: \"deployment\" | \"workspace\" | \"organization\" | \"connected_subscription\";\n metering: \"opengeni_credits\" | \"external\";\n};\n\nexport type ModelCostClassV1 = \"free\" | \"credits\" | \"subscription\" | \"workspace\" | \"organization\";\n\nexport type ModelPricingV1 = {\n inputMicrosPerMillionTokens: number;\n cachedInputMicrosPerMillionTokens?: number | undefined;\n cacheWriteMicrosPerMillionTokens?: number | undefined;\n outputMicrosPerMillionTokens: number;\n marginBps?: number | undefined;\n};\n\nexport type ModelPricingScheduleV1 = {\n default: ModelPricingV1;\n inputTokenTiers?:\n | Array<{\n minimumInputTokens: number;\n pricing: ModelPricingV1;\n }>\n | undefined;\n};\n\n/**\n * One model a client may select at send time, plus the provider that serves it.\n * The wire API (`responses` | `chat`) lets a client reason about provider\n * capabilities; the provider id/label drive a picker's grouping. Mirrors the\n * `ClientModel` shape projected into `ClientConfig` by the server.\n */\nexport type ClientModel = {\n id: string;\n label: string;\n /** Optional curated compact label for dense UI (e.g. mobile composer). */\n shortLabel?: string | undefined;\n /** Optional HTTPS maker logo supplied by the model catalog. */\n logoUrl?: string | undefined;\n /** Provider id (e.g. `openai`, `azure`, or a registry provider id). */\n provider: string;\n providerLabel: string;\n api: \"responses\" | \"chat\" | \"anthropic-messages\";\n source?: \"opengeni\" | \"codex\" | \"supergrok\" | \"workspace_gateway\" | \"openrouter\" | undefined;\n contextWindowTokens?: number | undefined;\n schemaVersion?: 1 | undefined;\n aliases?: string[] | undefined;\n deployment?:\n | {\n upstreamModelId: string;\n wireApi: \"responses\" | \"chat\" | \"anthropic-messages\";\n }\n | undefined;\n executionLimits?:\n | {\n contextWindowTokens: number | null;\n effectiveContextWindowTokens: number | null;\n autoCompactTokenLimit: number | null;\n toolOutputTruncationTokens: number | null;\n }\n | undefined;\n credentialSource?: ModelCredentialSourceV1 | undefined;\n billing?: ModelBillingAttributionV1 | undefined;\n cost?: ModelCostClassV1 | undefined;\n capabilities?: ModelCapabilitiesV1 | undefined;\n pricing?: ModelPricingScheduleV1 | undefined;\n definitionVersion?: string | undefined;\n /**\n * Transient availability hint. `reason: \"region_restricted\"`: the workspace\n * is EU-only and this model's route is not EU by its residency record.\n */\n availability?: ModelAvailabilityV1 | undefined;\n /** Where this route processes data, and how that is known. Absent means unknown, never EU. */\n residency?: ClientModelResidencyV1 | undefined;\n};\n\nexport type ModelAvailabilityV1 = {\n status: \"available\" | \"unavailable\" | \"degraded\" | \"unknown\";\n selectable: boolean;\n reason:\n | \"missing_credential\"\n | \"needs_reauth\"\n | \"credential_not_ready\"\n | \"not_entitled\"\n | \"provider_unhealthy\"\n | \"policy_blocked\"\n | \"unsupported\"\n | \"credits_disabled\"\n | \"region_restricted\"\n | null;\n checkedAt: string | null;\n};\n\nexport type ModelCredentialReadinessV1 = {\n status: \"ready\" | \"not_ready\" | \"error\";\n reason:\n | \"missing_credential\"\n | \"needs_reauth\"\n | \"prerequisites_missing\"\n | \"resolver_error\"\n | \"observation_stale\"\n | null;\n basis: \"configuration\" | \"connection\" | \"resolver\";\n checkedAt: string | null;\n};\n\nexport type WorkspaceModelCatalogModel = ClientModel & {\n /** Workspace preference, separate from immutable model execution limits. */\n compactionPolicy?:\n | {\n defaultTokens: number;\n /** This workspace's own limit; null follows the organization's or the model's default. */\n overrideTokens: number | null;\n /** The organization's limit this workspace follows while it sets none. */\n organizationTokens?: number | null | undefined;\n effectiveTokens: number;\n minimumTokens: number;\n maximumTokens: number;\n }\n | undefined;\n credentialReadiness: ModelCredentialReadinessV1;\n creditFunding?: \"promotional\" | \"general\" | \"unavailable\" | undefined;\n /**\n * Exact verdict of the policy the workspace runs with (its own lists within\n * its organization's, and its credit switch), without exposing provider\n * identity.\n */\n policyAllowed?: boolean | undefined;\n /**\n * False when the organization's allowlist, a ceiling the workspace's own\n * list can't widen, excludes the model. Absent when the organization allows\n * every model, and from older servers. Ignores the credit switch.\n */\n organizationAllowed?: boolean | undefined;\n availability: ModelAvailabilityV1;\n};\n\n/** Why a new chat or scheduled task without an explicit model gets its default. */\nexport type DefaultModelSelectionSource =\n | \"workspace\"\n | \"organization\"\n | \"subscription\"\n | \"credits\"\n | \"deployment\";\n\nexport type DefaultModelSelection = {\n model: string;\n reasoningEffort: ReasoningEffort;\n source: DefaultModelSelectionSource;\n};\n\nexport type WorkspaceModelCatalogResponse = {\n models: WorkspaceModelCatalogModel[];\n /** Default for new chats and scheduled tasks that name no model. */\n defaultSelection?: DefaultModelSelection | undefined;\n /**\n * The default this workspace would use once its organization holds an\n * Opengeni credit balance. Null when the deployment does not bill credits.\n */\n creditsSelection?: DefaultModelSelection | null | undefined;\n};\n\nexport type WorkspaceGatewayCustomModel = {\n id: string;\n upstreamModelId: string;\n label: string | null;\n version: number;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type WorkspaceGatewayCustomModelsResponse = {\n models: WorkspaceGatewayCustomModel[];\n};\n\nexport type CreateWorkspaceGatewayCustomModelRequest = {\n operationId: string;\n upstreamModelId: string;\n label?: string | undefined;\n};\n\nexport type DeleteWorkspaceGatewayCustomModelRequest = {\n expectedVersion: number;\n operationId: string;\n};\n\nexport type WorkspaceOpenRouterCustomModel = WorkspaceGatewayCustomModel;\n\nexport type WorkspaceOpenRouterCustomModelsResponse = {\n models: WorkspaceOpenRouterCustomModel[];\n};\n\nexport type CreateWorkspaceOpenRouterCustomModelRequest = CreateWorkspaceGatewayCustomModelRequest;\n\nexport type DeleteWorkspaceOpenRouterCustomModelRequest = DeleteWorkspaceGatewayCustomModelRequest;\n\nexport type WorkspaceOpperCustomModel = WorkspaceGatewayCustomModel;\n\nexport type WorkspaceOpperCustomModelsResponse = {\n models: WorkspaceOpperCustomModel[];\n};\n\nexport type CreateWorkspaceOpperCustomModelRequest = CreateWorkspaceGatewayCustomModelRequest;\n\nexport type DeleteWorkspaceOpperCustomModelRequest = DeleteWorkspaceGatewayCustomModelRequest;\n\n/** Model connection kinds that carry a per-connection access policy. */\nexport type ModelConnectionAccessKind =\n | \"codex\"\n | \"supergrok\"\n | \"vercel_gateway\"\n | \"openrouter\"\n | \"anthropic\"\n | \"claude_subscription\"\n | \"opper\"\n | \"openai\"\n | \"azure_openai\";\n\nexport type OrganizationModelProviderKind =\n | \"vercel_gateway\"\n | \"openrouter\"\n | \"anthropic\"\n | \"claude_subscription\"\n | \"opper\"\n /** The organization's ElevenLabs key, for Eleven Realtime voices. */\n | \"elevenlabs\"\n | \"openai\"\n | \"azure_openai\";\n\n/** Organization providers whose key runs models, with custom models to choose. */\nexport type OrganizationModelCatalogProviderKind = Exclude<\n OrganizationModelProviderKind,\n \"elevenlabs\"\n>;\n\nexport type ClaudeUsageWindow = {\n id:\n | \"five_hour\"\n | \"seven_day\"\n | \"seven_day_opus\"\n | \"seven_day_sonnet\"\n | \"seven_day_overage_included\"\n | \"overage\";\n usedPercent: number | null;\n resetsAt: string | null;\n status: \"allowed\" | \"allowed_warning\" | \"rejected\" | null;\n observedAt: string;\n source?: \"response_headers\" | \"provider\" | undefined;\n};\nexport type ClaudeUsageRequestStatus = {\n status: ClaudeUsageWindow[\"status\"];\n resetsAt: string | null;\n representativeClaim: ClaudeUsageWindow[\"id\"] | null;\n overageStatus: ClaudeUsageWindow[\"status\"];\n overageResetsAt: string | null;\n upstreamModelId: string | null;\n observedAt: string;\n source?: \"response_headers\" | \"provider\" | undefined;\n};\nexport type { SubscriptionUsagePool, SubscriptionUsagePoolsResponse } from \"@opengeni/contracts\";\n\nexport type ClaudeSubscriptionUsage = {\n connected: boolean;\n credentialVersion: number | null;\n windows: ClaudeUsageWindow[];\n observedAt: string | null;\n source: \"response_headers\" | \"provider\" | null;\n refreshStatus: \"not_checked\" | \"available\" | \"scope_required\" | \"unavailable\" | \"reconnect\";\n refreshCheckedAt: string | null;\n requestStatus?: ClaudeUsageRequestStatus | null | undefined;\n requestRestrictions?: ClaudeUsageRequestStatus[] | undefined;\n};\n\nexport type OrganizationModelProviderConnection = {\n providerKind: OrganizationModelProviderKind;\n status: \"active\" | \"revoked\";\n version: number;\n /** Azure OpenAI only: the non-secret `https://<resource>.openai.azure.com/openai/v1` endpoint. */\n endpoint?: string | undefined;\n /** Azure OpenAI only: how the connection signs in. */\n authMethod?: OrganizationModelProviderAuthMethod | undefined;\n createdAt: string;\n updatedAt: string;\n};\n\n/**\n * How an organization connection signs in: an API key, or for Azure OpenAI\n * Microsoft Entra ID as the organization's own app or this deployment's\n * identity (only when the deployment operator offers it).\n */\nexport type OrganizationModelProviderAuthMethod =\n | \"api_key\"\n | \"entra_client_secret\"\n | \"entra_deployment_identity\";\n\n/** Azure OpenAI only: a Microsoft Entra ID sign-in sent instead of `apiKey`. */\nexport type OrganizationModelProviderEntraAuthentication =\n | { method: \"entra_client_secret\"; tenantId: string; clientId: string; clientSecret: string }\n | { method: \"entra_deployment_identity\" };\n\nexport type UpsertOrganizationModelProviderConnectionRequest = {\n operationId: string;\n expectedVersion?: number | undefined;\n /** The provider key. Send it, or `authentication`, not both. */\n apiKey?: string | undefined;\n /** Azure OpenAI only: sign in with Microsoft Entra ID instead of `apiKey`. */\n authentication?: OrganizationModelProviderEntraAuthentication | undefined;\n /** Required for `azure_openai` (its resource endpoint); refused for every other kind. */\n endpoint?: string | undefined;\n claudeIdentity?: { accountUuid: string; deviceId: string } | undefined;\n};\n\nexport type RevokeOrganizationModelProviderConnectionRequest = {\n operationId: string;\n expectedVersion: number;\n};\n\nexport type OrganizationProviderCustomModel = WorkspaceGatewayCustomModel;\nexport type OrganizationProviderCustomModelsResponse = {\n models: OrganizationProviderCustomModel[];\n};\nexport type CreateOrganizationProviderCustomModelRequest = CreateWorkspaceGatewayCustomModelRequest;\nexport type DeleteOrganizationProviderCustomModelRequest = DeleteWorkspaceGatewayCustomModelRequest;\n\n/**\n * The workspace's hard model/provider allowlist. `null` means unrestricted for\n * that dimension; an empty array is an explicit total block. A model runs only\n * when both this list and `organization` allow it.\n */\nexport type WorkspaceModelAccessPolicy = {\n allowedProviders: string[] | null;\n allowedModels: string[] | null;\n /**\n * Where the policy comes from: the workspace's own, the organization's\n * default it follows, or no restriction. Absent from older servers.\n */\n source?: \"workspace\" | \"organization\" | \"none\" | undefined;\n /**\n * The organization's list: what the workspace uses without its own policy,\n * and a ceiling its own policy can only narrow.\n */\n organization?: {\n allowedProviders: string[] | null;\n allowedModels: string[] | null;\n } | null;\n /**\n * The workspace's credit switch (its `allowCreditModels` setting). False\n * blocks every model billed in Opengeni credits, including ones added later,\n * whichever allowlist applies. Absent from older servers; treat as true.\n */\n allowCreditModels?: boolean | undefined;\n};\n\n/**\n * Model defaults every workspace in an organization follows until it sets its\n * own (`GET/PATCH /v1/organizations/:id/model-defaults`, owners and admins).\n * The allowlists are the exception: a ceiling every workspace stays within,\n * which a workspace's own allowlist can only narrow.\n */\nexport type OrganizationModelDefaults = {\n sessionDefaults: { model: string; reasoningEffort: ReasoningEffort } | null;\n allowedProviders: string[] | null;\n allowedModels: string[] | null;\n modelCompactionThresholds: Record<string, number>;\n /** Voice settings by realtime model id, for workspaces without their own. */\n realtimeVoice: Record<string, RealtimeVoiceSettings>;\n /**\n * The voice model new voice conversations start with in workspaces without\n * their own choice, until the person picks one; null leaves it automatic.\n */\n realtimeDefaultModel: string | null;\n updatedAt: string | null;\n};\n\n/**\n * Field-by-field update; compaction and voice settings merge by model id and\n * null resets one model. `realtimeDefaultModel: null` makes the voice model\n * automatic again.\n */\nexport type UpdateOrganizationModelDefaultsRequest = {\n sessionDefaults?: { model: string; reasoningEffort: ReasoningEffort } | null | undefined;\n modelPolicy?:\n | {\n allowedProviders?: string[] | null | undefined;\n allowedModels?: string[] | null;\n }\n | null\n | undefined;\n modelCompactionThresholds?: Record<string, number | null> | undefined;\n realtimeVoice?: Record<string, RealtimeVoiceSettings | null> | undefined;\n realtimeDefaultModel?: SessionRealtimeModel | null | undefined;\n};\n\n/** A model-account setting an organization sets, and may lock for every workspace. */\nexport type ModelAccountSettingKey =\n | \"rotation\"\n | \"providers\"\n | \"crossProviderFailover\"\n | \"fallbackOrder\"\n | \"personalConnectionsAllowed\"\n | \"personalFallbackAllowed\";\n\n/**\n * Where an effective value comes from: the organization, this workspace's\n * override, or the organization with a lock workspaces cannot override.\n */\nexport type ModelAccountSettingSource = \"organization\" | \"workspace\" | \"locked\";\n\nexport type ModelAccountRotationMode = \"spread\" | \"primary_first\";\n\n/** Effective model-account settings. */\nexport type ModelAccountSettingValues = {\n /** How the shared core spreads load across eligible accounts, per provider. */\n rotation: Record<\n string,\n {\n mode: ModelAccountRotationMode;\n primaryConnectionId?: string | null | undefined;\n }\n >;\n providers: Record<\n string,\n {\n /** @deprecated Never set: every account that reaches a workspace serves it. */\n inferenceSource?: \"automatic\" | \"workspace\" | \"organization\" | undefined;\n /** @deprecated Always true: every account that reaches a workspace serves it. */\n useOrganizationAccounts: boolean;\n enabled: boolean;\n }\n >;\n crossProviderFailover: boolean;\n /** Ordered fallback models for a preferred model. */\n fallbackOrder: Record<string, string[]>;\n personalConnectionsAllowed: boolean;\n /** Permit a person's opt-in fallback; accepted background work retains its captured authority. */\n personalFallbackAllowed: boolean;\n};\n\n/** One source per setting and, for map-valued settings, per entry. */\nexport type ModelAccountSettingsView = {\n values: ModelAccountSettingValues;\n sources: Record<ModelAccountSettingKey, ModelAccountSettingSource>;\n entrySources: {\n rotation: Record<string, \"organization\" | \"workspace\">;\n providers: Record<string, \"organization\" | \"workspace\">;\n fallbackOrder: Record<string, \"organization\" | \"workspace\">;\n };\n};\n\n/** `GET/PATCH /v1/organizations/:id/model-account-settings` (owners and admins). */\nexport type OrganizationModelAccountSettings = {\n organizationId: string;\n values: ModelAccountSettingValues;\n locked: ModelAccountSettingKey[];\n version: number;\n updatedAt: string | null;\n /**\n * False when this deployment doesn't switch models when subscriptions run\n * out, so `crossProviderFailover` has no effect here. Absent from older servers.\n */\n crossProviderFailoverAvailable?: boolean | undefined;\n};\n\n/**\n * Organization change: omitted fields are kept; `fallbackOrder` and `locked`\n * replace the stored value. Locking a setting clears every workspace override of it.\n */\nexport type UpdateOrganizationModelAccountSettingsRequest = {\n crossProviderFailover?: boolean | undefined;\n fallbackOrder?: Record<string, string[]> | undefined;\n personalConnectionsAllowed?: boolean | undefined;\n personalFallbackAllowed?: boolean | undefined;\n rotation?: Record<string, { mode: ModelAccountRotationMode }> | undefined;\n locked?: ModelAccountSettingKey[] | undefined;\n /** Refuse the write (409) if the settings changed since this version was read. */\n expectedVersion?: number | undefined;\n};\n\n/** `GET/PATCH /v1/workspaces/:id/model-account-settings`. */\nexport type WorkspaceModelAccountSettings = ModelAccountSettingsView & {\n workspaceId: string;\n locked: ModelAccountSettingKey[];\n /** The workspace's stored overrides; null follows the organization. */\n overrides: {\n rotation: Record<string, unknown> | null;\n providers: Record<string, unknown> | null;\n crossProviderFailover: boolean | null;\n fallbackOrder: Record<string, string[]> | null;\n personalConnectionsAllowed: boolean | null;\n personalFallbackAllowed: boolean | null;\n };\n version: number;\n updatedAt: string | null;\n canEdit: boolean;\n /** As on the organization's settings: false when switching models is off here. */\n crossProviderFailoverAvailable?: boolean | undefined;\n};\n\n/**\n * Workspace change: `null` follows the organization again; `fallbackOrder`\n * and `rotation` change entry by entry. A locked setting answers 409.\n */\nexport type UpdateWorkspaceModelAccountSettingsRequest = {\n crossProviderFailover?: boolean | null | undefined;\n personalConnectionsAllowed?: boolean | null | undefined;\n personalFallbackAllowed?: boolean | null | undefined;\n fallbackOrder?: Record<string, string[] | null> | null | undefined;\n rotation?: Record<string, { mode: ModelAccountRotationMode } | null> | null | undefined;\n expectedVersion?: number | undefined;\n};\n\n/** Every shared workspace's effective settings and sources, one page. */\nexport type ModelAccountSettingsOverview = {\n organization: OrganizationModelAccountSettings;\n workspaces: (ModelAccountSettingsView & {\n workspaceId: string;\n name: string;\n })[];\n nextCursor: string | null;\n};\n\n/** Why a listed model account cannot be chosen for this session. */\nexport type ModelAccountChoiceRefusal =\n | \"inactive\"\n | \"personal_not_allowed\"\n | \"personal_not_owner_work\"\n | \"session_has_no_owner\";\n\n/**\n * Cached usage, not a live check or a promise of available capacity. Source/time\n * describe the snapshot, not each retained window. A past reset does not prove replenishment.\n */\nexport type ModelAccountUsageSnapshot = {\n /** Snapshot-level time, not the observation time of every retained window. */\n observedAt: string | null;\n source: \"usage_endpoint\" | \"response_headers\" | \"refusal\" | null;\n windows: Array<{\n id: string;\n /** Null means unknown; values over 100 can represent overage. */\n usedPercent: number | null;\n resetsAt: string | null;\n status: \"ok\" | \"warning\" | \"exhausted\" | \"unknown\";\n }>;\n exhaustedUntil: string | null;\n exhaustedKind: \"quota\" | \"rate_limit\" | null;\n};\n\n/** An already-visible account, with optional cached usage (never an eligibility decision). */\nexport type ModelAccountChoiceOption = {\n provider: string;\n connectionId: string;\n label: string | null;\n accountEmail: string | null;\n planType: string | null;\n status: string;\n personal: boolean;\n source: \"workspace\" | \"organization\" | \"personal\";\n allowedModelIds: string[] | null;\n choosable: boolean;\n refusal: ModelAccountChoiceRefusal | null;\n /** Omitted on older servers; null means no decodable stored snapshot. Readings may be partial or stale. */\n usage?: ModelAccountUsageSnapshot | null | undefined;\n};\n\n/** A session's current account, what it may switch to, and the effective personal settings. */\nexport type SessionModelAccountChoiceResponse = {\n /** Last committed placement; neither queued account choices nor unplaced proposals are serving truth. */\n serving?:\n | {\n turnId: string;\n provider: string;\n connectionId: string | null;\n modelId: string;\n preferredModelId: string;\n reasoningEffort: ReasoningEffort;\n latencyMode: LatencyMode;\n }\n | null\n | undefined;\n /** The session's account when it has bindings for one provider only; else null (see `bindings`). */\n binding: {\n provider: string;\n connectionId: string | null;\n choice: \"explicit\" | \"automatic\";\n } | null;\n /** One binding per provider. */\n bindings: {\n provider: string;\n connectionId: string | null;\n choice: \"explicit\" | \"automatic\";\n }[];\n accounts: ModelAccountChoiceOption[];\n personal: {\n connectionsAllowed: boolean;\n fallbackAllowed: boolean;\n fallbackOptIn: boolean;\n };\n};\n\n/**\n * A connection becomes the choice for its provider; other providers' choices\n * stay. `connectionId: null` returns `provider`'s choice to automatic, or\n * every provider's when `provider` is omitted.\n */\nexport type SetSessionModelAccountChoiceRequest = {\n connectionId: string | null;\n provider?: string;\n};\n\nexport type SetSessionModelAccountChoiceResponse = {\n changed: boolean;\n appliedTo: \"waiting_turn\" | \"next_turn\";\n provider: string | null;\n connectionId: string | null;\n choice: \"explicit\" | \"automatic\";\n};\n\n/** The caller's own model-account preferences in an organization. */\nexport type ModelAccountPreferences = {\n personalFallbackOptIn: boolean;\n version: number;\n};\n\nexport type UpdateModelAccountPreferencesRequest = {\n personalFallbackOptIn: boolean;\n expectedVersion?: number;\n};\n\n/**\n * What agents may do in the app for a person, organization-wide.\n * `sessionAdminAccessAllowed`: members may give a session they started their\n * own full access (off by default; turning it off ends every session's full\n * access). `chatActionsAllowed`: in a chat a person started, the agent may do\n * what that person could do in the app's pages and settings, each change only\n * after the person confirms it in the chat (on by default).\n */\nexport type OrganizationAgentAdminAccess = {\n sessionAdminAccessAllowed: boolean;\n chatActionsAllowed: boolean;\n updatedAt: string | null;\n};\n\n/** Change either choice; an omitted one stays as it is. */\nexport type UpdateOrganizationAgentAdminAccessRequest = {\n sessionAdminAccessAllowed?: boolean;\n chatActionsAllowed?: boolean;\n};\n\n/**\n * The organization's EU-only inference setting. When on, every model call for\n * its workspaces runs on an EU route or not at all. Any member can read it;\n * owners and admins can turn it on, and only an owner or admin in the app in a\n * browser can turn it off (`canTurnOff`).\n */\nexport type OrganizationInferenceResidency = {\n organizationId: string;\n euOnly: boolean;\n /** 0 until the setting is first changed. */\n version: number;\n updatedAt: string | null;\n /** Whether the caller may turn EU-only off: only an owner or admin in a browser. */\n canTurnOff: boolean;\n changed?: boolean | undefined;\n};\n\n/**\n * Turn EU-only on or off. `expectedVersion` is the current `version` (a stale\n * one is `409`); `operationId` makes a retry safe. Changes answer `503` while\n * the deployment doesn't allow them yet.\n */\nexport type UpdateOrganizationInferenceResidencyRequest = {\n euOnly: boolean;\n expectedVersion: number;\n operationId: string;\n};\n\n/** Model-backed features besides the chat model, as reported in `ClientConfig.inferenceFeatures`. */\nexport type InferenceFeatureId =\n | \"web_search\"\n | \"image_generation\"\n | \"video_generation\"\n | \"realtime_voice\"\n | \"voice_input\"\n | \"meeting_transcription\"\n | \"live_transcription\"\n | \"knowledge_embeddings\"\n | \"code_search\";\n\n/**\n * Why the server switched a feature off. `region_restricted`: the workspace\n * is EU-only and the feature has no EU route here (\"Not supported in EU\").\n */\nexport type FeatureUnavailableReason = \"region_restricted\";\n\n/** One feature's availability for the caller's workspace. */\nexport type InferenceFeatureAvailability = {\n id: InferenceFeatureId;\n available: boolean;\n unavailableReason: FeatureUnavailableReason | null;\n};\n\n/**\n * An organization's privacy choices, after the deployment's limits. A product\n * that embeds Opengeni can only narrow these; `limits` says which are fixed.\n */\nexport type OrganizationPrivacySettings = {\n organizationId: string;\n /**\n * Whether members can connect machines of their own (Only me machines).\n * Off: only owners and admins can connect new ones; machines already\n * connected keep working. Older servers omit it: members can.\n */\n membersConnectOwnMachines?: boolean;\n /** Who sees new chats and schedules unless the person picks otherwise. */\n defaultVisibility: \"private\" | \"workspace\";\n /** Whether people have their own Personal workspace to see and work in. */\n personalWorkspaces: boolean;\n /**\n * The most each person can spend from the organization's credits in their\n * own Personal workspace each calendar month (UTC), in USD micros; null for\n * no limit. Work paid by their own model plans or keys doesn't count.\n */\n personalWorkspaceMonthlyCredits: number | null;\n /** Whether admins see that other people's Only me schedules exist, and can pause them. */\n adminsSeePrivateSchedules: boolean;\n limits: {\n /** False when this deployment turns Only me off in shared workspaces. */\n onlyMeAllowed: boolean;\n /** True when new chats and schedules always start as Workspace. */\n defaultVisibilityLocked: boolean;\n /** True when admins always see that other people's Only me schedules exist. */\n adminsSeePrivateSchedulesLocked: boolean;\n };\n updatedAt: string | null;\n};\n\nexport type UpdateOrganizationPrivacySettingsRequest = {\n /** Off: only owners and admins connect new machines of their own. */\n membersConnectOwnMachines?: boolean;\n defaultVisibility?: \"private\" | \"workspace\";\n adminsSeePrivateSchedules?: boolean;\n /** Off: people no longer see or start new work in their Personal workspace. */\n personalWorkspaces?: boolean;\n /** USD micros a month per person; null removes the limit. */\n personalWorkspaceMonthlyCredits?: number | null;\n};\n\n/**\n * A session's admin access as the viewer sees it. While `active`, the agent\n * in this session can do what `grantedBy` can manage across the\n * organization, checked live on every action.\n */\nexport type SessionAdminAccess = {\n active: boolean;\n grantedBy: { subjectId: string; name: string | null } | null;\n grantedAt: string | null;\n /** While active: when it ends by itself, or null for no time limit. */\n expiresAt: string | null;\n /** The organization allows admin access for sessions. */\n allowed: boolean;\n /**\n * The viewer may turn it on, or choose a new time limit while it is on: an\n * owner or admin, in person, on their own session.\n */\n canGrant: boolean;\n /** The viewer may turn it off. */\n canRevoke: boolean;\n};\n\n/**\n * How long a session's admin access lasts from now: whole hours from 1 to\n * 720, or null for no time limit. Omitted means one hour.\n */\nexport type GrantSessionAdminAccessRequest = {\n durationHours?: number | null;\n};\n\n/** Full replacement body for `PUT /v1/workspaces/:id/model-policy`. */\nexport type UpdateWorkspaceModelAccessPolicyRequest = {\n allowedProviders?: string[] | null | undefined;\n allowedModels?: string[] | null | undefined;\n};\n\n/**\n * Connection state of a workspace's Codex (ChatGPT) subscription, returned by\n * `GET /v1/workspaces/:id/codex/status`. `models` are the codex models the\n * workspace can select (projected as ClientModel under their own \"no credits\"\n * provider group), present only while connected.\n */\nexport type CodexConnectionStatus = {\n connected: boolean;\n plan?: string | null;\n valid?: boolean;\n expiresAt?: string | null;\n lastError?: string | null;\n models?: ClientModel[];\n /** The account a session runs on when unpinned (label for the in-session indicator). */\n activeAccount?: {\n id: string;\n label?: string | null;\n chatgptAccountId?: string | null;\n } | null;\n /** Live model-catalog probe result for the active account only. */\n activeAccountValid?: boolean;\n /** Cached readiness of any account in the effective worker pool. */\n poolReady?: boolean;\n /** Cached unpinned worker routability; rotation-off remains active-pointer-only. */\n workerRoutable?: boolean;\n /** How many Codex accounts the workspace has connected. */\n accountCount?: number;\n source?: WorkspaceCodexSubscriptionSource;\n};\n\n/**\n * `automatic`: Codex is on here; `disabled`: off. The older `workspace` and\n * `organization` values are accepted and mean on.\n */\nexport type WorkspaceCodexSubscriptionMode =\n | \"automatic\"\n | \"workspace\"\n | \"organization\"\n | \"disabled\";\n\nexport type WorkspaceCodexSubscriptionSource = {\n accountId: string;\n workspaceId: string;\n workspaceKind: \"personal\" | \"shared\";\n mode: WorkspaceCodexSubscriptionMode;\n effectiveSource: \"workspace\" | \"organization\" | \"disabled\";\n workspaceAvailable: boolean;\n organizationAvailable: boolean;\n /** @deprecated Always false: no account is set aside. Absent from older servers. */\n workspaceSetAside?: boolean;\n /**\n * How many organization accounts reach this workspace (accounts limited to\n * chosen people aside). Absent from older servers.\n */\n organizationCount?: number;\n};\n\n/**\n * One normalized Codex usage window (5h or weekly), camelCase end-to-end (the\n * route normalizes server-side; the web layer never re-hand-types snake_case).\n * `percent` is authoritative; used/limit/remaining are a synthesized 0–100 scale\n * (limit = 100) because the provider gives only a percentage. `remaining =\n * 100 - percent` is the P3 rotation key. Identify the window by `limitWindowSeconds`\n * (18000 ⇒ 5h, 604800 ⇒ weekly), never by position.\n */\nexport type CodexUsageWindow = {\n used: number;\n limit: number;\n remaining: number;\n percent: number;\n resetAt: string | null;\n resetAfterSeconds: number | null;\n limitWindowSeconds: number;\n};\n\n/** The normalized usage payload for one account — the P2/P3 contract. */\nexport type CodexUsagePayload = {\n status: \"ok\" | \"limit_reached\" | \"error\" | \"no-data\";\n planType: string | null;\n fiveHour: CodexUsageWindow | null;\n weekly: CodexUsageWindow | null;\n limitReached: boolean;\n fetchedAt: string;\n /** Authoritative count-only summary from /wham/usage; never synthesized rows. */\n rateLimitResetCredits?: { availableCount: number; credits: null } | null;\n /** Present only on an auth/refresh failure path. */\n reason?: \"needs_relogin\";\n additionalLimits?: Array<{\n limitName: string;\n meteredFeature: string;\n fiveHour: CodexUsageWindow | null;\n weekly: CodexUsageWindow | null;\n unknownWindowExhausted: boolean;\n }>;\n credits?: {\n hasCredits: boolean;\n unlimited: boolean;\n overageLimitReached: boolean;\n balance: string | null;\n };\n};\n\n/** One model a Codex account's current ChatGPT plan was proven not to include. */\nexport type CodexPlanExcludedModel = {\n /** Product model id, for example `codex/gpt-6-sol`. */\n model: string;\n /** Display name, for example \"GPT-6 Sol\". */\n label: string;\n excludedAt: string;\n retryAfter: string;\n};\n\n/** One connected Codex (ChatGPT) account in a workspace (multi-account P1). Metadata only. */\nexport type CodexAccount = {\n id: string;\n source?: \"workspace\" | \"organization\";\n /**\n * Organization list only: shared workspaces that list the account among\n * their own (it was connected there).\n */\n ownInWorkspaceIds?: string[];\n /** The organization's list only: who the account reaches. */\n reach?: SubscriptionAccountReach;\n /**\n * The workspace whose own account this is, or null for the organization's\n * and personal accounts. In another workspace's list it was shared there by\n * its owner, and that workspace can only remove it. Absent from older servers.\n */\n ownerWorkspaceId?: string | null;\n chatgptAccountId?: string | null;\n label?: string | null;\n email?: string | null;\n plan?: string | null;\n /** When the provider last confirmed `plan` (connect, token refresh, or usage read). */\n planCheckedAt?: string | null;\n /** Plan before the most recent observed plan change, and when that change was seen. */\n planChangedFrom?: string | null;\n planChangedAt?: string | null;\n /**\n * Models the current plan was proven not to include. Each is skipped by\n * automatic selection until `retryAfter` (one request then re-checks it), or\n * until a different plan is observed, for example after refreshing usage.\n */\n planExcludedModels?: CodexPlanExcludedModel[];\n status: \"active\" | \"needs_relogin\" | \"error\";\n active: boolean;\n expiresAt?: string | null;\n lastRefreshAt?: string | null;\n lastError?: string | null;\n // P2 CACHED usage (built from the persisted columns; renders bars off\n // listCodexAccounts with no second call). null until the first live refresh.\n fiveHour?: CodexUsageWindow | null;\n weekly?: CodexUsageWindow | null;\n usageCheckedAt?: string | null;\n // P3 rotation cooldown: ISO timestamp until which this account is cooling-down\n // (rotated-off after a usage cap). null/absent ⇒ not cooling.\n exhaustedUntil?: string | null;\n /** Controls only NEW automatic allocations. */\n extraCreditsEnabled?: boolean;\n extraCreditsVersion?: number;\n extraCreditsUpdatedAt?: string | null;\n allocatorEnabled: boolean;\n /** Independent OCC sequence; credential/token `version` is never exposed. */\n allocatorVersion: number;\n allocatorUpdatedAt?: string | null;\n /** Cached authoritative summary count, never detailed redemption authority. */\n resetCreditAvailableCount?: number | null;\n resetCreditsCheckedAt?: string | null;\n /** True when this exact credential is the workspace's independent Apps credential. */\n appsDesignated: boolean;\n /** True only for the scoped managed human who connected it. */\n canEnableApps: boolean;\n};\n\nexport type CodexResetCredit = {\n id: string;\n resetType: \"codexRateLimits\" | \"unknown\";\n status: \"available\" | \"redeeming\" | \"redeemed\" | \"unknown\";\n /** Unix seconds from the provider contract. */\n grantedAt: number;\n /** Unix seconds, or null when the provider reports no expiry. */\n expiresAt: number | null;\n title: string | null;\n description: string | null;\n /** True only for fresh, complete, owning-human provider detail. */\n actionable: boolean;\n};\n\n/** Owning-human recovery metadata. It contains no token, browser-session hash, or provider key. */\nexport type CodexResetRedemptionRecovery = {\n attemptId: string;\n creditId: string;\n status: \"provider_started\" | \"completed\";\n outcome: \"reset\" | \"nothingToReset\" | \"noCredit\" | \"alreadyRedeemed\" | null;\n providerStartedAt: string | null;\n completedAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type CodexAccountOverview = {\n accountId: string;\n usage: {\n source: \"provider\" | \"cache\" | \"none\";\n fetchedAt: string | null;\n stale: boolean;\n error: string | null;\n value: CodexUsagePayload | null;\n };\n resetCredits: {\n source: \"provider\" | \"cache\" | \"none\";\n fetchedAt: string | null;\n stale: boolean;\n error: string | null;\n detailState: \"detailed\" | \"count_only\" | \"capped\" | \"unsupported\" | \"unknown\" | \"error\";\n detailsComplete: boolean;\n availableCount: number | null;\n credits: CodexResetCredit[];\n };\n canRedeem: boolean;\n /** Secret-free reason redemption is owner-actionable or view-only. */\n redemptionAccess: {\n ownership: \"current_human\" | \"unowned\" | \"different_human\" | \"managed_human_unavailable\";\n /** A direct managed-cookie admin may claim only an unowned same-provider row by reconnecting. */\n canClaimUnownedViaReconnect: boolean;\n };\n /** Owning managed-cookie human may replay durable completion without a healthy provider token. */\n canResumeRedemption: boolean;\n /** Durable owner-scoped ambiguity/completion discovery; never redemption authority for agents. */\n redemptions: CodexResetRedemptionRecovery[];\n};\n\n/** Independently settled live overview keyed by workspace credential id. */\nexport type CodexOverviewResponse = {\n accounts: Record<string, CodexAccountOverview>;\n};\n\nexport type CodexAllocatorUpdate = {\n allocatorEnabled: boolean;\n allocatorVersion: number;\n allocatorUpdatedAt: string | null;\n changed: boolean;\n};\n\n/** Per-workspace Codex rotation/active settings. New servers return `sharded`. */\nexport type CodexRotationSettings = {\n rotationEnabled: boolean;\n rotationStrategy: \"sharded\" | \"most_remaining\" | \"round_robin\" | \"drain_then_next\";\n activeCredentialId: string | null;\n};\n\n/** GET /codex/accounts — the accounts list + the workspace active pointer + settings. */\nexport type CodexAccountsResponse = {\n accounts: CodexAccount[];\n activeAccountId: string | null;\n source?: WorkspaceCodexSubscriptionSource;\n /** Added by Apps-aware servers; absent on older same-major deployments. */\n apps?: {\n available: boolean;\n credentialId: string | null;\n version: number;\n designatedAt: string | null;\n canDisable: boolean;\n };\n settings: CodexRotationSettings;\n};\n\nexport type OrganizationCodexAccountsResponse = Omit<CodexAccountsResponse, \"apps\" | \"source\">;\n\n/** Session-authorized choices: the accepted pool for a capacity wait, otherwise\n * the current pool for the next turn. Current execution may use another pool. */\nexport type SessionCodexAccountsResponse = Omit<CodexAccountsResponse, \"apps\" | \"source\"> & {\n currentSelection: { credentialId: string | null; waiting: boolean } | null;\n currentAccount: CodexAccount | null;\n pinnedAccountId: string | null;\n lastAccountId: string | null;\n};\n\nexport type CodexAppsUpdate = {\n credentialId: string | null;\n version: number;\n designatedAt: string | null;\n changed: boolean;\n};\n\n/** Payload of a `codex.account.switched` session event. */\nexport type CodexAccountSwitchedPayload = {\n fromAccountId: string | null;\n toAccountId: string;\n reason: \"manual\" | \"exhausted\" | \"rotation\";\n};\n\n/** Device-code start: show `userCode` at `verificationUri`, then poll with `state`. */\nexport type CodexConnectStart = {\n userCode: string;\n verificationUri: string;\n intervalSeconds: number;\n state: string;\n};\n\n/** Poll result: keep polling on `pending`, restart on `expired`, done on `connected`. */\nexport type CodexConnectPoll =\n | { status: \"pending\" }\n | { status: \"expired\" }\n | {\n status: \"connected\";\n plan?: string | null;\n accountId?: string;\n isActive?: boolean;\n /**\n * Opengeni's Codex models this account offers, read once from its live\n * model list at connect time. Absent when that read failed.\n */\n models?: Array<{ id: string; label: string }>;\n };\n\n/**\n * Who an account in the organization's list reaches: the workspace that owns\n * it (its own account, used only there), every workspace including new ones,\n * chosen shared workspaces, Personal workspaces, or chosen people.\n */\nexport type SubscriptionAccountReach = {\n /** The workspace whose own account this is, or null for an organization account. */\n ownerWorkspaceId: string | null;\n /** Every shared workspace, including ones created later. */\n everyWorkspace: boolean;\n /** The shared workspaces it reaches, when not every one. */\n workspaceIds: string[];\n /** Every Personal workspace. */\n personalWorkspaces: boolean;\n /** How many chosen people, or null when it is not limited to people. */\n people: number | null;\n};\n\n/** Explicit authority of one connected SuperGrok/xAI subscription account. */\nexport type SuperGrokAccountScope = \"workspace\" | \"user\" | \"organization\";\n\n/** Metadata-only connected SuperGrok account. Secret OAuth material never crosses the API. */\nexport type SuperGrokAccount = {\n id: string;\n /** The organization's list only: who the account reaches. */\n reach?: SubscriptionAccountReach;\n plan?: string | null;\n scope: SuperGrokAccountScope;\n subject: string;\n email?: string | null;\n label?: string | null;\n status: \"active\" | \"needs_relogin\" | \"error\";\n active: boolean;\n expiresAt?: string | null;\n lastRefreshAt?: string | null;\n lastError?: string | null;\n allocatorEnabled: boolean;\n allocatorVersion: number;\n allocatorUpdatedAt?: string | null;\n exhaustedUntil?: string | null;\n quota?: {\n usedPercent: number | null;\n periodStart: string | null;\n periodEnd: string | null;\n subscriptionTier: string | null;\n checkedAt: string | null;\n } | null;\n};\n\nexport type SuperGrokRotationSettings = {\n rotationEnabled: boolean;\n rotationStrategy: \"sharded\";\n activeCredentialId: string | null;\n};\n\n/** GET /supergrok/accounts — visible accounts plus the workspace active pointer. */\nexport type SuperGrokAccountsResponse = {\n source?: \"workspace\" | \"user\" | \"organization\";\n organizationId?: string;\n accounts: SuperGrokAccount[];\n activeAccountId: string | null;\n settings: SuperGrokRotationSettings;\n};\n\nexport type SuperGrokConnectionStatus = {\n connected: boolean;\n valid?: boolean;\n accountCount?: number;\n models?: ClientModel[];\n activeAccount?: {\n id: string;\n label?: string | null;\n subject?: string | null;\n scope: SuperGrokAccountScope;\n } | null;\n};\n\n/** Workspace is the deliberately simple/default connection authority. */\nexport type SuperGrokConnectStart = {\n userCode: string;\n verificationUri: string;\n verificationUriComplete?: string | null;\n intervalSeconds: number;\n expiresInSeconds: number;\n scope: SuperGrokAccountScope;\n state: string;\n};\n\nexport type SuperGrokConnectPoll =\n | { status: \"pending\" | \"slow_down\"; intervalSeconds?: number }\n | { status: \"expired\" | \"denied\" }\n | {\n status: \"connected\";\n accountId: string;\n scope: SuperGrokAccountScope;\n isActive: boolean;\n email?: string | null;\n };\n\nexport type SuperGrokAllocatorUpdate = {\n allocatorEnabled: boolean;\n allocatorVersion: number;\n allocatorUpdatedAt: string | null;\n changed: boolean;\n};\n\n/** Remaining usage/limits for one account. `usage` is the normalized P2 payload. */\nexport type CodexUsage = {\n status: \"ok\" | \"limit_reached\" | \"error\" | \"no-data\";\n usage: CodexUsagePayload | null;\n};\n\n/** Batched live-refresh response, keyed by credential id; each entry independently statused. */\nexport type CodexUsageMap = Record<string, CodexUsage>;\n\n/**\n * How a deployment expects clients to authenticate to it, surfaced so a UI can\n * wire up the right header/cookie without prior knowledge of the host setup.\n * Discriminated on `mode`; `none` is the back-compat default.\n */\nexport type ClientAuthConfig =\n | { mode: \"none\" }\n | { mode: \"deploymentKey\"; headerName: \"x-opengeni-access-key\" }\n | { mode: \"configuredToken\"; headerName: \"authorization\"; scheme: \"bearer\" }\n | {\n mode: \"managedSession\";\n session: \"cookie\";\n /** Defaults to true when omitted by an older deployment. */\n emailVerificationRequired?: boolean;\n /** Configured managed sign-in providers; omitted by older deployments. */\n socialProviders?: (\"google\" | \"github\")[];\n /**\n * False while the deployment has paused new account creation; existing\n * accounts can still sign in. Omitted (treat as true) by older deployments.\n */\n newSignupsEnabled?: boolean;\n signupChallengeSiteKey?: string | undefined;\n /** Sign in with a passkey, and add passkeys in Security; omitted (false) by older deployments. */\n passkeySignIn?: boolean;\n /** Create an account with only a name and a passkey; omitted (false) by older deployments. */\n passkeySignUp?: boolean;\n };\n\n// Kept value-identical to @opengeni/contracts and pinned by the SDK contract\n// parity suite. The SDK has no runtime dependency on the Zod contracts package.\nexport const OPENGENI_API_CONTRACT_REVISION = \"2026-09-plugins-and-skills-v1\" as const;\nexport const OPENGENI_API_CONTRACT_HEADER = \"x-opengeni-api-contract\" as const;\n/** Bounded request/response identifier shared by browser, ingress, and API diagnostics. */\nexport const OPENGENI_CORRELATION_HEADER = \"x-opengeni-correlation-id\" as const;\n\n/**\n * Public, unauthenticated-by-default client bootstrap config returned by\n * `GET /v1/config/client`: which models + reasoning efforts are exposed, the\n * MCP servers and file-upload limits a composer should offer, and how the\n * deployment expects the client to authenticate. `allowedModels` is kept for\n * back-compat; `models` carries the richer provider-grouped list for a picker.\n */\nexport type ClientConfig = {\n deploymentRevision: string;\n /**\n * The API's contract revision. Equals `OPENGENI_API_CONTRACT_REVISION` for a\n * `\"strict\"` client (it throws otherwise); a `\"compatible\"` client may\n * receive a newer revision from an additive deployment within its major.\n */\n apiContractRevision: string;\n serverVersion?: string | undefined;\n claudeSubscriptionEnabled?: boolean | undefined;\n /**\n * Organization admins may connect Azure OpenAI as this deployment's own\n * Microsoft Entra identity (the operator offers it). Absent otherwise.\n */\n azureOpenAIDeploymentIdentity?: boolean | undefined;\n /** Whether people can connect their own computers; absent on older servers. */\n connectedMachines?: boolean | undefined;\n /**\n * The Chrome extension people add to connect their own Chrome, and its\n * Chrome Web Store page; absent on older servers (Opengeni Browser).\n */\n browserExtension?: { name: string; installUrl: string } | undefined;\n defaultModel: string;\n allowedModels: string[];\n models: ClientModel[];\n defaultReasoningEffort: ReasoningEffort;\n allowedReasoningEfforts: ReasoningEffort[];\n defaultSandboxBackend?: SandboxBackend | undefined;\n mcpServers: { id: string; name: string }[];\n /** Deployment defaults and hard maximum for built-in Opengeni session tools. */\n firstPartyMcpTools?:\n | {\n default: FirstPartyMcpToolName[];\n allowed: FirstPartyMcpToolName[];\n }\n | undefined;\n fileUploads: { enabled: boolean; maxSizeBytes: number };\n /**\n * `false` when a host's session proxy fixes the model policy\n * (`createSessionProxyHandler({ modelSelection: false })`), so UIs hide the\n * model picker; `true` when the host explicitly offers end users model\n * choice (embedded stock UIs then show the picker). Opengeni itself omits it.\n */\n modelSelection?: boolean | undefined;\n /**\n * `false` when a host's session proxy owns chat setup (`createSession`), so\n * the browser cannot add a newly connected capability to a chat and stock\n * conversations leave the agent's capability cards to the host. Opengeni\n * itself omits it.\n */\n chatConnections?: boolean | undefined;\n /** Session proxy sandbox-path download opt-in; absent on native deployments. */\n sandboxFiles?: boolean | undefined;\n /**\n * `false` when a host's session proxy turns live voice off\n * (`createSessionProxyHandler({ realtimeVoice: false })`), so UIs hide the\n * voice button; `true` when the host explicitly offers it to end users\n * (embedded stock UIs then show the button). Otherwise absent: availability\n * comes from the workspace's realtime model catalog.\n */\n realtimeVoice?: boolean | undefined;\n /**\n * Session proxy only: the workspace the proxy resolved for this user, so a\n * browser pointed at the proxy (`<OpenGeniChat baseUrl=... />`) needs no\n * workspace id. Absent on native deployments and older proxies.\n */\n workspaceId?: string | undefined;\n /**\n * Session proxy capability for the embedded artifact viewer and inline Site\n * previews; absent on native deployments. The live socket is\n * ticket-authenticated and reached directly; the cache partition identifies\n * the proxied user. `false` when the proxy does not serve artifacts, so\n * stock UIs show Site previews as unavailable instead of failing on click.\n */\n artifacts?:\n | {\n editableLiveUrl: string;\n cachePartition: {\n accountId: string;\n principalId: string;\n authorizationEpoch: string;\n };\n }\n | false\n | undefined;\n /**\n * Session proxy only: whether the browser may start a chat (the proxy has a\n * `createSession` hook). Stock UIs hide \"New chat\" when `false`; absent on\n * native deployments and older proxies.\n */\n sessionCreation?: boolean | undefined;\n /**\n * Session proxy only: whether users may archive or restore their chats.\n * Stock UIs hide \"Archive\" when `false`; absent on native deployments.\n */\n archive?: boolean | undefined;\n /** Native browser microphone capture + server-side transcription capability. */\n voiceInput?: ClientVoiceInputConfig | undefined;\n /**\n * Whether the deployment offers the Jev-backed code_search agent tool and\n * what workspaces without their own setting get (`split` = half of sessions).\n */\n codeSearch?: { available: boolean; workspaceDefault: \"off\" | \"on\" | \"split\" } | undefined;\n /**\n * EU-only inference: each model-backed feature's region availability for the\n * caller's workspace. `unavailableReason: \"region_restricted\"` means the\n * workspace is EU-only and the feature has no EU route here. Absent on older\n * servers.\n */\n inferenceFeatures?: InferenceFeatureAvailability[] | undefined;\n /**\n * Present only when this deployment archives idle sessions: after `idleDays`\n * without activity a session (unless kept live) becomes read-only.\n */\n sessionArchive?: { enabled: true; idleDays: number } | undefined;\n /**\n * Present when the server records and enforces per-task usage limits.\n * `enabled: false` refuses new limits but still enforces and clears existing\n * ones. Omitted by older servers, which ignore `usageLimitMicros`.\n */\n sessionUsageLimits?: { enabled: boolean } | undefined;\n /**\n * Whether automations can have event triggers on this server: event sources,\n * the webhook intake and event runs. Omitted by older servers.\n */\n eventTriggers?: { enabled: boolean } | undefined;\n /** Agent configuration rollout and per-capability availability. */\n agentConfig?: ClientAgentConfig | undefined;\n productAccessMode: ProductAccessMode;\n /** Client-safe hint for whether the console should offer Stripe checkout. */\n billingMode?: BillingMode | undefined;\n managedAuthSessionSetMode: \"legacy\" | \"dual\" | \"broker\";\n auth: ClientAuthConfig;\n /**\n * Product documentation for a console Help link. `null` means the deployment\n * hides the link; absent means a server that predates the field.\n */\n documentationUrl?: string | null | undefined;\n analytics: {\n consentRequired: boolean;\n providers: {\n reo?: { clientId: string } | undefined;\n posthog?: { projectKey: string; host: string } | undefined;\n ga4?: { measurementId: string } | undefined;\n };\n };\n /** Operator-owned legal documents the signed-out console links to, when configured. */\n legal?:\n | {\n privacyPolicyUrl?: string | undefined;\n termsOfServiceUrl?: string | undefined;\n }\n | undefined;\n /** Operator support address the console offers as a mailto link, when configured. */\n supportEmail?: string | undefined;\n // Server-wide hint: does this deployment support Channel-A structured services\n // at all (P4.4). Per-session availability is negotiated on /stream-capabilities;\n // this is the coarse on/off the client uses to decide whether to even attempt\n // the fs/git/terminal panels.\n structuredServices: {\n fileSystem: boolean;\n git: boolean;\n terminalEvents: boolean;\n };\n};\n\n/** Client-safe voice-input capability projection. */\nexport type ClientVoiceInputConfig = {\n available: boolean;\n providers?: VoiceInputProviderId[] | undefined;\n /** Every model a dictation may name, of each ready provider. */\n models?: DictationModelOption[] | undefined;\n maxDurationSeconds: number;\n maxSizeBytes: number;\n acceptedMimeTypes: string[];\n resumable?: ClientResumableVoiceInputConfig | undefined;\n};\n\n/** A model a dictation can name, such as for one desktop dictation shortcut. */\nexport type DictationModelOption = {\n providerId: VoiceInputProviderId;\n providerName: string;\n model: string;\n name: string;\n};\n\nexport type ClientResumableVoiceInputConfig = {\n maxDurationSeconds: number;\n maxSizeBytes: number;\n maxChunkSizeBytes: number;\n providerSegmentSeconds: number;\n};\n\n/** Response from POST /v1/workspaces/:workspaceId/transcriptions. */\nexport type TranscribeAudioResponse = {\n text: string;\n languages: string[];\n};\n\nexport type AccountRole = \"owner\" | \"admin\" | \"member\";\n\nexport type AccessPrincipalKind =\n | \"human_session\"\n | \"agent_attempt\"\n | \"service\"\n | \"api_key\"\n | \"configured_key\";\n\nexport type AccountGrant = {\n accountId: string;\n subjectId: string;\n subjectLabel?: string | undefined;\n role?: AccountRole | undefined;\n permissions: Permission[];\n metadata?: Record<string, unknown> | undefined;\n};\n\nexport type AccessGrant = {\n workspaceId: string;\n accountId: string;\n subjectId: string;\n subjectLabel?: string | undefined;\n permissions: Permission[];\n /** Explicit policies never expand `workspace:admin` into unselected permissions. */\n permissionMode?: \"legacy\" | \"explicit\" | undefined;\n principalKind?: AccessPrincipalKind | undefined;\n metadata?: Record<string, unknown> | undefined;\n serviceInitiator?: ServiceTurnInitiator | undefined;\n serviceInitiatorContext?: ServiceTurnInitiatorContext | undefined;\n};\n\n/**\n * Authority of a directly used organization or workspace API key, separate\n * from the caller's account and workspace grants. Full organization keys can\n * provision shared workspaces, external members, and sessions through `asUser`;\n * those user requests additionally need the user's live membership.\n * Organization-key scope excludes Personal workspaces. Neither key kind bypasses\n * session visibility or the explicit `secrets:read` permission requirement.\n */\nexport type AccessCredential = {\n kind: \"organization_api_key\" | \"workspace_api_key\";\n /** Organization keys only; omitted for workspace keys. */\n access?: OrganizationApiKeyAccess | undefined;\n /** The key's organization id. */\n accountId: string;\n /** Null for an organization key; `workspaceScope` selects shared workspaces, never Personal. */\n workspaceId: string | null;\n /**\n * Effective workspace permissions, with admin expansion only for legacy keys. Excludes\n * account-only permissions and includes `secrets:read` only when explicitly\n * granted. Explicit policies grant exactly their selected permissions.\n */\n effectiveWorkspacePermissions: Permission[];\n /** Organization keys only; the preset label never adds permissions. */\n policy?: OrganizationAccessPolicy | undefined;\n /** Organization keys only; omitted on older servers. */\n workspaceScope?: OrganizationWorkspaceScope | undefined;\n /** Plain-language explanation of the key's scope and limits. */\n note: string;\n};\n\n/** Caller identity, grants, defaults, and optional direct API-key authority. */\nexport type AccessContext = {\n mode: ProductAccessMode;\n subjectId: string;\n subjectLabel?: string | undefined;\n accountGrants: AccountGrant[];\n workspaceGrants: AccessGrant[];\n defaultAccountId: string | null;\n defaultWorkspaceId: string | null;\n /**\n * Direct API-key authority; omitted for `asUser`/external actors, humans,\n * delegated tokens, other caller contexts, and older servers. Existing grants\n * are unchanged. Full organization keys can provision shared workspaces,\n * external members, and `asUser` sessions; user requests still need live\n * membership. Organization-key scope excludes Personal workspaces. Neither key\n * kind bypasses session visibility or the explicit `secrets:read` requirement.\n */\n credential?: AccessCredential | undefined;\n};\n\nexport type ManagedOrganizationMembership = {\n id: string;\n organizationId: string;\n status: \"active\";\n personalWorkspaceId: string;\n /**\n * False when the organization turned Personal workspaces off: the person no\n * longer sees or starts new work there. Absent means on.\n */\n personalWorkspacesEnabled?: boolean | undefined;\n /**\n * The person's current answer to \"How do you want to use Opengeni?\" for\n * this organization: get help with everyday things, add agents to a product,\n * or run agents in the cloud. Absent when the server keeps no answer for them.\n */\n signupUseCase?: \"everyday\" | \"embed\" | \"cloud\" | undefined;\n};\n\nexport type ListManagedOrganizationMembershipsResponse = {\n memberships: ManagedOrganizationMembership[];\n};\n\nexport type UserResourceKind =\n | \"connection\"\n | \"document\"\n | \"variable_set\"\n | \"rig\"\n | \"connected_machine\"\n | \"subscription_connection\";\nexport type UserResourceGrantAction =\n | \"connection.use\"\n | \"document.read\"\n | \"variable_set.use\"\n | \"rig.use\"\n | \"connected_machine.use\"\n | \"subscription_connection.use\";\nexport type UserResourceAuthorityGrant = {\n grantId: string;\n targetWorkspaceId: string;\n targetSessionId: string | null;\n action: UserResourceGrantAction;\n mode: \"once\" | \"session\" | \"always\";\n context: \"user_private\" | \"workspace_shared\";\n authorityEpoch: number | null;\n generation: number;\n status: \"active\" | \"consumed\" | \"revoked\" | \"expired\";\n expiresAt: string | null;\n delegation: UserResourceDelegation;\n};\nexport type UserResourceAuthoritySummary = {\n authorityId: string;\n resourceKind: UserResourceKind;\n resourceId: string;\n originWorkspaceId: string | null;\n generation: number;\n status: \"active\" | \"retained\" | \"revoked\";\n grants: UserResourceAuthorityGrant[];\n};\nexport type ListUserResourceAuthoritiesOptions = {\n resourceKind: Exclude<UserResourceKind, \"connection\">;\n cursor?: string | undefined;\n limit?: number | undefined;\n};\nexport type ListUserResourceAuthoritiesResponse = {\n scope: \"user\";\n authorities: UserResourceAuthoritySummary[];\n nextCursor: string | null;\n};\nexport type IssueUserResourceGrantRequest =\n | {\n scope: \"user\";\n resourceKind: Exclude<UserResourceKind, \"connection\">;\n mode: \"session\";\n context: \"user_private\" | \"workspace_shared\";\n sessionId: string;\n expectedAuthorityEpoch: number;\n workspaceSharedAcknowledged?: boolean | undefined;\n }\n | {\n scope: \"user\";\n /** `connection` turns your own login on for your messages in this\n * workspace (its `authorityId` from `listOwnConnectionAccounts`). */\n resourceKind: UserResourceKind;\n mode: \"always\";\n context: \"user_private\" | \"workspace_shared\";\n sessionId?: null | undefined;\n expectedAuthorityEpoch?: null | undefined;\n workspaceSharedAcknowledged?: boolean | undefined;\n };\nexport type UserResourceGrantMutationResponse = {\n scope: \"user\";\n grant: UserResourceAuthorityGrant;\n};\nexport type RevokeUserResourceGrantResponse = {\n scope: \"user\";\n grant: {\n grantId: string;\n generation: number;\n status: \"revoked\";\n revokedAt: string;\n };\n};\n/** Your own things that you turn on workspace by workspace. */\nexport type OwnResourceReachKind = \"connection\" | \"subscription_connection\" | \"connected_machine\";\n/** One of your workspaces in \"Where it works\" for your own login, plan or machine. */\nexport type OwnResourceReachWorkspace = {\n workspaceId: string;\n name: string;\n /** Your Personal workspace. */\n personal: boolean;\n /** The workspace this was asked from. */\n current: boolean;\n /** It works here for your own messages. Nobody else's messages ever use it. */\n on: boolean;\n /** Always on here: logins and plans in your Personal workspace. */\n alwaysOn: boolean;\n /** You may turn it on or off here. */\n canChange: boolean;\n};\nexport type OwnResourceReachResponse = {\n resourceKind: OwnResourceReachKind;\n resourceId: string;\n /** Your Personal workspace first, then by name. */\n workspaces: OwnResourceReachWorkspace[];\n};\nexport type SetOwnResourceReachRequest = {\n resourceKind: OwnResourceReachKind;\n resourceId: string;\n on: boolean;\n};\nexport type SetOwnResourceReachResponse = { workspace: OwnResourceReachWorkspace };\n/** One of your own logins, model plans or machines, with where it works. */\nexport type OwnResource = {\n resourceKind: OwnResourceReachKind;\n resourceId: string;\n /** A login's or plan's account (its email when known), or a machine's name. */\n name: string;\n /** Login: the service it signs in to. Plan: the provider (`codex`, `claude`, `xai`). Machine: null. */\n provider: string | null;\n /** Plan only: the plan the provider reports, when known. */\n plan: string | null;\n /** Your Personal workspace first, then by name. */\n workspaces: OwnResourceReachWorkspace[];\n};\nexport type OwnResourcesResponse = {\n /** Logins, then plans, then machines, each by name. */\n resources: OwnResource[];\n};\n\nexport type OrganizationMembershipRole = \"owner\" | \"admin\" | \"member\";\nexport type WorkspaceMemberRole = \"viewer\" | \"member\" | \"admin\" | \"custom\";\nexport type AssignableWorkspaceMemberRole = \"viewer\" | \"member\" | \"admin\";\nexport type OrganizationUserSetupDelivery = {\n id: string;\n state: \"pending\" | \"sent\" | \"failed\" | \"outcome_unknown\" | \"revoked\";\n attemptCount: number;\n revision: number;\n errorClass: string | null;\n retryState: \"available\" | \"reconciliation_required\" | \"unavailable\";\n sentAt: string | null;\n updatedAt: string;\n};\nexport type OrganizationInvitation = {\n id: string;\n organizationId: string;\n organizationName: string | null;\n targetEmail: string;\n targetName: string | null;\n initialWorkspaceIds: string[];\n role: OrganizationMembershipRole;\n status: \"pending\" | \"accepted\" | \"revoked\" | \"expired\";\n revision: number;\n expiresAt: string;\n acceptedMembershipId: string | null;\n createdAt: string;\n updatedAt: string;\n delivery: OrganizationUserSetupDelivery | null;\n};\nexport type OrganizationMember = {\n id: string;\n organizationId: string;\n subjectId: string;\n name: string | null;\n email: string | null;\n role: OrganizationMembershipRole;\n status: \"provisioning\" | \"active\" | \"suspended\" | \"revoked\";\n authorizationRevision: number;\n personalWorkspaceId: string | null;\n revokedAt: string | null;\n personalRetentionUntil: string | null;\n createdAt: string;\n updatedAt: string;\n};\nexport type OrganizationAdministrationMemberWorkspaceAccess = {\n workspaceId: string;\n workspaceName: string;\n membershipId: string;\n role: WorkspaceMemberRole;\n updatedAt: string;\n};\nexport type OrganizationAdministrationMember = {\n id: string;\n organizationId: string;\n subjectId: string;\n name: string | null;\n email: string | null;\n role: OrganizationMembershipRole;\n status: \"provisioning\" | \"active\" | \"suspended\" | \"revoked\";\n authorizationRevision: number;\n sharedWorkspaceAccess: OrganizationAdministrationMemberWorkspaceAccess[];\n revokedAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\nexport type OrganizationSummary = {\n id: string;\n name: string;\n createdAt: string;\n updatedAt: string;\n};\nexport type OrganizationWorkspaceAccessMember = {\n membershipId: string;\n organizationMembershipId: string | null;\n subjectId: string;\n name: string | null;\n email: string | null;\n subjectLabel: string | null;\n principalKind: \"human\" | \"service\";\n organizationRole: OrganizationMembershipRole | null;\n role: WorkspaceMemberRole;\n permissions: string[];\n createdAt: string;\n updatedAt: string;\n};\nexport type OrganizationWorkspaceAccess = {\n id: string;\n name: string;\n slug: string | null;\n createdAt: string;\n updatedAt: string;\n members: OrganizationWorkspaceAccessMember[];\n};\nexport type OrganizationAdministrationOverview = {\n organization: OrganizationSummary;\n roles: OrganizationWorkspaceRoleDefinition[];\n workspaces: OrganizationWorkspaceAccess[];\n};\nexport type OrganizationWorkspaceRoleDefinition = {\n role: AssignableWorkspaceMemberRole;\n label: string;\n description: string;\n permissions: Permission[];\n};\nexport type OrganizationPrivateSessionSettings = {\n organizationId: string;\n enabled: boolean;\n available: boolean;\n version: number;\n updatedAt: string;\n changed?: boolean;\n};\nexport type CreateOrganizationWorkspaceRequest = {\n name: string;\n operationId: string;\n};\nexport type UpdateOrganizationWorkspaceRequest = {\n name: string;\n expectedUpdatedAt: string;\n operationId: string;\n};\nexport type PutOrganizationWorkspaceMemberRequest =\n | {\n role: AssignableWorkspaceMemberRole;\n expectedUpdatedAt: string | null;\n operationId: string;\n }\n | {\n role: \"custom\";\n permissions: Permission[];\n expectedUpdatedAt: string | null;\n operationId: string;\n };\nexport type RevokeOrganizationWorkspaceMemberRequest = {\n expectedUpdatedAt: string;\n operationId: string;\n};\nexport type RevokeOrganizationWorkspaceMemberResponse = {\n removed: boolean;\n replay: boolean;\n};\nexport type CreateOrganizationRequest = {\n name: string;\n operationId: string;\n};\nexport type CreateOrganizationResponse = {\n organization: OrganizationSummary;\n workspaceId: string;\n};\nexport type CreateAdditionalOrganizationRequest = {\n name: string;\n workspaceName: string;\n operationId: string;\n};\nexport type CreateAdditionalOrganizationResponse = {\n organization: OrganizationSummary;\n workspaceId: string;\n personalWorkspaceId: string;\n};\nexport type UpdateOrganizationNameRequest = {\n name: string;\n expectedUpdatedAt: string;\n operationId: string;\n};\nexport type UpdateOrganizationPrivateSessionSettingsRequest = {\n enabled: boolean;\n expectedVersion: number;\n operationId: string;\n};\nexport type OrganizationRetentionPolicy = {\n organizationId: string;\n mode: \"retain\" | \"delete_after\";\n retentionDays: number | null;\n version: number;\n updatedAt: string;\n};\nexport type OrganizationRecoveryPolicyState =\n | \"pending_acceptance\"\n | \"active\"\n | \"degraded\"\n | \"superseded\"\n | \"disabled\";\nexport type OrganizationRecoveryOperationState =\n | \"collecting\"\n | \"cooling\"\n | \"executed\"\n | \"cancelled\"\n | \"expired\"\n | \"superseded\";\nexport type OrganizationRecoveryUnavailableReason =\n | \"no_policy\"\n | \"pending_acceptance\"\n | \"degraded\"\n | \"disabled\"\n | \"identity_unavailable\";\nexport type OrganizationRecoveryMemberSummary = {\n membershipId: string;\n name: string | null;\n email: string | null;\n};\nexport type OrganizationRecoveryCustodian = OrganizationRecoveryMemberSummary & {\n ordinal: number;\n enrollmentState: \"pending_acceptance\" | \"accepted\" | \"ineligible\";\n acceptedAt: string | null;\n};\nexport type OrganizationRecoveryPolicy = {\n id: string;\n organizationId: string;\n revision: number;\n state: OrganizationRecoveryPolicyState;\n custodians: OrganizationRecoveryCustodian[];\n createdAt: string;\n updatedAt: string;\n};\nexport type OrganizationRecoveryApproval = OrganizationRecoveryMemberSummary & {\n approvedAt: string;\n};\nexport type OrganizationRecoveryOperation = {\n id: string;\n organizationId: string;\n policyId: string;\n policyRevision: number;\n revision: number;\n state: OrganizationRecoveryOperationState;\n target: OrganizationRecoveryMemberSummary;\n approvals: OrganizationRecoveryApproval[];\n approvalCount: number;\n quorumAt: string | null;\n executableAt: string | null;\n expiresAt: string;\n executedAt: string | null;\n cancelledAt: string | null;\n notificationJournaled: boolean;\n createdAt: string;\n updatedAt: string;\n};\nexport type OrganizationRecoveryCapabilities = {\n configure: boolean;\n accept: boolean;\n disable: boolean;\n start: boolean;\n approve: boolean;\n cancel: boolean;\n execute: boolean;\n};\nexport type OrganizationRecoveryOverview = {\n organizationId: string;\n availability: \"available\" | \"recovery_unavailable\";\n unavailableReason: OrganizationRecoveryUnavailableReason | null;\n recentReauthenticationAt: string | null;\n eligibleMembers: OrganizationRecoveryMemberSummary[];\n policy: OrganizationRecoveryPolicy | null;\n operation: OrganizationRecoveryOperation | null;\n capabilities: OrganizationRecoveryCapabilities;\n};\nexport type ConfigureOrganizationRecoveryPolicyRequest = {\n custodianMembershipIds: [string, string, string];\n expectedPolicyRevision: number;\n operationId: string;\n};\nexport type AcceptOrganizationRecoveryCustodyRequest = {\n expectedPolicyRevision: number;\n operationId: string;\n};\nexport type DisableOrganizationRecoveryPolicyRequest = AcceptOrganizationRecoveryCustodyRequest;\nexport type StartOrganizationRecoveryOperationRequest = {\n targetMembershipId: string;\n expectedPolicyRevision: number;\n operationId: string;\n};\nexport type OrganizationRecoveryOperationCommandRequest = {\n expectedOperationRevision: number;\n operationId: string;\n};\nexport type OrganizationRecoveryMutationResponse = {\n replay: boolean;\n overview: OrganizationRecoveryOverview;\n};\nexport type CreateOrganizationInvitationRequest = {\n email: string;\n name?: string;\n initialWorkspaceIds?: string[];\n role?: OrganizationMembershipRole;\n expiresAt: string;\n operationId: string;\n};\nexport type AcceptOrganizationInvitationRequest = {\n expectedRevision: number;\n operationId: string;\n};\nexport type RevokeOrganizationInvitationRequest = AcceptOrganizationInvitationRequest;\nexport type PreviewOrganizationUserSetupRequest = { token: string };\nexport type OrganizationUserSetupPreview =\n | { state: \"unavailable\" | \"expired\" | \"revoked\" | \"completed\" }\n | {\n state: \"pending\";\n organizationId: string;\n organizationName: string;\n targetEmail: string;\n targetName: string | null;\n organizationRole: OrganizationMembershipRole;\n sharedWorkspaceAccess: Array<{\n workspaceId: string;\n workspaceName: string;\n role: AssignableWorkspaceMemberRole;\n }>;\n expiresAt: string;\n };\nexport type RetryOrganizationUserSetupDeliveryRequest = { operationId: string };\nexport type UpdateOrganizationMemberRequest = {\n kind: \"change_role\" | \"suspend\" | \"reactivate\" | \"offboard\";\n role?: OrganizationMembershipRole;\n expectedAuthorizationRevision: number;\n operationId: string;\n reason?: string;\n};\nexport type UpdateOrganizationRetentionPolicyRequest = {\n mode: \"retain\" | \"delete_after\";\n retentionDays: number | null;\n expectedVersion: number;\n operationId: string;\n};\nexport type ListOrganizationInvitationsPageResponse = {\n invitations: OrganizationInvitation[];\n nextCursor: string | null;\n};\nexport type ListOrganizationMembersResponse = {\n members: OrganizationAdministrationMember[];\n};\nexport type ListOrganizationAdministrationMembersResponse = {\n members: OrganizationAdministrationMember[];\n};\n/** An active person in the organization, by name only. */\nexport type OrganizationMemberName = {\n /** The organization membership id. */\n id: string;\n name: string | null;\n you: boolean;\n};\n/** `available` is false until the deployment's database grants the names list. */\nexport type ListOrganizationMemberNamesResponse = {\n available: boolean;\n members: OrganizationMemberName[];\n};\nexport type AcceptOrganizationInvitationResponse = {\n invitation: OrganizationInvitation;\n membership: OrganizationMember;\n};\n\nexport type Workspace = {\n id: string;\n accountId: string;\n kind: \"personal\" | \"shared\";\n name: string;\n slug: string | null;\n externalSource: string | null;\n externalId: string | null;\n agentInstructions: string | null;\n settings: Record<string, unknown>;\n inferenceControl: {\n timer?: WorkspacePauseTimer | null | undefined;\n serverTime?: string | undefined;\n state: \"active\" | \"paused\";\n revision: number;\n reason: string | null;\n changedBy: string | null;\n changedAt: string | null;\n };\n defaultRigId?: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type WorkspaceDefaultExecutionTarget =\n | { kind: \"managed\" }\n | { kind: \"machine\"; targetSandboxId: string };\n\n/**\n * `GET/PUT /v1/workspaces/:id/my-default-execution-target`: the caller's own\n * placement for the new chats they start in the workspace (\"Your default\n * machine\"). Null follows the workspace default. `usable` is false when the\n * saved machine is no longer available to them.\n */\nexport type MemberDefaultExecutionTarget = {\n target: WorkspaceDefaultExecutionTarget | null;\n usable: boolean;\n};\n\nexport type WorkspaceSettings = {\n /** Exact product-model preferences. Invalid/newer values are ignored per model. */\n modelCompactionThresholds?: unknown;\n memoryEnabled?: boolean | undefined;\n /** Reversible Memory V1 prompt composition rollout. */\n memoryPromptMode?: \"legacy_standing\" | \"retrieval_only\" | undefined;\n /** Model policy inherited by new chats and scheduled tasks. */\n sessionDefaults?: WorkspaceSessionDefaults | undefined;\n /** Exact capability selection inherited by new top-level sessions. */\n sessionToolDefaults?: WorkspaceSessionToolDefaults | undefined;\n /** Allowlisted sandbox image for new managed boxes; absent uses the deployment image. */\n defaultSandboxImage?: string | null | undefined;\n /** Placement for new chats; null follows the deployment default. */\n defaultExecutionTarget?: WorkspaceDefaultExecutionTarget | null | undefined;\n voiceInput?: WorkspaceVoiceInputSettings | undefined;\n transcription?: WorkspaceTranscriptionPolicy | undefined;\n maxNestedAgentDepth?: number | null | undefined;\n /** Default for new Codex sessions; absent ⇒ remote_v2. */\n codexCompactionDefault?: \"remote_v2\" | \"portable\" | undefined;\n /** Whether agents may invoke the built-in structured human-input tool. */\n agentHumanInputEnabled?: boolean | undefined;\n /**\n * What an ordinary Send does in the console composer while the agent is\n * working: `queue` (absent) runs it after the current turn, `steer` has the\n * agent read it at its next model step.\n */\n busySend?: \"queue\" | \"steer\" | undefined;\n /** Whether agents get the Jev-backed code_search tool; absent or null follows the deployment. */\n codeSearchEnabled?: boolean | null | undefined;\n /**\n * Realtime voice settings by realtime model id. Read one model's settings\n * from the realtime model catalog's `workspaceVoiceSettings`.\n */\n realtimeVoice?: Record<string, unknown> | undefined;\n /** The workspace's default realtime voice model; null or absent follows the organization. */\n realtimeDefaultModel?: string | null | undefined;\n slackReactionSummon?: WorkspaceSlackReactionSummonSettings | undefined;\n /** Slack orchestration notices; both default off when absent or invalid. */\n slackOrchestrationNotices?: WorkspaceSlackOrchestrationNoticeSettings | undefined;\n /** False blocks every model billed in Opengeni credits; absent allows them. */\n allowCreditModels?: boolean | undefined;\n [key: string]: unknown;\n};\n\nexport type WorkspaceSessionDefaults = {\n model: string;\n reasoningEffort: ReasoningEffort;\n};\n\nexport type WorkspaceSessionToolDefaults = {\n inheritConnectedMcpServers?: boolean | undefined;\n mcpServerIds?: string[];\n firstPartyMcpTools?: FirstPartyMcpToolName[];\n};\n\nexport type WorkspaceSlackReactionSummonSettings = {\n enabled: boolean;\n emoji: \"genie\";\n channelPolicy: { mode: \"bot_member\" } | { mode: \"allowlist\"; channelIds: string[] };\n};\n\n/**\n * Per-workspace switches for the two Slack orchestration notices. Both are off\n * unless the workspace explicitly turned them on.\n */\nexport type WorkspaceSlackOrchestrationNoticeSettings = {\n /** Post a pointer card when a child worker blocks on input or an approval. */\n childRequiresAction?: boolean | undefined;\n /** Post one line when a goal pauses for budget or the continuation cap. */\n goalPaused?: boolean | undefined;\n};\n\nexport type SlackReactionChannel = {\n id: string;\n name: string | null;\n isPrivate: boolean;\n};\n\nexport type SlackReactionChannelListResponse = {\n channels: SlackReactionChannel[];\n nextCursor: string | null;\n};\n\nexport type SlackChannelRoute = {\n slackChannelId: string;\n targetWorkspaceId: string;\n targetWorkspaceName: string | null;\n /** Set when a Slack agent answers in this channel. */\n slackAgentId?: string | null | undefined;\n slackAgentName?: string | null | undefined;\n source: \"picker\" | \"admin\";\n updatedAt: string;\n};\n\nexport type SlackChannelRouteListResponse = {\n routes: SlackChannelRoute[];\n routingEnabled: boolean;\n};\n\nexport type UpdateSlackChannelRoutesRequest = {\n connectionId: string;\n routes: Array<{\n slackChannelId: string;\n targetWorkspaceId: string | null;\n /** A Slack agent working in `targetWorkspaceId`; omitted or null is plain Opengeni. */\n slackAgentId?: string | null | undefined;\n }>;\n};\n\nexport type VoiceInputProviderId =\n | \"azure-mai\"\n | \"azure-speech\"\n | \"elevenlabs\"\n | \"supergrok-subscription\"\n | \"codex-subscription\"\n | \"openai\"\n | \"azure-openai\";\n\nexport type WorkspaceVoiceInputSettings = {\n enabled: boolean;\n preferredProvider?: VoiceInputProviderId | null | undefined;\n fallbackEnabled?: boolean | undefined;\n};\n\nexport type UpdateWorkspaceSettingsRequest = {\n /** Independent model patches; null restores that model's default. */\n modelCompactionThresholds?: Record<string, number | null>;\n memoryEnabled?: boolean | undefined;\n memoryPromptMode?: \"legacy_standing\" | \"retrieval_only\" | undefined;\n /** null removes the workspace's own default so it follows its organization's. */\n sessionDefaults?: WorkspaceSessionDefaults | null | undefined;\n sessionToolDefaults?:\n | {\n mcpServerIds?: string[] | null;\n firstPartyMcpTools?: FirstPartyMcpToolName[] | null;\n inheritConnectedMcpServers?: boolean | null;\n }\n | undefined;\n voiceInput?: WorkspaceVoiceInputSettings | undefined;\n transcription?: WorkspaceTranscriptionPolicy | undefined;\n maxNestedAgentDepth?: number | null | undefined;\n codexCompactionDefault?: \"remote_v2\" | \"portable\" | undefined;\n agentHumanInputEnabled?: boolean | undefined;\n busySend?: \"queue\" | \"steer\" | undefined;\n codeSearchEnabled?: boolean | null | undefined;\n /**\n * Voice settings by realtime model id, for example\n * `{ \"workspace-elevenlabs/eleven_realtime_v1_max\": { voice: \"<voice id>\", language: \"no\" } }`.\n * Each listed model's settings are replaced; null removes that model's\n * settings; models not listed keep theirs.\n */\n realtimeVoice?: Record<string, RealtimeVoiceSettings | null> | undefined;\n /**\n * The voice model new voice conversations in this workspace start with\n * until the person picks one; null follows the organization again.\n */\n realtimeDefaultModel?: SessionRealtimeModel | null | undefined;\n slackReactionSummon?: WorkspaceSlackReactionSummonSettings | undefined;\n slackOrchestrationNotices?: WorkspaceSlackOrchestrationNoticeSettings | undefined;\n /** One of `listWorkspaceSandboxImages().images`, or null for the deployment image. */\n defaultSandboxImage?: string | null | undefined;\n /** Placement for new chats; null follows the deployment default. */\n defaultExecutionTarget?: WorkspaceDefaultExecutionTarget | null | undefined;\n /** Agent defaults for new sessions; null clears. Requires the admission switch. */\n sessionAgentDefaults?: WorkspaceAgentDefaults | null | undefined;\n /**\n * False blocks every model billed in Opengeni credits in this workspace,\n * including ones added later; true allows them again.\n */\n allowCreditModels?: boolean | undefined;\n [key: string]: unknown;\n};\n\nexport type SetWorkspaceDefaultRigRequest = {\n rigId: string | null;\n};\n\nexport type CreateWorkspaceRequest = {\n accountId?: string | undefined;\n name: string;\n slug?: string | undefined;\n externalSource?: string | undefined;\n externalId?: string | undefined;\n agentInstructions?: string | null | undefined;\n};\n\nexport type EnsureWorkspaceRequest = {\n /**\n * Owning organization id. An organization API key may omit it and the\n * workspace is created in the key's own organization; every other caller\n * must send it.\n */\n accountId?: string | undefined;\n externalSource: string;\n externalId: string;\n name: string;\n slug?: string | undefined;\n agentInstructions?: string | null | undefined;\n};\n\nexport type EnsureWorkspaceResponse = {\n workspace: Workspace;\n created: boolean;\n};\n\nexport type UpdateWorkspaceRequest = {\n name?: string | undefined;\n slug?: string | null | undefined;\n agentInstructions?: string | null | undefined;\n};\n\n/**\n * Legacy organization API key access tier, derived by the server from the key's\n * permissions: `full` can provision shared workspaces, external members, and\n * `asUser` sessions (user requests additionally need live membership);\n * `read` only inventories shared workspaces and reads their sessions, events,\n * and files. `developer_setup` configures shared workspaces and budgets without\n * API-key management or credential delegation; its default expiry is 24 hours.\n * Organization-key scope excludes Personal workspaces and bypasses neither\n * session visibility nor the explicit `secrets:read` permission requirement.\n */\nexport type OrganizationApiKeyAccess = \"full\" | \"read\" | \"developer_setup\";\n\n/** Informational preset label; the server recomputes it from explicit permissions. */\nexport type OrganizationAccessPreset = \"read_only\" | \"full\" | \"custom\";\n\n/** Organization-key scope always excludes Personal workspaces. */\nexport type OrganizationWorkspaceScope =\n | { kind: \"all\" }\n | {\n kind: \"selected\";\n /** Up to 500 unique shared-workspace IDs in the same organization. Empty reaches none. */\n workspaceIds: string[];\n };\n\nexport type OrganizationAccessPolicy = {\n preset: OrganizationAccessPreset;\n /** Exact grants, including `workspace:admin` individually; no implicit wildcard. */\n permissions: Permission[];\n workspaceScope: OrganizationWorkspaceScope;\n};\n\nexport type OrganizationActor = \"user\" | \"organization\";\n\nexport type ApiKey = {\n id: string;\n accountId: string;\n workspaceId: string | null;\n name: string;\n description: string | null;\n prefix: string;\n permissions: Permission[];\n /** Organization keys only; omitted for workspace-scoped keys. */\n access?: OrganizationApiKeyAccess | undefined;\n policy?: OrganizationAccessPolicy | undefined;\n workspaceScope?: OrganizationWorkspaceScope | undefined;\n /** Legacy keys retain their historical workspace-admin wildcard. */\n permissionMode?: \"legacy\" | \"explicit\" | undefined;\n /** Organization keys: the service account that holds the key. */\n serviceAccount?:\n | { id: string; name: string; role: OrganizationServiceAccountRole }\n | null\n | undefined;\n expiresAt: string | null;\n revokedAt: string | null;\n lastUsedAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type CreateApiKeyRequest = {\n name: string;\n description?: string | undefined;\n permissions: Permission[];\n expiresAt?: string | undefined;\n};\n\nexport type CreateApiKeyResponse = {\n apiKey: ApiKey;\n /** The full secret token — shown once at creation, never returned again. */\n token: string;\n};\n\nexport type CreateOrganizationApiKeyRequest = {\n name: string;\n description?: string | undefined;\n expiresAt?: string | undefined;\n /** With no policy, omitted means legacy `full`. */\n access?: OrganizationApiKeyAccess | undefined;\n /** Optional creation alias for the developer_setup access tier. */\n preset?: \"developer_setup\" | undefined;\n /** Explicit grants and shared-workspace scope; do not combine with legacy access/preset. */\n policy?: OrganizationAccessPolicy | undefined;\n /** The service account that holds the key; omitted creates one named after the key. */\n serviceAccountId?: string | undefined;\n};\n\n/** The server requires at least one change. Omitted fields stay unchanged. */\nexport type UpdateOrganizationApiKeyRequest = {\n name?: string | undefined;\n description?: string | null | undefined;\n /** Replaces the policy and transitions a legacy key to explicit permission semantics. */\n policy?: OrganizationAccessPolicy | undefined;\n};\n\nexport type ListApiKeysResponse = {\n apiKeys: ApiKey[];\n};\n\n// --- Service accounts ----------------------------------------------------------------------------\n\n/** Up to admin, never owner. A member's keys never hold administrator permissions. */\nexport type OrganizationServiceAccountRole = \"admin\" | \"member\";\n\n/** An organization identity with no person behind it; it holds organization API keys. */\nexport type OrganizationServiceAccount = {\n id: string;\n organizationId: string;\n name: string;\n description: string | null;\n role: OrganizationServiceAccountRole;\n /** Keys that are not revoked, including expired ones. */\n activeKeyCount: number;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type ListOrganizationServiceAccountsResponse = {\n serviceAccounts: OrganizationServiceAccount[];\n};\n\nexport type CreateOrganizationServiceAccountRequest = {\n name: string;\n description?: string | undefined;\n /** Defaults to member. Only an organization administrator can choose admin. */\n role?: OrganizationServiceAccountRole | undefined;\n};\n\n/** The server requires at least one change. Making it a member narrows its keys. */\nexport type UpdateOrganizationServiceAccountRequest = {\n name?: string | undefined;\n description?: string | null | undefined;\n role?: OrganizationServiceAccountRole | undefined;\n};\n\n// --- Connected agents (organization MCP server) ------------------------------------------------\n\n/** An outside agent a person connected to the organization MCP server. */\nexport type OrganizationMcpConnection = {\n id: string;\n /** The name the client registered with (\"Claude Code\"). */\n clientName: string;\n /** Where its sign-in returned to (\"127.0.0.1:4567\", \"cursor.com\"). */\n clientHost: string | null;\n /** Signed-in agents act as the person who connected them. */\n actor: \"user\";\n connectedBy: { subjectId: string; name: string };\n /** What it can do and where. The person's own live access still caps it. */\n policy: OrganizationAccessPolicy;\n createdAt: string;\n lastUsedAt: string | null;\n expiresAt: string;\n revokedAt: null;\n /**\n * Listed agents: whether the caller can disconnect this one. Everyone\n * disconnects their own; owners and admins anyone's, except only an owner an\n * owner's.\n */\n canDisconnect?: boolean;\n};\n\nexport type OrganizationMcpConnectionList = {\n connections: OrganizationMcpConnection[];\n /** Owners and admins see and can disconnect everyone's agents. */\n canManageAll: boolean;\n};\n\nexport type UpdateOrganizationMcpConnectionRequest = {\n access: OrganizationAccessPolicy;\n};\n\n// --- Personal API keys ---------------------------------------------------------------------------\n\n/**\n * A key that acts as the person who created it: their live access in this\n * organization, capped by `access`. It stops working when they leave.\n */\nexport type PersonalApiKey = {\n id: string;\n organizationId: string;\n name: string;\n description: string | null;\n /** The first characters of the key, to recognize it. */\n prefix: string;\n access: OrganizationAccessPolicy;\n owner: { subjectId: string; name: string };\n expiresAt: string | null;\n lastUsedAt: string | null;\n createdAt: string;\n /**\n * Listed keys: whether the caller can revoke this one. Everyone revokes their\n * own; owners and admins anyone's, except only an owner an owner's.\n */\n canRevoke?: boolean;\n};\n\nexport type ListPersonalApiKeysResponse = {\n apiKeys: PersonalApiKey[];\n /** Owners and admins see everyone's keys and can revoke them. */\n canManageAll: boolean;\n};\n\nexport type CreatePersonalApiKeyRequest = {\n name: string;\n description?: string | undefined;\n access: OrganizationAccessPolicy;\n /** Omitted means the key never expires. */\n expiresAt?: string | undefined;\n};\n\nexport type CreatePersonalApiKeyResponse = {\n apiKey: PersonalApiKey;\n /** The full secret token, shown once at creation. */\n token: string;\n};\n\n/** A pending agent sign-in, as the web app's sign-in page shows it. */\nexport type McpConnectionRequest = {\n client: { name: string; host: string | null };\n person: { name: string | null };\n organizations: Array<{\n id: string;\n name: string;\n workspaces: Array<{ id: string; name: string; personal: boolean }>;\n /** Everything the person can do there; the most an agent can get. */\n grantable: Permission[];\n }>;\n defaultOrganizationId: string | null;\n};\n\nexport type McpConnectionDecision =\n | { decision: \"deny\" }\n | {\n decision: \"approve\";\n organizationId: string;\n access: OrganizationAccessPolicy;\n };\n\n// --- Inbox ---------------------------------------------------------------------------------------\n\n/** Why an inbox item waits on the person. */\nexport type InboxItemKind = \"question\" | \"approval\" | \"goal_paused\" | \"notification\" | \"reply\";\n\n/**\n * One thing that waits on the person: a question, an approval, a goal the agent\n * paused on them, or an agent's notification. It leaves the inbox when it is\n * answered, resolved, withdrawn or dismissed; it stays in the session's timeline.\n */\nexport type InboxItem = {\n id: string;\n workspaceId: string;\n sessionId: string;\n sessionTitle: string | null;\n kind: InboxItemKind;\n /** The question or approval id, or the notification key. */\n sourceKey: string;\n title: string;\n /** A notification's subtitle; empty otherwise. */\n subtitle: string;\n /** Plain text, or for a notification its message (paragraphs, \"- \" bullets, **bold**, `code`, links). */\n body: string;\n /** A notification's label/value facts (at most four); empty otherwise. */\n facts: InboxItemFact[];\n /** A notification's link outside the session, or null. */\n link: InboxItemLink | null;\n /**\n * The session event that opened or last updated the item: open the session\n * at this point. Null for items from before this was recorded.\n */\n eventSequence: number | null;\n /** One-tap answers for a single short choice question; empty otherwise. */\n choices: InboxItemChoice[];\n /**\n * An approval whose tool's MCP server asks the person a question in the\n * middle of the call: the title is then the server's question. A `confirm`\n * is answered with Allow or Deny (send `elicitationRound: round` with the\n * approval); a `form` is answered in the session, where the approval card\n * shows its fields. Null or absent otherwise.\n */\n serverQuestion?: InboxItemServerQuestion | null;\n urgency: \"normal\" | \"time_sensitive\";\n status: \"open\" | \"resolved\" | \"withdrawn\" | \"dismissed\";\n /** True while the person has not seen the item's current content. */\n unread: boolean;\n snoozedUntil: string | null;\n createdAt: string;\n updatedAt: string;\n resolvedAt: string | null;\n /** Another workspace member whose agent sent this notification; null for the person's own. */\n sender?: InboxItemSender | null;\n /**\n * Whether the person can open the session the item came from. False for\n * another member's private session: show no session link then.\n */\n sessionAvailable?: boolean;\n};\n\n/** The member an agent notified the person for. */\nexport type InboxItemSender = { subjectId: string; label: string };\n\n/** A short label and value an agent attached to a notification. */\nexport type InboxItemFact = { label: string; value: string };\n\n/** A place outside the session an agent's notification points to. */\nexport type InboxItemLink = { url: string; label: string };\n\n/** An option of the question behind an inbox item, answerable in one tap. */\nexport type InboxItemChoice = { id: string; label: string };\n\n/**\n * The MCP server asking about an approval in the inbox, how the person\n * answers (`confirm` has nothing to fill in, `form` has fields) and which of\n * the call's questions it is: send `round` back as `elicitationRound`.\n */\nexport type InboxItemServerQuestion = {\n server: string;\n kind: \"confirm\" | \"form\";\n round: number;\n};\n\nexport type ListInboxResponse = {\n items: InboxItem[];\n /** Open, unsnoozed items that need the person (questions, approvals, paused goals). */\n needsYouCount: number;\n /** Open, unsnoozed, unread items of any kind. */\n unreadCount: number;\n};\n\n/** The person's own attention on an item; answering happens in the session. */\nexport type UpdateInboxItemInput = {\n seen?: true;\n /** ISO time to hide the item until, or null to unsnooze. */\n snoozedUntil?: string | null;\n dismissed?: true;\n};\n\n/**\n * What agents may do in the person's inbox: tidy notifications (from their own\n * sessions, or any agent's), or `full_access` to see every open item and\n * snooze or dismiss it. Agents never answer or approve for the person.\n */\nexport type InboxTidyPolicy = \"own_sessions\" | \"any_agent\" | \"full_access\";\n\nexport type InboxSettings = {\n tidyPolicy: InboxTidyPolicy;\n /**\n * Goals an agent paused in the person's own sessions reach the inbox. Off by\n * default. Always present in responses; leave it out of an update to keep it.\n */\n pausedGoals?: boolean;\n /**\n * Keep each session's latest reply in the inbox until the person clears it.\n * Off by default. Always present in responses; leave it out to keep it.\n */\n replies?: boolean;\n /**\n * Alert the phone for the agent's questions and approvals as time-sensitive,\n * so they break through Focus on iPhone. Off by default. Always present in\n * responses; leave it out to keep it.\n */\n timeSensitiveNeedsYou?: boolean;\n};\n\n/**\n * The signed-in person's mute on one session. Muted replies neither reach the\n * inbox nor alert the phone; the agent's notifications, questions and\n * approvals still do. `scope` is \"schedule\" when the session is a run of a\n * schedule that starts a new session per run: the mute then covers every run\n * of that schedule. Older servers omit it.\n */\nexport type SessionInboxMute = {\n repliesMuted: boolean;\n scope?: \"session\" | \"schedule\";\n};\n\n/**\n * Whether other members' agents may notify the signed-in person in one\n * workspace. Each person decides for themselves; off by default.\n */\nexport type MemberNotificationsSetting = {\n allowOthers: boolean;\n};\n\n// --- Excel workbooks connected by an Office add-in -------------------------------------------\n\n/** A short-lived ticket that lets one add-in socket connect a workbook to a workspace. */\nexport type OfficeWorkbookTicket = {\n ticket: string;\n expiresAt: string;\n /** The socket's path on the Opengeni API, such as \"/v1/office/workbooks/live\". */\n path: string;\n /** The socket's full URL on the deployment's public API, when it has one. */\n url?: string;\n /** The WebSocket subprotocol the socket must offer. */\n protocol: string;\n};\n\n/** An open workbook the caller's agents in a workspace can reach with `excel_run`. */\nexport type OfficeWorkbook = {\n id: string;\n name: string;\n /** \"Excel on the web\", \"Excel for Mac\", \"Excel for Windows\"... */\n app: string;\n version: string | null;\n excelApi: string | null;\n connectedAt: string;\n};\n\n// --- Native app sign-in (authorization code + PKCE over the app's scheme) ----------------------\n\n/** `office`: the Opengeni add-in for Excel, signed in from its task pane. */\nexport type NativeAppPlatform = \"ios\" | \"android\" | \"macos\" | \"windows\" | \"linux\" | \"office\";\n\nexport type NativeAppAuthorizeInput = {\n /**\n * Exactly `<registered scheme>://auth/callback`, or for the Office add-in the\n * deployment's own `<web origin>/office/auth-callback.html`.\n */\n redirectUri: string;\n /** Base64url SHA-256 of the app's code verifier. */\n codeChallenge: string;\n codeChallengeMethod: \"S256\";\n state?: string;\n platform: NativeAppPlatform;\n deviceName?: string;\n};\n\nexport type NativeAppTokenInput = {\n code: string;\n codeVerifier: string;\n redirectUri: string;\n};\n\nexport type NativeAppToken = {\n /** Sent as `Authorization: Bearer <accessToken>` (the client's `apiKey`). */\n accessToken: string;\n tokenType: \"Bearer\";\n expiresAt: string;\n};\n\n/**\n * What a signed-in app is pushed about, for sessions its person started:\n * `needs_input` (a question or an approval), `reply_ready` (a turn finished),\n * `failed` (a turn failed) and `agent` (the agent chose to notify).\n */\nexport type NativePushRule =\n | \"needs_input\"\n | \"reply_ready\"\n | \"failed\"\n | \"agent\"\n /** Agents working for this person may ring this phone (off unless the person turns it on). */\n | \"call\"\n /** Agents of other members of a shared workspace may ring it too; needs `call`. */\n | \"call_members\";\n\nexport type RegisterNativePushDeviceInput = {\n platform: NativeAppPlatform;\n /** The app's bundle identifier (iOS) or package name (Android). */\n appId: string;\n /** APNs environment of the build; FCM ignores it. */\n environment: \"development\" | \"production\";\n /** The APNs device token (hex) or FCM registration token. */\n token: string;\n rules: NativePushRule[];\n /** iOS PushKit token that agent calls ring; iOS keeps no call rules without it. */\n voipToken?: string | null;\n};\n\n/** This app credential's push registration. */\nexport type NativePushDevice = {\n platform: NativeAppPlatform;\n appId: string;\n environment: \"development\" | \"production\";\n token: string;\n rules: NativePushRule[];\n voipToken?: string | null;\n updatedAt: string;\n};\n\n/** Where an agent's call to a person stands. */\nexport type AgentCallState = \"ringing\" | \"answered\" | \"declined\" | \"missed\" | \"cancelled\";\n\n/**\n * An agent ringing a person's phones (`call_user`). Only the person called can\n * read, answer or decline it. Answering opens the chat's voice call.\n */\nexport type AgentCall = {\n id: string;\n workspaceId: string;\n sessionId: string;\n /** Who the ring screen shows as calling. */\n callerLabel: string | null;\n /** Why the agent calls, in a few words. */\n reason: string;\n state: AgentCallState;\n ringUntil: string;\n createdAt: string;\n endedAt: string | null;\n /** Whether this phone (app credential) took the call; null when unknown. */\n answeredHere: boolean | null;\n};\n\n/**\n * Phones a product embedding Opengeni rings for agent calls itself, from the\n * `session.agentCall.ringing` webhook with its own push credentials. Agents\n * count them alongside the person's Opengeni app phones.\n */\nexport type AgentCallHostPhones = {\n /** How many of the person's phones the product rings for agents, 1..20. */\n phones: number;\n /** Whether agents working for other members of a shared workspace may ring them too. */\n teammates: boolean;\n updatedAt: string;\n};\n\n// --- Organization-wide session list (org API key or organization owner) -----------------------\n\nexport type ListOrganizationSessionsOptions = {\n /** Page size, 1..200; the server default is 50. */\n limit?: number | undefined;\n /** `nextCursor` from the previous page. */\n cursor?: string | undefined;\n /** Keep only sessions labelled with this exact end user. */\n scopeSubjectId?: string | undefined;\n /** Keep only sessions in this exact lifecycle state. */\n status?: SessionStatus | undefined;\n signal?: AbortSignal | undefined;\n};\n\n/**\n * One page of `GET /v1/organizations/:organizationId/sessions`. Rows come from\n * every shared workspace the caller may read, each carrying its\n * `workspaceId`; personal workspaces are never included and private sessions\n * stay invisible. A page may be shorter than `limit` while `nextCursor` is\n * still set, so follow `nextCursor` until it is null.\n */\nexport type OrganizationSessionListResponse = {\n sessions: Session[];\n nextCursor: string | null;\n};\n\n// A person (or API key) with access to a workspace. `subjectId` is\n// `user:<betterAuthUserId>` or `api_key:<id>`; the People surface lists the\n// `user:` subjects (api_key subjects belong to the API keys section).\nexport type WorkspaceMember = {\n subjectId: string;\n subjectLabel: string | null;\n role: string;\n permissions: Permission[];\n createdAt: string;\n};\n\nexport type ListWorkspaceMembersResponse = {\n members: WorkspaceMember[];\n};\n\nexport type WorkspaceMemberCandidate = {\n organizationMembershipId: string;\n subjectId: string;\n name: string | null;\n email: string | null;\n organizationRole: \"owner\" | \"admin\" | \"member\";\n};\n\nexport type ListWorkspaceMemberCandidatesResponse = {\n members: WorkspaceMemberCandidate[];\n};\n\nexport type AddWorkspaceMemberRequest = {\n organizationMembershipId: string;\n role?: string | undefined;\n permissions: Permission[];\n};\n\nexport type UpdateWorkspaceMemberRequest = {\n role?: string | undefined;\n permissions: Permission[];\n};\n\nexport type SlackUserLinkAccessRequestStatus =\n | \"prepared\"\n | \"pending\"\n | \"completed\"\n | \"denied\"\n | \"cancelled\"\n | \"expired\";\n\n/** Token-free durable projection of one signed Slack identity-link intent. */\nexport type SlackUserLinkAccessRequest = {\n id: string;\n workspaceId: string;\n workspaceDisplayName: string | null;\n subjectLabel: string | null;\n status: SlackUserLinkAccessRequestStatus;\n version: number;\n expiresAt: string;\n requestedAt: string | null;\n decidedAt: string | null;\n completedAt: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type PrepareSlackUserLinkAccessRequest = {\n linkToken: string;\n};\n\nexport type SlackUserLinkAccessMutationRequest = {\n expectedVersion: number;\n idempotencyKey: string;\n};\n\nexport type ApproveSlackUserLinkAccessRequest = SlackUserLinkAccessMutationRequest & {\n role?: string | undefined;\n permissions: Permission[];\n};\n\nexport type ListSlackUserLinkAccessRequestsResponse = {\n requests: SlackUserLinkAccessRequest[];\n};\n\n// --- Goals -------------------------------------------------------------------\n\nexport type SessionGoalStatus = \"active\" | \"paused\" | \"completed\";\n\nexport type SessionGoalCreatedBy = \"api\" | \"agent\" | \"scheduled_task\";\n\nexport type SessionGoalMutationPolicy =\n | \"review_changes\"\n | \"preserve_intent\"\n | \"autonomous_adaptation\";\n\nexport type SessionGoalChangeKind = \"refinement\" | \"adaptation\" | \"replacement\";\n\nexport type SessionGoalRevision = {\n id: string;\n accountId: string;\n workspaceId: string;\n sessionId: string;\n goalId: string;\n disposition: \"applied\" | \"proposed\" | \"rejected\";\n changeKind: SessionGoalChangeKind;\n baseObjectiveRevision: number;\n resultObjectiveRevision: number | null;\n text: string;\n successCriteria: string | null;\n rootConstraints: string[];\n mutationPolicy: SessionGoalMutationPolicy;\n rationale: string;\n actor: \"agent\" | \"api\" | \"scheduled_task\";\n actorTurnId: string | null;\n actorAttemptId: string | null;\n proposalId: string | null;\n rollbackOfRevisionId: string | null;\n createdAt: string;\n};\n\nexport type ApplySessionGoalRevisionRequest = {\n expectedObjectiveRevision: number;\n rationale?: string | undefined;\n};\n\nexport type ListSessionGoalRevisionsOptions = {\n limit?: number | undefined;\n before?: string | undefined;\n};\n\nexport type ListSessionGoalRevisionsResponse = {\n revisions: SessionGoalRevision[];\n hasMore: boolean;\n nextCursor: string | null;\n};\n\nexport type RejectSessionGoalRevisionRequest = {\n expectedObjectiveRevision: number;\n rationale: string;\n};\n\nexport type RejectSessionGoalRevisionResponse = {\n revision: SessionGoalRevision;\n replay: boolean;\n};\n\nexport type RollbackSessionGoalRevisionRequest = {\n expectedObjectiveRevision: number;\n rationale: string;\n};\n\nexport type SessionGoalContinuationState =\n | \"inactive\"\n | \"scheduled\"\n | \"running\"\n | \"blocked\"\n | \"invariant_broken\";\n\nexport type SessionGoalContinuationReason =\n | \"goal_inactive\"\n | \"wake_pending\"\n | \"continuation_pending\"\n | \"human_work_pending\"\n | \"goal_turn_running\"\n | \"human_turn_running\"\n | \"workstream_paused\"\n | \"approval_required\"\n | \"provider_backpressure\"\n | \"session_cancelled\"\n | \"system_work_pending\"\n | \"held_for_input\"\n | \"backoff_pending\"\n | \"missing_obligation\";\n\nexport type SessionGoalContinuation = {\n state: SessionGoalContinuationState;\n reason: SessionGoalContinuationReason;\n wakeRevision: number;\n observedRevision: number;\n nextAttemptAt: string | null;\n lastError: string | null;\n /** Agent-stated reason for a `wait_for_input` hold; null otherwise. */\n holdReason?: string | null | undefined;\n};\n\nexport type SessionGoal = {\n id: string;\n accountId: string;\n workspaceId: string;\n sessionId: string;\n status: SessionGoalStatus;\n text: string;\n successCriteria: string | null;\n rootConstraints: string[];\n /** Optional for older-server/source compatibility; current servers always supply this projection. */\n reportRequirements?: SessionGoalReportRequirement[] | undefined;\n evidence: string | null;\n rationale: string | null;\n pausedReason: string | null;\n createdBy: SessionGoalCreatedBy;\n version: number;\n objectiveRevision: number;\n mutationPolicy: SessionGoalMutationPolicy;\n autoContinuations: number;\n noProgressStreak: number;\n maxAutoContinuations: number | null;\n metadata: Record<string, unknown>;\n /** Optional for source compatibility; the API always supplies this projection. */\n continuation?: SessionGoalContinuation | undefined;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type UpdateSessionGoalRequest =\n | {\n status: \"paused\" | \"active\";\n rationale?: string | undefined;\n }\n | {\n text: string;\n successCriteria?: string | null | undefined;\n rootConstraints?: string[] | undefined;\n mutationPolicy?: SessionGoalMutationPolicy | undefined;\n rationale: string;\n expectedObjectiveRevision: number;\n };\n\nexport type UpdateSessionRequest = {\n title?: string | undefined;\n /** Empty string clears the description. */\n description?: string | null | undefined;\n avatar?: SessionAvatar | null | undefined;\n};\n\n// --- Operator context controls (/clear, /compact) ----------------------------\n\n/** Outcome of a manual /compact trigger. */\nexport type CompactSessionContextResult = {\n /** pending waits for the current safe boundary; completed ran while idle. */\n status: \"pending\" | \"completed\" | \"noop\";\n message: string;\n};\n\n// --- Turn queue --------------------------------------------------------------\n\nexport type EffectiveControlBlocker = {\n kind: \"session\" | \"workspace\";\n sessionId?: string | undefined;\n displayName: string;\n actor: string | null;\n reason: string | null;\n changedAt: string | null;\n revision: number;\n};\n\nexport type EffectiveControlResumeOption = {\n scope: \"selected\" | \"session\" | \"workspace\";\n targetId?: string | undefined;\n selectedStateAfter: \"active\" | \"paused\";\n remainingPrimaryBlocker?: EffectiveControlBlocker | undefined;\n impactCopy: string;\n};\n\nexport type EffectiveSessionControl = {\n state: \"active\" | \"paused\";\n controlVersion: number;\n controlEtag: string;\n directState: \"active\" | \"paused\";\n primaryBlocker: EffectiveControlBlocker | null;\n additionalBlockerCount: number;\n blockers: EffectiveControlBlocker[];\n resumeOptions: EffectiveControlResumeOption[];\n override: { rootSessionId: string; revision: number } | null;\n settlement: {\n state: \"stopping\";\n attemptCount: number;\n interruptionPendingCount: number;\n quiescencePendingCount: number;\n } | null;\n backgroundCommandSettlement?: { state: \"stopping\"; commandCount: number } | null | undefined;\n};\n\nexport type SessionCommandReceipt = {\n id: string;\n action: string;\n operationKey: string;\n targetSessionId: string | null;\n targetTurnId: string | null;\n appliedControlRevision: number | null;\n appliedQueueVersion: number | null;\n appliedTurnVersion: number | null;\n appliedDraftRevision: number | null;\n createdAt: string;\n};\n\nexport type SessionPromptRouting =\n | \"accepted_for_execution\"\n | \"queued_for_execution\"\n | \"accepted_for_steering\";\n\nexport type ComposerDraft = {\n revision: number;\n text: string;\n annotations?: DraftTimelineAnnotation[] | undefined;\n resources: ResourceRef[];\n model: string;\n reasoningEffort: ReasoningEffort;\n latencyMode: LatencyMode;\n /**\n * True when the draft has no model choice of its own: `model`,\n * `reasoningEffort` and `latencyMode` are then the chat's current settings\n * and follow every later change to them (for example by the agent). Send a\n * model with this draft only after the person picks one. Absent from\n * servers that predate it, which means false.\n */\n policyFollowsSession?: boolean | undefined;\n sourceTurnId: string | null;\n sourceTurnVersion: number | null;\n updatedAt: string | null;\n};\n\nexport type NewSessionDraftOptions = {\n agentLearning?: import(\"@opengeni/contracts\").AgentLearningOverrides | undefined;\n excludedMcpServerIds?: string[] | undefined;\n visibility?: SessionVisibility | undefined;\n sandboxBackend?: SandboxBackend | undefined;\n targetSandboxId?: string | undefined;\n workingDir?: string | undefined;\n rigId?: string | undefined;\n goal?: GoalSpec | undefined;\n firstPartyMcpPermissions?: Permission[] | undefined;\n firstPartyMcpTools?: FirstPartyMcpToolName[] | undefined;\n agent?: AgentConfigRequest | undefined;\n};\n\nexport type NewSessionSelectionHistory = {\n /** Most-recently used project first. Null channelId is the Default project. */\n projects: Array<{\n channelId: string | null;\n /** Null means the managed sandbox was used most recently in this project. */\n targetSandboxId: string | null;\n /** Most-recently used machine in this project first. */\n machines: Array<{ sandboxId: string; workingDir: string | null }>;\n }>;\n};\n\nexport type NewSessionDraft = {\n revision: number;\n text: string;\n resources: ResourceRef[];\n tools: ToolRef[];\n /** False inherits the workspace-default MCP policy; true preserves an explicit array. */\n toolsProvided: boolean;\n model: string;\n reasoningEffort: ReasoningEffort;\n latencyMode: LatencyMode;\n /**\n * True when the person chose this model policy; false follows the resolved\n * default for new chats. Absent from older servers.\n */\n modelProvided?: boolean | undefined;\n /** Absent on legacy drafts; null records an explicit Default-project selection. */\n selectedProjectChannelId?: string | null | undefined;\n options: NewSessionDraftOptions;\n selectionHistory: NewSessionSelectionHistory;\n /**\n * Read-only: the caller's own default placement for new chats (\"Your default\n * machine\") when usable now. A fresh form starts on it ahead of the\n * workspace default. Older servers omit it.\n */\n memberDefaultExecutionTarget?: WorkspaceDefaultExecutionTarget | null | undefined;\n updatedAt: string | null;\n};\n\nexport type SessionQueueSnapshot = {\n version: number;\n effectiveControl: EffectiveSessionControl;\n /** Secret-safe personal MCP summaries frozen on the exact active turn. */\n activePersonalConnections: McpPersonalConnectionSummary[];\n /** The latest interrupted attempt has not yet durably proved physical quiescence. */\n stoppingPreviousAttempt: boolean;\n items: SessionTurn[];\n /** Canonical pending machine inputs. Events only invalidate this snapshot. */\n pendingInputs: SessionPendingInputPreview[];\n /** Exact next bounded input batch that will join an already-waiting prompt. */\n pendingInputAttachment: {\n turnId: string;\n inputIds: string[];\n } | null;\n};\n\nexport type SessionPendingInputPreview = Pick<\n SessionSystemUpdate,\n \"id\" | \"sessionId\" | \"kind\" | \"classification\" | \"sourceId\" | \"summary\" | \"createdAt\"\n>;\n\nexport type SystemUpdateClassification = \"success\" | \"failure\" | \"action_required\" | \"info\";\n\nexport type SessionSystemUpdateKind =\n | \"scheduled_occurrence\"\n | \"goal_continuation\"\n | \"agent_message\"\n | \"agent_steer_instruction\"\n | \"session_wait_timeout\"\n | \"background_command_result\"\n | \"child_terminal_result\"\n | \"media_generation_result\"\n | \"child_requires_action\"\n | \"child_requires_action_resolved\"\n | \"child_paused\"\n | \"child_waiting_capacity\"\n | \"child_progress\"\n | \"secret_use_approval_decided\"\n | \"capability_setup_completed\";\n\nexport type SessionSystemUpdateState =\n | \"pending\"\n | \"delivered\"\n | \"cancelled\"\n | \"superseded\"\n | \"failed\";\n\nexport type SessionSystemUpdatePayload =\n | {\n type: \"session_wait_timeout\";\n waitTurnId: string;\n deadlineAt: string;\n reason: string;\n [key: string]: unknown;\n }\n | {\n type: \"background_command_result\";\n commandId: string;\n state: \"exited\" | \"lost\";\n exitCode: number | null;\n reason: string;\n outputLocator: {\n eventType: \"sandbox.command.output.delta\";\n commandId: string;\n };\n /** Bounded start and end of the output (absent for lost commands and older results). */\n output?: string | undefined;\n [key: string]: unknown;\n }\n | ({\n type: Exclude<SessionSystemUpdateKind, \"session_wait_timeout\" | \"background_command_result\">;\n } & Record<string, unknown>);\n\nexport type SessionSystemUpdate = {\n id: string;\n sessionId: string;\n kind: SessionSystemUpdateKind;\n classification: SystemUpdateClassification;\n sourceId: string;\n dedupeKey: string;\n summary: string;\n payload: SessionSystemUpdatePayload;\n lineage: Record<string, unknown>;\n state: SessionSystemUpdateState;\n deliveredTurnId: string | null;\n deliveredHistoryItemId: string | null;\n deliveredAt: string | null;\n createdAt: string;\n};\n\nexport type SessionRetryRequest = {\n clientEventId: string;\n failureEventId: string;\n model?: string;\n reasoningEffort?: ReasoningEffort;\n latencyMode?: LatencyMode;\n};\n\nexport type SandboxRecoverySelection = {\n version: 1;\n sessionId: string;\n sandboxGroupId: string;\n leaseId: string;\n routeEpoch: number;\n authorityEpoch: number;\n leaseEpoch: number;\n workspaceGeneration: number;\n archiveGeneration: number;\n artifactId: string;\n revision: string;\n capturedAt: string;\n};\n/** The checkpoint automatic recovery restores, native or portable.\n * `artifactId` is null for a portable archive. */\nexport type SandboxCheckpointSelection = Omit<SandboxRecoverySelection, \"artifactId\"> & {\n artifactId: string | null;\n};\nexport type SandboxRecoveryTarget = {\n sessionId: string;\n sandboxGroupId: string;\n leaseId: string;\n routeEpoch: number;\n authorityEpoch: number;\n leaseEpoch: number;\n workspaceGeneration: number;\n archiveGeneration: number | null;\n revision: string | null;\n restoreStatus: string;\n restoreCompletedAt: string | null;\n};\nexport type SandboxRecoveryProjection = {\n version: 1;\n status: \"unsupported\" | \"blocked\" | \"eligible\" | \"consent_accepted\" | \"restoring\" | \"restored\";\n reason: string | null;\n /** The registered native checkpoint a person can consent to restore, and for\n * an automatic Retry its checkpoint when that one is native. */\n checkpoint: SandboxRecoverySelection | null;\n operationId: string | null;\n target?: SandboxRecoveryTarget;\n retryAvailable?: boolean;\n freshWorkspaceAvailable?: boolean;\n groupSessionCount?: number;\n automaticAvailable?: boolean;\n /** What an automatic Retry does: restore `automaticCheckpoint`, or continue\n * on a new empty workspace because no usable checkpoint survived the loss. */\n automaticLane?: \"checkpoint\" | \"fresh_workspace\";\n /** The checkpoint an automatic Retry restores (lane `checkpoint`), native or\n * portable. `checkpoint` is set as well only when it is native. */\n automaticCheckpoint?: SandboxCheckpointSelection;\n /** For a timed recovery wait: the earliest time a Retry or a new message can\n * let Opengeni decide again. Nothing proceeds by itself before then. */\n availableAt?: string;\n};\nexport type SandboxRecoveryRequest =\n | {\n operationId: string;\n acceptHistoricalCheckpoint: true;\n selection: SandboxRecoverySelection;\n }\n | { operationId: string; action: \"retry\"; target: SandboxRecoveryTarget }\n | {\n operationId: string;\n action: \"continue_fresh\";\n acceptEmptyWorkspace: true;\n target: SandboxRecoveryTarget;\n };\nexport type SandboxRecoveryResponse = {\n outcome: \"accepted\" | \"replayed\";\n operationId: string;\n recovery: SandboxRecoveryProjection;\n};\n\nexport type SessionRetryResponse = {\n outcome: \"accepted\" | \"replayed\";\n turnId: string;\n failureEventId: string;\n};\n\nexport type SessionControlResponse = {\n receipt: SessionCommandReceipt;\n effectiveControl: EffectiveSessionControl;\n interruptionCount: number;\n wakeCount: number;\n cancelledSessionCount: number;\n cancelledTurnCount: number;\n};\n\nexport type WorkspacePauseTimer = {\n id: string;\n action: \"pause\" | \"resume\";\n dueAt: string;\n pauseForSeconds: number | null;\n};\nexport type WorkspacePauseTimerRequest = {\n action: \"set\" | \"cancel\";\n pauseInSeconds?: number | undefined;\n pauseForSeconds?: number | null | undefined;\n clientEventId: string;\n expectedRevision: number;\n};\n\nexport type WorkspaceInferenceControlResponse = {\n receipt: SessionCommandReceipt;\n state: \"active\" | \"paused\";\n revision: number;\n interruptionCount: number;\n wakeCount: number;\n};\n\nexport type WorkspaceControlEvent = {\n id: string;\n workspaceId: string;\n /** Same monotonic value as revision; named sequence for SSE resume cursors. */\n sequence: number;\n revision: number;\n type: \"workspace.control.changed\";\n scope: \"workspace\" | \"session\";\n rootSessionId: string | null;\n action: \"pause\" | \"resume\" | \"timer_set\" | \"timer_cancelled\";\n automatic: boolean;\n reason: string | null;\n actor: string;\n occurredAt: string;\n truncation?: {\n truncated: true;\n surface:\n | \"durable_control\"\n | \"database_guard\"\n | \"http_projection\"\n | \"nats_legacy_guard\"\n | \"sse_legacy_guard\";\n deliveredBytes: number;\n fields: Array<{\n field: \"reason\" | \"actor\";\n originalBytes: number;\n deliveredBytes: number;\n omittedBytes: number;\n }>;\n fullEvidence: {\n available: false;\n reason: \"not_retained\";\n };\n } | null;\n};\n\nexport type SessionQueueMutationResponse = {\n receipt: SessionCommandReceipt;\n snapshot: SessionQueueSnapshot;\n draft?: ComposerDraft;\n};\n\nexport type MoveSessionQueueItemRequest = {\n clientEventId: string;\n expectedQueueVersion: number;\n beforeTurnId: string | null;\n};\n\nexport type EditSessionQueueItemRequest = {\n clientEventId: string;\n expectedTurnVersion: number;\n expectedDraftRevision: number;\n replaceDraft: boolean;\n};\n\nexport type SteerSessionQueueItemRequest = {\n clientEventId: string;\n expectedTurnVersion: number;\n controlEtag?: string;\n /**\n * Interrupt the running turn now instead of at its next model step. Also\n * turns an already-waiting Steer into an immediate one.\n */\n interrupt?: boolean;\n};\n\nexport type DeleteSessionQueueItemRequest = {\n clientEventId: string;\n expectedTurnVersion: number;\n reason?: string;\n};\n\nexport type SaveComposerDraftRequest = Omit<\n ComposerDraft,\n | \"revision\"\n | \"sourceTurnId\"\n | \"sourceTurnVersion\"\n | \"updatedAt\"\n | \"policyFollowsSession\"\n | \"model\"\n | \"reasoningEffort\"\n | \"latencyMode\"\n> & {\n expectedRevision: number;\n /**\n * The person's pick in the composer. Omit all three to keep (or return)\n * the draft to the chat's own settings, so it follows later changes.\n */\n model?: string | undefined;\n reasoningEffort?: ReasoningEffort | undefined;\n latencyMode?: LatencyMode | undefined;\n};\n\nexport type SubmitComposerDraftRequest = Omit<SaveComposerDraftRequest, \"expectedRevision\"> & {\n expectedDraftRevision: number;\n clientEventId: string;\n delivery: \"send\" | \"steer\";\n controlEtag?: string;\n modelContext?: string;\n /** IANA time zone of the sender; see `UserMessageEventInput`. */\n timeZone?: string;\n mcpCredentialUpdates?: SessionMcpCredentialUpdateInput[];\n connectionAccounts?: McpConnectionAccountSelection[];\n personalResourceAttachment?: PersonalResourceAttachmentIntent;\n};\n\nexport type SubmitComposerDraftResponse = {\n accepted: SessionEvent;\n turn: SessionTurn;\n draft: ComposerDraft;\n receipt: SessionCommandReceipt;\n routing: SessionPromptRouting;\n interruptionCount: number;\n /** As on `SteerMessageResult`. Older servers omit it. */\n waitsForMachineOwner?: boolean | undefined;\n replay: boolean;\n};\n\nexport type SaveNewSessionDraftRequest = Omit<\n NewSessionDraft,\n \"revision\" | \"selectionHistory\" | \"updatedAt\" | \"memberDefaultExecutionTarget\"\n> & {\n expectedRevision: number;\n};\n\n// --- Scheduled tasks: requests + runs ----------------------------------------\n\n/** Input shape for agent config on create/update (server applies defaults). */\nexport type ScheduledTaskAgentConfigInput = {\n /**\n * Agent configuration frozen into the schedule and used by every run;\n * omitted runs follow the workspace's agent defaults.\n */\n agent?: AgentConfigRequest | undefined;\n knowledgeSource?: Extract<ScheduledTaskAction, { kind: \"knowledge_source_sync\" }> | undefined;\n prompt: string;\n resources?: ResourceRef[] | undefined;\n /**\n * Connectors added on top of the workspace defaults when `toolPolicy` is\n * set; otherwise the exact list. Omit both on a schedule that starts its\n * own session to follow the workspace defaults at each run.\n */\n tools?: ToolRef[] | undefined;\n /** Follow the workspace's default connectors at each run, except the excluded ones. */\n toolPolicy?: ScheduledTaskToolPolicy | undefined;\n metadata?: Record<string, unknown> | undefined;\n slackBotConnectionId?: string | undefined;\n /** Slack channel a person chose for this task's bot posts; requires slackBotConnectionId. */\n slackBotChannelId?: string | undefined;\n model?: string | undefined;\n reasoningEffort?: ReasoningEffort | undefined;\n sandboxBackend?: SandboxBackend | undefined;\n /** Follow the workspace machine when creating each new run chat. */\n executionTarget?: \"workspace_default\" | undefined;\n machineTarget?: { targetSandboxId: string; workingDir?: string | undefined } | undefined;\n goal?: GoalSpec | undefined;\n executionClass?: \"incident_telemetry\" | undefined;\n incidentTelemetryPreflight?: IncidentTelemetryPreflightInput | undefined;\n maxNestedAgentDepth?: number | undefined;\n /**\n * Seconds a run's own turn may wait on a person (tool approval or structured\n * question, 60 s - 30 days) before the scheduler rejects the approval / skips\n * the question as a labelled system decision. Omitted: waits indefinitely.\n */\n approvalTimeoutSeconds?: number | undefined;\n /**\n * Whether each chat this task starts runs unattended: no person answers\n * during the run, so the agent is told to settle open choices itself and\n * report what is left for a person, and calls that need someone's approval\n * are refused instead of waiting. `true` or `false` is a fixed choice.\n * Omitted: unattended by default, unless `approvalTimeoutSeconds` is set;\n * the default ends when a person writes in the chat. A task that posts into\n * an existing chat follows that chat.\n */\n unattended?: boolean | undefined;\n bundledSkillIds?: BundledSkillId[] | undefined;\n /**\n * Remote MCP servers attached to each chat the task starts, as on session\n * create. Static headers are not stored: credentials come from the\n * workspace credential provider or `connectionRef`.\n */\n mcpServers?: ScheduledTaskMcpServer[] | undefined;\n /**\n * Memory, agent reach and inline Skills of each chat the task starts, as on\n * session create. Only a task that starts its own chats can carry them.\n */\n memoryScope?: SessionMemoryScope | undefined;\n agentAccess?: SessionAgentAccess | undefined;\n skills?: ScheduledTaskSkill[] | undefined;\n};\n\nexport type CreateAgentScheduledTaskRequest = {\n agentLearning?: {\n scope: \"workspace\" | \"personal\";\n settings: import(\"./knowledge\").AgentLearningOverrides;\n };\n name: string;\n schedule: ScheduledTaskScheduleSpec;\n /** Who can see it. Omitted: everyone in the workspace. */\n visibility?: SessionVisibility | undefined;\n action?: { kind: \"agent_turn\" } | undefined;\n runMode?: ScheduledTaskRunMode | undefined;\n targetSessionId?: string | null | undefined;\n /**\n * Connector accounts a person pins for a schedule that starts its own\n * session (never an existing-chat schedule, never an agent).\n */\n pinnedAccounts?: McpConnectionAccountSelection[] | undefined;\n /** Skip an occurrence instead of running without an unusable pinned account. */\n pinnedAccountsRequired?: boolean | undefined;\n overlapPolicy?: ScheduledTaskOverlapPolicy | undefined;\n agentConfig: ScheduledTaskAgentConfigInput;\n /** Event triggers and the event run policy. Use schedule `{ type: \"manual\" }` for an event-only automation. */\n events?: ScheduledTaskEventsInput | undefined;\n status?: ScheduledTaskStatus | undefined;\n /**\n * Sandbox Environment each run binds to; its active version is resolved per\n * fire. Omit to resolve it once at create: the workspace default (none for a\n * Connected Machine task), or the target session's own environment for an\n * existing-session task. `null` means none.\n */\n rigId?: string | null | undefined;\n /** Vault narrowing for every run; omission adds none. */\n vaultPolicy?: VaultPolicy | undefined;\n metadata?: Record<string, unknown> | undefined;\n /**\n * Lock the task to its creator: only the same key or signed service\n * identity can later change, run, resume or delete it, and no agent can.\n * A workspace admin can still pause it. Set once at creation.\n */\n creatorLocked?: boolean | undefined;\n};\n\nexport type CreateKnowledgeSourceSyncScheduledTaskRequest = {\n name: string;\n schedule: ScheduledTaskScheduleSpec;\n action: Extract<ScheduledTaskAction, { kind: \"knowledge_source_sync\" }>;\n overlapPolicy?: \"skip\" | \"buffer_one\" | undefined;\n status?: ScheduledTaskStatus | undefined;\n metadata?: Record<string, unknown> | undefined;\n};\n\n/** Send a scheduled message using the destination chat’s current execution settings. */\nexport type CreateSessionScheduledTaskRequest = {\n name: string;\n schedule: ScheduledTaskScheduleSpec;\n prompt: string;\n targetSessionId: string;\n /** A schedule posting into an Only me chat is always Only me. */\n visibility?: SessionVisibility | undefined;\n runMode?: \"existing_session\" | undefined;\n overlapPolicy?: ScheduledTaskOverlapPolicy | undefined;\n status?: ScheduledTaskStatus | undefined;\n /** Event triggers that also post into the chat; `once` makes this a \"wake me when\". */\n events?: ScheduledTaskEventsInput | undefined;\n metadata?: Record<string, unknown> | undefined;\n /** Lock the task to its creator; see the agent-task request. */\n creatorLocked?: boolean | undefined;\n};\n\nexport type CreateScheduledTaskRequest =\n | CreateSessionScheduledTaskRequest\n | CreateAgentScheduledTaskRequest\n | CreateKnowledgeSourceSyncScheduledTaskRequest;\n\nexport type UpdateScheduledTaskRequest = {\n expectedExecutionDigest?: string | undefined;\n adoptSessionSettings?: true | undefined;\n /** Lossless message edit. All omitted configuration is preserved. */\n prompt?: string | undefined;\n name?: string | undefined;\n schedule?: ScheduledTaskScheduleSpec | undefined;\n runMode?: ScheduledTaskRunMode | undefined;\n targetSessionId?: string | null | undefined;\n /** Change who can see it. Only the owner can; a schedule posting into an Only me chat stays Only me. */\n visibility?: SessionVisibility | undefined;\n /** Replace the person-pinned accounts; `[]` unpins every connector. Omitted keeps the pins. */\n pinnedAccounts?: McpConnectionAccountSelection[] | undefined;\n /** Skip occurrences instead of running without an unusable pinned account. */\n pinnedAccountsRequired?: boolean | undefined;\n overlapPolicy?: ScheduledTaskOverlapPolicy | undefined;\n action?: ScheduledTaskAction | undefined;\n agentConfig?: ScheduledTaskAgentConfigInput | undefined;\n /** Lossless model defaults patch; cannot be combined with agentConfig replacement.\n * Existing target/reusable sessions retain their own model and reasoning. */\n agentConfigPatch?:\n | {\n prompt?: string | undefined;\n model?: string | undefined;\n reasoningEffort?: ReasoningEffort | undefined;\n }\n | undefined;\n status?: ScheduledTaskStatus | undefined;\n // The rig each run binds to (M3); active version resolved per fire.\n rigId?: string | null | undefined;\n /** Vault narrowing for every run. */\n vaultPolicy?: VaultPolicy | undefined;\n /** Replace the event triggers and event run policy; `{ triggers: [] }` removes every trigger. */\n events?: ScheduledTaskEventsInput | undefined;\n metadata?: Record<string, unknown> | undefined;\n};\n\nexport type ScheduledTaskRunStatus = \"queued\" | \"dispatched\" | \"succeeded\" | \"skipped\" | \"failed\";\n\nexport type KnowledgeSourceSyncRunSummary = {\n phase: \"queued\" | \"inventory\" | \"transfer\" | \"index\" | \"checkpoint\" | \"completed\" | \"failed\";\n scanned: number;\n imported: number;\n unchanged: number;\n skipped: number;\n failed: number;\n bytes: number;\n providerRequests: number;\n elapsedMs: number;\n indexed: number;\n aclPending: number;\n retryable: boolean;\n limitReached: \"items\" | \"bytes\" | \"file_bytes\" | \"provider_requests\" | \"elapsed_time\" | null;\n checkpointed: boolean;\n reconnectRequired: boolean;\n failures: Array<{\n externalObjectId: string;\n code:\n | \"authority_changed\"\n | \"connection_reconnect_required\"\n | \"provider_unavailable\"\n | \"provider_rejected\"\n | \"provider_payload_invalid\"\n | \"content_unsupported\"\n | \"content_too_large\"\n | \"resource_limit\"\n | \"item_processing_failed\"\n | \"indexing_failed\"\n | \"internal_failure\";\n retryable: boolean;\n message: string;\n }>;\n};\n\nexport type ScheduledTaskTriggerType =\n | \"scheduled\"\n | \"manual\"\n | \"initial\"\n | \"provider_event\"\n | \"retry\"\n | \"repair\"\n | \"event\";\n\nexport type ScheduledTaskRun = {\n id: string;\n accountId: string;\n workspaceId: string;\n taskId: string;\n taskAuthorityRevision: number | null;\n taskExecutionDigest: string | null;\n status: ScheduledTaskRunStatus;\n triggerType: ScheduledTaskTriggerType;\n scheduledAt: string | null;\n firedAt: string;\n sessionId: string | null;\n triggerEventId: string | null;\n actionKind: \"agent_turn\" | \"knowledge_source_sync\";\n knowledgeSyncRunId: string | null;\n knowledgeSummary: KnowledgeSourceSyncRunSummary | null;\n completedAt: string | null;\n error: string | null;\n admissionDiagnostic?:\n | {\n version: 1;\n reason:\n | \"selected_account_unavailable\"\n | \"owner_access_unavailable\"\n | \"ambiguous_account\"\n | \"parent_accounts_required\"\n | \"selection_unavailable\";\n accounts: Array<{\n serverId: string;\n connectionId: string | null;\n reason:\n | \"connector_unavailable\"\n | \"account_not_visible\"\n | \"account_inactive\"\n | \"account_mismatch\"\n | \"selection_unavailable\";\n }>;\n }\n | null\n | undefined;\n /**\n * Pinned connector accounts this run could not use. The run went ahead\n * without those connectors; no other account was used in their place.\n */\n degradedAccounts?:\n | Array<{\n serverId: string;\n connectionId: string | null;\n reason:\n | \"connector_unavailable\"\n | \"account_not_visible\"\n | \"account_inactive\"\n | \"account_mismatch\"\n | \"selection_unavailable\"\n | \"owner_access_unavailable\";\n }>\n | undefined;\n /**\n * Why the scheduler refused this occurrence before running it; `error`\n * equals `reason`. `retryable: true` (status `skipped`): a later occurrence\n * runs once the condition clears. `retryable: false` (status `failed`):\n * every occurrence is refused until the task or a resource it names changes.\n */\n admissionRefusal?: ScheduledTaskAdmissionRefusal | null | undefined;\n /**\n * This dispatched run's own turn is waiting on a person (tool approval or\n * structured question) since `since`; `expiresAt` is when the task's\n * `approvalTimeoutSeconds` answers for it (null: waits indefinitely).\n */\n awaitingHuman?: ScheduledTaskRunAwaitingHuman | null | undefined;\n createdAt: string;\n updatedAt: string;\n /** Connectors this run could not use; projected only for a viewer who can act on the task. */\n accessFailures?: ScheduledTaskRunAccessFailure[] | undefined;\n /** Event runs only: the trigger and events that caused the run. */\n eventOccurrence?: ScheduledTaskRunEventOccurrence | null | undefined;\n};\n\nexport type ScheduledTaskRunAwaitingHuman = {\n since: string;\n expiresAt: string | null;\n};\n\nexport type ScheduledTaskAdmissionRefusal = {\n version: 1;\n reason:\n | \"scheduled_authority_unavailable\"\n | \"machine_target_unavailable\"\n | \"machine_enrollment_inactive\"\n | \"variable_set_unavailable\"\n | \"rig_version_unavailable\"\n | \"scheduled_model_unavailable\"\n | \"insufficient_credits\"\n | \"monthly_model_cost_limit\"\n | \"monthly_agent_run_limit\"\n | (string & {});\n retryable: boolean;\n};\n\nexport type ScheduledTaskAccessFailureReason =\n | \"missing_connection\"\n | \"expired\"\n | \"insufficient_scope\"\n | \"refresh_failed\"\n | \"personal_authority_unavailable\"\n | \"unsupported_auth\"\n | \"resource_scope_unavailable\"\n | \"designated_credential_unavailable\";\n\n/** A connector a scheduled run's own turn could not use (a `tool.auth_needed` fact). */\nexport type ScheduledTaskRunAccessFailure = {\n serverId: string;\n name: string;\n providerDomain: string;\n reason: ScheduledTaskAccessFailureReason;\n count: number;\n firstOccurredAt: string;\n};\n\n/**\n * A schedule that needs its owner's attention: its latest run failed closed on\n * connector access (`runId`, `failures`), and/or a pinned connector account can\n * no longer be used (`unavailableAccounts`; runs continue without that\n * connector unless the schedule requires its pins; `runId` and `firedAt` are\n * null when only this applies).\n */\nexport type ScheduledTaskAccessAttention = {\n taskId: string;\n taskName: string;\n /** The task head this item was computed against; a new head is a new notice. */\n executionDigest: string;\n runId: string | null;\n firedAt: string | null;\n failures: ScheduledTaskRunAccessFailure[];\n unavailableAccounts: ScheduledTaskAccessConnector[];\n /** The latest run is waiting on a person (tool approval or question) right now. */\n awaitingHuman?: ScheduledTaskRunAwaitingHuman | null | undefined;\n};\n\nexport type ListScheduledTaskAccessAttentionResponse = {\n tasks: ScheduledTaskAccessAttention[];\n};\n\n// --- Rigs ---------------------------------------------------------------------\n// Workspace-scoped, versioned sandbox machine definitions. Versions are\n// append-only and content-immutable; exactly one is active per rig.\n\nexport type RigCheck = {\n name: string;\n command: string;\n};\n\nexport type RigProviderImageBuildStatus = \"building\" | \"ready\" | \"failed\" | \"unsupported\";\n\nexport type RigProviderImage = {\n backend: SandboxBackend;\n provider: string;\n status: RigProviderImageBuildStatus;\n contentHash: string;\n setupHash: string;\n sourceImage: string | null;\n buildRequestId: string;\n imageId: string | null;\n imageDigest: string | null;\n artifactId: string | null;\n providerBindingKeyHash: string | null;\n coldBootValidation?:\n | {\n version: 1;\n checkedAt: string;\n }\n | undefined;\n provenance: {\n kind: \"rig_verification\";\n targetKind: \"change\" | \"version\";\n targetId: string;\n };\n startedAt: string;\n finishedAt: string | null;\n error: {\n code: string;\n message: string;\n retryable: boolean;\n } | null;\n};\n\nexport type RigVersion = {\n id: string;\n rigId: string;\n version: number;\n image: string | null;\n setupScript: string | null;\n checks: RigCheck[];\n credentialHooks: string[];\n changelog: string | null;\n providerImages: Partial<Record<SandboxBackend, RigProviderImage>>;\n createdBy: string | null;\n active: boolean;\n createdAt: string;\n};\n\nexport type RigVerificationHealth = {\n checkHealth: \"passing\" | \"failing\" | \"unknown\";\n lastVerifiedAt: string | null;\n};\n\n/**\n * A project (\"channel\") organizing root sessions (\"workstreams\") by work type\n * in the rail. Pure organizational metadata, shared with the workspace or\n * Only me, like a chat.\n */\nexport type Channel = {\n id: string;\n accountId: string;\n workspaceId: string;\n name: string;\n description: string | null;\n /**\n * Shown to people instead of the folder icon, like a chat's avatar. Absent\n * from servers that predate project profiles.\n */\n avatar?: SessionAvatar | null | undefined;\n pinned: boolean;\n sortOrder: number;\n /**\n * Who sees it: the workspace, or only its owner (\"private\", Only me). An\n * Only me project holds only its owner's own Only me chats and Sites.\n * Absent from servers that predate project audiences, where every project\n * is shared.\n */\n visibility?: \"private\" | \"workspace\" | undefined;\n createdBy: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type CreateChannelRequest = {\n name: string;\n description?: string;\n avatar?: SessionAvatar | null;\n /**\n * Omitted, a person's project is shared with the workspace and an agent's\n * follows its chat: Only me when made in an Only me chat.\n */\n visibility?: \"private\" | \"workspace\";\n};\n\nexport type UpdateChannelRequest = {\n name?: string;\n description?: string | null;\n /** null clears it; omitted keeps it. */\n avatar?: SessionAvatar | null;\n pinned?: boolean;\n /**\n * \"workspace\" shares the owner's Only me project with the workspace. A\n * shared project cannot be made Only me; only its owner, signed in,\n * changes it.\n */\n visibility?: \"workspace\";\n};\n\n/** Complete workspace project order. It is replaced atomically after a drag. */\nexport type ReorderChannelsRequest = {\n channelIds: string[];\n};\n\n/** Re-files one session; null moves it back to the unfiled inbox. */\nexport type UpdateSessionChannelRequest = {\n channelId: string | null;\n};\n\nexport type Rig = {\n id: string;\n accountId: string;\n workspaceId: string;\n scope: ResourceAuthorityScope;\n generation: number;\n status: \"active\" | \"revoked\";\n name: string;\n description: string | null;\n createdBy: string | null;\n activeVersion: RigVersion | null;\n activeVersionHealth?: RigVerificationHealth | null;\n versionCount: number;\n createdAt: string;\n updatedAt: string;\n /** Where it works; present only for organization rigs. */\n reach?: OrganizationComputeReach | null | undefined;\n};\n\n/**\n * Where an organization machine or rig works: always in the workspace it was\n * connected from or made in (`homeWorkspaceId`), plus every shared workspace\n * of the organization (`allowedWorkspaceIds: null`) or the listed ones, and\n * members' Personal workspaces when `allowPersonalWorkspaces` is on.\n */\nexport type OrganizationComputeReach = {\n homeWorkspaceId: string;\n allowedWorkspaceIds: string[] | null;\n allowPersonalWorkspaces: boolean;\n};\n\n/** PUT .../machines/:enrollmentId/reach and PUT .../rigs/:rigId/reach body:\n * an organization owner or admin changes where an organization machine or rig\n * works. The ids are the organization's shared workspaces. */\nexport type UpdateOrganizationComputeReachRequest = {\n allowedWorkspaceIds: string[] | null;\n allowPersonalWorkspaces: boolean;\n};\n\nexport type OrganizationComputeReachResponse = {\n reach: OrganizationComputeReach;\n};\n\n/** An organization machine or rig, wherever it works: its name and where it\n * works. Machines carry the id of their sandbox, which machine pages open by. */\nexport type OrganizationComputeSummary = {\n id: string;\n name: string;\n sandboxId?: string | null | undefined;\n reach: OrganizationComputeReach;\n};\n\n/** GET .../organization-machines: every organization machine, wherever it\n * works, for organization owners. `complete` is false while the server can\n * only list the ones that work in the requested workspace. */\nexport type ListOrganizationMachinesResponse = {\n machines: OrganizationComputeSummary[];\n complete: boolean;\n};\n\n/** GET .../organization-rigs: every organization sandbox environment,\n * wherever it works, for organization owners. `complete` as for machines. */\nexport type ListOrganizationRigsResponse = {\n rigs: OrganizationComputeSummary[];\n complete: boolean;\n};\n\nexport type RigChangeKind = \"setup_append\" | \"definition_edit\";\n\nexport type RigChangeStatus = \"proposed\" | \"verifying\" | \"merged\" | \"rejected\" | \"failed\";\n\nexport type RigCheckResult = {\n name: string;\n command: string;\n exitCode: number | null;\n output?: string | undefined;\n};\n\nexport type RigChangeVerification = {\n startedAt?: string | undefined;\n finishedAt?: string | undefined;\n log?: string | undefined;\n platformCheckResults?: RigCheckResult[] | undefined;\n checkResults?: RigCheckResult[] | undefined;\n [key: string]: unknown;\n};\n\nexport type RigChange = {\n id: string;\n rigId: string;\n baseVersionId: string | null;\n kind: RigChangeKind;\n payload: Record<string, unknown>;\n status: RigChangeStatus;\n proposedBy: string | null;\n verification: RigChangeVerification | null;\n resultVersionId: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type CreateRigRequest = {\n scope?: ResourceAuthorityScope;\n name: string;\n description?: string | undefined;\n image?: never;\n setupScript?: string | undefined;\n checks?: RigCheck[] | undefined;\n credentialHooks?: string[] | undefined;\n};\n\nexport type UpdateRigRequest = {\n name?: string | undefined;\n description?: string | null | undefined;\n};\n\nexport type RigSetupAppendPayload = {\n command: string;\n note?: string | undefined;\n};\n\nexport type RigDefinitionEditPayload = {\n image?: never;\n setupScript?: string | null | undefined;\n checks?: RigCheck[] | undefined;\n credentialHooks?: string[] | undefined;\n changelog?: string | null | undefined;\n};\n\nexport type ProposeRigChangeRequest =\n | { kind: \"setup_append\"; payload: RigSetupAppendPayload }\n | { kind: \"definition_edit\"; payload: RigDefinitionEditPayload };\n\n// --- Files ---------------------------------------------------------------------\n\nexport type FileStatus = \"pending_upload\" | \"ready\" | \"failed\" | \"expired\" | \"deleted\";\n\nexport type FileListRequest = {\n scope?: \"all\" | \"workspace\" | \"personal\";\n limit?: number;\n cursor?: string;\n};\nexport type FileListResponse = {\n files: FileAsset[];\n nextCursor: string | null;\n};\n\n/**\n * Who can open a file: only its owner (\"private\", Only me) or everyone in the\n * workspace, with one plain sentence saying so.\n */\nexport type FileAccess = {\n visibility: \"private\" | \"workspace\";\n whoCanOpen: string;\n};\n\n/**\n * An app-shot: a screenshot of another app's window, sent from a desktop app,\n * with the window it shows and the text the window exposed. Stored with the\n * file once and never changed.\n */\nexport type AppShotCapture = {\n /** The app's name as the system shows it. */\n app: string;\n /** The app's stable identifier, where the system has one (macOS bundle id). */\n bundleId?: string | undefined;\n /** The window title; empty when the window has none. */\n title: string;\n /** ISO timestamp. */\n capturedAt: string;\n platform: \"macos\" | \"windows\" | \"linux\";\n /** Text read through accessibility, at most 32,000 characters. */\n text?: string | undefined;\n /** The window had more text than was kept. */\n textTruncated?: boolean | undefined;\n /** The window as the system identifies it. */\n window?: { processId: number; windowId: number } | undefined;\n /** The computer the window is on, when connected to this workspace. */\n computer?: { name: string; sandboxId?: string | undefined } | undefined;\n /**\n * A web browser window's page address (http or https) and, when the computer\n * is connected, the browser profiles connected from it (at most 10) by the\n * attached browser device id browser tools use.\n */\n browser?:\n | {\n url: string;\n profiles?: { deviceId: string; name: string }[] | undefined;\n }\n | undefined;\n};\n\nexport type FileAsset = {\n /** \"personal\" is Only me: only its owner can open it. */\n scope?: \"workspace\" | \"personal\" | undefined;\n /** The person who alone can share the file or limit it to themselves. */\n ownerSubjectId?: string | null | undefined;\n /**\n * An Only me file's other workspaces of the organization where it also\n * works, besides the one that stores it and its owner's Personal workspace;\n * null for every workspace. Absent for workspace files.\n */\n reachWorkspaceIds?: string[] | null | undefined;\n id: string;\n workspaceId: string;\n status: FileStatus;\n filename: string;\n safeFilename: string;\n contentType: string;\n sizeBytes: number;\n sha256: string | null;\n bucket: string;\n objectKey: string;\n createdAt: string;\n updatedAt: string;\n /** Present on upload, publish and sharing results: who can open the file. */\n access?: FileAccess | undefined;\n /** A screenshot sent as an app-shot: the window it shows and what it said. */\n appShot?: AppShotCapture | undefined;\n};\n\nexport type UpdateFileVisibilityRequest = {\n visibility: \"private\" | \"workspace\";\n};\nexport type UpdateFileVisibilityResponse = { file: FileAsset };\n\n/** Where an Only me file works besides its own workspace and its owner's Personal workspace. */\nexport type UpdateFileReachRequest = {\n /** The owner's other workspaces of this organization; null for all of them. */\n reachWorkspaceIds: string[] | null;\n};\nexport type UpdateFileReachResponse = { file: FileAsset };\n\n/** Mirrors the closed, provider-neutral retained-output contract. */\nexport const RETAINED_OUTPUT_DEFAULT_PAGE_BYTES = 256 * 1024;\nexport const RETAINED_OUTPUT_MAX_PAGE_BYTES = 1024 * 1024;\nexport const COMPUTER_SCREENSHOT_MAX_BYTES = 32 * 1024 * 1024;\nexport const GENERATED_IMAGE_MAX_BYTES = 64 * 1024 * 1024;\nexport const GENERATED_VIDEO_MAX_BYTES = 512 * 1024 * 1024;\n\nexport type RetainedOutputKind =\n | \"tool_result\"\n | \"assistant_completion\"\n | \"internal_update\"\n | \"event_media\"\n | \"computer_screenshot\"\n | \"browser_screenshot\"\n | \"generated_image\"\n | \"generated_video\"\n | \"file\";\n\nexport type RetainedOutputUnavailableReason =\n | \"not_retained\"\n | \"pending\"\n | \"failed\"\n | \"expired\"\n | \"deleted\"\n | \"missing_storage\"\n | \"storage_write_failed\"\n | \"quota_exceeded\"\n | \"invalid_content\"\n | \"oversized\"\n | \"unsupported\"\n /** The file exists but is Only me for someone else. */\n | \"private\";\n\nexport type RetainedArtifactReference = {\n available: true;\n artifactId: string;\n kind: RetainedOutputKind;\n contentType: string;\n originalBytes: number;\n sha256: string;\n retainedAt: string;\n dimensions?: { width: number; height: number } | undefined;\n retention:\n | { policy: \"workspace_file\"; expiresAt: null }\n | { policy: \"session_screenshot\"; expiresAt: string };\n retrieval: {\n method: \"GET\";\n path: string;\n acceptRanges: \"bytes\";\n maxRangeBytes: number;\n };\n};\n\nexport type RetainedArtifactUnavailable = {\n available: false;\n artifactId: string;\n reason: RetainedOutputUnavailableReason;\n};\n\nexport type RetainedArtifactMetadata = RetainedArtifactReference | RetainedArtifactUnavailable;\n\nexport type GeneratedImageReceipt = {\n type: \"generated_image\";\n artifact: RetainedArtifactReference;\n sandboxPath: string;\n};\n\nexport type VideoGenerationSourceMode =\n | \"text\"\n | \"first_frame\"\n | \"first_and_last_frames\"\n | \"image_reference\"\n | \"video_reference\";\n\nexport type VideoGenerationResolution = \"480p\" | \"720p\";\n\nexport type VideoGenerationAspectRatio =\n | \"16:9\"\n | \"4:3\"\n | \"1:1\"\n | \"3:4\"\n | \"9:16\"\n | \"21:9\"\n | \"adaptive\";\n\nexport type VideoGenerationModelCapability = {\n modelId: string;\n label: string;\n providerLabel: string;\n sourceModes: VideoGenerationSourceMode[];\n resolutions: VideoGenerationResolution[];\n aspectRatios: VideoGenerationAspectRatio[];\n duration: {\n minSeconds: number;\n maxSeconds: number;\n stepSeconds: number;\n };\n supportsAudio: boolean;\n};\n\nexport type VideoGenerationCapabilities = {\n schemaVersion: 1;\n capabilityRevision: string;\n defaultModelId: string;\n models: VideoGenerationModelCapability[];\n};\n\nexport type VideoGenerationPolicy = {\n schemaVersion: 1;\n revision: number;\n fundingSource: VideoGenerationFundingSource;\n enabledModelIds: string[];\n defaultModelId: string | null;\n};\n\nexport type UpdateVideoGenerationPolicyRequest = {\n expectedRevision: number;\n fundingSource: VideoGenerationFundingSource;\n enabledModelIds: string[];\n defaultModelId: string | null;\n};\n\nexport type VideoGenerationFundingSource =\n | \"opengeni_credits\"\n | \"workspace_gateway\"\n | \"supergrok_subscription\";\n\nexport type VideoGenerationFundingOption = {\n source: VideoGenerationFundingSource;\n label: string;\n description: string;\n available: boolean;\n unavailableReason: string | null;\n /** `region_restricted` when EU-only inference switched this source off. */\n unavailableCode?: FeatureUnavailableReason | undefined;\n};\n\nexport type WorkspaceVideoGenerationSettings = {\n schemaVersion: 1;\n policy: VideoGenerationPolicy;\n fundingOptions: VideoGenerationFundingOption[];\n availableModels: VideoGenerationModelCapability[];\n capabilities: VideoGenerationCapabilities | null;\n};\n\nexport type GeneratedVideoFacts = {\n durationSeconds: number;\n width: number;\n height: number;\n fps: number;\n hasAudio: boolean;\n videoCodec: \"h264\";\n audioCodec: \"aac\" | null;\n};\n\nexport type GeneratedVideoReceipt = {\n type: \"generated_video\";\n schemaVersion: 1;\n operationId: string;\n artifact: RetainedArtifactReference;\n video: GeneratedVideoFacts;\n sandboxPath: string;\n};\n\nexport type VideoGenerationTerminalFailureStatus =\n | \"provider_failed\"\n | \"retention_failed\"\n | \"cancelled_before_submit\"\n | \"outcome_unknown\";\n\nexport type MediaGenerationResult =\n | {\n type: \"media_generation_result\";\n schemaVersion: 1;\n status: \"ready\";\n operationId: string;\n receipt: GeneratedVideoReceipt;\n }\n | {\n type: \"media_generation_result\";\n schemaVersion: 1;\n status: VideoGenerationTerminalFailureStatus;\n operationId: string;\n boundedPublicReason: string;\n };\n\nexport type VideoGenerationPublicStatus =\n | \"preparing\"\n | \"prepared\"\n | \"accepted\"\n | \"provider_started\"\n | \"retaining\"\n | \"completed\"\n | VideoGenerationTerminalFailureStatus;\n\nexport type VideoGenerationOperationSummary = {\n schemaVersion: 1;\n operationId: string;\n modelId: string;\n status: VideoGenerationPublicStatus;\n createdAt: string;\n updatedAt: string;\n terminal: MediaGenerationResult | null;\n};\n\n/** Ephemeral source minted for native browser playback; never persist the URL. */\nexport type VideoArtifactPlaybackSource = {\n schemaVersion: 1;\n artifactId: string;\n url: string;\n expiresAt: string;\n contentType: \"video/mp4\";\n sizeBytes: number;\n sha256: string;\n acceptRanges: \"bytes\";\n};\n\nexport type RetainedArtifactContentOptions = {\n /** One RFC-style bytes range, for example `bytes=1048576-2097151`. */\n range?: string | undefined;\n signal?: AbortSignal | undefined;\n};\n\nexport type RetainedArtifactContent = {\n bytes: Uint8Array;\n status: 200 | 206;\n contentType: string;\n contentLength: number;\n contentRange: string | null;\n acceptRanges: \"bytes\";\n};\n\nexport type RetainedArtifactDownloadOptions = {\n signal?: AbortSignal | undefined;\n /** Retry transient range failures; bounded to 0..3, default 2. */\n maxRetries?: number | undefined;\n};\n\nexport type RetainedScreenshotDownloadOptions = RetainedArtifactDownloadOptions;\n\nexport type RetainedScreenshotDownload = {\n metadata: RetainedArtifactMetadata;\n /** Null when metadata truth says the screenshot is unavailable. */\n bytes: Uint8Array | null;\n};\n\nexport type RetainedArtifactDownload = {\n artifact: RetainedArtifactReference;\n bytes: Uint8Array;\n};\n\nexport type CreateFileUploadRequest = {\n scope?: \"workspace\" | \"personal\";\n filename: string;\n contentType: string;\n sizeBytes: number;\n sha256?: string | undefined;\n /** The upload is an app-shot (images only). */\n appShot?: AppShotCapture | undefined;\n};\n\nexport type CreateFileUploadResponse = {\n fileId: string;\n uploadId: string;\n /** Pre-signed PUT URL for the file bytes (direct to object storage). */\n putUrl: string;\n /** Headers that MUST be sent with the PUT for the signature to validate. */\n requiredHeaders: Record<string, string>;\n expiresAt: string;\n maxSizeBytes: number;\n /** Who will be able to open the file once uploaded. */\n access?: FileAccess | undefined;\n};\n\nexport type CompleteFileUploadResponse = {\n file: FileAsset;\n};\n\nexport type FileDownloadUrlResponse = {\n url: string;\n expiresAt: string;\n};\n\n/** Bytes accepted by the `uploadFile` helper. */\nexport type FileUploadData = Blob | ArrayBuffer | Uint8Array | string;\n\nexport type UploadFileInput = {\n scope?: \"workspace\" | \"personal\";\n filename: string;\n contentType: string;\n data: FileUploadData;\n sha256?: string | undefined;\n /** Optional deadline for the signed object-storage PUT. */\n timeoutMs?: number | undefined;\n /** The upload is an app-shot (images only): the window it shows and what it said. */\n appShot?: AppShotCapture | undefined;\n};\n\n// --- Documents -------------------------------------------------------------------\n\nexport type DocumentStatus = \"queued\" | \"indexing\" | \"ready\" | \"failed\";\nexport type KnowledgeSourceKind =\n | \"manual_upload\"\n | \"meeting_transcript\"\n | \"repository\"\n | \"email\"\n | \"chat\"\n | \"document\"\n | \"web\"\n | \"other\";\nexport type DocumentSearchMode = \"hybrid\" | \"vector\" | \"keyword\";\n\nexport type DocumentAuthorityKind = \"organization\" | \"workspace\" | \"personal\";\n\nexport type DocumentVisibility = \"workspace\" | \"private\";\n\nexport type DocumentCurationStatus = \"none\" | \"pending\" | \"suggested\" | \"auto_filed\" | \"failed\";\n\nexport type DocumentCuration = {\n suggestedBaseId: string | null;\n suggestedBaseName: string | null;\n confidence: number;\n reason: string | null;\n originalTitle: string | null;\n model: string | null;\n};\n\nexport type DocumentBase = {\n id: string;\n workspaceId: string;\n name: string;\n description: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type Document = {\n id: string;\n workspaceId: string;\n baseId: string;\n fileId: string;\n status: DocumentStatus;\n title: string;\n parser: string;\n chunkCount: number;\n error: string | null;\n sourceKind: KnowledgeSourceKind;\n sourceUri: string | null;\n sourceExternalId: string | null;\n sourceTitle: string | null;\n sourceAuthor: string | null;\n sourceCreatedAt: string | null;\n sourceUpdatedAt: string | null;\n sourceVersion: string | null;\n aclTags: string[];\n authorityKind: DocumentAuthorityKind;\n authorityWorkspaceId: string | null;\n authoritySubjectId: string | null;\n authorityId?: string | null | undefined;\n visibility: DocumentVisibility;\n createdBy: string | null;\n agentAccess: boolean;\n summary: string | null;\n topics: string[];\n curationStatus: DocumentCurationStatus;\n curation: DocumentCuration | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type DocumentSearchResult = {\n chunkId: string;\n workspaceId: string;\n documentId: string;\n baseId: string;\n fileId: string;\n title: string;\n text: string;\n score: number;\n matchType: DocumentSearchMode;\n vectorScore: number | null;\n keywordScore: number | null;\n chunkIndex: number;\n metadata: Record<string, unknown>;\n sourceKind: KnowledgeSourceKind;\n sourceUri: string | null;\n sourceExternalId: string | null;\n sourceTitle: string | null;\n sourceAuthor: string | null;\n sourceCreatedAt: string | null;\n sourceUpdatedAt: string | null;\n sourceVersion: string | null;\n aclTags: string[];\n authorityKind: DocumentAuthorityKind;\n authorityWorkspaceId: string | null;\n authoritySubjectId: string | null;\n};\n\nexport type CreateDocumentBaseRequest = {\n name: string;\n description?: string | undefined;\n};\n\nexport type AddDocumentRequest = {\n fileId: string;\n title?: string | undefined;\n sourceKind?: KnowledgeSourceKind | undefined;\n sourceUri?: string | undefined;\n sourceExternalId?: string | undefined;\n sourceTitle?: string | undefined;\n sourceAuthor?: string | undefined;\n sourceCreatedAt?: string | undefined;\n sourceUpdatedAt?: string | undefined;\n sourceVersion?: string | undefined;\n aclTags?: string[] | undefined;\n authorityKind?: DocumentAuthorityKind | undefined;\n visibility?: DocumentVisibility | undefined;\n agentAccess?: boolean | undefined;\n};\n\nexport type CreateKnowledgeDropRequest = {\n text?: string | undefined;\n fileId?: string | undefined;\n filename?: string | undefined;\n title?: string | undefined;\n authorityKind?: DocumentAuthorityKind | undefined;\n visibility?: DocumentVisibility | undefined;\n agentAccess?: boolean | undefined;\n};\n\nexport type MoveDocumentRequest = {\n targetBaseId?: string | undefined;\n};\n\nexport type DocumentAuthorityTuple = {\n kind: DocumentAuthorityKind;\n workspaceId: string | null;\n subjectId: string | null;\n authorityId: string | null;\n};\n\nexport type ReclassifyDocumentAuthorityRequest = {\n operationId: string;\n expectedAuthority: DocumentAuthorityTuple;\n targetAuthorityKind: DocumentAuthorityKind;\n};\n\nexport type DocumentAuthorityReclassification = {\n operationId: string;\n documentId: string;\n previousAuthority: DocumentAuthorityTuple;\n authority: DocumentAuthorityTuple;\n createdAt: string;\n};\n\nexport type ListDocumentAuthorityReclassificationsOptions = {\n limit?: number | undefined;\n cursor?: string | undefined;\n};\n\nexport type ListDocumentAuthorityReclassificationsResponse = {\n receipts: DocumentAuthorityReclassification[];\n hasMore: boolean;\n nextCursor: string | null;\n};\n\nexport type RunDocumentDefaultCollectionBackfillRequest = {\n runId: string;\n operationId: string;\n batchSize?: number | undefined;\n};\n\nexport type DocumentDefaultCollectionBackfill = {\n runId: string;\n operationId: string;\n status: \"running\" | \"completed\";\n lastWorkspaceId: string | null;\n processedCount: number;\n createdCount: number;\n adoptedCount: number;\n completedAt: string | null;\n};\n\nexport type DocumentDefaultCollectionBackfillRunAudit = Omit<\n DocumentDefaultCollectionBackfill,\n \"operationId\"\n> & {\n actorSubjectId: string;\n startedAt: string;\n updatedAt: string;\n};\n\nexport type DocumentDefaultCollectionBackfillOperationAudit = {\n operationId: string;\n result: DocumentDefaultCollectionBackfill;\n createdAt: string;\n};\n\nexport type DocumentDefaultCollectionBackfillReceiptAudit = {\n workspaceId: string;\n baseId: string;\n outcome: \"created\" | \"adopted\";\n createdAt: string;\n};\n\nexport type ListDocumentDefaultCollectionBackfillRunsResponse = {\n runs: DocumentDefaultCollectionBackfillRunAudit[];\n hasMore: boolean;\n nextCursor: string | null;\n};\n\nexport type DocumentDefaultCollectionBackfillAudit = {\n run: DocumentDefaultCollectionBackfillRunAudit;\n operations: DocumentDefaultCollectionBackfillOperationAudit[];\n receipts: DocumentDefaultCollectionBackfillReceiptAudit[];\n operationsHasMore: boolean;\n operationsNextCursor: string | null;\n receiptsHasMore: boolean;\n receiptsNextCursor: string | null;\n};\n\nexport type GetDocumentDefaultCollectionBackfillAuditOptions = {\n limit?: number | undefined;\n operationCursor?: string | undefined;\n receiptCursor?: string | undefined;\n};\n\nexport type OrganizationDocumentAuthorityReclassification = DocumentAuthorityReclassification & {\n actorSubjectId: string;\n requestWorkspaceId: string;\n};\n\nexport type ListOrganizationDocumentAuthorityReclassificationsResponse = {\n receipts: OrganizationDocumentAuthorityReclassification[];\n hasMore: boolean;\n nextCursor: string | null;\n};\n\nexport type DocumentSearchRequest = {\n query: string;\n baseIds?: string[] | undefined;\n mode?: DocumentSearchMode | undefined;\n sourceKinds?: KnowledgeSourceKind[] | undefined;\n authorityKinds?: DocumentAuthorityKind[] | undefined;\n aclTags?: string[] | undefined;\n limit?: number | undefined;\n};\n\nexport type DocumentSearchResponse = {\n results: DocumentSearchResult[];\n};\n\nexport type KnowledgeMemoryStatus =\n | \"proposed\"\n | \"approved\"\n | \"rejected\"\n | \"active\"\n | \"superseded\"\n | \"archived\";\nexport type KnowledgeMemoryKind =\n | \"semantic\"\n | \"episodic\"\n | \"procedural\"\n | \"decision\"\n | \"preference\";\n\nexport type KnowledgeSourceRef = {\n kind: \"document_chunk\" | \"document\" | \"session_event\" | \"memory\" | \"external\";\n id: string;\n uri?: string | undefined;\n title?: string | undefined;\n metadata?: Record<string, unknown> | undefined;\n};\n\nexport type KnowledgeMemory = {\n id: string;\n workspaceId: string;\n status: KnowledgeMemoryStatus;\n kind: KnowledgeMemoryKind;\n scope: string;\n text: string;\n sourceRefs: KnowledgeSourceRef[];\n confidence: number;\n metadata: Record<string, unknown>;\n createdBySessionId: string | null;\n reviewedBy: string | null;\n reviewedAt: string | null;\n pinned: boolean;\n usageCount: number;\n lastUsedAt: string | null;\n supersedesId: string | null;\n supersededById: string | null;\n validFrom: string;\n validUntil: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type CreateKnowledgeMemoryRequest = {\n status?: KnowledgeMemoryStatus | undefined;\n kind?: KnowledgeMemoryKind | undefined;\n scope?: string | undefined;\n text: string;\n sourceRefs?: KnowledgeSourceRef[] | undefined;\n confidence?: number | undefined;\n metadata?: Record<string, unknown> | undefined;\n createdBySessionId?: string | undefined;\n pinned?: boolean | undefined;\n replacesId?: string | undefined;\n};\n\nexport type UpdateKnowledgeMemoryRequest = {\n status?: KnowledgeMemoryStatus | undefined;\n kind?: KnowledgeMemoryKind | undefined;\n scope?: string | undefined;\n text?: string | undefined;\n sourceRefs?: KnowledgeSourceRef[] | undefined;\n confidence?: number | undefined;\n metadata?: Record<string, unknown> | undefined;\n reviewedBy?: string | undefined;\n pinned?: boolean | undefined;\n};\n\nexport type KnowledgeMemorySearchRequest = {\n query?: string | undefined;\n status?: KnowledgeMemoryStatus | undefined;\n kind?: KnowledgeMemoryKind | undefined;\n scope?: string | undefined;\n limit?: number | undefined;\n};\n\nexport type WorkspaceMemorySearchMode = \"hybrid\" | \"vector\" | \"keyword\";\n\nexport type WorkspaceMemorySearchRequest = {\n query: string;\n kind?: KnowledgeMemoryKind | undefined;\n limit?: number | undefined;\n mode?: WorkspaceMemorySearchMode | undefined;\n};\n\nexport type WorkspaceMemorySearchResult = {\n memory: KnowledgeMemory;\n score: number;\n matchType: WorkspaceMemorySearchMode;\n vectorScore: number | null;\n keywordScore: number | null;\n};\n\nexport type WorkspaceMemorySearchResponse = {\n results: WorkspaceMemorySearchResult[];\n};\n\nexport type SkillArtifactFile = {\n path: string;\n content: string;\n};\n\nexport type SkillArtifactDefinition = {\n name: string;\n description?: string | undefined;\n /** Omitted means workspace-wide; session_selected requires explicit session attachment. */\n activationMode?: \"workspace_managed\" | \"session_selected\" | undefined;\n files: SkillArtifactFile[];\n};\n\nexport type SessionSkill = Omit<SkillArtifactDefinition, \"activationMode\">;\n/** SKILL.md owns metadata; supplied legacy fields must exactly match it. */\nexport type SkillArtifactDefinitionInput = Omit<SkillArtifactDefinition, \"name\" | \"description\"> & {\n name?: string | undefined;\n description?: string | undefined;\n};\nexport type SessionSkillInput = Omit<SkillArtifactDefinitionInput, \"activationMode\">;\n\n// --- Capabilities ---------------------------------------------------------------\n\nexport type CapabilityKind = \"mcp\" | \"api\" | \"skill\" | \"plugin\";\n\nexport type CapabilitySource =\n | \"built_in\"\n | \"library\"\n | \"configured\"\n | \"public_registry\"\n | \"registry\"\n | \"manual\";\n\nexport type CapabilityInstallationStatus = \"active\" | \"disabled\";\n\nexport type CapabilityCatalogAuthKind = \"oauth2\" | \"api_key\" | \"none\" | \"unknown\";\n\nexport type CapabilityCatalogTier = \"verified\" | \"community\";\n\nexport type CapabilityLifecycleStatus =\n | \"available\"\n | \"installed\"\n | \"connected\"\n | \"ready\"\n | \"needs_attention\"\n | \"unavailable\"\n | \"managed\";\n\nexport type CapabilityReadiness = \"ready\" | \"setup_required\" | \"attention\" | \"unavailable\";\n\nexport type CapabilityAction =\n | \"install\"\n | \"connect\"\n | \"configure\"\n | \"update\"\n | \"repair\"\n | \"disconnect\"\n | \"uninstall\"\n | \"inspect\";\n\nexport type CapabilityLifecycle = {\n status: CapabilityLifecycleStatus;\n readiness: CapabilityReadiness;\n detail: string | null;\n managedBy: \"deployment\" | \"platform\" | \"workspace\" | \"organization\" | null;\n};\n\nexport type CapabilityRuntime = {\n available: boolean;\n mcpServerId?: string | undefined;\n transport?: string | undefined;\n notes: string | null;\n /** Secret-safe server-derived registry exposure state. */\n catalogTrust?:\n | {\n state: \"trusted\" | \"legacy_active\" | \"unverified\";\n reason:\n | \"trusted_source\"\n | \"verified_probe\"\n | \"active_installation_compatibility\"\n | \"missing_verification\";\n }\n | undefined;\n /**\n * Present when connecting needs an operator-registered OAuth client because\n * the provider refuses self-registration; `configured` is whether this\n * deployment has one. Connector surfaces offer the row only when true.\n */\n operatorOAuthClient?: { configured: boolean } | undefined;\n};\n\nexport type CapabilityCatalogItem = {\n id: string;\n accountId?: string | undefined;\n workspaceId?: string | undefined;\n kind: CapabilityKind;\n source: CapabilitySource;\n name: string;\n description: string | null;\n category: string;\n tags: string[];\n homepageUrl: string | null;\n endpointUrl: string | null;\n installUrl: string | null;\n authModel: string | null;\n providerDomain: string | null;\n surfaceType: string | null;\n transport: string | null;\n mcpUrl: string | null;\n authKind: CapabilityCatalogAuthKind | null;\n credentialFacts: Record<string, unknown>[];\n tier: CapabilityCatalogTier | null;\n provenance: string | null;\n logoAssetPath: string | null;\n importBatchId: string | null;\n stale: boolean;\n staleAt: string | null;\n tools: ToolRef[];\n runtime: CapabilityRuntime;\n lifecycle: CapabilityLifecycle;\n actions: CapabilityAction[];\n /** @deprecated Use lifecycle and actions. */\n enabled: boolean;\n /** @deprecated Use lifecycle.detail. */\n enabledReason: string | null;\n /** The connection backing this enabled installation, or null when none is involved. */\n connectionRef: {\n connectionId?: string | undefined;\n accountSelection?: \"all_eligible\" | undefined;\n authoritySource?: \"host\" | undefined;\n providerDomain: string;\n kind: string;\n subjectScope?: \"subject\" | \"workspace\" | undefined;\n } | null;\n metadata: Record<string, unknown>;\n createdAt?: string | undefined;\n updatedAt?: string | undefined;\n /**\n * Whether the viewer may remove this custom MCP server from the workspace\n * (`removeCapabilityInstallation` on the client): integration admins\n * remove any, a member only one they turned on, while it is on. Older\n * servers omit it.\n */\n canRemove?: boolean | undefined;\n};\n\nexport type CapabilityInstallation = {\n id: string;\n accountId: string;\n workspaceId: string;\n capabilityId: string;\n kind: CapabilityKind;\n status: CapabilityInstallationStatus;\n config: Record<string, unknown>;\n metadata: Record<string, unknown>;\n enabledAt: string;\n updatedAt: string;\n};\n\nexport type RemoveCapabilityInstallationResponse = {\n /** The installation that was removed. */\n removed: CapabilityInstallation;\n};\n\nexport type CapabilityCatalogResponse = {\n items: CapabilityCatalogItem[];\n installations: CapabilityInstallation[];\n /**\n * Who the organization lets turn integrations on: members (the default) or\n * only integration admins. Older servers omit it; treat that as members.\n */\n memberIntegrationSetup?: \"members\" | \"admins\" | undefined;\n};\n\nexport type CreateCapabilityCatalogItemRequest = {\n id?: string | undefined;\n kind: \"mcp\";\n source?: CapabilitySource | undefined;\n name: string;\n description?: string | undefined;\n category?: string | undefined;\n tags?: string[] | undefined;\n homepageUrl?: string | undefined;\n endpointUrl?: string | undefined;\n installUrl?: string | undefined;\n authModel?: string | undefined;\n metadata?: Record<string, unknown> | undefined;\n};\n\nexport type EnableCapabilityRequest = {\n onlyIfUninstalled?: boolean | undefined;\n config?: Record<string, unknown> | undefined;\n metadata?: Record<string, unknown> | undefined;\n connectionRef?: McpServerConnectionRef | undefined;\n /**\n * Credential headers for remote MCP capabilities. Write-only: encrypted at\n * rest, injected only into the runtime MCP client, never returned by the\n * API (responses expose header names only).\n */\n headers?: Record<string, string> | undefined;\n};\n\nexport type DiscoverMcpCapabilitiesResponse = {\n items: CapabilityCatalogItem[];\n source: \"official_mcp_registry\";\n sourceUrl: string;\n};\n\nexport type SkillImportSource = \"github\" | \"skills_sh\";\n\nexport type SkillInstallationSource = \"library\" | \"github\" | \"skills_sh\";\n\nexport type PreviewSkillImportRequest = {\n url: string;\n};\n\nexport type SkillImportFileSummary = {\n path: string;\n byteSize: number;\n contentSha256: string;\n};\n\nexport type SkillImportPreview = {\n markdown?: string;\n source: SkillImportSource;\n sourceUrl: string;\n repositoryUrl: string;\n owner: string;\n repository: string;\n sourcePath: string;\n sourceCommit: string;\n name: string;\n description: string;\n contentSha256: string;\n totalBytes: number;\n files: SkillImportFileSummary[];\n warnings: string[];\n installed: boolean;\n installationVersion: number | null;\n};\n\nexport type InstallSkillRequest = {\n url: string;\n expectedSourceCommit: string;\n expectedContentSha256: string;\n expectedInstallationVersion?: number | undefined;\n};\n\nexport type InstallLibrarySkillRequest = {\n expectedVersion: string;\n expectedContentSha256: string;\n expectedInstallationVersion?: number | undefined;\n};\n\nexport type InstalledSkill = {\n skillReceipt?: import(\"./skills\").SkillWriteReceipt | undefined;\n capabilityId: string;\n pluginId: string;\n pluginVersionId: string;\n facetId: string;\n pluginInstallationId: string;\n facetInstallationId: string;\n installationVersion: number;\n source: SkillInstallationSource;\n version: string;\n sourceUrl: string;\n sourceCommit: string;\n contentSha256: string;\n name: string;\n status: \"installed\";\n};\n\nexport type CapabilityComponentOwner = {\n kind: \"direct\" | \"plugin\" | \"migration\";\n id: string;\n removable: boolean;\n};\n\nexport type InstalledSkillSummary = {\n capabilityId: string;\n pluginKey: string;\n installationVersion: number;\n name: string;\n description: string;\n category: string;\n tags: string[];\n provenance: string;\n source: SkillInstallationSource;\n version: string;\n sourceUrl: string;\n repositoryUrl: string;\n sourceCommit: string;\n sourcePath: string;\n contentSha256: string;\n fileCount: number;\n totalBytes: number;\n license: string | null;\n installedAt: string;\n updatedAt: string;\n owners: CapabilityComponentOwner[];\n};\n\nexport type ListInstalledSkillsResponse = {\n skills: InstalledSkillSummary[];\n};\n\nexport type SkillUninstallPreview = {\n capabilityId: string;\n installed: boolean;\n installationVersion: number | null;\n directOwner: CapabilityComponentOwner | null;\n remainingOwners: CapabilityComponentOwner[];\n removesRuntimeSkill: boolean;\n};\n\nexport type UninstallSkillRequest = {\n expectedInstallationVersion: number;\n};\n\nexport type UninstallSkillResult = {\n skillReleases?: import(\"./skills\").SkillSourceReleaseReceipt[] | undefined;\n capabilityId: string;\n status: \"not_installed\" | \"uninstalled\" | \"retained_by_other_owners\";\n remainingOwners: CapabilityComponentOwner[];\n};\n\nexport type ApiIntegrationProtocol = \"openapi\" | \"graphql\";\nexport type IntegrationDefinitionProvenance = \"curated\" | \"workspace\";\n\nexport type IntegrationFacetKind =\n | \"tools\"\n | \"knowledge_source\"\n | \"inbound_trigger\"\n | \"delivery_destination\"\n | \"identity_link\";\n\nexport type IntegrationFacetStatus = \"active\" | \"paused\" | \"needs_attention\" | \"disabled\";\n\nexport type IntegrationFacetDefinitionSummary = {\n facetKey: string;\n kind: Exclude<IntegrationFacetKind, \"tools\">;\n configSchema: Record<string, unknown>;\n capabilities: Record<string, unknown>;\n};\n\nexport type IntegrationFacetBindingSummary = {\n id: string;\n facetKey: string;\n kind: Exclude<IntegrationFacetKind, \"tools\">;\n bindingKey: string;\n displayName: string;\n connectionId: string | null;\n status: IntegrationFacetStatus;\n config: Record<string, unknown>;\n version: number;\n hasCursor: boolean;\n lastSuccessAt: string | null;\n lastErrorCode: string | null;\n createdAt: string;\n updatedAt: string;\n directlyOwned: boolean;\n owners: CapabilityComponentOwner[];\n /**\n * Whether the caller may remove it: admins remove anything, a member only\n * what they added. Older servers omit it.\n */\n canRemove?: boolean | undefined;\n};\n\nexport type IntegrationInstanceFacetsResponse = {\n capabilityId: string;\n instanceKey: string;\n providerDomain: string;\n connectionId: string | null;\n facets: {\n definition: IntegrationFacetDefinitionSummary;\n binding: IntegrationFacetBindingSummary | null;\n }[];\n};\n\nexport type UpsertIntegrationFacetRequest = {\n displayName: string;\n config?: Record<string, unknown> | undefined;\n expectedVersion?: number | undefined;\n idempotencyKey: string;\n};\n\nexport type MutateIntegrationFacetRequest = {\n expectedVersion: number;\n idempotencyKey: string;\n};\n\nexport type IntegrationFacetMutationResult = {\n capabilityId: string;\n instanceKey: string;\n facetKey: string;\n status: \"configured\" | \"paused\" | \"active\";\n binding: IntegrationFacetBindingSummary;\n};\n\nexport type IntegrationFacetRemovalResult = {\n capabilityId: string;\n instanceKey: string;\n facetKey: string;\n status: \"not_configured\" | \"removed\" | \"retained_by_other_owners\";\n binding: IntegrationFacetBindingSummary | null;\n remainingOwners: CapabilityComponentOwner[];\n};\n\n/**\n * Presentation-only consent copy served with an integration or connector.\n * Never grants a scope or replaces server-side authorization; the UI keeps a\n * generic fallback for any omitted field.\n */\nexport type IntegrationPresentation = {\n providerName?: string | undefined;\n icon?: \"calendar\" | \"cloud\" | \"contacts\" | \"files\" | \"mail\" | undefined;\n introduction?: string | undefined;\n capabilities?: { title: string; description: string }[] | undefined;\n permissionSummary?: string | undefined;\n scopeLabels?: Record<string, { label: string; description: string }> | undefined;\n};\n\nexport type IntegrationDefinitionSummary = {\n id: string;\n name: string;\n summary: string;\n protocol: \"openapi\";\n provider: {\n id: \"google\" | \"microsoft\";\n domain: string;\n };\n authentication: {\n kind: \"oauth2\";\n scopes: string[];\n };\n presentation?: IntegrationPresentation | undefined;\n facets: IntegrationFacetDefinitionSummary[];\n};\n\nexport type ListIntegrationDefinitionsResponse = {\n definitions: IntegrationDefinitionSummary[];\n};\n\nexport type IntegrationSource =\n | { kind: \"definition\"; definitionId: string }\n | { kind: \"openapi\"; url: string; baseUrl?: string | undefined }\n | { kind: \"graphql\"; endpoint: string; name?: string | undefined }\n | { kind: \"auto\"; url: string; baseUrl?: string | undefined };\n\n/**\n * OpenAPI 3.x text (JSON or YAML, at most 8 MiB) sent in the request instead\n * of a URL. `sourceKey` is your stable identity for the Integration: reuse it\n * to update the same installation. Server URLs must be absolute or `baseUrl`\n * given. Calls still obey the deployment network policy, so an API on\n * localhost or a private address needs a public tunnel unless the operator\n * enables private targets. Send the same document again on install.\n */\nexport type InlineOpenApiDocumentSource = {\n kind: \"openapi_document\";\n sourceKey: string;\n document: string;\n baseUrl?: string | undefined;\n};\n\n/** Preview/install input sources. */\nexport type IntegrationSourceInput = IntegrationSource | InlineOpenApiDocumentSource;\n\n/** Preview echo: an inline document is reported by digest, never its text. */\nexport type IntegrationSourceProjection =\n | IntegrationSource\n | {\n kind: \"openapi_document\";\n sourceKey: string;\n documentSha256: string;\n baseUrl?: string | undefined;\n };\n\nexport type PreviewApiIntegrationRequest = {\n source: IntegrationSourceInput;\n connectionId?: string | undefined;\n ownership?: ConnectionOwnership | undefined;\n};\n\nexport type ApiIntegrationOAuthStartRequest = {\n definitionId: string;\n ownership?: ConnectionOwnership | undefined;\n connectionId?: string | undefined;\n returnPath?: string | undefined;\n};\n\nexport type ApiIntegrationAuthPreview =\n | { kind: \"none\" }\n | { kind: \"oauth2\"; providerDomain: string; scopes: string[] }\n | {\n kind: \"api_key\";\n providerDomain: string;\n carrier: \"header\" | \"query\" | \"cookie\";\n name: string;\n }\n | { kind: \"http\"; providerDomain: string; scheme: string };\n\nexport type ApiIntegrationToolPreview = {\n id: string;\n operationKey: string;\n name: string;\n description: string;\n safety: \"read\" | \"write\" | \"destructive\";\n approvalMode: \"never\" | \"ask\";\n deprecated: boolean;\n};\n\nexport type ApiIntegrationPreview = {\n source: IntegrationSourceProjection;\n definitionId: string;\n definitionProvenance: IntegrationDefinitionProvenance;\n protocol: ApiIntegrationProtocol;\n capabilityId: string;\n pluginKey: string;\n serverId: string;\n name: string;\n description: string | null;\n provider: string | null;\n providerDomain: string;\n baseUrl: string;\n sourceUrl: string | null;\n revisionId: string;\n contentSha256: string;\n auth: ApiIntegrationAuthPreview;\n connectionId: string | null;\n connectionOwnership: ConnectionOwnership | null;\n tools: ApiIntegrationToolPreview[];\n warnings: string[];\n};\n\nexport type InstallApiIntegrationRequest = {\n source: IntegrationSourceInput;\n expectedRevisionId: string;\n expectedContentSha256: string;\n connectionId?: string | undefined;\n ownership?: ConnectionOwnership | undefined;\n instanceKey?: string | undefined;\n displayName?: string | undefined;\n expectedInstanceVersion?: number | undefined;\n allowedTools?: string[] | undefined;\n /**\n * Selected tools whose preview `approvalMode` is `\"ask\"` that should run\n * without per-call human approval (for example in scheduled or other\n * unattended sessions). Needs `capabilities:manage`; a curated definition\n * may forbid exempting specific operations (422). Declarative: omit it and every write tool asks\n * again. Connector Block and session approval policies still apply.\n */\n autoApprovedTools?: string[] | undefined;\n};\n\nexport type InstalledApiIntegration = {\n capabilityId: string;\n pluginId: string;\n pluginVersionId: string;\n integrationFacetId: string;\n apiFacetId: string;\n pluginInstallationId: string;\n integrationFacetInstallationId: string;\n apiFacetInstallationId: string;\n installationVersion: number;\n instanceId: string;\n instanceKey: string;\n displayName: string;\n instanceVersion: number;\n revisionId: string;\n serverId: string;\n status: \"installed\";\n};\n\nexport type ApiIntegrationInstallationSummary = {\n capabilityId: string;\n pluginKey: string;\n installationVersion: number;\n instanceId: string;\n instanceKey: string;\n displayName: string;\n instanceVersion: number;\n serverId: string;\n name: string;\n description: string | null;\n protocol: ApiIntegrationProtocol;\n definitionId: string;\n definitionProvenance: IntegrationDefinitionProvenance;\n providerDomain: string;\n baseUrl: string;\n sourceUrl: string | null;\n connected: boolean;\n requiresConnection: boolean;\n connectionId: string | null;\n /** When the bound connection was last used, or null when never or unbound. */\n connectionLastUsedAt?: string | null;\n ownership: \"workspace\" | \"personal\" | \"none\";\n allowedTools: string[];\n toolCount: number;\n approvalRequiredToolCount: number;\n revisionId: string;\n contentSha256: string;\n /**\n * Set on an instance a Personal workspace carries for its owner from another\n * workspace where they connected it \"Only me\"; it is managed there.\n */\n personalExtension?: { originWorkspaceId: string; originWorkspaceName: string };\n /**\n * Set when the organization serves it here (organization settings manage\n * it); `enabledHere` is false while this workspace turned it off.\n */\n organizationConnector?: {\n connectorId: string;\n login: \"each_person\" | \"organization_key\" | \"none\";\n /** How the API authenticates: what a person adds when each person signs in. */\n auth: ApiIntegrationAuthPreview;\n enabledHere: boolean;\n };\n /**\n * Whether the caller may remove this instance: admins remove any, a member\n * only one they added. Older servers omit it.\n */\n canRemove?: boolean | undefined;\n};\n\nexport type ListApiIntegrationsResponse = {\n integrations: ApiIntegrationInstallationSummary[];\n};\n\nexport type ApiIntegrationUninstallPreview = {\n capabilityId: string;\n instanceKey: string;\n displayName: string | null;\n installed: boolean;\n installationVersion: number | null;\n instanceVersion: number | null;\n directOwner: CapabilityComponentOwner | null;\n remainingOwners: CapabilityComponentOwner[];\n removesRuntimeIntegration: boolean;\n removesDefinition: boolean;\n};\n\nexport type UninstallApiIntegrationRequest = {\n expectedInstallationVersion: number;\n expectedInstanceVersion: number;\n};\n\nexport type UninstallApiIntegrationResult = {\n capabilityId: string;\n instanceKey: string;\n status: \"not_installed\" | \"uninstalled\" | \"retained_by_other_owners\";\n remainingOwners: CapabilityComponentOwner[];\n definitionStatus: \"retained\" | \"disabled\";\n};\n\nexport type PluginManifestComponent =\n | { key: string; kind: \"skill\"; url: string }\n | { key: string; kind: \"integration\"; source: IntegrationSource }\n | { key: string; kind: \"mcp\"; serverId: string };\n\nexport type PluginManifest = {\n schemaVersion: 1;\n pluginKey: string;\n version: string;\n name: string;\n description: string;\n category: string;\n tags: string[];\n components: PluginManifestComponent[];\n};\n\nexport type PluginComponentBinding = {\n connectionId?: string | undefined;\n instanceKey?: string | undefined;\n displayName?: string | undefined;\n};\n\nexport type PreviewPluginRequest = {\n url: string;\n bindings?: Record<string, PluginComponentBinding> | undefined;\n};\n\nexport type PluginComponentPreview = {\n key: string;\n kind: \"skill\" | \"integration\" | \"mcp\";\n name: string;\n capabilityId: string;\n digest: string;\n connectionRequired: boolean;\n connectionId: string | null;\n instanceKey: string | null;\n displayName: string | null;\n facts: Record<string, unknown>;\n};\n\nexport type PluginUpdateDiff = {\n fromVersion: string | null;\n toVersion: string;\n added: string[];\n removed: string[];\n changed: string[];\n unchanged: string[];\n};\n\nexport type PluginPreview = {\n sourceUrl: string;\n manifest: PluginManifest;\n manifestDigest: string;\n installed: boolean;\n installationVersion: number | null;\n components: PluginComponentPreview[];\n diff: PluginUpdateDiff;\n};\n\nexport type InstallPluginRequest = {\n url: string;\n expectedManifestDigest: string;\n expectedComponents: Array<{ key: string; digest: string }>;\n bindings?: Record<string, PluginComponentBinding> | undefined;\n idempotencyKey: string;\n expectedInstallationVersion?: number | undefined;\n};\n\nexport type InstalledPlugin = {\n skillPublications?: import(\"./skills\").SkillPublicationReceipt[] | undefined;\n skillWrites?: import(\"./skills\").SkillWriteReceipt[] | undefined;\n skillReleases?: import(\"./skills\").SkillSourceReleaseReceipt[] | undefined;\n pluginKey: string;\n version: string;\n pluginId: string;\n pluginVersionId: string;\n pluginInstallationId: string;\n installationVersion: number;\n componentCount: number;\n status: \"installed\";\n};\n\nexport type PluginInstallationSummary = {\n pluginKey: string;\n version: string;\n name: string;\n description: string;\n category: string;\n tags: string[];\n logoUrl?: string | null | undefined;\n sourceUrl: string | null;\n manifestDigest: string;\n installationVersion: number;\n componentCount: number;\n status: \"active\" | \"needs_attention\";\n installedAt: string;\n updatedAt: string;\n /**\n * Whether the caller may remove this plugin: admins remove any, a member\n * only one they added. Older servers omit it.\n */\n canRemove?: boolean | undefined;\n};\n\nexport type ListInstalledPluginsResponse = {\n plugins: PluginInstallationSummary[];\n};\n\nexport type PluginUninstallComponentImpact = {\n capabilityId: string;\n kind: \"skill\" | \"integration\" | \"mcp\";\n retainedByOtherOwners: boolean;\n name: string;\n disposition: \"removed\" | \"retained\" | \"inactive\";\n retentionReasons: Array<\"other_owners\" | \"customized\" | \"re_scoped\" | \"registry_unavailable\">;\n remainingOwners: Array<{\n kind: \"direct\" | \"plugin\" | \"migration\";\n name: string;\n }>;\n skillId?: string | undefined;\n};\n\nexport type PluginUninstallPreview = {\n pluginKey: string;\n installed: boolean;\n version: string | null;\n installationVersion: number | null;\n previewToken?: string | undefined;\n components: PluginUninstallComponentImpact[];\n};\n\nexport type UninstallPluginRequest = {\n expectedInstallationVersion: number;\n expectedPreviewToken?: string | undefined;\n idempotencyKey: string;\n};\n\nexport type UninstallPluginResult = {\n skillReleases?: import(\"./skills\").SkillSourceReleaseReceipt[] | undefined;\n pluginKey: string;\n status: \"not_installed\" | \"uninstalled\";\n retainedComponents: string[];\n};\n\n// --- GitHub ---------------------------------------------------------------------\n\nexport type GitHubRepository = {\n id: number;\n installationId: number;\n fullName: string;\n name: string;\n private: boolean;\n htmlUrl: string;\n cloneUrl: string;\n defaultBranch: string;\n accountLogin: string;\n accountType: string | null;\n /** GitHub's archived flag, when the provider reported it. */\n archived?: boolean | undefined;\n /** GitHub's reported size in kilobytes, when reported. Zero means empty. */\n sizeKb?: number | undefined;\n};\n\nexport type GitHubRepositoryScope = \"all\" | \"selected\";\n\nexport type GitHubBindingStatus = \"disabled\" | \"unbound\" | \"bound\";\n\nexport type GitHubAppSetupMode = \"platform\" | \"operator\";\n\nexport type GitHubInstallationLifecycle = \"active\" | \"suspended\" | \"deleted\" | \"unverified\";\n\nexport type GitHubInstallationBinding = {\n installationId: number;\n githubAccountId: number | null;\n accountLogin: string | null;\n accountType: string | null;\n lifecycle: GitHubInstallationLifecycle;\n repositoryScope: GitHubRepositoryScope;\n repositoryCount: number;\n /** Opengeni-owned entry point for changing the installation's repository allowlist. */\n configureUrl: string | null;\n createdAt: string;\n updatedAt: string;\n};\n\nexport type GitHubAppInfo = {\n configured: boolean;\n /** Truthful workspace binding state; server App credentials alone are not a binding. */\n status: GitHubBindingStatus;\n /** Platform deployments expose installation only; operator deployments may create an App. */\n setupMode: GitHubAppSetupMode;\n appId: string | null;\n clientId: string | null;\n appSlug: string | null;\n /** Fresh OAuth-first existing-installation discovery and install entry point. */\n installUrl: string | null;\n /** Compatibility alias for installUrl. */\n linkUrl: string | null;\n /** Installation bindings owned independently by this workspace. */\n installations: GitHubInstallationBinding[];\n /** Setting names still missing when `configured` is false. */\n missing: string[];\n};\n\nexport type GitHubRepositoriesResponse = {\n repositories: GitHubRepository[];\n};\n\nexport type GitHubActionPolicyDecision = \"allow\" | \"ask\" | \"block\";\nexport type GitHubActionPolicyEffectiveDecision = GitHubActionPolicyDecision | \"mixed\";\nexport type GitHubActionPolicyGroup = \"routine\" | \"review\" | \"merge\";\n\nexport type GitHubActionPolicyActor =\n | { kind: \"workspace_app\"; installationId: number }\n | { kind: \"personal\"; connectionId: string };\n\nexport type GitHubActionPolicyActorState = GitHubActionPolicyActor & {\n label: string;\n groups: Record<GitHubActionPolicyGroup, GitHubActionPolicyEffectiveDecision>;\n};\n\nexport type GitHubActionPoliciesResponse = {\n enabled: boolean;\n actors: GitHubActionPolicyActorState[];\n};\n\nexport type UpdateGitHubActionPolicyRequest = {\n actor: GitHubActionPolicyActor;\n group: GitHubActionPolicyGroup;\n decision: GitHubActionPolicyDecision;\n};\n\nexport type VerifyPublicGitHubRepositoryRefRequest = {\n url: string;\n ref: string;\n};\n\nexport type VerifyPublicGitHubRepositoryRefResponse = {\n owner: string;\n name: string;\n fullName: string;\n canonicalUrl: string;\n cloneUrl: string;\n defaultBranch: string;\n ref: string;\n commitSha: string;\n};\n\nexport type GitHubRepositoryBranch = {\n name: string;\n isDefault: boolean;\n};\n\nexport type ListGitHubRepositoryBranchesOptions = {\n cursor?: number | undefined;\n limit?: number | undefined;\n};\n\nexport type GitHubRepositoryBranchesResponse = {\n branches: GitHubRepositoryBranch[];\n nextCursor: number | null;\n};\n\nexport type CreateGitHubAppManifestRequest = {\n appName?: string | undefined;\n organization?: string | undefined;\n public?: boolean | undefined;\n includeCiPermissions?: boolean | undefined;\n};\n\nexport type CreateGitHubAppManifestResponse = {\n /** GitHub URL to POST the manifest to (personal or organization flow). */\n actionUrl: string;\n state: string;\n manifest: Record<string, unknown>;\n};\n\n// --- Billing --------------------------------------------------------------------\n\nexport type BillingMode = \"disabled\" | \"stripe\";\n\nexport type EntitlementsMode = \"none\" | \"static\" | \"managed\";\n\nexport type PromotionalCreditScope = {\n label: string;\n eligibleModelIds: string[];\n};\n\nexport type PromotionalCreditBalance = PromotionalCreditScope & {\n grantId: string;\n remainingMicros: number;\n /** Also pays for dictation and live voice, like general credits (signup credits). */\n coversVoice?: boolean | undefined;\n /** Monthly scoped allowance; allocated before other promotions. */\n planCredit?: boolean | undefined;\n /** Free funding unavailable for new admission under an active promotion hold. */\n held?: boolean | undefined;\n};\n\nexport type {\n BillingPlanBalance,\n SubscriptionPlan,\n SubscriptionPlanCatalog,\n BillingSubscriptionCatalog,\n CreateSubscriptionCheckoutRequest,\n CreateSubscriptionCheckoutResponse,\n ChangeBillingSubscriptionRequest,\n CancelBillingSubscriptionRequest,\n BillingSubscriptionChange,\n} from \"@opengeni/contracts\";\nimport type { BillingPlanBalance } from \"@opengeni/contracts\";\n\nexport type BillingBalance = {\n accountId: string;\n balanceMicros: number;\n currency: \"usd\";\n updatedAt: string;\n generalBalanceMicros?: number | undefined;\n /** Credits outside plan credit (top-ups, operator grants). API usage spends only this. */\n creditsMicros?: number | undefined;\n /** Credit debt from API usage. Plan credit never repays it. */\n apiDebtMicros?: number | undefined;\n /** Paid plan credit the own-key platform fee may draw (app use only). */\n paidPlanCreditMicros?: number | undefined;\n /** Paid-for credits the own-key platform fee may draw. */\n paidCreditsMicros?: number | undefined;\n /** Own-key platform fees charged this calendar month (UTC). */\n byokPlatformFeeMonthMicros?: number | undefined;\n /** Own-key fees that ran past paid credit; the next top-up repays it. */\n byokFeeDebtMicros?: number | undefined;\n promotionalCredits?: PromotionalCreditBalance[] | undefined;\n heldCreditMicros?: number | undefined;\n heldGeneralCreditMicros?: number | undefined;\n promotionDecision?: \"eligible\" | \"verification_required\" | \"held\" | \"denied\" | undefined;\n plan?: BillingPlanBalance | null | undefined;\n};\n\nexport const KNOWN_USAGE_EVENT_TYPES = [\n \"agent_run.created\",\n \"agent_run.completed\",\n \"model.tokens\",\n \"model.cost\",\n \"file.uploaded\",\n \"file.deleted\",\n \"document.indexed\",\n \"scheduled_task.fired\",\n \"knowledge_source_sync.fired\",\n \"knowledge_source_sync.completed\",\n \"knowledge_source_sync.items\",\n \"knowledge_source_sync.bytes\",\n \"api_key.request\",\n // sandbox warm-time metering (P2.1) — mirrors contracts UsageEventType.\n \"sandbox.warm_seconds\",\n \"sandbox.warm_cost\",\n] as const;\n\nexport type KnownUsageEventType = (typeof KNOWN_USAGE_EVENT_TYPES)[number];\n\nexport type UsageEventType = KnownUsageEventType | (string & {});\n\nexport type UsageEvent = {\n id: string;\n workspaceId: string;\n accountId: string;\n subjectId: string | null;\n eventType: UsageEventType;\n quantity: number;\n unit: string;\n sourceResourceType: string | null;\n sourceResourceId: string | null;\n idempotencyKey: string;\n occurredAt: string;\n recordedAt: string;\n exportedToBillingAt: string | null;\n billingProviderEventId: string | null;\n};\n\nexport type EntitlementValue = boolean | string | number | string[];\n\nexport type Entitlements = Record<string, EntitlementValue>;\n\nexport type BillingSummary = {\n mode: BillingMode;\n balance: BillingBalance;\n};\n\nexport type BillingUsageResponse = {\n balance: BillingBalance;\n usage: UsageEvent[];\n};\n\nexport type InsightsRange = \"today\" | \"week\" | \"month\" | \"ytd\";\n\nexport type InsightsBillingPath = \"opengeni_credits\" | \"external\";\n\nexport type InsightsPricingSource = \"configured_list_price\" | \"gateway_reported\";\n\nexport type InsightsModelUsageRow = {\n id: string;\n model: string;\n provider: string;\n billing: InsightsBillingPath;\n calls: number;\n inputTokens: number;\n outputTokens: number;\n cachedTokens: number;\n cacheInputTokens: number;\n cacheWriteTokens: number;\n reasoningTokens: number;\n totalTokens: number;\n tokenKnownCalls: number;\n cacheKnownCalls: number;\n creditUsd: number;\n estimatedProviderUsd: number;\n estimatedProviderCostKnownCalls: number;\n equivalentCreditUsd: number;\n equivalentCreditCostKnownCalls: number;\n};\n\nexport type InsightsSeriesPoint = {\n label: string;\n modelCostUsd: number;\n estimatedProviderUsd: number;\n estimatedProviderCostKnownCalls: number;\n equivalentCreditUsd: number;\n equivalentCreditCostKnownCalls: number;\n warmSeconds: number;\n inputTokens: number;\n outputTokens: number;\n cachedTokens: number;\n cacheInputTokens: number;\n cacheWriteTokens: number;\n reasoningTokens: number;\n totalTokens: number;\n tokenKnownCalls: number;\n cacheKnownCalls: number;\n cacheHitPct: number;\n calls: number;\n};\n\nexport type InsightsScope = {\n rootSessionId: string | null;\n sessionId: string | null;\n};\n\nexport type InsightsDepthBucket = {\n depth: number;\n sessions: number;\n};\n\nexport type InsightsModelFacet = {\n provider: string;\n model: string;\n};\n\nexport type InsightsSpendDriver = {\n id: string;\n groupBy: \"root_session\" | \"schedule\";\n label: string;\n creditUsd: number;\n estimatedProviderUsd: number;\n estimatedProviderCostKnownCalls: number;\n equivalentCreditUsd: number;\n equivalentCreditCostKnownCalls: number;\n tokens: number;\n cacheHitPct: number;\n pctOfCreditUsd: number;\n pctOfTokens: number;\n deltaUsdVsPrior: number;\n};\n\nexport type InsightsProjectRow = {\n id: string;\n kind: \"project\" | \"other\" | \"unfiled\" | \"unavailable\" | \"deleted\";\n label: string;\n projects: number;\n rootSessions: number;\n calls: number;\n creditUsd: number;\n estimatedProviderUsd: number;\n estimatedProviderCostKnownCalls: number;\n tokens: number;\n cacheHitPct: number | null;\n};\n\nexport type InsightsWarmGroupRow = {\n id: string;\n groupId: string;\n label: string;\n backend: string | null;\n warmSeconds: number;\n sessionsAttached: number;\n};\n\nexport type InsightsLiveWarmLease = {\n id: string;\n groupId: string;\n backend: string;\n turnHolders: number;\n viewerHolders: number;\n warmForLabel: string;\n warmSeconds: number;\n};\n\nexport type InsightsFloorSession = {\n id: string;\n title: string;\n state: \"running\" | \"paused\" | \"failed\" | \"idle\" | \"compacting\" | \"waiting\";\n depth: number;\n model: string | null;\n provider: string | null;\n ageLabel: string;\n cacheHitPct: number | null;\n route: string | null;\n};\n\nexport type InsightsScheduleRow = {\n id: string;\n name: string;\n fires: number;\n creditUsd: number | null;\n estimatedProviderUsd: number | null;\n estimatedProviderCostKnownCalls: number | null;\n equivalentCreditUsd: number | null;\n equivalentCreditCostKnownCalls: number | null;\n tokens: number | null;\n cacheHitPct: number | null;\n billing: InsightsBillingPath | null;\n};\n\nexport type InsightsModelCallRow = {\n id: string;\n occurredAt: string;\n recordedAt: string;\n sessionId: string;\n sessionTitle: string;\n turnId: string;\n provider: string;\n providerApi: string;\n model: string;\n billing: InsightsBillingPath;\n inputTokens: number | null;\n outputTokens: number | null;\n cachedTokens: number | null;\n cacheWriteTokens: number | null;\n reasoningTokens: number | null;\n totalTokens: number | null;\n creditUsd: number;\n estimatedProviderUsd: number | null;\n equivalentCreditUsd: number | null;\n pricingSource: InsightsPricingSource | null;\n};\n\nexport type ModelContextContributionSource =\n | \"workspace_instruction_policy\"\n | \"legacy_workspace_instructions\"\n | \"preference_registry_descriptor\"\n | \"company_profile\"\n | \"legacy_memory_v1\"\n | \"runtime_skill_catalog\";\n\nexport type InsightsPromptContributionRow = {\n source: ModelContextContributionSource;\n items: number;\n utf8Bytes: number;\n estimatedTokens: number;\n calls: number;\n};\n\nexport type InsightsPromptContributions = {\n estimatedTokens: number;\n utf8Bytes: number;\n coveredCalls: number;\n totalCalls: number;\n sources: InsightsPromptContributionRow[];\n};\n\nexport type WorkspaceInsightsSnapshot = {\n range: InsightsRange;\n rangeLabel: string;\n priorLabel: string;\n seriesLabel: string;\n cacheSeriesLabel: string;\n windowStart: string;\n windowEnd: string;\n generatedAt: string;\n timezone: \"UTC\";\n models: InsightsModelUsageRow[];\n facets: InsightsModelFacet[];\n series: InsightsSeriesPoint[];\n depth: InsightsDepthBucket[];\n drivers: InsightsSpendDriver[];\n projects: InsightsProjectRow[];\n privateChats: {\n ownerKey: string;\n name: string | null;\n you: boolean;\n calls: number;\n tokens: number;\n creditUsd: number;\n estimatedProviderUsd: number;\n estimatedProviderCostKnownCalls: number;\n }[];\n privateChatsTruncated: boolean;\n schedules: InsightsScheduleRow[];\n recentCalls: InsightsModelCallRow[];\n promptContributions: InsightsPromptContributions;\n warmSeconds: number;\n priorWarmSeconds: number;\n warmGroups: InsightsWarmGroupRow[];\n liveWarm: InsightsLiveWarmLease[];\n floor: InsightsFloorSession[];\n selfhostedEnabled: boolean;\n machinesOnline: number;\n workspaceCreditUsd: number;\n priorWorkspaceCreditUsd: number;\n creditUsd: number;\n priorCreditUsd: number;\n estimatedProviderUsd: number;\n priorEstimatedProviderUsd: number;\n estimatedProviderCostKnownCalls: number;\n priorEstimatedProviderCostKnownCalls: number;\n equivalentCreditUsd: number;\n priorEquivalentCreditUsd: number;\n equivalentCreditCostKnownCalls: number;\n priorEquivalentCreditCostKnownCalls: number;\n modelCalls: number;\n priorInputTokens: number;\n priorTotalTokens: number;\n priorCacheHitPct: number;\n priorCalls: number;\n goalsActive: number;\n goalsCompleted: number;\n sessionsTouched: number;\n rootSessions: number;\n deepestDepth: number;\n deepestSessionTitle: string;\n avgDepth: number;\n warmIdleNow: number;\n billableTokensUsed: number;\n billableTokenCap: number | null;\n agentRunsUsed: number;\n agentRunCap: number | null;\n modelFilterActive: boolean;\n dataThrough: string | null;\n cacheHitPct: number;\n scope: InsightsScope;\n driverGroups: number;\n driversTruncated: boolean;\n facetsTruncated: boolean;\n recentCallsTruncated: boolean;\n};\n\nexport type WorkspaceInsightsResponse = {\n snapshot: WorkspaceInsightsSnapshot;\n};\n\nexport type BillingEntitlementsResponse = {\n accountId: string;\n mode: EntitlementsMode;\n entitlements: Entitlements;\n};\n\nexport type CreateCheckoutRequest = {\n accountId?: string | undefined;\n /**\n * USD amount with cent precision (server enforces min/max). Required unless\n * `promotionCode` is given; a fixed-amount USD code then sets the amount.\n */\n amountUsd?: number | undefined;\n /** A Stripe promotion code to apply up front, as the customer typed it. */\n promotionCode?: string | undefined;\n successUrl?: string | undefined;\n cancelUrl?: string | undefined;\n};\n\nexport type CreateCheckoutResponse = {\n checkoutSessionId: string;\n url: string;\n /** The credits this checkout grants once it completes. */\n amountUsd?: number | undefined;\n promotionalScope?: PromotionalCreditScope | undefined;\n};\n\n/** Where one checkout stands, and whether its credits reached the balance. */\nexport type BillingCheckoutStatus = {\n checkoutSessionId: string;\n status: \"open\" | \"complete\" | \"expired\";\n credit: {\n state: \"pending\" | \"granted\";\n amountMicros: number;\n currency: \"usd\";\n /** True when a coupon covered the whole checkout, so nothing was charged. */\n free: boolean;\n promotionalScope?: PromotionalCreditScope | undefined;\n };\n balance: BillingBalance | null;\n};\n\nexport type CreateBillingPortalRequest = {\n accountId?: string | undefined;\n returnUrl?: string | undefined;\n};\n\nexport type CreateBillingPortalResponse = {\n portalSessionId: string;\n url: string;\n};\n\nexport type UserMessageEventInput = {\n type: \"user.message\";\n clientEventId?: string | undefined;\n payload: {\n text: string;\n annotations?: SubmittedTimelineAnnotation[] | undefined;\n modelContext?: string | undefined;\n /**\n * IANA time zone of the person sending the message (for example\n * `Europe/Oslo`), so the model sees the message's local time. In a\n * browser or app the client fills in the device's zone when this is\n * omitted; invalid names are dropped.\n */\n timeZone?: string | undefined;\n resources?: ResourceRef[] | undefined;\n model?: string | undefined;\n reasoningEffort?: ReasoningEffort | undefined;\n latencyMode?: LatencyMode | undefined;\n controlEtag?: string | undefined;\n expectedDraftRevision?: number | undefined;\n mcpCredentialUpdates?: SessionMcpCredentialUpdateInput[] | undefined;\n connectionAccounts?: McpConnectionAccountSelection[] | undefined;\n personalResourceAttachment?: PersonalResourceAttachmentIntent | undefined;\n };\n};\n\n/**\n * Stable fields of each `session.requiresAction` `payload.approvals[]` entry.\n * Entries also carry producer-specific compatibility fields (`rawItem` on a\n * turn's first pause, `raw` on later ones); read only these three. Events\n * written before these fields existed need `approvalsFromRequiresAction`\n * from `@opengeni/react` or `approvalIdentifier` from `@opengeni/contracts`.\n */\nexport type SessionApprovalRequest = {\n /** Pass as `sendApprovalDecision({ approvalId })`; this is the tool call id. */\n id: string;\n /** Model-visible tool name, for example `crm__update_record`. */\n name: string;\n /** Tool arguments as the model produced them (usually a JSON string). */\n arguments: unknown;\n /**\n * Present when the tool's MCP server stopped mid-call to ask the person\n * (form elicitation). Approving sends `elicitationRound: elicitation.round`\n * and the answers as `content`, keyed by `requests[].id` and then by field\n * name; omitted fields take the form's defaults. Rejecting tells the server\n * the person declined.\n */\n elicitation?: McpElicitationApprovalRequest | undefined;\n [compatibilityField: string]: unknown;\n};\n\nexport type UserApprovalDecisionEventInput = {\n type: \"user.approvalDecision\";\n clientEventId?: string | undefined;\n payload: {\n /** `session.requiresAction` `approvals[].id` (the pending tool call id). */\n approvalId: string;\n decision: \"approve\" | \"reject\";\n message?: string | undefined;\n /** Answers to the approval's `elicitation` forms; only with `approve`. */\n content?: McpElicitationContent | undefined;\n /** The `elicitation.round` an approval answers; required to approve one. */\n elicitationRound?: number | undefined;\n /** Server-owned header rotation applied atomically when the response is accepted. */\n mcpCredentialUpdates?: SessionMcpCredentialUpdateInput[] | undefined;\n };\n};\n\nexport type UserHumanInputResponseEventInput = {\n type: \"user.humanInputResponse\";\n clientEventId?: string | undefined;\n payload: {\n requestId: string;\n response: SubmitHumanInputResponseRequest;\n /** Server-owned header rotation applied atomically when the response is accepted. */\n mcpCredentialUpdates?: SessionMcpCredentialUpdateInput[] | undefined;\n };\n};\n\n/** Control/user events a client may POST to a session's event log. */\nexport type ClientSessionEventInput =\n | UserMessageEventInput\n | UserApprovalDecisionEventInput\n | UserHumanInputResponseEventInput;\n\n// ── Bring-your-own-compute: Machines dashboard + per-machine metrics (M10) ────\n// Hand-written mirrors of the `@opengeni/contracts` MetricSample / MachineView /\n// MachinesResponse / MachineMetricsSeriesResponse (pinned by contract-parity).\n// M9 imports THESE so the dashboard UI never drifts from the API.\n\n/** A point-in-time machine metrics sample. `gpuUtilPct`/`gpuMemBytes` are null\n * when no GPU was present (not-reported, never a real zero); the bytes/load are\n * numbers; `sampledAt` is an ISO-8601 instant. */\nexport type MetricSample = {\n cpuPct: number;\n load1: number;\n load5: number;\n load15: number;\n memUsedBytes: number;\n memTotalBytes: number;\n diskUsedBytes: number;\n diskTotalBytes: number;\n gpuUtilPct: number | null;\n gpuMemBytes: number | null;\n runQueue: number;\n sampledAt: string;\n};\n\n/** The derived dashboard state of a machine (M3 liveness + consent/display\n * reasons + the in-flight device-flow). */\nexport type MachineState =\n | \"online\"\n | \"reconnecting\"\n | \"offline\"\n | \"consent_required\"\n | \"display_unavailable\"\n | \"enrolling\";\n\nexport type MachineKind =\n | \"docker\"\n | \"modal\"\n | \"local\"\n | \"daytona\"\n | \"runloop\"\n | \"e2b\"\n | \"blaxel\"\n | \"cloudflare\"\n | \"vercel\"\n | \"selfhosted\"\n | \"opensandbox\"\n | \"compute\";\n\nexport type MachineConnectionAuthority = {\n state: \"not_applicable\" | \"unclaimed\" | \"active\" | \"expired\";\n generation: number;\n supersededCount: number;\n leaseExpiresAt: string | null;\n duplicateRunnerDeniedCount: number;\n duplicateRunnerDeniedAt: string | null;\n authenticationError?: \"credentials_expired\" | null | undefined;\n};\n\nexport type MachineRuntimeCapabilities = {\n exec: boolean;\n filesystem: boolean;\n git: boolean;\n pty: boolean;\n desktop: boolean;\n opStream: boolean;\n browserBridge: boolean;\n operationResourcePolicy: boolean;\n operationCpuQuota: boolean;\n transactionalFsWrite: boolean;\n /** The agent renews its credentials on request, so screen control turns on in place. */\n credentialRenew: boolean;\n /** The live agent's credentials carry screen-control consent; null when unknown. */\n screenControl: boolean | null;\n};\n\n/** The three macOS Privacy & Security grants desktop capture and input need. */\nexport type MachineMacPermissions = {\n screenRecording: boolean;\n accessibility: boolean;\n inputMonitoring: boolean;\n};\n\nexport type MachineUpdateStatus =\n | \"requested\"\n | \"accepted\"\n | \"waiting_for_idle\"\n | \"downloading\"\n | \"verifying\"\n | \"applying\"\n | \"restarting\"\n | \"succeeded\"\n | \"failed\";\n\nexport type MachineUpdateState = {\n operationId: string;\n status: MachineUpdateStatus;\n targetVersion: string;\n expectedBinarySha256: string | null;\n errorCode: string | null;\n blockers?: Array<{ kind: string; count: number }> | undefined;\n retryable: boolean;\n rolledBack: boolean;\n requestedAt: string;\n updatedAt: string;\n completedAt: string | null;\n};\n\nexport type MachineRuntime = {\n installedVersion: string | null;\n binarySha256: string | null;\n updateChannel: \"stable\" | \"beta\" | null;\n desiredVersion: string | null;\n versionState: \"unknown\" | \"current\" | \"outdated\" | \"ahead\" | \"updating\" | \"update_failed\";\n /** Required installer bootstrap when a legacy updater cannot safely replace the install. */\n updateBlockedReason?: string | null | undefined;\n capabilities: MachineRuntimeCapabilities;\n update: MachineUpdateState | null;\n /** Live macOS permissions; null off macOS or when the agent does not report them. */\n macPermissions: MachineMacPermissions | null;\n};\n\nexport type UpdateMachineAgentResponse = {\n operationId: string;\n accepted: boolean;\n targetVersion: string;\n};\n\n/** POST /v1/workspaces/:ws/machines/:enrollmentId/screen-control response.\n * active: on now. pending: allowed, and turns on by itself when the machine\n * reconnects (offline), after its agent update (agent_update_required), or on\n * a retry (renewal_failed). reconnect_required: run the connect command on the\n * machine again. */\nexport type EnableMachineScreenControlResponse = {\n status: \"active\" | \"pending\";\n reason: \"offline\" | \"agent_update_required\" | \"renewal_failed\" | \"reconnect_required\" | null;\n message: string | null;\n};\n\n/** macOS Privacy & Security panes the agent needs for desktop capture/input. */\nexport type MachinePrivacySettingsPane = \"screen_recording\" | \"accessibility\" | \"input_monitoring\";\n\n/** POST /v1/workspaces/:ws/machines/:enrollmentId/privacy-settings body. */\nexport type OpenMachinePrivacySettingsRequest = {\n pane: MachinePrivacySettingsPane;\n};\n\n/** Who can use a Connected Machine: everyone in its workspace, or one person. */\nexport type MachineAudience = \"workspace\" | \"only_me\";\n\n/** POST /v1/workspaces/:ws/machines/:enrollmentId/audience/preview body.\n * `ownerSubjectId` names who owns the machine as Only me (defaults to the\n * caller; naming someone else needs workspace admin). */\nexport type MachineAudiencePreviewRequest = {\n audience: MachineAudience;\n ownerSubjectId?: string;\n};\n\n/** PUT /v1/workspaces/:ws/machines/:enrollmentId/audience body: apply the\n * previewed plan at the generation it was read at. */\nexport type ChangeMachineAudienceRequest = MachineAudiencePreviewRequest & {\n expectedGeneration: number;\n};\n\n/** What the change does to one thing on the machine. `move_off`: the chat\n * leaves the machine (its history and files stay). `keep`: the owner's chat\n * stays. `pause`: another person's schedule that runs on the machine; the new\n * owner's own schedules keep running and are not listed. `make_only_me` is no\n * longer produced. `remove_first`: the same computer is connected a second\n * time. */\nexport type MachineAudienceAction = \"move_off\" | \"keep\" | \"make_only_me\" | \"pause\" | \"remove_first\";\n\n/** One thing an audience change affects. Another member's private chat or\n * schedule is listed without its title or owner. */\nexport type MachineAudienceItem = {\n kind: \"chat\" | \"schedule\" | \"duplicate_connection\";\n action: MachineAudienceAction;\n sessionId: string | null;\n scheduledTaskId: string | null;\n enrollmentId: string | null;\n workspaceId: string | null;\n relation: \"other_member\" | \"owner_shared\" | \"owner_private\" | \"other_workspace\" | null;\n visibility: \"user_private\" | \"workspace_shared\" | null;\n title: string | null;\n ownerSubjectId: string | null;\n /** A running turn in this chat stops for good. */\n stopsTurn: boolean;\n /** Agent commands still running in this chat that stop. */\n stopsCommands: number;\n};\n\n/** Counts of what one change does. */\nexport type MachineAudienceSummary = {\n keptChats: number;\n keptSharedChats: number;\n movedOffChats: number;\n /** No longer produced: always 0. */\n schedulesMadeOnlyMe: number;\n schedulesPaused: number;\n stoppedTurns: number;\n stoppedCommands: number;\n notifiedPeople: number;\n};\n\n/** POST .../audience/preview response: everything one confirmation does.\n * `ready` is false only while the same computer is also connected as a\n * separate machine. */\nexport type MachineAudiencePreview = {\n enrollmentId: string;\n sandboxId: string;\n machineName: string;\n currentAudience: MachineAudience;\n targetAudience: MachineAudience;\n generation: number;\n ownerSubjectId: string | null;\n summary: MachineAudienceSummary;\n items: MachineAudienceItem[];\n ready: boolean;\n};\n\n/** PUT .../audience response. The machine keeps its sandbox ID and connection. */\nexport type ChangeMachineAudienceResponse = {\n enrollmentId: string;\n sandboxId: string;\n previousAudience: MachineAudience;\n audience: MachineAudience;\n ownerSubjectId: string | null;\n generation: number;\n summary: MachineAudienceSummary;\n detachedSessionIds: string[];\n keptSessionIds: string[];\n};\n\n/** POST /v1/workspaces/:ws/machines/:enrollmentId/privacy-settings response. */\nexport type OpenMachinePrivacySettingsResponse = {\n opened: boolean;\n message: string | null;\n};\n\nexport type MachineOperationPolicy = {\n memoryMaxBytes: number | null;\n memoryHighBytes: number | null;\n cpuMaxMillicores: number | null;\n revision: number;\n updatedAt: string | null;\n};\n\nexport type UpdateMachineOperationPolicyRequest = {\n memoryMaxBytes: number | null;\n memoryHighBytes: number | null;\n /** Omitted preserves the current CPU limit for older/partial clients; null clears. */\n cpuMaxMillicores?: number | null;\n expectedRevision: number;\n};\n\n/** A machine as the Machines dashboard renders it (an enrolled selfhosted machine\n * or the session's synthetic Modal group box, `isSessionGroup: true`). */\nexport type MachineView = {\n sandboxId: string;\n enrollmentId: string | null;\n scope: ResourceAuthorityScope;\n generation: number;\n name: string;\n kind: MachineKind;\n state: MachineState;\n active: boolean;\n isSessionGroup: boolean;\n workspaceGeneration: number | null;\n archiveGeneration: number | null;\n archiveComplete: boolean;\n os: string;\n arch: string;\n hasDisplay: boolean;\n /** Non-null only when a display exists but capture is blocked (macOS Screen\n * Recording / TCC not granted) — the UI can surface \"display: capture not\n * granted\". null == capture permitted OR headless. */\n desktopUnavailableReason?: string | null | undefined;\n allowScreenControl: boolean;\n sharedSessionCount: number;\n lastSeenAt: string | null;\n /** Secret-free single-runner authority diagnostics. */\n connectionAuthority: MachineConnectionAuthority;\n /** Exact build/update truth. Null means the runner predates runtime Hello\n * reporting or this is a managed-session group without a connected agent. */\n runtime: MachineRuntime | null;\n /** Explicit per-enrollment command memory policy. Null only for managed\n * session boxes; null limits on a real machine mean unrestricted. */\n operationPolicy: MachineOperationPolicy | null;\n metrics: MetricSample | null;\n /** Where an organization machine works; null for every other machine. */\n reach?: OrganizationComputeReach | null;\n};\n\n/** GET /v1/workspaces/:ws/machines — the dashboard list + the active-sandbox\n * pointer (null activeSandboxId == the session's own group box is active). */\nexport type SessionMachineAccess = {\n sandboxId: string;\n machineName: string;\n ownerName: string | null;\n isOwner: boolean;\n queuedTurnBlocked: boolean;\n /** Results from other people's work (their workers' results and agent\n * messages) waiting because only the machine's owner may start work on it,\n * grouped by whose work it is. Older servers omit it. */\n waitingWork?: SessionWaitingWork[] | undefined;\n /** Messages other people sent here that wait because only the machine's\n * owner may start work on it, grouped by sender. The owner's next message\n * brings them to the agent; moving the chat to a machine the sender may\n * use runs them. Older servers omit it. */\n waitingMessages?: SessionWaitingMessages[] | undefined;\n /** The next saved message is the machine owner's own and was approved for\n * other machines, not this one, so it can't start here and no recheck\n * helps: it runs after the chat moves to a machine it was approved for, or\n * it is removed and sent again here. Older servers omit it. */\n queuedTurnNotApprovedHere?: boolean | undefined;\n /** Where that message may run: the owner's personal machines it was\n * approved for. Listed only for its sender; empty for everyone else. */\n queuedTurnApprovedMachines?: SessionApprovedMachine[] | undefined;\n};\n\nexport type SessionApprovedMachine = {\n sandboxId: string;\n machineName: string;\n};\n\nexport type SessionWaitingMessages = {\n /** The sender's display name, when known. */\n name: string | null;\n /** The caller sent them. */\n isYou: boolean;\n messages: number;\n};\n\nexport type SessionWaitingWork = {\n /** The person's display name, when known. */\n name: string | null;\n /** The waiting results come from the caller's own work. */\n isYou: boolean;\n results: number;\n};\n\n/** POST /v1/workspaces/:ws/sessions/:id/waiting-work/continue */\nexport type ContinueSessionWaitingWorkResponse = {\n /** How many waiting results the agent now continues with under your authority. */\n continued: number;\n};\n\nexport type MachinesResponse = {\n activeSandboxId: string | null;\n activeEpoch: number;\n machines: MachineView[];\n sessionMachineAccess?: SessionMachineAccess | null | undefined;\n /**\n * False when the organization lets only its owners and admins connect new\n * machines of their own: an Only me machine, or any machine in a Personal\n * workspace. Omitted for an agent listing its own chat, and by older servers.\n */\n canConnectOwnMachine?: boolean | undefined;\n};\n\n/** GET /v1/workspaces/:ws/machines/:enrollmentId/metrics/series — the downsampled\n * (~1/min) history the dashboard time-range reads. */\nexport type MachineMetricsSeriesResponse = {\n samples: MetricSample[];\n};\n\n/** POST /v1/workspaces/:ws/enrollments/:id/revoke body. */\nexport type RemoveEnrollmentRequest = {\n expectedUpdatedAt?: string;\n idempotencyKey?: string;\n};\n\n/** Typed removal/revocation outcome. Blocked outcomes preserve the exact\n * dependency and the action needed to make removal safe. */\nexport type RemoveEnrollmentResponse = {\n revoked: boolean;\n outcome: \"removed\" | \"already_removed\" | \"blocked\";\n enrollmentId: string;\n machineName: string | null;\n lastSeenAt: string | null;\n revokedAt: string | null;\n code:\n | \"active_route\"\n | \"active_commands\"\n | \"machine_home\"\n | \"active_lease\"\n | \"recovery_pending\"\n | \"not_selfhosted\"\n | null;\n message: string;\n action: string;\n dependentSessions: Array<{ id: string; title: string | null }>;\n};\n\n/** POST /v1/workspaces/:ws/sessions/:sessionId/active-sandbox — swap a session's\n * active sandbox. `target` is a `MachineView.sandboxId`, or \"session\"/\"default\"\n * to swap back to the session's own group box. */\nexport type SwapActiveSandboxRequest = {\n target: string;\n};\n\n/** The swap outcome (mirrors the server `FleetSwapResult`). `swapped` is true on a\n * successful repoint OR a no-op (already there); `reason` carries the failure\n * detail (unowned/offline target, or a lost epoch fence) when false. */\nexport type SwapActiveSandboxResponse = {\n swapped: boolean;\n activeSandboxId: string | null;\n activeEpoch: number;\n reason?: string;\n // Typed rejection discriminant (issue #341); present only when swapped is false.\n // Mirror of the `@opengeni/contracts` SwapActiveSandboxResponse.code enum.\n code?:\n | \"stale_pointer\"\n | \"offline_enrollment\"\n | \"unsupported_backend_context\"\n | \"transient_establishment\"\n | \"home_unavailable_this_turn\"\n | \"workspace_root_unavailable\"\n | \"invalid_working_directory\"\n | \"concurrent_swap\"\n | \"personal_machine_permission_required\"\n | \"personal_machine_not_permitted\"\n | \"recovery_in_progress\"\n | \"recovery_degraded\"\n | \"recovery_unrecoverable\";\n};\n\n// ── Self-hosted enrollment UX (design 11) ────────────────────────────────────\n// Hand-written mirrors of the `@opengeni/contracts` enrollment-UX request/response\n// shapes. They remain type-only so ordinary SDK entries do not reach the contracts\n// runtime. The click-Grant approve-page lookup/deny + the headless enroll-token\n// mint/exchange.\n\n/** Mirror of `@opengeni/contracts` EnrollmentOs. */\nexport type EnrollmentOs = \"linux\" | \"macos\" | \"windows\";\nexport type ResourceAuthorityScope = \"organization\" | \"workspace\" | \"user\";\n\n/** POST /v1/enrollments/device/lookup body. */\nexport type DeviceEnrollmentLookupRequest = {\n userCode: string;\n};\n\n/** The presentational machine details the consent screen renders. */\nexport type DeviceEnrollmentLookupMachine = {\n machineName: string | null;\n os: EnrollmentOs;\n arch: string;\n canOfferDisplay: boolean;\n requestsScreenControl: boolean;\n};\n\n/** POST /v1/enrollments/device/lookup response (no secrets, no device_code). */\nexport type DeviceEnrollmentLookupResponse = {\n workspaceId: string;\n userCode: string;\n machine: DeviceEnrollmentLookupMachine;\n expiresAt: string;\n};\n\n/** POST /v1/workspaces/:ws/enrollments/device/approve body. */\nexport type DeviceEnrollmentApproveRequest = {\n userCode: string;\n allowScreenControl?: boolean;\n scope?: ResourceAuthorityScope;\n};\n\n/** POST /v1/workspaces/:ws/enrollments/device/approve response. */\nexport type DeviceEnrollmentApproveResponse = {\n approved: boolean;\n enrollmentId: string;\n sandboxId: string;\n allowScreenControl: boolean;\n};\n\n/** POST /v1/workspaces/:ws/enrollments/device/deny body. */\nexport type DeviceEnrollmentDenyRequest = {\n userCode: string;\n};\n\n/** POST /v1/workspaces/:ws/enrollments/device/deny response. */\nexport type DeviceEnrollmentDenyResponse = {\n denied: boolean;\n};\n\n/** POST /v1/workspaces/:ws/enrollments/token body. */\nexport type MintEnrollTokenRequest = {\n allowScreenControl?: boolean;\n /**\n * Who can use the machine. `user` makes it the signed-in caller's own\n * machine (requires a verified person: someone signed in, or a credential\n * acting as them, such as a personal API key or an organization key acting\n * `asUser`; a key, service or agent acting as itself gets 422); `workspace`\n * shares it with this workspace's members. Omitted mints the original\n * workspace-shared token.\n */\n scope?: EnrollTokenScope;\n};\n\n/** Who can use a machine connected with an enroll token. */\nexport type EnrollTokenScope = \"user\" | \"workspace\";\n\n/** POST /v1/workspaces/:ws/enrollments/token response. The `token` is SECRET. */\nexport type MintEnrollTokenResponse = {\n token: string;\n expiresAt: string;\n expiresInSeconds: number;\n /** What the token grants. Absent from servers that predate scoped tokens,\n * which always mint workspace-shared tokens. */\n scope?: EnrollTokenScope;\n allowScreenControl?: boolean;\n};\n\n/** The credential payload the headless exchange returns (a subset of the agent's\n * EnrollmentCredentials — IDENTICAL to the device-flow poll authorized branch). */\nexport type EnrollmentCredentials = {\n agentId: string;\n workspaceId: string;\n bearer: string;\n subjectPrefix: string;\n natsUrls: string[];\n relayUrl: string;\n relayToken: string;\n natsAccountCreds: string;\n updatePublicKey: string;\n consentedWholeMachine: boolean;\n consentedScreenControl: boolean;\n};\n\n/** POST /v1/enrollments/token/exchange body (the headless / fleet enroll path). */\nexport type EnrollTokenExchangeRequest = {\n token: string;\n publicKey: string;\n os?: EnrollmentOs;\n arch?: string;\n machineName?: string;\n exposure?: \"whole-machine\";\n canOfferDisplay?: boolean;\n requestsScreenControl?: boolean;\n};\n\n/** POST /v1/enrollments/token/exchange response (wraps the credential shape). */\nexport type EnrollTokenExchangeResponse = {\n credentials: EnrollmentCredentials;\n};\n\nexport type ModelConnectionAccessPolicy = {\n allowedModels: string[] | null;\n /**\n * The shared workspaces that may use the account; null for every shared\n * workspace, including new ones. A workspace's own account always keeps\n * serving its workspace. On a workspace's own route this is the list of\n * workspaces it serves, and only workspaces the caller also administers\n * can be added.\n */\n allowedWorkspaces: string[] | null;\n allowPersonalWorkspaces: boolean;\n /**\n * The chosen people (organization membership ids), or null when the account\n * is not limited to people. Requires `allowedWorkspaces: []` and\n * `allowPersonalWorkspaces: false`.\n */\n allowedPeople?: string[] | null;\n /** Explicit owner consent to share a personal subscription with the organization. */\n sharePersonal?: true;\n /**\n * Explicit consent to make a workspace's own account the organization's, so\n * that workspace's admins no longer manage it. Required on the organization\n * route before it can serve every shared workspace, Personal workspaces or\n * chosen people.\n */\n moveToOrganization?: true;\n version: number;\n};\nexport type ModelConnectionAccessResponse = {\n policy: ModelConnectionAccessPolicy;\n models: Array<{ id: string; label: string }>;\n workspaces: Array<{ id: string; name: string }>;\n personalWorkspacesSupported: boolean;\n /** The account can be limited to chosen people. */\n peopleSupported?: boolean;\n /** Active members of the organization an administrator can choose. */\n people?: Array<{ id: string; name: string | null; email: string | null }>;\n /** Workspaces that use the account as their own; they always keep it for workspace choices. */\n localWorkspaceIds?: string[];\n /** The workspace whose administrators also manage the account, if any. */\n managedByWorkspaceId?: string | null;\n personalSharingSupported?: boolean;\n};\n\nexport type ConnectorToolPermission = \"allow\" | \"ask\" | \"block\";\nexport type ConnectorToolPermissionEntry = {\n name: string;\n title?: string | undefined;\n description?: string | undefined;\n group: \"read\" | \"write\" | \"other\";\n permission: ConnectorToolPermission;\n inherited: boolean;\n approvalRequired: boolean;\n source?: \"recommended\" | \"connector_default\" | \"tool\" | \"action\" | \"conflict\";\n conditional?: boolean;\n actionPermissions?: Array<{\n actionName: string;\n permission: ConnectorToolPermission;\n }>;\n};\nexport type ConnectorToolPermissionsResponse = {\n connectionId: string;\n serverId: string;\n defaultPermission: ConnectorToolPermission | null;\n tools: ConnectorToolPermissionEntry[];\n discoveryError: string | null;\n canManage: boolean;\n appliesTo?: \"next_attempt\";\n revision?: string;\n accountLabel?: string;\n instanceKey?: string;\n accounts?: Array<{\n connectionId: string;\n label: string;\n scope: \"personal\" | \"workspace\" | \"none\";\n instanceKey?: string;\n }>;\n};\nexport type UpdateConnectorToolPermissionsRequest = {\n connectionId: string;\n permission: ConnectorToolPermission | null;\n expectedRevision?: string;\n instanceKey?: string;\n} & (\n | { target: \"default\" }\n | { target: \"tools\"; toolNames: string[] }\n | { target: \"action\"; toolName: string; actionName: string }\n);\n\n/** Saved Allow/Ask/Block rules for a session MCP server the host attaches.\n * Tools without a rule follow `defaultPermission`, then the attaching session's\n * `requireApproval` recommendation (Ask), then Allow. */\nexport type SessionMcpToolPermissionsResponse = {\n connectionId: string;\n serverId: string;\n defaultPermission: ConnectorToolPermission | null;\n tools: Array<{ toolName: string; permission: ConnectorToolPermission }>;\n revision: string;\n canManage: boolean;\n appliesTo: \"next_attempt\";\n};\n/** `url` is the exact URL attached to sessions; `permission: null` resets. */\nexport type UpdateSessionMcpToolPermissionsRequest = {\n serverId: string;\n url: string;\n permission: ConnectorToolPermission | null;\n expectedRevision?: string;\n} & ({ target: \"default\" } | { target: \"tools\"; toolNames: string[] });\n\n/** Agent capability ids (see `@opengeni/contracts` agent-config). */\nexport type AgentCapabilityId =\n | \"webSearch\"\n | \"humanInput\"\n | \"skills\"\n | \"goals\"\n | \"subagents\"\n | \"knowledge\"\n | \"schedules\"\n | \"artifacts\"\n | \"browser\"\n | \"secrets\"\n | \"media\"\n | \"workspaceFiles\"\n | \"workspaceConnectors\"\n | \"workspaceAdmin\";\n\n/** `read` reads installed Skills; `manage` also changes them. */\nexport type AgentSkillsCapability = \"read\" | \"manage\" | false;\n\nexport type AgentCapabilityToggles = {\n webSearch?: boolean | undefined;\n humanInput?: boolean | undefined;\n skills?: AgentSkillsCapability | undefined;\n goals?: boolean | undefined;\n subagents?: boolean | undefined;\n knowledge?: boolean | undefined;\n schedules?: boolean | undefined;\n artifacts?: boolean | undefined;\n browser?: boolean | undefined;\n secrets?: boolean | undefined;\n media?: boolean | undefined;\n workspaceFiles?: boolean | undefined;\n workspaceConnectors?: boolean | undefined;\n workspaceAdmin?: boolean | undefined;\n};\n\n/**\n * `\"all\"`: everything this workspace offers (today's behavior). `\"none\"`: the\n * session's own tools plus essentials. An object starts from one and toggles.\n */\nexport type AgentCapabilities =\n | \"all\"\n | \"none\"\n | ({ from: \"all\" | \"none\" } & AgentCapabilityToggles);\n\nexport type AgentRenderer = \"opengeni\" | \"markdown\";\n\nexport type AgentConfigRequest = {\n capabilities?: AgentCapabilities | undefined;\n /** Replaces only Opengeni's identity lines (max 8,000 chars); null = default identity. */\n identity?: string | null | undefined;\n /** Alias of the session `instructions` field. */\n instructions?: string | undefined;\n renderer?: AgentRenderer | undefined;\n /** Vaults this session may use (input only); intersected with the parent's policy. */\n vaultPolicy?: VaultPolicy | undefined;\n};\n\n/** Which vaults a session or schedule may use (see `@opengeni/contracts` VaultPolicy). */\nexport type VaultPolicy = { mode: \"all\" } | { mode: \"selected\"; vaultIds: string[] };\n\nexport type WorkspaceAgentDefaults = {\n capabilities?: AgentCapabilities | undefined;\n identity?: string | null | undefined;\n renderer?: AgentRenderer | undefined;\n};\n\nexport type ResolvedAgentCapabilities = {\n webSearch: boolean;\n humanInput: boolean;\n skills: AgentSkillsCapability;\n goals: boolean;\n subagents: boolean;\n knowledge: boolean;\n schedules: boolean;\n artifacts: boolean;\n browser: boolean;\n secrets: boolean;\n media: boolean;\n workspaceFiles: boolean;\n workspaceConnectors: boolean;\n workspaceAdmin: boolean;\n};\n\nexport type ResolvedAgentConfig = {\n version: 1;\n from: \"all\" | \"none\";\n capabilities: ResolvedAgentCapabilities;\n /** Capabilities wanted on but not offered by this deployment. */\n unavailable: AgentCapabilityId[];\n /** Why each unavailable capability is off; present whenever `unavailable` is non-empty. */\n unavailableReasons?: Partial<Record<AgentCapabilityId, string>> | undefined;\n identity: string | null;\n renderer: AgentRenderer;\n source:\n | \"request\"\n | \"workspace_default\"\n | \"deployment_default\"\n | \"inherited\"\n | \"legacy_conversion\";\n};\n\nexport type AgentEffectiveTools = {\n capabilities: ResolvedAgentCapabilities;\n unavailable: AgentCapabilityId[];\n /** False until exact runtime media adapters (including credential identity) are resolved. */\n mediaToolsKnown?: boolean | undefined;\n tools: Array<{\n name: string;\n capability: AgentCapabilityId | \"runtime\" | \"sandbox\" | \"product\";\n source: \"first_party\" | \"runtime\" | \"hosted\" | \"sandbox\" | \"mcp\";\n visibility?: \"upfront\" | \"search\" | undefined;\n }>;\n mcpServers: Array<{\n id: string;\n capability: AgentCapabilityId | \"runtime\" | \"product\";\n toolsKnown: boolean;\n }>;\n};\n\n/**\n * `PUT .../sessions/:id/skills`. Replaces every Skill the session carries\n * itself; an empty list removes them all.\n */\nexport type UpdateSessionSkillsRequest = {\n skills: SessionSkillInput[];\n /** The session's current `toolPolicyVersion` (shared CAS). */\n expectedVersion: number;\n};\n\n/**\n * `POST .../sessions/:id/resources/remove`. Removes attached repositories from\n * the session and its child sessions. Access ends on the next Git or GitHub\n * call; the next turn removes the repository folders. Repositories that are\n * not attached are ignored.\n */\nexport type RemoveSessionResourcesRequest = {\n resources: Array<{ kind: \"repository\"; uri: string }>;\n};\n\n/** One repository removed from a session (`Session.removedRepositories`). */\nexport type SessionRemovedRepository = {\n id: string;\n resource: RepositoryResourceRef;\n removedAt: string;\n /** True until the next turn has removed the folder from the sandbox. */\n sandboxCleanupPending: boolean;\n};\n\n/** `PUT .../sessions/:id/agent`. Omitted agent fields keep their current values. */\nexport type UpdateSessionAgentRequest = {\n agent: AgentConfigRequest;\n /** The session's current `toolPolicyVersion` (shared CAS). */\n expectedVersion: number;\n};\n\nexport type ClientAgentConfig = {\n /** @deprecated Agent configuration is always on; current servers always report `true`. */\n enabled: boolean;\n /** @deprecated Omitted `agent` always resolves `{ capabilities: \"all\" }`; always `true`. */\n defaultForNewSessions: boolean;\n capabilities: Array<{\n id: AgentCapabilityId;\n available: boolean;\n reason?: string | undefined;\n /** `region_restricted` when EU-only inference switched it off (\"Not supported in EU\"). */\n code?: FeatureUnavailableReason | undefined;\n }>;\n};\n\n/** `error.details.code` of a 422 agent-configuration failure. */\nexport type AgentConfigErrorCode =\n | \"agent_capability_unavailable\"\n | \"agent_config_conflict\"\n | \"agent_config_widening\"\n /** Returned only by older servers that predate always-on agent configuration. */\n | \"agent_config_not_enabled\";\nexport type {\n ToolActionReview,\n ToolReviewDetailsPage,\n ToolReviewStatus,\n} from \"@opengeni/contracts\";\n"],"mappings":";AA+zBO,IAAM,mCAAmC;AA8pDzC,IAAM,kDAAkD;AACxD,IAAM,0CACX;AA2MK,IAAM,sBAAsB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AAAA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA;AAAA;AAAA,EAGA;AAAA,EACA;AAAA,EACA;AACF;AA6eO,IAAM,kCAAkC;AA4xBxC,IAAM,oBAAoB;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAkgDO,IAAM,iCAAiC;AACvC,IAAM,+BAA+B;AAErC,IAAM,8BAA8B;AAm8FpC,IAAM,qCAAqC,MAAM;AACjD,IAAM,iCAAiC,OAAO;AAC9C,IAAM,gCAAgC,KAAK,OAAO;AAClD,IAAM,4BAA4B,KAAK,OAAO;AAC9C,IAAM,4BAA4B,MAAM,OAAO;AAumD/C,IAAM,0BAA0B;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AACF;","names":[]}