@opengeni/contracts 0.50.0 → 1.0.1

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.
@@ -8,15 +8,19 @@ export declare const GOOGLE_DRIVE_READONLY_SCOPE: "https://www.googleapis.com/au
8
8
  export declare const GOOGLE_DRIVE_CREDENTIAL_ROLE: "google_drive_metadata";
9
9
  export declare const GOOGLE_DRIVE_CREDENTIAL_LABEL: "Google Drive read-only source sync";
10
10
  export declare const GOOGLE_DRIVE_LEGACY_CREDENTIAL_LABEL: "Google Drive metadata browser";
11
+ export declare const GOOGLE_DRIVE_PUBLICATION_SERVER_ID: "google-drive-publishing";
12
+ export declare const GOOGLE_DRIVE_PUBLICATION_TOOL_NAME: "google_drive_publish_file";
13
+ export declare const GOOGLE_DRIVE_PUBLICATION_CREATE_ACTION: "create";
11
14
  export declare const GoogleDriveOAuthCapability: z.ZodEnum<{
12
15
  picker_file_read: "picker_file_read";
16
+ publish_file: "publish_file";
13
17
  recursive_source_sync: "recursive_source_sync";
14
18
  source_content_read: "source_content_read";
15
19
  source_metadata_discovery: "source_metadata_discovery";
16
20
  }>;
17
21
  export type GoogleDriveOAuthCapability = z.infer<typeof GoogleDriveOAuthCapability>;
18
22
  export type GoogleDriveOAuthScopeDecision = {
19
- accessMode: "metadata_readonly" | "readonly" | null;
23
+ accessMode: "file_only" | "metadata_readonly" | "readonly" | null;
20
24
  capabilities: GoogleDriveOAuthCapability[];
21
25
  };
