@wayai/cli 0.3.311 → 0.3.313

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
@@ -5354,6 +5354,80 @@ var init_chunk_Q7KIQHAZ = __esm({
5354
5354
  }
5355
5355
  });
5356
5356
 
5357
+ // ../../packages/core/dist/chunk-IPXBFWUU.js
5358
+ var variantAiModeSchema, experimentStatusSchema, overlayUpdateSchema, experimentIdParam, variantIdParam, listExperimentsQuery, listVariantsQuery, listOverridesQuery, deleteOverrideQuery, createExperimentBody, updateExperimentBody, setExperimentStatusBody, createVariantBody, updateVariantBody, upsertOverrideBody;
5359
+ var init_chunk_IPXBFWUU = __esm({
5360
+ "../../packages/core/dist/chunk-IPXBFWUU.js"() {
5361
+ "use strict";
5362
+ init_chunk_6TSQ5HXC();
5363
+ init_zod();
5364
+ variantAiModeSchema = external_exports.enum(["pilot+copilot", "pilot", "copilot", "turned_off"]);
5365
+ experimentStatusSchema = external_exports.enum(["draft", "running", "stopped"]);
5366
+ overlayUpdateSchema = external_exports.record(external_exports.unknown()).nullish().transform((v) => v === void 0 ? void 0 : v && Object.keys(v).length > 0 ? v : null);
5367
+ experimentIdParam = external_exports.object({
5368
+ id: external_exports.string().uuid()
5369
+ });
5370
+ variantIdParam = external_exports.object({
5371
+ id: external_exports.string().uuid()
5372
+ });
5373
+ listExperimentsQuery = external_exports.object({
5374
+ hub_id: external_exports.string().uuid()
5375
+ });
5376
+ listVariantsQuery = external_exports.object({
5377
+ hub_id: external_exports.string().uuid(),
5378
+ experiment_id: external_exports.string().uuid().optional()
5379
+ });
5380
+ listOverridesQuery = external_exports.object({
5381
+ hub_id: external_exports.string().uuid(),
5382
+ variant_id: external_exports.string().uuid()
5383
+ });
5384
+ deleteOverrideQuery = external_exports.object({
5385
+ hub_id: external_exports.string().uuid(),
5386
+ variant_id: external_exports.string().uuid(),
5387
+ agent_id: external_exports.string().uuid()
5388
+ });
5389
+ createExperimentBody = external_exports.object({
5390
+ hub_id: external_exports.string().uuid(),
5391
+ experiment_slug: slugSchema.optional(),
5392
+ experiment_name: external_exports.string().min(1, "experiment_name is required").max(100, "experiment_name must be 100 characters or fewer"),
5393
+ primary_metric: external_exports.string().max(200).nullish(),
5394
+ status: experimentStatusSchema.default("draft")
5395
+ });
5396
+ updateExperimentBody = external_exports.object({
5397
+ // experiment_slug is immutable after first persist — not accepted here.
5398
+ experiment_name: external_exports.string().min(1).max(100).optional(),
5399
+ primary_metric: external_exports.string().max(200).nullish(),
5400
+ control_variant_id: external_exports.string().uuid().nullish()
5401
+ });
5402
+ setExperimentStatusBody = external_exports.object({
5403
+ status: experimentStatusSchema
5404
+ });
5405
+ createVariantBody = external_exports.object({
5406
+ hub_id: external_exports.string().uuid(),
5407
+ experiment_id: external_exports.string().uuid(),
5408
+ label: external_exports.string().min(1, "label is required").max(100, "label must be 100 characters or fewer"),
5409
+ weight: external_exports.number().positive().default(1),
5410
+ ai_mode: variantAiModeSchema.nullish(),
5411
+ is_control: external_exports.boolean().default(false)
5412
+ });
5413
+ updateVariantBody = external_exports.object({
5414
+ label: external_exports.string().min(1).max(100).optional(),
5415
+ weight: external_exports.number().positive().optional(),
5416
+ ai_mode: variantAiModeSchema.nullish(),
5417
+ is_control: external_exports.boolean().optional()
5418
+ });
5419
+ upsertOverrideBody = external_exports.object({
5420
+ hub_id: external_exports.string().uuid(),
5421
+ variant_id: external_exports.string().uuid(),
5422
+ agent_id: external_exports.string().uuid(),
5423
+ instructions: external_exports.string().nullish(),
5424
+ additional_context_template: external_exports.string().nullish(),
5425
+ connection_id: external_exports.string().uuid().nullish(),
5426
+ agent_settings_overlay: overlayUpdateSchema
5427
+ });
5428
+ }
5429
+ });
5430
+
5357
5431
  // ../../packages/core/dist/chunk-NKLVUTFO.js
5358
5432
  var BASE_CREDENTIAL_MANAGED_BY, BASE_CREDENTIAL_NAME_MAX, BASE_CREDENTIAL_NAME_PATTERN, BASE_CREDENTIAL_NAME_CHARSET, baseCredentialNameSchema, createBaseCredentialLinkBody, baseCredentialLinkParams, baseCredentialLinkQuery;
