@wayai/cli 0.3.284 → 0.3.286

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,85 @@ var init_fs_safety = __esm({
4888
4888
  }
4889
4889
  });
4890
4890
 
4891
+ // ../../packages/core/dist/chunk-Q7KIQHAZ.js
4892
+ var initialValueCreateSchema, initialValueUpdateSchema, stateIdParam, listStatesQuery, stateNameSchema, createStateBody, updateStateBody, reorderStatesBody;
4893
+ var init_chunk_Q7KIQHAZ = __esm({
4894
+ "../../packages/core/dist/chunk-Q7KIQHAZ.js"() {
4895
+ "use strict";
4896
+ init_chunk_6TSQ5HXC();
4897
+ init_zod();
4898
+ initialValueCreateSchema = external_exports.record(external_exports.unknown()).nullish().transform((v) => v && Object.keys(v).length > 0 ? v : null);
4899
+ initialValueUpdateSchema = external_exports.record(external_exports.unknown()).nullish().transform((v) => v === void 0 ? void 0 : v && Object.keys(v).length > 0 ? v : null);
4900
+ stateIdParam = external_exports.object({
4901
+ id: external_exports.string().uuid()
4902
+ });
4903
+ listStatesQuery = external_exports.object({
4904
+ hub_id: external_exports.string().uuid()
4905
+ });
4906
+ stateNameSchema = external_exports.string().min(1, "state_name is required").max(100, "state_name must be 100 characters or fewer").refine((v) => visibleLength(v) > 0, "state_name must not be blank");
4907
+ createStateBody = external_exports.object({
4908
+ hub_id: external_exports.string().uuid(),
4909
+ state_slug: slugSchema,
4910
+ state_name: stateNameSchema,
4911
+ state_scope: external_exports.enum(["conversation", "user"]),
4912
+ state_description: external_exports.string().max(1e3).nullish(),
4913
+ json_schema: external_exports.record(external_exports.unknown()).default({}),
4914
+ initial_value: initialValueCreateSchema,
4915
+ display_order: external_exports.number().int().nonnegative().optional(),
4916
+ is_enabled: external_exports.boolean().default(true),
4917
+ inject_in_last_message: external_exports.boolean().default(true)
4918
+ });
4919
+ updateStateBody = external_exports.object({
4920
+ // state_slug is immutable after first persist — not accepted here.
4921
+ state_name: stateNameSchema.optional(),
4922
+ state_scope: external_exports.enum(["conversation", "user"]).optional(),
4923
+ state_description: external_exports.string().max(1e3).nullish(),
4924
+ json_schema: external_exports.record(external_exports.unknown()).optional(),
4925
+ initial_value: initialValueUpdateSchema,
4926
+ display_order: external_exports.number().int().nonnegative().optional(),
4927
+ is_enabled: external_exports.boolean().optional(),
4928
+ inject_in_last_message: external_exports.boolean().optional()
4929
+ });
4930
+ reorderStatesBody = external_exports.object({
4931
+ states: external_exports.array(external_exports.object({
4932
+ state_id: external_exports.string().uuid(),
4933
+ display_order: external_exports.number().int().nonnegative()
4934
+ })).min(1)
4935
+ });
4936
+ }
4937
+ });
4938
+
4939
+ // ../../packages/core/dist/chunk-NKLVUTFO.js
4940
+ var BASE_CREDENTIAL_MANAGED_BY, BASE_CREDENTIAL_NAME_MAX, BASE_CREDENTIAL_NAME_PATTERN, BASE_CREDENTIAL_NAME_CHARSET, baseCredentialNameSchema, createBaseCredentialLinkBody, baseCredentialLinkParams, baseCredentialLinkQuery;
4941
+ var init_chunk_NKLVUTFO = __esm({
4942
+ "../../packages/core/dist/chunk-NKLVUTFO.js"() {
4943
+ "use strict";
4944
+ init_zod();
4945
+ BASE_CREDENTIAL_MANAGED_BY = {
4946
+ DIRECT: "direct",
4947
+ ORG_LINK: "org-link"
4948
+ };
4949
+ BASE_CREDENTIAL_NAME_MAX = 100;
4950
+ BASE_CREDENTIAL_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:@+~=-]*$/;
4951
+ BASE_CREDENTIAL_NAME_CHARSET = "letters, digits and '. _ : @ + ~ = -', starting with a letter or digit";
4952
+ baseCredentialNameSchema = external_exports.string().min(1).max(BASE_CREDENTIAL_NAME_MAX).regex(BASE_CREDENTIAL_NAME_PATTERN, `name must use ${BASE_CREDENTIAL_NAME_CHARSET}`);
4953
+ createBaseCredentialLinkBody = external_exports.object({
4954
+ organization_id: external_exports.string().uuid(),
4955
+ base_id: external_exports.string().min(1),
4956
+ /** Defaults to a slug derived from the credential's display name. */
4957
+ name: baseCredentialNameSchema.optional()
4958
+ });
4959
+ baseCredentialLinkParams = external_exports.object({
4960
+ id: external_exports.string().uuid(),
4961
+ base_credential_id: external_exports.string().min(1)
4962
+ });
4963
+ baseCredentialLinkQuery = external_exports.object({
4964
+ organization_id: external_exports.string().uuid(),
4965
+ base_id: external_exports.string().min(1)
4966
+ });
4967
+ }
4968
+ });
4969
+
4891
4970
  // ../../packages/core/dist/chunk-HZ6CADSY.js
4892
4971
  function optionalTrimmedText(max) {
4893
4972
  return external_exports.string().trim().max(max).optional().transform((value) => value ? value : void 0);
@@ -5368,50 +5447,15 @@ var init_chunk_RACEDHG6 = __esm({
5368
5447
  }
5369
5448
  });
5370
5449
 
