@wayai/cli 0.3.229 → 0.3.231

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
@@ -488,67 +488,6 @@ var init_sentry = __esm({
488
488
  }
489
489
  });
490
490
 
491
- // ../../packages/core/dist/chunk-DHPUPI4Y.js
492
- function normalizeAuthType(raw) {
493
- if (VALID_AUTH_TYPES.has(raw)) return raw;
494
- return LEGACY_AUTH_TYPE_MAP[raw] ?? raw;
495
- }
496
- 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;
497
- var init_chunk_DHPUPI4Y = __esm({
498
- "../../packages/core/dist/chunk-DHPUPI4Y.js"() {
499
- "use strict";
500
- AUTH_TYPE = {
501
- OAUTH: "oauth",
502
- API_KEY: "api_key",
503
- BASIC_AUTH: "basic_auth",
504
- BEARER: "bearer",
505
- NONE: "none"
506
- };
507
- ORG_CREDENTIAL_AUTH_TYPES = [
508
- AUTH_TYPE.API_KEY,
509
- AUTH_TYPE.BEARER,
510
- AUTH_TYPE.BASIC_AUTH
511
- ];
512
- AUTH_TYPE_DISPLAY = {
513
- [AUTH_TYPE.OAUTH]: "OAuth",
514
- [AUTH_TYPE.API_KEY]: "API Key",
515
- [AUTH_TYPE.BASIC_AUTH]: "Basic Auth",
516
- [AUTH_TYPE.BEARER]: "Bearer Token",
517
- [AUTH_TYPE.NONE]: "No Authentication"
518
- };
519
- LEGACY_AUTH_TYPE_MAP = {
520
- "OAuth": AUTH_TYPE.OAUTH,
521
- "API Key": AUTH_TYPE.API_KEY,
522
- "Basic Auth": AUTH_TYPE.BASIC_AUTH,
523
- "Bearer Token": AUTH_TYPE.BEARER,
524
- "No authentication": AUTH_TYPE.NONE,
525
- // Also handle the old DISPLAY_TO_CODE bug where 'basic' was used instead of 'basic_auth'
526
- "basic": AUTH_TYPE.BASIC_AUTH
527
- };
528
- VALID_AUTH_TYPES = new Set(Object.values(AUTH_TYPE));
529
- AGENT_ROLES = [
530
- "pilot",
531
- "copilot",
532
- "pilot_specialist",
533
- "copilot_specialist",
534
- "pilot_advisor",
535
- "copilot_advisor",
536
- "monitor",
537
- "conversation_evaluator",
538
- "message_evaluator",
539
- "summarizer",
540
- "consultant",
541
- "pilot_voice"
542
- ];
543
- PILOT_TRACK_ROLES = ["pilot", "pilot_specialist"];
544
- COPILOT_TRACK_ROLES = ["copilot", "copilot_specialist"];
545
- CUSTOMER_FACING_AGENT_ROLES = [...PILOT_TRACK_ROLES, "pilot_advisor"];
546
- SAFE_USER_ID_REGEX = /^[A-Za-z0-9_-]{1,64}$/;
547
- SUPPORTED_LOCALES = ["en", "pt", "es"];
548
- SKILL_INSTALL_COMMAND = "mkdir -p .claude && npx skills add wayai-pro/wayai-skill -y";
549
- }
550
- });
551
-
552
491
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/util.js
553
492
  var util, objectUtil, ZodParsedType, getParsedType;
