@canonry/canonry 7.77.0 → 7.77.1

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.
Files changed (81) hide show
  1. package/README.md +1 -3
  2. package/dist/{ads-4WDIF7OK.js → ads-M6IAQDG7.js} +2 -2
  3. package/dist/{agent-UHSMOPSH.js → agent-X2T5X5K3.js} +5 -5
  4. package/dist/{agent-ask-QYGJQN5T.js → agent-ask-55LQH4TI.js} +2 -2
  5. package/dist/{agent-conversations-FVNLFQYS.js → agent-conversations-O6WC2NPV.js} +2 -2
  6. package/dist/{agent-memory-WBPVEUHN.js → agent-memory-6DWFMB4I.js} +2 -2
  7. package/dist/{agent-providers-7BGHHFRV.js → agent-providers-Q4YDVQX3.js} +2 -2
  8. package/dist/{agent-transcript-BSTEVSXP.js → agent-transcript-SJKCP2AO.js} +2 -2
  9. package/dist/{analytics-VTO2M4BN.js → analytics-4JOQMWH7.js} +2 -2
  10. package/dist/{apply-IVXI3B65.js → apply-EAKKKIZD.js} +2 -2
  11. package/dist/{backfill-PPXOHZR2.js → backfill-PASKIVGP.js} +2 -2
  12. package/dist/{backlinks-NSC56WKE.js → backlinks-TICPC323.js} +2 -2
  13. package/dist/{bing-BUNJKL7J.js → bing-MC7TSL4E.js} +2 -2
  14. package/dist/{bootstrap-ZDDSHNJV.js → bootstrap-X2BW64W7.js} +5 -5
  15. package/dist/{cdp-ZK7SNTHK.js → cdp-TCJKITCR.js} +5 -5
  16. package/dist/{chunk-IFLPQ5RQ.js → chunk-2BRVGCVU.js} +6 -8
  17. package/dist/{chunk-TS2B42RE.js → chunk-2SCPPWRW.js} +1 -1
  18. package/dist/{chunk-4HJO7VFM.js → chunk-6EZQHF67.js} +307 -307
  19. package/dist/{chunk-IQLEMBGA.js → chunk-B7JHQ3FW.js} +2 -2
  20. package/dist/{chunk-GXJWZOUC.js → chunk-CCNPBUQ5.js} +2 -2
  21. package/dist/{chunk-AWSK2DBU.js → chunk-CQMNWC5K.js} +90 -68
  22. package/dist/{chunk-CKJLL2FQ.js → chunk-FXIZBJZ4.js} +1 -1
  23. package/dist/{chunk-HCYSFU4U.js → chunk-H4ANN32B.js} +1 -1
  24. package/dist/{chunk-ZER6XCES.js → chunk-JZT3ZRD3.js} +1 -1
  25. package/dist/{chunk-GUEB3MPU.js → chunk-P3BWUKJL.js} +2 -2
  26. package/dist/{chunk-5QEGJVU5.js → chunk-TJYS2XCI.js} +2 -2
  27. package/dist/{chunk-Z7YPLZRD.js → chunk-TRW4XLQK.js} +1 -1
  28. package/dist/{chunk-RHRF7NBX.js → chunk-UB65XBH2.js} +1 -1
  29. package/dist/{chunk-ZOBE2CMQ.js → chunk-UGNNR7EO.js} +1 -1
  30. package/dist/{chunk-WYQQTWUB.js → chunk-X7UC755Q.js} +1 -1
  31. package/dist/{chunk-IUVJLNW4.js → chunk-YMOQSEO3.js} +1 -1
  32. package/dist/{citations-C2IJ7RHO.js → citations-IA3OCV53.js} +2 -2
  33. package/dist/{cli-commands-DX4ZVGV2.js → cli-commands-O7BYY3W5.js} +4 -4
  34. package/dist/cli.js +7 -7
  35. package/dist/{competitor-H7MYXUC2.js → competitor-4FVAZAQZ.js} +2 -2
  36. package/dist/{content-DDL4LI2E.js → content-OVBF6U7Z.js} +2 -2
  37. package/dist/{dashboard-CVJEQ56Q.js → dashboard-UGZSSIWK.js} +1 -1
  38. package/dist/{discover-YRCXWFNW.js → discover-R5BYAPOU.js} +2 -2
  39. package/dist/{discover-eval-QTOKYZWS.js → discover-eval-3FA4BR2L.js} +2 -2
  40. package/dist/{doctor-XC3VBBDF.js → doctor-2Q5LVV2P.js} +2 -2
  41. package/dist/{evidence-CKMSRS5C.js → evidence-LMGRT5IO.js} +2 -2
  42. package/dist/{export-cmd-YXESSTJV.js → export-cmd-LBLZ273Z.js} +2 -2
  43. package/dist/{ga-B45HBSS4.js → ga-PBIWRU67.js} +2 -2
  44. package/dist/{gbp-3IWONAO5.js → gbp-NYG7SW6P.js} +2 -2
  45. package/dist/{google-QNIYJEQ6.js → google-57XEYVOU.js} +2 -2
  46. package/dist/{health-cmd-WEBLFHNL.js → health-cmd-SJVYQZQL.js} +2 -2
  47. package/dist/{history-3DS5VTIQ.js → history-5XYZNWGP.js} +2 -2
  48. package/dist/index.d.ts +77 -67
  49. package/dist/index.js +8 -8
  50. package/dist/{init-2ZO6AUFB.js → init-KXR6PJEQ.js} +7 -7
  51. package/dist/{insights-GMTFJXMS.js → insights-L7OOH34I.js} +2 -2
  52. package/dist/{journeys-PSCN4GGH.js → journeys-VXBGDFBO.js} +2 -2
  53. package/dist/{keys-EBZDFHTP.js → keys-YMB5HAAG.js} +2 -2
  54. package/dist/{keyword-3WHXQ4UU.js → keyword-RZEMKH3K.js} +2 -2
  55. package/dist/{logs-QL3JWFOG.js → logs-ONZWSYXS.js} +2 -2
  56. package/dist/{mcp-4BMVUSZU.js → mcp-KK6EFHAZ.js} +3 -3
  57. package/dist/mcp.js +4 -4
  58. package/dist/{measurement-plan-VJK334AA.js → measurement-plan-LE7INWW6.js} +3 -3
  59. package/dist/{notify-U56W2ZAT.js → notify-T6T5LYRR.js} +2 -2
  60. package/dist/{organic-evidence-ZXQSTOCR.js → organic-evidence-P2GZ766W.js} +2 -2
  61. package/dist/{overview-GV7FE4HJ.js → overview-P2AILIWJ.js} +3 -3
  62. package/dist/{project-WMOIQ32P.js → project-7MHQSOJD.js} +2 -2
  63. package/dist/{query-FWE33SEK.js → query-EUDMU6L7.js} +2 -2
  64. package/dist/{research-32XG4HOS.js → research-4DASCVGY.js} +2 -2
  65. package/dist/{results-export-O43APU4C.js → results-export-GKXHX55L.js} +2 -2
  66. package/dist/{run-4T3D6ZNV.js → run-6LJGMJ5S.js} +3 -3
  67. package/dist/{schedule-AMXK44PA.js → schedule-D74P2BO5.js} +2 -2
  68. package/dist/{search-WVBOZLYM.js → search-W7AOYWRM.js} +2 -2
  69. package/dist/{serve-V67FDERY.js → serve-UNVCQSRC.js} +13 -11
  70. package/dist/{session-SLRAB77J.js → session-6NGNVCKP.js} +4 -4
  71. package/dist/{settings-7L6BSQSY.js → settings-LGD64PFE.js} +2 -2
  72. package/dist/{snapshot-QUX233WK.js → snapshot-PDYGSZZH.js} +2 -2
  73. package/dist/{status-UUYDHVVH.js → status-UZ4SE7ZP.js} +3 -3
  74. package/dist/{technical-aeo-LHZ7YUTK.js → technical-aeo-BNH7NV44.js} +2 -2
  75. package/dist/{telemetry-H2NMJ4KC.js → telemetry-UWDS7QNJ.js} +3 -3
  76. package/dist/{tools-JLNFAHYL.js → tools-EDPBQCI2.js} +3 -3
  77. package/dist/{traffic-W7N5E46S.js → traffic-NI6ACQO4.js} +2 -2
  78. package/dist/{users-OMNV5T6W.js → users-XTZ65NLC.js} +2 -2
  79. package/dist/{visibility-stats-X2QDF7P6.js → visibility-stats-EPF6MHYQ.js} +2 -2
  80. package/dist/{wordpress-6ZPLTOWU.js → wordpress-ZACJ3H5M.js} +2 -2
  81. package/package.json +1 -1
