@opengeni/contracts 0.22.0 → 0.26.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.
@@ -0,0 +1,526 @@
1
+ import { z } from "zod";
2
+ export declare const WORKSPACE_STATE_MAX_ACTIVE_POLICY_HEADS = 32;
3
+ export declare const WORKSPACE_STATE_MAX_BASES = 24;
4
+ export declare const WORKSPACE_STATE_MAX_TOPICS = 24;
5
+ export declare const WORKSPACE_STATE_MAX_GAPS = 16;
6
+ export declare const WORKSPACE_STATE_BASE_NAME_MAX_CHARS = 160;
7
+ export declare const WORKSPACE_STATE_TOPIC_MAX_CHARS = 96;
8
+ export declare const WORKSPACE_STATE_MEMORY_SAMPLE_LIMIT = 100;
9
+ export declare const WorkspaceStateDocumentStatusCounts: z.ZodObject<{
10
+ queued: z.ZodNumber;
11
+ indexing: z.ZodNumber;
12
+ ready: z.ZodNumber;
13
+ failed: z.ZodNumber;
14
+ }, z.core.$strict>;
15
+ export type WorkspaceStateDocumentStatusCounts = z.infer<typeof WorkspaceStateDocumentStatusCounts>;
16
+ export declare const WorkspaceStateSourceKindCounts: z.ZodObject<{
17
+ manual_upload: z.ZodNumber;
18
+ meeting_transcript: z.ZodNumber;
19
+ repository: z.ZodNumber;
20
+ email: z.ZodNumber;
21
+ chat: z.ZodNumber;
22
+ document: z.ZodNumber;
23
+ web: z.ZodNumber;
24
+ other: z.ZodNumber;
25
+ }, z.core.$strict>;
26
+ export type WorkspaceStateSourceKindCounts = z.infer<typeof WorkspaceStateSourceKindCounts>;
27
+ export declare const WorkspaceStateMemoryStatusCounts: z.ZodObject<{
28
+ proposed: z.ZodNumber;
29
+ approved: z.ZodNumber;
30
+ rejected: z.ZodNumber;
31
+ active: z.ZodNumber;
32
+ superseded: z.ZodNumber;
33
+ archived: z.ZodNumber;
34
+ }, z.core.$strict>;
35
+ export type WorkspaceStateMemoryStatusCounts = z.infer<typeof WorkspaceStateMemoryStatusCounts>;
36
+ export declare const WorkspaceStateMemoryKindCounts: z.ZodObject<{
37
+ semantic: z.ZodNumber;
38
+ episodic: z.ZodNumber;
39
+ procedural: z.ZodNumber;
40
+ decision: z.ZodNumber;
41
+ preference: z.ZodNumber;
42
+ }, z.core.$strict>;
43
+ export type WorkspaceStateMemoryKindCounts = z.infer<typeof WorkspaceStateMemoryKindCounts>;
44
+ export declare const WorkspaceStatePolicyHead: z.ZodObject<{
45
+ kind: z.ZodEnum<{
46
+ charter: "charter";
47
+ policy: "policy";
48
+ }>;
49
+ scope: z.ZodEnum<{
50
+ global: "global";
51
+ role: "role";
52
+ }>;
53
+ roleKey: z.ZodNullable<z.ZodString>;
54
+ revisionId: z.ZodString;
55
+ revision: z.ZodNumber;
56
+ contentHash: z.ZodString;
57
+ activationVersion: z.ZodNumber;
58
+ activatedAt: z.ZodString;
59
+ }, z.core.$strict>;
60
+ export declare const WorkspaceStatePolicyRevisionSummary: z.ZodObject<{
61
+ kind: z.ZodEnum<{
62
+ charter: "charter";
63
+ policy: "policy";
64
+ }>;
65
+ scope: z.ZodEnum<{
66
+ global: "global";
67
+ role: "role";
68
+ }>;
69
+ roleKey: z.ZodNullable<z.ZodString>;
70
+ revisionId: z.ZodString;
71
+ revision: z.ZodNumber;
72
+ contentHash: z.ZodString;
73
+ provenanceSource: z.ZodEnum<{
74
+ human: "human";
75
+ knowledge_proposal: "knowledge_proposal";
76
+ legacy_import: "legacy_import";
77
+ onboarding: "onboarding";
78
+ }>;
79
+ state: z.ZodEnum<{
80
+ active: "active";
81
+ inactive: "inactive";
82
+ }>;
83
+ createdAt: z.ZodString;
84
+ }, z.core.$strict>;
85
+ export declare const WorkspaceStatePolicy: z.ZodObject<{
86
+ authority: z.ZodLiteral<"workspace_instruction_policy_heads">;
87
+ activeHeads: z.ZodArray<z.ZodObject<{
88
+ kind: z.ZodEnum<{
89
+ charter: "charter";
90
+ policy: "policy";
91
+ }>;
92
+ scope: z.ZodEnum<{
93
+ global: "global";
94
+ role: "role";
95
+ }>;
96
+ roleKey: z.ZodNullable<z.ZodString>;
97
+ revisionId: z.ZodString;
98
+ revision: z.ZodNumber;
99
+ contentHash: z.ZodString;
100
+ activationVersion: z.ZodNumber;
101
+ activatedAt: z.ZodString;
102
+ }, z.core.$strict>>;
103
+ activeHeadsTruncated: z.ZodBoolean;
104
+ latestRevision: z.ZodNullable<z.ZodObject<{
105
+ kind: z.ZodEnum<{
106
+ charter: "charter";
107
+ policy: "policy";
108
+ }>;
109
+ scope: z.ZodEnum<{
110
+ global: "global";
111
+ role: "role";
112
+ }>;
113
+ roleKey: z.ZodNullable<z.ZodString>;
114
+ revisionId: z.ZodString;
115
+ revision: z.ZodNumber;
116
+ contentHash: z.ZodString;
117
+ provenanceSource: z.ZodEnum<{
118
+ human: "human";
119
+ knowledge_proposal: "knowledge_proposal";
120
+ legacy_import: "legacy_import";
121
+ onboarding: "onboarding";
122
+ }>;
123
+ state: z.ZodEnum<{
124
+ active: "active";
125
+ inactive: "inactive";
126
+ }>;
127
+ createdAt: z.ZodString;
128
+ }, z.core.$strict>>;
129
+ legacyRuntime: z.ZodObject<{
130
+ source: z.ZodEnum<{
131
+ deployment_default: "deployment_default";
132
+ workspace_override: "workspace_override";
133
+ }>;
134
+ workspaceOverrideConfigured: z.ZodBoolean;
135
+ }, z.core.$strict>;
136
+ runtimeComposition: z.ZodObject<{
137
+ status: z.ZodLiteral<"not_implemented">;
138
+ }, z.core.$strict>;
139
+ }, z.core.$strict>;
140
+ export declare const WorkspaceStateKnowledgeBase: z.ZodObject<{
141
+ id: z.ZodString;
142
+ name: z.ZodString;
143
+ visibleDocumentCount: z.ZodNumber;
144
+ statusCounts: z.ZodObject<{
145
+ queued: z.ZodNumber;
146
+ indexing: z.ZodNumber;
147
+ ready: z.ZodNumber;
148
+ failed: z.ZodNumber;
149
+ }, z.core.$strict>;
150
+ latestUpdatedAt: z.ZodNullable<z.ZodString>;
151
+ }, z.core.$strict>;
152
+ export declare const WorkspaceStateTopic: z.ZodObject<{
153
+ name: z.ZodString;
154
+ documentCount: z.ZodNumber;
155
+ }, z.core.$strict>;
156
+ export declare const WorkspaceStateGapCode: z.ZodEnum<{
157
+ failed_documents: "failed_documents";
158
+ missing_topic_coverage: "missing_topic_coverage";
159
+ no_document_bases: "no_document_bases";
160
+ no_memory_records: "no_memory_records";
161
+ no_visible_documents: "no_visible_documents";
162
+ partial_inventory: "partial_inventory";
163
+ pending_memory_review: "pending_memory_review";
164
+ processing_documents: "processing_documents";
165
+ }>;
166
+ export type WorkspaceStateGapCode = z.infer<typeof WorkspaceStateGapCode>;
167
+ export declare const WorkspaceStateGap: z.ZodObject<{
168
+ code: z.ZodEnum<{
169
+ failed_documents: "failed_documents";
170
+ missing_topic_coverage: "missing_topic_coverage";
171
+ no_document_bases: "no_document_bases";
172
+ no_memory_records: "no_memory_records";
173
+ no_visible_documents: "no_visible_documents";
174
+ partial_inventory: "partial_inventory";
175
+ pending_memory_review: "pending_memory_review";
176
+ processing_documents: "processing_documents";
177
+ }>;
178
+ severity: z.ZodEnum<{
179
+ info: "info";
180
+ warning: "warning";
181
+ }>;
182
+ relatedCount: z.ZodNullable<z.ZodNumber>;
183
+ }, z.core.$strict>;
184
+ export type WorkspaceStateGap = z.infer<typeof WorkspaceStateGap>;
185
+ export declare const WorkspaceStateKnowledgeAvailable: z.ZodObject<{
186
+ availability: z.ZodLiteral<"available">;
187
+ coverage: z.ZodEnum<{
188
+ complete: "complete";
189
+ partial: "partial";
190
+ }>;
191
+ baseCount: z.ZodNumber;
192
+ bases: z.ZodArray<z.ZodObject<{
193
+ id: z.ZodString;
194
+ name: z.ZodString;
195
+ visibleDocumentCount: z.ZodNumber;
196
+ statusCounts: z.ZodObject<{
197
+ queued: z.ZodNumber;
198
+ indexing: z.ZodNumber;
199
+ ready: z.ZodNumber;
200
+ failed: z.ZodNumber;
201
+ }, z.core.$strict>;
202
+ latestUpdatedAt: z.ZodNullable<z.ZodString>;
203
+ }, z.core.$strict>>;
204
+ basesTruncated: z.ZodBoolean;
205
+ inspectedVisibleDocumentCount: z.ZodNumber;
206
+ documentStatusCounts: z.ZodObject<{
207
+ queued: z.ZodNumber;
208
+ indexing: z.ZodNumber;
209
+ ready: z.ZodNumber;
210
+ failed: z.ZodNumber;
211
+ }, z.core.$strict>;
212
+ sourceKindCounts: z.ZodObject<{
213
+ manual_upload: z.ZodNumber;
214
+ meeting_transcript: z.ZodNumber;
215
+ repository: z.ZodNumber;
216
+ email: z.ZodNumber;
217
+ chat: z.ZodNumber;
218
+ document: z.ZodNumber;
219
+ web: z.ZodNumber;
220
+ other: z.ZodNumber;
221
+ }, z.core.$strict>;
222
+ topics: z.ZodArray<z.ZodObject<{
223
+ name: z.ZodString;
224
+ documentCount: z.ZodNumber;
225
+ }, z.core.$strict>>;
226
+ topicsTruncated: z.ZodBoolean;
227
+ latestDocumentUpdatedAt: z.ZodNullable<z.ZodString>;
228
+ memorySample: z.ZodObject<{
229
+ recordCount: z.ZodNumber;
230
+ sampleLimit: z.ZodLiteral<100>;
231
+ limitReached: z.ZodBoolean;
232
+ statusCounts: z.ZodObject<{
233
+ proposed: z.ZodNumber;
234
+ approved: z.ZodNumber;
235
+ rejected: z.ZodNumber;
236
+ active: z.ZodNumber;
237
+ superseded: z.ZodNumber;
238
+ archived: z.ZodNumber;
239
+ }, z.core.$strict>;
240
+ kindCounts: z.ZodObject<{
241
+ semantic: z.ZodNumber;
242
+ episodic: z.ZodNumber;
243
+ procedural: z.ZodNumber;
244
+ decision: z.ZodNumber;
245
+ preference: z.ZodNumber;
246
+ }, z.core.$strict>;
247
+ preferenceAuthority: z.ZodObject<{
248
+ kindCountSource: z.ZodLiteral<"knowledge_memories_legacy_observations">;
249
+ activeAuthority: z.ZodLiteral<"structured_preference_registry">;
250
+ }, z.core.$strict>;
251
+ latestUpdatedAt: z.ZodNullable<z.ZodString>;
252
+ }, z.core.$strict>;
253
+ gaps: z.ZodArray<z.ZodObject<{
254
+ code: z.ZodEnum<{
255
+ failed_documents: "failed_documents";
256
+ missing_topic_coverage: "missing_topic_coverage";
257
+ no_document_bases: "no_document_bases";
258
+ no_memory_records: "no_memory_records";
259
+ no_visible_documents: "no_visible_documents";
260
+ partial_inventory: "partial_inventory";
261
+ pending_memory_review: "pending_memory_review";
262
+ processing_documents: "processing_documents";
263
+ }>;
264
+ severity: z.ZodEnum<{
265
+ info: "info";
266
+ warning: "warning";
267
+ }>;
268
+ relatedCount: z.ZodNullable<z.ZodNumber>;
269
+ }, z.core.$strict>>;
270
+ }, z.core.$strict>;
271
+ export declare const WorkspaceStateKnowledgeUnavailable: z.ZodObject<{
272
+ availability: z.ZodLiteral<"unavailable">;
273
+ reason: z.ZodLiteral<"missing_permission">;
274
+ requiredPermission: z.ZodLiteral<"documents:search">;
275
+ }, z.core.$strict>;
276
+ export declare const WorkspaceStateKnowledge: z.ZodDiscriminatedUnion<[z.ZodObject<{
277
+ availability: z.ZodLiteral<"available">;
278
+ coverage: z.ZodEnum<{
279
+ complete: "complete";
280
+ partial: "partial";
281
+ }>;
282
+ baseCount: z.ZodNumber;
283
+ bases: z.ZodArray<z.ZodObject<{
284
+ id: z.ZodString;
285
+ name: z.ZodString;
286
+ visibleDocumentCount: z.ZodNumber;
287
+ statusCounts: z.ZodObject<{
288
+ queued: z.ZodNumber;
289
+ indexing: z.ZodNumber;
290
+ ready: z.ZodNumber;
291
+ failed: z.ZodNumber;
292
+ }, z.core.$strict>;
293
+ latestUpdatedAt: z.ZodNullable<z.ZodString>;
294
+ }, z.core.$strict>>;
295
+ basesTruncated: z.ZodBoolean;
296
+ inspectedVisibleDocumentCount: z.ZodNumber;
297
+ documentStatusCounts: z.ZodObject<{
298
+ queued: z.ZodNumber;
299
+ indexing: z.ZodNumber;
300
+ ready: z.ZodNumber;
301
+ failed: z.ZodNumber;
302
+ }, z.core.$strict>;
303
+ sourceKindCounts: z.ZodObject<{
304
+ manual_upload: z.ZodNumber;
305
+ meeting_transcript: z.ZodNumber;
306
+ repository: z.ZodNumber;
307
+ email: z.ZodNumber;
308
+ chat: z.ZodNumber;
309
+ document: z.ZodNumber;
310
+ web: z.ZodNumber;
311
+ other: z.ZodNumber;
312
+ }, z.core.$strict>;
313
+ topics: z.ZodArray<z.ZodObject<{
314
+ name: z.ZodString;
315
+ documentCount: z.ZodNumber;
316
+ }, z.core.$strict>>;
317
+ topicsTruncated: z.ZodBoolean;
318
+ latestDocumentUpdatedAt: z.ZodNullable<z.ZodString>;
319
+ memorySample: z.ZodObject<{
320
+ recordCount: z.ZodNumber;
321
+ sampleLimit: z.ZodLiteral<100>;
322
+ limitReached: z.ZodBoolean;
323
+ statusCounts: z.ZodObject<{
324
+ proposed: z.ZodNumber;
325
+ approved: z.ZodNumber;
326
+ rejected: z.ZodNumber;
327
+ active: z.ZodNumber;
328
+ superseded: z.ZodNumber;
329
+ archived: z.ZodNumber;
330
+ }, z.core.$strict>;
331
+ kindCounts: z.ZodObject<{
332
+ semantic: z.ZodNumber;
333
+ episodic: z.ZodNumber;
334
+ procedural: z.ZodNumber;
335
+ decision: z.ZodNumber;
336
+ preference: z.ZodNumber;
337
+ }, z.core.$strict>;
338
+ preferenceAuthority: z.ZodObject<{
339
+ kindCountSource: z.ZodLiteral<"knowledge_memories_legacy_observations">;
340
+ activeAuthority: z.ZodLiteral<"structured_preference_registry">;
341
+ }, z.core.$strict>;
342
+ latestUpdatedAt: z.ZodNullable<z.ZodString>;
343
+ }, z.core.$strict>;
344
+ gaps: z.ZodArray<z.ZodObject<{
345
+ code: z.ZodEnum<{
346
+ failed_documents: "failed_documents";
347
+ missing_topic_coverage: "missing_topic_coverage";
348
+ no_document_bases: "no_document_bases";
349
+ no_memory_records: "no_memory_records";
350
+ no_visible_documents: "no_visible_documents";
351
+ partial_inventory: "partial_inventory";
352
+ pending_memory_review: "pending_memory_review";
353
+ processing_documents: "processing_documents";
354
+ }>;
355
+ severity: z.ZodEnum<{
356
+ info: "info";
357
+ warning: "warning";
358
+ }>;
359
+ relatedCount: z.ZodNullable<z.ZodNumber>;
360
+ }, z.core.$strict>>;
361
+ }, z.core.$strict>, z.ZodObject<{
362
+ availability: z.ZodLiteral<"unavailable">;
363
+ reason: z.ZodLiteral<"missing_permission">;
364
+ requiredPermission: z.ZodLiteral<"documents:search">;
365
+ }, z.core.$strict>], "availability">;
366
+ export type WorkspaceStateKnowledge = z.infer<typeof WorkspaceStateKnowledge>;
367
+ export declare const WorkspaceStateResponse: z.ZodObject<{
368
+ workspaceId: z.ZodString;
369
+ generatedAt: z.ZodString;
370
+ truth: z.ZodObject<{
371
+ current: z.ZodObject<{
372
+ source: z.ZodLiteral<"read_time_projection">;
373
+ capturedAt: z.ZodString;
374
+ }, z.core.$strict>;
375
+ policySnapshot: z.ZodObject<{
376
+ status: z.ZodLiteral<"not_captured">;
377
+ reason: z.ZodLiteral<"workspace_instruction_policy_snapshot_not_implemented">;
378
+ }, z.core.$strict>;
379
+ }, z.core.$strict>;
380
+ policy: z.ZodObject<{
381
+ authority: z.ZodLiteral<"workspace_instruction_policy_heads">;
382
+ activeHeads: z.ZodArray<z.ZodObject<{
383
+ kind: z.ZodEnum<{
384
+ charter: "charter";
385
+ policy: "policy";
386
+ }>;
387
+ scope: z.ZodEnum<{
388
+ global: "global";
389
+ role: "role";
390
+ }>;
391
+ roleKey: z.ZodNullable<z.ZodString>;
392
+ revisionId: z.ZodString;
393
+ revision: z.ZodNumber;
394
+ contentHash: z.ZodString;
395
+ activationVersion: z.ZodNumber;
396
+ activatedAt: z.ZodString;
397
+ }, z.core.$strict>>;
398
+ activeHeadsTruncated: z.ZodBoolean;
399
+ latestRevision: z.ZodNullable<z.ZodObject<{
400
+ kind: z.ZodEnum<{
401
+ charter: "charter";
402
+ policy: "policy";
403
+ }>;
404
+ scope: z.ZodEnum<{
405
+ global: "global";
406
+ role: "role";
407
+ }>;
408
+ roleKey: z.ZodNullable<z.ZodString>;
409
+ revisionId: z.ZodString;
410
+ revision: z.ZodNumber;
411
+ contentHash: z.ZodString;
412
+ provenanceSource: z.ZodEnum<{
413
+ human: "human";
414
+ knowledge_proposal: "knowledge_proposal";
415
+ legacy_import: "legacy_import";
416
+ onboarding: "onboarding";
417
+ }>;
418
+ state: z.ZodEnum<{
419
+ active: "active";
420
+ inactive: "inactive";
421
+ }>;
422
+ createdAt: z.ZodString;
423
+ }, z.core.$strict>>;
424
+ legacyRuntime: z.ZodObject<{
425
+ source: z.ZodEnum<{
426
+ deployment_default: "deployment_default";
427
+ workspace_override: "workspace_override";
428
+ }>;
429
+ workspaceOverrideConfigured: z.ZodBoolean;
430
+ }, z.core.$strict>;
431
+ runtimeComposition: z.ZodObject<{
432
+ status: z.ZodLiteral<"not_implemented">;
433
+ }, z.core.$strict>;
434
+ }, z.core.$strict>;
435
+ knowledge: z.ZodDiscriminatedUnion<[z.ZodObject<{
436
+ availability: z.ZodLiteral<"available">;
437
+ coverage: z.ZodEnum<{
438
+ complete: "complete";
439
+ partial: "partial";
440
+ }>;
441
+ baseCount: z.ZodNumber;
442
+ bases: z.ZodArray<z.ZodObject<{
443
+ id: z.ZodString;
444
+ name: z.ZodString;
445
+ visibleDocumentCount: z.ZodNumber;
446
+ statusCounts: z.ZodObject<{
447
+ queued: z.ZodNumber;
448
+ indexing: z.ZodNumber;
449
+ ready: z.ZodNumber;
450
+ failed: z.ZodNumber;
451
+ }, z.core.$strict>;
452
+ latestUpdatedAt: z.ZodNullable<z.ZodString>;
453
+ }, z.core.$strict>>;
454
+ basesTruncated: z.ZodBoolean;
455
+ inspectedVisibleDocumentCount: z.ZodNumber;
456
+ documentStatusCounts: z.ZodObject<{
457
+ queued: z.ZodNumber;
458
+ indexing: z.ZodNumber;
459
+ ready: z.ZodNumber;
460
+ failed: z.ZodNumber;
461
+ }, z.core.$strict>;
462
+ sourceKindCounts: z.ZodObject<{
463
+ manual_upload: z.ZodNumber;
464
+ meeting_transcript: z.ZodNumber;
465
+ repository: z.ZodNumber;
466
+ email: z.ZodNumber;
467
+ chat: z.ZodNumber;
468
+ document: z.ZodNumber;
469
+ web: z.ZodNumber;
470
+ other: z.ZodNumber;
471
+ }, z.core.$strict>;
472
+ topics: z.ZodArray<z.ZodObject<{
473
+ name: z.ZodString;
474
+ documentCount: z.ZodNumber;
475
+ }, z.core.$strict>>;
476
+ topicsTruncated: z.ZodBoolean;
477
+ latestDocumentUpdatedAt: z.ZodNullable<z.ZodString>;
478
+ memorySample: z.ZodObject<{
479
+ recordCount: z.ZodNumber;
480
+ sampleLimit: z.ZodLiteral<100>;
481
+ limitReached: z.ZodBoolean;
482
+ statusCounts: z.ZodObject<{
483
+ proposed: z.ZodNumber;
484
+ approved: z.ZodNumber;
485
+ rejected: z.ZodNumber;
486
+ active: z.ZodNumber;
487
+ superseded: z.ZodNumber;
488
+ archived: z.ZodNumber;
489
+ }, z.core.$strict>;
490
+ kindCounts: z.ZodObject<{
491
+ semantic: z.ZodNumber;
492
+ episodic: z.ZodNumber;
493
+ procedural: z.ZodNumber;
494
+ decision: z.ZodNumber;
495
+ preference: z.ZodNumber;
496
+ }, z.core.$strict>;
497
+ preferenceAuthority: z.ZodObject<{
498
+ kindCountSource: z.ZodLiteral<"knowledge_memories_legacy_observations">;
499
+ activeAuthority: z.ZodLiteral<"structured_preference_registry">;
500
+ }, z.core.$strict>;
501
+ latestUpdatedAt: z.ZodNullable<z.ZodString>;
502
+ }, z.core.$strict>;
503
+ gaps: z.ZodArray<z.ZodObject<{
504
+ code: z.ZodEnum<{
505
+ failed_documents: "failed_documents";
506
+ missing_topic_coverage: "missing_topic_coverage";
507
+ no_document_bases: "no_document_bases";
508
+ no_memory_records: "no_memory_records";
509
+ no_visible_documents: "no_visible_documents";
510
+ partial_inventory: "partial_inventory";
511
+ pending_memory_review: "pending_memory_review";
512
+ processing_documents: "processing_documents";
513
+ }>;
514
+ severity: z.ZodEnum<{
515
+ info: "info";
516
+ warning: "warning";
517
+ }>;
518
+ relatedCount: z.ZodNullable<z.ZodNumber>;
519
+ }, z.core.$strict>>;
520
+ }, z.core.$strict>, z.ZodObject<{
521
+ availability: z.ZodLiteral<"unavailable">;
522
+ reason: z.ZodLiteral<"missing_permission">;
523
+ requiredPermission: z.ZodLiteral<"documents:search">;
524
+ }, z.core.$strict>], "availability">;
525
+ }, z.core.$strict>;
526
+ export type WorkspaceStateResponse = z.infer<typeof WorkspaceStateResponse>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opengeni/contracts",
3
- "version": "0.22.0",
3
+ "version": "0.26.1",
4
4
  "description": "Shared zod schemas and wire-contract types for the OpenGeni API.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -21,6 +21,14 @@
