@opengeni/sdk 0.3.1 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,5 +1,128 @@
1
1
  type SessionStatus = "queued" | "running" | "idle" | "requires_action" | "failed" | "cancelled";
2
- type SandboxBackend = "docker" | "modal" | "local" | "none";
2
+ type SandboxBackend = "docker" | "modal" | "local" | "none" | "daytona" | "runloop" | "e2b" | "blaxel" | "cloudflare" | "vercel";
3
+ type SandboxOs = "linux" | "macos" | "windows";
4
+ type SandboxCapabilityName = "FileSystem" | "Terminal" | "Git" | "DesktopStream" | "Recording";
5
+ type CapabilityUnavailableReason = "backend_unsupported" | "os_unsupported" | "not_provisioned" | "disabled_by_policy" | "lease_cold" | "tier_headless";
6
+ type SessionCapabilities = {
7
+ sessionId: string;
8
+ backend: SandboxBackend;
9
+ os: SandboxOs;
10
+ liveness: "cold" | "warming" | "warm" | "draining";
11
+ leaseEpoch: number;
12
+ viewerHeartbeatIntervalMs: number;
13
+ FileSystem: {
14
+ available: boolean;
15
+ readOnly: boolean;
16
+ root: string;
17
+ pathSep: "/" | "\\";
18
+ treeMode: "lazy" | "snapshot";
19
+ reason: CapabilityUnavailableReason | null;
20
+ };
21
+ Terminal: {
22
+ transport: "sse-events" | "pty-ws" | null;
23
+ ptyCapable: boolean;
24
+ shell: string;
25
+ url: string | null;
26
+ token: string | null;
27
+ reason: CapabilityUnavailableReason | null;
28
+ };
29
+ Git: {
30
+ available: boolean;
31
+ repos: string[];
32
+ reason: CapabilityUnavailableReason | null;
33
+ };
34
+ DesktopStream: {
35
+ transport: "vnc-ws" | "rdp-ws" | "webrtc" | null;
36
+ client: "novnc" | "web-rdp" | null;
37
+ mode: "read-only" | "interactive";
38
+ url: string | null;
39
+ token: string | null;
40
+ expiresAt: string | null;
41
+ resolution: [number, number];
42
+ unredacted: boolean;
43
+ requiresAcknowledgment: boolean;
44
+ acknowledged: boolean;
45
+ shared: boolean;
46
+ sharedSessionIds: string[];
47
+ reason: CapabilityUnavailableReason | null;
48
+ };
49
+ Recording: {
50
+ available: boolean;
51
+ modes: ("manual" | "on-turn" | "on-verify")[];
52
+ codecs: ("h264-mp4" | "vp9-webm")[];
53
+ reason: CapabilityUnavailableReason | null;
54
+ };
55
+ ComputerUse: {
56
+ available: boolean;
57
+ readOnly: boolean;
58
+ reason: CapabilityUnavailableReason | null;
59
+ };
60
+ negotiatedAt: string;
61
+ };
62
+ type FileSystemCapability = SessionCapabilities["FileSystem"];
63
+ type TerminalCapability = SessionCapabilities["Terminal"];
64
+ type GitCapability = SessionCapabilities["Git"];
65
+ type DesktopStreamCapability = SessionCapabilities["DesktopStream"];
66
+ type RecordingCapability = SessionCapabilities["Recording"];
67
+ type ComputerUseCapability = SessionCapabilities["ComputerUse"];
68
+ type StreamUrlRotatedPayload = {
69
+ url: string;
70
+ token: string | null;
71
+ expiresAt: string | null;
72
+ leaseEpoch: number;
73
+ transport: "vnc-ws";
74
+ viewerId: string | null;
75
+ };
76
+ type StreamOpenedPayload = {
77
+ viewerId: string;
78
+ shared: boolean;
79
+ viewerCount: number;
80
+ };
81
+ type StreamClosedPayload = {
82
+ viewerId: string;
83
+ reason: "client-disconnect" | "reaped" | "revoked" | "box-rollover";
84
+ viewerCount: number;
85
+ };
86
+ type StreamRevokedPayload = {
87
+ viewerId: string | null;
88
+ reason: "grant-revoked" | "session-failed" | "admin";
89
+ };
90
+ type AttachViewerRequest = {
91
+ viewerId?: string | undefined;
92
+ desktop?: boolean | undefined;
93
+ };
94
+ type ViewerHolder = {
95
+ viewerId: string;
96
+ sandboxGroupId: string;
97
+ liveness: "cold" | "warming" | "warm" | "draining";
98
+ leaseEpoch: number;
99
+ viewerHeartbeatIntervalMs: number;
100
+ dataPlaneUrl: string | null;
101
+ };
102
+ type AttachViewerResponse = ViewerHolder & {
103
+ streamToken: string | null;
104
+ streamExpiresAt: string | null;
105
+ resolution: [number, number] | null;
106
+ transport: "vnc-ws" | null;
107
+ client: "novnc" | null;
108
+ terminalUrl: string | null;
109
+ terminalToken: string | null;
110
+ terminalTransport: "pty-ws" | null;
111
+ };
112
+ type AcknowledgeStreamRequest = {
113
+ acknowledgeUnredacted?: boolean | undefined;
114
+ acknowledgeShared?: boolean | undefined;
115
+ };
116
+ type AcknowledgeStreamResponse = {
117
+ acknowledged: boolean;
118
+ acknowledgedShared: boolean;
119
+ };
120
+ type ViewerHeartbeatRequest = {
121
+ leaseEpoch: number;
122
+ };
123
+ type ViewerHeartbeatResponse = {
124
+ alive: boolean;
125
+ };
3
126
  type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