@@ -5,7 +5,7 @@ import {
5
5
  isStoredPageReadTool,
6
6
  isStoredReadTool,
7
7
  truncateToolResult
8
- } from "./chunk-ZER6XCES.js";
8
+ } from "./chunk-JZT3ZRD3.js";
9
9
  import {
10
10
  CANONRY_MCP_TOOLKITS
11
11
  } from "./chunk-NDTU7FGL.js";
@@ -22,7 +22,7 @@ import {
22
22
  resolveApiKeyFor,
23
23
  resolveModelForProvider,
24
24
  validateAgentProviderRegistry
25
- } from "./chunk-IFLPQ5RQ.js";
25
+ } from "./chunk-2BRVGCVU.js";
26
26
  import {
27
27
  CanonryMcpToolNames,
28
28
  canonryMcpTools
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  trackIntegrationConnection
3
- } from "./chunk-5QEGJVU5.js";
3
+ } from "./chunk-TJYS2XCI.js";
4
4
  import {
5
5
  cliRuntimeContext
6
- } from "./chunk-IUVJLNW4.js";
6
+ } from "./chunk-YMOQSEO3.js";
7
7
 
8
8
  // src/cli-connection-telemetry.ts
9
9
  function trackCliConnection(properties) {
@@ -27,14 +27,14 @@ import {
27
27
  resolveConfiguredAgentProvider,
28
28
  resolveSessionProviderAndModel,
29
29
  setAeroSystemPrompt
30
- } from "./chunk-IQLEMBGA.js";
30
+ } from "./chunk-B7JHQ3FW.js";
31
31
  import {
32
32
  AeroToolProfiles,
33
33
  AeroToolScopes,
34
34
  buildAeroStateTools,
35
35
  isAeroToolProfile,
36
36
  truncateToolResult
37
- } from "./chunk-ZER6XCES.js";
37
+ } from "./chunk-JZT3ZRD3.js";
38
38
  import {
39
39
  getGoogleAuthConfig,
40
40
  getGoogleConnection,
@@ -76,7 +76,7 @@ import {
76
76
  startOutcomeTimer,
77
77
  trackFeatureCompleted,
78
78
  trackInstallState
79
- } from "./chunk-5QEGJVU5.js";
79
+ } from "./chunk-TJYS2XCI.js";
80
80
  import {
81
81
  isLoopbackBindHost
82
82
  } from "./chunk-TSENU4GG.js";
