@opengeni/contracts 0.44.1 → 0.50.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.
Files changed (49) hide show
  1. package/dist/atlassian.js +10 -8
  2. package/dist/canonical-human-identities.d.ts +157 -0
  3. package/dist/canonical-human-identities.js +23 -0
  4. package/dist/canonical-human-identities.js.map +1 -0
  5. package/dist/chunk-CM6BMECR.js +24 -0
  6. package/dist/chunk-CM6BMECR.js.map +1 -0
  7. package/dist/{chunk-FJBG5E4O.js → chunk-JBCIY7QD.js} +12 -12
  8. package/dist/chunk-JUFK3T4Q.js +80 -0
  9. package/dist/chunk-JUFK3T4Q.js.map +1 -0
  10. package/dist/{chunk-H5BVCZKF.js → chunk-LW7OH6CS.js} +2 -2
  11. package/dist/{chunk-52SGB2QO.js → chunk-M5ZGRVIQ.js} +37 -6
  12. package/dist/chunk-M5ZGRVIQ.js.map +1 -0
  13. package/dist/{chunk-VA22KRHS.js → chunk-Q6A7XT2N.js} +6371 -4814
  14. package/dist/chunk-Q6A7XT2N.js.map +1 -0
  15. package/dist/codex-provider-account-authority.d.ts +23 -0
  16. package/dist/codex-provider-account-authority.js +23 -0
  17. package/dist/codex-provider-account-authority.js.map +1 -0
  18. package/dist/editable-artifact-codec-registry.js +5 -5
  19. package/dist/editable-artifact-live.js +3 -3
  20. package/dist/editable-artifact-serialized-commit.js +4 -4
  21. package/dist/editable-artifacts.js +27 -27
  22. package/dist/google-drive.js +11 -9
  23. package/dist/google-drive.js.map +1 -1
  24. package/dist/index.d.ts +1318 -128
  25. package/dist/index.js +400 -80
  26. package/dist/interaction.d.ts +1415 -20
  27. package/dist/knowledge.d.ts +543 -0
  28. package/dist/slack-task-policy.d.ts +294 -0
  29. package/dist/task-notes.d.ts +128 -0
  30. package/dist/video-generation.d.ts +48 -0
  31. package/dist/video-generation.js +9 -1
  32. package/dist/xai-provider-account-authority.d.ts +23 -0
  33. package/dist/xai-provider-account-authority.js +9 -0
  34. package/dist/xai-provider-account-authority.js.map +1 -0
  35. package/package.json +13 -1
  36. package/src/artifacts.ts +1 -1
  37. package/src/canonical-human-identities.ts +93 -0
  38. package/src/codex-provider-account-authority.ts +37 -0
  39. package/src/index.ts +731 -138
  40. package/src/interaction.ts +886 -5
  41. package/src/knowledge.ts +207 -0
  42. package/src/slack-task-policy.ts +215 -0
  43. package/src/task-notes.ts +92 -0
  44. package/src/video-generation.ts +43 -6
  45. package/src/xai-provider-account-authority.ts +37 -0
  46. package/dist/chunk-52SGB2QO.js.map +0 -1
  47. package/dist/chunk-VA22KRHS.js.map +0 -1
  48. /package/dist/{chunk-FJBG5E4O.js.map → chunk-JBCIY7QD.js.map} +0 -0
  49. /package/dist/{chunk-H5BVCZKF.js.map → chunk-LW7OH6CS.js.map} +0 -0
package/src/index.ts CHANGED
@@ -12,6 +12,7 @@ import { ClientResumableVoiceInputConfig } from "./transcription-recordings";
12
12
  import { MediaGenerationResult } from "./video-generation";
13
13
 
14
14
  export * from "./slack-bot-scopes";
15
+ export * from "./slack-task-policy";
15
16
  export * from "./atlassian";
16
17
  export * from "./connector-destinations";
17
18
  export * from "./memory-slack-delivery";