554
493
  var init_util = __esm({
@@ -4665,6 +4604,99 @@ var init_zod = __esm({
4665
4604
  }
4666
4605
  });
4667
4606
 
4607
+ // ../../packages/core/dist/chunk-GK27ENTT.js
4608
+ var BASE_CREDENTIAL_MANAGED_BY, BASE_CREDENTIAL_NAME_MAX, baseCredentialNameSchema, createBaseCredentialLinkBody, baseCredentialLinkParams, baseCredentialLinkQuery;
4609
+ var init_chunk_GK27ENTT = __esm({
4610
+ "../../packages/core/dist/chunk-GK27ENTT.js"() {
4611
+ "use strict";
4612
+ init_zod();
4613
+ BASE_CREDENTIAL_MANAGED_BY = {
4614
+ DIRECT: "direct",
4615
+ ORG_LINK: "org-link"
4616
+ };
4617
+ BASE_CREDENTIAL_NAME_MAX = 100;
4618
+ baseCredentialNameSchema = external_exports.string().min(1).max(BASE_CREDENTIAL_NAME_MAX).regex(
4619
+ /^[A-Za-z0-9][A-Za-z0-9._:@+~=-]*$/,
4620
+ "name must use letters, digits and '. _ : @ + ~ = -', starting with a letter or digit"
4621
+ );
4622
+ createBaseCredentialLinkBody = external_exports.object({
4623
+ organization_id: external_exports.string().uuid(),
4624
+ base_id: external_exports.string().min(1),
4625
+ /** Defaults to a slug derived from the credential's display name. */
4626
+ name: baseCredentialNameSchema.optional()
4627
+ });
4628
+ baseCredentialLinkParams = external_exports.object({
4629
+ id: external_exports.string().uuid(),
4630
+ base_credential_id: external_exports.string().min(1)
4631
+ });
4632
+ baseCredentialLinkQuery = external_exports.object({
4633
+ organization_id: external_exports.string().uuid(),
4634
+ base_id: external_exports.string().min(1)
4635
+ });
4636
+ }
4637
+ });
4638
+
4639
+ // ../../packages/core/dist/chunk-DHPUPI4Y.js
4640
+ function normalizeAuthType(raw) {
4641
+ if (VALID_AUTH_TYPES.has(raw)) return raw;
4642
+ return LEGACY_AUTH_TYPE_MAP[raw] ?? raw;
4643
+ }
4644
+ 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;
4645
+ var init_chunk_DHPUPI4Y = __esm({
4646
+ "../../packages/core/dist/chunk-DHPUPI4Y.js"() {
4647
+ "use strict";
4648
+ AUTH_TYPE = {
4649
+ OAUTH: "oauth",
4650
+ API_KEY: "api_key",
4651
+ BASIC_AUTH: "basic_auth",
4652
+ BEARER: "bearer",
4653
+ NONE: "none"
4654
+ };
4655
+ ORG_CREDENTIAL_AUTH_TYPES = [
4656
+ AUTH_TYPE.API_KEY,
4657
+ AUTH_TYPE.BEARER,
4658
+ AUTH_TYPE.BASIC_AUTH
4659
+ ];
4660
+ AUTH_TYPE_DISPLAY = {
4661
+ [AUTH_TYPE.OAUTH]: "OAuth",
4662
+ [AUTH_TYPE.API_KEY]: "API Key",
4663
+ [AUTH_TYPE.BASIC_AUTH]: "Basic Auth",
4664
+ [AUTH_TYPE.BEARER]: "Bearer Token",
4665
+ [AUTH_TYPE.NONE]: "No Authentication"
4666
+ };
4667
+ LEGACY_AUTH_TYPE_MAP = {
4668
+ "OAuth": AUTH_TYPE.OAUTH,
4669
+ "API Key": AUTH_TYPE.API_KEY,
4670
+ "Basic Auth": AUTH_TYPE.BASIC_AUTH,
4671
+ "Bearer Token": AUTH_TYPE.BEARER,
4672
+ "No authentication": AUTH_TYPE.NONE,
4673
+ // Also handle the old DISPLAY_TO_CODE bug where 'basic' was used instead of 'basic_auth'
4674
+ "basic": AUTH_TYPE.BASIC_AUTH
4675
+ };
4676
+ VALID_AUTH_TYPES = new Set(Object.values(AUTH_TYPE));
4677
+ AGENT_ROLES = [
4678
+ "pilot",
4679
+ "copilot",
4680
+ "pilot_specialist",
4681
+ "copilot_specialist",
4682
+ "pilot_advisor",
4683
+ "copilot_advisor",
4684
+ "monitor",
4685
+ "conversation_evaluator",
4686
+ "message_evaluator",
4687
+ "summarizer",
4688
+ "consultant",
4689
+ "pilot_voice"
4690
+ ];
4691
+ PILOT_TRACK_ROLES = ["pilot", "pilot_specialist"];
4692
+ COPILOT_TRACK_ROLES = ["copilot", "copilot_specialist"];
4693
+ CUSTOMER_FACING_AGENT_ROLES = [...PILOT_TRACK_ROLES, "pilot_advisor"];
4694
+ SAFE_USER_ID_REGEX = /^[A-Za-z0-9_-]{1,64}$/;
4695
+ SUPPORTED_LOCALES = ["en", "pt", "es"];
4696
+ SKILL_INSTALL_COMMAND = "mkdir -p .claude && npx skills add wayai-pro/wayai-skill -y";
4697
+ }
4698
+ });
4699
+
4668
4700
  // ../../packages/core/dist/chunk-SXDX4GHS.js
4669
4701
  var orgCredentialIdParam, listOrgCredentialsQuery, createOrgCredentialBody, updateOrgCredentialBody;
4670
4702
  var init_chunk_SXDX4GHS = __esm({
@@ -5257,181 +5289,6 @@ var init_chunk_IPXBFWUU = __esm({
5257
5289
  }
5258
5290
  });
5259
5291
 
5260
- // ../../packages/core/dist/chunk-GK27ENTT.js
5261
- var BASE_CREDENTIAL_MANAGED_BY, BASE_CREDENTIAL_NAME_MAX, baseCredentialNameSchema, createBaseCredentialLinkBody, baseCredentialLinkParams, baseCredentialLinkQuery;
5262
- var init_chunk_GK27ENTT = __esm({
5263
- "../../packages/core/dist/chunk-GK27ENTT.js"() {
5264
- "use strict";
5265
- init_zod();
5266
- BASE_CREDENTIAL_MANAGED_BY = {
5267
- DIRECT: "direct",
5268
- ORG_LINK: "org-link"
5269
- };
5270
- BASE_CREDENTIAL_NAME_MAX = 100;
5271
- baseCredentialNameSchema = external_exports.string().min(1).max(BASE_CREDENTIAL_NAME_MAX).regex(
5272
- /^[A-Za-z0-9][A-Za-z0-9._:@+~=-]*$/,
5273
- "name must use letters, digits and '. _ : @ + ~ = -', starting with a letter or digit"
5274
- );
5275
- createBaseCredentialLinkBody = external_exports.object({
5276
- organization_id: external_exports.string().uuid(),
5277
- base_id: external_exports.string().min(1),
5278
- /** Defaults to a slug derived from the credential's display name. */
5279
- name: baseCredentialNameSchema.optional()
5280
- });
5281
- baseCredentialLinkParams = external_exports.object({
5282
- id: external_exports.string().uuid(),
5283
- base_credential_id: external_exports.string().min(1)
5284
- });
5285
- baseCredentialLinkQuery = external_exports.object({
5286
- organization_id: external_exports.string().uuid(),
5287
- base_id: external_exports.string().min(1)
5288
- });
5289
- }
5290
- });
5291
-
5292
- // ../../packages/core/dist/chunk-IPDOHAZ5.js
5293
- 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;
5294
- var init_chunk_IPDOHAZ5 = __esm({
5295
- "../../packages/core/dist/chunk-IPDOHAZ5.js"() {
5296
- "use strict";
5297
- init_chunk_HZ6CADSY();
5298
- init_zod();
5299
- reportSourceSchema = external_exports.enum(["sentry", "cli", "review", "security_audit"]);
5300
- intakeReportSourceSchema = external_exports.enum(["cli", "review", "security_audit"]);
5301
- reportClassificationSchema = external_exports.enum(["bug", "flaky_test", "security", "enhancement"]);
5302
- reportStatusSchema = external_exports.enum([
5303
- "pending",
5304
- "grouped",
5305
- "escalated",
5306
- "shipped",
5307
- "contested",
5308
- "addressed",
5309
- "dismissed"
5310
- ]);
5311
- reportLocaleSchema = external_exports.enum(["en", "pt", "es"]);
5312
- reportMessageAuthorRoleSchema = external_exports.enum(["reporter", "triage", "fixer", "system"]);
5313
- reportMessageSchema = external_exports.object({
5314
- message_id: external_exports.string(),
5315
- author_role: reportMessageAuthorRoleSchema,
5316
- /** The status transition this note accompanied (e.g. 'shipped'); null for a free/system note. */
5317
- transition: external_exports.string().nullable(),
5318
- body: external_exports.string(),
5319
- created_at: timestampSchema,
5320
- /**
5321
- * Visibility: `false` = reporter-facing (the default for every narrative entry); `true` =
5322
- * triage-internal (e.g. a `hold` rationale) — surfaced to platform admins only and NEVER
5323
- * returned on the reporter read path. The reporter's `GET /api/reports/:id` filters these out.
5324
- */
5325
- internal: external_exports.boolean()
5326
- });
5327
- sentryRefStatusSchema = external_exports.enum(["valid", "not_found", "mismatch", "unverified"]);
5328
- createReportBody = external_exports.object({
5329
- title: external_exports.string().min(5).max(256),
5330
- description: external_exports.string().min(10).max(5e3),
5331
- steps_to_reproduce: external_exports.string().max(3e3).optional(),
5332
- error_message: external_exports.string().max(2e3).optional(),
5333
- // Taxonomy (server defaults: source=cli, classification=bug when absent).
5334
- source: intakeReportSourceSchema.optional(),
5335
- classification: reportClassificationSchema.optional(),
5336
- // Stable dedup key (e.g. "<file>::<test>" for flaky, "<file>:<line>" for
5337
- // security). When present, the fingerprint uses it instead of the body hash.
5338
- dedup_key: external_exports.string().min(1).max(256).optional(),
5339
- // Context fields (auto-captured by the CLI)
5340
- organization_id: external_exports.string().optional(),
5341
- hub_id: external_exports.string().uuid().optional(),
5342
- hub_name: external_exports.string().max(256).optional(),
5343
- conversation_id: external_exports.string().uuid().optional(),
5344
- agent_id: external_exports.string().uuid().optional(),
5345
- agent_name: external_exports.string().max(256).optional(),
5346
- client_version: external_exports.string().max(64).optional(),
5347
- additional_context: external_exports.string().max(2e3).optional()
5348
- });
5349
- editReportBody = external_exports.object({
5350
- title: external_exports.string().min(5).max(256).optional(),
5351
- description: external_exports.string().min(10).max(5e3).optional(),
5352
- steps_to_reproduce: external_exports.string().max(3e3).optional(),
5353
- error_message: external_exports.string().max(2e3).optional(),
5354
- additional_context: external_exports.string().max(2e3).optional()
5355
- }).strict().refine((b) => Object.keys(b).length > 0, {
5356
- message: "at least one field must be provided"
5357
- });
5358
- reporterReportSummarySchema = external_exports.object({
5359
- report_id: external_exports.string(),
5360
- title: external_exports.string(),
5361
- description: external_exports.string(),
5362
- classification: reportClassificationSchema,
5363
- status: reportStatusSchema,
5364
- created_at: timestampSchema,
5365
- triaged_at: timestampSchema.nullable(),
5366
- resolved_at: timestampSchema.nullable(),
5367
- /** How many times the reporter has contested (gates the hard cap). */
5368
- contest_count: external_exports.number(),
5369
- /** True once triage issued a non-contestable (final) dismissal. */
5370
- dismissal_final: external_exports.boolean()
5371
- });
5372
- reporterListResponseSchema = external_exports.object({
5373
- data: external_exports.array(reporterReportSummarySchema)
5374
- });
5375
- getReportResponseSchema = external_exports.object({
5376
- report: reporterReportSummarySchema,
5377
- messages: external_exports.array(reportMessageSchema)
5378
- });
5379
- reporterTransitionResponseSchema = external_exports.object({
5380
- report: reporterReportSummarySchema
5381
- });
5382
- contestReportBody = external_exports.object({
5383
- reason: external_exports.string().min(1).max(5e3)
5384
- });
5385
- reporterListQuery = external_exports.object({
5386
- status: reportStatusSchema.optional()
5387
- });
5388
- listReportsQuery = external_exports.object({
5389
- status: reportStatusSchema.optional(),
5390
- source: reportSourceSchema.optional(),
5391
- limit: external_exports.coerce.number().int().min(1).max(200).optional(),
5392
- offset: external_exports.coerce.number().int().min(0).optional(),
5393
- /** ISO 8601 lower bound on created_at. */
5394
- since: external_exports.string().datetime().optional(),
5395
- /**
5396
- * ISO 8601 lower bound on resolution time — "what did we resolve recently", which `since`
5397
- * (a created_at filter) cannot answer for a long-lived report resolved yesterday. Implies
5398
- * a terminal status (`addressed`/`dismissed`) and orders on that same axis.
5399
- */
5400
- resolved_since: external_exports.string().datetime().optional()
5401
- });
5402
- GITHUB_ISSUE_URL_REGEX = /^https:\/\/github\.com\/[^/]+\/[^/]+\/issues\/\d+(?:[/?#]|$)/;
5403
- githubIssueUrlSchema = external_exports.string().url().refine((u) => GITHUB_ISSUE_URL_REGEX.test(u), {
5404
- message: "must be an https://github.com/<owner>/<repo>/issues/<number> URL"
5405
- });
5406
- transitionReportBody = external_exports.discriminatedUnion("target", [
5407
- external_exports.object({
5408
- target: external_exports.literal("escalated"),
5409
- gh_issue_url: githubIssueUrlSchema,
5410
- ai_verdict: external_exports.string().max(2e3).optional()
5411
- }),
5412
- external_exports.object({
5413
- target: external_exports.literal("shipped"),
5414
- note: external_exports.string().min(1).max(2e3).optional()
5415
- }),
5416
- external_exports.object({
5417
- target: external_exports.literal("addressed")
5418
- }),
5419
- external_exports.object({
5420
- target: external_exports.literal("dismissed"),
5421
- dismissal_reason: external_exports.string().min(1).max(5e3),
5422
- ai_verdict: external_exports.string().max(2e3).optional(),
5423
- final: external_exports.boolean().optional()
5424
- })
5425
- ]);
5426
- groupReportsBody = external_exports.object({
5427
- member_ids: external_exports.array(external_exports.string().uuid()).min(1).max(100)
5428
- });
5429
- holdReportBody = external_exports.object({
5430
- reason: external_exports.string().min(1).max(5e3)
5431
- });
5432
- }
5433
- });
5434
-
5435
5292
  // ../../packages/core/dist/chunk-GPM7PE44.js
5436
5293
  var bootstrapQuery;
5437
5294
  var init_chunk_GPM7PE44 = __esm({
@@ -6374,15 +6231,18 @@ var init_chunk_BEOHBREG = __esm({
6374
6231
  }
6375
6232
  });
6376
6233
 
6377
- // ../../packages/core/dist/chunk-4MRBBR5L.js
6234
+ // ../../packages/core/dist/chunk-OWAAYKPB.js
6235
+ function declaresReview(schema) {
6236
+ return typeof schema === "object" && schema !== null && schema[REVIEW_DECLARATION_KEY] !== void 0;
6237
+ }
6378
6238
  function toolsetFileToolName(entry, op) {
6379
6239
  const names = entry.names;
6380
6240
  const stated = names?.[op];
6381
6241
  return stated !== void 0 && stated !== null ? String(stated) : `${op}_${entry.name ?? entry.file_type}`;
6382
6242
  }
6383
- var TOOLSET_SLUG_SETTING, TOOLSET_SLUG_PATTERN, REKOR_STRUCTURAL_ID_PATTERN, baseEnvironmentSchema, TOOLSET_FILE_OPERATIONS, toolsetFileToolSchema, toolsetSurfaceSchema, toolsetConnectionBindingSchema, rekorToolsetToolsSchema, rekorBoundAttestation, rekorResolvedToolsetSchema, resolvedFileToolSchema, rekorToolsetFileSchema, rekorToolsetFileListSchema, rekorToolsetFileGetSchema, rekorToolsetFilePutSchema, TOOLSET_CUSTOMER_FACING_REFUSAL_MARK, TOOLSET_CUSTOMER_FACING_REFUSAL;
6384
- var init_chunk_4MRBBR5L = __esm({
6385
- "../../packages/core/dist/chunk-4MRBBR5L.js"() {
6243
+ var TOOLSET_SLUG_SETTING, TOOLSET_SLUG_PATTERN, REKOR_STRUCTURAL_ID_PATTERN, baseEnvironmentSchema, TOOLSET_FILE_OPERATIONS, toolsetFileToolSchema, toolsetSurfaceSchema, toolsetConnectionBindingSchema, rekorToolsetToolsSchema, rekorBoundAttestation, rekorResolvedToolsetSchema, REVIEW_DECLARATION_KEY, resolvedRecordTypeSchema, reviewWritersSchema, sharedScopeSchema, resolvedFileToolSchema, rekorToolsetFileSchema, rekorToolsetFileListSchema, rekorToolsetFileGetSchema, rekorToolsetFilePutSchema, TOOLSET_CUSTOMER_FACING_REFUSAL_MARK, TOOLSET_CUSTOMER_FACING_REFUSAL;
6244
+ var init_chunk_OWAAYKPB = __esm({
6245
+ "../../packages/core/dist/chunk-OWAAYKPB.js"() {
6386
6246
  "use strict";
6387
6247
  init_chunk_BEOHBREG();
6388
6248
  init_chunk_DHPUPI4Y();
@@ -6430,6 +6290,22 @@ var init_chunk_4MRBBR5L = __esm({
6430
6290
  * sync or token save records it.
6431
6291
  */
6432
6292
  file_writes: external_exports.boolean().optional(),
6293
+ /**
6294
+ * A record type the toolset's actions or composite steps reach (the resolve's `record_types`) names it
6295
+ * among its writers (`x-review.writers`, #5083 RK4): the toolset writes the type's drafts and reads its
6296
+ * every record, drafts included. Or such a type's declaration this side cannot read, or a resolve
6297
+ * reaching records that carries no record types. A type only its relationship tools reach is not
6298
+ * judged: the resolve does not carry that type's declaration. Absent
6299
+ * on a surface recorded before it was, which the customer-facing rule reads as writing, for a toolset
6300
+ * reaching records, until the connection's next tool sync or token save records it.
6301
+ */
6302
+ review_writes: external_exports.boolean().optional(),
6303
+ /**
6304
+ * Every record type the toolset reaches, at least one, is reviewed (`x-review`), holds no customer data
6305
+ * (`shared`), and does not name it among its writers: each call reads only that type's approved
6306
+ * records (#5083 decision 182, Q9). Absent on a surface recorded before it was, which reads as false.
6307
+ */
6308
+ approved_reads_only: external_exports.boolean().optional(),
6433
6309
  /**
6434
6310
  * The toolset's file tools. Absent when it has none, and on a surface recorded before they were.
6435
6311
  * A list this side cannot read is dropped rather than failing the binding, which every call and
@@ -6512,9 +6388,23 @@ var init_chunk_4MRBBR5L = __esm({
6512
6388
  batch: external_exports.object({ enabled: external_exports.boolean().optional() }).passthrough().nullable().optional(),
6513
6389
  sql_query: external_exports.boolean().optional(),
6514
6390
  /** The toolset serves one customer per call (#5083 RK2). Absent reads as not scoped. */
6515
- customer_scope: external_exports.boolean().optional()
6391
+ customer_scope: external_exports.boolean().optional(),
6392
+ /**
6393
+ * Each record type the toolset's actions and composite steps reach, by id, as the data product
6394
+ * stores it (`json_schema` included). A reviewed type's `x-review` names its writers (#5083 RK4).
6395
+ */
6396
+ record_types: external_exports.record(external_exports.unknown()).optional(),
6397
+ /**
6398
+ * What each record type the toolset can reach is to a customer scope (`{ role }`, or null), by id:
6399
+ * those `record_types` holds, and those only its relationship tools and steps reach (#5083 RK2).
6400
+ */
6401
+ record_type_scopes: external_exports.record(external_exports.unknown()).optional()
6516
6402
  }).passthrough()
6517
6403
  });
6404
+ REVIEW_DECLARATION_KEY = "x-review";
6405
+ resolvedRecordTypeSchema = external_exports.object({ json_schema: external_exports.record(external_exports.unknown()) });
6406
+ reviewWritersSchema = external_exports.object({ writers: external_exports.array(external_exports.string()).optional() });
6407
+ sharedScopeSchema = external_exports.object({ role: external_exports.literal("shared") });
6518
6408
  resolvedFileToolSchema = external_exports.object({
6519
6409
  file_type: external_exports.string().min(1),
6520
6410
  path_prefix: external_exports.string().nullish(),
@@ -6537,61 +6427,149 @@ var init_chunk_4MRBBR5L = __esm({
6537
6427
  });
6538
6428
  rekorToolsetFilePutSchema = external_exports.object({ data: rekorToolsetFileSchema });
6539
6429
  TOOLSET_CUSTOMER_FACING_REFUSAL_MARK = "A customer-facing agent (a pilot, pilot specialist or pilot advisor) can use a toolset only when it exposes files alone: no record, composite or relationship tools, and neither sql_query nor batch";
6540
- TOOLSET_CUSTOMER_FACING_REFUSAL = `${TOOLSET_CUSTOMER_FACING_REFUSAL_MARK}, nor a file put or delete \u2014 unless the toolset is customer-scoped, which admits its record, composite and relationship tools, since each of their calls reaches only the conversation's customer and shared records`;
6430
+ TOOLSET_CUSTOMER_FACING_REFUSAL = `${TOOLSET_CUSTOMER_FACING_REFUSAL_MARK}, nor a file put or delete, nor a write of a reviewed record type \u2014 unless the toolset is customer-scoped, which admits its record, composite and relationship tools, since each of their calls reaches only the conversation's customer and shared records, or they only read approved records of reviewed shared record types`;
6541
6431
  }
6542
6432
  });
6543
6433
 
6544
- // ../../packages/core/dist/chunk-SY6PLCPK.js
6545
- var jsonSchemaSchema, hubUserIdentity, stateValueEntry, getHubUserContextResponse, updateHubUserBody, updateHubUserResponse, unlockHubUserNameResponse, stateResetParams, stateResetResponse;
6546
- var init_chunk_SY6PLCPK = __esm({
6547
- "../../packages/core/dist/chunk-SY6PLCPK.js"() {
6434
+ // ../../packages/core/dist/chunk-IPDOHAZ5.js
6435
+ 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;
6436
+ var init_chunk_IPDOHAZ5 = __esm({
6437
+ "../../packages/core/dist/chunk-IPDOHAZ5.js"() {
6548
6438
  "use strict";
6549
- init_chunk_6TSQ5HXC();
6439
+ init_chunk_HZ6CADSY();
6550
6440
  init_zod();
6551
- jsonSchemaSchema = external_exports.record(external_exports.unknown());
6552
- hubUserIdentity = external_exports.object({
6553
- user_id: external_exports.string().nullable(),
6554
- user_name: external_exports.string().nullable(),
6555
- user_email: external_exports.string().nullable(),
6556
- user_name_locked: external_exports.boolean(),
6557
- created_at: external_exports.string(),
6558
- updated_at: external_exports.string().nullable(),
6559
- hub_user_id: external_exports.string().optional(),
6560
- enabled: external_exports.boolean().optional(),
6561
- hub_team_id: external_exports.string().nullable().optional(),
6562
- source: external_exports.enum(["grant", "auto"]).optional()
6441
+ reportSourceSchema = external_exports.enum(["sentry", "cli", "review", "security_audit"]);
6442
+ intakeReportSourceSchema = external_exports.enum(["cli", "review", "security_audit"]);
6443
+ reportClassificationSchema = external_exports.enum(["bug", "flaky_test", "security", "enhancement"]);
6444
+ reportStatusSchema = external_exports.enum([
6445
+ "pending",
6446
+ "grouped",
6447
+ "escalated",
6448
+ "shipped",
6449
+ "contested",
6450
+ "addressed",
6451
+ "dismissed"
6452
+ ]);
6453
+ reportLocaleSchema = external_exports.enum(["en", "pt", "es"]);
6454
+ reportMessageAuthorRoleSchema = external_exports.enum(["reporter", "triage", "fixer", "system"]);
6455
+ reportMessageSchema = external_exports.object({
6456
+ message_id: external_exports.string(),
6457
+ author_role: reportMessageAuthorRoleSchema,
6458
+ /** The status transition this note accompanied (e.g. 'shipped'); null for a free/system note. */
6459
+ transition: external_exports.string().nullable(),
6460
+ body: external_exports.string(),
6461
+ created_at: timestampSchema,
6462
+ /**
6463
+ * Visibility: `false` = reporter-facing (the default for every narrative entry); `true` =
6464
+ * triage-internal (e.g. a `hold` rationale) — surfaced to platform admins only and NEVER
6465
+ * returned on the reporter read path. The reporter's `GET /api/reports/:id` filters these out.
6466
+ */
6467
+ internal: external_exports.boolean()
6563
6468
  });
6564
- stateValueEntry = external_exports.object({
6565
- state_slug: external_exports.string(),
6566
- state_name: external_exports.string(),
6567
- state_description: external_exports.string().nullable().optional(),
6568
- scope: external_exports.enum(["user", "conversation"]),
6569
- json_schema: jsonSchemaSchema,
6570
- initial_value: external_exports.unknown(),
6571
- value: external_exports.unknown(),
6572
- is_reserved: external_exports.boolean()
6469
+ sentryRefStatusSchema = external_exports.enum(["valid", "not_found", "mismatch", "unverified"]);
6470
+ createReportBody = external_exports.object({
6471
+ title: external_exports.string().min(5).max(256),
6472
+ description: external_exports.string().min(10).max(5e3),
6473
+ steps_to_reproduce: external_exports.string().max(3e3).optional(),
6474
+ error_message: external_exports.string().max(2e3).optional(),
6475
+ // Taxonomy (server defaults: source=cli, classification=bug when absent).
6476
+ source: intakeReportSourceSchema.optional(),
6477
+ classification: reportClassificationSchema.optional(),
6478
+ // Stable dedup key (e.g. "<file>::<test>" for flaky, "<file>:<line>" for
6479
+ // security). When present, the fingerprint uses it instead of the body hash.
6480
+ dedup_key: external_exports.string().min(1).max(256).optional(),
6481
+ // Context fields (auto-captured by the CLI)
6482
+ organization_id: external_exports.string().optional(),
6483
+ hub_id: external_exports.string().uuid().optional(),
6484
+ hub_name: external_exports.string().max(256).optional(),
6485
+ conversation_id: external_exports.string().uuid().optional(),
6486
+ agent_id: external_exports.string().uuid().optional(),
6487
+ agent_name: external_exports.string().max(256).optional(),
6488
+ client_version: external_exports.string().max(64).optional(),
6489
+ additional_context: external_exports.string().max(2e3).optional()
6573
6490
  });
6574
- getHubUserContextResponse = external_exports.object({
6575
- user: hubUserIdentity,
6576
- user_states: external_exports.array(stateValueEntry),
6577
- conversation_states: external_exports.array(stateValueEntry)
6491
+ editReportBody = external_exports.object({
6492
+ title: external_exports.string().min(5).max(256).optional(),
6493
+ description: external_exports.string().min(10).max(5e3).optional(),
6494
+ steps_to_reproduce: external_exports.string().max(3e3).optional(),
6495
+ error_message: external_exports.string().max(2e3).optional(),
6496
+ additional_context: external_exports.string().max(2e3).optional()
6497
+ }).strict().refine((b) => Object.keys(b).length > 0, {
6498
+ message: "at least one field must be provided"
6578
6499
  });
6579
- updateHubUserBody = external_exports.object({
6580
- // Non-empty, non-null. `.nullable()` here would bypass `.min(1)` and let an
6581
- // admin arm the lock on a null name — see hub-do.ts updateHubUser null-guard.
6582
- user_name: external_exports.string().min(1).max(120)
6500
+ reporterReportSummarySchema = external_exports.object({
6501
+ report_id: external_exports.string(),
6502
+ title: external_exports.string(),
6503
+ description: external_exports.string(),
6504
+ classification: reportClassificationSchema,
6505
+ status: reportStatusSchema,
6506
+ created_at: timestampSchema,
6507
+ triaged_at: timestampSchema.nullable(),
6508
+ resolved_at: timestampSchema.nullable(),
6509
+ /** How many times the reporter has contested (gates the hard cap). */
6510
+ contest_count: external_exports.number(),
6511
+ /** True once triage issued a non-contestable (final) dismissal. */
6512
+ dismissal_final: external_exports.boolean()
6583
6513
  });
6584
- updateHubUserResponse = external_exports.object({
6585
- user: hubUserIdentity
6514
+ reporterListResponseSchema = external_exports.object({
6515
+ data: external_exports.array(reporterReportSummarySchema)
6586
6516
  });
6587
- unlockHubUserNameResponse = external_exports.object({
6588
- user: hubUserIdentity
6517
+ getReportResponseSchema = external_exports.object({
6518
+ report: reporterReportSummarySchema,
6519
+ messages: external_exports.array(reportMessageSchema)
6589
6520
  });
6590
- stateResetParams = external_exports.object({
6591
- stateSlug: slugSchema
6521
+ reporterTransitionResponseSchema = external_exports.object({
6522
+ report: reporterReportSummarySchema
6592
6523
  });
6593
- stateResetResponse = external_exports.object({
6594
- ok: external_exports.literal(true)
6524
+ contestReportBody = external_exports.object({
6525
+ reason: external_exports.string().min(1).max(5e3)
6526
+ });
6527
+ reporterListQuery = external_exports.object({
6528
+ status: reportStatusSchema.optional()
6529
+ });
6530
+ listReportsQuery = external_exports.object({
6531
+ status: reportStatusSchema.optional(),
6532
+ source: reportSourceSchema.optional(),
6533
+ limit: external_exports.coerce.number().int().min(1).max(200).optional(),
6534
+ offset: external_exports.coerce.number().int().min(0).optional(),
6535
+ /** ISO 8601 lower bound on created_at. */
6536
+ since: external_exports.string().datetime().optional(),
6537
+ /**
6538
+ * ISO 8601 lower bound on resolution time — "what did we resolve recently", which `since`
6539
+ * (a created_at filter) cannot answer for a long-lived report resolved yesterday. Implies
6540
+ * a terminal status (`addressed`/`dismissed`) and orders on that same axis.
6541
+ */
6542
+ resolved_since: external_exports.string().datetime().optional()
6543
+ });
6544
+ GITHUB_ISSUE_URL_REGEX = /^https:\/\/github\.com\/[^/]+\/[^/]+\/issues\/\d+(?:[/?#]|$)/;
6545
+ githubIssueUrlSchema = external_exports.string().url().refine((u) => GITHUB_ISSUE_URL_REGEX.test(u), {
6546
+ message: "must be an https://github.com/<owner>/<repo>/issues/<number> URL"
6547
+ });
6548
+ transitionReportBody = external_exports.discriminatedUnion("target", [
6549
+ external_exports.object({
6550
+ target: external_exports.literal("escalated"),
6551
+ gh_issue_url: githubIssueUrlSchema,
6552
+ ai_verdict: external_exports.string().max(2e3).optional()
6553
+ }),
6554
+ external_exports.object({
6555
+ target: external_exports.literal("shipped"),
6556
+ note: external_exports.string().min(1).max(2e3).optional()
6557
+ }),
6558
+ external_exports.object({
6559
+ target: external_exports.literal("addressed")
6560
+ }),
6561
+ external_exports.object({
6562
+ target: external_exports.literal("dismissed"),
6563
+ dismissal_reason: external_exports.string().min(1).max(5e3),
6564
+ ai_verdict: external_exports.string().max(2e3).optional(),
6565
+ final: external_exports.boolean().optional()
6566
+ })
6567
+ ]);
6568
+ groupReportsBody = external_exports.object({
6569
+ member_ids: external_exports.array(external_exports.string().uuid()).min(1).max(100)
6570
+ });
6571
+ holdReportBody = external_exports.object({
6572
+ reason: external_exports.string().min(1).max(5e3)
6595
6573
  });
6596
6574
  }
6597
6575
  });
@@ -6714,101 +6692,6 @@ var init_chunk_FPSDNS2E = __esm({
6714
6692
  }
6715
6693
  });
6716
6694
 
6717
- // ../../packages/core/dist/chunk-LKBSHANA.js
6718
- var DESKTOP_SHELL_VERSION_RE, DESKTOP_PLATFORMS, DESKTOP_FLAVORS, desktopShellInfoSchema, DESKTOP_PRESENCE_STATES, desktopPresenceSchema, desktopUpdateSchema, DESKTOP_SIGN_IN_URL_MAX_LENGTH, DESKTOP_APP_PATH_MAX_LENGTH, desktopAppPathSchema, DESKTOP_NOTIFICATION_KINDS, DESKTOP_NOTIFICATION_TITLE_MAX_LENGTH, DESKTOP_NOTIFICATION_BODY_MAX_LENGTH, notificationTitleSchema, notificationBodySchema, desktopNotificationSchema, DESKTOP_BADGE_MAX_COUNT, DESKTOP_BADGE_LABEL_MAX_LENGTH, desktopBadgeSchema, desktopNavigateSchema, desktopSettingsSchema, desktopSettingsChangeSchema, desktopBridgeArgsSchemas;
6719
- var init_chunk_LKBSHANA = __esm({
6720
- "../../packages/core/dist/chunk-LKBSHANA.js"() {
6721
- "use strict";
6722
- init_zod();
6723
- DESKTOP_SHELL_VERSION_RE = /^(0|[1-9]\d{0,5})\.(0|[1-9]\d{0,5})\.(0|[1-9]\d{0,5})(-[0-9A-Za-z.-]{1,32})?$/;
6724
- DESKTOP_PLATFORMS = ["darwin", "win32"];
6725
- DESKTOP_FLAVORS = ["production", "development"];
6726
- desktopShellInfoSchema = external_exports.object({
6727
- /** The shell's own release version, independent of the web deploy. */
6728
- shellVersion: external_exports.string().regex(DESKTOP_SHELL_VERSION_RE),
6729
- /** The Electron runtime the shell was built with. */
6730
- electronVersion: external_exports.string().regex(/^\d{1,4}\.\d{1,4}\.\d{1,4}(-[0-9A-Za-z.-]{1,32})?$/),
6731
- platform: external_exports.enum(DESKTOP_PLATFORMS),
6732
- /** CPU architecture as Node reports it (`arm64`, `x64`). */
6733
- arch: external_exports.string().regex(/^[a-z0-9_]{1,16}$/),
6734
- flavor: external_exports.enum(DESKTOP_FLAVORS),
6735
- /**
6736
- * Present, and true, when the shell runs from the Microsoft Store's package: the Store updates it,
6737
- * and Windows alone opens it at login (the package's startup task, which the person turns on in
6738
- * Windows' settings). An optional field, so no new `bridgeVersion`: an older page ignores it, and
6739
- * its absence is every other shell.
6740
- */
6741
- store: external_exports.literal(true).optional()
6742
- });
6743
- DESKTOP_PRESENCE_STATES = ["present", "away"];
6744
- desktopPresenceSchema = external_exports.object({
6745
- presence: external_exports.enum(DESKTOP_PRESENCE_STATES),
6746
- mainWindow: external_exports.object({
6747
- shown: external_exports.boolean(),
6748
- focused: external_exports.boolean()
6749
- })
6750
- });
6751
- desktopUpdateSchema = external_exports.object({
6752
- ready: external_exports.object({
6753
- version: external_exports.string().regex(DESKTOP_SHELL_VERSION_RE),
6754
- offerRestart: external_exports.boolean()
6755
- }).nullable()
6756
- });
6757
- DESKTOP_SIGN_IN_URL_MAX_LENGTH = 4096;
6758
- DESKTOP_APP_PATH_MAX_LENGTH = 512;
6759
- desktopAppPathSchema = external_exports.string().max(DESKTOP_APP_PATH_MAX_LENGTH).regex(/^\/(?![/\\])[^\s\\]*$/);
6760
- DESKTOP_NOTIFICATION_KINDS = ["handoff", "message", "summary"];
6761
- DESKTOP_NOTIFICATION_TITLE_MAX_LENGTH = 200;
6762
- DESKTOP_NOTIFICATION_BODY_MAX_LENGTH = 500;
6763
- notificationTitleSchema = external_exports.string().min(1).max(DESKTOP_NOTIFICATION_TITLE_MAX_LENGTH);
6764
- notificationBodySchema = external_exports.string().max(DESKTOP_NOTIFICATION_BODY_MAX_LENGTH);
6765
- desktopNotificationSchema = external_exports.object({
6766
- kind: external_exports.enum(DESKTOP_NOTIFICATION_KINDS),
6767
- title: notificationTitleSchema,
6768
- body: notificationBodySchema,
6769
- path: desktopAppPathSchema,
6770
- withoutPreview: external_exports.object({ title: notificationTitleSchema, body: notificationBodySchema }).optional()
6771
- });
6772
- DESKTOP_BADGE_MAX_COUNT = 1e6;
6773
- DESKTOP_BADGE_LABEL_MAX_LENGTH = 200;
6774
- desktopBadgeSchema = external_exports.object({
6775
- count: external_exports.number().int().min(0).max(DESKTOP_BADGE_MAX_COUNT),
6776
- label: external_exports.string().max(DESKTOP_BADGE_LABEL_MAX_LENGTH)
6777
- });
6778
- desktopNavigateSchema = external_exports.object({
6779
- path: desktopAppPathSchema
6780
- });
6781
- desktopSettingsSchema = external_exports.object({
6782
- /** The app opens when the person logs in to the computer: the operating system's own login item. */
6783
- openAtLogin: external_exports.boolean(),
6784
- /** Closing the window keeps the app running in the tray (true), or quits it (false). */
6785
- closeToTray: external_exports.boolean(),
6786
- /** The shell shows notifications (true), or none (false). The badge is not a notification. */
6787
- notifications: external_exports.boolean(),
6788
- /**
6789
- * A customer message's notification shows the customer's name and words, where the platform
6790
- * allows them at all (`desktopShowsCustomerWords`: macOS); elsewhere the shell never shows them.
6791
- */
6792
- messagePreview: external_exports.boolean()
6793
- });
6794
- desktopSettingsChangeSchema = desktopSettingsSchema.partial().strict().refine((change) => Object.values(change).every((value) => typeof value === "boolean"), {
6795
- message: "each setting changed is true or false"
6796
- });
6797
- desktopBridgeArgsSchemas = {
6798
- getShellInfo: external_exports.tuple([]),
6799
- getPresence: external_exports.tuple([]),
6800
- openSignIn: external_exports.tuple([external_exports.string().max(DESKTOP_SIGN_IN_URL_MAX_LENGTH)]),
6801
- getUpdate: external_exports.tuple([]),
6802
- restartToUpdate: external_exports.tuple([]),
6803
- notify: external_exports.tuple([desktopNotificationSchema]),
6804
- setBadge: external_exports.tuple([desktopBadgeSchema]),
6805
- clearAll: external_exports.tuple([]),
6806
- getSettings: external_exports.tuple([]),
6807
- setSettings: external_exports.tuple([desktopSettingsChangeSchema])
6808
- };
6809
- }
6810
- });
6811
-
6812
6695
  // ../../packages/core/dist/chunk-MIWZOSPI.js
6813
6696
  function toIso(epochMs) {
6814
6697
  return new Date(epochMs).toISOString();
@@ -6973,7 +6856,7 @@ var init_chunk_A4JC7DXB = __esm({
6973
6856
  }
6974
6857
  });
6975
6858
 
6976
- // ../../packages/core/dist/chunk-23UZ2IKU.js
6859
+ // ../../packages/core/dist/chunk-VMAX5YRT.js
6977
6860
  function spokenLineField(label, description2) {
6978
6861
  return { type: "text", label, maxLength: SPOKEN_LINE_MAX_CHARS, default: "", description: description2 };
6979
6862
  }
@@ -6983,8 +6866,8 @@ function byLowercaseName(a, b) {
6983
6866
  return x < y ? -1 : x > y ? 1 : 0;
6984
6867
  }
6985
6868
  var CALLER_LANGUAGE, TTS_VOICE_REPLY_ENABLED_FIELD, COPILOT_TRIGGER_FIELD, SANDBOX_AGENT_FIELDS, AUDIO_LANGUAGE_OPTIONS, whatsapp, instagram, resend, telegram, API_CHANNEL_DELIVERY_EVENTS, apiChannel, OPENAI_REASONING_MODELS, openai, anthropic, googleAiStudio, openRouter, xai, groqStt, openaiStt, elevenLabsStt, openaiTts, groqTts, elevenLabsTts, GEMINI_TTS_VOICES, googleTts, wayai, externalResources, restApiTool, mcpServer, REKOR_TOOLSET_SERVICE_NAME, rekorToolset, CLAUDE_HARNESS_MODELS, CLAUDE_HARNESS_MODEL_OPTIONS, HARNESS_MCP_SERVERS_FIELD, HARNESS_EGRESS_FIELDS, claudeManagedAgents, SPOKEN_LINE_MAX_CHARS, gptLive, CONNECTORS;
6986
- var init_chunk_23UZ2IKU = __esm({
6987
- "../../packages/core/dist/chunk-23UZ2IKU.js"() {
6869
+ var init_chunk_VMAX5YRT = __esm({
6870
+ "../../packages/core/dist/chunk-VMAX5YRT.js"() {
6988
6871
  "use strict";
6989
6872
  init_chunk_A4JC7DXB();
6990
6873
  CALLER_LANGUAGE = "caller";
@@ -7951,13 +7834,13 @@ var init_chunk_23UZ2IKU = __esm({
7951
7834
  }
7952
7835
  });
7953
7836
 
7954
- // ../../packages/core/dist/chunk-23ESQLLF.js
7837
+ // ../../packages/core/dist/chunk-C4TPQN6Z.js
7955
7838
  var evalCallInstant, EVAL_CALL_MIN_SECONDS, EVAL_CALL_MAX_SECONDS, EVAL_CALL_SPOKEN_LINE_MAX_CHARS, hubScoped2, createEvalCallBody, createEvalCallResponse, evalCallConversationQuery, evalCallRecordQuery, evalCallSpeaker, evalCallUtterance, evalCallTurn, evalCallRecording, evalCallRecordResponse, evalCallFinishResponse;
7956
- var init_chunk_23ESQLLF = __esm({
7957
- "../../packages/core/dist/chunk-23ESQLLF.js"() {
7839
+ var init_chunk_C4TPQN6Z = __esm({
7840
+ "../../packages/core/dist/chunk-C4TPQN6Z.js"() {
7958
7841
  "use strict";
7959
7842
  init_chunk_E4DIIOOE();
7960
- init_chunk_23UZ2IKU();
7843
+ init_chunk_VMAX5YRT();
7961
7844
  init_chunk_HZ6CADSY();
7962
7845
  init_chunk_MIWZOSPI();
7963
7846
  init_zod();
@@ -8212,58 +8095,58 @@ var init_chunk_EA23LSDS = __esm({
8212
8095
  }
8213
8096
  });
8214
8097
 
8215
- // ../../packages/core/dist/chunk-V4FRPRH5.js
8216
- var CONSULT_THREAD_STATUSES, consultThreadStatus, CONSULT_THREAD_TITLE_MAX, consultThreadTitle, consultThreadSummary, listConsultThreadsQuery, listConsultThreadsResponse, createConsultThreadBody, createConsultThreadResponse, consultThreadIdParam, updateConsultThreadBody, updateConsultThreadResponse, CONSULT_AWAIT_TIMEOUT_MS;
8217
- var init_chunk_V4FRPRH5 = __esm({
8218
- "../../packages/core/dist/chunk-V4FRPRH5.js"() {
8098
+ // ../../packages/core/dist/chunk-SY6PLCPK.js
8099
+ var jsonSchemaSchema, hubUserIdentity, stateValueEntry, getHubUserContextResponse, updateHubUserBody, updateHubUserResponse, unlockHubUserNameResponse, stateResetParams, stateResetResponse;
8100
+ var init_chunk_SY6PLCPK = __esm({
8101
+ "../../packages/core/dist/chunk-SY6PLCPK.js"() {
8219
8102
  "use strict";
8103
+ init_chunk_6TSQ5HXC();
8220
8104
  init_zod();
8221
- CONSULT_THREAD_STATUSES = ["open", "awaiting", "resolved", "cancelled_at_close"];
8222
- consultThreadStatus = external_exports.enum(CONSULT_THREAD_STATUSES);
8223
- CONSULT_THREAD_TITLE_MAX = 120;
8224
- consultThreadTitle = external_exports.string().trim().min(1).max(CONSULT_THREAD_TITLE_MAX);
8225
- consultThreadSummary = external_exports.object({
8226
- consult_thread_id: external_exports.string(),
8227
- conversation_id: external_exports.string(),
8228
- initiator_type: external_exports.enum(["team", "agent"]),
8229
- initiator_id: external_exports.string(),
8230
- engaged_agent_id: external_exports.string().nullable(),
8231
- engaged_agent_name: external_exports.string().nullable(),
8232
- title: external_exports.string().nullable(),
8233
- status: consultThreadStatus,
8234
- created_at: external_exports.string()
8105
+ jsonSchemaSchema = external_exports.record(external_exports.unknown());
8106
+ hubUserIdentity = external_exports.object({
8107
+ user_id: external_exports.string().nullable(),
8108
+ user_name: external_exports.string().nullable(),
8109
+ user_email: external_exports.string().nullable(),
8110
+ user_name_locked: external_exports.boolean(),
8111
+ created_at: external_exports.string(),
8112
+ updated_at: external_exports.string().nullable(),
8113
+ hub_user_id: external_exports.string().optional(),
8114
+ enabled: external_exports.boolean().optional(),
8115
+ hub_team_id: external_exports.string().nullable().optional(),
8116
+ source: external_exports.enum(["grant", "auto"]).optional()
8235
8117
  });
8236
- listConsultThreadsQuery = external_exports.object({
8237
- hub_id: external_exports.string().uuid()
8118
+ stateValueEntry = external_exports.object({
8119
+ state_slug: external_exports.string(),
8120
+ state_name: external_exports.string(),
8121
+ state_description: external_exports.string().nullable().optional(),
8122
+ scope: external_exports.enum(["user", "conversation"]),
8123
+ json_schema: jsonSchemaSchema,
8124
+ initial_value: external_exports.unknown(),
8125
+ value: external_exports.unknown(),
8126
+ is_reserved: external_exports.boolean()
8238
8127
  });
8239
- listConsultThreadsResponse = external_exports.object({
8240
- threads: external_exports.array(consultThreadSummary)
8128
+ getHubUserContextResponse = external_exports.object({
8129
+ user: hubUserIdentity,
8130
+ user_states: external_exports.array(stateValueEntry),
8131
+ conversation_states: external_exports.array(stateValueEntry)
8241
8132
  });
8242
- createConsultThreadBody = external_exports.object({
8243
- hub_id: external_exports.string().uuid(),
8244
- title: consultThreadTitle.optional(),
8245
- // Optionally engage a consultant on creation. Validated server-side against the
8246
- // hub's `consultant`-role agents; a non-consultant / unknown id is rejected.
8247
- engaged_agent_id: external_exports.string().uuid().optional()
8133
+ updateHubUserBody = external_exports.object({
8134
+ // Non-empty, non-null. `.nullable()` here would bypass `.min(1)` and let an
8135
+ // admin arm the lock on a null name — see hub-do.ts updateHubUser null-guard.
8136
+ user_name: external_exports.string().min(1).max(120)
8248
8137
  });
8249
- createConsultThreadResponse = external_exports.object({
8250
- thread: consultThreadSummary
8138
+ updateHubUserResponse = external_exports.object({
8139
+ user: hubUserIdentity
8251
8140
  });
8252
- consultThreadIdParam = external_exports.object({
8253
- id: external_exports.string().uuid(),
8254
- threadId: external_exports.string().uuid()
8141
+ unlockHubUserNameResponse = external_exports.object({
8142
+ user: hubUserIdentity
8255
8143
  });
8256
- updateConsultThreadBody = external_exports.object({
8257
- hub_id: external_exports.string().uuid(),
8258
- title: consultThreadTitle.optional(),
8259
- engaged_agent_id: external_exports.string().uuid().optional()
8260
- }).refine((v) => v.title !== void 0 || v.engaged_agent_id !== void 0, {
8261
- message: "Provide a title and/or an engaged_agent_id to update"
8144
+ stateResetParams = external_exports.object({
8145
+ stateSlug: slugSchema
8262
8146
  });
8263
- updateConsultThreadResponse = external_exports.object({
8264
- thread: consultThreadSummary
8147
+ stateResetResponse = external_exports.object({
8148
+ ok: external_exports.literal(true)
8265
8149
  });
8266
- CONSULT_AWAIT_TIMEOUT_MS = 15 * 6e4;
8267
8150
  }
8268
8151
  });
8269
8152
 
@@ -9363,7 +9246,7 @@ var init_chunk_IBL7FANV = __esm({
9363
9246
  }
9364
9247
  });
9365
9248
 
9366
- // ../../packages/core/dist/chunk-Y3S4XX4K.js
9249
+ // ../../packages/core/dist/chunk-Z22T2ASG.js
9367
9250
  function parseExpr(expr) {
9368
9251
  const fnMatch = expr.match(/^([a-zA-Z_][a-zA-Z0-9_]*)\s*\((.*?)\)\s*(?:\.(.*))?$/);
9369
9252
  if (!fnMatch) return null;
@@ -9447,8 +9330,8 @@ function scanTemplateResources(template) {
9447
9330
  return scan;
9448
9331
  }
9449
9332
  var PREVIOUS_CONVERSATIONS_MAX, PLACEHOLDER_RE, CATALOG_FN, LEGACY_CATALOG_FN, EMPTY_SCAN;
9450
- var init_chunk_Y3S4XX4K = __esm({
9451
- "../../packages/core/dist/chunk-Y3S4XX4K.js"() {
9333
+ var init_chunk_Z22T2ASG = __esm({
9334
+ "../../packages/core/dist/chunk-Z22T2ASG.js"() {
9452
9335
  "use strict";
9453
9336
  PREVIOUS_CONVERSATIONS_MAX = 20;
9454
9337
  PLACEHOLDER_RE = /\{\{\s*([^{}]+?)\s*\}\}/g;
@@ -9652,7 +9535,7 @@ var init_chunk_T7KQKDET = __esm({
9652
9535
  }
9653
9536
  });
9654
9537
 
9655
- // ../../packages/core/dist/chunk-DIBRGYL6.js
9538
+ // ../../packages/core/dist/chunk-2LZYS6YX.js
9656
9539
  function resolveMonitorTrigger(monitorConfig) {
9657
9540
  if (!monitorConfig || typeof monitorConfig !== "object") return "idle";
9658
9541
  const raw = monitorConfig.trigger;
@@ -9958,12 +9841,12 @@ function refineMonitorRulesStructuredOutput(body, ctx) {
9958
9841
  if (refusal2) ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: ["response_format"], message: refusal2 });
9959
9842
  }
9960
9843
  var NATIVE_TOOL_NAMES, previousConversationsCountField, summarizationThresholdField, flagConditionSchema, MONITOR_TRIGGERS, monitorTriggerSchema, AUTOMATION_GATE_TRIGGERS, NON_FIRING_TRIGGERS, MONITOR_FIRING_TRIGGERS, MONITOR_DELAY_SECONDS_MIN, MONITOR_IDLE_DELAY_REQUIRED_MESSAGE, MONITOR_HISTORY_MESSAGES_MAX, monitorHistoryMessagesSchema, monitorIncludeToolResultsSchema, MONITOR_INPUT_SHAPING_KEYS, MONITOR_INPUT_SHAPING_SCHEMAS, MONITOR_INPUT_SHAPING_IDLE_MESSAGE, monitorArgumentSourceSchema, MONITOR_NOTE_TEMPLATE_MAX, MONITOR_STEER_NOTE_MAX, MONITOR_GATE_AGENT_NAME_MAX, monitorActionSchema, monitorRuleSchema, MONITOR_RULE_KEYS, MONITOR_RULE_SCHEMAS, MONITOR_RULE_TRIGGERS, MONITOR_RULE_TRIGGER_MESSAGE, CALL_UTTERANCE_SPEAKERS, callUtteranceSpeakerSchema, MONITOR_CALL_KEYS, MONITOR_CALL_SCHEMAS, MONITOR_CALL_KEY_MESSAGE, CALL_STEERING_MIN_CONFIDENCE, CALL_UTTERANCE_RULE_NOT_CONFIDENT_MESSAGE, CALL_UTTERANCE_FALLBACK_MESSAGE, CALL_UTTERANCE_FLAG_CONDITIONS_MESSAGE, CALL_STEER_NOTE_BLANK_MESSAGE, MONITOR_USER_MESSAGE_ACTION_KINDS, MONITOR_ASSISTANT_REPLY_ACTION_KINDS, MONITOR_CALL_UTTERANCE_ACTION_KINDS, MONITOR_AUTOMATION_FIRE_ACTION_KINDS, MONITOR_AUTOMATION_ITEM_ACTION_KINDS, INSERT_NOTE_TOOL_NAME, RUN_MONITOR_TOOL_NAME, MONITOR_RULE_ALLOWED_NATIVE_TOOLS, MONITOR_RULE_REENTRY_TOOLS, MONITOR_RULE_REENTRY_TRACKS, AUTOMATION_FIRE_FLAG_CONDITIONS_MESSAGE, AUTOMATION_FIRE_INPUT_SHAPING_MESSAGE, AUTOMATION_ITEM_FLAG_CONDITIONS_MESSAGE, AUTOMATION_ITEM_INPUT_SHAPING_MESSAGE, AUTOMATION_GATE_KEY_MESSAGES, monitorConfigField, flagConditionsField, agentIdParam, listAgentsQuery, agentConnectionsQuery, createAgentBody, updateAgentBody, AGENT_PARAMETER_TYPES, AGENT_PARAMETER_NAME_REGEX, agentParameterCreateSchema, MAX_AGENT_PARAMETERS_PER_REQUEST, createAgentParametersBody;
9961
- var init_chunk_DIBRGYL6 = __esm({
9962
- "../../packages/core/dist/chunk-DIBRGYL6.js"() {
9844
+ var init_chunk_2LZYS6YX = __esm({
9845
+ "../../packages/core/dist/chunk-2LZYS6YX.js"() {
9963
9846
  "use strict";
9964
9847
  init_chunk_UFYIBL66();
9965
9848
  init_chunk_IBL7FANV();
9966
- init_chunk_Y3S4XX4K();
9849
+ init_chunk_Z22T2ASG();
9967
9850
  init_chunk_HZ6CADSY();
9968
9851
  init_chunk_C2UEA2KW();
9969
9852
  init_chunk_DHPUPI4Y();
@@ -10184,12 +10067,12 @@ var init_chunk_DIBRGYL6 = __esm({
10184
10067
  }
10185
10068
  });
10186
10069
 
10187
- // ../../packages/core/dist/chunk-6GBBTCME.js
10070
+ // ../../packages/core/dist/chunk-XR36MYEY.js
10188
10071
  var conversationIdParam, conversationHubQuery, claimBody, releaseBody, transferBody, closeBody, additionalContextPayloadSchema, kanbanUpdateBody, annotateConversationBody, observabilityParams, observabilityListParams, deleteUserConversationsBody, deleteUserConversationsResponse, sendMessageBody, listConversationsQuery, flagSourceSchema, getConversationsResponse, getConversationDetailParams, getConversationDetailQuery, getConversationDetailResponse, listWhatsAppTemplatesQuery, sendWhatsAppTemplateBody;
10189
- var init_chunk_6GBBTCME = __esm({
10190
- "../../packages/core/dist/chunk-6GBBTCME.js"() {
10072
+ var init_chunk_XR36MYEY = __esm({
10073
+ "../../packages/core/dist/chunk-XR36MYEY.js"() {
10191
10074
  "use strict";
10192
- init_chunk_DIBRGYL6();
10075
+ init_chunk_2LZYS6YX();
10193
10076
  init_chunk_HZ6CADSY();
10194
10077
  init_chunk_DHPUPI4Y();
10195
10078
  init_zod();
@@ -10486,115 +10369,98 @@ var init_chunk_KSTYTQ7I = __esm({
10486
10369
  }
10487
10370
  });
10488
10371
 
10489
- // ../../packages/core/dist/chunk-7CYHPF35.js
10490
- var appMessageSenderType, appMessageReceiverType, apiChannelMessage, apiChannelMessageBody, appMessageBody, appMessageResponse;
10491
- var init_chunk_7CYHPF35 = __esm({
10492
- "../../packages/core/dist/chunk-7CYHPF35.js"() {
10372
+ // ../../packages/core/dist/chunk-LKBSHANA.js
10373
+ var DESKTOP_SHELL_VERSION_RE, DESKTOP_PLATFORMS, DESKTOP_FLAVORS, desktopShellInfoSchema, DESKTOP_PRESENCE_STATES, desktopPresenceSchema, desktopUpdateSchema, DESKTOP_SIGN_IN_URL_MAX_LENGTH, DESKTOP_APP_PATH_MAX_LENGTH, desktopAppPathSchema, DESKTOP_NOTIFICATION_KINDS, DESKTOP_NOTIFICATION_TITLE_MAX_LENGTH, DESKTOP_NOTIFICATION_BODY_MAX_LENGTH, notificationTitleSchema, notificationBodySchema, desktopNotificationSchema, DESKTOP_BADGE_MAX_COUNT, DESKTOP_BADGE_LABEL_MAX_LENGTH, desktopBadgeSchema, desktopNavigateSchema, desktopSettingsSchema, desktopSettingsChangeSchema, desktopBridgeArgsSchemas;
10374
+ var init_chunk_LKBSHANA = __esm({
10375
+ "../../packages/core/dist/chunk-LKBSHANA.js"() {
10493
10376
  "use strict";
10494
- init_chunk_HZ6CADSY();
10495
10377
  init_zod();
10496
- appMessageSenderType = external_exports.enum(["user", "team"]);
10497
- appMessageReceiverType = external_exports.enum(["user", "team", "agent", "assistant"]).transform((v) => v === "assistant" ? "agent" : v);
10498
- apiChannelMessage = external_exports.object({
10499
- text: clientOptionalString,
10500
- attachments: external_exports.array(messageAttachment).max(MAX_ATTACHMENTS_PER_MESSAGE).nullish().transform((v) => v ?? void 0)
10501
- }).refine((m) => m.text && m.text.length > 0 || m.attachments && m.attachments.length > 0, {
10502
- message: "message must have text or at least one attachment"
10378
+ DESKTOP_SHELL_VERSION_RE = /^(0|[1-9]\d{0,5})\.(0|[1-9]\d{0,5})\.(0|[1-9]\d{0,5})(-[0-9A-Za-z.-]{1,32})?$/;
10379
+ DESKTOP_PLATFORMS = ["darwin", "win32"];
10380
+ DESKTOP_FLAVORS = ["production", "development"];
10381
+ desktopShellInfoSchema = external_exports.object({
10382
+ /** The shell's own release version, independent of the web deploy. */
10383
+ shellVersion: external_exports.string().regex(DESKTOP_SHELL_VERSION_RE),
10384
+ /** The Electron runtime the shell was built with. */
10385
+ electronVersion: external_exports.string().regex(/^\d{1,4}\.\d{1,4}\.\d{1,4}(-[0-9A-Za-z.-]{1,32})?$/),
10386
+ platform: external_exports.enum(DESKTOP_PLATFORMS),
10387
+ /** CPU architecture as Node reports it (`arm64`, `x64`). */
10388
+ arch: external_exports.string().regex(/^[a-z0-9_]{1,16}$/),
10389
+ flavor: external_exports.enum(DESKTOP_FLAVORS),
10390
+ /**
10391
+ * Present, and true, when the shell runs from the Microsoft Store's package: the Store updates it,
10392
+ * and Windows alone opens it at login (the package's startup task, which the person turns on in
10393
+ * Windows' settings). An optional field, so no new `bridgeVersion`: an older page ignores it, and
10394
+ * its absence is every other shell.
10395
+ */
10396
+ store: external_exports.literal(true).optional()
10503
10397
  });
10504
- apiChannelMessageBody = external_exports.object({
10505
- // Correlation id (task hubs): new → new conversation, repeat → continue. min 1 so an
10506
- // empty string can't masquerade as a ref. Mutually exclusive with conversation_id.
10507
- external_ref: external_exports.string().min(1).max(256).optional(),
10508
- // Continue a specific WayAI conversation (authorized against the hub/channel + owner).
10509
- // UUID-validated here (unlike the app channel, whose client we control): allocation
10510
- // only treats a UUID-shaped id as a provided conversation, so a malformed id would
10511
- // otherwise skip the owner guard and silently MINT a new conversation instead of
10512
- // rejecting. A format 400 is shape-only — not an existence oracle (a valid-but-unknown
10513
- // UUID still collapses to the opaque authorization error downstream).
10514
- conversation_id: external_exports.string().uuid().optional(),
10515
- // On-behalf-of end-user identity. Absent → per-connection service principal (task-hub
10516
- // only; chat hub rejects with 422 in the route).
10517
- user: external_exports.object({
10518
- id: external_exports.string().min(1),
10519
- email: clientOptionalString,
10520
- name: clientOptionalString
10521
- }).optional(),
10522
- message: apiChannelMessage,
10523
- // Idempotency key: maps to channel_message_sid, deduped within one conversation
10524
- // (ConversationDO.storeMessage). A retried POST resolves to the same conversation (a chat
10525
- // hub's user, the external_ref, the conversation_id, or on a task hub with neither, this key
10526
- // scoped by the sender), so it echoes the original message_id and skips billing / turn
10527
- // dispatch. A failed store answers a retryable 503 only when this key is set; without it a
10528
- // retry could store the message twice, so it answers 400.
10529
- client_message_id: external_exports.string().min(1).max(256).optional()
10530
- }).refine((b) => !(b.external_ref && b.conversation_id), {
10531
- message: "provide external_ref or conversation_id, not both",
10532
- path: ["external_ref"]
10398
+ DESKTOP_PRESENCE_STATES = ["present", "away"];
10399
+ desktopPresenceSchema = external_exports.object({
10400
+ presence: external_exports.enum(DESKTOP_PRESENCE_STATES),
10401
+ mainWindow: external_exports.object({
10402
+ shown: external_exports.boolean(),
10403
+ focused: external_exports.boolean()
10404
+ })
10533
10405
  });
10534
- appMessageBody = external_exports.object({
10535
- // Message content — three historical aliases. All optional: an attachment-only
10536
- // or voice-only message carries no text.
10537
- content: clientOptionalString,
10538
- message_text: clientOptionalString,
10539
- message_body: clientOptionalString,
10540
- // Conversation context. Ids are plain strings rather than `.uuid()` on purpose:
10541
- // they are AUTHORIZED downstream, which is the stronger guarantee — a well-formed
10542
- // uuid belonging to another tenant must fail just as hard as junk. `hub_id` is
10543
- // gated by `assertHubEndUserAccess` (gh #3286) and `conversation_id` by HubDO's
10544
- // conversation_index owner check (gh #2781, #3281). The route's own falsy guards
10545
- // ('hub_id is required') still reject an empty one.
10546
- hub_id: clientOptionalString,
10547
- channel_id: clientOptionalString,
10548
- conversation_id: clientOptionalString,
10549
- hub_type: external_exports.enum(["chat", "task"]).nullish().transform((v) => v ?? void 0),
10550
- // Stable idempotency key for one explicit task-hub launcher. HubDO scopes it
10551
- // to the authenticated user and resolves retries/tabs to one conversation.
10552
- task_start_id: external_exports.string().uuid().nullish().transform((v) => v ?? void 0),
10553
- // Routing.
10554
- sender_type: appMessageSenderType.nullish().transform((v) => v ?? void 0),
10555
- receiver_type: appMessageReceiverType.nullish().transform((v) => v ?? void 0),
10556
- // Only meaningful on a team send, where `validateAppTeamSendContext` proves the
10557
- // caller may send to this receiver. Absent on a team send to a conversation with no
10558
- // person, which names its `conversation_id` instead. The end-user branch ignores it —
10559
- // see the receiver derivation in the route.
10560
- user_receiver_id: clientOptionalString,
10561
- // ── Internal consult (consultant-agents PR 2 — H1.0) ──────────────────────
10562
- // A team member handling a customer conversation can tag a `consultant`-role
10563
- // agent for a PRIVATE, team-only exchange that never reaches the customer. A
10564
- // consult send is a team send with `receiver_type: 'agent'` targeting the
10565
- // consultant; `user_receiver_id` identifies the customer whose conversation this is
10566
- // (and is authorized by `validateAppTeamSendContext`, exactly as a team→user send is),
10567
- // and is absent, as on a team→user send, when the conversation has no person. The consultant is resolved from `agent_receiver_id`
10568
- // when supplied, else from an `@mention` parsed out of the message text against
10569
- // the hub's consultant agents. `consult_thread_id` continues an existing thread;
10570
- // absent, the route creates/reuses the single implicit thread. These fields are
10571
- // inert on every non-consult send (end-user send, team→user send).
10572
- agent_receiver_id: clientOptionalString,
10573
- consult_thread_id: clientOptionalString,
10574
- is_first_message: clientOptionalBoolean,
10575
- end_conversation: clientOptionalBoolean,
10576
- // Pre-generated by the client so the optimistic bubble and the stored row share
10577
- // a key (transcription live-updates land on the same row instead of duplicating).
10578
- message_id: clientOptionalString,
10579
- attachments: external_exports.array(messageAttachment).max(MAX_ATTACHMENTS_PER_MESSAGE).nullish().transform((v) => v ?? void 0),
10580
- // Base64-encoded audio for STT. Size-capped in the route (the cap is a byte
10581
- // budget tied to the /channels/* bodyLimit, not a shape rule).
10582
- audio_file: clientOptionalString
10406
+ desktopUpdateSchema = external_exports.object({
10407
+ ready: external_exports.object({
10408
+ version: external_exports.string().regex(DESKTOP_SHELL_VERSION_RE),
10409
+ offerRestart: external_exports.boolean()
10410
+ }).nullable()
10583
10411
  });
10584
- appMessageResponse = external_exports.object({
10585
- success: external_exports.boolean(),
10586
- message: external_exports.string(),
10587
- result: external_exports.object({
10588
- conversation_id: external_exports.string().optional(),
10589
- message_id: external_exports.string().optional(),
10590
- status: external_exports.string().optional(),
10591
- files: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown())).optional(),
10592
- // True when this request reused a task-start/message id already accepted by
10593
- // the server. Clients must replace their optimistic payload with a fresh
10594
- // authoritative read because another tab may have won with different text.
10595
- deduped: external_exports.boolean().optional()
10596
- }).optional()
10412
+ DESKTOP_SIGN_IN_URL_MAX_LENGTH = 4096;
10413
+ DESKTOP_APP_PATH_MAX_LENGTH = 512;
10414
+ desktopAppPathSchema = external_exports.string().max(DESKTOP_APP_PATH_MAX_LENGTH).regex(/^\/(?![/\\])[^\s\\]*$/);
10415
+ DESKTOP_NOTIFICATION_KINDS = ["handoff", "message", "summary"];
10416
+ DESKTOP_NOTIFICATION_TITLE_MAX_LENGTH = 200;
10417
+ DESKTOP_NOTIFICATION_BODY_MAX_LENGTH = 500;
10418
+ notificationTitleSchema = external_exports.string().min(1).max(DESKTOP_NOTIFICATION_TITLE_MAX_LENGTH);
10419
+ notificationBodySchema = external_exports.string().max(DESKTOP_NOTIFICATION_BODY_MAX_LENGTH);
10420
+ desktopNotificationSchema = external_exports.object({
10421
+ kind: external_exports.enum(DESKTOP_NOTIFICATION_KINDS),
10422
+ title: notificationTitleSchema,
10423
+ body: notificationBodySchema,
10424
+ path: desktopAppPathSchema,
10425
+ withoutPreview: external_exports.object({ title: notificationTitleSchema, body: notificationBodySchema }).optional()
10426
+ });
10427
+ DESKTOP_BADGE_MAX_COUNT = 1e6;
10428
+ DESKTOP_BADGE_LABEL_MAX_LENGTH = 200;
10429
+ desktopBadgeSchema = external_exports.object({
10430
+ count: external_exports.number().int().min(0).max(DESKTOP_BADGE_MAX_COUNT),
10431
+ label: external_exports.string().max(DESKTOP_BADGE_LABEL_MAX_LENGTH)
10432
+ });
10433
+ desktopNavigateSchema = external_exports.object({
10434
+ path: desktopAppPathSchema
10435
+ });
10436
+ desktopSettingsSchema = external_exports.object({
10437
+ /** The app opens when the person logs in to the computer: the operating system's own login item. */
10438
+ openAtLogin: external_exports.boolean(),
10439
+ /** Closing the window keeps the app running in the tray (true), or quits it (false). */
10440
+ closeToTray: external_exports.boolean(),
10441
+ /** The shell shows notifications (true), or none (false). The badge is not a notification. */
10442
+ notifications: external_exports.boolean(),
10443
+ /**
10444
+ * A customer message's notification shows the customer's name and words, where the platform
10445
+ * allows them at all (`desktopShowsCustomerWords`: macOS); elsewhere the shell never shows them.
10446
+ */
10447
+ messagePreview: external_exports.boolean()
10597
10448
  });
10449
+ desktopSettingsChangeSchema = desktopSettingsSchema.partial().strict().refine((change) => Object.values(change).every((value) => typeof value === "boolean"), {
10450
+ message: "each setting changed is true or false"
10451
+ });
10452
+ desktopBridgeArgsSchemas = {
10453
+ getShellInfo: external_exports.tuple([]),
10454
+ getPresence: external_exports.tuple([]),
10455
+ openSignIn: external_exports.tuple([external_exports.string().max(DESKTOP_SIGN_IN_URL_MAX_LENGTH)]),
10456
+ getUpdate: external_exports.tuple([]),
10457
+ restartToUpdate: external_exports.tuple([]),
10458
+ notify: external_exports.tuple([desktopNotificationSchema]),
10459
+ setBadge: external_exports.tuple([desktopBadgeSchema]),
10460
+ clearAll: external_exports.tuple([]),
10461
+ getSettings: external_exports.tuple([]),
10462
+ setSettings: external_exports.tuple([desktopSettingsChangeSchema])
10463
+ };
10598
10464
  }
10599
10465
  });
10600
10466
 
@@ -11019,7 +10885,7 @@ var init_chunk_4LXDRTO4 = __esm({
11019
10885
  }
11020
10886
  });
11021
10887
 
11022
- // ../../packages/core/dist/chunk-C5MU3WEM.js
10888
+ // ../../packages/core/dist/chunk-6Y7XMRWF.js
11023
10889
  function isIanaTimezone(timezone) {
11024
10890
  try {
11025
10891
  new Intl.DateTimeFormat("en-US", { timeZone: timezone }).format(0);
@@ -11029,10 +10895,10 @@ function isIanaTimezone(timezone) {
11029
10895
  }
11030
10896
  }
11031
10897
  var evalDateContextSchema;
11032
- var init_chunk_C5MU3WEM = __esm({
11033
- "../../packages/core/dist/chunk-C5MU3WEM.js"() {
10898
+ var init_chunk_6Y7XMRWF = __esm({
10899
+ "../../packages/core/dist/chunk-6Y7XMRWF.js"() {
11034
10900
  "use strict";
11035
- init_chunk_Y3S4XX4K();
10901
+ init_chunk_Z22T2ASG();
11036
10902
  init_chunk_HZ6CADSY();
11037
10903
  init_chunk_MIWZOSPI();
11038
10904
  init_chunk_DHPUPI4Y();
@@ -11059,7 +10925,7 @@ var init_chunk_2ISUBJG7 = __esm({
11059
10925
  }
11060
10926
  });
11061
10927
 
11062
- // ../../packages/core/dist/chunk-6UKJ6EMZ.js
10928
+ // ../../packages/core/dist/chunk-RCTKQTJH.js
11063
10929
  function describeRole(role) {
11064
10930
  if (typeof role === "string") {
11065
10931
  return JSON.stringify(role.length > ROLE_ECHO_MAX ? `${role.slice(0, ROLE_ECHO_MAX)}\u2026` : role);
@@ -11233,11 +11099,11 @@ function terminalRunCount(counts) {
11233
11099
  return counts.successful_runs + counts.failed_runs;
11234
11100
  }
11235
11101
  var evalIdParam, sessionIdParam, scenarioSetIdParam, hubIdQuery, EVAL_FIXTURE_NAME_MAX_LENGTH, evalFixtureOverrideSchema, runSessionQuery, runJourneyQuery, EVAL_INPUT_ROLES, EVAL_INPUT_ROLE_LIST, ROLE_ECHO_MAX, EVAL_INITIAL_STATE_SCOPES, MAX_INITIAL_STATE_ENTRIES, evalInitialStateEntry, evalCustomerContactIdSchema, evalBody, EVAL_LIST_MAX_LIMIT, evalListLimit, getEvalsQuery, toggleEvalBody, bulkToggleEvalsBody, pacingConfigSchema, EVAL_MAX_SELECTED_SCENARIOS, evalScenarioSelectionEntrySchema, evalScenarioSelectionSchema, sessionConfigSchema, createSessionBody, getSessionsQuery, getSessionResultsQuery, getSessionRunsQuery, evalAnalyticsQuery, getSessionCostQuery, compareSessionsQuery, evalsSqlBody, evalsSqlSchemaQuery, exportResultsQuery, validateEvalBody, hubAgentsQuery, createScenarioSetBody, updateScenarioSetBody, scenarioSetsHubQuery, createScenarioFromConversationBody, createJourneyFromConversationBody, evalAttachmentRef, turnMayCarryAttachments, ATTACHMENTS_USER_ONLY_MESSAGE, journeyIdParam, journeyToolCallSchema, journeyTurnSchema, journeyStepOverrideSchema, fixtureField, createJourneyBody, updateJourneyBody, evalSessionConfigResponseSchema, evalSessionResponseSchema, evalSessionListConfigSchema, evalSessionListItemSchema, seedReleaseStatusSchema, EVAL_SESSION_NOT_QUIESCENT;
11236
- var init_chunk_6UKJ6EMZ = __esm({
11237
- "../../packages/core/dist/chunk-6UKJ6EMZ.js"() {
11102
+ var init_chunk_RCTKQTJH = __esm({
11103
+ "../../packages/core/dist/chunk-RCTKQTJH.js"() {
11238
11104
  "use strict";
11239
11105
  init_chunk_4LXDRTO4();
11240
- init_chunk_C5MU3WEM();
11106
+ init_chunk_6Y7XMRWF();
11241
11107
  init_chunk_HZ6CADSY();
11242
11108
  init_chunk_2ISUBJG7();
11243
11109
  init_zod();
@@ -12320,7 +12186,7 @@ var init_chunk_6NI5RAM4 = __esm({
12320
12186
  }
12321
12187
  });
12322
12188
 
12323
- // ../../packages/core/dist/chunk-SCZ3GSJE.js
12189
+ // ../../packages/core/dist/chunk-FJ5K57CB.js
12324
12190
  function refineHubAsCodeCustomTools(config, ctx) {
12325
12191
  const agents = config.agents;
12326
12192
  if (!Array.isArray(agents)) return;
@@ -12856,12 +12722,12 @@ function refineHubAsCodeMonitorRulesOutput(config, ctx) {
12856
12722
  });
12857
12723
  }
12858
12724
  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_CALL_OPENING_CARRIERS, MAX_CALL_OPENING_AGGREGATE_ENCODED_BYTES, hubAsCodeStateSchema, hubAsCodeResourceFileSchema, hubAsCodeResourceSchema, uuidPattern, ciUuidSchema, boundedHubAsCodeResourcesSchema, 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;
12859
- var init_chunk_SCZ3GSJE = __esm({
12860
- "../../packages/core/dist/chunk-SCZ3GSJE.js"() {
12725
+ var init_chunk_FJ5K57CB = __esm({
12726
+ "../../packages/core/dist/chunk-FJ5K57CB.js"() {
12861
12727
  "use strict";
12862
12728
  init_chunk_4S4FBSBE();
12863
- init_chunk_6UKJ6EMZ();
12864
- init_chunk_DIBRGYL6();
12729
+ init_chunk_RCTKQTJH();
12730
+ init_chunk_2LZYS6YX();
12865
12731
  init_chunk_LBDH7LCG();
12866
12732
  init_chunk_4LXDRTO4();
12867
12733
  init_chunk_T4Q5COKJ();
@@ -13703,29 +13569,58 @@ var init_chunk_YULHXJ5M = __esm({
13703
13569
  }
13704
13570
  });
13705
13571
 
13706
- // ../../packages/core/dist/chunk-UEJOG2Q7.js
13707
- var archiveHubIdParam, archiveConversationParams, archiveListQuery, archiveMessageObservabilityParams;
13708
- var init_chunk_UEJOG2Q7 = __esm({
13709
- "../../packages/core/dist/chunk-UEJOG2Q7.js"() {
13572
+ // ../../packages/core/dist/chunk-V4FRPRH5.js
13573
+ var CONSULT_THREAD_STATUSES, consultThreadStatus, CONSULT_THREAD_TITLE_MAX, consultThreadTitle, consultThreadSummary, listConsultThreadsQuery, listConsultThreadsResponse, createConsultThreadBody, createConsultThreadResponse, consultThreadIdParam, updateConsultThreadBody, updateConsultThreadResponse, CONSULT_AWAIT_TIMEOUT_MS;
13574
+ var init_chunk_V4FRPRH5 = __esm({
13575
+ "../../packages/core/dist/chunk-V4FRPRH5.js"() {
13710
13576
  "use strict";
13711
13577
  init_zod();
13712
- archiveHubIdParam = external_exports.object({
13713
- hubId: external_exports.string().uuid()
13578
+ CONSULT_THREAD_STATUSES = ["open", "awaiting", "resolved", "cancelled_at_close"];
13579
+ consultThreadStatus = external_exports.enum(CONSULT_THREAD_STATUSES);
13580
+ CONSULT_THREAD_TITLE_MAX = 120;
13581
+ consultThreadTitle = external_exports.string().trim().min(1).max(CONSULT_THREAD_TITLE_MAX);
13582
+ consultThreadSummary = external_exports.object({
13583
+ consult_thread_id: external_exports.string(),
13584
+ conversation_id: external_exports.string(),
13585
+ initiator_type: external_exports.enum(["team", "agent"]),
13586
+ initiator_id: external_exports.string(),
13587
+ engaged_agent_id: external_exports.string().nullable(),
13588
+ engaged_agent_name: external_exports.string().nullable(),
13589
+ title: external_exports.string().nullable(),
13590
+ status: consultThreadStatus,
13591
+ created_at: external_exports.string()
13714
13592
  });
13715
- archiveConversationParams = external_exports.object({
13716
- hubId: external_exports.string().uuid(),
13717
- conversationId: external_exports.string().uuid()
13593
+ listConsultThreadsQuery = external_exports.object({
13594
+ hub_id: external_exports.string().uuid()
13718
13595
  });
13719
- archiveListQuery = external_exports.object({
13720
- user_id: external_exports.string().optional(),
13721
- start: external_exports.string().optional(),
13722
- end: external_exports.string().optional(),
13723
- page: external_exports.string().regex(/^\d+$/).optional(),
13724
- page_size: external_exports.string().regex(/^\d+$/).optional()
13596
+ listConsultThreadsResponse = external_exports.object({
13597
+ threads: external_exports.array(consultThreadSummary)
13725
13598
  });
13726
- archiveMessageObservabilityParams = archiveConversationParams.extend({
13727
- messageId: external_exports.string().uuid()
13599
+ createConsultThreadBody = external_exports.object({
13600
+ hub_id: external_exports.string().uuid(),
13601
+ title: consultThreadTitle.optional(),
13602
+ // Optionally engage a consultant on creation. Validated server-side against the
13603
+ // hub's `consultant`-role agents; a non-consultant / unknown id is rejected.
13604
+ engaged_agent_id: external_exports.string().uuid().optional()
13605
+ });
13606
+ createConsultThreadResponse = external_exports.object({
13607
+ thread: consultThreadSummary
13608
+ });
13609
+ consultThreadIdParam = external_exports.object({
13610
+ id: external_exports.string().uuid(),
13611
+ threadId: external_exports.string().uuid()
13728
13612
  });
13613
+ updateConsultThreadBody = external_exports.object({
13614
+ hub_id: external_exports.string().uuid(),
13615
+ title: consultThreadTitle.optional(),
13616
+ engaged_agent_id: external_exports.string().uuid().optional()
13617
+ }).refine((v) => v.title !== void 0 || v.engaged_agent_id !== void 0, {
13618
+ message: "Provide a title and/or an engaged_agent_id to update"
13619
+ });
13620
+ updateConsultThreadResponse = external_exports.object({
13621
+ thread: consultThreadSummary
13622
+ });
13623
+ CONSULT_AWAIT_TIMEOUT_MS = 15 * 6e4;
13729
13624
  }
13730
13625
  });
13731
13626
 
@@ -13842,13 +13737,13 @@ var init_chunk_LQY2OCQL = __esm({
13842
13737
  }
13843
13738
  });
13844
13739
 
13845
- // ../../packages/core/dist/chunk-EHPGISOL.js
13740
+ // ../../packages/core/dist/chunk-EA6XOOL2.js
13846
13741
  var AUTOMATION_TRIGGER_TYPES, AUTOMATION_EVENT_TYPES, AUTOMATION_TARGET_TYPES, AUTOMATION_ACTION_TYPES, AUTOMATION_CHANNEL_TYPES, AUTOMATION_PURPOSES, AUTOMATION_NAME_MAX, AUTOMATION_DESCRIPTION_MAX, AUTOMATION_INSTRUCTIONS_MAX, AUTOMATION_TEXT_MAX, AUTOMATION_CRON_MAX, AUTOMATION_WEBHOOK_AUTHS, AUTOMATION_WEBHOOK_HEADERS, AUTOMATION_WEBHOOK_BODY_MAX_BYTES, AUTOMATION_WEBHOOK_HEADER_NAME_MAX, WEBHOOK_RESERVED_HEADERS, automationTriggerSchema, automationTargetSchema, automationActionSchema, automationGateSchema, automationName, automationDescription, automationIdParam, automationHubQuery, automationWebhookParams, AUTOMATION_RUNS_PAGE_MAX, listAutomationRunsQuery, createAutomationBody, updateAutomationBody, AUTOMATION_ALERT_CATEGORIES, AUTOMATION_BLOCKED_ALERT_CATEGORY, automationEventSubscriberParam;
13847
- var init_chunk_EHPGISOL = __esm({
13848
- "../../packages/core/dist/chunk-EHPGISOL.js"() {
13742
+ var init_chunk_EA6XOOL2 = __esm({
13743
+ "../../packages/core/dist/chunk-EA6XOOL2.js"() {
13849
13744
  "use strict";
13850
13745
  init_chunk_LQY2OCQL();
13851
- init_chunk_DIBRGYL6();
13746
+ init_chunk_2LZYS6YX();
13852
13747
  init_chunk_3HSB6J4J();
13853
13748
  init_chunk_5XEJSR22();
13854
13749
  init_chunk_DHPUPI4Y();
@@ -14099,6 +13994,118 @@ var init_chunk_ZJJ5ODOD = __esm({
14099
13994
  }
14100
13995
  });
14101
13996
 
13997
+ // ../../packages/core/dist/chunk-7CYHPF35.js
13998
+ var appMessageSenderType, appMessageReceiverType, apiChannelMessage, apiChannelMessageBody, appMessageBody, appMessageResponse;
13999
+ var init_chunk_7CYHPF35 = __esm({
14000
+ "../../packages/core/dist/chunk-7CYHPF35.js"() {
14001
+ "use strict";
14002
+ init_chunk_HZ6CADSY();
14003
+ init_zod();
14004
+ appMessageSenderType = external_exports.enum(["user", "team"]);
14005
+ appMessageReceiverType = external_exports.enum(["user", "team", "agent", "assistant"]).transform((v) => v === "assistant" ? "agent" : v);
14006
+ apiChannelMessage = external_exports.object({
14007
+ text: clientOptionalString,
14008
+ attachments: external_exports.array(messageAttachment).max(MAX_ATTACHMENTS_PER_MESSAGE).nullish().transform((v) => v ?? void 0)
14009
+ }).refine((m) => m.text && m.text.length > 0 || m.attachments && m.attachments.length > 0, {
14010
+ message: "message must have text or at least one attachment"
14011
+ });
14012
+ apiChannelMessageBody = external_exports.object({
14013
+ // Correlation id (task hubs): new → new conversation, repeat → continue. min 1 so an
14014
+ // empty string can't masquerade as a ref. Mutually exclusive with conversation_id.
14015
+ external_ref: external_exports.string().min(1).max(256).optional(),
14016
+ // Continue a specific WayAI conversation (authorized against the hub/channel + owner).
14017
+ // UUID-validated here (unlike the app channel, whose client we control): allocation
14018
+ // only treats a UUID-shaped id as a provided conversation, so a malformed id would
14019
+ // otherwise skip the owner guard and silently MINT a new conversation instead of
14020
+ // rejecting. A format 400 is shape-only — not an existence oracle (a valid-but-unknown
14021
+ // UUID still collapses to the opaque authorization error downstream).
14022
+ conversation_id: external_exports.string().uuid().optional(),
14023
+ // On-behalf-of end-user identity. Absent → per-connection service principal (task-hub
14024
+ // only; chat hub rejects with 422 in the route).
14025
+ user: external_exports.object({
14026
+ id: external_exports.string().min(1),
14027
+ email: clientOptionalString,
14028
+ name: clientOptionalString
14029
+ }).optional(),
14030
+ message: apiChannelMessage,
14031
+ // Idempotency key: maps to channel_message_sid, deduped within one conversation
14032
+ // (ConversationDO.storeMessage). A retried POST resolves to the same conversation (a chat
14033
+ // hub's user, the external_ref, the conversation_id, or on a task hub with neither, this key
14034
+ // scoped by the sender), so it echoes the original message_id and skips billing / turn
14035
+ // dispatch. A failed store answers a retryable 503 only when this key is set; without it a
14036
+ // retry could store the message twice, so it answers 400.
14037
+ client_message_id: external_exports.string().min(1).max(256).optional()
14038
+ }).refine((b) => !(b.external_ref && b.conversation_id), {
14039
+ message: "provide external_ref or conversation_id, not both",
14040
+ path: ["external_ref"]
14041
+ });
14042
+ appMessageBody = external_exports.object({
14043
+ // Message content — three historical aliases. All optional: an attachment-only
14044
+ // or voice-only message carries no text.
14045
+ content: clientOptionalString,
14046
+ message_text: clientOptionalString,
14047
+ message_body: clientOptionalString,
14048
+ // Conversation context. Ids are plain strings rather than `.uuid()` on purpose:
14049
+ // they are AUTHORIZED downstream, which is the stronger guarantee — a well-formed
14050
+ // uuid belonging to another tenant must fail just as hard as junk. `hub_id` is
14051
+ // gated by `assertHubEndUserAccess` (gh #3286) and `conversation_id` by HubDO's
14052
+ // conversation_index owner check (gh #2781, #3281). The route's own falsy guards
14053
+ // ('hub_id is required') still reject an empty one.
14054
+ hub_id: clientOptionalString,
14055
+ channel_id: clientOptionalString,
14056
+ conversation_id: clientOptionalString,
14057
+ hub_type: external_exports.enum(["chat", "task"]).nullish().transform((v) => v ?? void 0),
14058
+ // Stable idempotency key for one explicit task-hub launcher. HubDO scopes it
14059
+ // to the authenticated user and resolves retries/tabs to one conversation.
14060
+ task_start_id: external_exports.string().uuid().nullish().transform((v) => v ?? void 0),
14061
+ // Routing.
14062
+ sender_type: appMessageSenderType.nullish().transform((v) => v ?? void 0),
14063
+ receiver_type: appMessageReceiverType.nullish().transform((v) => v ?? void 0),
14064
+ // Only meaningful on a team send, where `validateAppTeamSendContext` proves the
14065
+ // caller may send to this receiver. Absent on a team send to a conversation with no
14066
+ // person, which names its `conversation_id` instead. The end-user branch ignores it —
14067
+ // see the receiver derivation in the route.
14068
+ user_receiver_id: clientOptionalString,
14069
+ // ── Internal consult (consultant-agents PR 2 — H1.0) ──────────────────────
14070
+ // A team member handling a customer conversation can tag a `consultant`-role
14071
+ // agent for a PRIVATE, team-only exchange that never reaches the customer. A
14072
+ // consult send is a team send with `receiver_type: 'agent'` targeting the
14073
+ // consultant; `user_receiver_id` identifies the customer whose conversation this is
14074
+ // (and is authorized by `validateAppTeamSendContext`, exactly as a team→user send is),
14075
+ // and is absent, as on a team→user send, when the conversation has no person. The consultant is resolved from `agent_receiver_id`
14076
+ // when supplied, else from an `@mention` parsed out of the message text against
14077
+ // the hub's consultant agents. `consult_thread_id` continues an existing thread;
14078
+ // absent, the route creates/reuses the single implicit thread. These fields are
14079
+ // inert on every non-consult send (end-user send, team→user send).
14080
+ agent_receiver_id: clientOptionalString,
14081
+ consult_thread_id: clientOptionalString,
14082
+ is_first_message: clientOptionalBoolean,
14083
+ end_conversation: clientOptionalBoolean,
14084
+ // Pre-generated by the client so the optimistic bubble and the stored row share
14085
+ // a key (transcription live-updates land on the same row instead of duplicating).
14086
+ message_id: clientOptionalString,
14087
+ attachments: external_exports.array(messageAttachment).max(MAX_ATTACHMENTS_PER_MESSAGE).nullish().transform((v) => v ?? void 0),
14088
+ // Base64-encoded audio for STT. Size-capped in the route (the cap is a byte
14089
+ // budget tied to the /channels/* bodyLimit, not a shape rule).
14090
+ audio_file: clientOptionalString
14091
+ });
14092
+ appMessageResponse = external_exports.object({
14093
+ success: external_exports.boolean(),
14094
+ message: external_exports.string(),
14095
+ result: external_exports.object({
14096
+ conversation_id: external_exports.string().optional(),
14097
+ message_id: external_exports.string().optional(),
14098
+ status: external_exports.string().optional(),
14099
+ files: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown())).optional(),
14100
+ // True when this request reused a task-start/message id already accepted by
14101
+ // the server. Clients must replace their optimistic payload with a fresh
14102
+ // authoritative read because another tab may have won with different text.
14103
+ deduped: external_exports.boolean().optional()
14104
+ }).optional()
14105
+ });
14106
+ }
14107
+ });
14108
+
14102
14109
  // ../../packages/core/dist/chunk-NVKU5PPQ.js
14103
14110
  var ADMIN_SKILL_NAME_REGEX, adminSkillNameParam;
14104
14111
  var init_chunk_NVKU5PPQ = __esm({
@@ -14148,10 +14155,10 @@ var init_chunk_BFG4ZWR4 = __esm({
14148
14155
  }
14149
14156
  });
14150
14157
 
14151
- // ../../packages/core/dist/chunk-WO37XYVD.js
14158
+ // ../../packages/core/dist/chunk-6QXCHNFQ.js
14152
14159
  var dataExplorerDebugDoType, DEBUG_READ_MAX_LIMIT, DEBUG_READ_DEFAULT_LIMIT;
14153
- var init_chunk_WO37XYVD = __esm({
14154
- "../../packages/core/dist/chunk-WO37XYVD.js"() {
14160
+ var init_chunk_6QXCHNFQ = __esm({
14161
+ "../../packages/core/dist/chunk-6QXCHNFQ.js"() {
14155
14162
  "use strict";
14156
14163
  init_zod();
14157
14164
  dataExplorerDebugDoType = external_exports.enum(["hub", "org", "conversation", "user", "platform", "thread", "community", "contact_book", "batch"]);
@@ -14262,7 +14269,7 @@ var init_chunk_OMPT4ZHR = __esm({
14262
14269
  }
14263
14270
  });
14264
14271
 
14265
- // ../../packages/core/dist/chunk-2FCLSQSQ.js
14272
+ // ../../packages/core/dist/chunk-3ACHWKFV.js
14266
14273
  function refineScopedTarget(data, ctx) {
14267
14274
  if (data.scope === "org") {
14268
14275
  if (!data.org_id) {
@@ -14287,13 +14294,13 @@ function refineScopedTarget(data, ctx) {
14287
14294
  }
14288
14295
  }
14289
14296
  }
14290
- var adminOrgIdParam, adminOrgAdminIdParam, adminUserIdParam, PRICING_PLAN_ID_RE, adminPlanIdParam, adminOrganizationsQuery, adminUserSearchQuery, kanbanSlugMigrationQuery, adjustQuotaBody, updatePlanBody, addAdminUserBody, MAX_VOICE_CALL_MINUTE_OPS, voiceCallMinuteOps, AUTOMATION_GATE_EVALUATIONS_PER_OPERATION_BOUND, automationGateEvaluationsPerOperation, AUTOMATION_RUN_RETENTION_DAYS_MAX, automationRunRetentionDays, turnDeadlineSeconds, updatePlatformConfigBody, updateFreeOrgLimitBody, adminScopedTargetShape, adminScopedTargetBody, BRANCHING_ORPHAN_ENTITY_TYPES, BRANCHING_ORPHAN_MAX_TARGETS, adminRepairBranchingOrphansBody, adminRepairLegacyOrgGrantsBody, adminRepairCompedPlansBody, updatePricingPlanBody, dataExplorerSearchQuery, dataExplorerOrgIdParam, dataExplorerHubIdParam, dataExplorerConvIdParam, dataExplorerDoInstancesQuery, dataExplorerNsIdParam, dataExplorerKvKeysBody, dataExplorerKvKeyBody, uuidOrHexId, dataExplorerDeleteOrgParam, dataExplorerDeleteHubParam, dataExplorerDeleteConvParam, dataExplorerDeleteUserParam, dataExplorerDeleteQuery, dataExplorerKvDeleteBody, pitrDoNamespace, pitrBookmarkParam, pitrRestoreBody, healthSamplingTriggerBody, DEBUG_DO_HEX_PREFIX, debugDoEntityId, debugTableName, dataExplorerDebugTablesParam, dataExplorerDebugRowsParam, dataExplorerDebugRowsQuery, dataExplorerDebugAnalyticsTable, debugUuid, dataExplorerDebugAnalyticsRowsParam, dataExplorerDebugAnalyticsRowsQuery, debugHubConvParam, debugMessageIdQuery;
14291
- var init_chunk_2FCLSQSQ = __esm({
14292
- "../../packages/core/dist/chunk-2FCLSQSQ.js"() {
14297
+ var adminOrgIdParam, adminOrgAdminIdParam, adminUserIdParam, PRICING_PLAN_ID_RE, adminPlanIdParam, adminOrganizationsQuery, adminUserSearchQuery, kanbanSlugMigrationQuery, adjustQuotaBody, updatePlanBody, addAdminUserBody, MAX_VOICE_CALL_MINUTE_OPS, voiceCallMinuteOps, AUTOMATION_GATE_EVALUATIONS_PER_OPERATION_BOUND, automationGateEvaluationsPerOperation, AUTOMATION_RUN_RETENTION_DAYS_MAX, automationRunRetentionDays, turnDeadlineSeconds, updatePlatformConfigBody, updateFreeOrgLimitBody, adminScopedTargetShape, adminScopedTargetBody, BRANCHING_ORPHAN_ENTITY_TYPES, BRANCHING_ORPHAN_MAX_TARGETS, adminRepairBranchingOrphansBody, adminRepairLegacyOrgGrantsBody, adminRepairCompedPlansBody, updatePricingPlanBody, dataExplorerSearchQuery, dataExplorerOrgIdParam, dataExplorerHubIdParam, dataExplorerConvIdParam, dataExplorerDoInstancesQuery, dataExplorerNsIdParam, dataExplorerKvKeysBody, dataExplorerKvKeyBody, uuidOrHexId, dataExplorerDeleteOrgParam, dataExplorerDeleteHubParam, dataExplorerDeleteConvParam, dataExplorerDeleteUserParam, dataExplorerDeleteQuery, dataExplorerKvDeleteBody, pitrDoNamespace, pitrBookmarkParam, pitrRestoreBody, healthSamplingTriggerBody, DEBUG_DO_HEX_PREFIX, debugDoEntityId, debugTableName, dataExplorerDebugTablesParam, dataExplorerDebugRowsParam, dataExplorerDebugRowsQuery, dataExplorerDebugAnalyticsTable, debugUuid, dataExplorerDebugAnalyticsRowsParam, dataExplorerDebugAnalyticsRowsQuery, dataExplorerDebugCountsDoType, dataExplorerDebugCountsParam, debugHubConvParam, debugMessageIdQuery;
14298
+ var init_chunk_3ACHWKFV = __esm({
14299
+ "../../packages/core/dist/chunk-3ACHWKFV.js"() {
14293
14300
  "use strict";
14294
14301
  init_chunk_FECLIZTY();
14295
14302
  init_chunk_BFG4ZWR4();
14296
- init_chunk_WO37XYVD();
14303
+ init_chunk_6QXCHNFQ();
14297
14304
  init_chunk_T4Q5COKJ();
14298
14305
  init_chunk_OMPT4ZHR();
14299
14306
  init_chunk_HZ6CADSY();
@@ -14620,6 +14627,11 @@ var init_chunk_2FCLSQSQ = __esm({
14620
14627
  message_id: debugUuid.optional(),
14621
14628
  limit: external_exports.coerce.number().int().min(1).max(DEBUG_READ_MAX_LIMIT).default(DEBUG_READ_DEFAULT_LIMIT)
14622
14629
  });
14630
+ dataExplorerDebugCountsDoType = dataExplorerDebugDoType.extract(["hub", "org"]);
14631
+ dataExplorerDebugCountsParam = external_exports.object({
14632
+ type: dataExplorerDebugCountsDoType,
14633
+ id: debugUuid
14634
+ });
14623
14635
  debugHubConvParam = external_exports.object({
14624
14636
  hubId: debugUuid,
14625
14637
  conversationId: debugUuid
@@ -14741,6 +14753,32 @@ var init_chunk_2PZIF56U = __esm({
14741
14753
  }
14742
14754
  });
14743
14755
 
14756
+ // ../../packages/core/dist/chunk-UEJOG2Q7.js
14757
+ var archiveHubIdParam, archiveConversationParams, archiveListQuery, archiveMessageObservabilityParams;
14758
+ var init_chunk_UEJOG2Q7 = __esm({
14759
+ "../../packages/core/dist/chunk-UEJOG2Q7.js"() {
14760
+ "use strict";
14761
+ init_zod();
14762
+ archiveHubIdParam = external_exports.object({
14763
+ hubId: external_exports.string().uuid()
14764
+ });
14765
+ archiveConversationParams = external_exports.object({
14766
+ hubId: external_exports.string().uuid(),
14767
+ conversationId: external_exports.string().uuid()
14768
+ });
14769
+ archiveListQuery = external_exports.object({
14770
+ user_id: external_exports.string().optional(),
14771
+ start: external_exports.string().optional(),
14772
+ end: external_exports.string().optional(),
14773
+ page: external_exports.string().regex(/^\d+$/).optional(),
14774
+ page_size: external_exports.string().regex(/^\d+$/).optional()
14775
+ });
14776
+ archiveMessageObservabilityParams = archiveConversationParams.extend({
14777
+ messageId: external_exports.string().uuid()
14778
+ });
14779
+ }
14780
+ });
14781
+
14744
14782
  // ../../packages/core/dist/chunk-SOJMWM63.js
14745
14783
  var init_chunk_SOJMWM63 = __esm({
14746
14784
  "../../packages/core/dist/chunk-SOJMWM63.js"() {
@@ -14955,6 +14993,7 @@ var init_chunk_TS4EYU3W = __esm({
14955
14993
  var init_contracts = __esm({
14956
14994
  "../../packages/core/dist/contracts/index.js"() {
14957
14995
  "use strict";
14996
+ init_chunk_GK27ENTT();
14958
14997
  init_chunk_SXDX4GHS();
14959
14998
  init_chunk_HENF6YTF();
14960
14999
  init_chunk_VXEAR36B();
@@ -14962,8 +15001,6 @@ var init_contracts = __esm({
14962
15001
  init_chunk_Q7KIQHAZ();
14963
15002
  init_chunk_WBFLPPDI();
14964
15003
  init_chunk_IPXBFWUU();
14965
- init_chunk_GK27ENTT();
14966
- init_chunk_IPDOHAZ5();
14967
15004
  init_chunk_GPM7PE44();
14968
15005
  init_chunk_DGKMMFIR();
14969
15006
  init_chunk_ZC6YGHNX();
@@ -14972,40 +15009,39 @@ var init_contracts = __esm({
14972
15009
  init_chunk_Y7CFCYX4();
14973
15010
  init_chunk_5DGHIY7L();
14974
15011
  init_chunk_4QBKRQMM();
14975
- init_chunk_4MRBBR5L();
15012
+ init_chunk_OWAAYKPB();
14976
15013
  init_chunk_BEOHBREG();
14977
- init_chunk_SY6PLCPK();
15014
+ init_chunk_IPDOHAZ5();
14978
15015
  init_chunk_YUZFHVB2();
14979
15016
  init_chunk_I3O2RACG();
14980
15017
  init_chunk_34LE6P7E();
14981
15018
  init_chunk_FPSDNS2E();
14982
- init_chunk_LKBSHANA();
14983
- init_chunk_23ESQLLF();
15019
+ init_chunk_C4TPQN6Z();
14984
15020
  init_chunk_C4HEZ7ZI();
14985
15021
  init_chunk_IR2NOSI3();
14986
15022
  init_chunk_EA23LSDS();
14987
- init_chunk_V4FRPRH5();
15023
+ init_chunk_SY6PLCPK();
14988
15024
  init_chunk_LWMLR2WI();
14989
15025
  init_chunk_ACGAI25T();
14990
15026
  init_chunk_MH4O3YEX();
14991
- init_chunk_6GBBTCME();
15027
+ init_chunk_XR36MYEY();
14992
15028
  init_chunk_KSTYTQ7I();
14993
- init_chunk_7CYHPF35();
15029
+ init_chunk_LKBSHANA();
14994
15030
  init_chunk_BPCNB5RT();
14995
- init_chunk_SCZ3GSJE();
15031
+ init_chunk_FJ5K57CB();
14996
15032
  init_chunk_4S4FBSBE();
14997
- init_chunk_6UKJ6EMZ();
15033
+ init_chunk_RCTKQTJH();
14998
15034
  init_chunk_JDJ4EUOL();
14999
15035
  init_chunk_3KYTITOR();
15000
15036
  init_chunk_XCDUP42J();
15001
15037
  init_chunk_6J742GLA();
15002
15038
  init_chunk_ZVXO3XL6();
15003
15039
  init_chunk_YULHXJ5M();
15004
- init_chunk_UEJOG2Q7();
15040
+ init_chunk_V4FRPRH5();
15005
15041
  init_chunk_ZHJEQBXJ();
15006
- init_chunk_EHPGISOL();
15042
+ init_chunk_EA6XOOL2();
15007
15043
  init_chunk_LQY2OCQL();
15008
- init_chunk_DIBRGYL6();
15044
+ init_chunk_2LZYS6YX();
15009
15045
  init_chunk_3HSB6J4J();
15010
15046
  init_chunk_IG6QBZMA();
15011
15047
  init_chunk_ZJJ5ODOD();
@@ -15013,29 +15049,31 @@ var init_contracts = __esm({
15013
15049
  init_chunk_LBDH7LCG();
15014
15050
  init_chunk_4LXDRTO4();
15015
15051
  init_chunk_E4DIIOOE();
15016
- init_chunk_23UZ2IKU();
15052
+ init_chunk_7CYHPF35();
15053
+ init_chunk_VMAX5YRT();
15017
15054
  init_chunk_MCSEEMGN();
15018
15055
  init_chunk_UFYIBL66();
15019
15056
  init_chunk_NVKU5PPQ();
15020
- init_chunk_2FCLSQSQ();
15057
+ init_chunk_3ACHWKFV();
15021
15058
  init_chunk_FECLIZTY();
15022
15059
  init_chunk_BFG4ZWR4();
15023
- init_chunk_WO37XYVD();
15060
+ init_chunk_6QXCHNFQ();
15024
15061
  init_chunk_T4Q5COKJ();
15025
15062
  init_chunk_3VHMUK4W();
15026
15063
  init_chunk_AMG6HKUQ();
15027
15064
  init_chunk_ACN6GXU6();
15028
15065
  init_chunk_OMPT4ZHR();
15029
15066
  init_chunk_2PZIF56U();
15067
+ init_chunk_UEJOG2Q7();
15030
15068
  init_chunk_KJXJKAYT();
15031
15069
  init_chunk_SOJMWM63();
15032
15070
  init_chunk_WEXVYJ5H();
15033
- init_chunk_C5MU3WEM();
15071
+ init_chunk_6Y7XMRWF();
15034
15072
  init_chunk_5XEJSR22();
15035
15073
  init_chunk_IBL7FANV();
15036
- init_chunk_Y3S4XX4K();
15037
- init_chunk_A4JC7DXB();
15074
+ init_chunk_Z22T2ASG();
15038
15075
  init_chunk_VORPHGDT();
15076
+ init_chunk_A4JC7DXB();
15039
15077
  init_chunk_HZ6CADSY();
15040
15078
  init_chunk_MIWZOSPI();
15041
15079
  init_chunk_2ISUBJG7();
@@ -15935,6 +15973,10 @@ var init_api_client = __esm({
15935
15973
  `/api/admin/data-explorer/debug/do/${doType}/${encodeURIComponent(doId)}/tables/${encodeURIComponent(table)}/rows${qs}`
15936
15974
  );
15937
15975
  }
15976
+ /** A hub's or an organization's knowledge as numbers: the admin census's counts (no text). */
15977
+ async debugCounts(doType, doId) {
15978
+ return this.request("GET", `/api/admin/data-explorer/debug/do/${doType}/${encodeURIComponent(doId)}/counts`);
15979
+ }
15938
15980
  async debugListAnalyticsTables() {
15939
15981
  return this.request("GET", "/api/admin/data-explorer/debug/analytics/tables");
15940
15982
  }
@@ -16359,13 +16401,13 @@ var init_dist = __esm({
16359
16401
  init_chunk_KJXJKAYT();
16360
16402
  init_chunk_SOJMWM63();
16361
16403
  init_chunk_WEXVYJ5H();
16362
- init_chunk_C5MU3WEM();
16404
+ init_chunk_6Y7XMRWF();
16363
16405
  init_chunk_5XEJSR22();
16364
16406
  init_chunk_IBL7FANV();
16365
- init_chunk_Y3S4XX4K();
16366
- init_chunk_A4JC7DXB();
16407
+ init_chunk_Z22T2ASG();
16367
16408
  init_chunk_P3AWZG3N();
16368
16409
  init_chunk_VORPHGDT();
16410
+ init_chunk_A4JC7DXB();
16369
16411
  init_chunk_HZ6CADSY();
16370
16412
  init_chunk_MIWZOSPI();
16371
16413
  init_chunk_ERFR7IRY();
@@ -17754,6 +17796,7 @@ var init_utils = __esm({
17754
17796
  ["admin observability", { positionals: 2, values: ["--message-id"] }],
17755
17797
  ["admin do tables", { positionals: 2 }],
17756
17798
  ["admin do read", { positionals: 3, values: ["--limit", "--id"] }],
17799
+ ["admin do counts", { positionals: 2 }],
17757
17800
  ["admin analytics tables", { positionals: 0 }],
17758
17801
  ["admin analytics read", { positionals: 1, values: ["--limit", "--conversation-id", "--hub-id", "--message-id"] }],
17759
17802
  ["admin report list", { positionals: 0, values: ["--status", "--source", "--limit", "--offset", "--since", "--resolved-since"] }],
@@ -33551,7 +33594,7 @@ token (\`wayai login --token\`, or WAYAI_TOKEN) is refused.
33551
33594
  var init_rekor_toolset = __esm({
33552
33595
  "../../packages/core/dist/contracts/rekor-toolset.js"() {
33553
33596
  "use strict";
33554
- init_chunk_4MRBBR5L();
33597
+ init_chunk_OWAAYKPB();
33555
33598
  init_chunk_BEOHBREG();
33556
33599
  init_chunk_DHPUPI4Y();
33557
33600
  }
@@ -35422,7 +35465,7 @@ var COUNTER_KEYS, STT_PRICING, CONTAINER_PRICING, connectorById, nativeToolById;
35422
35465
  var init_catalog = __esm({
35423
35466
  "../../packages/core/dist/catalog/index.js"() {
35424
35467
  "use strict";
35425
- init_chunk_23UZ2IKU();
35468
+ init_chunk_VMAX5YRT();
35426
35469
  init_chunk_MCSEEMGN();
35427
35470
  init_chunk_UFYIBL66();
35428
35471
  init_chunk_A4JC7DXB();
@@ -36131,6 +36174,9 @@ async function adminCommand(args2) {
36131
36174
  case "read":
36132
36175
  await runDoRead(positional, flagArgs);
36133
36176
  return;
36177
+ case "counts":
36178
+ await runDoCounts(positional, flagArgs);
36179
+ return;
36134
36180
  default:
36135
36181
  printHelp2();
36136
36182
  process.exit(1);
@@ -36461,6 +36507,32 @@ async function runDoRead(positional, flagArgs) {
36461
36507
  }
36462
36508
  printDebugRowsResult(response.data, jsonOutput);
36463
36509
  }
36510
+ async function runDoCounts(positional, flagArgs) {
36511
+ const type = dataExplorerDebugCountsDoType.safeParse(positional[0]);
36512
+ if (positional.length < 2 || !type.success) {
36513
+ console.error(`wayai admin do counts <${dataExplorerDebugCountsDoType.options.join("|")}> <id> [--json]`);
36514
+ process.exit(1);
36515
+ }
36516
+ const { jsonOutput } = parseFlags2(flagArgs, ["--json"]);
36517
+ const { config, accessToken } = await requireAuth();
36518
+ const client = new ApiClient({ apiUrl: config.api_url, accessToken });
36519
+ let response;
36520
+ try {
36521
+ response = await client.debugCounts(type.data, positional[1]);
36522
+ } catch (err) {
36523
+ exitOnApiError(err);
36524
+ throw err;
36525
+ }
36526
+ if (jsonOutput) {
36527
+ console.log(JSON.stringify(response.data, null, 2));
36528
+ return;
36529
+ }
36530
+ for (const line of flattenCounts(response.data)) console.log(line);
36531
+ }
36532
+ function flattenCounts(value, prefix = "") {
36533
+ if (value === null || typeof value !== "object") return [`${prefix}: ${value === null ? "\u2014" : String(value)}`];
36534
+ return Object.entries(value).flatMap(([key, child]) => flattenCounts(child, prefix ? `${prefix}.${key}` : key));
36535
+ }
36464
36536
  async function runAnalyticsTables() {
36465
36537
  const { config, accessToken } = await requireAuth();
36466
36538
  const client = new ApiClient({ apiUrl: config.api_url, accessToken });
@@ -37824,6 +37896,9 @@ wayai admin \u2014 platform-admin diagnostic commands
37824
37896
  Usage:
37825
37897
  wayai admin do tables <type> <id>
37826
37898
  wayai admin do read <type> <id> <table> [--limit N] [--id X] [--json]
37899
+ wayai admin do counts <hub|org> <id> [--json] Knowledge as numbers, no text: a hub's knowledge rows, links, toolset connections,
37900
+ knowledge placeholders per stored text and (production) publish state; an org's
37901
+ resources and moved-knowledge registry
37827
37902
 
37828
37903
  wayai admin analytics tables
37829
37904
  wayai admin analytics read <table> [--conversation-id X] [--hub-id Y] [--message-id Z] [--limit N] [--json]
@@ -38965,8 +39040,10 @@ Stopped at chunk ${nextIndex}. To resume, re-run the SAME command with:
38965
39040
  if (n === 0) {
38966
39041
  console.error("No rows left to undo \u2014 closing the import session.");
38967
39042
  } else {
39043
+ const reviewed = await recordTypeIsReviewed(client, base, plan.record_type);
39044
+ const count = `${reviewed ? "up to " : ""}${n} record${n === 1 ? "" : "s"}`;
38968
39045
  const ok = await confirm(
38969
- `Delete ${n} record${n === 1 ? "" : "s"} created by this import into "${sanitizeTerminalText(String(plan.record_type))}", plus every relationship pointing at them?`
39046
+ `Delete ${count} created by this import into "${sanitizeTerminalText(String(plan.record_type))}"${reviewed ? " (those approved now stay unless you are signed in to WayAI as a person)" : ""}, plus every relationship pointing at them?`
38970
39047
  );
38971
39048
  if (!ok) {
38972
39049
  console.error("Aborted.");
@@ -38976,6 +39053,7 @@ Stopped at chunk ${nextIndex}. To resume, re-run the SAME command with:
38976
39053
  }
38977
39054
  let records = 0;
38978
39055
  let relationships = 0;
39056
+ let kept = 0;
38979
39057
  let calls = 0;
38980
39058
  let incomplete = false;
38981
39059
  for (let sweep = 0; ; sweep++) {
@@ -38987,7 +39065,10 @@ Stopped at chunk ${nextIndex}. To resume, re-run the SAME command with:
38987
39065
  records += res.swept.records;
38988
39066
  relationships += res.swept.relationships;
38989
39067
  calls++;
38990
- if (res.complete) break;
39068
+ if (res.complete) {
39069
+ kept = res.kept?.records ?? 0;
39070
+ break;
39071
+ }
38991
39072
  const sweptNothing = res.swept.records === 0 && res.swept.relationships === 0;
38992
39073
  if (sweptNothing || sweep + 1 >= MAX_ROLLBACK_SWEEPS) {
38993
39074
  incomplete = true;
@@ -39005,10 +39086,16 @@ Stopped at chunk ${nextIndex}. To resume, re-run the SAME command with:
39005
39086
  "Note: a request was re-sent after its outcome was unknown, so the counts below are a lower bound \u2014 a page that committed before its response was lost is not included."
39006
39087
  );
39007
39088
  }
39089
+ if (kept > 0) {
39090
+ console.error(
39091
+ `Kept ${kept} record${kept === 1 ? "" : "s"} of this import that ${kept === 1 ? "is" : "are"} approved: only a person signed in to WayAI removes an approved record. A rollback of this import by one removes them.`
39092
+ );
39093
+ }
39008
39094
  printOutput(
39009
39095
  {
39010
39096
  import_id: importId,
39011
39097
  swept: { records, relationships },
39098
+ ...kept > 0 ? { kept: { records: kept } } : {},
39012
39099
  requests: calls,
39013
39100
  // The server's own completion claim, carried so a script can tell an
39014
39101
  // undo that FINISHED from one that stopped early and needs re-running.
@@ -39021,10 +39108,23 @@ Stopped at chunk ${nextIndex}. To resume, re-run the SAME command with:
39021
39108
  });
39022
39109
  return importCmd;
39023
39110
  }
39111
+ async function recordTypeIsReviewed(client, base, recordType2) {
39112
+ if (recordType2 === null) return false;
39113
+ try {
39114
+ const type = await client.request(
39115
+ "GET",
39116
+ `/v1/${base}/record-types/${pathSegment(recordType2, "record_type")}`
39117
+ );
39118
+ return declaresReview(type?.json_schema);
39119
+ } catch {
39120
+ return true;
39121
+ }
39122
+ }
39024
39123
  var MAX_CHUNK_ROWS, MAX_ATTEMPTS, MAX_ROLLBACK_SWEEPS, BASE_BACKOFF_MS, RETRYABLE_CODES, sleep2;
39025
39124
  var init_import = __esm({
39026
39125
  "src/data/commands/import.ts"() {
39027
39126
  "use strict";
39127
+ init_rekor_toolset();
39028
39128
  init_client();
39029
39129
  init_output();
39030
39130
  init_helpers();