@opengeni/contracts 0.40.0 → 0.50.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/dist/atlassian.d.ts +278 -0
  2. package/dist/atlassian.js +57 -0
  3. package/dist/atlassian.js.map +1 -0
  4. package/dist/canonical-human-identities.d.ts +157 -0
  5. package/dist/canonical-human-identities.js +23 -0
  6. package/dist/canonical-human-identities.js.map +1 -0
  7. package/dist/{chunk-7JZMI22I.js → chunk-5UDNP7AO.js} +34 -2
  8. package/dist/chunk-5UDNP7AO.js.map +1 -0
  9. package/dist/chunk-BVGIYW7D.js +11 -0
  10. package/dist/chunk-BVGIYW7D.js.map +1 -0
  11. package/dist/chunk-CADSX6UN.js +1145 -0
  12. package/dist/chunk-CADSX6UN.js.map +1 -0
  13. package/dist/chunk-CM6BMECR.js +24 -0
  14. package/dist/chunk-CM6BMECR.js.map +1 -0
  15. package/dist/chunk-D2HKF2EF.js +1460 -0
  16. package/dist/chunk-D2HKF2EF.js.map +1 -0
  17. package/dist/chunk-JBCIY7QD.js +194 -0
  18. package/dist/chunk-JBCIY7QD.js.map +1 -0
  19. package/dist/chunk-JUFK3T4Q.js +80 -0
  20. package/dist/chunk-JUFK3T4Q.js.map +1 -0
  21. package/dist/chunk-LSB7GRLG.js +779 -0
  22. package/dist/chunk-LSB7GRLG.js.map +1 -0
  23. package/dist/chunk-LW7OH6CS.js +382 -0
  24. package/dist/chunk-LW7OH6CS.js.map +1 -0
  25. package/dist/chunk-M5ZGRVIQ.js +719 -0
  26. package/dist/chunk-M5ZGRVIQ.js.map +1 -0
  27. package/dist/chunk-MYBZRDTY.js +340 -0
  28. package/dist/chunk-MYBZRDTY.js.map +1 -0
  29. package/dist/chunk-Q6A7XT2N.js +16734 -0
  30. package/dist/chunk-Q6A7XT2N.js.map +1 -0
  31. package/dist/chunk-RIY7GYQS.js +1204 -0
  32. package/dist/chunk-RIY7GYQS.js.map +1 -0
  33. package/dist/chunk-TZ6YEYN4.js +386 -0
  34. package/dist/chunk-TZ6YEYN4.js.map +1 -0
  35. package/dist/chunk-Y3MLSLB4.js +392 -0
  36. package/dist/chunk-Y3MLSLB4.js.map +1 -0
  37. package/dist/chunk-YRKRZ6OF.js +134 -0
  38. package/dist/chunk-YRKRZ6OF.js.map +1 -0
  39. package/dist/codex-provider-account-authority.d.ts +23 -0
  40. package/dist/codex-provider-account-authority.js +23 -0
  41. package/dist/codex-provider-account-authority.js.map +1 -0
  42. package/dist/company-profile.d.ts +629 -0
  43. package/dist/document-artifact-commands.d.ts +282 -0
  44. package/dist/document-artifact-commands.js +54 -0
  45. package/dist/document-artifact-commands.js.map +1 -0
  46. package/dist/document-artifact-query.d.ts +2 -0
  47. package/dist/document-artifact-query.js +54 -0
  48. package/dist/document-artifact-query.js.map +1 -0
  49. package/dist/editable-artifact-binary.d.ts +56 -0
  50. package/dist/editable-artifact-causal-frontier.d.ts +12 -0
  51. package/dist/editable-artifact-causal-frontier.js +18 -0
  52. package/dist/editable-artifact-causal-frontier.js.map +1 -0
  53. package/dist/editable-artifact-codec-registry.d.ts +48 -0
  54. package/dist/editable-artifact-codec-registry.js +20 -0
  55. package/dist/editable-artifact-codec-registry.js.map +1 -0
  56. package/dist/editable-artifact-committed-transaction.d.ts +35 -0
  57. package/dist/editable-artifact-committed-transaction.js +19 -0
  58. package/dist/editable-artifact-committed-transaction.js.map +1 -0
  59. package/dist/editable-artifact-live.d.ts +276 -0
  60. package/dist/editable-artifact-live.js +907 -0
  61. package/dist/editable-artifact-live.js.map +1 -0
  62. package/dist/editable-artifact-serialized-commit.d.ts +53 -0
  63. package/dist/editable-artifact-serialized-commit.js +26 -0
  64. package/dist/editable-artifact-serialized-commit.js.map +1 -0
  65. package/dist/editable-artifact-versions.d.ts +6 -0
  66. package/dist/editable-artifact-versions.js +11 -0
  67. package/dist/editable-artifact-versions.js.map +1 -0
  68. package/dist/editable-artifacts.d.ts +46 -0
  69. package/dist/editable-artifacts.js +236 -0
  70. package/dist/editable-artifacts.js.map +1 -0
  71. package/dist/event-preview.d.ts +1 -1
  72. package/dist/google-drive.d.ts +114 -2
  73. package/dist/google-drive.js +72 -14
  74. package/dist/google-drive.js.map +1 -1
  75. package/dist/image-generation.d.ts +70 -0
  76. package/dist/index.d.ts +5661 -166
  77. package/dist/index.js +1438 -21
  78. package/dist/interaction.d.ts +8290 -0
  79. package/dist/knowledge.d.ts +543 -0
  80. package/dist/memory-slack-delivery.d.ts +397 -0
  81. package/dist/presentation-artifact-commands.d.ts +349 -0
  82. package/dist/presentation-artifact-commands.js +66 -0
  83. package/dist/presentation-artifact-commands.js.map +1 -0
  84. package/dist/presentation-artifact-query.d.ts +2 -0
  85. package/dist/presentation-artifact-query.js +66 -0
  86. package/dist/presentation-artifact-query.js.map +1 -0
  87. package/dist/retained-output.d.ts +24 -0
  88. package/dist/sandbox-snapshots.d.ts +9 -0
  89. package/dist/scoped-knowledge.d.ts +14 -13
  90. package/dist/slack-bot-scopes.d.ts +4 -0
  91. package/dist/slack-bot-scopes.js +3 -1
  92. package/dist/slack-task-policy.d.ts +294 -0
  93. package/dist/spreadsheet-artifact-commands.d.ts +101 -0
  94. package/dist/spreadsheet-artifact-commands.js +27 -0
  95. package/dist/spreadsheet-artifact-commands.js.map +1 -0
  96. package/dist/spreadsheet-artifact-date.d.ts +4 -0
  97. package/dist/spreadsheet-artifact-query.d.ts +120 -0
  98. package/dist/spreadsheet-artifact-query.js +48 -0
  99. package/dist/spreadsheet-artifact-query.js.map +1 -0
  100. package/dist/task-notes.d.ts +128 -0
  101. package/dist/tool-catalog.d.ts +576 -0
  102. package/dist/video-generation.d.ts +580 -0
  103. package/dist/video-generation.js +59 -0
  104. package/dist/video-generation.js.map +1 -0
  105. package/dist/workspace-learning-policy.d.ts +208 -0
  106. package/dist/xai-provider-account-authority.d.ts +23 -0
  107. package/dist/xai-provider-account-authority.js +9 -0
  108. package/dist/xai-provider-account-authority.js.map +1 -0
  109. package/package.json +73 -1
  110. package/src/artifacts.ts +1 -1
  111. package/src/atlassian.ts +160 -0
  112. package/src/canonical-human-identities.ts +93 -0
  113. package/src/codex-provider-account-authority.ts +37 -0
  114. package/src/company-profile.ts +306 -0
  115. package/src/document-artifact-commands.ts +1709 -0
  116. package/src/document-artifact-query.ts +2 -0
  117. package/src/editable-artifact-binary.ts +396 -0
  118. package/src/editable-artifact-causal-frontier.ts +154 -0
  119. package/src/editable-artifact-codec-registry.ts +261 -0
  120. package/src/editable-artifact-committed-transaction.ts +478 -0
  121. package/src/editable-artifact-live.ts +1379 -0
  122. package/src/editable-artifact-serialized-commit.ts +494 -0
  123. package/src/editable-artifact-versions.ts +8 -0
  124. package/src/editable-artifacts.ts +473 -0
  125. package/src/google-drive.ts +68 -15
  126. package/src/image-generation.ts +106 -0
  127. package/src/index.ts +2920 -326
  128. package/src/interaction.ts +3173 -0
  129. package/src/knowledge.ts +207 -0
  130. package/src/memory-slack-delivery.ts +183 -0
  131. package/src/presentation-artifact-commands.ts +2035 -0
  132. package/src/presentation-artifact-query.ts +2 -0
  133. package/src/retained-output.ts +149 -2
  134. package/src/sandbox-snapshots.ts +28 -1
  135. package/src/scoped-knowledge.ts +18 -4
  136. package/src/slack-bot-scopes.ts +34 -1
  137. package/src/slack-task-policy.ts +215 -0
  138. package/src/spreadsheet-artifact-commands.ts +999 -0
  139. package/src/spreadsheet-artifact-date.ts +21 -0
  140. package/src/spreadsheet-artifact-query.ts +1411 -0
  141. package/src/task-notes.ts +92 -0
  142. package/src/tool-catalog.ts +334 -0
  143. package/src/video-generation.ts +431 -0
  144. package/src/workspace-learning-policy.ts +233 -0
  145. package/src/xai-provider-account-authority.ts +37 -0
  146. package/dist/chunk-5HR2GPSC.js +0 -11031
  147. package/dist/chunk-5HR2GPSC.js.map +0 -1
  148. package/dist/chunk-7JZMI22I.js.map +0 -1