22
26
  /**
@@ -122,6 +126,17 @@ export declare const GoogleDriveSelectedSource: z.ZodObject<{
122
126
  selectedAt: z.ZodString;
123
127
  }, z.core.$strip>;
124
128
  export type GoogleDriveSelectedSource = z.infer<typeof GoogleDriveSelectedSource>;
129
+ export declare const GoogleDriveOutputDestination: z.ZodObject<{
130
+ folderId: z.ZodString;
131
+ folderName: z.ZodString;
132
+ driveId: z.ZodNullable<z.ZodString>;
133
+ location: z.ZodEnum<{
134
+ my_drive: "my_drive";
135
+ shared_drive: "shared_drive";
136
+ }>;
137
+ selectedAt: z.ZodString;
138
+ }, z.core.$strict>;
139
+ export type GoogleDriveOutputDestination = z.infer<typeof GoogleDriveOutputDestination>;
125
140
  export declare const GoogleDriveConnectionMetadata: z.ZodObject<{
126
141
  credentialRole: z.ZodLiteral<"google_drive_metadata">;
127
142
  credentialLabel: z.ZodUnion<readonly [z.ZodLiteral<"Google Drive read-only source sync">, z.ZodLiteral<"Google Drive metadata browser">]>;
@@ -130,6 +145,7 @@ export declare const GoogleDriveConnectionMetadata: z.ZodObject<{
130
145
  googleDisplayName: z.ZodNullable<z.ZodString>;
131
146
  verifiedAt: z.ZodString;
132
147
  accessMode: z.ZodEnum<{
148
+ file_only: "file_only";
133
149
  metadata_readonly: "metadata_readonly";
134
150
  readonly: "readonly";
135
151
  }>;
@@ -162,6 +178,16 @@ export declare const GoogleDriveConnectionMetadata: z.ZodObject<{
162
178
  recoverable: z.ZodLiteral<true>;
163
179
  observedAt: z.ZodString;
164
180
  }, z.core.$strip>], "state">>;
181
+ outputDestination: z.ZodOptional<z.ZodObject<{
182
+ folderId: z.ZodString;
183
+ folderName: z.ZodString;
184
+ driveId: z.ZodNullable<z.ZodString>;
185
+ location: z.ZodEnum<{
186
+ my_drive: "my_drive";
187
+ shared_drive: "shared_drive";
188
+ }>;
189
+ selectedAt: z.ZodString;
190
+ }, z.core.$strict>>;
165
191
  documentDestination: z.ZodOptional<z.ZodObject<{
166
192
  authorityKind: z.ZodEnum<{
167
193
  organization: "organization";
@@ -247,6 +273,10 @@ export declare const GoogleDriveConnectionMetadata: z.ZodObject<{
247
273
  export type GoogleDriveConnectionMetadata = z.infer<typeof GoogleDriveConnectionMetadata>;
248
274
  export declare const GoogleDriveOAuthStartRequest: z.ZodObject<{
249
275
  connectionId: z.ZodOptional<z.ZodString>;
276
+ capability: z.ZodDefault<z.ZodEnum<{
277
+ publish: "publish";
278
+ source_read: "source_read";
279
+ }>>;
250
280
  }, z.core.$strip>;
251
281
  export type GoogleDriveOAuthStartRequest = z.infer<typeof GoogleDriveOAuthStartRequest>;
252
282
  export declare const GoogleDriveOAuthStartResponse: z.ZodObject<{
@@ -267,6 +297,63 @@ export declare const GoogleDriveDisconnectRequest: z.ZodObject<{
267
297
  idempotencyKey: z.ZodString;
268
298
  }, z.core.$strip>;
269
299
  export type GoogleDriveDisconnectRequest = z.infer<typeof GoogleDriveDisconnectRequest>;
300
+ export declare const GoogleDrivePublicationExportFile: z.ZodObject<{
301
+ fileId: z.ZodString;
302
+ filename: z.ZodString;
303
+ contentType: z.ZodString;
304
+ sizeBytes: z.ZodNumber;
305
+ sha256: z.ZodString;
306
+ artifactId: z.ZodString;
307
+ versionId: z.ZodString;
308
+ materializationJobId: z.ZodString;
309
+ sourceHeadSequence: z.ZodNumber;
310
+ sourceStateHash: z.ZodString;
311
+ }, z.core.$strict>;
312
+ export type GoogleDrivePublicationExportFile = z.infer<typeof GoogleDrivePublicationExportFile>;
313
+ export declare const GoogleDrivePublicationToolInput: z.ZodObject<{
314
+ title: z.ZodString;
315
+ modality: z.ZodEnum<{
316
+ document: "document";
317
+ presentation: "presentation";
318
+ spreadsheet: "spreadsheet";
319
+ }>;
320
+ file: z.ZodObject<{
321
+ fileId: z.ZodString;
322
+ filename: z.ZodString;
323
+ contentType: z.ZodString;
324
+ sizeBytes: z.ZodNumber;
325
+ sha256: z.ZodString;
326
+ artifactId: z.ZodString;
327
+ versionId: z.ZodString;
328
+ materializationJobId: z.ZodString;
329
+ sourceHeadSequence: z.ZodNumber;
330
+ sourceStateHash: z.ZodString;
331
+ }, z.core.$strict>;
332
+ idempotencyKey: z.ZodString;
333
+ }, z.core.$strict>;
334
+ export type GoogleDrivePublicationToolInput = z.infer<typeof GoogleDrivePublicationToolInput>;
335
+ export declare const GoogleDrivePublicationReceipt: z.ZodObject<{
336
+ connectionId: z.ZodString;
337
+ providerFileId: z.ZodString;
338
+ webViewLink: z.ZodString;
339
+ mimeType: z.ZodEnum<{
340
+ "application/vnd.google-apps.document": "application/vnd.google-apps.document";
341
+ "application/vnd.google-apps.presentation": "application/vnd.google-apps.presentation";
342
+ "application/vnd.google-apps.spreadsheet": "application/vnd.google-apps.spreadsheet";
343
+ }>;
344
+ destination: z.ZodObject<{
345
+ folderId: z.ZodString;
346
+ folderName: z.ZodString;
347
+ driveId: z.ZodNullable<z.ZodString>;
348
+ location: z.ZodEnum<{
349
+ my_drive: "my_drive";
350
+ shared_drive: "shared_drive";
351
+ }>;
352
+ selectedAt: z.ZodString;
353
+ }, z.core.$strict>;
354
+ replayed: z.ZodBoolean;
355
+ }, z.core.$strict>;
356
+ export type GoogleDrivePublicationReceipt = z.infer<typeof GoogleDrivePublicationReceipt>;
270
357
  export declare const GoogleDriveBrowseItem: z.ZodObject<{
271
358
  id: z.ZodString;
272
359
  name: z.ZodString;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  ConnectionMetadata
3
- } from "./chunk-Q6A7XT2N.js";
3
+ } from "./chunk-NX5JNF4L.js";
4
4
  import {
5
5
  ConnectorDocumentDestination,
6
6
  ConnectorDocumentDestinationSelection
@@ -31,8 +31,12 @@ var GOOGLE_DRIVE_READONLY_SCOPE = "https://www.googleapis.com/auth/drive.readonl
31
31
  var GOOGLE_DRIVE_CREDENTIAL_ROLE = "google_drive_metadata";
32
32
  var GOOGLE_DRIVE_CREDENTIAL_LABEL = "Google Drive read-only source sync";
33
33
  var GOOGLE_DRIVE_LEGACY_CREDENTIAL_LABEL = "Google Drive metadata browser";
34
+ var GOOGLE_DRIVE_PUBLICATION_SERVER_ID = "google-drive-publishing";
35
+ var GOOGLE_DRIVE_PUBLICATION_TOOL_NAME = "google_drive_publish_file";
36
+ var GOOGLE_DRIVE_PUBLICATION_CREATE_ACTION = "create";
34
37
  var GoogleDriveOAuthCapability = z.enum([
35
38
  "picker_file_read",
39
+ "publish_file",
36
40
  "source_metadata_discovery",
37
41
  "source_content_read",
38
42
  "recursive_source_sync"
@@ -41,16 +45,18 @@ function googleDriveOAuthScopeDecision(grantedScopes) {
41
45
  const granted = new Set(grantedScopes);
42
46
  const hasFullDrive = granted.has(GOOGLE_DRIVE_FULL_SCOPE);
43
47
  const hasSourceContentRead = hasFullDrive || granted.has(GOOGLE_DRIVE_READONLY_SCOPE);
48
+ const hasFileWrite = hasFullDrive || granted.has(GOOGLE_DRIVE_FILE_SCOPE);
44
49
  const hasSourceMetadataDiscovery = hasSourceContentRead || granted.has(GOOGLE_DRIVE_METADATA_READONLY_SCOPE);
45
- const hasPickerFileRead = hasSourceContentRead || granted.has(GOOGLE_DRIVE_FILE_SCOPE);
50
+ const hasPickerFileRead = hasSourceContentRead || hasFileWrite;
46
51
  const capabilities = [];
47
52
  if (hasPickerFileRead) capabilities.push("picker_file_read");
53
+ if (hasFileWrite) capabilities.push("publish_file");
48
54
  if (hasSourceMetadataDiscovery) capabilities.push("source_metadata_discovery");
49
55
  if (hasSourceContentRead) {
50
56
  capabilities.push("source_content_read", "recursive_source_sync");
51
57
  }
52
58
  return {
53
- accessMode: hasSourceContentRead ? "readonly" : hasSourceMetadataDiscovery ? "metadata_readonly" : null,
59
+ accessMode: hasSourceContentRead ? "readonly" : hasSourceMetadataDiscovery ? "metadata_readonly" : hasFileWrite ? "file_only" : null,
54
60
  capabilities
55
61
  };
56
62
  }
@@ -121,6 +127,21 @@ var GoogleDriveSelectedSource = z.object({
121
127
  readPolicy: GoogleDriveReadPolicy.default("allow"),
122
128
  selectedAt: z.string().datetime({ offset: true })
123
129
  });
130
+ var GoogleDriveOutputDestination = z.object({
131
+ folderId: z.string().min(1).max(256),
132
+ folderName: z.string().min(1).max(1024),
133
+ driveId: z.string().min(1).max(256).nullable(),
134
+ location: z.enum(["my_drive", "shared_drive"]),
135
+ selectedAt: z.string().datetime({ offset: true })
136
+ }).strict().superRefine((value, context) => {
137
+ if (value.location === "my_drive" !== (value.driveId === null)) {
138
+ context.addIssue({
139
+ code: "custom",
140
+ path: ["driveId"],
141
+ message: "Google Drive destination location does not match its drive identity"
142
+ });
143
+ }
144
+ });
124
145
  var GoogleDriveConnectionMetadata = z.object({
125
146
  credentialRole: z.literal(GOOGLE_DRIVE_CREDENTIAL_ROLE),
126
147
  credentialLabel: z.union([
@@ -131,15 +152,17 @@ var GoogleDriveConnectionMetadata = z.object({
131
152
  googleEmail: z.string().email().max(320),
132
153
  googleDisplayName: z.string().min(1).max(512).nullable(),
133
154
  verifiedAt: z.string().datetime({ offset: true }),
134
- accessMode: z.enum(["metadata_readonly", "readonly"]),
155
+ accessMode: z.enum(["file_only", "metadata_readonly", "readonly"]),
135
156
  lifecycle: GoogleDriveConnectionLifecycle.optional(),
157
+ outputDestination: GoogleDriveOutputDestination.optional(),
136
158
  documentDestination: ConnectorDocumentDestination.optional(),
137
159
  selectedSources: z.array(GoogleDriveSelectedSource).max(100).optional(),
138
160
  /** @deprecated Read `selectedSources`; retained while existing connections migrate. */
