@wayai/cli 0.3.261 → 0.3.263

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
@@ -4888,6 +4888,218 @@ var init_fs_safety = __esm({
4888
4888
  }
4889
4889
  });
4890
4890
 
4891
+ // ../../packages/core/dist/chunk-HZ6CADSY.js
4892
+ function optionalTrimmedText(max) {
4893
+ return external_exports.string().trim().max(max).optional().transform((value) => value ? value : void 0);
4894
+ }
4895
+ function jsonLengthOrNull(value) {
4896
+ try {
4897
+ const json = JSON.stringify(value);
4898
+ return typeof json === "string" ? json.length : null;
4899
+ } catch {
4900
+ return null;
4901
+ }
4902
+ }
4903
+ function withinJsonLength(value, max) {
4904
+ const length = jsonLengthOrNull(value);
4905
+ return length !== null && length <= max;
4906
+ }
4907
+ function isAudioAttachmentFileName(fileName) {
4908
+ return /\.(mp3|ogg|oga|wav|m4a|webm)$/i.test(fileName);
4909
+ }
4910
+ var uuidSchema, USER_ID_REGEX, timestampSchema, idParamSchema, clientOptionalString, clientOptionalBoolean, clientOptionalNumber, messageAttachment, MAX_MESSAGE_BODY_BYTES, MAX_ATTACHMENTS_PER_MESSAGE, MESSAGE_ENVELOPE_HEADROOM_BYTES, MAX_AUDIO_FILE_BASE64_BYTES;
4911
+ var init_chunk_HZ6CADSY = __esm({
4912
+ "../../packages/core/dist/chunk-HZ6CADSY.js"() {
4913
+ "use strict";
4914
+ init_zod();
4915
+ uuidSchema = external_exports.string().uuid();
4916
+ USER_ID_REGEX = /^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|user_[A-Za-z0-9]+)$/i;
4917
+ timestampSchema = external_exports.string().datetime();
4918
+ idParamSchema = external_exports.object({
4919
+ id: uuidSchema
4920
+ });
4921
+ clientOptionalString = external_exports.string().nullish().transform((v) => v ?? void 0);
4922
+ clientOptionalBoolean = external_exports.boolean().nullish().transform((v) => v ?? void 0);
4923
+ clientOptionalNumber = external_exports.number().nullish().transform((v) => v ?? void 0);
4924
+ messageAttachment = external_exports.object({
4925
+ /**
4926
+ * Capped at the same 255 the storage layer already truncates names to, so nothing
4927
+ * legitimate is lost — every filesystem caps there, and `sanitizeFileName` sliced
4928
+ * longer names anyway.
4929
+ *
4930
+ * The bound is load-bearing, not hygiene: the RAW name is written to R2
4931
+ * `customMetadata.originalFileName`, and R2 rejects oversized metadata. An unbounded
4932
+ * name let a client make the R2 write throw a generic storage error — indistinguishable
4933
+ * from a real outage — which pages us via `logger.error` and, on the app channel, is
4934
+ * read as "we lost the file" and escalates the user to a human. Client input must not
4935
+ * be able to impersonate an infrastructure failure (gh #3365).
4936
+ */
4937
+ file_name: external_exports.string().max(255),
4938
+ /** Base64. Bounded by the route's bodyLimit, not by this schema. */
4939
+ file_binary: external_exports.string(),
4940
+ file_size: clientOptionalNumber,
4941
+ file_extension: clientOptionalString
4942
+ });
4943
+ MAX_MESSAGE_BODY_BYTES = 10 * 1024 * 1024;
4944
+ MAX_ATTACHMENTS_PER_MESSAGE = 20;
4945
+ MESSAGE_ENVELOPE_HEADROOM_BYTES = 64 * 1024;
4946
+ MAX_AUDIO_FILE_BASE64_BYTES = 8 * 1024 * 1024;
4947
+ }
4948
+ });
4949
+
4950
+ // ../../packages/core/dist/chunk-MIWZOSPI.js
4951
+ function toIso(epochMs) {
4952
+ return new Date(epochMs).toISOString();
4953
+ }
4954
+ function fromIso(iso) {
4955
+ return new Date(iso).getTime();
4956
+ }
4957
+ function isIsoTimestamp(value) {
4958
+ return typeof value === "string" && ISO_UTC_RE.test(value);
4959
+ }
4960
+ var ISO_UTC_RE;
4961
+ var init_chunk_MIWZOSPI = __esm({
4962
+ "../../packages/core/dist/chunk-MIWZOSPI.js"() {
4963
+ "use strict";
4964
+ ISO_UTC_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
4965
+ }
4966
+ });
4967
+
4968
+ // ../../packages/core/dist/chunk-MF2VVXBR.js
4969
+ var credentialExpiresAtSchema, LINKED_EXPIRY_REFUSAL;
4970
+ var init_chunk_MF2VVXBR = __esm({
4971
+ "../../packages/core/dist/chunk-MF2VVXBR.js"() {
4972
+ "use strict";
4973
+ init_chunk_HZ6CADSY();
4974
+ init_chunk_MIWZOSPI();
4975
+ credentialExpiresAtSchema = timestampSchema.refine(isIsoTimestamp, "Expected a canonical ISO timestamp").nullable();
4976
+ LINKED_EXPIRY_REFUSAL = "A linked organization credential's expiry is set on the credential";
4977
+ }
4978
+ });
4979
+
4980
+ // ../../packages/core/dist/chunk-YROEDMVZ.js
4981
+ function normalizeAuthType(raw) {
4982
+ if (VALID_AUTH_TYPES.has(raw)) return raw;
4983
+ return LEGACY_AUTH_TYPE_MAP[raw] ?? raw;
4984
+ }
4985
+ function isCustomerFacingAgentRole(role) {
4986
+ return typeof role === "string" && CUSTOMER_FACING_AGENT_ROLES.includes(role);
4987
+ }
4988
+ var AUTH_TYPE, ORG_CREDENTIAL_AUTH_TYPES, AUTH_TYPE_DISPLAY, LEGACY_AUTH_TYPE_MAP, VALID_AUTH_TYPES, AGENT_ROLES, PILOT_TRACK_ROLES, COPILOT_TRACK_ROLES, CUSTOMER_FACING_AGENT_ROLES, AGENT_ROLE_DISPLAY, SAFE_USER_ID_REGEX, SUPPORTED_LOCALES, SKILL_INSTALL_COMMAND;
4989
+ var init_chunk_YROEDMVZ = __esm({
4990
+ "../../packages/core/dist/chunk-YROEDMVZ.js"() {
4991
+ "use strict";
4992
+ AUTH_TYPE = {
4993
+ OAUTH: "oauth",
4994
+ API_KEY: "api_key",
4995
+ BASIC_AUTH: "basic_auth",
4996
+ BEARER: "bearer",
4997
+ NONE: "none"
4998
+ };
4999
+ ORG_CREDENTIAL_AUTH_TYPES = [
5000
+ AUTH_TYPE.API_KEY,
5001
+ AUTH_TYPE.BEARER,
5002
+ AUTH_TYPE.BASIC_AUTH
5003
+ ];
5004
+ AUTH_TYPE_DISPLAY = {
5005
+ [AUTH_TYPE.OAUTH]: "OAuth",
5006
+ [AUTH_TYPE.API_KEY]: "API Key",
5007
+ [AUTH_TYPE.BASIC_AUTH]: "Basic Auth",
5008
+ [AUTH_TYPE.BEARER]: "Bearer Token",
5009
+ [AUTH_TYPE.NONE]: "No Authentication"
5010
+ };
5011
+ LEGACY_AUTH_TYPE_MAP = {
5012
+ "OAuth": AUTH_TYPE.OAUTH,
5013
+ "API Key": AUTH_TYPE.API_KEY,
5014
+ "Basic Auth": AUTH_TYPE.BASIC_AUTH,
5015
+ "Bearer Token": AUTH_TYPE.BEARER,
5016
+ "No authentication": AUTH_TYPE.NONE,
5017
+ // Also handle the old DISPLAY_TO_CODE bug where 'basic' was used instead of 'basic_auth'
5018
+ "basic": AUTH_TYPE.BASIC_AUTH
5019
+ };
5020
+ VALID_AUTH_TYPES = new Set(Object.values(AUTH_TYPE));
5021
+ AGENT_ROLES = [
5022
+ "pilot",
5023
+ "copilot",
5024
+ "pilot_specialist",
5025
+ "copilot_specialist",
5026
+ "pilot_advisor",
5027
+ "copilot_advisor",
5028
+ "monitor",
5029
+ "conversation_evaluator",
5030
+ "message_evaluator",
5031
+ "summarizer",
5032
+ "consultant",
5033
+ "pilot_voice"
5034
+ ];
5035
+ PILOT_TRACK_ROLES = ["pilot", "pilot_specialist"];
5036
+ COPILOT_TRACK_ROLES = ["copilot", "copilot_specialist"];
5037
+ CUSTOMER_FACING_AGENT_ROLES = [...PILOT_TRACK_ROLES, "pilot_advisor"];
5038
+ AGENT_ROLE_DISPLAY = {
5039
+ pilot: "Pilot",
5040
+ copilot: "Copilot",
5041
+ pilot_specialist: "Pilot Specialist",
5042
+ copilot_specialist: "Copilot Specialist",
5043
+ pilot_advisor: "Pilot Advisor",
5044
+ copilot_advisor: "Copilot Advisor",
5045
+ monitor: "Monitor",
5046
+ conversation_evaluator: "Conversation Evaluator",
5047
+ message_evaluator: "Message Evaluator",
5048
+ summarizer: "Summarizer",
5049
+ consultant: "Consultant",
5050
+ pilot_voice: "Pilot Voice"
5051
+ };
5052
+ SAFE_USER_ID_REGEX = /^[A-Za-z0-9_-]{1,64}$/;
5053
+ SUPPORTED_LOCALES = ["en", "pt", "es"];
5054
+ SKILL_INSTALL_COMMAND = "mkdir -p .claude && npx skills add wayai-pro/wayai-skill -y";
5055
+ }
5056
+ });
5057
+
5058
+ // ../../packages/core/dist/chunk-WL5QGKHN.js
5059
+ var orgCredentialIdParam, listOrgCredentialsQuery, createOrgCredentialBody, updateOrgCredentialBody;
5060
+ var init_chunk_WL5QGKHN = __esm({
5061
+ "../../packages/core/dist/chunk-WL5QGKHN.js"() {
5062
+ "use strict";
5063
+ init_chunk_MF2VVXBR();
5064
+ init_chunk_YROEDMVZ();
5065
+ init_zod();
5066
+ orgCredentialIdParam = external_exports.object({
5067
+ id: external_exports.string().uuid()
5068
+ });
5069
+ listOrgCredentialsQuery = external_exports.object({
5070
+ organization_id: external_exports.string().uuid(),
5071
+ hub_id: external_exports.string().uuid().optional()
5072
+ });
5073
+ createOrgCredentialBody = external_exports.object({
5074
+ organization_id: external_exports.string().uuid(),
5075
+ credential_display_name: external_exports.string().min(1).max(255),
5076
+ credential_description: external_exports.string().max(1e3).nullish(),
5077
+ authentication_type: external_exports.enum(["api_key", "bearer", "basic_auth"]).or(
5078
+ external_exports.enum(["API Key", "Bearer Token", "Basic Auth"]).transform((v) => normalizeAuthType(v))
5079
+ ),
5080
+ api_key: external_exports.string().optional(),
5081
+ access_token: external_exports.string().optional(),
5082
+ username: external_exports.string().optional(),
5083
+ password: external_exports.string().optional(),
5084
+ tags: external_exports.array(external_exports.string().uuid()).optional(),
5085
+ environment: external_exports.enum(["preview", "production", "all"]).optional(),
5086
+ expires_at: credentialExpiresAtSchema.optional()
5087
+ });
5088
+ updateOrgCredentialBody = external_exports.object({
5089
+ credential_display_name: external_exports.string().min(1).max(255).optional(),
5090
+ credential_description: external_exports.string().max(1e3).nullish(),
5091
+ api_key: external_exports.string().optional(),
5092
+ access_token: external_exports.string().optional(),
5093
+ username: external_exports.string().optional(),
5094
+ password: external_exports.string().optional(),
5095
+ tags: external_exports.array(external_exports.string().uuid()).optional(),
5096
+ environment: external_exports.enum(["preview", "production", "all"]).optional(),
5097
+ // Absent keeps the stored date, unless the request stores a new secret, which clears it.
5098
+ expires_at: credentialExpiresAtSchema.optional()
5099
+ });
5100
+ }
5101
+ });
5102
+
4891
5103
  // ../../packages/core/dist/chunk-YVY2TZK2.js