@@ -95,17 +95,17 @@ import {
95
95
  recordDashboardEvent,
96
96
  setTelemetryPreference,
97
97
  trackEvent
98
- } from "./chunk-IUVJLNW4.js";
98
+ } from "./chunk-YMOQSEO3.js";
99
99
  import {
100
100
  createCanonryMcpServer
101
- } from "./chunk-TS2B42RE.js";
101
+ } from "./chunk-2SCPPWRW.js";
102
102
  import {
103
103
  CANONRY_MCP_TIERS,
104
104
  CANONRY_MCP_TOOLKIT_NAMES
105
105
  } from "./chunk-NDTU7FGL.js";
106
106
  import {
107
107
  ApiClient
108
- } from "./chunk-WYQQTWUB.js";
108
+ } from "./chunk-X7UC755Q.js";
109
109
  import {
110
110
  AGENT_PROVIDERS,
111
111
  adapterSupportsBatch,
@@ -136,7 +136,7 @@ import {
136
136
  saveConfigPatch,
137
137
  sentimentInstallReadiness,
138
138
  updateSharedProviderExecutionGate
139
- } from "./chunk-IFLPQ5RQ.js";
139
+ } from "./chunk-2BRVGCVU.js";
140
140
  import {
141
141
  getBundledSkillSnapshots
142
142
  } from "./chunk-7UVCZZQJ.js";
@@ -5810,7 +5810,7 @@ function nonBlank(value) {
5810
5810
  return trimmed ? trimmed : void 0;
5811
5811
  }
5812
5812
  function resolveBuildCommit(env = process.env) {
5813
- const embedded = true ? "c35e40e5e25334c95c1aef2cc0741ac34e2557cf" : void 0;
5813
+ const embedded = true ? "68e116717d6c9f8e51f1909b38f184f264855ffe" : void 0;
5814
5814
  return nonBlank(embedded) ?? nonBlank(env.CANONRY_COMMIT);
5815
5815
  }
5816
5816
  function resolveInstanceIdentity(env = process.env) {
@@ -8493,7 +8493,8 @@ async function executeGscSync(db, runId, projectId, opts) {
8493
8493
  tokenExpiresAt: new Date(Date.now() + tokens.expires_in * 1e3).toISOString(),
8494
8494
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
8495
8495
  });
8496
- saveConfigPatch(opts.config);
8496
+ const persistConfigPatch = opts.saveConfigPatch ?? saveConfigPatch;
8497
+ persistConfigPatch(opts.config);
8497
8498
  }
8498
8499
  const lagOffset = GSC_DATA_LAG_DAYS;
8499
8500
  const endDate = formatIsoDateInTimeZone((/* @__PURE__ */ new Date()).toISOString(), GSC_REPORTING_TIME_ZONE);
@@ -8918,7 +8919,8 @@ async function executeGbpSync(db, runId, projectId, opts) {
8918
8919
  tokenExpiresAt: new Date(Date.now() + tokens.expires_in * 1e3).toISOString(),
8919
8920
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
8920
8921
  });
8921
- saveConfigPatch(opts.config);
8922
+ const persistConfigPatch = opts.saveConfigPatch ?? saveConfigPatch;
8923
+ persistConfigPatch(opts.config);
8922
8924
  }
8923
8925
  let locationRows = db.select().from(gbpLocations).where(and7(eq9(gbpLocations.projectId, projectId), eq9(gbpLocations.selected, true))).all();
8924
8926
  if (opts.locationNames?.length) {
@@ -10349,7 +10351,8 @@ async function executeInspectSitemap(db, runId, projectId, opts) {
10349
10351
  tokenExpiresAt: new Date(Date.now() + tokens.expires_in * 1e3).toISOString(),
10350
10352
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
10351
10353
  });
10352
- saveConfigPatch(opts.config);
10354
+ const persistConfigPatch = opts.saveConfigPatch ?? saveConfigPatch;
10355
+ persistConfigPatch(opts.config);
10353
10356
  }
10354
10357
  const sitemapUrl = opts.sitemapUrl || conn.sitemapUrl || `https://${project.canonicalDomain}/sitemap.xml`;
10355
10358
  log8.info("sitemap.fetch", { runId, projectId, sitemapUrl });
@@ -19291,7 +19294,7 @@ function serializeSessionCookie(opts) {
19291
19294
  }
19292
19295
  return parts.join("; ");
19293
19296
  }