139
161
  selectedSource: GoogleDriveSelectedSource.nullable().optional()
140
162
  }).passthrough();
141
163
  var GoogleDriveOAuthStartRequest = z.object({
142
- connectionId: z.string().uuid().optional()
164
+ connectionId: z.string().uuid().optional(),
165
+ capability: z.enum(["source_read", "publish"]).default("source_read")
143
166
  });
144
167
  var GoogleDriveOAuthStartResponse = z.object({
145
168
  authorizationUrl: z.string().url(),
@@ -153,6 +176,36 @@ var GoogleDriveDisconnectRequest = z.object({
153
176
  expectedVersion: z.number().int().positive(),
154
177
  idempotencyKey: z.string().trim().min(1).max(200)
155
178
  });
179
+ var GoogleDrivePublicationExportFile = z.object({
180
+ fileId: z.string().uuid(),
181
+ filename: z.string().trim().min(1).max(512),
182
+ contentType: z.string().trim().min(1).max(256),
183
+ sizeBytes: z.number().int().positive(),
184
+ sha256: z.string().regex(/^[0-9a-f]{64}$/u),
185
+ artifactId: z.string().regex(/^[0-9a-f]{32}$/u),
186
+ versionId: z.string().regex(/^[0-9a-f]{32}$/u),
187
+ materializationJobId: z.string().regex(/^[0-9a-f]{32}$/u),
188
+ sourceHeadSequence: z.number().int().nonnegative(),
189
+ sourceStateHash: z.string().regex(/^sha256:[0-9a-f]{64}$/u)
190
+ }).strict();
191
+ var GoogleDrivePublicationToolInput = z.object({
192
+ title: z.string().trim().min(1).max(512),
193
+ modality: z.enum(["document", "spreadsheet", "presentation"]),
194
+ file: GoogleDrivePublicationExportFile,
195
+ idempotencyKey: z.string().trim().min(1).max(200)
196
+ }).strict();
197
+ var GoogleDrivePublicationReceipt = z.object({
198
+ connectionId: z.string().uuid(),
199
+ providerFileId: z.string().min(1).max(256),
200
+ webViewLink: z.string().url(),
201
+ mimeType: z.enum([
202
+ "application/vnd.google-apps.document",
203
+ "application/vnd.google-apps.spreadsheet",
204
+ "application/vnd.google-apps.presentation"
205
+ ]),
206
+ destination: GoogleDriveOutputDestination,
207
+ replayed: z.boolean()
208
+ }).strict();
156
209
  var GoogleDriveBrowseItem = z.object({
157
210
  id: z.string().min(1).max(256),
158
211
  name: z.string().min(1).max(1024),
@@ -231,6 +284,9 @@ export {
231
284
  GOOGLE_DRIVE_LEGACY_CREDENTIAL_LABEL,
232
285
  GOOGLE_DRIVE_METADATA_READONLY_SCOPE,
233
286
  GOOGLE_DRIVE_PROVIDER_DOMAIN,
287
+ GOOGLE_DRIVE_PUBLICATION_CREATE_ACTION,
288
+ GOOGLE_DRIVE_PUBLICATION_SERVER_ID,
289
+ GOOGLE_DRIVE_PUBLICATION_TOOL_NAME,
234
290
  GOOGLE_DRIVE_READONLY_SCOPE,
235
291
  GoogleDriveBrowseItem,
236
292
  GoogleDriveBrowseResponse,
@@ -245,6 +301,10 @@ export {
245
301
  GoogleDriveOAuthCapability,
246
302
  GoogleDriveOAuthStartRequest,
247
303
  GoogleDriveOAuthStartResponse,
304
+ GoogleDriveOutputDestination,
305
+ GoogleDrivePublicationExportFile,
306
+ GoogleDrivePublicationReceipt,
307
+ GoogleDrivePublicationToolInput,
248
308
  GoogleDriveReadPolicy,
249
309
  GoogleDriveSelectedSource,
250
310
  GoogleDriveSyncCadence,
@@ -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;\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,IAAI,2BAA2B;AACpF,QAAM,6BACJ,wBAAwB,QAAQ,IAAI,oCAAoC;AAC1E,QAAM,oBAAoB,wBAAwB,QAAQ,IAAI,uBAAuB;AACrF,QAAM,eAA6C,CAAC;AACpD,MAAI,kBAAmB,cAAa,KAAK,kBAAkB;AAC3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AAI,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":[]}
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;\nexport const GOOGLE_DRIVE_PUBLICATION_SERVER_ID = \"google-drive-publishing\" as const;\nexport const GOOGLE_DRIVE_PUBLICATION_TOOL_NAME = \"google_drive_publish_file\" as const;\nexport const GOOGLE_DRIVE_PUBLICATION_CREATE_ACTION = \"create\" as const;\n\nexport const GoogleDriveOAuthCapability = z.enum([\n \"picker_file_read\",\n \"publish_file\",\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: \"file_only\" | \"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 hasFileWrite = hasFullDrive || granted.has(GOOGLE_DRIVE_FILE_SCOPE);\n const hasSourceMetadataDiscovery =\n hasSourceContentRead || granted.has(GOOGLE_DRIVE_METADATA_READONLY_SCOPE);\n const hasPickerFileRead = hasSourceContentRead || hasFileWrite;\n const capabilities: GoogleDriveOAuthCapability[] = [];\n if (hasPickerFileRead) capabilities.push(\"picker_file_read\");\n if (hasFileWrite) capabilities.push(\"publish_file\");\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 : hasFileWrite\n ? \"file_only\"\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 GoogleDriveOutputDestination = z\n .object({\n folderId: z.string().min(1).max(256),\n folderName: z.string().min(1).max(1024),\n driveId: z.string().min(1).max(256).nullable(),\n location: z.enum([\"my_drive\", \"shared_drive\"]),\n selectedAt: z.string().datetime({ offset: true }),\n })\n .strict()\n .superRefine((value, context) => {\n if ((value.location === \"my_drive\") !== (value.driveId === null)) {\n context.addIssue({\n code: \"custom\",\n path: [\"driveId\"],\n message: \"Google Drive destination location does not match its drive identity\",\n });\n }\n });\nexport type GoogleDriveOutputDestination = z.infer<typeof GoogleDriveOutputDestination>;\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([\"file_only\", \"metadata_readonly\", \"readonly\"]),\n lifecycle: GoogleDriveConnectionLifecycle.optional(),\n outputDestination: GoogleDriveOutputDestination.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 capability: z.enum([\"source_read\", \"publish\"]).default(\"source_read\"),\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 GoogleDrivePublicationExportFile = z\n .object({\n fileId: z.string().uuid(),\n filename: z.string().trim().min(1).max(512),\n contentType: z.string().trim().min(1).max(256),\n sizeBytes: z.number().int().positive(),\n sha256: z.string().regex(/^[0-9a-f]{64}$/u),\n artifactId: z.string().regex(/^[0-9a-f]{32}$/u),\n versionId: z.string().regex(/^[0-9a-f]{32}$/u),\n materializationJobId: z.string().regex(/^[0-9a-f]{32}$/u),\n sourceHeadSequence: z.number().int().nonnegative(),\n sourceStateHash: z.string().regex(/^sha256:[0-9a-f]{64}$/u),\n })\n .strict();\nexport type GoogleDrivePublicationExportFile = z.infer<typeof GoogleDrivePublicationExportFile>;\n\nexport const GoogleDrivePublicationToolInput = z\n .object({\n title: z.string().trim().min(1).max(512),\n modality: z.enum([\"document\", \"spreadsheet\", \"presentation\"]),\n file: GoogleDrivePublicationExportFile,\n idempotencyKey: z.string().trim().min(1).max(200),\n })\n .strict();\nexport type GoogleDrivePublicationToolInput = z.infer<typeof GoogleDrivePublicationToolInput>;\n\nexport const GoogleDrivePublicationReceipt = z\n .object({\n connectionId: z.string().uuid(),\n providerFileId: z.string().min(1).max(256),\n webViewLink: z.string().url(),\n mimeType: z.enum([\n \"application/vnd.google-apps.document\",\n \"application/vnd.google-apps.spreadsheet\",\n \"application/vnd.google-apps.presentation\",\n ]),\n destination: GoogleDriveOutputDestination,\n replayed: z.boolean(),\n })\n .strict();\nexport type GoogleDrivePublicationReceipt = z.infer<typeof GoogleDrivePublicationReceipt>;\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;AAC7C,IAAM,qCAAqC;AAC3C,IAAM,qCAAqC;AAC3C,IAAM,yCAAyC;AAE/C,IAAM,6BAA6B,EAAE,KAAK;AAAA,EAC/C;AAAA,EACA;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,eAAe,gBAAgB,QAAQ,IAAI,uBAAuB;AACxE,QAAM,6BACJ,wBAAwB,QAAQ,IAAI,oCAAoC;AAC1E,QAAM,oBAAoB,wBAAwB;AAClD,QAAM,eAA6C,CAAC;AACpD,MAAI,kBAAmB,cAAa,KAAK,kBAAkB;AAC3D,MAAI,aAAc,cAAa,KAAK,cAAc;AAClD,MAAI,2BAA4B,cAAa,KAAK,2BAA2B;AAC7E,MAAI,sBAAsB;AACxB,iBAAa,KAAK,uBAAuB,uBAAuB;AAAA,EAClE;AACA,SAAO;AAAA,IACL,YAAY,uBACR,aACA,6BACE,sBACA,eACE,cACA;AAAA,IACR;AAAA,EACF;AACF;AAEO,SAAS,iCACd,eACA,YACS;AACT,SAAO,8BAA8B,aAAa,EAAE,aAAa,SAAS,UA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AE,OAAO;AAAA,EAC5D,eAAe,EAAE,KAAK,CAAC,gBAAgB,aAAa,UAAU,CAAC;AAAA,EAC/D,oBAAoB,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG;AAAA,EAC7C,sBAAsB,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,GAAG,EAAE,SAAS;AAAA,EAC1D,oBAAoB,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,IAAI,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":[]}
package/dist/index.d.ts CHANGED
@@ -3877,6 +3877,18 @@ export declare const DocumentSearchResult: z.ZodObject<{
3877
3877
  }>;
3878
3878
  authorityWorkspaceId: z.ZodNullable<z.ZodString>;
3879
3879
  authoritySubjectId: z.ZodNullable<z.ZodString>;
3880
+ citation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
3881
+ provider: z.ZodLiteral<"google_drive">;
3882
+ externalObjectId: z.ZodString;
3883
+ providerRevision: z.ZodNullable<z.ZodString>;
3884
+ sourceVersion: z.ZodString;
3885
+ driveId: z.ZodNullable<z.ZodString>;
3886
+ deepLink: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodString>>;
3887
+ aclRevision: z.ZodString;
3888
+ authorizationObservedAt: z.ZodString;
3889
+ authorizationExpiresAt: z.ZodString;
3890
+ reauthorizedAt: z.ZodString;
3891
+ }, z.core.$strip>>>;
3880
3892
  }, z.core.$strip>;
3881
3893
  export type DocumentSearchResult = z.infer<typeof DocumentSearchResult>;
3882
3894
  export declare const DocumentSearchResponse: z.ZodObject<{
@@ -3923,6 +3935,18 @@ export declare const DocumentSearchResponse: z.ZodObject<{
3923
3935
  }>;
3924
3936
  authorityWorkspaceId: z.ZodNullable<z.ZodString>;
3925
3937
  authoritySubjectId: z.ZodNullable<z.ZodString>;
3938
+ citation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
3939
+ provider: z.ZodLiteral<"google_drive">;
3940
+ externalObjectId: z.ZodString;
3941
+ providerRevision: z.ZodNullable<z.ZodString>;
3942
+ sourceVersion: z.ZodString;
3943
+ driveId: z.ZodNullable<z.ZodString>;
3944
+ deepLink: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodString>>;
3945
+ aclRevision: z.ZodString;
3946
+ authorizationObservedAt: z.ZodString;
3947
+ authorizationExpiresAt: z.ZodString;
3948
+ reauthorizedAt: z.ZodString;
3949
+ }, z.core.$strip>>>;
3926
3950
  }, z.core.$strip>>;
3927
3951
  }, z.core.$strip>;
3928
3952
  export type DocumentSearchResponse = z.infer<typeof DocumentSearchResponse>;
@@ -3959,6 +3983,18 @@ export declare const IndexedDocumentProvenance: z.ZodObject<{
3959
3983
  authoritySubjectId: z.ZodNullable<z.ZodString>;
3960
3984
  createdBy: z.ZodNullable<z.ZodString>;
3961
3985
  createdAt: z.ZodString;
3986
+ citation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
3987
+ provider: z.ZodLiteral<"google_drive">;
3988
+ externalObjectId: z.ZodString;
3989
+ providerRevision: z.ZodNullable<z.ZodString>;
3990
+ sourceVersion: z.ZodString;
3991
+ driveId: z.ZodNullable<z.ZodString>;
3992
+ deepLink: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodString>>;
3993
+ aclRevision: z.ZodString;
3994
+ authorizationObservedAt: z.ZodString;
3995
+ authorizationExpiresAt: z.ZodString;
3996
+ reauthorizedAt: z.ZodString;
3997
+ }, z.core.$strip>>>;
3962
3998
  }, z.core.$strip>;