4
127
  type RepositoryResourceRef = {
5
128
  kind: "repository";
@@ -31,6 +154,8 @@ type Session = {
31
154
  accountId: string;
32
155
  status: SessionStatus;
33
156
  initialMessage: string;
157
+ title: string | null;
158
+ titleSource: "user" | "agent" | null;
34
159
  resources: ResourceRef[];
35
160
  tools: ToolRef[];
36
161
  metadata: Record<string, unknown>;
@@ -68,7 +193,7 @@ type SessionTurn = {
68
193
  createdAt: string;
69
194
  updatedAt: string;
70
195
  };
71
- declare const SESSION_EVENT_TYPES: readonly ["session.created", "session.status.changed", "session.requiresAction", "session.context.compacted", "session.context.cleared", "user.message", "user.interrupt", "user.approvalDecision", "turn.queued", "turn.updated", "turn.started", "turn.completed", "turn.failed", "turn.cancelled", "turn.preempted", "agent.message.delta", "agent.message.completed", "agent.reasoning.delta", "agent.toolCall.created", "agent.toolCall.output", "agent.updated", "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.continuation"];
196
+ declare const SESSION_EVENT_TYPES: readonly ["session.created", "session.status.changed", "session.requiresAction", "session.context.compacted", "session.context.cleared", "user.message", "user.interrupt", "user.approvalDecision", "turn.queued", "turn.updated", "turn.started", "turn.completed", "turn.failed", "turn.cancelled", "turn.preempted", "agent.message.delta", "agent.message.completed", "agent.reasoning.delta", "agent.toolCall.created", "agent.toolCall.output", "agent.updated", "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.continuation", "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"];
72
197
  type KnownSessionEventType = (typeof SESSION_EVENT_TYPES)[number];
73
198
  /**
74
199
  * Event types the SDK knows about today, kept open so a newer OpenGeni server
@@ -106,6 +231,319 @@ type AgentToolCallOutputPayload = {
106
231
  type SessionStatusChangedPayload = {
107
232
  status: SessionStatus;
108
233
  };
234
+ type RecordingMode = "manual" | "on-turn" | "on-verify";
235
+ type RecordingCodec = "h264-mp4" | "vp9-webm";
236
+ type RecordingContentType = "video/mp4" | "video/webm";
237
+ type RecordingFailedReason = "ffmpeg-error" | "box-death" | "box-rollover" | "upload-failed" | "max-bytes-exceeded" | "display-unavailable";
238
+ type RecordingStartedPayload = {
239
+ recordingId: string;
240
+ turnId: string | null;
241
+ mode: RecordingMode;
242
+ codec: RecordingCodec;
243
+ dimensions: [number, number];
244
+ framerate: number;
245
+ startedAt: string;
246
+ reason?: string | null | undefined;
247
+ };
248
+ type RecordingAvailablePayload = {
249
+ recordingId: string;
250
+ turnId: string | null;
251
+ codec: RecordingCodec;
252
+ contentType: RecordingContentType;
253
+ storageKey: string;
254
+ durationSeconds: number | null;
255
+ sizeBytes: number;
256
+ dimensions: [number, number];
257
+ };
258
+ type RecordingFailedPayload = {
259
+ recordingId: string;
260
+ turnId: string | null;
261
+ reason: RecordingFailedReason;
262
+ detail?: string | null | undefined;
263
+ };
264
+ type SandboxCommandOutputDeltaPayload = {
265
+ stream: "stdout" | "stderr";
266
+ chunk: string;
267
+ commandId?: string | undefined;
268
+ seq?: number | undefined;
269
+ };
270
+ type FsChangeKind = "created" | "modified" | "deleted" | "renamed";
271
+ type FsChangedPayload = {
272
+ changes: {
273
+ path: string;
274
+ kind: FsChangeKind;
275
+ isDir: boolean;
276
+ sizeBytes: number | null;
277
+ oldPath?: string | undefined;
278
+ }[];
279
+ source: "write" | "watch" | "agent";
280
+ revision: number;
281
+ leaseEpoch: number;
282
+ };
283
+ type GitChangedPayload = {
284
+ head: string | null;
285
+ dirty: boolean;
286
+ ahead: number;
287
+ behind: number;
288
+ changedFileCount: number;
289
+ reason: "commit" | "checkout" | "stage" | "worktree" | "fetch" | "unknown";
290
+ revision: number;
291
+ leaseEpoch: number;
292
+ };
293
+ type TerminalPtyStartedPayload = {
294
+ ptyId: string;
295
+ cols: number;
296
+ rows: number;
297
+ shell: string;
298
+ cwd: string;
299
+ };
300
+ type TerminalPtyOutputDeltaPayload = {
301
+ ptyId: string;
302
+ stream: "stdout" | "stderr";
303
+ chunk: string;
304
+ seq: number;
305
+ };
306
+ type TerminalPtyExitedPayload = {
307
+ ptyId: string;
308
+ exitCode: number | null;
309
+ reason: "exit" | "killed" | "owner_gone" | "timeout";
310
+ };
311
+ type FsNodeType = "file" | "dir" | "symlink" | "other";
312
+ type FsTreeNode = {
313
+ name: string;
314
+ path: string;
315
+ type: FsNodeType;
316
+ sizeBytes: number | null;
317
+ mtimeMs: number | null;
318
+ mode: number | null;
319
+ children?: FsTreeNode[] | undefined;
320
+ truncated: boolean;
321
+ };
322
+ type FsEncoding = "utf8" | "base64";
323
+ type FsListRequest = {
324
+ path?: string;
325
+ depth?: number;
326
+ maxEntries?: number;
327
+ includeHidden?: boolean;
328
+ };
329
+ type FsListResponse = {
330
+ root: FsTreeNode;
331
+ revision: number;
332
+ truncated: boolean;
333
+ };
334
+ type FsReadRequest = {
335
+ path: string;
336
+ encoding?: FsEncoding;
337
+ maxBytes?: number;
338
+ };
339
+ type FsReadResponse = {
340
+ path: string;
341
+ encoding: FsEncoding;
342
+ content: string;
343
+ sizeBytes: number;
344
+ truncated: boolean;
345
+ isBinary: boolean;
346
+ revision: number;
347
+ };
348
+ type FsWriteRequest = {
349
+ path: string;
350
+ encoding?: FsEncoding;
351
+ content: string;
352
+ overwrite?: boolean;
353
+ createParents?: boolean;
354
+ };
355
+ type FsWriteResponse = {
356
+ path: string;
357
+ sizeBytes: number;
358
+ revision: number;
359
+ };
360
+ type FsDeleteRequest = {
361
+ path: string;
362
+ recursive?: boolean;
363
+ };
364
+ type FsDeleteResponse = {
365
+ revision: number;
366
+ };
367
+ type FsMoveRequest = {
368
+ path: string;
369
+ newPath: string;
370
+ overwrite?: boolean;
371
+ createParents?: boolean;
372
+ };
373
+ type FsMoveResponse = {
374
+ path: string;
375
+ newPath: string;
376
+ revision: number;
377
+ };
378
+ type FsMkdirRequest = {
379
+ path: string;
380
+ recursive?: boolean;
381
+ };
382
+ type FsMkdirResponse = {
383
+ path: string;
384
+ revision: number;
385
+ };
386
+ type GitFileStatusCode = "added" | "modified" | "deleted" | "renamed" | "copied" | "untracked" | "ignored" | "conflicted" | "typechange";
387
+ type GitFileStatus = {
388
+ path: string;
389
+ oldPath: string | null;
390
+ index: GitFileStatusCode | null;
391
+ worktree: GitFileStatusCode | null;
392
+ isConflicted: boolean;
393
+ };
394
+ type GitStatusRequest = {
395
+ path?: string;
396
+ };
397
+ type GitStatusResponse = {
398
+ isRepo: boolean;
399
+ head: string | null;
400
+ detached: boolean;
401
+ upstream: string | null;
402
+ ahead: number;
403
+ behind: number;
404
+ files: GitFileStatus[];
405
+ revision: number;
406
+ };
407
+ type GitDiffLineType = "context" | "add" | "del" | "meta";
408
+ type GitDiffLine = {
409
+ type: GitDiffLineType;
410
+ oldNo: number | null;
411
+ newNo: number | null;
412
+ text: string;
413
+ };
414
+ type GitDiffHunk = {
415
+ oldStart: number;
416
+ oldLines: number;
417
+ newStart: number;
418
+ newLines: number;
419
+ header: string;
420
+ lines: GitDiffLine[];
421
+ };
422
+ type GitFileDiff = {
423
+ path: string;
424
+ oldPath: string | null;
425
+ status: GitFileStatusCode;
426
+ isBinary: boolean;
427
+ isImage: boolean;
428
+ additions: number;
429
+ deletions: number;
430
+ hunks: GitDiffHunk[];
431
+ truncated: boolean;
432
+ };
433
+ type GitDiffRequest = {
434
+ path?: string;
435
+ staged?: boolean;
436
+ fromRef?: string;
437
+ toRef?: string;
438
+ pathspec?: string[];
439
+ contextLines?: number;
440
+ maxBytesPerFile?: number;
441
+ };
442
+ type GitDiffResponse = {
443
+ files: GitFileDiff[];
444
+ revision: number;
445
+ };
446
+ type GitLogRequest = {
447
+ path?: string;
448
+ ref?: string;
449
+ maxCount?: number;
450
+ skip?: number;
451
+ pathspec?: string[];
452
+ };
453
+ type GitCommit = {
454
+ sha: string;
455
+ shortSha: string;
456
+ parents: string[];
457
+ author: {
458
+ name: string;
459
+ email: string;
460
+ timestamp: number;
461
+ };
462
+ committer: {
463
+ name: string;
464
+ email: string;
465
+ timestamp: number;
466
+ };
467
+ subject: string;
468
+ body: string;
469
+ refs: string[];
470
+ };
471
+ type GitLogResponse = {
472
+ commits: GitCommit[];
473
+ hasMore: boolean;
474
+ };
475
+ type GitShowRequest = {
476
+ path?: string;
477
+ ref: string;
478
+ filePath?: string;
479
+ encoding?: FsEncoding;
480
+ maxBytesPerFile?: number;
481
+ };
482
+ type GitShowResponse = {
483
+ commit: GitCommit | null;
484
+ files: GitFileDiff[];
485
+ blob: {
486
+ content: string;
487
+ encoding: FsEncoding;
488
+ sizeBytes: number;
489
+ truncated: boolean;
490
+ } | null;
491
+ revision: number;
492
+ };
493
+ type TerminalExecRequest = {
494
+ command: string;
495
+ cwd?: string;
496
+ timeoutMs?: number;
497
+ emitStream?: boolean;
498
+ };
499
+ type TerminalExecResponse = {
500
+ stdout: string;
501
+ stderr: string;
502
+ exitCode: number | null;
503
+ running: boolean;
504
+ wallTimeSeconds: number;
505
+ };
506
+ type PtyOpenRequest = {
507
+ cols?: number;
508
+ rows?: number;
509
+ cwd?: string;
510
+ shell?: string;
511
+ };
512
+ type PtyOpenResponse = {
513
+ ptyId: string;
514
+ streamVia: "sse-events";
515
+ supportsInput: boolean;
516
+ };
517
+ type PtyWriteRequest = {
518
+ ptyId: string;
519
+ data: string;
520
+ };
521
+ type PtyResizeRequest = {
522
+ ptyId: string;
523
+ cols: number;
524
+ rows: number;
525
+ };
526
+ type PtyCloseRequest = {
527
+ ptyId: string;
528
+ };
529
+ type SessionStructuredCapabilities = {
530
+ FileSystem: {
531
+ available: boolean;
532
+ readOnly: boolean;
533
+ root: string;
534
+ };
535
+ Terminal: {
536
+ events: boolean;
537
+ exec: boolean;
538
+ pty: {
539
+ available: boolean;
540
+ };
541
+ };
542
+ Git: {
543
+ available: boolean;
544
+ repos: string[];
545
+ };
546
+ };
109
547
  type ScheduledTaskStatus = "active" | "paused";
110
548
  type ScheduledTaskRunMode = "new_session_per_run" | "reusable_session";
111
549
  type ScheduledTaskOverlapPolicy = "allow_concurrent" | "skip" | "buffer_one";
@@ -167,7 +605,7 @@ type CreateSessionRequest = {
167
605
  idempotencyKey?: string | undefined;
168
606
  firstPartyMcpPermissions?: string[] | undefined;
169
607
  };
170
- 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", "files:upload", "files:read", "documents:manage", "documents:search", "scheduled_tasks:manage", "scheduled_tasks:run", "github:manage", "github:use", "api_keys:manage", "environments:manage", "environments:use", "goals:manage"];
608
+ 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", "environments:manage", "environments:use", "goals:manage"];
171
609
  type KnownPermission = (typeof KNOWN_PERMISSIONS)[number];
172
610
  /**
173
611
  * Permissions the SDK knows about today, kept open so a newer OpenGeni server
@@ -232,6 +670,11 @@ type ClientConfig = {
232
670
  };
233
671
  productAccessMode: ProductAccessMode;
234
672
  auth: ClientAuthConfig;
673
+ structuredServices: {
674
+ fileSystem: boolean;
675
+ git: boolean;
676
+ terminalEvents: boolean;
677
+ };
235
678
  };
236
679
  type AccountRole = "owner" | "admin" | "member";
237
680
  type AccountGrant = {
@@ -354,6 +797,9 @@ type UpdateSessionGoalRequest = {
354
797
  status: "paused" | "active";
355
798
  rationale?: string | undefined;
356
799
  };
800
+ type UpdateSessionRequest = {
801
+ title: string;
802
+ };
357
803
  /** Outcome of a manual /compact trigger. */
358
804
  type CompactSessionContextResult = {
359
805
  /**
@@ -807,7 +1253,7 @@ type BillingBalance = {
807
1253
  currency: "usd";
808
1254
  updatedAt: string;
809
1255
  };
810
- 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"];
1256
+ 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"];
811
1257
  type KnownUsageEventType = (typeof KNOWN_USAGE_EVENT_TYPES)[number];
812
1258
  type UsageEventType = KnownUsageEventType | (string & {});
813
1259
  type UsageEvent = {
@@ -971,6 +1417,7 @@ declare class OpenGeniClient {
971
1417
  constructor(options: OpenGeniClientOptions);
972
1418
  createSession(workspaceId: string, request: CreateSessionRequest): Promise<Session>;
973
1419
  getSession(workspaceId: string, sessionId: string): Promise<Session>;
1420
+ updateSession(workspaceId: string, sessionId: string, request: UpdateSessionRequest): Promise<Session>;
974
1421
  listSessions(workspaceId: string, options?: {
975
1422
  limit?: number;
976
1423
  }): Promise<Session[]>;
@@ -1062,6 +1509,63 @@ declare class OpenGeniClient {
1062
1509
  * it is a no-op (`status:"noop"`) with an explanatory message.
1063
1510
  */
1064
1511
  compactSessionContext(workspaceId: string, sessionId: string): Promise<CompactSessionContextResult>;
1512
+ /** FileSystem: list a directory tree (feeds the Pierre file tree). */
1513
+ fsList(workspaceId: string, sessionId: string, request?: FsListRequest): Promise<FsListResponse>;
1514
+ /** FileSystem: read a file (text or base64; binary-safe, size-capped). */
1515
+ fsRead(workspaceId: string, sessionId: string, request: FsReadRequest): Promise<FsReadResponse>;
1516
+ /** FileSystem: write a file (last-writer-wins; emits fs.changed). */
1517
+ fsWrite(workspaceId: string, sessionId: string, request: FsWriteRequest): Promise<FsWriteResponse>;
1518
+ /** FileSystem: delete a path (emits fs.changed). */
1519
+ fsDelete(workspaceId: string, sessionId: string, request: FsDeleteRequest): Promise<FsDeleteResponse>;
1520
+ /** FileSystem: move/rename a path (emits fs.changed; 409 if destination exists and overwrite is false). */
1521
+ fsMove(workspaceId: string, sessionId: string, request: FsMoveRequest): Promise<FsMoveResponse>;
1522
+ /** FileSystem: create a directory (emits fs.changed; recursive defaults to true). */
1523
+ fsMkdir(workspaceId: string, sessionId: string, request: FsMkdirRequest): Promise<FsMkdirResponse>;
1524
+ /** Git: working-tree/index status (the Pierre file-status feed). */
1525
+ gitStatus(workspaceId: string, sessionId: string, request?: GitStatusRequest): Promise<GitStatusResponse>;
1526
+ /** Git: structured diff hunks (the Pierre diff feed). */
1527
+ gitDiff(workspaceId: string, sessionId: string, request?: GitDiffRequest): Promise<GitDiffResponse>;
1528
+ /** Git: commit log. */
1529
+ gitLog(workspaceId: string, sessionId: string, request?: GitLogRequest): Promise<GitLogResponse>;
1530
+ /** Git: show a commit (diff vs first parent) or fetch a raw blob at a ref. */
1531
+ gitShow(workspaceId: string, sessionId: string, request: GitShowRequest): Promise<GitShowResponse>;
1532
+ /** Terminal: run a bounded command, returning buffered stdout/stderr inline. */
1533
+ terminalExec(workspaceId: string, sessionId: string, request: TerminalExecRequest): Promise<TerminalExecResponse>;
1534
+ /** Terminal: open an interactive PTY. Output streams on the event SSE as
1535
+ * terminal.pty.output.delta; drive it with terminalPtyWrite. */
1536
+ terminalPtyOpen(workspaceId: string, sessionId: string, request?: PtyOpenRequest): Promise<PtyOpenResponse>;
1537
+ /** Terminal: send stdin to an open PTY (output rides A1). */
1538
+ terminalPtyWrite(workspaceId: string, sessionId: string, request: PtyWriteRequest): Promise<void>;
1539
+ /** Terminal: resize an open PTY. */
1540
+ terminalPtyResize(workspaceId: string, sessionId: string, request: PtyResizeRequest): Promise<void>;
1541
+ /** Terminal: close an open PTY (idempotent). */
1542
+ terminalPtyClose(workspaceId: string, sessionId: string, request: PtyCloseRequest): Promise<void>;
1543
+ /** Read the negotiated capability doc for a session WITHOUT acquiring a viewer
1544
+ * holder (no warm, no spawn). Drives capability-gated rendering: which
1545
+ * surfaces mount, the per-surface unavailability reasons, and the lease
1546
+ * liveness the client polls on while `cold`/`warming`. The desktop URL/token
1547
+ * are minted in-process only when the box is warm AND the principal has
1548
+ * acknowledged the un-redacted plane. */
1549
+ getStreamCapabilities(workspaceId: string, sessionId: string): Promise<SessionCapabilities>;
1550
+ /** Record the calling principal's acknowledgment of the un-redacted desktop
1551
+ * pixel plane (and, when the box is shared, the shared-exposure disclosure).
1552
+ * The desktop viewer-attach path returns 409 until this is recorded. */
1553
+ acknowledgeStream(workspaceId: string, sessionId: string, request?: AcknowledgeStreamRequest): Promise<AcknowledgeStreamResponse>;
1554
+ /** Attach a viewer holder (refcounted liveness — keeps the box warm while
1555
+ * watched/used), spinning the box up in-process when cold, and mint the scoped
1556
+ * direct-to-provider URLs for the requested plane(s). `request.desktop:true`
1557
+ * opts into the un-redacted pixel plane and mints the noVNC URL — that plane
1558
+ * alone throws `OpenGeniApiError(409)` when the un-redacted/shared
1559
+ * acknowledgment is missing (the consent gate). A terminal-only attach
1560
+ * (`desktop` omitted/false) warms the box + mints the pty-ws terminal cell with
1561
+ * NO consent gate. An omitted `viewerId` mints a fresh one. */
1562
+ attachViewer(workspaceId: string, sessionId: string, request?: AttachViewerRequest): Promise<AttachViewerResponse>;
1563
+ /** Heartbeat a viewer holder (Channel-A app-level liveness). A closed laptop
1564
+ * stops sending these → the reaper drops the holder within ~90s. Echoes
1565
+ * `leaseEpoch` so a superseded epoch is rejected (`alive:false` → re-attach). */
1566
+ heartbeatViewer(workspaceId: string, sessionId: string, viewerId: string, request: ViewerHeartbeatRequest): Promise<ViewerHeartbeatResponse>;
1567
+ /** Detach a viewer (delete this holder; idempotent delete-my-row). */
1568
+ detachViewer(workspaceId: string, sessionId: string, viewerId: string): Promise<void>;
1065
1569
  /**
1066
1570
  * The deployment's public client bootstrap config: the host-exposed models
1067
1571
  * (provider-grouped in `models`, flat in `allowedModels` for back-compat),
@@ -1141,6 +1645,11 @@ declare class OpenGeniClient {
1141
1645
  listDocuments(workspaceId: string, baseId: string): Promise<Document[]>;
1142
1646
  /** Retry indexing for a failed document. */
1143
1647
  reindexDocument(workspaceId: string, baseId: string, documentId: string): Promise<Document>;
1648
+ /**
1649
+ * Delete a document from a base. Removes the document row and its indexed
1650
+ * chunks while leaving the uploaded file asset available for other uses.
1651
+ */
1652
+ deleteDocument(workspaceId: string, baseId: string, documentId: string): Promise<void>;
1144
1653
  searchDocuments(workspaceId: string, baseId: string, request: {
1145
1654
  query: string;
1146
1655
  limit?: number;
@@ -1296,4 +1805,124 @@ type SseMessage = {
1296
1805
  };
1297
1806
  declare function parseSseStream(stream: ReadableStream<Uint8Array>): AsyncGenerator<SseMessage, void, void>;
1298
1807
 
1299
- export { type AccessContext, type AccessGrant, type AccountGrant, type AccountRole, type AddWorkspaceMemberRequest, type AgentMessageCompletedPayload, type AgentTextDeltaPayload, type AgentToolCallCreatedPayload, type AgentToolCallOutputPayload, type ApiKey, type BillingBalance, type BillingEntitlementsResponse, type BillingMode, type BillingSummary, type BillingUsageResponse, type CapabilityCatalogItem, type CapabilityCatalogResponse, type CapabilityInstallation, type CapabilityInstallationStatus, type CapabilityKind, type CapabilityPack, type CapabilityPackConnector, type CapabilityPackConnectorAuthModel, type CapabilityPackEnvironmentSpec, type CapabilityPackKnowledge, type CapabilityPackScheduledTaskTemplate, type CapabilityPackSkill, type CapabilityPackSkillFile, type CapabilityRuntime, type CapabilitySource, type ClientConfig, type ClientModel, type ClientSessionEventInput, type CompactSessionContextResult, type CompleteFileUploadResponse, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateCapabilityCatalogItemRequest, type CreateCheckoutRequest, type CreateCheckoutResponse, type CreateDocumentBaseRequest, type CreateFileUploadRequest, type CreateFileUploadResponse, type CreateGitHubAppManifestRequest, type CreateGitHubAppManifestResponse, type CreateScheduledTaskRequest, type CreateSessionRequest, type CreateWorkspaceEnvironmentRequest, type CreateWorkspaceRequest, type DiscoverMcpCapabilitiesResponse, type Document, type DocumentBase, type DocumentSearchRequest, type DocumentSearchResponse, type DocumentSearchResult, type DocumentStatus, type EnableCapabilityRequest, type EnablePackRequest, type EntitlementValue, type Entitlements, type EntitlementsMode, type FetchLike, type FileAsset, type FileDownloadUrlResponse, type FileResourceRef, type FileStatus, type FileUploadData, type GetPackResponse, type GitHubAppInfo, type GitHubRepositoriesResponse, type GitHubRepository, type GoalSpec, KNOWN_PERMISSIONS, KNOWN_USAGE_EVENT_TYPES, type KnownPermission, type KnownSessionEventType, type KnownUsageEventType, type ListApiKeysResponse, type ListPacksResponse, type ListWorkspaceMembersResponse, OpenGeniApiError, OpenGeniClient, type OpenGeniClientOptions, OpenGeniStreamError, type PackInstallation, type PackInstallationStatus, type Permission, type ProductAccessMode, type ProxySessionEventStreamOptions, type ReasoningEffort, type RegisterCapabilityPackRequest, type RepositoryResourceRef, type ResourceRef, SESSION_EVENT_TYPES, type SandboxBackend, type ScheduledTask, type ScheduledTaskAgentConfig, type ScheduledTaskAgentConfigInput, type ScheduledTaskDayOfWeek, type ScheduledTaskOverlapPolicy, type ScheduledTaskRun, type ScheduledTaskRunMode, type ScheduledTaskRunStatus, type ScheduledTaskScheduleSpec, type ScheduledTaskStatus, type ScheduledTaskTriggerType, type SendMessageInput, type Session, type SessionEvent, type SessionEventStreamTransport, type SessionEventType, type SessionGoal, type SessionGoalCreatedBy, type SessionGoalStatus, type SessionStatus, type SessionStatusChangedPayload, type SessionTurn, type SessionTurnSource, type SessionTurnStatus, type SseMessage, type SseReStreamOptions, type SteerMessageResult, type StreamConnectionState, type StreamSessionEventsOptions, type ToolRef, type UpdateScheduledTaskRequest, type UpdateSessionGoalRequest, type UpdateSessionTurnRequest, type UpdateWorkspaceEnvironmentRequest, type UpdateWorkspaceMemberRequest, type UpdateWorkspaceRequest, type UploadFileInput, type UsageEvent, type UsageEventType, type UserApprovalDecisionEventInput, type UserInterruptEventInput, type UserMessageEventInput, type Workspace, type WorkspaceEnvironment, type WorkspaceEnvironmentVariableMetadata, type WorkspaceMember, type WorkspaceRegisteredPack, formatSseEvent, isRetryableStreamError, parseSseStream, proxySessionEventStream, resumeSequenceFromRequest, sessionEventsToSseResponse, sessionEventsToSseStream, streamSessionEvents };
1808
+ /**
1809
+ * Translate the negotiated desktop capability into the WebSocket URL the noVNC
1810
+ * RFB client connects to. The scoped provider token is ALREADY embedded in the
1811
+ * minted `url` (Modal tunnel host, Blaxel `bl_preview_token`, Daytona signed
1812
+ * preview) by `session.resolveExposedPort(6080)` — we do NOT append `cap.token`
1813
+ * as a query param (that double-auth was an adversarial-review bug: the box runs
1814
+ * `-nopw` in v1, so the RFB password is meaningless and the real auth is the
1815
+ * tunnel token in the host). We only normalize the scheme to `ws`/`wss` and, when
1816
+ * the minted URL points at a `vnc.html` viewer page, rewrite it to the
1817
+ * websockify socket path noVNC actually dials.
1818
+ */
1819
+ declare function desktopSocketUrl(cap: Pick<DesktopStreamCapability, "url">): string;
1820
+ /**
1821
+ * The minimal RFB surface the React component drives. Lets tests (and 3rd
1822
+ * parties swapping noVNC for a WebRTC client in v3) provide a fake without the
1823
+ * DOM. Matches `@novnc/novnc`'s RFB constructor + lifecycle.
1824
+ */
1825
+ interface DesktopRfbLike {
1826
+ viewOnly: boolean;
1827
+ scaleViewport: boolean;
1828
+ /**
1829
+ * 1:1 viewport clipping. We always drive this FALSE: with clipping on, noVNC
1830
+ * paints the framebuffer pixel-for-pixel and scrolls/crops to the container
1831
+ * (the "zoomed in" look). FALSE lets `scaleViewport` shrink the 1280x800 frame
1832
+ * to fit the panel (aspect-preserved). Declared so the hook can pin it instead
1833
+ * of relying on noVNC's default — `scaleViewport=true` forces clip off
1834
+ * internally, but a stale/partial state on reconnect could leave it on.
1835
+ */
1836
+ clipViewport: boolean;
1837
+ addEventListener(type: "connect" | "disconnect" | "securityfailure", cb: (e?: unknown) => void): void;
1838
+ removeEventListener?: (type: "connect" | "disconnect" | "securityfailure", cb: (e?: unknown) => void) => void;
1839
+ disconnect(): void;
1840
+ }
1841
+ type DesktopRfbFactory = (target: HTMLElement, url: string, opts: {
1842
+ credentials?: {
1843
+ password?: string | undefined;
1844
+ } | undefined;
1845
+ }) => DesktopRfbLike;
1846
+ type DesktopConnectionState = "idle" | "negotiating" | "connecting" | "connected" | "rotating" | "reconnecting" | "error" | "ended";
1847
+ type DesktopStreamEvent = {
1848
+ type: "negotiated";
1849
+ } | {
1850
+ type: "connected";
1851
+ } | {
1852
+ type: "disconnected";
1853
+ } | {
1854
+ type: "rotate";
1855
+ } | {
1856
+ type: "fail";
1857
+ } | {
1858
+ type: "abort";
1859
+ };
1860
+ /**
1861
+ * Pure reducer for the desktop connection lifecycle. The component owns the RFB
1862
+ * object + DOM; this owns the transitions so they are unit-testable. Mirrors the
1863
+ * Channel-A stream reducer discipline.
1864
+ */
1865
+ declare function nextDesktopState(current: DesktopConnectionState, ev: DesktopStreamEvent): DesktopConnectionState;
1866
+ type DesktopStreamCapabilityLike = {
1867
+ url: string | null;
1868
+ token: string | null;
1869
+ expiresAt: string | null;
1870
+ };
1871
+ /**
1872
+ * Apply a `stream.url.rotated` event onto a desktop capability, fencing on
1873
+ * leaseEpoch (split-brain). A rotation minted under an epoch the client has
1874
+ * already advanced PAST is from a superseded owner and is dropped (returns
1875
+ * null); otherwise the fresh url/token/expiresAt are folded in.
1876
+ */
1877
+ declare function applyUrlRotation<T extends DesktopStreamCapabilityLike>(cap: T, payload: StreamUrlRotatedPayload, knownEpoch: number): T | null;
1878
+
1879
+ /**
1880
+ * Translate the negotiated `pty-ws` Terminal capability into the WebSocket URL
1881
+ * the ttyd client dials. The scoped provider token is ALREADY embedded in the
1882
+ * minted `url` (the Modal tunnel host) by `session.resolveExposedPort(7681)` —
1883
+ * we do NOT append `cap.token` (identical posture to the desktop: the gate is the
1884
+ * unguessable short-TTL tunnel URL + the server-recorded scoped stream token; ttyd
1885
+ * runs `--writable` with no `-c` credential in v1). We only normalize the scheme
1886
+ * to `ws`/`wss`; a bare host is already the ttyd websocket endpoint.
1887
+ */
1888
+ declare function terminalSocketUrl(cap: Pick<TerminalCapability, "url">): string;
1889
+ /** ttyd subprotocol — REQUIRED on the WebSocket handshake or ttyd refuses it. */
1890
+ declare const TTYD_SUBPROTOCOL = "tty";
1891
+ /** Client→server command bytes (the first char of each outbound text frame). */
1892
+ declare const TtydClientCommand: {
1893
+ /** stdin: "0" + raw input bytes. */
1894
+ readonly INPUT: "0";
1895
+ /** window resize: "1" + JSON.stringify({ columns, rows }). */
1896
+ readonly RESIZE: "1";
1897
+ /** flow-control pause (back-pressure): "2". */
1898
+ readonly PAUSE: "2";
1899
+ /** flow-control resume: "3". */
1900
+ readonly RESUME: "3";
1901
+ };
1902
+ /** Server→client command bytes (the first char of each inbound frame). */
1903
+ declare const TtydServerCommand: {
1904
+ /** stdout/stderr: "0" + raw output bytes (write the rest into xterm). */
1905
+ readonly OUTPUT: "0";
1906
+ /** set the window title: "1" + title string. */
1907
+ readonly SET_WINDOW_TITLE: "1";
1908
+ /** ttyd client preferences JSON: "2" + json (ignored by us). */
1909
+ readonly SET_PREFERENCES: "2";
1910
+ };
1911
+ /**
1912
+ * The ttyd handshake's first frame: an auth message. ttyd expects
1913
+ * `JSON.stringify({ AuthToken })` as the FIRST text frame on the socket. We send
1914
+ * an empty token — our gate is the tunnel URL + scoped stream token, NOT a ttyd
1915
+ * `-c` basic-auth credential (which the box does not set in v1). Optional ttyd
1916
+ * `columns`/`rows` can ride this frame to seed the PTY size before the first
1917
+ * resize. Pure (string-building only) so it stays unit-testable in the SDK.
1918
+ */
1919
+ declare function ttydAuthFrame(opts?: {
1920
+ columns?: number;
1921
+ rows?: number;
1922
+ }): string;
1923
+ /** Build a client→server INPUT (stdin) frame: "0" + data. */
1924
+ declare function ttydInputFrame(data: string): string;
1925
+ /** Build a client→server RESIZE frame: "1" + JSON.stringify({ columns, rows }). */
1926
+ declare function ttydResizeFrame(columns: number, rows: number): string;
1927
+
1928
+ export { type AccessContext, type AccessGrant, type AccountGrant, type AccountRole, type AcknowledgeStreamRequest, type AcknowledgeStreamResponse, type AddWorkspaceMemberRequest, type AgentMessageCompletedPayload, type AgentTextDeltaPayload, type AgentToolCallCreatedPayload, type AgentToolCallOutputPayload, type ApiKey, type AttachViewerRequest, type AttachViewerResponse, type BillingBalance, type BillingEntitlementsResponse, type BillingMode, type BillingSummary, type BillingUsageResponse, type CapabilityCatalogItem, type CapabilityCatalogResponse, type CapabilityInstallation, type CapabilityInstallationStatus, type CapabilityKind, type CapabilityPack, type CapabilityPackConnector, type CapabilityPackConnectorAuthModel, type CapabilityPackEnvironmentSpec, type CapabilityPackKnowledge, type CapabilityPackScheduledTaskTemplate, type CapabilityPackSkill, type CapabilityPackSkillFile, type CapabilityRuntime, type CapabilitySource, type CapabilityUnavailableReason, type ClientAuthConfig, type ClientConfig, type ClientModel, type ClientSessionEventInput, type CompactSessionContextResult, type CompleteFileUploadResponse, type ComputerUseCapability, type CreateApiKeyRequest, type CreateApiKeyResponse, type CreateCapabilityCatalogItemRequest, type CreateCheckoutRequest, type CreateCheckoutResponse, type CreateDocumentBaseRequest, type CreateFileUploadRequest, type CreateFileUploadResponse, type CreateGitHubAppManifestRequest, type CreateGitHubAppManifestResponse, type CreateScheduledTaskRequest, type CreateSessionRequest, type CreateWorkspaceEnvironmentRequest, type CreateWorkspaceRequest, type DesktopConnectionState, type DesktopRfbFactory, type DesktopRfbLike, type DesktopStreamCapability, type DesktopStreamEvent, type DiscoverMcpCapabilitiesResponse, type Document, type DocumentBase, type DocumentSearchRequest, type DocumentSearchResponse, type DocumentSearchResult, type DocumentStatus, type EnableCapabilityRequest, type EnablePackRequest, type EntitlementValue, type Entitlements, type EntitlementsMode, type FetchLike, type FileAsset, type FileDownloadUrlResponse, type FileResourceRef, type FileStatus, type FileSystemCapability, type FileUploadData, type FsChangeKind, type FsChangedPayload, type FsDeleteRequest, type FsDeleteResponse, type FsEncoding, type FsListRequest, type FsListResponse, type FsMkdirRequest, type FsMkdirResponse, type FsMoveRequest, type FsMoveResponse, type FsNodeType, type FsReadRequest, type FsReadResponse, type FsTreeNode, type FsWriteRequest, type FsWriteResponse, type GetPackResponse, type GitCapability, type GitChangedPayload, type GitCommit, type GitDiffHunk, type GitDiffLine, type GitDiffLineType, type GitDiffRequest, type GitDiffResponse, type GitFileDiff, type GitFileStatus, type GitFileStatusCode, type GitHubAppInfo, type GitHubRepositoriesResponse, type GitHubRepository, type GitLogRequest, type GitLogResponse, type GitShowRequest, type GitShowResponse, type GitStatusRequest, type GitStatusResponse, type GoalSpec, KNOWN_PERMISSIONS, KNOWN_USAGE_EVENT_TYPES, type KnownPermission, type KnownSessionEventType, type KnownUsageEventType, type ListApiKeysResponse, type ListPacksResponse, type ListWorkspaceMembersResponse, OpenGeniApiError, OpenGeniClient, type OpenGeniClientOptions, OpenGeniStreamError, type PackInstallation, type PackInstallationStatus, type Permission, type ProductAccessMode, type ProxySessionEventStreamOptions, type PtyCloseRequest, type PtyOpenRequest, type PtyOpenResponse, type PtyResizeRequest, type PtyWriteRequest, type ReasoningEffort, type RecordingAvailablePayload, type RecordingCapability, type RecordingCodec, type RecordingContentType, type RecordingFailedPayload, type RecordingFailedReason, type RecordingMode, type RecordingStartedPayload, type RegisterCapabilityPackRequest, type RepositoryResourceRef, type ResourceRef, SESSION_EVENT_TYPES, type SandboxBackend, type SandboxCapabilityName, type SandboxCommandOutputDeltaPayload, type SandboxOs, type ScheduledTask, type ScheduledTaskAgentConfig, type ScheduledTaskAgentConfigInput, type ScheduledTaskDayOfWeek, type ScheduledTaskOverlapPolicy, type ScheduledTaskRun, type ScheduledTaskRunMode, type ScheduledTaskRunStatus, type ScheduledTaskScheduleSpec, type ScheduledTaskStatus, type ScheduledTaskTriggerType, type SendMessageInput, type Session, type SessionCapabilities, type SessionEvent, type SessionEventStreamTransport, type SessionEventType, type SessionGoal, type SessionGoalCreatedBy, type SessionGoalStatus, type SessionStatus, type SessionStatusChangedPayload, type SessionStructuredCapabilities, type SessionTurn, type SessionTurnSource, type SessionTurnStatus, type SseMessage, type SseReStreamOptions, type SteerMessageResult, type StreamClosedPayload, type StreamConnectionState, type StreamOpenedPayload, type StreamRevokedPayload, type StreamSessionEventsOptions, type StreamUrlRotatedPayload, TTYD_SUBPROTOCOL, type TerminalCapability, type TerminalExecRequest, type TerminalExecResponse, type TerminalPtyExitedPayload, type TerminalPtyOutputDeltaPayload, type TerminalPtyStartedPayload, type ToolRef, TtydClientCommand, TtydServerCommand, type UpdateScheduledTaskRequest, type UpdateSessionGoalRequest, type UpdateSessionRequest, type UpdateSessionTurnRequest, type UpdateWorkspaceEnvironmentRequest, type UpdateWorkspaceMemberRequest, type UpdateWorkspaceRequest, type UploadFileInput, type UsageEvent, type UsageEventType, type UserApprovalDecisionEventInput, type UserInterruptEventInput, type UserMessageEventInput, type ViewerHeartbeatRequest, type ViewerHeartbeatResponse, type ViewerHolder, type Workspace, type WorkspaceEnvironment, type WorkspaceEnvironmentVariableMetadata, type WorkspaceMember, type WorkspaceRegisteredPack, applyUrlRotation, desktopSocketUrl, formatSseEvent, isRetryableStreamError, nextDesktopState, parseSseStream, proxySessionEventStream, resumeSequenceFromRequest, sessionEventsToSseResponse, sessionEventsToSseStream, streamSessionEvents, terminalSocketUrl, ttydAuthFrame, ttydInputFrame, ttydResizeFrame };