@@ -0,0 +1,207 @@
1
+ import { z } from "zod";
2
+
3
+ export const KNOWLEDGE_BROWSE_CURSOR_MAX_CHARS = 1_024;
4
+ export const KNOWLEDGE_BROWSE_DEFAULT_LIMIT = 20;
5
+ export const KNOWLEDGE_BROWSE_MAX_LIMIT = 50;
6
+ export const KNOWLEDGE_TITLE_MAX_BYTES = 1_024;
7
+ export const KNOWLEDGE_BODY_MAX_BYTES = 16 * 1_024;
8
+ export const KNOWLEDGE_SUMMARY_MAX_BYTES = 4 * 1_024;
9
+ export const KNOWLEDGE_TOPIC_MAX_BYTES = 256;
10
+ export const KNOWLEDGE_TOPICS_MAX_ITEMS = 32;
11
+ export const KNOWLEDGE_METADATA_MAX_BYTES = 8 * 1_024;
12
+ export const KNOWLEDGE_METADATA_MAX_ITEMS = 64;
13
+ export const KNOWLEDGE_METADATA_MAX_DEPTH = 4;
14
+ export const KNOWLEDGE_SOURCE_STRING_MAX_BYTES = 2_048;
15
+ export const KNOWLEDGE_SOURCE_URI_MAX_BYTES = 8_192;
16
+
17
+ const utf8Bytes = (value: string): number => new TextEncoder().encode(value).byteLength;
18
+ const boundedUtf8 = (maxBytes: number) =>
19
+ z.string().superRefine((value, ctx) => {
20
+ if (utf8Bytes(value) > maxBytes) {
21
+ ctx.addIssue({
22
+ code: z.ZodIssueCode.custom,
23
+ message: `must be at most ${maxBytes} UTF-8 bytes`,
24
+ });
25
+ }
26
+ });
27
+
28
+ function boundedJson(value: unknown): boolean {
29
+ let items = 0;
30
+ let valid = true;
31
+ const visit = (candidate: unknown, depth: number): void => {
32
+ if (!valid || ++items > KNOWLEDGE_METADATA_MAX_ITEMS || depth > KNOWLEDGE_METADATA_MAX_DEPTH) {
33
+ valid = false;
34
+ return;
35
+ }
36
+ if (
37
+ candidate === null ||
38
+ typeof candidate === "boolean" ||
39
+ (typeof candidate === "number" && Number.isFinite(candidate))
40
+ ) {
41
+ return;
42
+ }
43
+ if (typeof candidate === "string") {
44
+ if (utf8Bytes(candidate) > KNOWLEDGE_SOURCE_STRING_MAX_BYTES) valid = false;
45
+ return;
46
+ }
47
+ if (Array.isArray(candidate)) {
48
+ for (const item of candidate) visit(item, depth + 1);
49
+ return;
50
+ }
51
+ if (typeof candidate === "object") {
52
+ for (const [key, item] of Object.entries(candidate as Record<string, unknown>)) {
53
+ if (utf8Bytes(key) > KNOWLEDGE_TOPIC_MAX_BYTES) valid = false;
54
+ visit(item, depth + 1);
55
+ }
56
+ return;
57
+ }
58
+ valid = false;
59
+ };
60
+ visit(value, 0);
61
+ if (!valid) return false;
62
+ try {
63
+ return utf8Bytes(JSON.stringify(value)) <= KNOWLEDGE_METADATA_MAX_BYTES;
64
+ } catch {
65
+ return false;
66
+ }
67
+ }
68
+
69
+ export const KnowledgeRecordId = z
70
+ .string()
71
+ .regex(
72
+ /^(document|document_chunk):[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/iu,
73
+ );
74
+ export type KnowledgeRecordId = z.infer<typeof KnowledgeRecordId>;
75
+
76
+ export const KnowledgeRecordKind = z.enum(["document", "document_chunk"]);
77
+ export type KnowledgeRecordKind = z.infer<typeof KnowledgeRecordKind>;
78
+
79
+ export const KnowledgeAuthority = z.object({
80
+ kind: z.enum(["organization", "workspace", "personal"]),
81
+ });
82
+ export type KnowledgeAuthority = z.infer<typeof KnowledgeAuthority>;
83
+
84
+ export const KnowledgeSource = z.object({
85
+ kind: z.enum([
86
+ "manual_upload",
87
+ "meeting_transcript",
88
+ "repository",
89
+ "email",
90
+ "chat",
91
+ "document",
92
+ "web",
93
+ "other",
94
+ ]),
95
+ uri: boundedUtf8(KNOWLEDGE_SOURCE_URI_MAX_BYTES).pipe(z.string().min(1)).nullable(),
96
+ externalId: boundedUtf8(KNOWLEDGE_SOURCE_STRING_MAX_BYTES).nullable(),
97
+ title: boundedUtf8(KNOWLEDGE_SOURCE_STRING_MAX_BYTES).nullable(),
98
+ author: boundedUtf8(KNOWLEDGE_SOURCE_STRING_MAX_BYTES).nullable(),
99
+ createdAt: z.string().nullable(),
100
+ updatedAt: z.string().nullable(),
101
+ version: boundedUtf8(KNOWLEDGE_SOURCE_STRING_MAX_BYTES).nullable(),
102
+ });
103
+ export type KnowledgeSource = z.infer<typeof KnowledgeSource>;
104
+
105
+ export const KnowledgeLinkTarget = z.discriminatedUnion("kind", [
106
+ z.object({
107
+ kind: z.literal("knowledge"),
108
+ id: KnowledgeRecordId,
109
+ }),
110
+ z.object({
111
+ kind: z.literal("external"),
112
+ uri: boundedUtf8(KNOWLEDGE_SOURCE_URI_MAX_BYTES).pipe(z.string().min(1)),
113
+ }),
114
+ ]);
115
+ export type KnowledgeLinkTarget = z.infer<typeof KnowledgeLinkTarget>;
116
+
117
+ export const KnowledgeLink = z.object({
118
+ relation: z.enum(["parent", "contents", "previous", "next", "source"]),
119
+ target: KnowledgeLinkTarget,
120
+ });
121
+ export type KnowledgeLink = z.infer<typeof KnowledgeLink>;
122
+
123
+ /**
124
+ * Permission-safe agent projection over one flexible knowledge record. Scope,
125
+ * provenance, lifecycle, and stable identity are strict. The body and metadata
126
+ * stay source-shaped so varied company knowledge does not require one rigid
127
+ * taxonomy. Personal subject ids and inaccessible linked-record metadata are
128
+ * deliberately absent.
129
+ */
130
+ export const KnowledgeRecord = z.object({
131
+ id: KnowledgeRecordId,
132
+ kind: KnowledgeRecordKind,
133
+ title: boundedUtf8(KNOWLEDGE_TITLE_MAX_BYTES),
134
+ content: z.object({
135
+ format: z.literal("markdown"),
136
+ body: boundedUtf8(KNOWLEDGE_BODY_MAX_BYTES).nullable(),
137
+ summary: boundedUtf8(KNOWLEDGE_SUMMARY_MAX_BYTES).nullable(),
138
+ topics: z.array(boundedUtf8(KNOWLEDGE_TOPIC_MAX_BYTES)).max(KNOWLEDGE_TOPICS_MAX_ITEMS),
139
+ metadata: z.record(z.string(), z.unknown()).refine(boundedJson, {
140
+ message: "knowledge metadata exceeds its JSON projection boundary",
141
+ }),
142
+ }),
143
+ authority: KnowledgeAuthority,
144
+ provenance: z.object({
145
+ source: KnowledgeSource,
146
+ indexedAt: z.string(),
147
+ }),
148
+ lifecycle: z.object({
149
+ state: z.literal("active"),
150
+ updatedAt: z.string(),
151
+ }),
152
+ quality: z.object({
153
+ trust: z.literal("sourced"),
154
+ freshnessAt: z.string(),
155
+ conflict: z.literal("not_evaluated"),
156
+ correction: z.literal("current_source_version"),
157
+ }),
158
+ links: z.array(KnowledgeLink).max(8),
159
+ projection: z.object({
160
+ truncated: z.boolean(),
161
+ fields: z
162
+ .array(
163
+ z.enum([
164
+ "title",
165
+ "content.body",
166
+ "content.summary",
167
+ "content.topics",
168
+ "content.metadata",
169
+ "provenance.source.uri",
170
+ "provenance.source.externalId",
171
+ "provenance.source.title",
172
+ "provenance.source.author",
173
+ "provenance.source.version",
174
+ ]),
175
+ )
176
+ .max(10),
177
+ }),
178
+ });
179
+ export type KnowledgeRecord = z.infer<typeof KnowledgeRecord>;
180
+
181
+ export const KnowledgeSearchResult = z.object({
182
+ record: KnowledgeRecord,
183
+ retrieval: z.object({
184
+ score: z.number(),
185
+ matchType: z.enum(["hybrid", "vector", "keyword"]),
186
+ vectorScore: z.number().nullable(),
187
+ keywordScore: z.number().nullable(),
188
+ }),
189
+ });
190
+ export type KnowledgeSearchResult = z.infer<typeof KnowledgeSearchResult>;
191
+
192
+ export const KnowledgeSearchResponse = z.object({
193
+ results: z.array(KnowledgeSearchResult),
194
+ });
195
+ export type KnowledgeSearchResponse = z.infer<typeof KnowledgeSearchResponse>;
196
+
197
+ export const KnowledgeGetResponse = z.object({
198
+ record: KnowledgeRecord,
199
+ });
200
+ export type KnowledgeGetResponse = z.infer<typeof KnowledgeGetResponse>;
201
+
202
+ export const KnowledgeBrowseResponse = z.object({
203
+ records: z.array(KnowledgeRecord),
204
+ nextCursor: z.string().min(1).max(KNOWLEDGE_BROWSE_CURSOR_MAX_CHARS).nullable(),
205
+ hasMore: z.boolean(),
206
+ });
207
+ export type KnowledgeBrowseResponse = z.infer<typeof KnowledgeBrowseResponse>;
@@ -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
+ >;