@wayai/cli 0.3.255 → 0.3.257

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.
package/dist/index.js CHANGED
@@ -16,44 +16,44 @@ var __export = (target, all) => {
16
16
  };
17
17
 
18
18
  // src/lib/mask-secrets.ts
19
- function valueEnd(text3, from, isEnd) {
20
- for (let i = from; i < text3.length; i++) {
21
- if (text3[i] === "\\") {
19
+ function valueEnd(text4, from, isEnd) {
20
+ for (let i = from; i < text4.length; i++) {
21
+ if (text4[i] === "\\") {
22
22
  i++;
23
23
  continue;
24
24
  }
25
- if (isEnd(text3[i])) return i;
25
+ if (isEnd(text4[i])) return i;
26
26
  }
27
- return text3.length;
27
+ return text4.length;
28
28
  }
29
- function maskCredentialValues(text3, keyRe, resolveValueEnd) {
29
+ function maskCredentialValues(text4, keyRe, resolveValueEnd) {
30
30
  keyRe.lastIndex = 0;
31
31
  let out = "";
32
32
  let copied = 0;
33
33
  let match;
34
- while ((match = keyRe.exec(text3)) !== null) {
34
+ while ((match = keyRe.exec(text4)) !== null) {
35
35
  const valueStart = match.index + match[0].length;
36
36
  keyRe.lastIndex = valueStart;
37
37
  if (!isCredentialKey(match[1])) continue;
38
- const end = resolveValueEnd(text3, valueStart);
39
- const value = text3.slice(valueStart, end);
38
+ const end = resolveValueEnd(text4, valueStart);
39
+ const value = text4.slice(valueStart, end);
40
40
  if (value.length === 0 || FULLY_MASKED_VALUE_RE.test(value)) continue;
41
- out += text3.slice(copied, valueStart) + "[REDACTED]";
41
+ out += text4.slice(copied, valueStart) + "[REDACTED]";
42
42
  copied = end;
43
43
  keyRe.lastIndex = end;
44
44
  }
45
- return out + text3.slice(copied);
45
+ return out + text4.slice(copied);
46
46
  }
47
- function maskJwts(text3) {
47
+ function maskJwts(text4) {
48
48
  let out = "";
49
49
  let copied = 0;
50
50
  let cursor = 0;
51
- while (cursor < text3.length) {
52
- while (cursor < text3.length && !isBase64UrlChar(text3[cursor])) cursor++;
51
+ while (cursor < text4.length) {
52
+ while (cursor < text4.length && !isBase64UrlChar(text4[cursor])) cursor++;
53
53
  const headerStart = cursor;
54
54
  let tokenStart = -1;
55
- while (cursor < text3.length && isBase64UrlChar(text3[cursor])) {
56
- if (tokenStart < 0 && text3[cursor] === "e" && text3[cursor + 1] === "y" && text3[cursor + 2] === "J") {
55
+ while (cursor < text4.length && isBase64UrlChar(text4[cursor])) {
56
+ if (tokenStart < 0 && text4[cursor] === "e" && text4[cursor + 1] === "y" && text4[cursor + 2] === "J") {
57
57
  tokenStart = cursor;
58
58
  }
59
59
  cursor++;
@@ -61,28 +61,28 @@ function maskJwts(text3) {
61
61
  const headerEnd = cursor;
62
62
  if (headerStart === headerEnd) continue;
63
63
  const hasJwtHeader = tokenStart >= headerStart && tokenStart + 3 < headerEnd;
64
- if (!hasJwtHeader || text3[headerEnd] !== ".") continue;
64
+ if (!hasJwtHeader || text4[headerEnd] !== ".") continue;
65
65
  const payloadStart = headerEnd + 1;
66
66
  cursor = payloadStart;
67
- while (cursor < text3.length && isBase64UrlChar(text3[cursor])) cursor++;
67
+ while (cursor < text4.length && isBase64UrlChar(text4[cursor])) cursor++;
68
68
  const payloadEnd = cursor;
69
- if (payloadEnd === payloadStart || text3[payloadEnd] !== ".") continue;
69
+ if (payloadEnd === payloadStart || text4[payloadEnd] !== ".") continue;
70
70
  const signatureStart = payloadEnd + 1;
71
71
  cursor = signatureStart;
72
- while (cursor < text3.length && isBase64UrlChar(text3[cursor])) cursor++;
72
+ while (cursor < text4.length && isBase64UrlChar(text4[cursor])) cursor++;
73
73
  if (cursor === signatureStart) continue;
74
- out += text3.slice(copied, tokenStart) + "[REDACTED_JWT]";
74
+ out += text4.slice(copied, tokenStart) + "[REDACTED_JWT]";
75
75
  copied = cursor;
76
76
  }
77
- return out + text3.slice(copied);
77
+ return out + text4.slice(copied);
78
78
  }
79
- function jsonContainerEnd(text3, from) {
80
- const opener = text3[from];
79
+ function jsonContainerEnd(text4, from) {
80
+ const opener = text4[from];
81
81
  if (opener !== "{" && opener !== "[") return null;
82
82
  const stack = [opener];
83
83
  let inString = false;
84
- for (let i = from + 1; i < text3.length; i++) {
85
- const char = text3[i];
84
+ for (let i = from + 1; i < text4.length; i++) {
85
+ const char = text4[i];
86
86
  if (inString) {
87
87
  if (char === "\\") {
88
88
  i++;
@@ -103,62 +103,62 @@ function jsonContainerEnd(text3, from) {
103
103
  }
104
104
  return null;
105
105
  }
106
- function jsonNumberEnd(text3, from) {
107
- const match = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(text3.slice(from));
106
+ function jsonNumberEnd(text4, from) {
107
+ const match = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?/.exec(text4.slice(from));
108
108
  if (!match) return null;
109
109
  const end = from + match[0].length;
110
110
  let next = end;
111
- while (next < text3.length && /\s/.test(text3[next])) next++;
112
- return next === text3.length || text3[next] === "," || text3[next] === "}" || text3[next] === "]" ? end : null;
111
+ while (next < text4.length && /\s/.test(text4[next])) next++;
112
+ return next === text4.length || text4[next] === "," || text4[next] === "}" || text4[next] === "]" ? end : null;
113
113
  }
114
- function maskJsonCredentialValues(text3) {
114
+ function maskJsonCredentialValues(text4) {
115
115
  JSON_KEY_RE.lastIndex = 0;
116
116
  let out = "";
117
117
  let copied = 0;
118
118
  let match;
119
- while ((match = JSON_KEY_RE.exec(text3)) !== null) {
119
+ while ((match = JSON_KEY_RE.exec(text4)) !== null) {
120
120
  const valueStart = match.index + match[0].length;
121
121
  JSON_KEY_RE.lastIndex = valueStart;
122
122
  const key = match[1];
123
123
  const isNumericCredentialKey = NUMERIC_CREDENTIAL_KEY_RE.test(key);
124
124
  if (!isCredentialKey(key) && !isNumericCredentialKey) continue;
125
- if (text3[valueStart] === '"') {
125
+ if (text4[valueStart] === '"') {
126
126
  const contentStart = valueStart + 1;
127
- const end = valueEnd(text3, contentStart, isJsonValueEnd);
128
- const value = text3.slice(contentStart, end);
127
+ const end = valueEnd(text4, contentStart, isJsonValueEnd);
128
+ const value = text4.slice(contentStart, end);
129
129
  if (value.length === 0 || FULLY_MASKED_VALUE_RE.test(value)) continue;
130
- out += text3.slice(copied, contentStart) + "[REDACTED]";
130
+ out += text4.slice(copied, contentStart) + "[REDACTED]";
131
131
  copied = end;
132
132
  JSON_KEY_RE.lastIndex = end;
133
133
  continue;
134
134
  }
135
- if (text3[valueStart] === "{" || text3[valueStart] === "[") {
136
- const end = jsonContainerEnd(text3, valueStart) ?? text3.length;
137
- out += text3.slice(copied, valueStart) + '"[REDACTED]"';
135
+ if (text4[valueStart] === "{" || text4[valueStart] === "[") {
136
+ const end = jsonContainerEnd(text4, valueStart) ?? text4.length;
137
+ out += text4.slice(copied, valueStart) + '"[REDACTED]"';
138
138
  copied = end;
139
139
  JSON_KEY_RE.lastIndex = end;
140
140
  continue;
141
141
  }
142
142
  if (isNumericCredentialKey) {
143
- const end = jsonNumberEnd(text3, valueStart);
143
+ const end = jsonNumberEnd(text4, valueStart);
144
144
  if (end !== null) {
145
- out += text3.slice(copied, valueStart) + '"[REDACTED]"';
145
+ out += text4.slice(copied, valueStart) + '"[REDACTED]"';
146
146
  copied = end;
147
147
  JSON_KEY_RE.lastIndex = end;
148
148
  }
149
149
  }
150
150
  }
151
- return out + text3.slice(copied);
151
+ return out + text4.slice(copied);
152
152
  }
153
- function headerValueEnd(text3, from) {
154
- for (let i = from; i < text3.length; i++) {
155
- const char = text3[i];
153
+ function headerValueEnd(text4, from) {
154
+ for (let i = from; i < text4.length; i++) {
155
+ const char = text4[i];
156
156
  if (char === "\r" || char === "\n") return i;
157
157
  if (char === "\\") {
158
158
  let afterSlashes = i;
159
- while (text3[afterSlashes] === "\\") afterSlashes++;
159
+ while (text4[afterSlashes] === "\\") afterSlashes++;
160
160
  const slashCount = afterSlashes - i;
161
- if (slashCount % 2 === 1 && (text3[afterSlashes] === "r" || text3[afterSlashes] === "n")) {
161
+ if (slashCount % 2 === 1 && (text4[afterSlashes] === "r" || text4[afterSlashes] === "n")) {
162
162
  return i;
163
163
  }
164
164
  if (slashCount % 2 === 1) afterSlashes++;
@@ -167,16 +167,16 @@ function headerValueEnd(text3, from) {
167
167
  }
168
168
  if (char === '"') {
169
169
  let next = i + 1;
170
- while (next < text3.length && /\s/.test(text3[next])) next++;
171
- if (next === text3.length || text3[next] === "," || text3[next] === "}" || text3[next] === "]") {
170
+ while (next < text4.length && /\s/.test(text4[next])) next++;
171
+ if (next === text4.length || text4[next] === "," || text4[next] === "}" || text4[next] === "]") {
172
172
  return i;
173
173
  }
174
174
  }
175
175
  }
176
- return text3.length;
176
+ return text4.length;
177
177
  }
178
- function isSerializedJsonContainer(text3) {
179
- const trimmed = text3.trim();
178
+ function isSerializedJsonContainer(text4) {
179
+ const trimmed = text4.trim();
180
180
  if (trimmed[0] !== "{" && trimmed[0] !== "[") return false;
181
181
  try {
182
182
  const parsed = JSON.parse(trimmed);
@@ -185,21 +185,21 @@ function isSerializedJsonContainer(text3) {
185
185
  return false;
186
186
  }
187
187
  }
188
- function maskNestedJsonStringValues(text3, depth) {
188
+ function maskNestedJsonStringValues(text4, depth) {
189
189
  let out = "";
190
190
  let copied = 0;
191
- for (let i = 0; i < text3.length; i++) {
192
- if (text3[i] !== '"') continue;
191
+ for (let i = 0; i < text4.length; i++) {
192
+ if (text4[i] !== '"') continue;
193
193
  const contentStart = i + 1;
194
- const end = valueEnd(text3, contentStart, isJsonValueEnd);
195
- if (end === text3.length) break;
194
+ const end = valueEnd(text4, contentStart, isJsonValueEnd);
195
+ if (end === text4.length) break;
196
196
  let next = end + 1;
197
- while (next < text3.length && /\s/.test(text3[next])) next++;
198
- if (text3[next] === ":") {
197
+ while (next < text4.length && /\s/.test(text4[next])) next++;
198
+ if (text4[next] === ":") {
199
199
  i = end;
200
200
  continue;
201
201
  }
202
- const encoded = text3.slice(contentStart, end);
202
+ const encoded = text4.slice(contentStart, end);
203
203
  let decoded;
204
204
  try {
205
205
  decoded = JSON.parse(`"${encoded}"`);
@@ -210,15 +210,15 @@ function maskNestedJsonStringValues(text3, depth) {
210
210
  const masked = depth >= MAX_NESTED_JSON_STRING_DEPTH && isSerializedJsonContainer(decoded) ? "[REDACTED]" : maskSecretsInMessageAtDepth(decoded, depth + 1);
211
211
  if (masked !== decoded) {
212
212
  const reencoded = JSON.stringify(masked).slice(1, -1);
213
- out += text3.slice(copied, contentStart) + reencoded;
213
+ out += text4.slice(copied, contentStart) + reencoded;
214
214
  copied = end;
215
215
  }
216
216
  i = end;
217
217
  }
218
- return out + text3.slice(copied);
218
+ return out + text4.slice(copied);
219
219
  }
220
- function maskSecretsInMessageAtDepth(text3, depth) {
221
- let out = maskJwts(text3);
220
+ function maskSecretsInMessageAtDepth(text4, depth) {
221
+ let out = maskJwts(text4);
222
222
  for (const [pattern, replacement] of SHAPE_PATTERNS) out = out.replace(pattern, replacement);
223
223
  out = out.replace(BASIC_CREDENTIAL_RE, maskBasicCredential);
224
224
  out = maskJsonCredentialValues(out);
@@ -227,8 +227,8 @@ function maskSecretsInMessageAtDepth(text3, depth) {
227
227
  out = maskCredentialValues(out, HEADER_KEY_RE, headerValueEnd);
228
228
  return out.replace(BASE64_RE, maskBase64);
229
229
  }
230
- function maskSecretsInMessage(text3) {
231
- return maskSecretsInMessageAtDepth(text3, 0);
230
+ function maskSecretsInMessage(text4) {
231
+ return maskSecretsInMessageAtDepth(text4, 0);
232
232
  }
233
233
  var CREDENTIAL_KEY_RE, NUMERIC_CREDENTIAL_KEY_RE, FULLY_MASKED_VALUE_RE, isCredentialKey, isBase64UrlChar, SHAPE_PATTERNS, BASIC_CREDENTIAL_RE, maskBasicCredential, JSON_KEY_RE, isJsonValueEnd, QUERY_KEY_RE, isQueryValueEnd, queryValueEnd, HEADER_KEY_RE, BASE64_RE, maskBase64, MAX_NESTED_JSON_STRING_DEPTH;
234
234
  var init_mask_secrets = __esm({
@@ -287,7 +287,7 @@ var init_mask_secrets = __esm({
287
287
  isJsonValueEnd = (char) => char === '"';
288
288
  QUERY_KEY_RE = /(?:^|[?#&;,\s"'])([A-Za-z0-9_.-]+)=/g;
289
289
  isQueryValueEnd = (char) => char === "&" || char === ";" || char === '"' || /\s/.test(char);
290
- queryValueEnd = (text3, from) => valueEnd(text3, from, isQueryValueEnd);
290
+ queryValueEnd = (text4, from) => valueEnd(text4, from, isQueryValueEnd);
291
291
  HEADER_KEY_RE = /(?:^|[^A-Za-z0-9_.\/\\-])([A-Za-z0-9_.-]+):[ \t]*/g;
292
292
  BASE64_RE = // Padded base64 bodies (wrapped DEKs, HMAC secrets, service-account material)
293
293
  // appearing outside any credential-named key — the shape the rules above miss.
@@ -4888,6 +4888,99 @@ var init_fs_safety = __esm({
4888
4888
  }
4889
4889
  });
4890
4890
 
4891
+ // ../../packages/core/dist/chunk-YVY2TZK2.js
4892
+ var orgResourceIdParam, orgResourceFileIdParam, orgResourceFolderIdParam, hubOrgResourceParam, listOrgResourcesQuery, orgIdQuery, createOrgResourceBody, updateOrgResourceBody, createOrgResourceFolderBody, updateOrgResourceFolderBody, uploadOrgResourceFileBody, updateOrgResourceFileBody, uploadOrgSkillZipBody, linkOrgResourceBody;
4893
+ var init_chunk_YVY2TZK2 = __esm({
4894
+ "../../packages/core/dist/chunk-YVY2TZK2.js"() {
4895
+ "use strict";
4896
+ init_zod();
4897
+ orgResourceIdParam = external_exports.object({
4898
+ id: external_exports.string().uuid()
4899
+ });
4900
+ orgResourceFileIdParam = external_exports.object({
4901
+ file_id: external_exports.string().uuid()
4902
+ });
4903
+ orgResourceFolderIdParam = external_exports.object({
4904
+ folder_id: external_exports.string().uuid()
4905
+ });
4906
+ hubOrgResourceParam = external_exports.object({
4907
+ id: external_exports.string().uuid(),
4908
+ org_resource_id: external_exports.string().uuid()
4909
+ });
4910
+ listOrgResourcesQuery = external_exports.object({
4911
+ organization_id: external_exports.string().uuid(),
4912
+ hub_id: external_exports.string().uuid().optional()
4913
+ });
4914
+ orgIdQuery = external_exports.object({
4915
+ organization_id: external_exports.string().uuid()
4916
+ });
4917
+ createOrgResourceBody = external_exports.object({
4918
+ organization_id: external_exports.string().uuid(),
4919
+ resource_name: external_exports.string().min(1).max(255),
4920
+ resource_description: external_exports.string().max(1e3).nullish(),
4921
+ // Required (validated in the route layer, which names the field, since a refinement here
4922
+ // complicates the inferred input type for callers).
4923
+ skill_name: external_exports.string().min(1).max(255).nullish(),
4924
+ skill_version: external_exports.string().max(50).nullish(),
4925
+ enabled: external_exports.boolean().optional(),
4926
+ tags: external_exports.array(external_exports.string().uuid()).optional(),
4927
+ environment: external_exports.enum(["preview", "production", "all"]).optional()
4928
+ });
4929
+ updateOrgResourceBody = external_exports.object({
4930
+ resource_name: external_exports.string().min(1).max(255).optional(),
4931
+ resource_description: external_exports.string().max(1e3).nullish(),
4932
+ skill_name: external_exports.string().min(1).max(255).nullish(),
4933
+ skill_version: external_exports.string().max(50).nullish(),
4934
+ enabled: external_exports.boolean().optional(),
4935
+ tags: external_exports.array(external_exports.string().uuid()).optional(),
4936
+ environment: external_exports.enum(["preview", "production", "all"]).optional()
4937
+ });
4938
+ createOrgResourceFolderBody = external_exports.object({
4939
+ org_resource_id: external_exports.string().uuid(),
4940
+ folder_name: external_exports.string().min(1).max(255),
4941
+ folder_description: external_exports.string().max(1e3).nullish(),
4942
+ parent_folder_id: external_exports.string().uuid().nullish(),
4943
+ order_index: external_exports.number().int().nonnegative().optional(),
4944
+ enabled: external_exports.boolean().optional(),
4945
+ metadata: external_exports.record(external_exports.unknown()).optional()
4946
+ });
4947
+ updateOrgResourceFolderBody = external_exports.object({
4948
+ folder_name: external_exports.string().min(1).max(255).optional(),
4949
+ folder_description: external_exports.string().max(1e3).nullish(),
4950
+ parent_folder_id: external_exports.string().uuid().nullish(),
4951
+ order_index: external_exports.number().int().nonnegative().optional(),
4952
+ enabled: external_exports.boolean().optional(),
4953
+ metadata: external_exports.record(external_exports.unknown()).optional()
4954
+ });
4955
+ uploadOrgResourceFileBody = external_exports.object({
4956
+ org_resource_id: external_exports.string().uuid(),
4957
+ folder_id: external_exports.string().uuid().nullish(),
4958
+ file_name: external_exports.string().min(1).max(255),
4959
+ file_data: external_exports.string(),
4960
+ // base64
4961
+ mime_type: external_exports.string().optional(),
4962
+ file_size: external_exports.number().int().nonnegative().optional(),
4963
+ resource_file_tags: external_exports.array(external_exports.string()).optional(),
4964
+ metadata: external_exports.record(external_exports.unknown()).optional()
4965
+ });
4966
+ updateOrgResourceFileBody = external_exports.object({
4967
+ resource_file_title: external_exports.string().min(1).max(255).optional(),
4968
+ folder_id: external_exports.string().uuid().nullish(),
4969
+ order_index: external_exports.number().int().nonnegative().optional(),
4970
+ enabled: external_exports.boolean().optional(),
4971
+ resource_file_tags: external_exports.array(external_exports.string()).optional(),
4972
+ metadata: external_exports.record(external_exports.unknown()).optional()
4973
+ });
4974
+ uploadOrgSkillZipBody = external_exports.object({
4975
+ zip_data: external_exports.string().min(1),
4976
+ replace_existing: external_exports.boolean().optional()
4977
+ });
4978
+ linkOrgResourceBody = external_exports.object({
4979
+ org_resource_id: external_exports.string().uuid()
4980
+ });
4981
+ }
4982
+ });
4983
+
4891
4984
  // ../../packages/core/dist/chunk-VXEAR36B.js
4892
4985
  var orgTagIdParam, listOrgTagsQuery, ORG_TAG_NAME_REGEX, ORG_TAG_NAME_MAX_LENGTH, createOrgTagBody, updateOrgTagBody;
4893
4986
  var init_chunk_VXEAR36B = __esm({
@@ -5170,6 +5263,113 @@ var init_chunk_Q7KIQHAZ = __esm({
5170
5263
  }
5171
5264
  });
5172
5265
 
5266
+ // ../../packages/core/dist/chunk-MIWZOSPI.js
5267
+ function toIso(epochMs) {
5268
+ return new Date(epochMs).toISOString();
5269
+ }
5270
+ function fromIso(iso) {
5271
+ return new Date(iso).getTime();
5272
+ }
5273
+ function isIsoTimestamp(value) {
5274
+ return typeof value === "string" && ISO_UTC_RE.test(value);
5275
+ }
5276
+ var ISO_UTC_RE;
5277
+ var init_chunk_MIWZOSPI = __esm({
5278
+ "../../packages/core/dist/chunk-MIWZOSPI.js"() {
5279
+ "use strict";
5280
+ ISO_UTC_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
5281
+ }
5282
+ });
5283
+
5284
+ // ../../packages/core/dist/chunk-MF2VVXBR.js
5285
+ var credentialExpiresAtSchema, LINKED_EXPIRY_REFUSAL;
5286
+ var init_chunk_MF2VVXBR = __esm({
5287
+ "../../packages/core/dist/chunk-MF2VVXBR.js"() {
5288
+ "use strict";
5289
+ init_chunk_HZ6CADSY();
5290
+ init_chunk_MIWZOSPI();
5291
+ credentialExpiresAtSchema = timestampSchema.refine(isIsoTimestamp, "Expected a canonical ISO timestamp").nullable();
5292
+ LINKED_EXPIRY_REFUSAL = "A linked organization credential's expiry is set on the credential";
5293
+ }
5294
+ });
5295
+
5296
+ // ../../packages/core/dist/chunk-HA7CRZMX.js
5297
+ var connectionIdParam, connectorIdParam, listConnectionsQuery, deleteConnectionQuery, addConnectionBody, editConnectionBody, PRODUCTION_DIRECT_FIELDS, BESIDE_LINK_FIELDS, setProductionCredentialBody, registerWhatsappQuery, registerWhatsappBody, retryProvisioningQuery, resendDomainStatusQuery;
5298
+ var init_chunk_HA7CRZMX = __esm({
5299
+ "../../packages/core/dist/chunk-HA7CRZMX.js"() {
5300
+ "use strict";
5301
+ init_chunk_MF2VVXBR();
5302
+ init_chunk_HZ6CADSY();
5303
+ init_zod();
5304
+ connectionIdParam = external_exports.object({ id: uuidSchema });
5305
+ connectorIdParam = external_exports.object({ id: uuidSchema });
5306
+ listConnectionsQuery = external_exports.object({ hub_id: uuidSchema });
5307
+ deleteConnectionQuery = external_exports.object({ hub_id: uuidSchema });
5308
+ addConnectionBody = external_exports.object({
5309
+ hub_id: uuidSchema,
5310
+ connector_id: uuidSchema,
5311
+ authentication_type: external_exports.string().optional(),
5312
+ inbound_mode: external_exports.enum(["wayai", "resend"]).optional(),
5313
+ inbound_address: external_exports.string().email().optional(),
5314
+ // Opt out of copying this connection's credentials into production on publish/sync.
5315
+ // Defaults to true at the DB layer.
5316
+ sync_credentials_to_production: external_exports.boolean().optional(),
5317
+ // When the connection's own secret expires; null for none (`credential-expiry.ts`).
5318
+ expires_at: credentialExpiresAtSchema.optional()
5319
+ }).passthrough().superRefine((data, ctx) => {
5320
+ if (data.inbound_mode === "resend" && !data.inbound_address) {
5321
+ ctx.addIssue({
5322
+ code: external_exports.ZodIssueCode.custom,
5323
+ message: "Receiving email address is required when using Resend inbound mode",
5324
+ path: ["inbound_address"]
5325
+ });
5326
+ }
5327
+ });
5328
+ editConnectionBody = external_exports.object({
5329
+ hub_id: uuidSchema,
5330
+ sync_credentials_to_production: external_exports.boolean().optional(),
5331
+ expires_at: credentialExpiresAtSchema.optional()
5332
+ }).passthrough();
5333
+ PRODUCTION_DIRECT_FIELDS = ["username", "api_key", "access_token", "password", "refresh_token", "webhook_secret_token", "webhook_signing_secret", "github_app_id", "github_app_private_key"];
5334
+ BESIDE_LINK_FIELDS = /* @__PURE__ */ new Set(["webhook_secret_token", "github_app_id", "github_app_private_key"]);
5335
+ setProductionCredentialBody = external_exports.object({
5336
+ hub_id: uuidSchema,
5337
+ organization_credential_id: external_exports.string().nullable().optional(),
5338
+ organization_credential_token_id: external_exports.string().nullable().optional(),
5339
+ username: external_exports.string().optional(),
5340
+ api_key: external_exports.string().optional(),
5341
+ access_token: external_exports.string().optional(),
5342
+ password: external_exports.string().optional(),
5343
+ refresh_token: external_exports.string().optional(),
5344
+ webhook_secret_token: external_exports.string().optional(),
5345
+ webhook_signing_secret: external_exports.string().optional(),
5346
+ github_app_id: external_exports.string().optional(),
5347
+ github_app_private_key: external_exports.string().optional(),
5348
+ expires_at: credentialExpiresAtSchema.optional()
5349
+ }).strict().superRefine((data, ctx) => {
5350
+ const hasOrgLink = !!data.organization_credential_id || !!data.organization_credential_token_id;
5351
+ const sets = (f) => data[f] != null && data[f] !== `__USE_EXISTING_${f.toUpperCase()}__`;
5352
+ const hasDirect = PRODUCTION_DIRECT_FIELDS.some(sets);
5353
+ const hasDirectBesideLink = PRODUCTION_DIRECT_FIELDS.some((f) => !BESIDE_LINK_FIELDS.has(f) && sets(f));
5354
+ if (hasOrgLink && hasDirectBesideLink) {
5355
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Provide either an organization credential link or direct credential fields, not both" });
5356
+ }
5357
+ if (hasOrgLink && data.expires_at != null) {
5358
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: LINKED_EXPIRY_REFUSAL, path: ["expires_at"] });
5359
+ }
5360
+ if (!hasOrgLink && !hasDirect && data.expires_at === void 0) {
5361
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "A credential is required: link an organization credential or provide a credential field" });
5362
+ }
5363
+ });
5364
+ registerWhatsappQuery = external_exports.object({ hub_id: uuidSchema });
5365
+ registerWhatsappBody = external_exports.object({
5366
+ pin: external_exports.string().optional()
5367
+ });
5368
+ retryProvisioningQuery = external_exports.object({ hub_id: uuidSchema });
5369
+ resendDomainStatusQuery = external_exports.object({ hub_id: uuidSchema });
5370
+ }
5371
+ });
5372
+
5173
5373
  // ../../packages/core/dist/chunk-IPXBFWUU.js
5174
5374
  var variantAiModeSchema, experimentStatusSchema, overlayUpdateSchema, experimentIdParam, variantIdParam, listExperimentsQuery, listVariantsQuery, listOverridesQuery, deleteOverrideQuery, createExperimentBody, updateExperimentBody, setExperimentStatusBody, createVariantBody, updateVariantBody, upsertOverrideBody;
5175
5375
  var init_chunk_IPXBFWUU = __esm({
@@ -5275,36 +5475,6 @@ var init_chunk_NKLVUTFO = __esm({
5275
5475
  }
5276
5476
  });
5277
5477
 
5278
- // ../../packages/core/dist/chunk-MIWZOSPI.js
5279
- function toIso(epochMs) {
5280
- return new Date(epochMs).toISOString();
5281
- }
5282
- function fromIso(iso) {
5283
- return new Date(iso).getTime();
5284
- }
5285
- function isIsoTimestamp(value) {
5286
- return typeof value === "string" && ISO_UTC_RE.test(value);
5287
- }
5288
- var ISO_UTC_RE;
5289
- var init_chunk_MIWZOSPI = __esm({
5290
- "../../packages/core/dist/chunk-MIWZOSPI.js"() {
5291
- "use strict";
5292
- ISO_UTC_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
5293
- }
5294
- });
5295
-
5296
- // ../../packages/core/dist/chunk-MF2VVXBR.js
5297
- var credentialExpiresAtSchema, LINKED_EXPIRY_REFUSAL;
5298
- var init_chunk_MF2VVXBR = __esm({
5299
- "../../packages/core/dist/chunk-MF2VVXBR.js"() {
5300
- "use strict";
5301
- init_chunk_HZ6CADSY();
5302
- init_chunk_MIWZOSPI();
5303
- credentialExpiresAtSchema = timestampSchema.refine(isIsoTimestamp, "Expected a canonical ISO timestamp").nullable();
5304
- LINKED_EXPIRY_REFUSAL = "A linked organization credential's expiry is set on the credential";
5305
- }
5306
- });
5307
-
5308
5478
  // ../../packages/core/dist/chunk-YROEDMVZ.js
5309
5479
  function normalizeAuthType(raw) {
5310
5480
  if (VALID_AUTH_TYPES.has(raw)) return raw;
@@ -5428,95 +5598,72 @@ var init_chunk_WL5QGKHN = __esm({
5428
5598
  }
5429
5599
  });
5430
5600
 
5431
- // ../../packages/core/dist/chunk-YVY2TZK2.js
5432
- var orgResourceIdParam, orgResourceFileIdParam, orgResourceFolderIdParam, hubOrgResourceParam, listOrgResourcesQuery, orgIdQuery, createOrgResourceBody, updateOrgResourceBody, createOrgResourceFolderBody, updateOrgResourceFolderBody, uploadOrgResourceFileBody, updateOrgResourceFileBody, uploadOrgSkillZipBody, linkOrgResourceBody;
5433
- var init_chunk_YVY2TZK2 = __esm({
5434
- "../../packages/core/dist/chunk-YVY2TZK2.js"() {
5601
+ // ../../packages/core/dist/chunk-ZC6YGHNX.js
5602
+ var updateUserBody, updateProfileBody, pathnameRegex, updatePreferencesBody, registerPushTokenBody, deletePushTokenQuery, recordAiDisclosureAcceptanceBody, activityQuery, deletionModeSchema, deletionRequestBody;
5603
+ var init_chunk_ZC6YGHNX = __esm({
5604
+ "../../packages/core/dist/chunk-ZC6YGHNX.js"() {
5435
5605
  "use strict";
5436
5606
  init_zod();
5437
- orgResourceIdParam = external_exports.object({
5438
- id: external_exports.string().uuid()
5439
- });
5440
- orgResourceFileIdParam = external_exports.object({
5441
- file_id: external_exports.string().uuid()
5442
- });
5443
- orgResourceFolderIdParam = external_exports.object({
5444
- folder_id: external_exports.string().uuid()
5445
- });
5446
- hubOrgResourceParam = external_exports.object({
5447
- id: external_exports.string().uuid(),
5448
- org_resource_id: external_exports.string().uuid()
5449
- });
5450
- listOrgResourcesQuery = external_exports.object({
5451
- organization_id: external_exports.string().uuid(),
5452
- hub_id: external_exports.string().uuid().optional()
5453
- });
5454
- orgIdQuery = external_exports.object({
5455
- organization_id: external_exports.string().uuid()
5456
- });
5457
- createOrgResourceBody = external_exports.object({
5458
- organization_id: external_exports.string().uuid(),
5459
- resource_name: external_exports.string().min(1).max(255),
5460
- resource_description: external_exports.string().max(1e3).nullish(),
5461
- // Required (validated in the route layer, which names the field, since a refinement here
5462
- // complicates the inferred input type for callers).
5463
- skill_name: external_exports.string().min(1).max(255).nullish(),
5464
- skill_version: external_exports.string().max(50).nullish(),
5465
- enabled: external_exports.boolean().optional(),
5466
- tags: external_exports.array(external_exports.string().uuid()).optional(),
5467
- environment: external_exports.enum(["preview", "production", "all"]).optional()
5468
- });
5469
- updateOrgResourceBody = external_exports.object({
5470
- resource_name: external_exports.string().min(1).max(255).optional(),
5471
- resource_description: external_exports.string().max(1e3).nullish(),
5472
- skill_name: external_exports.string().min(1).max(255).nullish(),
5473
- skill_version: external_exports.string().max(50).nullish(),
5474
- enabled: external_exports.boolean().optional(),
5475
- tags: external_exports.array(external_exports.string().uuid()).optional(),
5476
- environment: external_exports.enum(["preview", "production", "all"]).optional()
5477
- });
5478
- createOrgResourceFolderBody = external_exports.object({
5479
- org_resource_id: external_exports.string().uuid(),
5480
- folder_name: external_exports.string().min(1).max(255),
5481
- folder_description: external_exports.string().max(1e3).nullish(),
5482
- parent_folder_id: external_exports.string().uuid().nullish(),
5483
- order_index: external_exports.number().int().nonnegative().optional(),
5484
- enabled: external_exports.boolean().optional(),
5485
- metadata: external_exports.record(external_exports.unknown()).optional()
5486
- });
5487
- updateOrgResourceFolderBody = external_exports.object({
5488
- folder_name: external_exports.string().min(1).max(255).optional(),
5489
- folder_description: external_exports.string().max(1e3).nullish(),
5490
- parent_folder_id: external_exports.string().uuid().nullish(),
5491
- order_index: external_exports.number().int().nonnegative().optional(),
5492
- enabled: external_exports.boolean().optional(),
5493
- metadata: external_exports.record(external_exports.unknown()).optional()
5607
+ updateUserBody = external_exports.object({
5608
+ user_language: external_exports.string().optional(),
5609
+ /** true: dark; false: light; null: follow each device's own setting (`AppearanceMode`). */
5610
+ ui_dark_mode: external_exports.boolean().nullable().optional(),
5611
+ profile_name: external_exports.string().optional(),
5612
+ link_email_to_identities: external_exports.boolean().optional()
5613
+ }).refine(
5614
+ (data) => Object.values(data).some((v) => v !== void 0),
5615
+ { message: "At least one field must be provided" }
5616
+ );
5617
+ updateProfileBody = external_exports.object({
5618
+ display_name: external_exports.string().optional(),
5619
+ avatar_url: external_exports.string().optional(),
5620
+ preferences: external_exports.record(external_exports.unknown()).optional()
5621
+ }).refine(
5622
+ (data) => Object.values(data).some((v) => v !== void 0),
5623
+ { message: "At least one field must be provided" }
5624
+ );
5625
+ pathnameRegex = /^\/(?!\/)[A-Za-z0-9\-._~!$&'()*+,;=:@/?%]*$/;
5626
+ updatePreferencesBody = external_exports.object({
5627
+ last_viewed_nav: external_exports.string().regex(pathnameRegex, "Must be a URL pathname").max(2048).optional(),
5628
+ dismissed_agentic_shortcut: external_exports.boolean().optional(),
5629
+ opened_guide: external_exports.boolean().optional()
5630
+ }).passthrough();
5631
+ registerPushTokenBody = external_exports.object({
5632
+ token: external_exports.string().min(1).max(512),
5633
+ platform: external_exports.enum(["ios", "android"]),
5634
+ /** Stable per-install id so re-registration replaces the prior token for the device. */
5635
+ device_id: external_exports.string().min(1).max(128).optional(),
5636
+ /**
5637
+ * The build opens a person-to-person thread from a push (gh #4661): only a token registered
5638
+ * with it receives thread pushes, whose `data` carries `thread_id` and no `conversation_id`.
5639
+ * Each registration states it afresh, so a build that sends none clears it.
5640
+ */
5641
+ supports_threads: external_exports.boolean().optional(),
5642
+ /**
5643
+ * The build opens a community from a push (gh #4872 Decision 8): only a token registered with it
5644
+ * receives a community's pushes (an announcement, a reply to the member's forum post), whose
5645
+ * `data` is `CommunityPushData` — never a `conversation_id` or a `thread_id`. Each registration
5646
+ * states it afresh, so a build that sends none clears it.
5647
+ */
5648
+ supports_communities: external_exports.boolean().optional()
5494
5649
  });
5495
- uploadOrgResourceFileBody = external_exports.object({
5496
- org_resource_id: external_exports.string().uuid(),
5497
- folder_id: external_exports.string().uuid().nullish(),
5498
- file_name: external_exports.string().min(1).max(255),
5499
- file_data: external_exports.string(),
5500
- // base64
5501
- mime_type: external_exports.string().optional(),
5502
- file_size: external_exports.number().int().nonnegative().optional(),
5503
- resource_file_tags: external_exports.array(external_exports.string()).optional(),
5504
- metadata: external_exports.record(external_exports.unknown()).optional()
5650
+ deletePushTokenQuery = external_exports.object({
5651
+ token: external_exports.string().min(1).max(512)
5505
5652
  });
5506
- updateOrgResourceFileBody = external_exports.object({
5507
- resource_file_title: external_exports.string().min(1).max(255).optional(),
5508
- folder_id: external_exports.string().uuid().nullish(),
5509
- order_index: external_exports.number().int().nonnegative().optional(),
5510
- enabled: external_exports.boolean().optional(),
5511
- resource_file_tags: external_exports.array(external_exports.string()).optional(),
5512
- metadata: external_exports.record(external_exports.unknown()).optional()
5653
+ recordAiDisclosureAcceptanceBody = external_exports.object({
5654
+ version: external_exports.number().int().positive(),
5655
+ withdrawn_at_seen: external_exports.string().datetime().nullable().optional()
5513
5656
  });
5514
- uploadOrgSkillZipBody = external_exports.object({
5515
- zip_data: external_exports.string().min(1),
5516
- replace_existing: external_exports.boolean().optional()
5657
+ activityQuery = external_exports.object({
5658
+ limit: external_exports.coerce.number().int().min(1).max(100).optional()
5517
5659
  });
5518
- linkOrgResourceBody = external_exports.object({
5519
- org_resource_id: external_exports.string().uuid()
5660
+ deletionModeSchema = external_exports.enum(["scheduled", "immediate"]);
5661
+ deletionRequestBody = external_exports.object({
5662
+ mode: deletionModeSchema,
5663
+ /** User-supplied reason captured in the audit log; bounded to bound logged PII. */
5664
+ reason: external_exports.string().max(500).optional(),
5665
+ /** Type-to-confirm value; must equal the user's email (constant-time compared). */
5666
+ email_confirmation: external_exports.string().min(1).max(320)
5520
5667
  });
5521
5668
  }
5522
5669
  });
@@ -5566,559 +5713,54 @@ var init_chunk_JOPEQ3WP = __esm({
5566
5713
  }
5567
5714
  });
5568
5715
 
5569
- // ../../packages/core/dist/chunk-HA7CRZMX.js
5570
- var connectionIdParam, connectorIdParam, listConnectionsQuery, deleteConnectionQuery, addConnectionBody, editConnectionBody, PRODUCTION_DIRECT_FIELDS, BESIDE_LINK_FIELDS, setProductionCredentialBody, registerWhatsappQuery, registerWhatsappBody, retryProvisioningQuery, resendDomainStatusQuery;
5571
- var init_chunk_HA7CRZMX = __esm({
5572
- "../../packages/core/dist/chunk-HA7CRZMX.js"() {
5716
+ // ../../packages/core/dist/chunk-5XEJSR22.js
5717
+ var DATA_PROXY_MOUNT, DATA_PROXY_PREFIX, BASE_DESTRUCTION_MOUNT, BASE_DESTRUCTION_PREFIX, BASE_DESTRUCTION_CONFIRM_PATH, COMMUNITY_EMAIL_UNSUBSCRIBE_PATH, CONTACT_BOOK_EMAIL_UNSUBSCRIBE_PATH, AUTOMATION_WEBHOOK_MOUNT, MANAGED_AGENTS_WEBHOOK_MOUNT;
5718
+ var init_chunk_5XEJSR22 = __esm({
5719
+ "../../packages/core/dist/chunk-5XEJSR22.js"() {
5573
5720
  "use strict";
5574
- init_chunk_MF2VVXBR();
5575
- init_chunk_HZ6CADSY();
5576
- init_zod();
5577
- connectionIdParam = external_exports.object({ id: uuidSchema });
5578
- connectorIdParam = external_exports.object({ id: uuidSchema });
5579
- listConnectionsQuery = external_exports.object({ hub_id: uuidSchema });
5580
- deleteConnectionQuery = external_exports.object({ hub_id: uuidSchema });
5581
- addConnectionBody = external_exports.object({
5582
- hub_id: uuidSchema,
5583
- connector_id: uuidSchema,
5584
- authentication_type: external_exports.string().optional(),
5585
- inbound_mode: external_exports.enum(["wayai", "resend"]).optional(),
5586
- inbound_address: external_exports.string().email().optional(),
5587
- // Opt out of copying this connection's credentials into production on publish/sync.
5588
- // Defaults to true at the DB layer.
5589
- sync_credentials_to_production: external_exports.boolean().optional(),
5590
- // When the connection's own secret expires; null for none (`credential-expiry.ts`).
5591
- expires_at: credentialExpiresAtSchema.optional()
5592
- }).passthrough().superRefine((data, ctx) => {
5593
- if (data.inbound_mode === "resend" && !data.inbound_address) {
5594
- ctx.addIssue({
5595
- code: external_exports.ZodIssueCode.custom,
5596
- message: "Receiving email address is required when using Resend inbound mode",
5597
- path: ["inbound_address"]
5598
- });
5599
- }
5600
- });
5601
- editConnectionBody = external_exports.object({
5602
- hub_id: uuidSchema,
5603
- sync_credentials_to_production: external_exports.boolean().optional(),
5604
- expires_at: credentialExpiresAtSchema.optional()
5605
- }).passthrough();
5606
- PRODUCTION_DIRECT_FIELDS = ["username", "api_key", "access_token", "password", "refresh_token", "webhook_secret_token", "webhook_signing_secret", "github_app_id", "github_app_private_key"];
5607
- BESIDE_LINK_FIELDS = /* @__PURE__ */ new Set(["webhook_secret_token", "github_app_id", "github_app_private_key"]);
5608
- setProductionCredentialBody = external_exports.object({
5609
- hub_id: uuidSchema,
5610
- organization_credential_id: external_exports.string().nullable().optional(),
5611
- organization_credential_token_id: external_exports.string().nullable().optional(),
5612
- username: external_exports.string().optional(),
5613
- api_key: external_exports.string().optional(),
5614
- access_token: external_exports.string().optional(),
5615
- password: external_exports.string().optional(),
5616
- refresh_token: external_exports.string().optional(),
5617
- webhook_secret_token: external_exports.string().optional(),
5618
- webhook_signing_secret: external_exports.string().optional(),
5619
- github_app_id: external_exports.string().optional(),
5620
- github_app_private_key: external_exports.string().optional(),
5621
- expires_at: credentialExpiresAtSchema.optional()
5622
- }).strict().superRefine((data, ctx) => {
5623
- const hasOrgLink = !!data.organization_credential_id || !!data.organization_credential_token_id;
5624
- const sets = (f) => data[f] != null && data[f] !== `__USE_EXISTING_${f.toUpperCase()}__`;
5625
- const hasDirect = PRODUCTION_DIRECT_FIELDS.some(sets);
5626
- const hasDirectBesideLink = PRODUCTION_DIRECT_FIELDS.some((f) => !BESIDE_LINK_FIELDS.has(f) && sets(f));
5627
- if (hasOrgLink && hasDirectBesideLink) {
5628
- ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Provide either an organization credential link or direct credential fields, not both" });
5629
- }
5630
- if (hasOrgLink && data.expires_at != null) {
5631
- ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: LINKED_EXPIRY_REFUSAL, path: ["expires_at"] });
5632
- }
5633
- if (!hasOrgLink && !hasDirect && data.expires_at === void 0) {
5634
- ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "A credential is required: link an organization credential or provide a credential field" });
5635
- }
5636
- });
5637
- registerWhatsappQuery = external_exports.object({ hub_id: uuidSchema });
5638
- registerWhatsappBody = external_exports.object({
5639
- pin: external_exports.string().optional()
5640
- });
5641
- retryProvisioningQuery = external_exports.object({ hub_id: uuidSchema });
5642
- resendDomainStatusQuery = external_exports.object({ hub_id: uuidSchema });
5721
+ DATA_PROXY_MOUNT = "/data";
5722
+ DATA_PROXY_PREFIX = `/api${DATA_PROXY_MOUNT}`;
5723
+ BASE_DESTRUCTION_MOUNT = "/bases";
5724
+ BASE_DESTRUCTION_PREFIX = `/api${BASE_DESTRUCTION_MOUNT}`;
5725
+ BASE_DESTRUCTION_CONFIRM_PATH = `${BASE_DESTRUCTION_PREFIX}/destruction/confirm`;
5726
+ COMMUNITY_EMAIL_UNSUBSCRIBE_PATH = "/api/communities/email-unsubscribe";
5727
+ CONTACT_BOOK_EMAIL_UNSUBSCRIBE_PATH = "/api/contact-book/email-unsubscribe";
5728
+ AUTOMATION_WEBHOOK_MOUNT = "/webhooks/automations";
5729
+ MANAGED_AGENTS_WEBHOOK_MOUNT = "/webhooks/managed-agents";
5643
5730
  }
5644
5731
  });
5645
5732
 
5646
- // ../../packages/core/dist/chunk-IPDOHAZ5.js
5647
- var reportSourceSchema, intakeReportSourceSchema, reportClassificationSchema, reportStatusSchema, reportLocaleSchema, reportMessageAuthorRoleSchema, reportMessageSchema, sentryRefStatusSchema, createReportBody, editReportBody, reporterReportSummarySchema, reporterListResponseSchema, getReportResponseSchema, reporterTransitionResponseSchema, contestReportBody, reporterListQuery, listReportsQuery, GITHUB_ISSUE_URL_REGEX, githubIssueUrlSchema, transitionReportBody, groupReportsBody, holdReportBody;
5648
- var init_chunk_IPDOHAZ5 = __esm({
5649
- "../../packages/core/dist/chunk-IPDOHAZ5.js"() {
5650
- "use strict";
5651
- init_chunk_HZ6CADSY();
5652
- init_zod();
5653
- reportSourceSchema = external_exports.enum(["sentry", "cli", "review", "security_audit"]);
5654
- intakeReportSourceSchema = external_exports.enum(["cli", "review", "security_audit"]);
5655
- reportClassificationSchema = external_exports.enum(["bug", "flaky_test", "security", "enhancement"]);
5656
- reportStatusSchema = external_exports.enum([
5657
- "pending",
5658
- "grouped",
5659
- "escalated",
5660
- "shipped",
5661
- "contested",
5662
- "addressed",
5663
- "dismissed"
5664
- ]);
5665
- reportLocaleSchema = external_exports.enum(["en", "pt", "es"]);
5666
- reportMessageAuthorRoleSchema = external_exports.enum(["reporter", "triage", "fixer", "system"]);
5667
- reportMessageSchema = external_exports.object({
5668
- message_id: external_exports.string(),
5669
- author_role: reportMessageAuthorRoleSchema,
5670
- /** The status transition this note accompanied (e.g. 'shipped'); null for a free/system note. */
5671
- transition: external_exports.string().nullable(),
5672
- body: external_exports.string(),
5673
- created_at: timestampSchema,
5674
- /**
5675
- * Visibility: `false` = reporter-facing (the default for every narrative entry); `true` =
5676
- * triage-internal (e.g. a `hold` rationale) — surfaced to platform admins only and NEVER
5677
- * returned on the reporter read path. The reporter's `GET /api/reports/:id` filters these out.
5678
- */
5679
- internal: external_exports.boolean()
5680
- });
5681
- sentryRefStatusSchema = external_exports.enum(["valid", "not_found", "mismatch", "unverified"]);
5682
- createReportBody = external_exports.object({
5683
- title: external_exports.string().min(5).max(256),
5684
- description: external_exports.string().min(10).max(5e3),
5685
- steps_to_reproduce: external_exports.string().max(3e3).optional(),
5686
- error_message: external_exports.string().max(2e3).optional(),
5687
- // Taxonomy (server defaults: source=cli, classification=bug when absent).
5688
- source: intakeReportSourceSchema.optional(),
5689
- classification: reportClassificationSchema.optional(),
5690
- // Stable dedup key (e.g. "<file>::<test>" for flaky, "<file>:<line>" for
5691
- // security). When present, the fingerprint uses it instead of the body hash.
5692
- dedup_key: external_exports.string().min(1).max(256).optional(),
5693
- // Context fields (auto-captured by the CLI)
5694
- organization_id: external_exports.string().optional(),
5695
- hub_id: external_exports.string().uuid().optional(),
5696
- hub_name: external_exports.string().max(256).optional(),
5697
- conversation_id: external_exports.string().uuid().optional(),
5698
- agent_id: external_exports.string().uuid().optional(),
5699
- agent_name: external_exports.string().max(256).optional(),
5700
- client_version: external_exports.string().max(64).optional(),
5701
- additional_context: external_exports.string().max(2e3).optional()
5702
- });
5703
- editReportBody = external_exports.object({
5704
- title: external_exports.string().min(5).max(256).optional(),
5705
- description: external_exports.string().min(10).max(5e3).optional(),
5706
- steps_to_reproduce: external_exports.string().max(3e3).optional(),
5707
- error_message: external_exports.string().max(2e3).optional(),
5708
- additional_context: external_exports.string().max(2e3).optional()
5709
- }).strict().refine((b) => Object.keys(b).length > 0, {
5710
- message: "at least one field must be provided"
5711
- });
5712
- reporterReportSummarySchema = external_exports.object({
5713
- report_id: external_exports.string(),
5714
- title: external_exports.string(),
5715
- description: external_exports.string(),
5716
- classification: reportClassificationSchema,
5717
- status: reportStatusSchema,
5718
- created_at: timestampSchema,
5719
- triaged_at: timestampSchema.nullable(),
5720
- resolved_at: timestampSchema.nullable(),
5721
- /** How many times the reporter has contested (gates the hard cap). */
5722
- contest_count: external_exports.number(),
5723
- /** True once triage issued a non-contestable (final) dismissal. */
5724
- dismissal_final: external_exports.boolean()
5725
- });
5726
- reporterListResponseSchema = external_exports.object({
5727
- data: external_exports.array(reporterReportSummarySchema)
5728
- });
5729
- getReportResponseSchema = external_exports.object({
5730
- report: reporterReportSummarySchema,
5731
- messages: external_exports.array(reportMessageSchema)
5732
- });
5733
- reporterTransitionResponseSchema = external_exports.object({
5734
- report: reporterReportSummarySchema
5735
- });
5736
- contestReportBody = external_exports.object({
5737
- reason: external_exports.string().min(1).max(5e3)
5738
- });
5739
- reporterListQuery = external_exports.object({
5740
- status: reportStatusSchema.optional()
5741
- });
5742
- listReportsQuery = external_exports.object({
5743
- status: reportStatusSchema.optional(),
5744
- source: reportSourceSchema.optional(),
5745
- limit: external_exports.coerce.number().int().min(1).max(200).optional(),
5746
- offset: external_exports.coerce.number().int().min(0).optional(),
5747
- /** ISO 8601 lower bound on created_at. */
5748
- since: external_exports.string().datetime().optional(),
5749
- /**
5750
- * ISO 8601 lower bound on resolution time — "what did we resolve recently", which `since`
5751
- * (a created_at filter) cannot answer for a long-lived report resolved yesterday. Implies
5752
- * a terminal status (`addressed`/`dismissed`) and orders on that same axis.
5753
- */
5754
- resolved_since: external_exports.string().datetime().optional()
5755
- });
5756
- GITHUB_ISSUE_URL_REGEX = /^https:\/\/github\.com\/[^/]+\/[^/]+\/issues\/\d+(?:[/?#]|$)/;
5757
- githubIssueUrlSchema = external_exports.string().url().refine((u) => GITHUB_ISSUE_URL_REGEX.test(u), {
5758
- message: "must be an https://github.com/<owner>/<repo>/issues/<number> URL"
5759
- });
5760
- transitionReportBody = external_exports.discriminatedUnion("target", [
5761
- external_exports.object({
5762
- target: external_exports.literal("escalated"),
5763
- gh_issue_url: githubIssueUrlSchema,
5764
- ai_verdict: external_exports.string().max(2e3).optional()
5765
- }),
5766
- external_exports.object({
5767
- target: external_exports.literal("shipped"),
5768
- note: external_exports.string().min(1).max(2e3).optional()
5769
- }),
5770
- external_exports.object({
5771
- target: external_exports.literal("addressed")
5772
- }),
5773
- external_exports.object({
5774
- target: external_exports.literal("dismissed"),
5775
- dismissal_reason: external_exports.string().min(1).max(5e3),
5776
- ai_verdict: external_exports.string().max(2e3).optional(),
5777
- final: external_exports.boolean().optional()
5778
- })
5779
- ]);
5780
- groupReportsBody = external_exports.object({
5781
- member_ids: external_exports.array(external_exports.string().uuid()).min(1).max(100)
5782
- });
5783
- holdReportBody = external_exports.object({
5784
- reason: external_exports.string().min(1).max(5e3)
5785
- });
5786
- }
5787
- });
5788
-
5789
- // ../../packages/core/dist/chunk-GPM7PE44.js
5790
- var bootstrapQuery;
5791
- var init_chunk_GPM7PE44 = __esm({
5792
- "../../packages/core/dist/chunk-GPM7PE44.js"() {
5793
- "use strict";
5794
- init_zod();
5795
- bootstrapQuery = external_exports.object({
5796
- active_hub_id: external_exports.string().uuid().optional(),
5797
- active_conversation_id: external_exports.string().uuid().optional(),
5798
- active_nav: external_exports.enum(["chat", "task", "support"]).optional(),
5799
- /**
5800
- * The people thread the URL names (`/chat/threads/:threadId`, gh #4661): the snapshot
5801
- * preloads it as `people.active_thread` when the viewer is a member.
5802
- */
5803
- active_thread_id: external_exports.string().uuid().optional()
5804
- });
5805
- }
5806
- });
5807
-
5808
- // ../../packages/core/dist/chunk-5VL6LBFD.js
5809
- var PERMISSIONS;
5810
- var init_chunk_5VL6LBFD = __esm({
5811
- "../../packages/core/dist/chunk-5VL6LBFD.js"() {
5812
- "use strict";
5813
- PERMISSIONS = [
5814
- "hub:read",
5815
- "hub:write",
5816
- "hub:admin",
5817
- "conversation:read",
5818
- "conversation:write",
5819
- "analytics:read",
5820
- "billing:read",
5821
- "billing:write",
5822
- "org:read",
5823
- "org:write",
5824
- "org:admin",
5825
- "contacts:write",
5826
- "platform:admin",
5827
- "*"
5828
- ];
5829
- }
5830
- });
5831
-
5832
- // ../../packages/core/dist/chunk-VEERWOZ6.js
5833
- var MAX_NAME_LENGTH2, MAX_HUBS_PER_GRANT, MAX_HUB_TAGS_PER_GRANT, MAX_GRANTS, permissionEnum, grantScopeSchema, grantSchema, createTokenBody, tokenOrgIdParam;
5834
- var init_chunk_VEERWOZ6 = __esm({
5835
- "../../packages/core/dist/chunk-VEERWOZ6.js"() {
5836
- "use strict";
5837
- init_chunk_5VL6LBFD();
5838
- init_chunk_HZ6CADSY();
5839
- init_zod();
5840
- MAX_NAME_LENGTH2 = 100;
5841
- MAX_HUBS_PER_GRANT = 50;
5842
- MAX_HUB_TAGS_PER_GRANT = 20;
5843
- MAX_GRANTS = 20;
5844
- permissionEnum = external_exports.enum(PERMISSIONS).refine(
5845
- (p) => p !== "platform:admin",
5846
- { message: "platform:admin cannot be delegated via token creation" }
5847
- );
5848
- grantScopeSchema = external_exports.object({
5849
- // Required: every token grant must declare its org tenancy. The handler
5850
- // also strict-checks this as defense-in-depth, but failing at the Zod
5851
- // boundary keeps the generated client type honest (org_id: string).
5852
- org_id: external_exports.string().min(1),
5853
- hubs: external_exports.array(external_exports.string().min(1)).min(1, "Each grant must have scope.hubs as a non-empty array").max(MAX_HUBS_PER_GRANT),
5854
- hub_tags: external_exports.array(external_exports.string().min(1)).min(1, "scope.hub_tags must be a non-empty array if provided").max(MAX_HUB_TAGS_PER_GRANT).optional(),
5855
- environments: external_exports.array(external_exports.enum(["production", "preview"])).min(1, "scope.environments must be a non-empty array if provided").optional()
5856
- }).strict();
5857
- grantSchema = external_exports.object({
5858
- scope: grantScopeSchema,
5859
- permissions: external_exports.array(permissionEnum).min(1, "Each grant must have permissions as a non-empty array")
5860
- }).strict();
5861
- createTokenBody = external_exports.object({
5862
- name: external_exports.string().trim().min(1, "name is required").max(MAX_NAME_LENGTH2, `name must be ${MAX_NAME_LENGTH2} characters or fewer`),
5863
- grants: external_exports.array(grantSchema).min(1, "grants must be a non-empty array").max(MAX_GRANTS),
5864
- expires_at: external_exports.string().datetime({ message: "expires_at must be a valid ISO 8601 date" }).refine(
5865
- (s) => new Date(s).getTime() > Date.now(),
5866
- { message: "expires_at must be in the future" }
5867
- ).optional()
5868
- });
5869
- tokenOrgIdParam = external_exports.object({ orgId: uuidSchema });
5870
- }
5871
- });
5872
-
5873
- // ../../packages/core/dist/chunk-ZC6YGHNX.js
5874
- var updateUserBody, updateProfileBody, pathnameRegex, updatePreferencesBody, registerPushTokenBody, deletePushTokenQuery, recordAiDisclosureAcceptanceBody, activityQuery, deletionModeSchema, deletionRequestBody;
5875
- var init_chunk_ZC6YGHNX = __esm({
5876
- "../../packages/core/dist/chunk-ZC6YGHNX.js"() {
5877
- "use strict";
5878
- init_zod();
5879
- updateUserBody = external_exports.object({
5880
- user_language: external_exports.string().optional(),
5881
- /** true: dark; false: light; null: follow each device's own setting (`AppearanceMode`). */
5882
- ui_dark_mode: external_exports.boolean().nullable().optional(),
5883
- profile_name: external_exports.string().optional(),
5884
- link_email_to_identities: external_exports.boolean().optional()
5885
- }).refine(
5886
- (data) => Object.values(data).some((v) => v !== void 0),
5887
- { message: "At least one field must be provided" }
5888
- );
5889
- updateProfileBody = external_exports.object({
5890
- display_name: external_exports.string().optional(),
5891
- avatar_url: external_exports.string().optional(),
5892
- preferences: external_exports.record(external_exports.unknown()).optional()
5893
- }).refine(
5894
- (data) => Object.values(data).some((v) => v !== void 0),
5895
- { message: "At least one field must be provided" }
5896
- );
5897
- pathnameRegex = /^\/(?!\/)[A-Za-z0-9\-._~!$&'()*+,;=:@/?%]*$/;
5898
- updatePreferencesBody = external_exports.object({
5899
- last_viewed_nav: external_exports.string().regex(pathnameRegex, "Must be a URL pathname").max(2048).optional(),
5900
- dismissed_agentic_shortcut: external_exports.boolean().optional(),
5901
- opened_guide: external_exports.boolean().optional()
5902
- }).passthrough();
5903
- registerPushTokenBody = external_exports.object({
5904
- token: external_exports.string().min(1).max(512),
5905
- platform: external_exports.enum(["ios", "android"]),
5906
- /** Stable per-install id so re-registration replaces the prior token for the device. */
5907
- device_id: external_exports.string().min(1).max(128).optional(),
5908
- /**
5909
- * The build opens a person-to-person thread from a push (gh #4661): only a token registered
5910
- * with it receives thread pushes, whose `data` carries `thread_id` and no `conversation_id`.
5911
- * Each registration states it afresh, so a build that sends none clears it.
5912
- */
5913
- supports_threads: external_exports.boolean().optional(),
5914
- /**
5915
- * The build opens a community from a push (gh #4872 Decision 8): only a token registered with it
5916
- * receives a community's pushes (an announcement, a reply to the member's forum post), whose
5917
- * `data` is `CommunityPushData` — never a `conversation_id` or a `thread_id`. Each registration
5918
- * states it afresh, so a build that sends none clears it.
5919
- */
5920
- supports_communities: external_exports.boolean().optional()
5921
- });
5922
- deletePushTokenQuery = external_exports.object({
5923
- token: external_exports.string().min(1).max(512)
5924
- });
5925
- recordAiDisclosureAcceptanceBody = external_exports.object({
5926
- version: external_exports.number().int().positive(),
5927
- withdrawn_at_seen: external_exports.string().datetime().nullable().optional()
5928
- });
5929
- activityQuery = external_exports.object({
5930
- limit: external_exports.coerce.number().int().min(1).max(100).optional()
5931
- });
5932
- deletionModeSchema = external_exports.enum(["scheduled", "immediate"]);
5933
- deletionRequestBody = external_exports.object({
5934
- mode: deletionModeSchema,
5935
- /** User-supplied reason captured in the audit log; bounded to bound logged PII. */
5936
- reason: external_exports.string().max(500).optional(),
5937
- /** Type-to-confirm value; must equal the user's email (constant-time compared). */
5938
- email_confirmation: external_exports.string().min(1).max(320)
5939
- });
5940
- }
5941
- });
5942
-
5943
- // ../../packages/core/dist/chunk-ZVXO3XL6.js
5944
- var PEOPLE_CONTACT_PAGE_MAX, PEOPLE_CONTACT_PAGE_DEFAULT, PEOPLE_CONTACT_EMAIL_MAX_LENGTH, peopleUserIdSchema, peopleInviteEmailSchema, peopleContactInviteBody, peopleContactInviteIdParam, peopleContactUserIdParam, peopleContactBlockBody, peopleContactPageQuery, peopleOutgoingInviteSchema, peopleContactPersonSchema, peopleContactSchema, peopleIncomingInviteSchema, peopleBlockedUserSchema;
5945
- var init_chunk_ZVXO3XL6 = __esm({
5946
- "../../packages/core/dist/chunk-ZVXO3XL6.js"() {
5947
- "use strict";
5948
- init_chunk_HZ6CADSY();
5949
- init_zod();
5950
- PEOPLE_CONTACT_PAGE_MAX = 100;
5951
- PEOPLE_CONTACT_PAGE_DEFAULT = 50;
5952
- PEOPLE_CONTACT_EMAIL_MAX_LENGTH = 254;
5953
- peopleUserIdSchema = external_exports.string().max(64).regex(USER_ID_REGEX, "must be a user id");
5954
- peopleInviteEmailSchema = external_exports.string().trim().max(PEOPLE_CONTACT_EMAIL_MAX_LENGTH).email();
5955
- peopleContactInviteBody = external_exports.object({
5956
- email: peopleInviteEmailSchema
5957
- }).strict();
5958
- peopleContactInviteIdParam = external_exports.object({ inviteId: uuidSchema });
5959
- peopleContactUserIdParam = external_exports.object({ userId: peopleUserIdSchema });
5960
- peopleContactBlockBody = external_exports.object({ user_id: peopleUserIdSchema, thread_id: uuidSchema.optional(), community_id: uuidSchema.optional() }).strict().refine((body) => body.thread_id === void 0 || body.community_id === void 0, {
5961
- message: "Name a thread or a community, not both",
5962
- path: ["community_id"]
5963
- });
5964
- peopleContactPageQuery = external_exports.object({
5965
- cursor: external_exports.string().min(1).max(256).optional(),
5966
- limit: external_exports.coerce.number().int().min(1).max(PEOPLE_CONTACT_PAGE_MAX).default(PEOPLE_CONTACT_PAGE_DEFAULT)
5967
- });
5968
- peopleOutgoingInviteSchema = external_exports.object({
5969
- invite_id: uuidSchema,
5970
- email: external_exports.string(),
5971
- status: external_exports.literal("sent"),
5972
- created_at: timestampSchema,
5973
- expires_at: timestampSchema
5974
- }).strict();
5975
- peopleContactPersonSchema = external_exports.object({
5976
- user_id: peopleUserIdSchema,
5977
- display_name: external_exports.string().nullable(),
5978
- email: external_exports.string().nullable()
5979
- }).strict();
5980
- peopleContactSchema = peopleContactPersonSchema.extend({ contact_since: timestampSchema, thread_id: uuidSchema }).strict();
5981
- peopleIncomingInviteSchema = external_exports.object({
5982
- invite_id: uuidSchema,
5983
- inviter: peopleContactPersonSchema,
5984
- created_at: timestampSchema,
5985
- expires_at: timestampSchema
5986
- }).strict();
5987
- peopleBlockedUserSchema = peopleContactPersonSchema.extend({ blocked_at: timestampSchema, deleted_user: external_exports.boolean() }).strict();
5988
- }
5989
- });
5990
-
5991
- // ../../packages/core/dist/chunk-ZXK6N2HN.js
5992
- var PEOPLE_MODERATION_NOTE_MAX_LENGTH, ADMIN_PEOPLE_REPORTS_PAGE_MAX, ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT, PEOPLE_SUSPENDED_REASON, peopleModerationActionSchema, moderationNoteSchema, adminPeopleReportListQuery, adminPeopleReportIdParam, adminPeopleMessageRemovalBody, adminPeopleSuspendBody, adminPeopleNoteBody;
5993
- var init_chunk_ZXK6N2HN = __esm({
5994
- "../../packages/core/dist/chunk-ZXK6N2HN.js"() {
5995
- "use strict";
5996
- init_chunk_ZVXO3XL6();
5997
- init_chunk_HZ6CADSY();
5998
- init_zod();
5999
- PEOPLE_MODERATION_NOTE_MAX_LENGTH = 500;
6000
- ADMIN_PEOPLE_REPORTS_PAGE_MAX = 100;
6001
- ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT = 50;
6002
- PEOPLE_SUSPENDED_REASON = "suspended";
6003
- peopleModerationActionSchema = external_exports.enum(["remove_message", "suspend", "unsuspend", "dismiss"]);
6004
- moderationNoteSchema = optionalTrimmedText(PEOPLE_MODERATION_NOTE_MAX_LENGTH);
6005
- adminPeopleReportListQuery = external_exports.object({
6006
- pending: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true"),
6007
- /** Lower bound on `created_at`. */
6008
- since: timestampSchema.optional(),
6009
- limit: external_exports.coerce.number().int().min(1).max(ADMIN_PEOPLE_REPORTS_PAGE_MAX).default(ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT),
6010
- offset: external_exports.coerce.number().int().min(0).default(0)
6011
- });
6012
- adminPeopleReportIdParam = external_exports.object({ reportId: uuidSchema });
6013
- adminPeopleMessageRemovalBody = external_exports.object({ report_id: uuidSchema, message_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
6014
- adminPeopleSuspendBody = external_exports.object({ report_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
6015
- adminPeopleNoteBody = external_exports.object({ note: moderationNoteSchema }).strict();
6016
- }
6017
- });
6018
-
6019
- // ../../packages/core/dist/chunk-Y7CFCYX4.js
6020
- var PEOPLE_REPORT_DETAILS_MAX_LENGTH, peopleReportReasonSchema, reportDetailsSchema, reportFields, peopleReportBody;
6021
- var init_chunk_Y7CFCYX4 = __esm({
6022
- "../../packages/core/dist/chunk-Y7CFCYX4.js"() {
6023
- "use strict";
6024
- init_chunk_ZVXO3XL6();
6025
- init_chunk_HZ6CADSY();
6026
- init_zod();
6027
- PEOPLE_REPORT_DETAILS_MAX_LENGTH = 500;
6028
- peopleReportReasonSchema = external_exports.enum(["spam", "harassment", "hate", "sexual", "violence", "other"]);
6029
- reportDetailsSchema = optionalTrimmedText(PEOPLE_REPORT_DETAILS_MAX_LENGTH);
6030
- reportFields = { reason: peopleReportReasonSchema, details: reportDetailsSchema };
6031
- peopleReportBody = external_exports.discriminatedUnion("target", [
6032
- external_exports.object({ target: external_exports.literal("message"), thread_id: uuidSchema, message_id: uuidSchema, ...reportFields }).strict(),
6033
- external_exports.object({ target: external_exports.literal("thread"), thread_id: uuidSchema, ...reportFields }).strict(),
6034
- external_exports.object({ target: external_exports.literal("user"), user_id: peopleUserIdSchema, thread_id: uuidSchema.optional(), ...reportFields }).strict(),
6035
- external_exports.object({
6036
- target: external_exports.literal("community_message"),
6037
- community_id: uuidSchema,
6038
- room_id: uuidSchema,
6039
- message_id: uuidSchema,
6040
- ...reportFields
6041
- }).strict(),
6042
- external_exports.object({ target: external_exports.literal("community_member"), community_id: uuidSchema, user_id: peopleUserIdSchema, ...reportFields }).strict()
6043
- ]);
6044
- }
6045
- });
6046
-
6047
- // ../../packages/core/dist/chunk-5DGHIY7L.js
6048
- var rekorBaseChangeMessageSchema;
6049
- var init_chunk_5DGHIY7L = __esm({
6050
- "../../packages/core/dist/chunk-5DGHIY7L.js"() {
6051
- "use strict";
6052
- init_zod();
6053
- rekorBaseChangeMessageSchema = external_exports.object({
6054
- /** The WayAI org UUID — one id namespace. */
6055
- org_id: external_exports.string().uuid(),
6056
- /**
6057
- * Not a UUID: a preview base id is `{prod_base_id}--{slug}`. Immutable per base — a
6058
- * preview clone is its OWN base_id — so `(base_id, scope)` keys never collide across
6059
- * environments. Empty is never a real base id, so it is non-conforming rather than a
6060
- * frame keyed on nothing.
6061
- */
6062
- base_id: external_exports.string().min(1),
6063
- /**
6064
- * Rides along so the client scopes its refetch without a lookup; the inspector scopes
6065
- * by side.
6066
- */
6067
- environment: external_exports.enum(["production", "preview"]),
6068
- /** Which pane refetches. `base` covers create/delete/promote/config changes. */
6069
- scope: external_exports.enum(["records", "record_types", "files", "base"])
6070
- });
6071
- }
6072
- });
6073
-
6074
- // ../../packages/core/dist/chunk-5XEJSR22.js
6075
- var DATA_PROXY_MOUNT, DATA_PROXY_PREFIX, BASE_DESTRUCTION_MOUNT, BASE_DESTRUCTION_PREFIX, BASE_DESTRUCTION_CONFIRM_PATH, COMMUNITY_EMAIL_UNSUBSCRIBE_PATH, CONTACT_BOOK_EMAIL_UNSUBSCRIBE_PATH, AUTOMATION_WEBHOOK_MOUNT, MANAGED_AGENTS_WEBHOOK_MOUNT;
6076
- var init_chunk_5XEJSR22 = __esm({
6077
- "../../packages/core/dist/chunk-5XEJSR22.js"() {
6078
- "use strict";
6079
- DATA_PROXY_MOUNT = "/data";
6080
- DATA_PROXY_PREFIX = `/api${DATA_PROXY_MOUNT}`;
6081
- BASE_DESTRUCTION_MOUNT = "/bases";
6082
- BASE_DESTRUCTION_PREFIX = `/api${BASE_DESTRUCTION_MOUNT}`;
6083
- BASE_DESTRUCTION_CONFIRM_PATH = `${BASE_DESTRUCTION_PREFIX}/destruction/confirm`;
6084
- COMMUNITY_EMAIL_UNSUBSCRIBE_PATH = "/api/communities/email-unsubscribe";
6085
- CONTACT_BOOK_EMAIL_UNSUBSCRIBE_PATH = "/api/contact-book/email-unsubscribe";
6086
- AUTOMATION_WEBHOOK_MOUNT = "/webhooks/automations";
6087
- MANAGED_AGENTS_WEBHOOK_MOUNT = "/webhooks/managed-agents";
6088
- }
6089
- });
6090
-
6091
- // ../../packages/core/dist/chunk-Z2SC7EVO.js
6092
- function matchPath(pattern, path45) {
6093
- const pathSegments2 = path45.replace(/\/$/, "").split("/");
6094
- const isPrefix = pattern.endsWith("/*");
6095
- const patternSegments = (isPrefix ? pattern.slice(0, -2) : pattern).split("/");
6096
- if (isPrefix ? pathSegments2.length < patternSegments.length : pathSegments2.length !== patternSegments.length) {
6097
- return false;
6098
- }
6099
- return patternSegments.every((segment, i) => segment === "*" ? pathSegments2[i] !== "" : segment === pathSegments2[i]);
6100
- }
6101
- function getEndpointConfig(path45) {
6102
- for (const excluded of EXCLUDED_PATHS) {
6103
- if (matchPath(excluded, path45)) {
6104
- return null;
6105
- }
6106
- }
6107
- const normalizedPath = path45.replace(/\/$/, "");
6108
- if (!normalizedPath.endsWith("/*") && Object.prototype.hasOwnProperty.call(ENDPOINT_CONFIGS, normalizedPath)) {
6109
- return ENDPOINT_CONFIGS[normalizedPath];
6110
- }
6111
- const sortedPatterns = Object.keys(ENDPOINT_CONFIGS).sort((a, b) => b.length - a.length);
6112
- for (const pattern of sortedPatterns) {
6113
- if (matchPath(pattern, path45)) {
6114
- return ENDPOINT_CONFIGS[pattern];
6115
- }
6116
- }
6117
- return { tier: "STANDARD" };
6118
- }
6119
- var ENDPOINT_CONFIGS, EXCLUDED_PATHS;
6120
- var init_chunk_Z2SC7EVO = __esm({
6121
- "../../packages/core/dist/chunk-Z2SC7EVO.js"() {
5733
+ // ../../packages/core/dist/chunk-J3UZCMO6.js
5734
+ function matchPath(pattern, path45) {
5735
+ const pathSegments2 = path45.replace(/\/$/, "").split("/");
5736
+ const isPrefix = pattern.endsWith("/*");
5737
+ const patternSegments = (isPrefix ? pattern.slice(0, -2) : pattern).split("/");
5738
+ if (isPrefix ? pathSegments2.length < patternSegments.length : pathSegments2.length !== patternSegments.length) {
5739
+ return false;
5740
+ }
5741
+ return patternSegments.every((segment, i) => segment === "*" ? pathSegments2[i] !== "" : segment === pathSegments2[i]);
5742
+ }
5743
+ function getEndpointConfig(path45) {
5744
+ for (const excluded of EXCLUDED_PATHS) {
5745
+ if (matchPath(excluded, path45)) {
5746
+ return null;
5747
+ }
5748
+ }
5749
+ const normalizedPath = path45.replace(/\/$/, "");
5750
+ if (!normalizedPath.endsWith("/*") && Object.prototype.hasOwnProperty.call(ENDPOINT_CONFIGS, normalizedPath)) {
5751
+ return ENDPOINT_CONFIGS[normalizedPath];
5752
+ }
5753
+ const sortedPatterns = Object.keys(ENDPOINT_CONFIGS).sort((a, b) => b.length - a.length);
5754
+ for (const pattern of sortedPatterns) {
5755
+ if (matchPath(pattern, path45)) {
5756
+ return ENDPOINT_CONFIGS[pattern];
5757
+ }
5758
+ }
5759
+ return { tier: "STANDARD" };
5760
+ }
5761
+ var ENDPOINT_CONFIGS, EXCLUDED_PATHS;
5762
+ var init_chunk_J3UZCMO6 = __esm({
5763
+ "../../packages/core/dist/chunk-J3UZCMO6.js"() {
6122
5764
  "use strict";
6123
5765
  init_chunk_5XEJSR22();
6124
5766
  ENDPOINT_CONFIGS = {
@@ -6596,7 +6238,7 @@ var init_chunk_Z2SC7EVO = __esm({
6596
6238
  }
6597
6239
  });
6598
6240
 
6599
- // ../../packages/core/dist/chunk-ZAFNUHAY.js
6241
+ // ../../packages/core/dist/chunk-EKMLVJJ7.js
6600
6242
  function fileSnapshotChanged(run) {
6601
6243
  return run.written + run.removed > 0;
6602
6244
  }
@@ -6637,10 +6279,10 @@ async function sendWithRetry(opts, cursor) {
6637
6279
  }
6638
6280
  }
6639
6281
  var rekorFileSnapshotAnswerSchema, FILE_SNAPSHOT_MAX_PAGES, FILE_SNAPSHOT_CONFLICT_ATTEMPTS, FILE_SNAPSHOT_PAGE_SPACING_MS, FILE_SNAPSHOT_CONFLICT_STATUS;
6640
- var init_chunk_ZAFNUHAY = __esm({
6641
- "../../packages/core/dist/chunk-ZAFNUHAY.js"() {
6282
+ var init_chunk_EKMLVJJ7 = __esm({
6283
+ "../../packages/core/dist/chunk-EKMLVJJ7.js"() {
6642
6284
  "use strict";
6643
- init_chunk_Z2SC7EVO();
6285
+ init_chunk_J3UZCMO6();
6644
6286
  init_chunk_5XEJSR22();
6645
6287
  init_zod();
6646
6288
  rekorFileSnapshotAnswerSchema = external_exports.object({
@@ -6663,6 +6305,581 @@ var init_chunk_ZAFNUHAY = __esm({
6663
6305
  }
6664
6306
  });
6665
6307
 
6308
+ // ../../packages/core/dist/chunk-IPDOHAZ5.js
6309
+ var reportSourceSchema, intakeReportSourceSchema, reportClassificationSchema, reportStatusSchema, reportLocaleSchema, reportMessageAuthorRoleSchema, reportMessageSchema, sentryRefStatusSchema, createReportBody, editReportBody, reporterReportSummarySchema, reporterListResponseSchema, getReportResponseSchema, reporterTransitionResponseSchema, contestReportBody, reporterListQuery, listReportsQuery, GITHUB_ISSUE_URL_REGEX, githubIssueUrlSchema, transitionReportBody, groupReportsBody, holdReportBody;
6310
+ var init_chunk_IPDOHAZ5 = __esm({
6311
+ "../../packages/core/dist/chunk-IPDOHAZ5.js"() {
6312
+ "use strict";
6313
+ init_chunk_HZ6CADSY();
6314
+ init_zod();
6315
+ reportSourceSchema = external_exports.enum(["sentry", "cli", "review", "security_audit"]);
6316
+ intakeReportSourceSchema = external_exports.enum(["cli", "review", "security_audit"]);
6317
+ reportClassificationSchema = external_exports.enum(["bug", "flaky_test", "security", "enhancement"]);
6318
+ reportStatusSchema = external_exports.enum([
6319
+ "pending",
6320
+ "grouped",
6321
+ "escalated",
6322
+ "shipped",
6323
+ "contested",
6324
+ "addressed",
6325
+ "dismissed"
6326
+ ]);
6327
+ reportLocaleSchema = external_exports.enum(["en", "pt", "es"]);
6328
+ reportMessageAuthorRoleSchema = external_exports.enum(["reporter", "triage", "fixer", "system"]);
6329
+ reportMessageSchema = external_exports.object({
6330
+ message_id: external_exports.string(),
6331
+ author_role: reportMessageAuthorRoleSchema,
6332
+ /** The status transition this note accompanied (e.g. 'shipped'); null for a free/system note. */
6333
+ transition: external_exports.string().nullable(),
6334
+ body: external_exports.string(),
6335
+ created_at: timestampSchema,
6336
+ /**
6337
+ * Visibility: `false` = reporter-facing (the default for every narrative entry); `true` =
6338
+ * triage-internal (e.g. a `hold` rationale) — surfaced to platform admins only and NEVER
6339
+ * returned on the reporter read path. The reporter's `GET /api/reports/:id` filters these out.
6340
+ */
6341
+ internal: external_exports.boolean()
6342
+ });
6343
+ sentryRefStatusSchema = external_exports.enum(["valid", "not_found", "mismatch", "unverified"]);
6344
+ createReportBody = external_exports.object({
6345
+ title: external_exports.string().min(5).max(256),
6346
+ description: external_exports.string().min(10).max(5e3),
6347
+ steps_to_reproduce: external_exports.string().max(3e3).optional(),
6348
+ error_message: external_exports.string().max(2e3).optional(),
6349
+ // Taxonomy (server defaults: source=cli, classification=bug when absent).
6350
+ source: intakeReportSourceSchema.optional(),
6351
+ classification: reportClassificationSchema.optional(),
6352
+ // Stable dedup key (e.g. "<file>::<test>" for flaky, "<file>:<line>" for
6353
+ // security). When present, the fingerprint uses it instead of the body hash.
6354
+ dedup_key: external_exports.string().min(1).max(256).optional(),
6355
+ // Context fields (auto-captured by the CLI)
6356
+ organization_id: external_exports.string().optional(),
6357
+ hub_id: external_exports.string().uuid().optional(),
6358
+ hub_name: external_exports.string().max(256).optional(),
6359
+ conversation_id: external_exports.string().uuid().optional(),
6360
+ agent_id: external_exports.string().uuid().optional(),
6361
+ agent_name: external_exports.string().max(256).optional(),
6362
+ client_version: external_exports.string().max(64).optional(),
6363
+ additional_context: external_exports.string().max(2e3).optional()
6364
+ });
6365
+ editReportBody = external_exports.object({
6366
+ title: external_exports.string().min(5).max(256).optional(),
6367
+ description: external_exports.string().min(10).max(5e3).optional(),
6368
+ steps_to_reproduce: external_exports.string().max(3e3).optional(),
6369
+ error_message: external_exports.string().max(2e3).optional(),
6370
+ additional_context: external_exports.string().max(2e3).optional()
6371
+ }).strict().refine((b) => Object.keys(b).length > 0, {
6372
+ message: "at least one field must be provided"
6373
+ });
6374
+ reporterReportSummarySchema = external_exports.object({
6375
+ report_id: external_exports.string(),
6376
+ title: external_exports.string(),
6377
+ description: external_exports.string(),
6378
+ classification: reportClassificationSchema,
6379
+ status: reportStatusSchema,
6380
+ created_at: timestampSchema,
6381
+ triaged_at: timestampSchema.nullable(),
6382
+ resolved_at: timestampSchema.nullable(),
6383
+ /** How many times the reporter has contested (gates the hard cap). */
6384
+ contest_count: external_exports.number(),
6385
+ /** True once triage issued a non-contestable (final) dismissal. */
6386
+ dismissal_final: external_exports.boolean()
6387
+ });
6388
+ reporterListResponseSchema = external_exports.object({
6389
+ data: external_exports.array(reporterReportSummarySchema)
6390
+ });
6391
+ getReportResponseSchema = external_exports.object({
6392
+ report: reporterReportSummarySchema,
6393
+ messages: external_exports.array(reportMessageSchema)
6394
+ });
6395
+ reporterTransitionResponseSchema = external_exports.object({
6396
+ report: reporterReportSummarySchema
6397
+ });
6398
+ contestReportBody = external_exports.object({
6399
+ reason: external_exports.string().min(1).max(5e3)
6400
+ });
6401
+ reporterListQuery = external_exports.object({
6402
+ status: reportStatusSchema.optional()
6403
+ });
6404
+ listReportsQuery = external_exports.object({
6405
+ status: reportStatusSchema.optional(),
6406
+ source: reportSourceSchema.optional(),
6407
+ limit: external_exports.coerce.number().int().min(1).max(200).optional(),
6408
+ offset: external_exports.coerce.number().int().min(0).optional(),
6409
+ /** ISO 8601 lower bound on created_at. */
6410
+ since: external_exports.string().datetime().optional(),
6411
+ /**
6412
+ * ISO 8601 lower bound on resolution time — "what did we resolve recently", which `since`
6413
+ * (a created_at filter) cannot answer for a long-lived report resolved yesterday. Implies
6414
+ * a terminal status (`addressed`/`dismissed`) and orders on that same axis.
6415
+ */
6416
+ resolved_since: external_exports.string().datetime().optional()
6417
+ });
6418
+ GITHUB_ISSUE_URL_REGEX = /^https:\/\/github\.com\/[^/]+\/[^/]+\/issues\/\d+(?:[/?#]|$)/;
6419
+ githubIssueUrlSchema = external_exports.string().url().refine((u) => GITHUB_ISSUE_URL_REGEX.test(u), {
6420
+ message: "must be an https://github.com/<owner>/<repo>/issues/<number> URL"
6421
+ });
6422
+ transitionReportBody = external_exports.discriminatedUnion("target", [
6423
+ external_exports.object({
6424
+ target: external_exports.literal("escalated"),
6425
+ gh_issue_url: githubIssueUrlSchema,
6426
+ ai_verdict: external_exports.string().max(2e3).optional()
6427
+ }),
6428
+ external_exports.object({
6429
+ target: external_exports.literal("shipped"),
6430
+ note: external_exports.string().min(1).max(2e3).optional()
6431
+ }),
6432
+ external_exports.object({
6433
+ target: external_exports.literal("addressed")
6434
+ }),
6435
+ external_exports.object({
6436
+ target: external_exports.literal("dismissed"),
6437
+ dismissal_reason: external_exports.string().min(1).max(5e3),
6438
+ ai_verdict: external_exports.string().max(2e3).optional(),
6439
+ final: external_exports.boolean().optional()
6440
+ })
6441
+ ]);
6442
+ groupReportsBody = external_exports.object({
6443
+ member_ids: external_exports.array(external_exports.string().uuid()).min(1).max(100)
6444
+ });
6445
+ holdReportBody = external_exports.object({
6446
+ reason: external_exports.string().min(1).max(5e3)
6447
+ });
6448
+ }
6449
+ });
6450
+
6451
+ // ../../packages/core/dist/chunk-GPM7PE44.js
6452
+ var bootstrapQuery;
6453
+ var init_chunk_GPM7PE44 = __esm({
6454
+ "../../packages/core/dist/chunk-GPM7PE44.js"() {
6455
+ "use strict";
6456
+ init_zod();
6457
+ bootstrapQuery = external_exports.object({
6458
+ active_hub_id: external_exports.string().uuid().optional(),
6459
+ active_conversation_id: external_exports.string().uuid().optional(),
6460
+ active_nav: external_exports.enum(["chat", "task", "support"]).optional(),
6461
+ /**
6462
+ * The people thread the URL names (`/chat/threads/:threadId`, gh #4661): the snapshot
6463
+ * preloads it as `people.active_thread` when the viewer is a member.
6464
+ */
6465
+ active_thread_id: external_exports.string().uuid().optional()
6466
+ });
6467
+ }
6468
+ });
6469
+
6470
+ // ../../packages/core/dist/chunk-5VL6LBFD.js
6471
+ var PERMISSIONS;
6472
+ var init_chunk_5VL6LBFD = __esm({
6473
+ "../../packages/core/dist/chunk-5VL6LBFD.js"() {
6474
+ "use strict";
6475
+ PERMISSIONS = [
6476
+ "hub:read",
6477
+ "hub:write",
6478
+ "hub:admin",
6479
+ "conversation:read",
6480
+ "conversation:write",
6481
+ "analytics:read",
6482
+ "billing:read",
6483
+ "billing:write",
6484
+ "org:read",
6485
+ "org:write",
6486
+ "org:admin",
6487
+ "contacts:write",
6488
+ "platform:admin",
6489
+ "*"
6490
+ ];
6491
+ }
6492
+ });
6493
+
6494
+ // ../../packages/core/dist/chunk-VEERWOZ6.js
6495
+ var MAX_NAME_LENGTH2, MAX_HUBS_PER_GRANT, MAX_HUB_TAGS_PER_GRANT, MAX_GRANTS, permissionEnum, grantScopeSchema, grantSchema, createTokenBody, tokenOrgIdParam;
6496
+ var init_chunk_VEERWOZ6 = __esm({
6497
+ "../../packages/core/dist/chunk-VEERWOZ6.js"() {
6498
+ "use strict";
6499
+ init_chunk_5VL6LBFD();
6500
+ init_chunk_HZ6CADSY();
6501
+ init_zod();
6502
+ MAX_NAME_LENGTH2 = 100;
6503
+ MAX_HUBS_PER_GRANT = 50;
6504
+ MAX_HUB_TAGS_PER_GRANT = 20;
6505
+ MAX_GRANTS = 20;
6506
+ permissionEnum = external_exports.enum(PERMISSIONS).refine(
6507
+ (p) => p !== "platform:admin",
6508
+ { message: "platform:admin cannot be delegated via token creation" }
6509
+ );
6510
+ grantScopeSchema = external_exports.object({
6511
+ // Required: every token grant must declare its org tenancy. The handler
6512
+ // also strict-checks this as defense-in-depth, but failing at the Zod
6513
+ // boundary keeps the generated client type honest (org_id: string).
6514
+ org_id: external_exports.string().min(1),
6515
+ hubs: external_exports.array(external_exports.string().min(1)).min(1, "Each grant must have scope.hubs as a non-empty array").max(MAX_HUBS_PER_GRANT),
6516
+ hub_tags: external_exports.array(external_exports.string().min(1)).min(1, "scope.hub_tags must be a non-empty array if provided").max(MAX_HUB_TAGS_PER_GRANT).optional(),
6517
+ environments: external_exports.array(external_exports.enum(["production", "preview"])).min(1, "scope.environments must be a non-empty array if provided").optional()
6518
+ }).strict();
6519
+ grantSchema = external_exports.object({
6520
+ scope: grantScopeSchema,
6521
+ permissions: external_exports.array(permissionEnum).min(1, "Each grant must have permissions as a non-empty array")
6522
+ }).strict();
6523
+ createTokenBody = external_exports.object({
6524
+ name: external_exports.string().trim().min(1, "name is required").max(MAX_NAME_LENGTH2, `name must be ${MAX_NAME_LENGTH2} characters or fewer`),
6525
+ grants: external_exports.array(grantSchema).min(1, "grants must be a non-empty array").max(MAX_GRANTS),
6526
+ expires_at: external_exports.string().datetime({ message: "expires_at must be a valid ISO 8601 date" }).refine(
6527
+ (s) => new Date(s).getTime() > Date.now(),
6528
+ { message: "expires_at must be in the future" }
6529
+ ).optional()
6530
+ });
6531
+ tokenOrgIdParam = external_exports.object({ orgId: uuidSchema });
6532
+ }
6533
+ });
6534
+
6535
+ // ../../packages/core/dist/chunk-ZVXO3XL6.js
6536
+ var PEOPLE_CONTACT_PAGE_MAX, PEOPLE_CONTACT_PAGE_DEFAULT, PEOPLE_CONTACT_EMAIL_MAX_LENGTH, peopleUserIdSchema, peopleInviteEmailSchema, peopleContactInviteBody, peopleContactInviteIdParam, peopleContactUserIdParam, peopleContactBlockBody, peopleContactPageQuery, peopleOutgoingInviteSchema, peopleContactPersonSchema, peopleContactSchema, peopleIncomingInviteSchema, peopleBlockedUserSchema;
6537
+ var init_chunk_ZVXO3XL6 = __esm({
6538
+ "../../packages/core/dist/chunk-ZVXO3XL6.js"() {
6539
+ "use strict";
6540
+ init_chunk_HZ6CADSY();
6541
+ init_zod();
6542
+ PEOPLE_CONTACT_PAGE_MAX = 100;
6543
+ PEOPLE_CONTACT_PAGE_DEFAULT = 50;
6544
+ PEOPLE_CONTACT_EMAIL_MAX_LENGTH = 254;
6545
+ peopleUserIdSchema = external_exports.string().max(64).regex(USER_ID_REGEX, "must be a user id");
6546
+ peopleInviteEmailSchema = external_exports.string().trim().max(PEOPLE_CONTACT_EMAIL_MAX_LENGTH).email();
6547
+ peopleContactInviteBody = external_exports.object({
6548
+ email: peopleInviteEmailSchema
6549
+ }).strict();
6550
+ peopleContactInviteIdParam = external_exports.object({ inviteId: uuidSchema });
6551
+ peopleContactUserIdParam = external_exports.object({ userId: peopleUserIdSchema });
6552
+ peopleContactBlockBody = external_exports.object({ user_id: peopleUserIdSchema, thread_id: uuidSchema.optional(), community_id: uuidSchema.optional() }).strict().refine((body) => body.thread_id === void 0 || body.community_id === void 0, {
6553
+ message: "Name a thread or a community, not both",
6554
+ path: ["community_id"]
6555
+ });
6556
+ peopleContactPageQuery = external_exports.object({
6557
+ cursor: external_exports.string().min(1).max(256).optional(),
6558
+ limit: external_exports.coerce.number().int().min(1).max(PEOPLE_CONTACT_PAGE_MAX).default(PEOPLE_CONTACT_PAGE_DEFAULT)
6559
+ });
6560
+ peopleOutgoingInviteSchema = external_exports.object({
6561
+ invite_id: uuidSchema,
6562
+ email: external_exports.string(),
6563
+ status: external_exports.literal("sent"),
6564
+ created_at: timestampSchema,
6565
+ expires_at: timestampSchema
6566
+ }).strict();
6567
+ peopleContactPersonSchema = external_exports.object({
6568
+ user_id: peopleUserIdSchema,
6569
+ display_name: external_exports.string().nullable(),
6570
+ email: external_exports.string().nullable()
6571
+ }).strict();
6572
+ peopleContactSchema = peopleContactPersonSchema.extend({ contact_since: timestampSchema, thread_id: uuidSchema }).strict();
6573
+ peopleIncomingInviteSchema = external_exports.object({
6574
+ invite_id: uuidSchema,
6575
+ inviter: peopleContactPersonSchema,
6576
+ created_at: timestampSchema,
6577
+ expires_at: timestampSchema
6578
+ }).strict();
6579
+ peopleBlockedUserSchema = peopleContactPersonSchema.extend({ blocked_at: timestampSchema, deleted_user: external_exports.boolean() }).strict();
6580
+ }
6581
+ });
6582
+
6583
+ // ../../packages/core/dist/chunk-ZXK6N2HN.js
6584
+ var PEOPLE_MODERATION_NOTE_MAX_LENGTH, ADMIN_PEOPLE_REPORTS_PAGE_MAX, ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT, PEOPLE_SUSPENDED_REASON, peopleModerationActionSchema, moderationNoteSchema, adminPeopleReportListQuery, adminPeopleReportIdParam, adminPeopleMessageRemovalBody, adminPeopleSuspendBody, adminPeopleNoteBody;
6585
+ var init_chunk_ZXK6N2HN = __esm({
6586
+ "../../packages/core/dist/chunk-ZXK6N2HN.js"() {
6587
+ "use strict";
6588
+ init_chunk_ZVXO3XL6();
6589
+ init_chunk_HZ6CADSY();
6590
+ init_zod();
6591
+ PEOPLE_MODERATION_NOTE_MAX_LENGTH = 500;
6592
+ ADMIN_PEOPLE_REPORTS_PAGE_MAX = 100;
6593
+ ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT = 50;
6594
+ PEOPLE_SUSPENDED_REASON = "suspended";
6595
+ peopleModerationActionSchema = external_exports.enum(["remove_message", "suspend", "unsuspend", "dismiss"]);
6596
+ moderationNoteSchema = optionalTrimmedText(PEOPLE_MODERATION_NOTE_MAX_LENGTH);
6597
+ adminPeopleReportListQuery = external_exports.object({
6598
+ pending: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true"),
6599
+ /** Lower bound on `created_at`. */
6600
+ since: timestampSchema.optional(),
6601
+ limit: external_exports.coerce.number().int().min(1).max(ADMIN_PEOPLE_REPORTS_PAGE_MAX).default(ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT),
6602
+ offset: external_exports.coerce.number().int().min(0).default(0)
6603
+ });
6604
+ adminPeopleReportIdParam = external_exports.object({ reportId: uuidSchema });
6605
+ adminPeopleMessageRemovalBody = external_exports.object({ report_id: uuidSchema, message_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
6606
+ adminPeopleSuspendBody = external_exports.object({ report_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
6607
+ adminPeopleNoteBody = external_exports.object({ note: moderationNoteSchema }).strict();
6608
+ }
6609
+ });
6610
+
6611
+ // ../../packages/core/dist/chunk-Y7CFCYX4.js
6612
+ var PEOPLE_REPORT_DETAILS_MAX_LENGTH, peopleReportReasonSchema, reportDetailsSchema, reportFields, peopleReportBody;
6613
+ var init_chunk_Y7CFCYX4 = __esm({
6614
+ "../../packages/core/dist/chunk-Y7CFCYX4.js"() {
6615
+ "use strict";
6616
+ init_chunk_ZVXO3XL6();
6617
+ init_chunk_HZ6CADSY();
6618
+ init_zod();
6619
+ PEOPLE_REPORT_DETAILS_MAX_LENGTH = 500;
6620
+ peopleReportReasonSchema = external_exports.enum(["spam", "harassment", "hate", "sexual", "violence", "other"]);
6621
+ reportDetailsSchema = optionalTrimmedText(PEOPLE_REPORT_DETAILS_MAX_LENGTH);
6622
+ reportFields = { reason: peopleReportReasonSchema, details: reportDetailsSchema };
6623
+ peopleReportBody = external_exports.discriminatedUnion("target", [
6624
+ external_exports.object({ target: external_exports.literal("message"), thread_id: uuidSchema, message_id: uuidSchema, ...reportFields }).strict(),
6625
+ external_exports.object({ target: external_exports.literal("thread"), thread_id: uuidSchema, ...reportFields }).strict(),
6626
+ external_exports.object({ target: external_exports.literal("user"), user_id: peopleUserIdSchema, thread_id: uuidSchema.optional(), ...reportFields }).strict(),
6627
+ external_exports.object({
6628
+ target: external_exports.literal("community_message"),
6629
+ community_id: uuidSchema,
6630
+ room_id: uuidSchema,
6631
+ message_id: uuidSchema,
6632
+ ...reportFields
6633
+ }).strict(),
6634
+ external_exports.object({ target: external_exports.literal("community_member"), community_id: uuidSchema, user_id: peopleUserIdSchema, ...reportFields }).strict()
6635
+ ]);
6636
+ }
6637
+ });
6638
+
6639
+ // ../../packages/core/dist/chunk-LIDKVVXZ.js
6640
+ function normalizeContactPhone(raw) {
6641
+ const compact = raw.trim().replace(/[\s\-.()]/g, "");
6642
+ const withPlus = compact.startsWith("00") ? `+${compact.slice(2)}` : compact;
6643
+ return /^\+[1-9]\d{7,14}$/.test(withPlus) ? withPlus : null;
6644
+ }
6645
+ function normalizeContactLabel(raw) {
6646
+ return raw.trim().replace(/\s+/g, " ").toLowerCase();
6647
+ }
6648
+ function importRowLabels(row, batchLabels) {
6649
+ return [.../* @__PURE__ */ new Set([...row.labels ?? [], ...batchLabels ?? []])];
6650
+ }
6651
+ var CONTACT_ENVIRONMENTS, CONTACT_NAME_MAX, CONTACT_EMAIL_MAX, CONTACT_PHONE_INPUT_MAX, CONTACT_INSTAGRAM_SID_MAX, CONTACT_METADATA_MAX_BYTES, CONTACT_LABEL_MAX, CONTACT_LABELS_MAX, CONTACT_SCOPE_TAGS_MAX, CONTACT_PAGE_MAX, CONTACT_IMPORT_BATCH_MAX, CONTACT_SEARCH_MAX, CONTACT_LIST_NAME_MAX, CONTACT_LIST_NAME_REGEX, CONTACT_LIST_DESCRIPTION_MAX, CONTACT_LIST_FILTER_MAX, CONTACT_LIST_PINS_PER_REQUEST_MAX, SUPPRESSION_SCOPES, SUPPRESSION_ID_REGEX, contactName, contactPhone, contactEmail, contactInstagramSid, contactLabel, contactLabels, contactMetadata, scopeTagIds, contactVisibilitySchema, hasIdentity, IDENTITY_REQUIRED, contactBookOrgQuery, contactBookContactParam, contactBookListParam, contactBookHubParam, contactBookPageQuery, listContactBookContactsQuery, listHubContactBookContactsQuery, contactBookLinkCandidatesQuery, listContactBookListMembersQuery, contactRowFields, createContactBookContactBody, updateContactBookContactBody, contactImportRowSchema, importContactBookContactsBody, linkContactBookContactBody, CONTACT_CUSTOMER_BASE_ID_PATTERN, baseId, recordId, linkContactCustomerBody, unlinkContactCustomerQuery, listName, contactListFilterSchema, createContactBookListBody, updateContactBookListBody, updateContactBookListPinsBody, suppressionIdentitySchema, createContactBookSuppressionBody, contactBookSuppressionParam, listContactBookSuppressionsQuery, contactBookEmailUnsubscribeTokenSchema, contactBookEmailUnsubscribeQuery, orgListReferenceSchema;
6652
+ var init_chunk_LIDKVVXZ = __esm({
6653
+ "../../packages/core/dist/chunk-LIDKVVXZ.js"() {
6654
+ "use strict";
6655
+ init_zod();
6656
+ CONTACT_ENVIRONMENTS = ["production", "preview", "all"];
6657
+ CONTACT_NAME_MAX = 200;
6658
+ CONTACT_EMAIL_MAX = 320;
6659
+ CONTACT_PHONE_INPUT_MAX = 40;
6660
+ CONTACT_INSTAGRAM_SID_MAX = 64;
6661
+ CONTACT_METADATA_MAX_BYTES = 4096;
6662
+ CONTACT_LABEL_MAX = 64;
6663
+ CONTACT_LABELS_MAX = 20;
6664
+ CONTACT_SCOPE_TAGS_MAX = 20;
6665
+ CONTACT_PAGE_MAX = 100;
6666
+ CONTACT_IMPORT_BATCH_MAX = 500;
6667
+ CONTACT_SEARCH_MAX = 100;
6668
+ CONTACT_LIST_NAME_MAX = 64;
6669
+ CONTACT_LIST_NAME_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
6670
+ CONTACT_LIST_DESCRIPTION_MAX = 1e3;
6671
+ CONTACT_LIST_FILTER_MAX = 20;
6672
+ CONTACT_LIST_PINS_PER_REQUEST_MAX = 100;
6673
+ SUPPRESSION_SCOPES = ["all", "marketing"];
6674
+ SUPPRESSION_ID_REGEX = /^[0-9a-f]{64}$/;
6675
+ contactName = external_exports.string().trim().min(1).max(CONTACT_NAME_MAX);
6676
+ contactPhone = external_exports.string().max(CONTACT_PHONE_INPUT_MAX).transform((raw, ctx) => {
6677
+ const phone = normalizeContactPhone(raw);
6678
+ if (phone === null) {
6679
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Phone must be an international number, e.g. +5511999999999" });
6680
+ return external_exports.NEVER;
6681
+ }
6682
+ return phone;
6683
+ });
6684
+ contactEmail = external_exports.string().trim().toLowerCase().max(CONTACT_EMAIL_MAX).email();
6685
+ contactInstagramSid = external_exports.string().trim().min(1).max(CONTACT_INSTAGRAM_SID_MAX);
6686
+ contactLabel = external_exports.string().max(CONTACT_LABEL_MAX).transform(normalizeContactLabel).refine((label2) => label2.length > 0, "A label cannot be empty").refine((label2) => !label2.includes(","), "A label cannot contain a comma");
6687
+ contactLabels = external_exports.array(contactLabel).max(CONTACT_LABELS_MAX).transform((labels) => [...new Set(labels)]);
6688
+ contactMetadata = external_exports.record(external_exports.unknown()).refine(
6689
+ (metadata) => new TextEncoder().encode(JSON.stringify(metadata)).length <= CONTACT_METADATA_MAX_BYTES,
6690
+ `Metadata must serialize to at most ${CONTACT_METADATA_MAX_BYTES} bytes`
6691
+ );
6692
+ scopeTagIds = external_exports.array(external_exports.string().uuid()).min(1).max(CONTACT_SCOPE_TAGS_MAX).transform((ids) => [...new Set(ids)]);
6693
+ contactVisibilitySchema = external_exports.discriminatedUnion("scope", [
6694
+ external_exports.object({ scope: external_exports.literal("all_hubs") }).strict(),
6695
+ external_exports.object({ scope: external_exports.literal("tags"), tag_ids: scopeTagIds }).strict()
6696
+ ]);
6697
+ hasIdentity = (row) => Boolean(row.phone || row.email || row.instagram_sid);
6698
+ IDENTITY_REQUIRED = "A contact needs a phone, an email or an Instagram id";
6699
+ contactBookOrgQuery = external_exports.object({
6700
+ organization_id: external_exports.string().uuid()
6701
+ });
6702
+ contactBookContactParam = external_exports.object({
6703
+ contactId: external_exports.string().uuid()
6704
+ });
6705
+ contactBookListParam = external_exports.object({
6706
+ listId: external_exports.string().uuid()
6707
+ });
6708
+ contactBookHubParam = external_exports.object({
6709
+ hubId: external_exports.string().uuid()
6710
+ });
6711
+ contactBookPageQuery = external_exports.object({
6712
+ cursor: external_exports.string().max(2048).optional(),
6713
+ limit: external_exports.coerce.number().int().min(1).max(CONTACT_PAGE_MAX).default(50)
6714
+ });
6715
+ listContactBookContactsQuery = contactBookOrgQuery.merge(contactBookPageQuery).extend({
6716
+ q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional(),
6717
+ label: external_exports.string().max(CONTACT_LABEL_MAX).transform(normalizeContactLabel).optional(),
6718
+ scope_tag_id: external_exports.string().uuid().optional()
6719
+ });
6720
+ listHubContactBookContactsQuery = contactBookPageQuery.extend({
6721
+ q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional()
6722
+ });
6723
+ contactBookLinkCandidatesQuery = contactBookOrgQuery.extend({
6724
+ email: contactEmail
6725
+ });
6726
+ listContactBookListMembersQuery = contactBookOrgQuery.merge(contactBookPageQuery);
6727
+ contactRowFields = {
6728
+ name: contactName,
6729
+ phone: contactPhone.nullish(),
6730
+ email: contactEmail.nullish(),
6731
+ instagram_sid: contactInstagramSid.nullish(),
6732
+ labels: contactLabels.optional(),
6733
+ metadata: contactMetadata.optional()
6734
+ };
6735
+ createContactBookContactBody = external_exports.object({
6736
+ organization_id: external_exports.string().uuid(),
6737
+ ...contactRowFields,
6738
+ visibility: contactVisibilitySchema,
6739
+ environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
6740
+ }).strict().refine(hasIdentity, IDENTITY_REQUIRED);
6741
+ updateContactBookContactBody = external_exports.object({
6742
+ name: contactName.optional(),
6743
+ phone: contactPhone.nullable().optional(),
6744
+ email: contactEmail.nullable().optional(),
6745
+ instagram_sid: contactInstagramSid.nullable().optional(),
6746
+ labels: contactLabels.optional(),
6747
+ metadata: contactMetadata.optional(),
6748
+ visibility: contactVisibilitySchema.optional(),
6749
+ environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
6750
+ }).strict();
6751
+ contactImportRowSchema = external_exports.object(contactRowFields).strict().refine(hasIdentity, IDENTITY_REQUIRED);
6752
+ importContactBookContactsBody = external_exports.object({
6753
+ organization_id: external_exports.string().uuid(),
6754
+ visibility: contactVisibilitySchema,
6755
+ environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional(),
6756
+ labels: contactLabels.optional(),
6757
+ rows: external_exports.array(contactImportRowSchema).min(1).max(CONTACT_IMPORT_BATCH_MAX)
6758
+ }).strict().superRefine((batch, ctx) => {
6759
+ batch.rows.forEach((row, index) => {
6760
+ if (importRowLabels(row, batch.labels).length > CONTACT_LABELS_MAX) {
6761
+ ctx.addIssue({
6762
+ code: external_exports.ZodIssueCode.custom,
6763
+ path: ["rows", index, "labels"],
6764
+ message: `A contact holds at most ${CONTACT_LABELS_MAX} labels, the batch's included`
6765
+ });
6766
+ }
6767
+ });
6768
+ });
6769
+ linkContactBookContactBody = external_exports.object({
6770
+ user_id: external_exports.string().min(1).max(128)
6771
+ }).strict();
6772
+ CONTACT_CUSTOMER_BASE_ID_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;
6773
+ baseId = external_exports.string().regex(CONTACT_CUSTOMER_BASE_ID_PATTERN, { message: "Must be a base id" });
6774
+ recordId = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_\-.:]{0,254}$/, { message: "Must be a record id" });
6775
+ linkContactCustomerBody = external_exports.object({
6776
+ base_id: baseId,
6777
+ record_id: recordId
6778
+ }).strict();
6779
+ unlinkContactCustomerQuery = contactBookOrgQuery.extend({
6780
+ base_id: baseId
6781
+ });
6782
+ listName = external_exports.string().trim().min(1).max(CONTACT_LIST_NAME_MAX).regex(CONTACT_LIST_NAME_REGEX, {
6783
+ message: 'Must be lowercase alphanumeric with hyphens (e.g. "vip-customers")'
6784
+ });
6785
+ contactListFilterSchema = external_exports.object({
6786
+ labels: external_exports.array(contactLabel).max(CONTACT_LIST_FILTER_MAX).transform((l) => [...new Set(l)]).default([]),
6787
+ scope_tag_ids: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_FILTER_MAX).transform((t) => [...new Set(t)]).default([])
6788
+ }).strict();
6789
+ createContactBookListBody = external_exports.object({
6790
+ organization_id: external_exports.string().uuid(),
6791
+ name: listName,
6792
+ description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullish(),
6793
+ filter: contactListFilterSchema.optional()
6794
+ }).strict();
6795
+ updateContactBookListBody = external_exports.object({
6796
+ name: listName.optional(),
6797
+ description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullable().optional(),
6798
+ filter: contactListFilterSchema.optional()
6799
+ }).strict();
6800
+ updateContactBookListPinsBody = external_exports.object({
6801
+ add: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([]),
6802
+ remove: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([])
6803
+ }).strict().refine((b) => b.add.length + b.remove.length > 0, "Add or remove at least one contact");
6804
+ suppressionIdentitySchema = external_exports.discriminatedUnion("kind", [
6805
+ external_exports.object({ kind: external_exports.literal("phone"), value: contactPhone }).strict(),
6806
+ external_exports.object({ kind: external_exports.literal("email"), value: contactEmail }).strict(),
6807
+ external_exports.object({ kind: external_exports.literal("instagram"), value: contactInstagramSid }).strict()
6808
+ ]);
6809
+ createContactBookSuppressionBody = external_exports.object({
6810
+ organization_id: external_exports.string().uuid(),
6811
+ identity: suppressionIdentitySchema,
6812
+ scope: external_exports.enum(SUPPRESSION_SCOPES)
6813
+ }).strict();
6814
+ contactBookSuppressionParam = external_exports.object({
6815
+ suppressionId: external_exports.string().regex(SUPPRESSION_ID_REGEX)
6816
+ });
6817
+ listContactBookSuppressionsQuery = contactBookOrgQuery.merge(contactBookPageQuery);
6818
+ contactBookEmailUnsubscribeTokenSchema = external_exports.string().max(200).regex(/^[0-9a-f-]{36}\.[0-9a-f]{64}\.[0-9a-f]{64}$/i);
6819
+ contactBookEmailUnsubscribeQuery = external_exports.object({ token: contactBookEmailUnsubscribeTokenSchema });
6820
+ orgListReferenceSchema = listName;
6821
+ }
6822
+ });
6823
+
6824
+ // ../../packages/core/dist/chunk-DGTJX3C4.js
6825
+ var PERSON_ID_PATTERN, CONTACT_PERSON_ID_PATTERN, PERSON_DENY_PAGE_MAX, PERSON_ID_FORM_MESSAGE, userPersonIdSchema, personIdSchema, personParam, personLinkParam, deniedPersonParam, listDeniedPersonsQuery;
6826
+ var init_chunk_DGTJX3C4 = __esm({
6827
+ "../../packages/core/dist/chunk-DGTJX3C4.js"() {
6828
+ "use strict";
6829
+ init_chunk_LIDKVVXZ();
6830
+ init_zod();
6831
+ PERSON_ID_PATTERN = /^prs_[a-z2-7]{52}$/;
6832
+ CONTACT_PERSON_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
6833
+ PERSON_DENY_PAGE_MAX = 100;
6834
+ PERSON_ID_FORM_MESSAGE = "Must be a person id (prs_\u2026) or a contact id (a lowercase UUID)";
6835
+ userPersonIdSchema = external_exports.string().regex(PERSON_ID_PATTERN, { message: "Must be a person id (prs_\u2026)" });
6836
+ personIdSchema = external_exports.string().refine(
6837
+ (value) => PERSON_ID_PATTERN.test(value) || CONTACT_PERSON_ID_PATTERN.test(value),
6838
+ { message: PERSON_ID_FORM_MESSAGE }
6839
+ );
6840
+ personParam = external_exports.object({
6841
+ personId: userPersonIdSchema
6842
+ });
6843
+ personLinkParam = personParam.extend({
6844
+ targetId: personIdSchema
6845
+ });
6846
+ deniedPersonParam = external_exports.object({
6847
+ personId: personIdSchema
6848
+ });
6849
+ listDeniedPersonsQuery = contactBookOrgQuery.extend({
6850
+ cursor: personIdSchema.optional(),
6851
+ limit: external_exports.coerce.number().int().min(1).max(PERSON_DENY_PAGE_MAX).default(50)
6852
+ });
6853
+ }
6854
+ });
6855
+
6856
+ // ../../packages/core/dist/chunk-5DGHIY7L.js
6857
+ var rekorBaseChangeMessageSchema;
6858
+ var init_chunk_5DGHIY7L = __esm({
6859
+ "../../packages/core/dist/chunk-5DGHIY7L.js"() {
6860
+ "use strict";
6861
+ init_zod();
6862
+ rekorBaseChangeMessageSchema = external_exports.object({
6863
+ /** The WayAI org UUID — one id namespace. */
6864
+ org_id: external_exports.string().uuid(),
6865
+ /**
6866
+ * Not a UUID: a preview base id is `{prod_base_id}--{slug}`. Immutable per base — a
6867
+ * preview clone is its OWN base_id — so `(base_id, scope)` keys never collide across
6868
+ * environments. Empty is never a real base id, so it is non-conforming rather than a
6869
+ * frame keyed on nothing.
6870
+ */
6871
+ base_id: external_exports.string().min(1),
6872
+ /**
6873
+ * Rides along so the client scopes its refetch without a lookup; the inspector scopes
6874
+ * by side.
6875
+ */
6876
+ environment: external_exports.enum(["production", "preview"]),
6877
+ /** Which pane refetches. `base` covers create/delete/promote/config changes. */
6878
+ scope: external_exports.enum(["records", "record_types", "files", "base"])
6879
+ });
6880
+ }
6881
+ });
6882
+
6666
6883
  // ../../packages/core/dist/chunk-YUZFHVB2.js
6667
6884
  var invitePreviewQuery, inviteRolePreviewResponse, inviteContactPreviewResponse, invitePreviewResponse, inviteUnsubscribeBody;
6668
6885
  var init_chunk_YUZFHVB2 = __esm({
@@ -6781,10 +6998,10 @@ var init_chunk_FPSDNS2E = __esm({
6781
6998
  }
6782
6999
  });
6783
7000
 
6784
- // ../../packages/core/dist/chunk-Z2DCDLGA.js
7001
+ // ../../packages/core/dist/chunk-BNHJNSAJ.js
6785
7002
  var REKOR_ACTOR_TYPE_HEADER, REKOR_ACTOR_ID_HEADER, REKOR_ACTOR_LABEL_HEADER, REKOR_ACTOR_ORG_HEADER, REKOR_ACTOR_ADMIN_HEADER, REKOR_CLIENT_HEADER, REKOR_TOOL_ID_HEADER, REKOR_CLIENTS, rekorClientSchema, MAX_REKOR_TOOL_ID_LENGTH, rekorToolIdSchema, REKOR_V1_PREFIX, DATA_PROXY_ORG_QUERY_PARAM, MAX_PROVISIONING_BODY_BYTES, dataProxyQuery, rekorAttestation, REQUIRED_REKOR_ATTESTATION_HEADERS, REKOR_BOUND_BASE_HEADER, REKOR_BOUND_TOOLSET_HEADER, REKOR_BOUND_TOKEN_HEADER, REKOR_BOUND_CUSTOMER_HEADER, REKOR_BOUND_ACCESS_HEADER, REKOR_BOUND_ACCESS_SCOPE_HEADER, REKOR_BOUND_PAGE_HEADER, REKOR_BOUND_PERSON_HEADER, REKOR_PERSON_AUDIENCE_STAFF, REKOR_PERSON_AUDIENCE_CUSTOMER, REKOR_PERSON_ALL, REKOR_ACCESS_SCOPE_CUSTOMER, DATA_BASE_GENERATION_HEADER, REKOR_MAX_ACTOR_ID_LENGTH, REKOR_MAX_ACTOR_LABEL_LENGTH, REKOR_MAX_ACCESS_DIMENSIONS, REKOR_MAX_ACCESS_VALUES, REKOR_MAX_ACCESS_ID_LENGTH, REKOR_MAX_ACCESS_HEADER_LENGTH, REKOR_MAX_PERSON_PARTIES, REKOR_MAX_PERSON_IDS, REKOR_MAX_PERSON_ID_LENGTH, REKOR_MAX_PERSON_HEADER_LENGTH;
6786
- var init_chunk_Z2DCDLGA = __esm({
6787
- "../../packages/core/dist/chunk-Z2DCDLGA.js"() {
7003
+ var init_chunk_BNHJNSAJ = __esm({
7004
+ "../../packages/core/dist/chunk-BNHJNSAJ.js"() {
6788
7005
  "use strict";
6789
7006
  init_zod();
6790
7007
  REKOR_ACTOR_TYPE_HEADER = "X-Rekor-Actor-Type";
@@ -6840,7 +7057,7 @@ var init_chunk_Z2DCDLGA = __esm({
6840
7057
  }
6841
7058
  });
6842
7059
 
6843
- // ../../packages/core/dist/chunk-4WAW72DX.js
7060
+ // ../../packages/core/dist/chunk-RCMBGK4O.js
6844
7061
  function isPersonAccessAll(lists) {
6845
7062
  return lists !== void 0 && lists.read.length === 1 && lists.read[0] === ACCESS_UNRESTRICTED && lists.write.length === 1 && lists.write[0] === ACCESS_UNRESTRICTED;
6846
7063
  }
@@ -6878,10 +7095,10 @@ function assignmentHasUnrestricted(assignment) {
6878
7095
  return Object.values(assignment).some((lists) => lists.read.includes(ACCESS_UNRESTRICTED) || lists.write.includes(ACCESS_UNRESTRICTED));
6879
7096
  }
6880
7097
  var ACCESS_UNRESTRICTED, ACCESS_ID_REGEX, ACCESS_ID_MAX_LENGTH, MAX_ACCESS_DIMENSIONS_PER_ORG, MAX_ACCESS_VALUES_PER_DIMENSION, ACCESS_LABEL_MAX_LENGTH, accessIdSchema, accessLabelSchema, accessValueListSchema, accessListsSchema, accessAssignmentSchema, PERSON_ACCESS_KEY, heldAccessKeySchema, heldAccessAssignmentSchema, AGENT_PERSON_ACCESS_REFUSAL, accessSetSchema, accessDimensionParam, accessValueParam, orgMemberParam, orgHubParam, createAccessDimensionBody, updateAccessDimensionBody, createAccessValueBody, updateAccessValueBody, setMemberAccessValuesBody, HUB_PERSON_KINDS, ACCESS_PERSON_KINDS, setHubUserAccessValuesBody, setHubAccessValuesBody, setAgentAccessValuesBody;
6881
- var init_chunk_4WAW72DX = __esm({
6882
- "../../packages/core/dist/chunk-4WAW72DX.js"() {
7098
+ var init_chunk_RCMBGK4O = __esm({
7099
+ "../../packages/core/dist/chunk-RCMBGK4O.js"() {
6883
7100
  "use strict";
6884
- init_chunk_Z2DCDLGA();
7101
+ init_chunk_BNHJNSAJ();
6885
7102
  init_chunk_HZ6CADSY();
6886
7103
  init_chunk_YROEDMVZ();
6887
7104
  init_zod();
@@ -6972,7 +7189,7 @@ var init_chunk_4WAW72DX = __esm({
6972
7189
  }
6973
7190
  });
6974
7191
 
6975
- // ../../packages/core/dist/chunk-FTMUTHML.js
7192
+ // ../../packages/core/dist/chunk-LKD6ISTP.js
6976
7193
  function isEncodedBoundPerson(raw) {
6977
7194
  let parsed;
6978
7195
  try {
@@ -6983,11 +7200,11 @@ function isEncodedBoundPerson(raw) {
6983
7200
  return rekorBoundPersonSchema.safeParse(parsed).success;
6984
7201
  }
6985
7202
  var TOOLSET_SLUG_PATTERN, REKOR_STRUCTURAL_ID_PATTERN, baseEnvironmentSchema, toolsetFileToolSchema, toolsetSurfaceSchema, toolsetConnectionBindingSchema, rekorToolsetToolsSchema, rekorPersonIdSchema, rekorPersonAudienceSchema, rekorBoundPersonSchema, rekorBoundAttestation, rekorResolvedToolsetSchema, REKOR_TOOL_KINDS_PARAM, REKOR_TOOL_KINDS_RESOLVE_SEARCH, resolvedRecordTypeSchema, reviewWritersSchema, sharedScopeSchema, resolvedFileToolSchema, rekorToolsetFileSchema, rekorToolsetFileUrlAnswerSchema, rekorToolsetFileListSchema, rekorToolsetFileGetSchema, rekorToolsetFilePutSchema, TOOLSET_CUSTOMER_FACING_REFUSAL_MARK, TOOLSET_CUSTOMER_FACING_REFUSAL;
6986
- var init_chunk_FTMUTHML = __esm({
6987
- "../../packages/core/dist/chunk-FTMUTHML.js"() {
7203
+ var init_chunk_LKD6ISTP = __esm({
7204
+ "../../packages/core/dist/chunk-LKD6ISTP.js"() {
6988
7205
  "use strict";
6989
- init_chunk_4WAW72DX();
6990
- init_chunk_Z2DCDLGA();
7206
+ init_chunk_RCMBGK4O();
7207
+ init_chunk_BNHJNSAJ();
6991
7208
  init_zod();
6992
7209
  TOOLSET_SLUG_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;
6993
7210
  REKOR_STRUCTURAL_ID_PATTERN = TOOLSET_SLUG_PATTERN;
@@ -7133,7 +7350,8 @@ var init_chunk_FTMUTHML = __esm({
7133
7350
  /**
7134
7351
  * The persons the call is for (#5473 §9): their header text (`encodeBoundPerson`), within the far side's
7135
7352
  * header cap. Every tool call carries it beside its access set (`apps/backend/src/rekor/access-set.ts`); the
7136
- * config reads do not. The far side holds a staff call's reads and writes of a person-ruled record type to its parties.
7353
+ * config reads do not. The far side holds a call's reads and writes of a person-ruled record type to its parties,
7354
+ * whatever its audience, and a customer-facing call to its audience gate (#5473 2a).
7137
7355
  */
7138
7356
  [REKOR_BOUND_PERSON_HEADER]: external_exports.string().max(REKOR_MAX_PERSON_HEADER_LENGTH).refine(isEncodedBoundPerson, {
7139
7357
  message: "Not the persons a bound call is for"
@@ -7455,14 +7673,14 @@ var init_chunk_WEXVYJ5H = __esm({
7455
7673
  });
7456
7674
 
7457
7675
  // ../../packages/core/dist/chunk-VFDRJV2E.js
7458
- function utf8ByteLength(text3) {
7676
+ function utf8ByteLength(text4) {
7459
7677
  let bytes = 0;
7460
- for (let i = 0; i < text3.length; i++) {
7461
- const code = text3.charCodeAt(i);
7678
+ for (let i = 0; i < text4.length; i++) {
7679
+ const code = text4.charCodeAt(i);
7462
7680
  if (code < 128) bytes += 1;
7463
7681
  else if (code < 2048) bytes += 2;
7464
- else if (code >= 55296 && code <= 56319 && i + 1 < text3.length) {
7465
- const next = text3.charCodeAt(i + 1);
7682
+ else if (code >= 55296 && code <= 56319 && i + 1 < text4.length) {
7683
+ const next = text4.charCodeAt(i + 1);
7466
7684
  if (next >= 56320 && next <= 57343) {
7467
7685
  bytes += 4;
7468
7686
  i += 1;
@@ -7625,12 +7843,12 @@ var init_chunk_VFDRJV2E = __esm({
7625
7843
  }
7626
7844
  });
7627
7845
 
7628
- // ../../packages/core/dist/chunk-7PYRMHTA.js
7846
+ // ../../packages/core/dist/chunk-6LEP2CEL.js
7629
7847
  var hubPageWatchParam, pageWatchedBaseSchema, hubPageWatchResponseSchema;
7630
- var init_chunk_7PYRMHTA = __esm({
7631
- "../../packages/core/dist/chunk-7PYRMHTA.js"() {
7848
+ var init_chunk_6LEP2CEL = __esm({
7849
+ "../../packages/core/dist/chunk-6LEP2CEL.js"() {
7632
7850
  "use strict";
7633
- init_chunk_FTMUTHML();
7851
+ init_chunk_LKD6ISTP();
7634
7852
  init_chunk_VFDRJV2E();
7635
7853
  init_chunk_HZ6CADSY();
7636
7854
  init_zod();
@@ -11655,191 +11873,6 @@ var init_chunk_IR2NOSI3 = __esm({
11655
11873
  }
11656
11874
  });
11657
11875
 
11658
- // ../../packages/core/dist/chunk-THM6ALTK.js
11659
- function normalizeContactPhone(raw) {
11660
- const compact = raw.trim().replace(/[\s\-.()]/g, "");
11661
- const withPlus = compact.startsWith("00") ? `+${compact.slice(2)}` : compact;
11662
- return /^\+[1-9]\d{7,14}$/.test(withPlus) ? withPlus : null;
11663
- }
11664
- function normalizeContactLabel(raw) {
11665
- return raw.trim().replace(/\s+/g, " ").toLowerCase();
11666
- }
11667
- function importRowLabels(row, batchLabels) {
11668
- return [.../* @__PURE__ */ new Set([...row.labels ?? [], ...batchLabels ?? []])];
11669
- }
11670
- var CONTACT_ENVIRONMENTS, CONTACT_NAME_MAX, CONTACT_EMAIL_MAX, CONTACT_PHONE_INPUT_MAX, CONTACT_INSTAGRAM_SID_MAX, CONTACT_METADATA_MAX_BYTES, CONTACT_LABEL_MAX, CONTACT_LABELS_MAX, CONTACT_SCOPE_TAGS_MAX, CONTACT_PAGE_MAX, CONTACT_IMPORT_BATCH_MAX, CONTACT_SEARCH_MAX, CONTACT_LIST_NAME_MAX, CONTACT_LIST_NAME_REGEX, CONTACT_LIST_DESCRIPTION_MAX, CONTACT_LIST_FILTER_MAX, CONTACT_LIST_PINS_PER_REQUEST_MAX, SUPPRESSION_SCOPES, SUPPRESSION_ID_REGEX, contactName, contactPhone, contactEmail, contactInstagramSid, contactLabel, contactLabels, contactMetadata, scopeTagIds, contactVisibilitySchema, hasIdentity, IDENTITY_REQUIRED, contactBookOrgQuery, contactBookContactParam, contactBookListParam, contactBookHubParam, contactBookPageQuery, listContactBookContactsQuery, listHubContactBookContactsQuery, contactBookLinkCandidatesQuery, listContactBookListMembersQuery, contactRowFields, createContactBookContactBody, updateContactBookContactBody, contactImportRowSchema, importContactBookContactsBody, linkContactBookContactBody, CONTACT_CUSTOMER_BASE_ID_PATTERN, baseId, recordId, linkContactCustomerBody, unlinkContactCustomerQuery, listName, contactListFilterSchema, createContactBookListBody, updateContactBookListBody, updateContactBookListPinsBody, suppressionIdentitySchema, createContactBookSuppressionBody, contactBookSuppressionParam, listContactBookSuppressionsQuery, contactBookEmailUnsubscribeTokenSchema, contactBookEmailUnsubscribeQuery, orgListReferenceSchema;
11671
- var init_chunk_THM6ALTK = __esm({
11672
- "../../packages/core/dist/chunk-THM6ALTK.js"() {
11673
- "use strict";
11674
- init_zod();
11675
- CONTACT_ENVIRONMENTS = ["production", "preview", "all"];
11676
- CONTACT_NAME_MAX = 200;
11677
- CONTACT_EMAIL_MAX = 320;
11678
- CONTACT_PHONE_INPUT_MAX = 40;
11679
- CONTACT_INSTAGRAM_SID_MAX = 64;
11680
- CONTACT_METADATA_MAX_BYTES = 4096;
11681
- CONTACT_LABEL_MAX = 64;
11682
- CONTACT_LABELS_MAX = 20;
11683
- CONTACT_SCOPE_TAGS_MAX = 20;
11684
- CONTACT_PAGE_MAX = 100;
11685
- CONTACT_IMPORT_BATCH_MAX = 500;
11686
- CONTACT_SEARCH_MAX = 100;
11687
- CONTACT_LIST_NAME_MAX = 64;
11688
- CONTACT_LIST_NAME_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
11689
- CONTACT_LIST_DESCRIPTION_MAX = 1e3;
11690
- CONTACT_LIST_FILTER_MAX = 20;
11691
- CONTACT_LIST_PINS_PER_REQUEST_MAX = 100;
11692
- SUPPRESSION_SCOPES = ["all", "marketing"];
11693
- SUPPRESSION_ID_REGEX = /^[0-9a-f]{64}$/;
11694
- contactName = external_exports.string().trim().min(1).max(CONTACT_NAME_MAX);
11695
- contactPhone = external_exports.string().max(CONTACT_PHONE_INPUT_MAX).transform((raw, ctx) => {
11696
- const phone = normalizeContactPhone(raw);
11697
- if (phone === null) {
11698
- ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Phone must be an international number, e.g. +5511999999999" });
11699
- return external_exports.NEVER;
11700
- }
11701
- return phone;
11702
- });
11703
- contactEmail = external_exports.string().trim().toLowerCase().max(CONTACT_EMAIL_MAX).email();
11704
- contactInstagramSid = external_exports.string().trim().min(1).max(CONTACT_INSTAGRAM_SID_MAX);
11705
- contactLabel = external_exports.string().max(CONTACT_LABEL_MAX).transform(normalizeContactLabel).refine((label2) => label2.length > 0, "A label cannot be empty").refine((label2) => !label2.includes(","), "A label cannot contain a comma");
11706
- contactLabels = external_exports.array(contactLabel).max(CONTACT_LABELS_MAX).transform((labels) => [...new Set(labels)]);
11707
- contactMetadata = external_exports.record(external_exports.unknown()).refine(
11708
- (metadata) => new TextEncoder().encode(JSON.stringify(metadata)).length <= CONTACT_METADATA_MAX_BYTES,
11709
- `Metadata must serialize to at most ${CONTACT_METADATA_MAX_BYTES} bytes`
11710
- );
11711
- scopeTagIds = external_exports.array(external_exports.string().uuid()).min(1).max(CONTACT_SCOPE_TAGS_MAX).transform((ids) => [...new Set(ids)]);
11712
- contactVisibilitySchema = external_exports.discriminatedUnion("scope", [
11713
- external_exports.object({ scope: external_exports.literal("all_hubs") }).strict(),
11714
- external_exports.object({ scope: external_exports.literal("tags"), tag_ids: scopeTagIds }).strict()
11715
- ]);
11716
- hasIdentity = (row) => Boolean(row.phone || row.email || row.instagram_sid);
11717
- IDENTITY_REQUIRED = "A contact needs a phone, an email or an Instagram id";
11718
- contactBookOrgQuery = external_exports.object({
11719
- organization_id: external_exports.string().uuid()
11720
- });
11721
- contactBookContactParam = external_exports.object({
11722
- contactId: external_exports.string().uuid()
11723
- });
11724
- contactBookListParam = external_exports.object({
11725
- listId: external_exports.string().uuid()
11726
- });
11727
- contactBookHubParam = external_exports.object({
11728
- hubId: external_exports.string().uuid()
11729
- });
11730
- contactBookPageQuery = external_exports.object({
11731
- cursor: external_exports.string().max(2048).optional(),
11732
- limit: external_exports.coerce.number().int().min(1).max(CONTACT_PAGE_MAX).default(50)
11733
- });
11734
- listContactBookContactsQuery = contactBookOrgQuery.merge(contactBookPageQuery).extend({
11735
- q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional(),
11736
- label: external_exports.string().max(CONTACT_LABEL_MAX).transform(normalizeContactLabel).optional(),
11737
- scope_tag_id: external_exports.string().uuid().optional()
11738
- });
11739
- listHubContactBookContactsQuery = contactBookPageQuery.extend({
11740
- q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional()
11741
- });
11742
- contactBookLinkCandidatesQuery = contactBookOrgQuery.extend({
11743
- email: contactEmail
11744
- });
11745
- listContactBookListMembersQuery = contactBookOrgQuery.merge(contactBookPageQuery);
11746
- contactRowFields = {
11747
- name: contactName,
11748
- phone: contactPhone.nullish(),
11749
- email: contactEmail.nullish(),
11750
- instagram_sid: contactInstagramSid.nullish(),
11751
- labels: contactLabels.optional(),
11752
- metadata: contactMetadata.optional()
11753
- };
11754
- createContactBookContactBody = external_exports.object({
11755
- organization_id: external_exports.string().uuid(),
11756
- ...contactRowFields,
11757
- visibility: contactVisibilitySchema,
11758
- environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
11759
- }).strict().refine(hasIdentity, IDENTITY_REQUIRED);
11760
- updateContactBookContactBody = external_exports.object({
11761
- name: contactName.optional(),
11762
- phone: contactPhone.nullable().optional(),
11763
- email: contactEmail.nullable().optional(),
11764
- instagram_sid: contactInstagramSid.nullable().optional(),
11765
- labels: contactLabels.optional(),
11766
- metadata: contactMetadata.optional(),
11767
- visibility: contactVisibilitySchema.optional(),
11768
- environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
11769
- }).strict();
11770
- contactImportRowSchema = external_exports.object(contactRowFields).strict().refine(hasIdentity, IDENTITY_REQUIRED);
11771
- importContactBookContactsBody = external_exports.object({
11772
- organization_id: external_exports.string().uuid(),
11773
- visibility: contactVisibilitySchema,
11774
- environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional(),
11775
- labels: contactLabels.optional(),
11776
- rows: external_exports.array(contactImportRowSchema).min(1).max(CONTACT_IMPORT_BATCH_MAX)
11777
- }).strict().superRefine((batch, ctx) => {
11778
- batch.rows.forEach((row, index) => {
11779
- if (importRowLabels(row, batch.labels).length > CONTACT_LABELS_MAX) {
11780
- ctx.addIssue({
11781
- code: external_exports.ZodIssueCode.custom,
11782
- path: ["rows", index, "labels"],
11783
- message: `A contact holds at most ${CONTACT_LABELS_MAX} labels, the batch's included`
11784
- });
11785
- }
11786
- });
11787
- });
11788
- linkContactBookContactBody = external_exports.object({
11789
- user_id: external_exports.string().min(1).max(128)
11790
- }).strict();
11791
- CONTACT_CUSTOMER_BASE_ID_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;
11792
- baseId = external_exports.string().regex(CONTACT_CUSTOMER_BASE_ID_PATTERN, { message: "Must be a base id" });
11793
- recordId = external_exports.string().regex(/^[a-zA-Z0-9][a-zA-Z0-9_\-.:]{0,254}$/, { message: "Must be a record id" });
11794
- linkContactCustomerBody = external_exports.object({
11795
- base_id: baseId,
11796
- record_id: recordId
11797
- }).strict();
11798
- unlinkContactCustomerQuery = contactBookOrgQuery.extend({
11799
- base_id: baseId
11800
- });
11801
- listName = external_exports.string().trim().min(1).max(CONTACT_LIST_NAME_MAX).regex(CONTACT_LIST_NAME_REGEX, {
11802
- message: 'Must be lowercase alphanumeric with hyphens (e.g. "vip-customers")'
11803
- });
11804
- contactListFilterSchema = external_exports.object({
11805
- labels: external_exports.array(contactLabel).max(CONTACT_LIST_FILTER_MAX).transform((l) => [...new Set(l)]).default([]),
11806
- scope_tag_ids: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_FILTER_MAX).transform((t) => [...new Set(t)]).default([])
11807
- }).strict();
11808
- createContactBookListBody = external_exports.object({
11809
- organization_id: external_exports.string().uuid(),
11810
- name: listName,
11811
- description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullish(),
11812
- filter: contactListFilterSchema.optional()
11813
- }).strict();
11814
- updateContactBookListBody = external_exports.object({
11815
- name: listName.optional(),
11816
- description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullable().optional(),
11817
- filter: contactListFilterSchema.optional()
11818
- }).strict();
11819
- updateContactBookListPinsBody = external_exports.object({
11820
- add: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([]),
11821
- remove: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([])
11822
- }).strict().refine((b) => b.add.length + b.remove.length > 0, "Add or remove at least one contact");
11823
- suppressionIdentitySchema = external_exports.discriminatedUnion("kind", [
11824
- external_exports.object({ kind: external_exports.literal("phone"), value: contactPhone }).strict(),
11825
- external_exports.object({ kind: external_exports.literal("email"), value: contactEmail }).strict(),
11826
- external_exports.object({ kind: external_exports.literal("instagram"), value: contactInstagramSid }).strict()
11827
- ]);
11828
- createContactBookSuppressionBody = external_exports.object({
11829
- organization_id: external_exports.string().uuid(),
11830
- identity: suppressionIdentitySchema,
11831
- scope: external_exports.enum(SUPPRESSION_SCOPES)
11832
- }).strict();
11833
- contactBookSuppressionParam = external_exports.object({
11834
- suppressionId: external_exports.string().regex(SUPPRESSION_ID_REGEX)
11835
- });
11836
- listContactBookSuppressionsQuery = contactBookOrgQuery.merge(contactBookPageQuery);
11837
- contactBookEmailUnsubscribeTokenSchema = external_exports.string().max(200).regex(/^[0-9a-f-]{36}\.[0-9a-f]{64}\.[0-9a-f]{64}$/i);
11838
- contactBookEmailUnsubscribeQuery = external_exports.object({ token: contactBookEmailUnsubscribeTokenSchema });
11839
- orgListReferenceSchema = listName;
11840
- }
11841
- });
11842
-
11843
11876
  // ../../packages/core/dist/chunk-6J742GLA.js
11844
11877
  var PEOPLE_THREAD_MESSAGE_MAX_LENGTH, PEOPLE_THREAD_MESSAGES_PAGE_MAX, PEOPLE_THREAD_PAGE_MAX, PEOPLE_THREAD_PAGE_DEFAULT, PEOPLE_GROUP_NAME_MAX_LENGTH, PEOPLE_GROUP_AVATAR_URL_MAX_LENGTH, PEOPLE_THREAD_ATTACHMENT_MAX_BYTES, PEOPLE_THREAD_ATTACHMENT_NAME_MAX_LENGTH, PEOPLE_ATTACHMENT_STORAGE_PER_USER_BYTES, PEOPLE_THREAD_ATTACHMENT_MAX_MB, PEOPLE_THREAD_ATTACHMENT_URL_TTL_SECONDS, PEOPLE_THREAD_ATTACHMENT_URLS_MAX, peopleThreadIdParam, peopleThreadMessageIdParam, peopleThreadListQuery, peopleThreadMessagesQuery, peopleThreadAttachmentUploadSchema, peopleThreadSendBody, peopleThreadAttachmentUrlsBody, peopleThreadReadBody, peopleThreadSettingsBody, peopleGroupNameSchema, peopleGroupAvatarUrlSchema, peopleGroupCreateBody, peopleOrgDirectBody, peopleGroupUpdateBody, peopleGroupInviteBody, peopleOrgErasureBody, peopleGroupLeaveBody, peopleGroupInviteIdParam, peopleGroupIncomingInviteIdParam, peopleGroupMemberParam, peopleThreadKindSchema, peopleThreadMemberSchema, peopleThreadLastMessageSchema, peopleGroupRoleSchema, peopleGroupSummarySchema, peopleThreadSummarySchema, peopleThreadAttachmentSchema, peopleThreadMessageSchema, peopleGroupMemberSchema, peopleGroupSentInviteSchema, peopleGroupIncomingInviteSchema;
11845
11878
  var init_chunk_6J742GLA = __esm({
@@ -11992,12 +12025,12 @@ var init_chunk_6J742GLA = __esm({
11992
12025
  }
11993
12026
  });
11994
12027
 
11995
- // ../../packages/core/dist/chunk-3LLEDXPM.js
12028
+ // ../../packages/core/dist/chunk-PIOPQ5UH.js
11996
12029
  var COMMUNITIES_PER_ORG_MAX, COMMUNITY_NAME_MAX_LENGTH, COMMUNITY_REGISTRY_CLOSED_REASON, COMMUNITY_MEMBERS_MAX, COMMUNITY_ADMISSIONS, COMMUNITY_ACCESS_MAX, COMMUNITY_ACCESS_ADD_MAX, COMMUNITY_ACCESS_FULL_REASON, COMMUNITY_JOIN_SOURCE_MAX_LENGTH, COMMUNITY_JOIN_FLOW_TOKEN_MAX_LENGTH, COMMUNITY_ROOMS_MAX, COMMUNITY_ROOM_NAME_MAX_LENGTH, COMMUNITY_MESSAGE_MAX_LENGTH, COMMUNITY_MESSAGES_PAGE_SIZE, COMMUNITY_ATTACHMENT_URLS_MAX, COMMUNITY_POST_TITLE_MAX_LENGTH, COMMUNITY_POST_SEARCH_MAX_LENGTH, COMMUNITY_MEMBER_STATUSES, COMMUNITY_RULES_MAX_LENGTH, COMMUNITY_SLOW_MODE_MAX_SECONDS, COMMUNITY_COURSES_LABEL_MAX_LENGTH, COMMUNITY_LIVE_TICKET_PREFIX, COMMUNITY_STATS_DAYS, communityNameSchema, adminCreateCommunityBody, communityIdParam, communityJoinTokenSchema, communityJoinSourceSchema, communityJoinPreviewQuery, communityJoinBody, communityRoomKindSchema, communityRoomNameSchema, communityRoomIdParam, communityMessageIdParam, communityRoomCreateBody, communityRoomUpdateBody, communityMessagesQuery, communityMessageBodySchema, communityPostTitleSchema, communityAttachmentUploadSchema, communitySendBody, communityEditBody, communityPostIdParam, communityPostsQuery, communityAnswerBody, communityReadBody, communityAttachmentUrlsBody, communityPersonParam, communityOrgParam, communityPeopleQuery, communityCoursesLabelSchema, communityAdmissionSchema, communitySettingsBody, communityAccessEmailSchema, communityAccessAddBody, communityAccessQuery, communityAccessIdParam, communityBanBody, communityLockBody, communityPinBody, communityModLogQuery, communityReportsQuery, communityReportIdParam, communityLiveTicketSchema, communityLiveQuery, communityMuteBody, communityEmailUnsubscribeTokenSchema, communityEmailUnsubscribeQuery;
11997
- var init_chunk_3LLEDXPM = __esm({
11998
- "../../packages/core/dist/chunk-3LLEDXPM.js"() {
12030
+ var init_chunk_PIOPQ5UH = __esm({
12031
+ "../../packages/core/dist/chunk-PIOPQ5UH.js"() {
11999
12032
  "use strict";
12000
- init_chunk_THM6ALTK();
12033
+ init_chunk_LIDKVVXZ();
12001
12034
  init_chunk_6J742GLA();
12002
12035
  init_chunk_ZVXO3XL6();
12003
12036
  init_chunk_HZ6CADSY();
@@ -12101,7 +12134,7 @@ var init_chunk_3LLEDXPM = __esm({
12101
12134
  }
12102
12135
  });
12103
12136
 
12104
- // ../../packages/core/dist/chunk-FUIWYKHJ.js
12137
+ // ../../packages/core/dist/chunk-7LLIQ4UF.js
12105
12138
  function parseCommunityLessonVideoUrl(url) {
12106
12139
  const parts = /^https?:\/\/([^/?#]+)([^?#]*)(?:\?([^#]*))?(?:#.*)?$/i.exec(url.trim());
12107
12140
  if (!parts) return null;
@@ -12127,10 +12160,10 @@ function communityLessonVideoWatchUrl(video) {
12127
12160
  }
12128
12161
  }
12129
12162
  var COMMUNITY_COURSES_MAX, COMMUNITY_COURSE_MODULES_MAX, COMMUNITY_COURSE_LESSONS_MAX, COMMUNITY_LESSONS_MAX, COMMUNITY_COURSE_TITLE_MAX_LENGTH, COMMUNITY_COURSE_DESCRIPTION_MAX_LENGTH, COMMUNITY_LESSON_BODY_MAX_LENGTH, COMMUNITY_LESSON_LINKS_MAX, COMMUNITY_LESSON_URL_MAX_LENGTH, YOUTUBE_ID, YOUTUBE_HOSTS, YOUTU_BE, YOUTUBE_ID_PATH, communityCourseIdParam, communityCourseModuleIdParam, communityLessonIdParam, communityCourseTitleSchema, communityCourseDescriptionSchema, communityCoursePositionSchema, communityLessonVideoUrlSchema, communityLessonLinkSchema, communityLessonLinksSchema, communityLessonBodySchema, communityCourseCreateBody, communityCourseUpdateBody, communityModuleCreateBody, communityModuleUpdateBody, communityLessonCreateBody, communityLessonUpdateBody;
12130
- var init_chunk_FUIWYKHJ = __esm({
12131
- "../../packages/core/dist/chunk-FUIWYKHJ.js"() {
12163
+ var init_chunk_7LLIQ4UF = __esm({
12164
+ "../../packages/core/dist/chunk-7LLIQ4UF.js"() {
12132
12165
  "use strict";
12133
- init_chunk_3LLEDXPM();
12166
+ init_chunk_PIOPQ5UH();
12134
12167
  init_chunk_HZ6CADSY();
12135
12168
  init_zod();
12136
12169
  COMMUNITY_COURSES_MAX = 20;
@@ -13958,7 +13991,7 @@ var init_chunk_TU4Y4MEX = __esm({
13958
13991
  }
13959
13992
  });
13960
13993
 
13961
- // ../../packages/core/dist/chunk-5MXHAKHC.js
13994
+ // ../../packages/core/dist/chunk-PTWZYQB5.js
13962
13995
  function refineHubAsCodeCustomTools(config, ctx) {
13963
13996
  const agents = config.agents;
13964
13997
  if (!Array.isArray(agents)) return;
@@ -14568,11 +14601,11 @@ function skillSectionsAsResources(scope) {
14568
14601
  };
14569
14602
  }
14570
14603
  var MAX_10MB_BASE64_ENCODED_BYTES, MAX_EVAL_ATTACHMENT_ENCODED_BYTES, MAX_EVAL_ATTACHMENT_CARRIERS, MAX_EVAL_ATTACHMENT_AGGREGATE_ENCODED_BYTES, MAX_RESOURCE_ENCODED_BYTES, MAX_HUB_AS_CODE_RESOURCES, MAX_HUB_AS_CODE_RESOURCE_FILES, MAX_RESOURCE_AGGREGATE_ENCODED_BYTES, MAX_CI_CONFIG_BODY_BYTES, MAX_HUB_AS_CODE_PAGE_MANIFEST_CHARS, hubAsCodePagesSchema, MAX_CALL_OPENING_CARRIERS, MAX_CALL_OPENING_AGGREGATE_ENCODED_BYTES, hubAsCodeStateSchema, hubAsCodeResourceFileSchema, hubAsCodeResourceSchema, uuidPattern, ciUuidSchema, boundedHubAsCodeResourcesSchema, isPlainObject, MIN_SKILLS_LAYOUT_CLI, hubAsCodeConfigSchema, ciPullHubIdParam, ciBranchParam, ciPullQuery, ciHubsQuery, ciLookupQuery, ciBranchesQuery, ciSyncBody, ciPushBody, ciDiffBody, ciPublishBody, ciPublishPreviewBody, ciSyncMcpBody, ciOrgResourcesParam, orgResourcesConfigSchema, ciOrgResourcesPushBody, ciOrgResourcesDiffBody, CI_APPLY_ENTITY_KINDS, CI_APPLY_OPERATIONS, ciApplyErrorBaseSchema, ciApplyErrorSchema, ciSyncCountSchema, ciSyncChangesSchema, ciSyncWarningSchema, ciSyncResponseSchema;
14571
- var init_chunk_5MXHAKHC = __esm({
14572
- "../../packages/core/dist/chunk-5MXHAKHC.js"() {
14604
+ var init_chunk_PTWZYQB5 = __esm({
14605
+ "../../packages/core/dist/chunk-PTWZYQB5.js"() {
14573
14606
  "use strict";
14574
14607
  init_chunk_SARVKRZB();
14575
- init_chunk_4WAW72DX();
14608
+ init_chunk_RCMBGK4O();
14576
14609
  init_chunk_UN7QXDKQ();
14577
14610
  init_chunk_LBDH7LCG();
14578
14611
  init_chunk_4LXDRTO4();
@@ -15629,15 +15662,15 @@ var init_chunk_JO53JB35 = __esm({
15629
15662
  }
15630
15663
  });
15631
15664
 
15632
- // ../../packages/core/dist/chunk-PBE4O572.js
15665
+ // ../../packages/core/dist/chunk-WJ7THIFJ.js
15633
15666
  function filterNamesAnything(filter) {
15634
15667
  return filter.labels.length + filter.scope_tag_ids.length > 0;
15635
15668
  }
15636
15669
  var hubListNameSchema, HUB_LIST_FILTER_REQUIRED, hubContactListFilterSchema, hubContactListIdParam, hubContactListHubQuery, description, createHubContactListBody, updateHubContactListBody;
15637
- var init_chunk_PBE4O572 = __esm({
15638
- "../../packages/core/dist/chunk-PBE4O572.js"() {
15670
+ var init_chunk_WJ7THIFJ = __esm({
15671
+ "../../packages/core/dist/chunk-WJ7THIFJ.js"() {
15639
15672
  "use strict";
15640
- init_chunk_THM6ALTK();
15673
+ init_chunk_LIDKVVXZ();
15641
15674
  init_zod();
15642
15675
  hubListNameSchema = orgListReferenceSchema;
15643
15676
  HUB_LIST_FILTER_REQUIRED = "A hub list names at least one label or scope tag";
@@ -15663,13 +15696,13 @@ var init_chunk_PBE4O572 = __esm({
15663
15696
  }
15664
15697
  });
15665
15698
 
15666
- // ../../packages/core/dist/chunk-5PEVI432.js
15699
+ // ../../packages/core/dist/chunk-F4MBPBZX.js
15667
15700
  var AUTOMATION_TRIGGER_TYPES, AUTOMATION_EVENT_TYPES, AUTOMATION_TARGET_TYPES, AUTOMATION_ACTION_TYPES, AUTOMATION_CHANNEL_TYPES, AUTOMATION_PURPOSES, AUTOMATION_NAME_MAX, AUTOMATION_DESCRIPTION_MAX, AUTOMATION_INSTRUCTIONS_MAX, AUTOMATION_TEXT_MAX, AUTOMATION_CRON_MAX, AUTOMATION_WEBHOOK_AUTHS, AUTOMATION_WEBHOOK_HEADERS, AUTOMATION_WEBHOOK_BODY_MAX_BYTES, AUTOMATION_WEBHOOK_HEADER_NAME_MAX, WEBHOOK_RESERVED_HEADERS, automationTriggerSchema, automationTargetSchema, automationActionSchema, automationGateSchema, automationName, automationDescription, automationIdParam, automationHubQuery, automationWebhookParams, AUTOMATION_RUNS_PAGE_MAX, listAutomationRunsQuery, createAutomationBody, updateAutomationBody, AUTOMATION_ALERT_CATEGORIES, AUTOMATION_BLOCKED_ALERT_CATEGORY, automationEventSubscriberParam;
15668
- var init_chunk_5PEVI432 = __esm({
15669
- "../../packages/core/dist/chunk-5PEVI432.js"() {
15701
+ var init_chunk_F4MBPBZX = __esm({
15702
+ "../../packages/core/dist/chunk-F4MBPBZX.js"() {
15670
15703
  "use strict";
15671
- init_chunk_PBE4O572();
15672
- init_chunk_THM6ALTK();
15704
+ init_chunk_WJ7THIFJ();
15705
+ init_chunk_LIDKVVXZ();
15673
15706
  init_chunk_DZNBZNK6();
15674
15707
  init_chunk_5XEJSR22();
15675
15708
  init_chunk_PI55UGBV();
@@ -16108,31 +16141,32 @@ var init_chunk_XXZ4MOE3 = __esm({
16108
16141
  var init_contracts = __esm({
16109
16142
  "../../packages/core/dist/contracts/index.js"() {
16110
16143
  "use strict";
16144
+ init_chunk_YVY2TZK2();
16111
16145
  init_chunk_VXEAR36B();
16112
16146
  init_chunk_RACEDHG6();
16113
16147
  init_chunk_Q7KIQHAZ();
16148
+ init_chunk_HA7CRZMX();
16114
16149
  init_chunk_IPXBFWUU();
16115
16150
  init_chunk_NKLVUTFO();
16116
16151
  init_chunk_WL5QGKHN();
16117
- init_chunk_YVY2TZK2();
16152
+ init_chunk_MF2VVXBR();
16153
+ init_chunk_ZC6YGHNX();
16118
16154
  init_chunk_ACKF2MVU();
16119
16155
  init_chunk_JOPEQ3WP();
16120
- init_chunk_HA7CRZMX();
16121
- init_chunk_MF2VVXBR();
16156
+ init_chunk_EKMLVJJ7();
16122
16157
  init_chunk_IPDOHAZ5();
16123
16158
  init_chunk_GPM7PE44();
16124
16159
  init_chunk_VEERWOZ6();
16125
- init_chunk_ZC6YGHNX();
16126
16160
  init_chunk_ZXK6N2HN();
16127
16161
  init_chunk_Y7CFCYX4();
16162
+ init_chunk_DGTJX3C4();
16128
16163
  init_chunk_5DGHIY7L();
16129
- init_chunk_ZAFNUHAY();
16130
16164
  init_chunk_YUZFHVB2();
16131
16165
  init_chunk_I3O2RACG();
16132
16166
  init_chunk_34LE6P7E();
16133
16167
  init_chunk_FPSDNS2E();
16134
- init_chunk_7PYRMHTA();
16135
- init_chunk_FTMUTHML();
16168
+ init_chunk_6LEP2CEL();
16169
+ init_chunk_LKD6ISTP();
16136
16170
  init_chunk_OPETF4GS();
16137
16171
  init_chunk_SY6PLCPK();
16138
16172
  init_chunk_KMAC3O3L();
@@ -16142,8 +16176,8 @@ var init_contracts = __esm({
16142
16176
  init_chunk_EJFKWH32();
16143
16177
  init_chunk_C4HEZ7ZI();
16144
16178
  init_chunk_IR2NOSI3();
16145
- init_chunk_FUIWYKHJ();
16146
- init_chunk_3LLEDXPM();
16179
+ init_chunk_7LLIQ4UF();
16180
+ init_chunk_PIOPQ5UH();
16147
16181
  init_chunk_YULHXJ5M();
16148
16182
  init_chunk_V4FRPRH5();
16149
16183
  init_chunk_LWMLR2WI();
@@ -16154,10 +16188,10 @@ var init_contracts = __esm({
16154
16188
  init_chunk_E4DIIOOE();
16155
16189
  init_chunk_7CYHPF35();
16156
16190
  init_chunk_BPCNB5RT();
16157
- init_chunk_5MXHAKHC();
16191
+ init_chunk_PTWZYQB5();
16158
16192
  init_chunk_SARVKRZB();
16159
- init_chunk_4WAW72DX();
16160
- init_chunk_Z2DCDLGA();
16193
+ init_chunk_RCMBGK4O();
16194
+ init_chunk_BNHJNSAJ();
16161
16195
  init_chunk_UN7QXDKQ();
16162
16196
  init_chunk_LBDH7LCG();
16163
16197
  init_chunk_4LXDRTO4();
@@ -16174,13 +16208,13 @@ var init_contracts = __esm({
16174
16208
  init_chunk_2PZIF56U();
16175
16209
  init_chunk_UEJOG2Q7();
16176
16210
  init_chunk_JO53JB35();
16177
- init_chunk_5PEVI432();
16178
- init_chunk_PBE4O572();
16179
- init_chunk_THM6ALTK();
16211
+ init_chunk_F4MBPBZX();
16212
+ init_chunk_WJ7THIFJ();
16213
+ init_chunk_LIDKVVXZ();
16180
16214
  init_chunk_DZNBZNK6();
16181
16215
  init_chunk_IG6QBZMA();
16182
16216
  init_chunk_OMPT4ZHR();
16183
- init_chunk_Z2SC7EVO();
16217
+ init_chunk_J3UZCMO6();
16184
16218
  init_chunk_SOJMWM63();
16185
16219
  init_chunk_WTOA3ANF();
16186
16220
  init_chunk_5XEJSR22();
@@ -16321,8 +16355,8 @@ async function uuidV5(namespace, name) {
16321
16355
  const out = digest.slice(0, 16);
16322
16356
  return bytesToUuid(setUuidVersion(out, 5));
16323
16357
  }
16324
- function markdownToPlainText(text3) {
16325
- let result = text3;
16358
+ function markdownToPlainText(text4) {
16359
+ let result = text4;
16326
16360
  result = result.replace(/```[\w]*\n?([\s\S]*?)```/g, "$1");
16327
16361
  result = result.replace(/`([^`]+)`/g, "$1");
16328
16362
  result = result.replace(/\*\*\*(.+?)\*\*\*/g, "$1");
@@ -16341,7 +16375,7 @@ var UUID_RE2, WAYAI_WORKSPACE_LAYOUT;
16341
16375
  var init_dist = __esm({
16342
16376
  "../../packages/core/dist/index.js"() {
16343
16377
  "use strict";
16344
- init_chunk_Z2SC7EVO();
16378
+ init_chunk_J3UZCMO6();
16345
16379
  init_chunk_SOJMWM63();
16346
16380
  init_chunk_WTOA3ANF();
16347
16381
  init_chunk_5XEJSR22();
@@ -18142,6 +18176,51 @@ var init_api_client = __esm({
18142
18176
  const qs = new URLSearchParams({ organization_id: orgId, base_id: baseId2 });
18143
18177
  return this.request("DELETE", `/api/contact-book/contacts/${encodeURIComponent(contactId)}/customer?${qs}`);
18144
18178
  }
18179
+ // Person links and the deny list (wayai-pro/wayai#5473 §1): a browser sign-in only — each route refuses
18180
+ // an API token. A link takes org:write over the organization; the rest an organization admin.
18181
+ /** Whom a person id names in the organization: the hub where a conversation carries it, and that hub's name and email for them. */
18182
+ async lookupPerson(orgId, personId) {
18183
+ const qs = new URLSearchParams({ organization_id: orgId });
18184
+ return this.request("GET", `/api/contact-book/persons/${encodeURIComponent(personId)}?${qs}`);
18185
+ }
18186
+ /** The person links of the user `personId` names. */
18187
+ async listPersonLinks(orgId, personId) {
18188
+ const qs = new URLSearchParams({ organization_id: orgId });
18189
+ return this.request("GET", `/api/contact-book/persons/${encodeURIComponent(personId)}/links?${qs}`);
18190
+ }
18191
+ /** Link the user `personId` names to `targetId` (a person id or a contact id), copying the target's own links. */
18192
+ async linkPerson(orgId, personId, targetId) {
18193
+ const qs = new URLSearchParams({ organization_id: orgId });
18194
+ return this.request(
18195
+ "PUT",
18196
+ `/api/contact-book/persons/${encodeURIComponent(personId)}/links/${encodeURIComponent(targetId)}?${qs}`
18197
+ );
18198
+ }
18199
+ /** Remove one of the user's person links. */
18200
+ async unlinkPerson(orgId, personId, targetId) {
18201
+ const qs = new URLSearchParams({ organization_id: orgId });
18202
+ return this.request(
18203
+ "DELETE",
18204
+ `/api/contact-book/persons/${encodeURIComponent(personId)}/links/${encodeURIComponent(targetId)}?${qs}`
18205
+ );
18206
+ }
18207
+ /** A page of the organization's deny list, by id. */
18208
+ async listDeniedPersons(orgId, opts = {}) {
18209
+ const qs = new URLSearchParams({ organization_id: orgId });
18210
+ if (opts.cursor !== void 0) qs.set("cursor", opts.cursor);
18211
+ if (opts.limit !== void 0) qs.set("limit", String(opts.limit));
18212
+ return this.request("GET", `/api/contact-book/denied-persons?${qs}`);
18213
+ }
18214
+ /** Deny a person id or contact id for the organization. */
18215
+ async denyPerson(orgId, personId) {
18216
+ const qs = new URLSearchParams({ organization_id: orgId });
18217
+ return this.request("PUT", `/api/contact-book/denied-persons/${encodeURIComponent(personId)}?${qs}`);
18218
+ }
18219
+ /** Lift a denial. */
18220
+ async undenyPerson(orgId, personId) {
18221
+ const qs = new URLSearchParams({ organization_id: orgId });
18222
+ return this.request("DELETE", `/api/contact-book/denied-persons/${encodeURIComponent(personId)}?${qs}`);
18223
+ }
18145
18224
  /**
18146
18225
  * The access set every hub toolset call of an agent sends for a person, or for none (the hub's ∩ the
18147
18226
  * agent's), and the layer that removed each value (#5358 PR 15). Another person's takes an org-admin
@@ -22629,20 +22708,20 @@ function readCss(source, attribute) {
22629
22708
  return { declarations, loads };
22630
22709
  }
22631
22710
  const stack = [];
22632
- let text3 = "";
22711
+ let text4 = "";
22633
22712
  for (const ch of css) {
22634
22713
  if (ch === "{") {
22635
- stack.push({ prelude: text3.trim(), body: "" });
22636
- text3 = "";
22714
+ stack.push({ prelude: text4.trim(), body: "" });
22715
+ text4 = "";
22637
22716
  } else if (ch === "}") {
22638
22717
  const block = stack.pop();
22639
- if (block) declare(block.body + text3, [...stack.map((b) => b.prelude), block.prelude]);
22640
- text3 = "";
22718
+ if (block) declare(block.body + text4, [...stack.map((b) => b.prelude), block.prelude]);
22719
+ text4 = "";
22641
22720
  } else if (ch === ";") {
22642
- if (stack.length > 0) stack[stack.length - 1].body += `${text3};`;
22643
- text3 = "";
22721
+ if (stack.length > 0) stack[stack.length - 1].body += `${text4};`;
22722
+ text4 = "";
22644
22723
  } else {
22645
- text3 += ch;
22724
+ text4 += ch;
22646
22725
  }
22647
22726
  }
22648
22727
  return { declarations, loads };
@@ -22787,7 +22866,7 @@ var init_page_design_lint = __esm({
22787
22866
  LIST_MARKUP = /<(?:ul|ol|table)\b|wayai-list|createElement\(\s*['"`](?:li|tr|ul|ol|table)['"`]/i;
22788
22867
  ZERO_ROWS_CHECK = /\.length\s*(?:===?|<=)\s*0\b|\.length\s*<\s*1\b|!\s*[\w$.[\]]+\.length\b/;
22789
22868
  plural = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
22790
- shown = (text3) => truncate(sanitizeTerminalText(text3).replace(/\s+/g, " "), 60);
22869
+ shown = (text4) => truncate(sanitizeTerminalText(text4).replace(/\s+/g, " "), 60);
22791
22870
  }
22792
22871
  });
22793
22872
 
@@ -23352,16 +23431,16 @@ function pathSegments(value, label2 = "path") {
23352
23431
  function parseData(data, flag) {
23353
23432
  const prefix = flag ? `${flag}: ` : "";
23354
23433
  const source = data.startsWith("@") ? data.slice(1) : void 0;
23355
- let text3 = data;
23434
+ let text4 = data;
23356
23435
  if (source !== void 0) {
23357
23436
  try {
23358
- text3 = readFileSync14(source, "utf-8");
23437
+ text4 = readFileSync14(source, "utf-8");
23359
23438
  } catch (e) {
23360
23439
  throw expected(`${prefix}${source}: ${e instanceof Error ? e.message : "could not be read"}`);
23361
23440
  }
23362
23441
  }
23363
23442
  try {
23364
- return JSON.parse(text3);
23443
+ return JSON.parse(text4);
23365
23444
  } catch (e) {
23366
23445
  const where = source !== void 0 ? ` in ${source}` : "";
23367
23446
  throw expected(`${prefix}invalid JSON${where}: ${e instanceof Error ? e.message : String(e)}`);
@@ -24359,8 +24438,8 @@ var init_pacer = __esm({
24359
24438
 
24360
24439
  // src/communities/model.ts
24361
24440
  import { createHash as createHash3 } from "crypto";
24362
- function toLf(text3) {
24363
- return text3.replace(/\r\n?/g, "\n");
24441
+ function toLf(text4) {
24442
+ return text4.replace(/\r\n?/g, "\n");
24364
24443
  }
24365
24444
  function normalizeRules(rules) {
24366
24445
  if (rules === null || rules === void 0) return null;
@@ -24580,14 +24659,14 @@ function readCourseFolders(communityFolder, slugs, problems2) {
24580
24659
  }
24581
24660
  function readCourseFolder(communityFolder, folder, slug, problems2) {
24582
24661
  const where = `${COURSES_DIR}/${slug}/${COURSE_FILE}`;
24583
- const text3 = readRealFileOrThrow(communityFolder, path26.join(folder, COURSE_FILE));
24584
- if (text3 === null) {
24662
+ const text4 = readRealFileOrThrow(communityFolder, path26.join(folder, COURSE_FILE));
24663
+ if (text4 === null) {
24585
24664
  problems2.push(`${COURSES_DIR}/${slug}/: no ${COURSE_FILE}`);
24586
24665
  return null;
24587
24666
  }
24588
24667
  let doc;
24589
24668
  try {
24590
- doc = yaml13.load(text3);
24669
+ doc = yaml13.load(text4);
24591
24670
  } catch (err) {
24592
24671
  problems2.push(`${where} is not valid YAML: ${err instanceof Error ? err.message : String(err)}`);
24593
24672
  return null;
@@ -24670,12 +24749,12 @@ function readModules(communityFolder, lessonsDir, raw, courseSlug, courseWhere,
24670
24749
  });
24671
24750
  return modules;
24672
24751
  }
24673
- function splitFrontmatter(text3) {
24674
- if (!text3.startsWith("---\n")) return null;
24675
- const close2 = text3.indexOf("\n---\n", 3);
24676
- if (close2 === -1) return text3.endsWith("\n---") ? { front: text3.slice(4, -3), body: "" } : null;
24677
- const rest = text3.slice(close2 + 5);
24678
- return { front: text3.slice(4, close2 + 1), body: rest.endsWith("\n") ? rest.slice(0, -1) : rest };
24752
+ function splitFrontmatter(text4) {
24753
+ if (!text4.startsWith("---\n")) return null;
24754
+ const close2 = text4.indexOf("\n---\n", 3);
24755
+ if (close2 === -1) return text4.endsWith("\n---") ? { front: text4.slice(4, -3), body: "" } : null;
24756
+ const rest = text4.slice(close2 + 5);
24757
+ return { front: text4.slice(4, close2 + 1), body: rest.endsWith("\n") ? rest.slice(0, -1) : rest };
24679
24758
  }
24680
24759
  function readLessonFile(communityFolder, lessonsDir, courseSlug, slug, problems2) {
24681
24760
  const name = `${slug}${LESSON_FILE_EXT}`;
@@ -24842,14 +24921,14 @@ import * as yaml14 from "js-yaml";
24842
24921
  function readCommunityFolder(folder) {
24843
24922
  const where = path27.basename(folder);
24844
24923
  const yamlPath = path27.join(folder, COMMUNITY_FILE);
24845
- const text3 = readRealFileOrThrow(folder, yamlPath);
24846
- if (text3 === null) {
24924
+ const text4 = readRealFileOrThrow(folder, yamlPath);
24925
+ if (text4 === null) {
24847
24926
  throw expected(`No ${COMMUNITY_FILE} in ${where}/: pull the community first (wayai pull communities/<community_id>).`);
24848
24927
  }
24849
24928
  const rules = toLf(readRealFileOrThrow(folder, path27.join(folder, RULES_FILE)) ?? "");
24850
24929
  let doc;
24851
24930
  try {
24852
- doc = yaml14.load(text3);
24931
+ doc = yaml14.load(text4);
24853
24932
  } catch (err) {
24854
24933
  throw expected(`${where}/${COMMUNITY_FILE} is not valid YAML: ${err instanceof Error ? err.message : String(err)}`);
24855
24934
  }
@@ -25020,8 +25099,8 @@ function renderCommunityYaml(files) {
25020
25099
  return yaml14.dump(doc, YAML_DUMP_OPTIONS);
25021
25100
  }
25022
25101
  function renderRules(rules) {
25023
- const text3 = toLf(rules).replace(/\n+$/, "");
25024
- return text3 === "" ? "" : `${text3}
25102
+ const text4 = toLf(rules).replace(/\n+$/, "");
25103
+ return text4 === "" ? "" : `${text4}
25025
25104
  `;
25026
25105
  }
25027
25106
  function renderCommunityFiles(files) {
@@ -25113,7 +25192,7 @@ var init_listing = __esm({
25113
25192
  "src/communities/listing.ts"() {
25114
25193
  "use strict";
25115
25194
  init_terminal_output();
25116
- show = (text3) => JSON.stringify(sanitizeTerminalText(text3));
25195
+ show = (text4) => JSON.stringify(sanitizeTerminalText(text4));
25117
25196
  emptyListing = () => ({ changes: [], serverChanged: [], conflicts: [], leftAsIs: [], kept: [] });
25118
25197
  }
25119
25198
  });
@@ -28020,8 +28099,8 @@ function titleOf(slug) {
28020
28099
  const words = slug.split("-").join(" ");
28021
28100
  return words.charAt(0).toUpperCase() + words.slice(1);
28022
28101
  }
28023
- function escapeHtml(text3) {
28024
- return text3.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
28102
+ function escapeHtml(text4) {
28103
+ return text4.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
28025
28104
  }
28026
28105
  function scaffoldPage(input) {
28027
28106
  const customers = input.audience === "customers";
@@ -28408,8 +28487,8 @@ async function pageCommand(args2) {
28408
28487
  throw expected(`${path33.basename(hubFolder)} already holds ${PAGES_PER_HUB_MAX} pages: a hub holds at most ${PAGES_PER_HUB_MAX} pages.`);
28409
28488
  }
28410
28489
  requireRealSubdirNoSymlink(hubFolder, dir, true);
28411
- for (const [file, text3] of [[PAGE_MANIFEST_FILE, files.manifestYaml], [PAGE_HTML_FILE, files.html]]) {
28412
- const outcome = createFileNoFollow(hubFolder, path33.join(dir, file), Buffer.from(text3));
28490
+ for (const [file, text4] of [[PAGE_MANIFEST_FILE, files.manifestYaml], [PAGE_HTML_FILE, files.html]]) {
28491
+ const outcome = createFileNoFollow(hubFolder, path33.join(dir, file), Buffer.from(text4));
28413
28492
  if (outcome !== "created") throw expected(`${rel}/${file} could not be written (${outcome}): \`wayai page new\` never overwrites a page.`);
28414
28493
  }
28415
28494
  const shown3 = path33.join(path33.basename(hubFolder), rel);
@@ -31331,10 +31410,10 @@ var init_caller_audio = __esm({
31331
31410
  /** Syntheses in flight, by cache file: two lines with the same words pay for one. */
31332
31411
  inFlight = /* @__PURE__ */ new Map();
31333
31412
  /** The cache file for a text: one per model, voice and exact text. */
31334
- cachePath(text3) {
31413
+ cachePath(text4) {
31335
31414
  const key = createHash4("sha256").update(`${this.model}
31336
31415
  ${this.voice}
31337
- ${text3}`).digest("hex");
31416
+ ${text4}`).digest("hex");
31338
31417
  return join33(this.cacheDir, `${key}.pcm`);
31339
31418
  }
31340
31419
  clipFor(line) {
@@ -31686,8 +31765,8 @@ function parseWrittenNumber(raw) {
31686
31765
  if (m) return { ...base, int: Number(m[1]), frac: m[2] };
31687
31766
  return { ...base, int: Number(base.digits || "0"), digitMode: true };
31688
31767
  }
31689
- function tokenize(text3) {
31690
- const norm = normalizeText(text3);
31768
+ function tokenize(text4) {
31769
+ const norm = normalizeText(text4);
31691
31770
  const out = [];
31692
31771
  const re = /r\$|\d[\d.,/:h-]*\d|\d|%|[a-z]+|[.\-/]/g;
31693
31772
  for (const m of norm.matchAll(re)) {
@@ -31805,8 +31884,8 @@ function num(tk) {
31805
31884
  function decimalString(n) {
31806
31885
  return n.frac ? `${n.int}.${n.frac.padEnd(2, "0")}` : String(n.int);
31807
31886
  }
31808
- function extractFacts(text3) {
31809
- const toks = tokenize(text3);
31887
+ function extractFacts(text4) {
31888
+ const toks = tokenize(text4);
31810
31889
  const facts = [];
31811
31890
  const used = /* @__PURE__ */ new Set();
31812
31891
  const push = (kind, key, from, to) => {
@@ -31934,10 +32013,10 @@ function extractFacts(text3) {
31934
32013
  }
31935
32014
  return facts;
31936
32015
  }
31937
- function digitRuns(text3) {
32016
+ function digitRuns(text4) {
31938
32017
  const runs = [];
31939
32018
  let cur = "";
31940
- for (const f of extractFacts(text3)) {
32019
+ for (const f of extractFacts(text4)) {
31941
32020
  if (f.kind === "digits" || f.kind === "cpf" || f.kind === "number" && /^\d+$/.test(f.key)) cur += f.key;
31942
32021
  else {
31943
32022
  if (cur) runs.push(cur);
@@ -32001,21 +32080,21 @@ function isVetted(fact, vetted) {
32001
32080
  if (fact.kind === "number") return vetted.derivedNumbers.has(String(Number(fact.key)));
32002
32081
  return false;
32003
32082
  }
32004
- function readbackCandidate(text3, kind) {
32083
+ function readbackCandidate(text4, kind) {
32005
32084
  if (kind === "cpf") {
32006
- const cpf = extractFacts(text3).find((f) => f.kind === "cpf");
32085
+ const cpf = extractFacts(text4).find((f) => f.kind === "cpf");
32007
32086
  if (cpf) return cpf.key;
32008
- return digitRuns(text3).find((r) => r.length >= 9 && r.length <= 13) ?? null;
32087
+ return digitRuns(text4).find((r) => r.length >= 9 && r.length <= 13) ?? null;
32009
32088
  }
32010
32089
  if (kind === "digits") {
32011
- const code = extractFacts(text3).find((f) => (f.kind === "digits" || f.kind === "cpf") && f.key.length >= 5);
32090
+ const code = extractFacts(text4).find((f) => (f.kind === "digits" || f.kind === "cpf") && f.key.length >= 5);
32012
32091
  if (code) return code.key;
32013
- return digitRuns(text3).find((r) => r.length >= 5) ?? null;
32092
+ return digitRuns(text4).find((r) => r.length >= 5) ?? null;
32014
32093
  }
32015
- return extractFacts(text3).find((f) => f.kind === kind)?.key ?? null;
32094
+ return extractFacts(text4).find((f) => f.kind === kind)?.key ?? null;
32016
32095
  }
32017
- function claimMarkers(text3) {
32018
- const n = normalizeText(text3);
32096
+ function claimMarkers(text4) {
32097
+ const n = normalizeText(text4);
32019
32098
  return {
32020
32099
  policy: POLICY_MARKERS.filter((m) => n.includes(m)),
32021
32100
  action: ACTION_MARKERS.filter((m) => n.includes(m))
@@ -32176,10 +32255,10 @@ function parseCallPlan(raw) {
32176
32255
  }
32177
32256
  return { lines: out };
32178
32257
  }
32179
- function dictatedIdentifier(text3) {
32180
- const fact = extractFacts(text3).find((f) => f.kind === "cpf" || f.kind === "digits" && f.key.length >= 5);
32258
+ function dictatedIdentifier(text4) {
32259
+ const fact = extractFacts(text4).find((f) => f.kind === "cpf" || f.kind === "digits" && f.key.length >= 5);
32181
32260
  if (fact) return { kind: fact.kind, key: fact.key };
32182
- const run = digitRuns(text3).find((r) => r.length >= 5);
32261
+ const run = digitRuns(text4).find((r) => r.length >= 5);
32183
32262
  return run ? { kind: run.length === 11 ? "cpf" : "digits", key: run } : null;
32184
32263
  }
32185
32264
  function readbackOf(value) {
@@ -32302,9 +32381,9 @@ var init_cost_cap = __esm({
32302
32381
  function factLabel(fact) {
32303
32382
  return `${fact.kind}:${fact.raw}`;
32304
32383
  }
32305
- function tokens(text3) {
32306
- const words = normalizeText(text3).split(/[^a-z0-9]+/).filter((w) => w.length > 1 && !/^\d+$/.test(w) && !isNumberWord(w));
32307
- const facts = extractFacts(text3).map((f) => `#${f.kind}:${f.key}`);
32384
+ function tokens(text4) {
32385
+ const words = normalizeText(text4).split(/[^a-z0-9]+/).filter((w) => w.length > 1 && !/^\d+$/.test(w) && !isNumberWord(w));
32386
+ const facts = extractFacts(text4).map((f) => `#${f.kind}:${f.key}`);
32308
32387
  return /* @__PURE__ */ new Set([...words, ...facts]);
32309
32388
  }
32310
32389
  function similarity(a, b) {
@@ -32839,7 +32918,7 @@ var init_report = __esm({
32839
32918
  style: "style",
32840
32919
  latency: "latency"
32841
32920
  };
32842
- shown2 = (text3) => text3 === null ? "nothing" : sanitizeTerminalText(text3);
32921
+ shown2 = (text4) => text4 === null ? "nothing" : sanitizeTerminalText(text4);
32843
32922
  }
32844
32923
  });
32845
32924
 
@@ -35490,6 +35569,9 @@ function parse2(args2) {
35490
35569
  org: { type: "string" },
35491
35570
  base: { type: "string" },
35492
35571
  record: { type: "string" },
35572
+ to: { type: "string" },
35573
+ cursor: { type: "string" },
35574
+ limit: { type: "string" },
35493
35575
  json: { type: "boolean" }
35494
35576
  },
35495
35577
  allowPositionals: true,
@@ -35513,43 +35595,135 @@ function failure(err, accessToken) {
35513
35595
  if (err.status === 403 && identifyTokenType(accessToken) === "way_token") {
35514
35596
  const override2 = envTokenOverride() ? " WAYAI_TOKEN is set in this shell and is sent instead of your sign-in: unset it first." : "";
35515
35597
  return expected(
35516
- `A contact's customer record is linked from a browser sign-in only, and this login is an API token. Run \`wayai login\` (without --token).${override2}`
35598
+ `These commands work from a browser sign-in only, and this login is an API token. Run \`wayai login\` (without --token).${override2}`
35517
35599
  );
35518
35600
  }
35519
35601
  if (err.status >= 400 && err.status < 500) return expected(sanitizeTerminalText(extractApiMessage(err)));
35520
35602
  return err;
35521
35603
  }
35522
- async function contactsCommand(args2) {
35523
- if (wantsHelp(args2) || args2.length === 0) {
35524
- console.log(USAGE4);
35525
- return;
35604
+ function userPersonId(sub, value) {
35605
+ if (value === void 0) throw usageError3(`${sub} takes one <person_id>.`);
35606
+ if (!userPersonIdSchema.safeParse(value).success) throw usageError3(`Invalid <person_id> ${JSON.stringify(value)}: expected a person id (prs_\u2026).`);
35607
+ return value;
35608
+ }
35609
+ function personOrContactId(what, value) {
35610
+ if (value === void 0) throw usageError3(`Missing ${what}.`);
35611
+ if (!personIdSchema.safeParse(value).success) {
35612
+ throw usageError3(`Invalid ${what} ${JSON.stringify(value)}. ${PERSON_ID_FORM_MESSAGE}.`);
35526
35613
  }
35527
- const { values, positionals } = parse2(args2);
35528
- const [sub, contactId, ...extra] = positionals;
35529
- if (!SUBCOMMANDS2.includes(sub)) throw usageError3(`Unknown subcommand ${JSON.stringify(sub)}.`);
35614
+ return value;
35615
+ }
35616
+ function refuseFlags(sub, values, flags) {
35617
+ for (const flag of flags) {
35618
+ if (values[flag] !== void 0) throw usageError3(`--${String(flag)} does not apply to ${sub}.`);
35619
+ }
35620
+ }
35621
+ function entryLine(entry) {
35622
+ return ` ${text2(entry.person_id)} since ${text2(entry.created_at)}, by ${text2(entry.created_by)}`;
35623
+ }
35624
+ function print(values, data, lines) {
35625
+ console.log(values.json ? JSON.stringify(data, null, 2) : lines.join("\n"));
35626
+ }
35627
+ async function customerRecord(sub, positionals, values) {
35628
+ const [contactId, ...extra] = positionals;
35530
35629
  if (contactId === void 0 || extra.length > 0) throw usageError3(`${sub} takes one <contact_id>.`);
35531
35630
  if (!UUID_RE3.test(contactId)) throw usageError3(`Invalid <contact_id> ${JSON.stringify(contactId)}: expected a contact id (a UUID).`);
35631
+ refuseFlags(sub, values, ["to", "cursor", "limit"]);
35532
35632
  if (!values.base) throw usageError3(`${sub} needs --base <base_id>.`);
35533
35633
  if (!isValidBaseId(values.base)) throw usageError3(`Invalid --base ${JSON.stringify(values.base)}: a base id is ${BASE_ID_RULE}.`);
35534
35634
  if (sub === "link-customer" && !values.record) throw usageError3("link-customer needs --record <record_id>.");
35535
35635
  if (sub === "unlink-customer" && values.record !== void 0) throw usageError3("--record applies only to link-customer.");
35536
35636
  const orgId = resolveOrgId2(values.org);
35637
+ await withApi(async (api) => {
35638
+ const { customer } = sub === "link-customer" ? await api.linkContactCustomer(orgId, contactId, { base_id: values.base, record_id: values.record }) : await api.unlinkContactCustomer(orgId, contactId, values.base);
35639
+ const where = `base ${text2(customer.base_id)} (${text2(customer.record_type)})`;
35640
+ print(values, customer, [sub === "link-customer" ? `Contact ${customer.contact_id} is linked to customer record ${text2(customer.record_id)} in ${where}.` : `Contact ${customer.contact_id} is unlinked from customer record ${text2(customer.record_id)} in ${where}; the record keeps the contact id under ${customer.external_source}.`]);
35641
+ });
35642
+ }
35643
+ async function persons(sub, positionals, values) {
35644
+ refuseFlags(sub, values, ["base", "record"]);
35645
+ const takesTo = sub === "link-person" || sub === "unlink-person";
35646
+ if (!takesTo) refuseFlags(sub, values, ["to"]);
35647
+ if (sub !== "denied-persons") refuseFlags(sub, values, ["cursor", "limit"]);
35648
+ const [first, ...extra] = positionals;
35649
+ if (sub === "denied-persons" ? positionals.length > 0 : extra.length > 0) {
35650
+ throw usageError3(sub === "denied-persons" ? "denied-persons takes no arguments." : `${sub} takes one id.`);
35651
+ }
35652
+ let limit;
35653
+ if (values.limit !== void 0) {
35654
+ limit = Number(values.limit);
35655
+ if (!Number.isInteger(limit) || limit < 1 || limit > PERSON_DENY_PAGE_MAX) {
35656
+ throw usageError3(`Invalid --limit ${JSON.stringify(values.limit)}: expected a whole number from 1 to ${PERSON_DENY_PAGE_MAX}.`);
35657
+ }
35658
+ }
35659
+ const cursor = values.cursor === void 0 ? void 0 : personOrContactId("--cursor", values.cursor);
35660
+ const subject = sub === "denied-persons" ? "" : sub === "deny-person" || sub === "undeny-person" ? personOrContactId("<person_id|contact_id>", first) : userPersonId(sub, first);
35661
+ const target = takesTo ? personOrContactId("--to <person_id|contact_id>", values.to) : "";
35662
+ const orgId = resolveOrgId2(values.org);
35663
+ await withApi(async (api) => {
35664
+ switch (sub) {
35665
+ case "lookup-person": {
35666
+ const { person } = await api.lookupPerson(orgId, subject);
35667
+ print(values, person, [person.status === "found" ? `Person ${person.person_id} is ${person.user_name ? text2(person.user_name) : "unnamed"}${person.user_email ? ` <${text2(person.user_email)}>` : ""}, in hub ${person.hub_name ? text2(person.hub_name) : "unnamed"} (${text2(person.hub_id)}).` : `No conversation of the organization's hubs carries person ${person.person_id}.`]);
35668
+ return;
35669
+ }
35670
+ case "person-links": {
35671
+ const data = await api.listPersonLinks(orgId, subject);
35672
+ print(values, data, data.links.length === 0 ? [`Person ${data.person_id} has no person links.`] : [`Person ${data.person_id} is linked to:`, ...data.links.map(entryLine)]);
35673
+ return;
35674
+ }
35675
+ case "link-person": {
35676
+ const data = await api.linkPerson(orgId, subject, target);
35677
+ print(values, data, [data.status === "linked" ? `Person ${data.person_id} is linked to ${target}${data.added ? `; added ${data.added.map(text2).join(", ")}` : ""}.` : `Person ${data.person_id} was already linked to ${target} and its own links.`]);
35678
+ return;
35679
+ }
35680
+ case "unlink-person": {
35681
+ const data = await api.unlinkPerson(orgId, subject, target);
35682
+ print(values, data, [`Person ${subject} is no longer linked to ${target}.`]);
35683
+ return;
35684
+ }
35685
+ case "denied-persons": {
35686
+ const data = await api.listDeniedPersons(orgId, { cursor, limit });
35687
+ const lines = data.denied.length === 0 ? ["Nothing is denied."] : ["Denied:", ...data.denied.map(entryLine)];
35688
+ if (data.next_cursor) lines.push(`More: --cursor ${text2(data.next_cursor)}`);
35689
+ print(values, data, lines);
35690
+ return;
35691
+ }
35692
+ case "deny-person": {
35693
+ const data = await api.denyPerson(orgId, subject);
35694
+ print(values, data, [data.status === "denied" ? `Denied ${data.person_id}.` : `${data.person_id} was already denied.`]);
35695
+ return;
35696
+ }
35697
+ case "undeny-person": {
35698
+ const data = await api.undenyPerson(orgId, subject);
35699
+ print(values, data, [`Lifted the denial of ${subject}.`]);
35700
+ return;
35701
+ }
35702
+ }
35703
+ });
35704
+ }
35705
+ async function withApi(act) {
35537
35706
  const { config, accessToken } = await requireAuth();
35538
35707
  const api = new ApiClient({ apiUrl: config.api_url, accessToken, onUnauthorized: () => getAccessToken(config) });
35539
- let customer;
35540
35708
  try {
35541
- ({ customer } = sub === "link-customer" ? await api.linkContactCustomer(orgId, contactId, { base_id: values.base, record_id: values.record }) : await api.unlinkContactCustomer(orgId, contactId, values.base));
35709
+ await act(api);
35542
35710
  } catch (err) {
35543
35711
  throw failure(err, accessToken);
35544
35712
  }
35545
- if (values.json) {
35546
- console.log(JSON.stringify(customer, null, 2));
35713
+ }
35714
+ async function contactsCommand(args2) {
35715
+ if (wantsHelp(args2) || args2.length === 0) {
35716
+ console.log(USAGE4);
35547
35717
  return;
35548
35718
  }
35549
- const where = `base ${sanitizeTerminalText(customer.base_id)} (${sanitizeTerminalText(customer.record_type)})`;
35550
- console.log(sub === "link-customer" ? `Contact ${customer.contact_id} is linked to customer record ${sanitizeTerminalText(customer.record_id)} in ${where}.` : `Contact ${customer.contact_id} is unlinked from customer record ${sanitizeTerminalText(customer.record_id)} in ${where}; the record keeps the contact id under ${customer.external_source}.`);
35719
+ const { values, positionals } = parse2(args2);
35720
+ const [sub, ...rest] = positionals;
35721
+ if (!SUBCOMMANDS2.includes(sub)) throw usageError3(`Unknown subcommand ${JSON.stringify(sub)}.`);
35722
+ const command2 = sub;
35723
+ if (command2 === "link-customer" || command2 === "unlink-customer") return customerRecord(command2, rest, values);
35724
+ return persons(command2, rest, values);
35551
35725
  }
35552
- var USAGE4, SUBCOMMANDS2;
35726
+ var USAGE4, SUBCOMMANDS2, text2;
35553
35727
  var init_contacts = __esm({
35554
35728
  "src/commands/contacts.ts"() {
35555
35729
  "use strict";
@@ -35562,12 +35736,20 @@ var init_contacts = __esm({
35562
35736
  init_token_store();
35563
35737
  init_base_id();
35564
35738
  init_utils();
35739
+ init_contracts();
35565
35740
  USAGE4 = `
35566
- wayai contacts \u2014 a contact's customer record in one of the organization's bases
35741
+ wayai contacts \u2014 a contact's customer record in a base, and the organization's person links and deny list
35567
35742
 
35568
35743
  Usage:
35569
35744
  wayai contacts link-customer <contact_id> --base <base_id> --record <record_id> [--org <org_id>] [--json]
35570
35745
  wayai contacts unlink-customer <contact_id> --base <base_id> [--org <org_id>] [--json]
35746
+ wayai contacts lookup-person <person_id> [--org <org_id>] [--json]
35747
+ wayai contacts person-links <person_id> [--org <org_id>] [--json]
35748
+ wayai contacts link-person <person_id> --to <person_id|contact_id> [--org <org_id>] [--json]
35749
+ wayai contacts unlink-person <person_id> --to <person_id|contact_id> [--org <org_id>] [--json]
35750
+ wayai contacts denied-persons [--cursor <id>] [--limit <n>] [--org <org_id>] [--json]
35751
+ wayai contacts deny-person <person_id|contact_id> [--org <org_id>] [--json]
35752
+ wayai contacts undeny-person <person_id|contact_id> [--org <org_id>] [--json]
35571
35753
 
35572
35754
  link-customer Make the record the contact's customer record: a conversation with the
35573
35755
  contact (its WhatsApp phone, Instagram id or app account) then serves that
@@ -35579,11 +35761,37 @@ unlink-customer Unlink the contact's customer record in the base. The record ke
35579
35761
  contact id under the source wayai_contact_unlinked, so its owned records stay
35580
35762
  its own, and link-customer on the same record links it again.
35581
35763
 
35582
- The organization is --org, else this repo's (wayai-ws/wayai.yaml). You must be an
35583
- organization admin. These commands need a browser sign-in (\`wayai login\`): an API
35584
- token (\`wayai login --token\`, or WAYAI_TOKEN) is refused.
35764
+ lookup-person Whom a person id (prs_\u2026) names: a hub of the organization where a
35765
+ conversation carries it, and that hub's name and email for the person. A
35766
+ person id no conversation carries is unknown.
35767
+ person-links The person ids and contacts a person is linked to, oldest first.
35768
+ link-person Link a person to another person id (their earlier identity, say an old
35769
+ number) or to a contact of the organization: the person is also that one.
35770
+ The target's own links are copied too. A person holds at most 16 links.
35771
+ unlink-person Remove one link. The links it copied stay.
35772
+ denied-persons The organization's deny list: person ids and contacts no person set holds.
35773
+ deny-person Deny a person id or a contact for the organization.
35774
+ undeny-person Lift a denial.
35775
+
35776
+ Person links and the deny list give and take no access yet: no call reads them.
35777
+
35778
+ The organization is --org, else this repo's (wayai-ws/wayai.yaml). Linking and unlinking
35779
+ a person needs org:write over the organization; everything else here an organization
35780
+ admin. These commands need a browser sign-in (\`wayai login\`): an API token
35781
+ (\`wayai login --token\`, or WAYAI_TOKEN) is refused.
35585
35782
  `.trim();
35586
- SUBCOMMANDS2 = ["link-customer", "unlink-customer"];
35783
+ SUBCOMMANDS2 = [
35784
+ "link-customer",
35785
+ "unlink-customer",
35786
+ "lookup-person",
35787
+ "person-links",
35788
+ "link-person",
35789
+ "unlink-person",
35790
+ "denied-persons",
35791
+ "deny-person",
35792
+ "undeny-person"
35793
+ ];
35794
+ text2 = (value) => sanitizeTerminalText(value);
35587
35795
  }
35588
35796
  });
35589
35797
 
@@ -35781,7 +35989,7 @@ function layerLines(values) {
35781
35989
  if (values === null) return ["narrows nothing (no values)"];
35782
35990
  const dimensions = Object.entries(values);
35783
35991
  if (dimensions.length === 0) return ["reaches nothing (unset, or no dimension)"];
35784
- return dimensions.map(([dimension, { read, write }]) => `${text2(dimension)}: read ${list(read)}; write ${list(write)}`);
35992
+ return dimensions.map(([dimension, { read, write }]) => `${text3(dimension)}: read ${list(read)}; write ${list(write)}`);
35785
35993
  }
35786
35994
  function partyLine(party) {
35787
35995
  const who = party.customer ? "the conversation's customer" : "the person";
@@ -35795,23 +36003,23 @@ function partyLine(party) {
35795
36003
  function personsLines(data) {
35796
36004
  if (!data.persons) return [];
35797
36005
  const lines = ["", "Persons each call is for (matched on record types with person entries):"];
35798
- for (const persons of data.persons) {
35799
- const audience = persons.audience === REKOR_PERSON_AUDIENCE_STAFF ? "a call for team members" : "customer-facing";
35800
- lines.push(` ${TURN_NAMES[persons.turn]}: ${audience}${persons.full_reach ? ", full reach" : ""}`);
35801
- if (persons.parties.length === 0) {
35802
- lines.push(persons.agent_all ? " no person; the agent holds $person: every person's records" : " no person; the agent does not hold $person: no person's records");
36006
+ for (const persons2 of data.persons) {
36007
+ const audience = persons2.audience === REKOR_PERSON_AUDIENCE_STAFF ? "a call for team members" : "customer-facing";
36008
+ lines.push(` ${TURN_NAMES[persons2.turn]}: ${audience}${persons2.full_reach ? ", full reach" : ""}`);
36009
+ if (persons2.parties.length === 0) {
36010
+ lines.push(persons2.agent_all ? " no person; the agent holds $person: every person's records" : " no person; the agent does not hold $person: no person's records");
35803
36011
  }
35804
- for (const party of persons.parties) lines.push(` ${partyLine(party)}`);
36012
+ for (const party of persons2.parties) lines.push(` ${partyLine(party)}`);
35805
36013
  }
35806
- lines.push(" Person entries are matched only on calls for team members: a customer-facing call reaches none of their records.");
36014
+ lines.push(" Person entries are matched on calls for team members and customer-facing calls alike; a customer-facing call also reaches only record types with person entries in enforce or marked shared.");
35807
36015
  return lines;
35808
36016
  }
35809
36017
  function formatExplanation(data) {
35810
36018
  const lines = [];
35811
- const who = data.user_id === null ? "no person: the hub's \u2229 the agent's" : `person ${text2(data.user_id)}, ${data.kind ? kindName(data.kind) : "unknown kind"}`;
35812
- lines.push(`Hub ${text2(data.hub_id)}, agent ${text2(data.agent_id)}, ${who}`);
36019
+ const who = data.user_id === null ? "no person: the hub's \u2229 the agent's" : `person ${text3(data.user_id)}, ${data.kind ? kindName(data.kind) : "unknown kind"}`;
36020
+ lines.push(`Hub ${text3(data.hub_id)}, agent ${text3(data.agent_id)}, ${who}`);
35813
36021
  if (data.values_hub_id === null) lines.push("This preview hub was never published: it has no hub values, so it reaches nothing.");
35814
- else if (data.values_hub_id !== data.hub_id) lines.push(`Hub values are those of its production hub ${text2(data.values_hub_id)}.`);
36022
+ else if (data.values_hub_id !== data.hub_id) lines.push(`Hub values are those of its production hub ${text3(data.values_hub_id)}.`);
35815
36023
  if (data.customer_only) {
35816
36024
  lines.push("Customer-only: held only on record types customer scope narrows to one customer, on a call naming its customer; every other scoped type reaches nothing.");
35817
36025
  }
@@ -35828,12 +36036,12 @@ function formatExplanation(data) {
35828
36036
  lines.push("", "Effective set:");
35829
36037
  if (data.dimensions.length === 0) lines.push(" no dimension: the set reaches nothing on any scoped record type");
35830
36038
  for (const dimension of data.dimensions) {
35831
- lines.push(` ${text2(dimension.dimension_id)}: read ${list(dimension.read)}; write ${list(dimension.write)}`);
36039
+ lines.push(` ${text3(dimension.dimension_id)}: read ${list(dimension.read)}; write ${list(dimension.write)}`);
35832
36040
  for (const removal of dimension.read_removed) {
35833
- lines.push(` ${text2(removal.value_id)} not read: removed by ${removal.layers.map((layer) => LAYER_NAMES[layer]).join(", ")}`);
36041
+ lines.push(` ${text3(removal.value_id)} not read: removed by ${removal.layers.map((layer) => LAYER_NAMES[layer]).join(", ")}`);
35834
36042
  }
35835
36043
  for (const removal of dimension.write_removed) {
35836
- lines.push(` ${text2(removal.value_id)} read, not written: removed by ${removal.layers.map((layer) => LAYER_NAMES[layer]).join(", ")}`);
36044
+ lines.push(` ${text3(removal.value_id)} read, not written: removed by ${removal.layers.map((layer) => LAYER_NAMES[layer]).join(", ")}`);
35837
36045
  }
35838
36046
  }
35839
36047
  lines.push("", "This set filters records only on record types a base enforces (x-access in enforce mode).");
@@ -35869,7 +36077,7 @@ async function accessCommand(args2) {
35869
36077
  }
35870
36078
  console.log(values.json ? JSON.stringify(data, null, 2) : formatExplanation(data).join("\n"));
35871
36079
  }
35872
- var USAGE6, LAYER_NAMES, kindName, text2, list, TURN_NAMES;
36080
+ var USAGE6, LAYER_NAMES, kindName, text3, list, TURN_NAMES;
35873
36081
  var init_access = __esm({
35874
36082
  "src/commands/access.ts"() {
35875
36083
  "use strict";
@@ -35932,8 +36140,8 @@ organization admin.
35932
36140
  agent: "agent"
35933
36141
  };
35934
36142
  kindName = (kind) => kind === "public" ? "everyone else" : LAYER_NAMES[kind];
35935
- text2 = (value) => sanitizeTerminalText(value);
35936
- list = (ids) => ids.length === 0 ? "nothing" : ids.map(text2).join(" ");
36143
+ text3 = (value) => sanitizeTerminalText(value);
36144
+ list = (ids) => ids.length === 0 ? "nothing" : ids.map(text3).join(" ");
35937
36145
  TURN_NAMES = {
35938
36146
  own_conversation: "Their message in their own conversation",
35939
36147
  team_send: "Their message with no customer in the turn (a team send or a consult they start)",
@@ -36091,11 +36299,11 @@ function ensureSyncDir(dir) {
36091
36299
  if (!fs30.lstatSync(dir).isDirectory()) throw symlinkRefusal(dir, "directory");
36092
36300
  }
36093
36301
  function readRecord(dir) {
36094
- const text3 = readRealFileOrThrow(dir, path42.join(dir, RECORD_FILE));
36095
- if (text3 === null) return null;
36302
+ const text4 = readRealFileOrThrow(dir, path42.join(dir, RECORD_FILE));
36303
+ if (text4 === null) return null;
36096
36304
  let parsed;
36097
36305
  try {
36098
- parsed = JSON.parse(text3);
36306
+ parsed = JSON.parse(text4);
36099
36307
  } catch {
36100
36308
  parsed = void 0;
36101
36309
  }
@@ -37503,8 +37711,8 @@ async function runArchiveRead(positional, flagArgs) {
37503
37711
  const id = String(m.message_id ?? "");
37504
37712
  const sender = String(m.sender_type ?? "");
37505
37713
  const ts = String(m.created_at ?? "");
37506
- const text3 = truncate2(String(m.message_text ?? ""), 80);
37507
- console.log(` ${id} | ${sender} | ${ts} | ${text3}`);
37714
+ const text4 = truncate2(String(m.message_text ?? ""), 80);
37715
+ console.log(` ${id} | ${sender} | ${ts} | ${text4}`);
37508
37716
  }
37509
37717
  }
37510
37718
  }
@@ -42610,7 +42818,7 @@ Commands:
42610
42818
  sync-mcp Re-discover an MCP connection's tools (refresh stale schemas)
42611
42819
  list List organizations and hubs
42612
42820
  communities An organization's communities: list, join link (get/rotate/off), stats, access list (list/add/remove) \u2014 \`wayai communities --help\`
42613
- contacts Link a contact to its customer record in a base, or unlink it (browser sign-in only) \u2014 \`wayai contacts --help\`
42821
+ contacts A contact's customer record in a base; person links, the deny list, person lookup (browser sign-in only) \u2014 \`wayai contacts --help\`
42614
42822
  dimensions An organization's access dimensions and their values: list, create, relabel, add/retire values \u2014 \`wayai dimensions --help\`
42615
42823
  access explain The access set a hub agent's toolset calls send for a person, and which layer removed each value \u2014 \`wayai access --help\`
42616
42824
  knowledge refresh-preview Make the knowledge base's preview hold its production base's files \u2014 \`wayai knowledge --help\`