@@ -245,7 +246,7 @@ export type CapabilityDescriptor = {
245
246
  FileSystem: { available: boolean; readOnly: boolean };
246
247
  Terminal: {
247
248
  available: boolean;
248
- transport: "sse-events" | "pty-ws" | null;
249
+ transport: "sse-events" | "pty-ws" | "relay-pty" | null;
249
250
  pty: boolean;
250
251
  };
251
252
  Git: { available: boolean };
@@ -567,7 +568,7 @@ export const CAPABILITY_DESCRIPTORS: Record<SandboxBackend, CapabilityDescriptor
567
568
  os: { supported: ["linux", "macos", "windows"], default: "linux" },
568
569
  capabilities: {
569
570
  FileSystem: { available: true, readOnly: false },
570
- Terminal: { available: true, transport: "pty-ws", pty: true }, // real PTY over the relay
571
+ Terminal: { available: true, transport: "relay-pty", pty: true }, // real PTY over the relay
571
572
  Git: { available: true },
572
573
  DesktopStream: { available: true, transport: "vnc-ws" }, // proclaimed; consent-gated at enroll
573
574
  Recording: { available: true }, // boot invariant: == DesktopStream.available
@@ -625,6 +626,7 @@ export const ErrorEnvelope = z.object({
625
626
  code: ErrorCode,
626
627
  message: z.string(),
627
628
  retryable: z.boolean(),
629
+ outcomeUnknown: z.boolean().optional(),
628
630
  requestId: z.string().optional(),
629
631
  details: z.record(z.string(), z.unknown()).optional(),
630
632
  }),
@@ -798,6 +800,7 @@ export const FIRST_PARTY_MCP_TOOL_NAMES = [
798
800
  "set_session_title",
799
801
  "goal_set",
800
802
  "goal_update",
803
+ "goal_progress",
801
804
  "goal_complete",
802
805
  "goal_pause",
803
806
  "memory_search",
@@ -805,6 +808,9 @@ export const FIRST_PARTY_MCP_TOOL_NAMES = [
805
808
  "memory_correct",
806
809
  "preference_registry_summary",
807
810
  "preference_registry_get",
811
+ "task_notes_list",
812
+ "task_note_save",
813
+ "task_note_archive",
808
814
  "sandboxes_list",
809
815
  "sandbox_attach",
810
816
  "sandbox_swap",
@@ -830,13 +836,17 @@ export const FIRST_PARTY_MCP_TOOL_NAMES = [
830
836
  "browser_tabs",
831
837
  "browser_observe",
832
838
  "browser_act",
839
+ "browser_clipboard",
833
840
  "browser_debug",
841
+ "browser_auth",
842
+ "interaction_request_human",
834
843
  "browser_identity",
835
844
  "browser_publish",
836
845
  "browser_lifecycle",
837
846
  "computer_open",
838
847
  "computer_targets",
839
848
  "computer_observe",
849
+ "computer_clipboard",
840
850
  "computer_act",
841
851
  "computer_lifecycle",
842
852
  "variable_set_list",
@@ -886,6 +896,16 @@ export const FIRST_PARTY_MCP_TOOL_NAMES = [
886
896
  "slack_bot_file_content",
887
897
  "slack_bot_post_message",
888
898
  "slack_bot_delete_message",
899
+ "fiken_companies_list",
900
+ "fiken_contacts_list",
901
+ "fiken_contact_create",
902
+ "fiken_products_list",
903
+ "fiken_invoices_list",
904
+ "fiken_invoice_get",
905
+ "fiken_invoice_draft_create",
906
+ "fiken_bank_accounts_list",
907
+ "fiken_purchases_list",
908
+ "fiken_sales_list",
889
909
  "atlassian_sources_list",
890
910
  "atlassian_search",
891
911
  "atlassian_get",
@@ -917,13 +937,17 @@ export const FIRST_PARTY_IN_PROCESS_TOOL_NAMES = [
917
937
  "browser_tabs",
918
938
  "browser_observe",
919
939
  "browser_act",
940
+ "browser_clipboard",
920
941
  "browser_debug",
942
+ "browser_auth",
943
+ "interaction_request_human",
921
944
  "browser_identity",
922
945
  "browser_publish",
923
946
  "browser_lifecycle",
924
947
  "computer_open",
925
948
  "computer_targets",
926
949
  "computer_observe",
950
+ "computer_clipboard",
927
951
  "computer_act",
928
952
  "computer_lifecycle",
929
953
  ] as const satisfies readonly FirstPartyMcpToolName[];
@@ -932,9 +956,27 @@ const FIRST_PARTY_IN_PROCESS_TOOL_NAME_SET = new Set<FirstPartyMcpToolName>(
932
956
  FIRST_PARTY_IN_PROCESS_TOOL_NAMES,
933
957
  );
934
958
 
959
+ /**
960
+ * Names accepted for stored-selection compatibility but intentionally omitted
961
+ * from the remote first-party `opengeni` MCP server.
962
+ *
963
+ * `slack_bot_post_message` cannot accept a model/caller-supplied UUID as a
964
+ * trustworthy logical-delivery identity. Server-owned Slack delivery paths
965
+ * call the internal client directly with their own durable operation IDs.
966
+ */
967
+ const FIRST_PARTY_COMPATIBILITY_ONLY_TOOL_NAMES = [
968
+ "slack_bot_post_message",
969
+ ] as const satisfies readonly FirstPartyMcpToolName[];
970
+
971
+ const FIRST_PARTY_COMPATIBILITY_ONLY_TOOL_NAME_SET = new Set<FirstPartyMcpToolName>(
972
+ FIRST_PARTY_COMPATIBILITY_ONLY_TOOL_NAMES,
973
+ );
974
+
935
975
  /** Exact catalog registered by the remote first-party `opengeni` MCP server. */
936
976
  export const FIRST_PARTY_REMOTE_MCP_TOOL_NAMES = FIRST_PARTY_MCP_TOOL_NAMES.filter(
937
- (name) => !FIRST_PARTY_IN_PROCESS_TOOL_NAME_SET.has(name),
977
+ (name) =>
978
+ !FIRST_PARTY_IN_PROCESS_TOOL_NAME_SET.has(name) &&
979
+ !FIRST_PARTY_COMPATIBILITY_ONLY_TOOL_NAME_SET.has(name),
938
980
  ) satisfies readonly FirstPartyMcpToolName[];
939
981
 
940
982
  /** Authored CodeMode paths for the canonical collaborative artifact surface. */
@@ -960,6 +1002,7 @@ export const DEFAULT_FIRST_PARTY_MCP_TOOLS = FIRST_PARTY_MCP_TOOL_NAMES.filter(
960
1002
  !name.startsWith("x_") &&
961
1003
  !name.startsWith("reddit_") &&
962
1004
  !name.startsWith("slack_bot_") &&
1005
+ !name.startsWith("fiken_") &&
963
1006
  !name.startsWith("atlassian_"),
964
1007
  ) satisfies readonly FirstPartyMcpToolName[];
965
1008
 
@@ -982,6 +1025,255 @@ export type UsageLimitsMode = z.infer<typeof UsageLimitsMode>;
982
1025
  export const AccountRole = z.enum(["owner", "admin", "member"]);
983
1026
  export type AccountRole = z.infer<typeof AccountRole>;
984
1027
 
1028
+ /**
1029
+ * Settled tenancy vocabulary for resources that may outlive or be used from
1030
+ * more than one workspace. This names authority only; parsing one of these
1031
+ * contracts never authorizes access by itself.
1032
+ */
1033
+ export const ResourceAuthorityScope = z.enum(["organization", "workspace", "user"]);
1034
+ export type ResourceAuthorityScope = z.infer<typeof ResourceAuthorityScope>;
1035
+
1036
+ export const ResourceAuthorityListScope = z.enum([
1037
+ "effective",
1038
+ "organization",
1039
+ "workspace",
1040
+ "user",
1041
+ ]);
1042
+ export type ResourceAuthorityListScope = z.infer<typeof ResourceAuthorityListScope>;
1043
+
1044
+ export const OrganizationMembershipStatus = z.enum([
1045
+ "provisioning",
1046
+ "active",
1047
+ "suspended",
1048
+ "revoked",
1049
+ ]);
1050
+ export type OrganizationMembershipStatus = z.infer<typeof OrganizationMembershipStatus>;
1051
+
1052
+ export const PersonalResourceRetentionMode = z.enum(["retain", "delete_after"]);
1053
+ export type PersonalResourceRetentionMode = z.infer<typeof PersonalResourceRetentionMode>;
1054
+
1055
+ export const SessionTenancyVisibility = z.enum(["user_private", "workspace_shared"]);
1056
+ export type SessionTenancyVisibility = z.infer<typeof SessionTenancyVisibility>;
1057
+
1058
+ /** Public/session API vocabulary. Persistence keeps the explicit tenancy names. */
1059
+ export const SessionVisibility = z.enum(["private", "workspace"]);
1060
+ export type SessionVisibility = z.infer<typeof SessionVisibility>;
1061
+
1062
+ export function sessionVisibilityToPublic(value: SessionTenancyVisibility): SessionVisibility {
1063
+ return value === "user_private" ? "private" : "workspace";
1064
+ }
1065
+
1066
+ export function sessionVisibilityFromPublic(value: SessionVisibility): SessionTenancyVisibility {
1067
+ return value === "private" ? "user_private" : "workspace_shared";
1068
+ }
1069
+
1070
+ export const UserResourceGrantMode = z.enum(["once", "session", "always"]);
1071
+ export type UserResourceGrantMode = z.infer<typeof UserResourceGrantMode>;
1072
+
1073
+ /** Canonical non-wildcard action named by a personal-resource grant. */
1074
+ export const UserResourceGrantAction = z
1075
+ .string()
1076
+ .min(1)
1077
+ .max(64)
1078
+ .regex(/^[a-z0-9](?:[a-z0-9._:-]*[a-z0-9])?$/u);
1079
+ export type UserResourceGrantAction = z.infer<typeof UserResourceGrantAction>;
1080
+
1081
+ export const UserResourceGrantStatus = z.enum(["active", "consumed", "revoked", "expired"]);
1082
+ export type UserResourceGrantStatus = z.infer<typeof UserResourceGrantStatus>;
1083
+
1084
+ function refineUserResourceGrantFence(
1085
+ value: {
1086
+ mode: UserResourceGrantMode;
1087
+ sessionId: string | null;
1088
+ authorityEpoch: number | null;
1089
+ },
1090
+ context: z.RefinementCtx,
1091
+ ): void {
1092
+ const sessionBoundMode = value.mode === "once" || value.mode === "session";
1093
+ const hasSession = value.sessionId !== null;
1094
+ const hasAuthorityEpoch = value.authorityEpoch !== null;
1095
+
1096
+ if (sessionBoundMode && !hasSession) {
1097
+ context.addIssue({
1098
+ code: "custom",
1099
+ path: ["sessionId"],
1100
+ message: "once and session grants require an exact sessionId",
1101
+ });
1102
+ }
1103
+ if (sessionBoundMode && !hasAuthorityEpoch) {
1104
+ context.addIssue({
1105
+ code: "custom",
1106
+ path: ["authorityEpoch"],
1107
+ message: "once and session grants require an authorityEpoch fence",
1108
+ });
1109
+ }
1110
+ if (!sessionBoundMode && (hasSession || hasAuthorityEpoch)) {
1111
+ context.addIssue({
1112
+ code: "custom",
1113
+ path: ["mode"],
1114
+ message: "always grants must not carry a session or authority-epoch fence",
1115
+ });
1116
+ }
1117
+ if (hasSession !== hasAuthorityEpoch) {
1118
+ context.addIssue({
1119
+ code: "custom",
1120
+ path: ["authorityEpoch"],
1121
+ message: "sessionId and authorityEpoch must be present or absent together",
1122
+ });
1123
+ }
1124
+ }
1125
+
1126
+ /** Self-only organization membership projection; no subject identifier leaks. */
1127
+ export const OrganizationMembershipProjection = z.object({
1128
+ id: z.string().uuid(),
1129
+ organizationId: z.string().uuid(),
1130
+ status: OrganizationMembershipStatus,
1131
+ personalWorkspaceId: z.string().uuid().nullable(),
1132
+ personalRetentionUntil: z.string().datetime({ offset: true }).nullable(),
1133
+ });
1134
+ export type OrganizationMembershipProjection = z.infer<typeof OrganizationMembershipProjection>;
1135
+
1136
+ /**
1137
+ * Exact active-membership facts returned by managed-human login provisioning.
1138
+ * Retention is intentionally absent because the narrow provisioning capability
1139
+ * neither reads nor mutates offboarding policy.
1140
+ */
1141
+ export const ManagedOrganizationMembershipProjection = z.object({
1142
+ id: z.string().uuid(),
1143
+ organizationId: z.string().uuid(),
1144
+ status: z.literal("active"),
1145
+ personalWorkspaceId: z.string().uuid(),
1146
+ });
1147
+ export type ManagedOrganizationMembershipProjection = z.infer<
1148
+ typeof ManagedOrganizationMembershipProjection
1149
+ >;
1150
+
1151
+ export const ListManagedOrganizationMembershipsResponse = z.object({
1152
+ memberships: z.array(ManagedOrganizationMembershipProjection),
1153
+ });
1154
+ export type ListManagedOrganizationMembershipsResponse = z.infer<
1155
+ typeof ListManagedOrganizationMembershipsResponse
1156
+ >;
1157
+
1158
+ /**
1159
+ * Opaque user-resource authority projection. Ownership is represented by the
1160
+ * server-issued authority id, never a raw subject or membership id.
1161
+ */
1162
+ export const UserResourceAuthorityProjection = z.object({
1163
+ id: z.string().uuid(),
1164
+ organizationId: z.string().uuid(),
1165
+ scope: z.literal("user"),
1166
+ resourceKind: z.string().min(1).max(64),
1167
+ originWorkspaceId: z.string().uuid().nullable(),
1168
+ generation: z.number().int().positive(),
1169
+ status: z.enum(["active", "retained", "revoked"]),
1170
+ });
1171
+ export type UserResourceAuthorityProjection = z.infer<typeof UserResourceAuthorityProjection>;
1172
+
1173
+ /**
1174
+ * Opaque grant projection. A grant is still inert until a server-side access
1175
+ * boundary proves the organization, owner, workspace, session context, and
1176
+ * current authority epoch.
1177
+ */
1178
+ export const UserResourceGrantProjection = z
1179
+ .object({
1180
+ id: z.string().uuid(),
1181
+ authorityId: z.string().uuid(),
1182
+ organizationId: z.string().uuid(),
1183
+ workspaceId: z.string().uuid(),
1184
+ sessionId: z.string().uuid().nullable(),
1185
+ action: UserResourceGrantAction,
1186
+ mode: UserResourceGrantMode,
1187
+ context: SessionTenancyVisibility,
1188
+ authorityEpoch: z.number().int().positive().nullable(),
1189
+ generation: z.number().int().positive(),
1190
+ status: UserResourceGrantStatus,
1191
+ expiresAt: z.string().datetime({ offset: true }).nullable(),
1192
+ })
1193
+ .superRefine(refineUserResourceGrantFence);
1194
+ export type UserResourceGrantProjection = z.infer<typeof UserResourceGrantProjection>;
1195
+
1196
+ /**
1197
+ * Extensible immutable delegation payload for accepted work. It contains only
1198
+ * opaque authority/grant identity and execution fences, never owner identity
1199
+ * or credential material.
1200
+ */
1201
+ export const UserResourceDelegation = z
1202
+ .object({
1203
+ authorityId: z.string().uuid(),
1204
+ grantId: z.string().uuid(),
1205
+ organizationId: z.string().uuid(),
1206
+ workspaceId: z.string().uuid(),
1207
+ sessionId: z.string().uuid().nullable(),
1208
+ action: UserResourceGrantAction,
1209
+ mode: UserResourceGrantMode,
1210
+ context: SessionTenancyVisibility,
1211
+ authorityEpoch: z.number().int().positive().nullable(),
1212
+ authorityGeneration: z.number().int().positive(),
1213
+ grantGeneration: z.number().int().positive(),
1214
+ resourceVersionId: z.string().uuid().nullable().optional(),
1215
+ })
1216
+ .superRefine(refineUserResourceGrantFence);
1217
+ export type UserResourceDelegation = z.infer<typeof UserResourceDelegation>;
1218
+
1219
+ /**
1220
+ * Compatibility envelope for future resource selectors. Omitted scope and
1221
+ * authority parse to workspace-only behavior; user authority is impossible
1222
+ * without one complete opaque delegation.
1223
+ */
1224
+ export const ResourceAuthorityEnvelope = z
1225
+ .object({
1226
+ scope: ResourceAuthorityScope.default("workspace"),
1227
+ userDelegation: UserResourceDelegation.optional(),
1228
+ })
1229
+ .superRefine((value, context) => {
1230
+ if (value.scope === "user" && value.userDelegation === undefined) {
1231
+ context.addIssue({
1232
+ code: "custom",
1233
+ path: ["userDelegation"],
1234
+ message: "user scope requires an explicit immutable delegation",
1235
+ });
1236
+ }
1237
+ if (value.scope !== "user" && value.userDelegation !== undefined) {
1238
+ context.addIssue({
1239
+ code: "custom",
1240
+ path: ["userDelegation"],
1241
+ message: "only user scope may carry a user delegation",
1242
+ });
1243
+ }
1244
+ });
1245
+ export type ResourceAuthorityEnvelope = z.infer<typeof ResourceAuthorityEnvelope>;
1246
+
1247
+ /** Secret-safe generic session tenancy metadata for an authorized viewer. */
1248
+ export const SessionTenancyProjection = z.object({
1249
+ visibility: SessionTenancyVisibility,
1250
+ authorityEpoch: z.number().int().positive(),
1251
+ ownedByCurrentUser: z.boolean(),
1252
+ fork: z
1253
+ .object({
1254
+ sourceVisibility: SessionTenancyVisibility,
1255
+ sourceAuthorityEpoch: z.number().int().positive(),
1256
+ forkedAt: z.string().datetime({ offset: true }),
1257
+ })
1258
+ .nullable(),
1259
+ });
1260
+ export type SessionTenancyProjection = z.infer<typeof SessionTenancyProjection>;
1261
+
1262
+ /** Secret-safe public projection used by activated session APIs. */
1263
+ export const SessionTenancyPublicProjection = z.object({
1264
+ visibility: SessionVisibility,
1265
+ authorityEpoch: z.number().int().positive(),
1266
+ ownedByCurrentUser: z.boolean(),
1267
+ fork: z
1268
+ .object({
1269
+ sourceVisibility: SessionVisibility,
1270
+ sourceAuthorityEpoch: z.number().int().positive(),
1271
+ forkedAt: z.string().datetime({ offset: true }),
1272
+ })
1273
+ .nullable(),
1274
+ });
1275
+ export type SessionTenancyPublicProjection = z.infer<typeof SessionTenancyPublicProjection>;
1276
+
985
1277
  export const ManagedAccount = z.object({
986
1278
  id: z.string().uuid(),
987
1279
  name: z.string(),
@@ -1422,12 +1714,17 @@ export const DEFAULT_WORKSPACE_SLACK_REACTION_SUMMON_SETTINGS = {
1422
1714
  channelPolicy: { mode: "bot_member" },
1423
1715
  } as const satisfies WorkspaceSlackReactionSummonSettings;
1424
1716
 
1717
+ export const WorkspaceMemoryPromptMode = z.enum(["legacy_standing", "retrieval_only"]);
1718
+ export type WorkspaceMemoryPromptMode = z.infer<typeof WorkspaceMemoryPromptMode>;
1719
+
1425
1720
  // Validates the KNOWN keys of workspaces.settings; passthrough keeps unknown
1426
- // (future) keys rather than stripping them. memoryEnabled defaults off;
1721
+ // (future) keys rather than stripping them. memoryEnabled defaults off and the
1722
+ // reversible Memory V1 containment rollout defaults to legacy standing context;
1427
1723
  // voiceInput defaults to enabled when the deployment has a provider.
1428
1724
  export const WorkspaceSettingsSchema = z
1429
1725
  .object({
1430
1726
  memoryEnabled: z.boolean().optional(),
1727
+ memoryPromptMode: WorkspaceMemoryPromptMode.optional(),
1431
1728
  /** Preferred workspace voice-input toggle. */
1432
1729
  voiceInput: WorkspaceVoiceInputSettings.optional(),
1433
1730
  /**
@@ -1457,6 +1754,12 @@ export function resolveWorkspaceMemoryEnabled(settings: unknown): boolean {
1457
1754
  return parsed.success ? parsed.data.memoryEnabled === true : false;
1458
1755
  }
1459
1756
 
1757
+ /** Reversible Memory V1 prompt rollout. Absent preserves legacy composition. */
1758
+ export function resolveWorkspaceMemoryPromptMode(settings: unknown): WorkspaceMemoryPromptMode {
1759
+ const parsed = WorkspaceSettingsSchema.safeParse(settings ?? {});
1760
+ return parsed.success ? (parsed.data.memoryPromptMode ?? "legacy_standing") : "legacy_standing";
1761
+ }
1762
+
1460
1763
  /** Default Codex compaction mode for new Codex sessions (remote_v2 when unset). */
1461
1764
  export function resolveWorkspaceCodexCompactionDefault(settings: unknown): CodexCompactionMode {
1462
1765
  const parsed = WorkspaceSettingsSchema.safeParse(settings ?? {});
@@ -1527,6 +1830,7 @@ export function workspaceSlackReactionChannelAllowed(
1527
1830
  export const UpdateWorkspaceSettingsRequest = z
1528
1831
  .object({
1529
1832
  memoryEnabled: z.boolean().optional(),
1833
+ memoryPromptMode: WorkspaceMemoryPromptMode.optional(),
1530
1834
  voiceInput: WorkspaceVoiceInputSettings.optional(),
1531
1835
  /** @deprecated Prefer `voiceInput`. Kept for one compatibility release. */
1532
1836
  transcription: WorkspaceTranscriptionPolicy.optional(),
@@ -1594,6 +1898,8 @@ const reservedServiceTurnInitiatorContextKeys = new Set([
1594
1898
  "backfill",
1595
1899
  "label",
1596
1900
  "provenanceError",
1901
+ "opengeniSiteAuthConnectionId",
1902
+ "opengeniSiteAuthMaintenanceOperationId",
1597
1903
  "via",
1598
1904
  "viaTruncated",
1599
1905
  ]);
@@ -1695,6 +2001,11 @@ export const DelegatedAccessTokenPayload = z
1695
2001
  // Model-visible first-party tool selection for a worker-bound session.
1696
2002
  // This is visibility only; permissions remain the authorization boundary.
1697
2003
  firstPartyMcpTools: z.array(FirstPartyMcpToolName).optional(),
2004
+ // Trusted root-relative depth facts frozen when the worker prepares this
2005
+ // attempt. They shape only the model-visible tool catalog; the database
2006
+ // remains authoritative for admission and concurrent policy changes.
2007
+ nestedAgentDepth: NestedAgentDepthValue.optional(),
2008
+ effectiveMaxNestedAgentDepth: NestedAgentDepthValue.optional(),
1698
2009
  // The turn making the call (the caller's identity), HMAC-signed by the worker
1699
2010
  // at turn setup. Lets a tool classify WHO is calling from the token itself,
1700
2011
  // instead of racily re-reading the session's live active_turn_id — e.g. the
@@ -1715,6 +2026,23 @@ export const DelegatedAccessTokenPayload = z
1715
2026
  payload.executionGeneration,
1716
2027
  ];
1717
2028
  const exactAttemptClaimCount = exactAttemptClaims.filter((value) => value !== undefined).length;
2029
+ const depthClaimCount = [payload.nestedAgentDepth, payload.effectiveMaxNestedAgentDepth].filter(
2030
+ (value) => value !== undefined,
2031
+ ).length;
2032
+ if (depthClaimCount !== 0 && depthClaimCount !== 2) {
2033
+ ctx.addIssue({
2034
+ code: z.ZodIssueCode.custom,
2035
+ path: ["nestedAgentDepth"],
2036
+ message: "nested-agent depth claims must be supplied together",
2037
+ });
2038
+ }
2039
+ if (depthClaimCount > 0 && payload.principalKind !== "agent_attempt") {
2040
+ ctx.addIssue({
2041
+ code: z.ZodIssueCode.custom,
2042
+ path: ["principalKind"],
2043
+ message: "nested-agent depth claims require an agent_attempt principal",
2044
+ });
2045
+ }
1718
2046
  if (
1719
2047
  payload.principalKind === "human_session" &&
1720
2048
  (exactAttemptClaimCount !== 0 || payload.serviceInitiator !== undefined)
@@ -2371,9 +2699,9 @@ export type InsightsModelUsageRow = z.infer<typeof InsightsModelUsageRow>;
2371
2699
 
2372
2700
  export const InsightsSeriesPoint = z.object({
2373
2701
  label: z.string().min(1),
2374
- /** Day-bucketed sum of usage_events.model.cost (workspace-wide) or filtered facts when provider/model set. */
2702
+ /** UTC hour/day-bucketed sum of usage_events.model.cost (workspace-wide) or filtered facts when provider/model set. */
2375
2703
  modelCostUsd: z.number().nonnegative(),
2376
- /** Day-bucketed hypothetical provider-rate USD for calls with captured pricing. */
2704
+ /** UTC hour/day-bucketed hypothetical provider-rate USD for calls with captured pricing. */
2377
2705
  estimatedProviderUsd: z.number().nonnegative(),
2378
2706
  estimatedProviderCostKnownCalls: z.number().int().nonnegative(),
2379
2707
  warmSeconds: z.number().nonnegative(),
@@ -4293,6 +4621,86 @@ export type SessionGoalStatus = z.infer<typeof SessionGoalStatus>;
4293
4621
  export const SessionGoalCreatedBy = z.enum(["api", "agent", "scheduled_task"]);
4294
4622
  export type SessionGoalCreatedBy = z.infer<typeof SessionGoalCreatedBy>;
4295
4623
 
4624
+ export const SessionGoalMutationPolicy = z.enum([
4625
+ "review_changes",
4626
+ "preserve_intent",
4627
+ "autonomous_adaptation",
4628
+ ]);
4629
+ export type SessionGoalMutationPolicy = z.infer<typeof SessionGoalMutationPolicy>;
4630
+
4631
+ export const SessionGoalChangeKind = z.enum(["refinement", "adaptation", "replacement"]);
4632
+ export type SessionGoalChangeKind = z.infer<typeof SessionGoalChangeKind>;
4633
+
4634
+ export const SESSION_GOAL_TEXT_MAX_BYTES = 8 * 1024;
4635
+ export const SESSION_GOAL_SUCCESS_CRITERIA_MAX_BYTES = 8 * 1024;
4636
+ export const SESSION_GOAL_RATIONALE_MAX_BYTES = 2 * 1024;
4637
+ export const SESSION_GOAL_PROGRESS_MAX_BYTES = 4 * 1024;
4638
+
4639
+ export function sessionGoalUtf8Bytes(value: string): number {
4640
+ return new TextEncoder().encode(value).byteLength;
4641
+ }
4642
+
4643
+ function boundedSessionGoalString(maxBytes: number, field: string) {
4644
+ return z
4645
+ .string()
4646
+ .min(1)
4647
+ .refine((value) => sessionGoalUtf8Bytes(value) <= maxBytes, {
4648
+ message: `${field} exceeds ${maxBytes} UTF-8 bytes`,
4649
+ });
4650
+ }
4651
+
4652
+ const SessionGoalTextWrite = boundedSessionGoalString(SESSION_GOAL_TEXT_MAX_BYTES, "goal text");
4653
+ const SessionGoalSuccessCriteriaWrite = boundedSessionGoalString(
4654
+ SESSION_GOAL_SUCCESS_CRITERIA_MAX_BYTES,
4655
+ "goal success criteria",
4656
+ );
4657
+ const SessionGoalRationaleWrite = boundedSessionGoalString(
4658
+ SESSION_GOAL_RATIONALE_MAX_BYTES,
4659
+ "goal rationale",
4660
+ );
4661
+
4662
+ export const SessionGoalSnapshot = z.discriminatedUnion("state", [
4663
+ z.object({ state: z.literal("none"), capturedAt: z.string() }),
4664
+ z.object({
4665
+ state: z.enum(["active", "paused", "completed"]),
4666
+ goalId: z.string().uuid(),
4667
+ objectiveRevision: z.number().int().positive(),
4668
+ text: SessionGoalTextWrite,
4669
+ successCriteria: SessionGoalSuccessCriteriaWrite.nullable(),
4670
+ mutationPolicy: SessionGoalMutationPolicy,
4671
+ capturedAt: z.string(),
4672
+ }),
4673
+ ]);
4674
+ export type SessionGoalSnapshot = z.infer<typeof SessionGoalSnapshot>;
4675
+
4676
+ export const SessionGoalRevision = z.object({
4677
+ id: z.string().uuid(),
4678
+ accountId: z.string().uuid(),
4679
+ workspaceId: z.string().uuid(),
4680
+ sessionId: z.string().uuid(),
4681
+ goalId: z.string().uuid(),
4682
+ disposition: z.enum(["applied", "proposed", "rejected"]),
4683
+ changeKind: SessionGoalChangeKind,
4684
+ baseObjectiveRevision: z.number().int().nonnegative(),
4685
+ resultObjectiveRevision: z.number().int().positive().nullable(),
4686
+ text: z.string().min(1),
4687
+ successCriteria: z.string().nullable(),
4688
+ mutationPolicy: SessionGoalMutationPolicy,
4689
+ rationale: z.string().min(1),
4690
+ actor: z.enum(["agent", "api", "scheduled_task"]),
4691
+ actorTurnId: z.string().uuid().nullable(),
4692
+ actorAttemptId: z.string().uuid().nullable(),
4693
+ proposalId: z.string().uuid().nullable(),
4694
+ createdAt: z.string(),
4695
+ });
4696
+ export type SessionGoalRevision = z.infer<typeof SessionGoalRevision>;
4697
+
4698
+ export const ApplySessionGoalRevisionRequest = z.object({
4699
+ expectedObjectiveRevision: z.number().int().positive(),
4700
+ rationale: SessionGoalRationaleWrite.optional(),
4701
+ });
4702
+ export type ApplySessionGoalRevisionRequest = z.infer<typeof ApplySessionGoalRevisionRequest>;
4703
+
4296
4704
  export const SessionGoalPausedReason = z.enum([
4297
4705
  "agent",
4298
4706
  "user_pause",
@@ -4351,6 +4759,8 @@ export const SessionGoal = z.object({
4351
4759
  pausedReason: z.string().nullable(),
4352
4760
  createdBy: SessionGoalCreatedBy,
4353
4761
  version: z.number().int().positive(),
4762
+ objectiveRevision: z.number().int().positive(),
4763
+ mutationPolicy: SessionGoalMutationPolicy,
4354
4764
  autoContinuations: z.number().int().nonnegative(),
4355
4765
  noProgressStreak: z.number().int().nonnegative(),
4356
4766
  maxAutoContinuations: z.number().int().positive().nullable(),
@@ -4364,16 +4774,26 @@ export const SessionGoal = z.object({
4364
4774
  export type SessionGoal = z.infer<typeof SessionGoal>;
4365
4775
 
4366
4776
  export const GoalSpec = z.object({
4367
- text: z.string().min(1),
4368
- successCriteria: z.string().min(1).optional(),
4777
+ text: SessionGoalTextWrite,
4778
+ successCriteria: SessionGoalSuccessCriteriaWrite.optional(),
4369
4779
  maxAutoContinuations: z.number().int().positive().optional(),
4780
+ mutationPolicy: SessionGoalMutationPolicy.optional(),
4370
4781
  });
4371
4782
  export type GoalSpec = z.infer<typeof GoalSpec>;
4372
4783
 
4373
- export const UpdateSessionGoalRequest = z.object({
4374
- status: z.enum(["paused", "active"]),
4375
- rationale: z.string().min(1).optional(),
4376
- });
4784
+ export const UpdateSessionGoalRequest = z.union([
4785
+ z.object({
4786
+ status: z.enum(["paused", "active"]),
4787
+ rationale: SessionGoalRationaleWrite.optional(),
4788
+ }),
4789
+ z.object({
4790
+ text: SessionGoalTextWrite,
4791
+ successCriteria: SessionGoalSuccessCriteriaWrite.nullable().optional(),
4792
+ mutationPolicy: SessionGoalMutationPolicy.optional(),
4793
+ rationale: SessionGoalRationaleWrite,
4794
+ expectedObjectiveRevision: z.number().int().positive(),
4795
+ }),
4796
+ ]);
4377
4797
  export type UpdateSessionGoalRequest = z.infer<typeof UpdateSessionGoalRequest>;
4378
4798
 
4379
4799
  export const UpdateSessionRequest = z.object({
@@ -4702,6 +5122,7 @@ export type SyncSessionRealtimeLedgerResponse = z.infer<typeof SyncSessionRealti
4702
5122
 
4703
5123
  export const SessionRealtimeModel = z.enum([
4704
5124
  "gpt-live-1-boulder-alpha",
5125
+ "supergrok/grok-voice-think-fast-2.0",
4705
5126
  "opengeni-gateway/openai/gpt-realtime-2.1",
4706
5127
  "opengeni-gateway/openai/gpt-realtime-mini",
4707
5128
  "opengeni-gateway/xai/grok-voice-think-fast-2.0",
@@ -4714,7 +5135,7 @@ export type SessionRealtimeModel = z.infer<typeof SessionRealtimeModel>;
4714
5135
  export const WorkspaceRealtimeModelCatalogItem = z.object({
4715
5136
  id: SessionRealtimeModel,
4716
5137
  label: z.string().min(1),
4717
- provider: z.enum(["OpenGeni", "Connected Codex", "Your Gateway"]),
5138
+ provider: z.enum(["OpenGeni", "Connected Codex", "Connected SuperGrok", "Your Gateway"]),
4718
5139
  description: z.string().min(1),
4719
5140
  available: z.boolean(),
4720
5141
  unavailableReason: z.string().nullable(),
@@ -4808,11 +5229,14 @@ export const SessionAuthorizationOperation = z.enum([
4808
5229
  "session.human_input.read",
4809
5230
  "session.human_input.write",
4810
5231
  "session.title.write",
5232
+ "session.channel.write",
4811
5233
  "session.mcp.approval_policy.write",
4812
5234
  "session.tool_policy.write",
4813
5235
  "session.goal.read",
4814
5236
  "session.goal.write",
4815
5237
  "session.child.create",
5238
+ "session.visibility.write",
5239
+ "session.fork.create",
4816
5240
  ]);
4817
5241
  export type SessionAuthorizationOperation = z.infer<typeof SessionAuthorizationOperation>;
4818
5242
 
@@ -6070,6 +6494,40 @@ export const UpdateRigRequest = z.object({
6070
6494
  });
6071
6495
  export type UpdateRigRequest = z.infer<typeof UpdateRigRequest>;
6072
6496
 
6497
+ // Workspace-shared channels organize root sessions ("workstreams") by work
6498
+ // type in the rail. Pure organizational metadata: filing a session into a
6499
+ // channel never affects execution, authority, memory, or history.
6500
+ export const Channel = z.object({
6501
+ id: z.string().uuid(),
6502
+ accountId: z.string().uuid(),
6503
+ workspaceId: z.string().uuid(),
6504
+ name: z.string(),
6505
+ description: z.string().nullable(),
6506
+ createdBy: z.string().nullable(),
6507
+ createdAt: z.string(),
6508
+ updatedAt: z.string(),
6509
+ });
6510
+ export type Channel = z.infer<typeof Channel>;
6511
+
6512
+ export const CreateChannelRequest = z.object({
6513
+ name: z.string().trim().min(1).max(80),
6514
+ description: z.string().max(2000).optional(),
6515
+ });
6516
+ export type CreateChannelRequest = z.infer<typeof CreateChannelRequest>;
6517
+
6518
+ export const UpdateChannelRequest = z.object({
6519
+ name: z.string().trim().min(1).max(80).optional(),
6520
+ description: z.string().max(2000).nullable().optional(),
6521
+ });
6522
+ export type UpdateChannelRequest = z.infer<typeof UpdateChannelRequest>;
6523
+
6524
+ // Re-files one session (rail organization only). null moves it back to the
6525
+ // unfiled inbox.
6526
+ export const UpdateSessionChannelRequest = z.object({
6527
+ channelId: z.string().uuid().nullable(),
6528
+ });
6529
+ export type UpdateSessionChannelRequest = z.infer<typeof UpdateSessionChannelRequest>;
6530
+
6073
6531
  // setup_append: the exact command that already worked (+ an optional note).
6074
6532
  export const RigSetupAppendPayload = z.object({
6075
6533
  command: z.string().min(1).max(8192),
@@ -6418,47 +6876,48 @@ export const CreateScheduledTaskRequest = /* @__PURE__ */ z.union([
6418
6876
  ]);
6419
6877
  export type CreateScheduledTaskRequest = z.infer<typeof CreateScheduledTaskRequest>;
6420
6878
 
6421
- export const UpdateScheduledTaskRequest = /* @__PURE__ */ withVariableSetIdAlias({
6422
- name: z.string().min(1).optional(),
6423
- schedule: ScheduledTaskScheduleSpec.optional(),
6424
- runMode: ScheduledTaskRunMode.optional(),
6425
- overlapPolicy: ScheduledTaskOverlapPolicy.optional(),
6426
- action: ScheduledTaskAction.optional(),
6427
- targetSessionId: z.string().uuid().nullable().optional(),
6428
- agentConfig: ScheduledTaskAgentConfig.optional(),
6429
- status: ScheduledTaskStatus.optional(),
6430
- variableSetId: z.string().uuid().nullable().optional(),
6431
- environmentId: z.string().uuid().nullable().optional(),
6432
- // The rig each run binds to (M3); null clears it. Its active version is
6433
- // resolved per fire, so an update takes effect on the next dispatch.
6434
- rigId: z.string().uuid().nullable().optional(),
6435
- metadata: z.record(z.string(), z.unknown()).optional(),
6436
- }).superRefine((value, context) => {
6437
- if (value.targetSessionId && value.runMode && value.runMode !== "existing_session") {
6438
- context.addIssue({
6439
- code: "custom",
6440
- path: ["targetSessionId"],
6441
- message: "targetSessionId requires runMode=existing_session",
6442
- });
6443
- }
6444
- if (value.runMode === "existing_session" && value.targetSessionId === null) {
6445
- context.addIssue({
6446
- code: "custom",
6447
- path: ["targetSessionId"],
6448
- message: "targetSessionId cannot be null when runMode=existing_session",
6449
- });
6450
- }
6451
- if (
6452
- value.agentConfig?.goal &&
6453
- (value.runMode === "existing_session" || Boolean(value.targetSessionId))
6454
- ) {
6455
- context.addIssue({
6456
- code: "custom",
6457
- path: ["agentConfig", "goal"],
6458
- message: "agentConfig.goal cannot be used with an existing-session target",
6459
- });
6460
- }
6461
- });
6879
+ export const UpdateScheduledTaskRequest =
6880
+ /* @__PURE__ */ withVariableSetIdAlias({
6881
+ name: z.string().min(1).optional(),
6882
+ schedule: ScheduledTaskScheduleSpec.optional(),
6883
+ runMode: ScheduledTaskRunMode.optional(),
6884
+ overlapPolicy: ScheduledTaskOverlapPolicy.optional(),
6885
+ action: ScheduledTaskAction.optional(),
6886
+ targetSessionId: z.string().uuid().nullable().optional(),
6887
+ agentConfig: ScheduledTaskAgentConfig.optional(),
6888
+ status: ScheduledTaskStatus.optional(),
6889
+ variableSetId: z.string().uuid().nullable().optional(),
6890
+ environmentId: z.string().uuid().nullable().optional(),
6891
+ // The rig each run binds to (M3); null clears it. Its active version is
6892
+ // resolved per fire, so an update takes effect on the next dispatch.
6893
+ rigId: z.string().uuid().nullable().optional(),
6894
+ metadata: z.record(z.string(), z.unknown()).optional(),
6895
+ }).superRefine((value, context) => {
6896
+ if (value.targetSessionId && value.runMode && value.runMode !== "existing_session") {
6897
+ context.addIssue({
6898
+ code: "custom",
6899
+ path: ["targetSessionId"],
6900
+ message: "targetSessionId requires runMode=existing_session",
6901
+ });
6902
+ }
6903
+ if (value.runMode === "existing_session" && value.targetSessionId === null) {
6904
+ context.addIssue({
6905
+ code: "custom",
6906
+ path: ["targetSessionId"],
6907
+ message: "targetSessionId cannot be null when runMode=existing_session",
6908
+ });
6909
+ }
6910
+ if (
6911
+ value.agentConfig?.goal &&
6912
+ (value.runMode === "existing_session" || Boolean(value.targetSessionId))
6913
+ ) {
6914
+ context.addIssue({
6915
+ code: "custom",
6916
+ path: ["agentConfig", "goal"],
6917
+ message: "agentConfig.goal cannot be used with an existing-session target",
6918
+ });
6919
+ }
6920
+ });
6462
6921
  export type UpdateScheduledTaskRequest = z.infer<typeof UpdateScheduledTaskRequest>;
6463
6922
 
6464
6923
  /**
@@ -6668,10 +7127,10 @@ export const CapabilityPackComponentReference = z.discriminatedUnion("kind", [
6668
7127
  z
6669
7128
  .object({
6670
7129
  key: CapabilityPackComponentKey,
6671
- kind: z.literal("feature"),
7130
+ kind: z.literal("facet"),
6672
7131
  capabilityId: z.string().min(1).max(512),
6673
7132
  instanceKey: CapabilityPackInstanceKey,
6674
- featureKey: z.string().min(1).max(200),
7133
+ facetKey: z.string().min(1).max(200),
6675
7134
  bindingKey: CapabilityPackInstanceKey,
6676
7135
  configDigest: z.string().regex(/^[0-9a-f]{64}$/),
6677
7136
  required: z.boolean().default(true),
@@ -6880,7 +7339,7 @@ export type PackComponentResolutionStatus = z.infer<typeof PackComponentResoluti
6880
7339
  export const PackComponentResolution = z
6881
7340
  .object({
6882
7341
  key: CapabilityPackComponentKey,
6883
- kind: z.enum(["plugin", "skill", "integration", "feature", "inline_skill"]),
7342
+ kind: z.enum(["plugin", "skill", "integration", "facet", "inline_skill"]),
6884
7343
  capabilityId: z.string().min(1).max(512),
6885
7344
  required: z.boolean(),
6886
7345
  status: PackComponentResolutionStatus,
@@ -6956,7 +7415,7 @@ export const PackUninstallPreview = z
6956
7415
  z
6957
7416
  .object({
6958
7417
  key: CapabilityPackComponentKey,
6959
- kind: z.enum(["plugin", "skill", "integration", "feature", "inline_skill"]),
7418
+ kind: z.enum(["plugin", "skill", "integration", "facet", "inline_skill"]),
6960
7419
  capabilityId: z.string().min(1).max(512),
6961
7420
  retainedByOtherOwners: z.boolean(),
6962
7421
  })
@@ -7102,6 +7561,48 @@ export const OpenGeniSlackBotConnectionMetadata = z
7102
7561
  .passthrough();
7103
7562
  export type OpenGeniSlackBotConnectionMetadata = z.infer<typeof OpenGeniSlackBotConnectionMetadata>;
7104
7563
 
7564
+ export const FIKEN_PROVIDER_DOMAIN = "fiken.no" as const;
7565
+ export const FIKEN_CREDENTIAL_ROLE = "fiken_api_token" as const;
7566
+ export const FIKEN_CREDENTIAL_LABEL = "Fiken API token" as const;
7567
+
7568
+ export const FikenCompanySummary = z.object({
7569
+ slug: z.string().min(1).max(128),
7570
+ name: z.string().min(1).max(256),
7571
+ organizationNumber: z.string().max(64).nullable(),
7572
+ });
7573
+ export type FikenCompanySummary = z.infer<typeof FikenCompanySummary>;
7574
+
7575
+ export const FikenConnectionMetadata = z
7576
+ .object({
7577
+ credentialRole: z.literal(FIKEN_CREDENTIAL_ROLE),
7578
+ credentialLabel: z.literal(FIKEN_CREDENTIAL_LABEL),
7579
+ companies: z.array(FikenCompanySummary).max(100),
7580
+ defaultCompanySlug: z.string().min(1).max(128).nullable(),
7581
+ verifiedAt: z.string().datetime({ offset: true }),
7582
+ })
7583
+ .passthrough();
7584
+ export type FikenConnectionMetadata = z.infer<typeof FikenConnectionMetadata>;
7585
+
7586
+ export const FikenInstallRequest = z.object({
7587
+ apiToken: z.string().min(16).max(512),
7588
+ defaultCompanySlug: z.string().min(1).max(128).optional(),
7589
+ /** Existing Fiken connection to rewrite in place (reconnect). */
7590
+ connectionId: z.string().uuid().optional(),
7591
+ });
7592
+ export type FikenInstallRequest = z.infer<typeof FikenInstallRequest>;
7593
+
7594
+ export const FikenOAuthStartRequest = z.object({
7595
+ /** Existing Fiken connection to re-authorize in place (reconnect). */
7596
+ connectionId: z.string().uuid().optional(),
7597
+ });
7598
+ export type FikenOAuthStartRequest = z.infer<typeof FikenOAuthStartRequest>;
7599
+
7600
+ export const FikenOAuthStartResponse = z.object({
7601
+ authorizationUrl: z.string().url(),
7602
+ expiresAt: z.string().datetime({ offset: true }),
7603
+ });
7604
+ export type FikenOAuthStartResponse = z.infer<typeof FikenOAuthStartResponse>;
7605
+
7105
7606
  export const ConnectionMetadata = z.object({
7106
7607
  id: z.string().uuid(),
7107
7608
  accountId: z.string().uuid(),
@@ -7514,7 +8015,7 @@ export type CapabilityInstallation = z.infer<typeof CapabilityInstallation>;
7514
8015
 
7515
8016
  export const CreateCapabilityCatalogItemRequest = z.object({
7516
8017
  id: z.string().min(1).optional(),
7517
- kind: CapabilityKind.exclude(["pack"]),
8018
+ kind: z.literal("mcp"),
7518
8019
  source: CapabilitySource.default("manual"),
7519
8020
  name: z.string().min(1),
7520
8021
  description: z.string().min(1).optional(),
@@ -7528,7 +8029,7 @@ export const CreateCapabilityCatalogItemRequest = z.object({
7528
8029
  });
7529
8030
  export type CreateCapabilityCatalogItemRequest = z.infer<typeof CreateCapabilityCatalogItemRequest>;
7530
8031
 
7531
- export const EnableCapabilityRequest = withVariableSetIdAlias({
8032
+ export const EnableCapabilityRequest = z.object({
7532
8033
  config: z.record(z.string(), z.unknown()).default({}),
7533
8034
  metadata: z.record(z.string(), z.unknown()).default({}),
7534
8035
  connectionRef: McpServerConnectionRef.optional(),
@@ -7539,14 +8040,6 @@ export const EnableCapabilityRequest = withVariableSetIdAlias({
7539
8040
  * and never returned by the API — responses expose header names only.
7540
8041
  */
7541
8042
  headers: z.record(z.string(), z.string()).default({}),
7542
- /**
7543
- * Initial variableSet attachment for kind=pack capabilities. Mirrors the
7544
- * dedicated POST /packs/:id/enable body: required to enable an
7545
- * variableSet.required pack through the unified capability-enable path,
7546
- * optional otherwise. Ignored by non-pack capabilities.
7547
- */
7548
- variableSetId: z.string().uuid().optional(),
7549
- environmentId: z.string().uuid().optional(),
7550
8043
  });
7551
8044
  export type EnableCapabilityRequest = z.infer<typeof EnableCapabilityRequest>;
7552
8045
 
@@ -7566,6 +8059,9 @@ export type DiscoverMcpCapabilitiesResponse = z.infer<typeof DiscoverMcpCapabili
7566
8059
  export const SkillImportSource = z.enum(["github", "skills_sh"]);
7567
8060
  export type SkillImportSource = z.infer<typeof SkillImportSource>;
7568
8061
 
8062
+ export const SkillInstallationSource = z.enum(["library", "github", "skills_sh", "pack"]);
8063
+ export type SkillInstallationSource = z.infer<typeof SkillInstallationSource>;
8064
+
7569
8065
  export const PreviewSkillImportRequest = z.object({
7570
8066
  url: z.string().url().max(2048),
7571
8067
  });
@@ -7605,6 +8101,15 @@ export const InstallSkillRequest = z.object({
7605
8101
  });
7606
8102
  export type InstallSkillRequest = z.infer<typeof InstallSkillRequest>;
7607
8103
 
8104
+ export const InstallLibrarySkillRequest = z
8105
+ .object({
8106
+ expectedVersion: z.string().min(1).max(96),
8107
+ expectedContentSha256: z.string().regex(/^[0-9a-f]{64}$/),
8108
+ expectedInstallationVersion: z.number().int().positive().optional(),
8109
+ })
8110
+ .strict();
8111
+ export type InstallLibrarySkillRequest = z.infer<typeof InstallLibrarySkillRequest>;
8112
+
7608
8113
  export const InstalledSkill = z.object({
7609
8114
  capabilityId: z.string().min(1),
7610
8115
  pluginId: z.string().uuid(),
@@ -7613,7 +8118,8 @@ export const InstalledSkill = z.object({
7613
8118
  pluginInstallationId: z.string().uuid(),
7614
8119
  facetInstallationId: z.string().uuid(),
7615
8120
  installationVersion: z.number().int().positive(),
7616
- source: SkillImportSource,
8121
+ source: SkillInstallationSource,
8122
+ version: z.string().min(1).max(96),
7617
8123
  sourceUrl: z.string().url(),
7618
8124
  sourceCommit: z.string().regex(/^[0-9a-f]{40,64}$/),
7619
8125
  contentSha256: z.string().regex(/^[0-9a-f]{64}$/),
@@ -7629,6 +8135,38 @@ export const CapabilityComponentOwner = z.object({
7629
8135
  });
7630
8136
  export type CapabilityComponentOwner = z.infer<typeof CapabilityComponentOwner>;
7631
8137
 
8138
+ export const InstalledSkillSummary = z
8139
+ .object({
8140
+ capabilityId: z.string().min(1),
8141
+ pluginKey: z.string().min(1).max(200),
8142
+ installationVersion: z.number().int().positive(),
8143
+ name: z.string().min(1).max(200),
8144
+ description: z.string().max(4000),
8145
+ category: z.string().min(1).max(100),
8146
+ tags: z.array(z.string().min(1).max(100)).max(64),
8147
+ provenance: z.string().min(1).max(4000),
8148
+ source: SkillInstallationSource,
8149
+ version: z.string().min(1).max(96),
8150
+ sourceUrl: z.string().url().max(2048),
8151
+ repositoryUrl: z.string().url().max(2048),
8152
+ sourceCommit: z.string().regex(/^[0-9a-f]{40,64}$/),
8153
+ sourcePath: z.string().min(1).max(1024),
8154
+ contentSha256: z.string().regex(/^[0-9a-f]{64}$/),
8155
+ fileCount: z.number().int().positive().max(128),
8156
+ totalBytes: z.number().int().positive().max(1048576),
8157
+ license: z.string().min(1).max(200).nullable(),
8158
+ installedAt: z.string().datetime({ offset: true }),
8159
+ updatedAt: z.string().datetime({ offset: true }),
8160
+ owners: z.array(CapabilityComponentOwner).min(1),
8161
+ })
8162
+ .strict();
8163
+ export type InstalledSkillSummary = z.infer<typeof InstalledSkillSummary>;
8164
+
8165
+ export const ListInstalledSkillsResponse = z
8166
+ .object({ skills: z.array(InstalledSkillSummary).max(1000) })
8167
+ .strict();
8168
+ export type ListInstalledSkillsResponse = z.infer<typeof ListInstalledSkillsResponse>;
8169
+
7632
8170
  export const SkillUninstallPreview = z.object({
7633
8171
  capabilityId: z.string().min(1),
7634
8172
  installed: z.boolean(),
@@ -7654,26 +8192,29 @@ export type UninstallSkillResult = z.infer<typeof UninstallSkillResult>;
7654
8192
  export const ApiIntegrationProtocol = z.enum(["openapi", "graphql"]);
7655
8193
  export type ApiIntegrationProtocol = z.infer<typeof ApiIntegrationProtocol>;
7656
8194
 
7657
- export const IntegrationFeatureKey = z
8195
+ export const IntegrationDefinitionProvenance = z.enum(["curated", "workspace"]);
8196
+ export type IntegrationDefinitionProvenance = z.infer<typeof IntegrationDefinitionProvenance>;
8197
+
8198
+ export const IntegrationFacetKey = z
7658
8199
  .string()
7659
8200
  .min(1)
7660
8201
  .max(200)
7661
8202
  .regex(/^[a-z0-9](?:[a-z0-9._/-]*[a-z0-9])?$/);
7662
- export type IntegrationFeatureKey = z.infer<typeof IntegrationFeatureKey>;
8203
+ export type IntegrationFacetKey = z.infer<typeof IntegrationFacetKey>;
7663
8204
 
7664
- export const IntegrationFeatureKind = z.enum([
8205
+ export const IntegrationFacetKind = z.enum([
7665
8206
  "tools",
7666
8207
  "knowledge_source",
7667
8208
  "inbound_trigger",
7668
8209
  "delivery_destination",
7669
8210
  "identity_link",
7670
8211
  ]);
7671
- export type IntegrationFeatureKind = z.infer<typeof IntegrationFeatureKind>;
8212
+ export type IntegrationFacetKind = z.infer<typeof IntegrationFacetKind>;
7672
8213
 
7673
- export const IntegrationFeatureStatus = z.enum(["active", "paused", "needs_attention", "disabled"]);
7674
- export type IntegrationFeatureStatus = z.infer<typeof IntegrationFeatureStatus>;
8214
+ export const IntegrationFacetStatus = z.enum(["active", "paused", "needs_attention", "disabled"]);
8215
+ export type IntegrationFacetStatus = z.infer<typeof IntegrationFacetStatus>;
7675
8216
 
7676
- const IntegrationFeatureJsonObject = z.record(z.string(), z.unknown()).superRefine((value, ctx) => {
8217
+ const IntegrationFacetJsonObject = z.record(z.string(), z.unknown()).superRefine((value, ctx) => {
7677
8218
  let serialized: string;
7678
8219
  try {
7679
8220
  serialized = JSON.stringify(value);
@@ -7682,40 +8223,50 @@ const IntegrationFeatureJsonObject = z.record(z.string(), z.unknown()).superRefi
7682
8223
  return;
7683
8224
  }
7684
8225
  if (new TextEncoder().encode(serialized).byteLength > 131_072) {
7685
- ctx.addIssue({ code: "custom", message: "must not exceed 131072 UTF-8 bytes" });
8226
+ ctx.addIssue({
8227
+ code: "custom",
8228
+ message: "must not exceed 131072 UTF-8 bytes",
8229
+ });
7686
8230
  }
7687
8231
  });
7688
8232
 
7689
- export const IntegrationFeatureDefinitionSummary = z
8233
+ export const IntegrationFacetDefinitionSummary = z
7690
8234
  .object({
7691
- featureKey: IntegrationFeatureKey,
7692
- kind: IntegrationFeatureKind.exclude(["tools"]),
7693
- configSchema: IntegrationFeatureJsonObject,
7694
- capabilities: IntegrationFeatureJsonObject,
8235
+ facetKey: IntegrationFacetKey,
8236
+ kind: IntegrationFacetKind.exclude(["tools"]),
8237
+ configSchema: IntegrationFacetJsonObject,
8238
+ capabilities: IntegrationFacetJsonObject,
7695
8239
  })
7696
8240
  .strict();
7697
- export type IntegrationFeatureDefinitionSummary = z.infer<
7698
- typeof IntegrationFeatureDefinitionSummary
7699
- >;
8241
+ export type IntegrationFacetDefinitionSummary = z.infer<typeof IntegrationFacetDefinitionSummary>;
7700
8242
 
7701
- export const ApiIntegrationPresetSummary = z
8243
+ export const IntegrationDefinitionSummary = z
7702
8244
  .object({
7703
8245
  id: z.string().min(1).max(128),
7704
8246
  name: z.string().min(1).max(200),
7705
8247
  summary: z.string().min(1).max(1000),
7706
- family: z.enum(["google", "microsoft"]),
7707
8248
  protocol: z.literal("openapi"),
7708
- providerDomain: z.string().min(1).max(253),
7709
- scopes: z.array(z.string().min(1).max(1024)).max(256),
7710
- features: z.array(IntegrationFeatureDefinitionSummary).max(128),
8249
+ provider: z
8250
+ .object({
8251
+ id: z.enum(["google", "microsoft"]),
8252
+ domain: z.string().min(1).max(253),
8253
+ })
8254
+ .strict(),
8255
+ authentication: z
8256
+ .object({
8257
+ kind: z.literal("oauth2"),
8258
+ scopes: z.array(z.string().min(1).max(1024)).max(256),
8259
+ })
8260
+ .strict(),
8261
+ facets: z.array(IntegrationFacetDefinitionSummary).max(128),
7711
8262
  })
7712
8263
  .strict();
7713
- export type ApiIntegrationPresetSummary = z.infer<typeof ApiIntegrationPresetSummary>;
8264
+ export type IntegrationDefinitionSummary = z.infer<typeof IntegrationDefinitionSummary>;
7714
8265
 
7715
- export const ListApiIntegrationPresetsResponse = z
7716
- .object({ presets: z.array(ApiIntegrationPresetSummary).max(128) })
8266
+ export const ListIntegrationDefinitionsResponse = z
8267
+ .object({ definitions: z.array(IntegrationDefinitionSummary).max(128) })
7717
8268
  .strict();
7718
- export type ListApiIntegrationPresetsResponse = z.infer<typeof ListApiIntegrationPresetsResponse>;
8269
+ export type ListIntegrationDefinitionsResponse = z.infer<typeof ListIntegrationDefinitionsResponse>;
7719
8270
 
7720
8271
  export const IntegrationInstanceKey = z
7721
8272
  .string()
@@ -7724,16 +8275,16 @@ export const IntegrationInstanceKey = z
7724
8275
  .regex(/^[a-z0-9](?:[a-z0-9._/-]*[a-z0-9])?$/);
7725
8276
  export type IntegrationInstanceKey = z.infer<typeof IntegrationInstanceKey>;
7726
8277
 
7727
- export const IntegrationFeatureBindingSummary = z
8278
+ export const IntegrationFacetBindingSummary = z
7728
8279
  .object({
7729
8280
  id: z.string().uuid(),
7730
- featureKey: IntegrationFeatureKey,
7731
- kind: IntegrationFeatureKind.exclude(["tools"]),
8281
+ facetKey: IntegrationFacetKey,
8282
+ kind: IntegrationFacetKind.exclude(["tools"]),
7732
8283
  bindingKey: IntegrationInstanceKey,
7733
8284
  displayName: z.string().min(1).max(200),
7734
8285
  connectionId: z.string().uuid().nullable(),
7735
- status: IntegrationFeatureStatus,
7736
- config: IntegrationFeatureJsonObject,
8286
+ status: IntegrationFacetStatus,
8287
+ config: IntegrationFacetJsonObject,
7737
8288
  version: z.number().int().positive(),
7738
8289
  hasCursor: z.boolean(),
7739
8290
  lastSuccessAt: z.string().datetime({ offset: true }).nullable(),
@@ -7742,73 +8293,76 @@ export const IntegrationFeatureBindingSummary = z
7742
8293
  updatedAt: z.string().datetime({ offset: true }),
7743
8294
  })
7744
8295
  .strict();
7745
- export type IntegrationFeatureBindingSummary = z.infer<typeof IntegrationFeatureBindingSummary>;
8296
+ export type IntegrationFacetBindingSummary = z.infer<typeof IntegrationFacetBindingSummary>;
7746
8297
 
7747
- export const IntegrationInstanceFeaturesResponse = z
8298
+ export const IntegrationInstanceFacetsResponse = z
7748
8299
  .object({
7749
8300
  capabilityId: z.string().min(1).max(512),
7750
8301
  instanceKey: IntegrationInstanceKey,
7751
8302
  providerDomain: z.string().min(1).max(253),
7752
8303
  connectionId: z.string().uuid().nullable(),
7753
- features: z
8304
+ facets: z
7754
8305
  .array(
7755
8306
  z
7756
8307
  .object({
7757
- definition: IntegrationFeatureDefinitionSummary,
7758
- binding: IntegrationFeatureBindingSummary.nullable(),
8308
+ definition: IntegrationFacetDefinitionSummary,
8309
+ binding: IntegrationFacetBindingSummary.nullable(),
7759
8310
  })
7760
8311
  .strict(),
7761
8312
  )
7762
8313
  .max(128),
7763
8314
  })
7764
8315
  .strict();
7765
- export type IntegrationInstanceFeaturesResponse = z.infer<
7766
- typeof IntegrationInstanceFeaturesResponse
7767
- >;
8316
+ export type IntegrationInstanceFacetsResponse = z.infer<typeof IntegrationInstanceFacetsResponse>;
7768
8317
 
7769
- export const UpsertIntegrationFeatureRequest = z
8318
+ export const UpsertIntegrationFacetRequest = z
7770
8319
  .object({
7771
8320
  displayName: z.string().min(1).max(200),
7772
- config: IntegrationFeatureJsonObject.default({}),
8321
+ config: IntegrationFacetJsonObject.default({}),
7773
8322
  expectedVersion: z.number().int().positive().optional(),
7774
8323
  idempotencyKey: z.string().uuid(),
7775
8324
  })
7776
8325
  .strict();
7777
- export type UpsertIntegrationFeatureRequest = z.infer<typeof UpsertIntegrationFeatureRequest>;
8326
+ export type UpsertIntegrationFacetRequest = z.infer<typeof UpsertIntegrationFacetRequest>;
7778
8327
 
7779
- export const MutateIntegrationFeatureRequest = z
8328
+ export const MutateIntegrationFacetRequest = z
7780
8329
  .object({
7781
8330
  expectedVersion: z.number().int().positive(),
7782
8331
  idempotencyKey: z.string().uuid(),
7783
8332
  })
7784
8333
  .strict();
7785
- export type MutateIntegrationFeatureRequest = z.infer<typeof MutateIntegrationFeatureRequest>;
8334
+ export type MutateIntegrationFacetRequest = z.infer<typeof MutateIntegrationFacetRequest>;
7786
8335
 
7787
- export const IntegrationFeatureMutationResult = z
8336
+ export const IntegrationFacetMutationResult = z
7788
8337
  .object({
7789
8338
  capabilityId: z.string().min(1).max(512),
7790
8339
  instanceKey: IntegrationInstanceKey,
7791
- featureKey: IntegrationFeatureKey,
8340
+ facetKey: IntegrationFacetKey,
7792
8341
  status: z.enum(["configured", "paused", "active"]),
7793
- binding: IntegrationFeatureBindingSummary,
8342
+ binding: IntegrationFacetBindingSummary,
7794
8343
  })
7795
8344
  .strict();
7796
- export type IntegrationFeatureMutationResult = z.infer<typeof IntegrationFeatureMutationResult>;
8345
+ export type IntegrationFacetMutationResult = z.infer<typeof IntegrationFacetMutationResult>;
7797
8346
 
7798
- export const IntegrationFeatureRemovalResult = z
8347
+ export const IntegrationFacetRemovalResult = z
7799
8348
  .object({
7800
8349
  capabilityId: z.string().min(1).max(512),
7801
8350
  instanceKey: IntegrationInstanceKey,
7802
- featureKey: IntegrationFeatureKey,
8351
+ facetKey: IntegrationFacetKey,
7803
8352
  status: z.enum(["not_configured", "removed", "retained_by_other_owners"]),
7804
- binding: IntegrationFeatureBindingSummary.nullable(),
8353
+ binding: IntegrationFacetBindingSummary.nullable(),
7805
8354
  remainingOwners: z.array(CapabilityComponentOwner),
7806
8355
  })
7807
8356
  .strict();
7808
- export type IntegrationFeatureRemovalResult = z.infer<typeof IntegrationFeatureRemovalResult>;
8357
+ export type IntegrationFacetRemovalResult = z.infer<typeof IntegrationFacetRemovalResult>;
7809
8358
 
7810
- export const ApiIntegrationSource = z.discriminatedUnion("kind", [
7811
- z.object({ kind: z.literal("preset"), presetId: z.string().min(1).max(128) }).strict(),
8359
+ export const IntegrationSource = z.discriminatedUnion("kind", [
8360
+ z
8361
+ .object({
8362
+ kind: z.literal("definition"),
8363
+ definitionId: z.string().min(1).max(128),
8364
+ })
8365
+ .strict(),
7812
8366
  z
7813
8367
  .object({
7814
8368
  kind: z.literal("openapi"),
@@ -7831,11 +8385,11 @@ export const ApiIntegrationSource = z.discriminatedUnion("kind", [
7831
8385
  })
7832
8386
  .strict(),
7833
8387
  ]);
7834
- export type ApiIntegrationSource = z.infer<typeof ApiIntegrationSource>;
8388
+ export type IntegrationSource = z.infer<typeof IntegrationSource>;
7835
8389
 
7836
8390
  export const PreviewApiIntegrationRequest = z
7837
8391
  .object({
7838
- source: ApiIntegrationSource,
8392
+ source: IntegrationSource,
7839
8393
  connectionId: z.string().uuid().optional(),
7840
8394
  ownership: ConnectionOwnership.optional(),
7841
8395
  })
@@ -7844,7 +8398,7 @@ export type PreviewApiIntegrationRequest = z.infer<typeof PreviewApiIntegrationR
7844
8398
 
7845
8399
  export const ApiIntegrationOAuthStartRequest = z
7846
8400
  .object({
7847
- presetId: z.string().min(1).max(128),
8401
+ definitionId: z.string().min(1).max(128),
7848
8402
  ownership: ConnectionOwnership.optional(),
7849
8403
  connectionId: z.string().uuid().optional(),
7850
8404
  returnPath: z.string().min(1).max(2048).optional(),
@@ -7861,7 +8415,7 @@ export const ApiIntegrationOAuthConnectionMetadata = z
7861
8415
  providerPrincipalId: z.string().min(1).max(512),
7862
8416
  providerEmail: z.string().min(1).max(512).nullable(),
7863
8417
  providerDisplayName: z.string().min(1).max(512).nullable(),
7864
- authorizedPresetIds: z.array(z.string().min(1).max(128)).min(1).max(32),
8418
+ authorizedDefinitionIds: z.array(z.string().min(1).max(128)).min(1).max(32),
7865
8419
  verifiedAt: z.string().datetime({ offset: true }),
7866
8420
  })
7867
8421
  .passthrough();
@@ -7911,10 +8465,10 @@ export type ApiIntegrationToolPreview = z.infer<typeof ApiIntegrationToolPreview
7911
8465
 
7912
8466
  export const ApiIntegrationPreview = z
7913
8467
  .object({
7914
- source: ApiIntegrationSource,
7915
- presetId: z.string().min(1).max(128).nullable(),
8468
+ source: IntegrationSource,
8469
+ definitionId: z.string().min(1).max(200),
8470
+ definitionProvenance: IntegrationDefinitionProvenance,
7916
8471
  protocol: ApiIntegrationProtocol,
7917
- integrationId: z.string().min(1).max(200),
7918
8472
  capabilityId: z.string().min(1).max(512),
7919
8473
  pluginKey: z.string().min(1).max(200),
7920
8474
  serverId: SessionMcpServerId,
@@ -7937,7 +8491,7 @@ export type ApiIntegrationPreview = z.infer<typeof ApiIntegrationPreview>;
7937
8491
 
7938
8492
  export const InstallApiIntegrationRequest = z
7939
8493
  .object({
7940
- source: ApiIntegrationSource,
8494
+ source: IntegrationSource,
7941
8495
  expectedRevisionId: z.string().min(1).max(96),
7942
8496
  expectedContentSha256: z.string().regex(/^[0-9a-f]{64}$/),
7943
8497
  connectionId: z.string().uuid().optional(),
@@ -7985,7 +8539,8 @@ export const ApiIntegrationInstallationSummary = z
7985
8539
  name: z.string().min(1),
7986
8540
  description: z.string().nullable(),
7987
8541
  protocol: ApiIntegrationProtocol,
7988
- presetId: z.string().min(1).max(128).nullable(),
8542
+ definitionId: z.string().min(1).max(200),
8543
+ definitionProvenance: IntegrationDefinitionProvenance,
7989
8544
  providerDomain: z.string().min(1),
7990
8545
  baseUrl: z.string().url(),
7991
8546
  sourceUrl: z.string().url().nullable(),
@@ -8065,13 +8620,17 @@ export const PluginManifest = z
8065
8620
  .array(
8066
8621
  z.discriminatedUnion("kind", [
8067
8622
  z
8068
- .object({ key: PluginComponentKey, kind: z.literal("skill"), url: z.string().url() })
8623
+ .object({
8624
+ key: PluginComponentKey,
8625
+ kind: z.literal("skill"),
8626
+ url: z.string().url(),
8627
+ })
8069
8628
  .strict(),
8070
8629
  z
8071
8630
  .object({
8072
8631
  key: PluginComponentKey,
8073
8632
  kind: z.literal("integration"),
8074
- source: ApiIntegrationSource,
8633
+ source: IntegrationSource,
8075
8634
  })
8076
8635
  .strict(),
8077
8636
  z
@@ -8166,7 +8725,12 @@ export const InstallPluginRequest = z
8166
8725
  expectedManifestDigest: z.string().regex(/^[0-9a-f]{64}$/),
8167
8726
  expectedComponents: z
8168
8727
  .array(
8169
- z.object({ key: PluginComponentKey, digest: z.string().regex(/^[0-9a-f]{64}$/) }).strict(),
8728
+ z
8729
+ .object({
8730
+ key: PluginComponentKey,
8731
+ digest: z.string().regex(/^[0-9a-f]{64}$/),
8732
+ })
8733
+ .strict(),
8170
8734
  )
8171
8735
  .min(1)
8172
8736
  .max(64),
@@ -8276,6 +8840,8 @@ export const Session = z.object({
8276
8840
  // the workspace runtime registry.
8277
8841
  effectiveToolPolicy: SessionEffectiveToolPolicy.optional(),
8278
8842
  metadata: z.record(z.string(), z.unknown()),
8843
+ /** Additive public tenancy projection; omitted by legacy/internal readers. */
8844
+ tenancy: SessionTenancyPublicProjection.optional(),
8279
8845
  /** Frozen creator fact used only for creation attribution/idempotent repair. */
8280
8846
  createdBy: TurnInitiator,
8281
8847
  createdByContext: TurnInitiatorContext,
@@ -8307,6 +8873,9 @@ export const Session = z.object({
8307
8873
  // Both null ⇒ a rig-less session (byte-for-byte today's behavior).
8308
8874
  rigId: z.string().uuid().nullable().default(null),
8309
8875
  rigVersionId: z.string().uuid().nullable().default(null),
8876
+ // Workspace channel this session is filed under (rail organization only;
8877
+ // a session tree is grouped by its ROOT session's channel). Null = unfiled.
8878
+ channelId: z.string().uuid().nullable().default(null),
8310
8879
  // Non-default first-party MCP token permissions (manager-style sessions);
8311
8880
  // null means the fixed worker default set.
8312
8881
  firstPartyMcpPermissions: z.array(Permission).nullable(),
@@ -8486,6 +9055,7 @@ export type SessionLineageResponse = z.infer<typeof SessionLineageResponse>;
8486
9055
 
8487
9056
  export const SessionEventType = z.enum([
8488
9057
  "session.created",
9058
+ "session.visibility.changed",
8489
9059
  // Defensive read/transport projection for a malformed or historically
8490
9060
  // oversized retained event envelope. The original row stays durable; this
8491
9061
  // explicit synthetic type prevents unbounded free-form envelope fields from
@@ -8536,6 +9106,9 @@ export const SessionEventType = z.enum([
8536
9106
  "artifact.created",
8537
9107
  "goal.set",
8538
9108
  "goal.updated",
9109
+ "goal.progress",
9110
+ "goal.rewrite.proposed",
9111
+ "goal.rewrite.rejected",
8539
9112
  "goal.completed",
8540
9113
  "goal.paused",
8541
9114
  "goal.resumed",
@@ -8739,6 +9312,9 @@ export const SESSION_EVENT_SEMANTIC_CLASS_TYPES = {
8739
9312
  "user.humanInputResponse",
8740
9313
  "goal.set",
8741
9314
  "goal.updated",
9315
+ "goal.progress",
9316
+ "goal.rewrite.proposed",
9317
+ "goal.rewrite.rejected",
8742
9318
  "goal.completed",
8743
9319
  "goal.paused",
8744
9320
  "goal.resumed",
@@ -10712,6 +11288,10 @@ export const CreateSessionRequest = withVariableSetIdAlias({
10712
11288
  // null ⇒ explicitly create a rig-less session; UUID ⇒ bind that exact rig.
10713
11289
  // An id that does not name a rig in the workspace is a 422.
10714
11290
  rigId: z.string().uuid().nullable().optional(),
11291
+ // The workspace channel to file this session under (rail organization only).
11292
+ // Omitted/null ⇒ unfiled (inbox). An id that does not name a channel in the
11293
+ // workspace is a 422.
11294
+ channelId: z.string().uuid().nullable().optional(),
10715
11295
  goal: GoalSpec.optional(),
10716
11296
  clientEventId: SessionOperationKey.optional(),
10717
11297
  // Workspace-scoped CREATE idempotency key: collapses concurrent/retried
@@ -11171,7 +11751,7 @@ export const SessionCapabilities = z.object({
11171
11751
  reason: CapabilityUnavailableReason.nullable(),
11172
11752
  }),
11173
11753
  Terminal: z.object({
11174
- transport: z.enum(["sse-events", "pty-ws"]).nullable(),
11754
+ transport: z.enum(["sse-events", "pty-ws", "relay-pty"]).nullable(),
11175
11755
  ptyCapable: z.boolean(),
11176
11756
  shell: z.string(),
11177
11757
  // The direct-to-provider ttyd PTY-over-websocket URL (pty-ws) resolved on the
@@ -11288,7 +11868,7 @@ export const AttachViewerResponse = /* @__PURE__ */ ViewerHolder.extend({
11288
11868
  terminalUrl: z.string().nullable(),
11289
11869
  terminalToken: z.string().nullable(),
11290
11870
  terminalExpiresAt: z.string().nullable(),
11291
- terminalTransport: z.literal("pty-ws").nullable(),
11871
+ terminalTransport: z.enum(["pty-ws", "relay-pty"]).nullable(),
11292
11872
  });
11293
11873
  export type AttachViewerResponse = z.infer<typeof AttachViewerResponse>;
11294
11874
 
@@ -11828,7 +12408,7 @@ export const ModelCredentialSourceV1 =
11828
12408
  z
11829
12409
  .object({
11830
12410
  kind: z.literal("connected_subscription"),
11831
- provider: z.literal("codex"),
12411
+ provider: z.enum(["codex", "xai"]),
11832
12412
  })
11833
12413
  .strict(),
11834
12414
  z
@@ -12039,7 +12619,7 @@ export const ClientModel = /* @__PURE__ */ defineModelContractSchema(() =>
12039
12619
  provider: z.string(), // provider id
12040
12620
  providerLabel: z.string(),
12041
12621
  api: z.enum(["responses", "chat"]),
12042
- source: z.enum(["opengeni", "codex", "workspace_gateway"]).optional(),
12622
+ source: z.enum(["opengeni", "codex", "supergrok", "workspace_gateway"]).optional(),
12043
12623
  contextWindowTokens: z.number().int().positive().optional(),
12044
12624
  // Additive normalized definition metadata. Optional so older server payloads
12045
12625
  // remain parseable; current servers project the complete V1 set.
@@ -12200,6 +12780,15 @@ export const ClientConfig = /* @__PURE__ */ defineModelContractSchema(() =>
12200
12780
  }),
12201
12781
  )
12202
12782
  .default([]),
12783
+ firstPartyMcpTools: z
12784
+ .object({
12785
+ default: z.array(FirstPartyMcpToolName),
12786
+ allowed: z.array(FirstPartyMcpToolName),
12787
+ })
12788
+ .default({
12789
+ default: [...DEFAULT_FIRST_PARTY_MCP_TOOLS],
12790
+ allowed: [...FIRST_PARTY_MCP_TOOL_NAMES],
12791
+ }),
12203
12792
  fileUploads: z.object({
12204
12793
  enabled: z.boolean(),
12205
12794
  maxSizeBytes: z.number().int().positive(),
@@ -12334,9 +12923,13 @@ export function evaluateWorkspaceModelPolicy(
12334
12923
  }
12335
12924
 
12336
12925
  export * from "./codex-fleet-policy";
12926
+ export * from "./xai-provider-account-authority";
12337
12927
  export * from "./workspace-instruction-policies";
12338
12928
  export * from "./company-profile";
12339
12929
  export * from "./workspace-learning-policy";
12340
12930
  export * from "./workspace-state";
12341
12931
  export * from "./preference-registry";
12342
12932
  export * from "./scoped-knowledge";
12933
+ export * from "./knowledge";
12934
+ export * from "./task-notes";
12935
+ export * from "./canonical-human-identities";