@wayai/cli 0.3.248 → 0.3.249

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
@@ -447,11 +447,11 @@ function captureException2(error, context) {
447
447
  Sentry.captureException(error);
448
448
  });
449
449
  }
450
- function addApiBreadcrumb(method, path42) {
450
+ function addApiBreadcrumb(method, path43) {
451
451
  if (!initialized) return;
452
452
  Sentry.addBreadcrumb({
453
453
  category: "http",
454
- message: `${method} ${path42}`,
454
+ message: `${method} ${path43}`,
455
455
  level: "info"
456
456
  });
457
457
  }
@@ -905,8 +905,8 @@ var init_parseUtil = __esm({
905
905
  init_errors();
906
906
  init_en();
907
907
  makeIssue = (params) => {
908
- const { data, path: path42, errorMaps, issueData } = params;
909
- const fullPath = [...path42, ...issueData.path || []];
908
+ const { data, path: path43, errorMaps, issueData } = params;
909
+ const fullPath = [...path43, ...issueData.path || []];
910
910
  const fullIssue = {
911
911
  ...issueData,
912
912
  path: fullPath
@@ -1217,11 +1217,11 @@ var init_types = __esm({
1217
1217
  init_parseUtil();
1218
1218
  init_util();
1219
1219
  ParseInputLazyPath = class {
1220
- constructor(parent, value, path42, key) {
1220
+ constructor(parent, value, path43, key) {
1221
1221
  this._cachedPath = [];
1222
1222
  this.parent = parent;
1223
1223
  this.data = value;
1224
- this._path = path42;
1224
+ this._path = path43;
1225
1225
  this._key = key;
1226
1226
  }
1227
1227
  get path() {
@@ -4883,7 +4883,7 @@ var init_fs_safety = __esm({
4883
4883
  "src/lib/fs-safety.ts"() {
4884
4884
  "use strict";
4885
4885
  init_expected();
4886
- HUB_MANAGED_SUBDIRS = ["agents", "evals", "journeys", "skills", "resources", "attachments", "call-openings"];
4886
+ HUB_MANAGED_SUBDIRS = ["agents", "evals", "journeys", "skills", "resources", "attachments", "call-openings", "pages"];
4887
4887
  HUB_CONFIG_FILES = ["hub.yaml", "wayai.yaml"];
4888
4888
  }
4889
4889
  });
@@ -5138,6 +5138,80 @@ var init_chunk_Q7KIQHAZ = __esm({
5138
5138
  }
5139
5139
  });
5140
5140
 
5141
+ // ../../packages/core/dist/chunk-IPXBFWUU.js
5142
+ var variantAiModeSchema, experimentStatusSchema, overlayUpdateSchema, experimentIdParam, variantIdParam, listExperimentsQuery, listVariantsQuery, listOverridesQuery, deleteOverrideQuery, createExperimentBody, updateExperimentBody, setExperimentStatusBody, createVariantBody, updateVariantBody, upsertOverrideBody;
5143
+ var init_chunk_IPXBFWUU = __esm({
5144
+ "../../packages/core/dist/chunk-IPXBFWUU.js"() {
5145
+ "use strict";
5146
+ init_chunk_6TSQ5HXC();
5147
+ init_zod();
5148
+ variantAiModeSchema = external_exports.enum(["pilot+copilot", "pilot", "copilot", "turned_off"]);
5149
+ experimentStatusSchema = external_exports.enum(["draft", "running", "stopped"]);
5150
+ overlayUpdateSchema = external_exports.record(external_exports.unknown()).nullish().transform((v) => v === void 0 ? void 0 : v && Object.keys(v).length > 0 ? v : null);
5151
+ experimentIdParam = external_exports.object({
5152
+ id: external_exports.string().uuid()
5153
+ });
5154
+ variantIdParam = external_exports.object({
5155
+ id: external_exports.string().uuid()
5156
+ });
5157
+ listExperimentsQuery = external_exports.object({
5158
+ hub_id: external_exports.string().uuid()
5159
+ });
5160
+ listVariantsQuery = external_exports.object({
5161
+ hub_id: external_exports.string().uuid(),
5162
+ experiment_id: external_exports.string().uuid().optional()
5163
+ });
5164
+ listOverridesQuery = external_exports.object({
5165
+ hub_id: external_exports.string().uuid(),
5166
+ variant_id: external_exports.string().uuid()
5167
+ });
5168
+ deleteOverrideQuery = external_exports.object({
5169
+ hub_id: external_exports.string().uuid(),
5170
+ variant_id: external_exports.string().uuid(),
5171
+ agent_id: external_exports.string().uuid()
5172
+ });
5173
+ createExperimentBody = external_exports.object({
5174
+ hub_id: external_exports.string().uuid(),
5175
+ experiment_slug: slugSchema.optional(),
5176
+ experiment_name: external_exports.string().min(1, "experiment_name is required").max(100, "experiment_name must be 100 characters or fewer"),
5177
+ primary_metric: external_exports.string().max(200).nullish(),
5178
+ status: experimentStatusSchema.default("draft")
5179
+ });
5180
+ updateExperimentBody = external_exports.object({
5181
+ // experiment_slug is immutable after first persist — not accepted here.
5182
+ experiment_name: external_exports.string().min(1).max(100).optional(),
5183
+ primary_metric: external_exports.string().max(200).nullish(),
5184
+ control_variant_id: external_exports.string().uuid().nullish()
5185
+ });
5186
+ setExperimentStatusBody = external_exports.object({
5187
+ status: experimentStatusSchema
5188
+ });
5189
+ createVariantBody = external_exports.object({
5190
+ hub_id: external_exports.string().uuid(),
5191
+ experiment_id: external_exports.string().uuid(),
5192
+ label: external_exports.string().min(1, "label is required").max(100, "label must be 100 characters or fewer"),
5193
+ weight: external_exports.number().positive().default(1),
5194
+ ai_mode: variantAiModeSchema.nullish(),
5195
+ is_control: external_exports.boolean().default(false)
5196
+ });
5197
+ updateVariantBody = external_exports.object({
5198
+ label: external_exports.string().min(1).max(100).optional(),
5199
+ weight: external_exports.number().positive().optional(),
5200
+ ai_mode: variantAiModeSchema.nullish(),
5201
+ is_control: external_exports.boolean().optional()
5202
+ });
5203
+ upsertOverrideBody = external_exports.object({
5204
+ hub_id: external_exports.string().uuid(),
5205
+ variant_id: external_exports.string().uuid(),
5206
+ agent_id: external_exports.string().uuid(),
5207
+ instructions: external_exports.string().nullish(),
5208
+ additional_context_template: external_exports.string().nullish(),
5209
+ connection_id: external_exports.string().uuid().nullish(),
5210
+ agent_settings_overlay: overlayUpdateSchema
5211
+ });
5212
+ }
5213
+ });
5214
+
5141
5215
  // ../../packages/core/dist/chunk-NKLVUTFO.js
5142
5216
  var BASE_CREDENTIAL_MANAGED_BY, BASE_CREDENTIAL_NAME_MAX, BASE_CREDENTIAL_NAME_PATTERN, BASE_CREDENTIAL_NAME_CHARSET, baseCredentialNameSchema, createBaseCredentialLinkBody, baseCredentialLinkParams, baseCredentialLinkQuery;
5143
5217
  var init_chunk_NKLVUTFO = __esm({
@@ -5520,76 +5594,145 @@ var init_chunk_HA7CRZMX = __esm({
5520
5594
  }
5521
5595
  });
5522
5596
 
5523
- // ../../packages/core/dist/chunk-IPXBFWUU.js
5524
- var variantAiModeSchema, experimentStatusSchema, overlayUpdateSchema, experimentIdParam, variantIdParam, listExperimentsQuery, listVariantsQuery, listOverridesQuery, deleteOverrideQuery, createExperimentBody, updateExperimentBody, setExperimentStatusBody, createVariantBody, updateVariantBody, upsertOverrideBody;
5525
- var init_chunk_IPXBFWUU = __esm({
5526
- "../../packages/core/dist/chunk-IPXBFWUU.js"() {
5597
+ // ../../packages/core/dist/chunk-IPDOHAZ5.js
5598
+ var reportSourceSchema, intakeReportSourceSchema, reportClassificationSchema, reportStatusSchema, reportLocaleSchema, reportMessageAuthorRoleSchema, reportMessageSchema, sentryRefStatusSchema, createReportBody, editReportBody, reporterReportSummarySchema, reporterListResponseSchema, getReportResponseSchema, reporterTransitionResponseSchema, contestReportBody, reporterListQuery, listReportsQuery, GITHUB_ISSUE_URL_REGEX, githubIssueUrlSchema, transitionReportBody, groupReportsBody, holdReportBody;
5599
+ var init_chunk_IPDOHAZ5 = __esm({
5600
+ "../../packages/core/dist/chunk-IPDOHAZ5.js"() {
5527
5601
  "use strict";
5528
- init_chunk_6TSQ5HXC();
5602
+ init_chunk_HZ6CADSY();
5529
5603
  init_zod();
5530
- variantAiModeSchema = external_exports.enum(["pilot+copilot", "pilot", "copilot", "turned_off"]);
5531
- experimentStatusSchema = external_exports.enum(["draft", "running", "stopped"]);
5532
- overlayUpdateSchema = external_exports.record(external_exports.unknown()).nullish().transform((v) => v === void 0 ? void 0 : v && Object.keys(v).length > 0 ? v : null);
5533
- experimentIdParam = external_exports.object({
5534
- id: external_exports.string().uuid()
5604
+ reportSourceSchema = external_exports.enum(["sentry", "cli", "review", "security_audit"]);
5605
+ intakeReportSourceSchema = external_exports.enum(["cli", "review", "security_audit"]);
5606
+ reportClassificationSchema = external_exports.enum(["bug", "flaky_test", "security", "enhancement"]);
5607
+ reportStatusSchema = external_exports.enum([
5608
+ "pending",
5609
+ "grouped",
5610
+ "escalated",
5611
+ "shipped",
5612
+ "contested",
5613
+ "addressed",
5614
+ "dismissed"
5615
+ ]);
5616
+ reportLocaleSchema = external_exports.enum(["en", "pt", "es"]);
5617
+ reportMessageAuthorRoleSchema = external_exports.enum(["reporter", "triage", "fixer", "system"]);
5618
+ reportMessageSchema = external_exports.object({
5619
+ message_id: external_exports.string(),
5620
+ author_role: reportMessageAuthorRoleSchema,
5621
+ /** The status transition this note accompanied (e.g. 'shipped'); null for a free/system note. */
5622
+ transition: external_exports.string().nullable(),
5623
+ body: external_exports.string(),
5624
+ created_at: timestampSchema,
5625
+ /**
5626
+ * Visibility: `false` = reporter-facing (the default for every narrative entry); `true` =
5627
+ * triage-internal (e.g. a `hold` rationale) — surfaced to platform admins only and NEVER
5628
+ * returned on the reporter read path. The reporter's `GET /api/reports/:id` filters these out.
5629
+ */
5630
+ internal: external_exports.boolean()
5535
5631
  });
5536
- variantIdParam = external_exports.object({
5537
- id: external_exports.string().uuid()
5632
+ sentryRefStatusSchema = external_exports.enum(["valid", "not_found", "mismatch", "unverified"]);
5633
+ createReportBody = external_exports.object({
5634
+ title: external_exports.string().min(5).max(256),
5635
+ description: external_exports.string().min(10).max(5e3),
5636
+ steps_to_reproduce: external_exports.string().max(3e3).optional(),
5637
+ error_message: external_exports.string().max(2e3).optional(),
5638
+ // Taxonomy (server defaults: source=cli, classification=bug when absent).
5639
+ source: intakeReportSourceSchema.optional(),
5640
+ classification: reportClassificationSchema.optional(),
5641
+ // Stable dedup key (e.g. "<file>::<test>" for flaky, "<file>:<line>" for
5642
+ // security). When present, the fingerprint uses it instead of the body hash.
5643
+ dedup_key: external_exports.string().min(1).max(256).optional(),
5644
+ // Context fields (auto-captured by the CLI)
5645
+ organization_id: external_exports.string().optional(),
5646
+ hub_id: external_exports.string().uuid().optional(),
5647
+ hub_name: external_exports.string().max(256).optional(),
5648
+ conversation_id: external_exports.string().uuid().optional(),
5649
+ agent_id: external_exports.string().uuid().optional(),
5650
+ agent_name: external_exports.string().max(256).optional(),
5651
+ client_version: external_exports.string().max(64).optional(),
5652
+ additional_context: external_exports.string().max(2e3).optional()
5538
5653
  });
5539
- listExperimentsQuery = external_exports.object({
5540
- hub_id: external_exports.string().uuid()
5654
+ editReportBody = external_exports.object({
5655
+ title: external_exports.string().min(5).max(256).optional(),
5656
+ description: external_exports.string().min(10).max(5e3).optional(),
5657
+ steps_to_reproduce: external_exports.string().max(3e3).optional(),
5658
+ error_message: external_exports.string().max(2e3).optional(),
5659
+ additional_context: external_exports.string().max(2e3).optional()
5660
+ }).strict().refine((b) => Object.keys(b).length > 0, {
5661
+ message: "at least one field must be provided"
5541
5662
  });
5542
- listVariantsQuery = external_exports.object({
5543
- hub_id: external_exports.string().uuid(),
5544
- experiment_id: external_exports.string().uuid().optional()
5663
+ reporterReportSummarySchema = external_exports.object({
5664
+ report_id: external_exports.string(),
5665
+ title: external_exports.string(),
5666
+ description: external_exports.string(),
5667
+ classification: reportClassificationSchema,
5668
+ status: reportStatusSchema,
5669
+ created_at: timestampSchema,
5670
+ triaged_at: timestampSchema.nullable(),
5671
+ resolved_at: timestampSchema.nullable(),
5672
+ /** How many times the reporter has contested (gates the hard cap). */
5673
+ contest_count: external_exports.number(),
5674
+ /** True once triage issued a non-contestable (final) dismissal. */
5675
+ dismissal_final: external_exports.boolean()
5545
5676
  });
5546
- listOverridesQuery = external_exports.object({
5547
- hub_id: external_exports.string().uuid(),
5548
- variant_id: external_exports.string().uuid()
5677
+ reporterListResponseSchema = external_exports.object({
5678
+ data: external_exports.array(reporterReportSummarySchema)
5549
5679
  });
5550
- deleteOverrideQuery = external_exports.object({
5551
- hub_id: external_exports.string().uuid(),
5552
- variant_id: external_exports.string().uuid(),
5553
- agent_id: external_exports.string().uuid()
5680
+ getReportResponseSchema = external_exports.object({
5681
+ report: reporterReportSummarySchema,
5682
+ messages: external_exports.array(reportMessageSchema)
5554
5683
  });
5555
- createExperimentBody = external_exports.object({
5556
- hub_id: external_exports.string().uuid(),
5557
- experiment_slug: slugSchema.optional(),
5558
- experiment_name: external_exports.string().min(1, "experiment_name is required").max(100, "experiment_name must be 100 characters or fewer"),
5559
- primary_metric: external_exports.string().max(200).nullish(),
5560
- status: experimentStatusSchema.default("draft")
5684
+ reporterTransitionResponseSchema = external_exports.object({
5685
+ report: reporterReportSummarySchema
5561
5686
  });
5562
- updateExperimentBody = external_exports.object({
5563
- // experiment_slug is immutable after first persist — not accepted here.
5564
- experiment_name: external_exports.string().min(1).max(100).optional(),
5565
- primary_metric: external_exports.string().max(200).nullish(),
5566
- control_variant_id: external_exports.string().uuid().nullish()
5687
+ contestReportBody = external_exports.object({
5688
+ reason: external_exports.string().min(1).max(5e3)
5567
5689
  });
5568
- setExperimentStatusBody = external_exports.object({
5569
- status: experimentStatusSchema
5690
+ reporterListQuery = external_exports.object({
5691
+ status: reportStatusSchema.optional()
5570
5692
  });
5571
- createVariantBody = external_exports.object({
5572
- hub_id: external_exports.string().uuid(),
5573
- experiment_id: external_exports.string().uuid(),
5574
- label: external_exports.string().min(1, "label is required").max(100, "label must be 100 characters or fewer"),
5575
- weight: external_exports.number().positive().default(1),
5576
- ai_mode: variantAiModeSchema.nullish(),
5577
- is_control: external_exports.boolean().default(false)
5693
+ listReportsQuery = external_exports.object({
5694
+ status: reportStatusSchema.optional(),
5695
+ source: reportSourceSchema.optional(),
5696
+ limit: external_exports.coerce.number().int().min(1).max(200).optional(),
5697
+ offset: external_exports.coerce.number().int().min(0).optional(),
5698
+ /** ISO 8601 lower bound on created_at. */
5699
+ since: external_exports.string().datetime().optional(),
5700
+ /**
5701
+ * ISO 8601 lower bound on resolution time — "what did we resolve recently", which `since`
5702
+ * (a created_at filter) cannot answer for a long-lived report resolved yesterday. Implies
5703
+ * a terminal status (`addressed`/`dismissed`) and orders on that same axis.
5704
+ */
5705
+ resolved_since: external_exports.string().datetime().optional()
5578
5706
  });
5579
- updateVariantBody = external_exports.object({
5580
- label: external_exports.string().min(1).max(100).optional(),
5581
- weight: external_exports.number().positive().optional(),
5582
- ai_mode: variantAiModeSchema.nullish(),
5583
- is_control: external_exports.boolean().optional()
5707
+ GITHUB_ISSUE_URL_REGEX = /^https:\/\/github\.com\/[^/]+\/[^/]+\/issues\/\d+(?:[/?#]|$)/;
5708
+ githubIssueUrlSchema = external_exports.string().url().refine((u) => GITHUB_ISSUE_URL_REGEX.test(u), {
5709
+ message: "must be an https://github.com/<owner>/<repo>/issues/<number> URL"
5584
5710
  });
5585
- upsertOverrideBody = external_exports.object({
5586
- hub_id: external_exports.string().uuid(),
5587
- variant_id: external_exports.string().uuid(),
5588
- agent_id: external_exports.string().uuid(),
5589
- instructions: external_exports.string().nullish(),
5590
- additional_context_template: external_exports.string().nullish(),
5591
- connection_id: external_exports.string().uuid().nullish(),
5592
- agent_settings_overlay: overlayUpdateSchema
5711
+ transitionReportBody = external_exports.discriminatedUnion("target", [
5712
+ external_exports.object({
5713
+ target: external_exports.literal("escalated"),
5714
+ gh_issue_url: githubIssueUrlSchema,
5715
+ ai_verdict: external_exports.string().max(2e3).optional()
5716
+ }),
5717
+ external_exports.object({
5718
+ target: external_exports.literal("shipped"),
5719
+ note: external_exports.string().min(1).max(2e3).optional()
5720
+ }),
5721
+ external_exports.object({
5722
+ target: external_exports.literal("addressed")
5723
+ }),
5724
+ external_exports.object({
5725
+ target: external_exports.literal("dismissed"),
5726
+ dismissal_reason: external_exports.string().min(1).max(5e3),
5727
+ ai_verdict: external_exports.string().max(2e3).optional(),
5728
+ final: external_exports.boolean().optional()
5729
+ })
5730
+ ]);
5731
+ groupReportsBody = external_exports.object({
5732
+ member_ids: external_exports.array(external_exports.string().uuid()).min(1).max(100)
5733
+ });
5734
+ holdReportBody = external_exports.object({
5735
+ reason: external_exports.string().min(1).max(5e3)
5593
5736
  });
5594
5737
  }
5595
5738
  });
@@ -5929,27 +6072,27 @@ var init_chunk_5XEJSR22 = __esm({
5929
6072
  });
5930
6073
 
5931
6074
  // ../../packages/core/dist/chunk-KKA642DR.js
5932
- function matchPath(pattern, path42) {
5933
- const normalizedPath = path42.replace(/\/$/, "");
6075
+ function matchPath(pattern, path43) {
6076
+ const normalizedPath = path43.replace(/\/$/, "");
5934
6077
  if (pattern.endsWith("/*")) {
5935
6078
  const prefix = pattern.slice(0, -2);
5936
6079
  return normalizedPath === prefix || normalizedPath.startsWith(prefix + "/");
5937
6080
  }
5938
6081
  return pattern === normalizedPath;
5939
6082
  }
5940
- function getEndpointConfig(path42) {
6083
+ function getEndpointConfig(path43) {
5941
6084
  for (const excluded of EXCLUDED_PATHS) {
5942
- if (matchPath(excluded, path42)) {
6085
+ if (matchPath(excluded, path43)) {
5943
6086
  return null;
5944
6087
  }
5945
6088
  }
5946
- const normalizedPath = path42.replace(/\/$/, "");
6089
+ const normalizedPath = path43.replace(/\/$/, "");
5947
6090
  if (!normalizedPath.endsWith("/*") && Object.prototype.hasOwnProperty.call(ENDPOINT_CONFIGS, normalizedPath)) {
5948
6091
  return ENDPOINT_CONFIGS[normalizedPath];
5949
6092
  }
5950
6093
  const sortedPatterns = Object.keys(ENDPOINT_CONFIGS).sort((a, b) => b.length - a.length);
5951
6094
  for (const pattern of sortedPatterns) {
5952
- if (matchPath(pattern, path42)) {
6095
+ if (matchPath(pattern, path43)) {
5953
6096
  return ENDPOINT_CONFIGS[pattern];
5954
6097
  }
5955
6098
  }
@@ -6864,149 +7007,6 @@ var init_chunk_QIY3NIYY = __esm({
6864
7007
  }
6865
7008
  });
6866
7009
 
6867
- // ../../packages/core/dist/chunk-IPDOHAZ5.js
6868
- var reportSourceSchema, intakeReportSourceSchema, reportClassificationSchema, reportStatusSchema, reportLocaleSchema, reportMessageAuthorRoleSchema, reportMessageSchema, sentryRefStatusSchema, createReportBody, editReportBody, reporterReportSummarySchema, reporterListResponseSchema, getReportResponseSchema, reporterTransitionResponseSchema, contestReportBody, reporterListQuery, listReportsQuery, GITHUB_ISSUE_URL_REGEX, githubIssueUrlSchema, transitionReportBody, groupReportsBody, holdReportBody;
6869
- var init_chunk_IPDOHAZ5 = __esm({
6870
- "../../packages/core/dist/chunk-IPDOHAZ5.js"() {
6871
- "use strict";
6872
- init_chunk_HZ6CADSY();
6873
- init_zod();
6874
- reportSourceSchema = external_exports.enum(["sentry", "cli", "review", "security_audit"]);
6875
- intakeReportSourceSchema = external_exports.enum(["cli", "review", "security_audit"]);
6876
- reportClassificationSchema = external_exports.enum(["bug", "flaky_test", "security", "enhancement"]);
6877
- reportStatusSchema = external_exports.enum([
6878
- "pending",
6879
- "grouped",
6880
- "escalated",
6881
- "shipped",
6882
- "contested",
6883
- "addressed",
6884
- "dismissed"
6885
- ]);
6886
- reportLocaleSchema = external_exports.enum(["en", "pt", "es"]);
6887
- reportMessageAuthorRoleSchema = external_exports.enum(["reporter", "triage", "fixer", "system"]);
6888
- reportMessageSchema = external_exports.object({
6889
- message_id: external_exports.string(),
6890
- author_role: reportMessageAuthorRoleSchema,
6891
- /** The status transition this note accompanied (e.g. 'shipped'); null for a free/system note. */
6892
- transition: external_exports.string().nullable(),
6893
- body: external_exports.string(),
6894
- created_at: timestampSchema,
6895
- /**
6896
- * Visibility: `false` = reporter-facing (the default for every narrative entry); `true` =
6897
- * triage-internal (e.g. a `hold` rationale) — surfaced to platform admins only and NEVER
6898
- * returned on the reporter read path. The reporter's `GET /api/reports/:id` filters these out.
6899
- */
6900
- internal: external_exports.boolean()
6901
- });
6902
- sentryRefStatusSchema = external_exports.enum(["valid", "not_found", "mismatch", "unverified"]);
6903
- createReportBody = external_exports.object({
6904
- title: external_exports.string().min(5).max(256),
6905
- description: external_exports.string().min(10).max(5e3),
6906
- steps_to_reproduce: external_exports.string().max(3e3).optional(),
6907
- error_message: external_exports.string().max(2e3).optional(),
6908
- // Taxonomy (server defaults: source=cli, classification=bug when absent).
6909
- source: intakeReportSourceSchema.optional(),
6910
- classification: reportClassificationSchema.optional(),
6911
- // Stable dedup key (e.g. "<file>::<test>" for flaky, "<file>:<line>" for
6912
- // security). When present, the fingerprint uses it instead of the body hash.
6913
- dedup_key: external_exports.string().min(1).max(256).optional(),
6914
- // Context fields (auto-captured by the CLI)
6915
- organization_id: external_exports.string().optional(),
6916
- hub_id: external_exports.string().uuid().optional(),
6917
- hub_name: external_exports.string().max(256).optional(),
6918
- conversation_id: external_exports.string().uuid().optional(),
6919
- agent_id: external_exports.string().uuid().optional(),
6920
- agent_name: external_exports.string().max(256).optional(),
6921
- client_version: external_exports.string().max(64).optional(),
6922
- additional_context: external_exports.string().max(2e3).optional()
6923
- });
6924
- editReportBody = external_exports.object({
6925
- title: external_exports.string().min(5).max(256).optional(),
6926
- description: external_exports.string().min(10).max(5e3).optional(),
6927
- steps_to_reproduce: external_exports.string().max(3e3).optional(),
6928
- error_message: external_exports.string().max(2e3).optional(),
6929
- additional_context: external_exports.string().max(2e3).optional()
6930
- }).strict().refine((b) => Object.keys(b).length > 0, {
6931
- message: "at least one field must be provided"
6932
- });
6933
- reporterReportSummarySchema = external_exports.object({
6934
- report_id: external_exports.string(),
6935
- title: external_exports.string(),
6936
- description: external_exports.string(),
6937
- classification: reportClassificationSchema,
6938
- status: reportStatusSchema,
6939
- created_at: timestampSchema,
6940
- triaged_at: timestampSchema.nullable(),
6941
- resolved_at: timestampSchema.nullable(),
6942
- /** How many times the reporter has contested (gates the hard cap). */
6943
- contest_count: external_exports.number(),
6944
- /** True once triage issued a non-contestable (final) dismissal. */
6945
- dismissal_final: external_exports.boolean()
6946
- });
6947
- reporterListResponseSchema = external_exports.object({
6948
- data: external_exports.array(reporterReportSummarySchema)
6949
- });
6950
- getReportResponseSchema = external_exports.object({
6951
- report: reporterReportSummarySchema,
6952
- messages: external_exports.array(reportMessageSchema)
6953
- });
6954
- reporterTransitionResponseSchema = external_exports.object({
6955
- report: reporterReportSummarySchema
6956
- });
6957
- contestReportBody = external_exports.object({
6958
- reason: external_exports.string().min(1).max(5e3)
6959
- });
6960
- reporterListQuery = external_exports.object({
6961
- status: reportStatusSchema.optional()
6962
- });
6963
- listReportsQuery = external_exports.object({
6964
- status: reportStatusSchema.optional(),
6965
- source: reportSourceSchema.optional(),
6966
- limit: external_exports.coerce.number().int().min(1).max(200).optional(),
6967
- offset: external_exports.coerce.number().int().min(0).optional(),
6968
- /** ISO 8601 lower bound on created_at. */
6969
- since: external_exports.string().datetime().optional(),
6970
- /**
6971
- * ISO 8601 lower bound on resolution time — "what did we resolve recently", which `since`
6972
- * (a created_at filter) cannot answer for a long-lived report resolved yesterday. Implies
6973
- * a terminal status (`addressed`/`dismissed`) and orders on that same axis.
6974
- */
6975
- resolved_since: external_exports.string().datetime().optional()
6976
- });
6977
- GITHUB_ISSUE_URL_REGEX = /^https:\/\/github\.com\/[^/]+\/[^/]+\/issues\/\d+(?:[/?#]|$)/;
6978
- githubIssueUrlSchema = external_exports.string().url().refine((u) => GITHUB_ISSUE_URL_REGEX.test(u), {
6979
- message: "must be an https://github.com/<owner>/<repo>/issues/<number> URL"
6980
- });
6981
- transitionReportBody = external_exports.discriminatedUnion("target", [
6982
- external_exports.object({
6983
- target: external_exports.literal("escalated"),
6984
- gh_issue_url: githubIssueUrlSchema,
6985
- ai_verdict: external_exports.string().max(2e3).optional()
6986
- }),
6987
- external_exports.object({
6988
- target: external_exports.literal("shipped"),
6989
- note: external_exports.string().min(1).max(2e3).optional()
6990
- }),
6991
- external_exports.object({
6992
- target: external_exports.literal("addressed")
6993
- }),
6994
- external_exports.object({
6995
- target: external_exports.literal("dismissed"),
6996
- dismissal_reason: external_exports.string().min(1).max(5e3),
6997
- ai_verdict: external_exports.string().max(2e3).optional(),
6998
- final: external_exports.boolean().optional()
6999
- })
7000
- ]);
7001
- groupReportsBody = external_exports.object({
7002
- member_ids: external_exports.array(external_exports.string().uuid()).min(1).max(100)
7003
- });
7004
- holdReportBody = external_exports.object({
7005
- reason: external_exports.string().min(1).max(5e3)
7006
- });
7007
- }
7008
- });
7009
-
7010
7010
  // ../../packages/core/dist/chunk-YUZFHVB2.js
7011
7011
  var invitePreviewQuery, inviteRolePreviewResponse, inviteContactPreviewResponse, invitePreviewResponse, inviteUnsubscribeBody;
7012
7012
  var init_chunk_YUZFHVB2 = __esm({
@@ -9947,9 +9947,9 @@ function monitorRuleActions(monitorConfig) {
9947
9947
  if (!monitorConfig || typeof monitorConfig !== "object") return [];
9948
9948
  const config = monitorConfig;
9949
9949
  const found = [];
9950
- const visit = (action, path42) => {
9950
+ const visit = (action, path43) => {
9951
9951
  if (!action || typeof action !== "object" || Array.isArray(action)) return;
9952
- found.push({ action, path: path42 });
9952
+ found.push({ action, path: path43 });
9953
9953
  };
9954
9954
  if (Array.isArray(config.rules)) {
9955
9955
  config.rules.forEach((rule, index) => {
@@ -9981,25 +9981,25 @@ function collectMonitorRuleIssues(monitorConfig) {
9981
9981
  const trigger = resolveMonitorTrigger(monitorConfig);
9982
9982
  const kinds = monitorRuleActionKinds(trigger);
9983
9983
  const issues = [...callUtteranceRuleIssues(monitorConfig), ...automationGateIssues(monitorConfig)];
9984
- for (const { action, path: path42 } of monitorRuleActions(monitorConfig)) {
9985
- if (trigger === "call_utterance" && path42[0] === "fallback") continue;
9984
+ for (const { action, path: path43 } of monitorRuleActions(monitorConfig)) {
9985
+ if (trigger === "call_utterance" && path43[0] === "fallback") continue;
9986
9986
  const kind = action.kind;
9987
9987
  if (typeof kind === "string" && !kinds.includes(kind)) {
9988
- issues.push({ path: [...path42, "kind"], message: monitorActionKindMessage(kind, trigger) });
9988
+ issues.push({ path: [...path43, "kind"], message: monitorActionKindMessage(kind, trigger) });
9989
9989
  }
9990
9990
  const toolName = action.tool_name;
9991
9991
  if (kind === "call_tool" && typeof toolName === "string" && isRefusedNativeToolName(toolName, trigger)) {
9992
- issues.push({ path: [...path42, "tool_name"], message: monitorRuleToolNotAllowedMessage(toolName, trigger) });
9992
+ issues.push({ path: [...path43, "tool_name"], message: monitorRuleToolNotAllowedMessage(toolName, trigger) });
9993
9993
  continue;
9994
9994
  }
9995
9995
  if (kind === "call_tool" && toolName === INSERT_NOTE_TOOL_NAME) {
9996
- issues.push(...insertNoteArgumentIssues(action, path42));
9996
+ issues.push(...insertNoteArgumentIssues(action, path43));
9997
9997
  }
9998
9998
  if (kind === "call_tool" && toolName === RUN_MONITOR_TOOL_NAME) {
9999
9999
  const callee = readRunMonitorCallee(action);
10000
10000
  if (!callee.ok) {
10001
10001
  issues.push({
10002
- path: [...path42, "args", "monitor_name"],
10002
+ path: [...path43, "args", "monitor_name"],
10003
10003
  message: runMonitorCalleeMessage(callee.reason)
10004
10004
  });
10005
10005
  }
@@ -10059,11 +10059,11 @@ function insertNoteTemplateMessage(reason) {
10059
10059
  return `insert_note's template is longer than the ${MONITOR_NOTE_TEMPLATE_MAX}-character limit.`;
10060
10060
  }
10061
10061
  }
10062
- function insertNoteArgumentIssues(action, path42) {
10062
+ function insertNoteArgumentIssues(action, path43) {
10063
10063
  const result = readInsertNoteTemplate(action);
10064
10064
  if (result.ok) return [];
10065
10065
  return [{
10066
- path: [...path42, "args", "template"],
10066
+ path: [...path43, "args", "template"],
10067
10067
  message: insertNoteTemplateMessage(result.reason)
10068
10068
  }];
10069
10069
  }
@@ -10837,12 +10837,12 @@ function typeMatches(typeField, allowed) {
10837
10837
  if (Array.isArray(typeField)) return typeField.every((t) => typeof t === "string" && allowed.has(t));
10838
10838
  return false;
10839
10839
  }
10840
- function validateSchema(schema, path42, errors, opts = {}) {
10840
+ function validateSchema(schema, path43, errors, opts = {}) {
10841
10841
  if (typeof schema === "boolean") return;
10842
10842
  const depth = opts.depth ?? 0;
10843
10843
  if (depth > MAX_SCHEMA_DEPTH) {
10844
10844
  errors.push({
10845
- path: path42 || "<root>",
10845
+ path: path43 || "<root>",
10846
10846
  message: `schema nesting exceeds ${MAX_SCHEMA_DEPTH} levels`,
10847
10847
  suggestion: "Flatten the schema; LLM providers reject deeply nested tool input_schemas."
10848
10848
  });
@@ -10850,7 +10850,7 @@ function validateSchema(schema, path42, errors, opts = {}) {
10850
10850
  }
10851
10851
  if (!isRecord2(schema)) {
10852
10852
  errors.push({
10853
- path: path42,
10853
+ path: path43,
10854
10854
  message: `expected object, got ${schema === null ? "null" : typeof schema}`
10855
10855
  });
10856
10856
  return;
@@ -10858,14 +10858,14 @@ function validateSchema(schema, path42, errors, opts = {}) {
10858
10858
  if (opts.isRoot) {
10859
10859
  if ("type" in schema && schema.type !== "object") {
10860
10860
  errors.push({
10861
- path: path42 ? `${path42}.type` : "type",
10861
+ path: path43 ? `${path43}.type` : "type",
10862
10862
  message: `root type must be 'object', got ${JSON.stringify(schema.type)}`,
10863
10863
  suggestion: "Tool parameters at the root must be an object: `{ type: 'object', properties: { ... } }`."
10864
10864
  });
10865
10865
  }
10866
10866
  } else if ("type" in schema && !typeMatches(schema.type, ALLOWED_TYPES)) {
10867
10867
  errors.push({
10868
- path: `${path42}.type`,
10868
+ path: `${path43}.type`,
10869
10869
  message: `type must be one of ${[...ALLOWED_TYPES].join("/")} or an array of those, got ${JSON.stringify(schema.type)}`
10870
10870
  });
10871
10871
  }
@@ -10875,25 +10875,25 @@ function validateSchema(schema, path42, errors, opts = {}) {
10875
10875
  const isPlaceholder = PLACEHOLDER_TOKENS.includes(e);
10876
10876
  const isOutcomePlaceholder = e === "[KANBAN_OUTCOME_VALUES]";
10877
10877
  errors.push({
10878
- path: `${path42}.enum`,
10878
+ path: `${path43}.enum`,
10879
10879
  message: `enum must be a non-empty array of primitives, got string ${JSON.stringify(e)}`,
10880
10880
  suggestion: isOutcomePlaceholder ? "Declare `outcomes` on the hub's terminal kanban status so the platform can render the placeholder into a valid array; with none configured the platform drops the parameter instead." : isPlaceholder ? "Set `operation: 'update_kanban_status'` on the tool and ensure at least one hub.kanban_status has `allowsAgentUpdate: true` so the platform can render the placeholder into a valid array." : 'Wrap the value in an array: `enum: ["value"]`.'
10881
10881
  });
10882
10882
  } else if (!Array.isArray(e)) {
10883
10883
  errors.push({
10884
- path: `${path42}.enum`,
10884
+ path: `${path43}.enum`,
10885
10885
  message: `enum must be a non-empty array of primitives, got ${typeof e}`
10886
10886
  });
10887
10887
  } else if (e.length === 0) {
10888
10888
  errors.push({
10889
- path: `${path42}.enum`,
10889
+ path: `${path43}.enum`,
10890
10890
  message: "enum must not be empty"
10891
10891
  });
10892
10892
  } else {
10893
10893
  for (let i = 0; i < e.length; i++) {
10894
10894
  if (!isPrimitive(e[i])) {
10895
10895
  errors.push({
10896
- path: `${path42}.enum[${i}]`,
10896
+ path: `${path43}.enum[${i}]`,
10897
10897
  message: `enum entry must be a primitive (string/number/boolean/null), got ${typeof e[i]}`
10898
10898
  });
10899
10899
  }
@@ -10903,7 +10903,7 @@ function validateSchema(schema, path42, errors, opts = {}) {
10903
10903
  for (const key of ["exclusiveMinimum", "exclusiveMaximum"]) {
10904
10904
  if (key in schema && typeof schema[key] === "boolean") {
10905
10905
  errors.push({
10906
- path: `${path42}.${key}`,
10906
+ path: `${path43}.${key}`,
10907
10907
  message: `${key} as boolean is draft-04 syntax; draft 2020-12 requires a numeric value`,
10908
10908
  suggestion: `Replace with the numeric bound, e.g. \`${key}: 0\`.`
10909
10909
  });
@@ -10912,45 +10912,45 @@ function validateSchema(schema, path42, errors, opts = {}) {
10912
10912
  if ("properties" in schema) {
10913
10913
  if (!isRecord2(schema.properties)) {
10914
10914
  errors.push({
10915
- path: `${path42}.properties`,
10915
+ path: `${path43}.properties`,
10916
10916
  message: `properties must be an object, got ${Array.isArray(schema.properties) ? "array" : typeof schema.properties}`
10917
10917
  });
10918
10918
  } else {
10919
10919
  for (const [propName, propSchema] of Object.entries(schema.properties)) {
10920
- validateSchema(propSchema, `${path42}.properties.${propName}`, errors, { depth: depth + 1 });
10920
+ validateSchema(propSchema, `${path43}.properties.${propName}`, errors, { depth: depth + 1 });
10921
10921
  }
10922
10922
  }
10923
10923
  }
10924
10924
  if (schemaTypeIncludes(schema, "array") && "items" in schema) {
10925
10925
  if (Array.isArray(schema.items)) {
10926
- schema.items.forEach((sub, i) => validateSchema(sub, `${path42}.items[${i}]`, errors, { depth: depth + 1 }));
10926
+ schema.items.forEach((sub, i) => validateSchema(sub, `${path43}.items[${i}]`, errors, { depth: depth + 1 }));
10927
10927
  } else {
10928
- validateSchema(schema.items, `${path42}.items`, errors, { depth: depth + 1 });
10928
+ validateSchema(schema.items, `${path43}.items`, errors, { depth: depth + 1 });
10929
10929
  }
10930
10930
  }
10931
10931
  for (const key of SUBSCHEMA_OBJECT_KEYWORDS) {
10932
10932
  if (key in schema && isRecord2(schema[key])) {
10933
- validateSchema(schema[key], `${path42}.${key}`, errors, { depth: depth + 1 });
10933
+ validateSchema(schema[key], `${path43}.${key}`, errors, { depth: depth + 1 });
10934
10934
  }
10935
10935
  }
10936
10936
  for (const key of SUBSCHEMA_LIST_KEYWORDS) {
10937
10937
  const list2 = schema[key];
10938
10938
  if (Array.isArray(list2)) {
10939
- list2.forEach((sub, i) => validateSchema(sub, `${path42}.${key}[${i}]`, errors, { depth: depth + 1 }));
10939
+ list2.forEach((sub, i) => validateSchema(sub, `${path43}.${key}[${i}]`, errors, { depth: depth + 1 }));
10940
10940
  }
10941
10941
  }
10942
10942
  for (const key of SUBSCHEMA_MAP_KEYWORDS) {
10943
10943
  const map = schema[key];
10944
10944
  if (isRecord2(map)) {
10945
10945
  for (const [name, sub] of Object.entries(map)) {
10946
- validateSchema(sub, `${path42}.${key}.${name}`, errors, { depth: depth + 1 });
10946
+ validateSchema(sub, `${path43}.${key}.${name}`, errors, { depth: depth + 1 });
10947
10947
  }
10948
10948
  }
10949
10949
  }
10950
10950
  const reportedPaths = new Set(errors.map((e) => e.path));
10951
10951
  for (const [k, v] of Object.entries(schema)) {
10952
10952
  if (typeof v !== "string") continue;
10953
- const fieldPath = `${path42}.${k}`;
10953
+ const fieldPath = `${path43}.${k}`;
10954
10954
  if (reportedPaths.has(fieldPath)) continue;
10955
10955
  for (const token of PLACEHOLDER_TOKENS) {
10956
10956
  if (v === token) {
@@ -11116,6 +11116,125 @@ var init_chunk_I6T2KTYE = __esm({
11116
11116
  }
11117
11117
  });
11118
11118
 
11119
+ // ../../packages/core/dist/chunk-PJYOHUIZ.js
11120
+ function utf8ByteLength(text2) {
11121
+ let bytes = 0;
11122
+ for (let i = 0; i < text2.length; i++) {
11123
+ const code = text2.charCodeAt(i);
11124
+ if (code < 128) bytes += 1;
11125
+ else if (code < 2048) bytes += 2;
11126
+ else if (code >= 55296 && code <= 56319 && i + 1 < text2.length) {
11127
+ const next = text2.charCodeAt(i + 1);
11128
+ if (next >= 56320 && next <= 57343) {
11129
+ bytes += 4;
11130
+ i += 1;
11131
+ } else {
11132
+ bytes += 3;
11133
+ }
11134
+ } else bytes += 3;
11135
+ }
11136
+ return bytes;
11137
+ }
11138
+ function pageHtmlIssue(html) {
11139
+ if (typeof html !== "string" || !/\S/.test(html)) return "a page needs its HTML: one non-empty, self-contained file";
11140
+ const bytes = utf8ByteLength(html);
11141
+ if (bytes > PAGE_HTML_MAX_BYTES) {
11142
+ return `a page's HTML is at most ${PAGE_HTML_MAX_BYTES / 1024} KiB; this one is ${Math.ceil(bytes / 1024)} KiB`;
11143
+ }
11144
+ return null;
11145
+ }
11146
+ var PAGES_PER_HUB_MAX, PAGE_HTML_MAX_BYTES, PAGE_SLUG_MAX, PAGE_SLUG_REGEX, PAGE_TITLE_MAX, PAGE_DESCRIPTION_MAX, PAGE_ORDER_MAX, PAGE_TOOLS_MAX, PAGE_CONNECTION_NAME_MAX, PAGE_TOOL_NAME_MAX, PAGE_PARAMS_MAX_CHARS, PAGE_AUDIENCES, PAGE_NOTIFY_LEVELS, pageSlugSchema, pageToolSchema, pageParamsSchema, pageManifestObject, pageManifestSchema, pageSummarySchema;
11147
+ var init_chunk_PJYOHUIZ = __esm({
11148
+ "../../packages/core/dist/chunk-PJYOHUIZ.js"() {
11149
+ "use strict";
11150
+ init_chunk_WEXVYJ5H();
11151
+ init_zod();
11152
+ PAGES_PER_HUB_MAX = 20;
11153
+ PAGE_HTML_MAX_BYTES = 512 * 1024;
11154
+ PAGE_SLUG_MAX = 64;
11155
+ PAGE_SLUG_REGEX = /^[a-z0-9]+(-[a-z0-9]+)*$/;
11156
+ PAGE_TITLE_MAX = 120;
11157
+ PAGE_DESCRIPTION_MAX = 500;
11158
+ PAGE_ORDER_MAX = 1e3;
11159
+ PAGE_TOOLS_MAX = 50;
11160
+ PAGE_CONNECTION_NAME_MAX = 200;
11161
+ PAGE_TOOL_NAME_MAX = 128;
11162
+ PAGE_PARAMS_MAX_CHARS = 16 * 1024;
11163
+ PAGE_AUDIENCES = ["team"];
11164
+ PAGE_NOTIFY_LEVELS = ["none", "summary"];
11165
+ pageSlugSchema = external_exports.string().min(1).max(PAGE_SLUG_MAX).regex(PAGE_SLUG_REGEX, {
11166
+ message: 'a page slug is lowercase letters, digits and hyphens (e.g. "swim-results")'
11167
+ });
11168
+ pageToolSchema = external_exports.object({
11169
+ /** The toolset connection's name, as `hub.yaml` names it. */
11170
+ connection: external_exports.string().trim().min(1).max(PAGE_CONNECTION_NAME_MAX),
11171
+ /** The tool's name in its connection's catalog. */
11172
+ tool: external_exports.string().trim().min(1).max(PAGE_TOOL_NAME_MAX),
11173
+ notify: external_exports.enum(PAGE_NOTIFY_LEVELS).default("none")
11174
+ }).strict();
11175
+ pageParamsSchema = external_exports.record(external_exports.unknown()).superRefine((schema, ctx) => {
11176
+ if (JSON.stringify(schema).length > PAGE_PARAMS_MAX_CHARS) {
11177
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: `params is at most ${PAGE_PARAMS_MAX_CHARS} characters of JSON` });
11178
+ return;
11179
+ }
11180
+ const result = validateToolInputSchema(schema);
11181
+ if (!result.ok) {
11182
+ for (const error of result.errors) {
11183
+ ctx.addIssue({
11184
+ code: external_exports.ZodIssueCode.custom,
11185
+ message: `params is not a valid JSON Schema${error.path ? ` at "${error.path}"` : ""}: ${error.message}`
11186
+ });
11187
+ }
11188
+ }
11189
+ });
11190
+ pageManifestObject = external_exports.object({
11191
+ slug: pageSlugSchema,
11192
+ title: external_exports.string().trim().min(1).max(PAGE_TITLE_MAX),
11193
+ description: external_exports.string().trim().max(PAGE_DESCRIPTION_MAX).nullable().default(null),
11194
+ audience: external_exports.enum(PAGE_AUDIENCES, {
11195
+ errorMap: () => ({ message: 'audience must be "team": customer pages are not available yet' })
11196
+ }),
11197
+ /** Team users without a grant on the hub may run the page's tools. Grant holders always may. */
11198
+ team_writes: external_exports.boolean().default(false),
11199
+ /** The page is offered in the conversation header to whoever may open it. */
11200
+ show_in_conversation: external_exports.boolean().default(false),
11201
+ /** Menu position, lowest first; pages of equal order sort by slug. */
11202
+ order: external_exports.number().int().min(0).max(PAGE_ORDER_MAX).default(0),
11203
+ params: pageParamsSchema.nullable().default(null),
11204
+ tools: external_exports.array(pageToolSchema).max(PAGE_TOOLS_MAX).default([])
11205
+ }).strict();
11206
+ pageManifestSchema = pageManifestObject.superRefine((manifest, ctx) => {
11207
+ const seen = /* @__PURE__ */ new Set();
11208
+ manifest.tools.forEach((t, i) => {
11209
+ if (seen.has(t.tool)) {
11210
+ ctx.addIssue({
11211
+ code: external_exports.ZodIssueCode.custom,
11212
+ path: ["tools", i, "tool"],
11213
+ message: `two tools are named "${t.tool}": a page calls a tool by its name alone, so tool names are unique across the manifest`
11214
+ });
11215
+ }
11216
+ seen.add(t.tool);
11217
+ });
11218
+ });
11219
+ pageSummarySchema = external_exports.object({
11220
+ slug: external_exports.string(),
11221
+ title: external_exports.string(),
11222
+ description: external_exports.string().nullable(),
11223
+ audience: external_exports.string(),
11224
+ team_writes: external_exports.boolean(),
11225
+ show_in_conversation: external_exports.boolean(),
11226
+ order: external_exports.number(),
11227
+ params: external_exports.record(external_exports.unknown()).nullable(),
11228
+ tools: external_exports.array(external_exports.object({ connection: external_exports.string(), tool: external_exports.string(), notify: external_exports.string() })),
11229
+ revision: external_exports.string(),
11230
+ /** The HTML's size in UTF-8 bytes. */
11231
+ html_bytes: external_exports.number().int().nonnegative(),
11232
+ created_at: external_exports.string(),
11233
+ updated_at: external_exports.string()
11234
+ });
11235
+ }
11236
+ });
11237
+
11119
11238
  // ../../packages/core/dist/chunk-4LXDRTO4.js
11120
11239
  var EVAL_ATTACHMENT_HASH_REGEX, CALL_OPENING_HASH_REGEX;
11121
11240
  var init_chunk_4LXDRTO4 = __esm({
@@ -11244,8 +11363,8 @@ function evalInitialStateError(input) {
11244
11363
  const parsed = evalInitialStateEntry.safeParse(entries[i]);
11245
11364
  if (!parsed.success) {
11246
11365
  const issue = parsed.error.issues[0];
11247
- const path42 = issue?.path.join(".") || "?";
11248
- return `initial_state[${i}].${path42} is invalid: ${issue?.message ?? "malformed"}`;
11366
+ const path43 = issue?.path.join(".") || "?";
11367
+ return `initial_state[${i}].${path43} is invalid: ${issue?.message ?? "malformed"}`;
11249
11368
  }
11250
11369
  if (seenSlugs.has(parsed.data.slug)) {
11251
11370
  return `initial_state[${i}].slug "${parsed.data.slug}" is declared more than once`;
@@ -11702,6 +11821,57 @@ var init_chunk_LBDH7LCG = __esm({
11702
11821
  }
11703
11822
  });
11704
11823
 
11824
+ // ../../packages/core/dist/chunk-2ATLBDFP.js
11825
+ var primaryRegionSchema, placementSourceSchema, orgIdParam, orgAdminIdParam, createOrganizationBody, updateOrganizationBody, addOrgAdminBody;
11826
+ var init_chunk_2ATLBDFP = __esm({
11827
+ "../../packages/core/dist/chunk-2ATLBDFP.js"() {
11828
+ "use strict";
11829
+ init_chunk_HZ6CADSY();
11830
+ init_zod();
11831
+ primaryRegionSchema = external_exports.enum([
11832
+ "wnam",
11833
+ "enam",
11834
+ "sam",
11835
+ "weur",
11836
+ "eeur",
11837
+ "apac",
11838
+ "oc",
11839
+ "afr",
11840
+ "me"
11841
+ ]);
11842
+ placementSourceSchema = external_exports.enum([
11843
+ "hub_config",
11844
+ "org_config",
11845
+ "parent_cascade",
11846
+ "cf_colo",
11847
+ "country",
11848
+ "fallback",
11849
+ "unpinned"
11850
+ ]);
11851
+ orgIdParam = external_exports.object({
11852
+ id: uuidSchema
11853
+ });
11854
+ orgAdminIdParam = external_exports.object({
11855
+ id: uuidSchema,
11856
+ adminId: external_exports.string().min(1)
11857
+ });
11858
+ createOrganizationBody = external_exports.object({
11859
+ organization_name: external_exports.string().min(1, "organization_name is required"),
11860
+ // Write-once at creation; updateOrganizationBody does not accept this.
11861
+ primary_region: primaryRegionSchema.optional()
11862
+ });
11863
+ updateOrganizationBody = external_exports.object({
11864
+ organization_name: external_exports.string().min(1).optional(),
11865
+ organization_avatar_url: external_exports.string().url().nullable().optional(),
11866
+ timezone: external_exports.string().optional(),
11867
+ business_hours: external_exports.unknown().optional()
11868
+ }).passthrough();
11869
+ addOrgAdminBody = external_exports.object({
11870
+ user_email: external_exports.string().email("valid email is required")
11871
+ });
11872
+ }
11873
+ });
11874
+
11705
11875
  // ../../packages/core/dist/chunk-AMG6HKUQ.js
11706
11876
  function isEventRelativeFollowupType(type) {
11707
11877
  return typeof type === "string" && EVENT_RELATIVE_FOLLOWUP_TYPES.includes(type);
@@ -11710,12 +11880,12 @@ function validateFollowupLinks(followups, label, ctx) {
11710
11880
  const linkTargets = /* @__PURE__ */ new Set();
11711
11881
  followups.forEach((followup, i) => {
11712
11882
  const ref = followup?.after_followup_id;
11713
- const path42 = ["followups", i, "after_followup_id"];
11883
+ const path43 = ["followups", i, "after_followup_id"];
11714
11884
  if (followup?.type !== "inactivity_after_before_event") {
11715
11885
  if (ref !== void 0) {
11716
11886
  ctx.addIssue({
11717
11887
  code: external_exports.ZodIssueCode.custom,
11718
- path: path42,
11888
+ path: path43,
11719
11889
  message: `kanban status ${label}: after_followup_id is only valid on inactivity_after_before_event followups (this one is ${followup?.type})`
11720
11890
  });
11721
11891
  }
@@ -11724,7 +11894,7 @@ function validateFollowupLinks(followups, label, ctx) {
11724
11894
  if (ref === void 0) {
11725
11895
  ctx.addIssue({
11726
11896
  code: external_exports.ZodIssueCode.custom,
11727
- path: path42,
11897
+ path: path43,
11728
11898
  message: `kanban status ${label}: inactivity_after_before_event requires after_followup_id naming the id of a before_event followup in the same status`
11729
11899
  });
11730
11900
  return;
@@ -11734,7 +11904,7 @@ function validateFollowupLinks(followups, label, ctx) {
11734
11904
  if (matches.length > 1) {
11735
11905
  ctx.addIssue({
11736
11906
  code: external_exports.ZodIssueCode.custom,
11737
- path: path42,
11907
+ path: path43,
11738
11908
  message: `kanban status ${label}: after_followup_id "${ref}" matches ${matches.length} followups \u2014 a link must name exactly one`
11739
11909
  });
11740
11910
  return;
@@ -11746,7 +11916,7 @@ function validateFollowupLinks(followups, label, ctx) {
11746
11916
  );
11747
11917
  ctx.addIssue({
11748
11918
  code: external_exports.ZodIssueCode.custom,
11749
- path: path42,
11919
+ path: path43,
11750
11920
  message: hasIdlessBeforeEvent ? `kanban status ${label}: after_followup_id "${ref}" matches no followup \u2014 a link target must declare an explicit id, and this status has before_event followups without one` : `kanban status ${label}: after_followup_id "${ref}" matches no followup in this status`
11751
11921
  });
11752
11922
  return;
@@ -11754,7 +11924,7 @@ function validateFollowupLinks(followups, label, ctx) {
11754
11924
  if (target.type !== "before_event") {
11755
11925
  ctx.addIssue({
11756
11926
  code: external_exports.ZodIssueCode.custom,
11757
- path: path42,
11927
+ path: path43,
11758
11928
  message: `kanban status ${label}: after_followup_id "${ref}" points at a ${target.type} followup \u2014 only before_event followups can anchor a chain`
11759
11929
  });
11760
11930
  }
@@ -12096,56 +12266,6 @@ var init_chunk_AMG6HKUQ = __esm({
12096
12266
  }
12097
12267
  });
12098
12268
 
12099
- // ../../packages/core/dist/chunk-3VHMUK4W.js
12100
- var primaryRegionSchema, placementSourceSchema, orgIdParam, orgAdminIdParam, createOrganizationBody, updateOrganizationBody, addOrgAdminBody;
12101
- var init_chunk_3VHMUK4W = __esm({
12102
- "../../packages/core/dist/chunk-3VHMUK4W.js"() {
12103
- "use strict";
12104
- init_chunk_HZ6CADSY();
12105
- init_zod();
12106
- primaryRegionSchema = external_exports.enum([
12107
- "wnam",
12108
- "enam",
12109
- "sam",
12110
- "weur",
12111
- "eeur",
12112
- "apac",
12113
- "oc",
12114
- "afr",
12115
- "me"
12116
- ]);
12117
- placementSourceSchema = external_exports.enum([
12118
- "hub_config",
12119
- "org_config",
12120
- "parent_cascade",
12121
- "cf_colo",
12122
- "country",
12123
- "fallback"
12124
- ]);
12125
- orgIdParam = external_exports.object({
12126
- id: uuidSchema
12127
- });
12128
- orgAdminIdParam = external_exports.object({
12129
- id: uuidSchema,
12130
- adminId: external_exports.string().min(1)
12131
- });
12132
- createOrganizationBody = external_exports.object({
12133
- organization_name: external_exports.string().min(1, "organization_name is required"),
12134
- // Write-once at creation; updateOrganizationBody does not accept this.
12135
- primary_region: primaryRegionSchema.optional()
12136
- });
12137
- updateOrganizationBody = external_exports.object({
12138
- organization_name: external_exports.string().min(1).optional(),
12139
- organization_avatar_url: external_exports.string().url().nullable().optional(),
12140
- timezone: external_exports.string().optional(),
12141
- business_hours: external_exports.unknown().optional()
12142
- }).passthrough();
12143
- addOrgAdminBody = external_exports.object({
12144
- user_email: external_exports.string().email("valid email is required")
12145
- });
12146
- }
12147
- });
12148
-
12149
12269
  // ../../packages/core/dist/chunk-5BOYRUX2.js
12150
12270
  function byLocale(entry) {
12151
12271
  const shape = Object.fromEntries(SUPPORTED_LOCALES.map((locale) => [locale, entry.optional()]));
@@ -12184,7 +12304,7 @@ var init_chunk_5BOYRUX2 = __esm({
12184
12304
  }
12185
12305
  });
12186
12306
 
12187
- // ../../packages/core/dist/chunk-O7IPFQTZ.js
12307
+ // ../../packages/core/dist/chunk-ETFW6QY3.js
12188
12308
  function refineLaneReferences(val, ctx) {
12189
12309
  const lanes = val.lanes;
12190
12310
  const statuses = val.kanban_statuses;
@@ -12208,11 +12328,11 @@ function describeSyncWarning(warning) {
12208
12328
  return `${label}: ${parts.join("; ")}. Promote the base so production's tools match the preview's.`;
12209
12329
  }
12210
12330
  var hubIdParam, hubAdminIdParam, hubUserIdParam, hubAgentIdParam, hubIdentityIdParam, hubTeamIdParam, hubTeamUserDeleteParam, hubSchemaQuery, HUB_USERS_PAGE_SIZE_MAX, HUB_USERS_SEARCH_MAX, HUB_USERS_CHANNEL_TYPES, getHubUsersQuery, PREVIEW_LABEL_MAX_LENGTH, MAX_ENDED_INDEX_RETENTION_DAYS, MAX_EVAL_RETENTION_DAYS, MAX_END_USER_DAILY_MESSAGE_LIMIT, endUserDailyMessageLimitField, previewLabelField, hubTagsField, createHubBody, updateHubBody, HUB_TAG_CHANGE_REFUSED, hubTagChangeRefusalSchema, addHubAdminBody, addHubIdentityAuthorizationBody, contactDecisionBody, approveContactBody, CONTACT_ACCESS_PAGE_SIZE_MAX, listContactAccessQuery, createHubTeamBody, updateHubTeamBody, addHubTeamUserBody, reassignHubUserBody, replicatePreviewBody, HUB_DIFF_SECTION_SET, HUB_DIFF_SECTIONS, updateChannelTestIdentitiesBody, claimCodeChannelParam, claimCodeDeleteParam;
12211
- var init_chunk_O7IPFQTZ = __esm({
12212
- "../../packages/core/dist/chunk-O7IPFQTZ.js"() {
12331
+ var init_chunk_ETFW6QY3 = __esm({
12332
+ "../../packages/core/dist/chunk-ETFW6QY3.js"() {
12213
12333
  "use strict";
12334
+ init_chunk_2ATLBDFP();
12214
12335
  init_chunk_AMG6HKUQ();
12215
- init_chunk_3VHMUK4W();
12216
12336
  init_chunk_5BOYRUX2();
12217
12337
  init_chunk_HZ6CADSY();
12218
12338
  init_zod();
@@ -12389,6 +12509,7 @@ var init_chunk_O7IPFQTZ = __esm({
12389
12509
  message_templates: true,
12390
12510
  contact_lists: true,
12391
12511
  automations: true,
12512
+ pages: true,
12392
12513
  evals: true
12393
12514
  };
12394
12515
  HUB_DIFF_SECTIONS = Object.keys(HUB_DIFF_SECTION_SET);
@@ -12407,7 +12528,7 @@ var init_chunk_O7IPFQTZ = __esm({
12407
12528
  }
12408
12529
  });
12409
12530
 
12410
- // ../../packages/core/dist/chunk-VD5QA4ZZ.js
12531
+ // ../../packages/core/dist/chunk-MKMRGNBS.js
12411
12532
  function refineHubAsCodeCustomTools(config, ctx) {
12412
12533
  const agents = config.agents;
12413
12534
  if (!Array.isArray(agents)) return;
@@ -12572,10 +12693,10 @@ function refineHubAsCodeCustomers(config, ctx) {
12572
12693
  function refineHubAsCodeEvalAttachments(config, ctx) {
12573
12694
  const cfg = config;
12574
12695
  const referencedHashes = /* @__PURE__ */ new Set();
12575
- const addTurnIssue = (path42, turn, name) => {
12696
+ const addTurnIssue = (path43, turn, name) => {
12576
12697
  const error = evalTurnAttachmentsError(turn);
12577
12698
  if (error) {
12578
- ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: path42, message: `${name}: ${error}` });
12699
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: path43, message: `${name}: ${error}` });
12579
12700
  return;
12580
12701
  }
12581
12702
  for (const hash of collectTurnAttachmentHashes(turn)) referencedHashes.add(hash);
@@ -12666,17 +12787,17 @@ function refineHubAsCodeCallOpenings(config, ctx) {
12666
12787
  const agent = entry;
12667
12788
  const openings = agent?.call_openings;
12668
12789
  if (openings === void 0 || openings === null) return;
12669
- const path42 = ["agents", a, "call_openings"];
12790
+ const path43 = ["agents", a, "call_openings"];
12670
12791
  const name = `agent "${typeof agent?.name === "string" ? agent.name : "<unnamed>"}"`;
12671
12792
  if (typeof openings !== "object" || Array.isArray(openings)) {
12672
- ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: path42, message: `${name}: call_openings must map a language to an opening` });
12793
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: path43, message: `${name}: call_openings must map a language to an opening` });
12673
12794
  return;
12674
12795
  }
12675
12796
  if (agent?.role !== "pilot_voice" && Object.keys(openings).length > 0) {
12676
- ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: path42, message: `${name}: only a pilot_voice agent has call_openings` });
12797
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: path43, message: `${name}: only a pilot_voice agent has call_openings` });
12677
12798
  }
12678
12799
  for (const [language, raw] of Object.entries(openings)) {
12679
- const at = [...path42, language];
12800
+ const at = [...path43, language];
12680
12801
  if (!callOpeningLanguage.safeParse(language).success) {
12681
12802
  ctx.addIssue({ code: external_exports.ZodIssueCode.custom, path: at, message: `${name}: call_openings language must be one of ${CALL_OPENING_LANGUAGES.join(", ")}` });
12682
12803
  continue;
@@ -12725,7 +12846,7 @@ function refineHubAsCodeCallOpenings(config, ctx) {
12725
12846
  });
12726
12847
  }
12727
12848
  }
12728
- function utf8ByteLength(value) {
12849
+ function utf8ByteLength2(value) {
12729
12850
  let bytes = 0;
12730
12851
  for (let i = 0; i < value.length; i++) {
12731
12852
  const code = value.charCodeAt(i);
@@ -12758,7 +12879,7 @@ function refineHubAsCodeResources(config, ctx) {
12758
12879
  }
12759
12880
  }
12760
12881
  if (typeof entry.content === "string") {
12761
- const contentBytes = utf8ByteLength(entry.content);
12882
+ const contentBytes = utf8ByteLength2(entry.content);
12762
12883
  aggregateEncoded += contentBytes;
12763
12884
  if (contentBytes > MAX_RESOURCE_FILE_SIZE) {
12764
12885
  ctx.addIssue({
@@ -12803,11 +12924,11 @@ function refineHubAsCodeDelegation(config, ctx) {
12803
12924
  }
12804
12925
  }
12805
12926
  if (del.context_boundary === void 0) return;
12806
- const path42 = ["agents", agentIndex, "tools", "delegation", delIndex, "context_boundary"];
12927
+ const path43 = ["agents", agentIndex, "tools", "delegation", delIndex, "context_boundary"];
12807
12928
  if (del.type !== "hub") {
12808
12929
  ctx.addIssue({
12809
12930
  code: external_exports.ZodIssueCode.custom,
12810
- path: path42,
12931
+ path: path43,
12811
12932
  message: `context_boundary applies only to \`type: hub\` delegations (got type "${String(del.type)}")`
12812
12933
  });
12813
12934
  return;
@@ -12815,7 +12936,7 @@ function refineHubAsCodeDelegation(config, ctx) {
12815
12936
  if (!CONTEXT_BOUNDARIES.includes(del.context_boundary)) {
12816
12937
  ctx.addIssue({
12817
12938
  code: external_exports.ZodIssueCode.custom,
12818
- path: path42,
12939
+ path: path43,
12819
12940
  message: `context_boundary must be one of: ${CONTEXT_BOUNDARIES.join(", ")}`
12820
12941
  });
12821
12942
  }
@@ -13006,17 +13127,18 @@ function skillSectionsAsResources(scope) {
13006
13127
  return out;
13007
13128
  };
13008
13129
  }
13009
- var MAX_10MB_BASE64_ENCODED_BYTES, MAX_EVAL_ATTACHMENT_ENCODED_BYTES, MAX_EVAL_ATTACHMENT_CARRIERS, MAX_EVAL_ATTACHMENT_AGGREGATE_ENCODED_BYTES, MAX_RESOURCE_ENCODED_BYTES, MAX_HUB_AS_CODE_RESOURCES, MAX_HUB_AS_CODE_RESOURCE_FILES, MAX_RESOURCE_AGGREGATE_ENCODED_BYTES, MAX_CI_CONFIG_BODY_BYTES, MAX_CALL_OPENING_CARRIERS, MAX_CALL_OPENING_AGGREGATE_ENCODED_BYTES, hubAsCodeStateSchema, hubAsCodeResourceFileSchema, hubAsCodeResourceSchema, uuidPattern, ciUuidSchema, boundedHubAsCodeResourcesSchema, isPlainObject, MIN_SKILLS_LAYOUT_CLI, hubAsCodeConfigSchema, ciPullHubIdParam, ciBranchParam, ciPullQuery, ciHubsQuery, ciLookupQuery, ciBranchesQuery, ciSyncBody, ciPushBody, ciDiffBody, ciPublishBody, ciPublishPreviewBody, ciSyncMcpBody, ciOrgResourcesParam, orgResourcesConfigSchema, ciOrgResourcesPushBody, ciOrgResourcesDiffBody, CI_APPLY_ENTITY_KINDS, CI_APPLY_OPERATIONS, ciApplyErrorBaseSchema, ciApplyErrorSchema, ciSyncCountSchema, ciSyncChangesSchema, ciSyncWarningSchema, ciSyncResponseSchema;
13010
- var init_chunk_VD5QA4ZZ = __esm({
13011
- "../../packages/core/dist/chunk-VD5QA4ZZ.js"() {
13130
+ var MAX_10MB_BASE64_ENCODED_BYTES, MAX_EVAL_ATTACHMENT_ENCODED_BYTES, MAX_EVAL_ATTACHMENT_CARRIERS, MAX_EVAL_ATTACHMENT_AGGREGATE_ENCODED_BYTES, MAX_RESOURCE_ENCODED_BYTES, MAX_HUB_AS_CODE_RESOURCES, MAX_HUB_AS_CODE_RESOURCE_FILES, MAX_RESOURCE_AGGREGATE_ENCODED_BYTES, MAX_CI_CONFIG_BODY_BYTES, MAX_HUB_AS_CODE_PAGE_MANIFEST_CHARS, hubAsCodePagesSchema, MAX_CALL_OPENING_CARRIERS, MAX_CALL_OPENING_AGGREGATE_ENCODED_BYTES, hubAsCodeStateSchema, hubAsCodeResourceFileSchema, hubAsCodeResourceSchema, uuidPattern, ciUuidSchema, boundedHubAsCodeResourcesSchema, isPlainObject, MIN_SKILLS_LAYOUT_CLI, hubAsCodeConfigSchema, ciPullHubIdParam, ciBranchParam, ciPullQuery, ciHubsQuery, ciLookupQuery, ciBranchesQuery, ciSyncBody, ciPushBody, ciDiffBody, ciPublishBody, ciPublishPreviewBody, ciSyncMcpBody, ciOrgResourcesParam, orgResourcesConfigSchema, ciOrgResourcesPushBody, ciOrgResourcesDiffBody, CI_APPLY_ENTITY_KINDS, CI_APPLY_OPERATIONS, ciApplyErrorBaseSchema, ciApplyErrorSchema, ciSyncCountSchema, ciSyncChangesSchema, ciSyncWarningSchema, ciSyncResponseSchema;
13131
+ var init_chunk_MKMRGNBS = __esm({
13132
+ "../../packages/core/dist/chunk-MKMRGNBS.js"() {
13012
13133
  "use strict";
13013
13134
  init_chunk_I6T2KTYE();
13014
13135
  init_chunk_OEDDM5YN();
13136
+ init_chunk_PJYOHUIZ();
13015
13137
  init_chunk_EKWR7732();
13016
13138
  init_chunk_TL7IF5CR();
13017
13139
  init_chunk_LBDH7LCG();
13018
13140
  init_chunk_4LXDRTO4();
13019
- init_chunk_O7IPFQTZ();
13141
+ init_chunk_ETFW6QY3();
13020
13142
  init_chunk_AMG6HKUQ();
13021
13143
  init_chunk_5BOYRUX2();
13022
13144
  init_chunk_WEXVYJ5H();
@@ -13033,6 +13155,15 @@ var init_chunk_VD5QA4ZZ = __esm({
13033
13155
  MAX_HUB_AS_CODE_RESOURCE_FILES = 5e3;
13034
13156
  MAX_RESOURCE_AGGREGATE_ENCODED_BYTES = 32 * 1024 * 1024;
13035
13157
  MAX_CI_CONFIG_BODY_BYTES = 64 * 1024 * 1024;
13158
+ MAX_HUB_AS_CODE_PAGE_MANIFEST_CHARS = 64 * 1024;
13159
+ hubAsCodePagesSchema = external_exports.array(external_exports.object({
13160
+ manifest: external_exports.record(external_exports.unknown()).superRefine((manifest, ctx) => {
13161
+ if (JSON.stringify(manifest).length > MAX_HUB_AS_CODE_PAGE_MANIFEST_CHARS) {
13162
+ ctx.addIssue({ code: external_exports.ZodIssueCode.custom, message: `a page manifest is at most ${MAX_HUB_AS_CODE_PAGE_MANIFEST_CHARS} characters of JSON` });
13163
+ }
13164
+ }),
13165
+ html: external_exports.string().max(PAGE_HTML_MAX_BYTES, `a page's HTML is at most ${PAGE_HTML_MAX_BYTES / 1024} KiB`)
13166
+ }).strict()).max(PAGES_PER_HUB_MAX, `a hub holds at most ${PAGES_PER_HUB_MAX} pages`);
13036
13167
  MAX_CALL_OPENING_CARRIERS = 30;
13037
13168
  MAX_CALL_OPENING_AGGREGATE_ENCODED_BYTES = 8 * 1024 * 1024;
13038
13169
  hubAsCodeStateSchema = external_exports.object({
@@ -13112,7 +13243,8 @@ var init_chunk_VD5QA4ZZ = __esm({
13112
13243
  end_user_daily_message_limit: endUserDailyMessageLimitField
13113
13244
  }).passthrough(),
13114
13245
  states: external_exports.array(hubAsCodeStateSchema).optional(),
13115
- resources: boundedHubAsCodeResourcesSchema.optional()
13246
+ resources: boundedHubAsCodeResourcesSchema.optional(),
13247
+ pages: hubAsCodePagesSchema.optional()
13116
13248
  }).passthrough().superRefine((config, ctx) => {
13117
13249
  refineHubAsCodeCustomTools(config, ctx);
13118
13250
  refineHubAsCodeKanbanStatuses(config, ctx);
@@ -13207,6 +13339,7 @@ var init_chunk_VD5QA4ZZ = __esm({
13207
13339
  "eval",
13208
13340
  "hub_config",
13209
13341
  "journey",
13342
+ "page",
13210
13343
  "resource",
13211
13344
  "resource_file",
13212
13345
  "state",
@@ -13272,7 +13405,11 @@ var init_chunk_VD5QA4ZZ = __esm({
13272
13405
  automations_deleted: ciSyncCountSchema,
13273
13406
  contact_lists_created: ciSyncCountSchema,
13274
13407
  contact_lists_updated: ciSyncCountSchema,
13275
- contact_lists_deleted: ciSyncCountSchema
13408
+ contact_lists_deleted: ciSyncCountSchema,
13409
+ // Hub pages (wayai-pro/wayai#5333): absent from a server older than its pages section.
13410
+ pages_created: ciSyncCountSchema.optional(),
13411
+ pages_updated: ciSyncCountSchema.optional(),
13412
+ pages_deleted: ciSyncCountSchema.optional()
13276
13413
  });
13277
13414
  ciSyncWarningSchema = external_exports.object({
13278
13415
  code: external_exports.string(),
@@ -13754,16 +13891,16 @@ function parseCommunityLessonVideoUrl(url) {
13754
13891
  const parts = /^https?:\/\/([^/?#]+)([^?#]*)(?:\?([^#]*))?(?:#.*)?$/i.exec(url.trim());
13755
13892
  if (!parts) return null;
13756
13893
  const host = parts[1].toLowerCase();
13757
- const path42 = parts[2] ?? "";
13894
+ const path43 = parts[2] ?? "";
13758
13895
  const query = parts[3] ?? "";
13759
13896
  let id;
13760
13897
  if (host === YOUTU_BE) {
13761
- id = /^\/([A-Za-z0-9_-]{11})\/?$/.exec(path42)?.[1];
13898
+ id = /^\/([A-Za-z0-9_-]{11})\/?$/.exec(path43)?.[1];
13762
13899
  } else if (YOUTUBE_HOSTS.has(host)) {
13763
- if (path42 === "/watch" || path42 === "/watch/") {
13900
+ if (path43 === "/watch" || path43 === "/watch/") {
13764
13901
  id = query.split("&").find((param) => param.startsWith("v="))?.slice(2);
13765
13902
  } else {
13766
- id = YOUTUBE_ID_PATH.exec(path42)?.[1];
13903
+ id = YOUTUBE_ID_PATH.exec(path43)?.[1];
13767
13904
  }
13768
13905
  }
13769
13906
  return id !== void 0 && YOUTUBE_ID.test(id) ? { provider: "youtube", id } : null;
@@ -14555,7 +14692,7 @@ var init_chunk_OMPT4ZHR = __esm({
14555
14692
  }
14556
14693
  });
14557
14694
 
14558
- // ../../packages/core/dist/chunk-5MZZUQPD.js
14695
+ // ../../packages/core/dist/chunk-XEO6FIPG.js
14559
14696
  function refineScopedTarget(data, ctx) {
14560
14697
  if (data.scope === "org") {
14561
14698
  if (!data.org_id) {
@@ -14581,13 +14718,13 @@ function refineScopedTarget(data, ctx) {
14581
14718
  }
14582
14719
  }
14583
14720
  var adminOrgIdParam, adminOrgAdminIdParam, adminUserIdParam, PRICING_PLAN_ID_RE, adminPlanIdParam, adminOrganizationsQuery, adminUserSearchQuery, kanbanSlugMigrationQuery, adjustQuotaBody, updatePlanBody, addAdminUserBody, MAX_VOICE_CALL_MINUTE_OPS, voiceCallMinuteOps, AUTOMATION_GATE_EVALUATIONS_PER_OPERATION_BOUND, automationGateEvaluationsPerOperation, AUTOMATION_RUN_RETENTION_DAYS_MAX, automationRunRetentionDays, turnDeadlineSeconds, updatePlatformConfigBody, updateFreeOrgLimitBody, adminScopedTargetShape, adminScopedTargetBody, adminRepairKnowledgeBlobsBody, BRANCHING_ORPHAN_ENTITY_TYPES, BRANCHING_ORPHAN_MAX_TARGETS, adminRepairBranchingOrphansBody, adminRepairLegacyOrgGrantsBody, adminRepairCompedPlansBody, updatePricingPlanBody, dataExplorerSearchQuery, dataExplorerOrgIdParam, dataExplorerHubIdParam, dataExplorerConvIdParam, dataExplorerDoInstancesQuery, dataExplorerNsIdParam, dataExplorerKvKeysBody, dataExplorerKvKeyBody, uuidOrHexId, dataExplorerDeleteOrgParam, dataExplorerDeleteHubParam, dataExplorerDeleteConvParam, dataExplorerDeleteUserParam, dataExplorerDeleteQuery, dataExplorerKvDeleteBody, pitrDoNamespace, pitrBookmarkParam, pitrRestoreBody, healthSamplingTriggerBody, DEBUG_DO_HEX_PREFIX, debugDoEntityId, debugTableName, dataExplorerDebugTablesParam, dataExplorerDebugRowsParam, dataExplorerDebugRowsQuery, dataExplorerDebugAnalyticsTable, debugUuid, dataExplorerDebugAnalyticsRowsParam, dataExplorerDebugAnalyticsRowsQuery, dataExplorerDebugCountsDoType, dataExplorerDebugCountsParam, debugHubConvParam, debugMessageIdQuery;
14584
- var init_chunk_5MZZUQPD = __esm({
14585
- "../../packages/core/dist/chunk-5MZZUQPD.js"() {
14721
+ var init_chunk_XEO6FIPG = __esm({
14722
+ "../../packages/core/dist/chunk-XEO6FIPG.js"() {
14586
14723
  "use strict";
14587
14724
  init_chunk_FECLIZTY();
14588
14725
  init_chunk_BFG4ZWR4();
14589
14726
  init_chunk_YZAIZJTO();
14590
- init_chunk_O7IPFQTZ();
14727
+ init_chunk_ETFW6QY3();
14591
14728
  init_chunk_OMPT4ZHR();
14592
14729
  init_chunk_HZ6CADSY();
14593
14730
  init_chunk_MIWZOSPI();
@@ -15283,6 +15420,7 @@ var init_contracts = __esm({
15283
15420
  "use strict";
15284
15421
  init_chunk_RACEDHG6();
15285
15422
  init_chunk_Q7KIQHAZ();
15423
+ init_chunk_IPXBFWUU();
15286
15424
  init_chunk_NKLVUTFO();
15287
15425
  init_chunk_ILW3RFGU();
15288
15426
  init_chunk_YVY2TZK2();
@@ -15290,7 +15428,7 @@ var init_contracts = __esm({
15290
15428
  init_chunk_K2UY4M4E();
15291
15429
  init_chunk_HA7CRZMX();
15292
15430
  init_chunk_MF2VVXBR();
15293
- init_chunk_IPXBFWUU();
15431
+ init_chunk_IPDOHAZ5();
15294
15432
  init_chunk_GPM7PE44();
15295
15433
  init_chunk_VEERWOZ6();
15296
15434
  init_chunk_ZC6YGHNX();
@@ -15300,7 +15438,6 @@ var init_contracts = __esm({
15300
15438
  init_chunk_5DGHIY7L();
15301
15439
  init_chunk_TUHJ5PQH();
15302
15440
  init_chunk_QIY3NIYY();
15303
- init_chunk_IPDOHAZ5();
15304
15441
  init_chunk_YUZFHVB2();
15305
15442
  init_chunk_I3O2RACG();
15306
15443
  init_chunk_34LE6P7E();
@@ -15317,10 +15454,11 @@ var init_contracts = __esm({
15317
15454
  init_chunk_KSTYTQ7I();
15318
15455
  init_chunk_LKBSHANA();
15319
15456
  init_chunk_BPCNB5RT();
15320
- init_chunk_VD5QA4ZZ();
15457
+ init_chunk_MKMRGNBS();
15321
15458
  init_chunk_I6T2KTYE();
15322
15459
  init_chunk_OEDDM5YN();
15323
15460
  init_chunk_TANTZFI3();
15461
+ init_chunk_PJYOHUIZ();
15324
15462
  init_chunk_EKWR7732();
15325
15463
  init_chunk_JDJ4EUOL();
15326
15464
  init_chunk_ZLJP22IA();
@@ -15345,13 +15483,13 @@ var init_contracts = __esm({
15345
15483
  init_chunk_JJWKZHF3();
15346
15484
  init_chunk_RHGPANBN();
15347
15485
  init_chunk_NVKU5PPQ();
15348
- init_chunk_5MZZUQPD();
15486
+ init_chunk_XEO6FIPG();
15349
15487
  init_chunk_FECLIZTY();
15350
15488
  init_chunk_BFG4ZWR4();
15351
15489
  init_chunk_YZAIZJTO();
15352
- init_chunk_O7IPFQTZ();
15490
+ init_chunk_ETFW6QY3();
15491
+ init_chunk_2ATLBDFP();
15353
15492
  init_chunk_AMG6HKUQ();
15354
- init_chunk_3VHMUK4W();
15355
15493
  init_chunk_5BOYRUX2();
15356
15494
  init_chunk_OMPT4ZHR();
15357
15495
  init_chunk_2PZIF56U();
@@ -16082,14 +16220,14 @@ function readOrgFields(doc) {
16082
16220
  if (name) config.organization_name = name;
16083
16221
  return { kind: "declared", config };
16084
16222
  }
16085
- function declarationFrom(load14) {
16086
- if (load14.kind === "absent") return { kind: "none" };
16087
- if (load14.kind === "malformed") return { kind: "invalid", detail: `it does not parse (${load14.reason})` };
16088
- return readOrgFields(load14.doc);
16223
+ function declarationFrom(load15) {
16224
+ if (load15.kind === "absent") return { kind: "none" };
16225
+ if (load15.kind === "malformed") return { kind: "invalid", detail: `it does not parse (${load15.reason})` };
16226
+ return readOrgFields(load15.doc);
16089
16227
  }
16090
- function legacyFieldsIn(load14) {
16091
- if (load14.kind !== "ok") return [];
16092
- return LEGACY_FIELDS.filter((f) => load14.doc[f] !== void 0);
16228
+ function legacyFieldsIn(load15) {
16229
+ if (load15.kind !== "ok") return [];
16230
+ return LEGACY_FIELDS.filter((f) => load15.doc[f] !== void 0);
16093
16231
  }
16094
16232
  function resolve3(gitRoot) {
16095
16233
  const manifestFile = workspaceManifestPath(gitRoot);
@@ -16275,13 +16413,13 @@ function writeRepoConfig(config, root) {
16275
16413
  if (stale.kind === "declared" && stale.config.organization_id !== config.organization_id) {
16276
16414
  throw expected(rebindRefusal(config.organization_id, stale.config.organization_id));
16277
16415
  }
16278
- const load14 = loadWorkspaceManifest(gitRoot);
16279
- if (load14.kind === "malformed") {
16416
+ const load15 = loadWorkspaceManifest(gitRoot);
16417
+ if (load15.kind === "malformed") {
16280
16418
  throw expected(
16281
- `Cannot write the organization binding: ${WORKSPACE_MANIFEST_LABEL} does not parse (${load14.reason}). Fix or delete it, then re-run.`
16419
+ `Cannot write the organization binding: ${WORKSPACE_MANIFEST_LABEL} does not parse (${load15.reason}). Fix or delete it, then re-run.`
16282
16420
  );
16283
16421
  }
16284
- const { organization_id: _id, organization_name: _name, ...rest } = load14.kind === "ok" ? load14.doc : {};
16422
+ const { organization_id: _id, organization_name: _name, ...rest } = load15.kind === "ok" ? load15.doc : {};
16285
16423
  const doc = { organization_id: config.organization_id };
16286
16424
  if (config.organization_name?.trim()) doc.organization_name = config.organization_name.trim();
16287
16425
  Object.assign(doc, rest);
@@ -17135,10 +17273,10 @@ function toDataProxyPath(v1Path) {
17135
17273
  }
17136
17274
  return `${DATA_PROXY_PREFIX}${v1Path.slice(REKOR_V1_PREFIX.length)}`;
17137
17275
  }
17138
- function withOrgSelector(path42, orgId) {
17139
- if (!orgId) return path42;
17140
- const separator = path42.includes("?") ? "&" : "?";
17141
- return `${path42}${separator}${DATA_PROXY_ORG_QUERY_PARAM}=${encodeURIComponent(orgId)}`;
17276
+ function withOrgSelector(path43, orgId) {
17277
+ if (!orgId) return path43;
17278
+ const separator = path43.includes("?") ? "&" : "?";
17279
+ return `${path43}${separator}${DATA_PROXY_ORG_QUERY_PARAM}=${encodeURIComponent(orgId)}`;
17142
17280
  }
17143
17281
  function dataErrorMessage(err) {
17144
17282
  if (!(err instanceof ApiError)) return null;
@@ -17175,13 +17313,13 @@ var init_api_client = __esm({
17175
17313
  * telling them apart by body shape misreads one for the other.
17176
17314
  */
17177
17315
  path;
17178
- constructor(method, path42, status, body) {
17316
+ constructor(method, path43, status, body) {
17179
17317
  const safeBody = maskSecretsInMessage(body);
17180
- super(`API request failed: ${method} ${path42} (${status}): ${safeBody}`);
17318
+ super(`API request failed: ${method} ${path43} (${status}): ${safeBody}`);
17181
17319
  this.name = "ApiError";
17182
17320
  this.status = status;
17183
17321
  this.body = safeBody;
17184
- this.path = path42;
17322
+ this.path = path43;
17185
17323
  }
17186
17324
  /** True when the status code is a 4xx client error (expected user-facing condition, not a bug). */
17187
17325
  get isExpected() {
@@ -17442,8 +17580,8 @@ var init_api_client = __esm({
17442
17580
  ...opts?.check && { check: true }
17443
17581
  });
17444
17582
  }
17445
- async lookup(path42, opts) {
17446
- const params = new URLSearchParams({ path: path42 });
17583
+ async lookup(path43, opts) {
17584
+ const params = new URLSearchParams({ path: path43 });
17447
17585
  if (opts?.organizationId) params.set("organization_id", opts.organizationId);
17448
17586
  return this.request("GET", `/api/ci/lookup?${params.toString()}`);
17449
17587
  }
@@ -17989,9 +18127,9 @@ var init_api_client = __esm({
17989
18127
  `/api/admin/data-explorer/debug/observability/${encodeURIComponent(hubId)}/conversations/${encodeURIComponent(conversationId)}${qs}`
17990
18128
  );
17991
18129
  }
17992
- async request(method, path42, body, extraHeaders, contentType) {
17993
- addApiBreadcrumb(method, path42);
17994
- const url = `${this.apiUrl}${path42}`;
18130
+ async request(method, path43, body, extraHeaders, contentType) {
18131
+ addApiBreadcrumb(method, path43);
18132
+ const url = `${this.apiUrl}${path43}`;
17995
18133
  let refreshedOn401 = false;
17996
18134
  for (let retry = 0; ; retry++) {
17997
18135
  let response = await this.send(url, method, body, extraHeaders, contentType);
@@ -18016,7 +18154,7 @@ var init_api_client = __esm({
18016
18154
  await delay(RETRYABLE_BACKOFF_MS[retry]);
18017
18155
  continue;
18018
18156
  }
18019
- throw new ApiError(method, path42, response.status, errorBody);
18157
+ throw new ApiError(method, path43, response.status, errorBody);
18020
18158
  }
18021
18159
  }
18022
18160
  /**
@@ -18083,9 +18221,9 @@ var init_api_client = __esm({
18083
18221
  * transient-retry loop — re-streaming a blob is not worth a cold-start probe.
18084
18222
  */
18085
18223
  async dataDownload(v1Path, orgId) {
18086
- const path42 = withOrgSelector(toDataProxyPath(v1Path), orgId);
18087
- addApiBreadcrumb("GET", path42);
18088
- const url = `${this.apiUrl}${path42}`;
18224
+ const path43 = withOrgSelector(toDataProxyPath(v1Path), orgId);
18225
+ addApiBreadcrumb("GET", path43);
18226
+ const url = `${this.apiUrl}${path43}`;
18089
18227
  let response = await this.send(url, "GET");
18090
18228
  if (response.status === 401 && this.onUnauthorized) {
18091
18229
  let refreshed;
@@ -18099,7 +18237,7 @@ var init_api_client = __esm({
18099
18237
  }
18100
18238
  }
18101
18239
  if (!response.ok) {
18102
- throw new ApiError("GET", path42, response.status, await response.text());
18240
+ throw new ApiError("GET", path43, response.status, await response.text());
18103
18241
  }
18104
18242
  return {
18105
18243
  bytes: new Uint8Array(await response.arrayBuffer()),
@@ -18522,9 +18660,9 @@ function getVersionCachePath(filename = CLI_CACHE_FILE) {
18522
18660
  }
18523
18661
  function readVersionCache(filename = CLI_CACHE_FILE) {
18524
18662
  try {
18525
- const path42 = getVersionCachePath(filename);
18526
- if (!existsSync4(path42)) return null;
18527
- const parsed = JSON.parse(readFileSync6(path42, "utf-8"));
18663
+ const path43 = getVersionCachePath(filename);
18664
+ if (!existsSync4(path43)) return null;
18665
+ const parsed = JSON.parse(readFileSync6(path43, "utf-8"));
18528
18666
  if (typeof parsed.lastCheck !== "number") return null;
18529
18667
  if (parsed.latest !== null && typeof parsed.latest !== "string") return null;
18530
18668
  return parsed;
@@ -18544,10 +18682,10 @@ function isVersionCacheStale(filename = CLI_CACHE_FILE, maxAgeMs = MAX_AGE_24H_M
18544
18682
  return Date.now() - cache.lastCheck > maxAgeMs;
18545
18683
  }
18546
18684
  function writeVersionCache(filename, cache) {
18547
- const path42 = getVersionCachePath(filename);
18548
- const dir = dirname6(path42);
18685
+ const path43 = getVersionCachePath(filename);
18686
+ const dir = dirname6(path43);
18549
18687
  if (!existsSync4(dir)) mkdirSync2(dir, { recursive: true });
18550
- writeFileSync2(path42, JSON.stringify(cache));
18688
+ writeFileSync2(path43, JSON.stringify(cache));
18551
18689
  }
18552
18690
  function touchVersionCache(filename) {
18553
18691
  writeVersionCache(filename, { lastCheck: Date.now(), latest: readVersionCache(filename)?.latest ?? null });
@@ -18586,14 +18724,14 @@ function parseFrontmatterVersion(content) {
18586
18724
  function findInstalledSkills(projectRoot, paths = SKILL_INSTALL_PATHS) {
18587
18725
  const found = [];
18588
18726
  for (const rel of paths) {
18589
- const path42 = join9(projectRoot, rel);
18590
- if (!existsSync5(path42)) continue;
18727
+ const path43 = join9(projectRoot, rel);
18728
+ if (!existsSync5(path43)) continue;
18591
18729
  let version = null;
18592
18730
  try {
18593
- version = parseFrontmatterVersion(readFileSync7(path42, "utf-8"));
18731
+ version = parseFrontmatterVersion(readFileSync7(path43, "utf-8"));
18594
18732
  } catch {
18595
18733
  }
18596
- found.push({ path: path42, version });
18734
+ found.push({ path: path43, version });
18597
18735
  }
18598
18736
  return found;
18599
18737
  }
@@ -20537,20 +20675,86 @@ var init_call_openings = __esm({
20537
20675
  }
20538
20676
  });
20539
20677
 
20540
- // src/lib/parser.ts
20678
+ // ../../packages/core/dist/contracts/pages.js
20679
+ var init_pages = __esm({
20680
+ "../../packages/core/dist/contracts/pages.js"() {
20681
+ "use strict";
20682
+ init_chunk_PJYOHUIZ();
20683
+ init_chunk_WEXVYJ5H();
20684
+ }
20685
+ });
20686
+
20687
+ // src/lib/pages.ts
20541
20688
  import * as fs13 from "fs";
20542
20689
  import * as path15 from "path";
20543
20690
  import * as yaml7 from "js-yaml";
20691
+ function readPages(hubFolder) {
20692
+ const dir = path15.join(hubFolder, PAGES_DIR);
20693
+ let st;
20694
+ try {
20695
+ st = fs13.lstatSync(dir);
20696
+ } catch {
20697
+ return void 0;
20698
+ }
20699
+ if (!st.isDirectory()) throw symlinkRefusal(path15.join(path15.basename(hubFolder), PAGES_DIR), "directory");
20700
+ const pages = [];
20701
+ const entries = fs13.readdirSync(dir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
20702
+ for (const entry of entries) {
20703
+ const rel = `${PAGES_DIR}/${entry.name}`;
20704
+ if (entry.isSymbolicLink()) throw symlinkRefusal(rel, "file or folder");
20705
+ if (!entry.isDirectory()) continue;
20706
+ const manifestText = readRealFileOrThrow(hubFolder, path15.join(dir, entry.name, PAGE_MANIFEST_FILE));
20707
+ const html = readRealFileOrThrow(hubFolder, path15.join(dir, entry.name, PAGE_HTML_FILE));
20708
+ if (manifestText === null && html === null) continue;
20709
+ if (manifestText === null) throw expected(`${rel}/${PAGE_HTML_FILE} has no ${PAGE_MANIFEST_FILE} beside it: a page is both files.`);
20710
+ if (html === null) throw expected(`${rel}/${PAGE_MANIFEST_FILE} has no ${PAGE_HTML_FILE} beside it: a page is both files.`);
20711
+ let manifest;
20712
+ try {
20713
+ manifest = yaml7.load(manifestText);
20714
+ } catch (err) {
20715
+ if (err instanceof yaml7.YAMLException) throw expected(`Invalid YAML in ${rel}/${PAGE_MANIFEST_FILE}: ${err.message}`);
20716
+ throw err;
20717
+ }
20718
+ if (!manifest || typeof manifest !== "object" || Array.isArray(manifest)) {
20719
+ throw expected(`${rel}/${PAGE_MANIFEST_FILE} is not a YAML object.`);
20720
+ }
20721
+ const stated = manifest.slug;
20722
+ if (stated !== void 0 && stated !== entry.name) {
20723
+ throw expected(`${rel}/${PAGE_MANIFEST_FILE} names slug "${String(stated)}": a page's folder is named by its slug. Rename the folder or the slug (a new slug is a new page).`);
20724
+ }
20725
+ const htmlIssue = pageHtmlIssue(html);
20726
+ if (htmlIssue) throw expected(`${rel}/${PAGE_HTML_FILE}: ${htmlIssue}.`);
20727
+ pages.push({ manifest: { slug: entry.name, ...manifest }, html });
20728
+ }
20729
+ return pages;
20730
+ }
20731
+ var PAGES_DIR, PAGE_MANIFEST_FILE, PAGE_HTML_FILE;
20732
+ var init_pages2 = __esm({
20733
+ "src/lib/pages.ts"() {
20734
+ "use strict";
20735
+ init_pages();
20736
+ init_expected();
20737
+ init_fs_safety();
20738
+ PAGES_DIR = "pages";
20739
+ PAGE_MANIFEST_FILE = "page.yaml";
20740
+ PAGE_HTML_FILE = "index.html";
20741
+ }
20742
+ });
20743
+
20744
+ // src/lib/parser.ts
20745
+ import * as fs14 from "fs";
20746
+ import * as path16 from "path";
20747
+ import * as yaml8 from "js-yaml";
20544
20748
  function refuseConsumedLink(hubFolder, dir, entry) {
20545
20749
  if (!entry.isSymbolicLink()) return;
20546
- const abs = path15.join(dir, entry.name);
20750
+ const abs = path16.join(dir, entry.name);
20547
20751
  let toDir = false;
20548
20752
  try {
20549
- toDir = fs13.statSync(abs).isDirectory();
20753
+ toDir = fs14.statSync(abs).isDirectory();
20550
20754
  } catch {
20551
20755
  }
20552
20756
  if (toDir || entry.name.endsWith(".yaml")) {
20553
- throw symlinkRefusal(path15.relative(hubFolder, abs), "file or folder");
20757
+ throw symlinkRefusal(path16.relative(hubFolder, abs), "file or folder");
20554
20758
  }
20555
20759
  }
20556
20760
  function parseHubFolder(hubFolder, opts) {
@@ -20562,9 +20766,9 @@ function parseHubFolder(hubFolder, opts) {
20562
20766
  const yamlContent = readRealFileOrThrow(hubFolder, yamlPath) ?? "";
20563
20767
  let config;
20564
20768
  try {
20565
- config = yaml7.load(yamlContent);
20769
+ config = yaml8.load(yamlContent);
20566
20770
  } catch (err) {
20567
- if (err instanceof yaml7.YAMLException) {
20771
+ if (err instanceof yaml8.YAMLException) {
20568
20772
  throw expected(`Invalid YAML in ${yamlPath}: ${err.message}`);
20569
20773
  }
20570
20774
  throw err;
@@ -20600,8 +20804,8 @@ function parseHubFolder(hubFolder, opts) {
20600
20804
  const resolved = { ...agent };
20601
20805
  if (typeof resolved.instructions === "string" && resolved.instructions.endsWith(".md")) {
20602
20806
  const instrValue = resolved.instructions;
20603
- const instructionsPath = instrValue.startsWith("agents/") ? path15.join(hubFolder, instrValue) : path15.join(hubFolder, "agents", instrValue);
20604
- if (!isUnder(path15.join(hubFolder, "agents"), instructionsPath)) {
20807
+ const instructionsPath = instrValue.startsWith("agents/") ? path16.join(hubFolder, instrValue) : path16.join(hubFolder, "agents", instrValue);
20808
+ if (!isUnder(path16.join(hubFolder, "agents"), instructionsPath)) {
20605
20809
  throw workspaceRefusal(
20606
20810
  `Agent instructions path "${instrValue}" (agent "${agent.name}") must stay inside agents/.`
20607
20811
  );
@@ -20615,7 +20819,7 @@ function parseHubFolder(hubFolder, opts) {
20615
20819
  );
20616
20820
  }
20617
20821
  } else if (resolved.instructions === void 0 && typeof agent.name === "string") {
20618
- const conventionPath = path15.join(hubFolder, "agents", `${slugify2(agent.name)}.md`);
20822
+ const conventionPath = path16.join(hubFolder, "agents", `${slugify2(agent.name)}.md`);
20619
20823
  const instructions = readRealFileOrThrow(hubFolder, conventionPath);
20620
20824
  if (instructions !== null) resolved.instructions = instructions;
20621
20825
  }
@@ -20672,31 +20876,33 @@ function parseHubFolder(hubFolder, opts) {
20672
20876
  if (bytesByHash.size > 0) {
20673
20877
  payload.eval_attachment_files = [...bytesByHash.values()];
20674
20878
  }
20879
+ const pages = readPages(hubFolder);
20880
+ if (pages !== void 0) payload.pages = pages;
20675
20881
  return payload;
20676
20882
  }
20677
20883
  function scanEvalYamlFiles(hubFolder, bytesByHash, unreadable) {
20678
- const evalsDir = path15.join(hubFolder, "evals");
20679
- if (!fs13.existsSync(evalsDir)) return [];
20884
+ const evalsDir = path16.join(hubFolder, "evals");
20885
+ if (!fs14.existsSync(evalsDir)) return [];
20680
20886
  const evals = [];
20681
20887
  const seen = /* @__PURE__ */ new Set();
20682
- const topEntries = fs13.readdirSync(evalsDir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
20888
+ const topEntries = fs14.readdirSync(evalsDir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
20683
20889
  for (const entry of topEntries) {
20684
20890
  refuseConsumedLink(hubFolder, evalsDir, entry);
20685
20891
  if (entry.isFile() && entry.name.endsWith(".yaml")) {
20686
- collectEval(evals, seen, path15.join(evalsDir, entry.name), `evals/${entry.name}`, null, hubFolder, bytesByHash, unreadable);
20892
+ collectEval(evals, seen, path16.join(evalsDir, entry.name), `evals/${entry.name}`, null, hubFolder, bytesByHash, unreadable);
20687
20893
  } else if (entry.isDirectory()) {
20688
20894
  const setName = entry.name;
20689
- const setDir = path15.join(evalsDir, setName);
20690
- const setEntries = fs13.readdirSync(setDir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
20895
+ const setDir = path16.join(evalsDir, setName);
20896
+ const setEntries = fs14.readdirSync(setDir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
20691
20897
  for (const sub of setEntries) {
20692
20898
  refuseConsumedLink(hubFolder, setDir, sub);
20693
20899
  if (sub.isDirectory()) {
20694
20900
  throw expected(
20695
- `Nested scenario sets are not supported: ${path15.relative(hubFolder, path15.join(setDir, sub.name))}. Move scenarios up to evals/${setName}/.`
20901
+ `Nested scenario sets are not supported: ${path16.relative(hubFolder, path16.join(setDir, sub.name))}. Move scenarios up to evals/${setName}/.`
20696
20902
  );
20697
20903
  }
20698
20904
  if (sub.isFile() && sub.name.endsWith(".yaml")) {
20699
- collectEval(evals, seen, path15.join(setDir, sub.name), `evals/${setName}/${sub.name}`, setName, hubFolder, bytesByHash, unreadable);
20905
+ collectEval(evals, seen, path16.join(setDir, sub.name), `evals/${setName}/${sub.name}`, setName, hubFolder, bytesByHash, unreadable);
20700
20906
  }
20701
20907
  }
20702
20908
  }
@@ -20713,26 +20919,26 @@ function collectEval(evals, seen, filePath2, relPath, setName, hubFolder, bytesB
20713
20919
  if (seen.has(key)) {
20714
20920
  const where = setName ? `scenario set "${setName}"` : "root";
20715
20921
  throw expected(
20716
- `Duplicate eval at ${where}: "${evalEntry.name}" (in ${path15.basename(filePath2)}). Each (name, scenario set) pair must be unique.`
20922
+ `Duplicate eval at ${where}: "${evalEntry.name}" (in ${path16.basename(filePath2)}). Each (name, scenario set) pair must be unique.`
20717
20923
  );
20718
20924
  }
20719
20925
  seen.add(key);
20720
20926
  evals.push(evalEntry);
20721
20927
  }
20722
20928
  function parseEvalYaml(filePath2, relPath, setName, hubFolder, bytesByHash) {
20723
- const content = fs13.readFileSync(filePath2, "utf-8");
20929
+ const content = fs14.readFileSync(filePath2, "utf-8");
20724
20930
  let raw;
20725
20931
  try {
20726
- raw = yaml7.load(content);
20932
+ raw = yaml8.load(content);
20727
20933
  } catch (err) {
20728
- if (err instanceof yaml7.YAMLException) {
20934
+ if (err instanceof yaml8.YAMLException) {
20729
20935
  throw expected(`Invalid YAML in ${relPath}: ${err.message}`);
20730
20936
  }
20731
20937
  throw err;
20732
20938
  }
20733
20939
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
20734
20940
  const data = raw;
20735
- const fileSlug = path15.basename(filePath2, ".yaml");
20941
+ const fileSlug = path16.basename(filePath2, ".yaml");
20736
20942
  const evalName = typeof data.name === "string" && data.name.trim().length > 0 ? data.name : fileSlug;
20737
20943
  if (typeof data.agent !== "string" || data.agent.trim().length === 0) {
20738
20944
  throw expected(`Eval "${evalName}" in ${relPath}: missing required field "agent" (string).`);
@@ -20826,20 +21032,20 @@ function parseFixtureField(raw, label, key, hint = "the Rekor fixture name") {
20826
21032
  return trimmed.length > 0 ? trimmed : void 0;
20827
21033
  }
20828
21034
  function scanJourneyYamlFiles(hubFolder, bytesByHash, unreadable) {
20829
- const journeysDir = path15.join(hubFolder, "journeys");
20830
- if (!fs13.existsSync(journeysDir)) return [];
21035
+ const journeysDir = path16.join(hubFolder, "journeys");
21036
+ if (!fs14.existsSync(journeysDir)) return [];
20831
21037
  const journeys = [];
20832
21038
  const seen = /* @__PURE__ */ new Set();
20833
- const entries = fs13.readdirSync(journeysDir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
21039
+ const entries = fs14.readdirSync(journeysDir, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name));
20834
21040
  for (const entry of entries) {
20835
21041
  refuseConsumedLink(hubFolder, journeysDir, entry);
20836
21042
  if (entry.isDirectory()) {
20837
21043
  throw expected(
20838
- `Subfolders are not supported under journeys/: ${path15.relative(hubFolder, path15.join(journeysDir, entry.name))}. A journey owns its own managed scenario set \u2014 put each journey in a single journeys/<slug>.yaml file.`
21044
+ `Subfolders are not supported under journeys/: ${path16.relative(hubFolder, path16.join(journeysDir, entry.name))}. A journey owns its own managed scenario set \u2014 put each journey in a single journeys/<slug>.yaml file.`
20839
21045
  );
20840
21046
  }
20841
21047
  if (!entry.isFile() || !entry.name.endsWith(".yaml")) continue;
20842
- const journeyEntry = parseJourneyYaml(path15.join(journeysDir, entry.name), `journeys/${entry.name}`, hubFolder, bytesByHash);
21048
+ const journeyEntry = parseJourneyYaml(path16.join(journeysDir, entry.name), `journeys/${entry.name}`, hubFolder, bytesByHash);
20843
21049
  if (!journeyEntry) {
20844
21050
  unreadable(`journeys/${entry.name}`, NOT_A_YAML_OBJECT);
20845
21051
  continue;
@@ -20855,19 +21061,19 @@ function scanJourneyYamlFiles(hubFolder, bytesByHash, unreadable) {
20855
21061
  return journeys;
20856
21062
  }
20857
21063
  function parseJourneyYaml(filePath2, relPath, hubFolder, bytesByHash) {
20858
- const content = fs13.readFileSync(filePath2, "utf-8");
21064
+ const content = fs14.readFileSync(filePath2, "utf-8");
20859
21065
  let raw;
20860
21066
  try {
20861
- raw = yaml7.load(content);
21067
+ raw = yaml8.load(content);
20862
21068
  } catch (err) {
20863
- if (err instanceof yaml7.YAMLException) {
21069
+ if (err instanceof yaml8.YAMLException) {
20864
21070
  throw expected(`Invalid YAML in ${relPath}: ${err.message}`);
20865
21071
  }
20866
21072
  throw err;
20867
21073
  }
20868
21074
  if (!raw || typeof raw !== "object" || Array.isArray(raw)) return null;
20869
21075
  const data = raw;
20870
- const fileSlug = path15.basename(filePath2, ".yaml");
21076
+ const fileSlug = path16.basename(filePath2, ".yaml");
20871
21077
  const journeyName = typeof data.name === "string" && data.name.trim().length > 0 ? data.name : fileSlug;
20872
21078
  if (typeof data.agent !== "string" || data.agent.trim().length === 0) {
20873
21079
  throw expected(`Journey "${journeyName}" in ${relPath}: missing required field "agent" (string).`);
@@ -20914,19 +21120,19 @@ function parseJourneyYaml(filePath2, relPath, hubFolder, bytesByHash) {
20914
21120
  return journeyEntry;
20915
21121
  }
20916
21122
  function scanAgentYamlFiles(hubFolder, unreadable) {
20917
- const agentsDir = path15.join(hubFolder, "agents");
20918
- if (!fs13.existsSync(agentsDir)) return [];
20919
- const yamlFiles = fs13.readdirSync(agentsDir).filter((f) => f.endsWith(".yaml")).sort();
21123
+ const agentsDir = path16.join(hubFolder, "agents");
21124
+ if (!fs14.existsSync(agentsDir)) return [];
21125
+ const yamlFiles = fs14.readdirSync(agentsDir).filter((f) => f.endsWith(".yaml")).sort();
20920
21126
  if (yamlFiles.length === 0) return [];
20921
21127
  const agents = [];
20922
21128
  for (const file of yamlFiles) {
20923
- const filePath2 = path15.join(agentsDir, file);
21129
+ const filePath2 = path16.join(agentsDir, file);
20924
21130
  const content = readRealFileOrThrow(hubFolder, filePath2) ?? "";
20925
21131
  let agent;
20926
21132
  try {
20927
- agent = yaml7.load(content);
21133
+ agent = yaml8.load(content);
20928
21134
  } catch (err) {
20929
- if (err instanceof yaml7.YAMLException) {
21135
+ if (err instanceof yaml8.YAMLException) {
20930
21136
  throw expected(`Invalid YAML in agents/${file}: ${err.message}`);
20931
21137
  }
20932
21138
  throw err;
@@ -20945,8 +21151,8 @@ function scanAgentYamlFiles(hubFolder, unreadable) {
20945
21151
  }
20946
21152
  function oldLayoutParts(hubFolder, config, agents) {
20947
21153
  const parts = [];
20948
- if ("resources" in config) parts.push(`${path15.basename(resolveHubYamlPath(hubFolder) ?? "hub.yaml")}'s \`resources:\``);
20949
- if (fs13.existsSync(path15.join(hubFolder, OLD_RESOURCES_DIR))) parts.push(`the ${OLD_RESOURCES_DIR}/ folder`);
21154
+ if ("resources" in config) parts.push(`${path16.basename(resolveHubYamlPath(hubFolder) ?? "hub.yaml")}'s \`resources:\``);
21155
+ if (fs14.existsSync(path16.join(hubFolder, OLD_RESOURCES_DIR))) parts.push(`the ${OLD_RESOURCES_DIR}/ folder`);
20950
21156
  for (const agent of agents ?? []) {
20951
21157
  if ("resources" in agent) parts.push(`agent "${String(agent.name)}"'s \`resources:\` links`);
20952
21158
  }
@@ -20954,7 +21160,7 @@ function oldLayoutParts(hubFolder, config, agents) {
20954
21160
  }
20955
21161
  function oldLayoutRefusal(hubFolder, parts) {
20956
21162
  return expected(
20957
- `${path15.basename(hubFolder)} is in the old layout (${parts.join(", ")}): resources are skills now. Run \`wayai pull\` to convert it (\`skills:\` in hub.yaml and the agent files, each skill's files under ${SKILLS_DIR}/<skill_name>/), then push again. Nothing was sent.`
21163
+ `${path16.basename(hubFolder)} is in the old layout (${parts.join(", ")}): resources are skills now. Run \`wayai pull\` to convert it (\`skills:\` in hub.yaml and the agent files, each skill's files under ${SKILLS_DIR}/<skill_name>/), then push again. Nothing was sent.`
20958
21164
  );
20959
21165
  }
20960
21166
  function assertSkillsLayout(hubFolder) {
@@ -20962,9 +21168,9 @@ function assertSkillsLayout(hubFolder) {
20962
21168
  if (!yamlPath) return;
20963
21169
  let config;
20964
21170
  try {
20965
- config = yaml7.load(readRealFileOrThrow(hubFolder, yamlPath) ?? "") ?? {};
21171
+ config = yaml8.load(readRealFileOrThrow(hubFolder, yamlPath) ?? "") ?? {};
20966
21172
  } catch (err) {
20967
- if (err instanceof yaml7.YAMLException) return;
21173
+ if (err instanceof yaml8.YAMLException) return;
20968
21174
  throw err;
20969
21175
  }
20970
21176
  if (!config || typeof config !== "object") return;
@@ -20975,12 +21181,12 @@ function assertSkillsLayout(hubFolder) {
20975
21181
  }
20976
21182
  function parseSkills(hubFolder, config, unreadable) {
20977
21183
  if ("skills" in config && "resources" in config) {
20978
- const file = path15.basename(resolveHubYamlPath(hubFolder) ?? "hub.yaml");
21184
+ const file = path16.basename(resolveHubYamlPath(hubFolder) ?? "hub.yaml");
20979
21185
  throw expected(`${file} lists both \`skills:\` and \`resources:\`: name the skills under \`skills:\` only.`);
20980
21186
  }
20981
21187
  const old = !("skills" in config) && "resources" in config;
20982
21188
  const entries = (old ? config.resources : config.skills) ?? [];
20983
- const root = path15.join(hubFolder, old ? OLD_RESOURCES_DIR : SKILLS_DIR);
21189
+ const root = path16.join(hubFolder, old ? OLD_RESOURCES_DIR : SKILLS_DIR);
20984
21190
  const results = [];
20985
21191
  for (const entry of entries) {
20986
21192
  const skill = {
@@ -20992,10 +21198,10 @@ function parseSkills(hubFolder, config, unreadable) {
20992
21198
  if (entry.enabled === false) skill.enabled = false;
20993
21199
  if (entry.skill_name) skill.skill_name = entry.skill_name;
20994
21200
  const folder = old ? oldResourceFolder(skill) : skillFolder(skill);
20995
- const dir = path15.join(root, folder);
21201
+ const dir = path16.join(root, folder);
20996
21202
  requireRealSubdirNoSymlink(hubFolder, dir, false);
20997
- if (fs13.existsSync(dir)) {
20998
- const rel = `${path15.basename(root)}/${folder}`;
21203
+ if (fs14.existsSync(dir)) {
21204
+ const rel = `${path16.basename(root)}/${folder}`;
20999
21205
  const files = scanResourceFiles(dir, "", (relPath, reason) => unreadable(`${rel}/${relPath}`, reason));
21000
21206
  if (files.length > 0) {
21001
21207
  skill.files = files;
@@ -21014,6 +21220,7 @@ var init_parser = __esm({
21014
21220
  init_resource_files();
21015
21221
  init_eval_attachments();
21016
21222
  init_call_openings();
21223
+ init_pages2();
21017
21224
  init_expected();
21018
21225
  init_fs_safety();
21019
21226
  NOT_A_YAML_OBJECT = "not a YAML object";
@@ -21048,7 +21255,7 @@ var init_diff_display = __esm({
21048
21255
  });
21049
21256
 
21050
21257
  // src/lib/workspace-files.ts
21051
- import * as path16 from "path";
21258
+ import * as path17 from "path";
21052
21259
  function perHubAgentsMd(hubFolderName) {
21053
21260
  return [
21054
21261
  `# ${hubFolderName}`,
@@ -21064,7 +21271,7 @@ function perHubAgentsMd(hubFolderName) {
21064
21271
  ].join("\n");
21065
21272
  }
21066
21273
  function writeIfAbsent(root, filePath2, content) {
21067
- return createFileNoFollow(root, filePath2, Buffer.from(content, "utf-8")) === "created" ? path16.basename(filePath2) : null;
21274
+ return createFileNoFollow(root, filePath2, Buffer.from(content, "utf-8")) === "created" ? path17.basename(filePath2) : null;
21068
21275
  }
21069
21276
  var init_workspace_files = __esm({
21070
21277
  "src/lib/workspace-files.ts"() {
@@ -21074,16 +21281,16 @@ var init_workspace_files = __esm({
21074
21281
  });
21075
21282
 
21076
21283
  // src/lib/yaml-writer.ts
21077
- import * as fs14 from "fs";
21078
- import * as path17 from "path";
21079
- import * as yaml8 from "js-yaml";
21284
+ import * as fs15 from "fs";
21285
+ import * as path18 from "path";
21286
+ import * as yaml9 from "js-yaml";
21080
21287
  function writeFileIfChanged(hubFolder, absPath, content, log) {
21081
21288
  const buf = Buffer.from(content, "utf-8");
21082
21289
  if (fileHasBytes(absPath, buf)) return;
21083
21290
  if (writeFileNoFollow(hubFolder, absPath, buf)) {
21084
- log.changed.push(path17.relative(hubFolder, absPath));
21291
+ log.changed.push(path18.relative(hubFolder, absPath));
21085
21292
  } else {
21086
- console.warn(` Warning: skipping ${path17.relative(hubFolder, absPath)} (destination escapes the hub folder via a symlink)`);
21293
+ console.warn(` Warning: skipping ${path18.relative(hubFolder, absPath)} (destination escapes the hub folder via a symlink)`);
21087
21294
  }
21088
21295
  }
21089
21296
  function buildEvalYamlObject(evalEntry, slug) {
@@ -21126,11 +21333,11 @@ function buildEvalYamlObject(evalEntry, slug) {
21126
21333
  return out;
21127
21334
  }
21128
21335
  function hubFolderInOldLayout(hubFolder) {
21129
- if (fs14.existsSync(path17.join(hubFolder, OLD_RESOURCES_DIR))) return true;
21336
+ if (fs15.existsSync(path18.join(hubFolder, OLD_RESOURCES_DIR))) return true;
21130
21337
  const yamlPath = resolveHubYamlPath(hubFolder);
21131
21338
  if (!yamlPath) return false;
21132
21339
  try {
21133
- const config = yaml8.load(readRealFileOrThrow(hubFolder, yamlPath) ?? "");
21340
+ const config = yaml9.load(readRealFileOrThrow(hubFolder, yamlPath) ?? "");
21134
21341
  return !!config && typeof config === "object" && "resources" in config;
21135
21342
  } catch {
21136
21343
  return false;
@@ -21144,51 +21351,51 @@ function writeHubFolder(hubFolder, payload, options = {}) {
21144
21351
  const log = { changed: [], removed: [] };
21145
21352
  if (options.readOnlyMirror) assertDistinctSkillFolders(payload.skills ?? []);
21146
21353
  else assertHubFolderConvertible(hubFolder, payload);
21147
- const agentsDir = path17.join(hubFolder, "agents");
21148
- if (!fs14.existsSync(hubFolder)) {
21149
- fs14.mkdirSync(hubFolder, { recursive: true });
21354
+ const agentsDir = path18.join(hubFolder, "agents");
21355
+ if (!fs15.existsSync(hubFolder)) {
21356
+ fs15.mkdirSync(hubFolder, { recursive: true });
21150
21357
  }
21151
- if (!fs14.existsSync(agentsDir)) {
21152
- fs14.mkdirSync(agentsDir, { recursive: true });
21358
+ if (!fs15.existsSync(agentsDir)) {
21359
+ fs15.mkdirSync(agentsDir, { recursive: true });
21153
21360
  }
21154
21361
  const yamlPayload = buildYamlPayload(payload);
21155
21362
  const agentFiles = extractAgentFiles(payload);
21156
- const yamlContent = yaml8.dump(yamlPayload, YAML_DUMP_OPTIONS);
21157
- writeFileIfChanged(hubFolder, path17.join(hubFolder, "hub.yaml"), yamlContent, log);
21363
+ const yamlContent = yaml9.dump(yamlPayload, YAML_DUMP_OPTIONS);
21364
+ writeFileIfChanged(hubFolder, path18.join(hubFolder, "hub.yaml"), yamlContent, log);
21158
21365
  if (options.seedAgentContext ?? true) {
21159
21366
  const seeded = writeIfAbsent(
21160
21367
  hubFolder,
21161
- path17.join(hubFolder, "AGENTS.md"),
21162
- perHubAgentsMd(path17.basename(hubFolder))
21368
+ path18.join(hubFolder, "AGENTS.md"),
21369
+ perHubAgentsMd(path18.basename(hubFolder))
21163
21370
  );
21164
21371
  if (seeded) log.changed.push(seeded);
21165
21372
  }
21166
- const oldYamlPath = path17.join(hubFolder, "wayai.yaml");
21167
- if (fs14.existsSync(oldYamlPath)) {
21168
- fs14.unlinkSync(oldYamlPath);
21169
- log.removed.push(path17.relative(hubFolder, oldYamlPath));
21373
+ const oldYamlPath = path18.join(hubFolder, "wayai.yaml");
21374
+ if (fs15.existsSync(oldYamlPath)) {
21375
+ fs15.unlinkSync(oldYamlPath);
21376
+ log.removed.push(path18.relative(hubFolder, oldYamlPath));
21170
21377
  }
21171
21378
  const yamlSlugs = writeAgentYamlFiles(hubFolder, agentsDir, payload.agents || [], log);
21172
21379
  const mdSlugs = /* @__PURE__ */ new Set();
21173
21380
  for (const { slug, content } of agentFiles) {
21174
21381
  mdSlugs.add(slug);
21175
- writeFileIfChanged(hubFolder, path17.join(agentsDir, `${slug}.md`), content, log);
21382
+ writeFileIfChanged(hubFolder, path18.join(agentsDir, `${slug}.md`), content, log);
21176
21383
  }
21177
- const existingFiles = fs14.readdirSync(agentsDir);
21384
+ const existingFiles = fs15.readdirSync(agentsDir);
21178
21385
  for (const file of existingFiles) {
21179
21386
  if (file.endsWith(".yaml")) {
21180
21387
  const slug = file.slice(0, -5);
21181
21388
  if (!yamlSlugs.has(slug)) {
21182
- const orphan = path17.join(agentsDir, file);
21183
- fs14.unlinkSync(orphan);
21184
- log.removed.push(path17.relative(hubFolder, orphan));
21389
+ const orphan = path18.join(agentsDir, file);
21390
+ fs15.unlinkSync(orphan);
21391
+ log.removed.push(path18.relative(hubFolder, orphan));
21185
21392
  }
21186
21393
  } else if (file.endsWith(".md")) {
21187
21394
  const slug = file.slice(0, -3);
21188
21395
  if (!mdSlugs.has(slug)) {
21189
- const orphan = path17.join(agentsDir, file);
21190
- fs14.unlinkSync(orphan);
21191
- log.removed.push(path17.relative(hubFolder, orphan));
21396
+ const orphan = path18.join(agentsDir, file);
21397
+ fs15.unlinkSync(orphan);
21398
+ log.removed.push(path18.relative(hubFolder, orphan));
21192
21399
  }
21193
21400
  }
21194
21401
  }
@@ -21196,16 +21403,17 @@ function writeHubFolder(hubFolder, payload, options = {}) {
21196
21403
  removeConvertedOldResources(hubFolder, payload.skills || [], log, { all: options.readOnlyMirror });
21197
21404
  writeEvalYamlFiles(hubFolder, payload.evals || [], log);
21198
21405
  writeJourneyYamlFiles(hubFolder, payload.journeys || [], log);
21406
+ writePageFiles(hubFolder, payload.pages, log);
21199
21407
  return log;
21200
21408
  }
21201
21409
  function setPreviewLabelInHubYaml(hubFolder, label) {
21202
21410
  requireRealHubFolder(hubFolder, false);
21203
21411
  const yamlPath = resolveHubYamlPath(hubFolder);
21204
21412
  if (!yamlPath) return;
21205
- const obj = yaml8.load(readRealFileOrThrow(hubFolder, yamlPath) ?? "") ?? {};
21413
+ const obj = yaml9.load(readRealFileOrThrow(hubFolder, yamlPath) ?? "") ?? {};
21206
21414
  if (label) obj.preview_label = label;
21207
21415
  else delete obj.preview_label;
21208
- writeFileNoFollow(hubFolder, yamlPath, Buffer.from(yaml8.dump(obj, YAML_DUMP_OPTIONS), "utf-8"));
21416
+ writeFileNoFollow(hubFolder, yamlPath, Buffer.from(yaml9.dump(obj, YAML_DUMP_OPTIONS), "utf-8"));
21209
21417
  }
21210
21418
  function buildYamlPayload(payload) {
21211
21419
  const result = {
@@ -21247,8 +21455,8 @@ function writeAgentYamlFiles(hubFolder, agentsDir, agents, log) {
21247
21455
  slugs.add(slug);
21248
21456
  const entry = { ...agent };
21249
21457
  delete entry.instructions;
21250
- const yamlContent = yaml8.dump(entry, YAML_DUMP_OPTIONS);
21251
- writeFileIfChanged(hubFolder, path17.join(agentsDir, `${slug}.yaml`), yamlContent, log);
21458
+ const yamlContent = yaml9.dump(entry, YAML_DUMP_OPTIONS);
21459
+ writeFileIfChanged(hubFolder, path18.join(agentsDir, `${slug}.yaml`), yamlContent, log);
21252
21460
  }
21253
21461
  return slugs;
21254
21462
  }
@@ -21265,62 +21473,62 @@ function extractAgentFiles(payload) {
21265
21473
  return files;
21266
21474
  }
21267
21475
  function writeEvalYamlFiles(hubFolder, evals, log) {
21268
- const evalsDir = path17.join(hubFolder, "evals");
21476
+ const evalsDir = path18.join(hubFolder, "evals");
21269
21477
  if (evals.length === 0) {
21270
- if (fs14.existsSync(evalsDir)) {
21478
+ if (fs15.existsSync(evalsDir)) {
21271
21479
  cleanEvalOrphans(hubFolder, evalsDir, /* @__PURE__ */ new Set(), log);
21272
21480
  try {
21273
- if (fs14.readdirSync(evalsDir).length === 0) fs14.rmdirSync(evalsDir);
21481
+ if (fs15.readdirSync(evalsDir).length === 0) fs15.rmdirSync(evalsDir);
21274
21482
  } catch {
21275
21483
  }
21276
21484
  }
21277
21485
  return;
21278
21486
  }
21279
- if (!fs14.existsSync(evalsDir)) {
21280
- fs14.mkdirSync(evalsDir, { recursive: true });
21487
+ if (!fs15.existsSync(evalsDir)) {
21488
+ fs15.mkdirSync(evalsDir, { recursive: true });
21281
21489
  }
21282
21490
  const writtenRelPaths = /* @__PURE__ */ new Set();
21283
21491
  for (const evalEntry of evals) {
21284
21492
  const slug = slugify2(evalEntry.name);
21285
21493
  const setName = evalEntry.path && evalEntry.path.trim().length > 0 ? evalEntry.path : null;
21286
21494
  const relPath = setName ? `${setName}/${slug}.yaml` : `${slug}.yaml`;
21287
- const targetPath = path17.join(evalsDir, relPath);
21288
- if (!targetPath.startsWith(evalsDir + path17.sep)) {
21495
+ const targetPath = path18.join(evalsDir, relPath);
21496
+ if (!targetPath.startsWith(evalsDir + path18.sep)) {
21289
21497
  console.warn(` Warning: skipping eval "${evalEntry.name}" (scenario set "${setName}" escapes evals/ \u2014 possible bad backend data)`);
21290
21498
  continue;
21291
21499
  }
21292
- const yamlContent = yaml8.dump(buildEvalYamlObject(evalEntry, slug), YAML_DUMP_OPTIONS);
21500
+ const yamlContent = yaml9.dump(buildEvalYamlObject(evalEntry, slug), YAML_DUMP_OPTIONS);
21293
21501
  writeFileIfChanged(hubFolder, targetPath, yamlContent, log);
21294
21502
  writtenRelPaths.add(relPath);
21295
21503
  }
21296
21504
  cleanEvalOrphans(hubFolder, evalsDir, writtenRelPaths, log);
21297
21505
  }
21298
21506
  function cleanEvalOrphans(hubFolder, evalsDir, writtenRelPaths, log) {
21299
- const entries = fs14.readdirSync(evalsDir, { withFileTypes: true });
21507
+ const entries = fs15.readdirSync(evalsDir, { withFileTypes: true });
21300
21508
  for (const entry of entries) {
21301
- const fullPath = path17.join(evalsDir, entry.name);
21509
+ const fullPath = path18.join(evalsDir, entry.name);
21302
21510
  if (entry.isFile()) {
21303
21511
  if (entry.name.endsWith(".yaml") && !writtenRelPaths.has(entry.name)) {
21304
- fs14.unlinkSync(fullPath);
21305
- log.removed.push(path17.relative(hubFolder, fullPath));
21512
+ fs15.unlinkSync(fullPath);
21513
+ log.removed.push(path18.relative(hubFolder, fullPath));
21306
21514
  }
21307
21515
  continue;
21308
21516
  }
21309
21517
  if (entry.isDirectory()) {
21310
21518
  const setName = entry.name;
21311
- const subEntries = fs14.readdirSync(fullPath, { withFileTypes: true });
21519
+ const subEntries = fs15.readdirSync(fullPath, { withFileTypes: true });
21312
21520
  for (const sub of subEntries) {
21313
21521
  if (sub.isFile() && sub.name.endsWith(".yaml")) {
21314
21522
  const relPath = `${setName}/${sub.name}`;
21315
21523
  if (!writtenRelPaths.has(relPath)) {
21316
- const orphan = path17.join(fullPath, sub.name);
21317
- fs14.unlinkSync(orphan);
21318
- log.removed.push(path17.relative(hubFolder, orphan));
21524
+ const orphan = path18.join(fullPath, sub.name);
21525
+ fs15.unlinkSync(orphan);
21526
+ log.removed.push(path18.relative(hubFolder, orphan));
21319
21527
  }
21320
21528
  }
21321
21529
  }
21322
21530
  try {
21323
- if (fs14.readdirSync(fullPath).length === 0) fs14.rmdirSync(fullPath);
21531
+ if (fs15.readdirSync(fullPath).length === 0) fs15.rmdirSync(fullPath);
21324
21532
  } catch {
21325
21533
  }
21326
21534
  }
@@ -21360,61 +21568,112 @@ function buildJourneyYamlObject(journeyEntry, slug) {
21360
21568
  return out;
21361
21569
  }
21362
21570
  function writeJourneyYamlFiles(hubFolder, journeys, log) {
21363
- const journeysDir = path17.join(hubFolder, "journeys");
21571
+ const journeysDir = path18.join(hubFolder, "journeys");
21364
21572
  if (journeys.length === 0) {
21365
- if (fs14.existsSync(journeysDir)) {
21573
+ if (fs15.existsSync(journeysDir)) {
21366
21574
  cleanJourneyOrphans(hubFolder, journeysDir, /* @__PURE__ */ new Set(), log);
21367
21575
  try {
21368
- if (fs14.readdirSync(journeysDir).length === 0) fs14.rmdirSync(journeysDir);
21576
+ if (fs15.readdirSync(journeysDir).length === 0) fs15.rmdirSync(journeysDir);
21369
21577
  } catch {
21370
21578
  }
21371
21579
  }
21372
21580
  return;
21373
21581
  }
21374
- if (!fs14.existsSync(journeysDir)) {
21375
- fs14.mkdirSync(journeysDir, { recursive: true });
21582
+ if (!fs15.existsSync(journeysDir)) {
21583
+ fs15.mkdirSync(journeysDir, { recursive: true });
21376
21584
  }
21377
21585
  const writtenFiles = /* @__PURE__ */ new Set();
21378
21586
  const usedSlugs = /* @__PURE__ */ new Set();
21379
21587
  for (const journeyEntry of journeys) {
21380
21588
  const slug = ensureUniqueSlug(slugify2(journeyEntry.name), usedSlugs);
21381
21589
  const fileName = `${slug}.yaml`;
21382
- const yamlContent = yaml8.dump(buildJourneyYamlObject(journeyEntry, slug), YAML_DUMP_OPTIONS);
21383
- writeFileIfChanged(hubFolder, path17.join(journeysDir, fileName), yamlContent, log);
21590
+ const yamlContent = yaml9.dump(buildJourneyYamlObject(journeyEntry, slug), YAML_DUMP_OPTIONS);
21591
+ writeFileIfChanged(hubFolder, path18.join(journeysDir, fileName), yamlContent, log);
21384
21592
  writtenFiles.add(fileName);
21385
21593
  }
21386
21594
  cleanJourneyOrphans(hubFolder, journeysDir, writtenFiles, log);
21387
21595
  }
21388
21596
  function cleanJourneyOrphans(hubFolder, journeysDir, writtenFiles, log) {
21389
- const entries = fs14.readdirSync(journeysDir, { withFileTypes: true });
21597
+ const entries = fs15.readdirSync(journeysDir, { withFileTypes: true });
21390
21598
  for (const entry of entries) {
21391
21599
  if (entry.isFile() && entry.name.endsWith(".yaml") && !writtenFiles.has(entry.name)) {
21392
- const orphan = path17.join(journeysDir, entry.name);
21393
- fs14.unlinkSync(orphan);
21394
- log.removed.push(path17.relative(hubFolder, orphan));
21600
+ const orphan = path18.join(journeysDir, entry.name);
21601
+ fs15.unlinkSync(orphan);
21602
+ log.removed.push(path18.relative(hubFolder, orphan));
21395
21603
  }
21396
21604
  }
21397
21605
  }
21398
21606
  function writeSkillFiles(hubFolder, skills, log) {
21399
- const skillsDir = path17.join(hubFolder, SKILLS_DIR);
21607
+ const skillsDir = path18.join(hubFolder, SKILLS_DIR);
21400
21608
  const currentFolders = /* @__PURE__ */ new Set();
21401
21609
  for (const skill of skills) {
21402
21610
  const folder = skillFolder(skill);
21403
21611
  currentFolders.add(folder);
21404
- writeResourceFileTree(path17.join(skillsDir, folder), skill.files || [], hubFolder, log);
21612
+ writeResourceFileTree(path18.join(skillsDir, folder), skill.files || [], hubFolder, log);
21405
21613
  }
21406
- if (fs14.existsSync(skillsDir)) {
21407
- const existingDirs = fs14.readdirSync(skillsDir, { withFileTypes: true });
21614
+ if (fs15.existsSync(skillsDir)) {
21615
+ const existingDirs = fs15.readdirSync(skillsDir, { withFileTypes: true });
21408
21616
  for (const entry of existingDirs) {
21409
21617
  if (entry.isDirectory() && !currentFolders.has(entry.name)) {
21410
- const orphanDir = path17.join(skillsDir, entry.name);
21411
- fs14.rmSync(orphanDir, { recursive: true, force: true });
21412
- log.removed.push(`${path17.relative(hubFolder, orphanDir)}/`);
21618
+ const orphanDir = path18.join(skillsDir, entry.name);
21619
+ fs15.rmSync(orphanDir, { recursive: true, force: true });
21620
+ log.removed.push(`${path18.relative(hubFolder, orphanDir)}/`);
21621
+ }
21622
+ }
21623
+ }
21624
+ }
21625
+ function pageManifestYaml(manifest) {
21626
+ const out = {};
21627
+ for (const [key, value] of Object.entries(manifest)) {
21628
+ const fallback = PAGE_MANIFEST_DEFAULTS[key];
21629
+ if (!["slug", "title", "audience"].includes(key) && key in PAGE_MANIFEST_DEFAULTS && JSON.stringify(value) === JSON.stringify(fallback)) continue;
21630
+ out[key] = key === "tools" && Array.isArray(value) ? value.map((t) => {
21631
+ const { notify, ...rest } = t;
21632
+ return notify === PAGE_TOOL_NOTIFY_DEFAULT ? rest : { ...rest, notify };
21633
+ }) : value;
21634
+ }
21635
+ return yaml9.dump(out, YAML_DUMP_OPTIONS);
21636
+ }
21637
+ function writePageFiles(hubFolder, pages, log) {
21638
+ if (pages === void 0) return;
21639
+ const dir = path18.join(hubFolder, PAGES_DIR);
21640
+ const written = /* @__PURE__ */ new Set();
21641
+ for (const page of pages) {
21642
+ const slug = page.manifest.slug;
21643
+ if (typeof slug !== "string" || !PAGE_SLUG_REGEX.test(slug)) {
21644
+ console.warn(` Warning: skipping a page whose slug is not a folder name (${JSON.stringify(slug)})`);
21645
+ continue;
21646
+ }
21647
+ written.add(slug);
21648
+ writeFileIfChanged(hubFolder, path18.join(dir, slug, PAGE_MANIFEST_FILE), pageManifestYaml(page.manifest), log);
21649
+ writeFileIfChanged(hubFolder, path18.join(dir, slug, PAGE_HTML_FILE), page.html, log);
21650
+ }
21651
+ if (!fs15.existsSync(dir)) return;
21652
+ for (const entry of fs15.readdirSync(dir, { withFileTypes: true })) {
21653
+ if (!entry.isDirectory() || written.has(entry.name)) continue;
21654
+ const pageDir = path18.join(dir, entry.name);
21655
+ if (!fs15.existsSync(path18.join(pageDir, PAGE_MANIFEST_FILE))) continue;
21656
+ for (const file of [PAGE_MANIFEST_FILE, PAGE_HTML_FILE]) {
21657
+ const abs = path18.join(pageDir, file);
21658
+ try {
21659
+ if (!fs15.lstatSync(abs).isFile()) continue;
21660
+ } catch {
21661
+ continue;
21413
21662
  }
21663
+ fs15.unlinkSync(abs);
21664
+ log.removed.push(path18.relative(hubFolder, abs));
21665
+ }
21666
+ try {
21667
+ if (fs15.readdirSync(pageDir).length === 0) fs15.rmdirSync(pageDir);
21668
+ } catch {
21414
21669
  }
21415
21670
  }
21671
+ try {
21672
+ if (fs15.readdirSync(dir).length === 0) fs15.rmdirSync(dir);
21673
+ } catch {
21674
+ }
21416
21675
  }
21417
- var YAML_DUMP_OPTIONS;
21676
+ var YAML_DUMP_OPTIONS, PAGE_MANIFEST_DEFAULTS, PAGE_TOOL_NOTIFY_DEFAULT;
21418
21677
  var init_yaml_writer = __esm({
21419
21678
  "src/lib/yaml-writer.ts"() {
21420
21679
  "use strict";
@@ -21422,6 +21681,8 @@ var init_yaml_writer = __esm({
21422
21681
  init_utils();
21423
21682
  init_resource_files();
21424
21683
  init_eval_attachments();
21684
+ init_pages2();
21685
+ init_pages();
21425
21686
  init_workspace_files();
21426
21687
  init_fs_safety();
21427
21688
  YAML_DUMP_OPTIONS = {
@@ -21433,11 +21694,18 @@ var init_yaml_writer = __esm({
21433
21694
  forceQuotes: false,
21434
21695
  sortKeys: false
21435
21696
  };
21697
+ PAGE_MANIFEST_DEFAULTS = pageManifestSchema.parse({ slug: "x", title: "x", audience: "team" });
21698
+ PAGE_TOOL_NOTIFY_DEFAULT = pageManifestSchema.parse({
21699
+ slug: "x",
21700
+ title: "x",
21701
+ audience: "team",
21702
+ tools: [{ connection: "x", tool: "x" }]
21703
+ }).tools[0].notify;
21436
21704
  }
21437
21705
  });
21438
21706
 
21439
21707
  // src/lib/hub-materializer.ts
21440
- import * as path18 from "path";
21708
+ import * as path19 from "path";
21441
21709
  async function materializeHubFolder(hubFolder, payload, options = {}) {
21442
21710
  if (materialized.has(payload)) {
21443
21711
  throw new Error(
@@ -21464,7 +21732,7 @@ async function downloadBinarySkillFiles(hubFolder, payload) {
21464
21732
  let downloadCount = 0;
21465
21733
  for (const skill of skills) {
21466
21734
  if (!skill.files) continue;
21467
- const dir = path18.join(hubFolder, SKILLS_DIR, skillFolder(skill));
21735
+ const dir = path19.join(hubFolder, SKILLS_DIR, skillFolder(skill));
21468
21736
  downloadCount += await downloadBinaryFiles(dir, skill.files, hubFolder, log);
21469
21737
  }
21470
21738
  if (downloadCount > 0) {
@@ -21486,15 +21754,15 @@ var init_hub_materializer = __esm({
21486
21754
  });
21487
21755
 
21488
21756
  // src/lib/base-workspace.ts
21489
- import * as fs15 from "fs";
21490
- import * as path19 from "path";
21491
- import * as yaml9 from "js-yaml";
21757
+ import * as fs16 from "fs";
21758
+ import * as path20 from "path";
21759
+ import * as yaml10 from "js-yaml";
21492
21760
  function readBaseMeta(folder) {
21493
- const bytes = readFileNoFollow(folder, path19.join(folder, BASE_META_FILE));
21761
+ const bytes = readFileNoFollow(folder, path20.join(folder, BASE_META_FILE));
21494
21762
  if (bytes === null) return null;
21495
21763
  let doc;
21496
21764
  try {
21497
- doc = yaml9.load(bytes.toString("utf-8"));
21765
+ doc = yaml10.load(bytes.toString("utf-8"));
21498
21766
  } catch {
21499
21767
  return null;
21500
21768
  }
@@ -21504,13 +21772,13 @@ function readBaseMeta(folder) {
21504
21772
  function listBaseFolders(basesDir) {
21505
21773
  let entries;
21506
21774
  try {
21507
- entries = fs15.readdirSync(basesDir).filter((entry) => !entry.startsWith("."));
21775
+ entries = fs16.readdirSync(basesDir).filter((entry) => !entry.startsWith("."));
21508
21776
  } catch {
21509
21777
  return [];
21510
21778
  }
21511
21779
  const out = [];
21512
21780
  for (const name of entries.sort()) {
21513
- const folder = path19.join(basesDir, name);
21781
+ const folder = path20.join(basesDir, name);
21514
21782
  if (!isDirectory(folder)) continue;
21515
21783
  const meta = readBaseMeta(folder);
21516
21784
  if (meta) out.push({ folder, meta });
@@ -21524,12 +21792,12 @@ function filterEditableBases(bases) {
21524
21792
  return bases.filter((b) => !isProductionFolder(b.meta));
21525
21793
  }
21526
21794
  function findEnclosingBaseFolder(basesDir, cwd) {
21527
- let dir = path19.resolve(cwd);
21528
- const stop = path19.resolve(basesDir);
21795
+ let dir = path20.resolve(cwd);
21796
+ const stop = path20.resolve(basesDir);
21529
21797
  while (isUnder(stop, dir)) {
21530
21798
  const meta = readBaseMeta(dir);
21531
21799
  if (meta) return { folder: dir, meta };
21532
- const parent = path19.dirname(dir);
21800
+ const parent = path20.dirname(dir);
21533
21801
  if (parent === dir) break;
21534
21802
  dir = parent;
21535
21803
  }
@@ -21537,7 +21805,7 @@ function findEnclosingBaseFolder(basesDir, cwd) {
21537
21805
  }
21538
21806
  function folderForSelector(basesDir, selector) {
21539
21807
  assertValidBaseSelector(selector);
21540
- return path19.join(basesDir, selector);
21808
+ return path20.join(basesDir, selector);
21541
21809
  }
21542
21810
  function assertValidBaseSelector(selector, source = "base") {
21543
21811
  if (!isPathSafeId(selector)) {
@@ -21570,24 +21838,24 @@ function resolveBaseTarget(gitRoot, selector, cwd = process.cwd()) {
21570
21838
  throw expected(
21571
21839
  [
21572
21840
  `Multiple bases found in ${label}/. Pass --base <id|folder-name> to choose, or run from inside a base folder:`,
21573
- ...editable.map((b) => ` ${path19.basename(b.folder)} (${b.meta.base_id ?? "not created yet"})`)
21841
+ ...editable.map((b) => ` ${path20.basename(b.folder)} (${b.meta.base_id ?? "not created yet"})`)
21574
21842
  ].join("\n")
21575
21843
  );
21576
21844
  }
21577
21845
  function targetBaseId(target, selector) {
21578
21846
  if (target.meta?.base_id) return target.meta.base_id;
21579
- if (selector && !selector.includes("/") && !selector.includes(path19.sep)) return selector;
21580
- return target.exists ? null : path19.basename(target.folder);
21847
+ if (selector && !selector.includes("/") && !selector.includes(path20.sep)) return selector;
21848
+ return target.exists ? null : path20.basename(target.folder);
21581
21849
  }
21582
21850
  function resolveBaseSelectorToId(gitRoot, selector) {
21583
- if (!gitRoot || selector.includes("/") || selector.includes(path19.sep)) return selector;
21851
+ if (!gitRoot || selector.includes("/") || selector.includes(path20.sep)) return selector;
21584
21852
  if (!isPathSafeId(selector)) return selector;
21585
- const id = readBaseMeta(path19.join(resolveBasesDir(gitRoot), selector))?.base_id;
21853
+ const id = readBaseMeta(path20.join(resolveBasesDir(gitRoot), selector))?.base_id;
21586
21854
  return typeof id === "string" && isPathSafeId(id) ? id : selector;
21587
21855
  }
21588
21856
  function hasBaseMetaFile(folder) {
21589
21857
  try {
21590
- return fs15.lstatSync(path19.join(folder, BASE_META_FILE)).isFile();
21858
+ return fs16.lstatSync(path20.join(folder, BASE_META_FILE)).isFile();
21591
21859
  } catch {
21592
21860
  return false;
21593
21861
  }
@@ -21606,15 +21874,15 @@ var init_base_workspace = __esm({
21606
21874
  });
21607
21875
 
21608
21876
  // src/lib/subtree-routing.ts
21609
- import * as path20 from "path";
21877
+ import * as path21 from "path";
21610
21878
  function readRepoDefaults(gitRoot) {
21611
- const load14 = loadWorkspaceManifest(gitRoot);
21612
- if (load14.kind !== "ok") return {};
21613
- const raw = load14.doc;
21879
+ const load15 = loadWorkspaceManifest(gitRoot);
21880
+ if (load15.kind !== "ok") return {};
21881
+ const raw = load15.doc;
21614
21882
  const str = (v) => {
21615
21883
  if (typeof v !== "string" || !v.trim()) return void 0;
21616
21884
  const value = v.trim();
21617
- if (value.includes("/") || value.includes(path20.sep) || value === "." || value === "..") {
21885
+ if (value.includes("/") || value.includes(path21.sep) || value === "." || value === "..") {
21618
21886
  console.warn(
21619
21887
  `Warning: ignoring ${JSON.stringify(value)} in ${WORKSPACE_MANIFEST_LABEL} \u2014 a default names a hub or base, not a path.`
21620
21888
  );
@@ -21672,12 +21940,12 @@ function extraTargetRefusal(verb, tokens2) {
21672
21940
  return `\`wayai ${verb}\` acts on one target, and was given ${named.length}: ${listed2}. It is refused rather than run on one of them alone: name one target per run.`;
21673
21941
  }
21674
21942
  function firstSegment(p) {
21675
- const normalized = p.split(path20.sep).join("/");
21943
+ const normalized = p.split(path21.sep).join("/");
21676
21944
  const [head] = normalized.split("/").filter(Boolean);
21677
21945
  return head ?? p;
21678
21946
  }
21679
21947
  function resolveSelectorSubtree(layout, selector, cwd) {
21680
- const parts = selector.split(path20.sep).join("/").split("/").filter(Boolean);
21948
+ const parts = selector.split(path21.sep).join("/").split("/").filter(Boolean);
21681
21949
  const qualified = parts[0] === WAYAI_LAYOUT.wsDir ? parts.slice(1) : parts;
21682
21950
  if (qualified.length > 1) {
21683
21951
  if (qualified[0] === WAYAI_LAYOUT.hubsSubdir) return { kind: "hubs", target: qualified[1] };
@@ -21686,17 +21954,17 @@ function resolveSelectorSubtree(layout, selector, cwd) {
21686
21954
  }
21687
21955
  if (!layout) return { kind: "unknown" };
21688
21956
  const { hubsDir, basesDir, communitiesDir } = layout;
21689
- if (selector.includes("/") || selector.includes(path20.sep)) {
21690
- const abs = path20.resolve(cwd, selector);
21691
- if (isUnder(hubsDir, abs)) return { kind: "hubs", target: firstSegment(path20.relative(hubsDir, abs)) };
21692
- if (isUnder(basesDir, abs)) return { kind: "bases", target: firstSegment(path20.relative(basesDir, abs)) };
21957
+ if (selector.includes("/") || selector.includes(path21.sep)) {
21958
+ const abs = path21.resolve(cwd, selector);
21959
+ if (isUnder(hubsDir, abs)) return { kind: "hubs", target: firstSegment(path21.relative(hubsDir, abs)) };
21960
+ if (isUnder(basesDir, abs)) return { kind: "bases", target: firstSegment(path21.relative(basesDir, abs)) };
21693
21961
  if (isUnder(communitiesDir, abs) && abs !== communitiesDir) {
21694
- return { kind: "communities", target: firstSegment(path20.relative(communitiesDir, abs)) };
21962
+ return { kind: "communities", target: firstSegment(path21.relative(communitiesDir, abs)) };
21695
21963
  }
21696
21964
  return { kind: "unknown" };
21697
21965
  }
21698
- const inHubs = isDirectory(path20.join(hubsDir, selector));
21699
- const inBases = isDirectory(path20.join(basesDir, selector));
21966
+ const inHubs = isDirectory(path21.join(hubsDir, selector));
21967
+ const inBases = isDirectory(path21.join(basesDir, selector));
21700
21968
  if (inHubs && inBases) return { kind: "both", target: selector };
21701
21969
  if (inHubs) return { kind: "hubs", target: selector };
21702
21970
  if (inBases) return { kind: "bases", target: selector };
@@ -21709,8 +21977,8 @@ function listCandidates(layout) {
21709
21977
  ];
21710
21978
  const bases = filterEditableBases(listBaseFolders(layout.basesDir)).map((b) => b.folder);
21711
21979
  return [
21712
- ...hubs.map((folder) => ({ subtree: "hubs", name: path20.basename(folder) })),
21713
- ...bases.map((folder) => ({ subtree: "bases", name: path20.basename(folder) }))
21980
+ ...hubs.map((folder) => ({ subtree: "hubs", name: path21.basename(folder) })),
21981
+ ...bases.map((folder) => ({ subtree: "bases", name: path21.basename(folder) }))
21714
21982
  ];
21715
21983
  }
21716
21984
  function mixedInvocationRefusal(verb, targets) {
@@ -21941,12 +22209,12 @@ async function createDataClient(orgId, opts = {}) {
21941
22209
  return orgId2;
21942
22210
  }
21943
22211
  return {
21944
- async request(method, path42, body, headers) {
21945
- const envelope = await api.dataRequest(method, path42, body, org, headers);
22212
+ async request(method, path43, body, headers) {
22213
+ const envelope = await api.dataRequest(method, path43, body, org, headers);
21946
22214
  return envelope.data;
21947
22215
  },
21948
- async requestRaw(method, path42, body) {
21949
- const body_ = await api.dataRequest(method, path42, body, org);
22216
+ async requestRaw(method, path43, body) {
22217
+ const body_ = await api.dataRequest(method, path43, body, org);
21950
22218
  return body_;
21951
22219
  },
21952
22220
  async collectPages(makePath) {
@@ -22176,11 +22444,11 @@ var init_types2 = __esm({
22176
22444
  });
22177
22445
 
22178
22446
  // src/data/config-as-code/config-writer.ts
22179
- import * as fs16 from "fs";
22180
- import * as path21 from "path";
22181
- import * as yaml10 from "js-yaml";
22447
+ import * as fs17 from "fs";
22448
+ import * as path22 from "path";
22449
+ import * as yaml11 from "js-yaml";
22182
22450
  function dump5(value) {
22183
- return yaml10.dump(value, YAML_DUMP_OPTIONS);
22451
+ return yaml11.dump(value, YAML_DUMP_OPTIONS);
22184
22452
  }
22185
22453
  function omitUndefined(obj) {
22186
22454
  const out = {};
@@ -22211,15 +22479,15 @@ function pruneOrphans(folder, dir, keep, log) {
22211
22479
  if (!ensureRealSubdirNoSymlink(folder, dir, false)) return;
22212
22480
  let entries;
22213
22481
  try {
22214
- entries = fs16.readdirSync(dir);
22482
+ entries = fs17.readdirSync(dir);
22215
22483
  } catch {
22216
22484
  return;
22217
22485
  }
22218
22486
  for (const file of entries) {
22219
22487
  if (!file.endsWith(".yaml") || keep.has(file)) continue;
22220
- const abs = path21.join(dir, file);
22221
- fs16.rmSync(abs);
22222
- log.removed.push(path21.relative(folder, abs));
22488
+ const abs = path22.join(dir, file);
22489
+ fs17.rmSync(abs);
22490
+ log.removed.push(path22.relative(folder, abs));
22223
22491
  }
22224
22492
  }
22225
22493
  function metaFileObject(meta) {
@@ -22231,16 +22499,16 @@ function metaFileObject(meta) {
22231
22499
  }
22232
22500
  function writeBaseFolder(folder, meta, config) {
22233
22501
  const delta = { changed: [], removed: [] };
22234
- const parent = path21.dirname(folder);
22235
- fs16.mkdirSync(parent, { recursive: true });
22502
+ const parent = path22.dirname(folder);
22503
+ fs17.mkdirSync(parent, { recursive: true });
22236
22504
  if (!ensureRealSubdirNoSymlink(parent, folder, true)) {
22237
22505
  throw expected(
22238
22506
  `Refusing to write ${folder}: the path crosses a symlink. Remove it and pull again.`
22239
22507
  );
22240
22508
  }
22241
- writeFileIfChanged(folder, path21.join(folder, BASE_META_FILE), dump5(metaFileObject(meta)), delta);
22509
+ writeFileIfChanged(folder, path22.join(folder, BASE_META_FILE), dump5(metaFileObject(meta)), delta);
22242
22510
  for (const kind of ENTITY_KINDS) {
22243
- const dir = path21.join(folder, ENTITY_DIRS[kind]);
22511
+ const dir = path22.join(folder, ENTITY_DIRS[kind]);
22244
22512
  const entities = config[kind] ?? [];
22245
22513
  const keep = /* @__PURE__ */ new Set();
22246
22514
  for (const raw of entities) {
@@ -22252,20 +22520,20 @@ function writeBaseFolder(folder, meta, config) {
22252
22520
  }
22253
22521
  const file = `${id}.yaml`;
22254
22522
  keep.add(file);
22255
- writeFileIfChanged(folder, path21.join(dir, file), dump5(toFileObject(kind, entity)), delta);
22523
+ writeFileIfChanged(folder, path22.join(dir, file), dump5(toFileObject(kind, entity)), delta);
22256
22524
  }
22257
22525
  pruneOrphans(folder, dir, keep, delta);
22258
22526
  }
22259
22527
  for (const deprecated of DEPRECATED_ENTITY_DIRS) {
22260
- const dir = path21.join(folder, deprecated);
22528
+ const dir = path22.join(folder, deprecated);
22261
22529
  if (ensureRealSubdirNoSymlink(folder, dir, false)) {
22262
- fs16.rmSync(dir, { recursive: true, force: true });
22530
+ fs17.rmSync(dir, { recursive: true, force: true });
22263
22531
  }
22264
22532
  }
22265
22533
  return delta;
22266
22534
  }
22267
22535
  function markProductionMirror(folder, baseId2) {
22268
- const file = path21.join(folder, BASE_META_FILE);
22536
+ const file = path22.join(folder, BASE_META_FILE);
22269
22537
  try {
22270
22538
  const body = readFileNoFollow(folder, file)?.toString("utf-8");
22271
22539
  if (body === void 0 || body.startsWith(MIRROR_MARKER_PREFIX)) return;
@@ -22277,7 +22545,7 @@ function markProductionMirror(folder, baseId2) {
22277
22545
  }
22278
22546
  function ensureMirrorIgnored(folder) {
22279
22547
  try {
22280
- writeFileNoFollow(folder, path21.join(folder, ".gitignore"), Buffer.from(MIRROR_GITIGNORE, "utf-8"));
22548
+ writeFileNoFollow(folder, path22.join(folder, ".gitignore"), Buffer.from(MIRROR_GITIGNORE, "utf-8"));
22281
22549
  } catch {
22282
22550
  }
22283
22551
  }
@@ -22417,25 +22685,25 @@ var init_api = __esm({
22417
22685
  });
22418
22686
 
22419
22687
  // src/data/config-as-code/config-parser.ts
22420
- import * as fs17 from "fs";
22421
- import * as path22 from "path";
22422
- import * as yaml11 from "js-yaml";
22688
+ import * as fs18 from "fs";
22689
+ import * as path23 from "path";
22690
+ import * as yaml12 from "js-yaml";
22423
22691
  function readEntityDir(folder, dir) {
22424
22692
  if (!ensureRealSubdirNoSymlink(folder, dir, false)) {
22425
22693
  throw expected(`Refusing to read ${dir}: it is a symlink, not a config directory.`);
22426
22694
  }
22427
22695
  if (!isDirectory(dir)) return [];
22428
22696
  const out = [];
22429
- for (const file of fs17.readdirSync(dir).sort()) {
22697
+ for (const file of fs18.readdirSync(dir).sort()) {
22430
22698
  if (!file.endsWith(".yaml")) continue;
22431
- const abs = path22.join(dir, file);
22699
+ const abs = path23.join(dir, file);
22432
22700
  const bytes = readFileNoFollow(folder, abs);
22433
22701
  if (bytes === null) {
22434
22702
  throw expected(`Refusing to read ${abs}: it is a symlink, not a config file.`);
22435
22703
  }
22436
22704
  let parsed;
22437
22705
  try {
22438
- parsed = yaml11.load(bytes.toString("utf-8"));
22706
+ parsed = yaml12.load(bytes.toString("utf-8"));
22439
22707
  } catch (err) {
22440
22708
  throw expected(`Failed to parse ${abs}: ${err instanceof Error ? err.message : String(err)}`);
22441
22709
  }
@@ -22443,7 +22711,7 @@ function readEntityDir(folder, dir) {
22443
22711
  throw expected(`${abs} is empty or not a YAML object`);
22444
22712
  }
22445
22713
  const entity = parsed;
22446
- const stem = path22.basename(file, ".yaml");
22714
+ const stem = path23.basename(file, ".yaml");
22447
22715
  if (entity.id === void 0) entity.id = stem;
22448
22716
  else if (String(entity.id) !== stem) {
22449
22717
  throw expected(`${abs}: id "${String(entity.id)}" does not match filename "${stem}.yaml"`);
@@ -22456,11 +22724,11 @@ function parseBaseFolder(folder) {
22456
22724
  const meta = readBaseMeta(folder);
22457
22725
  if (!meta) {
22458
22726
  throw expected(
22459
- hasBaseMetaFile(folder) ? `${path22.join(folder, BASE_META_FILE)} could not be parsed as a YAML mapping. Fix it, or delete it and pull again.` : `No ${BASE_META_FILE} found in ${folder}`
22727
+ hasBaseMetaFile(folder) ? `${path23.join(folder, BASE_META_FILE)} could not be parsed as a YAML mapping. Fix it, or delete it and pull again.` : `No ${BASE_META_FILE} found in ${folder}`
22460
22728
  );
22461
22729
  }
22462
- const read = (kind) => readEntityDir(folder, path22.join(folder, ENTITY_DIRS[kind]));
22463
- const fileTypesDir = path22.join(folder, ENTITY_DIRS.file_types);
22730
+ const read = (kind) => readEntityDir(folder, path23.join(folder, ENTITY_DIRS[kind]));
22731
+ const fileTypesDir = path23.join(folder, ENTITY_DIRS.file_types);
22464
22732
  const fileTypes = readEntityDir(folder, fileTypesDir);
22465
22733
  const config = {
22466
22734
  record_types: read("record_types"),
@@ -22577,7 +22845,7 @@ __export(sync_exports, {
22577
22845
  pullBase: () => pullBase,
22578
22846
  pushBase: () => pushBase
22579
22847
  });
22580
- import * as path23 from "path";
22848
+ import * as path24 from "path";
22581
22849
  function parseArgs4(args2) {
22582
22850
  return {
22583
22851
  autoConfirm: args2.includes("--yes") || args2.includes("-y"),
@@ -22594,7 +22862,7 @@ async function writeProductionMirror(client, basesDir, prodId, record) {
22594
22862
  throw expected(`Refusing to mirror base ${JSON.stringify(prodId)}: not a usable base id.`);
22595
22863
  }
22596
22864
  const config = await getConfig(client, prodId);
22597
- const folder = path23.join(basesDir, prodId);
22865
+ const folder = path24.join(basesDir, prodId);
22598
22866
  writeBaseFolder(folder, { ...metaFromRecord(record, prodId), environment: "production" }, config);
22599
22867
  markProductionMirror(folder, prodId);
22600
22868
  ensureMirrorIgnored(folder);
@@ -22634,7 +22902,7 @@ async function pullBase(gitRootOrNull, selector, args2) {
22634
22902
  assertInScope("bases", baseId2);
22635
22903
  if (target.exists && !autoConfirm) {
22636
22904
  const ok = await confirm(
22637
- `Overwrite local files in ${path23.relative(gitRoot, target.folder)} with the server config for "${sanitizeTerminalText(baseId2)}"?`
22905
+ `Overwrite local files in ${path24.relative(gitRoot, target.folder)} with the server config for "${sanitizeTerminalText(baseId2)}"?`
22638
22906
  );
22639
22907
  if (!ok) {
22640
22908
  console.log("Cancelled.");
@@ -22674,7 +22942,7 @@ async function createDeclaredPreview(client, target, parsed, autoConfirm) {
22674
22942
  "base.yaml needs a base_id (an existing preview) or an origin_base_id (to create one)."
22675
22943
  );
22676
22944
  }
22677
- const name = meta.name ?? path23.basename(target.folder);
22945
+ const name = meta.name ?? path24.basename(target.folder);
22678
22946
  assertScopeAllowsCreation("bases", name);
22679
22947
  if (!autoConfirm) {
22680
22948
  const ok = await confirm(
@@ -22710,12 +22978,12 @@ async function pushBase(gitRootOrNull, selector, args2) {
22710
22978
  const { meta, config } = parsed;
22711
22979
  if (isProductionFolder(meta)) {
22712
22980
  throw expected(
22713
- `${path23.relative(gitRoot, target.folder)} is a read-only production mirror. Push operates on previews \u2014 edit the linked preview and promote with \`wayai bases promote\`.`
22981
+ `${path24.relative(gitRoot, target.folder)} is a read-only production mirror. Push operates on previews \u2014 edit the linked preview and promote with \`wayai bases promote\`.`
22714
22982
  );
22715
22983
  }
22716
22984
  if (!meta.base_id && dryRun) {
22717
22985
  console.log(
22718
- `Dry run \u2014 nothing applied. ${path23.relative(gitRoot, target.folder)} has no base_id yet, so a real push would first create a preview from "${sanitizeTerminalText(meta.origin_base_id ?? "<origin_base_id>")}".`
22986
+ `Dry run \u2014 nothing applied. ${path24.relative(gitRoot, target.folder)} has no base_id yet, so a real push would first create a preview from "${sanitizeTerminalText(meta.origin_base_id ?? "<origin_base_id>")}".`
22719
22987
  );
22720
22988
  return;
22721
22989
  }
@@ -23174,9 +23442,9 @@ var init_model = __esm({
23174
23442
  });
23175
23443
 
23176
23444
  // src/communities/course-files.ts
23177
- import * as fs18 from "fs";
23178
- import * as path24 from "path";
23179
- import * as yaml12 from "js-yaml";
23445
+ import * as fs19 from "fs";
23446
+ import * as path25 from "path";
23447
+ import * as yaml13 from "js-yaml";
23180
23448
  function isMapping(value) {
23181
23449
  return typeof value === "object" && value !== null && !Array.isArray(value);
23182
23450
  }
@@ -23256,11 +23524,11 @@ function readNameList(raw, where, what, problems2) {
23256
23524
  return names;
23257
23525
  }
23258
23526
  function readCourseFolders(communityFolder, slugs, problems2) {
23259
- const coursesDir = path24.join(communityFolder, COURSES_DIR);
23527
+ const coursesDir = path25.join(communityFolder, COURSES_DIR);
23260
23528
  requireRealSubdirNoSymlink(communityFolder, coursesDir, false);
23261
23529
  const courses = [];
23262
23530
  for (const slug of slugs) {
23263
- const folder = path24.join(coursesDir, slug);
23531
+ const folder = path25.join(coursesDir, slug);
23264
23532
  requireRealSubdirNoSymlink(communityFolder, folder, false);
23265
23533
  if (!isRealDirectory(folder)) {
23266
23534
  problems2.push(`${COMMUNITY_FILE} courses: ${slug} has no folder ${COURSES_DIR}/${slug}/`);
@@ -23269,19 +23537,19 @@ function readCourseFolders(communityFolder, slugs, problems2) {
23269
23537
  const course = readCourseFolder(communityFolder, folder, slug, problems2);
23270
23538
  if (course) courses.push(course);
23271
23539
  }
23272
- const unlisted = folderEntries(coursesDir).filter((name) => !slugs.includes(name) && isRealDirectory(path24.join(coursesDir, name))).map((name) => ({ name, id: readYamlIdNoFollow(communityFolder, path24.join(coursesDir, name, COURSE_FILE), "id") }));
23540
+ const unlisted = folderEntries(coursesDir).filter((name) => !slugs.includes(name) && isRealDirectory(path25.join(coursesDir, name))).map((name) => ({ name, id: readYamlIdNoFollow(communityFolder, path25.join(coursesDir, name, COURSE_FILE), "id") }));
23273
23541
  return { courses, unlisted };
23274
23542
  }
23275
23543
  function readCourseFolder(communityFolder, folder, slug, problems2) {
23276
23544
  const where = `${COURSES_DIR}/${slug}/${COURSE_FILE}`;
23277
- const text2 = readRealFileOrThrow(communityFolder, path24.join(folder, COURSE_FILE));
23545
+ const text2 = readRealFileOrThrow(communityFolder, path25.join(folder, COURSE_FILE));
23278
23546
  if (text2 === null) {
23279
23547
  problems2.push(`${COURSES_DIR}/${slug}/: no ${COURSE_FILE}`);
23280
23548
  return null;
23281
23549
  }
23282
23550
  let doc;
23283
23551
  try {
23284
- doc = yaml12.load(text2);
23552
+ doc = yaml13.load(text2);
23285
23553
  } catch (err) {
23286
23554
  problems2.push(`${where} is not valid YAML: ${err instanceof Error ? err.message : String(err)}`);
23287
23555
  return null;
@@ -23298,11 +23566,11 @@ function readCourseFolder(communityFolder, folder, slug, problems2) {
23298
23566
  const parsed = communityCourseCreateBody.safeParse({ title: doc.title, description: description2 });
23299
23567
  if (!parsed.success) problems2.push(`${where}: ${contractProblem(parsed.error)}`);
23300
23568
  const published = optionalBoolean(doc, "published", where, problems2);
23301
- const lessonsDir = path24.join(folder, LESSONS_DIR);
23569
+ const lessonsDir = path25.join(folder, LESSONS_DIR);
23302
23570
  requireRealSubdirNoSymlink(communityFolder, lessonsDir, false);
23303
23571
  const modules = readModules(communityFolder, lessonsDir, doc.modules, slug, where, problems2);
23304
23572
  const listed2 = new Set(modules.flatMap((module) => module.lessons.map((lesson) => lesson.slug)));
23305
- const unlisted = folderEntries(lessonsDir).filter((name) => name.endsWith(LESSON_FILE_EXT) && !listed2.has(path24.basename(name, LESSON_FILE_EXT))).map((name) => ({ name, id: uuidField(lessonFrontmatter(readFileNoFollow(communityFolder, path24.join(lessonsDir, name))), "id") }));
23573
+ const unlisted = folderEntries(lessonsDir).filter((name) => name.endsWith(LESSON_FILE_EXT) && !listed2.has(path25.basename(name, LESSON_FILE_EXT))).map((name) => ({ name, id: uuidField(lessonFrontmatter(readFileNoFollow(communityFolder, path25.join(lessonsDir, name))), "id") }));
23306
23574
  if (!parsed.success) return null;
23307
23575
  return {
23308
23576
  slug,
@@ -23374,7 +23642,7 @@ function splitFrontmatter(text2) {
23374
23642
  function readLessonFile(communityFolder, lessonsDir, courseSlug, slug, problems2) {
23375
23643
  const name = `${slug}${LESSON_FILE_EXT}`;
23376
23644
  const where = `${COURSES_DIR}/${courseSlug}/${LESSONS_DIR}/${name}`;
23377
- const raw = readRealFileOrThrow(communityFolder, path24.join(lessonsDir, name));
23645
+ const raw = readRealFileOrThrow(communityFolder, path25.join(lessonsDir, name));
23378
23646
  if (raw === null) {
23379
23647
  const hint = slug.endsWith(LESSON_FILE_EXT) ? ` (list a lesson by its file's name less ${LESSON_FILE_EXT})` : "";
23380
23648
  problems2.push(`${COURSES_DIR}/${courseSlug}/${COURSE_FILE}: lesson ${slug} has no file ${LESSONS_DIR}/${name}${hint}`);
@@ -23387,7 +23655,7 @@ function readLessonFile(communityFolder, lessonsDir, courseSlug, slug, problems2
23387
23655
  }
23388
23656
  let doc;
23389
23657
  try {
23390
- doc = parts.front.trim() === "" ? {} : yaml12.load(parts.front);
23658
+ doc = parts.front.trim() === "" ? {} : yaml13.load(parts.front);
23391
23659
  } catch (err) {
23392
23660
  problems2.push(`${where}: the frontmatter is not valid YAML: ${err instanceof Error ? err.message : String(err)}`);
23393
23661
  return null;
@@ -23429,7 +23697,7 @@ function readLessonFile(communityFolder, lessonsDir, courseSlug, slug, problems2
23429
23697
  }
23430
23698
  function folderEntries(dir) {
23431
23699
  try {
23432
- return fs18.readdirSync(dir).filter((name) => !name.startsWith(".")).sort();
23700
+ return fs19.readdirSync(dir).filter((name) => !name.startsWith(".")).sort();
23433
23701
  } catch {
23434
23702
  return [];
23435
23703
  }
@@ -23438,7 +23706,7 @@ function lessonFrontmatter(bytes) {
23438
23706
  const parts = bytes ? splitFrontmatter(toLf(bytes.toString("utf-8"))) : null;
23439
23707
  if (!parts) return null;
23440
23708
  try {
23441
- return yaml12.load(parts.front);
23709
+ return yaml13.load(parts.front);
23442
23710
  } catch {
23443
23711
  return null;
23444
23712
  }
@@ -23466,7 +23734,7 @@ function renderCourseYaml(course) {
23466
23734
  }
23467
23735
  } : {}
23468
23736
  };
23469
- return yaml12.dump(doc, YAML_DUMP_OPTIONS);
23737
+ return yaml13.dump(doc, YAML_DUMP_OPTIONS);
23470
23738
  }
23471
23739
  function syncedRank(course, moduleId) {
23472
23740
  const at = course.synced?.modules?.indexOf(moduleId) ?? -1;
@@ -23484,15 +23752,15 @@ function renderLessonFile(lesson) {
23484
23752
  requires_paid_plan: lesson.requires_paid_plan
23485
23753
  };
23486
23754
  return `---
23487
- ${yaml12.dump(front, YAML_DUMP_OPTIONS)}---
23755
+ ${yaml13.dump(front, YAML_DUMP_OPTIONS)}---
23488
23756
  ${toLf(lesson.body)}
23489
23757
  `;
23490
23758
  }
23491
23759
  function writeCourseYaml(root, communityFolder, course) {
23492
- return writeFileIfChangedNoFollow(root, path24.join(communityFolder, coursePath(course)), renderCourseYaml(course));
23760
+ return writeFileIfChangedNoFollow(root, path25.join(communityFolder, coursePath(course)), renderCourseYaml(course));
23493
23761
  }
23494
23762
  function writeLessonFile(root, communityFolder, course, lesson) {
23495
- return writeFileIfChangedNoFollow(root, path24.join(communityFolder, lessonPath(course, lesson)), renderLessonFile(lesson));
23763
+ return writeFileIfChangedNoFollow(root, path25.join(communityFolder, lessonPath(course, lesson)), renderLessonFile(lesson));
23496
23764
  }
23497
23765
  function writeCourseFolder(root, communityFolder, course) {
23498
23766
  const written = writeCourseYaml(root, communityFolder, course) ? [coursePath(course)] : [];
@@ -23524,26 +23792,26 @@ var init_course_files = __esm({
23524
23792
  COURSE_SYNCED_KEYS = ["modules", "lessons"];
23525
23793
  LESSON_KEYS = ["id", "rev", "title", "published", "room", "video_url", "links", "requires_paid_plan"];
23526
23794
  lessonFileBody = communityLessonCreateBody.omit({ module_id: true, room_id: true, client_id: true });
23527
- coursePath = (course) => path24.join(COURSES_DIR, course.slug, COURSE_FILE);
23528
- lessonPath = (course, lesson) => path24.join(COURSES_DIR, course.slug, LESSONS_DIR, `${lesson.slug}${LESSON_FILE_EXT}`);
23529
- unlistedPath = (name, course) => course ? path24.join(COURSES_DIR, course.slug, LESSONS_DIR, name) : `${path24.join(COURSES_DIR, name)}/`;
23795
+ coursePath = (course) => path25.join(COURSES_DIR, course.slug, COURSE_FILE);
23796
+ lessonPath = (course, lesson) => path25.join(COURSES_DIR, course.slug, LESSONS_DIR, `${lesson.slug}${LESSON_FILE_EXT}`);
23797
+ unlistedPath = (name, course) => course ? path25.join(COURSES_DIR, course.slug, LESSONS_DIR, name) : `${path25.join(COURSES_DIR, name)}/`;
23530
23798
  }
23531
23799
  });
23532
23800
 
23533
23801
  // src/communities/files.ts
23534
- import * as path25 from "path";
23535
- import * as yaml13 from "js-yaml";
23802
+ import * as path26 from "path";
23803
+ import * as yaml14 from "js-yaml";
23536
23804
  function readCommunityFolder(folder) {
23537
- const where = path25.basename(folder);
23538
- const yamlPath = path25.join(folder, COMMUNITY_FILE);
23805
+ const where = path26.basename(folder);
23806
+ const yamlPath = path26.join(folder, COMMUNITY_FILE);
23539
23807
  const text2 = readRealFileOrThrow(folder, yamlPath);
23540
23808
  if (text2 === null) {
23541
23809
  throw expected(`No ${COMMUNITY_FILE} in ${where}/: pull the community first (wayai pull communities/<community_id>).`);
23542
23810
  }
23543
- const rules = toLf(readRealFileOrThrow(folder, path25.join(folder, RULES_FILE)) ?? "");
23811
+ const rules = toLf(readRealFileOrThrow(folder, path26.join(folder, RULES_FILE)) ?? "");
23544
23812
  let doc;
23545
23813
  try {
23546
- doc = yaml13.load(text2);
23814
+ doc = yaml14.load(text2);
23547
23815
  } catch (err) {
23548
23816
  throw expected(`${where}/${COMMUNITY_FILE} is not valid YAML: ${err instanceof Error ? err.message : String(err)}`);
23549
23817
  }
@@ -23711,7 +23979,7 @@ function renderCommunityYaml(files) {
23711
23979
  courses: files.courses.map((course) => course.slug),
23712
23980
  ...files.synced_courses ? { synced: { courses: files.synced_courses } } : {}
23713
23981
  };
23714
- return yaml13.dump(doc, YAML_DUMP_OPTIONS);
23982
+ return yaml14.dump(doc, YAML_DUMP_OPTIONS);
23715
23983
  }
23716
23984
  function renderRules(rules) {
23717
23985
  const text2 = toLf(rules).replace(/\n+$/, "");
@@ -23725,14 +23993,14 @@ function renderCommunityFiles(files) {
23725
23993
  ];
23726
23994
  }
23727
23995
  function writeCommunityFiles(root, folder, files) {
23728
- return renderCommunityFiles(files).flatMap(([name, content]) => writeFileIfChangedNoFollow(root, path25.join(folder, name), content) ? [name] : []);
23996
+ return renderCommunityFiles(files).flatMap(([name, content]) => writeFileIfChangedNoFollow(root, path26.join(folder, name), content) ? [name] : []);
23729
23997
  }
23730
23998
  function communityFilesSaver(root, folder, files) {
23731
23999
  const saved = new Map(renderCommunityFiles(files));
23732
24000
  return () => {
23733
24001
  for (const [name, content] of renderCommunityFiles(files)) {
23734
24002
  if (saved.get(name) === content) continue;
23735
- writeFileIfChangedNoFollow(root, path25.join(folder, name), content);
24003
+ writeFileIfChangedNoFollow(root, path26.join(folder, name), content);
23736
24004
  saved.set(name, content);
23737
24005
  }
23738
24006
  };
@@ -23898,7 +24166,7 @@ var init_order = __esm({
23898
24166
 
23899
24167
  // src/communities/courses.ts
23900
24168
  import { isDeepStrictEqual } from "util";
23901
- import * as path26 from "path";
24169
+ import * as path27 from "path";
23902
24170
  function roomIdOf(rooms, key) {
23903
24171
  if (key === void 0) return null;
23904
24172
  const room = rooms.find((entry) => entry.key === key);
@@ -24389,7 +24657,7 @@ function pullTree(files, index, course, takes, note, listing) {
24389
24657
  const { folder } = course;
24390
24658
  const server = course.export;
24391
24659
  const keys = new Set(folder.modules.map((module) => module.key));
24392
- const unlisted = folder.unlisted.map((file) => ({ slug: path26.basename(file.name, LESSON_FILE_EXT), id: file.id }));
24660
+ const unlisted = folder.unlisted.map((file) => ({ slug: path27.basename(file.name, LESSON_FILE_EXT), id: file.id }));
24393
24661
  const slugs = new Set([...folder.modules.flatMap((module) => module.lessons.map((lesson) => lesson.slug)), ...unlisted.map((file) => file.slug)].map((name) => name.toLowerCase()));
24394
24662
  const held = new Set(unlisted.flatMap((file) => file.id === null ? [] : [file.id]));
24395
24663
  const fresh = /* @__PURE__ */ new Set();
@@ -25113,8 +25381,8 @@ __export(sync_exports2, {
25113
25381
  pullCommunity: () => pullCommunity,
25114
25382
  pushCommunity: () => pushCommunity
25115
25383
  });
25116
- import * as fs19 from "fs";
25117
- import * as path27 from "path";
25384
+ import * as fs20 from "fs";
25385
+ import * as path28 from "path";
25118
25386
  function parseArgs5(args2) {
25119
25387
  return {
25120
25388
  autoConfirm: args2.includes("--yes") || args2.includes("-y"),
@@ -25450,13 +25718,13 @@ async function pushCommunity(gitRootOrNull, selector, args2) {
25450
25718
  throw expected("Push changes the live community and asks first: pass -y when not running in a terminal, or --dry-run to only list the changes.");
25451
25719
  }
25452
25720
  const { organization_id: orgId } = requireRepoConfig(gitRoot);
25453
- const label = path27.basename(folder);
25721
+ const label = path28.basename(folder);
25454
25722
  assertInScope("communities", files.community_id, label);
25455
25723
  warnUnlisted(files);
25456
25724
  const remote = await openRemote(files.community_id);
25457
25725
  const server = await remote.read(orgId);
25458
25726
  const plan = planSync(files, server);
25459
- console.log(`Community ${show(server.community.name)} (${server.community.community_id}) \u2014 ${path27.relative(gitRoot, folder)}/`);
25727
+ console.log(`Community ${show(server.community.name)} (${server.community.community_id}) \u2014 ${path28.relative(gitRoot, folder)}/`);
25460
25728
  const problems2 = pushProblems(files, server, plan);
25461
25729
  if (problems2.length > 0) {
25462
25730
  throw expected(`Nothing was pushed:
@@ -25533,7 +25801,7 @@ What it applied before stopping is on the community, and the files record it. Fi
25533
25801
  }
25534
25802
  console.log(
25535
25803
  `
25536
- Pushed ${done} change(s). Commit ${path27.relative(gitRoot, folder)}/: the files now record the ids and revs this push wrote.`
25804
+ Pushed ${done} change(s). Commit ${path28.relative(gitRoot, folder)}/: the files now record the ids and revs this push wrote.`
25537
25805
  );
25538
25806
  seedScopeIfEmpty("communities", files.community_id);
25539
25807
  }
@@ -25666,15 +25934,15 @@ async function pullCommunity(gitRootOrNull, selector, args2) {
25666
25934
  communityId = existing.files.community_id;
25667
25935
  }
25668
25936
  const { organization_id: orgId } = requireRepoConfig(gitRoot);
25669
- assertInScope("communities", communityId, existing ? path27.basename(existing.folder) : void 0);
25937
+ assertInScope("communities", communityId, existing ? path28.basename(existing.folder) : void 0);
25670
25938
  const { communitiesDir } = resolveLayout(gitRoot);
25671
25939
  const remote = await openRemote(communityId);
25672
25940
  const server = await remote.read(orgId);
25673
25941
  if (!existing) {
25674
25942
  const taken = new Set(safeReaddir2(communitiesDir).map((name) => name.toLowerCase()));
25675
- const folder2 = path27.join(communitiesDir, localName(server.community.name, communityId, taken, "community"));
25943
+ const folder2 = path28.join(communitiesDir, localName(server.community.name, communityId, taken, "community"));
25676
25944
  const files = filesFromServer(server);
25677
- const where = `${path27.relative(gitRoot, folder2)}/`;
25945
+ const where = `${path28.relative(gitRoot, folder2)}/`;
25678
25946
  const counts = `${files.rooms.length} room(s), ${files.courses.length} course(s)`;
25679
25947
  if (dryRun) {
25680
25948
  console.log(`Dry run \u2014 would write community ${show(server.community.name)} to ${where} with ${counts}.`);
@@ -25695,7 +25963,7 @@ async function pullCommunity(gitRootOrNull, selector, args2) {
25695
25963
  ${problems2.map((p) => ` - ${p}`).join("\n")}`);
25696
25964
  }
25697
25965
  const listing = pullMerge(local, server, plan, theirs);
25698
- console.log(`Community ${show(server.community.name)} (${communityId}) \u2014 ${path27.relative(gitRoot, folder)}/`);
25966
+ console.log(`Community ${show(server.community.name)} (${communityId}) \u2014 ${path28.relative(gitRoot, folder)}/`);
25699
25967
  printListing(listing);
25700
25968
  if (dryRun) {
25701
25969
  console.log("\nDry run \u2014 nothing was written.");
@@ -25710,11 +25978,11 @@ Wrote ${written.join(", ")}.` : "\nAlready up to date.");
25710
25978
  }
25711
25979
  }
25712
25980
  function resolveConflicts(folder) {
25713
- return `To resolve, take the server's side \u2014 wayai pull ${WAYAI_LAYOUT.communitiesSubdir}/${path27.basename(folder)} --theirs \u2014 then make again any edit of yours to keep, and push.`;
25981
+ return `To resolve, take the server's side \u2014 wayai pull ${WAYAI_LAYOUT.communitiesSubdir}/${path28.basename(folder)} --theirs \u2014 then make again any edit of yours to keep, and push.`;
25714
25982
  }
25715
25983
  function safeReaddir2(dir) {
25716
25984
  try {
25717
- return fs19.readdirSync(dir);
25985
+ return fs20.readdirSync(dir);
25718
25986
  } catch {
25719
25987
  return [];
25720
25988
  }
@@ -25833,9 +26101,9 @@ __export(push_exports, {
25833
26101
  shouldWarnIgnoredPreviewLabel: () => shouldWarnIgnoredPreviewLabel,
25834
26102
  syncAfterPush: () => syncAfterPush
25835
26103
  });
25836
- import * as fs20 from "fs";
25837
- import * as path28 from "path";
25838
- import * as yaml14 from "js-yaml";
26104
+ import * as fs21 from "fs";
26105
+ import * as path29 from "path";
26106
+ import * as yaml15 from "js-yaml";
25839
26107
  function parseArgs6(args2) {
25840
26108
  let autoConfirm = false;
25841
26109
  let label;
@@ -25898,6 +26166,9 @@ Sync complete. Preview hub: ${result.preview_hub_id}`);
25898
26166
  if (c.contact_lists_created > 0) parts.push(`${c.contact_lists_created} contact list(s) created`);
25899
26167
  if (c.contact_lists_updated > 0) parts.push(`${c.contact_lists_updated} contact list(s) updated`);
25900
26168
  if (c.contact_lists_deleted > 0) parts.push(`${c.contact_lists_deleted} contact list(s) deleted`);
26169
+ if ((c.pages_created ?? 0) > 0) parts.push(`${c.pages_created} page(s) created`);
26170
+ if ((c.pages_updated ?? 0) > 0) parts.push(`${c.pages_updated} page(s) updated`);
26171
+ if ((c.pages_deleted ?? 0) > 0) parts.push(`${c.pages_deleted} page(s) deleted`);
25901
26172
  if (parts.length > 0) {
25902
26173
  console.log(`Changes: ${parts.join(", ")}`);
25903
26174
  }
@@ -25940,14 +26211,14 @@ function printLocalFileChanges(delta) {
25940
26211
  }
25941
26212
  async function autoRenameAgentFiles(client, hubId, hubFolder, organizationId, remoteConfig) {
25942
26213
  requireRealHubFolder(hubFolder, false);
25943
- const agentsDir = path28.join(hubFolder, "agents");
26214
+ const agentsDir = path29.join(hubFolder, "agents");
25944
26215
  let agentsWithIds = [];
25945
- if (fs20.existsSync(agentsDir)) {
25946
- const yamlFiles = fs20.readdirSync(agentsDir).filter((f) => f.endsWith(".yaml"));
26216
+ if (fs21.existsSync(agentsDir)) {
26217
+ const yamlFiles = fs21.readdirSync(agentsDir).filter((f) => f.endsWith(".yaml"));
25947
26218
  for (const file of yamlFiles) {
25948
- const content = readRealFileOrThrow(hubFolder, path28.join(agentsDir, file)) ?? "";
26219
+ const content = readRealFileOrThrow(hubFolder, path29.join(agentsDir, file)) ?? "";
25949
26220
  try {
25950
- const agent = yaml14.load(content);
26221
+ const agent = yaml15.load(content);
25951
26222
  if (agent?.id && agent.name) {
25952
26223
  agentsWithIds.push({ id: agent.id, name: agent.name });
25953
26224
  }
@@ -25960,7 +26231,7 @@ async function autoRenameAgentFiles(client, hubId, hubFolder, organizationId, re
25960
26231
  const yamlPath = resolveHubYamlPath(hubFolder);
25961
26232
  if (!yamlPath) return;
25962
26233
  const yamlContent = readRealFileOrThrow(hubFolder, yamlPath) ?? "";
25963
- const config = yaml14.load(yamlContent);
26234
+ const config = yaml15.load(yamlContent);
25964
26235
  agentsWithIds = (config.agents || []).filter((a) => !!a.id && !!a.name);
25965
26236
  }
25966
26237
  if (agentsWithIds.length === 0) return;
@@ -25991,18 +26262,18 @@ async function autoRenameAgentFiles(client, hubId, hubFolder, organizationId, re
25991
26262
  }
25992
26263
  }
25993
26264
  if (renames.length === 0) return;
25994
- if (!fs20.existsSync(agentsDir)) return;
25995
- for (const file of fs20.readdirSync(agentsDir)) {
26265
+ if (!fs21.existsSync(agentsDir)) return;
26266
+ for (const file of fs21.readdirSync(agentsDir)) {
25996
26267
  if (file.startsWith("__rename_temp_") && (file.endsWith(".md") || file.endsWith(".yaml"))) {
25997
26268
  console.warn(` Warning: removing orphaned temp file agents/${file}`);
25998
- fs20.unlinkSync(path28.join(agentsDir, file));
26269
+ fs21.unlinkSync(path29.join(agentsDir, file));
25999
26270
  }
26000
26271
  }
26001
26272
  const renameFileIfExists = (dir, oldName, newName) => {
26002
- const oldPath = path28.join(dir, oldName);
26003
- const newPath = path28.join(dir, newName);
26004
- if (!fs20.existsSync(oldPath)) return false;
26005
- fs20.renameSync(oldPath, newPath);
26273
+ const oldPath = path29.join(dir, oldName);
26274
+ const newPath = path29.join(dir, newName);
26275
+ if (!fs21.existsSync(oldPath)) return false;
26276
+ fs21.renameSync(oldPath, newPath);
26006
26277
  return true;
26007
26278
  };
26008
26279
  const oldSlugs = new Set(renames.map((r) => r.oldSlug));
@@ -26035,9 +26306,9 @@ async function autoRenameAgentFiles(client, hubId, hubFolder, organizationId, re
26035
26306
  }
26036
26307
  } else {
26037
26308
  for (const { oldSlug, newSlug } of renames) {
26038
- const hasOldFile = extensions.some((ext) => fs20.existsSync(path28.join(agentsDir, `${oldSlug}${ext}`)));
26309
+ const hasOldFile = extensions.some((ext) => fs21.existsSync(path29.join(agentsDir, `${oldSlug}${ext}`)));
26039
26310
  if (!hasOldFile) continue;
26040
- const hasNewFile = extensions.some((ext) => fs20.existsSync(path28.join(agentsDir, `${newSlug}${ext}`)));
26311
+ const hasNewFile = extensions.some((ext) => fs21.existsSync(path29.join(agentsDir, `${newSlug}${ext}`)));
26041
26312
  if (hasNewFile) {
26042
26313
  console.warn(` Warning: skipping rename agents/${oldSlug}.* \u2192 agents/${newSlug}.* (target already exists)`);
26043
26314
  continue;
@@ -26064,7 +26335,7 @@ async function autoRenameAgentFiles(client, hubId, hubFolder, organizationId, re
26064
26335
  );
26065
26336
  if (updatedYaml !== mainYamlContent) {
26066
26337
  writeFileNoFollow(hubFolder, mainYamlPath, Buffer.from(updatedYaml, "utf-8"));
26067
- console.log(` Updated instructions paths in ${path28.basename(mainYamlPath)}`);
26338
+ console.log(` Updated instructions paths in ${path29.basename(mainYamlPath)}`);
26068
26339
  }
26069
26340
  }
26070
26341
  }
@@ -26133,7 +26404,7 @@ async function pushSingleHub(client, hubId, hubFolder, autoConfirm, organization
26133
26404
  function selectExistingHub(workspaceDir, allHubs, selector, wsLabel) {
26134
26405
  if (selector !== void 0) {
26135
26406
  const match = allHubs.find(
26136
- (h) => h.hubId === selector || path28.basename(h.hubFolder) === selector
26407
+ (h) => h.hubId === selector || path29.basename(h.hubFolder) === selector
26137
26408
  );
26138
26409
  if (!match) {
26139
26410
  console.error(`No hub matching --hub ${selector} found in ${wsLabel}/.`);
@@ -26204,7 +26475,7 @@ function reportUnresolvedPushTarget(reason, existingHubs, newHubs, selector, wsL
26204
26475
  if (existingHubs.length > 0) {
26205
26476
  console.error(`No pushable hub found in ${wsLabel}/ \u2014 only read-only production mirror folder(s). Edit the linked preview hub, pull one, or create a new hub with \`wayai create\`:`);
26206
26477
  for (const h of existingHubs) {
26207
- console.error(` ${path28.basename(h.hubFolder)} (${h.hubId}, production mirror)`);
26478
+ console.error(` ${path29.basename(h.hubFolder)} (${h.hubId}, production mirror)`);
26208
26479
  }
26209
26480
  } else {
26210
26481
  console.error(`No hub folders found. Create hub files in ${wsLabel}/<hub>/hub.yaml with \`hub: { name: ... }\` and run \`wayai push\` (or \`wayai create\`).`);
@@ -26218,10 +26489,10 @@ function reportUnresolvedPushTarget(reason, existingHubs, newHubs, selector, wsL
26218
26489
  console.error(`Multiple hub folders found in ${wsLabel}/. Pass --hub <uuid|folder-name> to choose, or run from inside a hub folder:`);
26219
26490
  }
26220
26491
  for (const h of existingHubs) {
26221
- console.error(` ${path28.basename(h.hubFolder)} (${h.hubId})`);
26492
+ console.error(` ${path29.basename(h.hubFolder)} (${h.hubId})`);
26222
26493
  }
26223
26494
  for (const h of newHubs) {
26224
- console.error(` ${path28.basename(h.hubFolder)} (new \u2014 "${h.hubName}")`);
26495
+ console.error(` ${path29.basename(h.hubFolder)} (new \u2014 "${h.hubName}")`);
26225
26496
  }
26226
26497
  if (hint) console.error(hint);
26227
26498
  process.exit(1);
@@ -26248,7 +26519,7 @@ async function pushCommand(args2) {
26248
26519
  const client = new ApiClient({ apiUrl: config.api_url, accessToken });
26249
26520
  const workspaceDir = resolveWorkspaceDir();
26250
26521
  const wsLabel = hubsDirLabel(gitRoot);
26251
- if (!fs20.existsSync(workspaceDir)) {
26522
+ if (!fs21.existsSync(workspaceDir)) {
26252
26523
  console.error(`No ${wsLabel}/ directory found. Run \`wayai pull\` first or create hub files in ${wsLabel}/<hub>/hub.yaml.`);
26253
26524
  const hint = communityFoldersHint(gitRoot, "push");
26254
26525
  if (hint) console.error(hint);
@@ -26270,8 +26541,8 @@ async function pushCommand(args2) {
26270
26541
  if (label) {
26271
26542
  console.warn("Note: --label is only used when creating a new hub. To change an existing hub's label, use `wayai relabel`.");
26272
26543
  }
26273
- console.log(`Target hub: ${path28.basename(existing.hubFolder)} (${existing.hubId})`);
26274
- assertInScope("hubs", existing.hubId, path28.basename(existing.hubFolder));
26544
+ console.log(`Target hub: ${path29.basename(existing.hubFolder)} (${existing.hubId})`);
26545
+ assertInScope("hubs", existing.hubId, path29.basename(existing.hubFolder));
26275
26546
  await pushSingleHub(client, existing.hubId, existing.hubFolder, autoConfirm, organizationId);
26276
26547
  return;
26277
26548
  }
@@ -26309,8 +26580,8 @@ __export(pull_exports, {
26309
26580
  resolveHubTarget: () => resolveHubTarget,
26310
26581
  writeProductionMirror: () => writeProductionMirror2
26311
26582
  });
26312
- import * as fs21 from "fs";
26313
- import * as path29 from "path";
26583
+ import * as fs22 from "fs";
26584
+ import * as path30 from "path";
26314
26585
  function parseArgs7(args2) {
26315
26586
  return { autoConfirm: args2.includes("--yes") || args2.includes("-y") };
26316
26587
  }
@@ -26320,7 +26591,7 @@ function resolveHubTarget(workspaceDir, selector) {
26320
26591
  const allHubs = scanWorkspaceHubs(workspaceDir);
26321
26592
  if (selector !== void 0) {
26322
26593
  const match = allHubs.find(
26323
- (h) => h.hubId === selector || path29.basename(h.hubFolder) === selector
26594
+ (h) => h.hubId === selector || path30.basename(h.hubFolder) === selector
26324
26595
  );
26325
26596
  if (match) return { hubId: match.hubId, hubFolder: match.hubFolder };
26326
26597
  if (UUID_RE3.test(selector)) return { hubId: selector, hubFolder: null };
@@ -26339,7 +26610,7 @@ function resolveHubTarget(workspaceDir, selector) {
26339
26610
  }
26340
26611
  console.error(`Multiple hubs found in ${wsLabel}/. Pass --hub <uuid|folder-name> to choose, or run from inside a hub folder:`);
26341
26612
  for (const h of previewHubs) {
26342
- console.error(` ${path29.basename(h.hubFolder)} (${h.hubId})`);
26613
+ console.error(` ${path30.basename(h.hubFolder)} (${h.hubId})`);
26343
26614
  }
26344
26615
  process.exit(1);
26345
26616
  }
@@ -26388,7 +26659,7 @@ async function pullCommand(args2) {
26388
26659
  );
26389
26660
  let wroteFiles = false;
26390
26661
  if (!existingFolder && !resolveHubYamlPath(hubFolder)) {
26391
- fs21.mkdirSync(path29.dirname(hubFolder), { recursive: true });
26662
+ fs22.mkdirSync(path30.dirname(hubFolder), { recursive: true });
26392
26663
  console.log("Writing hub configuration...");
26393
26664
  await materializeHubFolder(hubFolder, payload);
26394
26665
  const finalFolder = autoRenameHubFolder(hubFolder, payload.hub.name, payload.hub_environment, payload.hub_id, payload.preview_label, payload.branch_name);
@@ -26474,7 +26745,7 @@ ${why}`);
26474
26745
  }
26475
26746
  async function writeProductionMirror2(workspaceDir, prodPayload) {
26476
26747
  const folder = resolveHubFolder(workspaceDir, prodPayload.hub_id, prodPayload.hub.name, "production", null, null);
26477
- fs21.mkdirSync(path29.dirname(folder), { recursive: true });
26748
+ fs22.mkdirSync(path30.dirname(folder), { recursive: true });
26478
26749
  await materializeHubFolder(folder, prodPayload, { seedAgentContext: false, readOnlyMirror: true });
26479
26750
  const finalFolder = autoRenameHubFolder(folder, prodPayload.hub.name, "production", prodPayload.hub_id, null, null);
26480
26751
  prependMirrorMarker(finalFolder, prodPayload.hub_id);
@@ -26490,13 +26761,13 @@ async function mirrorLinkedProduction2(client, workspaceDir, productionHubId, or
26490
26761
  }
26491
26762
  }
26492
26763
  function prependMirrorMarker(hubFolder, productionHubId) {
26493
- const hubYaml = path29.join(hubFolder, "hub.yaml");
26764
+ const hubYaml = path30.join(hubFolder, "hub.yaml");
26494
26765
  try {
26495
- const content = fs21.readFileSync(hubYaml, "utf-8");
26766
+ const content = fs22.readFileSync(hubYaml, "utf-8");
26496
26767
  if (content.startsWith(MIRROR_MARKER_PREFIX2)) return;
26497
26768
  const marker = `${MIRROR_MARKER_PREFIX2} ${productionHubId}. Edits are ignored; push is blocked. Edit the linked preview hub instead.
26498
26769
  `;
26499
- fs21.writeFileSync(hubYaml, marker + content, "utf-8");
26770
+ fs22.writeFileSync(hubYaml, marker + content, "utf-8");
26500
26771
  } catch {
26501
26772
  }
26502
26773
  }
@@ -26546,8 +26817,8 @@ __export(create_exports, {
26546
26817
  createCommand: () => createCommand,
26547
26818
  parseArgs: () => parseArgs8
26548
26819
  });
26549
- import * as path30 from "path";
26550
- import * as fs22 from "fs";
26820
+ import * as path31 from "path";
26821
+ import * as fs23 from "fs";
26551
26822
  function parseArgs8(args2) {
26552
26823
  let autoConfirm = false;
26553
26824
  let folderSelector;
@@ -26574,7 +26845,7 @@ async function createCommand(args2) {
26574
26845
  const gitRoot = findGitRoot();
26575
26846
  const wsLabel = hubsDirLabel(gitRoot);
26576
26847
  if (gitRoot) warnLayoutOnce(gitRoot);
26577
- if (!fs22.existsSync(workspaceDir)) {
26848
+ if (!fs23.existsSync(workspaceDir)) {
26578
26849
  console.error(`No ${wsLabel}/ directory found. Create hub files in ${wsLabel}/<hub>/hub.yaml with \`hub: { name: ... }\` first.`);
26579
26850
  process.exit(1);
26580
26851
  }
@@ -26583,7 +26854,7 @@ async function createCommand(args2) {
26583
26854
  const resolution = resolveNewHubForCreate(workspaceDir, existingHubs, newHubs, folderSelector);
26584
26855
  if (!resolution.ok) {
26585
26856
  if (resolution.reason === "exists") {
26586
- const folder = path30.basename(resolution.existing.hubFolder);
26857
+ const folder = path31.basename(resolution.existing.hubFolder);
26587
26858
  console.error(`Hub "${folder}" already exists (${resolution.existing.hubId}). Use \`wayai push --hub ${folder}\` to update it.`);
26588
26859
  process.exit(1);
26589
26860
  }
@@ -26597,7 +26868,7 @@ async function createCommand(args2) {
26597
26868
  }
26598
26869
  console.error(`Multiple new hub folders found in ${wsLabel}/. Pass the folder name (\`wayai create <folder>\`) or run from inside one:`);
26599
26870
  for (const h of newHubs) {
26600
- console.error(` ${path30.basename(h.hubFolder)} (new \u2014 "${h.hubName}")`);
26871
+ console.error(` ${path31.basename(h.hubFolder)} (new \u2014 "${h.hubName}")`);
26601
26872
  }
26602
26873
  process.exit(1);
26603
26874
  }
@@ -26709,8 +26980,8 @@ __export(replicate_exports, {
26709
26980
  parseArgs: () => parseArgs10,
26710
26981
  replicateCommand: () => replicateCommand
26711
26982
  });
26712
- import * as fs23 from "fs";
26713
- import * as path31 from "path";
26983
+ import * as fs24 from "fs";
26984
+ import * as path32 from "path";
26714
26985
  function parseArgs10(args2) {
26715
26986
  let label;
26716
26987
  let hubFlag;
@@ -26763,8 +27034,8 @@ async function replicateCommand(args2) {
26763
27034
  payload.preview_label,
26764
27035
  payload.branch_name
26765
27036
  );
26766
- const folderPreExisted = fs23.existsSync(hubFolder);
26767
- fs23.mkdirSync(path31.dirname(hubFolder), { recursive: true });
27037
+ const folderPreExisted = fs24.existsSync(hubFolder);
27038
+ fs24.mkdirSync(path32.dirname(hubFolder), { recursive: true });
26768
27039
  let delta;
26769
27040
  try {
26770
27041
  delta = await materializeHubFolder(hubFolder, payload);
@@ -26784,8 +27055,8 @@ async function replicateCommand(args2) {
26784
27055
  );
26785
27056
  seedScopeIfEmpty("hubs", previewHubId);
26786
27057
  if (folderPreExisted) printLocalFileChanges(delta);
26787
- console.log(`Preview written to ${path31.basename(hubFolder)}`);
26788
- console.log(` Switch to it with: wayai use ${path31.basename(hubFolder)}`);
27058
+ console.log(`Preview written to ${path32.basename(hubFolder)}`);
27059
+ console.log(` Switch to it with: wayai use ${path32.basename(hubFolder)}`);
26789
27060
  }
26790
27061
  var init_replicate = __esm({
26791
27062
  "src/commands/replicate.ts"() {
@@ -26812,7 +27083,7 @@ __export(relabel_exports, {
26812
27083
  parseArgs: () => parseArgs11,
26813
27084
  relabelCommand: () => relabelCommand
26814
27085
  });
26815
- import * as path32 from "path";
27086
+ import * as path33 from "path";
26816
27087
  function parseArgs11(args2) {
26817
27088
  let label;
26818
27089
  let clear = false;
@@ -26861,7 +27132,7 @@ async function relabelCommand(args2) {
26861
27132
  } else {
26862
27133
  console.error(`Multiple hubs found in ${wsLabel}/. Pass --hub <uuid|folder-name> to choose, or run from inside a hub folder:`);
26863
27134
  for (const h of previewHubs) {
26864
- console.error(` ${path32.basename(h.hubFolder)} (${h.hubId})`);
27135
+ console.error(` ${path33.basename(h.hubFolder)} (${h.hubId})`);
26865
27136
  }
26866
27137
  }
26867
27138
  process.exit(1);
@@ -26870,7 +27141,7 @@ async function relabelCommand(args2) {
26870
27141
  console.log("This is a read-only production mirror \u2014 production hubs have no preview label. Relabel the linked preview hub instead.");
26871
27142
  return;
26872
27143
  }
26873
- assertInScope("hubs", target.hubId, path32.basename(target.hubFolder));
27144
+ assertInScope("hubs", target.hubId, path33.basename(target.hubFolder));
26874
27145
  console.log(normalizedLabel ? `Setting preview label to "${normalizedLabel}"...` : "Clearing preview label...");
26875
27146
  const { data } = await client.relabelPreview(target.hubId, normalizedLabel);
26876
27147
  const row = data[0];
@@ -26886,7 +27157,7 @@ async function relabelCommand(args2) {
26886
27157
  );
26887
27158
  console.log(serverLabel ? `Preview label set to "${serverLabel}".` : "Preview label cleared.");
26888
27159
  if (finalFolder !== target.hubFolder) {
26889
- console.log(`Hub folder is now ${path32.basename(finalFolder)}`);
27160
+ console.log(`Hub folder is now ${path33.basename(finalFolder)}`);
26890
27161
  }
26891
27162
  }
26892
27163
  var init_relabel = __esm({
@@ -26914,7 +27185,7 @@ __export(publish_exports, {
26914
27185
  renderHubDiff: () => renderHubDiff,
26915
27186
  runPublish: () => runPublish
26916
27187
  });
26917
- import * as path33 from "path";
27188
+ import * as path34 from "path";
26918
27189
  function parseArgs12(args2) {
26919
27190
  let autoConfirm = false;
26920
27191
  let hubSelector;
@@ -27024,7 +27295,7 @@ async function publishCommand(args2) {
27024
27295
  return;
27025
27296
  }
27026
27297
  }
27027
- assertInScope("hubs", hubId, hubFolder ? path33.basename(hubFolder) : void 0);
27298
+ assertInScope("hubs", hubId, hubFolder ? path34.basename(hubFolder) : void 0);
27028
27299
  await runPublish(client, { hubId, localConfig, organizationId, autoConfirm });
27029
27300
  }
27030
27301
  var STATUS_STYLE, SECTION_TITLES;
@@ -27067,13 +27338,14 @@ var init_publish = __esm({
27067
27338
  message_templates: "Message templates",
27068
27339
  contact_lists: "Contact lists",
27069
27340
  automations: "Automations",
27341
+ pages: "Pages",
27070
27342
  evals: "Evals"
27071
27343
  };
27072
27344
  }
27073
27345
  });
27074
27346
 
27075
27347
  // src/lib/scope-selector.ts
27076
- import * as path34 from "path";
27348
+ import * as path35 from "path";
27077
27349
  function findAddFlag(args2) {
27078
27350
  return args2.find((arg) => arg === "--add" || arg.startsWith("--add="));
27079
27351
  }
@@ -27137,7 +27409,7 @@ function resolveHubSelectorToId(gitRoot, selector) {
27137
27409
  const match = findHubByFolderName(workspaceDir, selector);
27138
27410
  if (match) return match.hubId;
27139
27411
  const newHubs = scanNewHubs(workspaceDir);
27140
- const pending = newHubs.find((h) => path34.basename(h.hubFolder) === selector);
27412
+ const pending = newHubs.find((h) => path35.basename(h.hubFolder) === selector);
27141
27413
  if (pending) {
27142
27414
  throw expected(
27143
27415
  `"${selector}" is a new hub that hasn't been created on the platform yet, so it has no id to bind to.
@@ -27148,9 +27420,9 @@ Create it first \u2014 the worktree scope picks it up automatically afterward:
27148
27420
  throw expected(
27149
27421
  [
27150
27422
  `No hub matching "${selector}" found in ${hubsDirLabel(gitRoot)}/. Pass a UUID or a folder name from:`,
27151
- ...scanWorkspaceHubs(workspaceDir).map((h) => ` ${path34.basename(h.hubFolder)} (${h.hubId})`),
27423
+ ...scanWorkspaceHubs(workspaceDir).map((h) => ` ${path35.basename(h.hubFolder)} (${h.hubId})`),
27152
27424
  ...newHubs.map(
27153
- (h) => ` ${path34.basename(h.hubFolder)} (new \u2014 "${h.hubName}", run \`wayai create ${path34.basename(h.hubFolder)}\`)`
27425
+ (h) => ` ${path35.basename(h.hubFolder)} (new \u2014 "${h.hubName}", run \`wayai create ${path35.basename(h.hubFolder)}\`)`
27154
27426
  )
27155
27427
  ].join("\n")
27156
27428
  );
@@ -27240,11 +27512,11 @@ __export(migrate_exports, {
27240
27512
  migrateCommand: () => migrateCommand
27241
27513
  });
27242
27514
  import { execFileSync as execFileSync3 } from "child_process";
27243
- import * as fs24 from "fs";
27244
- import * as path35 from "path";
27515
+ import * as fs25 from "fs";
27516
+ import * as path36 from "path";
27245
27517
  function isTracked(gitRoot, p) {
27246
27518
  try {
27247
- execFileSync3("git", ["ls-files", "--error-unmatch", "--", path35.relative(gitRoot, p)], {
27519
+ execFileSync3("git", ["ls-files", "--error-unmatch", "--", path36.relative(gitRoot, p)], {
27248
27520
  cwd: gitRoot,
27249
27521
  stdio: ["pipe", "pipe", "pipe"]
27250
27522
  });
@@ -27254,10 +27526,10 @@ function isTracked(gitRoot, p) {
27254
27526
  }
27255
27527
  }
27256
27528
  function moveDir(gitRoot, from, to) {
27257
- fs24.mkdirSync(path35.dirname(to), { recursive: true });
27529
+ fs25.mkdirSync(path36.dirname(to), { recursive: true });
27258
27530
  if (isTracked(gitRoot, from)) {
27259
27531
  try {
27260
- execFileSync3("git", ["mv", path35.relative(gitRoot, from), path35.relative(gitRoot, to)], {
27532
+ execFileSync3("git", ["mv", path36.relative(gitRoot, from), path36.relative(gitRoot, to)], {
27261
27533
  cwd: gitRoot,
27262
27534
  stdio: ["pipe", "pipe", "pipe"]
27263
27535
  });
@@ -27265,7 +27537,7 @@ function moveDir(gitRoot, from, to) {
27265
27537
  } catch {
27266
27538
  }
27267
27539
  }
27268
- fs24.renameSync(from, to);
27540
+ fs25.renameSync(from, to);
27269
27541
  return "fs";
27270
27542
  }
27271
27543
  async function migrateCommand(_args) {
@@ -27274,12 +27546,12 @@ async function migrateCommand(_args) {
27274
27546
  console.error("Not inside a git repository.");
27275
27547
  process.exit(1);
27276
27548
  }
27277
- const rel = (p) => path35.relative(gitRoot, p);
27278
- const newWs = path35.join(gitRoot, WAYAI_LAYOUT.wsDir);
27279
- const legacyWs = path35.join(gitRoot, WAYAI_LAYOUT.legacy.wsDir);
27280
- const legacyOrg = path35.join(gitRoot, WAYAI_LAYOUT.legacy.orgAtRoot);
27281
- const newHubs = path35.join(newWs, WAYAI_LAYOUT.hubsSubdir);
27282
- const newOrg = path35.join(newWs, WAYAI_LAYOUT.orgSubdir);
27549
+ const rel = (p) => path36.relative(gitRoot, p);
27550
+ const newWs = path36.join(gitRoot, WAYAI_LAYOUT.wsDir);
27551
+ const legacyWs = path36.join(gitRoot, WAYAI_LAYOUT.legacy.wsDir);
27552
+ const legacyOrg = path36.join(gitRoot, WAYAI_LAYOUT.legacy.orgAtRoot);
27553
+ const newHubs = path36.join(newWs, WAYAI_LAYOUT.hubsSubdir);
27554
+ const newOrg = path36.join(newWs, WAYAI_LAYOUT.orgSubdir);
27283
27555
  requireRealSubdirNoSymlink(gitRoot, newHubs, false);
27284
27556
  requireRealSubdirNoSymlink(gitRoot, newOrg, false);
27285
27557
  readRealFileOrThrow(gitRoot, workspaceManifestPath(gitRoot));
@@ -27432,12 +27704,12 @@ var send_message_exports = {};
27432
27704
  __export(send_message_exports, {
27433
27705
  sendMessageCommand: () => sendMessageCommand
27434
27706
  });
27435
- import * as fs25 from "fs";
27436
- import * as path36 from "path";
27707
+ import * as fs26 from "fs";
27708
+ import * as path37 from "path";
27437
27709
  function statAttachment(filePath2) {
27438
27710
  let stat2;
27439
27711
  try {
27440
- stat2 = fs25.statSync(filePath2);
27712
+ stat2 = fs26.statSync(filePath2);
27441
27713
  } catch {
27442
27714
  console.error(`Error: file not found: ${filePath2}`);
27443
27715
  process.exit(1);
@@ -27449,11 +27721,11 @@ function statAttachment(filePath2) {
27449
27721
  return { filePath: filePath2, size: stat2.size };
27450
27722
  }
27451
27723
  function readAttachment(filePath2, size) {
27452
- const fileName = path36.basename(filePath2);
27453
- const ext = path36.extname(fileName).replace(/^\./, "");
27724
+ const fileName = path37.basename(filePath2);
27725
+ const ext = path37.extname(fileName).replace(/^\./, "");
27454
27726
  return {
27455
27727
  file_name: fileName,
27456
- file_binary: fs25.readFileSync(filePath2).toString("base64"),
27728
+ file_binary: fs26.readFileSync(filePath2).toString("base64"),
27457
27729
  file_size: size,
27458
27730
  ...ext && { file_extension: ext }
27459
27731
  };
@@ -27500,7 +27772,7 @@ async function sendMessageCommand(args2) {
27500
27772
  }
27501
27773
  const stats = filePaths.map(statAttachment);
27502
27774
  const filesTotal = stats.reduce((sum, s) => sum + base64Length(s.size), 0);
27503
- const fileDetail = () => stats.map((s) => `${path36.basename(s.filePath)} ${asMb(s.size)} MB`).join(", ");
27775
+ const fileDetail = () => stats.map((s) => `${path37.basename(s.filePath)} ${asMb(s.size)} MB`).join(", ");
27504
27776
  if (filesTotal > MAX_MESSAGE_BODY_BYTES) {
27505
27777
  console.error(
27506
27778
  `Error: ${fileDetail()} encode to ~${asMb(filesTotal)} MB, over the ${asMb(MAX_MESSAGE_BODY_BYTES)} MB per-request limit.`
@@ -27508,10 +27780,10 @@ async function sendMessageCommand(args2) {
27508
27780
  console.error("Base64 inflates a file by about a third, so ~7 MB of files is the practical ceiling.");
27509
27781
  process.exit(1);
27510
27782
  }
27511
- const audioStats = stats.filter((s) => isAudioAttachmentFileName(path36.basename(s.filePath)));
27783
+ const audioStats = stats.filter((s) => isAudioAttachmentFileName(path37.basename(s.filePath)));
27512
27784
  if (audioStats.length > 1) {
27513
27785
  console.error(
27514
- `Error: at most one audio file per message (got ${audioStats.length}: ${audioStats.map((s) => path36.basename(s.filePath)).join(", ")}).`
27786
+ `Error: at most one audio file per message (got ${audioStats.length}: ${audioStats.map((s) => path37.basename(s.filePath)).join(", ")}).`
27515
27787
  );
27516
27788
  console.error("Audio is transcribed via the hub's STT connection, and only one file per message is transcribed.");
27517
27789
  process.exit(1);
@@ -27519,7 +27791,7 @@ async function sendMessageCommand(args2) {
27519
27791
  const oversizeAudio = audioStats.find((s) => base64Length(s.size) > MAX_AUDIO_FILE_BASE64_BYTES);
27520
27792
  if (oversizeAudio) {
27521
27793
  console.error(
27522
- `Error: ${path36.basename(oversizeAudio.filePath)} (${asMb(oversizeAudio.size)} MB) is over the ~${asMb(MAX_AUDIO_FILE_BASE64_BYTES * 3 / 4)} MB audio limit for transcription.`
27794
+ `Error: ${path37.basename(oversizeAudio.filePath)} (${asMb(oversizeAudio.size)} MB) is over the ~${asMb(MAX_AUDIO_FILE_BASE64_BYTES * 3 / 4)} MB audio limit for transcription.`
27523
27795
  );
27524
27796
  process.exit(1);
27525
27797
  }
@@ -29554,7 +29826,7 @@ var init_eval_results = __esm({
29554
29826
  import { createHash as createHash4 } from "crypto";
29555
29827
  import { mkdirSync as mkdirSync12, readFileSync as readFileSync17, renameSync as renameSync5, writeFileSync as writeFileSync7 } from "fs";
29556
29828
  import { homedir as homedir5 } from "os";
29557
- import { dirname as dirname12, isAbsolute as isAbsolute2, join as join31, resolve as resolve10 } from "path";
29829
+ import { dirname as dirname12, isAbsolute as isAbsolute2, join as join32, resolve as resolve10 } from "path";
29558
29830
  function parseWav(buf, name = "clip") {
29559
29831
  if (buf.length < 12 || buf.toString("ascii", 0, 4) !== "RIFF" || buf.toString("ascii", 8, 12) !== "WAVE") {
29560
29832
  throw new Error(`${name} is not a WAV file.`);
@@ -29593,7 +29865,7 @@ function parseWav(buf, name = "clip") {
29593
29865
  throw new Error(`${name} holds no audio data.`);
29594
29866
  }
29595
29867
  function defaultClipCacheDir() {
29596
- return join31(homedir5(), ".wayai", "call-clips");
29868
+ return join32(homedir5(), ".wayai", "call-clips");
29597
29869
  }
29598
29870
  function pcmClip(buf) {
29599
29871
  const samples = new Int16Array(Math.floor(buf.length / 2));
@@ -29642,15 +29914,15 @@ var init_caller_audio = __esm({
29642
29914
  }
29643
29915
  describe;
29644
29916
  async clipFor(line) {
29645
- const path42 = line.clip ? isAbsolute2(line.clip) ? line.clip : resolve10(this.planDir, line.clip) : this.dir ? join31(this.dir, `${line.n}.wav`) : null;
29646
- if (!path42) throw new Error(`Line ${line.n} has no clip: give --clips <dir>, or a "clip" for it in the plan.`);
29917
+ const path43 = line.clip ? isAbsolute2(line.clip) ? line.clip : resolve10(this.planDir, line.clip) : this.dir ? join32(this.dir, `${line.n}.wav`) : null;
29918
+ if (!path43) throw new Error(`Line ${line.n} has no clip: give --clips <dir>, or a "clip" for it in the plan.`);
29647
29919
  let buf;
29648
29920
  try {
29649
- buf = readFileSync17(path42);
29921
+ buf = readFileSync17(path43);
29650
29922
  } catch {
29651
- throw new Error(`Line ${line.n}'s clip ${path42} cannot be read.`);
29923
+ throw new Error(`Line ${line.n}'s clip ${path43} cannot be read.`);
29652
29924
  }
29653
- return parseWav(buf, path42);
29925
+ return parseWav(buf, path43);
29654
29926
  }
29655
29927
  };
29656
29928
  OPENAI_PCM_SAMPLE_RATE = 24e3;
@@ -29677,20 +29949,20 @@ var init_caller_audio = __esm({
29677
29949
  const key = createHash4("sha256").update(`${this.model}
29678
29950
  ${this.voice}
29679
29951
  ${text2}`).digest("hex");
29680
- return join31(this.cacheDir, `${key}.pcm`);
29952
+ return join32(this.cacheDir, `${key}.pcm`);
29681
29953
  }
29682
29954
  clipFor(line) {
29683
- const path42 = this.cachePath(line.say);
29684
- let pending = this.inFlight.get(path42);
29955
+ const path43 = this.cachePath(line.say);
29956
+ let pending = this.inFlight.get(path43);
29685
29957
  if (!pending) {
29686
- pending = this.readOrSynthesize(line, path42);
29687
- this.inFlight.set(path42, pending);
29958
+ pending = this.readOrSynthesize(line, path43);
29959
+ this.inFlight.set(path43, pending);
29688
29960
  }
29689
29961
  return pending;
29690
29962
  }
29691
- async readOrSynthesize(line, path42) {
29963
+ async readOrSynthesize(line, path43) {
29692
29964
  try {
29693
- return pcmClip(readFileSync17(path42));
29965
+ return pcmClip(readFileSync17(path43));
29694
29966
  } catch {
29695
29967
  }
29696
29968
  const res = await this.doFetch("https://api.openai.com/v1/audio/speech", {
@@ -29704,10 +29976,10 @@ ${text2}`).digest("hex");
29704
29976
  }
29705
29977
  const buf = Buffer.from(await res.arrayBuffer());
29706
29978
  if (buf.length < 2) throw new Error(`OpenAI speech synthesis returned no audio for line ${line.n}.`);
29707
- mkdirSync12(dirname12(path42), { recursive: true });
29708
- const tmp = `${path42}.${process.pid}.tmp`;
29979
+ mkdirSync12(dirname12(path43), { recursive: true });
29980
+ const tmp = `${path43}.${process.pid}.tmp`;
29709
29981
  writeFileSync7(tmp, buf);
29710
- renameSync5(tmp, path42);
29982
+ renameSync5(tmp, path43);
29711
29983
  return pcmClip(buf);
29712
29984
  }
29713
29985
  };
@@ -31272,15 +31544,15 @@ function parseEvalCallArgs(args2) {
31272
31544
  if (parsed.jsonPath) checkReportPath(parsed.jsonPath);
31273
31545
  return parsed;
31274
31546
  }
31275
- function checkReportPath(path42) {
31276
- const target = resolve11(path42);
31547
+ function checkReportPath(path43) {
31548
+ const target = resolve11(path43);
31277
31549
  const dir = dirname13(target);
31278
- if (!existsSync16(dir) || !statSync8(dir).isDirectory()) fail(`--json ${path42}: the folder ${dir} does not exist.`);
31279
- if (existsSync16(target) && statSync8(target).isDirectory()) fail(`--json ${path42} is a folder; name a file.`);
31550
+ if (!existsSync16(dir) || !statSync8(dir).isDirectory()) fail(`--json ${path43}: the folder ${dir} does not exist.`);
31551
+ if (existsSync16(target) && statSync8(target).isDirectory()) fail(`--json ${path43} is a folder; name a file.`);
31280
31552
  try {
31281
31553
  accessSync(existsSync16(target) ? target : dir, fsConstants.W_OK);
31282
31554
  } catch {
31283
- fail(`--json ${path42} cannot be written here.`);
31555
+ fail(`--json ${path43} cannot be written here.`);
31284
31556
  }
31285
31557
  }
31286
31558
  function suiteExitCode(report2, runs, reportWritten) {
@@ -31490,9 +31762,9 @@ var eval_capture_exports = {};
31490
31762
  __export(eval_capture_exports, {
31491
31763
  evalCaptureCommand: () => evalCaptureCommand
31492
31764
  });
31493
- import * as fs26 from "fs";
31494
- import * as path37 from "path";
31495
- import * as yaml15 from "js-yaml";
31765
+ import * as fs27 from "fs";
31766
+ import * as path38 from "path";
31767
+ import * as yaml16 from "js-yaml";
31496
31768
  function isValidSetName(name) {
31497
31769
  if (name.length === 0 || name === "." || name === "..") return false;
31498
31770
  if (name.startsWith(".")) return false;
@@ -31557,25 +31829,25 @@ async function evalCaptureCommand(args2) {
31557
31829
  const setFolderName = targetSetName;
31558
31830
  const scenarioName = parsed.evalName ?? `Capture ${parsed.conversationId.slice(0, 8)}`;
31559
31831
  const slug = slugify2(scenarioName);
31560
- const evalsDir = path37.join(hubFolder, "evals");
31561
- const targetDir = path37.join(evalsDir, setFolderName);
31562
- const targetPath = path37.join(targetDir, `${slug}.yaml`);
31563
- if (!targetPath.startsWith(evalsDir + path37.sep)) {
31564
- console.error(`Resolved path "${path37.relative(hubFolder, targetPath)}" escapes evals/. Aborting.`);
31832
+ const evalsDir = path38.join(hubFolder, "evals");
31833
+ const targetDir = path38.join(evalsDir, setFolderName);
31834
+ const targetPath = path38.join(targetDir, `${slug}.yaml`);
31835
+ if (!targetPath.startsWith(evalsDir + path38.sep)) {
31836
+ console.error(`Resolved path "${path38.relative(hubFolder, targetPath)}" escapes evals/. Aborting.`);
31565
31837
  process.exit(1);
31566
31838
  }
31567
31839
  if (!ensureRealSubdirNoSymlink(hubFolder, targetDir, false)) {
31568
- console.error(`${path37.relative(hubFolder, targetDir)} is reached through a symlink. Aborting.`);
31840
+ console.error(`${path38.relative(hubFolder, targetDir)} is reached through a symlink. Aborting.`);
31569
31841
  process.exit(1);
31570
31842
  }
31571
31843
  let targetTaken = true;
31572
31844
  try {
31573
- fs26.lstatSync(targetPath);
31845
+ fs27.lstatSync(targetPath);
31574
31846
  } catch {
31575
31847
  targetTaken = false;
31576
31848
  }
31577
31849
  if (targetTaken) {
31578
- console.error(`File already exists: ${path37.relative(hubFolder, targetPath)}. Use --name to choose a different name.`);
31850
+ console.error(`File already exists: ${path38.relative(hubFolder, targetPath)}. Use --name to choose a different name.`);
31579
31851
  process.exit(1);
31580
31852
  }
31581
31853
  console.log("Resolving scenario set...");
@@ -31607,14 +31879,14 @@ async function evalCaptureCommand(args2) {
31607
31879
  ...captured.evaluator_instructions ? { evaluator_instructions: captured.evaluator_instructions } : {}
31608
31880
  };
31609
31881
  const yamlObj = buildEvalYamlObject(evalEntry, slug);
31610
- const outcome = createFileNoFollow(hubFolder, targetPath, Buffer.from(yaml15.dump(yamlObj, YAML_DUMP_OPTIONS), "utf-8"));
31882
+ const outcome = createFileNoFollow(hubFolder, targetPath, Buffer.from(yaml16.dump(yamlObj, YAML_DUMP_OPTIONS), "utf-8"));
31611
31883
  if (outcome !== "created") {
31612
31884
  console.error(
31613
- `Could not write ${path37.relative(hubFolder, targetPath)} (${outcome === "exists" ? "it appeared meanwhile" : "its folder is reached through a symlink"}). The scenario was created on the platform as ${captured.eval_id} \u2014 run \`wayai pull\` to fetch it.`
31885
+ `Could not write ${path38.relative(hubFolder, targetPath)} (${outcome === "exists" ? "it appeared meanwhile" : "its folder is reached through a symlink"}). The scenario was created on the platform as ${captured.eval_id} \u2014 run \`wayai pull\` to fetch it.`
31614
31886
  );
31615
31887
  process.exit(1);
31616
31888
  }
31617
- const relPath = path37.relative(process.cwd(), targetPath);
31889
+ const relPath = path38.relative(process.cwd(), targetPath);
31618
31890
  console.log(`
31619
31891
  Wrote ${relPath}`);
31620
31892
  console.log("Run `wayai pull` to refresh the agent display name, then commit. The scenario is already on the platform.");
@@ -33001,41 +33273,41 @@ var init_set_connection_credential = __esm({
33001
33273
  });
33002
33274
 
33003
33275
  // src/lib/org-workspace.ts
33004
- import * as fs27 from "fs";
33005
- import * as path38 from "path";
33006
- import * as yaml16 from "js-yaml";
33276
+ import * as fs28 from "fs";
33277
+ import * as path39 from "path";
33278
+ import * as yaml17 from "js-yaml";
33007
33279
  function getOrgDir(gitRoot) {
33008
33280
  return resolveLayout(gitRoot).orgDir;
33009
33281
  }
33010
33282
  function orgManifestExists(orgDir) {
33011
- return fs27.existsSync(path38.join(orgDir, ORG_MANIFEST_NAME)) || fs27.existsSync(path38.join(orgDir, OLD_ORG_MANIFEST_NAME));
33283
+ return fs28.existsSync(path39.join(orgDir, ORG_MANIFEST_NAME)) || fs28.existsSync(path39.join(orgDir, OLD_ORG_MANIFEST_NAME));
33012
33284
  }
33013
33285
  function orgDirInOldLayout(orgDir) {
33014
- return fs27.existsSync(path38.join(orgDir, OLD_ORG_MANIFEST_NAME)) || fs27.existsSync(path38.join(orgDir, OLD_RESOURCES_DIR));
33286
+ return fs28.existsSync(path39.join(orgDir, OLD_ORG_MANIFEST_NAME)) || fs28.existsSync(path39.join(orgDir, OLD_RESOURCES_DIR));
33015
33287
  }
33016
33288
  function assertOrgDirConvertible(orgDir, payload) {
33017
33289
  assertDistinctSkillFolders(payload.skills ?? []);
33018
33290
  assertOldLayoutConvertible(orgDir, payload.skills ?? [], orgDirInOldLayout(orgDir), "wayai org pull");
33019
33291
  }
33020
33292
  function parseOrgSkills(orgDir, opts = {}) {
33021
- const oldParts = [OLD_ORG_MANIFEST_NAME, `${OLD_RESOURCES_DIR}/`].filter((name) => fs27.existsSync(path38.join(orgDir, name)));
33293
+ const oldParts = [OLD_ORG_MANIFEST_NAME, `${OLD_RESOURCES_DIR}/`].filter((name) => fs28.existsSync(path39.join(orgDir, name)));
33022
33294
  if (oldParts.length > 0 && !opts.readOldLayout) {
33023
33295
  throw expected(
33024
- `${path38.basename(orgDir)}/ is in the old layout (${oldParts.join(", ")}): resources are skills now. Run \`wayai org pull\` to convert it (${ORG_MANIFEST_NAME}, each skill's files under ${SKILLS_DIR}/<skill_name>/), then push again. Nothing was sent.`
33296
+ `${path39.basename(orgDir)}/ is in the old layout (${oldParts.join(", ")}): resources are skills now. Run \`wayai org pull\` to convert it (${ORG_MANIFEST_NAME}, each skill's files under ${SKILLS_DIR}/<skill_name>/), then push again. Nothing was sent.`
33025
33297
  );
33026
33298
  }
33027
- const hasManifest = fs27.existsSync(path38.join(orgDir, ORG_MANIFEST_NAME));
33028
- const hasOldManifest = fs27.existsSync(path38.join(orgDir, OLD_ORG_MANIFEST_NAME));
33299
+ const hasManifest = fs28.existsSync(path39.join(orgDir, ORG_MANIFEST_NAME));
33300
+ const hasOldManifest = fs28.existsSync(path39.join(orgDir, OLD_ORG_MANIFEST_NAME));
33029
33301
  if (hasManifest && hasOldManifest) {
33030
33302
  throw expected(
33031
- `${path38.basename(orgDir)}/ holds both ${ORG_MANIFEST_NAME} and ${OLD_ORG_MANIFEST_NAME}: name the skills in ${ORG_MANIFEST_NAME} only.`
33303
+ `${path39.basename(orgDir)}/ holds both ${ORG_MANIFEST_NAME} and ${OLD_ORG_MANIFEST_NAME}: name the skills in ${ORG_MANIFEST_NAME} only.`
33032
33304
  );
33033
33305
  }
33034
33306
  const old = hasOldManifest;
33035
- const root = path38.join(orgDir, old ? OLD_RESOURCES_DIR : SKILLS_DIR);
33307
+ const root = path39.join(orgDir, old ? OLD_RESOURCES_DIR : SKILLS_DIR);
33036
33308
  requireRealSubdirNoSymlink(orgDir, root, false);
33037
- const manifestText = readRealFileOrThrow(orgDir, path38.join(orgDir, old ? OLD_ORG_MANIFEST_NAME : ORG_MANIFEST_NAME));
33038
- const manifest = (manifestText !== null ? yaml16.load(manifestText) : null) ?? {};
33309
+ const manifestText = readRealFileOrThrow(orgDir, path39.join(orgDir, old ? OLD_ORG_MANIFEST_NAME : ORG_MANIFEST_NAME));
33310
+ const manifest = (manifestText !== null ? yaml17.load(manifestText) : null) ?? {};
33039
33311
  const section = old ? manifest.resources : manifest.skills;
33040
33312
  const entries = Array.isArray(section) ? section : [];
33041
33313
  const skills = entries.map((entry) => {
@@ -33048,9 +33320,9 @@ function parseOrgSkills(orgDir, opts = {}) {
33048
33320
  if (entry.environment) skill.environment = entry.environment;
33049
33321
  if (Array.isArray(entry.tags)) skill.tags = entry.tags;
33050
33322
  if (Array.isArray(entry.folders)) skill.folders = entry.folders;
33051
- const dir = path38.join(root, old ? oldResourceFolder(skill) : skillFolder(skill));
33323
+ const dir = path39.join(root, old ? oldResourceFolder(skill) : skillFolder(skill));
33052
33324
  requireRealSubdirNoSymlink(orgDir, dir, false);
33053
- if (fs27.existsSync(dir)) {
33325
+ if (fs28.existsSync(dir)) {
33054
33326
  const files = scanResourceFiles(dir, "");
33055
33327
  if (files.length > 0) skill.files = files;
33056
33328
  }
@@ -33062,8 +33334,8 @@ function parseOrgSkills(orgDir, opts = {}) {
33062
33334
  function writeOrgSkills(orgDir, payload) {
33063
33335
  const skills = payload.skills ?? [];
33064
33336
  assertOrgDirConvertible(orgDir, payload);
33065
- fs27.mkdirSync(orgDir, { recursive: true });
33066
- const skillsDir = path38.join(orgDir, SKILLS_DIR);
33337
+ fs28.mkdirSync(orgDir, { recursive: true });
33338
+ const skillsDir = path39.join(orgDir, SKILLS_DIR);
33067
33339
  requireRealSubdirNoSymlink(orgDir, skillsDir, false);
33068
33340
  const manifestSkills = skills.map((r) => {
33069
33341
  const { files: _files, ...rest } = r;
@@ -33071,31 +33343,31 @@ function writeOrgSkills(orgDir, payload) {
33071
33343
  });
33072
33344
  writeFileNoFollow(
33073
33345
  orgDir,
33074
- path38.join(orgDir, ORG_MANIFEST_NAME),
33075
- Buffer.from(yaml16.dump({ version: 1, skills: manifestSkills }, YAML_DUMP_OPTIONS), "utf-8")
33346
+ path39.join(orgDir, ORG_MANIFEST_NAME),
33347
+ Buffer.from(yaml17.dump({ version: 1, skills: manifestSkills }, YAML_DUMP_OPTIONS), "utf-8")
33076
33348
  );
33077
33349
  const currentFolders = /* @__PURE__ */ new Set();
33078
33350
  for (const skill of skills) {
33079
33351
  const folder = skillFolder(skill);
33080
33352
  currentFolders.add(folder);
33081
- writeResourceFileTree(path38.join(skillsDir, folder), skill.files || [], orgDir);
33353
+ writeResourceFileTree(path39.join(skillsDir, folder), skill.files || [], orgDir);
33082
33354
  }
33083
- if (fs27.existsSync(skillsDir)) {
33084
- for (const entry of fs27.readdirSync(skillsDir, { withFileTypes: true })) {
33355
+ if (fs28.existsSync(skillsDir)) {
33356
+ for (const entry of fs28.readdirSync(skillsDir, { withFileTypes: true })) {
33085
33357
  if (entry.isDirectory() && !currentFolders.has(entry.name)) {
33086
- fs27.rmSync(path38.join(skillsDir, entry.name), { recursive: true, force: true });
33358
+ fs28.rmSync(path39.join(skillsDir, entry.name), { recursive: true, force: true });
33087
33359
  }
33088
33360
  }
33089
33361
  }
33090
33362
  removeConvertedOldResources(orgDir, skills);
33091
- const oldManifest = path38.join(orgDir, OLD_ORG_MANIFEST_NAME);
33092
- if (fs27.existsSync(oldManifest)) fs27.unlinkSync(oldManifest);
33363
+ const oldManifest = path39.join(orgDir, OLD_ORG_MANIFEST_NAME);
33364
+ if (fs28.existsSync(oldManifest)) fs28.unlinkSync(oldManifest);
33093
33365
  }
33094
33366
  async function downloadOrgBinaryFiles(orgDir, payload) {
33095
33367
  let count = 0;
33096
33368
  for (const skill of payload.skills ?? []) {
33097
33369
  if (!skill.files) continue;
33098
- const dir = path38.join(orgDir, SKILLS_DIR, skillFolder(skill));
33370
+ const dir = path39.join(orgDir, SKILLS_DIR, skillFolder(skill));
33099
33371
  count += await downloadBinaryFiles(dir, skill.files, orgDir);
33100
33372
  }
33101
33373
  if (count > 0) console.log(`Downloaded ${count} binary skill file(s).`);
@@ -34290,8 +34562,8 @@ var init_headers = __esm({
34290
34562
  });
34291
34563
 
34292
34564
  // src/data/files-sync/local.ts
34293
- import * as fs28 from "fs";
34294
- import * as path39 from "path";
34565
+ import * as fs29 from "fs";
34566
+ import * as path40 from "path";
34295
34567
  function foldSegment(segment) {
34296
34568
  return segment.normalize("NFC").toLowerCase().replace(/[. ]+$/, "");
34297
34569
  }
@@ -34319,7 +34591,7 @@ function remotePath(folder, rel) {
34319
34591
  return folder ? `${folder}/${rel}` : rel;
34320
34592
  }
34321
34593
  function defaultDir(fileType, folder) {
34322
- return path39.join(fileType, ...folder ? folder.split("/") : []);
34594
+ return path40.join(fileType, ...folder ? folder.split("/") : []);
34323
34595
  }
34324
34596
  function describeSync(r) {
34325
34597
  const where = r.folder ? `folder "${r.folder}"` : "the whole file type";
@@ -34382,7 +34654,7 @@ function assertPushable(folder, rels, platform2 = process.platform) {
34382
34654
  }
34383
34655
  function syncDirExists(dir) {
34384
34656
  try {
34385
- fs28.lstatSync(dir);
34657
+ fs29.lstatSync(dir);
34386
34658
  return true;
34387
34659
  } catch {
34388
34660
  return false;
@@ -34390,13 +34662,13 @@ function syncDirExists(dir) {
34390
34662
  }
34391
34663
  function ensureSyncDir(dir) {
34392
34664
  if (!syncDirExists(dir)) {
34393
- fs28.mkdirSync(dir, { recursive: true });
34665
+ fs29.mkdirSync(dir, { recursive: true });
34394
34666
  return;
34395
34667
  }
34396
- if (!fs28.lstatSync(dir).isDirectory()) throw symlinkRefusal(dir, "directory");
34668
+ if (!fs29.lstatSync(dir).isDirectory()) throw symlinkRefusal(dir, "directory");
34397
34669
  }
34398
34670
  function readRecord(dir) {
34399
- const text2 = readRealFileOrThrow(dir, path39.join(dir, RECORD_FILE));
34671
+ const text2 = readRealFileOrThrow(dir, path40.join(dir, RECORD_FILE));
34400
34672
  if (text2 === null) return null;
34401
34673
  let parsed;
34402
34674
  try {
@@ -34406,7 +34678,7 @@ function readRecord(dir) {
34406
34678
  }
34407
34679
  if (!isRecord3(parsed)) {
34408
34680
  throw expected(
34409
- `${path39.join(dir, RECORD_FILE)} is not a record \`wayai files pull\` wrote. Restore it from version control, or move the folder aside and pull again.`
34681
+ `${path40.join(dir, RECORD_FILE)} is not a record \`wayai files pull\` wrote. Restore it from version control, or move the folder aside and pull again.`
34410
34682
  );
34411
34683
  }
34412
34684
  return parsed;
@@ -34426,16 +34698,16 @@ function writeRecord(dir, record) {
34426
34698
  for (const rel of Object.keys(record.files).sort()) files[rel] = syncedFile(record.files[rel]);
34427
34699
  const body = `${JSON.stringify({ base: record.base, file_type: record.file_type, folder: record.folder, files }, null, 2)}
34428
34700
  `;
34429
- const tmp = path39.join(dir, `${RECORD_FILE}.tmp`);
34701
+ const tmp = path40.join(dir, `${RECORD_FILE}.tmp`);
34430
34702
  if (!writeFileNoFollow(dir, tmp, Buffer.from(body, "utf-8"))) throw symlinkRefusal(tmp, "file");
34431
- fs28.renameSync(tmp, path39.join(dir, RECORD_FILE));
34703
+ fs29.renameSync(tmp, path40.join(dir, RECORD_FILE));
34432
34704
  }
34433
34705
  function syncedFile(f) {
34434
34706
  return { version: f.version, content_sha256: f.content_sha256 };
34435
34707
  }
34436
34708
  function readLocal(dir, rel) {
34437
- const bytes = readFileNoFollow(dir, path39.join(dir, ...rel.split("/")));
34438
- if (!bytes) throw symlinkRefusal(path39.join(dir, rel), "file");
34709
+ const bytes = readFileNoFollow(dir, path40.join(dir, ...rel.split("/")));
34710
+ if (!bytes) throw symlinkRefusal(path40.join(dir, rel), "file");
34439
34711
  return bytes;
34440
34712
  }
34441
34713
  function scanLocal(dir) {
@@ -34443,22 +34715,22 @@ function scanLocal(dir) {
34443
34715
  if (!syncDirExists(dir)) return out;
34444
34716
  ensureSyncDir(dir);
34445
34717
  const walk = (absDir, relDir) => {
34446
- for (const name of fs28.readdirSync(absDir).sort()) {
34718
+ for (const name of fs29.readdirSync(absDir).sort()) {
34447
34719
  const rel = relDir ? `${relDir}/${name}` : name;
34448
34720
  if (foldSegment(name) === ".git") {
34449
34721
  throw expected(
34450
- `${sanitizeTerminalText(path39.join(dir, rel))} is a git repository inside the synced folder, which files pull and push do not sync into. Sync into a folder of its own \u2014 a folder inside a repository is fine; a repository's root, or a folder holding one, is not.`
34722
+ `${sanitizeTerminalText(path40.join(dir, rel))} is a git repository inside the synced folder, which files pull and push do not sync into. Sync into a folder of its own \u2014 a folder inside a repository is fine; a repository's root, or a folder holding one, is not.`
34451
34723
  );
34452
34724
  }
34453
34725
  if (isOutsideSync(rel)) continue;
34454
- const st = fs28.lstatSync(path39.join(absDir, name));
34726
+ const st = fs29.lstatSync(path40.join(absDir, name));
34455
34727
  if (st.isDirectory()) {
34456
- walk(path39.join(absDir, name), rel);
34728
+ walk(path40.join(absDir, name), rel);
34457
34729
  } else if (st.isFile()) {
34458
34730
  const bytes = readLocal(dir, rel);
34459
34731
  out.set(rel, { rel, content_sha256: computeHash(bytes), size: bytes.length });
34460
34732
  } else {
34461
- throw symlinkRefusal(path39.join(dir, rel), "file or folder");
34733
+ throw symlinkRefusal(path40.join(dir, rel), "file or folder");
34462
34734
  }
34463
34735
  }
34464
34736
  };
@@ -34466,7 +34738,7 @@ function scanLocal(dir) {
34466
34738
  return out;
34467
34739
  }
34468
34740
  function matchesScan(dir, rel, scanned) {
34469
- const abs = path39.join(dir, ...rel.split("/"));
34741
+ const abs = path40.join(dir, ...rel.split("/"));
34470
34742
  if (!syncDirExists(abs)) return scanned === void 0;
34471
34743
  if (scanned === void 0) return false;
34472
34744
  const bytes = readFileNoFollow(dir, abs);
@@ -34474,27 +34746,27 @@ function matchesScan(dir, rel, scanned) {
34474
34746
  }
34475
34747
  function writeLocal(dir, rel, bytes) {
34476
34748
  const data = Buffer.from(bytes.buffer, bytes.byteOffset, bytes.byteLength);
34477
- if (!writeFileNoFollow(dir, path39.join(dir, ...rel.split("/")), data)) {
34478
- throw symlinkRefusal(path39.join(dir, rel), "file");
34749
+ if (!writeFileNoFollow(dir, path40.join(dir, ...rel.split("/")), data)) {
34750
+ throw symlinkRefusal(path40.join(dir, rel), "file");
34479
34751
  }
34480
34752
  }
34481
34753
  function removeLocal(dir, rel) {
34482
- const abs = path39.join(dir, ...rel.split("/"));
34483
- requireRealSubdirNoSymlink(dir, path39.dirname(abs), false);
34754
+ const abs = path40.join(dir, ...rel.split("/"));
34755
+ requireRealSubdirNoSymlink(dir, path40.dirname(abs), false);
34484
34756
  let st;
34485
34757
  try {
34486
- st = fs28.lstatSync(abs);
34758
+ st = fs29.lstatSync(abs);
34487
34759
  } catch {
34488
34760
  return;
34489
34761
  }
34490
- if (!st.isFile()) throw symlinkRefusal(path39.join(dir, rel), "file");
34491
- fs28.rmSync(abs);
34492
- const root = path39.resolve(dir);
34493
- for (let parent = path39.dirname(path39.resolve(abs)); parent !== root && isUnder(root, parent); parent = path39.dirname(parent)) {
34494
- const names = fs28.readdirSync(parent);
34762
+ if (!st.isFile()) throw symlinkRefusal(path40.join(dir, rel), "file");
34763
+ fs29.rmSync(abs);
34764
+ const root = path40.resolve(dir);
34765
+ for (let parent = path40.dirname(path40.resolve(abs)); parent !== root && isUnder(root, parent); parent = path40.dirname(parent)) {
34766
+ const names = fs29.readdirSync(parent);
34495
34767
  if (names.some((n) => n !== ".DS_Store")) break;
34496
- for (const n of names) fs28.rmSync(path39.join(parent, n));
34497
- fs28.rmdirSync(parent);
34768
+ for (const n of names) fs29.rmSync(path40.join(parent, n));
34769
+ fs29.rmdirSync(parent);
34498
34770
  }
34499
34771
  }
34500
34772
  function diskClash(dir, rel) {
@@ -34503,7 +34775,7 @@ function diskClash(dir, rel) {
34503
34775
  for (let i = 0; i < segments.length; i++) {
34504
34776
  let names;
34505
34777
  try {
34506
- names = fs28.readdirSync(abs);
34778
+ names = fs29.readdirSync(abs);
34507
34779
  } catch {
34508
34780
  return void 0;
34509
34781
  }
@@ -34511,8 +34783,8 @@ function diskClash(dir, rel) {
34511
34783
  const twin = names.find((n) => n !== segments[i] && foldSegment(n) === want);
34512
34784
  if (twin !== void 0) return { reason: "case_twin", other: [...segments.slice(0, i), twin].join("/") };
34513
34785
  if (!names.includes(segments[i])) return void 0;
34514
- abs = path39.join(abs, segments[i]);
34515
- const isDir = fs28.lstatSync(abs).isDirectory();
34786
+ abs = path40.join(abs, segments[i]);
34787
+ const isDir = fs29.lstatSync(abs).isDirectory();
34516
34788
  const here = segments.slice(0, i + 1).join("/");
34517
34789
  if (i < segments.length - 1 && !isDir) return { reason: "file_folder", other: here };
34518
34790
  if (i === segments.length - 1 && isDir) return { reason: "file_folder", other: `${here}/` };
@@ -34701,25 +34973,25 @@ var init_plan = __esm({
34701
34973
  constructor(paths = []) {
34702
34974
  for (const p of paths) this.add(p);
34703
34975
  }
34704
- add(path42) {
34705
- this.cases.add(path42);
34706
- this.files.add(path42);
34707
- const segments = path42.split("/");
34976
+ add(path43) {
34977
+ this.cases.add(path43);
34978
+ this.files.add(path43);
34979
+ const segments = path43.split("/");
34708
34980
  for (let i = 1; i < segments.length; i++) {
34709
34981
  const folder = segments.slice(0, i).join("/");
34710
- if (!this.folders.has(folder)) this.folders.set(folder, path42);
34982
+ if (!this.folders.has(folder)) this.folders.set(folder, path43);
34711
34983
  }
34712
34984
  }
34713
34985
  /** The path `path` would collide with, and how; undefined when it collides with none. */
34714
- clash(path42) {
34715
- const twin = this.cases.twinOf(path42);
34986
+ clash(path43) {
34987
+ const twin = this.cases.twinOf(path43);
34716
34988
  if (twin !== void 0) return { reason: "case_twin", other: twin };
34717
- const segments = path42.split("/");
34989
+ const segments = path43.split("/");
34718
34990
  for (let i = 1; i < segments.length; i++) {
34719
34991
  const folder = segments.slice(0, i).join("/");
34720
34992
  if (this.files.has(folder)) return { reason: "file_folder", other: folder };
34721
34993
  }
34722
- const inside = this.folders.get(path42);
34994
+ const inside = this.folders.get(path43);
34723
34995
  return inside === void 0 ? void 0 : { reason: "file_folder", other: inside };
34724
34996
  }
34725
34997
  };
@@ -34741,9 +35013,9 @@ async function openRemote2() {
34741
35013
  )
34742
35014
  });
34743
35015
  return {
34744
- request: (method, path42, body, headers) => pacer.run(() => client.request(method, path42, body, headers)),
34745
- upload: (path42, bytes, contentType, headers) => pacer.run(() => client.upload(path42, bytes, contentType, headers)),
34746
- download: (path42) => pacer.run(() => client.download(path42))
35016
+ request: (method, path43, body, headers) => pacer.run(() => client.request(method, path43, body, headers)),
35017
+ upload: (path43, bytes, contentType, headers) => pacer.run(() => client.upload(path43, bytes, contentType, headers)),
35018
+ download: (path43) => pacer.run(() => client.download(path43))
34747
35019
  };
34748
35020
  }
34749
35021
  function filesRoot(t) {
@@ -34876,13 +35148,13 @@ async function pullFiles(opts) {
34876
35148
  conflicts.push({ rel: w.rel, ...clash });
34877
35149
  continue;
34878
35150
  }
34879
- const path42 = filePath(target, w.rel);
35151
+ const path43 = filePath(target, w.rel);
34880
35152
  let bytes;
34881
35153
  let version = w.remote.version;
34882
35154
  try {
34883
- bytes = (await client.download(path42)).bytes;
35155
+ bytes = (await client.download(path43)).bytes;
34884
35156
  if (computeHash(bytes) !== w.remote.content_sha256) {
34885
- const meta = await client.request("GET", `${path42}?meta=1`);
35157
+ const meta = await client.request("GET", `${path43}?meta=1`);
34886
35158
  if (meta?.content_sha256 !== computeHash(bytes)) {
34887
35159
  changedWhilePulling.push(w.rel);
34888
35160
  continue;
@@ -35011,7 +35283,7 @@ Push ${n} change${n === 1 ? "" : "s"} to ${describeSync(target)}?`, opts.yes)) {
35011
35283
  let pushed = 0;
35012
35284
  const refusedDeletes = /* @__PURE__ */ new Set();
35013
35285
  for (const step of plan.steps) {
35014
- const path42 = filePath(target, step.rel);
35286
+ const path43 = filePath(target, step.rel);
35015
35287
  const blockedBy = step.op === "create" ? step.after?.find((d) => refusedDeletes.has(d.rel)) : void 0;
35016
35288
  if (blockedBy !== void 0) {
35017
35289
  const conflict = { rel: step.rel, reason: blockedBy.reason, other: blockedBy.rel };
@@ -35021,7 +35293,7 @@ Push ${n} change${n === 1 ? "" : "s"} to ${describeSync(target)}?`, opts.yes)) {
35021
35293
  }
35022
35294
  try {
35023
35295
  if (step.op === "delete") {
35024
- await client.request("DELETE", path42, void 0, fileWriteHeaders({ ifMatch: step.ifMatch }));
35296
+ await client.request("DELETE", path43, void 0, fileWriteHeaders({ ifMatch: step.ifMatch }));
35025
35297
  delete record.files[step.rel];
35026
35298
  } else {
35027
35299
  const bytes = readLocal(dir, step.rel);
@@ -35030,7 +35302,7 @@ Push ${n} change${n === 1 ? "" : "s"} to ${describeSync(target)}?`, opts.yes)) {
35030
35302
  }
35031
35303
  const contentType = step.op === "update" ? step.remote.content_type : guessMimeType(step.rel) ?? "application/octet-stream";
35032
35304
  const row = await client.upload(
35033
- path42,
35305
+ path43,
35034
35306
  bytes,
35035
35307
  contentType,
35036
35308
  fileWriteHeaders({ ...step.op === "update" ? { ifMatch: step.ifMatch } : { createOnly: true }, label })
@@ -35297,8 +35569,8 @@ refresh-preview: make the knowledge base's preview hold its production base's fi
35297
35569
  });
35298
35570
 
35299
35571
  // src/lib/file-map.ts
35300
- import * as fs29 from "fs";
35301
- import * as path40 from "path";
35572
+ import * as fs30 from "fs";
35573
+ import * as path41 from "path";
35302
35574
  function isSafeRelPath(rel) {
35303
35575
  if (rel.length === 0 || rel.length > 300) return false;
35304
35576
  if (rel.startsWith("/") || rel.includes("\\")) return false;
@@ -35313,9 +35585,9 @@ function writeFileMap(targetDir, files) {
35313
35585
  if (!isSafeRelPath(rel)) {
35314
35586
  throw new Error(`Refusing to write unsafe path: ${rel}`);
35315
35587
  }
35316
- const abs = path40.join(targetDir, rel);
35317
- fs29.mkdirSync(path40.dirname(abs), { recursive: true });
35318
- fs29.writeFileSync(abs, body, "utf-8");
35588
+ const abs = path41.join(targetDir, rel);
35589
+ fs30.mkdirSync(path41.dirname(abs), { recursive: true });
35590
+ fs30.writeFileSync(abs, body, "utf-8");
35319
35591
  written.push(rel);
35320
35592
  }
35321
35593
  return written;
@@ -35331,8 +35603,8 @@ var admin_exports = {};
35331
35603
  __export(admin_exports, {
35332
35604
  adminCommand: () => adminCommand
35333
35605
  });
35334
- import * as fs30 from "fs";
35335
- import * as path41 from "path";
35606
+ import * as fs31 from "fs";
35607
+ import * as path42 from "path";
35336
35608
  async function adminCommand(args2) {
35337
35609
  const [group, ...afterGroup] = args2;
35338
35610
  if (!group) {
@@ -35907,13 +36179,13 @@ async function runSkillInstall(positional) {
35907
36179
  throw err;
35908
36180
  }
35909
36181
  const root = findGitRoot() ?? process.cwd();
35910
- const present = HARNESS_SKILL_DIRS.filter((dir) => fs30.existsSync(path41.join(root, dir)));
36182
+ const present = HARNESS_SKILL_DIRS.filter((dir) => fs31.existsSync(path42.join(root, dir)));
35911
36183
  const targets = present.length > 0 ? present : HARNESS_SKILL_DIRS;
35912
36184
  const fileCount = Object.keys(res.files).length;
35913
36185
  const relDirs = targets.map((harness) => {
35914
- const targetDir = path41.join(root, harness, "skills", name);
36186
+ const targetDir = path42.join(root, harness, "skills", name);
35915
36187
  writeFileMap(targetDir, res.files);
35916
- return `${path41.relative(root, targetDir)}/`;
36188
+ return `${path42.relative(root, targetDir)}/`;
35917
36189
  });
35918
36190
  console.log(`Installed skill "${name}" (${fileCount} file${fileCount === 1 ? "" : "s"}) \u2192 ${relDirs.join(", ")}`);
35919
36191
  console.log("Reload your agent (e.g. restart Claude Code) to pick up the skill.");
@@ -38784,16 +39056,16 @@ MCP URL: ${toolsetMcpUrl(slug)}`);
38784
39056
  ).option("--force", "Revoke even if the token appears to be in live use").action(async function(tokenId, opts) {
38785
39057
  const client = await createDataClient();
38786
39058
  const id = pathSegment(tokenId, "token id");
38787
- const path42 = (force) => `/v1/tokens/${id}${force ? "?force=true" : ""}`;
39059
+ const path43 = (force) => `/v1/tokens/${id}${force ? "?force=true" : ""}`;
38788
39060
  const format = outputFormat(this);
38789
39061
  const revoked = (forced) => printOutput({ token_id: tokenId, revoked: true, forced }, format);
38790
39062
  if (opts.force) {
38791
- await client.request("DELETE", path42(true));
39063
+ await client.request("DELETE", path43(true));
38792
39064
  revoked(true);
38793
39065
  return;
38794
39066
  }
38795
39067
  try {
38796
- await client.request("DELETE", path42(false));
39068
+ await client.request("DELETE", path43(false));
38797
39069
  revoked(false);
38798
39070
  } catch (err) {
38799
39071
  if (!(err instanceof ApiError) || err.status !== 409 || dataErrorDetails(err)?.requires_force !== true) {
@@ -38808,7 +39080,7 @@ MCP URL: ${toolsetMcpUrl(slug)}`);
38808
39080
  console.error("Aborted.");
38809
39081
  return process.exit(1);
38810
39082
  }
38811
- await client.request("DELETE", path42(true));
39083
+ await client.request("DELETE", path43(true));
38812
39084
  revoked(true);
38813
39085
  }
38814
39086
  });
@@ -38956,9 +39228,9 @@ var init_base_tags = __esm({
38956
39228
 
38957
39229
  // src/data/commands/bases.ts
38958
39230
  import { Command as Command9 } from "commander";
38959
- function pageOf(path42, cursor) {
38960
- if (!cursor) return path42;
38961
- return `${path42}${path42.includes("?") ? "&" : "?"}cursor=${encodeURIComponent(cursor)}`;
39231
+ function pageOf(path43, cursor) {
39232
+ if (!cursor) return path43;
39233
+ return `${path43}${path43.includes("?") ? "&" : "?"}cursor=${encodeURIComponent(cursor)}`;
38962
39234
  }
38963
39235
  function parseEnum(flag, value, allowed) {
38964
39236
  if (value === void 0) return void 0;
@@ -39115,9 +39387,9 @@ function buildBasesCommand() {
39115
39387
  });
39116
39388
  bases.command("list-previews <origin-id>").description("List preview bases cloned from a base (production or preview)").action(async function(originId) {
39117
39389
  const client = await createDataClient();
39118
- const path42 = `/v1/${pathSegment(originId, "origin base id")}/previews`;
39390
+ const path43 = `/v1/${pathSegment(originId, "origin base id")}/previews`;
39119
39391
  printOutput(
39120
- await client.collectPages((cursor) => pageOf(path42, cursor)),
39392
+ await client.collectPages((cursor) => pageOf(path43, cursor)),
39121
39393
  outputFormat(this)
39122
39394
  );
39123
39395
  });
@@ -39165,9 +39437,9 @@ function buildBasesCommand() {
39165
39437
  });
39166
39438
  bases.command("promotions <production-id>").description("List promotion history for a production base").action(async function(productionId) {
39167
39439
  const client = await createDataClient();
39168
- const path42 = `/v1/${pathSegment(productionId, "production base id")}/promotions`;
39440
+ const path43 = `/v1/${pathSegment(productionId, "production base id")}/promotions`;
39169
39441
  printOutput(
39170
- await client.collectPages((cursor) => pageOf(path42, cursor)),
39442
+ await client.collectPages((cursor) => pageOf(path43, cursor)),
39171
39443
  outputFormat(this)
39172
39444
  );
39173
39445
  });
@@ -39304,7 +39576,7 @@ var init_file_types = __esm({
39304
39576
  // src/data/commands/files.ts
39305
39577
  import { Command as Command11 } from "commander";
39306
39578
  import { readFileSync as readFileSync22, writeFileSync as writeFileSync11 } from "fs";
39307
- import { basename as basename27 } from "path";
39579
+ import { basename as basename28 } from "path";
39308
39580
  function renderFileDiff(fileType, filePath2, from, to, d) {
39309
39581
  console.log(sanitizeTerminalText(`${fileType}/${filePath2}: v${from} \u2192 v${to}`));
39310
39582
  const md = d.metadata_delta;
@@ -39336,7 +39608,7 @@ function renderFileDiff(fileType, filePath2, from, to, d) {
39336
39608
  }
39337
39609
  function downloadTarget(remotePath2, to) {
39338
39610
  if (to) return to;
39339
- const derived = basename27(remotePath2);
39611
+ const derived = basename28(remotePath2);
39340
39612
  if (derived === "" || derived === "." || derived === "..") {
39341
39613
  throw expected(
39342
39614
  `Cannot derive a local filename from "${remotePath2}" \u2014 pass --to <local> to name it.`
@@ -39760,8 +40032,8 @@ function buildRecordsCommand() {
39760
40032
  const body = { data: parseData(opts.data) };
39761
40033
  if (opts.externalId) body.external_id = opts.externalId;
39762
40034
  if (opts.externalSource) body.external_source = opts.externalSource;
39763
- const path42 = opts.id ? `/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${pathSegment(opts.id, "--id")}` : `/v1/${base}/records/${pathSegment(recordType2, "record_type")}`;
39764
- printOutput(await client.request("PUT", path42, body), outputFormat(this));
40035
+ const path43 = opts.id ? `/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${pathSegment(opts.id, "--id")}` : `/v1/${base}/records/${pathSegment(recordType2, "record_type")}`;
40036
+ printOutput(await client.request("PUT", path43, body), outputFormat(this));
39765
40037
  });
39766
40038
  records.command("query <record_type>").description("List/search records: exact filters + fuzzy `search`, sorting, pagination").option(
39767
40039
  "--external-source <source>",
@@ -39796,9 +40068,9 @@ function buildRecordsCommand() {
39796
40068
  ).action(async function(recordType2, id, opts) {
39797
40069
  const base = pathSegment(requireBase(this), "--base");
39798
40070
  const client = await createDataClient();
39799
- let path42 = `/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${recordKey(id, opts.externalSource)}`;
39800
- if (opts.externalSource) path42 += `?external_source=${encodeURIComponent(opts.externalSource)}`;
39801
- printOutput(await client.request("GET", path42), outputFormat(this));
40071
+ let path43 = `/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${recordKey(id, opts.externalSource)}`;
40072
+ if (opts.externalSource) path43 += `?external_source=${encodeURIComponent(opts.externalSource)}`;
40073
+ printOutput(await client.request("GET", path43), outputFormat(this));
39802
40074
  });
39803
40075
  records.command("delete <record_type> <id>").description(
39804
40076
  "Delete a record by internal ID, or by external_id (pass --external-source to scope it)"
@@ -39812,11 +40084,11 @@ function buildRecordsCommand() {
39812
40084
  }
39813
40085
  const base = pathSegment(requireBase(this), "--base");
39814
40086
  const client = await createDataClient();
39815
- let path42 = `/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${recordKey(id, opts.externalSource)}`;
40087
+ let path43 = `/v1/${base}/records/${pathSegment(recordType2, "record_type")}/${recordKey(id, opts.externalSource)}`;
39816
40088
  if (opts.externalSource) {
39817
- path42 += `?external_source=${encodeURIComponent(opts.externalSource)}&external_id=${encodeURIComponent(id)}`;
40089
+ path43 += `?external_source=${encodeURIComponent(opts.externalSource)}&external_id=${encodeURIComponent(id)}`;
39818
40090
  }
39819
- await client.request("DELETE", path42);
40091
+ await client.request("DELETE", path43);
39820
40092
  console.log("Deleted");
39821
40093
  });
39822
40094
  records.command("history <id>").description(
@@ -39981,8 +40253,8 @@ function buildRelationshipsCommand() {
39981
40253
  if (opts.data) body.data = parseData(opts.data);
39982
40254
  const base = pathSegment(requireBase(this), "--base");
39983
40255
  const client = await createDataClient();
39984
- const path42 = opts.id ? `/v1/${base}/relationships/${pathSegment(opts.id, "--id")}` : `/v1/${base}/relationships`;
39985
- printOutput(await client.request("PUT", path42, body), outputFormat(this));
40256
+ const path43 = opts.id ? `/v1/${base}/relationships/${pathSegment(opts.id, "--id")}` : `/v1/${base}/relationships`;
40257
+ printOutput(await client.request("PUT", path43, body), outputFormat(this));
39986
40258
  });
39987
40259
  relationships.command("get <id>").description(
39988
40260
  "Get a relationship by ID (or by its external key: pass the external_id with --rel-type)"
@@ -40215,8 +40487,8 @@ function buildToolsetsCommand() {
40215
40487
  toolsets.command("get <slug>").description("Get a toolset").option("--resolved", "Include resolved record_type schemas").action(async function(slug, opts) {
40216
40488
  const base = pathSegment(requireBase(this), "--base");
40217
40489
  const client = await createDataClient();
40218
- const path42 = opts.resolved ? `/v1/${base}/toolsets/${pathSegment(slug, "toolset slug")}/resolved` : `/v1/${base}/toolsets/${pathSegment(slug, "toolset slug")}`;
40219
- printOutput(await client.request("GET", path42), outputFormat(this));
40490
+ const path43 = opts.resolved ? `/v1/${base}/toolsets/${pathSegment(slug, "toolset slug")}/resolved` : `/v1/${base}/toolsets/${pathSegment(slug, "toolset slug")}`;
40491
+ printOutput(await client.request("GET", path43), outputFormat(this));
40220
40492
  });
40221
40493
  toolsets.command("list").description("List all toolsets").action(async function() {
40222
40494
  const base = pathSegment(requireBase(this), "--base");
@@ -40451,7 +40723,7 @@ init_utils();
40451
40723
  init_registry();
40452
40724
  import { readFileSync as readFileSync23 } from "fs";
40453
40725
  import { fileURLToPath as fileURLToPath2 } from "url";
40454
- import { dirname as dirname16, join as join37 } from "path";
40726
+ import { dirname as dirname16, join as join38 } from "path";
40455
40727
 
40456
40728
  // src/lib/version-refresh.ts
40457
40729
  init_version_cache();
@@ -40607,7 +40879,7 @@ Run \`wayai admin skill install\` to update.`);
40607
40879
 
40608
40880
  // src/index.ts
40609
40881
  var __dirname = dirname16(fileURLToPath2(import.meta.url));
40610
- var pkg = JSON.parse(readFileSync23(join37(__dirname, "..", "package.json"), "utf-8"));
40882
+ var pkg = JSON.parse(readFileSync23(join38(__dirname, "..", "package.json"), "utf-8"));
40611
40883
  var [, , command, ...args] = process.argv;
40612
40884
  var isBackgroundRefresh = command === REFRESH_COMMAND;
40613
40885
  if (!isBackgroundRefresh) initSentry(command, pkg.version);