3963
3999
  export type IndexedDocumentProvenance = z.infer<typeof IndexedDocumentProvenance>;
3964
4000
  export declare const IndexedDocumentSummary: z.ZodObject<{
@@ -4001,6 +4037,18 @@ export declare const IndexedDocumentSummary: z.ZodObject<{
4001
4037
  authoritySubjectId: z.ZodNullable<z.ZodString>;
4002
4038
  createdBy: z.ZodNullable<z.ZodString>;
4003
4039
  createdAt: z.ZodString;
4040
+ citation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
4041
+ provider: z.ZodLiteral<"google_drive">;
4042
+ externalObjectId: z.ZodString;
4043
+ providerRevision: z.ZodNullable<z.ZodString>;
4044
+ sourceVersion: z.ZodString;
4045
+ driveId: z.ZodNullable<z.ZodString>;
4046
+ deepLink: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodString>>;
4047
+ aclRevision: z.ZodString;
4048
+ authorizationObservedAt: z.ZodString;
4049
+ authorizationExpiresAt: z.ZodString;
4050
+ reauthorizedAt: z.ZodString;
4051
+ }, z.core.$strip>>>;
4004
4052
  }, z.core.$strip>;
4005
4053
  }, z.core.$strip>;
4006
4054
  export type IndexedDocumentSummary = z.infer<typeof IndexedDocumentSummary>;
