@opengeni/contracts 0.40.0 → 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 (148) hide show
  1. package/dist/atlassian.d.ts +278 -0
  2. package/dist/atlassian.js +57 -0
  3. package/dist/atlassian.js.map +1 -0
  4. package/dist/canonical-human-identities.d.ts +157 -0
  5. package/dist/canonical-human-identities.js +23 -0
  6. package/dist/canonical-human-identities.js.map +1 -0
  7. package/dist/{chunk-7JZMI22I.js → chunk-5UDNP7AO.js} +34 -2
  8. package/dist/chunk-5UDNP7AO.js.map +1 -0
  9. package/dist/chunk-BVGIYW7D.js +11 -0
  10. package/dist/chunk-BVGIYW7D.js.map +1 -0
  11. package/dist/chunk-CADSX6UN.js +1145 -0
  12. package/dist/chunk-CADSX6UN.js.map +1 -0
  13. package/dist/chunk-CM6BMECR.js +24 -0
  14. package/dist/chunk-CM6BMECR.js.map +1 -0
  15. package/dist/chunk-D2HKF2EF.js +1460 -0
  16. package/dist/chunk-D2HKF2EF.js.map +1 -0
  17. package/dist/chunk-JBCIY7QD.js +194 -0
  18. package/dist/chunk-JBCIY7QD.js.map +1 -0
  19. package/dist/chunk-JUFK3T4Q.js +80 -0
  20. package/dist/chunk-JUFK3T4Q.js.map +1 -0
  21. package/dist/chunk-LSB7GRLG.js +779 -0
  22. package/dist/chunk-LSB7GRLG.js.map +1 -0
  23. package/dist/chunk-LW7OH6CS.js +382 -0
  24. package/dist/chunk-LW7OH6CS.js.map +1 -0
  25. package/dist/chunk-M5ZGRVIQ.js +719 -0
  26. package/dist/chunk-M5ZGRVIQ.js.map +1 -0
  27. package/dist/chunk-MYBZRDTY.js +340 -0
  28. package/dist/chunk-MYBZRDTY.js.map +1 -0
  29. package/dist/chunk-Q6A7XT2N.js +16734 -0
  30. package/dist/chunk-Q6A7XT2N.js.map +1 -0
  31. package/dist/chunk-RIY7GYQS.js +1204 -0
  32. package/dist/chunk-RIY7GYQS.js.map +1 -0
  33. package/dist/chunk-TZ6YEYN4.js +386 -0
  34. package/dist/chunk-TZ6YEYN4.js.map +1 -0
  35. package/dist/chunk-Y3MLSLB4.js +392 -0
  36. package/dist/chunk-Y3MLSLB4.js.map +1 -0
  37. package/dist/chunk-YRKRZ6OF.js +134 -0
  38. package/dist/chunk-YRKRZ6OF.js.map +1 -0
  39. package/dist/codex-provider-account-authority.d.ts +23 -0
  40. package/dist/codex-provider-account-authority.js +23 -0
  41. package/dist/codex-provider-account-authority.js.map +1 -0
  42. package/dist/company-profile.d.ts +629 -0
  43. package/dist/document-artifact-commands.d.ts +282 -0
  44. package/dist/document-artifact-commands.js +54 -0
  45. package/dist/document-artifact-commands.js.map +1 -0
  46. package/dist/document-artifact-query.d.ts +2 -0
  47. package/dist/document-artifact-query.js +54 -0
  48. package/dist/document-artifact-query.js.map +1 -0
  49. package/dist/editable-artifact-binary.d.ts +56 -0
  50. package/dist/editable-artifact-causal-frontier.d.ts +12 -0
  51. package/dist/editable-artifact-causal-frontier.js +18 -0
  52. package/dist/editable-artifact-causal-frontier.js.map +1 -0
  53. package/dist/editable-artifact-codec-registry.d.ts +48 -0
  54. package/dist/editable-artifact-codec-registry.js +20 -0
  55. package/dist/editable-artifact-codec-registry.js.map +1 -0
  56. package/dist/editable-artifact-committed-transaction.d.ts +35 -0
  57. package/dist/editable-artifact-committed-transaction.js +19 -0
  58. package/dist/editable-artifact-committed-transaction.js.map +1 -0
  59. package/dist/editable-artifact-live.d.ts +276 -0
  60. package/dist/editable-artifact-live.js +907 -0
  61. package/dist/editable-artifact-live.js.map +1 -0
  62. package/dist/editable-artifact-serialized-commit.d.ts +53 -0
  63. package/dist/editable-artifact-serialized-commit.js +26 -0
  64. package/dist/editable-artifact-serialized-commit.js.map +1 -0
  65. package/dist/editable-artifact-versions.d.ts +6 -0
  66. package/dist/editable-artifact-versions.js +11 -0
  67. package/dist/editable-artifact-versions.js.map +1 -0
  68. package/dist/editable-artifacts.d.ts +46 -0
  69. package/dist/editable-artifacts.js +236 -0
  70. package/dist/editable-artifacts.js.map +1 -0
  71. package/dist/event-preview.d.ts +1 -1
  72. package/dist/google-drive.d.ts +114 -2
  73. package/dist/google-drive.js +72 -14
  74. package/dist/google-drive.js.map +1 -1
  75. package/dist/image-generation.d.ts +70 -0
  76. package/dist/index.d.ts +5661 -166
  77. package/dist/index.js +1438 -21
  78. package/dist/interaction.d.ts +8290 -0
  79. package/dist/knowledge.d.ts +543 -0
  80. package/dist/memory-slack-delivery.d.ts +397 -0
  81. package/dist/presentation-artifact-commands.d.ts +349 -0
  82. package/dist/presentation-artifact-commands.js +66 -0
  83. package/dist/presentation-artifact-commands.js.map +1 -0
  84. package/dist/presentation-artifact-query.d.ts +2 -0
  85. package/dist/presentation-artifact-query.js +66 -0
  86. package/dist/presentation-artifact-query.js.map +1 -0
  87. package/dist/retained-output.d.ts +24 -0
  88. package/dist/sandbox-snapshots.d.ts +9 -0
  89. package/dist/scoped-knowledge.d.ts +14 -13
  90. package/dist/slack-bot-scopes.d.ts +4 -0
  91. package/dist/slack-bot-scopes.js +3 -1
  92. package/dist/slack-task-policy.d.ts +294 -0
  93. package/dist/spreadsheet-artifact-commands.d.ts +101 -0
  94. package/dist/spreadsheet-artifact-commands.js +27 -0
  95. package/dist/spreadsheet-artifact-commands.js.map +1 -0
  96. package/dist/spreadsheet-artifact-date.d.ts +4 -0
  97. package/dist/spreadsheet-artifact-query.d.ts +120 -0
  98. package/dist/spreadsheet-artifact-query.js +48 -0
  99. package/dist/spreadsheet-artifact-query.js.map +1 -0
  100. package/dist/task-notes.d.ts +128 -0
  101. package/dist/tool-catalog.d.ts +576 -0
  102. package/dist/video-generation.d.ts +580 -0
  103. package/dist/video-generation.js +59 -0
  104. package/dist/video-generation.js.map +1 -0
  105. package/dist/workspace-learning-policy.d.ts +208 -0
  106. package/dist/xai-provider-account-authority.d.ts +23 -0
  107. package/dist/xai-provider-account-authority.js +9 -0
  108. package/dist/xai-provider-account-authority.js.map +1 -0
  109. package/package.json +73 -1
  110. package/src/artifacts.ts +1 -1
  111. package/src/atlassian.ts +160 -0
  112. package/src/canonical-human-identities.ts +93 -0
  113. package/src/codex-provider-account-authority.ts +37 -0
  114. package/src/company-profile.ts +306 -0
  115. package/src/document-artifact-commands.ts +1709 -0
  116. package/src/document-artifact-query.ts +2 -0
  117. package/src/editable-artifact-binary.ts +396 -0
  118. package/src/editable-artifact-causal-frontier.ts +154 -0
  119. package/src/editable-artifact-codec-registry.ts +261 -0
  120. package/src/editable-artifact-committed-transaction.ts +478 -0
  121. package/src/editable-artifact-live.ts +1379 -0
  122. package/src/editable-artifact-serialized-commit.ts +494 -0
  123. package/src/editable-artifact-versions.ts +8 -0
  124. package/src/editable-artifacts.ts +473 -0
  125. package/src/google-drive.ts +68 -15
  126. package/src/image-generation.ts +106 -0
  127. package/src/index.ts +2920 -326
  128. package/src/interaction.ts +3173 -0
  129. package/src/knowledge.ts +207 -0
  130. package/src/memory-slack-delivery.ts +183 -0
  131. package/src/presentation-artifact-commands.ts +2035 -0
  132. package/src/presentation-artifact-query.ts +2 -0
  133. package/src/retained-output.ts +149 -2
  134. package/src/sandbox-snapshots.ts +28 -1
  135. package/src/scoped-knowledge.ts +18 -4
  136. package/src/slack-bot-scopes.ts +34 -1
  137. package/src/slack-task-policy.ts +215 -0
  138. package/src/spreadsheet-artifact-commands.ts +999 -0
  139. package/src/spreadsheet-artifact-date.ts +21 -0
  140. package/src/spreadsheet-artifact-query.ts +1411 -0
  141. package/src/task-notes.ts +92 -0
  142. package/src/tool-catalog.ts +334 -0
  143. package/src/video-generation.ts +431 -0
  144. package/src/workspace-learning-policy.ts +233 -0
  145. package/src/xai-provider-account-authority.ts +37 -0
  146. package/dist/chunk-5HR2GPSC.js +0 -11031
  147. package/dist/chunk-5HR2GPSC.js.map +0 -1
  148. package/dist/chunk-7JZMI22I.js.map +0 -1
