@opengeni/contracts 0.39.0 → 0.44.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.
Files changed (130) hide show
  1. package/dist/atlassian.d.ts +278 -0
  2. package/dist/atlassian.js +55 -0
  3. package/dist/atlassian.js.map +1 -0
  4. package/dist/chunk-52SGB2QO.js +688 -0
  5. package/dist/chunk-52SGB2QO.js.map +1 -0
  6. package/dist/{chunk-7JZMI22I.js → chunk-5UDNP7AO.js} +34 -2
  7. package/dist/chunk-5UDNP7AO.js.map +1 -0
  8. package/dist/chunk-BVGIYW7D.js +11 -0
  9. package/dist/chunk-BVGIYW7D.js.map +1 -0
  10. package/dist/chunk-CADSX6UN.js +1145 -0
  11. package/dist/chunk-CADSX6UN.js.map +1 -0
  12. package/dist/chunk-D2HKF2EF.js +1460 -0
  13. package/dist/chunk-D2HKF2EF.js.map +1 -0
  14. package/dist/chunk-FJBG5E4O.js +194 -0
  15. package/dist/chunk-FJBG5E4O.js.map +1 -0
  16. package/dist/chunk-H5BVCZKF.js +382 -0
  17. package/dist/chunk-H5BVCZKF.js.map +1 -0
  18. package/dist/chunk-LSB7GRLG.js +779 -0
  19. package/dist/chunk-LSB7GRLG.js.map +1 -0
  20. package/dist/chunk-MYBZRDTY.js +340 -0
  21. package/dist/chunk-MYBZRDTY.js.map +1 -0
  22. package/dist/chunk-RIY7GYQS.js +1204 -0
  23. package/dist/chunk-RIY7GYQS.js.map +1 -0
  24. package/dist/chunk-TZ6YEYN4.js +386 -0
  25. package/dist/chunk-TZ6YEYN4.js.map +1 -0
  26. package/dist/chunk-VA22KRHS.js +15177 -0
  27. package/dist/chunk-VA22KRHS.js.map +1 -0
  28. package/dist/chunk-Y3MLSLB4.js +392 -0
  29. package/dist/chunk-Y3MLSLB4.js.map +1 -0
  30. package/dist/chunk-YRKRZ6OF.js +134 -0
  31. package/dist/chunk-YRKRZ6OF.js.map +1 -0
  32. package/dist/company-profile.d.ts +629 -0
  33. package/dist/document-artifact-commands.d.ts +282 -0
  34. package/dist/document-artifact-commands.js +54 -0
  35. package/dist/document-artifact-commands.js.map +1 -0
  36. package/dist/document-artifact-query.d.ts +2 -0
  37. package/dist/document-artifact-query.js +54 -0
  38. package/dist/document-artifact-query.js.map +1 -0
  39. package/dist/editable-artifact-binary.d.ts +56 -0
  40. package/dist/editable-artifact-causal-frontier.d.ts +12 -0
  41. package/dist/editable-artifact-causal-frontier.js +18 -0
  42. package/dist/editable-artifact-causal-frontier.js.map +1 -0
  43. package/dist/editable-artifact-codec-registry.d.ts +48 -0
  44. package/dist/editable-artifact-codec-registry.js +20 -0
  45. package/dist/editable-artifact-codec-registry.js.map +1 -0
  46. package/dist/editable-artifact-committed-transaction.d.ts +35 -0
  47. package/dist/editable-artifact-committed-transaction.js +19 -0
  48. package/dist/editable-artifact-committed-transaction.js.map +1 -0
  49. package/dist/editable-artifact-live.d.ts +276 -0
  50. package/dist/editable-artifact-live.js +907 -0
  51. package/dist/editable-artifact-live.js.map +1 -0
  52. package/dist/editable-artifact-serialized-commit.d.ts +53 -0
  53. package/dist/editable-artifact-serialized-commit.js +26 -0
  54. package/dist/editable-artifact-serialized-commit.js.map +1 -0
  55. package/dist/editable-artifact-versions.d.ts +6 -0
  56. package/dist/editable-artifact-versions.js +11 -0
  57. package/dist/editable-artifact-versions.js.map +1 -0
  58. package/dist/editable-artifacts.d.ts +46 -0
  59. package/dist/editable-artifacts.js +236 -0
  60. package/dist/editable-artifacts.js.map +1 -0
  61. package/dist/event-preview.d.ts +7 -7
  62. package/dist/google-drive.d.ts +114 -2
  63. package/dist/google-drive.js +70 -14
  64. package/dist/google-drive.js.map +1 -1
  65. package/dist/image-generation.d.ts +70 -0
  66. package/dist/index.d.ts +5180 -329
  67. package/dist/index.js +1173 -40
  68. package/dist/interaction.d.ts +6895 -0
  69. package/dist/mcp-receipts.d.ts +96 -0
  70. package/dist/memory-slack-delivery.d.ts +397 -0
  71. package/dist/presentation-artifact-commands.d.ts +349 -0
  72. package/dist/presentation-artifact-commands.js +66 -0
  73. package/dist/presentation-artifact-commands.js.map +1 -0
  74. package/dist/presentation-artifact-query.d.ts +2 -0
  75. package/dist/presentation-artifact-query.js +66 -0
  76. package/dist/presentation-artifact-query.js.map +1 -0
  77. package/dist/retained-output.d.ts +83 -6
  78. package/dist/sandbox-snapshots.d.ts +9 -0
  79. package/dist/scoped-knowledge.d.ts +14 -13
  80. package/dist/slack-bot-scopes.d.ts +4 -0
  81. package/dist/slack-bot-scopes.js +3 -1
  82. package/dist/spreadsheet-artifact-commands.d.ts +101 -0
  83. package/dist/spreadsheet-artifact-commands.js +27 -0
  84. package/dist/spreadsheet-artifact-commands.js.map +1 -0
  85. package/dist/spreadsheet-artifact-date.d.ts +4 -0
  86. package/dist/spreadsheet-artifact-query.d.ts +120 -0
  87. package/dist/spreadsheet-artifact-query.js +48 -0
  88. package/dist/spreadsheet-artifact-query.js.map +1 -0
  89. package/dist/tool-catalog.d.ts +576 -0
  90. package/dist/video-generation.d.ts +532 -0
  91. package/dist/video-generation.js +51 -0
  92. package/dist/video-generation.js.map +1 -0
  93. package/dist/workspace-learning-policy.d.ts +208 -0
  94. package/package.json +61 -1
  95. package/src/atlassian.ts +160 -0
  96. package/src/company-profile.ts +306 -0
  97. package/src/document-artifact-commands.ts +1709 -0
  98. package/src/document-artifact-query.ts +2 -0
  99. package/src/editable-artifact-binary.ts +396 -0
  100. package/src/editable-artifact-causal-frontier.ts +154 -0
  101. package/src/editable-artifact-codec-registry.ts +261 -0
  102. package/src/editable-artifact-committed-transaction.ts +478 -0
  103. package/src/editable-artifact-live.ts +1379 -0
  104. package/src/editable-artifact-serialized-commit.ts +494 -0
  105. package/src/editable-artifact-versions.ts +8 -0
  106. package/src/editable-artifacts.ts +473 -0
  107. package/src/event-preview.ts +6 -6
  108. package/src/google-drive.ts +68 -15
  109. package/src/image-generation.ts +106 -0
  110. package/src/index.ts +2535 -282
  111. package/src/interaction.ts +2292 -0
  112. package/src/mcp-receipts.ts +281 -0
  113. package/src/memory-slack-delivery.ts +183 -0
  114. package/src/presentation-artifact-commands.ts +2035 -0
  115. package/src/presentation-artifact-query.ts +2 -0
  116. package/src/retained-output.ts +248 -8
  117. package/src/sandbox-snapshots.ts +28 -1
  118. package/src/scoped-knowledge.ts +18 -4
  119. package/src/slack-bot-scopes.ts +34 -1
  120. package/src/spreadsheet-artifact-commands.ts +999 -0
  121. package/src/spreadsheet-artifact-date.ts +21 -0
  122. package/src/spreadsheet-artifact-query.ts +1411 -0
  123. package/src/tool-catalog.ts +334 -0
  124. package/src/video-generation.ts +394 -0
  125. package/src/workspace-learning-policy.ts +233 -0
  126. package/dist/chunk-7JZMI22I.js.map +0 -1
  127. package/dist/chunk-PCTCJEAF.js +0 -10799
  128. package/dist/chunk-PCTCJEAF.js.map +0 -1
  129. package/dist/secret-redaction.d.ts +0 -40
  130. package/src/secret-redaction.ts +0 -364