4892
5104
  var orgResourceIdParam, orgResourceFileIdParam, orgResourceFolderIdParam, hubOrgResourceParam, listOrgResourcesQuery, orgIdQuery, createOrgResourceBody, updateOrgResourceBody, createOrgResourceFolderBody, updateOrgResourceFolderBody, uploadOrgResourceFileBody, updateOrgResourceFileBody, uploadOrgSkillZipBody, linkOrgResourceBody;
4893
5105
  var init_chunk_YVY2TZK2 = __esm({
@@ -5013,65 +5225,6 @@ var init_chunk_VXEAR36B = __esm({
5013
5225
  }
5014
5226
  });
5015
5227
 
5016
- // ../../packages/core/dist/chunk-HZ6CADSY.js
5017
- function optionalTrimmedText(max) {
5018
- return external_exports.string().trim().max(max).optional().transform((value) => value ? value : void 0);
5019
- }
5020
- function jsonLengthOrNull(value) {
5021
- try {
5022
- const json = JSON.stringify(value);
5023
- return typeof json === "string" ? json.length : null;
5024
- } catch {
5025
- return null;
5026
- }
5027
- }
5028
- function withinJsonLength(value, max) {
5029
- const length = jsonLengthOrNull(value);
5030
- return length !== null && length <= max;
5031
- }
5032
- function isAudioAttachmentFileName(fileName) {
5033
- return /\.(mp3|ogg|oga|wav|m4a|webm)$/i.test(fileName);
5034
- }
5035
- var uuidSchema, USER_ID_REGEX, timestampSchema, idParamSchema, clientOptionalString, clientOptionalBoolean, clientOptionalNumber, messageAttachment, MAX_MESSAGE_BODY_BYTES, MAX_ATTACHMENTS_PER_MESSAGE, MESSAGE_ENVELOPE_HEADROOM_BYTES, MAX_AUDIO_FILE_BASE64_BYTES;
5036
- var init_chunk_HZ6CADSY = __esm({
5037
- "../../packages/core/dist/chunk-HZ6CADSY.js"() {
5038
- "use strict";
5039
- init_zod();
5040
- uuidSchema = external_exports.string().uuid();
5041
- USER_ID_REGEX = /^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|user_[A-Za-z0-9]+)$/i;
5042
- timestampSchema = external_exports.string().datetime();
5043
- idParamSchema = external_exports.object({
5044
- id: uuidSchema
5045
- });
5046
- clientOptionalString = external_exports.string().nullish().transform((v) => v ?? void 0);
5047
- clientOptionalBoolean = external_exports.boolean().nullish().transform((v) => v ?? void 0);
5048
- clientOptionalNumber = external_exports.number().nullish().transform((v) => v ?? void 0);
5049
- messageAttachment = external_exports.object({
5050
- /**
5051
- * Capped at the same 255 the storage layer already truncates names to, so nothing
5052
- * legitimate is lost — every filesystem caps there, and `sanitizeFileName` sliced
5053
- * longer names anyway.
5054
- *
5055
- * The bound is load-bearing, not hygiene: the RAW name is written to R2
5056
- * `customMetadata.originalFileName`, and R2 rejects oversized metadata. An unbounded
5057
- * name let a client make the R2 write throw a generic storage error — indistinguishable
5058
- * from a real outage — which pages us via `logger.error` and, on the app channel, is
5059
- * read as "we lost the file" and escalates the user to a human. Client input must not
5060
- * be able to impersonate an infrastructure failure (gh #3365).
5061
- */
5062
- file_name: external_exports.string().max(255),
5063
- /** Base64. Bounded by the route's bodyLimit, not by this schema. */
5064
- file_binary: external_exports.string(),
5065
- file_size: clientOptionalNumber,
5066
- file_extension: clientOptionalString
5067
- });
5068
- MAX_MESSAGE_BODY_BYTES = 10 * 1024 * 1024;
5069
- MAX_ATTACHMENTS_PER_MESSAGE = 20;
5070
- MESSAGE_ENVELOPE_HEADROOM_BYTES = 64 * 1024;
5071
- MAX_AUDIO_FILE_BASE64_BYTES = 8 * 1024 * 1024;
5072
- }
5073
- });
5074
-
5075
5228
  // ../../packages/core/dist/chunk-RACEDHG6.js
5076
5229
  var resourceIdParam, listResourcesQuery, createResourceBody, updateResourceBody, syncSkillsBody, resourceFileIdParam, listResourceFilesQuery, createResourceFileBody, updateResourceFileBody, uploadResourceFileBody, uploadSkillZipBody, resourceFolderIdParam, listResourceFoldersQuery, createResourceFolderBody, updateResourceFolderBody, agentResourceQuery, hubResourceQuery, linkAgentResourceBody, updateAgentResourceBody, unlinkAgentResourceQuery;
