@wayai/cli 0.3.284 → 0.3.285

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -4888,6 +4888,85 @@ var init_fs_safety = __esm({
4888
4888
  }
4889
4889
  });
4890
4890
 
4891
+ // ../../packages/core/dist/chunk-Q7KIQHAZ.js
4892
+ var initialValueCreateSchema, initialValueUpdateSchema, stateIdParam, listStatesQuery, stateNameSchema, createStateBody, updateStateBody, reorderStatesBody;
4893
+ var init_chunk_Q7KIQHAZ = __esm({
4894
+ "../../packages/core/dist/chunk-Q7KIQHAZ.js"() {
4895
+ "use strict";
4896
+ init_chunk_6TSQ5HXC();
4897
+ init_zod();
4898
+ initialValueCreateSchema = external_exports.record(external_exports.unknown()).nullish().transform((v) => v && Object.keys(v).length > 0 ? v : null);
4899
+ initialValueUpdateSchema = external_exports.record(external_exports.unknown()).nullish().transform((v) => v === void 0 ? void 0 : v && Object.keys(v).length > 0 ? v : null);
4900
+ stateIdParam = external_exports.object({
4901
+ id: external_exports.string().uuid()
4902
+ });
4903
+ listStatesQuery = external_exports.object({
4904
+ hub_id: external_exports.string().uuid()
4905
+ });
4906
+ stateNameSchema = external_exports.string().min(1, "state_name is required").max(100, "state_name must be 100 characters or fewer").refine((v) => visibleLength(v) > 0, "state_name must not be blank");
4907
+ createStateBody = external_exports.object({
4908
+ hub_id: external_exports.string().uuid(),
4909
+ state_slug: slugSchema,
4910
+ state_name: stateNameSchema,
4911
+ state_scope: external_exports.enum(["conversation", "user"]),
4912
+ state_description: external_exports.string().max(1e3).nullish(),
4913
+ json_schema: external_exports.record(external_exports.unknown()).default({}),
4914
+ initial_value: initialValueCreateSchema,
4915
+ display_order: external_exports.number().int().nonnegative().optional(),
4916
+ is_enabled: external_exports.boolean().default(true),
4917
+ inject_in_last_message: external_exports.boolean().default(true)
4918
+ });
4919
+ updateStateBody = external_exports.object({
4920
+ // state_slug is immutable after first persist — not accepted here.
4921
+ state_name: stateNameSchema.optional(),
4922
+ state_scope: external_exports.enum(["conversation", "user"]).optional(),
4923
+ state_description: external_exports.string().max(1e3).nullish(),
4924
+ json_schema: external_exports.record(external_exports.unknown()).optional(),
4925
+ initial_value: initialValueUpdateSchema,
4926
+ display_order: external_exports.number().int().nonnegative().optional(),
4927
+ is_enabled: external_exports.boolean().optional(),
4928
+ inject_in_last_message: external_exports.boolean().optional()
4929
+ });
4930
+ reorderStatesBody = external_exports.object({
4931
+ states: external_exports.array(external_exports.object({
4932
+ state_id: external_exports.string().uuid(),
4933
+ display_order: external_exports.number().int().nonnegative()
4934
+ })).min(1)
4935
+ });
4936
+ }
4937
+ });
4938
+
4939
+ // ../../packages/core/dist/chunk-NKLVUTFO.js
4940
+ var BASE_CREDENTIAL_MANAGED_BY, BASE_CREDENTIAL_NAME_MAX, BASE_CREDENTIAL_NAME_PATTERN, BASE_CREDENTIAL_NAME_CHARSET, baseCredentialNameSchema, createBaseCredentialLinkBody, baseCredentialLinkParams, baseCredentialLinkQuery;
4941
+ var init_chunk_NKLVUTFO = __esm({
4942
+ "../../packages/core/dist/chunk-NKLVUTFO.js"() {
4943
+ "use strict";
4944
+ init_zod();
4945
+ BASE_CREDENTIAL_MANAGED_BY = {
4946
+ DIRECT: "direct",
4947
+ ORG_LINK: "org-link"
4948
+ };
4949
+ BASE_CREDENTIAL_NAME_MAX = 100;
4950
+ BASE_CREDENTIAL_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:@+~=-]*$/;
4951
+ BASE_CREDENTIAL_NAME_CHARSET = "letters, digits and '. _ : @ + ~ = -', starting with a letter or digit";
4952
+ baseCredentialNameSchema = external_exports.string().min(1).max(BASE_CREDENTIAL_NAME_MAX).regex(BASE_CREDENTIAL_NAME_PATTERN, `name must use ${BASE_CREDENTIAL_NAME_CHARSET}`);
4953
+ createBaseCredentialLinkBody = external_exports.object({
4954
+ organization_id: external_exports.string().uuid(),
4955
+ base_id: external_exports.string().min(1),
4956
+ /** Defaults to a slug derived from the credential's display name. */
4957
+ name: baseCredentialNameSchema.optional()
4958
+ });
4959
+ baseCredentialLinkParams = external_exports.object({
4960
+ id: external_exports.string().uuid(),
4961
+ base_credential_id: external_exports.string().min(1)
4962
+ });
4963
+ baseCredentialLinkQuery = external_exports.object({
4964
+ organization_id: external_exports.string().uuid(),
4965
+ base_id: external_exports.string().min(1)
4966
+ });
4967
+ }
4968
+ });
4969
+
4891
4970
  // ../../packages/core/dist/chunk-HZ6CADSY.js
4892
4971
  function optionalTrimmedText(max) {
4893
4972
  return external_exports.string().trim().max(max).optional().transform((value) => value ? value : void 0);
@@ -5368,50 +5447,15 @@ var init_chunk_RACEDHG6 = __esm({
5368
5447
  }
5369
5448
  });
5370
5449
 
