@opengeni/sdk 0.28.2 → 0.32.1

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.
@@ -0,0 +1,643 @@
1
+ import { type SessionEventStreamTransport, type StreamSessionEventsOptions } from "./stream";
2
+ import { type WorkspaceControlStreamTransport } from "./workspace-control-stream";
3
+ import type { AccessContext, AddWorkspaceMemberRequest, ApiKey, BillingEntitlementsResponse, CodexAccount, CodexAccountsResponse, CodexRotationSettings, CodexOverviewResponse, CodexAllocatorUpdate, CodexConnectionStatus, CodexConnectPoll, CodexConnectStart, CodexUsage, CodexUsageMap, BillingSummary, BillingUsageResponse, InsightsRange, WorkspaceInsightsResponse, CapabilityCatalogItem, CapabilityCatalogResponse, CapabilityInstallation, AddDocumentRequest, CreateKnowledgeDropRequest, MoveDocumentRequest, ClientConfig, WorkspaceModelCatalogResponse, ClientSessionEventInput, CompactSessionContextResult, ConnectionMetadata, CreateApiKeyRequest, CreateApiKeyResponse, CreateCapabilityCatalogItemRequest, CreateCheckoutRequest, CreateCheckoutResponse, OpenGeniSlackBotInstallRequest, OpenGeniSlackBotInstallStart, CreateConnectionRequest, CreateDocumentBaseRequest, CreateFileUploadRequest, CreateFileUploadResponse, CreateGitHubAppManifestRequest, CreateGitHubAppManifestResponse, CreateKnowledgeMemoryRequest, CreateScheduledTaskRequest, CreateSessionRequest, CreateSessionResponse, CreateVariableSetRequest, CreateRigRequest, CreateWorkspaceRequest, DeviceEnrollmentApproveResponse, DeviceEnrollmentDenyResponse, DeviceEnrollmentLookupResponse, MintEnrollTokenResponse, DiscoverMcpCapabilitiesResponse, Document, DocumentBase, DocumentSearchRequest, DocumentSearchResponse, EnableCapabilityRequest, EnablePackRequest, FileAsset, FileDownloadUrlResponse, GetPackResponse, GitHubAppInfo, GitHubRepositoriesResponse, KnowledgeMemory, KnowledgeMemorySearchRequest, ListPacksResponse, MachinesResponse, MetricSample, SwapActiveSandboxRequest, SwapActiveSandboxResponse, PackInstallation, LatencyMode, ReasoningEffort, RetainedArtifactContent, RetainedArtifactContentOptions, RetainedArtifactMetadata, RegisterCapabilityPackRequest, ResourceRef, ScheduledTask, ScheduledTaskRun, Session, SessionListResponse, UpdateSessionPinRequest, SessionEvent, SessionEventCompactResult, SessionEventCompactResultOptions, SessionEventListOptions, SessionEventPage, SessionGoal, SessionHumanInputRequest, SessionLineageResponse, SessionMcpCredentialUpdateInput, UpdateSessionMcpApprovalPolicyRequest, UpdateSessionMcpApprovalPolicyResponse, SessionQueueSnapshot, SessionQueueMutationResponse, ComposerDraft, DeleteSessionQueueItemRequest, EditSessionQueueItemRequest, MoveSessionQueueItemRequest, NewSessionDraft, SaveComposerDraftRequest, SaveNewSessionDraftRequest, SteerSessionQueueItemRequest, SessionControlResponse, WorkspaceInferenceControlResponse, WorkspaceControlEvent, SessionTurn, SubmitHumanInputResponseRequest, SessionCapabilities, AttachViewerRequest, AttachViewerResponse, AcknowledgeStreamRequest, AcknowledgeStreamResponse, ViewerHeartbeatRequest, ViewerHeartbeatResponse, FsListRequest, FsListResponse, FsReadRequest, FsReadResponse, FsWriteRequest, FsWriteResponse, FsDeleteRequest, FsDeleteResponse, FsMoveRequest, FsMoveResponse, FsMkdirRequest, FsMkdirResponse, GitStatusRequest, GitStatusResponse, GitDiffRequest, GitDiffResponse, GitLogRequest, GitLogResponse, GitShowRequest, GitShowResponse, GetWorkspaceCaptureResponse, GetWorkspaceCaptureFileResponse, TerminalExecRequest, TerminalExecResponse, PtyOpenRequest, PtyOpenResponse, PtyWriteRequest, PtyResizeRequest, PtyCloseRequest, ToolRef, TranscribeAudioResponse, UpdateConnectionRequest, UpdateKnowledgeMemoryRequest, UpdateScheduledTaskRequest, UpdateSessionGoalRequest, UpdateSessionRequest, UpdateSessionToolPolicyRequest, UpdateVariableSetRequest, UpdateRigRequest, UpdateWorkspaceMemberRequest, UpdateWorkspaceRequest, UpdateWorkspaceSettingsRequest, SetWorkspaceDefaultRigRequest, UploadFileInput, VariableSet, VariableSetVariableMetadata, Rig, RigVersion, RigChange, ProposeRigChangeRequest, WorkspaceMember, WorkspaceMemorySearchRequest, WorkspaceMemorySearchResponse, WorkspaceRegisteredPack, Workspace, OAuthStartRequest, OAuthStartResponse } from "./types";
4
+ import type { ActivateWorkspaceInstructionPolicyRequest, CreateWorkspaceInstructionPolicyDraftRequest, ImportLegacyWorkspaceInstructionPolicyDraftRequest, RollbackWorkspaceInstructionPolicyRequest, WorkspaceInstructionPolicyActivationResponse, WorkspaceInstructionPolicyDiffRequest, WorkspaceInstructionPolicyDiffResponse, WorkspaceInstructionPolicyListOptions, WorkspaceInstructionPolicyListResponse, WorkspaceInstructionPolicyRevision } from "./workspace-instruction-policies";
5
+ import type { WorkspaceStateResponse } from "./workspace-state";
6
+ import type { ActivatePreferenceRegistryRevisionRequest, ChangePreferenceRegistryScopeRequest, CorrectPreferenceRegistryRequest, CreatePreferenceRegistryProposalRequest, DeactivatePreferenceRegistryRequest, PreferenceRegistryDetailResponse, PreferenceRegistryFullContent, PreferenceRegistryListOptions, PreferenceRegistryListResponse, PreferenceRegistryMutationResponse, PreferenceRegistryRecord, PreferenceRegistrySnapshot, RejectPreferenceRegistryProposalRequest, SupersedePreferenceRegistryRequest } from "./preference-registry";
7
+ export type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
8
+ export type WorkspaceControlEventPage = {
9
+ events: WorkspaceControlEvent[];
10
+ bytes: number;
11
+ truncated: boolean;
12
+ nextAfter: number | null;
13
+ };
14
+ export type OpenGeniClientOptions = {
15
+ /** Base URL of the OpenGeni API, e.g. `https://api.example.com`. */
16
+ baseUrl: string;
17
+ /** OpenGeni API key, sent as `Authorization: Bearer <apiKey>`. */
18
+ apiKey?: string;
19
+ /** Extra headers (static or computed per request) merged into every call. */
20
+ headers?: Record<string, string> | (() => Record<string, string>);
21
+ /** Custom fetch implementation. Defaults to the global `fetch`. */
22
+ fetch?: FetchLike;
23
+ };
24
+ /** Per-request cancellation for operations whose caller owns an AbortSignal. */
25
+ export type OpenGeniRequestOptions = {
26
+ signal?: AbortSignal | undefined;
27
+ };
28
+ export type SendMessageInput = {
29
+ text: string;
30
+ /** System instructions scoped to this exact turn; never visible timeline text. */
31
+ turnInstructions?: string;
32
+ resources?: ResourceRef[];
33
+ tools?: ToolRef[];
34
+ model?: string;
35
+ reasoningEffort?: ReasoningEffort;
36
+ latencyMode?: LatencyMode;
37
+ clientEventId?: string;
38
+ controlEtag?: string;
39
+ expectedDraftRevision?: number;
40
+ mcpCredentialUpdates?: SessionMcpCredentialUpdateInput[];
41
+ };
42
+ export type SteerMessageResult = {
43
+ /** The accepted `user.message` event. */
44
+ accepted: SessionEvent;
45
+ /** The exact turn created for this message in the same server transaction. */
46
+ turn: SessionTurn;
47
+ };
48
+ export type TranscribeAudioInput = {
49
+ audio: Blob | File | Uint8Array;
50
+ mimeType: string;
51
+ durationSeconds?: number | undefined;
52
+ signal?: AbortSignal | undefined;
53
+ };
54
+ /**
55
+ * Typed client for the OpenGeni public API. Framework-agnostic: only needs
56
+ * WHATWG `fetch` + streams, so it runs in Node 18+, Bun, Deno, browsers, and
57
+ * edge runtimes.
58
+ */
59
+ export declare class OpenGeniClient {
60
+ private readonly baseUrl;
61
+ private readonly options;
62
+ private readonly fetchImpl;
63
+ constructor(options: OpenGeniClientOptions);
64
+ /** Upload one ephemeral browser recording. This method never retries. */
65
+ transcribeAudio(workspaceId: string, input: TranscribeAudioInput): Promise<TranscribeAudioResponse>;
66
+ createSession(workspaceId: string, request: CreateSessionRequest): Promise<CreateSessionResponse>;
67
+ getNewSessionDraft(workspaceId: string): Promise<NewSessionDraft>;
68
+ saveNewSessionDraft(workspaceId: string, request: SaveNewSessionDraftRequest): Promise<NewSessionDraft>;
69
+ getSession(workspaceId: string, sessionId: string): Promise<Session>;
70
+ updateSession(workspaceId: string, sessionId: string, request: UpdateSessionRequest): Promise<Session>;
71
+ /** Replace the durable tool policy or explicitly adopt workspace defaults. */
72
+ updateSessionToolPolicy(workspaceId: string, sessionId: string, request: UpdateSessionToolPolicyRequest): Promise<Session>;
73
+ /**
74
+ * Replace one attached MCP server's approval policy. The change is captured
75
+ * by the next claimed attempt; already-claimed work keeps its immutable
76
+ * policy snapshot.
77
+ */
78
+ updateSessionMcpApprovalPolicy(workspaceId: string, sessionId: string, serverId: string, request: UpdateSessionMcpApprovalPolicyRequest): Promise<UpdateSessionMcpApprovalPolicyResponse>;
79
+ listSessions(workspaceId: string, options?: {
80
+ limit?: number;
81
+ parentSessionId?: string | null;
82
+ search?: string;
83
+ }): Promise<Session[]>;
84
+ /** Pin-aware ordinary-session page with a stable keyset cursor. */
85
+ listSessionPage(workspaceId: string, options?: {
86
+ limit?: number;
87
+ parentSessionId?: string | null;
88
+ cursor?: string;
89
+ search?: string;
90
+ /** Return only the complete personal pinned projection. */
91
+ pinsOnly?: boolean;
92
+ }): Promise<SessionListResponse>;
93
+ /** Set this authenticated member's personal workspace pin for a session. */
94
+ updateSessionPin(workspaceId: string, sessionId: string, request: UpdateSessionPinRequest): Promise<Session>;
95
+ getSessionLineage(workspaceId: string, sessionId: string): Promise<SessionLineageResponse>;
96
+ listTurns(workspaceId: string, sessionId: string, options?: {
97
+ limit?: number;
98
+ latestStarted?: boolean;
99
+ }): Promise<SessionTurn[]>;
100
+ /** Newest turn that durably emitted `turn.started`, or null before any admission. */
101
+ getLatestStartedTurn(workspaceId: string, sessionId: string): Promise<SessionTurn | null>;
102
+ /**
103
+ * List the workspace's machines (the Machines dashboard). Each enrolled
104
+ * selfhosted machine carries its derived state + latest metrics +
105
+ * sharedSessionCount. Pass `sessionId` for an in-session view, which adds the
106
+ * session's synthetic Modal group box + the active-sandbox pointer.
107
+ */
108
+ listMachines(workspaceId: string, options?: {
109
+ sessionId?: string;
110
+ signal?: AbortSignal;
111
+ }): Promise<MachinesResponse>;
112
+ /**
113
+ * Read the downsampled (~1/min) metrics series for ONE machine over a time
114
+ * window (default 1h). The samples are oldest-first (a left-to-right chart).
115
+ */
116
+ machineMetricsSeries(workspaceId: string, enrollmentId: string, options?: {
117
+ window?: "15m" | "1h" | "6h" | "24h";
118
+ }): Promise<MetricSample[]>;
119
+ /**
120
+ * Resolve a pending device-enrollment flow by its user_code for the click-Grant
121
+ * approve page (EnrollmentConsent). NO workspace in the path — the server
122
+ * resolves the workspace from the (globally-unique-among-pending) code, then
123
+ * authorizes the caller against it (enrollments:read). Rejects (404) when the
124
+ * code is unknown/expired OR the caller lacks the grant — the two are
125
+ * indistinguishable by design (no cross-workspace disclosure). Does not consume
126
+ * the request.
127
+ */
128
+ lookupDeviceEnrollment(userCode: string): Promise<DeviceEnrollmentLookupResponse>;
129
+ /**
130
+ * Approve a pending device-enrollment flow (the LOUD consent step). `allowScreenControl`
131
+ * is the authoritative screen-control consent (whole-machine is mandatory/implicit).
132
+ * Lands an enrollment + a selfhosted sandbox and unblocks the agent's poll.
133
+ */
134
+ approveDeviceEnrollment(workspaceId: string, request: {
135
+ userCode: string;
136
+ allowScreenControl?: boolean;
137
+ }): Promise<DeviceEnrollmentApproveResponse>;
138
+ /** Deny a pending device-enrollment flow (the explicit "no" at the approve page). */
139
+ denyDeviceEnrollment(workspaceId: string, request: {
140
+ userCode: string;
141
+ }): Promise<DeviceEnrollmentDenyResponse>;
142
+ /**
143
+ * Mint a short-TTL headless enroll token (the `oget_` token) for the fleet /
144
+ * non-interactive enroll path. The returned `token` is SECRET — surface it once
145
+ * with a copy-now warning; it cannot be re-read. `allowScreenControl` bakes the
146
+ * screen-control consent into the token.
147
+ */
148
+ mintEnrollToken(workspaceId: string, request?: {
149
+ allowScreenControl?: boolean;
150
+ }): Promise<MintEnrollTokenResponse>;
151
+ /**
152
+ * Swap a session's active sandbox (the user-authenticated equivalent of the
153
+ * M7 `sandbox_swap` MCP tool). `target` is a `MachineView.sandboxId` from
154
+ * `listMachines`, or "session"/"default" to swap back to the session's own
155
+ * group box. Validation (ownership/liveness/epoch fence) is server-side; the
156
+ * result echoes the resulting pointer (`swapped: false` + `reason` on a
157
+ * rejected target or a lost epoch fence).
158
+ */
159
+ swapActiveSandbox(workspaceId: string, sessionId: string, request: SwapActiveSandboxRequest): Promise<SwapActiveSandboxResponse>;
160
+ listScheduledTasks(workspaceId: string, options?: {
161
+ limit?: number;
162
+ }): Promise<ScheduledTask[]>;
163
+ getScheduledTask(workspaceId: string, taskId: string): Promise<ScheduledTask>;
164
+ /**
165
+ * Return the events from one bounded page. With no cursor, this uses the safe
166
+ * semantic monitoring tail; pass explicit forensic options and a cursor for
167
+ * retained audit replay. Use `listEventPage` when projection, coverage, or
168
+ * resume-cursor facts are required.
169
+ */
170
+ listEvents(workspaceId: string, sessionId: string, options?: SessionEventListOptions): Promise<SessionEvent[]>;
171
+ /** Bounded durable/monitoring page plus exact projection and cursor facts. */
172
+ listEventPage(workspaceId: string, sessionId: string, options: SessionEventCompactResultOptions): Promise<SessionEventCompactResult | null>;
173
+ listEventPage(workspaceId: string, sessionId: string, options?: SessionEventListOptions): Promise<SessionEventPage>;
174
+ /**
175
+ * Fetch the authoritative newest-sequence semantic result directly. This is
176
+ * the callback-loss recovery path: it reads one compact durable result and
177
+ * never creates a model turn. `latest: "receipt"` aliases `tool_receipt`;
178
+ * turn generation remains scoped retry metadata.
179
+ */
180
+ getLatestEventResult(workspaceId: string, sessionId: string, options?: Omit<SessionEventCompactResultOptions, "resultMode">): Promise<SessionEventCompactResult | null>;
181
+ /** POST a user/control event to the session. Returns the accepted event. */
182
+ sendEvent(workspaceId: string, sessionId: string, event: ClientSessionEventInput): Promise<SessionEvent>;
183
+ sendMessage(workspaceId: string, sessionId: string, message: string | SendMessageInput): Promise<SessionEvent>;
184
+ pauseSession(workspaceId: string, sessionId: string, options?: {
185
+ reason?: string;
186
+ clientEventId?: string;
187
+ expectedControlEtag?: string;
188
+ }): Promise<SessionControlResponse>;
189
+ sendApprovalDecision(workspaceId: string, sessionId: string, decision: {
190
+ approvalId: string;
191
+ decision: "approve" | "reject";
192
+ message?: string;
193
+ clientEventId?: string;
194
+ }): Promise<SessionEvent>;
195
+ listHumanInputRequests(workspaceId: string, sessionId: string, options?: {
196
+ status?: SessionHumanInputRequest["status"];
197
+ }): Promise<SessionHumanInputRequest[]>;
198
+ getHumanInputRequest(workspaceId: string, sessionId: string, requestId: string): Promise<SessionHumanInputRequest>;
199
+ submitHumanInputResponse(workspaceId: string, sessionId: string, requestId: string, response: SubmitHumanInputResponseRequest, options?: {
200
+ clientEventId?: string;
201
+ }): Promise<SessionEvent>;
202
+ /**
203
+ * Live-stream a session's events with automatic reconnect, resume from the
204
+ * last seen sequence, gap backfill, and duplicate suppression. See
205
+ * {@link streamSessionEvents} for the delivery guarantees.
206
+ */
207
+ streamEvents(workspaceId: string, sessionId: string, options?: StreamSessionEventsOptions): AsyncGenerator<SessionEvent, void, void>;
208
+ /** The transport `streamEvents` runs on; useful for custom streaming layers. */
209
+ eventStreamTransport(workspaceId: string, sessionId: string): SessionEventStreamTransport;
210
+ /** Open one raw SSE connection (no reconnect). Most callers want `streamEvents`. */
211
+ openEventStream(workspaceId: string, sessionId: string, options?: {
212
+ after?: number;
213
+ signal?: AbortSignal;
214
+ }): Promise<ReadableStream<Uint8Array>>;
215
+ getQueue(workspaceId: string, sessionId: string): Promise<SessionQueueSnapshot>;
216
+ moveQueueItem(workspaceId: string, sessionId: string, turnId: string, request: MoveSessionQueueItemRequest): Promise<SessionQueueMutationResponse>;
217
+ editQueueItem(workspaceId: string, sessionId: string, turnId: string, request: EditSessionQueueItemRequest): Promise<SessionQueueMutationResponse>;
218
+ steerQueueItem(workspaceId: string, sessionId: string, turnId: string, request: SteerSessionQueueItemRequest): Promise<SessionQueueMutationResponse>;
219
+ deleteQueueItem(workspaceId: string, sessionId: string, turnId: string, request: DeleteSessionQueueItemRequest): Promise<SessionQueueMutationResponse>;
220
+ getComposerDraft(workspaceId: string, sessionId: string): Promise<ComposerDraft>;
221
+ saveComposerDraft(workspaceId: string, sessionId: string, request: SaveComposerDraftRequest): Promise<ComposerDraft>;
222
+ controlSession(workspaceId: string, sessionId: string, request: {
223
+ action: "pause" | "resume";
224
+ reason?: string;
225
+ clientEventId: string;
226
+ expectedControlEtag?: string;
227
+ }): Promise<SessionControlResponse>;
228
+ resumeSession(workspaceId: string, sessionId: string, options?: {
229
+ reason?: string;
230
+ clientEventId?: string;
231
+ expectedControlEtag?: string;
232
+ }): Promise<SessionControlResponse>;
233
+ setWorkspaceInferenceState(workspaceId: string, request: {
234
+ action: "pause" | "resume";
235
+ reason?: string;
236
+ clientEventId: string;
237
+ expectedRevision?: number;
238
+ }): Promise<WorkspaceInferenceControlResponse>;
239
+ listWorkspaceControlEvents(workspaceId: string, options?: {
240
+ after?: number;
241
+ limit?: number;
242
+ }): Promise<WorkspaceControlEvent[]>;
243
+ /** Count/byte-bounded page plus an explicit continuation cursor. */
244
+ listWorkspaceControlEventPage(workspaceId: string, options?: {
245
+ after?: number;
246
+ limit?: number;
247
+ }): Promise<WorkspaceControlEventPage>;
248
+ streamWorkspaceControlEvents(workspaceId: string, options?: StreamSessionEventsOptions): AsyncGenerator<WorkspaceControlEvent, void, void>;
249
+ workspaceControlStreamTransport(workspaceId: string): WorkspaceControlStreamTransport;
250
+ openWorkspaceControlEventStream(workspaceId: string, options?: {
251
+ after?: number;
252
+ signal?: AbortSignal;
253
+ }): Promise<ReadableStream<Uint8Array>>;
254
+ /**
255
+ * Steer: atomically put this prompt at the head and supersede the current
256
+ * inference. The client performs one request and renders server order.
257
+ */
258
+ steerMessage(workspaceId: string, sessionId: string, message: string | SendMessageInput): Promise<SteerMessageResult>;
259
+ /** The session's goal. 404s when the session never had one. */
260
+ getGoal(workspaceId: string, sessionId: string): Promise<SessionGoal>;
261
+ updateGoal(workspaceId: string, sessionId: string, request: UpdateSessionGoalRequest): Promise<SessionGoal>;
262
+ deleteGoal(workspaceId: string, sessionId: string): Promise<void>;
263
+ /** Pause the goal loop: the session stops self-continuing until resumed. */
264
+ pauseGoal(workspaceId: string, sessionId: string, options?: {
265
+ rationale?: string;
266
+ }): Promise<SessionGoal>;
267
+ /** Resume a paused goal: resets counters and re-arms the continuation loop. */
268
+ resumeGoal(workspaceId: string, sessionId: string): Promise<SessionGoal>;
269
+ /**
270
+ * Clear the session's conversation context. Destructive and audit-preserving:
271
+ * the server supersedes (never deletes) the live history and emits a
272
+ * `session.context.cleared` event. Refused (409) while a turn is in flight or
273
+ * awaiting action. `confirm:true` is sent so an accidental call cannot wipe
274
+ * context — the destructive intent is explicit on the wire.
275
+ */
276
+ clearSessionContext(workspaceId: string, sessionId: string): Promise<void>;
277
+ /** Request one durable portable compaction at the next safe model boundary. */
278
+ compactSessionContext(workspaceId: string, sessionId: string): Promise<CompactSessionContextResult>;
279
+ /** FileSystem: list a directory tree (feeds the Pierre file tree). */
280
+ fsList(workspaceId: string, sessionId: string, request?: FsListRequest, options?: OpenGeniRequestOptions): Promise<FsListResponse>;
281
+ /** FileSystem: read a file (text or base64; binary-safe, size-capped). */
282
+ fsRead(workspaceId: string, sessionId: string, request: FsReadRequest, options?: OpenGeniRequestOptions): Promise<FsReadResponse>;
283
+ /** FileSystem: write a file (last-writer-wins; emits fs.changed). */
284
+ fsWrite(workspaceId: string, sessionId: string, request: FsWriteRequest): Promise<FsWriteResponse>;
285
+ /** FileSystem: delete a path (emits fs.changed). */
286
+ fsDelete(workspaceId: string, sessionId: string, request: FsDeleteRequest): Promise<FsDeleteResponse>;
287
+ /** FileSystem: move/rename a path (emits fs.changed; 409 if destination exists and overwrite is false). */
288
+ fsMove(workspaceId: string, sessionId: string, request: FsMoveRequest): Promise<FsMoveResponse>;
289
+ /** FileSystem: create a directory (emits fs.changed; recursive defaults to true). */
290
+ fsMkdir(workspaceId: string, sessionId: string, request: FsMkdirRequest): Promise<FsMkdirResponse>;
291
+ /** Git: working-tree/index status (the Pierre file-status feed). */
292
+ gitStatus(workspaceId: string, sessionId: string, request?: GitStatusRequest, options?: OpenGeniRequestOptions): Promise<GitStatusResponse>;
293
+ /** Git: structured diff hunks (the Pierre diff feed). */
294
+ gitDiff(workspaceId: string, sessionId: string, request?: GitDiffRequest, options?: OpenGeniRequestOptions): Promise<GitDiffResponse>;
295
+ /** Git: commit log. */
296
+ gitLog(workspaceId: string, sessionId: string, request?: GitLogRequest): Promise<GitLogResponse>;
297
+ /** Git: show a commit (diff vs first parent) or fetch a raw blob at a ref. */
298
+ gitShow(workspaceId: string, sessionId: string, request: GitShowRequest): Promise<GitShowResponse>;
299
+ /** Workspace capture: the latest turn-end snapshot of the session's workspace
300
+ * (tree + per-repo diff + file after-image refs), served from durable storage
301
+ * WITHOUT warming a machine — the workbench cold-paint source. Returns
302
+ * `{available:false}` when no capture exists yet (fall back to the live path). */
303
+ getWorkspaceCapture(workspaceId: string, sessionId: string, options?: OpenGeniRequestOptions): Promise<GetWorkspaceCaptureResponse>;
304
+ /** Workspace capture: a single file's after-image from the capture (revision
305
+ * pins a specific one; omitted → latest). Content is inline for small files,
306
+ * else a short-TTL signed URL; a tooLarge file returns metadata only. */
307
+ getWorkspaceCaptureFile(workspaceId: string, sessionId: string, path: string, revision?: number, options?: OpenGeniRequestOptions): Promise<GetWorkspaceCaptureFileResponse>;
308
+ /** Terminal: run a bounded command, returning buffered stdout/stderr inline. */
309
+ terminalExec(workspaceId: string, sessionId: string, request: TerminalExecRequest): Promise<TerminalExecResponse>;
310
+ /** Terminal: open an interactive PTY. Output streams on the event SSE as
311
+ * terminal.pty.output.delta; drive it with terminalPtyWrite. */
312
+ terminalPtyOpen(workspaceId: string, sessionId: string, request?: PtyOpenRequest): Promise<PtyOpenResponse>;
313
+ /** Terminal: send stdin to an open PTY (output rides A1). */
314
+ terminalPtyWrite(workspaceId: string, sessionId: string, request: PtyWriteRequest): Promise<void>;
315
+ /** Terminal: resize an open PTY. */
316
+ terminalPtyResize(workspaceId: string, sessionId: string, request: PtyResizeRequest): Promise<void>;
317
+ /** Terminal: close an open PTY (idempotent). */
318
+ terminalPtyClose(workspaceId: string, sessionId: string, request: PtyCloseRequest): Promise<void>;
319
+ /** Read the negotiated capability doc for a session WITHOUT acquiring a viewer
320
+ * holder (no warm, no spawn). Drives capability-gated rendering: which
321
+ * surfaces mount, the per-surface unavailability reasons, and the lease
322
+ * liveness the client polls on while `cold`/`warming`. The desktop URL/token
323
+ * are minted in-process only when the box is warm AND the principal has
324
+ * acknowledged the un-redacted plane. */
325
+ getStreamCapabilities(workspaceId: string, sessionId: string, options?: OpenGeniRequestOptions): Promise<SessionCapabilities>;
326
+ /** Record the calling principal's acknowledgment of the un-redacted desktop
327
+ * pixel plane (and, when the box is shared, the shared-exposure disclosure).
328
+ * The desktop viewer-attach path returns 409 until this is recorded. */
329
+ acknowledgeStream(workspaceId: string, sessionId: string, request?: AcknowledgeStreamRequest): Promise<AcknowledgeStreamResponse>;
330
+ /** Attach a viewer holder (refcounted liveness — keeps the box warm while
331
+ * watched/used), spinning the box up in-process when cold, and mint the scoped
332
+ * direct-to-provider URLs for the requested plane(s). `request.desktop:true`
333
+ * opts into the un-redacted pixel plane and mints the noVNC URL — that plane
334
+ * alone throws `OpenGeniApiError(409)` when the un-redacted/shared
335
+ * acknowledgment is missing (the consent gate). A terminal-only attach
336
+ * (`desktop` omitted/false) warms the box + mints the pty-ws terminal cell with
337
+ * NO consent gate. An omitted `viewerId` mints a fresh one. */
338
+ attachViewer(workspaceId: string, sessionId: string, request?: AttachViewerRequest): Promise<AttachViewerResponse>;
339
+ /** Heartbeat a viewer holder (Channel-A app-level liveness). A closed laptop
340
+ * stops sending these → the reaper drops the holder within ~90s. Echoes
341
+ * `leaseEpoch` so a superseded epoch is rejected (`alive:false` → re-attach). */
342
+ heartbeatViewer(workspaceId: string, sessionId: string, viewerId: string, request: ViewerHeartbeatRequest): Promise<ViewerHeartbeatResponse>;
343
+ /** Detach a viewer (delete this holder; idempotent delete-my-row). */
344
+ detachViewer(workspaceId: string, sessionId: string, viewerId: string): Promise<void>;
345
+ /**
346
+ * The deployment's public client bootstrap config: the host-exposed models
347
+ * (provider-grouped in `models`, flat in `allowedModels` for back-compat),
348
+ * reasoning efforts, MCP servers, file-upload limits, and how the client is
349
+ * expected to authenticate. Drives a composer's model picker without prior
350
+ * knowledge of the host setup; safe to call before any auth is established.
351
+ */
352
+ getClientConfig(): Promise<ClientConfig>;
353
+ /** Authenticated model definitions plus workspace-specific selectability. */
354
+ getWorkspaceModelCatalog(workspaceId: string): Promise<WorkspaceModelCatalogResponse>;
355
+ /** The caller's access context: subject, account + workspace grants, defaults. */
356
+ getAccessContext(): Promise<AccessContext>;
357
+ listWorkspaces(): Promise<Workspace[]>;
358
+ createWorkspace(request: CreateWorkspaceRequest): Promise<Workspace>;
359
+ getWorkspace(workspaceId: string): Promise<Workspace>;
360
+ /** Read-time, secret-safe inventory of policy heads and visible workspace knowledge. */
361
+ getWorkspaceState(workspaceId: string): Promise<WorkspaceStateResponse>;
362
+ updateWorkspace(workspaceId: string, request: UpdateWorkspaceRequest): Promise<Workspace>;
363
+ /** Inspect immutable instruction-policy history, active heads, and activation audit evidence. */
364
+ listWorkspaceInstructionPolicies(workspaceId: string, options?: WorkspaceInstructionPolicyListOptions): Promise<WorkspaceInstructionPolicyListResponse>;
365
+ getWorkspaceInstructionPolicyRevision(workspaceId: string, revisionId: string): Promise<WorkspaceInstructionPolicyRevision>;
366
+ createWorkspaceInstructionPolicyDraft(workspaceId: string, request: CreateWorkspaceInstructionPolicyDraftRequest): Promise<WorkspaceInstructionPolicyRevision>;
367
+ /** Import the stored legacy workspace override as an inactive charter draft. */
368
+ importLegacyWorkspaceInstructionPolicyDraft(workspaceId: string, request?: ImportLegacyWorkspaceInstructionPolicyDraftRequest): Promise<WorkspaceInstructionPolicyRevision>;
369
+ diffWorkspaceInstructionPolicyRevisions(workspaceId: string, request: WorkspaceInstructionPolicyDiffRequest): Promise<WorkspaceInstructionPolicyDiffResponse>;
370
+ activateWorkspaceInstructionPolicyRevision(workspaceId: string, revisionId: string, request: ActivateWorkspaceInstructionPolicyRequest): Promise<WorkspaceInstructionPolicyActivationResponse>;
371
+ rollbackWorkspaceInstructionPolicyRevision(workspaceId: string, request: RollbackWorkspaceInstructionPolicyRequest): Promise<WorkspaceInstructionPolicyActivationResponse>;
372
+ listPreferenceRegistry(workspaceId: string, options?: PreferenceRegistryListOptions): Promise<PreferenceRegistryListResponse>;
373
+ getPreferenceRegistry(workspaceId: string, preferenceId: string): Promise<PreferenceRegistryDetailResponse>;
374
+ createPreferenceRegistryProposal(workspaceId: string, request: CreatePreferenceRegistryProposalRequest): Promise<PreferenceRegistryRecord>;
375
+ activatePreferenceRegistryRevision(workspaceId: string, preferenceId: string, request: ActivatePreferenceRegistryRevisionRequest): Promise<PreferenceRegistryMutationResponse>;
376
+ correctPreferenceRegistry(workspaceId: string, preferenceId: string, request: CorrectPreferenceRegistryRequest): Promise<PreferenceRegistryMutationResponse>;
377
+ changePreferenceRegistryScope(workspaceId: string, preferenceId: string, request: ChangePreferenceRegistryScopeRequest): Promise<PreferenceRegistryMutationResponse>;
378
+ deactivatePreferenceRegistry(workspaceId: string, preferenceId: string, request: DeactivatePreferenceRegistryRequest): Promise<PreferenceRegistryMutationResponse>;
379
+ supersedePreferenceRegistry(workspaceId: string, preferenceId: string, request: SupersedePreferenceRegistryRequest): Promise<PreferenceRegistryMutationResponse>;
380
+ rejectPreferenceRegistryProposal(workspaceId: string, preferenceId: string, request: RejectPreferenceRegistryProposalRequest): Promise<PreferenceRegistryMutationResponse>;
381
+ getPreferenceRegistrySummary(workspaceId: string): Promise<PreferenceRegistrySnapshot>;
382
+ getPreferenceRegistryFullContent(workspaceId: string, retrievalHandle: string): Promise<PreferenceRegistryFullContent>;
383
+ /**
384
+ * Delete a workspace and everything in it. Refused (409) for the account's
385
+ * only workspace and while it still has a running session. Irreversible.
386
+ */
387
+ deleteWorkspace(workspaceId: string): Promise<void>;
388
+ /** The workspace's members (user + api_key subjects). */
389
+ listWorkspaceMembers(workspaceId: string): Promise<WorkspaceMember[]>;
390
+ /**
391
+ * Add an already-registered user by email. 404s when no user with that email
392
+ * exists (email invites for unknown users are deferred).
393
+ */
394
+ addWorkspaceMember(workspaceId: string, request: AddWorkspaceMemberRequest): Promise<WorkspaceMember>;
395
+ updateWorkspaceMember(workspaceId: string, subjectId: string, request: UpdateWorkspaceMemberRequest): Promise<WorkspaceMember>;
396
+ /**
397
+ * Remove a member. Refused (409) for your own membership and for the last
398
+ * member who can still manage the workspace.
399
+ */
400
+ removeWorkspaceMember(workspaceId: string, subjectId: string): Promise<void>;
401
+ createScheduledTask(workspaceId: string, request: CreateScheduledTaskRequest): Promise<ScheduledTask>;
402
+ updateScheduledTask(workspaceId: string, taskId: string, request: UpdateScheduledTaskRequest): Promise<ScheduledTask>;
403
+ pauseScheduledTask(workspaceId: string, taskId: string): Promise<ScheduledTask>;
404
+ resumeScheduledTask(workspaceId: string, taskId: string): Promise<ScheduledTask>;
405
+ /**
406
+ * Fire the task immediately (manual trigger), independent of its schedule.
407
+ * Pass a stable `triggerId` to make a retried trigger idempotent — the same
408
+ * token charges once and starts one run. Omit it and each call is distinct.
409
+ */
410
+ triggerScheduledTask(workspaceId: string, taskId: string, options?: {
411
+ triggerId?: string;
412
+ }): Promise<ScheduledTask>;
413
+ deleteScheduledTask(workspaceId: string, taskId: string): Promise<void>;
414
+ listScheduledTaskRuns(workspaceId: string, taskId: string, options?: {
415
+ limit?: number;
416
+ }): Promise<ScheduledTaskRun[]>;
417
+ listVariableSets(workspaceId: string): Promise<VariableSet[]>;
418
+ createVariableSet(workspaceId: string, request: CreateVariableSetRequest): Promise<VariableSet>;
419
+ getVariableSet(workspaceId: string, variableSetId: string): Promise<VariableSet>;
420
+ updateVariableSet(workspaceId: string, variableSetId: string, request: UpdateVariableSetRequest): Promise<VariableSet>;
421
+ deleteVariableSet(workspaceId: string, variableSetId: string): Promise<void>;
422
+ /** Create or rotate a variable. The value never comes back on any read. */
423
+ setVariableSetVariable(workspaceId: string, variableSetId: string, name: string, value: string): Promise<VariableSetVariableMetadata>;
424
+ deleteVariableSetVariable(workspaceId: string, variableSetId: string, name: string): Promise<void>;
425
+ listRigs(workspaceId: string): Promise<Rig[]>;
426
+ createRig(workspaceId: string, request: CreateRigRequest): Promise<Rig>;
427
+ getRig(workspaceId: string, rigId: string): Promise<Rig>;
428
+ updateRig(workspaceId: string, rigId: string, request: UpdateRigRequest): Promise<Rig>;
429
+ deleteRig(workspaceId: string, rigId: string): Promise<void>;
430
+ listRigVersions(workspaceId: string, rigId: string): Promise<RigVersion[]>;
431
+ /** Roll the active version to an existing one (rollback / promote-activate). */
432
+ activateRigVersion(workspaceId: string, rigId: string, versionId: string): Promise<RigVersion>;
433
+ listRigChanges(workspaceId: string, rigId: string): Promise<RigChange[]>;
434
+ /** Propose a change against the rig's active version (rigs:use). */
435
+ proposeRigChange(workspaceId: string, rigId: string, request: ProposeRigChangeRequest): Promise<RigChange>;
436
+ getRigChange(workspaceId: string, rigId: string, changeId: string): Promise<RigChange>;
437
+ /**
438
+ * Re-run verification for a change (rigs:use). Verification is asynchronous:
439
+ * this returns the change immediately with status `verifying`; poll
440
+ * `getRigChange`/`listRigChanges` for the terminal outcome + logs.
441
+ */
442
+ verifyRigChange(workspaceId: string, rigId: string, changeId: string): Promise<RigChange>;
443
+ /**
444
+ * Promote a verified `definition_edit` change into a new active rig version
445
+ * (rigs:manage). Only valid once the change's verification passed; returns the
446
+ * newly minted version.
447
+ */
448
+ promoteRigChange(workspaceId: string, rigId: string, changeId: string): Promise<RigVersion>;
449
+ /**
450
+ * Re-run the active version's checks in a clean throwaway sandbox (rigs:use).
451
+ * Asynchronous — returns the version id being verified; the outcome lands on
452
+ * the version's audit trail.
453
+ */
454
+ verifyRig(workspaceId: string, rigId: string): Promise<{
455
+ ok: boolean;
456
+ versionId: string;
457
+ }>;
458
+ /** @deprecated use listVariableSets */
459
+ listEnvironments(workspaceId: string): Promise<VariableSet[]>;
460
+ /** @deprecated use createVariableSet */
461
+ createEnvironment(workspaceId: string, request: CreateVariableSetRequest): Promise<VariableSet>;
462
+ /** @deprecated use getVariableSet */
463
+ getEnvironment(workspaceId: string, environmentId: string): Promise<VariableSet>;
464
+ /** @deprecated use updateVariableSet */
465
+ updateEnvironment(workspaceId: string, environmentId: string, request: UpdateVariableSetRequest): Promise<VariableSet>;
466
+ /** @deprecated use deleteVariableSet */
467
+ deleteEnvironment(workspaceId: string, environmentId: string): Promise<void>;
468
+ /** @deprecated use setVariableSetVariable */
469
+ setEnvironmentVariable(workspaceId: string, environmentId: string, name: string, value: string): Promise<VariableSetVariableMetadata>;
470
+ /** @deprecated use deleteVariableSetVariable */
471
+ deleteEnvironmentVariable(workspaceId: string, environmentId: string, name: string): Promise<void>;
472
+ /** Step 1 of the upload flow: returns the pre-signed PUT target. */
473
+ beginFileUpload(workspaceId: string, request: CreateFileUploadRequest): Promise<CreateFileUploadResponse>;
474
+ /** Step 3 of the upload flow: server verifies the object and marks it ready. */
475
+ completeFileUpload(workspaceId: string, uploadId: string): Promise<FileAsset>;
476
+ /**
477
+ * The whole upload flow as one call: begin -> PUT the bytes to the signed
478
+ * URL (with its required headers; no API auth is sent to object storage)
479
+ * -> complete. Returns the ready `FileAsset`.
480
+ */
481
+ uploadFile(workspaceId: string, input: UploadFileInput): Promise<FileAsset>;
482
+ getFile(workspaceId: string, fileId: string): Promise<FileAsset>;
483
+ /** Read provider-neutral retained evidence metadata; never returns a storage location. */
484
+ getRetainedArtifact(workspaceId: string, artifactId: string): Promise<RetainedArtifactMetadata>;
485
+ /**
486
+ * Read at most one authenticated retained-evidence range from the API. This
487
+ * deliberately does not use the ordinary signed file-download URL.
488
+ */
489
+ getRetainedArtifactContent(workspaceId: string, artifactId: string, options?: RetainedArtifactContentOptions): Promise<RetainedArtifactContent>;
490
+ /** Mint a short-lived signed download URL for a ready file. */
491
+ createFileDownloadUrl(workspaceId: string, fileId: string): Promise<FileDownloadUrlResponse>;
492
+ createDocumentBase(workspaceId: string, request: CreateDocumentBaseRequest): Promise<DocumentBase>;
493
+ listDocumentBases(workspaceId: string): Promise<DocumentBase[]>;
494
+ getDocumentBase(workspaceId: string, baseId: string): Promise<DocumentBase>;
495
+ /** Index an uploaded file into the base. The file must be `ready`. */
496
+ addDocument(workspaceId: string, baseId: string, request: AddDocumentRequest): Promise<Document>;
497
+ listDocuments(workspaceId: string, baseId: string): Promise<Document[]>;
498
+ /**
499
+ * Drop raw text or an already-uploaded file into the workspace's Default
500
+ * base. When curation is enabled, it may name, summarize, categorize, and
501
+ * (confidence permitting) file the document into the best-matching base;
502
+ * provider=none leaves caller metadata and Default placement unchanged.
503
+ */
504
+ createKnowledgeDrop(workspaceId: string, request: CreateKnowledgeDropRequest): Promise<Document>;
505
+ /**
506
+ * Move a document (and its indexed chunks) to another base. With no
507
+ * targetBaseId, applies the document's stored curation suggestion.
508
+ */
509
+ moveDocument(workspaceId: string, documentId: string, request?: MoveDocumentRequest): Promise<Document>;
510
+ /** Retry indexing for a failed document. */
511
+ reindexDocument(workspaceId: string, baseId: string, documentId: string): Promise<Document>;
512
+ /**
513
+ * Delete a document from a base. Removes the document row and its indexed
514
+ * chunks while leaving the uploaded file asset available for other uses.
515
+ */
516
+ deleteDocument(workspaceId: string, baseId: string, documentId: string): Promise<void>;
517
+ searchDocuments(workspaceId: string, baseId: string, request: Omit<DocumentSearchRequest, "baseIds">): Promise<DocumentSearchResponse>;
518
+ searchKnowledge(workspaceId: string, request: DocumentSearchRequest): Promise<DocumentSearchResponse>;
519
+ listKnowledgeMemories(workspaceId: string, request?: KnowledgeMemorySearchRequest): Promise<KnowledgeMemory[]>;
520
+ getKnowledgeMemory(workspaceId: string, memoryId: string): Promise<KnowledgeMemory>;
521
+ createKnowledgeMemory(workspaceId: string, request: CreateKnowledgeMemoryRequest): Promise<KnowledgeMemory>;
522
+ updateKnowledgeMemory(workspaceId: string, memoryId: string, request: UpdateKnowledgeMemoryRequest): Promise<KnowledgeMemory>;
523
+ /** Hybrid (semantic + keyword) search over the workspace's agent-visible memory. */
524
+ searchWorkspaceMemories(workspaceId: string, request: WorkspaceMemorySearchRequest): Promise<WorkspaceMemorySearchResponse>;
525
+ /** Deep-merge a settings patch into the workspace (preserves unknown keys). */
526
+ updateWorkspaceSettings(workspaceId: string, request: UpdateWorkspaceSettingsRequest): Promise<Workspace>;
527
+ setWorkspaceDefaultRig(workspaceId: string, request: SetWorkspaceDefaultRigRequest): Promise<Workspace>;
528
+ /** Built-in + registered packs, with the workspace's installations. */
529
+ listPacks(workspaceId: string): Promise<ListPacksResponse>;
530
+ /** Register (or replace) a workspace-scoped pack from a manifest. */
531
+ registerPack(workspaceId: string, manifest: RegisterCapabilityPackRequest): Promise<WorkspaceRegisteredPack>;
532
+ getPack(workspaceId: string, packId: string): Promise<GetPackResponse>;
533
+ enablePack(workspaceId: string, packId: string, request?: EnablePackRequest): Promise<PackInstallation>;
534
+ /** Unregister a workspace-scoped pack (built-in packs cannot be deleted). */
535
+ deletePack(workspaceId: string, packId: string): Promise<void>;
536
+ listPackInstallations(workspaceId: string): Promise<PackInstallation[]>;
537
+ listCapabilities(workspaceId: string): Promise<CapabilityCatalogResponse>;
538
+ /** Add a manual capability catalog item (e.g. a remote MCP server). */
539
+ createCapability(workspaceId: string, request: CreateCapabilityCatalogItemRequest): Promise<CapabilityCatalogItem>;
540
+ enableCapability(workspaceId: string, capabilityId: string, request?: EnableCapabilityRequest): Promise<CapabilityInstallation>;
541
+ disableCapability(workspaceId: string, capabilityId: string): Promise<CapabilityInstallation>;
542
+ /** Search the official MCP registry for installable capabilities. */
543
+ discoverMcpCapabilities(workspaceId: string, options?: {
544
+ query?: string;
545
+ limit?: number;
546
+ }): Promise<DiscoverMcpCapabilitiesResponse>;
547
+ listConnections(workspaceId: string): Promise<ConnectionMetadata[]>;
548
+ createConnection(workspaceId: string, request: CreateConnectionRequest): Promise<ConnectionMetadata>;
549
+ /** Start the public Slack installation flow for the workspace-shared OpenGeni bot. */
550
+ startOpenGeniSlackBotInstall(workspaceId: string, request?: OpenGeniSlackBotInstallRequest): Promise<OpenGeniSlackBotInstallStart>;
551
+ updateConnection(workspaceId: string, connectionId: string, request: UpdateConnectionRequest): Promise<ConnectionMetadata>;
552
+ deleteConnection(workspaceId: string, connectionId: string): Promise<ConnectionMetadata>;
553
+ /** Start an OAuth connection flow; redirect the user to the returned `authorizationUrl`. */
554
+ startConnectionOAuth(workspaceId: string, request: OAuthStartRequest, options?: OpenGeniRequestOptions): Promise<OAuthStartResponse>;
555
+ /** Public, immutably-cached URL for a catalog item's logo, or null when the item has none. */
556
+ catalogAssetUrl(logoAssetPath: string | null): string | null;
557
+ /** GitHub App server configuration plus truthful workspace binding status. */
558
+ getGitHubApp(workspaceId: string): Promise<GitHubAppInfo>;
559
+ /** Build the GitHub owner-consent entry URL for fresh workspace-bound state. */
560
+ githubConnectUrl(workspaceId: string, state: string): string;
561
+ listGitHubRepositories(workspaceId: string): Promise<GitHubRepositoriesResponse>;
562
+ /** Re-sync the installation's repository list from GitHub. */
563
+ syncGitHubRepositories(workspaceId: string): Promise<GitHubRepositoriesResponse>;
564
+ /** Remove one workspace binding without uninstalling the GitHub App itself. */
565
+ unlinkGitHubInstallation(workspaceId: string, installationId: number): Promise<void>;
566
+ /** Build a GitHub App manifest + the GitHub URL to submit it to. */
567
+ createGitHubAppManifest(workspaceId: string, request?: CreateGitHubAppManifestRequest): Promise<CreateGitHubAppManifestResponse>;
568
+ listApiKeys(workspaceId: string): Promise<ApiKey[]>;
569
+ /** The returned `token` is shown once; only its prefix is stored. */
570
+ createApiKey(workspaceId: string, request: CreateApiKeyRequest): Promise<CreateApiKeyResponse>;
571
+ /** Revoke an API key. Returns the revoked key. */
572
+ deleteApiKey(workspaceId: string, apiKeyId: string): Promise<ApiKey>;
573
+ getBilling(options?: {
574
+ accountId?: string;
575
+ }): Promise<BillingSummary>;
576
+ getBillingUsage(options?: {
577
+ accountId?: string;
578
+ workspaceId?: string;
579
+ }): Promise<BillingUsageResponse>;
580
+ getWorkspaceInsights(workspaceId: string, options?: {
581
+ range?: InsightsRange;
582
+ provider?: string;
583
+ model?: string;
584
+ }): Promise<WorkspaceInsightsResponse>;
585
+ getBillingEntitlements(options?: {
586
+ accountId?: string;
587
+ }): Promise<BillingEntitlementsResponse>;
588
+ /** Start a Stripe checkout for prepaid credits. */
589
+ createBillingCheckout(request: CreateCheckoutRequest): Promise<CreateCheckoutResponse>;
590
+ private headers;
591
+ private url;
592
+ /** Connection state + the codex models the workspace may select (empty until connected). */
593
+ codexStatus(workspaceId: string): Promise<CodexConnectionStatus>;
594
+ /** Begin device-code login: show `userCode` at `verificationUri`, then poll with `state`. */
595
+ codexConnectStart(workspaceId: string): Promise<CodexConnectStart>;
596
+ /** Poll device-code authorization with the `state` from {@link codexConnectStart}. */
597
+ codexConnectPoll(workspaceId: string, state: string): Promise<CodexConnectPoll>;
598
+ /** Remaining usage / limits for the connected (ACTIVE) subscription. Back-compat. */
599
+ codexUsage(workspaceId: string): Promise<CodexUsage>;
600
+ /** Live per-account usage read (refreshes THIS account's bearer; writes the cache). */
601
+ codexAccountUsage(workspaceId: string, accountId: string): Promise<CodexUsage>;
602
+ /** Batched live refresh across every connected account, keyed by credential id. */
603
+ refreshCodexUsage(workspaceId: string): Promise<{
604
+ usage: CodexUsageMap;
605
+ }>;
606
+ /** Live independently-settled quota + reset-credit overview for every account. */
607
+ codexOverview(workspaceId: string): Promise<CodexOverviewResponse>;
608
+ /** Disconnect ALL accounts (legacy workspace-wide). Prefer `disconnectCodexAccount`. */
609
+ codexDisconnect(workspaceId: string): Promise<{
610
+ disconnected: boolean;
611
+ }>;
612
+ /** List every connected Codex account + the workspace active pointer + settings. */
613
+ listCodexAccounts(workspaceId: string): Promise<CodexAccountsResponse>;
614
+ /** Switch the workspace ACTIVE Codex account (the one unpinned sessions use). */
615
+ activateCodexAccount(workspaceId: string, accountId: string): Promise<{
616
+ activated: boolean;
617
+ accountId: string;
618
+ }>;
619
+ /** P3: enable/disable Codex auto-rotation and/or pick the strategy. Returns the effective settings. */
620
+ setCodexRotationSettings(workspaceId: string, patch: {
621
+ rotationEnabled?: boolean;
622
+ rotationStrategy?: CodexRotationSettings["rotationStrategy"];
623
+ }): Promise<CodexRotationSettings>;
624
+ /** Toggle only NEW automatic allocations under independent allocator OCC. */
625
+ setCodexAccountAllocator(workspaceId: string, accountId: string, input: {
626
+ enabled: boolean;
627
+ expectedVersion: number;
628
+ }): Promise<CodexAllocatorUpdate>;
629
+ /** Disconnect ONE Codex account by id (re-picks active when the removed one was active). */
630
+ disconnectCodexAccount(workspaceId: string, accountId: string): Promise<{
631
+ disconnected: boolean;
632
+ newActiveId: string | null;
633
+ }>;
634
+ /** Rename a Codex account (label only in P1). */
635
+ renameCodexAccount(workspaceId: string, accountId: string, label: string | null): Promise<CodexAccount>;
636
+ /** Pin (or unpin via "auto") a session's Codex account. Applies on the next turn. */
637
+ pinSessionCodexAccount(workspaceId: string, sessionId: string, target: string): Promise<{
638
+ pinned: string;
639
+ }>;
640
+ private requestJson;
641
+ /** Like `requestJson` for endpoints that respond with no body (204). */
642
+ private requestVoid;
643
+ }