@opengeni/contracts 0.32.0 → 0.36.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.
@@ -43,6 +43,46 @@ export declare const GoogleDriveReadPolicy: z.ZodEnum<{
43
43
  block: "block";
44
44
  }>;
45
45
  export type GoogleDriveReadPolicy = z.infer<typeof GoogleDriveReadPolicy>;
46
+ export declare const GoogleDriveConnectionLifecycleState: z.ZodEnum<{
47
+ active: "active";
48
+ app_removed: "app_removed";
49
+ disconnected: "disconnected";
50
+ paused: "paused";
51
+ reconnect_required: "reconnect_required";
52
+ reconsent_required: "reconsent_required";
53
+ token_revoked: "token_revoked";
54
+ }>;
55
+ export type GoogleDriveConnectionLifecycleState = z.infer<typeof GoogleDriveConnectionLifecycleState>;
56
+ export declare const GoogleDriveConnectionLifecycle: z.ZodDiscriminatedUnion<[z.ZodObject<{
57
+ state: z.ZodLiteral<"active">;
58
+ recoverable: z.ZodLiteral<true>;
59
+ observedAt: z.ZodString;
60
+ }, z.core.$strip>, z.ZodObject<{
61
+ state: z.ZodLiteral<"paused">;
62
+ recoverable: z.ZodLiteral<true>;
63
+ observedAt: z.ZodString;
64
+ }, z.core.$strip>, z.ZodObject<{
65
+ state: z.ZodLiteral<"token_revoked">;
66
+ recoverable: z.ZodLiteral<true>;
67
+ observedAt: z.ZodString;
68
+ }, z.core.$strip>, z.ZodObject<{
69
+ state: z.ZodLiteral<"app_removed">;
70
+ recoverable: z.ZodLiteral<false>;
71
+ observedAt: z.ZodString;
72
+ }, z.core.$strip>, z.ZodObject<{
73
+ state: z.ZodLiteral<"disconnected">;
74
+ recoverable: z.ZodLiteral<true>;
75
+ observedAt: z.ZodString;
76
+ }, z.core.$strip>, z.ZodObject<{
77
+ state: z.ZodLiteral<"reconnect_required">;
78
+ recoverable: z.ZodLiteral<true>;
79
+ observedAt: z.ZodString;
80
+ }, z.core.$strip>, z.ZodObject<{
81
+ state: z.ZodLiteral<"reconsent_required">;
82
+ recoverable: z.ZodLiteral<true>;
83
+ observedAt: z.ZodString;
84
+ }, z.core.$strip>], "state">;
85
+ export type GoogleDriveConnectionLifecycle = z.infer<typeof GoogleDriveConnectionLifecycle>;
46
86
  export declare const GoogleDriveSelectedSource: z.ZodObject<{
47
87
  id: z.ZodString;
48
88
  name: z.ZodString;
@@ -77,6 +117,35 @@ export declare const GoogleDriveConnectionMetadata: z.ZodObject<{
77
117
  metadata_readonly: "metadata_readonly";
78
118
  readonly: "readonly";
79
119
  }>;
120
+ lifecycle: z.ZodOptional<z.ZodDiscriminatedUnion<[z.ZodObject<{
121
+ state: z.ZodLiteral<"active">;
122
+ recoverable: z.ZodLiteral<true>;
123
+ observedAt: z.ZodString;
124
+ }, z.core.$strip>, z.ZodObject<{
125
+ state: z.ZodLiteral<"paused">;
126
+ recoverable: z.ZodLiteral<true>;
127
+ observedAt: z.ZodString;
128
+ }, z.core.$strip>, z.ZodObject<{
129
+ state: z.ZodLiteral<"token_revoked">;
130
+ recoverable: z.ZodLiteral<true>;
131
+ observedAt: z.ZodString;
132
+ }, z.core.$strip>, z.ZodObject<{
133
+ state: z.ZodLiteral<"app_removed">;
134
+ recoverable: z.ZodLiteral<false>;
135
+ observedAt: z.ZodString;
136
+ }, z.core.$strip>, z.ZodObject<{
137
+ state: z.ZodLiteral<"disconnected">;
138
+ recoverable: z.ZodLiteral<true>;
139
+ observedAt: z.ZodString;
140
+ }, z.core.$strip>, z.ZodObject<{
141
+ state: z.ZodLiteral<"reconnect_required">;
142
+ recoverable: z.ZodLiteral<true>;
143
+ observedAt: z.ZodString;
144
+ }, z.core.$strip>, z.ZodObject<{
145
+ state: z.ZodLiteral<"reconsent_required">;
146
+ recoverable: z.ZodLiteral<true>;
147
+ observedAt: z.ZodString;
148
+ }, z.core.$strip>], "state">>;
80
149
  selectedSources: z.ZodOptional<z.ZodArray<z.ZodObject<{
81
150
  id: z.ZodString;
82
151
  name: z.ZodString;
@@ -132,6 +201,19 @@ export declare const GoogleDriveOAuthStartResponse: z.ZodObject<{
132
201
  expiresAt: z.ZodString;
133
202
  }, z.core.$strip>;
134
203
  export type GoogleDriveOAuthStartResponse = z.infer<typeof GoogleDriveOAuthStartResponse>;
204
+ export declare const GoogleDriveLifecycleActionRequest: z.ZodObject<{
205
+ action: z.ZodEnum<{
206
+ pause: "pause";
207
+ resume: "resume";
208
+ }>;
209
+ expectedVersion: z.ZodNumber;
210
+ }, z.core.$strip>;
211
+ export type GoogleDriveLifecycleActionRequest = z.infer<typeof GoogleDriveLifecycleActionRequest>;
212
+ export declare const GoogleDriveDisconnectRequest: z.ZodObject<{
213
+ expectedVersion: z.ZodNumber;
214
+ idempotencyKey: z.ZodString;
215
+ }, z.core.$strip>;
216
+ export type GoogleDriveDisconnectRequest = z.infer<typeof GoogleDriveDisconnectRequest>;
135
217
  export declare const GoogleDriveBrowseItem: z.ZodObject<{
136
218
  id: z.ZodString;
137
219
  name: z.ZodString;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ConnectionMetadata
3
- } from "./chunk-GMOYIHF3.js";
3
+ } from "./chunk-F4KMLKSL.js";
4
4
  import "./chunk-7JZMI22I.js";
5
5
 
6
6
  // src/google-drive.ts
@@ -41,6 +41,53 @@ function googleDriveScopesAllowCapability(grantedScopes, capability) {
41
41
  var GoogleDriveTargetScope = z.enum(["user", "workspace", "organization"]);
42
42
  var GoogleDriveSyncCadence = z.enum(["manual", "hourly", "daily"]);
43
43
  var GoogleDriveReadPolicy = z.enum(["allow", "ask", "block"]);
44
+ var GoogleDriveConnectionLifecycleState = z.enum([
45
+ "active",
46
+ "paused",
47
+ "token_revoked",
48
+ "app_removed",
49
+ "disconnected",
50
+ "reconnect_required",
51
+ "reconsent_required"
52
+ ]);
53
+ var GoogleDriveLifecycleObservedAt = z.string().datetime({ offset: true });
54
+ var GoogleDriveConnectionLifecycle = z.discriminatedUnion("state", [
55
+ z.object({
56
+ state: z.literal("active"),
57
+ recoverable: z.literal(true),
58
+ observedAt: GoogleDriveLifecycleObservedAt
59
+ }),
60
+ z.object({
61
+ state: z.literal("paused"),
62
+ recoverable: z.literal(true),
63
+ observedAt: GoogleDriveLifecycleObservedAt
64
+ }),
65
+ z.object({
66
+ state: z.literal("token_revoked"),
67
+ recoverable: z.literal(true),
68
+ observedAt: GoogleDriveLifecycleObservedAt
69
+ }),
70
+ z.object({
71
+ state: z.literal("app_removed"),
72
+ recoverable: z.literal(false),
73
+ observedAt: GoogleDriveLifecycleObservedAt
74
+ }),
75
+ z.object({
76
+ state: z.literal("disconnected"),
77
+ recoverable: z.literal(true),
78
+ observedAt: GoogleDriveLifecycleObservedAt
79
+ }),
80
+ z.object({
81
+ state: z.literal("reconnect_required"),
82
+ recoverable: z.literal(true),
83
+ observedAt: GoogleDriveLifecycleObservedAt
84
+ }),
85
+ z.object({
86
+ state: z.literal("reconsent_required"),
87
+ recoverable: z.literal(true),
88
+ observedAt: GoogleDriveLifecycleObservedAt
89
+ })
90
+ ]);
44
91
  var GoogleDriveSelectedSource = z.object({
45
92
  id: z.string().min(1).max(256),
46
93
  name: z.string().min(1).max(1024),
@@ -59,6 +106,7 @@ var GoogleDriveConnectionMetadata = z.object({
59
106
  googleDisplayName: z.string().min(1).max(512).nullable(),
60
107
  verifiedAt: z.string().datetime({ offset: true }),
61
108
  accessMode: z.enum(["metadata_readonly", "readonly"]),
109
+ lifecycle: GoogleDriveConnectionLifecycle.optional(),
62
110
  selectedSources: z.array(GoogleDriveSelectedSource).max(100).optional(),
63
111
  /** @deprecated Read `selectedSources`; retained while existing connections migrate. */
64
112
  selectedSource: GoogleDriveSelectedSource.nullable().optional()
@@ -70,6 +118,14 @@ var GoogleDriveOAuthStartResponse = z.object({
70
118
  authorizationUrl: z.string().url(),
71
119
  expiresAt: z.string().datetime({ offset: true })
72
120
  });
121
+ var GoogleDriveLifecycleActionRequest = z.object({
122
+ action: z.enum(["pause", "resume"]),
123
+ expectedVersion: z.number().int().positive()
124
+ });
125
+ var GoogleDriveDisconnectRequest = z.object({
126
+ expectedVersion: z.number().int().positive(),
127
+ idempotencyKey: z.string().trim().min(1).max(200)
128
+ });
73
129
  var GoogleDriveBrowseItem = z.object({
74
130
  id: z.string().min(1).max(256),
75
131
  name: z.string().min(1).max(1024),
@@ -113,7 +169,11 @@ export {
113
169
  GOOGLE_DRIVE_READONLY_SCOPE,
114
170
  GoogleDriveBrowseItem,
115
171
  GoogleDriveBrowseResponse,
172
+ GoogleDriveConnectionLifecycle,
173
+ GoogleDriveConnectionLifecycleState,
116
174
  GoogleDriveConnectionMetadata,
175
+ GoogleDriveDisconnectRequest,
176
+ GoogleDriveLifecycleActionRequest,
117
177
  GoogleDriveOAuthCapability,
118
178
  GoogleDriveOAuthStartRequest,
119
179
  GoogleDriveOAuthStartResponse,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/google-drive.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { ConnectionMetadata } from \"./index\";\n\nexport const GOOGLE_DRIVE_PROVIDER_DOMAIN = \"googleapis.com\" as const;\nexport const GOOGLE_DRIVE_FULL_SCOPE = \"https://www.googleapis.com/auth/drive\" as const;\nexport const GOOGLE_DRIVE_FILE_SCOPE = \"https://www.googleapis.com/auth/drive.file\" as const;\nexport const GOOGLE_DRIVE_METADATA_READONLY_SCOPE =\n \"https://www.googleapis.com/auth/drive.metadata.readonly\" as const;\nexport const GOOGLE_DRIVE_READONLY_SCOPE =\n \"https://www.googleapis.com/auth/drive.readonly\" as const;\nexport const GOOGLE_DRIVE_CREDENTIAL_ROLE = \"google_drive_metadata\" as const;\nexport const GOOGLE_DRIVE_CREDENTIAL_LABEL = \"Google Drive metadata browser\" as const;\n\nexport const GoogleDriveOAuthCapability = z.enum([\n \"picker_file_read\",\n \"source_metadata_discovery\",\n \"source_content_read\",\n \"recursive_source_sync\",\n]);\nexport type GoogleDriveOAuthCapability = z.infer<typeof GoogleDriveOAuthCapability>;\n\nexport type GoogleDriveOAuthScopeDecision = {\n accessMode: \"metadata_readonly\" | \"readonly\" | null;\n capabilities: GoogleDriveOAuthCapability[];\n};\n\n/**\n * Converts exact Google OAuth grants into the Drive capabilities OpenGeni may\n * rely on. Unknown or malformed grants add no authority. In particular,\n * drive.file covers only files explicitly opened or shared with the app and\n * never authorizes arbitrary recursive descendant discovery.\n */\nexport function googleDriveOAuthScopeDecision(\n grantedScopes: readonly string[],\n): GoogleDriveOAuthScopeDecision {\n const granted = new Set(grantedScopes);\n const hasFullDrive = granted.has(GOOGLE_DRIVE_FULL_SCOPE);\n const hasSourceContentRead = hasFullDrive || granted.has(GOOGLE_DRIVE_READONLY_SCOPE);\n const hasSourceMetadataDiscovery =\n hasSourceContentRead || granted.has(GOOGLE_DRIVE_METADATA_READONLY_SCOPE);\n const hasPickerFileRead = hasSourceContentRead || granted.has(GOOGLE_DRIVE_FILE_SCOPE);\n const capabilities: GoogleDriveOAuthCapability[] = [];\n if (hasPickerFileRead) capabilities.push(\"picker_file_read\");\n if (hasSourceMetadataDiscovery) capabilities.push(\"source_metadata_discovery\");\n if (hasSourceContentRead) {\n capabilities.push(\"source_content_read\", \"recursive_source_sync\");\n }\n return {\n accessMode: hasSourceContentRead\n ? \"readonly\"\n : hasSourceMetadataDiscovery\n ? \"metadata_readonly\"\n : null,\n capabilities,\n };\n}\n\nexport function googleDriveScopesAllowCapability(\n grantedScopes: readonly string[],\n capability: GoogleDriveOAuthCapability,\n): boolean {\n return googleDriveOAuthScopeDecision(grantedScopes).capabilities.includes(capability);\n}\n\nexport const GoogleDriveTargetScope = z.enum([\"user\", \"workspace\", \"organization\"]);\nexport type GoogleDriveTargetScope = z.infer<typeof GoogleDriveTargetScope>;\n\nexport const GoogleDriveSyncCadence = z.enum([\"manual\", \"hourly\", \"daily\"]);\nexport type GoogleDriveSyncCadence = z.infer<typeof GoogleDriveSyncCadence>;\n\nexport const GoogleDriveReadPolicy = z.enum([\"allow\", \"ask\", \"block\"]);\nexport type GoogleDriveReadPolicy = z.infer<typeof GoogleDriveReadPolicy>;\n\nexport const GoogleDriveSelectedSource = z.object({\n id: z.string().min(1).max(256),\n name: z.string().min(1).max(1024),\n mimeType: z.string().min(1).max(256),\n driveId: z.string().min(1).max(256).nullable().default(null),\n targetScope: GoogleDriveTargetScope,\n syncCadence: GoogleDriveSyncCadence.default(\"hourly\"),\n readPolicy: GoogleDriveReadPolicy.default(\"allow\"),\n selectedAt: z.string().datetime({ offset: true }),\n});\nexport type GoogleDriveSelectedSource = z.infer<typeof GoogleDriveSelectedSource>;\n\nexport const GoogleDriveConnectionMetadata = z\n .object({\n credentialRole: z.literal(GOOGLE_DRIVE_CREDENTIAL_ROLE),\n credentialLabel: z.literal(GOOGLE_DRIVE_CREDENTIAL_LABEL),\n googlePermissionId: z.string().min(1).max(256),\n googleEmail: z.string().email().max(320),\n googleDisplayName: z.string().min(1).max(512).nullable(),\n verifiedAt: z.string().datetime({ offset: true }),\n accessMode: z.enum([\"metadata_readonly\", \"readonly\"]),\n selectedSources: z.array(GoogleDriveSelectedSource).max(100).optional(),\n /** @deprecated Read `selectedSources`; retained while existing connections migrate. */\n selectedSource: GoogleDriveSelectedSource.nullable().optional(),\n })\n .passthrough();\nexport type GoogleDriveConnectionMetadata = z.infer<typeof GoogleDriveConnectionMetadata>;\n\nexport const GoogleDriveOAuthStartRequest = z.object({\n connectionId: z.string().uuid().optional(),\n});\nexport type GoogleDriveOAuthStartRequest = z.infer<typeof GoogleDriveOAuthStartRequest>;\n\nexport const GoogleDriveOAuthStartResponse = z.object({\n authorizationUrl: z.string().url(),\n expiresAt: z.string().datetime({ offset: true }),\n});\nexport type GoogleDriveOAuthStartResponse = z.infer<typeof GoogleDriveOAuthStartResponse>;\n\nexport const GoogleDriveBrowseItem = z.object({\n id: z.string().min(1).max(256),\n name: z.string().min(1).max(1024),\n mimeType: z.string().min(1).max(256),\n kind: z.enum([\"folder\", \"file\"]),\n driveId: z.string().min(1).max(256).nullable(),\n modifiedTime: z.string().datetime({ offset: true }).nullable(),\n size: z.string().regex(/^\\d+$/).nullable(),\n webViewLink: z.string().url().nullable(),\n});\nexport type GoogleDriveBrowseItem = z.infer<typeof GoogleDriveBrowseItem>;\n\nexport const GoogleDriveBrowseResponse = z.object({\n connection: z.lazy(() => ConnectionMetadata),\n parentId: z.string().min(1).max(256),\n current: GoogleDriveBrowseItem.nullable(),\n items: z.array(GoogleDriveBrowseItem),\n nextPageToken: z.string().min(1).max(4096).nullable(),\n incompleteSearch: z.boolean(),\n});\nexport type GoogleDriveBrowseResponse = z.infer<typeof GoogleDriveBrowseResponse>;\n\nexport const SaveGoogleDriveSourceRequest = z.object({\n sources: z\n .array(\n GoogleDriveBrowseItem.pick({\n id: true,\n name: true,\n mimeType: true,\n driveId: true,\n }),\n )\n .max(100)\n .refine((sources) => new Set(sources.map((source) => source.id)).size === sources.length, {\n message: \"Google Drive sources must be unique\",\n }),\n targetScope: GoogleDriveTargetScope,\n syncCadence: GoogleDriveSyncCadence.default(\"hourly\"),\n readPolicy: GoogleDriveReadPolicy.default(\"allow\"),\n});\nexport type SaveGoogleDriveSourceRequest = z.infer<typeof SaveGoogleDriveSourceRequest>;\n"],"mappings":";;;;;;AAAA,SAAS,SAAS;AAIX,IAAM,+BAA+B;AACrC,IAAM,0BAA0B;AAChC,IAAM,0BAA0B;AAChC,IAAM,uCACX;AACK,IAAM,8BACX;AACK,IAAM,+BAA+B;AACrC,IAAM,gCAAgC;AAEtC,IAAM,6BAA6B,EAAE,KAAK;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAcM,SAAS,8BACd,eAC+B;AAC/B,QAAM,UAAU,IAAI,IAAI,aAAa;AACrC,QAAM,eAAe,QAAQ,IAAI,uBAAuB;AACxD,QAAM,uBAAuB,gBAAgB,QAAQ,IAAI,2BAA2B;AACpF,QAAM,6BACJ,wBAAwB,QAAQ,IAAI,oCAAoC;AAC1E,QAAM,oBAAoB,wBAAwB,QAAQ,IAAI,uBAAuB;AACrF,QAAM,eAA6C,CAAC;AACpD,MAAI,kBAAmB,c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D,YAAY,EAAE,KAAK,MAAM,kBAAkB;AAAA,EAC3C,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EACnC,SAAS,sBAAsB,SAAS;AAAA,EACxC,OAAO,EAAE,MAAM,qBAAqB;AAAA,EACpC,eAAe,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,IAAI,EAAE,SAAS;AAAA,EACpD,kBAAkB,EAAE,QAAQ;AAC9B,CAAC;AAGM,IAAM,+BAA+B,EAAE,OAAO;AAAA,EACnD,SAAS,EACN;AAAA,IACC,sBAAsB,KAAK;AAAA,MACzB,IAAI;AAAA,MACJ,MAAM;AAAA,MACN,UAAU;AAAA,MACV,SAAS;AAAA,IACX,CAAC;AAAA,EACH,EACC,IAAI,GAAG,EACP,OAAO,CAAC,YAAY,IAAI,IAAI,QAAQ,IAAI,CAAC,WAAW,OAAO,EAAE,CAAC,EAAE,SAAS,QAAQ,QAAQ;AAAA,IACxF,SAAS;AAAA,EACX,CAAC;AAAA,EACH,aAAa;AAAA,EACb,aAAa,uBAAuB,QAAQ,QAAQ;AAAA,EACpD,YAAY,sBAAsB,QAAQ,OAAO;AACnD,CAAC;","names":[]}
1
+ {"version":3,"sources":["../src/google-drive.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { ConnectionMetadata } from \"./index\";\n\nexport const GOOGLE_DRIVE_PROVIDER_DOMAIN = \"googleapis.com\" as const;\nexport const GOOGLE_DRIVE_FULL_SCOPE = \"https://www.googleapis.com/auth/drive\" as const;\nexport const GOOGLE_DRIVE_FILE_SCOPE = \"https://www.googleapis.com/auth/drive.file\" as const;\nexport const GOOGLE_DRIVE_METADATA_READONLY_SCOPE =\n \"https://www.googleapis.com/auth/drive.metadata.readonly\" as const;\nexport const GOOGLE_DRIVE_READONLY_SCOPE =\n \"https://www.googleapis.com/auth/drive.readonly\" as const;\nexport const GOOGLE_DRIVE_CREDENTIAL_ROLE = \"google_drive_metadata\" as const;\nexport const GOOGLE_DRIVE_CREDENTIAL_LABEL = \"Google Drive metadata browser\" as const;\n\nexport const GoogleDriveOAuthCapability = z.enum([\n \"picker_file_read\",\n \"source_metadata_discovery\",\n \"source_content_read\",\n \"recursive_source_sync\",\n]);\nexport type GoogleDriveOAuthCapability = z.infer<typeof GoogleDriveOAuthCapability>;\n\nexport type GoogleDriveOAuthScopeDecision = {\n accessMode: \"metadata_readonly\" | \"readonly\" | null;\n capabilities: GoogleDriveOAuthCapability[];\n};\n\n/**\n * Converts exact Google OAuth grants into the Drive capabilities OpenGeni may\n * rely on. Unknown or malformed grants add no authority. In particular,\n * drive.file covers only files explicitly opened or shared with the app and\n * never authorizes arbitrary recursive descendant discovery.\n */\nexport function googleDriveOAuthScopeDecision(\n grantedScopes: readonly string[],\n): GoogleDriveOAuthScopeDecision {\n const granted = new Set(grantedScopes);\n const hasFullDrive = granted.has(GOOGLE_DRIVE_FULL_SCOPE);\n const hasSourceContentRead = hasFullDrive || granted.has(GOOGLE_DRIVE_READONLY_SCOPE);\n const hasSourceMetadataDiscovery =\n hasSourceContentRead || granted.has(GOOGLE_DRIVE_METADATA_READONLY_SCOPE);\n const hasPickerFileRead = hasSourceContentRead || granted.has(GOOGLE_DRIVE_FILE_SCOPE);\n const capabilities: GoogleDriveOAuthCapability[] = [];\n if (hasPickerFileRead) capabilities.push(\"picker_file_read\");\n if (hasSourceMetadataDiscovery) capabilities.push(\"source_metadata_discovery\");\n if (hasSourceContentRead) {\n capabilities.push(\"source_content_read\", \"recursive_source_sync\");\n }\n return {\n accessMode: hasSourceContentRead\n ? \"readonly\"\n : hasSourceMetadataDiscovery\n ? \"metadata_readonly\"\n : null,\n capabilities,\n };\n}\n\nexport function googleDriveScopesAllowCapability(\n grantedScopes: readonly string[],\n capability: GoogleDriveOAuthCapability,\n): boolean {\n return googleDriveOAuthScopeDecision(grantedScopes).capabilities.includes(capability);\n}\n\nexport const GoogleDriveTargetScope = z.enum([\"user\", \"workspace\", \"organization\"]);\nexport type GoogleDriveTargetScope = z.infer<typeof GoogleDriveTargetScope>;\n\nexport const GoogleDriveSyncCadence = z.enum([\"manual\", \"hourly\", \"daily\"]);\nexport type GoogleDriveSyncCadence = z.infer<typeof GoogleDriveSyncCadence>;\n\nexport const GoogleDriveReadPolicy = z.enum([\"allow\", \"ask\", \"block\"]);\nexport type GoogleDriveReadPolicy = z.infer<typeof GoogleDriveReadPolicy>;\n\nexport const GoogleDriveConnectionLifecycleState = z.enum([\n \"active\",\n \"paused\",\n \"token_revoked\",\n \"app_removed\",\n \"disconnected\",\n \"reconnect_required\",\n \"reconsent_required\",\n]);\nexport type GoogleDriveConnectionLifecycleState = z.infer<\n typeof GoogleDriveConnectionLifecycleState\n>;\n\nconst GoogleDriveLifecycleObservedAt = z.string().datetime({ offset: true });\nexport const GoogleDriveConnectionLifecycle = z.discriminatedUnion(\"state\", [\n z.object({\n state: z.literal(\"active\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"paused\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"token_revoked\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"app_removed\"),\n recoverable: z.literal(false),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"disconnected\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"reconnect_required\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n z.object({\n state: z.literal(\"reconsent_required\"),\n recoverable: z.literal(true),\n observedAt: GoogleDriveLifecycleObservedAt,\n }),\n]);\nexport type GoogleDriveConnectionLifecycle = z.infer<typeof GoogleDriveConnectionLifecycle>;\n\nexport const GoogleDriveSelectedSource = z.object({\n id: z.string().min(1).max(256),\n name: z.string().min(1).max(1024),\n mimeType: z.string().min(1).max(256),\n driveId: z.string().min(1).max(256).nullable().default(null),\n targetScope: GoogleDriveTargetScope,\n syncCadence: GoogleDriveSyncCadence.default(\"hourly\"),\n readPolicy: GoogleDriveReadPolicy.default(\"allow\"),\n selectedAt: z.string().datetime({ offset: true }),\n});\nexport type GoogleDriveSelectedSource = z.infer<typeof GoogleDriveSelectedSource>;\n\nexport const GoogleDriveConnectionMetadata = z\n .object({\n credentialRole: z.literal(GOOGLE_DRIVE_CREDENTIAL_ROLE),\n credentialLabel: z.literal(GOOGLE_DRIVE_CREDENTIAL_LABEL),\n googlePermissionId: z.string().min(1).max(256),\n googleEmail: z.string().email().max(320),\n googleDisplayName: z.string().min(1).max(512).nullable(),\n verifiedAt: z.string().datetime({ offset: true }),\n accessMode: z.enum([\"metadata_readonly\", \"readonly\"]),\n lifecycle: GoogleDriveConnectionLifecycle.optional(),\n selectedSources: z.array(GoogleDriveSelectedSource).max(100).optional(),\n /** @deprecated Read `selectedSources`; retained while existing connections migrate. */\n selectedSource: GoogleDriveSelectedSource.nullable().optional(),\n })\n .passthrough();\nexport type GoogleDriveConnectionMetadata = z.infer<typeof GoogleDriveConnectionMetadata>;\n\nexport const GoogleDriveOAuthStartRequest = z.object({\n connectionId: z.string().uuid().optional(),\n});\nexport type GoogleDriveOAuthStartRequest = z.infer<typeof GoogleDriveOAuthStartRequest>;\n\nexport const GoogleDriveOAuthStartResponse = z.object({\n authorizationUrl: z.string().url(),\n expiresAt: z.string().datetime({ offset: true }),\n});\nexport type GoogleDriveOAuthStartResponse = z.infer<typeof GoogleDriveOAuthStartResponse>;\n\nexport const GoogleDriveLifecycleActionRequest = z.object({\n action: z.enum([\"pause\", \"resume\"]),\n expectedVersion: z.number().int().positive(),\n});\nexport type GoogleDriveLifecycleActionRequest = z.infer<typeof GoogleDriveLifecycleActionRequest>;\n\nexport const GoogleDriveDisconnectRequest = z.object({\n expectedVersion: z.number().int().positive(),\n idempotencyKey: z.string().trim().min(1).max(200),\n});\nexport type GoogleDriveDisconnectRequest = z.infer<typeof GoogleDriveDisconnectRequest>;\n\nexport const GoogleDriveBrowseItem = z.object({\n id: z.string().min(1).max(256),\n name: z.string().min(1).max(1024),\n mimeType: z.string().min(1).max(256),\n kind: z.enum([\"folder\", \"file\"]),\n driveId: z.string().min(1).max(256).nullable(),\n modifiedTime: z.string().datetime({ offset: true }).nullable(),\n size: z.string().regex(/^\\d+$/).nullable(),\n webViewLink: z.string().url().nullable(),\n});\nexport type GoogleDriveBrowseItem = z.infer<typeof GoogleDriveBrowseItem>;\n\nexport const GoogleDriveBrowseResponse = z.object({\n connection: z.lazy(() => ConnectionMetadata),\n parentId: z.string().min(1).max(256),\n current: GoogleDriveBrowseItem.nullable(),\n items: z.array(GoogleDriveBrowseItem),\n nextPageToken: z.string().min(1).max(4096).nullable(),\n incompleteSearch: z.boolean(),\n});\nexport type GoogleDriveBrowseResponse = z.infer<typeof GoogleDriveBrowseResponse>;\n\nexport const SaveGoogleDriveSourceRequest = z.object({\n sources: z\n .array(\n GoogleDriveBrowseItem.pick({\n id: true,\n name: true,\n mimeType: true,\n driveId: true,\n }),\n )\n .max(100)\n .refine((sources) => new Set(sources.map((source) => source.id)).size === sources.length, {\n message: \"Google Drive sources must be unique\",\n }),\n targetScope: GoogleDriveTargetScope,\n syncCadence: GoogleDriveSyncCadence.default(\"hourly\"),\n readPolicy: GoogleDriveReadPolicy.default(\"allow\"),\n});\nexport type SaveGoogleDriveSourceRequest = z.infer<typeof SaveGoogleDriveSourceRequest>;\n"],"mappings":";;;;;;AAAA,SAAS,SAAS;AAIX,IAAM,+BAA+B;AACrC,IAAM,0BAA0B;AAChC,IAAM,0BAA0B;AAChC,IAAM,uCACX;AACK,IAAM,8BACX;AACK,IAAM,+BAA+B;AACrC,IAAM,gCAAgC;AAEtC,IAAM,6BAA6B,EAAE,KAAK;AAAA,EAC/C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAcM,SAAS,8BACd,eAC+B;AA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A,EACH,aAAa;AAAA,EACb,aAAa,uBAAuB,QAAQ,QAAQ;AAAA,EACpD,YAAY,sBAAsB,QAAQ,OAAO;AACnD,CAAC;","names":[]}
package/dist/index.d.ts CHANGED
@@ -2696,6 +2696,13 @@ export declare const FileResourceRef: z.ZodObject<{
2696
2696
  mountPath: z.ZodOptional<z.ZodString>;
2697
2697
  }, z.core.$strip>;
2698
2698
  export type FileResourceRef = z.infer<typeof FileResourceRef>;
2699
+ /**
2700
+ * Private durable metadata carried on user history items. It contains only
2701
+ * stable file references, never file bytes, and is removed before model wire
2702
+ * serialization. Keeping the references beside the message lets a later turn
2703
+ * reconstruct the same typed attachment input after a model switch or retry.
2704
+ */
2705
+ export declare const MODEL_ATTACHMENT_REFS_FIELD: "opengeni_attachment_refs";
2699
2706
  export declare const ResourceRef: z.ZodDiscriminatedUnion<[z.ZodObject<{
2700
2707
  kind: z.ZodLiteral<"repository">;
2701
2708
  uri: z.ZodString;
@@ -2748,6 +2755,7 @@ export declare function resourceMountPathCollisionKey(path: string): string;
2748
2755
  */
2749
2756
  export declare function defaultRepositoryMountPath(uri: string): string;
2750
2757
  /** Resolve the exact mount used by API normalization, manifests, and clone hooks. */
2758
+ export declare const DEFAULT_FILE_RESOURCE_MOUNT_ROOT: ".opengeni/files";
2751
2759
  export declare function resourceMountPath(resource: ResourceRef): string;
2752
2760
  /** Fail before sandbox execution when two resources share a portable path. */
2753
2761
  export declare function assertUniqueResourceMountPaths(resources: readonly ResourceRef[]): void;
@@ -2856,6 +2864,12 @@ export declare const DocumentSearchMode: z.ZodEnum<{
2856
2864
  vector: "vector";
2857
2865
  }>;
2858
2866
  export type DocumentSearchMode = z.infer<typeof DocumentSearchMode>;
2867
+ export declare const DocumentAuthorityKind: z.ZodEnum<{
2868
+ organization: "organization";
2869
+ personal: "personal";
2870
+ workspace: "workspace";
2871
+ }>;
2872
+ export type DocumentAuthorityKind = z.infer<typeof DocumentAuthorityKind>;
2859
2873
  export declare const DocumentVisibility: z.ZodEnum<{
2860
2874
  private: "private";
2861
2875
  workspace: "workspace";
@@ -2920,6 +2934,13 @@ export declare const Document: z.ZodObject<{
2920
2934
  sourceUpdatedAt: z.ZodNullable<z.ZodString>;
2921
2935
  sourceVersion: z.ZodNullable<z.ZodString>;
2922
2936
  aclTags: z.ZodArray<z.ZodString>;
2937
+ authorityKind: z.ZodEnum<{
2938
+ organization: "organization";
2939
+ personal: "personal";
2940
+ workspace: "workspace";
2941
+ }>;
2942
+ authorityWorkspaceId: z.ZodNullable<z.ZodString>;
2943
+ authoritySubjectId: z.ZodNullable<z.ZodString>;
2923
2944
  visibility: z.ZodEnum<{
2924
2945
  private: "private";
2925
2946
  workspace: "workspace";
@@ -2983,8 +3004,62 @@ export declare const DocumentSearchResult: z.ZodObject<{
2983
3004
  sourceUpdatedAt: z.ZodNullable<z.ZodString>;
2984
3005
  sourceVersion: z.ZodNullable<z.ZodString>;
2985
3006
  aclTags: z.ZodArray<z.ZodString>;
3007
+ authorityKind: z.ZodEnum<{
3008
+ organization: "organization";
3009
+ personal: "personal";
3010
+ workspace: "workspace";
3011
+ }>;
3012
+ authorityWorkspaceId: z.ZodNullable<z.ZodString>;
3013
+ authoritySubjectId: z.ZodNullable<z.ZodString>;
2986
3014
  }, z.core.$strip>;
2987
3015
  export type DocumentSearchResult = z.infer<typeof DocumentSearchResult>;
3016
+ export declare const DocumentSearchResponse: z.ZodObject<{
3017
+ results: z.ZodArray<z.ZodObject<{
3018
+ chunkId: z.ZodString;
3019
+ workspaceId: z.ZodString;
3020
+ documentId: z.ZodString;
3021
+ baseId: z.ZodString;
3022
+ fileId: z.ZodString;
3023
+ title: z.ZodString;
3024
+ text: z.ZodString;
3025
+ score: z.ZodNumber;
3026
+ matchType: z.ZodEnum<{
3027
+ hybrid: "hybrid";
3028
+ keyword: "keyword";
3029
+ vector: "vector";
3030
+ }>;
3031
+ vectorScore: z.ZodNullable<z.ZodNumber>;
3032
+ keywordScore: z.ZodNullable<z.ZodNumber>;
3033
+ chunkIndex: z.ZodNumber;
3034
+ metadata: z.ZodRecord<z.ZodString, z.ZodUnknown>;
3035
+ sourceKind: z.ZodEnum<{
3036
+ chat: "chat";
3037
+ document: "document";
3038
+ email: "email";
3039
+ manual_upload: "manual_upload";
3040
+ meeting_transcript: "meeting_transcript";
3041
+ other: "other";
3042
+ repository: "repository";
3043
+ web: "web";
3044
+ }>;
3045
+ sourceUri: z.ZodNullable<z.ZodString>;
3046
+ sourceExternalId: z.ZodNullable<z.ZodString>;
3047
+ sourceTitle: z.ZodNullable<z.ZodString>;
3048
+ sourceAuthor: z.ZodNullable<z.ZodString>;
3049
+ sourceCreatedAt: z.ZodNullable<z.ZodString>;
3050
+ sourceUpdatedAt: z.ZodNullable<z.ZodString>;
3051
+ sourceVersion: z.ZodNullable<z.ZodString>;
3052
+ aclTags: z.ZodArray<z.ZodString>;
3053
+ authorityKind: z.ZodEnum<{
3054
+ organization: "organization";
3055
+ personal: "personal";
3056
+ workspace: "workspace";
3057
+ }>;
3058
+ authorityWorkspaceId: z.ZodNullable<z.ZodString>;
3059
+ authoritySubjectId: z.ZodNullable<z.ZodString>;
3060
+ }, z.core.$strip>>;
3061
+ }, z.core.$strip>;
3062
+ export type DocumentSearchResponse = z.infer<typeof DocumentSearchResponse>;
2988
3063
  export declare const CreateDocumentBaseRequest: z.ZodObject<{
2989
3064
  name: z.ZodString;
2990
3065
  description: z.ZodOptional<z.ZodString>;
@@ -3011,6 +3086,11 @@ export declare const AddDocumentRequest: z.ZodObject<{
3011
3086
  sourceUpdatedAt: z.ZodOptional<z.ZodString>;
3012
3087
  sourceVersion: z.ZodOptional<z.ZodString>;
3013
3088
  aclTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
3089
+ authorityKind: z.ZodOptional<z.ZodEnum<{
3090
+ organization: "organization";
3091
+ personal: "personal";
3092
+ workspace: "workspace";
3093
+ }>>;
3014
3094
  visibility: z.ZodOptional<z.ZodEnum<{
3015
3095
  private: "private";
3016
3096
  workspace: "workspace";
@@ -3023,6 +3103,11 @@ export declare const CreateKnowledgeDropRequest: z.ZodObject<{
3023
3103
  fileId: z.ZodOptional<z.ZodString>;
3024
3104
  filename: z.ZodOptional<z.ZodString>;
3025
3105
  title: z.ZodOptional<z.ZodString>;
3106
+ authorityKind: z.ZodOptional<z.ZodEnum<{
3107
+ organization: "organization";
3108
+ personal: "personal";
3109
+ workspace: "workspace";
3110
+ }>>;
3026
3111
  visibility: z.ZodOptional<z.ZodEnum<{
3027
3112
  private: "private";
3028
3113
  workspace: "workspace";
@@ -12500,8 +12585,6 @@ export declare const HumanInputQuestion: z.ZodObject<{
12500
12585
  required: z.ZodDefault<z.ZodBoolean>;
12501
12586
  allowOther: z.ZodDefault<z.ZodBoolean>;
12502
12587
  validation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
12503
- minLength: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
12504
- maxLength: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
12505
12588
  minSelections: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
12506
12589
  maxSelections: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
12507
12590
  }, z.core.$strip>>>;
@@ -12534,8 +12617,6 @@ export declare const RequestHumanInputToolInput: z.ZodObject<{
12534
12617
  required: z.ZodDefault<z.ZodBoolean>;
12535
12618
  allowOther: z.ZodDefault<z.ZodBoolean>;
12536
12619
  validation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
12537
- minLength: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
12538
- maxLength: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
12539
12620
  minSelections: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
12540
12621
  maxSelections: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
12541
12622
  }, z.core.$strip>>>;
@@ -12609,8 +12690,6 @@ export declare const SessionHumanInputRequest: z.ZodObject<{
12609
12690
  required: z.ZodDefault<z.ZodBoolean>;
12610
12691
  allowOther: z.ZodDefault<z.ZodBoolean>;
12611
12692
  validation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
12612
- minLength: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
12613
- maxLength: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
12614
12693
  minSelections: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
12615
12694
  maxSelections: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
12616
12695
  }, z.core.$strip>>>;
@@ -14034,6 +14113,7 @@ export declare const ModelCapabilitiesV1: z.ZodObject<{
14034
14113
  image: "image";
14035
14114
  text: "text";
14036
14115
  }>>;
14116
+ inputFileMediaTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
14037
14117
  outputModalities: z.ZodArray<z.ZodEnum<{
14038
14118
  audio: "audio";
14039
14119
  image: "image";
@@ -14404,6 +14484,7 @@ export declare const ClientModel: z.ZodObject<{
14404
14484
  image: "image";
14405
14485
  text: "text";
14406
14486
  }>>;
14487
+ inputFileMediaTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
14407
14488
  outputModalities: z.ZodArray<z.ZodEnum<{
14408
14489
  audio: "audio";
14409
14490
  image: "image";
@@ -14653,6 +14734,7 @@ export declare const WorkspaceModelCatalogModel: z.ZodObject<{
14653
14734
  image: "image";
14654
14735
  text: "text";
14655
14736
  }>>;
14737
+ inputFileMediaTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
14656
14738
  outputModalities: z.ZodArray<z.ZodEnum<{
14657
14739
  audio: "audio";
14658
14740
  image: "image";
@@ -14901,6 +14983,7 @@ export declare const WorkspaceModelCatalogResponse: z.ZodObject<{
14901
14983
  image: "image";
14902
14984
  text: "text";
14903
14985
  }>>;
14986
+ inputFileMediaTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
14904
14987
  outputModalities: z.ZodArray<z.ZodEnum<{
14905
14988
  audio: "audio";
14906
14989
  image: "image";
@@ -15167,6 +15250,7 @@ export declare const ClientConfig: z.ZodObject<{
15167
15250
  image: "image";
15168
15251
  text: "text";
15169
15252
  }>>;
15253
+ inputFileMediaTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
15170
15254
  outputModalities: z.ZodArray<z.ZodEnum<{
15171
15255
  audio: "audio";
15172
15256
  image: "image";
package/dist/index.js CHANGED
@@ -85,9 +85,11 @@ import {
85
85
  CreateWorkspaceArtifactRequest,
86
86
  CreateWorkspaceEnvironmentRequest,
87
87
  CreateWorkspaceInstructionPolicyDraftRequest,
88
+ CreateWorkspaceInstructionPolicyOnboardingProposalRequest,
88
89
  CreateWorkspaceRequest,
89
90
  CredentialAuthNeededPayload,
90
91
  DEFAULT_CODEX_FLEET_POLICY_V1,
92
+ DEFAULT_FILE_RESOURCE_MOUNT_ROOT,
91
93
  DEFAULT_FIRST_PARTY_MCP_PERMISSIONS,
92
94
  DEFAULT_FIRST_PARTY_MCP_TOOLS,
93
95
  DEFAULT_WORKSPACE_SLACK_REACTION_SUMMON_SETTINGS,
@@ -110,11 +112,13 @@ import {
110
112
  DeviceEnrollmentState,
111
113
  DiscoverMcpCapabilitiesResponse,
112
114
  Document,
115
+ DocumentAuthorityKind,
113
116
  DocumentBase,
114
117
  DocumentCuration,
115
118
  DocumentCurationStatus,
116
119
  DocumentSearchMode,
117
120
  DocumentSearchRequest,
121
+ DocumentSearchResponse,
118
122
  DocumentSearchResult,
119
123
  DocumentStatus,
120
124
  DocumentVisibility,
@@ -250,6 +254,7 @@ import {
250
254
  ListEnrollmentsResponse,
251
255
  ListWorkspaceMembersResponse,
252
256
  MAX_NESTED_AGENT_DEPTH,
257
+ MODEL_ATTACHMENT_REFS_FIELD,
253
258
  MachineKind,
254
259
  MachineMetricsSeriesResponse,
255
260
  MachineState,
@@ -568,6 +573,7 @@ import {
568
573
  WORKSPACE_CONTROL_EVENT_MAX_BYTES,
569
574
  WORKSPACE_CONTROL_REASON_MAX_BYTES,
570
575
  WORKSPACE_INSTRUCTION_POLICY_CONTENT_MAX_CHARS,
576
+ WORKSPACE_INSTRUCTION_POLICY_ONBOARDING_SOURCE_VERSION_MAX_CHARS,
571
577
  WORKSPACE_INSTRUCTION_POLICY_PROMPT_MAX_UTF8_BYTES,
572
578
  WORKSPACE_INSTRUCTION_POLICY_REASON_MAX_CHARS,
573
579
  WORKSPACE_INSTRUCTION_POLICY_ROLE_KEY_MAX_CHARS,
@@ -618,6 +624,14 @@ import {
618
624
  WorkspaceInstructionPolicyKind,
619
625
  WorkspaceInstructionPolicyListQuery,
620
626
  WorkspaceInstructionPolicyListResponse,
627
+ WorkspaceInstructionPolicyOnboardingProposal,
628
+ WorkspaceInstructionPolicyOnboardingProposalConflictResponse,
629
+ WorkspaceInstructionPolicyOnboardingProposalContentErrorResponse,
630
+ WorkspaceInstructionPolicyOnboardingProposalListQuery,
631
+ WorkspaceInstructionPolicyOnboardingProposalListResponse,
632
+ WorkspaceInstructionPolicyOnboardingProposalSource,
633
+ WorkspaceInstructionPolicyOnboardingProposalStaleResponse,
634
+ WorkspaceInstructionPolicyOperationReuseResponse,
621
635
  WorkspaceInstructionPolicyProvenance,
622
636
  WorkspaceInstructionPolicyProvenanceSource,
623
637
  WorkspaceInstructionPolicyRevision,
@@ -645,9 +659,11 @@ import {
645
659
  WorkspaceSettingsSchema,
646
660
  WorkspaceSlackReactionChannelPolicy,
647
661
  WorkspaceSlackReactionSummonSettings,
662
+ WorkspaceStateAttemptGovernance,
648
663
  WorkspaceStateDocumentStatusCounts,
649
664
  WorkspaceStateGap,
650
665
  WorkspaceStateGapCode,
666
+ WorkspaceStateGovernanceDriftStatus,
651
667
  WorkspaceStateKnowledge,
652
668
  WorkspaceStateKnowledgeAvailable,
653
669
  WorkspaceStateKnowledgeBase,
@@ -657,6 +673,7 @@ import {
657
673
  WorkspaceStatePolicy,
658
674
  WorkspaceStatePolicyHead,
659
675
  WorkspaceStatePolicyRevisionSummary,
676
+ WorkspaceStateQuery,
660
677
  WorkspaceStateResponse,
661
678
  WorkspaceStateSourceKindCounts,
662
679
  WorkspaceStateTopic,
@@ -743,7 +760,7 @@ import {
743
760
  verifyStreamToken,
744
761
  workspaceControlUtf8Bytes,
745
762
  workspaceSlackReactionChannelAllowed
746
- } from "./chunk-GMOYIHF3.js";
763
+ } from "./chunk-F4KMLKSL.js";
747
764
  import {
748
765
  OPENGENI_MANAGED_PUBLIC_BASE_URL,
749
766
  OPENGENI_SLACK_BOT_EVENTS,
@@ -844,9 +861,11 @@ export {
844
861
  CreateWorkspaceArtifactRequest,
845
862
  CreateWorkspaceEnvironmentRequest,
846
863
  CreateWorkspaceInstructionPolicyDraftRequest,
864
+ CreateWorkspaceInstructionPolicyOnboardingProposalRequest,
847
865
  CreateWorkspaceRequest,
848
866
  CredentialAuthNeededPayload,
849
867
  DEFAULT_CODEX_FLEET_POLICY_V1,
868
+ DEFAULT_FILE_RESOURCE_MOUNT_ROOT,
850
869
  DEFAULT_FIRST_PARTY_MCP_PERMISSIONS,
851
870
  DEFAULT_FIRST_PARTY_MCP_TOOLS,
852
871
  DEFAULT_WORKSPACE_SLACK_REACTION_SUMMON_SETTINGS,
@@ -869,11 +888,13 @@ export {
869
888
  DeviceEnrollmentState,
870
889
  DiscoverMcpCapabilitiesResponse,
871
890
  Document,
891
+ DocumentAuthorityKind,
872
892
  DocumentBase,
873
893
  DocumentCuration,
874
894
  DocumentCurationStatus,
875
895
  DocumentSearchMode,
876
896
  DocumentSearchRequest,
897
+ DocumentSearchResponse,
877
898
  DocumentSearchResult,
878
899
  DocumentStatus,
879
900
  DocumentVisibility,
@@ -1009,6 +1030,7 @@ export {
1009
1030
  ListEnrollmentsResponse,
1010
1031
  ListWorkspaceMembersResponse,
1011
1032
  MAX_NESTED_AGENT_DEPTH,
1033
+ MODEL_ATTACHMENT_REFS_FIELD,
1012
1034
  MachineKind,
1013
1035
  MachineMetricsSeriesResponse,
1014
1036
  MachineState,
@@ -1334,6 +1356,7 @@ export {
1334
1356
  WORKSPACE_CONTROL_EVENT_MAX_BYTES,
1335
1357
  WORKSPACE_CONTROL_REASON_MAX_BYTES,
1336
1358
  WORKSPACE_INSTRUCTION_POLICY_CONTENT_MAX_CHARS,
1359
+ WORKSPACE_INSTRUCTION_POLICY_ONBOARDING_SOURCE_VERSION_MAX_CHARS,
1337
1360
  WORKSPACE_INSTRUCTION_POLICY_PROMPT_MAX_UTF8_BYTES,
1338
1361
  WORKSPACE_INSTRUCTION_POLICY_REASON_MAX_CHARS,
1339
1362
  WORKSPACE_INSTRUCTION_POLICY_ROLE_KEY_MAX_CHARS,
@@ -1384,6 +1407,14 @@ export {
1384
1407
  WorkspaceInstructionPolicyKind,
1385
1408
  WorkspaceInstructionPolicyListQuery,
1386
1409
  WorkspaceInstructionPolicyListResponse,
1410
+ WorkspaceInstructionPolicyOnboardingProposal,
1411
+ WorkspaceInstructionPolicyOnboardingProposalConflictResponse,
1412
+ WorkspaceInstructionPolicyOnboardingProposalContentErrorResponse,
1413
+ WorkspaceInstructionPolicyOnboardingProposalListQuery,
1414
+ WorkspaceInstructionPolicyOnboardingProposalListResponse,
1415
+ WorkspaceInstructionPolicyOnboardingProposalSource,
1416
+ WorkspaceInstructionPolicyOnboardingProposalStaleResponse,
1417
+ WorkspaceInstructionPolicyOperationReuseResponse,
1387
1418
  WorkspaceInstructionPolicyProvenance,
1388
1419
  WorkspaceInstructionPolicyProvenanceSource,
1389
1420
  WorkspaceInstructionPolicyRevision,
@@ -1411,9 +1442,11 @@ export {
1411
1442
  WorkspaceSettingsSchema,
1412
1443
  WorkspaceSlackReactionChannelPolicy,
1413
1444
  WorkspaceSlackReactionSummonSettings,
1445
+ WorkspaceStateAttemptGovernance,
1414
1446
  WorkspaceStateDocumentStatusCounts,
1415
1447
  WorkspaceStateGap,
1416
1448
  WorkspaceStateGapCode,
1449
+ WorkspaceStateGovernanceDriftStatus,
1417
1450
  WorkspaceStateKnowledge,
1418
1451
  WorkspaceStateKnowledgeAvailable,
1419
1452
  WorkspaceStateKnowledgeBase,
@@ -1423,6 +1456,7 @@ export {
1423
1456
  WorkspaceStatePolicy,
1424
1457
  WorkspaceStatePolicyHead,
1425
1458
  WorkspaceStatePolicyRevisionSummary,
1459
+ WorkspaceStateQuery,
1426
1460
  WorkspaceStateResponse,
1427
1461
  WorkspaceStateSourceKindCounts,
1428
1462
  WorkspaceStateTopic,