@opengeni/sdk 0.11.0 → 0.15.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,8 @@ export type SessionStatus =
8
8
  | "running"
9
9
  | "idle"
10
10
  | "requires_action"
11
+ | "recovering"
12
+ | "waiting_capacity"
11
13
  | "failed"
12
14
  | "cancelled";
13
15
 
@@ -209,6 +211,7 @@ export type ViewerHeartbeatRequest = { leaseEpoch: number };
209
211
  export type ViewerHeartbeatResponse = { alive: boolean };
210
212
 
211
213
  export type ReasoningEffort = "none" | "minimal" | "low" | "medium" | "high" | "xhigh";
214
+ export type GitCredentialProvider = "github" | "gitlab" | "azure_devops";
212
215
 
213
216
  export type RepositoryResourceRef = {
214
217
  kind: "repository";
@@ -216,6 +219,11 @@ export type RepositoryResourceRef = {
216
219
  ref: string;
217
220
  mountPath?: string | undefined;
218
221
  subpath?: string | undefined;
222
+ provider?: GitCredentialProvider | undefined;
223
+ repositoryId?: number | string | undefined;
224
+ installationId?: number | string | undefined;
225
+ projectId?: number | string | undefined;
226
+ connectionId?: string | undefined;
219
227
  githubInstallationId?: number | undefined;
220
228
  githubRepositoryId?: number | undefined;
221
229
  };
@@ -331,6 +339,13 @@ export type OAuthStartRequest = {
331
339
  requestedScopes?: string[] | undefined;
332
340
  returnPath?: string | undefined;
333
341
  connectionId?: string | undefined;
342
+ oauthClient?:
343
+ | {
344
+ clientId: string;
345
+ clientSecret?: string | undefined;
346
+ tokenEndpointAuthMethod?: "none" | "client_secret_post" | "client_secret_basic" | undefined;
347
+ }
348
+ | undefined;
334
349
  };
335
350
 
336
351
  export type OAuthStartResponse = {
@@ -364,30 +379,98 @@ export type Session = {
364
379
  metadata: Record<string, unknown>;
365
380
  model: string;
366
381
  sandboxBackend: SandboxBackend;
382
+ sandboxOs: SandboxOs;
383
+ sandboxGroupId: string;
384
+ activeSandboxId: string | null;
385
+ activeEpoch: number;
386
+ variableSetId: string | null;
387
+ /** @deprecated use variableSetId */
367
388
  environmentId: string | null;
389
+ // The rig + frozen rig version this session rides (M3). Both null for a
390
+ // rig-less session. Frozen at create; a later rig promote never moves them.
391
+ rigId: string | null;
392
+ rigVersionId: string | null;
368
393
  firstPartyMcpPermissions: string[] | null;
369
394
  mcpServers: SessionMcpServerMetadata[];
395
+ parentSessionId: string | null;
370
396
  createIdempotencyKey: string | null;
371
397
  temporalWorkflowId: string | null;
372
398
  activeTurnId: string | null;
399
+ queueVersion: number;
400
+ queueHeadPosition: number;
401
+ queueTailPosition: number;
402
+ effectiveControl: EffectiveSessionControl;
373
403
  lastSequence: number;
374
404
  /** Multi-account Codex (P1): the account this session is pinned to (null ⇒ follow workspace active). */
375
405
  codexPinnedCredentialId?: string | null;
376
406
  /** Multi-account Codex (P1): the account the most recent turn ran on (the "Running on:" indicator). */
377
407
  codexLastCredentialId?: string | null;
408
+ /** Personal (authenticated subject) workspace pin state, never workspace-global. */
409
+ pinned?: boolean;
410
+ /** Stable pin ordering key; null when this subject has not pinned the session. */
411
+ pinnedAt?: string | null;
412
+ /** Optimistic pin-state revision; zero represents an absent pin relation. */
413
+ pinVersion?: number;
414
+ /** Server-authoritative descendant counts populated by session-list reads. */
415
+ treeStats?:
416
+ | {
417
+ directChildren: number;
418
+ totalDescendants: number;
419
+ runningDescendants: number;
420
+ queuedDescendants: number;
421
+ attentionDescendants: number;
422
+ pausedDescendants: number;
423
+ failedDescendants: number;
424
+ }
425
+ | undefined;
378
426
  createdAt: string;
379
427
  updatedAt: string;
380
428
  };
381
429
 
430
+ export type SessionSummary = Session;
431
+
432
+ /** Canonical session-list page; pinned rows are excluded from ordinary pages. */
433
+ export type SessionListResponse = {
434
+ pinned: Session[];
435
+ sessions: Session[];
436
+ nextCursor: string | null;
437
+ };
438
+
439
+ export type UpdateSessionPinRequest = {
440
+ pinned: boolean;
441
+ expectedVersion?: number;
442
+ };
443
+
444
+ export type LineageNode = {
445
+ session: SessionSummary;
446
+ children: LineageNode[];
447
+ };
448
+
449
+ export type SessionLineageResponse = {
450
+ ancestors: SessionSummary[];
451
+ children: LineageNode[];
452
+ truncated: boolean;
453
+ };
454
+
382
455
  export type SessionTurnStatus =
383
456
  | "queued"
384
457
  | "running"
385
458
  | "requires_action"
459
+ | "recovering"
460
+ | "waiting_capacity"
386
461
  | "completed"
387
462
  | "failed"
388
- | "cancelled";
389
-
390
- export type SessionTurnSource = "user" | "scheduled_task" | "api" | "goal";
463
+ | "cancelled"
464
+ | "superseded"
465
+ | "withdrawn_for_edit";
466
+
467
+ export type SessionTurnSource =
468
+ | "user"
469
+ | "scheduled_task"
470
+ | "api"
471
+ | "goal"
472
+ | "system"
473
+ | "compaction";
391
474
 
392
475
  export type SessionTurn = {
393
476
  id: string;
@@ -404,7 +487,14 @@ export type SessionTurn = {
404
487
  model: string;
405
488
  reasoningEffort: ReasoningEffort;
406
489
  sandboxBackend: SandboxBackend;
490
+ sandboxOs: SandboxOs | null;
407
491
  metadata: Record<string, unknown>;
492
+ version: number;
493
+ executionGeneration: number;
494
+ activeAttemptId: string | null;
495
+ lineage: Record<string, unknown>;
496
+ cancelledBy?: string | null;
497
+ cancelReason?: string | null;
408
498
  startedAt: string | null;
409
499
  finishedAt: string | null;
410
500
  createdAt: string;
@@ -415,25 +505,33 @@ export const SESSION_EVENT_TYPES = [
415
505
  "session.created",
416
506
  "session.status.changed",
417
507
  "session.requiresAction",
508
+ "session.context.compaction.requested",
418
509
  "session.context.compacted",
510
+ "session.context.compaction.skipped",
419
511
  "session.context.cleared",
420
512
  "user.message",
421
- "user.interrupt",
513
+ "user.pause",
422
514
  "user.approvalDecision",
423
515
  "turn.queued",
424
- "turn.updated",
425
516
  "turn.started",
426
517
  "turn.completed",
427
518
  "turn.failed",
428
519
  "turn.cancelled",
429
- "turn.preempted",
520
+ "turn.superseded",
521
+ "turn.recovery.requested",
522
+ "turn.capacity_waiting",
430
523
  "agent.message.delta",
431
524
  "agent.message.completed",
432
525
  "agent.reasoning.delta",
433
526
  "agent.toolCall.created",
434
527
  "agent.toolCall.output",
528
+ "agent.model.usage",
435
529
  "tool.auth_needed",
436
530
  "agent.updated",
531
+ "rig.setup.started",
532
+ "rig.setup.completed",
533
+ "rig.setup.skipped",
534
+ "rig.setup.failed",
437
535
  "sandbox.operation.started",
438
536
  "sandbox.operation.completed",
439
537
  "sandbox.operation.failed",
@@ -444,7 +542,21 @@ export const SESSION_EVENT_TYPES = [
444
542
  "goal.completed",
445
543
  "goal.paused",
446
544
  "goal.resumed",
545
+ "goal.cleared",
447
546
  "goal.continuation",
547
+ "system.update.pending",
548
+ "system.update.delivered",
549
+ "session.control.paused",
550
+ "session.control.resumed",
551
+ "session.control.steer_requested",
552
+ "workspace.inference.paused",
553
+ "workspace.inference.resumed",
554
+ "session.queue.changed",
555
+ "session.queue.prompt.cancelled",
556
+ "session.queue.history",
557
+ "turn.event.rejected_late",
558
+ "memory.saved",
559
+ "memory.corrected",
448
560
  // Channel-B desktop pixel-plane signals (mirror of contracts SessionEventType;
449
561
  // the contract-parity test asserts sorted equality).
450
562
  "stream.url.rotated",
@@ -465,6 +577,36 @@ export const SESSION_EVENT_TYPES = [
465
577
  "session.title_set",
466
578
  // Multi-account Codex (P1): the session's inference account changed.
467
579
  "codex.account.switched",
580
+ // OPE-21 metadata-only per-turn credential selection audit.
581
+ "codex.credential.selected",
582
+ // OPE-21 durable zero-capacity wait lifecycle. These are system/runtime
583
+ // events, never synthetic user messages.
584
+ "codex.capacity.waiting",
585
+ "codex.capacity.resumed",
586
+ "codex.capacity.superseded",
587
+ // Sandbox durability observability (mirror of contracts SessionEventType):
588
+ // box lifecycle + manifest-env drift, attributable from the DB alone.
589
+ "sandbox.box.created",
590
+ "sandbox.box.lost",
591
+ "sandbox.box.terminated",
592
+ "sandbox.box.snapshot",
593
+ "sandbox.env.drift",
594
+ // Active-sandbox pointer reconcile (issue #341; announce-only; mirror of contracts
595
+ // SessionEventType — the contract-parity test asserts sorted equality).
596
+ "session.route.reconciled",
597
+ // Workbench v2 turn-end workspace capture (announce-only; mirror of contracts
598
+ // SessionEventType — the contract-parity test asserts sorted equality).
599
+ "workspace.revision.captured",
600
+ "workspace.revision.degraded",
601
+ // Connected Machine op-outcome observability (announce-only, quiet; mirror of
602
+ // contracts SessionEventType — the contract-parity test asserts sorted equality).
603
+ "machine.op.failed",
604
+ "machine.op.recovered",
605
+ // Connected Machine link-plane observability (announce-only, quiet; mirror of
606
+ // contracts SessionEventType — the contract-parity test asserts sorted equality).
607
+ "machine.link.lost",
608
+ "machine.link.restored",
609
+ "machine.runner.restarted",
468
610
  ] as const;
469
611
 
470
612
  export type KnownSessionEventType = (typeof SESSION_EVENT_TYPES)[number];
@@ -486,6 +628,11 @@ export type SessionEvent = {
486
628
  occurredAt: string;
487
629
  clientEventId?: string | null | undefined;
488
630
  turnId?: string | null | undefined;
631
+ turnGeneration?: number | null | undefined;
632
+ turnAttemptId?: string | null | undefined;
633
+ turnAssociation?: "current" | "late_rejected" | "duplicate" | null | undefined;
634
+ duplicateOfEventId?: string | null | undefined;
635
+ duplicateReason?: string | null | undefined;
489
636
  };
490
637
 
491
638
  export type ToolAuthNeededPayload = {
@@ -565,7 +712,13 @@ export type SandboxCommandOutputDeltaPayload = {
565
712
  };
566
713
  export type FsChangeKind = "created" | "modified" | "deleted" | "renamed";
567
714
  export type FsChangedPayload = {
568
- changes: { path: string; kind: FsChangeKind; isDir: boolean; sizeBytes: number | null; oldPath?: string | undefined }[];
715
+ changes: {
716
+ path: string;
717
+ kind: FsChangeKind;
718
+ isDir: boolean;
719
+ sizeBytes: number | null;
720
+ oldPath?: string | undefined;
721
+ }[];
569
722
  source: "write" | "watch" | "agent";
570
723
  revision: number;
571
724
  leaseEpoch: number;
@@ -580,9 +733,24 @@ export type GitChangedPayload = {
580
733
  revision: number;
581
734
  leaseEpoch: number;
582
735
  };
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" };
736
+ export type TerminalPtyStartedPayload = {
737
+ ptyId: string;
738
+ cols: number;
739
+ rows: number;
740
+ shell: string;
741
+ cwd: string;
742
+ };
743
+ export type TerminalPtyOutputDeltaPayload = {
744
+ ptyId: string;
745
+ stream: "stdout" | "stderr";
746
+ chunk: string;
747
+ seq: number;
748
+ };
749
+ export type TerminalPtyExitedPayload = {
750
+ ptyId: string;
751
+ exitCode: number | null;
752
+ reason: "exit" | "killed" | "owner_gone" | "timeout";
753
+ };
586
754
 
587
755
  // A2 FileSystem request/response.
588
756
  export type FsNodeType = "file" | "dir" | "symlink" | "other";
@@ -597,31 +765,115 @@ export type FsTreeNode = {
597
765
  truncated: boolean;
598
766
  };
599
767
  export type FsEncoding = "utf8" | "base64";
600
- export type FsListRequest = { path?: string; depth?: number; maxEntries?: number; includeHidden?: boolean };
768
+ export type FsListRequest = {
769
+ path?: string;
770
+ depth?: number;
771
+ maxEntries?: number;
772
+ includeHidden?: boolean;
773
+ };
601
774
  export type FsListResponse = { root: FsTreeNode; revision: number; truncated: boolean };
602
775
  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 };
776
+ export type FsReadResponse = {
777
+ path: string;
778
+ encoding: FsEncoding;
779
+ content: string;
780
+ sizeBytes: number;
781
+ truncated: boolean;
782
+ isBinary: boolean;
783
+ revision: number;
784
+ };
785
+ export type FsWriteRequest = {
786
+ path: string;
787
+ encoding?: FsEncoding;
788
+ content: string;
789
+ overwrite?: boolean;
790
+ createParents?: boolean;
791
+ };
605
792
  export type FsWriteResponse = { path: string; sizeBytes: number; revision: number };
606
793
  export type FsDeleteRequest = { path: string; recursive?: boolean };
607
794
  export type FsDeleteResponse = { revision: number };
608
- export type FsMoveRequest = { path: string; newPath: string; overwrite?: boolean; createParents?: boolean };
795
+ export type FsMoveRequest = {
796
+ path: string;
797
+ newPath: string;
798
+ overwrite?: boolean;
799
+ createParents?: boolean;
800
+ };
609
801
  export type FsMoveResponse = { path: string; newPath: string; revision: number };
610
802
  export type FsMkdirRequest = { path: string; recursive?: boolean };
611
803
  export type FsMkdirResponse = { path: string; revision: number };
612
804
 
613
805
  // 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 };
806
+ export type GitFileStatusCode =
807
+ | "added"
808
+ | "modified"
809
+ | "deleted"
810
+ | "renamed"
811
+ | "copied"
812
+ | "untracked"
813
+ | "ignored"
814
+ | "conflicted"
815
+ | "typechange";
816
+ export type GitFileStatus = {
817
+ path: string;
818
+ oldPath: string | null;
819
+ index: GitFileStatusCode | null;
820
+ worktree: GitFileStatusCode | null;
821
+ isConflicted: boolean;
822
+ };
616
823
  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 };
824
+ export type GitStatusResponse = {
825
+ isRepo: boolean;
826
+ head: string | null;
827
+ detached: boolean;
828
+ upstream: string | null;
829
+ ahead: number;
830
+ behind: number;
831
+ files: GitFileStatus[];
832
+ revision: number;
833
+ };
618
834
  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 };
835
+ export type GitDiffLine = {
836
+ type: GitDiffLineType;
837
+ oldNo: number | null;
838
+ newNo: number | null;
839
+ text: string;
840
+ };
841
+ export type GitDiffHunk = {
842
+ oldStart: number;
843
+ oldLines: number;
844
+ newStart: number;
845
+ newLines: number;
846
+ header: string;
847
+ lines: GitDiffLine[];
848
+ };
849
+ export type GitFileDiff = {
850
+ path: string;
851
+ oldPath: string | null;
852
+ status: GitFileStatusCode;
853
+ isBinary: boolean;
854
+ isImage: boolean;
855
+ additions: number;
856
+ deletions: number;
857
+ hunks: GitDiffHunk[];
858
+ truncated: boolean;
859
+ };
860
+ export type GitDiffRequest = {
861
+ path?: string;
862
+ staged?: boolean;
863
+ fromRef?: string;
864
+ toRef?: string;
865
+ pathspec?: string[];
866
+ contextLines?: number;
867
+ maxBytesPerFile?: number;
868
+ };
623
869
  export type GitDiffResponse = { files: GitFileDiff[]; revision: number };
624
- export type GitLogRequest = { path?: string; ref?: string; maxCount?: number; skip?: number; pathspec?: string[] };
870
+ export type GitLogRequest = {
871
+ path?: string;
872
+ ref?: string;
873
+ maxCount?: number;
874
+ skip?: number;
875
+ pathspec?: string[];
876
+ };
625
877
  export type GitCommit = {
626
878
  sha: string;
627
879
  shortSha: string;
@@ -633,12 +885,139 @@ export type GitCommit = {
633
885
  refs: string[];
634
886
  };
635
887
  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 };
888
+ export type GitShowRequest = {
889
+ path?: string;
890
+ ref: string;
891
+ filePath?: string;
892
+ encoding?: FsEncoding;
893
+ maxBytesPerFile?: number;
894
+ };
895
+ export type GitShowResponse = {
896
+ commit: GitCommit | null;
897
+ files: GitFileDiff[];
898
+ blob: { content: string; encoding: FsEncoding; sizeBytes: number; truncated: boolean } | null;
899
+ revision: number;
900
+ };
901
+
902
+ // Workbench v2 turn-end capture (mirror of `@opengeni/contracts` WorkspaceCapture*
903
+ // + the M2 read-API response shapes, dossier §10.3). Reuses FsTreeNode /
904
+ // GitFileStatus / GitFileDiff / GitFileStatusCode / FsEncoding above.
905
+ export type WorkspaceCaptureFile = {
906
+ path: string;
907
+ status: GitFileStatusCode;
908
+ hash: string | null;
909
+ baseHash: string | null;
910
+ contentRef: string | null;
911
+ sizeBytes: number;
912
+ isBinary: boolean;
913
+ tooLarge: boolean;
914
+ deleted: boolean;
915
+ };
916
+ export type WorkspaceCaptureRepo = {
917
+ root: string;
918
+ head: string | null;
919
+ detached: boolean;
920
+ upstream: string | null;
921
+ ahead: number;
922
+ behind: number;
923
+ status: GitFileStatus[];
924
+ diff: GitFileDiff[];
925
+ };
926
+ export type WorkspaceCaptureDegradedReason =
927
+ | "repository_discovery_command_failed"
928
+ | "repository_discovery_timed_out"
929
+ | "repository_discovery_result_limit_exceeded";
930
+ export type WorkspaceCaptureStats = {
931
+ repoCount: number;
932
+ fileCount: number;
933
+ additions: number;
934
+ deletions: number;
935
+ totalBytes: number;
936
+ tooLargeCount: number;
937
+ binaryCount: number;
938
+ treeEntryCount: number;
939
+ treeTruncated: boolean;
940
+ durationMs: number;
941
+ fingerprint?: string;
942
+ };
943
+ export type WorkspaceCaptureManifest = {
944
+ version: 1;
945
+ revision: number;
946
+ capturedAt: string;
947
+ turnId: string | null;
948
+ leaseEpoch: number;
949
+ treeIndex: FsTreeNode;
950
+ treeTruncated: boolean;
951
+ repos: WorkspaceCaptureRepo[];
952
+ files: WorkspaceCaptureFile[];
953
+ stats: WorkspaceCaptureStats;
954
+ };
955
+ export type WorkspaceRevisionCapturedPayload = {
956
+ revision: number;
957
+ turnId: string | null;
958
+ capturedAt: string;
959
+ leaseEpoch: number;
960
+ stats: WorkspaceCaptureStats;
961
+ };
962
+ export type WorkspaceRevisionDegradedPayload = {
963
+ revision: number;
964
+ turnId: string | null;
965
+ capturedAt: string;
966
+ leaseEpoch: number;
967
+ reason: WorkspaceCaptureDegradedReason;
968
+ };
969
+ export type WorkspaceCaptureSignedUrl = { url: string; expiresAt: string };
970
+ // GET …/workspace/capture. Exactly one of manifest/manifestUrl is non-null.
971
+ export type GetWorkspaceCaptureResponse =
972
+ | {
973
+ available: false;
974
+ degradedReason?: WorkspaceCaptureDegradedReason | null;
975
+ revision?: number | null;
976
+ capturedAt?: string | null;
977
+ turnId?: string | null;
978
+ leaseEpoch?: number | null;
979
+ }
980
+ | {
981
+ available: true;
982
+ revision: number;
983
+ capturedAt: string;
984
+ turnId: string | null;
985
+ leaseEpoch: number;
986
+ sizeBytes: number;
987
+ stats: WorkspaceCaptureStats;
988
+ manifest: WorkspaceCaptureManifest | null;
989
+ manifestUrl: WorkspaceCaptureSignedUrl | null;
990
+ };
991
+ // GET …/workspace/capture/file. content inline (≤256KB) OR contentUrl OR marker
992
+ // only (tooLarge / missing blob).
993
+ export type GetWorkspaceCaptureFileResponse = {
994
+ path: string;
995
+ revision: number;
996
+ status: GitFileStatusCode;
997
+ hash: string | null;
998
+ baseHash: string | null;
999
+ sizeBytes: number;
1000
+ isBinary: boolean;
1001
+ tooLarge: boolean;
1002
+ encoding: FsEncoding | null;
1003
+ content: string | null;
1004
+ contentUrl: WorkspaceCaptureSignedUrl | null;
1005
+ };
638
1006
 
639
1007
  // 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 };
1008
+ export type TerminalExecRequest = {
1009
+ command: string;
1010
+ cwd?: string;
1011
+ timeoutMs?: number;
1012
+ emitStream?: boolean;
1013
+ };
1014
+ export type TerminalExecResponse = {
1015
+ stdout: string;
1016
+ stderr: string;
1017
+ exitCode: number | null;
1018
+ running: boolean;
1019
+ wallTimeSeconds: number;
1020
+ };
642
1021
  export type PtyOpenRequest = { cols?: number; rows?: number; cwd?: string; shell?: string };
643
1022
  export type PtyOpenResponse = { ptyId: string; streamVia: "sse-events"; supportsInput: boolean };
644
1023
  export type PtyWriteRequest = { ptyId: string; data: string };
@@ -705,7 +1084,11 @@ export type ScheduledTask = {
705
1084
  overlapPolicy: ScheduledTaskOverlapPolicy;
706
1085
  agentConfig: ScheduledTaskAgentConfig;
707
1086
  reusableSessionId: string | null;
1087
+ variableSetId: string | null;
1088
+ /** @deprecated use variableSetId */
708
1089
  environmentId: string | null;
1090
+ // The rig each run binds to (M3); active version resolved per fire. Null ⇒ rig-less.
1091
+ rigId: string | null;
709
1092
  metadata: Record<string, unknown>;
710
1093
  createdAt: string;
711
1094
  updatedAt: string;
@@ -730,7 +1113,12 @@ export type CreateSessionRequest = {
730
1113
  // Host working directory for a connected-machine target (the agent runs here;
731
1114
  // default = the machine's launch dir). Ignored for managed sandboxes.
732
1115
  workingDir?: string | undefined;
1116
+ variableSetId?: string | undefined;
1117
+ /** @deprecated use variableSetId */
733
1118
  environmentId?: string | undefined;
1119
+ // The rig to bind this session to (M3). Its active version is frozen onto the
1120
+ // session at create. Omitted ⇒ the workspace default rig when set, else rig-less.
1121
+ rigId?: string | undefined;
734
1122
  goal?: GoalSpec | undefined;
735
1123
  clientEventId?: string | undefined;
736
1124
  // Workspace-scoped CREATE idempotency key: forward a STABLE value to make a
@@ -784,11 +1172,15 @@ export const KNOWN_PERMISSIONS = [
784
1172
  "connections:write",
785
1173
  "environments:manage",
786
1174
  "environments:use",
1175
+ "variable-sets:manage",
1176
+ "variable-sets:use",
787
1177
  "mcp_servers:attach",
788
1178
  "toolspace:call",
789
1179
  "goals:manage",
790
1180
  "enrollments:read",
791
1181
  "enrollments:manage",
1182
+ "rigs:use",
1183
+ "rigs:manage",
792
1184
  ] as const;
793
1185
 
794
1186
  export type KnownPermission = (typeof KNOWN_PERMISSIONS)[number];
@@ -864,8 +1256,18 @@ export type CodexUsagePayload = {
864
1256
  fetchedAt: string;
865
1257
  /** Present only on an auth/refresh failure path. */
866
1258
  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 };
1259
+ additionalLimits?: Array<{
1260
+ limitName: string;
1261
+ meteredFeature: string;
1262
+ fiveHour: CodexUsageWindow | null;
1263
+ weekly: CodexUsageWindow | null;
1264
+ }>;
1265
+ credits?: {
1266
+ hasCredits: boolean;
1267
+ unlimited: boolean;
1268
+ overageLimitReached: boolean;
1269
+ balance: string;
1270
+ };
869
1271
  };
870
1272
 
871
1273
  /** One connected Codex (ChatGPT) account in a workspace (multi-account P1). Metadata only. */
@@ -930,7 +1332,10 @@ export type CodexConnectPoll =
930
1332
  | { status: "connected"; plan?: string | null; accountId?: string; isActive?: boolean };
931
1333
 
932
1334
  /** 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 };
1335
+ export type CodexUsage = {
1336
+ status: "ok" | "limit_reached" | "error" | "no-data";
1337
+ usage: CodexUsagePayload | null;
1338
+ };
934
1339
 
935
1340
  /** Batched live-refresh response, keyed by credential id; each entry independently statused. */
936
1341
  export type CodexUsageMap = Record<string, CodexUsage>;
@@ -946,6 +1351,11 @@ export type ClientAuthConfig =
946
1351
  | { mode: "configuredToken"; headerName: "authorization"; scheme: "bearer" }
947
1352
  | { mode: "managedSession"; session: "cookie" };
948
1353
 
1354
+ // Kept value-identical to @opengeni/contracts and pinned by the SDK contract
1355
+ // parity suite. The SDK has no runtime dependency on the Zod contracts package.
1356
+ export const OPENGENI_API_CONTRACT_REVISION = "2026-07-session-control-v1" as const;
1357
+ export const OPENGENI_API_CONTRACT_HEADER = "x-opengeni-api-contract" as const;
1358
+
949
1359
  /**
950
1360
  * Public, unauthenticated-by-default client bootstrap config returned by
951
1361
  * `GET /v1/config/client`: which models + reasoning efforts are exposed, the
@@ -955,6 +1365,8 @@ export type ClientAuthConfig =
955
1365
  */
956
1366
  export type ClientConfig = {
957
1367
  deploymentRevision: string;
1368
+ apiContractRevision: typeof OPENGENI_API_CONTRACT_REVISION;
1369
+ serverVersion?: string | undefined;
958
1370
  defaultModel: string;
959
1371
  allowedModels: string[];
960
1372
  models: ClientModel[];
@@ -1009,10 +1421,33 @@ export type Workspace = {
1009
1421
  externalSource: string | null;
1010
1422
  externalId: string | null;
1011
1423
  agentInstructions: string | null;
1424
+ settings: Record<string, unknown>;
1425
+ inferenceControl: {
1426
+ state: "active" | "paused";
1427
+ revision: number;
1428
+ reason: string | null;
1429
+ changedBy: string | null;
1430
+ changedAt: string | null;
1431
+ };
1432
+ defaultRigId?: string | null;
1012
1433
  createdAt: string;
1013
1434
  updatedAt: string;
1014
1435
  };
1015
1436
 
1437
+ export type WorkspaceSettings = {
1438
+ memoryEnabled?: boolean | undefined;
1439
+ [key: string]: unknown;
1440
+ };
1441
+
1442
+ export type UpdateWorkspaceSettingsRequest = {
1443
+ memoryEnabled?: boolean | undefined;
1444
+ [key: string]: unknown;
1445
+ };
1446
+
1447
+ export type SetWorkspaceDefaultRigRequest = {
1448
+ rigId: string | null;
1449
+ };
1450
+
1016
1451
  export type CreateWorkspaceRequest = {
1017
1452
  accountId?: string | undefined;
1018
1453
  name: string;
@@ -1124,26 +1559,175 @@ export type UpdateSessionRequest = {
1124
1559
 
1125
1560
  /** Outcome of a manual /compact trigger. */
1126
1561
  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";
1562
+ /** pending waits for the current safe boundary; completed ran while idle. */
1563
+ status: "pending" | "completed" | "noop";
1132
1564
  message: string;
1133
1565
  };
1134
1566
 
1135
1567
  // --- Turn queue --------------------------------------------------------------
1136
1568
 
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;
1569
+ export type EffectiveControlBlocker = {
1570
+ kind: "session" | "workspace";
1571
+ sessionId?: string | undefined;
1572
+ displayName: string;
1573
+ actor: string | null;
1574
+ reason: string | null;
1575
+ changedAt: string | null;
1576
+ revision: number;
1577
+ };
1578
+
1579
+ export type EffectiveControlResumeOption = {
1580
+ scope: "selected" | "session" | "workspace";
1581
+ targetId?: string | undefined;
1582
+ selectedStateAfter: "active" | "paused";
1583
+ remainingPrimaryBlocker?: EffectiveControlBlocker | undefined;
1584
+ impactCopy: string;
1585
+ };
1586
+
1587
+ export type EffectiveSessionControl = {
1588
+ state: "active" | "paused";
1589
+ controlVersion: number;
1590
+ controlEtag: string;
1591
+ directState: "active" | "paused";
1592
+ primaryBlocker: EffectiveControlBlocker | null;
1593
+ additionalBlockerCount: number;
1594
+ blockers: EffectiveControlBlocker[];
1595
+ resumeOptions: EffectiveControlResumeOption[];
1596
+ override: { rootSessionId: string; revision: number } | null;
1597
+ settlement: { state: "stopping"; attemptCount: number } | null;
1598
+ };
1599
+
1600
+ export type SessionCommandReceipt = {
1601
+ id: string;
1602
+ action: string;
1603
+ operationKey: string;
1604
+ targetSessionId: string | null;
1605
+ targetTurnId: string | null;
1606
+ appliedControlRevision: number | null;
1607
+ appliedQueueVersion: number | null;
1608
+ appliedTurnVersion: number | null;
1609
+ appliedDraftRevision: number | null;
1610
+ createdAt: string;
1611
+ };
1612
+
1613
+ export type ComposerDraft = {
1614
+ revision: number;
1615
+ text: string;
1616
+ resources: ResourceRef[];
1617
+ tools: ToolRef[];
1618
+ model: string;
1619
+ reasoningEffort: ReasoningEffort;
1620
+ sourceTurnId: string | null;
1621
+ sourceTurnVersion: number | null;
1622
+ updatedAt: string | null;
1623
+ };
1624
+
1625
+ export type SessionQueueSnapshot = {
1626
+ version: number;
1627
+ effectiveControl: EffectiveSessionControl;
1628
+ items: SessionTurn[];
1629
+ };
1630
+
1631
+ export type SystemUpdateClassification = "success" | "failure" | "action_required" | "info";
1632
+
1633
+ export type SessionSystemUpdateKind =
1634
+ | "scheduled_occurrence"
1635
+ | "goal_continuation"
1636
+ | "agent_message"
1637
+ | "agent_steer_instruction"
1638
+ | "child_terminal_result";
1639
+
1640
+ export type SessionSystemUpdateState =
1641
+ | "pending"
1642
+ | "deferred"
1643
+ | "delivered"
1644
+ | "cancelled"
1645
+ | "superseded"
1646
+ | "failed";
1647
+
1648
+ export type SessionSystemUpdate = {
1649
+ id: string;
1650
+ sessionId: string;
1651
+ kind: SessionSystemUpdateKind;
1652
+ classification: SystemUpdateClassification;
1653
+ sourceId: string;
1654
+ dedupeKey: string;
1655
+ summary: string;
1656
+ payload: Record<string, unknown>;
1657
+ lineage: Record<string, unknown>;
1658
+ state: SessionSystemUpdateState;
1659
+ deliveredTurnId: string | null;
1660
+ deliveredAt: string | null;
1661
+ createdAt: string;
1662
+ };
1663
+
1664
+ export type SessionControlResponse = {
1665
+ receipt: SessionCommandReceipt;
1666
+ effectiveControl: EffectiveSessionControl;
1667
+ interruptionCount: number;
1668
+ wakeCount: number;
1669
+ };
1670
+
1671
+ export type WorkspaceInferenceControlResponse = {
1672
+ receipt: SessionCommandReceipt;
1673
+ state: "active" | "paused";
1674
+ revision: number;
1675
+ interruptionCount: number;
1676
+ wakeCount: number;
1677
+ };
1678
+
1679
+ export type WorkspaceControlEvent = {
1680
+ id: string;
1681
+ workspaceId: string;
1682
+ /** Same monotonic value as revision; named sequence for SSE resume cursors. */
1683
+ sequence: number;
1684
+ revision: number;
1685
+ type: "workspace.control.changed";
1686
+ scope: "workspace" | "session";
1687
+ rootSessionId: string | null;
1688
+ action: "pause" | "resume";
1689
+ automatic: boolean;
1690
+ reason: string | null;
1691
+ actor: string;
1692
+ occurredAt: string;
1693
+ };
1694
+
1695
+ export type SessionQueueMutationResponse = {
1696
+ receipt: SessionCommandReceipt;
1697
+ snapshot: SessionQueueSnapshot;
1698
+ draft?: ComposerDraft;
1699
+ };
1700
+
1701
+ export type MoveSessionQueueItemRequest = {
1702
+ clientEventId: string;
1703
+ expectedQueueVersion: number;
1704
+ beforeTurnId: string | null;
1705
+ };
1706
+
1707
+ export type EditSessionQueueItemRequest = {
1708
+ clientEventId: string;
1709
+ expectedTurnVersion: number;
1710
+ expectedDraftRevision: number;
1711
+ replaceDraft: boolean;
1712
+ };
1713
+
1714
+ export type SteerSessionQueueItemRequest = {
1715
+ clientEventId: string;
1716
+ expectedTurnVersion: number;
1717
+ controlEtag?: string;
1145
1718
  };
1146
1719
 
1720
+ export type DeleteSessionQueueItemRequest = {
1721
+ clientEventId: string;
1722
+ expectedTurnVersion: number;
1723
+ reason?: string;
1724
+ };
1725
+
1726
+ export type SaveComposerDraftRequest = Omit<
1727
+ ComposerDraft,
1728
+ "revision" | "sourceTurnId" | "sourceTurnVersion" | "updatedAt"
1729
+ > & { expectedRevision: number };
1730
+
1147
1731
  // --- Scheduled tasks: requests + runs ----------------------------------------
1148
1732
 
1149
1733
  /** Input shape for agent config on create/update (server applies defaults). */
@@ -1165,7 +1749,11 @@ export type CreateScheduledTaskRequest = {
1165
1749
  overlapPolicy?: ScheduledTaskOverlapPolicy | undefined;
1166
1750
  agentConfig: ScheduledTaskAgentConfigInput;
1167
1751
  status?: ScheduledTaskStatus | undefined;
1752
+ variableSetId?: string | null | undefined;
1753
+ /** @deprecated use variableSetId */
1168
1754
  environmentId?: string | null | undefined;
1755
+ // The rig each run binds to (M3); active version resolved per fire.
1756
+ rigId?: string | null | undefined;
1169
1757
  metadata?: Record<string, unknown> | undefined;
1170
1758
  };
1171
1759
 
@@ -1176,7 +1764,11 @@ export type UpdateScheduledTaskRequest = {
1176
1764
  overlapPolicy?: ScheduledTaskOverlapPolicy | undefined;
1177
1765
  agentConfig?: ScheduledTaskAgentConfigInput | undefined;
1178
1766
  status?: ScheduledTaskStatus | undefined;
1767
+ variableSetId?: string | null | undefined;
1768
+ /** @deprecated use variableSetId */
1179
1769
  environmentId?: string | null | undefined;
1770
+ // The rig each run binds to (M3); active version resolved per fire.
1771
+ rigId?: string | null | undefined;
1180
1772
  metadata?: Record<string, unknown> | undefined;
1181
1773
  };
1182
1774
 
@@ -1200,43 +1792,171 @@ export type ScheduledTaskRun = {
1200
1792
  updatedAt: string;
1201
1793
  };
1202
1794
 
1203
- // --- Environments -------------------------------------------------------------
1795
+ // --- VariableSets -------------------------------------------------------------
1204
1796
 
1205
1797
  /**
1206
1798
  * Variable values are write-only by design: the API never returns a value, so
1207
1799
  * reads expose name + version metadata only. Values are decrypted exclusively
1208
1800
  * inside the worker at sandbox materialization time.
1209
1801
  */
1210
- export type WorkspaceEnvironmentVariableMetadata = {
1802
+ export type VariableSetVariableMetadata = {
1211
1803
  name: string;
1212
1804
  version: number;
1213
1805
  createdAt: string;
1214
1806
  updatedAt: string;
1215
1807
  };
1216
1808
 
1217
- export type WorkspaceEnvironment = {
1809
+ export type VariableSet = {
1218
1810
  id: string;
1219
1811
  accountId: string;
1220
1812
  workspaceId: string;
1221
1813
  name: string;
1222
1814
  description: string | null;
1223
- variables: WorkspaceEnvironmentVariableMetadata[];
1815
+ variables: VariableSetVariableMetadata[];
1224
1816
  createdAt: string;
1225
1817
  updatedAt: string;
1226
1818
  };
1227
1819
 
1228
- export type CreateWorkspaceEnvironmentRequest = {
1820
+ /** @deprecated use VariableSetVariableMetadata */
1821
+ export type WorkspaceEnvironmentVariableMetadata = VariableSetVariableMetadata;
1822
+
1823
+ /** @deprecated use VariableSet */
1824
+ export type WorkspaceEnvironment = VariableSet;
1825
+
1826
+ export type CreateVariableSetRequest = {
1229
1827
  name: string;
1230
1828
  description?: string | undefined;
1231
1829
  /** Initial variables. Values are write-only: they never come back on reads. */
1232
1830
  variables?: { name: string; value: string }[] | undefined;
1233
1831
  };
1234
1832
 
1235
- export type UpdateWorkspaceEnvironmentRequest = {
1833
+ /** @deprecated use CreateVariableSetRequest */
1834
+ export type CreateWorkspaceEnvironmentRequest = CreateVariableSetRequest;
1835
+
1836
+ export type UpdateVariableSetRequest = {
1837
+ name?: string | undefined;
1838
+ description?: string | null | undefined;
1839
+ };
1840
+
1841
+ /** @deprecated use UpdateVariableSetRequest */
1842
+ export type UpdateWorkspaceEnvironmentRequest = UpdateVariableSetRequest;
1843
+
1844
+ export type SetVariableSetVariableRequest = {
1845
+ value: string;
1846
+ };
1847
+
1848
+ /** @deprecated use SetVariableSetVariableRequest */
1849
+ export type SetWorkspaceEnvironmentVariableRequest = SetVariableSetVariableRequest;
1850
+
1851
+ // --- Rigs ---------------------------------------------------------------------
1852
+ // Workspace-scoped, versioned sandbox machine definitions. Versions are
1853
+ // append-only and content-immutable; exactly one is active per rig.
1854
+
1855
+ export type RigCheck = {
1856
+ name: string;
1857
+ command: string;
1858
+ };
1859
+
1860
+ export type RigVersion = {
1861
+ id: string;
1862
+ rigId: string;
1863
+ version: number;
1864
+ image: string | null;
1865
+ setupScript: string | null;
1866
+ checks: RigCheck[];
1867
+ credentialHooks: string[];
1868
+ defaultVariableSetIds: string[];
1869
+ changelog: string | null;
1870
+ createdBy: string | null;
1871
+ active: boolean;
1872
+ createdAt: string;
1873
+ };
1874
+
1875
+ export type RigVerificationHealth = {
1876
+ checkHealth: "passing" | "failing" | "unknown";
1877
+ lastVerifiedAt: string | null;
1878
+ };
1879
+
1880
+ export type Rig = {
1881
+ id: string;
1882
+ accountId: string;
1883
+ workspaceId: string;
1884
+ name: string;
1885
+ description: string | null;
1886
+ createdBy: string | null;
1887
+ activeVersion: RigVersion | null;
1888
+ activeVersionHealth?: RigVerificationHealth | null;
1889
+ versionCount: number;
1890
+ createdAt: string;
1891
+ updatedAt: string;
1892
+ };
1893
+
1894
+ export type RigChangeKind = "setup_append" | "definition_edit";
1895
+
1896
+ export type RigChangeStatus = "proposed" | "verifying" | "merged" | "rejected" | "failed";
1897
+
1898
+ export type RigCheckResult = {
1899
+ name: string;
1900
+ command: string;
1901
+ exitCode: number | null;
1902
+ output?: string | undefined;
1903
+ };
1904
+
1905
+ export type RigChangeVerification = {
1906
+ startedAt?: string | undefined;
1907
+ finishedAt?: string | undefined;
1908
+ log?: string | undefined;
1909
+ checkResults?: RigCheckResult[] | undefined;
1910
+ [key: string]: unknown;
1911
+ };
1912
+
1913
+ export type RigChange = {
1914
+ id: string;
1915
+ rigId: string;
1916
+ baseVersionId: string | null;
1917
+ kind: RigChangeKind;
1918
+ payload: Record<string, unknown>;
1919
+ status: RigChangeStatus;
1920
+ proposedBy: string | null;
1921
+ verification: RigChangeVerification | null;
1922
+ resultVersionId: string | null;
1923
+ createdAt: string;
1924
+ updatedAt: string;
1925
+ };
1926
+
1927
+ export type CreateRigRequest = {
1928
+ name: string;
1929
+ description?: string | undefined;
1930
+ image?: string | undefined;
1931
+ setupScript?: string | undefined;
1932
+ checks?: RigCheck[] | undefined;
1933
+ credentialHooks?: string[] | undefined;
1934
+ defaultVariableSetIds?: string[] | undefined;
1935
+ };
1936
+
1937
+ export type UpdateRigRequest = {
1236
1938
  name?: string | undefined;
1237
1939
  description?: string | null | undefined;
1238
1940
  };
1239
1941
 
1942
+ export type RigSetupAppendPayload = {
1943
+ command: string;
1944
+ note?: string | undefined;
1945
+ };
1946
+
1947
+ export type RigDefinitionEditPayload = {
1948
+ image?: string | null | undefined;
1949
+ setupScript?: string | null | undefined;
1950
+ checks?: RigCheck[] | undefined;
1951
+ credentialHooks?: string[] | undefined;
1952
+ defaultVariableSetIds?: string[] | undefined;
1953
+ changelog?: string | null | undefined;
1954
+ };
1955
+
1956
+ export type ProposeRigChangeRequest =
1957
+ | { kind: "setup_append"; payload: RigSetupAppendPayload }
1958
+ | { kind: "definition_edit"; payload: RigDefinitionEditPayload };
1959
+
1240
1960
  // --- Files ---------------------------------------------------------------------
1241
1961
 
1242
1962
  export type FileStatus = "pending_upload" | "ready" | "failed" | "expired" | "deleted";
@@ -1296,7 +2016,15 @@ export type UploadFileInput = {
1296
2016
  // --- Documents -------------------------------------------------------------------
1297
2017
 
1298
2018
  export type DocumentStatus = "queued" | "indexing" | "ready" | "failed";
1299
- export type KnowledgeSourceKind = "manual_upload" | "meeting_transcript" | "repository" | "email" | "chat" | "document" | "web" | "other";
2019
+ export type KnowledgeSourceKind =
2020
+ | "manual_upload"
2021
+ | "meeting_transcript"
2022
+ | "repository"
2023
+ | "email"
2024
+ | "chat"
2025
+ | "document"
2026
+ | "web"
2027
+ | "other";
1300
2028
  export type DocumentSearchMode = "hybrid" | "vector" | "keyword";
1301
2029
 
1302
2030
  export type DocumentBase = {
@@ -1388,8 +2116,19 @@ export type DocumentSearchResponse = {
1388
2116
  results: DocumentSearchResult[];
1389
2117
  };
1390
2118
 
1391
- export type KnowledgeMemoryStatus = "proposed" | "approved" | "rejected";
1392
- export type KnowledgeMemoryKind = "semantic" | "episodic" | "procedural" | "decision" | "preference";
2119
+ export type KnowledgeMemoryStatus =
2120
+ | "proposed"
2121
+ | "approved"
2122
+ | "rejected"
2123
+ | "active"
2124
+ | "superseded"
2125
+ | "archived";
2126
+ export type KnowledgeMemoryKind =
2127
+ | "semantic"
2128
+ | "episodic"
2129
+ | "procedural"
2130
+ | "decision"
2131
+ | "preference";
1393
2132
 
1394
2133
  export type KnowledgeSourceRef = {
1395
2134
  kind: "document_chunk" | "document" | "session_event" | "memory" | "external";
@@ -1412,6 +2151,13 @@ export type KnowledgeMemory = {
1412
2151
  createdBySessionId: string | null;
1413
2152
  reviewedBy: string | null;
1414
2153
  reviewedAt: string | null;
2154
+ pinned: boolean;
2155
+ usageCount: number;
2156
+ lastUsedAt: string | null;
2157
+ supersedesId: string | null;
2158
+ supersededById: string | null;
2159
+ validFrom: string;
2160
+ validUntil: string | null;
1415
2161
  createdAt: string;
1416
2162
  updatedAt: string;
1417
2163
  };
@@ -1425,6 +2171,8 @@ export type CreateKnowledgeMemoryRequest = {
1425
2171
  confidence?: number | undefined;
1426
2172
  metadata?: Record<string, unknown> | undefined;
1427
2173
  createdBySessionId?: string | undefined;
2174
+ pinned?: boolean | undefined;
2175
+ replacesId?: string | undefined;
1428
2176
  };
1429
2177
 
1430
2178
  export type UpdateKnowledgeMemoryRequest = {
@@ -1436,6 +2184,7 @@ export type UpdateKnowledgeMemoryRequest = {
1436
2184
  confidence?: number | undefined;
1437
2185
  metadata?: Record<string, unknown> | undefined;
1438
2186
  reviewedBy?: string | undefined;
2187
+ pinned?: boolean | undefined;
1439
2188
  };
1440
2189
 
1441
2190
  export type KnowledgeMemorySearchRequest = {
@@ -1446,6 +2195,27 @@ export type KnowledgeMemorySearchRequest = {
1446
2195
  limit?: number | undefined;
1447
2196
  };
1448
2197
 
2198
+ export type WorkspaceMemorySearchMode = "hybrid" | "vector" | "keyword";
2199
+
2200
+ export type WorkspaceMemorySearchRequest = {
2201
+ query: string;
2202
+ kind?: KnowledgeMemoryKind | undefined;
2203
+ limit?: number | undefined;
2204
+ mode?: WorkspaceMemorySearchMode | undefined;
2205
+ };
2206
+
2207
+ export type WorkspaceMemorySearchResult = {
2208
+ memory: KnowledgeMemory;
2209
+ score: number;
2210
+ matchType: WorkspaceMemorySearchMode;
2211
+ vectorScore: number | null;
2212
+ keywordScore: number | null;
2213
+ };
2214
+
2215
+ export type WorkspaceMemorySearchResponse = {
2216
+ results: WorkspaceMemorySearchResult[];
2217
+ };
2218
+
1449
2219
  // --- Capability packs ---------------------------------------------------------
1450
2220
 
1451
2221
  export type CapabilityPackConnectorAuthModel =
@@ -1494,7 +2264,7 @@ export type CapabilityPackSkill = {
1494
2264
  files: CapabilityPackSkillFile[];
1495
2265
  };
1496
2266
 
1497
- export type CapabilityPackEnvironmentSpec = {
2267
+ export type CapabilityPackVariableSetSpec = {
1498
2268
  description: string;
1499
2269
  requiredVariables: string[];
1500
2270
  required: boolean;
@@ -1513,7 +2283,7 @@ export type CapabilityPack = {
1513
2283
  connectors: CapabilityPackConnector[];
1514
2284
  knowledge: CapabilityPackKnowledge[];
1515
2285
  scheduledTaskTemplates: CapabilityPackScheduledTaskTemplate[];
1516
- environment?: CapabilityPackEnvironmentSpec | undefined;
2286
+ variableSet?: CapabilityPackVariableSetSpec | undefined;
1517
2287
  metadata: Record<string, unknown>;
1518
2288
  };
1519
2289
 
@@ -1526,43 +2296,53 @@ export type RegisterCapabilityPackRequest = {
1526
2296
  category: string;
1527
2297
  version: string;
1528
2298
  sandboxImage?: string | undefined;
1529
- skills?: {
1530
- name: string;
1531
- description?: string | undefined;
1532
- files: CapabilityPackSkillFile[];
1533
- }[] | undefined;
2299
+ skills?:
2300
+ | {
2301
+ name: string;
2302
+ description?: string | undefined;
2303
+ files: CapabilityPackSkillFile[];
2304
+ }[]
2305
+ | undefined;
1534
2306
  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;
2307
+ connectors?:
2308
+ | {
2309
+ id: string;
2310
+ name: string;
2311
+ category: string;
2312
+ authModel: CapabilityPackConnectorAuthModel;
2313
+ providers?: string[] | undefined;
2314
+ scopes?: string[] | undefined;
2315
+ required?: boolean | undefined;
2316
+ metadata?: Record<string, unknown> | undefined;
2317
+ }[]
2318
+ | undefined;
2319
+ knowledge?:
2320
+ | {
2321
+ type: "document_base";
2322
+ id: string;
2323
+ name: string;
2324
+ description?: string | null | undefined;
2325
+ required?: boolean | undefined;
2326
+ }[]
2327
+ | undefined;
2328
+ scheduledTaskTemplates?:
2329
+ | {
2330
+ id: string;
2331
+ name: string;
2332
+ description: string;
2333
+ defaultSchedule: ScheduledTaskScheduleSpec;
2334
+ defaultRunMode?: ScheduledTaskRunMode | undefined;
2335
+ defaultOverlapPolicy?: ScheduledTaskOverlapPolicy | undefined;
2336
+ prompt?: string | undefined;
2337
+ }[]
2338
+ | undefined;
2339
+ variableSet?:
2340
+ | {
2341
+ description: string;
2342
+ requiredVariables?: string[] | undefined;
2343
+ required?: boolean | undefined;
2344
+ }
2345
+ | undefined;
1566
2346
  metadata?: Record<string, unknown> | undefined;
1567
2347
  };
1568
2348
 
@@ -1588,6 +2368,8 @@ export type PackInstallation = {
1588
2368
  };
1589
2369
 
1590
2370
  export type EnablePackRequest = {
2371
+ variableSetId?: string | undefined;
2372
+ /** @deprecated use variableSetId */
1591
2373
  environmentId?: string | undefined;
1592
2374
  metadata?: Record<string, unknown> | undefined;
1593
2375
  };
@@ -1606,7 +2388,12 @@ export type GetPackResponse = {
1606
2388
 
1607
2389
  export type CapabilityKind = "pack" | "mcp" | "api" | "skill" | "plugin";
1608
2390
 
1609
- export type CapabilitySource = "built_in" | "configured" | "public_registry" | "registry" | "manual";
2391
+ export type CapabilitySource =
2392
+ | "built_in"
2393
+ | "configured"
2394
+ | "public_registry"
2395
+ | "registry"
2396
+ | "manual";
1610
2397
 
1611
2398
  export type CapabilityInstallationStatus = "active" | "disabled";
1612
2399
 
@@ -1651,6 +2438,8 @@ export type CapabilityCatalogItem = {
1651
2438
  runtime: CapabilityRuntime;
1652
2439
  enabled: boolean;
1653
2440
  enabledReason: string | null;
2441
+ /** The connection backing this enabled installation, or null when none is involved. */
2442
+ connectionRef: { connectionId: string; providerDomain: string; kind: string } | null;
1654
2443
  metadata: Record<string, unknown>;
1655
2444
  createdAt?: string | undefined;
1656
2445
  updatedAt?: string | undefined;
@@ -1700,10 +2489,12 @@ export type EnableCapabilityRequest = {
1700
2489
  */
1701
2490
  headers?: Record<string, string> | undefined;
1702
2491
  /**
1703
- * Initial environment attachment for kind=pack capabilities — mirrors the
2492
+ * Initial variableSet attachment for kind=pack capabilities — mirrors the
1704
2493
  * dedicated POST /packs/:id/enable body. Required to enable an
1705
- * environment.required pack through this unified path; ignored otherwise.
2494
+ * variableSet.required pack through this unified path; ignored otherwise.
1706
2495
  */
2496
+ variableSetId?: string | undefined;
2497
+ /** @deprecated use variableSetId */
1707
2498
  environmentId?: string | undefined;
1708
2499
  };
1709
2500
 
@@ -1852,12 +2643,6 @@ export type UserMessageEventInput = {
1852
2643
  };
1853
2644
  };
1854
2645
 
1855
- export type UserInterruptEventInput = {
1856
- type: "user.interrupt";
1857
- clientEventId?: string | undefined;
1858
- payload?: { reason?: string | undefined } | undefined;
1859
- };
1860
-
1861
2646
  export type UserApprovalDecisionEventInput = {
1862
2647
  type: "user.approvalDecision";
1863
2648
  clientEventId?: string | undefined;
@@ -1869,10 +2654,7 @@ export type UserApprovalDecisionEventInput = {
1869
2654
  };
1870
2655
 
1871
2656
  /** Control/user events a client may POST to a session's event log. */
1872
- export type ClientSessionEventInput =
1873
- | UserMessageEventInput
1874
- | UserInterruptEventInput
1875
- | UserApprovalDecisionEventInput;
2657
+ export type ClientSessionEventInput = UserMessageEventInput | UserApprovalDecisionEventInput;
1876
2658
 
1877
2659
  // ── Bring-your-own-compute: Machines dashboard + per-machine metrics (M10) ────
1878
2660
  // Hand-written mirrors of the `@opengeni/contracts` MetricSample / MachineView /
@@ -1961,6 +2743,14 @@ export type SwapActiveSandboxResponse = {
1961
2743
  activeSandboxId: string | null;
1962
2744
  activeEpoch: number;
1963
2745
  reason?: string;
2746
+ // Typed rejection discriminant (issue #341); present only when swapped is false.
2747
+ // Mirror of the `@opengeni/contracts` SwapActiveSandboxResponse.code enum.
2748
+ code?:
2749
+ | "stale_pointer"
2750
+ | "offline_enrollment"
2751
+ | "unsupported_backend_context"
2752
+ | "transient_establishment"
2753
+ | "concurrent_swap";
1964
2754
  };
1965
2755
 
1966
2756
  // ── Self-hosted enrollment UX (design 11) ────────────────────────────────────