@wayai/cli 0.3.318 → 0.3.319

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
@@ -5104,6 +5104,85 @@ var init_fs_safety = __esm({
5104
5104
  }
5105
5105
  });
5106
5106
 
5107
+ // ../../packages/core/dist/chunk-Q7KIQHAZ.js
5108
+ var initialValueCreateSchema, initialValueUpdateSchema, stateIdParam, listStatesQuery, stateNameSchema, createStateBody, updateStateBody, reorderStatesBody;
5109
+ var init_chunk_Q7KIQHAZ = __esm({
5110
+ "../../packages/core/dist/chunk-Q7KIQHAZ.js"() {
5111
+ "use strict";
5112
+ init_chunk_6TSQ5HXC();
5113
+ init_zod();
5114
+ initialValueCreateSchema = external_exports.record(external_exports.unknown()).nullish().transform((v) => v && Object.keys(v).length > 0 ? v : null);
5115
+ initialValueUpdateSchema = external_exports.record(external_exports.unknown()).nullish().transform((v) => v === void 0 ? void 0 : v && Object.keys(v).length > 0 ? v : null);
5116
+ stateIdParam = external_exports.object({
5117
+ id: external_exports.string().uuid()
5118
+ });
5119
+ listStatesQuery = external_exports.object({
5120
+ hub_id: external_exports.string().uuid()
5121
+ });
5122
+ 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");
5123
+ createStateBody = external_exports.object({
5124
+ hub_id: external_exports.string().uuid(),
5125
+ state_slug: slugSchema,
5126
+ state_name: stateNameSchema,
5127
+ state_scope: external_exports.enum(["conversation", "user"]),
5128
+ state_description: external_exports.string().max(1e3).nullish(),
5129
+ json_schema: external_exports.record(external_exports.unknown()).default({}),
5130
+ initial_value: initialValueCreateSchema,
5131
+ display_order: external_exports.number().int().nonnegative().optional(),
5132
+ is_enabled: external_exports.boolean().default(true),
5133
+ inject_in_last_message: external_exports.boolean().default(true)
5134
+ });
5135
+ updateStateBody = external_exports.object({
5136
+ // state_slug is immutable after first persist — not accepted here.
5137
+ state_name: stateNameSchema.optional(),
5138
+ state_scope: external_exports.enum(["conversation", "user"]).optional(),
5139
+ state_description: external_exports.string().max(1e3).nullish(),
5140
+ json_schema: external_exports.record(external_exports.unknown()).optional(),
5141
+ initial_value: initialValueUpdateSchema,
5142
+ display_order: external_exports.number().int().nonnegative().optional(),
5143
+ is_enabled: external_exports.boolean().optional(),
5144
+ inject_in_last_message: external_exports.boolean().optional()
5145
+ });
5146
+ reorderStatesBody = external_exports.object({
5147
+ states: external_exports.array(external_exports.object({
5148
+ state_id: external_exports.string().uuid(),
5149
+ display_order: external_exports.number().int().nonnegative()
5150
+ })).min(1)
5151
+ });
5152
+ }
5153
+ });
5154
+
5155
+ // ../../packages/core/dist/chunk-NKLVUTFO.js
5156
+ var BASE_CREDENTIAL_MANAGED_BY, BASE_CREDENTIAL_NAME_MAX, BASE_CREDENTIAL_NAME_PATTERN, BASE_CREDENTIAL_NAME_CHARSET, baseCredentialNameSchema, createBaseCredentialLinkBody, baseCredentialLinkParams, baseCredentialLinkQuery;
5157
+ var init_chunk_NKLVUTFO = __esm({
5158
+ "../../packages/core/dist/chunk-NKLVUTFO.js"() {
5159
+ "use strict";
5160
+ init_zod();
5161
+ BASE_CREDENTIAL_MANAGED_BY = {
5162
+ DIRECT: "direct",
5163
+ ORG_LINK: "org-link"
5164
+ };
5165
+ BASE_CREDENTIAL_NAME_MAX = 100;
5166
+ BASE_CREDENTIAL_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:@+~=-]*$/;
5167
+ BASE_CREDENTIAL_NAME_CHARSET = "letters, digits and '. _ : @ + ~ = -', starting with a letter or digit";
5168
+ baseCredentialNameSchema = external_exports.string().min(1).max(BASE_CREDENTIAL_NAME_MAX).regex(BASE_CREDENTIAL_NAME_PATTERN, `name must use ${BASE_CREDENTIAL_NAME_CHARSET}`);
5169
+ createBaseCredentialLinkBody = external_exports.object({
5170
+ organization_id: external_exports.string().uuid(),
5171
+ base_id: external_exports.string().min(1),
5172
+ /** Defaults to a slug derived from the credential's display name. */
5173
+ name: baseCredentialNameSchema.optional()
5174
+ });
5175
+ baseCredentialLinkParams = external_exports.object({
5176
+ id: external_exports.string().uuid(),
5177
+ base_credential_id: external_exports.string().min(1)
5178
+ });
5179
+ baseCredentialLinkQuery = external_exports.object({
5180
+ organization_id: external_exports.string().uuid(),
5181
+ base_id: external_exports.string().min(1)
5182
+ });
5183
+ }
5184
+ });
5185
+
5107
5186
  // ../../packages/core/dist/chunk-HZ6CADSY.js
5108
5187
  function optionalTrimmedText(max) {
5109
5188
  return external_exports.string().trim().max(max).optional().transform((value) => value ? value : void 0);
@@ -5593,50 +5672,15 @@ var init_chunk_RACEDHG6 = __esm({
5593
5672
  }
5594
5673
  });
5595
5674
 