@@ -4050,6 +4098,18 @@ export declare const ListIndexedDocumentsResponse: z.ZodObject<{
4050
4098
  authoritySubjectId: z.ZodNullable<z.ZodString>;
4051
4099
  createdBy: z.ZodNullable<z.ZodString>;
4052
4100
  createdAt: z.ZodString;
4101
+ citation: z.ZodOptional<z.ZodNullable<z.ZodObject<{
4102
+ provider: z.ZodLiteral<"google_drive">;
4103
+ externalObjectId: z.ZodString;
4104
+ providerRevision: z.ZodNullable<z.ZodString>;
4105
+ sourceVersion: z.ZodString;
4106
+ driveId: z.ZodNullable<z.ZodString>;
4107
+ deepLink: z.ZodNullable<z.ZodPipe<z.ZodString, z.ZodString>>;
4108
+ aclRevision: z.ZodString;
4109
+ authorizationObservedAt: z.ZodString;
4110
+ authorizationExpiresAt: z.ZodString;
4111
+ reauthorizedAt: z.ZodString;
4112
+ }, z.core.$strip>>>;
4053
4113
  }, z.core.$strip>;
4054
4114
  }, z.core.$strip>>;
4055
4115
  nextCheckpoint: z.ZodString;
@@ -5313,6 +5373,7 @@ export declare const SessionRealtimeInboundEntry: z.ZodObject<{
5313
5373
  delegationItemId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5314
5374
  text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5315
5375
  payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5376
+ modelContext: z.ZodOptional<z.ZodString>;
5316
5377
  }, z.core.$strict>;
