@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,281 @@
1
+ import { z } from "zod";
2
+
3
+ /**
4
+ * Versioned, provider-neutral receipt returned by first-party MCP mutation tools.
5
+ *
6
+ * A receipt intentionally contains only server-generated identity and outcome
7
+ * facts. Callers already have mutation inputs in their tool-call history, so
8
+ * copying names, prompts, instructions, commands, evidence, or other request
9
+ * fields into the result wastes context and can expose data twice.
10
+ */
11
+ export const MCP_MUTATION_RECEIPT_VERSION = "mcp-mutation-receipt.v1" as const;
12
+ export const MCP_MUTATION_RECEIPT_MAX_BYTES = 64 * 1024;
13
+
14
+ const utf8ByteLength = (value: string): number => new TextEncoder().encode(value).byteLength;
15
+
16
+ function boundedUtf8String(maxBytes: number, minLength = 0) {
17
+ return z
18
+ .string()
19
+ .min(minLength)
20
+ .max(maxBytes)
21
+ .superRefine((value, context) => {
22
+ if (utf8ByteLength(value) > maxBytes) {
23
+ context.addIssue({
24
+ code: "custom",
25
+ message: `string must contain at most ${maxBytes} UTF-8 bytes`,
26
+ });
27
+ }
28
+ });
29
+ }
30
+
31
+ export const McpMutationReceiptOutcome = z.enum([
32
+ "created",
33
+ "updated",
34
+ "deleted",
35
+ "unchanged",
36
+ "accepted",
37
+ "triggered",
38
+ "repaired",
39
+ "replayed",
40
+ "partial_failure",
41
+ ]);
42
+ export type McpMutationReceiptOutcome = z.infer<typeof McpMutationReceiptOutcome>;
43
+
44
+ export const McpMutationReceiptIdempotencyStatus = z.enum([
45
+ "not_supported",
46
+ "not_requested",
47
+ "applied",
48
+ "replayed",
49
+ "unknown",
50
+ ]);
51
+ export type McpMutationReceiptIdempotencyStatus = z.infer<
52
+ typeof McpMutationReceiptIdempotencyStatus
53
+ >;
54
+
55
+ export const McpMutationResource = z
56
+ .object({
57
+ type: boundedUtf8String(128, 1),
58
+ id: boundedUtf8String(256, 1),
59
+ version: z.union([z.number().int().nonnegative(), boundedUtf8String(128, 1)]).optional(),
60
+ etag: boundedUtf8String(512, 1).optional(),
61
+ state: boundedUtf8String(128, 1).optional(),
62
+ })
63
+ .strict();
64
+ export type McpMutationResource = z.infer<typeof McpMutationResource>;
65
+
66
+ const McpMutationReceiptFact = z.union([
67
+ boundedUtf8String(512),
68
+ z.number().finite(),
69
+ z.boolean(),
70
+ z.null(),
71
+ ]);
72
+
73
+ const McpMutationReceiptFacts = z
74
+ .record(boundedUtf8String(64, 1), McpMutationReceiptFact)
75
+ .superRefine((value, context) => {
76
+ if (Object.keys(value).length > 16) {
77
+ context.addIssue({
78
+ code: "custom",
79
+ message: "receipt facts may contain at most 16 scalar entries",
80
+ });
81
+ }
82
+ });
83
+
84
+ const McpMutationReceiptNextActionArguments = z
85
+ .record(boundedUtf8String(64, 1), McpMutationReceiptFact)
86
+ .superRefine((value, context) => {
87
+ if (Object.keys(value).length > 8) {
88
+ context.addIssue({
89
+ code: "custom",
90
+ message: "receipt nextAction arguments may contain at most 8 scalar entries",
91
+ });
92
+ }
93
+ });
94
+
95
+ export const McpMutationReceipt = z
96
+ .object({
97
+ receiptVersion: z.literal(MCP_MUTATION_RECEIPT_VERSION),
98
+ operation: boundedUtf8String(128, 1),
99
+ // v1 receipts describe committed truth only. Validation/auth/conflict and
100
+ // fully compensated failures remain MCP errors rather than success-shaped
101
+ // committed=false results.
102
+ committed: z.literal(true),
103
+ outcome: McpMutationReceiptOutcome,
104
+ changed: z.boolean(),
105
+ resource: McpMutationResource,
106
+ relatedResources: z.array(McpMutationResource).max(8).optional(),
107
+ timestamp: z.string().datetime({ offset: true }),
108
+ idempotency: z
109
+ .object({
110
+ status: McpMutationReceiptIdempotencyStatus,
111
+ })
112
+ .strict(),
113
+ partialFailure: z
114
+ .object({
115
+ stage: boundedUtf8String(128, 1),
116
+ retryable: z.boolean(),
117
+ })
118
+ .strict()
119
+ .optional(),
120
+ warnings: z.array(boundedUtf8String(512, 1)).max(20),
121
+ nextAction: z
122
+ .object({
123
+ tool: boundedUtf8String(128, 1),
124
+ arguments: McpMutationReceiptNextActionArguments,
125
+ })
126
+ .strict()
127
+ .optional(),
128
+ /** Operation-specific outcome facts. Values are deliberately bounded scalars. */
129
+ facts: McpMutationReceiptFacts.optional(),
130
+ /**
131
+ * Bounded session_create compatibility aliases. Existing orchestration
132
+ * consumers use these server-authored lineage facts to spawn descendants
133
+ * without fetching the full session entity.
134
+ */
135
+ id: boundedUtf8String(256, 1).optional(),
136
+ rootSessionId: boundedUtf8String(256, 1).optional(),
137
+ nestedAgentDepth: z.number().int().nonnegative().optional(),
138
+ effectiveMaxNestedAgentDepth: z.number().int().nonnegative().optional(),
139
+ /** Bounded session_steer compatibility alias for resource.id. */
140
+ updateId: boundedUtf8String(256, 1).optional(),
141
+ })
142
+ .strict()
143
+ .superRefine((receipt, context) => {
144
+ const sessionCreateCompatibility = [
145
+ ["id", receipt.id],
146
+ ["rootSessionId", receipt.rootSessionId],
147
+ ["nestedAgentDepth", receipt.nestedAgentDepth],
148
+ ["effectiveMaxNestedAgentDepth", receipt.effectiveMaxNestedAgentDepth],
149
+ ] as const;
150
+ if (receipt.operation === "session_create") {
151
+ for (const [field, value] of sessionCreateCompatibility) {
152
+ if (value === undefined) {
153
+ context.addIssue({
154
+ code: "custom",
155
+ path: [field],
156
+ message: `session_create receipts require ${field}`,
157
+ });
158
+ }
159
+ }
160
+ if (receipt.id !== undefined && receipt.id !== receipt.resource.id) {
161
+ context.addIssue({
162
+ code: "custom",
163
+ path: ["id"],
164
+ message: "session_create id must equal resource.id",
165
+ });
166
+ }
167
+ } else {
168
+ for (const [field, value] of sessionCreateCompatibility) {
169
+ if (value !== undefined) {
170
+ context.addIssue({
171
+ code: "custom",
172
+ path: [field],
173
+ message: `${field} is only valid for session_create receipts`,
174
+ });
175
+ }
176
+ }
177
+ }
178
+
179
+ if (receipt.operation === "session_steer") {
180
+ if (receipt.updateId === undefined) {
181
+ context.addIssue({
182
+ code: "custom",
183
+ path: ["updateId"],
184
+ message: "session_steer receipts require updateId",
185
+ });
186
+ } else if (receipt.updateId !== receipt.resource.id) {
187
+ context.addIssue({
188
+ code: "custom",
189
+ path: ["updateId"],
190
+ message: "session_steer updateId must equal resource.id",
191
+ });
192
+ }
193
+ } else if (receipt.updateId !== undefined) {
194
+ context.addIssue({
195
+ code: "custom",
196
+ path: ["updateId"],
197
+ message: "updateId is only valid for session_steer receipts",
198
+ });
199
+ }
200
+
201
+ if (receipt.outcome === "partial_failure") {
202
+ if (!receipt.committed) {
203
+ context.addIssue({
204
+ code: "custom",
205
+ path: ["committed"],
206
+ message: "partial-failure receipts describe a committed mutation",
207
+ });
208
+ }
209
+ if (!receipt.partialFailure) {
210
+ context.addIssue({
211
+ code: "custom",
212
+ path: ["partialFailure"],
213
+ message: "partial-failure receipts require stage and retryability",
214
+ });
215
+ }
216
+ } else if (receipt.partialFailure) {
217
+ context.addIssue({
218
+ code: "custom",
219
+ path: ["partialFailure"],
220
+ message: "partialFailure is only valid for a partial_failure outcome",
221
+ });
222
+ }
223
+
224
+ if (receipt.outcome === "unchanged" && receipt.changed) {
225
+ context.addIssue({
226
+ code: "custom",
227
+ path: ["changed"],
228
+ message: "unchanged receipts cannot report changed=true",
229
+ });
230
+ }
231
+ if (receipt.outcome === "repaired") {
232
+ if (!receipt.changed) {
233
+ context.addIssue({
234
+ code: "custom",
235
+ path: ["changed"],
236
+ message: "a repair must report changed=true",
237
+ });
238
+ }
239
+ if (receipt.idempotency.status !== "applied") {
240
+ context.addIssue({
241
+ code: "custom",
242
+ path: ["idempotency", "status"],
243
+ message: "repaired outcomes require idempotency.status=applied",
244
+ });
245
+ }
246
+ }
247
+ if (receipt.outcome === "replayed") {
248
+ if (receipt.changed) {
249
+ context.addIssue({
250
+ code: "custom",
251
+ path: ["changed"],
252
+ message: "a replay does not apply a new mutation",
253
+ });
254
+ }
255
+ if (receipt.idempotency.status !== "replayed") {
256
+ context.addIssue({
257
+ code: "custom",
258
+ path: ["idempotency", "status"],
259
+ message: "replayed outcomes require idempotency.status=replayed",
260
+ });
261
+ }
262
+ } else if (
263
+ receipt.idempotency.status === "replayed" &&
264
+ !(receipt.outcome === "partial_failure" && !receipt.changed)
265
+ ) {
266
+ context.addIssue({
267
+ code: "custom",
268
+ path: ["outcome"],
269
+ message:
270
+ "idempotency.status=replayed requires a replayed outcome or unchanged partial failure",
271
+ });
272
+ }
273
+
274
+ if (utf8ByteLength(JSON.stringify(receipt, null, 2)) > MCP_MUTATION_RECEIPT_MAX_BYTES) {
275
+ context.addIssue({
276
+ code: "custom",
277
+ message: `receipt must contain at most ${MCP_MUTATION_RECEIPT_MAX_BYTES} UTF-8 bytes when serialized as pretty JSON`,
278
+ });
279
+ }
280
+ });
281
+ export type McpMutationReceipt = z.infer<typeof McpMutationReceipt>;
@@ -0,0 +1,183 @@
1
+ import { z } from "zod";
2
+
3
+ export const MemorySlackImportance = z.enum(["major", "normal", "minor"]);
4
+ export type MemorySlackImportance = z.infer<typeof MemorySlackImportance>;
5
+
6
+ export const MemorySlackRequestedMode = z.enum(["auto", "review", "never"]);
7
+ export type MemorySlackRequestedMode = z.infer<typeof MemorySlackRequestedMode>;
8
+
9
+ export const MemorySlackPublicationDistribution = z
10
+ .object({
11
+ importance: MemorySlackImportance,
12
+ audience: z.literal("workspace"),
13
+ slackMode: MemorySlackRequestedMode,
14
+ shareSummary: z.string().trim().min(1).max(4_096),
15
+ })
16
+ .strict();
17
+ export type MemorySlackPublicationDistribution = z.infer<typeof MemorySlackPublicationDistribution>;
18
+
19
+ export const MemorySlackPublicationConfiguration = z.object({
20
+ id: z.string().uuid(),
21
+ workspaceId: z.string().uuid(),
22
+ revision: z.number().int().positive(),
23
+ enabled: z.boolean(),
24
+ connectionId: z.string().uuid().nullable(),
25
+ slackTeamId: z.string().min(1).max(64).nullable(),
26
+ slackChannelId: z.string().min(1).max(64).nullable(),
27
+ slackChannelName: z.string().min(1).max(256).nullable(),
28
+ autoImportances: z.array(MemorySlackImportance).max(3),
29
+ reviewImportances: z.array(MemorySlackImportance).max(3),
30
+ createdBySubjectId: z.string().min(1).max(1_024),
31
+ createdAt: z.string(),
32
+ });
33
+ export type MemorySlackPublicationConfiguration = z.infer<
34
+ typeof MemorySlackPublicationConfiguration
35
+ >;
36
+
37
+ export const UpdateMemorySlackPublicationConfigurationRequest = z
38
+ .object({
39
+ expectedRevision: z.number().int().nonnegative(),
40
+ enabled: z.boolean(),
41
+ connectionId: z.string().uuid().nullable(),
42
+ slackChannelId: z.string().trim().min(1).max(64).nullable(),
43
+ slackChannelName: z.string().trim().min(1).max(256).nullable(),
44
+ autoImportances: z.array(MemorySlackImportance).max(3),
45
+ reviewImportances: z.array(MemorySlackImportance).max(3),
46
+ })
47
+ .strict()
48
+ .superRefine((value, context) => {
49
+ const overlap = value.autoImportances.filter((importance) =>
50
+ value.reviewImportances.includes(importance),
51
+ );
52
+ if (overlap.length > 0) {
53
+ context.addIssue({
54
+ code: "custom",
55
+ message: "auto and review importance policies must not overlap",
56
+ path: ["reviewImportances"],
57
+ });
58
+ }
59
+ if (value.enabled && (!value.connectionId || !value.slackChannelId)) {
60
+ context.addIssue({
61
+ code: "custom",
62
+ message: "an enabled Slack publication configuration requires a connection and channel",
63
+ });
64
+ }
65
+ });
66
+ export type UpdateMemorySlackPublicationConfigurationRequest = z.infer<
67
+ typeof UpdateMemorySlackPublicationConfigurationRequest
68
+ >;
69
+
70
+ export const MemorySlackPublicationConfigurationResponse = z.object({
71
+ current: MemorySlackPublicationConfiguration.nullable(),
72
+ history: z.array(MemorySlackPublicationConfiguration).max(100),
73
+ });
74
+ export type MemorySlackPublicationConfigurationResponse = z.infer<
75
+ typeof MemorySlackPublicationConfigurationResponse
76
+ >;
77
+
78
+ export const MemorySlackPublicationState = z.enum([
79
+ "review_pending",
80
+ "queued",
81
+ "delivering",
82
+ "retry_wait",
83
+ "delivered",
84
+ "rejected",
85
+ "failed",
86
+ "cancelled",
87
+ ]);
88
+ export type MemorySlackPublicationState = z.infer<typeof MemorySlackPublicationState>;
89
+
90
+ export const MemorySlackPublicationReceiptKind = z.enum([
91
+ "enqueued",
92
+ "review_approved",
93
+ "review_rejected",
94
+ "delivery_claimed",
95
+ "retry_scheduled",
96
+ "delivered",
97
+ "failed",
98
+ "cancelled",
99
+ "manual_retry",
100
+ ]);
101
+ export type MemorySlackPublicationReceiptKind = z.infer<typeof MemorySlackPublicationReceiptKind>;
102
+
103
+ export const MemorySlackPublicationReceipt = z.object({
104
+ id: z.string().uuid(),
105
+ publicationId: z.string().uuid(),
106
+ sequence: z.number().int().positive(),
107
+ kind: MemorySlackPublicationReceiptKind,
108
+ state: MemorySlackPublicationState,
109
+ attemptNumber: z.number().int().nonnegative(),
110
+ actorKind: z.enum(["human", "agent", "service"]),
111
+ actorSubjectId: z.string().min(1).max(1_024),
112
+ operationId: z.string().uuid(),
113
+ errorCode: z.string().min(1).max(128).nullable(),
114
+ retryAt: z.string().nullable(),
115
+ slackChannelId: z.string().min(1).max(64).nullable(),
116
+ slackMessageTimestamp: z.string().min(1).max(64).nullable(),
117
+ createdAt: z.string(),
118
+ });
119
+ export type MemorySlackPublicationReceipt = z.infer<typeof MemorySlackPublicationReceipt>;
120
+
121
+ export const MemorySlackPublication = z.object({
122
+ id: z.string().uuid(),
123
+ workspaceId: z.string().uuid(),
124
+ configurationRevision: z.number().int().positive(),
125
+ connectionId: z.string().uuid(),
126
+ slackTeamId: z.string().min(1).max(64),
127
+ slackChannelId: z.string().min(1).max(64),
128
+ sourceType: z.enum(["workspace_memory", "durable_learning"]),
129
+ sourceId: z.string().min(1).max(1_024),
130
+ sourceVersion: z.string().min(1).max(512).nullable(),
131
+ importance: MemorySlackImportance,
132
+ deliveryMode: z.enum(["auto", "review"]),
133
+ state: MemorySlackPublicationState,
134
+ summary: z.string().max(512),
135
+ sourceLabel: z.string().max(128),
136
+ authoritativePath: z.string().max(2_048).nullable(),
137
+ initiatorKind: z.enum(["human", "agent", "service"]),
138
+ initiatorSubjectId: z.string().min(1).max(1_024),
139
+ initiatingHumanSubjectId: z.string().min(1).max(1_024).nullable(),
140
+ attemptCount: z.number().int().nonnegative(),
141
+ retryAt: z.string().nullable(),
142
+ lastErrorCode: z.string().min(1).max(128).nullable(),
143
+ slackMessageTimestamp: z.string().min(1).max(64).nullable(),
144
+ deliveredAt: z.string().nullable(),
145
+ terminalAt: z.string().nullable(),
146
+ createdAt: z.string(),
147
+ updatedAt: z.string(),
148
+ receipts: z.array(MemorySlackPublicationReceipt).max(100),
149
+ });
150
+ export type MemorySlackPublication = z.infer<typeof MemorySlackPublication>;
151
+
152
+ export const MemorySlackPublicationHistoryResponse = z.object({
153
+ publications: z.array(MemorySlackPublication).max(100),
154
+ nextCursor: z.string().uuid().nullable(),
155
+ });
156
+ export type MemorySlackPublicationHistoryResponse = z.infer<
157
+ typeof MemorySlackPublicationHistoryResponse
158
+ >;
159
+
160
+ export const MemorySlackPublicationActionRequest = z
161
+ .object({
162
+ action: z.enum(["approve", "reject", "retry"]),
163
+ expectedState: MemorySlackPublicationState,
164
+ })
165
+ .strict();
166
+ export type MemorySlackPublicationActionRequest = z.infer<
167
+ typeof MemorySlackPublicationActionRequest
168
+ >;
169
+
170
+ export const SlackPublicationChannel = z.object({
171
+ id: z.string().min(1).max(64),
172
+ name: z.string().min(1).max(256).nullable(),
173
+ isPrivate: z.boolean(),
174
+ });
175
+ export type SlackPublicationChannel = z.infer<typeof SlackPublicationChannel>;
176
+
177
+ export const SlackPublicationChannelListResponse = z.object({
178
+ channels: z.array(SlackPublicationChannel).max(200),
179
+ nextCursor: z.string().max(1_024).nullable(),
180
+ });
181
+ export type SlackPublicationChannelListResponse = z.infer<
182
+ typeof SlackPublicationChannelListResponse
183
+ >;