21
21
  ".": {
22
22
  "types": "./dist/index.d.ts",
23
23
  "import": "./dist/index.js"
24
+ },
25
+ "./slack-bot-scopes": {
26
+ "types": "./dist/slack-bot-scopes.d.ts",
27
+ "import": "./dist/slack-bot-scopes.js"
28
+ },
29
+ "./google-drive": {
30
+ "types": "./dist/google-drive.d.ts",
31
+ "import": "./dist/google-drive.js"
24
32
  }
25
33
  },
26
34
  "publishConfig": {
@@ -28,8 +36,8 @@
28
36
  "provenance": true
29
37
  },
30
38
  "scripts": {
31
- "typecheck": "tsgo --noEmit",
32
- "build": "tsup",
39
+ "typecheck": "tsc --noEmit",
40
+ "build": "bun ../../scripts/build-typescript-package.ts",
33
41
  "prepublishOnly": "bash ../../scripts/prepublish-guard"
34
42
  },
35
43
  "dependencies": {
@@ -0,0 +1,36 @@
1
+ export type ModalCheckpointProviderBinding = {
2
+ version: 1;
3
+ serverUrl: string;
4
+ workspaceName: string;
5
+ environment: string;
6
+ };
7
+
8
+ /**
9
+ * One canonical, non-secret identity for the Modal namespace that owns a
10
+ * checkpoint. The same bytes are used for uniqueness, durable storage, and
11
+ * destructive-call fencing.
12
+ */
13
+ export function canonicalModalCheckpointProviderBinding(
14
+ value: unknown,
15
+ ): { binding: ModalCheckpointProviderBinding; key: string } | null {
16
+ if (!value || typeof value !== "object") return null;
17
+ const candidate = value as Partial<ModalCheckpointProviderBinding>;
18
+ if (
19
+ candidate.version !== 1 ||
20
+ typeof candidate.serverUrl !== "string" ||
21
+ candidate.serverUrl.trim().length === 0 ||
22
+ typeof candidate.workspaceName !== "string" ||
23
+ candidate.workspaceName.trim().length === 0 ||
24
+ typeof candidate.environment !== "string"
25
+ ) {
26
+ return null;
27
+ }
28
+ const binding: ModalCheckpointProviderBinding = {
29
+ version: 1,
30
+ serverUrl: candidate.serverUrl,
31
+ workspaceName: candidate.workspaceName,
32
+ environment: candidate.environment,
33
+ };
34
+ const key = JSON.stringify(binding);
35
+ return key.length <= 1024 ? { binding, key } : null;
36
+ }
@@ -0,0 +1,101 @@
1
+ import { z } from "zod";
2
+
3
+ import { ConnectionMetadata } from "./index";
4
+
5
+ export const GOOGLE_DRIVE_PROVIDER_DOMAIN = "googleapis.com" as const;
6
+ export const GOOGLE_DRIVE_METADATA_READONLY_SCOPE =
7
+ "https://www.googleapis.com/auth/drive.metadata.readonly" as const;
8
+ export const GOOGLE_DRIVE_READONLY_SCOPE =
9
+ "https://www.googleapis.com/auth/drive.readonly" as const;
10
+ export const GOOGLE_DRIVE_CREDENTIAL_ROLE = "google_drive_metadata" as const;
11
+ export const GOOGLE_DRIVE_CREDENTIAL_LABEL = "Google Drive metadata browser" as const;
12
+
13
+ export const GoogleDriveTargetScope = z.enum(["user", "workspace", "organization"]);
14
+ export type GoogleDriveTargetScope = z.infer<typeof GoogleDriveTargetScope>;
15
+
16
+ export const GoogleDriveSyncCadence = z.enum(["manual", "hourly", "daily"]);
17
+ export type GoogleDriveSyncCadence = z.infer<typeof GoogleDriveSyncCadence>;
18
+
19
+ export const GoogleDriveReadPolicy = z.enum(["allow", "ask", "block"]);
20
+ export type GoogleDriveReadPolicy = z.infer<typeof GoogleDriveReadPolicy>;
21
+
22
+ export const GoogleDriveSelectedSource = z.object({
23
+ id: z.string().min(1).max(256),
24
+ name: z.string().min(1).max(1024),
25
+ mimeType: z.string().min(1).max(256),
26
+ driveId: z.string().min(1).max(256).nullable().default(null),
27
+ targetScope: GoogleDriveTargetScope,
28
+ syncCadence: GoogleDriveSyncCadence.default("hourly"),
29
+ readPolicy: GoogleDriveReadPolicy.default("allow"),
30
+ selectedAt: z.string().datetime({ offset: true }),
31
+ });
32
+ export type GoogleDriveSelectedSource = z.infer<typeof GoogleDriveSelectedSource>;
33
+
34
+ export const GoogleDriveConnectionMetadata = z
35
+ .object({
36
+ credentialRole: z.literal(GOOGLE_DRIVE_CREDENTIAL_ROLE),
37
+ credentialLabel: z.literal(GOOGLE_DRIVE_CREDENTIAL_LABEL),
38
+ googlePermissionId: z.string().min(1).max(256),
39
+ googleEmail: z.string().email().max(320),
40
+ googleDisplayName: z.string().min(1).max(512).nullable(),
41
+ verifiedAt: z.string().datetime({ offset: true }),
42
+ accessMode: z.enum(["metadata_readonly", "readonly"]),
43
+ selectedSources: z.array(GoogleDriveSelectedSource).max(100).optional(),
44
+ /** @deprecated Read `selectedSources`; retained while existing connections migrate. */
45
+ selectedSource: GoogleDriveSelectedSource.nullable().optional(),
46
+ })
47
+ .passthrough();
48
+ export type GoogleDriveConnectionMetadata = z.infer<typeof GoogleDriveConnectionMetadata>;
49
+
50
+ export const GoogleDriveOAuthStartRequest = z.object({
51
+ connectionId: z.string().uuid().optional(),
52
+ });
53
+ export type GoogleDriveOAuthStartRequest = z.infer<typeof GoogleDriveOAuthStartRequest>;
54
+
55
+ export const GoogleDriveOAuthStartResponse = z.object({
56
+ authorizationUrl: z.string().url(),
57
+ expiresAt: z.string().datetime({ offset: true }),
58
+ });
59
+ export type GoogleDriveOAuthStartResponse = z.infer<typeof GoogleDriveOAuthStartResponse>;
60
+
61
+ export const GoogleDriveBrowseItem = z.object({
62
+ id: z.string().min(1).max(256),
63
+ name: z.string().min(1).max(1024),
64
+ mimeType: z.string().min(1).max(256),
65
+ kind: z.enum(["folder", "file"]),
66
+ driveId: z.string().min(1).max(256).nullable(),
67
+ modifiedTime: z.string().datetime({ offset: true }).nullable(),
68
+ size: z.string().regex(/^\d+$/).nullable(),
69
+ webViewLink: z.string().url().nullable(),
70
+ });
71
+ export type GoogleDriveBrowseItem = z.infer<typeof GoogleDriveBrowseItem>;
72
+
73
+ export const GoogleDriveBrowseResponse = z.object({
74
+ connection: z.lazy(() => ConnectionMetadata),
75
+ parentId: z.string().min(1).max(256),
76
+ current: GoogleDriveBrowseItem.nullable(),
77
+ items: z.array(GoogleDriveBrowseItem),
78
+ nextPageToken: z.string().min(1).max(4096).nullable(),
79
+ incompleteSearch: z.boolean(),
80
+ });
81
+ export type GoogleDriveBrowseResponse = z.infer<typeof GoogleDriveBrowseResponse>;
82
+
83
+ export const SaveGoogleDriveSourceRequest = z.object({
84
+ sources: z
85
+ .array(
86
+ GoogleDriveBrowseItem.pick({
87
+ id: true,
88
+ name: true,
89
+ mimeType: true,
90
+ driveId: true,
91
+ }),
92
+ )
93
+ .max(100)
94
+ .refine((sources) => new Set(sources.map((source) => source.id)).size === sources.length, {
95
+ message: "Google Drive sources must be unique",
96
+ }),
97
+ targetScope: GoogleDriveTargetScope,
98
+ syncCadence: GoogleDriveSyncCadence.default("hourly"),
99
+ readPolicy: GoogleDriveReadPolicy.default("allow"),
100
+ });
101
+ export type SaveGoogleDriveSourceRequest = z.infer<typeof SaveGoogleDriveSourceRequest>;