5317
5378
  export type SessionRealtimeInboundEntry = z.infer<typeof SessionRealtimeInboundEntry>;
5318
5379
  export declare const SyncSessionRealtimeLedgerRequest: z.ZodObject<{
@@ -5338,6 +5399,7 @@ export declare const SyncSessionRealtimeLedgerRequest: z.ZodObject<{
5338
5399
  delegationItemId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5339
5400
  text: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5340
5401
  payload: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
5402
+ modelContext: z.ZodOptional<z.ZodString>;
5341
5403
  }, z.core.$strict>>>;
5342
5404
  clientAckThroughSequence: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
5343
5405
  providerAckSequences: z.ZodOptional<z.ZodArray<z.ZodNumber>>;
@@ -5923,6 +5985,17 @@ export declare const TimelineAnnotations: z.ZodArray<z.ZodObject<{
5923
5985
  export type TimelineAnnotations = z.infer<typeof TimelineAnnotations>;
5924
5986
  export declare function numberTimelineAnnotations(annotations: readonly SubmittedTimelineAnnotation[]): TimelineAnnotation[];
5925
5987
  export declare function renderTimelineAnnotationsForModel(text: string, annotations: readonly TimelineAnnotation[]): string;
5988
+ export declare const MODEL_CONTEXT_LABEL: "[Application context attached to this user message]";
5989
+ /**
5990
+ * Build one canonical user-role message body. `modelContext` is ordinary
5991
+ * message content: it is model-visible in the same chronological position as
5992
+ * the visible text, but presentation layers may omit it. It is not a secret or
5993
+ * an instruction-authority boundary.
5994
+ */
5995
+ export declare function renderUserMessageContentForModel(text: string, annotations: readonly TimelineAnnotation[], modelContext?: string | null): string | Array<{
5996
+ type: "input_text";
5997
+ text: string;
5998
+ }>;
5926
5999
  export declare const SessionTurn: z.ZodObject<{
5927
6000
  id: z.ZodString;
5928
6001
  workspaceId: z.ZodString;
@@ -17782,7 +17855,7 @@ export declare const CreateSessionRequest: z.ZodPreprocess<z.ZodObject<{
17782
17855
  requestedSessionId: z.ZodOptional<z.ZodString>;
17783
17856
  initialMessage: z.ZodOptional<z.ZodString>;
17784
17857
  startMode: z.ZodOptional<z.ZodLiteral<"realtime">>;
17785
- turnInstructions: z.ZodOptional<z.ZodString>;
17858
+ modelContext: z.ZodOptional<z.ZodString>;
17786
17859
  instructions: z.ZodOptional<z.ZodString>;
17787
17860
  policyRole: z.ZodOptional<z.ZodPipe<z.ZodPipe<z.ZodString, z.ZodTransform<string, string>>, z.ZodString>>;
17788
17861
  resources: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
@@ -18293,7 +18366,7 @@ export declare const SessionUserMessagePayload: z.ZodObject<{
18293
18366
  quote: z.ZodString;
18294
18367
  note: z.ZodString;
18295
18368
  }, z.core.$strict>>>;
18296
- turnInstructions: z.ZodOptional<z.ZodString>;
18369
+ modelContext: z.ZodOptional<z.ZodString>;
18297
18370
  resources: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
18298
18371
  kind: z.ZodLiteral<"repository">;
18299
18372
  uri: z.ZodString;
@@ -18374,7 +18447,7 @@ export declare const ClientSessionEvent: z.ZodDiscriminatedUnion<[z.ZodObject<{
18374
18447
  quote: z.ZodString;
18375
18448
  note: z.ZodString;
18376
18449
  }, z.core.$strict>>>;
18377
- turnInstructions: z.ZodOptional<z.ZodString>;
18450
+ modelContext: z.ZodOptional<z.ZodString>;
18378
18451
  resources: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
18379
18452
  kind: z.ZodLiteral<"repository">;
18380
18453
  uri: z.ZodString;
@@ -18480,7 +18553,7 @@ export declare const SteerSessionMessageRequest: z.ZodObject<{
18480
18553
  quote: z.ZodString;
18481
18554
  note: z.ZodString;
18482
18555
  }, z.core.$strict>>>;
18483
- turnInstructions: z.ZodOptional<z.ZodString>;
18556
+ modelContext: z.ZodOptional<z.ZodString>;
18484
18557
  resources: z.ZodDefault<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
18485
18558
  kind: z.ZodLiteral<"repository">;
18486
18559
  uri: z.ZodString;
@@ -20907,13 +20980,13 @@ export type WorkspaceModelCatalogResponse = z.infer<typeof WorkspaceModelCatalog
20907
20980
  * that rollout boundary. Mutating clients send this value in
20908
20981
  * `x-opengeni-api-contract`; the API rejects any other value before routing.
20909
20982
  */
20910
- export declare const OPENGENI_API_CONTRACT_REVISION: "2026-08-social-provider-tools-v1";
20983
+ export declare const OPENGENI_API_CONTRACT_REVISION: "2026-08-model-context-v1";
20911
20984
  export declare const OPENGENI_API_CONTRACT_HEADER: "x-opengeni-api-contract";
20912
20985
  /** Bounded request/response identifier shared by browser, ingress, and API diagnostics. */
20913
20986
  export declare const OPENGENI_CORRELATION_HEADER: "x-opengeni-correlation-id";
20914
20987
  export declare const ClientConfig: z.ZodObject<{
20915
20988
  deploymentRevision: z.ZodString;
20916
- apiContractRevision: z.ZodLiteral<"2026-08-social-provider-tools-v1">;
20989
+ apiContractRevision: z.ZodLiteral<"2026-08-model-context-v1">;
20917
20990
  serverVersion: z.ZodOptional<z.ZodString>;
20918
20991
  defaultModel: z.ZodString;
20919
20992
  allowedModels: z.ZodArray<z.ZodString>;
package/dist/index.js CHANGED
@@ -554,6 +554,7 @@ import {
554
554
  KnowledgeMemoryKind,
555
555
  KnowledgeMemorySearchRequest,
556
556
  KnowledgeMemoryStatus,
557
+ KnowledgeProviderCitation,
557
558
  KnowledgeRecord,
558
559
  KnowledgeRecordId,
559
560
  KnowledgeRecordKind,
@@ -590,6 +591,7 @@ import {
590
591
  MCP_MUTATION_RECEIPT_MAX_BYTES,
591
592
  MCP_MUTATION_RECEIPT_VERSION,
592
593
  MODEL_ATTACHMENT_REFS_FIELD,
594
+ MODEL_CONTEXT_LABEL,
593
595
  MODEL_TIMELINE_ANNOTATIONS_FIELD,
594
596
  MachineKind,
595
597
  MachineMetricsSeriesResponse,
@@ -1276,6 +1278,7 @@ import {
1276
1278
  reasoningEffortForMetadata,
1277
1279
  renderSessionSystemUpdateBatch,
1278
1280
  renderTimelineAnnotationsForModel,
1281
+ renderUserMessageContentForModel,
1279
1282
  replayCodexFleetDecisionV1,
1280
1283
  resolveSessionEventTypeFilters,
1281
1284
  resolveWorkspaceAgentHumanInputEnabled,
@@ -1314,7 +1317,7 @@ import {
1314
1317
  workspaceLearningPolicyRouterContext,
1315
1318
  workspaceLearningSourceKey,
1316
1319
  workspaceSlackReactionChannelAllowed
1317
- } from "./chunk-Q6A7XT2N.js";
1320
+ } from "./chunk-NX5JNF4L.js";
1318
1321
  import {
1319
1322
  ConnectorDocumentDestination,
1320
1323
  ConnectorDocumentDestinationAuthority,
@@ -2158,6 +2161,7 @@ export {
2158
2161
  KnowledgeMemoryKind,
2159
2162
  KnowledgeMemorySearchRequest,
2160
2163
  KnowledgeMemoryStatus,
2164
+ KnowledgeProviderCitation,
2161
2165
  KnowledgeRecord,
2162
2166
  KnowledgeRecordId,
2163
2167
  KnowledgeRecordKind,
@@ -2199,6 +2203,7 @@ export {
2199
2203
  MCP_MUTATION_RECEIPT_MAX_BYTES,
2200
2204
  MCP_MUTATION_RECEIPT_VERSION,
2201
2205
  MODEL_ATTACHMENT_REFS_FIELD,
2206
+ MODEL_CONTEXT_LABEL,
2202
2207
  MODEL_TIMELINE_ANNOTATIONS_FIELD,
2203
2208
  MachineKind,
2204
2209
  MachineMetricsSeriesResponse,
@@ -3017,6 +3022,7 @@ export {
3017
3022
  reasoningEffortForMetadata,
3018
3023
  renderSessionSystemUpdateBatch,
3019
3024
  renderTimelineAnnotationsForModel,
3025
+ renderUserMessageContentForModel,
3020
3026
  replayCodexFleetDecisionV1,
3021
3027
  resolveConnectorDocumentDestination,
3022
3028
  resolveRetainedOutputRange,