@wayai/cli 0.3.251 → 0.3.252

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,201 @@ var init_fs_safety = __esm({
4888
4888
  }
4889
4889
  });
4890
4890
 
4891
+ // ../../packages/core/dist/chunk-HZ6CADSY.js
4892
+ function optionalTrimmedText(max) {
4893
+ return external_exports.string().trim().max(max).optional().transform((value) => value ? value : void 0);
4894
+ }
4895
+ function jsonLengthOrNull(value) {
4896
+ try {
4897
+ const json = JSON.stringify(value);
4898
+ return typeof json === "string" ? json.length : null;
4899
+ } catch {
4900
+ return null;
4901
+ }
4902
+ }
4903
+ function withinJsonLength(value, max) {
4904
+ const length = jsonLengthOrNull(value);
4905
+ return length !== null && length <= max;
4906
+ }
4907
+ function isAudioAttachmentFileName(fileName) {
4908
+ return /\.(mp3|ogg|oga|wav|m4a|webm)$/i.test(fileName);
4909
+ }
4910
+ var uuidSchema, USER_ID_REGEX, timestampSchema, idParamSchema, clientOptionalString, clientOptionalBoolean, clientOptionalNumber, messageAttachment, MAX_MESSAGE_BODY_BYTES, MAX_ATTACHMENTS_PER_MESSAGE, MESSAGE_ENVELOPE_HEADROOM_BYTES, MAX_AUDIO_FILE_BASE64_BYTES;
4911
+ var init_chunk_HZ6CADSY = __esm({
4912
+ "../../packages/core/dist/chunk-HZ6CADSY.js"() {
4913
+ "use strict";
4914
+ init_zod();
4915
+ uuidSchema = external_exports.string().uuid();
4916
+ USER_ID_REGEX = /^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|user_[A-Za-z0-9]+)$/i;
4917
+ timestampSchema = external_exports.string().datetime();
4918
+ idParamSchema = external_exports.object({
4919
+ id: uuidSchema
4920
+ });
4921
+ clientOptionalString = external_exports.string().nullish().transform((v) => v ?? void 0);
4922
+ clientOptionalBoolean = external_exports.boolean().nullish().transform((v) => v ?? void 0);
4923
+ clientOptionalNumber = external_exports.number().nullish().transform((v) => v ?? void 0);
4924
+ messageAttachment = external_exports.object({
4925
+ /**
4926
+ * Capped at the same 255 the storage layer already truncates names to, so nothing
4927
+ * legitimate is lost — every filesystem caps there, and `sanitizeFileName` sliced
4928
+ * longer names anyway.
4929
+ *
4930
+ * The bound is load-bearing, not hygiene: the RAW name is written to R2
4931
+ * `customMetadata.originalFileName`, and R2 rejects oversized metadata. An unbounded
4932
+ * name let a client make the R2 write throw a generic storage error — indistinguishable
4933
+ * from a real outage — which pages us via `logger.error` and, on the app channel, is
4934
+ * read as "we lost the file" and escalates the user to a human. Client input must not
4935
+ * be able to impersonate an infrastructure failure (gh #3365).
4936
+ */
4937
+ file_name: external_exports.string().max(255),
4938
+ /** Base64. Bounded by the route's bodyLimit, not by this schema. */
4939
+ file_binary: external_exports.string(),
4940
+ file_size: clientOptionalNumber,
4941
+ file_extension: clientOptionalString
4942
+ });
4943
+ MAX_MESSAGE_BODY_BYTES = 10 * 1024 * 1024;
4944
+ MAX_ATTACHMENTS_PER_MESSAGE = 20;
4945
+ MESSAGE_ENVELOPE_HEADROOM_BYTES = 64 * 1024;
4946
+ MAX_AUDIO_FILE_BASE64_BYTES = 8 * 1024 * 1024;
4947
+ }
4948
+ });
4949
+
4950
+ // ../../packages/core/dist/chunk-MIWZOSPI.js
4951
+ function toIso(epochMs) {
4952
+ return new Date(epochMs).toISOString();
4953
+ }
4954
+ function fromIso(iso) {
4955
+ return new Date(iso).getTime();
4956
+ }
4957
+ function isIsoTimestamp(value) {
4958
+ return typeof value === "string" && ISO_UTC_RE.test(value);
4959
+ }
4960
+ var ISO_UTC_RE;
4961
+ var init_chunk_MIWZOSPI = __esm({
4962
+ "../../packages/core/dist/chunk-MIWZOSPI.js"() {
4963
+ "use strict";
4964
+ ISO_UTC_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
4965
+ }
4966
+ });
4967
+
4968
+ // ../../packages/core/dist/chunk-MF2VVXBR.js
4969
+ var credentialExpiresAtSchema, LINKED_EXPIRY_REFUSAL;
4970
+ var init_chunk_MF2VVXBR = __esm({
4971
+ "../../packages/core/dist/chunk-MF2VVXBR.js"() {
4972
+ "use strict";
4973
+ init_chunk_HZ6CADSY();
4974
+ init_chunk_MIWZOSPI();
4975
+ credentialExpiresAtSchema = timestampSchema.refine(isIsoTimestamp, "Expected a canonical ISO timestamp").nullable();
4976
+ LINKED_EXPIRY_REFUSAL = "A linked organization credential's expiry is set on the credential";
4977
+ }
4978
+ });
4979
+
4980
+ // ../../packages/core/dist/chunk-PTYXZZTE.js
4981
+ function normalizeAuthType(raw) {
4982
+ if (VALID_AUTH_TYPES.has(raw)) return raw;
4983
+ return LEGACY_AUTH_TYPE_MAP[raw] ?? raw;
4984
+ }
4985
+ var AUTH_TYPE, ORG_CREDENTIAL_AUTH_TYPES, AUTH_TYPE_DISPLAY, LEGACY_AUTH_TYPE_MAP, VALID_AUTH_TYPES, AGENT_ROLES, PILOT_TRACK_ROLES, COPILOT_TRACK_ROLES, CUSTOMER_FACING_AGENT_ROLES, SAFE_USER_ID_REGEX, SUPPORTED_LOCALES, SKILL_INSTALL_COMMAND;
4986
+ var init_chunk_PTYXZZTE = __esm({
4987
+ "../../packages/core/dist/chunk-PTYXZZTE.js"() {
4988
+ "use strict";
4989
+ AUTH_TYPE = {
4990
+ OAUTH: "oauth",
4991
+ API_KEY: "api_key",
4992
+ BASIC_AUTH: "basic_auth",
4993
+ BEARER: "bearer",
4994
+ NONE: "none"
4995
+ };
4996
+ ORG_CREDENTIAL_AUTH_TYPES = [
4997
+ AUTH_TYPE.API_KEY,
4998
+ AUTH_TYPE.BEARER,
4999
+ AUTH_TYPE.BASIC_AUTH
5000
+ ];
5001
+ AUTH_TYPE_DISPLAY = {
5002
+ [AUTH_TYPE.OAUTH]: "OAuth",
5003
+ [AUTH_TYPE.API_KEY]: "API Key",
5004
+ [AUTH_TYPE.BASIC_AUTH]: "Basic Auth",
5005
+ [AUTH_TYPE.BEARER]: "Bearer Token",
5006
+ [AUTH_TYPE.NONE]: "No Authentication"
5007
+ };
5008
+ LEGACY_AUTH_TYPE_MAP = {
5009
+ "OAuth": AUTH_TYPE.OAUTH,
5010
+ "API Key": AUTH_TYPE.API_KEY,
5011
+ "Basic Auth": AUTH_TYPE.BASIC_AUTH,
5012
+ "Bearer Token": AUTH_TYPE.BEARER,
5013
+ "No authentication": AUTH_TYPE.NONE,
5014
+ // Also handle the old DISPLAY_TO_CODE bug where 'basic' was used instead of 'basic_auth'
5015
+ "basic": AUTH_TYPE.BASIC_AUTH
5016
+ };
5017
+ VALID_AUTH_TYPES = new Set(Object.values(AUTH_TYPE));
5018
+ AGENT_ROLES = [
5019
+ "pilot",
5020
+ "copilot",
5021
+ "pilot_specialist",
5022
+ "copilot_specialist",
5023
+ "pilot_advisor",
5024
+ "copilot_advisor",
5025
+ "monitor",
5026
+ "conversation_evaluator",
5027
+ "message_evaluator",
5028
+ "summarizer",
5029
+ "consultant",
5030
+ "pilot_voice"
5031
+ ];
5032
+ PILOT_TRACK_ROLES = ["pilot", "pilot_specialist"];
5033
+ COPILOT_TRACK_ROLES = ["copilot", "copilot_specialist"];
5034
+ CUSTOMER_FACING_AGENT_ROLES = [...PILOT_TRACK_ROLES, "pilot_advisor"];
5035
+ SAFE_USER_ID_REGEX = /^[A-Za-z0-9_-]{1,64}$/;
5036
+ SUPPORTED_LOCALES = ["en", "pt", "es"];
5037
+ SKILL_INSTALL_COMMAND = "mkdir -p .claude && npx skills add wayai-pro/wayai-skill -y";
5038
+ }
5039
+ });
5040
+
5041
+ // ../../packages/core/dist/chunk-ILW3RFGU.js
5042
+ var orgCredentialIdParam, listOrgCredentialsQuery, createOrgCredentialBody, updateOrgCredentialBody;
5043
+ var init_chunk_ILW3RFGU = __esm({
5044
+ "../../packages/core/dist/chunk-ILW3RFGU.js"() {
5045
+ "use strict";
5046
+ init_chunk_MF2VVXBR();
5047
+ init_chunk_PTYXZZTE();
5048
+ init_zod();
5049
+ orgCredentialIdParam = external_exports.object({
5050
+ id: external_exports.string().uuid()
5051
+ });
5052
+ listOrgCredentialsQuery = external_exports.object({
5053
+ organization_id: external_exports.string().uuid(),
5054
+ hub_id: external_exports.string().uuid().optional()
5055
+ });
5056
+ createOrgCredentialBody = external_exports.object({
5057
+ organization_id: external_exports.string().uuid(),
5058
+ credential_display_name: external_exports.string().min(1).max(255),
5059
+ credential_description: external_exports.string().max(1e3).nullish(),
5060
+ authentication_type: external_exports.enum(["api_key", "bearer", "basic_auth"]).or(
5061
+ external_exports.enum(["API Key", "Bearer Token", "Basic Auth"]).transform((v) => normalizeAuthType(v))
5062
+ ),
5063
+ api_key: external_exports.string().optional(),
5064
+ access_token: external_exports.string().optional(),
5065
+ username: external_exports.string().optional(),
5066
+ password: external_exports.string().optional(),
5067
+ tags: external_exports.array(external_exports.string().uuid()).optional(),
5068
+ environment: external_exports.enum(["preview", "production", "all"]).optional(),
5069
+ expires_at: credentialExpiresAtSchema.optional()
5070
+ });
5071
+ updateOrgCredentialBody = external_exports.object({
5072
+ credential_display_name: external_exports.string().min(1).max(255).optional(),
5073
+ credential_description: external_exports.string().max(1e3).nullish(),
5074
+ api_key: external_exports.string().optional(),
5075
+ access_token: external_exports.string().optional(),
5076
+ username: external_exports.string().optional(),
5077
+ password: external_exports.string().optional(),
5078
+ tags: external_exports.array(external_exports.string().uuid()).optional(),
5079
+ environment: external_exports.enum(["preview", "production", "all"]).optional(),
5080
+ // Absent keeps the stored date, unless the request stores a new secret, which clears it.
5081
+ expires_at: credentialExpiresAtSchema.optional()
5082
+ });
5083
+ }
5084
+ });
5085
+
4891
5086
  // ../../packages/core/dist/chunk-YVY2TZK2.js
4892
5087
  var orgResourceIdParam, orgResourceFileIdParam, orgResourceFolderIdParam, hubOrgResourceParam, listOrgResourcesQuery, orgIdQuery, createOrgResourceBody, updateOrgResourceBody, createOrgResourceFolderBody, updateOrgResourceFolderBody, uploadOrgResourceFileBody, updateOrgResourceFileBody, uploadOrgSkillZipBody, linkOrgResourceBody;