5371
- // ../../packages/core/dist/chunk-Q7KIQHAZ.js
5372
- var initialValueCreateSchema, initialValueUpdateSchema, stateIdParam, listStatesQuery, stateNameSchema, createStateBody, updateStateBody, reorderStatesBody;
5373
- var init_chunk_Q7KIQHAZ = __esm({
5374
- "../../packages/core/dist/chunk-Q7KIQHAZ.js"() {
5450
+ // ../../packages/core/dist/chunk-HIGKBEPF.js
5451
+ var accessExplainQuery;
5452
+ var init_chunk_HIGKBEPF = __esm({
5453
+ "../../packages/core/dist/chunk-HIGKBEPF.js"() {
5375
5454
  "use strict";
5376
- init_chunk_6TSQ5HXC();
5455
+ init_chunk_HZ6CADSY();
5377
5456
  init_zod();
5378
- initialValueCreateSchema = external_exports.record(external_exports.unknown()).nullish().transform((v) => v && Object.keys(v).length > 0 ? v : null);
5379
- initialValueUpdateSchema = external_exports.record(external_exports.unknown()).nullish().transform((v) => v === void 0 ? void 0 : v && Object.keys(v).length > 0 ? v : null);
5380
- stateIdParam = external_exports.object({
5381
- id: external_exports.string().uuid()
5382
- });
5383
- listStatesQuery = external_exports.object({
5384
- hub_id: external_exports.string().uuid()
5385
- });
5386
- stateNameSchema = external_exports.string().min(1, "state_name is required").max(100, "state_name must be 100 characters or fewer").refine((v) => visibleLength(v) > 0, "state_name must not be blank");
5387
- createStateBody = external_exports.object({
5388
- hub_id: external_exports.string().uuid(),
5389
- state_slug: slugSchema,
5390
- state_name: stateNameSchema,
5391
- state_scope: external_exports.enum(["conversation", "user"]),
5392
- state_description: external_exports.string().max(1e3).nullish(),
5393
- json_schema: external_exports.record(external_exports.unknown()).default({}),
5394
- initial_value: initialValueCreateSchema,
5395
- display_order: external_exports.number().int().nonnegative().optional(),
5396
- is_enabled: external_exports.boolean().default(true),
5397
- inject_in_last_message: external_exports.boolean().default(true)
5398
- });
5399
- updateStateBody = external_exports.object({
5400
- // state_slug is immutable after first persist — not accepted here.
5401
- state_name: stateNameSchema.optional(),
5402
- state_scope: external_exports.enum(["conversation", "user"]).optional(),
5403
- state_description: external_exports.string().max(1e3).nullish(),
5404
- json_schema: external_exports.record(external_exports.unknown()).optional(),
5405
- initial_value: initialValueUpdateSchema,
5406
- display_order: external_exports.number().int().nonnegative().optional(),
5407
- is_enabled: external_exports.boolean().optional(),
5408
- inject_in_last_message: external_exports.boolean().optional()
5409
- });
5410
- reorderStatesBody = external_exports.object({
5411
- states: external_exports.array(external_exports.object({
5412
- state_id: external_exports.string().uuid(),
5413
- display_order: external_exports.number().int().nonnegative()
5414
- })).min(1)
5457
+ accessExplainQuery = external_exports.object({
5458
+ user_id: external_exports.string().regex(USER_ID_REGEX).optional()
5415
5459
  });
5416
5460
  }
5417
5461
  });
@@ -5567,34 +5611,68 @@ var init_chunk_IPXBFWUU = __esm({
5567
5611
  }
5568
5612
  });
5569
5613
 
5570
- // ../../packages/core/dist/chunk-NKLVUTFO.js
5571
- var BASE_CREDENTIAL_MANAGED_BY, BASE_CREDENTIAL_NAME_MAX, BASE_CREDENTIAL_NAME_PATTERN, BASE_CREDENTIAL_NAME_CHARSET, baseCredentialNameSchema, createBaseCredentialLinkBody, baseCredentialLinkParams, baseCredentialLinkQuery;
5572
- var init_chunk_NKLVUTFO = __esm({
5573
- "../../packages/core/dist/chunk-NKLVUTFO.js"() {
5614
+ // ../../packages/core/dist/chunk-5VL6LBFD.js
5615
+ var PERMISSIONS;
5616
+ var init_chunk_5VL6LBFD = __esm({
5617
+ "../../packages/core/dist/chunk-5VL6LBFD.js"() {
5618
+ "use strict";
5619
+ PERMISSIONS = [
5620
+ "hub:read",
5621
+ "hub:write",
5622
+ "hub:admin",
5623
+ "conversation:read",
5624
+ "conversation:write",
5625
+ "analytics:read",
5626
+ "billing:read",
5627
+ "billing:write",
5628
+ "org:read",
5629
+ "org:write",
5630
+ "org:admin",
5631
+ "contacts:write",
5632
+ "platform:admin",
5633
+ "*"
5634
+ ];
5635
+ }
5636
+ });
5637
+
5638
+ // ../../packages/core/dist/chunk-VEERWOZ6.js
5639
+ var MAX_NAME_LENGTH, MAX_HUBS_PER_GRANT, MAX_HUB_TAGS_PER_GRANT, MAX_GRANTS, permissionEnum, grantScopeSchema, grantSchema, createTokenBody, tokenOrgIdParam;
5640
+ var init_chunk_VEERWOZ6 = __esm({
5641
+ "../../packages/core/dist/chunk-VEERWOZ6.js"() {
5574
5642
  "use strict";
5643
+ init_chunk_5VL6LBFD();
5644
+ init_chunk_HZ6CADSY();
5575
5645
  init_zod();
5576
- BASE_CREDENTIAL_MANAGED_BY = {
5577
- DIRECT: "direct",
5578
- ORG_LINK: "org-link"
5579
- };
5580
- BASE_CREDENTIAL_NAME_MAX = 100;
5581
- BASE_CREDENTIAL_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:@+~=-]*$/;
5582
- BASE_CREDENTIAL_NAME_CHARSET = "letters, digits and '. _ : @ + ~ = -', starting with a letter or digit";
5583
- baseCredentialNameSchema = external_exports.string().min(1).max(BASE_CREDENTIAL_NAME_MAX).regex(BASE_CREDENTIAL_NAME_PATTERN, `name must use ${BASE_CREDENTIAL_NAME_CHARSET}`);
5584
- createBaseCredentialLinkBody = external_exports.object({
5585
- organization_id: external_exports.string().uuid(),
5586
- base_id: external_exports.string().min(1),
5587
- /** Defaults to a slug derived from the credential's display name. */
5588
- name: baseCredentialNameSchema.optional()
5589
- });
5590
- baseCredentialLinkParams = external_exports.object({
5591
- id: external_exports.string().uuid(),
5592
- base_credential_id: external_exports.string().min(1)
5593
- });
5594
- baseCredentialLinkQuery = external_exports.object({
5595
- organization_id: external_exports.string().uuid(),
5596
- base_id: external_exports.string().min(1)
5646
+ MAX_NAME_LENGTH = 100;
5647
+ MAX_HUBS_PER_GRANT = 50;
5648
+ MAX_HUB_TAGS_PER_GRANT = 20;
5649
+ MAX_GRANTS = 20;
5650
+ permissionEnum = external_exports.enum(PERMISSIONS).refine(
5651
+ (p) => p !== "platform:admin",
5652
+ { message: "platform:admin cannot be delegated via token creation" }
5653
+ );
5654
+ grantScopeSchema = external_exports.object({
5655
+ // Required: every token grant must declare its org tenancy. The handler
5656
+ // also strict-checks this as defense-in-depth, but failing at the Zod
5657
+ // boundary keeps the generated client type honest (org_id: string).
5658
+ org_id: external_exports.string().min(1),
5659
+ hubs: external_exports.array(external_exports.string().min(1)).min(1, "Each grant must have scope.hubs as a non-empty array").max(MAX_HUBS_PER_GRANT),
5660
+ hub_tags: external_exports.array(external_exports.string().min(1)).min(1, "scope.hub_tags must be a non-empty array if provided").max(MAX_HUB_TAGS_PER_GRANT).optional(),
5661
+ environments: external_exports.array(external_exports.enum(["production", "preview"])).min(1, "scope.environments must be a non-empty array if provided").optional()
5662
+ }).strict();
5663
+ grantSchema = external_exports.object({
5664
+ scope: grantScopeSchema,
5665
+ permissions: external_exports.array(permissionEnum).min(1, "Each grant must have permissions as a non-empty array")
5666
+ }).strict();
5667
+ createTokenBody = external_exports.object({
5668
+ name: external_exports.string().trim().min(1, "name is required").max(MAX_NAME_LENGTH, `name must be ${MAX_NAME_LENGTH} characters or fewer`),
5669
+ grants: external_exports.array(grantSchema).min(1, "grants must be a non-empty array").max(MAX_GRANTS),
5670
+ expires_at: external_exports.string().datetime({ message: "expires_at must be a valid ISO 8601 date" }).refine(
5671
+ (s) => new Date(s).getTime() > Date.now(),
5672
+ { message: "expires_at must be in the future" }
5673
+ ).optional()
5597
5674
  });
5675
+ tokenOrgIdParam = external_exports.object({ orgId: uuidSchema });
5598
5676
  }
5599
5677
  });
5600
5678
 
@@ -6150,19 +6228,6 @@ var init_chunk_ZC6YGHNX = __esm({
6150
6228
  }
6151
6229
  });
6152
6230
 
6153
- // ../../packages/core/dist/chunk-HIGKBEPF.js
6154
- var accessExplainQuery;
6155
- var init_chunk_HIGKBEPF = __esm({
6156
- "../../packages/core/dist/chunk-HIGKBEPF.js"() {
6157
- "use strict";
6158
- init_chunk_HZ6CADSY();
6159
- init_zod();
6160
- accessExplainQuery = external_exports.object({
6161
- user_id: external_exports.string().regex(USER_ID_REGEX).optional()
6162
- });
6163
- }
6164
- });
6165
-
6166
6231
  // ../../packages/core/dist/chunk-5DGHIY7L.js
6167
6232
  var rekorBaseChangeMessageSchema;
6168
6233
  var init_chunk_5DGHIY7L = __esm({
@@ -6190,10 +6255,10 @@ var init_chunk_5DGHIY7L = __esm({
6190
6255
  }
6191
6256
  });
6192
6257
 
6193
- // ../../packages/core/dist/chunk-5XEJSR22.js
6194
- var DATA_PROXY_MOUNT, DATA_PROXY_PREFIX, BASE_DESTRUCTION_MOUNT, BASE_DESTRUCTION_PREFIX, BASE_DESTRUCTION_CONFIRM_PATH, COMMUNITY_EMAIL_UNSUBSCRIBE_PATH, CONTACT_BOOK_EMAIL_UNSUBSCRIBE_PATH, AUTOMATION_WEBHOOK_MOUNT, MANAGED_AGENTS_WEBHOOK_MOUNT;
6195
- var init_chunk_5XEJSR22 = __esm({
6196
- "../../packages/core/dist/chunk-5XEJSR22.js"() {
6258
+ // ../../packages/core/dist/chunk-5FO3GNKP.js
6259
+ var DATA_PROXY_MOUNT, DATA_PROXY_PREFIX, BASE_DESTRUCTION_MOUNT, BASE_DESTRUCTION_PREFIX, BASE_DESTRUCTION_CONFIRM_PATH, COMMUNITY_EMAIL_UNSUBSCRIBE_PATH, CONTACT_BOOK_EMAIL_UNSUBSCRIBE_PATH, AUTOMATION_WEBHOOK_MOUNT, MANAGED_AGENTS_WEBHOOK_MOUNT, TELEGRAM_VAULT_WEBHOOK_PATH;
6260
+ var init_chunk_5FO3GNKP = __esm({
6261
+ "../../packages/core/dist/chunk-5FO3GNKP.js"() {
6197
6262
  "use strict";
6198
6263
  DATA_PROXY_MOUNT = "/data";
6199
6264
  DATA_PROXY_PREFIX = `/api${DATA_PROXY_MOUNT}`;
@@ -6204,10 +6269,11 @@ var init_chunk_5XEJSR22 = __esm({
6204
6269
  CONTACT_BOOK_EMAIL_UNSUBSCRIBE_PATH = "/api/contact-book/email-unsubscribe";
6205
6270
  AUTOMATION_WEBHOOK_MOUNT = "/webhooks/automations";
6206
6271
  MANAGED_AGENTS_WEBHOOK_MOUNT = "/webhooks/managed-agents";
6272
+ TELEGRAM_VAULT_WEBHOOK_PATH = "/webhooks/telegram/vault";
6207
6273
  }
6208
6274
  });
6209
6275
 
6210
- // ../../packages/core/dist/chunk-3VCB2RTC.js
6276
+ // ../../packages/core/dist/chunk-JSLX2PRT.js
6211
6277
  function matchPath(pattern, path45) {
6212
6278
  const pathSegments2 = path45.replace(/\/$/, "").split("/");
6213
6279
  const isPrefix = pattern.endsWith("/*");
@@ -6236,10 +6302,10 @@ function getEndpointConfig(path45) {
6236
6302
  return { tier: "STANDARD" };
6237
6303
  }
6238
6304
  var ENDPOINT_CONFIGS, EXCLUDED_PATHS;
6239
- var init_chunk_3VCB2RTC = __esm({
6240
- "../../packages/core/dist/chunk-3VCB2RTC.js"() {
6305
+ var init_chunk_JSLX2PRT = __esm({
6306
+ "../../packages/core/dist/chunk-JSLX2PRT.js"() {
6241
6307
  "use strict";
6242
- init_chunk_5XEJSR22();
6308
+ init_chunk_5FO3GNKP();
6243
6309
  ENDPOINT_CONFIGS = {
6244
6310
  // OAuth callbacks - strict, fail-closed (prevent brute force)
6245
6311
  "/oauth/callback/*": { tier: "STRICT", failClosed: true },
@@ -6398,6 +6464,9 @@ var init_chunk_3VCB2RTC = __esm({
6398
6464
  // vendor address carries every tenant's, so BULK. The per-connection budget is
6399
6465
  // `MANAGED_AGENTS_WEBHOOK_PER_CONNECTION_LIMIT`, counted after the delivery is verified.
6400
6466
  [`${MANAGED_AGENTS_WEBHOOK_MOUNT}/*`]: { tier: "BULK" },
6467
+ // Telegram updates the credentials vault forwards for the bots whose tokens it holds (wayai#5644):
6468
+ // the vault's egress carries every such bot's, so BULK. Its signature is checked after this.
6469
+ [TELEGRAM_VAULT_WEBHOOK_PATH]: { tier: "BULK" },
6401
6470
  // Reports (CLI → platform_report triage queue). One per-user budget covers intake
6402
6471
  // (POST), the content edit (PATCH /:id), the reporter read-back (GET, GET /:id), and the
6403
6472
  // verification loop (POST /:id/accept, /:id/contest). The limiter is path-based, so a
@@ -6716,7 +6785,7 @@ var init_chunk_3VCB2RTC = __esm({
6716
6785
  }
6717
6786
  });
6718
6787
 
6719
- // ../../packages/core/dist/chunk-S447DV3E.js
6788
+ // ../../packages/core/dist/chunk-YFHL2BKN.js
6720
6789
  function fileSnapshotChanged(run) {
6721
6790
  return run.written + run.removed > 0;
6722
6791
  }
@@ -6757,11 +6826,11 @@ async function sendWithRetry(opts, cursor) {
6757
6826
  }
6758
6827
  }
6759
6828
  var rekorFileSnapshotAnswerSchema, FILE_SNAPSHOT_MAX_PAGES, FILE_SNAPSHOT_CONFLICT_ATTEMPTS, FILE_SNAPSHOT_PAGE_SPACING_MS, FILE_SNAPSHOT_CONFLICT_STATUS;
6760
- var init_chunk_S447DV3E = __esm({
6761
- "../../packages/core/dist/chunk-S447DV3E.js"() {
6829
+ var init_chunk_YFHL2BKN = __esm({
6830
+ "../../packages/core/dist/chunk-YFHL2BKN.js"() {
6762
6831
  "use strict";
6763
- init_chunk_3VCB2RTC();
6764
- init_chunk_5XEJSR22();
6832
+ init_chunk_JSLX2PRT();
6833
+ init_chunk_5FO3GNKP();
6765
6834
  init_zod();
6766
6835
  rekorFileSnapshotAnswerSchema = external_exports.object({
6767
6836
  data: external_exports.object({
@@ -6945,621 +7014,109 @@ var init_chunk_GPM7PE44 = __esm({
6945
7014
  }
6946
7015
  });
6947
7016
 
6948
- // ../../packages/core/dist/chunk-5VL6LBFD.js
6949
- var PERMISSIONS;
6950
- var init_chunk_5VL6LBFD = __esm({
6951
- "../../packages/core/dist/chunk-5VL6LBFD.js"() {
6952
- "use strict";
6953
- PERMISSIONS = [
6954
- "hub:read",
6955
- "hub:write",
6956
- "hub:admin",
6957
- "conversation:read",
6958
- "conversation:write",
6959
- "analytics:read",
6960
- "billing:read",
6961
- "billing:write",
6962
- "org:read",
6963
- "org:write",
6964
- "org:admin",
6965
- "contacts:write",
6966
- "platform:admin",
6967
- "*"
6968
- ];
7017
+ // ../../packages/core/dist/chunk-WEXVYJ5H.js
7018
+ function containsKanbanPlaceholders(value) {
7019
+ if (value == null) return false;
7020
+ const serialized = typeof value === "string" ? value : JSON.stringify(value);
7021
+ for (const token of PLACEHOLDER_TOKENS) {
7022
+ if (serialized.includes(token)) return true;
6969
7023
  }
6970
- });
6971
-
6972
- // ../../packages/core/dist/chunk-VEERWOZ6.js
6973
- var MAX_NAME_LENGTH, MAX_HUBS_PER_GRANT, MAX_HUB_TAGS_PER_GRANT, MAX_GRANTS, permissionEnum, grantScopeSchema, grantSchema, createTokenBody, tokenOrgIdParam;
6974
- var init_chunk_VEERWOZ6 = __esm({
6975
- "../../packages/core/dist/chunk-VEERWOZ6.js"() {
6976
- "use strict";
6977
- init_chunk_5VL6LBFD();
6978
- init_chunk_HZ6CADSY();
6979
- init_zod();
6980
- MAX_NAME_LENGTH = 100;
6981
- MAX_HUBS_PER_GRANT = 50;
6982
- MAX_HUB_TAGS_PER_GRANT = 20;
6983
- MAX_GRANTS = 20;
6984
- permissionEnum = external_exports.enum(PERMISSIONS).refine(
6985
- (p) => p !== "platform:admin",
6986
- { message: "platform:admin cannot be delegated via token creation" }
6987
- );
6988
- grantScopeSchema = external_exports.object({
6989
- // Required: every token grant must declare its org tenancy. The handler
6990
- // also strict-checks this as defense-in-depth, but failing at the Zod
6991
- // boundary keeps the generated client type honest (org_id: string).
6992
- org_id: external_exports.string().min(1),
6993
- hubs: external_exports.array(external_exports.string().min(1)).min(1, "Each grant must have scope.hubs as a non-empty array").max(MAX_HUBS_PER_GRANT),
6994
- hub_tags: external_exports.array(external_exports.string().min(1)).min(1, "scope.hub_tags must be a non-empty array if provided").max(MAX_HUB_TAGS_PER_GRANT).optional(),
6995
- environments: external_exports.array(external_exports.enum(["production", "preview"])).min(1, "scope.environments must be a non-empty array if provided").optional()
6996
- }).strict();
6997
- grantSchema = external_exports.object({
6998
- scope: grantScopeSchema,
6999
- permissions: external_exports.array(permissionEnum).min(1, "Each grant must have permissions as a non-empty array")
7000
- }).strict();
7001
- createTokenBody = external_exports.object({
7002
- name: external_exports.string().trim().min(1, "name is required").max(MAX_NAME_LENGTH, `name must be ${MAX_NAME_LENGTH} characters or fewer`),
7003
- grants: external_exports.array(grantSchema).min(1, "grants must be a non-empty array").max(MAX_GRANTS),
7004
- expires_at: external_exports.string().datetime({ message: "expires_at must be a valid ISO 8601 date" }).refine(
7005
- (s) => new Date(s).getTime() > Date.now(),
7006
- { message: "expires_at must be in the future" }
7007
- ).optional()
7008
- });
7009
- tokenOrgIdParam = external_exports.object({ orgId: uuidSchema });
7024
+ return false;
7025
+ }
7026
+ function extractToolParameters(toolConfig) {
7027
+ let cfg = toolConfig;
7028
+ if (typeof cfg === "string") {
7029
+ try {
7030
+ cfg = JSON.parse(cfg);
7031
+ } catch {
7032
+ return void 0;
7033
+ }
7010
7034
  }
7011
- });
7012
-
7013
- // ../../packages/core/dist/chunk-ZVXO3XL6.js
7014
- 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;
7015
- var init_chunk_ZVXO3XL6 = __esm({
7016
- "../../packages/core/dist/chunk-ZVXO3XL6.js"() {
7017
- "use strict";
7018
- init_chunk_HZ6CADSY();
7019
- init_zod();
7020
- PEOPLE_CONTACT_PAGE_MAX = 100;
7021
- PEOPLE_CONTACT_PAGE_DEFAULT = 50;
7022
- PEOPLE_CONTACT_EMAIL_MAX_LENGTH = 254;
7023
- peopleUserIdSchema = external_exports.string().max(64).regex(USER_ID_REGEX, "must be a user id");
7024
- peopleInviteEmailSchema = external_exports.string().trim().max(PEOPLE_CONTACT_EMAIL_MAX_LENGTH).email();
7025
- peopleContactInviteBody = external_exports.object({
7026
- email: peopleInviteEmailSchema
7027
- }).strict();
7028
- peopleContactInviteIdParam = external_exports.object({ inviteId: uuidSchema });
7029
- peopleContactUserIdParam = external_exports.object({ userId: peopleUserIdSchema });
7030
- 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, {
7031
- message: "Name a thread or a community, not both",
7032
- path: ["community_id"]
7035
+ if (!cfg || typeof cfg !== "object" || Array.isArray(cfg)) return void 0;
7036
+ return cfg.parameters;
7037
+ }
7038
+ function isRecord(v) {
7039
+ return typeof v === "object" && v !== null && !Array.isArray(v);
7040
+ }
7041
+ function isPrimitive(v) {
7042
+ return v === null || ["string", "number", "boolean"].includes(typeof v);
7043
+ }
7044
+ function typeMatches(typeField, allowed) {
7045
+ if (typeof typeField === "string") return allowed.has(typeField);
7046
+ if (Array.isArray(typeField)) return typeField.every((t) => typeof t === "string" && allowed.has(t));
7047
+ return false;
7048
+ }
7049
+ function validateSchema(schema, path45, errors, opts = {}) {
7050
+ if (typeof schema === "boolean") return;
7051
+ const depth = opts.depth ?? 0;
7052
+ if (depth > MAX_SCHEMA_DEPTH) {
7053
+ errors.push({
7054
+ path: path45 || "<root>",
7055
+ message: `schema nesting exceeds ${MAX_SCHEMA_DEPTH} levels`,
7056
+ suggestion: "Flatten the schema; LLM providers reject deeply nested tool input_schemas."
7033
7057
  });
7034
- peopleContactPageQuery = external_exports.object({
7035
- cursor: external_exports.string().min(1).max(256).optional(),
7036
- limit: external_exports.coerce.number().int().min(1).max(PEOPLE_CONTACT_PAGE_MAX).default(PEOPLE_CONTACT_PAGE_DEFAULT)
7058
+ return;
7059
+ }
7060
+ if (!isRecord(schema)) {
7061
+ errors.push({
7062
+ path: path45,
7063
+ message: `expected object, got ${schema === null ? "null" : typeof schema}`
7037
7064
  });
7038
- peopleOutgoingInviteSchema = external_exports.object({
7039
- invite_id: uuidSchema,
7040
- email: external_exports.string(),
7041
- status: external_exports.literal("sent"),
7042
- created_at: timestampSchema,
7043
- expires_at: timestampSchema
7044
- }).strict();
7045
- peopleContactPersonSchema = external_exports.object({
7046
- user_id: peopleUserIdSchema,
7047
- display_name: external_exports.string().nullable(),
7048
- email: external_exports.string().nullable()
7049
- }).strict();
7050
- peopleContactSchema = peopleContactPersonSchema.extend({ contact_since: timestampSchema, thread_id: uuidSchema }).strict();
7051
- peopleIncomingInviteSchema = external_exports.object({
7052
- invite_id: uuidSchema,
7053
- inviter: peopleContactPersonSchema,
7054
- created_at: timestampSchema,
7055
- expires_at: timestampSchema
7056
- }).strict();
7057
- peopleBlockedUserSchema = peopleContactPersonSchema.extend({ blocked_at: timestampSchema, deleted_user: external_exports.boolean() }).strict();
7065
+ return;
7058
7066
  }
7059
- });
7060
-
7061
- // ../../packages/core/dist/chunk-ZXK6N2HN.js
7062
- 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;
7063
- var init_chunk_ZXK6N2HN = __esm({
7064
- "../../packages/core/dist/chunk-ZXK6N2HN.js"() {
7065
- "use strict";
7066
- init_chunk_ZVXO3XL6();
7067
- init_chunk_HZ6CADSY();
7068
- init_zod();
7069
- PEOPLE_MODERATION_NOTE_MAX_LENGTH = 500;
7070
- ADMIN_PEOPLE_REPORTS_PAGE_MAX = 100;
7071
- ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT = 50;
7072
- PEOPLE_SUSPENDED_REASON = "suspended";
7073
- peopleModerationActionSchema = external_exports.enum(["remove_message", "suspend", "unsuspend", "dismiss"]);
7074
- moderationNoteSchema = optionalTrimmedText(PEOPLE_MODERATION_NOTE_MAX_LENGTH);
7075
- adminPeopleReportListQuery = external_exports.object({
7076
- pending: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true"),
7077
- /** Lower bound on `created_at`. */
7078
- since: timestampSchema.optional(),
7079
- limit: external_exports.coerce.number().int().min(1).max(ADMIN_PEOPLE_REPORTS_PAGE_MAX).default(ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT),
7080
- offset: external_exports.coerce.number().int().min(0).default(0)
7067
+ if (opts.isRoot) {
7068
+ if ("type" in schema && schema.type !== "object") {
7069
+ errors.push({
7070
+ path: path45 ? `${path45}.type` : "type",
7071
+ message: `root type must be 'object', got ${JSON.stringify(schema.type)}`,
7072
+ suggestion: "Tool parameters at the root must be an object: `{ type: 'object', properties: { ... } }`."
7073
+ });
7074
+ }
7075
+ } else if ("type" in schema && !typeMatches(schema.type, ALLOWED_TYPES)) {
7076
+ errors.push({
7077
+ path: `${path45}.type`,
7078
+ message: `type must be one of ${[...ALLOWED_TYPES].join("/")} or an array of those, got ${JSON.stringify(schema.type)}`
7081
7079
  });
7082
- adminPeopleReportIdParam = external_exports.object({ reportId: uuidSchema });
7083
- adminPeopleMessageRemovalBody = external_exports.object({ report_id: uuidSchema, message_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
7084
- adminPeopleSuspendBody = external_exports.object({ report_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
7085
- adminPeopleNoteBody = external_exports.object({ note: moderationNoteSchema }).strict();
7086
7080
  }
7087
- });
7088
-
7089
- // ../../packages/core/dist/chunk-Y7CFCYX4.js
7090
- var PEOPLE_REPORT_DETAILS_MAX_LENGTH, peopleReportReasonSchema, reportDetailsSchema, reportFields, peopleReportBody;
7091
- var init_chunk_Y7CFCYX4 = __esm({
7092
- "../../packages/core/dist/chunk-Y7CFCYX4.js"() {
7093
- "use strict";
7094
- init_chunk_ZVXO3XL6();
7095
- init_chunk_HZ6CADSY();
7096
- init_zod();
7097
- PEOPLE_REPORT_DETAILS_MAX_LENGTH = 500;
7098
- peopleReportReasonSchema = external_exports.enum(["spam", "harassment", "hate", "sexual", "violence", "other"]);
7099
- reportDetailsSchema = optionalTrimmedText(PEOPLE_REPORT_DETAILS_MAX_LENGTH);
7100
- reportFields = { reason: peopleReportReasonSchema, details: reportDetailsSchema };
7101
- peopleReportBody = external_exports.discriminatedUnion("target", [
7102
- external_exports.object({ target: external_exports.literal("message"), thread_id: uuidSchema, message_id: uuidSchema, ...reportFields }).strict(),
7103
- external_exports.object({ target: external_exports.literal("thread"), thread_id: uuidSchema, ...reportFields }).strict(),
7104
- external_exports.object({ target: external_exports.literal("user"), user_id: peopleUserIdSchema, thread_id: uuidSchema.optional(), ...reportFields }).strict(),
7105
- external_exports.object({
7106
- target: external_exports.literal("community_message"),
7107
- community_id: uuidSchema,
7108
- room_id: uuidSchema,
7109
- message_id: uuidSchema,
7110
- ...reportFields
7111
- }).strict(),
7112
- external_exports.object({ target: external_exports.literal("community_member"), community_id: uuidSchema, user_id: peopleUserIdSchema, ...reportFields }).strict()
7113
- ]);
7081
+ if ("enum" in schema) {
7082
+ const e = schema.enum;
7083
+ if (typeof e === "string") {
7084
+ const isPlaceholder = PLACEHOLDER_TOKENS.includes(e);
7085
+ const isOutcomePlaceholder = e === "[KANBAN_OUTCOME_VALUES]";
7086
+ errors.push({
7087
+ path: `${path45}.enum`,
7088
+ message: `enum must be a non-empty array of primitives, got string ${JSON.stringify(e)}`,
7089
+ suggestion: isOutcomePlaceholder ? "Declare `outcomes` on the hub's terminal kanban status so the platform can render the placeholder into a valid array; with none configured the platform drops the parameter instead." : isPlaceholder ? "Set `operation: 'update_kanban_status'` on the tool and ensure at least one hub.kanban_status has `allowsAgentUpdate: true` so the platform can render the placeholder into a valid array." : 'Wrap the value in an array: `enum: ["value"]`.'
7090
+ });
7091
+ } else if (!Array.isArray(e)) {
7092
+ errors.push({
7093
+ path: `${path45}.enum`,
7094
+ message: `enum must be a non-empty array of primitives, got ${typeof e}`
7095
+ });
7096
+ } else if (e.length === 0) {
7097
+ errors.push({
7098
+ path: `${path45}.enum`,
7099
+ message: "enum must not be empty"
7100
+ });
7101
+ } else {
7102
+ for (let i = 0; i < e.length; i++) {
7103
+ if (!isPrimitive(e[i])) {
7104
+ errors.push({
7105
+ path: `${path45}.enum[${i}]`,
7106
+ message: `enum entry must be a primitive (string/number/boolean/null), got ${typeof e[i]}`
7107
+ });
7108
+ }
7109
+ }
7110
+ }
7114
7111
  }
7115
- });
7116
-
7117
- // ../../packages/core/dist/chunk-2YEGUQR7.js
7118
- var PERSON_ID_PATTERN, CONTACT_PERSON_ID_PATTERN, PERSON_ID_FORM_MESSAGE, userPersonIdSchema, personIdSchema;
7119
- var init_chunk_2YEGUQR7 = __esm({
7120
- "../../packages/core/dist/chunk-2YEGUQR7.js"() {
7121
- "use strict";
7122
- init_zod();
7123
- PERSON_ID_PATTERN = /^prs_[a-z2-7]{52}$/;
7124
- CONTACT_PERSON_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
7125
- PERSON_ID_FORM_MESSAGE = "Must be a person id (prs_\u2026) or a contact id (a lowercase UUID)";
7126
- userPersonIdSchema = external_exports.string().regex(PERSON_ID_PATTERN, { message: "Must be a person id (prs_\u2026)" });
7127
- personIdSchema = external_exports.string().refine(
7128
- (value) => PERSON_ID_PATTERN.test(value) || CONTACT_PERSON_ID_PATTERN.test(value),
7129
- { message: PERSON_ID_FORM_MESSAGE }
7130
- );
7131
- }
7132
- });
7133
-
7134
- // ../../packages/core/dist/chunk-UAOHHCW5.js
7135
- function normalizeContactPhone(raw) {
7136
- const compact = raw.trim().replace(/[\s\-.()]/g, "");
7137
- const withPlus = compact.startsWith("00") ? `+${compact.slice(2)}` : compact;
7138
- return /^\+[1-9]\d{7,14}$/.test(withPlus) ? withPlus : null;
7139
- }
7140
- function normalizeContactLabel(raw) {
7141
- return raw.trim().replace(/\s+/g, " ").toLowerCase();
7142
- }
7143
- function importRowLabels(row, batchLabels) {
7144
- return [.../* @__PURE__ */ new Set([...row.labels ?? [], ...batchLabels ?? []])];
7145
- }
7146
- 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;
7147
- var init_chunk_UAOHHCW5 = __esm({
7148
- "../../packages/core/dist/chunk-UAOHHCW5.js"() {
7149
- "use strict";
7150
- init_zod();
7151
- CONTACT_ENVIRONMENTS = ["production", "preview", "all"];
7152
- CONTACT_NAME_MAX = 200;
7153
- CONTACT_EMAIL_MAX = 320;
7154
- CONTACT_PHONE_INPUT_MAX = 40;
7155
- CONTACT_INSTAGRAM_SID_MAX = 64;
7156
- CONTACT_METADATA_MAX_BYTES = 4096;
7157
- CONTACT_LABEL_MAX = 64;
7158
- CONTACT_LABELS_MAX = 20;
7159
- CONTACT_SCOPE_TAGS_MAX = 20;
7160
- CONTACT_PAGE_MAX = 100;
7161
- CONTACT_IMPORT_BATCH_MAX = 500;
7162
- CONTACT_SEARCH_MAX = 100;
7163
- CONTACT_LIST_NAME_MAX = 64;
7164
- CONTACT_LIST_NAME_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
7165
- CONTACT_LIST_DESCRIPTION_MAX = 1e3;
7166
- CONTACT_LIST_FILTER_MAX = 20;
7167
- CONTACT_LIST_PINS_PER_REQUEST_MAX = 100;
7168
- SUPPRESSION_SCOPES = ["all", "marketing"];
7169
- SUPPRESSION_ID_REGEX = /^[0-9a-f]{64}$/;
7170
- contactName = external_exports.string().trim().min(1).max(CONTACT_NAME_MAX);
7171
- contactPhone = external_exports.string().max(CONTACT_PHONE_INPUT_MAX).transform((raw, ctx) => {
7172
- const phone = normalizeContactPhone(raw);
7173
- if (phone === null) {
7174
- ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Phone must be an international number, e.g. +5511999999999" });
7175
- return external_exports.NEVER;
7176
- }
7177
- return phone;
7178
- });
7179
- contactEmail = external_exports.string().trim().toLowerCase().max(CONTACT_EMAIL_MAX).email();
7180
- contactInstagramSid = external_exports.string().trim().min(1).max(CONTACT_INSTAGRAM_SID_MAX);
7181
- 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");
7182
- contactLabels = external_exports.array(contactLabel).max(CONTACT_LABELS_MAX).transform((labels) => [...new Set(labels)]);
7183
- contactMetadata = external_exports.record(external_exports.unknown()).refine((metadata) => {
7184
- try {
7185
- return new TextEncoder().encode(JSON.stringify(metadata)).length <= CONTACT_METADATA_MAX_BYTES;
7186
- } catch {
7187
- return false;
7188
- }
7189
- }, `Metadata must serialize to at most ${CONTACT_METADATA_MAX_BYTES} bytes`);
7190
- scopeTagIds = external_exports.array(external_exports.string().uuid()).min(1).max(CONTACT_SCOPE_TAGS_MAX).transform((ids) => [...new Set(ids)]);
7191
- contactVisibilitySchema = external_exports.discriminatedUnion("scope", [
7192
- external_exports.object({ scope: external_exports.literal("all_hubs") }).strict(),
7193
- external_exports.object({ scope: external_exports.literal("tags"), tag_ids: scopeTagIds }).strict()
7194
- ]);
7195
- hasIdentity = (row) => Boolean(row.phone || row.email || row.instagram_sid);
7196
- IDENTITY_REQUIRED = "A contact needs a phone, an email or an Instagram id";
7197
- contactBookOrgQuery = external_exports.object({
7198
- organization_id: external_exports.string().uuid()
7199
- });
7200
- contactBookContactParam = external_exports.object({
7201
- contactId: external_exports.string().uuid()
7202
- });
7203
- contactBookListParam = external_exports.object({
7204
- listId: external_exports.string().uuid()
7205
- });
7206
- contactBookHubParam = external_exports.object({
7207
- hubId: external_exports.string().uuid()
7208
- });
7209
- contactBookPageQuery = external_exports.object({
7210
- cursor: external_exports.string().max(2048).optional(),
7211
- limit: external_exports.coerce.number().int().min(1).max(CONTACT_PAGE_MAX).default(50)
7212
- });
7213
- listContactBookContactsQuery = contactBookOrgQuery.merge(contactBookPageQuery).extend({
7214
- q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional(),
7215
- label: external_exports.string().max(CONTACT_LABEL_MAX).transform(normalizeContactLabel).optional(),
7216
- scope_tag_id: external_exports.string().uuid().optional()
7217
- });
7218
- listHubContactBookContactsQuery = contactBookPageQuery.extend({
7219
- q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional()
7220
- });
7221
- contactBookLinkCandidatesQuery = contactBookOrgQuery.extend({
7222
- email: contactEmail
7223
- });
7224
- listContactBookListMembersQuery = contactBookOrgQuery.merge(contactBookPageQuery);
7225
- contactRowFields = {
7226
- name: contactName,
7227
- phone: contactPhone.nullish(),
7228
- email: contactEmail.nullish(),
7229
- instagram_sid: contactInstagramSid.nullish(),
7230
- labels: contactLabels.optional(),
7231
- metadata: contactMetadata.optional()
7232
- };
7233
- createContactBookContactBody = external_exports.object({
7234
- organization_id: external_exports.string().uuid(),
7235
- ...contactRowFields,
7236
- visibility: contactVisibilitySchema,
7237
- environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
7238
- }).strict().refine(hasIdentity, IDENTITY_REQUIRED);
7239
- updateContactBookContactBody = external_exports.object({
7240
- name: contactName.optional(),
7241
- phone: contactPhone.nullable().optional(),
7242
- email: contactEmail.nullable().optional(),
7243
- instagram_sid: contactInstagramSid.nullable().optional(),
7244
- labels: contactLabels.optional(),
7245
- metadata: contactMetadata.optional(),
7246
- visibility: contactVisibilitySchema.optional(),
7247
- environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
7248
- }).strict();
7249
- contactImportRowSchema = external_exports.object(contactRowFields).strict().refine(hasIdentity, IDENTITY_REQUIRED);
7250
- importContactBookContactsBody = external_exports.object({
7251
- organization_id: external_exports.string().uuid(),
7252
- visibility: contactVisibilitySchema,
7253
- environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional(),
7254
- labels: contactLabels.optional(),
7255
- rows: external_exports.array(contactImportRowSchema).min(1).max(CONTACT_IMPORT_BATCH_MAX)
7256
- }).strict().superRefine((batch, ctx) => {
7257
- batch.rows.forEach((row, index) => {
7258
- if (importRowLabels(row, batch.labels).length > CONTACT_LABELS_MAX) {
7259
- ctx.addIssue({
7260
- code: external_exports.ZodIssueCode.custom,
7261
- path: ["rows", index, "labels"],
7262
- message: `A contact holds at most ${CONTACT_LABELS_MAX} labels, the batch's included`
7263
- });
7264
- }
7265
- });
7266
- });
7267
- linkContactBookContactBody = external_exports.object({
7268
- user_id: external_exports.string().min(1).max(128)
7269
- }).strict();
7270
- listName = external_exports.string().trim().min(1).max(CONTACT_LIST_NAME_MAX).regex(CONTACT_LIST_NAME_REGEX, {
7271
- message: 'Must be lowercase alphanumeric with hyphens (e.g. "vip-customers")'
7272
- });
7273
- contactListFilterSchema = external_exports.object({
7274
- labels: external_exports.array(contactLabel).max(CONTACT_LIST_FILTER_MAX).transform((l) => [...new Set(l)]).default([]),
7275
- scope_tag_ids: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_FILTER_MAX).transform((t) => [...new Set(t)]).default([])
7276
- }).strict();
7277
- createContactBookListBody = external_exports.object({
7278
- organization_id: external_exports.string().uuid(),
7279
- name: listName,
7280
- description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullish(),
7281
- filter: contactListFilterSchema.optional()
7282
- }).strict();
7283
- updateContactBookListBody = external_exports.object({
7284
- name: listName.optional(),
7285
- description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullable().optional(),
7286
- filter: contactListFilterSchema.optional()
7287
- }).strict();
7288
- updateContactBookListPinsBody = external_exports.object({
7289
- add: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([]),
7290
- remove: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([])
7291
- }).strict().refine((b) => b.add.length + b.remove.length > 0, "Add or remove at least one contact");
7292
- suppressionIdentitySchema = external_exports.discriminatedUnion("kind", [
7293
- external_exports.object({ kind: external_exports.literal("phone"), value: contactPhone }).strict(),
7294
- external_exports.object({ kind: external_exports.literal("email"), value: contactEmail }).strict(),
7295
- external_exports.object({ kind: external_exports.literal("instagram"), value: contactInstagramSid }).strict()
7296
- ]);
7297
- createContactBookSuppressionBody = external_exports.object({
7298
- organization_id: external_exports.string().uuid(),
7299
- identity: suppressionIdentitySchema,
7300
- scope: external_exports.enum(SUPPRESSION_SCOPES)
7301
- }).strict();
7302
- contactBookSuppressionParam = external_exports.object({
7303
- suppressionId: external_exports.string().regex(SUPPRESSION_ID_REGEX)
7304
- });
7305
- listContactBookSuppressionsQuery = contactBookOrgQuery.merge(contactBookPageQuery);
7306
- contactBookEmailUnsubscribeTokenSchema = external_exports.string().max(200).regex(/^[0-9a-f-]{36}\.[0-9a-f]{64}\.[0-9a-f]{64}$/i);
7307
- contactBookEmailUnsubscribeQuery = external_exports.object({ token: contactBookEmailUnsubscribeTokenSchema });
7308
- orgListReferenceSchema = listName;
7309
- }
7310
- });
7311
-
7312
- // ../../packages/core/dist/chunk-MGBAXT5Y.js
7313
- var PERSON_LINKS_MAX, PERSON_DENY_PAGE_MAX, personParam, personLinkParam, deniedPersonParam, listDeniedPersonsQuery, conversationCustomerPersonParam;
7314
- var init_chunk_MGBAXT5Y = __esm({
7315
- "../../packages/core/dist/chunk-MGBAXT5Y.js"() {
7316
- "use strict";
7317
- init_chunk_2YEGUQR7();
7318
- init_chunk_UAOHHCW5();
7319
- init_zod();
7320
- PERSON_LINKS_MAX = 15;
7321
- PERSON_DENY_PAGE_MAX = 100;
7322
- personParam = external_exports.object({
7323
- personId: userPersonIdSchema
7324
- });
7325
- personLinkParam = personParam.extend({
7326
- targetId: personIdSchema
7327
- });
7328
- deniedPersonParam = external_exports.object({
7329
- personId: personIdSchema
7330
- });
7331
- listDeniedPersonsQuery = contactBookOrgQuery.extend({
7332
- cursor: personIdSchema.optional(),
7333
- limit: external_exports.coerce.number().int().min(1).max(PERSON_DENY_PAGE_MAX).default(50)
7334
- });
7335
- conversationCustomerPersonParam = external_exports.object({
7336
- hubId: external_exports.string().uuid(),
7337
- conversationId: external_exports.string().uuid()
7338
- });
7339
- }
7340
- });
7341
-
7342
- // ../../packages/core/dist/chunk-YUZFHVB2.js
7343
- var invitePreviewQuery, inviteRolePreviewResponse, inviteContactPreviewResponse, invitePreviewResponse, inviteUnsubscribeBody;
7344
- var init_chunk_YUZFHVB2 = __esm({
7345
- "../../packages/core/dist/chunk-YUZFHVB2.js"() {
7346
- "use strict";
7347
- init_zod();
7348
- invitePreviewQuery = external_exports.object({
7349
- token: external_exports.string().min(1).max(2048)
7350
- });
7351
- inviteRolePreviewResponse = external_exports.object({
7352
- inviter_name: external_exports.string(),
7353
- entity_id: external_exports.string().uuid(),
7354
- entity_name: external_exports.string(),
7355
- entity_type: external_exports.enum(["org", "hub"]),
7356
- role: external_exports.enum(["org_admin", "admin", "team_user", "user"]),
7357
- expires_at: external_exports.string().datetime()
7358
- });
7359
- inviteContactPreviewResponse = external_exports.object({
7360
- inviter_name: external_exports.string().nullable(),
7361
- entity_id: external_exports.string().uuid(),
7362
- entity_type: external_exports.literal("contact"),
7363
- role: external_exports.literal("contact"),
7364
- expires_at: external_exports.string().datetime()
7365
- });
7366
- invitePreviewResponse = external_exports.union([inviteRolePreviewResponse, inviteContactPreviewResponse]);
7367
- inviteUnsubscribeBody = external_exports.object({ token: external_exports.string().min(1).max(256) }).strict();
7368
- }
7369
- });
7370
-
7371
- // ../../packages/core/dist/chunk-I3O2RACG.js
7372
- var managedAgentsWebhookParams, MANAGED_AGENTS_WEBHOOK_BODY_MAX_BYTES;
7373
- var init_chunk_I3O2RACG = __esm({
7374
- "../../packages/core/dist/chunk-I3O2RACG.js"() {
7375
- "use strict";
7376
- init_zod();
7377
- managedAgentsWebhookParams = external_exports.object({
7378
- hub_id: external_exports.string().uuid(),
7379
- connection_id: external_exports.string().uuid()
7380
- });
7381
- MANAGED_AGENTS_WEBHOOK_BODY_MAX_BYTES = 16 * 1024;
7382
- }
7383
- });
7384
-
7385
- // ../../packages/core/dist/chunk-34LE6P7E.js
7386
- var templateIdParam, listTemplatesQuery, deleteTemplateQuery, templateStatusQuery, createTemplateBody, updateTemplateBody, submitTemplateBody, testTemplateBody;
7387
- var init_chunk_34LE6P7E = __esm({
7388
- "../../packages/core/dist/chunk-34LE6P7E.js"() {
7389
- "use strict";
7390
- init_zod();
7391
- templateIdParam = external_exports.object({
7392
- id: external_exports.string().uuid()
7393
- });
7394
- listTemplatesQuery = external_exports.object({
7395
- hub_id: external_exports.string().uuid(),
7396
- connection_id: external_exports.string().uuid()
7397
- });
7398
- deleteTemplateQuery = external_exports.object({
7399
- hub_id: external_exports.string().uuid(),
7400
- connection_id: external_exports.string().uuid()
7401
- });
7402
- templateStatusQuery = external_exports.object({
7403
- hub_id: external_exports.string().uuid(),
7404
- connection_id: external_exports.string().uuid()
7405
- });
7406
- createTemplateBody = external_exports.object({
7407
- hub_id: external_exports.string().uuid(),
7408
- connection_id: external_exports.string().uuid()
7409
- }).passthrough();
7410
- updateTemplateBody = external_exports.object({}).passthrough();
7411
- submitTemplateBody = external_exports.object({
7412
- hub_id: external_exports.string().uuid(),
7413
- connection_id: external_exports.string().uuid()
7414
- }).passthrough();
7415
- testTemplateBody = external_exports.object({
7416
- hub_id: external_exports.string().uuid(),
7417
- connection_id: external_exports.string().uuid()
7418
- }).passthrough();
7419
- }
7420
- });
7421
-
7422
- // ../../packages/core/dist/chunk-FPSDNS2E.js
7423
- var noticeSeveritySchema, noticeStatusSchema, NOTICE_SCOPE_REGEX, noticeScopeSchema, noticeLinkSchema, createNoticeBody, updateNoticeBody, listNoticesQuery, noticeIdParamSchema;
7424
- var init_chunk_FPSDNS2E = __esm({
7425
- "../../packages/core/dist/chunk-FPSDNS2E.js"() {
7426
- "use strict";
7427
- init_zod();
7428
- noticeSeveritySchema = external_exports.enum(["critical", "warn", "info"]);
7429
- noticeStatusSchema = external_exports.enum(["active", "resolved"]);
7430
- NOTICE_SCOPE_REGEX = /^(global|provider:[a-z0-9_-]{1,40}|service:[a-z0-9_-]{1,40})$/;
7431
- noticeScopeSchema = external_exports.string().regex(NOTICE_SCOPE_REGEX, "scope must be 'global', 'provider:<x>', or 'service:<x>'");
7432
- noticeLinkSchema = external_exports.string().url().refine((u) => /^https?:\/\//i.test(u), { message: "link must be an http(s) URL" });
7433
- createNoticeBody = external_exports.object({
7434
- severity: noticeSeveritySchema.default("info"),
7435
- scope: noticeScopeSchema.default("global"),
7436
- title: external_exports.string().trim().min(1).max(200),
7437
- body: external_exports.string().max(2e3).optional(),
7438
- link: noticeLinkSchema.optional(),
7439
- starts_at: external_exports.string().datetime().optional(),
7440
- ends_at: external_exports.string().datetime().optional()
7441
- });
7442
- updateNoticeBody = external_exports.object({
7443
- severity: noticeSeveritySchema.optional(),
7444
- scope: noticeScopeSchema.optional(),
7445
- title: external_exports.string().trim().min(1).max(200).optional(),
7446
- body: external_exports.string().max(2e3).nullable().optional(),
7447
- link: noticeLinkSchema.nullable().optional(),
7448
- starts_at: external_exports.string().datetime().optional(),
7449
- ends_at: external_exports.string().datetime().nullable().optional()
7450
- }).refine((b) => Object.keys(b).length > 0, { message: "at least one field must be provided" });
7451
- listNoticesQuery = external_exports.object({
7452
- status: noticeStatusSchema.optional(),
7453
- limit: external_exports.coerce.number().int().min(1).max(200).optional(),
7454
- offset: external_exports.coerce.number().int().min(0).optional()
7455
- });
7456
- noticeIdParamSchema = external_exports.object({ id: external_exports.string().min(1) });
7457
- }
7458
- });
7459
-
7460
- // ../../packages/core/dist/chunk-WEXVYJ5H.js
7461
- function containsKanbanPlaceholders(value) {
7462
- if (value == null) return false;
7463
- const serialized = typeof value === "string" ? value : JSON.stringify(value);
7464
- for (const token of PLACEHOLDER_TOKENS) {
7465
- if (serialized.includes(token)) return true;
7466
- }
7467
- return false;
7468
- }
7469
- function extractToolParameters(toolConfig) {
7470
- let cfg = toolConfig;
7471
- if (typeof cfg === "string") {
7472
- try {
7473
- cfg = JSON.parse(cfg);
7474
- } catch {
7475
- return void 0;
7476
- }
7477
- }
7478
- if (!cfg || typeof cfg !== "object" || Array.isArray(cfg)) return void 0;
7479
- return cfg.parameters;
7480
- }
7481
- function isRecord(v) {
7482
- return typeof v === "object" && v !== null && !Array.isArray(v);
7483
- }
7484
- function isPrimitive(v) {
7485
- return v === null || ["string", "number", "boolean"].includes(typeof v);
7486
- }
7487
- function typeMatches(typeField, allowed) {
7488
- if (typeof typeField === "string") return allowed.has(typeField);
7489
- if (Array.isArray(typeField)) return typeField.every((t) => typeof t === "string" && allowed.has(t));
7490
- return false;
7491
- }
7492
- function validateSchema(schema, path45, errors, opts = {}) {
7493
- if (typeof schema === "boolean") return;
7494
- const depth = opts.depth ?? 0;
7495
- if (depth > MAX_SCHEMA_DEPTH) {
7496
- errors.push({
7497
- path: path45 || "<root>",
7498
- message: `schema nesting exceeds ${MAX_SCHEMA_DEPTH} levels`,
7499
- suggestion: "Flatten the schema; LLM providers reject deeply nested tool input_schemas."
7500
- });
7501
- return;
7502
- }
7503
- if (!isRecord(schema)) {
7504
- errors.push({
7505
- path: path45,
7506
- message: `expected object, got ${schema === null ? "null" : typeof schema}`
7507
- });
7508
- return;
7509
- }
7510
- if (opts.isRoot) {
7511
- if ("type" in schema && schema.type !== "object") {
7512
- errors.push({
7513
- path: path45 ? `${path45}.type` : "type",
7514
- message: `root type must be 'object', got ${JSON.stringify(schema.type)}`,
7515
- suggestion: "Tool parameters at the root must be an object: `{ type: 'object', properties: { ... } }`."
7516
- });
7517
- }
7518
- } else if ("type" in schema && !typeMatches(schema.type, ALLOWED_TYPES)) {
7519
- errors.push({
7520
- path: `${path45}.type`,
7521
- message: `type must be one of ${[...ALLOWED_TYPES].join("/")} or an array of those, got ${JSON.stringify(schema.type)}`
7522
- });
7523
- }
7524
- if ("enum" in schema) {
7525
- const e = schema.enum;
7526
- if (typeof e === "string") {
7527
- const isPlaceholder = PLACEHOLDER_TOKENS.includes(e);
7528
- const isOutcomePlaceholder = e === "[KANBAN_OUTCOME_VALUES]";
7529
- errors.push({
7530
- path: `${path45}.enum`,
7531
- message: `enum must be a non-empty array of primitives, got string ${JSON.stringify(e)}`,
7532
- suggestion: isOutcomePlaceholder ? "Declare `outcomes` on the hub's terminal kanban status so the platform can render the placeholder into a valid array; with none configured the platform drops the parameter instead." : isPlaceholder ? "Set `operation: 'update_kanban_status'` on the tool and ensure at least one hub.kanban_status has `allowsAgentUpdate: true` so the platform can render the placeholder into a valid array." : 'Wrap the value in an array: `enum: ["value"]`.'
7533
- });
7534
- } else if (!Array.isArray(e)) {
7535
- errors.push({
7536
- path: `${path45}.enum`,
7537
- message: `enum must be a non-empty array of primitives, got ${typeof e}`
7538
- });
7539
- } else if (e.length === 0) {
7540
- errors.push({
7541
- path: `${path45}.enum`,
7542
- message: "enum must not be empty"
7543
- });
7544
- } else {
7545
- for (let i = 0; i < e.length; i++) {
7546
- if (!isPrimitive(e[i])) {
7547
- errors.push({
7548
- path: `${path45}.enum[${i}]`,
7549
- message: `enum entry must be a primitive (string/number/boolean/null), got ${typeof e[i]}`
7550
- });
7551
- }
7552
- }
7553
- }
7554
- }
7555
- for (const key of ["exclusiveMinimum", "exclusiveMaximum"]) {
7556
- if (key in schema && typeof schema[key] === "boolean") {
7557
- errors.push({
7558
- path: `${path45}.${key}`,
7559
- message: `${key} as boolean is draft-04 syntax; draft 2020-12 requires a numeric value`,
7560
- suggestion: `Replace with the numeric bound, e.g. \`${key}: 0\`.`
7561
- });
7562
- }
7112
+ for (const key of ["exclusiveMinimum", "exclusiveMaximum"]) {
7113
+ if (key in schema && typeof schema[key] === "boolean") {
7114
+ errors.push({
7115
+ path: `${path45}.${key}`,
7116
+ message: `${key} as boolean is draft-04 syntax; draft 2020-12 requires a numeric value`,
7117
+ suggestion: `Replace with the numeric bound, e.g. \`${key}: 0\`.`
7118
+ });
7119
+ }
7563
7120
  }
7564
7121
  if ("properties" in schema) {
7565
7122
  if (!isRecord(schema.properties)) {
@@ -7859,6 +7416,819 @@ var init_chunk_NZ6RQW6R = __esm({
7859
7416
  }
7860
7417
  });
7861
7418
 
7419
+ // ../../packages/core/dist/chunk-ZVXO3XL6.js
7420
+ 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;
7421
+ var init_chunk_ZVXO3XL6 = __esm({
7422
+ "../../packages/core/dist/chunk-ZVXO3XL6.js"() {
7423
+ "use strict";
7424
+ init_chunk_HZ6CADSY();
7425
+ init_zod();
7426
+ PEOPLE_CONTACT_PAGE_MAX = 100;
7427
+ PEOPLE_CONTACT_PAGE_DEFAULT = 50;
7428
+ PEOPLE_CONTACT_EMAIL_MAX_LENGTH = 254;
7429
+ peopleUserIdSchema = external_exports.string().max(64).regex(USER_ID_REGEX, "must be a user id");
7430
+ peopleInviteEmailSchema = external_exports.string().trim().max(PEOPLE_CONTACT_EMAIL_MAX_LENGTH).email();
7431
+ peopleContactInviteBody = external_exports.object({
7432
+ email: peopleInviteEmailSchema
7433
+ }).strict();
7434
+ peopleContactInviteIdParam = external_exports.object({ inviteId: uuidSchema });
7435
+ peopleContactUserIdParam = external_exports.object({ userId: peopleUserIdSchema });
7436
+ 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, {
7437
+ message: "Name a thread or a community, not both",
7438
+ path: ["community_id"]
7439
+ });
7440
+ peopleContactPageQuery = external_exports.object({
7441
+ cursor: external_exports.string().min(1).max(256).optional(),
7442
+ limit: external_exports.coerce.number().int().min(1).max(PEOPLE_CONTACT_PAGE_MAX).default(PEOPLE_CONTACT_PAGE_DEFAULT)
7443
+ });
7444
+ peopleOutgoingInviteSchema = external_exports.object({
7445
+ invite_id: uuidSchema,
7446
+ email: external_exports.string(),
7447
+ status: external_exports.literal("sent"),
7448
+ created_at: timestampSchema,
7449
+ expires_at: timestampSchema
7450
+ }).strict();
7451
+ peopleContactPersonSchema = external_exports.object({
7452
+ user_id: peopleUserIdSchema,
7453
+ display_name: external_exports.string().nullable(),
7454
+ email: external_exports.string().nullable()
7455
+ }).strict();
7456
+ peopleContactSchema = peopleContactPersonSchema.extend({ contact_since: timestampSchema, thread_id: uuidSchema }).strict();
7457
+ peopleIncomingInviteSchema = external_exports.object({
7458
+ invite_id: uuidSchema,
7459
+ inviter: peopleContactPersonSchema,
7460
+ created_at: timestampSchema,
7461
+ expires_at: timestampSchema
7462
+ }).strict();
7463
+ peopleBlockedUserSchema = peopleContactPersonSchema.extend({ blocked_at: timestampSchema, deleted_user: external_exports.boolean() }).strict();
7464
+ }
7465
+ });
7466
+
7467
+ // ../../packages/core/dist/chunk-ZXK6N2HN.js
7468
+ 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;
7469
+ var init_chunk_ZXK6N2HN = __esm({
7470
+ "../../packages/core/dist/chunk-ZXK6N2HN.js"() {
7471
+ "use strict";
7472
+ init_chunk_ZVXO3XL6();
7473
+ init_chunk_HZ6CADSY();
7474
+ init_zod();
7475
+ PEOPLE_MODERATION_NOTE_MAX_LENGTH = 500;
7476
+ ADMIN_PEOPLE_REPORTS_PAGE_MAX = 100;
7477
+ ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT = 50;
7478
+ PEOPLE_SUSPENDED_REASON = "suspended";
7479
+ peopleModerationActionSchema = external_exports.enum(["remove_message", "suspend", "unsuspend", "dismiss"]);
7480
+ moderationNoteSchema = optionalTrimmedText(PEOPLE_MODERATION_NOTE_MAX_LENGTH);
7481
+ adminPeopleReportListQuery = external_exports.object({
7482
+ pending: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true"),
7483
+ /** Lower bound on `created_at`. */
7484
+ since: timestampSchema.optional(),
7485
+ limit: external_exports.coerce.number().int().min(1).max(ADMIN_PEOPLE_REPORTS_PAGE_MAX).default(ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT),
7486
+ offset: external_exports.coerce.number().int().min(0).default(0)
7487
+ });
7488
+ adminPeopleReportIdParam = external_exports.object({ reportId: uuidSchema });
7489
+ adminPeopleMessageRemovalBody = external_exports.object({ report_id: uuidSchema, message_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
7490
+ adminPeopleSuspendBody = external_exports.object({ report_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
7491
+ adminPeopleNoteBody = external_exports.object({ note: moderationNoteSchema }).strict();
7492
+ }
7493
+ });
7494
+
7495
+ // ../../packages/core/dist/chunk-Y7CFCYX4.js
7496
+ var PEOPLE_REPORT_DETAILS_MAX_LENGTH, peopleReportReasonSchema, reportDetailsSchema, reportFields, peopleReportBody;
7497
+ var init_chunk_Y7CFCYX4 = __esm({
7498
+ "../../packages/core/dist/chunk-Y7CFCYX4.js"() {
7499
+ "use strict";
7500
+ init_chunk_ZVXO3XL6();
7501
+ init_chunk_HZ6CADSY();
7502
+ init_zod();
7503
+ PEOPLE_REPORT_DETAILS_MAX_LENGTH = 500;
7504
+ peopleReportReasonSchema = external_exports.enum(["spam", "harassment", "hate", "sexual", "violence", "other"]);
7505
+ reportDetailsSchema = optionalTrimmedText(PEOPLE_REPORT_DETAILS_MAX_LENGTH);
7506
+ reportFields = { reason: peopleReportReasonSchema, details: reportDetailsSchema };
7507
+ peopleReportBody = external_exports.discriminatedUnion("target", [
7508
+ external_exports.object({ target: external_exports.literal("message"), thread_id: uuidSchema, message_id: uuidSchema, ...reportFields }).strict(),
7509
+ external_exports.object({ target: external_exports.literal("thread"), thread_id: uuidSchema, ...reportFields }).strict(),
7510
+ external_exports.object({ target: external_exports.literal("user"), user_id: peopleUserIdSchema, thread_id: uuidSchema.optional(), ...reportFields }).strict(),
7511
+ external_exports.object({
7512
+ target: external_exports.literal("community_message"),
7513
+ community_id: uuidSchema,
7514
+ room_id: uuidSchema,
7515
+ message_id: uuidSchema,
7516
+ ...reportFields
7517
+ }).strict(),
7518
+ external_exports.object({ target: external_exports.literal("community_member"), community_id: uuidSchema, user_id: peopleUserIdSchema, ...reportFields }).strict()
7519
+ ]);
7520
+ }
7521
+ });
7522
+
7523
+ // ../../packages/core/dist/chunk-2YEGUQR7.js
7524
+ var PERSON_ID_PATTERN, CONTACT_PERSON_ID_PATTERN, PERSON_ID_FORM_MESSAGE, userPersonIdSchema, personIdSchema;
7525
+ var init_chunk_2YEGUQR7 = __esm({
7526
+ "../../packages/core/dist/chunk-2YEGUQR7.js"() {
7527
+ "use strict";
7528
+ init_zod();
7529
+ PERSON_ID_PATTERN = /^prs_[a-z2-7]{52}$/;
7530
+ CONTACT_PERSON_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
7531
+ PERSON_ID_FORM_MESSAGE = "Must be a person id (prs_\u2026) or a contact id (a lowercase UUID)";
7532
+ userPersonIdSchema = external_exports.string().regex(PERSON_ID_PATTERN, { message: "Must be a person id (prs_\u2026)" });
7533
+ personIdSchema = external_exports.string().refine(
7534
+ (value) => PERSON_ID_PATTERN.test(value) || CONTACT_PERSON_ID_PATTERN.test(value),
7535
+ { message: PERSON_ID_FORM_MESSAGE }
7536
+ );
7537
+ }
7538
+ });
7539
+
7540
+ // ../../packages/core/dist/chunk-UAOHHCW5.js
7541
+ function normalizeContactPhone(raw) {
7542
+ const compact = raw.trim().replace(/[\s\-.()]/g, "");
7543
+ const withPlus = compact.startsWith("00") ? `+${compact.slice(2)}` : compact;
7544
+ return /^\+[1-9]\d{7,14}$/.test(withPlus) ? withPlus : null;
7545
+ }
7546
+ function normalizeContactLabel(raw) {
7547
+ return raw.trim().replace(/\s+/g, " ").toLowerCase();
7548
+ }
7549
+ function importRowLabels(row, batchLabels) {
7550
+ return [.../* @__PURE__ */ new Set([...row.labels ?? [], ...batchLabels ?? []])];
7551
+ }
7552
+ 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;
7553
+ var init_chunk_UAOHHCW5 = __esm({
7554
+ "../../packages/core/dist/chunk-UAOHHCW5.js"() {
7555
+ "use strict";
7556
+ init_zod();
7557
+ CONTACT_ENVIRONMENTS = ["production", "preview", "all"];
7558
+ CONTACT_NAME_MAX = 200;
7559
+ CONTACT_EMAIL_MAX = 320;
7560
+ CONTACT_PHONE_INPUT_MAX = 40;
7561
+ CONTACT_INSTAGRAM_SID_MAX = 64;
7562
+ CONTACT_METADATA_MAX_BYTES = 4096;
7563
+ CONTACT_LABEL_MAX = 64;
7564
+ CONTACT_LABELS_MAX = 20;
7565
+ CONTACT_SCOPE_TAGS_MAX = 20;
7566
+ CONTACT_PAGE_MAX = 100;
7567
+ CONTACT_IMPORT_BATCH_MAX = 500;
7568
+ CONTACT_SEARCH_MAX = 100;
7569
+ CONTACT_LIST_NAME_MAX = 64;
7570
+ CONTACT_LIST_NAME_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
7571
+ CONTACT_LIST_DESCRIPTION_MAX = 1e3;
7572
+ CONTACT_LIST_FILTER_MAX = 20;
7573
+ CONTACT_LIST_PINS_PER_REQUEST_MAX = 100;
7574
+ SUPPRESSION_SCOPES = ["all", "marketing"];
7575
+ SUPPRESSION_ID_REGEX = /^[0-9a-f]{64}$/;
7576
+ contactName = external_exports.string().trim().min(1).max(CONTACT_NAME_MAX);
7577
+ contactPhone = external_exports.string().max(CONTACT_PHONE_INPUT_MAX).transform((raw, ctx) => {
7578
+ const phone = normalizeContactPhone(raw);
7579
+ if (phone === null) {
7580
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Phone must be an international number, e.g. +5511999999999" });
7581
+ return external_exports.NEVER;
7582
+ }
7583
+ return phone;
7584
+ });
7585
+ contactEmail = external_exports.string().trim().toLowerCase().max(CONTACT_EMAIL_MAX).email();
7586
+ contactInstagramSid = external_exports.string().trim().min(1).max(CONTACT_INSTAGRAM_SID_MAX);
7587
+ 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");
7588
+ contactLabels = external_exports.array(contactLabel).max(CONTACT_LABELS_MAX).transform((labels) => [...new Set(labels)]);
7589
+ contactMetadata = external_exports.record(external_exports.unknown()).refine((metadata) => {
7590
+ try {
7591
+ return new TextEncoder().encode(JSON.stringify(metadata)).length <= CONTACT_METADATA_MAX_BYTES;
7592
+ } catch {
7593
+ return false;
7594
+ }
7595
+ }, `Metadata must serialize to at most ${CONTACT_METADATA_MAX_BYTES} bytes`);
7596
+ scopeTagIds = external_exports.array(external_exports.string().uuid()).min(1).max(CONTACT_SCOPE_TAGS_MAX).transform((ids) => [...new Set(ids)]);
7597
+ contactVisibilitySchema = external_exports.discriminatedUnion("scope", [
7598
+ external_exports.object({ scope: external_exports.literal("all_hubs") }).strict(),
7599
+ external_exports.object({ scope: external_exports.literal("tags"), tag_ids: scopeTagIds }).strict()
7600
+ ]);
7601
+ hasIdentity = (row) => Boolean(row.phone || row.email || row.instagram_sid);
7602
+ IDENTITY_REQUIRED = "A contact needs a phone, an email or an Instagram id";
7603
+ contactBookOrgQuery = external_exports.object({
7604
+ organization_id: external_exports.string().uuid()
7605
+ });
7606
+ contactBookContactParam = external_exports.object({
7607
+ contactId: external_exports.string().uuid()
7608
+ });
7609
+ contactBookListParam = external_exports.object({
7610
+ listId: external_exports.string().uuid()
7611
+ });
7612
+ contactBookHubParam = external_exports.object({
7613
+ hubId: external_exports.string().uuid()
7614
+ });
7615
+ contactBookPageQuery = external_exports.object({
7616
+ cursor: external_exports.string().max(2048).optional(),
7617
+ limit: external_exports.coerce.number().int().min(1).max(CONTACT_PAGE_MAX).default(50)
7618
+ });
7619
+ listContactBookContactsQuery = contactBookOrgQuery.merge(contactBookPageQuery).extend({
7620
+ q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional(),
7621
+ label: external_exports.string().max(CONTACT_LABEL_MAX).transform(normalizeContactLabel).optional(),
7622
+ scope_tag_id: external_exports.string().uuid().optional()
7623
+ });
7624
+ listHubContactBookContactsQuery = contactBookPageQuery.extend({
7625
+ q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional()
7626
+ });
7627
+ contactBookLinkCandidatesQuery = contactBookOrgQuery.extend({
7628
+ email: contactEmail
7629
+ });
7630
+ listContactBookListMembersQuery = contactBookOrgQuery.merge(contactBookPageQuery);
7631
+ contactRowFields = {
7632
+ name: contactName,
7633
+ phone: contactPhone.nullish(),
7634
+ email: contactEmail.nullish(),
7635
+ instagram_sid: contactInstagramSid.nullish(),
7636
+ labels: contactLabels.optional(),
7637
+ metadata: contactMetadata.optional()
7638
+ };
7639
+ createContactBookContactBody = external_exports.object({
7640
+ organization_id: external_exports.string().uuid(),
7641
+ ...contactRowFields,
7642
+ visibility: contactVisibilitySchema,
7643
+ environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
7644
+ }).strict().refine(hasIdentity, IDENTITY_REQUIRED);
7645
+ updateContactBookContactBody = external_exports.object({
7646
+ name: contactName.optional(),
7647
+ phone: contactPhone.nullable().optional(),
7648
+ email: contactEmail.nullable().optional(),
7649
+ instagram_sid: contactInstagramSid.nullable().optional(),
7650
+ labels: contactLabels.optional(),
7651
+ metadata: contactMetadata.optional(),
7652
+ visibility: contactVisibilitySchema.optional(),
7653
+ environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
7654
+ }).strict();
7655
+ contactImportRowSchema = external_exports.object(contactRowFields).strict().refine(hasIdentity, IDENTITY_REQUIRED);
7656
+ importContactBookContactsBody = external_exports.object({
7657
+ organization_id: external_exports.string().uuid(),
7658
+ visibility: contactVisibilitySchema,
7659
+ environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional(),
7660
+ labels: contactLabels.optional(),
7661
+ rows: external_exports.array(contactImportRowSchema).min(1).max(CONTACT_IMPORT_BATCH_MAX)
7662
+ }).strict().superRefine((batch, ctx) => {
7663
+ batch.rows.forEach((row, index) => {
7664
+ if (importRowLabels(row, batch.labels).length > CONTACT_LABELS_MAX) {
7665
+ ctx.addIssue({
7666
+ code: external_exports.ZodIssueCode.custom,
7667
+ path: ["rows", index, "labels"],
7668
+ message: `A contact holds at most ${CONTACT_LABELS_MAX} labels, the batch's included`
7669
+ });
7670
+ }
7671
+ });
7672
+ });
7673
+ linkContactBookContactBody = external_exports.object({
7674
+ user_id: external_exports.string().min(1).max(128)
7675
+ }).strict();
7676
+ listName = external_exports.string().trim().min(1).max(CONTACT_LIST_NAME_MAX).regex(CONTACT_LIST_NAME_REGEX, {
7677
+ message: 'Must be lowercase alphanumeric with hyphens (e.g. "vip-customers")'
7678
+ });
7679
+ contactListFilterSchema = external_exports.object({
7680
+ labels: external_exports.array(contactLabel).max(CONTACT_LIST_FILTER_MAX).transform((l) => [...new Set(l)]).default([]),
7681
+ scope_tag_ids: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_FILTER_MAX).transform((t) => [...new Set(t)]).default([])
7682
+ }).strict();
7683
+ createContactBookListBody = external_exports.object({
7684
+ organization_id: external_exports.string().uuid(),
7685
+ name: listName,
7686
+ description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullish(),
7687
+ filter: contactListFilterSchema.optional()
7688
+ }).strict();
7689
+ updateContactBookListBody = external_exports.object({
7690
+ name: listName.optional(),
7691
+ description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullable().optional(),
7692
+ filter: contactListFilterSchema.optional()
7693
+ }).strict();
7694
+ updateContactBookListPinsBody = external_exports.object({
7695
+ add: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([]),
7696
+ remove: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([])
7697
+ }).strict().refine((b) => b.add.length + b.remove.length > 0, "Add or remove at least one contact");
7698
+ suppressionIdentitySchema = external_exports.discriminatedUnion("kind", [
7699
+ external_exports.object({ kind: external_exports.literal("phone"), value: contactPhone }).strict(),
7700
+ external_exports.object({ kind: external_exports.literal("email"), value: contactEmail }).strict(),
7701
+ external_exports.object({ kind: external_exports.literal("instagram"), value: contactInstagramSid }).strict()
7702
+ ]);
7703
+ createContactBookSuppressionBody = external_exports.object({
7704
+ organization_id: external_exports.string().uuid(),
7705
+ identity: suppressionIdentitySchema,
7706
+ scope: external_exports.enum(SUPPRESSION_SCOPES)
7707
+ }).strict();
7708
+ contactBookSuppressionParam = external_exports.object({
7709
+ suppressionId: external_exports.string().regex(SUPPRESSION_ID_REGEX)
7710
+ });
7711
+ listContactBookSuppressionsQuery = contactBookOrgQuery.merge(contactBookPageQuery);
7712
+ contactBookEmailUnsubscribeTokenSchema = external_exports.string().max(200).regex(/^[0-9a-f-]{36}\.[0-9a-f]{64}\.[0-9a-f]{64}$/i);
7713
+ contactBookEmailUnsubscribeQuery = external_exports.object({ token: contactBookEmailUnsubscribeTokenSchema });
7714
+ orgListReferenceSchema = listName;
7715
+ }
7716
+ });
7717
+
7718
+ // ../../packages/core/dist/chunk-MGBAXT5Y.js
7719
+ var PERSON_LINKS_MAX, PERSON_DENY_PAGE_MAX, personParam, personLinkParam, deniedPersonParam, listDeniedPersonsQuery, conversationCustomerPersonParam;
7720
+ var init_chunk_MGBAXT5Y = __esm({
7721
+ "../../packages/core/dist/chunk-MGBAXT5Y.js"() {
7722
+ "use strict";
7723
+ init_chunk_2YEGUQR7();
7724
+ init_chunk_UAOHHCW5();
7725
+ init_zod();
7726
+ PERSON_LINKS_MAX = 15;
7727
+ PERSON_DENY_PAGE_MAX = 100;
7728
+ personParam = external_exports.object({
7729
+ personId: userPersonIdSchema
7730
+ });
7731
+ personLinkParam = personParam.extend({
7732
+ targetId: personIdSchema
7733
+ });
7734
+ deniedPersonParam = external_exports.object({
7735
+ personId: personIdSchema
7736
+ });
7737
+ listDeniedPersonsQuery = contactBookOrgQuery.extend({
7738
+ cursor: personIdSchema.optional(),
7739
+ limit: external_exports.coerce.number().int().min(1).max(PERSON_DENY_PAGE_MAX).default(50)
7740
+ });
7741
+ conversationCustomerPersonParam = external_exports.object({
7742
+ hubId: external_exports.string().uuid(),
7743
+ conversationId: external_exports.string().uuid()
7744
+ });
7745
+ }
7746
+ });
7747
+
7748
+ // ../../packages/core/dist/chunk-YUZFHVB2.js
7749
+ var invitePreviewQuery, inviteRolePreviewResponse, inviteContactPreviewResponse, invitePreviewResponse, inviteUnsubscribeBody;
7750
+ var init_chunk_YUZFHVB2 = __esm({
7751
+ "../../packages/core/dist/chunk-YUZFHVB2.js"() {
7752
+ "use strict";
7753
+ init_zod();
7754
+ invitePreviewQuery = external_exports.object({
7755
+ token: external_exports.string().min(1).max(2048)
7756
+ });
7757
+ inviteRolePreviewResponse = external_exports.object({
7758
+ inviter_name: external_exports.string(),
7759
+ entity_id: external_exports.string().uuid(),
7760
+ entity_name: external_exports.string(),
7761
+ entity_type: external_exports.enum(["org", "hub"]),
7762
+ role: external_exports.enum(["org_admin", "admin", "team_user", "user"]),
7763
+ expires_at: external_exports.string().datetime()
7764
+ });
7765
+ inviteContactPreviewResponse = external_exports.object({
7766
+ inviter_name: external_exports.string().nullable(),
7767
+ entity_id: external_exports.string().uuid(),
7768
+ entity_type: external_exports.literal("contact"),
7769
+ role: external_exports.literal("contact"),
7770
+ expires_at: external_exports.string().datetime()
7771
+ });
7772
+ invitePreviewResponse = external_exports.union([inviteRolePreviewResponse, inviteContactPreviewResponse]);
7773
+ inviteUnsubscribeBody = external_exports.object({ token: external_exports.string().min(1).max(256) }).strict();
7774
+ }
7775
+ });
7776
+
7777
+ // ../../packages/core/dist/chunk-I3O2RACG.js
7778
+ var managedAgentsWebhookParams, MANAGED_AGENTS_WEBHOOK_BODY_MAX_BYTES;
7779
+ var init_chunk_I3O2RACG = __esm({
7780
+ "../../packages/core/dist/chunk-I3O2RACG.js"() {
7781
+ "use strict";
7782
+ init_zod();
7783
+ managedAgentsWebhookParams = external_exports.object({
7784
+ hub_id: external_exports.string().uuid(),
7785
+ connection_id: external_exports.string().uuid()
7786
+ });
7787
+ MANAGED_AGENTS_WEBHOOK_BODY_MAX_BYTES = 16 * 1024;
7788
+ }
7789
+ });
7790
+
7791
+ // ../../packages/core/dist/chunk-6J742GLA.js
7792
+ var PEOPLE_THREAD_MESSAGE_MAX_LENGTH, PEOPLE_THREAD_MESSAGES_PAGE_MAX, PEOPLE_THREAD_PAGE_MAX, PEOPLE_THREAD_PAGE_DEFAULT, PEOPLE_GROUP_NAME_MAX_LENGTH, PEOPLE_GROUP_AVATAR_URL_MAX_LENGTH, PEOPLE_THREAD_ATTACHMENT_MAX_BYTES, PEOPLE_THREAD_ATTACHMENT_NAME_MAX_LENGTH, PEOPLE_ATTACHMENT_STORAGE_PER_USER_BYTES, PEOPLE_THREAD_ATTACHMENT_MAX_MB, PEOPLE_THREAD_ATTACHMENT_URL_TTL_SECONDS, PEOPLE_THREAD_ATTACHMENT_URLS_MAX, peopleThreadIdParam, peopleThreadMessageIdParam, peopleThreadListQuery, peopleThreadMessagesQuery, peopleThreadAttachmentUploadSchema, peopleThreadSendBody, peopleThreadAttachmentUrlsBody, peopleThreadReadBody, peopleThreadSettingsBody, peopleGroupNameSchema, peopleGroupAvatarUrlSchema, peopleGroupCreateBody, peopleOrgDirectBody, peopleGroupUpdateBody, peopleGroupInviteBody, peopleOrgErasureBody, peopleGroupLeaveBody, peopleGroupInviteIdParam, peopleGroupIncomingInviteIdParam, peopleGroupMemberParam, peopleThreadKindSchema, peopleThreadMemberSchema, peopleThreadLastMessageSchema, peopleGroupRoleSchema, peopleGroupSummarySchema, peopleThreadSummarySchema, peopleThreadAttachmentSchema, peopleThreadMessageSchema, peopleGroupMemberSchema, peopleGroupSentInviteSchema, peopleGroupIncomingInviteSchema;
7793
+ var init_chunk_6J742GLA = __esm({
7794
+ "../../packages/core/dist/chunk-6J742GLA.js"() {
7795
+ "use strict";
7796
+ init_chunk_ZVXO3XL6();
7797
+ init_chunk_HZ6CADSY();
7798
+ init_zod();
7799
+ PEOPLE_THREAD_MESSAGE_MAX_LENGTH = 4e3;
7800
+ PEOPLE_THREAD_MESSAGES_PAGE_MAX = 50;
7801
+ PEOPLE_THREAD_PAGE_MAX = 100;
7802
+ PEOPLE_THREAD_PAGE_DEFAULT = 50;
7803
+ PEOPLE_GROUP_NAME_MAX_LENGTH = 100;
7804
+ PEOPLE_GROUP_AVATAR_URL_MAX_LENGTH = 2048;
7805
+ PEOPLE_THREAD_ATTACHMENT_MAX_BYTES = 7 * 1024 * 1024;
7806
+ PEOPLE_THREAD_ATTACHMENT_NAME_MAX_LENGTH = 255;
7807
+ PEOPLE_ATTACHMENT_STORAGE_PER_USER_BYTES = 1024 * 1024 * 1024;
7808
+ PEOPLE_THREAD_ATTACHMENT_MAX_MB = Math.floor(PEOPLE_THREAD_ATTACHMENT_MAX_BYTES / (1024 * 1024));
7809
+ PEOPLE_THREAD_ATTACHMENT_URL_TTL_SECONDS = 15 * 60;
7810
+ PEOPLE_THREAD_ATTACHMENT_URLS_MAX = PEOPLE_THREAD_MESSAGES_PAGE_MAX;
7811
+ peopleThreadIdParam = external_exports.object({ threadId: uuidSchema });
7812
+ peopleThreadMessageIdParam = external_exports.object({ threadId: uuidSchema, messageId: uuidSchema });
7813
+ peopleThreadListQuery = external_exports.object({
7814
+ cursor: external_exports.string().min(1).max(256).optional(),
7815
+ limit: external_exports.coerce.number().int().min(1).max(PEOPLE_THREAD_PAGE_MAX).default(PEOPLE_THREAD_PAGE_DEFAULT)
7816
+ });
7817
+ peopleThreadMessagesQuery = external_exports.object({
7818
+ before_seq: external_exports.coerce.number().int().min(1).optional(),
7819
+ limit: external_exports.coerce.number().int().min(1).max(PEOPLE_THREAD_MESSAGES_PAGE_MAX).default(PEOPLE_THREAD_MESSAGES_PAGE_MAX)
7820
+ });
7821
+ peopleThreadAttachmentUploadSchema = external_exports.object({
7822
+ file_name: external_exports.string().trim().min(1).max(PEOPLE_THREAD_ATTACHMENT_NAME_MAX_LENGTH),
7823
+ file_binary: external_exports.string().min(1)
7824
+ }).strict();
7825
+ peopleThreadSendBody = external_exports.object({
7826
+ body: external_exports.string().max(PEOPLE_THREAD_MESSAGE_MAX_LENGTH).default(""),
7827
+ client_message_id: uuidSchema.optional(),
7828
+ attachment: peopleThreadAttachmentUploadSchema.optional()
7829
+ }).strict().refine((b) => b.body.trim().length > 0 || b.attachment !== void 0, {
7830
+ message: "must not be empty",
7831
+ path: ["body"]
7832
+ });
7833
+ peopleThreadAttachmentUrlsBody = external_exports.object({ attachment_ids: external_exports.array(uuidSchema).min(1).max(PEOPLE_THREAD_ATTACHMENT_URLS_MAX) }).strict();
7834
+ peopleThreadReadBody = external_exports.object({ seq: external_exports.number().int().min(0) }).strict();
7835
+ peopleThreadSettingsBody = external_exports.object({
7836
+ muted: external_exports.boolean().optional(),
7837
+ hidden: external_exports.boolean().optional()
7838
+ }).strict().refine((b) => b.muted !== void 0 || b.hidden !== void 0, "nothing to change");
7839
+ peopleGroupNameSchema = external_exports.string().trim().min(1).max(PEOPLE_GROUP_NAME_MAX_LENGTH);
7840
+ peopleGroupAvatarUrlSchema = external_exports.string().max(PEOPLE_GROUP_AVATAR_URL_MAX_LENGTH).url().refine((s) => s.startsWith("https://"), "must be an https URL");
7841
+ peopleGroupCreateBody = external_exports.object({
7842
+ name: peopleGroupNameSchema,
7843
+ avatar_url: peopleGroupAvatarUrlSchema.nullable().optional(),
7844
+ org_id: uuidSchema.optional()
7845
+ }).strict();
7846
+ peopleOrgDirectBody = external_exports.object({
7847
+ org_id: uuidSchema,
7848
+ user_id: peopleUserIdSchema
7849
+ }).strict();
7850
+ peopleGroupUpdateBody = external_exports.object({
7851
+ name: peopleGroupNameSchema.optional(),
7852
+ avatar_url: peopleGroupAvatarUrlSchema.nullable().optional()
7853
+ }).strict().refine((b) => b.name !== void 0 || b.avatar_url !== void 0, "nothing to change");
7854
+ peopleGroupInviteBody = external_exports.union([
7855
+ external_exports.object({ user_id: peopleUserIdSchema }).strict(),
7856
+ external_exports.object({ email: peopleInviteEmailSchema }).strict()
7857
+ ]);
7858
+ peopleOrgErasureBody = external_exports.object({
7859
+ org_id: uuidSchema,
7860
+ email: peopleInviteEmailSchema
7861
+ }).strict();
7862
+ peopleGroupLeaveBody = external_exports.object({ delete_my_messages: external_exports.boolean().optional() }).strict();
7863
+ peopleGroupInviteIdParam = external_exports.object({ threadId: uuidSchema, inviteId: uuidSchema });
7864
+ peopleGroupIncomingInviteIdParam = external_exports.object({ inviteId: uuidSchema });
7865
+ peopleGroupMemberParam = external_exports.object({ threadId: uuidSchema, userId: peopleUserIdSchema });
7866
+ peopleThreadKindSchema = external_exports.enum(["dm", "group"]);
7867
+ peopleThreadMemberSchema = external_exports.object({
7868
+ user_id: peopleUserIdSchema,
7869
+ display_name: external_exports.string().nullable(),
7870
+ deleted_user: external_exports.boolean()
7871
+ }).strict();
7872
+ peopleThreadLastMessageSchema = external_exports.object({
7873
+ message_id: uuidSchema,
7874
+ seq: external_exports.number().int().positive(),
7875
+ author_user_id: peopleUserIdSchema,
7876
+ preview: external_exports.string().nullable(),
7877
+ deleted: external_exports.boolean(),
7878
+ created_at: timestampSchema
7879
+ }).strict();
7880
+ peopleGroupRoleSchema = external_exports.enum(["admin", "member"]);
7881
+ peopleGroupSummarySchema = external_exports.object({
7882
+ membership: external_exports.enum(["member", "removed", "left"]),
7883
+ role: peopleGroupRoleSchema.nullable(),
7884
+ avatar_url: external_exports.string().nullable()
7885
+ }).strict();
7886
+ peopleThreadSummarySchema = external_exports.object({
7887
+ thread_id: uuidSchema,
7888
+ kind: peopleThreadKindSchema,
7889
+ org_id: external_exports.string().nullable(),
7890
+ org_name: external_exports.string().nullable(),
7891
+ title: external_exports.string().nullable(),
7892
+ counterpart: peopleThreadMemberSchema.nullable(),
7893
+ last_seq: external_exports.number().int().nonnegative(),
7894
+ last_message: peopleThreadLastMessageSchema.nullable(),
7895
+ last_activity_at: timestampSchema,
7896
+ read_seq: external_exports.number().int().nonnegative(),
7897
+ unread_count: external_exports.number().int().nonnegative(),
7898
+ muted: external_exports.boolean(),
7899
+ hidden: external_exports.boolean(),
7900
+ writable: external_exports.boolean(),
7901
+ group: peopleGroupSummarySchema.nullable().optional(),
7902
+ version: external_exports.number().int().nonnegative().optional()
7903
+ }).strict();
7904
+ peopleThreadAttachmentSchema = external_exports.object({
7905
+ attachment_id: uuidSchema,
7906
+ file_name: external_exports.string(),
7907
+ content_type: external_exports.string(),
7908
+ size_bytes: external_exports.number().int().positive()
7909
+ }).strict();
7910
+ peopleThreadMessageSchema = external_exports.object({
7911
+ message_id: uuidSchema,
7912
+ seq: external_exports.number().int().positive(),
7913
+ author_user_id: peopleUserIdSchema,
7914
+ body: external_exports.string().nullable(),
7915
+ deleted: external_exports.boolean(),
7916
+ created_at: timestampSchema,
7917
+ deleted_at: timestampSchema.nullable(),
7918
+ client_message_id: uuidSchema.nullable(),
7919
+ attachment: peopleThreadAttachmentSchema.nullable().optional()
7920
+ }).strict();
7921
+ peopleGroupMemberSchema = peopleThreadMemberSchema.extend({ role: peopleGroupRoleSchema, joined_at: timestampSchema }).strict();
7922
+ peopleGroupSentInviteSchema = external_exports.object({
7923
+ invite_id: uuidSchema,
7924
+ invitee: peopleThreadMemberSchema,
7925
+ invitee_email: external_exports.string().nullable().optional(),
7926
+ status: external_exports.literal("sent"),
7927
+ created_at: timestampSchema,
7928
+ expires_at: timestampSchema
7929
+ }).strict();
7930
+ peopleGroupIncomingInviteSchema = external_exports.object({
7931
+ invite_id: uuidSchema,
7932
+ thread_id: uuidSchema,
7933
+ kind: peopleThreadKindSchema.optional(),
7934
+ group: external_exports.object({ name: external_exports.string() }).strict(),
7935
+ org: external_exports.object({ org_id: external_exports.string(), org_name: external_exports.string().nullable() }).strict().nullable().optional(),
7936
+ inviter: external_exports.object({ user_id: peopleUserIdSchema, display_name: external_exports.string().nullable(), email: external_exports.string().nullable() }).strict(),
7937
+ created_at: timestampSchema,
7938
+ expires_at: timestampSchema
7939
+ }).strict();
7940
+ }
7941
+ });
7942
+
7943
+ // ../../packages/core/dist/chunk-6AYIXGDT.js
7944
+ 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;
7945
+ var init_chunk_6AYIXGDT = __esm({
7946
+ "../../packages/core/dist/chunk-6AYIXGDT.js"() {
7947
+ "use strict";
7948
+ init_chunk_UAOHHCW5();
7949
+ init_chunk_6J742GLA();
7950
+ init_chunk_ZVXO3XL6();
7951
+ init_chunk_HZ6CADSY();
7952
+ init_zod();
7953
+ COMMUNITIES_PER_ORG_MAX = 10;
7954
+ COMMUNITY_NAME_MAX_LENGTH = 100;
7955
+ COMMUNITY_REGISTRY_CLOSED_REASON = "community_registry_closed";
7956
+ COMMUNITY_MEMBERS_MAX = 1e4;
7957
+ COMMUNITY_ADMISSIONS = ["link", "invite"];
7958
+ COMMUNITY_ACCESS_MAX = COMMUNITY_MEMBERS_MAX;
7959
+ COMMUNITY_ACCESS_ADD_MAX = 500;
7960
+ COMMUNITY_ACCESS_FULL_REASON = "community_access_full";
7961
+ COMMUNITY_JOIN_SOURCE_MAX_LENGTH = 32;
7962
+ COMMUNITY_JOIN_FLOW_TOKEN_MAX_LENGTH = 128;
7963
+ COMMUNITY_ROOMS_MAX = 20;
7964
+ COMMUNITY_ROOM_NAME_MAX_LENGTH = 100;
7965
+ COMMUNITY_MESSAGE_MAX_LENGTH = 4e3;
7966
+ COMMUNITY_MESSAGES_PAGE_SIZE = 50;
7967
+ COMMUNITY_ATTACHMENT_URLS_MAX = COMMUNITY_MESSAGES_PAGE_SIZE + 2;
7968
+ COMMUNITY_POST_TITLE_MAX_LENGTH = 200;
7969
+ COMMUNITY_POST_SEARCH_MAX_LENGTH = 100;
7970
+ COMMUNITY_MEMBER_STATUSES = ["active", "left", "removed", "banned"];
7971
+ COMMUNITY_RULES_MAX_LENGTH = 4e3;
7972
+ COMMUNITY_SLOW_MODE_MAX_SECONDS = 21600;
7973
+ COMMUNITY_COURSES_LABEL_MAX_LENGTH = 16;
7974
+ COMMUNITY_LIVE_TICKET_PREFIX = "cst";
7975
+ COMMUNITY_STATS_DAYS = 30;
7976
+ communityNameSchema = external_exports.string().trim().min(1).max(COMMUNITY_NAME_MAX_LENGTH);
7977
+ adminCreateCommunityBody = external_exports.object({ org_id: uuidSchema, name: communityNameSchema }).strict();
7978
+ communityIdParam = external_exports.object({ communityId: uuidSchema });
7979
+ communityJoinTokenSchema = external_exports.string().regex(/^[0-9a-f]{32}$/);
7980
+ communityJoinSourceSchema = external_exports.string().regex(new RegExp(`^[a-z0-9_-]{1,${COMMUNITY_JOIN_SOURCE_MAX_LENGTH}}$`));
7981
+ communityJoinPreviewQuery = external_exports.object({ c: uuidSchema, k: communityJoinTokenSchema });
7982
+ communityJoinBody = external_exports.object({
7983
+ token: communityJoinTokenSchema,
7984
+ src: communityJoinSourceSchema.optional(),
7985
+ flow_token: external_exports.string().max(COMMUNITY_JOIN_FLOW_TOKEN_MAX_LENGTH).optional()
7986
+ }).strict();
7987
+ communityRoomKindSchema = external_exports.enum(["discussion", "forum", "announcements"]);
7988
+ communityRoomNameSchema = external_exports.string().trim().min(1).max(COMMUNITY_ROOM_NAME_MAX_LENGTH);
7989
+ communityRoomIdParam = external_exports.object({ communityId: uuidSchema, roomId: uuidSchema });
7990
+ communityMessageIdParam = external_exports.object({ communityId: uuidSchema, roomId: uuidSchema, messageId: uuidSchema });
7991
+ communityRoomCreateBody = external_exports.object({ kind: communityRoomKindSchema, name: communityRoomNameSchema, client_id: uuidSchema.optional() }).strict();
7992
+ communityRoomUpdateBody = external_exports.object({ name: communityRoomNameSchema.optional(), archived: external_exports.boolean().optional() }).strict().refine((b) => b.name !== void 0 || b.archived !== void 0, "nothing to change");
7993
+ communityMessagesQuery = external_exports.object({
7994
+ before: external_exports.coerce.number().int().min(1).optional(),
7995
+ after: external_exports.coerce.number().int().min(0).optional()
7996
+ }).refine((q) => q.before === void 0 || q.after === void 0, "before and after cannot be combined");
7997
+ communityMessageBodySchema = external_exports.string().max(COMMUNITY_MESSAGE_MAX_LENGTH).refine((body) => body.trim().length > 0, "must not be empty");
7998
+ communityPostTitleSchema = external_exports.string().trim().min(1).max(COMMUNITY_POST_TITLE_MAX_LENGTH);
7999
+ communityAttachmentUploadSchema = peopleThreadAttachmentUploadSchema;
8000
+ communitySendBody = external_exports.object({
8001
+ body: external_exports.string().max(COMMUNITY_MESSAGE_MAX_LENGTH).default(""),
8002
+ client_message_id: uuidSchema.optional(),
8003
+ title: communityPostTitleSchema.optional(),
8004
+ parent_message_id: uuidSchema.optional(),
8005
+ attachment: communityAttachmentUploadSchema.optional()
8006
+ }).strict().refine((b) => b.title === void 0 || b.parent_message_id === void 0, "a post is not a reply: send a title or a parent_message_id, not both").refine((b) => b.body.trim().length > 0 || b.attachment !== void 0, { message: "must not be empty", path: ["body"] });
8007
+ communityEditBody = external_exports.object({ body: communityMessageBodySchema, title: communityPostTitleSchema.optional() }).strict();
8008
+ communityPostIdParam = external_exports.object({ communityId: uuidSchema, roomId: uuidSchema, postId: uuidSchema });
8009
+ communityPostsQuery = external_exports.object({
8010
+ before_activity: external_exports.coerce.number().int().min(1).optional(),
8011
+ q: optionalTrimmedText(COMMUNITY_POST_SEARCH_MAX_LENGTH),
8012
+ unanswered: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true")
8013
+ });
8014
+ communityAnswerBody = external_exports.object({ reply_id: uuidSchema.nullable() }).strict();
8015
+ communityReadBody = external_exports.object({ seq: external_exports.number().int().min(0) }).strict();
8016
+ communityAttachmentUrlsBody = external_exports.object({ attachment_ids: external_exports.array(uuidSchema).min(1).max(COMMUNITY_ATTACHMENT_URLS_MAX) }).strict();
8017
+ communityPersonParam = external_exports.object({ communityId: uuidSchema, userId: peopleUserIdSchema });
8018
+ communityOrgParam = external_exports.object({ orgId: uuidSchema });
8019
+ communityPeopleQuery = external_exports.object({ after: peopleUserIdSchema.optional() });
8020
+ communityCoursesLabelSchema = external_exports.string().trim().max(COMMUNITY_COURSES_LABEL_MAX_LENGTH);
8021
+ communityAdmissionSchema = external_exports.enum(COMMUNITY_ADMISSIONS);
8022
+ communitySettingsBody = external_exports.object({
8023
+ name: communityNameSchema.optional(),
8024
+ rules: external_exports.string().trim().max(COMMUNITY_RULES_MAX_LENGTH).nullable().optional().transform((rules) => rules === "" ? null : rules),
8025
+ slow_mode_seconds: external_exports.number().int().min(0).max(COMMUNITY_SLOW_MODE_MAX_SECONDS).optional(),
8026
+ courses_label: communityCoursesLabelSchema.optional(),
8027
+ admission: communityAdmissionSchema.optional()
8028
+ }).strict().refine(
8029
+ (b) => b.name !== void 0 || b.rules !== void 0 || b.slow_mode_seconds !== void 0 || b.courses_label !== void 0 || b.admission !== void 0,
8030
+ "nothing to change"
8031
+ );
8032
+ communityAccessEmailSchema = external_exports.string().trim().toLowerCase().max(CONTACT_EMAIL_MAX).email();
8033
+ communityAccessAddBody = external_exports.object({ emails: external_exports.array(communityAccessEmailSchema).min(1).max(COMMUNITY_ACCESS_ADD_MAX) }).strict();
8034
+ communityAccessQuery = external_exports.object({ cursor: external_exports.string().min(1).max(256).optional() });
8035
+ communityAccessIdParam = external_exports.object({ communityId: uuidSchema, accessId: uuidSchema });
8036
+ communityBanBody = external_exports.object({ delete_messages: external_exports.boolean().optional() }).strict();
8037
+ communityLockBody = external_exports.object({ locked: external_exports.boolean() }).strict();
8038
+ communityPinBody = external_exports.object({ pinned: external_exports.boolean() }).strict();
8039
+ communityModLogQuery = external_exports.object({ before: external_exports.coerce.number().int().min(1).optional() });
8040
+ communityReportsQuery = communityModLogQuery.extend({
8041
+ pending: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true")
8042
+ });
8043
+ communityReportIdParam = external_exports.object({ communityId: uuidSchema, reportId: uuidSchema });
8044
+ communityLiveTicketSchema = external_exports.string().regex(new RegExp(`^${COMMUNITY_LIVE_TICKET_PREFIX}_[A-Za-z0-9_-]{43}$`));
8045
+ communityLiveQuery = external_exports.object({ ticket: communityLiveTicketSchema });
8046
+ communityMuteBody = external_exports.object({ muted: external_exports.boolean() }).strict();
8047
+ communityEmailUnsubscribeTokenSchema = external_exports.string().max(200).regex(/^[0-9a-f-]{36}\.[A-Za-z0-9_-]{1,64}\.[0-9a-f]{64}$/i);
8048
+ communityEmailUnsubscribeQuery = external_exports.object({ token: communityEmailUnsubscribeTokenSchema });
8049
+ }
8050
+ });
8051
+
8052
+ // ../../packages/core/dist/chunk-UCYWGWQT.js
8053
+ function parseCommunityLessonVideoUrl(url) {
8054
+ const parts = /^https?:\/\/([^/?#]+)([^?#]*)(?:\?([^#]*))?(?:#.*)?$/i.exec(url.trim());
8055
+ if (!parts) return null;
8056
+ const host = parts[1].toLowerCase();
8057
+ const path45 = parts[2] ?? "";
8058
+ const query = parts[3] ?? "";
8059
+ let id;
8060
+ if (host === YOUTU_BE) {
8061
+ id = /^\/([A-Za-z0-9_-]{11})\/?$/.exec(path45)?.[1];
8062
+ } else if (YOUTUBE_HOSTS.has(host)) {
8063
+ if (path45 === "/watch" || path45 === "/watch/") {
8064
+ id = query.split("&").find((param) => param.startsWith("v="))?.slice(2);
8065
+ } else {
8066
+ id = YOUTUBE_ID_PATH.exec(path45)?.[1];
8067
+ }
8068
+ }
8069
+ return id !== void 0 && YOUTUBE_ID.test(id) ? { provider: "youtube", id } : null;
8070
+ }
8071
+ function communityLessonVideoWatchUrl(video) {
8072
+ switch (video.provider) {
8073
+ case "youtube":
8074
+ return `https://www.youtube.com/watch?v=${video.id}`;
8075
+ }
8076
+ }
8077
+ 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;
8078
+ var init_chunk_UCYWGWQT = __esm({
8079
+ "../../packages/core/dist/chunk-UCYWGWQT.js"() {
8080
+ "use strict";
8081
+ init_chunk_6AYIXGDT();
8082
+ init_chunk_HZ6CADSY();
8083
+ init_zod();
8084
+ COMMUNITY_COURSES_MAX = 20;
8085
+ COMMUNITY_COURSE_MODULES_MAX = 20;
8086
+ COMMUNITY_COURSE_LESSONS_MAX = 100;
8087
+ COMMUNITY_LESSONS_MAX = 500;
8088
+ COMMUNITY_COURSE_TITLE_MAX_LENGTH = 200;
8089
+ COMMUNITY_COURSE_DESCRIPTION_MAX_LENGTH = 2e3;
8090
+ COMMUNITY_LESSON_BODY_MAX_LENGTH = 2e4;
8091
+ COMMUNITY_LESSON_LINKS_MAX = 10;
8092
+ COMMUNITY_LESSON_URL_MAX_LENGTH = 2e3;
8093
+ YOUTUBE_ID = /^[A-Za-z0-9_-]{11}$/;
8094
+ YOUTUBE_HOSTS = /* @__PURE__ */ new Set(["youtube.com", "www.youtube.com", "m.youtube.com", "youtube-nocookie.com", "www.youtube-nocookie.com"]);
8095
+ YOUTU_BE = "youtu.be";
8096
+ YOUTUBE_ID_PATH = /^\/(?:embed|shorts|live|v)\/([A-Za-z0-9_-]{11})\/?$/;
8097
+ communityCourseIdParam = external_exports.object({ communityId: uuidSchema, courseId: uuidSchema });
8098
+ communityCourseModuleIdParam = external_exports.object({ communityId: uuidSchema, courseId: uuidSchema, moduleId: uuidSchema });
8099
+ communityLessonIdParam = external_exports.object({ communityId: uuidSchema, courseId: uuidSchema, lessonId: uuidSchema });
8100
+ communityCourseTitleSchema = external_exports.string().trim().min(1).max(COMMUNITY_COURSE_TITLE_MAX_LENGTH);
8101
+ communityCourseDescriptionSchema = external_exports.string().trim().max(COMMUNITY_COURSE_DESCRIPTION_MAX_LENGTH);
8102
+ communityCoursePositionSchema = external_exports.number().int().min(0);
8103
+ communityLessonVideoUrlSchema = external_exports.string().trim().max(COMMUNITY_LESSON_URL_MAX_LENGTH).transform((url, ctx) => {
8104
+ const video = parseCommunityLessonVideoUrl(url);
8105
+ if (video) return video;
8106
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Only a YouTube video URL is accepted" });
8107
+ return external_exports.NEVER;
8108
+ });
8109
+ communityLessonLinkSchema = external_exports.object({
8110
+ title: communityCourseTitleSchema,
8111
+ url: external_exports.string().trim().max(COMMUNITY_LESSON_URL_MAX_LENGTH).url().refine((url) => /^https?:\/\//i.test(url), "must be an http or https URL")
8112
+ }).strict();
8113
+ communityLessonLinksSchema = external_exports.array(communityLessonLinkSchema).max(COMMUNITY_LESSON_LINKS_MAX);
8114
+ communityLessonBodySchema = external_exports.string().max(COMMUNITY_LESSON_BODY_MAX_LENGTH);
8115
+ communityCourseCreateBody = external_exports.object({ title: communityCourseTitleSchema, description: communityCourseDescriptionSchema.optional(), client_id: uuidSchema.optional() }).strict();
8116
+ communityCourseUpdateBody = external_exports.object({
8117
+ title: communityCourseTitleSchema.optional(),
8118
+ description: communityCourseDescriptionSchema.optional(),
8119
+ position: communityCoursePositionSchema.optional(),
8120
+ published: external_exports.boolean().optional()
8121
+ }).strict().refine((b) => Object.values(b).some((value) => value !== void 0), "nothing to change");
8122
+ communityModuleCreateBody = external_exports.object({ title: communityCourseTitleSchema, client_id: uuidSchema.optional() }).strict();
8123
+ communityModuleUpdateBody = external_exports.object({ title: communityCourseTitleSchema.optional(), position: communityCoursePositionSchema.optional() }).strict().refine((b) => b.title !== void 0 || b.position !== void 0, "nothing to change");
8124
+ communityLessonCreateBody = external_exports.object({
8125
+ module_id: uuidSchema,
8126
+ title: communityCourseTitleSchema,
8127
+ video_url: communityLessonVideoUrlSchema.nullable().optional(),
8128
+ body: communityLessonBodySchema.optional(),
8129
+ links: communityLessonLinksSchema.optional(),
8130
+ room_id: uuidSchema.nullable().optional(),
8131
+ requires_paid_plan: external_exports.boolean().optional(),
8132
+ published: external_exports.boolean().optional(),
8133
+ client_id: uuidSchema.optional()
8134
+ }).strict();
8135
+ communityLessonUpdateBody = external_exports.object({
8136
+ module_id: uuidSchema.optional(),
8137
+ title: communityCourseTitleSchema.optional(),
8138
+ video_url: communityLessonVideoUrlSchema.nullable().optional(),
8139
+ body: communityLessonBodySchema.optional(),
8140
+ links: communityLessonLinksSchema.optional(),
8141
+ room_id: uuidSchema.nullable().optional(),
8142
+ requires_paid_plan: external_exports.boolean().optional(),
8143
+ position: communityCoursePositionSchema.optional(),
8144
+ published: external_exports.boolean().optional()
8145
+ }).strict().refine((b) => Object.values(b).some((value) => value !== void 0), "nothing to change");
8146
+ }
8147
+ });
8148
+
8149
+ // ../../packages/core/dist/chunk-CMRECH67.js
8150
+ var init_chunk_CMRECH67 = __esm({
8151
+ "../../packages/core/dist/chunk-CMRECH67.js"() {
8152
+ "use strict";
8153
+ init_chunk_UCYWGWQT();
8154
+ }
8155
+ });
8156
+
8157
+ // ../../packages/core/dist/chunk-34LE6P7E.js
8158
+ var templateIdParam, listTemplatesQuery, deleteTemplateQuery, templateStatusQuery, createTemplateBody, updateTemplateBody, submitTemplateBody, testTemplateBody;
8159
+ var init_chunk_34LE6P7E = __esm({
8160
+ "../../packages/core/dist/chunk-34LE6P7E.js"() {
8161
+ "use strict";
8162
+ init_zod();
8163
+ templateIdParam = external_exports.object({
8164
+ id: external_exports.string().uuid()
8165
+ });
8166
+ listTemplatesQuery = external_exports.object({
8167
+ hub_id: external_exports.string().uuid(),
8168
+ connection_id: external_exports.string().uuid()
8169
+ });
8170
+ deleteTemplateQuery = external_exports.object({
8171
+ hub_id: external_exports.string().uuid(),
8172
+ connection_id: external_exports.string().uuid()
8173
+ });
8174
+ templateStatusQuery = external_exports.object({
8175
+ hub_id: external_exports.string().uuid(),
8176
+ connection_id: external_exports.string().uuid()
8177
+ });
8178
+ createTemplateBody = external_exports.object({
8179
+ hub_id: external_exports.string().uuid(),
8180
+ connection_id: external_exports.string().uuid()
8181
+ }).passthrough();
8182
+ updateTemplateBody = external_exports.object({}).passthrough();
8183
+ submitTemplateBody = external_exports.object({
8184
+ hub_id: external_exports.string().uuid(),
8185
+ connection_id: external_exports.string().uuid()
8186
+ }).passthrough();
8187
+ testTemplateBody = external_exports.object({
8188
+ hub_id: external_exports.string().uuid(),
8189
+ connection_id: external_exports.string().uuid()
8190
+ }).passthrough();
8191
+ }
8192
+ });
8193
+
8194
+ // ../../packages/core/dist/chunk-FPSDNS2E.js
8195
+ var noticeSeveritySchema, noticeStatusSchema, NOTICE_SCOPE_REGEX, noticeScopeSchema, noticeLinkSchema, createNoticeBody, updateNoticeBody, listNoticesQuery, noticeIdParamSchema;
8196
+ var init_chunk_FPSDNS2E = __esm({
8197
+ "../../packages/core/dist/chunk-FPSDNS2E.js"() {
8198
+ "use strict";
8199
+ init_zod();
8200
+ noticeSeveritySchema = external_exports.enum(["critical", "warn", "info"]);
8201
+ noticeStatusSchema = external_exports.enum(["active", "resolved"]);
8202
+ NOTICE_SCOPE_REGEX = /^(global|provider:[a-z0-9_-]{1,40}|service:[a-z0-9_-]{1,40})$/;
8203
+ noticeScopeSchema = external_exports.string().regex(NOTICE_SCOPE_REGEX, "scope must be 'global', 'provider:<x>', or 'service:<x>'");
8204
+ noticeLinkSchema = external_exports.string().url().refine((u) => /^https?:\/\//i.test(u), { message: "link must be an http(s) URL" });
8205
+ createNoticeBody = external_exports.object({
8206
+ severity: noticeSeveritySchema.default("info"),
8207
+ scope: noticeScopeSchema.default("global"),
8208
+ title: external_exports.string().trim().min(1).max(200),
8209
+ body: external_exports.string().max(2e3).optional(),
8210
+ link: noticeLinkSchema.optional(),
8211
+ starts_at: external_exports.string().datetime().optional(),
8212
+ ends_at: external_exports.string().datetime().optional()
8213
+ });
8214
+ updateNoticeBody = external_exports.object({
8215
+ severity: noticeSeveritySchema.optional(),
8216
+ scope: noticeScopeSchema.optional(),
8217
+ title: external_exports.string().trim().min(1).max(200).optional(),
8218
+ body: external_exports.string().max(2e3).nullable().optional(),
8219
+ link: noticeLinkSchema.nullable().optional(),
8220
+ starts_at: external_exports.string().datetime().optional(),
8221
+ ends_at: external_exports.string().datetime().nullable().optional()
8222
+ }).refine((b) => Object.keys(b).length > 0, { message: "at least one field must be provided" });
8223
+ listNoticesQuery = external_exports.object({
8224
+ status: noticeStatusSchema.optional(),
8225
+ limit: external_exports.coerce.number().int().min(1).max(200).optional(),
8226
+ offset: external_exports.coerce.number().int().min(0).optional()
8227
+ });
8228
+ noticeIdParamSchema = external_exports.object({ id: external_exports.string().min(1) });
8229
+ }
8230
+ });
8231
+
7862
8232
  // ../../packages/core/dist/chunk-OPETF4GS.js
7863
8233
  var hubAlertsParam, hubAlertSeverity, hubAlert, hubAlertsListResponse;
7864
8234
  var init_chunk_OPETF4GS = __esm({
@@ -8341,7 +8711,7 @@ var init_chunk_C2UEA2KW = __esm({
8341
8711
  }
8342
8712
  });
8343
8713
 
8344
- // ../../packages/core/dist/chunk-GYSQV2DS.js
8714
+ // ../../packages/core/dist/chunk-JHUTFQDO.js
8345
8715
  function isNativeToolName(name) {
8346
8716
  return NATIVE_TOOL_NAMES.has(name);
8347
8717
  }
@@ -8360,8 +8730,8 @@ function idempotencyHeaderRefusal(value) {
8360
8730
  return null;
8361
8731
  }
8362
8732
  var NATIVE_TOOL_SCHEMAS, WAYAI_CONNECTOR, SANDBOX_AGENT_ROLES, BASE_NATIVE_TOOLS, NATIVE_TOOLS, NATIVE_TOOL_NAMES, CATALOG_SIDE_EFFECTS, CATALOG_REPLAY, REPLAY_OVERRIDES, RESERVED_HEADERS;
8363
- var init_chunk_GYSQV2DS = __esm({
8364
- "../../packages/core/dist/chunk-GYSQV2DS.js"() {
8733
+ var init_chunk_JHUTFQDO = __esm({
8734
+ "../../packages/core/dist/chunk-JHUTFQDO.js"() {
8365
8735
  "use strict";
8366
8736
  init_chunk_YROEDMVZ();
8367
8737
  NATIVE_TOOL_SCHEMAS = {
@@ -10410,12 +10780,12 @@ var init_chunk_I42QJGJF = __esm({
10410
10780
  }
10411
10781
  });
10412
10782
 
10413
- // ../../packages/core/dist/chunk-VSSZVDBU.js
10783
+ // ../../packages/core/dist/chunk-DOGCOC6X.js
10414
10784
  var COUNTER_KEYS, STT_PRICING, CONTAINER_PRICING, connectorById, nativeToolById;
10415
- var init_chunk_VSSZVDBU = __esm({
10416
- "../../packages/core/dist/chunk-VSSZVDBU.js"() {
10785
+ var init_chunk_DOGCOC6X = __esm({
10786
+ "../../packages/core/dist/chunk-DOGCOC6X.js"() {
10417
10787
  "use strict";
10418
- init_chunk_GYSQV2DS();
10788
+ init_chunk_JHUTFQDO();
10419
10789
  init_chunk_I42QJGJF();
10420
10790
  init_chunk_MIWZOSPI();
10421
10791
  COUNTER_KEYS = Object.keys({
@@ -10539,7 +10909,7 @@ var init_chunk_L5F7ZOUJ = __esm({
10539
10909
  }
10540
10910
  });
10541
10911
 
10542
- // ../../packages/core/dist/chunk-J75LDBC2.js
10912
+ // ../../packages/core/dist/chunk-BLPYDZAO.js
10543
10913
  function normalizeDecisionsModelId(modelId) {
10544
10914
  return modelId.trim().toLowerCase();
10545
10915
  }
@@ -10610,10 +10980,10 @@ function readAgentSettingsModel(agentSettings) {
10610
10980
  return typeof model === "string" ? model : null;
10611
10981
  }
10612
10982
  var DECISIONS_MODEL_PREFIXES, DECISION_CAPABLE_AGENT_ROLES;
10613
- var init_chunk_J75LDBC2 = __esm({
10614
- "../../packages/core/dist/chunk-J75LDBC2.js"() {
10983
+ var init_chunk_BLPYDZAO = __esm({
10984
+ "../../packages/core/dist/chunk-BLPYDZAO.js"() {
10615
10985
  "use strict";
10616
- init_chunk_VSSZVDBU();
10986
+ init_chunk_DOGCOC6X();
10617
10987
  init_chunk_L5F7ZOUJ();
10618
10988
  DECISIONS_MODEL_PREFIXES = ["typesafe/jev-", "jev-"];
10619
10989
  DECISION_CAPABLE_AGENT_ROLES = [
@@ -10624,7 +10994,7 @@ var init_chunk_J75LDBC2 = __esm({
10624
10994
  }
10625
10995
  });
10626
10996
 
10627
- // ../../packages/core/dist/chunk-OXVMTY3G.js
10997
+ // ../../packages/core/dist/chunk-OAWG66J3.js
10628
10998
  function resolveMonitorTrigger(monitorConfig) {
10629
10999
  if (!monitorConfig || typeof monitorConfig !== "object") return "idle";
10630
11000
  const raw = monitorConfig.trigger;
@@ -10930,15 +11300,15 @@ function refineMonitorRulesStructuredOutput(body, ctx) {
10930
11300
  if (refusal2) ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: ["response_format"], message: refusal2 });
10931
11301
  }
10932
11302
  var previousConversationsCountField, summarizationThresholdField, flagConditionSchema, MONITOR_TRIGGERS, monitorTriggerSchema, AUTOMATION_GATE_TRIGGERS, NON_FIRING_TRIGGERS, MONITOR_FIRING_TRIGGERS, MONITOR_DELAY_SECONDS_MIN, MONITOR_IDLE_DELAY_REQUIRED_MESSAGE, MONITOR_HISTORY_MESSAGES_MAX, monitorHistoryMessagesSchema, monitorIncludeToolResultsSchema, MONITOR_INPUT_SHAPING_KEYS, MONITOR_INPUT_SHAPING_SCHEMAS, MONITOR_INPUT_SHAPING_IDLE_MESSAGE, monitorArgumentSourceSchema, MONITOR_NOTE_TEMPLATE_MAX, MONITOR_STEER_NOTE_MAX, MONITOR_GATE_AGENT_NAME_MAX, monitorActionSchema, monitorRuleSchema, MONITOR_RULE_KEYS, MONITOR_RULE_SCHEMAS, MONITOR_RULE_TRIGGERS, MONITOR_RULE_TRIGGER_MESSAGE, CALL_UTTERANCE_SPEAKERS, callUtteranceSpeakerSchema, MONITOR_CALL_KEYS, MONITOR_CALL_SCHEMAS, MONITOR_CALL_KEY_MESSAGE, CALL_STEERING_MIN_CONFIDENCE, CALL_UTTERANCE_RULE_NOT_CONFIDENT_MESSAGE, CALL_UTTERANCE_FALLBACK_MESSAGE, CALL_UTTERANCE_FLAG_CONDITIONS_MESSAGE, CALL_STEER_NOTE_BLANK_MESSAGE, MONITOR_USER_MESSAGE_ACTION_KINDS, MONITOR_ASSISTANT_REPLY_ACTION_KINDS, MONITOR_CALL_UTTERANCE_ACTION_KINDS, MONITOR_AUTOMATION_FIRE_ACTION_KINDS, MONITOR_AUTOMATION_ITEM_ACTION_KINDS, INSERT_NOTE_TOOL_NAME, RUN_MONITOR_TOOL_NAME, MONITOR_RULE_ALLOWED_NATIVE_TOOLS, MONITOR_RULE_REENTRY_TOOLS, MONITOR_RULE_REENTRY_TRACKS, AUTOMATION_FIRE_FLAG_CONDITIONS_MESSAGE, AUTOMATION_FIRE_INPUT_SHAPING_MESSAGE, AUTOMATION_ITEM_FLAG_CONDITIONS_MESSAGE, AUTOMATION_ITEM_INPUT_SHAPING_MESSAGE, AUTOMATION_GATE_KEY_MESSAGES, monitorConfigField, flagConditionsField, agentIdParam, listAgentsQuery, agentConnectionsQuery, createAgentBody, updateAgentBody, AGENT_PARAMETER_TYPES, AGENT_PARAMETER_NAME_REGEX, agentParameterCreateSchema, MAX_AGENT_PARAMETERS_PER_REQUEST, createAgentParametersBody;
10933
- var init_chunk_OXVMTY3G = __esm({
10934
- "../../packages/core/dist/chunk-OXVMTY3G.js"() {
11303
+ var init_chunk_OAWG66J3 = __esm({
11304
+ "../../packages/core/dist/chunk-OAWG66J3.js"() {
10935
11305
  "use strict";
10936
11306
  init_chunk_IBL7FANV();
10937
11307
  init_chunk_KB5RK3RP();
10938
11308
  init_chunk_C2UEA2KW();
10939
11309
  init_chunk_HZ6CADSY();
10940
- init_chunk_J75LDBC2();
10941
- init_chunk_GYSQV2DS();
11310
+ init_chunk_BLPYDZAO();
11311
+ init_chunk_JHUTFQDO();
10942
11312
  init_chunk_YROEDMVZ();
10943
11313
  init_chunk_L5F7ZOUJ();
10944
11314
  init_zod();
@@ -11155,12 +11525,12 @@ var init_chunk_OXVMTY3G = __esm({
11155
11525
  }
11156
11526
  });
11157
11527
 
11158
- // ../../packages/core/dist/chunk-CQTU636K.js
11528
+ // ../../packages/core/dist/chunk-HL6QCLLK.js
11159
11529
  var conversationIdParam, conversationHubQuery, claimBody, releaseBody, transferBody, closeBody, additionalContextPayloadSchema, kanbanUpdateBody, annotateConversationBody, observabilityParams, observabilityListParams, deleteUserConversationsBody, deleteUserConversationsResponse, sendMessageBody, listConversationsQuery, flagSourceSchema, getConversationsResponse, getConversationDetailParams, getConversationDetailQuery, getConversationDetailResponse, listWhatsAppTemplatesQuery, sendWhatsAppTemplateBody;
11160
- var init_chunk_CQTU636K = __esm({
11161
- "../../packages/core/dist/chunk-CQTU636K.js"() {
11530
+ var init_chunk_HL6QCLLK = __esm({
11531
+ "../../packages/core/dist/chunk-HL6QCLLK.js"() {
11162
11532
  "use strict";
11163
- init_chunk_OXVMTY3G();
11533
+ init_chunk_OAWG66J3();
11164
11534
  init_chunk_HZ6CADSY();
11165
11535
  init_chunk_YROEDMVZ();
11166
11536
  init_zod();
@@ -11875,364 +12245,6 @@ var init_chunk_IR2NOSI3 = __esm({
11875
12245
  }
11876
12246
  });
11877
12247
 
11878
- // ../../packages/core/dist/chunk-6J742GLA.js
11879
- var PEOPLE_THREAD_MESSAGE_MAX_LENGTH, PEOPLE_THREAD_MESSAGES_PAGE_MAX, PEOPLE_THREAD_PAGE_MAX, PEOPLE_THREAD_PAGE_DEFAULT, PEOPLE_GROUP_NAME_MAX_LENGTH, PEOPLE_GROUP_AVATAR_URL_MAX_LENGTH, PEOPLE_THREAD_ATTACHMENT_MAX_BYTES, PEOPLE_THREAD_ATTACHMENT_NAME_MAX_LENGTH, PEOPLE_ATTACHMENT_STORAGE_PER_USER_BYTES, PEOPLE_THREAD_ATTACHMENT_MAX_MB, PEOPLE_THREAD_ATTACHMENT_URL_TTL_SECONDS, PEOPLE_THREAD_ATTACHMENT_URLS_MAX, peopleThreadIdParam, peopleThreadMessageIdParam, peopleThreadListQuery, peopleThreadMessagesQuery, peopleThreadAttachmentUploadSchema, peopleThreadSendBody, peopleThreadAttachmentUrlsBody, peopleThreadReadBody, peopleThreadSettingsBody, peopleGroupNameSchema, peopleGroupAvatarUrlSchema, peopleGroupCreateBody, peopleOrgDirectBody, peopleGroupUpdateBody, peopleGroupInviteBody, peopleOrgErasureBody, peopleGroupLeaveBody, peopleGroupInviteIdParam, peopleGroupIncomingInviteIdParam, peopleGroupMemberParam, peopleThreadKindSchema, peopleThreadMemberSchema, peopleThreadLastMessageSchema, peopleGroupRoleSchema, peopleGroupSummarySchema, peopleThreadSummarySchema, peopleThreadAttachmentSchema, peopleThreadMessageSchema, peopleGroupMemberSchema, peopleGroupSentInviteSchema, peopleGroupIncomingInviteSchema;
11880
- var init_chunk_6J742GLA = __esm({
11881
- "../../packages/core/dist/chunk-6J742GLA.js"() {
11882
- "use strict";
11883
- init_chunk_ZVXO3XL6();
11884
- init_chunk_HZ6CADSY();
11885
- init_zod();
11886
- PEOPLE_THREAD_MESSAGE_MAX_LENGTH = 4e3;
11887
- PEOPLE_THREAD_MESSAGES_PAGE_MAX = 50;
11888
- PEOPLE_THREAD_PAGE_MAX = 100;
11889
- PEOPLE_THREAD_PAGE_DEFAULT = 50;
11890
- PEOPLE_GROUP_NAME_MAX_LENGTH = 100;
11891
- PEOPLE_GROUP_AVATAR_URL_MAX_LENGTH = 2048;
11892
- PEOPLE_THREAD_ATTACHMENT_MAX_BYTES = 7 * 1024 * 1024;
11893
- PEOPLE_THREAD_ATTACHMENT_NAME_MAX_LENGTH = 255;
11894
- PEOPLE_ATTACHMENT_STORAGE_PER_USER_BYTES = 1024 * 1024 * 1024;
11895
- PEOPLE_THREAD_ATTACHMENT_MAX_MB = Math.floor(PEOPLE_THREAD_ATTACHMENT_MAX_BYTES / (1024 * 1024));
11896
- PEOPLE_THREAD_ATTACHMENT_URL_TTL_SECONDS = 15 * 60;
11897
- PEOPLE_THREAD_ATTACHMENT_URLS_MAX = PEOPLE_THREAD_MESSAGES_PAGE_MAX;
11898
- peopleThreadIdParam = external_exports.object({ threadId: uuidSchema });
11899
- peopleThreadMessageIdParam = external_exports.object({ threadId: uuidSchema, messageId: uuidSchema });
11900
- peopleThreadListQuery = external_exports.object({
11901
- cursor: external_exports.string().min(1).max(256).optional(),
11902
- limit: external_exports.coerce.number().int().min(1).max(PEOPLE_THREAD_PAGE_MAX).default(PEOPLE_THREAD_PAGE_DEFAULT)
11903
- });
11904
- peopleThreadMessagesQuery = external_exports.object({
11905
- before_seq: external_exports.coerce.number().int().min(1).optional(),
11906
- limit: external_exports.coerce.number().int().min(1).max(PEOPLE_THREAD_MESSAGES_PAGE_MAX).default(PEOPLE_THREAD_MESSAGES_PAGE_MAX)
11907
- });
11908
- peopleThreadAttachmentUploadSchema = external_exports.object({
11909
- file_name: external_exports.string().trim().min(1).max(PEOPLE_THREAD_ATTACHMENT_NAME_MAX_LENGTH),
11910
- file_binary: external_exports.string().min(1)
11911
- }).strict();
11912
- peopleThreadSendBody = external_exports.object({
11913
- body: external_exports.string().max(PEOPLE_THREAD_MESSAGE_MAX_LENGTH).default(""),
11914
- client_message_id: uuidSchema.optional(),
11915
- attachment: peopleThreadAttachmentUploadSchema.optional()
11916
- }).strict().refine((b) => b.body.trim().length > 0 || b.attachment !== void 0, {
11917
- message: "must not be empty",
11918
- path: ["body"]
11919
- });
11920
- peopleThreadAttachmentUrlsBody = external_exports.object({ attachment_ids: external_exports.array(uuidSchema).min(1).max(PEOPLE_THREAD_ATTACHMENT_URLS_MAX) }).strict();
11921
- peopleThreadReadBody = external_exports.object({ seq: external_exports.number().int().min(0) }).strict();
11922
- peopleThreadSettingsBody = external_exports.object({
11923
- muted: external_exports.boolean().optional(),
11924
- hidden: external_exports.boolean().optional()
11925
- }).strict().refine((b) => b.muted !== void 0 || b.hidden !== void 0, "nothing to change");
11926
- peopleGroupNameSchema = external_exports.string().trim().min(1).max(PEOPLE_GROUP_NAME_MAX_LENGTH);
11927
- peopleGroupAvatarUrlSchema = external_exports.string().max(PEOPLE_GROUP_AVATAR_URL_MAX_LENGTH).url().refine((s) => s.startsWith("https://"), "must be an https URL");
11928
- peopleGroupCreateBody = external_exports.object({
11929
- name: peopleGroupNameSchema,
11930
- avatar_url: peopleGroupAvatarUrlSchema.nullable().optional(),
11931
- org_id: uuidSchema.optional()
11932
- }).strict();
11933
- peopleOrgDirectBody = external_exports.object({
11934
- org_id: uuidSchema,
11935
- user_id: peopleUserIdSchema
11936
- }).strict();
11937
- peopleGroupUpdateBody = external_exports.object({
11938
- name: peopleGroupNameSchema.optional(),
11939
- avatar_url: peopleGroupAvatarUrlSchema.nullable().optional()
11940
- }).strict().refine((b) => b.name !== void 0 || b.avatar_url !== void 0, "nothing to change");
11941
- peopleGroupInviteBody = external_exports.union([
11942
- external_exports.object({ user_id: peopleUserIdSchema }).strict(),
11943
- external_exports.object({ email: peopleInviteEmailSchema }).strict()
11944
- ]);
11945
- peopleOrgErasureBody = external_exports.object({
11946
- org_id: uuidSchema,
11947
- email: peopleInviteEmailSchema
11948
- }).strict();
11949
- peopleGroupLeaveBody = external_exports.object({ delete_my_messages: external_exports.boolean().optional() }).strict();
11950
- peopleGroupInviteIdParam = external_exports.object({ threadId: uuidSchema, inviteId: uuidSchema });
11951
- peopleGroupIncomingInviteIdParam = external_exports.object({ inviteId: uuidSchema });
11952
- peopleGroupMemberParam = external_exports.object({ threadId: uuidSchema, userId: peopleUserIdSchema });
11953
- peopleThreadKindSchema = external_exports.enum(["dm", "group"]);
11954
- peopleThreadMemberSchema = external_exports.object({
11955
- user_id: peopleUserIdSchema,
11956
- display_name: external_exports.string().nullable(),
11957
- deleted_user: external_exports.boolean()
11958
- }).strict();
11959
- peopleThreadLastMessageSchema = external_exports.object({
11960
- message_id: uuidSchema,
11961
- seq: external_exports.number().int().positive(),
11962
- author_user_id: peopleUserIdSchema,
11963
- preview: external_exports.string().nullable(),
11964
- deleted: external_exports.boolean(),
11965
- created_at: timestampSchema
11966
- }).strict();
11967
- peopleGroupRoleSchema = external_exports.enum(["admin", "member"]);
11968
- peopleGroupSummarySchema = external_exports.object({
11969
- membership: external_exports.enum(["member", "removed", "left"]),
11970
- role: peopleGroupRoleSchema.nullable(),
11971
- avatar_url: external_exports.string().nullable()
11972
- }).strict();
11973
- peopleThreadSummarySchema = external_exports.object({
11974
- thread_id: uuidSchema,
11975
- kind: peopleThreadKindSchema,
11976
- org_id: external_exports.string().nullable(),
11977
- org_name: external_exports.string().nullable(),
11978
- title: external_exports.string().nullable(),
11979
- counterpart: peopleThreadMemberSchema.nullable(),
11980
- last_seq: external_exports.number().int().nonnegative(),
11981
- last_message: peopleThreadLastMessageSchema.nullable(),
11982
- last_activity_at: timestampSchema,
11983
- read_seq: external_exports.number().int().nonnegative(),
11984
- unread_count: external_exports.number().int().nonnegative(),
11985
- muted: external_exports.boolean(),
11986
- hidden: external_exports.boolean(),
11987
- writable: external_exports.boolean(),
11988
- group: peopleGroupSummarySchema.nullable().optional(),
11989
- version: external_exports.number().int().nonnegative().optional()
11990
- }).strict();
11991
- peopleThreadAttachmentSchema = external_exports.object({
11992
- attachment_id: uuidSchema,
11993
- file_name: external_exports.string(),
11994
- content_type: external_exports.string(),
11995
- size_bytes: external_exports.number().int().positive()
11996
- }).strict();
11997
- peopleThreadMessageSchema = external_exports.object({
11998
- message_id: uuidSchema,
11999
- seq: external_exports.number().int().positive(),
12000
- author_user_id: peopleUserIdSchema,
12001
- body: external_exports.string().nullable(),
12002
- deleted: external_exports.boolean(),
12003
- created_at: timestampSchema,
12004
- deleted_at: timestampSchema.nullable(),
12005
- client_message_id: uuidSchema.nullable(),
12006
- attachment: peopleThreadAttachmentSchema.nullable().optional()
12007
- }).strict();
12008
- peopleGroupMemberSchema = peopleThreadMemberSchema.extend({ role: peopleGroupRoleSchema, joined_at: timestampSchema }).strict();
12009
- peopleGroupSentInviteSchema = external_exports.object({
12010
- invite_id: uuidSchema,
12011
- invitee: peopleThreadMemberSchema,
12012
- invitee_email: external_exports.string().nullable().optional(),
12013
- status: external_exports.literal("sent"),
12014
- created_at: timestampSchema,
12015
- expires_at: timestampSchema
12016
- }).strict();
12017
- peopleGroupIncomingInviteSchema = external_exports.object({
12018
- invite_id: uuidSchema,
12019
- thread_id: uuidSchema,
12020
- kind: peopleThreadKindSchema.optional(),
12021
- group: external_exports.object({ name: external_exports.string() }).strict(),
12022
- org: external_exports.object({ org_id: external_exports.string(), org_name: external_exports.string().nullable() }).strict().nullable().optional(),
12023
- inviter: external_exports.object({ user_id: peopleUserIdSchema, display_name: external_exports.string().nullable(), email: external_exports.string().nullable() }).strict(),
12024
- created_at: timestampSchema,
12025
- expires_at: timestampSchema
12026
- }).strict();
12027
- }
12028
- });
12029
-
12030
- // ../../packages/core/dist/chunk-6AYIXGDT.js
12031
- 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;
12032
- var init_chunk_6AYIXGDT = __esm({
12033
- "../../packages/core/dist/chunk-6AYIXGDT.js"() {
12034
- "use strict";
12035
- init_chunk_UAOHHCW5();
12036
- init_chunk_6J742GLA();
12037
- init_chunk_ZVXO3XL6();
12038
- init_chunk_HZ6CADSY();
12039
- init_zod();
12040
- COMMUNITIES_PER_ORG_MAX = 10;
12041
- COMMUNITY_NAME_MAX_LENGTH = 100;
12042
- COMMUNITY_REGISTRY_CLOSED_REASON = "community_registry_closed";
12043
- COMMUNITY_MEMBERS_MAX = 1e4;
12044
- COMMUNITY_ADMISSIONS = ["link", "invite"];
12045
- COMMUNITY_ACCESS_MAX = COMMUNITY_MEMBERS_MAX;
12046
- COMMUNITY_ACCESS_ADD_MAX = 500;
12047
- COMMUNITY_ACCESS_FULL_REASON = "community_access_full";
12048
- COMMUNITY_JOIN_SOURCE_MAX_LENGTH = 32;
12049
- COMMUNITY_JOIN_FLOW_TOKEN_MAX_LENGTH = 128;
12050
- COMMUNITY_ROOMS_MAX = 20;
12051
- COMMUNITY_ROOM_NAME_MAX_LENGTH = 100;
12052
- COMMUNITY_MESSAGE_MAX_LENGTH = 4e3;
12053
- COMMUNITY_MESSAGES_PAGE_SIZE = 50;
12054
- COMMUNITY_ATTACHMENT_URLS_MAX = COMMUNITY_MESSAGES_PAGE_SIZE + 2;
12055
- COMMUNITY_POST_TITLE_MAX_LENGTH = 200;
12056
- COMMUNITY_POST_SEARCH_MAX_LENGTH = 100;
12057
- COMMUNITY_MEMBER_STATUSES = ["active", "left", "removed", "banned"];
12058
- COMMUNITY_RULES_MAX_LENGTH = 4e3;
12059
- COMMUNITY_SLOW_MODE_MAX_SECONDS = 21600;
12060
- COMMUNITY_COURSES_LABEL_MAX_LENGTH = 16;
12061
- COMMUNITY_LIVE_TICKET_PREFIX = "cst";
12062
- COMMUNITY_STATS_DAYS = 30;
12063
- communityNameSchema = external_exports.string().trim().min(1).max(COMMUNITY_NAME_MAX_LENGTH);
12064
- adminCreateCommunityBody = external_exports.object({ org_id: uuidSchema, name: communityNameSchema }).strict();
12065
- communityIdParam = external_exports.object({ communityId: uuidSchema });
12066
- communityJoinTokenSchema = external_exports.string().regex(/^[0-9a-f]{32}$/);
12067
- communityJoinSourceSchema = external_exports.string().regex(new RegExp(`^[a-z0-9_-]{1,${COMMUNITY_JOIN_SOURCE_MAX_LENGTH}}$`));
12068
- communityJoinPreviewQuery = external_exports.object({ c: uuidSchema, k: communityJoinTokenSchema });
12069
- communityJoinBody = external_exports.object({
12070
- token: communityJoinTokenSchema,
12071
- src: communityJoinSourceSchema.optional(),
12072
- flow_token: external_exports.string().max(COMMUNITY_JOIN_FLOW_TOKEN_MAX_LENGTH).optional()
12073
- }).strict();
12074
- communityRoomKindSchema = external_exports.enum(["discussion", "forum", "announcements"]);
12075
- communityRoomNameSchema = external_exports.string().trim().min(1).max(COMMUNITY_ROOM_NAME_MAX_LENGTH);
12076
- communityRoomIdParam = external_exports.object({ communityId: uuidSchema, roomId: uuidSchema });
12077
- communityMessageIdParam = external_exports.object({ communityId: uuidSchema, roomId: uuidSchema, messageId: uuidSchema });
12078
- communityRoomCreateBody = external_exports.object({ kind: communityRoomKindSchema, name: communityRoomNameSchema, client_id: uuidSchema.optional() }).strict();
12079
- communityRoomUpdateBody = external_exports.object({ name: communityRoomNameSchema.optional(), archived: external_exports.boolean().optional() }).strict().refine((b) => b.name !== void 0 || b.archived !== void 0, "nothing to change");
12080
- communityMessagesQuery = external_exports.object({
12081
- before: external_exports.coerce.number().int().min(1).optional(),
12082
- after: external_exports.coerce.number().int().min(0).optional()
12083
- }).refine((q) => q.before === void 0 || q.after === void 0, "before and after cannot be combined");
12084
- communityMessageBodySchema = external_exports.string().max(COMMUNITY_MESSAGE_MAX_LENGTH).refine((body) => body.trim().length > 0, "must not be empty");
12085
- communityPostTitleSchema = external_exports.string().trim().min(1).max(COMMUNITY_POST_TITLE_MAX_LENGTH);
12086
- communityAttachmentUploadSchema = peopleThreadAttachmentUploadSchema;
12087
- communitySendBody = external_exports.object({
12088
- body: external_exports.string().max(COMMUNITY_MESSAGE_MAX_LENGTH).default(""),
12089
- client_message_id: uuidSchema.optional(),
12090
- title: communityPostTitleSchema.optional(),
12091
- parent_message_id: uuidSchema.optional(),
12092
- attachment: communityAttachmentUploadSchema.optional()
12093
- }).strict().refine((b) => b.title === void 0 || b.parent_message_id === void 0, "a post is not a reply: send a title or a parent_message_id, not both").refine((b) => b.body.trim().length > 0 || b.attachment !== void 0, { message: "must not be empty", path: ["body"] });
12094
- communityEditBody = external_exports.object({ body: communityMessageBodySchema, title: communityPostTitleSchema.optional() }).strict();
12095
- communityPostIdParam = external_exports.object({ communityId: uuidSchema, roomId: uuidSchema, postId: uuidSchema });
12096
- communityPostsQuery = external_exports.object({
12097
- before_activity: external_exports.coerce.number().int().min(1).optional(),
12098
- q: optionalTrimmedText(COMMUNITY_POST_SEARCH_MAX_LENGTH),
12099
- unanswered: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true")
12100
- });
12101
- communityAnswerBody = external_exports.object({ reply_id: uuidSchema.nullable() }).strict();
12102
- communityReadBody = external_exports.object({ seq: external_exports.number().int().min(0) }).strict();
12103
- communityAttachmentUrlsBody = external_exports.object({ attachment_ids: external_exports.array(uuidSchema).min(1).max(COMMUNITY_ATTACHMENT_URLS_MAX) }).strict();
12104
- communityPersonParam = external_exports.object({ communityId: uuidSchema, userId: peopleUserIdSchema });
12105
- communityOrgParam = external_exports.object({ orgId: uuidSchema });
12106
- communityPeopleQuery = external_exports.object({ after: peopleUserIdSchema.optional() });
12107
- communityCoursesLabelSchema = external_exports.string().trim().max(COMMUNITY_COURSES_LABEL_MAX_LENGTH);
12108
- communityAdmissionSchema = external_exports.enum(COMMUNITY_ADMISSIONS);
12109
- communitySettingsBody = external_exports.object({
12110
- name: communityNameSchema.optional(),
12111
- rules: external_exports.string().trim().max(COMMUNITY_RULES_MAX_LENGTH).nullable().optional().transform((rules) => rules === "" ? null : rules),
12112
- slow_mode_seconds: external_exports.number().int().min(0).max(COMMUNITY_SLOW_MODE_MAX_SECONDS).optional(),
12113
- courses_label: communityCoursesLabelSchema.optional(),
12114
- admission: communityAdmissionSchema.optional()
12115
- }).strict().refine(
12116
- (b) => b.name !== void 0 || b.rules !== void 0 || b.slow_mode_seconds !== void 0 || b.courses_label !== void 0 || b.admission !== void 0,
12117
- "nothing to change"
12118
- );
12119
- communityAccessEmailSchema = external_exports.string().trim().toLowerCase().max(CONTACT_EMAIL_MAX).email();
12120
- communityAccessAddBody = external_exports.object({ emails: external_exports.array(communityAccessEmailSchema).min(1).max(COMMUNITY_ACCESS_ADD_MAX) }).strict();
12121
- communityAccessQuery = external_exports.object({ cursor: external_exports.string().min(1).max(256).optional() });
12122
- communityAccessIdParam = external_exports.object({ communityId: uuidSchema, accessId: uuidSchema });
12123
- communityBanBody = external_exports.object({ delete_messages: external_exports.boolean().optional() }).strict();
12124
- communityLockBody = external_exports.object({ locked: external_exports.boolean() }).strict();
12125
- communityPinBody = external_exports.object({ pinned: external_exports.boolean() }).strict();
12126
- communityModLogQuery = external_exports.object({ before: external_exports.coerce.number().int().min(1).optional() });
12127
- communityReportsQuery = communityModLogQuery.extend({
12128
- pending: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true")
12129
- });
12130
- communityReportIdParam = external_exports.object({ communityId: uuidSchema, reportId: uuidSchema });
12131
- communityLiveTicketSchema = external_exports.string().regex(new RegExp(`^${COMMUNITY_LIVE_TICKET_PREFIX}_[A-Za-z0-9_-]{43}$`));
12132
- communityLiveQuery = external_exports.object({ ticket: communityLiveTicketSchema });
12133
- communityMuteBody = external_exports.object({ muted: external_exports.boolean() }).strict();
12134
- communityEmailUnsubscribeTokenSchema = external_exports.string().max(200).regex(/^[0-9a-f-]{36}\.[A-Za-z0-9_-]{1,64}\.[0-9a-f]{64}$/i);
12135
- communityEmailUnsubscribeQuery = external_exports.object({ token: communityEmailUnsubscribeTokenSchema });
12136
- }
12137
- });
12138
-
12139
- // ../../packages/core/dist/chunk-47LPEX74.js
12140
- function parseCommunityLessonVideoUrl(url) {
12141
- const parts = /^https?:\/\/([^/?#]+)([^?#]*)(?:\?([^#]*))?(?:#.*)?$/i.exec(url.trim());
12142
- if (!parts) return null;
12143
- const host = parts[1].toLowerCase();
12144
- const path45 = parts[2] ?? "";
12145
- const query = parts[3] ?? "";
12146
- let id;
12147
- if (host === YOUTU_BE) {
12148
- id = /^\/([A-Za-z0-9_-]{11})\/?$/.exec(path45)?.[1];
12149
- } else if (YOUTUBE_HOSTS.has(host)) {
12150
- if (path45 === "/watch" || path45 === "/watch/") {
12151
- id = query.split("&").find((param) => param.startsWith("v="))?.slice(2);
12152
- } else {
12153
- id = YOUTUBE_ID_PATH.exec(path45)?.[1];
12154
- }
12155
- }
12156
- return id !== void 0 && YOUTUBE_ID.test(id) ? { provider: "youtube", id } : null;
12157
- }
12158
- function communityLessonVideoWatchUrl(video) {
12159
- switch (video.provider) {
12160
- case "youtube":
12161
- return `https://www.youtube.com/watch?v=${video.id}`;
12162
- }
12163
- }
12164
- 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;
12165
- var init_chunk_47LPEX74 = __esm({
12166
- "../../packages/core/dist/chunk-47LPEX74.js"() {
12167
- "use strict";
12168
- init_chunk_6AYIXGDT();
12169
- init_chunk_HZ6CADSY();
12170
- init_zod();
12171
- COMMUNITY_COURSES_MAX = 20;
12172
- COMMUNITY_COURSE_MODULES_MAX = 20;
12173
- COMMUNITY_COURSE_LESSONS_MAX = 100;
12174
- COMMUNITY_LESSONS_MAX = 500;
12175
- COMMUNITY_COURSE_TITLE_MAX_LENGTH = 200;
12176
- COMMUNITY_COURSE_DESCRIPTION_MAX_LENGTH = 2e3;
12177
- COMMUNITY_LESSON_BODY_MAX_LENGTH = 2e4;
12178
- COMMUNITY_LESSON_LINKS_MAX = 10;
12179
- COMMUNITY_LESSON_URL_MAX_LENGTH = 2e3;
12180
- YOUTUBE_ID = /^[A-Za-z0-9_-]{11}$/;
12181
- YOUTUBE_HOSTS = /* @__PURE__ */ new Set(["youtube.com", "www.youtube.com", "m.youtube.com", "youtube-nocookie.com", "www.youtube-nocookie.com"]);
12182
- YOUTU_BE = "youtu.be";
12183
- YOUTUBE_ID_PATH = /^\/(?:embed|shorts|live|v)\/([A-Za-z0-9_-]{11})\/?$/;
12184
- communityCourseIdParam = external_exports.object({ communityId: uuidSchema, courseId: uuidSchema });
12185
- communityCourseModuleIdParam = external_exports.object({ communityId: uuidSchema, courseId: uuidSchema, moduleId: uuidSchema });
12186
- communityLessonIdParam = external_exports.object({ communityId: uuidSchema, courseId: uuidSchema, lessonId: uuidSchema });
12187
- communityCourseTitleSchema = external_exports.string().trim().min(1).max(COMMUNITY_COURSE_TITLE_MAX_LENGTH);
12188
- communityCourseDescriptionSchema = external_exports.string().trim().max(COMMUNITY_COURSE_DESCRIPTION_MAX_LENGTH);
12189
- communityCoursePositionSchema = external_exports.number().int().min(0);
12190
- communityLessonVideoUrlSchema = external_exports.string().trim().max(COMMUNITY_LESSON_URL_MAX_LENGTH).transform((url, ctx) => {
12191
- const video = parseCommunityLessonVideoUrl(url);
12192
- if (video) return video;
12193
- ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Only a YouTube video URL is accepted" });
12194
- return external_exports.NEVER;
12195
- });
12196
- communityLessonLinkSchema = external_exports.object({
12197
- title: communityCourseTitleSchema,
12198
- url: external_exports.string().trim().max(COMMUNITY_LESSON_URL_MAX_LENGTH).url().refine((url) => /^https?:\/\//i.test(url), "must be an http or https URL")
12199
- }).strict();
12200
- communityLessonLinksSchema = external_exports.array(communityLessonLinkSchema).max(COMMUNITY_LESSON_LINKS_MAX);
12201
- communityLessonBodySchema = external_exports.string().max(COMMUNITY_LESSON_BODY_MAX_LENGTH);
12202
- communityCourseCreateBody = external_exports.object({ title: communityCourseTitleSchema, description: communityCourseDescriptionSchema.optional(), client_id: uuidSchema.optional() }).strict();
12203
- communityCourseUpdateBody = external_exports.object({
12204
- title: communityCourseTitleSchema.optional(),
12205
- description: communityCourseDescriptionSchema.optional(),
12206
- position: communityCoursePositionSchema.optional(),
12207
- published: external_exports.boolean().optional()
12208
- }).strict().refine((b) => Object.values(b).some((value) => value !== void 0), "nothing to change");
12209
- communityModuleCreateBody = external_exports.object({ title: communityCourseTitleSchema, client_id: uuidSchema.optional() }).strict();
12210
- communityModuleUpdateBody = external_exports.object({ title: communityCourseTitleSchema.optional(), position: communityCoursePositionSchema.optional() }).strict().refine((b) => b.title !== void 0 || b.position !== void 0, "nothing to change");
12211
- communityLessonCreateBody = external_exports.object({
12212
- module_id: uuidSchema,
12213
- title: communityCourseTitleSchema,
12214
- video_url: communityLessonVideoUrlSchema.nullable().optional(),
12215
- body: communityLessonBodySchema.optional(),
12216
- links: communityLessonLinksSchema.optional(),
12217
- room_id: uuidSchema.nullable().optional(),
12218
- requires_paid_plan: external_exports.boolean().optional(),
12219
- published: external_exports.boolean().optional(),
12220
- client_id: uuidSchema.optional()
12221
- }).strict();
12222
- communityLessonUpdateBody = external_exports.object({
12223
- module_id: uuidSchema.optional(),
12224
- title: communityCourseTitleSchema.optional(),
12225
- video_url: communityLessonVideoUrlSchema.nullable().optional(),
12226
- body: communityLessonBodySchema.optional(),
12227
- links: communityLessonLinksSchema.optional(),
12228
- room_id: uuidSchema.nullable().optional(),
12229
- requires_paid_plan: external_exports.boolean().optional(),
12230
- position: communityCoursePositionSchema.optional(),
12231
- published: external_exports.boolean().optional()
12232
- }).strict().refine((b) => Object.values(b).some((value) => value !== void 0), "nothing to change");
12233
- }
12234
- });
12235
-
12236
12248
  // ../../packages/core/dist/chunk-YULHXJ5M.js
12237
12249
  var COMMUNITY_LESSON_TREE_MAX_BYTES, COMMUNITY_LESSON_LINK_PROTOCOLS, COMMUNITY_LESSON_TREE_TOO_LARGE_REASON, COMMUNITY_LESSON_TREE_TOO_DEEP_REASON, COMMUNITY_LESSON_LINE_PREFIX_TOO_WIDE_REASON, LINK_SCHEME;
12238
12250
  var init_chunk_YULHXJ5M = __esm({
@@ -12602,7 +12614,7 @@ var init_chunk_BPCNB5RT = __esm({
12602
12614
  }
12603
12615
  });
12604
12616
 
12605
- // ../../packages/core/dist/chunk-NEIVT3KL.js
12617
+ // ../../packages/core/dist/chunk-YWCYUPJV.js
12606
12618
  function toolParametersViolations(params) {
12607
12619
  try {
12608
12620
  if (containsKanbanPlaceholders(params)) return [];
@@ -12657,12 +12669,12 @@ function refineToolConfig(value, ctx) {
12657
12669
  }
12658
12670
  }
12659
12671
  var nonBlank, DEFAULT_TOOL_CONFIG_DESCRIPTION, toolIdParam, listToolsQuery, toolAgentQuery, deleteToolQuery, toolConnectionsQuery, nativeToolIdSchema, CONTEXT_BOUNDARIES, contextBoundarySchema, addNativeToolBody, addMcpToolBody, toolReplaySettingsFields, toolReplaySettingsSchema, createCustomToolBody, updateCustomToolBody, updateToolExecutionConfigBody;
12660
- var init_chunk_NEIVT3KL = __esm({
12661
- "../../packages/core/dist/chunk-NEIVT3KL.js"() {
12672
+ var init_chunk_YWCYUPJV = __esm({
12673
+ "../../packages/core/dist/chunk-YWCYUPJV.js"() {
12662
12674
  "use strict";
12663
12675
  init_chunk_WEXVYJ5H();
12664
12676
  init_chunk_HZ6CADSY();
12665
- init_chunk_GYSQV2DS();
12677
+ init_chunk_JHUTFQDO();
12666
12678
  init_zod();
12667
12679
  nonBlank = (text4) => typeof text4 === "string" && text4.trim() !== "" ? text4 : void 0;
12668
12680
  DEFAULT_TOOL_CONFIG_DESCRIPTION = "Function description";
@@ -12771,7 +12783,7 @@ var init_chunk_2ISUBJG7 = __esm({
12771
12783
  }
12772
12784
  });
12773
12785
 
12774
- // ../../packages/core/dist/chunk-IW7D2QOD.js
12786
+ // ../../packages/core/dist/chunk-CZEJR5UE.js
12775
12787
  function describeRole(role) {
12776
12788
  if (typeof role === "string") {
12777
12789
  return JSON.stringify(role.length > ROLE_ECHO_MAX ? `${role.slice(0, ROLE_ECHO_MAX)}\u2026` : role);
@@ -12950,11 +12962,11 @@ function terminalRunCount(counts) {
12950
12962
  return counts.successful_runs + counts.failed_runs;
12951
12963
  }
12952
12964
  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, EVAL_PERSON_MAX, evalPersonSchema, EVAL_PERSON_ALIAS_RETIRED, EVAL_PERSON_ALIAS_REFUSED, 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;
12953
- var init_chunk_IW7D2QOD = __esm({
12954
- "../../packages/core/dist/chunk-IW7D2QOD.js"() {
12965
+ var init_chunk_CZEJR5UE = __esm({
12966
+ "../../packages/core/dist/chunk-CZEJR5UE.js"() {
12955
12967
  "use strict";
12956
- init_chunk_2YEGUQR7();
12957
12968
  init_chunk_4D6K4P4K();
12969
+ init_chunk_2YEGUQR7();
12958
12970
  init_chunk_4LXDRTO4();
12959
12971
  init_chunk_WTOA3ANF();
12960
12972
  init_chunk_2ISUBJG7();
@@ -14028,7 +14040,7 @@ var init_chunk_7NQZRSSJ = __esm({
14028
14040
  }
14029
14041
  });
14030
14042
 
14031
- // ../../packages/core/dist/chunk-JJYZUBYV.js
14043
+ // ../../packages/core/dist/chunk-VMPEOBYP.js
14032
14044
  function declaresNoConnection(agent) {
14033
14045
  return agent.connection === null && !agent.connection_id;
14034
14046
  }
@@ -14042,12 +14054,15 @@ function customToolConnectionRefusal(agentName, tool) {
14042
14054
  return `Agent "${agentName}", tool "${tool.name}": connection is required. A custom tool calls through one of the hub's connections: name it.`;
14043
14055
  }
14044
14056
  function customToolConfigObject(config) {
14045
- if (typeof config !== "string") return config;
14046
- try {
14047
- return JSON.parse(config);
14048
- } catch {
14049
- return config;
14057
+ let read = config;
14058
+ for (let layer = 0; layer < MAX_CUSTOM_TOOL_CONFIG_TEXT_LAYERS && typeof read === "string"; layer++) {
14059
+ try {
14060
+ read = JSON.parse(read);
14061
+ } catch {
14062
+ return read;
14063
+ }
14050
14064
  }
14065
+ return read;
14051
14066
  }
14052
14067
  function customToolDescriptionAfterPush(entry, row, writtenConfig) {
14053
14068
  const written = row ? writtenConfig : entry.config;
@@ -14087,27 +14102,18 @@ function refineHubAsCodeCustomTools(config, ctx) {
14087
14102
  message: `custom tool "${printableName(tool?.name)}": ${issue.path.join(".")}: ${issue.message}`
14088
14103
  });
14089
14104
  }
14090
- const raw = tool?.config;
14091
- if (raw == null) continue;
14092
- const params = extractToolParameters(raw);
14093
- if (params === void 0) {
14094
- const looksLikeObject = raw !== null && typeof raw === "object" && !Array.isArray(raw) || typeof raw === "string" && (() => {
14095
- try {
14096
- const parsed = JSON.parse(raw);
14097
- return parsed !== null && typeof parsed === "object" && !Array.isArray(parsed);
14098
- } catch {
14099
- return false;
14100
- }
14101
- })();
14102
- if (!looksLikeObject) {
14103
- ctx.addIssue({
14104
- code: external_exports.ZodIssueCode.custom,
14105
- path: ["agents", a, "tools", "custom", c, "config"],
14106
- message: `custom tool "${printableName(tool?.name)}": config must be an object`
14107
- });
14108
- }
14105
+ if (tool?.config == null) continue;
14106
+ const raw = customToolConfigObject(tool.config);
14107
+ if (!isPlainObject(raw)) {
14108
+ ctx.addIssue({
14109
+ code: external_exports.ZodIssueCode.custom,
14110
+ path: ["agents", a, "tools", "custom", c, "config"],
14111
+ message: `custom tool "${printableName(tool?.name)}": config must be an object`
14112
+ });
14109
14113
  continue;
14110
14114
  }
14115
+ const params = extractToolParameters(raw);
14116
+ if (params === void 0) continue;
14111
14117
  for (const err of toolParametersViolations(params)) {
14112
14118
  const tail = err.path.split(".").filter(Boolean);
14113
14119
  ctx.addIssue({
@@ -14709,13 +14715,7 @@ function refusedStringConfigNesting(config, ctx) {
14709
14715
  const custom2 = isPlainObject(agent) && isPlainObject(agent.tools) ? agent.tools.custom : void 0;
14710
14716
  return Array.isArray(custom2) && custom2.some((tool, t) => {
14711
14717
  if (!isPlainObject(tool) || typeof tool.config !== "string") return false;
14712
- let parsed;
14713
- try {
14714
- parsed = JSON.parse(tool.config);
14715
- } catch {
14716
- return false;
14717
- }
14718
- return refusedNesting(parsed, ["agents", a, "tools", "custom", t, "config"], ctx);
14718
+ return refusedNesting(customToolConfigObject(tool.config), ["agents", a, "tools", "custom", t, "config"], ctx);
14719
14719
  });
14720
14720
  });
14721
14721
  }
@@ -14782,25 +14782,25 @@ function skillSectionsAsResources(scope) {
14782
14782
  return out;
14783
14783
  };
14784
14784
  }
14785
- 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, HUB_AS_CODE_AGENT_TOOL_KEYS, hubAsCodeStateSchema, hubAsCodeResourceFileSchema, hubAsCodeResourceSchema, uuidPattern, ciUuidSchema, flagEntriesOf, boundedHubAsCodeResourcesSchema, isPlainObject, MIN_SKILLS_LAYOUT_CLI, MAX_HUB_AS_CODE_DEPTH, NAMED_DEPTH_SEGMENTS, NAMED_DEPTH_KEY_CHARS, fieldName, 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;
14786
- var init_chunk_JJYZUBYV = __esm({
14787
- "../../packages/core/dist/chunk-JJYZUBYV.js"() {
14785
+ 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_CUSTOM_TOOL_CONFIG_TEXT_LAYERS, MAX_CALL_OPENING_CARRIERS, MAX_CALL_OPENING_AGGREGATE_ENCODED_BYTES, HUB_AS_CODE_AGENT_TOOL_KEYS, hubAsCodeStateSchema, hubAsCodeResourceFileSchema, hubAsCodeResourceSchema, uuidPattern, ciUuidSchema, flagEntriesOf, boundedHubAsCodeResourcesSchema, isPlainObject, MIN_SKILLS_LAYOUT_CLI, MAX_HUB_AS_CODE_DEPTH, NAMED_DEPTH_SEGMENTS, NAMED_DEPTH_KEY_CHARS, fieldName, 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;
14786
+ var init_chunk_VMPEOBYP = __esm({
14787
+ "../../packages/core/dist/chunk-VMPEOBYP.js"() {
14788
14788
  "use strict";
14789
- init_chunk_NEIVT3KL();
14789
+ init_chunk_YWCYUPJV();
14790
14790
  init_chunk_HRKVCI5A();
14791
- init_chunk_IW7D2QOD();
14791
+ init_chunk_CZEJR5UE();
14792
14792
  init_chunk_LBDH7LCG();
14793
14793
  init_chunk_4LXDRTO4();
14794
14794
  init_chunk_7NQZRSSJ();
14795
14795
  init_chunk_X5PZZVTS();
14796
14796
  init_chunk_K5UAZWFF();
14797
- init_chunk_OXVMTY3G();
14797
+ init_chunk_OAWG66J3();
14798
14798
  init_chunk_S4VDZ7PZ();
14799
14799
  init_chunk_C2UEA2KW();
14800
14800
  init_chunk_FBV7NLKO();
14801
14801
  init_chunk_WEXVYJ5H();
14802
14802
  init_chunk_HZ6CADSY();
14803
- init_chunk_J75LDBC2();
14803
+ init_chunk_BLPYDZAO();
14804
14804
  init_chunk_YROEDMVZ();
14805
14805
  init_zod();
14806
14806
  MAX_10MB_BASE64_ENCODED_BYTES = Math.ceil(MAX_RESOURCE_FILE_SIZE / 3) * 4 + 16;
@@ -14821,6 +14821,7 @@ var init_chunk_JJYZUBYV = __esm({
14821
14821
  }),
14822
14822
  html: external_exports.string().max(PAGE_HTML_MAX_BYTES, `a page's HTML is at most ${PAGE_HTML_MAX_BYTES / 1024} KiB`)
14823
14823
  }).strict()).max(PAGES_PER_HUB_MAX, `a hub holds at most ${PAGES_PER_HUB_MAX} pages`);
14824
+ MAX_CUSTOM_TOOL_CONFIG_TEXT_LAYERS = 16;
14824
14825
  MAX_CALL_OPENING_CARRIERS = 30;
14825
14826
  MAX_CALL_OPENING_AGGREGATE_ENCODED_BYTES = 8 * 1024 * 1024;
14826
14827
  HUB_AS_CODE_AGENT_TOOL_KEYS = [
@@ -15167,10 +15168,10 @@ var init_chunk_BFG4ZWR4 = __esm({
15167
15168
  }
15168
15169
  });
15169
15170
 
15170
- // ../../packages/core/dist/chunk-SAMZLA2A.js
15171
+ // ../../packages/core/dist/chunk-4J5DPB3X.js
15171
15172
  var dataExplorerDebugDoType, DEBUG_READ_MAX_LIMIT, DEBUG_READ_DEFAULT_LIMIT;
15172
- var init_chunk_SAMZLA2A = __esm({
15173
- "../../packages/core/dist/chunk-SAMZLA2A.js"() {
15173
+ var init_chunk_4J5DPB3X = __esm({
15174
+ "../../packages/core/dist/chunk-4J5DPB3X.js"() {
15174
15175
  "use strict";
15175
15176
  init_zod();
15176
15177
  dataExplorerDebugDoType = external_exports.enum(["hub", "org", "conversation", "user", "platform", "thread", "community", "contact_book", "batch"]);
@@ -15281,7 +15282,7 @@ var init_chunk_OMPT4ZHR = __esm({
15281
15282
  }
15282
15283
  });
15283
15284
 
15284
- // ../../packages/core/dist/chunk-ZECCDXFH.js
15285
+ // ../../packages/core/dist/chunk-2IAHI2UA.js
15285
15286
  function refineScopedTarget(data, ctx) {
15286
15287
  if (data.scope === "org") {
15287
15288
  if (!data.org_id) {
@@ -15307,12 +15308,12 @@ function refineScopedTarget(data, ctx) {
15307
15308
  }
15308
15309
  }
15309
15310
  var adminOrgIdParam, adminOrgAdminIdParam, adminUserIdParam, PRICING_PLAN_ID_RE, adminPlanIdParam, adminOrganizationsQuery, adminUserSearchQuery, kanbanSlugMigrationQuery, adjustQuotaBody, updatePlanBody, addAdminUserBody, MAX_VOICE_CALL_MINUTE_OPS, voiceCallMinuteOps, AUTOMATION_GATE_EVALUATIONS_PER_OPERATION_BOUND, automationGateEvaluationsPerOperation, AUTOMATION_RUN_RETENTION_DAYS_MAX, automationRunRetentionDays, turnDeadlineSeconds, updatePlatformConfigBody, updateFreeOrgLimitBody, adminScopedTargetShape, adminScopedTargetBody, adminDryRunByDefaultTargetBody, BRANCHING_ORPHAN_ENTITY_TYPES, BRANCHING_ORPHAN_MAX_TARGETS, adminRepairBranchingOrphansBody, adminRepairLegacyOrgGrantsBody, adminRepairCompedPlansBody, updatePricingPlanBody, dataExplorerSearchQuery, dataExplorerOrgIdParam, dataExplorerHubIdParam, dataExplorerConvIdParam, dataExplorerDoInstancesQuery, dataExplorerNsIdParam, dataExplorerKvKeysBody, dataExplorerKvKeyBody, uuidOrHexId, dataExplorerDeleteOrgParam, dataExplorerDeleteHubParam, dataExplorerDeleteConvParam, dataExplorerDeleteUserParam, dataExplorerDeleteQuery, dataExplorerKvDeleteBody, pitrDoNamespace, pitrBookmarkParam, pitrRestoreBody, healthSamplingTriggerBody, DEBUG_DO_HEX_PREFIX, debugDoEntityId, debugTableName, dataExplorerDebugTablesParam, dataExplorerDebugRowsParam, dataExplorerDebugRowsQuery, dataExplorerDebugAnalyticsTable, debugUuid, dataExplorerDebugAnalyticsRowsParam, dataExplorerDebugAnalyticsRowsQuery, dataExplorerDebugCountsDoType, dataExplorerDebugCountsParam, debugHubConvParam, debugMessageIdQuery;
15310
- var init_chunk_ZECCDXFH = __esm({
15311
- "../../packages/core/dist/chunk-ZECCDXFH.js"() {
15311
+ var init_chunk_2IAHI2UA = __esm({
15312
+ "../../packages/core/dist/chunk-2IAHI2UA.js"() {
15312
15313
  "use strict";
15313
15314
  init_chunk_FECLIZTY();
15314
15315
  init_chunk_BFG4ZWR4();
15315
- init_chunk_SAMZLA2A();
15316
+ init_chunk_4J5DPB3X();
15316
15317
  init_chunk_7NQZRSSJ();
15317
15318
  init_chunk_OMPT4ZHR();
15318
15319
  init_chunk_HZ6CADSY();
@@ -15451,6 +15452,13 @@ var init_chunk_ZECCDXFH = __esm({
15451
15452
  automation_run_retention_days: automationRunRetentionDays.optional(),
15452
15453
  /** How long a native agent turn may run (`turnDeadlineSeconds`). */
15453
15454
  turn_deadline_seconds: turnDeadlineSeconds.optional(),
15455
+ /**
15456
+ * The catalog connectors (`connector_id`) whose new credentials go to the credentials vault
15457
+ * (wayai#5644), replacing the whole list. Empty is the default: every connector on the existing
15458
+ * path. The route stores it as JSON (`durable-objects/platform-do/vault-gate.ts`). An id no
15459
+ * connector has matches nothing, so it leaves that connector off.
15460
+ */
15461
+ vault_connector_ids: external_exports.array(uuidSchema).max(200).optional(),
15454
15462
  /**
15455
15463
  * The mobile app version policy (`MOBILE_VERSION_POLICY_COLUMNS`), per platform: an install
15456
15464
  * below the minimum is blocked until it updates from the store; one below the recommended
@@ -15900,16 +15908,16 @@ var init_chunk_R6Y377AW = __esm({
15900
15908
  }
15901
15909
  });
15902
15910
 
15903
- // ../../packages/core/dist/chunk-AHOE4ZHH.js
15911
+ // ../../packages/core/dist/chunk-3QU3I3BQ.js
15904
15912
  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;
15905
- var init_chunk_AHOE4ZHH = __esm({
15906
- "../../packages/core/dist/chunk-AHOE4ZHH.js"() {
15913
+ var init_chunk_3QU3I3BQ = __esm({
15914
+ "../../packages/core/dist/chunk-3QU3I3BQ.js"() {
15907
15915
  "use strict";
15908
15916
  init_chunk_R6Y377AW();
15909
15917
  init_chunk_UAOHHCW5();
15910
- init_chunk_OXVMTY3G();
15911
- init_chunk_5XEJSR22();
15912
- init_chunk_J75LDBC2();
15918
+ init_chunk_OAWG66J3();
15919
+ init_chunk_5FO3GNKP();
15920
+ init_chunk_BLPYDZAO();
15913
15921
  init_chunk_YROEDMVZ();
15914
15922
  init_zod();
15915
15923
  AUTOMATION_TRIGGER_TYPES = ["schedule", "event", "webhook"];
@@ -16228,10 +16236,10 @@ var init_chunk_WFQDSQJK = __esm({
16228
16236
  }
16229
16237
  });
16230
16238
 
16231
- // ../../packages/core/dist/chunk-EV3MAOEX.js
16239
+ // ../../packages/core/dist/chunk-M53YHYIG.js
16232
16240
  var APP_ERROR_BRAND, AppError, PAGE_CUSTOMER_UNAVAILABLE_CODE, LLM_RATE_LIMIT_BRAND, LlmRateLimitError, LLM_PROVIDER_HTTP_BRAND, LlmProviderHttpError, LLM_PROVIDER_CONTENT_BRAND, LlmProviderContentError, LLM_PROVIDER_TIMEOUT_BRAND, LlmProviderTimeoutError, ExternalServiceError, CHANNEL_PROVIDER_HTTP_BRAND, ChannelProviderHttpError, MEDIA_PROVIDER_HTTP_BRAND, MediaProviderHttpError;
16233
- var init_chunk_EV3MAOEX = __esm({
16234
- "../../packages/core/dist/chunk-EV3MAOEX.js"() {
16241
+ var init_chunk_M53YHYIG = __esm({
16242
+ "../../packages/core/dist/chunk-M53YHYIG.js"() {
16235
16243
  "use strict";
16236
16244
  init_chunk_WFQDSQJK();
16237
16245
  APP_ERROR_BRAND = /* @__PURE__ */ Symbol.for("wayai.AppError");
@@ -16345,42 +16353,43 @@ var init_chunk_EV3MAOEX = __esm({
16345
16353
  var init_contracts = __esm({
16346
16354
  "../../packages/core/dist/contracts/index.js"() {
16347
16355
  "use strict";
16356
+ init_chunk_Q7KIQHAZ();
16357
+ init_chunk_NKLVUTFO();
16348
16358
  init_chunk_WL5QGKHN();
16349
16359
  init_chunk_YVY2TZK2();
16350
16360
  init_chunk_VXEAR36B();
16351
16361
  init_chunk_RACEDHG6();
16352
- init_chunk_Q7KIQHAZ();
16362
+ init_chunk_HIGKBEPF();
16353
16363
  init_chunk_HA7CRZMX();
16354
16364
  init_chunk_MF2VVXBR();
16355
16365
  init_chunk_IPXBFWUU();
16356
- init_chunk_NKLVUTFO();
16366
+ init_chunk_VEERWOZ6();
16357
16367
  init_chunk_5YNUTCJ2();
16358
16368
  init_chunk_ZC6YGHNX();
16359
- init_chunk_HIGKBEPF();
16360
16369
  init_chunk_5DGHIY7L();
16361
- init_chunk_S447DV3E();
16370
+ init_chunk_YFHL2BKN();
16362
16371
  init_chunk_IPDOHAZ5();
16363
16372
  init_chunk_GPM7PE44();
16364
- init_chunk_VEERWOZ6();
16373
+ init_chunk_NZ6RQW6R();
16374
+ init_chunk_2DXRB6DR();
16365
16375
  init_chunk_ZXK6N2HN();
16366
16376
  init_chunk_Y7CFCYX4();
16367
16377
  init_chunk_MGBAXT5Y();
16368
16378
  init_chunk_YUZFHVB2();
16369
16379
  init_chunk_I3O2RACG();
16380
+ init_chunk_CMRECH67();
16370
16381
  init_chunk_34LE6P7E();
16371
16382
  init_chunk_FPSDNS2E();
16372
- init_chunk_NZ6RQW6R();
16373
- init_chunk_2DXRB6DR();
16374
16383
  init_chunk_OPETF4GS();
16375
16384
  init_chunk_SY6PLCPK();
16376
16385
  init_chunk_KMAC3O3L();
16377
- init_chunk_CQTU636K();
16386
+ init_chunk_HL6QCLLK();
16378
16387
  init_chunk_KSTYTQ7I();
16379
16388
  init_chunk_LKBSHANA();
16380
16389
  init_chunk_Y6NC5CH5();
16381
16390
  init_chunk_C4HEZ7ZI();
16382
16391
  init_chunk_IR2NOSI3();
16383
- init_chunk_47LPEX74();
16392
+ init_chunk_UCYWGWQT();
16384
16393
  init_chunk_6AYIXGDT();
16385
16394
  init_chunk_YULHXJ5M();
16386
16395
  init_chunk_V4FRPRH5();
@@ -16392,20 +16401,20 @@ var init_contracts = __esm({
16392
16401
  init_chunk_E4DIIOOE();
16393
16402
  init_chunk_7CYHPF35();
16394
16403
  init_chunk_BPCNB5RT();
16395
- init_chunk_JJYZUBYV();
16396
- init_chunk_NEIVT3KL();
16404
+ init_chunk_VMPEOBYP();
16405
+ init_chunk_YWCYUPJV();
16397
16406
  init_chunk_HRKVCI5A();
16398
- init_chunk_IW7D2QOD();
16399
- init_chunk_2YEGUQR7();
16407
+ init_chunk_CZEJR5UE();
16400
16408
  init_chunk_4D6K4P4K();
16409
+ init_chunk_2YEGUQR7();
16401
16410
  init_chunk_LBDH7LCG();
16402
16411
  init_chunk_4LXDRTO4();
16403
16412
  init_chunk_JDJ4EUOL();
16404
16413
  init_chunk_NVKU5PPQ();
16405
- init_chunk_ZECCDXFH();
16414
+ init_chunk_2IAHI2UA();
16406
16415
  init_chunk_FECLIZTY();
16407
16416
  init_chunk_BFG4ZWR4();
16408
- init_chunk_SAMZLA2A();
16417
+ init_chunk_4J5DPB3X();
16409
16418
  init_chunk_7NQZRSSJ();
16410
16419
  init_chunk_D3EP4TDU();
16411
16420
  init_chunk_X5PZZVTS();
@@ -16413,16 +16422,16 @@ var init_contracts = __esm({
16413
16422
  init_chunk_2PZIF56U();
16414
16423
  init_chunk_UEJOG2Q7();
16415
16424
  init_chunk_JO53JB35();
16416
- init_chunk_AHOE4ZHH();
16425
+ init_chunk_3QU3I3BQ();
16417
16426
  init_chunk_R6Y377AW();
16418
16427
  init_chunk_UAOHHCW5();
16419
- init_chunk_OXVMTY3G();
16428
+ init_chunk_OAWG66J3();
16420
16429
  init_chunk_IG6QBZMA();
16421
16430
  init_chunk_OMPT4ZHR();
16422
- init_chunk_3VCB2RTC();
16431
+ init_chunk_JSLX2PRT();
16423
16432
  init_chunk_SOJMWM63();
16424
16433
  init_chunk_WTOA3ANF();
16425
- init_chunk_5XEJSR22();
16434
+ init_chunk_5FO3GNKP();
16426
16435
  init_chunk_IBL7FANV();
16427
16436
  init_chunk_S4VDZ7PZ();
16428
16437
  init_chunk_KB5RK3RP();
@@ -16439,14 +16448,14 @@ var init_contracts = __esm({
16439
16448
  init_chunk_WEXVYJ5H();
16440
16449
  init_chunk_6TSQ5HXC();
16441
16450
  init_chunk_HZ6CADSY();
16442
- init_chunk_J75LDBC2();
16443
- init_chunk_VSSZVDBU();
16444
- init_chunk_GYSQV2DS();
16451
+ init_chunk_BLPYDZAO();
16452
+ init_chunk_DOGCOC6X();
16453
+ init_chunk_JHUTFQDO();
16445
16454
  init_chunk_I42QJGJF();
16446
16455
  init_chunk_MIWZOSPI();
16447
16456
  init_chunk_YROEDMVZ();
16448
16457
  init_chunk_L5F7ZOUJ();
16449
- init_chunk_EV3MAOEX();
16458
+ init_chunk_M53YHYIG();
16450
16459
  init_chunk_WFQDSQJK();
16451
16460
  }
16452
16461
  });
@@ -16521,10 +16530,10 @@ var init_chunk_RPGBR5IN = __esm({
16521
16530
  }
16522
16531
  });
16523
16532
 
16524
- // ../../packages/core/dist/chunk-OMK3L45Z.js
16533
+ // ../../packages/core/dist/chunk-FZ7BJJW7.js
16525
16534
  var ENVELOPE_PREFIX, CREDENTIAL_REFERENCE_PREFIX;
16526
- var init_chunk_OMK3L45Z = __esm({
16527
- "../../packages/core/dist/chunk-OMK3L45Z.js"() {
16535
+ var init_chunk_FZ7BJJW7 = __esm({
16536
+ "../../packages/core/dist/chunk-FZ7BJJW7.js"() {
16528
16537
  "use strict";
16529
16538
  ENVELOPE_PREFIX = "enc:v1:";
16530
16539
  CREDENTIAL_REFERENCE_PREFIX = `${ENVELOPE_PREFIX}vault:`;
@@ -16583,10 +16592,10 @@ var UUID_RE2, WAYAI_WORKSPACE_LAYOUT;
16583
16592
  var init_dist = __esm({
16584
16593
  "../../packages/core/dist/index.js"() {
16585
16594
  "use strict";
16586
- init_chunk_3VCB2RTC();
16595
+ init_chunk_JSLX2PRT();
16587
16596
  init_chunk_SOJMWM63();
16588
16597
  init_chunk_WTOA3ANF();
16589
- init_chunk_5XEJSR22();
16598
+ init_chunk_5FO3GNKP();
16590
16599
  init_chunk_IBL7FANV();
16591
16600
  init_chunk_S4VDZ7PZ();
16592
16601
  init_chunk_KB5RK3RP();
@@ -16601,15 +16610,15 @@ var init_dist = __esm({
16601
16610
  init_chunk_WEXVYJ5H();
16602
16611
  init_chunk_6TSQ5HXC();
16603
16612
  init_chunk_HZ6CADSY();
16604
- init_chunk_OMK3L45Z();
16605
- init_chunk_J75LDBC2();
16606
- init_chunk_VSSZVDBU();
16607
- init_chunk_GYSQV2DS();
16613
+ init_chunk_FZ7BJJW7();
16614
+ init_chunk_BLPYDZAO();
16615
+ init_chunk_DOGCOC6X();
16616
+ init_chunk_JHUTFQDO();
16608
16617
  init_chunk_I42QJGJF();
16609
16618
  init_chunk_MIWZOSPI();
16610
16619
  init_chunk_YROEDMVZ();
16611
16620
  init_chunk_L5F7ZOUJ();
16612
- init_chunk_EV3MAOEX();
16621
+ init_chunk_M53YHYIG();
16613
16622
  init_chunk_WFQDSQJK();
16614
16623
  UUID_RE2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
16615
16624
  WAYAI_WORKSPACE_LAYOUT = {
@@ -21662,7 +21671,7 @@ var init_pages = __esm({
21662
21671
  init_chunk_FBV7NLKO();
21663
21672
  init_chunk_WEXVYJ5H();
21664
21673
  init_chunk_HZ6CADSY();
21665
- init_chunk_EV3MAOEX();
21674
+ init_chunk_M53YHYIG();
21666
21675
  init_chunk_WFQDSQJK();
21667
21676
  }
21668
21677
  });
@@ -21728,9 +21737,9 @@ var init_pages2 = __esm({
21728
21737
  var init_evals = __esm({
21729
21738
  "../../packages/core/dist/contracts/evals.js"() {
21730
21739
  "use strict";
21731
- init_chunk_IW7D2QOD();
21732
- init_chunk_2YEGUQR7();
21740
+ init_chunk_CZEJR5UE();
21733
21741
  init_chunk_4D6K4P4K();
21742
+ init_chunk_2YEGUQR7();
21734
21743
  init_chunk_4LXDRTO4();
21735
21744
  init_chunk_WTOA3ANF();
21736
21745
  init_chunk_KB5RK3RP();
@@ -22756,19 +22765,19 @@ var init_hub_materializer = __esm({
22756
22765
  var init_ci = __esm({
22757
22766
  "../../packages/core/dist/contracts/ci.js"() {
22758
22767
  "use strict";
22759
- init_chunk_JJYZUBYV();
22760
- init_chunk_NEIVT3KL();
22768
+ init_chunk_VMPEOBYP();
22769
+ init_chunk_YWCYUPJV();
22761
22770
  init_chunk_HRKVCI5A();
22762
- init_chunk_IW7D2QOD();
22763
- init_chunk_2YEGUQR7();
22771
+ init_chunk_CZEJR5UE();
22764
22772
  init_chunk_4D6K4P4K();
22773
+ init_chunk_2YEGUQR7();
22765
22774
  init_chunk_LBDH7LCG();
22766
22775
  init_chunk_4LXDRTO4();
22767
22776
  init_chunk_7NQZRSSJ();
22768
22777
  init_chunk_D3EP4TDU();
22769
22778
  init_chunk_X5PZZVTS();
22770
22779
  init_chunk_K5UAZWFF();
22771
- init_chunk_OXVMTY3G();
22780
+ init_chunk_OAWG66J3();
22772
22781
  init_chunk_WTOA3ANF();
22773
22782
  init_chunk_IBL7FANV();
22774
22783
  init_chunk_S4VDZ7PZ();
@@ -22780,14 +22789,14 @@ var init_ci = __esm({
22780
22789
  init_chunk_WEXVYJ5H();
22781
22790
  init_chunk_6TSQ5HXC();
22782
22791
  init_chunk_HZ6CADSY();
22783
- init_chunk_J75LDBC2();
22784
- init_chunk_VSSZVDBU();
22785
- init_chunk_GYSQV2DS();
22792
+ init_chunk_BLPYDZAO();
22793
+ init_chunk_DOGCOC6X();
22794
+ init_chunk_JHUTFQDO();
22786
22795
  init_chunk_I42QJGJF();
22787
22796
  init_chunk_MIWZOSPI();
22788
22797
  init_chunk_YROEDMVZ();
22789
22798
  init_chunk_L5F7ZOUJ();
22790
- init_chunk_EV3MAOEX();
22799
+ init_chunk_M53YHYIG();
22791
22800
  init_chunk_WFQDSQJK();
22792
22801
  }
22793
22802
  });
@@ -27724,6 +27733,10 @@ function resolveHeld(id, name, held) {
27724
27733
  if (id && held?.some((h) => h.id === id)) return id;
27725
27734
  return held?.find((h) => name !== void 0 && h.name === name)?.id;
27726
27735
  }
27736
+ function pulledHubId(name, pulled) {
27737
+ const ids = new Set((pulled.agents ?? []).flatMap((a) => a.tools?.delegation ?? []).filter((row) => row.type === "hub" && row.target === name && row.target_id).map((row) => row.target_id));
27738
+ return ids.size === 1 ? [...ids][0] : void 0;
27739
+ }
27727
27740
  function entriesWithNoRow(entries, rows, identity2, pulled) {
27728
27741
  const keys = entries.map((entry) => identity2.key(entry, pulled));
27729
27742
  const rowKeys = new Set(rows.map((row) => identity2.rowKey(row)));
@@ -28038,7 +28051,7 @@ var init_push = __esm({
28038
28051
  },
28039
28052
  delegation: {
28040
28053
  key: (entry, pulled) => {
28041
- const target = entry.type === "agent" ? resolveHeld(entry.target_id, entry.target, pulled.agents) : entry.type === "team" ? resolveHeld(entry.target_id, entry.target, pulled.teams) : entry.target_id;
28054
+ const target = entry.type === "agent" ? resolveHeld(entry.target_id, entry.target, pulled.agents) : entry.type === "team" ? resolveHeld(entry.target_id, entry.target, pulled.teams) : entry.target_id ?? pulledHubId(entry.target, pulled);
28042
28055
  if (target === void 0 && entry.type === "hub") return null;
28043
28056
  return `${entry.tool}:${entry.type}:${target ?? `name:${entry.target}`}`;
28044
28057
  },
@@ -39459,7 +39472,7 @@ Usage:
39459
39472
  wayai admin do tables <type> <id>
39460
39473
  wayai admin do read <type> <id> <table> [--limit N] [--id X] [--json]
39461
39474
  wayai admin do counts <hub|org> <id> [--json] Numbers, no text: a hub's toolset connections, knowledge placeholders per stored
39462
- text, summary schemas' invariant verdicts, secret columns' shapes and
39475
+ text, summary and kanban context schemas' verdicts, secret columns' shapes and
39463
39476
  (production) publish state; an org's
39464
39477
  skills, hub links, moved-knowledge registry and credentials' shapes
39465
39478