@opengeni/sdk 0.11.0 → 0.13.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/src/types.ts CHANGED
@@ -8,6 +8,9 @@ export type SessionStatus =
8
8
  | "running"
9
9
  | "idle"
10
10
  | "requires_action"
11
+ | "recovering"
12
+ | "waiting_capacity"
13
+ | "paused"
11
14
  | "failed"
12
15
  | "cancelled";
13
16
 
@@ -209,6 +212,7 @@ export type ViewerHeartbeatRequest = { leaseEpoch: number };
209
212
  export type ViewerHeartbeatResponse = { alive: boolean };
210
213
 
211
214
  export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
215
+ export type GitCredentialProvider = "github" | "gitlab" | "azure_devops";
212
216
 
213
217
  export type RepositoryResourceRef = {
214
218
  kind: "repository";
@@ -216,6 +220,11 @@ export type RepositoryResourceRef = {
216
220
  ref: string;
217
221
  mountPath?: string | undefined;
218
222
  subpath?: string | undefined;
223
+ provider?: GitCredentialProvider | undefined;
224
+ repositoryId?: number | string | undefined;
225
+ installationId?: number | string | undefined;
226
+ projectId?: number | string | undefined;
227
+ connectionId?: string | undefined;
219
228
  githubInstallationId?: number | undefined;
220
229
  githubRepositoryId?: number | undefined;
221
230
  };
@@ -331,6 +340,13 @@ export type OAuthStartRequest = {
331
340
  requestedScopes?: string[] | undefined;
332
341
  returnPath?: string | undefined;
333
342
  connectionId?: string | undefined;
343
+ oauthClient?:
344
+ | {
345
+ clientId: string;
346
+ clientSecret?: string | undefined;
347
+ tokenEndpointAuthMethod?: "none" | "client_secret_post" | "client_secret_basic" | undefined;
348
+ }
349
+ | undefined;
334
350
  };
335
351
 
336
352
  export type OAuthStartResponse = {
@@ -364,30 +380,102 @@ export type Session = {
364
380
  metadata: Record<string, unknown>;
365
381
  model: string;
366
382
  sandboxBackend: SandboxBackend;
383
+ sandboxOs: SandboxOs;
384
+ sandboxGroupId: string;
385
+ activeSandboxId: string | null;
386
+ activeEpoch: number;
387
+ variableSetId: string | null;
388
+ /** @deprecated use variableSetId */
367
389
  environmentId: string | null;
390
+ // The rig + frozen rig version this session rides (M3). Both null for a
391
+ // rig-less session. Frozen at create; a later rig promote never moves them.
392
+ rigId: string | null;
393
+ rigVersionId: string | null;
368
394
  firstPartyMcpPermissions: string[] | null;
369
395
  mcpServers: SessionMcpServerMetadata[];
396
+ parentSessionId: string | null;
370
397
  createIdempotencyKey: string | null;
371
398
  temporalWorkflowId: string | null;
372
399
  activeTurnId: string | null;
400
+ queueVersion: number;
401
+ queueHeadPosition: number;
402
+ queueTailPosition: number;
403
+ controlState: "active" | "paused";
404
+ controlGeneration: number;
405
+ controlReason: string | null;
406
+ controlChangedBy: string | null;
407
+ controlChangedAt: string | null;
408
+ workspaceRunExceptionGeneration: number | null;
373
409
  lastSequence: number;
374
410
  /** Multi-account Codex (P1): the account this session is pinned to (null ⇒ follow workspace active). */
375
411
  codexPinnedCredentialId?: string | null;
376
412
  /** Multi-account Codex (P1): the account the most recent turn ran on (the "Running on:" indicator). */
377
413
  codexLastCredentialId?: string | null;
414
+ /** Personal (authenticated subject) workspace pin state, never workspace-global. */
415
+ pinned?: boolean;
416
+ /** Stable pin ordering key; null when this subject has not pinned the session. */
417
+ pinnedAt?: string | null;
418
+ /** Optimistic pin-state revision; zero represents an absent pin relation. */
419
+ pinVersion?: number;
420
+ /** Server-authoritative descendant counts populated by session-list reads. */
421
+ treeStats?:
422
+ | {
423
+ directChildren: number;
424
+ totalDescendants: number;
425
+ runningDescendants: number;
426
+ queuedDescendants: number;
427
+ attentionDescendants: number;
428
+ pausedDescendants: number;
429
+ failedDescendants: number;
430
+ }
431
+ | undefined;
378
432
  createdAt: string;
379
433
  updatedAt: string;
380
434
  };
381
435
 
436
+ export type SessionSummary = Session;
437
+
438
+ /** Canonical session-list page; pinned rows are excluded from ordinary pages. */
439
+ export type SessionListResponse = {
440
+ pinned: Session[];
441
+ sessions: Session[];
442
+ nextCursor: string | null;
443
+ };
444
+
445
+ export type UpdateSessionPinRequest = {
446
+ pinned: boolean;
447
+ expectedVersion?: number;
448
+ };
449
+
450
+ export type LineageNode = {
451
+ session: SessionSummary;
452
+ children: LineageNode[];
453
+ };
454
+
455
+ export type SessionLineageResponse = {
456
+ ancestors: SessionSummary[];
457
+ children: LineageNode[];
458
+ truncated: boolean;
459
+ };
460
+
382
461
  export type SessionTurnStatus =
383
462
  | "queued"
384
463
  | "running"
385
464
  | "requires_action"
465
+ | "recovering"
466
+ | "waiting_capacity"
386
467
  | "completed"
387
468
  | "failed"
388
- | "cancelled";
469
+ | "cancelled"
470
+ | "superseded";
389
471
 
390
- export type SessionTurnSource = "user" | "scheduled_task" | "api" | "goal";
472
+ export type SessionTurnSource =
473
+ | "user"
474
+ | "scheduled_task"
475
+ | "api"
476
+ | "goal"
477
+ | "system"
478
+ | "compaction";
391
479
 
392
480
  export type SessionTurn = {
393
481
  id: string;
@@ -404,7 +492,14 @@ export type SessionTurn = {
404
492
  model: string;
405
493
  reasoningEffort: ReasoningEffort;
406
494
  sandboxBackend: SandboxBackend;
495
+ sandboxOs: SandboxOs | null;
407
496
  metadata: Record<string, unknown>;
497
+ version: number;
498
+ executionGeneration: number;
499
+ activeAttemptId: string | null;
500
+ lineage: Record<string, unknown>;
501
+ cancelledBy?: string | null;
502
+ cancelReason?: string | null;
408
503
  startedAt: string | null;
409
504
  finishedAt: string | null;
410
505
  createdAt: string;
@@ -415,25 +510,33 @@ export const SESSION_EVENT_TYPES = [
415
510
  "session.created",
416
511
  "session.status.changed",
417
512
  "session.requiresAction",
513
+ "session.context.compaction.requested",
418
514
  "session.context.compacted",
515
+ "session.context.compaction.skipped",
419
516
  "session.context.cleared",
420
517
  "user.message",
421
- "user.interrupt",
518
+ "user.pause",
422
519
  "user.approvalDecision",
423
520
  "turn.queued",
424
- "turn.updated",
425
521
  "turn.started",
426
522
  "turn.completed",
427
523
  "turn.failed",
428
524
  "turn.cancelled",
429
- "turn.preempted",
525
+ "turn.superseded",
526
+ "turn.recovery.requested",
527
+ "turn.capacity_waiting",
430
528
  "agent.message.delta",
431
529
  "agent.message.completed",
432
530
  "agent.reasoning.delta",
433
531
  "agent.toolCall.created",
434
532
  "agent.toolCall.output",
533
+ "agent.model.usage",
435
534
  "tool.auth_needed",
436
535
  "agent.updated",
536
+ "rig.setup.started",
537
+ "rig.setup.completed",
538
+ "rig.setup.skipped",
539
+ "rig.setup.failed",
437
540
  "sandbox.operation.started",
438
541
  "sandbox.operation.completed",
439
542
  "sandbox.operation.failed",
@@ -444,7 +547,20 @@ export const SESSION_EVENT_TYPES = [
444
547
  "goal.completed",
445
548
  "goal.paused",
446
549
  "goal.resumed",
550
+ "goal.cleared",
447
551
  "goal.continuation",
552
+ "system.update.pending",
553
+ "system.update.delivered",
554
+ "session.control.paused",
555
+ "session.control.resumed",
556
+ "session.control.steer_requested",
557
+ "workspace.inference.paused",
558
+ "workspace.inference.resumed",
559
+ "session.queue.prompt.cancelled",
560
+ "session.queue.history",
561
+ "turn.event.rejected_late",
562
+ "memory.saved",
563
+ "memory.corrected",
448
564
  // Channel-B desktop pixel-plane signals (mirror of contracts SessionEventType;
449
565
  // the contract-parity test asserts sorted equality).
450
566
  "stream.url.rotated",
@@ -465,6 +581,36 @@ export const SESSION_EVENT_TYPES = [
465
581
  "session.title_set",
466
582
  // Multi-account Codex (P1): the session's inference account changed.
467
583
  "codex.account.switched",
584
+ // OPE-21 metadata-only per-turn credential selection audit.
585
+ "codex.credential.selected",
586
+ // OPE-21 durable zero-capacity wait lifecycle. These are system/runtime
587
+ // events, never synthetic user messages.
588
+ "codex.capacity.waiting",
589
+ "codex.capacity.resumed",
590
+ "codex.capacity.superseded",
591
+ // Sandbox durability observability (mirror of contracts SessionEventType):
592
+ // box lifecycle + manifest-env drift, attributable from the DB alone.
593
+ "sandbox.box.created",
594
+ "sandbox.box.lost",
595
+ "sandbox.box.terminated",
596
+ "sandbox.box.snapshot",
597
+ "sandbox.env.drift",
598
+ // Active-sandbox pointer reconcile (issue #341; announce-only; mirror of contracts
599
+ // SessionEventType — the contract-parity test asserts sorted equality).
600
+ "session.route.reconciled",
601
+ // Workbench v2 turn-end workspace capture (announce-only; mirror of contracts
602
+ // SessionEventType — the contract-parity test asserts sorted equality).
603
+ "workspace.revision.captured",
604
+ "workspace.revision.degraded",
605
+ // Connected Machine op-outcome observability (announce-only, quiet; mirror of
606
+ // contracts SessionEventType — the contract-parity test asserts sorted equality).
607
+ "machine.op.failed",
608
+ "machine.op.recovered",
609
+ // Connected Machine link-plane observability (announce-only, quiet; mirror of
610
+ // contracts SessionEventType — the contract-parity test asserts sorted equality).
611
+ "machine.link.lost",
612
+ "machine.link.restored",
613
+ "machine.runner.restarted",
468
614
  ] as const;
469
615
 
470
616
  export type KnownSessionEventType = (typeof SESSION_EVENT_TYPES)[number];
@@ -486,6 +632,11 @@ export type SessionEvent = {
486
632
  occurredAt: string;
487
633
  clientEventId?: string | null | undefined;
488
634
  turnId?: string | null | undefined;
635
+ turnGeneration?: number | null | undefined;
636
+ turnAttemptId?: string | null | undefined;
637
+ turnAssociation?: "current" | "late_rejected" | "duplicate" | null | undefined;
638
+ duplicateOfEventId?: string | null | undefined;
639
+ duplicateReason?: string | null | undefined;
489
640
  };
490
641
 
491
642
  export type ToolAuthNeededPayload = {
@@ -565,7 +716,13 @@ export type SandboxCommandOutputDeltaPayload = {
565
716
  };
566
717
  export type FsChangeKind = "created" | "modified" | "deleted" | "renamed";
567
718
  export type FsChangedPayload = {
568
- changes: { path: string; kind: FsChangeKind; isDir: boolean; sizeBytes: number | null; oldPath?: string | undefined }[];
719
+ changes: {
720
+ path: string;
721
+ kind: FsChangeKind;
722
+ isDir: boolean;
723
+ sizeBytes: number | null;
724
+ oldPath?: string | undefined;
725
+ }[];
569
726
  source: "write" | "watch" | "agent";
570
727
  revision: number;
571
728
  leaseEpoch: number;
@@ -580,9 +737,24 @@ export type GitChangedPayload = {
580
737
  revision: number;
581
738
  leaseEpoch: number;
582
739
  };
583
- export type TerminalPtyStartedPayload = { ptyId: string; cols: number; rows: number; shell: string; cwd: string };
584
- export type TerminalPtyOutputDeltaPayload = { ptyId: string; stream: "stdout" | "stderr"; chunk: string; seq: number };
585
- export type TerminalPtyExitedPayload = { ptyId: string; exitCode: number | null; reason: "exit" | "killed" | "owner_gone" | "timeout" };
740
+ export type TerminalPtyStartedPayload = {
741
+ ptyId: string;
742
+ cols: number;
743
+ rows: number;
744
+ shell: string;
745
+ cwd: string;
746
+ };
747
+ export type TerminalPtyOutputDeltaPayload = {
748
+ ptyId: string;
749
+ stream: "stdout" | "stderr";
750
+ chunk: string;
751
+ seq: number;
752
+ };
753
+ export type TerminalPtyExitedPayload = {
754
+ ptyId: string;
755
+ exitCode: number | null;
756
+ reason: "exit" | "killed" | "owner_gone" | "timeout";
757
+ };
586
758
 
587
759
  // A2 FileSystem request/response.
588
760
  export type FsNodeType = "file" | "dir" | "symlink" | "other";
@@ -597,31 +769,115 @@ export type FsTreeNode = {
597
769
  truncated: boolean;
598
770
  };
599
771
  export type FsEncoding = "utf8" | "base64";
600
- export type FsListRequest = { path?: string; depth?: number; maxEntries?: number; includeHidden?: boolean };
772
+ export type FsListRequest = {
773
+ path?: string;
774
+ depth?: number;
775
+ maxEntries?: number;
776
+ includeHidden?: boolean;
777
+ };
601
778
  export type FsListResponse = { root: FsTreeNode; revision: number; truncated: boolean };
602
779
  export type FsReadRequest = { path: string; encoding?: FsEncoding; maxBytes?: number };
603
- export type FsReadResponse = { path: string; encoding: FsEncoding; content: string; sizeBytes: number; truncated: boolean; isBinary: boolean; revision: number };
604
- export type FsWriteRequest = { path: string; encoding?: FsEncoding; content: string; overwrite?: boolean; createParents?: boolean };
780
+ export type FsReadResponse = {
781
+ path: string;
782
+ encoding: FsEncoding;
783
+ content: string;
784
+ sizeBytes: number;
785
+ truncated: boolean;
786
+ isBinary: boolean;
787
+ revision: number;
788
+ };
789
+ export type FsWriteRequest = {
790
+ path: string;
791
+ encoding?: FsEncoding;
792
+ content: string;
793
+ overwrite?: boolean;
794
+ createParents?: boolean;
795
+ };
605
796
  export type FsWriteResponse = { path: string; sizeBytes: number; revision: number };
606
797
  export type FsDeleteRequest = { path: string; recursive?: boolean };
607
798
  export type FsDeleteResponse = { revision: number };
608
- export type FsMoveRequest = { path: string; newPath: string; overwrite?: boolean; createParents?: boolean };
799
+ export type FsMoveRequest = {
800
+ path: string;
801
+ newPath: string;
802
+ overwrite?: boolean;
803
+ createParents?: boolean;
804
+ };
609
805
  export type FsMoveResponse = { path: string; newPath: string; revision: number };
610
806
  export type FsMkdirRequest = { path: string; recursive?: boolean };
611
807
  export type FsMkdirResponse = { path: string; revision: number };
612
808
 
613
809
  // A2 Git request/response (the Pierre-diff feed).
614
- export type GitFileStatusCode = "added" | "modified" | "deleted" | "renamed" | "copied" | "untracked" | "ignored" | "conflicted" | "typechange";
615
- export type GitFileStatus = { path: string; oldPath: string | null; index: GitFileStatusCode | null; worktree: GitFileStatusCode | null; isConflicted: boolean };
810
+ export type GitFileStatusCode =
811
+ | "added"
812
+ | "modified"
813
+ | "deleted"
814
+ | "renamed"
815
+ | "copied"
816
+ | "untracked"
817
+ | "ignored"
818
+ | "conflicted"
819
+ | "typechange";
820
+ export type GitFileStatus = {
821
+ path: string;
822
+ oldPath: string | null;
823
+ index: GitFileStatusCode | null;
824
+ worktree: GitFileStatusCode | null;
825
+ isConflicted: boolean;
826
+ };
616
827
  export type GitStatusRequest = { path?: string };
617
- export type GitStatusResponse = { isRepo: boolean; head: string | null; detached: boolean; upstream: string | null; ahead: number; behind: number; files: GitFileStatus[]; revision: number };
828
+ export type GitStatusResponse = {
829
+ isRepo: boolean;
830
+ head: string | null;
831
+ detached: boolean;
832
+ upstream: string | null;
833
+ ahead: number;
834
+ behind: number;
835
+ files: GitFileStatus[];
836
+ revision: number;
837
+ };
618
838
  export type GitDiffLineType = "context" | "add" | "del" | "meta";
619
- export type GitDiffLine = { type: GitDiffLineType; oldNo: number | null; newNo: number | null; text: string };
620
- export type GitDiffHunk = { oldStart: number; oldLines: number; newStart: number; newLines: number; header: string; lines: GitDiffLine[] };
621
- export type GitFileDiff = { path: string; oldPath: string | null; status: GitFileStatusCode; isBinary: boolean; isImage: boolean; additions: number; deletions: number; hunks: GitDiffHunk[]; truncated: boolean };
622
- export type GitDiffRequest = { path?: string; staged?: boolean; fromRef?: string; toRef?: string; pathspec?: string[]; contextLines?: number; maxBytesPerFile?: number };
839
+ export type GitDiffLine = {
840
+ type: GitDiffLineType;
841
+ oldNo: number | null;
842
+ newNo: number | null;
843
+ text: string;
844
+ };
845
+ export type GitDiffHunk = {
846
+ oldStart: number;
847
+ oldLines: number;
848
+ newStart: number;
849
+ newLines: number;
850
+ header: string;
851
+ lines: GitDiffLine[];
852
+ };
853
+ export type GitFileDiff = {
854
+ path: string;
855
+ oldPath: string | null;
856
+ status: GitFileStatusCode;
857
+ isBinary: boolean;
858
+ isImage: boolean;
859
+ additions: number;
860
+ deletions: number;
861
+ hunks: GitDiffHunk[];
862
+ truncated: boolean;
863
+ };
864
+ export type GitDiffRequest = {
865
+ path?: string;
866
+ staged?: boolean;
867
+ fromRef?: string;
868
+ toRef?: string;
869
+ pathspec?: string[];
870
+ contextLines?: number;
871
+ maxBytesPerFile?: number;
872
+ };
623
873
  export type GitDiffResponse = { files: GitFileDiff[]; revision: number };
624
- export type GitLogRequest = { path?: string; ref?: string; maxCount?: number; skip?: number; pathspec?: string[] };
874
+ export type GitLogRequest = {
875
+ path?: string;
876
+ ref?: string;
877
+ maxCount?: number;
878
+ skip?: number;
879
+ pathspec?: string[];
880
+ };
625
881
  export type GitCommit = {
626
882
  sha: string;
627
883
  shortSha: string;
@@ -633,12 +889,139 @@ export type GitCommit = {
633
889
  refs: string[];
634
890
  };
635
891
  export type GitLogResponse = { commits: GitCommit[]; hasMore: boolean };
636
- export type GitShowRequest = { path?: string; ref: string; filePath?: string; encoding?: FsEncoding; maxBytesPerFile?: number };
637
- export type GitShowResponse = { commit: GitCommit | null; files: GitFileDiff[]; blob: { content: string; encoding: FsEncoding; sizeBytes: number; truncated: boolean } | null; revision: number };
892
+ export type GitShowRequest = {
893
+ path?: string;
894
+ ref: string;
895
+ filePath?: string;
896
+ encoding?: FsEncoding;
897
+ maxBytesPerFile?: number;
898
+ };
899
+ export type GitShowResponse = {
900
+ commit: GitCommit | null;
901
+ files: GitFileDiff[];
902
+ blob: { content: string; encoding: FsEncoding; sizeBytes: number; truncated: boolean } | null;
903
+ revision: number;
904
+ };
905
+
906
+ // Workbench v2 turn-end capture (mirror of `@opengeni/contracts` WorkspaceCapture*
907
+ // + the M2 read-API response shapes, dossier §10.3). Reuses FsTreeNode /
908
+ // GitFileStatus / GitFileDiff / GitFileStatusCode / FsEncoding above.
909
+ export type WorkspaceCaptureFile = {
910
+ path: string;
911
+ status: GitFileStatusCode;
912
+ hash: string | null;
913
+ baseHash: string | null;
914
+ contentRef: string | null;
915
+ sizeBytes: number;
916
+ isBinary: boolean;
917
+ tooLarge: boolean;
918
+ deleted: boolean;
919
+ };
920
+ export type WorkspaceCaptureRepo = {
921
+ root: string;
922
+ head: string | null;
923
+ detached: boolean;
924
+ upstream: string | null;
925
+ ahead: number;
926
+ behind: number;
927
+ status: GitFileStatus[];
928
+ diff: GitFileDiff[];
929
+ };
930
+ export type WorkspaceCaptureDegradedReason =
931
+ | "repository_discovery_command_failed"
932
+ | "repository_discovery_timed_out"
933
+ | "repository_discovery_result_limit_exceeded";
934
+ export type WorkspaceCaptureStats = {
935
+ repoCount: number;
936
+ fileCount: number;
937
+ additions: number;
938
+ deletions: number;
939
+ totalBytes: number;
940
+ tooLargeCount: number;
941
+ binaryCount: number;
942
+ treeEntryCount: number;
943
+ treeTruncated: boolean;
944
+ durationMs: number;
945
+ fingerprint?: string;
946
+ };
947
+ export type WorkspaceCaptureManifest = {
948
+ version: 1;
949
+ revision: number;
950
+ capturedAt: string;
951
+ turnId: string | null;
952
+ leaseEpoch: number;
953
+ treeIndex: FsTreeNode;
954
+ treeTruncated: boolean;
955
+ repos: WorkspaceCaptureRepo[];
956
+ files: WorkspaceCaptureFile[];
957
+ stats: WorkspaceCaptureStats;
958
+ };
959
+ export type WorkspaceRevisionCapturedPayload = {
960
+ revision: number;
961
+ turnId: string | null;
962
+ capturedAt: string;
963
+ leaseEpoch: number;
964
+ stats: WorkspaceCaptureStats;
965
+ };
966
+ export type WorkspaceRevisionDegradedPayload = {
967
+ revision: number;
968
+ turnId: string | null;
969
+ capturedAt: string;
970
+ leaseEpoch: number;
971
+ reason: WorkspaceCaptureDegradedReason;
972
+ };
973
+ export type WorkspaceCaptureSignedUrl = { url: string; expiresAt: string };
974
+ // GET …/workspace/capture. Exactly one of manifest/manifestUrl is non-null.
975
+ export type GetWorkspaceCaptureResponse =
976
+ | {
977
+ available: false;
978
+ degradedReason?: WorkspaceCaptureDegradedReason | null;
979
+ revision?: number | null;
980
+ capturedAt?: string | null;
981
+ turnId?: string | null;
982
+ leaseEpoch?: number | null;
983
+ }
984
+ | {
985
+ available: true;
986
+ revision: number;
987
+ capturedAt: string;
988
+ turnId: string | null;
989
+ leaseEpoch: number;
990
+ sizeBytes: number;
991
+ stats: WorkspaceCaptureStats;
992
+ manifest: WorkspaceCaptureManifest | null;
993
+ manifestUrl: WorkspaceCaptureSignedUrl | null;
994
+ };
995
+ // GET …/workspace/capture/file. content inline (≤256KB) OR contentUrl OR marker
996
+ // only (tooLarge / missing blob).
997
+ export type GetWorkspaceCaptureFileResponse = {
998
+ path: string;
999
+ revision: number;
1000
+ status: GitFileStatusCode;
1001
+ hash: string | null;
1002
+ baseHash: string | null;
1003
+ sizeBytes: number;
1004
+ isBinary: boolean;
1005
+ tooLarge: boolean;
1006
+ encoding: FsEncoding | null;
1007
+ content: string | null;
1008
+ contentUrl: WorkspaceCaptureSignedUrl | null;
1009
+ };
638
1010
 
639
1011
  // A2 Terminal exec + PTY.
640
- export type TerminalExecRequest = { command: string; cwd?: string; timeoutMs?: number; emitStream?: boolean };
641
- export type TerminalExecResponse = { stdout: string; stderr: string; exitCode: number | null; running: boolean; wallTimeSeconds: number };
1012
+ export type TerminalExecRequest = {
1013
+ command: string;
1014
+ cwd?: string;
1015
+ timeoutMs?: number;
1016
+ emitStream?: boolean;
1017
+ };
1018
+ export type TerminalExecResponse = {
1019
+ stdout: string;
1020
+ stderr: string;
1021
+ exitCode: number | null;
1022
+ running: boolean;
1023
+ wallTimeSeconds: number;
1024
+ };
642
1025
  export type PtyOpenRequest = { cols?: number; rows?: number; cwd?: string; shell?: string };
643
1026
  export type PtyOpenResponse = { ptyId: string; streamVia: "sse-events"; supportsInput: boolean };
644
1027
  export type PtyWriteRequest = { ptyId: string; data: string };
@@ -705,7 +1088,11 @@ export type ScheduledTask = {
705
1088
  overlapPolicy: ScheduledTaskOverlapPolicy;
706
1089
  agentConfig: ScheduledTaskAgentConfig;
707
1090
  reusableSessionId: string | null;
1091
+ variableSetId: string | null;
1092
+ /** @deprecated use variableSetId */
708
1093
  environmentId: string | null;
1094
+ // The rig each run binds to (M3); active version resolved per fire. Null ⇒ rig-less.
1095
+ rigId: string | null;
709
1096
  metadata: Record<string, unknown>;
710
1097
  createdAt: string;
711
1098
  updatedAt: string;
@@ -730,7 +1117,12 @@ export type CreateSessionRequest = {
730
1117
  // Host working directory for a connected-machine target (the agent runs here;
731
1118
  // default = the machine's launch dir). Ignored for managed sandboxes.
732
1119
  workingDir?: string | undefined;
1120
+ variableSetId?: string | undefined;
1121
+ /** @deprecated use variableSetId */
733
1122
  environmentId?: string | undefined;
1123
+ // The rig to bind this session to (M3). Its active version is frozen onto the
1124
+ // session at create. Omitted ⇒ the workspace default rig when set, else rig-less.
1125
+ rigId?: string | undefined;
734
1126
  goal?: GoalSpec | undefined;
735
1127
  clientEventId?: string | undefined;
736
1128
  // Workspace-scoped CREATE idempotency key: forward a STABLE value to make a
@@ -784,11 +1176,15 @@ export const KNOWN_PERMISSIONS = [
784
1176
  "connections:write",
785
1177
  "environments:manage",
786
1178
  "environments:use",
1179
+ "variable-sets:manage",
1180
+ "variable-sets:use",
787
1181
  "mcp_servers:attach",
788
1182
  "toolspace:call",
789
1183
  "goals:manage",
790
1184
  "enrollments:read",
791
1185
  "enrollments:manage",
1186
+ "rigs:use",
1187
+ "rigs:manage",
792
1188
  ] as const;
793
1189
 
794
1190
  export type KnownPermission = (typeof KNOWN_PERMISSIONS)[number];
@@ -864,8 +1260,18 @@ export type CodexUsagePayload = {
864
1260
  fetchedAt: string;
865
1261
  /** Present only on an auth/refresh failure path. */
866
1262
  reason?: "needs_relogin";
867
- additionalLimits?: Array<{ limitName: string; meteredFeature: string; fiveHour: CodexUsageWindow | null; weekly: CodexUsageWindow | null }>;
868
- credits?: { hasCredits: boolean; unlimited: boolean; overageLimitReached: boolean; balance: string };
1263
+ additionalLimits?: Array<{
1264
+ limitName: string;
1265
+ meteredFeature: string;
1266
+ fiveHour: CodexUsageWindow | null;
1267
+ weekly: CodexUsageWindow | null;
1268
+ }>;
1269
+ credits?: {
1270
+ hasCredits: boolean;
1271
+ unlimited: boolean;
1272
+ overageLimitReached: boolean;
1273
+ balance: string;
1274
+ };
869
1275
  };
870
1276
 
871
1277
  /** One connected Codex (ChatGPT) account in a workspace (multi-account P1). Metadata only. */
@@ -930,7 +1336,10 @@ export type CodexConnectPoll =
930
1336
  | { status: "connected"; plan?: string | null; accountId?: string; isActive?: boolean };
931
1337
 
932
1338
  /** Remaining usage/limits for one account. `usage` is the normalized P2 payload. */
933
- export type CodexUsage = { status: "ok" | "limit_reached" | "error" | "no-data"; usage: CodexUsagePayload | null };
1339
+ export type CodexUsage = {
1340
+ status: "ok" | "limit_reached" | "error" | "no-data";
1341
+ usage: CodexUsagePayload | null;
1342
+ };
934
1343
 
935
1344
  /** Batched live-refresh response, keyed by credential id; each entry independently statused. */
936
1345
  export type CodexUsageMap = Record<string, CodexUsage>;
@@ -1009,10 +1418,31 @@ export type Workspace = {
1009
1418
  externalSource: string | null;
1010
1419
  externalId: string | null;
1011
1420
  agentInstructions: string | null;
1421
+ settings: Record<string, unknown>;
1422
+ inferenceState?: "active" | "paused";
1423
+ inferenceGeneration?: number;
1424
+ inferenceReason?: string | null;
1425
+ inferenceChangedBy?: string | null;
1426
+ inferenceChangedAt?: string | null;
1427
+ defaultRigId?: string | null;
1012
1428
  createdAt: string;
1013
1429
  updatedAt: string;
1014
1430
  };
1015
1431
 
1432
+ export type WorkspaceSettings = {
1433
+ memoryEnabled?: boolean | undefined;
1434
+ [key: string]: unknown;
1435
+ };
1436
+
1437
+ export type UpdateWorkspaceSettingsRequest = {
1438
+ memoryEnabled?: boolean | undefined;
1439
+ [key: string]: unknown;
1440
+ };
1441
+
1442
+ export type SetWorkspaceDefaultRigRequest = {
1443
+ rigId: string | null;
1444
+ };
1445
+
1016
1446
  export type CreateWorkspaceRequest = {
1017
1447
  accountId?: string | undefined;
1018
1448
  name: string;
@@ -1124,24 +1554,80 @@ export type UpdateSessionRequest = {
1124
1554
 
1125
1555
  /** Outcome of a manual /compact trigger. */
1126
1556
  export type CompactSessionContextResult = {
1127
- /**
1128
- * queued: a client-side (Azure) compaction will run before the next turn.
1129
- * noop: nothing to do (server-managed provider, mode off, or no history).
1130
- */
1131
- status: "queued" | "noop";
1557
+ /** pending waits for the current safe boundary; completed ran while idle. */
1558
+ status: "pending" | "completed" | "noop";
1132
1559
  message: string;
1133
1560
  };
1134
1561
 
1135
1562
  // --- Turn queue --------------------------------------------------------------
1136
1563
 
1137
- export type UpdateSessionTurnRequest = {
1138
- prompt?: string | undefined;
1139
- resources?: ResourceRef[] | undefined;
1140
- tools?: ToolRef[] | undefined;
1141
- model?: string | undefined;
1142
- reasoningEffort?: ReasoningEffort | undefined;
1143
- sandboxBackend?: SandboxBackend | undefined;
1144
- metadata?: Record<string, unknown> | undefined;
1564
+ export type SessionQueueSnapshot = {
1565
+ version: number;
1566
+ controlState: "active" | "paused";
1567
+ controlGeneration: number;
1568
+ workspaceInferenceState: "active" | "paused";
1569
+ workspaceInferenceGeneration: number;
1570
+ workspaceRunExceptionGeneration: number | null;
1571
+ items: SessionTurn[];
1572
+ };
1573
+
1574
+ export type SystemUpdateClassification = "success" | "failure" | "action_required" | "info";
1575
+
1576
+ export type SessionSystemUpdateKind =
1577
+ | "child_session_update"
1578
+ | "scheduled_wake"
1579
+ | "lifecycle_event"
1580
+ | "runtime_notice";
1581
+
1582
+ export type SessionSystemUpdateState =
1583
+ | "pending"
1584
+ | "deferred"
1585
+ | "delivered"
1586
+ | "cancelled"
1587
+ | "failed";
1588
+
1589
+ export type SessionSystemUpdate = {
1590
+ id: string;
1591
+ sessionId: string;
1592
+ kind: SessionSystemUpdateKind;
1593
+ classification: SystemUpdateClassification;
1594
+ sourceId: string;
1595
+ dedupeKey: string;
1596
+ summary: string;
1597
+ payload: Record<string, unknown>;
1598
+ lineage: Record<string, unknown>;
1599
+ state: SessionSystemUpdateState;
1600
+ deliveredTurnId: string | null;
1601
+ deliveredAt: string | null;
1602
+ createdAt: string;
1603
+ };
1604
+
1605
+ export type SessionControlResponse = {
1606
+ operationId: string;
1607
+ event: SessionEvent;
1608
+ controlState: "active" | "paused";
1609
+ controlGeneration: number;
1610
+ expectedActiveTurnId: string | null;
1611
+ expectedExecutionGeneration: number | null;
1612
+ expectedAttemptId: string | null;
1613
+ deliveryEventId: string | null;
1614
+ shouldSignalControl: boolean;
1615
+ shouldWake: boolean;
1616
+ };
1617
+
1618
+ export type WorkspaceInferenceControlResponse = {
1619
+ operationId: string;
1620
+ state: "active" | "paused";
1621
+ generation: number;
1622
+ affectedSessionIds: string[];
1623
+ controlSessionIds: string[];
1624
+ exceptionSessionIds: string[];
1625
+ };
1626
+
1627
+ export type SessionQueueMutationResponse = {
1628
+ snapshot: SessionQueueSnapshot;
1629
+ events: SessionEvent[];
1630
+ shouldWake: boolean;
1145
1631
  };
1146
1632
 
1147
1633
  // --- Scheduled tasks: requests + runs ----------------------------------------
@@ -1165,7 +1651,11 @@ export type CreateScheduledTaskRequest = {
1165
1651
  overlapPolicy?: ScheduledTaskOverlapPolicy | undefined;
1166
1652
  agentConfig: ScheduledTaskAgentConfigInput;
1167
1653
  status?: ScheduledTaskStatus | undefined;
1654
+ variableSetId?: string | null | undefined;
1655
+ /** @deprecated use variableSetId */
1168
1656
  environmentId?: string | null | undefined;
1657
+ // The rig each run binds to (M3); active version resolved per fire.
1658
+ rigId?: string | null | undefined;
1169
1659
  metadata?: Record<string, unknown> | undefined;
1170
1660
  };
1171
1661
 
@@ -1176,7 +1666,11 @@ export type UpdateScheduledTaskRequest = {
1176
1666
  overlapPolicy?: ScheduledTaskOverlapPolicy | undefined;
1177
1667
  agentConfig?: ScheduledTaskAgentConfigInput | undefined;
1178
1668
  status?: ScheduledTaskStatus | undefined;
1669
+ variableSetId?: string | null | undefined;
1670
+ /** @deprecated use variableSetId */
1179
1671
  environmentId?: string | null | undefined;
1672
+ // The rig each run binds to (M3); active version resolved per fire.
1673
+ rigId?: string | null | undefined;
1180
1674
  metadata?: Record<string, unknown> | undefined;
1181
1675
  };
1182
1676
 
@@ -1200,43 +1694,171 @@ export type ScheduledTaskRun = {
1200
1694
  updatedAt: string;
1201
1695
  };
1202
1696
 
1203
- // --- Environments -------------------------------------------------------------
1697
+ // --- VariableSets -------------------------------------------------------------
1204
1698
 
1205
1699
  /**
1206
1700
  * Variable values are write-only by design: the API never returns a value, so
1207
1701
  * reads expose name + version metadata only. Values are decrypted exclusively
1208
1702
  * inside the worker at sandbox materialization time.
1209
1703
  */
1210
- export type WorkspaceEnvironmentVariableMetadata = {
1704
+ export type VariableSetVariableMetadata = {
1211
1705
  name: string;
1212
1706
  version: number;
1213
1707
  createdAt: string;
1214
1708
  updatedAt: string;
1215
1709
  };
1216
1710
 
1217
- export type WorkspaceEnvironment = {
1711
+ export type VariableSet = {
1218
1712
  id: string;
1219
1713
  accountId: string;
1220
1714
  workspaceId: string;
1221
1715
  name: string;
1222
1716
  description: string | null;
1223
- variables: WorkspaceEnvironmentVariableMetadata[];
1717
+ variables: VariableSetVariableMetadata[];
1224
1718
  createdAt: string;
1225
1719
  updatedAt: string;
1226
1720
  };
1227
1721
 
1228
- export type CreateWorkspaceEnvironmentRequest = {
1722
+ /** @deprecated use VariableSetVariableMetadata */
1723
+ export type WorkspaceEnvironmentVariableMetadata = VariableSetVariableMetadata;
1724
+
1725
+ /** @deprecated use VariableSet */
1726
+ export type WorkspaceEnvironment = VariableSet;
1727
+
1728
+ export type CreateVariableSetRequest = {
1229
1729
  name: string;
1230
1730
  description?: string | undefined;
1231
1731
  /** Initial variables. Values are write-only: they never come back on reads. */
1232
1732
  variables?: { name: string; value: string }[] | undefined;
1233
1733
  };
1234
1734
 
1235
- export type UpdateWorkspaceEnvironmentRequest = {
1735
+ /** @deprecated use CreateVariableSetRequest */
1736
+ export type CreateWorkspaceEnvironmentRequest = CreateVariableSetRequest;
1737
+
1738
+ export type UpdateVariableSetRequest = {
1236
1739
  name?: string | undefined;
1237
1740
  description?: string | null | undefined;
1238
1741
  };
1239
1742
 
1743
+ /** @deprecated use UpdateVariableSetRequest */
1744
+ export type UpdateWorkspaceEnvironmentRequest = UpdateVariableSetRequest;
1745
+
1746
+ export type SetVariableSetVariableRequest = {
1747
+ value: string;
1748
+ };
1749
+
1750
+ /** @deprecated use SetVariableSetVariableRequest */
1751
+ export type SetWorkspaceEnvironmentVariableRequest = SetVariableSetVariableRequest;
1752
+
1753
+ // --- Rigs ---------------------------------------------------------------------
1754
+ // Workspace-scoped, versioned sandbox machine definitions. Versions are
1755
+ // append-only and content-immutable; exactly one is active per rig.
1756
+
1757
+ export type RigCheck = {
1758
+ name: string;
1759
+ command: string;
1760
+ };
1761
+
1762
+ export type RigVersion = {
1763
+ id: string;
1764
+ rigId: string;
1765
+ version: number;
1766
+ image: string | null;
1767
+ setupScript: string | null;
1768
+ checks: RigCheck[];
1769
+ credentialHooks: string[];
1770
+ defaultVariableSetIds: string[];
1771
+ changelog: string | null;
1772
+ createdBy: string | null;
1773
+ active: boolean;
1774
+ createdAt: string;
1775
+ };
1776
+
1777
+ export type RigVerificationHealth = {
1778
+ checkHealth: "passing" | "failing" | "unknown";
1779
+ lastVerifiedAt: string | null;
1780
+ };
1781
+
1782
+ export type Rig = {
1783
+ id: string;
1784
+ accountId: string;
1785
+ workspaceId: string;
1786
+ name: string;
1787
+ description: string | null;
1788
+ createdBy: string | null;
1789
+ activeVersion: RigVersion | null;
1790
+ activeVersionHealth?: RigVerificationHealth | null;
1791
+ versionCount: number;
1792
+ createdAt: string;
1793
+ updatedAt: string;
1794
+ };
1795
+
1796
+ export type RigChangeKind = "setup_append" | "definition_edit";
1797
+
1798
+ export type RigChangeStatus = "proposed" | "verifying" | "merged" | "rejected" | "failed";
1799
+
1800
+ export type RigCheckResult = {
1801
+ name: string;
1802
+ command: string;
1803
+ exitCode: number | null;
1804
+ output?: string | undefined;
1805
+ };
1806
+
1807
+ export type RigChangeVerification = {
1808
+ startedAt?: string | undefined;
1809
+ finishedAt?: string | undefined;
1810
+ log?: string | undefined;
1811
+ checkResults?: RigCheckResult[] | undefined;
1812
+ [key: string]: unknown;
1813
+ };
1814
+
1815
+ export type RigChange = {
1816
+ id: string;
1817
+ rigId: string;
1818
+ baseVersionId: string | null;
1819
+ kind: RigChangeKind;
1820
+ payload: Record<string, unknown>;
1821
+ status: RigChangeStatus;
1822
+ proposedBy: string | null;
1823
+ verification: RigChangeVerification | null;
1824
+ resultVersionId: string | null;
1825
+ createdAt: string;
1826
+ updatedAt: string;
1827
+ };
1828
+
1829
+ export type CreateRigRequest = {
1830
+ name: string;
1831
+ description?: string | undefined;
1832
+ image?: string | undefined;
1833
+ setupScript?: string | undefined;
1834
+ checks?: RigCheck[] | undefined;
1835
+ credentialHooks?: string[] | undefined;
1836
+ defaultVariableSetIds?: string[] | undefined;
1837
+ };
1838
+
1839
+ export type UpdateRigRequest = {
1840
+ name?: string | undefined;
1841
+ description?: string | null | undefined;
1842
+ };
1843
+
1844
+ export type RigSetupAppendPayload = {
1845
+ command: string;
1846
+ note?: string | undefined;
1847
+ };
1848
+
1849
+ export type RigDefinitionEditPayload = {
1850
+ image?: string | null | undefined;
1851
+ setupScript?: string | null | undefined;
1852
+ checks?: RigCheck[] | undefined;
1853
+ credentialHooks?: string[] | undefined;
1854
+ defaultVariableSetIds?: string[] | undefined;
1855
+ changelog?: string | null | undefined;
1856
+ };
1857
+
1858
+ export type ProposeRigChangeRequest =
1859
+ | { kind: "setup_append"; payload: RigSetupAppendPayload }
1860
+ | { kind: "definition_edit"; payload: RigDefinitionEditPayload };
1861
+
1240
1862
  // --- Files ---------------------------------------------------------------------
1241
1863
 
1242
1864
  export type FileStatus = "pending_upload" | "ready" | "failed" | "expired" | "deleted";
@@ -1296,7 +1918,15 @@ export type UploadFileInput = {
1296
1918
  // --- Documents -------------------------------------------------------------------
1297
1919
 
1298
1920
  export type DocumentStatus = "queued" | "indexing" | "ready" | "failed";
1299
- export type KnowledgeSourceKind = "manual_upload" | "meeting_transcript" | "repository" | "email" | "chat" | "document" | "web" | "other";
1921
+ export type KnowledgeSourceKind =
1922
+ | "manual_upload"
1923
+ | "meeting_transcript"
1924
+ | "repository"
1925
+ | "email"
1926
+ | "chat"
1927
+ | "document"
1928
+ | "web"
1929
+ | "other";
1300
1930
  export type DocumentSearchMode = "hybrid" | "vector" | "keyword";
1301
1931
 
1302
1932
  export type DocumentBase = {
@@ -1388,8 +2018,19 @@ export type DocumentSearchResponse = {
1388
2018
  results: DocumentSearchResult[];
1389
2019
  };
1390
2020
 
1391
- export type KnowledgeMemoryStatus = "proposed" | "approved" | "rejected";
1392
- export type KnowledgeMemoryKind = "semantic" | "episodic" | "procedural" | "decision" | "preference";
2021
+ export type KnowledgeMemoryStatus =
2022
+ | "proposed"
2023
+ | "approved"
2024
+ | "rejected"
2025
+ | "active"
2026
+ | "superseded"
2027
+ | "archived";
2028
+ export type KnowledgeMemoryKind =
2029
+ | "semantic"
2030
+ | "episodic"
2031
+ | "procedural"
2032
+ | "decision"
2033
+ | "preference";
1393
2034
 
1394
2035
  export type KnowledgeSourceRef = {
1395
2036
  kind: "document_chunk" | "document" | "session_event" | "memory" | "external";
@@ -1412,6 +2053,13 @@ export type KnowledgeMemory = {
1412
2053
  createdBySessionId: string | null;
1413
2054
  reviewedBy: string | null;
1414
2055
  reviewedAt: string | null;
2056
+ pinned: boolean;
2057
+ usageCount: number;
2058
+ lastUsedAt: string | null;
2059
+ supersedesId: string | null;
2060
+ supersededById: string | null;
2061
+ validFrom: string;
2062
+ validUntil: string | null;
1415
2063
  createdAt: string;
1416
2064
  updatedAt: string;
1417
2065
  };
@@ -1425,6 +2073,8 @@ export type CreateKnowledgeMemoryRequest = {
1425
2073
  confidence?: number | undefined;
1426
2074
  metadata?: Record<string, unknown> | undefined;
1427
2075
  createdBySessionId?: string | undefined;
2076
+ pinned?: boolean | undefined;
2077
+ replacesId?: string | undefined;
1428
2078
  };
1429
2079
 
1430
2080
  export type UpdateKnowledgeMemoryRequest = {
@@ -1436,6 +2086,7 @@ export type UpdateKnowledgeMemoryRequest = {
1436
2086
  confidence?: number | undefined;
1437
2087
  metadata?: Record<string, unknown> | undefined;
1438
2088
  reviewedBy?: string | undefined;
2089
+ pinned?: boolean | undefined;
1439
2090
  };
1440
2091
 
1441
2092
  export type KnowledgeMemorySearchRequest = {
@@ -1446,6 +2097,27 @@ export type KnowledgeMemorySearchRequest = {
1446
2097
  limit?: number | undefined;
1447
2098
  };
1448
2099
 
2100
+ export type WorkspaceMemorySearchMode = "hybrid" | "vector" | "keyword";
2101
+
2102
+ export type WorkspaceMemorySearchRequest = {
2103
+ query: string;
2104
+ kind?: KnowledgeMemoryKind | undefined;
2105
+ limit?: number | undefined;
2106
+ mode?: WorkspaceMemorySearchMode | undefined;
2107
+ };
2108
+
2109
+ export type WorkspaceMemorySearchResult = {
2110
+ memory: KnowledgeMemory;
2111
+ score: number;
2112
+ matchType: WorkspaceMemorySearchMode;
2113
+ vectorScore: number | null;
2114
+ keywordScore: number | null;
2115
+ };
2116
+
2117
+ export type WorkspaceMemorySearchResponse = {
2118
+ results: WorkspaceMemorySearchResult[];
2119
+ };
2120
+
1449
2121
  // --- Capability packs ---------------------------------------------------------
1450
2122
 
1451
2123
  export type CapabilityPackConnectorAuthModel =
@@ -1494,7 +2166,7 @@ export type CapabilityPackSkill = {
1494
2166
  files: CapabilityPackSkillFile[];
1495
2167
  };
1496
2168
 
1497
- export type CapabilityPackEnvironmentSpec = {
2169
+ export type CapabilityPackVariableSetSpec = {
1498
2170
  description: string;
1499
2171
  requiredVariables: string[];
1500
2172
  required: boolean;
@@ -1513,7 +2185,7 @@ export type CapabilityPack = {
1513
2185
  connectors: CapabilityPackConnector[];
1514
2186
  knowledge: CapabilityPackKnowledge[];
1515
2187
  scheduledTaskTemplates: CapabilityPackScheduledTaskTemplate[];
1516
- environment?: CapabilityPackEnvironmentSpec | undefined;
2188
+ variableSet?: CapabilityPackVariableSetSpec | undefined;
1517
2189
  metadata: Record<string, unknown>;
1518
2190
  };
1519
2191
 
@@ -1526,43 +2198,53 @@ export type RegisterCapabilityPackRequest = {
1526
2198
  category: string;
1527
2199
  version: string;
1528
2200
  sandboxImage?: string | undefined;
1529
- skills?: {
1530
- name: string;
1531
- description?: string | undefined;
1532
- files: CapabilityPackSkillFile[];
1533
- }[] | undefined;
2201
+ skills?:
2202
+ | {
2203
+ name: string;
2204
+ description?: string | undefined;
2205
+ files: CapabilityPackSkillFile[];
2206
+ }[]
2207
+ | undefined;
1534
2208
  tools?: ToolRef[] | undefined;
1535
- connectors?: {
1536
- id: string;
1537
- name: string;
1538
- category: string;
1539
- authModel: CapabilityPackConnectorAuthModel;
1540
- providers?: string[] | undefined;
1541
- scopes?: string[] | undefined;
1542
- required?: boolean | undefined;
1543
- metadata?: Record<string, unknown> | undefined;
1544
- }[] | undefined;
1545
- knowledge?: {
1546
- type: "document_base";
1547
- id: string;
1548
- name: string;
1549
- description?: string | null | undefined;
1550
- required?: boolean | undefined;
1551
- }[] | undefined;
1552
- scheduledTaskTemplates?: {
1553
- id: string;
1554
- name: string;
1555
- description: string;
1556
- defaultSchedule: ScheduledTaskScheduleSpec;
1557
- defaultRunMode?: ScheduledTaskRunMode | undefined;
1558
- defaultOverlapPolicy?: ScheduledTaskOverlapPolicy | undefined;
1559
- prompt?: string | undefined;
1560
- }[] | undefined;
1561
- environment?: {
1562
- description: string;
1563
- requiredVariables?: string[] | undefined;
1564
- required?: boolean | undefined;
1565
- } | undefined;
2209
+ connectors?:
2210
+ | {
2211
+ id: string;
2212
+ name: string;
2213
+ category: string;
2214
+ authModel: CapabilityPackConnectorAuthModel;
2215
+ providers?: string[] | undefined;
2216
+ scopes?: string[] | undefined;
2217
+ required?: boolean | undefined;
2218
+ metadata?: Record<string, unknown> | undefined;
2219
+ }[]
2220
+ | undefined;
2221
+ knowledge?:
2222
+ | {
2223
+ type: "document_base";
2224
+ id: string;
2225
+ name: string;
2226
+ description?: string | null | undefined;
2227
+ required?: boolean | undefined;
2228
+ }[]
2229
+ | undefined;
2230
+ scheduledTaskTemplates?:
2231
+ | {
2232
+ id: string;
2233
+ name: string;
2234
+ description: string;
2235
+ defaultSchedule: ScheduledTaskScheduleSpec;
2236
+ defaultRunMode?: ScheduledTaskRunMode | undefined;
2237
+ defaultOverlapPolicy?: ScheduledTaskOverlapPolicy | undefined;
2238
+ prompt?: string | undefined;
2239
+ }[]
2240
+ | undefined;
2241
+ variableSet?:
2242
+ | {
2243
+ description: string;
2244
+ requiredVariables?: string[] | undefined;
2245
+ required?: boolean | undefined;
2246
+ }
2247
+ | undefined;
1566
2248
  metadata?: Record<string, unknown> | undefined;
1567
2249
  };
1568
2250
 
@@ -1588,6 +2270,8 @@ export type PackInstallation = {
1588
2270
  };
1589
2271
 
1590
2272
  export type EnablePackRequest = {
2273
+ variableSetId?: string | undefined;
2274
+ /** @deprecated use variableSetId */
1591
2275
  environmentId?: string | undefined;
1592
2276
  metadata?: Record<string, unknown> | undefined;
1593
2277
  };
@@ -1606,7 +2290,12 @@ export type GetPackResponse = {
1606
2290
 
1607
2291
  export type CapabilityKind = "pack" | "mcp" | "api" | "skill" | "plugin";
1608
2292
 
1609
- export type CapabilitySource = "built_in" | "configured" | "public_registry" | "registry" | "manual";
2293
+ export type CapabilitySource =
2294
+ | "built_in"
2295
+ | "configured"
2296
+ | "public_registry"
2297
+ | "registry"
2298
+ | "manual";
1610
2299
 
1611
2300
  export type CapabilityInstallationStatus = "active" | "disabled";
1612
2301
 
@@ -1651,6 +2340,8 @@ export type CapabilityCatalogItem = {
1651
2340
  runtime: CapabilityRuntime;
1652
2341
  enabled: boolean;
1653
2342
  enabledReason: string | null;
2343
+ /** The connection backing this enabled installation, or null when none is involved. */
2344
+ connectionRef: { connectionId: string; providerDomain: string; kind: string } | null;
1654
2345
  metadata: Record<string, unknown>;
1655
2346
  createdAt?: string | undefined;
1656
2347
  updatedAt?: string | undefined;
@@ -1700,10 +2391,12 @@ export type EnableCapabilityRequest = {
1700
2391
  */
1701
2392
  headers?: Record<string, string> | undefined;
1702
2393
  /**
1703
- * Initial environment attachment for kind=pack capabilities — mirrors the
2394
+ * Initial variableSet attachment for kind=pack capabilities — mirrors the
1704
2395
  * dedicated POST /packs/:id/enable body. Required to enable an
1705
- * environment.required pack through this unified path; ignored otherwise.
2396
+ * variableSet.required pack through this unified path; ignored otherwise.
1706
2397
  */
2398
+ variableSetId?: string | undefined;
2399
+ /** @deprecated use variableSetId */
1707
2400
  environmentId?: string | undefined;
1708
2401
  };
1709
2402
 
@@ -1852,12 +2545,6 @@ export type UserMessageEventInput = {
1852
2545
  };
1853
2546
  };
1854
2547
 
1855
- export type UserInterruptEventInput = {
1856
- type: "user.interrupt";
1857
- clientEventId?: string | undefined;
1858
- payload?: { reason?: string | undefined } | undefined;
1859
- };
1860
-
1861
2548
  export type UserApprovalDecisionEventInput = {
1862
2549
  type: "user.approvalDecision";
1863
2550
  clientEventId?: string | undefined;
@@ -1869,10 +2556,7 @@ export type UserApprovalDecisionEventInput = {
1869
2556
  };
1870
2557
 
1871
2558
  /** Control/user events a client may POST to a session's event log. */
1872
- export type ClientSessionEventInput =
1873
- | UserMessageEventInput
1874
- | UserInterruptEventInput
1875
- | UserApprovalDecisionEventInput;
2559
+ export type ClientSessionEventInput = UserMessageEventInput | UserApprovalDecisionEventInput;
1876
2560
 
1877
2561
  // ── Bring-your-own-compute: Machines dashboard + per-machine metrics (M10) ────
1878
2562
  // Hand-written mirrors of the `@opengeni/contracts` MetricSample / MachineView /
@@ -1961,6 +2645,14 @@ export type SwapActiveSandboxResponse = {
1961
2645
  activeSandboxId: string | null;
1962
2646
  activeEpoch: number;
1963
2647
  reason?: string;
2648
+ // Typed rejection discriminant (issue #341); present only when swapped is false.
2649
+ // Mirror of the `@opengeni/contracts` SwapActiveSandboxResponse.code enum.
2650
+ code?:
2651
+ | "stale_pointer"
2652
+ | "offline_enrollment"
2653
+ | "unsupported_backend_context"
2654
+ | "transient_establishment"
2655
+ | "concurrent_swap";
1964
2656
  };
1965
2657
 
1966
2658
  // ── Self-hosted enrollment UX (design 11) ────────────────────────────────────