@opengeni/contracts 0.7.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -5,6 +5,9 @@ var SessionStatus = z.enum([
5
5
  "running",
6
6
  "idle",
7
7
  "requires_action",
8
+ "recovering",
9
+ "waiting_capacity",
10
+ "paused",
8
11
  "failed",
9
12
  "cancelled"
10
13
  ]);
@@ -412,12 +415,22 @@ var Permission = z.enum([
412
415
  "github:manage",
413
416
  "github:use",
414
417
  "api_keys:manage",
418
+ "connections:read",
419
+ "connections:write",
420
+ /** @deprecated alias of variable-sets:manage */
415
421
  "environments:manage",
422
+ /** @deprecated alias of variable-sets:use */
416
423
  "environments:use",
424
+ "variable-sets:manage",
425
+ "variable-sets:use",
417
426
  // Attach or rotate per-session third-party MCP server credentials. Deliberately
418
427
  // not part of the worker's default first-party MCP permission set: a sandboxed
419
428
  // agent must not be able to hand itself new bearer credentials.
420
429
  "mcp_servers:attach",
430
+ // Programmatic sandbox -> tool access through the first-party MCP gate. This is
431
+ // intentionally narrow and is never part of first-party MCP defaults; callers
432
+ // must receive it through an explicit delegated `ogd_` mint carrying sessionId.
433
+ "toolspace:call",
421
434
  "goals:manage",
422
435
  // Bring-your-own-compute (M5). enrollments:read lists a workspace's machines;
423
436
  // enrollments:manage approves a device-flow enrollment (the LOUD whole-machine
@@ -425,8 +438,18 @@ var Permission = z.enum([
425
438
  // enrollment grants WHOLE-MACHINE access to a user's own hardware — a high-trust,
426
439
  // admin-shaped action. workspace:admin is the super-wildcard over both.
427
440
  "enrollments:read",
428
- "enrollments:manage"
441
+ "enrollments:manage",
442
+ // Rigs (workspace-scoped, versioned sandbox machine definitions). rigs:use is
443
+ // read + propose-change (the agent-native, additive path a sandboxed session
444
+ // is trusted with); rigs:manage is create/edit/activate/promote/delete (the
445
+ // admin-shaped path that mints or rolls versions). workspace:admin is the
446
+ // super-wildcard over both.
447
+ "rigs:use",
448
+ "rigs:manage"
429
449
  ]);
450
+ function prefixedMcpToolName(registryId2, toolName) {
451
+ return `${registryId2}__${toolName}`;
452
+ }
430
453
  var ProductAccessMode = z.enum(["local", "configured", "managed"]);
431
454
  var BillingMode = z.enum(["disabled", "stripe"]);
432
455
  var EntitlementsMode = z.enum(["none", "static", "managed"]);
@@ -450,12 +473,40 @@ var Workspace = z.object({
450
473
  // Per-workspace agent persona template (white-label override). null means
451
474
  // the deployment default (OPENGENI_AGENT_INSTRUCTIONS_TEMPLATE /
452
475
  // DEFAULT_AGENT_INSTRUCTIONS) is used. The runtime always injects the
453
- // non-bypassable CORE (goal-loop ownership + environment block), so an
476
+ // non-bypassable CORE (goal-loop ownership + variableSet block), so an
454
477
  // override restyles the persona without dropping that contract.
455
478
  agentInstructions: z.string().nullable(),
479
+ // Growth-ready per-workspace settings bag (migration 0045). Known keys are
480
+ // validated by WorkspaceSettingsSchema; unknown keys are preserved across
481
+ // PATCH merges so newer settings survive an older server.
482
+ settings: z.record(z.string(), z.unknown()),
483
+ inferenceState: z.enum(["active", "paused"]),
484
+ inferenceGeneration: z.number().int().nonnegative(),
485
+ inferenceReason: z.string().nullable(),
486
+ inferenceChangedBy: z.string().nullable(),
487
+ inferenceChangedAt: z.string().nullable(),
488
+ // Workspace default rig used by session/scheduled-task create fallback.
489
+ defaultRigId: z.string().uuid().nullable(),
456
490
  createdAt: z.string(),
457
491
  updatedAt: z.string()
458
492
  });
493
+ var WorkspaceSettingsSchema = z.object({
494
+ memoryEnabled: z.boolean().optional()
495
+ }).passthrough();
496
+ function resolveWorkspaceMemoryEnabled(settings) {
497
+ const parsed = WorkspaceSettingsSchema.safeParse(settings ?? {});
498
+ return parsed.success ? parsed.data.memoryEnabled === true : false;
499
+ }
500
+ var UpdateWorkspaceSettingsRequest = z.object({
501
+ memoryEnabled: z.boolean().optional()
502
+ }).passthrough();
503
+ var SetWorkspaceDefaultRigRequest = z.object({
504
+ rigId: z.string().uuid().nullable()
505
+ });
506
+ var UpdateWorkspaceModelPolicyRequest = z.object({
507
+ allowedProviders: z.array(z.string().min(1).max(128)).max(64).nullable().optional(),
508
+ allowedModels: z.array(z.string().min(1).max(256)).max(256).nullable().optional()
509
+ });
459
510
  var AccountGrant = z.object({
460
511
  accountId: z.string().uuid(),
461
512
  subjectId: z.string().min(1),
@@ -490,10 +541,18 @@ var DelegatedAccessTokenPayload = z.object({
490
541
  // Worker-asserted session scope for first-party MCP calls (HMAC-signed, not
491
542
  // agent-controlled); enables session-scoped tools such as goal management.
492
543
  sessionId: z.string().uuid().optional(),
544
+ // The turn making the call (the caller's identity), HMAC-signed by the worker
545
+ // at turn setup. Lets a tool classify WHO is calling from the token itself,
546
+ // instead of racily re-reading the session's live active_turn_id — e.g. the
547
+ // sacred-pause guard must know if the CALLER is a machine child-notification
548
+ // turn, and the active pointer can flip to another turn mid-check.
549
+ turnId: z.string().uuid().optional(),
493
550
  exp: z.number().int().positive()
494
551
  });
495
552
  async function signDelegatedAccessToken(secret, payload) {
496
- const encodedPayload = base64UrlEncode(JSON.stringify(DelegatedAccessTokenPayload.parse(payload)));
553
+ const encodedPayload = base64UrlEncode(
554
+ JSON.stringify(DelegatedAccessTokenPayload.parse(payload))
555
+ );
497
556
  const signature = await hmacSha256Base64Url(secret, encodedPayload);
498
557
  return `ogd_${encodedPayload}.${signature}`;
499
558
  }
@@ -512,7 +571,9 @@ async function verifyDelegatedAccessToken(secret, token, nowSeconds = Math.floor
512
571
  if (!constantTimeEqual(signature, expected)) {
513
572
  return null;
514
573
  }
515
- const payload = DelegatedAccessTokenPayload.safeParse(JSON.parse(base64UrlDecode(encodedPayload)));
574
+ const payload = DelegatedAccessTokenPayload.safeParse(
575
+ JSON.parse(base64UrlDecode(encodedPayload))
576
+ );
516
577
  if (!payload.success || payload.data.exp < nowSeconds) {
517
578
  return null;
518
579
  }
@@ -808,8 +869,24 @@ var LimitDecision = z.discriminatedUnion("allowed", [
808
869
  ]);
809
870
  var EntitlementDecision = z.discriminatedUnion("allowed", [
810
871
  z.object({ allowed: z.literal(true), quantity: z.number().optional() }),
811
- z.object({ allowed: z.literal(false), reason: z.string(), code: z.string().optional(), quantity: z.number().optional() })
872
+ z.object({
873
+ allowed: z.literal(false),
874
+ reason: z.string(),
875
+ code: z.string().optional(),
876
+ quantity: z.number().optional()
877
+ })
812
878
  ]);
879
+ var GitCredentialProvider = z.enum(["github", "gitlab", "azure_devops"]);
880
+ var GitProviderRepositoryId = z.union([z.number().int().positive(), z.string().min(1)]);
881
+ var GitCredentialRepositoryRef = z.object({
882
+ provider: GitCredentialProvider.optional(),
883
+ uri: z.string().min(1),
884
+ ref: z.string().min(1),
885
+ repositoryId: GitProviderRepositoryId.optional(),
886
+ installationId: GitProviderRepositoryId.optional(),
887
+ projectId: GitProviderRepositoryId.optional(),
888
+ connectionId: z.string().min(1).optional()
889
+ });
813
890
  var BillingBalance = z.object({
814
891
  accountId: z.string().uuid(),
815
892
  balanceMicros: z.number().int(),
@@ -835,6 +912,11 @@ var RepositoryResourceRef = z.object({
835
912
  ref: z.string().min(1),
836
913
  mountPath: z.string().min(1).optional(),
837
914
  subpath: z.string().min(1).optional(),
915
+ provider: GitCredentialProvider.optional(),
916
+ repositoryId: GitProviderRepositoryId.optional(),
917
+ installationId: GitProviderRepositoryId.optional(),
918
+ projectId: GitProviderRepositoryId.optional(),
919
+ connectionId: z.string().min(1).optional(),
838
920
  githubInstallationId: z.number().int().positive().optional(),
839
921
  githubRepositoryId: z.number().int().positive().optional()
840
922
  });
@@ -845,7 +927,13 @@ var FileResourceRef = z.object({
845
927
  });
846
928
  var ResourceRef = z.discriminatedUnion("kind", [RepositoryResourceRef, FileResourceRef]);
847
929
  var FileStatus = z.enum(["pending_upload", "ready", "failed", "expired", "deleted"]);
848
- var FileUploadStatus = z.enum(["pending", "completed", "expired", "failed"]);
930
+ var FileUploadStatus = z.enum([
931
+ "pending",
932
+ "cleanup_pending",
933
+ "completed",
934
+ "expired",
935
+ "failed"
936
+ ]);
849
937
  var FileAsset = z.object({
850
938
  id: z.string().uuid(),
851
939
  workspaceId: z.string().uuid(),
@@ -882,6 +970,17 @@ var FileDownloadUrlResponse = z.object({
882
970
  expiresAt: z.string()
883
971
  });
884
972
  var DocumentStatus = z.enum(["queued", "indexing", "ready", "failed"]);
973
+ var KnowledgeSourceKind = z.enum([
974
+ "manual_upload",
975
+ "meeting_transcript",
976
+ "repository",
977
+ "email",
978
+ "chat",
979
+ "document",
980
+ "web",
981
+ "other"
982
+ ]);
983
+ var DocumentSearchMode = z.enum(["hybrid", "vector", "keyword"]);
885
984
  var DocumentBase = z.object({
886
985
  id: z.string().uuid(),
887
986
  workspaceId: z.string().uuid(),
@@ -900,6 +999,15 @@ var Document = z.object({
900
999
  parser: z.string(),
901
1000
  chunkCount: z.number().int().nonnegative(),
902
1001
  error: z.string().nullable(),
1002
+ sourceKind: KnowledgeSourceKind,
1003
+ sourceUri: z.string().nullable(),
1004
+ sourceExternalId: z.string().nullable(),
1005
+ sourceTitle: z.string().nullable(),
1006
+ sourceAuthor: z.string().nullable(),
1007
+ sourceCreatedAt: z.string().nullable(),
1008
+ sourceUpdatedAt: z.string().nullable(),
1009
+ sourceVersion: z.string().nullable(),
1010
+ aclTags: z.array(z.string()),
903
1011
  createdAt: z.string(),
904
1012
  updatedAt: z.string()
905
1013
  });
@@ -912,19 +1020,142 @@ var DocumentSearchResult = z.object({
912
1020
  title: z.string(),
913
1021
  text: z.string(),
914
1022
  score: z.number(),
1023
+ matchType: DocumentSearchMode,
1024
+ vectorScore: z.number().nullable(),
1025
+ keywordScore: z.number().nullable(),
915
1026
  chunkIndex: z.number().int().nonnegative(),
916
- metadata: z.record(z.string(), z.unknown())
1027
+ metadata: z.record(z.string(), z.unknown()),
1028
+ sourceKind: KnowledgeSourceKind,
1029
+ sourceUri: z.string().nullable(),
1030
+ sourceExternalId: z.string().nullable(),
1031
+ sourceTitle: z.string().nullable(),
1032
+ sourceAuthor: z.string().nullable(),
1033
+ sourceCreatedAt: z.string().nullable(),
1034
+ sourceUpdatedAt: z.string().nullable(),
1035
+ sourceVersion: z.string().nullable(),
1036
+ aclTags: z.array(z.string())
917
1037
  });
918
1038
  var CreateDocumentBaseRequest = z.object({
919
1039
  name: z.string().min(1),
920
1040
  description: z.string().optional()
921
1041
  });
922
1042
  var AddDocumentRequest = z.object({
923
- fileId: z.string().uuid()
1043
+ fileId: z.string().uuid(),
1044
+ title: z.string().min(1).optional(),
1045
+ sourceKind: KnowledgeSourceKind.optional(),
1046
+ sourceUri: z.string().min(1).optional(),
1047
+ sourceExternalId: z.string().min(1).optional(),
1048
+ sourceTitle: z.string().min(1).optional(),
1049
+ sourceAuthor: z.string().min(1).optional(),
1050
+ sourceCreatedAt: z.string().datetime({ offset: true }).optional(),
1051
+ sourceUpdatedAt: z.string().datetime({ offset: true }).optional(),
1052
+ sourceVersion: z.string().min(1).optional(),
1053
+ aclTags: z.array(z.string().min(1)).optional()
924
1054
  });
925
1055
  var DocumentSearchRequest = z.object({
926
1056
  query: z.string().min(1),
927
- limit: z.number().int().positive().max(20).default(5)
1057
+ baseIds: z.array(z.string().uuid()).optional(),
1058
+ mode: DocumentSearchMode.optional(),
1059
+ sourceKinds: z.array(KnowledgeSourceKind).optional(),
1060
+ aclTags: z.array(z.string().min(1)).optional(),
1061
+ limit: z.number().int().positive().max(50).default(5)
1062
+ });
1063
+ var KnowledgeMemoryStatus = z.enum([
1064
+ "proposed",
1065
+ "approved",
1066
+ "rejected",
1067
+ "active",
1068
+ "superseded",
1069
+ "archived"
1070
+ ]);
1071
+ var KnowledgeMemoryKind = z.enum([
1072
+ "semantic",
1073
+ "episodic",
1074
+ "procedural",
1075
+ "decision",
1076
+ "preference"
1077
+ ]);
1078
+ var KnowledgeSourceRef = z.object({
1079
+ kind: z.enum(["document_chunk", "document", "session_event", "memory", "external"]),
1080
+ id: z.string().min(1),
1081
+ uri: z.string().min(1).optional(),
1082
+ title: z.string().min(1).optional(),
1083
+ metadata: z.record(z.string(), z.unknown()).default({})
1084
+ });
1085
+ var KnowledgeMemory = z.object({
1086
+ id: z.string().uuid(),
1087
+ workspaceId: z.string().uuid(),
1088
+ status: KnowledgeMemoryStatus,
1089
+ kind: KnowledgeMemoryKind,
1090
+ scope: z.string(),
1091
+ text: z.string(),
1092
+ sourceRefs: z.array(KnowledgeSourceRef),
1093
+ confidence: z.number().min(0).max(1),
1094
+ metadata: z.record(z.string(), z.unknown()),
1095
+ createdBySessionId: z.string().uuid().nullable(),
1096
+ reviewedBy: z.string().nullable(),
1097
+ reviewedAt: z.string().nullable(),
1098
+ // Workspace Memory V1 fields. usageCount/lastUsedAt feed end-state ranking and
1099
+ // decay; supersedesId/supersededById link correction chains; validFrom/validUntil
1100
+ // are the point-in-time window. embedding/embeddingModel/textHash are internal
1101
+ // and never exposed on the wire.
1102
+ pinned: z.boolean(),
1103
+ usageCount: z.number().int(),
1104
+ lastUsedAt: z.string().nullable(),
1105
+ supersedesId: z.string().uuid().nullable(),
1106
+ supersededById: z.string().uuid().nullable(),
1107
+ validFrom: z.string(),
1108
+ validUntil: z.string().nullable(),
1109
+ createdAt: z.string(),
1110
+ updatedAt: z.string()
1111
+ });
1112
+ var CreateKnowledgeMemoryRequest = z.object({
1113
+ status: KnowledgeMemoryStatus.default("active"),
1114
+ kind: KnowledgeMemoryKind.default("semantic"),
1115
+ scope: z.string().min(1).default("workspace"),
1116
+ text: z.string().min(1),
1117
+ sourceRefs: z.array(KnowledgeSourceRef).default([]),
1118
+ confidence: z.number().min(0).max(1).default(0.5),
1119
+ metadata: z.record(z.string(), z.unknown()).default({}),
1120
+ createdBySessionId: z.string().uuid().optional(),
1121
+ pinned: z.boolean().optional(),
1122
+ replacesId: z.string().min(1).optional()
1123
+ });
1124
+ var UpdateKnowledgeMemoryRequest = z.object({
1125
+ status: KnowledgeMemoryStatus.optional(),
1126
+ kind: KnowledgeMemoryKind.optional(),
1127
+ scope: z.string().min(1).optional(),
1128
+ text: z.string().min(1).optional(),
1129
+ sourceRefs: z.array(KnowledgeSourceRef).optional(),
1130
+ confidence: z.number().min(0).max(1).optional(),
1131
+ metadata: z.record(z.string(), z.unknown()).optional(),
1132
+ reviewedBy: z.string().min(1).optional(),
1133
+ // Human audit action: pin (never decays) / unpin.
1134
+ pinned: z.boolean().optional()
1135
+ });
1136
+ var KnowledgeMemorySearchRequest = z.object({
1137
+ query: z.string().min(1).optional(),
1138
+ status: KnowledgeMemoryStatus.optional(),
1139
+ kind: KnowledgeMemoryKind.optional(),
1140
+ scope: z.string().min(1).optional(),
1141
+ limit: z.number().int().positive().max(100).default(20)
1142
+ });
1143
+ var WorkspaceMemorySearchMode = z.enum(["hybrid", "vector", "keyword"]);
1144
+ var WorkspaceMemorySearchRequest = z.object({
1145
+ query: z.string().min(1),
1146
+ kind: KnowledgeMemoryKind.optional(),
1147
+ limit: z.number().int().positive().max(20).optional(),
1148
+ mode: WorkspaceMemorySearchMode.optional()
1149
+ });
1150
+ var WorkspaceMemorySearchResult = z.object({
1151
+ memory: KnowledgeMemory,
1152
+ score: z.number(),
1153
+ matchType: WorkspaceMemorySearchMode,
1154
+ vectorScore: z.number().nullable(),
1155
+ keywordScore: z.number().nullable()
1156
+ });
1157
+ var WorkspaceMemorySearchResponse = z.object({
1158
+ results: z.array(WorkspaceMemorySearchResult)
928
1159
  });
929
1160
  var ToolRef = z.object({
930
1161
  kind: z.literal("mcp"),
@@ -938,13 +1169,16 @@ var ToolRef = z.object({
938
1169
  optional: z.boolean().optional()
939
1170
  });
940
1171
  var registryId = /^[A-Za-z0-9_-]+$/;
941
- var httpsUrl = z.string().url().refine((value) => {
942
- try {
943
- return new URL(value).protocol === "https:";
944
- } catch {
945
- return false;
946
- }
947
- }, { message: "URL must use https" });
1172
+ var httpsUrl = z.string().url().refine(
1173
+ (value) => {
1174
+ try {
1175
+ return new URL(value).protocol === "https:";
1176
+ } catch {
1177
+ return false;
1178
+ }
1179
+ },
1180
+ { message: "URL must use https" }
1181
+ );
948
1182
  var SessionMcpServerInput = z.object({
949
1183
  id: z.string().min(1).regex(registryId),
950
1184
  name: z.string().min(1).optional(),
@@ -952,6 +1186,12 @@ var SessionMcpServerInput = z.object({
952
1186
  allowedTools: z.array(z.string().min(1)).optional(),
953
1187
  timeoutMs: z.number().int().positive().optional(),
954
1188
  cacheToolsList: z.boolean().optional(),
1189
+ // Human-approval policy for this server's tools. `true` = every tool of this
1190
+ // server requires approval before it runs (a `session.requiresAction` pause
1191
+ // the caller resolves with `user.approvalDecision`); a string[] = ONLY the
1192
+ // listed UNPREFIXED tool names require approval (e.g. reads auto-run, writes
1193
+ // ask); absent / `false` = auto-run everything (the historical default).
1194
+ requireApproval: z.union([z.boolean(), z.array(z.string().min(1))]).optional(),
955
1195
  // Write-only credential headers. Values are encrypted at rest and never
956
1196
  // returned in session responses or events; response metadata exposes names.
957
1197
  headers: z.record(z.string(), z.string()).optional()
@@ -993,8 +1233,14 @@ function mergeToolRefs(existing, additions) {
993
1233
  }
994
1234
  function mergeResourceRefs(existing, additions, options = {}) {
995
1235
  const out = [...existing];
996
- const mountPaths = new Map(existing.flatMap((resource) => resource.mountPath ? [[resource.mountPath, stableJson(resource)]] : []));
997
- const identities = new Map(existing.map((resource) => [resourceIdentityKey(resource), stableJson(resource)]));
1236
+ const mountPaths = new Map(
1237
+ existing.flatMap(
1238
+ (resource) => resource.mountPath ? [[resource.mountPath, stableJson(resource)]] : []
1239
+ )
1240
+ );
1241
+ const identities = new Map(
1242
+ existing.map((resource) => [resourceIdentityKey(resource), stableJson(resource)])
1243
+ );
998
1244
  const exact = new Set(existing.map(stableJson));
999
1245
  for (const resource of additions) {
1000
1246
  const serialized = stableJson(resource);
@@ -1004,12 +1250,16 @@ function mergeResourceRefs(existing, additions, options = {}) {
1004
1250
  if (options.rejectConflicts) {
1005
1251
  const existingAtMount = resource.mountPath ? mountPaths.get(resource.mountPath) : void 0;
1006
1252
  if (existingAtMount && existingAtMount !== serialized) {
1007
- throw new ResourceRefConflictError(`resource mount path is already attached: ${resource.mountPath}`);
1253
+ throw new ResourceRefConflictError(
1254
+ `resource mount path is already attached: ${resource.mountPath}`
1255
+ );
1008
1256
  }
1009
1257
  const identity = resourceIdentityKey(resource);
1010
1258
  const existingIdentity = identities.get(identity);
1011
1259
  if (existingIdentity && existingIdentity !== serialized) {
1012
- throw new ResourceRefConflictError(`resource is already attached with different settings: ${identity}`);
1260
+ throw new ResourceRefConflictError(
1261
+ `resource is already attached with different settings: ${identity}`
1262
+ );
1013
1263
  }
1014
1264
  }
1015
1265
  out.push(resource);
@@ -1039,17 +1289,38 @@ function sortJson(value) {
1039
1289
  return value.map(sortJson);
1040
1290
  }
1041
1291
  if (value && typeof value === "object") {
1042
- return Object.fromEntries(Object.entries(value).sort(([a], [b]) => a.localeCompare(b)).map(([key, nested]) => [key, sortJson(nested)]));
1292
+ return Object.fromEntries(
1293
+ Object.entries(value).sort(([a], [b]) => a.localeCompare(b)).map(([key, nested]) => [key, sortJson(nested)])
1294
+ );
1043
1295
  }
1044
1296
  return value;
1045
1297
  }
1046
- var SessionTurnStatus = z.enum(["queued", "running", "requires_action", "completed", "failed", "cancelled"]);
1047
- var SessionTurnSource = z.enum(["user", "scheduled_task", "api", "goal"]);
1298
+ var SessionTurnStatus = z.enum([
1299
+ "queued",
1300
+ "running",
1301
+ "requires_action",
1302
+ "recovering",
1303
+ "waiting_capacity",
1304
+ "completed",
1305
+ "failed",
1306
+ "cancelled",
1307
+ "superseded"
1308
+ ]);
1309
+ var SessionTurnSource = z.enum([
1310
+ "user",
1311
+ "scheduled_task",
1312
+ "api",
1313
+ "goal",
1314
+ "system",
1315
+ "compaction"
1316
+ ]);
1317
+ var SessionControlState = z.enum(["active", "paused"]);
1318
+ var WorkspaceInferenceState = z.enum(["active", "paused"]);
1048
1319
  var SessionGoalStatus = z.enum(["active", "paused", "completed"]);
1049
1320
  var SessionGoalCreatedBy = z.enum(["api", "agent", "scheduled_task"]);
1050
1321
  var SessionGoalPausedReason = z.enum([
1051
1322
  "agent",
1052
- "user_interrupt",
1323
+ "user_pause",
1053
1324
  "api",
1054
1325
  "no_progress",
1055
1326
  "max_auto_continuations",
@@ -1087,6 +1358,10 @@ var UpdateSessionGoalRequest = z.object({
1087
1358
  var UpdateSessionRequest = z.object({
1088
1359
  title: z.string().min(1).max(200)
1089
1360
  });
1361
+ var UpdateSessionPinRequest = z.object({
1362
+ pinned: z.boolean(),
1363
+ expectedVersion: z.number().int().nonnegative().optional()
1364
+ });
1090
1365
  var ClearSessionContextRequest = z.object({
1091
1366
  confirm: z.literal(true)
1092
1367
  });
@@ -1105,9 +1380,10 @@ function isClearedRunStateBlob(serialized) {
1105
1380
  }
1106
1381
  var CompactSessionContextRequest = z.object({}).strict();
1107
1382
  var CompactSessionContextResult = z.object({
1108
- // queued: a client-side (Azure) compaction will run before the next turn.
1109
- // noop: nothing to do (server-managed provider, mode off, or no history).
1110
- status: z.enum(["queued", "noop"]),
1383
+ // pending: an active/paused session will compact at its next safe boundary.
1384
+ // completed: an idle compaction-only activity completed synchronously.
1385
+ // noop: there is no active history to compact.
1386
+ status: z.enum(["pending", "completed", "noop"]),
1111
1387
  message: z.string()
1112
1388
  });
1113
1389
  var SessionTurn = z.object({
@@ -1118,7 +1394,7 @@ var SessionTurn = z.object({
1118
1394
  temporalWorkflowId: z.string(),
1119
1395
  status: SessionTurnStatus,
1120
1396
  source: SessionTurnSource,
1121
- position: z.number().int().positive(),
1397
+ position: z.number().int(),
1122
1398
  prompt: z.string().min(1),
1123
1399
  resources: z.array(ResourceRef),
1124
1400
  tools: z.array(ToolRef),
@@ -1128,55 +1404,232 @@ var SessionTurn = z.object({
1128
1404
  // Per-turn OS override. NULL = inherit the session's sandboxOs.
1129
1405
  sandboxOs: SandboxOs.nullable(),
1130
1406
  metadata: z.record(z.string(), z.unknown()),
1407
+ version: z.number().int().positive(),
1408
+ executionGeneration: z.number().int().nonnegative(),
1409
+ activeAttemptId: z.string().uuid().nullable(),
1410
+ lineage: z.record(z.string(), z.unknown()),
1411
+ cancelledBy: z.string().nullable(),
1412
+ cancelReason: z.string().nullable(),
1131
1413
  startedAt: z.string().nullable(),
1132
1414
  finishedAt: z.string().nullable(),
1133
1415
  createdAt: z.string(),
1134
1416
  updatedAt: z.string()
1135
1417
  });
1136
- var UpdateSessionTurnRequest = z.object({
1137
- prompt: z.string().min(1).optional(),
1138
- resources: z.array(ResourceRef).optional(),
1139
- tools: z.array(ToolRef).optional(),
1140
- model: z.string().min(1).optional(),
1141
- reasoningEffort: ReasoningEffort.optional(),
1142
- sandboxBackend: SandboxBackend.optional(),
1143
- metadata: z.record(z.string(), z.unknown()).optional()
1144
- });
1145
- var ReorderSessionTurnsRequest = z.object({
1146
- turnIds: z.array(z.string().uuid()).min(1)
1418
+ var SessionQueueSnapshot = z.object({
1419
+ version: z.number().int().nonnegative(),
1420
+ controlState: SessionControlState,
1421
+ controlGeneration: z.number().int().nonnegative(),
1422
+ workspaceInferenceState: WorkspaceInferenceState,
1423
+ workspaceInferenceGeneration: z.number().int().nonnegative(),
1424
+ workspaceRunExceptionGeneration: z.number().int().nonnegative().nullable(),
1425
+ items: z.array(SessionTurn)
1426
+ });
1427
+ var CancelSessionQueueItemRequest = z.object({
1428
+ expectedQueueVersion: z.number().int().nonnegative(),
1429
+ expectedItemVersion: z.number().int().positive(),
1430
+ reason: z.string().min(1).optional()
1431
+ });
1432
+ var SessionControlRequest = z.object({
1433
+ mode: z.enum(["pause", "resume"]),
1434
+ reason: z.string().min(1).optional(),
1435
+ clientEventId: z.string().min(1).optional(),
1436
+ expectedControlState: SessionControlState.optional(),
1437
+ expectedControlGeneration: z.number().int().nonnegative().optional(),
1438
+ expectedWorkspaceInferenceGeneration: z.number().int().nonnegative().optional()
1439
+ });
1440
+ var WorkspaceInferenceControlRequest = z.object({
1441
+ state: WorkspaceInferenceState,
1442
+ reason: z.string().min(1),
1443
+ clientEventId: z.string().min(1),
1444
+ expectedState: WorkspaceInferenceState,
1445
+ expectedGeneration: z.number().int().nonnegative(),
1446
+ exceptSessionIds: z.array(z.string().uuid()).default([])
1447
+ });
1448
+ var WorkspaceInferenceControlResponse = z.object({
1449
+ operationId: z.string().uuid(),
1450
+ state: WorkspaceInferenceState,
1451
+ generation: z.number().int().nonnegative(),
1452
+ affectedSessionIds: z.array(z.string().uuid()),
1453
+ controlSessionIds: z.array(z.string().uuid()),
1454
+ exceptionSessionIds: z.array(z.string().uuid())
1455
+ });
1456
+ var SystemUpdateClassification = z.enum(["success", "failure", "action_required", "info"]);
1457
+ var SessionSystemUpdateKind = z.enum([
1458
+ "child_session_update",
1459
+ "scheduled_wake",
1460
+ "lifecycle_event",
1461
+ "runtime_notice"
1462
+ ]);
1463
+ var SessionSystemUpdateState = z.enum([
1464
+ "pending",
1465
+ "deferred",
1466
+ "delivered",
1467
+ "cancelled",
1468
+ "failed"
1469
+ ]);
1470
+ var SessionSystemUpdate = z.object({
1471
+ id: z.string().uuid(),
1472
+ sessionId: z.string().uuid(),
1473
+ kind: SessionSystemUpdateKind,
1474
+ classification: SystemUpdateClassification,
1475
+ sourceId: z.string(),
1476
+ dedupeKey: z.string(),
1477
+ summary: z.string(),
1478
+ payload: z.record(z.string(), z.unknown()),
1479
+ lineage: z.record(z.string(), z.unknown()),
1480
+ state: SessionSystemUpdateState,
1481
+ deliveredTurnId: z.string().uuid().nullable(),
1482
+ deliveredAt: z.string().nullable(),
1483
+ createdAt: z.string()
1147
1484
  });
1148
- var WorkspaceEnvironmentVariableName = z.string().regex(/^[A-Z][A-Z0-9_]*$/).max(128);
1149
- var WorkspaceEnvironmentVariableMetadata = z.object({
1150
- name: WorkspaceEnvironmentVariableName,
1485
+ var VariableSetVariableName = z.string().regex(/^[A-Z][A-Z0-9_]*$/).max(128);
1486
+ function withVariableSetIdAlias(shape) {
1487
+ return z.preprocess((input) => {
1488
+ if (!input || typeof input !== "object" || Array.isArray(input)) {
1489
+ return input;
1490
+ }
1491
+ const record = input;
1492
+ if (record.variableSetId !== void 0 || record.environmentId === void 0) {
1493
+ return record;
1494
+ }
1495
+ return { ...record, variableSetId: record.environmentId };
1496
+ }, z.object(shape));
1497
+ }
1498
+ var VariableSetVariableMetadata = z.object({
1499
+ name: VariableSetVariableName,
1151
1500
  version: z.number().int().positive(),
1152
1501
  createdAt: z.string(),
1153
1502
  updatedAt: z.string()
1154
1503
  });
1155
- var WorkspaceEnvironment = z.object({
1504
+ var WorkspaceEnvironmentVariableMetadata = VariableSetVariableMetadata;
1505
+ var VariableSet = z.object({
1156
1506
  id: z.string().uuid(),
1157
1507
  accountId: z.string().uuid(),
1158
1508
  workspaceId: z.string().uuid(),
1159
1509
  name: z.string(),
1160
1510
  description: z.string().nullable(),
1161
- variables: z.array(WorkspaceEnvironmentVariableMetadata),
1511
+ variables: z.array(VariableSetVariableMetadata),
1162
1512
  createdAt: z.string(),
1163
1513
  updatedAt: z.string()
1164
1514
  });
1165
- var CreateWorkspaceEnvironmentRequest = z.object({
1515
+ var WorkspaceEnvironment = VariableSet;
1516
+ var CreateVariableSetRequest = z.object({
1166
1517
  name: z.string().min(1).max(120),
1167
1518
  description: z.string().max(2e3).optional(),
1168
- variables: z.array(z.object({
1169
- name: WorkspaceEnvironmentVariableName,
1170
- value: z.string().min(1).max(32768)
1171
- })).default([])
1519
+ variables: z.array(
1520
+ z.object({
1521
+ name: VariableSetVariableName,
1522
+ value: z.string().min(1).max(32768)
1523
+ })
1524
+ ).default([])
1172
1525
  });
1173
- var UpdateWorkspaceEnvironmentRequest = z.object({
1526
+ var CreateWorkspaceEnvironmentRequest = CreateVariableSetRequest;
1527
+ var UpdateVariableSetRequest = z.object({
1174
1528
  name: z.string().min(1).max(120).optional(),
1175
1529
  description: z.string().max(2e3).nullable().optional()
1176
1530
  });
1177
- var SetWorkspaceEnvironmentVariableRequest = z.object({
1531
+ var UpdateWorkspaceEnvironmentRequest = UpdateVariableSetRequest;
1532
+ var SetVariableSetVariableRequest = z.object({
1178
1533
  value: z.string().min(1).max(32768)
1179
1534
  });
1535
+ var SetWorkspaceEnvironmentVariableRequest = SetVariableSetVariableRequest;
1536
+ var RigCheck = z.object({
1537
+ name: z.string().min(1).max(120),
1538
+ command: z.string().min(1).max(8192)
1539
+ });
1540
+ var RigVersion = z.object({
1541
+ id: z.string().uuid(),
1542
+ rigId: z.string().uuid(),
1543
+ version: z.number().int().positive(),
1544
+ image: z.string().nullable(),
1545
+ setupScript: z.string().nullable(),
1546
+ checks: z.array(RigCheck),
1547
+ credentialHooks: z.array(z.string()),
1548
+ defaultVariableSetIds: z.array(z.string().uuid()),
1549
+ changelog: z.string().nullable(),
1550
+ // Attribution: 'user:<subject>' | 'session:<id>' | 'system'.
1551
+ createdBy: z.string().nullable(),
1552
+ active: z.boolean(),
1553
+ createdAt: z.string()
1554
+ });
1555
+ var RigVerificationHealth = z.object({
1556
+ checkHealth: z.enum(["passing", "failing", "unknown"]),
1557
+ lastVerifiedAt: z.string().nullable()
1558
+ });
1559
+ var Rig = z.object({
1560
+ id: z.string().uuid(),
1561
+ accountId: z.string().uuid(),
1562
+ workspaceId: z.string().uuid(),
1563
+ name: z.string(),
1564
+ description: z.string().nullable(),
1565
+ createdBy: z.string().nullable(),
1566
+ // The rig's currently-active version (present after create; nullable so a
1567
+ // partial/list read can omit it without a schema change).
1568
+ activeVersion: RigVersion.nullable(),
1569
+ // Summary for the currently active version. null only when there is no active
1570
+ // version; otherwise "unknown" means the active version has no verification.
1571
+ activeVersionHealth: RigVerificationHealth.nullable(),
1572
+ versionCount: z.number().int().nonnegative(),
1573
+ createdAt: z.string(),
1574
+ updatedAt: z.string()
1575
+ });
1576
+ var RigChangeKind = z.enum(["setup_append", "definition_edit"]);
1577
+ var RigChangeStatus = z.enum(["proposed", "verifying", "merged", "rejected", "failed"]);
1578
+ var RigCheckResult = z.object({
1579
+ name: z.string(),
1580
+ command: z.string(),
1581
+ exitCode: z.number().int().nullable(),
1582
+ output: z.string().optional()
1583
+ });
1584
+ var RigChangeVerification = z.object({
1585
+ startedAt: z.string().optional(),
1586
+ finishedAt: z.string().optional(),
1587
+ log: z.string().optional(),
1588
+ checkResults: z.array(RigCheckResult).optional()
1589
+ }).passthrough();
1590
+ var RigChange = z.object({
1591
+ id: z.string().uuid(),
1592
+ rigId: z.string().uuid(),
1593
+ baseVersionId: z.string().uuid().nullable(),
1594
+ kind: RigChangeKind,
1595
+ payload: z.record(z.string(), z.unknown()),
1596
+ status: RigChangeStatus,
1597
+ proposedBy: z.string().nullable(),
1598
+ verification: RigChangeVerification.nullable(),
1599
+ resultVersionId: z.string().uuid().nullable(),
1600
+ createdAt: z.string(),
1601
+ updatedAt: z.string()
1602
+ });
1603
+ var CreateRigRequest = z.object({
1604
+ name: z.string().min(1).max(120),
1605
+ description: z.string().max(2e3).optional(),
1606
+ // Initial (version 1) content, inline.
1607
+ image: z.string().max(1024).optional(),
1608
+ setupScript: z.string().max(131072).optional(),
1609
+ checks: z.array(RigCheck).max(100).default([]),
1610
+ credentialHooks: z.array(z.string().min(1).max(200)).max(50).default([]),
1611
+ defaultVariableSetIds: z.array(z.string().uuid()).max(25).default([])
1612
+ });
1613
+ var UpdateRigRequest = z.object({
1614
+ name: z.string().min(1).max(120).optional(),
1615
+ description: z.string().max(2e3).nullable().optional()
1616
+ });
1617
+ var RigSetupAppendPayload = z.object({
1618
+ command: z.string().min(1).max(8192),
1619
+ note: z.string().max(2e3).optional()
1620
+ });
1621
+ var RigDefinitionEditPayload = z.object({
1622
+ image: z.string().max(1024).nullish(),
1623
+ setupScript: z.string().max(131072).nullish(),
1624
+ checks: z.array(RigCheck).max(100).optional(),
1625
+ credentialHooks: z.array(z.string().min(1).max(200)).max(50).optional(),
1626
+ defaultVariableSetIds: z.array(z.string().uuid()).max(25).optional(),
1627
+ changelog: z.string().max(4096).nullish()
1628
+ });
1629
+ var ProposeRigChangeRequest = z.discriminatedUnion("kind", [
1630
+ z.object({ kind: z.literal("setup_append"), payload: RigSetupAppendPayload }),
1631
+ z.object({ kind: z.literal("definition_edit"), payload: RigDefinitionEditPayload })
1632
+ ]);
1180
1633
  var ScheduledTaskStatus = z.enum(["active", "paused"]);
1181
1634
  var ScheduledTaskRunStatus = z.enum(["queued", "dispatched", "failed"]);
1182
1635
  var ScheduledTaskRunMode = z.enum(["new_session_per_run", "reusable_session"]);
@@ -1224,7 +1677,13 @@ var ScheduledTask = z.object({
1224
1677
  overlapPolicy: ScheduledTaskOverlapPolicy,
1225
1678
  agentConfig: ScheduledTaskAgentConfig,
1226
1679
  reusableSessionId: z.string().uuid().nullable(),
1227
- environmentId: z.string().uuid().nullable(),
1680
+ variableSetId: z.string().uuid().nullable().default(null),
1681
+ /** @deprecated use variableSetId */
1682
+ environmentId: z.string().uuid().nullable().default(null),
1683
+ // The rig each run binds to (M3). Stored on the task; the ACTIVE version is
1684
+ // resolved PER FIRE (at dispatch), so a task always runs the rig's current
1685
+ // version rather than one frozen at task-create time. Null ⇒ rig-less runs.
1686
+ rigId: z.string().uuid().nullable().default(null),
1228
1687
  metadata: z.record(z.string(), z.unknown()),
1229
1688
  createdAt: z.string(),
1230
1689
  updatedAt: z.string()
@@ -1244,24 +1703,31 @@ var ScheduledTaskRun = z.object({
1244
1703
  createdAt: z.string(),
1245
1704
  updatedAt: z.string()
1246
1705
  });
1247
- var CreateScheduledTaskRequest = z.object({
1706
+ var CreateScheduledTaskRequest = withVariableSetIdAlias({
1248
1707
  name: z.string().min(1),
1249
1708
  schedule: ScheduledTaskScheduleSpec,
1250
1709
  runMode: ScheduledTaskRunMode.default("new_session_per_run"),
1251
1710
  overlapPolicy: ScheduledTaskOverlapPolicy.default("allow_concurrent"),
1252
1711
  agentConfig: ScheduledTaskAgentConfig,
1253
1712
  status: ScheduledTaskStatus.default("active"),
1713
+ variableSetId: z.string().uuid().nullable().optional(),
1254
1714
  environmentId: z.string().uuid().nullable().optional(),
1715
+ // The rig each run binds to (M3); its active version is resolved per fire.
1716
+ rigId: z.string().uuid().nullable().optional(),
1255
1717
  metadata: z.record(z.string(), z.unknown()).default({})
1256
1718
  });
1257
- var UpdateScheduledTaskRequest = z.object({
1719
+ var UpdateScheduledTaskRequest = withVariableSetIdAlias({
1258
1720
  name: z.string().min(1).optional(),
1259
1721
  schedule: ScheduledTaskScheduleSpec.optional(),
1260
1722
  runMode: ScheduledTaskRunMode.optional(),
1261
1723
  overlapPolicy: ScheduledTaskOverlapPolicy.optional(),
1262
1724
  agentConfig: ScheduledTaskAgentConfig.optional(),
1263
1725
  status: ScheduledTaskStatus.optional(),
1726
+ variableSetId: z.string().uuid().nullable().optional(),
1264
1727
  environmentId: z.string().uuid().nullable().optional(),
1728
+ // The rig each run binds to (M3); null clears it. Its active version is
1729
+ // resolved per fire, so an update takes effect on the next dispatch.
1730
+ rigId: z.string().uuid().nullable().optional(),
1265
1731
  metadata: z.record(z.string(), z.unknown()).optional()
1266
1732
  });
1267
1733
  var TriggerScheduledTaskRequest = z.object({
@@ -1317,12 +1783,20 @@ var CapabilityPackSkill = z.object({
1317
1783
  const seen = /* @__PURE__ */ new Set();
1318
1784
  skill.files.forEach((file, index) => {
1319
1785
  if (seen.has(file.path)) {
1320
- ctx.addIssue({ code: "custom", message: `duplicate skill file path: ${file.path}`, path: ["files", index, "path"] });
1786
+ ctx.addIssue({
1787
+ code: "custom",
1788
+ message: `duplicate skill file path: ${file.path}`,
1789
+ path: ["files", index, "path"]
1790
+ });
1321
1791
  }
1322
1792
  seen.add(file.path);
1323
1793
  });
1324
1794
  if (!skill.files.some((file) => file.path === "SKILL.md")) {
1325
- ctx.addIssue({ code: "custom", message: "skill must include a top-level SKILL.md file", path: ["files"] });
1795
+ ctx.addIssue({
1796
+ code: "custom",
1797
+ message: "skill must include a top-level SKILL.md file",
1798
+ path: ["files"]
1799
+ });
1326
1800
  }
1327
1801
  });
1328
1802
  function isSafePackSkillRelativePath(path) {
@@ -1331,39 +1805,71 @@ function isSafePackSkillRelativePath(path) {
1331
1805
  }
1332
1806
  return path.split("/").every((segment) => segment.length > 0 && segment !== "." && segment !== "..");
1333
1807
  }
1334
- var CapabilityPack = z.object({
1335
- id: z.string().min(1),
1336
- name: z.string().min(1),
1808
+ var CapabilityPackVariableSet = z.object({
1337
1809
  description: z.string().min(1),
1338
- role: z.string().min(1),
1339
- category: z.string().min(1),
1340
- version: z.string().min(1),
1341
- // Container image ref (digest-pinned recommended) the pack's sessions run
1342
- // in. At most one enabled pack per workspace may declare one; with none,
1343
- // sessions use the deployment-wide image settings.
1344
- sandboxImage: z.string().trim().min(1).max(512).optional(),
1345
- // Skills delivered into the sandbox skill index when the pack is enabled.
1346
- skills: z.array(CapabilityPackSkill).max(32).superRefine((skills, ctx) => {
1347
- const seen = /* @__PURE__ */ new Set();
1348
- skills.forEach((skill, index) => {
1349
- const key = skill.name.toLowerCase();
1350
- if (seen.has(key)) {
1351
- ctx.addIssue({ code: "custom", message: `duplicate pack skill name: ${skill.name}`, path: [index, "name"] });
1352
- }
1353
- seen.add(key);
1354
- });
1355
- }).default([]),
1356
- tools: z.array(ToolRef).default([]),
1357
- connectors: z.array(CapabilityPackConnector).default([]),
1358
- knowledge: z.array(CapabilityPackKnowledge).default([]),
1359
- scheduledTaskTemplates: z.array(CapabilityPackScheduledTaskTemplate).default([]),
1360
- environment: z.object({
1361
- description: z.string().min(1),
1362
- requiredVariables: z.array(WorkspaceEnvironmentVariableName).default([]),
1363
- required: z.boolean().default(false)
1364
- }).optional(),
1365
- metadata: z.record(z.string(), z.unknown()).default({})
1810
+ requiredVariables: z.array(VariableSetVariableName).default([]),
1811
+ required: z.boolean().default(false)
1366
1812
  });
1813
+ var CapabilityPack = z.preprocess(
1814
+ (input) => {
1815
+ if (!input || typeof input !== "object" || Array.isArray(input)) {
1816
+ return input;
1817
+ }
1818
+ const record = input;
1819
+ if (record.variableSet !== void 0) {
1820
+ return record;
1821
+ }
1822
+ if (record.environment !== void 0) {
1823
+ const { environment: _environment, ...rest } = record;
1824
+ return { ...rest, variableSet: record.environment };
1825
+ }
1826
+ if (record.requiredVariables !== void 0) {
1827
+ const { requiredVariables: _requiredVariables, ...rest } = record;
1828
+ return {
1829
+ ...rest,
1830
+ variableSet: {
1831
+ description: "Required variables",
1832
+ requiredVariables: record.requiredVariables,
1833
+ required: Array.isArray(record.requiredVariables) && record.requiredVariables.length > 0
1834
+ }
1835
+ };
1836
+ }
1837
+ return record;
1838
+ },
1839
+ z.object({
1840
+ id: z.string().min(1),
1841
+ name: z.string().min(1),
1842
+ description: z.string().min(1),
1843
+ role: z.string().min(1),
1844
+ category: z.string().min(1),
1845
+ version: z.string().min(1),
1846
+ // Container image ref (digest-pinned recommended) the pack's sessions run
1847
+ // in. At most one enabled pack per workspace may declare one; with none,
1848
+ // sessions use the deployment-wide image settings.
1849
+ sandboxImage: z.string().trim().min(1).max(512).optional(),
1850
+ // Skills delivered into the sandbox skill index when the pack is enabled.
1851
+ skills: z.array(CapabilityPackSkill).max(32).superRefine((skills, ctx) => {
1852
+ const seen = /* @__PURE__ */ new Set();
1853
+ skills.forEach((skill, index) => {
1854
+ const key = skill.name.toLowerCase();
1855
+ if (seen.has(key)) {
1856
+ ctx.addIssue({
1857
+ code: "custom",
1858
+ message: `duplicate pack skill name: ${skill.name}`,
1859
+ path: [index, "name"]
1860
+ });
1861
+ }
1862
+ seen.add(key);
1863
+ });
1864
+ }).default([]),
1865
+ tools: z.array(ToolRef).default([]),
1866
+ connectors: z.array(CapabilityPackConnector).default([]),
1867
+ knowledge: z.array(CapabilityPackKnowledge).default([]),
1868
+ scheduledTaskTemplates: z.array(CapabilityPackScheduledTaskTemplate).default([]),
1869
+ variableSet: CapabilityPackVariableSet.optional(),
1870
+ metadata: z.record(z.string(), z.unknown()).default({})
1871
+ })
1872
+ );
1367
1873
  var RegisterCapabilityPackRequest = CapabilityPack;
1368
1874
  var WorkspaceRegisteredPack = z.object({
1369
1875
  accountId: z.string().uuid(),
@@ -1383,7 +1889,8 @@ var PackInstallation = z.object({
1383
1889
  enabledAt: z.string(),
1384
1890
  updatedAt: z.string()
1385
1891
  });
1386
- var EnablePackRequest = z.object({
1892
+ var EnablePackRequest = withVariableSetIdAlias({
1893
+ variableSetId: z.string().uuid().optional(),
1387
1894
  environmentId: z.string().uuid().optional(),
1388
1895
  metadata: z.record(z.string(), z.unknown()).default({})
1389
1896
  });
@@ -1449,6 +1956,91 @@ var CreateSocialPostRequest = z.object({
1449
1956
  metrics: z.record(z.string(), z.number()).default({}),
1450
1957
  raw: z.record(z.string(), z.unknown()).default({})
1451
1958
  });
1959
+ var ConnectionKind = z.enum(["oauth2", "api_key", "app_install", "delegated"]);
1960
+ var ConnectionStatus = z.enum(["active", "needs_reauth", "revoked", "error"]);
1961
+ var McpServerConnectionRef = z.object({
1962
+ connectionId: z.string().uuid().optional(),
1963
+ providerDomain: z.string().min(1),
1964
+ kind: ConnectionKind.optional(),
1965
+ scopes: z.array(z.string().min(1)).optional(),
1966
+ resource: z.string().min(1).optional(),
1967
+ subjectScope: z.enum(["workspace", "subject"]).optional()
1968
+ }).strict();
1969
+ var ConnectionMetadata = z.object({
1970
+ id: z.string().uuid(),
1971
+ accountId: z.string().uuid(),
1972
+ workspaceId: z.string().uuid(),
1973
+ subjectId: z.string().nullable(),
1974
+ providerDomain: z.string(),
1975
+ kind: ConnectionKind,
1976
+ status: ConnectionStatus,
1977
+ grantedScopes: z.array(z.string()),
1978
+ expiresAt: z.string().nullable(),
1979
+ lastRefreshAt: z.string().nullable(),
1980
+ lastUsedAt: z.string().nullable(),
1981
+ lastError: z.string().nullable(),
1982
+ version: z.number().int().positive(),
1983
+ metadata: z.record(z.string(), z.unknown()),
1984
+ createdBySubjectId: z.string().nullable(),
1985
+ updatedBySubjectId: z.string().nullable(),
1986
+ createdAt: z.string(),
1987
+ updatedAt: z.string()
1988
+ });
1989
+ var ConnectionCredentialBundle = z.record(z.string(), z.unknown());
1990
+ var CreateConnectionRequest = z.object({
1991
+ providerDomain: z.string().min(1),
1992
+ kind: ConnectionKind,
1993
+ subjectId: z.string().min(1).nullable().optional(),
1994
+ credential: ConnectionCredentialBundle,
1995
+ grantedScopes: z.array(z.string().min(1)).default([]),
1996
+ expiresAt: z.string().datetime({ offset: true }).nullable().optional(),
1997
+ metadata: z.record(z.string(), z.unknown()).default({})
1998
+ });
1999
+ var UpdateConnectionRequest = z.object({
2000
+ providerDomain: z.string().min(1).optional(),
2001
+ subjectId: z.string().min(1).nullable().optional(),
2002
+ kind: ConnectionKind.optional(),
2003
+ status: ConnectionStatus.optional(),
2004
+ credential: ConnectionCredentialBundle.optional(),
2005
+ grantedScopes: z.array(z.string().min(1)).optional(),
2006
+ expiresAt: z.string().datetime({ offset: true }).nullable().optional(),
2007
+ metadata: z.record(z.string(), z.unknown()).optional()
2008
+ });
2009
+ var ConnectionResponse = z.object({
2010
+ connection: ConnectionMetadata
2011
+ });
2012
+ var ListConnectionsResponse = z.object({
2013
+ connections: z.array(ConnectionMetadata)
2014
+ });
2015
+ var OAuthStartRequest = z.object({
2016
+ providerDomain: z.string().min(1).optional(),
2017
+ mcpUrl: z.string().url().optional(),
2018
+ resource: z.string().url().optional(),
2019
+ requestedScopes: z.array(z.string().min(1)).default([]),
2020
+ returnPath: z.string().min(1).optional(),
2021
+ connectionId: z.string().uuid().optional(),
2022
+ oauthClient: z.object({
2023
+ clientId: z.string().min(1),
2024
+ clientSecret: z.string().min(1).optional(),
2025
+ tokenEndpointAuthMethod: z.enum(["none", "client_secret_post", "client_secret_basic"]).optional()
2026
+ }).optional()
2027
+ }).refine((value) => Boolean(value.mcpUrl ?? value.resource), {
2028
+ message: "mcpUrl is required",
2029
+ path: ["mcpUrl"]
2030
+ });
2031
+ var OAuthStartResponse = z.object({
2032
+ state: z.string().min(1),
2033
+ authorizationUrl: z.string().url().nullable(),
2034
+ expiresAt: z.string()
2035
+ });
2036
+ var IntegrationClientMetadata = z.object({
2037
+ client_id: z.string().url(),
2038
+ client_name: z.literal("OpenGeni"),
2039
+ redirect_uris: z.array(z.string().url()),
2040
+ token_endpoint_auth_method: z.literal("none"),
2041
+ grant_types: z.array(z.enum(["authorization_code", "refresh_token"])),
2042
+ response_types: z.array(z.literal("code"))
2043
+ });
1452
2044
  var MarketingDailyAnalysisTaskRequest = z.object({
1453
2045
  name: z.string().min(1).optional(),
1454
2046
  connectionIds: z.array(z.string().uuid()).default([]),
@@ -1462,8 +2054,16 @@ var MarketingDailyAnalysisTaskRequest = z.object({
1462
2054
  overlapPolicy: ScheduledTaskOverlapPolicy.default("skip")
1463
2055
  });
1464
2056
  var CapabilityKind = z.enum(["pack", "mcp", "api", "skill", "plugin"]);
1465
- var CapabilitySource = z.enum(["built_in", "configured", "public_registry", "manual"]);
2057
+ var CapabilitySource = z.enum([
2058
+ "built_in",
2059
+ "configured",
2060
+ "public_registry",
2061
+ "registry",
2062
+ "manual"
2063
+ ]);
1466
2064
  var CapabilityInstallationStatus = z.enum(["active", "disabled"]);
2065
+ var CapabilityCatalogAuthKind = z.enum(["oauth2", "api_key", "none", "unknown"]);
2066
+ var CapabilityCatalogTier = z.enum(["verified", "community"]);
1467
2067
  var CapabilityRuntime = z.object({
1468
2068
  available: z.boolean().default(false),
1469
2069
  mcpServerId: z.string().min(1).optional(),
@@ -1484,10 +2084,31 @@ var CapabilityCatalogItem = z.object({
1484
2084
  endpointUrl: z.string().url().nullable().default(null),
1485
2085
  installUrl: z.string().url().nullable().default(null),
1486
2086
  authModel: z.string().min(1).nullable().default(null),
2087
+ providerDomain: z.string().min(1).nullable().default(null),
2088
+ surfaceType: z.string().min(1).nullable().default(null),
2089
+ transport: z.string().min(1).nullable().default(null),
2090
+ mcpUrl: z.string().url().nullable().default(null),
2091
+ authKind: CapabilityCatalogAuthKind.nullable().default(null),
2092
+ credentialFacts: z.array(z.record(z.string(), z.unknown())).default([]),
2093
+ tier: CapabilityCatalogTier.nullable().default(null),
2094
+ provenance: z.string().min(1).nullable().default(null),
2095
+ logoAssetPath: z.string().min(1).nullable().default(null),
2096
+ importBatchId: z.string().uuid().nullable().default(null),
2097
+ stale: z.boolean().default(false),
2098
+ staleAt: z.string().nullable().default(null),
1487
2099
  tools: z.array(ToolRef).default([]),
1488
2100
  runtime: CapabilityRuntime.default({ available: false, notes: null }),
1489
2101
  enabled: z.boolean().default(false),
1490
2102
  enabledReason: z.string().nullable().default(null),
2103
+ // The connection backing this enabled installation, when the enable-time
2104
+ // connectionRef resolved to one (null for header/credential-free items —
2105
+ // that means "no connection involved", not "broken"). Lets the UI match
2106
+ // connection health by id instead of guessing from providerDomain alone.
2107
+ connectionRef: z.object({
2108
+ connectionId: z.string().min(1),
2109
+ providerDomain: z.string().min(1),
2110
+ kind: z.string().min(1)
2111
+ }).nullable().default(null),
1491
2112
  metadata: z.record(z.string(), z.unknown()).default({}),
1492
2113
  createdAt: z.string().optional(),
1493
2114
  updatedAt: z.string().optional()
@@ -1518,22 +2139,24 @@ var CreateCapabilityCatalogItemRequest = z.object({
1518
2139
  authModel: z.string().min(1).optional(),
1519
2140
  metadata: z.record(z.string(), z.unknown()).default({})
1520
2141
  });
1521
- var EnableCapabilityRequest = z.object({
2142
+ var EnableCapabilityRequest = withVariableSetIdAlias({
1522
2143
  config: z.record(z.string(), z.unknown()).default({}),
1523
2144
  metadata: z.record(z.string(), z.unknown()).default({}),
2145
+ connectionRef: McpServerConnectionRef.optional(),
1524
2146
  /**
1525
2147
  * Credential headers for remote MCP capabilities (for example an
1526
2148
  * Authorization bearer token). Values are encrypted at rest with the
1527
- * workspace-environments key, injected only into the runtime MCP client,
2149
+ * workspace-variable-sets key, injected only into the runtime MCP client,
1528
2150
  * and never returned by the API — responses expose header names only.
1529
2151
  */
1530
2152
  headers: z.record(z.string(), z.string()).default({}),
1531
2153
  /**
1532
- * Initial environment attachment for kind=pack capabilities. Mirrors the
2154
+ * Initial variableSet attachment for kind=pack capabilities. Mirrors the
1533
2155
  * dedicated POST /packs/:id/enable body: required to enable an
1534
- * environment.required pack through the unified capability-enable path,
2156
+ * variableSet.required pack through the unified capability-enable path,
1535
2157
  * optional otherwise. Ignored by non-pack capabilities.
1536
2158
  */
2159
+ variableSetId: z.string().uuid().optional(),
1537
2160
  environmentId: z.string().uuid().optional()
1538
2161
  });
1539
2162
  var CapabilityCatalogResponse = z.object({
@@ -1575,7 +2198,16 @@ var Session = z.object({
1575
2198
  // stale in-flight op and retry against the new active sandbox.
1576
2199
  activeSandboxId: z.string().uuid().nullable(),
1577
2200
  activeEpoch: z.number().int().nonnegative(),
1578
- environmentId: z.string().uuid().nullable(),
2201
+ variableSetId: z.string().uuid().nullable().default(null),
2202
+ /** @deprecated use variableSetId */
2203
+ environmentId: z.string().uuid().nullable().default(null),
2204
+ // The rig this session rides (M3 runtime binding). Both are resolved and
2205
+ // FROZEN at session create: rigId names the rig, rigVersionId pins the exact
2206
+ // active version the session's box/env/setup/doctrine are built from for the
2207
+ // session's whole life (a later promote does NOT move an existing session).
2208
+ // Both null ⇒ a rig-less session (byte-for-byte today's behavior).
2209
+ rigId: z.string().uuid().nullable().default(null),
2210
+ rigVersionId: z.string().uuid().nullable().default(null),
1579
2211
  // Non-default first-party MCP token permissions (manager-style sessions);
1580
2212
  // null means the fixed worker default set.
1581
2213
  firstPartyMcpPermissions: z.array(Permission).nullable(),
@@ -1594,9 +2226,18 @@ var Session = z.object({
1594
2226
  temporalWorkflowId: z.string().nullable(),
1595
2227
  activeTurnId: z.string().uuid().nullable(),
1596
2228
  // Actual input tokens of the last model call of the most recent turn; the
1597
- // pre-turn client-side context-compaction trigger reads it as its budget
2229
+ // pre-turn portable context-compaction trigger reads it as its budget
1598
2230
  // signal. Null until a turn with usage has completed.
1599
2231
  lastInputTokens: z.number().int().nonnegative().nullable(),
2232
+ queueVersion: z.number().int().nonnegative(),
2233
+ queueHeadPosition: z.number().int(),
2234
+ queueTailPosition: z.number().int(),
2235
+ controlState: SessionControlState,
2236
+ controlGeneration: z.number().int().nonnegative(),
2237
+ controlReason: z.string().nullable(),
2238
+ controlChangedBy: z.string().nullable(),
2239
+ controlChangedAt: z.string().nullable(),
2240
+ workspaceRunExceptionGeneration: z.number().int().nonnegative().nullable(),
1600
2241
  lastSequence: z.number().int().nonnegative(),
1601
2242
  // Multi-account Codex (P1). codexPinnedCredentialId: the account this session is
1602
2243
  // manually PINNED to (null ⇒ follow the workspace active pointer).
@@ -1604,31 +2245,76 @@ var Session = z.object({
1604
2245
  // "Running on:" indicator's source). Both are credential-row ids, null until set.
1605
2246
  codexPinnedCredentialId: z.string().uuid().nullable(),
1606
2247
  codexLastCredentialId: z.string().uuid().nullable(),
2248
+ /** Personal (authenticated subject) workspace pin state, never workspace-global. */
2249
+ pinned: z.boolean().default(false),
2250
+ /** Stable pin ordering key; null when this subject has not pinned the session. */
2251
+ pinnedAt: z.string().nullable().default(null),
2252
+ /** Optimistic pin-state revision; zero represents an absent pin relation. */
2253
+ pinVersion: z.number().int().nonnegative().default(0),
2254
+ /**
2255
+ * Server-authoritative hierarchy summary populated on session-list reads.
2256
+ * Detail reads may omit it. The rail uses this instead of guessing a tree
2257
+ * from whichever global recency page happened to be loaded.
2258
+ */
2259
+ treeStats: z.object({
2260
+ directChildren: z.number().int().nonnegative(),
2261
+ totalDescendants: z.number().int().nonnegative(),
2262
+ runningDescendants: z.number().int().nonnegative(),
2263
+ queuedDescendants: z.number().int().nonnegative(),
2264
+ attentionDescendants: z.number().int().nonnegative(),
2265
+ pausedDescendants: z.number().int().nonnegative(),
2266
+ failedDescendants: z.number().int().nonnegative()
2267
+ }).optional(),
1607
2268
  createdAt: z.string(),
1608
2269
  updatedAt: z.string()
1609
2270
  });
2271
+ var SessionListResponse = z.object({
2272
+ pinned: z.array(Session),
2273
+ sessions: z.array(Session),
2274
+ nextCursor: z.string().nullable()
2275
+ });
2276
+ var LineageNode = z.lazy(
2277
+ () => z.object({
2278
+ session: Session,
2279
+ children: z.array(LineageNode)
2280
+ })
2281
+ );
2282
+ var SessionLineageResponse = z.object({
2283
+ ancestors: z.array(Session),
2284
+ children: z.array(LineageNode),
2285
+ truncated: z.boolean().default(false)
2286
+ });
1610
2287
  var SessionEventType = z.enum([
1611
2288
  "session.created",
1612
2289
  "session.status.changed",
1613
2290
  "session.requiresAction",
2291
+ "session.context.compaction.requested",
1614
2292
  "session.context.compacted",
2293
+ "session.context.compaction.skipped",
1615
2294
  "session.context.cleared",
1616
2295
  "user.message",
1617
- "user.interrupt",
2296
+ "user.pause",
1618
2297
  "user.approvalDecision",
1619
2298
  "turn.queued",
1620
- "turn.updated",
1621
2299
  "turn.started",
1622
2300
  "turn.completed",
1623
2301
  "turn.failed",
1624
2302
  "turn.cancelled",
1625
- "turn.preempted",
2303
+ "turn.superseded",
2304
+ "turn.recovery.requested",
2305
+ "turn.capacity_waiting",
1626
2306
  "agent.message.delta",
1627
2307
  "agent.message.completed",
1628
2308
  "agent.reasoning.delta",
1629
2309
  "agent.toolCall.created",
1630
2310
  "agent.toolCall.output",
2311
+ "agent.model.usage",
2312
+ "tool.auth_needed",
1631
2313
  "agent.updated",
2314
+ "rig.setup.started",
2315
+ "rig.setup.completed",
2316
+ "rig.setup.skipped",
2317
+ "rig.setup.failed",
1632
2318
  "sandbox.operation.started",
1633
2319
  "sandbox.operation.completed",
1634
2320
  "sandbox.operation.failed",
@@ -1639,7 +2325,22 @@ var SessionEventType = z.enum([
1639
2325
  "goal.completed",
1640
2326
  "goal.paused",
1641
2327
  "goal.resumed",
2328
+ "goal.cleared",
1642
2329
  "goal.continuation",
2330
+ "system.update.pending",
2331
+ "system.update.delivered",
2332
+ "session.control.paused",
2333
+ "session.control.resumed",
2334
+ "session.control.steer_requested",
2335
+ "workspace.inference.paused",
2336
+ "workspace.inference.resumed",
2337
+ "session.queue.prompt.cancelled",
2338
+ "session.queue.history",
2339
+ // A terminal/stale activity callback is retained as an audit wrapper rather
2340
+ // than being dropped or emitted as though it belonged to the current turn.
2341
+ "turn.event.rejected_late",
2342
+ "memory.saved",
2343
+ "memory.corrected",
1643
2344
  // Channel-B desktop pixel-plane signals (07-channel-b §1.2). The pixel socket
1644
2345
  // carries opaque RFB and cannot carry a control message the client can act on,
1645
2346
  // so these ride the durable, sequenced, gap-filled Channel-A SSE spine.
@@ -1683,8 +2384,96 @@ var SessionEventType = z.enum([
1683
2384
  // Multi-account Codex (P1): the account a session's turn runs on changed
1684
2385
  // (manual switch in P1; failover/rotation in P3 reuse the same event). Drives
1685
2386
  // the in-session "Running on:" indicator's live flip.
1686
- "codex.account.switched"
2387
+ "codex.account.switched",
2388
+ // OPE-21 per-turn selection audit. Payload is metadata only: credential row
2389
+ // id, bounded strategy/reason, and pool counts — never token material.
2390
+ "codex.credential.selected",
2391
+ // OPE-21 durable zero-capacity wait lifecycle. Runtime/system events only;
2392
+ // no synthetic user message is created when capacity returns.
2393
+ "codex.capacity.waiting",
2394
+ "codex.capacity.resumed",
2395
+ "codex.capacity.superseded",
2396
+ // Sandbox durability observability (sandbox-file-persistence). The 2026-07
2397
+ // incidents (mid-session box death with /workspace loss; a fatal manifest-env
2398
+ // delta on a live box) were near-unattributable because box lifecycle left no
2399
+ // durable trace — only worker logs, which rotate within hours. These events
2400
+ // make every box transition and env recomputation drift readable from the DB
2401
+ // alone. Payloads carry ids/flags/key NAMES only — never env values (secrets).
2402
+ "sandbox.box.created",
2403
+ // box cold-created/cold-restored ({hydrated: "archive"|"none"})
2404
+ "sandbox.box.lost",
2405
+ // resume-by-id found the box gone (provider NotFound)
2406
+ "sandbox.box.terminated",
2407
+ // reaper drain terminated the box ({actor, persisted})
2408
+ "sandbox.box.snapshot",
2409
+ // mid-session /workspace snapshot persisted ({trigger})
2410
+ "sandbox.env.drift",
2411
+ // recomputed manifest env != live box env (key names only)
2412
+ // Active-sandbox pointer reconcile (issue #341 invariant B). Turn start found the
2413
+ // persisted (active_sandbox_id, active_epoch) pointing at a target the turn cannot
2414
+ // establish — a deleted/absent sandbox, a Modal sibling with no establisher, or a
2415
+ // selfhosted sandbox with no enrollment — and reset it to the session HOME under
2416
+ // the epoch fence instead of routing every op into the dead target. A VISIBLE,
2417
+ // never-silent downgrade: payload carries the typed reason + from/to epoch, never a
2418
+ // target id or command content. Announce-only; hits the timeline projection default
2419
+ // (no rendered item) like the other sandbox.* diagnostics.
2420
+ "session.route.reconciled",
2421
+ // Workbench v2 turn-end workspace capture (dossier §10.1). ANNOUNCE-ONLY: a new
2422
+ // capture revision was persisted at turn end; the client refetches the latest
2423
+ // capture. It carries metadata only (revision/turnId/capturedAt/leaseEpoch/stats),
2424
+ // never file content. Hits the timeline projection default case (ignored) — it
2425
+ // must NEVER gain a rendered timeline item without regenerating the golden
2426
+ // snapshots (dossier §7.3 golden-grammar gate).
2427
+ "workspace.revision.captured",
2428
+ // Repository discovery could not prove a complete capture. The worker
2429
+ // persisted a failed/degraded revision marker and clients must fall back to
2430
+ // the live box rather than trust a zero-repository snapshot.
2431
+ "workspace.revision.degraded",
2432
+ // Connected Machine (selfhosted) op-outcome observability (failure-visibility
2433
+ // doctrine, out-of-band plane). SESSION-scoped facts only: these fire for the
2434
+ // session whose turn ran the op (the two-planes rule — machine-plane facts like
2435
+ // pressure live in the M10 metrics DB, never as session events). Payloads carry
2436
+ // the op kind + a typed fault class + attempt count — NEVER command content.
2437
+ //
2438
+ // `machine.op.failed` fires ONLY for INFRASTRUCTURE fault classes (offline,
2439
+ // draining-exhausted, payload-too-large, reconnecting-timeout, OS/stream/protocol)
2440
+ // — a semantic miss the model asked about (a missing path, a consent gate, a
2441
+ // nonzero exit) is an OUTCOME, not an infra fault, and never fires this.
2442
+ // `machine.op.recovered` is the healed-fault leading indicator (a blip/backpressure
2443
+ // the transport absorbed): announce-only, quiet. Both hit the timeline projection's
2444
+ // quiet status-tick tier (the severity split's "degraded"); adding a rendered item
2445
+ // requires regenerating the golden snapshots (the golden-grammar gate).
2446
+ "machine.op.failed",
2447
+ "machine.op.recovered",
2448
+ // Connected Machine (selfhosted) LINK-plane observability (failure-visibility
2449
+ // doctrine). SESSION-scoped, ANNOUNCE-ONLY facts fanned out to the sessions that
2450
+ // had an active op running on the machine when its control link changed — never
2451
+ // to idle/historical sessions. Payloads carry ids / a typed reason / key-names
2452
+ // only, NEVER command content.
2453
+ //
2454
+ // `machine.link.lost` — the machine announced a clean GoingOffline (its control
2455
+ // link is going away) while a session had a running turn on it. `machine.link.
2456
+ // restored` — a reconnect Hello re-established the link that was previously lost.
2457
+ // `machine.runner.restarted` — the additional signal that the going-offline was
2458
+ // a self-update restart specifically (link.lost also fires for it; this
2459
+ // distinguishes a restart from a plain stop / host shutdown). All three hit the
2460
+ // timeline projection's quiet default tier (no rendered item); adding a rendered
2461
+ // item requires regenerating the golden snapshots (the golden-grammar gate).
2462
+ "machine.link.lost",
2463
+ "machine.link.restored",
2464
+ "machine.runner.restarted"
1687
2465
  ]);
2466
+ var ToolAuthNeededPayload = z.object({
2467
+ serverId: z.string().min(1),
2468
+ toolName: z.string().min(1).nullable().optional(),
2469
+ providerDomain: z.string().min(1),
2470
+ connectionId: z.string().uuid().nullable().optional(),
2471
+ reason: z.enum(["missing_connection", "expired", "insufficient_scope", "refresh_failed"]),
2472
+ scopes: z.array(z.string().min(1)).optional(),
2473
+ resource: z.string().min(1).optional(),
2474
+ authorizationUrl: z.string().url().optional(),
2475
+ subjectId: z.string().min(1).nullable().optional()
2476
+ });
1688
2477
  var StreamUrlRotatedPayload = z.object({
1689
2478
  url: z.string().url(),
1690
2479
  token: z.string().nullable(),
@@ -1766,15 +2555,17 @@ var SandboxCommandOutputDeltaPayload = z.object({
1766
2555
  });
1767
2556
  var FsChangeKind = z.enum(["created", "modified", "deleted", "renamed"]);
1768
2557
  var FsChangedPayload = z.object({
1769
- changes: z.array(z.object({
1770
- path: z.string(),
1771
- // workspace-relative POSIX path
1772
- kind: FsChangeKind,
1773
- isDir: z.boolean().default(false),
1774
- sizeBytes: z.number().int().nonnegative().nullable().default(null),
1775
- oldPath: z.string().optional()
1776
- // for "renamed"
1777
- })).min(1),
2558
+ changes: z.array(
2559
+ z.object({
2560
+ path: z.string(),
2561
+ // workspace-relative POSIX path
2562
+ kind: FsChangeKind,
2563
+ isDir: z.boolean().default(false),
2564
+ sizeBytes: z.number().int().nonnegative().nullable().default(null),
2565
+ oldPath: z.string().optional()
2566
+ // for "renamed"
2567
+ })
2568
+ ).min(1),
1778
2569
  source: z.enum(["write", "watch", "agent"]).default("write"),
1779
2570
  // Monotonic FS revision (per-lease, paired with leaseEpoch for staleness).
1780
2571
  revision: z.number().int().nonnegative(),
@@ -1817,16 +2608,18 @@ var TerminalPtyExitedPayload = z.object({
1817
2608
  reason: z.enum(["exit", "killed", "owner_gone", "timeout"])
1818
2609
  });
1819
2610
  var FsNodeType = z.enum(["file", "dir", "symlink", "other"]);
1820
- var FsTreeNode = z.lazy(() => z.object({
1821
- name: z.string(),
1822
- path: z.string(),
1823
- type: FsNodeType,
1824
- sizeBytes: z.number().int().nonnegative().nullable(),
1825
- mtimeMs: z.number().int().nonnegative().nullable(),
1826
- mode: z.number().int().nullable(),
1827
- children: z.array(FsTreeNode).optional(),
1828
- truncated: z.boolean().default(false)
1829
- }));
2611
+ var FsTreeNode = z.lazy(
2612
+ () => z.object({
2613
+ name: z.string(),
2614
+ path: z.string(),
2615
+ type: FsNodeType,
2616
+ sizeBytes: z.number().int().nonnegative().nullable(),
2617
+ mtimeMs: z.number().int().nonnegative().nullable(),
2618
+ mode: z.number().int().nullable(),
2619
+ children: z.array(FsTreeNode).optional(),
2620
+ truncated: z.boolean().default(false)
2621
+ })
2622
+ );
1830
2623
  var FsListRequest = z.object({
1831
2624
  path: z.string().default(""),
1832
2625
  // "" = workspace root
@@ -1985,6 +2778,125 @@ var GitDiffResponse = z.object({
1985
2778
  files: z.array(GitFileDiff),
1986
2779
  revision: z.number().int().nonnegative()
1987
2780
  });
2781
+ var WorkspaceCaptureFile = z.object({
2782
+ path: z.string(),
2783
+ status: GitFileStatusCode,
2784
+ // sha256 of the captured after-image bytes; null when deleted / tooLarge.
2785
+ hash: z.string().nullable(),
2786
+ // git blob sha of the HEAD version — the wake-on-edit flush guard (dossier
2787
+ // §10.1). null when the path is new/untracked (no HEAD blob).
2788
+ baseHash: z.string().nullable(),
2789
+ // Content-addressed storage key of the after-image; null when deleted /
2790
+ // tooLarge / binary (no inline content captured).
2791
+ contentRef: z.string().nullable(),
2792
+ sizeBytes: z.number().int().nonnegative(),
2793
+ isBinary: z.boolean().default(false),
2794
+ // >5MB per-file content guard tripped: content NOT captured, render "open live".
2795
+ tooLarge: z.boolean().default(false),
2796
+ deleted: z.boolean().default(false)
2797
+ });
2798
+ var WorkspaceCaptureRepo = z.object({
2799
+ root: z.string(),
2800
+ head: z.string().nullable(),
2801
+ detached: z.boolean().default(false),
2802
+ upstream: z.string().nullable(),
2803
+ ahead: z.number().int().nonnegative().default(0),
2804
+ behind: z.number().int().nonnegative().default(0),
2805
+ status: z.array(GitFileStatus),
2806
+ diff: z.array(GitFileDiff)
2807
+ });
2808
+ var WorkspaceCaptureDegradedReason = z.enum([
2809
+ "repository_discovery_command_failed",
2810
+ "repository_discovery_timed_out",
2811
+ "repository_discovery_result_limit_exceeded"
2812
+ ]);
2813
+ var WorkspaceCaptureStats = z.object({
2814
+ repoCount: z.number().int().nonnegative(),
2815
+ fileCount: z.number().int().nonnegative(),
2816
+ additions: z.number().int().nonnegative(),
2817
+ deletions: z.number().int().nonnegative(),
2818
+ totalBytes: z.number().int().nonnegative(),
2819
+ tooLargeCount: z.number().int().nonnegative(),
2820
+ binaryCount: z.number().int().nonnegative(),
2821
+ treeEntryCount: z.number().int().nonnegative(),
2822
+ treeTruncated: z.boolean().default(false),
2823
+ durationMs: z.number().int().nonnegative(),
2824
+ // sha256 over the change surface (per-file path/hash/status + per-repo diff
2825
+ // summary, tree/mtime excluded). The empty-turn gate skips a capture whose
2826
+ // fingerprint equals the previous revision's — "no new revision when nothing
2827
+ // changed" holds even when the tree stays dirty across read-only turns.
2828
+ fingerprint: z.string().optional()
2829
+ });
2830
+ var WorkspaceCaptureManifest = z.object({
2831
+ version: z.literal(1),
2832
+ revision: z.number().int().nonnegative(),
2833
+ capturedAt: z.string(),
2834
+ turnId: z.string().nullable(),
2835
+ leaseEpoch: z.number().int().nonnegative(),
2836
+ treeIndex: FsTreeNode,
2837
+ treeTruncated: z.boolean().default(false),
2838
+ repos: z.array(WorkspaceCaptureRepo),
2839
+ files: z.array(WorkspaceCaptureFile),
2840
+ stats: WorkspaceCaptureStats
2841
+ });
2842
+ var WorkspaceRevisionCapturedPayload = z.object({
2843
+ revision: z.number().int().nonnegative(),
2844
+ turnId: z.string().nullable(),
2845
+ capturedAt: z.string(),
2846
+ leaseEpoch: z.number().int().nonnegative(),
2847
+ stats: WorkspaceCaptureStats
2848
+ });
2849
+ var WorkspaceRevisionDegradedPayload = z.object({
2850
+ revision: z.number().int().nonnegative(),
2851
+ turnId: z.string().nullable(),
2852
+ capturedAt: z.string(),
2853
+ leaseEpoch: z.number().int().nonnegative(),
2854
+ reason: WorkspaceCaptureDegradedReason
2855
+ });
2856
+ var WorkspaceCaptureSignedUrl = z.object({
2857
+ url: z.string().url(),
2858
+ expiresAt: z.string()
2859
+ });
2860
+ var GetWorkspaceCaptureResponse = z.discriminatedUnion("available", [
2861
+ z.object({
2862
+ available: z.literal(false),
2863
+ // Optional for additive compatibility with older servers. New servers set
2864
+ // these fields when the newest durable revision is an explicit degraded
2865
+ // marker rather than "no capture exists yet".
2866
+ degradedReason: WorkspaceCaptureDegradedReason.nullable().optional(),
2867
+ revision: z.number().int().nonnegative().nullable().optional(),
2868
+ capturedAt: z.string().nullable().optional(),
2869
+ turnId: z.string().nullable().optional(),
2870
+ leaseEpoch: z.number().int().nonnegative().nullable().optional()
2871
+ }),
2872
+ z.object({
2873
+ available: z.literal(true),
2874
+ revision: z.number().int().nonnegative(),
2875
+ capturedAt: z.string(),
2876
+ turnId: z.string().nullable(),
2877
+ leaseEpoch: z.number().int().nonnegative(),
2878
+ sizeBytes: z.number().int().nonnegative(),
2879
+ stats: WorkspaceCaptureStats,
2880
+ manifest: WorkspaceCaptureManifest.nullable().default(null),
2881
+ manifestUrl: WorkspaceCaptureSignedUrl.nullable().default(null)
2882
+ })
2883
+ ]);
2884
+ var GetWorkspaceCaptureFileResponse = z.object({
2885
+ path: z.string(),
2886
+ revision: z.number().int().nonnegative(),
2887
+ status: GitFileStatusCode,
2888
+ hash: z.string().nullable(),
2889
+ baseHash: z.string().nullable(),
2890
+ sizeBytes: z.number().int().nonnegative(),
2891
+ isBinary: z.boolean(),
2892
+ tooLarge: z.boolean(),
2893
+ encoding: FsEncoding.nullable().default(null),
2894
+ // set iff content is inline
2895
+ content: z.string().nullable().default(null),
2896
+ // inline ≤256KB (per encoding)
2897
+ contentUrl: WorkspaceCaptureSignedUrl.nullable().default(null)
2898
+ // signed >256KB
2899
+ });
1988
2900
  var GitLogRequest = z.object({
1989
2901
  path: z.string().default(""),
1990
2902
  ref: z.string().default("HEAD"),
@@ -2018,7 +2930,12 @@ var GitShowResponse = z.object({
2018
2930
  // null when fetching a raw blob
2019
2931
  files: z.array(GitFileDiff),
2020
2932
  // commit diff vs first parent
2021
- blob: z.object({ content: z.string(), encoding: FsEncoding, sizeBytes: z.number().int(), truncated: z.boolean() }).nullable(),
2933
+ blob: z.object({
2934
+ content: z.string(),
2935
+ encoding: FsEncoding,
2936
+ sizeBytes: z.number().int(),
2937
+ truncated: z.boolean()
2938
+ }).nullable(),
2022
2939
  revision: z.number().int().nonnegative()
2023
2940
  });
2024
2941
  var TerminalExecRequest = z.object({
@@ -2056,7 +2973,11 @@ var PtyOpenResponse = z.object({
2056
2973
  // false on backends without writeStdin
2057
2974
  });
2058
2975
  var PtyWriteRequest = z.object({ ptyId: z.string().uuid(), data: z.string() });
2059
- var PtyResizeRequest = z.object({ ptyId: z.string().uuid(), cols: z.number().int().positive(), rows: z.number().int().positive() });
2976
+ var PtyResizeRequest = z.object({
2977
+ ptyId: z.string().uuid(),
2978
+ cols: z.number().int().positive(),
2979
+ rows: z.number().int().positive()
2980
+ });
2060
2981
  var PtyCloseRequest = z.object({ ptyId: z.string().uuid() });
2061
2982
  var SessionStructuredCapabilities = z.object({
2062
2983
  FileSystem: z.object({ available: z.boolean(), readOnly: z.boolean(), root: z.string() }),
@@ -2079,9 +3000,31 @@ var SessionEvent = z.object({
2079
3000
  payload: z.unknown().default({}),
2080
3001
  occurredAt: z.string(),
2081
3002
  clientEventId: z.string().min(1).nullable().optional(),
2082
- turnId: z.string().uuid().nullable().optional()
2083
- });
2084
- var CreateSessionRequest = z.object({
3003
+ turnId: z.string().uuid().nullable().optional(),
3004
+ turnGeneration: z.number().int().nonnegative().nullable().optional(),
3005
+ turnAttemptId: z.string().uuid().nullable().optional(),
3006
+ turnAssociation: z.enum(["current", "late_rejected", "duplicate"]).nullable().optional(),
3007
+ duplicateOfEventId: z.string().uuid().nullable().optional(),
3008
+ duplicateReason: z.string().min(1).nullable().optional()
3009
+ });
3010
+ var SessionQueueMutationResponse = z.object({
3011
+ snapshot: SessionQueueSnapshot,
3012
+ events: z.array(SessionEvent),
3013
+ shouldWake: z.boolean()
3014
+ });
3015
+ var SessionControlResponse = z.object({
3016
+ operationId: z.string().uuid(),
3017
+ event: SessionEvent,
3018
+ controlState: SessionControlState,
3019
+ controlGeneration: z.number().int().nonnegative(),
3020
+ expectedActiveTurnId: z.string().uuid().nullable(),
3021
+ expectedExecutionGeneration: z.number().int().nonnegative().nullable(),
3022
+ expectedAttemptId: z.string().uuid().nullable(),
3023
+ deliveryEventId: z.string().uuid().nullable(),
3024
+ shouldSignalControl: z.boolean(),
3025
+ shouldWake: z.boolean()
3026
+ });
3027
+ var CreateSessionRequest = withVariableSetIdAlias({
2085
3028
  initialMessage: z.string().min(1),
2086
3029
  // Per-session agent persona/system instructions (org-visible metadata, NOT a
2087
3030
  // secret). Rides the SAME system-level instructions channel the per-workspace
@@ -2090,7 +3033,7 @@ var CreateSessionRequest = z.object({
2090
3033
  // leaking them into the user-visible timeline (it is NEVER emitted as an
2091
3034
  // event, unlike goal/initialMessage). Trimmed, non-empty. The 32768-char cap
2092
3035
  // matches the codebase's largest free-form string convention (workspace
2093
- // environment variable values). Absent ⇒ byte-identical to today.
3036
+ // variable set variable values). Absent ⇒ byte-identical to today.
2094
3037
  instructions: z.string().trim().min(1).max(32768).optional(),
2095
3038
  resources: z.array(ResourceRef).default([]),
2096
3039
  tools: z.array(ToolRef).default([]),
@@ -2109,9 +3052,15 @@ var CreateSessionRequest = z.object({
2109
3052
  // (the agent's resolve_cwd handles both). Only valid WITH targetSandboxId
2110
3053
  // (workingDir alone is a 422); omitted ⇒ the machine's default workspace_root.
2111
3054
  workingDir: z.string().min(1).optional(),
2112
- // Workspace environment attachment is fixed at session creation; follow-up
3055
+ // Variable set attachment is fixed at session creation; follow-up
2113
3056
  // user.message events cannot switch or add one.
3057
+ variableSetId: z.string().uuid().optional(),
2114
3058
  environmentId: z.string().uuid().optional(),
3059
+ // The rig to bind this session to (M3). Its ACTIVE version is resolved and
3060
+ // FROZEN onto the session at create. Omitted ⇒ the workspace's default rig
3061
+ // (workspaces.default_rig_id) when set, else a rig-less session (today's
3062
+ // behavior). An id that does not name a rig in the workspace is a 422.
3063
+ rigId: z.string().uuid().optional(),
2115
3064
  goal: GoalSpec.optional(),
2116
3065
  clientEventId: z.string().min(1).optional(),
2117
3066
  // Workspace-scoped CREATE idempotency key: collapses concurrent/retried
@@ -2123,7 +3072,7 @@ var CreateSessionRequest = z.object({
2123
3072
  idempotencyKey: z.string().min(1).max(200).optional(),
2124
3073
  // Permissions the session's first-party MCP token should carry instead of
2125
3074
  // the fixed worker default — how an operator hands a manager-style session
2126
- // the orchestration/environment/github tools. Capped at creation: every
3075
+ // the orchestration/variableSet/github tools. Capped at creation: every
2127
3076
  // requested permission must be held by the creating grant (no escalation).
2128
3077
  firstPartyMcpPermissions: z.array(Permission).optional(),
2129
3078
  // Third-party MCP servers attached only to this session. Credential headers are
@@ -2141,16 +3090,12 @@ var CreateSessionRequest = z.object({
2141
3090
  // A shared spawn inherits the box's (backend, os) — it is literally the same
2142
3091
  // box; the child cannot pick its own backend. Cross-workspace sharing is
2143
3092
  // forbidden by construction (the parent/group reads are RLS-workspace-scoped).
2144
- // ENV-AWARE: the box's environment is fixed at creation, so a share requires
2145
- // the SAME environmentId as the creator's box. On a mismatch the inherited
3093
+ // ENV-AWARE: the box's variable set is fixed at creation, so a share requires
3094
+ // the SAME variableSetId as the creator's box. On a mismatch the inherited
2146
3095
  // default silently falls back to an own box; an explicit "shared"/{groupId}
2147
3096
  // request 422s at create (instead of the first turn dying on the SDK's
2148
3097
  // manifest-env guard).
2149
- sandbox: z.union([
2150
- z.literal("shared"),
2151
- z.literal("new"),
2152
- z.object({ groupId: z.string().uuid() })
2153
- ]).optional()
3098
+ sandbox: z.union([z.literal("shared"), z.literal("new"), z.object({ groupId: z.string().uuid() })]).optional()
2154
3099
  });
2155
3100
  var ClientSessionEvent = z.discriminatedUnion("type", [
2156
3101
  z.object({
@@ -2167,11 +3112,6 @@ var ClientSessionEvent = z.discriminatedUnion("type", [
2167
3112
  mcpCredentialUpdates: z.array(SessionMcpCredentialUpdateInput).optional()
2168
3113
  })
2169
3114
  }),
2170
- z.object({
2171
- type: z.literal("user.interrupt"),
2172
- clientEventId: z.string().min(1).optional(),
2173
- payload: z.object({ reason: z.string().optional() }).default({})
2174
- }),
2175
3115
  z.object({
2176
3116
  type: z.literal("user.approvalDecision"),
2177
3117
  clientEventId: z.string().min(1).optional(),
@@ -2182,6 +3122,21 @@ var ClientSessionEvent = z.discriminatedUnion("type", [
2182
3122
  })
2183
3123
  })
2184
3124
  ]);
3125
+ var SteerSessionMessageRequest = z.object({
3126
+ text: z.string().min(1),
3127
+ resources: z.array(ResourceRef).default([]),
3128
+ tools: z.array(ToolRef).default([]),
3129
+ model: z.string().min(1).optional(),
3130
+ reasoningEffort: ReasoningEffort.optional(),
3131
+ clientEventId: z.string().min(1).optional(),
3132
+ expectedControlGeneration: z.number().int().nonnegative().optional(),
3133
+ expectedWorkspaceInferenceGeneration: z.number().int().nonnegative().optional(),
3134
+ mcpCredentialUpdates: z.array(SessionMcpCredentialUpdateInput).optional()
3135
+ });
3136
+ var SteerSessionMessageResponse = z.object({
3137
+ accepted: SessionEvent,
3138
+ turn: SessionTurn
3139
+ });
2185
3140
  var SessionBusMessage = z.object({
2186
3141
  workspaceId: z.string().uuid(),
2187
3142
  sessionId: z.string().uuid(),
@@ -2400,7 +3355,13 @@ var DeviceEnrollmentApproveResponse = z.object({
2400
3355
  var DeviceEnrollmentPollRequest = z.object({
2401
3356
  deviceCode: z.string().min(1).max(256)
2402
3357
  });
2403
- var DeviceEnrollmentState = z.enum(["pending", "authorized", "denied", "expired", "disabled"]);
3358
+ var DeviceEnrollmentState = z.enum([
3359
+ "pending",
3360
+ "authorized",
3361
+ "denied",
3362
+ "expired",
3363
+ "disabled"
3364
+ ]);
2404
3365
  var EnrollmentCredentialsResponse = z.object({
2405
3366
  agentId: z.string().uuid(),
2406
3367
  workspaceId: z.string().uuid(),
@@ -2441,6 +3402,11 @@ var EnrollmentSummary = z.object({
2441
3402
  pubkey: z.string(),
2442
3403
  exposure: z.literal("whole-machine"),
2443
3404
  hasDisplay: z.boolean(),
3405
+ // Present (non-null) only when a display EXISTS but capture is blocked (macOS
3406
+ // Screen Recording / TCC not granted): a human, actionable reason so the UI can
3407
+ // show "display: capture not granted" instead of a bare "headless". null == capture
3408
+ // permitted OR genuinely headless.
3409
+ desktopUnavailableReason: z.string().nullish(),
2444
3410
  allowScreenControl: z.boolean(),
2445
3411
  status: z.enum(["active", "revoked"]),
2446
3412
  os: EnrollmentOs,
@@ -2537,6 +3503,10 @@ var MachineView = z.object({
2537
3503
  os: z.string(),
2538
3504
  arch: z.string(),
2539
3505
  hasDisplay: z.boolean(),
3506
+ // Non-null only when a display exists but capture is blocked (macOS Screen
3507
+ // Recording / TCC not granted) — the UI can surface "display: capture not granted".
3508
+ // null == capture permitted OR headless.
3509
+ desktopUnavailableReason: z.string().nullish(),
2540
3510
  allowScreenControl: z.boolean(),
2541
3511
  sharedSessionCount: z.number().int(),
2542
3512
  lastSeenAt: z.string().nullable(),
@@ -2554,7 +3524,18 @@ var SwapActiveSandboxResponse = z.object({
2554
3524
  swapped: z.boolean(),
2555
3525
  activeSandboxId: z.string().nullable(),
2556
3526
  activeEpoch: z.number().int(),
2557
- reason: z.string().optional()
3527
+ reason: z.string().optional(),
3528
+ // Typed rejection discriminant (issue #341). Present only when swapped is false,
3529
+ // so a client distinguishes a deleted/absent target from an unaddressable
3530
+ // enrollment from a backend the turn cannot establish from a lost epoch race —
3531
+ // without parsing the human reason string.
3532
+ code: z.enum([
3533
+ "stale_pointer",
3534
+ "offline_enrollment",
3535
+ "unsupported_backend_context",
3536
+ "transient_establishment",
3537
+ "concurrent_swap"
3538
+ ]).optional()
2558
3539
  });
2559
3540
  var MachineMetricsSeriesResponse = z.object({
2560
3541
  samples: z.array(MetricSample)
@@ -2581,10 +3562,12 @@ var ClientConfig = z.object({
2581
3562
  models: z.array(ClientModel).default([]),
2582
3563
  defaultReasoningEffort: ReasoningEffort,
2583
3564
  allowedReasoningEfforts: z.array(ReasoningEffort).min(1),
2584
- mcpServers: z.array(z.object({
2585
- id: z.string(),
2586
- name: z.string()
2587
- })).default([]),
3565
+ mcpServers: z.array(
3566
+ z.object({
3567
+ id: z.string(),
3568
+ name: z.string()
3569
+ })
3570
+ ).default([]),
2588
3571
  fileUploads: z.object({
2589
3572
  enabled: z.boolean(),
2590
3573
  maxSizeBytes: z.number().int().positive()
@@ -2630,6 +3613,18 @@ function constantTimeEqual(actual, expected) {
2630
3613
  }
2631
3614
  return diff === 0;
2632
3615
  }
3616
+ function evaluateWorkspaceModelPolicy(policy, candidate) {
3617
+ if (!policy) {
3618
+ return { allowed: true };
3619
+ }
3620
+ if (policy.allowedProviders !== null && !policy.allowedProviders.includes(candidate.providerId)) {
3621
+ return { allowed: false, reason: "provider" };
3622
+ }
3623
+ if (policy.allowedModels !== null && !policy.allowedModels.includes(candidate.modelId)) {
3624
+ return { allowed: false, reason: "model" };
3625
+ }
3626
+ return { allowed: true };
3627
+ }
2633
3628
  export {
2634
3629
  AccessContext,
2635
3630
  AccessGrant,
@@ -2646,8 +3641,11 @@ export {
2646
3641
  CAPABILITY_DESCRIPTORS,
2647
3642
  CLEARED_RUN_STATE_BLOB,
2648
3643
  CLEARED_RUN_STATE_MARKER,
3644
+ CancelSessionQueueItemRequest,
3645
+ CapabilityCatalogAuthKind,
2649
3646
  CapabilityCatalogItem,
2650
3647
  CapabilityCatalogResponse,
3648
+ CapabilityCatalogTier,
2651
3649
  CapabilityInstallation,
2652
3650
  CapabilityInstallationStatus,
2653
3651
  CapabilityKind,
@@ -2669,18 +3667,27 @@ export {
2669
3667
  CompactSessionContextRequest,
2670
3668
  CompactSessionContextResult,
2671
3669
  CompleteFileUploadResponse,
3670
+ ConnectionCredentialBundle,
3671
+ ConnectionKind,
3672
+ ConnectionMetadata,
3673
+ ConnectionResponse,
3674
+ ConnectionStatus,
2672
3675
  CreateApiKeyRequest,
2673
3676
  CreateApiKeyResponse,
2674
3677
  CreateCapabilityCatalogItemRequest,
2675
3678
  CreateCheckoutRequest,
2676
3679
  CreateCheckoutResponse,
3680
+ CreateConnectionRequest,
2677
3681
  CreateDocumentBaseRequest,
2678
3682
  CreateFileUploadRequest,
2679
3683
  CreateFileUploadResponse,
3684
+ CreateKnowledgeMemoryRequest,
3685
+ CreateRigRequest,
2680
3686
  CreateScheduledTaskRequest,
2681
3687
  CreateSessionRequest,
2682
3688
  CreateSocialConnectionRequest,
2683
3689
  CreateSocialPostRequest,
3690
+ CreateVariableSetRequest,
2684
3691
  CreateWorkspaceEnvironmentRequest,
2685
3692
  CreateWorkspaceRequest,
2686
3693
  DESKTOP_STREAM_PORT,
@@ -2700,6 +3707,7 @@ export {
2700
3707
  DiscoverMcpCapabilitiesResponse,
2701
3708
  Document,
2702
3709
  DocumentBase,
3710
+ DocumentSearchMode,
2703
3711
  DocumentSearchRequest,
2704
3712
  DocumentSearchResult,
2705
3713
  DocumentStatus,
@@ -2741,8 +3749,12 @@ export {
2741
3749
  FsTreeNode,
2742
3750
  FsWriteRequest,
2743
3751
  FsWriteResponse,
3752
+ GetWorkspaceCaptureFileResponse,
3753
+ GetWorkspaceCaptureResponse,
2744
3754
  GitChangedPayload,
2745
3755
  GitCommit,
3756
+ GitCredentialProvider,
3757
+ GitCredentialRepositoryRef,
2746
3758
  GitDiffHunk,
2747
3759
  GitDiffLine,
2748
3760
  GitDiffLineType,
@@ -2760,8 +3772,17 @@ export {
2760
3772
  GitStatusRequest,
2761
3773
  GitStatusResponse,
2762
3774
  GoalSpec,
3775
+ IntegrationClientMetadata,
3776
+ KnowledgeMemory,
3777
+ KnowledgeMemoryKind,
3778
+ KnowledgeMemorySearchRequest,
3779
+ KnowledgeMemoryStatus,
3780
+ KnowledgeSourceKind,
3781
+ KnowledgeSourceRef,
2763
3782
  LimitAction,
2764
3783
  LimitDecision,
3784
+ LineageNode,
3785
+ ListConnectionsResponse,
2765
3786
  ListEnrollmentsResponse,
2766
3787
  ListWorkspaceMembersResponse,
2767
3788
  MachineKind,
@@ -2771,13 +3792,17 @@ export {
2771
3792
  MachinesResponse,
2772
3793
  ManagedAccount,
2773
3794
  MarketingDailyAnalysisTaskRequest,
3795
+ McpServerConnectionRef,
2774
3796
  MetricSample,
2775
3797
  MintEnrollTokenRequest,
2776
3798
  MintEnrollTokenResponse,
3799
+ OAuthStartRequest,
3800
+ OAuthStartResponse,
2777
3801
  PackInstallation,
2778
3802
  PackInstallationStatus,
2779
3803
  Permission,
2780
3804
  ProductAccessMode,
3805
+ ProposeRigChangeRequest,
2781
3806
  PtyCloseRequest,
2782
3807
  PtyOpenRequest,
2783
3808
  PtyOpenResponse,
@@ -2793,11 +3818,21 @@ export {
2793
3818
  RecordingStartedPayload,
2794
3819
  RegisterCapabilityPackRequest,
2795
3820
  RelayTokenPayload,
2796
- ReorderSessionTurnsRequest,
2797
3821
  RepositoryResourceRef,
2798
3822
  ResourceRef,
2799
3823
  ResourceRefConflictError,
2800
3824
  RevokeEnrollmentResponse,
3825
+ Rig,
3826
+ RigChange,
3827
+ RigChangeKind,
3828
+ RigChangeStatus,
3829
+ RigChangeVerification,
3830
+ RigCheck,
3831
+ RigCheckResult,
3832
+ RigDefinitionEditPayload,
3833
+ RigSetupAppendPayload,
3834
+ RigVerificationHealth,
3835
+ RigVersion,
2801
3836
  SandboxBackend,
2802
3837
  SandboxCapabilityName,
2803
3838
  SandboxCommandOutputDeltaPayload,
@@ -2814,26 +3849,40 @@ export {
2814
3849
  Session,
2815
3850
  SessionBusMessage,
2816
3851
  SessionCapabilities,
3852
+ SessionControlRequest,
3853
+ SessionControlResponse,
3854
+ SessionControlState,
2817
3855
  SessionEvent,
2818
3856
  SessionEventType,
2819
3857
  SessionGoal,
2820
3858
  SessionGoalCreatedBy,
2821
3859
  SessionGoalPausedReason,
2822
3860
  SessionGoalStatus,
3861
+ SessionLineageResponse,
3862
+ SessionListResponse,
2823
3863
  SessionMcpCredentialUpdateInput,
2824
3864
  SessionMcpServerInput,
2825
3865
  SessionMcpServerMetadata,
3866
+ SessionQueueMutationResponse,
3867
+ SessionQueueSnapshot,
2826
3868
  SessionStatus,
2827
3869
  SessionStructuredCapabilities,
3870
+ SessionSystemUpdate,
3871
+ SessionSystemUpdateKind,
3872
+ SessionSystemUpdateState,
2828
3873
  SessionTurn,
2829
3874
  SessionTurnSource,
2830
3875
  SessionTurnStatus,
3876
+ SetVariableSetVariableRequest,
3877
+ SetWorkspaceDefaultRigRequest,
2831
3878
  SetWorkspaceEnvironmentVariableRequest,
2832
3879
  SocialConnection,
2833
3880
  SocialConnectionStatus,
2834
3881
  SocialPost,
2835
3882
  SocialProvider,
2836
3883
  StaticUsageLimits,
3884
+ SteerSessionMessageRequest,
3885
+ SteerSessionMessageResponse,
2837
3886
  StreamClosedPayload,
2838
3887
  StreamOpenedPayload,
2839
3888
  StreamRevokedPayload,
@@ -2841,37 +3890,66 @@ export {
2841
3890
  StreamUrlRotatedPayload,
2842
3891
  SwapActiveSandboxRequest,
2843
3892
  SwapActiveSandboxResponse,
3893
+ SystemUpdateClassification,
2844
3894
  TERMINAL_STREAM_PORT,
2845
3895
  TerminalExecRequest,
2846
3896
  TerminalExecResponse,
2847
3897
  TerminalPtyExitedPayload,
2848
3898
  TerminalPtyOutputDeltaPayload,
2849
3899
  TerminalPtyStartedPayload,
3900
+ ToolAuthNeededPayload,
2850
3901
  ToolRef,
2851
3902
  TriggerScheduledTaskRequest,
3903
+ UpdateConnectionRequest,
3904
+ UpdateKnowledgeMemoryRequest,
3905
+ UpdateRigRequest,
2852
3906
  UpdateScheduledTaskRequest,
2853
3907
  UpdateSessionGoalRequest,
3908
+ UpdateSessionPinRequest,
2854
3909
  UpdateSessionRequest,
2855
- UpdateSessionTurnRequest,
3910
+ UpdateVariableSetRequest,
2856
3911
  UpdateWorkspaceEnvironmentRequest,
2857
3912
  UpdateWorkspaceMemberRequest,
3913
+ UpdateWorkspaceModelPolicyRequest,
2858
3914
  UpdateWorkspaceRequest,
3915
+ UpdateWorkspaceSettingsRequest,
2859
3916
  UsageEvent,
2860
3917
  UsageEventType,
2861
3918
  UsageLimitsMode,
3919
+ VariableSet,
3920
+ VariableSetVariableMetadata,
3921
+ VariableSetVariableName,
2862
3922
  ViewerHeartbeatRequest,
2863
3923
  ViewerHeartbeatResponse,
2864
3924
  ViewerHolder,
2865
3925
  Workspace,
3926
+ WorkspaceCaptureDegradedReason,
3927
+ WorkspaceCaptureFile,
3928
+ WorkspaceCaptureManifest,
3929
+ WorkspaceCaptureRepo,
3930
+ WorkspaceCaptureSignedUrl,
3931
+ WorkspaceCaptureStats,
2866
3932
  WorkspaceEnvironment,
2867
3933
  WorkspaceEnvironmentVariableMetadata,
2868
- WorkspaceEnvironmentVariableName,
3934
+ WorkspaceInferenceControlRequest,
3935
+ WorkspaceInferenceControlResponse,
3936
+ WorkspaceInferenceState,
2869
3937
  WorkspaceMember,
3938
+ WorkspaceMemorySearchMode,
3939
+ WorkspaceMemorySearchRequest,
3940
+ WorkspaceMemorySearchResponse,
3941
+ WorkspaceMemorySearchResult,
2870
3942
  WorkspaceRegisteredPack,
3943
+ WorkspaceRevisionCapturedPayload,
3944
+ WorkspaceRevisionDegradedPayload,
3945
+ WorkspaceSettingsSchema,
3946
+ evaluateWorkspaceModelPolicy,
2871
3947
  isClearedRunStateBlob,
2872
3948
  mergeResourceRefs,
2873
3949
  mergeToolRefs,
3950
+ prefixedMcpToolName,
2874
3951
  reasoningEffortForMetadata,
3952
+ resolveWorkspaceMemoryEnabled,
2875
3953
  resourceIdentityKey,
2876
3954
  signDelegatedAccessToken,
2877
3955
  signEnrollToken,