@@ -4,8 +4,10 @@ export declare const GOOGLE_DRIVE_FULL_SCOPE: "https://www.googleapis.com/auth/d
4
4
  export declare const GOOGLE_DRIVE_FILE_SCOPE: "https://www.googleapis.com/auth/drive.file";
5
5
  export declare const GOOGLE_DRIVE_METADATA_READONLY_SCOPE: "https://www.googleapis.com/auth/drive.metadata.readonly";
6
6
  export declare const GOOGLE_DRIVE_READONLY_SCOPE: "https://www.googleapis.com/auth/drive.readonly";
7
+ /** Stable serialized role retained for existing connection rows; not product-facing copy. */
7
8
  export declare const GOOGLE_DRIVE_CREDENTIAL_ROLE: "google_drive_metadata";
8
- export declare const GOOGLE_DRIVE_CREDENTIAL_LABEL: "Google Drive metadata browser";
9
+ export declare const GOOGLE_DRIVE_CREDENTIAL_LABEL: "Google Drive read-only source sync";
10
+ export declare const GOOGLE_DRIVE_LEGACY_CREDENTIAL_LABEL: "Google Drive metadata browser";
9
11
  export declare const GoogleDriveOAuthCapability: z.ZodEnum<{
10
12
  picker_file_read: "picker_file_read";
11
13
  recursive_source_sync: "recursive_source_sync";
@@ -110,6 +112,8 @@ export declare const GoogleDriveSelectedSource: z.ZodObject<{
110
112
  hourly: "hourly";
111
113
  manual: "manual";
112
114
  }>>;
115
+ syncEnabled: z.ZodDefault<z.ZodBoolean>;
116
+ configGeneration: z.ZodDefault<z.ZodNumber>;
113
117
  readPolicy: z.ZodDefault<z.ZodEnum<{
114
118
  allow: "allow";
115
119
  ask: "ask";
@@ -120,7 +124,7 @@ export declare const GoogleDriveSelectedSource: z.ZodObject<{
120
124
  export type GoogleDriveSelectedSource = z.infer<typeof GoogleDriveSelectedSource>;
121
125
  export declare const GoogleDriveConnectionMetadata: z.ZodObject<{
122
126
  credentialRole: z.ZodLiteral<"google_drive_metadata">;
123
- credentialLabel: z.ZodLiteral<"Google Drive metadata browser">;
127
+ credentialLabel: z.ZodUnion<readonly [z.ZodLiteral<"Google Drive read-only source sync">, z.ZodLiteral<"Google Drive metadata browser">]>;
124
128
  googlePermissionId: z.ZodString;
125
129
  googleEmail: z.ZodString;
126
130
  googleDisplayName: z.ZodNullable<z.ZodString>;
@@ -195,6 +199,8 @@ export declare const GoogleDriveConnectionMetadata: z.ZodObject<{
195
199
  hourly: "hourly";
196
200
  manual: "manual";
197
201
  }>>;
202
+ syncEnabled: z.ZodDefault<z.ZodBoolean>;
203
+ configGeneration: z.ZodDefault<z.ZodNumber>;
198
204
  readPolicy: z.ZodDefault<z.ZodEnum<{
199
205
  allow: "allow";
200
206
  ask: "ask";
@@ -228,6 +234,8 @@ export declare const GoogleDriveConnectionMetadata: z.ZodObject<{
228
234
  hourly: "hourly";
229
235
  manual: "manual";
230
236
  }>>;
237
+ syncEnabled: z.ZodDefault<z.ZodBoolean>;
238
+ configGeneration: z.ZodDefault<z.ZodNumber>;
231
239
  readPolicy: z.ZodDefault<z.ZodEnum<{
232
240
  allow: "allow";
233
241
  ask: "ask";
@@ -362,6 +370,7 @@ export declare const SaveGoogleDriveSourceRequest: z.ZodObject<{
362
370
  hourly: "hourly";
363
371
  manual: "manual";
364
372
  }>>;
373
+ syncEnabled: z.ZodDefault<z.ZodBoolean>;
365
374
  readPolicy: z.ZodDefault<z.ZodEnum<{
366
375
  allow: "allow";
367
376
  ask: "ask";
@@ -369,3 +378,106 @@ export declare const SaveGoogleDriveSourceRequest: z.ZodObject<{
369
378
  }>>;
370
379
  }, z.core.$strip>;
371
380
  export type SaveGoogleDriveSourceRequest = z.infer<typeof SaveGoogleDriveSourceRequest>;
381
+ export declare const GoogleDriveKnowledgeSourceItem: z.ZodObject<{
382
+ id: z.ZodString;
383
+ name: z.ZodString;
384
+ mimeType: z.ZodString;
385
+ driveId: z.ZodOptional<z.ZodString>;
386
+ sourceKind: z.ZodEnum<{
387
+ folder: "folder";
388
+ my_drive: "my_drive";
389
+ shared_drive: "shared_drive";
390
+ }>;
391
+ includeDescendants: z.ZodBoolean;
392
+ }, z.core.$strip>;
393
+ export type GoogleDriveKnowledgeSourceItem = z.infer<typeof GoogleDriveKnowledgeSourceItem>;
394
+ export declare const GoogleDriveKnowledgeSourceDestination: z.ZodObject<{
395
+ authorityKind: z.ZodEnum<{
396
+ organization: "organization";
397
+ personal: "personal";
398
+ workspace: "workspace";
399
+ }>;
400
+ authorityAccountId: z.ZodString;
401
+ authorityWorkspaceId: z.ZodOptional<z.ZodString>;
402
+ authoritySubjectId: z.ZodOptional<z.ZodString>;
403
+ collectionId: z.ZodOptional<z.ZodString>;
404
+ }, z.core.$strip>;
405
+ export type GoogleDriveKnowledgeSourceDestination = z.infer<typeof GoogleDriveKnowledgeSourceDestination>;
406
+ export declare const GoogleDriveKnowledgeSourceConfig: z.ZodObject<{
407
+ sources: z.ZodArray<z.ZodObject<{
408
+ id: z.ZodString;
409
+ name: z.ZodString;
410
+ mimeType: z.ZodString;
411
+ driveId: z.ZodOptional<z.ZodString>;
412
+ sourceKind: z.ZodEnum<{
413
+ folder: "folder";
414
+ my_drive: "my_drive";
415
+ shared_drive: "shared_drive";
416
+ }>;
417
+ includeDescendants: z.ZodBoolean;
418
+ }, z.core.$strip>>;
419
+ destination: z.ZodObject<{
420
+ authorityKind: z.ZodEnum<{
421
+ organization: "organization";
422
+ personal: "personal";
423
+ workspace: "workspace";
424
+ }>;
425
+ authorityAccountId: z.ZodString;
426
+ authorityWorkspaceId: z.ZodOptional<z.ZodString>;
427
+ authoritySubjectId: z.ZodOptional<z.ZodString>;
428
+ collectionId: z.ZodOptional<z.ZodString>;
429
+ }, z.core.$strip>;
430
+ syncCadence: z.ZodEnum<{
431
+ daily: "daily";
432
+ hourly: "hourly";
433
+ manual: "manual";
434
+ }>;
435
+ readPolicy: z.ZodEnum<{
436
+ allow: "allow";
437
+ ask: "ask";
438
+ block: "block";
439
+ }>;
440
+ }, z.core.$strip>;
441
+ export type GoogleDriveKnowledgeSourceConfig = z.infer<typeof GoogleDriveKnowledgeSourceConfig>;
442
+ export declare const SaveGoogleDriveIntegrationSourceRequest: z.ZodIntersection<z.ZodObject<{
443
+ sources: z.ZodArray<z.ZodObject<{
444
+ id: z.ZodString;
445
+ name: z.ZodString;
446
+ mimeType: z.ZodString;
447
+ driveId: z.ZodNullable<z.ZodString>;
448
+ }, z.core.$strip>>;
449
+ destination: z.ZodOptional<z.ZodObject<{
450
+ authorityKind: z.ZodEnum<{
451
+ organization: "organization";
452
+ personal: "personal";
453
+ workspace: "workspace";
454
+ }>;
455
+ collectionId: z.ZodDefault<z.ZodNullable<z.ZodString>>;
456
+ }, z.core.$strip>>;
457
+ targetScope: z.ZodOptional<z.ZodEnum<{
458
+ organization: "organization";
459
+ user: "user";
460
+ workspace: "workspace";
461
+ }>>;
462
+ syncCadence: z.ZodDefault<z.ZodEnum<{
463
+ daily: "daily";
464
+ hourly: "hourly";
465
+ manual: "manual";
466
+ }>>;
467
+ syncEnabled: z.ZodDefault<z.ZodBoolean>;
468
+ readPolicy: z.ZodDefault<z.ZodEnum<{
469
+ allow: "allow";
470
+ ask: "ask";
471
+ block: "block";
472
+ }>>;
473
+ }, z.core.$strip>, z.ZodObject<{
474
+ sources: z.ZodArray<z.ZodObject<{
475
+ id: z.ZodString;
476
+ name: z.ZodString;
477
+ mimeType: z.ZodString;
478
+ driveId: z.ZodNullable<z.ZodString>;
479
+ }, z.core.$strip>>;
480
+ expectedVersion: z.ZodOptional<z.ZodNumber>;
481
+ idempotencyKey: z.ZodString;
482
+ }, z.core.$strip>>;
483
+ export type SaveGoogleDriveIntegrationSourceRequest = z.infer<typeof SaveGoogleDriveIntegrationSourceRequest>;
@@ -1,11 +1,25 @@
1
1
  import {
2
2
  ConnectionMetadata
3
- } from "./chunk-5HR2GPSC.js";
3
+ } from "./chunk-Q6A7XT2N.js";
4
4
  import {
5
5
  ConnectorDocumentDestination,
6
6
  ConnectorDocumentDestinationSelection
7
7
  } from "./chunk-WYBDERIY.js";
8
- import "./chunk-7JZMI22I.js";
8
+ import "./chunk-5UDNP7AO.js";
9
+ import "./chunk-Y3MLSLB4.js";
10
+ import "./chunk-CM6BMECR.js";
11
+ import "./chunk-JUFK3T4Q.js";
12
+ import "./chunk-M5ZGRVIQ.js";
13
+ import "./chunk-LW7OH6CS.js";
14
+ import "./chunk-TZ6YEYN4.js";
15
+ import "./chunk-YRKRZ6OF.js";
16
+ import "./chunk-JBCIY7QD.js";
17
+ import "./chunk-RIY7GYQS.js";
18
+ import "./chunk-CADSX6UN.js";
19
+ import "./chunk-D2HKF2EF.js";
20
+ import "./chunk-MYBZRDTY.js";
21
+ import "./chunk-LSB7GRLG.js";
22
+ import "./chunk-BVGIYW7D.js";
9
23
 
10
24
  // src/google-drive.ts
11
25
  import { z } from "zod";
@@ -15,7 +29,8 @@ var GOOGLE_DRIVE_FILE_SCOPE = "https://www.googleapis.com/auth/drive.file";
15
29
  var GOOGLE_DRIVE_METADATA_READONLY_SCOPE = "https://www.googleapis.com/auth/drive.metadata.readonly";
16
30
  var GOOGLE_DRIVE_READONLY_SCOPE = "https://www.googleapis.com/auth/drive.readonly";
17
31
  var GOOGLE_DRIVE_CREDENTIAL_ROLE = "google_drive_metadata";
18
- var GOOGLE_DRIVE_CREDENTIAL_LABEL = "Google Drive metadata browser";
32
+ var GOOGLE_DRIVE_CREDENTIAL_LABEL = "Google Drive read-only source sync";
33
+ var GOOGLE_DRIVE_LEGACY_CREDENTIAL_LABEL = "Google Drive metadata browser";
19
34
  var GoogleDriveOAuthCapability = z.enum([
20
35
  "picker_file_read",
21
36
  "source_metadata_discovery",
@@ -101,12 +116,17 @@ var GoogleDriveSelectedSource = z.object({
101
116
  /** @deprecated Missing destinations resolve to the current workspace boundary. */
102
117
  targetScope: GoogleDriveTargetScope.optional(),
103
118
  syncCadence: GoogleDriveSyncCadence.default("hourly"),
119
+ syncEnabled: z.boolean().default(false),
120
+ configGeneration: z.number().int().positive().default(1),
104
121
  readPolicy: GoogleDriveReadPolicy.default("allow"),
105
122
  selectedAt: z.string().datetime({ offset: true })
106
123
  });
107
124
  var GoogleDriveConnectionMetadata = z.object({
108
125
  credentialRole: z.literal(GOOGLE_DRIVE_CREDENTIAL_ROLE),
109
- credentialLabel: z.literal(GOOGLE_DRIVE_CREDENTIAL_LABEL),
126
+ credentialLabel: z.union([
127
+ z.literal(GOOGLE_DRIVE_CREDENTIAL_LABEL),
128
+ z.literal(GOOGLE_DRIVE_LEGACY_CREDENTIAL_LABEL)
129
+ ]),
110
130
  googlePermissionId: z.string().min(1).max(256),
111
131
  googleEmail: z.string().email().max(320),
112
132
  googleDisplayName: z.string().min(1).max(512).nullable(),
@@ -151,30 +171,64 @@ var GoogleDriveBrowseResponse = z.object({
151
171
  nextPageToken: z.string().min(1).max(4096).nullable(),
152
172
  incompleteSearch: z.boolean()
153
173
  });
174
+ var GoogleDriveSourceSelection = z.array(
175
+ GoogleDriveBrowseItem.pick({
176
+ id: true,
177
+ name: true,
178
+ mimeType: true,
179
+ driveId: true
180
+ })
181
+ ).max(100).refine((sources) => new Set(sources.map((source) => source.id)).size === sources.length, {
182
+ message: "Google Drive sources must be unique"
183
+ });
154
184
  var SaveGoogleDriveSourceRequest = z.object({
155
- sources: z.array(
156
- GoogleDriveBrowseItem.pick({
157
- id: true,
158
- name: true,
159
- mimeType: true,
160
- driveId: true
161
- })
162
- ).max(100).refine((sources) => new Set(sources.map((source) => source.id)).size === sources.length, {
163
- message: "Google Drive sources must be unique"
164
- }),
185
+ sources: GoogleDriveSourceSelection,
165
186
  destination: ConnectorDocumentDestinationSelection.optional(),
166
187
  /** @deprecated Legacy requests are accepted but resolve to workspace authority. */
167
188
  targetScope: GoogleDriveTargetScope.optional(),
168
189
  syncCadence: GoogleDriveSyncCadence.default("hourly"),
190
+ syncEnabled: z.boolean().default(false),
169
191
  readPolicy: GoogleDriveReadPolicy.default("allow")
170
192
  }).refine((request) => request.destination !== void 0 || request.targetScope !== void 0, {
171
193
  message: "Google Drive document destination is required"
172
194
  });
195
+ var GoogleDriveKnowledgeSourceItem = z.object({
196
+ id: z.string().min(1).max(512),
197
+ name: z.string().min(1).max(1024),
198
+ mimeType: z.string().min(1).max(256),
199
+ driveId: z.string().min(1).max(512).optional(),
200
+ sourceKind: z.enum(["my_drive", "shared_drive", "folder"]),
201
+ includeDescendants: z.boolean()
202
+ });
203
+ var GoogleDriveKnowledgeSourceDestination = z.object({
204
+ authorityKind: z.enum(["organization", "workspace", "personal"]),
205
+ authorityAccountId: z.string().min(1).max(128),
206
+ authorityWorkspaceId: z.string().min(1).max(128).optional(),
207
+ authoritySubjectId: z.string().min(1).max(512).optional(),
208
+ collectionId: z.string().min(1).max(512).optional()
209
+ });
210
+ var GoogleDriveKnowledgeSourceConfig = z.object({
211
+ sources: z.array(GoogleDriveKnowledgeSourceItem).min(1).max(100),
212
+ destination: GoogleDriveKnowledgeSourceDestination,
213
+ syncCadence: GoogleDriveSyncCadence,
214
+ readPolicy: GoogleDriveReadPolicy
215
+ });
216
+ var SaveGoogleDriveIntegrationSourceRequest = z.intersection(
217
+ SaveGoogleDriveSourceRequest,
218
+ z.object({
219
+ sources: GoogleDriveSourceSelection.refine((sources) => sources.length > 0, {
220
+ message: "At least one Google Drive source is required"
221
+ }),
222
+ expectedVersion: z.number().int().positive().optional(),
223
+ idempotencyKey: z.string().uuid()
224
+ })
225
+ );
173
226
  export {
174
227
  GOOGLE_DRIVE_CREDENTIAL_LABEL,
175
228
  GOOGLE_DRIVE_CREDENTIAL_ROLE,
176
229
  GOOGLE_DRIVE_FILE_SCOPE,
177
230
  GOOGLE_DRIVE_FULL_SCOPE,
231
+ GOOGLE_DRIVE_LEGACY_CREDENTIAL_LABEL,
178
232
  GOOGLE_DRIVE_METADATA_READONLY_SCOPE,
179
233
  GOOGLE_DRIVE_PROVIDER_DOMAIN,
180
234
  GOOGLE_DRIVE_READONLY_SCOPE,
@@ -184,6 +238,9 @@ export {
184
238
  GoogleDriveConnectionLifecycleState,
185
239
  GoogleDriveConnectionMetadata,
186
240
  GoogleDriveDisconnectRequest,
241
+ GoogleDriveKnowledgeSourceConfig,
242
+ GoogleDriveKnowledgeSourceDestination,
243
+ GoogleDriveKnowledgeSourceItem,
187
244
  GoogleDriveLifecycleActionRequest,
188
245
  GoogleDriveOAuthCapability,
189
246
  GoogleDriveOAuthStartRequest,
@@ -192,6 +249,7 @@ export {
192
249
  GoogleDriveSelectedSource,
193
250
  GoogleDriveSyncCadence,
194
251
  GoogleDriveTargetScope,
252
+ SaveGoogleDriveIntegrationSourceRequest,
195
253
  SaveGoogleDriveSourceRequest,
196
254
  googleDriveOAuthScopeDecision,
197
255
  googleDriveScopesAllowCapability
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/google-drive.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { ConnectionMetadata } from \"./index\";\nimport {\n ConnectorDocumentDestination,\n ConnectorDocumentDestinationSelection,\n} from \"./connector-destinations\";\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\n/** @deprecated Connector document destinations use organization/workspace/personal authority. */\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 destination: ConnectorDocumentDestination.optional(),\n /** @deprecated Missing destinations resolve to the current workspace boundary. */\n targetScope: GoogleDriveTargetScope.optional(),\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 documentDestination: ConnectorDocumentDestination.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\n .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 destination: ConnectorDocumentDestinationSelection.optional(),\n /** @deprecated Legacy requests are accepted but resolve to workspace authority. */\n targetScope: GoogleDriveTargetScope.optional(),\n syncCadence: GoogleDriveSyncCadence.default(\"hourly\"),\n readPolicy: GoogleDriveReadPolicy.default(\"allow\"),\n })\n .refine((request) => request.destination !== undefined || request.targetScope !== undefined, {\n message: \"Google Drive document destination is required\",\n });\nexport type SaveGoogleDriveSourceRequest = z.infer<typeof SaveGoogleDriveSourceRequest>;\n"],"mappings":";;;;;;;;;;AAAA,SAAS,SAAS;AAQX,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;A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a,uBAAuB,QAAQ,QAAQ;AAAA,EACpD,YAAY,sBAAsB,QAAQ,OAAO;AACnD,CAAC,EACA,OAAO,CAAC,YAAY,QAAQ,gBAAgB,UAAa,QAAQ,gBAAgB,QAAW;AAAA,EAC3F,SAAS;AACX,CAAC;","names":[]}
1
+ {"version":3,"sources":["../src/google-drive.ts"],"sourcesContent":["import { z } from \"zod\";\n\nimport { ConnectionMetadata } from \"./index\";\nimport {\n ConnectorDocumentDestination,\n ConnectorDocumentDestinationSelection,\n} from \"./connector-destinations\";\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;\n/** Stable serialized role retained for existing connection rows; not product-facing copy. */\nexport const GOOGLE_DRIVE_CREDENTIAL_ROLE = \"google_drive_metadata\" as const;\nexport const GOOGLE_DRIVE_CREDENTIAL_LABEL = \"Google Drive read-only source sync\" as const;\nexport const GOOGLE_DRIVE_LEGACY_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\n/** @deprecated Connector document destinations use organization/workspace/personal authority. */\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 destination: ConnectorDocumentDestination.optional(),\n /** @deprecated Missing destinations resolve to the current workspace boundary. */\n targetScope: GoogleDriveTargetScope.optional(),\n syncCadence: GoogleDriveSyncCadence.default(\"hourly\"),\n syncEnabled: z.boolean().default(false),\n configGeneration: z.number().int().positive().default(1),\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.union([\n z.literal(GOOGLE_DRIVE_CREDENTIAL_LABEL),\n z.literal(GOOGLE_DRIVE_LEGACY_CREDENTIAL_LABEL),\n ]),\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 documentDestination: ConnectorDocumentDestination.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\nconst GoogleDriveSourceSelection = 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\nexport const SaveGoogleDriveSourceRequest = z\n .object({\n sources: GoogleDriveSourceSelection,\n destination: ConnectorDocumentDestinationSelection.optional(),\n /** @deprecated Legacy requests are accepted but resolve to workspace authority. */\n targetScope: GoogleDriveTargetScope.optional(),\n syncCadence: GoogleDriveSyncCadence.default(\"hourly\"),\n syncEnabled: z.boolean().default(false),\n readPolicy: GoogleDriveReadPolicy.default(\"allow\"),\n })\n .refine((request) => request.destination !== undefined || request.targetScope !== undefined, {\n message: \"Google Drive document destination is required\",\n });\nexport type SaveGoogleDriveSourceRequest = z.infer<typeof SaveGoogleDriveSourceRequest>;\n\nexport const GoogleDriveKnowledgeSourceItem = z.object({\n id: z.string().min(1).max(512),\n name: z.string().min(1).max(1024),\n mimeType: z.string().min(1).max(256),\n driveId: z.string().min(1).max(512).optional(),\n sourceKind: z.enum([\"my_drive\", \"shared_drive\", \"folder\"]),\n includeDescendants: z.boolean(),\n});\nexport type GoogleDriveKnowledgeSourceItem = z.infer<typeof GoogleDriveKnowledgeSourceItem>;\n\nexport const GoogleDriveKnowledgeSourceDestination = z.object({\n authorityKind: z.enum([\"organization\", \"workspace\", \"personal\"]),\n authorityAccountId: z.string().min(1).max(128),\n authorityWorkspaceId: z.string().min(1).max(128).optional(),\n authoritySubjectId: z.string().min(1).max(512).optional(),\n collectionId: z.string().min(1).max(512).optional(),\n});\nexport type GoogleDriveKnowledgeSourceDestination = z.infer<\n typeof GoogleDriveKnowledgeSourceDestination\n>;\n\nexport const GoogleDriveKnowledgeSourceConfig = z.object({\n sources: z.array(GoogleDriveKnowledgeSourceItem).min(1).max(100),\n destination: GoogleDriveKnowledgeSourceDestination,\n syncCadence: GoogleDriveSyncCadence,\n readPolicy: GoogleDriveReadPolicy,\n});\nexport type GoogleDriveKnowledgeSourceConfig = z.infer<typeof GoogleDriveKnowledgeSourceConfig>;\n\nexport const SaveGoogleDriveIntegrationSourceRequest = z.intersection(\n SaveGoogleDriveSourceRequest,\n z.object({\n sources: GoogleDriveSourceSelection.refine((sources) => sources.length > 0, {\n message: \"At least one Google Drive source is required\",\n }),\n expectedVersion: z.number().int().positive().optional(),\n idempotencyKey: z.string().uuid(),\n }),\n);\nexport type SaveGoogleDriveIntegrationSourceRequest = z.infer<\n typeof SaveGoogleDriveIntegrationSourceRequest\n>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS;AAQX,IAAM,+BAA+B;AACrC,IAAM,0BAA0B;AAChC,IAAM,0BAA0B;AAChC,IAAM,uCACX;AACK,IAAM,8BACX;AAEK,IAAM,+BAA+B;AACrC,IAAM,gCAAgC;AACtC,IAAM,uCAAuC;AAE7C,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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I,GAAG,EAAE,SAAS;AAAA,EACxD,cAAc,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,EAAE,SAAS;AACpD,CAAC;AAKM,IAAM,mCAAmC,EAAE,OAAO;AAAA,EACvD,SAAS,EAAE,MAAM,8BAA8B,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EAC/D,aAAa;AAAA,EACb,aAAa;AAAA,EACb,YAAY;AACd,CAAC;AAGM,IAAM,0CAA0C,EAAE;AAAA,EACvD;AAAA,EACA,EAAE,OAAO;AAAA,IACP,SAAS,2BAA2B,OAAO,CAAC,YAAY,QAAQ,SAAS,GAAG;AAAA,MAC1E,SAAS;AAAA,IACX,CAAC;AAAA,IACD,iBAAiB,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS;AAAA,IACtD,gBAAgB,EAAE,OAAO,EAAE,KAAK;AAAA,EAClC,CAAC;AACH;","names":[]}
@@ -0,0 +1,70 @@
1
+ import { z } from "zod";
2
+ export declare const IMAGE_GENERATION_MAX_REFERENCES = 4;
3
+ /** One ordered, workspace-owned input used to guide or edit an image. */
4
+ export declare const ImageGenerationReferenceSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
5
+ kind: z.ZodLiteral<"sandbox_path">;
6
+ path: z.ZodString;
7
+ }, z.core.$strict>, z.ZodObject<{
8
+ kind: z.ZodLiteral<"file">;
9
+ fileId: z.ZodString;
10
+ }, z.core.$strict>, z.ZodObject<{
11
+ kind: z.ZodLiteral<"artifact">;
12
+ artifactId: z.ZodString;
13
+ }, z.core.$strict>], "kind">;
14
+ export type ImageGenerationReference = z.infer<typeof ImageGenerationReferenceSchema>;
15
+ /** Provider-neutral minimum shared by native and adapter-backed image tools. */
16
+ export declare const GenerateImageToolInput: z.ZodObject<{
17
+ prompt: z.ZodString;
18
+ references: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
19
+ kind: z.ZodLiteral<"sandbox_path">;
20
+ path: z.ZodString;
21
+ }, z.core.$strict>, z.ZodObject<{
22
+ kind: z.ZodLiteral<"file">;
23
+ fileId: z.ZodString;
24
+ }, z.core.$strict>, z.ZodObject<{
25
+ kind: z.ZodLiteral<"artifact">;
26
+ artifactId: z.ZodString;
27
+ }, z.core.$strict>], "kind">>>>;
28
+ }, z.core.$strict>;
29
+ export type GenerateImageToolInput = z.infer<typeof GenerateImageToolInput>;
30
+ /** Closed durable result shared by native and adapter-backed image tools. */
31
+ export declare const GeneratedImageReceiptSchema: z.ZodObject<{
32
+ type: z.ZodLiteral<"generated_image">;
33
+ artifact: z.ZodObject<{
34
+ available: z.ZodLiteral<true>;
35
+ artifactId: z.ZodString;
36
+ kind: z.ZodEnum<{
37
+ assistant_completion: "assistant_completion";
38
+ computer_screenshot: "computer_screenshot";
39
+ event_media: "event_media";
40
+ file: "file";
41
+ generated_image: "generated_image";
42
+ generated_video: "generated_video";
43
+ internal_update: "internal_update";
44
+ tool_result: "tool_result";
45
+ }>;
46
+ contentType: z.ZodString;
47
+ originalBytes: z.ZodNumber;
48
+ sha256: z.ZodString;
49
+ retainedAt: z.ZodString;
50
+ dimensions: z.ZodOptional<z.ZodObject<{
51
+ width: z.ZodNumber;
52
+ height: z.ZodNumber;
53
+ }, z.core.$strict>>;
54
+ retention: z.ZodUnion<readonly [z.ZodObject<{
55
+ policy: z.ZodLiteral<"workspace_file">;
56
+ expiresAt: z.ZodNull;
57
+ }, z.core.$strict>, z.ZodObject<{
58
+ policy: z.ZodLiteral<"session_screenshot">;
59
+ expiresAt: z.ZodString;
60
+ }, z.core.$strict>]>;
61
+ retrieval: z.ZodObject<{
62
+ method: z.ZodLiteral<"GET">;
63
+ path: z.ZodString;
64
+ acceptRanges: z.ZodLiteral<"bytes">;
65
+ maxRangeBytes: z.ZodNumber;
66
+ }, z.core.$strict>;
67
+ }, z.core.$strict>;
68
+ sandboxPath: z.ZodString;
69
+ }, z.core.$strict>;
70
+ export type GeneratedImageReceipt = z.infer<typeof GeneratedImageReceiptSchema>;