5077
5230
  var init_chunk_RACEDHG6 = __esm({
@@ -5263,36 +5416,6 @@ var init_chunk_Q7KIQHAZ = __esm({
5263
5416
  }
5264
5417
  });
5265
5418
 
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
5419
  // ../../packages/core/dist/chunk-HA7CRZMX.js
5297
5420
  var connectionIdParam, connectorIdParam, listConnectionsQuery, deleteConnectionQuery, addConnectionBody, editConnectionBody, PRODUCTION_DIRECT_FIELDS, BESIDE_LINK_FIELDS, setProductionCredentialBody, registerWhatsappQuery, registerWhatsappBody, retryProvisioningQuery, resendDomainStatusQuery;
5298
5421
  var init_chunk_HA7CRZMX = __esm({
@@ -5475,129 +5598,6 @@ var init_chunk_NKLVUTFO = __esm({
5475
5598
  }
5476
5599
  });
5477
5600
 
5478
- // ../../packages/core/dist/chunk-YROEDMVZ.js
5479
- function normalizeAuthType(raw) {
5480
- if (VALID_AUTH_TYPES.has(raw)) return raw;
5481
- return LEGACY_AUTH_TYPE_MAP[raw] ?? raw;
5482
- }
5483
- function isCustomerFacingAgentRole(role) {
5484
- return typeof role === "string" && CUSTOMER_FACING_AGENT_ROLES.includes(role);
5485
- }
5486
- var AUTH_TYPE, ORG_CREDENTIAL_AUTH_TYPES, AUTH_TYPE_DISPLAY, LEGACY_AUTH_TYPE_MAP, VALID_AUTH_TYPES, AGENT_ROLES, PILOT_TRACK_ROLES, COPILOT_TRACK_ROLES, CUSTOMER_FACING_AGENT_ROLES, AGENT_ROLE_DISPLAY, SAFE_USER_ID_REGEX, SUPPORTED_LOCALES, SKILL_INSTALL_COMMAND;
5487
- var init_chunk_YROEDMVZ = __esm({
5488
- "../../packages/core/dist/chunk-YROEDMVZ.js"() {
5489
- "use strict";
5490
- AUTH_TYPE = {
5491
- OAUTH: "oauth",
5492
- API_KEY: "api_key",
5493
- BASIC_AUTH: "basic_auth",
5494
- BEARER: "bearer",
5495
- NONE: "none"
5496
- };
5497
- ORG_CREDENTIAL_AUTH_TYPES = [
5498
- AUTH_TYPE.API_KEY,
5499
- AUTH_TYPE.BEARER,
5500
- AUTH_TYPE.BASIC_AUTH
5501
- ];
5502
- AUTH_TYPE_DISPLAY = {
5503
- [AUTH_TYPE.OAUTH]: "OAuth",
5504
- [AUTH_TYPE.API_KEY]: "API Key",
5505
- [AUTH_TYPE.BASIC_AUTH]: "Basic Auth",
5506
- [AUTH_TYPE.BEARER]: "Bearer Token",
5507
- [AUTH_TYPE.NONE]: "No Authentication"
5508
- };
5509
- LEGACY_AUTH_TYPE_MAP = {
5510
- "OAuth": AUTH_TYPE.OAUTH,
5511
- "API Key": AUTH_TYPE.API_KEY,
5512
- "Basic Auth": AUTH_TYPE.BASIC_AUTH,
5513
- "Bearer Token": AUTH_TYPE.BEARER,
5514
- "No authentication": AUTH_TYPE.NONE,
5515
- // Also handle the old DISPLAY_TO_CODE bug where 'basic' was used instead of 'basic_auth'
5516
- "basic": AUTH_TYPE.BASIC_AUTH
5517
- };
5518
- VALID_AUTH_TYPES = new Set(Object.values(AUTH_TYPE));
5519
- AGENT_ROLES = [
5520
- "pilot",
5521
- "copilot",
5522
- "pilot_specialist",
5523
- "copilot_specialist",
5524
- "pilot_advisor",
5525
- "copilot_advisor",
5526
- "monitor",
5527
- "conversation_evaluator",
5528
- "message_evaluator",
5529
- "summarizer",
5530
- "consultant",
5531
- "pilot_voice"
5532
- ];
5533
- PILOT_TRACK_ROLES = ["pilot", "pilot_specialist"];
5534
- COPILOT_TRACK_ROLES = ["copilot", "copilot_specialist"];
5535
- CUSTOMER_FACING_AGENT_ROLES = [...PILOT_TRACK_ROLES, "pilot_advisor"];
5536
- AGENT_ROLE_DISPLAY = {
5537
- pilot: "Pilot",
5538
- copilot: "Copilot",
5539
- pilot_specialist: "Pilot Specialist",
5540
- copilot_specialist: "Copilot Specialist",
5541
- pilot_advisor: "Pilot Advisor",
5542
- copilot_advisor: "Copilot Advisor",
5543
- monitor: "Monitor",
5544
- conversation_evaluator: "Conversation Evaluator",
5545
- message_evaluator: "Message Evaluator",
5546
- summarizer: "Summarizer",
5547
- consultant: "Consultant",
5548
- pilot_voice: "Pilot Voice"
5549
- };
5550
- SAFE_USER_ID_REGEX = /^[A-Za-z0-9_-]{1,64}$/;
5551
- SUPPORTED_LOCALES = ["en", "pt", "es"];
5552
- SKILL_INSTALL_COMMAND = "mkdir -p .claude && npx skills add wayai-pro/wayai-skill -y";
5553
- }
5554
- });
5555
-
5556
- // ../../packages/core/dist/chunk-WL5QGKHN.js
5557
- var orgCredentialIdParam, listOrgCredentialsQuery, createOrgCredentialBody, updateOrgCredentialBody;
5558
- var init_chunk_WL5QGKHN = __esm({
5559
- "../../packages/core/dist/chunk-WL5QGKHN.js"() {
5560
- "use strict";
5561
- init_chunk_MF2VVXBR();
5562
- init_chunk_YROEDMVZ();
5563
- init_zod();
5564
- orgCredentialIdParam = external_exports.object({
5565
- id: external_exports.string().uuid()
5566
- });
5567
- listOrgCredentialsQuery = external_exports.object({
5568
- organization_id: external_exports.string().uuid(),
5569
- hub_id: external_exports.string().uuid().optional()
5570
- });
5571
- createOrgCredentialBody = external_exports.object({
5572
- organization_id: external_exports.string().uuid(),
5573
- credential_display_name: external_exports.string().min(1).max(255),
5574
- credential_description: external_exports.string().max(1e3).nullish(),
5575
- authentication_type: external_exports.enum(["api_key", "bearer", "basic_auth"]).or(
5576
- external_exports.enum(["API Key", "Bearer Token", "Basic Auth"]).transform((v) => normalizeAuthType(v))
5577
- ),
5578
- api_key: external_exports.string().optional(),
5579
- access_token: external_exports.string().optional(),
5580
- username: external_exports.string().optional(),
5581
- password: external_exports.string().optional(),
5582
- tags: external_exports.array(external_exports.string().uuid()).optional(),
5583
- environment: external_exports.enum(["preview", "production", "all"]).optional(),
5584
- expires_at: credentialExpiresAtSchema.optional()
5585
- });
5586
- updateOrgCredentialBody = external_exports.object({
5587
- credential_display_name: external_exports.string().min(1).max(255).optional(),
5588
- credential_description: external_exports.string().max(1e3).nullish(),
5589
- api_key: external_exports.string().optional(),
5590
- access_token: external_exports.string().optional(),
5591
- username: external_exports.string().optional(),
5592
- password: external_exports.string().optional(),
5593
- tags: external_exports.array(external_exports.string().uuid()).optional(),
5594
- environment: external_exports.enum(["preview", "production", "all"]).optional(),
5595
- // Absent keeps the stored date, unless the request stores a new secret, which clears it.
5596
- expires_at: credentialExpiresAtSchema.optional()
5597
- });
5598
- }
5599
- });
5600
-
5601
5601
  // ../../packages/core/dist/chunk-ZC6YGHNX.js
5602
5602
  var updateUserBody, updateProfileBody, pathnameRegex, updatePreferencesBody, registerPushTokenBody, deletePushTokenQuery, recordAiDisclosureAcceptanceBody, activityQuery, deletionModeSchema, deletionRequestBody;
5603
5603
  var init_chunk_ZC6YGHNX = __esm({
@@ -6532,472 +6532,6 @@ var init_chunk_VEERWOZ6 = __esm({
6532
6532
  }
6533
6533
  });
6534
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-IPEFFLCO.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_IPEFFLCO = __esm({
6653
- "../../packages/core/dist/chunk-IPEFFLCO.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-YHH6V2TT.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_YHH6V2TT = __esm({
6827
- "../../packages/core/dist/chunk-YHH6V2TT.js"() {
6828
- "use strict";
6829
- init_chunk_IPEFFLCO();
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
-
6883
- // ../../packages/core/dist/chunk-YUZFHVB2.js
6884
- var invitePreviewQuery, inviteRolePreviewResponse, inviteContactPreviewResponse, invitePreviewResponse, inviteUnsubscribeBody;
6885
- var init_chunk_YUZFHVB2 = __esm({
6886
- "../../packages/core/dist/chunk-YUZFHVB2.js"() {
6887
- "use strict";
6888
- init_zod();
6889
- invitePreviewQuery = external_exports.object({
6890
- token: external_exports.string().min(1).max(2048)
6891
- });
6892
- inviteRolePreviewResponse = external_exports.object({
6893
- inviter_name: external_exports.string(),
6894
- entity_id: external_exports.string().uuid(),
6895
- entity_name: external_exports.string(),
6896
- entity_type: external_exports.enum(["org", "hub"]),
6897
- role: external_exports.enum(["org_admin", "admin", "team_user", "user"]),
6898
- expires_at: external_exports.string().datetime()
6899
- });
6900
- inviteContactPreviewResponse = external_exports.object({
6901
- inviter_name: external_exports.string().nullable(),
6902
- entity_id: external_exports.string().uuid(),
6903
- entity_type: external_exports.literal("contact"),
6904
- role: external_exports.literal("contact"),
6905
- expires_at: external_exports.string().datetime()
6906
- });
6907
- invitePreviewResponse = external_exports.union([inviteRolePreviewResponse, inviteContactPreviewResponse]);
6908
- inviteUnsubscribeBody = external_exports.object({ token: external_exports.string().min(1).max(256) }).strict();
6909
- }
6910
- });
6911
-
6912
- // ../../packages/core/dist/chunk-I3O2RACG.js
6913
- var managedAgentsWebhookParams, MANAGED_AGENTS_WEBHOOK_BODY_MAX_BYTES;
6914
- var init_chunk_I3O2RACG = __esm({
6915
- "../../packages/core/dist/chunk-I3O2RACG.js"() {
6916
- "use strict";
6917
- init_zod();
6918
- managedAgentsWebhookParams = external_exports.object({
6919
- hub_id: external_exports.string().uuid(),
6920
- connection_id: external_exports.string().uuid()
6921
- });
6922
- MANAGED_AGENTS_WEBHOOK_BODY_MAX_BYTES = 16 * 1024;
6923
- }
6924
- });
6925
-
6926
- // ../../packages/core/dist/chunk-34LE6P7E.js
6927
- var templateIdParam, listTemplatesQuery, deleteTemplateQuery, templateStatusQuery, createTemplateBody, updateTemplateBody, submitTemplateBody, testTemplateBody;
6928
- var init_chunk_34LE6P7E = __esm({
6929
- "../../packages/core/dist/chunk-34LE6P7E.js"() {
6930
- "use strict";
6931
- init_zod();
6932
- templateIdParam = external_exports.object({
6933
- id: external_exports.string().uuid()
6934
- });
6935
- listTemplatesQuery = external_exports.object({
6936
- hub_id: external_exports.string().uuid(),
6937
- connection_id: external_exports.string().uuid()
6938
- });
6939
- deleteTemplateQuery = external_exports.object({
6940
- hub_id: external_exports.string().uuid(),
6941
- connection_id: external_exports.string().uuid()
6942
- });
6943
- templateStatusQuery = external_exports.object({
6944
- hub_id: external_exports.string().uuid(),
6945
- connection_id: external_exports.string().uuid()
6946
- });
6947
- createTemplateBody = external_exports.object({
6948
- hub_id: external_exports.string().uuid(),
6949
- connection_id: external_exports.string().uuid()
6950
- }).passthrough();
6951
- updateTemplateBody = external_exports.object({}).passthrough();
6952
- submitTemplateBody = external_exports.object({
6953
- hub_id: external_exports.string().uuid(),
6954
- connection_id: external_exports.string().uuid()
6955
- }).passthrough();
6956
- testTemplateBody = external_exports.object({
6957
- hub_id: external_exports.string().uuid(),
6958
- connection_id: external_exports.string().uuid()
6959
- }).passthrough();
6960
- }
6961
- });
6962
-
6963
- // ../../packages/core/dist/chunk-FPSDNS2E.js
6964
- var noticeSeveritySchema, noticeStatusSchema, NOTICE_SCOPE_REGEX, noticeScopeSchema, noticeLinkSchema, createNoticeBody, updateNoticeBody, listNoticesQuery, noticeIdParamSchema;
6965
- var init_chunk_FPSDNS2E = __esm({
6966
- "../../packages/core/dist/chunk-FPSDNS2E.js"() {
6967
- "use strict";
6968
- init_zod();
6969
- noticeSeveritySchema = external_exports.enum(["critical", "warn", "info"]);
6970
- noticeStatusSchema = external_exports.enum(["active", "resolved"]);
6971
- NOTICE_SCOPE_REGEX = /^(global|provider:[a-z0-9_-]{1,40}|service:[a-z0-9_-]{1,40})$/;
6972
- noticeScopeSchema = external_exports.string().regex(NOTICE_SCOPE_REGEX, "scope must be 'global', 'provider:<x>', or 'service:<x>'");
6973
- noticeLinkSchema = external_exports.string().url().refine((u) => /^https?:\/\//i.test(u), { message: "link must be an http(s) URL" });
6974
- createNoticeBody = external_exports.object({
6975
- severity: noticeSeveritySchema.default("info"),
6976
- scope: noticeScopeSchema.default("global"),
6977
- title: external_exports.string().trim().min(1).max(200),
6978
- body: external_exports.string().max(2e3).optional(),
6979
- link: noticeLinkSchema.optional(),
6980
- starts_at: external_exports.string().datetime().optional(),
6981
- ends_at: external_exports.string().datetime().optional()
6982
- });
6983
- updateNoticeBody = external_exports.object({
6984
- severity: noticeSeveritySchema.optional(),
6985
- scope: noticeScopeSchema.optional(),
6986
- title: external_exports.string().trim().min(1).max(200).optional(),
6987
- body: external_exports.string().max(2e3).nullable().optional(),
6988
- link: noticeLinkSchema.nullable().optional(),
6989
- starts_at: external_exports.string().datetime().optional(),
6990
- ends_at: external_exports.string().datetime().nullable().optional()
6991
- }).refine((b) => Object.keys(b).length > 0, { message: "at least one field must be provided" });
6992
- listNoticesQuery = external_exports.object({
6993
- status: noticeStatusSchema.optional(),
6994
- limit: external_exports.coerce.number().int().min(1).max(200).optional(),
6995
- offset: external_exports.coerce.number().int().min(0).optional()
6996
- });
6997
- noticeIdParamSchema = external_exports.object({ id: external_exports.string().min(1) });
6998
- }
6999
- });
7000
-
7001
6535
  // ../../packages/core/dist/chunk-L55XSECQ.js
7002
6536
  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;
7003
6537
  var init_chunk_L55XSECQ = __esm({
@@ -7467,6 +7001,480 @@ var init_chunk_BUYOPDSJ = __esm({
7467
7001
  }
7468
7002
  });
7469
7003
 
7004
+ // ../../packages/core/dist/chunk-OS6EZSUS.js
7005
+ var TOOLSET_ANSWER_PERSON_PARTIES, toolsetAnswerPersonSchema, toolsetAnswerPersonsSchema;
7006
+ var init_chunk_OS6EZSUS = __esm({
7007
+ "../../packages/core/dist/chunk-OS6EZSUS.js"() {
7008
+ "use strict";
7009
+ init_chunk_BUYOPDSJ();
7010
+ init_chunk_L55XSECQ();
7011
+ init_zod();
7012
+ TOOLSET_ANSWER_PERSON_PARTIES = ["requester", "originator", "initiator", "delegator"];
7013
+ toolsetAnswerPersonSchema = external_exports.object({
7014
+ party: external_exports.enum(TOOLSET_ANSWER_PERSON_PARTIES),
7015
+ person_id: rekorPersonIdSchema
7016
+ }).strict();
7017
+ toolsetAnswerPersonsSchema = external_exports.array(toolsetAnswerPersonSchema).min(1).max(REKOR_MAX_PERSON_PARTIES);
7018
+ }
7019
+ });
7020
+
7021
+ // ../../packages/core/dist/chunk-ZVXO3XL6.js
7022
+ 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;
7023
+ var init_chunk_ZVXO3XL6 = __esm({
7024
+ "../../packages/core/dist/chunk-ZVXO3XL6.js"() {
7025
+ "use strict";
7026
+ init_chunk_HZ6CADSY();
7027
+ init_zod();
7028
+ PEOPLE_CONTACT_PAGE_MAX = 100;
7029
+ PEOPLE_CONTACT_PAGE_DEFAULT = 50;
7030
+ PEOPLE_CONTACT_EMAIL_MAX_LENGTH = 254;
7031
+ peopleUserIdSchema = external_exports.string().max(64).regex(USER_ID_REGEX, "must be a user id");
7032
+ peopleInviteEmailSchema = external_exports.string().trim().max(PEOPLE_CONTACT_EMAIL_MAX_LENGTH).email();
7033
+ peopleContactInviteBody = external_exports.object({
7034
+ email: peopleInviteEmailSchema
7035
+ }).strict();
7036
+ peopleContactInviteIdParam = external_exports.object({ inviteId: uuidSchema });
7037
+ peopleContactUserIdParam = external_exports.object({ userId: peopleUserIdSchema });
7038
+ 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, {
7039
+ message: "Name a thread or a community, not both",
7040
+ path: ["community_id"]
7041
+ });
7042
+ peopleContactPageQuery = external_exports.object({
7043
+ cursor: external_exports.string().min(1).max(256).optional(),
7044
+ limit: external_exports.coerce.number().int().min(1).max(PEOPLE_CONTACT_PAGE_MAX).default(PEOPLE_CONTACT_PAGE_DEFAULT)
7045
+ });
7046
+ peopleOutgoingInviteSchema = external_exports.object({
7047
+ invite_id: uuidSchema,
7048
+ email: external_exports.string(),
7049
+ status: external_exports.literal("sent"),
7050
+ created_at: timestampSchema,
7051
+ expires_at: timestampSchema
7052
+ }).strict();
7053
+ peopleContactPersonSchema = external_exports.object({
7054
+ user_id: peopleUserIdSchema,
7055
+ display_name: external_exports.string().nullable(),
7056
+ email: external_exports.string().nullable()
7057
+ }).strict();
7058
+ peopleContactSchema = peopleContactPersonSchema.extend({ contact_since: timestampSchema, thread_id: uuidSchema }).strict();
7059
+ peopleIncomingInviteSchema = external_exports.object({
7060
+ invite_id: uuidSchema,
7061
+ inviter: peopleContactPersonSchema,
7062
+ created_at: timestampSchema,
7063
+ expires_at: timestampSchema
7064
+ }).strict();
7065
+ peopleBlockedUserSchema = peopleContactPersonSchema.extend({ blocked_at: timestampSchema, deleted_user: external_exports.boolean() }).strict();
7066
+ }
7067
+ });
7068
+
7069
+ // ../../packages/core/dist/chunk-ZXK6N2HN.js
7070
+ 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;
7071
+ var init_chunk_ZXK6N2HN = __esm({
7072
+ "../../packages/core/dist/chunk-ZXK6N2HN.js"() {
7073
+ "use strict";
7074
+ init_chunk_ZVXO3XL6();
7075
+ init_chunk_HZ6CADSY();
7076
+ init_zod();
7077
+ PEOPLE_MODERATION_NOTE_MAX_LENGTH = 500;
7078
+ ADMIN_PEOPLE_REPORTS_PAGE_MAX = 100;
7079
+ ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT = 50;
7080
+ PEOPLE_SUSPENDED_REASON = "suspended";
7081
+ peopleModerationActionSchema = external_exports.enum(["remove_message", "suspend", "unsuspend", "dismiss"]);
7082
+ moderationNoteSchema = optionalTrimmedText(PEOPLE_MODERATION_NOTE_MAX_LENGTH);
7083
+ adminPeopleReportListQuery = external_exports.object({
7084
+ pending: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true"),
7085
+ /** Lower bound on `created_at`. */
7086
+ since: timestampSchema.optional(),
7087
+ limit: external_exports.coerce.number().int().min(1).max(ADMIN_PEOPLE_REPORTS_PAGE_MAX).default(ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT),
7088
+ offset: external_exports.coerce.number().int().min(0).default(0)
7089
+ });
7090
+ adminPeopleReportIdParam = external_exports.object({ reportId: uuidSchema });
7091
+ adminPeopleMessageRemovalBody = external_exports.object({ report_id: uuidSchema, message_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
7092
+ adminPeopleSuspendBody = external_exports.object({ report_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
7093
+ adminPeopleNoteBody = external_exports.object({ note: moderationNoteSchema }).strict();
7094
+ }
7095
+ });
7096
+
7097
+ // ../../packages/core/dist/chunk-Y7CFCYX4.js
7098
+ var PEOPLE_REPORT_DETAILS_MAX_LENGTH, peopleReportReasonSchema, reportDetailsSchema, reportFields, peopleReportBody;
7099
+ var init_chunk_Y7CFCYX4 = __esm({
7100
+ "../../packages/core/dist/chunk-Y7CFCYX4.js"() {
7101
+ "use strict";
7102
+ init_chunk_ZVXO3XL6();
7103
+ init_chunk_HZ6CADSY();
7104
+ init_zod();
7105
+ PEOPLE_REPORT_DETAILS_MAX_LENGTH = 500;
7106
+ peopleReportReasonSchema = external_exports.enum(["spam", "harassment", "hate", "sexual", "violence", "other"]);
7107
+ reportDetailsSchema = optionalTrimmedText(PEOPLE_REPORT_DETAILS_MAX_LENGTH);
7108
+ reportFields = { reason: peopleReportReasonSchema, details: reportDetailsSchema };
7109
+ peopleReportBody = external_exports.discriminatedUnion("target", [
7110
+ external_exports.object({ target: external_exports.literal("message"), thread_id: uuidSchema, message_id: uuidSchema, ...reportFields }).strict(),
7111
+ external_exports.object({ target: external_exports.literal("thread"), thread_id: uuidSchema, ...reportFields }).strict(),
7112
+ external_exports.object({ target: external_exports.literal("user"), user_id: peopleUserIdSchema, thread_id: uuidSchema.optional(), ...reportFields }).strict(),
7113
+ external_exports.object({
7114
+ target: external_exports.literal("community_message"),
7115
+ community_id: uuidSchema,
7116
+ room_id: uuidSchema,
7117
+ message_id: uuidSchema,
7118
+ ...reportFields
7119
+ }).strict(),
7120
+ external_exports.object({ target: external_exports.literal("community_member"), community_id: uuidSchema, user_id: peopleUserIdSchema, ...reportFields }).strict()
7121
+ ]);
7122
+ }
7123
+ });
7124
+
7125
+ // ../../packages/core/dist/chunk-S5SVBLGT.js
7126
+ function normalizeContactPhone(raw) {
7127
+ const compact = raw.trim().replace(/[\s\-.()]/g, "");
7128
+ const withPlus = compact.startsWith("00") ? `+${compact.slice(2)}` : compact;
7129
+ return /^\+[1-9]\d{7,14}$/.test(withPlus) ? withPlus : null;
7130
+ }
7131
+ function normalizeContactLabel(raw) {
7132
+ return raw.trim().replace(/\s+/g, " ").toLowerCase();
7133
+ }
7134
+ function importRowLabels(row, batchLabels) {
7135
+ return [.../* @__PURE__ */ new Set([...row.labels ?? [], ...batchLabels ?? []])];
7136
+ }
7137
+ 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, listName, contactListFilterSchema, createContactBookListBody, updateContactBookListBody, updateContactBookListPinsBody, suppressionIdentitySchema, createContactBookSuppressionBody, contactBookSuppressionParam, listContactBookSuppressionsQuery, contactBookEmailUnsubscribeTokenSchema, contactBookEmailUnsubscribeQuery, orgListReferenceSchema;
7138
+ var init_chunk_S5SVBLGT = __esm({
7139
+ "../../packages/core/dist/chunk-S5SVBLGT.js"() {
7140
+ "use strict";
7141
+ init_zod();
7142
+ CONTACT_ENVIRONMENTS = ["production", "preview", "all"];
7143
+ CONTACT_NAME_MAX = 200;
7144
+ CONTACT_EMAIL_MAX = 320;
7145
+ CONTACT_PHONE_INPUT_MAX = 40;
7146
+ CONTACT_INSTAGRAM_SID_MAX = 64;
7147
+ CONTACT_METADATA_MAX_BYTES = 4096;
7148
+ CONTACT_LABEL_MAX = 64;
7149
+ CONTACT_LABELS_MAX = 20;
7150
+ CONTACT_SCOPE_TAGS_MAX = 20;
7151
+ CONTACT_PAGE_MAX = 100;
7152
+ CONTACT_IMPORT_BATCH_MAX = 500;
7153
+ CONTACT_SEARCH_MAX = 100;
7154
+ CONTACT_LIST_NAME_MAX = 64;
7155
+ CONTACT_LIST_NAME_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
7156
+ CONTACT_LIST_DESCRIPTION_MAX = 1e3;
7157
+ CONTACT_LIST_FILTER_MAX = 20;
7158
+ CONTACT_LIST_PINS_PER_REQUEST_MAX = 100;
7159
+ SUPPRESSION_SCOPES = ["all", "marketing"];
7160
+ SUPPRESSION_ID_REGEX = /^[0-9a-f]{64}$/;
7161
+ contactName = external_exports.string().trim().min(1).max(CONTACT_NAME_MAX);
7162
+ contactPhone = external_exports.string().max(CONTACT_PHONE_INPUT_MAX).transform((raw, ctx) => {
7163
+ const phone = normalizeContactPhone(raw);
7164
+ if (phone === null) {
7165
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Phone must be an international number, e.g. +5511999999999" });
7166
+ return external_exports.NEVER;
7167
+ }
7168
+ return phone;
7169
+ });
7170
+ contactEmail = external_exports.string().trim().toLowerCase().max(CONTACT_EMAIL_MAX).email();
7171
+ contactInstagramSid = external_exports.string().trim().min(1).max(CONTACT_INSTAGRAM_SID_MAX);
7172
+ 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");
7173
+ contactLabels = external_exports.array(contactLabel).max(CONTACT_LABELS_MAX).transform((labels) => [...new Set(labels)]);
7174
+ contactMetadata = external_exports.record(external_exports.unknown()).refine(
7175
+ (metadata) => new TextEncoder().encode(JSON.stringify(metadata)).length <= CONTACT_METADATA_MAX_BYTES,
7176
+ `Metadata must serialize to at most ${CONTACT_METADATA_MAX_BYTES} bytes`
7177
+ );
7178
+ scopeTagIds = external_exports.array(external_exports.string().uuid()).min(1).max(CONTACT_SCOPE_TAGS_MAX).transform((ids) => [...new Set(ids)]);
7179
+ contactVisibilitySchema = external_exports.discriminatedUnion("scope", [
7180
+ external_exports.object({ scope: external_exports.literal("all_hubs") }).strict(),
7181
+ external_exports.object({ scope: external_exports.literal("tags"), tag_ids: scopeTagIds }).strict()
7182
+ ]);
7183
+ hasIdentity = (row) => Boolean(row.phone || row.email || row.instagram_sid);
7184
+ IDENTITY_REQUIRED = "A contact needs a phone, an email or an Instagram id";
7185
+ contactBookOrgQuery = external_exports.object({
7186
+ organization_id: external_exports.string().uuid()
7187
+ });
7188
+ contactBookContactParam = external_exports.object({
7189
+ contactId: external_exports.string().uuid()
7190
+ });
7191
+ contactBookListParam = external_exports.object({
7192
+ listId: external_exports.string().uuid()
7193
+ });
7194
+ contactBookHubParam = external_exports.object({
7195
+ hubId: external_exports.string().uuid()
7196
+ });
7197
+ contactBookPageQuery = external_exports.object({
7198
+ cursor: external_exports.string().max(2048).optional(),
7199
+ limit: external_exports.coerce.number().int().min(1).max(CONTACT_PAGE_MAX).default(50)
7200
+ });
7201
+ listContactBookContactsQuery = contactBookOrgQuery.merge(contactBookPageQuery).extend({
7202
+ q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional(),
7203
+ label: external_exports.string().max(CONTACT_LABEL_MAX).transform(normalizeContactLabel).optional(),
7204
+ scope_tag_id: external_exports.string().uuid().optional()
7205
+ });
7206
+ listHubContactBookContactsQuery = contactBookPageQuery.extend({
7207
+ q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional()
7208
+ });
7209
+ contactBookLinkCandidatesQuery = contactBookOrgQuery.extend({
7210
+ email: contactEmail
7211
+ });
7212
+ listContactBookListMembersQuery = contactBookOrgQuery.merge(contactBookPageQuery);
7213
+ contactRowFields = {
7214
+ name: contactName,
7215
+ phone: contactPhone.nullish(),
7216
+ email: contactEmail.nullish(),
7217
+ instagram_sid: contactInstagramSid.nullish(),
7218
+ labels: contactLabels.optional(),
7219
+ metadata: contactMetadata.optional()
7220
+ };
7221
+ createContactBookContactBody = external_exports.object({
7222
+ organization_id: external_exports.string().uuid(),
7223
+ ...contactRowFields,
7224
+ visibility: contactVisibilitySchema,
7225
+ environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
7226
+ }).strict().refine(hasIdentity, IDENTITY_REQUIRED);
7227
+ updateContactBookContactBody = external_exports.object({
7228
+ name: contactName.optional(),
7229
+ phone: contactPhone.nullable().optional(),
7230
+ email: contactEmail.nullable().optional(),
7231
+ instagram_sid: contactInstagramSid.nullable().optional(),
7232
+ labels: contactLabels.optional(),
7233
+ metadata: contactMetadata.optional(),
7234
+ visibility: contactVisibilitySchema.optional(),
7235
+ environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
7236
+ }).strict();
7237
+ contactImportRowSchema = external_exports.object(contactRowFields).strict().refine(hasIdentity, IDENTITY_REQUIRED);
7238
+ importContactBookContactsBody = external_exports.object({
7239
+ organization_id: external_exports.string().uuid(),
7240
+ visibility: contactVisibilitySchema,
7241
+ environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional(),
7242
+ labels: contactLabels.optional(),
7243
+ rows: external_exports.array(contactImportRowSchema).min(1).max(CONTACT_IMPORT_BATCH_MAX)
7244
+ }).strict().superRefine((batch, ctx) => {
7245
+ batch.rows.forEach((row, index) => {
7246
+ if (importRowLabels(row, batch.labels).length > CONTACT_LABELS_MAX) {
7247
+ ctx.addIssue({
7248
+ code: external_exports.ZodIssueCode.custom,
7249
+ path: ["rows", index, "labels"],
7250
+ message: `A contact holds at most ${CONTACT_LABELS_MAX} labels, the batch's included`
7251
+ });
7252
+ }
7253
+ });
7254
+ });
7255
+ linkContactBookContactBody = external_exports.object({
7256
+ user_id: external_exports.string().min(1).max(128)
7257
+ }).strict();
7258
+ listName = external_exports.string().trim().min(1).max(CONTACT_LIST_NAME_MAX).regex(CONTACT_LIST_NAME_REGEX, {
7259
+ message: 'Must be lowercase alphanumeric with hyphens (e.g. "vip-customers")'
7260
+ });
7261
+ contactListFilterSchema = external_exports.object({
7262
+ labels: external_exports.array(contactLabel).max(CONTACT_LIST_FILTER_MAX).transform((l) => [...new Set(l)]).default([]),
7263
+ scope_tag_ids: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_FILTER_MAX).transform((t) => [...new Set(t)]).default([])
7264
+ }).strict();
7265
+ createContactBookListBody = external_exports.object({
7266
+ organization_id: external_exports.string().uuid(),
7267
+ name: listName,
7268
+ description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullish(),
7269
+ filter: contactListFilterSchema.optional()
7270
+ }).strict();
7271
+ updateContactBookListBody = external_exports.object({
7272
+ name: listName.optional(),
7273
+ description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullable().optional(),
7274
+ filter: contactListFilterSchema.optional()
7275
+ }).strict();
7276
+ updateContactBookListPinsBody = external_exports.object({
7277
+ add: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([]),
7278
+ remove: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([])
7279
+ }).strict().refine((b) => b.add.length + b.remove.length > 0, "Add or remove at least one contact");
7280
+ suppressionIdentitySchema = external_exports.discriminatedUnion("kind", [
7281
+ external_exports.object({ kind: external_exports.literal("phone"), value: contactPhone }).strict(),
7282
+ external_exports.object({ kind: external_exports.literal("email"), value: contactEmail }).strict(),
7283
+ external_exports.object({ kind: external_exports.literal("instagram"), value: contactInstagramSid }).strict()
7284
+ ]);
7285
+ createContactBookSuppressionBody = external_exports.object({
7286
+ organization_id: external_exports.string().uuid(),
7287
+ identity: suppressionIdentitySchema,
7288
+ scope: external_exports.enum(SUPPRESSION_SCOPES)
7289
+ }).strict();
7290
+ contactBookSuppressionParam = external_exports.object({
7291
+ suppressionId: external_exports.string().regex(SUPPRESSION_ID_REGEX)
7292
+ });
7293
+ listContactBookSuppressionsQuery = contactBookOrgQuery.merge(contactBookPageQuery);
7294
+ contactBookEmailUnsubscribeTokenSchema = external_exports.string().max(200).regex(/^[0-9a-f-]{36}\.[0-9a-f]{64}\.[0-9a-f]{64}$/i);
7295
+ contactBookEmailUnsubscribeQuery = external_exports.object({ token: contactBookEmailUnsubscribeTokenSchema });
7296
+ orgListReferenceSchema = listName;
7297
+ }
7298
+ });
7299
+
7300
+ // ../../packages/core/dist/chunk-3GUHAF3O.js
7301
+ var PERSON_ID_PATTERN, CONTACT_PERSON_ID_PATTERN, PERSON_LINKS_MAX, PERSON_DENY_PAGE_MAX, PERSON_ID_FORM_MESSAGE, userPersonIdSchema, personIdSchema, personParam, personLinkParam, deniedPersonParam, listDeniedPersonsQuery;
7302
+ var init_chunk_3GUHAF3O = __esm({
7303
+ "../../packages/core/dist/chunk-3GUHAF3O.js"() {
7304
+ "use strict";
7305
+ init_chunk_S5SVBLGT();
7306
+ init_zod();
7307
+ PERSON_ID_PATTERN = /^prs_[a-z2-7]{52}$/;
7308
+ CONTACT_PERSON_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
7309
+ PERSON_LINKS_MAX = 15;
7310
+ PERSON_DENY_PAGE_MAX = 100;
7311
+ PERSON_ID_FORM_MESSAGE = "Must be a person id (prs_\u2026) or a contact id (a lowercase UUID)";
7312
+ userPersonIdSchema = external_exports.string().regex(PERSON_ID_PATTERN, { message: "Must be a person id (prs_\u2026)" });
7313
+ personIdSchema = external_exports.string().refine(
7314
+ (value) => PERSON_ID_PATTERN.test(value) || CONTACT_PERSON_ID_PATTERN.test(value),
7315
+ { message: PERSON_ID_FORM_MESSAGE }
7316
+ );
7317
+ personParam = external_exports.object({
7318
+ personId: userPersonIdSchema
7319
+ });
7320
+ personLinkParam = personParam.extend({
7321
+ targetId: personIdSchema
7322
+ });
7323
+ deniedPersonParam = external_exports.object({
7324
+ personId: personIdSchema
7325
+ });
7326
+ listDeniedPersonsQuery = contactBookOrgQuery.extend({
7327
+ cursor: personIdSchema.optional(),
7328
+ limit: external_exports.coerce.number().int().min(1).max(PERSON_DENY_PAGE_MAX).default(50)
7329
+ });
7330
+ }
7331
+ });
7332
+
7333
+ // ../../packages/core/dist/chunk-5DGHIY7L.js
7334
+ var rekorBaseChangeMessageSchema;
7335
+ var init_chunk_5DGHIY7L = __esm({
7336
+ "../../packages/core/dist/chunk-5DGHIY7L.js"() {
7337
+ "use strict";
7338
+ init_zod();
7339
+ rekorBaseChangeMessageSchema = external_exports.object({
7340
+ /** The WayAI org UUID — one id namespace. */
7341
+ org_id: external_exports.string().uuid(),
7342
+ /**
7343
+ * Not a UUID: a preview base id is `{prod_base_id}--{slug}`. Immutable per base — a
7344
+ * preview clone is its OWN base_id — so `(base_id, scope)` keys never collide across
7345
+ * environments. Empty is never a real base id, so it is non-conforming rather than a
7346
+ * frame keyed on nothing.
7347
+ */
7348
+ base_id: external_exports.string().min(1),
7349
+ /**
7350
+ * Rides along so the client scopes its refetch without a lookup; the inspector scopes
7351
+ * by side.
7352
+ */
7353
+ environment: external_exports.enum(["production", "preview"]),
7354
+ /** Which pane refetches. `base` covers create/delete/promote/config changes. */
7355
+ scope: external_exports.enum(["records", "record_types", "files", "base"])
7356
+ });
7357
+ }
7358
+ });
7359
+
7360
+ // ../../packages/core/dist/chunk-YUZFHVB2.js
7361
+ var invitePreviewQuery, inviteRolePreviewResponse, inviteContactPreviewResponse, invitePreviewResponse, inviteUnsubscribeBody;
7362
+ var init_chunk_YUZFHVB2 = __esm({
7363
+ "../../packages/core/dist/chunk-YUZFHVB2.js"() {
7364
+ "use strict";
7365
+ init_zod();
7366
+ invitePreviewQuery = external_exports.object({
7367
+ token: external_exports.string().min(1).max(2048)
7368
+ });
7369
+ inviteRolePreviewResponse = external_exports.object({
7370
+ inviter_name: external_exports.string(),
7371
+ entity_id: external_exports.string().uuid(),
7372
+ entity_name: external_exports.string(),
7373
+ entity_type: external_exports.enum(["org", "hub"]),
7374
+ role: external_exports.enum(["org_admin", "admin", "team_user", "user"]),
7375
+ expires_at: external_exports.string().datetime()
7376
+ });
7377
+ inviteContactPreviewResponse = external_exports.object({
7378
+ inviter_name: external_exports.string().nullable(),
7379
+ entity_id: external_exports.string().uuid(),
7380
+ entity_type: external_exports.literal("contact"),
7381
+ role: external_exports.literal("contact"),
7382
+ expires_at: external_exports.string().datetime()
7383
+ });
7384
+ invitePreviewResponse = external_exports.union([inviteRolePreviewResponse, inviteContactPreviewResponse]);
7385
+ inviteUnsubscribeBody = external_exports.object({ token: external_exports.string().min(1).max(256) }).strict();
7386
+ }
7387
+ });
7388
+
7389
+ // ../../packages/core/dist/chunk-I3O2RACG.js
7390
+ var managedAgentsWebhookParams, MANAGED_AGENTS_WEBHOOK_BODY_MAX_BYTES;
7391
+ var init_chunk_I3O2RACG = __esm({
7392
+ "../../packages/core/dist/chunk-I3O2RACG.js"() {
7393
+ "use strict";
7394
+ init_zod();
7395
+ managedAgentsWebhookParams = external_exports.object({
7396
+ hub_id: external_exports.string().uuid(),
7397
+ connection_id: external_exports.string().uuid()
7398
+ });
7399
+ MANAGED_AGENTS_WEBHOOK_BODY_MAX_BYTES = 16 * 1024;
7400
+ }
7401
+ });
7402
+
7403
+ // ../../packages/core/dist/chunk-34LE6P7E.js
7404
+ var templateIdParam, listTemplatesQuery, deleteTemplateQuery, templateStatusQuery, createTemplateBody, updateTemplateBody, submitTemplateBody, testTemplateBody;
7405
+ var init_chunk_34LE6P7E = __esm({
7406
+ "../../packages/core/dist/chunk-34LE6P7E.js"() {
7407
+ "use strict";
7408
+ init_zod();
7409
+ templateIdParam = external_exports.object({
7410
+ id: external_exports.string().uuid()
7411
+ });
7412
+ listTemplatesQuery = external_exports.object({
7413
+ hub_id: external_exports.string().uuid(),
7414
+ connection_id: external_exports.string().uuid()
7415
+ });
7416
+ deleteTemplateQuery = external_exports.object({
7417
+ hub_id: external_exports.string().uuid(),
7418
+ connection_id: external_exports.string().uuid()
7419
+ });
7420
+ templateStatusQuery = external_exports.object({
7421
+ hub_id: external_exports.string().uuid(),
7422
+ connection_id: external_exports.string().uuid()
7423
+ });
7424
+ createTemplateBody = external_exports.object({
7425
+ hub_id: external_exports.string().uuid(),
7426
+ connection_id: external_exports.string().uuid()
7427
+ }).passthrough();
7428
+ updateTemplateBody = external_exports.object({}).passthrough();
7429
+ submitTemplateBody = external_exports.object({
7430
+ hub_id: external_exports.string().uuid(),
7431
+ connection_id: external_exports.string().uuid()
7432
+ }).passthrough();
7433
+ testTemplateBody = external_exports.object({
7434
+ hub_id: external_exports.string().uuid(),
7435
+ connection_id: external_exports.string().uuid()
7436
+ }).passthrough();
7437
+ }
7438
+ });
7439
+
7440
+ // ../../packages/core/dist/chunk-FPSDNS2E.js
7441
+ var noticeSeveritySchema, noticeStatusSchema, NOTICE_SCOPE_REGEX, noticeScopeSchema, noticeLinkSchema, createNoticeBody, updateNoticeBody, listNoticesQuery, noticeIdParamSchema;
7442
+ var init_chunk_FPSDNS2E = __esm({
7443
+ "../../packages/core/dist/chunk-FPSDNS2E.js"() {
7444
+ "use strict";
7445
+ init_zod();
7446
+ noticeSeveritySchema = external_exports.enum(["critical", "warn", "info"]);
7447
+ noticeStatusSchema = external_exports.enum(["active", "resolved"]);
7448
+ NOTICE_SCOPE_REGEX = /^(global|provider:[a-z0-9_-]{1,40}|service:[a-z0-9_-]{1,40})$/;
7449
+ noticeScopeSchema = external_exports.string().regex(NOTICE_SCOPE_REGEX, "scope must be 'global', 'provider:<x>', or 'service:<x>'");
7450
+ noticeLinkSchema = external_exports.string().url().refine((u) => /^https?:\/\//i.test(u), { message: "link must be an http(s) URL" });
7451
+ createNoticeBody = external_exports.object({
7452
+ severity: noticeSeveritySchema.default("info"),
7453
+ scope: noticeScopeSchema.default("global"),
7454
+ title: external_exports.string().trim().min(1).max(200),
7455
+ body: external_exports.string().max(2e3).optional(),
7456
+ link: noticeLinkSchema.optional(),
7457
+ starts_at: external_exports.string().datetime().optional(),
7458
+ ends_at: external_exports.string().datetime().optional()
7459
+ });
7460
+ updateNoticeBody = external_exports.object({
7461
+ severity: noticeSeveritySchema.optional(),
7462
+ scope: noticeScopeSchema.optional(),
7463
+ title: external_exports.string().trim().min(1).max(200).optional(),
7464
+ body: external_exports.string().max(2e3).nullable().optional(),
7465
+ link: noticeLinkSchema.nullable().optional(),
7466
+ starts_at: external_exports.string().datetime().optional(),
7467
+ ends_at: external_exports.string().datetime().nullable().optional()
7468
+ }).refine((b) => Object.keys(b).length > 0, { message: "at least one field must be provided" });
7469
+ listNoticesQuery = external_exports.object({
7470
+ status: noticeStatusSchema.optional(),
7471
+ limit: external_exports.coerce.number().int().min(1).max(200).optional(),
7472
+ offset: external_exports.coerce.number().int().min(0).optional()
7473
+ });
7474
+ noticeIdParamSchema = external_exports.object({ id: external_exports.string().min(1) });
7475
+ }
7476
+ });
7477
+
7470
7478
  // ../../packages/core/dist/chunk-WEXVYJ5H.js
7471
7479
  function containsKanbanPlaceholders(value) {
7472
7480
  if (value == null) return false;
@@ -12034,12 +12042,12 @@ var init_chunk_6J742GLA = __esm({
12034
12042
  }
12035
12043
  });
12036
12044
 
12037
- // ../../packages/core/dist/chunk-ZM3DFTSY.js
12045
+ // ../../packages/core/dist/chunk-LCBRIVIN.js
12038
12046
  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;
12039
- var init_chunk_ZM3DFTSY = __esm({
12040
- "../../packages/core/dist/chunk-ZM3DFTSY.js"() {
12047
+ var init_chunk_LCBRIVIN = __esm({
12048
+ "../../packages/core/dist/chunk-LCBRIVIN.js"() {
12041
12049
  "use strict";
12042
- init_chunk_IPEFFLCO();
12050
+ init_chunk_S5SVBLGT();
12043
12051
  init_chunk_6J742GLA();
12044
12052
  init_chunk_ZVXO3XL6();
12045
12053
  init_chunk_HZ6CADSY();
@@ -12143,7 +12151,7 @@ var init_chunk_ZM3DFTSY = __esm({
12143
12151
  }
12144
12152
  });
12145
12153
 
12146
- // ../../packages/core/dist/chunk-5WTHC665.js
12154
+ // ../../packages/core/dist/chunk-MT4ITTI4.js
12147
12155
  function parseCommunityLessonVideoUrl(url) {
12148
12156
  const parts = /^https?:\/\/([^/?#]+)([^?#]*)(?:\?([^#]*))?(?:#.*)?$/i.exec(url.trim());
12149
12157
  if (!parts) return null;
@@ -12169,10 +12177,10 @@ function communityLessonVideoWatchUrl(video) {
12169
12177
  }
12170
12178
  }
12171
12179
  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;
12172
- var init_chunk_5WTHC665 = __esm({
12173
- "../../packages/core/dist/chunk-5WTHC665.js"() {
12180
+ var init_chunk_MT4ITTI4 = __esm({
12181
+ "../../packages/core/dist/chunk-MT4ITTI4.js"() {
12174
12182
  "use strict";
12175
- init_chunk_ZM3DFTSY();
12183
+ init_chunk_LCBRIVIN();
12176
12184
  init_chunk_HZ6CADSY();
12177
12185
  init_zod();
12178
12186
  COMMUNITY_COURSES_MAX = 20;
@@ -12757,7 +12765,7 @@ var init_chunk_2ISUBJG7 = __esm({
12757
12765
  }
12758
12766
  });
12759
12767
 
12760
- // ../../packages/core/dist/chunk-HSQZYXKA.js
12768
+ // ../../packages/core/dist/chunk-GMCEFUWT.js
12761
12769
  function describeRole(role) {
12762
12770
  if (typeof role === "string") {
12763
12771
  return JSON.stringify(role.length > ROLE_ECHO_MAX ? `${role.slice(0, ROLE_ECHO_MAX)}\u2026` : role);
@@ -12931,8 +12939,8 @@ function terminalRunCount(counts) {
12931
12939
  return counts.successful_runs + counts.failed_runs;
12932
12940
  }
12933
12941
  var evalIdParam, sessionIdParam, scenarioSetIdParam, hubIdQuery, EVAL_FIXTURE_NAME_MAX_LENGTH, evalFixtureOverrideSchema, runSessionQuery, runJourneyQuery, EVAL_INPUT_ROLES, EVAL_INPUT_ROLE_LIST, ROLE_ECHO_MAX, EVAL_INITIAL_STATE_SCOPES, MAX_INITIAL_STATE_ENTRIES, evalInitialStateEntry, evalCustomerContactIdSchema, evalBody, EVAL_LIST_MAX_LIMIT, evalListLimit, getEvalsQuery, toggleEvalBody, bulkToggleEvalsBody, pacingConfigSchema, EVAL_MAX_SELECTED_SCENARIOS, evalScenarioSelectionEntrySchema, evalScenarioSelectionSchema, sessionConfigSchema, createSessionBody, getSessionsQuery, getSessionResultsQuery, getSessionRunsQuery, evalAnalyticsQuery, getSessionCostQuery, compareSessionsQuery, evalsSqlBody, evalsSqlSchemaQuery, exportResultsQuery, validateEvalBody, hubAgentsQuery, createScenarioSetBody, updateScenarioSetBody, scenarioSetsHubQuery, createScenarioFromConversationBody, createJourneyFromConversationBody, evalAttachmentRef, turnMayCarryAttachments, ATTACHMENTS_USER_ONLY_MESSAGE, journeyIdParam, journeyToolCallSchema, journeyTurnSchema, journeyStepOverrideSchema, fixtureField, createJourneyBody, updateJourneyBody, evalSessionConfigResponseSchema, evalSessionResponseSchema, evalSessionListConfigSchema, evalSessionListItemSchema, seedReleaseStatusSchema, EVAL_SESSION_NOT_QUIESCENT;
12934
- var init_chunk_HSQZYXKA = __esm({
12935
- "../../packages/core/dist/chunk-HSQZYXKA.js"() {
12942
+ var init_chunk_GMCEFUWT = __esm({
12943
+ "../../packages/core/dist/chunk-GMCEFUWT.js"() {
12936
12944
  "use strict";
12937
12945
  init_chunk_4LXDRTO4();
12938
12946
  init_chunk_WTOA3ANF();
@@ -14000,7 +14008,7 @@ var init_chunk_TU4Y4MEX = __esm({
14000
14008
  }
14001
14009
  });
14002
14010
 
14003
- // ../../packages/core/dist/chunk-TRA7DRML.js
14011
+ // ../../packages/core/dist/chunk-E7SXOYHO.js
14004
14012
  function refineHubAsCodeCustomTools(config, ctx) {
14005
14013
  const agents = config.agents;
14006
14014
  if (!Array.isArray(agents)) return;
@@ -14610,12 +14618,12 @@ function skillSectionsAsResources(scope) {
14610
14618
  };
14611
14619
  }
14612
14620
  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;
14613
- var init_chunk_TRA7DRML = __esm({
14614
- "../../packages/core/dist/chunk-TRA7DRML.js"() {
14621
+ var init_chunk_E7SXOYHO = __esm({
14622
+ "../../packages/core/dist/chunk-E7SXOYHO.js"() {
14615
14623
  "use strict";
14616
14624
  init_chunk_SARVKRZB();
14617
14625
  init_chunk_XAYDRN6A();
14618
- init_chunk_HSQZYXKA();
14626
+ init_chunk_GMCEFUWT();
14619
14627
  init_chunk_LBDH7LCG();
14620
14628
  init_chunk_4LXDRTO4();
14621
14629
  init_chunk_TU4Y4MEX();
@@ -15671,15 +15679,15 @@ var init_chunk_JO53JB35 = __esm({
15671
15679
  }
15672
15680
  });
15673
15681
 
15674
- // ../../packages/core/dist/chunk-63ZD7TGN.js
15682
+ // ../../packages/core/dist/chunk-ZU2FJGU3.js
15675
15683
  function filterNamesAnything(filter) {
15676
15684
  return filter.labels.length + filter.scope_tag_ids.length > 0;
15677
15685
  }
15678
15686
  var hubListNameSchema, HUB_LIST_FILTER_REQUIRED, hubContactListFilterSchema, hubContactListIdParam, hubContactListHubQuery, description, createHubContactListBody, updateHubContactListBody;
15679
- var init_chunk_63ZD7TGN = __esm({
15680
- "../../packages/core/dist/chunk-63ZD7TGN.js"() {
15687
+ var init_chunk_ZU2FJGU3 = __esm({
15688
+ "../../packages/core/dist/chunk-ZU2FJGU3.js"() {
15681
15689
  "use strict";
15682
- init_chunk_IPEFFLCO();
15690
+ init_chunk_S5SVBLGT();
15683
15691
  init_zod();
15684
15692
  hubListNameSchema = orgListReferenceSchema;
15685
15693
  HUB_LIST_FILTER_REQUIRED = "A hub list names at least one label or scope tag";
@@ -15705,13 +15713,13 @@ var init_chunk_63ZD7TGN = __esm({
15705
15713
  }
15706
15714
  });
15707
15715
 
15708
- // ../../packages/core/dist/chunk-EXAQDPNR.js
15716
+ // ../../packages/core/dist/chunk-CL2SULM6.js
15709
15717
  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;
15710
- var init_chunk_EXAQDPNR = __esm({
15711
- "../../packages/core/dist/chunk-EXAQDPNR.js"() {
15718
+ var init_chunk_CL2SULM6 = __esm({
15719
+ "../../packages/core/dist/chunk-CL2SULM6.js"() {
15712
15720
  "use strict";
15713
- init_chunk_63ZD7TGN();
15714
- init_chunk_IPEFFLCO();
15721
+ init_chunk_ZU2FJGU3();
15722
+ init_chunk_S5SVBLGT();
15715
15723
  init_chunk_5FTGVRDF();
15716
15724
  init_chunk_5XEJSR22();
15717
15725
  init_chunk_Q3WAAJBA();
@@ -16150,15 +16158,15 @@ var init_chunk_EV3MAOEX = __esm({
16150
16158
  var init_contracts = __esm({
16151
16159
  "../../packages/core/dist/contracts/index.js"() {
16152
16160
  "use strict";
16161
+ init_chunk_WL5QGKHN();
16153
16162
  init_chunk_YVY2TZK2();
16154
16163
  init_chunk_VXEAR36B();
16155
16164
  init_chunk_RACEDHG6();
16156
16165
  init_chunk_Q7KIQHAZ();
16157
16166
  init_chunk_HA7CRZMX();
16167
+ init_chunk_MF2VVXBR();
16158
16168
  init_chunk_IPXBFWUU();
16159
16169
  init_chunk_NKLVUTFO();
16160
- init_chunk_WL5QGKHN();
16161
- init_chunk_MF2VVXBR();
16162
16170
  init_chunk_ZC6YGHNX();
16163
16171
  init_chunk_ACKF2MVU();
16164
16172
  init_chunk_GPYAZPH7();
@@ -16166,9 +16174,10 @@ var init_contracts = __esm({
16166
16174
  init_chunk_IPDOHAZ5();
16167
16175
  init_chunk_GPM7PE44();
16168
16176
  init_chunk_VEERWOZ6();
16177
+ init_chunk_OS6EZSUS();
16169
16178
  init_chunk_ZXK6N2HN();
16170
16179
  init_chunk_Y7CFCYX4();
16171
- init_chunk_YHH6V2TT();
16180
+ init_chunk_3GUHAF3O();
16172
16181
  init_chunk_5DGHIY7L();
16173
16182
  init_chunk_YUZFHVB2();
16174
16183
  init_chunk_I3O2RACG();
@@ -16185,8 +16194,8 @@ var init_contracts = __esm({
16185
16194
  init_chunk_UI6YFSZL();
16186
16195
  init_chunk_C4HEZ7ZI();
16187
16196
  init_chunk_IR2NOSI3();
16188
- init_chunk_5WTHC665();
16189
- init_chunk_ZM3DFTSY();
16197
+ init_chunk_MT4ITTI4();
16198
+ init_chunk_LCBRIVIN();
16190
16199
  init_chunk_YULHXJ5M();
16191
16200
  init_chunk_V4FRPRH5();
16192
16201
  init_chunk_LWMLR2WI();
@@ -16197,11 +16206,11 @@ var init_contracts = __esm({
16197
16206
  init_chunk_E4DIIOOE();
16198
16207
  init_chunk_7CYHPF35();
16199
16208
  init_chunk_BPCNB5RT();
16200
- init_chunk_TRA7DRML();
16209
+ init_chunk_E7SXOYHO();
16201
16210
  init_chunk_SARVKRZB();
16202
16211
  init_chunk_XAYDRN6A();
16203
16212
  init_chunk_L55XSECQ();
16204
- init_chunk_HSQZYXKA();
16213
+ init_chunk_GMCEFUWT();
16205
16214
  init_chunk_LBDH7LCG();
16206
16215
  init_chunk_4LXDRTO4();
16207
16216
  init_chunk_JDJ4EUOL();
@@ -16217,9 +16226,9 @@ var init_contracts = __esm({
16217
16226
  init_chunk_2PZIF56U();
16218
16227
  init_chunk_UEJOG2Q7();
16219
16228
  init_chunk_JO53JB35();
16220
- init_chunk_EXAQDPNR();
16221
- init_chunk_63ZD7TGN();
16222
- init_chunk_IPEFFLCO();
16229
+ init_chunk_CL2SULM6();
16230
+ init_chunk_ZU2FJGU3();
16231
+ init_chunk_S5SVBLGT();
16223
16232
  init_chunk_5FTGVRDF();
16224
16233
  init_chunk_IG6QBZMA();
16225
16234
  init_chunk_OMPT4ZHR();
@@ -18172,19 +18181,6 @@ var init_api_client = __esm({
18172
18181
  }
18173
18182
  // The org-admin community routes (gh #5003, `wayai communities`): an owner or admin of the
18174
18183
  // community's org, on an interactive session only — a scoped token is refused with 403.
18175
- /**
18176
- * Link a contact to its customer record, a root record of one of the org's bases (#5083 RK2 A3).
18177
- * A browser sign-in only: the route refuses an API token.
18178
- */
18179
- async linkContactCustomer(orgId, contactId, body) {
18180
- const qs = new URLSearchParams({ organization_id: orgId });
18181
- return this.request("PUT", `/api/contact-book/contacts/${encodeURIComponent(contactId)}/customer?${qs}`, body);
18182
- }
18183
- /** Unlink a contact from its customer record in one base (owner decision 142). A browser sign-in only. */
18184
- async unlinkContactCustomer(orgId, contactId, baseId2) {
18185
- const qs = new URLSearchParams({ organization_id: orgId, base_id: baseId2 });
18186
- return this.request("DELETE", `/api/contact-book/contacts/${encodeURIComponent(contactId)}/customer?${qs}`);
18187
- }
18188
18184
  // Person links and the deny list (wayai-pro/wayai#5473 §1): a browser sign-in only — each route refuses
18189
18185
  // an API token. A link takes org:write over the organization; the rest an organization admin.
18190
18186
  /** Whom a person id names in the organization: the hub where a conversation carries it, and that hub's name and email for them. */
@@ -23658,12 +23654,12 @@ function writeBaseFolder(folder, meta, config) {
23658
23654
  }
23659
23655
  return delta;
23660
23656
  }
23661
- function markProductionMirror(folder, baseId2) {
23657
+ function markProductionMirror(folder, baseId) {
23662
23658
  const file = path23.join(folder, BASE_META_FILE);
23663
23659
  try {
23664
23660
  const body = readFileNoFollow(folder, file)?.toString("utf-8");
23665
23661
  if (body === void 0 || body.startsWith(MIRROR_MARKER_PREFIX)) return;
23666
- const banner = `${MIRROR_MARKER_PREFIX} "${baseId2}". Edits are ignored; \`wayai push\` refuses it. Edit the linked preview instead.
23662
+ const banner = `${MIRROR_MARKER_PREFIX} "${baseId}". Edits are ignored; \`wayai push\` refuses it. Edit the linked preview instead.
23667
23663
  `;
23668
23664
  writeFileNoFollow(folder, file, Buffer.from(banner + body, "utf-8"));
23669
23665
  } catch {
@@ -23795,10 +23791,10 @@ function createPreview(client, originId, opts) {
23795
23791
  ...opts.analytics ? { analytics: opts.analytics } : {}
23796
23792
  });
23797
23793
  }
23798
- function deleteEntity(client, baseId2, kind, id) {
23794
+ function deleteEntity(client, baseId, kind, id) {
23799
23795
  return client.request(
23800
23796
  "DELETE",
23801
- `/v1/${pathSegment(baseId2, "base id")}/${ENTITY_DIRS[kind]}/${pathSegment(id, `${kind} id`)}`
23797
+ `/v1/${pathSegment(baseId, "base id")}/${ENTITY_DIRS[kind]}/${pathSegment(id, `${kind} id`)}`
23802
23798
  );
23803
23799
  }
23804
23800
  var init_api = __esm({
@@ -24011,40 +24007,40 @@ async function pullBase(gitRootOrNull, selector, args2) {
24011
24007
  const gitRoot = requireGitRoot(gitRootOrNull);
24012
24008
  const target = resolveBaseTarget(gitRoot, selector);
24013
24009
  const basesDir = resolveBasesDir(gitRoot);
24014
- const baseId2 = targetBaseId(target, selector);
24015
- if (!baseId2) {
24010
+ const baseId = targetBaseId(target, selector);
24011
+ if (!baseId) {
24016
24012
  throw expected(
24017
24013
  `Could not determine the base id for ${target.folder}. Pass the base id explicitly.`
24018
24014
  );
24019
24015
  }
24020
24016
  const client = await createDataClient();
24021
24017
  console.log("Fetching base configuration...");
24022
- const record = await getBaseRecord(client, baseId2);
24018
+ const record = await getBaseRecord(client, baseId);
24023
24019
  if (record.environment === "production") {
24024
- const folder = await writeProductionMirror(client, basesDir, record.id ?? baseId2, record);
24020
+ const folder = await writeProductionMirror(client, basesDir, record.id ?? baseId, record);
24025
24021
  console.log(`Production base mirrored (read-only) \u2192 ${folder}`);
24026
24022
  return;
24027
24023
  }
24028
- assertInScope("bases", baseId2);
24024
+ assertInScope("bases", baseId);
24029
24025
  if (target.exists && !autoConfirm) {
24030
24026
  const ok = await confirm(
24031
- `Overwrite local files in ${path25.relative(gitRoot, target.folder)} with the server config for "${sanitizeTerminalText(baseId2)}"?`
24027
+ `Overwrite local files in ${path25.relative(gitRoot, target.folder)} with the server config for "${sanitizeTerminalText(baseId)}"?`
24032
24028
  );
24033
24029
  if (!ok) {
24034
24030
  console.log("Cancelled.");
24035
24031
  return;
24036
24032
  }
24037
24033
  }
24038
- const config = await getConfig(client, baseId2);
24034
+ const config = await getConfig(client, baseId);
24039
24035
  const isFirstPull = !target.exists;
24040
- const delta = writeBaseFolder(target.folder, metaFromRecord(record, baseId2), config);
24036
+ const delta = writeBaseFolder(target.folder, metaFromRecord(record, baseId), config);
24041
24037
  console.log(`Base configuration written to ${target.folder}`);
24042
24038
  console.log(
24043
24039
  ` ${ENTITY_KINDS.map((kind) => `${(config[kind] ?? []).length} ${kind}`).join(", ")}`
24044
24040
  );
24045
24041
  if (!isFirstPull) printLocalFileChanges(delta);
24046
24042
  console.log(" Credential values are not written. Manage them with `wayai bases credentials`.");
24047
- seedScopeIfEmpty("bases", baseId2);
24043
+ seedScopeIfEmpty("bases", baseId);
24048
24044
  if (record.origin_base_id) {
24049
24045
  await mirrorLinkedProduction(client, basesDir, record.origin_base_id);
24050
24046
  }
@@ -24114,25 +24110,25 @@ async function pushBase(gitRootOrNull, selector, args2) {
24114
24110
  return;
24115
24111
  }
24116
24112
  const client = await createDataClient();
24117
- let baseId2 = meta.base_id;
24118
- if (!baseId2) {
24113
+ let baseId = meta.base_id;
24114
+ if (!baseId) {
24119
24115
  const created = await createDeclaredPreview(client, target, parsed, autoConfirm);
24120
24116
  if (!created) return;
24121
- baseId2 = created;
24117
+ baseId = created;
24122
24118
  } else {
24123
- const record = await getBaseRecord(client, baseId2);
24119
+ const record = await getBaseRecord(client, baseId);
24124
24120
  if (record.environment && record.environment !== "preview") {
24125
24121
  throw expected(
24126
- `"${sanitizeTerminalText(baseId2)}" is a ${sanitizeTerminalText(record.environment)} base. Push operates on previews \u2014 promote with \`wayai bases promote\`.`
24122
+ `"${sanitizeTerminalText(baseId)}" is a ${sanitizeTerminalText(record.environment)} base. Push operates on previews \u2014 promote with \`wayai bases promote\`.`
24127
24123
  );
24128
24124
  }
24129
- assertInScope("bases", baseId2);
24125
+ assertInScope("bases", baseId);
24130
24126
  }
24131
- const diff = await diffConfig(client, baseId2, config);
24127
+ const diff = await diffConfig(client, baseId, config);
24132
24128
  printLintWarnings(diff.warnings);
24133
24129
  if (isDiffEmpty(diff)) {
24134
- console.log(`No changes \u2014 preview "${sanitizeTerminalText(baseId2)}" already matches your files.`);
24135
- if (!dryRun) seedScopeIfEmpty("bases", baseId2);
24130
+ console.log(`No changes \u2014 preview "${sanitizeTerminalText(baseId)}" already matches your files.`);
24131
+ if (!dryRun) seedScopeIfEmpty("bases", baseId);
24136
24132
  return;
24137
24133
  }
24138
24134
  console.log(renderDiff(diff));
@@ -24142,13 +24138,13 @@ async function pushBase(gitRootOrNull, selector, args2) {
24142
24138
  }
24143
24139
  if (!autoConfirm) {
24144
24140
  const ok = await confirm(`
24145
- Apply these changes to preview "${sanitizeTerminalText(baseId2)}"?`);
24141
+ Apply these changes to preview "${sanitizeTerminalText(baseId)}"?`);
24146
24142
  if (!ok) {
24147
24143
  console.log("Cancelled.");
24148
24144
  return;
24149
24145
  }
24150
24146
  }
24151
- const result = await applyConfig(client, baseId2, config);
24147
+ const result = await applyConfig(client, baseId, config);
24152
24148
  const secretGroups = [
24153
24149
  ["trigger", result.new_trigger_secrets],
24154
24150
  ["inbound webhook", result.new_inbound_webhook_secrets]
@@ -24175,7 +24171,7 @@ ${RED}${removals.length} ${word} not in your files were left on the base. Re-run
24175
24171
  Delete ${removals.length} server ${word} not in your files? Record types cascade to their records, file types to their files.`
24176
24172
  )) {
24177
24173
  for (const removal of removals) {
24178
- await deleteEntity(client, baseId2, removal.kind, removal.id);
24174
+ await deleteEntity(client, baseId, removal.kind, removal.id);
24179
24175
  console.log(` - deleted ${removal.kind} ${sanitizeTerminalText(removal.id)}`);
24180
24176
  }
24181
24177
  } else {
@@ -24183,8 +24179,8 @@ Delete ${removals.length} server ${word} not in your files? Record types cascade
24183
24179
  }
24184
24180
  }
24185
24181
  console.log(`
24186
- Pushed to preview "${sanitizeTerminalText(baseId2)}".`);
24187
- seedScopeIfEmpty("bases", baseId2);
24182
+ Pushed to preview "${sanitizeTerminalText(baseId)}".`);
24183
+ seedScopeIfEmpty("bases", baseId);
24188
24184
  }
24189
24185
  var init_sync = __esm({
24190
24186
  "src/data/config-as-code/sync.ts"() {
@@ -35576,8 +35572,6 @@ function parse2(args2) {
35576
35572
  args: args2,
35577
35573
  options: {
35578
35574
  org: { type: "string" },
35579
- base: { type: "string" },
35580
- record: { type: "string" },
35581
35575
  to: { type: "string" },
35582
35576
  cursor: { type: "string" },
35583
35577
  limit: { type: "string" },
@@ -35633,24 +35627,7 @@ function entryLine(entry) {
35633
35627
  function print(values, data, lines) {
35634
35628
  console.log(values.json ? JSON.stringify(data, null, 2) : lines.join("\n"));
35635
35629
  }
35636
- async function customerRecord(sub, positionals, values) {
35637
- const [contactId, ...extra] = positionals;
35638
- if (contactId === void 0 || extra.length > 0) throw usageError3(`${sub} takes one <contact_id>.`);
35639
- if (!UUID_RE3.test(contactId)) throw usageError3(`Invalid <contact_id> ${JSON.stringify(contactId)}: expected a contact id (a UUID).`);
35640
- refuseFlags(sub, values, ["to", "cursor", "limit"]);
35641
- if (!values.base) throw usageError3(`${sub} needs --base <base_id>.`);
35642
- if (!isValidBaseId(values.base)) throw usageError3(`Invalid --base ${JSON.stringify(values.base)}: a base id is ${BASE_ID_RULE}.`);
35643
- if (sub === "link-customer" && !values.record) throw usageError3("link-customer needs --record <record_id>.");
35644
- if (sub === "unlink-customer" && values.record !== void 0) throw usageError3("--record applies only to link-customer.");
35645
- const orgId = resolveOrgId2(values.org);
35646
- await withApi(async (api) => {
35647
- 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);
35648
- const where = `base ${text2(customer.base_id)} (${text2(customer.record_type)})`;
35649
- 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}.`]);
35650
- });
35651
- }
35652
35630
  async function persons(sub, positionals, values) {
35653
- refuseFlags(sub, values, ["base", "record"]);
35654
35631
  const takesTo = sub === "link-person" || sub === "unlink-person";
35655
35632
  if (!takesTo) refuseFlags(sub, values, ["to"]);
35656
35633
  if (sub !== "denied-persons") refuseFlags(sub, values, ["cursor", "limit"]);
@@ -35728,9 +35705,7 @@ async function contactsCommand(args2) {
35728
35705
  const { values, positionals } = parse2(args2);
35729
35706
  const [sub, ...rest] = positionals;
35730
35707
  if (!SUBCOMMANDS2.includes(sub)) throw usageError3(`Unknown subcommand ${JSON.stringify(sub)}.`);
35731
- const command2 = sub;
35732
- if (command2 === "link-customer" || command2 === "unlink-customer") return customerRecord(command2, rest, values);
35733
- return persons(command2, rest, values);
35708
+ return persons(sub, rest, values);
35734
35709
  }
35735
35710
  var USAGE4, SUBCOMMANDS2, text2;
35736
35711
  var init_contacts = __esm({
@@ -35743,15 +35718,12 @@ var init_contacts = __esm({
35743
35718
  init_repo_config();
35744
35719
  init_terminal_output();
35745
35720
  init_token_store();
35746
- init_base_id();
35747
35721
  init_utils();
35748
35722
  init_contracts();
35749
35723
  USAGE4 = `
35750
- wayai contacts \u2014 a contact's customer record in a base, and the organization's person links and deny list
35724
+ wayai contacts \u2014 the organization's person links and deny list
35751
35725
 
35752
35726
  Usage:
35753
- wayai contacts link-customer <contact_id> --base <base_id> --record <record_id> [--org <org_id>] [--json]
35754
- wayai contacts unlink-customer <contact_id> --base <base_id> [--org <org_id>] [--json]
35755
35727
  wayai contacts lookup-person <person_id> [--org <org_id>] [--json]
35756
35728
  wayai contacts person-links <person_id> [--org <org_id>] [--json]
35757
35729
  wayai contacts link-person <person_id> --to <person_id|contact_id> [--org <org_id>] [--json]
@@ -35760,29 +35732,22 @@ Usage:
35760
35732
  wayai contacts deny-person <person_id|contact_id> [--org <org_id>] [--json]
35761
35733
  wayai contacts undeny-person <person_id|contact_id> [--org <org_id>] [--json]
35762
35734
 
35763
- link-customer Make the record the contact's customer record: an eval declaring the contact
35764
- then reaches that customer through a customer-scoped toolset (an agent's and
35765
- a customer page's calls name no customer). The record is one of the base's
35766
- customer record type (x-customer-scope role root), holding no external key
35767
- or the contact id under another source. A record keyed under another
35768
- external_id is refused: re-keying it would orphan its owned records.
35769
- unlink-customer Unlink the contact's customer record in the base. The record keeps the
35770
- contact id under the source wayai_contact_unlinked, so its owned records stay
35771
- its own, and link-customer on the same record links it again.
35772
-
35773
35735
  lookup-person Whom a person id (prs_\u2026) names: a hub of the organization where a
35774
35736
  conversation carries it, and that hub's name and email for the person. A
35775
35737
  person id no conversation carries is unknown.
35776
35738
  person-links The person ids and contacts a person is linked to, oldest first.
35777
35739
  link-person Link a person to another person id (their earlier identity, say an old
35778
35740
  number) or to a contact of the organization: the person is also that one.
35779
- The target's own links are copied too. A person holds at most 16 links.
35741
+ The target's own links are copied too. A person holds at most ${PERSON_LINKS_MAX} links.
35780
35742
  unlink-person Remove one link. The links it copied stay.
35781
35743
  denied-persons The organization's deny list: person ids and contacts no person set holds.
35782
35744
  deny-person Deny a person id or a contact for the organization.
35783
35745
  undeny-person Lift a denial.
35784
35746
 
35785
- Person links and the deny list give and take no access yet: no call reads them.
35747
+ Every toolset call reads the person links and the deny list of the people it is for: a person
35748
+ reaches the records naming an id they are linked to (a contact only where the hub sees it), and
35749
+ no one is matched by a denied id; a person whose own id is denied reaches none. An eval run's
35750
+ declared contact (on a preview hub) is used as declared, its links and the deny list unread.
35786
35751
 
35787
35752
  The organization is --org, else this repo's (wayai-ws/wayai.yaml). Linking and unlinking
35788
35753
  a person needs org:write over the organization; everything else here an organization
@@ -35790,8 +35755,6 @@ admin. These commands need a browser sign-in (\`wayai login\`): an API token
35790
35755
  (\`wayai login --token\`, or WAYAI_TOKEN) is refused.
35791
35756
  `.trim();
35792
35757
  SUBCOMMANDS2 = [
35793
- "link-customer",
35794
- "unlink-customer",
35795
35758
  "lookup-person",
35796
35759
  "person-links",
35797
35760
  "link-person",
@@ -37074,14 +37037,14 @@ var init_remote = __esm({
37074
37037
  function refreshPreviewCommand(orgId, base) {
37075
37038
  return `wayai knowledge refresh-preview --org ${orgId} --base ${sanitizeTerminalText(base)}`;
37076
37039
  }
37077
- async function resolveBases(kb, baseId2, orgId) {
37078
- const base = await kb.getBase(baseId2);
37079
- if (!base || base.deleted) throw expected(`Base "${sanitizeTerminalText(baseId2)}" not found in this organization.`);
37040
+ async function resolveBases(kb, baseId, orgId) {
37041
+ const base = await kb.getBase(baseId);
37042
+ if (!base || base.deleted) throw expected(`Base "${sanitizeTerminalText(baseId)}" not found in this organization.`);
37080
37043
  if (base.environment === "preview") {
37081
37044
  const origin = base.origin_base_id ? await kb.getBase(base.origin_base_id) : null;
37082
37045
  if (!origin || origin.deleted || origin.environment !== "production") {
37083
37046
  throw expected(
37084
- `Base "${sanitizeTerminalText(baseId2)}" is a preview with no production origin, so it has no production files to copy. Name the production knowledge base, or a preview created from it.`
37047
+ `Base "${sanitizeTerminalText(baseId)}" is a preview with no production origin, so it has no production files to copy. Name the production knowledge base, or a preview created from it.`
37085
37048
  );
37086
37049
  }
37087
37050
  return { production: origin.id, preview: base.id };
@@ -37094,7 +37057,7 @@ async function resolveBases(kb, baseId2, orgId) {
37094
37057
  }
37095
37058
  if (previews.length !== 1) {
37096
37059
  throw expected(
37097
- previews.length === 0 ? `Base "${sanitizeTerminalText(baseId2)}" has no preview. Create one with \`wayai bases create-preview ${sanitizeTerminalText(baseId2)} --name <name>\`, then copy production's files into it with \`${refreshPreviewCommand(orgId, baseId2)}\`.` : `Base "${sanitizeTerminalText(baseId2)}" has ${previews.length} previews (${previews.map(sanitizeTerminalText).join(", ")}). Pass the one to use as --base.`
37060
+ previews.length === 0 ? `Base "${sanitizeTerminalText(baseId)}" has no preview. Create one with \`wayai bases create-preview ${sanitizeTerminalText(baseId)} --name <name>\`, then copy production's files into it with \`${refreshPreviewCommand(orgId, baseId)}\`.` : `Base "${sanitizeTerminalText(baseId)}" has ${previews.length} previews (${previews.map(sanitizeTerminalText).join(", ")}). Pass the one to use as --base.`
37098
37061
  );
37099
37062
  }
37100
37063
  return { production: base.id, preview: previews[0] };
@@ -41119,28 +41082,28 @@ function buildBasesCommand() {
41119
41082
  bases.command("use <base>").description(
41120
41083
  "Deprecated alias of `wayai use bases/<id>` \u2014 scope this worktree to a base"
41121
41084
  ).action(async function(selector) {
41122
- const baseId2 = resolveBaseSelectorToId(findGitRoot(), selector);
41085
+ const baseId = resolveBaseSelectorToId(findGitRoot(), selector);
41123
41086
  const previous = readScope().bases;
41124
- const changed = previous.length !== 1 || previous[0] !== baseId2;
41087
+ const changed = previous.length !== 1 || previous[0] !== baseId;
41125
41088
  if (changed) {
41126
41089
  try {
41127
- setScopeAxis("bases", [baseId2]);
41090
+ setScopeAxis("bases", [baseId]);
41128
41091
  } catch (err) {
41129
41092
  throw expected(err instanceof Error ? err.message : String(err));
41130
41093
  }
41131
41094
  }
41132
41095
  if (outputFormat(this) === "json") {
41133
41096
  printOutput(
41134
- { base_id: baseId2, previous_base_id: previous[0] ?? null, changed },
41097
+ { base_id: baseId, previous_base_id: previous[0] ?? null, changed },
41135
41098
  "json"
41136
41099
  );
41137
41100
  return;
41138
41101
  }
41139
41102
  if (!changed) {
41140
- console.log(`Worktree already bound to base ${baseId2}.`);
41103
+ console.log(`Worktree already bound to base ${baseId}.`);
41141
41104
  } else {
41142
41105
  console.log(
41143
- previous.length > 0 ? `Worktree rebound: ${previous.join(", ")} -> ${baseId2}.` : `Worktree bound to base ${baseId2}.`
41106
+ previous.length > 0 ? `Worktree rebound: ${previous.join(", ")} -> ${baseId}.` : `Worktree bound to base ${baseId}.`
41144
41107
  );
41145
41108
  }
41146
41109
  });
@@ -42860,7 +42823,7 @@ Commands:
42860
42823
  sync-mcp Re-discover an MCP connection's tools (refresh stale schemas)
42861
42824
  list List organizations and hubs
42862
42825
  communities An organization's communities: list, join link (get/rotate/off), stats, access list (list/add/remove) \u2014 \`wayai communities --help\`
42863
- contacts A contact's customer record in a base; person links, the deny list, person lookup (browser sign-in only) \u2014 \`wayai contacts --help\`
42826
+ contacts Person links, the deny list, person lookup (browser sign-in only) \u2014 \`wayai contacts --help\`
42864
42827
  dimensions An organization's access dimensions and their values: list, create, relabel, add/retire values \u2014 \`wayai dimensions --help\`
42865
42828
  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\`
42866
42829
  knowledge refresh-preview Make the knowledge base's preview hold its production base's files \u2014 \`wayai knowledge --help\`