5359
5433
  var init_chunk_NKLVUTFO = __esm({
@@ -5753,76 +5827,21 @@ var init_chunk_HA7CRZMX = __esm({
5753
5827
  }
5754
5828
  });
5755
5829
 
5756
- // ../../packages/core/dist/chunk-IPXBFWUU.js
5757
- var variantAiModeSchema, experimentStatusSchema, overlayUpdateSchema, experimentIdParam, variantIdParam, listExperimentsQuery, listVariantsQuery, listOverridesQuery, deleteOverrideQuery, createExperimentBody, updateExperimentBody, setExperimentStatusBody, createVariantBody, updateVariantBody, upsertOverrideBody;
5758
- var init_chunk_IPXBFWUU = __esm({
5759
- "../../packages/core/dist/chunk-IPXBFWUU.js"() {
5830
+ // ../../packages/core/dist/chunk-WE4KMHZK.js
5831
+ var bootstrapQuery;
5832
+ var init_chunk_WE4KMHZK = __esm({
5833
+ "../../packages/core/dist/chunk-WE4KMHZK.js"() {
5760
5834
  "use strict";
5761
- init_chunk_6TSQ5HXC();
5762
5835
  init_zod();
5763
- variantAiModeSchema = external_exports.enum(["pilot+copilot", "pilot", "copilot", "turned_off"]);
5764
- experimentStatusSchema = external_exports.enum(["draft", "running", "stopped"]);
5765
- overlayUpdateSchema = external_exports.record(external_exports.unknown()).nullish().transform((v) => v === void 0 ? void 0 : v && Object.keys(v).length > 0 ? v : null);
5766
- experimentIdParam = external_exports.object({
5767
- id: external_exports.string().uuid()
5768
- });
5769
- variantIdParam = external_exports.object({
5770
- id: external_exports.string().uuid()
5771
- });
5772
- listExperimentsQuery = external_exports.object({
5773
- hub_id: external_exports.string().uuid()
5774
- });
5775
- listVariantsQuery = external_exports.object({
5776
- hub_id: external_exports.string().uuid(),
5777
- experiment_id: external_exports.string().uuid().optional()
5778
- });
5779
- listOverridesQuery = external_exports.object({
5780
- hub_id: external_exports.string().uuid(),
5781
- variant_id: external_exports.string().uuid()
5782
- });
5783
- deleteOverrideQuery = external_exports.object({
5784
- hub_id: external_exports.string().uuid(),
5785
- variant_id: external_exports.string().uuid(),
5786
- agent_id: external_exports.string().uuid()
5787
- });
5788
- createExperimentBody = external_exports.object({
5789
- hub_id: external_exports.string().uuid(),
5790
- experiment_slug: slugSchema.optional(),
5791
- experiment_name: external_exports.string().min(1, "experiment_name is required").max(100, "experiment_name must be 100 characters or fewer"),
5792
- primary_metric: external_exports.string().max(200).nullish(),
5793
- status: experimentStatusSchema.default("draft")
5794
- });
5795
- updateExperimentBody = external_exports.object({
5796
- // experiment_slug is immutable after first persist — not accepted here.
5797
- experiment_name: external_exports.string().min(1).max(100).optional(),
5798
- primary_metric: external_exports.string().max(200).nullish(),
5799
- control_variant_id: external_exports.string().uuid().nullish()
5800
- });
5801
- setExperimentStatusBody = external_exports.object({
5802
- status: experimentStatusSchema
5803
- });
5804
- createVariantBody = external_exports.object({
5805
- hub_id: external_exports.string().uuid(),
5806
- experiment_id: external_exports.string().uuid(),
5807
- label: external_exports.string().min(1, "label is required").max(100, "label must be 100 characters or fewer"),
5808
- weight: external_exports.number().positive().default(1),
5809
- ai_mode: variantAiModeSchema.nullish(),
5810
- is_control: external_exports.boolean().default(false)
5811
- });
5812
- updateVariantBody = external_exports.object({
5813
- label: external_exports.string().min(1).max(100).optional(),
5814
- weight: external_exports.number().positive().optional(),
5815
- ai_mode: variantAiModeSchema.nullish(),
5816
- is_control: external_exports.boolean().optional()
5817
- });
5818
- upsertOverrideBody = external_exports.object({
5819
- hub_id: external_exports.string().uuid(),
5820
- variant_id: external_exports.string().uuid(),
5821
- agent_id: external_exports.string().uuid(),
5822
- instructions: external_exports.string().nullish(),
5823
- additional_context_template: external_exports.string().nullish(),
5824
- connection_id: external_exports.string().uuid().nullish(),
5825
- agent_settings_overlay: overlayUpdateSchema
5836
+ bootstrapQuery = external_exports.object({
5837
+ active_hub_id: external_exports.string().uuid().optional(),
5838
+ active_conversation_id: external_exports.string().uuid().optional(),
5839
+ active_nav: external_exports.enum(["chat", "task", "support"]).optional(),
5840
+ /**
5841
+ * The people thread the URL names (`/chat/threads/:threadId`, gh #4661): the snapshot
5842
+ * preloads it as `people.active_thread` when the viewer is a member.
5843
+ */
5844
+ active_thread_id: external_exports.string().uuid().optional()
5826
5845
  });
5827
5846
  }
5828
5847
  });
@@ -6476,6 +6495,231 @@ var init_chunk_ZC6YGHNX = __esm({
6476
6495
  }
6477
6496
  });
6478
6497
 
6498
+ // ../../packages/core/dist/chunk-2YEGUQR7.js
6499
+ var PERSON_ID_PATTERN, CONTACT_PERSON_ID_PATTERN, PERSON_ID_FORM_MESSAGE, userPersonIdSchema, personIdSchema;
6500
+ var init_chunk_2YEGUQR7 = __esm({
6501
+ "../../packages/core/dist/chunk-2YEGUQR7.js"() {
6502
+ "use strict";
6503
+ init_zod();
6504
+ PERSON_ID_PATTERN = /^prs_[a-z2-7]{52}$/;
6505
+ CONTACT_PERSON_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
6506
+ PERSON_ID_FORM_MESSAGE = "Must be a person id (prs_\u2026) or a contact id (a lowercase UUID)";
6507
+ userPersonIdSchema = external_exports.string().regex(PERSON_ID_PATTERN, { message: "Must be a person id (prs_\u2026)" });
6508
+ personIdSchema = external_exports.string().refine(
6509
+ (value) => PERSON_ID_PATTERN.test(value) || CONTACT_PERSON_ID_PATTERN.test(value),
6510
+ { message: PERSON_ID_FORM_MESSAGE }
6511
+ );
6512
+ }
6513
+ });
6514
+
6515
+ // ../../packages/core/dist/chunk-UAOHHCW5.js
6516
+ function normalizeContactPhone(raw) {
6517
+ const compact = raw.trim().replace(/[\s\-.()]/g, "");
6518
+ const withPlus = compact.startsWith("00") ? `+${compact.slice(2)}` : compact;
6519
+ return /^\+[1-9]\d{7,14}$/.test(withPlus) ? withPlus : null;
6520
+ }
6521
+ function normalizeContactLabel(raw) {
6522
+ return raw.trim().replace(/\s+/g, " ").toLowerCase();
6523
+ }
6524
+ function importRowLabels(row, batchLabels) {
6525
+ return [.../* @__PURE__ */ new Set([...row.labels ?? [], ...batchLabels ?? []])];
6526
+ }
6527
+ 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;
6528
+ var init_chunk_UAOHHCW5 = __esm({
6529
+ "../../packages/core/dist/chunk-UAOHHCW5.js"() {
6530
+ "use strict";
6531
+ init_zod();
6532
+ CONTACT_ENVIRONMENTS = ["production", "preview", "all"];
6533
+ CONTACT_NAME_MAX = 200;
6534
+ CONTACT_EMAIL_MAX = 320;
6535
+ CONTACT_PHONE_INPUT_MAX = 40;
6536
+ CONTACT_INSTAGRAM_SID_MAX = 64;
6537
+ CONTACT_METADATA_MAX_BYTES = 4096;
6538
+ CONTACT_LABEL_MAX = 64;
6539
+ CONTACT_LABELS_MAX = 20;
6540
+ CONTACT_SCOPE_TAGS_MAX = 20;
6541
+ CONTACT_PAGE_MAX = 100;
6542
+ CONTACT_IMPORT_BATCH_MAX = 500;
6543
+ CONTACT_SEARCH_MAX = 100;
6544
+ CONTACT_LIST_NAME_MAX = 64;
6545
+ CONTACT_LIST_NAME_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
6546
+ CONTACT_LIST_DESCRIPTION_MAX = 1e3;
6547
+ CONTACT_LIST_FILTER_MAX = 20;
6548
+ CONTACT_LIST_PINS_PER_REQUEST_MAX = 100;
6549
+ SUPPRESSION_SCOPES = ["all", "marketing"];
6550
+ SUPPRESSION_ID_REGEX = /^[0-9a-f]{64}$/;
6551
+ contactName = external_exports.string().trim().min(1).max(CONTACT_NAME_MAX);
6552
+ contactPhone = external_exports.string().max(CONTACT_PHONE_INPUT_MAX).transform((raw, ctx) => {
6553
+ const phone = normalizeContactPhone(raw);
6554
+ if (phone === null) {
6555
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Phone must be an international number, e.g. +5511999999999" });
6556
+ return external_exports.NEVER;
6557
+ }
6558
+ return phone;
6559
+ });
6560
+ contactEmail = external_exports.string().trim().toLowerCase().max(CONTACT_EMAIL_MAX).email();
6561
+ contactInstagramSid = external_exports.string().trim().min(1).max(CONTACT_INSTAGRAM_SID_MAX);
6562
+ 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");
6563
+ contactLabels = external_exports.array(contactLabel).max(CONTACT_LABELS_MAX).transform((labels) => [...new Set(labels)]);
6564
+ contactMetadata = external_exports.record(external_exports.unknown()).refine((metadata) => {
6565
+ try {
6566
+ return new TextEncoder().encode(JSON.stringify(metadata)).length <= CONTACT_METADATA_MAX_BYTES;
6567
+ } catch {
6568
+ return false;
6569
+ }
6570
+ }, `Metadata must serialize to at most ${CONTACT_METADATA_MAX_BYTES} bytes`);
6571
+ scopeTagIds = external_exports.array(external_exports.string().uuid()).min(1).max(CONTACT_SCOPE_TAGS_MAX).transform((ids) => [...new Set(ids)]);
6572
+ contactVisibilitySchema = external_exports.discriminatedUnion("scope", [
6573
+ external_exports.object({ scope: external_exports.literal("all_hubs") }).strict(),
6574
+ external_exports.object({ scope: external_exports.literal("tags"), tag_ids: scopeTagIds }).strict()
6575
+ ]);
6576
+ hasIdentity = (row) => Boolean(row.phone || row.email || row.instagram_sid);
6577
+ IDENTITY_REQUIRED = "A contact needs a phone, an email or an Instagram id";
6578
+ contactBookOrgQuery = external_exports.object({
6579
+ organization_id: external_exports.string().uuid()
6580
+ });
6581
+ contactBookContactParam = external_exports.object({
6582
+ contactId: external_exports.string().uuid()
6583
+ });
6584
+ contactBookListParam = external_exports.object({
6585
+ listId: external_exports.string().uuid()
6586
+ });
6587
+ contactBookHubParam = external_exports.object({
6588
+ hubId: external_exports.string().uuid()
6589
+ });
6590
+ contactBookPageQuery = external_exports.object({
6591
+ cursor: external_exports.string().max(2048).optional(),
6592
+ limit: external_exports.coerce.number().int().min(1).max(CONTACT_PAGE_MAX).default(50)
6593
+ });
6594
+ listContactBookContactsQuery = contactBookOrgQuery.merge(contactBookPageQuery).extend({
6595
+ q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional(),
6596
+ label: external_exports.string().max(CONTACT_LABEL_MAX).transform(normalizeContactLabel).optional(),
6597
+ scope_tag_id: external_exports.string().uuid().optional()
6598
+ });
6599
+ listHubContactBookContactsQuery = contactBookPageQuery.extend({
6600
+ q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional()
6601
+ });
6602
+ contactBookLinkCandidatesQuery = contactBookOrgQuery.extend({
6603
+ email: contactEmail
6604
+ });
6605
+ listContactBookListMembersQuery = contactBookOrgQuery.merge(contactBookPageQuery);
6606
+ contactRowFields = {
6607
+ name: contactName,
6608
+ phone: contactPhone.nullish(),
6609
+ email: contactEmail.nullish(),
6610
+ instagram_sid: contactInstagramSid.nullish(),
6611
+ labels: contactLabels.optional(),
6612
+ metadata: contactMetadata.optional()
6613
+ };
6614
+ createContactBookContactBody = external_exports.object({
6615
+ organization_id: external_exports.string().uuid(),
6616
+ ...contactRowFields,
6617
+ visibility: contactVisibilitySchema,
6618
+ environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
6619
+ }).strict().refine(hasIdentity, IDENTITY_REQUIRED);
6620
+ updateContactBookContactBody = external_exports.object({
6621
+ name: contactName.optional(),
6622
+ phone: contactPhone.nullable().optional(),
6623
+ email: contactEmail.nullable().optional(),
6624
+ instagram_sid: contactInstagramSid.nullable().optional(),
6625
+ labels: contactLabels.optional(),
6626
+ metadata: contactMetadata.optional(),
6627
+ visibility: contactVisibilitySchema.optional(),
6628
+ environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
6629
+ }).strict();
6630
+ contactImportRowSchema = external_exports.object(contactRowFields).strict().refine(hasIdentity, IDENTITY_REQUIRED);
6631
+ importContactBookContactsBody = external_exports.object({
6632
+ organization_id: external_exports.string().uuid(),
6633
+ visibility: contactVisibilitySchema,
6634
+ environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional(),
6635
+ labels: contactLabels.optional(),
6636
+ rows: external_exports.array(contactImportRowSchema).min(1).max(CONTACT_IMPORT_BATCH_MAX)
6637
+ }).strict().superRefine((batch, ctx) => {
6638
+ batch.rows.forEach((row, index) => {
6639
+ if (importRowLabels(row, batch.labels).length > CONTACT_LABELS_MAX) {
6640
+ ctx.addIssue({
6641
+ code: external_exports.ZodIssueCode.custom,
6642
+ path: ["rows", index, "labels"],
6643
+ message: `A contact holds at most ${CONTACT_LABELS_MAX} labels, the batch's included`
6644
+ });
6645
+ }
6646
+ });
6647
+ });
6648
+ linkContactBookContactBody = external_exports.object({
6649
+ user_id: external_exports.string().min(1).max(128)
6650
+ }).strict();
6651
+ listName = external_exports.string().trim().min(1).max(CONTACT_LIST_NAME_MAX).regex(CONTACT_LIST_NAME_REGEX, {
6652
+ message: 'Must be lowercase alphanumeric with hyphens (e.g. "vip-customers")'
6653
+ });
6654
+ contactListFilterSchema = external_exports.object({
6655
+ labels: external_exports.array(contactLabel).max(CONTACT_LIST_FILTER_MAX).transform((l) => [...new Set(l)]).default([]),
6656
+ scope_tag_ids: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_FILTER_MAX).transform((t) => [...new Set(t)]).default([])
6657
+ }).strict();
6658
+ createContactBookListBody = external_exports.object({
6659
+ organization_id: external_exports.string().uuid(),
6660
+ name: listName,
6661
+ description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullish(),
6662
+ filter: contactListFilterSchema.optional()
6663
+ }).strict();
6664
+ updateContactBookListBody = external_exports.object({
6665
+ name: listName.optional(),
6666
+ description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullable().optional(),
6667
+ filter: contactListFilterSchema.optional()
6668
+ }).strict();
6669
+ updateContactBookListPinsBody = external_exports.object({
6670
+ add: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([]),
6671
+ remove: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([])
6672
+ }).strict().refine((b) => b.add.length + b.remove.length > 0, "Add or remove at least one contact");
6673
+ suppressionIdentitySchema = external_exports.discriminatedUnion("kind", [
6674
+ external_exports.object({ kind: external_exports.literal("phone"), value: contactPhone }).strict(),
6675
+ external_exports.object({ kind: external_exports.literal("email"), value: contactEmail }).strict(),
6676
+ external_exports.object({ kind: external_exports.literal("instagram"), value: contactInstagramSid }).strict()
6677
+ ]);
6678
+ createContactBookSuppressionBody = external_exports.object({
6679
+ organization_id: external_exports.string().uuid(),
6680
+ identity: suppressionIdentitySchema,
6681
+ scope: external_exports.enum(SUPPRESSION_SCOPES)
6682
+ }).strict();
6683
+ contactBookSuppressionParam = external_exports.object({
6684
+ suppressionId: external_exports.string().regex(SUPPRESSION_ID_REGEX)
6685
+ });
6686
+ listContactBookSuppressionsQuery = contactBookOrgQuery.merge(contactBookPageQuery);
6687
+ contactBookEmailUnsubscribeTokenSchema = external_exports.string().max(200).regex(/^[0-9a-f-]{36}\.[0-9a-f]{64}\.[0-9a-f]{64}$/i);
6688
+ contactBookEmailUnsubscribeQuery = external_exports.object({ token: contactBookEmailUnsubscribeTokenSchema });
6689
+ orgListReferenceSchema = listName;
6690
+ }
6691
+ });
6692
+
6693
+ // ../../packages/core/dist/chunk-MGBAXT5Y.js
6694
+ var PERSON_LINKS_MAX, PERSON_DENY_PAGE_MAX, personParam, personLinkParam, deniedPersonParam, listDeniedPersonsQuery, conversationCustomerPersonParam;
6695
+ var init_chunk_MGBAXT5Y = __esm({
6696
+ "../../packages/core/dist/chunk-MGBAXT5Y.js"() {
6697
+ "use strict";
6698
+ init_chunk_2YEGUQR7();
6699
+ init_chunk_UAOHHCW5();
6700
+ init_zod();
6701
+ PERSON_LINKS_MAX = 15;
6702
+ PERSON_DENY_PAGE_MAX = 100;
6703
+ personParam = external_exports.object({
6704
+ personId: userPersonIdSchema
6705
+ });
6706
+ personLinkParam = personParam.extend({
6707
+ targetId: personIdSchema
6708
+ });
6709
+ deniedPersonParam = external_exports.object({
6710
+ personId: personIdSchema
6711
+ });
6712
+ listDeniedPersonsQuery = contactBookOrgQuery.extend({
6713
+ cursor: personIdSchema.optional(),
6714
+ limit: external_exports.coerce.number().int().min(1).max(PERSON_DENY_PAGE_MAX).default(50)
6715
+ });
6716
+ conversationCustomerPersonParam = external_exports.object({
6717
+ hubId: external_exports.string().uuid(),
6718
+ conversationId: external_exports.string().uuid()
6719
+ });
6720
+ }
6721
+ });
6722
+
6479
6723
  // ../../packages/core/dist/chunk-5DGHIY7L.js
6480
6724
  var rekorBaseChangeMessageSchema;
6481
6725
  var init_chunk_5DGHIY7L = __esm({
@@ -6521,7 +6765,7 @@ var init_chunk_5FO3GNKP = __esm({
6521
6765
  }
6522
6766
  });
6523
6767
 
6524
- // ../../packages/core/dist/chunk-SMVVXYHP.js
6768
+ // ../../packages/core/dist/chunk-EJRDF5B6.js
6525
6769
  function matchPath(pattern, path45) {
6526
6770
  const pathSegments2 = path45.replace(/\/$/, "").split("/");
6527
6771
  const isPrefix = pattern.endsWith("/*");
@@ -6550,8 +6794,8 @@ function getEndpointConfig(path45) {
6550
6794
  return { tier: "STANDARD" };
6551
6795
  }
6552
6796
  var ENDPOINT_CONFIGS, EXCLUDED_PATHS;
6553
- var init_chunk_SMVVXYHP = __esm({
6554
- "../../packages/core/dist/chunk-SMVVXYHP.js"() {
6797
+ var init_chunk_EJRDF5B6 = __esm({
6798
+ "../../packages/core/dist/chunk-EJRDF5B6.js"() {
6555
6799
  "use strict";
6556
6800
  init_chunk_5FO3GNKP();
6557
6801
  ENDPOINT_CONFIGS = {
@@ -7007,6 +7251,17 @@ var init_chunk_SMVVXYHP = __esm({
7007
7251
  // many members' clicks share, and STRICT's 5/min bucket is shared with sign-in. An exact key, so
7008
7252
  // it wins over the wildcard above.
7009
7253
  [COMMUNITY_EMAIL_UNSUBSCRIBE_PATH]: { tier: "MODERATE" },
7254
+ // Case spaces (wayai#5921, `cases/routes.ts`): every route under the mount shares one per-user
7255
+ // budget. Each is one person's page or write, at most a few hundred Durable Object reads (the
7256
+ // list of their spaces); a space's own limits are counted in its CaseDO. Every caller is a web
7257
+ // session, so the per-IP tier is skipped; the key is pinned because the paths carry org, space,
7258
+ // person and team ids.
7259
+ "/api/cases/*": {
7260
+ tier: "STANDARD",
7261
+ userLimit: 60,
7262
+ skipAuthenticatedUsers: true,
7263
+ userLimitKey: "/api/cases/*"
7264
+ },
7010
7265
  // The WayAI Guide's help entry (wayai#4948, `routes/api/guide.ts`): one POST per click by a viewer
7011
7266
  // the snapshot does not show enrolled, which reads the person's row on the Guide hub and writes only
7012
7267
  // what is missing (an enrolled viewer's click opens the hub without a request). Every caller is
@@ -7043,7 +7298,7 @@ var init_chunk_SMVVXYHP = __esm({
7043
7298
  }
7044
7299
  });
7045
7300
 
7046
- // ../../packages/core/dist/chunk-5SG6USCJ.js
7301
+ // ../../packages/core/dist/chunk-2FWVCLBC.js
7047
7302
  function fileSnapshotChanged(run) {
7048
7303
  return run.written + run.removed > 0;
7049
7304
  }
@@ -7084,10 +7339,10 @@ async function sendWithRetry(opts, cursor) {
7084
7339
  }
7085
7340
  }
7086
7341
  var rekorFileSnapshotAnswerSchema, FILE_SNAPSHOT_MAX_PAGES, FILE_SNAPSHOT_CONFLICT_ATTEMPTS, FILE_SNAPSHOT_PAGE_SPACING_MS, FILE_SNAPSHOT_CONFLICT_STATUS;
7087
- var init_chunk_5SG6USCJ = __esm({
7088
- "../../packages/core/dist/chunk-5SG6USCJ.js"() {
7342
+ var init_chunk_2FWVCLBC = __esm({
7343
+ "../../packages/core/dist/chunk-2FWVCLBC.js"() {
7089
7344
  "use strict";
7090
- init_chunk_SMVVXYHP();
7345
+ init_chunk_EJRDF5B6();
7091
7346
  init_chunk_5FO3GNKP();
7092
7347
  init_zod();
7093
7348
  rekorFileSnapshotAnswerSchema = external_exports.object({
@@ -7348,22 +7603,41 @@ var init_chunk_PFGVH2CX = __esm({
7348
7603
  }
7349
7604
  });
7350
7605
 
7351
- // ../../packages/core/dist/chunk-GPM7PE44.js
7352
- var bootstrapQuery;
7353
- var init_chunk_GPM7PE44 = __esm({
7354
- "../../packages/core/dist/chunk-GPM7PE44.js"() {
7606
+ // ../../packages/core/dist/chunk-FPSDNS2E.js
7607
+ var noticeSeveritySchema, noticeStatusSchema, NOTICE_SCOPE_REGEX, noticeScopeSchema, noticeLinkSchema, createNoticeBody, updateNoticeBody, listNoticesQuery, noticeIdParamSchema;
7608
+ var init_chunk_FPSDNS2E = __esm({
7609
+ "../../packages/core/dist/chunk-FPSDNS2E.js"() {
7355
7610
  "use strict";
7356
7611
  init_zod();
7357
- bootstrapQuery = external_exports.object({
7358
- active_hub_id: external_exports.string().uuid().optional(),
7359
- active_conversation_id: external_exports.string().uuid().optional(),
7360
- active_nav: external_exports.enum(["chat", "task", "support"]).optional(),
7361
- /**
7362
- * The people thread the URL names (`/chat/threads/:threadId`, gh #4661): the snapshot
7363
- * preloads it as `people.active_thread` when the viewer is a member.
7364
- */
7365
- active_thread_id: external_exports.string().uuid().optional()
7612
+ noticeSeveritySchema = external_exports.enum(["critical", "warn", "info"]);
7613
+ noticeStatusSchema = external_exports.enum(["active", "resolved"]);
7614
+ NOTICE_SCOPE_REGEX = /^(global|provider:[a-z0-9_-]{1,40}|service:[a-z0-9_-]{1,40})$/;
7615
+ noticeScopeSchema = external_exports.string().regex(NOTICE_SCOPE_REGEX, "scope must be 'global', 'provider:<x>', or 'service:<x>'");
7616
+ noticeLinkSchema = external_exports.string().url().refine((u) => /^https?:\/\//i.test(u), { message: "link must be an http(s) URL" });
7617
+ createNoticeBody = external_exports.object({
7618
+ severity: noticeSeveritySchema.default("info"),
7619
+ scope: noticeScopeSchema.default("global"),
7620
+ title: external_exports.string().trim().min(1).max(200),
7621
+ body: external_exports.string().max(2e3).optional(),
7622
+ link: noticeLinkSchema.optional(),
7623
+ starts_at: external_exports.string().datetime().optional(),
7624
+ ends_at: external_exports.string().datetime().optional()
7366
7625
  });
7626
+ updateNoticeBody = external_exports.object({
7627
+ severity: noticeSeveritySchema.optional(),
7628
+ scope: noticeScopeSchema.optional(),
7629
+ title: external_exports.string().trim().min(1).max(200).optional(),
7630
+ body: external_exports.string().max(2e3).nullable().optional(),
7631
+ link: noticeLinkSchema.nullable().optional(),
7632
+ starts_at: external_exports.string().datetime().optional(),
7633
+ ends_at: external_exports.string().datetime().nullable().optional()
7634
+ }).refine((b) => Object.keys(b).length > 0, { message: "at least one field must be provided" });
7635
+ listNoticesQuery = external_exports.object({
7636
+ status: noticeStatusSchema.optional(),
7637
+ limit: external_exports.coerce.number().int().min(1).max(200).optional(),
7638
+ offset: external_exports.coerce.number().int().min(0).optional()
7639
+ });
7640
+ noticeIdParamSchema = external_exports.object({ id: external_exports.string().min(1) });
7367
7641
  }
7368
7642
  });
7369
7643
 
@@ -7873,231 +8147,6 @@ var init_chunk_Y7CFCYX4 = __esm({
7873
8147
  }
7874
8148
  });
7875
8149
 
7876
- // ../../packages/core/dist/chunk-2YEGUQR7.js
7877
- var PERSON_ID_PATTERN, CONTACT_PERSON_ID_PATTERN, PERSON_ID_FORM_MESSAGE, userPersonIdSchema, personIdSchema;
7878
- var init_chunk_2YEGUQR7 = __esm({
7879
- "../../packages/core/dist/chunk-2YEGUQR7.js"() {
7880
- "use strict";
7881
- init_zod();
7882
- PERSON_ID_PATTERN = /^prs_[a-z2-7]{52}$/;
7883
- CONTACT_PERSON_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
7884
- PERSON_ID_FORM_MESSAGE = "Must be a person id (prs_\u2026) or a contact id (a lowercase UUID)";
7885
- userPersonIdSchema = external_exports.string().regex(PERSON_ID_PATTERN, { message: "Must be a person id (prs_\u2026)" });
7886
- personIdSchema = external_exports.string().refine(
7887
- (value) => PERSON_ID_PATTERN.test(value) || CONTACT_PERSON_ID_PATTERN.test(value),
7888
- { message: PERSON_ID_FORM_MESSAGE }
7889
- );
7890
- }
7891
- });
7892
-
7893
- // ../../packages/core/dist/chunk-UAOHHCW5.js
7894
- function normalizeContactPhone(raw) {
7895
- const compact = raw.trim().replace(/[\s\-.()]/g, "");
7896
- const withPlus = compact.startsWith("00") ? `+${compact.slice(2)}` : compact;
7897
- return /^\+[1-9]\d{7,14}$/.test(withPlus) ? withPlus : null;
7898
- }
7899
- function normalizeContactLabel(raw) {
7900
- return raw.trim().replace(/\s+/g, " ").toLowerCase();
7901
- }
7902
- function importRowLabels(row, batchLabels) {
7903
- return [.../* @__PURE__ */ new Set([...row.labels ?? [], ...batchLabels ?? []])];
7904
- }
7905
- 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;
7906
- var init_chunk_UAOHHCW5 = __esm({
7907
- "../../packages/core/dist/chunk-UAOHHCW5.js"() {
7908
- "use strict";
7909
- init_zod();
7910
- CONTACT_ENVIRONMENTS = ["production", "preview", "all"];
7911
- CONTACT_NAME_MAX = 200;
7912
- CONTACT_EMAIL_MAX = 320;
7913
- CONTACT_PHONE_INPUT_MAX = 40;
7914
- CONTACT_INSTAGRAM_SID_MAX = 64;
7915
- CONTACT_METADATA_MAX_BYTES = 4096;
7916
- CONTACT_LABEL_MAX = 64;
7917
- CONTACT_LABELS_MAX = 20;
7918
- CONTACT_SCOPE_TAGS_MAX = 20;
7919
- CONTACT_PAGE_MAX = 100;
7920
- CONTACT_IMPORT_BATCH_MAX = 500;
7921
- CONTACT_SEARCH_MAX = 100;
7922
- CONTACT_LIST_NAME_MAX = 64;
7923
- CONTACT_LIST_NAME_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
7924
- CONTACT_LIST_DESCRIPTION_MAX = 1e3;
7925
- CONTACT_LIST_FILTER_MAX = 20;
7926
- CONTACT_LIST_PINS_PER_REQUEST_MAX = 100;
7927
- SUPPRESSION_SCOPES = ["all", "marketing"];
7928
- SUPPRESSION_ID_REGEX = /^[0-9a-f]{64}$/;
7929
- contactName = external_exports.string().trim().min(1).max(CONTACT_NAME_MAX);
7930
- contactPhone = external_exports.string().max(CONTACT_PHONE_INPUT_MAX).transform((raw, ctx) => {
7931
- const phone = normalizeContactPhone(raw);
7932
- if (phone === null) {
7933
- ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Phone must be an international number, e.g. +5511999999999" });
7934
- return external_exports.NEVER;
7935
- }
7936
- return phone;
7937
- });
7938
- contactEmail = external_exports.string().trim().toLowerCase().max(CONTACT_EMAIL_MAX).email();
7939
- contactInstagramSid = external_exports.string().trim().min(1).max(CONTACT_INSTAGRAM_SID_MAX);
7940
- 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");
7941
- contactLabels = external_exports.array(contactLabel).max(CONTACT_LABELS_MAX).transform((labels) => [...new Set(labels)]);
7942
- contactMetadata = external_exports.record(external_exports.unknown()).refine((metadata) => {
7943
- try {
7944
- return new TextEncoder().encode(JSON.stringify(metadata)).length <= CONTACT_METADATA_MAX_BYTES;
7945
- } catch {
7946
- return false;
7947
- }
7948
- }, `Metadata must serialize to at most ${CONTACT_METADATA_MAX_BYTES} bytes`);
7949
- scopeTagIds = external_exports.array(external_exports.string().uuid()).min(1).max(CONTACT_SCOPE_TAGS_MAX).transform((ids) => [...new Set(ids)]);
7950
- contactVisibilitySchema = external_exports.discriminatedUnion("scope", [
7951
- external_exports.object({ scope: external_exports.literal("all_hubs") }).strict(),
7952
- external_exports.object({ scope: external_exports.literal("tags"), tag_ids: scopeTagIds }).strict()
7953
- ]);
7954
- hasIdentity = (row) => Boolean(row.phone || row.email || row.instagram_sid);
7955
- IDENTITY_REQUIRED = "A contact needs a phone, an email or an Instagram id";
7956
- contactBookOrgQuery = external_exports.object({
7957
- organization_id: external_exports.string().uuid()
7958
- });
7959
- contactBookContactParam = external_exports.object({
7960
- contactId: external_exports.string().uuid()
7961
- });
7962
- contactBookListParam = external_exports.object({
7963
- listId: external_exports.string().uuid()
7964
- });
7965
- contactBookHubParam = external_exports.object({
7966
- hubId: external_exports.string().uuid()
7967
- });
7968
- contactBookPageQuery = external_exports.object({
7969
- cursor: external_exports.string().max(2048).optional(),
7970
- limit: external_exports.coerce.number().int().min(1).max(CONTACT_PAGE_MAX).default(50)
7971
- });
7972
- listContactBookContactsQuery = contactBookOrgQuery.merge(contactBookPageQuery).extend({
7973
- q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional(),
7974
- label: external_exports.string().max(CONTACT_LABEL_MAX).transform(normalizeContactLabel).optional(),
7975
- scope_tag_id: external_exports.string().uuid().optional()
7976
- });
7977
- listHubContactBookContactsQuery = contactBookPageQuery.extend({
7978
- q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional()
7979
- });
7980
- contactBookLinkCandidatesQuery = contactBookOrgQuery.extend({
7981
- email: contactEmail
7982
- });
7983
- listContactBookListMembersQuery = contactBookOrgQuery.merge(contactBookPageQuery);
7984
- contactRowFields = {
7985
- name: contactName,
7986
- phone: contactPhone.nullish(),
7987
- email: contactEmail.nullish(),
7988
- instagram_sid: contactInstagramSid.nullish(),
7989
- labels: contactLabels.optional(),
7990
- metadata: contactMetadata.optional()
7991
- };
7992
- createContactBookContactBody = external_exports.object({
7993
- organization_id: external_exports.string().uuid(),
7994
- ...contactRowFields,
7995
- visibility: contactVisibilitySchema,
7996
- environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
7997
- }).strict().refine(hasIdentity, IDENTITY_REQUIRED);
7998
- updateContactBookContactBody = external_exports.object({
7999
- name: contactName.optional(),
8000
- phone: contactPhone.nullable().optional(),
8001
- email: contactEmail.nullable().optional(),
8002
- instagram_sid: contactInstagramSid.nullable().optional(),
8003
- labels: contactLabels.optional(),
8004
- metadata: contactMetadata.optional(),
8005
- visibility: contactVisibilitySchema.optional(),
8006
- environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
8007
- }).strict();
8008
- contactImportRowSchema = external_exports.object(contactRowFields).strict().refine(hasIdentity, IDENTITY_REQUIRED);
8009
- importContactBookContactsBody = external_exports.object({
8010
- organization_id: external_exports.string().uuid(),
8011
- visibility: contactVisibilitySchema,
8012
- environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional(),
8013
- labels: contactLabels.optional(),
8014
- rows: external_exports.array(contactImportRowSchema).min(1).max(CONTACT_IMPORT_BATCH_MAX)
8015
- }).strict().superRefine((batch, ctx) => {
8016
- batch.rows.forEach((row, index) => {
8017
- if (importRowLabels(row, batch.labels).length > CONTACT_LABELS_MAX) {
8018
- ctx.addIssue({
8019
- code: external_exports.ZodIssueCode.custom,
8020
- path: ["rows", index, "labels"],
8021
- message: `A contact holds at most ${CONTACT_LABELS_MAX} labels, the batch's included`
8022
- });
8023
- }
8024
- });
8025
- });
8026
- linkContactBookContactBody = external_exports.object({
8027
- user_id: external_exports.string().min(1).max(128)
8028
- }).strict();
8029
- listName = external_exports.string().trim().min(1).max(CONTACT_LIST_NAME_MAX).regex(CONTACT_LIST_NAME_REGEX, {
8030
- message: 'Must be lowercase alphanumeric with hyphens (e.g. "vip-customers")'
8031
- });
8032
- contactListFilterSchema = external_exports.object({
8033
- labels: external_exports.array(contactLabel).max(CONTACT_LIST_FILTER_MAX).transform((l) => [...new Set(l)]).default([]),
8034
- scope_tag_ids: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_FILTER_MAX).transform((t) => [...new Set(t)]).default([])
8035
- }).strict();
8036
- createContactBookListBody = external_exports.object({
8037
- organization_id: external_exports.string().uuid(),
8038
- name: listName,
8039
- description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullish(),
8040
- filter: contactListFilterSchema.optional()
8041
- }).strict();
8042
- updateContactBookListBody = external_exports.object({
8043
- name: listName.optional(),
8044
- description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullable().optional(),
8045
- filter: contactListFilterSchema.optional()
8046
- }).strict();
8047
- updateContactBookListPinsBody = external_exports.object({
8048
- add: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([]),
8049
- remove: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([])
8050
- }).strict().refine((b) => b.add.length + b.remove.length > 0, "Add or remove at least one contact");
8051
- suppressionIdentitySchema = external_exports.discriminatedUnion("kind", [
8052
- external_exports.object({ kind: external_exports.literal("phone"), value: contactPhone }).strict(),
8053
- external_exports.object({ kind: external_exports.literal("email"), value: contactEmail }).strict(),
8054
- external_exports.object({ kind: external_exports.literal("instagram"), value: contactInstagramSid }).strict()
8055
- ]);
8056
- createContactBookSuppressionBody = external_exports.object({
8057
- organization_id: external_exports.string().uuid(),
8058
- identity: suppressionIdentitySchema,
8059
- scope: external_exports.enum(SUPPRESSION_SCOPES)
8060
- }).strict();
8061
- contactBookSuppressionParam = external_exports.object({
8062
- suppressionId: external_exports.string().regex(SUPPRESSION_ID_REGEX)
8063
- });
8064
- listContactBookSuppressionsQuery = contactBookOrgQuery.merge(contactBookPageQuery);
8065
- contactBookEmailUnsubscribeTokenSchema = external_exports.string().max(200).regex(/^[0-9a-f-]{36}\.[0-9a-f]{64}\.[0-9a-f]{64}$/i);
8066
- contactBookEmailUnsubscribeQuery = external_exports.object({ token: contactBookEmailUnsubscribeTokenSchema });
8067
- orgListReferenceSchema = listName;
8068
- }
8069
- });
8070
-
8071
- // ../../packages/core/dist/chunk-MGBAXT5Y.js
8072
- var PERSON_LINKS_MAX, PERSON_DENY_PAGE_MAX, personParam, personLinkParam, deniedPersonParam, listDeniedPersonsQuery, conversationCustomerPersonParam;
8073
- var init_chunk_MGBAXT5Y = __esm({
8074
- "../../packages/core/dist/chunk-MGBAXT5Y.js"() {
8075
- "use strict";
8076
- init_chunk_2YEGUQR7();
8077
- init_chunk_UAOHHCW5();
8078
- init_zod();
8079
- PERSON_LINKS_MAX = 15;
8080
- PERSON_DENY_PAGE_MAX = 100;
8081
- personParam = external_exports.object({
8082
- personId: userPersonIdSchema
8083
- });
8084
- personLinkParam = personParam.extend({
8085
- targetId: personIdSchema
8086
- });
8087
- deniedPersonParam = external_exports.object({
8088
- personId: personIdSchema
8089
- });
8090
- listDeniedPersonsQuery = contactBookOrgQuery.extend({
8091
- cursor: personIdSchema.optional(),
8092
- limit: external_exports.coerce.number().int().min(1).max(PERSON_DENY_PAGE_MAX).default(50)
8093
- });
8094
- conversationCustomerPersonParam = external_exports.object({
8095
- hubId: external_exports.string().uuid(),
8096
- conversationId: external_exports.string().uuid()
8097
- });
8098
- }
8099
- });
8100
-
8101
8150
  // ../../packages/core/dist/chunk-YUZFHVB2.js
8102
8151
  var invitePreviewQuery, inviteRolePreviewResponse, inviteContactPreviewResponse, invitePreviewResponse, inviteUnsubscribeBody;
8103
8152
  var init_chunk_YUZFHVB2 = __esm({
@@ -8544,41 +8593,18 @@ var init_chunk_34LE6P7E = __esm({
8544
8593
  }
8545
8594
  });
8546
8595
 
8547
- // ../../packages/core/dist/chunk-FPSDNS2E.js
8548
- var noticeSeveritySchema, noticeStatusSchema, NOTICE_SCOPE_REGEX, noticeScopeSchema, noticeLinkSchema, createNoticeBody, updateNoticeBody, listNoticesQuery, noticeIdParamSchema;
8549
- var init_chunk_FPSDNS2E = __esm({
8550
- "../../packages/core/dist/chunk-FPSDNS2E.js"() {
8596
+ // ../../packages/core/dist/chunk-IR2NOSI3.js
8597
+ var adminSetGuideHubBody, GUIDE_HUB_INELIGIBLE_REASON;
8598
+ var init_chunk_IR2NOSI3 = __esm({
8599
+ "../../packages/core/dist/chunk-IR2NOSI3.js"() {
8551
8600
  "use strict";
8601
+ init_chunk_HZ6CADSY();
8552
8602
  init_zod();
8553
- noticeSeveritySchema = external_exports.enum(["critical", "warn", "info"]);
8554
- noticeStatusSchema = external_exports.enum(["active", "resolved"]);
8555
- NOTICE_SCOPE_REGEX = /^(global|provider:[a-z0-9_-]{1,40}|service:[a-z0-9_-]{1,40})$/;
8556
- noticeScopeSchema = external_exports.string().regex(NOTICE_SCOPE_REGEX, "scope must be 'global', 'provider:<x>', or 'service:<x>'");
8557
- noticeLinkSchema = external_exports.string().url().refine((u) => /^https?:\/\//i.test(u), { message: "link must be an http(s) URL" });
8558
- createNoticeBody = external_exports.object({
8559
- severity: noticeSeveritySchema.default("info"),
8560
- scope: noticeScopeSchema.default("global"),
8561
- title: external_exports.string().trim().min(1).max(200),
8562
- body: external_exports.string().max(2e3).optional(),
8563
- link: noticeLinkSchema.optional(),
8564
- starts_at: external_exports.string().datetime().optional(),
8565
- ends_at: external_exports.string().datetime().optional()
8566
- });
8567
- updateNoticeBody = external_exports.object({
8568
- severity: noticeSeveritySchema.optional(),
8569
- scope: noticeScopeSchema.optional(),
8570
- title: external_exports.string().trim().min(1).max(200).optional(),
8571
- body: external_exports.string().max(2e3).nullable().optional(),
8572
- link: noticeLinkSchema.nullable().optional(),
8573
- starts_at: external_exports.string().datetime().optional(),
8574
- ends_at: external_exports.string().datetime().nullable().optional()
8575
- }).refine((b) => Object.keys(b).length > 0, { message: "at least one field must be provided" });
8576
- listNoticesQuery = external_exports.object({
8577
- status: noticeStatusSchema.optional(),
8578
- limit: external_exports.coerce.number().int().min(1).max(200).optional(),
8579
- offset: external_exports.coerce.number().int().min(0).optional()
8580
- });
8581
- noticeIdParamSchema = external_exports.object({ id: external_exports.string().min(1) });
8603
+ adminSetGuideHubBody = external_exports.object({
8604
+ hub_id: uuidSchema,
8605
+ dry_run: external_exports.boolean().optional()
8606
+ }).strict();
8607
+ GUIDE_HUB_INELIGIBLE_REASON = "guide_hub_ineligible";
8582
8608
  }
8583
8609
  });
8584
8610
 
@@ -9045,6 +9071,29 @@ var init_chunk_KMAC3O3L = __esm({
9045
9071
  }
9046
9072
  });
9047
9073
 
9074
+ // ../../packages/core/dist/chunk-MH4O3YEX.js
9075
+ var stateOperationBody;
9076
+ var init_chunk_MH4O3YEX = __esm({
9077
+ "../../packages/core/dist/chunk-MH4O3YEX.js"() {
9078
+ "use strict";
9079
+ init_chunk_6TSQ5HXC();
9080
+ init_zod();
9081
+ stateOperationBody = external_exports.object({
9082
+ hub_id: external_exports.string().uuid(),
9083
+ operation: external_exports.enum(["get", "update", "set_path", "reset"]),
9084
+ state_slug: slugSchema,
9085
+ /**
9086
+ * Deprecated and ignored. Scope is derived from the hub's state definition.
9087
+ * Kept on the schema so legacy bodies still validate.
9088
+ */
9089
+ state_scope: external_exports.enum(["conversation", "user"]).optional(),
9090
+ updates: external_exports.record(external_exports.unknown()).optional(),
9091
+ path: external_exports.array(external_exports.string()).optional(),
9092
+ value: external_exports.unknown().optional()
9093
+ });
9094
+ }
9095
+ });
9096
+
9048
9097
  // ../../packages/core/dist/chunk-IBL7FANV.js
9049
9098
  var SUMMARIZATION_THRESHOLD_MIN, SUMMARIZATION_THRESHOLD_MAX;
9050
9099
  var init_chunk_IBL7FANV = __esm({
@@ -12585,21 +12634,6 @@ var init_chunk_C4HEZ7ZI = __esm({
12585
12634
  }
12586
12635
  });
12587
12636
 
12588
- // ../../packages/core/dist/chunk-IR2NOSI3.js
12589
- var adminSetGuideHubBody, GUIDE_HUB_INELIGIBLE_REASON;
12590
- var init_chunk_IR2NOSI3 = __esm({
12591
- "../../packages/core/dist/chunk-IR2NOSI3.js"() {
12592
- "use strict";
12593
- init_chunk_HZ6CADSY();
12594
- init_zod();
12595
- adminSetGuideHubBody = external_exports.object({
12596
- hub_id: uuidSchema,
12597
- dry_run: external_exports.boolean().optional()
12598
- }).strict();
12599
- GUIDE_HUB_INELIGIBLE_REASON = "guide_hub_ineligible";
12600
- }
12601
- });
12602
-
12603
12637
  // ../../packages/core/dist/chunk-YULHXJ5M.js
12604
12638
  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;
12605
12639
  var init_chunk_YULHXJ5M = __esm({
@@ -12703,29 +12737,6 @@ var init_chunk_ACGAI25T = __esm({
12703
12737
  }
12704
12738
  });
12705
12739
 
12706
- // ../../packages/core/dist/chunk-MH4O3YEX.js
12707
- var stateOperationBody;
12708
- var init_chunk_MH4O3YEX = __esm({
12709
- "../../packages/core/dist/chunk-MH4O3YEX.js"() {
12710
- "use strict";
12711
- init_chunk_6TSQ5HXC();
12712
- init_zod();
12713
- stateOperationBody = external_exports.object({
12714
- hub_id: external_exports.string().uuid(),
12715
- operation: external_exports.enum(["get", "update", "set_path", "reset"]),
12716
- state_slug: slugSchema,
12717
- /**
12718
- * Deprecated and ignored. Scope is derived from the hub's state definition.
12719
- * Kept on the schema so legacy bodies still validate.
12720
- */
12721
- state_scope: external_exports.enum(["conversation", "user"]).optional(),
12722
- updates: external_exports.record(external_exports.unknown()).optional(),
12723
- path: external_exports.array(external_exports.string()).optional(),
12724
- value: external_exports.unknown().optional()
12725
- });
12726
- }
12727
- });
12728
-
12729
12740
  // ../../packages/core/dist/chunk-PZPOUXJR.js
12730
12741
  var navItemSchema, hubCountResetBody, navItemCountResetBody, typingBody;
12731
12742
  var init_chunk_PZPOUXJR = __esm({
@@ -12793,6 +12804,55 @@ var init_chunk_YWZFB34T = __esm({
12793
12804
  }
12794
12805
  });
12795
12806
 
12807
+ // ../../packages/core/dist/chunk-GAANFFN7.js
12808
+ var CASE_SPACE_NAME_MAX_LENGTH, CASE_TEAM_NAME_MAX_LENGTH, CASE_TEAM_MEMBERS_MAX, CASE_MEMBERS_PAGE_MAX, CASE_PAGE_CURSOR_MAX_LENGTH, CASE_LEVELS, CASE_REGISTRY_CLOSED_REASON, caseSpaceNameSchema, adminCreateCaseSpaceBody, caseOrgParam, caseSpaceParam, caseMemberParam, caseAdministratorParam, caseTeamParam, casePageQuery, saveCaseMemberBody, caseTeamScopeSchema, caseTeamMemberInput, caseTeamFields, createCaseTeamBody, updateCaseTeamBody;
12809
+ var init_chunk_GAANFFN7 = __esm({
12810
+ "../../packages/core/dist/chunk-GAANFFN7.js"() {
12811
+ "use strict";
12812
+ init_chunk_ZVXO3XL6();
12813
+ init_chunk_HZ6CADSY();
12814
+ init_zod();
12815
+ CASE_SPACE_NAME_MAX_LENGTH = 200;
12816
+ CASE_TEAM_NAME_MAX_LENGTH = 200;
12817
+ CASE_TEAM_MEMBERS_MAX = 1e3;
12818
+ CASE_MEMBERS_PAGE_MAX = 200;
12819
+ CASE_PAGE_CURSOR_MAX_LENGTH = 2048;
12820
+ CASE_LEVELS = ["read", "edit", "conduct"];
12821
+ CASE_REGISTRY_CLOSED_REASON = "case_registry_closed";
12822
+ caseSpaceNameSchema = external_exports.string().trim().min(1).max(CASE_SPACE_NAME_MAX_LENGTH);
12823
+ adminCreateCaseSpaceBody = external_exports.object({ org_id: uuidSchema, name: caseSpaceNameSchema }).strict();
12824
+ caseOrgParam = external_exports.object({ org_id: uuidSchema });
12825
+ caseSpaceParam = caseOrgParam.extend({ space_id: uuidSchema });
12826
+ caseMemberParam = caseSpaceParam.extend({ person_id: uuidSchema });
12827
+ caseAdministratorParam = caseSpaceParam.extend({ user_id: peopleUserIdSchema });
12828
+ caseTeamParam = caseSpaceParam.extend({ team_id: uuidSchema });
12829
+ casePageQuery = external_exports.object({
12830
+ limit: external_exports.coerce.number().int().min(1).max(CASE_MEMBERS_PAGE_MAX).optional(),
12831
+ cursor: external_exports.string().min(1).max(CASE_PAGE_CURSOR_MAX_LENGTH).optional()
12832
+ });
12833
+ saveCaseMemberBody = external_exports.object({
12834
+ user_id: peopleUserIdSchema,
12835
+ guest: external_exports.boolean().default(false),
12836
+ registry: external_exports.boolean().default(false)
12837
+ }).strict().refine((body) => !(body.guest && body.registry), { message: "A guest cannot hold the Registry flag", path: ["registry"] });
12838
+ caseTeamScopeSchema = external_exports.object({ kind: external_exports.literal("space"), target_id: external_exports.null() }).strict();
12839
+ caseTeamMemberInput = external_exports.object({
12840
+ person_id: uuidSchema,
12841
+ level: external_exports.enum(CASE_LEVELS),
12842
+ approve: external_exports.boolean(),
12843
+ confidential: external_exports.boolean()
12844
+ }).strict();
12845
+ caseTeamFields = {
12846
+ name: external_exports.string().trim().min(1).max(CASE_TEAM_NAME_MAX_LENGTH),
12847
+ active: external_exports.boolean(),
12848
+ scopes: external_exports.array(caseTeamScopeSchema).max(1),
12849
+ members: external_exports.array(caseTeamMemberInput).max(CASE_TEAM_MEMBERS_MAX)
12850
+ };
12851
+ createCaseTeamBody = external_exports.object(caseTeamFields).strict();
12852
+ updateCaseTeamBody = external_exports.object({ ...caseTeamFields, expected_updated_at: timestampSchema.optional() }).strict();
12853
+ }
12854
+ });
12855
+
12796
12856
  // ../../packages/core/dist/chunk-7CYHPF35.js
12797
12857
  var appMessageSenderType, appMessageReceiverType, apiChannelMessage, apiChannelMessageBody, appMessageBody, appMessageResponse;
12798
12858
  var init_chunk_7CYHPF35 = __esm({
@@ -13687,6 +13747,57 @@ var init_chunk_LBDH7LCG = __esm({
13687
13747
  }
13688
13748
  });
13689
13749
 
13750
+ // ../../packages/core/dist/chunk-D3EP4TDU.js
13751
+ var primaryRegionSchema, placementSourceSchema, orgIdParam, orgAdminIdParam, createOrganizationBody, updateOrganizationBody, addOrgAdminBody;
13752
+ var init_chunk_D3EP4TDU = __esm({
13753
+ "../../packages/core/dist/chunk-D3EP4TDU.js"() {
13754
+ "use strict";
13755
+ init_chunk_HZ6CADSY();
13756
+ init_zod();
13757
+ primaryRegionSchema = external_exports.enum([
13758
+ "wnam",
13759
+ "enam",
13760
+ "sam",
13761
+ "weur",
13762
+ "eeur",
13763
+ "apac",
13764
+ "oc",
13765
+ "afr",
13766
+ "me"
13767
+ ]);
13768
+ placementSourceSchema = external_exports.enum([
13769
+ "hub_config",
13770
+ "org_config",
13771
+ "parent_cascade",
13772
+ "cf_colo",
13773
+ "country",
13774
+ "fallback",
13775
+ "unpinned"
13776
+ ]);
13777
+ orgIdParam = external_exports.object({
13778
+ id: uuidSchema
13779
+ });
13780
+ orgAdminIdParam = external_exports.object({
13781
+ id: uuidSchema,
13782
+ adminId: external_exports.string().min(1)
13783
+ });
13784
+ createOrganizationBody = external_exports.object({
13785
+ organization_name: external_exports.string().min(1, "organization_name is required"),
13786
+ // Write-once at creation; updateOrganizationBody does not accept this.
13787
+ primary_region: primaryRegionSchema.optional()
13788
+ });
13789
+ updateOrganizationBody = external_exports.object({
13790
+ organization_name: external_exports.string().min(1).optional(),
13791
+ organization_avatar_url: external_exports.string().url().nullable().optional(),
13792
+ timezone: external_exports.string().optional(),
13793
+ business_hours: external_exports.unknown().optional()
13794
+ }).passthrough();
13795
+ addOrgAdminBody = external_exports.object({
13796
+ user_email: external_exports.string().email("valid email is required")
13797
+ });
13798
+ }
13799
+ });
13800
+
13690
13801
  // ../../packages/core/dist/chunk-X5PZZVTS.js
13691
13802
  function isEventRelativeFollowupType(type) {
13692
13803
  return typeof type === "string" && EVENT_RELATIVE_FOLLOWUP_TYPES.includes(type);
@@ -14085,57 +14196,6 @@ var init_chunk_X5PZZVTS = __esm({
14085
14196
  }
14086
14197
  });
14087
14198
 
14088
- // ../../packages/core/dist/chunk-D3EP4TDU.js
14089
- var primaryRegionSchema, placementSourceSchema, orgIdParam, orgAdminIdParam, createOrganizationBody, updateOrganizationBody, addOrgAdminBody;
14090
- var init_chunk_D3EP4TDU = __esm({
14091
- "../../packages/core/dist/chunk-D3EP4TDU.js"() {
14092
- "use strict";
14093
- init_chunk_HZ6CADSY();
14094
- init_zod();
14095
- primaryRegionSchema = external_exports.enum([
14096
- "wnam",
14097
- "enam",
14098
- "sam",
14099
- "weur",
14100
- "eeur",
14101
- "apac",
14102
- "oc",
14103
- "afr",
14104
- "me"
14105
- ]);
14106
- placementSourceSchema = external_exports.enum([
14107
- "hub_config",
14108
- "org_config",
14109
- "parent_cascade",
14110
- "cf_colo",
14111
- "country",
14112
- "fallback",
14113
- "unpinned"
14114
- ]);
14115
- orgIdParam = external_exports.object({
14116
- id: uuidSchema
14117
- });
14118
- orgAdminIdParam = external_exports.object({
14119
- id: uuidSchema,
14120
- adminId: external_exports.string().min(1)
14121
- });
14122
- createOrganizationBody = external_exports.object({
14123
- organization_name: external_exports.string().min(1, "organization_name is required"),
14124
- // Write-once at creation; updateOrganizationBody does not accept this.
14125
- primary_region: primaryRegionSchema.optional()
14126
- });
14127
- updateOrganizationBody = external_exports.object({
14128
- organization_name: external_exports.string().min(1).optional(),
14129
- organization_avatar_url: external_exports.string().url().nullable().optional(),
14130
- timezone: external_exports.string().optional(),
14131
- business_hours: external_exports.unknown().optional()
14132
- }).passthrough();
14133
- addOrgAdminBody = external_exports.object({
14134
- user_email: external_exports.string().email("valid email is required")
14135
- });
14136
- }
14137
- });
14138
-
14139
14199
  // ../../packages/core/dist/chunk-K5UAZWFF.js
14140
14200
  function byLocale(entry) {
14141
14201
  const shape = Object.fromEntries(SUPPORTED_LOCALES.map((locale) => [locale, entry.optional()]));
@@ -14174,7 +14234,7 @@ var init_chunk_K5UAZWFF = __esm({
14174
14234
  }
14175
14235
  });
14176
14236
 
14177
- // ../../packages/core/dist/chunk-MO23HUAX.js
14237
+ // ../../packages/core/dist/chunk-7NQZRSSJ.js
14178
14238
  function refineLaneReferences(val, ctx) {
14179
14239
  const lanes = val.lanes;
14180
14240
  const statuses = val.kanban_statuses;
@@ -14198,11 +14258,11 @@ function describeSyncWarning(warning) {
14198
14258
  return `${label2}: ${parts.join("; ")}. Promote the base so production's tools match the preview's.`;
14199
14259
  }
14200
14260
  var hubIdParam, hubAdminIdParam, hubUserIdParam, hubAgentIdParam, hubIdentityIdParam, hubTeamIdParam, hubTeamUserDeleteParam, hubSchemaQuery, HUB_USERS_PAGE_SIZE_MAX, HUB_USERS_SEARCH_MAX, HUB_USERS_CHANNEL_TYPES, getHubUsersQuery, PREVIEW_LABEL_MAX_LENGTH, MAX_ENDED_INDEX_RETENTION_DAYS, MAX_EVAL_RETENTION_DAYS, MAX_END_USER_DAILY_MESSAGE_LIMIT, endUserDailyMessageLimitField, previewLabelField, hubTagsField, createHubBody, updateHubBody, HUB_TAG_CHANGE_REFUSED, hubTagChangeRefusalSchema, addHubAdminBody, addHubIdentityAuthorizationBody, contactDecisionBody, approveContactBody, CONTACT_ACCESS_PAGE_SIZE_MAX, listContactAccessQuery, createHubTeamBody, updateHubTeamBody, addHubTeamUserBody, reassignHubUserBody, replicatePreviewBody, HUB_DIFF_SECTION_SET, HUB_DIFF_SECTIONS, updateChannelTestIdentitiesBody, claimCodeChannelParam, claimCodeDeleteParam;
14201
- var init_chunk_MO23HUAX = __esm({
14202
- "../../packages/core/dist/chunk-MO23HUAX.js"() {
14261
+ var init_chunk_7NQZRSSJ = __esm({
14262
+ "../../packages/core/dist/chunk-7NQZRSSJ.js"() {
14203
14263
  "use strict";
14204
- init_chunk_X5PZZVTS();
14205
14264
  init_chunk_D3EP4TDU();
14265
+ init_chunk_X5PZZVTS();
14206
14266
  init_chunk_K5UAZWFF();
14207
14267
  init_chunk_HZ6CADSY();
14208
14268
  init_zod();
@@ -14398,7 +14458,7 @@ var init_chunk_MO23HUAX = __esm({
14398
14458
  }
14399
14459
  });
14400
14460
 
14401
- // ../../packages/core/dist/chunk-KOLSAPLZ.js
14461
+ // ../../packages/core/dist/chunk-Z6H7PHIF.js
14402
14462
  function declaresNoConnection(agent) {
14403
14463
  return agent.connection === null && !agent.connection_id;
14404
14464
  }
@@ -15130,15 +15190,15 @@ function skillSectionsAsResources(scope) {
15130
15190
  };
15131
15191
  }
15132
15192
  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;
15133
- var init_chunk_KOLSAPLZ = __esm({
15134
- "../../packages/core/dist/chunk-KOLSAPLZ.js"() {
15193
+ var init_chunk_Z6H7PHIF = __esm({
15194
+ "../../packages/core/dist/chunk-Z6H7PHIF.js"() {
15135
15195
  "use strict";
15136
15196
  init_chunk_YI3ORIXJ();
15137
15197
  init_chunk_T6D3YZ6B();
15138
15198
  init_chunk_66EZQ7Y7();
15139
15199
  init_chunk_LBDH7LCG();
15140
15200
  init_chunk_4LXDRTO4();
15141
- init_chunk_MO23HUAX();
15201
+ init_chunk_7NQZRSSJ();
15142
15202
  init_chunk_X5PZZVTS();
15143
15203
  init_chunk_K5UAZWFF();
15144
15204
  init_chunk_L4YFOZGK();
@@ -15628,7 +15688,7 @@ var init_chunk_OMPT4ZHR = __esm({
15628
15688
  }
15629
15689
  });
15630
15690
 
15631
- // ../../packages/core/dist/chunk-7SJEG3UO.js
15691
+ // ../../packages/core/dist/chunk-4KGSO7DL.js
15632
15692
  function refineScopedTarget(data, ctx) {
15633
15693
  if (data.scope === "org") {
15634
15694
  if (!data.org_id) {
@@ -15654,13 +15714,13 @@ function refineScopedTarget(data, ctx) {
15654
15714
  }
15655
15715
  }
15656
15716
  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, casesLimit, updatePlatformConfigBody, updateFreeOrgLimitBody, adminScopedTargetShape, adminScopedTargetBody, adminDryRunByDefaultTargetBody, WAYAI_HOST_TOKEN_TARGET_KINDS, WAYAI_HOST_TOKEN_MAX_TARGETS, adminClearWayaiHostTokensBody, 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;
15657
- var init_chunk_7SJEG3UO = __esm({
15658
- "../../packages/core/dist/chunk-7SJEG3UO.js"() {
15717
+ var init_chunk_4KGSO7DL = __esm({
15718
+ "../../packages/core/dist/chunk-4KGSO7DL.js"() {
15659
15719
  "use strict";
15660
15720
  init_chunk_FECLIZTY();
15661
15721
  init_chunk_BFG4ZWR4();
15662
15722
  init_chunk_2R5D4TEX();
15663
- init_chunk_MO23HUAX();
15723
+ init_chunk_7NQZRSSJ();
15664
15724
  init_chunk_OMPT4ZHR();
15665
15725
  init_chunk_HZ6CADSY();
15666
15726
  init_chunk_MIWZOSPI();
@@ -15847,7 +15907,7 @@ var init_chunk_7SJEG3UO = __esm({
15847
15907
  });
15848
15908
  adminScopedTargetBody = adminScopedTargetShape.strict().superRefine(refineScopedTarget);
15849
15909
  adminDryRunByDefaultTargetBody = adminScopedTargetShape.extend({ dry_run: external_exports.boolean().optional().default(true) }).strict().superRefine(refineScopedTarget);
15850
- WAYAI_HOST_TOKEN_TARGET_KINDS = ["toolset", "seed", "connection", "credential"];
15910
+ WAYAI_HOST_TOKEN_TARGET_KINDS = ["toolset", "seed", "connection", "tool", "credential"];
15851
15911
  WAYAI_HOST_TOKEN_MAX_TARGETS = 50;
15852
15912
  adminClearWayaiHostTokensBody = adminScopedTargetShape.extend({
15853
15913
  dry_run: external_exports.boolean().optional().default(true),
@@ -16450,6 +16510,7 @@ var init_contracts = __esm({
16450
16510
  "use strict";
16451
16511
  init_chunk_RACEDHG6();
16452
16512
  init_chunk_Q7KIQHAZ();
16513
+ init_chunk_IPXBFWUU();
16453
16514
  init_chunk_NKLVUTFO();
16454
16515
  init_chunk_WL5QGKHN();
16455
16516
  init_chunk_YVY2TZK2();
@@ -16457,47 +16518,47 @@ var init_contracts = __esm({
16457
16518
  init_chunk_HIGKBEPF();
16458
16519
  init_chunk_HA7CRZMX();
16459
16520
  init_chunk_MF2VVXBR();
16460
- init_chunk_IPXBFWUU();
16521
+ init_chunk_WE4KMHZK();
16461
16522
  init_chunk_P5GJNS5R();
16462
16523
  init_chunk_JW6QQD5K();
16463
16524
  init_chunk_ZC6YGHNX();
16525
+ init_chunk_MGBAXT5Y();
16464
16526
  init_chunk_5DGHIY7L();
16465
- init_chunk_5SG6USCJ();
16527
+ init_chunk_2FWVCLBC();
16466
16528
  init_chunk_IPDOHAZ5();
16467
16529
  init_chunk_PFGVH2CX();
16468
- init_chunk_GPM7PE44();
16530
+ init_chunk_FPSDNS2E();
16469
16531
  init_chunk_TSIH4Y2H();
16470
16532
  init_chunk_U6S4MZGT();
16471
16533
  init_chunk_ZXK6N2HN();
16472
16534
  init_chunk_Y7CFCYX4();
16473
- init_chunk_MGBAXT5Y();
16474
16535
  init_chunk_YUZFHVB2();
16475
16536
  init_chunk_I3O2RACG();
16476
16537
  init_chunk_CMRECH67();
16477
16538
  init_chunk_34LE6P7E();
16478
- init_chunk_FPSDNS2E();
16539
+ init_chunk_IR2NOSI3();
16479
16540
  init_chunk_OPETF4GS();
16480
16541
  init_chunk_SY6PLCPK();
16481
16542
  init_chunk_KMAC3O3L();
16543
+ init_chunk_MH4O3YEX();
16482
16544
  init_chunk_65MH4JRN();
16483
16545
  init_chunk_KSTYTQ7I();
16484
16546
  init_chunk_LKBSHANA();
16485
16547
  init_chunk_I2EVH3FR();
16486
16548
  init_chunk_C4HEZ7ZI();
16487
- init_chunk_IR2NOSI3();
16488
16549
  init_chunk_UCYWGWQT();
16489
16550
  init_chunk_6AYIXGDT();
16490
16551
  init_chunk_YULHXJ5M();
16491
16552
  init_chunk_V4FRPRH5();
16492
16553
  init_chunk_LWMLR2WI();
16493
16554
  init_chunk_ACGAI25T();
16494
- init_chunk_MH4O3YEX();
16495
16555
  init_chunk_YWZFB34T();
16496
16556
  init_chunk_PZPOUXJR();
16497
16557
  init_chunk_E4DIIOOE();
16558
+ init_chunk_GAANFFN7();
16498
16559
  init_chunk_7CYHPF35();
16499
16560
  init_chunk_NETRUHZF();
16500
- init_chunk_KOLSAPLZ();
16561
+ init_chunk_Z6H7PHIF();
16501
16562
  init_chunk_YI3ORIXJ();
16502
16563
  init_chunk_T6D3YZ6B();
16503
16564
  init_chunk_66EZQ7Y7();
@@ -16507,13 +16568,13 @@ var init_contracts = __esm({
16507
16568
  init_chunk_4LXDRTO4();
16508
16569
  init_chunk_JDJ4EUOL();
16509
16570
  init_chunk_NVKU5PPQ();
16510
- init_chunk_7SJEG3UO();
16571
+ init_chunk_4KGSO7DL();
16511
16572
  init_chunk_FECLIZTY();
16512
16573
  init_chunk_BFG4ZWR4();
16513
16574
  init_chunk_2R5D4TEX();
16514
- init_chunk_MO23HUAX();
16515
- init_chunk_X5PZZVTS();
16575
+ init_chunk_7NQZRSSJ();
16516
16576
  init_chunk_D3EP4TDU();
16577
+ init_chunk_X5PZZVTS();
16517
16578
  init_chunk_K5UAZWFF();
16518
16579
  init_chunk_2PZIF56U();
16519
16580
  init_chunk_UEJOG2Q7();
@@ -16524,7 +16585,7 @@ var init_contracts = __esm({
16524
16585
  init_chunk_L4YFOZGK();
16525
16586
  init_chunk_ULQGJUXZ();
16526
16587
  init_chunk_OMPT4ZHR();
16527
- init_chunk_SMVVXYHP();
16588
+ init_chunk_EJRDF5B6();
16528
16589
  init_chunk_SOJMWM63();
16529
16590
  init_chunk_WTOA3ANF();
16530
16591
  init_chunk_5FO3GNKP();
@@ -16688,7 +16749,7 @@ var UUID_RE2, WAYAI_WORKSPACE_LAYOUT;
16688
16749
  var init_dist = __esm({
16689
16750
  "../../packages/core/dist/index.js"() {
16690
16751
  "use strict";
16691
- init_chunk_SMVVXYHP();
16752
+ init_chunk_EJRDF5B6();
16692
16753
  init_chunk_SOJMWM63();
16693
16754
  init_chunk_WTOA3ANF();
16694
16755
  init_chunk_5FO3GNKP();
@@ -17948,6 +18009,7 @@ var init_utils = __esm({
17948
18009
  ["admin cases enable", { positionals: 0 }],
17949
18010
  ["admin cases disable", { positionals: 0 }],
17950
18011
  ["admin cases status", { positionals: 0 }],
18012
+ ["admin cases create", { positionals: 0, values: ["--org", "--name"] }],
17951
18013
  ["admin communities enable", { positionals: 0 }],
17952
18014
  ["admin communities disable", { positionals: 0 }],
17953
18015
  ["admin communities status", { positionals: 0 }],
@@ -18501,6 +18563,11 @@ var init_api_client = __esm({
18501
18563
  async adminCreateCommunity(body) {
18502
18564
  return this.request("POST", "/api/admin/communities", body);
18503
18565
  }
18566
+ // Create an org's case space (platform-admin gated, wayai#5921). Used by
18567
+ // `wayai admin cases create`.
18568
+ async adminCreateCaseSpace(body) {
18569
+ return this.request("POST", "/api/admin/cases/spaces", body);
18570
+ }
18504
18571
  // Destroy an org-owned community (platform-admin gated, gh #4872). Used by
18505
18572
  // `wayai admin communities destroy`.
18506
18573
  async adminDestroyCommunity(communityId) {
@@ -22946,7 +23013,7 @@ var init_hub_materializer = __esm({
22946
23013
  var init_ci = __esm({
22947
23014
  "../../packages/core/dist/contracts/ci.js"() {
22948
23015
  "use strict";
22949
- init_chunk_KOLSAPLZ();
23016
+ init_chunk_Z6H7PHIF();
22950
23017
  init_chunk_YI3ORIXJ();
22951
23018
  init_chunk_T6D3YZ6B();
22952
23019
  init_chunk_66EZQ7Y7();
@@ -22954,9 +23021,9 @@ var init_ci = __esm({
22954
23021
  init_chunk_2YEGUQR7();
22955
23022
  init_chunk_LBDH7LCG();
22956
23023
  init_chunk_4LXDRTO4();
22957
- init_chunk_MO23HUAX();
22958
- init_chunk_X5PZZVTS();
23024
+ init_chunk_7NQZRSSJ();
22959
23025
  init_chunk_D3EP4TDU();
23026
+ init_chunk_X5PZZVTS();
22960
23027
  init_chunk_K5UAZWFF();
22961
23028
  init_chunk_L4YFOZGK();
22962
23029
  init_chunk_WTOA3ANF();
@@ -38237,6 +38304,9 @@ async function adminCommand(args2) {
38237
38304
  case "status":
38238
38305
  await runPlatformGateStatus(CASES_GATE, flagArgs);
38239
38306
  return;
38307
+ case "create":
38308
+ await runCasesCreate(flagArgs);
38309
+ return;
38240
38310
  default:
38241
38311
  printHelp2();
38242
38312
  process.exit(1);
@@ -38893,6 +38963,7 @@ async function runClearWayaiHostTokens(flagArgs) {
38893
38963
  c.referenced_by.length > 0 ? `referenced_by=${c.referenced_by.join(",")}` : null
38894
38964
  ].filter(Boolean).join(" ");
38895
38965
  console.log(` ${c.target} org=${c.org_id} hub=${c.hub_id} ${facts} -> ${c.action ?? `none (${c.reason})`}`);
38966
+ if (c.tool_targets?.length) console.log(` tool targets first: ${c.tool_targets.map((t) => `--id ${t}`).join(" ")}`);
38896
38967
  }
38897
38968
  for (const c of data.credentials) {
38898
38969
  console.log(
@@ -39451,6 +39522,60 @@ async function runCasesToggle(enable, flagArgs) {
39451
39522
  await runPlatformGateToggle(CASES_GATE, enable, flagArgs);
39452
39523
  console.log(PLATFORM_CONFIG_PROPAGATION_NOTE);
39453
39524
  }
39525
+ async function runCasesCreate(flagArgs) {
39526
+ const usage3 = "wayai admin cases create --org <org_id> --name <name> [--json]";
39527
+ let orgId;
39528
+ let name;
39529
+ let jsonOutput = false;
39530
+ for (let i = 0; i < flagArgs.length; i++) {
39531
+ const flag = flagArgs[i];
39532
+ if (flag === "--org") {
39533
+ orgId = requireFlagValue(flagArgs, i + 1, "--org");
39534
+ i++;
39535
+ } else if (flag === "--name") {
39536
+ name = requireFlagValue(flagArgs, i + 1, "--name");
39537
+ i++;
39538
+ } else if (flag === "--json") {
39539
+ jsonOutput = true;
39540
+ } else {
39541
+ console.error(`Unknown flag: ${flag}`);
39542
+ console.error(usage3);
39543
+ process.exit(1);
39544
+ }
39545
+ }
39546
+ const parsed = adminCreateCaseSpaceBody.safeParse({ org_id: orgId, name });
39547
+ if (!parsed.success) {
39548
+ console.error(parsed.error.issues.map((issue) => `--${issue.path[0] === "org_id" ? "org" : issue.path[0]}: ${issue.message}`).join("\n"));
39549
+ console.error(usage3);
39550
+ process.exit(1);
39551
+ }
39552
+ const { config, accessToken } = await requireAuth();
39553
+ const client = new ApiClient({ apiUrl: config.api_url, accessToken });
39554
+ let data;
39555
+ try {
39556
+ data = (await client.adminCreateCaseSpace(parsed.data)).data;
39557
+ } catch (err) {
39558
+ if (err instanceof ApiError && err.status === 404) {
39559
+ console.error(`Organization ${parsed.data.org_id} not found.`);
39560
+ process.exit(1);
39561
+ }
39562
+ if (err instanceof ApiError && err.status === 409) {
39563
+ console.error(conflictReasonOf(err) === CASE_REGISTRY_CLOSED_REASON ? `A deletion of organization ${parsed.data.org_id} closed it to new case spaces.` : "The organization already holds as many case spaces as it may (`wayai admin config` cases_spaces_per_org_max).");
39564
+ process.exit(1);
39565
+ }
39566
+ if (err instanceof ApiError && err.status === 503) {
39567
+ console.error(errorCodeOf(err.body) === "TRANSIENT_STORAGE" ? `The platform was briefly unavailable, and the case space may have been created. Check organization ${parsed.data.org_id}'s case spaces before running the command again.` : "The case space was not created in time. Run the command again.");
39568
+ process.exit(1);
39569
+ }
39570
+ exitOnApiError(err);
39571
+ throw err;
39572
+ }
39573
+ if (jsonOutput) {
39574
+ console.log(JSON.stringify(data, null, 2));
39575
+ return;
39576
+ }
39577
+ console.log(`Created case space ${data.space_id} \u2014 "${data.name}", of organization ${data.org_id}. Its owner administers it.`);
39578
+ }
39454
39579
  async function runCommunitiesToggle(enable, flagArgs) {
39455
39580
  await runPlatformGateToggle(COMMUNITIES_GATE, enable, flagArgs);
39456
39581
  if (enable) {
@@ -40431,6 +40556,8 @@ Usage:
40431
40556
  wayai admin cases enable Flip the platform cases_enabled kill switch ON
40432
40557
  wayai admin cases disable Flip it OFF
40433
40558
  wayai admin cases status Print the kill switch
40559
+ wayai admin cases create --org <org_id> --name <name> [--json]
40560
+ Create a case space of the org, which its owner administers; works while the switch is OFF
40434
40561
 
40435
40562
  wayai admin communities enable Flip the platform communities_enabled kill switch ON (members reach communities while threads is ON too)
40436
40563
  wayai admin communities disable Flip it OFF: no member reaches a community
@@ -40515,9 +40642,10 @@ Sources:
40515
40642
  day. It reports by default and deletes only with --apply.
40516
40643
  \`clear-wayai-host-tokens\` clears the WayAI tokens hub connections still store
40517
40644
  (#5644): it lists every candidate and what it would do, and acts only on
40518
- the targets --id names, with --apply. A seed's token goes only once it records
40519
- its binding; a production row goes only once no preview maps it and nothing
40520
- points at it.
40645
+ the targets --id names, with --apply. A seed's token goes once it records its
40646
+ binding, and a seed recording none is deleted; a production row goes only once
40647
+ no preview maps it and nothing points at it, and a production tool pointing at
40648
+ it (tool:<id>, listed under the row) can be named first to free it.
40521
40649
  orgs Org roster repair. \`repair-legacy-grants\` fixes member_grant rows the
40522
40650
  platform-admin org-admin add wrote before #3922: the email landed in the
40523
40651
  user_id column with user_email NULL. Auth reads UserDO, never member_grant,
@@ -40548,7 +40676,8 @@ Sources:
40548
40676
  about 60 s.
40549
40677
  cases The cases gate, default-deny: the PLATFORM-wide cases_enabled switch
40550
40678
  (\`enable\`/\`disable\`), independent of threads. Changes land within about
40551
- 60 s.
40679
+ 60 s. \`create\` makes an org's case space, whichever way the switch is set;
40680
+ deleting an org destroys its spaces too.
40552
40681
  communities Org-owned communities. \`enable\`/\`disable\` flip the PLATFORM-wide
40553
40682
  communities_enabled switch, default-deny and nested in threads: members
40554
40683
  reach a community only while both switches are on. \`create\` makes a