@opengeni/sdk 0.29.0 → 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,3221 @@
1
+ import type { WorkspaceTranscriptionPolicy } from "./transcription";
2
+ export type SessionStatus = "queued" | "running" | "idle" | "requires_action" | "recovering" | "waiting_capacity" | "failed" | "cancelled";
3
+ export type SandboxBackend = "docker" | "modal" | "local" | "none" | "daytona" | "runloop" | "e2b" | "blaxel" | "cloudflare" | "vercel" | "selfhosted";
4
+ export type SandboxOs = "linux" | "macos" | "windows";
5
+ export type SandboxCapabilityName = "FileSystem" | "Terminal" | "Git" | "DesktopStream" | "Recording";
6
+ export type CapabilityUnavailableReason = "backend_unsupported" | "os_unsupported" | "not_provisioned" | "disabled_by_policy" | "lease_cold" | "tier_headless" | "agent_offline" | "agent_reconnecting" | "consent_required" | "display_unavailable";
7
+ export type SessionCapabilities = {
8
+ sessionId: string;
9
+ backend: SandboxBackend;
10
+ os: SandboxOs;
11
+ liveness: "cold" | "warming" | "warm" | "draining";
12
+ leaseEpoch: number;
13
+ workspaceGeneration: number | null;
14
+ archiveGeneration: number | null;
15
+ archiveComplete: boolean;
16
+ viewerHeartbeatIntervalMs: number;
17
+ FileSystem: {
18
+ available: boolean;
19
+ readOnly: boolean;
20
+ root: string;
21
+ pathSep: "/" | "\\";
22
+ treeMode: "lazy" | "snapshot";
23
+ reason: CapabilityUnavailableReason | null;
24
+ };
25
+ Terminal: {
26
+ transport: "sse-events" | "pty-ws" | null;
27
+ ptyCapable: boolean;
28
+ shell: string;
29
+ url: string | null;
30
+ token: string | null;
31
+ reason: CapabilityUnavailableReason | null;
32
+ };
33
+ Git: {
34
+ available: boolean;
35
+ repos: string[];
36
+ reason: CapabilityUnavailableReason | null;
37
+ };
38
+ DesktopStream: {
39
+ transport: "vnc-ws" | "rdp-ws" | "webrtc" | "relay-frames" | null;
40
+ client: "novnc" | "web-rdp" | "frames" | null;
41
+ mode: "read-only" | "interactive";
42
+ url: string | null;
43
+ token: string | null;
44
+ expiresAt: string | null;
45
+ resolution: [number, number];
46
+ unredacted: boolean;
47
+ requiresAcknowledgment: boolean;
48
+ acknowledged: boolean;
49
+ shared: boolean;
50
+ sharedSessionIds: string[];
51
+ reason: CapabilityUnavailableReason | null;
52
+ };
53
+ Recording: {
54
+ available: boolean;
55
+ modes: ("manual" | "on-turn" | "on-verify")[];
56
+ codecs: ("h264-mp4" | "vp9-webm")[];
57
+ reason: CapabilityUnavailableReason | null;
58
+ };
59
+ ComputerUse: {
60
+ available: boolean;
61
+ readOnly: boolean;
62
+ reason: CapabilityUnavailableReason | null;
63
+ };
64
+ negotiatedAt: string;
65
+ };
66
+ export type FileSystemCapability = SessionCapabilities["FileSystem"];
67
+ export type TerminalCapability = SessionCapabilities["Terminal"];
68
+ export type GitCapability = SessionCapabilities["Git"];
69
+ export type DesktopStreamCapability = SessionCapabilities["DesktopStream"];
70
+ export type RecordingCapability = SessionCapabilities["Recording"];
71
+ export type ComputerUseCapability = SessionCapabilities["ComputerUse"];
72
+ export type StreamUrlRotatedPayload = {
73
+ url: string;
74
+ token: string | null;
75
+ expiresAt: string | null;
76
+ leaseEpoch: number;
77
+ transport: "vnc-ws";
78
+ viewerId: string | null;
79
+ };
80
+ export type StreamOpenedPayload = {
81
+ viewerId: string;
82
+ shared: boolean;
83
+ viewerCount: number;
84
+ };
85
+ export type StreamClosedPayload = {
86
+ viewerId: string;
87
+ reason: "client-disconnect" | "reaped" | "revoked" | "box-rollover";
88
+ viewerCount: number;
89
+ };
90
+ export type StreamRevokedPayload = {
91
+ viewerId: string | null;
92
+ reason: "grant-revoked" | "session-failed" | "admin";
93
+ };
94
+ export type AttachViewerRequest = {
95
+ viewerId?: string | undefined;
96
+ desktop?: boolean | undefined;
97
+ };
98
+ export type ViewerHolder = {
99
+ viewerId: string;
100
+ sandboxGroupId: string;
101
+ liveness: "cold" | "warming" | "warm" | "draining";
102
+ leaseEpoch: number;
103
+ workspaceGeneration: number | null;
104
+ archiveGeneration: number | null;
105
+ archiveComplete: boolean;
106
+ viewerHeartbeatIntervalMs: number;
107
+ dataPlaneUrl: string | null;
108
+ };
109
+ export type AttachViewerResponse = ViewerHolder & {
110
+ streamToken: string | null;
111
+ streamExpiresAt: string | null;
112
+ resolution: [number, number] | null;
113
+ transport: "vnc-ws" | null;
114
+ client: "novnc" | null;
115
+ terminalUrl: string | null;
116
+ terminalToken: string | null;
117
+ terminalTransport: "pty-ws" | null;
118
+ };
119
+ export type AcknowledgeStreamRequest = {
120
+ acknowledgeUnredacted?: boolean | undefined;
121
+ acknowledgeShared?: boolean | undefined;
122
+ };
123
+ export type AcknowledgeStreamResponse = {
124
+ acknowledged: boolean;
125
+ acknowledgedShared: boolean;
126
+ };
127
+ export type ViewerHeartbeatRequest = {
128
+ leaseEpoch: number;
129
+ };
130
+ export type ViewerHeartbeatResponse = {
131
+ alive: boolean;
132
+ };
133
+ export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
134
+ export type LatencyMode = "standard" | "priority" | "fast";
135
+ export type GitCredentialProvider = "github" | "gitlab" | "azure_devops";
136
+ export type GitCredentialBindingId = string;
137
+ export type GitRepositoryAccess = "read" | "write";
138
+ export type RepositoryResourceRef = {
139
+ kind: "repository";
140
+ uri: string;
141
+ ref: string;
142
+ /**
143
+ * Optional workspace-relative override. When omitted, OpenGeni persists
144
+ * `repos/<encoded-host>/<owner>/<repo>` so equal names on different Git
145
+ * providers do not collide. Explicit paths are portable, traversal-free, and
146
+ * collision-checked case-insensitively before sandbox execution.
147
+ */
148
+ mountPath?: string | undefined;
149
+ subpath?: string | undefined;
150
+ provider?: GitCredentialProvider | undefined;
151
+ credentialBindingId?: GitCredentialBindingId | undefined;
152
+ access?: GitRepositoryAccess | undefined;
153
+ repositoryId?: number | string | undefined;
154
+ installationId?: number | string | undefined;
155
+ projectId?: number | string | undefined;
156
+ connectionId?: string | undefined;
157
+ githubInstallationId?: number | undefined;
158
+ githubRepositoryId?: number | undefined;
159
+ };
160
+ export type FileResourceRef = {
161
+ kind: "file";
162
+ fileId: string;
163
+ /** Optional workspace-relative override; defaults to `files/<file-id>`. */
164
+ mountPath?: string | undefined;
165
+ };
166
+ export type ResourceRef = RepositoryResourceRef | FileResourceRef;
167
+ export type ToolRef = {
168
+ kind: "mcp";
169
+ id: string;
170
+ optional?: boolean | undefined;
171
+ };
172
+ export type SessionToolPolicy = {
173
+ mode: "workspace_default" | "explicit" | "inherited";
174
+ inheritedFromSessionId: string | null;
175
+ };
176
+ export type UpdateSessionToolPolicyRequest = {
177
+ mode: "workspace_default";
178
+ expectedVersion: number;
179
+ } | {
180
+ mode: "explicit";
181
+ tools: ToolRef[];
182
+ firstPartyMcpTools: FirstPartyMcpToolName[];
183
+ expectedVersion: number;
184
+ };
185
+ export type SessionEffectiveToolPolicy = {
186
+ mode: SessionToolPolicy["mode"];
187
+ inheritedFromSessionId: string | null;
188
+ selectedIds: string[];
189
+ effectiveIds: string[];
190
+ mandatoryIds: string[];
191
+ lazyRouter: {
192
+ state: "required" | "disabled";
193
+ deferredIds: string[];
194
+ };
195
+ configuredIds: string[];
196
+ droppedIds: string[];
197
+ counts: {
198
+ selected: number;
199
+ effective: number;
200
+ mandatory: number;
201
+ deferred: number;
202
+ configured: number;
203
+ dropped: number;
204
+ };
205
+ idsTruncated: boolean;
206
+ };
207
+ export type GoalSpec = {
208
+ text: string;
209
+ successCriteria?: string | undefined;
210
+ maxAutoContinuations?: number | undefined;
211
+ };
212
+ export type SessionMcpServerInput = {
213
+ id: string;
214
+ name?: string | undefined;
215
+ url: string;
216
+ allowedTools?: string[] | undefined;
217
+ timeoutMs?: number | undefined;
218
+ cacheToolsList?: boolean | undefined;
219
+ /** Require human approval for every tool, or only the listed unprefixed tool names. */
220
+ requireApproval?: boolean | string[] | undefined;
221
+ headers?: Record<string, string> | undefined;
222
+ connectionRef?: McpServerConnectionRef | undefined;
223
+ };
224
+ export type SessionMcpCredentialUpdateInput = {
225
+ id: string;
226
+ headers: Record<string, string>;
227
+ };
228
+ export type SessionMcpApprovalPolicy = boolean | string[];
229
+ export type SessionMcpServerMetadata = {
230
+ id: string;
231
+ name: string | null;
232
+ url: string;
233
+ headerNames: string[];
234
+ credentialVersion: number;
235
+ requireApproval: SessionMcpApprovalPolicy;
236
+ connectionRef: McpServerConnectionRef | null;
237
+ };
238
+ export type UpdateSessionMcpApprovalPolicyRequest = {
239
+ requireApproval: SessionMcpApprovalPolicy;
240
+ };
241
+ export type UpdateSessionMcpApprovalPolicyResponse = {
242
+ server: SessionMcpServerMetadata;
243
+ effectiveFrom: "next_attempt";
244
+ };
245
+ export type ConnectionKind = "oauth2" | "api_key" | "app_install" | "delegated";
246
+ export type ConnectionStatus = "active" | "needs_reauth" | "revoked" | "error";
247
+ export type McpServerConnectionRef = {
248
+ connectionId?: string | undefined;
249
+ provider?: string | undefined;
250
+ providerDomain: string;
251
+ kind?: ConnectionKind | undefined;
252
+ scopes?: string[] | undefined;
253
+ resource?: string | undefined;
254
+ selectedResources?: Array<{
255
+ id: string;
256
+ kind: "repository";
257
+ }> | undefined;
258
+ subjectScope?: "workspace" | "subject" | undefined;
259
+ };
260
+ export type ConnectionMetadata = {
261
+ id: string;
262
+ accountId: string;
263
+ workspaceId: string;
264
+ subjectId: string | null;
265
+ providerDomain: string;
266
+ kind: ConnectionKind;
267
+ status: ConnectionStatus;
268
+ grantedScopes: string[];
269
+ expiresAt: string | null;
270
+ lastRefreshAt: string | null;
271
+ lastUsedAt: string | null;
272
+ lastError: string | null;
273
+ version: number;
274
+ verifiedInstallAt?: string | null;
275
+ verifiedInstallVersion?: number | null;
276
+ metadata: Record<string, unknown>;
277
+ createdBySubjectId: string | null;
278
+ updatedBySubjectId: string | null;
279
+ createdAt: string;
280
+ updatedAt: string;
281
+ };
282
+ export type CreateConnectionRequest = {
283
+ providerDomain: string;
284
+ kind: ConnectionKind;
285
+ subjectId?: string | null | undefined;
286
+ credential: Record<string, unknown>;
287
+ grantedScopes?: string[] | undefined;
288
+ expiresAt?: string | null | undefined;
289
+ metadata?: Record<string, unknown> | undefined;
290
+ };
291
+ export type OpenGeniSlackBotInstallRequest = {
292
+ /** Existing OpenGeni Slack bot connection to reinstall in place. */
293
+ connectionId?: string | undefined;
294
+ };
295
+ export type OpenGeniSlackBotInstallStart = {
296
+ authorizationUrl: string;
297
+ expiresAt: string;
298
+ };
299
+ export type GoogleDriveTargetScope = "user" | "workspace" | "organization";
300
+ export type GoogleDriveSyncCadence = "manual" | "hourly" | "daily";
301
+ export type GoogleDriveReadPolicy = "allow" | "ask" | "block";
302
+ export type GoogleDriveSelectedSource = {
303
+ id: string;
304
+ name: string;
305
+ mimeType: string;
306
+ driveId: string | null;
307
+ targetScope: GoogleDriveTargetScope;
308
+ syncCadence: GoogleDriveSyncCadence;
309
+ readPolicy: GoogleDriveReadPolicy;
310
+ selectedAt: string;
311
+ };
312
+ export type GoogleDriveConnectionMetadata = {
313
+ credentialRole: "google_drive_metadata";
314
+ credentialLabel: "Google Drive metadata browser";
315
+ googlePermissionId: string;
316
+ googleEmail: string;
317
+ googleDisplayName: string | null;
318
+ verifiedAt: string;
319
+ accessMode: "metadata_readonly" | "readonly";
320
+ selectedSources?: GoogleDriveSelectedSource[] | undefined;
321
+ /** @deprecated Read selectedSources; retained while existing connections migrate. */
322
+ selectedSource?: GoogleDriveSelectedSource | null | undefined;
323
+ [key: string]: unknown;
324
+ };
325
+ export type GoogleDriveOAuthStartRequest = {
326
+ connectionId?: string | undefined;
327
+ };
328
+ export type GoogleDriveOAuthStartResponse = {
329
+ authorizationUrl: string;
330
+ expiresAt: string;
331
+ };
332
+ export type GoogleDriveBrowseItem = {
333
+ id: string;
334
+ name: string;
335
+ mimeType: string;
336
+ kind: "folder" | "file";
337
+ driveId: string | null;
338
+ modifiedTime: string | null;
339
+ size: string | null;
340
+ webViewLink: string | null;
341
+ };
342
+ export type GoogleDriveBrowseResponse = {
343
+ connection: ConnectionMetadata;
344
+ parentId: string;
345
+ current: GoogleDriveBrowseItem | null;
346
+ items: GoogleDriveBrowseItem[];
347
+ nextPageToken: string | null;
348
+ incompleteSearch: boolean;
349
+ };
350
+ export type SaveGoogleDriveSourceRequest = {
351
+ sources: Array<Pick<GoogleDriveBrowseItem, "id" | "name" | "mimeType" | "driveId">>;
352
+ targetScope: GoogleDriveTargetScope;
353
+ syncCadence: GoogleDriveSyncCadence;
354
+ readPolicy: GoogleDriveReadPolicy;
355
+ };
356
+ export type UpdateConnectionRequest = {
357
+ providerDomain?: string | undefined;
358
+ subjectId?: string | null | undefined;
359
+ kind?: ConnectionKind | undefined;
360
+ status?: ConnectionStatus | undefined;
361
+ credential?: Record<string, unknown> | undefined;
362
+ grantedScopes?: string[] | undefined;
363
+ expiresAt?: string | null | undefined;
364
+ metadata?: Record<string, unknown> | undefined;
365
+ };
366
+ export type ConnectionResponse = {
367
+ connection: ConnectionMetadata;
368
+ };
369
+ export type ListConnectionsResponse = {
370
+ connections: ConnectionMetadata[];
371
+ };
372
+ export type OAuthStartRequest = {
373
+ providerDomain?: string | undefined;
374
+ mcpUrl?: string | undefined;
375
+ resource?: string | undefined;
376
+ requestedScopes?: string[] | undefined;
377
+ returnPath?: string | undefined;
378
+ connectionId?: string | undefined;
379
+ oauthClient?: {
380
+ clientId: string;
381
+ clientSecret?: string | undefined;
382
+ tokenEndpointAuthMethod?: "none" | "client_secret_post" | "client_secret_basic" | undefined;
383
+ } | undefined;
384
+ };
385
+ export type OAuthStartResponse = {
386
+ state: string;
387
+ authorizationUrl: string | null;
388
+ expiresAt: string;
389
+ };
390
+ /** The immutable principal whose authority accepted a session or turn. */
391
+ export type TurnInitiator = {
392
+ kind: "subject" | "service";
393
+ subjectId: string;
394
+ /** Display-only snapshot; never an authorization input. */
395
+ label?: string | undefined;
396
+ };
397
+ /** A trusted embedding host's causal machine/service principal. */
398
+ export type ServiceTurnInitiator = TurnInitiator & {
399
+ kind: "service";
400
+ };
401
+ /** Bounded host provenance; OpenGeni-owned lineage keys are reserved. */
402
+ export type ServiceTurnInitiatorContext = Record<string, unknown>;
403
+ export type IntegrationClientMetadata = {
404
+ client_id: string;
405
+ client_name: "OpenGeni";
406
+ redirect_uris: string[];
407
+ token_endpoint_auth_method: "none";
408
+ grant_types: Array<"authorization_code" | "refresh_token">;
409
+ response_types: ["code"];
410
+ };
411
+ export type Session = {
412
+ id: string;
413
+ workspaceId: string;
414
+ accountId: string;
415
+ status: SessionStatus;
416
+ initialMessage: string;
417
+ title: string | null;
418
+ titleSource: "user" | "agent" | null;
419
+ instructions: string | null;
420
+ resources: ResourceRef[];
421
+ skills: SessionSkill[];
422
+ tools: ToolRef[];
423
+ toolPolicy: SessionToolPolicy;
424
+ toolPolicyVersion: number;
425
+ effectiveToolPolicy?: SessionEffectiveToolPolicy | undefined;
426
+ metadata: Record<string, unknown>;
427
+ /** Frozen creator fact; later turns carry their own independent initiator. */
428
+ createdBy: TurnInitiator;
429
+ createdByContext: Record<string, unknown>;
430
+ model: string;
431
+ sandboxBackend: SandboxBackend;
432
+ sandboxOs: SandboxOs;
433
+ sandboxGroupId: string;
434
+ activeSandboxId: string | null;
435
+ activeEpoch: number;
436
+ variableSetId: string | null;
437
+ /** @deprecated use variableSetId */
438
+ environmentId: string | null;
439
+ rigId: string | null;
440
+ rigVersionId: string | null;
441
+ firstPartyMcpPermissions: string[] | null;
442
+ firstPartyMcpTools: FirstPartyMcpToolName[];
443
+ mcpServers: SessionMcpServerMetadata[];
444
+ parentSessionId: string | null;
445
+ /** Immutable server-authored nested-agent lineage and policy snapshot. */
446
+ rootSessionId: string;
447
+ nestedAgentDepth: number;
448
+ maxNestedAgentDepthOverride: number | null;
449
+ effectiveMaxNestedAgentDepth: number;
450
+ nestedAgentDepthPolicySource: "session" | "workspace" | "deployment" | "default";
451
+ nestedAgentDepthPolicySessionId: string | null;
452
+ createIdempotencyKey: string | null;
453
+ temporalWorkflowId: string | null;
454
+ activeTurnId: string | null;
455
+ queueVersion: number;
456
+ queueHeadPosition: number;
457
+ queueTailPosition: number;
458
+ effectiveControl: EffectiveSessionControl;
459
+ lastSequence: number;
460
+ /** Multi-account Codex (P1): the account this session is pinned to (null ⇒ follow workspace active). */
461
+ codexPinnedCredentialId?: string | null;
462
+ /** Multi-account Codex (P1): the account the most recent turn ran on (the "Running on:" indicator). */
463
+ codexLastCredentialId?: string | null;
464
+ /**
465
+ * Frozen at create. `remote_v2` ⇒ Codex remote compaction + Codex-only model
466
+ * admission; `portable` ⇒ plaintext compaction and free provider switching.
467
+ */
468
+ codexCompactionMode: "remote_v2" | "portable";
469
+ /** Personal (authenticated subject) workspace pin state, never workspace-global. */
470
+ pinned?: boolean;
471
+ /** Stable pin ordering key; null when this subject has not pinned the session. */
472
+ pinnedAt?: string | null;
473
+ /** Optimistic pin-state revision; zero represents an absent pin relation. */
474
+ pinVersion?: number;
475
+ /** Server-authoritative descendant counts populated by session-list reads. */
476
+ treeStats?: {
477
+ directChildren: number;
478
+ totalDescendants: number;
479
+ runningDescendants: number;
480
+ queuedDescendants: number;
481
+ attentionDescendants: number;
482
+ pausedDescendants: number;
483
+ failedDescendants: number;
484
+ /** Counts are lower bounds rather than exact totals when true. */
485
+ truncated: boolean;
486
+ } | undefined;
487
+ createdAt: string;
488
+ updatedAt: string;
489
+ };
490
+ /** Additive receipt returned by POST /sessions. */
491
+ export type CreateSessionResponse = Session & {
492
+ initialTurnId: string | null;
493
+ };
494
+ export type SessionSummary = Session;
495
+ /** Canonical session-list page; pinned rows are excluded from ordinary pages. */
496
+ export type SessionListResponse = {
497
+ pinned: Session[];
498
+ /** True when the server omitted older pins from its bounded pinned section. */
499
+ pinnedTruncated?: boolean;
500
+ sessions: Session[];
501
+ nextCursor: string | null;
502
+ };
503
+ export type UpdateSessionPinRequest = {
504
+ pinned: boolean;
505
+ expectedVersion?: number;
506
+ };
507
+ export type LineageNode = {
508
+ session: SessionSummary;
509
+ children: LineageNode[];
510
+ };
511
+ export type SessionLineageResponse = {
512
+ ancestors: SessionSummary[];
513
+ children: LineageNode[];
514
+ truncated: boolean;
515
+ };
516
+ export type SessionTurnStatus = "queued" | "running" | "requires_action" | "recovering" | "waiting_capacity" | "completed" | "failed" | "cancelled" | "superseded" | "withdrawn_for_edit";
517
+ export type SessionTurnSource = "user" | "scheduled_task" | "api" | "goal" | "system" | "compaction";
518
+ export type SessionTurn = {
519
+ id: string;
520
+ workspaceId: string;
521
+ sessionId: string;
522
+ triggerEventId: string;
523
+ temporalWorkflowId: string;
524
+ status: SessionTurnStatus;
525
+ source: SessionTurnSource;
526
+ position: number;
527
+ prompt: string;
528
+ resources: ResourceRef[];
529
+ tools: ToolRef[];
530
+ toolsProvided?: boolean | undefined;
531
+ model: string;
532
+ reasoningEffort: ReasoningEffort;
533
+ latencyMode: LatencyMode;
534
+ sandboxBackend: SandboxBackend;
535
+ sandboxOs: SandboxOs | null;
536
+ metadata: Record<string, unknown>;
537
+ version: number;
538
+ executionGeneration: number;
539
+ activeAttemptId: string | null;
540
+ lineage: Record<string, unknown>;
541
+ initiator: TurnInitiator;
542
+ initiatorContext: Record<string, unknown>;
543
+ cancelledBy?: string | null;
544
+ cancelReason?: string | null;
545
+ startedAt: string | null;
546
+ finishedAt: string | null;
547
+ createdAt: string;
548
+ updatedAt: string;
549
+ };
550
+ export type HumanInputQuestionKind = "text" | "single_select" | "multi_select";
551
+ export type HumanInputOption = {
552
+ id: string;
553
+ label: string;
554
+ description?: string | null | undefined;
555
+ };
556
+ export type HumanInputQuestion = {
557
+ id: string;
558
+ kind: HumanInputQuestionKind;
559
+ prompt: string;
560
+ label?: string | null | undefined;
561
+ helpText?: string | null | undefined;
562
+ options: HumanInputOption[];
563
+ required: boolean;
564
+ allowOther: boolean;
565
+ validation?: {
566
+ minLength?: number | null | undefined;
567
+ maxLength?: number | null | undefined;
568
+ minSelections?: number | null | undefined;
569
+ maxSelections?: number | null | undefined;
570
+ } | null | undefined;
571
+ };
572
+ export type HumanInputAnswer = {
573
+ questionId: string;
574
+ values: string[];
575
+ other?: string | null | undefined;
576
+ };
577
+ export type HumanInputResponse = {
578
+ outcome: "answered";
579
+ answers: HumanInputAnswer[];
580
+ } | {
581
+ outcome: "skipped" | "expired" | "cancelled";
582
+ };
583
+ export type SubmitHumanInputResponseRequest = {
584
+ outcome: "answered";
585
+ answers: HumanInputAnswer[];
586
+ } | {
587
+ outcome: "skipped";
588
+ };
589
+ export type SessionHumanInputRequest = {
590
+ id: string;
591
+ workspaceId: string;
592
+ sessionId: string;
593
+ turnId: string;
594
+ turnGeneration: number;
595
+ creationAttemptId: string;
596
+ toolCallId: string;
597
+ status: "pending" | "answered" | "skipped" | "expired" | "cancelled";
598
+ questions: HumanInputQuestion[];
599
+ allowSkip: boolean;
600
+ response: HumanInputResponse | null;
601
+ respondedBy: string | null;
602
+ respondedAt: string | null;
603
+ expiresAt: string | null;
604
+ createdAt: string;
605
+ updatedAt: string;
606
+ };
607
+ export declare const SESSION_EVENT_TYPES: readonly ["session.created", "session.event.envelope_omitted", "session.status.changed", "session.requiresAction", "session.humanInput.requested", "session.context.compaction.requested", "session.context.compaction.started", "session.context.compacted", "session.context.compaction.skipped", "session.context.cleared", "user.message", "user.pause", "user.approvalDecision", "user.humanInputResponse", "turn.queued", "turn.started", "turn.completed", "turn.failed", "turn.cancelled", "turn.superseded", "turn.recovery.requested", "turn.capacity_waiting", "agent.message.delta", "agent.message.completed", "agent.reasoning.delta", "agent.toolCall.created", "agent.toolCall.output", "agent.model.request", "agent.model.usage", "tool.auth_needed", "credential.auth_needed", "agent.updated", "rig.setup.started", "rig.setup.completed", "rig.setup.skipped", "rig.setup.failed", "sandbox.operation.started", "sandbox.operation.completed", "sandbox.operation.failed", "sandbox.command.output.delta", "artifact.created", "goal.set", "goal.updated", "goal.completed", "goal.paused", "goal.resumed", "goal.cleared", "goal.continuation", "system.update.pending", "system.update.delivered", "system.update.superseded", "system.update.cancelled", "system.update.settled", "session.control.paused", "session.control.resumed", "session.control.steer_requested", "workspace.inference.paused", "workspace.inference.resumed", "session.queue.changed", "session.queue.prompt.cancelled", "session.queue.history", "turn.event.rejected_late", "memory.saved", "memory.corrected", "stream.url.rotated", "stream.opened", "stream.closed", "stream.revoked", "recording.started", "recording.available", "recording.failed", "fs.changed", "git.changed", "terminal.pty.started", "terminal.pty.output.delta", "terminal.pty.exited", "session.title_set", "session.mcp.approval_policy.updated", "session.tool_policy.updated", "codex.account.switched", "codex.credential.selected", "codex.fleet.decision", "codex.capacity.waiting", "codex.capacity.resumed", "codex.capacity.superseded", "sandbox.box.created", "sandbox.box.lost", "sandbox.box.terminated", "sandbox.box.snapshot", "sandbox.env.drift", "session.route.reconciled", "workspace.revision.captured", "workspace.revision.degraded", "machine.op.failed", "machine.op.recovered", "machine.link.lost", "machine.link.restored", "machine.runner.restarted"];
608
+ export type KnownSessionEventType = (typeof SESSION_EVENT_TYPES)[number];
609
+ /**
610
+ * Event types the SDK knows about today, kept open so a newer OpenGeni server
611
+ * can introduce event types without breaking older SDK consumers.
612
+ */
613
+ export type SessionEventType = KnownSessionEventType | (string & {});
614
+ export type SessionEvent = {
615
+ id: string;
616
+ workspaceId: string;
617
+ sessionId: string;
618
+ /** Per-session sequence number: positive, contiguous, strictly increasing. */
619
+ sequence: number;
620
+ type: SessionEventType;
621
+ payload: unknown;
622
+ occurredAt: string;
623
+ clientEventId?: string | null | undefined;
624
+ turnId?: string | null | undefined;
625
+ turnGeneration?: number | null | undefined;
626
+ turnAttemptId?: string | null | undefined;
627
+ turnAssociation?: "current" | "late_rejected" | "duplicate" | null | undefined;
628
+ duplicateOfEventId?: string | null | undefined;
629
+ duplicateReason?: string | null | undefined;
630
+ };
631
+ export type SessionEventSemanticClass = "control" | "terminal" | "failure" | "checkpoint" | "tool_receipt" | "provider_account";
632
+ export type SessionEventLatestClass = SessionEventSemanticClass | "receipt";
633
+ export type SessionEventPayloadMode = "none" | "summary" | "full";
634
+ export type SessionEventReadMode = "monitoring" | "forensic";
635
+ export type SessionEventReadDirection = "after" | "before";
636
+ export type SessionEventResultMode = "events" | "compact";
637
+ type SessionEventListCommonOptions = {
638
+ after?: number;
639
+ before?: number;
640
+ limit?: number;
641
+ compact?: boolean;
642
+ mode?: SessionEventReadMode;
643
+ direction?: SessionEventReadDirection;
644
+ payloadMode?: SessionEventPayloadMode;
645
+ resultMode?: "events";
646
+ };
647
+ export type SessionEventListOptions = SessionEventListCommonOptions & ({
648
+ latest?: never;
649
+ includeTypes?: SessionEventType[];
650
+ excludeTypes?: SessionEventType[];
651
+ includeClasses?: SessionEventSemanticClass[];
652
+ excludeClasses?: SessionEventSemanticClass[];
653
+ } | {
654
+ /** Exclusive lookup for the newest event in exactly this semantic class. */
655
+ latest: SessionEventLatestClass;
656
+ includeTypes?: never;
657
+ excludeTypes?: never;
658
+ includeClasses?: never;
659
+ excludeClasses?: never;
660
+ });
661
+ export type SessionEventCompactResult = {
662
+ version: 1;
663
+ semanticClass: SessionEventSemanticClass;
664
+ source: {
665
+ id: string;
666
+ type: SessionEventType;
667
+ sequence: number;
668
+ occurredAt: string;
669
+ turnId: string | null;
670
+ turnGeneration: number | null;
671
+ turnAttemptId: string | null;
672
+ turnAssociation: SessionEvent["turnAssociation"];
673
+ };
674
+ id: string;
675
+ type: SessionEventType;
676
+ sequence: number;
677
+ occurredAt: string;
678
+ turnId: string | null;
679
+ turnGeneration: number | null;
680
+ turnAttemptId: string | null;
681
+ turnAssociation: SessionEvent["turnAssociation"];
682
+ coveredSequence: {
683
+ first: number;
684
+ last: number;
685
+ };
686
+ status: "completed" | "failed" | "cancelled" | "superseded" | "checkpoint" | "receipt" | "unknown";
687
+ text: string | null;
688
+ output: unknown;
689
+ result: unknown;
690
+ failure: {
691
+ error: string | null;
692
+ code: string | null;
693
+ retryable: boolean | null;
694
+ recovery: string | null;
695
+ } | null;
696
+ checkpoint: unknown;
697
+ receipt: unknown;
698
+ truncation: {
699
+ truncated: boolean;
700
+ fields: string[];
701
+ originalBytes: number | null;
702
+ deliveredBytes: number;
703
+ };
704
+ };
705
+ export type SessionEventCompactResultOptions = {
706
+ latest: SessionEventLatestClass;
707
+ resultMode: "compact";
708
+ mode?: SessionEventReadMode;
709
+ payloadMode?: SessionEventPayloadMode;
710
+ };
711
+ export type SessionEventPage = {
712
+ events: SessionEvent[];
713
+ mode: SessionEventReadMode;
714
+ payloadMode: SessionEventPayloadMode;
715
+ direction: SessionEventReadDirection;
716
+ bytes: number;
717
+ maxBytes: number;
718
+ truncated: boolean;
719
+ hasMore: boolean;
720
+ truncatedBy: "count" | "bytes" | "http_bytes" | null;
721
+ coveredSequence: {
722
+ first: number;
723
+ last: number;
724
+ } | null;
725
+ nextAfter: number | null;
726
+ nextBefore: number | null;
727
+ forensicExact: boolean;
728
+ };
729
+ export type ToolAuthNeededPayload = {
730
+ serverId: string;
731
+ toolName?: string | null | undefined;
732
+ providerDomain: string;
733
+ provider?: string | undefined;
734
+ connectionId?: string | null | undefined;
735
+ reason: "missing_connection" | "expired" | "insufficient_scope" | "refresh_failed" | "unsupported_auth" | "resource_scope_unavailable";
736
+ scopes?: string[] | undefined;
737
+ resource?: string | undefined;
738
+ selectedResources?: Array<{
739
+ id: string;
740
+ kind: "repository";
741
+ }> | undefined;
742
+ authorizationUrl?: string | undefined;
743
+ subjectId?: string | null | undefined;
744
+ };
745
+ export type AgentTextDeltaPayload = {
746
+ text: string;
747
+ };
748
+ export type AgentMessageCompletedPayload = {
749
+ text: string;
750
+ };
751
+ export type AgentToolCallCreatedPayload = {
752
+ id: string | null;
753
+ name: string;
754
+ arguments: unknown;
755
+ raw?: unknown | undefined;
756
+ };
757
+ export type AgentToolCallOutputPayload = {
758
+ id: string | null;
759
+ output: unknown;
760
+ };
761
+ export type SessionStatusChangedPayload = {
762
+ status: SessionStatus;
763
+ };
764
+ export type CodexFleetConfidence = "unknown" | "low" | "medium" | "high";
765
+ export type CodexFleetCacheState = "unknown" | "healthy" | "collapsed";
766
+ export type CodexFleetShadowComparison = "match" | "different_candidate" | "different_outcome" | "not_comparable_truncated";
767
+ export type CodexFleetDecisionScore = {
768
+ candidateKey: string;
769
+ eligible: boolean;
770
+ rejectionReason: "allocator_disabled" | "unavailable" | "cooling" | "quota_ceiling" | "overlay_isolation" | null;
771
+ quotaPressure: number;
772
+ leasePressure: number;
773
+ observedBurnPressure: number;
774
+ inferredBurnPressure: number;
775
+ runwayPressure: number;
776
+ uncertaintyPressure: number;
777
+ cacheAffinityBenefit: number;
778
+ cacheState: CodexFleetCacheState;
779
+ overlayPreferenceBenefit: number;
780
+ total: number;
781
+ confidence: CodexFleetConfidence;
782
+ };
783
+ export type CodexFleetDecisionEventPayload = {
784
+ schemaVersion: 1;
785
+ mode: "shadow";
786
+ actual: {
787
+ outcome: "selected" | "waiting" | "none";
788
+ candidateKey: string | null;
789
+ reason: "lease_reused" | "pin" | "rotation" | "active" | "all_capped" | "none";
790
+ };
791
+ comparison: CodexFleetShadowComparison;
792
+ replay: {
793
+ schemaVersion: 1;
794
+ policyVersion: "adaptive-shadow-v1";
795
+ mode: "shadow";
796
+ input: {
797
+ candidates: Array<{
798
+ key: string;
799
+ }>;
800
+ } & Record<string, unknown>;
801
+ truncatedCandidateCount: number;
802
+ inputFingerprint: string;
803
+ decisionFingerprint: string;
804
+ decision: {
805
+ outcome: "selected" | "paced" | "none";
806
+ selectedCandidateKey: string | null;
807
+ reason: "fenced_in_flight" | "fenced_candidate_missing" | "admission_paced" | "no_eligible_candidate" | "overlay_isolated_empty" | "best_score" | "affinity_best" | "hysteresis_hold";
808
+ admission: {
809
+ outcome: "admit" | "pace";
810
+ reason: "fenced_in_flight" | "pacing_disabled" | "capacity_unknown" | "capacity_available" | "work_conserving_borrow" | "manager_priority" | "standard_starvation_bound" | "capacity_saturated" | "emergency_fuse";
811
+ borrowedIdleCapacity: boolean;
812
+ };
813
+ borrowedOverlayCapacity: boolean;
814
+ strandedEligibleCount: number;
815
+ confidence: CodexFleetConfidence;
816
+ scores: CodexFleetDecisionScore[];
817
+ };
818
+ } & Record<string, unknown>;
819
+ };
820
+ export type RecordingMode = "manual" | "on-turn" | "on-verify";
821
+ export type RecordingCodec = "h264-mp4" | "vp9-webm";
822
+ export type RecordingContentType = "video/mp4" | "video/webm";
823
+ export type RecordingFailedReason = "ffmpeg-error" | "box-death" | "box-rollover" | "upload-failed" | "max-bytes-exceeded" | "display-unavailable";
824
+ export type RecordingStartedPayload = {
825
+ recordingId: string;
826
+ turnId: string | null;
827
+ mode: RecordingMode;
828
+ codec: RecordingCodec;
829
+ dimensions: [number, number];
830
+ framerate: number;
831
+ startedAt: string;
832
+ reason?: string | null | undefined;
833
+ };
834
+ export type RecordingAvailablePayload = {
835
+ recordingId: string;
836
+ turnId: string | null;
837
+ codec: RecordingCodec;
838
+ contentType: RecordingContentType;
839
+ storageKey: string;
840
+ durationSeconds: number | null;
841
+ sizeBytes: number;
842
+ dimensions: [number, number];
843
+ };
844
+ export type RecordingFailedPayload = {
845
+ recordingId: string;
846
+ turnId: string | null;
847
+ reason: RecordingFailedReason;
848
+ detail?: string | null | undefined;
849
+ };
850
+ export type SandboxCommandOutputDeltaPayload = {
851
+ stream: "stdout" | "stderr";
852
+ chunk: string;
853
+ commandId?: string | undefined;
854
+ seq?: number | undefined;
855
+ };
856
+ export type FsChangeKind = "created" | "modified" | "deleted" | "renamed";
857
+ export type FsChangedPayload = {
858
+ changes: {
859
+ path: string;
860
+ kind: FsChangeKind;
861
+ isDir: boolean;
862
+ sizeBytes: number | null;
863
+ oldPath?: string | undefined;
864
+ }[];
865
+ source: "write" | "watch" | "agent";
866
+ revision: number;
867
+ leaseEpoch: number;
868
+ };
869
+ export type GitChangedPayload = {
870
+ head: string | null;
871
+ dirty: boolean;
872
+ ahead: number;
873
+ behind: number;
874
+ changedFileCount: number;
875
+ reason: "commit" | "checkout" | "stage" | "worktree" | "fetch" | "unknown";
876
+ revision: number;
877
+ leaseEpoch: number;
878
+ };
879
+ export type TerminalPtyStartedPayload = {
880
+ ptyId: string;
881
+ cols: number;
882
+ rows: number;
883
+ shell: string;
884
+ cwd: string;
885
+ };
886
+ export type TerminalPtyOutputDeltaPayload = {
887
+ ptyId: string;
888
+ stream: "stdout" | "stderr";
889
+ chunk: string;
890
+ seq: number;
891
+ };
892
+ export type TerminalPtyExitedPayload = {
893
+ ptyId: string;
894
+ exitCode: number | null;
895
+ reason: "exit" | "killed" | "owner_gone" | "timeout" | "lost";
896
+ };
897
+ export type FsNodeType = "file" | "dir" | "symlink" | "other";
898
+ export type FsTreeNode = {
899
+ name: string;
900
+ path: string;
901
+ type: FsNodeType;
902
+ sizeBytes: number | null;
903
+ mtimeMs: number | null;
904
+ mode: number | null;
905
+ children?: FsTreeNode[] | undefined;
906
+ truncated: boolean;
907
+ };
908
+ export type FsEncoding = "utf8" | "base64";
909
+ export type FsListRequest = {
910
+ path?: string;
911
+ depth?: number;
912
+ maxEntries?: number;
913
+ includeHidden?: boolean;
914
+ };
915
+ export type FsListResponse = {
916
+ root: FsTreeNode;
917
+ revision: number;
918
+ truncated: boolean;
919
+ };
920
+ export type FsReadRequest = {
921
+ path: string;
922
+ encoding?: FsEncoding;
923
+ maxBytes?: number;
924
+ };
925
+ export type FsReadResponse = {
926
+ path: string;
927
+ encoding: FsEncoding;
928
+ content: string;
929
+ sizeBytes: number;
930
+ truncated: boolean;
931
+ isBinary: boolean;
932
+ revision: number;
933
+ };
934
+ export type FsWriteRequest = {
935
+ path: string;
936
+ encoding?: FsEncoding;
937
+ content: string;
938
+ overwrite?: boolean;
939
+ createParents?: boolean;
940
+ };
941
+ export type FsWriteResponse = {
942
+ path: string;
943
+ sizeBytes: number;
944
+ revision: number;
945
+ };
946
+ export type FsDeleteRequest = {
947
+ path: string;
948
+ recursive?: boolean;
949
+ };
950
+ export type FsDeleteResponse = {
951
+ revision: number;
952
+ };
953
+ export type FsMoveRequest = {
954
+ path: string;
955
+ newPath: string;
956
+ overwrite?: boolean;
957
+ createParents?: boolean;
958
+ };
959
+ export type FsMoveResponse = {
960
+ path: string;
961
+ newPath: string;
962
+ revision: number;
963
+ };
964
+ export type FsMkdirRequest = {
965
+ path: string;
966
+ recursive?: boolean;
967
+ };
968
+ export type FsMkdirResponse = {
969
+ path: string;
970
+ revision: number;
971
+ };
972
+ export type GitFileStatusCode = "added" | "modified" | "deleted" | "renamed" | "copied" | "untracked" | "ignored" | "conflicted" | "typechange";
973
+ export type GitFileStatus = {
974
+ path: string;
975
+ oldPath: string | null;
976
+ index: GitFileStatusCode | null;
977
+ worktree: GitFileStatusCode | null;
978
+ isConflicted: boolean;
979
+ };
980
+ export type GitStatusRequest = {
981
+ path?: string;
982
+ };
983
+ export type GitStatusResponse = {
984
+ isRepo: boolean;
985
+ head: string | null;
986
+ detached: boolean;
987
+ upstream: string | null;
988
+ ahead: number;
989
+ behind: number;
990
+ files: GitFileStatus[];
991
+ revision: number;
992
+ };
993
+ export type GitDiffLineType = "context" | "add" | "del" | "meta";
994
+ export type GitDiffLine = {
995
+ type: GitDiffLineType;
996
+ oldNo: number | null;
997
+ newNo: number | null;
998
+ text: string;
999
+ };
1000
+ export type GitDiffHunk = {
1001
+ oldStart: number;
1002
+ oldLines: number;
1003
+ newStart: number;
1004
+ newLines: number;
1005
+ header: string;
1006
+ lines: GitDiffLine[];
1007
+ };
1008
+ export type GitFileDiff = {
1009
+ path: string;
1010
+ oldPath: string | null;
1011
+ status: GitFileStatusCode;
1012
+ isBinary: boolean;
1013
+ isImage: boolean;
1014
+ additions: number;
1015
+ deletions: number;
1016
+ hunks: GitDiffHunk[];
1017
+ truncated: boolean;
1018
+ };
1019
+ export type GitDiffRequest = {
1020
+ path?: string;
1021
+ staged?: boolean;
1022
+ includeUntracked?: boolean;
1023
+ fromRef?: string;
1024
+ toRef?: string;
1025
+ pathspec?: string[];
1026
+ contextLines?: number;
1027
+ maxBytesPerFile?: number;
1028
+ };
1029
+ export type GitDiffResponse = {
1030
+ files: GitFileDiff[];
1031
+ revision: number;
1032
+ };
1033
+ export type GitLogRequest = {
1034
+ path?: string;
1035
+ ref?: string;
1036
+ maxCount?: number;
1037
+ skip?: number;
1038
+ pathspec?: string[];
1039
+ };
1040
+ export type GitCommit = {
1041
+ sha: string;
1042
+ shortSha: string;
1043
+ parents: string[];
1044
+ author: {
1045
+ name: string;
1046
+ email: string;
1047
+ timestamp: number;
1048
+ };
1049
+ committer: {
1050
+ name: string;
1051
+ email: string;
1052
+ timestamp: number;
1053
+ };
1054
+ subject: string;
1055
+ body: string;
1056
+ refs: string[];
1057
+ };
1058
+ export type GitLogResponse = {
1059
+ commits: GitCommit[];
1060
+ hasMore: boolean;
1061
+ };
1062
+ export type GitShowRequest = {
1063
+ path?: string;
1064
+ ref: string;
1065
+ filePath?: string;
1066
+ encoding?: FsEncoding;
1067
+ maxBytesPerFile?: number;
1068
+ };
1069
+ export type GitShowResponse = {
1070
+ commit: GitCommit | null;
1071
+ files: GitFileDiff[];
1072
+ blob: {
1073
+ content: string;
1074
+ encoding: FsEncoding;
1075
+ sizeBytes: number;
1076
+ truncated: boolean;
1077
+ } | null;
1078
+ revision: number;
1079
+ };
1080
+ export type WorkspaceCaptureFile = {
1081
+ path: string;
1082
+ status: GitFileStatusCode;
1083
+ hash: string | null;
1084
+ baseHash: string | null;
1085
+ contentRef: string | null;
1086
+ sizeBytes: number;
1087
+ isBinary: boolean;
1088
+ tooLarge: boolean;
1089
+ deleted: boolean;
1090
+ };
1091
+ export type WorkspaceCaptureRepo = {
1092
+ root: string;
1093
+ head: string | null;
1094
+ detached: boolean;
1095
+ upstream: string | null;
1096
+ ahead: number;
1097
+ behind: number;
1098
+ status: GitFileStatus[];
1099
+ diff: GitFileDiff[];
1100
+ };
1101
+ export type WorkspaceCaptureDegradedReason = "repository_discovery_command_failed" | "repository_discovery_timed_out" | "repository_discovery_result_limit_exceeded" | "repository_read_unavailable";
1102
+ export type WorkspaceCaptureStats = {
1103
+ repoCount: number;
1104
+ fileCount: number;
1105
+ additions: number;
1106
+ deletions: number;
1107
+ totalBytes: number;
1108
+ tooLargeCount: number;
1109
+ binaryCount: number;
1110
+ treeEntryCount: number;
1111
+ treeTruncated: boolean;
1112
+ durationMs: number;
1113
+ fingerprint?: string;
1114
+ };
1115
+ export type WorkspaceCaptureManifest = {
1116
+ version: 1;
1117
+ revision: number;
1118
+ capturedAt: string;
1119
+ turnId: string | null;
1120
+ leaseEpoch: number;
1121
+ treeIndex: FsTreeNode;
1122
+ treeTruncated: boolean;
1123
+ repos: WorkspaceCaptureRepo[];
1124
+ files: WorkspaceCaptureFile[];
1125
+ stats: WorkspaceCaptureStats;
1126
+ };
1127
+ export type WorkspaceRevisionCapturedPayload = {
1128
+ revision: number;
1129
+ turnId: string | null;
1130
+ capturedAt: string;
1131
+ leaseEpoch: number;
1132
+ stats: WorkspaceCaptureStats;
1133
+ };
1134
+ export type WorkspaceRevisionDegradedPayload = {
1135
+ revision: number;
1136
+ turnId: string | null;
1137
+ capturedAt: string;
1138
+ leaseEpoch: number;
1139
+ reason: WorkspaceCaptureDegradedReason;
1140
+ };
1141
+ export type WorkspaceCaptureSignedUrl = {
1142
+ url: string;
1143
+ expiresAt: string;
1144
+ };
1145
+ export type GetWorkspaceCaptureResponse = {
1146
+ available: false;
1147
+ degradedReason?: WorkspaceCaptureDegradedReason | null;
1148
+ revision?: number | null;
1149
+ capturedAt?: string | null;
1150
+ turnId?: string | null;
1151
+ leaseEpoch?: number | null;
1152
+ } | {
1153
+ available: true;
1154
+ revision: number;
1155
+ capturedAt: string;
1156
+ turnId: string | null;
1157
+ leaseEpoch: number;
1158
+ sizeBytes: number;
1159
+ stats: WorkspaceCaptureStats;
1160
+ manifest: WorkspaceCaptureManifest | null;
1161
+ manifestUrl: WorkspaceCaptureSignedUrl | null;
1162
+ };
1163
+ export type GetWorkspaceCaptureFileResponse = {
1164
+ path: string;
1165
+ revision: number;
1166
+ status: GitFileStatusCode;
1167
+ hash: string | null;
1168
+ baseHash: string | null;
1169
+ sizeBytes: number;
1170
+ isBinary: boolean;
1171
+ tooLarge: boolean;
1172
+ encoding: FsEncoding | null;
1173
+ content: string | null;
1174
+ contentUrl: WorkspaceCaptureSignedUrl | null;
1175
+ };
1176
+ export type TerminalExecRequest = {
1177
+ command: string;
1178
+ cwd?: string;
1179
+ timeoutMs?: number;
1180
+ emitStream?: boolean;
1181
+ };
1182
+ export type TerminalExecResponse = {
1183
+ stdout: string;
1184
+ stderr: string;
1185
+ exitCode: number;
1186
+ running: false;
1187
+ wallTimeSeconds: number;
1188
+ };
1189
+ export type PtyOpenRequest = {
1190
+ cols?: number;
1191
+ rows?: number;
1192
+ cwd?: string;
1193
+ shell?: string;
1194
+ };
1195
+ export type PtyOpenResponse = {
1196
+ ptyId: string;
1197
+ streamVia: "sse-events";
1198
+ supportsInput: boolean;
1199
+ };
1200
+ export type PtyWriteRequest = {
1201
+ ptyId: string;
1202
+ data: string;
1203
+ };
1204
+ export type PtyResizeRequest = {
1205
+ ptyId: string;
1206
+ cols: number;
1207
+ rows: number;
1208
+ };
1209
+ export type PtyCloseRequest = {
1210
+ ptyId: string;
1211
+ };
1212
+ export type SessionStructuredCapabilities = {
1213
+ FileSystem: {
1214
+ available: boolean;
1215
+ readOnly: boolean;
1216
+ root: string;
1217
+ };
1218
+ Terminal: {
1219
+ events: boolean;
1220
+ exec: boolean;
1221
+ pty: {
1222
+ available: boolean;
1223
+ };
1224
+ };
1225
+ Git: {
1226
+ available: boolean;
1227
+ repos: string[];
1228
+ };
1229
+ };
1230
+ export type ScheduledTaskStatus = "active" | "paused";
1231
+ export type ScheduledTaskRunMode = "new_session_per_run" | "reusable_session";
1232
+ export type ScheduledTaskOverlapPolicy = "allow_concurrent" | "skip" | "buffer_one";
1233
+ export type ScheduledTaskDayOfWeek = "SUNDAY" | "MONDAY" | "TUESDAY" | "WEDNESDAY" | "THURSDAY" | "FRIDAY" | "SATURDAY";
1234
+ export type ScheduledTaskScheduleSpec = {
1235
+ type: "once";
1236
+ runAt: string;
1237
+ timeZone: string;
1238
+ } | {
1239
+ type: "interval";
1240
+ everySeconds: number;
1241
+ startAt?: string | undefined;
1242
+ endAt?: string | undefined;
1243
+ } | {
1244
+ type: "calendar";
1245
+ timeZone: string;
1246
+ hour: number;
1247
+ minute: number;
1248
+ daysOfWeek?: ScheduledTaskDayOfWeek[] | undefined;
1249
+ };
1250
+ export type ScheduledTaskAgentConfig = {
1251
+ prompt: string;
1252
+ resources: ResourceRef[];
1253
+ tools: ToolRef[];
1254
+ metadata: Record<string, unknown>;
1255
+ slackBotConnectionId?: string | undefined;
1256
+ model?: string | undefined;
1257
+ reasoningEffort?: ReasoningEffort | undefined;
1258
+ sandboxBackend?: SandboxBackend | undefined;
1259
+ goal?: GoalSpec | undefined;
1260
+ maxNestedAgentDepth?: number | undefined;
1261
+ };
1262
+ export type ScheduledTask = {
1263
+ id: string;
1264
+ accountId: string;
1265
+ workspaceId: string;
1266
+ name: string;
1267
+ status: ScheduledTaskStatus;
1268
+ schedule: ScheduledTaskScheduleSpec;
1269
+ temporalScheduleId: string;
1270
+ runMode: ScheduledTaskRunMode;
1271
+ overlapPolicy: ScheduledTaskOverlapPolicy;
1272
+ agentConfig: ScheduledTaskAgentConfig;
1273
+ reusableSessionId: string | null;
1274
+ variableSetId: string | null;
1275
+ /** @deprecated use variableSetId */
1276
+ environmentId: string | null;
1277
+ rigId: string | null;
1278
+ metadata: Record<string, unknown>;
1279
+ createdAt: string;
1280
+ updatedAt: string;
1281
+ };
1282
+ export type CreateSessionRequest = {
1283
+ requestedSessionId?: string | undefined;
1284
+ initialMessage: string;
1285
+ /** System instructions scoped to the initial turn; never visible timeline text. */
1286
+ turnInstructions?: string | undefined;
1287
+ instructions?: string | undefined;
1288
+ resources?: ResourceRef[] | undefined;
1289
+ /** Inline skills fixed onto this session; omitted children inherit them. */
1290
+ skills?: SessionSkill[] | undefined;
1291
+ tools?: ToolRef[] | undefined;
1292
+ metadata?: Record<string, unknown> | undefined;
1293
+ model?: string | undefined;
1294
+ reasoningEffort?: ReasoningEffort | undefined;
1295
+ latencyMode?: LatencyMode | undefined;
1296
+ sandboxBackend?: SandboxBackend | undefined;
1297
+ targetSandboxId?: string | undefined;
1298
+ workingDir?: string | undefined;
1299
+ variableSetId?: string | undefined;
1300
+ /** @deprecated use variableSetId */
1301
+ environmentId?: string | undefined;
1302
+ rigId?: string | undefined;
1303
+ goal?: GoalSpec | undefined;
1304
+ clientEventId?: string | undefined;
1305
+ idempotencyKey?: string | undefined;
1306
+ expectedNewSessionDraftRevision?: number | undefined;
1307
+ maxNestedAgentDepth?: number | undefined;
1308
+ firstPartyMcpPermissions?: string[] | undefined;
1309
+ firstPartyMcpTools?: FirstPartyMcpToolName[] | undefined;
1310
+ mcpServers?: SessionMcpServerInput[] | undefined;
1311
+ sandbox?: "shared" | "new" | {
1312
+ groupId: string;
1313
+ } | undefined;
1314
+ };
1315
+ export declare const KNOWN_PERMISSIONS: readonly ["account:read", "account:admin", "members:manage", "workspace:create", "billing:read", "billing:manage", "workspace:read", "workspace:admin", "sessions:create", "sessions:read", "sessions:control", "stream:view", "stream:control", "stream:acknowledge", "files:upload", "files:read", "files:write", "terminal:attach", "documents:manage", "documents:search", "scheduled_tasks:manage", "scheduled_tasks:run", "github:manage", "github:use", "api_keys:manage", "connections:read", "connections:write", "environments:manage", "environments:use", "variable-sets:manage", "variable-sets:use", "mcp_servers:attach", "toolspace:call", "goals:manage", "enrollments:read", "enrollments:manage", "rigs:use", "rigs:manage"];
1316
+ export type KnownPermission = (typeof KNOWN_PERMISSIONS)[number];
1317
+ /**
1318
+ * Permissions the SDK knows about today, kept open so a newer OpenGeni server
1319
+ * can introduce permissions without breaking older SDK consumers.
1320
+ */
1321
+ export type Permission = KnownPermission | (string & {});
1322
+ export type FirstPartyMcpToolName = "set_session_title" | "goal_set" | "goal_update" | "goal_complete" | "goal_pause" | "memory_search" | "memory_save" | "memory_correct" | "preference_registry_summary" | "preference_registry_get" | "sandboxes_list" | "sandbox_attach" | "sandbox_swap" | "run_on" | "sandbox_provision" | "rig_list" | "rig_get" | "rig_propose_change" | "rig_verify" | "rig_promote" | "sessions_list" | "session_get" | "session_events" | "session_create" | "session_send_message" | "session_pause" | "session_resume" | "session_steer" | "set_other_session_title" | "variable_set_list" | "environment_list" | "variable_set_set_variable" | "environment_set_variable" | "github_connect_link" | "github_token" | "github_repositories_list" | "social_connections_list" | "social_posts_recent" | "social_daily_analysis_context" | "scheduled_tasks_list" | "scheduled_tasks_get" | "scheduled_tasks_create" | "scheduled_tasks_update" | "scheduled_tasks_pause" | "scheduled_tasks_resume" | "scheduled_tasks_trigger" | "scheduled_tasks_delete" | "scheduled_task_runs_list" | "slack_bot_list_channels" | "slack_bot_channel_history" | "slack_bot_thread_replies" | "slack_bot_list_users" | "slack_bot_list_files" | "slack_bot_file_info" | "slack_bot_file_content" | "slack_bot_post_message" | "slack_bot_delete_message";
1323
+ export type ProductAccessMode = "local" | "configured" | "managed";
1324
+ export type ModelCapabilitySupportV1 = "supported" | "unsupported" | "unknown";
1325
+ export type ModelCapabilityStateV1 = {
1326
+ upstream: ModelCapabilitySupportV1;
1327
+ runnable: boolean;
1328
+ };
1329
+ export type ModelCapabilitiesV1 = {
1330
+ reasoning: ModelCapabilityStateV1 & {
1331
+ efforts: ReasoningEffort[];
1332
+ defaultEffort: ReasoningEffort | null;
1333
+ required: boolean;
1334
+ };
1335
+ functionCalling: ModelCapabilityStateV1;
1336
+ structuredOutput: ModelCapabilityStateV1;
1337
+ hostedTools: {
1338
+ webSearch: ModelCapabilityStateV1;
1339
+ xSearch: ModelCapabilityStateV1;
1340
+ codeExecution: ModelCapabilityStateV1;
1341
+ };
1342
+ inputModalities: Array<"text" | "image" | "audio">;
1343
+ outputModalities: Array<"text" | "image" | "audio">;
1344
+ transports: {
1345
+ sse: ModelCapabilityStateV1;
1346
+ responsesWebSocket: ModelCapabilityStateV1;
1347
+ realtimeAudio: ModelCapabilityStateV1;
1348
+ };
1349
+ latencyModes: Array<{
1350
+ id: "standard" | "priority" | "fast";
1351
+ upstream: ModelCapabilitySupportV1;
1352
+ runnable: boolean;
1353
+ billingMultiplierBps?: number | undefined;
1354
+ }>;
1355
+ };
1356
+ export type ModelCredentialSourceV1 = {
1357
+ kind: "deployment";
1358
+ mechanism: "api_key" | "azure_ad_bearer";
1359
+ } | {
1360
+ kind: "connected_subscription";
1361
+ provider: "codex";
1362
+ } | {
1363
+ kind: "workspace_connection";
1364
+ mechanism: "api_key";
1365
+ };
1366
+ export type ModelBillingAttributionV1 = {
1367
+ upstreamPayer: "deployment" | "workspace" | "connected_subscription";
1368
+ metering: "opengeni_credits" | "external";
1369
+ };
1370
+ export type ModelPricingV1 = {
1371
+ inputMicrosPerMillionTokens: number;
1372
+ cachedInputMicrosPerMillionTokens?: number | undefined;
1373
+ outputMicrosPerMillionTokens: number;
1374
+ marginBps?: number | undefined;
1375
+ };
1376
+ export type ModelPricingScheduleV1 = {
1377
+ default: ModelPricingV1;
1378
+ inputTokenTiers?: Array<{
1379
+ minimumInputTokens: number;
1380
+ pricing: ModelPricingV1;
1381
+ }> | undefined;
1382
+ };
1383
+ /**
1384
+ * One model a client may select at send time, plus the provider that serves it.
1385
+ * The wire API (`responses` | `chat`) lets a client reason about provider
1386
+ * capabilities; the provider id/label drive a picker's grouping. Mirrors the
1387
+ * `ClientModel` shape projected into `ClientConfig` by the server.
1388
+ */
1389
+ export type ClientModel = {
1390
+ id: string;
1391
+ label: string;
1392
+ /** Provider id (e.g. `openai`, `azure`, or a registry provider id). */
1393
+ provider: string;
1394
+ providerLabel: string;
1395
+ api: "responses" | "chat";
1396
+ contextWindowTokens?: number | undefined;
1397
+ schemaVersion?: 1 | undefined;
1398
+ aliases?: string[] | undefined;
1399
+ deployment?: {
1400
+ upstreamModelId: string;
1401
+ wireApi: "responses" | "chat";
1402
+ } | undefined;
1403
+ executionLimits?: {
1404
+ contextWindowTokens: number | null;
1405
+ effectiveContextWindowTokens: number | null;
1406
+ autoCompactTokenLimit: number | null;
1407
+ toolOutputTruncationTokens: number | null;
1408
+ } | undefined;
1409
+ credentialSource?: ModelCredentialSourceV1 | undefined;
1410
+ billing?: ModelBillingAttributionV1 | undefined;
1411
+ capabilities?: ModelCapabilitiesV1 | undefined;
1412
+ pricing?: ModelPricingScheduleV1 | undefined;
1413
+ definitionVersion?: string | undefined;
1414
+ };
1415
+ export type ModelAvailabilityV1 = {
1416
+ status: "available" | "unavailable" | "degraded" | "unknown";
1417
+ selectable: boolean;
1418
+ reason: "missing_credential" | "needs_reauth" | "credential_not_ready" | "not_entitled" | "provider_unhealthy" | "policy_blocked" | "unsupported" | null;
1419
+ checkedAt: string | null;
1420
+ };
1421
+ export type ModelCredentialReadinessV1 = {
1422
+ status: "ready" | "not_ready" | "error";
1423
+ reason: "missing_credential" | "needs_reauth" | "prerequisites_missing" | "resolver_error" | "observation_stale" | null;
1424
+ basis: "configuration" | "connection" | "resolver";
1425
+ checkedAt: string | null;
1426
+ };
1427
+ export type WorkspaceModelCatalogModel = ClientModel & {
1428
+ credentialReadiness: ModelCredentialReadinessV1;
1429
+ availability: ModelAvailabilityV1;
1430
+ };
1431
+ export type WorkspaceModelCatalogResponse = {
1432
+ models: WorkspaceModelCatalogModel[];
1433
+ };
1434
+ /**
1435
+ * Connection state of a workspace's Codex (ChatGPT) subscription, returned by
1436
+ * `GET /v1/workspaces/:id/codex/status`. `models` are the codex models the
1437
+ * workspace can select (projected as ClientModel under their own "no credits"
1438
+ * provider group), present only while connected.
1439
+ */
1440
+ export type CodexConnectionStatus = {
1441
+ connected: boolean;
1442
+ plan?: string | null;
1443
+ valid?: boolean;
1444
+ expiresAt?: string | null;
1445
+ lastError?: string | null;
1446
+ models?: ClientModel[];
1447
+ /** The account a session runs on when unpinned (label for the in-session indicator). */
1448
+ activeAccount?: {
1449
+ id: string;
1450
+ label?: string | null;
1451
+ chatgptAccountId?: string | null;
1452
+ } | null;
1453
+ /** How many Codex accounts the workspace has connected. */
1454
+ accountCount?: number;
1455
+ };
1456
+ /**
1457
+ * One normalized Codex usage window (5h or weekly), camelCase end-to-end (the
1458
+ * route normalizes server-side; the web layer never re-hand-types snake_case).
1459
+ * `percent` is authoritative; used/limit/remaining are a synthesized 0–100 scale
1460
+ * (limit = 100) because the provider gives only a percentage. `remaining =
1461
+ * 100 - percent` is the P3 rotation key. Identify the window by `limitWindowSeconds`
1462
+ * (18000 ⇒ 5h, 604800 ⇒ weekly), never by position.
1463
+ */
1464
+ export type CodexUsageWindow = {
1465
+ used: number;
1466
+ limit: number;
1467
+ remaining: number;
1468
+ percent: number;
1469
+ resetAt: string | null;
1470
+ resetAfterSeconds: number | null;
1471
+ limitWindowSeconds: number;
1472
+ };
1473
+ /** The normalized usage payload for one account — the P2/P3 contract. */
1474
+ export type CodexUsagePayload = {
1475
+ status: "ok" | "limit_reached" | "error" | "no-data";
1476
+ planType: string | null;
1477
+ fiveHour: CodexUsageWindow | null;
1478
+ weekly: CodexUsageWindow | null;
1479
+ limitReached: boolean;
1480
+ fetchedAt: string;
1481
+ /** Authoritative count-only summary from /wham/usage; never synthesized rows. */
1482
+ rateLimitResetCredits?: {
1483
+ availableCount: number;
1484
+ credits: null;
1485
+ } | null;
1486
+ /** Present only on an auth/refresh failure path. */
1487
+ reason?: "needs_relogin";
1488
+ additionalLimits?: Array<{
1489
+ limitName: string;
1490
+ meteredFeature: string;
1491
+ fiveHour: CodexUsageWindow | null;
1492
+ weekly: CodexUsageWindow | null;
1493
+ }>;
1494
+ credits?: {
1495
+ hasCredits: boolean;
1496
+ unlimited: boolean;
1497
+ overageLimitReached: boolean;
1498
+ balance: string;
1499
+ };
1500
+ };
1501
+ /** One connected Codex (ChatGPT) account in a workspace (multi-account P1). Metadata only. */
1502
+ export type CodexAccount = {
1503
+ id: string;
1504
+ chatgptAccountId?: string | null;
1505
+ label?: string | null;
1506
+ email?: string | null;
1507
+ plan?: string | null;
1508
+ status: "active" | "needs_relogin" | "error";
1509
+ active: boolean;
1510
+ expiresAt?: string | null;
1511
+ lastRefreshAt?: string | null;
1512
+ lastError?: string | null;
1513
+ fiveHour?: CodexUsageWindow | null;
1514
+ weekly?: CodexUsageWindow | null;
1515
+ usageCheckedAt?: string | null;
1516
+ exhaustedUntil?: string | null;
1517
+ /** Controls only NEW automatic allocations. */
1518
+ allocatorEnabled: boolean;
1519
+ /** Independent OCC sequence; credential/token `version` is never exposed. */
1520
+ allocatorVersion: number;
1521
+ allocatorUpdatedAt?: string | null;
1522
+ /** Cached authoritative summary count, never detailed redemption authority. */
1523
+ resetCreditAvailableCount?: number | null;
1524
+ resetCreditsCheckedAt?: string | null;
1525
+ };
1526
+ export type CodexResetCredit = {
1527
+ id: string;
1528
+ resetType: "codexRateLimits" | "unknown";
1529
+ status: "available" | "redeeming" | "redeemed" | "unknown";
1530
+ /** Unix seconds from the provider contract. */
1531
+ grantedAt: number;
1532
+ /** Unix seconds, or null when the provider reports no expiry. */
1533
+ expiresAt: number | null;
1534
+ title: string | null;
1535
+ description: string | null;
1536
+ /** True only for fresh, complete, owning-human provider detail. */
1537
+ actionable: boolean;
1538
+ };
1539
+ /** Owning-human recovery metadata. It contains no token, browser-session hash, or provider key. */
1540
+ export type CodexResetRedemptionRecovery = {
1541
+ attemptId: string;
1542
+ creditId: string;
1543
+ status: "provider_started" | "completed";
1544
+ outcome: "reset" | "nothingToReset" | "noCredit" | "alreadyRedeemed" | null;
1545
+ providerStartedAt: string | null;
1546
+ completedAt: string | null;
1547
+ createdAt: string;
1548
+ updatedAt: string;
1549
+ };
1550
+ export type CodexAccountOverview = {
1551
+ accountId: string;
1552
+ usage: {
1553
+ source: "provider" | "cache" | "none";
1554
+ fetchedAt: string | null;
1555
+ stale: boolean;
1556
+ error: string | null;
1557
+ value: CodexUsagePayload | null;
1558
+ };
1559
+ resetCredits: {
1560
+ source: "provider" | "cache" | "none";
1561
+ fetchedAt: string | null;
1562
+ stale: boolean;
1563
+ error: string | null;
1564
+ detailState: "detailed" | "count_only" | "capped" | "unsupported" | "unknown" | "error";
1565
+ detailsComplete: boolean;
1566
+ availableCount: number | null;
1567
+ credits: CodexResetCredit[];
1568
+ };
1569
+ canRedeem: boolean;
1570
+ /** Owning managed-cookie human may replay durable completion without a healthy provider token. */
1571
+ canResumeRedemption: boolean;
1572
+ /** Durable owner-scoped ambiguity/completion discovery; never redemption authority for agents. */
1573
+ redemptions: CodexResetRedemptionRecovery[];
1574
+ };
1575
+ /** Independently settled live overview keyed by workspace credential id. */
1576
+ export type CodexOverviewResponse = {
1577
+ accounts: Record<string, CodexAccountOverview>;
1578
+ };
1579
+ export type CodexAllocatorUpdate = {
1580
+ allocatorEnabled: boolean;
1581
+ allocatorVersion: number;
1582
+ allocatorUpdatedAt: string | null;
1583
+ changed: boolean;
1584
+ };
1585
+ /** Per-workspace Codex rotation/active settings. P1: rotation inert, only activeCredentialId loads. */
1586
+ export type CodexRotationSettings = {
1587
+ rotationEnabled: boolean;
1588
+ rotationStrategy: "most_remaining" | "round_robin" | "drain_then_next";
1589
+ activeCredentialId: string | null;
1590
+ };
1591
+ /** GET /codex/accounts — the accounts list + the workspace active pointer + settings. */
1592
+ export type CodexAccountsResponse = {
1593
+ accounts: CodexAccount[];
1594
+ activeAccountId: string | null;
1595
+ settings: CodexRotationSettings;
1596
+ };
1597
+ /** Payload of a `codex.account.switched` session event. */
1598
+ export type CodexAccountSwitchedPayload = {
1599
+ fromAccountId: string | null;
1600
+ toAccountId: string;
1601
+ reason: "manual" | "exhausted" | "rotation";
1602
+ droppedConnectors?: string[];
1603
+ };
1604
+ /** Device-code start: show `userCode` at `verificationUri`, then poll with `state`. */
1605
+ export type CodexConnectStart = {
1606
+ userCode: string;
1607
+ verificationUri: string;
1608
+ intervalSeconds: number;
1609
+ state: string;
1610
+ };
1611
+ /** Poll result: keep polling on `pending`, restart on `expired`, done on `connected`. */
1612
+ export type CodexConnectPoll = {
1613
+ status: "pending";
1614
+ } | {
1615
+ status: "expired";
1616
+ } | {
1617
+ status: "connected";
1618
+ plan?: string | null;
1619
+ accountId?: string;
1620
+ isActive?: boolean;
1621
+ };
1622
+ /** Remaining usage/limits for one account. `usage` is the normalized P2 payload. */
1623
+ export type CodexUsage = {
1624
+ status: "ok" | "limit_reached" | "error" | "no-data";
1625
+ usage: CodexUsagePayload | null;
1626
+ };
1627
+ /** Batched live-refresh response, keyed by credential id; each entry independently statused. */
1628
+ export type CodexUsageMap = Record<string, CodexUsage>;
1629
+ /**
1630
+ * How a deployment expects clients to authenticate to it, surfaced so a UI can
1631
+ * wire up the right header/cookie without prior knowledge of the host setup.
1632
+ * Discriminated on `mode`; `none` is the back-compat default.
1633
+ */
1634
+ export type ClientAuthConfig = {
1635
+ mode: "none";
1636
+ } | {
1637
+ mode: "deploymentKey";
1638
+ headerName: "x-opengeni-access-key";
1639
+ } | {
1640
+ mode: "configuredToken";
1641
+ headerName: "authorization";
1642
+ scheme: "bearer";
1643
+ } | {
1644
+ mode: "managedSession";
1645
+ session: "cookie";
1646
+ };
1647
+ export declare const OPENGENI_API_CONTRACT_REVISION: "2026-07-turn-instructions-v1";
1648
+ export declare const OPENGENI_API_CONTRACT_HEADER: "x-opengeni-api-contract";
1649
+ /** Bounded request/response identifier shared by browser, ingress, and API diagnostics. */
1650
+ export declare const OPENGENI_CORRELATION_HEADER: "x-opengeni-correlation-id";
1651
+ /**
1652
+ * Public, unauthenticated-by-default client bootstrap config returned by
1653
+ * `GET /v1/config/client`: which models + reasoning efforts are exposed, the
1654
+ * MCP servers and file-upload limits a composer should offer, and how the
1655
+ * deployment expects the client to authenticate. `allowedModels` is kept for
1656
+ * back-compat; `models` carries the richer provider-grouped list for a picker.
1657
+ */
1658
+ export type ClientConfig = {
1659
+ deploymentRevision: string;
1660
+ apiContractRevision: typeof OPENGENI_API_CONTRACT_REVISION;
1661
+ serverVersion?: string | undefined;
1662
+ defaultModel: string;
1663
+ allowedModels: string[];
1664
+ models: ClientModel[];
1665
+ defaultReasoningEffort: ReasoningEffort;
1666
+ allowedReasoningEfforts: ReasoningEffort[];
1667
+ mcpServers: {
1668
+ id: string;
1669
+ name: string;
1670
+ }[];
1671
+ fileUploads: {
1672
+ enabled: boolean;
1673
+ maxSizeBytes: number;
1674
+ };
1675
+ /** Native browser microphone capture + server-side transcription capability. */
1676
+ voiceInput?: ClientVoiceInputConfig | undefined;
1677
+ productAccessMode: ProductAccessMode;
1678
+ auth: ClientAuthConfig;
1679
+ structuredServices: {
1680
+ fileSystem: boolean;
1681
+ git: boolean;
1682
+ terminalEvents: boolean;
1683
+ };
1684
+ };
1685
+ /** Client-safe voice-input capability projection. */
1686
+ export type ClientVoiceInputConfig = {
1687
+ available: boolean;
1688
+ maxDurationSeconds: number;
1689
+ maxSizeBytes: number;
1690
+ acceptedMimeTypes: string[];
1691
+ };
1692
+ /** Response from POST /v1/workspaces/:workspaceId/transcriptions. */
1693
+ export type TranscribeAudioResponse = {
1694
+ text: string;
1695
+ languages: string[];
1696
+ };
1697
+ export type AccountRole = "owner" | "admin" | "member";
1698
+ export type AccessPrincipalKind = "human_session" | "agent_attempt" | "service" | "api_key" | "configured_key";
1699
+ export type AccountGrant = {
1700
+ accountId: string;
1701
+ subjectId: string;
1702
+ subjectLabel?: string | undefined;
1703
+ role?: AccountRole | undefined;
1704
+ permissions: Permission[];
1705
+ metadata?: Record<string, unknown> | undefined;
1706
+ };
1707
+ export type AccessGrant = {
1708
+ workspaceId: string;
1709
+ accountId: string;
1710
+ subjectId: string;
1711
+ subjectLabel?: string | undefined;
1712
+ permissions: Permission[];
1713
+ principalKind?: AccessPrincipalKind | undefined;
1714
+ metadata?: Record<string, unknown> | undefined;
1715
+ serviceInitiator?: ServiceTurnInitiator | undefined;
1716
+ serviceInitiatorContext?: ServiceTurnInitiatorContext | undefined;
1717
+ };
1718
+ export type AccessContext = {
1719
+ mode: ProductAccessMode;
1720
+ subjectId: string;
1721
+ subjectLabel?: string | undefined;
1722
+ accountGrants: AccountGrant[];
1723
+ workspaceGrants: AccessGrant[];
1724
+ defaultAccountId: string | null;
1725
+ defaultWorkspaceId: string | null;
1726
+ };
1727
+ export type Workspace = {
1728
+ id: string;
1729
+ accountId: string;
1730
+ name: string;
1731
+ slug: string | null;
1732
+ externalSource: string | null;
1733
+ externalId: string | null;
1734
+ agentInstructions: string | null;
1735
+ settings: Record<string, unknown>;
1736
+ inferenceControl: {
1737
+ state: "active" | "paused";
1738
+ revision: number;
1739
+ reason: string | null;
1740
+ changedBy: string | null;
1741
+ changedAt: string | null;
1742
+ };
1743
+ defaultRigId?: string | null;
1744
+ createdAt: string;
1745
+ updatedAt: string;
1746
+ };
1747
+ export type WorkspaceSettings = {
1748
+ memoryEnabled?: boolean | undefined;
1749
+ voiceInput?: WorkspaceVoiceInputSettings | undefined;
1750
+ transcription?: WorkspaceTranscriptionPolicy | undefined;
1751
+ maxNestedAgentDepth?: number | null | undefined;
1752
+ /** Default for new Codex sessions; absent ⇒ remote_v2. */
1753
+ codexCompactionDefault?: "remote_v2" | "portable" | undefined;
1754
+ [key: string]: unknown;
1755
+ };
1756
+ export type WorkspaceVoiceInputSettings = {
1757
+ enabled: boolean;
1758
+ };
1759
+ export type UpdateWorkspaceSettingsRequest = {
1760
+ memoryEnabled?: boolean | undefined;
1761
+ voiceInput?: WorkspaceVoiceInputSettings | undefined;
1762
+ transcription?: WorkspaceTranscriptionPolicy | undefined;
1763
+ maxNestedAgentDepth?: number | null | undefined;
1764
+ codexCompactionDefault?: "remote_v2" | "portable" | undefined;
1765
+ [key: string]: unknown;
1766
+ };
1767
+ export type SetWorkspaceDefaultRigRequest = {
1768
+ rigId: string | null;
1769
+ };
1770
+ export type CreateWorkspaceRequest = {
1771
+ accountId?: string | undefined;
1772
+ name: string;
1773
+ slug?: string | undefined;
1774
+ externalSource?: string | undefined;
1775
+ externalId?: string | undefined;
1776
+ agentInstructions?: string | null | undefined;
1777
+ };
1778
+ export type UpdateWorkspaceRequest = {
1779
+ name?: string | undefined;
1780
+ slug?: string | null | undefined;
1781
+ agentInstructions?: string | null | undefined;
1782
+ };
1783
+ export type ApiKey = {
1784
+ id: string;
1785
+ accountId: string;
1786
+ workspaceId: string | null;
1787
+ name: string;
1788
+ prefix: string;
1789
+ permissions: Permission[];
1790
+ expiresAt: string | null;
1791
+ revokedAt: string | null;
1792
+ lastUsedAt: string | null;
1793
+ createdAt: string;
1794
+ updatedAt: string;
1795
+ };
1796
+ export type CreateApiKeyRequest = {
1797
+ name: string;
1798
+ permissions: Permission[];
1799
+ expiresAt?: string | undefined;
1800
+ };
1801
+ export type CreateApiKeyResponse = {
1802
+ apiKey: ApiKey;
1803
+ /** The full secret token — shown once at creation, never returned again. */
1804
+ token: string;
1805
+ };
1806
+ export type ListApiKeysResponse = {
1807
+ apiKeys: ApiKey[];
1808
+ };
1809
+ export type WorkspaceMember = {
1810
+ subjectId: string;
1811
+ subjectLabel: string | null;
1812
+ role: string;
1813
+ permissions: Permission[];
1814
+ createdAt: string;
1815
+ };
1816
+ export type ListWorkspaceMembersResponse = {
1817
+ members: WorkspaceMember[];
1818
+ };
1819
+ export type AddWorkspaceMemberRequest = {
1820
+ email: string;
1821
+ role?: string | undefined;
1822
+ permissions: Permission[];
1823
+ };
1824
+ export type UpdateWorkspaceMemberRequest = {
1825
+ role?: string | undefined;
1826
+ permissions: Permission[];
1827
+ };
1828
+ export type SessionGoalStatus = "active" | "paused" | "completed";
1829
+ export type SessionGoalCreatedBy = "api" | "agent" | "scheduled_task";
1830
+ export type SessionGoalContinuationState = "inactive" | "scheduled" | "running" | "blocked" | "invariant_broken";
1831
+ export type SessionGoalContinuationReason = "goal_inactive" | "wake_pending" | "continuation_pending" | "human_work_pending" | "goal_turn_running" | "human_turn_running" | "workstream_paused" | "approval_required" | "provider_backpressure" | "session_cancelled" | "system_work_pending" | "missing_obligation";
1832
+ export type SessionGoalContinuation = {
1833
+ state: SessionGoalContinuationState;
1834
+ reason: SessionGoalContinuationReason;
1835
+ wakeRevision: number;
1836
+ observedRevision: number;
1837
+ nextAttemptAt: string | null;
1838
+ lastError: string | null;
1839
+ };
1840
+ export type SessionGoal = {
1841
+ id: string;
1842
+ accountId: string;
1843
+ workspaceId: string;
1844
+ sessionId: string;
1845
+ status: SessionGoalStatus;
1846
+ text: string;
1847
+ successCriteria: string | null;
1848
+ evidence: string | null;
1849
+ rationale: string | null;
1850
+ pausedReason: string | null;
1851
+ createdBy: SessionGoalCreatedBy;
1852
+ version: number;
1853
+ autoContinuations: number;
1854
+ noProgressStreak: number;
1855
+ maxAutoContinuations: number | null;
1856
+ metadata: Record<string, unknown>;
1857
+ /** Optional for source compatibility; the API always supplies this projection. */
1858
+ continuation?: SessionGoalContinuation | undefined;
1859
+ createdAt: string;
1860
+ updatedAt: string;
1861
+ };
1862
+ export type UpdateSessionGoalRequest = {
1863
+ status: "paused" | "active";
1864
+ rationale?: string | undefined;
1865
+ };
1866
+ export type UpdateSessionRequest = {
1867
+ title: string;
1868
+ };
1869
+ /** Outcome of a manual /compact trigger. */
1870
+ export type CompactSessionContextResult = {
1871
+ /** pending waits for the current safe boundary; completed ran while idle. */
1872
+ status: "pending" | "completed" | "noop";
1873
+ message: string;
1874
+ };
1875
+ export type EffectiveControlBlocker = {
1876
+ kind: "session" | "workspace";
1877
+ sessionId?: string | undefined;
1878
+ displayName: string;
1879
+ actor: string | null;
1880
+ reason: string | null;
1881
+ changedAt: string | null;
1882
+ revision: number;
1883
+ };
1884
+ export type EffectiveControlResumeOption = {
1885
+ scope: "selected" | "session" | "workspace";
1886
+ targetId?: string | undefined;
1887
+ selectedStateAfter: "active" | "paused";
1888
+ remainingPrimaryBlocker?: EffectiveControlBlocker | undefined;
1889
+ impactCopy: string;
1890
+ };
1891
+ export type EffectiveSessionControl = {
1892
+ state: "active" | "paused";
1893
+ controlVersion: number;
1894
+ controlEtag: string;
1895
+ directState: "active" | "paused";
1896
+ primaryBlocker: EffectiveControlBlocker | null;
1897
+ additionalBlockerCount: number;
1898
+ blockers: EffectiveControlBlocker[];
1899
+ resumeOptions: EffectiveControlResumeOption[];
1900
+ override: {
1901
+ rootSessionId: string;
1902
+ revision: number;
1903
+ } | null;
1904
+ settlement: {
1905
+ state: "stopping";
1906
+ attemptCount: number;
1907
+ interruptionPendingCount: number;
1908
+ quiescencePendingCount: number;
1909
+ } | null;
1910
+ };
1911
+ export type SessionCommandReceipt = {
1912
+ id: string;
1913
+ action: string;
1914
+ operationKey: string;
1915
+ targetSessionId: string | null;
1916
+ targetTurnId: string | null;
1917
+ appliedControlRevision: number | null;
1918
+ appliedQueueVersion: number | null;
1919
+ appliedTurnVersion: number | null;
1920
+ appliedDraftRevision: number | null;
1921
+ createdAt: string;
1922
+ };
1923
+ export type ComposerDraft = {
1924
+ revision: number;
1925
+ text: string;
1926
+ resources: ResourceRef[];
1927
+ model: string;
1928
+ reasoningEffort: ReasoningEffort;
1929
+ latencyMode?: LatencyMode | undefined;
1930
+ sourceTurnId: string | null;
1931
+ sourceTurnVersion: number | null;
1932
+ updatedAt: string | null;
1933
+ };
1934
+ export type NewSessionDraftOptions = {
1935
+ sandboxBackend?: SandboxBackend | undefined;
1936
+ targetSandboxId?: string | undefined;
1937
+ workingDir?: string | undefined;
1938
+ variableSetId?: string | undefined;
1939
+ rigId?: string | undefined;
1940
+ goal?: GoalSpec | undefined;
1941
+ firstPartyMcpPermissions?: Permission[] | undefined;
1942
+ firstPartyMcpTools?: FirstPartyMcpToolName[] | undefined;
1943
+ };
1944
+ export type NewSessionDraft = {
1945
+ revision: number;
1946
+ text: string;
1947
+ resources: ResourceRef[];
1948
+ tools: ToolRef[];
1949
+ /** False inherits the workspace-default MCP policy; true preserves an explicit array. */
1950
+ toolsProvided: boolean;
1951
+ model: string;
1952
+ reasoningEffort: ReasoningEffort;
1953
+ latencyMode?: LatencyMode | undefined;
1954
+ options: NewSessionDraftOptions;
1955
+ updatedAt: string | null;
1956
+ };
1957
+ export type SessionQueueSnapshot = {
1958
+ version: number;
1959
+ effectiveControl: EffectiveSessionControl;
1960
+ /** The latest interrupted attempt has not yet durably proved physical quiescence. */
1961
+ stoppingPreviousAttempt: boolean;
1962
+ items: SessionTurn[];
1963
+ /** Canonical pending machine inputs. Events only invalidate this snapshot. */
1964
+ pendingInputs: SessionPendingInputPreview[];
1965
+ /** Exact next bounded input batch that will join an already-waiting prompt. */
1966
+ pendingInputAttachment: {
1967
+ turnId: string;
1968
+ inputIds: string[];
1969
+ } | null;
1970
+ };
1971
+ export type SessionPendingInputPreview = Pick<SessionSystemUpdate, "id" | "sessionId" | "kind" | "classification" | "sourceId" | "summary" | "createdAt">;
1972
+ export type SystemUpdateClassification = "success" | "failure" | "action_required" | "info";
1973
+ export type SessionSystemUpdateKind = "scheduled_occurrence" | "goal_continuation" | "agent_message" | "agent_steer_instruction" | "child_terminal_result";
1974
+ export type SessionSystemUpdateState = "pending" | "delivered" | "cancelled" | "superseded" | "failed";
1975
+ export type SessionSystemUpdate = {
1976
+ id: string;
1977
+ sessionId: string;
1978
+ kind: SessionSystemUpdateKind;
1979
+ classification: SystemUpdateClassification;
1980
+ sourceId: string;
1981
+ dedupeKey: string;
1982
+ summary: string;
1983
+ payload: Record<string, unknown>;
1984
+ lineage: Record<string, unknown>;
1985
+ state: SessionSystemUpdateState;
1986
+ deliveredTurnId: string | null;
1987
+ deliveredHistoryItemId: string | null;
1988
+ deliveredAt: string | null;
1989
+ createdAt: string;
1990
+ };
1991
+ export type SessionControlResponse = {
1992
+ receipt: SessionCommandReceipt;
1993
+ effectiveControl: EffectiveSessionControl;
1994
+ interruptionCount: number;
1995
+ wakeCount: number;
1996
+ };
1997
+ export type WorkspaceInferenceControlResponse = {
1998
+ receipt: SessionCommandReceipt;
1999
+ state: "active" | "paused";
2000
+ revision: number;
2001
+ interruptionCount: number;
2002
+ wakeCount: number;
2003
+ };
2004
+ export type WorkspaceControlEvent = {
2005
+ id: string;
2006
+ workspaceId: string;
2007
+ /** Same monotonic value as revision; named sequence for SSE resume cursors. */
2008
+ sequence: number;
2009
+ revision: number;
2010
+ type: "workspace.control.changed";
2011
+ scope: "workspace" | "session";
2012
+ rootSessionId: string | null;
2013
+ action: "pause" | "resume";
2014
+ automatic: boolean;
2015
+ reason: string | null;
2016
+ actor: string;
2017
+ occurredAt: string;
2018
+ truncation?: {
2019
+ truncated: true;
2020
+ surface: "durable_control" | "database_guard" | "http_projection" | "nats_legacy_guard" | "sse_legacy_guard";
2021
+ deliveredBytes: number;
2022
+ fields: Array<{
2023
+ field: "reason" | "actor";
2024
+ originalBytes: number;
2025
+ deliveredBytes: number;
2026
+ omittedBytes: number;
2027
+ }>;
2028
+ fullEvidence: {
2029
+ available: false;
2030
+ reason: "not_retained";
2031
+ };
2032
+ } | null;
2033
+ };
2034
+ export type SessionQueueMutationResponse = {
2035
+ receipt: SessionCommandReceipt;
2036
+ snapshot: SessionQueueSnapshot;
2037
+ draft?: ComposerDraft;
2038
+ };
2039
+ export type MoveSessionQueueItemRequest = {
2040
+ clientEventId: string;
2041
+ expectedQueueVersion: number;
2042
+ beforeTurnId: string | null;
2043
+ };
2044
+ export type EditSessionQueueItemRequest = {
2045
+ clientEventId: string;
2046
+ expectedTurnVersion: number;
2047
+ expectedDraftRevision: number;
2048
+ replaceDraft: boolean;
2049
+ };
2050
+ export type SteerSessionQueueItemRequest = {
2051
+ clientEventId: string;
2052
+ expectedTurnVersion: number;
2053
+ controlEtag?: string;
2054
+ };
2055
+ export type DeleteSessionQueueItemRequest = {
2056
+ clientEventId: string;
2057
+ expectedTurnVersion: number;
2058
+ reason?: string;
2059
+ };
2060
+ export type SaveComposerDraftRequest = Omit<ComposerDraft, "revision" | "sourceTurnId" | "sourceTurnVersion" | "updatedAt"> & {
2061
+ expectedRevision: number;
2062
+ };
2063
+ export type SaveNewSessionDraftRequest = Omit<NewSessionDraft, "revision" | "updatedAt"> & {
2064
+ expectedRevision: number;
2065
+ };
2066
+ /** Input shape for agent config on create/update (server applies defaults). */
2067
+ export type ScheduledTaskAgentConfigInput = {
2068
+ prompt: string;
2069
+ resources?: ResourceRef[] | undefined;
2070
+ tools?: ToolRef[] | undefined;
2071
+ metadata?: Record<string, unknown> | undefined;
2072
+ slackBotConnectionId?: string | undefined;
2073
+ model?: string | undefined;
2074
+ reasoningEffort?: ReasoningEffort | undefined;
2075
+ sandboxBackend?: SandboxBackend | undefined;
2076
+ goal?: GoalSpec | undefined;
2077
+ maxNestedAgentDepth?: number | undefined;
2078
+ };
2079
+ export type CreateScheduledTaskRequest = {
2080
+ name: string;
2081
+ schedule: ScheduledTaskScheduleSpec;
2082
+ runMode?: ScheduledTaskRunMode | undefined;
2083
+ overlapPolicy?: ScheduledTaskOverlapPolicy | undefined;
2084
+ agentConfig: ScheduledTaskAgentConfigInput;
2085
+ status?: ScheduledTaskStatus | undefined;
2086
+ variableSetId?: string | null | undefined;
2087
+ /** @deprecated use variableSetId */
2088
+ environmentId?: string | null | undefined;
2089
+ rigId?: string | null | undefined;
2090
+ metadata?: Record<string, unknown> | undefined;
2091
+ };
2092
+ export type UpdateScheduledTaskRequest = {
2093
+ name?: string | undefined;
2094
+ schedule?: ScheduledTaskScheduleSpec | undefined;
2095
+ runMode?: ScheduledTaskRunMode | undefined;
2096
+ overlapPolicy?: ScheduledTaskOverlapPolicy | undefined;
2097
+ agentConfig?: ScheduledTaskAgentConfigInput | undefined;
2098
+ status?: ScheduledTaskStatus | undefined;
2099
+ variableSetId?: string | null | undefined;
2100
+ /** @deprecated use variableSetId */
2101
+ environmentId?: string | null | undefined;
2102
+ rigId?: string | null | undefined;
2103
+ metadata?: Record<string, unknown> | undefined;
2104
+ };
2105
+ export type ScheduledTaskRunStatus = "queued" | "dispatched" | "failed";
2106
+ export type ScheduledTaskTriggerType = "scheduled" | "manual";
2107
+ export type ScheduledTaskRun = {
2108
+ id: string;
2109
+ accountId: string;
2110
+ workspaceId: string;
2111
+ taskId: string;
2112
+ status: ScheduledTaskRunStatus;
2113
+ triggerType: ScheduledTaskTriggerType;
2114
+ scheduledAt: string | null;
2115
+ firedAt: string;
2116
+ sessionId: string | null;
2117
+ triggerEventId: string | null;
2118
+ error: string | null;
2119
+ createdAt: string;
2120
+ updatedAt: string;
2121
+ };
2122
+ /**
2123
+ * Variable values are write-only by design: the API never returns a value, so
2124
+ * reads expose name + version metadata only. Values are decrypted exclusively
2125
+ * inside the worker at sandbox materialization time.
2126
+ */
2127
+ export type VariableSetVariableMetadata = {
2128
+ name: string;
2129
+ version: number;
2130
+ createdAt: string;
2131
+ updatedAt: string;
2132
+ };
2133
+ export type VariableSet = {
2134
+ id: string;
2135
+ accountId: string;
2136
+ workspaceId: string;
2137
+ name: string;
2138
+ description: string | null;
2139
+ variables: VariableSetVariableMetadata[];
2140
+ createdAt: string;
2141
+ updatedAt: string;
2142
+ };
2143
+ /** @deprecated use VariableSetVariableMetadata */
2144
+ export type WorkspaceEnvironmentVariableMetadata = VariableSetVariableMetadata;
2145
+ /** @deprecated use VariableSet */
2146
+ export type WorkspaceEnvironment = VariableSet;
2147
+ export type CreateVariableSetRequest = {
2148
+ name: string;
2149
+ description?: string | undefined;
2150
+ /** Initial variables. Values are write-only: they never come back on reads. */
2151
+ variables?: {
2152
+ name: string;
2153
+ value: string;
2154
+ }[] | undefined;
2155
+ };
2156
+ /** @deprecated use CreateVariableSetRequest */
2157
+ export type CreateWorkspaceEnvironmentRequest = CreateVariableSetRequest;
2158
+ export type UpdateVariableSetRequest = {
2159
+ name?: string | undefined;
2160
+ description?: string | null | undefined;
2161
+ };
2162
+ /** @deprecated use UpdateVariableSetRequest */
2163
+ export type UpdateWorkspaceEnvironmentRequest = UpdateVariableSetRequest;
2164
+ export type SetVariableSetVariableRequest = {
2165
+ value: string;
2166
+ };
2167
+ /** @deprecated use SetVariableSetVariableRequest */
2168
+ export type SetWorkspaceEnvironmentVariableRequest = SetVariableSetVariableRequest;
2169
+ export type RigCheck = {
2170
+ name: string;
2171
+ command: string;
2172
+ };
2173
+ export type RigVersion = {
2174
+ id: string;
2175
+ rigId: string;
2176
+ version: number;
2177
+ image: string | null;
2178
+ setupScript: string | null;
2179
+ checks: RigCheck[];
2180
+ credentialHooks: string[];
2181
+ defaultVariableSetIds: string[];
2182
+ changelog: string | null;
2183
+ createdBy: string | null;
2184
+ active: boolean;
2185
+ createdAt: string;
2186
+ };
2187
+ export type RigVerificationHealth = {
2188
+ checkHealth: "passing" | "failing" | "unknown";
2189
+ lastVerifiedAt: string | null;
2190
+ };
2191
+ export type Rig = {
2192
+ id: string;
2193
+ accountId: string;
2194
+ workspaceId: string;
2195
+ name: string;
2196
+ description: string | null;
2197
+ createdBy: string | null;
2198
+ activeVersion: RigVersion | null;
2199
+ activeVersionHealth?: RigVerificationHealth | null;
2200
+ versionCount: number;
2201
+ createdAt: string;
2202
+ updatedAt: string;
2203
+ };
2204
+ export type RigChangeKind = "setup_append" | "definition_edit";
2205
+ export type RigChangeStatus = "proposed" | "verifying" | "merged" | "rejected" | "failed";
2206
+ export type RigCheckResult = {
2207
+ name: string;
2208
+ command: string;
2209
+ exitCode: number | null;
2210
+ output?: string | undefined;
2211
+ };
2212
+ export type RigChangeVerification = {
2213
+ startedAt?: string | undefined;
2214
+ finishedAt?: string | undefined;
2215
+ log?: string | undefined;
2216
+ checkResults?: RigCheckResult[] | undefined;
2217
+ [key: string]: unknown;
2218
+ };
2219
+ export type RigChange = {
2220
+ id: string;
2221
+ rigId: string;
2222
+ baseVersionId: string | null;
2223
+ kind: RigChangeKind;
2224
+ payload: Record<string, unknown>;
2225
+ status: RigChangeStatus;
2226
+ proposedBy: string | null;
2227
+ verification: RigChangeVerification | null;
2228
+ resultVersionId: string | null;
2229
+ createdAt: string;
2230
+ updatedAt: string;
2231
+ };
2232
+ export type CreateRigRequest = {
2233
+ name: string;
2234
+ description?: string | undefined;
2235
+ image?: string | undefined;
2236
+ setupScript?: string | undefined;
2237
+ checks?: RigCheck[] | undefined;
2238
+ credentialHooks?: string[] | undefined;
2239
+ defaultVariableSetIds?: string[] | undefined;
2240
+ };
2241
+ export type UpdateRigRequest = {
2242
+ name?: string | undefined;
2243
+ description?: string | null | undefined;
2244
+ };
2245
+ export type RigSetupAppendPayload = {
2246
+ command: string;
2247
+ note?: string | undefined;
2248
+ };
2249
+ export type RigDefinitionEditPayload = {
2250
+ image?: string | null | undefined;
2251
+ setupScript?: string | null | undefined;
2252
+ checks?: RigCheck[] | undefined;
2253
+ credentialHooks?: string[] | undefined;
2254
+ defaultVariableSetIds?: string[] | undefined;
2255
+ changelog?: string | null | undefined;
2256
+ };
2257
+ export type ProposeRigChangeRequest = {
2258
+ kind: "setup_append";
2259
+ payload: RigSetupAppendPayload;
2260
+ } | {
2261
+ kind: "definition_edit";
2262
+ payload: RigDefinitionEditPayload;
2263
+ };
2264
+ export type FileStatus = "pending_upload" | "ready" | "failed" | "expired" | "deleted";
2265
+ export type FileAsset = {
2266
+ id: string;
2267
+ workspaceId: string;
2268
+ status: FileStatus;
2269
+ filename: string;
2270
+ safeFilename: string;
2271
+ contentType: string;
2272
+ sizeBytes: number;
2273
+ sha256: string | null;
2274
+ bucket: string;
2275
+ objectKey: string;
2276
+ createdAt: string;
2277
+ updatedAt: string;
2278
+ };
2279
+ /** Mirrors the closed, provider-neutral retained-output contract. */
2280
+ export declare const RETAINED_OUTPUT_DEFAULT_PAGE_BYTES: number;
2281
+ export declare const RETAINED_OUTPUT_MAX_PAGE_BYTES: number;
2282
+ export type RetainedOutputKind = "tool_result" | "assistant_completion" | "internal_update" | "event_media" | "file";
2283
+ export type RetainedOutputUnavailableReason = "not_retained" | "pending" | "failed" | "expired" | "deleted" | "missing_storage" | "storage_write_failed" | "unsupported";
2284
+ export type RetainedArtifactReference = {
2285
+ available: true;
2286
+ artifactId: string;
2287
+ kind: RetainedOutputKind;
2288
+ contentType: string;
2289
+ originalBytes: number;
2290
+ sha256: string;
2291
+ retainedAt: string;
2292
+ retention: {
2293
+ policy: "workspace_file";
2294
+ expiresAt: null;
2295
+ };
2296
+ retrieval: {
2297
+ method: "GET";
2298
+ path: string;
2299
+ acceptRanges: "bytes";
2300
+ maxRangeBytes: number;
2301
+ };
2302
+ };
2303
+ export type RetainedArtifactUnavailable = {
2304
+ available: false;
2305
+ artifactId: string;
2306
+ reason: RetainedOutputUnavailableReason;
2307
+ };
2308
+ export type RetainedArtifactMetadata = RetainedArtifactReference | RetainedArtifactUnavailable;
2309
+ export type RetainedArtifactContentOptions = {
2310
+ /** One RFC-style bytes range, for example `bytes=1048576-2097151`. */
2311
+ range?: string | undefined;
2312
+ signal?: AbortSignal | undefined;
2313
+ };
2314
+ export type RetainedArtifactContent = {
2315
+ bytes: Uint8Array;
2316
+ status: 200 | 206;
2317
+ contentType: string;
2318
+ contentLength: number;
2319
+ contentRange: string | null;
2320
+ acceptRanges: "bytes";
2321
+ };
2322
+ export type CreateFileUploadRequest = {
2323
+ filename: string;
2324
+ contentType: string;
2325
+ sizeBytes: number;
2326
+ sha256?: string | undefined;
2327
+ };
2328
+ export type CreateFileUploadResponse = {
2329
+ fileId: string;
2330
+ uploadId: string;
2331
+ /** Pre-signed PUT URL for the file bytes (direct to object storage). */
2332
+ putUrl: string;
2333
+ /** Headers that MUST be sent with the PUT for the signature to validate. */
2334
+ requiredHeaders: Record<string, string>;
2335
+ expiresAt: string;
2336
+ maxSizeBytes: number;
2337
+ };
2338
+ export type CompleteFileUploadResponse = {
2339
+ file: FileAsset;
2340
+ };
2341
+ export type FileDownloadUrlResponse = {
2342
+ url: string;
2343
+ expiresAt: string;
2344
+ };
2345
+ /** Bytes accepted by the `uploadFile` helper. */
2346
+ export type FileUploadData = Blob | ArrayBuffer | Uint8Array | string;
2347
+ export type UploadFileInput = {
2348
+ filename: string;
2349
+ contentType: string;
2350
+ data: FileUploadData;
2351
+ sha256?: string | undefined;
2352
+ };
2353
+ export type DocumentStatus = "queued" | "indexing" | "ready" | "failed";
2354
+ export type KnowledgeSourceKind = "manual_upload" | "meeting_transcript" | "repository" | "email" | "chat" | "document" | "web" | "other";
2355
+ export type DocumentSearchMode = "hybrid" | "vector" | "keyword";
2356
+ export type DocumentVisibility = "workspace" | "private";
2357
+ export type DocumentCurationStatus = "none" | "pending" | "suggested" | "auto_filed" | "failed";
2358
+ export type DocumentCuration = {
2359
+ suggestedBaseId: string | null;
2360
+ suggestedBaseName: string | null;
2361
+ confidence: number;
2362
+ reason: string | null;
2363
+ originalTitle: string | null;
2364
+ model: string | null;
2365
+ };
2366
+ export type DocumentBase = {
2367
+ id: string;
2368
+ workspaceId: string;
2369
+ name: string;
2370
+ description: string | null;
2371
+ createdAt: string;
2372
+ updatedAt: string;
2373
+ };
2374
+ export type Document = {
2375
+ id: string;
2376
+ workspaceId: string;
2377
+ baseId: string;
2378
+ fileId: string;
2379
+ status: DocumentStatus;
2380
+ title: string;
2381
+ parser: string;
2382
+ chunkCount: number;
2383
+ error: string | null;
2384
+ sourceKind: KnowledgeSourceKind;
2385
+ sourceUri: string | null;
2386
+ sourceExternalId: string | null;
2387
+ sourceTitle: string | null;
2388
+ sourceAuthor: string | null;
2389
+ sourceCreatedAt: string | null;
2390
+ sourceUpdatedAt: string | null;
2391
+ sourceVersion: string | null;
2392
+ aclTags: string[];
2393
+ visibility: DocumentVisibility;
2394
+ createdBy: string | null;
2395
+ agentAccess: boolean;
2396
+ summary: string | null;
2397
+ topics: string[];
2398
+ curationStatus: DocumentCurationStatus;
2399
+ curation: DocumentCuration | null;
2400
+ createdAt: string;
2401
+ updatedAt: string;
2402
+ };
2403
+ export type DocumentSearchResult = {
2404
+ chunkId: string;
2405
+ workspaceId: string;
2406
+ documentId: string;
2407
+ baseId: string;
2408
+ fileId: string;
2409
+ title: string;
2410
+ text: string;
2411
+ score: number;
2412
+ matchType: DocumentSearchMode;
2413
+ vectorScore: number | null;
2414
+ keywordScore: number | null;
2415
+ chunkIndex: number;
2416
+ metadata: Record<string, unknown>;
2417
+ sourceKind: KnowledgeSourceKind;
2418
+ sourceUri: string | null;
2419
+ sourceExternalId: string | null;
2420
+ sourceTitle: string | null;
2421
+ sourceAuthor: string | null;
2422
+ sourceCreatedAt: string | null;
2423
+ sourceUpdatedAt: string | null;
2424
+ sourceVersion: string | null;
2425
+ aclTags: string[];
2426
+ };
2427
+ export type CreateDocumentBaseRequest = {
2428
+ name: string;
2429
+ description?: string | undefined;
2430
+ };
2431
+ export type AddDocumentRequest = {
2432
+ fileId: string;
2433
+ title?: string | undefined;
2434
+ sourceKind?: KnowledgeSourceKind | undefined;
2435
+ sourceUri?: string | undefined;
2436
+ sourceExternalId?: string | undefined;
2437
+ sourceTitle?: string | undefined;
2438
+ sourceAuthor?: string | undefined;
2439
+ sourceCreatedAt?: string | undefined;
2440
+ sourceUpdatedAt?: string | undefined;
2441
+ sourceVersion?: string | undefined;
2442
+ aclTags?: string[] | undefined;
2443
+ visibility?: DocumentVisibility | undefined;
2444
+ agentAccess?: boolean | undefined;
2445
+ };
2446
+ export type CreateKnowledgeDropRequest = {
2447
+ text?: string | undefined;
2448
+ fileId?: string | undefined;
2449
+ filename?: string | undefined;
2450
+ title?: string | undefined;
2451
+ visibility?: DocumentVisibility | undefined;
2452
+ agentAccess?: boolean | undefined;
2453
+ };
2454
+ export type MoveDocumentRequest = {
2455
+ targetBaseId?: string | undefined;
2456
+ };
2457
+ export type DocumentSearchRequest = {
2458
+ query: string;
2459
+ baseIds?: string[] | undefined;
2460
+ mode?: DocumentSearchMode | undefined;
2461
+ sourceKinds?: KnowledgeSourceKind[] | undefined;
2462
+ aclTags?: string[] | undefined;
2463
+ limit?: number | undefined;
2464
+ };
2465
+ export type DocumentSearchResponse = {
2466
+ results: DocumentSearchResult[];
2467
+ };
2468
+ export type KnowledgeMemoryStatus = "proposed" | "approved" | "rejected" | "active" | "superseded" | "archived";
2469
+ export type KnowledgeMemoryKind = "semantic" | "episodic" | "procedural" | "decision" | "preference";
2470
+ export type KnowledgeSourceRef = {
2471
+ kind: "document_chunk" | "document" | "session_event" | "memory" | "external";
2472
+ id: string;
2473
+ uri?: string | undefined;
2474
+ title?: string | undefined;
2475
+ metadata?: Record<string, unknown> | undefined;
2476
+ };
2477
+ export type KnowledgeMemory = {
2478
+ id: string;
2479
+ workspaceId: string;
2480
+ status: KnowledgeMemoryStatus;
2481
+ kind: KnowledgeMemoryKind;
2482
+ scope: string;
2483
+ text: string;
2484
+ sourceRefs: KnowledgeSourceRef[];
2485
+ confidence: number;
2486
+ metadata: Record<string, unknown>;
2487
+ createdBySessionId: string | null;
2488
+ reviewedBy: string | null;
2489
+ reviewedAt: string | null;
2490
+ pinned: boolean;
2491
+ usageCount: number;
2492
+ lastUsedAt: string | null;
2493
+ supersedesId: string | null;
2494
+ supersededById: string | null;
2495
+ validFrom: string;
2496
+ validUntil: string | null;
2497
+ createdAt: string;
2498
+ updatedAt: string;
2499
+ };
2500
+ export type CreateKnowledgeMemoryRequest = {
2501
+ status?: KnowledgeMemoryStatus | undefined;
2502
+ kind?: KnowledgeMemoryKind | undefined;
2503
+ scope?: string | undefined;
2504
+ text: string;
2505
+ sourceRefs?: KnowledgeSourceRef[] | undefined;
2506
+ confidence?: number | undefined;
2507
+ metadata?: Record<string, unknown> | undefined;
2508
+ createdBySessionId?: string | undefined;
2509
+ pinned?: boolean | undefined;
2510
+ replacesId?: string | undefined;
2511
+ };
2512
+ export type UpdateKnowledgeMemoryRequest = {
2513
+ status?: KnowledgeMemoryStatus | undefined;
2514
+ kind?: KnowledgeMemoryKind | undefined;
2515
+ scope?: string | undefined;
2516
+ text?: string | undefined;
2517
+ sourceRefs?: KnowledgeSourceRef[] | undefined;
2518
+ confidence?: number | undefined;
2519
+ metadata?: Record<string, unknown> | undefined;
2520
+ reviewedBy?: string | undefined;
2521
+ pinned?: boolean | undefined;
2522
+ };
2523
+ export type KnowledgeMemorySearchRequest = {
2524
+ query?: string | undefined;
2525
+ status?: KnowledgeMemoryStatus | undefined;
2526
+ kind?: KnowledgeMemoryKind | undefined;
2527
+ scope?: string | undefined;
2528
+ limit?: number | undefined;
2529
+ };
2530
+ export type WorkspaceMemorySearchMode = "hybrid" | "vector" | "keyword";
2531
+ export type WorkspaceMemorySearchRequest = {
2532
+ query: string;
2533
+ kind?: KnowledgeMemoryKind | undefined;
2534
+ limit?: number | undefined;
2535
+ mode?: WorkspaceMemorySearchMode | undefined;
2536
+ };
2537
+ export type WorkspaceMemorySearchResult = {
2538
+ memory: KnowledgeMemory;
2539
+ score: number;
2540
+ matchType: WorkspaceMemorySearchMode;
2541
+ vectorScore: number | null;
2542
+ keywordScore: number | null;
2543
+ };
2544
+ export type WorkspaceMemorySearchResponse = {
2545
+ results: WorkspaceMemorySearchResult[];
2546
+ };
2547
+ export type CapabilityPackConnectorAuthModel = "oauth2_authorization_code_pkce" | "oauth2_authorization_code" | "api_key" | "credential_ref";
2548
+ export type CapabilityPackConnector = {
2549
+ id: string;
2550
+ name: string;
2551
+ category: string;
2552
+ authModel: CapabilityPackConnectorAuthModel;
2553
+ providers: string[];
2554
+ scopes: string[];
2555
+ required: boolean;
2556
+ metadata: Record<string, unknown>;
2557
+ };
2558
+ export type CapabilityPackKnowledge = {
2559
+ type: "document_base";
2560
+ id: string;
2561
+ name: string;
2562
+ description: string | null;
2563
+ required: boolean;
2564
+ };
2565
+ export type CapabilityPackScheduledTaskTemplate = {
2566
+ id: string;
2567
+ name: string;
2568
+ description: string;
2569
+ defaultSchedule: ScheduledTaskScheduleSpec;
2570
+ defaultRunMode: ScheduledTaskRunMode;
2571
+ defaultOverlapPolicy: ScheduledTaskOverlapPolicy;
2572
+ prompt?: string | undefined;
2573
+ };
2574
+ export type CapabilityPackSkillFile = {
2575
+ path: string;
2576
+ content: string;
2577
+ };
2578
+ export type CapabilityPackSkill = {
2579
+ name: string;
2580
+ description?: string | undefined;
2581
+ files: CapabilityPackSkillFile[];
2582
+ };
2583
+ export type SessionSkill = CapabilityPackSkill;
2584
+ export type CapabilityPackVariableSetSpec = {
2585
+ description: string;
2586
+ requiredVariables: string[];
2587
+ required: boolean;
2588
+ };
2589
+ export type CapabilityPack = {
2590
+ id: string;
2591
+ name: string;
2592
+ description: string;
2593
+ role: string;
2594
+ category: string;
2595
+ version: string;
2596
+ sandboxImage?: string | undefined;
2597
+ skills: CapabilityPackSkill[];
2598
+ tools: ToolRef[];
2599
+ connectors: CapabilityPackConnector[];
2600
+ knowledge: CapabilityPackKnowledge[];
2601
+ scheduledTaskTemplates: CapabilityPackScheduledTaskTemplate[];
2602
+ variableSet?: CapabilityPackVariableSetSpec | undefined;
2603
+ metadata: Record<string, unknown>;
2604
+ };
2605
+ /** Input shape for registering a pack manifest (server applies defaults). */
2606
+ export type RegisterCapabilityPackRequest = {
2607
+ id: string;
2608
+ name: string;
2609
+ description: string;
2610
+ role: string;
2611
+ category: string;
2612
+ version: string;
2613
+ sandboxImage?: string | undefined;
2614
+ skills?: {
2615
+ name: string;
2616
+ description?: string | undefined;
2617
+ files: CapabilityPackSkillFile[];
2618
+ }[] | undefined;
2619
+ tools?: ToolRef[] | undefined;
2620
+ connectors?: {
2621
+ id: string;
2622
+ name: string;
2623
+ category: string;
2624
+ authModel: CapabilityPackConnectorAuthModel;
2625
+ providers?: string[] | undefined;
2626
+ scopes?: string[] | undefined;
2627
+ required?: boolean | undefined;
2628
+ metadata?: Record<string, unknown> | undefined;
2629
+ }[] | undefined;
2630
+ knowledge?: {
2631
+ type: "document_base";
2632
+ id: string;
2633
+ name: string;
2634
+ description?: string | null | undefined;
2635
+ required?: boolean | undefined;
2636
+ }[] | undefined;
2637
+ scheduledTaskTemplates?: {
2638
+ id: string;
2639
+ name: string;
2640
+ description: string;
2641
+ defaultSchedule: ScheduledTaskScheduleSpec;
2642
+ defaultRunMode?: ScheduledTaskRunMode | undefined;
2643
+ defaultOverlapPolicy?: ScheduledTaskOverlapPolicy | undefined;
2644
+ prompt?: string | undefined;
2645
+ }[] | undefined;
2646
+ variableSet?: {
2647
+ description: string;
2648
+ requiredVariables?: string[] | undefined;
2649
+ required?: boolean | undefined;
2650
+ } | undefined;
2651
+ metadata?: Record<string, unknown> | undefined;
2652
+ };
2653
+ export type WorkspaceRegisteredPack = {
2654
+ accountId: string;
2655
+ workspaceId: string;
2656
+ pack: CapabilityPack;
2657
+ createdAt: string;
2658
+ updatedAt: string;
2659
+ };
2660
+ export type PackInstallationStatus = "active" | "disabled";
2661
+ export type PackInstallation = {
2662
+ id: string;
2663
+ accountId: string;
2664
+ workspaceId: string;
2665
+ packId: string;
2666
+ status: PackInstallationStatus;
2667
+ metadata: Record<string, unknown>;
2668
+ enabledAt: string;
2669
+ updatedAt: string;
2670
+ };
2671
+ export type EnablePackRequest = {
2672
+ variableSetId?: string | undefined;
2673
+ /** @deprecated use variableSetId */
2674
+ environmentId?: string | undefined;
2675
+ metadata?: Record<string, unknown> | undefined;
2676
+ };
2677
+ export type ListPacksResponse = {
2678
+ packs: CapabilityPack[];
2679
+ installations: PackInstallation[];
2680
+ };
2681
+ export type GetPackResponse = {
2682
+ pack: CapabilityPack;
2683
+ installation: PackInstallation | null;
2684
+ };
2685
+ export type CapabilityKind = "pack" | "mcp" | "api" | "skill" | "plugin";
2686
+ export type CapabilitySource = "built_in" | "library" | "configured" | "public_registry" | "registry" | "manual";
2687
+ export type CapabilityInstallationStatus = "active" | "disabled";
2688
+ export type CapabilityCatalogAuthKind = "oauth2" | "api_key" | "none" | "unknown";
2689
+ export type CapabilityCatalogTier = "verified" | "community";
2690
+ export type CapabilityRuntime = {
2691
+ available: boolean;
2692
+ mcpServerId?: string | undefined;
2693
+ transport?: string | undefined;
2694
+ notes: string | null;
2695
+ /** Secret-safe server-derived registry exposure state. */
2696
+ catalogTrust?: {
2697
+ state: "trusted" | "legacy_active" | "unverified";
2698
+ reason: "trusted_source" | "verified_probe" | "active_installation_compatibility" | "missing_verification";
2699
+ } | undefined;
2700
+ };
2701
+ export type CapabilityCatalogItem = {
2702
+ id: string;
2703
+ accountId?: string | undefined;
2704
+ workspaceId?: string | undefined;
2705
+ kind: CapabilityKind;
2706
+ source: CapabilitySource;
2707
+ name: string;
2708
+ description: string | null;
2709
+ category: string;
2710
+ tags: string[];
2711
+ homepageUrl: string | null;
2712
+ endpointUrl: string | null;
2713
+ installUrl: string | null;
2714
+ authModel: string | null;
2715
+ providerDomain: string | null;
2716
+ surfaceType: string | null;
2717
+ transport: string | null;
2718
+ mcpUrl: string | null;
2719
+ authKind: CapabilityCatalogAuthKind | null;
2720
+ credentialFacts: Record<string, unknown>[];
2721
+ tier: CapabilityCatalogTier | null;
2722
+ provenance: string | null;
2723
+ logoAssetPath: string | null;
2724
+ importBatchId: string | null;
2725
+ stale: boolean;
2726
+ staleAt: string | null;
2727
+ tools: ToolRef[];
2728
+ runtime: CapabilityRuntime;
2729
+ enabled: boolean;
2730
+ enabledReason: string | null;
2731
+ /** The connection backing this enabled installation, or null when none is involved. */
2732
+ connectionRef: {
2733
+ connectionId?: string | undefined;
2734
+ providerDomain: string;
2735
+ kind: string;
2736
+ subjectScope?: "subject" | "workspace" | undefined;
2737
+ } | null;
2738
+ metadata: Record<string, unknown>;
2739
+ createdAt?: string | undefined;
2740
+ updatedAt?: string | undefined;
2741
+ };
2742
+ export type CapabilityInstallation = {
2743
+ id: string;
2744
+ accountId: string;
2745
+ workspaceId: string;
2746
+ capabilityId: string;
2747
+ kind: CapabilityKind;
2748
+ status: CapabilityInstallationStatus;
2749
+ config: Record<string, unknown>;
2750
+ metadata: Record<string, unknown>;
2751
+ enabledAt: string;
2752
+ updatedAt: string;
2753
+ };
2754
+ export type CapabilityCatalogResponse = {
2755
+ items: CapabilityCatalogItem[];
2756
+ installations: CapabilityInstallation[];
2757
+ };
2758
+ export type CreateCapabilityCatalogItemRequest = {
2759
+ id?: string | undefined;
2760
+ kind: Exclude<CapabilityKind, "pack">;
2761
+ source?: CapabilitySource | undefined;
2762
+ name: string;
2763
+ description?: string | undefined;
2764
+ category?: string | undefined;
2765
+ tags?: string[] | undefined;
2766
+ homepageUrl?: string | undefined;
2767
+ endpointUrl?: string | undefined;
2768
+ installUrl?: string | undefined;
2769
+ authModel?: string | undefined;
2770
+ metadata?: Record<string, unknown> | undefined;
2771
+ };
2772
+ export type EnableCapabilityRequest = {
2773
+ config?: Record<string, unknown> | undefined;
2774
+ metadata?: Record<string, unknown> | undefined;
2775
+ connectionRef?: McpServerConnectionRef | undefined;
2776
+ /**
2777
+ * Credential headers for remote MCP capabilities. Write-only: encrypted at
2778
+ * rest, injected only into the runtime MCP client, never returned by the
2779
+ * API (responses expose header names only).
2780
+ */
2781
+ headers?: Record<string, string> | undefined;
2782
+ /**
2783
+ * Initial variableSet attachment for kind=pack capabilities — mirrors the
2784
+ * dedicated POST /packs/:id/enable body. Required to enable an
2785
+ * variableSet.required pack through this unified path; ignored otherwise.
2786
+ */
2787
+ variableSetId?: string | undefined;
2788
+ /** @deprecated use variableSetId */
2789
+ environmentId?: string | undefined;
2790
+ };
2791
+ export type DiscoverMcpCapabilitiesResponse = {
2792
+ items: CapabilityCatalogItem[];
2793
+ source: "official_mcp_registry";
2794
+ sourceUrl: string;
2795
+ };
2796
+ export type GitHubRepository = {
2797
+ id: number;
2798
+ installationId: number;
2799
+ fullName: string;
2800
+ name: string;
2801
+ private: boolean;
2802
+ htmlUrl: string;
2803
+ cloneUrl: string;
2804
+ defaultBranch: string;
2805
+ accountLogin: string;
2806
+ accountType: string | null;
2807
+ };
2808
+ export type GitHubRepositoryScope = "all" | "selected";
2809
+ export type GitHubBindingStatus = "disabled" | "unbound" | "bound";
2810
+ export type GitHubAppSetupMode = "platform" | "operator";
2811
+ export type GitHubInstallationLifecycle = "active" | "suspended" | "deleted" | "unverified";
2812
+ export type GitHubInstallationBinding = {
2813
+ installationId: number;
2814
+ githubAccountId: number | null;
2815
+ accountLogin: string | null;
2816
+ accountType: string | null;
2817
+ lifecycle: GitHubInstallationLifecycle;
2818
+ repositoryScope: GitHubRepositoryScope;
2819
+ repositoryCount: number;
2820
+ /** OpenGeni-owned entry point for changing the installation's repository allowlist. */
2821
+ configureUrl: string | null;
2822
+ createdAt: string;
2823
+ updatedAt: string;
2824
+ };
2825
+ export type GitHubAppInfo = {
2826
+ configured: boolean;
2827
+ /** Truthful workspace binding state; server App credentials alone are not a binding. */
2828
+ status: GitHubBindingStatus;
2829
+ /** Platform deployments expose installation only; operator deployments may create an App. */
2830
+ setupMode: GitHubAppSetupMode;
2831
+ appId: string | null;
2832
+ clientId: string | null;
2833
+ appSlug: string | null;
2834
+ /** Fresh OAuth-first existing-installation discovery and install entry point. */
2835
+ installUrl: string | null;
2836
+ /** Compatibility alias for installUrl. */
2837
+ linkUrl: string | null;
2838
+ /** Installation bindings owned independently by this workspace. */
2839
+ installations: GitHubInstallationBinding[];
2840
+ /** Setting names still missing when `configured` is false. */
2841
+ missing: string[];
2842
+ };
2843
+ export type GitHubRepositoriesResponse = {
2844
+ repositories: GitHubRepository[];
2845
+ };
2846
+ export type CreateGitHubAppManifestRequest = {
2847
+ appName?: string | undefined;
2848
+ organization?: string | undefined;
2849
+ public?: boolean | undefined;
2850
+ includeCiPermissions?: boolean | undefined;
2851
+ };
2852
+ export type CreateGitHubAppManifestResponse = {
2853
+ /** GitHub URL to POST the manifest to (personal or organization flow). */
2854
+ actionUrl: string;
2855
+ state: string;
2856
+ manifest: Record<string, unknown>;
2857
+ };
2858
+ export type BillingMode = "disabled" | "stripe";
2859
+ export type EntitlementsMode = "none" | "static" | "managed";
2860
+ export type BillingBalance = {
2861
+ accountId: string;
2862
+ balanceMicros: number;
2863
+ currency: "usd";
2864
+ updatedAt: string;
2865
+ };
2866
+ export declare const KNOWN_USAGE_EVENT_TYPES: readonly ["agent_run.created", "agent_run.completed", "model.tokens", "model.cost", "file.uploaded", "file.deleted", "document.indexed", "scheduled_task.fired", "api_key.request", "sandbox.warm_seconds", "sandbox.warm_cost"];
2867
+ export type KnownUsageEventType = (typeof KNOWN_USAGE_EVENT_TYPES)[number];
2868
+ export type UsageEventType = KnownUsageEventType | (string & {});
2869
+ export type UsageEvent = {
2870
+ id: string;
2871
+ workspaceId: string;
2872
+ accountId: string;
2873
+ subjectId: string | null;
2874
+ eventType: UsageEventType;
2875
+ quantity: number;
2876
+ unit: string;
2877
+ sourceResourceType: string | null;
2878
+ sourceResourceId: string | null;
2879
+ idempotencyKey: string;
2880
+ occurredAt: string;
2881
+ recordedAt: string;
2882
+ exportedToBillingAt: string | null;
2883
+ billingProviderEventId: string | null;
2884
+ };
2885
+ export type EntitlementValue = boolean | string | number | string[];
2886
+ export type Entitlements = Record<string, EntitlementValue>;
2887
+ export type BillingSummary = {
2888
+ mode: BillingMode;
2889
+ balance: BillingBalance;
2890
+ };
2891
+ export type BillingUsageResponse = {
2892
+ balance: BillingBalance;
2893
+ usage: UsageEvent[];
2894
+ };
2895
+ export type InsightsRange = "today" | "week" | "month" | "ytd";
2896
+ export type InsightsBillingPath = "opengeni_credits" | "external";
2897
+ export type InsightsModelUsageRow = {
2898
+ id: string;
2899
+ model: string;
2900
+ provider: string;
2901
+ billing: InsightsBillingPath;
2902
+ calls: number;
2903
+ inputTokens: number;
2904
+ outputTokens: number;
2905
+ cachedTokens: number;
2906
+ cacheWriteTokens: number;
2907
+ reasoningTokens: number;
2908
+ creditUsd: number;
2909
+ };
2910
+ export type InsightsSeriesPoint = {
2911
+ label: string;
2912
+ modelCostUsd: number;
2913
+ warmSeconds: number;
2914
+ inputTokens: number;
2915
+ cachedTokens: number;
2916
+ cacheHitPct: number;
2917
+ calls: number;
2918
+ };
2919
+ export type InsightsDepthBucket = {
2920
+ depth: number;
2921
+ sessions: number;
2922
+ };
2923
+ export type InsightsModelFacet = {
2924
+ provider: string;
2925
+ model: string;
2926
+ };
2927
+ export type InsightsSpendDriver = {
2928
+ id: string;
2929
+ groupBy: "root_session" | "schedule";
2930
+ label: string;
2931
+ creditUsd: number;
2932
+ tokens: number;
2933
+ cacheHitPct: number;
2934
+ pctOfCreditUsd: number;
2935
+ deltaUsdVsPrior: number;
2936
+ };
2937
+ export type InsightsWarmGroupRow = {
2938
+ id: string;
2939
+ groupId: string;
2940
+ label: string;
2941
+ backend: string | null;
2942
+ warmSeconds: number;
2943
+ sessionsAttached: number;
2944
+ };
2945
+ export type InsightsLiveWarmLease = {
2946
+ id: string;
2947
+ groupId: string;
2948
+ backend: string;
2949
+ turnHolders: number;
2950
+ viewerHolders: number;
2951
+ warmForLabel: string;
2952
+ warmSeconds: number;
2953
+ };
2954
+ export type InsightsFloorSession = {
2955
+ id: string;
2956
+ title: string;
2957
+ state: "running" | "paused" | "failed" | "idle" | "compacting" | "waiting";
2958
+ depth: number;
2959
+ model: string | null;
2960
+ provider: string | null;
2961
+ ageLabel: string;
2962
+ cacheHitPct: number | null;
2963
+ route: string | null;
2964
+ };
2965
+ export type InsightsScheduleRow = {
2966
+ id: string;
2967
+ name: string;
2968
+ fires: number;
2969
+ creditUsd: number | null;
2970
+ tokens: number | null;
2971
+ cacheHitPct: number | null;
2972
+ billing: InsightsBillingPath | null;
2973
+ };
2974
+ export type WorkspaceInsightsSnapshot = {
2975
+ range: InsightsRange;
2976
+ rangeLabel: string;
2977
+ priorLabel: string;
2978
+ seriesLabel: string;
2979
+ cacheSeriesLabel: string;
2980
+ timezone: "UTC";
2981
+ models: InsightsModelUsageRow[];
2982
+ facets: InsightsModelFacet[];
2983
+ series: InsightsSeriesPoint[];
2984
+ depth: InsightsDepthBucket[];
2985
+ drivers: InsightsSpendDriver[];
2986
+ schedules: InsightsScheduleRow[];
2987
+ warmSeconds: number;
2988
+ priorWarmSeconds: number;
2989
+ warmGroups: InsightsWarmGroupRow[];
2990
+ liveWarm: InsightsLiveWarmLease[];
2991
+ floor: InsightsFloorSession[];
2992
+ selfhostedEnabled: boolean;
2993
+ machinesOnline: number;
2994
+ workspaceCreditUsd: number;
2995
+ priorWorkspaceCreditUsd: number;
2996
+ creditUsd: number;
2997
+ priorCreditUsd: number;
2998
+ priorInputTokens: number;
2999
+ priorCacheHitPct: number;
3000
+ priorCalls: number;
3001
+ goalsActive: number;
3002
+ goalsCompleted: number;
3003
+ sessionsTouched: number;
3004
+ rootSessions: number;
3005
+ deepestDepth: number;
3006
+ deepestSessionTitle: string;
3007
+ avgDepth: number;
3008
+ warmIdleNow: number;
3009
+ billableTokensUsed: number;
3010
+ billableTokenCap: number | null;
3011
+ agentRunsUsed: number;
3012
+ agentRunCap: number | null;
3013
+ modelFilterActive: boolean;
3014
+ };
3015
+ export type WorkspaceInsightsResponse = {
3016
+ snapshot: WorkspaceInsightsSnapshot;
3017
+ };
3018
+ export type BillingEntitlementsResponse = {
3019
+ accountId: string;
3020
+ mode: EntitlementsMode;
3021
+ entitlements: Entitlements;
3022
+ };
3023
+ export type CreateCheckoutRequest = {
3024
+ accountId?: string | undefined;
3025
+ /** USD amount with cent precision (server enforces min/max). */
3026
+ amountUsd: number;
3027
+ successUrl?: string | undefined;
3028
+ cancelUrl?: string | undefined;
3029
+ };
3030
+ export type CreateCheckoutResponse = {
3031
+ checkoutSessionId: string;
3032
+ url: string;
3033
+ };
3034
+ export type UserMessageEventInput = {
3035
+ type: "user.message";
3036
+ clientEventId?: string | undefined;
3037
+ payload: {
3038
+ text: string;
3039
+ turnInstructions?: string | undefined;
3040
+ resources?: ResourceRef[] | undefined;
3041
+ model?: string | undefined;
3042
+ reasoningEffort?: ReasoningEffort | undefined;
3043
+ latencyMode?: LatencyMode | undefined;
3044
+ mcpCredentialUpdates?: SessionMcpCredentialUpdateInput[] | undefined;
3045
+ };
3046
+ };
3047
+ export type UserApprovalDecisionEventInput = {
3048
+ type: "user.approvalDecision";
3049
+ clientEventId?: string | undefined;
3050
+ payload: {
3051
+ approvalId: string;
3052
+ decision: "approve" | "reject";
3053
+ message?: string | undefined;
3054
+ };
3055
+ };
3056
+ export type UserHumanInputResponseEventInput = {
3057
+ type: "user.humanInputResponse";
3058
+ clientEventId?: string | undefined;
3059
+ payload: {
3060
+ requestId: string;
3061
+ response: SubmitHumanInputResponseRequest;
3062
+ };
3063
+ };
3064
+ /** Control/user events a client may POST to a session's event log. */
3065
+ export type ClientSessionEventInput = UserMessageEventInput | UserApprovalDecisionEventInput | UserHumanInputResponseEventInput;
3066
+ /** A point-in-time machine metrics sample. `gpuUtilPct`/`gpuMemBytes` are null
3067
+ * when no GPU was present (not-reported, never a real zero); the bytes/load are
3068
+ * numbers; `sampledAt` is an ISO-8601 instant. */
3069
+ export type MetricSample = {
3070
+ cpuPct: number;
3071
+ load1: number;
3072
+ load5: number;
3073
+ load15: number;
3074
+ memUsedBytes: number;
3075
+ memTotalBytes: number;
3076
+ diskUsedBytes: number;
3077
+ diskTotalBytes: number;
3078
+ gpuUtilPct: number | null;
3079
+ gpuMemBytes: number | null;
3080
+ runQueue: number;
3081
+ sampledAt: string;
3082
+ };
3083
+ /** The derived dashboard state of a machine (M3 liveness + consent/display
3084
+ * reasons + the in-flight device-flow). */
3085
+ export type MachineState = "online" | "reconnecting" | "offline" | "consent_required" | "display_unavailable" | "enrolling";
3086
+ export type MachineKind = "modal" | "selfhosted";
3087
+ /** A machine as the Machines dashboard renders it (an enrolled selfhosted machine
3088
+ * or the session's synthetic Modal group box, `isSessionGroup: true`). */
3089
+ export type MachineView = {
3090
+ sandboxId: string;
3091
+ enrollmentId: string | null;
3092
+ name: string;
3093
+ kind: MachineKind;
3094
+ state: MachineState;
3095
+ active: boolean;
3096
+ isSessionGroup: boolean;
3097
+ workspaceGeneration: number | null;
3098
+ archiveGeneration: number | null;
3099
+ archiveComplete: boolean;
3100
+ os: string;
3101
+ arch: string;
3102
+ hasDisplay: boolean;
3103
+ /** Non-null only when a display exists but capture is blocked (macOS Screen
3104
+ * Recording / TCC not granted) — the UI can surface "display: capture not
3105
+ * granted". null == capture permitted OR headless. */
3106
+ desktopUnavailableReason?: string | null | undefined;
3107
+ allowScreenControl: boolean;
3108
+ sharedSessionCount: number;
3109
+ lastSeenAt: string | null;
3110
+ metrics: MetricSample | null;
3111
+ };
3112
+ /** GET /v1/workspaces/:ws/machines — the dashboard list + the active-sandbox
3113
+ * pointer (null activeSandboxId == the session's own group box is active). */
3114
+ export type MachinesResponse = {
3115
+ activeSandboxId: string | null;
3116
+ activeEpoch: number;
3117
+ machines: MachineView[];
3118
+ };
3119
+ /** GET /v1/workspaces/:ws/machines/:enrollmentId/metrics/series — the downsampled
3120
+ * (~1/min) history the dashboard time-range reads. */
3121
+ export type MachineMetricsSeriesResponse = {
3122
+ samples: MetricSample[];
3123
+ };
3124
+ /** POST /v1/workspaces/:ws/sessions/:sessionId/active-sandbox — swap a session's
3125
+ * active sandbox. `target` is a `MachineView.sandboxId`, or "session"/"default"
3126
+ * to swap back to the session's own group box. */
3127
+ export type SwapActiveSandboxRequest = {
3128
+ target: string;
3129
+ };
3130
+ /** The swap outcome (mirrors the server `FleetSwapResult`). `swapped` is true on a
3131
+ * successful repoint OR a no-op (already there); `reason` carries the failure
3132
+ * detail (unowned/offline target, or a lost epoch fence) when false. */
3133
+ export type SwapActiveSandboxResponse = {
3134
+ swapped: boolean;
3135
+ activeSandboxId: string | null;
3136
+ activeEpoch: number;
3137
+ reason?: string;
3138
+ code?: "stale_pointer" | "offline_enrollment" | "unsupported_backend_context" | "transient_establishment" | "concurrent_swap" | "recovery_in_progress" | "recovery_degraded" | "recovery_unrecoverable";
3139
+ };
3140
+ /** Mirror of `@opengeni/contracts` EnrollmentOs. */
3141
+ export type EnrollmentOs = "linux" | "macos" | "windows";
3142
+ /** POST /v1/enrollments/device/lookup body. */
3143
+ export type DeviceEnrollmentLookupRequest = {
3144
+ userCode: string;
3145
+ };
3146
+ /** The presentational machine details the consent screen renders. */
3147
+ export type DeviceEnrollmentLookupMachine = {
3148
+ machineName: string | null;
3149
+ os: EnrollmentOs;
3150
+ arch: string;
3151
+ canOfferDisplay: boolean;
3152
+ requestsScreenControl: boolean;
3153
+ };
3154
+ /** POST /v1/enrollments/device/lookup response (no secrets, no device_code). */
3155
+ export type DeviceEnrollmentLookupResponse = {
3156
+ workspaceId: string;
3157
+ userCode: string;
3158
+ machine: DeviceEnrollmentLookupMachine;
3159
+ expiresAt: string;
3160
+ };
3161
+ /** POST /v1/workspaces/:ws/enrollments/device/approve body. */
3162
+ export type DeviceEnrollmentApproveRequest = {
3163
+ userCode: string;
3164
+ allowScreenControl?: boolean;
3165
+ };
3166
+ /** POST /v1/workspaces/:ws/enrollments/device/approve response. */
3167
+ export type DeviceEnrollmentApproveResponse = {
3168
+ approved: boolean;
3169
+ enrollmentId: string;
3170
+ sandboxId: string;
3171
+ allowScreenControl: boolean;
3172
+ };
3173
+ /** POST /v1/workspaces/:ws/enrollments/device/deny body. */
3174
+ export type DeviceEnrollmentDenyRequest = {
3175
+ userCode: string;
3176
+ };
3177
+ /** POST /v1/workspaces/:ws/enrollments/device/deny response. */
3178
+ export type DeviceEnrollmentDenyResponse = {
3179
+ denied: boolean;
3180
+ };
3181
+ /** POST /v1/workspaces/:ws/enrollments/token body. */
3182
+ export type MintEnrollTokenRequest = {
3183
+ allowScreenControl?: boolean;
3184
+ };
3185
+ /** POST /v1/workspaces/:ws/enrollments/token response. The `token` is SECRET. */
3186
+ export type MintEnrollTokenResponse = {
3187
+ token: string;
3188
+ expiresAt: string;
3189
+ expiresInSeconds: number;
3190
+ };
3191
+ /** The credential payload the headless exchange returns (a subset of the agent's
3192
+ * EnrollmentCredentials — IDENTICAL to the device-flow poll authorized branch). */
3193
+ export type EnrollmentCredentials = {
3194
+ agentId: string;
3195
+ workspaceId: string;
3196
+ bearer: string;
3197
+ subjectPrefix: string;
3198
+ natsUrls: string[];
3199
+ relayUrl: string;
3200
+ relayToken: string;
3201
+ natsAccountCreds: string;
3202
+ updatePublicKey: string;
3203
+ consentedWholeMachine: boolean;
3204
+ consentedScreenControl: boolean;
3205
+ };
3206
+ /** POST /v1/enrollments/token/exchange body (the headless / fleet enroll path). */
3207
+ export type EnrollTokenExchangeRequest = {
3208
+ token: string;
3209
+ publicKey: string;
3210
+ os?: EnrollmentOs;
3211
+ arch?: string;
3212
+ machineName?: string;
3213
+ exposure?: "whole-machine";
3214
+ canOfferDisplay?: boolean;
3215
+ requestsScreenControl?: boolean;
3216
+ };
3217
+ /** POST /v1/enrollments/token/exchange response (wraps the credential shape). */
3218
+ export type EnrollTokenExchangeResponse = {
3219
+ credentials: EnrollmentCredentials;
3220
+ };
3221
+ export {};