5596
- // ../../packages/core/dist/chunk-Q7KIQHAZ.js
5597
- var initialValueCreateSchema, initialValueUpdateSchema, stateIdParam, listStatesQuery, stateNameSchema, createStateBody, updateStateBody, reorderStatesBody;
5598
- var init_chunk_Q7KIQHAZ = __esm({
5599
- "../../packages/core/dist/chunk-Q7KIQHAZ.js"() {
5675
+ // ../../packages/core/dist/chunk-HIGKBEPF.js
5676
+ var accessExplainQuery;
5677
+ var init_chunk_HIGKBEPF = __esm({
5678
+ "../../packages/core/dist/chunk-HIGKBEPF.js"() {
5600
5679
  "use strict";
5601
- init_chunk_6TSQ5HXC();
5680
+ init_chunk_HZ6CADSY();
5602
5681
  init_zod();
5603
- initialValueCreateSchema = external_exports.record(external_exports.unknown()).nullish().transform((v) => v && Object.keys(v).length > 0 ? v : null);
5604
- initialValueUpdateSchema = external_exports.record(external_exports.unknown()).nullish().transform((v) => v === void 0 ? void 0 : v && Object.keys(v).length > 0 ? v : null);
5605
- stateIdParam = external_exports.object({
5606
- id: external_exports.string().uuid()
5607
- });
5608
- listStatesQuery = external_exports.object({
5609
- hub_id: external_exports.string().uuid()
5610
- });
5611
- 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");
5612
- createStateBody = external_exports.object({
5613
- hub_id: external_exports.string().uuid(),
5614
- state_slug: slugSchema,
5615
- state_name: stateNameSchema,
5616
- state_scope: external_exports.enum(["conversation", "user"]),
5617
- state_description: external_exports.string().max(1e3).nullish(),
5618
- json_schema: external_exports.record(external_exports.unknown()).default({}),
5619
- initial_value: initialValueCreateSchema,
5620
- display_order: external_exports.number().int().nonnegative().optional(),
5621
- is_enabled: external_exports.boolean().default(true),
5622
- inject_in_last_message: external_exports.boolean().default(true)
5623
- });
5624
- updateStateBody = external_exports.object({
5625
- // state_slug is immutable after first persist — not accepted here.
5626
- state_name: stateNameSchema.optional(),
5627
- state_scope: external_exports.enum(["conversation", "user"]).optional(),
5628
- state_description: external_exports.string().max(1e3).nullish(),
5629
- json_schema: external_exports.record(external_exports.unknown()).optional(),
5630
- initial_value: initialValueUpdateSchema,
5631
- display_order: external_exports.number().int().nonnegative().optional(),
5632
- is_enabled: external_exports.boolean().optional(),
5633
- inject_in_last_message: external_exports.boolean().optional()
5634
- });
5635
- reorderStatesBody = external_exports.object({
5636
- states: external_exports.array(external_exports.object({
5637
- state_id: external_exports.string().uuid(),
5638
- display_order: external_exports.number().int().nonnegative()
5639
- })).min(1)
5682
+ accessExplainQuery = external_exports.object({
5683
+ user_id: external_exports.string().regex(USER_ID_REGEX).optional()
5640
5684
  });
5641
5685
  }
5642
5686
  });
@@ -5792,377 +5836,6 @@ var init_chunk_IPXBFWUU = __esm({
5792
5836
  }
5793
5837
  });
5794
5838
 
5795
- // ../../packages/core/dist/chunk-NKLVUTFO.js
5796
- var BASE_CREDENTIAL_MANAGED_BY, BASE_CREDENTIAL_NAME_MAX, BASE_CREDENTIAL_NAME_PATTERN, BASE_CREDENTIAL_NAME_CHARSET, baseCredentialNameSchema, createBaseCredentialLinkBody, baseCredentialLinkParams, baseCredentialLinkQuery;
5797
- var init_chunk_NKLVUTFO = __esm({
5798
- "../../packages/core/dist/chunk-NKLVUTFO.js"() {
5799
- "use strict";
5800
- init_zod();
5801
- BASE_CREDENTIAL_MANAGED_BY = {
5802
- DIRECT: "direct",
5803
- ORG_LINK: "org-link"
5804
- };
5805
- BASE_CREDENTIAL_NAME_MAX = 100;
5806
- BASE_CREDENTIAL_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:@+~=-]*$/;
5807
- BASE_CREDENTIAL_NAME_CHARSET = "letters, digits and '. _ : @ + ~ = -', starting with a letter or digit";
5808
- baseCredentialNameSchema = external_exports.string().min(1).max(BASE_CREDENTIAL_NAME_MAX).regex(BASE_CREDENTIAL_NAME_PATTERN, `name must use ${BASE_CREDENTIAL_NAME_CHARSET}`);
5809
- createBaseCredentialLinkBody = external_exports.object({
5810
- organization_id: external_exports.string().uuid(),
5811
- base_id: external_exports.string().min(1),
5812
- /** Defaults to a slug derived from the credential's display name. */
5813
- name: baseCredentialNameSchema.optional()
5814
- });
5815
- baseCredentialLinkParams = external_exports.object({
5816
- id: external_exports.string().uuid(),
5817
- base_credential_id: external_exports.string().min(1)
5818
- });
5819
- baseCredentialLinkQuery = external_exports.object({
5820
- organization_id: external_exports.string().uuid(),
5821
- base_id: external_exports.string().min(1)
5822
- });
5823
- }
5824
- });
5825
-
5826
- // ../../packages/core/dist/chunk-ZC6YGHNX.js
5827
- var updateUserBody, updateProfileBody, pathnameRegex, updatePreferencesBody, registerPushTokenBody, deletePushTokenQuery, recordAiDisclosureAcceptanceBody, activityQuery, deletionModeSchema, deletionRequestBody;
5828
- var init_chunk_ZC6YGHNX = __esm({
5829
- "../../packages/core/dist/chunk-ZC6YGHNX.js"() {
5830
- "use strict";
5831
- init_zod();
5832
- updateUserBody = external_exports.object({
5833
- user_language: external_exports.string().optional(),
5834
- /** true: dark; false: light; null: follow each device's own setting (`AppearanceMode`). */
5835
- ui_dark_mode: external_exports.boolean().nullable().optional(),
5836
- profile_name: external_exports.string().optional(),
5837
- link_email_to_identities: external_exports.boolean().optional()
5838
- }).refine(
5839
- (data) => Object.values(data).some((v) => v !== void 0),
5840
- { message: "At least one field must be provided" }
5841
- );
5842
- updateProfileBody = external_exports.object({
5843
- display_name: external_exports.string().optional(),
5844
- avatar_url: external_exports.string().optional(),
5845
- preferences: external_exports.record(external_exports.unknown()).optional()
5846
- }).refine(
5847
- (data) => Object.values(data).some((v) => v !== void 0),
5848
- { message: "At least one field must be provided" }
5849
- );
5850
- pathnameRegex = /^\/(?!\/)[A-Za-z0-9\-._~!$&'()*+,;=:@/?%]*$/;
5851
- updatePreferencesBody = external_exports.object({
5852
- last_viewed_nav: external_exports.string().regex(pathnameRegex, "Must be a URL pathname").max(2048).optional(),
5853
- dismissed_agentic_shortcut: external_exports.boolean().optional(),
5854
- opened_guide: external_exports.boolean().optional()
5855
- }).passthrough();
5856
- registerPushTokenBody = external_exports.object({
5857
- token: external_exports.string().min(1).max(512),
5858
- platform: external_exports.enum(["ios", "android"]),
5859
- /** Stable per-install id so re-registration replaces the prior token for the device. */
5860
- device_id: external_exports.string().min(1).max(128).optional(),
5861
- /**
5862
- * The build opens a person-to-person thread from a push (gh #4661): only a token registered
5863
- * with it receives thread pushes, whose `data` carries `thread_id` and no `conversation_id`.
5864
- * Each registration states it afresh, so a build that sends none clears it.
5865
- */
5866
- supports_threads: external_exports.boolean().optional(),
5867
- /**
5868
- * The build opens a community from a push (gh #4872 Decision 8): only a token registered with it
5869
- * receives a community's pushes (an announcement, a reply to the member's forum post), whose
5870
- * `data` is `CommunityPushData` — never a `conversation_id` or a `thread_id`. Each registration
5871
- * states it afresh, so a build that sends none clears it.
5872
- */
5873
- supports_communities: external_exports.boolean().optional()
5874
- });
5875
- deletePushTokenQuery = external_exports.object({
5876
- token: external_exports.string().min(1).max(512)
5877
- });
5878
- recordAiDisclosureAcceptanceBody = external_exports.object({
5879
- version: external_exports.number().int().positive(),
5880
- withdrawn_at_seen: external_exports.string().datetime().nullable().optional()
5881
- });
5882
- activityQuery = external_exports.object({
5883
- limit: external_exports.coerce.number().int().min(1).max(100).optional()
5884
- });
5885
- deletionModeSchema = external_exports.enum(["scheduled", "immediate"]);
5886
- deletionRequestBody = external_exports.object({
5887
- mode: deletionModeSchema,
5888
- /** User-supplied reason captured in the audit log; bounded to bound logged PII. */
5889
- reason: external_exports.string().max(500).optional(),
5890
- /** Type-to-confirm value; must equal the user's email (constant-time compared). */
5891
- email_confirmation: external_exports.string().min(1).max(320)
5892
- });
5893
- }
5894
- });
5895
-
5896
- // ../../packages/core/dist/chunk-HIGKBEPF.js
5897
- var accessExplainQuery;
5898
- var init_chunk_HIGKBEPF = __esm({
5899
- "../../packages/core/dist/chunk-HIGKBEPF.js"() {
5900
- "use strict";
5901
- init_chunk_HZ6CADSY();
5902
- init_zod();
5903
- accessExplainQuery = external_exports.object({
5904
- user_id: external_exports.string().regex(USER_ID_REGEX).optional()
5905
- });
5906
- }
5907
- });
5908
-
5909
- // ../../packages/core/dist/chunk-IPDOHAZ5.js
5910
- var reportSourceSchema, intakeReportSourceSchema, reportClassificationSchema, reportStatusSchema, reportLocaleSchema, reportMessageAuthorRoleSchema, reportMessageSchema, sentryRefStatusSchema, createReportBody, editReportBody, reporterReportSummarySchema, reporterListResponseSchema, getReportResponseSchema, reporterTransitionResponseSchema, contestReportBody, reporterListQuery, listReportsQuery, GITHUB_ISSUE_URL_REGEX, githubIssueUrlSchema, transitionReportBody, groupReportsBody, holdReportBody;
5911
- var init_chunk_IPDOHAZ5 = __esm({
5912
- "../../packages/core/dist/chunk-IPDOHAZ5.js"() {
5913
- "use strict";
5914
- init_chunk_HZ6CADSY();
5915
- init_zod();
5916
- reportSourceSchema = external_exports.enum(["sentry", "cli", "review", "security_audit"]);
5917
- intakeReportSourceSchema = external_exports.enum(["cli", "review", "security_audit"]);
5918
- reportClassificationSchema = external_exports.enum(["bug", "flaky_test", "security", "enhancement"]);
5919
- reportStatusSchema = external_exports.enum([
5920
- "pending",
5921
- "grouped",
5922
- "escalated",
5923
- "shipped",
5924
- "contested",
5925
- "addressed",
5926
- "dismissed"
5927
- ]);
5928
- reportLocaleSchema = external_exports.enum(["en", "pt", "es"]);
5929
- reportMessageAuthorRoleSchema = external_exports.enum(["reporter", "triage", "fixer", "system"]);
5930
- reportMessageSchema = external_exports.object({
5931
- message_id: external_exports.string(),
5932
- author_role: reportMessageAuthorRoleSchema,
5933
- /** The status transition this note accompanied (e.g. 'shipped'); null for a free/system note. */
5934
- transition: external_exports.string().nullable(),
5935
- body: external_exports.string(),
5936
- created_at: timestampSchema,
5937
- /**
5938
- * Visibility: `false` = reporter-facing (the default for every narrative entry); `true` =
5939
- * triage-internal (e.g. a `hold` rationale) — surfaced to platform admins only and NEVER
5940
- * returned on the reporter read path. The reporter's `GET /api/reports/:id` filters these out.
5941
- */
5942
- internal: external_exports.boolean()
5943
- });
5944
- sentryRefStatusSchema = external_exports.enum(["valid", "not_found", "mismatch", "unverified"]);
5945
- createReportBody = external_exports.object({
5946
- title: external_exports.string().min(5).max(256),
5947
- description: external_exports.string().min(10).max(5e3),
5948
- steps_to_reproduce: external_exports.string().max(3e3).optional(),
5949
- error_message: external_exports.string().max(2e3).optional(),
5950
- // Taxonomy (server defaults: source=cli, classification=bug when absent).
5951
- source: intakeReportSourceSchema.optional(),
5952
- classification: reportClassificationSchema.optional(),
5953
- // Stable dedup key (e.g. "<file>::<test>" for flaky, "<file>:<line>" for
5954
- // security). When present, the fingerprint uses it instead of the body hash.
5955
- dedup_key: external_exports.string().min(1).max(256).optional(),
5956
- // Context fields (auto-captured by the CLI)
5957
- organization_id: external_exports.string().optional(),
5958
- hub_id: external_exports.string().uuid().optional(),
5959
- hub_name: external_exports.string().max(256).optional(),
5960
- conversation_id: external_exports.string().uuid().optional(),
5961
- agent_id: external_exports.string().uuid().optional(),
5962
- agent_name: external_exports.string().max(256).optional(),
5963
- client_version: external_exports.string().max(64).optional(),
5964
- additional_context: external_exports.string().max(2e3).optional()
5965
- });
5966
- editReportBody = external_exports.object({
5967
- title: external_exports.string().min(5).max(256).optional(),
5968
- description: external_exports.string().min(10).max(5e3).optional(),
5969
- steps_to_reproduce: external_exports.string().max(3e3).optional(),
5970
- error_message: external_exports.string().max(2e3).optional(),
5971
- additional_context: external_exports.string().max(2e3).optional()
5972
- }).strict().refine((b) => Object.keys(b).length > 0, {
5973
- message: "at least one field must be provided"
5974
- });
5975
- reporterReportSummarySchema = external_exports.object({
5976
- report_id: external_exports.string(),
5977
- title: external_exports.string(),
5978
- description: external_exports.string(),
5979
- classification: reportClassificationSchema,
5980
- status: reportStatusSchema,
5981
- created_at: timestampSchema,
5982
- triaged_at: timestampSchema.nullable(),
5983
- resolved_at: timestampSchema.nullable(),
5984
- /** How many times the reporter has contested (gates the hard cap). */
5985
- contest_count: external_exports.number(),
5986
- /** True once triage issued a non-contestable (final) dismissal. */
5987
- dismissal_final: external_exports.boolean()
5988
- });
5989
- reporterListResponseSchema = external_exports.object({
5990
- data: external_exports.array(reporterReportSummarySchema)
5991
- });
5992
- getReportResponseSchema = external_exports.object({
5993
- report: reporterReportSummarySchema,
5994
- messages: external_exports.array(reportMessageSchema)
5995
- });
5996
- reporterTransitionResponseSchema = external_exports.object({
5997
- report: reporterReportSummarySchema
5998
- });
5999
- contestReportBody = external_exports.object({
6000
- reason: external_exports.string().min(1).max(5e3)
6001
- });
6002
- reporterListQuery = external_exports.object({
6003
- status: reportStatusSchema.optional()
6004
- });
6005
- listReportsQuery = external_exports.object({
6006
- status: reportStatusSchema.optional(),
6007
- source: reportSourceSchema.optional(),
6008
- limit: external_exports.coerce.number().int().min(1).max(200).optional(),
6009
- offset: external_exports.coerce.number().int().min(0).optional(),
6010
- /** ISO 8601 lower bound on created_at. */
6011
- since: external_exports.string().datetime().optional(),
6012
- /**
6013
- * ISO 8601 lower bound on resolution time — "what did we resolve recently", which `since`
6014
- * (a created_at filter) cannot answer for a long-lived report resolved yesterday. Implies
6015
- * a terminal status (`addressed`/`dismissed`) and orders on that same axis.
6016
- */
6017
- resolved_since: external_exports.string().datetime().optional()
6018
- });
6019
- GITHUB_ISSUE_URL_REGEX = /^https:\/\/github\.com\/[^/]+\/[^/]+\/issues\/\d+(?:[/?#]|$)/;
6020
- githubIssueUrlSchema = external_exports.string().url().refine((u) => GITHUB_ISSUE_URL_REGEX.test(u), {
6021
- message: "must be an https://github.com/<owner>/<repo>/issues/<number> URL"
6022
- });
6023
- transitionReportBody = external_exports.discriminatedUnion("target", [
6024
- external_exports.object({
6025
- target: external_exports.literal("escalated"),
6026
- gh_issue_url: githubIssueUrlSchema,
6027
- ai_verdict: external_exports.string().max(2e3).optional()
6028
- }),
6029
- external_exports.object({
6030
- target: external_exports.literal("shipped"),
6031
- note: external_exports.string().min(1).max(2e3).optional()
6032
- }),
6033
- external_exports.object({
6034
- target: external_exports.literal("addressed")
6035
- }),
6036
- external_exports.object({
6037
- target: external_exports.literal("dismissed"),
6038
- dismissal_reason: external_exports.string().min(1).max(5e3),
6039
- ai_verdict: external_exports.string().max(2e3).optional(),
6040
- final: external_exports.boolean().optional()
6041
- })
6042
- ]);
6043
- groupReportsBody = external_exports.object({
6044
- member_ids: external_exports.array(external_exports.string().uuid()).min(1).max(100)
6045
- });
6046
- holdReportBody = external_exports.object({
6047
- reason: external_exports.string().min(1).max(5e3)
6048
- });
6049
- }
6050
- });
6051
-
6052
- // ../../packages/core/dist/chunk-KEN2DASI.js
6053
- var SECOND_FACTOR_TIERS, secondFactorTier, META_ENTITY_ID_PATTERN, metaEntityId, whatsappCallbackBody, authMeResponse, wsTicketResponse, sessionCheckResponse, logoutResponse, magicCodeSendBody, magicCodeSendResponse, magicCodeVerifyBody, magicCodeVerifyResponse, passwordLoginBody, normalizeEmail, REVIEW_ACCOUNT_EMAILS;
6054
- var init_chunk_KEN2DASI = __esm({
6055
- "../../packages/core/dist/chunk-KEN2DASI.js"() {
6056
- "use strict";
6057
- init_zod();
6058
- SECOND_FACTOR_TIERS = ["off", "settings"];
6059
- secondFactorTier = external_exports.enum(SECOND_FACTOR_TIERS);
6060
- META_ENTITY_ID_PATTERN = /^\d{1,32}$/;
6061
- metaEntityId = external_exports.string().regex(META_ENTITY_ID_PATTERN, "must be a numeric Meta entity id");
6062
- whatsappCallbackBody = external_exports.object({
6063
- state: external_exports.string().min(1, "state is required"),
6064
- code: external_exports.string().optional(),
6065
- access_token: external_exports.string().optional(),
6066
- user_id: external_exports.string().optional(),
6067
- /**
6068
- * The phone number and WABA the operator actually picked in Meta's Embedded
6069
- * Signup popup (posted to the opener as `WA_EMBEDDED_SIGNUP`). Optional:
6070
- * older clients, and the redirect-based flow, never see that event and fall
6071
- * back to discovery.
6072
- */
6073
- phone_number_id: metaEntityId.optional(),
6074
- waba_id: metaEntityId.optional()
6075
- }).refine(
6076
- (data) => !!data.access_token || !!data.code,
6077
- { message: "Missing required parameters: state and either access_token or code" }
6078
- );
6079
- authMeResponse = external_exports.object({
6080
- user_id: external_exports.string(),
6081
- email: external_exports.string(),
6082
- org_id: external_exports.string().nullable(),
6083
- is_platform_admin: external_exports.boolean()
6084
- });
6085
- wsTicketResponse = external_exports.object({
6086
- ticket: external_exports.string(),
6087
- /** Seconds until the ticket expires if unconsumed. */
6088
- expires_in: external_exports.number()
6089
- });
6090
- sessionCheckResponse = external_exports.object({
6091
- valid: external_exports.literal(true)
6092
- });
6093
- logoutResponse = external_exports.object({
6094
- success: external_exports.literal(true)
6095
- });
6096
- magicCodeSendBody = external_exports.object({
6097
- email: external_exports.string().email("Invalid email").max(254)
6098
- // RFC 5321 max; bounds the request payload
6099
- });
6100
- magicCodeSendResponse = external_exports.object({
6101
- success: external_exports.literal(true)
6102
- });
6103
- magicCodeVerifyBody = external_exports.object({
6104
- email: external_exports.string().email("Invalid email").max(254),
6105
- // RFC 5321 max; bounds the request payload
6106
- code: external_exports.string().min(1, "Code is required").max(12)
6107
- // WorkOS sends a 6-digit code; bound the input
6108
- });
6109
- magicCodeVerifyResponse = external_exports.object({
6110
- access_token: external_exports.string(),
6111
- refresh_token: external_exports.string()
6112
- });
6113
- passwordLoginBody = external_exports.object({
6114
- email: external_exports.string().email("Invalid email").max(254),
6115
- // RFC 5321 max; bounds the request payload
6116
- password: external_exports.string().min(1, "Password is required").max(128)
6117
- // bound the payload; WorkOS validates
6118
- });
6119
- normalizeEmail = (email) => email.trim().toLowerCase();
6120
- REVIEW_ACCOUNT_EMAILS = new Set(
6121
- ["apple.review@wayai.pro", "play.review@wayai.pro", "microsoft.review@wayai.pro", "meta.review@wayai.pro"].map(
6122
- normalizeEmail
6123
- )
6124
- );
6125
- }
6126
- });
6127
-
6128
- // ../../packages/core/dist/chunk-PFGVH2CX.js
6129
- var secondFactorCode, secondFactorRecoveryCode, secondFactorCodeBody, secondFactorRecoveryBody, secondFactorDisableBody, setOrgSecondFactorBody;
6130
- var init_chunk_PFGVH2CX = __esm({
6131
- "../../packages/core/dist/chunk-PFGVH2CX.js"() {
6132
- "use strict";
6133
- init_chunk_KEN2DASI();
6134
- init_zod();
6135
- secondFactorCode = external_exports.string().regex(/^\d{6}$/, "Enter the 6-digit code");
6136
- secondFactorRecoveryCode = external_exports.string().min(1, "Enter a recovery code").max(64);
6137
- secondFactorCodeBody = external_exports.object({ code: secondFactorCode });
6138
- secondFactorRecoveryBody = external_exports.object({ recovery_code: secondFactorRecoveryCode });
6139
- secondFactorDisableBody = external_exports.union([
6140
- external_exports.object({ code: secondFactorCode, recovery_code: external_exports.undefined().optional() }),
6141
- external_exports.object({ recovery_code: secondFactorRecoveryCode, code: external_exports.undefined().optional() })
6142
- ]);
6143
- setOrgSecondFactorBody = external_exports.object({ tier: secondFactorTier });
6144
- }
6145
- });
6146
-
6147
- // ../../packages/core/dist/chunk-WE4KMHZK.js
6148
- var bootstrapQuery;
6149
- var init_chunk_WE4KMHZK = __esm({
6150
- "../../packages/core/dist/chunk-WE4KMHZK.js"() {
6151
- "use strict";
6152
- init_zod();
6153
- bootstrapQuery = external_exports.object({
6154
- active_hub_id: external_exports.string().uuid().optional(),
6155
- active_conversation_id: external_exports.string().uuid().optional(),
6156
- active_nav: external_exports.enum(["chat", "task", "support"]).optional(),
6157
- /**
6158
- * The people thread the URL names (`/chat/threads/:threadId`, gh #4661): the snapshot
6159
- * preloads it as `people.active_thread` when the viewer is a member.
6160
- */
6161
- active_thread_id: external_exports.string().uuid().optional()
6162
- });
6163
- }
6164
- });
6165
-
6166
5839
  // ../../packages/core/dist/chunk-SCC6AVLY.js
6167
5840
  var PERMISSIONS;
6168
5841
  var init_chunk_SCC6AVLY = __esm({
@@ -6742,303 +6415,72 @@ var init_chunk_5VGCQRPR = __esm({
6742
6415
  }
6743
6416
  });
6744
6417
 
6745
- // ../../packages/core/dist/chunk-ZVXO3XL6.js
6746
- 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;
6747
- var init_chunk_ZVXO3XL6 = __esm({
6748
- "../../packages/core/dist/chunk-ZVXO3XL6.js"() {
6749
- "use strict";
6750
- init_chunk_HZ6CADSY();
6751
- init_zod();
6752
- PEOPLE_CONTACT_PAGE_MAX = 100;
6753
- PEOPLE_CONTACT_PAGE_DEFAULT = 50;
6754
- PEOPLE_CONTACT_EMAIL_MAX_LENGTH = 254;
6755
- peopleUserIdSchema = external_exports.string().max(64).regex(USER_ID_REGEX, "must be a user id");
6756
- peopleInviteEmailSchema = external_exports.string().trim().max(PEOPLE_CONTACT_EMAIL_MAX_LENGTH).email();
6757
- peopleContactInviteBody = external_exports.object({
6758
- email: peopleInviteEmailSchema
6759
- }).strict();
6760
- peopleContactInviteIdParam = external_exports.object({ inviteId: uuidSchema });
6761
- peopleContactUserIdParam = external_exports.object({ userId: peopleUserIdSchema });
6762
- 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, {
6763
- message: "Name a thread or a community, not both",
6764
- path: ["community_id"]
6765
- });
6766
- peopleContactPageQuery = external_exports.object({
6767
- cursor: external_exports.string().min(1).max(256).optional(),
6768
- limit: external_exports.coerce.number().int().min(1).max(PEOPLE_CONTACT_PAGE_MAX).default(PEOPLE_CONTACT_PAGE_DEFAULT)
6769
- });
6770
- peopleOutgoingInviteSchema = external_exports.object({
6771
- invite_id: uuidSchema,
6772
- email: external_exports.string(),
6773
- status: external_exports.literal("sent"),
6774
- created_at: timestampSchema,
6775
- expires_at: timestampSchema
6776
- }).strict();
6777
- peopleContactPersonSchema = external_exports.object({
6778
- user_id: peopleUserIdSchema,
6779
- display_name: external_exports.string().nullable(),
6780
- email: external_exports.string().nullable()
6781
- }).strict();
6782
- peopleContactSchema = peopleContactPersonSchema.extend({ contact_since: timestampSchema, thread_id: uuidSchema }).strict();
6783
- peopleIncomingInviteSchema = external_exports.object({
6784
- invite_id: uuidSchema,
6785
- inviter: peopleContactPersonSchema,
6786
- created_at: timestampSchema,
6787
- expires_at: timestampSchema
6788
- }).strict();
6789
- peopleBlockedUserSchema = peopleContactPersonSchema.extend({ blocked_at: timestampSchema, deleted_user: external_exports.boolean() }).strict();
6790
- }
6791
- });
6792
-
6793
- // ../../packages/core/dist/chunk-Y7CFCYX4.js
6794
- var PEOPLE_REPORT_DETAILS_MAX_LENGTH, peopleReportReasonSchema, reportDetailsSchema, reportFields, peopleReportBody;
6795
- var init_chunk_Y7CFCYX4 = __esm({
6796
- "../../packages/core/dist/chunk-Y7CFCYX4.js"() {
6797
- "use strict";
6798
- init_chunk_ZVXO3XL6();
6799
- init_chunk_HZ6CADSY();
6800
- init_zod();
6801
- PEOPLE_REPORT_DETAILS_MAX_LENGTH = 500;
6802
- peopleReportReasonSchema = external_exports.enum(["spam", "harassment", "hate", "sexual", "violence", "other"]);
6803
- reportDetailsSchema = optionalTrimmedText(PEOPLE_REPORT_DETAILS_MAX_LENGTH);
6804
- reportFields = { reason: peopleReportReasonSchema, details: reportDetailsSchema };
6805
- peopleReportBody = external_exports.discriminatedUnion("target", [
6806
- external_exports.object({ target: external_exports.literal("message"), thread_id: uuidSchema, message_id: uuidSchema, ...reportFields }).strict(),
6807
- external_exports.object({ target: external_exports.literal("thread"), thread_id: uuidSchema, ...reportFields }).strict(),
6808
- external_exports.object({ target: external_exports.literal("user"), user_id: peopleUserIdSchema, thread_id: uuidSchema.optional(), ...reportFields }).strict(),
6809
- external_exports.object({
6810
- target: external_exports.literal("community_message"),
6811
- community_id: uuidSchema,
6812
- room_id: uuidSchema,
6813
- message_id: uuidSchema,
6814
- ...reportFields
6815
- }).strict(),
6816
- external_exports.object({ target: external_exports.literal("community_member"), community_id: uuidSchema, user_id: peopleUserIdSchema, ...reportFields }).strict()
6817
- ]);
6818
- }
6819
- });
6820
-
6821
- // ../../packages/core/dist/chunk-2YEGUQR7.js
6822
- var PERSON_ID_PATTERN, CONTACT_PERSON_ID_PATTERN, PERSON_ID_FORM_MESSAGE, userPersonIdSchema, personIdSchema;
6823
- var init_chunk_2YEGUQR7 = __esm({
6824
- "../../packages/core/dist/chunk-2YEGUQR7.js"() {
6418
+ // ../../packages/core/dist/chunk-ZC6YGHNX.js
6419
+ var updateUserBody, updateProfileBody, pathnameRegex, updatePreferencesBody, registerPushTokenBody, deletePushTokenQuery, recordAiDisclosureAcceptanceBody, activityQuery, deletionModeSchema, deletionRequestBody;
6420
+ var init_chunk_ZC6YGHNX = __esm({
6421
+ "../../packages/core/dist/chunk-ZC6YGHNX.js"() {
6825
6422
  "use strict";
6826
6423
  init_zod();
6827
- PERSON_ID_PATTERN = /^prs_[a-z2-7]{52}$/;
6828
- CONTACT_PERSON_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
6829
- PERSON_ID_FORM_MESSAGE = "Must be a person id (prs_\u2026) or a contact id (a lowercase UUID)";
6830
- userPersonIdSchema = external_exports.string().regex(PERSON_ID_PATTERN, { message: "Must be a person id (prs_\u2026)" });
6831
- personIdSchema = external_exports.string().refine(
6832
- (value) => PERSON_ID_PATTERN.test(value) || CONTACT_PERSON_ID_PATTERN.test(value),
6833
- { message: PERSON_ID_FORM_MESSAGE }
6424
+ updateUserBody = external_exports.object({
6425
+ user_language: external_exports.string().optional(),
6426
+ /** true: dark; false: light; null: follow each device's own setting (`AppearanceMode`). */
6427
+ ui_dark_mode: external_exports.boolean().nullable().optional(),
6428
+ profile_name: external_exports.string().optional(),
6429
+ link_email_to_identities: external_exports.boolean().optional()
6430
+ }).refine(
6431
+ (data) => Object.values(data).some((v) => v !== void 0),
6432
+ { message: "At least one field must be provided" }
6834
6433
  );
6835
- }
6836
- });
6837
-
6838
- // ../../packages/core/dist/chunk-UAOHHCW5.js
6839
- function normalizeContactPhone(raw) {
6840
- const compact = raw.trim().replace(/[\s\-.()]/g, "");
6841
- const withPlus = compact.startsWith("00") ? `+${compact.slice(2)}` : compact;
6842
- return /^\+[1-9]\d{7,14}$/.test(withPlus) ? withPlus : null;
6843
- }
6844
- function normalizeContactLabel(raw) {
6845
- return raw.trim().replace(/\s+/g, " ").toLowerCase();
6846
- }
6847
- function importRowLabels(row, batchLabels) {
6848
- return [.../* @__PURE__ */ new Set([...row.labels ?? [], ...batchLabels ?? []])];
6849
- }
6850
- 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;
6851
- var init_chunk_UAOHHCW5 = __esm({
6852
- "../../packages/core/dist/chunk-UAOHHCW5.js"() {
6853
- "use strict";
6854
- init_zod();
6855
- CONTACT_ENVIRONMENTS = ["production", "preview", "all"];
6856
- CONTACT_NAME_MAX = 200;
6857
- CONTACT_EMAIL_MAX = 320;
6858
- CONTACT_PHONE_INPUT_MAX = 40;
6859
- CONTACT_INSTAGRAM_SID_MAX = 64;
6860
- CONTACT_METADATA_MAX_BYTES = 4096;
6861
- CONTACT_LABEL_MAX = 64;
6862
- CONTACT_LABELS_MAX = 20;
6863
- CONTACT_SCOPE_TAGS_MAX = 20;
6864
- CONTACT_PAGE_MAX = 100;
6865
- CONTACT_IMPORT_BATCH_MAX = 500;
6866
- CONTACT_SEARCH_MAX = 100;
6867
- CONTACT_LIST_NAME_MAX = 64;
6868
- CONTACT_LIST_NAME_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
6869
- CONTACT_LIST_DESCRIPTION_MAX = 1e3;
6870
- CONTACT_LIST_FILTER_MAX = 20;
6871
- CONTACT_LIST_PINS_PER_REQUEST_MAX = 100;
6872
- SUPPRESSION_SCOPES = ["all", "marketing"];
6873
- SUPPRESSION_ID_REGEX = /^[0-9a-f]{64}$/;
6874
- contactName = external_exports.string().trim().min(1).max(CONTACT_NAME_MAX);
6875
- contactPhone = external_exports.string().max(CONTACT_PHONE_INPUT_MAX).transform((raw, ctx) => {
6876
- const phone = normalizeContactPhone(raw);
6877
- if (phone === null) {
6878
- ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Phone must be an international number, e.g. +5511999999999" });
6879
- return external_exports.NEVER;
6880
- }
6881
- return phone;
6882
- });
6883
- contactEmail = external_exports.string().trim().toLowerCase().max(CONTACT_EMAIL_MAX).email();
6884
- contactInstagramSid = external_exports.string().trim().min(1).max(CONTACT_INSTAGRAM_SID_MAX);
6885
- contactLabel = external_exports.string().max(CONTACT_LABEL_MAX).transform(normalizeContactLabel).refine((label3) => label3.length > 0, "A label cannot be empty").refine((label3) => !label3.includes(","), "A label cannot contain a comma");
6886
- contactLabels = external_exports.array(contactLabel).max(CONTACT_LABELS_MAX).transform((labels) => [...new Set(labels)]);
6887
- contactMetadata = external_exports.record(external_exports.unknown()).refine((metadata) => {
6888
- try {
6889
- return new TextEncoder().encode(JSON.stringify(metadata)).length <= CONTACT_METADATA_MAX_BYTES;
6890
- } catch {
6891
- return false;
6892
- }
6893
- }, `Metadata must serialize to at most ${CONTACT_METADATA_MAX_BYTES} bytes`);
6894
- scopeTagIds = external_exports.array(external_exports.string().uuid()).min(1).max(CONTACT_SCOPE_TAGS_MAX).transform((ids) => [...new Set(ids)]);
6895
- contactVisibilitySchema = external_exports.discriminatedUnion("scope", [
6896
- external_exports.object({ scope: external_exports.literal("all_hubs") }).strict(),
6897
- external_exports.object({ scope: external_exports.literal("tags"), tag_ids: scopeTagIds }).strict()
6898
- ]);
6899
- hasIdentity = (row) => Boolean(row.phone || row.email || row.instagram_sid);
6900
- IDENTITY_REQUIRED = "A contact needs a phone, an email or an Instagram id";
6901
- contactBookOrgQuery = external_exports.object({
6902
- organization_id: external_exports.string().uuid()
6903
- });
6904
- contactBookContactParam = external_exports.object({
6905
- contactId: external_exports.string().uuid()
6906
- });
6907
- contactBookListParam = external_exports.object({
6908
- listId: external_exports.string().uuid()
6909
- });
6910
- contactBookHubParam = external_exports.object({
6911
- hubId: external_exports.string().uuid()
6912
- });
6913
- contactBookPageQuery = external_exports.object({
6914
- cursor: external_exports.string().max(2048).optional(),
6915
- limit: external_exports.coerce.number().int().min(1).max(CONTACT_PAGE_MAX).default(50)
6916
- });
6917
- listContactBookContactsQuery = contactBookOrgQuery.merge(contactBookPageQuery).extend({
6918
- q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional(),
6919
- label: external_exports.string().max(CONTACT_LABEL_MAX).transform(normalizeContactLabel).optional(),
6920
- scope_tag_id: external_exports.string().uuid().optional()
6921
- });
6922
- listHubContactBookContactsQuery = contactBookPageQuery.extend({
6923
- q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional()
6924
- });
6925
- contactBookLinkCandidatesQuery = contactBookOrgQuery.extend({
6926
- email: contactEmail
6927
- });
6928
- listContactBookListMembersQuery = contactBookOrgQuery.merge(contactBookPageQuery);
6929
- contactRowFields = {
6930
- name: contactName,
6931
- phone: contactPhone.nullish(),
6932
- email: contactEmail.nullish(),
6933
- instagram_sid: contactInstagramSid.nullish(),
6934
- labels: contactLabels.optional(),
6935
- metadata: contactMetadata.optional()
6936
- };
6937
- createContactBookContactBody = external_exports.object({
6938
- organization_id: external_exports.string().uuid(),
6939
- ...contactRowFields,
6940
- visibility: contactVisibilitySchema,
6941
- environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
6942
- }).strict().refine(hasIdentity, IDENTITY_REQUIRED);
6943
- updateContactBookContactBody = external_exports.object({
6944
- name: contactName.optional(),
6945
- phone: contactPhone.nullable().optional(),
6946
- email: contactEmail.nullable().optional(),
6947
- instagram_sid: contactInstagramSid.nullable().optional(),
6948
- labels: contactLabels.optional(),
6949
- metadata: contactMetadata.optional(),
6950
- visibility: contactVisibilitySchema.optional(),
6951
- environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
6952
- }).strict();
6953
- contactImportRowSchema = external_exports.object(contactRowFields).strict().refine(hasIdentity, IDENTITY_REQUIRED);
6954
- importContactBookContactsBody = external_exports.object({
6955
- organization_id: external_exports.string().uuid(),
6956
- visibility: contactVisibilitySchema,
6957
- environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional(),
6958
- labels: contactLabels.optional(),
6959
- rows: external_exports.array(contactImportRowSchema).min(1).max(CONTACT_IMPORT_BATCH_MAX)
6960
- }).strict().superRefine((batch, ctx) => {
6961
- batch.rows.forEach((row, index) => {
6962
- if (importRowLabels(row, batch.labels).length > CONTACT_LABELS_MAX) {
6963
- ctx.addIssue({
6964
- code: external_exports.ZodIssueCode.custom,
6965
- path: ["rows", index, "labels"],
6966
- message: `A contact holds at most ${CONTACT_LABELS_MAX} labels, the batch's included`
6967
- });
6968
- }
6969
- });
6970
- });
6971
- linkContactBookContactBody = external_exports.object({
6972
- user_id: external_exports.string().min(1).max(128)
6973
- }).strict();
6974
- listName = external_exports.string().trim().min(1).max(CONTACT_LIST_NAME_MAX).regex(CONTACT_LIST_NAME_REGEX, {
6975
- message: 'Must be lowercase alphanumeric with hyphens (e.g. "vip-customers")'
6976
- });
6977
- contactListFilterSchema = external_exports.object({
6978
- labels: external_exports.array(contactLabel).max(CONTACT_LIST_FILTER_MAX).transform((l) => [...new Set(l)]).default([]),
6979
- scope_tag_ids: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_FILTER_MAX).transform((t) => [...new Set(t)]).default([])
6980
- }).strict();
6981
- createContactBookListBody = external_exports.object({
6982
- organization_id: external_exports.string().uuid(),
6983
- name: listName,
6984
- description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullish(),
6985
- filter: contactListFilterSchema.optional()
6986
- }).strict();
6987
- updateContactBookListBody = external_exports.object({
6988
- name: listName.optional(),
6989
- description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullable().optional(),
6990
- filter: contactListFilterSchema.optional()
6991
- }).strict();
6992
- updateContactBookListPinsBody = external_exports.object({
6993
- add: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([]),
6994
- remove: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([])
6995
- }).strict().refine((b) => b.add.length + b.remove.length > 0, "Add or remove at least one contact");
6996
- suppressionIdentitySchema = external_exports.discriminatedUnion("kind", [
6997
- external_exports.object({ kind: external_exports.literal("phone"), value: contactPhone }).strict(),
6998
- external_exports.object({ kind: external_exports.literal("email"), value: contactEmail }).strict(),
6999
- external_exports.object({ kind: external_exports.literal("instagram"), value: contactInstagramSid }).strict()
7000
- ]);
7001
- createContactBookSuppressionBody = external_exports.object({
7002
- organization_id: external_exports.string().uuid(),
7003
- identity: suppressionIdentitySchema,
7004
- scope: external_exports.enum(SUPPRESSION_SCOPES)
7005
- }).strict();
7006
- contactBookSuppressionParam = external_exports.object({
7007
- suppressionId: external_exports.string().regex(SUPPRESSION_ID_REGEX)
7008
- });
7009
- listContactBookSuppressionsQuery = contactBookOrgQuery.merge(contactBookPageQuery);
7010
- contactBookEmailUnsubscribeTokenSchema = external_exports.string().max(200).regex(/^[0-9a-f-]{36}\.[0-9a-f]{64}\.[0-9a-f]{64}$/i);
7011
- contactBookEmailUnsubscribeQuery = external_exports.object({ token: contactBookEmailUnsubscribeTokenSchema });
7012
- orgListReferenceSchema = listName;
7013
- }
7014
- });
7015
-
7016
- // ../../packages/core/dist/chunk-MGBAXT5Y.js
7017
- var PERSON_LINKS_MAX, PERSON_DENY_PAGE_MAX, personParam, personLinkParam, deniedPersonParam, listDeniedPersonsQuery, conversationCustomerPersonParam;
7018
- var init_chunk_MGBAXT5Y = __esm({
7019
- "../../packages/core/dist/chunk-MGBAXT5Y.js"() {
7020
- "use strict";
7021
- init_chunk_2YEGUQR7();
7022
- init_chunk_UAOHHCW5();
7023
- init_zod();
7024
- PERSON_LINKS_MAX = 15;
7025
- PERSON_DENY_PAGE_MAX = 100;
7026
- personParam = external_exports.object({
7027
- personId: userPersonIdSchema
6434
+ updateProfileBody = external_exports.object({
6435
+ display_name: external_exports.string().optional(),
6436
+ avatar_url: external_exports.string().optional(),
6437
+ preferences: external_exports.record(external_exports.unknown()).optional()
6438
+ }).refine(
6439
+ (data) => Object.values(data).some((v) => v !== void 0),
6440
+ { message: "At least one field must be provided" }
6441
+ );
6442
+ pathnameRegex = /^\/(?!\/)[A-Za-z0-9\-._~!$&'()*+,;=:@/?%]*$/;
6443
+ updatePreferencesBody = external_exports.object({
6444
+ last_viewed_nav: external_exports.string().regex(pathnameRegex, "Must be a URL pathname").max(2048).optional(),
6445
+ dismissed_agentic_shortcut: external_exports.boolean().optional(),
6446
+ opened_guide: external_exports.boolean().optional()
6447
+ }).passthrough();
6448
+ registerPushTokenBody = external_exports.object({
6449
+ token: external_exports.string().min(1).max(512),
6450
+ platform: external_exports.enum(["ios", "android"]),
6451
+ /** Stable per-install id so re-registration replaces the prior token for the device. */
6452
+ device_id: external_exports.string().min(1).max(128).optional(),
6453
+ /**
6454
+ * The build opens a person-to-person thread from a push (gh #4661): only a token registered
6455
+ * with it receives thread pushes, whose `data` carries `thread_id` and no `conversation_id`.
6456
+ * Each registration states it afresh, so a build that sends none clears it.
6457
+ */
6458
+ supports_threads: external_exports.boolean().optional(),
6459
+ /**
6460
+ * The build opens a community from a push (gh #4872 Decision 8): only a token registered with it
6461
+ * receives a community's pushes (an announcement, a reply to the member's forum post), whose
6462
+ * `data` is `CommunityPushData` — never a `conversation_id` or a `thread_id`. Each registration
6463
+ * states it afresh, so a build that sends none clears it.
6464
+ */
6465
+ supports_communities: external_exports.boolean().optional()
7028
6466
  });
7029
- personLinkParam = personParam.extend({
7030
- targetId: personIdSchema
6467
+ deletePushTokenQuery = external_exports.object({
6468
+ token: external_exports.string().min(1).max(512)
7031
6469
  });
7032
- deniedPersonParam = external_exports.object({
7033
- personId: personIdSchema
6470
+ recordAiDisclosureAcceptanceBody = external_exports.object({
6471
+ version: external_exports.number().int().positive(),
6472
+ withdrawn_at_seen: external_exports.string().datetime().nullable().optional()
7034
6473
  });
7035
- listDeniedPersonsQuery = contactBookOrgQuery.extend({
7036
- cursor: personIdSchema.optional(),
7037
- limit: external_exports.coerce.number().int().min(1).max(PERSON_DENY_PAGE_MAX).default(50)
6474
+ activityQuery = external_exports.object({
6475
+ limit: external_exports.coerce.number().int().min(1).max(100).optional()
7038
6476
  });
7039
- conversationCustomerPersonParam = external_exports.object({
7040
- hubId: external_exports.string().uuid(),
7041
- conversationId: external_exports.string().uuid()
6477
+ deletionModeSchema = external_exports.enum(["scheduled", "immediate"]);
6478
+ deletionRequestBody = external_exports.object({
6479
+ mode: deletionModeSchema,
6480
+ /** User-supplied reason captured in the audit log; bounded to bound logged PII. */
6481
+ reason: external_exports.string().max(500).optional(),
6482
+ /** Type-to-confirm value; must equal the user's email (constant-time compared). */
6483
+ email_confirmation: external_exports.string().min(1).max(320)
7042
6484
  });
7043
6485
  }
7044
6486
  });
@@ -7088,7 +6530,7 @@ var init_chunk_5FO3GNKP = __esm({
7088
6530
  }
7089
6531
  });
7090
6532
 
7091
- // ../../packages/core/dist/chunk-EJRDF5B6.js
6533
+ // ../../packages/core/dist/chunk-PC3774CE.js
7092
6534
  function matchPath(pattern, path45) {
7093
6535
  const pathSegments2 = path45.replace(/\/$/, "").split("/");
7094
6536
  const isPrefix = pattern.endsWith("/*");
@@ -7117,8 +6559,8 @@ function getEndpointConfig(path45) {
7117
6559
  return { tier: "STANDARD" };
7118
6560
  }
7119
6561
  var ENDPOINT_CONFIGS, EXCLUDED_PATHS;
7120
- var init_chunk_EJRDF5B6 = __esm({
7121
- "../../packages/core/dist/chunk-EJRDF5B6.js"() {
6562
+ var init_chunk_PC3774CE = __esm({
6563
+ "../../packages/core/dist/chunk-PC3774CE.js"() {
7122
6564
  "use strict";
7123
6565
  init_chunk_5FO3GNKP();
7124
6566
  ENDPOINT_CONFIGS = {
@@ -7448,6 +6890,8 @@ var init_chunk_EJRDF5B6 = __esm({
7448
6890
  // takes the same strict, fail-closed budget as the other hub repairs. Exact path, for the same reason.
7449
6891
  "/api/admin/hubs/repair-knowledge-blobs": { tier: "STRICT", userLimit: 10, userWindow: 3600, failClosed: true },
7450
6892
  "/api/admin/hubs/repair-credential-links": { tier: "STRICT", userLimit: 10, userWindow: 3600, failClosed: true },
6893
+ // The org credential service backfill (#5644) writes org credentials, and its dry run reads every org: the same budget.
6894
+ "/api/admin/organizations/repair-credential-services": { tier: "STRICT", userLimit: 10, userWindow: 3600, failClosed: true },
7451
6895
  // The WayAI-host token clear (#5644 steps 6–7) deletes connections and org credentials, and its dry run fans out over
7452
6896
  // every hub of every org: the same strict, fail-closed budget.
7453
6897
  "/api/admin/hubs/clear-wayai-host-tokens": { tier: "STRICT", userLimit: 10, userWindow: 3600, failClosed: true },
@@ -7621,7 +7065,7 @@ var init_chunk_EJRDF5B6 = __esm({
7621
7065
  }
7622
7066
  });
7623
7067
 
7624
- // ../../packages/core/dist/chunk-2FWVCLBC.js
7068
+ // ../../packages/core/dist/chunk-HFEOIQF4.js
7625
7069
  function fileSnapshotChanged(run) {
7626
7070
  return run.written + run.removed > 0;
7627
7071
  }
@@ -7662,10 +7106,10 @@ async function sendWithRetry(opts, cursor) {
7662
7106
  }
7663
7107
  }
7664
7108
  var rekorFileSnapshotAnswerSchema, FILE_SNAPSHOT_MAX_PAGES, FILE_SNAPSHOT_CONFLICT_ATTEMPTS, FILE_SNAPSHOT_PAGE_SPACING_MS, FILE_SNAPSHOT_CONFLICT_STATUS;
7665
- var init_chunk_2FWVCLBC = __esm({
7666
- "../../packages/core/dist/chunk-2FWVCLBC.js"() {
7109
+ var init_chunk_HFEOIQF4 = __esm({
7110
+ "../../packages/core/dist/chunk-HFEOIQF4.js"() {
7667
7111
  "use strict";
7668
- init_chunk_EJRDF5B6();
7112
+ init_chunk_PC3774CE();
7669
7113
  init_chunk_5FO3GNKP();
7670
7114
  init_zod();
7671
7115
  rekorFileSnapshotAnswerSchema = external_exports.object({
@@ -7688,6 +7132,635 @@ var init_chunk_2FWVCLBC = __esm({
7688
7132
  }
7689
7133
  });
7690
7134
 
7135
+ // ../../packages/core/dist/chunk-IPDOHAZ5.js
7136
+ var reportSourceSchema, intakeReportSourceSchema, reportClassificationSchema, reportStatusSchema, reportLocaleSchema, reportMessageAuthorRoleSchema, reportMessageSchema, sentryRefStatusSchema, createReportBody, editReportBody, reporterReportSummarySchema, reporterListResponseSchema, getReportResponseSchema, reporterTransitionResponseSchema, contestReportBody, reporterListQuery, listReportsQuery, GITHUB_ISSUE_URL_REGEX, githubIssueUrlSchema, transitionReportBody, groupReportsBody, holdReportBody;
7137
+ var init_chunk_IPDOHAZ5 = __esm({
7138
+ "../../packages/core/dist/chunk-IPDOHAZ5.js"() {
7139
+ "use strict";
7140
+ init_chunk_HZ6CADSY();
7141
+ init_zod();
7142
+ reportSourceSchema = external_exports.enum(["sentry", "cli", "review", "security_audit"]);
7143
+ intakeReportSourceSchema = external_exports.enum(["cli", "review", "security_audit"]);
7144
+ reportClassificationSchema = external_exports.enum(["bug", "flaky_test", "security", "enhancement"]);
7145
+ reportStatusSchema = external_exports.enum([
7146
+ "pending",
7147
+ "grouped",
7148
+ "escalated",
7149
+ "shipped",
7150
+ "contested",
7151
+ "addressed",
7152
+ "dismissed"
7153
+ ]);
7154
+ reportLocaleSchema = external_exports.enum(["en", "pt", "es"]);
7155
+ reportMessageAuthorRoleSchema = external_exports.enum(["reporter", "triage", "fixer", "system"]);
7156
+ reportMessageSchema = external_exports.object({
7157
+ message_id: external_exports.string(),
7158
+ author_role: reportMessageAuthorRoleSchema,
7159
+ /** The status transition this note accompanied (e.g. 'shipped'); null for a free/system note. */
7160
+ transition: external_exports.string().nullable(),
7161
+ body: external_exports.string(),
7162
+ created_at: timestampSchema,
7163
+ /**
7164
+ * Visibility: `false` = reporter-facing (the default for every narrative entry); `true` =
7165
+ * triage-internal (e.g. a `hold` rationale) — surfaced to platform admins only and NEVER
7166
+ * returned on the reporter read path. The reporter's `GET /api/reports/:id` filters these out.
7167
+ */
7168
+ internal: external_exports.boolean()
7169
+ });
7170
+ sentryRefStatusSchema = external_exports.enum(["valid", "not_found", "mismatch", "unverified"]);
7171
+ createReportBody = external_exports.object({
7172
+ title: external_exports.string().min(5).max(256),
7173
+ description: external_exports.string().min(10).max(5e3),
7174
+ steps_to_reproduce: external_exports.string().max(3e3).optional(),
7175
+ error_message: external_exports.string().max(2e3).optional(),
7176
+ // Taxonomy (server defaults: source=cli, classification=bug when absent).
7177
+ source: intakeReportSourceSchema.optional(),
7178
+ classification: reportClassificationSchema.optional(),
7179
+ // Stable dedup key (e.g. "<file>::<test>" for flaky, "<file>:<line>" for
7180
+ // security). When present, the fingerprint uses it instead of the body hash.
7181
+ dedup_key: external_exports.string().min(1).max(256).optional(),
7182
+ // Context fields (auto-captured by the CLI)
7183
+ organization_id: external_exports.string().optional(),
7184
+ hub_id: external_exports.string().uuid().optional(),
7185
+ hub_name: external_exports.string().max(256).optional(),
7186
+ conversation_id: external_exports.string().uuid().optional(),
7187
+ agent_id: external_exports.string().uuid().optional(),
7188
+ agent_name: external_exports.string().max(256).optional(),
7189
+ client_version: external_exports.string().max(64).optional(),
7190
+ additional_context: external_exports.string().max(2e3).optional()
7191
+ });
7192
+ editReportBody = external_exports.object({
7193
+ title: external_exports.string().min(5).max(256).optional(),
7194
+ description: external_exports.string().min(10).max(5e3).optional(),
7195
+ steps_to_reproduce: external_exports.string().max(3e3).optional(),
7196
+ error_message: external_exports.string().max(2e3).optional(),
7197
+ additional_context: external_exports.string().max(2e3).optional()
7198
+ }).strict().refine((b) => Object.keys(b).length > 0, {
7199
+ message: "at least one field must be provided"
7200
+ });
7201
+ reporterReportSummarySchema = external_exports.object({
7202
+ report_id: external_exports.string(),
7203
+ title: external_exports.string(),
7204
+ description: external_exports.string(),
7205
+ classification: reportClassificationSchema,
7206
+ status: reportStatusSchema,
7207
+ created_at: timestampSchema,
7208
+ triaged_at: timestampSchema.nullable(),
7209
+ resolved_at: timestampSchema.nullable(),
7210
+ /** How many times the reporter has contested (gates the hard cap). */
7211
+ contest_count: external_exports.number(),
7212
+ /** True once triage issued a non-contestable (final) dismissal. */
7213
+ dismissal_final: external_exports.boolean()
7214
+ });
7215
+ reporterListResponseSchema = external_exports.object({
7216
+ data: external_exports.array(reporterReportSummarySchema)
7217
+ });
7218
+ getReportResponseSchema = external_exports.object({
7219
+ report: reporterReportSummarySchema,
7220
+ messages: external_exports.array(reportMessageSchema)
7221
+ });
7222
+ reporterTransitionResponseSchema = external_exports.object({
7223
+ report: reporterReportSummarySchema
7224
+ });
7225
+ contestReportBody = external_exports.object({
7226
+ reason: external_exports.string().min(1).max(5e3)
7227
+ });
7228
+ reporterListQuery = external_exports.object({
7229
+ status: reportStatusSchema.optional()
7230
+ });
7231
+ listReportsQuery = external_exports.object({
7232
+ status: reportStatusSchema.optional(),
7233
+ source: reportSourceSchema.optional(),
7234
+ limit: external_exports.coerce.number().int().min(1).max(200).optional(),
7235
+ offset: external_exports.coerce.number().int().min(0).optional(),
7236
+ /** ISO 8601 lower bound on created_at. */
7237
+ since: external_exports.string().datetime().optional(),
7238
+ /**
7239
+ * ISO 8601 lower bound on resolution time — "what did we resolve recently", which `since`
7240
+ * (a created_at filter) cannot answer for a long-lived report resolved yesterday. Implies
7241
+ * a terminal status (`addressed`/`dismissed`) and orders on that same axis.
7242
+ */
7243
+ resolved_since: external_exports.string().datetime().optional()
7244
+ });
7245
+ GITHUB_ISSUE_URL_REGEX = /^https:\/\/github\.com\/[^/]+\/[^/]+\/issues\/\d+(?:[/?#]|$)/;
7246
+ githubIssueUrlSchema = external_exports.string().url().refine((u) => GITHUB_ISSUE_URL_REGEX.test(u), {
7247
+ message: "must be an https://github.com/<owner>/<repo>/issues/<number> URL"
7248
+ });
7249
+ transitionReportBody = external_exports.discriminatedUnion("target", [
7250
+ external_exports.object({
7251
+ target: external_exports.literal("escalated"),
7252
+ gh_issue_url: githubIssueUrlSchema,
7253
+ ai_verdict: external_exports.string().max(2e3).optional()
7254
+ }),
7255
+ external_exports.object({
7256
+ target: external_exports.literal("shipped"),
7257
+ note: external_exports.string().min(1).max(2e3).optional()
7258
+ }),
7259
+ external_exports.object({
7260
+ target: external_exports.literal("addressed")
7261
+ }),
7262
+ external_exports.object({
7263
+ target: external_exports.literal("dismissed"),
7264
+ dismissal_reason: external_exports.string().min(1).max(5e3),
7265
+ ai_verdict: external_exports.string().max(2e3).optional(),
7266
+ final: external_exports.boolean().optional()
7267
+ })
7268
+ ]);
7269
+ groupReportsBody = external_exports.object({
7270
+ member_ids: external_exports.array(external_exports.string().uuid()).min(1).max(100)
7271
+ });
7272
+ holdReportBody = external_exports.object({
7273
+ reason: external_exports.string().min(1).max(5e3)
7274
+ });
7275
+ }
7276
+ });
7277
+
7278
+ // ../../packages/core/dist/chunk-KEN2DASI.js
7279
+ var SECOND_FACTOR_TIERS, secondFactorTier, META_ENTITY_ID_PATTERN, metaEntityId, whatsappCallbackBody, authMeResponse, wsTicketResponse, sessionCheckResponse, logoutResponse, magicCodeSendBody, magicCodeSendResponse, magicCodeVerifyBody, magicCodeVerifyResponse, passwordLoginBody, normalizeEmail, REVIEW_ACCOUNT_EMAILS;
7280
+ var init_chunk_KEN2DASI = __esm({
7281
+ "../../packages/core/dist/chunk-KEN2DASI.js"() {
7282
+ "use strict";
7283
+ init_zod();
7284
+ SECOND_FACTOR_TIERS = ["off", "settings"];
7285
+ secondFactorTier = external_exports.enum(SECOND_FACTOR_TIERS);
7286
+ META_ENTITY_ID_PATTERN = /^\d{1,32}$/;
7287
+ metaEntityId = external_exports.string().regex(META_ENTITY_ID_PATTERN, "must be a numeric Meta entity id");
7288
+ whatsappCallbackBody = external_exports.object({
7289
+ state: external_exports.string().min(1, "state is required"),
7290
+ code: external_exports.string().optional(),
7291
+ access_token: external_exports.string().optional(),
7292
+ user_id: external_exports.string().optional(),
7293
+ /**
7294
+ * The phone number and WABA the operator actually picked in Meta's Embedded
7295
+ * Signup popup (posted to the opener as `WA_EMBEDDED_SIGNUP`). Optional:
7296
+ * older clients, and the redirect-based flow, never see that event and fall
7297
+ * back to discovery.
7298
+ */
7299
+ phone_number_id: metaEntityId.optional(),
7300
+ waba_id: metaEntityId.optional()
7301
+ }).refine(
7302
+ (data) => !!data.access_token || !!data.code,
7303
+ { message: "Missing required parameters: state and either access_token or code" }
7304
+ );
7305
+ authMeResponse = external_exports.object({
7306
+ user_id: external_exports.string(),
7307
+ email: external_exports.string(),
7308
+ org_id: external_exports.string().nullable(),
7309
+ is_platform_admin: external_exports.boolean()
7310
+ });
7311
+ wsTicketResponse = external_exports.object({
7312
+ ticket: external_exports.string(),
7313
+ /** Seconds until the ticket expires if unconsumed. */
7314
+ expires_in: external_exports.number()
7315
+ });
7316
+ sessionCheckResponse = external_exports.object({
7317
+ valid: external_exports.literal(true)
7318
+ });
7319
+ logoutResponse = external_exports.object({
7320
+ success: external_exports.literal(true)
7321
+ });
7322
+ magicCodeSendBody = external_exports.object({
7323
+ email: external_exports.string().email("Invalid email").max(254)
7324
+ // RFC 5321 max; bounds the request payload
7325
+ });
7326
+ magicCodeSendResponse = external_exports.object({
7327
+ success: external_exports.literal(true)
7328
+ });
7329
+ magicCodeVerifyBody = external_exports.object({
7330
+ email: external_exports.string().email("Invalid email").max(254),
7331
+ // RFC 5321 max; bounds the request payload
7332
+ code: external_exports.string().min(1, "Code is required").max(12)
7333
+ // WorkOS sends a 6-digit code; bound the input
7334
+ });
7335
+ magicCodeVerifyResponse = external_exports.object({
7336
+ access_token: external_exports.string(),
7337
+ refresh_token: external_exports.string()
7338
+ });
7339
+ passwordLoginBody = external_exports.object({
7340
+ email: external_exports.string().email("Invalid email").max(254),
7341
+ // RFC 5321 max; bounds the request payload
7342
+ password: external_exports.string().min(1, "Password is required").max(128)
7343
+ // bound the payload; WorkOS validates
7344
+ });
7345
+ normalizeEmail = (email) => email.trim().toLowerCase();
7346
+ REVIEW_ACCOUNT_EMAILS = new Set(
7347
+ ["apple.review@wayai.pro", "play.review@wayai.pro", "microsoft.review@wayai.pro", "meta.review@wayai.pro"].map(
7348
+ normalizeEmail
7349
+ )
7350
+ );
7351
+ }
7352
+ });
7353
+
7354
+ // ../../packages/core/dist/chunk-PFGVH2CX.js
7355
+ var secondFactorCode, secondFactorRecoveryCode, secondFactorCodeBody, secondFactorRecoveryBody, secondFactorDisableBody, setOrgSecondFactorBody;
7356
+ var init_chunk_PFGVH2CX = __esm({
7357
+ "../../packages/core/dist/chunk-PFGVH2CX.js"() {
7358
+ "use strict";
7359
+ init_chunk_KEN2DASI();
7360
+ init_zod();
7361
+ secondFactorCode = external_exports.string().regex(/^\d{6}$/, "Enter the 6-digit code");
7362
+ secondFactorRecoveryCode = external_exports.string().min(1, "Enter a recovery code").max(64);
7363
+ secondFactorCodeBody = external_exports.object({ code: secondFactorCode });
7364
+ secondFactorRecoveryBody = external_exports.object({ recovery_code: secondFactorRecoveryCode });
7365
+ secondFactorDisableBody = external_exports.union([
7366
+ external_exports.object({ code: secondFactorCode, recovery_code: external_exports.undefined().optional() }),
7367
+ external_exports.object({ recovery_code: secondFactorRecoveryCode, code: external_exports.undefined().optional() })
7368
+ ]);
7369
+ setOrgSecondFactorBody = external_exports.object({ tier: secondFactorTier });
7370
+ }
7371
+ });
7372
+
7373
+ // ../../packages/core/dist/chunk-WE4KMHZK.js
7374
+ var bootstrapQuery;
7375
+ var init_chunk_WE4KMHZK = __esm({
7376
+ "../../packages/core/dist/chunk-WE4KMHZK.js"() {
7377
+ "use strict";
7378
+ init_zod();
7379
+ bootstrapQuery = external_exports.object({
7380
+ active_hub_id: external_exports.string().uuid().optional(),
7381
+ active_conversation_id: external_exports.string().uuid().optional(),
7382
+ active_nav: external_exports.enum(["chat", "task", "support"]).optional(),
7383
+ /**
7384
+ * The people thread the URL names (`/chat/threads/:threadId`, gh #4661): the snapshot
7385
+ * preloads it as `people.active_thread` when the viewer is a member.
7386
+ */
7387
+ active_thread_id: external_exports.string().uuid().optional()
7388
+ });
7389
+ }
7390
+ });
7391
+
7392
+ // ../../packages/core/dist/chunk-ZVXO3XL6.js
7393
+ 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;
7394
+ var init_chunk_ZVXO3XL6 = __esm({
7395
+ "../../packages/core/dist/chunk-ZVXO3XL6.js"() {
7396
+ "use strict";
7397
+ init_chunk_HZ6CADSY();
7398
+ init_zod();
7399
+ PEOPLE_CONTACT_PAGE_MAX = 100;
7400
+ PEOPLE_CONTACT_PAGE_DEFAULT = 50;
7401
+ PEOPLE_CONTACT_EMAIL_MAX_LENGTH = 254;
7402
+ peopleUserIdSchema = external_exports.string().max(64).regex(USER_ID_REGEX, "must be a user id");
7403
+ peopleInviteEmailSchema = external_exports.string().trim().max(PEOPLE_CONTACT_EMAIL_MAX_LENGTH).email();
7404
+ peopleContactInviteBody = external_exports.object({
7405
+ email: peopleInviteEmailSchema
7406
+ }).strict();
7407
+ peopleContactInviteIdParam = external_exports.object({ inviteId: uuidSchema });
7408
+ peopleContactUserIdParam = external_exports.object({ userId: peopleUserIdSchema });
7409
+ 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, {
7410
+ message: "Name a thread or a community, not both",
7411
+ path: ["community_id"]
7412
+ });
7413
+ peopleContactPageQuery = external_exports.object({
7414
+ cursor: external_exports.string().min(1).max(256).optional(),
7415
+ limit: external_exports.coerce.number().int().min(1).max(PEOPLE_CONTACT_PAGE_MAX).default(PEOPLE_CONTACT_PAGE_DEFAULT)
7416
+ });
7417
+ peopleOutgoingInviteSchema = external_exports.object({
7418
+ invite_id: uuidSchema,
7419
+ email: external_exports.string(),
7420
+ status: external_exports.literal("sent"),
7421
+ created_at: timestampSchema,
7422
+ expires_at: timestampSchema
7423
+ }).strict();
7424
+ peopleContactPersonSchema = external_exports.object({
7425
+ user_id: peopleUserIdSchema,
7426
+ display_name: external_exports.string().nullable(),
7427
+ email: external_exports.string().nullable()
7428
+ }).strict();
7429
+ peopleContactSchema = peopleContactPersonSchema.extend({ contact_since: timestampSchema, thread_id: uuidSchema }).strict();
7430
+ peopleIncomingInviteSchema = external_exports.object({
7431
+ invite_id: uuidSchema,
7432
+ inviter: peopleContactPersonSchema,
7433
+ created_at: timestampSchema,
7434
+ expires_at: timestampSchema
7435
+ }).strict();
7436
+ peopleBlockedUserSchema = peopleContactPersonSchema.extend({ blocked_at: timestampSchema, deleted_user: external_exports.boolean() }).strict();
7437
+ }
7438
+ });
7439
+
7440
+ // ../../packages/core/dist/chunk-ZXK6N2HN.js
7441
+ 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;
7442
+ var init_chunk_ZXK6N2HN = __esm({
7443
+ "../../packages/core/dist/chunk-ZXK6N2HN.js"() {
7444
+ "use strict";
7445
+ init_chunk_ZVXO3XL6();
7446
+ init_chunk_HZ6CADSY();
7447
+ init_zod();
7448
+ PEOPLE_MODERATION_NOTE_MAX_LENGTH = 500;
7449
+ ADMIN_PEOPLE_REPORTS_PAGE_MAX = 100;
7450
+ ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT = 50;
7451
+ PEOPLE_SUSPENDED_REASON = "suspended";
7452
+ peopleModerationActionSchema = external_exports.enum(["remove_message", "suspend", "unsuspend", "dismiss"]);
7453
+ moderationNoteSchema = optionalTrimmedText(PEOPLE_MODERATION_NOTE_MAX_LENGTH);
7454
+ adminPeopleReportListQuery = external_exports.object({
7455
+ pending: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true"),
7456
+ /** Lower bound on `created_at`. */
7457
+ since: timestampSchema.optional(),
7458
+ limit: external_exports.coerce.number().int().min(1).max(ADMIN_PEOPLE_REPORTS_PAGE_MAX).default(ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT),
7459
+ offset: external_exports.coerce.number().int().min(0).default(0)
7460
+ });
7461
+ adminPeopleReportIdParam = external_exports.object({ reportId: uuidSchema });
7462
+ adminPeopleMessageRemovalBody = external_exports.object({ report_id: uuidSchema, message_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
7463
+ adminPeopleSuspendBody = external_exports.object({ report_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
7464
+ adminPeopleNoteBody = external_exports.object({ note: moderationNoteSchema }).strict();
7465
+ }
7466
+ });
7467
+
7468
+ // ../../packages/core/dist/chunk-Y7CFCYX4.js
7469
+ var PEOPLE_REPORT_DETAILS_MAX_LENGTH, peopleReportReasonSchema, reportDetailsSchema, reportFields, peopleReportBody;
7470
+ var init_chunk_Y7CFCYX4 = __esm({
7471
+ "../../packages/core/dist/chunk-Y7CFCYX4.js"() {
7472
+ "use strict";
7473
+ init_chunk_ZVXO3XL6();
7474
+ init_chunk_HZ6CADSY();
7475
+ init_zod();
7476
+ PEOPLE_REPORT_DETAILS_MAX_LENGTH = 500;
7477
+ peopleReportReasonSchema = external_exports.enum(["spam", "harassment", "hate", "sexual", "violence", "other"]);
7478
+ reportDetailsSchema = optionalTrimmedText(PEOPLE_REPORT_DETAILS_MAX_LENGTH);
7479
+ reportFields = { reason: peopleReportReasonSchema, details: reportDetailsSchema };
7480
+ peopleReportBody = external_exports.discriminatedUnion("target", [
7481
+ external_exports.object({ target: external_exports.literal("message"), thread_id: uuidSchema, message_id: uuidSchema, ...reportFields }).strict(),
7482
+ external_exports.object({ target: external_exports.literal("thread"), thread_id: uuidSchema, ...reportFields }).strict(),
7483
+ external_exports.object({ target: external_exports.literal("user"), user_id: peopleUserIdSchema, thread_id: uuidSchema.optional(), ...reportFields }).strict(),
7484
+ external_exports.object({
7485
+ target: external_exports.literal("community_message"),
7486
+ community_id: uuidSchema,
7487
+ room_id: uuidSchema,
7488
+ message_id: uuidSchema,
7489
+ ...reportFields
7490
+ }).strict(),
7491
+ external_exports.object({ target: external_exports.literal("community_member"), community_id: uuidSchema, user_id: peopleUserIdSchema, ...reportFields }).strict()
7492
+ ]);
7493
+ }
7494
+ });
7495
+
7496
+ // ../../packages/core/dist/chunk-2YEGUQR7.js
7497
+ var PERSON_ID_PATTERN, CONTACT_PERSON_ID_PATTERN, PERSON_ID_FORM_MESSAGE, userPersonIdSchema, personIdSchema;
7498
+ var init_chunk_2YEGUQR7 = __esm({
7499
+ "../../packages/core/dist/chunk-2YEGUQR7.js"() {
7500
+ "use strict";
7501
+ init_zod();
7502
+ PERSON_ID_PATTERN = /^prs_[a-z2-7]{52}$/;
7503
+ CONTACT_PERSON_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
7504
+ PERSON_ID_FORM_MESSAGE = "Must be a person id (prs_\u2026) or a contact id (a lowercase UUID)";
7505
+ userPersonIdSchema = external_exports.string().regex(PERSON_ID_PATTERN, { message: "Must be a person id (prs_\u2026)" });
7506
+ personIdSchema = external_exports.string().refine(
7507
+ (value) => PERSON_ID_PATTERN.test(value) || CONTACT_PERSON_ID_PATTERN.test(value),
7508
+ { message: PERSON_ID_FORM_MESSAGE }
7509
+ );
7510
+ }
7511
+ });
7512
+
7513
+ // ../../packages/core/dist/chunk-UAOHHCW5.js
7514
+ function normalizeContactPhone(raw) {
7515
+ const compact = raw.trim().replace(/[\s\-.()]/g, "");
7516
+ const withPlus = compact.startsWith("00") ? `+${compact.slice(2)}` : compact;
7517
+ return /^\+[1-9]\d{7,14}$/.test(withPlus) ? withPlus : null;
7518
+ }
7519
+ function normalizeContactLabel(raw) {
7520
+ return raw.trim().replace(/\s+/g, " ").toLowerCase();
7521
+ }
7522
+ function importRowLabels(row, batchLabels) {
7523
+ return [.../* @__PURE__ */ new Set([...row.labels ?? [], ...batchLabels ?? []])];
7524
+ }
7525
+ 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;
7526
+ var init_chunk_UAOHHCW5 = __esm({
7527
+ "../../packages/core/dist/chunk-UAOHHCW5.js"() {
7528
+ "use strict";
7529
+ init_zod();
7530
+ CONTACT_ENVIRONMENTS = ["production", "preview", "all"];
7531
+ CONTACT_NAME_MAX = 200;
7532
+ CONTACT_EMAIL_MAX = 320;
7533
+ CONTACT_PHONE_INPUT_MAX = 40;
7534
+ CONTACT_INSTAGRAM_SID_MAX = 64;
7535
+ CONTACT_METADATA_MAX_BYTES = 4096;
7536
+ CONTACT_LABEL_MAX = 64;
7537
+ CONTACT_LABELS_MAX = 20;
7538
+ CONTACT_SCOPE_TAGS_MAX = 20;
7539
+ CONTACT_PAGE_MAX = 100;
7540
+ CONTACT_IMPORT_BATCH_MAX = 500;
7541
+ CONTACT_SEARCH_MAX = 100;
7542
+ CONTACT_LIST_NAME_MAX = 64;
7543
+ CONTACT_LIST_NAME_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
7544
+ CONTACT_LIST_DESCRIPTION_MAX = 1e3;
7545
+ CONTACT_LIST_FILTER_MAX = 20;
7546
+ CONTACT_LIST_PINS_PER_REQUEST_MAX = 100;
7547
+ SUPPRESSION_SCOPES = ["all", "marketing"];
7548
+ SUPPRESSION_ID_REGEX = /^[0-9a-f]{64}$/;
7549
+ contactName = external_exports.string().trim().min(1).max(CONTACT_NAME_MAX);
7550
+ contactPhone = external_exports.string().max(CONTACT_PHONE_INPUT_MAX).transform((raw, ctx) => {
7551
+ const phone = normalizeContactPhone(raw);
7552
+ if (phone === null) {
7553
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Phone must be an international number, e.g. +5511999999999" });
7554
+ return external_exports.NEVER;
7555
+ }
7556
+ return phone;
7557
+ });
7558
+ contactEmail = external_exports.string().trim().toLowerCase().max(CONTACT_EMAIL_MAX).email();
7559
+ contactInstagramSid = external_exports.string().trim().min(1).max(CONTACT_INSTAGRAM_SID_MAX);
7560
+ contactLabel = external_exports.string().max(CONTACT_LABEL_MAX).transform(normalizeContactLabel).refine((label3) => label3.length > 0, "A label cannot be empty").refine((label3) => !label3.includes(","), "A label cannot contain a comma");
7561
+ contactLabels = external_exports.array(contactLabel).max(CONTACT_LABELS_MAX).transform((labels) => [...new Set(labels)]);
7562
+ contactMetadata = external_exports.record(external_exports.unknown()).refine((metadata) => {
7563
+ try {
7564
+ return new TextEncoder().encode(JSON.stringify(metadata)).length <= CONTACT_METADATA_MAX_BYTES;
7565
+ } catch {
7566
+ return false;
7567
+ }
7568
+ }, `Metadata must serialize to at most ${CONTACT_METADATA_MAX_BYTES} bytes`);
7569
+ scopeTagIds = external_exports.array(external_exports.string().uuid()).min(1).max(CONTACT_SCOPE_TAGS_MAX).transform((ids) => [...new Set(ids)]);
7570
+ contactVisibilitySchema = external_exports.discriminatedUnion("scope", [
7571
+ external_exports.object({ scope: external_exports.literal("all_hubs") }).strict(),
7572
+ external_exports.object({ scope: external_exports.literal("tags"), tag_ids: scopeTagIds }).strict()
7573
+ ]);
7574
+ hasIdentity = (row) => Boolean(row.phone || row.email || row.instagram_sid);
7575
+ IDENTITY_REQUIRED = "A contact needs a phone, an email or an Instagram id";
7576
+ contactBookOrgQuery = external_exports.object({
7577
+ organization_id: external_exports.string().uuid()
7578
+ });
7579
+ contactBookContactParam = external_exports.object({
7580
+ contactId: external_exports.string().uuid()
7581
+ });
7582
+ contactBookListParam = external_exports.object({
7583
+ listId: external_exports.string().uuid()
7584
+ });
7585
+ contactBookHubParam = external_exports.object({
7586
+ hubId: external_exports.string().uuid()
7587
+ });
7588
+ contactBookPageQuery = external_exports.object({
7589
+ cursor: external_exports.string().max(2048).optional(),
7590
+ limit: external_exports.coerce.number().int().min(1).max(CONTACT_PAGE_MAX).default(50)
7591
+ });
7592
+ listContactBookContactsQuery = contactBookOrgQuery.merge(contactBookPageQuery).extend({
7593
+ q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional(),
7594
+ label: external_exports.string().max(CONTACT_LABEL_MAX).transform(normalizeContactLabel).optional(),
7595
+ scope_tag_id: external_exports.string().uuid().optional()
7596
+ });
7597
+ listHubContactBookContactsQuery = contactBookPageQuery.extend({
7598
+ q: external_exports.string().trim().max(CONTACT_SEARCH_MAX).optional()
7599
+ });
7600
+ contactBookLinkCandidatesQuery = contactBookOrgQuery.extend({
7601
+ email: contactEmail
7602
+ });
7603
+ listContactBookListMembersQuery = contactBookOrgQuery.merge(contactBookPageQuery);
7604
+ contactRowFields = {
7605
+ name: contactName,
7606
+ phone: contactPhone.nullish(),
7607
+ email: contactEmail.nullish(),
7608
+ instagram_sid: contactInstagramSid.nullish(),
7609
+ labels: contactLabels.optional(),
7610
+ metadata: contactMetadata.optional()
7611
+ };
7612
+ createContactBookContactBody = external_exports.object({
7613
+ organization_id: external_exports.string().uuid(),
7614
+ ...contactRowFields,
7615
+ visibility: contactVisibilitySchema,
7616
+ environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
7617
+ }).strict().refine(hasIdentity, IDENTITY_REQUIRED);
7618
+ updateContactBookContactBody = external_exports.object({
7619
+ name: contactName.optional(),
7620
+ phone: contactPhone.nullable().optional(),
7621
+ email: contactEmail.nullable().optional(),
7622
+ instagram_sid: contactInstagramSid.nullable().optional(),
7623
+ labels: contactLabels.optional(),
7624
+ metadata: contactMetadata.optional(),
7625
+ visibility: contactVisibilitySchema.optional(),
7626
+ environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional()
7627
+ }).strict();
7628
+ contactImportRowSchema = external_exports.object(contactRowFields).strict().refine(hasIdentity, IDENTITY_REQUIRED);
7629
+ importContactBookContactsBody = external_exports.object({
7630
+ organization_id: external_exports.string().uuid(),
7631
+ visibility: contactVisibilitySchema,
7632
+ environment: external_exports.enum(CONTACT_ENVIRONMENTS).optional(),
7633
+ labels: contactLabels.optional(),
7634
+ rows: external_exports.array(contactImportRowSchema).min(1).max(CONTACT_IMPORT_BATCH_MAX)
7635
+ }).strict().superRefine((batch, ctx) => {
7636
+ batch.rows.forEach((row, index) => {
7637
+ if (importRowLabels(row, batch.labels).length > CONTACT_LABELS_MAX) {
7638
+ ctx.addIssue({
7639
+ code: external_exports.ZodIssueCode.custom,
7640
+ path: ["rows", index, "labels"],
7641
+ message: `A contact holds at most ${CONTACT_LABELS_MAX} labels, the batch's included`
7642
+ });
7643
+ }
7644
+ });
7645
+ });
7646
+ linkContactBookContactBody = external_exports.object({
7647
+ user_id: external_exports.string().min(1).max(128)
7648
+ }).strict();
7649
+ listName = external_exports.string().trim().min(1).max(CONTACT_LIST_NAME_MAX).regex(CONTACT_LIST_NAME_REGEX, {
7650
+ message: 'Must be lowercase alphanumeric with hyphens (e.g. "vip-customers")'
7651
+ });
7652
+ contactListFilterSchema = external_exports.object({
7653
+ labels: external_exports.array(contactLabel).max(CONTACT_LIST_FILTER_MAX).transform((l) => [...new Set(l)]).default([]),
7654
+ scope_tag_ids: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_FILTER_MAX).transform((t) => [...new Set(t)]).default([])
7655
+ }).strict();
7656
+ createContactBookListBody = external_exports.object({
7657
+ organization_id: external_exports.string().uuid(),
7658
+ name: listName,
7659
+ description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullish(),
7660
+ filter: contactListFilterSchema.optional()
7661
+ }).strict();
7662
+ updateContactBookListBody = external_exports.object({
7663
+ name: listName.optional(),
7664
+ description: external_exports.string().max(CONTACT_LIST_DESCRIPTION_MAX).nullable().optional(),
7665
+ filter: contactListFilterSchema.optional()
7666
+ }).strict();
7667
+ updateContactBookListPinsBody = external_exports.object({
7668
+ add: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([]),
7669
+ remove: external_exports.array(external_exports.string().uuid()).max(CONTACT_LIST_PINS_PER_REQUEST_MAX).default([])
7670
+ }).strict().refine((b) => b.add.length + b.remove.length > 0, "Add or remove at least one contact");
7671
+ suppressionIdentitySchema = external_exports.discriminatedUnion("kind", [
7672
+ external_exports.object({ kind: external_exports.literal("phone"), value: contactPhone }).strict(),
7673
+ external_exports.object({ kind: external_exports.literal("email"), value: contactEmail }).strict(),
7674
+ external_exports.object({ kind: external_exports.literal("instagram"), value: contactInstagramSid }).strict()
7675
+ ]);
7676
+ createContactBookSuppressionBody = external_exports.object({
7677
+ organization_id: external_exports.string().uuid(),
7678
+ identity: suppressionIdentitySchema,
7679
+ scope: external_exports.enum(SUPPRESSION_SCOPES)
7680
+ }).strict();
7681
+ contactBookSuppressionParam = external_exports.object({
7682
+ suppressionId: external_exports.string().regex(SUPPRESSION_ID_REGEX)
7683
+ });
7684
+ listContactBookSuppressionsQuery = contactBookOrgQuery.merge(contactBookPageQuery);
7685
+ contactBookEmailUnsubscribeTokenSchema = external_exports.string().max(200).regex(/^[0-9a-f-]{36}\.[0-9a-f]{64}\.[0-9a-f]{64}$/i);
7686
+ contactBookEmailUnsubscribeQuery = external_exports.object({ token: contactBookEmailUnsubscribeTokenSchema });
7687
+ orgListReferenceSchema = listName;
7688
+ }
7689
+ });
7690
+
7691
+ // ../../packages/core/dist/chunk-MGBAXT5Y.js
7692
+ var PERSON_LINKS_MAX, PERSON_DENY_PAGE_MAX, personParam, personLinkParam, deniedPersonParam, listDeniedPersonsQuery, conversationCustomerPersonParam;
7693
+ var init_chunk_MGBAXT5Y = __esm({
7694
+ "../../packages/core/dist/chunk-MGBAXT5Y.js"() {
7695
+ "use strict";
7696
+ init_chunk_2YEGUQR7();
7697
+ init_chunk_UAOHHCW5();
7698
+ init_zod();
7699
+ PERSON_LINKS_MAX = 15;
7700
+ PERSON_DENY_PAGE_MAX = 100;
7701
+ personParam = external_exports.object({
7702
+ personId: userPersonIdSchema
7703
+ });
7704
+ personLinkParam = personParam.extend({
7705
+ targetId: personIdSchema
7706
+ });
7707
+ deniedPersonParam = external_exports.object({
7708
+ personId: personIdSchema
7709
+ });
7710
+ listDeniedPersonsQuery = contactBookOrgQuery.extend({
7711
+ cursor: personIdSchema.optional(),
7712
+ limit: external_exports.coerce.number().int().min(1).max(PERSON_DENY_PAGE_MAX).default(50)
7713
+ });
7714
+ conversationCustomerPersonParam = external_exports.object({
7715
+ hubId: external_exports.string().uuid(),
7716
+ conversationId: external_exports.string().uuid()
7717
+ });
7718
+ }
7719
+ });
7720
+
7721
+ // ../../packages/core/dist/chunk-YUZFHVB2.js
7722
+ var invitePreviewQuery, inviteRolePreviewResponse, inviteContactPreviewResponse, invitePreviewResponse, inviteUnsubscribeBody;
7723
+ var init_chunk_YUZFHVB2 = __esm({
7724
+ "../../packages/core/dist/chunk-YUZFHVB2.js"() {
7725
+ "use strict";
7726
+ init_zod();
7727
+ invitePreviewQuery = external_exports.object({
7728
+ token: external_exports.string().min(1).max(2048)
7729
+ });
7730
+ inviteRolePreviewResponse = external_exports.object({
7731
+ inviter_name: external_exports.string(),
7732
+ entity_id: external_exports.string().uuid(),
7733
+ entity_name: external_exports.string(),
7734
+ entity_type: external_exports.enum(["org", "hub"]),
7735
+ role: external_exports.enum(["org_admin", "admin", "team_user", "user"]),
7736
+ expires_at: external_exports.string().datetime()
7737
+ });
7738
+ inviteContactPreviewResponse = external_exports.object({
7739
+ inviter_name: external_exports.string().nullable(),
7740
+ entity_id: external_exports.string().uuid(),
7741
+ entity_type: external_exports.literal("contact"),
7742
+ role: external_exports.literal("contact"),
7743
+ expires_at: external_exports.string().datetime()
7744
+ });
7745
+ invitePreviewResponse = external_exports.union([inviteRolePreviewResponse, inviteContactPreviewResponse]);
7746
+ inviteUnsubscribeBody = external_exports.object({ token: external_exports.string().min(1).max(256) }).strict();
7747
+ }
7748
+ });
7749
+
7750
+ // ../../packages/core/dist/chunk-I3O2RACG.js
7751
+ var managedAgentsWebhookParams, MANAGED_AGENTS_WEBHOOK_BODY_MAX_BYTES;
7752
+ var init_chunk_I3O2RACG = __esm({
7753
+ "../../packages/core/dist/chunk-I3O2RACG.js"() {
7754
+ "use strict";
7755
+ init_zod();
7756
+ managedAgentsWebhookParams = external_exports.object({
7757
+ hub_id: external_exports.string().uuid(),
7758
+ connection_id: external_exports.string().uuid()
7759
+ });
7760
+ MANAGED_AGENTS_WEBHOOK_BODY_MAX_BYTES = 16 * 1024;
7761
+ }
7762
+ });
7763
+
7691
7764
  // ../../packages/core/dist/chunk-6J742GLA.js
7692
7765
  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;
7693
7766
  var init_chunk_6J742GLA = __esm({
@@ -8531,31 +8604,58 @@ var init_chunk_XPI4K6MX = __esm({
8531
8604
  }
8532
8605
  });
8533
8606
 
8534
- // ../../packages/core/dist/chunk-ZXK6N2HN.js
8535
- 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;
8536
- var init_chunk_ZXK6N2HN = __esm({
8537
- "../../packages/core/dist/chunk-ZXK6N2HN.js"() {
8607
+ // ../../packages/core/dist/chunk-SY6PLCPK.js
8608
+ var jsonSchemaSchema, hubUserIdentity, stateValueEntry, getHubUserContextResponse, updateHubUserBody, updateHubUserResponse, unlockHubUserNameResponse, stateResetParams, stateResetResponse;
8609
+ var init_chunk_SY6PLCPK = __esm({
8610
+ "../../packages/core/dist/chunk-SY6PLCPK.js"() {
8538
8611
  "use strict";
8539
- init_chunk_ZVXO3XL6();
8540
- init_chunk_HZ6CADSY();
8612
+ init_chunk_6TSQ5HXC();
8541
8613
  init_zod();
8542
- PEOPLE_MODERATION_NOTE_MAX_LENGTH = 500;
8543
- ADMIN_PEOPLE_REPORTS_PAGE_MAX = 100;
8544
- ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT = 50;
8545
- PEOPLE_SUSPENDED_REASON = "suspended";
8546
- peopleModerationActionSchema = external_exports.enum(["remove_message", "suspend", "unsuspend", "dismiss"]);
8547
- moderationNoteSchema = optionalTrimmedText(PEOPLE_MODERATION_NOTE_MAX_LENGTH);
8548
- adminPeopleReportListQuery = external_exports.object({
8549
- pending: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true"),
8550
- /** Lower bound on `created_at`. */
8551
- since: timestampSchema.optional(),
8552
- limit: external_exports.coerce.number().int().min(1).max(ADMIN_PEOPLE_REPORTS_PAGE_MAX).default(ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT),
8553
- offset: external_exports.coerce.number().int().min(0).default(0)
8614
+ jsonSchemaSchema = external_exports.record(external_exports.unknown());
8615
+ hubUserIdentity = external_exports.object({
8616
+ user_id: external_exports.string().nullable(),
8617
+ user_name: external_exports.string().nullable(),
8618
+ user_email: external_exports.string().nullable(),
8619
+ user_name_locked: external_exports.boolean(),
8620
+ created_at: external_exports.string(),
8621
+ updated_at: external_exports.string().nullable(),
8622
+ hub_user_id: external_exports.string().optional(),
8623
+ enabled: external_exports.boolean().optional(),
8624
+ hub_team_id: external_exports.string().nullable().optional(),
8625
+ source: external_exports.enum(["grant", "auto"]).optional()
8626
+ });
8627
+ stateValueEntry = external_exports.object({
8628
+ state_slug: external_exports.string(),
8629
+ state_name: external_exports.string(),
8630
+ state_description: external_exports.string().nullable().optional(),
8631
+ scope: external_exports.enum(["user", "conversation"]),
8632
+ json_schema: jsonSchemaSchema,
8633
+ initial_value: external_exports.unknown(),
8634
+ value: external_exports.unknown(),
8635
+ is_reserved: external_exports.boolean()
8636
+ });
8637
+ getHubUserContextResponse = external_exports.object({
8638
+ user: hubUserIdentity,
8639
+ user_states: external_exports.array(stateValueEntry),
8640
+ conversation_states: external_exports.array(stateValueEntry)
8641
+ });
8642
+ updateHubUserBody = external_exports.object({
8643
+ // Non-empty, non-null. `.nullable()` here would bypass `.min(1)` and let an
8644
+ // admin arm the lock on a null name — see hub-do.ts updateHubUser null-guard.
8645
+ user_name: external_exports.string().min(1).max(120)
8646
+ });
8647
+ updateHubUserResponse = external_exports.object({
8648
+ user: hubUserIdentity
8649
+ });
8650
+ unlockHubUserNameResponse = external_exports.object({
8651
+ user: hubUserIdentity
8652
+ });
8653
+ stateResetParams = external_exports.object({
8654
+ stateSlug: slugSchema
8655
+ });
8656
+ stateResetResponse = external_exports.object({
8657
+ ok: external_exports.literal(true)
8554
8658
  });
8555
- adminPeopleReportIdParam = external_exports.object({ reportId: uuidSchema });
8556
- adminPeopleMessageRemovalBody = external_exports.object({ report_id: uuidSchema, message_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
8557
- adminPeopleSuspendBody = external_exports.object({ report_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
8558
- adminPeopleNoteBody = external_exports.object({ note: moderationNoteSchema }).strict();
8559
8659
  }
8560
8660
  });
8561
8661
 
@@ -8923,46 +9023,114 @@ var init_chunk_KMAC3O3L = __esm({
8923
9023
  }
8924
9024
  });
8925
9025
 
8926
- // ../../packages/core/dist/chunk-YUZFHVB2.js
8927
- var invitePreviewQuery, inviteRolePreviewResponse, inviteContactPreviewResponse, invitePreviewResponse, inviteUnsubscribeBody;
8928
- var init_chunk_YUZFHVB2 = __esm({
8929
- "../../packages/core/dist/chunk-YUZFHVB2.js"() {
9026
+ // ../../packages/core/dist/chunk-KSTYTQ7I.js
9027
+ var copilotSuggestBody, copilotSuggestResponse;
9028
+ var init_chunk_KSTYTQ7I = __esm({
9029
+ "../../packages/core/dist/chunk-KSTYTQ7I.js"() {
8930
9030
  "use strict";
8931
9031
  init_zod();
8932
- invitePreviewQuery = external_exports.object({
8933
- token: external_exports.string().min(1).max(2048)
8934
- });
8935
- inviteRolePreviewResponse = external_exports.object({
8936
- inviter_name: external_exports.string(),
8937
- entity_id: external_exports.string().uuid(),
8938
- entity_name: external_exports.string(),
8939
- entity_type: external_exports.enum(["org", "hub"]),
8940
- role: external_exports.enum(["org_admin", "admin", "team_user", "user"]),
8941
- expires_at: external_exports.string().datetime()
9032
+ copilotSuggestBody = external_exports.object({
9033
+ hub_id: external_exports.string().uuid()
8942
9034
  });
8943
- inviteContactPreviewResponse = external_exports.object({
8944
- inviter_name: external_exports.string().nullable(),
8945
- entity_id: external_exports.string().uuid(),
8946
- entity_type: external_exports.literal("contact"),
8947
- role: external_exports.literal("contact"),
8948
- expires_at: external_exports.string().datetime()
9035
+ copilotSuggestResponse = external_exports.object({
9036
+ status: external_exports.enum(["processing", "skipped"]),
9037
+ reason: external_exports.string().optional()
8949
9038
  });
8950
- invitePreviewResponse = external_exports.union([inviteRolePreviewResponse, inviteContactPreviewResponse]);
8951
- inviteUnsubscribeBody = external_exports.object({ token: external_exports.string().min(1).max(256) }).strict();
8952
9039
  }
8953
9040
  });
8954
9041
 
8955
- // ../../packages/core/dist/chunk-I3O2RACG.js
8956
- var managedAgentsWebhookParams, MANAGED_AGENTS_WEBHOOK_BODY_MAX_BYTES;
8957
- var init_chunk_I3O2RACG = __esm({
8958
- "../../packages/core/dist/chunk-I3O2RACG.js"() {
9042
+ // ../../packages/core/dist/chunk-LKBSHANA.js
9043
+ var DESKTOP_SHELL_VERSION_RE, DESKTOP_PLATFORMS, DESKTOP_FLAVORS, desktopShellInfoSchema, DESKTOP_PRESENCE_STATES, desktopPresenceSchema, desktopUpdateSchema, DESKTOP_SIGN_IN_URL_MAX_LENGTH, DESKTOP_APP_PATH_MAX_LENGTH, desktopAppPathSchema, DESKTOP_NOTIFICATION_KINDS, DESKTOP_NOTIFICATION_TITLE_MAX_LENGTH, DESKTOP_NOTIFICATION_BODY_MAX_LENGTH, notificationTitleSchema, notificationBodySchema, desktopNotificationSchema, DESKTOP_BADGE_MAX_COUNT, DESKTOP_BADGE_LABEL_MAX_LENGTH, desktopBadgeSchema, desktopNavigateSchema, desktopSettingsSchema, desktopSettingsChangeSchema, desktopBridgeArgsSchemas;
9044
+ var init_chunk_LKBSHANA = __esm({
9045
+ "../../packages/core/dist/chunk-LKBSHANA.js"() {
8959
9046
  "use strict";
8960
9047
  init_zod();
8961
- managedAgentsWebhookParams = external_exports.object({
8962
- hub_id: external_exports.string().uuid(),
8963
- connection_id: external_exports.string().uuid()
9048
+ DESKTOP_SHELL_VERSION_RE = /^(0|[1-9]\d{0,5})\.(0|[1-9]\d{0,5})\.(0|[1-9]\d{0,5})(-[0-9A-Za-z.-]{1,32})?$/;
9049
+ DESKTOP_PLATFORMS = ["darwin", "win32"];
9050
+ DESKTOP_FLAVORS = ["production", "development"];
9051
+ desktopShellInfoSchema = external_exports.object({
9052
+ /** The shell's own release version, independent of the web deploy. */
9053
+ shellVersion: external_exports.string().regex(DESKTOP_SHELL_VERSION_RE),
9054
+ /** The Electron runtime the shell was built with. */
9055
+ electronVersion: external_exports.string().regex(/^\d{1,4}\.\d{1,4}\.\d{1,4}(-[0-9A-Za-z.-]{1,32})?$/),
9056
+ platform: external_exports.enum(DESKTOP_PLATFORMS),
9057
+ /** CPU architecture as Node reports it (`arm64`, `x64`). */
9058
+ arch: external_exports.string().regex(/^[a-z0-9_]{1,16}$/),
9059
+ flavor: external_exports.enum(DESKTOP_FLAVORS),
9060
+ /**
9061
+ * Present, and true, when the shell runs from the Microsoft Store's package: the Store updates it,
9062
+ * and Windows alone opens it at login (the package's startup task, which the person turns on in
9063
+ * Windows' settings). An optional field, so no new `bridgeVersion`: an older page ignores it, and
9064
+ * its absence is every other shell.
9065
+ */
9066
+ store: external_exports.literal(true).optional()
8964
9067
  });
8965
- MANAGED_AGENTS_WEBHOOK_BODY_MAX_BYTES = 16 * 1024;
9068
+ DESKTOP_PRESENCE_STATES = ["present", "away"];
9069
+ desktopPresenceSchema = external_exports.object({
9070
+ presence: external_exports.enum(DESKTOP_PRESENCE_STATES),
9071
+ mainWindow: external_exports.object({
9072
+ shown: external_exports.boolean(),
9073
+ focused: external_exports.boolean()
9074
+ })
9075
+ });
9076
+ desktopUpdateSchema = external_exports.object({
9077
+ ready: external_exports.object({
9078
+ version: external_exports.string().regex(DESKTOP_SHELL_VERSION_RE),
9079
+ offerRestart: external_exports.boolean()
9080
+ }).nullable()
9081
+ });
9082
+ DESKTOP_SIGN_IN_URL_MAX_LENGTH = 4096;
9083
+ DESKTOP_APP_PATH_MAX_LENGTH = 512;
9084
+ desktopAppPathSchema = external_exports.string().max(DESKTOP_APP_PATH_MAX_LENGTH).regex(/^\/(?![/\\])[^\s\\]*$/);
9085
+ DESKTOP_NOTIFICATION_KINDS = ["handoff", "message", "summary"];
9086
+ DESKTOP_NOTIFICATION_TITLE_MAX_LENGTH = 200;
9087
+ DESKTOP_NOTIFICATION_BODY_MAX_LENGTH = 500;
9088
+ notificationTitleSchema = external_exports.string().min(1).max(DESKTOP_NOTIFICATION_TITLE_MAX_LENGTH);
9089
+ notificationBodySchema = external_exports.string().max(DESKTOP_NOTIFICATION_BODY_MAX_LENGTH);
9090
+ desktopNotificationSchema = external_exports.object({
9091
+ kind: external_exports.enum(DESKTOP_NOTIFICATION_KINDS),
9092
+ title: notificationTitleSchema,
9093
+ body: notificationBodySchema,
9094
+ path: desktopAppPathSchema,
9095
+ withoutPreview: external_exports.object({ title: notificationTitleSchema, body: notificationBodySchema }).optional()
9096
+ });
9097
+ DESKTOP_BADGE_MAX_COUNT = 1e6;
9098
+ DESKTOP_BADGE_LABEL_MAX_LENGTH = 200;
9099
+ desktopBadgeSchema = external_exports.object({
9100
+ count: external_exports.number().int().min(0).max(DESKTOP_BADGE_MAX_COUNT),
9101
+ label: external_exports.string().max(DESKTOP_BADGE_LABEL_MAX_LENGTH)
9102
+ });
9103
+ desktopNavigateSchema = external_exports.object({
9104
+ path: desktopAppPathSchema
9105
+ });
9106
+ desktopSettingsSchema = external_exports.object({
9107
+ /** The app opens when the person logs in to the computer: the operating system's own login item. */
9108
+ openAtLogin: external_exports.boolean(),
9109
+ /** Closing the window keeps the app running in the tray (true), or quits it (false). */
9110
+ closeToTray: external_exports.boolean(),
9111
+ /** The shell shows notifications (true), or none (false). The badge is not a notification. */
9112
+ notifications: external_exports.boolean(),
9113
+ /**
9114
+ * A customer message's notification shows the customer's name and words, where the platform
9115
+ * allows them at all (`desktopShowsCustomerWords`: macOS); elsewhere the shell never shows them.
9116
+ */
9117
+ messagePreview: external_exports.boolean()
9118
+ });
9119
+ desktopSettingsChangeSchema = desktopSettingsSchema.partial().strict().refine((change) => Object.values(change).every((value) => typeof value === "boolean"), {
9120
+ message: "each setting changed is true or false"
9121
+ });
9122
+ desktopBridgeArgsSchemas = {
9123
+ getShellInfo: external_exports.tuple([]),
9124
+ getPresence: external_exports.tuple([]),
9125
+ openSignIn: external_exports.tuple([external_exports.string().max(DESKTOP_SIGN_IN_URL_MAX_LENGTH)]),
9126
+ getUpdate: external_exports.tuple([]),
9127
+ restartToUpdate: external_exports.tuple([]),
9128
+ notify: external_exports.tuple([desktopNotificationSchema]),
9129
+ setBadge: external_exports.tuple([desktopBadgeSchema]),
9130
+ clearAll: external_exports.tuple([]),
9131
+ getSettings: external_exports.tuple([]),
9132
+ setSettings: external_exports.tuple([desktopSettingsChangeSchema])
9133
+ };
8966
9134
  }
8967
9135
  });
8968
9136
 
@@ -10365,58 +10533,72 @@ var init_chunk_OPETF4GS = __esm({
10365
10533
  }
10366
10534
  });
10367
10535
 
10368
- // ../../packages/core/dist/chunk-SY6PLCPK.js
10369
- var jsonSchemaSchema, hubUserIdentity, stateValueEntry, getHubUserContextResponse, updateHubUserBody, updateHubUserResponse, unlockHubUserNameResponse, stateResetParams, stateResetResponse;
10370
- var init_chunk_SY6PLCPK = __esm({
10371
- "../../packages/core/dist/chunk-SY6PLCPK.js"() {
10536
+ // ../../packages/core/dist/chunk-YULHXJ5M.js
10537
+ 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;
10538
+ var init_chunk_YULHXJ5M = __esm({
10539
+ "../../packages/core/dist/chunk-YULHXJ5M.js"() {
10540
+ "use strict";
10541
+ COMMUNITY_LESSON_TREE_MAX_BYTES = 512 * 1024;
10542
+ COMMUNITY_LESSON_LINK_PROTOCOLS = ["http", "https", "mailto"];
10543
+ COMMUNITY_LESSON_TREE_TOO_LARGE_REASON = "lesson_tree_too_large";
10544
+ COMMUNITY_LESSON_TREE_TOO_DEEP_REASON = "lesson_tree_too_deep";
10545
+ COMMUNITY_LESSON_LINE_PREFIX_TOO_WIDE_REASON = "lesson_line_prefix_too_wide";
10546
+ LINK_SCHEME = new RegExp(`^(${COMMUNITY_LESSON_LINK_PROTOCOLS.join("|")}):`, "i");
10547
+ }
10548
+ });
10549
+
10550
+ // ../../packages/core/dist/chunk-V4FRPRH5.js
10551
+ var CONSULT_THREAD_STATUSES, consultThreadStatus, CONSULT_THREAD_TITLE_MAX, consultThreadTitle, consultThreadSummary, listConsultThreadsQuery, listConsultThreadsResponse, createConsultThreadBody, createConsultThreadResponse, consultThreadIdParam, updateConsultThreadBody, updateConsultThreadResponse, CONSULT_AWAIT_TIMEOUT_MS;
10552
+ var init_chunk_V4FRPRH5 = __esm({
10553
+ "../../packages/core/dist/chunk-V4FRPRH5.js"() {
10372
10554
  "use strict";
10373
- init_chunk_6TSQ5HXC();
10374
10555
  init_zod();
10375
- jsonSchemaSchema = external_exports.record(external_exports.unknown());
10376
- hubUserIdentity = external_exports.object({
10377
- user_id: external_exports.string().nullable(),
10378
- user_name: external_exports.string().nullable(),
10379
- user_email: external_exports.string().nullable(),
10380
- user_name_locked: external_exports.boolean(),
10381
- created_at: external_exports.string(),
10382
- updated_at: external_exports.string().nullable(),
10383
- hub_user_id: external_exports.string().optional(),
10384
- enabled: external_exports.boolean().optional(),
10385
- hub_team_id: external_exports.string().nullable().optional(),
10386
- source: external_exports.enum(["grant", "auto"]).optional()
10556
+ CONSULT_THREAD_STATUSES = ["open", "awaiting", "resolved", "cancelled_at_close"];
10557
+ consultThreadStatus = external_exports.enum(CONSULT_THREAD_STATUSES);
10558
+ CONSULT_THREAD_TITLE_MAX = 120;
10559
+ consultThreadTitle = external_exports.string().trim().min(1).max(CONSULT_THREAD_TITLE_MAX);
10560
+ consultThreadSummary = external_exports.object({
10561
+ consult_thread_id: external_exports.string(),
10562
+ conversation_id: external_exports.string(),
10563
+ initiator_type: external_exports.enum(["team", "agent"]),
10564
+ initiator_id: external_exports.string(),
10565
+ engaged_agent_id: external_exports.string().nullable(),
10566
+ engaged_agent_name: external_exports.string().nullable(),
10567
+ title: external_exports.string().nullable(),
10568
+ status: consultThreadStatus,
10569
+ created_at: external_exports.string()
10387
10570
  });
10388
- stateValueEntry = external_exports.object({
10389
- state_slug: external_exports.string(),
10390
- state_name: external_exports.string(),
10391
- state_description: external_exports.string().nullable().optional(),
10392
- scope: external_exports.enum(["user", "conversation"]),
10393
- json_schema: jsonSchemaSchema,
10394
- initial_value: external_exports.unknown(),
10395
- value: external_exports.unknown(),
10396
- is_reserved: external_exports.boolean()
10571
+ listConsultThreadsQuery = external_exports.object({
10572
+ hub_id: external_exports.string().uuid()
10397
10573
  });
10398
- getHubUserContextResponse = external_exports.object({
10399
- user: hubUserIdentity,
10400
- user_states: external_exports.array(stateValueEntry),
10401
- conversation_states: external_exports.array(stateValueEntry)
10574
+ listConsultThreadsResponse = external_exports.object({
10575
+ threads: external_exports.array(consultThreadSummary)
10402
10576
  });
10403
- updateHubUserBody = external_exports.object({
10404
- // Non-empty, non-null. `.nullable()` here would bypass `.min(1)` and let an
10405
- // admin arm the lock on a null name — see hub-do.ts updateHubUser null-guard.
10406
- user_name: external_exports.string().min(1).max(120)
10577
+ createConsultThreadBody = external_exports.object({
10578
+ hub_id: external_exports.string().uuid(),
10579
+ title: consultThreadTitle.optional(),
10580
+ // Optionally engage a consultant on creation. Validated server-side against the
10581
+ // hub's `consultant`-role agents; a non-consultant / unknown id is rejected.
10582
+ engaged_agent_id: external_exports.string().uuid().optional()
10407
10583
  });
10408
- updateHubUserResponse = external_exports.object({
10409
- user: hubUserIdentity
10584
+ createConsultThreadResponse = external_exports.object({
10585
+ thread: consultThreadSummary
10410
10586
  });
10411
- unlockHubUserNameResponse = external_exports.object({
10412
- user: hubUserIdentity
10587
+ consultThreadIdParam = external_exports.object({
10588
+ id: external_exports.string().uuid(),
10589
+ threadId: external_exports.string().uuid()
10413
10590
  });
10414
- stateResetParams = external_exports.object({
10415
- stateSlug: slugSchema
10591
+ updateConsultThreadBody = external_exports.object({
10592
+ hub_id: external_exports.string().uuid(),
10593
+ title: consultThreadTitle.optional(),
10594
+ engaged_agent_id: external_exports.string().uuid().optional()
10595
+ }).refine((v) => v.title !== void 0 || v.engaged_agent_id !== void 0, {
10596
+ message: "Provide a title and/or an engaged_agent_id to update"
10416
10597
  });
10417
- stateResetResponse = external_exports.object({
10418
- ok: external_exports.literal(true)
10598
+ updateConsultThreadResponse = external_exports.object({
10599
+ thread: consultThreadSummary
10419
10600
  });
10601
+ CONSULT_AWAIT_TIMEOUT_MS = 15 * 6e4;
10420
10602
  }
10421
10603
  });
10422
10604
 
@@ -12603,114 +12785,115 @@ var init_chunk_WEV7ZGHP = __esm({
12603
12785
  }
12604
12786
  });
12605
12787
 
12606
- // ../../packages/core/dist/chunk-KSTYTQ7I.js
12607
- var copilotSuggestBody, copilotSuggestResponse;
12608
- var init_chunk_KSTYTQ7I = __esm({
12609
- "../../packages/core/dist/chunk-KSTYTQ7I.js"() {
12610
- "use strict";
12611
- init_zod();
12612
- copilotSuggestBody = external_exports.object({
12613
- hub_id: external_exports.string().uuid()
12614
- });
12615
- copilotSuggestResponse = external_exports.object({
12616
- status: external_exports.enum(["processing", "skipped"]),
12617
- reason: external_exports.string().optional()
12618
- });
12619
- }
12620
- });
12621
-
12622
- // ../../packages/core/dist/chunk-LKBSHANA.js
12623
- var DESKTOP_SHELL_VERSION_RE, DESKTOP_PLATFORMS, DESKTOP_FLAVORS, desktopShellInfoSchema, DESKTOP_PRESENCE_STATES, desktopPresenceSchema, desktopUpdateSchema, DESKTOP_SIGN_IN_URL_MAX_LENGTH, DESKTOP_APP_PATH_MAX_LENGTH, desktopAppPathSchema, DESKTOP_NOTIFICATION_KINDS, DESKTOP_NOTIFICATION_TITLE_MAX_LENGTH, DESKTOP_NOTIFICATION_BODY_MAX_LENGTH, notificationTitleSchema, notificationBodySchema, desktopNotificationSchema, DESKTOP_BADGE_MAX_COUNT, DESKTOP_BADGE_LABEL_MAX_LENGTH, desktopBadgeSchema, desktopNavigateSchema, desktopSettingsSchema, desktopSettingsChangeSchema, desktopBridgeArgsSchemas;
12624
- var init_chunk_LKBSHANA = __esm({
12625
- "../../packages/core/dist/chunk-LKBSHANA.js"() {
12788
+ // ../../packages/core/dist/chunk-7CYHPF35.js
12789
+ var appMessageSenderType, appMessageReceiverType, apiChannelMessage, apiChannelMessageBody, appMessageBody, appMessageResponse;
12790
+ var init_chunk_7CYHPF35 = __esm({
12791
+ "../../packages/core/dist/chunk-7CYHPF35.js"() {
12626
12792
  "use strict";
12793
+ init_chunk_HZ6CADSY();
12627
12794
  init_zod();
12628
- DESKTOP_SHELL_VERSION_RE = /^(0|[1-9]\d{0,5})\.(0|[1-9]\d{0,5})\.(0|[1-9]\d{0,5})(-[0-9A-Za-z.-]{1,32})?$/;
12629
- DESKTOP_PLATFORMS = ["darwin", "win32"];
12630
- DESKTOP_FLAVORS = ["production", "development"];
12631
- desktopShellInfoSchema = external_exports.object({
12632
- /** The shell's own release version, independent of the web deploy. */
12633
- shellVersion: external_exports.string().regex(DESKTOP_SHELL_VERSION_RE),
12634
- /** The Electron runtime the shell was built with. */
12635
- electronVersion: external_exports.string().regex(/^\d{1,4}\.\d{1,4}\.\d{1,4}(-[0-9A-Za-z.-]{1,32})?$/),
12636
- platform: external_exports.enum(DESKTOP_PLATFORMS),
12637
- /** CPU architecture as Node reports it (`arm64`, `x64`). */
12638
- arch: external_exports.string().regex(/^[a-z0-9_]{1,16}$/),
12639
- flavor: external_exports.enum(DESKTOP_FLAVORS),
12640
- /**
12641
- * Present, and true, when the shell runs from the Microsoft Store's package: the Store updates it,
12642
- * and Windows alone opens it at login (the package's startup task, which the person turns on in
12643
- * Windows' settings). An optional field, so no new `bridgeVersion`: an older page ignores it, and
12644
- * its absence is every other shell.
12645
- */
12646
- store: external_exports.literal(true).optional()
12647
- });
12648
- DESKTOP_PRESENCE_STATES = ["present", "away"];
12649
- desktopPresenceSchema = external_exports.object({
12650
- presence: external_exports.enum(DESKTOP_PRESENCE_STATES),
12651
- mainWindow: external_exports.object({
12652
- shown: external_exports.boolean(),
12653
- focused: external_exports.boolean()
12654
- })
12655
- });
12656
- desktopUpdateSchema = external_exports.object({
12657
- ready: external_exports.object({
12658
- version: external_exports.string().regex(DESKTOP_SHELL_VERSION_RE),
12659
- offerRestart: external_exports.boolean()
12660
- }).nullable()
12661
- });
12662
- DESKTOP_SIGN_IN_URL_MAX_LENGTH = 4096;
12663
- DESKTOP_APP_PATH_MAX_LENGTH = 512;
12664
- desktopAppPathSchema = external_exports.string().max(DESKTOP_APP_PATH_MAX_LENGTH).regex(/^\/(?![/\\])[^\s\\]*$/);
12665
- DESKTOP_NOTIFICATION_KINDS = ["handoff", "message", "summary"];
12666
- DESKTOP_NOTIFICATION_TITLE_MAX_LENGTH = 200;
12667
- DESKTOP_NOTIFICATION_BODY_MAX_LENGTH = 500;
12668
- notificationTitleSchema = external_exports.string().min(1).max(DESKTOP_NOTIFICATION_TITLE_MAX_LENGTH);
12669
- notificationBodySchema = external_exports.string().max(DESKTOP_NOTIFICATION_BODY_MAX_LENGTH);
12670
- desktopNotificationSchema = external_exports.object({
12671
- kind: external_exports.enum(DESKTOP_NOTIFICATION_KINDS),
12672
- title: notificationTitleSchema,
12673
- body: notificationBodySchema,
12674
- path: desktopAppPathSchema,
12675
- withoutPreview: external_exports.object({ title: notificationTitleSchema, body: notificationBodySchema }).optional()
12676
- });
12677
- DESKTOP_BADGE_MAX_COUNT = 1e6;
12678
- DESKTOP_BADGE_LABEL_MAX_LENGTH = 200;
12679
- desktopBadgeSchema = external_exports.object({
12680
- count: external_exports.number().int().min(0).max(DESKTOP_BADGE_MAX_COUNT),
12681
- label: external_exports.string().max(DESKTOP_BADGE_LABEL_MAX_LENGTH)
12795
+ appMessageSenderType = external_exports.enum(["user", "team"]);
12796
+ appMessageReceiverType = external_exports.enum(["user", "team", "agent", "assistant"]).transform((v) => v === "assistant" ? "agent" : v);
12797
+ apiChannelMessage = external_exports.object({
12798
+ text: clientOptionalString,
12799
+ attachments: external_exports.array(messageAttachment).max(MAX_ATTACHMENTS_PER_MESSAGE).nullish().transform((v) => v ?? void 0)
12800
+ }).refine((m) => m.text && m.text.length > 0 || m.attachments && m.attachments.length > 0, {
12801
+ message: "message must have text or at least one attachment"
12682
12802
  });
12683
- desktopNavigateSchema = external_exports.object({
12684
- path: desktopAppPathSchema
12803
+ apiChannelMessageBody = external_exports.object({
12804
+ // Correlation id (task hubs): new → new conversation, repeat → continue. min 1 so an
12805
+ // empty string can't masquerade as a ref. Mutually exclusive with conversation_id.
12806
+ external_ref: external_exports.string().min(1).max(256).optional(),
12807
+ // Continue a specific WayAI conversation (authorized against the hub/channel + owner).
12808
+ // UUID-validated here (unlike the app channel, whose client we control): allocation
12809
+ // only treats a UUID-shaped id as a provided conversation, so a malformed id would
12810
+ // otherwise skip the owner guard and silently MINT a new conversation instead of
12811
+ // rejecting. A format 400 is shape-only — not an existence oracle (a valid-but-unknown
12812
+ // UUID still collapses to the opaque authorization error downstream).
12813
+ conversation_id: external_exports.string().uuid().optional(),
12814
+ // On-behalf-of end-user identity. Absent → per-connection service principal (task-hub
12815
+ // only; chat hub rejects with 422 in the route).
12816
+ user: external_exports.object({
12817
+ id: external_exports.string().min(1),
12818
+ email: clientOptionalString,
12819
+ name: clientOptionalString
12820
+ }).optional(),
12821
+ message: apiChannelMessage,
12822
+ // Idempotency key: maps to channel_message_sid, deduped within one conversation
12823
+ // (ConversationDO.storeMessage). A retried POST resolves to the same conversation (a chat
12824
+ // hub's user, the external_ref, the conversation_id, or on a task hub with neither, this key
12825
+ // scoped by the sender), so it echoes the original message_id and skips billing / turn
12826
+ // dispatch. A failed store answers a retryable 503 only when this key is set; without it a
12827
+ // retry could store the message twice, so it answers 400.
12828
+ client_message_id: external_exports.string().min(1).max(256).optional()
12829
+ }).refine((b) => !(b.external_ref && b.conversation_id), {
12830
+ message: "provide external_ref or conversation_id, not both",
12831
+ path: ["external_ref"]
12685
12832
  });
12686
- desktopSettingsSchema = external_exports.object({
12687
- /** The app opens when the person logs in to the computer: the operating system's own login item. */
12688
- openAtLogin: external_exports.boolean(),
12689
- /** Closing the window keeps the app running in the tray (true), or quits it (false). */
12690
- closeToTray: external_exports.boolean(),
12691
- /** The shell shows notifications (true), or none (false). The badge is not a notification. */
12692
- notifications: external_exports.boolean(),
12693
- /**
12694
- * A customer message's notification shows the customer's name and words, where the platform
12695
- * allows them at all (`desktopShowsCustomerWords`: macOS); elsewhere the shell never shows them.
12696
- */
12697
- messagePreview: external_exports.boolean()
12833
+ appMessageBody = external_exports.object({
12834
+ // Message content — three historical aliases. All optional: an attachment-only
12835
+ // or voice-only message carries no text.
12836
+ content: clientOptionalString,
12837
+ message_text: clientOptionalString,
12838
+ message_body: clientOptionalString,
12839
+ // Conversation context. Ids are plain strings rather than `.uuid()` on purpose:
12840
+ // they are AUTHORIZED downstream, which is the stronger guarantee — a well-formed
12841
+ // uuid belonging to another tenant must fail just as hard as junk. `hub_id` is
12842
+ // gated by `assertHubEndUserAccess` (gh #3286) and `conversation_id` by HubDO's
12843
+ // conversation_index owner check (gh #2781, #3281). The route's own falsy guards
12844
+ // ('hub_id is required') still reject an empty one.
12845
+ hub_id: clientOptionalString,
12846
+ channel_id: clientOptionalString,
12847
+ conversation_id: clientOptionalString,
12848
+ hub_type: external_exports.enum(["chat", "task"]).nullish().transform((v) => v ?? void 0),
12849
+ // Stable idempotency key for one explicit task-hub launcher. HubDO scopes it
12850
+ // to the authenticated user and resolves retries/tabs to one conversation.
12851
+ task_start_id: external_exports.string().uuid().nullish().transform((v) => v ?? void 0),
12852
+ // Routing.
12853
+ sender_type: appMessageSenderType.nullish().transform((v) => v ?? void 0),
12854
+ receiver_type: appMessageReceiverType.nullish().transform((v) => v ?? void 0),
12855
+ // Only meaningful on a team send, where `validateAppTeamSendContext` proves the
12856
+ // caller may send to this receiver. Absent on a team send to a conversation with no
12857
+ // person, which names its `conversation_id` instead. The end-user branch ignores it —
12858
+ // see the receiver derivation in the route.
12859
+ user_receiver_id: clientOptionalString,
12860
+ // ── Internal consult (consultant-agents PR 2 — H1.0) ──────────────────────
12861
+ // A team member handling a customer conversation can tag a `consultant`-role
12862
+ // agent for a PRIVATE, team-only exchange that never reaches the customer. A
12863
+ // consult send is a team send with `receiver_type: 'agent'` targeting the
12864
+ // consultant; `user_receiver_id` identifies the customer whose conversation this is
12865
+ // (and is authorized by `validateAppTeamSendContext`, exactly as a team→user send is),
12866
+ // and is absent, as on a team→user send, when the conversation has no person. The consultant is resolved from `agent_receiver_id`
12867
+ // when supplied, else from an `@mention` parsed out of the message text against
12868
+ // the hub's consultant agents. `consult_thread_id` continues an existing thread;
12869
+ // absent, the route creates/reuses the single implicit thread. These fields are
12870
+ // inert on every non-consult send (end-user send, team→user send).
12871
+ agent_receiver_id: clientOptionalString,
12872
+ consult_thread_id: clientOptionalString,
12873
+ is_first_message: clientOptionalBoolean,
12874
+ end_conversation: clientOptionalBoolean,
12875
+ // Pre-generated by the client so the optimistic bubble and the stored row share
12876
+ // a key (transcription live-updates land on the same row instead of duplicating).
12877
+ message_id: clientOptionalString,
12878
+ attachments: external_exports.array(messageAttachment).max(MAX_ATTACHMENTS_PER_MESSAGE).nullish().transform((v) => v ?? void 0),
12879
+ // Base64-encoded audio for STT. Size-capped in the route (the cap is a byte
12880
+ // budget tied to the /channels/* bodyLimit, not a shape rule).
12881
+ audio_file: clientOptionalString
12698
12882
  });
12699
- desktopSettingsChangeSchema = desktopSettingsSchema.partial().strict().refine((change) => Object.values(change).every((value) => typeof value === "boolean"), {
12700
- message: "each setting changed is true or false"
12883
+ appMessageResponse = external_exports.object({
12884
+ success: external_exports.boolean(),
12885
+ message: external_exports.string(),
12886
+ result: external_exports.object({
12887
+ conversation_id: external_exports.string().optional(),
12888
+ message_id: external_exports.string().optional(),
12889
+ status: external_exports.string().optional(),
12890
+ files: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown())).optional(),
12891
+ // True when this request reused a task-start/message id already accepted by
12892
+ // the server. Clients must replace their optimistic payload with a fresh
12893
+ // authoritative read because another tab may have won with different text.
12894
+ deduped: external_exports.boolean().optional()
12895
+ }).optional()
12701
12896
  });
12702
- desktopBridgeArgsSchemas = {
12703
- getShellInfo: external_exports.tuple([]),
12704
- getPresence: external_exports.tuple([]),
12705
- openSignIn: external_exports.tuple([external_exports.string().max(DESKTOP_SIGN_IN_URL_MAX_LENGTH)]),
12706
- getUpdate: external_exports.tuple([]),
12707
- restartToUpdate: external_exports.tuple([]),
12708
- notify: external_exports.tuple([desktopNotificationSchema]),
12709
- setBadge: external_exports.tuple([desktopBadgeSchema]),
12710
- clearAll: external_exports.tuple([]),
12711
- getSettings: external_exports.tuple([]),
12712
- setSettings: external_exports.tuple([desktopSettingsChangeSchema])
12713
- };
12714
12897
  }
12715
12898
  });
12716
12899
 
@@ -12778,7 +12961,7 @@ var init_chunk_NETRUHZF = __esm({
12778
12961
  }
12779
12962
  });
12780
12963
 
12781
- // ../../packages/core/dist/chunk-EH45EEIA.js
12964
+ // ../../packages/core/dist/chunk-JSPSTJH4.js
12782
12965
  function toolParametersViolations(params) {
12783
12966
  try {
12784
12967
  if (containsKanbanPlaceholders(params)) return [];
@@ -12835,8 +13018,8 @@ function refineToolConfig(value, ctx) {
12835
13018
  }
12836
13019
  }
12837
13020
  var nonBlank, DEFAULT_TOOL_CONFIG_DESCRIPTION, MAX_CUSTOM_TOOL_CONFIG_TEXT_LAYERS, toolIdParam, listToolsQuery, toolAgentQuery, deleteToolQuery, toolConnectionsQuery, nativeToolIdSchema, CONTEXT_BOUNDARIES, contextBoundarySchema, addNativeToolBody, addMcpToolBody, toolReplaySettingsFields, toolReplaySettingsSchema, createCustomToolBody, updateCustomToolBody, updateToolExecutionConfigBody;
12838
- var init_chunk_EH45EEIA = __esm({
12839
- "../../packages/core/dist/chunk-EH45EEIA.js"() {
13021
+ var init_chunk_JSPSTJH4 = __esm({
13022
+ "../../packages/core/dist/chunk-JSPSTJH4.js"() {
12840
13023
  "use strict";
12841
13024
  init_chunk_WEXVYJ5H();
12842
13025
  init_chunk_HZ6CADSY();
@@ -13496,57 +13679,6 @@ var init_chunk_LBDH7LCG = __esm({
13496
13679
  }
13497
13680
  });
13498
13681
 
13499
- // ../../packages/core/dist/chunk-D3EP4TDU.js
13500
- var primaryRegionSchema, placementSourceSchema, orgIdParam, orgAdminIdParam, createOrganizationBody, updateOrganizationBody, addOrgAdminBody;
13501
- var init_chunk_D3EP4TDU = __esm({
13502
- "../../packages/core/dist/chunk-D3EP4TDU.js"() {
13503
- "use strict";
13504
- init_chunk_HZ6CADSY();
13505
- init_zod();
13506
- primaryRegionSchema = external_exports.enum([
13507
- "wnam",
13508
- "enam",
13509
- "sam",
13510
- "weur",
13511
- "eeur",
13512
- "apac",
13513
- "oc",
13514
- "afr",
13515
- "me"
13516
- ]);
13517
- placementSourceSchema = external_exports.enum([
13518
- "hub_config",
13519
- "org_config",
13520
- "parent_cascade",
13521
- "cf_colo",
13522
- "country",
13523
- "fallback",
13524
- "unpinned"
13525
- ]);
13526
- orgIdParam = external_exports.object({
13527
- id: uuidSchema
13528
- });
13529
- orgAdminIdParam = external_exports.object({
13530
- id: uuidSchema,
13531
- adminId: external_exports.string().min(1)
13532
- });
13533
- createOrganizationBody = external_exports.object({
13534
- organization_name: external_exports.string().min(1, "organization_name is required"),
13535
- // Write-once at creation; updateOrganizationBody does not accept this.
13536
- primary_region: primaryRegionSchema.optional()
13537
- });
13538
- updateOrganizationBody = external_exports.object({
13539
- organization_name: external_exports.string().min(1).optional(),
13540
- organization_avatar_url: external_exports.string().url().nullable().optional(),
13541
- timezone: external_exports.string().optional(),
13542
- business_hours: external_exports.unknown().optional()
13543
- }).passthrough();
13544
- addOrgAdminBody = external_exports.object({
13545
- user_email: external_exports.string().email("valid email is required")
13546
- });
13547
- }
13548
- });
13549
-
13550
13682
  // ../../packages/core/dist/chunk-X5PZZVTS.js
13551
13683
  function isEventRelativeFollowupType(type) {
13552
13684
  return typeof type === "string" && EVENT_RELATIVE_FOLLOWUP_TYPES.includes(type);
@@ -13945,6 +14077,57 @@ var init_chunk_X5PZZVTS = __esm({
13945
14077
  }
13946
14078
  });
13947
14079
 
14080
+ // ../../packages/core/dist/chunk-D3EP4TDU.js
14081
+ var primaryRegionSchema, placementSourceSchema, orgIdParam, orgAdminIdParam, createOrganizationBody, updateOrganizationBody, addOrgAdminBody;
14082
+ var init_chunk_D3EP4TDU = __esm({
14083
+ "../../packages/core/dist/chunk-D3EP4TDU.js"() {
14084
+ "use strict";
14085
+ init_chunk_HZ6CADSY();
14086
+ init_zod();
14087
+ primaryRegionSchema = external_exports.enum([
14088
+ "wnam",
14089
+ "enam",
14090
+ "sam",
14091
+ "weur",
14092
+ "eeur",
14093
+ "apac",
14094
+ "oc",
14095
+ "afr",
14096
+ "me"
14097
+ ]);
14098
+ placementSourceSchema = external_exports.enum([
14099
+ "hub_config",
14100
+ "org_config",
14101
+ "parent_cascade",
14102
+ "cf_colo",
14103
+ "country",
14104
+ "fallback",
14105
+ "unpinned"
14106
+ ]);
14107
+ orgIdParam = external_exports.object({
14108
+ id: uuidSchema
14109
+ });
14110
+ orgAdminIdParam = external_exports.object({
14111
+ id: uuidSchema,
14112
+ adminId: external_exports.string().min(1)
14113
+ });
14114
+ createOrganizationBody = external_exports.object({
14115
+ organization_name: external_exports.string().min(1, "organization_name is required"),
14116
+ // Write-once at creation; updateOrganizationBody does not accept this.
14117
+ primary_region: primaryRegionSchema.optional()
14118
+ });
14119
+ updateOrganizationBody = external_exports.object({
14120
+ organization_name: external_exports.string().min(1).optional(),
14121
+ organization_avatar_url: external_exports.string().url().nullable().optional(),
14122
+ timezone: external_exports.string().optional(),
14123
+ business_hours: external_exports.unknown().optional()
14124
+ }).passthrough();
14125
+ addOrgAdminBody = external_exports.object({
14126
+ user_email: external_exports.string().email("valid email is required")
14127
+ });
14128
+ }
14129
+ });
14130
+
13948
14131
  // ../../packages/core/dist/chunk-PIZTARVG.js
13949
14132
  function byLocale(entry) {
13950
14133
  const shape = Object.fromEntries(SUPPORTED_LOCALES.map((locale) => [locale, entry.optional()]));
@@ -13983,7 +14166,7 @@ var init_chunk_PIZTARVG = __esm({
13983
14166
  }
13984
14167
  });
13985
14168
 
13986
- // ../../packages/core/dist/chunk-5LACAGAY.js
14169
+ // ../../packages/core/dist/chunk-L5KGJZQD.js
13987
14170
  function refineLaneReferences(val, ctx) {
13988
14171
  const lanes = val.lanes;
13989
14172
  const statuses = val.kanban_statuses;
@@ -14007,11 +14190,11 @@ function describeSyncWarning(warning) {
14007
14190
  return `${label3}: ${parts.join("; ")}. Promote the base so production's tools match the preview's.`;
14008
14191
  }
14009
14192
  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;
14010
- var init_chunk_5LACAGAY = __esm({
14011
- "../../packages/core/dist/chunk-5LACAGAY.js"() {
14193
+ var init_chunk_L5KGJZQD = __esm({
14194
+ "../../packages/core/dist/chunk-L5KGJZQD.js"() {
14012
14195
  "use strict";
14013
- init_chunk_D3EP4TDU();
14014
14196
  init_chunk_X5PZZVTS();
14197
+ init_chunk_D3EP4TDU();
14015
14198
  init_chunk_PIZTARVG();
14016
14199
  init_chunk_HZ6CADSY();
14017
14200
  init_zod();
@@ -14207,7 +14390,7 @@ var init_chunk_5LACAGAY = __esm({
14207
14390
  }
14208
14391
  });
14209
14392
 
14210
- // ../../packages/core/dist/chunk-T65A4OFV.js
14393
+ // ../../packages/core/dist/chunk-MKQRDEZT.js
14211
14394
  function declaresNoConnection(agent) {
14212
14395
  return agent.connection === null && !agent.connection_id;
14213
14396
  }
@@ -14939,15 +15122,15 @@ function skillSectionsAsResources(scope) {
14939
15122
  };
14940
15123
  }
14941
15124
  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;
14942
- var init_chunk_T65A4OFV = __esm({
14943
- "../../packages/core/dist/chunk-T65A4OFV.js"() {
15125
+ var init_chunk_MKQRDEZT = __esm({
15126
+ "../../packages/core/dist/chunk-MKQRDEZT.js"() {
14944
15127
  "use strict";
14945
- init_chunk_EH45EEIA();
15128
+ init_chunk_JSPSTJH4();
14946
15129
  init_chunk_MFUQ2NQ5();
14947
15130
  init_chunk_ACXXM7PI();
14948
15131
  init_chunk_LBDH7LCG();
14949
15132
  init_chunk_4LXDRTO4();
14950
- init_chunk_5LACAGAY();
15133
+ init_chunk_L5KGJZQD();
14951
15134
  init_chunk_X5PZZVTS();
14952
15135
  init_chunk_PIZTARVG();
14953
15136
  init_chunk_3VHOXD5Y();
@@ -15274,75 +15457,6 @@ var init_chunk_JDJ4EUOL = __esm({
15274
15457
  }
15275
15458
  });
15276
15459
 
15277
- // ../../packages/core/dist/chunk-YULHXJ5M.js
15278
- 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;
15279
- var init_chunk_YULHXJ5M = __esm({
15280
- "../../packages/core/dist/chunk-YULHXJ5M.js"() {
15281
- "use strict";
15282
- COMMUNITY_LESSON_TREE_MAX_BYTES = 512 * 1024;
15283
- COMMUNITY_LESSON_LINK_PROTOCOLS = ["http", "https", "mailto"];
15284
- COMMUNITY_LESSON_TREE_TOO_LARGE_REASON = "lesson_tree_too_large";
15285
- COMMUNITY_LESSON_TREE_TOO_DEEP_REASON = "lesson_tree_too_deep";
15286
- COMMUNITY_LESSON_LINE_PREFIX_TOO_WIDE_REASON = "lesson_line_prefix_too_wide";
15287
- LINK_SCHEME = new RegExp(`^(${COMMUNITY_LESSON_LINK_PROTOCOLS.join("|")}):`, "i");
15288
- }
15289
- });
15290
-
15291
- // ../../packages/core/dist/chunk-V4FRPRH5.js
15292
- var CONSULT_THREAD_STATUSES, consultThreadStatus, CONSULT_THREAD_TITLE_MAX, consultThreadTitle, consultThreadSummary, listConsultThreadsQuery, listConsultThreadsResponse, createConsultThreadBody, createConsultThreadResponse, consultThreadIdParam, updateConsultThreadBody, updateConsultThreadResponse, CONSULT_AWAIT_TIMEOUT_MS;
15293
- var init_chunk_V4FRPRH5 = __esm({
15294
- "../../packages/core/dist/chunk-V4FRPRH5.js"() {
15295
- "use strict";
15296
- init_zod();
15297
- CONSULT_THREAD_STATUSES = ["open", "awaiting", "resolved", "cancelled_at_close"];
15298
- consultThreadStatus = external_exports.enum(CONSULT_THREAD_STATUSES);
15299
- CONSULT_THREAD_TITLE_MAX = 120;
15300
- consultThreadTitle = external_exports.string().trim().min(1).max(CONSULT_THREAD_TITLE_MAX);
15301
- consultThreadSummary = external_exports.object({
15302
- consult_thread_id: external_exports.string(),
15303
- conversation_id: external_exports.string(),
15304
- initiator_type: external_exports.enum(["team", "agent"]),
15305
- initiator_id: external_exports.string(),
15306
- engaged_agent_id: external_exports.string().nullable(),
15307
- engaged_agent_name: external_exports.string().nullable(),
15308
- title: external_exports.string().nullable(),
15309
- status: consultThreadStatus,
15310
- created_at: external_exports.string()
15311
- });
15312
- listConsultThreadsQuery = external_exports.object({
15313
- hub_id: external_exports.string().uuid()
15314
- });
15315
- listConsultThreadsResponse = external_exports.object({
15316
- threads: external_exports.array(consultThreadSummary)
15317
- });
15318
- createConsultThreadBody = external_exports.object({
15319
- hub_id: external_exports.string().uuid(),
15320
- title: consultThreadTitle.optional(),
15321
- // Optionally engage a consultant on creation. Validated server-side against the
15322
- // hub's `consultant`-role agents; a non-consultant / unknown id is rejected.
15323
- engaged_agent_id: external_exports.string().uuid().optional()
15324
- });
15325
- createConsultThreadResponse = external_exports.object({
15326
- thread: consultThreadSummary
15327
- });
15328
- consultThreadIdParam = external_exports.object({
15329
- id: external_exports.string().uuid(),
15330
- threadId: external_exports.string().uuid()
15331
- });
15332
- updateConsultThreadBody = external_exports.object({
15333
- hub_id: external_exports.string().uuid(),
15334
- title: consultThreadTitle.optional(),
15335
- engaged_agent_id: external_exports.string().uuid().optional()
15336
- }).refine((v) => v.title !== void 0 || v.engaged_agent_id !== void 0, {
15337
- message: "Provide a title and/or an engaged_agent_id to update"
15338
- });
15339
- updateConsultThreadResponse = external_exports.object({
15340
- thread: consultThreadSummary
15341
- });
15342
- CONSULT_AWAIT_TIMEOUT_MS = 15 * 6e4;
15343
- }
15344
- });
15345
-
15346
15460
  // ../../packages/core/dist/chunk-FOFCV4SW.js
15347
15461
  function isCaseAttributeDate(text4) {
15348
15462
  const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(text4);
@@ -15459,10 +15573,10 @@ var init_chunk_VYINA6YP = __esm({
15459
15573
  }
15460
15574
  });
15461
15575
 
15462
- // ../../packages/core/dist/chunk-VHPMMK6K.js
15576
+ // ../../packages/core/dist/chunk-KYBVSEJ2.js
15463
15577
  var CASE_SPACE_NAME_MAX_LENGTH, CASE_SPACE_DEFAULT_TIME_ZONE, CASE_TEAM_NAME_MAX_LENGTH, CASE_TEAM_MEMBERS_MAX, CASE_TEAM_SCOPES_MAX, CASE_MEMBERS_PAGE_MAX, CASE_PAGE_CURSOR_MAX_LENGTH, CASE_LEVELS, CASE_TEAM_TARGET_KINDS, CASE_REGISTRY_CLOSED_REASON, caseSpaceNameSchema, caseSpaceTimeZoneSchema, updateCaseSpaceSettingsBody, adminCreateCaseSpaceBody, caseOrgParam, caseSpaceParam, caseMemberParam, caseAdministratorParam, caseTeamParam, casePageQuery, saveCaseMemberBody, caseTeamScopeSchema, caseTeamMemberInput, caseTeamFields, createCaseTeamBody, updateCaseTeamBody;
15464
- var init_chunk_VHPMMK6K = __esm({
15465
- "../../packages/core/dist/chunk-VHPMMK6K.js"() {
15578
+ var init_chunk_KYBVSEJ2 = __esm({
15579
+ "../../packages/core/dist/chunk-KYBVSEJ2.js"() {
15466
15580
  "use strict";
15467
15581
  init_chunk_VYINA6YP();
15468
15582
  init_chunk_ZVXO3XL6();
@@ -15476,7 +15590,7 @@ var init_chunk_VHPMMK6K = __esm({
15476
15590
  CASE_MEMBERS_PAGE_MAX = 200;
15477
15591
  CASE_PAGE_CURSOR_MAX_LENGTH = 2048;
15478
15592
  CASE_LEVELS = ["read", "edit", "conduct"];
15479
- CASE_TEAM_TARGET_KINDS = ["party_group", "party", "instrument", "case_type"];
15593
+ CASE_TEAM_TARGET_KINDS = ["party_group", "party", "instrument", "case_type", "case"];
15480
15594
  CASE_REGISTRY_CLOSED_REASON = "case_registry_closed";
15481
15595
  caseSpaceNameSchema = external_exports.string().trim().min(1).max(CASE_SPACE_NAME_MAX_LENGTH);
15482
15596
  caseSpaceTimeZoneSchema = external_exports.string().trim().min(1).max(TIME_ZONE_NAME_MAX_LENGTH).refine(isTimeZone, "Not a time zone (an IANA name such as America/Sao_Paulo)");
@@ -15522,7 +15636,7 @@ var init_chunk_VHPMMK6K = __esm({
15522
15636
  }
15523
15637
  });
15524
15638
 
15525
- // ../../packages/core/dist/chunk-KQSPA427.js
15639
+ // ../../packages/core/dist/chunk-GKXAUKRL.js
15526
15640
  function resolveItemLink(phaseFolder, target) {
15527
15641
  const slash = target.lastIndexOf("/");
15528
15642
  const folder = slash < 0 ? phaseFolder : target.slice(0, slash);
@@ -15721,11 +15835,11 @@ function caseTypeDefinitionProblem(definition) {
15721
15835
  return null;
15722
15836
  }
15723
15837
  var CASE_CODE_PATTERN, CASE_PHASE_CODE_PATTERN, CASE_PHASE_FOLDER_PATTERN, CASE_INPUT_KEY_PATTERN, CASE_CALCULATION_CODE_PATTERN, CASE_AGENDA_GROUP_CODE_PATTERN, CASE_DECISION_CODE_PATTERN, CASE_DECISION_OPTION_CODE_PATTERN, CASE_DECISION_EFFECT_PATTERN, FILE_PATH_SEGMENT_PATTERN, CASE_REVIEW_MODES, CASE_OUTPUT_FORMATS, CASE_INPUT_ORIGINS, CASE_TEMPLATE_MODES, CASE_AGENDA_QUORUMS, CASE_DECISION_TYPES, CASE_NUMERIC_DECISION_TYPES, CASE_TYPE_NAME_MAX_LENGTH, CASE_CODE_MAX_LENGTH, CASE_FILE_PATH_MAX_LENGTH, CASE_TASK_NAME_MAX_LENGTH, CASE_TASK_DEPENDENCIES_MAX, CASE_FIXED_TEXT_MAX_LENGTH, CASE_TYPE_DEFINITION_MAX_CHARS, CASE_TYPE_DEFINITION_ROWS_MAX, CASE_TYPE_VERSIONS_MAX, CASE_TYPES_PAGE_MAX, code, phaseCode, inputKey, caseAgendaGroupCodeSchema, decisionCode, label2, optionalText, itemLinkTarget, filePath, caseTypePartyRoleSchema, caseTypeOutcomeSchema, caseItemRequirementsSchema, caseItemLinksSchema, caseOutputItemSchema, casePhaseOutputSchema, casePhaseInputSchema, caseDecisionOptionSchema, decisionBound, caseAgendaDecisionSchema, caseAgendaGroupSchema, caseTypeTaskSchema, caseTypePhaseSchema, caseTypeDefinitionShape, caseValuesRepeated, caseTypeDefinitionSchema, caseTypeAbbreviationSchema, caseTypeNameSchema, createCaseTypeBody, publishCaseTypeVersionBody, setCaseTypeActiveBody, caseTypeParam, caseTypesPageQuery, caseTypeVersionQuery;
15724
- var init_chunk_KQSPA427 = __esm({
15725
- "../../packages/core/dist/chunk-KQSPA427.js"() {
15838
+ var init_chunk_GKXAUKRL = __esm({
15839
+ "../../packages/core/dist/chunk-GKXAUKRL.js"() {
15726
15840
  "use strict";
15727
15841
  init_chunk_FOFCV4SW();
15728
- init_chunk_VHPMMK6K();
15842
+ init_chunk_KYBVSEJ2();
15729
15843
  init_chunk_HZ6CADSY();
15730
15844
  init_chunk_ZTNFLGW5();
15731
15845
  init_zod();
@@ -15933,7 +16047,7 @@ var init_chunk_KQSPA427 = __esm({
15933
16047
  }
15934
16048
  });
15935
16049
 
15936
- // ../../packages/core/dist/chunk-5IQXVUZZ.js
16050
+ // ../../packages/core/dist/chunk-AIBWYEMW.js
15937
16051
  function openCaseProblem(body) {
15938
16052
  const pairs = /* @__PURE__ */ new Set();
15939
16053
  for (const [index, party] of body.parties.entries()) {
@@ -15945,12 +16059,12 @@ ${party.role}`;
15945
16059
  if (new Set(body.instrument_ids).size !== body.instrument_ids.length) return { reason: "instrument_repeated", at: "instrument_ids" };
15946
16060
  return null;
15947
16061
  }
15948
- var CASE_RECORD_CODE_PATTERN, CASE_RECORD_CODE_MAX_LENGTH, CASE_RECORD_PARTIES_MAX, CASE_RECORD_INSTRUMENTS_MAX, CASE_RECORD_ROLE_MAX_LENGTH, CASE_RECORDS_PAGE_MAX, CASE_RECORDS_QUERY_MAX_LENGTH, caseRecordPartySchema, openCaseShape, openCaseBody, previewOpenCaseShape, caseRecordParam, CASE_RECORD_STATUSES, caseRecordsQuery, CASE_STATE_SUMMARIES_MAX, caseStatesQuery, CASE_CLOSURE_REASON_MAX_LENGTH, closeCaseBody;
15949
- var init_chunk_5IQXVUZZ = __esm({
15950
- "../../packages/core/dist/chunk-5IQXVUZZ.js"() {
16062
+ var CASE_RECORD_CODE_PATTERN, CASE_RECORD_CODE_MAX_LENGTH, CASE_RECORD_PARTIES_MAX, CASE_RECORD_INSTRUMENTS_MAX, CASE_RECORD_ROLE_MAX_LENGTH, CASE_RECORDS_PAGE_MAX, CASE_RECORDS_QUERY_MAX_LENGTH, caseRecordPartySchema, openCaseShape, openCaseBody, previewOpenCaseShape, caseRecordParam, CASE_RECORD_STATUSES, caseRecordsQuery, CASE_STATE_SUMMARIES_MAX, caseStatesQuery, CASE_CLOSURE_REASON_MAX_LENGTH, closeCaseBody, setCaseConfidentialityBody;
16063
+ var init_chunk_AIBWYEMW = __esm({
16064
+ "../../packages/core/dist/chunk-AIBWYEMW.js"() {
15951
16065
  "use strict";
15952
- init_chunk_KQSPA427();
15953
- init_chunk_VHPMMK6K();
16066
+ init_chunk_GKXAUKRL();
16067
+ init_chunk_KYBVSEJ2();
15954
16068
  init_chunk_HZ6CADSY();
15955
16069
  init_chunk_ZTNFLGW5();
15956
16070
  init_zod();
@@ -16005,19 +16119,80 @@ var init_chunk_5IQXVUZZ = __esm({
16005
16119
  outcome_code: external_exports.string().max(CASE_CODE_MAX_LENGTH).regex(CASE_CODE_PATTERN),
16006
16120
  reason: external_exports.string().trim().min(1).max(CASE_CLOSURE_REASON_MAX_LENGTH)
16007
16121
  }).strict();
16122
+ setCaseConfidentialityBody = external_exports.object({ confidential: external_exports.boolean() }).strict();
16008
16123
  }
16009
16124
  });
16010
16125
 
16011
- // ../../packages/core/dist/chunk-YMNHLPJB.js
16126
+ // ../../packages/core/dist/chunk-XCWEXZQE.js
16127
+ var CASE_RELATION_TYPE_CODE_PATTERN, CASE_RELATION_TYPE_CODE_MAX_LENGTH, CASE_RELATION_TYPE_NAME_MAX_LENGTH, CASE_RELATION_TYPES_PER_SPACE_MAX, CASE_RELATION_DESCRIPTION_MAX_LENGTH, CASE_RELATION_SIDES, CASE_EXTERNAL_SYSTEM_PATTERN, CASE_EXTERNAL_NUMBER_MAX_LENGTH, CASE_EXTERNAL_URL_MAX_LENGTH, trimmedName, relationTypeFields, createCaseRelationTypeBody, updateCaseRelationTypeBody, relateCasesBody, addCaseExternalReferenceBody, caseRelationTypeParam, caseRelationParam, caseExternalReferenceParam, caseRelationTypesQuery;
16128
+ var init_chunk_XCWEXZQE = __esm({
16129
+ "../../packages/core/dist/chunk-XCWEXZQE.js"() {
16130
+ "use strict";
16131
+ init_chunk_AIBWYEMW();
16132
+ init_chunk_KYBVSEJ2();
16133
+ init_chunk_HZ6CADSY();
16134
+ init_zod();
16135
+ CASE_RELATION_TYPE_CODE_PATTERN = /^[a-z0-9]+(_[a-z0-9]+)*$/;
16136
+ CASE_RELATION_TYPE_CODE_MAX_LENGTH = 64;
16137
+ CASE_RELATION_TYPE_NAME_MAX_LENGTH = 200;
16138
+ CASE_RELATION_TYPES_PER_SPACE_MAX = 100;
16139
+ CASE_RELATION_DESCRIPTION_MAX_LENGTH = 500;
16140
+ CASE_RELATION_SIDES = ["origin", "destination"];
16141
+ CASE_EXTERNAL_SYSTEM_PATTERN = /^[A-Za-z0-9][A-Za-z0-9 ._-]{0,30}$/;
16142
+ CASE_EXTERNAL_NUMBER_MAX_LENGTH = 120;
16143
+ CASE_EXTERNAL_URL_MAX_LENGTH = 2048;
16144
+ trimmedName = external_exports.string().trim().min(1).max(CASE_RELATION_TYPE_NAME_MAX_LENGTH);
16145
+ relationTypeFields = { name: trimmedName, inverse_name: trimmedName, active: external_exports.boolean().default(true) };
16146
+ createCaseRelationTypeBody = external_exports.object({
16147
+ code: external_exports.string().trim().max(CASE_RELATION_TYPE_CODE_MAX_LENGTH).regex(CASE_RELATION_TYPE_CODE_PATTERN),
16148
+ ...relationTypeFields
16149
+ }).strict();
16150
+ updateCaseRelationTypeBody = external_exports.object({ ...relationTypeFields, expected_updated_at: timestampSchema.optional() }).strict();
16151
+ relateCasesBody = external_exports.object({
16152
+ relation_type_id: uuidSchema,
16153
+ other_code: external_exports.string().max(CASE_RECORD_CODE_MAX_LENGTH).regex(CASE_RECORD_CODE_PATTERN),
16154
+ /** This case's side: `origin` reads the type's name ("continues"), `destination` its inverse. */
16155
+ side: external_exports.enum(CASE_RELATION_SIDES).default("origin"),
16156
+ description: external_exports.string().trim().min(1).max(CASE_RELATION_DESCRIPTION_MAX_LENGTH).nullable().default(null)
16157
+ }).strict();
16158
+ addCaseExternalReferenceBody = external_exports.object({
16159
+ system: external_exports.string().trim().regex(CASE_EXTERNAL_SYSTEM_PATTERN),
16160
+ number: external_exports.string().trim().min(1).max(CASE_EXTERNAL_NUMBER_MAX_LENGTH),
16161
+ url: external_exports.string().trim().max(CASE_EXTERNAL_URL_MAX_LENGTH).url().refine((url) => url.startsWith("https://"), "An https link").nullable().default(null)
16162
+ }).strict();
16163
+ caseRelationTypeParam = caseSpaceParam.extend({ relation_type_id: uuidSchema });
16164
+ caseRelationParam = caseRecordParam.extend({ relation_id: uuidSchema });
16165
+ caseExternalReferenceParam = caseRecordParam.extend({ reference_id: uuidSchema });
16166
+ caseRelationTypesQuery = casePageQuery.extend({
16167
+ limit: external_exports.coerce.number().int().min(1).max(CASE_RELATION_TYPES_PER_SPACE_MAX).optional()
16168
+ });
16169
+ }
16170
+ });
16171
+
16172
+ // ../../packages/core/dist/chunk-N6SE35OR.js
16173
+ var CASE_MEMBER_CASES_PAGE_MAX, caseMemberReachQuery;
16174
+ var init_chunk_N6SE35OR = __esm({
16175
+ "../../packages/core/dist/chunk-N6SE35OR.js"() {
16176
+ "use strict";
16177
+ init_chunk_KYBVSEJ2();
16178
+ init_zod();
16179
+ CASE_MEMBER_CASES_PAGE_MAX = 50;
16180
+ caseMemberReachQuery = casePageQuery.extend({
16181
+ limit: external_exports.coerce.number().int().min(1).max(CASE_MEMBER_CASES_PAGE_MAX).optional()
16182
+ }).strict();
16183
+ }
16184
+ });
16185
+
16186
+ // ../../packages/core/dist/chunk-5THMAK2R.js
16012
16187
  function addCaseNoteProblem(note) {
16013
16188
  return note.origin !== null && note.kind !== "contribution" ? { reason: "origin_not_contribution", at: "origin" } : null;
16014
16189
  }
16015
16190
  var CASE_NOTE_KINDS, CASE_NOTE_TEXT_MAX_LENGTH, CASE_NOTE_ORIGIN_MAX_LENGTH, CASE_NOTES_PAGE_MAX, addCaseNoteShape, addCaseNoteBody, caseNoteParam, caseTaskParam, caseNotesQuery;
16016
- var init_chunk_YMNHLPJB = __esm({
16017
- "../../packages/core/dist/chunk-YMNHLPJB.js"() {
16191
+ var init_chunk_5THMAK2R = __esm({
16192
+ "../../packages/core/dist/chunk-5THMAK2R.js"() {
16018
16193
  "use strict";
16019
- init_chunk_5IQXVUZZ();
16020
- init_chunk_VHPMMK6K();
16194
+ init_chunk_AIBWYEMW();
16195
+ init_chunk_KYBVSEJ2();
16021
16196
  init_chunk_HZ6CADSY();
16022
16197
  init_zod();
16023
16198
  CASE_NOTE_KINDS = ["observation", "next_step", "pending", "contribution"];
@@ -16046,7 +16221,7 @@ var init_chunk_YMNHLPJB = __esm({
16046
16221
  }
16047
16222
  });
16048
16223
 
16049
- // ../../packages/core/dist/chunk-OQMCZSR4.js
16224
+ // ../../packages/core/dist/chunk-SE6YMSWN.js
16050
16225
  function withProblem(shape, problemOf) {
16051
16226
  return shape.superRefine((value, ctx) => {
16052
16227
  const found = problemOf(value);
@@ -16082,12 +16257,12 @@ function caseInstrumentProblem(instrument) {
16082
16257
  ${party.role}`);
16083
16258
  return new Set(keys).size === keys.length ? null : { reason: "instrument_party_repeated", at: "parties" };
16084
16259
  }
16085
- var CASE_REGISTRY_TYPE_CODE_PATTERN, CASE_REGISTRY_TYPE_CODE_MAX_LENGTH, CASE_REGISTRY_NAME_MAX_LENGTH, CASE_REGISTRY_TYPE_SCHEMA_MAX_CHARS, CASE_PARTY_ABBREVIATION_PATTERN, CASE_PARTY_PERSON_KINDS, CASE_PARTY_DOCUMENT_KINDS, CASE_PARTY_DOCUMENT_MAX_LENGTH, CASE_PARTY_GROUP_MEMBERS_MAX, CASE_INSTRUMENT_NUMBER_MAX_LENGTH, CASE_INSTRUMENT_ROLE_MAX_LENGTH, CASE_INSTRUMENT_PARTIES_MAX, CASE_REGISTRY_PAGE_MAX, CASE_REGISTRY_QUERY_MAX_LENGTH, trimmedName, dateSchema, attributesValues, registryTypeFields, createCaseRegistryTypeShape, updateCaseRegistryTypeShape, createCaseRegistryTypeBody, updateCaseRegistryTypeBody, saveCasePartyShape, saveCasePartyBody, saveCasePartyGroupShape, saveCasePartyGroupBody, caseInstrumentPartyInput, saveCaseInstrumentShape, saveCaseInstrumentBody, registryPage, searchText, casePartiesQuery, casePartyGroupsQuery, caseInstrumentsQuery, caseRegistryTypeParam, casePartyParam, casePartyGroupParam, caseInstrumentParam;
16086
- var init_chunk_OQMCZSR4 = __esm({
16087
- "../../packages/core/dist/chunk-OQMCZSR4.js"() {
16260
+ var CASE_REGISTRY_TYPE_CODE_PATTERN, CASE_REGISTRY_TYPE_CODE_MAX_LENGTH, CASE_REGISTRY_NAME_MAX_LENGTH, CASE_REGISTRY_TYPE_SCHEMA_MAX_CHARS, CASE_PARTY_ABBREVIATION_PATTERN, CASE_PARTY_PERSON_KINDS, CASE_PARTY_DOCUMENT_KINDS, CASE_PARTY_DOCUMENT_MAX_LENGTH, CASE_PARTY_GROUP_MEMBERS_MAX, CASE_INSTRUMENT_NUMBER_MAX_LENGTH, CASE_INSTRUMENT_ROLE_MAX_LENGTH, CASE_INSTRUMENT_PARTIES_MAX, CASE_REGISTRY_PAGE_MAX, CASE_REGISTRY_QUERY_MAX_LENGTH, trimmedName2, dateSchema, attributesValues, registryTypeFields, createCaseRegistryTypeShape, updateCaseRegistryTypeShape, createCaseRegistryTypeBody, updateCaseRegistryTypeBody, saveCasePartyShape, saveCasePartyBody, saveCasePartyGroupShape, saveCasePartyGroupBody, caseInstrumentPartyInput, saveCaseInstrumentShape, saveCaseInstrumentBody, registryPage, searchText, casePartiesQuery, casePartyGroupsQuery, caseInstrumentsQuery, caseRegistryTypeParam, casePartyParam, casePartyGroupParam, caseInstrumentParam;
16261
+ var init_chunk_SE6YMSWN = __esm({
16262
+ "../../packages/core/dist/chunk-SE6YMSWN.js"() {
16088
16263
  "use strict";
16089
16264
  init_chunk_FOFCV4SW();
16090
- init_chunk_VHPMMK6K();
16265
+ init_chunk_KYBVSEJ2();
16091
16266
  init_chunk_HZ6CADSY();
16092
16267
  init_zod();
16093
16268
  CASE_REGISTRY_TYPE_CODE_PATTERN = /^[a-z0-9]+(_[a-z0-9]+)*$/;
@@ -16104,11 +16279,11 @@ var init_chunk_OQMCZSR4 = __esm({
16104
16279
  CASE_INSTRUMENT_PARTIES_MAX = 50;
16105
16280
  CASE_REGISTRY_PAGE_MAX = 100;
16106
16281
  CASE_REGISTRY_QUERY_MAX_LENGTH = 200;
16107
- trimmedName = external_exports.string().trim().min(1).max(CASE_REGISTRY_NAME_MAX_LENGTH);
16282
+ trimmedName2 = external_exports.string().trim().min(1).max(CASE_REGISTRY_NAME_MAX_LENGTH);
16108
16283
  dateSchema = external_exports.string().refine(isCaseAttributeDate, "Not a date (YYYY-MM-DD)");
16109
16284
  attributesValues = external_exports.record(external_exports.string(), external_exports.unknown()).default({});
16110
16285
  registryTypeFields = {
16111
- name: trimmedName,
16286
+ name: trimmedName2,
16112
16287
  attributes: caseAttributesSchemaSchema.default(EMPTY_CASE_ATTRIBUTES_SCHEMA),
16113
16288
  active: external_exports.boolean().default(true)
16114
16289
  };
@@ -16124,7 +16299,7 @@ var init_chunk_OQMCZSR4 = __esm({
16124
16299
  updateCaseRegistryTypeBody = withProblem(updateCaseRegistryTypeShape, caseRegistryTypeProblem);
16125
16300
  saveCasePartyShape = external_exports.object({
16126
16301
  type_id: uuidSchema,
16127
- name: trimmedName,
16302
+ name: trimmedName2,
16128
16303
  abbreviation: external_exports.string().trim().transform((value) => value.toUpperCase()).pipe(external_exports.string().regex(CASE_PARTY_ABBREVIATION_PATTERN)).nullable().default(null),
16129
16304
  person_kind: external_exports.enum(CASE_PARTY_PERSON_KINDS),
16130
16305
  document_kind: external_exports.enum(CASE_PARTY_DOCUMENT_KINDS).nullable().default(null),
@@ -16135,7 +16310,7 @@ var init_chunk_OQMCZSR4 = __esm({
16135
16310
  }).strict();
16136
16311
  saveCasePartyBody = withProblem(saveCasePartyShape, casePartyProblem);
16137
16312
  saveCasePartyGroupShape = external_exports.object({
16138
- name: trimmedName,
16313
+ name: trimmedName2,
16139
16314
  party_ids: external_exports.array(uuidSchema).max(CASE_PARTY_GROUP_MEMBERS_MAX).default([]),
16140
16315
  expected_updated_at: timestampSchema.optional()
16141
16316
  }).strict();
@@ -16188,128 +16363,27 @@ var init_chunk_IGLHT6YP = __esm({
16188
16363
  }
16189
16364
  });
16190
16365
 
16191
- // ../../packages/core/dist/chunk-5XV7YVGX.js
16192
- var CASE_TIMELINE_PAGE_MAX, caseTimelineQuery;
16193
- var init_chunk_5XV7YVGX = __esm({
16194
- "../../packages/core/dist/chunk-5XV7YVGX.js"() {
16366
+ // ../../packages/core/dist/chunk-7ULJTQXZ.js
16367
+ var caseTeamPreviewBody;
16368
+ var init_chunk_7ULJTQXZ = __esm({
16369
+ "../../packages/core/dist/chunk-7ULJTQXZ.js"() {
16195
16370
  "use strict";
16196
- init_chunk_VHPMMK6K();
16197
- init_zod();
16198
- CASE_TIMELINE_PAGE_MAX = 100;
16199
- caseTimelineQuery = casePageQuery.extend({
16200
- limit: external_exports.coerce.number().int().min(1).max(CASE_TIMELINE_PAGE_MAX).optional()
16201
- });
16371
+ init_chunk_KYBVSEJ2();
16372
+ init_chunk_HZ6CADSY();
16373
+ caseTeamPreviewBody = createCaseTeamBody.pick({ active: true, scopes: true, members: true }).extend({ team_id: uuidSchema.optional() }).strict();
16202
16374
  }
16203
16375
  });
16204
16376
 
16205
- // ../../packages/core/dist/chunk-7CYHPF35.js
16206
- var appMessageSenderType, appMessageReceiverType, apiChannelMessage, apiChannelMessageBody, appMessageBody, appMessageResponse;
16207
- var init_chunk_7CYHPF35 = __esm({
16208
- "../../packages/core/dist/chunk-7CYHPF35.js"() {
16377
+ // ../../packages/core/dist/chunk-QBCR5ELA.js
16378
+ var CASE_TIMELINE_PAGE_MAX, caseTimelineQuery;
16379
+ var init_chunk_QBCR5ELA = __esm({
16380
+ "../../packages/core/dist/chunk-QBCR5ELA.js"() {
16209
16381
  "use strict";
16210
- init_chunk_HZ6CADSY();
16382
+ init_chunk_KYBVSEJ2();
16211
16383
  init_zod();
16212
- appMessageSenderType = external_exports.enum(["user", "team"]);
16213
- appMessageReceiverType = external_exports.enum(["user", "team", "agent", "assistant"]).transform((v) => v === "assistant" ? "agent" : v);
16214
- apiChannelMessage = external_exports.object({
16215
- text: clientOptionalString,
16216
- attachments: external_exports.array(messageAttachment).max(MAX_ATTACHMENTS_PER_MESSAGE).nullish().transform((v) => v ?? void 0)
16217
- }).refine((m) => m.text && m.text.length > 0 || m.attachments && m.attachments.length > 0, {
16218
- message: "message must have text or at least one attachment"
16219
- });
16220
- apiChannelMessageBody = external_exports.object({
16221
- // Correlation id (task hubs): new → new conversation, repeat → continue. min 1 so an
16222
- // empty string can't masquerade as a ref. Mutually exclusive with conversation_id.
16223
- external_ref: external_exports.string().min(1).max(256).optional(),
16224
- // Continue a specific WayAI conversation (authorized against the hub/channel + owner).
16225
- // UUID-validated here (unlike the app channel, whose client we control): allocation
16226
- // only treats a UUID-shaped id as a provided conversation, so a malformed id would
16227
- // otherwise skip the owner guard and silently MINT a new conversation instead of
16228
- // rejecting. A format 400 is shape-only — not an existence oracle (a valid-but-unknown
16229
- // UUID still collapses to the opaque authorization error downstream).
16230
- conversation_id: external_exports.string().uuid().optional(),
16231
- // On-behalf-of end-user identity. Absent → per-connection service principal (task-hub
16232
- // only; chat hub rejects with 422 in the route).
16233
- user: external_exports.object({
16234
- id: external_exports.string().min(1),
16235
- email: clientOptionalString,
16236
- name: clientOptionalString
16237
- }).optional(),
16238
- message: apiChannelMessage,
16239
- // Idempotency key: maps to channel_message_sid, deduped within one conversation
16240
- // (ConversationDO.storeMessage). A retried POST resolves to the same conversation (a chat
16241
- // hub's user, the external_ref, the conversation_id, or on a task hub with neither, this key
16242
- // scoped by the sender), so it echoes the original message_id and skips billing / turn
16243
- // dispatch. A failed store answers a retryable 503 only when this key is set; without it a
16244
- // retry could store the message twice, so it answers 400.
16245
- client_message_id: external_exports.string().min(1).max(256).optional()
16246
- }).refine((b) => !(b.external_ref && b.conversation_id), {
16247
- message: "provide external_ref or conversation_id, not both",
16248
- path: ["external_ref"]
16249
- });
16250
- appMessageBody = external_exports.object({
16251
- // Message content — three historical aliases. All optional: an attachment-only
16252
- // or voice-only message carries no text.
16253
- content: clientOptionalString,
16254
- message_text: clientOptionalString,
16255
- message_body: clientOptionalString,
16256
- // Conversation context. Ids are plain strings rather than `.uuid()` on purpose:
16257
- // they are AUTHORIZED downstream, which is the stronger guarantee — a well-formed
16258
- // uuid belonging to another tenant must fail just as hard as junk. `hub_id` is
16259
- // gated by `assertHubEndUserAccess` (gh #3286) and `conversation_id` by HubDO's
16260
- // conversation_index owner check (gh #2781, #3281). The route's own falsy guards
16261
- // ('hub_id is required') still reject an empty one.
16262
- hub_id: clientOptionalString,
16263
- channel_id: clientOptionalString,
16264
- conversation_id: clientOptionalString,
16265
- hub_type: external_exports.enum(["chat", "task"]).nullish().transform((v) => v ?? void 0),
16266
- // Stable idempotency key for one explicit task-hub launcher. HubDO scopes it
16267
- // to the authenticated user and resolves retries/tabs to one conversation.
16268
- task_start_id: external_exports.string().uuid().nullish().transform((v) => v ?? void 0),
16269
- // Routing.
16270
- sender_type: appMessageSenderType.nullish().transform((v) => v ?? void 0),
16271
- receiver_type: appMessageReceiverType.nullish().transform((v) => v ?? void 0),
16272
- // Only meaningful on a team send, where `validateAppTeamSendContext` proves the
16273
- // caller may send to this receiver. Absent on a team send to a conversation with no
16274
- // person, which names its `conversation_id` instead. The end-user branch ignores it —
16275
- // see the receiver derivation in the route.
16276
- user_receiver_id: clientOptionalString,
16277
- // ── Internal consult (consultant-agents PR 2 — H1.0) ──────────────────────
16278
- // A team member handling a customer conversation can tag a `consultant`-role
16279
- // agent for a PRIVATE, team-only exchange that never reaches the customer. A
16280
- // consult send is a team send with `receiver_type: 'agent'` targeting the
16281
- // consultant; `user_receiver_id` identifies the customer whose conversation this is
16282
- // (and is authorized by `validateAppTeamSendContext`, exactly as a team→user send is),
16283
- // and is absent, as on a team→user send, when the conversation has no person. The consultant is resolved from `agent_receiver_id`
16284
- // when supplied, else from an `@mention` parsed out of the message text against
16285
- // the hub's consultant agents. `consult_thread_id` continues an existing thread;
16286
- // absent, the route creates/reuses the single implicit thread. These fields are
16287
- // inert on every non-consult send (end-user send, team→user send).
16288
- agent_receiver_id: clientOptionalString,
16289
- consult_thread_id: clientOptionalString,
16290
- is_first_message: clientOptionalBoolean,
16291
- end_conversation: clientOptionalBoolean,
16292
- // Pre-generated by the client so the optimistic bubble and the stored row share
16293
- // a key (transcription live-updates land on the same row instead of duplicating).
16294
- message_id: clientOptionalString,
16295
- attachments: external_exports.array(messageAttachment).max(MAX_ATTACHMENTS_PER_MESSAGE).nullish().transform((v) => v ?? void 0),
16296
- // Base64-encoded audio for STT. Size-capped in the route (the cap is a byte
16297
- // budget tied to the /channels/* bodyLimit, not a shape rule).
16298
- audio_file: clientOptionalString
16299
- });
16300
- appMessageResponse = external_exports.object({
16301
- success: external_exports.boolean(),
16302
- message: external_exports.string(),
16303
- result: external_exports.object({
16304
- conversation_id: external_exports.string().optional(),
16305
- message_id: external_exports.string().optional(),
16306
- status: external_exports.string().optional(),
16307
- files: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown())).optional(),
16308
- // True when this request reused a task-start/message id already accepted by
16309
- // the server. Clients must replace their optimistic payload with a fresh
16310
- // authoritative read because another tab may have won with different text.
16311
- deduped: external_exports.boolean().optional()
16312
- }).optional()
16384
+ CASE_TIMELINE_PAGE_MAX = 100;
16385
+ caseTimelineQuery = casePageQuery.extend({
16386
+ limit: external_exports.coerce.number().int().min(1).max(CASE_TIMELINE_PAGE_MAX).optional()
16313
16387
  });
16314
16388
  }
16315
16389
  });
@@ -16381,12 +16455,23 @@ var init_chunk_YWZFB34T = __esm({
16381
16455
  }
16382
16456
  });
16383
16457
 
16384
- // ../../packages/core/dist/chunk-ZRQS7XQH.js
16458
+ // ../../packages/core/dist/chunk-Z3SV3XTC.js
16459
+ var caseAccessQuery;
16460
+ var init_chunk_Z3SV3XTC = __esm({
16461
+ "../../packages/core/dist/chunk-Z3SV3XTC.js"() {
16462
+ "use strict";
16463
+ init_chunk_HZ6CADSY();
16464
+ init_zod();
16465
+ caseAccessQuery = external_exports.object({ with_team_id: uuidSchema.optional() }).strict();
16466
+ }
16467
+ });
16468
+
16469
+ // ../../packages/core/dist/chunk-MVLW2KQB.js
16385
16470
  var CASE_ADJUSTMENT_REASON_MAX_LENGTH, CASE_ADJUSTMENT_DISPENSATION_KINDS, reason, activateCasePhaseBody, dispenseCaseBody, addCaseTaskBody, addCaseInputBody, caseOwnItemSchema, addCaseItemBody;
16386
- var init_chunk_ZRQS7XQH = __esm({
16387
- "../../packages/core/dist/chunk-ZRQS7XQH.js"() {
16471
+ var init_chunk_MVLW2KQB = __esm({
16472
+ "../../packages/core/dist/chunk-MVLW2KQB.js"() {
16388
16473
  "use strict";
16389
- init_chunk_KQSPA427();
16474
+ init_chunk_GKXAUKRL();
16390
16475
  init_chunk_HZ6CADSY();
16391
16476
  init_zod();
16392
16477
  CASE_ADJUSTMENT_REASON_MAX_LENGTH = 2e3;
@@ -16417,7 +16502,7 @@ var init_chunk_ZRQS7XQH = __esm({
16417
16502
  }
16418
16503
  });
16419
16504
 
16420
- // ../../packages/core/dist/chunk-QRAZ5PK7.js
16505
+ // ../../packages/core/dist/chunk-EPW6REOS.js
16421
16506
  function isCaseDueDate(value) {
16422
16507
  const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value);
16423
16508
  if (!match) return false;
@@ -16435,10 +16520,10 @@ function setCaseDeadlinesProblem(body) {
16435
16520
  return null;
16436
16521
  }
16437
16522
  var CASE_DUE_DATE_MIN_YEAR, CASE_DUE_DATE_MAX_YEAR, CASE_DEADLINES_PHASES_MAX, CASE_OVERDUE_CASES_MAX, caseDueDateSchema, setCaseDeadlinesShape, setCaseDeadlinesBody, setCaseTaskPlanBody, setCaseOwnerBody, caseOverdueQuery;
16438
- var init_chunk_QRAZ5PK7 = __esm({
16439
- "../../packages/core/dist/chunk-QRAZ5PK7.js"() {
16523
+ var init_chunk_EPW6REOS = __esm({
16524
+ "../../packages/core/dist/chunk-EPW6REOS.js"() {
16440
16525
  "use strict";
16441
- init_chunk_VHPMMK6K();
16526
+ init_chunk_KYBVSEJ2();
16442
16527
  init_chunk_HZ6CADSY();
16443
16528
  init_zod();
16444
16529
  CASE_DUE_DATE_MIN_YEAR = 2e3;
@@ -16466,52 +16551,6 @@ var init_chunk_QRAZ5PK7 = __esm({
16466
16551
  }
16467
16552
  });
16468
16553
 
16469
- // ../../packages/core/dist/chunk-YFDHUHJA.js
16470
- var CASE_RELATION_TYPE_CODE_PATTERN, CASE_RELATION_TYPE_CODE_MAX_LENGTH, CASE_RELATION_TYPE_NAME_MAX_LENGTH, CASE_RELATION_TYPES_PER_SPACE_MAX, CASE_RELATION_DESCRIPTION_MAX_LENGTH, CASE_RELATION_SIDES, CASE_EXTERNAL_SYSTEM_PATTERN, CASE_EXTERNAL_NUMBER_MAX_LENGTH, CASE_EXTERNAL_URL_MAX_LENGTH, trimmedName2, relationTypeFields, createCaseRelationTypeBody, updateCaseRelationTypeBody, relateCasesBody, addCaseExternalReferenceBody, caseRelationTypeParam, caseRelationParam, caseExternalReferenceParam, caseRelationTypesQuery;
16471
- var init_chunk_YFDHUHJA = __esm({
16472
- "../../packages/core/dist/chunk-YFDHUHJA.js"() {
16473
- "use strict";
16474
- init_chunk_5IQXVUZZ();
16475
- init_chunk_VHPMMK6K();
16476
- init_chunk_HZ6CADSY();
16477
- init_zod();
16478
- CASE_RELATION_TYPE_CODE_PATTERN = /^[a-z0-9]+(_[a-z0-9]+)*$/;
16479
- CASE_RELATION_TYPE_CODE_MAX_LENGTH = 64;
16480
- CASE_RELATION_TYPE_NAME_MAX_LENGTH = 200;
16481
- CASE_RELATION_TYPES_PER_SPACE_MAX = 100;
16482
- CASE_RELATION_DESCRIPTION_MAX_LENGTH = 500;
16483
- CASE_RELATION_SIDES = ["origin", "destination"];
16484
- CASE_EXTERNAL_SYSTEM_PATTERN = /^[A-Za-z0-9][A-Za-z0-9 ._-]{0,30}$/;
16485
- CASE_EXTERNAL_NUMBER_MAX_LENGTH = 120;
16486
- CASE_EXTERNAL_URL_MAX_LENGTH = 2048;
16487
- trimmedName2 = external_exports.string().trim().min(1).max(CASE_RELATION_TYPE_NAME_MAX_LENGTH);
16488
- relationTypeFields = { name: trimmedName2, inverse_name: trimmedName2, active: external_exports.boolean().default(true) };
16489
- createCaseRelationTypeBody = external_exports.object({
16490
- code: external_exports.string().trim().max(CASE_RELATION_TYPE_CODE_MAX_LENGTH).regex(CASE_RELATION_TYPE_CODE_PATTERN),
16491
- ...relationTypeFields
16492
- }).strict();
16493
- updateCaseRelationTypeBody = external_exports.object({ ...relationTypeFields, expected_updated_at: timestampSchema.optional() }).strict();
16494
- relateCasesBody = external_exports.object({
16495
- relation_type_id: uuidSchema,
16496
- other_code: external_exports.string().max(CASE_RECORD_CODE_MAX_LENGTH).regex(CASE_RECORD_CODE_PATTERN),
16497
- /** This case's side: `origin` reads the type's name ("continues"), `destination` its inverse. */
16498
- side: external_exports.enum(CASE_RELATION_SIDES).default("origin"),
16499
- description: external_exports.string().trim().min(1).max(CASE_RELATION_DESCRIPTION_MAX_LENGTH).nullable().default(null)
16500
- }).strict();
16501
- addCaseExternalReferenceBody = external_exports.object({
16502
- system: external_exports.string().trim().regex(CASE_EXTERNAL_SYSTEM_PATTERN),
16503
- number: external_exports.string().trim().min(1).max(CASE_EXTERNAL_NUMBER_MAX_LENGTH),
16504
- url: external_exports.string().trim().max(CASE_EXTERNAL_URL_MAX_LENGTH).url().refine((url) => url.startsWith("https://"), "An https link").nullable().default(null)
16505
- }).strict();
16506
- caseRelationTypeParam = caseSpaceParam.extend({ relation_type_id: uuidSchema });
16507
- caseRelationParam = caseRecordParam.extend({ relation_id: uuidSchema });
16508
- caseExternalReferenceParam = caseRecordParam.extend({ reference_id: uuidSchema });
16509
- caseRelationTypesQuery = casePageQuery.extend({
16510
- limit: external_exports.coerce.number().int().min(1).max(CASE_RELATION_TYPES_PER_SPACE_MAX).optional()
16511
- });
16512
- }
16513
- });
16514
-
16515
16554
  // ../../packages/core/dist/chunk-NVKU5PPQ.js
16516
16555
  var ADMIN_SKILL_NAME_REGEX, adminSkillNameParam;
16517
16556
  var init_chunk_NVKU5PPQ = __esm({
@@ -16675,7 +16714,7 @@ var init_chunk_OMPT4ZHR = __esm({
16675
16714
  }
16676
16715
  });
16677
16716
 
16678
- // ../../packages/core/dist/chunk-NWB4MECC.js
16717
+ // ../../packages/core/dist/chunk-5THT3WVS.js
16679
16718
  function refineScopedTarget(data, ctx) {
16680
16719
  if (data.scope === "org") {
16681
16720
  if (!data.org_id) {
@@ -16700,14 +16739,14 @@ function refineScopedTarget(data, ctx) {
16700
16739
  }
16701
16740
  }
16702
16741
  }
16703
- 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;
16704
- var init_chunk_NWB4MECC = __esm({
16705
- "../../packages/core/dist/chunk-NWB4MECC.js"() {
16742
+ 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, adminRepairCredentialServicesBody, 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;
16743
+ var init_chunk_5THT3WVS = __esm({
16744
+ "../../packages/core/dist/chunk-5THT3WVS.js"() {
16706
16745
  "use strict";
16707
16746
  init_chunk_FECLIZTY();
16708
16747
  init_chunk_BFG4ZWR4();
16709
16748
  init_chunk_7VJ4SOFF();
16710
- init_chunk_5LACAGAY();
16749
+ init_chunk_L5KGJZQD();
16711
16750
  init_chunk_OMPT4ZHR();
16712
16751
  init_chunk_HZ6CADSY();
16713
16752
  init_chunk_MIWZOSPI();
@@ -16943,6 +16982,11 @@ var init_chunk_NWB4MECC = __esm({
16943
16982
  ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "scope=all must not include org_id", path: ["org_id"] });
16944
16983
  }
16945
16984
  });
16985
+ adminRepairCredentialServicesBody = external_exports.object({
16986
+ scope: external_exports.enum(["all", "org"]),
16987
+ org_id: external_exports.string().uuid().optional(),
16988
+ dry_run: external_exports.boolean().optional().default(true)
16989
+ }).strict().superRefine(refineScopedTarget);
16946
16990
  adminRepairCompedPlansBody = external_exports.object({
16947
16991
  org_id: external_exports.string().uuid().optional(),
16948
16992
  dry_run: external_exports.boolean().optional().default(true)
@@ -17495,83 +17539,86 @@ var init_chunk_B6PT7ZSX = __esm({
17495
17539
  var init_contracts = __esm({
17496
17540
  "../../packages/core/dist/contracts/index.js"() {
17497
17541
  "use strict";
17542
+ init_chunk_Q7KIQHAZ();
17543
+ init_chunk_NKLVUTFO();
17498
17544
  init_chunk_Q5M4VJ4W();
17499
17545
  init_chunk_YVY2TZK2();
17500
17546
  init_chunk_VXEAR36B();
17501
17547
  init_chunk_RACEDHG6();
17502
- init_chunk_Q7KIQHAZ();
17548
+ init_chunk_HIGKBEPF();
17503
17549
  init_chunk_HA7CRZMX();
17504
17550
  init_chunk_MF2VVXBR();
17505
17551
  init_chunk_IPXBFWUU();
17506
- init_chunk_NKLVUTFO();
17552
+ init_chunk_P5GJNS5R();
17553
+ init_chunk_5VGCQRPR();
17507
17554
  init_chunk_ZC6YGHNX();
17508
- init_chunk_HIGKBEPF();
17555
+ init_chunk_5DGHIY7L();
17556
+ init_chunk_HFEOIQF4();
17509
17557
  init_chunk_IPDOHAZ5();
17510
17558
  init_chunk_PFGVH2CX();
17511
17559
  init_chunk_WE4KMHZK();
17512
- init_chunk_P5GJNS5R();
17513
- init_chunk_5VGCQRPR();
17560
+ init_chunk_ZXK6N2HN();
17514
17561
  init_chunk_Y7CFCYX4();
17515
17562
  init_chunk_MGBAXT5Y();
17516
- init_chunk_5DGHIY7L();
17517
- init_chunk_2FWVCLBC();
17563
+ init_chunk_YUZFHVB2();
17564
+ init_chunk_I3O2RACG();
17518
17565
  init_chunk_CMRECH67();
17519
17566
  init_chunk_34LE6P7E();
17520
17567
  init_chunk_FPSDNS2E();
17521
17568
  init_chunk_XPI4K6MX();
17522
17569
  init_chunk_FN7WRXIP();
17523
- init_chunk_ZXK6N2HN();
17570
+ init_chunk_SY6PLCPK();
17524
17571
  init_chunk_KMAC3O3L();
17525
- init_chunk_YUZFHVB2();
17526
- init_chunk_I3O2RACG();
17572
+ init_chunk_KSTYTQ7I();
17573
+ init_chunk_LKBSHANA();
17527
17574
  init_chunk_FMB4KA3N();
17528
17575
  init_chunk_C4HEZ7ZI();
17529
17576
  init_chunk_IR2NOSI3();
17530
17577
  init_chunk_OPETF4GS();
17531
- init_chunk_SY6PLCPK();
17578
+ init_chunk_UCYWGWQT();
17579
+ init_chunk_YULHXJ5M();
17580
+ init_chunk_V4FRPRH5();
17532
17581
  init_chunk_LWMLR2WI();
17533
17582
  init_chunk_ACGAI25T();
17534
17583
  init_chunk_MH4O3YEX();
17535
17584
  init_chunk_WEV7ZGHP();
17536
- init_chunk_KSTYTQ7I();
17537
- init_chunk_LKBSHANA();
17585
+ init_chunk_7CYHPF35();
17538
17586
  init_chunk_NETRUHZF();
17539
- init_chunk_T65A4OFV();
17540
- init_chunk_EH45EEIA();
17587
+ init_chunk_MKQRDEZT();
17588
+ init_chunk_JSPSTJH4();
17541
17589
  init_chunk_MFUQ2NQ5();
17542
17590
  init_chunk_ACXXM7PI();
17543
17591
  init_chunk_2YEGUQR7();
17544
17592
  init_chunk_SDOG6762();
17545
17593
  init_chunk_JDJ4EUOL();
17546
- init_chunk_UCYWGWQT();
17547
17594
  init_chunk_6AYIXGDT();
17548
- init_chunk_YULHXJ5M();
17549
- init_chunk_V4FRPRH5();
17550
- init_chunk_YMNHLPJB();
17551
- init_chunk_OQMCZSR4();
17595
+ init_chunk_XCWEXZQE();
17596
+ init_chunk_N6SE35OR();
17597
+ init_chunk_5THMAK2R();
17598
+ init_chunk_AIBWYEMW();
17599
+ init_chunk_SE6YMSWN();
17552
17600
  init_chunk_IGLHT6YP();
17553
- init_chunk_5XV7YVGX();
17554
- init_chunk_7CYHPF35();
17601
+ init_chunk_7ULJTQXZ();
17602
+ init_chunk_QBCR5ELA();
17555
17603
  init_chunk_YWZFB34T();
17556
17604
  init_chunk_PZPOUXJR();
17557
17605
  init_chunk_LBDH7LCG();
17558
17606
  init_chunk_4LXDRTO4();
17559
17607
  init_chunk_E4DIIOOE();
17560
- init_chunk_ZRQS7XQH();
17561
- init_chunk_QRAZ5PK7();
17562
- init_chunk_YFDHUHJA();
17563
- init_chunk_5IQXVUZZ();
17564
- init_chunk_KQSPA427();
17608
+ init_chunk_Z3SV3XTC();
17609
+ init_chunk_MVLW2KQB();
17610
+ init_chunk_GKXAUKRL();
17565
17611
  init_chunk_FOFCV4SW();
17566
- init_chunk_VHPMMK6K();
17612
+ init_chunk_EPW6REOS();
17613
+ init_chunk_KYBVSEJ2();
17567
17614
  init_chunk_NVKU5PPQ();
17568
- init_chunk_NWB4MECC();
17615
+ init_chunk_5THT3WVS();
17569
17616
  init_chunk_FECLIZTY();
17570
17617
  init_chunk_BFG4ZWR4();
17571
17618
  init_chunk_7VJ4SOFF();
17572
- init_chunk_5LACAGAY();
17573
- init_chunk_D3EP4TDU();
17619
+ init_chunk_L5KGJZQD();
17574
17620
  init_chunk_X5PZZVTS();
17621
+ init_chunk_D3EP4TDU();
17575
17622
  init_chunk_PIZTARVG();
17576
17623
  init_chunk_OMPT4ZHR();
17577
17624
  init_chunk_2PZIF56U();
@@ -17583,7 +17630,7 @@ var init_contracts = __esm({
17583
17630
  init_chunk_UAOHHCW5();
17584
17631
  init_chunk_ULQGJUXZ();
17585
17632
  init_chunk_VYINA6YP();
17586
- init_chunk_EJRDF5B6();
17633
+ init_chunk_PC3774CE();
17587
17634
  init_chunk_SOJMWM63();
17588
17635
  init_chunk_MLNQUHG5();
17589
17636
  init_chunk_5FO3GNKP();
@@ -17747,7 +17794,7 @@ var UUID_RE2, WAYAI_WORKSPACE_LAYOUT;
17747
17794
  var init_dist = __esm({
17748
17795
  "../../packages/core/dist/index.js"() {
17749
17796
  "use strict";
17750
- init_chunk_EJRDF5B6();
17797
+ init_chunk_PC3774CE();
17751
17798
  init_chunk_SOJMWM63();
17752
17799
  init_chunk_MLNQUHG5();
17753
17800
  init_chunk_5FO3GNKP();
@@ -18994,6 +19041,7 @@ var init_utils = __esm({
18994
19041
  ["admin hubs repair-knowledge-blobs", { positionals: 0, values: ["--org", "--hub"], dryRun: true }],
18995
19042
  ["admin hubs clear-wayai-host-tokens", { positionals: 0, values: ["--org", "--hub", "--id"], dryRun: true }],
18996
19043
  ["admin orgs repair-legacy-grants", { positionals: 0, values: ["--org"], dryRun: true }],
19044
+ ["admin orgs repair-credential-services", { positionals: 0, values: ["--org"], dryRun: true }],
18997
19045
  ["admin vault import", { positionals: 0, values: ["--org", "--connector", "--max-puts", "--approved"] }],
18998
19046
  ["admin vault revert", { positionals: 0, values: ["--org", "--connector"] }],
18999
19047
  ["admin vault base-dry-run", { positionals: 0, values: ["--org", "--base", "--after"] }],
@@ -19545,6 +19593,11 @@ var init_api_client = __esm({
19545
19593
  async adminRepairLegacyOrgGrants(body) {
19546
19594
  return this.request("POST", "/api/admin/organizations/repair-legacy-grants", body);
19547
19595
  }
19596
+ // Name the service of each org credential created before credentials named one, from its live links (wayai#5644).
19597
+ // Used by `wayai admin orgs repair-credential-services` (platform-admin gated).
19598
+ async adminRepairCredentialServices(body) {
19599
+ return this.request("POST", "/api/admin/organizations/repair-credential-services", body);
19600
+ }
19548
19601
  // Read the platform config (platform-admin gated). Used by every `wayai admin <gate>
19549
19602
  // status` — grep `PlatformGate` in `commands/admin.ts` for the gates it serves.
19550
19603
  async adminGetConfig() {
@@ -24011,17 +24064,17 @@ var init_hub_materializer = __esm({
24011
24064
  var init_ci = __esm({
24012
24065
  "../../packages/core/dist/contracts/ci.js"() {
24013
24066
  "use strict";
24014
- init_chunk_T65A4OFV();
24015
- init_chunk_EH45EEIA();
24067
+ init_chunk_MKQRDEZT();
24068
+ init_chunk_JSPSTJH4();
24016
24069
  init_chunk_MFUQ2NQ5();
24017
24070
  init_chunk_ACXXM7PI();
24018
24071
  init_chunk_2YEGUQR7();
24019
24072
  init_chunk_SDOG6762();
24020
24073
  init_chunk_LBDH7LCG();
24021
24074
  init_chunk_4LXDRTO4();
24022
- init_chunk_5LACAGAY();
24023
- init_chunk_D3EP4TDU();
24075
+ init_chunk_L5KGJZQD();
24024
24076
  init_chunk_X5PZZVTS();
24077
+ init_chunk_D3EP4TDU();
24025
24078
  init_chunk_PIZTARVG();
24026
24079
  init_chunk_3VHOXD5Y();
24027
24080
  init_chunk_MLNQUHG5();
@@ -39268,6 +39321,9 @@ async function adminCommand(args2) {
39268
39321
  case "repair-legacy-grants":
39269
39322
  await runRepairLegacyOrgGrants(flagArgs);
39270
39323
  return;
39324
+ case "repair-credential-services":
39325
+ await runRepairCredentialServices(flagArgs);
39326
+ return;
39271
39327
  default:
39272
39328
  printHelp2();
39273
39329
  process.exit(1);
@@ -39836,9 +39892,9 @@ async function runRepairTeamOrphans(flagArgs) {
39836
39892
  console.log(`${d.hub_id} | ${d.dangling_team_ids.join(",")} | ${d.team_users_removed}`);
39837
39893
  }
39838
39894
  }
39839
- function parseApplyTargetFlags(flagArgs, usage3) {
39895
+ function parseApplyTargetFlags(flagArgs, usage3, opts = {}) {
39840
39896
  const apply = flagArgs.includes("--apply");
39841
- const target = parseScopedTargetFlags(flagArgs.filter((arg) => arg !== "--apply"), usage3);
39897
+ const target = parseScopedTargetFlags(flagArgs.filter((arg) => arg !== "--apply"), usage3, opts);
39842
39898
  if (apply && target.dryRun) {
39843
39899
  console.error("--apply and --dry-run contradict each other: a run is a dry run unless --apply is given.");
39844
39900
  console.error(usage3);
@@ -40406,6 +40462,51 @@ async function runRepairLegacyOrgGrants(flagArgs) {
40406
40462
  console.log(`${d.org_id} | ${d.user_email} | ${d.action} | ${d.user_id ?? "-"} | ${d.reason ?? "-"}`);
40407
40463
  }
40408
40464
  }
40465
+ async function runRepairCredentialServices(flagArgs) {
40466
+ const USAGE8 = "wayai admin orgs repair-credential-services --all | --org <org_id> [--apply] [--yes] [--json]";
40467
+ const scoped = parseApplyTargetFlags(flagArgs, USAGE8, { scopes: ["all", "org"], allLabel: "ALL organizations (platform-wide)" });
40468
+ const { targetLabel, apply, yes, jsonOutput } = scoped;
40469
+ const body = scoped.body.scope === "org" ? { scope: "org", org_id: scoped.body.org_id, dry_run: !apply } : { scope: "all", dry_run: !apply };
40470
+ if (apply && !yes && !jsonOutput) {
40471
+ console.log(`About to NAME the service of unnamed org credentials in: ${targetLabel}.`);
40472
+ console.log("A named credential links only to connections of that service, for its life. Run without --apply first to see each one.");
40473
+ const ok = await confirm("Proceed?");
40474
+ if (!ok) {
40475
+ console.log("Aborted.");
40476
+ return;
40477
+ }
40478
+ }
40479
+ const { config, accessToken } = await requireAuth();
40480
+ const client = new ApiClient({ apiUrl: config.api_url, accessToken });
40481
+ let response;
40482
+ try {
40483
+ response = await client.adminRepairCredentialServices(body);
40484
+ } catch (err) {
40485
+ exitOnApiError(err);
40486
+ throw err;
40487
+ }
40488
+ const data = response.data;
40489
+ if (jsonOutput) {
40490
+ console.log(JSON.stringify(data, null, 2));
40491
+ return;
40492
+ }
40493
+ const mode = data.dry_run ? "DRY RUN \u2014 nothing written" : "written";
40494
+ console.log(
40495
+ `repair-credential-services (${data.scope}) \u2014 ${mode}: orgs_scanned=${data.orgs_scanned} named=${data.named} would_name=${data.would_name} skipped=${data.skipped} failed=${data.failed}`
40496
+ );
40497
+ if (data.orgs_errored > 0 || data.failed > 0) {
40498
+ console.log(`WARNING: ${data.orgs_errored} org(s) could not be read and ${data.failed} write(s) failed \u2014 re-run to cover them.`);
40499
+ }
40500
+ if (data.results.length === 0) {
40501
+ console.log("(no unnamed API Key or Bearer Token org credentials in scope)");
40502
+ return;
40503
+ }
40504
+ for (const r of data.results) {
40505
+ const service = r.connector_id ? ` ${r.connector_name ?? r.connector_id} (${r.connector_id})` : "";
40506
+ const reason2 = r.reason ? ` (${r.reason})` : "";
40507
+ console.log(` org=${r.org_id} credential=${r.credential_id} ${r.credential_type}: ${r.outcome}${service}${reason2} linked=[${r.linked_connector_ids.join(", ")}]`);
40508
+ }
40509
+ }
40409
40510
  async function runHarnessMassDestroy(flagArgs) {
40410
40511
  const USAGE8 = "wayai admin harness mass-destroy --all | --org <org_id> | --hub <hub_id> [--dry-run] [--yes] [--json]";
40411
40512
  const { body, targetLabel, dryRun, yes, jsonOutput } = parseScopedTargetFlags(flagArgs, USAGE8);
@@ -41582,6 +41683,9 @@ Usage:
41582
41683
  wayai admin orgs repair-legacy-grants --all | --org <org_id> [--dry-run] [--yes] [--json]
41583
41684
  Repair org-admin roster rows keyed by email with a NULL user_email (pre-#3922 platform-admin adds): grant the real access they never conferred, or drop the phantom seat. Idempotent \u2014 run --dry-run first
41584
41685
 
41686
+ wayai admin orgs repair-credential-services --all | --org <org_id> [--apply] [--yes] [--json]
41687
+ Name the service of each API Key or Bearer Token org credential created before credentials named one, from its live links (#5644), so a push can pick it again; a credential whose links show no one service, or of a service another credential is already named for, is left unnamed with its reason. A dry run by default; --apply writes. Idempotent
41688
+
41585
41689
  wayai admin vault import --org <org_id> --connector <connector_id> [--max-puts <n>] [--approved <dry-run.json>] [--apply] [--yes] [--json]
41586
41690
  Move one org's stored credentials of one connector into the credentials vault, no re-entry (#5644). A dry run by default (counts by field, link kind and form); --apply needs the connector's gate open, puts each distinct value once for the direct rows holding it, moves each org credential with the rows it supplies when all of them may move (else names why it stays), and keeps the old ciphertext 30 days for revert. Re-run until values_remaining and credentials_remaining are 0. Lists Telegram bots to enable again. WhatsApp and Instagram: trims each token as a send does (rows counted), puts it with its expiry, and counts the legacy api_key rows that stay. REST API, External Resources, MCP Server: prints each value's derived policy or why it stays and counts the connections; --apply moves only what --approved (the reviewed dry run's --json) lists, keeping the old ciphertext 7 days
41587
41691
 
@@ -41697,7 +41801,7 @@ Sources:
41697
41801
  binding, and a seed recording none is deleted; a production row goes only once
41698
41802
  no preview maps it and nothing points at it, and a production tool pointing at
41699
41803
  it (tool:<id>, listed under the row) can be named first to free it.
41700
- orgs Org roster repair. \`repair-legacy-grants\` fixes member_grant rows the
41804
+ orgs Org repairs. \`repair-legacy-grants\` fixes member_grant rows the
41701
41805
  platform-admin org-admin add wrote before #3922: the email landed in the
41702
41806
  user_id column with user_email NULL. Auth reads UserDO, never member_grant,
41703
41807
  so the row grants NOTHING \u2014 while still counting as a seat, which refuses
@@ -41707,6 +41811,14 @@ Sources:
41707
41811
  access, or dropped when no account matches. A repaired row is a REAL grant
41708
41812
  to a real person and sends no email, so read --dry-run output as the list of
41709
41813
  people about to get access. Idempotent.
41814
+ \`repair-credential-services\` names the service of each API Key or Bearer
41815
+ Token org credential created before credentials named one (#5644), from the
41816
+ connectors of the connections it is linked to: a push links a new connection
41817
+ only to a credential named for its service. A credential linked to more than
41818
+ one service, to none, to a REST API, External Resources, MCP Server or Base
41819
+ Toolset connection, or into a base, or of a service another credential is
41820
+ already named for, stays unnamed with its reason. It reports by default and
41821
+ writes only with --apply.
41710
41822
 
41711
41823
  harness Incident response for harness agents. \`disable\`/\`enable\` flip the single
41712
41824
  PLATFORM-wide harness_enabled flag; \`status\` prints it. That one flag both
@@ -41775,6 +41887,8 @@ Examples:
41775
41887
  wayai admin hubs clear-wayai-host-tokens --org <org-id> --id toolset:<connection-id> --id credential:<credential-id> --apply
41776
41888
  wayai admin orgs repair-legacy-grants --all --dry-run
41777
41889
  wayai admin orgs repair-legacy-grants --org <org-id> --yes
41890
+ wayai admin orgs repair-credential-services --all
41891
+ wayai admin orgs repair-credential-services --org <org-id> --apply
41778
41892
  wayai admin harness disable
41779
41893
  wayai admin harness mass-destroy --all --dry-run
41780
41894
  wayai admin harness mass-destroy --hub <hub-id> --yes