@wayai/cli 0.3.368 → 0.3.369

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
@@ -239,8 +239,8 @@ var init_mask_secrets = __esm({
239
239
  FULLY_MASKED_VALUE_RE = /^(?:(?:Bearer|Basic)\s+)?(?:way_|wst_|rec_)?\[REDACTED(?:_JWT|_BASE64)?\]$/;
240
240
  isCredentialKey = (key) => CREDENTIAL_KEY_RE.test(key);
241
241
  isBase64UrlChar = (char) => {
242
- const code2 = char.charCodeAt(0);
243
- return code2 >= 48 && code2 <= 57 || code2 >= 65 && code2 <= 90 || code2 >= 97 && code2 <= 122 || char === "-" || char === "_";
242
+ const code3 = char.charCodeAt(0);
243
+ return code3 >= 48 && code3 <= 57 || code3 >= 65 && code3 <= 90 || code3 >= 97 && code3 <= 122 || char === "-" || char === "_";
244
244
  };
245
245
  SHAPE_PATTERNS = [
246
246
  // way_ scoped API tokens (keyring/CI credentials). Leading \b avoids
@@ -328,16 +328,16 @@ var init_mask_secrets = __esm({
328
328
  // src/lib/network-error.ts
329
329
  function errorCode(value) {
330
330
  if (value && typeof value === "object" && "code" in value) {
331
- const code2 = value.code;
332
- if (typeof code2 === "string") return code2;
331
+ const code3 = value.code;
332
+ if (typeof code3 === "string") return code3;
333
333
  }
334
334
  return void 0;
335
335
  }
336
336
  function isNetworkError(err) {
337
337
  if (err instanceof TypeError && err.message === "fetch failed") return true;
338
338
  if (!err || typeof err !== "object") return false;
339
- const code2 = errorCode(err) ?? errorCode(err.cause);
340
- return code2 !== void 0 && NETWORK_ERROR_CODES.has(code2);
339
+ const code3 = errorCode(err) ?? errorCode(err.cause);
340
+ return code3 !== void 0 && NETWORK_ERROR_CODES.has(code3);
341
341
  }
342
342
  var NETWORK_ERROR_CODES;
343
343
  var init_network_error = __esm({
@@ -588,9 +588,9 @@ var init_chunk_ICYO56QW = __esm({
588
588
  init_chunk_WFQDSQJK();
589
589
  APP_ERROR_BRAND = /* @__PURE__ */ Symbol.for("wayai.AppError");
590
590
  AppError = class extends Error {
591
- constructor(message, code2, statusCode = 500, details) {
591
+ constructor(message, code3, statusCode = 500, details) {
592
592
  super(message);
593
- this.code = code2;
593
+ this.code = code3;
594
594
  this.statusCode = statusCode;
595
595
  this.details = details;
596
596
  this.name = "AppError";
@@ -5113,6 +5113,19 @@ var init_fs_safety = __esm({
5113
5113
  }
5114
5114
  });
5115
5115
 
5116
+ // ../../packages/core/dist/chunk-AYLAGFAD.js
5117
+ var BASE_CREDENTIAL_NAME_MAX, BASE_CREDENTIAL_NAME_PATTERN, BASE_CREDENTIAL_NAME_CHARSET, baseCredentialNameSchema;
5118
+ var init_chunk_AYLAGFAD = __esm({
5119
+ "../../packages/core/dist/chunk-AYLAGFAD.js"() {
5120
+ "use strict";
5121
+ init_zod();
5122
+ BASE_CREDENTIAL_NAME_MAX = 100;
5123
+ BASE_CREDENTIAL_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:@+~=-]*$/;
5124
+ BASE_CREDENTIAL_NAME_CHARSET = "letters, digits and '. _ : @ + ~ = -', starting with a letter or digit";
5125
+ baseCredentialNameSchema = external_exports.string().min(1).max(BASE_CREDENTIAL_NAME_MAX).regex(BASE_CREDENTIAL_NAME_PATTERN, `name must use ${BASE_CREDENTIAL_NAME_CHARSET}`);
5126
+ }
5127
+ });
5128
+
5116
5129
  // ../../packages/core/dist/chunk-MIWZOSPI.js
5117
5130
  function toIso(epochMs) {
5118
5131
  return new Date(epochMs).toISOString();
@@ -6326,19 +6339,6 @@ var init_chunk_63UWXV4T = __esm({
6326
6339
  }
6327
6340
  });
6328
6341
 
6329
- // ../../packages/core/dist/chunk-AYLAGFAD.js
6330
- var BASE_CREDENTIAL_NAME_MAX, BASE_CREDENTIAL_NAME_PATTERN, BASE_CREDENTIAL_NAME_CHARSET, baseCredentialNameSchema;
6331
- var init_chunk_AYLAGFAD = __esm({
6332
- "../../packages/core/dist/chunk-AYLAGFAD.js"() {
6333
- "use strict";
6334
- init_zod();
6335
- BASE_CREDENTIAL_NAME_MAX = 100;
6336
- BASE_CREDENTIAL_NAME_PATTERN = /^[A-Za-z0-9][A-Za-z0-9._:@+~=-]*$/;
6337
- BASE_CREDENTIAL_NAME_CHARSET = "letters, digits and '. _ : @ + ~ = -', starting with a letter or digit";
6338
- baseCredentialNameSchema = external_exports.string().min(1).max(BASE_CREDENTIAL_NAME_MAX).regex(BASE_CREDENTIAL_NAME_PATTERN, `name must use ${BASE_CREDENTIAL_NAME_CHARSET}`);
6339
- }
6340
- });
6341
-
6342
6342
  // ../../packages/core/dist/chunk-ZC6YGHNX.js
6343
6343
  var updateUserBody, updateProfileBody, pathnameRegex, updatePreferencesBody, registerPushTokenBody, deletePushTokenQuery, recordAiDisclosureAcceptanceBody, activityQuery, deletionModeSchema, deletionRequestBody;
6344
6344
  var init_chunk_ZC6YGHNX = __esm({
@@ -6809,6 +6809,34 @@ var init_chunk_ZVXO3XL6 = __esm({
6809
6809
  }
6810
6810
  });
6811
6811
 
6812
+ // ../../packages/core/dist/chunk-ZXK6N2HN.js
6813
+ var PEOPLE_MODERATION_NOTE_MAX_LENGTH, ADMIN_PEOPLE_REPORTS_PAGE_MAX, ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT, PEOPLE_SUSPENDED_REASON, peopleModerationActionSchema, moderationNoteSchema, adminPeopleReportListQuery, adminPeopleReportIdParam, adminPeopleMessageRemovalBody, adminPeopleSuspendBody, adminPeopleNoteBody;
6814
+ var init_chunk_ZXK6N2HN = __esm({
6815
+ "../../packages/core/dist/chunk-ZXK6N2HN.js"() {
6816
+ "use strict";
6817
+ init_chunk_ZVXO3XL6();
6818
+ init_chunk_HZ6CADSY();
6819
+ init_zod();
6820
+ PEOPLE_MODERATION_NOTE_MAX_LENGTH = 500;
6821
+ ADMIN_PEOPLE_REPORTS_PAGE_MAX = 100;
6822
+ ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT = 50;
6823
+ PEOPLE_SUSPENDED_REASON = "suspended";
6824
+ peopleModerationActionSchema = external_exports.enum(["remove_message", "suspend", "unsuspend", "dismiss"]);
6825
+ moderationNoteSchema = optionalTrimmedText(PEOPLE_MODERATION_NOTE_MAX_LENGTH);
6826
+ adminPeopleReportListQuery = external_exports.object({
6827
+ pending: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true"),
6828
+ /** Lower bound on `created_at`. */
6829
+ since: timestampSchema.optional(),
6830
+ limit: external_exports.coerce.number().int().min(1).max(ADMIN_PEOPLE_REPORTS_PAGE_MAX).default(ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT),
6831
+ offset: external_exports.coerce.number().int().min(0).default(0)
6832
+ });
6833
+ adminPeopleReportIdParam = external_exports.object({ reportId: uuidSchema });
6834
+ adminPeopleMessageRemovalBody = external_exports.object({ report_id: uuidSchema, message_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
6835
+ adminPeopleSuspendBody = external_exports.object({ report_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
6836
+ adminPeopleNoteBody = external_exports.object({ note: moderationNoteSchema }).strict();
6837
+ }
6838
+ });
6839
+
6812
6840
  // ../../packages/core/dist/chunk-Y7CFCYX4.js
6813
6841
  var PEOPLE_REPORT_DETAILS_MAX_LENGTH, peopleReportReasonSchema, reportDetailsSchema, reportFields, peopleReportBody;
6814
6842
  var init_chunk_Y7CFCYX4 = __esm({
@@ -7792,6 +7820,20 @@ var init_chunk_2IPHTFV5 = __esm({
7792
7820
  }
7793
7821
  });
7794
7822
 
7823
+ // ../../packages/core/dist/chunk-I3O2RACG.js
7824
+ var managedAgentsWebhookParams, MANAGED_AGENTS_WEBHOOK_BODY_MAX_BYTES;
7825
+ var init_chunk_I3O2RACG = __esm({
7826
+ "../../packages/core/dist/chunk-I3O2RACG.js"() {
7827
+ "use strict";
7828
+ init_zod();
7829
+ managedAgentsWebhookParams = external_exports.object({
7830
+ hub_id: external_exports.string().uuid(),
7831
+ connection_id: external_exports.string().uuid()
7832
+ });
7833
+ MANAGED_AGENTS_WEBHOOK_BODY_MAX_BYTES = 16 * 1024;
7834
+ }
7835
+ });
7836
+
7795
7837
  // ../../packages/core/dist/chunk-6J742GLA.js
7796
7838
  var PEOPLE_THREAD_MESSAGE_MAX_LENGTH, PEOPLE_THREAD_MESSAGES_PAGE_MAX, PEOPLE_THREAD_PAGE_MAX, PEOPLE_THREAD_PAGE_DEFAULT, PEOPLE_GROUP_NAME_MAX_LENGTH, PEOPLE_GROUP_AVATAR_URL_MAX_LENGTH, PEOPLE_THREAD_ATTACHMENT_MAX_BYTES, PEOPLE_THREAD_ATTACHMENT_NAME_MAX_LENGTH, PEOPLE_ATTACHMENT_STORAGE_PER_USER_BYTES, PEOPLE_THREAD_ATTACHMENT_MAX_MB, PEOPLE_THREAD_ATTACHMENT_URL_TTL_SECONDS, PEOPLE_THREAD_ATTACHMENT_URLS_MAX, peopleThreadIdParam, peopleThreadMessageIdParam, peopleThreadListQuery, peopleThreadMessagesQuery, peopleThreadAttachmentUploadSchema, peopleThreadSendBody, peopleThreadAttachmentUrlsBody, peopleThreadReadBody, peopleThreadSettingsBody, peopleGroupNameSchema, peopleGroupAvatarUrlSchema, peopleGroupCreateBody, peopleOrgDirectBody, peopleGroupUpdateBody, peopleGroupInviteBody, peopleOrgErasureBody, peopleGroupLeaveBody, peopleGroupInviteIdParam, peopleGroupIncomingInviteIdParam, peopleGroupMemberParam, peopleThreadKindSchema, peopleThreadMemberSchema, peopleThreadLastMessageSchema, peopleGroupRoleSchema, peopleGroupSummarySchema, peopleThreadSummarySchema, peopleThreadAttachmentSchema, peopleThreadMessageSchema, peopleGroupMemberSchema, peopleGroupSentInviteSchema, peopleGroupIncomingInviteSchema;
7797
7839
  var init_chunk_6J742GLA = __esm({
@@ -8450,10 +8492,10 @@ var init_chunk_WEXVYJ5H = __esm({
8450
8492
  function utf8ByteLength(text5) {
8451
8493
  let bytes = 0;
8452
8494
  for (let i = 0; i < text5.length; i++) {
8453
- const code2 = text5.charCodeAt(i);
8454
- if (code2 < 128) bytes += 1;
8455
- else if (code2 < 2048) bytes += 2;
8456
- else if (code2 >= 55296 && code2 <= 56319 && i + 1 < text5.length) {
8495
+ const code3 = text5.charCodeAt(i);
8496
+ if (code3 < 128) bytes += 1;
8497
+ else if (code3 < 2048) bytes += 2;
8498
+ else if (code3 >= 55296 && code3 <= 56319 && i + 1 < text5.length) {
8457
8499
  const next = text5.charCodeAt(i + 1);
8458
8500
  if (next >= 56320 && next <= 57343) {
8459
8501
  bytes += 4;
@@ -8635,31 +8677,58 @@ var init_chunk_TZH6DKKJ = __esm({
8635
8677
  }
8636
8678
  });
8637
8679
 
8638
- // ../../packages/core/dist/chunk-ZXK6N2HN.js
8639
- var PEOPLE_MODERATION_NOTE_MAX_LENGTH, ADMIN_PEOPLE_REPORTS_PAGE_MAX, ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT, PEOPLE_SUSPENDED_REASON, peopleModerationActionSchema, moderationNoteSchema, adminPeopleReportListQuery, adminPeopleReportIdParam, adminPeopleMessageRemovalBody, adminPeopleSuspendBody, adminPeopleNoteBody;
8640
- var init_chunk_ZXK6N2HN = __esm({
8641
- "../../packages/core/dist/chunk-ZXK6N2HN.js"() {
8680
+ // ../../packages/core/dist/chunk-SY6PLCPK.js
8681
+ var jsonSchemaSchema, hubUserIdentity, stateValueEntry, getHubUserContextResponse, updateHubUserBody, updateHubUserResponse, unlockHubUserNameResponse, stateResetParams, stateResetResponse;
8682
+ var init_chunk_SY6PLCPK = __esm({
8683
+ "../../packages/core/dist/chunk-SY6PLCPK.js"() {
8642
8684
  "use strict";
8643
- init_chunk_ZVXO3XL6();
8644
- init_chunk_HZ6CADSY();
8685
+ init_chunk_6TSQ5HXC();
8645
8686
  init_zod();
8646
- PEOPLE_MODERATION_NOTE_MAX_LENGTH = 500;
8647
- ADMIN_PEOPLE_REPORTS_PAGE_MAX = 100;
8648
- ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT = 50;
8649
- PEOPLE_SUSPENDED_REASON = "suspended";
8650
- peopleModerationActionSchema = external_exports.enum(["remove_message", "suspend", "unsuspend", "dismiss"]);
8651
- moderationNoteSchema = optionalTrimmedText(PEOPLE_MODERATION_NOTE_MAX_LENGTH);
8652
- adminPeopleReportListQuery = external_exports.object({
8653
- pending: external_exports.enum(["true", "false"]).optional().transform((value) => value === "true"),
8654
- /** Lower bound on `created_at`. */
8655
- since: timestampSchema.optional(),
8656
- limit: external_exports.coerce.number().int().min(1).max(ADMIN_PEOPLE_REPORTS_PAGE_MAX).default(ADMIN_PEOPLE_REPORTS_PAGE_DEFAULT),
8657
- offset: external_exports.coerce.number().int().min(0).default(0)
8687
+ jsonSchemaSchema = external_exports.record(external_exports.unknown());
8688
+ hubUserIdentity = external_exports.object({
8689
+ user_id: external_exports.string().nullable(),
8690
+ user_name: external_exports.string().nullable(),
8691
+ user_email: external_exports.string().nullable(),
8692
+ user_name_locked: external_exports.boolean(),
8693
+ created_at: external_exports.string(),
8694
+ updated_at: external_exports.string().nullable(),
8695
+ hub_user_id: external_exports.string().optional(),
8696
+ enabled: external_exports.boolean().optional(),
8697
+ hub_team_id: external_exports.string().nullable().optional(),
8698
+ source: external_exports.enum(["grant", "auto"]).optional()
8699
+ });
8700
+ stateValueEntry = external_exports.object({
8701
+ state_slug: external_exports.string(),
8702
+ state_name: external_exports.string(),
8703
+ state_description: external_exports.string().nullable().optional(),
8704
+ scope: external_exports.enum(["user", "conversation"]),
8705
+ json_schema: jsonSchemaSchema,
8706
+ initial_value: external_exports.unknown(),
8707
+ value: external_exports.unknown(),
8708
+ is_reserved: external_exports.boolean()
8709
+ });
8710
+ getHubUserContextResponse = external_exports.object({
8711
+ user: hubUserIdentity,
8712
+ user_states: external_exports.array(stateValueEntry),
8713
+ conversation_states: external_exports.array(stateValueEntry)
8714
+ });
8715
+ updateHubUserBody = external_exports.object({
8716
+ // Non-empty, non-null. `.nullable()` here would bypass `.min(1)` and let an
8717
+ // admin arm the lock on a null name — see hub-do.ts updateHubUser null-guard.
8718
+ user_name: external_exports.string().min(1).max(120)
8719
+ });
8720
+ updateHubUserResponse = external_exports.object({
8721
+ user: hubUserIdentity
8722
+ });
8723
+ unlockHubUserNameResponse = external_exports.object({
8724
+ user: hubUserIdentity
8725
+ });
8726
+ stateResetParams = external_exports.object({
8727
+ stateSlug: slugSchema
8728
+ });
8729
+ stateResetResponse = external_exports.object({
8730
+ ok: external_exports.literal(true)
8658
8731
  });
8659
- adminPeopleReportIdParam = external_exports.object({ reportId: uuidSchema });
8660
- adminPeopleMessageRemovalBody = external_exports.object({ report_id: uuidSchema, message_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
8661
- adminPeopleSuspendBody = external_exports.object({ report_id: uuidSchema.optional(), note: moderationNoteSchema }).strict();
8662
- adminPeopleNoteBody = external_exports.object({ note: moderationNoteSchema }).strict();
8663
8732
  }
8664
8733
  });
8665
8734
 
@@ -9056,17 +9125,98 @@ var init_chunk_YUZFHVB2 = __esm({
9056
9125
  }
9057
9126
  });
9058
9127
 
9059
- // ../../packages/core/dist/chunk-I3O2RACG.js
9060
- var managedAgentsWebhookParams, MANAGED_AGENTS_WEBHOOK_BODY_MAX_BYTES;
9061
- var init_chunk_I3O2RACG = __esm({
9062
- "../../packages/core/dist/chunk-I3O2RACG.js"() {
9128
+ // ../../packages/core/dist/chunk-LKBSHANA.js
9129
+ 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;
9130
+ var init_chunk_LKBSHANA = __esm({
9131
+ "../../packages/core/dist/chunk-LKBSHANA.js"() {
9063
9132
  "use strict";
9064
9133
  init_zod();
9065
- managedAgentsWebhookParams = external_exports.object({
9066
- hub_id: external_exports.string().uuid(),
9067
- connection_id: external_exports.string().uuid()
9134
+ 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})?$/;
9135
+ DESKTOP_PLATFORMS = ["darwin", "win32"];
9136
+ DESKTOP_FLAVORS = ["production", "development"];
9137
+ desktopShellInfoSchema = external_exports.object({
9138
+ /** The shell's own release version, independent of the web deploy. */
9139
+ shellVersion: external_exports.string().regex(DESKTOP_SHELL_VERSION_RE),
9140
+ /** The Electron runtime the shell was built with. */
9141
+ electronVersion: external_exports.string().regex(/^\d{1,4}\.\d{1,4}\.\d{1,4}(-[0-9A-Za-z.-]{1,32})?$/),
9142
+ platform: external_exports.enum(DESKTOP_PLATFORMS),
9143
+ /** CPU architecture as Node reports it (`arm64`, `x64`). */
9144
+ arch: external_exports.string().regex(/^[a-z0-9_]{1,16}$/),
9145
+ flavor: external_exports.enum(DESKTOP_FLAVORS),
9146
+ /**
9147
+ * Present, and true, when the shell runs from the Microsoft Store's package: the Store updates it,
9148
+ * and Windows alone opens it at login (the package's startup task, which the person turns on in
9149
+ * Windows' settings). An optional field, so no new `bridgeVersion`: an older page ignores it, and
9150
+ * its absence is every other shell.
9151
+ */
9152
+ store: external_exports.literal(true).optional()
9068
9153
  });
9069
- MANAGED_AGENTS_WEBHOOK_BODY_MAX_BYTES = 16 * 1024;
9154
+ DESKTOP_PRESENCE_STATES = ["present", "away"];
9155
+ desktopPresenceSchema = external_exports.object({
9156
+ presence: external_exports.enum(DESKTOP_PRESENCE_STATES),
9157
+ mainWindow: external_exports.object({
9158
+ shown: external_exports.boolean(),
9159
+ focused: external_exports.boolean()
9160
+ })
9161
+ });
9162
+ desktopUpdateSchema = external_exports.object({
9163
+ ready: external_exports.object({
9164
+ version: external_exports.string().regex(DESKTOP_SHELL_VERSION_RE),
9165
+ offerRestart: external_exports.boolean()
9166
+ }).nullable()
9167
+ });
9168
+ DESKTOP_SIGN_IN_URL_MAX_LENGTH = 4096;
9169
+ DESKTOP_APP_PATH_MAX_LENGTH = 512;
9170
+ desktopAppPathSchema = external_exports.string().max(DESKTOP_APP_PATH_MAX_LENGTH).regex(/^\/(?![/\\])[^\s\\]*$/);
9171
+ DESKTOP_NOTIFICATION_KINDS = ["handoff", "message", "summary"];
9172
+ DESKTOP_NOTIFICATION_TITLE_MAX_LENGTH = 200;
9173
+ DESKTOP_NOTIFICATION_BODY_MAX_LENGTH = 500;
9174
+ notificationTitleSchema = external_exports.string().min(1).max(DESKTOP_NOTIFICATION_TITLE_MAX_LENGTH);
9175
+ notificationBodySchema = external_exports.string().max(DESKTOP_NOTIFICATION_BODY_MAX_LENGTH);
9176
+ desktopNotificationSchema = external_exports.object({
9177
+ kind: external_exports.enum(DESKTOP_NOTIFICATION_KINDS),
9178
+ title: notificationTitleSchema,
9179
+ body: notificationBodySchema,
9180
+ path: desktopAppPathSchema,
9181
+ withoutPreview: external_exports.object({ title: notificationTitleSchema, body: notificationBodySchema }).optional()
9182
+ });
9183
+ DESKTOP_BADGE_MAX_COUNT = 1e6;
9184
+ DESKTOP_BADGE_LABEL_MAX_LENGTH = 200;
9185
+ desktopBadgeSchema = external_exports.object({
9186
+ count: external_exports.number().int().min(0).max(DESKTOP_BADGE_MAX_COUNT),
9187
+ label: external_exports.string().max(DESKTOP_BADGE_LABEL_MAX_LENGTH)
9188
+ });
9189
+ desktopNavigateSchema = external_exports.object({
9190
+ path: desktopAppPathSchema
9191
+ });
9192
+ desktopSettingsSchema = external_exports.object({
9193
+ /** The app opens when the person logs in to the computer: the operating system's own login item. */
9194
+ openAtLogin: external_exports.boolean(),
9195
+ /** Closing the window keeps the app running in the tray (true), or quits it (false). */
9196
+ closeToTray: external_exports.boolean(),
9197
+ /** The shell shows notifications (true), or none (false). The badge is not a notification. */
9198
+ notifications: external_exports.boolean(),
9199
+ /**
9200
+ * A customer message's notification shows the customer's name and words, where the platform
9201
+ * allows them at all (`desktopShowsCustomerWords`: macOS); elsewhere the shell never shows them.
9202
+ */
9203
+ messagePreview: external_exports.boolean()
9204
+ });
9205
+ desktopSettingsChangeSchema = desktopSettingsSchema.partial().strict().refine((change) => Object.values(change).every((value) => typeof value === "boolean"), {
9206
+ message: "each setting changed is true or false"
9207
+ });
9208
+ desktopBridgeArgsSchemas = {
9209
+ getShellInfo: external_exports.tuple([]),
9210
+ getPresence: external_exports.tuple([]),
9211
+ openSignIn: external_exports.tuple([external_exports.string().max(DESKTOP_SIGN_IN_URL_MAX_LENGTH)]),
9212
+ getUpdate: external_exports.tuple([]),
9213
+ restartToUpdate: external_exports.tuple([]),
9214
+ notify: external_exports.tuple([desktopNotificationSchema]),
9215
+ setBadge: external_exports.tuple([desktopBadgeSchema]),
9216
+ clearAll: external_exports.tuple([]),
9217
+ getSettings: external_exports.tuple([]),
9218
+ setSettings: external_exports.tuple([desktopSettingsChangeSchema])
9219
+ };
9070
9220
  }
9071
9221
  });
9072
9222
 
@@ -10469,58 +10619,58 @@ var init_chunk_OPETF4GS = __esm({
10469
10619
  }
10470
10620
  });
10471
10621
 
10472
- // ../../packages/core/dist/chunk-SY6PLCPK.js
10473
- var jsonSchemaSchema, hubUserIdentity, stateValueEntry, getHubUserContextResponse, updateHubUserBody, updateHubUserResponse, unlockHubUserNameResponse, stateResetParams, stateResetResponse;
10474
- var init_chunk_SY6PLCPK = __esm({
10475
- "../../packages/core/dist/chunk-SY6PLCPK.js"() {
10622
+ // ../../packages/core/dist/chunk-V4FRPRH5.js
10623
+ var CONSULT_THREAD_STATUSES, consultThreadStatus, CONSULT_THREAD_TITLE_MAX, consultThreadTitle, consultThreadSummary, listConsultThreadsQuery, listConsultThreadsResponse, createConsultThreadBody, createConsultThreadResponse, consultThreadIdParam, updateConsultThreadBody, updateConsultThreadResponse, CONSULT_AWAIT_TIMEOUT_MS;
10624
+ var init_chunk_V4FRPRH5 = __esm({
10625
+ "../../packages/core/dist/chunk-V4FRPRH5.js"() {
10476
10626
  "use strict";
10477
- init_chunk_6TSQ5HXC();
10478
10627
  init_zod();
10479
- jsonSchemaSchema = external_exports.record(external_exports.unknown());
10480
- hubUserIdentity = external_exports.object({
10481
- user_id: external_exports.string().nullable(),
10482
- user_name: external_exports.string().nullable(),
10483
- user_email: external_exports.string().nullable(),
10484
- user_name_locked: external_exports.boolean(),
10485
- created_at: external_exports.string(),
10486
- updated_at: external_exports.string().nullable(),
10487
- hub_user_id: external_exports.string().optional(),
10488
- enabled: external_exports.boolean().optional(),
10489
- hub_team_id: external_exports.string().nullable().optional(),
10490
- source: external_exports.enum(["grant", "auto"]).optional()
10628
+ CONSULT_THREAD_STATUSES = ["open", "awaiting", "resolved", "cancelled_at_close"];
10629
+ consultThreadStatus = external_exports.enum(CONSULT_THREAD_STATUSES);
10630
+ CONSULT_THREAD_TITLE_MAX = 120;
10631
+ consultThreadTitle = external_exports.string().trim().min(1).max(CONSULT_THREAD_TITLE_MAX);
10632
+ consultThreadSummary = external_exports.object({
10633
+ consult_thread_id: external_exports.string(),
10634
+ conversation_id: external_exports.string(),
10635
+ initiator_type: external_exports.enum(["team", "agent"]),
10636
+ initiator_id: external_exports.string(),
10637
+ engaged_agent_id: external_exports.string().nullable(),
10638
+ engaged_agent_name: external_exports.string().nullable(),
10639
+ title: external_exports.string().nullable(),
10640
+ status: consultThreadStatus,
10641
+ created_at: external_exports.string()
10491
10642
  });
10492
- stateValueEntry = external_exports.object({
10493
- state_slug: external_exports.string(),
10494
- state_name: external_exports.string(),
10495
- state_description: external_exports.string().nullable().optional(),
10496
- scope: external_exports.enum(["user", "conversation"]),
10497
- json_schema: jsonSchemaSchema,
10498
- initial_value: external_exports.unknown(),
10499
- value: external_exports.unknown(),
10500
- is_reserved: external_exports.boolean()
10643
+ listConsultThreadsQuery = external_exports.object({
10644
+ hub_id: external_exports.string().uuid()
10501
10645
  });
10502
- getHubUserContextResponse = external_exports.object({
10503
- user: hubUserIdentity,
10504
- user_states: external_exports.array(stateValueEntry),
10505
- conversation_states: external_exports.array(stateValueEntry)
10646
+ listConsultThreadsResponse = external_exports.object({
10647
+ threads: external_exports.array(consultThreadSummary)
10506
10648
  });
10507
- updateHubUserBody = external_exports.object({
10508
- // Non-empty, non-null. `.nullable()` here would bypass `.min(1)` and let an
10509
- // admin arm the lock on a null name — see hub-do.ts updateHubUser null-guard.
10510
- user_name: external_exports.string().min(1).max(120)
10649
+ createConsultThreadBody = external_exports.object({
10650
+ hub_id: external_exports.string().uuid(),
10651
+ title: consultThreadTitle.optional(),
10652
+ // Optionally engage a consultant on creation. Validated server-side against the
10653
+ // hub's `consultant`-role agents; a non-consultant / unknown id is rejected.
10654
+ engaged_agent_id: external_exports.string().uuid().optional()
10511
10655
  });
10512
- updateHubUserResponse = external_exports.object({
10513
- user: hubUserIdentity
10656
+ createConsultThreadResponse = external_exports.object({
10657
+ thread: consultThreadSummary
10514
10658
  });
10515
- unlockHubUserNameResponse = external_exports.object({
10516
- user: hubUserIdentity
10659
+ consultThreadIdParam = external_exports.object({
10660
+ id: external_exports.string().uuid(),
10661
+ threadId: external_exports.string().uuid()
10517
10662
  });
10518
- stateResetParams = external_exports.object({
10519
- stateSlug: slugSchema
10663
+ updateConsultThreadBody = external_exports.object({
10664
+ hub_id: external_exports.string().uuid(),
10665
+ title: consultThreadTitle.optional(),
10666
+ engaged_agent_id: external_exports.string().uuid().optional()
10667
+ }).refine((v) => v.title !== void 0 || v.engaged_agent_id !== void 0, {
10668
+ message: "Provide a title and/or an engaged_agent_id to update"
10520
10669
  });
10521
- stateResetResponse = external_exports.object({
10522
- ok: external_exports.literal(true)
10670
+ updateConsultThreadResponse = external_exports.object({
10671
+ thread: consultThreadSummary
10523
10672
  });
10673
+ CONSULT_AWAIT_TIMEOUT_MS = 15 * 6e4;
10524
10674
  }
10525
10675
  });
10526
10676
 
@@ -12731,98 +12881,115 @@ var init_chunk_KSTYTQ7I = __esm({
12731
12881
  }
12732
12882
  });
12733
12883
 
12734
- // ../../packages/core/dist/chunk-LKBSHANA.js
12735
- 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;
12736
- var init_chunk_LKBSHANA = __esm({
12737
- "../../packages/core/dist/chunk-LKBSHANA.js"() {
12884
+ // ../../packages/core/dist/chunk-7CYHPF35.js
12885
+ var appMessageSenderType, appMessageReceiverType, apiChannelMessage, apiChannelMessageBody, appMessageBody, appMessageResponse;
12886
+ var init_chunk_7CYHPF35 = __esm({
12887
+ "../../packages/core/dist/chunk-7CYHPF35.js"() {
12738
12888
  "use strict";
12889
+ init_chunk_HZ6CADSY();
12739
12890
  init_zod();
12740
- 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})?$/;
12741
- DESKTOP_PLATFORMS = ["darwin", "win32"];
12742
- DESKTOP_FLAVORS = ["production", "development"];
12743
- desktopShellInfoSchema = external_exports.object({
12744
- /** The shell's own release version, independent of the web deploy. */
12745
- shellVersion: external_exports.string().regex(DESKTOP_SHELL_VERSION_RE),
12746
- /** The Electron runtime the shell was built with. */
12747
- electronVersion: external_exports.string().regex(/^\d{1,4}\.\d{1,4}\.\d{1,4}(-[0-9A-Za-z.-]{1,32})?$/),
12748
- platform: external_exports.enum(DESKTOP_PLATFORMS),
12749
- /** CPU architecture as Node reports it (`arm64`, `x64`). */
12750
- arch: external_exports.string().regex(/^[a-z0-9_]{1,16}$/),
12751
- flavor: external_exports.enum(DESKTOP_FLAVORS),
12752
- /**
12753
- * Present, and true, when the shell runs from the Microsoft Store's package: the Store updates it,
12754
- * and Windows alone opens it at login (the package's startup task, which the person turns on in
12755
- * Windows' settings). An optional field, so no new `bridgeVersion`: an older page ignores it, and
12756
- * its absence is every other shell.
12757
- */
12758
- store: external_exports.literal(true).optional()
12759
- });
12760
- DESKTOP_PRESENCE_STATES = ["present", "away"];
12761
- desktopPresenceSchema = external_exports.object({
12762
- presence: external_exports.enum(DESKTOP_PRESENCE_STATES),
12763
- mainWindow: external_exports.object({
12764
- shown: external_exports.boolean(),
12765
- focused: external_exports.boolean()
12766
- })
12767
- });
12768
- desktopUpdateSchema = external_exports.object({
12769
- ready: external_exports.object({
12770
- version: external_exports.string().regex(DESKTOP_SHELL_VERSION_RE),
12771
- offerRestart: external_exports.boolean()
12772
- }).nullable()
12773
- });
12774
- DESKTOP_SIGN_IN_URL_MAX_LENGTH = 4096;
12775
- DESKTOP_APP_PATH_MAX_LENGTH = 512;
12776
- desktopAppPathSchema = external_exports.string().max(DESKTOP_APP_PATH_MAX_LENGTH).regex(/^\/(?![/\\])[^\s\\]*$/);
12777
- DESKTOP_NOTIFICATION_KINDS = ["handoff", "message", "summary"];
12778
- DESKTOP_NOTIFICATION_TITLE_MAX_LENGTH = 200;
12779
- DESKTOP_NOTIFICATION_BODY_MAX_LENGTH = 500;
12780
- notificationTitleSchema = external_exports.string().min(1).max(DESKTOP_NOTIFICATION_TITLE_MAX_LENGTH);
12781
- notificationBodySchema = external_exports.string().max(DESKTOP_NOTIFICATION_BODY_MAX_LENGTH);
12782
- desktopNotificationSchema = external_exports.object({
12783
- kind: external_exports.enum(DESKTOP_NOTIFICATION_KINDS),
12784
- title: notificationTitleSchema,
12785
- body: notificationBodySchema,
12786
- path: desktopAppPathSchema,
12787
- withoutPreview: external_exports.object({ title: notificationTitleSchema, body: notificationBodySchema }).optional()
12788
- });
12789
- DESKTOP_BADGE_MAX_COUNT = 1e6;
12790
- DESKTOP_BADGE_LABEL_MAX_LENGTH = 200;
12791
- desktopBadgeSchema = external_exports.object({
12792
- count: external_exports.number().int().min(0).max(DESKTOP_BADGE_MAX_COUNT),
12793
- label: external_exports.string().max(DESKTOP_BADGE_LABEL_MAX_LENGTH)
12891
+ appMessageSenderType = external_exports.enum(["user", "team"]);
12892
+ appMessageReceiverType = external_exports.enum(["user", "team", "agent", "assistant"]).transform((v) => v === "assistant" ? "agent" : v);
12893
+ apiChannelMessage = external_exports.object({
12894
+ text: clientOptionalString,
12895
+ attachments: external_exports.array(messageAttachment).max(MAX_ATTACHMENTS_PER_MESSAGE).nullish().transform((v) => v ?? void 0)
12896
+ }).refine((m) => m.text && m.text.length > 0 || m.attachments && m.attachments.length > 0, {
12897
+ message: "message must have text or at least one attachment"
12794
12898
  });
12795
- desktopNavigateSchema = external_exports.object({
12796
- path: desktopAppPathSchema
12899
+ apiChannelMessageBody = external_exports.object({
12900
+ // Correlation id (task hubs): new → new conversation, repeat → continue. min 1 so an
12901
+ // empty string can't masquerade as a ref. Mutually exclusive with conversation_id.
12902
+ external_ref: external_exports.string().min(1).max(256).optional(),
12903
+ // Continue a specific WayAI conversation (authorized against the hub/channel + owner).
12904
+ // UUID-validated here (unlike the app channel, whose client we control): allocation
12905
+ // only treats a UUID-shaped id as a provided conversation, so a malformed id would
12906
+ // otherwise skip the owner guard and silently MINT a new conversation instead of
12907
+ // rejecting. A format 400 is shape-only — not an existence oracle (a valid-but-unknown
12908
+ // UUID still collapses to the opaque authorization error downstream).
12909
+ conversation_id: external_exports.string().uuid().optional(),
12910
+ // On-behalf-of end-user identity. Absent → per-connection service principal (task-hub
12911
+ // only; chat hub rejects with 422 in the route).
12912
+ user: external_exports.object({
12913
+ id: external_exports.string().min(1),
12914
+ email: clientOptionalString,
12915
+ name: clientOptionalString
12916
+ }).optional(),
12917
+ message: apiChannelMessage,
12918
+ // Idempotency key: maps to channel_message_sid, deduped within one conversation
12919
+ // (ConversationDO.storeMessage). A retried POST resolves to the same conversation (a chat
12920
+ // hub's user, the external_ref, the conversation_id, or on a task hub with neither, this key
12921
+ // scoped by the sender), so it echoes the original message_id and skips billing / turn
12922
+ // dispatch. A failed store answers a retryable 503 only when this key is set; without it a
12923
+ // retry could store the message twice, so it answers 400.
12924
+ client_message_id: external_exports.string().min(1).max(256).optional()
12925
+ }).refine((b) => !(b.external_ref && b.conversation_id), {
12926
+ message: "provide external_ref or conversation_id, not both",
12927
+ path: ["external_ref"]
12797
12928
  });
12798
- desktopSettingsSchema = external_exports.object({
12799
- /** The app opens when the person logs in to the computer: the operating system's own login item. */
12800
- openAtLogin: external_exports.boolean(),
12801
- /** Closing the window keeps the app running in the tray (true), or quits it (false). */
12802
- closeToTray: external_exports.boolean(),
12803
- /** The shell shows notifications (true), or none (false). The badge is not a notification. */
12804
- notifications: external_exports.boolean(),
12805
- /**
12806
- * A customer message's notification shows the customer's name and words, where the platform
12807
- * allows them at all (`desktopShowsCustomerWords`: macOS); elsewhere the shell never shows them.
12808
- */
12809
- messagePreview: external_exports.boolean()
12929
+ appMessageBody = external_exports.object({
12930
+ // Message content — three historical aliases. All optional: an attachment-only
12931
+ // or voice-only message carries no text.
12932
+ content: clientOptionalString,
12933
+ message_text: clientOptionalString,
12934
+ message_body: clientOptionalString,
12935
+ // Conversation context. Ids are plain strings rather than `.uuid()` on purpose:
12936
+ // they are AUTHORIZED downstream, which is the stronger guarantee — a well-formed
12937
+ // uuid belonging to another tenant must fail just as hard as junk. `hub_id` is
12938
+ // gated by `assertHubEndUserAccess` (gh #3286) and `conversation_id` by HubDO's
12939
+ // conversation_index owner check (gh #2781, #3281). The route's own falsy guards
12940
+ // ('hub_id is required') still reject an empty one.
12941
+ hub_id: clientOptionalString,
12942
+ channel_id: clientOptionalString,
12943
+ conversation_id: clientOptionalString,
12944
+ hub_type: external_exports.enum(["chat", "task"]).nullish().transform((v) => v ?? void 0),
12945
+ // Stable idempotency key for one explicit task-hub launcher. HubDO scopes it
12946
+ // to the authenticated user and resolves retries/tabs to one conversation.
12947
+ task_start_id: external_exports.string().uuid().nullish().transform((v) => v ?? void 0),
12948
+ // Routing.
12949
+ sender_type: appMessageSenderType.nullish().transform((v) => v ?? void 0),
12950
+ receiver_type: appMessageReceiverType.nullish().transform((v) => v ?? void 0),
12951
+ // Only meaningful on a team send, where `validateAppTeamSendContext` proves the
12952
+ // caller may send to this receiver. Absent on a team send to a conversation with no
12953
+ // person, which names its `conversation_id` instead. The end-user branch ignores it —
12954
+ // see the receiver derivation in the route.
12955
+ user_receiver_id: clientOptionalString,
12956
+ // ── Internal consult (consultant-agents PR 2 — H1.0) ──────────────────────
12957
+ // A team member handling a customer conversation can tag a `consultant`-role
12958
+ // agent for a PRIVATE, team-only exchange that never reaches the customer. A
12959
+ // consult send is a team send with `receiver_type: 'agent'` targeting the
12960
+ // consultant; `user_receiver_id` identifies the customer whose conversation this is
12961
+ // (and is authorized by `validateAppTeamSendContext`, exactly as a team→user send is),
12962
+ // and is absent, as on a team→user send, when the conversation has no person. The consultant is resolved from `agent_receiver_id`
12963
+ // when supplied, else from an `@mention` parsed out of the message text against
12964
+ // the hub's consultant agents. `consult_thread_id` continues an existing thread;
12965
+ // absent, the route creates/reuses the single implicit thread. These fields are
12966
+ // inert on every non-consult send (end-user send, team→user send).
12967
+ agent_receiver_id: clientOptionalString,
12968
+ consult_thread_id: clientOptionalString,
12969
+ is_first_message: clientOptionalBoolean,
12970
+ end_conversation: clientOptionalBoolean,
12971
+ // Pre-generated by the client so the optimistic bubble and the stored row share
12972
+ // a key (transcription live-updates land on the same row instead of duplicating).
12973
+ message_id: clientOptionalString,
12974
+ attachments: external_exports.array(messageAttachment).max(MAX_ATTACHMENTS_PER_MESSAGE).nullish().transform((v) => v ?? void 0),
12975
+ // Base64-encoded audio for STT. Size-capped in the route (the cap is a byte
12976
+ // budget tied to the /channels/* bodyLimit, not a shape rule).
12977
+ audio_file: clientOptionalString
12810
12978
  });
12811
- desktopSettingsChangeSchema = desktopSettingsSchema.partial().strict().refine((change) => Object.values(change).every((value) => typeof value === "boolean"), {
12812
- message: "each setting changed is true or false"
12979
+ appMessageResponse = external_exports.object({
12980
+ success: external_exports.boolean(),
12981
+ message: external_exports.string(),
12982
+ result: external_exports.object({
12983
+ conversation_id: external_exports.string().optional(),
12984
+ message_id: external_exports.string().optional(),
12985
+ status: external_exports.string().optional(),
12986
+ files: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown())).optional(),
12987
+ // True when this request reused a task-start/message id already accepted by
12988
+ // the server. Clients must replace their optimistic payload with a fresh
12989
+ // authoritative read because another tab may have won with different text.
12990
+ deduped: external_exports.boolean().optional()
12991
+ }).optional()
12813
12992
  });
12814
- desktopBridgeArgsSchemas = {
12815
- getShellInfo: external_exports.tuple([]),
12816
- getPresence: external_exports.tuple([]),
12817
- openSignIn: external_exports.tuple([external_exports.string().max(DESKTOP_SIGN_IN_URL_MAX_LENGTH)]),
12818
- getUpdate: external_exports.tuple([]),
12819
- restartToUpdate: external_exports.tuple([]),
12820
- notify: external_exports.tuple([desktopNotificationSchema]),
12821
- setBadge: external_exports.tuple([desktopBadgeSchema]),
12822
- clearAll: external_exports.tuple([]),
12823
- getSettings: external_exports.tuple([]),
12824
- setSettings: external_exports.tuple([desktopSettingsChangeSchema])
12825
- };
12826
12993
  }
12827
12994
  });
12828
12995
 
@@ -12916,61 +13083,6 @@ var init_chunk_YULHXJ5M = __esm({
12916
13083
  }
12917
13084
  });
12918
13085
 
12919
- // ../../packages/core/dist/chunk-V4FRPRH5.js
12920
- var CONSULT_THREAD_STATUSES, consultThreadStatus, CONSULT_THREAD_TITLE_MAX, consultThreadTitle, consultThreadSummary, listConsultThreadsQuery, listConsultThreadsResponse, createConsultThreadBody, createConsultThreadResponse, consultThreadIdParam, updateConsultThreadBody, updateConsultThreadResponse, CONSULT_AWAIT_TIMEOUT_MS;
12921
- var init_chunk_V4FRPRH5 = __esm({
12922
- "../../packages/core/dist/chunk-V4FRPRH5.js"() {
12923
- "use strict";
12924
- init_zod();
12925
- CONSULT_THREAD_STATUSES = ["open", "awaiting", "resolved", "cancelled_at_close"];
12926
- consultThreadStatus = external_exports.enum(CONSULT_THREAD_STATUSES);
12927
- CONSULT_THREAD_TITLE_MAX = 120;
12928
- consultThreadTitle = external_exports.string().trim().min(1).max(CONSULT_THREAD_TITLE_MAX);
12929
- consultThreadSummary = external_exports.object({
12930
- consult_thread_id: external_exports.string(),
12931
- conversation_id: external_exports.string(),
12932
- initiator_type: external_exports.enum(["team", "agent"]),
12933
- initiator_id: external_exports.string(),
12934
- engaged_agent_id: external_exports.string().nullable(),
12935
- engaged_agent_name: external_exports.string().nullable(),
12936
- title: external_exports.string().nullable(),
12937
- status: consultThreadStatus,
12938
- created_at: external_exports.string()
12939
- });
12940
- listConsultThreadsQuery = external_exports.object({
12941
- hub_id: external_exports.string().uuid()
12942
- });
12943
- listConsultThreadsResponse = external_exports.object({
12944
- threads: external_exports.array(consultThreadSummary)
12945
- });
12946
- createConsultThreadBody = external_exports.object({
12947
- hub_id: external_exports.string().uuid(),
12948
- title: consultThreadTitle.optional(),
12949
- // Optionally engage a consultant on creation. Validated server-side against the
12950
- // hub's `consultant`-role agents; a non-consultant / unknown id is rejected.
12951
- engaged_agent_id: external_exports.string().uuid().optional()
12952
- });
12953
- createConsultThreadResponse = external_exports.object({
12954
- thread: consultThreadSummary
12955
- });
12956
- consultThreadIdParam = external_exports.object({
12957
- id: external_exports.string().uuid(),
12958
- threadId: external_exports.string().uuid()
12959
- });
12960
- updateConsultThreadBody = external_exports.object({
12961
- hub_id: external_exports.string().uuid(),
12962
- title: consultThreadTitle.optional(),
12963
- engaged_agent_id: external_exports.string().uuid().optional()
12964
- }).refine((v) => v.title !== void 0 || v.engaged_agent_id !== void 0, {
12965
- message: "Provide a title and/or an engaged_agent_id to update"
12966
- });
12967
- updateConsultThreadResponse = external_exports.object({
12968
- thread: consultThreadSummary
12969
- });
12970
- CONSULT_AWAIT_TIMEOUT_MS = 15 * 6e4;
12971
- }
12972
- });
12973
-
12974
13086
  // ../../packages/core/dist/chunk-VYINA6YP.js
12975
13087
  function formatterOf(zone) {
12976
13088
  const held = formatters.get(zone);
@@ -13132,118 +13244,6 @@ var init_chunk_X4IDZLLS = __esm({
13132
13244
  }
13133
13245
  });
13134
13246
 
13135
- // ../../packages/core/dist/chunk-7CYHPF35.js
13136
- var appMessageSenderType, appMessageReceiverType, apiChannelMessage, apiChannelMessageBody, appMessageBody, appMessageResponse;
13137
- var init_chunk_7CYHPF35 = __esm({
13138
- "../../packages/core/dist/chunk-7CYHPF35.js"() {
13139
- "use strict";
13140
- init_chunk_HZ6CADSY();
13141
- init_zod();
13142
- appMessageSenderType = external_exports.enum(["user", "team"]);
13143
- appMessageReceiverType = external_exports.enum(["user", "team", "agent", "assistant"]).transform((v) => v === "assistant" ? "agent" : v);
13144
- apiChannelMessage = external_exports.object({
13145
- text: clientOptionalString,
13146
- attachments: external_exports.array(messageAttachment).max(MAX_ATTACHMENTS_PER_MESSAGE).nullish().transform((v) => v ?? void 0)
13147
- }).refine((m) => m.text && m.text.length > 0 || m.attachments && m.attachments.length > 0, {
13148
- message: "message must have text or at least one attachment"
13149
- });
13150
- apiChannelMessageBody = external_exports.object({
13151
- // Correlation id (task hubs): new → new conversation, repeat → continue. min 1 so an
13152
- // empty string can't masquerade as a ref. Mutually exclusive with conversation_id.
13153
- external_ref: external_exports.string().min(1).max(256).optional(),
13154
- // Continue a specific WayAI conversation (authorized against the hub/channel + owner).
13155
- // UUID-validated here (unlike the app channel, whose client we control): allocation
13156
- // only treats a UUID-shaped id as a provided conversation, so a malformed id would
13157
- // otherwise skip the owner guard and silently MINT a new conversation instead of
13158
- // rejecting. A format 400 is shape-only — not an existence oracle (a valid-but-unknown
13159
- // UUID still collapses to the opaque authorization error downstream).
13160
- conversation_id: external_exports.string().uuid().optional(),
13161
- // On-behalf-of end-user identity. Absent → per-connection service principal (task-hub
13162
- // only; chat hub rejects with 422 in the route).
13163
- user: external_exports.object({
13164
- id: external_exports.string().min(1),
13165
- email: clientOptionalString,
13166
- name: clientOptionalString
13167
- }).optional(),
13168
- message: apiChannelMessage,
13169
- // Idempotency key: maps to channel_message_sid, deduped within one conversation
13170
- // (ConversationDO.storeMessage). A retried POST resolves to the same conversation (a chat
13171
- // hub's user, the external_ref, the conversation_id, or on a task hub with neither, this key
13172
- // scoped by the sender), so it echoes the original message_id and skips billing / turn
13173
- // dispatch. A failed store answers a retryable 503 only when this key is set; without it a
13174
- // retry could store the message twice, so it answers 400.
13175
- client_message_id: external_exports.string().min(1).max(256).optional()
13176
- }).refine((b) => !(b.external_ref && b.conversation_id), {
13177
- message: "provide external_ref or conversation_id, not both",
13178
- path: ["external_ref"]
13179
- });
13180
- appMessageBody = external_exports.object({
13181
- // Message content — three historical aliases. All optional: an attachment-only
13182
- // or voice-only message carries no text.
13183
- content: clientOptionalString,
13184
- message_text: clientOptionalString,
13185
- message_body: clientOptionalString,
13186
- // Conversation context. Ids are plain strings rather than `.uuid()` on purpose:
13187
- // they are AUTHORIZED downstream, which is the stronger guarantee — a well-formed
13188
- // uuid belonging to another tenant must fail just as hard as junk. `hub_id` is
13189
- // gated by `assertHubEndUserAccess` (gh #3286) and `conversation_id` by HubDO's
13190
- // conversation_index owner check (gh #2781, #3281). The route's own falsy guards
13191
- // ('hub_id is required') still reject an empty one.
13192
- hub_id: clientOptionalString,
13193
- channel_id: clientOptionalString,
13194
- conversation_id: clientOptionalString,
13195
- hub_type: external_exports.enum(["chat", "task"]).nullish().transform((v) => v ?? void 0),
13196
- // Stable idempotency key for one explicit task-hub launcher. HubDO scopes it
13197
- // to the authenticated user and resolves retries/tabs to one conversation.
13198
- task_start_id: external_exports.string().uuid().nullish().transform((v) => v ?? void 0),
13199
- // Routing.
13200
- sender_type: appMessageSenderType.nullish().transform((v) => v ?? void 0),
13201
- receiver_type: appMessageReceiverType.nullish().transform((v) => v ?? void 0),
13202
- // Only meaningful on a team send, where `validateAppTeamSendContext` proves the
13203
- // caller may send to this receiver. Absent on a team send to a conversation with no
13204
- // person, which names its `conversation_id` instead. The end-user branch ignores it —
13205
- // see the receiver derivation in the route.
13206
- user_receiver_id: clientOptionalString,
13207
- // ── Internal consult (consultant-agents PR 2 — H1.0) ──────────────────────
13208
- // A team member handling a customer conversation can tag a `consultant`-role
13209
- // agent for a PRIVATE, team-only exchange that never reaches the customer. A
13210
- // consult send is a team send with `receiver_type: 'agent'` targeting the
13211
- // consultant; `user_receiver_id` identifies the customer whose conversation this is
13212
- // (and is authorized by `validateAppTeamSendContext`, exactly as a team→user send is),
13213
- // and is absent, as on a team→user send, when the conversation has no person. The consultant is resolved from `agent_receiver_id`
13214
- // when supplied, else from an `@mention` parsed out of the message text against
13215
- // the hub's consultant agents. `consult_thread_id` continues an existing thread;
13216
- // absent, the route creates/reuses the single implicit thread. These fields are
13217
- // inert on every non-consult send (end-user send, team→user send).
13218
- agent_receiver_id: clientOptionalString,
13219
- consult_thread_id: clientOptionalString,
13220
- is_first_message: clientOptionalBoolean,
13221
- end_conversation: clientOptionalBoolean,
13222
- // Pre-generated by the client so the optimistic bubble and the stored row share
13223
- // a key (transcription live-updates land on the same row instead of duplicating).
13224
- message_id: clientOptionalString,
13225
- attachments: external_exports.array(messageAttachment).max(MAX_ATTACHMENTS_PER_MESSAGE).nullish().transform((v) => v ?? void 0),
13226
- // Base64-encoded audio for STT. Size-capped in the route (the cap is a byte
13227
- // budget tied to the /channels/* bodyLimit, not a shape rule).
13228
- audio_file: clientOptionalString
13229
- });
13230
- appMessageResponse = external_exports.object({
13231
- success: external_exports.boolean(),
13232
- message: external_exports.string(),
13233
- result: external_exports.object({
13234
- conversation_id: external_exports.string().optional(),
13235
- message_id: external_exports.string().optional(),
13236
- status: external_exports.string().optional(),
13237
- files: external_exports.array(external_exports.record(external_exports.string(), external_exports.unknown())).optional(),
13238
- // True when this request reused a task-start/message id already accepted by
13239
- // the server. Clients must replace their optimistic payload with a fresh
13240
- // authoritative read because another tab may have won with different text.
13241
- deduped: external_exports.boolean().optional()
13242
- }).optional()
13243
- });
13244
- }
13245
- });
13246
-
13247
13247
  // ../../packages/core/dist/chunk-M2T55BV6.js
13248
13248
  function isCaseAttributeDate(text5) {
13249
13249
  const match = /^(\d{4})-(\d{2})-(\d{2})$/.exec(text5);
@@ -13326,7 +13326,7 @@ var init_chunk_M2T55BV6 = __esm({
13326
13326
  }
13327
13327
  });
13328
13328
 
13329
- // ../../packages/core/dist/chunk-3SZD2H6D.js
13329
+ // ../../packages/core/dist/chunk-J3HQTL6M.js
13330
13330
  function withProblem(shape, problemOf) {
13331
13331
  return shape.superRefine((value, ctx) => {
13332
13332
  const found = problemOf(value);
@@ -13363,11 +13363,11 @@ ${party.role}`);
13363
13363
  return new Set(keys).size === keys.length ? null : { reason: "instrument_party_repeated", at: "parties" };
13364
13364
  }
13365
13365
  var CASE_REGISTRY_TYPE_CODE_PATTERN, CASE_REGISTRY_TYPE_CODE_MAX_LENGTH, CASE_REGISTRY_NAME_MAX_LENGTH, CASE_REGISTRY_TYPE_SCHEMA_MAX_CHARS, CASE_PARTY_ABBREVIATION_PATTERN, CASE_PARTY_PERSON_KINDS, CASE_PARTY_DOCUMENT_KINDS, CASE_PARTY_DOCUMENT_MAX_LENGTH, CASE_PARTY_GROUP_MEMBERS_MAX, CASE_INSTRUMENT_NUMBER_MAX_LENGTH, CASE_INSTRUMENT_ROLE_MAX_LENGTH, CASE_INSTRUMENT_PARTIES_MAX, CASE_REGISTRY_PAGE_MAX, CASE_REGISTRY_QUERY_MAX_LENGTH, trimmedName, dateSchema, attributesValues, registryTypeFields, createCaseRegistryTypeShape, updateCaseRegistryTypeShape, createCaseRegistryTypeBody, updateCaseRegistryTypeBody, saveCasePartyShape, saveCasePartyBody, saveCasePartyGroupShape, saveCasePartyGroupBody, caseInstrumentPartyInput, saveCaseInstrumentShape, saveCaseInstrumentBody, registryPage, searchText, casePartiesQuery, casePartyGroupsQuery, caseInstrumentsQuery, caseRegistryTypeParam, casePartyParam, casePartyGroupParam, caseInstrumentParam;
13366
- var init_chunk_3SZD2H6D = __esm({
13367
- "../../packages/core/dist/chunk-3SZD2H6D.js"() {
13366
+ var init_chunk_J3HQTL6M = __esm({
13367
+ "../../packages/core/dist/chunk-J3HQTL6M.js"() {
13368
13368
  "use strict";
13369
- init_chunk_CLGTGGVN();
13370
13369
  init_chunk_M2T55BV6();
13370
+ init_chunk_CLGTGGVN();
13371
13371
  init_chunk_HZ6CADSY();
13372
13372
  init_zod();
13373
13373
  CASE_REGISTRY_TYPE_CODE_PATTERN = /^[a-z0-9]+(_[a-z0-9]+)*$/;
@@ -13682,7 +13682,7 @@ var init_chunk_ZJA3UZMG = __esm({
13682
13682
  }
13683
13683
  });
13684
13684
 
13685
- // ../../packages/core/dist/chunk-5D4QFV76.js
13685
+ // ../../packages/core/dist/chunk-YMFTFCT5.js
13686
13686
  function collectionUploadForm(field, shape) {
13687
13687
  return external_exports.record(external_exports.string(), external_exports.unknown()).transform((form2, ctx) => {
13688
13688
  const refuse2 = (message, path55) => {
@@ -13722,14 +13722,14 @@ function caseCollectionFileName(sent) {
13722
13722
  return name || "document";
13723
13723
  }
13724
13724
  var CASE_COLLECTION_FOLDERS, CASE_COLLECTION_PARTS, isCaseCollectionPart, CASE_COLLECTION_TITLE_MAX_LENGTH, CASE_COLLECTION_TYPE_MAX_LENGTH, CASE_COLLECTION_REASON_MAX_LENGTH, CASE_COLLECTION_FILE_NAME_MAX_LENGTH, caseCollectionDocumentParam, dateOnly, title, registerCaseCollectionDocumentShape, addCaseCollectionVersionShape, CASE_COLLECTION_UPLOAD_BODY_MAX_BYTES, CASE_COLLECTION_DOCUMENT_FIELD, CASE_COLLECTION_VERSION_FIELD, caseCollectionDocumentUploadForm, caseCollectionVersionUploadForm, CASE_COLLECTION_PAGE_MAX, CASE_COLLECTION_CURSOR_MAX_LENGTH, caseCollectionQuery, CASE_COLLECTION_VERSIONS_PAGE_MAX, caseCollectionVersionsQuery, caseCollectionContentQuery;
13725
- var init_chunk_5D4QFV76 = __esm({
13726
- "../../packages/core/dist/chunk-5D4QFV76.js"() {
13725
+ var init_chunk_YMFTFCT5 = __esm({
13726
+ "../../packages/core/dist/chunk-YMFTFCT5.js"() {
13727
13727
  "use strict";
13728
- init_chunk_3SZD2H6D();
13728
+ init_chunk_J3HQTL6M();
13729
13729
  init_chunk_ZJA3UZMG();
13730
13730
  init_chunk_HPZOVPVT();
13731
- init_chunk_CLGTGGVN();
13732
13731
  init_chunk_M2T55BV6();
13732
+ init_chunk_CLGTGGVN();
13733
13733
  init_chunk_HZ6CADSY();
13734
13734
  init_zod();
13735
13735
  CASE_COLLECTION_FOLDERS = ["norms", "internal_norms", "instruments", "data"];
@@ -13788,12 +13788,12 @@ var init_chunk_5D4QFV76 = __esm({
13788
13788
  }
13789
13789
  });
13790
13790
 
13791
- // ../../packages/core/dist/chunk-LYVJU46L.js
13791
+ // ../../packages/core/dist/chunk-MCLSEATL.js
13792
13792
  function resolveItemLink(phaseFolder, target) {
13793
13793
  const slash = target.lastIndexOf("/");
13794
13794
  const folder = slash < 0 ? phaseFolder : target.slice(0, slash);
13795
- const code2 = target.slice(slash + 1);
13796
- return { folder, code: code2, key: `${folder}/${code2}` };
13795
+ const code22 = target.slice(slash + 1);
13796
+ return { folder, code: code22, key: `${folder}/${code22}` };
13797
13797
  }
13798
13798
  function caseTypeDefinitionRows(definition) {
13799
13799
  let rows = 1 + definition.type_party_roles.length + definition.type_outcomes.length;
@@ -14013,12 +14013,12 @@ function caseTypeDefinitionReasonOf(error) {
14013
14013
  return first && reason3 ? { reason: reason3, at: first.path.join(".") } : null;
14014
14014
  }
14015
14015
  var CASE_CODE_PATTERN, CASE_PHASE_CODE_PATTERN, CASE_PHASE_FOLDER_PATTERN, CASE_INPUT_KEY_PATTERN, CASE_CALCULATION_CODE_PATTERN, CASE_AGENDA_GROUP_CODE_PATTERN, CASE_DECISION_CODE_PATTERN, CASE_DECISION_OPTION_CODE_PATTERN, CASE_DECISION_EFFECT_PATTERN, FILE_PATH_SEGMENT_PATTERN, CASE_REVIEW_MODES, CASE_OUTPUT_FORMATS, CASE_INPUT_ORIGINS, CASE_TEMPLATE_MODES, CASE_AGENDA_QUORUMS, CASE_DECISION_TYPES, CASE_NUMERIC_DECISION_TYPES, CASE_TYPE_NAME_MAX_LENGTH, CASE_CODE_MAX_LENGTH, CASE_FILE_PATH_MAX_LENGTH, CASE_TASK_NAME_MAX_LENGTH, CASE_TASK_DEPENDENCIES_MAX, CASE_FIXED_TEXT_MAX_LENGTH, CASE_TYPE_DEFINITION_MAX_CHARS, CASE_TYPE_DEFINITION_ROWS_MAX, CASE_TYPE_VERSIONS_MAX, CASE_TYPES_PAGE_MAX, code, phaseCode, inputKey, caseAgendaGroupCodeSchema, caseDecisionCodeSchema, decisionCode, label2, optionalText, itemLinkTarget, filePath, caseTypePartyRoleSchema, caseTypeOutcomeSchema, caseItemRequirementsSchema, caseItemLinksSchema, caseOutputItemSchema, casePhaseOutputSchema, casePhaseInputSchema, caseDecisionOptionSchema, decisionBound, caseAgendaDecisionSchema, caseAgendaGroupSchema, caseTypeTaskSchema, caseTypePhaseSchema, caseTypeDefinitionShape, caseValuesRepeated, CHAPTER_PROBE, caseTypeDefinitionSchema, caseTypeAbbreviationSchema, caseTypeNameSchema, createCaseTypeBody, publishCaseTypeVersionBody, setCaseTypeActiveBody, caseTypeParam, caseTypesPageQuery, caseTypeVersionQuery, CASE_TYPE_VERSION_CONFLICT_REASON;
14016
- var init_chunk_LYVJU46L = __esm({
14017
- "../../packages/core/dist/chunk-LYVJU46L.js"() {
14016
+ var init_chunk_MCLSEATL = __esm({
14017
+ "../../packages/core/dist/chunk-MCLSEATL.js"() {
14018
14018
  "use strict";
14019
+ init_chunk_M2T55BV6();
14019
14020
  init_chunk_CLGTGGVN();
14020
14021
  init_chunk_KWRHZBGU();
14021
- init_chunk_M2T55BV6();
14022
14022
  init_chunk_HZ6CADSY();
14023
14023
  init_chunk_ZTNFLGW5();
14024
14024
  init_zod();
@@ -14229,7 +14229,7 @@ var init_chunk_LYVJU46L = __esm({
14229
14229
  }
14230
14230
  });
14231
14231
 
14232
- // ../../packages/core/dist/chunk-4EHHQFKV.js
14232
+ // ../../packages/core/dist/chunk-UGKJPB2J.js
14233
14233
  function openCaseProblem(body) {
14234
14234
  const pairs = /* @__PURE__ */ new Set();
14235
14235
  for (const [index, party] of body.parties.entries()) {
@@ -14242,10 +14242,10 @@ ${party.role}`;
14242
14242
  return null;
14243
14243
  }
14244
14244
  var CASE_RECORD_CODE_PATTERN, CASE_RECORD_CODE_MAX_LENGTH, CASE_RECORD_PARTIES_MAX, CASE_RECORD_INSTRUMENTS_MAX, CASE_RECORD_ROLE_MAX_LENGTH, CASE_RECORDS_PAGE_MAX, CASE_RECORDS_QUERY_MAX_LENGTH, caseRecordPartySchema, openCaseShape, openCaseBody, previewOpenCaseShape, caseRecordParam, CASE_RECORD_STATUSES, caseRecordsQuery, CASE_STATE_SUMMARIES_MAX, caseStatesQuery, CASE_CLOSED_REASON, CASE_CLOSURE_REASON_MAX_LENGTH, closeCaseBody, setCaseConfidentialityBody;
14245
- var init_chunk_4EHHQFKV = __esm({
14246
- "../../packages/core/dist/chunk-4EHHQFKV.js"() {
14245
+ var init_chunk_UGKJPB2J = __esm({
14246
+ "../../packages/core/dist/chunk-UGKJPB2J.js"() {
14247
14247
  "use strict";
14248
- init_chunk_LYVJU46L();
14248
+ init_chunk_MCLSEATL();
14249
14249
  init_chunk_CLGTGGVN();
14250
14250
  init_chunk_HZ6CADSY();
14251
14251
  init_chunk_ZTNFLGW5();
@@ -14306,7 +14306,7 @@ var init_chunk_4EHHQFKV = __esm({
14306
14306
  }
14307
14307
  });
14308
14308
 
14309
- // ../../packages/core/dist/chunk-4GVO7ZLI.js
14309
+ // ../../packages/core/dist/chunk-BE4ATZB7.js
14310
14310
  function caseReceivedFormat(fileName) {
14311
14311
  const dot = fileName.lastIndexOf(".");
14312
14312
  if (dot < 0) return null;
@@ -14314,13 +14314,13 @@ function caseReceivedFormat(fileName) {
14314
14314
  return isCaseReceivedFormat(extension) ? extension : null;
14315
14315
  }
14316
14316
  var ZIP_SIGNATURE, CASE_RECEIVED_FORMATS, isCaseReceivedFormat, CASE_RECEIVED_PARTS, CASE_RECEIVED_TITLE_MAX_LENGTH, CASE_RECEIVED_TYPE_MAX_LENGTH, CASE_RECEIVED_TEXT_MAX_BYTES, CASE_RECEIVED_UPLOAD_BODY_MAX_BYTES, CASE_RECEIVED_DOCUMENT_FIELD, caseReceivedParam, registerCaseReceivedDocumentShape, caseReceivedUploadForm, caseReceivedFileName, ZIP_DIRECTORY_MAX_BYTES, CONTENT_TYPES_MAX_BYTES, CONTENT_TYPES_INFLATED_MAX_BYTES, CASE_RECEIVED_PAGE_MAX, caseReceivedQuery, caseReceivedContentQuery;
14317
- var init_chunk_4GVO7ZLI = __esm({
14318
- "../../packages/core/dist/chunk-4GVO7ZLI.js"() {
14317
+ var init_chunk_BE4ATZB7 = __esm({
14318
+ "../../packages/core/dist/chunk-BE4ATZB7.js"() {
14319
14319
  "use strict";
14320
- init_chunk_5D4QFV76();
14320
+ init_chunk_YMFTFCT5();
14321
14321
  init_chunk_ZJA3UZMG();
14322
14322
  init_chunk_HPZOVPVT();
14323
- init_chunk_4EHHQFKV();
14323
+ init_chunk_UGKJPB2J();
14324
14324
  init_chunk_CLGTGGVN();
14325
14325
  init_chunk_HZ6CADSY();
14326
14326
  init_zod();
@@ -14395,14 +14395,25 @@ var init_chunk_4GVO7ZLI = __esm({
14395
14395
  }
14396
14396
  });
14397
14397
 
14398
- // ../../packages/core/dist/chunk-EFX3OU2G.js
14398
+ // ../../packages/core/dist/chunk-COZBA6Z4.js
14399
+ var casePhaseParam;
14400
+ var init_chunk_COZBA6Z4 = __esm({
14401
+ "../../packages/core/dist/chunk-COZBA6Z4.js"() {
14402
+ "use strict";
14403
+ init_chunk_UGKJPB2J();
14404
+ init_chunk_HZ6CADSY();
14405
+ casePhaseParam = caseRecordParam.extend({ phase_id: uuidSchema });
14406
+ }
14407
+ });
14408
+
14409
+ // ../../packages/core/dist/chunk-6ITRMGLQ.js
14399
14410
  var CASE_OFFICIAL_FILE_KINDS, CASE_OFFICIAL_FILE_NAME_PATTERN, publishCaseSubmissionBody, caseOfficialVersionParam, caseOfficialFileQuery;
14400
- var init_chunk_EFX3OU2G = __esm({
14401
- "../../packages/core/dist/chunk-EFX3OU2G.js"() {
14411
+ var init_chunk_6ITRMGLQ = __esm({
14412
+ "../../packages/core/dist/chunk-6ITRMGLQ.js"() {
14402
14413
  "use strict";
14403
14414
  init_chunk_YR7QALGP();
14404
14415
  init_chunk_HPZOVPVT();
14405
- init_chunk_4EHHQFKV();
14416
+ init_chunk_UGKJPB2J();
14406
14417
  init_chunk_HZ6CADSY();
14407
14418
  init_zod();
14408
14419
  CASE_OFFICIAL_FILE_KINDS = [...CASE_SUBMISSION_ISSUED_KINDS, "file"];
@@ -14416,17 +14427,6 @@ var init_chunk_EFX3OU2G = __esm({
14416
14427
  }
14417
14428
  });
14418
14429
 
14419
- // ../../packages/core/dist/chunk-3BFHRPHD.js
14420
- var casePhaseParam;
14421
- var init_chunk_3BFHRPHD = __esm({
14422
- "../../packages/core/dist/chunk-3BFHRPHD.js"() {
14423
- "use strict";
14424
- init_chunk_4EHHQFKV();
14425
- init_chunk_HZ6CADSY();
14426
- casePhaseParam = caseRecordParam.extend({ phase_id: uuidSchema });
14427
- }
14428
- });
14429
-
14430
14430
  // ../../packages/core/dist/chunk-64HCHXKB.js
14431
14431
  var CASE_CHECK_CSV_MAX_BYTES, CASE_DECISIONS_CSV_PATH, CASE_CONFIDENTIAL_DECISIONS_CSV_PATH, caseChecksQuery;
14432
14432
  var init_chunk_64HCHXKB = __esm({
@@ -14444,17 +14444,17 @@ var init_chunk_64HCHXKB = __esm({
14444
14444
  }
14445
14445
  });
14446
14446
 
14447
- // ../../packages/core/dist/chunk-G4QNT67H.js
14447
+ // ../../packages/core/dist/chunk-3SYJ5V22.js
14448
14448
  var CASE_REVIEW_DECISIONS, CASE_ISSUED_FORMATS, CASE_REVIEW_COMMENT_MAX_LENGTH, CASE_REVIEW_JUSTIFICATION_MAX_LENGTH, text2, caseSubmissionParam, decideCaseSubmissionBody, caseIssuedQuery, CASE_APPROVALS_STATES, caseApprovalsQuery, caseCompareDefaultQuery, caseApprovalsAgendaQuery;
14449
- var init_chunk_G4QNT67H = __esm({
14450
- "../../packages/core/dist/chunk-G4QNT67H.js"() {
14449
+ var init_chunk_3SYJ5V22 = __esm({
14450
+ "../../packages/core/dist/chunk-3SYJ5V22.js"() {
14451
14451
  "use strict";
14452
- init_chunk_EFX3OU2G();
14453
- init_chunk_3BFHRPHD();
14452
+ init_chunk_COZBA6Z4();
14453
+ init_chunk_6ITRMGLQ();
14454
14454
  init_chunk_64HCHXKB();
14455
14455
  init_chunk_YR7QALGP();
14456
14456
  init_chunk_HPZOVPVT();
14457
- init_chunk_4EHHQFKV();
14457
+ init_chunk_UGKJPB2J();
14458
14458
  init_chunk_CLGTGGVN();
14459
14459
  init_chunk_HZ6CADSY();
14460
14460
  init_zod();
@@ -14524,15 +14524,15 @@ var init_chunk_26PIYACX = __esm({
14524
14524
  }
14525
14525
  });
14526
14526
 
14527
- // ../../packages/core/dist/chunk-AVSVFP3W.js
14527
+ // ../../packages/core/dist/chunk-7JYZW5BH.js
14528
14528
  function addCaseNoteProblem(note) {
14529
14529
  return note.origin !== null && note.kind !== "contribution" ? { reason: "origin_not_contribution", at: "origin" } : null;
14530
14530
  }
14531
14531
  var CASE_NOTE_KINDS, CASE_NOTE_TEXT_MAX_LENGTH, CASE_NOTE_ORIGIN_MAX_LENGTH, CASE_NOTES_PAGE_MAX, addCaseNoteShape, addCaseNoteBody, caseNoteParam, caseTaskParam, caseNotesQuery;
14532
- var init_chunk_AVSVFP3W = __esm({
14533
- "../../packages/core/dist/chunk-AVSVFP3W.js"() {
14532
+ var init_chunk_7JYZW5BH = __esm({
14533
+ "../../packages/core/dist/chunk-7JYZW5BH.js"() {
14534
14534
  "use strict";
14535
- init_chunk_4EHHQFKV();
14535
+ init_chunk_UGKJPB2J();
14536
14536
  init_chunk_CLGTGGVN();
14537
14537
  init_chunk_HZ6CADSY();
14538
14538
  init_zod();
@@ -14562,17 +14562,17 @@ var init_chunk_AVSVFP3W = __esm({
14562
14562
  }
14563
14563
  });
14564
14564
 
14565
- // ../../packages/core/dist/chunk-OFJI6SZT.js
14565
+ // ../../packages/core/dist/chunk-BN7WSDWC.js
14566
14566
  function casePassageLines(text5) {
14567
14567
  const lines2 = text5.replace(/\r\n/g, "\n").split("\n");
14568
14568
  if (lines2.at(-1) === "") lines2.pop();
14569
14569
  return lines2;
14570
14570
  }
14571
14571
  var CASE_COMMENT_TEXT_MAX_LENGTH, CASE_COMMENTS_PAGE_MAX, CASE_COMMENT_LINE_MAX, casePassageLineSchema, lineNumber, addCaseCommentShape, CASE_COMMENT_REVERSED_REASON, addCaseCommentBody, caseCommentsQuery, CASE_COMMENT_OUT_OF_RANGE_REASON, CASE_COMMENT_NOT_TEXT_REASON, CASE_COMMENT_DOCUMENT_TOO_LARGE_REASON;
14572
- var init_chunk_OFJI6SZT = __esm({
14573
- "../../packages/core/dist/chunk-OFJI6SZT.js"() {
14572
+ var init_chunk_BN7WSDWC = __esm({
14573
+ "../../packages/core/dist/chunk-BN7WSDWC.js"() {
14574
14574
  "use strict";
14575
- init_chunk_AVSVFP3W();
14575
+ init_chunk_7JYZW5BH();
14576
14576
  init_chunk_HPZOVPVT();
14577
14577
  init_chunk_CLGTGGVN();
14578
14578
  init_chunk_HZ6CADSY();
@@ -14611,12 +14611,12 @@ var init_chunk_OFJI6SZT = __esm({
14611
14611
  }
14612
14612
  });
14613
14613
 
14614
- // ../../packages/core/dist/chunk-FT63I5NG.js
14614
+ // ../../packages/core/dist/chunk-CSHU2GN3.js
14615
14615
  var CASE_VERSION_DECISION_REASON_MAX_LENGTH, CASE_VERSION_DECISIONS, caseVersionDecisionReason, reason, lineNumber2, recordCaseReferenceBody, CASE_PASSAGE_REVERSED_REASON, citeCasePassageBody, decideCaseVersionBody, CASE_PASSAGE_LINK_REQUIRED_REASON, CASE_PASSAGE_LINK_CHANGED_REASON, CASE_PASSAGE_NO_TEXT_REASON, CASE_PASSAGE_TEXT_TOO_LARGE_REASON, CASE_PASSAGE_NOT_TEXT_REASON, CASE_PASSAGE_OUT_OF_RANGE_REASON;
14616
- var init_chunk_FT63I5NG = __esm({
14617
- "../../packages/core/dist/chunk-FT63I5NG.js"() {
14616
+ var init_chunk_CSHU2GN3 = __esm({
14617
+ "../../packages/core/dist/chunk-CSHU2GN3.js"() {
14618
14618
  "use strict";
14619
- init_chunk_OFJI6SZT();
14619
+ init_chunk_BN7WSDWC();
14620
14620
  init_chunk_HZ6CADSY();
14621
14621
  init_zod();
14622
14622
  CASE_VERSION_DECISION_REASON_MAX_LENGTH = 2e3;
@@ -14655,13 +14655,13 @@ var init_chunk_FT63I5NG = __esm({
14655
14655
  }
14656
14656
  });
14657
14657
 
14658
- // ../../packages/core/dist/chunk-5MNWTL44.js
14658
+ // ../../packages/core/dist/chunk-YCVI6W6V.js
14659
14659
  var lines, ordered, citeCaseOfficialVersionPassageBody, citeCaseReceivedPassageBody, citeCaseSourcePassageBody, citeCaseInputPassageBody, caseSourceRefSchema;
14660
- var init_chunk_5MNWTL44 = __esm({
14661
- "../../packages/core/dist/chunk-5MNWTL44.js"() {
14660
+ var init_chunk_YCVI6W6V = __esm({
14661
+ "../../packages/core/dist/chunk-YCVI6W6V.js"() {
14662
14662
  "use strict";
14663
- init_chunk_FT63I5NG();
14664
- init_chunk_OFJI6SZT();
14663
+ init_chunk_CSHU2GN3();
14664
+ init_chunk_BN7WSDWC();
14665
14665
  init_chunk_HZ6CADSY();
14666
14666
  init_zod();
14667
14667
  lines = { line_start: casePassageLineSchema, line_end: casePassageLineSchema };
@@ -14679,12 +14679,12 @@ var init_chunk_5MNWTL44 = __esm({
14679
14679
  }
14680
14680
  });
14681
14681
 
14682
- // ../../packages/core/dist/chunk-CQERU52D.js
14682
+ // ../../packages/core/dist/chunk-4MH4X3D4.js
14683
14683
  var CASE_RELATION_TYPE_CODE_PATTERN, CASE_RELATION_TYPE_CODE_MAX_LENGTH, CASE_RELATION_TYPE_NAME_MAX_LENGTH, CASE_RELATION_TYPES_PER_SPACE_MAX, CASE_RELATION_DESCRIPTION_MAX_LENGTH, CASE_RELATION_SIDES, CASE_EXTERNAL_SYSTEM_PATTERN, CASE_EXTERNAL_NUMBER_MAX_LENGTH, CASE_EXTERNAL_URL_MAX_LENGTH, trimmedName2, relationTypeFields, createCaseRelationTypeBody, updateCaseRelationTypeBody, relateCasesBody, addCaseExternalReferenceBody, caseRelationTypeParam, caseRelationParam, caseExternalReferenceParam, caseRelationTypesQuery;
14684
- var init_chunk_CQERU52D = __esm({
14685
- "../../packages/core/dist/chunk-CQERU52D.js"() {
14684
+ var init_chunk_4MH4X3D4 = __esm({
14685
+ "../../packages/core/dist/chunk-4MH4X3D4.js"() {
14686
14686
  "use strict";
14687
- init_chunk_4EHHQFKV();
14687
+ init_chunk_UGKJPB2J();
14688
14688
  init_chunk_CLGTGGVN();
14689
14689
  init_chunk_HZ6CADSY();
14690
14690
  init_zod();
@@ -14725,12 +14725,12 @@ var init_chunk_CQERU52D = __esm({
14725
14725
  }
14726
14726
  });
14727
14727
 
14728
- // ../../packages/core/dist/chunk-S7ONW7DJ.js
14728
+ // ../../packages/core/dist/chunk-B5Y3JXHS.js
14729
14729
  var CASE_CHANGE_TOPICS, caseChangedFrameSchema;
14730
- var init_chunk_S7ONW7DJ = __esm({
14731
- "../../packages/core/dist/chunk-S7ONW7DJ.js"() {
14730
+ var init_chunk_B5Y3JXHS = __esm({
14731
+ "../../packages/core/dist/chunk-B5Y3JXHS.js"() {
14732
14732
  "use strict";
14733
- init_chunk_4EHHQFKV();
14733
+ init_chunk_UGKJPB2J();
14734
14734
  init_chunk_HZ6CADSY();
14735
14735
  init_zod();
14736
14736
  CASE_CHANGE_TOPICS = ["submission", "agenda", "review", "access"];
@@ -14758,14 +14758,14 @@ var init_chunk_PSY4BJ7E = __esm({
14758
14758
  }
14759
14759
  });
14760
14760
 
14761
- // ../../packages/core/dist/chunk-JOMYQVNZ.js
14761
+ // ../../packages/core/dist/chunk-VGNNAETO.js
14762
14762
  var caseInputLinkParam, caseCollectionDocumentOfCaseParam, linkCaseCollectionInputBody, linkCasePreviousOutputInputBody, linkCaseReceivedInputBody, linkCaseInputBody, CASE_LINK_OFFICIAL_VERSION_UNKNOWN_REASON, CASE_LINK_OUTPUT_NOT_PRIOR_REASON, CASE_LINK_RECEIVED_UNKNOWN_REASON, CASE_LINK_DOCUMENT_TYPE_MISMATCH_REASON, CASE_LINK_VERSION_NOT_CURRENT_REASON, CASE_COLLECTION_CASES_PAGE_MAX, caseCollectionCasesQuery, CASE_REFERENCES_PAGE_MAX, caseReferencesQuery;
14763
- var init_chunk_JOMYQVNZ = __esm({
14764
- "../../packages/core/dist/chunk-JOMYQVNZ.js"() {
14763
+ var init_chunk_VGNNAETO = __esm({
14764
+ "../../packages/core/dist/chunk-VGNNAETO.js"() {
14765
14765
  "use strict";
14766
- init_chunk_FT63I5NG();
14767
- init_chunk_5D4QFV76();
14768
- init_chunk_4EHHQFKV();
14766
+ init_chunk_CSHU2GN3();
14767
+ init_chunk_YMFTFCT5();
14768
+ init_chunk_UGKJPB2J();
14769
14769
  init_chunk_CLGTGGVN();
14770
14770
  init_chunk_HZ6CADSY();
14771
14771
  init_zod();
@@ -14928,12 +14928,12 @@ var init_chunk_GCPFVAXX = __esm({
14928
14928
  }
14929
14929
  });
14930
14930
 
14931
- // ../../packages/core/dist/chunk-ONZPYX5Y.js
14931
+ // ../../packages/core/dist/chunk-UMM5CTTH.js
14932
14932
  var CASE_ADJUSTMENT_REASON_MAX_LENGTH, CASE_ADJUSTMENT_DISPENSATION_KINDS, reason2, activateCasePhaseBody, dispenseCaseBody, addCaseTaskBody, addCaseInputBody, caseOwnItemSchema, addCaseItemBody;
14933
- var init_chunk_ONZPYX5Y = __esm({
14934
- "../../packages/core/dist/chunk-ONZPYX5Y.js"() {
14933
+ var init_chunk_UMM5CTTH = __esm({
14934
+ "../../packages/core/dist/chunk-UMM5CTTH.js"() {
14935
14935
  "use strict";
14936
- init_chunk_LYVJU46L();
14936
+ init_chunk_MCLSEATL();
14937
14937
  init_chunk_HZ6CADSY();
14938
14938
  init_zod();
14939
14939
  CASE_ADJUSTMENT_REASON_MAX_LENGTH = 2e3;
@@ -14964,15 +14964,15 @@ var init_chunk_ONZPYX5Y = __esm({
14964
14964
  }
14965
14965
  });
14966
14966
 
14967
- // ../../packages/core/dist/chunk-QNVB4W63.js
14967
+ // ../../packages/core/dist/chunk-IRY6N2QR.js
14968
14968
  var CASE_AGENDA_VALUE_MAX_LENGTH, CASE_AGENDA_JUSTIFICATION_MAX_LENGTH, CASE_AGENDA_EVIDENCE_MAX_LENGTH, CASE_AGENDA_COMMENT_MAX_LENGTH, CASE_AGENDA_VERDICTS, comment, caseAgendaGroupParam, caseAgendaDecisionParam, caseAgendaQuery, caseApprovedDecisionsQuery, proposeCaseAgendaValueBody, decideCaseAgendaBody, dispenseCaseAgendaBody, addCaseDecisionBody;
14969
- var init_chunk_QNVB4W63 = __esm({
14970
- "../../packages/core/dist/chunk-QNVB4W63.js"() {
14969
+ var init_chunk_IRY6N2QR = __esm({
14970
+ "../../packages/core/dist/chunk-IRY6N2QR.js"() {
14971
14971
  "use strict";
14972
- init_chunk_4EHHQFKV();
14973
- init_chunk_LYVJU46L();
14974
- init_chunk_CLGTGGVN();
14972
+ init_chunk_UGKJPB2J();
14973
+ init_chunk_MCLSEATL();
14975
14974
  init_chunk_M2T55BV6();
14975
+ init_chunk_CLGTGGVN();
14976
14976
  init_chunk_HZ6CADSY();
14977
14977
  init_zod();
14978
14978
  CASE_AGENDA_VALUE_MAX_LENGTH = 2e3;
@@ -15011,6 +15011,19 @@ var init_chunk_QNVB4W63 = __esm({
15011
15011
  }
15012
15012
  });
15013
15013
 
15014
+ // ../../packages/core/dist/chunk-NVKU5PPQ.js
15015
+ var ADMIN_SKILL_NAME_REGEX, adminSkillNameParam;
15016
+ var init_chunk_NVKU5PPQ = __esm({
15017
+ "../../packages/core/dist/chunk-NVKU5PPQ.js"() {
15018
+ "use strict";
15019
+ init_zod();
15020
+ ADMIN_SKILL_NAME_REGEX = /^[a-z0-9][a-z0-9-]{0,63}$/;
15021
+ adminSkillNameParam = external_exports.object({
15022
+ name: external_exports.string().regex(ADMIN_SKILL_NAME_REGEX, "invalid skill name")
15023
+ });
15024
+ }
15025
+ });
15026
+
15014
15027
  // ../../packages/core/dist/chunk-FECLIZTY.js
15015
15028
  var TURN_DEADLINE_SECONDS_FLOOR, TURN_DEADLINE_SECONDS_MAX;
15016
15029
  var init_chunk_FECLIZTY = __esm({
@@ -17751,7 +17764,7 @@ var init_chunk_LBDH7LCG = __esm({
17751
17764
  }
17752
17765
  });
17753
17766
 
17754
- // ../../packages/core/dist/chunk-NOVD6LKY.js
17767
+ // ../../packages/core/dist/chunk-6KWTXHFE.js
17755
17768
  function declaresNoConnection(agent) {
17756
17769
  return agent.connection === null && !agent.connection_id;
17757
17770
  }
@@ -18102,10 +18115,10 @@ function refineHubAsCodeCallOpenings(config, ctx) {
18102
18115
  function utf8ByteLength2(value) {
18103
18116
  let bytes = 0;
18104
18117
  for (let i = 0; i < value.length; i++) {
18105
- const code2 = value.charCodeAt(i);
18106
- if (code2 < 128) bytes += 1;
18107
- else if (code2 < 2048) bytes += 2;
18108
- else if (code2 >= 55296 && code2 <= 56319 && i + 1 < value.length && value.charCodeAt(i + 1) >= 56320 && value.charCodeAt(i + 1) <= 57343) {
18118
+ const code3 = value.charCodeAt(i);
18119
+ if (code3 < 128) bytes += 1;
18120
+ else if (code3 < 2048) bytes += 2;
18121
+ else if (code3 >= 55296 && code3 <= 56319 && i + 1 < value.length && value.charCodeAt(i + 1) >= 56320 && value.charCodeAt(i + 1) <= 57343) {
18109
18122
  bytes += 4;
18110
18123
  i++;
18111
18124
  } else bytes += 3;
@@ -18482,9 +18495,9 @@ function skillSectionsAsResources(scope) {
18482
18495
  return out;
18483
18496
  };
18484
18497
  }
18485
- 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, hubAsCodeKanbanFollowupSchema, hubAsCodeKanbanOutcomeSchema, hubAsCodeKanbanStatusSchema, hubAsCodeLaneSchema, hubAsCodePageSchema, MAX_HUB_AS_CODE_PAGE_MANIFEST_CHARS, hubAsCodePagesSchema, hubAsCodeCallOpeningSchema, hubAsCodeCallOpeningFileSchema, MAX_CALL_OPENING_CARRIERS, MAX_CALL_OPENING_AGGREGATE_ENCODED_BYTES, hubAsCodeEvaluationVariableSchema, hubAsCodeNativeToolSchema, hubAsCodeMcpToolSchema, hubAsCodeCustomToolSchema, hubAsCodeStateSchema, hubAsCodeTeamSchema, hubAsCodeResourceFileSchema, hubAsCodeResourceSchema, hubAsCodeAgentResourceSchema, hubAsCodeDelegationToolSchema, hubAsCodeAgentSchema, HUB_AS_CODE_AGENT_KEYS, HUB_AS_CODE_AGENT_TOOL_KEYS, orgAsCodeResourceFolderSchema, orgAsCodeResourceSchema, orgResourcesPayloadSchema, hubAsCodeAutomationSchema, HUB_AS_CODE_AUTOMATION_KEYS, HUB_AS_CODE_AUTOMATION_TRIGGER_KEYS, HUB_AS_CODE_AUTOMATION_TARGET_KEYS, HUB_AS_CODE_AUTOMATION_ACTION_KEYS, HUB_AS_CODE_AUTOMATION_GATE_KEYS, hubAsCodeContactListSchema, HUB_AS_CODE_CONTACT_LIST_KEYS, HUB_AS_CODE_CONTACT_LIST_FILTER_KEYS, hubAsCodeEvalMessageFields, hubAsCodeHistoryTurnSchema, hubAsCodeEvalSchema, hubAsCodeEvalAttachmentFileSchema, hubAsCodeJourneyTurnSchema, hubAsCodeJourneyStepOverrideSchema, hubAsCodeJourneySchema, uuidPattern, ciUuidSchema, flagEntriesOf, boundedHubAsCodeResourcesSchema, isPlainObject, MIN_SKILLS_LAYOUT_CLI, MAX_HUB_AS_CODE_DEPTH, NAMED_DEPTH_SEGMENTS, NAMED_DEPTH_KEY_CHARS, fieldName, hubAsCodeConfigObjectSchema, hubAsCodeConfigSchema, hubAsCodeConnectionSchema, hubAsCodePayloadSchema, ciPullHubIdParam, ciBranchParam, ciPullQuery, ciHubsQuery, ciLookupQuery, ciBranchesQuery, ciDiffDirectionSchema, ciSyncBody, ciPushBody, ciDiffBody, ciPublishBody, ciPublishPreviewBody, ciSyncMcpBody, ciOrgResourcesParam, orgResourcesConfigSchema, ciOrgResourcesPushBody, ciOrgResourcesDiffBody, ciDiffHunkSectionSchema, ciDiffHunkSchema, ciDiffResponseFields, ciDiffResponseSchema, ciOrgSkillsDiffResponseSchema, ciHubIdentitySchema, ciLookupResponseSchema, ciOrganizationsResponseSchema, ciCreateOrganizationResponseSchema, ciHubListItemSchema, ciHubListResponseSchema, CI_APPLY_ENTITY_KINDS, CI_APPLY_OPERATIONS, ciApplyErrorBaseSchema, ciApplyErrorSchema, ciSyncCountSchema, ciSyncChangesSchema, ciSyncWarningSchema, CI_SKIPPABLE_TOOL_GROUPS, ciSkippedEntrySchema, ciSyncResponseSchema, ciPublishResponseSchema, ciMcpDriftEntrySchema, ciSyncMcpResponseSchema, ciPublishPreviewResponseSchema, ciBranchInfoSchema, ciBranchListResponseSchema, ciBranchDeleteResponseSchema, ciOrgResourcesPullFileSchema, ciOrgResourcesPullFolderSchema, ciOrgResourcesPullResourceSchema, ciOrgResourcesPullResponseSchema, ciOrgResourcesPushResponseSchema;
18486
- var init_chunk_NOVD6LKY = __esm({
18487
- "../../packages/core/dist/chunk-NOVD6LKY.js"() {
18498
+ 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, hubAsCodeKanbanFollowupSchema, hubAsCodeKanbanOutcomeSchema, hubAsCodeKanbanStatusSchema, hubAsCodeLaneSchema, hubAsCodePageSchema, MAX_HUB_AS_CODE_PAGE_MANIFEST_CHARS, hubAsCodePagesSchema, hubAsCodeCallOpeningSchema, hubAsCodeCallOpeningFileSchema, MAX_CALL_OPENING_CARRIERS, MAX_CALL_OPENING_AGGREGATE_ENCODED_BYTES, hubAsCodeEvaluationVariableSchema, hubAsCodeNativeToolSchema, hubAsCodeMcpToolSchema, hubAsCodeCustomToolSchema, hubAsCodeStateSchema, hubAsCodeTeamSchema, hubAsCodeResourceFileSchema, hubAsCodeResourceSchema, hubAsCodeAgentResourceSchema, hubAsCodeDelegationToolSchema, hubAsCodeAgentSchema, HUB_AS_CODE_AGENT_KEYS, HUB_AS_CODE_AGENT_TOOL_KEYS, orgAsCodeResourceFolderSchema, orgAsCodeResourceSchema, orgResourcesPayloadSchema, hubAsCodeAutomationSchema, HUB_AS_CODE_AUTOMATION_KEYS, HUB_AS_CODE_AUTOMATION_TRIGGER_KEYS, HUB_AS_CODE_AUTOMATION_TARGET_KEYS, HUB_AS_CODE_AUTOMATION_ACTION_KEYS, HUB_AS_CODE_AUTOMATION_GATE_KEYS, hubAsCodeContactListSchema, HUB_AS_CODE_CONTACT_LIST_KEYS, HUB_AS_CODE_CONTACT_LIST_FILTER_KEYS, hubAsCodeEvalMessageFields, hubAsCodeHistoryTurnSchema, hubAsCodeEvalSchema, hubAsCodeEvalAttachmentFileSchema, hubAsCodeJourneyTurnSchema, hubAsCodeJourneyStepOverrideSchema, hubAsCodeJourneySchema, uuidPattern, ciUuidSchema, flagEntriesOf, boundedHubAsCodeResourcesSchema, isPlainObject, MIN_SKILLS_LAYOUT_CLI, MAX_HUB_AS_CODE_DEPTH, NAMED_DEPTH_SEGMENTS, NAMED_DEPTH_KEY_CHARS, fieldName, hubAsCodeConfigObjectSchema, hubAsCodeConfigSchema, hubAsCodeConnectionSchema, hubAsCodePayloadSchema, ciPullHubIdParam, ciBranchParam, ciPullQuery, ciHubsQuery, ciLookupQuery, ciBranchesQuery, ciDiffDirectionSchema, ciSyncBody, ciPushBody, ciDiffBody, ciPublishBody, ciPublishPreviewBody, ciSyncMcpBody, ciOrgResourcesParam, orgResourcesConfigSchema, ciOrgResourcesPushBody, ciOrgResourcesDiffBody, ciDiffHunkSectionSchema, ciDiffHunkSchema, PAGE_DESIGN_RULES, ciPageDesignFindingSchema, ciDiffResponseFields, ciDiffResponseSchema, ciOrgSkillsDiffResponseSchema, ciHubIdentitySchema, ciLookupResponseSchema, ciOrganizationsResponseSchema, ciCreateOrganizationResponseSchema, ciHubListItemSchema, ciHubListResponseSchema, CI_APPLY_ENTITY_KINDS, CI_APPLY_OPERATIONS, ciApplyErrorBaseSchema, ciApplyErrorSchema, ciSyncCountSchema, ciSyncChangesSchema, ciSyncWarningSchema, CI_SKIPPABLE_TOOL_GROUPS, ciSkippedEntrySchema, ciSyncResponseSchema, ciPublishResponseSchema, ciMcpDriftEntrySchema, ciSyncMcpResponseSchema, ciPublishPreviewResponseSchema, ciBranchInfoSchema, ciBranchListResponseSchema, ciBranchDeleteResponseSchema, ciOrgResourcesPullFileSchema, ciOrgResourcesPullFolderSchema, ciOrgResourcesPullResourceSchema, ciOrgResourcesPullResponseSchema, ciOrgResourcesPushResponseSchema;
18499
+ var init_chunk_6KWTXHFE = __esm({
18500
+ "../../packages/core/dist/chunk-6KWTXHFE.js"() {
18488
18501
  "use strict";
18489
18502
  init_chunk_QG3XMUEN();
18490
18503
  init_chunk_EBUWHIFV();
@@ -19448,6 +19461,20 @@ var init_chunk_NOVD6LKY = __esm({
19448
19461
  name: external_exports.string().nullable(),
19449
19462
  fields: external_exports.array(external_exports.string())
19450
19463
  });
19464
+ PAGE_DESIGN_RULES = [
19465
+ "hard-coded-color",
19466
+ "no-theme",
19467
+ "fixed-width",
19468
+ "table-overflow",
19469
+ "remote-load",
19470
+ "list-empty-state",
19471
+ "list-error-state"
19472
+ ];
19473
+ ciPageDesignFindingSchema = external_exports.object({
19474
+ page: external_exports.string(),
19475
+ rule: external_exports.enum(PAGE_DESIGN_RULES),
19476
+ message: external_exports.string()
19477
+ });
19451
19478
  ciDiffResponseFields = {
19452
19479
  has_changes: external_exports.boolean(),
19453
19480
  direction: ciDiffDirectionSchema,
@@ -19481,7 +19508,15 @@ var init_chunk_NOVD6LKY = __esm({
19481
19508
  * without this the silent no-op is invisible. Optional for back-compat with
19482
19509
  * older backends. See gh hub-branching.
19483
19510
  */
19484
- preview_label: external_exports.string().nullable().optional()
19511
+ preview_label: external_exports.string().nullable().optional(),
19512
+ /**
19513
+ * The design lint's findings for the pages a push diff carries, in their order
19514
+ * (`pageDesignFindings`); empty for a pull diff, which writes no page. Never in `warnings`, so a
19515
+ * CLI that lints its own pages, as every CLI before this field did, prints each finding once.
19516
+ * Absent from a server older than the field; a client then lints its own pages with the same
19517
+ * function.
19518
+ */
19519
+ page_design: external_exports.array(ciPageDesignFindingSchema).optional()
19485
19520
  });
19486
19521
  ciOrgSkillsDiffResponseSchema = external_exports.object({
19487
19522
  ...ciDiffResponseFields,
@@ -19697,19 +19732,6 @@ var init_chunk_NOVD6LKY = __esm({
19697
19732
  }
19698
19733
  });
19699
19734
 
19700
- // ../../packages/core/dist/chunk-NVKU5PPQ.js
19701
- var ADMIN_SKILL_NAME_REGEX, adminSkillNameParam;
19702
- var init_chunk_NVKU5PPQ = __esm({
19703
- "../../packages/core/dist/chunk-NVKU5PPQ.js"() {
19704
- "use strict";
19705
- init_zod();
19706
- ADMIN_SKILL_NAME_REGEX = /^[a-z0-9][a-z0-9-]{0,63}$/;
19707
- adminSkillNameParam = external_exports.object({
19708
- name: external_exports.string().regex(ADMIN_SKILL_NAME_REGEX, "invalid skill name")
19709
- });
19710
- }
19711
- });
19712
-
19713
19735
  // ../../packages/core/dist/chunk-SOJMWM63.js
19714
19736
  var init_chunk_SOJMWM63 = __esm({
19715
19737
  "../../packages/core/dist/chunk-SOJMWM63.js"() {
@@ -19760,6 +19782,7 @@ var init_chunk_ZRXP6OOJ = __esm({
19760
19782
  var init_contracts = __esm({
19761
19783
  "../../packages/core/dist/contracts/index.js"() {
19762
19784
  "use strict";
19785
+ init_chunk_AYLAGFAD();
19763
19786
  init_chunk_OPJ5OACS();
19764
19787
  init_chunk_YVY2TZK2();
19765
19788
  init_chunk_VXEAR36B();
@@ -19769,7 +19792,6 @@ var init_contracts = __esm({
19769
19792
  init_chunk_C7UAGRXF();
19770
19793
  init_chunk_IPXBFWUU();
19771
19794
  init_chunk_63UWXV4T();
19772
- init_chunk_AYLAGFAD();
19773
19795
  init_chunk_ZC6YGHNX();
19774
19796
  init_chunk_HIGKBEPF();
19775
19797
  init_chunk_IPDOHAZ5();
@@ -19777,66 +19799,68 @@ var init_contracts = __esm({
19777
19799
  init_chunk_TVUDMGWV();
19778
19800
  init_chunk_WTIGECE5();
19779
19801
  init_chunk_WDAXZDJO();
19802
+ init_chunk_ZXK6N2HN();
19780
19803
  init_chunk_Y7CFCYX4();
19781
19804
  init_chunk_OS6EKEP4();
19782
19805
  init_chunk_5DGHIY7L();
19783
19806
  init_chunk_2IPHTFV5();
19807
+ init_chunk_I3O2RACG();
19784
19808
  init_chunk_CMRECH67();
19785
19809
  init_chunk_34LE6P7E();
19786
19810
  init_chunk_FPSDNS2E();
19787
19811
  init_chunk_TZH6DKKJ();
19788
19812
  init_chunk_SSPK6ISL();
19789
- init_chunk_ZXK6N2HN();
19813
+ init_chunk_SY6PLCPK();
19790
19814
  init_chunk_2ZZZHXZR();
19791
19815
  init_chunk_YUZFHVB2();
19792
- init_chunk_I3O2RACG();
19816
+ init_chunk_LKBSHANA();
19793
19817
  init_chunk_LX3D5LCB();
19794
19818
  init_chunk_C4HEZ7ZI();
19795
19819
  init_chunk_IR2NOSI3();
19796
19820
  init_chunk_OPETF4GS();
19797
- init_chunk_SY6PLCPK();
19821
+ init_chunk_V4FRPRH5();
19798
19822
  init_chunk_LWMLR2WI();
19799
19823
  init_chunk_ACGAI25T();
19800
19824
  init_chunk_MH4O3YEX();
19801
19825
  init_chunk_V2CXEU5X();
19802
19826
  init_chunk_KSTYTQ7I();
19803
- init_chunk_LKBSHANA();
19827
+ init_chunk_7CYHPF35();
19804
19828
  init_chunk_NETRUHZF();
19805
19829
  init_chunk_JDJ4EUOL();
19806
19830
  init_chunk_UCYWGWQT();
19807
19831
  init_chunk_6AYIXGDT();
19808
19832
  init_chunk_YULHXJ5M();
19809
- init_chunk_V4FRPRH5();
19810
19833
  init_chunk_ME7AKVSP();
19811
19834
  init_chunk_KY3ZNL3E();
19812
19835
  init_chunk_X4IDZLLS();
19813
- init_chunk_7CYHPF35();
19814
- init_chunk_4GVO7ZLI();
19815
- init_chunk_G4QNT67H();
19836
+ init_chunk_BE4ATZB7();
19837
+ init_chunk_3SYJ5V22();
19838
+ init_chunk_COZBA6Z4();
19816
19839
  init_chunk_2WVZOVEF();
19817
19840
  init_chunk_26PIYACX();
19818
- init_chunk_5MNWTL44();
19819
- init_chunk_CQERU52D();
19820
- init_chunk_S7ONW7DJ();
19841
+ init_chunk_YCVI6W6V();
19842
+ init_chunk_4MH4X3D4();
19843
+ init_chunk_B5Y3JXHS();
19821
19844
  init_chunk_PSY4BJ7E();
19822
- init_chunk_EFX3OU2G();
19823
- init_chunk_3BFHRPHD();
19824
- init_chunk_JOMYQVNZ();
19825
- init_chunk_FT63I5NG();
19826
- init_chunk_5D4QFV76();
19827
- init_chunk_3SZD2H6D();
19845
+ init_chunk_6ITRMGLQ();
19846
+ init_chunk_VGNNAETO();
19847
+ init_chunk_CSHU2GN3();
19848
+ init_chunk_YMFTFCT5();
19849
+ init_chunk_J3HQTL6M();
19828
19850
  init_chunk_ZJA3UZMG();
19829
19851
  init_chunk_4GJFEMVI();
19830
19852
  init_chunk_YWZFB34T();
19831
19853
  init_chunk_PZPOUXJR();
19832
19854
  init_chunk_5PKKFSSF();
19833
19855
  init_chunk_GCPFVAXX();
19834
- init_chunk_ONZPYX5Y();
19835
- init_chunk_QNVB4W63();
19856
+ init_chunk_UMM5CTTH();
19857
+ init_chunk_IRY6N2QR();
19858
+ init_chunk_NVKU5PPQ();
19836
19859
  init_chunk_UM2UFZAQ();
19837
19860
  init_chunk_FECLIZTY();
19838
19861
  init_chunk_BFG4ZWR4();
19839
19862
  init_chunk_UY32MQHG();
19863
+ init_chunk_AZOWABU5();
19840
19864
  init_chunk_5QVZHYHM();
19841
19865
  init_chunk_UEJOG2Q7();
19842
19866
  init_chunk_KEN2DASI();
@@ -19844,8 +19868,7 @@ var init_contracts = __esm({
19844
19868
  init_chunk_R6Y377AW();
19845
19869
  init_chunk_UAOHHCW5();
19846
19870
  init_chunk_ULQGJUXZ();
19847
- init_chunk_AZOWABU5();
19848
- init_chunk_NOVD6LKY();
19871
+ init_chunk_6KWTXHFE();
19849
19872
  init_chunk_QG3XMUEN();
19850
19873
  init_chunk_EBUWHIFV();
19851
19874
  init_chunk_5YZ3R7KF();
@@ -19858,18 +19881,17 @@ var init_contracts = __esm({
19858
19881
  init_chunk_ZANBA4K4();
19859
19882
  init_chunk_QT7R3TGR();
19860
19883
  init_chunk_OLBDDBKV();
19861
- init_chunk_NVKU5PPQ();
19862
19884
  init_chunk_AUD5MVHU();
19863
19885
  init_chunk_SOJMWM63();
19864
19886
  init_chunk_5FO3GNKP();
19865
19887
  init_chunk_AMMLEB4T();
19866
19888
  init_chunk_IBL7FANV();
19889
+ init_chunk_KB5RK3RP();
19867
19890
  init_chunk_S4HVRNEQ();
19868
19891
  init_chunk_6J742GLA();
19869
19892
  init_chunk_ZRXP6OOJ();
19870
19893
  init_chunk_BGNWWR6B();
19871
19894
  init_chunk_ZIGA5RCU();
19872
- init_chunk_KB5RK3RP();
19873
19895
  init_chunk_ZDTX3DG5();
19874
19896
  init_chunk_3MF6FWS5();
19875
19897
  init_chunk_JP7XIMUA();
@@ -19882,14 +19904,14 @@ var init_contracts = __esm({
19882
19904
  init_chunk_6TSQ5HXC();
19883
19905
  init_chunk_64HCHXKB();
19884
19906
  init_chunk_YR7QALGP();
19885
- init_chunk_OFJI6SZT();
19886
- init_chunk_AVSVFP3W();
19907
+ init_chunk_BN7WSDWC();
19908
+ init_chunk_7JYZW5BH();
19887
19909
  init_chunk_HPZOVPVT();
19888
- init_chunk_4EHHQFKV();
19889
- init_chunk_LYVJU46L();
19910
+ init_chunk_UGKJPB2J();
19911
+ init_chunk_MCLSEATL();
19912
+ init_chunk_M2T55BV6();
19890
19913
  init_chunk_CLGTGGVN();
19891
19914
  init_chunk_KWRHZBGU();
19892
- init_chunk_M2T55BV6();
19893
19915
  init_chunk_VYINA6YP();
19894
19916
  init_chunk_ZVXO3XL6();
19895
19917
  init_chunk_FBV7NLKO();
@@ -20039,10 +20061,10 @@ var init_dist = __esm({
20039
20061
  init_chunk_5FO3GNKP();
20040
20062
  init_chunk_AMMLEB4T();
20041
20063
  init_chunk_IBL7FANV();
20064
+ init_chunk_KB5RK3RP();
20042
20065
  init_chunk_SKP67RXU();
20043
20066
  init_chunk_S4HVRNEQ();
20044
20067
  init_chunk_RPGBR5IN();
20045
- init_chunk_KB5RK3RP();
20046
20068
  init_chunk_ZDTX3DG5();
20047
20069
  init_chunk_3MF6FWS5();
20048
20070
  init_chunk_JP7XIMUA();
@@ -21695,10 +21717,10 @@ var init_case_type_drafts = __esm({
21695
21717
  "../../packages/core/dist/contracts/case-type-drafts.js"() {
21696
21718
  "use strict";
21697
21719
  init_chunk_HPZOVPVT();
21698
- init_chunk_LYVJU46L();
21720
+ init_chunk_MCLSEATL();
21721
+ init_chunk_M2T55BV6();
21699
21722
  init_chunk_CLGTGGVN();
21700
21723
  init_chunk_KWRHZBGU();
21701
- init_chunk_M2T55BV6();
21702
21724
  init_chunk_VYINA6YP();
21703
21725
  init_chunk_ZVXO3XL6();
21704
21726
  init_chunk_FBV7NLKO();
@@ -21770,16 +21792,16 @@ var init_case_type_drafts = __esm({
21770
21792
  var init_case_received_documents = __esm({
21771
21793
  "../../packages/core/dist/contracts/case-received-documents.js"() {
21772
21794
  "use strict";
21773
- init_chunk_4GVO7ZLI();
21774
- init_chunk_5D4QFV76();
21775
- init_chunk_3SZD2H6D();
21795
+ init_chunk_BE4ATZB7();
21796
+ init_chunk_YMFTFCT5();
21797
+ init_chunk_J3HQTL6M();
21776
21798
  init_chunk_ZJA3UZMG();
21777
21799
  init_chunk_HPZOVPVT();
21778
- init_chunk_4EHHQFKV();
21779
- init_chunk_LYVJU46L();
21800
+ init_chunk_UGKJPB2J();
21801
+ init_chunk_MCLSEATL();
21802
+ init_chunk_M2T55BV6();
21780
21803
  init_chunk_CLGTGGVN();
21781
21804
  init_chunk_KWRHZBGU();
21782
- init_chunk_M2T55BV6();
21783
21805
  init_chunk_VYINA6YP();
21784
21806
  init_chunk_ZVXO3XL6();
21785
21807
  init_chunk_FBV7NLKO();
@@ -22401,8 +22423,8 @@ var init_api_client = __esm({
22401
22423
  async me() {
22402
22424
  return this.request("GET", "/api/auth/me");
22403
22425
  }
22404
- async verifySecondFactor(code2) {
22405
- return this.request("POST", "/api/auth/second-factor/verify", { code: code2 });
22426
+ async verifySecondFactor(code3) {
22427
+ return this.request("POST", "/api/auth/second-factor/verify", { code: code3 });
22406
22428
  }
22407
22429
  async useSecondFactorRecoveryCode(recoveryCode) {
22408
22430
  return this.request("POST", "/api/auth/second-factor/recovery", { recovery_code: recoveryCode });
@@ -23127,11 +23149,11 @@ function friendlyHint(err) {
23127
23149
  return "Couldn't reach WayAI \u2014 check your network connection and try again.";
23128
23150
  }
23129
23151
  if (!(err instanceof ApiError)) return null;
23130
- const code2 = extractApiErrorCode(err);
23131
- if (code2 === SECOND_FACTOR_REQUIRED_CODE) {
23152
+ const code3 = extractApiErrorCode(err);
23153
+ if (code3 === SECOND_FACTOR_REQUIRED_CODE) {
23132
23154
  return "This action needs a two-step verification code. Run `wayai 2fa verify`, then try again.";
23133
23155
  }
23134
- if (code2 === SECOND_FACTOR_ENROLLMENT_REQUIRED_CODE) {
23156
+ if (code3 === SECOND_FACTOR_ENROLLMENT_REQUIRED_CODE) {
23135
23157
  return "This organization requires two-step verification. Turn it on in your WayAI account settings, then try again.";
23136
23158
  }
23137
23159
  if (err.body.includes("FREE_PLAN_RESTRICTION")) {
@@ -23967,13 +23989,13 @@ function generateState() {
23967
23989
  function expiresInToIso(expiresInSeconds) {
23968
23990
  return new Date(Date.now() + expiresInSeconds * 1e3).toISOString();
23969
23991
  }
23970
- async function exchangeCodeForTokens(authkitDomain, clientId, code2, codeVerifier, redirectUri) {
23992
+ async function exchangeCodeForTokens(authkitDomain, clientId, code3, codeVerifier, redirectUri) {
23971
23993
  const response = await fetch(`${authkitDomain}/oauth2/token`, {
23972
23994
  method: "POST",
23973
23995
  headers: { "Content-Type": "application/x-www-form-urlencoded" },
23974
23996
  body: new URLSearchParams({
23975
23997
  grant_type: "authorization_code",
23976
- code: code2,
23998
+ code: code3,
23977
23999
  code_verifier: codeVerifier,
23978
24000
  redirect_uri: redirectUri,
23979
24001
  client_id: clientId
@@ -24024,7 +24046,7 @@ function startCallbackServer(port, expectedState, timeoutMs = 12e4) {
24024
24046
  const server = http.createServer((req, res) => {
24025
24047
  const url = new URL(req.url || "/", `http://127.0.0.1:${port}`);
24026
24048
  if (url.pathname === "/callback") {
24027
- const code2 = url.searchParams.get("code");
24049
+ const code3 = url.searchParams.get("code");
24028
24050
  const state = url.searchParams.get("state");
24029
24051
  const error = url.searchParams.get("error");
24030
24052
  const errorDescription = url.searchParams.get("error_description");
@@ -24042,11 +24064,11 @@ function startCallbackServer(port, expectedState, timeoutMs = 12e4) {
24042
24064
  reject(new Error("OAuth state mismatch \u2014 possible CSRF attack"));
24043
24065
  return;
24044
24066
  }
24045
- if (code2) {
24067
+ if (code3) {
24046
24068
  res.writeHead(200, { "Content-Type": "text/html" });
24047
24069
  res.end("<html><body><h2>Login successful!</h2><p>You can close this tab and return to your terminal.</p></body></html>");
24048
24070
  server.close();
24049
- resolve19({ code: code2, port });
24071
+ resolve19({ code: code3, port });
24050
24072
  } else {
24051
24073
  res.writeHead(400, { "Content-Type": "text/html" });
24052
24074
  res.end("<html><body><h2>Login failed</h2><p>No authorization code received</p></body></html>");
@@ -24358,12 +24380,12 @@ Open this URL in your browser to log in:
24358
24380
  } else {
24359
24381
  console.log("Opening browser for login...");
24360
24382
  }
24361
- const { code: code2 } = await callbackPromise;
24383
+ const { code: code3 } = await callbackPromise;
24362
24384
  console.log("Exchanging authorization code...");
24363
24385
  const tokens2 = await exchangeCodeForTokens(
24364
24386
  authkitDomain,
24365
24387
  clientId,
24366
- code2,
24388
+ code3,
24367
24389
  codeVerifier,
24368
24390
  redirectUri
24369
24391
  );
@@ -26686,7 +26708,7 @@ var init_hub_materializer = __esm({
26686
26708
  var init_ci = __esm({
26687
26709
  "../../packages/core/dist/contracts/ci.js"() {
26688
26710
  "use strict";
26689
- init_chunk_NOVD6LKY();
26711
+ init_chunk_6KWTXHFE();
26690
26712
  init_chunk_QG3XMUEN();
26691
26713
  init_chunk_EBUWHIFV();
26692
26714
  init_chunk_5YZ3R7KF();
@@ -26722,343 +26744,6 @@ var init_ci = __esm({
26722
26744
  }
26723
26745
  });
26724
26746
 
26725
- // src/lib/eval-format.ts
26726
- function runNotes(unproven, inProgress) {
26727
- return [
26728
- unproven > 0 ? `${unproven} unproven` : "",
26729
- inProgress > 0 ? `${inProgress} in progress` : ""
26730
- ].filter(Boolean);
26731
- }
26732
- function printResultsTable(results, mode) {
26733
- let totalPassed = 0;
26734
- let totalEvaluated = 0;
26735
- let totalUnproven = 0;
26736
- let totalInProgress = 0;
26737
- for (const r of results) {
26738
- const evalName = r.eval?.eval_name || r.eval_id.slice(0, 8);
26739
- const evaluatedRuns = evaluatedRunCount(r);
26740
- const unproven = unprovenRunCount(r);
26741
- const inProgress = (r.running_runs ?? 0) + (r.pending_runs ?? 0);
26742
- const notes2 = runNotes(unproven, inProgress);
26743
- const passed = notes2.length > 0 ? `${r.successful_runs}/${evaluatedRuns} passed (${notes2.join(", ")})` : `${r.successful_runs}/${evaluatedRuns} passed`;
26744
- const avgTime = r.avg_execution_time_ms != null ? `avg ${(r.avg_execution_time_ms / 1e3).toFixed(1)}s` : "";
26745
- let scoresStr = "";
26746
- if (r.aggregated_scores) {
26747
- const parts = Object.entries(r.aggregated_scores).map(
26748
- ([key, val]) => mode === "compact" ? `${key}: ${Math.round(val.avg * 100)}%` : `${key}: avg ${Math.round(val.avg * 100)}%, min ${Math.round(val.min * 100)}%, max ${Math.round(val.max * 100)}%`
26749
- );
26750
- if (parts.length > 0) scoresStr = " " + parts.join(" ");
26751
- }
26752
- console.log(` ${evalName.padEnd(20)} ${passed.padEnd(14)} ${avgTime}${scoresStr}`);
26753
- totalPassed += r.successful_runs;
26754
- totalEvaluated += evaluatedRuns;
26755
- totalUnproven += unproven;
26756
- totalInProgress += inProgress;
26757
- }
26758
- const pct = totalEvaluated > 0 ? (totalPassed / totalEvaluated * 100).toFixed(1) : "0.0";
26759
- const notes = runNotes(totalUnproven, totalInProgress);
26760
- const note = notes.length > 0 ? ` \u2014 ${notes.join(", ")}` : "";
26761
- console.log(`
26762
- Overall: ${totalPassed}/${totalEvaluated} passed (${pct}%)${note}`);
26763
- }
26764
- function truncate(str, maxLen) {
26765
- if (str.length <= maxLen) return str;
26766
- return str.slice(0, maxLen - 3) + "...";
26767
- }
26768
- function summarizeResponse(resp, maxLen = 80) {
26769
- if (!resp) return "(none)";
26770
- const parts = [];
26771
- const content = typeof resp.content === "string" ? resp.content.trim() : "";
26772
- if (content) parts.push(`"${truncate(content, maxLen)}"`);
26773
- if (resp.tool_calls && resp.tool_calls.length > 0) {
26774
- parts.push(
26775
- resp.tool_calls.map((tc) => `${tc.function.name}(${truncate(tc.function.arguments, maxLen)})`).join(", ")
26776
- );
26777
- }
26778
- return parts.length > 0 ? parts.join(" + ") : "(empty)";
26779
- }
26780
- function isFailingRun(run) {
26781
- if (run.run_status && !TERMINAL_RUN_STATUSES.has(run.run_status)) return false;
26782
- return run.response_match !== true;
26783
- }
26784
- function failureTag(run) {
26785
- switch (run.outcome_kind) {
26786
- case "execution_error":
26787
- return "ERROR";
26788
- case "evaluation_invalid":
26789
- return "INVALID";
26790
- // `assertion_failure`, and any pre-taxonomy payload.
26791
- default:
26792
- return "FAIL";
26793
- }
26794
- }
26795
- function printFailingRuns(runs) {
26796
- const failing = runs.filter(isFailingRun);
26797
- if (failing.length === 0) return;
26798
- console.log(`
26799
- Failures (${failing.length}):`);
26800
- let anyComment = false;
26801
- for (const run of failing) {
26802
- const evalName = run.eval?.eval_name || run.eval_id?.slice(0, 8) || "eval";
26803
- console.log(` ${evalName} \u2014 Run #${run.run_number} [${failureTag(run)}]`);
26804
- if (run.error_message) {
26805
- console.log(` Error: ${run.error_message}`);
26806
- }
26807
- if (run.response_comment) {
26808
- anyComment = true;
26809
- console.log(` Why: ${run.response_comment}`);
26810
- }
26811
- if (run.expected_response) {
26812
- console.log(` Expected: ${summarizeResponse(run.expected_response)}`);
26813
- console.log(` Actual: ${summarizeResponse(run.eval_response)}`);
26814
- }
26815
- }
26816
- if (!anyComment) {
26817
- console.log(`
26818
- ${NO_EVALUATOR_NOTES_HINT}`);
26819
- }
26820
- }
26821
- var NO_EVALUATOR_NOTES_HINT, TERMINAL_RUN_STATUSES;
26822
- var init_eval_format = __esm({
26823
- "src/lib/eval-format.ts"() {
26824
- "use strict";
26825
- init_contracts();
26826
- NO_EVALUATOR_NOTES_HINT = "No evaluator notes found \u2014 add a `notes` evaluation variable to the message_evaluator agent to surface its reasoning here.";
26827
- TERMINAL_RUN_STATUSES = /* @__PURE__ */ new Set(["completed", "failed"]);
26828
- }
26829
- });
26830
-
26831
- // src/lib/page-design-lint.ts
26832
- function attributesOf(tag) {
26833
- const out = /* @__PURE__ */ new Map();
26834
- for (const m of tag.matchAll(ATTRIBUTE)) out.set(m[1].toLowerCase(), (m[2] ?? m[3] ?? m[4] ?? "").trim());
26835
- return out;
26836
- }
26837
- function splitPage(html) {
26838
- const scripts = [];
26839
- const withoutScripts = html.replace(SCRIPT_ELEMENT, (_m, attrs, body) => {
26840
- scripts.push(body);
26841
- return `<script${attrs}></script>`;
26842
- });
26843
- const withoutComments = withoutScripts.replace(/<!--[\s\S]*?-->/g, "");
26844
- const css = [];
26845
- const markup = withoutComments.replace(STYLE_ELEMENT, (_m, body) => {
26846
- css.push({ text: body, attribute: false });
26847
- return "<style></style>";
26848
- });
26849
- for (const tag of markup.matchAll(TAG)) {
26850
- const style = attributesOf(tag[2]).get("style");
26851
- if (style) css.push({ text: style, attribute: true });
26852
- }
26853
- return { markup, css, scripts: scripts.join("\n") };
26854
- }
26855
- function removeCalls(value, name, keep = () => false) {
26856
- const lower = value.toLowerCase();
26857
- const open = `${name}(`;
26858
- let out = "";
26859
- let from = 0;
26860
- for (let at = lower.indexOf(open); at !== -1; at = lower.indexOf(open, from)) {
26861
- let depth = 0;
26862
- let end = at + name.length;
26863
- for (; end < value.length; end++) {
26864
- if (value[end] === "(") depth++;
26865
- else if (value[end] === ")" && --depth === 0) break;
26866
- }
26867
- const inner = value.slice(at + open.length, end);
26868
- out += value.slice(from, at) + (keep(inner) ? value.slice(at, end + 1) : "");
26869
- from = end + 1;
26870
- }
26871
- return out + value.slice(from);
26872
- }
26873
- function readCss(source, attribute) {
26874
- const loads = [];
26875
- let css = source.replace(/\/\*[\s\S]*?\*\//g, "");
26876
- css = css.replace(IMPORT_RULE, (_m, url) => {
26877
- loads.push(url || "@import");
26878
- return "";
26879
- });
26880
- css = css.replace(URL_CALL, (_m, a, b, c) => {
26881
- loads.push((a ?? b ?? c ?? "").trim());
26882
- return "url()";
26883
- });
26884
- css = css.replace(/"[^"]*"|'[^']*'/g, '""');
26885
- const declarations = [];
26886
- const declare = (body, context) => {
26887
- for (const piece of body.split(";")) {
26888
- const colon = piece.indexOf(":");
26889
- if (colon === -1) continue;
26890
- const prop = piece.slice(0, colon).trim().toLowerCase();
26891
- const value = piece.slice(colon + 1).replace(/\s+/g, " ").trim();
26892
- if (/^-?-?[a-z][a-z0-9-]*$/.test(prop) && value) declarations.push({ prop, value, context });
26893
- }
26894
- };
26895
- if (attribute) {
26896
- declare(css, []);
26897
- return { declarations, loads };
26898
- }
26899
- const stack = [];
26900
- let text5 = "";
26901
- for (const ch of css) {
26902
- if (ch === "{") {
26903
- stack.push({ prelude: text5.trim(), body: "" });
26904
- text5 = "";
26905
- } else if (ch === "}") {
26906
- const block2 = stack.pop();
26907
- if (block2) declare(block2.body + text5, [...stack.map((b) => b.prelude), block2.prelude]);
26908
- text5 = "";
26909
- } else if (ch === ";") {
26910
- if (stack.length > 0) stack[stack.length - 1].body += `${text5};`;
26911
- text5 = "";
26912
- } else {
26913
- text5 += ch;
26914
- }
26915
- }
26916
- return { declarations, loads };
26917
- }
26918
- function hardCodedColor(d) {
26919
- if (!COLOR_PROPERTY.test(d.prop)) return false;
26920
- const tokenMixesGone = removeCalls(d.value, "color-mix", (inner) => !/var\(/i.test(inner));
26921
- const literal = removeCalls(tokenMixesGone, "var");
26922
- return HEX_COLOR.test(literal) || COLOR_FUNCTION.test(literal);
26923
- }
26924
- function fixedWidth(d) {
26925
- if (d.prop !== "width" && d.prop !== "inline-size") return false;
26926
- const px = /^(\d+(?:\.\d+)?)px$/i.exec(d.value.replace(/\s*!important$/i, ""));
26927
- return px !== null && Number(px[1]) > PHONE_WIDTH_MAX_PX && !inQuery(d);
26928
- }
26929
- function tableFits(html, declarations) {
26930
- if (html.includes("wayai-table-wrap")) return true;
26931
- return declarations.some((d) => /^overflow(?:-x|-inline)?$/.test(d.prop) && /\b(?:auto|scroll)\b/.test(d.value) || inQuery(d) && d.context.some((p) => !p.startsWith("@") && TABLE_SELECTOR.test(p)));
26932
- }
26933
- function markupLoads(markup) {
26934
- const loads = [];
26935
- for (const tag of markup.matchAll(TAG)) {
26936
- const name = tag[1].toLowerCase();
26937
- const attrs = attributesOf(tag[2]);
26938
- if (name === "script") {
26939
- const src = attrs.get("src");
26940
- if (src) loads.push(src);
26941
- } else if (name === "link") {
26942
- const href = attrs.get("href");
26943
- const rel = attrs.get("rel") ?? "";
26944
- if (href && (/\bstylesheet\b/i.test(rel) || /icon|preload|prefetch|manifest/i.test(rel) && !LOCAL_URL.test(href))) {
26945
- loads.push(href);
26946
- }
26947
- } else if (name === "source") {
26948
- const src = attrs.get("src");
26949
- const srcset = attrs.get("srcset");
26950
- if (src) loads.push(src);
26951
- if (srcset && !LOCAL_URL.test(srcset)) loads.push(srcset);
26952
- } else if (IMAGE_ELEMENTS.has(name)) {
26953
- for (const key of ["src", "srcset", "href"]) {
26954
- const url = attrs.get(key);
26955
- if (url && !LOCAL_URL.test(url)) loads.push(url);
26956
- }
26957
- } else if (MEDIA_ELEMENTS.has(name)) {
26958
- for (const key of ["src", "poster"]) {
26959
- const url = attrs.get(key);
26960
- if (url) loads.push(url);
26961
- }
26962
- } else if (name === "object") {
26963
- const data = attrs.get("data");
26964
- if (data) loads.push(data);
26965
- }
26966
- }
26967
- return loads;
26968
- }
26969
- function lintPageDesign(page) {
26970
- const { html } = page;
26971
- const parts = splitPage(html);
26972
- const read = parts.css.map((c) => readCss(c.text, c.attribute));
26973
- const declarations = read.flatMap((r) => r.declarations);
26974
- const findings = [];
26975
- const colors = declarations.filter(hardCodedColor);
26976
- if (colors.length > 0) {
26977
- findings.push({
26978
- rule: "hard-coded-color",
26979
- message: `${plural(colors.length, "hard-coded color")} in its CSS, e.g. \`${shown(`${colors[0].prop}: ${colors[0].value}`)}\`: style with the tokens (var(--color-...), var(--wayai-...)) so the page follows the viewer's light or dark theme`
26980
- });
26981
- }
26982
- if (!/data-theme|applyDocumentTheme/.test(html)) {
26983
- findings.push({
26984
- rule: "no-theme",
26985
- message: "never sets data-theme on <html> from the host context's theme, so it keeps the theme it opened in when the viewer switches between light and dark"
26986
- });
26987
- }
26988
- const widths = declarations.filter(fixedWidth);
26989
- if (widths.length > 0) {
26990
- findings.push({
26991
- rule: "fixed-width",
26992
- message: `${plural(widths.length, "fixed width")} wider than a phone (${PHONE_WIDTH_MAX_PX}px) outside a media or container query, e.g. \`${widths[0].prop}: ${widths[0].value}\`: lay the page out mobile-first and widen it inside a media or container query`
26993
- });
26994
- }
26995
- if ((/<table\b/i.test(html) || /createElement\(\s*['"`]table['"`]/.test(html)) && !tableFits(html, declarations)) {
26996
- findings.push({
26997
- rule: "table-overflow",
26998
- message: "has a table with no sideways scroll or narrow layout: wrap it in a wayai-table-wrap element, or turn its rows into cards inside a media or container query"
26999
- });
27000
- }
27001
- const loads = [
27002
- ...markupLoads(parts.markup),
27003
- ...read.flatMap((r) => r.loads).filter((url) => url !== "" && !LOCAL_URL.test(url)),
27004
- ...[...parts.scripts.matchAll(SCRIPT_LOAD)].map((m) => m[2])
27005
- ];
27006
- if (loads.length > 0) {
27007
- findings.push({
27008
- rule: "remote-load",
27009
- message: `${plural(loads.length, "load")} the page's sandbox refuses, e.g. \`${shown(loads[0])}\`: a page has no network, so inline scripts and styles, and give images and fonts as data: URLs`
27010
- });
27011
- }
27012
- const tools = page.manifest.tools;
27013
- if (Array.isArray(tools) && tools.length > 0 && LIST_MARKUP.test(html)) {
27014
- if (!html.includes("wayai-empty") && !ZERO_ROWS_CHECK.test(html)) {
27015
- findings.push({
27016
- rule: "list-empty-state",
27017
- message: "fills a list from its tools but shows no empty state (no wayai-empty element and no check for zero rows): say what is missing when a list comes back empty"
27018
- });
27019
- }
27020
- if (!/\bisError\b/.test(html) && !html.includes("wayai-alert")) {
27021
- findings.push({
27022
- rule: "list-error-state",
27023
- message: "calls its tools but never reads a result's isError or shows a wayai-alert: show the viewer why a call failed"
27024
- });
27025
- }
27026
- }
27027
- return findings;
27028
- }
27029
- function pageDesignWarnings(pages) {
27030
- if (!pages) return [];
27031
- return pages.flatMap((page) => lintPageDesign(page).map((f) => `page "${String(page.manifest.slug)}" (design): ${f.message}`));
27032
- }
27033
- var PHONE_WIDTH_MAX_PX, SCRIPT_ELEMENT, STYLE_ELEMENT, TAG, ATTRIBUTE, URL_CALL, IMPORT_RULE, inQuery, COLOR_PROPERTY, HEX_COLOR, COLOR_FUNCTION, TABLE_SELECTOR, LOCAL_URL, IMAGE_ELEMENTS, MEDIA_ELEMENTS, SCRIPT_LOAD, LIST_MARKUP, ZERO_ROWS_CHECK, plural, shown;
27034
- var init_page_design_lint = __esm({
27035
- "src/lib/page-design-lint.ts"() {
27036
- "use strict";
27037
- init_eval_format();
27038
- init_terminal_output();
27039
- PHONE_WIDTH_MAX_PX = 430;
27040
- SCRIPT_ELEMENT = /<script\b([^>]*)>([\s\S]*?)<\/script\s*>/gi;
27041
- STYLE_ELEMENT = /<style\b[^>]*>([\s\S]*?)<\/style\s*>/gi;
27042
- TAG = /<([a-z][a-z0-9-]*)\b([^>]*)>/gi;
27043
- ATTRIBUTE = /([a-z][a-z0-9:-]*)\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+))/gi;
27044
- URL_CALL = /url\(\s*(?:"([^"]*)"|'([^']*)'|([^)]*?))\s*\)/gi;
27045
- IMPORT_RULE = /@import\s+(?:url\(\s*)?["']?([^"')\s;]*)[^;]*;?/gi;
27046
- inQuery = (d) => d.context.some((p) => /^@(?:media|container)\b/i.test(p));
27047
- COLOR_PROPERTY = /^(?:color|background|background-color|fill|stroke|caret-color|accent-color|text-decoration|text-decoration-color|outline|outline-color|column-rule|column-rule-color)$|^border(?:-(?:top|right|bottom|left|block|inline|block-start|block-end|inline-start|inline-end))?(?:-color)?$/;
27048
- HEX_COLOR = /#(?:[0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{3,4})(?![\w-])/i;
27049
- COLOR_FUNCTION = /\b(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch)\(/i;
27050
- TABLE_SELECTOR = /\b(?:table|thead|tbody|tr|th|td)\b/i;
27051
- LOCAL_URL = /^(?:data:|blob:|#)/i;
27052
- IMAGE_ELEMENTS = /* @__PURE__ */ new Set(["img", "input", "image"]);
27053
- MEDIA_ELEMENTS = /* @__PURE__ */ new Set(["video", "audio", "track", "iframe", "embed", "frame"]);
27054
- SCRIPT_LOAD = /\b(?:fetch|WebSocket|EventSource)\s*\(\s*(['"`])((?:https?:|wss?:|\/\/)[^'"`]*)\1/g;
27055
- LIST_MARKUP = /<(?:ul|ol|table)\b|wayai-list|createElement\(\s*['"`](?:li|tr|ul|ol|table)['"`]/i;
27056
- ZERO_ROWS_CHECK = /\.length\s*(?:===?|<=)\s*0\b|\.length\s*<\s*1\b|!\s*[\w$.[\]]+\.length\b/;
27057
- plural = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
27058
- shown = (text5) => truncate(sanitizeTerminalText(text5).replace(/\s+/g, " "), 60);
27059
- }
27060
- });
27061
-
27062
26747
  // src/lib/base-workspace.ts
27063
26748
  import * as fs16 from "fs";
27064
26749
  import * as path21 from "path";
@@ -27554,7 +27239,7 @@ var nativeEntryName, SKIPPABLE_ENTRY_IDENTITY;
27554
27239
  var init_skipped_tool_entries = __esm({
27555
27240
  "../../packages/core/dist/skipped-tool-entries.js"() {
27556
27241
  "use strict";
27557
- init_chunk_NOVD6LKY();
27242
+ init_chunk_6KWTXHFE();
27558
27243
  init_chunk_QG3XMUEN();
27559
27244
  init_chunk_EBUWHIFV();
27560
27245
  init_chunk_5YZ3R7KF();
@@ -27615,6 +27300,389 @@ var init_skipped_tool_entries = __esm({
27615
27300
  }
27616
27301
  });
27617
27302
 
27303
+ // ../../packages/core/dist/page-design-lint.js
27304
+ function skipSpace(text5, at) {
27305
+ while (isSpace(text5[at])) at++;
27306
+ return at;
27307
+ }
27308
+ function findClose(lower, name, from) {
27309
+ const open = `</${name}`;
27310
+ for (let at = lower.indexOf(open, from); at !== -1; at = lower.indexOf(open, at + 1)) {
27311
+ const gt = skipSpace(lower, at + open.length);
27312
+ if (lower[gt] === ">") return { start: at, end: gt + 1 };
27313
+ }
27314
+ return null;
27315
+ }
27316
+ function replaceElements(text5, name, replace) {
27317
+ const lower = asciiLower(text5);
27318
+ const open = `<${name}`;
27319
+ let out = "";
27320
+ let from = 0;
27321
+ let at = lower.indexOf(open);
27322
+ while (at !== -1) {
27323
+ const afterName = at + open.length;
27324
+ if (isWordChar(lower[afterName])) {
27325
+ at = lower.indexOf(open, at + 1);
27326
+ continue;
27327
+ }
27328
+ const gt = lower.indexOf(">", afterName);
27329
+ if (gt === -1) break;
27330
+ const close3 = findClose(lower, name, gt + 1);
27331
+ if (!close3) break;
27332
+ out += text5.slice(from, at) + replace(text5.slice(afterName, gt), text5.slice(gt + 1, close3.start));
27333
+ from = close3.end;
27334
+ at = lower.indexOf(open, from);
27335
+ }
27336
+ return out + text5.slice(from);
27337
+ }
27338
+ function removeSpans(text5, open, close3) {
27339
+ let out = "";
27340
+ let from = 0;
27341
+ for (let at = text5.indexOf(open); at !== -1; at = text5.indexOf(open, from)) {
27342
+ const end = text5.indexOf(close3, at + open.length);
27343
+ if (end === -1) break;
27344
+ out += text5.slice(from, at);
27345
+ from = end + close3.length;
27346
+ }
27347
+ return out + text5.slice(from);
27348
+ }
27349
+ function quotedAt(text5, at, lastQuote) {
27350
+ const quote = text5[at];
27351
+ if (quote !== '"' && quote !== "'" || lastQuote[quote] <= at) return null;
27352
+ const close3 = text5.indexOf(quote, at + 1);
27353
+ return { value: text5.slice(at + 1, close3), end: close3 + 1 };
27354
+ }
27355
+ function tagsOf(markup) {
27356
+ const tags = [];
27357
+ for (let lt = markup.indexOf("<"); lt !== -1; lt = markup.indexOf("<", lt + 1)) {
27358
+ if (!isLetter(markup[lt + 1])) continue;
27359
+ let end = lt + 2;
27360
+ while (end < markup.length && isTagNameChar(markup[end])) end++;
27361
+ while (end > lt + 2 && isWordChar(markup[end - 1]) === isWordChar(markup[end])) end--;
27362
+ if (isWordChar(markup[end - 1]) === isWordChar(markup[end])) continue;
27363
+ const gt = markup.indexOf(">", end);
27364
+ if (gt === -1) break;
27365
+ tags.push({ name: markup.slice(lt + 1, end), attrs: attributesOf(markup.slice(end, gt)) });
27366
+ lt = gt;
27367
+ }
27368
+ return tags;
27369
+ }
27370
+ function attributesOf(attrs) {
27371
+ const out = /* @__PURE__ */ new Map();
27372
+ const lastQuote = lastQuotesOf(attrs);
27373
+ let at = 0;
27374
+ while (at < attrs.length) {
27375
+ if (!isLetter(attrs[at])) {
27376
+ at++;
27377
+ continue;
27378
+ }
27379
+ let nameEnd = at + 1;
27380
+ while (nameEnd < attrs.length && isAttributeNameChar(attrs[nameEnd])) nameEnd++;
27381
+ const eq = skipSpace(attrs, nameEnd);
27382
+ if (attrs[eq] !== "=") {
27383
+ at = nameEnd;
27384
+ continue;
27385
+ }
27386
+ const valueAt = skipSpace(attrs, eq + 1);
27387
+ const quote = attrs[valueAt];
27388
+ let value = null;
27389
+ let next = nameEnd;
27390
+ if (quote === '"' || quote === "'") {
27391
+ const quoted = quotedAt(attrs, valueAt, lastQuote);
27392
+ if (quoted) {
27393
+ value = quoted.value;
27394
+ next = quoted.end;
27395
+ }
27396
+ } else {
27397
+ let valueEnd2 = valueAt;
27398
+ while (valueEnd2 < attrs.length && !isSpace(attrs[valueEnd2]) && !`"'>`.includes(attrs[valueEnd2])) valueEnd2++;
27399
+ if (valueEnd2 > valueAt) {
27400
+ value = attrs.slice(valueAt, valueEnd2);
27401
+ next = valueEnd2;
27402
+ }
27403
+ }
27404
+ if (value !== null) out.set(attrs.slice(at, nameEnd).toLowerCase(), value.trim());
27405
+ at = next;
27406
+ }
27407
+ return out;
27408
+ }
27409
+ function splitPage(html) {
27410
+ const scripts = [];
27411
+ const withoutScripts = replaceElements(html, "script", (attrs, body) => {
27412
+ scripts.push(body);
27413
+ return `<script${attrs}></script>`;
27414
+ });
27415
+ const withoutComments = removeSpans(withoutScripts, "<!--", "-->");
27416
+ const css = [];
27417
+ const markup = replaceElements(withoutComments, "style", (_attrs, body) => {
27418
+ css.push({ text: body, attribute: false });
27419
+ return "<style></style>";
27420
+ });
27421
+ const tags = tagsOf(markup);
27422
+ for (const tag of tags) {
27423
+ const style = tag.attrs.get("style");
27424
+ if (style) css.push({ text: style, attribute: true });
27425
+ }
27426
+ return { markup, tags, css, scripts: scripts.join("\n") };
27427
+ }
27428
+ function removeCalls(value, name, keep = () => false) {
27429
+ const lower = asciiLower(value);
27430
+ const open = `${name}(`;
27431
+ let out = "";
27432
+ let from = 0;
27433
+ for (let at = lower.indexOf(open); at !== -1; at = lower.indexOf(open, from)) {
27434
+ let depth = 0;
27435
+ let end = at + name.length;
27436
+ for (; end < value.length; end++) {
27437
+ if (value[end] === "(") depth++;
27438
+ else if (value[end] === ")" && --depth === 0) break;
27439
+ }
27440
+ const inner = value.slice(at + open.length, end);
27441
+ out += value.slice(from, at) + (keep(inner) ? value.slice(at, end + 1) : "");
27442
+ from = end + 1;
27443
+ }
27444
+ return out + value.slice(from);
27445
+ }
27446
+ function replaceUrlCalls(css, loads) {
27447
+ const lower = asciiLower(css);
27448
+ const lastQuote = lastQuotesOf(css);
27449
+ let out = "";
27450
+ let from = 0;
27451
+ for (let at = lower.indexOf("url("); at !== -1; at = lower.indexOf("url(", from)) {
27452
+ const inner = skipSpace(css, at + 4);
27453
+ const quoted = quotedAt(css, inner, lastQuote);
27454
+ let url = null;
27455
+ let end = -1;
27456
+ if (quoted) {
27457
+ const paren = skipSpace(css, quoted.end);
27458
+ if (css[paren] === ")") {
27459
+ url = quoted.value;
27460
+ end = paren + 1;
27461
+ }
27462
+ }
27463
+ if (url === null) {
27464
+ const paren = css.indexOf(")", inner);
27465
+ if (paren === -1) break;
27466
+ url = css.slice(inner, paren);
27467
+ end = paren + 1;
27468
+ }
27469
+ loads.push(url.trim());
27470
+ out += `${css.slice(from, at)}url()`;
27471
+ from = end;
27472
+ }
27473
+ return out + css.slice(from);
27474
+ }
27475
+ function readCss(source, attribute) {
27476
+ const loads = [];
27477
+ let css = removeSpans(source, "/*", "*/");
27478
+ css = css.replace(IMPORT_RULE, (_m, url) => {
27479
+ loads.push(url || "@import");
27480
+ return "";
27481
+ });
27482
+ css = replaceUrlCalls(css, loads);
27483
+ css = css.replace(/"[^"]*"|'[^']*'/g, '""');
27484
+ const declarations = [];
27485
+ const declare = (body, inQuery, underTableSelector) => {
27486
+ for (const piece of body.split(";")) {
27487
+ const colon = piece.indexOf(":");
27488
+ if (colon === -1) continue;
27489
+ const prop = piece.slice(0, colon).trim().toLowerCase();
27490
+ const value = piece.slice(colon + 1).replace(/\s+/g, " ").trim();
27491
+ if (/^-?-?[a-z][a-z0-9-]*$/.test(prop) && value) declarations.push({ prop, value, inQuery, underTableSelector });
27492
+ }
27493
+ };
27494
+ if (attribute) {
27495
+ declare(css, false, false);
27496
+ return { declarations, loads };
27497
+ }
27498
+ const stack = [];
27499
+ let text5 = "";
27500
+ for (const ch of css) {
27501
+ if (ch === "{") {
27502
+ const prelude = text5.trim();
27503
+ const outer = stack[stack.length - 1];
27504
+ stack.push({
27505
+ body: "",
27506
+ inQuery: (outer?.inQuery ?? false) || QUERY_PRELUDE.test(prelude),
27507
+ underTableSelector: (outer?.underTableSelector ?? false) || !prelude.startsWith("@") && TABLE_SELECTOR.test(prelude)
27508
+ });
27509
+ text5 = "";
27510
+ } else if (ch === "}") {
27511
+ const block2 = stack.pop();
27512
+ if (block2) declare(block2.body + text5, block2.inQuery, block2.underTableSelector);
27513
+ text5 = "";
27514
+ } else if (ch === ";") {
27515
+ if (stack.length > 0) stack[stack.length - 1].body += `${text5};`;
27516
+ text5 = "";
27517
+ } else {
27518
+ text5 += ch;
27519
+ }
27520
+ }
27521
+ return { declarations, loads };
27522
+ }
27523
+ function hardCodedColor(d) {
27524
+ if (!COLOR_PROPERTY.test(d.prop)) return false;
27525
+ const tokenMixesGone = removeCalls(d.value, "color-mix", (inner) => !/var\(/i.test(inner));
27526
+ const literal = removeCalls(tokenMixesGone, "var");
27527
+ return HEX_COLOR.test(literal) || COLOR_FUNCTION.test(literal);
27528
+ }
27529
+ function fixedWidth(d) {
27530
+ if (d.prop !== "width" && d.prop !== "inline-size") return false;
27531
+ const px = /^(\d+(?:\.\d+)?)px$/i.exec(d.value.replace(/\s*!important$/i, ""));
27532
+ return px !== null && Number(px[1]) > PHONE_WIDTH_MAX_PX && !d.inQuery;
27533
+ }
27534
+ function tableFits(html, declarations) {
27535
+ if (html.includes("wayai-table-wrap")) return true;
27536
+ return declarations.some((d) => /^overflow(?:-x|-inline)?$/.test(d.prop) && /\b(?:auto|scroll)\b/.test(d.value) || d.inQuery && d.underTableSelector);
27537
+ }
27538
+ function markupLoads(tags) {
27539
+ const loads = [];
27540
+ for (const tag of tags) {
27541
+ const name = tag.name.toLowerCase();
27542
+ const { attrs } = tag;
27543
+ if (name === "script") {
27544
+ const src = attrs.get("src");
27545
+ if (src) loads.push(src);
27546
+ } else if (name === "link") {
27547
+ const href = attrs.get("href");
27548
+ const rel = attrs.get("rel") ?? "";
27549
+ if (href && (/\bstylesheet\b/i.test(rel) || /icon|preload|prefetch|manifest/i.test(rel) && !LOCAL_URL.test(href))) {
27550
+ loads.push(href);
27551
+ }
27552
+ } else if (name === "source") {
27553
+ const src = attrs.get("src");
27554
+ const srcset = attrs.get("srcset");
27555
+ if (src) loads.push(src);
27556
+ if (srcset && !LOCAL_URL.test(srcset)) loads.push(srcset);
27557
+ } else if (IMAGE_ELEMENTS.has(name)) {
27558
+ for (const key of ["src", "srcset", "href"]) {
27559
+ const url = attrs.get(key);
27560
+ if (url && !LOCAL_URL.test(url)) loads.push(url);
27561
+ }
27562
+ } else if (MEDIA_ELEMENTS.has(name)) {
27563
+ for (const key of ["src", "poster"]) {
27564
+ const url = attrs.get(key);
27565
+ if (url) loads.push(url);
27566
+ }
27567
+ } else if (name === "object") {
27568
+ const data = attrs.get("data");
27569
+ if (data) loads.push(data);
27570
+ }
27571
+ }
27572
+ return loads;
27573
+ }
27574
+ function shown(text5) {
27575
+ const line = text5.replace(/[\u0000-\u0008\u000e-\u001f\u007f-\u009f]/g, "").replace(/\s+/g, " ");
27576
+ return line.length <= SNIPPET_MAX_CHARS ? line : `${line.slice(0, SNIPPET_MAX_CHARS - 3)}...`;
27577
+ }
27578
+ function lintPageDesign(page) {
27579
+ const { html } = page;
27580
+ const parts = splitPage(html);
27581
+ const read = parts.css.map((c) => readCss(c.text, c.attribute));
27582
+ const declarations = read.flatMap((r) => r.declarations);
27583
+ const findings = [];
27584
+ const colors = declarations.filter(hardCodedColor);
27585
+ if (colors.length > 0) {
27586
+ findings.push({
27587
+ rule: "hard-coded-color",
27588
+ message: `${plural(colors.length, "hard-coded color")} in its CSS, e.g. \`${shown(`${colors[0].prop}: ${colors[0].value}`)}\`: style with the tokens (var(--color-...), var(--wayai-...)) so the page follows the viewer's light or dark theme`
27589
+ });
27590
+ }
27591
+ if (!/data-theme|applyDocumentTheme/.test(html)) {
27592
+ findings.push({
27593
+ rule: "no-theme",
27594
+ message: "never sets data-theme on <html> from the host context's theme, so it keeps the theme it opened in when the viewer switches between light and dark"
27595
+ });
27596
+ }
27597
+ const widths = declarations.filter(fixedWidth);
27598
+ if (widths.length > 0) {
27599
+ findings.push({
27600
+ rule: "fixed-width",
27601
+ message: `${plural(widths.length, "fixed width")} wider than a phone (${PHONE_WIDTH_MAX_PX}px) outside a media or container query, e.g. \`${shown(`${widths[0].prop}: ${widths[0].value}`)}\`: lay the page out mobile-first and widen it inside a media or container query`
27602
+ });
27603
+ }
27604
+ if ((/<table\b/i.test(html) || /createElement\(\s*['"`]table['"`]/.test(html)) && !tableFits(html, declarations)) {
27605
+ findings.push({
27606
+ rule: "table-overflow",
27607
+ message: "has a table with no sideways scroll or narrow layout: wrap it in a wayai-table-wrap element, or turn its rows into cards inside a media or container query"
27608
+ });
27609
+ }
27610
+ const loads = [
27611
+ ...markupLoads(parts.tags),
27612
+ ...read.flatMap((r) => r.loads).filter((url) => url !== "" && !LOCAL_URL.test(url)),
27613
+ ...[...parts.scripts.matchAll(SCRIPT_LOAD)].map((m) => m[2])
27614
+ ];
27615
+ if (loads.length > 0) {
27616
+ findings.push({
27617
+ rule: "remote-load",
27618
+ message: `${plural(loads.length, "load")} the page's sandbox refuses, e.g. \`${shown(loads[0])}\`: a page has no network, so inline scripts and styles, and give images and fonts as data: URLs`
27619
+ });
27620
+ }
27621
+ const tools = page.manifest.tools;
27622
+ if (Array.isArray(tools) && tools.length > 0 && LIST_MARKUP.test(html)) {
27623
+ if (!html.includes("wayai-empty") && !ZERO_ROWS_CHECK.test(html)) {
27624
+ findings.push({
27625
+ rule: "list-empty-state",
27626
+ message: "fills a list from its tools but shows no empty state (no wayai-empty element and no check for zero rows): say what is missing when a list comes back empty"
27627
+ });
27628
+ }
27629
+ if (!/\bisError\b/.test(html) && !html.includes("wayai-alert")) {
27630
+ findings.push({
27631
+ rule: "list-error-state",
27632
+ message: "calls its tools but never reads a result's isError or shows a wayai-alert: show the viewer why a call failed"
27633
+ });
27634
+ }
27635
+ }
27636
+ return findings;
27637
+ }
27638
+ function pageDesignFindings(pages) {
27639
+ if (!pages) return [];
27640
+ return pages.flatMap((page) => {
27641
+ const slug = page.manifest.slug;
27642
+ if (typeof slug !== "string") return [];
27643
+ return lintPageDesign(page).map((f) => ({ page: slug, rule: f.rule, message: f.message }));
27644
+ });
27645
+ }
27646
+ var PHONE_WIDTH_MAX_PX, code2, isLetter, isDigit, isWordChar, isTagNameChar, isAttributeNameChar, isSpace, asciiLower, lastQuotesOf, IMPORT_RULE, QUERY_PRELUDE, TABLE_SELECTOR, COLOR_PROPERTY, HEX_COLOR, COLOR_FUNCTION, LOCAL_URL, IMAGE_ELEMENTS, MEDIA_ELEMENTS, SCRIPT_LOAD, LIST_MARKUP, ZERO_ROWS_CHECK, plural, SNIPPET_MAX_CHARS;
27647
+ var init_page_design_lint = __esm({
27648
+ "../../packages/core/dist/page-design-lint.js"() {
27649
+ "use strict";
27650
+ PHONE_WIDTH_MAX_PX = 430;
27651
+ code2 = (ch) => ch === void 0 ? -1 : ch.charCodeAt(0);
27652
+ isLetter = (ch) => {
27653
+ const c = code2(ch) | 32;
27654
+ return c >= 97 && c <= 122;
27655
+ };
27656
+ isDigit = (ch) => {
27657
+ const c = code2(ch);
27658
+ return c >= 48 && c <= 57;
27659
+ };
27660
+ isWordChar = (ch) => isLetter(ch) || isDigit(ch) || ch === "_";
27661
+ isTagNameChar = (ch) => isLetter(ch) || isDigit(ch) || ch === "-";
27662
+ isAttributeNameChar = (ch) => isTagNameChar(ch) || ch === ":";
27663
+ isSpace = (ch) => {
27664
+ const c = code2(ch);
27665
+ return c === 32 || c >= 9 && c <= 13 || c > 127 && /\s/.test(ch);
27666
+ };
27667
+ asciiLower = (text5) => text5.replace(/[A-Z]+/g, (run) => run.toLowerCase());
27668
+ lastQuotesOf = (text5) => ({ '"': text5.lastIndexOf('"'), "'": text5.lastIndexOf("'") });
27669
+ IMPORT_RULE = /@import\s+(?:url\(\s*)?["']?([^"')\s;]*)[^;]*;?/gi;
27670
+ QUERY_PRELUDE = /^@(?:media|container)\b/i;
27671
+ TABLE_SELECTOR = /\b(?:table|thead|tbody|tr|th|td)\b/i;
27672
+ COLOR_PROPERTY = /^(?:color|background|background-color|fill|stroke|caret-color|accent-color|text-decoration|text-decoration-color|outline|outline-color|column-rule|column-rule-color)$|^border(?:-(?:top|right|bottom|left|block|inline|block-start|block-end|inline-start|inline-end))?(?:-color)?$/;
27673
+ HEX_COLOR = /#(?:[0-9a-f]{8}|[0-9a-f]{6}|[0-9a-f]{3,4})(?![\w-])/i;
27674
+ COLOR_FUNCTION = /\b(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch)\(/i;
27675
+ LOCAL_URL = /^(?:data:|blob:|#)/i;
27676
+ IMAGE_ELEMENTS = /* @__PURE__ */ new Set(["img", "input", "image"]);
27677
+ MEDIA_ELEMENTS = /* @__PURE__ */ new Set(["video", "audio", "track", "iframe", "embed", "frame"]);
27678
+ SCRIPT_LOAD = /\b(?:fetch|WebSocket|EventSource)\s*\(\s*(['"`])((?:https?:|wss?:|\/\/)[^'"`]*)\1/g;
27679
+ LIST_MARKUP = /<(?:ul|ol|table)\b|wayai-list|createElement\(\s*['"`](?:li|tr|ul|ol|table)['"`]/i;
27680
+ ZERO_ROWS_CHECK = /\.length\s*(?:===?|<=)\s*0\b|\.length\s*<\s*1\b|!\s*[\w$.[\]]+\.length\b/;
27681
+ plural = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
27682
+ SNIPPET_MAX_CHARS = 60;
27683
+ }
27684
+ });
27685
+
27618
27686
  // src/data/org-context.ts
27619
27687
  function setDataOrgOverride(orgId) {
27620
27688
  override = orgId;
@@ -27699,8 +27767,8 @@ function dataErrorEnvelope(err) {
27699
27767
  }
27700
27768
  }
27701
27769
  function dataErrorCode(err) {
27702
- const code2 = dataErrorEnvelope(err)?.code;
27703
- return typeof code2 === "string" && code2 ? code2 : null;
27770
+ const code3 = dataErrorEnvelope(err)?.code;
27771
+ return typeof code3 === "string" && code3 ? code3 : null;
27704
27772
  }
27705
27773
  function dataErrorDetails(err) {
27706
27774
  const details = dataErrorEnvelope(err)?.details;
@@ -29034,7 +29102,7 @@ async function stopEvalSessionWithRetries(stop, opts = {}) {
29034
29102
  throw lastError;
29035
29103
  }
29036
29104
  function installEvalSignalHandlers(input) {
29037
- const exit = input.exit ?? ((code2) => process.exit(code2));
29105
+ const exit = input.exit ?? ((code3) => process.exit(code3));
29038
29106
  const manualStopCommand = formatEvalSessionStopCommand(input.sessionId, input.hubId);
29039
29107
  let signalCount = 0;
29040
29108
  let disposed = false;
@@ -32196,9 +32264,9 @@ function casePackageProblems(read, archiveBytes, definition) {
32196
32264
  }
32197
32265
  if (textBytes > CASE_PACKAGE_LIMITS.text_bytes) problems2.push({ path: null, reason: "package_text_too_large" });
32198
32266
  for (const [folder, phase] of phases) {
32199
- for (const [code2, item] of phase.items) {
32200
- if (item.required && !item.grouping && !itemInstructions.has(`${folder}/${code2}`)) {
32201
- problems2.push({ path: `instructions/${folder}/items/${code2}.md`, reason: "package_item_instruction_missing" });
32267
+ for (const [code3, item] of phase.items) {
32268
+ if (item.required && !item.grouping && !itemInstructions.has(`${folder}/${code3}`)) {
32269
+ problems2.push({ path: `instructions/${folder}/items/${code3}.md`, reason: "package_item_instruction_missing" });
32202
32270
  }
32203
32271
  }
32204
32272
  }
@@ -32274,10 +32342,10 @@ var init_case_type_packages = __esm({
32274
32342
  var init_case_types = __esm({
32275
32343
  "../../packages/core/dist/contracts/case-types.js"() {
32276
32344
  "use strict";
32277
- init_chunk_LYVJU46L();
32345
+ init_chunk_MCLSEATL();
32346
+ init_chunk_M2T55BV6();
32278
32347
  init_chunk_CLGTGGVN();
32279
32348
  init_chunk_KWRHZBGU();
32280
- init_chunk_M2T55BV6();
32281
32349
  init_chunk_VYINA6YP();
32282
32350
  init_chunk_ZVXO3XL6();
32283
32351
  init_chunk_FBV7NLKO();
@@ -34353,6 +34421,7 @@ var push_exports = {};
34353
34421
  __export(push_exports, {
34354
34422
  autoRenameAgentFiles: () => autoRenameAgentFiles,
34355
34423
  createAndPushNewHub: () => createAndPushNewHub,
34424
+ diffWarnings: () => diffWarnings,
34356
34425
  keepSkippedToolEntries: () => keepSkippedToolEntries,
34357
34426
  printErrors: () => printErrors,
34358
34427
  printLocalFileChanges: () => printLocalFileChanges,
@@ -34447,6 +34516,13 @@ function printWarnings(warnings) {
34447
34516
  console.log(` \x1B[33m! ${w}\x1B[0m`);
34448
34517
  }
34449
34518
  }
34519
+ function diffWarnings(result, pages) {
34520
+ const findings = result.page_design ?? pageDesignFindings(pages);
34521
+ return [
34522
+ ...result.warnings,
34523
+ ...findings.map((f) => `page "${sanitizeTerminalText(f.page)}" (design): ${sanitizeTerminalText(f.message)}`)
34524
+ ];
34525
+ }
34450
34526
  function printErrors(errors) {
34451
34527
  if (errors.length === 0) return;
34452
34528
  console.error(`
@@ -34668,7 +34744,7 @@ async function pushSingleHub(client, hubId, hubFolder, autoConfirm, organization
34668
34744
  const wireConfig = remoteConfig ? prepareResourcePayload(localConfig, remoteConfig) : localConfig;
34669
34745
  console.log("Computing diff...");
34670
34746
  const diffResult = await client.diff(hubId, wireConfig, "push", organizationId);
34671
- printWarnings([...diffResult.warnings, ...pageDesignWarnings(localConfig.pages)]);
34747
+ printWarnings(diffWarnings(diffResult, localConfig.pages));
34672
34748
  if (shouldWarnIgnoredPreviewLabel(localConfig.preview_label, diffResult.preview_label)) {
34673
34749
  console.warn(
34674
34750
  `Note: preview_label "${localConfig.preview_label}" in hub.yaml is server-owned and ignored on push (server value: ${diffResult.preview_label ?? "none"}). Use \`wayai relabel\` to change it.`
@@ -34886,7 +34962,7 @@ var init_push = __esm({
34886
34962
  init_hub_materializer();
34887
34963
  init_resource_files();
34888
34964
  init_diff_display();
34889
- init_page_design_lint();
34965
+ init_terminal_output();
34890
34966
  init_utils();
34891
34967
  init_workspace();
34892
34968
  init_layout();
@@ -34895,6 +34971,7 @@ var init_push = __esm({
34895
34971
  init_subtree_routing();
34896
34972
  init_community_workspace();
34897
34973
  init_skipped_tool_entries();
34974
+ init_page_design_lint();
34898
34975
  init_fs_safety();
34899
34976
  LOCAL_CHANGE_LIST_CAP = 20;
34900
34977
  entryId = (entry) => typeof entry === "object" && entry !== null ? entry.id : void 0;
@@ -35275,7 +35352,7 @@ async function diffCommand(args2) {
35275
35352
  assertResourcePayloadFitsWithoutPruning(localConfig, err);
35276
35353
  }
35277
35354
  const result = await client.diff(targetHubId, diffPayload, "push", organizationId);
35278
- printWarnings([...result.warnings, ...pageDesignWarnings(localConfig.pages)]);
35355
+ printWarnings(diffWarnings(result, localConfig.pages));
35279
35356
  if (!result.has_changes) {
35280
35357
  console.log(`
35281
35358
  No differences \u2014 local files match ${label3}.`);
@@ -35291,7 +35368,6 @@ var init_diff = __esm({
35291
35368
  init_auth();
35292
35369
  init_api_client();
35293
35370
  init_parser();
35294
- init_page_design_lint();
35295
35371
  init_diff_display();
35296
35372
  init_push();
35297
35373
  init_pull();
@@ -36636,6 +36712,112 @@ var init_send_message = __esm({
36636
36712
  }
36637
36713
  });
36638
36714
 
36715
+ // src/lib/eval-format.ts
36716
+ function runNotes(unproven, inProgress) {
36717
+ return [
36718
+ unproven > 0 ? `${unproven} unproven` : "",
36719
+ inProgress > 0 ? `${inProgress} in progress` : ""
36720
+ ].filter(Boolean);
36721
+ }
36722
+ function printResultsTable(results, mode) {
36723
+ let totalPassed = 0;
36724
+ let totalEvaluated = 0;
36725
+ let totalUnproven = 0;
36726
+ let totalInProgress = 0;
36727
+ for (const r of results) {
36728
+ const evalName = r.eval?.eval_name || r.eval_id.slice(0, 8);
36729
+ const evaluatedRuns = evaluatedRunCount(r);
36730
+ const unproven = unprovenRunCount(r);
36731
+ const inProgress = (r.running_runs ?? 0) + (r.pending_runs ?? 0);
36732
+ const notes2 = runNotes(unproven, inProgress);
36733
+ const passed = notes2.length > 0 ? `${r.successful_runs}/${evaluatedRuns} passed (${notes2.join(", ")})` : `${r.successful_runs}/${evaluatedRuns} passed`;
36734
+ const avgTime = r.avg_execution_time_ms != null ? `avg ${(r.avg_execution_time_ms / 1e3).toFixed(1)}s` : "";
36735
+ let scoresStr = "";
36736
+ if (r.aggregated_scores) {
36737
+ const parts = Object.entries(r.aggregated_scores).map(
36738
+ ([key, val]) => mode === "compact" ? `${key}: ${Math.round(val.avg * 100)}%` : `${key}: avg ${Math.round(val.avg * 100)}%, min ${Math.round(val.min * 100)}%, max ${Math.round(val.max * 100)}%`
36739
+ );
36740
+ if (parts.length > 0) scoresStr = " " + parts.join(" ");
36741
+ }
36742
+ console.log(` ${evalName.padEnd(20)} ${passed.padEnd(14)} ${avgTime}${scoresStr}`);
36743
+ totalPassed += r.successful_runs;
36744
+ totalEvaluated += evaluatedRuns;
36745
+ totalUnproven += unproven;
36746
+ totalInProgress += inProgress;
36747
+ }
36748
+ const pct = totalEvaluated > 0 ? (totalPassed / totalEvaluated * 100).toFixed(1) : "0.0";
36749
+ const notes = runNotes(totalUnproven, totalInProgress);
36750
+ const note = notes.length > 0 ? ` \u2014 ${notes.join(", ")}` : "";
36751
+ console.log(`
36752
+ Overall: ${totalPassed}/${totalEvaluated} passed (${pct}%)${note}`);
36753
+ }
36754
+ function truncate(str, maxLen) {
36755
+ if (str.length <= maxLen) return str;
36756
+ return str.slice(0, maxLen - 3) + "...";
36757
+ }
36758
+ function summarizeResponse(resp, maxLen = 80) {
36759
+ if (!resp) return "(none)";
36760
+ const parts = [];
36761
+ const content = typeof resp.content === "string" ? resp.content.trim() : "";
36762
+ if (content) parts.push(`"${truncate(content, maxLen)}"`);
36763
+ if (resp.tool_calls && resp.tool_calls.length > 0) {
36764
+ parts.push(
36765
+ resp.tool_calls.map((tc) => `${tc.function.name}(${truncate(tc.function.arguments, maxLen)})`).join(", ")
36766
+ );
36767
+ }
36768
+ return parts.length > 0 ? parts.join(" + ") : "(empty)";
36769
+ }
36770
+ function isFailingRun(run) {
36771
+ if (run.run_status && !TERMINAL_RUN_STATUSES.has(run.run_status)) return false;
36772
+ return run.response_match !== true;
36773
+ }
36774
+ function failureTag(run) {
36775
+ switch (run.outcome_kind) {
36776
+ case "execution_error":
36777
+ return "ERROR";
36778
+ case "evaluation_invalid":
36779
+ return "INVALID";
36780
+ // `assertion_failure`, and any pre-taxonomy payload.
36781
+ default:
36782
+ return "FAIL";
36783
+ }
36784
+ }
36785
+ function printFailingRuns(runs) {
36786
+ const failing = runs.filter(isFailingRun);
36787
+ if (failing.length === 0) return;
36788
+ console.log(`
36789
+ Failures (${failing.length}):`);
36790
+ let anyComment = false;
36791
+ for (const run of failing) {
36792
+ const evalName = run.eval?.eval_name || run.eval_id?.slice(0, 8) || "eval";
36793
+ console.log(` ${evalName} \u2014 Run #${run.run_number} [${failureTag(run)}]`);
36794
+ if (run.error_message) {
36795
+ console.log(` Error: ${run.error_message}`);
36796
+ }
36797
+ if (run.response_comment) {
36798
+ anyComment = true;
36799
+ console.log(` Why: ${run.response_comment}`);
36800
+ }
36801
+ if (run.expected_response) {
36802
+ console.log(` Expected: ${summarizeResponse(run.expected_response)}`);
36803
+ console.log(` Actual: ${summarizeResponse(run.eval_response)}`);
36804
+ }
36805
+ }
36806
+ if (!anyComment) {
36807
+ console.log(`
36808
+ ${NO_EVALUATOR_NOTES_HINT}`);
36809
+ }
36810
+ }
36811
+ var NO_EVALUATOR_NOTES_HINT, TERMINAL_RUN_STATUSES;
36812
+ var init_eval_format = __esm({
36813
+ "src/lib/eval-format.ts"() {
36814
+ "use strict";
36815
+ init_contracts();
36816
+ NO_EVALUATOR_NOTES_HINT = "No evaluator notes found \u2014 add a `notes` evaluation variable to the message_evaluator agent to surface its reasoning here.";
36817
+ TERMINAL_RUN_STATUSES = /* @__PURE__ */ new Set(["completed", "failed"]);
36818
+ }
36819
+ });
36820
+
36639
36821
  // src/lib/cross-hub-conversations.ts
36640
36822
  async function mapWithConcurrency(items, concurrency, worker) {
36641
36823
  const results = new Array(items.length);
@@ -37953,8 +38135,8 @@ var init_evals2 = __esm({
37953
38135
 
37954
38136
  // src/lib/eval-fixture-queue.ts
37955
38137
  function isQueueableLaunchError(err) {
37956
- const code2 = extractApiErrorCode(err);
37957
- return code2 !== null && QUEUEABLE_LAUNCH_ERRORS.has(code2);
38138
+ const code3 = extractApiErrorCode(err);
38139
+ return code3 !== null && QUEUEABLE_LAUNCH_ERRORS.has(code3);
37958
38140
  }
37959
38141
  async function runWithFixtureQueue(opts) {
37960
38142
  let delay3 = FIXTURE_QUEUE_INITIAL_DELAY_MS;
@@ -39315,8 +39497,8 @@ function readbackCandidate(text5, kind) {
39315
39497
  return digitRuns(text5).find((r) => r.length >= 9 && r.length <= 13) ?? null;
39316
39498
  }
39317
39499
  if (kind === "digits") {
39318
- const code2 = extractFacts(text5).find((f) => (f.kind === "digits" || f.kind === "cpf") && f.key.length >= 5);
39319
- if (code2) return code2.key;
39500
+ const code3 = extractFacts(text5).find((f) => (f.kind === "digits" || f.kind === "cpf") && f.key.length >= 5);
39501
+ if (code3) return code3.key;
39320
39502
  return digitRuns(text5).find((r) => r.length >= 5) ?? null;
39321
39503
  }
39322
39504
  return extractFacts(text5).find((f) => f.kind === kind)?.key ?? null;
@@ -40268,7 +40450,7 @@ function chooseAudioSource(options, plan, env = process.env) {
40268
40450
  }
40269
40451
  return new OpenAiTtsSource({ apiKey, voice: options.ttsVoice, model: options.ttsModel });
40270
40452
  }
40271
- function installInterruptHandlers(exit = (code2) => process.exit(code2)) {
40453
+ function installInterruptHandlers(exit = (code3) => process.exit(code3)) {
40272
40454
  let first = null;
40273
40455
  const listeners = /* @__PURE__ */ new Map();
40274
40456
  const dispose = () => {
@@ -43012,11 +43194,11 @@ var CASE_AGENT_REQUEST_TTL_MS, CASE_AGENT_REQUESTS_PER_PERSON_MAX, CASE_AGENT_MA
43012
43194
  var init_case_agents = __esm({
43013
43195
  "../../packages/core/dist/contracts/case-agents.js"() {
43014
43196
  "use strict";
43015
- init_chunk_4EHHQFKV();
43016
- init_chunk_LYVJU46L();
43197
+ init_chunk_UGKJPB2J();
43198
+ init_chunk_MCLSEATL();
43199
+ init_chunk_M2T55BV6();
43017
43200
  init_chunk_CLGTGGVN();
43018
43201
  init_chunk_KWRHZBGU();
43019
- init_chunk_M2T55BV6();
43020
43202
  init_chunk_VYINA6YP();
43021
43203
  init_chunk_ZVXO3XL6();
43022
43204
  init_chunk_FBV7NLKO();
@@ -43050,11 +43232,11 @@ var init_case_agents = __esm({
43050
43232
  var init_case_records = __esm({
43051
43233
  "../../packages/core/dist/contracts/case-records.js"() {
43052
43234
  "use strict";
43053
- init_chunk_4EHHQFKV();
43054
- init_chunk_LYVJU46L();
43235
+ init_chunk_UGKJPB2J();
43236
+ init_chunk_MCLSEATL();
43237
+ init_chunk_M2T55BV6();
43055
43238
  init_chunk_CLGTGGVN();
43056
43239
  init_chunk_KWRHZBGU();
43057
- init_chunk_M2T55BV6();
43058
43240
  init_chunk_VYINA6YP();
43059
43241
  init_chunk_ZVXO3XL6();
43060
43242
  init_chunk_FBV7NLKO();
@@ -43072,10 +43254,10 @@ var init_case_review = __esm({
43072
43254
  "../../packages/core/dist/contracts/case-review.js"() {
43073
43255
  "use strict";
43074
43256
  init_chunk_HPZOVPVT();
43075
- init_chunk_LYVJU46L();
43257
+ init_chunk_MCLSEATL();
43258
+ init_chunk_M2T55BV6();
43076
43259
  init_chunk_CLGTGGVN();
43077
43260
  init_chunk_KWRHZBGU();
43078
- init_chunk_M2T55BV6();
43079
43261
  init_chunk_VYINA6YP();
43080
43262
  init_chunk_ZVXO3XL6();
43081
43263
  init_chunk_FBV7NLKO();
@@ -43205,14 +43387,14 @@ var init_case_session = __esm({
43205
43387
  var init_case_comments = __esm({
43206
43388
  "../../packages/core/dist/contracts/case-comments.js"() {
43207
43389
  "use strict";
43208
- init_chunk_OFJI6SZT();
43209
- init_chunk_AVSVFP3W();
43390
+ init_chunk_BN7WSDWC();
43391
+ init_chunk_7JYZW5BH();
43210
43392
  init_chunk_HPZOVPVT();
43211
- init_chunk_4EHHQFKV();
43212
- init_chunk_LYVJU46L();
43393
+ init_chunk_UGKJPB2J();
43394
+ init_chunk_MCLSEATL();
43395
+ init_chunk_M2T55BV6();
43213
43396
  init_chunk_CLGTGGVN();
43214
43397
  init_chunk_KWRHZBGU();
43215
- init_chunk_M2T55BV6();
43216
43398
  init_chunk_VYINA6YP();
43217
43399
  init_chunk_ZVXO3XL6();
43218
43400
  init_chunk_FBV7NLKO();
@@ -43228,15 +43410,15 @@ var init_case_comments = __esm({
43228
43410
  var init_case_collection_citations = __esm({
43229
43411
  "../../packages/core/dist/contracts/case-collection-citations.js"() {
43230
43412
  "use strict";
43231
- init_chunk_FT63I5NG();
43232
- init_chunk_OFJI6SZT();
43233
- init_chunk_AVSVFP3W();
43413
+ init_chunk_CSHU2GN3();
43414
+ init_chunk_BN7WSDWC();
43415
+ init_chunk_7JYZW5BH();
43234
43416
  init_chunk_HPZOVPVT();
43235
- init_chunk_4EHHQFKV();
43236
- init_chunk_LYVJU46L();
43417
+ init_chunk_UGKJPB2J();
43418
+ init_chunk_MCLSEATL();
43419
+ init_chunk_M2T55BV6();
43237
43420
  init_chunk_CLGTGGVN();
43238
43421
  init_chunk_KWRHZBGU();
43239
- init_chunk_M2T55BV6();
43240
43422
  init_chunk_VYINA6YP();
43241
43423
  init_chunk_ZVXO3XL6();
43242
43424
  init_chunk_FBV7NLKO();
@@ -43252,19 +43434,19 @@ var init_case_collection_citations = __esm({
43252
43434
  var init_case_collection_links = __esm({
43253
43435
  "../../packages/core/dist/contracts/case-collection-links.js"() {
43254
43436
  "use strict";
43255
- init_chunk_JOMYQVNZ();
43256
- init_chunk_FT63I5NG();
43257
- init_chunk_5D4QFV76();
43258
- init_chunk_3SZD2H6D();
43437
+ init_chunk_VGNNAETO();
43438
+ init_chunk_CSHU2GN3();
43439
+ init_chunk_YMFTFCT5();
43440
+ init_chunk_J3HQTL6M();
43259
43441
  init_chunk_ZJA3UZMG();
43260
- init_chunk_OFJI6SZT();
43261
- init_chunk_AVSVFP3W();
43442
+ init_chunk_BN7WSDWC();
43443
+ init_chunk_7JYZW5BH();
43262
43444
  init_chunk_HPZOVPVT();
43263
- init_chunk_4EHHQFKV();
43264
- init_chunk_LYVJU46L();
43445
+ init_chunk_UGKJPB2J();
43446
+ init_chunk_MCLSEATL();
43447
+ init_chunk_M2T55BV6();
43265
43448
  init_chunk_CLGTGGVN();
43266
43449
  init_chunk_KWRHZBGU();
43267
- init_chunk_M2T55BV6();
43268
43450
  init_chunk_VYINA6YP();
43269
43451
  init_chunk_ZVXO3XL6();
43270
43452
  init_chunk_FBV7NLKO();
@@ -43780,8 +43962,8 @@ async function lockMirror(root) {
43780
43962
  }
43781
43963
  };
43782
43964
  const refusal2 = (err) => {
43783
- const code2 = err.code;
43784
- return code2 === "EACCES" || code2 === "EPERM" || code2 === "EROFS" ? expected(`The mirror's folder ${safe6(dir)} cannot be written (${code2}). Make it writable by you (it is the CLI's to write), then pull again.`) : err;
43965
+ const code3 = err.code;
43966
+ return code3 === "EACCES" || code3 === "EPERM" || code3 === "EROFS" ? expected(`The mirror's folder ${safe6(dir)} cannot be written (${code3}). Make it writable by you (it is the CLI's to write), then pull again.`) : err;
43785
43967
  };
43786
43968
  const deadline = Date.now() + LOCK_WAIT_MS;
43787
43969
  for (; ; ) {
@@ -44031,7 +44213,7 @@ exec wayai cases pull --mirror-only --dir "$(dirname "$0")/.."
44031
44213
  }
44032
44214
  });
44033
44215
 
44034
- // ../../packages/core/dist/chunk-7ASBGO5Y.js
44216
+ // ../../packages/core/dist/chunk-QF3ISWMG.js
44035
44217
  function firstAtOrAfter(sorted, from) {
44036
44218
  let lo = 0;
44037
44219
  let hi = sorted.length;
@@ -44172,7 +44354,7 @@ function lineImages(line) {
44172
44354
  const targets = [];
44173
44355
  const targetFrom = (from) => {
44174
44356
  let k = from;
44175
- while (k < line.length && !isSpace(line[k]) && line[k] !== ")" && line[k] !== ">") k++;
44357
+ while (k < line.length && !isSpace2(line[k]) && line[k] !== ")" && line[k] !== ">") k++;
44176
44358
  return line.slice(from, k);
44177
44359
  };
44178
44360
  let bracket = -2;
@@ -44183,7 +44365,7 @@ function lineImages(line) {
44183
44365
  after = null;
44184
44366
  if (bracket >= 0 && line[bracket + 1] === "(") {
44185
44367
  let j = bracket + 2;
44186
- while (isSpace(line[j])) j++;
44368
+ while (isSpace2(line[j])) j++;
44187
44369
  const angled = line[j] === "<" ? targetFrom(j + 1) : "";
44188
44370
  const target = angled || targetFrom(j);
44189
44371
  if (target) after = { target, end: (angled ? j + 1 : j) + target.length };
@@ -44200,11 +44382,11 @@ function fillsOf(text5) {
44200
44382
  let close3 = -2;
44201
44383
  for (let open = text5.indexOf("{{"); open >= 0; ) {
44202
44384
  let j = open + 2;
44203
- while (isSpace(text5[j])) j++;
44385
+ while (isSpace2(text5[j])) j++;
44204
44386
  let next = open + 1;
44205
44387
  if (text5.startsWith("fill", j)) {
44206
44388
  j += 4;
44207
- while (isSpace(text5[j])) j++;
44389
+ while (isSpace2(text5[j])) j++;
44208
44390
  if (text5[j] === ":") {
44209
44391
  j++;
44210
44392
  if (close3 !== -1 && close3 < j) close3 = text5.indexOf("}}", j);
@@ -44247,7 +44429,7 @@ function anchorOf(text5) {
44247
44429
  for (let k = attributes.length - 1; k >= 0; k--) {
44248
44430
  if (attributes[k] !== "#" || k > 0 && !isTabOrSpace(attributes[k - 1])) continue;
44249
44431
  let stop = k + 1;
44250
- while (stop < attributes.length && !isSpace(attributes[stop])) stop++;
44432
+ while (stop < attributes.length && !isSpace2(attributes[stop])) stop++;
44251
44433
  if (stop === k + 1) continue;
44252
44434
  let titleEnd = open;
44253
44435
  while (titleEnd > 0 && isTabOrSpace(text5[titleEnd - 1])) titleEnd--;
@@ -44445,12 +44627,12 @@ function readItems(text5, state) {
44445
44627
  malformed_markers: malformed
44446
44628
  };
44447
44629
  }
44448
- var CASE_COMPOSED_COVER, CASE_ITEM_READER_MAX_CHARS, FENCE_OPEN, BLANK_AFTER, CASE_FRONT_MATTER, FRONT_MATTER_OPENING, withoutBom, FENCE, SETEXT_UNDERLINE, DASHES, COLUMNS, patternBody, CALCULATION_MARKER, DECISION_MARKER, DOCUMENT_MARKER, INPUT_MARKER, isSpace, isTabOrSpace, once, OPENS_FRONT_MATTER;
44449
- var init_chunk_7ASBGO5Y = __esm({
44450
- "../../packages/core/dist/chunk-7ASBGO5Y.js"() {
44630
+ var CASE_COMPOSED_COVER, CASE_ITEM_READER_MAX_CHARS, FENCE_OPEN, BLANK_AFTER, CASE_FRONT_MATTER, FRONT_MATTER_OPENING, withoutBom, FENCE, SETEXT_UNDERLINE, DASHES, COLUMNS, patternBody, CALCULATION_MARKER, DECISION_MARKER, DOCUMENT_MARKER, INPUT_MARKER, isSpace2, isTabOrSpace, once, OPENS_FRONT_MATTER;
44631
+ var init_chunk_QF3ISWMG = __esm({
44632
+ "../../packages/core/dist/chunk-QF3ISWMG.js"() {
44451
44633
  "use strict";
44452
- init_chunk_OFJI6SZT();
44453
- init_chunk_LYVJU46L();
44634
+ init_chunk_BN7WSDWC();
44635
+ init_chunk_MCLSEATL();
44454
44636
  CASE_COMPOSED_COVER = "00-cover.md";
44455
44637
  CASE_ITEM_READER_MAX_CHARS = 4 * 1024 * 1024;
44456
44638
  FENCE_OPEN = / {0,3}(`{3,}|~{3,})([^\n]*)(?:\n|$)/y;
@@ -44469,7 +44651,7 @@ var init_chunk_7ASBGO5Y = __esm({
44469
44651
  INPUT_MARKER = new RegExp(
44470
44652
  `^(?<key>${patternBody(CASE_INPUT_KEY_PATTERN)})@v(?<version>[1-9]\\d*)(?:#L(?<start>[1-9]\\d*)(?:-L(?<end>[1-9]\\d*))?)?(?:\\|(?<label>.*))?$`
44471
44653
  );
44472
- isSpace = (c) => c !== void 0 && /\s/.test(c);
44654
+ isSpace2 = (c) => c !== void 0 && /\s/.test(c);
44473
44655
  isTabOrSpace = (c) => c === " " || c === " ";
44474
44656
  once = (values) => [...new Set(values)];
44475
44657
  OPENS_FRONT_MATTER = new RegExp(FRONT_MATTER_OPENING);
@@ -44480,15 +44662,15 @@ var init_chunk_7ASBGO5Y = __esm({
44480
44662
  var init_case_item_reader = __esm({
44481
44663
  "../../packages/core/dist/case-item-reader.js"() {
44482
44664
  "use strict";
44483
- init_chunk_7ASBGO5Y();
44484
- init_chunk_OFJI6SZT();
44485
- init_chunk_AVSVFP3W();
44665
+ init_chunk_QF3ISWMG();
44666
+ init_chunk_BN7WSDWC();
44667
+ init_chunk_7JYZW5BH();
44486
44668
  init_chunk_HPZOVPVT();
44487
- init_chunk_4EHHQFKV();
44488
- init_chunk_LYVJU46L();
44669
+ init_chunk_UGKJPB2J();
44670
+ init_chunk_MCLSEATL();
44671
+ init_chunk_M2T55BV6();
44489
44672
  init_chunk_CLGTGGVN();
44490
44673
  init_chunk_KWRHZBGU();
44491
- init_chunk_M2T55BV6();
44492
44674
  init_chunk_VYINA6YP();
44493
44675
  init_chunk_ZVXO3XL6();
44494
44676
  init_chunk_FBV7NLKO();
@@ -44700,14 +44882,14 @@ function linkMismatch(input, label3, target) {
44700
44882
  if (input.origin === "previous_output") return `The ${label3} links an earlier phase's official version: pass --official-version <id or output code>, or --list.`;
44701
44883
  return target.kind === "list" ? `The ${label3} links a received document of the case, which no read lists here: pass --received <id> (the id is in its files' names under a phase's received/).` : `The ${label3} links a received document of the case: pass --received <id>.`;
44702
44884
  }
44703
- function chooseByOutput(linkable, code2, named, folders) {
44704
- const chosen = linkable.filter((v) => v.output.code === code2);
44885
+ function chooseByOutput(linkable, code3, named, folders) {
44886
+ const chosen = linkable.filter((v) => v.output.code === code3);
44705
44887
  if (chosen.length === 1) return chosen[0];
44706
44888
  if (chosen.length > 1) {
44707
- throw expected(`Several outputs of code ${code2} have an official version the ${named.label} may link, one per phase: name it by its id.` + candidateBlock(chosen, named.key, named.folder, folders, " "));
44889
+ throw expected(`Several outputs of code ${code3} have an official version the ${named.label} may link, one per phase: name it by its id.` + candidateBlock(chosen, named.key, named.folder, folders, " "));
44708
44890
  }
44709
44891
  if (linkable.length === 0) throw expected(noneLinkable(named.label));
44710
- throw expected(`No output of code ${code2} has an official version the ${named.label} may link. Those it may link:` + candidateBlock(linkable, named.key, named.folder, folders, " "));
44892
+ throw expected(`No output of code ${code3} has an official version the ${named.label} may link. Those it may link:` + candidateBlock(linkable, named.key, named.folder, folders, " "));
44711
44893
  }
44712
44894
  function linkableLines(linkable, named, folders) {
44713
44895
  if (linkable.length === 0) return [noneLinkable(named.label)];
@@ -44827,16 +45009,16 @@ ${line}`).join("");
44827
45009
  var init_case_input_sources = __esm({
44828
45010
  "../../packages/core/dist/contracts/case-input-sources.js"() {
44829
45011
  "use strict";
44830
- init_chunk_5MNWTL44();
44831
- init_chunk_FT63I5NG();
44832
- init_chunk_OFJI6SZT();
44833
- init_chunk_AVSVFP3W();
45012
+ init_chunk_YCVI6W6V();
45013
+ init_chunk_CSHU2GN3();
45014
+ init_chunk_BN7WSDWC();
45015
+ init_chunk_7JYZW5BH();
44834
45016
  init_chunk_HPZOVPVT();
44835
- init_chunk_4EHHQFKV();
44836
- init_chunk_LYVJU46L();
45017
+ init_chunk_UGKJPB2J();
45018
+ init_chunk_MCLSEATL();
45019
+ init_chunk_M2T55BV6();
44837
45020
  init_chunk_CLGTGGVN();
44838
45021
  init_chunk_KWRHZBGU();
44839
- init_chunk_M2T55BV6();
44840
45022
  init_chunk_VYINA6YP();
44841
45023
  init_chunk_ZVXO3XL6();
44842
45024
  init_chunk_FBV7NLKO();
@@ -44852,12 +45034,12 @@ var init_case_input_sources = __esm({
44852
45034
  var init_case_notes = __esm({
44853
45035
  "../../packages/core/dist/contracts/case-notes.js"() {
44854
45036
  "use strict";
44855
- init_chunk_AVSVFP3W();
44856
- init_chunk_4EHHQFKV();
44857
- init_chunk_LYVJU46L();
45037
+ init_chunk_7JYZW5BH();
45038
+ init_chunk_UGKJPB2J();
45039
+ init_chunk_MCLSEATL();
45040
+ init_chunk_M2T55BV6();
44858
45041
  init_chunk_CLGTGGVN();
44859
45042
  init_chunk_KWRHZBGU();
44860
- init_chunk_M2T55BV6();
44861
45043
  init_chunk_VYINA6YP();
44862
45044
  init_chunk_ZVXO3XL6();
44863
45045
  init_chunk_FBV7NLKO();
@@ -45351,28 +45533,28 @@ async function caseSkeleton(session, clone, opts) {
45351
45533
  };
45352
45534
  if (!CASE_PHASE_FOLDER_PATTERN.test(phase.folder)) problems2.push(`the phase's folder ${JSON.stringify(sanitizeTerminalText(phase.folder))} is no phase folder`);
45353
45535
  const planned = outputs.map((output) => {
45354
- const code2 = one3(output.code);
45536
+ const code3 = one3(output.code);
45355
45537
  const bad = output.file_paths.filter((p) => !casePath2(p.endsWith("/") ? `${p}${CASE_COMPOSED_COVER}` : p, false));
45356
- for (const p of bad) problems2.push(`output ${code2}: ${JSON.stringify(sanitizeTerminalText(p))} is no path of this phase a document can be written at`);
45538
+ for (const p of bad) problems2.push(`output ${code3}: ${JSON.stringify(sanitizeTerminalText(p))} is no path of this phase a document can be written at`);
45357
45539
  if (bad.length) return null;
45358
- if (output.format === "file") return { code: code2, skipped: "a file piece, sent as it comes: it has no items to start from" };
45359
- if (output.dispensation) return { code: code2, skipped: "dispensed" };
45540
+ if (output.format === "file") return { code: code3, skipped: "a file piece, sent as it comes: it has no items to start from" };
45541
+ if (output.dispensation) return { code: code3, skipped: "dispensed" };
45360
45542
  const items = workItems.filter((i) => i.output_id === output.id && !i.dispensation);
45361
45543
  const malformed = items.filter((i) => !CASE_CODE_PATTERN.test(i.code));
45362
- for (const i of malformed) problems2.push(`output ${code2}: ${JSON.stringify(sanitizeTerminalText(i.code))} is no item code`);
45544
+ for (const i of malformed) problems2.push(`output ${code3}: ${JSON.stringify(sanitizeTerminalText(i.code))} is no item code`);
45363
45545
  if (malformed.length) return null;
45364
- if (items.length === 0) return { code: code2, skipped: "no item to start from" };
45546
+ if (items.length === 0) return { code: code3, skipped: "no item to start from" };
45365
45547
  const bound = output.file_paths.find((p) => p.endsWith(".md") || p.endsWith("/"));
45366
- if (bound === void 0) return { code: code2, skipped: "it binds no Markdown file or folder of chapters" };
45548
+ if (bound === void 0) return { code: code3, skipped: "it binds no Markdown file or folder of chapters" };
45367
45549
  const held = output.file_paths.flatMap((p) => opts.confidential ? [p, `conf/${p}`] : [p]).find((p) => documentHere(clone.root, clone.record, p));
45368
- if (held !== void 0) return { code: code2, skipped: `its document is already here, at ${sanitizeTerminalText(held)}` };
45550
+ if (held !== void 0) return { code: code3, skipped: `its document is already here, at ${sanitizeTerminalText(held)}` };
45369
45551
  const skeletonItems = items.map((item) => {
45370
45552
  let template = null;
45371
45553
  if (item.own === null && !item.grouping && item.template_mode !== "fixed") {
45372
45554
  const rel = `templates/${phase.folder}/${item.code}.md`;
45373
45555
  const file = pkg2.file(rel);
45374
45556
  if (file.state !== "unlisted" && file.confidential && !opts.confidential) {
45375
- problems2.push(`item ${one3(item.code)} of output ${code2}: its template is confidential, used only with --confidential`);
45557
+ problems2.push(`item ${one3(item.code)} of output ${code3}: its template is confidential, used only with --confidential`);
45376
45558
  } else if (file.state === "ok") {
45377
45559
  template = file.bytes.toString("utf-8");
45378
45560
  } else if (file.state !== "unlisted") {
@@ -45386,9 +45568,9 @@ async function caseSkeleton(session, clone, opts) {
45386
45568
  const base = opts.confidential ? `conf/${bound}` : bound;
45387
45569
  const made = skeletonFiles(input, base);
45388
45570
  for (const f of made.files.filter((f2) => !casePath2(f2.rel, opts.confidential))) {
45389
- problems2.push(`output ${code2}: ${JSON.stringify(sanitizeTerminalText(f.rel))} is no path a document can be written at`);
45571
+ problems2.push(`output ${code3}: ${JSON.stringify(sanitizeTerminalText(f.rel))} is no path a document can be written at`);
45390
45572
  }
45391
- return { code: code2, path: base, files: made.files, items: items.length, missing: made.missing };
45573
+ return { code: code3, path: base, files: made.files, items: items.length, missing: made.missing };
45392
45574
  });
45393
45575
  if (problems2.length) {
45394
45576
  throw expected(`Nothing was written:
@@ -46218,10 +46400,10 @@ var init_case_files2 = __esm({
46218
46400
  // src/cases/case-review.ts
46219
46401
  function reviewFailure(err, session) {
46220
46402
  if (err instanceof ApiError && err.status >= 400 && err.status < 500) {
46221
- const code2 = session.connection.code;
46403
+ const code3 = session.connection.code;
46222
46404
  switch (extractApiErrorReason(err)) {
46223
46405
  case CASE_REVIEW_TOO_LARGE_REASON:
46224
- return expected(`Case ${code2}'s review is larger than one review may read, so it cannot be computed.`);
46406
+ return expected(`Case ${code3}'s review is larger than one review may read, so it cannot be computed.`);
46225
46407
  case CASE_REVIEW_PAIR_UNKNOWN_REASON:
46226
46408
  return expected(
46227
46409
  "The case's review holds no pair of those items with those hashes at that revision (a value not copied as the review printed it, or --confidential not as the review was read). Nothing was recorded. Run the command `wayai cases review` prints for the pair."
@@ -46229,11 +46411,11 @@ function reviewFailure(err, session) {
46229
46411
  case CASE_REVIEW_CHAIN_STOPPED_REASON:
46230
46412
  return expected(`This pair's chain stopped after ${CASE_REVIEW_ROUNDS_MAX} rounds, so it takes no verdict. ${WEB_ONLY_NOTICE}`);
46231
46413
  case CASE_REVIEW_VERDICTS_FULL_REASON:
46232
- return expected(`Case ${code2} holds as many verdicts as it may: nothing was recorded.`);
46414
+ return expected(`Case ${code3} holds as many verdicts as it may: nothing was recorded.`);
46233
46415
  case CASE_CLOSED_REASON:
46234
- return expected(`Case ${code2} is closed: it takes no verdict.`);
46416
+ return expected(`Case ${code3} is closed: it takes no verdict.`);
46235
46417
  case "revision_unknown":
46236
- return expected(`Case ${code2} has no revision of that id you may read. Read the review again: \`wayai cases review\`.`);
46418
+ return expected(`Case ${code3} has no revision of that id you may read. Read the review again: \`wayai cases review\`.`);
46237
46419
  case "reason_too_long":
46238
46420
  return expected("The reason is longer than the case takes.");
46239
46421
  }
@@ -46277,17 +46459,17 @@ async function caseReview(session, opts) {
46277
46459
  printReview(session.connection, graph);
46278
46460
  }
46279
46461
  function printReview(connection, graph) {
46280
- const { code: code2 } = connection;
46462
+ const { code: code3 } = connection;
46281
46463
  const omitted = graph.warnings.some((w) => w.code === CASE_REVIEW_CONFIDENTIAL_OMITTED);
46282
46464
  const notice = () => {
46283
46465
  if (omitted) console.log("\nConfidential content is left out of this review unless you pass --confidential.");
46284
46466
  };
46285
46467
  if (graph.revision_id === null) {
46286
- console.log(`Case ${code2} has no revision you read here: nothing to review.`);
46468
+ console.log(`Case ${code3} has no revision you read here: nothing to review.`);
46287
46469
  notice();
46288
46470
  return;
46289
46471
  }
46290
- console.log(`Review of case ${code2} at revision ${one5(graph.revision_id)}${graph.confidential ? ", with confidential content" : ""}.`);
46472
+ console.log(`Review of case ${code3} at revision ${one5(graph.revision_id)}${graph.confidential ? ", with confidential content" : ""}.`);
46291
46473
  console.log(graph.base_revision_id ? `Base: revision ${one5(graph.base_revision_id)}. Nothing you read here is pending.` : "Base: each item's own, below. Something you read here is pending.");
46292
46474
  const titles = new Map(graph.items.map((item) => [item.key, item.title]));
46293
46475
  if (graph.items.length) {
@@ -46455,8 +46637,8 @@ async function casesCommand(args2) {
46455
46637
  if (extra.length) throw usageError4(`${name} does not take ${extra.map((key) => `--${key}`).join(", ")}.`);
46456
46638
  if (name === "connect") {
46457
46639
  if (operands.length !== 3) throw usageError4("connect takes <org_id> <space_id> <code>.");
46458
- const [orgId, spaceId, code2] = operands;
46459
- return connect(caseRef(orgId, spaceId, code2), machineLabel2(values.label));
46640
+ const [orgId, spaceId, code3] = operands;
46641
+ return connect(caseRef(orgId, spaceId, code3), machineLabel2(values.label));
46460
46642
  }
46461
46643
  if (name === "type pull") {
46462
46644
  if (operands.length !== 3) throw usageError4("type pull takes <org_id> <space_id> <type_id>.");
@@ -46599,8 +46781,8 @@ async function casesCommand(args2) {
46599
46781
  throw usageError4(`Unknown subcommand ${JSON.stringify(sanitizeTerminalText(name))}.`);
46600
46782
  }
46601
46783
  }
46602
- function caseRef(orgId, spaceId, code2) {
46603
- const parsed = caseRecordParam.safeParse({ org_id: orgId, space_id: spaceId, code: code2 });
46784
+ function caseRef(orgId, spaceId, code3) {
46785
+ const parsed = caseRecordParam.safeParse({ org_id: orgId, space_id: spaceId, code: code3 });
46604
46786
  if (!parsed.success) {
46605
46787
  throw usageError4("Expected an organization id and a space id (UUIDs) and a case code (TYPE-YEAR-SEQ, as the web app shows it).");
46606
46788
  }
@@ -46722,12 +46904,12 @@ async function selfRevoke(connection, token) {
46722
46904
  return "unreachable";
46723
46905
  }
46724
46906
  }
46725
- async function disconnect(code2, filter) {
46726
- const matches = listCaseConnections().filter((c) => c.code === code2 && (filter.org === void 0 || c.org_id === filter.org) && (filter.space === void 0 || c.space_id === filter.space));
46727
- if (matches.length === 0) throw expected(`This machine is not connected to case ${sanitizeTerminalText(code2)}.`);
46907
+ async function disconnect(code3, filter) {
46908
+ const matches = listCaseConnections().filter((c) => c.code === code3 && (filter.org === void 0 || c.org_id === filter.org) && (filter.space === void 0 || c.space_id === filter.space));
46909
+ if (matches.length === 0) throw expected(`This machine is not connected to case ${sanitizeTerminalText(code3)}.`);
46728
46910
  if (matches.length > 1) {
46729
46911
  throw expected(
46730
- `This machine is connected to ${matches.length} cases coded ${code2}; pick one with --org and --space:
46912
+ `This machine is connected to ${matches.length} cases coded ${code3}; pick one with --org and --space:
46731
46913
  ` + matches.map((c) => ` --org ${c.org_id} --space ${c.space_id}`).join("\n")
46732
46914
  );
46733
46915
  }
@@ -46738,18 +46920,18 @@ async function disconnect(code2, filter) {
46738
46920
  token = await readCaseToken(connection);
46739
46921
  } catch (err) {
46740
46922
  throw expected(
46741
- `This machine's keyring could not read the token for case ${code2} (${err instanceof Error ? err.message : String(err)}). Nothing was revoked or removed: run disconnect again once the keyring can be read.`
46923
+ `This machine's keyring could not read the token for case ${code3} (${err instanceof Error ? err.message : String(err)}). Nothing was revoked or removed: run disconnect again once the keyring can be read.`
46742
46924
  );
46743
46925
  }
46744
46926
  let outcome = "no_token";
46745
46927
  if (token) outcome = await selfRevoke(connection, token);
46746
46928
  const { keyringCleared } = await removeCaseConnection(connection);
46747
- if (outcome === "revoked") console.log(`Revoked this machine's authorization on case ${code2}.`);
46748
- else if (outcome === "dead") console.log(`The authorization on case ${code2} was already revoked or expired.`);
46929
+ if (outcome === "revoked") console.log(`Revoked this machine's authorization on case ${code3}.`);
46930
+ else if (outcome === "dead") console.log(`The authorization on case ${code3} was already revoked or expired.`);
46749
46931
  else if (outcome === "unreachable") {
46750
- console.error(`The server could not be reached, so the authorization on case ${code2} may still be live: revoke it in the web app, at ${agentsPage}.`);
46932
+ console.error(`The server could not be reached, so the authorization on case ${code3} may still be live: revoke it in the web app, at ${agentsPage}.`);
46751
46933
  } else {
46752
- console.error(`This machine's keyring held no token for case ${code2}. If the web app still lists its authorization, revoke it there, at ${agentsPage}.`);
46934
+ console.error(`This machine's keyring held no token for case ${code3}. If the web app still lists its authorization, revoke it there, at ${agentsPage}.`);
46753
46935
  }
46754
46936
  if (keyringCleared) {
46755
46937
  console.log("The case token is removed from this machine.");
@@ -49546,8 +49728,8 @@ function requireFlagValue(flagArgs, index, flag) {
49546
49728
  }
49547
49729
  function errorCodeOf(body) {
49548
49730
  try {
49549
- const code2 = JSON.parse(body)?.error;
49550
- return typeof code2 === "string" ? code2 : null;
49731
+ const code3 = JSON.parse(body)?.error;
49732
+ return typeof code3 === "string" ? code3 : null;
49551
49733
  } catch {
49552
49734
  return null;
49553
49735
  }
@@ -51160,8 +51342,8 @@ import { Command as Command5 } from "commander";
51160
51342
  function isRetryable(err) {
51161
51343
  if (isNetworkError(err)) return true;
51162
51344
  if (!(err instanceof ApiError)) return false;
51163
- const code2 = dataErrorCode(err);
51164
- if (code2 && RETRYABLE_CODES.has(code2)) return true;
51345
+ const code3 = dataErrorCode(err);
51346
+ if (code3 && RETRYABLE_CODES.has(code3)) return true;
51165
51347
  return err.status >= 500 && err.status !== 501;
51166
51348
  }
51167
51349
  function isExpiredSession(err) {
@@ -51177,8 +51359,8 @@ async function withRetry(state, fn, what) {
51177
51359
  } catch (err) {
51178
51360
  lastErr = err;
51179
51361
  if (!isRetryable(err) || attempt === MAX_ATTEMPTS) throw err;
51180
- const code2 = err instanceof ApiError ? dataErrorCode(err) : null;
51181
- if (!code2 || !RETRYABLE_CODES.has(code2)) state.sawAmbiguous = true;
51362
+ const code3 = err instanceof ApiError ? dataErrorCode(err) : null;
51363
+ if (!code3 || !RETRYABLE_CODES.has(code3)) state.sawAmbiguous = true;
51182
51364
  const delay3 = BASE_BACKOFF_MS * 2 ** (attempt - 1);
51183
51365
  console.error(
51184
51366
  ` ${what}: ${err.message} \u2014 retrying in ${delay3}ms (${attempt}/${MAX_ATTEMPTS - 1})`
@@ -53294,13 +53476,13 @@ function routeErrorsToCli(command2) {
53294
53476
  return command2;
53295
53477
  }
53296
53478
  function handleParserExit(err) {
53297
- const { code: code2, exitCode } = err ?? {};
53298
- if (code2 === "commander.helpDisplayed" || code2 === "commander.version") return;
53299
- if (code2 === "commander.help") {
53479
+ const { code: code3, exitCode } = err ?? {};
53480
+ if (code3 === "commander.helpDisplayed" || code3 === "commander.version") return;
53481
+ if (code3 === "commander.help") {
53300
53482
  process.exitCode = exitCode || 1;
53301
53483
  return;
53302
53484
  }
53303
- if (typeof code2 === "string" && code2.startsWith("commander.")) {
53485
+ if (typeof code3 === "string" && code3.startsWith("commander.")) {
53304
53486
  throw expected(err instanceof Error ? err.message : String(err));
53305
53487
  }
53306
53488
  throw err;