19294
- function applyLegacyCredentials(rows, config) {
19297
+ function applyLegacyCredentials(rows, config, persistConfigPatch = saveConfigPatch) {
19295
19298
  let migratedGoogle = 0;
19296
19299
  for (const row of rows.google) {
19297
19300
  const existing = getGoogleConnection(
@@ -19315,7 +19318,7 @@ function applyLegacyCredentials(rows, config) {
19315
19318
  migratedGoogle++;
19316
19319
  }
19317
19320
  if (migratedGoogle > 0) {
19318
- saveConfigPatch({ google: config.google });
19321
+ persistConfigPatch({ google: config.google });
19319
19322
  log27.info("credentials.migrated", { type: "google", count: migratedGoogle });
19320
19323
  }
19321
19324
  let migratedGa4 = 0;
@@ -19333,7 +19336,7 @@ function applyLegacyCredentials(rows, config) {
19333
19336
  migratedGa4++;
19334
19337
  }
19335
19338
  if (migratedGa4 > 0) {
19336
- saveConfigPatch({ ga4: config.ga4 });
19339
+ persistConfigPatch({ ga4: config.ga4 });
19337
19340
  log27.info("credentials.migrated", { type: "ga4", count: migratedGa4 });
19338
19341
  }
19339
19342
  }
@@ -19530,8 +19533,16 @@ function createGoogleMarketingConfigCredentialStore(input) {
19530
19533
  };
19531
19534
  }
19532
19535
  async function createServer(opts) {
19533
- const runtimeConfigPath = path5.resolve(getConfigPath());
19536
+ const runtimeConfigPath = path5.resolve(opts.configPath ?? getConfigPath());
19534
19537
  const runtimeConfigIdentity = runtimePathIdentity(runtimeConfigPath);
19538
+ const persistedConfigPath = opts.configPath === void 0 ? void 0 : runtimeConfigPath;
19539
+ const persistConfigPatch = (patch, options = {}) => {
19540
+ if (persistedConfigPath !== void 0) saveConfigPatch(patch, { ...options, configPath: persistedConfigPath });
19541
+ };
19542
+ const ownsDefaultConfig = persistedConfigPath !== void 0 && runtimeConfigIdentity === runtimePathIdentity(getConfigPath());
19543
+ const coverageRefreshDeps = {
19544
+ executeInspectSitemap: (db, runId, projectId, inspectOpts) => executeInspectSitemap(db, runId, projectId, { ...inspectOpts, saveConfigPatch: persistConfigPatch })
19545
+ };
19535
19546
  const runtimeDatabasePath = opts.config.database;
19536
19547
  const runtimeDatabaseIdentity = runtimePathIdentity(runtimeDatabasePath);
19537
19548
  const embed = resolveEmbedConfig(process.env, opts.config);
@@ -19596,14 +19607,16 @@ async function createServer(opts) {
19596
19607
  };
19597
19608
  }
19598
19609
  opts.config.providers = providers;
19599
- try {
19600
- const legacyRows = extractLegacyCredentials(opts.db);
19601
- applyLegacyCredentials(legacyRows, opts.config);
19602
- dropLegacyCredentialColumns(opts.db);
19603
- } catch (err) {
19604
- log27.warn("credentials.migration.failed", {
19605
- error: describeError(err)
19606
- });
19610
+ if (persistedConfigPath !== void 0) {
19611
+ try {
19612
+ const legacyRows = extractLegacyCredentials(opts.db);
19613
+ applyLegacyCredentials(legacyRows, opts.config, persistConfigPatch);
19614
+ dropLegacyCredentialColumns(opts.db);
19615
+ } catch (err) {
19616
+ log27.warn("credentials.migration.failed", {
19617
+ error: describeError(err)
19618
+ });
19619
+ }
19607
19620
  }
19608
19621
  log27.info("providers.configured", {
19609
19622
  providers: registeredProviderNames({ providers, cdp: opts.config.cdp })
@@ -19620,8 +19633,9 @@ async function createServer(opts) {
19620
19633
  const jobRunner = new JobRunner(opts.db, registry, {
19621
19634
  // The one-time first-sweep thank-you. Lives on the serve console because
19622
19635
  // runs execute here, including the foreground serve that init hands off
19623
- // to. TTY-gated inside, so supervised deployments never see it.
19624
- onFirstActivation: () => maybeShowActivationNotice()
19636
+ // to. TTY-gated inside, so supervised deployments never see it. It marks
19637
+ // the default config.yaml, so only the server running from it asks.
19638
+ ...ownsDefaultConfig ? { onFirstActivation: () => maybeShowActivationNotice() } : {}
19625
19639
  });
19626
19640
  jobRunner.recoverStaleRuns();
19627
19641
  const seoRuntime = new SeoRuntime(opts.db, () => loadConfig(runtimeConfigPath).seo, () => {
@@ -19694,17 +19708,18 @@ async function createServer(opts) {
19694
19708
  );
19695
19709
  const removedGoogleMarketingCredentials = removeLegacyGoogleAdsConnections(opts.config) + removeLegacyGtmConnections(opts.config) + removeOrphanedGoogleAdsConnections(opts.config, liveProjectIds) + removeOrphanedGtmConnections(opts.config, liveProjectIds);
19696
19710
  if (removedGoogleMarketingCredentials > 0) {
19697
- saveConfigPatch({
19711
+ persistConfigPatch({
19698
19712
  googleAds: opts.config.googleAds,
19699
19713
  gtm: opts.config.gtm
19700
19714
  });
19701
19715
  }
19702
19716
  const googleMarketingRuntime = createGoogleMarketingRuntime({
19703
19717
  config: opts.config,
19704
- saveConfigPatch
19718
+ saveConfigPatch: persistConfigPatch
19705
19719
  });
19706
19720
  const googleMarketingCredentialStore = createGoogleMarketingConfigCredentialStore({
19707
- config: opts.config
19721
+ config: opts.config,
19722
+ saveConfigPatch: persistConfigPatch
19708
19723
  });
19709
19724
  const prepareGoogleMarketingCredentialDelete = (projectId) => {
19710
19725
  const previousGoogleAdsConnections = opts.config.googleAds?.connections;
@@ -19717,7 +19732,7 @@ async function createServer(opts) {
19717
19732
  const removedGtm = removeGtmConnection(opts.config, projectId);
19718
19733
  if (!removedGoogleAds && !removedGtm) return void 0;
19719
19734
  try {
19720
- saveConfigPatch({
19735
+ persistConfigPatch({
19721
19736
  googleAds: opts.config.googleAds,
19722
19737
  gtm: opts.config.gtm
19723
19738
  });
@@ -19728,7 +19743,7 @@ async function createServer(opts) {
19728
19743
  return () => {
19729
19744
  restore();
19730
19745
  try {
19731
- saveConfigPatch({
19746
+ persistConfigPatch({
19732
19747
  googleAds: opts.config.googleAds,
19733
19748
  gtm: opts.config.gtm
19734
19749
  });
@@ -19800,7 +19815,8 @@ async function createServer(opts) {
19800
19815
  }
19801
19816
  executeGbpSync(opts.db, runId, projectId, {
19802
19817
  ...syncOpts,
19803
- config: opts.config
19818
+ config: opts.config,
19819
+ saveConfigPatch: persistConfigPatch
19804
19820
  }).then(() => runCoordinator.onRunCompleted(runId, projectId)).catch((err) => {
19805
19821
  app.log.error({ runId, err }, "GBP sync failed");
19806
19822
  });
@@ -19828,12 +19844,12 @@ async function createServer(opts) {
19828
19844
  },
19829
19845
  upsertConnection: (connection) => {
19830
19846
  const updated = upsertOpenAiAdsConnection(opts.config, connection);
19831
- saveConfigPatch(opts.config);
19847
+ persistConfigPatch(opts.config);
19832
19848
  return updated;
19833
19849
  },
19834
19850
  removeConnection: (projectName) => {
19835
19851
  const removed = removeOpenAiAdsConnection(opts.config, projectName);
19836
- if (removed) saveConfigPatch(opts.config);
19852
+ if (removed) persistConfigPatch(opts.config);
19837
19853
  return removed;
19838
19854
  }
19839
19855
  };
@@ -20218,7 +20234,7 @@ async function createServer(opts) {
20218
20234
  } else {
20219
20235
  opts.config.bing.connections.push(normalized);
20220
20236
  }
20221
- saveConfigPatch(opts.config);
20237
+ persistConfigPatch(opts.config);
20222
20238
  return normalized;
20223
20239
  },
20224
20240
  updateConnection: (domain, patch) => {
@@ -20227,7 +20243,7 @@ async function createServer(opts) {
20227
20243
  );
20228
20244
  if (!conn) return void 0;
20229
20245
  Object.assign(conn, patch);
20230
- saveConfigPatch(opts.config);
20246
+ persistConfigPatch(opts.config);
20231
20247
  return conn;
20232
20248
  },
20233
20249
  deleteConnection: (domain) => {
@@ -20237,7 +20253,7 @@ async function createServer(opts) {
20237
20253
  );
20238
20254
  if (idx < 0) return false;
20239
20255
  opts.config.bing.connections.splice(idx, 1);
20240
- saveConfigPatch(opts.config);
20256
+ persistConfigPatch(opts.config);
20241
20257
  return true;
20242
20258
  }
20243
20259
  };
@@ -20247,12 +20263,12 @@ async function createServer(opts) {
20247
20263
  },
20248
20264
  upsertConnection: (connection) => {
20249
20265
  const updated = upsertGa4Connection(opts.config, connection);
20250
- saveConfigPatch(opts.config);
20266
+ persistConfigPatch(opts.config);
20251
20267
  return updated;
20252
20268
  },
20253
20269
  deleteConnection: (projectName) => {
20254
20270
  const removed = removeGa4Connection(opts.config, projectName);
20255
- if (removed) saveConfigPatch(opts.config);
20271
+ if (removed) persistConfigPatch(opts.config);
20256
20272
  return removed;
20257
20273
  }
20258
20274
  };
@@ -20262,12 +20278,12 @@ async function createServer(opts) {
20262
20278
  },
20263
20279
  upsertConnection: (record) => {
20264
20280
  const updated = upsertCloudRunConnection(opts.config, record);
20265
- saveConfigPatch(opts.config);
20281
+ persistConfigPatch(opts.config);
20266
20282
  return updated;
20267
20283
  },
20268
20284
  deleteConnection: (projectName) => {
20269
20285
  const removed = removeCloudRunConnection(opts.config, projectName);
20270
- if (removed) saveConfigPatch(opts.config);
20286
+ if (removed) persistConfigPatch(opts.config);
20271
20287
  return removed;
20272
20288
  }
20273
20289
  };
@@ -20277,7 +20293,7 @@ async function createServer(opts) {
20277
20293
  },
20278
20294
  upsertConnection: (record) => {
20279
20295
  const updated = upsertWordpressTrafficConnection(opts.config, record);
20280
- saveConfigPatch(opts.config);
20296
+ persistConfigPatch(opts.config);
20281
20297
  return updated;
20282
20298
  },
20283
20299
  deleteConnection: (projectName) => {
@@ -20285,7 +20301,7 @@ async function createServer(opts) {
20285
20301
  opts.config,
20286
20302
  projectName
20287
20303
  );
20288
- if (removed) saveConfigPatch(opts.config);
20304
+ if (removed) persistConfigPatch(opts.config);
20289
20305
  return removed;
20290
20306
  }
20291
20307
  };
@@ -20295,12 +20311,12 @@ async function createServer(opts) {
20295
20311
  },
20296
20312
  upsertConnection: (record) => {
20297
20313
  const updated = upsertVercelTrafficConnection(opts.config, record);
20298
- saveConfigPatch(opts.config);
20314
+ persistConfigPatch(opts.config);
20299
20315
  return updated;
20300
20316
  },
20301
20317
  deleteConnection: (projectName) => {
20302
20318
  const removed = removeVercelTrafficConnection(opts.config, projectName);
20303
- if (removed) saveConfigPatch(opts.config);
20319
+ if (removed) persistConfigPatch(opts.config);
20304
20320
  return removed;
20305
20321
  }
20306
20322
  };
@@ -20313,12 +20329,12 @@ async function createServer(opts) {
20313
20329
  },
20314
20330
  upsertConnection: (record) => {
20315
20331
  const updated = upsertCloudflareTrafficConnection(opts.config, record);
20316
- saveConfigPatch(opts.config);
20332
+ persistConfigPatch(opts.config);
20317
20333
  return updated;
20318
20334
  },
20319
20335
  deleteConnection: (projectName) => {
20320
20336
  const removed = removeCloudflareTrafficConnection(opts.config, projectName);
20321
- if (removed) saveConfigPatch(opts.config);
20337
+ if (removed) persistConfigPatch(opts.config);
20322
20338
  return removed;
20323
20339
  },
20324
20340
  deleteConnectionBySourceId: (sourceId) => {
@@ -20326,7 +20342,7 @@ async function createServer(opts) {
20326
20342
  opts.config,
20327
20343
  sourceId
20328
20344
  );
20329
- if (removed) saveConfigPatch(opts.config);
20345
+ if (removed) persistConfigPatch(opts.config);
20330
20346
  return removed;
20331
20347
  }
20332
20348
  };
@@ -20336,7 +20352,7 @@ async function createServer(opts) {
20336
20352
  getConnection: (domain, connectionType) => getGoogleConnection(opts.config, domain, connectionType),
20337
20353
  upsertConnection: (connection) => {
20338
20354
  const updated = upsertGoogleConnection(opts.config, connection);
20339
- saveConfigPatch(opts.config);
20355
+ persistConfigPatch(opts.config);
20340
20356
  return updated;
20341
20357
  },
20342
20358
  updateConnection: (domain, connectionType, patch) => {
@@ -20346,7 +20362,7 @@ async function createServer(opts) {
20346
20362
  connectionType,
20347
20363
  patch
20348
20364
  );
20349
- if (updated) saveConfigPatch(opts.config);
20365
+ if (updated) persistConfigPatch(opts.config);
20350
20366
  return updated;
20351
20367
  },
20352
20368
  deleteConnection: (domain, connectionType) => {
@@ -20355,7 +20371,7 @@ async function createServer(opts) {
20355
20371
  domain,
20356
20372
  connectionType
20357
20373
  );
20358
- if (removed) saveConfigPatch(opts.config);
20374
+ if (removed) persistConfigPatch(opts.config);
20359
20375
  return removed;
20360
20376
  }
20361
20377
  };
@@ -20365,17 +20381,17 @@ async function createServer(opts) {
20365
20381
  },
20366
20382
  upsertConnection: (connection) => {
20367
20383
  const updated = upsertWordpressConnection(opts.config, connection);
20368
- saveConfigPatch(opts.config);
20384
+ persistConfigPatch(opts.config);
20369
20385
  return updated;
20370
20386
  },
20371
20387
  updateConnection: (projectName, patch) => {
20372
20388
  const updated = patchWordpressConnection(opts.config, projectName, patch);
20373
- if (updated) saveConfigPatch(opts.config);
20389
+ if (updated) persistConfigPatch(opts.config);
20374
20390
  return updated;
20375
20391
  },
20376
20392
  deleteConnection: (projectName) => {
20377
20393
  const removed = removeWordpressConnection(opts.config, projectName);
20378
- if (removed) saveConfigPatch(opts.config);
20394
+ if (removed) persistConfigPatch(opts.config);
20379
20395
  return removed;
20380
20396
  }
20381
20397
  };
@@ -20611,7 +20627,7 @@ async function createServer(opts) {
20611
20627
  diff: { authorizedBy: presentedRootKey ? "root-api-key" : "local-request" }
20612
20628
  }));
20613
20629
  const created = createSession(defaultKey, true, tx);
20614
- saveConfigPatch(opts.config, { setDashboardPasswordHash: passwordHash });
20630
+ persistConfigPatch(opts.config, { setDashboardPasswordHash: passwordHash });
20615
20631
  return created;
20616
20632
  });
20617
20633
  } catch (err) {
@@ -20642,18 +20658,20 @@ async function createServer(opts) {
20642
20658
  password,
20643
20659
  opts.config.dashboardPasswordHash
20644
20660
  );
20645
- const onDisk = verification.ok && verification.needsRehash ? loadConfigRaw() : null;
20661
+ const onDisk = verification.ok && verification.needsRehash && persistedConfigPath !== void 0 ? loadConfigRaw(persistedConfigPath) : null;
20646
20662
  if (!verification.ok || onDisk && onDisk.dashboardPasswordHash !== opts.config.dashboardPasswordHash) {
20647
20663
  return reply.status(401).send({
20648
20664
  error: { code: "AUTH_INVALID", message: "Incorrect password" }
20649
20665
  });
20650
20666
  }
20651
20667
  if (verification.needsRehash) {
20652
- if (fs5.existsSync(getConfigPath()) && (!onDisk || typeof onDisk !== "object" || Array.isArray(onDisk) || !onDisk.apiUrl || !onDisk.database || !onDisk.apiKey)) {
20668
+ if (persistedConfigPath !== void 0 && fs5.existsSync(persistedConfigPath) && (!onDisk || typeof onDisk !== "object" || Array.isArray(onDisk) || !onDisk.apiUrl || !onDisk.database || !onDisk.apiKey)) {
20653
20669
  throw new Error("Cannot migrate dashboard password: config.yaml is unreadable or invalid");
20654
20670
  }
20655
20671
  const migratedHash = hashDashboardPassword(password);
20656
- saveConfig({ ...onDisk ?? opts.config, dashboardPasswordHash: migratedHash });
20672
+ if (persistedConfigPath !== void 0) {
20673
+ saveConfig({ ...onDisk ?? opts.config, dashboardPasswordHash: migratedHash }, persistedConfigPath);
20674
+ }
20657
20675
  opts.config.dashboardPasswordHash = migratedHash;
20658
20676
  }
20659
20677
  if (!createPasswordSession(reply)) {
@@ -21068,9 +21086,10 @@ async function createServer(opts) {
21068
21086
  }
21069
21087
  executeGscSync(opts.db, runId, projectId, {
21070
21088
  ...syncOpts,
21071
- config: opts.config
21089
+ config: opts.config,
21090
+ saveConfigPatch: persistConfigPatch
21072
21091
  }).then(
21073
- () => maybeRefreshGscCoverage(opts.db, opts.config, projectId, void 0, Date.now(), {
21092
+ () => maybeRefreshGscCoverage(opts.db, opts.config, projectId, coverageRefreshDeps, Date.now(), {
21074
21093
  userInitiated: runWasUserInitiated(opts.db, runId)
21075
21094
  })
21076
21095
  ).catch((err) => {
@@ -21088,7 +21107,8 @@ async function createServer(opts) {
21088
21107
  }
21089
21108
  executeInspectSitemap(opts.db, runId, projectId, {
21090
21109
  ...inspectOpts,
21091
- config: opts.config
21110
+ config: opts.config,
21111
+ saveConfigPatch: persistConfigPatch
21092
21112
  }).catch((err) => {
21093
21113
  app.log.error({ runId, err }, "Inspect sitemap failed");
21094
21114
  });
@@ -21259,7 +21279,7 @@ async function createServer(opts) {
21259
21279
  opts.db,
21260
21280
  opts.config,
21261
21281
  projectId,
21262
- void 0,
21282
+ coverageRefreshDeps,
21263
21283
  Date.now(),
21264
21284
  { userInitiated: runWasUserInitiated(opts.db, runId) }
21265
21285
  );
@@ -21361,7 +21381,7 @@ async function createServer(opts) {
21361
21381
  ...existing?.pricing ? { pricing: existing.pricing } : {}
21362
21382
  };
21363
21383
  try {
21364
- saveConfigPatch(fs5.existsSync(runtimeConfigPath) ? { providers: { [name]: opts.config.providers[name] } } : opts.config);
21384
+ persistConfigPatch(fs5.existsSync(runtimeConfigPath) ? { providers: { [name]: opts.config.providers[name] } } : opts.config);
21365
21385
  } catch (err) {
21366
21386
  app.log.error({ err }, "Failed to save config");
21367
21387
  return null;
@@ -21381,7 +21401,7 @@ async function createServer(opts) {
21381
21401
  onGoogleSettingsUpdate: (clientId, clientSecret) => {
21382
21402
  try {
21383
21403
  setGoogleAuthConfig(opts.config, { clientId, clientSecret });
21384
- saveConfigPatch(opts.config);
21404
+ persistConfigPatch(opts.config);
21385
21405
  googleSettingsSummary.configured = true;
21386
21406
  return { ...googleSettingsSummary };
21387
21407
  } catch (err) {
@@ -21393,7 +21413,7 @@ async function createServer(opts) {
21393
21413
  try {
21394
21414
  if (!opts.config.bing) opts.config.bing = {};
21395
21415
  opts.config.bing.apiKey = apiKey;
21396
- saveConfigPatch(opts.config);
21416
+ persistConfigPatch(opts.config);
21397
21417
  bingSettingsSummary.configured = true;
21398
21418
  return { ...bingSettingsSummary };
21399
21419
  } catch (err) {
@@ -21420,7 +21440,7 @@ async function createServer(opts) {
21420
21440
  const removedGoogleAds = removeGoogleAdsConnection(opts.config, projectId);
21421
21441
  const removedGtm = removeGtmConnection(opts.config, projectId);
21422
21442
  if (removedGoogleAds || removedGtm) {
21423
- saveConfigPatch({
21443
+ persistConfigPatch({
21424
21444
  googleAds: opts.config.googleAds,
21425
21445
  gtm: opts.config.gtm
21426
21446
  });
@@ -21438,10 +21458,12 @@ async function createServer(opts) {
21438
21458
  operatorApiKeyIds,
21439
21459
  listOperationalLogs: (query) => operationalLogs.list(query),
21440
21460
  getTelemetryStatus,
21441
- setTelemetryEnabled: (enabled, attribution) => {
21461
+ // The preference lives in the default config.yaml; a server running from
21462
+ // any other config leaves it alone, and the route answers 501.
21463
+ setTelemetryEnabled: ownsDefaultConfig ? (enabled, attribution) => {
21442
21464
  void setTelemetryPreference(enabled, "api", outcomeAttribution(attribution));
21443
21465
  opts.config.telemetry = enabled;
21444
- },
21466
+ } : void 0,
21445
21467
  recordOnboardingEvent: (event) => recordDashboardEvent(event),
21446
21468
  // Answers false while telemetry is off or the per-process cap is spent, so
21447
21469
  // the dashboard stops sending for the session.
@@ -21452,7 +21474,7 @@ async function createServer(opts) {
21452
21474
  opts.config.cdp.host = host;
21453
21475
  opts.config.cdp.port = port2;
21454
21476
  try {
21455
- saveConfigPatch(opts.config);
21477
+ persistConfigPatch(opts.config);
21456
21478
  } catch (err) {
21457
21479
  app.log.error({ err }, "Failed to save CDP config");
21458
21480
  throw err;
@@ -2,7 +2,7 @@ import {
2
2
  configExists,
3
3
  loadConfigRaw,
4
4
  saveConfigPatch
5
- } from "./chunk-IFLPQ5RQ.js";
5
+ } from "./chunk-2BRVGCVU.js";
6
6
  import {
7
7
  BUNDLED_SKILL_NAMES,
8
8
  installSkills
@@ -10,7 +10,7 @@ import {
10
10
  } from "./chunk-C3UFOS7J.js";
11
11
  import {
12
12
  loadConfig
13
- } from "./chunk-IFLPQ5RQ.js";
13
+ } from "./chunk-2BRVGCVU.js";
14
14
  import {
15
15
  isMachineFormat
16
16
  } from "./chunk-HGMYEDAQ.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runWithUsageTags
3
- } from "./chunk-WYQQTWUB.js";
3
+ } from "./chunk-X7UC755Q.js";
4
4
  import {
5
5
  CanonryMcpToolNames,
6
6
  canonryMcpTools
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  configExists,
6
6
  loadConfigRaw
7
- } from "./chunk-IFLPQ5RQ.js";
7
+ } from "./chunk-2BRVGCVU.js";
8
8
 
9
9
  // src/setup-state.ts
10
10
  import fs from "fs";
@@ -47,7 +47,7 @@ function queueServeHandoff() {
47
47
  async function runPendingServeHandoff(format) {
48
48
  if (!pendingServeHandoff) return;
49
49
  pendingServeHandoff = false;
50
- const { serveCommand } = await import("./serve-V67FDERY.js");
50
+ const { serveCommand } = await import("./serve-UNVCQSRC.js");
51
51
  await serveCommand(format);
52
52
  }
53
53
 
@@ -2,10 +2,10 @@ import {
2
2
  bucketCliCommandDuration,
3
3
  isTelemetryEnabled,
4
4
  trackEvent
5
- } from "./chunk-IUVJLNW4.js";
5
+ } from "./chunk-YMOQSEO3.js";
6
6
  import {
7
7
  getConfigDir
8
- } from "./chunk-IFLPQ5RQ.js";
8
+ } from "./chunk-2BRVGCVU.js";
9
9
  import {
10
10
  currentOutcomeAttribution
11
11
  } from "./chunk-JPOIDGGF.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-VJWDBFSL.js";
5
5
  import {
6
6
  createApiClient
7
- } from "./chunk-WYQQTWUB.js";
7
+ } from "./chunk-X7UC755Q.js";
8
8
  import {
9
9
  CliError,
10
10
  isMachineFormat
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-WYQQTWUB.js";
3
+ } from "./chunk-X7UC755Q.js";
4
4
  import {
5
5
  emitJsonl
6
6
  } from "./chunk-Z7IUAJOF.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-WYQQTWUB.js";
3
+ } from "./chunk-X7UC755Q.js";
4
4
  import {
5
5
  emitJsonl
6
6
  } from "./chunk-Z7IUAJOF.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  loadConfig
3
- } from "./chunk-IFLPQ5RQ.js";
3
+ } from "./chunk-2BRVGCVU.js";
4
4
  import {
5
5
  PACKAGE_VERSION
6
6
  } from "./chunk-AOJU5LKX.js";
@@ -5,7 +5,7 @@ import {
5
5
  loadConfig,
6
6
  loadConfigRaw,
7
7
  saveConfigPatch
8
- } from "./chunk-IFLPQ5RQ.js";
8
+ } from "./chunk-2BRVGCVU.js";
9
9
  import {
10
10
  CANONRY_NPM_PACKAGE_URL,
11
11
  compareSemver,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-WYQQTWUB.js";
4
- import "./chunk-IFLPQ5RQ.js";
3
+ } from "./chunk-X7UC755Q.js";
4
+ import "./chunk-2BRVGCVU.js";
5
5
  import "./chunk-AOJU5LKX.js";
6
6
  import "./chunk-HGMYEDAQ.js";
7
7
  import "./chunk-FCGYYZHL.js";