4893
5088
  var init_chunk_YVY2TZK2 = __esm({
@@ -5013,65 +5208,6 @@ var init_chunk_VXEAR36B = __esm({
5013
5208
  }
5014
5209
  });
5015
5210
 
5016
- // ../../packages/core/dist/chunk-HZ6CADSY.js
5017
- function optionalTrimmedText(max) {
5018
- return external_exports.string().trim().max(max).optional().transform((value) => value ? value : void 0);
5019
- }
5020
- function jsonLengthOrNull(value) {
5021
- try {
5022
- const json = JSON.stringify(value);
5023
- return typeof json === "string" ? json.length : null;
5024
- } catch {
5025
- return null;
5026
- }
5027
- }
5028
- function withinJsonLength(value, max) {
5029
- const length = jsonLengthOrNull(value);
5030
- return length !== null && length <= max;
5031
- }
5032
- function isAudioAttachmentFileName(fileName) {
5033
- return /\.(mp3|ogg|oga|wav|m4a|webm)$/i.test(fileName);
5034
- }
5035
- var uuidSchema, USER_ID_REGEX, timestampSchema, idParamSchema, clientOptionalString, clientOptionalBoolean, clientOptionalNumber, messageAttachment, MAX_MESSAGE_BODY_BYTES, MAX_ATTACHMENTS_PER_MESSAGE, MESSAGE_ENVELOPE_HEADROOM_BYTES, MAX_AUDIO_FILE_BASE64_BYTES;
5036
- var init_chunk_HZ6CADSY = __esm({
5037
- "../../packages/core/dist/chunk-HZ6CADSY.js"() {
5038
- "use strict";
5039
- init_zod();
5040
- uuidSchema = external_exports.string().uuid();
5041
- USER_ID_REGEX = /^([0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}|user_[A-Za-z0-9]+)$/i;
5042
- timestampSchema = external_exports.string().datetime();
5043
- idParamSchema = external_exports.object({
5044
- id: uuidSchema
5045
- });
5046
- clientOptionalString = external_exports.string().nullish().transform((v) => v ?? void 0);
5047
- clientOptionalBoolean = external_exports.boolean().nullish().transform((v) => v ?? void 0);
5048
- clientOptionalNumber = external_exports.number().nullish().transform((v) => v ?? void 0);
5049
- messageAttachment = external_exports.object({
5050
- /**
5051
- * Capped at the same 255 the storage layer already truncates names to, so nothing
5052
- * legitimate is lost — every filesystem caps there, and `sanitizeFileName` sliced
5053
- * longer names anyway.
5054
- *
5055
- * The bound is load-bearing, not hygiene: the RAW name is written to R2
5056
- * `customMetadata.originalFileName`, and R2 rejects oversized metadata. An unbounded
5057
- * name let a client make the R2 write throw a generic storage error — indistinguishable
5058
- * from a real outage — which pages us via `logger.error` and, on the app channel, is
5059
- * read as "we lost the file" and escalates the user to a human. Client input must not
5060
- * be able to impersonate an infrastructure failure (gh #3365).
5061
- */
5062
- file_name: external_exports.string().max(255),
5063
- /** Base64. Bounded by the route's bodyLimit, not by this schema. */
5064
- file_binary: external_exports.string(),
5065
- file_size: clientOptionalNumber,
5066
- file_extension: clientOptionalString
5067
- });
5068
- MAX_MESSAGE_BODY_BYTES = 10 * 1024 * 1024;
5069
- MAX_ATTACHMENTS_PER_MESSAGE = 20;
5070
- MESSAGE_ENVELOPE_HEADROOM_BYTES = 64 * 1024;
5071
- MAX_AUDIO_FILE_BASE64_BYTES = 8 * 1024 * 1024;
5072
- }
5073
- });
5074
-
5075
5211
  // ../../packages/core/dist/chunk-RACEDHG6.js
5076
5212
  var resourceIdParam, listResourcesQuery, createResourceBody, updateResourceBody, syncSkillsBody, resourceFileIdParam, listResourceFilesQuery, createResourceFileBody, updateResourceFileBody, uploadResourceFileBody, uploadSkillZipBody, resourceFolderIdParam, listResourceFoldersQuery, createResourceFolderBody, updateResourceFolderBody, agentResourceQuery, hubResourceQuery, linkAgentResourceBody, updateAgentResourceBody, unlinkAgentResourceQuery;
5077
5213
  var init_chunk_RACEDHG6 = __esm({
@@ -5263,36 +5399,6 @@ var init_chunk_Q7KIQHAZ = __esm({
5263
5399
  }
5264
5400
  });
5265
5401
 
5266
- // ../../packages/core/dist/chunk-MIWZOSPI.js
5267
- function toIso(epochMs) {
5268
- return new Date(epochMs).toISOString();
5269
- }
5270
- function fromIso(iso) {
5271
- return new Date(iso).getTime();
5272
- }
5273
- function isIsoTimestamp(value) {
5274
- return typeof value === "string" && ISO_UTC_RE.test(value);
5275
- }
5276
- var ISO_UTC_RE;
5277
- var init_chunk_MIWZOSPI = __esm({
5278
- "../../packages/core/dist/chunk-MIWZOSPI.js"() {
5279
- "use strict";
5280
- ISO_UTC_RE = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
5281
- }
5282
- });
5283
-
5284
- // ../../packages/core/dist/chunk-MF2VVXBR.js
5285
- var credentialExpiresAtSchema, LINKED_EXPIRY_REFUSAL;
5286
- var init_chunk_MF2VVXBR = __esm({
5287
- "../../packages/core/dist/chunk-MF2VVXBR.js"() {
5288
- "use strict";
5289
- init_chunk_HZ6CADSY();
5290
- init_chunk_MIWZOSPI();
5291
- credentialExpiresAtSchema = timestampSchema.refine(isIsoTimestamp, "Expected a canonical ISO timestamp").nullable();
5292
- LINKED_EXPIRY_REFUSAL = "A linked organization credential's expiry is set on the credential";
5293
- }
5294
- });
5295
-
5296
5402
  // ../../packages/core/dist/chunk-HA7CRZMX.js
5297
5403
  var connectionIdParam, connectorIdParam, listConnectionsQuery, deleteConnectionQuery, addConnectionBody, editConnectionBody, PRODUCTION_DIRECT_FIELDS, BESIDE_LINK_FIELDS, setProductionCredentialBody, registerWhatsappQuery, registerWhatsappBody, retryProvisioningQuery, resendDomainStatusQuery;
5298
5404
  var init_chunk_HA7CRZMX = __esm({
@@ -5475,112 +5581,6 @@ var init_chunk_NKLVUTFO = __esm({
5475
5581
  }
5476
5582
  });
5477
5583
 
5478
- // ../../packages/core/dist/chunk-PTYXZZTE.js
5479
- function normalizeAuthType(raw) {
5480
- if (VALID_AUTH_TYPES.has(raw)) return raw;
5481
- return LEGACY_AUTH_TYPE_MAP[raw] ?? raw;
5482
- }
5483
- var AUTH_TYPE, ORG_CREDENTIAL_AUTH_TYPES, AUTH_TYPE_DISPLAY, LEGACY_AUTH_TYPE_MAP, VALID_AUTH_TYPES, AGENT_ROLES, PILOT_TRACK_ROLES, COPILOT_TRACK_ROLES, CUSTOMER_FACING_AGENT_ROLES, SAFE_USER_ID_REGEX, SUPPORTED_LOCALES, SKILL_INSTALL_COMMAND;
5484
- var init_chunk_PTYXZZTE = __esm({
5485
- "../../packages/core/dist/chunk-PTYXZZTE.js"() {
5486
- "use strict";
5487
- AUTH_TYPE = {
5488
- OAUTH: "oauth",
5489
- API_KEY: "api_key",
5490
- BASIC_AUTH: "basic_auth",
5491
- BEARER: "bearer",
5492
- NONE: "none"
5493
- };
5494
- ORG_CREDENTIAL_AUTH_TYPES = [
5495
- AUTH_TYPE.API_KEY,
5496
- AUTH_TYPE.BEARER,
5497
- AUTH_TYPE.BASIC_AUTH
5498
- ];
5499
- AUTH_TYPE_DISPLAY = {
5500
- [AUTH_TYPE.OAUTH]: "OAuth",
5501
- [AUTH_TYPE.API_KEY]: "API Key",
5502
- [AUTH_TYPE.BASIC_AUTH]: "Basic Auth",
5503
- [AUTH_TYPE.BEARER]: "Bearer Token",
5504
- [AUTH_TYPE.NONE]: "No Authentication"
5505
- };
5506
- LEGACY_AUTH_TYPE_MAP = {
5507
- "OAuth": AUTH_TYPE.OAUTH,
5508
- "API Key": AUTH_TYPE.API_KEY,
5509
- "Basic Auth": AUTH_TYPE.BASIC_AUTH,
5510
- "Bearer Token": AUTH_TYPE.BEARER,
5511
- "No authentication": AUTH_TYPE.NONE,
5512
- // Also handle the old DISPLAY_TO_CODE bug where 'basic' was used instead of 'basic_auth'
5513
- "basic": AUTH_TYPE.BASIC_AUTH
5514
- };
5515
- VALID_AUTH_TYPES = new Set(Object.values(AUTH_TYPE));
5516
- AGENT_ROLES = [
5517
- "pilot",
5518
- "copilot",
5519
- "pilot_specialist",
5520
- "copilot_specialist",
5521
- "pilot_advisor",
5522
- "copilot_advisor",
5523
- "monitor",
5524
- "conversation_evaluator",
5525
- "message_evaluator",
5526
- "summarizer",
5527
- "consultant",
5528
- "pilot_voice"
5529
- ];
5530
- PILOT_TRACK_ROLES = ["pilot", "pilot_specialist"];
5531
- COPILOT_TRACK_ROLES = ["copilot", "copilot_specialist"];
5532
- CUSTOMER_FACING_AGENT_ROLES = [...PILOT_TRACK_ROLES, "pilot_advisor"];
5533
- SAFE_USER_ID_REGEX = /^[A-Za-z0-9_-]{1,64}$/;
5534
- SUPPORTED_LOCALES = ["en", "pt", "es"];
5535
- SKILL_INSTALL_COMMAND = "mkdir -p .claude && npx skills add wayai-pro/wayai-skill -y";
5536
- }
5537
- });
5538
-
5539
- // ../../packages/core/dist/chunk-ILW3RFGU.js
5540
- var orgCredentialIdParam, listOrgCredentialsQuery, createOrgCredentialBody, updateOrgCredentialBody;
5541
- var init_chunk_ILW3RFGU = __esm({
5542
- "../../packages/core/dist/chunk-ILW3RFGU.js"() {
5543
- "use strict";
5544
- init_chunk_MF2VVXBR();
5545
- init_chunk_PTYXZZTE();
5546
- init_zod();
5547
- orgCredentialIdParam = external_exports.object({
5548
- id: external_exports.string().uuid()
5549
- });
5550
- listOrgCredentialsQuery = external_exports.object({
5551
- organization_id: external_exports.string().uuid(),
5552
- hub_id: external_exports.string().uuid().optional()
5553
- });
5554
- createOrgCredentialBody = external_exports.object({
5555
- organization_id: external_exports.string().uuid(),
5556
- credential_display_name: external_exports.string().min(1).max(255),
5557
- credential_description: external_exports.string().max(1e3).nullish(),
5558
- authentication_type: external_exports.enum(["api_key", "bearer", "basic_auth"]).or(
5559
- external_exports.enum(["API Key", "Bearer Token", "Basic Auth"]).transform((v) => normalizeAuthType(v))
5560
- ),
5561
- api_key: external_exports.string().optional(),
5562
- access_token: external_exports.string().optional(),
5563
- username: external_exports.string().optional(),
5564
- password: external_exports.string().optional(),
5565
- tags: external_exports.array(external_exports.string().uuid()).optional(),
5566
- environment: external_exports.enum(["preview", "production", "all"]).optional(),
5567
- expires_at: credentialExpiresAtSchema.optional()
5568
- });
5569
- updateOrgCredentialBody = external_exports.object({
5570
- credential_display_name: external_exports.string().min(1).max(255).optional(),
5571
- credential_description: external_exports.string().max(1e3).nullish(),
5572
- api_key: external_exports.string().optional(),
5573
- access_token: external_exports.string().optional(),
5574
- username: external_exports.string().optional(),
5575
- password: external_exports.string().optional(),
5576
- tags: external_exports.array(external_exports.string().uuid()).optional(),
5577
- environment: external_exports.enum(["preview", "production", "all"]).optional(),
5578
- // Absent keeps the stored date, unless the request stores a new secret, which clears it.
5579
- expires_at: credentialExpiresAtSchema.optional()
5580
- });
5581
- }
5582
- });
5583
-
5584
5584
  // ../../packages/core/dist/chunk-ZC6YGHNX.js
5585
5585
  var updateUserBody, updateProfileBody, pathnameRegex, updatePreferencesBody, registerPushTokenBody, deletePushTokenQuery, recordAiDisclosureAcceptanceBody, activityQuery, deletionModeSchema, deletionRequestBody;
5586
5586
  var init_chunk_ZC6YGHNX = __esm({
@@ -5696,6 +5696,33 @@ var init_chunk_K2UY4M4E = __esm({
5696
5696
  }
5697
5697
  });
5698
5698
 
5699
+ // ../../packages/core/dist/chunk-5DGHIY7L.js
5700
+ var rekorBaseChangeMessageSchema;
5701
+ var init_chunk_5DGHIY7L = __esm({
5702
+ "../../packages/core/dist/chunk-5DGHIY7L.js"() {
5703
+ "use strict";
5704
+ init_zod();
5705
+ rekorBaseChangeMessageSchema = external_exports.object({
5706
+ /** The WayAI org UUID — one id namespace. */
5707
+ org_id: external_exports.string().uuid(),
5708
+ /**
5709
+ * Not a UUID: a preview base id is `{prod_base_id}--{slug}`. Immutable per base — a
5710
+ * preview clone is its OWN base_id — so `(base_id, scope)` keys never collide across
5711
+ * environments. Empty is never a real base id, so it is non-conforming rather than a
5712
+ * frame keyed on nothing.
5713
+ */
5714
+ base_id: external_exports.string().min(1),
5715
+ /**
5716
+ * Rides along so the client scopes its refetch without a lookup; the inspector scopes
5717
+ * by side.
5718
+ */
5719
+ environment: external_exports.enum(["production", "preview"]),
5720
+ /** Which pane refetches. `base` covers create/delete/promote/config changes. */
5721
+ scope: external_exports.enum(["records", "record_types", "files", "base"])
5722
+ });
5723
+ }
5724
+ });
5725
+
5699
5726
  // ../../packages/core/dist/chunk-5XEJSR22.js
5700
5727
  var DATA_PROXY_MOUNT, DATA_PROXY_PREFIX, BASE_DESTRUCTION_MOUNT, BASE_DESTRUCTION_PREFIX, BASE_DESTRUCTION_CONFIRM_PATH, COMMUNITY_EMAIL_UNSUBSCRIBE_PATH, CONTACT_BOOK_EMAIL_UNSUBSCRIBE_PATH, AUTOMATION_WEBHOOK_MOUNT, MANAGED_AGENTS_WEBHOOK_MOUNT;
5701
5728
  var init_chunk_5XEJSR22 = __esm({
@@ -5713,7 +5740,7 @@ var init_chunk_5XEJSR22 = __esm({
5713
5740
  }
5714
5741
  });
5715
5742
 
5716
- // ../../packages/core/dist/chunk-3DCPJ6NB.js
5743
+ // ../../packages/core/dist/chunk-Z2SC7EVO.js
5717
5744
  function matchPath(pattern, path44) {
5718
5745
  const pathSegments2 = path44.replace(/\/$/, "").split("/");
5719
5746
  const isPrefix = pattern.endsWith("/*");
@@ -5742,8 +5769,8 @@ function getEndpointConfig(path44) {
5742
5769
  return { tier: "STANDARD" };
5743
5770
  }
5744
5771
  var ENDPOINT_CONFIGS, EXCLUDED_PATHS;
5745
- var init_chunk_3DCPJ6NB = __esm({
5746
- "../../packages/core/dist/chunk-3DCPJ6NB.js"() {
5772
+ var init_chunk_Z2SC7EVO = __esm({
5773
+ "../../packages/core/dist/chunk-Z2SC7EVO.js"() {
5747
5774
  "use strict";
5748
5775
  init_chunk_5XEJSR22();
5749
5776
  ENDPOINT_CONFIGS = {
@@ -6072,7 +6099,8 @@ var init_chunk_3DCPJ6NB = __esm({
6072
6099
  // A hub's team pages and their bridge (#5333; owner decision of 2026-10-27): a signed-in caller is
6073
6100
  // counted on one budget of their own across every hub's page routes instead of the per-IP tier,
6074
6101
  // which a team behind one address shares. The bridge's own budgets still apply on top: 60 calls a
6075
- // minute per viewer and page, 150 per viewer across a hub's pages, 500 per hub (`PAGE_BRIDGE_PER_*` below).
6102
+ // minute per viewer and page (30 on a customer page), 150 per viewer across a hub's pages, 200 per hub
6103
+ // across its customer pages and 500 per hub (`PAGE_BRIDGE_*` below).
6076
6104
  "/api/hubs/*/pages/*": { tier: "STANDARD", userLimit: 500, skipAuthenticatedUsers: true, userLimitKey: "/api/hubs/*/pages/*" },
6077
6105
  // Attested `/v1` proxy onto the data API's `AttestedEntrypoint`. `userLimitKey` is load-bearing here: the
6078
6106
  // per-user budget defaults to the full request path, and this surface's paths carry base,
@@ -6220,7 +6248,7 @@ var init_chunk_3DCPJ6NB = __esm({
6220
6248
  }
6221
6249
  });
6222
6250
 
6223
- // ../../packages/core/dist/chunk-DAPIEZDP.js
6251
+ // ../../packages/core/dist/chunk-ZAFNUHAY.js
6224
6252
  function fileSnapshotChanged(run) {
6225
6253
  return run.written + run.removed > 0;
6226
6254
  }
@@ -6261,10 +6289,10 @@ async function sendWithRetry(opts, cursor) {
6261
6289
  }
6262
6290
  }
6263
6291
  var rekorFileSnapshotAnswerSchema, FILE_SNAPSHOT_MAX_PAGES, FILE_SNAPSHOT_CONFLICT_ATTEMPTS, FILE_SNAPSHOT_PAGE_SPACING_MS, FILE_SNAPSHOT_CONFLICT_STATUS;
6264
- var init_chunk_DAPIEZDP = __esm({
6265
- "../../packages/core/dist/chunk-DAPIEZDP.js"() {
6292
+ var init_chunk_ZAFNUHAY = __esm({
6293
+ "../../packages/core/dist/chunk-ZAFNUHAY.js"() {
6266
6294
  "use strict";
6267
- init_chunk_3DCPJ6NB();
6295
+ init_chunk_Z2SC7EVO();
6268
6296
  init_chunk_5XEJSR22();
6269
6297
  init_zod();
6270
6298
  rekorFileSnapshotAnswerSchema = external_exports.object({
@@ -6287,58 +6315,331 @@ var init_chunk_DAPIEZDP = __esm({
6287
6315
  }
6288
6316
  });
6289
6317
 
6290
- // ../../packages/core/dist/chunk-C2ID2BF7.js
6291
- var REKOR_ACTOR_TYPE_HEADER, REKOR_ACTOR_ID_HEADER, REKOR_ACTOR_LABEL_HEADER, REKOR_ACTOR_ORG_HEADER, REKOR_ACTOR_ADMIN_HEADER, REKOR_CLIENT_HEADER, REKOR_TOOL_ID_HEADER, REKOR_CLIENTS, rekorClientSchema, MAX_REKOR_TOOL_ID_LENGTH, rekorToolIdSchema, REKOR_V1_PREFIX, DATA_PROXY_ORG_QUERY_PARAM, MAX_PROVISIONING_BODY_BYTES, dataProxyQuery, rekorAttestation, REQUIRED_REKOR_ATTESTATION_HEADERS, REKOR_BOUND_BASE_HEADER, REKOR_BOUND_TOOLSET_HEADER, REKOR_BOUND_TOKEN_HEADER, REKOR_BOUND_CUSTOMER_HEADER, REKOR_BOUND_ACCESS_HEADER, REKOR_BOUND_ACCESS_SCOPE_HEADER, REKOR_BOUND_PAGE_HEADER, REKOR_ACCESS_SCOPE_CUSTOMER, DATA_BASE_GENERATION_HEADER, REKOR_MAX_ACTOR_ID_LENGTH, REKOR_MAX_ACTOR_LABEL_LENGTH, REKOR_MAX_ACCESS_DIMENSIONS, REKOR_MAX_ACCESS_VALUES, REKOR_MAX_ACCESS_ID_LENGTH, REKOR_MAX_ACCESS_HEADER_LENGTH;
6292
- var init_chunk_C2ID2BF7 = __esm({
6293
- "../../packages/core/dist/chunk-C2ID2BF7.js"() {
6318
+ // ../../packages/core/dist/chunk-IPDOHAZ5.js
6319
+ var reportSourceSchema, intakeReportSourceSchema, reportClassificationSchema, reportStatusSchema, reportLocaleSchema, reportMessageAuthorRoleSchema, reportMessageSchema, sentryRefStatusSchema, createReportBody, editReportBody, reporterReportSummarySchema, reporterListResponseSchema, getReportResponseSchema, reporterTransitionResponseSchema, contestReportBody, reporterListQuery, listReportsQuery, GITHUB_ISSUE_URL_REGEX, githubIssueUrlSchema, transitionReportBody, groupReportsBody, holdReportBody;
6320
+ var init_chunk_IPDOHAZ5 = __esm({
6321
+ "../../packages/core/dist/chunk-IPDOHAZ5.js"() {
6294
6322
  "use strict";
6323
+ init_chunk_HZ6CADSY();
6295
6324
  init_zod();
6296
- REKOR_ACTOR_TYPE_HEADER = "X-Rekor-Actor-Type";
6297
- REKOR_ACTOR_ID_HEADER = "X-Rekor-Actor-Id";
6298
- REKOR_ACTOR_LABEL_HEADER = "X-Rekor-Actor-Label";
6299
- REKOR_ACTOR_ORG_HEADER = "X-Rekor-Actor-Org";
6300
- REKOR_ACTOR_ADMIN_HEADER = "X-Rekor-Actor-Admin";
6301
- REKOR_CLIENT_HEADER = "X-Rekor-Client";
6302
- REKOR_TOOL_ID_HEADER = "X-Rekor-Tool-Id";
6303
- REKOR_CLIENTS = ["api", "cli", "mcp"];
6304
- rekorClientSchema = external_exports.enum(REKOR_CLIENTS);
6305
- MAX_REKOR_TOOL_ID_LENGTH = 128;
6306
- rekorToolIdSchema = external_exports.string().trim().min(1).max(MAX_REKOR_TOOL_ID_LENGTH);
6307
- REKOR_V1_PREFIX = "/v1";
6308
- DATA_PROXY_ORG_QUERY_PARAM = "org_id";
6309
- MAX_PROVISIONING_BODY_BYTES = 256 * 1024;
6310
- dataProxyQuery = external_exports.object({
6311
- [DATA_PROXY_ORG_QUERY_PARAM]: external_exports.string().uuid().optional()
6325
+ reportSourceSchema = external_exports.enum(["sentry", "cli", "review", "security_audit"]);
6326
+ intakeReportSourceSchema = external_exports.enum(["cli", "review", "security_audit"]);
6327
+ reportClassificationSchema = external_exports.enum(["bug", "flaky_test", "security", "enhancement"]);
6328
+ reportStatusSchema = external_exports.enum([
6329
+ "pending",
6330
+ "grouped",
6331
+ "escalated",
6332
+ "shipped",
6333
+ "contested",
6334
+ "addressed",
6335
+ "dismissed"
6336
+ ]);
6337
+ reportLocaleSchema = external_exports.enum(["en", "pt", "es"]);
6338
+ reportMessageAuthorRoleSchema = external_exports.enum(["reporter", "triage", "fixer", "system"]);
6339
+ reportMessageSchema = external_exports.object({
6340
+ message_id: external_exports.string(),
6341
+ author_role: reportMessageAuthorRoleSchema,
6342
+ /** The status transition this note accompanied (e.g. 'shipped'); null for a free/system note. */
6343
+ transition: external_exports.string().nullable(),
6344
+ body: external_exports.string(),
6345
+ created_at: timestampSchema,
6346
+ /**
6347
+ * Visibility: `false` = reporter-facing (the default for every narrative entry); `true` =
6348
+ * triage-internal (e.g. a `hold` rationale) — surfaced to platform admins only and NEVER
6349
+ * returned on the reporter read path. The reporter's `GET /api/reports/:id` filters these out.
6350
+ */
6351
+ internal: external_exports.boolean()
6312
6352
  });
6313
- rekorAttestation = external_exports.object({
6314
- [REKOR_ACTOR_TYPE_HEADER]: external_exports.enum(["user", "token"]),
6315
- [REKOR_ACTOR_ID_HEADER]: external_exports.string().min(1),
6316
- [REKOR_ACTOR_LABEL_HEADER]: external_exports.string(),
6317
- [REKOR_ACTOR_ORG_HEADER]: external_exports.string().uuid(),
6318
- [REKOR_ACTOR_ADMIN_HEADER]: external_exports.enum(["0", "1"]),
6319
- [REKOR_CLIENT_HEADER]: rekorClientSchema,
6320
- [REKOR_TOOL_ID_HEADER]: rekorToolIdSchema.optional()
6353
+ sentryRefStatusSchema = external_exports.enum(["valid", "not_found", "mismatch", "unverified"]);
6354
+ createReportBody = external_exports.object({
6355
+ title: external_exports.string().min(5).max(256),
6356
+ description: external_exports.string().min(10).max(5e3),
6357
+ steps_to_reproduce: external_exports.string().max(3e3).optional(),
6358
+ error_message: external_exports.string().max(2e3).optional(),
6359
+ // Taxonomy (server defaults: source=cli, classification=bug when absent).
6360
+ source: intakeReportSourceSchema.optional(),
6361
+ classification: reportClassificationSchema.optional(),
6362
+ // Stable dedup key (e.g. "<file>::<test>" for flaky, "<file>:<line>" for
6363
+ // security). When present, the fingerprint uses it instead of the body hash.
6364
+ dedup_key: external_exports.string().min(1).max(256).optional(),
6365
+ // Context fields (auto-captured by the CLI)
6366
+ organization_id: external_exports.string().optional(),
6367
+ hub_id: external_exports.string().uuid().optional(),
6368
+ hub_name: external_exports.string().max(256).optional(),
6369
+ conversation_id: external_exports.string().uuid().optional(),
6370
+ agent_id: external_exports.string().uuid().optional(),
6371
+ agent_name: external_exports.string().max(256).optional(),
6372
+ client_version: external_exports.string().max(64).optional(),
6373
+ additional_context: external_exports.string().max(2e3).optional()
6321
6374
  });
6322
- REQUIRED_REKOR_ATTESTATION_HEADERS = Object.entries(rekorAttestation.shape).filter(([, field]) => !field.isOptional()).map(([header]) => header);
6323
- REKOR_BOUND_BASE_HEADER = "X-Rekor-Bound-Base";
6324
- REKOR_BOUND_TOOLSET_HEADER = "X-Rekor-Bound-Toolset";
6325
- REKOR_BOUND_TOKEN_HEADER = "X-Rekor-Bound-Token";
6326
- REKOR_BOUND_CUSTOMER_HEADER = "X-Rekor-Bound-Customer";
6327
- REKOR_BOUND_ACCESS_HEADER = "X-Rekor-Bound-Access";
6328
- REKOR_BOUND_ACCESS_SCOPE_HEADER = "X-Rekor-Bound-Access-Scope";
6329
- REKOR_BOUND_PAGE_HEADER = "X-Rekor-Bound-Page";
6330
- REKOR_ACCESS_SCOPE_CUSTOMER = "customer";
6331
- DATA_BASE_GENERATION_HEADER = "X-Data-Base-Generation";
6332
- REKOR_MAX_ACTOR_ID_LENGTH = 256;
6333
- REKOR_MAX_ACTOR_LABEL_LENGTH = 256;
6334
- REKOR_MAX_ACCESS_DIMENSIONS = 8;
6335
- REKOR_MAX_ACCESS_VALUES = 100;
6336
- REKOR_MAX_ACCESS_ID_LENGTH = 32;
6337
- REKOR_MAX_ACCESS_HEADER_LENGTH = 65536;
6338
- }
6339
- });
6375
+ editReportBody = external_exports.object({
6376
+ title: external_exports.string().min(5).max(256).optional(),
6377
+ description: external_exports.string().min(10).max(5e3).optional(),
6378
+ steps_to_reproduce: external_exports.string().max(3e3).optional(),
6379
+ error_message: external_exports.string().max(2e3).optional(),
6380
+ additional_context: external_exports.string().max(2e3).optional()
6381
+ }).strict().refine((b) => Object.keys(b).length > 0, {
6382
+ message: "at least one field must be provided"
6383
+ });
6384
+ reporterReportSummarySchema = external_exports.object({
6385
+ report_id: external_exports.string(),
6386
+ title: external_exports.string(),
6387
+ description: external_exports.string(),
6388
+ classification: reportClassificationSchema,
6389
+ status: reportStatusSchema,
6390
+ created_at: timestampSchema,
6391
+ triaged_at: timestampSchema.nullable(),
6392
+ resolved_at: timestampSchema.nullable(),
6393
+ /** How many times the reporter has contested (gates the hard cap). */
6394
+ contest_count: external_exports.number(),
6395
+ /** True once triage issued a non-contestable (final) dismissal. */
6396
+ dismissal_final: external_exports.boolean()
6397
+ });
6398
+ reporterListResponseSchema = external_exports.object({
6399
+ data: external_exports.array(reporterReportSummarySchema)
6400
+ });
6401
+ getReportResponseSchema = external_exports.object({
6402
+ report: reporterReportSummarySchema,
6403
+ messages: external_exports.array(reportMessageSchema)
6404
+ });
6405
+ reporterTransitionResponseSchema = external_exports.object({
6406
+ report: reporterReportSummarySchema
6407
+ });
6408
+ contestReportBody = external_exports.object({
6409
+ reason: external_exports.string().min(1).max(5e3)
6410
+ });
6411
+ reporterListQuery = external_exports.object({
6412
+ status: reportStatusSchema.optional()
6413
+ });
6414
+ listReportsQuery = external_exports.object({
6415
+ status: reportStatusSchema.optional(),
6416
+ source: reportSourceSchema.optional(),
6417
+ limit: external_exports.coerce.number().int().min(1).max(200).optional(),
6418
+ offset: external_exports.coerce.number().int().min(0).optional(),
6419
+ /** ISO 8601 lower bound on created_at. */
6420
+ since: external_exports.string().datetime().optional(),
6421
+ /**
6422
+ * ISO 8601 lower bound on resolution time — "what did we resolve recently", which `since`
6423
+ * (a created_at filter) cannot answer for a long-lived report resolved yesterday. Implies
6424
+ * a terminal status (`addressed`/`dismissed`) and orders on that same axis.
6425
+ */
6426
+ resolved_since: external_exports.string().datetime().optional()
6427
+ });
6428
+ GITHUB_ISSUE_URL_REGEX = /^https:\/\/github\.com\/[^/]+\/[^/]+\/issues\/\d+(?:[/?#]|$)/;
6429
+ githubIssueUrlSchema = external_exports.string().url().refine((u) => GITHUB_ISSUE_URL_REGEX.test(u), {
6430
+ message: "must be an https://github.com/<owner>/<repo>/issues/<number> URL"
6431
+ });
6432
+ transitionReportBody = external_exports.discriminatedUnion("target", [
6433
+ external_exports.object({
6434
+ target: external_exports.literal("escalated"),
6435
+ gh_issue_url: githubIssueUrlSchema,
6436
+ ai_verdict: external_exports.string().max(2e3).optional()
6437
+ }),
6438
+ external_exports.object({
6439
+ target: external_exports.literal("shipped"),
6440
+ note: external_exports.string().min(1).max(2e3).optional()
6441
+ }),
6442
+ external_exports.object({
6443
+ target: external_exports.literal("addressed")
6444
+ }),
6445
+ external_exports.object({
6446
+ target: external_exports.literal("dismissed"),
6447
+ dismissal_reason: external_exports.string().min(1).max(5e3),
6448
+ ai_verdict: external_exports.string().max(2e3).optional(),
6449
+ final: external_exports.boolean().optional()
6450
+ })
6451
+ ]);
6452
+ groupReportsBody = external_exports.object({
6453
+ member_ids: external_exports.array(external_exports.string().uuid()).min(1).max(100)
6454
+ });
6455
+ holdReportBody = external_exports.object({
6456
+ reason: external_exports.string().min(1).max(5e3)
6457
+ });
6458
+ }
6459
+ });
6460
+
6461
+ // ../../packages/core/dist/chunk-GPM7PE44.js
6462
+ var bootstrapQuery;
6463
+ var init_chunk_GPM7PE44 = __esm({
6464
+ "../../packages/core/dist/chunk-GPM7PE44.js"() {
6465
+ "use strict";
6466
+ init_zod();
6467
+ bootstrapQuery = external_exports.object({
6468
+ active_hub_id: external_exports.string().uuid().optional(),
6469
+ active_conversation_id: external_exports.string().uuid().optional(),
6470
+ active_nav: external_exports.enum(["chat", "task", "support"]).optional(),
6471
+ /**
6472
+ * The people thread the URL names (`/chat/threads/:threadId`, gh #4661): the snapshot
6473
+ * preloads it as `people.active_thread` when the viewer is a member.
6474
+ */
6475
+ active_thread_id: external_exports.string().uuid().optional()
6476
+ });
6477
+ }
6478
+ });
6479
+
6480
+ // ../../packages/core/dist/chunk-5VL6LBFD.js
6481
+ var PERMISSIONS;
6482
+ var init_chunk_5VL6LBFD = __esm({
6483
+ "../../packages/core/dist/chunk-5VL6LBFD.js"() {
6484
+ "use strict";
6485
+ PERMISSIONS = [
6486
+ "hub:read",
6487
+ "hub:write",
6488
+ "hub:admin",
6489
+ "conversation:read",
6490
+ "conversation:write",
6491
+ "analytics:read",
6492
+ "billing:read",
6493
+ "billing:write",
6494
+ "org:read",
6495
+ "org:write",
6496
+ "org:admin",
6497
+ "contacts:write",
6498
+ "platform:admin",
6499
+ "*"
6500
+ ];
6501
+ }
6502
+ });
6340
6503
 
6341
- // ../../packages/core/dist/chunk-IAAIVRFJ.js
6504
+ // ../../packages/core/dist/chunk-VEERWOZ6.js
6505
+ var MAX_NAME_LENGTH2, MAX_HUBS_PER_GRANT, MAX_HUB_TAGS_PER_GRANT, MAX_GRANTS, permissionEnum, grantScopeSchema, grantSchema, createTokenBody, tokenOrgIdParam;
6506
+ var init_chunk_VEERWOZ6 = __esm({
6507
+ "../../packages/core/dist/chunk-VEERWOZ6.js"() {
6508
+ "use strict";
6509
+ init_chunk_5VL6LBFD();
6510
+ init_chunk_HZ6CADSY();
6511
+ init_zod();
6512
+ MAX_NAME_LENGTH2 = 100;
6513
+ MAX_HUBS_PER_GRANT = 50;
6514
+ MAX_HUB_TAGS_PER_GRANT = 20;
6515
+ MAX_GRANTS = 20;
6516
+ permissionEnum = external_exports.enum(PERMISSIONS).refine(
6517
+ (p) => p !== "platform:admin",
6518
+ { message: "platform:admin cannot be delegated via token creation" }
6519
+ );
6520
+ grantScopeSchema = external_exports.object({
6521
+ // Required: every token grant must declare its org tenancy. The handler
6522
+ // also strict-checks this as defense-in-depth, but failing at the Zod
6523
+ // boundary keeps the generated client type honest (org_id: string).
6524
+ org_id: external_exports.string().min(1),
6525
+ 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),
6526
+ 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(),
6527
+ environments: external_exports.array(external_exports.enum(["production", "preview"])).min(1, "scope.environments must be a non-empty array if provided").optional()
6528
+ }).strict();
6529
+ grantSchema = external_exports.object({
6530
+ scope: grantScopeSchema,
6531
+ permissions: external_exports.array(permissionEnum).min(1, "Each grant must have permissions as a non-empty array")
6532
+ }).strict();
6533
+ createTokenBody = external_exports.object({
6534
+ name: external_exports.string().trim().min(1, "name is required").max(MAX_NAME_LENGTH2, `name must be ${MAX_NAME_LENGTH2} characters or fewer`),
6535
+ grants: external_exports.array(grantSchema).min(1, "grants must be a non-empty array").max(MAX_GRANTS),
6536
+ expires_at: external_exports.string().datetime({ message: "expires_at must be a valid ISO 8601 date" }).refine(
6537
+ (s) => new Date(s).getTime() > Date.now(),
6538
+ { message: "expires_at must be in the future" }
6539
+ ).optional()
6540
+ });
6541
+ tokenOrgIdParam = external_exports.object({ orgId: uuidSchema });
6542
+ }
6543
+ });
6544
+
6545
+ // ../../packages/core/dist/chunk-FPSDNS2E.js
6546
+ var noticeSeveritySchema, noticeStatusSchema, NOTICE_SCOPE_REGEX, noticeScopeSchema, noticeLinkSchema, createNoticeBody, updateNoticeBody, listNoticesQuery, noticeIdParamSchema;
6547
+ var init_chunk_FPSDNS2E = __esm({
6548
+ "../../packages/core/dist/chunk-FPSDNS2E.js"() {
6549
+ "use strict";
6550
+ init_zod();
6551
+ noticeSeveritySchema = external_exports.enum(["critical", "warn", "info"]);
6552
+ noticeStatusSchema = external_exports.enum(["active", "resolved"]);
6553
+ NOTICE_SCOPE_REGEX = /^(global|provider:[a-z0-9_-]{1,40}|service:[a-z0-9_-]{1,40})$/;
6554
+ noticeScopeSchema = external_exports.string().regex(NOTICE_SCOPE_REGEX, "scope must be 'global', 'provider:<x>', or 'service:<x>'");
6555
+ noticeLinkSchema = external_exports.string().url().refine((u) => /^https?:\/\//i.test(u), { message: "link must be an http(s) URL" });
6556
+ createNoticeBody = external_exports.object({
6557
+ severity: noticeSeveritySchema.default("info"),
6558
+ scope: noticeScopeSchema.default("global"),
6559
+ title: external_exports.string().trim().min(1).max(200),
6560
+ body: external_exports.string().max(2e3).optional(),
6561
+ link: noticeLinkSchema.optional(),
6562
+ starts_at: external_exports.string().datetime().optional(),
6563
+ ends_at: external_exports.string().datetime().optional()
6564
+ });
6565
+ updateNoticeBody = external_exports.object({
6566
+ severity: noticeSeveritySchema.optional(),
6567
+ scope: noticeScopeSchema.optional(),
6568
+ title: external_exports.string().trim().min(1).max(200).optional(),
6569
+ body: external_exports.string().max(2e3).nullable().optional(),
6570
+ link: noticeLinkSchema.nullable().optional(),
6571
+ starts_at: external_exports.string().datetime().optional(),
6572
+ ends_at: external_exports.string().datetime().nullable().optional()
6573
+ }).refine((b) => Object.keys(b).length > 0, { message: "at least one field must be provided" });
6574
+ listNoticesQuery = external_exports.object({
6575
+ status: noticeStatusSchema.optional(),
6576
+ limit: external_exports.coerce.number().int().min(1).max(200).optional(),
6577
+ offset: external_exports.coerce.number().int().min(0).optional()
6578
+ });
6579
+ noticeIdParamSchema = external_exports.object({ id: external_exports.string().min(1) });
6580
+ }
6581
+ });
6582
+
6583
+ // ../../packages/core/dist/chunk-UE4KTV2N.js
6584
+ var REKOR_ACTOR_TYPE_HEADER, REKOR_ACTOR_ID_HEADER, REKOR_ACTOR_LABEL_HEADER, REKOR_ACTOR_ORG_HEADER, REKOR_ACTOR_ADMIN_HEADER, REKOR_CLIENT_HEADER, REKOR_TOOL_ID_HEADER, REKOR_CLIENTS, rekorClientSchema, MAX_REKOR_TOOL_ID_LENGTH, rekorToolIdSchema, REKOR_V1_PREFIX, DATA_PROXY_ORG_QUERY_PARAM, MAX_PROVISIONING_BODY_BYTES, dataProxyQuery, rekorAttestation, REQUIRED_REKOR_ATTESTATION_HEADERS, REKOR_BOUND_BASE_HEADER, REKOR_BOUND_TOOLSET_HEADER, REKOR_BOUND_TOKEN_HEADER, REKOR_BOUND_CUSTOMER_HEADER, REKOR_BOUND_ACCESS_HEADER, REKOR_BOUND_ACCESS_SCOPE_HEADER, REKOR_BOUND_PAGE_HEADER, REKOR_BOUND_PERSON_HEADER, REKOR_PERSON_AUDIENCE_STAFF, REKOR_PERSON_AUDIENCE_CUSTOMER, REKOR_PERSON_ALL, REKOR_ACCESS_SCOPE_CUSTOMER, DATA_BASE_GENERATION_HEADER, REKOR_MAX_ACTOR_ID_LENGTH, REKOR_MAX_ACTOR_LABEL_LENGTH, REKOR_MAX_ACCESS_DIMENSIONS, REKOR_MAX_ACCESS_VALUES, REKOR_MAX_ACCESS_ID_LENGTH, REKOR_MAX_ACCESS_HEADER_LENGTH, REKOR_MAX_PERSON_PARTIES, REKOR_MAX_PERSON_IDS, REKOR_MAX_PERSON_ID_LENGTH, REKOR_MAX_PERSON_HEADER_LENGTH;
6585
+ var init_chunk_UE4KTV2N = __esm({
6586
+ "../../packages/core/dist/chunk-UE4KTV2N.js"() {
6587
+ "use strict";
6588
+ init_zod();
6589
+ REKOR_ACTOR_TYPE_HEADER = "X-Rekor-Actor-Type";
6590
+ REKOR_ACTOR_ID_HEADER = "X-Rekor-Actor-Id";
6591
+ REKOR_ACTOR_LABEL_HEADER = "X-Rekor-Actor-Label";
6592
+ REKOR_ACTOR_ORG_HEADER = "X-Rekor-Actor-Org";
6593
+ REKOR_ACTOR_ADMIN_HEADER = "X-Rekor-Actor-Admin";
6594
+ REKOR_CLIENT_HEADER = "X-Rekor-Client";
6595
+ REKOR_TOOL_ID_HEADER = "X-Rekor-Tool-Id";
6596
+ REKOR_CLIENTS = ["api", "cli", "mcp"];
6597
+ rekorClientSchema = external_exports.enum(REKOR_CLIENTS);
6598
+ MAX_REKOR_TOOL_ID_LENGTH = 128;
6599
+ rekorToolIdSchema = external_exports.string().trim().min(1).max(MAX_REKOR_TOOL_ID_LENGTH);
6600
+ REKOR_V1_PREFIX = "/v1";
6601
+ DATA_PROXY_ORG_QUERY_PARAM = "org_id";
6602
+ MAX_PROVISIONING_BODY_BYTES = 256 * 1024;
6603
+ dataProxyQuery = external_exports.object({
6604
+ [DATA_PROXY_ORG_QUERY_PARAM]: external_exports.string().uuid().optional()
6605
+ });
6606
+ rekorAttestation = external_exports.object({
6607
+ [REKOR_ACTOR_TYPE_HEADER]: external_exports.enum(["user", "token"]),
6608
+ [REKOR_ACTOR_ID_HEADER]: external_exports.string().min(1),
6609
+ [REKOR_ACTOR_LABEL_HEADER]: external_exports.string(),
6610
+ [REKOR_ACTOR_ORG_HEADER]: external_exports.string().uuid(),
6611
+ [REKOR_ACTOR_ADMIN_HEADER]: external_exports.enum(["0", "1"]),
6612
+ [REKOR_CLIENT_HEADER]: rekorClientSchema,
6613
+ [REKOR_TOOL_ID_HEADER]: rekorToolIdSchema.optional()
6614
+ });
6615
+ REQUIRED_REKOR_ATTESTATION_HEADERS = Object.entries(rekorAttestation.shape).filter(([, field]) => !field.isOptional()).map(([header]) => header);
6616
+ REKOR_BOUND_BASE_HEADER = "X-Rekor-Bound-Base";
6617
+ REKOR_BOUND_TOOLSET_HEADER = "X-Rekor-Bound-Toolset";
6618
+ REKOR_BOUND_TOKEN_HEADER = "X-Rekor-Bound-Token";
6619
+ REKOR_BOUND_CUSTOMER_HEADER = "X-Rekor-Bound-Customer";
6620
+ REKOR_BOUND_ACCESS_HEADER = "X-Rekor-Bound-Access";
6621
+ REKOR_BOUND_ACCESS_SCOPE_HEADER = "X-Rekor-Bound-Access-Scope";
6622
+ REKOR_BOUND_PAGE_HEADER = "X-Rekor-Bound-Page";
6623
+ REKOR_BOUND_PERSON_HEADER = "X-Rekor-Bound-Person";
6624
+ REKOR_PERSON_AUDIENCE_STAFF = "staff";
6625
+ REKOR_PERSON_AUDIENCE_CUSTOMER = "customer";
6626
+ REKOR_PERSON_ALL = "*";
6627
+ REKOR_ACCESS_SCOPE_CUSTOMER = "customer";
6628
+ DATA_BASE_GENERATION_HEADER = "X-Data-Base-Generation";
6629
+ REKOR_MAX_ACTOR_ID_LENGTH = 256;
6630
+ REKOR_MAX_ACTOR_LABEL_LENGTH = 256;
6631
+ REKOR_MAX_ACCESS_DIMENSIONS = 8;
6632
+ REKOR_MAX_ACCESS_VALUES = 100;
6633
+ REKOR_MAX_ACCESS_ID_LENGTH = 32;
6634
+ REKOR_MAX_ACCESS_HEADER_LENGTH = 65536;
6635
+ REKOR_MAX_PERSON_PARTIES = 16;
6636
+ REKOR_MAX_PERSON_IDS = 16;
6637
+ REKOR_MAX_PERSON_ID_LENGTH = 64;
6638
+ REKOR_MAX_PERSON_HEADER_LENGTH = 32768;
6639
+ }
6640
+ });
6641
+
6642
+ // ../../packages/core/dist/chunk-QSKQ4RFI.js
6342
6643
  function writeWithinRead(assignment) {
6343
6644
  return Object.values(assignment).every(({ read, write }) => read.includes(ACCESS_UNRESTRICTED) || !write.includes(ACCESS_UNRESTRICTED) && write.every((id) => read.includes(id)));
6344
6645
  }
@@ -6355,10 +6656,10 @@ function assignmentHasUnrestricted(assignment) {
6355
6656
  return Object.values(assignment).some((lists) => lists.read.includes(ACCESS_UNRESTRICTED) || lists.write.includes(ACCESS_UNRESTRICTED));
6356
6657
  }
6357
6658
  var ACCESS_UNRESTRICTED, ACCESS_ID_REGEX, ACCESS_ID_MAX_LENGTH, MAX_ACCESS_DIMENSIONS_PER_ORG, MAX_ACCESS_VALUES_PER_DIMENSION, ACCESS_LABEL_MAX_LENGTH, accessIdSchema, accessLabelSchema, accessValueListSchema, accessAssignmentSchema, accessSetSchema, accessDimensionParam, accessValueParam, orgMemberParam, orgHubParam, createAccessDimensionBody, updateAccessDimensionBody, createAccessValueBody, updateAccessValueBody, setMemberAccessValuesBody, HUB_PERSON_KINDS, ACCESS_PERSON_KINDS, setHubUserAccessValuesBody, setAgentAccessValuesBody;
6358
- var init_chunk_IAAIVRFJ = __esm({
6359
- "../../packages/core/dist/chunk-IAAIVRFJ.js"() {
6659
+ var init_chunk_QSKQ4RFI = __esm({
6660
+ "../../packages/core/dist/chunk-QSKQ4RFI.js"() {
6360
6661
  "use strict";
6361
- init_chunk_C2ID2BF7();
6662
+ init_chunk_UE4KTV2N();
6362
6663
  init_chunk_HZ6CADSY();
6363
6664
  init_zod();
6364
6665
  ACCESS_UNRESTRICTED = "*";
@@ -6429,14 +6730,23 @@ var init_chunk_IAAIVRFJ = __esm({
6429
6730
  }
6430
6731
  });
6431
6732
 
6432
- // ../../packages/core/dist/chunk-3FYOP6GU.js
6433
- var TOOLSET_SLUG_PATTERN, REKOR_STRUCTURAL_ID_PATTERN, baseEnvironmentSchema, toolsetFileToolSchema, toolsetSurfaceSchema, toolsetConnectionBindingSchema, rekorToolsetToolsSchema, rekorBoundAttestation, rekorResolvedToolsetSchema, REKOR_TOOL_KINDS_PARAM, REKOR_TOOL_KINDS_RESOLVE_SEARCH, resolvedRecordTypeSchema, reviewWritersSchema, sharedScopeSchema, resolvedFileToolSchema, rekorToolsetFileSchema, rekorToolsetFileUrlAnswerSchema, rekorToolsetFileListSchema, rekorToolsetFileGetSchema, rekorToolsetFilePutSchema, TOOLSET_CUSTOMER_FACING_REFUSAL_MARK, TOOLSET_CUSTOMER_FACING_REFUSAL;
6434
- var init_chunk_3FYOP6GU = __esm({
6435
- "../../packages/core/dist/chunk-3FYOP6GU.js"() {
6436
- "use strict";
6437
- init_chunk_IAAIVRFJ();
6438
- init_chunk_C2ID2BF7();
6439
- init_chunk_PTYXZZTE();
6733
+ // ../../packages/core/dist/chunk-DXLHSIKP.js
6734
+ function isEncodedBoundPerson(raw) {
6735
+ let parsed;
6736
+ try {
6737
+ parsed = JSON.parse(raw);
6738
+ } catch {
6739
+ return false;
6740
+ }
6741
+ return rekorBoundPersonSchema.safeParse(parsed).success;
6742
+ }
6743
+ var TOOLSET_SLUG_PATTERN, REKOR_STRUCTURAL_ID_PATTERN, baseEnvironmentSchema, toolsetFileToolSchema, toolsetSurfaceSchema, toolsetConnectionBindingSchema, rekorToolsetToolsSchema, rekorPersonIdSchema, rekorBoundPersonSchema, rekorBoundAttestation, rekorResolvedToolsetSchema, REKOR_TOOL_KINDS_PARAM, REKOR_TOOL_KINDS_RESOLVE_SEARCH, resolvedRecordTypeSchema, reviewWritersSchema, sharedScopeSchema, resolvedFileToolSchema, rekorToolsetFileSchema, rekorToolsetFileUrlAnswerSchema, rekorToolsetFileListSchema, rekorToolsetFileGetSchema, rekorToolsetFilePutSchema, TOOLSET_CUSTOMER_FACING_REFUSAL_MARK, TOOLSET_CUSTOMER_FACING_REFUSAL;
6744
+ var init_chunk_DXLHSIKP = __esm({
6745
+ "../../packages/core/dist/chunk-DXLHSIKP.js"() {
6746
+ "use strict";
6747
+ init_chunk_QSKQ4RFI();
6748
+ init_chunk_UE4KTV2N();
6749
+ init_chunk_PTYXZZTE();
6440
6750
  init_zod();
6441
6751
  TOOLSET_SLUG_PATTERN = /^[A-Za-z0-9_-]{1,128}$/;
6442
6752
  REKOR_STRUCTURAL_ID_PATTERN = TOOLSET_SLUG_PATTERN;
@@ -6532,6 +6842,15 @@ var init_chunk_3FYOP6GU = __esm({
6532
6842
  }))
6533
6843
  })
6534
6844
  });
6845
+ rekorPersonIdSchema = external_exports.string().max(REKOR_MAX_PERSON_ID_LENGTH).regex(REKOR_STRUCTURAL_ID_PATTERN);
6846
+ rekorBoundPersonSchema = external_exports.object({
6847
+ audience: external_exports.enum([REKOR_PERSON_AUDIENCE_STAFF, REKOR_PERSON_AUDIENCE_CUSTOMER]),
6848
+ parties: external_exports.array(external_exports.union([external_exports.array(rekorPersonIdSchema).max(REKOR_MAX_PERSON_IDS), external_exports.literal(REKOR_PERSON_ALL)])).max(REKOR_MAX_PERSON_PARTIES),
6849
+ agent_all: external_exports.boolean()
6850
+ }).strict().refine((person) => !person.agent_all || person.audience === REKOR_PERSON_AUDIENCE_STAFF, {
6851
+ message: `The agent's "*" applies only to a staff call`,
6852
+ path: ["agent_all"]
6853
+ });
6535
6854
  rekorBoundAttestation = rekorAttestation.extend({
6536
6855
  [REKOR_ACTOR_TYPE_HEADER]: external_exports.enum(["token", "user"]),
6537
6856
  /** Trimmed and checked as the far side trims and checks it. */
@@ -6568,7 +6887,14 @@ var init_chunk_3FYOP6GU = __esm({
6568
6887
  * The hub whose page makes the call (#5333): sent on every call of the page bridge, and on no other.
6569
6888
  * A hub id, read by the far side under the same structural charset as the other bound ids.
6570
6889
  */
6571
- [REKOR_BOUND_PAGE_HEADER]: external_exports.string().regex(REKOR_STRUCTURAL_ID_PATTERN).optional()
6890
+ [REKOR_BOUND_PAGE_HEADER]: external_exports.string().regex(REKOR_STRUCTURAL_ID_PATTERN).optional(),
6891
+ /**
6892
+ * The persons the call is for (#5473 §9): their header text (`encodeBoundPerson`), within the far side's
6893
+ * header cap. Not sent yet; the far side reads it and enforces nothing with it.
6894
+ */
6895
+ [REKOR_BOUND_PERSON_HEADER]: external_exports.string().max(REKOR_MAX_PERSON_HEADER_LENGTH).refine(isEncodedBoundPerson, {
6896
+ message: "Not the persons a bound call is for"
6897
+ }).optional()
6572
6898
  }).superRefine((bag, ctx) => {
6573
6899
  if (bag[REKOR_BOUND_ACCESS_SCOPE_HEADER] !== void 0 && bag[REKOR_BOUND_ACCESS_HEADER] === void 0) {
6574
6900
  ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: [REKOR_BOUND_ACCESS_SCOPE_HEADER], message: "Accepted only beside an access set" });
@@ -6672,268 +6998,393 @@ var init_chunk_3FYOP6GU = __esm({
6672
6998
  }
6673
6999
  });
6674
7000
 
6675
- // ../../packages/core/dist/chunk-IPDOHAZ5.js
6676
- var reportSourceSchema, intakeReportSourceSchema, reportClassificationSchema, reportStatusSchema, reportLocaleSchema, reportMessageAuthorRoleSchema, reportMessageSchema, sentryRefStatusSchema, createReportBody, editReportBody, reporterReportSummarySchema, reporterListResponseSchema, getReportResponseSchema, reporterTransitionResponseSchema, contestReportBody, reporterListQuery, listReportsQuery, GITHUB_ISSUE_URL_REGEX, githubIssueUrlSchema, transitionReportBody, groupReportsBody, holdReportBody;
6677
- var init_chunk_IPDOHAZ5 = __esm({
6678
- "../../packages/core/dist/chunk-IPDOHAZ5.js"() {
6679
- "use strict";
6680
- init_chunk_HZ6CADSY();
6681
- init_zod();
6682
- reportSourceSchema = external_exports.enum(["sentry", "cli", "review", "security_audit"]);
6683
- intakeReportSourceSchema = external_exports.enum(["cli", "review", "security_audit"]);
6684
- reportClassificationSchema = external_exports.enum(["bug", "flaky_test", "security", "enhancement"]);
6685
- reportStatusSchema = external_exports.enum([
6686
- "pending",
6687
- "grouped",
6688
- "escalated",
6689
- "shipped",
6690
- "contested",
6691
- "addressed",
6692
- "dismissed"
6693
- ]);
6694
- reportLocaleSchema = external_exports.enum(["en", "pt", "es"]);
6695
- reportMessageAuthorRoleSchema = external_exports.enum(["reporter", "triage", "fixer", "system"]);
6696
- reportMessageSchema = external_exports.object({
6697
- message_id: external_exports.string(),
6698
- author_role: reportMessageAuthorRoleSchema,
6699
- /** The status transition this note accompanied (e.g. 'shipped'); null for a free/system note. */
6700
- transition: external_exports.string().nullable(),
6701
- body: external_exports.string(),
6702
- created_at: timestampSchema,
6703
- /**
6704
- * Visibility: `false` = reporter-facing (the default for every narrative entry); `true` =
6705
- * triage-internal (e.g. a `hold` rationale) — surfaced to platform admins only and NEVER
6706
- * returned on the reporter read path. The reporter's `GET /api/reports/:id` filters these out.
6707
- */
6708
- internal: external_exports.boolean()
6709
- });
6710
- sentryRefStatusSchema = external_exports.enum(["valid", "not_found", "mismatch", "unverified"]);
6711
- createReportBody = external_exports.object({
6712
- title: external_exports.string().min(5).max(256),
6713
- description: external_exports.string().min(10).max(5e3),
6714
- steps_to_reproduce: external_exports.string().max(3e3).optional(),
6715
- error_message: external_exports.string().max(2e3).optional(),
6716
- // Taxonomy (server defaults: source=cli, classification=bug when absent).
6717
- source: intakeReportSourceSchema.optional(),
6718
- classification: reportClassificationSchema.optional(),
6719
- // Stable dedup key (e.g. "<file>::<test>" for flaky, "<file>:<line>" for
6720
- // security). When present, the fingerprint uses it instead of the body hash.
6721
- dedup_key: external_exports.string().min(1).max(256).optional(),
6722
- // Context fields (auto-captured by the CLI)
6723
- organization_id: external_exports.string().optional(),
6724
- hub_id: external_exports.string().uuid().optional(),
6725
- hub_name: external_exports.string().max(256).optional(),
6726
- conversation_id: external_exports.string().uuid().optional(),
6727
- agent_id: external_exports.string().uuid().optional(),
6728
- agent_name: external_exports.string().max(256).optional(),
6729
- client_version: external_exports.string().max(64).optional(),
6730
- additional_context: external_exports.string().max(2e3).optional()
6731
- });
6732
- editReportBody = external_exports.object({
6733
- title: external_exports.string().min(5).max(256).optional(),
6734
- description: external_exports.string().min(10).max(5e3).optional(),
6735
- steps_to_reproduce: external_exports.string().max(3e3).optional(),
6736
- error_message: external_exports.string().max(2e3).optional(),
6737
- additional_context: external_exports.string().max(2e3).optional()
6738
- }).strict().refine((b) => Object.keys(b).length > 0, {
6739
- message: "at least one field must be provided"
6740
- });
6741
- reporterReportSummarySchema = external_exports.object({
6742
- report_id: external_exports.string(),
6743
- title: external_exports.string(),
6744
- description: external_exports.string(),
6745
- classification: reportClassificationSchema,
6746
- status: reportStatusSchema,
6747
- created_at: timestampSchema,
6748
- triaged_at: timestampSchema.nullable(),
6749
- resolved_at: timestampSchema.nullable(),
6750
- /** How many times the reporter has contested (gates the hard cap). */
6751
- contest_count: external_exports.number(),
6752
- /** True once triage issued a non-contestable (final) dismissal. */
6753
- dismissal_final: external_exports.boolean()
6754
- });
6755
- reporterListResponseSchema = external_exports.object({
6756
- data: external_exports.array(reporterReportSummarySchema)
6757
- });
6758
- getReportResponseSchema = external_exports.object({
6759
- report: reporterReportSummarySchema,
6760
- messages: external_exports.array(reportMessageSchema)
6761
- });
6762
- reporterTransitionResponseSchema = external_exports.object({
6763
- report: reporterReportSummarySchema
6764
- });
6765
- contestReportBody = external_exports.object({
6766
- reason: external_exports.string().min(1).max(5e3)
6767
- });
6768
- reporterListQuery = external_exports.object({
6769
- status: reportStatusSchema.optional()
6770
- });
6771
- listReportsQuery = external_exports.object({
6772
- status: reportStatusSchema.optional(),
6773
- source: reportSourceSchema.optional(),
6774
- limit: external_exports.coerce.number().int().min(1).max(200).optional(),
6775
- offset: external_exports.coerce.number().int().min(0).optional(),
6776
- /** ISO 8601 lower bound on created_at. */
6777
- since: external_exports.string().datetime().optional(),
6778
- /**
6779
- * ISO 8601 lower bound on resolution time — "what did we resolve recently", which `since`
6780
- * (a created_at filter) cannot answer for a long-lived report resolved yesterday. Implies
6781
- * a terminal status (`addressed`/`dismissed`) and orders on that same axis.
6782
- */
6783
- resolved_since: external_exports.string().datetime().optional()
6784
- });
6785
- GITHUB_ISSUE_URL_REGEX = /^https:\/\/github\.com\/[^/]+\/[^/]+\/issues\/\d+(?:[/?#]|$)/;
6786
- githubIssueUrlSchema = external_exports.string().url().refine((u) => GITHUB_ISSUE_URL_REGEX.test(u), {
6787
- message: "must be an https://github.com/<owner>/<repo>/issues/<number> URL"
6788
- });
6789
- transitionReportBody = external_exports.discriminatedUnion("target", [
6790
- external_exports.object({
6791
- target: external_exports.literal("escalated"),
6792
- gh_issue_url: githubIssueUrlSchema,
6793
- ai_verdict: external_exports.string().max(2e3).optional()
6794
- }),
6795
- external_exports.object({
6796
- target: external_exports.literal("shipped"),
6797
- note: external_exports.string().min(1).max(2e3).optional()
6798
- }),
6799
- external_exports.object({
6800
- target: external_exports.literal("addressed")
6801
- }),
6802
- external_exports.object({
6803
- target: external_exports.literal("dismissed"),
6804
- dismissal_reason: external_exports.string().min(1).max(5e3),
6805
- ai_verdict: external_exports.string().max(2e3).optional(),
6806
- final: external_exports.boolean().optional()
6807
- })
6808
- ]);
6809
- groupReportsBody = external_exports.object({
6810
- member_ids: external_exports.array(external_exports.string().uuid()).min(1).max(100)
6811
- });
6812
- holdReportBody = external_exports.object({
6813
- reason: external_exports.string().min(1).max(5e3)
7001
+ // ../../packages/core/dist/chunk-WEXVYJ5H.js
7002
+ function containsKanbanPlaceholders(value) {
7003
+ if (value == null) return false;
7004
+ const serialized = typeof value === "string" ? value : JSON.stringify(value);
7005
+ for (const token of PLACEHOLDER_TOKENS) {
7006
+ if (serialized.includes(token)) return true;
7007
+ }
7008
+ return false;
7009
+ }
7010
+ function extractToolParameters(toolConfig) {
7011
+ let cfg = toolConfig;
7012
+ if (typeof cfg === "string") {
7013
+ try {
7014
+ cfg = JSON.parse(cfg);
7015
+ } catch {
7016
+ return void 0;
7017
+ }
7018
+ }
7019
+ if (!cfg || typeof cfg !== "object" || Array.isArray(cfg)) return void 0;
7020
+ return cfg.parameters;
7021
+ }
7022
+ function isRecord(v) {
7023
+ return typeof v === "object" && v !== null && !Array.isArray(v);
7024
+ }
7025
+ function isPrimitive(v) {
7026
+ return v === null || ["string", "number", "boolean"].includes(typeof v);
7027
+ }
7028
+ function typeMatches(typeField, allowed) {
7029
+ if (typeof typeField === "string") return allowed.has(typeField);
7030
+ if (Array.isArray(typeField)) return typeField.every((t) => typeof t === "string" && allowed.has(t));
7031
+ return false;
7032
+ }
7033
+ function validateSchema(schema, path44, errors, opts = {}) {
7034
+ if (typeof schema === "boolean") return;
7035
+ const depth = opts.depth ?? 0;
7036
+ if (depth > MAX_SCHEMA_DEPTH) {
7037
+ errors.push({
7038
+ path: path44 || "<root>",
7039
+ message: `schema nesting exceeds ${MAX_SCHEMA_DEPTH} levels`,
7040
+ suggestion: "Flatten the schema; LLM providers reject deeply nested tool input_schemas."
6814
7041
  });
7042
+ return;
6815
7043
  }
6816
- });
6817
-
6818
- // ../../packages/core/dist/chunk-GPM7PE44.js
6819
- var bootstrapQuery;
6820
- var init_chunk_GPM7PE44 = __esm({
6821
- "../../packages/core/dist/chunk-GPM7PE44.js"() {
6822
- "use strict";
6823
- init_zod();
6824
- bootstrapQuery = external_exports.object({
6825
- active_hub_id: external_exports.string().uuid().optional(),
6826
- active_conversation_id: external_exports.string().uuid().optional(),
6827
- active_nav: external_exports.enum(["chat", "task", "support"]).optional(),
6828
- /**
6829
- * The people thread the URL names (`/chat/threads/:threadId`, gh #4661): the snapshot
6830
- * preloads it as `people.active_thread` when the viewer is a member.
6831
- */
6832
- active_thread_id: external_exports.string().uuid().optional()
7044
+ if (!isRecord(schema)) {
7045
+ errors.push({
7046
+ path: path44,
7047
+ message: `expected object, got ${schema === null ? "null" : typeof schema}`
6833
7048
  });
7049
+ return;
6834
7050
  }
6835
- });
6836
-
6837
- // ../../packages/core/dist/chunk-5VL6LBFD.js
6838
- var PERMISSIONS;
6839
- var init_chunk_5VL6LBFD = __esm({
6840
- "../../packages/core/dist/chunk-5VL6LBFD.js"() {
6841
- "use strict";
6842
- PERMISSIONS = [
6843
- "hub:read",
6844
- "hub:write",
6845
- "hub:admin",
6846
- "conversation:read",
6847
- "conversation:write",
6848
- "analytics:read",
6849
- "billing:read",
6850
- "billing:write",
6851
- "org:read",
6852
- "org:write",
6853
- "org:admin",
6854
- "contacts:write",
6855
- "platform:admin",
6856
- "*"
6857
- ];
7051
+ if (opts.isRoot) {
7052
+ if ("type" in schema && schema.type !== "object") {
7053
+ errors.push({
7054
+ path: path44 ? `${path44}.type` : "type",
7055
+ message: `root type must be 'object', got ${JSON.stringify(schema.type)}`,
7056
+ suggestion: "Tool parameters at the root must be an object: `{ type: 'object', properties: { ... } }`."
7057
+ });
7058
+ }
7059
+ } else if ("type" in schema && !typeMatches(schema.type, ALLOWED_TYPES)) {
7060
+ errors.push({
7061
+ path: `${path44}.type`,
7062
+ message: `type must be one of ${[...ALLOWED_TYPES].join("/")} or an array of those, got ${JSON.stringify(schema.type)}`
7063
+ });
6858
7064
  }
6859
- });
6860
-
6861
- // ../../packages/core/dist/chunk-VEERWOZ6.js
6862
- var MAX_NAME_LENGTH2, MAX_HUBS_PER_GRANT, MAX_HUB_TAGS_PER_GRANT, MAX_GRANTS, permissionEnum, grantScopeSchema, grantSchema, createTokenBody, tokenOrgIdParam;
6863
- var init_chunk_VEERWOZ6 = __esm({
6864
- "../../packages/core/dist/chunk-VEERWOZ6.js"() {
6865
- "use strict";
6866
- init_chunk_5VL6LBFD();
7065
+ if ("enum" in schema) {
7066
+ const e = schema.enum;
7067
+ if (typeof e === "string") {
7068
+ const isPlaceholder = PLACEHOLDER_TOKENS.includes(e);
7069
+ const isOutcomePlaceholder = e === "[KANBAN_OUTCOME_VALUES]";
7070
+ errors.push({
7071
+ path: `${path44}.enum`,
7072
+ message: `enum must be a non-empty array of primitives, got string ${JSON.stringify(e)}`,
7073
+ 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"]`.'
7074
+ });
7075
+ } else if (!Array.isArray(e)) {
7076
+ errors.push({
7077
+ path: `${path44}.enum`,
7078
+ message: `enum must be a non-empty array of primitives, got ${typeof e}`
7079
+ });
7080
+ } else if (e.length === 0) {
7081
+ errors.push({
7082
+ path: `${path44}.enum`,
7083
+ message: "enum must not be empty"
7084
+ });
7085
+ } else {
7086
+ for (let i = 0; i < e.length; i++) {
7087
+ if (!isPrimitive(e[i])) {
7088
+ errors.push({
7089
+ path: `${path44}.enum[${i}]`,
7090
+ message: `enum entry must be a primitive (string/number/boolean/null), got ${typeof e[i]}`
7091
+ });
7092
+ }
7093
+ }
7094
+ }
7095
+ }
7096
+ for (const key of ["exclusiveMinimum", "exclusiveMaximum"]) {
7097
+ if (key in schema && typeof schema[key] === "boolean") {
7098
+ errors.push({
7099
+ path: `${path44}.${key}`,
7100
+ message: `${key} as boolean is draft-04 syntax; draft 2020-12 requires a numeric value`,
7101
+ suggestion: `Replace with the numeric bound, e.g. \`${key}: 0\`.`
7102
+ });
7103
+ }
7104
+ }
7105
+ if ("properties" in schema) {
7106
+ if (!isRecord(schema.properties)) {
7107
+ errors.push({
7108
+ path: `${path44}.properties`,
7109
+ message: `properties must be an object, got ${Array.isArray(schema.properties) ? "array" : typeof schema.properties}`
7110
+ });
7111
+ } else {
7112
+ for (const [propName, propSchema] of Object.entries(schema.properties)) {
7113
+ validateSchema(propSchema, `${path44}.properties.${propName}`, errors, { depth: depth + 1 });
7114
+ }
7115
+ }
7116
+ }
7117
+ if (schemaTypeIncludes(schema, "array") && "items" in schema) {
7118
+ if (Array.isArray(schema.items)) {
7119
+ schema.items.forEach((sub, i) => validateSchema(sub, `${path44}.items[${i}]`, errors, { depth: depth + 1 }));
7120
+ } else {
7121
+ validateSchema(schema.items, `${path44}.items`, errors, { depth: depth + 1 });
7122
+ }
7123
+ }
7124
+ for (const key of SUBSCHEMA_OBJECT_KEYWORDS) {
7125
+ if (key in schema && isRecord(schema[key])) {
7126
+ validateSchema(schema[key], `${path44}.${key}`, errors, { depth: depth + 1 });
7127
+ }
7128
+ }
7129
+ for (const key of SUBSCHEMA_LIST_KEYWORDS) {
7130
+ const list2 = schema[key];
7131
+ if (Array.isArray(list2)) {
7132
+ list2.forEach((sub, i) => validateSchema(sub, `${path44}.${key}[${i}]`, errors, { depth: depth + 1 }));
7133
+ }
7134
+ }
7135
+ for (const key of SUBSCHEMA_MAP_KEYWORDS) {
7136
+ const map = schema[key];
7137
+ if (isRecord(map)) {
7138
+ for (const [name, sub] of Object.entries(map)) {
7139
+ validateSchema(sub, `${path44}.${key}.${name}`, errors, { depth: depth + 1 });
7140
+ }
7141
+ }
7142
+ }
7143
+ const reportedPaths = new Set(errors.map((e) => e.path));
7144
+ for (const [k, v] of Object.entries(schema)) {
7145
+ if (typeof v !== "string") continue;
7146
+ const fieldPath = `${path44}.${k}`;
7147
+ if (reportedPaths.has(fieldPath)) continue;
7148
+ for (const token of PLACEHOLDER_TOKENS) {
7149
+ if (v === token) {
7150
+ errors.push({
7151
+ path: fieldPath,
7152
+ message: `unresolved placeholder ${JSON.stringify(token)}`,
7153
+ 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`."
7154
+ });
7155
+ }
7156
+ }
7157
+ }
7158
+ }
7159
+ function schemaTypeIncludes(schema, wanted) {
7160
+ const t = schema.type;
7161
+ if (typeof t === "string") return t === wanted;
7162
+ if (Array.isArray(t)) return t.includes(wanted);
7163
+ return false;
7164
+ }
7165
+ function validateToolInputSchema(schema) {
7166
+ const errors = [];
7167
+ if (!isRecord(schema)) {
7168
+ errors.push({
7169
+ path: "",
7170
+ message: `expected object at root, got ${schema === null ? "null" : typeof schema}`
7171
+ });
7172
+ return { ok: false, errors };
7173
+ }
7174
+ validateSchema(schema, "", errors, { isRoot: true });
7175
+ return errors.length === 0 ? { ok: true } : { ok: false, errors };
7176
+ }
7177
+ var PLACEHOLDER_TOKENS, ALLOWED_TYPES, SUBSCHEMA_OBJECT_KEYWORDS, SUBSCHEMA_LIST_KEYWORDS, SUBSCHEMA_MAP_KEYWORDS, MAX_SCHEMA_DEPTH;
7178
+ var init_chunk_WEXVYJ5H = __esm({
7179
+ "../../packages/core/dist/chunk-WEXVYJ5H.js"() {
7180
+ "use strict";
7181
+ PLACEHOLDER_TOKENS = [
7182
+ "[KANBAN_STATUS_VALUES]",
7183
+ "[KANBAN_STATUS_NAMES]",
7184
+ "[SCHEDULING_STATUS_NAMES]",
7185
+ "[STATE_SLUG_VALUES]",
7186
+ // Carried by `close_conversation` as well as `update_kanban_status`, since an
7187
+ // agent close routes through the terminal transition. Omitting them here does not
7188
+ // merely weaken a hint: `containsKanbanPlaceholders` is what lets HubDO's render
7189
+ // chokepoint recognize a template config, and its other trigger is
7190
+ // `operation === 'update_kanban_status'` — so a token missing from this list means
7191
+ // `close_conversation` is never rendered and is then rejected as malformed.
7192
+ "[KANBAN_OUTCOME_VALUES]",
7193
+ "[KANBAN_OUTCOME_NAMES]"
7194
+ ];
7195
+ ALLOWED_TYPES = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "object", "array", "null"]);
7196
+ SUBSCHEMA_OBJECT_KEYWORDS = [
7197
+ "additionalProperties",
7198
+ "unevaluatedProperties",
7199
+ "additionalItems",
7200
+ "unevaluatedItems",
7201
+ "contains",
7202
+ "propertyNames",
7203
+ "not",
7204
+ "if",
7205
+ "then",
7206
+ "else"
7207
+ ];
7208
+ SUBSCHEMA_LIST_KEYWORDS = ["allOf", "anyOf", "oneOf", "prefixItems"];
7209
+ SUBSCHEMA_MAP_KEYWORDS = ["$defs", "definitions", "patternProperties", "dependentSchemas"];
7210
+ MAX_SCHEMA_DEPTH = 20;
7211
+ }
7212
+ });
7213
+
7214
+ // ../../packages/core/dist/chunk-MVJOHMHA.js
7215
+ function utf8ByteLength(text2) {
7216
+ let bytes = 0;
7217
+ for (let i = 0; i < text2.length; i++) {
7218
+ const code = text2.charCodeAt(i);
7219
+ if (code < 128) bytes += 1;
7220
+ else if (code < 2048) bytes += 2;
7221
+ else if (code >= 55296 && code <= 56319 && i + 1 < text2.length) {
7222
+ const next = text2.charCodeAt(i + 1);
7223
+ if (next >= 56320 && next <= 57343) {
7224
+ bytes += 4;
7225
+ i += 1;
7226
+ } else {
7227
+ bytes += 3;
7228
+ }
7229
+ } else bytes += 3;
7230
+ }
7231
+ return bytes;
7232
+ }
7233
+ function pageHtmlIssue(html) {
7234
+ if (typeof html !== "string" || !/\S/.test(html)) return "a page needs its HTML: one non-empty, self-contained file";
7235
+ const bytes = utf8ByteLength(html);
7236
+ if (bytes > PAGE_HTML_MAX_BYTES) {
7237
+ return `a page's HTML is at most ${PAGE_HTML_MAX_BYTES / 1024} KiB; this one is ${Math.ceil(bytes / 1024)} KiB`;
7238
+ }
7239
+ return null;
7240
+ }
7241
+ 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;
7242
+ var init_chunk_MVJOHMHA = __esm({
7243
+ "../../packages/core/dist/chunk-MVJOHMHA.js"() {
7244
+ "use strict";
7245
+ init_chunk_WEXVYJ5H();
6867
7246
  init_chunk_HZ6CADSY();
6868
7247
  init_zod();
6869
- MAX_NAME_LENGTH2 = 100;
6870
- MAX_HUBS_PER_GRANT = 50;
6871
- MAX_HUB_TAGS_PER_GRANT = 20;
6872
- MAX_GRANTS = 20;
6873
- permissionEnum = external_exports.enum(PERMISSIONS).refine(
6874
- (p) => p !== "platform:admin",
6875
- { message: "platform:admin cannot be delegated via token creation" }
6876
- );
6877
- grantScopeSchema = external_exports.object({
6878
- // Required: every token grant must declare its org tenancy. The handler
6879
- // also strict-checks this as defense-in-depth, but failing at the Zod
6880
- // boundary keeps the generated client type honest (org_id: string).
6881
- org_id: external_exports.string().min(1),
6882
- 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),
6883
- 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(),
6884
- environments: external_exports.array(external_exports.enum(["production", "preview"])).min(1, "scope.environments must be a non-empty array if provided").optional()
7248
+ PAGES_PER_HUB_MAX = 20;
7249
+ PAGE_HTML_MAX_BYTES = 512 * 1024;
7250
+ PAGE_SLUG_MAX = 64;
7251
+ PAGE_SLUG_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
7252
+ PAGE_TITLE_MAX = 120;
7253
+ PAGE_DESCRIPTION_MAX = 500;
7254
+ PAGE_ORDER_MAX = 1e3;
7255
+ PAGE_TOOLS_MAX = 50;
7256
+ PAGE_CONNECTION_NAME_MAX = 200;
7257
+ PAGE_TOOL_NAME_MAX = 128;
7258
+ PAGE_PARAMS_MAX_CHARS = 16 * 1024;
7259
+ PAGE_AUDIENCES = ["team", "customers"];
7260
+ PAGE_NOTIFY_LEVELS = ["none", "summary"];
7261
+ pageSlugSchema = external_exports.string().min(1).max(PAGE_SLUG_MAX).regex(PAGE_SLUG_REGEX, {
7262
+ message: 'a page slug is lowercase letters, digits and hyphens (e.g. "swim-results")'
7263
+ });
7264
+ pageToolSchema = external_exports.object({
7265
+ /** The toolset connection's name, as `hub.yaml` names it. */
7266
+ connection: external_exports.string().trim().min(1).max(PAGE_CONNECTION_NAME_MAX),
7267
+ /** The tool's name in its connection's catalog. */
7268
+ tool: external_exports.string().trim().min(1).max(PAGE_TOOL_NAME_MAX),
7269
+ notify: external_exports.enum(PAGE_NOTIFY_LEVELS).default("none")
6885
7270
  }).strict();
6886
- grantSchema = external_exports.object({
6887
- scope: grantScopeSchema,
6888
- permissions: external_exports.array(permissionEnum).min(1, "Each grant must have permissions as a non-empty array")
7271
+ pageParamsSchema = external_exports.record(external_exports.unknown()).superRefine((schema, ctx) => {
7272
+ if (JSON.stringify(schema).length > PAGE_PARAMS_MAX_CHARS) {
7273
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: `params is at most ${PAGE_PARAMS_MAX_CHARS} characters of JSON` });
7274
+ return;
7275
+ }
7276
+ const result = validateToolInputSchema(schema);
7277
+ if (!result.ok) {
7278
+ for (const error of result.errors) {
7279
+ ctx.addIssue({
7280
+ code: external_exports.ZodIssueCode.custom,
7281
+ message: `params is not a valid JSON Schema${error.path ? ` at "${error.path}"` : ""}: ${error.message}`
7282
+ });
7283
+ }
7284
+ }
7285
+ });
7286
+ pageManifestObject = external_exports.object({
7287
+ slug: pageSlugSchema,
7288
+ title: external_exports.string().trim().min(1).max(PAGE_TITLE_MAX),
7289
+ description: external_exports.string().trim().max(PAGE_DESCRIPTION_MAX).nullable().default(null),
7290
+ audience: external_exports.enum(PAGE_AUDIENCES, {
7291
+ errorMap: () => ({ message: 'audience must be "team" or "customers"' })
7292
+ }),
7293
+ /** A team page's: the hub's team users may run its write tools. A `conversation:write` grant on the hub always may. */
7294
+ team_writes: external_exports.boolean().default(false),
7295
+ /**
7296
+ * A customer page's: its customers may run its write tools, each on their own records (opt-in). Stored
7297
+ * only when stated, so a page that states none (every team page) keeps the manifest it had.
7298
+ */
7299
+ customer_writes: external_exports.boolean().optional(),
7300
+ /** The page is offered in the conversation header to whoever may open it. Required on a customer page. */
7301
+ show_in_conversation: external_exports.boolean().default(false),
7302
+ /** Menu position, lowest first; pages of equal order sort by slug. */
7303
+ order: external_exports.number().int().min(0).max(PAGE_ORDER_MAX).default(0),
7304
+ params: pageParamsSchema.nullable().default(null),
7305
+ tools: external_exports.array(pageToolSchema).max(PAGE_TOOLS_MAX).default([])
6889
7306
  }).strict();
6890
- createTokenBody = external_exports.object({
6891
- name: external_exports.string().trim().min(1, "name is required").max(MAX_NAME_LENGTH2, `name must be ${MAX_NAME_LENGTH2} characters or fewer`),
6892
- grants: external_exports.array(grantSchema).min(1, "grants must be a non-empty array").max(MAX_GRANTS),
6893
- expires_at: external_exports.string().datetime({ message: "expires_at must be a valid ISO 8601 date" }).refine(
6894
- (s) => new Date(s).getTime() > Date.now(),
6895
- { message: "expires_at must be in the future" }
6896
- ).optional()
7307
+ pageManifestSchema = pageManifestObject.superRefine((manifest, ctx) => {
7308
+ if (manifest.audience === "customers") {
7309
+ if (!manifest.show_in_conversation) {
7310
+ ctx.addIssue({
7311
+ code: external_exports.ZodIssueCode.custom,
7312
+ path: ["show_in_conversation"],
7313
+ message: "a customer page sets show_in_conversation: true, since the conversation header is a customer's only way in"
7314
+ });
7315
+ }
7316
+ if (manifest.team_writes) {
7317
+ 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" });
7318
+ }
7319
+ if (manifest.tools.some((t) => t.notify !== "none")) {
7320
+ ctx.addIssue({
7321
+ code: external_exports.ZodIssueCode.custom,
7322
+ path: ["tools"],
7323
+ message: "a customer page's tools are notify: none: the agent does not hear a customer page's calls yet"
7324
+ });
7325
+ }
7326
+ } else if (manifest.customer_writes) {
7327
+ 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" });
7328
+ }
7329
+ const seen = /* @__PURE__ */ new Set();
7330
+ manifest.tools.forEach((t, i) => {
7331
+ if (seen.has(t.tool)) {
7332
+ ctx.addIssue({
7333
+ code: external_exports.ZodIssueCode.custom,
7334
+ path: ["tools", i, "tool"],
7335
+ message: `two tools are named "${t.tool}": a page calls a tool by its name alone, so tool names are unique across the manifest`
7336
+ });
7337
+ }
7338
+ seen.add(t.tool);
7339
+ });
6897
7340
  });
6898
- tokenOrgIdParam = external_exports.object({ orgId: uuidSchema });
7341
+ pageSummarySchema = external_exports.object({
7342
+ slug: external_exports.string(),
7343
+ title: external_exports.string(),
7344
+ description: external_exports.string().nullable(),
7345
+ audience: external_exports.string(),
7346
+ team_writes: external_exports.boolean(),
7347
+ /** A customer page's opt-in to writes, when its manifest states it; absent otherwise. */
7348
+ customer_writes: external_exports.boolean().optional(),
7349
+ show_in_conversation: external_exports.boolean(),
7350
+ order: external_exports.number(),
7351
+ params: external_exports.record(external_exports.unknown()).nullable(),
7352
+ tools: external_exports.array(external_exports.object({ connection: external_exports.string(), tool: external_exports.string(), notify: external_exports.string() })),
7353
+ revision: external_exports.string(),
7354
+ /** The HTML's size in UTF-8 bytes. */
7355
+ html_bytes: external_exports.number().int().nonnegative(),
7356
+ created_at: external_exports.string(),
7357
+ updated_at: external_exports.string()
7358
+ });
7359
+ hubPagesParam = external_exports.object({ hub_id: uuidSchema });
7360
+ hubPagesQuery = external_exports.object({ audience: external_exports.enum(PAGE_AUDIENCES).optional() });
7361
+ hubPageParam = external_exports.object({ hub_id: uuidSchema, slug: pageSlugSchema });
7362
+ pageRevisionSchema = external_exports.string().regex(/^[0-9a-f]{64}$/, { message: "a page revision is 64 hex digits" });
7363
+ PAGE_TOOL_CALL_BODY_MAX_BYTES = 1024 * 1024;
7364
+ pageToolCallBody = external_exports.object({
7365
+ revision: pageRevisionSchema,
7366
+ tool: external_exports.string().min(1).max(PAGE_TOOL_NAME_MAX),
7367
+ arguments: external_exports.record(external_exports.unknown()).default({}),
7368
+ conversation_id: uuidSchema.optional()
7369
+ }).strict();
7370
+ PAGE_REVISION_STALE_CODE = "PAGE_REVISION_STALE";
6899
7371
  }
6900
7372
  });
6901
7373
 
6902
- // ../../packages/core/dist/chunk-FPSDNS2E.js
6903
- var noticeSeveritySchema, noticeStatusSchema, NOTICE_SCOPE_REGEX, noticeScopeSchema, noticeLinkSchema, createNoticeBody, updateNoticeBody, listNoticesQuery, noticeIdParamSchema;
6904
- var init_chunk_FPSDNS2E = __esm({
6905
- "../../packages/core/dist/chunk-FPSDNS2E.js"() {
7374
+ // ../../packages/core/dist/chunk-UXC3VPMK.js
7375
+ var hubPageWatchParam, pageWatchedBaseSchema, hubPageWatchResponseSchema;
7376
+ var init_chunk_UXC3VPMK = __esm({
7377
+ "../../packages/core/dist/chunk-UXC3VPMK.js"() {
6906
7378
  "use strict";
7379
+ init_chunk_DXLHSIKP();
7380
+ init_chunk_MVJOHMHA();
7381
+ init_chunk_HZ6CADSY();
6907
7382
  init_zod();
6908
- noticeSeveritySchema = external_exports.enum(["critical", "warn", "info"]);
6909
- noticeStatusSchema = external_exports.enum(["active", "resolved"]);
6910
- NOTICE_SCOPE_REGEX = /^(global|provider:[a-z0-9_-]{1,40}|service:[a-z0-9_-]{1,40})$/;
6911
- noticeScopeSchema = external_exports.string().regex(NOTICE_SCOPE_REGEX, "scope must be 'global', 'provider:<x>', or 'service:<x>'");
6912
- noticeLinkSchema = external_exports.string().url().refine((u) => /^https?:\/\//i.test(u), { message: "link must be an http(s) URL" });
6913
- createNoticeBody = external_exports.object({
6914
- severity: noticeSeveritySchema.default("info"),
6915
- scope: noticeScopeSchema.default("global"),
6916
- title: external_exports.string().trim().min(1).max(200),
6917
- body: external_exports.string().max(2e3).optional(),
6918
- link: noticeLinkSchema.optional(),
6919
- starts_at: external_exports.string().datetime().optional(),
6920
- ends_at: external_exports.string().datetime().optional()
6921
- });
6922
- updateNoticeBody = external_exports.object({
6923
- severity: noticeSeveritySchema.optional(),
6924
- scope: noticeScopeSchema.optional(),
6925
- title: external_exports.string().trim().min(1).max(200).optional(),
6926
- body: external_exports.string().max(2e3).nullable().optional(),
6927
- link: noticeLinkSchema.nullable().optional(),
6928
- starts_at: external_exports.string().datetime().optional(),
6929
- ends_at: external_exports.string().datetime().nullable().optional()
6930
- }).refine((b) => Object.keys(b).length > 0, { message: "at least one field must be provided" });
6931
- listNoticesQuery = external_exports.object({
6932
- status: noticeStatusSchema.optional(),
6933
- limit: external_exports.coerce.number().int().min(1).max(200).optional(),
6934
- offset: external_exports.coerce.number().int().min(0).optional()
7383
+ hubPageWatchParam = external_exports.object({ hub_id: uuidSchema, slug: pageSlugSchema, watch_id: uuidSchema });
7384
+ pageWatchedBaseSchema = toolsetConnectionBindingSchema.pick({ base_id: true, environment: true });
7385
+ hubPageWatchResponseSchema = external_exports.object({
7386
+ data: external_exports.object({ bases: external_exports.array(pageWatchedBaseSchema), expires_at: timestampSchema.nullable(), org_id: uuidSchema })
6935
7387
  });
6936
- noticeIdParamSchema = external_exports.object({ id: external_exports.string().min(1) });
6937
7388
  }
6938
7389
  });
6939
7390
 
@@ -7041,33 +7492,6 @@ var init_chunk_Y7CFCYX4 = __esm({
7041
7492
  }
7042
7493
  });
7043
7494
 
7044
- // ../../packages/core/dist/chunk-5DGHIY7L.js
7045
- var rekorBaseChangeMessageSchema;
7046
- var init_chunk_5DGHIY7L = __esm({
7047
- "../../packages/core/dist/chunk-5DGHIY7L.js"() {
7048
- "use strict";
7049
- init_zod();
7050
- rekorBaseChangeMessageSchema = external_exports.object({
7051
- /** The WayAI org UUID — one id namespace. */
7052
- org_id: external_exports.string().uuid(),
7053
- /**
7054
- * Not a UUID: a preview base id is `{prod_base_id}--{slug}`. Immutable per base — a
7055
- * preview clone is its OWN base_id — so `(base_id, scope)` keys never collide across
7056
- * environments. Empty is never a real base id, so it is non-conforming rather than a
7057
- * frame keyed on nothing.
7058
- */
7059
- base_id: external_exports.string().min(1),
7060
- /**
7061
- * Rides along so the client scopes its refetch without a lookup; the inspector scopes
7062
- * by side.
7063
- */
7064
- environment: external_exports.enum(["production", "preview"]),
7065
- /** Which pane refetches. `base` covers create/delete/promote/config changes. */
7066
- scope: external_exports.enum(["records", "record_types", "files", "base"])
7067
- });
7068
- }
7069
- });
7070
-
7071
7495
  // ../../packages/core/dist/chunk-SY6PLCPK.js
7072
7496
  var jsonSchemaSchema, hubUserIdentity, stateValueEntry, getHubUserContextResponse, updateHubUserBody, updateHubUserResponse, unlockHubUserNameResponse, stateResetParams, stateResetResponse;
7073
7497
  var init_chunk_SY6PLCPK = __esm({
@@ -9877,11 +10301,11 @@ function schemaToQuestions(schema) {
9877
10301
  }
9878
10302
  function classifySchema(schema) {
9879
10303
  const fields = /* @__PURE__ */ new Map();
9880
- if (!isRecord(schema) || schema.type !== "object") {
10304
+ if (!isRecord2(schema) || schema.type !== "object") {
9881
10305
  return { fields, refusals: [{ field: null, reason: "schema_not_object" }] };
9882
10306
  }
9883
10307
  const properties = schema.properties;
9884
- if (!isRecord(properties) || Object.keys(properties).length === 0) {
10308
+ if (!isRecord2(properties) || Object.keys(properties).length === 0) {
9885
10309
  return { fields, refusals: [{ field: null, reason: "schema_has_no_properties" }] };
9886
10310
  }
9887
10311
  const refusals = [];
@@ -9896,7 +10320,7 @@ function classifySchema(schema) {
9896
10320
  return refusals.length > 0 ? { fields: /* @__PURE__ */ new Map(), refusals } : { fields, refusals };
9897
10321
  }
9898
10322
  function classifyField(field, property) {
9899
- if (!isRecord(property)) return { reason: "unsupported_type" };
10323
+ if (!isRecord2(property)) return { reason: "unsupported_type" };
9900
10324
  const instructions = describeField(field, property);
9901
10325
  if (property.enum !== void 0) {
9902
10326
  const declared = property.enum;
@@ -9943,13 +10367,13 @@ function toQuestion(primitive) {
9943
10367
  }
9944
10368
  }
9945
10369
  function describeField(field, property) {
9946
- const description2 = isRecord(property) ? property.description : void 0;
10370
+ const description2 = isRecord2(property) ? property.description : void 0;
9947
10371
  return typeof description2 === "string" && description2.trim() !== "" ? description2 : field;
9948
10372
  }
9949
10373
  function scoreLevels(minimum, levels) {
9950
10374
  return Array.from({ length: levels }, (_, index) => String(minimum + index));
9951
10375
  }
9952
- function isRecord(value) {
10376
+ function isRecord2(value) {
9953
10377
  return typeof value === "object" && value !== null && !Array.isArray(value);
9954
10378
  }
9955
10379
  var CONFIDENCE_VARIABLE_SUFFIX, DECISION_SCORE_MIN_LEVELS, DECISION_SCORE_MAX_LEVELS;
@@ -11015,258 +11439,45 @@ var init_chunk_BPCNB5RT = __esm({
11015
11439
  // fan-out it would otherwise discard client-side (gh #3319).
11016
11440
  scope_hub_id: external_exports.string().uuid().optional(),
11017
11441
  conversation_id: external_exports.string().uuid().optional(),
11018
- // 'ended' = recently-closed, served warm from the HubDO index (≤ retention
11019
- // window). 'archived' = the full closed-conversation history from ClickHouse.
11020
- status: external_exports.enum(["active", "agent", "team", "ended", "archived"]).optional(),
11021
- page: external_exports.string().regex(/^\d+$/).optional(),
11022
- page_size: external_exports.string().regex(/^\d+$/).optional()
11023
- });
11024
- getMessagesQuery = external_exports.object({
11025
- hub_id: external_exports.string().uuid(),
11026
- hub_team_user_id: external_exports.string().optional(),
11027
- hub_user_id: external_exports.string().optional(),
11028
- conversation_id: external_exports.string().uuid().optional(),
11029
- message_id: external_exports.string().uuid().optional(),
11030
- // `page` = LEGACY oldest-first offset paging (deployed page-based clients).
11031
- // Its PRESENCE selects the legacy read path server-side; a new client omits it
11032
- // and instead sends `page_size` + (for older pages) the keyset cursor below.
11033
- page: external_exports.string().regex(/^\d+$/).optional(),
11034
- page_size: external_exports.string().regex(/^\d+$/).optional(),
11035
- // Keyset cursor for the newest-first scroll (`page` absent): return only
11036
- // messages strictly older than (before_created_at, before_message_id) — the
11037
- // oldest currently-loaded VISIBLE message. UTC ISO-8601 (Timestamps standard);
11038
- // `datetime()` hardens it before the parameterized DO predicate.
11039
- before_created_at: external_exports.string().datetime().optional(),
11040
- before_message_id: external_exports.string().uuid().optional(),
11041
- /**
11042
- * When true AND the caller has support access (hub admin or hub team member),
11043
- * internal messages (tool calls, tool results) are included in the response.
11044
- * Silently ignored for non-support callers — it's a view preference, not an
11045
- * authorization boundary.
11046
- */
11047
- include_internal: external_exports.union([external_exports.literal("true"), external_exports.literal("false"), external_exports.boolean()]).optional().transform((v) => v === true || v === "true")
11048
- }).superRefine((q, ctx) => {
11049
- if (q.before_created_at == null !== (q.before_message_id == null)) {
11050
- ctx.addIssue({
11051
- code: external_exports.ZodIssueCode.custom,
11052
- message: "before_created_at and before_message_id must be provided together",
11053
- path: [q.before_created_at == null ? "before_created_at" : "before_message_id"]
11054
- });
11055
- }
11056
- });
11057
- }
11058
- });
11059
-
11060
- // ../../packages/core/dist/chunk-WEXVYJ5H.js
11061
- function containsKanbanPlaceholders(value) {
11062
- if (value == null) return false;
11063
- const serialized = typeof value === "string" ? value : JSON.stringify(value);
11064
- for (const token of PLACEHOLDER_TOKENS) {
11065
- if (serialized.includes(token)) return true;
11066
- }
11067
- return false;
11068
- }
11069
- function extractToolParameters(toolConfig) {
11070
- let cfg = toolConfig;
11071
- if (typeof cfg === "string") {
11072
- try {
11073
- cfg = JSON.parse(cfg);
11074
- } catch {
11075
- return void 0;
11076
- }
11077
- }
11078
- if (!cfg || typeof cfg !== "object" || Array.isArray(cfg)) return void 0;
11079
- return cfg.parameters;
11080
- }
11081
- function isRecord2(v) {
11082
- return typeof v === "object" && v !== null && !Array.isArray(v);
11083
- }
11084
- function isPrimitive(v) {
11085
- return v === null || ["string", "number", "boolean"].includes(typeof v);
11086
- }
11087
- function typeMatches(typeField, allowed) {
11088
- if (typeof typeField === "string") return allowed.has(typeField);
11089
- if (Array.isArray(typeField)) return typeField.every((t) => typeof t === "string" && allowed.has(t));
11090
- return false;
11091
- }
11092
- function validateSchema(schema, path44, errors, opts = {}) {
11093
- if (typeof schema === "boolean") return;
11094
- const depth = opts.depth ?? 0;
11095
- if (depth > MAX_SCHEMA_DEPTH) {
11096
- errors.push({
11097
- path: path44 || "<root>",
11098
- message: `schema nesting exceeds ${MAX_SCHEMA_DEPTH} levels`,
11099
- suggestion: "Flatten the schema; LLM providers reject deeply nested tool input_schemas."
11100
- });
11101
- return;
11102
- }
11103
- if (!isRecord2(schema)) {
11104
- errors.push({
11105
- path: path44,
11106
- message: `expected object, got ${schema === null ? "null" : typeof schema}`
11107
- });
11108
- return;
11109
- }
11110
- if (opts.isRoot) {
11111
- if ("type" in schema && schema.type !== "object") {
11112
- errors.push({
11113
- path: path44 ? `${path44}.type` : "type",
11114
- message: `root type must be 'object', got ${JSON.stringify(schema.type)}`,
11115
- suggestion: "Tool parameters at the root must be an object: `{ type: 'object', properties: { ... } }`."
11116
- });
11117
- }
11118
- } else if ("type" in schema && !typeMatches(schema.type, ALLOWED_TYPES)) {
11119
- errors.push({
11120
- path: `${path44}.type`,
11121
- message: `type must be one of ${[...ALLOWED_TYPES].join("/")} or an array of those, got ${JSON.stringify(schema.type)}`
11122
- });
11123
- }
11124
- if ("enum" in schema) {
11125
- const e = schema.enum;
11126
- if (typeof e === "string") {
11127
- const isPlaceholder = PLACEHOLDER_TOKENS.includes(e);
11128
- const isOutcomePlaceholder = e === "[KANBAN_OUTCOME_VALUES]";
11129
- errors.push({
11130
- path: `${path44}.enum`,
11131
- message: `enum must be a non-empty array of primitives, got string ${JSON.stringify(e)}`,
11132
- 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"]`.'
11133
- });
11134
- } else if (!Array.isArray(e)) {
11135
- errors.push({
11136
- path: `${path44}.enum`,
11137
- message: `enum must be a non-empty array of primitives, got ${typeof e}`
11138
- });
11139
- } else if (e.length === 0) {
11140
- errors.push({
11141
- path: `${path44}.enum`,
11142
- message: "enum must not be empty"
11143
- });
11144
- } else {
11145
- for (let i = 0; i < e.length; i++) {
11146
- if (!isPrimitive(e[i])) {
11147
- errors.push({
11148
- path: `${path44}.enum[${i}]`,
11149
- message: `enum entry must be a primitive (string/number/boolean/null), got ${typeof e[i]}`
11150
- });
11151
- }
11152
- }
11153
- }
11154
- }
11155
- for (const key of ["exclusiveMinimum", "exclusiveMaximum"]) {
11156
- if (key in schema && typeof schema[key] === "boolean") {
11157
- errors.push({
11158
- path: `${path44}.${key}`,
11159
- message: `${key} as boolean is draft-04 syntax; draft 2020-12 requires a numeric value`,
11160
- suggestion: `Replace with the numeric bound, e.g. \`${key}: 0\`.`
11161
- });
11162
- }
11163
- }
11164
- if ("properties" in schema) {
11165
- if (!isRecord2(schema.properties)) {
11166
- errors.push({
11167
- path: `${path44}.properties`,
11168
- message: `properties must be an object, got ${Array.isArray(schema.properties) ? "array" : typeof schema.properties}`
11169
- });
11170
- } else {
11171
- for (const [propName, propSchema] of Object.entries(schema.properties)) {
11172
- validateSchema(propSchema, `${path44}.properties.${propName}`, errors, { depth: depth + 1 });
11173
- }
11174
- }
11175
- }
11176
- if (schemaTypeIncludes(schema, "array") && "items" in schema) {
11177
- if (Array.isArray(schema.items)) {
11178
- schema.items.forEach((sub, i) => validateSchema(sub, `${path44}.items[${i}]`, errors, { depth: depth + 1 }));
11179
- } else {
11180
- validateSchema(schema.items, `${path44}.items`, errors, { depth: depth + 1 });
11181
- }
11182
- }
11183
- for (const key of SUBSCHEMA_OBJECT_KEYWORDS) {
11184
- if (key in schema && isRecord2(schema[key])) {
11185
- validateSchema(schema[key], `${path44}.${key}`, errors, { depth: depth + 1 });
11186
- }
11187
- }
11188
- for (const key of SUBSCHEMA_LIST_KEYWORDS) {
11189
- const list2 = schema[key];
11190
- if (Array.isArray(list2)) {
11191
- list2.forEach((sub, i) => validateSchema(sub, `${path44}.${key}[${i}]`, errors, { depth: depth + 1 }));
11192
- }
11193
- }
11194
- for (const key of SUBSCHEMA_MAP_KEYWORDS) {
11195
- const map = schema[key];
11196
- if (isRecord2(map)) {
11197
- for (const [name, sub] of Object.entries(map)) {
11198
- validateSchema(sub, `${path44}.${key}.${name}`, errors, { depth: depth + 1 });
11199
- }
11200
- }
11201
- }
11202
- const reportedPaths = new Set(errors.map((e) => e.path));
11203
- for (const [k, v] of Object.entries(schema)) {
11204
- if (typeof v !== "string") continue;
11205
- const fieldPath = `${path44}.${k}`;
11206
- if (reportedPaths.has(fieldPath)) continue;
11207
- for (const token of PLACEHOLDER_TOKENS) {
11208
- if (v === token) {
11209
- errors.push({
11210
- path: fieldPath,
11211
- message: `unresolved placeholder ${JSON.stringify(token)}`,
11212
- 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`."
11442
+ // 'ended' = recently-closed, served warm from the HubDO index (≤ retention
11443
+ // window). 'archived' = the full closed-conversation history from ClickHouse.
11444
+ status: external_exports.enum(["active", "agent", "team", "ended", "archived"]).optional(),
11445
+ page: external_exports.string().regex(/^\d+$/).optional(),
11446
+ page_size: external_exports.string().regex(/^\d+$/).optional()
11447
+ });
11448
+ getMessagesQuery = external_exports.object({
11449
+ hub_id: external_exports.string().uuid(),
11450
+ hub_team_user_id: external_exports.string().optional(),
11451
+ hub_user_id: external_exports.string().optional(),
11452
+ conversation_id: external_exports.string().uuid().optional(),
11453
+ message_id: external_exports.string().uuid().optional(),
11454
+ // `page` = LEGACY oldest-first offset paging (deployed page-based clients).
11455
+ // Its PRESENCE selects the legacy read path server-side; a new client omits it
11456
+ // and instead sends `page_size` + (for older pages) the keyset cursor below.
11457
+ page: external_exports.string().regex(/^\d+$/).optional(),
11458
+ page_size: external_exports.string().regex(/^\d+$/).optional(),
11459
+ // Keyset cursor for the newest-first scroll (`page` absent): return only
11460
+ // messages strictly older than (before_created_at, before_message_id) — the
11461
+ // oldest currently-loaded VISIBLE message. UTC ISO-8601 (Timestamps standard);
11462
+ // `datetime()` hardens it before the parameterized DO predicate.
11463
+ before_created_at: external_exports.string().datetime().optional(),
11464
+ before_message_id: external_exports.string().uuid().optional(),
11465
+ /**
11466
+ * When true AND the caller has support access (hub admin or hub team member),
11467
+ * internal messages (tool calls, tool results) are included in the response.
11468
+ * Silently ignored for non-support callers — it's a view preference, not an
11469
+ * authorization boundary.
11470
+ */
11471
+ include_internal: external_exports.union([external_exports.literal("true"), external_exports.literal("false"), external_exports.boolean()]).optional().transform((v) => v === true || v === "true")
11472
+ }).superRefine((q, ctx) => {
11473
+ if (q.before_created_at == null !== (q.before_message_id == null)) {
11474
+ ctx.addIssue({
11475
+ code: external_exports.ZodIssueCode.custom,
11476
+ message: "before_created_at and before_message_id must be provided together",
11477
+ path: [q.before_created_at == null ? "before_created_at" : "before_message_id"]
11213
11478
  });
11214
11479
  }
11215
- }
11216
- }
11217
- }
11218
- function schemaTypeIncludes(schema, wanted) {
11219
- const t = schema.type;
11220
- if (typeof t === "string") return t === wanted;
11221
- if (Array.isArray(t)) return t.includes(wanted);
11222
- return false;
11223
- }
11224
- function validateToolInputSchema(schema) {
11225
- const errors = [];
11226
- if (!isRecord2(schema)) {
11227
- errors.push({
11228
- path: "",
11229
- message: `expected object at root, got ${schema === null ? "null" : typeof schema}`
11230
11480
  });
11231
- return { ok: false, errors };
11232
- }
11233
- validateSchema(schema, "", errors, { isRoot: true });
11234
- return errors.length === 0 ? { ok: true } : { ok: false, errors };
11235
- }
11236
- var PLACEHOLDER_TOKENS, ALLOWED_TYPES, SUBSCHEMA_OBJECT_KEYWORDS, SUBSCHEMA_LIST_KEYWORDS, SUBSCHEMA_MAP_KEYWORDS, MAX_SCHEMA_DEPTH;
11237
- var init_chunk_WEXVYJ5H = __esm({
11238
- "../../packages/core/dist/chunk-WEXVYJ5H.js"() {
11239
- "use strict";
11240
- PLACEHOLDER_TOKENS = [
11241
- "[KANBAN_STATUS_VALUES]",
11242
- "[KANBAN_STATUS_NAMES]",
11243
- "[SCHEDULING_STATUS_NAMES]",
11244
- "[STATE_SLUG_VALUES]",
11245
- // Carried by `close_conversation` as well as `update_kanban_status`, since an
11246
- // agent close routes through the terminal transition. Omitting them here does not
11247
- // merely weaken a hint: `containsKanbanPlaceholders` is what lets HubDO's render
11248
- // chokepoint recognize a template config, and its other trigger is
11249
- // `operation === 'update_kanban_status'` — so a token missing from this list means
11250
- // `close_conversation` is never rendered and is then rejected as malformed.
11251
- "[KANBAN_OUTCOME_VALUES]",
11252
- "[KANBAN_OUTCOME_NAMES]"
11253
- ];
11254
- ALLOWED_TYPES = /* @__PURE__ */ new Set(["string", "number", "integer", "boolean", "object", "array", "null"]);
11255
- SUBSCHEMA_OBJECT_KEYWORDS = [
11256
- "additionalProperties",
11257
- "unevaluatedProperties",
11258
- "additionalItems",
11259
- "unevaluatedItems",
11260
- "contains",
11261
- "propertyNames",
11262
- "not",
11263
- "if",
11264
- "then",
11265
- "else"
11266
- ];
11267
- SUBSCHEMA_LIST_KEYWORDS = ["allOf", "anyOf", "oneOf", "prefixItems"];
11268
- SUBSCHEMA_MAP_KEYWORDS = ["$defs", "definitions", "patternProperties", "dependentSchemas"];
11269
- MAX_SCHEMA_DEPTH = 20;
11270
11481
  }
11271
11482
  });
11272
11483
 
@@ -11368,165 +11579,6 @@ var init_chunk_PCBZHIA2 = __esm({
11368
11579
  }
11369
11580
  });
11370
11581
 
11371
- // ../../packages/core/dist/chunk-BA7WE5YR.js
11372
- function utf8ByteLength(text2) {
11373
- let bytes = 0;
11374
- for (let i = 0; i < text2.length; i++) {
11375
- const code = text2.charCodeAt(i);
11376
- if (code < 128) bytes += 1;
11377
- else if (code < 2048) bytes += 2;
11378
- else if (code >= 55296 && code <= 56319 && i + 1 < text2.length) {
11379
- const next = text2.charCodeAt(i + 1);
11380
- if (next >= 56320 && next <= 57343) {
11381
- bytes += 4;
11382
- i += 1;
11383
- } else {
11384
- bytes += 3;
11385
- }
11386
- } else bytes += 3;
11387
- }
11388
- return bytes;
11389
- }
11390
- function pageHtmlIssue(html) {
11391
- if (typeof html !== "string" || !/\S/.test(html)) return "a page needs its HTML: one non-empty, self-contained file";
11392
- const bytes = utf8ByteLength(html);
11393
- if (bytes > PAGE_HTML_MAX_BYTES) {
11394
- return `a page's HTML is at most ${PAGE_HTML_MAX_BYTES / 1024} KiB; this one is ${Math.ceil(bytes / 1024)} KiB`;
11395
- }
11396
- return null;
11397
- }
11398
- 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, hubPageParam, pageRevisionSchema, PAGE_TOOL_CALL_BODY_MAX_BYTES, pageToolCallBody, PAGE_REVISION_STALE_CODE;
11399
- var init_chunk_BA7WE5YR = __esm({
11400
- "../../packages/core/dist/chunk-BA7WE5YR.js"() {
11401
- "use strict";
11402
- init_chunk_WEXVYJ5H();
11403
- init_chunk_HZ6CADSY();
11404
- init_zod();
11405
- PAGES_PER_HUB_MAX = 20;
11406
- PAGE_HTML_MAX_BYTES = 512 * 1024;
11407
- PAGE_SLUG_MAX = 64;
11408
- PAGE_SLUG_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
11409
- PAGE_TITLE_MAX = 120;
11410
- PAGE_DESCRIPTION_MAX = 500;
11411
- PAGE_ORDER_MAX = 1e3;
11412
- PAGE_TOOLS_MAX = 50;
11413
- PAGE_CONNECTION_NAME_MAX = 200;
11414
- PAGE_TOOL_NAME_MAX = 128;
11415
- PAGE_PARAMS_MAX_CHARS = 16 * 1024;
11416
- PAGE_AUDIENCES = ["team", "customers"];
11417
- PAGE_NOTIFY_LEVELS = ["none", "summary"];
11418
- pageSlugSchema = external_exports.string().min(1).max(PAGE_SLUG_MAX).regex(PAGE_SLUG_REGEX, {
11419
- message: 'a page slug is lowercase letters, digits and hyphens (e.g. "swim-results")'
11420
- });
11421
- pageToolSchema = external_exports.object({
11422
- /** The toolset connection's name, as `hub.yaml` names it. */
11423
- connection: external_exports.string().trim().min(1).max(PAGE_CONNECTION_NAME_MAX),
11424
- /** The tool's name in its connection's catalog. */
11425
- tool: external_exports.string().trim().min(1).max(PAGE_TOOL_NAME_MAX),
11426
- notify: external_exports.enum(PAGE_NOTIFY_LEVELS).default("none")
11427
- }).strict();
11428
- pageParamsSchema = external_exports.record(external_exports.unknown()).superRefine((schema, ctx) => {
11429
- if (JSON.stringify(schema).length > PAGE_PARAMS_MAX_CHARS) {
11430
- ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: `params is at most ${PAGE_PARAMS_MAX_CHARS} characters of JSON` });
11431
- return;
11432
- }
11433
- const result = validateToolInputSchema(schema);
11434
- if (!result.ok) {
11435
- for (const error of result.errors) {
11436
- ctx.addIssue({
11437
- code: external_exports.ZodIssueCode.custom,
11438
- message: `params is not a valid JSON Schema${error.path ? ` at "${error.path}"` : ""}: ${error.message}`
11439
- });
11440
- }
11441
- }
11442
- });
11443
- pageManifestObject = external_exports.object({
11444
- slug: pageSlugSchema,
11445
- title: external_exports.string().trim().min(1).max(PAGE_TITLE_MAX),
11446
- description: external_exports.string().trim().max(PAGE_DESCRIPTION_MAX).nullable().default(null),
11447
- audience: external_exports.enum(PAGE_AUDIENCES, {
11448
- errorMap: () => ({ message: 'audience must be "team" or "customers"' })
11449
- }),
11450
- /** A team page's: the hub's team users may run its write tools. A `conversation:write` grant on the hub always may. */
11451
- team_writes: external_exports.boolean().default(false),
11452
- /**
11453
- * A customer page's: its customers may run its write tools, each on their own records (opt-in). Stored
11454
- * only when stated, so a page that states none (every team page) keeps the manifest it had.
11455
- */
11456
- customer_writes: external_exports.boolean().optional(),
11457
- /** The page is offered in the conversation header to whoever may open it. Required on a customer page. */
11458
- show_in_conversation: external_exports.boolean().default(false),
11459
- /** Menu position, lowest first; pages of equal order sort by slug. */
11460
- order: external_exports.number().int().min(0).max(PAGE_ORDER_MAX).default(0),
11461
- params: pageParamsSchema.nullable().default(null),
11462
- tools: external_exports.array(pageToolSchema).max(PAGE_TOOLS_MAX).default([])
11463
- }).strict();
11464
- pageManifestSchema = pageManifestObject.superRefine((manifest, ctx) => {
11465
- if (manifest.audience === "customers") {
11466
- if (!manifest.show_in_conversation) {
11467
- ctx.addIssue({
11468
- code: external_exports.ZodIssueCode.custom,
11469
- path: ["show_in_conversation"],
11470
- message: "a customer page sets show_in_conversation: true, since the conversation header is a customer's only way in"
11471
- });
11472
- }
11473
- if (manifest.team_writes) {
11474
- 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" });
11475
- }
11476
- if (manifest.tools.some((t) => t.notify !== "none")) {
11477
- ctx.addIssue({
11478
- code: external_exports.ZodIssueCode.custom,
11479
- path: ["tools"],
11480
- message: "a customer page's tools are notify: none: the agent does not hear a customer page's calls yet"
11481
- });
11482
- }
11483
- } else if (manifest.customer_writes) {
11484
- 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" });
11485
- }
11486
- const seen = /* @__PURE__ */ new Set();
11487
- manifest.tools.forEach((t, i) => {
11488
- if (seen.has(t.tool)) {
11489
- ctx.addIssue({
11490
- code: external_exports.ZodIssueCode.custom,
11491
- path: ["tools", i, "tool"],
11492
- message: `two tools are named "${t.tool}": a page calls a tool by its name alone, so tool names are unique across the manifest`
11493
- });
11494
- }
11495
- seen.add(t.tool);
11496
- });
11497
- });
11498
- pageSummarySchema = external_exports.object({
11499
- slug: external_exports.string(),
11500
- title: external_exports.string(),
11501
- description: external_exports.string().nullable(),
11502
- audience: external_exports.string(),
11503
- team_writes: external_exports.boolean(),
11504
- /** A customer page's opt-in to writes, when its manifest states it; absent otherwise. */
11505
- customer_writes: external_exports.boolean().optional(),
11506
- show_in_conversation: external_exports.boolean(),
11507
- order: external_exports.number(),
11508
- params: external_exports.record(external_exports.unknown()).nullable(),
11509
- tools: external_exports.array(external_exports.object({ connection: external_exports.string(), tool: external_exports.string(), notify: external_exports.string() })),
11510
- revision: external_exports.string(),
11511
- /** The HTML's size in UTF-8 bytes. */
11512
- html_bytes: external_exports.number().int().nonnegative(),
11513
- created_at: external_exports.string(),
11514
- updated_at: external_exports.string()
11515
- });
11516
- hubPagesParam = external_exports.object({ hub_id: uuidSchema });
11517
- hubPageParam = external_exports.object({ hub_id: uuidSchema, slug: pageSlugSchema });
11518
- pageRevisionSchema = external_exports.string().regex(/^[0-9a-f]{64}$/, { message: "a page revision is 64 hex digits" });
11519
- PAGE_TOOL_CALL_BODY_MAX_BYTES = 1024 * 1024;
11520
- pageToolCallBody = external_exports.object({
11521
- revision: pageRevisionSchema,
11522
- tool: external_exports.string().min(1).max(PAGE_TOOL_NAME_MAX),
11523
- arguments: external_exports.record(external_exports.unknown()).default({}),
11524
- conversation_id: uuidSchema.optional()
11525
- }).strict();
11526
- PAGE_REVISION_STALE_CODE = "PAGE_REVISION_STALE";
11527
- }
11528
- });
11529
-
11530
11582
  // ../../packages/core/dist/chunk-4LXDRTO4.js
11531
11583
  var EVAL_ATTACHMENT_HASH_REGEX, CALL_OPENING_HASH_REGEX;
11532
11584
  var init_chunk_4LXDRTO4 = __esm({
@@ -12820,7 +12872,7 @@ var init_chunk_ETFW6QY3 = __esm({
12820
12872
  }
12821
12873
  });
12822
12874
 
12823
- // ../../packages/core/dist/chunk-AGHRRR4N.js
12875
+ // ../../packages/core/dist/chunk-RAAGRDCW.js
12824
12876
  function refineHubAsCodeCustomTools(config, ctx) {
12825
12877
  const agents = config.agents;
12826
12878
  if (!Array.isArray(agents)) return;
@@ -13420,12 +13472,12 @@ function skillSectionsAsResources(scope) {
13420
13472
  };
13421
13473
  }
13422
13474
  var MAX_10MB_BASE64_ENCODED_BYTES, MAX_EVAL_ATTACHMENT_ENCODED_BYTES, MAX_EVAL_ATTACHMENT_CARRIERS, MAX_EVAL_ATTACHMENT_AGGREGATE_ENCODED_BYTES, MAX_RESOURCE_ENCODED_BYTES, MAX_HUB_AS_CODE_RESOURCES, MAX_HUB_AS_CODE_RESOURCE_FILES, MAX_RESOURCE_AGGREGATE_ENCODED_BYTES, MAX_CI_CONFIG_BODY_BYTES, MAX_HUB_AS_CODE_PAGE_MANIFEST_CHARS, hubAsCodePagesSchema, MAX_CALL_OPENING_CARRIERS, MAX_CALL_OPENING_AGGREGATE_ENCODED_BYTES, hubAsCodeStateSchema, hubAsCodeResourceFileSchema, hubAsCodeResourceSchema, uuidPattern, ciUuidSchema, boundedHubAsCodeResourcesSchema, isPlainObject, MIN_SKILLS_LAYOUT_CLI, hubAsCodeConfigSchema, ciPullHubIdParam, ciBranchParam, ciPullQuery, ciHubsQuery, ciLookupQuery, ciBranchesQuery, ciSyncBody, ciPushBody, ciDiffBody, ciPublishBody, ciPublishPreviewBody, ciSyncMcpBody, ciOrgResourcesParam, orgResourcesConfigSchema, ciOrgResourcesPushBody, ciOrgResourcesDiffBody, CI_APPLY_ENTITY_KINDS, CI_APPLY_OPERATIONS, ciApplyErrorBaseSchema, ciApplyErrorSchema, ciSyncCountSchema, ciSyncChangesSchema, ciSyncWarningSchema, ciSyncResponseSchema;
13423
- var init_chunk_AGHRRR4N = __esm({
13424
- "../../packages/core/dist/chunk-AGHRRR4N.js"() {
13475
+ var init_chunk_RAAGRDCW = __esm({
13476
+ "../../packages/core/dist/chunk-RAAGRDCW.js"() {
13425
13477
  "use strict";
13426
13478
  init_chunk_PCBZHIA2();
13427
- init_chunk_IAAIVRFJ();
13428
- init_chunk_BA7WE5YR();
13479
+ init_chunk_QSKQ4RFI();
13480
+ init_chunk_MVJOHMHA();
13429
13481
  init_chunk_K5ILL3RT();
13430
13482
  init_chunk_F4M7M4E5();
13431
13483
  init_chunk_LBDH7LCG();
@@ -15413,10 +15465,10 @@ var init_chunk_WFQDSQJK = __esm({
15413
15465
  }
15414
15466
  });
15415
15467
 
15416
- // ../../packages/core/dist/chunk-2TRCUU5E.js
15417
- var APP_ERROR_BRAND, AppError, LLM_RATE_LIMIT_BRAND, LlmRateLimitError, LLM_PROVIDER_HTTP_BRAND, LlmProviderHttpError, LLM_PROVIDER_CONTENT_BRAND, LlmProviderContentError, LLM_PROVIDER_TIMEOUT_BRAND, LlmProviderTimeoutError, ExternalServiceError, CHANNEL_PROVIDER_HTTP_BRAND, ChannelProviderHttpError, MEDIA_PROVIDER_HTTP_BRAND, MediaProviderHttpError;
15418
- var init_chunk_2TRCUU5E = __esm({
15419
- "../../packages/core/dist/chunk-2TRCUU5E.js"() {
15468
+ // ../../packages/core/dist/chunk-XXZ4MOE3.js
15469
+ var APP_ERROR_BRAND, AppError, PAGE_CUSTOMER_UNAVAILABLE_CODE, LLM_RATE_LIMIT_BRAND, LlmRateLimitError, LLM_PROVIDER_HTTP_BRAND, LlmProviderHttpError, LLM_PROVIDER_CONTENT_BRAND, LlmProviderContentError, LLM_PROVIDER_TIMEOUT_BRAND, LlmProviderTimeoutError, ExternalServiceError, CHANNEL_PROVIDER_HTTP_BRAND, ChannelProviderHttpError, MEDIA_PROVIDER_HTTP_BRAND, MediaProviderHttpError;
15470
+ var init_chunk_XXZ4MOE3 = __esm({
15471
+ "../../packages/core/dist/chunk-XXZ4MOE3.js"() {
15420
15472
  "use strict";
15421
15473
  init_chunk_WFQDSQJK();
15422
15474
  APP_ERROR_BRAND = /* @__PURE__ */ Symbol.for("wayai.AppError");
@@ -15437,6 +15489,7 @@ var init_chunk_2TRCUU5E = __esm({
15437
15489
  };
15438
15490
  }
15439
15491
  };
15492
+ PAGE_CUSTOMER_UNAVAILABLE_CODE = "PAGE_CUSTOMER_UNAVAILABLE";
15440
15493
  LLM_RATE_LIMIT_BRAND = /* @__PURE__ */ Symbol.for("wayai.LlmRateLimitError");
15441
15494
  LlmRateLimitError = class extends Error {
15442
15495
  constructor(provider, retryAfterMs) {
@@ -15529,27 +15582,28 @@ var init_chunk_2TRCUU5E = __esm({
15529
15582
  var init_contracts = __esm({
15530
15583
  "../../packages/core/dist/contracts/index.js"() {
15531
15584
  "use strict";
15585
+ init_chunk_ILW3RFGU();
15532
15586
  init_chunk_YVY2TZK2();
15533
15587
  init_chunk_VXEAR36B();
15534
15588
  init_chunk_RACEDHG6();
15535
15589
  init_chunk_Q7KIQHAZ();
15536
15590
  init_chunk_HA7CRZMX();
15591
+ init_chunk_MF2VVXBR();
15537
15592
  init_chunk_IPXBFWUU();
15538
15593
  init_chunk_NKLVUTFO();
15539
- init_chunk_ILW3RFGU();
15540
- init_chunk_MF2VVXBR();
15541
15594
  init_chunk_ZC6YGHNX();
15542
15595
  init_chunk_ACKF2MVU();
15543
15596
  init_chunk_K2UY4M4E();
15544
- init_chunk_DAPIEZDP();
15545
- init_chunk_3FYOP6GU();
15597
+ init_chunk_5DGHIY7L();
15598
+ init_chunk_ZAFNUHAY();
15546
15599
  init_chunk_IPDOHAZ5();
15547
15600
  init_chunk_GPM7PE44();
15548
15601
  init_chunk_VEERWOZ6();
15549
15602
  init_chunk_FPSDNS2E();
15603
+ init_chunk_UXC3VPMK();
15604
+ init_chunk_DXLHSIKP();
15550
15605
  init_chunk_ZXK6N2HN();
15551
15606
  init_chunk_Y7CFCYX4();
15552
- init_chunk_5DGHIY7L();
15553
15607
  init_chunk_SY6PLCPK();
15554
15608
  init_chunk_YUZFHVB2();
15555
15609
  init_chunk_I3O2RACG();
@@ -15569,11 +15623,11 @@ var init_contracts = __esm({
15569
15623
  init_chunk_E4DIIOOE();
15570
15624
  init_chunk_7CYHPF35();
15571
15625
  init_chunk_BPCNB5RT();
15572
- init_chunk_AGHRRR4N();
15626
+ init_chunk_RAAGRDCW();
15573
15627
  init_chunk_PCBZHIA2();
15574
- init_chunk_IAAIVRFJ();
15575
- init_chunk_BA7WE5YR();
15576
- init_chunk_C2ID2BF7();
15628
+ init_chunk_QSKQ4RFI();
15629
+ init_chunk_MVJOHMHA();
15630
+ init_chunk_UE4KTV2N();
15577
15631
  init_chunk_K5ILL3RT();
15578
15632
  init_chunk_JDJ4EUOL();
15579
15633
  init_chunk_ZLJP22IA();
@@ -15602,7 +15656,7 @@ var init_contracts = __esm({
15602
15656
  init_chunk_AMG6HKUQ();
15603
15657
  init_chunk_5BOYRUX2();
15604
15658
  init_chunk_OMPT4ZHR();
15605
- init_chunk_3DCPJ6NB();
15659
+ init_chunk_Z2SC7EVO();
15606
15660
  init_chunk_SOJMWM63();
15607
15661
  init_chunk_WEXVYJ5H();
15608
15662
  init_chunk_UEQSHGAY();
@@ -15623,7 +15677,7 @@ var init_contracts = __esm({
15623
15677
  init_chunk_MIWZOSPI();
15624
15678
  init_chunk_PTYXZZTE();
15625
15679
  init_chunk_L5F7ZOUJ();
15626
- init_chunk_2TRCUU5E();
15680
+ init_chunk_XXZ4MOE3();
15627
15681
  init_chunk_WFQDSQJK();
15628
15682
  }
15629
15683
  });
@@ -15757,7 +15811,7 @@ var UUID_RE2, WAYAI_WORKSPACE_LAYOUT;
15757
15811
  var init_dist = __esm({
15758
15812
  "../../packages/core/dist/index.js"() {
15759
15813
  "use strict";
15760
- init_chunk_3DCPJ6NB();
15814
+ init_chunk_Z2SC7EVO();
15761
15815
  init_chunk_SOJMWM63();
15762
15816
  init_chunk_WEXVYJ5H();
15763
15817
  init_chunk_UEQSHGAY();
@@ -15783,7 +15837,7 @@ var init_dist = __esm({
15783
15837
  init_chunk_MIWZOSPI();
15784
15838
  init_chunk_PTYXZZTE();
15785
15839
  init_chunk_L5F7ZOUJ();
15786
- init_chunk_2TRCUU5E();
15840
+ init_chunk_XXZ4MOE3();
15787
15841
  init_chunk_WFQDSQJK();
15788
15842
  UUID_RE2 = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
15789
15843
  WAYAI_WORKSPACE_LAYOUT = {
@@ -20793,9 +20847,11 @@ var init_call_openings = __esm({
20793
20847
  var init_pages = __esm({
20794
20848
  "../../packages/core/dist/contracts/pages.js"() {
20795
20849
  "use strict";
20796
- init_chunk_BA7WE5YR();
20850
+ init_chunk_MVJOHMHA();
20797
20851
  init_chunk_WEXVYJ5H();
20798
20852
  init_chunk_HZ6CADSY();
20853
+ init_chunk_XXZ4MOE3();
20854
+ init_chunk_WFQDSQJK();
20799
20855
  }
20800
20856
  });
20801
20857
 
@@ -27438,14 +27494,22 @@ function escapeHtml(text2) {
27438
27494
  return text2.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;");
27439
27495
  }
27440
27496
  function scaffoldPage(input) {
27441
- const manifest = { slug: input.slug, title: input.title ?? titleOf(input.slug), audience: input.audience, tools: [] };
27497
+ const customers = input.audience === "customers";
27498
+ const manifest = {
27499
+ slug: input.slug,
27500
+ title: input.title ?? titleOf(input.slug),
27501
+ audience: input.audience,
27502
+ ...customers ? { show_in_conversation: true } : {},
27503
+ tools: []
27504
+ };
27442
27505
  const parsed = pageManifestSchema.safeParse(manifest);
27443
27506
  if (!parsed.success) {
27444
27507
  const issues = parsed.error.issues.map((i) => i.path.length > 0 ? `${i.path.join(".")}: ${i.message}` : i.message);
27445
27508
  throw expected(issues.map((issue) => `page "${input.slug}": ${issue}`).join("\n"));
27446
27509
  }
27447
27510
  const { slug: _slug, ...written } = manifest;
27448
- const manifestYaml = "# The page's manifest: pages.md in the WayAI skill has every field. Add each tool the page calls to\n# tools: - { connection: <a Base Toolset connection in hub.yaml>, tool: <its tool name>, notify: none }\n" + yaml16.dump(written, YAML_DUMP_OPTIONS);
27511
+ const header = customers ? "# The page's manifest: pages.md in the WayAI skill has every field, and its Customer Pages section\n# what a customer page may reach. The hub's end users open it from their own conversation's header.\n# Add the tool it lists to tools, from a customer-scoped Base Toolset connection, so each customer reads\n# only their own records and shared ones:\n# tools: - { connection: <a customer-scoped Base Toolset connection in hub.yaml>, tool: <its list tool>, notify: none }\n# It only reads. customer_writes: true lets each customer change their own records through its write tools.\n" : "# The page's manifest: pages.md in the WayAI skill has every field. Add each tool the page calls to\n# tools: - { connection: <a Base Toolset connection in hub.yaml>, tool: <its tool name>, notify: none }\n";
27512
+ const manifestYaml = header + yaml16.dump(written, YAML_DUMP_OPTIONS);
27449
27513
  return { manifestYaml, html: starterHtml(input.slug, parsed.data.title) };
27450
27514
  }
27451
27515
  function starterHtml(slug, title) {
@@ -27530,16 +27594,18 @@ function starterHtml(slug, title) {
27530
27594
 
27531
27595
  // Every string the viewer reads, in each language the host passes (its context's locale).
27532
27596
  const STRINGS = {
27533
- en: { refresh: 'Refresh', loading: 'Loading\u2026', empty: 'Nothing here yet.', notSetUp: 'This page does not list anything yet.', failed: 'Could not load this list.', retry: 'Try again', stale: 'This page was updated. Reload it to continue.', rateLimited: 'Too many requests. Try again in {seconds} seconds.', denied: 'This page is no longer available to you.', notFound: 'This page, or the list it shows, is not available.', offline: 'Could not reach WayAI. Check your connection and try again.', name: 'Name', updated: 'Updated' },
27534
- pt: { refresh: 'Atualizar', loading: 'Carregando\u2026', empty: 'Nada aqui ainda.', notSetUp: 'Esta p\xE1gina ainda n\xE3o lista nada.', failed: 'N\xE3o foi poss\xEDvel carregar esta lista.', retry: 'Tentar de novo', stale: 'Esta p\xE1gina foi atualizada. Recarregue-a para continuar.', rateLimited: 'Muitas solicita\xE7\xF5es. Tente de novo em {seconds} segundos.', denied: 'Esta p\xE1gina n\xE3o est\xE1 mais dispon\xEDvel para voc\xEA.', notFound: 'Esta p\xE1gina, ou a lista que ela mostra, n\xE3o est\xE1 dispon\xEDvel.', offline: 'N\xE3o foi poss\xEDvel conectar ao WayAI. Verifique sua conex\xE3o e tente de novo.', name: 'Nome', updated: 'Atualizado' },
27535
- es: { refresh: 'Actualizar', loading: 'Cargando\u2026', empty: 'Todav\xEDa no hay nada aqu\xED.', notSetUp: 'Esta p\xE1gina todav\xEDa no muestra nada.', failed: 'No se pudo cargar esta lista.', retry: 'Reintentar', stale: 'Esta p\xE1gina se actualiz\xF3. Vuelve a cargarla para continuar.', rateLimited: 'Demasiadas solicitudes. Int\xE9ntalo de nuevo en {seconds} segundos.', denied: 'Esta p\xE1gina ya no est\xE1 disponible para ti.', notFound: 'Esta p\xE1gina, o la lista que muestra, no est\xE1 disponible.', offline: 'No se pudo conectar con WayAI. Revisa tu conexi\xF3n e int\xE9ntalo de nuevo.', name: 'Nombre', updated: 'Actualizado' },
27597
+ en: { refresh: 'Refresh', loading: 'Loading\u2026', empty: 'Nothing here yet.', notSetUp: 'This page does not list anything yet.', failed: 'Could not load this list.', retry: 'Try again', stale: 'This page was updated. Reload it to continue.', rateLimited: 'Too many requests. Try again in {seconds} seconds.', denied: 'This page is no longer available to you.', unavailable: 'This page is not available to your account.', notFound: 'This page, or the list it shows, is not available.', offline: 'Could not reach WayAI. Check your connection and try again.', name: 'Name', updated: 'Updated' },
27598
+ pt: { refresh: 'Atualizar', loading: 'Carregando\u2026', empty: 'Nada aqui ainda.', notSetUp: 'Esta p\xE1gina ainda n\xE3o lista nada.', failed: 'N\xE3o foi poss\xEDvel carregar esta lista.', retry: 'Tentar de novo', stale: 'Esta p\xE1gina foi atualizada. Recarregue-a para continuar.', rateLimited: 'Muitas solicita\xE7\xF5es. Tente de novo em {seconds} segundos.', denied: 'Esta p\xE1gina n\xE3o est\xE1 mais dispon\xEDvel para voc\xEA.', unavailable: 'Esta p\xE1gina n\xE3o est\xE1 dispon\xEDvel para a sua conta.', notFound: 'Esta p\xE1gina, ou a lista que ela mostra, n\xE3o est\xE1 dispon\xEDvel.', offline: 'N\xE3o foi poss\xEDvel conectar ao WayAI. Verifique sua conex\xE3o e tente de novo.', name: 'Nome', updated: 'Atualizado' },
27599
+ es: { refresh: 'Actualizar', loading: 'Cargando\u2026', empty: 'Todav\xEDa no hay nada aqu\xED.', notSetUp: 'Esta p\xE1gina todav\xEDa no muestra nada.', failed: 'No se pudo cargar esta lista.', retry: 'Reintentar', stale: 'Esta p\xE1gina se actualiz\xF3. Vuelve a cargarla para continuar.', rateLimited: 'Demasiadas solicitudes. Int\xE9ntalo de nuevo en {seconds} segundos.', denied: 'Esta p\xE1gina ya no est\xE1 disponible para ti.', unavailable: 'Esta p\xE1gina no est\xE1 disponible para tu cuenta.', notFound: 'Esta p\xE1gina, o la lista que muestra, no est\xE1 disponible.', offline: 'No se pudo conectar con WayAI. Revisa tu conexi\xF3n e int\xE9ntalo de nuevo.', name: 'Nombre', updated: 'Actualizado' },
27536
27600
  };
27537
27601
 
27538
27602
  // What the host told the page (ui/initialize, then each host-context-changed), and what it shows.
27539
- const context = { theme: 'light', locale: 'en' };
27603
+ const context = { theme: 'light', locale: 'en', refresh: undefined };
27540
27604
  let view = { kind: 'loading' };
27541
27605
  // A rate-limit wait: no call is started until it ends (one timer per refusal, never a poll).
27542
27606
  let waiting = false;
27607
+ // wayai.refresh rose while a read was in flight: read again once it settles.
27608
+ let refreshPending = false;
27543
27609
 
27544
27610
  const $ = (id) => document.getElementById(id);
27545
27611
  const language = () => (STRINGS[context.locale] ? context.locale : 'en');
@@ -27582,6 +27648,14 @@ function starterHtml(slug, title) {
27582
27648
  document.documentElement.setAttribute('data-theme', changed.theme);
27583
27649
  }
27584
27650
  if (changed.locale) context.locale = changed.locale;
27651
+ // wayai.refresh rises when what the page shows may have changed: read again (pages.md, Live Refresh).
27652
+ // It arrives whole with any change to wayai, so only a new value reads.
27653
+ if (changed.wayai && changed.wayai.refresh !== undefined && changed.wayai.refresh !== context.refresh) {
27654
+ const known = context.refresh !== undefined;
27655
+ context.refresh = changed.wayai.refresh;
27656
+ if (known && view.kind === 'loading') refreshPending = true;
27657
+ else if (known && !waiting && !(view.kind === 'error' && view.key === 'stale')) load();
27658
+ }
27585
27659
  if (changed.safeAreaInsets) {
27586
27660
  for (const side of ['top', 'right', 'bottom', 'left']) {
27587
27661
  document.documentElement.style.setProperty('--safe-' + side, (changed.safeAreaInsets[side] || 0) + 'px');
@@ -27592,6 +27666,15 @@ function starterHtml(slug, title) {
27592
27666
 
27593
27667
  // \u2500\u2500 Loading the list \u2500\u2500
27594
27668
  async function load() {
27669
+ await read();
27670
+ // A rise while it ran is read now, unless the read left the page waiting or stale.
27671
+ if (refreshPending) {
27672
+ refreshPending = false;
27673
+ if (!waiting && !(view.kind === 'error' && view.key === 'stale')) load();
27674
+ }
27675
+ }
27676
+
27677
+ async function read() {
27595
27678
  view = { kind: 'loading' };
27596
27679
  render();
27597
27680
  if (!LIST_TOOL) {
@@ -27626,6 +27709,7 @@ function starterHtml(slug, title) {
27626
27709
  return { kind: 'error', key: 'rateLimited', values: { seconds } };
27627
27710
  }
27628
27711
  if (code === 'AUTHORIZATION_ERROR') return { kind: 'error', key: 'denied' };
27712
+ if (code === '${PAGE_CUSTOMER_UNAVAILABLE_CODE}') return { kind: 'error', key: 'unavailable' };
27629
27713
  const text = (result.content || []).find((part) => part.type === 'text');
27630
27714
  if (code === 'NOT_FOUND') return { kind: 'error', key: 'notFound', detail: text && text.text };
27631
27715
  return text && text.text ? { kind: 'error', text: text.text } : { kind: 'error', key: 'failed' };
@@ -27828,7 +27912,7 @@ var init_page = __esm({
27828
27912
  wayai page \u2014 a hub's pages
27829
27913
 
27830
27914
  Usage:
27831
- wayai page new <slug> [--audience team] [--title <title>] [--hub <uuid|folder-name>]
27915
+ wayai page new <slug> [--audience team|customers] [--title <title>] [--hub <uuid|folder-name>]
27832
27916
 
27833
27917
  new: write a starter page, pages/<slug>/page.yaml and pages/<slug>/index.html, into a hub folder.
27834
27918
  The page is styled with WayAI's tokens and base classes, follows the viewer's theme and
@@ -27836,7 +27920,8 @@ new: write a starter page, pages/<slug>/page.yaml and pages/<slug>/index.html, i
27836
27920
  then \`wayai push\`. It never overwrites a file.
27837
27921
 
27838
27922
  <slug> The page's id and folder name: lowercase letters, digits and hyphens.
27839
- --audience Who the page is for: team (the default; customer pages are not available yet).
27923
+ --audience Who the page is for: team (the default), or customers: the hub's end users, who
27924
+ open it from their own conversation's header. A customer page starts read-only.
27840
27925
  --title What menus show (default: the slug in words).
27841
27926
  --hub The hub folder: needed when the workspace has more than one,
27842
27927
  no default_hub, and you are not in one.