5371
- // ../../packages/core/dist/chunk-Q7KIQHAZ.js
5372
- var initialValueCreateSchema, initialValueUpdateSchema, stateIdParam, listStatesQuery, stateNameSchema, createStateBody, updateStateBody, reorderStatesBody;
5373
- var init_chunk_Q7KIQHAZ = __esm({
5374
- "../../packages/core/dist/chunk-Q7KIQHAZ.js"() {
5450
+ // ../../packages/core/dist/chunk-HIGKBEPF.js
5451
+ var accessExplainQuery;
5452
+ var init_chunk_HIGKBEPF = __esm({
5453
+ "../../packages/core/dist/chunk-HIGKBEPF.js"() {
5375
5454
  "use strict";
5376
- init_chunk_6TSQ5HXC();
5455
+ init_chunk_HZ6CADSY();
5377
5456
  init_zod();
5378
- initialValueCreateSchema = external_exports.record(external_exports.unknown()).nullish().transform((v) => v && Object.keys(v).length > 0 ? v : null);
5379
- initialValueUpdateSchema = external_exports.record(external_exports.unknown()).nullish().transform((v) => v === void 0 ? void 0 : v && Object.keys(v).length > 0 ? v : null);
5380
- stateIdParam = external_exports.object({
5381
- id: external_exports.string().uuid()
5382
- });
5383
- listStatesQuery = external_exports.object({
5384
- hub_id: external_exports.string().uuid()
5385
- });
5386
- stateNameSchema = external_exports.string().min(1, "state_name is required").max(100, "state_name must be 100 characters or fewer").refine((v) => visibleLength(v) > 0, "state_name must not be blank");
5387
- createStateBody = external_exports.object({
5388
- hub_id: external_exports.string().uuid(),
5389
- state_slug: slugSchema,
5390
- state_name: stateNameSchema,
5391
- state_scope: external_exports.enum(["conversation", "user"]),
5392
- state_description: external_exports.string().max(1e3).nullish(),
5393
- json_schema: external_exports.record(external_exports.unknown()).default({}),
5394
- initial_value: initialValueCreateSchema,
5395
- display_order: external_exports.number().int().nonnegative().optional(),
5396
- is_enabled: external_exports.boolean().default(true),
5397
- inject_in_last_message: external_exports.boolean().default(true)
5398
- });
5399
- updateStateBody = external_exports.object({
5400
- // state_slug is immutable after first persist — not accepted here.
5401
- state_name: stateNameSchema.optional(),
5402
- state_scope: external_exports.enum(["conversation", "user"]).optional(),
5403
- state_description: external_exports.string().max(1e3).nullish(),
5404
- json_schema: external_exports.record(external_exports.unknown()).optional(),
5405
- initial_value: initialValueUpdateSchema,
5406
- display_order: external_exports.number().int().nonnegative().optional(),
5407
- is_enabled: external_exports.boolean().optional(),
5408
- inject_in_last_message: external_exports.boolean().optional()
5409
- });
5410
- reorderStatesBody = external_exports.object({
5411
- states: external_exports.array(external_exports.object({
5412
- state_id: external_exports.string().uuid(),
5413
- display_order: external_exports.number().int().nonnegative()
5414
- })).min(1)
5457
+ accessExplainQuery = external_exports.object({
5458
+ user_id: external_exports.string().regex(USER_ID_REGEX).optional()
5415
5459
  });
5416
5460
  }
5417
5461
  });
@@ -5567,34 +5611,68 @@ var init_chunk_IPXBFWUU = __esm({
5567
5611
  }
5568
5612
  });
5569
5613
 
5570
- // ../../packages/core/dist/chunk-NKLVUTFO.js
5571
- var BASE_CREDENTIAL_MANAGED_BY, BASE_CREDENTIAL_NAME_MAX, BASE_CREDENTIAL_NAME_PATTERN, BASE_CREDENTIAL_NAME_CHARSET, baseCredentialNameSchema, createBaseCredentialLinkBody, baseCredentialLinkParams, baseCredentialLinkQuery;
5572
- var init_chunk_NKLVUTFO = __esm({
5573
- "../../packages/core/dist/chunk-NKLVUTFO.js"() {
5614
+ // ../../packages/core/dist/chunk-5VL6LBFD.js
5615
+ var PERMISSIONS;
5616
+ var init_chunk_5VL6LBFD = __esm({
5617
+ "../../packages/core/dist/chunk-5VL6LBFD.js"() {
5618
+ "use strict";
5619
+ PERMISSIONS = [
5620
+ "hub:read",
5621
+ "hub:write",
5622
+ "hub:admin",
5623
+ "conversation:read",
5624
+ "conversation:write",
5625
+ "analytics:read",
5626
+ "billing:read",
5627
+ "billing:write",
5628
+ "org:read",
5629
+ "org:write",
5630
+ "org:admin",
5631
+ "contacts:write",
5632
+ "platform:admin",
5633
+ "*"
5634
+ ];
5635
+ }
5636
+ });
5637
+
5638
+ // ../../packages/core/dist/chunk-VEERWOZ6.js
5639
+ var MAX_NAME_LENGTH, MAX_HUBS_PER_GRANT, MAX_HUB_TAGS_PER_GRANT, MAX_GRANTS, permissionEnum, grantScopeSchema, grantSchema, createTokenBody, tokenOrgIdParam;
5640
+ var init_chunk_VEERWOZ6 = __esm({
5641
+ "../../packages/core/dist/chunk-VEERWOZ6.js"() {
5574
5642
  "use strict";
5643
+ init_chunk_5VL6LBFD();
5644
+ init_chunk_HZ6CADSY();
5575
5645
  init_zod();
5576
- BASE_CREDENTIAL_MANAGED_BY = {
5577
- DIRECT: "direct",
5578
- ORG_LINK: "org-link"
5579
- };
5580
- BASE_CREDENTIAL_NAME_MAX = 100;
5581
- BASE_CREDENTIAL_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:@+~=-]*$/;
5582
- BASE_CREDENTIAL_NAME_CHARSET = "letters, digits and '. _ : @ + ~ = -', starting with a letter or digit";
5583
- baseCredentialNameSchema = external_exports.string().min(1).max(BASE_CREDENTIAL_NAME_MAX).regex(BASE_CREDENTIAL_NAME_PATTERN, `name must use ${BASE_CREDENTIAL_NAME_CHARSET}`);
5584
- createBaseCredentialLinkBody = external_exports.object({
5585
- organization_id: external_exports.string().uuid(),
5586
- base_id: external_exports.string().min(1),
5587
- /** Defaults to a slug derived from the credential's display name. */
5588
- name: baseCredentialNameSchema.optional()
5589
- });
5590
- baseCredentialLinkParams = external_exports.object({
5591
- id: external_exports.string().uuid(),
5592
- base_credential_id: external_exports.string().min(1)
5593
- });
5594
- baseCredentialLinkQuery = external_exports.object({
5595
- organization_id: external_exports.string().uuid(),
5596
- base_id: external_exports.string().min(1)
5646
+ MAX_NAME_LENGTH = 100;
5647
+ MAX_HUBS_PER_GRANT = 50;
5648
+ MAX_HUB_TAGS_PER_GRANT = 20;
5649
+ MAX_GRANTS = 20;
5650
+ permissionEnum = external_exports.enum(PERMISSIONS).refine(
5651
+ (p) => p !== "platform:admin",
5652
+ { message: "platform:admin cannot be delegated via token creation" }
5653
+ );
5654
+ grantScopeSchema = external_exports.object({
5655
+ // Required: every token grant must declare its org tenancy. The handler
5656
+ // also strict-checks this as defense-in-depth, but failing at the Zod
5657
+ // boundary keeps the generated client type honest (org_id: string).
5658
+ org_id: external_exports.string().min(1),
5659
+ hubs: external_exports.array(external_exports.string().min(1)).min(1, "Each grant must have scope.hubs as a non-empty array").max(MAX_HUBS_PER_GRANT),
5660
+ hub_tags: external_exports.array(external_exports.string().min(1)).min(1, "scope.hub_tags must be a non-empty array if provided").max(MAX_HUB_TAGS_PER_GRANT).optional(),
5661
+ environments: external_exports.array(external_exports.enum(["production", "preview"])).min(1, "scope.environments must be a non-empty array if provided").optional()
5662
+ }).strict();
5663
+ grantSchema = external_exports.object({
5664
+ scope: grantScopeSchema,
5665
+ permissions: external_exports.array(permissionEnum).min(1, "Each grant must have permissions as a non-empty array")
5666
+ }).strict();
5667
+ createTokenBody = external_exports.object({
5668
+ name: external_exports.string().trim().min(1, "name is required").max(MAX_NAME_LENGTH, `name must be ${MAX_NAME_LENGTH} characters or fewer`),
5669
+ grants: external_exports.array(grantSchema).min(1, "grants must be a non-empty array").max(MAX_GRANTS),
5670
+ expires_at: external_exports.string().datetime({ message: "expires_at must be a valid ISO 8601 date" }).refine(
5671
+ (s) => new Date(s).getTime() > Date.now(),
5672
+ { message: "expires_at must be in the future" }
5673
+ ).optional()
5597
5674
  });
5675
+ tokenOrgIdParam = external_exports.object({ orgId: uuidSchema });
5598
5676
  }
5599
5677
  });
5600
5678
 
@@ -6150,19 +6228,6 @@ var init_chunk_ZC6YGHNX = __esm({
6150
6228
  }
6151
6229
  });
6152
6230
 
6153
- // ../../packages/core/dist/chunk-HIGKBEPF.js
6154
- var accessExplainQuery;
6155
- var init_chunk_HIGKBEPF = __esm({
6156
- "../../packages/core/dist/chunk-HIGKBEPF.js"() {
6157
- "use strict";
6158
- init_chunk_HZ6CADSY();
6159
- init_zod();
6160
- accessExplainQuery = external_exports.object({
6161
- user_id: external_exports.string().regex(USER_ID_REGEX).optional()
6162
- });
6163
- }
6164
- });
6165
-
6166
6231
  // ../../packages/core/dist/chunk-5DGHIY7L.js
6167
6232
  var rekorBaseChangeMessageSchema;
6168
6233
  var init_chunk_5DGHIY7L = __esm({
@@ -6945,207 +7010,544 @@ var init_chunk_GPM7PE44 = __esm({
6945
7010
  }
6946
7011
  });
6947
7012
 
6948
- // ../../packages/core/dist/chunk-5VL6LBFD.js
6949
- var PERMISSIONS;
6950
- var init_chunk_5VL6LBFD = __esm({
6951
- "../../packages/core/dist/chunk-5VL6LBFD.js"() {
6952
- "use strict";
6953
- PERMISSIONS = [
6954
- "hub:read",
6955
- "hub:write",
6956
- "hub:admin",
6957
- "conversation:read",
6958
- "conversation:write",
6959
- "analytics:read",
6960
- "billing:read",
6961
- "billing:write",
6962
- "org:read",
6963
- "org:write",
6964
- "org:admin",
6965
- "contacts:write",
6966
- "platform:admin",
6967
- "*"
6968
- ];
7013
+ // ../../packages/core/dist/chunk-WEXVYJ5H.js
7014
+ function containsKanbanPlaceholders(value) {
7015
+ if (value == null) return false;
7016
+ const serialized = typeof value === "string" ? value : JSON.stringify(value);
7017
+ for (const token of PLACEHOLDER_TOKENS) {
7018
+ if (serialized.includes(token)) return true;
6969
7019
  }
6970
- });
6971
-
6972
- // ../../packages/core/dist/chunk-VEERWOZ6.js
6973
- var MAX_NAME_LENGTH, MAX_HUBS_PER_GRANT, MAX_HUB_TAGS_PER_GRANT, MAX_GRANTS, permissionEnum, grantScopeSchema, grantSchema, createTokenBody, tokenOrgIdParam;
6974
- var init_chunk_VEERWOZ6 = __esm({
6975
- "../../packages/core/dist/chunk-VEERWOZ6.js"() {
6976
- "use strict";
6977
- init_chunk_5VL6LBFD();
6978
- init_chunk_HZ6CADSY();
6979
- init_zod();
6980
- MAX_NAME_LENGTH = 100;
6981
- MAX_HUBS_PER_GRANT = 50;
6982
- MAX_HUB_TAGS_PER_GRANT = 20;
6983
- MAX_GRANTS = 20;
6984
- permissionEnum = external_exports.enum(PERMISSIONS).refine(
6985
- (p) => p !== "platform:admin",
6986
- { message: "platform:admin cannot be delegated via token creation" }
6987
- );
6988
- grantScopeSchema = external_exports.object({
6989
- // Required: every token grant must declare its org tenancy. The handler
6990
- // also strict-checks this as defense-in-depth, but failing at the Zod
6991
- // boundary keeps the generated client type honest (org_id: string).
6992
- org_id: external_exports.string().min(1),
6993
- hubs: external_exports.array(external_exports.string().min(1)).min(1, "Each grant must have scope.hubs as a non-empty array").max(MAX_HUBS_PER_GRANT),
6994
- hub_tags: external_exports.array(external_exports.string().min(1)).min(1, "scope.hub_tags must be a non-empty array if provided").max(MAX_HUB_TAGS_PER_GRANT).optional(),
6995
- environments: external_exports.array(external_exports.enum(["production", "preview"])).min(1, "scope.environments must be a non-empty array if provided").optional()
6996
- }).strict();
6997
- grantSchema = external_exports.object({
6998
- scope: grantScopeSchema,
6999
- permissions: external_exports.array(permissionEnum).min(1, "Each grant must have permissions as a non-empty array")
7000
- }).strict();
7001
- createTokenBody = external_exports.object({
7002
- name: external_exports.string().trim().min(1, "name is required").max(MAX_NAME_LENGTH, `name must be ${MAX_NAME_LENGTH} characters or fewer`),
7003
- grants: external_exports.array(grantSchema).min(1, "grants must be a non-empty array").max(MAX_GRANTS),
7004
- expires_at: external_exports.string().datetime({ message: "expires_at must be a valid ISO 8601 date" }).refine(
7005
- (s) => new Date(s).getTime() > Date.now(),
7006
- { message: "expires_at must be in the future" }
7007
- ).optional()
7008
- });
7009
- tokenOrgIdParam = external_exports.object({ orgId: uuidSchema });
7020
+ return false;
7021
+ }
7022
+ function extractToolParameters(toolConfig) {
7023
+ let cfg = toolConfig;
7024
+ if (typeof cfg === "string") {
7025
+ try {
7026
+ cfg = JSON.parse(cfg);
7027
+ } catch {
7028
+ return void 0;
7029
+ }
7010
7030
  }
7011
- });
7012
-
7013
- // ../../packages/core/dist/chunk-ZVXO3XL6.js
7014
- var PEOPLE_CONTACT_PAGE_MAX, PEOPLE_CONTACT_PAGE_DEFAULT, PEOPLE_CONTACT_EMAIL_MAX_LENGTH, peopleUserIdSchema, peopleInviteEmailSchema, peopleContactInviteBody, peopleContactInviteIdParam, peopleContactUserIdParam, peopleContactBlockBody, peopleContactPageQuery, peopleOutgoingInviteSchema, peopleContactPersonSchema, peopleContactSchema, peopleIncomingInviteSchema, peopleBlockedUserSchema;
7015
- var init_chunk_ZVXO3XL6 = __esm({
7016
- "../../packages/core/dist/chunk-ZVXO3XL6.js"() {
7017
- "use strict";
7018
- init_chunk_HZ6CADSY();
7019
- init_zod();
7020
- PEOPLE_CONTACT_PAGE_MAX = 100;
7021
- PEOPLE_CONTACT_PAGE_DEFAULT = 50;
7022
- PEOPLE_CONTACT_EMAIL_MAX_LENGTH = 254;
7023
- peopleUserIdSchema = external_exports.string().max(64).regex(USER_ID_REGEX, "must be a user id");
7024
- peopleInviteEmailSchema = external_exports.string().trim().max(PEOPLE_CONTACT_EMAIL_MAX_LENGTH).email();
7025
- peopleContactInviteBody = external_exports.object({
7026
- email: peopleInviteEmailSchema
7027
- }).strict();
7028
- peopleContactInviteIdParam = external_exports.object({ inviteId: uuidSchema });
7029
- peopleContactUserIdParam = external_exports.object({ userId: peopleUserIdSchema });
7030
- peopleContactBlockBody = external_exports.object({ user_id: peopleUserIdSchema, thread_id: uuidSchema.optional(), community_id: uuidSchema.optional() }).strict().refine((body) => body.thread_id === void 0 || body.community_id === void 0, {
7031
- message: "Name a thread or a community, not both",
7032
- path: ["community_id"]
7031
+ if (!cfg || typeof cfg !== "object" || Array.isArray(cfg)) return void 0;
7032
+ return cfg.parameters;
7033
+ }
7034
+ function isRecord(v) {
7035
+ return typeof v === "object" && v !== null && !Array.isArray(v);
7036
+ }
7037
+ function isPrimitive(v) {
7038
+ return v === null || ["string", "number", "boolean"].includes(typeof v);
7039
+ }
7040
+ function typeMatches(typeField, allowed) {
7041
+ if (typeof typeField === "string") return allowed.has(typeField);
7042
+ if (Array.isArray(typeField)) return typeField.every((t) => typeof t === "string" && allowed.has(t));
7043
+ return false;
7044
+ }
7045
+ function validateSchema(schema, path45, errors, opts = {}) {
7046
+ if (typeof schema === "boolean") return;
7047
+ const depth = opts.depth ?? 0;
7048
+ if (depth > MAX_SCHEMA_DEPTH) {
7049
+ errors.push({
7050
+ path: path45 || "<root>",
7051
+ message: `schema nesting exceeds ${MAX_SCHEMA_DEPTH} levels`,
7052
+ suggestion: "Flatten the schema; LLM providers reject deeply nested tool input_schemas."
7033
7053
  });
7034
- peopleContactPageQuery = external_exports.object({
7035
- cursor: external_exports.string().min(1).max(256).optional(),
7036
- limit: external_exports.coerce.number().int().min(1).max(PEOPLE_CONTACT_PAGE_MAX).default(PEOPLE_CONTACT_PAGE_DEFAULT)
7054
+ return;
7055
+ }
7056
+ if (!isRecord(schema)) {
7057
+ errors.push({
7058
+ path: path45,
7059
+ message: `expected object, got ${schema === null ? "null" : typeof schema}`
7037
7060
  });
7038
- peopleOutgoingInviteSchema = external_exports.object({
7039
- invite_id: uuidSchema,
7040
- email: external_exports.string(),
7041
- status: external_exports.literal("sent"),
7042
- created_at: timestampSchema,
7043
- expires_at: timestampSchema
7044
- }).strict();
7045
- peopleContactPersonSchema = external_exports.object({
7046
- user_id: peopleUserIdSchema,
7047
- display_name: external_exports.string().nullable(),
7048
- email: external_exports.string().nullable()
7049
- }).strict();
7050
- peopleContactSchema = peopleContactPersonSchema.extend({ contact_since: timestampSchema, thread_id: uuidSchema }).strict();
7051
- peopleIncomingInviteSchema = external_exports.object({
7052
- invite_id: uuidSchema,
7053
- inviter: peopleContactPersonSchema,
7054
- created_at: timestampSchema,
7055
- expires_at: timestampSchema
7056
- }).strict();
7057
- peopleBlockedUserSchema = peopleContactPersonSchema.extend({ blocked_at: timestampSchema, deleted_user: external_exports.boolean() }).strict();
7061
+ return;
7058
7062
  }
7059
- });
7060
-
7061
- // ../../packages/core/dist/chunk-ZXK6N2HN.js
7062
- var PEOPLE_MODERATION_NOTE_MAX_LENGTH, ADMIN_PEOPLE_REPORTS_PAGE_MAX, ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT, PEOPLE_SUSPENDED_REASON, peopleModerationActionSchema, moderationNoteSchema, adminPeopleReportListQuery, adminPeopleReportIdParam, adminPeopleMessageRemovalBody, adminPeopleSuspendBody, adminPeopleNoteBody;
7063
- var init_chunk_ZXK6N2HN = __esm({
7064
- "../../packages/core/dist/chunk-ZXK6N2HN.js"() {
7065
- "use strict";
7066
- init_chunk_ZVXO3XL6();
7067
- init_chunk_HZ6CADSY();
7068
- init_zod();
7069
- PEOPLE_MODERATION_NOTE_MAX_LENGTH = 500;
7070
- ADMIN_PEOPLE_REPORTS_PAGE_MAX = 100;
7071
- ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT = 50;
7072
- PEOPLE_SUSPENDED_REASON = "suspended";
7073
- peopleModerationActionSchema = external_exports.enum(["remove_message", "suspend", "unsuspend", "dismiss"]);
7074
- moderationNoteSchema = optionalTrimmedText(PEOPLE_MODERATION_NOTE_MAX_LENGTH);
7075
- adminPeopleReportListQuery = external_exports.object({
7076
- pending: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true"),
7077
- /** Lower bound on `created_at`. */
7078
- since: timestampSchema.optional(),
7079
- limit: external_exports.coerce.number().int().min(1).max(ADMIN_PEOPLE_REPORTS_PAGE_MAX).default(ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT),
7080
- offset: external_exports.coerce.number().int().min(0).default(0)
7063
+ if (opts.isRoot) {
7064
+ if ("type" in schema && schema.type !== "object") {
7065
+ errors.push({
7066
+ path: path45 ? `${path45}.type` : "type",
7067
+ message: `root type must be 'object', got ${JSON.stringify(schema.type)}`,
7068
+ suggestion: "Tool parameters at the root must be an object: `{ type: 'object', properties: { ... } }`."
7069
+ });
7070
+ }
7071
+ } else if ("type" in schema && !typeMatches(schema.type, ALLOWED_TYPES)) {
7072
+ errors.push({
7073
+ path: `${path45}.type`,
7074
+ message: `type must be one of ${[...ALLOWED_TYPES].join("/")} or an array of those, got ${JSON.stringify(schema.type)}`
7081
7075
  });
7082
- adminPeopleReportIdParam = external_exports.object({ reportId: uuidSchema });
7083
- adminPeopleMessageRemovalBody = external_exports.object({ report_id: uuidSchema, message_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
7084
- adminPeopleSuspendBody = external_exports.object({ report_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
7085
- adminPeopleNoteBody = external_exports.object({ note: moderationNoteSchema }).strict();
7086
7076
  }
7087
- });
7088
-
7089
- // ../../packages/core/dist/chunk-Y7CFCYX4.js
7090
- var PEOPLE_REPORT_DETAILS_MAX_LENGTH, peopleReportReasonSchema, reportDetailsSchema, reportFields, peopleReportBody;
7091
- var init_chunk_Y7CFCYX4 = __esm({
7092
- "../../packages/core/dist/chunk-Y7CFCYX4.js"() {
7093
- "use strict";
7094
- init_chunk_ZVXO3XL6();
7095
- init_chunk_HZ6CADSY();
7096
- init_zod();
7097
- PEOPLE_REPORT_DETAILS_MAX_LENGTH = 500;
7098
- peopleReportReasonSchema = external_exports.enum(["spam", "harassment", "hate", "sexual", "violence", "other"]);
7099
- reportDetailsSchema = optionalTrimmedText(PEOPLE_REPORT_DETAILS_MAX_LENGTH);
7100
- reportFields = { reason: peopleReportReasonSchema, details: reportDetailsSchema };
7101
- peopleReportBody = external_exports.discriminatedUnion("target", [
7102
- external_exports.object({ target: external_exports.literal("message"), thread_id: uuidSchema, message_id: uuidSchema, ...reportFields }).strict(),
7103
- external_exports.object({ target: external_exports.literal("thread"), thread_id: uuidSchema, ...reportFields }).strict(),
7104
- external_exports.object({ target: external_exports.literal("user"), user_id: peopleUserIdSchema, thread_id: uuidSchema.optional(), ...reportFields }).strict(),
7105
- external_exports.object({
7106
- target: external_exports.literal("community_message"),
7107
- community_id: uuidSchema,
7108
- room_id: uuidSchema,
7109
- message_id: uuidSchema,
7110
- ...reportFields
7111
- }).strict(),
7112
- external_exports.object({ target: external_exports.literal("community_member"), community_id: uuidSchema, user_id: peopleUserIdSchema, ...reportFields }).strict()
7113
- ]);
7077
+ if ("enum" in schema) {
7078
+ const e = schema.enum;
7079
+ if (typeof e === "string") {
7080
+ const isPlaceholder = PLACEHOLDER_TOKENS.includes(e);
7081
+ const isOutcomePlaceholder = e === "[KANBAN_OUTCOME_VALUES]";
7082
+ errors.push({
7083
+ path: `${path45}.enum`,
7084
+ message: `enum must be a non-empty array of primitives, got string ${JSON.stringify(e)}`,
7085
+ suggestion: isOutcomePlaceholder ? "Declare `outcomes` on the hub's terminal kanban status so the platform can render the placeholder into a valid array; with none configured the platform drops the parameter instead." : isPlaceholder ? "Set `operation: 'update_kanban_status'` on the tool and ensure at least one hub.kanban_status has `allowsAgentUpdate: true` so the platform can render the placeholder into a valid array." : 'Wrap the value in an array: `enum: ["value"]`.'
7086
+ });
7087
+ } else if (!Array.isArray(e)) {
7088
+ errors.push({
7089
+ path: `${path45}.enum`,
7090
+ message: `enum must be a non-empty array of primitives, got ${typeof e}`
7091
+ });
7092
+ } else if (e.length === 0) {
7093
+ errors.push({
7094
+ path: `${path45}.enum`,
7095
+ message: "enum must not be empty"
7096
+ });
7097
+ } else {
7098
+ for (let i = 0; i < e.length; i++) {
7099
+ if (!isPrimitive(e[i])) {
7100
+ errors.push({
7101
+ path: `${path45}.enum[${i}]`,
7102
+ message: `enum entry must be a primitive (string/number/boolean/null), got ${typeof e[i]}`
7103
+ });
7104
+ }
7105
+ }
7106
+ }
7114
7107
  }
7115
- });
7116
-
7117
- // ../../packages/core/dist/chunk-2YEGUQR7.js
7118
- var PERSON_ID_PATTERN, CONTACT_PERSON_ID_PATTERN, PERSON_ID_FORM_MESSAGE, userPersonIdSchema, personIdSchema;
7119
- var init_chunk_2YEGUQR7 = __esm({
7120
- "../../packages/core/dist/chunk-2YEGUQR7.js"() {
7121
- "use strict";
7122
- init_zod();
7123
- PERSON_ID_PATTERN = /^prs_[a-z2-7]{52}$/;
7124
- CONTACT_PERSON_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
7125
- PERSON_ID_FORM_MESSAGE = "Must be a person id (prs_\u2026) or a contact id (a lowercase UUID)";
7126
- userPersonIdSchema = external_exports.string().regex(PERSON_ID_PATTERN, { message: "Must be a person id (prs_\u2026)" });
7127
- personIdSchema = external_exports.string().refine(
7128
- (value) => PERSON_ID_PATTERN.test(value) || CONTACT_PERSON_ID_PATTERN.test(value),
7129
- { message: PERSON_ID_FORM_MESSAGE }
7130
- );
7108
+ for (const key of ["exclusiveMinimum", "exclusiveMaximum"]) {
7109
+ if (key in schema && typeof schema[key] === "boolean") {
7110
+ errors.push({
7111
+ path: `${path45}.${key}`,
7112
+ message: `${key} as boolean is draft-04 syntax; draft 2020-12 requires a numeric value`,
7113
+ suggestion: `Replace with the numeric bound, e.g. \`${key}: 0\`.`
7114
+ });
7115
+ }
7131
7116
  }
7132
- });
7133
-
7134
- // ../../packages/core/dist/chunk-UAOHHCW5.js
7135
- function normalizeContactPhone(raw) {
7136
- const compact = raw.trim().replace(/[\s\-.()]/g, "");
7137
- const withPlus = compact.startsWith("00") ? `+${compact.slice(2)}` : compact;
7138
- return /^\+[1-9]\d{7,14}$/.test(withPlus) ? withPlus : null;
7139
- }
7140
- function normalizeContactLabel(raw) {
7141
- return raw.trim().replace(/\s+/g, " ").toLowerCase();
7142
- }
7143
- function importRowLabels(row, batchLabels) {
7144
- return [.../* @__PURE__ */ new Set([...row.labels ?? [], ...batchLabels ?? []])];
7145
- }
7146
- var CONTACT_ENVIRONMENTS, CONTACT_NAME_MAX, CONTACT_EMAIL_MAX, CONTACT_PHONE_INPUT_MAX, CONTACT_INSTAGRAM_SID_MAX, CONTACT_METADATA_MAX_BYTES, CONTACT_LABEL_MAX, CONTACT_LABELS_MAX, CONTACT_SCOPE_TAGS_MAX, CONTACT_PAGE_MAX, CONTACT_IMPORT_BATCH_MAX, CONTACT_SEARCH_MAX, CONTACT_LIST_NAME_MAX, CONTACT_LIST_NAME_REGEX, CONTACT_LIST_DESCRIPTION_MAX, CONTACT_LIST_FILTER_MAX, CONTACT_LIST_PINS_PER_REQUEST_MAX, SUPPRESSION_SCOPES, SUPPRESSION_ID_REGEX, contactName, contactPhone, contactEmail, contactInstagramSid, contactLabel, contactLabels, contactMetadata, scopeTagIds, contactVisibilitySchema, hasIdentity, IDENTITY_REQUIRED, contactBookOrgQuery, contactBookContactParam, contactBookListParam, contactBookHubParam, contactBookPageQuery, listContactBookContactsQuery, listHubContactBookContactsQuery, contactBookLinkCandidatesQuery, listContactBookListMembersQuery, contactRowFields, createContactBookContactBody, updateContactBookContactBody, contactImportRowSchema, importContactBookContactsBody, linkContactBookContactBody, listName, contactListFilterSchema, createContactBookListBody, updateContactBookListBody, updateContactBookListPinsBody, suppressionIdentitySchema, createContactBookSuppressionBody, contactBookSuppressionParam, listContactBookSuppressionsQuery, contactBookEmailUnsubscribeTokenSchema, contactBookEmailUnsubscribeQuery, orgListReferenceSchema;
7147
- var init_chunk_UAOHHCW5 = __esm({
7148
- "../../packages/core/dist/chunk-UAOHHCW5.js"() {
7117
+ if ("properties" in schema) {
7118
+ if (!isRecord(schema.properties)) {
7119
+ errors.push({
7120
+ path: `${path45}.properties`,
7121
+ message: `properties must be an object, got ${Array.isArray(schema.properties) ? "array" : typeof schema.properties}`
7122
+ });
7123
+ } else {
7124
+ for (const [propName, propSchema] of Object.entries(schema.properties)) {
7125
+ validateSchema(propSchema, `${path45}.properties.${propName}`, errors, { depth: depth + 1 });
7126
+ }
7127
+ }
7128
+ }
7129
+ if (schemaTypeIncludes(schema, "array") && "items" in schema) {
7130
+ if (Array.isArray(schema.items)) {
7131
+ schema.items.forEach((sub, i) => validateSchema(sub, `${path45}.items[${i}]`, errors, { depth: depth + 1 }));
7132
+ } else {
7133
+ validateSchema(schema.items, `${path45}.items`, errors, { depth: depth + 1 });
7134
+ }
7135
+ }
7136
+ for (const key of SUBSCHEMA_OBJECT_KEYWORDS) {
7137
+ if (key in schema && isRecord(schema[key])) {
7138
+ validateSchema(schema[key], `${path45}.${key}`, errors, { depth: depth + 1 });
7139
+ }
7140
+ }
7141
+ for (const key of SUBSCHEMA_LIST_KEYWORDS) {
7142
+ const list2 = schema[key];
7143
+ if (Array.isArray(list2)) {
7144
+ list2.forEach((sub, i) => validateSchema(sub, `${path45}.${key}[${i}]`, errors, { depth: depth + 1 }));
7145
+ }
7146
+ }
7147
+ for (const key of SUBSCHEMA_MAP_KEYWORDS) {
7148
+ const map = schema[key];
7149
+ if (isRecord(map)) {
7150
+ for (const [name, sub] of Object.entries(map)) {
7151
+ validateSchema(sub, `${path45}.${key}.${name}`, errors, { depth: depth + 1 });
7152
+ }
7153
+ }
7154
+ }
7155
+ const reportedPaths = new Set(errors.map((e) => e.path));
7156
+ for (const [k, v] of Object.entries(schema)) {
7157
+ if (typeof v !== "string") continue;
7158
+ const fieldPath = `${path45}.${k}`;
7159
+ if (reportedPaths.has(fieldPath)) continue;
7160
+ for (const token of PLACEHOLDER_TOKENS) {
7161
+ if (v === token) {
7162
+ errors.push({
7163
+ path: fieldPath,
7164
+ message: `unresolved placeholder ${JSON.stringify(token)}`,
7165
+ suggestion: "The platform renders this placeholder at tool-creation time. Ensure `operation: 'update_kanban_status'` is set and the hub has at least one kanban_status with `allowsAgentUpdate: true`."
7166
+ });
7167
+ }
7168
+ }
7169
+ }
7170
+ }
7171
+ function schemaTypeIncludes(schema, wanted) {
7172
+ const t = schema.type;
7173
+ if (typeof t === "string") return t === wanted;
7174
+ if (Array.isArray(t)) return t.includes(wanted);
7175
+ return false;
7176
+ }
7177
+ function validateToolInputSchema(schema) {
7178
+ const errors = [];
7179
+ if (!isRecord(schema)) {
7180
+ errors.push({
7181
+ path: "",
7182
+ message: `expected object at root, got ${schema === null ? "null" : typeof schema}`
7183
+ });
7184
+ return { ok: false, errors };
7185
+ }
7186
+ validateSchema(schema, "", errors, { isRoot: true });
7187
+ return errors.length === 0 ? { ok: true } : { ok: false, errors };
7188
+ }
7189
+ var PLACEHOLDER_TOKENS, ALLOWED_TYPES, SUBSCHEMA_OBJECT_KEYWORDS, SUBSCHEMA_LIST_KEYWORDS, SUBSCHEMA_MAP_KEYWORDS, MAX_SCHEMA_DEPTH;
7190
+ var init_chunk_WEXVYJ5H = __esm({
7191
+ "../../packages/core/dist/chunk-WEXVYJ5H.js"() {
7192
+ "use strict";
7193
+ PLACEHOLDER_TOKENS = [
7194
+ "[KANBAN_STATUS_VALUES]",
7195
+ "[KANBAN_STATUS_NAMES]",
7196
+ "[SCHEDULING_STATUS_NAMES]",
7197
+ "[STATE_SLUG_VALUES]",
7198
+ // Carried by `close_conversation` as well as `update_kanban_status`, since an
7199
+ // agent close routes through the terminal transition. Omitting them here does not
7200
+ // merely weaken a hint: `containsKanbanPlaceholders` is what lets HubDO's render
7201
+ // chokepoint recognize a template config, and its other trigger is
7202
+ // `operation === 'update_kanban_status'` — so a token missing from this list means
7203
+ // `close_conversation` is never rendered and is then rejected as malformed.
7204
+ "[KANBAN_OUTCOME_VALUES]",
7205
+ "[KANBAN_OUTCOME_NAMES]"
7206
+ ];
7207
+ ALLOWED_TYPES = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "object", "array", "null"]);
7208
+ SUBSCHEMA_OBJECT_KEYWORDS = [
7209
+ "additionalProperties",
7210
+ "unevaluatedProperties",
7211
+ "additionalItems",
7212
+ "unevaluatedItems",
7213
+ "contains",
7214
+ "propertyNames",
7215
+ "not",
7216
+ "if",
7217
+ "then",
7218
+ "else"
7219
+ ];
7220
+ SUBSCHEMA_LIST_KEYWORDS = ["allOf", "anyOf", "oneOf", "prefixItems"];
7221
+ SUBSCHEMA_MAP_KEYWORDS = ["$defs", "definitions", "patternProperties", "dependentSchemas"];
7222
+ MAX_SCHEMA_DEPTH = 20;
7223
+ }
7224
+ });
7225
+
7226
+ // ../../packages/core/dist/chunk-FBV7NLKO.js
7227
+ function utf8ByteLength(text4) {
7228
+ let bytes = 0;
7229
+ for (let i = 0; i < text4.length; i++) {
7230
+ const code = text4.charCodeAt(i);
7231
+ if (code < 128) bytes += 1;
7232
+ else if (code < 2048) bytes += 2;
7233
+ else if (code >= 55296 && code <= 56319 && i + 1 < text4.length) {
7234
+ const next = text4.charCodeAt(i + 1);
7235
+ if (next >= 56320 && next <= 57343) {
7236
+ bytes += 4;
7237
+ i += 1;
7238
+ } else {
7239
+ bytes += 3;
7240
+ }
7241
+ } else bytes += 3;
7242
+ }
7243
+ return bytes;
7244
+ }
7245
+ function pageHtmlIssue(html) {
7246
+ if (typeof html !== "string" || !/\S/.test(html)) return "a page needs its HTML: one non-empty, self-contained file";
7247
+ const bytes = utf8ByteLength(html);
7248
+ if (bytes > PAGE_HTML_MAX_BYTES) {
7249
+ return `a page's HTML is at most ${PAGE_HTML_MAX_BYTES / 1024} KiB; this one is ${Math.ceil(bytes / 1024)} KiB`;
7250
+ }
7251
+ return null;
7252
+ }
7253
+ var PAGES_PER_HUB_MAX, PAGE_HTML_MAX_BYTES, PAGE_SLUG_MAX, PAGE_SLUG_REGEX, PAGE_TITLE_MAX, PAGE_DESCRIPTION_MAX, PAGE_ORDER_MAX, PAGE_TOOLS_MAX, PAGE_CONNECTION_NAME_MAX, PAGE_TOOL_NAME_MAX, PAGE_PARAMS_MAX_CHARS, PAGE_AUDIENCES, PAGE_NOTIFY_LEVELS, pageSlugSchema, pageToolSchema, pageParamsSchema, pageManifestObject, pageManifestSchema, pageSummarySchema, hubPagesParam, hubPagesQuery, hubPageParam, pageRevisionSchema, PAGE_TOOL_CALL_BODY_MAX_BYTES, pageToolCallBody, PAGE_REVISION_STALE_CODE;
7254
+ var init_chunk_FBV7NLKO = __esm({
7255
+ "../../packages/core/dist/chunk-FBV7NLKO.js"() {
7256
+ "use strict";
7257
+ init_chunk_WEXVYJ5H();
7258
+ init_chunk_HZ6CADSY();
7259
+ init_zod();
7260
+ PAGES_PER_HUB_MAX = 20;
7261
+ PAGE_HTML_MAX_BYTES = 512 * 1024;
7262
+ PAGE_SLUG_MAX = 64;
7263
+ PAGE_SLUG_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
7264
+ PAGE_TITLE_MAX = 120;
7265
+ PAGE_DESCRIPTION_MAX = 500;
7266
+ PAGE_ORDER_MAX = 1e3;
7267
+ PAGE_TOOLS_MAX = 50;
7268
+ PAGE_CONNECTION_NAME_MAX = 200;
7269
+ PAGE_TOOL_NAME_MAX = 128;
7270
+ PAGE_PARAMS_MAX_CHARS = 16 * 1024;
7271
+ PAGE_AUDIENCES = ["team", "customers"];
7272
+ PAGE_NOTIFY_LEVELS = ["none", "summary"];
7273
+ pageSlugSchema = external_exports.string().min(1).max(PAGE_SLUG_MAX).regex(PAGE_SLUG_REGEX, {
7274
+ message: 'a page slug is lowercase letters, digits and hyphens (e.g. "swim-results")'
7275
+ });
7276
+ pageToolSchema = external_exports.object({
7277
+ /** The toolset connection's name, as `hub.yaml` names it. */
7278
+ connection: external_exports.string().trim().min(1).max(PAGE_CONNECTION_NAME_MAX),
7279
+ /** The tool's name in its connection's catalog. */
7280
+ tool: external_exports.string().trim().min(1).max(PAGE_TOOL_NAME_MAX),
7281
+ notify: external_exports.enum(PAGE_NOTIFY_LEVELS).default("none")
7282
+ }).strict();
7283
+ pageParamsSchema = external_exports.record(external_exports.unknown()).superRefine((schema, ctx) => {
7284
+ if (JSON.stringify(schema).length > PAGE_PARAMS_MAX_CHARS) {
7285
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: `params is at most ${PAGE_PARAMS_MAX_CHARS} characters of JSON` });
7286
+ return;
7287
+ }
7288
+ const result = validateToolInputSchema(schema);
7289
+ if (!result.ok) {
7290
+ for (const error of result.errors) {
7291
+ ctx.addIssue({
7292
+ code: external_exports.ZodIssueCode.custom,
7293
+ message: `params is not a valid JSON Schema${error.path ? ` at "${error.path}"` : ""}: ${error.message}`
7294
+ });
7295
+ }
7296
+ }
7297
+ });
7298
+ pageManifestObject = external_exports.object({
7299
+ slug: pageSlugSchema,
7300
+ title: external_exports.string().trim().min(1).max(PAGE_TITLE_MAX),
7301
+ description: external_exports.string().trim().max(PAGE_DESCRIPTION_MAX).nullable().default(null),
7302
+ audience: external_exports.enum(PAGE_AUDIENCES, {
7303
+ errorMap: () => ({ message: 'audience must be "team" or "customers"' })
7304
+ }),
7305
+ /** A team page's: the hub's team users may run its write tools. A `conversation:write` grant on the hub always may. */
7306
+ team_writes: external_exports.boolean().default(false),
7307
+ /**
7308
+ * A customer page's: its customers may run its write tools (opt-in), each on their own records of a person-ruled
7309
+ * record type, and on every record of a `{ shared: true }` one (wayai#5473 2b2). Stored
7310
+ * only when stated, so a page that states none (every team page) keeps the manifest it had.
7311
+ */
7312
+ customer_writes: external_exports.boolean().optional(),
7313
+ /** The page is offered in the conversation header to whoever may open it. Required on a customer page. */
7314
+ show_in_conversation: external_exports.boolean().default(false),
7315
+ /**
7316
+ * Either audience's (decision 10): the page may put text in the viewer's own composer (MCP Apps
7317
+ * `ui/message`), never send it. Unset is false. Stored only when stated, so a page that states none keeps
7318
+ * the manifest, and the revision, it had.
7319
+ */
7320
+ allow_messages: external_exports.boolean().optional(),
7321
+ /** Menu position, lowest first; pages of equal order sort by slug. */
7322
+ order: external_exports.number().int().min(0).max(PAGE_ORDER_MAX).default(0),
7323
+ params: pageParamsSchema.nullable().default(null),
7324
+ tools: external_exports.array(pageToolSchema).max(PAGE_TOOLS_MAX).default([])
7325
+ }).strict();
7326
+ pageManifestSchema = pageManifestObject.superRefine((manifest, ctx) => {
7327
+ if (manifest.audience === "customers") {
7328
+ if (!manifest.show_in_conversation) {
7329
+ ctx.addIssue({
7330
+ code: external_exports.ZodIssueCode.custom,
7331
+ path: ["show_in_conversation"],
7332
+ message: "a customer page sets show_in_conversation: true, since the conversation header is a customer's only way in"
7333
+ });
7334
+ }
7335
+ if (manifest.team_writes) {
7336
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: ["team_writes"], message: "team_writes is a team page's: a customer page writes only with customer_writes" });
7337
+ }
7338
+ if (manifest.tools.some((t) => t.notify !== "none")) {
7339
+ ctx.addIssue({
7340
+ code: external_exports.ZodIssueCode.custom,
7341
+ path: ["tools"],
7342
+ message: "a customer page's tools are notify: none: the agent does not hear a customer page's calls yet"
7343
+ });
7344
+ }
7345
+ } else if (manifest.customer_writes) {
7346
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: ["customer_writes"], message: "customer_writes is a customer page's: a team page writes with team_writes" });
7347
+ }
7348
+ const seen = /* @__PURE__ */ new Set();
7349
+ manifest.tools.forEach((t, i) => {
7350
+ if (seen.has(t.tool)) {
7351
+ ctx.addIssue({
7352
+ code: external_exports.ZodIssueCode.custom,
7353
+ path: ["tools", i, "tool"],
7354
+ message: `two tools are named "${t.tool}": a page calls a tool by its name alone, so tool names are unique across the manifest`
7355
+ });
7356
+ }
7357
+ seen.add(t.tool);
7358
+ });
7359
+ });
7360
+ pageSummarySchema = external_exports.object({
7361
+ slug: external_exports.string(),
7362
+ title: external_exports.string(),
7363
+ description: external_exports.string().nullable(),
7364
+ audience: external_exports.string(),
7365
+ team_writes: external_exports.boolean(),
7366
+ /** A customer page's opt-in to writes, when its manifest states it; absent otherwise. */
7367
+ customer_writes: external_exports.boolean().optional(),
7368
+ show_in_conversation: external_exports.boolean(),
7369
+ /**
7370
+ * Whether the page may prefill the viewer's composer (`ui/message`). Absent from a server before #5333
7371
+ * row 6.2, and from a stored page that states none; a host reads absent as false.
7372
+ */
7373
+ allow_messages: external_exports.boolean().optional(),
7374
+ order: external_exports.number(),
7375
+ params: external_exports.record(external_exports.unknown()).nullable(),
7376
+ tools: external_exports.array(external_exports.object({ connection: external_exports.string(), tool: external_exports.string(), notify: external_exports.string() })),
7377
+ revision: external_exports.string(),
7378
+ /** The HTML's size in UTF-8 bytes. */
7379
+ html_bytes: external_exports.number().int().nonnegative(),
7380
+ created_at: external_exports.string(),
7381
+ updated_at: external_exports.string()
7382
+ });
7383
+ hubPagesParam = external_exports.object({ hub_id: uuidSchema });
7384
+ hubPagesQuery = external_exports.object({ audience: external_exports.enum(PAGE_AUDIENCES).optional() });
7385
+ hubPageParam = external_exports.object({ hub_id: uuidSchema, slug: pageSlugSchema });
7386
+ pageRevisionSchema = external_exports.string().regex(/^[0-9a-f]{64}$/, { message: "a page revision is 64 hex digits" });
7387
+ PAGE_TOOL_CALL_BODY_MAX_BYTES = 1024 * 1024;
7388
+ pageToolCallBody = external_exports.object({
7389
+ revision: pageRevisionSchema,
7390
+ tool: external_exports.string().min(1).max(PAGE_TOOL_NAME_MAX),
7391
+ arguments: external_exports.record(external_exports.unknown()).default({}),
7392
+ conversation_id: uuidSchema.optional()
7393
+ }).strict();
7394
+ PAGE_REVISION_STALE_CODE = "PAGE_REVISION_STALE";
7395
+ }
7396
+ });
7397
+
7398
+ // ../../packages/core/dist/chunk-NZ6RQW6R.js
7399
+ var hubPageWatchParam, pageWatchedBaseSchema, hubPageWatchResponseSchema;
7400
+ var init_chunk_NZ6RQW6R = __esm({
7401
+ "../../packages/core/dist/chunk-NZ6RQW6R.js"() {
7402
+ "use strict";
7403
+ init_chunk_2DXRB6DR();
7404
+ init_chunk_FBV7NLKO();
7405
+ init_chunk_HZ6CADSY();
7406
+ init_zod();
7407
+ hubPageWatchParam = external_exports.object({ hub_id: uuidSchema, slug: pageSlugSchema, watch_id: uuidSchema });
7408
+ pageWatchedBaseSchema = toolsetConnectionBindingSchema.pick({ base_id: true, environment: true });
7409
+ hubPageWatchResponseSchema = external_exports.object({
7410
+ data: external_exports.object({ bases: external_exports.array(pageWatchedBaseSchema), expires_at: timestampSchema.nullable(), org_id: uuidSchema })
7411
+ });
7412
+ }
7413
+ });
7414
+
7415
+ // ../../packages/core/dist/chunk-ZVXO3XL6.js
7416
+ 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;
7417
+ var init_chunk_ZVXO3XL6 = __esm({
7418
+ "../../packages/core/dist/chunk-ZVXO3XL6.js"() {
7419
+ "use strict";
7420
+ init_chunk_HZ6CADSY();
7421
+ init_zod();
7422
+ PEOPLE_CONTACT_PAGE_MAX = 100;
7423
+ PEOPLE_CONTACT_PAGE_DEFAULT = 50;
7424
+ PEOPLE_CONTACT_EMAIL_MAX_LENGTH = 254;
7425
+ peopleUserIdSchema = external_exports.string().max(64).regex(USER_ID_REGEX, "must be a user id");
7426
+ peopleInviteEmailSchema = external_exports.string().trim().max(PEOPLE_CONTACT_EMAIL_MAX_LENGTH).email();
7427
+ peopleContactInviteBody = external_exports.object({
7428
+ email: peopleInviteEmailSchema
7429
+ }).strict();
7430
+ peopleContactInviteIdParam = external_exports.object({ inviteId: uuidSchema });
7431
+ peopleContactUserIdParam = external_exports.object({ userId: peopleUserIdSchema });
7432
+ 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, {
7433
+ message: "Name a thread or a community, not both",
7434
+ path: ["community_id"]
7435
+ });
7436
+ peopleContactPageQuery = external_exports.object({
7437
+ cursor: external_exports.string().min(1).max(256).optional(),
7438
+ limit: external_exports.coerce.number().int().min(1).max(PEOPLE_CONTACT_PAGE_MAX).default(PEOPLE_CONTACT_PAGE_DEFAULT)
7439
+ });
7440
+ peopleOutgoingInviteSchema = external_exports.object({
7441
+ invite_id: uuidSchema,
7442
+ email: external_exports.string(),
7443
+ status: external_exports.literal("sent"),
7444
+ created_at: timestampSchema,
7445
+ expires_at: timestampSchema
7446
+ }).strict();
7447
+ peopleContactPersonSchema = external_exports.object({
7448
+ user_id: peopleUserIdSchema,
7449
+ display_name: external_exports.string().nullable(),
7450
+ email: external_exports.string().nullable()
7451
+ }).strict();
7452
+ peopleContactSchema = peopleContactPersonSchema.extend({ contact_since: timestampSchema, thread_id: uuidSchema }).strict();
7453
+ peopleIncomingInviteSchema = external_exports.object({
7454
+ invite_id: uuidSchema,
7455
+ inviter: peopleContactPersonSchema,
7456
+ created_at: timestampSchema,
7457
+ expires_at: timestampSchema
7458
+ }).strict();
7459
+ peopleBlockedUserSchema = peopleContactPersonSchema.extend({ blocked_at: timestampSchema, deleted_user: external_exports.boolean() }).strict();
7460
+ }
7461
+ });
7462
+
7463
+ // ../../packages/core/dist/chunk-ZXK6N2HN.js
7464
+ 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;
7465
+ var init_chunk_ZXK6N2HN = __esm({
7466
+ "../../packages/core/dist/chunk-ZXK6N2HN.js"() {
7467
+ "use strict";
7468
+ init_chunk_ZVXO3XL6();
7469
+ init_chunk_HZ6CADSY();
7470
+ init_zod();
7471
+ PEOPLE_MODERATION_NOTE_MAX_LENGTH = 500;
7472
+ ADMIN_PEOPLE_REPORTS_PAGE_MAX = 100;
7473
+ ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT = 50;
7474
+ PEOPLE_SUSPENDED_REASON = "suspended";
7475
+ peopleModerationActionSchema = external_exports.enum(["remove_message", "suspend", "unsuspend", "dismiss"]);
7476
+ moderationNoteSchema = optionalTrimmedText(PEOPLE_MODERATION_NOTE_MAX_LENGTH);
7477
+ adminPeopleReportListQuery = external_exports.object({
7478
+ pending: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true"),
7479
+ /** Lower bound on `created_at`. */
7480
+ since: timestampSchema.optional(),
7481
+ limit: external_exports.coerce.number().int().min(1).max(ADMIN_PEOPLE_REPORTS_PAGE_MAX).default(ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT),
7482
+ offset: external_exports.coerce.number().int().min(0).default(0)
7483
+ });
7484
+ adminPeopleReportIdParam = external_exports.object({ reportId: uuidSchema });
7485
+ adminPeopleMessageRemovalBody = external_exports.object({ report_id: uuidSchema, message_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
7486
+ adminPeopleSuspendBody = external_exports.object({ report_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
7487
+ adminPeopleNoteBody = external_exports.object({ note: moderationNoteSchema }).strict();
7488
+ }
7489
+ });
7490
+
7491
+ // ../../packages/core/dist/chunk-Y7CFCYX4.js
7492
+ var PEOPLE_REPORT_DETAILS_MAX_LENGTH, peopleReportReasonSchema, reportDetailsSchema, reportFields, peopleReportBody;
7493
+ var init_chunk_Y7CFCYX4 = __esm({
7494
+ "../../packages/core/dist/chunk-Y7CFCYX4.js"() {
7495
+ "use strict";
7496
+ init_chunk_ZVXO3XL6();
7497
+ init_chunk_HZ6CADSY();
7498
+ init_zod();
7499
+ PEOPLE_REPORT_DETAILS_MAX_LENGTH = 500;
7500
+ peopleReportReasonSchema = external_exports.enum(["spam", "harassment", "hate", "sexual", "violence", "other"]);
7501
+ reportDetailsSchema = optionalTrimmedText(PEOPLE_REPORT_DETAILS_MAX_LENGTH);
7502
+ reportFields = { reason: peopleReportReasonSchema, details: reportDetailsSchema };
7503
+ peopleReportBody = external_exports.discriminatedUnion("target", [
7504
+ external_exports.object({ target: external_exports.literal("message"), thread_id: uuidSchema, message_id: uuidSchema, ...reportFields }).strict(),
7505
+ external_exports.object({ target: external_exports.literal("thread"), thread_id: uuidSchema, ...reportFields }).strict(),
7506
+ external_exports.object({ target: external_exports.literal("user"), user_id: peopleUserIdSchema, thread_id: uuidSchema.optional(), ...reportFields }).strict(),
7507
+ external_exports.object({
7508
+ target: external_exports.literal("community_message"),
7509
+ community_id: uuidSchema,
7510
+ room_id: uuidSchema,
7511
+ message_id: uuidSchema,
7512
+ ...reportFields
7513
+ }).strict(),
7514
+ external_exports.object({ target: external_exports.literal("community_member"), community_id: uuidSchema, user_id: peopleUserIdSchema, ...reportFields }).strict()
7515
+ ]);
7516
+ }
7517
+ });
7518
+
7519
+ // ../../packages/core/dist/chunk-2YEGUQR7.js
7520
+ var PERSON_ID_PATTERN, CONTACT_PERSON_ID_PATTERN, PERSON_ID_FORM_MESSAGE, userPersonIdSchema, personIdSchema;
7521
+ var init_chunk_2YEGUQR7 = __esm({
7522
+ "../../packages/core/dist/chunk-2YEGUQR7.js"() {
7523
+ "use strict";
7524
+ init_zod();
7525
+ PERSON_ID_PATTERN = /^prs_[a-z2-7]{52}$/;
7526
+ CONTACT_PERSON_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
7527
+ PERSON_ID_FORM_MESSAGE = "Must be a person id (prs_\u2026) or a contact id (a lowercase UUID)";
7528
+ userPersonIdSchema = external_exports.string().regex(PERSON_ID_PATTERN, { message: "Must be a person id (prs_\u2026)" });
7529
+ personIdSchema = external_exports.string().refine(
7530
+ (value) => PERSON_ID_PATTERN.test(value) || CONTACT_PERSON_ID_PATTERN.test(value),
7531
+ { message: PERSON_ID_FORM_MESSAGE }
7532
+ );
7533
+ }
7534
+ });
7535
+
7536
+ // ../../packages/core/dist/chunk-UAOHHCW5.js
7537
+ function normalizeContactPhone(raw) {
7538
+ const compact = raw.trim().replace(/[\s\-.()]/g, "");
7539
+ const withPlus = compact.startsWith("00") ? `+${compact.slice(2)}` : compact;
7540
+ return /^\+[1-9]\d{7,14}$/.test(withPlus) ? withPlus : null;
7541
+ }
7542
+ function normalizeContactLabel(raw) {
7543
+ return raw.trim().replace(/\s+/g, " ").toLowerCase();
7544
+ }
7545
+ function importRowLabels(row, batchLabels) {
7546
+ return [.../* @__PURE__ */ new Set([...row.labels ?? [], ...batchLabels ?? []])];
7547
+ }
7548
+ 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;
7549
+ var init_chunk_UAOHHCW5 = __esm({
7550
+ "../../packages/core/dist/chunk-UAOHHCW5.js"() {
7149
7551
  "use strict";
7150
7552
  init_zod();
7151
7553
  CONTACT_ENVIRONMENTS = ["production", "preview", "all"];
@@ -7351,511 +7753,475 @@ var init_chunk_YUZFHVB2 = __esm({
7351
7753
  inviteRolePreviewResponse = external_exports.object({
7352
7754
  inviter_name: external_exports.string(),
7353
7755
  entity_id: external_exports.string().uuid(),
7354
- entity_name: external_exports.string(),
7355
- entity_type: external_exports.enum(["org", "hub"]),
7356
- role: external_exports.enum(["org_admin", "admin", "team_user", "user"]),
7357
- expires_at: external_exports.string().datetime()
7358
- });
7359
- inviteContactPreviewResponse = external_exports.object({
7360
- inviter_name: external_exports.string().nullable(),
7361
- entity_id: external_exports.string().uuid(),
7362
- entity_type: external_exports.literal("contact"),
7363
- role: external_exports.literal("contact"),
7364
- expires_at: external_exports.string().datetime()
7365
- });
7366
- invitePreviewResponse = external_exports.union([inviteRolePreviewResponse, inviteContactPreviewResponse]);
7367
- inviteUnsubscribeBody = external_exports.object({ token: external_exports.string().min(1).max(256) }).strict();
7368
- }
7369
- });
7370
-
7371
- // ../../packages/core/dist/chunk-I3O2RACG.js
7372
- var managedAgentsWebhookParams, MANAGED_AGENTS_WEBHOOK_BODY_MAX_BYTES;
7373
- var init_chunk_I3O2RACG = __esm({
7374
- "../../packages/core/dist/chunk-I3O2RACG.js"() {
7375
- "use strict";
7376
- init_zod();
7377
- managedAgentsWebhookParams = external_exports.object({
7378
- hub_id: external_exports.string().uuid(),
7379
- connection_id: external_exports.string().uuid()
7380
- });
7381
- MANAGED_AGENTS_WEBHOOK_BODY_MAX_BYTES = 16 * 1024;
7382
- }
7383
- });
7384
-
7385
- // ../../packages/core/dist/chunk-34LE6P7E.js
7386
- var templateIdParam, listTemplatesQuery, deleteTemplateQuery, templateStatusQuery, createTemplateBody, updateTemplateBody, submitTemplateBody, testTemplateBody;
7387
- var init_chunk_34LE6P7E = __esm({
7388
- "../../packages/core/dist/chunk-34LE6P7E.js"() {
7389
- "use strict";
7390
- init_zod();
7391
- templateIdParam = external_exports.object({
7392
- id: external_exports.string().uuid()
7393
- });
7394
- listTemplatesQuery = external_exports.object({
7395
- hub_id: external_exports.string().uuid(),
7396
- connection_id: external_exports.string().uuid()
7397
- });
7398
- deleteTemplateQuery = external_exports.object({
7399
- hub_id: external_exports.string().uuid(),
7400
- connection_id: external_exports.string().uuid()
7401
- });
7402
- templateStatusQuery = external_exports.object({
7403
- hub_id: external_exports.string().uuid(),
7404
- connection_id: external_exports.string().uuid()
7405
- });
7406
- createTemplateBody = external_exports.object({
7407
- hub_id: external_exports.string().uuid(),
7408
- connection_id: external_exports.string().uuid()
7409
- }).passthrough();
7410
- updateTemplateBody = external_exports.object({}).passthrough();
7411
- submitTemplateBody = external_exports.object({
7412
- hub_id: external_exports.string().uuid(),
7413
- connection_id: external_exports.string().uuid()
7414
- }).passthrough();
7415
- testTemplateBody = external_exports.object({
7416
- hub_id: external_exports.string().uuid(),
7417
- connection_id: external_exports.string().uuid()
7418
- }).passthrough();
7419
- }
7420
- });
7421
-
7422
- // ../../packages/core/dist/chunk-FPSDNS2E.js
7423
- var noticeSeveritySchema, noticeStatusSchema, NOTICE_SCOPE_REGEX, noticeScopeSchema, noticeLinkSchema, createNoticeBody, updateNoticeBody, listNoticesQuery, noticeIdParamSchema;
7424
- var init_chunk_FPSDNS2E = __esm({
7425
- "../../packages/core/dist/chunk-FPSDNS2E.js"() {
7426
- "use strict";
7427
- init_zod();
7428
- noticeSeveritySchema = external_exports.enum(["critical", "warn", "info"]);
7429
- noticeStatusSchema = external_exports.enum(["active", "resolved"]);
7430
- NOTICE_SCOPE_REGEX = /^(global|provider:[a-z0-9_-]{1,40}|service:[a-z0-9_-]{1,40})$/;
7431
- noticeScopeSchema = external_exports.string().regex(NOTICE_SCOPE_REGEX, "scope must be 'global', 'provider:<x>', or 'service:<x>'");
7432
- noticeLinkSchema = external_exports.string().url().refine((u) => /^https?:\/\//i.test(u), { message: "link must be an http(s) URL" });
7433
- createNoticeBody = external_exports.object({
7434
- severity: noticeSeveritySchema.default("info"),
7435
- scope: noticeScopeSchema.default("global"),
7436
- title: external_exports.string().trim().min(1).max(200),
7437
- body: external_exports.string().max(2e3).optional(),
7438
- link: noticeLinkSchema.optional(),
7439
- starts_at: external_exports.string().datetime().optional(),
7440
- ends_at: external_exports.string().datetime().optional()
7756
+ entity_name: external_exports.string(),
7757
+ entity_type: external_exports.enum(["org", "hub"]),
7758
+ role: external_exports.enum(["org_admin", "admin", "team_user", "user"]),
7759
+ expires_at: external_exports.string().datetime()
7441
7760
  });
7442
- updateNoticeBody = external_exports.object({
7443
- severity: noticeSeveritySchema.optional(),
7444
- scope: noticeScopeSchema.optional(),
7445
- title: external_exports.string().trim().min(1).max(200).optional(),
7446
- body: external_exports.string().max(2e3).nullable().optional(),
7447
- link: noticeLinkSchema.nullable().optional(),
7448
- starts_at: external_exports.string().datetime().optional(),
7449
- ends_at: external_exports.string().datetime().nullable().optional()
7450
- }).refine((b) => Object.keys(b).length > 0, { message: "at least one field must be provided" });
7451
- listNoticesQuery = external_exports.object({
7452
- status: noticeStatusSchema.optional(),
7453
- limit: external_exports.coerce.number().int().min(1).max(200).optional(),
7454
- offset: external_exports.coerce.number().int().min(0).optional()
7761
+ inviteContactPreviewResponse = external_exports.object({
7762
+ inviter_name: external_exports.string().nullable(),
7763
+ entity_id: external_exports.string().uuid(),
7764
+ entity_type: external_exports.literal("contact"),
7765
+ role: external_exports.literal("contact"),
7766
+ expires_at: external_exports.string().datetime()
7455
7767
  });
7456
- noticeIdParamSchema = external_exports.object({ id: external_exports.string().min(1) });
7768
+ invitePreviewResponse = external_exports.union([inviteRolePreviewResponse, inviteContactPreviewResponse]);
7769
+ inviteUnsubscribeBody = external_exports.object({ token: external_exports.string().min(1).max(256) }).strict();
7457
7770
  }
7458
7771
  });
7459
7772
 
7460
- // ../../packages/core/dist/chunk-WEXVYJ5H.js
7461
- function containsKanbanPlaceholders(value) {
7462
- if (value == null) return false;
7463
- const serialized = typeof value === "string" ? value : JSON.stringify(value);
7464
- for (const token of PLACEHOLDER_TOKENS) {
7465
- if (serialized.includes(token)) return true;
7466
- }
7467
- return false;
7468
- }
7469
- function extractToolParameters(toolConfig) {
7470
- let cfg = toolConfig;
7471
- if (typeof cfg === "string") {
7472
- try {
7473
- cfg = JSON.parse(cfg);
7474
- } catch {
7475
- return void 0;
7476
- }
7477
- }
7478
- if (!cfg || typeof cfg !== "object" || Array.isArray(cfg)) return void 0;
7479
- return cfg.parameters;
7480
- }
7481
- function isRecord(v) {
7482
- return typeof v === "object" && v !== null && !Array.isArray(v);
7483
- }
7484
- function isPrimitive(v) {
7485
- return v === null || ["string", "number", "boolean"].includes(typeof v);
7486
- }
7487
- function typeMatches(typeField, allowed) {
7488
- if (typeof typeField === "string") return allowed.has(typeField);
7489
- if (Array.isArray(typeField)) return typeField.every((t) => typeof t === "string" && allowed.has(t));
7490
- return false;
7491
- }
7492
- function validateSchema(schema, path45, errors, opts = {}) {
7493
- if (typeof schema === "boolean") return;
7494
- const depth = opts.depth ?? 0;
7495
- if (depth > MAX_SCHEMA_DEPTH) {
7496
- errors.push({
7497
- path: path45 || "<root>",
7498
- message: `schema nesting exceeds ${MAX_SCHEMA_DEPTH} levels`,
7499
- suggestion: "Flatten the schema; LLM providers reject deeply nested tool input_schemas."
7773
+ // ../../packages/core/dist/chunk-I3O2RACG.js
7774
+ var managedAgentsWebhookParams, MANAGED_AGENTS_WEBHOOK_BODY_MAX_BYTES;
7775
+ var init_chunk_I3O2RACG = __esm({
7776
+ "../../packages/core/dist/chunk-I3O2RACG.js"() {
7777
+ "use strict";
7778
+ init_zod();
7779
+ managedAgentsWebhookParams = external_exports.object({
7780
+ hub_id: external_exports.string().uuid(),
7781
+ connection_id: external_exports.string().uuid()
7500
7782
  });
7501
- return;
7783
+ MANAGED_AGENTS_WEBHOOK_BODY_MAX_BYTES = 16 * 1024;
7502
7784
  }
7503
- if (!isRecord(schema)) {
7504
- errors.push({
7505
- path: path45,
7506
- message: `expected object, got ${schema === null ? "null" : typeof schema}`
7785
+ });
7786
+
7787
+ // ../../packages/core/dist/chunk-6J742GLA.js
7788
+ 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;
7789
+ var init_chunk_6J742GLA = __esm({
7790
+ "../../packages/core/dist/chunk-6J742GLA.js"() {
7791
+ "use strict";
7792
+ init_chunk_ZVXO3XL6();
7793
+ init_chunk_HZ6CADSY();
7794
+ init_zod();
7795
+ PEOPLE_THREAD_MESSAGE_MAX_LENGTH = 4e3;
7796
+ PEOPLE_THREAD_MESSAGES_PAGE_MAX = 50;
7797
+ PEOPLE_THREAD_PAGE_MAX = 100;
7798
+ PEOPLE_THREAD_PAGE_DEFAULT = 50;
7799
+ PEOPLE_GROUP_NAME_MAX_LENGTH = 100;
7800
+ PEOPLE_GROUP_AVATAR_URL_MAX_LENGTH = 2048;
7801
+ PEOPLE_THREAD_ATTACHMENT_MAX_BYTES = 7 * 1024 * 1024;
7802
+ PEOPLE_THREAD_ATTACHMENT_NAME_MAX_LENGTH = 255;
7803
+ PEOPLE_ATTACHMENT_STORAGE_PER_USER_BYTES = 1024 * 1024 * 1024;
7804
+ PEOPLE_THREAD_ATTACHMENT_MAX_MB = Math.floor(PEOPLE_THREAD_ATTACHMENT_MAX_BYTES / (1024 * 1024));
7805
+ PEOPLE_THREAD_ATTACHMENT_URL_TTL_SECONDS = 15 * 60;
7806
+ PEOPLE_THREAD_ATTACHMENT_URLS_MAX = PEOPLE_THREAD_MESSAGES_PAGE_MAX;
7807
+ peopleThreadIdParam = external_exports.object({ threadId: uuidSchema });
7808
+ peopleThreadMessageIdParam = external_exports.object({ threadId: uuidSchema, messageId: uuidSchema });
7809
+ peopleThreadListQuery = external_exports.object({
7810
+ cursor: external_exports.string().min(1).max(256).optional(),
7811
+ limit: external_exports.coerce.number().int().min(1).max(PEOPLE_THREAD_PAGE_MAX).default(PEOPLE_THREAD_PAGE_DEFAULT)
7507
7812
  });
7508
- return;
7509
- }
7510
- if (opts.isRoot) {
7511
- if ("type" in schema && schema.type !== "object") {
7512
- errors.push({
7513
- path: path45 ? `${path45}.type` : "type",
7514
- message: `root type must be 'object', got ${JSON.stringify(schema.type)}`,
7515
- suggestion: "Tool parameters at the root must be an object: `{ type: 'object', properties: { ... } }`."
7516
- });
7517
- }
7518
- } else if ("type" in schema && !typeMatches(schema.type, ALLOWED_TYPES)) {
7519
- errors.push({
7520
- path: `${path45}.type`,
7521
- message: `type must be one of ${[...ALLOWED_TYPES].join("/")} or an array of those, got ${JSON.stringify(schema.type)}`
7813
+ peopleThreadMessagesQuery = external_exports.object({
7814
+ before_seq: external_exports.coerce.number().int().min(1).optional(),
7815
+ limit: external_exports.coerce.number().int().min(1).max(PEOPLE_THREAD_MESSAGES_PAGE_MAX).default(PEOPLE_THREAD_MESSAGES_PAGE_MAX)
7522
7816
  });
7523
- }
7524
- if ("enum" in schema) {
7525
- const e = schema.enum;
7526
- if (typeof e === "string") {
7527
- const isPlaceholder = PLACEHOLDER_TOKENS.includes(e);
7528
- const isOutcomePlaceholder = e === "[KANBAN_OUTCOME_VALUES]";
7529
- errors.push({
7530
- path: `${path45}.enum`,
7531
- message: `enum must be a non-empty array of primitives, got string ${JSON.stringify(e)}`,
7532
- suggestion: isOutcomePlaceholder ? "Declare `outcomes` on the hub's terminal kanban status so the platform can render the placeholder into a valid array; with none configured the platform drops the parameter instead." : isPlaceholder ? "Set `operation: 'update_kanban_status'` on the tool and ensure at least one hub.kanban_status has `allowsAgentUpdate: true` so the platform can render the placeholder into a valid array." : 'Wrap the value in an array: `enum: ["value"]`.'
7533
- });
7534
- } else if (!Array.isArray(e)) {
7535
- errors.push({
7536
- path: `${path45}.enum`,
7537
- message: `enum must be a non-empty array of primitives, got ${typeof e}`
7538
- });
7539
- } else if (e.length === 0) {
7540
- errors.push({
7541
- path: `${path45}.enum`,
7542
- message: "enum must not be empty"
7543
- });
7544
- } else {
7545
- for (let i = 0; i < e.length; i++) {
7546
- if (!isPrimitive(e[i])) {
7547
- errors.push({
7548
- path: `${path45}.enum[${i}]`,
7549
- message: `enum entry must be a primitive (string/number/boolean/null), got ${typeof e[i]}`
7550
- });
7551
- }
7552
- }
7553
- }
7554
- }
7555
- for (const key of ["exclusiveMinimum", "exclusiveMaximum"]) {
7556
- if (key in schema && typeof schema[key] === "boolean") {
7557
- errors.push({
7558
- path: `${path45}.${key}`,
7559
- message: `${key} as boolean is draft-04 syntax; draft 2020-12 requires a numeric value`,
7560
- suggestion: `Replace with the numeric bound, e.g. \`${key}: 0\`.`
7561
- });
7562
- }
7563
- }
7564
- if ("properties" in schema) {
7565
- if (!isRecord(schema.properties)) {
7566
- errors.push({
7567
- path: `${path45}.properties`,
7568
- message: `properties must be an object, got ${Array.isArray(schema.properties) ? "array" : typeof schema.properties}`
7569
- });
7570
- } else {
7571
- for (const [propName, propSchema] of Object.entries(schema.properties)) {
7572
- validateSchema(propSchema, `${path45}.properties.${propName}`, errors, { depth: depth + 1 });
7573
- }
7574
- }
7575
- }
7576
- if (schemaTypeIncludes(schema, "array") && "items" in schema) {
7577
- if (Array.isArray(schema.items)) {
7578
- schema.items.forEach((sub, i) => validateSchema(sub, `${path45}.items[${i}]`, errors, { depth: depth + 1 }));
7579
- } else {
7580
- validateSchema(schema.items, `${path45}.items`, errors, { depth: depth + 1 });
7581
- }
7582
- }
7583
- for (const key of SUBSCHEMA_OBJECT_KEYWORDS) {
7584
- if (key in schema && isRecord(schema[key])) {
7585
- validateSchema(schema[key], `${path45}.${key}`, errors, { depth: depth + 1 });
7586
- }
7587
- }
7588
- for (const key of SUBSCHEMA_LIST_KEYWORDS) {
7589
- const list2 = schema[key];
7590
- if (Array.isArray(list2)) {
7591
- list2.forEach((sub, i) => validateSchema(sub, `${path45}.${key}[${i}]`, errors, { depth: depth + 1 }));
7592
- }
7593
- }
7594
- for (const key of SUBSCHEMA_MAP_KEYWORDS) {
7595
- const map = schema[key];
7596
- if (isRecord(map)) {
7597
- for (const [name, sub] of Object.entries(map)) {
7598
- validateSchema(sub, `${path45}.${key}.${name}`, errors, { depth: depth + 1 });
7599
- }
7600
- }
7601
- }
7602
- const reportedPaths = new Set(errors.map((e) => e.path));
7603
- for (const [k, v] of Object.entries(schema)) {
7604
- if (typeof v !== "string") continue;
7605
- const fieldPath = `${path45}.${k}`;
7606
- if (reportedPaths.has(fieldPath)) continue;
7607
- for (const token of PLACEHOLDER_TOKENS) {
7608
- if (v === token) {
7609
- errors.push({
7610
- path: fieldPath,
7611
- message: `unresolved placeholder ${JSON.stringify(token)}`,
7612
- suggestion: "The platform renders this placeholder at tool-creation time. Ensure `operation: 'update_kanban_status'` is set and the hub has at least one kanban_status with `allowsAgentUpdate: true`."
7613
- });
7614
- }
7615
- }
7616
- }
7617
- }
7618
- function schemaTypeIncludes(schema, wanted) {
7619
- const t = schema.type;
7620
- if (typeof t === "string") return t === wanted;
7621
- if (Array.isArray(t)) return t.includes(wanted);
7622
- return false;
7623
- }
7624
- function validateToolInputSchema(schema) {
7625
- const errors = [];
7626
- if (!isRecord(schema)) {
7627
- errors.push({
7628
- path: "",
7629
- message: `expected object at root, got ${schema === null ? "null" : typeof schema}`
7817
+ peopleThreadAttachmentUploadSchema = external_exports.object({
7818
+ file_name: external_exports.string().trim().min(1).max(PEOPLE_THREAD_ATTACHMENT_NAME_MAX_LENGTH),
7819
+ file_binary: external_exports.string().min(1)
7820
+ }).strict();
7821
+ peopleThreadSendBody = external_exports.object({
7822
+ body: external_exports.string().max(PEOPLE_THREAD_MESSAGE_MAX_LENGTH).default(""),
7823
+ client_message_id: uuidSchema.optional(),
7824
+ attachment: peopleThreadAttachmentUploadSchema.optional()
7825
+ }).strict().refine((b) => b.body.trim().length > 0 || b.attachment !== void 0, {
7826
+ message: "must not be empty",
7827
+ path: ["body"]
7630
7828
  });
7631
- return { ok: false, errors };
7829
+ peopleThreadAttachmentUrlsBody = external_exports.object({ attachment_ids: external_exports.array(uuidSchema).min(1).max(PEOPLE_THREAD_ATTACHMENT_URLS_MAX) }).strict();
7830
+ peopleThreadReadBody = external_exports.object({ seq: external_exports.number().int().min(0) }).strict();
7831
+ peopleThreadSettingsBody = external_exports.object({
7832
+ muted: external_exports.boolean().optional(),
7833
+ hidden: external_exports.boolean().optional()
7834
+ }).strict().refine((b) => b.muted !== void 0 || b.hidden !== void 0, "nothing to change");
7835
+ peopleGroupNameSchema = external_exports.string().trim().min(1).max(PEOPLE_GROUP_NAME_MAX_LENGTH);
7836
+ peopleGroupAvatarUrlSchema = external_exports.string().max(PEOPLE_GROUP_AVATAR_URL_MAX_LENGTH).url().refine((s) => s.startsWith("https://"), "must be an https URL");
7837
+ peopleGroupCreateBody = external_exports.object({
7838
+ name: peopleGroupNameSchema,
7839
+ avatar_url: peopleGroupAvatarUrlSchema.nullable().optional(),
7840
+ org_id: uuidSchema.optional()
7841
+ }).strict();
7842
+ peopleOrgDirectBody = external_exports.object({
7843
+ org_id: uuidSchema,
7844
+ user_id: peopleUserIdSchema
7845
+ }).strict();
7846
+ peopleGroupUpdateBody = external_exports.object({
7847
+ name: peopleGroupNameSchema.optional(),
7848
+ avatar_url: peopleGroupAvatarUrlSchema.nullable().optional()
7849
+ }).strict().refine((b) => b.name !== void 0 || b.avatar_url !== void 0, "nothing to change");
7850
+ peopleGroupInviteBody = external_exports.union([
7851
+ external_exports.object({ user_id: peopleUserIdSchema }).strict(),
7852
+ external_exports.object({ email: peopleInviteEmailSchema }).strict()
7853
+ ]);
7854
+ peopleOrgErasureBody = external_exports.object({
7855
+ org_id: uuidSchema,
7856
+ email: peopleInviteEmailSchema
7857
+ }).strict();
7858
+ peopleGroupLeaveBody = external_exports.object({ delete_my_messages: external_exports.boolean().optional() }).strict();
7859
+ peopleGroupInviteIdParam = external_exports.object({ threadId: uuidSchema, inviteId: uuidSchema });
7860
+ peopleGroupIncomingInviteIdParam = external_exports.object({ inviteId: uuidSchema });
7861
+ peopleGroupMemberParam = external_exports.object({ threadId: uuidSchema, userId: peopleUserIdSchema });
7862
+ peopleThreadKindSchema = external_exports.enum(["dm", "group"]);
7863
+ peopleThreadMemberSchema = external_exports.object({
7864
+ user_id: peopleUserIdSchema,
7865
+ display_name: external_exports.string().nullable(),
7866
+ deleted_user: external_exports.boolean()
7867
+ }).strict();
7868
+ peopleThreadLastMessageSchema = external_exports.object({
7869
+ message_id: uuidSchema,
7870
+ seq: external_exports.number().int().positive(),
7871
+ author_user_id: peopleUserIdSchema,
7872
+ preview: external_exports.string().nullable(),
7873
+ deleted: external_exports.boolean(),
7874
+ created_at: timestampSchema
7875
+ }).strict();
7876
+ peopleGroupRoleSchema = external_exports.enum(["admin", "member"]);
7877
+ peopleGroupSummarySchema = external_exports.object({
7878
+ membership: external_exports.enum(["member", "removed", "left"]),
7879
+ role: peopleGroupRoleSchema.nullable(),
7880
+ avatar_url: external_exports.string().nullable()
7881
+ }).strict();
7882
+ peopleThreadSummarySchema = external_exports.object({
7883
+ thread_id: uuidSchema,
7884
+ kind: peopleThreadKindSchema,
7885
+ org_id: external_exports.string().nullable(),
7886
+ org_name: external_exports.string().nullable(),
7887
+ title: external_exports.string().nullable(),
7888
+ counterpart: peopleThreadMemberSchema.nullable(),
7889
+ last_seq: external_exports.number().int().nonnegative(),
7890
+ last_message: peopleThreadLastMessageSchema.nullable(),
7891
+ last_activity_at: timestampSchema,
7892
+ read_seq: external_exports.number().int().nonnegative(),
7893
+ unread_count: external_exports.number().int().nonnegative(),
7894
+ muted: external_exports.boolean(),
7895
+ hidden: external_exports.boolean(),
7896
+ writable: external_exports.boolean(),
7897
+ group: peopleGroupSummarySchema.nullable().optional(),
7898
+ version: external_exports.number().int().nonnegative().optional()
7899
+ }).strict();
7900
+ peopleThreadAttachmentSchema = external_exports.object({
7901
+ attachment_id: uuidSchema,
7902
+ file_name: external_exports.string(),
7903
+ content_type: external_exports.string(),
7904
+ size_bytes: external_exports.number().int().positive()
7905
+ }).strict();
7906
+ peopleThreadMessageSchema = external_exports.object({
7907
+ message_id: uuidSchema,
7908
+ seq: external_exports.number().int().positive(),
7909
+ author_user_id: peopleUserIdSchema,
7910
+ body: external_exports.string().nullable(),
7911
+ deleted: external_exports.boolean(),
7912
+ created_at: timestampSchema,
7913
+ deleted_at: timestampSchema.nullable(),
7914
+ client_message_id: uuidSchema.nullable(),
7915
+ attachment: peopleThreadAttachmentSchema.nullable().optional()
7916
+ }).strict();
7917
+ peopleGroupMemberSchema = peopleThreadMemberSchema.extend({ role: peopleGroupRoleSchema, joined_at: timestampSchema }).strict();
7918
+ peopleGroupSentInviteSchema = external_exports.object({
7919
+ invite_id: uuidSchema,
7920
+ invitee: peopleThreadMemberSchema,
7921
+ invitee_email: external_exports.string().nullable().optional(),
7922
+ status: external_exports.literal("sent"),
7923
+ created_at: timestampSchema,
7924
+ expires_at: timestampSchema
7925
+ }).strict();
7926
+ peopleGroupIncomingInviteSchema = external_exports.object({
7927
+ invite_id: uuidSchema,
7928
+ thread_id: uuidSchema,
7929
+ kind: peopleThreadKindSchema.optional(),
7930
+ group: external_exports.object({ name: external_exports.string() }).strict(),
7931
+ org: external_exports.object({ org_id: external_exports.string(), org_name: external_exports.string().nullable() }).strict().nullable().optional(),
7932
+ inviter: external_exports.object({ user_id: peopleUserIdSchema, display_name: external_exports.string().nullable(), email: external_exports.string().nullable() }).strict(),
7933
+ created_at: timestampSchema,
7934
+ expires_at: timestampSchema
7935
+ }).strict();
7632
7936
  }
7633
- validateSchema(schema, "", errors, { isRoot: true });
7634
- return errors.length === 0 ? { ok: true } : { ok: false, errors };
7635
- }
7636
- var PLACEHOLDER_TOKENS, ALLOWED_TYPES, SUBSCHEMA_OBJECT_KEYWORDS, SUBSCHEMA_LIST_KEYWORDS, SUBSCHEMA_MAP_KEYWORDS, MAX_SCHEMA_DEPTH;
7637
- var init_chunk_WEXVYJ5H = __esm({
7638
- "../../packages/core/dist/chunk-WEXVYJ5H.js"() {
7937
+ });
7938
+
7939
+ // ../../packages/core/dist/chunk-6AYIXGDT.js
7940
+ var COMMUNITIES_PER_ORG_MAX, COMMUNITY_NAME_MAX_LENGTH, COMMUNITY_REGISTRY_CLOSED_REASON, COMMUNITY_MEMBERS_MAX, COMMUNITY_ADMISSIONS, COMMUNITY_ACCESS_MAX, COMMUNITY_ACCESS_ADD_MAX, COMMUNITY_ACCESS_FULL_REASON, COMMUNITY_JOIN_SOURCE_MAX_LENGTH, COMMUNITY_JOIN_FLOW_TOKEN_MAX_LENGTH, COMMUNITY_ROOMS_MAX, COMMUNITY_ROOM_NAME_MAX_LENGTH, COMMUNITY_MESSAGE_MAX_LENGTH, COMMUNITY_MESSAGES_PAGE_SIZE, COMMUNITY_ATTACHMENT_URLS_MAX, COMMUNITY_POST_TITLE_MAX_LENGTH, COMMUNITY_POST_SEARCH_MAX_LENGTH, COMMUNITY_MEMBER_STATUSES, COMMUNITY_RULES_MAX_LENGTH, COMMUNITY_SLOW_MODE_MAX_SECONDS, COMMUNITY_COURSES_LABEL_MAX_LENGTH, COMMUNITY_LIVE_TICKET_PREFIX, COMMUNITY_STATS_DAYS, communityNameSchema, adminCreateCommunityBody, communityIdParam, communityJoinTokenSchema, communityJoinSourceSchema, communityJoinPreviewQuery, communityJoinBody, communityRoomKindSchema, communityRoomNameSchema, communityRoomIdParam, communityMessageIdParam, communityRoomCreateBody, communityRoomUpdateBody, communityMessagesQuery, communityMessageBodySchema, communityPostTitleSchema, communityAttachmentUploadSchema, communitySendBody, communityEditBody, communityPostIdParam, communityPostsQuery, communityAnswerBody, communityReadBody, communityAttachmentUrlsBody, communityPersonParam, communityOrgParam, communityPeopleQuery, communityCoursesLabelSchema, communityAdmissionSchema, communitySettingsBody, communityAccessEmailSchema, communityAccessAddBody, communityAccessQuery, communityAccessIdParam, communityBanBody, communityLockBody, communityPinBody, communityModLogQuery, communityReportsQuery, communityReportIdParam, communityLiveTicketSchema, communityLiveQuery, communityMuteBody, communityEmailUnsubscribeTokenSchema, communityEmailUnsubscribeQuery;
7941
+ var init_chunk_6AYIXGDT = __esm({
7942
+ "../../packages/core/dist/chunk-6AYIXGDT.js"() {
7639
7943
  "use strict";
7640
- PLACEHOLDER_TOKENS = [
7641
- "[KANBAN_STATUS_VALUES]",
7642
- "[KANBAN_STATUS_NAMES]",
7643
- "[SCHEDULING_STATUS_NAMES]",
7644
- "[STATE_SLUG_VALUES]",
7645
- // Carried by `close_conversation` as well as `update_kanban_status`, since an
7646
- // agent close routes through the terminal transition. Omitting them here does not
7647
- // merely weaken a hint: `containsKanbanPlaceholders` is what lets HubDO's render
7648
- // chokepoint recognize a template config, and its other trigger is
7649
- // `operation === 'update_kanban_status'` — so a token missing from this list means
7650
- // `close_conversation` is never rendered and is then rejected as malformed.
7651
- "[KANBAN_OUTCOME_VALUES]",
7652
- "[KANBAN_OUTCOME_NAMES]"
7653
- ];
7654
- ALLOWED_TYPES = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "object", "array", "null"]);
7655
- SUBSCHEMA_OBJECT_KEYWORDS = [
7656
- "additionalProperties",
7657
- "unevaluatedProperties",
7658
- "additionalItems",
7659
- "unevaluatedItems",
7660
- "contains",
7661
- "propertyNames",
7662
- "not",
7663
- "if",
7664
- "then",
7665
- "else"
7666
- ];
7667
- SUBSCHEMA_LIST_KEYWORDS = ["allOf", "anyOf", "oneOf", "prefixItems"];
7668
- SUBSCHEMA_MAP_KEYWORDS = ["$defs", "definitions", "patternProperties", "dependentSchemas"];
7669
- MAX_SCHEMA_DEPTH = 20;
7944
+ init_chunk_UAOHHCW5();
7945
+ init_chunk_6J742GLA();
7946
+ init_chunk_ZVXO3XL6();
7947
+ init_chunk_HZ6CADSY();
7948
+ init_zod();
7949
+ COMMUNITIES_PER_ORG_MAX = 10;
7950
+ COMMUNITY_NAME_MAX_LENGTH = 100;
7951
+ COMMUNITY_REGISTRY_CLOSED_REASON = "community_registry_closed";
7952
+ COMMUNITY_MEMBERS_MAX = 1e4;
7953
+ COMMUNITY_ADMISSIONS = ["link", "invite"];
7954
+ COMMUNITY_ACCESS_MAX = COMMUNITY_MEMBERS_MAX;
7955
+ COMMUNITY_ACCESS_ADD_MAX = 500;
7956
+ COMMUNITY_ACCESS_FULL_REASON = "community_access_full";
7957
+ COMMUNITY_JOIN_SOURCE_MAX_LENGTH = 32;
7958
+ COMMUNITY_JOIN_FLOW_TOKEN_MAX_LENGTH = 128;
7959
+ COMMUNITY_ROOMS_MAX = 20;
7960
+ COMMUNITY_ROOM_NAME_MAX_LENGTH = 100;
7961
+ COMMUNITY_MESSAGE_MAX_LENGTH = 4e3;
7962
+ COMMUNITY_MESSAGES_PAGE_SIZE = 50;
7963
+ COMMUNITY_ATTACHMENT_URLS_MAX = COMMUNITY_MESSAGES_PAGE_SIZE + 2;
7964
+ COMMUNITY_POST_TITLE_MAX_LENGTH = 200;
7965
+ COMMUNITY_POST_SEARCH_MAX_LENGTH = 100;
7966
+ COMMUNITY_MEMBER_STATUSES = ["active", "left", "removed", "banned"];
7967
+ COMMUNITY_RULES_MAX_LENGTH = 4e3;
7968
+ COMMUNITY_SLOW_MODE_MAX_SECONDS = 21600;
7969
+ COMMUNITY_COURSES_LABEL_MAX_LENGTH = 16;
7970
+ COMMUNITY_LIVE_TICKET_PREFIX = "cst";
7971
+ COMMUNITY_STATS_DAYS = 30;
7972
+ communityNameSchema = external_exports.string().trim().min(1).max(COMMUNITY_NAME_MAX_LENGTH);
7973
+ adminCreateCommunityBody = external_exports.object({ org_id: uuidSchema, name: communityNameSchema }).strict();
7974
+ communityIdParam = external_exports.object({ communityId: uuidSchema });
7975
+ communityJoinTokenSchema = external_exports.string().regex(/^[0-9a-f]{32}$/);
7976
+ communityJoinSourceSchema = external_exports.string().regex(new RegExp(`^[a-z0-9_-]{1,${COMMUNITY_JOIN_SOURCE_MAX_LENGTH}}$`));
7977
+ communityJoinPreviewQuery = external_exports.object({ c: uuidSchema, k: communityJoinTokenSchema });
7978
+ communityJoinBody = external_exports.object({
7979
+ token: communityJoinTokenSchema,
7980
+ src: communityJoinSourceSchema.optional(),
7981
+ flow_token: external_exports.string().max(COMMUNITY_JOIN_FLOW_TOKEN_MAX_LENGTH).optional()
7982
+ }).strict();
7983
+ communityRoomKindSchema = external_exports.enum(["discussion", "forum", "announcements"]);
7984
+ communityRoomNameSchema = external_exports.string().trim().min(1).max(COMMUNITY_ROOM_NAME_MAX_LENGTH);
7985
+ communityRoomIdParam = external_exports.object({ communityId: uuidSchema, roomId: uuidSchema });
7986
+ communityMessageIdParam = external_exports.object({ communityId: uuidSchema, roomId: uuidSchema, messageId: uuidSchema });
7987
+ communityRoomCreateBody = external_exports.object({ kind: communityRoomKindSchema, name: communityRoomNameSchema, client_id: uuidSchema.optional() }).strict();
7988
+ communityRoomUpdateBody = external_exports.object({ name: communityRoomNameSchema.optional(), archived: external_exports.boolean().optional() }).strict().refine((b) => b.name !== void 0 || b.archived !== void 0, "nothing to change");
7989
+ communityMessagesQuery = external_exports.object({
7990
+ before: external_exports.coerce.number().int().min(1).optional(),
7991
+ after: external_exports.coerce.number().int().min(0).optional()
7992
+ }).refine((q) => q.before === void 0 || q.after === void 0, "before and after cannot be combined");
7993
+ communityMessageBodySchema = external_exports.string().max(COMMUNITY_MESSAGE_MAX_LENGTH).refine((body) => body.trim().length > 0, "must not be empty");
7994
+ communityPostTitleSchema = external_exports.string().trim().min(1).max(COMMUNITY_POST_TITLE_MAX_LENGTH);
7995
+ communityAttachmentUploadSchema = peopleThreadAttachmentUploadSchema;
7996
+ communitySendBody = external_exports.object({
7997
+ body: external_exports.string().max(COMMUNITY_MESSAGE_MAX_LENGTH).default(""),
7998
+ client_message_id: uuidSchema.optional(),
7999
+ title: communityPostTitleSchema.optional(),
8000
+ parent_message_id: uuidSchema.optional(),
8001
+ attachment: communityAttachmentUploadSchema.optional()
8002
+ }).strict().refine((b) => b.title === void 0 || b.parent_message_id === void 0, "a post is not a reply: send a title or a parent_message_id, not both").refine((b) => b.body.trim().length > 0 || b.attachment !== void 0, { message: "must not be empty", path: ["body"] });
8003
+ communityEditBody = external_exports.object({ body: communityMessageBodySchema, title: communityPostTitleSchema.optional() }).strict();
8004
+ communityPostIdParam = external_exports.object({ communityId: uuidSchema, roomId: uuidSchema, postId: uuidSchema });
8005
+ communityPostsQuery = external_exports.object({
8006
+ before_activity: external_exports.coerce.number().int().min(1).optional(),
8007
+ q: optionalTrimmedText(COMMUNITY_POST_SEARCH_MAX_LENGTH),
8008
+ unanswered: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true")
8009
+ });
8010
+ communityAnswerBody = external_exports.object({ reply_id: uuidSchema.nullable() }).strict();
8011
+ communityReadBody = external_exports.object({ seq: external_exports.number().int().min(0) }).strict();
8012
+ communityAttachmentUrlsBody = external_exports.object({ attachment_ids: external_exports.array(uuidSchema).min(1).max(COMMUNITY_ATTACHMENT_URLS_MAX) }).strict();
8013
+ communityPersonParam = external_exports.object({ communityId: uuidSchema, userId: peopleUserIdSchema });
8014
+ communityOrgParam = external_exports.object({ orgId: uuidSchema });
8015
+ communityPeopleQuery = external_exports.object({ after: peopleUserIdSchema.optional() });
8016
+ communityCoursesLabelSchema = external_exports.string().trim().max(COMMUNITY_COURSES_LABEL_MAX_LENGTH);
8017
+ communityAdmissionSchema = external_exports.enum(COMMUNITY_ADMISSIONS);
8018
+ communitySettingsBody = external_exports.object({
8019
+ name: communityNameSchema.optional(),
8020
+ rules: external_exports.string().trim().max(COMMUNITY_RULES_MAX_LENGTH).nullable().optional().transform((rules) => rules === "" ? null : rules),
8021
+ slow_mode_seconds: external_exports.number().int().min(0).max(COMMUNITY_SLOW_MODE_MAX_SECONDS).optional(),
8022
+ courses_label: communityCoursesLabelSchema.optional(),
8023
+ admission: communityAdmissionSchema.optional()
8024
+ }).strict().refine(
8025
+ (b) => b.name !== void 0 || b.rules !== void 0 || b.slow_mode_seconds !== void 0 || b.courses_label !== void 0 || b.admission !== void 0,
8026
+ "nothing to change"
8027
+ );
8028
+ communityAccessEmailSchema = external_exports.string().trim().toLowerCase().max(CONTACT_EMAIL_MAX).email();
8029
+ communityAccessAddBody = external_exports.object({ emails: external_exports.array(communityAccessEmailSchema).min(1).max(COMMUNITY_ACCESS_ADD_MAX) }).strict();
8030
+ communityAccessQuery = external_exports.object({ cursor: external_exports.string().min(1).max(256).optional() });
8031
+ communityAccessIdParam = external_exports.object({ communityId: uuidSchema, accessId: uuidSchema });
8032
+ communityBanBody = external_exports.object({ delete_messages: external_exports.boolean().optional() }).strict();
8033
+ communityLockBody = external_exports.object({ locked: external_exports.boolean() }).strict();
8034
+ communityPinBody = external_exports.object({ pinned: external_exports.boolean() }).strict();
8035
+ communityModLogQuery = external_exports.object({ before: external_exports.coerce.number().int().min(1).optional() });
8036
+ communityReportsQuery = communityModLogQuery.extend({
8037
+ pending: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true")
8038
+ });
8039
+ communityReportIdParam = external_exports.object({ communityId: uuidSchema, reportId: uuidSchema });
8040
+ communityLiveTicketSchema = external_exports.string().regex(new RegExp(`^${COMMUNITY_LIVE_TICKET_PREFIX}_[A-Za-z0-9_-]{43}$`));
8041
+ communityLiveQuery = external_exports.object({ ticket: communityLiveTicketSchema });
8042
+ communityMuteBody = external_exports.object({ muted: external_exports.boolean() }).strict();
8043
+ communityEmailUnsubscribeTokenSchema = external_exports.string().max(200).regex(/^[0-9a-f-]{36}\.[A-Za-z0-9_-]{1,64}\.[0-9a-f]{64}$/i);
8044
+ communityEmailUnsubscribeQuery = external_exports.object({ token: communityEmailUnsubscribeTokenSchema });
7670
8045
  }
7671
8046
  });
7672
8047
 
7673
- // ../../packages/core/dist/chunk-FBV7NLKO.js
7674
- function utf8ByteLength(text4) {
7675
- let bytes = 0;
7676
- for (let i = 0; i < text4.length; i++) {
7677
- const code = text4.charCodeAt(i);
7678
- if (code < 128) bytes += 1;
7679
- else if (code < 2048) bytes += 2;
7680
- else if (code >= 55296 && code <= 56319 && i + 1 < text4.length) {
7681
- const next = text4.charCodeAt(i + 1);
7682
- if (next >= 56320 && next <= 57343) {
7683
- bytes += 4;
7684
- i += 1;
7685
- } else {
7686
- bytes += 3;
7687
- }
7688
- } else bytes += 3;
8048
+ // ../../packages/core/dist/chunk-UCYWGWQT.js
8049
+ function parseCommunityLessonVideoUrl(url) {
8050
+ const parts = /^https?:\/\/([^/?#]+)([^?#]*)(?:\?([^#]*))?(?:#.*)?$/i.exec(url.trim());
8051
+ if (!parts) return null;
8052
+ const host = parts[1].toLowerCase();
8053
+ const path45 = parts[2] ?? "";
8054
+ const query = parts[3] ?? "";
8055
+ let id;
8056
+ if (host === YOUTU_BE) {
8057
+ id = /^\/([A-Za-z0-9_-]{11})\/?$/.exec(path45)?.[1];
8058
+ } else if (YOUTUBE_HOSTS.has(host)) {
8059
+ if (path45 === "/watch" || path45 === "/watch/") {
8060
+ id = query.split("&").find((param) => param.startsWith("v="))?.slice(2);
8061
+ } else {
8062
+ id = YOUTUBE_ID_PATH.exec(path45)?.[1];
8063
+ }
7689
8064
  }
7690
- return bytes;
8065
+ return id !== void 0 && YOUTUBE_ID.test(id) ? { provider: "youtube", id } : null;
7691
8066
  }
7692
- function pageHtmlIssue(html) {
7693
- if (typeof html !== "string" || !/\S/.test(html)) return "a page needs its HTML: one non-empty, self-contained file";
7694
- const bytes = utf8ByteLength(html);
7695
- if (bytes > PAGE_HTML_MAX_BYTES) {
7696
- return `a page's HTML is at most ${PAGE_HTML_MAX_BYTES / 1024} KiB; this one is ${Math.ceil(bytes / 1024)} KiB`;
8067
+ function communityLessonVideoWatchUrl(video) {
8068
+ switch (video.provider) {
8069
+ case "youtube":
8070
+ return `https://www.youtube.com/watch?v=${video.id}`;
7697
8071
  }
7698
- return null;
7699
8072
  }
7700
- var PAGES_PER_HUB_MAX, PAGE_HTML_MAX_BYTES, PAGE_SLUG_MAX, PAGE_SLUG_REGEX, PAGE_TITLE_MAX, PAGE_DESCRIPTION_MAX, PAGE_ORDER_MAX, PAGE_TOOLS_MAX, PAGE_CONNECTION_NAME_MAX, PAGE_TOOL_NAME_MAX, PAGE_PARAMS_MAX_CHARS, PAGE_AUDIENCES, PAGE_NOTIFY_LEVELS, pageSlugSchema, pageToolSchema, pageParamsSchema, pageManifestObject, pageManifestSchema, pageSummarySchema, hubPagesParam, hubPagesQuery, hubPageParam, pageRevisionSchema, PAGE_TOOL_CALL_BODY_MAX_BYTES, pageToolCallBody, PAGE_REVISION_STALE_CODE;
7701
- var init_chunk_FBV7NLKO = __esm({
7702
- "../../packages/core/dist/chunk-FBV7NLKO.js"() {
8073
+ var COMMUNITY_COURSES_MAX, COMMUNITY_COURSE_MODULES_MAX, COMMUNITY_COURSE_LESSONS_MAX, COMMUNITY_LESSONS_MAX, COMMUNITY_COURSE_TITLE_MAX_LENGTH, COMMUNITY_COURSE_DESCRIPTION_MAX_LENGTH, COMMUNITY_LESSON_BODY_MAX_LENGTH, COMMUNITY_LESSON_LINKS_MAX, COMMUNITY_LESSON_URL_MAX_LENGTH, YOUTUBE_ID, YOUTUBE_HOSTS, YOUTU_BE, YOUTUBE_ID_PATH, communityCourseIdParam, communityCourseModuleIdParam, communityLessonIdParam, communityCourseTitleSchema, communityCourseDescriptionSchema, communityCoursePositionSchema, communityLessonVideoUrlSchema, communityLessonLinkSchema, communityLessonLinksSchema, communityLessonBodySchema, communityCourseCreateBody, communityCourseUpdateBody, communityModuleCreateBody, communityModuleUpdateBody, communityLessonCreateBody, communityLessonUpdateBody;
8074
+ var init_chunk_UCYWGWQT = __esm({
8075
+ "../../packages/core/dist/chunk-UCYWGWQT.js"() {
7703
8076
  "use strict";
7704
- init_chunk_WEXVYJ5H();
8077
+ init_chunk_6AYIXGDT();
7705
8078
  init_chunk_HZ6CADSY();
7706
8079
  init_zod();
7707
- PAGES_PER_HUB_MAX = 20;
7708
- PAGE_HTML_MAX_BYTES = 512 * 1024;
7709
- PAGE_SLUG_MAX = 64;
7710
- PAGE_SLUG_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
7711
- PAGE_TITLE_MAX = 120;
7712
- PAGE_DESCRIPTION_MAX = 500;
7713
- PAGE_ORDER_MAX = 1e3;
7714
- PAGE_TOOLS_MAX = 50;
7715
- PAGE_CONNECTION_NAME_MAX = 200;
7716
- PAGE_TOOL_NAME_MAX = 128;
7717
- PAGE_PARAMS_MAX_CHARS = 16 * 1024;
7718
- PAGE_AUDIENCES = ["team", "customers"];
7719
- PAGE_NOTIFY_LEVELS = ["none", "summary"];
7720
- pageSlugSchema = external_exports.string().min(1).max(PAGE_SLUG_MAX).regex(PAGE_SLUG_REGEX, {
7721
- message: 'a page slug is lowercase letters, digits and hyphens (e.g. "swim-results")'
8080
+ COMMUNITY_COURSES_MAX = 20;
8081
+ COMMUNITY_COURSE_MODULES_MAX = 20;
8082
+ COMMUNITY_COURSE_LESSONS_MAX = 100;
8083
+ COMMUNITY_LESSONS_MAX = 500;
8084
+ COMMUNITY_COURSE_TITLE_MAX_LENGTH = 200;
8085
+ COMMUNITY_COURSE_DESCRIPTION_MAX_LENGTH = 2e3;
8086
+ COMMUNITY_LESSON_BODY_MAX_LENGTH = 2e4;
8087
+ COMMUNITY_LESSON_LINKS_MAX = 10;
8088
+ COMMUNITY_LESSON_URL_MAX_LENGTH = 2e3;
8089
+ YOUTUBE_ID = /^[A-Za-z0-9_-]{11}$/;
8090
+ YOUTUBE_HOSTS = /* @__PURE__ */ new Set(["youtube.com", "www.youtube.com", "m.youtube.com", "youtube-nocookie.com", "www.youtube-nocookie.com"]);
8091
+ YOUTU_BE = "youtu.be";
8092
+ YOUTUBE_ID_PATH = /^\/(?:embed|shorts|live|v)\/([A-Za-z0-9_-]{11})\/?$/;
8093
+ communityCourseIdParam = external_exports.object({ communityId: uuidSchema, courseId: uuidSchema });
8094
+ communityCourseModuleIdParam = external_exports.object({ communityId: uuidSchema, courseId: uuidSchema, moduleId: uuidSchema });
8095
+ communityLessonIdParam = external_exports.object({ communityId: uuidSchema, courseId: uuidSchema, lessonId: uuidSchema });
8096
+ communityCourseTitleSchema = external_exports.string().trim().min(1).max(COMMUNITY_COURSE_TITLE_MAX_LENGTH);
8097
+ communityCourseDescriptionSchema = external_exports.string().trim().max(COMMUNITY_COURSE_DESCRIPTION_MAX_LENGTH);
8098
+ communityCoursePositionSchema = external_exports.number().int().min(0);
8099
+ communityLessonVideoUrlSchema = external_exports.string().trim().max(COMMUNITY_LESSON_URL_MAX_LENGTH).transform((url, ctx) => {
8100
+ const video = parseCommunityLessonVideoUrl(url);
8101
+ if (video) return video;
8102
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Only a YouTube video URL is accepted" });
8103
+ return external_exports.NEVER;
7722
8104
  });
7723
- pageToolSchema = external_exports.object({
7724
- /** The toolset connection's name, as `hub.yaml` names it. */
7725
- connection: external_exports.string().trim().min(1).max(PAGE_CONNECTION_NAME_MAX),
7726
- /** The tool's name in its connection's catalog. */
7727
- tool: external_exports.string().trim().min(1).max(PAGE_TOOL_NAME_MAX),
7728
- notify: external_exports.enum(PAGE_NOTIFY_LEVELS).default("none")
8105
+ communityLessonLinkSchema = external_exports.object({
8106
+ title: communityCourseTitleSchema,
8107
+ url: external_exports.string().trim().max(COMMUNITY_LESSON_URL_MAX_LENGTH).url().refine((url) => /^https?:\/\//i.test(url), "must be an http or https URL")
7729
8108
  }).strict();
7730
- pageParamsSchema = external_exports.record(external_exports.unknown()).superRefine((schema, ctx) => {
7731
- if (JSON.stringify(schema).length > PAGE_PARAMS_MAX_CHARS) {
7732
- ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: `params is at most ${PAGE_PARAMS_MAX_CHARS} characters of JSON` });
7733
- return;
7734
- }
7735
- const result = validateToolInputSchema(schema);
7736
- if (!result.ok) {
7737
- for (const error of result.errors) {
7738
- ctx.addIssue({
7739
- code: external_exports.ZodIssueCode.custom,
7740
- message: `params is not a valid JSON Schema${error.path ? ` at "${error.path}"` : ""}: ${error.message}`
7741
- });
7742
- }
7743
- }
7744
- });
7745
- pageManifestObject = external_exports.object({
7746
- slug: pageSlugSchema,
7747
- title: external_exports.string().trim().min(1).max(PAGE_TITLE_MAX),
7748
- description: external_exports.string().trim().max(PAGE_DESCRIPTION_MAX).nullable().default(null),
7749
- audience: external_exports.enum(PAGE_AUDIENCES, {
7750
- errorMap: () => ({ message: 'audience must be "team" or "customers"' })
7751
- }),
7752
- /** A team page's: the hub's team users may run its write tools. A `conversation:write` grant on the hub always may. */
7753
- team_writes: external_exports.boolean().default(false),
7754
- /**
7755
- * A customer page's: its customers may run its write tools (opt-in), each on their own records of a person-ruled
7756
- * record type, and on every record of a `{ shared: true }` one (wayai#5473 2b2). Stored
7757
- * only when stated, so a page that states none (every team page) keeps the manifest it had.
7758
- */
7759
- customer_writes: external_exports.boolean().optional(),
7760
- /** The page is offered in the conversation header to whoever may open it. Required on a customer page. */
7761
- show_in_conversation: external_exports.boolean().default(false),
7762
- /**
7763
- * Either audience's (decision 10): the page may put text in the viewer's own composer (MCP Apps
7764
- * `ui/message`), never send it. Unset is false. Stored only when stated, so a page that states none keeps
7765
- * the manifest, and the revision, it had.
7766
- */
7767
- allow_messages: external_exports.boolean().optional(),
7768
- /** Menu position, lowest first; pages of equal order sort by slug. */
7769
- order: external_exports.number().int().min(0).max(PAGE_ORDER_MAX).default(0),
7770
- params: pageParamsSchema.nullable().default(null),
7771
- tools: external_exports.array(pageToolSchema).max(PAGE_TOOLS_MAX).default([])
8109
+ communityLessonLinksSchema = external_exports.array(communityLessonLinkSchema).max(COMMUNITY_LESSON_LINKS_MAX);
8110
+ communityLessonBodySchema = external_exports.string().max(COMMUNITY_LESSON_BODY_MAX_LENGTH);
8111
+ communityCourseCreateBody = external_exports.object({ title: communityCourseTitleSchema, description: communityCourseDescriptionSchema.optional(), client_id: uuidSchema.optional() }).strict();
8112
+ communityCourseUpdateBody = external_exports.object({
8113
+ title: communityCourseTitleSchema.optional(),
8114
+ description: communityCourseDescriptionSchema.optional(),
8115
+ position: communityCoursePositionSchema.optional(),
8116
+ published: external_exports.boolean().optional()
8117
+ }).strict().refine((b) => Object.values(b).some((value) => value !== void 0), "nothing to change");
8118
+ communityModuleCreateBody = external_exports.object({ title: communityCourseTitleSchema, client_id: uuidSchema.optional() }).strict();
8119
+ communityModuleUpdateBody = external_exports.object({ title: communityCourseTitleSchema.optional(), position: communityCoursePositionSchema.optional() }).strict().refine((b) => b.title !== void 0 || b.position !== void 0, "nothing to change");
8120
+ communityLessonCreateBody = external_exports.object({
8121
+ module_id: uuidSchema,
8122
+ title: communityCourseTitleSchema,
8123
+ video_url: communityLessonVideoUrlSchema.nullable().optional(),
8124
+ body: communityLessonBodySchema.optional(),
8125
+ links: communityLessonLinksSchema.optional(),
8126
+ room_id: uuidSchema.nullable().optional(),
8127
+ requires_paid_plan: external_exports.boolean().optional(),
8128
+ published: external_exports.boolean().optional(),
8129
+ client_id: uuidSchema.optional()
7772
8130
  }).strict();
7773
- pageManifestSchema = pageManifestObject.superRefine((manifest, ctx) => {
7774
- if (manifest.audience === "customers") {
7775
- if (!manifest.show_in_conversation) {
7776
- ctx.addIssue({
7777
- code: external_exports.ZodIssueCode.custom,
7778
- path: ["show_in_conversation"],
7779
- message: "a customer page sets show_in_conversation: true, since the conversation header is a customer's only way in"
7780
- });
7781
- }
7782
- if (manifest.team_writes) {
7783
- ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: ["team_writes"], message: "team_writes is a team page's: a customer page writes only with customer_writes" });
7784
- }
7785
- if (manifest.tools.some((t) => t.notify !== "none")) {
7786
- ctx.addIssue({
7787
- code: external_exports.ZodIssueCode.custom,
7788
- path: ["tools"],
7789
- message: "a customer page's tools are notify: none: the agent does not hear a customer page's calls yet"
7790
- });
7791
- }
7792
- } else if (manifest.customer_writes) {
7793
- ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: ["customer_writes"], message: "customer_writes is a customer page's: a team page writes with team_writes" });
7794
- }
7795
- const seen = /* @__PURE__ */ new Set();
7796
- manifest.tools.forEach((t, i) => {
7797
- if (seen.has(t.tool)) {
7798
- ctx.addIssue({
7799
- code: external_exports.ZodIssueCode.custom,
7800
- path: ["tools", i, "tool"],
7801
- message: `two tools are named "${t.tool}": a page calls a tool by its name alone, so tool names are unique across the manifest`
7802
- });
7803
- }
7804
- seen.add(t.tool);
7805
- });
8131
+ communityLessonUpdateBody = external_exports.object({
8132
+ module_id: uuidSchema.optional(),
8133
+ title: communityCourseTitleSchema.optional(),
8134
+ video_url: communityLessonVideoUrlSchema.nullable().optional(),
8135
+ body: communityLessonBodySchema.optional(),
8136
+ links: communityLessonLinksSchema.optional(),
8137
+ room_id: uuidSchema.nullable().optional(),
8138
+ requires_paid_plan: external_exports.boolean().optional(),
8139
+ position: communityCoursePositionSchema.optional(),
8140
+ published: external_exports.boolean().optional()
8141
+ }).strict().refine((b) => Object.values(b).some((value) => value !== void 0), "nothing to change");
8142
+ }
8143
+ });
8144
+
8145
+ // ../../packages/core/dist/chunk-CMRECH67.js
8146
+ var init_chunk_CMRECH67 = __esm({
8147
+ "../../packages/core/dist/chunk-CMRECH67.js"() {
8148
+ "use strict";
8149
+ init_chunk_UCYWGWQT();
8150
+ }
8151
+ });
8152
+
8153
+ // ../../packages/core/dist/chunk-34LE6P7E.js
8154
+ var templateIdParam, listTemplatesQuery, deleteTemplateQuery, templateStatusQuery, createTemplateBody, updateTemplateBody, submitTemplateBody, testTemplateBody;
8155
+ var init_chunk_34LE6P7E = __esm({
8156
+ "../../packages/core/dist/chunk-34LE6P7E.js"() {
8157
+ "use strict";
8158
+ init_zod();
8159
+ templateIdParam = external_exports.object({
8160
+ id: external_exports.string().uuid()
7806
8161
  });
7807
- pageSummarySchema = external_exports.object({
7808
- slug: external_exports.string(),
7809
- title: external_exports.string(),
7810
- description: external_exports.string().nullable(),
7811
- audience: external_exports.string(),
7812
- team_writes: external_exports.boolean(),
7813
- /** A customer page's opt-in to writes, when its manifest states it; absent otherwise. */
7814
- customer_writes: external_exports.boolean().optional(),
7815
- show_in_conversation: external_exports.boolean(),
7816
- /**
7817
- * Whether the page may prefill the viewer's composer (`ui/message`). Absent from a server before #5333
7818
- * row 6.2, and from a stored page that states none; a host reads absent as false.
7819
- */
7820
- allow_messages: external_exports.boolean().optional(),
7821
- order: external_exports.number(),
7822
- params: external_exports.record(external_exports.unknown()).nullable(),
7823
- tools: external_exports.array(external_exports.object({ connection: external_exports.string(), tool: external_exports.string(), notify: external_exports.string() })),
7824
- revision: external_exports.string(),
7825
- /** The HTML's size in UTF-8 bytes. */
7826
- html_bytes: external_exports.number().int().nonnegative(),
7827
- created_at: external_exports.string(),
7828
- updated_at: external_exports.string()
8162
+ listTemplatesQuery = external_exports.object({
8163
+ hub_id: external_exports.string().uuid(),
8164
+ connection_id: external_exports.string().uuid()
7829
8165
  });
7830
- hubPagesParam = external_exports.object({ hub_id: uuidSchema });
7831
- hubPagesQuery = external_exports.object({ audience: external_exports.enum(PAGE_AUDIENCES).optional() });
7832
- hubPageParam = external_exports.object({ hub_id: uuidSchema, slug: pageSlugSchema });
7833
- pageRevisionSchema = external_exports.string().regex(/^[0-9a-f]{64}$/, { message: "a page revision is 64 hex digits" });
7834
- PAGE_TOOL_CALL_BODY_MAX_BYTES = 1024 * 1024;
7835
- pageToolCallBody = external_exports.object({
7836
- revision: pageRevisionSchema,
7837
- tool: external_exports.string().min(1).max(PAGE_TOOL_NAME_MAX),
7838
- arguments: external_exports.record(external_exports.unknown()).default({}),
7839
- conversation_id: uuidSchema.optional()
7840
- }).strict();
7841
- PAGE_REVISION_STALE_CODE = "PAGE_REVISION_STALE";
8166
+ deleteTemplateQuery = external_exports.object({
8167
+ hub_id: external_exports.string().uuid(),
8168
+ connection_id: external_exports.string().uuid()
8169
+ });
8170
+ templateStatusQuery = external_exports.object({
8171
+ hub_id: external_exports.string().uuid(),
8172
+ connection_id: external_exports.string().uuid()
8173
+ });
8174
+ createTemplateBody = external_exports.object({
8175
+ hub_id: external_exports.string().uuid(),
8176
+ connection_id: external_exports.string().uuid()
8177
+ }).passthrough();
8178
+ updateTemplateBody = external_exports.object({}).passthrough();
8179
+ submitTemplateBody = external_exports.object({
8180
+ hub_id: external_exports.string().uuid(),
8181
+ connection_id: external_exports.string().uuid()
8182
+ }).passthrough();
8183
+ testTemplateBody = external_exports.object({
8184
+ hub_id: external_exports.string().uuid(),
8185
+ connection_id: external_exports.string().uuid()
8186
+ }).passthrough();
7842
8187
  }
7843
8188
  });
7844
8189
 
7845
- // ../../packages/core/dist/chunk-NZ6RQW6R.js
7846
- var hubPageWatchParam, pageWatchedBaseSchema, hubPageWatchResponseSchema;
7847
- var init_chunk_NZ6RQW6R = __esm({
7848
- "../../packages/core/dist/chunk-NZ6RQW6R.js"() {
8190
+ // ../../packages/core/dist/chunk-FPSDNS2E.js
8191
+ var noticeSeveritySchema, noticeStatusSchema, NOTICE_SCOPE_REGEX, noticeScopeSchema, noticeLinkSchema, createNoticeBody, updateNoticeBody, listNoticesQuery, noticeIdParamSchema;
8192
+ var init_chunk_FPSDNS2E = __esm({
8193
+ "../../packages/core/dist/chunk-FPSDNS2E.js"() {
7849
8194
  "use strict";
7850
- init_chunk_2DXRB6DR();
7851
- init_chunk_FBV7NLKO();
7852
- init_chunk_HZ6CADSY();
7853
8195
  init_zod();
7854
- hubPageWatchParam = external_exports.object({ hub_id: uuidSchema, slug: pageSlugSchema, watch_id: uuidSchema });
7855
- pageWatchedBaseSchema = toolsetConnectionBindingSchema.pick({ base_id: true, environment: true });
7856
- hubPageWatchResponseSchema = external_exports.object({
7857
- data: external_exports.object({ bases: external_exports.array(pageWatchedBaseSchema), expires_at: timestampSchema.nullable(), org_id: uuidSchema })
8196
+ noticeSeveritySchema = external_exports.enum(["critical", "warn", "info"]);
8197
+ noticeStatusSchema = external_exports.enum(["active", "resolved"]);
8198
+ NOTICE_SCOPE_REGEX = /^(global|provider:[a-z0-9_-]{1,40}|service:[a-z0-9_-]{1,40})$/;
8199
+ noticeScopeSchema = external_exports.string().regex(NOTICE_SCOPE_REGEX, "scope must be 'global', 'provider:<x>', or 'service:<x>'");
8200
+ noticeLinkSchema = external_exports.string().url().refine((u) => /^https?:\/\//i.test(u), { message: "link must be an http(s) URL" });
8201
+ createNoticeBody = external_exports.object({
8202
+ severity: noticeSeveritySchema.default("info"),
8203
+ scope: noticeScopeSchema.default("global"),
8204
+ title: external_exports.string().trim().min(1).max(200),
8205
+ body: external_exports.string().max(2e3).optional(),
8206
+ link: noticeLinkSchema.optional(),
8207
+ starts_at: external_exports.string().datetime().optional(),
8208
+ ends_at: external_exports.string().datetime().optional()
8209
+ });
8210
+ updateNoticeBody = external_exports.object({
8211
+ severity: noticeSeveritySchema.optional(),
8212
+ scope: noticeScopeSchema.optional(),
8213
+ title: external_exports.string().trim().min(1).max(200).optional(),
8214
+ body: external_exports.string().max(2e3).nullable().optional(),
8215
+ link: noticeLinkSchema.nullable().optional(),
8216
+ starts_at: external_exports.string().datetime().optional(),
8217
+ ends_at: external_exports.string().datetime().nullable().optional()
8218
+ }).refine((b) => Object.keys(b).length > 0, { message: "at least one field must be provided" });
8219
+ listNoticesQuery = external_exports.object({
8220
+ status: noticeStatusSchema.optional(),
8221
+ limit: external_exports.coerce.number().int().min(1).max(200).optional(),
8222
+ offset: external_exports.coerce.number().int().min(0).optional()
7858
8223
  });
8224
+ noticeIdParamSchema = external_exports.object({ id: external_exports.string().min(1) });
7859
8225
  }
7860
8226
  });
7861
8227
 
@@ -11814,422 +12180,64 @@ var init_chunk_Y6NC5CH5 = __esm({
11814
12180
  /**
11815
12181
  * The call's recording, present only when the query asks for it (`include_recording=true`);
11816
12182
  * null while there is none: its voice agent does not record calls, the recording is still
11817
- * being finished (call control registers it on the conversation shortly after the call ends),
11818
- * or it could not be finished. Absent from a server that predates it, which reads as none.
11819
- * The record itself is readable until the daily cleanup reaps the ended conversation, the
11820
- * hub's `conversation_retention_days` after it was archived.
11821
- */
11822
- recording: evalCallRecording.nullable().optional(),
11823
- /**
11824
- * The call's page in the web app (`evalCallWebPath`, on the backend's own web origin); null
11825
- * when the backend has no usable web origin. Absent from a server that predates it.
11826
- */
11827
- web_url: external_exports.string().url().nullable().optional()
11828
- });
11829
- evalCallFinishResponse = external_exports.object({
11830
- success: external_exports.literal(true),
11831
- /** The conversation's status after the request: always closed. */
11832
- conversation_status: external_exports.literal("ended")
11833
- });
11834
- }
11835
- });
11836
-
11837
- // ../../packages/core/dist/chunk-C4HEZ7ZI.js
11838
- var downloadBody, uploadQuery, SIGN_URL_MAX_EXPIRES_IN_SECONDS, signUrlBody;
11839
- var init_chunk_C4HEZ7ZI = __esm({
11840
- "../../packages/core/dist/chunk-C4HEZ7ZI.js"() {
11841
- "use strict";
11842
- init_chunk_CJ3L46X6();
11843
- init_zod();
11844
- downloadBody = external_exports.object({
11845
- type: external_exports.enum(["workspace", "agent_instructions"]),
11846
- agent_id: external_exports.string().uuid().optional(),
11847
- organization_name: external_exports.string().optional()
11848
- });
11849
- uploadQuery = external_exports.object({
11850
- type: external_exports.enum(["agent_instructions"]),
11851
- agent_id: external_exports.string().uuid(),
11852
- hub_id: external_exports.string().uuid()
11853
- });
11854
- SIGN_URL_MAX_EXPIRES_IN_SECONDS = 3600;
11855
- signUrlBody = external_exports.object({
11856
- bucket: external_exports.string(),
11857
- filePath: external_exports.string(),
11858
- expiresIn: external_exports.number().int().positive().max(SIGN_URL_MAX_EXPIRES_IN_SECONDS).optional()
11859
- });
11860
- }
11861
- });
11862
-
11863
- // ../../packages/core/dist/chunk-IR2NOSI3.js
11864
- var adminSetGuideHubBody, GUIDE_HUB_INELIGIBLE_REASON;
11865
- var init_chunk_IR2NOSI3 = __esm({
11866
- "../../packages/core/dist/chunk-IR2NOSI3.js"() {
11867
- "use strict";
11868
- init_chunk_HZ6CADSY();
11869
- init_zod();
11870
- adminSetGuideHubBody = external_exports.object({
11871
- hub_id: uuidSchema,
11872
- dry_run: external_exports.boolean().optional()
11873
- }).strict();
11874
- GUIDE_HUB_INELIGIBLE_REASON = "guide_hub_ineligible";
11875
- }
11876
- });
11877
-
11878
- // ../../packages/core/dist/chunk-6J742GLA.js
11879
- var PEOPLE_THREAD_MESSAGE_MAX_LENGTH, PEOPLE_THREAD_MESSAGES_PAGE_MAX, PEOPLE_THREAD_PAGE_MAX, PEOPLE_THREAD_PAGE_DEFAULT, PEOPLE_GROUP_NAME_MAX_LENGTH, PEOPLE_GROUP_AVATAR_URL_MAX_LENGTH, PEOPLE_THREAD_ATTACHMENT_MAX_BYTES, PEOPLE_THREAD_ATTACHMENT_NAME_MAX_LENGTH, PEOPLE_ATTACHMENT_STORAGE_PER_USER_BYTES, PEOPLE_THREAD_ATTACHMENT_MAX_MB, PEOPLE_THREAD_ATTACHMENT_URL_TTL_SECONDS, PEOPLE_THREAD_ATTACHMENT_URLS_MAX, peopleThreadIdParam, peopleThreadMessageIdParam, peopleThreadListQuery, peopleThreadMessagesQuery, peopleThreadAttachmentUploadSchema, peopleThreadSendBody, peopleThreadAttachmentUrlsBody, peopleThreadReadBody, peopleThreadSettingsBody, peopleGroupNameSchema, peopleGroupAvatarUrlSchema, peopleGroupCreateBody, peopleOrgDirectBody, peopleGroupUpdateBody, peopleGroupInviteBody, peopleOrgErasureBody, peopleGroupLeaveBody, peopleGroupInviteIdParam, peopleGroupIncomingInviteIdParam, peopleGroupMemberParam, peopleThreadKindSchema, peopleThreadMemberSchema, peopleThreadLastMessageSchema, peopleGroupRoleSchema, peopleGroupSummarySchema, peopleThreadSummarySchema, peopleThreadAttachmentSchema, peopleThreadMessageSchema, peopleGroupMemberSchema, peopleGroupSentInviteSchema, peopleGroupIncomingInviteSchema;
11880
- var init_chunk_6J742GLA = __esm({
11881
- "../../packages/core/dist/chunk-6J742GLA.js"() {
11882
- "use strict";
11883
- init_chunk_ZVXO3XL6();
11884
- init_chunk_HZ6CADSY();
11885
- init_zod();
11886
- PEOPLE_THREAD_MESSAGE_MAX_LENGTH = 4e3;
11887
- PEOPLE_THREAD_MESSAGES_PAGE_MAX = 50;
11888
- PEOPLE_THREAD_PAGE_MAX = 100;
11889
- PEOPLE_THREAD_PAGE_DEFAULT = 50;
11890
- PEOPLE_GROUP_NAME_MAX_LENGTH = 100;
11891
- PEOPLE_GROUP_AVATAR_URL_MAX_LENGTH = 2048;
11892
- PEOPLE_THREAD_ATTACHMENT_MAX_BYTES = 7 * 1024 * 1024;
11893
- PEOPLE_THREAD_ATTACHMENT_NAME_MAX_LENGTH = 255;
11894
- PEOPLE_ATTACHMENT_STORAGE_PER_USER_BYTES = 1024 * 1024 * 1024;
11895
- PEOPLE_THREAD_ATTACHMENT_MAX_MB = Math.floor(PEOPLE_THREAD_ATTACHMENT_MAX_BYTES / (1024 * 1024));
11896
- PEOPLE_THREAD_ATTACHMENT_URL_TTL_SECONDS = 15 * 60;
11897
- PEOPLE_THREAD_ATTACHMENT_URLS_MAX = PEOPLE_THREAD_MESSAGES_PAGE_MAX;
11898
- peopleThreadIdParam = external_exports.object({ threadId: uuidSchema });
11899
- peopleThreadMessageIdParam = external_exports.object({ threadId: uuidSchema, messageId: uuidSchema });
11900
- peopleThreadListQuery = external_exports.object({
11901
- cursor: external_exports.string().min(1).max(256).optional(),
11902
- limit: external_exports.coerce.number().int().min(1).max(PEOPLE_THREAD_PAGE_MAX).default(PEOPLE_THREAD_PAGE_DEFAULT)
11903
- });
11904
- peopleThreadMessagesQuery = external_exports.object({
11905
- before_seq: external_exports.coerce.number().int().min(1).optional(),
11906
- limit: external_exports.coerce.number().int().min(1).max(PEOPLE_THREAD_MESSAGES_PAGE_MAX).default(PEOPLE_THREAD_MESSAGES_PAGE_MAX)
11907
- });
11908
- peopleThreadAttachmentUploadSchema = external_exports.object({
11909
- file_name: external_exports.string().trim().min(1).max(PEOPLE_THREAD_ATTACHMENT_NAME_MAX_LENGTH),
11910
- file_binary: external_exports.string().min(1)
11911
- }).strict();
11912
- peopleThreadSendBody = external_exports.object({
11913
- body: external_exports.string().max(PEOPLE_THREAD_MESSAGE_MAX_LENGTH).default(""),
11914
- client_message_id: uuidSchema.optional(),
11915
- attachment: peopleThreadAttachmentUploadSchema.optional()
11916
- }).strict().refine((b) => b.body.trim().length > 0 || b.attachment !== void 0, {
11917
- message: "must not be empty",
11918
- path: ["body"]
11919
- });
11920
- peopleThreadAttachmentUrlsBody = external_exports.object({ attachment_ids: external_exports.array(uuidSchema).min(1).max(PEOPLE_THREAD_ATTACHMENT_URLS_MAX) }).strict();
11921
- peopleThreadReadBody = external_exports.object({ seq: external_exports.number().int().min(0) }).strict();
11922
- peopleThreadSettingsBody = external_exports.object({
11923
- muted: external_exports.boolean().optional(),
11924
- hidden: external_exports.boolean().optional()
11925
- }).strict().refine((b) => b.muted !== void 0 || b.hidden !== void 0, "nothing to change");
11926
- peopleGroupNameSchema = external_exports.string().trim().min(1).max(PEOPLE_GROUP_NAME_MAX_LENGTH);
11927
- peopleGroupAvatarUrlSchema = external_exports.string().max(PEOPLE_GROUP_AVATAR_URL_MAX_LENGTH).url().refine((s) => s.startsWith("https://"), "must be an https URL");
11928
- peopleGroupCreateBody = external_exports.object({
11929
- name: peopleGroupNameSchema,
11930
- avatar_url: peopleGroupAvatarUrlSchema.nullable().optional(),
11931
- org_id: uuidSchema.optional()
11932
- }).strict();
11933
- peopleOrgDirectBody = external_exports.object({
11934
- org_id: uuidSchema,
11935
- user_id: peopleUserIdSchema
11936
- }).strict();
11937
- peopleGroupUpdateBody = external_exports.object({
11938
- name: peopleGroupNameSchema.optional(),
11939
- avatar_url: peopleGroupAvatarUrlSchema.nullable().optional()
11940
- }).strict().refine((b) => b.name !== void 0 || b.avatar_url !== void 0, "nothing to change");
11941
- peopleGroupInviteBody = external_exports.union([
11942
- external_exports.object({ user_id: peopleUserIdSchema }).strict(),
11943
- external_exports.object({ email: peopleInviteEmailSchema }).strict()
11944
- ]);
11945
- peopleOrgErasureBody = external_exports.object({
11946
- org_id: uuidSchema,
11947
- email: peopleInviteEmailSchema
11948
- }).strict();
11949
- peopleGroupLeaveBody = external_exports.object({ delete_my_messages: external_exports.boolean().optional() }).strict();
11950
- peopleGroupInviteIdParam = external_exports.object({ threadId: uuidSchema, inviteId: uuidSchema });
11951
- peopleGroupIncomingInviteIdParam = external_exports.object({ inviteId: uuidSchema });
11952
- peopleGroupMemberParam = external_exports.object({ threadId: uuidSchema, userId: peopleUserIdSchema });
11953
- peopleThreadKindSchema = external_exports.enum(["dm", "group"]);
11954
- peopleThreadMemberSchema = external_exports.object({
11955
- user_id: peopleUserIdSchema,
11956
- display_name: external_exports.string().nullable(),
11957
- deleted_user: external_exports.boolean()
11958
- }).strict();
11959
- peopleThreadLastMessageSchema = external_exports.object({
11960
- message_id: uuidSchema,
11961
- seq: external_exports.number().int().positive(),
11962
- author_user_id: peopleUserIdSchema,
11963
- preview: external_exports.string().nullable(),
11964
- deleted: external_exports.boolean(),
11965
- created_at: timestampSchema
11966
- }).strict();
11967
- peopleGroupRoleSchema = external_exports.enum(["admin", "member"]);
11968
- peopleGroupSummarySchema = external_exports.object({
11969
- membership: external_exports.enum(["member", "removed", "left"]),
11970
- role: peopleGroupRoleSchema.nullable(),
11971
- avatar_url: external_exports.string().nullable()
11972
- }).strict();
11973
- peopleThreadSummarySchema = external_exports.object({
11974
- thread_id: uuidSchema,
11975
- kind: peopleThreadKindSchema,
11976
- org_id: external_exports.string().nullable(),
11977
- org_name: external_exports.string().nullable(),
11978
- title: external_exports.string().nullable(),
11979
- counterpart: peopleThreadMemberSchema.nullable(),
11980
- last_seq: external_exports.number().int().nonnegative(),
11981
- last_message: peopleThreadLastMessageSchema.nullable(),
11982
- last_activity_at: timestampSchema,
11983
- read_seq: external_exports.number().int().nonnegative(),
11984
- unread_count: external_exports.number().int().nonnegative(),
11985
- muted: external_exports.boolean(),
11986
- hidden: external_exports.boolean(),
11987
- writable: external_exports.boolean(),
11988
- group: peopleGroupSummarySchema.nullable().optional(),
11989
- version: external_exports.number().int().nonnegative().optional()
11990
- }).strict();
11991
- peopleThreadAttachmentSchema = external_exports.object({
11992
- attachment_id: uuidSchema,
11993
- file_name: external_exports.string(),
11994
- content_type: external_exports.string(),
11995
- size_bytes: external_exports.number().int().positive()
11996
- }).strict();
11997
- peopleThreadMessageSchema = external_exports.object({
11998
- message_id: uuidSchema,
11999
- seq: external_exports.number().int().positive(),
12000
- author_user_id: peopleUserIdSchema,
12001
- body: external_exports.string().nullable(),
12002
- deleted: external_exports.boolean(),
12003
- created_at: timestampSchema,
12004
- deleted_at: timestampSchema.nullable(),
12005
- client_message_id: uuidSchema.nullable(),
12006
- attachment: peopleThreadAttachmentSchema.nullable().optional()
12007
- }).strict();
12008
- peopleGroupMemberSchema = peopleThreadMemberSchema.extend({ role: peopleGroupRoleSchema, joined_at: timestampSchema }).strict();
12009
- peopleGroupSentInviteSchema = external_exports.object({
12010
- invite_id: uuidSchema,
12011
- invitee: peopleThreadMemberSchema,
12012
- invitee_email: external_exports.string().nullable().optional(),
12013
- status: external_exports.literal("sent"),
12014
- created_at: timestampSchema,
12015
- expires_at: timestampSchema
12016
- }).strict();
12017
- peopleGroupIncomingInviteSchema = external_exports.object({
12018
- invite_id: uuidSchema,
12019
- thread_id: uuidSchema,
12020
- kind: peopleThreadKindSchema.optional(),
12021
- group: external_exports.object({ name: external_exports.string() }).strict(),
12022
- org: external_exports.object({ org_id: external_exports.string(), org_name: external_exports.string().nullable() }).strict().nullable().optional(),
12023
- inviter: external_exports.object({ user_id: peopleUserIdSchema, display_name: external_exports.string().nullable(), email: external_exports.string().nullable() }).strict(),
12024
- created_at: timestampSchema,
12025
- expires_at: timestampSchema
12026
- }).strict();
12183
+ * being finished (call control registers it on the conversation shortly after the call ends),
12184
+ * or it could not be finished. Absent from a server that predates it, which reads as none.
12185
+ * The record itself is readable until the daily cleanup reaps the ended conversation, the
12186
+ * hub's `conversation_retention_days` after it was archived.
12187
+ */
12188
+ recording: evalCallRecording.nullable().optional(),
12189
+ /**
12190
+ * The call's page in the web app (`evalCallWebPath`, on the backend's own web origin); null
12191
+ * when the backend has no usable web origin. Absent from a server that predates it.
12192
+ */
12193
+ web_url: external_exports.string().url().nullable().optional()
12194
+ });
12195
+ evalCallFinishResponse = external_exports.object({
12196
+ success: external_exports.literal(true),
12197
+ /** The conversation's status after the request: always closed. */
12198
+ conversation_status: external_exports.literal("ended")
12199
+ });
12027
12200
  }
12028
12201
  });
12029
12202
 
12030
- // ../../packages/core/dist/chunk-6AYIXGDT.js
12031
- var COMMUNITIES_PER_ORG_MAX, COMMUNITY_NAME_MAX_LENGTH, COMMUNITY_REGISTRY_CLOSED_REASON, COMMUNITY_MEMBERS_MAX, COMMUNITY_ADMISSIONS, COMMUNITY_ACCESS_MAX, COMMUNITY_ACCESS_ADD_MAX, COMMUNITY_ACCESS_FULL_REASON, COMMUNITY_JOIN_SOURCE_MAX_LENGTH, COMMUNITY_JOIN_FLOW_TOKEN_MAX_LENGTH, COMMUNITY_ROOMS_MAX, COMMUNITY_ROOM_NAME_MAX_LENGTH, COMMUNITY_MESSAGE_MAX_LENGTH, COMMUNITY_MESSAGES_PAGE_SIZE, COMMUNITY_ATTACHMENT_URLS_MAX, COMMUNITY_POST_TITLE_MAX_LENGTH, COMMUNITY_POST_SEARCH_MAX_LENGTH, COMMUNITY_MEMBER_STATUSES, COMMUNITY_RULES_MAX_LENGTH, COMMUNITY_SLOW_MODE_MAX_SECONDS, COMMUNITY_COURSES_LABEL_MAX_LENGTH, COMMUNITY_LIVE_TICKET_PREFIX, COMMUNITY_STATS_DAYS, communityNameSchema, adminCreateCommunityBody, communityIdParam, communityJoinTokenSchema, communityJoinSourceSchema, communityJoinPreviewQuery, communityJoinBody, communityRoomKindSchema, communityRoomNameSchema, communityRoomIdParam, communityMessageIdParam, communityRoomCreateBody, communityRoomUpdateBody, communityMessagesQuery, communityMessageBodySchema, communityPostTitleSchema, communityAttachmentUploadSchema, communitySendBody, communityEditBody, communityPostIdParam, communityPostsQuery, communityAnswerBody, communityReadBody, communityAttachmentUrlsBody, communityPersonParam, communityOrgParam, communityPeopleQuery, communityCoursesLabelSchema, communityAdmissionSchema, communitySettingsBody, communityAccessEmailSchema, communityAccessAddBody, communityAccessQuery, communityAccessIdParam, communityBanBody, communityLockBody, communityPinBody, communityModLogQuery, communityReportsQuery, communityReportIdParam, communityLiveTicketSchema, communityLiveQuery, communityMuteBody, communityEmailUnsubscribeTokenSchema, communityEmailUnsubscribeQuery;
12032
- var init_chunk_6AYIXGDT = __esm({
12033
- "../../packages/core/dist/chunk-6AYIXGDT.js"() {
12203
+ // ../../packages/core/dist/chunk-C4HEZ7ZI.js
12204
+ var downloadBody, uploadQuery, SIGN_URL_MAX_EXPIRES_IN_SECONDS, signUrlBody;
12205
+ var init_chunk_C4HEZ7ZI = __esm({
12206
+ "../../packages/core/dist/chunk-C4HEZ7ZI.js"() {
12034
12207
  "use strict";
12035
- init_chunk_UAOHHCW5();
12036
- init_chunk_6J742GLA();
12037
- init_chunk_ZVXO3XL6();
12038
- init_chunk_HZ6CADSY();
12208
+ init_chunk_CJ3L46X6();
12039
12209
  init_zod();
12040
- COMMUNITIES_PER_ORG_MAX = 10;
12041
- COMMUNITY_NAME_MAX_LENGTH = 100;
12042
- COMMUNITY_REGISTRY_CLOSED_REASON = "community_registry_closed";
12043
- COMMUNITY_MEMBERS_MAX = 1e4;
12044
- COMMUNITY_ADMISSIONS = ["link", "invite"];
12045
- COMMUNITY_ACCESS_MAX = COMMUNITY_MEMBERS_MAX;
12046
- COMMUNITY_ACCESS_ADD_MAX = 500;
12047
- COMMUNITY_ACCESS_FULL_REASON = "community_access_full";
12048
- COMMUNITY_JOIN_SOURCE_MAX_LENGTH = 32;
12049
- COMMUNITY_JOIN_FLOW_TOKEN_MAX_LENGTH = 128;
12050
- COMMUNITY_ROOMS_MAX = 20;
12051
- COMMUNITY_ROOM_NAME_MAX_LENGTH = 100;
12052
- COMMUNITY_MESSAGE_MAX_LENGTH = 4e3;
12053
- COMMUNITY_MESSAGES_PAGE_SIZE = 50;
12054
- COMMUNITY_ATTACHMENT_URLS_MAX = COMMUNITY_MESSAGES_PAGE_SIZE + 2;
12055
- COMMUNITY_POST_TITLE_MAX_LENGTH = 200;
12056
- COMMUNITY_POST_SEARCH_MAX_LENGTH = 100;
12057
- COMMUNITY_MEMBER_STATUSES = ["active", "left", "removed", "banned"];
12058
- COMMUNITY_RULES_MAX_LENGTH = 4e3;
12059
- COMMUNITY_SLOW_MODE_MAX_SECONDS = 21600;
12060
- COMMUNITY_COURSES_LABEL_MAX_LENGTH = 16;
12061
- COMMUNITY_LIVE_TICKET_PREFIX = "cst";
12062
- COMMUNITY_STATS_DAYS = 30;
12063
- communityNameSchema = external_exports.string().trim().min(1).max(COMMUNITY_NAME_MAX_LENGTH);
12064
- adminCreateCommunityBody = external_exports.object({ org_id: uuidSchema, name: communityNameSchema }).strict();
12065
- communityIdParam = external_exports.object({ communityId: uuidSchema });
12066
- communityJoinTokenSchema = external_exports.string().regex(/^[0-9a-f]{32}$/);
12067
- communityJoinSourceSchema = external_exports.string().regex(new RegExp(`^[a-z0-9_-]{1,${COMMUNITY_JOIN_SOURCE_MAX_LENGTH}}$`));
12068
- communityJoinPreviewQuery = external_exports.object({ c: uuidSchema, k: communityJoinTokenSchema });
12069
- communityJoinBody = external_exports.object({
12070
- token: communityJoinTokenSchema,
12071
- src: communityJoinSourceSchema.optional(),
12072
- flow_token: external_exports.string().max(COMMUNITY_JOIN_FLOW_TOKEN_MAX_LENGTH).optional()
12073
- }).strict();
12074
- communityRoomKindSchema = external_exports.enum(["discussion", "forum", "announcements"]);
12075
- communityRoomNameSchema = external_exports.string().trim().min(1).max(COMMUNITY_ROOM_NAME_MAX_LENGTH);
12076
- communityRoomIdParam = external_exports.object({ communityId: uuidSchema, roomId: uuidSchema });
12077
- communityMessageIdParam = external_exports.object({ communityId: uuidSchema, roomId: uuidSchema, messageId: uuidSchema });
12078
- communityRoomCreateBody = external_exports.object({ kind: communityRoomKindSchema, name: communityRoomNameSchema, client_id: uuidSchema.optional() }).strict();
12079
- communityRoomUpdateBody = external_exports.object({ name: communityRoomNameSchema.optional(), archived: external_exports.boolean().optional() }).strict().refine((b) => b.name !== void 0 || b.archived !== void 0, "nothing to change");
12080
- communityMessagesQuery = external_exports.object({
12081
- before: external_exports.coerce.number().int().min(1).optional(),
12082
- after: external_exports.coerce.number().int().min(0).optional()
12083
- }).refine((q) => q.before === void 0 || q.after === void 0, "before and after cannot be combined");
12084
- communityMessageBodySchema = external_exports.string().max(COMMUNITY_MESSAGE_MAX_LENGTH).refine((body) => body.trim().length > 0, "must not be empty");
12085
- communityPostTitleSchema = external_exports.string().trim().min(1).max(COMMUNITY_POST_TITLE_MAX_LENGTH);
12086
- communityAttachmentUploadSchema = peopleThreadAttachmentUploadSchema;
12087
- communitySendBody = external_exports.object({
12088
- body: external_exports.string().max(COMMUNITY_MESSAGE_MAX_LENGTH).default(""),
12089
- client_message_id: uuidSchema.optional(),
12090
- title: communityPostTitleSchema.optional(),
12091
- parent_message_id: uuidSchema.optional(),
12092
- attachment: communityAttachmentUploadSchema.optional()
12093
- }).strict().refine((b) => b.title === void 0 || b.parent_message_id === void 0, "a post is not a reply: send a title or a parent_message_id, not both").refine((b) => b.body.trim().length > 0 || b.attachment !== void 0, { message: "must not be empty", path: ["body"] });
12094
- communityEditBody = external_exports.object({ body: communityMessageBodySchema, title: communityPostTitleSchema.optional() }).strict();
12095
- communityPostIdParam = external_exports.object({ communityId: uuidSchema, roomId: uuidSchema, postId: uuidSchema });
12096
- communityPostsQuery = external_exports.object({
12097
- before_activity: external_exports.coerce.number().int().min(1).optional(),
12098
- q: optionalTrimmedText(COMMUNITY_POST_SEARCH_MAX_LENGTH),
12099
- unanswered: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true")
12210
+ downloadBody = external_exports.object({
12211
+ type: external_exports.enum(["workspace", "agent_instructions"]),
12212
+ agent_id: external_exports.string().uuid().optional(),
12213
+ organization_name: external_exports.string().optional()
12100
12214
  });
12101
- communityAnswerBody = external_exports.object({ reply_id: uuidSchema.nullable() }).strict();
12102
- communityReadBody = external_exports.object({ seq: external_exports.number().int().min(0) }).strict();
12103
- communityAttachmentUrlsBody = external_exports.object({ attachment_ids: external_exports.array(uuidSchema).min(1).max(COMMUNITY_ATTACHMENT_URLS_MAX) }).strict();
12104
- communityPersonParam = external_exports.object({ communityId: uuidSchema, userId: peopleUserIdSchema });
12105
- communityOrgParam = external_exports.object({ orgId: uuidSchema });
12106
- communityPeopleQuery = external_exports.object({ after: peopleUserIdSchema.optional() });
12107
- communityCoursesLabelSchema = external_exports.string().trim().max(COMMUNITY_COURSES_LABEL_MAX_LENGTH);
12108
- communityAdmissionSchema = external_exports.enum(COMMUNITY_ADMISSIONS);
12109
- communitySettingsBody = external_exports.object({
12110
- name: communityNameSchema.optional(),
12111
- rules: external_exports.string().trim().max(COMMUNITY_RULES_MAX_LENGTH).nullable().optional().transform((rules) => rules === "" ? null : rules),
12112
- slow_mode_seconds: external_exports.number().int().min(0).max(COMMUNITY_SLOW_MODE_MAX_SECONDS).optional(),
12113
- courses_label: communityCoursesLabelSchema.optional(),
12114
- admission: communityAdmissionSchema.optional()
12115
- }).strict().refine(
12116
- (b) => b.name !== void 0 || b.rules !== void 0 || b.slow_mode_seconds !== void 0 || b.courses_label !== void 0 || b.admission !== void 0,
12117
- "nothing to change"
12118
- );
12119
- communityAccessEmailSchema = external_exports.string().trim().toLowerCase().max(CONTACT_EMAIL_MAX).email();
12120
- communityAccessAddBody = external_exports.object({ emails: external_exports.array(communityAccessEmailSchema).min(1).max(COMMUNITY_ACCESS_ADD_MAX) }).strict();
12121
- communityAccessQuery = external_exports.object({ cursor: external_exports.string().min(1).max(256).optional() });
12122
- communityAccessIdParam = external_exports.object({ communityId: uuidSchema, accessId: uuidSchema });
12123
- communityBanBody = external_exports.object({ delete_messages: external_exports.boolean().optional() }).strict();
12124
- communityLockBody = external_exports.object({ locked: external_exports.boolean() }).strict();
12125
- communityPinBody = external_exports.object({ pinned: external_exports.boolean() }).strict();
12126
- communityModLogQuery = external_exports.object({ before: external_exports.coerce.number().int().min(1).optional() });
12127
- communityReportsQuery = communityModLogQuery.extend({
12128
- pending: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true")
12215
+ uploadQuery = external_exports.object({
12216
+ type: external_exports.enum(["agent_instructions"]),
12217
+ agent_id: external_exports.string().uuid(),
12218
+ hub_id: external_exports.string().uuid()
12219
+ });
12220
+ SIGN_URL_MAX_EXPIRES_IN_SECONDS = 3600;
12221
+ signUrlBody = external_exports.object({
12222
+ bucket: external_exports.string(),
12223
+ filePath: external_exports.string(),
12224
+ expiresIn: external_exports.number().int().positive().max(SIGN_URL_MAX_EXPIRES_IN_SECONDS).optional()
12129
12225
  });
12130
- communityReportIdParam = external_exports.object({ communityId: uuidSchema, reportId: uuidSchema });
12131
- communityLiveTicketSchema = external_exports.string().regex(new RegExp(`^${COMMUNITY_LIVE_TICKET_PREFIX}_[A-Za-z0-9_-]{43}$`));
12132
- communityLiveQuery = external_exports.object({ ticket: communityLiveTicketSchema });
12133
- communityMuteBody = external_exports.object({ muted: external_exports.boolean() }).strict();
12134
- communityEmailUnsubscribeTokenSchema = external_exports.string().max(200).regex(/^[0-9a-f-]{36}\.[A-Za-z0-9_-]{1,64}\.[0-9a-f]{64}$/i);
12135
- communityEmailUnsubscribeQuery = external_exports.object({ token: communityEmailUnsubscribeTokenSchema });
12136
12226
  }
12137
12227
  });
12138
12228
 
12139
- // ../../packages/core/dist/chunk-47LPEX74.js
12140
- function parseCommunityLessonVideoUrl(url) {
12141
- const parts = /^https?:\/\/([^/?#]+)([^?#]*)(?:\?([^#]*))?(?:#.*)?$/i.exec(url.trim());
12142
- if (!parts) return null;
12143
- const host = parts[1].toLowerCase();
12144
- const path45 = parts[2] ?? "";
12145
- const query = parts[3] ?? "";
12146
- let id;
12147
- if (host === YOUTU_BE) {
12148
- id = /^\/([A-Za-z0-9_-]{11})\/?$/.exec(path45)?.[1];
12149
- } else if (YOUTUBE_HOSTS.has(host)) {
12150
- if (path45 === "/watch" || path45 === "/watch/") {
12151
- id = query.split("&").find((param) => param.startsWith("v="))?.slice(2);
12152
- } else {
12153
- id = YOUTUBE_ID_PATH.exec(path45)?.[1];
12154
- }
12155
- }
12156
- return id !== void 0 && YOUTUBE_ID.test(id) ? { provider: "youtube", id } : null;
12157
- }
12158
- function communityLessonVideoWatchUrl(video) {
12159
- switch (video.provider) {
12160
- case "youtube":
12161
- return `https://www.youtube.com/watch?v=${video.id}`;
12162
- }
12163
- }
12164
- var COMMUNITY_COURSES_MAX, COMMUNITY_COURSE_MODULES_MAX, COMMUNITY_COURSE_LESSONS_MAX, COMMUNITY_LESSONS_MAX, COMMUNITY_COURSE_TITLE_MAX_LENGTH, COMMUNITY_COURSE_DESCRIPTION_MAX_LENGTH, COMMUNITY_LESSON_BODY_MAX_LENGTH, COMMUNITY_LESSON_LINKS_MAX, COMMUNITY_LESSON_URL_MAX_LENGTH, YOUTUBE_ID, YOUTUBE_HOSTS, YOUTU_BE, YOUTUBE_ID_PATH, communityCourseIdParam, communityCourseModuleIdParam, communityLessonIdParam, communityCourseTitleSchema, communityCourseDescriptionSchema, communityCoursePositionSchema, communityLessonVideoUrlSchema, communityLessonLinkSchema, communityLessonLinksSchema, communityLessonBodySchema, communityCourseCreateBody, communityCourseUpdateBody, communityModuleCreateBody, communityModuleUpdateBody, communityLessonCreateBody, communityLessonUpdateBody;
12165
- var init_chunk_47LPEX74 = __esm({
12166
- "../../packages/core/dist/chunk-47LPEX74.js"() {
12229
+ // ../../packages/core/dist/chunk-IR2NOSI3.js
12230
+ var adminSetGuideHubBody, GUIDE_HUB_INELIGIBLE_REASON;
12231
+ var init_chunk_IR2NOSI3 = __esm({
12232
+ "../../packages/core/dist/chunk-IR2NOSI3.js"() {
12167
12233
  "use strict";
12168
- init_chunk_6AYIXGDT();
12169
12234
  init_chunk_HZ6CADSY();
12170
12235
  init_zod();
12171
- COMMUNITY_COURSES_MAX = 20;
12172
- COMMUNITY_COURSE_MODULES_MAX = 20;
12173
- COMMUNITY_COURSE_LESSONS_MAX = 100;
12174
- COMMUNITY_LESSONS_MAX = 500;
12175
- COMMUNITY_COURSE_TITLE_MAX_LENGTH = 200;
12176
- COMMUNITY_COURSE_DESCRIPTION_MAX_LENGTH = 2e3;
12177
- COMMUNITY_LESSON_BODY_MAX_LENGTH = 2e4;
12178
- COMMUNITY_LESSON_LINKS_MAX = 10;
12179
- COMMUNITY_LESSON_URL_MAX_LENGTH = 2e3;
12180
- YOUTUBE_ID = /^[A-Za-z0-9_-]{11}$/;
12181
- YOUTUBE_HOSTS = /* @__PURE__ */ new Set(["youtube.com", "www.youtube.com", "m.youtube.com", "youtube-nocookie.com", "www.youtube-nocookie.com"]);
12182
- YOUTU_BE = "youtu.be";
12183
- YOUTUBE_ID_PATH = /^\/(?:embed|shorts|live|v)\/([A-Za-z0-9_-]{11})\/?$/;
12184
- communityCourseIdParam = external_exports.object({ communityId: uuidSchema, courseId: uuidSchema });
12185
- communityCourseModuleIdParam = external_exports.object({ communityId: uuidSchema, courseId: uuidSchema, moduleId: uuidSchema });
12186
- communityLessonIdParam = external_exports.object({ communityId: uuidSchema, courseId: uuidSchema, lessonId: uuidSchema });
12187
- communityCourseTitleSchema = external_exports.string().trim().min(1).max(COMMUNITY_COURSE_TITLE_MAX_LENGTH);
12188
- communityCourseDescriptionSchema = external_exports.string().trim().max(COMMUNITY_COURSE_DESCRIPTION_MAX_LENGTH);
12189
- communityCoursePositionSchema = external_exports.number().int().min(0);
12190
- communityLessonVideoUrlSchema = external_exports.string().trim().max(COMMUNITY_LESSON_URL_MAX_LENGTH).transform((url, ctx) => {
12191
- const video = parseCommunityLessonVideoUrl(url);
12192
- if (video) return video;
12193
- ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: "Only a YouTube video URL is accepted" });
12194
- return external_exports.NEVER;
12195
- });
12196
- communityLessonLinkSchema = external_exports.object({
12197
- title: communityCourseTitleSchema,
12198
- url: external_exports.string().trim().max(COMMUNITY_LESSON_URL_MAX_LENGTH).url().refine((url) => /^https?:\/\//i.test(url), "must be an http or https URL")
12199
- }).strict();
12200
- communityLessonLinksSchema = external_exports.array(communityLessonLinkSchema).max(COMMUNITY_LESSON_LINKS_MAX);
12201
- communityLessonBodySchema = external_exports.string().max(COMMUNITY_LESSON_BODY_MAX_LENGTH);
12202
- communityCourseCreateBody = external_exports.object({ title: communityCourseTitleSchema, description: communityCourseDescriptionSchema.optional(), client_id: uuidSchema.optional() }).strict();
12203
- communityCourseUpdateBody = external_exports.object({
12204
- title: communityCourseTitleSchema.optional(),
12205
- description: communityCourseDescriptionSchema.optional(),
12206
- position: communityCoursePositionSchema.optional(),
12207
- published: external_exports.boolean().optional()
12208
- }).strict().refine((b) => Object.values(b).some((value) => value !== void 0), "nothing to change");
12209
- communityModuleCreateBody = external_exports.object({ title: communityCourseTitleSchema, client_id: uuidSchema.optional() }).strict();
12210
- communityModuleUpdateBody = external_exports.object({ title: communityCourseTitleSchema.optional(), position: communityCoursePositionSchema.optional() }).strict().refine((b) => b.title !== void 0 || b.position !== void 0, "nothing to change");
12211
- communityLessonCreateBody = external_exports.object({
12212
- module_id: uuidSchema,
12213
- title: communityCourseTitleSchema,
12214
- video_url: communityLessonVideoUrlSchema.nullable().optional(),
12215
- body: communityLessonBodySchema.optional(),
12216
- links: communityLessonLinksSchema.optional(),
12217
- room_id: uuidSchema.nullable().optional(),
12218
- requires_paid_plan: external_exports.boolean().optional(),
12219
- published: external_exports.boolean().optional(),
12220
- client_id: uuidSchema.optional()
12236
+ adminSetGuideHubBody = external_exports.object({
12237
+ hub_id: uuidSchema,
12238
+ dry_run: external_exports.boolean().optional()
12221
12239
  }).strict();
12222
- communityLessonUpdateBody = external_exports.object({
12223
- module_id: uuidSchema.optional(),
12224
- title: communityCourseTitleSchema.optional(),
12225
- video_url: communityLessonVideoUrlSchema.nullable().optional(),
12226
- body: communityLessonBodySchema.optional(),
12227
- links: communityLessonLinksSchema.optional(),
12228
- room_id: uuidSchema.nullable().optional(),
12229
- requires_paid_plan: external_exports.boolean().optional(),
12230
- position: communityCoursePositionSchema.optional(),
12231
- published: external_exports.boolean().optional()
12232
- }).strict().refine((b) => Object.values(b).some((value) => value !== void 0), "nothing to change");
12240
+ GUIDE_HUB_INELIGIBLE_REASON = "guide_hub_ineligible";
12233
12241
  }
12234
12242
  });
12235
12243
 
@@ -12771,7 +12779,7 @@ var init_chunk_2ISUBJG7 = __esm({
12771
12779
  }
12772
12780
  });
12773
12781
 
12774
- // ../../packages/core/dist/chunk-IW7D2QOD.js
12782
+ // ../../packages/core/dist/chunk-CZEJR5UE.js
12775
12783
  function describeRole(role) {
12776
12784
  if (typeof role === "string") {
12777
12785
  return JSON.stringify(role.length > ROLE_ECHO_MAX ? `${role.slice(0, ROLE_ECHO_MAX)}\u2026` : role);
@@ -12950,11 +12958,11 @@ function terminalRunCount(counts) {
12950
12958
  return counts.successful_runs + counts.failed_runs;
12951
12959
  }
12952
12960
  var evalIdParam, sessionIdParam, scenarioSetIdParam, hubIdQuery, EVAL_FIXTURE_NAME_MAX_LENGTH, evalFixtureOverrideSchema, runSessionQuery, runJourneyQuery, EVAL_INPUT_ROLES, EVAL_INPUT_ROLE_LIST, ROLE_ECHO_MAX, EVAL_INITIAL_STATE_SCOPES, MAX_INITIAL_STATE_ENTRIES, evalInitialStateEntry, EVAL_PERSON_MAX, evalPersonSchema, EVAL_PERSON_ALIAS_RETIRED, EVAL_PERSON_ALIAS_REFUSED, evalBody, EVAL_LIST_MAX_LIMIT, evalListLimit, getEvalsQuery, toggleEvalBody, bulkToggleEvalsBody, pacingConfigSchema, EVAL_MAX_SELECTED_SCENARIOS, evalScenarioSelectionEntrySchema, evalScenarioSelectionSchema, sessionConfigSchema, createSessionBody, getSessionsQuery, getSessionResultsQuery, getSessionRunsQuery, evalAnalyticsQuery, getSessionCostQuery, compareSessionsQuery, evalsSqlBody, evalsSqlSchemaQuery, exportResultsQuery, validateEvalBody, hubAgentsQuery, createScenarioSetBody, updateScenarioSetBody, scenarioSetsHubQuery, createScenarioFromConversationBody, createJourneyFromConversationBody, evalAttachmentRef, turnMayCarryAttachments, ATTACHMENTS_USER_ONLY_MESSAGE, journeyIdParam, journeyToolCallSchema, journeyTurnSchema, journeyStepOverrideSchema, fixtureField, createJourneyBody, updateJourneyBody, evalSessionConfigResponseSchema, evalSessionResponseSchema, evalSessionListConfigSchema, evalSessionListItemSchema, seedReleaseStatusSchema, EVAL_SESSION_NOT_QUIESCENT;
12953
- var init_chunk_IW7D2QOD = __esm({
12954
- "../../packages/core/dist/chunk-IW7D2QOD.js"() {
12961
+ var init_chunk_CZEJR5UE = __esm({
12962
+ "../../packages/core/dist/chunk-CZEJR5UE.js"() {
12955
12963
  "use strict";
12956
- init_chunk_2YEGUQR7();
12957
12964
  init_chunk_4D6K4P4K();
12965
+ init_chunk_2YEGUQR7();
12958
12966
  init_chunk_4LXDRTO4();
12959
12967
  init_chunk_WTOA3ANF();
12960
12968
  init_chunk_2ISUBJG7();
@@ -14028,7 +14036,7 @@ var init_chunk_7NQZRSSJ = __esm({
14028
14036
  }
14029
14037
  });
14030
14038
 
14031
- // ../../packages/core/dist/chunk-JJYZUBYV.js
14039
+ // ../../packages/core/dist/chunk-4WB5E53T.js
14032
14040
  function declaresNoConnection(agent) {
14033
14041
  return agent.connection === null && !agent.connection_id;
14034
14042
  }
@@ -14783,12 +14791,12 @@ function skillSectionsAsResources(scope) {
14783
14791
  };
14784
14792
  }
14785
14793
  var MAX_10MB_BASE64_ENCODED_BYTES, MAX_EVAL_ATTACHMENT_ENCODED_BYTES, MAX_EVAL_ATTACHMENT_CARRIERS, MAX_EVAL_ATTACHMENT_AGGREGATE_ENCODED_BYTES, MAX_RESOURCE_ENCODED_BYTES, MAX_HUB_AS_CODE_RESOURCES, MAX_HUB_AS_CODE_RESOURCE_FILES, MAX_RESOURCE_AGGREGATE_ENCODED_BYTES, MAX_CI_CONFIG_BODY_BYTES, MAX_HUB_AS_CODE_PAGE_MANIFEST_CHARS, hubAsCodePagesSchema, MAX_CALL_OPENING_CARRIERS, MAX_CALL_OPENING_AGGREGATE_ENCODED_BYTES, HUB_AS_CODE_AGENT_TOOL_KEYS, hubAsCodeStateSchema, hubAsCodeResourceFileSchema, hubAsCodeResourceSchema, uuidPattern, ciUuidSchema, flagEntriesOf, boundedHubAsCodeResourcesSchema, isPlainObject, MIN_SKILLS_LAYOUT_CLI, MAX_HUB_AS_CODE_DEPTH, NAMED_DEPTH_SEGMENTS, NAMED_DEPTH_KEY_CHARS, fieldName, hubAsCodeConfigSchema, ciPullHubIdParam, ciBranchParam, ciPullQuery, ciHubsQuery, ciLookupQuery, ciBranchesQuery, ciSyncBody, ciPushBody, ciDiffBody, ciPublishBody, ciPublishPreviewBody, ciSyncMcpBody, ciOrgResourcesParam, orgResourcesConfigSchema, ciOrgResourcesPushBody, ciOrgResourcesDiffBody, CI_APPLY_ENTITY_KINDS, CI_APPLY_OPERATIONS, ciApplyErrorBaseSchema, ciApplyErrorSchema, ciSyncCountSchema, ciSyncChangesSchema, ciSyncWarningSchema, ciSyncResponseSchema;
14786
- var init_chunk_JJYZUBYV = __esm({
14787
- "../../packages/core/dist/chunk-JJYZUBYV.js"() {
14794
+ var init_chunk_4WB5E53T = __esm({
14795
+ "../../packages/core/dist/chunk-4WB5E53T.js"() {
14788
14796
  "use strict";
14789
14797
  init_chunk_NEIVT3KL();
14790
14798
  init_chunk_HRKVCI5A();
14791
- init_chunk_IW7D2QOD();
14799
+ init_chunk_CZEJR5UE();
14792
14800
  init_chunk_LBDH7LCG();
14793
14801
  init_chunk_4LXDRTO4();
14794
14802
  init_chunk_7NQZRSSJ();
@@ -15281,7 +15289,7 @@ var init_chunk_OMPT4ZHR = __esm({
15281
15289
  }
15282
15290
  });
15283
15291
 
15284
- // ../../packages/core/dist/chunk-ZECCDXFH.js
15292
+ // ../../packages/core/dist/chunk-3QME565M.js
15285
15293
  function refineScopedTarget(data, ctx) {
15286
15294
  if (data.scope === "org") {
15287
15295
  if (!data.org_id) {
@@ -15307,8 +15315,8 @@ function refineScopedTarget(data, ctx) {
15307
15315
  }
15308
15316
  }
15309
15317
  var adminOrgIdParam, adminOrgAdminIdParam, adminUserIdParam, PRICING_PLAN_ID_RE, adminPlanIdParam, adminOrganizationsQuery, adminUserSearchQuery, kanbanSlugMigrationQuery, adjustQuotaBody, updatePlanBody, addAdminUserBody, MAX_VOICE_CALL_MINUTE_OPS, voiceCallMinuteOps, AUTOMATION_GATE_EVALUATIONS_PER_OPERATION_BOUND, automationGateEvaluationsPerOperation, AUTOMATION_RUN_RETENTION_DAYS_MAX, automationRunRetentionDays, turnDeadlineSeconds, updatePlatformConfigBody, updateFreeOrgLimitBody, adminScopedTargetShape, adminScopedTargetBody, adminDryRunByDefaultTargetBody, BRANCHING_ORPHAN_ENTITY_TYPES, BRANCHING_ORPHAN_MAX_TARGETS, adminRepairBranchingOrphansBody, adminRepairLegacyOrgGrantsBody, adminRepairCompedPlansBody, updatePricingPlanBody, dataExplorerSearchQuery, dataExplorerOrgIdParam, dataExplorerHubIdParam, dataExplorerConvIdParam, dataExplorerDoInstancesQuery, dataExplorerNsIdParam, dataExplorerKvKeysBody, dataExplorerKvKeyBody, uuidOrHexId, dataExplorerDeleteOrgParam, dataExplorerDeleteHubParam, dataExplorerDeleteConvParam, dataExplorerDeleteUserParam, dataExplorerDeleteQuery, dataExplorerKvDeleteBody, pitrDoNamespace, pitrBookmarkParam, pitrRestoreBody, healthSamplingTriggerBody, DEBUG_DO_HEX_PREFIX, debugDoEntityId, debugTableName, dataExplorerDebugTablesParam, dataExplorerDebugRowsParam, dataExplorerDebugRowsQuery, dataExplorerDebugAnalyticsTable, debugUuid, dataExplorerDebugAnalyticsRowsParam, dataExplorerDebugAnalyticsRowsQuery, dataExplorerDebugCountsDoType, dataExplorerDebugCountsParam, debugHubConvParam, debugMessageIdQuery;
15310
- var init_chunk_ZECCDXFH = __esm({
15311
- "../../packages/core/dist/chunk-ZECCDXFH.js"() {
15318
+ var init_chunk_3QME565M = __esm({
15319
+ "../../packages/core/dist/chunk-3QME565M.js"() {
15312
15320
  "use strict";
15313
15321
  init_chunk_FECLIZTY();
15314
15322
  init_chunk_BFG4ZWR4();
@@ -15451,6 +15459,13 @@ var init_chunk_ZECCDXFH = __esm({
15451
15459
  automation_run_retention_days: automationRunRetentionDays.optional(),
15452
15460
  /** How long a native agent turn may run (`turnDeadlineSeconds`). */
15453
15461
  turn_deadline_seconds: turnDeadlineSeconds.optional(),
15462
+ /**
15463
+ * The catalog connectors (`connector_id`) whose new credentials go to the credentials vault
15464
+ * (wayai#5644), replacing the whole list. Empty is the default: every connector on the existing
15465
+ * path. The route stores it as JSON (`durable-objects/platform-do/vault-gate.ts`). An id no
15466
+ * connector has matches nothing, so it leaves that connector off.
15467
+ */
15468
+ vault_connector_ids: external_exports.array(uuidSchema).max(200).optional(),
15454
15469
  /**
15455
15470
  * The mobile app version policy (`MOBILE_VERSION_POLICY_COLUMNS`), per platform: an install
15456
15471
  * below the minimum is blocked until it updates from the store; one below the recommended
@@ -16345,32 +16360,33 @@ var init_chunk_EV3MAOEX = __esm({
16345
16360
  var init_contracts = __esm({
16346
16361
  "../../packages/core/dist/contracts/index.js"() {
16347
16362
  "use strict";
16363
+ init_chunk_Q7KIQHAZ();
16364
+ init_chunk_NKLVUTFO();
16348
16365
  init_chunk_WL5QGKHN();
16349
16366
  init_chunk_YVY2TZK2();
16350
16367
  init_chunk_VXEAR36B();
16351
16368
  init_chunk_RACEDHG6();
16352
- init_chunk_Q7KIQHAZ();
16369
+ init_chunk_HIGKBEPF();
16353
16370
  init_chunk_HA7CRZMX();
16354
16371
  init_chunk_MF2VVXBR();
16355
16372
  init_chunk_IPXBFWUU();
16356
- init_chunk_NKLVUTFO();
16373
+ init_chunk_VEERWOZ6();
16357
16374
  init_chunk_5YNUTCJ2();
16358
16375
  init_chunk_ZC6YGHNX();
16359
- init_chunk_HIGKBEPF();
16360
16376
  init_chunk_5DGHIY7L();
16361
16377
  init_chunk_S447DV3E();
16362
16378
  init_chunk_IPDOHAZ5();
16363
16379
  init_chunk_GPM7PE44();
16364
- init_chunk_VEERWOZ6();
16380
+ init_chunk_NZ6RQW6R();
16381
+ init_chunk_2DXRB6DR();
16365
16382
  init_chunk_ZXK6N2HN();
16366
16383
  init_chunk_Y7CFCYX4();
16367
16384
  init_chunk_MGBAXT5Y();
16368
16385
  init_chunk_YUZFHVB2();
16369
16386
  init_chunk_I3O2RACG();
16387
+ init_chunk_CMRECH67();
16370
16388
  init_chunk_34LE6P7E();
16371
16389
  init_chunk_FPSDNS2E();
16372
- init_chunk_NZ6RQW6R();
16373
- init_chunk_2DXRB6DR();
16374
16390
  init_chunk_OPETF4GS();
16375
16391
  init_chunk_SY6PLCPK();
16376
16392
  init_chunk_KMAC3O3L();
@@ -16380,7 +16396,7 @@ var init_contracts = __esm({
16380
16396
  init_chunk_Y6NC5CH5();
16381
16397
  init_chunk_C4HEZ7ZI();
16382
16398
  init_chunk_IR2NOSI3();
16383
- init_chunk_47LPEX74();
16399
+ init_chunk_UCYWGWQT();
16384
16400
  init_chunk_6AYIXGDT();
16385
16401
  init_chunk_YULHXJ5M();
16386
16402
  init_chunk_V4FRPRH5();
@@ -16392,17 +16408,17 @@ var init_contracts = __esm({
16392
16408
  init_chunk_E4DIIOOE();
16393
16409
  init_chunk_7CYHPF35();
16394
16410
  init_chunk_BPCNB5RT();
16395
- init_chunk_JJYZUBYV();
16411
+ init_chunk_4WB5E53T();
16396
16412
  init_chunk_NEIVT3KL();
16397
16413
  init_chunk_HRKVCI5A();
16398
- init_chunk_IW7D2QOD();
16399
- init_chunk_2YEGUQR7();
16414
+ init_chunk_CZEJR5UE();
16400
16415
  init_chunk_4D6K4P4K();
16416
+ init_chunk_2YEGUQR7();
16401
16417
  init_chunk_LBDH7LCG();
16402
16418
  init_chunk_4LXDRTO4();
16403
16419
  init_chunk_JDJ4EUOL();
16404
16420
  init_chunk_NVKU5PPQ();
16405
- init_chunk_ZECCDXFH();
16421
+ init_chunk_3QME565M();
16406
16422
  init_chunk_FECLIZTY();
16407
16423
  init_chunk_BFG4ZWR4();
16408
16424
  init_chunk_SAMZLA2A();
@@ -16521,10 +16537,10 @@ var init_chunk_RPGBR5IN = __esm({
16521
16537
  }
16522
16538
  });
16523
16539
 
16524
- // ../../packages/core/dist/chunk-OMK3L45Z.js
16540
+ // ../../packages/core/dist/chunk-MYPAFWEY.js
16525
16541
  var ENVELOPE_PREFIX, CREDENTIAL_REFERENCE_PREFIX;
16526
- var init_chunk_OMK3L45Z = __esm({
16527
- "../../packages/core/dist/chunk-OMK3L45Z.js"() {
16542
+ var init_chunk_MYPAFWEY = __esm({
16543
+ "../../packages/core/dist/chunk-MYPAFWEY.js"() {
16528
16544
  "use strict";
16529
16545
  ENVELOPE_PREFIX = "enc:v1:";
16530
16546
  CREDENTIAL_REFERENCE_PREFIX = `${ENVELOPE_PREFIX}vault:`;
@@ -16601,7 +16617,7 @@ var init_dist = __esm({
16601
16617
  init_chunk_WEXVYJ5H();
16602
16618
  init_chunk_6TSQ5HXC();
16603
16619
  init_chunk_HZ6CADSY();
16604
- init_chunk_OMK3L45Z();
16620
+ init_chunk_MYPAFWEY();
16605
16621
  init_chunk_J75LDBC2();
16606
16622
  init_chunk_VSSZVDBU();
16607
16623
  init_chunk_GYSQV2DS();
@@ -21728,9 +21744,9 @@ var init_pages2 = __esm({
21728
21744
  var init_evals = __esm({
21729
21745
  "../../packages/core/dist/contracts/evals.js"() {
21730
21746
  "use strict";
21731
- init_chunk_IW7D2QOD();
21732
- init_chunk_2YEGUQR7();
21747
+ init_chunk_CZEJR5UE();
21733
21748
  init_chunk_4D6K4P4K();
21749
+ init_chunk_2YEGUQR7();
21734
21750
  init_chunk_4LXDRTO4();
21735
21751
  init_chunk_WTOA3ANF();
21736
21752
  init_chunk_KB5RK3RP();
@@ -22756,12 +22772,12 @@ var init_hub_materializer = __esm({
22756
22772
  var init_ci = __esm({
22757
22773
  "../../packages/core/dist/contracts/ci.js"() {
22758
22774
  "use strict";
22759
- init_chunk_JJYZUBYV();
22775
+ init_chunk_4WB5E53T();
22760
22776
  init_chunk_NEIVT3KL();
22761
22777
  init_chunk_HRKVCI5A();
22762
- init_chunk_IW7D2QOD();
22763
- init_chunk_2YEGUQR7();
22778
+ init_chunk_CZEJR5UE();
22764
22779
  init_chunk_4D6K4P4K();
22780
+ init_chunk_2YEGUQR7();
22765
22781
  init_chunk_LBDH7LCG();
22766
22782
  init_chunk_4LXDRTO4();
22767
22783
  init_chunk_7NQZRSSJ();
@@ -27724,6 +27740,10 @@ function resolveHeld(id, name, held) {
27724
27740
  if (id && held?.some((h) => h.id === id)) return id;
27725
27741
  return held?.find((h) => name !== void 0 && h.name === name)?.id;
27726
27742
  }
27743
+ function pulledHubId(name, pulled) {
27744
+ const ids = new Set((pulled.agents ?? []).flatMap((a) => a.tools?.delegation ?? []).filter((row) => row.type === "hub" && row.target === name && row.target_id).map((row) => row.target_id));
27745
+ return ids.size === 1 ? [...ids][0] : void 0;
27746
+ }
27727
27747
  function entriesWithNoRow(entries, rows, identity2, pulled) {
27728
27748
  const keys = entries.map((entry) => identity2.key(entry, pulled));
27729
27749
  const rowKeys = new Set(rows.map((row) => identity2.rowKey(row)));
@@ -28038,7 +28058,7 @@ var init_push = __esm({
28038
28058
  },
28039
28059
  delegation: {
28040
28060
  key: (entry, pulled) => {
28041
- const target = entry.type === "agent" ? resolveHeld(entry.target_id, entry.target, pulled.agents) : entry.type === "team" ? resolveHeld(entry.target_id, entry.target, pulled.teams) : entry.target_id;
28061
+ const target = entry.type === "agent" ? resolveHeld(entry.target_id, entry.target, pulled.agents) : entry.type === "team" ? resolveHeld(entry.target_id, entry.target, pulled.teams) : entry.target_id ?? pulledHubId(entry.target, pulled);
28042
28062
  if (target === void 0 && entry.type === "hub") return null;
28043
28063
  return `${entry.tool}:${entry.type}:${target ?? `name:${entry.target}`}`;
28044
28064
  },