@@ -0,0 +1,334 @@
1
+ import { z } from "zod";
2
+
3
+ export const ATTEMPT_TOOL_CATALOG_VERSION = 1 as const;
4
+ export const ATTEMPT_TOOL_CATALOG_MAX_ENTRIES = 4_096;
5
+ export const ATTEMPT_TOOL_CATALOG_MAX_BYTES = 16 * 1024 * 1024;
6
+ export const ATTEMPT_TOOL_CATALOG_MAX_PATH_SEGMENTS = 8;
7
+ export const ATTEMPT_TOOL_CATALOG_MAX_CONTENT_BLOCKS = 1_024;
8
+ export const CODEMODE_OPERATION_VERSION = 1 as const;
9
+ export const CODEMODE_ARGUMENTS_MAX_BYTES = 4 * 1024 * 1024;
10
+ export const CODEMODE_RESULT_MAX_BYTES = 16 * 1024 * 1024;
11
+ export const CODEMODE_DISPATCH_TIMEOUT_MS = 5_000;
12
+ export const CODEMODE_CLAIM_LEASE_MS = 30_000;
13
+ export const CODEMODE_CLAIM_HEARTBEAT_MS = 10_000;
14
+ export const CODEMODE_MAX_CONCURRENT_CALLS_PER_ATTEMPT = 16;
15
+
16
+ const sha256 = z.string().regex(/^[0-9a-f]{64}$/u);
17
+ const serverIdentifier = z
18
+ .string()
19
+ .min(1)
20
+ .max(256)
21
+ .regex(/^[A-Za-z0-9_-]+$/u);
22
+ const toolIdentifier = z
23
+ .string()
24
+ .min(1)
25
+ .max(512)
26
+ .regex(/^[^\u0000-\u001f\u007f]+$/u);
27
+ const namespaceSegment = z
28
+ .string()
29
+ .min(1)
30
+ .max(128)
31
+ .regex(/^[A-Za-z_$][A-Za-z0-9_$]*$/u)
32
+ .refine((value) => !["__proto__", "prototype", "constructor"].includes(value), {
33
+ message: "unsafe Codemode namespace segment",
34
+ });
35
+ const jsonObject = z.record(z.string().max(512), z.json());
36
+
37
+ /** Opaque authority identity. Display/wire names must never be parsed as authority. */
38
+ export const AttemptToolIdentity = z
39
+ .object({
40
+ serverId: serverIdentifier,
41
+ toolName: toolIdentifier,
42
+ })
43
+ .strict();
44
+ export type AttemptToolIdentity = z.infer<typeof AttemptToolIdentity>;
45
+
46
+ export const AttemptToolCatalogIcon = z
47
+ .object({
48
+ src: z.string().min(1).max(8_192),
49
+ mimeType: z.string().min(1).max(128).optional(),
50
+ sizes: z.array(z.string().min(1).max(64)).max(16).optional(),
51
+ theme: z.enum(["light", "dark"]).optional(),
52
+ })
53
+ .strict();
54
+ export type AttemptToolCatalogIcon = z.infer<typeof AttemptToolCatalogIcon>;
55
+
56
+ /** MCP annotations retained without inventing stronger effect guarantees. */
57
+ export const AttemptToolAnnotations = z
58
+ .object({
59
+ title: z.string().max(512).optional(),
60
+ readOnlyHint: z.boolean().optional(),
61
+ destructiveHint: z.boolean().optional(),
62
+ idempotentHint: z.boolean().optional(),
63
+ openWorldHint: z.boolean().optional(),
64
+ })
65
+ .loose();
66
+ export type AttemptToolAnnotations = z.infer<typeof AttemptToolAnnotations>;
67
+
68
+ /** JSON Schema is preserved as received. Runtime byte/node guards remain authoritative. */
69
+ export const AttemptToolJsonSchema = jsonObject;
70
+ export type AttemptToolJsonSchema = z.infer<typeof AttemptToolJsonSchema>;
71
+
72
+ export const AttemptToolCatalogEntry = z
73
+ .object({
74
+ identity: AttemptToolIdentity,
75
+ /** Exact model-wire projection for this generation, e.g. `slack__search`. */
76
+ modelName: toolIdentifier,
77
+ /** Safe generated Codemode namespace; convenience only, never authority. */
78
+ codemodePath: z.array(namespaceSegment).min(2).max(ATTEMPT_TOOL_CATALOG_MAX_PATH_SEGMENTS),
79
+ title: z.string().min(1).max(512).optional(),
80
+ description: z.string().max(32_768).optional(),
81
+ inputSchema: AttemptToolJsonSchema,
82
+ outputSchema: AttemptToolJsonSchema.optional(),
83
+ annotations: AttemptToolAnnotations.optional(),
84
+ icons: z.array(AttemptToolCatalogIcon).max(16).optional(),
85
+ source: z.enum(["opengeni", "files", "docs", "mcp", "codex_apps", "interaction"]),
86
+ approval: z.enum(["none", "human", "policy"]),
87
+ })
88
+ .strict();
89
+ export type AttemptToolCatalogEntry = z.infer<typeof AttemptToolCatalogEntry>;
90
+
91
+ export const AttemptToolCatalog = z
92
+ .object({
93
+ version: z.literal(ATTEMPT_TOOL_CATALOG_VERSION),
94
+ accountId: z.string().uuid(),
95
+ workspaceId: z.string().uuid(),
96
+ sessionId: z.string().uuid(),
97
+ turnId: z.string().uuid(),
98
+ attemptId: z.string().uuid(),
99
+ executionGeneration: z.number().int().positive(),
100
+ generation: z.number().int().positive(),
101
+ digest: sha256,
102
+ createdAt: z.string().datetime({ offset: true }),
103
+ entries: z.array(AttemptToolCatalogEntry).max(ATTEMPT_TOOL_CATALOG_MAX_ENTRIES),
104
+ })
105
+ .strict()
106
+ .superRefine((catalog, context) => {
107
+ const identities = new Set<string>();
108
+ const modelNames = new Set<string>();
109
+ const codemodePaths = new Set<string>();
110
+ for (const [index, entry] of catalog.entries.entries()) {
111
+ const identity = `${entry.identity.serverId}\u0000${entry.identity.toolName}`;
112
+ const codemodePath = entry.codemodePath.join(".");
113
+ if (identities.has(identity)) {
114
+ context.addIssue({
115
+ code: "custom",
116
+ path: ["entries", index, "identity"],
117
+ message: "duplicate tool identity",
118
+ });
119
+ }
120
+ if (modelNames.has(entry.modelName)) {
121
+ context.addIssue({
122
+ code: "custom",
123
+ path: ["entries", index, "modelName"],
124
+ message: "duplicate model tool name",
125
+ });
126
+ }
127
+ if (codemodePaths.has(codemodePath)) {
128
+ context.addIssue({
129
+ code: "custom",
130
+ path: ["entries", index, "codemodePath"],
131
+ message: "duplicate Codemode tool path",
132
+ });
133
+ }
134
+ identities.add(identity);
135
+ modelNames.add(entry.modelName);
136
+ codemodePaths.add(codemodePath);
137
+ }
138
+ });
139
+ export type AttemptToolCatalog = z.infer<typeof AttemptToolCatalog>;
140
+
141
+ export const AttemptToolCaller = z
142
+ .object({
143
+ kind: z.enum(["model", "codemode"]),
144
+ subjectId: z.string().min(1).max(1_024),
145
+ })
146
+ .strict();
147
+ export type AttemptToolCaller = z.infer<typeof AttemptToolCaller>;
148
+
149
+ export const AttemptToolCall = z
150
+ .object({
151
+ operationId: z.string().uuid(),
152
+ catalogDigest: sha256,
153
+ identity: AttemptToolIdentity,
154
+ arguments: jsonObject,
155
+ caller: AttemptToolCaller,
156
+ })
157
+ .strict();
158
+ export type AttemptToolCall = z.infer<typeof AttemptToolCall>;
159
+
160
+ const McpAnnotations = z.record(z.string().max(256), z.json()).optional();
161
+ const McpMeta = z.record(z.string().max(512), z.json()).optional();
162
+
163
+ export const AttemptToolTextContent = z
164
+ .object({
165
+ type: z.literal("text"),
166
+ text: z.string(),
167
+ annotations: McpAnnotations,
168
+ _meta: McpMeta,
169
+ })
170
+ .loose();
171
+
172
+ export const AttemptToolImageContent = z
173
+ .object({
174
+ type: z.literal("image"),
175
+ data: z.string(),
176
+ mimeType: z.string().min(1).max(128),
177
+ annotations: McpAnnotations,
178
+ _meta: McpMeta,
179
+ })
180
+ .loose();
181
+
182
+ export const AttemptToolAudioContent = z
183
+ .object({
184
+ type: z.literal("audio"),
185
+ data: z.string(),
186
+ mimeType: z.string().min(1).max(128),
187
+ annotations: McpAnnotations,
188
+ _meta: McpMeta,
189
+ })
190
+ .loose();
191
+
192
+ export const AttemptToolResourceLinkContent = z
193
+ .object({
194
+ type: z.literal("resource_link"),
195
+ name: z.string().min(1).max(1_024),
196
+ title: z.string().max(1_024).optional(),
197
+ uri: z.string().min(1).max(16_384),
198
+ description: z.string().max(32_768).optional(),
199
+ mimeType: z.string().max(128).optional(),
200
+ size: z.number().int().nonnegative().optional(),
201
+ icons: z.array(AttemptToolCatalogIcon).max(16).optional(),
202
+ annotations: McpAnnotations,
203
+ _meta: McpMeta,
204
+ })
205
+ .loose();
206
+
207
+ const AttemptToolTextResource = z
208
+ .object({
209
+ uri: z.string().min(1).max(16_384),
210
+ mimeType: z.string().max(128).optional(),
211
+ text: z.string(),
212
+ _meta: McpMeta,
213
+ })
214
+ .loose();
215
+
216
+ const AttemptToolBlobResource = z
217
+ .object({
218
+ uri: z.string().min(1).max(16_384),
219
+ mimeType: z.string().max(128).optional(),
220
+ blob: z.string(),
221
+ _meta: McpMeta,
222
+ })
223
+ .loose();
224
+
225
+ export const AttemptToolEmbeddedResourceContent = z
226
+ .object({
227
+ type: z.literal("resource"),
228
+ resource: z.union([AttemptToolTextResource, AttemptToolBlobResource]),
229
+ annotations: McpAnnotations,
230
+ _meta: McpMeta,
231
+ })
232
+ .loose();
233
+
234
+ export const AttemptToolContent = z.discriminatedUnion("type", [
235
+ AttemptToolTextContent,
236
+ AttemptToolImageContent,
237
+ AttemptToolAudioContent,
238
+ AttemptToolResourceLinkContent,
239
+ AttemptToolEmbeddedResourceContent,
240
+ ]);
241
+ export type AttemptToolContent = z.infer<typeof AttemptToolContent>;
242
+
243
+ /** Exact MCP-shaped result. No output type is fabricated when `outputSchema` is absent. */
244
+ export const AttemptToolResult = z
245
+ .object({
246
+ content: z.array(AttemptToolContent).max(ATTEMPT_TOOL_CATALOG_MAX_CONTENT_BLOCKS),
247
+ structuredContent: jsonObject.optional(),
248
+ isError: z.boolean().optional(),
249
+ _meta: McpMeta,
250
+ })
251
+ .loose();
252
+ export type AttemptToolResult = z.infer<typeof AttemptToolResult>;
253
+
254
+ export const CodemodeOperationState = z.enum([
255
+ "queued",
256
+ "running",
257
+ "completed",
258
+ "failed",
259
+ "outcome_unknown",
260
+ "cancelled",
261
+ ]);
262
+ export type CodemodeOperationState = z.infer<typeof CodemodeOperationState>;
263
+
264
+ /**
265
+ * Durable, attempt-fenced Codemode operation. `requestDigest` binds an
266
+ * idempotency key to one exact call; callers may safely poll/retry the same
267
+ * operation id but may never repurpose it.
268
+ */
269
+ export const CodemodeOperation = z
270
+ .object({
271
+ version: z.literal(CODEMODE_OPERATION_VERSION),
272
+ operationId: z.string().uuid(),
273
+ accountId: z.string().uuid(),
274
+ workspaceId: z.string().uuid(),
275
+ sessionId: z.string().uuid(),
276
+ turnId: z.string().uuid(),
277
+ attemptId: z.string().uuid(),
278
+ executionGeneration: z.number().int().positive(),
279
+ catalogDigest: sha256,
280
+ requestDigest: sha256,
281
+ identity: AttemptToolIdentity,
282
+ arguments: jsonObject,
283
+ caller: AttemptToolCaller.refine((caller) => caller.kind === "codemode", {
284
+ message: "Codemode operation caller must be codemode",
285
+ }),
286
+ state: CodemodeOperationState,
287
+ result: AttemptToolResult.nullable(),
288
+ errorCode: z.string().min(1).max(128).nullable(),
289
+ errorMessage: z.string().min(1).max(4_096).nullable(),
290
+ createdAt: z.string().datetime({ offset: true }),
291
+ claimedAt: z.string().datetime({ offset: true }).nullable(),
292
+ executionStartedAt: z.string().datetime({ offset: true }).nullable(),
293
+ completedAt: z.string().datetime({ offset: true }).nullable(),
294
+ updatedAt: z.string().datetime({ offset: true }),
295
+ })
296
+ .strict();
297
+ export type CodemodeOperation = z.infer<typeof CodemodeOperation>;
298
+
299
+ export const CodemodeCallRequest = z
300
+ .object({
301
+ operationId: z.string().uuid(),
302
+ catalogDigest: sha256,
303
+ identity: AttemptToolIdentity,
304
+ arguments: jsonObject,
305
+ })
306
+ .strict();
307
+ export type CodemodeCallRequest = z.infer<typeof CodemodeCallRequest>;
308
+
309
+ export const CodemodeCallSubmission = z
310
+ .object({
311
+ operation: CodemodeOperation,
312
+ dispatch: z.enum(["accepted", "already_running", "terminal", "unavailable", "rejected"]),
313
+ })
314
+ .strict();
315
+ export type CodemodeCallSubmission = z.infer<typeof CodemodeCallSubmission>;
316
+
317
+ /** Tiny NATS wake-up. Postgres, never the broker payload, is durable truth. */
318
+ export const CodemodeDispatchRequest = z
319
+ .object({
320
+ version: z.literal(CODEMODE_OPERATION_VERSION),
321
+ operationId: z.string().uuid(),
322
+ catalogDigest: sha256,
323
+ })
324
+ .strict();
325
+ export type CodemodeDispatchRequest = z.infer<typeof CodemodeDispatchRequest>;
326
+
327
+ export const CodemodeDispatchAck = z
328
+ .object({
329
+ version: z.literal(CODEMODE_OPERATION_VERSION),
330
+ operationId: z.string().uuid(),
331
+ status: z.enum(["accepted", "already_running", "terminal", "unavailable", "rejected"]),
332
+ })
333
+ .strict();
334
+ export type CodemodeDispatchAck = z.infer<typeof CodemodeDispatchAck>;