@canonry/canonry 7.77.0 → 7.77.2

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-5K5IQDCD.js} +2 -2
  3. package/dist/{agent-UHSMOPSH.js → agent-Q4PKMBEJ.js} +5 -5
  4. package/dist/{agent-ask-QYGJQN5T.js → agent-ask-JEPVVW2J.js} +2 -2
  5. package/dist/{agent-conversations-FVNLFQYS.js → agent-conversations-EHE7QEBC.js} +2 -2
  6. package/dist/{agent-memory-WBPVEUHN.js → agent-memory-AB72YQET.js} +2 -2
  7. package/dist/{agent-providers-7BGHHFRV.js → agent-providers-NQ7HJYAQ.js} +2 -2
  8. package/dist/{agent-transcript-BSTEVSXP.js → agent-transcript-PRTWIQ2A.js} +2 -2
  9. package/dist/{analytics-VTO2M4BN.js → analytics-IY3J4VZE.js} +2 -2
  10. package/dist/{apply-IVXI3B65.js → apply-HNOG674K.js} +2 -2
  11. package/dist/{backfill-PPXOHZR2.js → backfill-TO7TPPO6.js} +2 -2
  12. package/dist/{backlinks-NSC56WKE.js → backlinks-3NY5GNT4.js} +2 -2
  13. package/dist/{bing-BUNJKL7J.js → bing-Z7W7U2CT.js} +2 -2
  14. package/dist/{bootstrap-ZDDSHNJV.js → bootstrap-DXXS3LRH.js} +5 -5
  15. package/dist/{cdp-ZK7SNTHK.js → cdp-CKPRS6VE.js} +5 -5
  16. package/dist/{chunk-ZOBE2CMQ.js → chunk-4XVXP6VR.js} +1 -1
  17. package/dist/{chunk-IQLEMBGA.js → chunk-5LKK2MCJ.js} +2 -2
  18. package/dist/{chunk-IUVJLNW4.js → chunk-6KPBYCPE.js} +14 -3
  19. package/dist/{chunk-IFLPQ5RQ.js → chunk-7JC4Z6FQ.js} +12 -8
  20. package/dist/{chunk-GXJWZOUC.js → chunk-AAUMUHUI.js} +2 -2
  21. package/dist/{chunk-AWSK2DBU.js → chunk-CHTKK43G.js} +99 -68
  22. package/dist/{chunk-CKJLL2FQ.js → chunk-CMS4YM5M.js} +1 -1
  23. package/dist/{chunk-HCYSFU4U.js → chunk-EM2HAM2U.js} +1 -1
  24. package/dist/{chunk-RHRF7NBX.js → chunk-G26YB6JK.js} +1 -1
  25. package/dist/{chunk-5QEGJVU5.js → chunk-JEXBP7CR.js} +2 -2
  26. package/dist/{chunk-GUEB3MPU.js → chunk-JMCURBZG.js} +2 -2
  27. package/dist/{chunk-WYQQTWUB.js → chunk-JRVKW4OO.js} +1 -1
  28. package/dist/{chunk-Z7YPLZRD.js → chunk-JZ4UFSVR.js} +1 -1
  29. package/dist/{chunk-TS2B42RE.js → chunk-LKEFPJQ2.js} +1 -1
  30. package/dist/{chunk-ZER6XCES.js → chunk-ORZBHCZR.js} +1 -1
  31. package/dist/{chunk-4HJO7VFM.js → chunk-WFFZAQRG.js} +307 -307
  32. package/dist/{citations-C2IJ7RHO.js → citations-4AV6HLUZ.js} +2 -2
  33. package/dist/{cli-commands-DX4ZVGV2.js → cli-commands-NJDUBQ3R.js} +4 -4
  34. package/dist/cli.js +7 -7
  35. package/dist/{competitor-H7MYXUC2.js → competitor-SG4N37UD.js} +2 -2
  36. package/dist/{content-DDL4LI2E.js → content-EDLZAPUV.js} +2 -2
  37. package/dist/{dashboard-CVJEQ56Q.js → dashboard-5ZFVJPHX.js} +1 -1
  38. package/dist/{discover-YRCXWFNW.js → discover-7X2WMNFV.js} +2 -2
  39. package/dist/{discover-eval-QTOKYZWS.js → discover-eval-ECOPSJJ4.js} +2 -2
  40. package/dist/{doctor-XC3VBBDF.js → doctor-NMFBKNYR.js} +2 -2
  41. package/dist/{evidence-CKMSRS5C.js → evidence-C52ZPRYB.js} +2 -2
  42. package/dist/{export-cmd-YXESSTJV.js → export-cmd-2WSEETUC.js} +2 -2
  43. package/dist/{ga-B45HBSS4.js → ga-YG4O2FT5.js} +2 -2
  44. package/dist/{gbp-3IWONAO5.js → gbp-BDGV6F74.js} +2 -2
  45. package/dist/{google-QNIYJEQ6.js → google-P2AX6CUF.js} +2 -2
  46. package/dist/{health-cmd-WEBLFHNL.js → health-cmd-MIQT2JNL.js} +2 -2
  47. package/dist/{history-3DS5VTIQ.js → history-3XDDJDAV.js} +2 -2
  48. package/dist/index.d.ts +76 -65
  49. package/dist/index.js +8 -8
  50. package/dist/{init-2ZO6AUFB.js → init-GT3QM7FC.js} +7 -7
  51. package/dist/{insights-GMTFJXMS.js → insights-ZJUDCBBP.js} +2 -2
  52. package/dist/{journeys-PSCN4GGH.js → journeys-L2CXQXRP.js} +2 -2
  53. package/dist/{keys-EBZDFHTP.js → keys-ODRGIQS7.js} +2 -2
  54. package/dist/{keyword-3WHXQ4UU.js → keyword-LE3CAXO2.js} +2 -2
  55. package/dist/{logs-QL3JWFOG.js → logs-OXK43XN2.js} +2 -2
  56. package/dist/{mcp-4BMVUSZU.js → mcp-6OTPCDGW.js} +3 -3
  57. package/dist/mcp.js +4 -4
  58. package/dist/{measurement-plan-VJK334AA.js → measurement-plan-NXRCDUYL.js} +3 -3
  59. package/dist/{notify-U56W2ZAT.js → notify-VNNJTNC6.js} +2 -2
  60. package/dist/{organic-evidence-ZXQSTOCR.js → organic-evidence-LYDB7IID.js} +2 -2
  61. package/dist/{overview-GV7FE4HJ.js → overview-2GPPQ6JP.js} +3 -3
  62. package/dist/{project-WMOIQ32P.js → project-CQJPXC66.js} +2 -2
  63. package/dist/{query-FWE33SEK.js → query-PPE4EHMY.js} +2 -2
  64. package/dist/{research-32XG4HOS.js → research-GDYZKQY2.js} +2 -2
  65. package/dist/{results-export-O43APU4C.js → results-export-OAJHDEIQ.js} +2 -2
  66. package/dist/{run-4T3D6ZNV.js → run-XDPDQS44.js} +3 -3
  67. package/dist/{schedule-AMXK44PA.js → schedule-C6SYV54I.js} +2 -2
  68. package/dist/{search-WVBOZLYM.js → search-DONTDHQK.js} +2 -2
  69. package/dist/{serve-V67FDERY.js → serve-PJXATOSY.js} +13 -11
  70. package/dist/{session-SLRAB77J.js → session-PMZV27GX.js} +4 -4
  71. package/dist/{settings-7L6BSQSY.js → settings-PMATG7GG.js} +2 -2
  72. package/dist/{snapshot-QUX233WK.js → snapshot-E4GHH6DD.js} +2 -2
  73. package/dist/{status-UUYDHVVH.js → status-MEGXEEW6.js} +3 -3
  74. package/dist/{technical-aeo-LHZ7YUTK.js → technical-aeo-GE6KOFKT.js} +2 -2
  75. package/dist/{telemetry-H2NMJ4KC.js → telemetry-Y63F4XFX.js} +3 -3
  76. package/dist/{tools-JLNFAHYL.js → tools-V546ALG7.js} +3 -3
  77. package/dist/{traffic-W7N5E46S.js → traffic-5ELSKXBM.js} +2 -2
  78. package/dist/{users-OMNV5T6W.js → users-7YK7XYWY.js} +2 -2
  79. package/dist/{visibility-stats-X2QDF7P6.js → visibility-stats-GYPUKXVS.js} +2 -2
  80. package/dist/{wordpress-6ZPLTOWU.js → wordpress-WUGJT5NN.js} +2 -2
  81. package/package.json +1 -1
@@ -27,14 +27,14 @@ import {
27
27
  resolveConfiguredAgentProvider,
28
28
  resolveSessionProviderAndModel,
29
29
  setAeroSystemPrompt
30
- } from "./chunk-IQLEMBGA.js";
30
+ } from "./chunk-5LKK2MCJ.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-ORZBHCZR.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-JEXBP7CR.js";
80
80
  import {
81
81
  isLoopbackBindHost
82
82
  } from "./chunk-TSENU4GG.js";
@@ -90,22 +90,23 @@ import {
90
90
  getOrCreateAnonymousId,
91
91
  getServerUpdateStatus,
92
92
  getTelemetryStatus,
93
+ holdAnonymousIdWrites,
93
94
  installAttribution,
94
95
  isTelemetryEnabled,
95
96
  recordDashboardEvent,
96
97
  setTelemetryPreference,
97
98
  trackEvent
98
- } from "./chunk-IUVJLNW4.js";
99
+ } from "./chunk-6KPBYCPE.js";
99
100
  import {
100
101
  createCanonryMcpServer
101
- } from "./chunk-TS2B42RE.js";
102
+ } from "./chunk-LKEFPJQ2.js";
102
103
  import {
103
104
  CANONRY_MCP_TIERS,
104
105
  CANONRY_MCP_TOOLKIT_NAMES
105
106
  } from "./chunk-NDTU7FGL.js";
106
107
  import {
107
108
  ApiClient
108
- } from "./chunk-WYQQTWUB.js";
109
+ } from "./chunk-JRVKW4OO.js";
109
110
  import {
110
111
  AGENT_PROVIDERS,
111
112
  adapterSupportsBatch,
@@ -124,6 +125,7 @@ import {
124
125
  isAgentModelUnchecked,
125
126
  loadConfig,
126
127
  loadConfigRaw,
128
+ loadedConfigPath,
127
129
  openRouterModels,
128
130
  providerConfigFromEntry,
129
131
  providersWithUnsupportedBatch,
@@ -136,7 +138,7 @@ import {
136
138
  saveConfigPatch,
137
139
  sentimentInstallReadiness,
138
140
  updateSharedProviderExecutionGate
139
- } from "./chunk-IFLPQ5RQ.js";
141
+ } from "./chunk-7JC4Z6FQ.js";
140
142
  import {
141
143
  getBundledSkillSnapshots
142
144
  } from "./chunk-7UVCZZQJ.js";
@@ -5810,7 +5812,7 @@ function nonBlank(value) {
5810
5812
  return trimmed ? trimmed : void 0;
5811
5813
  }
5812
5814
  function resolveBuildCommit(env = process.env) {
5813
- const embedded = true ? "c35e40e5e25334c95c1aef2cc0741ac34e2557cf" : void 0;
5815
+ const embedded = true ? "31abb805953cc5f5c6cfa83e68610c6944e35b6c" : void 0;
5814
5816
  return nonBlank(embedded) ?? nonBlank(env.CANONRY_COMMIT);
5815
5817
  }
5816
5818
  function resolveInstanceIdentity(env = process.env) {
@@ -8493,7 +8495,8 @@ async function executeGscSync(db, runId, projectId, opts) {
8493
8495
  tokenExpiresAt: new Date(Date.now() + tokens.expires_in * 1e3).toISOString(),
8494
8496
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
8495
8497
  });
8496
- saveConfigPatch(opts.config);
8498
+ const persistConfigPatch = opts.saveConfigPatch ?? saveConfigPatch;
8499
+ persistConfigPatch(opts.config);
8497
8500
  }
8498
8501
  const lagOffset = GSC_DATA_LAG_DAYS;
8499
8502
  const endDate = formatIsoDateInTimeZone((/* @__PURE__ */ new Date()).toISOString(), GSC_REPORTING_TIME_ZONE);
@@ -8918,7 +8921,8 @@ async function executeGbpSync(db, runId, projectId, opts) {
8918
8921
  tokenExpiresAt: new Date(Date.now() + tokens.expires_in * 1e3).toISOString(),
8919
8922
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
8920
8923
  });
8921
- saveConfigPatch(opts.config);
8924
+ const persistConfigPatch = opts.saveConfigPatch ?? saveConfigPatch;
8925
+ persistConfigPatch(opts.config);
8922
8926
  }
8923
8927
  let locationRows = db.select().from(gbpLocations).where(and7(eq9(gbpLocations.projectId, projectId), eq9(gbpLocations.selected, true))).all();
8924
8928
  if (opts.locationNames?.length) {
@@ -10349,7 +10353,8 @@ async function executeInspectSitemap(db, runId, projectId, opts) {
10349
10353
  tokenExpiresAt: new Date(Date.now() + tokens.expires_in * 1e3).toISOString(),
10350
10354
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
10351
10355
  });
10352
- saveConfigPatch(opts.config);
10356
+ const persistConfigPatch = opts.saveConfigPatch ?? saveConfigPatch;
10357
+ persistConfigPatch(opts.config);
10353
10358
  }
10354
10359
  const sitemapUrl = opts.sitemapUrl || conn.sitemapUrl || `https://${project.canonicalDomain}/sitemap.xml`;
10355
10360
  log8.info("sitemap.fetch", { runId, projectId, sitemapUrl });
@@ -19291,7 +19296,7 @@ function serializeSessionCookie(opts) {
19291
19296
  }
19292
19297
  return parts.join("; ");
19293
19298
  }
19294
- function applyLegacyCredentials(rows, config) {
19299
+ function applyLegacyCredentials(rows, config, persistConfigPatch = saveConfigPatch) {
19295
19300
  let migratedGoogle = 0;
19296
19301
  for (const row of rows.google) {
19297
19302
  const existing = getGoogleConnection(
@@ -19315,7 +19320,7 @@ function applyLegacyCredentials(rows, config) {
19315
19320
  migratedGoogle++;
19316
19321
  }
19317
19322
  if (migratedGoogle > 0) {
19318
- saveConfigPatch({ google: config.google });
19323
+ persistConfigPatch({ google: config.google });
19319
19324
  log27.info("credentials.migrated", { type: "google", count: migratedGoogle });
19320
19325
  }
19321
19326
  let migratedGa4 = 0;
@@ -19333,7 +19338,7 @@ function applyLegacyCredentials(rows, config) {
19333
19338
  migratedGa4++;
19334
19339
  }
19335
19340
  if (migratedGa4 > 0) {
19336
- saveConfigPatch({ ga4: config.ga4 });
19341
+ persistConfigPatch({ ga4: config.ga4 });
19337
19342
  log27.info("credentials.migrated", { type: "ga4", count: migratedGa4 });
19338
19343
  }
19339
19344
  }
@@ -19530,8 +19535,17 @@ function createGoogleMarketingConfigCredentialStore(input) {
19530
19535
  };
19531
19536
  }
19532
19537
  async function createServer(opts) {
19533
- const runtimeConfigPath = path5.resolve(getConfigPath());
19538
+ const configSourcePath = opts.configPath ?? loadedConfigPath(opts.config);
19539
+ const runtimeConfigPath = path5.resolve(configSourcePath ?? getConfigPath());
19534
19540
  const runtimeConfigIdentity = runtimePathIdentity(runtimeConfigPath);
19541
+ const persistedConfigPath = configSourcePath === void 0 ? void 0 : runtimeConfigPath;
19542
+ const persistConfigPatch = (patch, options = {}) => {
19543
+ if (persistedConfigPath !== void 0) saveConfigPatch(patch, { ...options, configPath: persistedConfigPath });
19544
+ };
19545
+ const ownsDefaultConfig = persistedConfigPath !== void 0 && runtimeConfigIdentity === runtimePathIdentity(getConfigPath());
19546
+ const coverageRefreshDeps = {
19547
+ executeInspectSitemap: (db, runId, projectId, inspectOpts) => executeInspectSitemap(db, runId, projectId, { ...inspectOpts, saveConfigPatch: persistConfigPatch })
19548
+ };
19535
19549
  const runtimeDatabasePath = opts.config.database;
19536
19550
  const runtimeDatabaseIdentity = runtimePathIdentity(runtimeDatabasePath);
19537
19551
  const embed = resolveEmbedConfig(process.env, opts.config);
@@ -19547,6 +19561,12 @@ async function createServer(opts) {
19547
19561
  genReqId: () => crypto26.randomUUID(),
19548
19562
  trustProxy
19549
19563
  });
19564
+ if (!ownsDefaultConfig) {
19565
+ const releaseAnonymousIdWrites = holdAnonymousIdWrites();
19566
+ app.addHook("onClose", async () => {
19567
+ releaseAnonymousIdWrites();
19568
+ });
19569
+ }
19550
19570
  const allowedHosts = buildAllowedHosts(opts.host, opts.config.apiUrl, opts.config.publicUrl);
19551
19571
  const embedAllowedOrigins = new Set(
19552
19572
  (embed.allowedOrigins ?? []).map((o) => {
@@ -19596,14 +19616,16 @@ async function createServer(opts) {
19596
19616
  };
19597
19617
  }
19598
19618
  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
- });
19619
+ if (persistedConfigPath !== void 0) {
19620
+ try {
19621
+ const legacyRows = extractLegacyCredentials(opts.db);
19622
+ applyLegacyCredentials(legacyRows, opts.config, persistConfigPatch);
19623
+ dropLegacyCredentialColumns(opts.db);
19624
+ } catch (err) {
19625
+ log27.warn("credentials.migration.failed", {
19626
+ error: describeError(err)
19627
+ });
19628
+ }
19607
19629
  }
19608
19630
  log27.info("providers.configured", {
19609
19631
  providers: registeredProviderNames({ providers, cdp: opts.config.cdp })
@@ -19620,8 +19642,9 @@ async function createServer(opts) {
19620
19642
  const jobRunner = new JobRunner(opts.db, registry, {
19621
19643
  // The one-time first-sweep thank-you. Lives on the serve console because
19622
19644
  // 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()
19645
+ // to. TTY-gated inside, so supervised deployments never see it. It marks
19646
+ // the default config.yaml, so only the server running from it asks.
19647
+ ...ownsDefaultConfig ? { onFirstActivation: () => maybeShowActivationNotice() } : {}
19625
19648
  });
19626
19649
  jobRunner.recoverStaleRuns();
19627
19650
  const seoRuntime = new SeoRuntime(opts.db, () => loadConfig(runtimeConfigPath).seo, () => {
@@ -19694,17 +19717,18 @@ async function createServer(opts) {
19694
19717
  );
19695
19718
  const removedGoogleMarketingCredentials = removeLegacyGoogleAdsConnections(opts.config) + removeLegacyGtmConnections(opts.config) + removeOrphanedGoogleAdsConnections(opts.config, liveProjectIds) + removeOrphanedGtmConnections(opts.config, liveProjectIds);
19696
19719
  if (removedGoogleMarketingCredentials > 0) {
19697
- saveConfigPatch({
19720
+ persistConfigPatch({
19698
19721
  googleAds: opts.config.googleAds,
19699
19722
  gtm: opts.config.gtm
19700
19723
  });
19701
19724
  }
19702
19725
  const googleMarketingRuntime = createGoogleMarketingRuntime({
19703
19726
  config: opts.config,
19704
- saveConfigPatch
19727
+ saveConfigPatch: persistConfigPatch
19705
19728
  });
19706
19729
  const googleMarketingCredentialStore = createGoogleMarketingConfigCredentialStore({
19707
- config: opts.config
19730
+ config: opts.config,
19731
+ saveConfigPatch: persistConfigPatch
19708
19732
  });
19709
19733
  const prepareGoogleMarketingCredentialDelete = (projectId) => {
19710
19734
  const previousGoogleAdsConnections = opts.config.googleAds?.connections;
@@ -19717,7 +19741,7 @@ async function createServer(opts) {
19717
19741
  const removedGtm = removeGtmConnection(opts.config, projectId);
19718
19742
  if (!removedGoogleAds && !removedGtm) return void 0;
19719
19743
  try {
19720
- saveConfigPatch({
19744
+ persistConfigPatch({
19721
19745
  googleAds: opts.config.googleAds,
19722
19746
  gtm: opts.config.gtm
19723
19747
  });
@@ -19728,7 +19752,7 @@ async function createServer(opts) {
19728
19752
  return () => {
19729
19753
  restore();
19730
19754
  try {
19731
- saveConfigPatch({
19755
+ persistConfigPatch({
19732
19756
  googleAds: opts.config.googleAds,
19733
19757
  gtm: opts.config.gtm
19734
19758
  });
@@ -19800,7 +19824,8 @@ async function createServer(opts) {
19800
19824
  }
19801
19825
  executeGbpSync(opts.db, runId, projectId, {
19802
19826
  ...syncOpts,
19803
- config: opts.config
19827
+ config: opts.config,
19828
+ saveConfigPatch: persistConfigPatch
19804
19829
  }).then(() => runCoordinator.onRunCompleted(runId, projectId)).catch((err) => {
19805
19830
  app.log.error({ runId, err }, "GBP sync failed");
19806
19831
  });
@@ -19828,12 +19853,12 @@ async function createServer(opts) {
19828
19853
  },
19829
19854
  upsertConnection: (connection) => {
19830
19855
  const updated = upsertOpenAiAdsConnection(opts.config, connection);
19831
- saveConfigPatch(opts.config);
19856
+ persistConfigPatch(opts.config);
19832
19857
  return updated;
19833
19858
  },
19834
19859
  removeConnection: (projectName) => {
19835
19860
  const removed = removeOpenAiAdsConnection(opts.config, projectName);
19836
- if (removed) saveConfigPatch(opts.config);
19861
+ if (removed) persistConfigPatch(opts.config);
19837
19862
  return removed;
19838
19863
  }
19839
19864
  };
@@ -20218,7 +20243,7 @@ async function createServer(opts) {
20218
20243
  } else {
20219
20244
  opts.config.bing.connections.push(normalized);
20220
20245
  }
20221
- saveConfigPatch(opts.config);
20246
+ persistConfigPatch(opts.config);
20222
20247
  return normalized;
20223
20248
  },
20224
20249
  updateConnection: (domain, patch) => {
@@ -20227,7 +20252,7 @@ async function createServer(opts) {
20227
20252
  );
20228
20253
  if (!conn) return void 0;
20229
20254
  Object.assign(conn, patch);
20230
- saveConfigPatch(opts.config);
20255
+ persistConfigPatch(opts.config);
20231
20256
  return conn;
20232
20257
  },
20233
20258
  deleteConnection: (domain) => {
@@ -20237,7 +20262,7 @@ async function createServer(opts) {
20237
20262
  );
20238
20263
  if (idx < 0) return false;
20239
20264
  opts.config.bing.connections.splice(idx, 1);
20240
- saveConfigPatch(opts.config);
20265
+ persistConfigPatch(opts.config);
20241
20266
  return true;
20242
20267
  }
20243
20268
  };
@@ -20247,12 +20272,12 @@ async function createServer(opts) {
20247
20272
  },
20248
20273
  upsertConnection: (connection) => {
20249
20274
  const updated = upsertGa4Connection(opts.config, connection);
20250
- saveConfigPatch(opts.config);
20275
+ persistConfigPatch(opts.config);
20251
20276
  return updated;
20252
20277
  },
20253
20278
  deleteConnection: (projectName) => {
20254
20279
  const removed = removeGa4Connection(opts.config, projectName);
20255
- if (removed) saveConfigPatch(opts.config);
20280
+ if (removed) persistConfigPatch(opts.config);
20256
20281
  return removed;
20257
20282
  }
20258
20283
  };
@@ -20262,12 +20287,12 @@ async function createServer(opts) {
20262
20287
  },
20263
20288
  upsertConnection: (record) => {
20264
20289
  const updated = upsertCloudRunConnection(opts.config, record);
20265
- saveConfigPatch(opts.config);
20290
+ persistConfigPatch(opts.config);
20266
20291
  return updated;
20267
20292
  },
20268
20293
  deleteConnection: (projectName) => {
20269
20294
  const removed = removeCloudRunConnection(opts.config, projectName);
20270
- if (removed) saveConfigPatch(opts.config);
20295
+ if (removed) persistConfigPatch(opts.config);
20271
20296
  return removed;
20272
20297
  }
20273
20298
  };
@@ -20277,7 +20302,7 @@ async function createServer(opts) {
20277
20302
  },
20278
20303
  upsertConnection: (record) => {
20279
20304
  const updated = upsertWordpressTrafficConnection(opts.config, record);
20280
- saveConfigPatch(opts.config);
20305
+ persistConfigPatch(opts.config);
20281
20306
  return updated;
20282
20307
  },
20283
20308
  deleteConnection: (projectName) => {
@@ -20285,7 +20310,7 @@ async function createServer(opts) {
20285
20310
  opts.config,
20286
20311
  projectName
20287
20312
  );
20288
- if (removed) saveConfigPatch(opts.config);
20313
+ if (removed) persistConfigPatch(opts.config);
20289
20314
  return removed;
20290
20315
  }
20291
20316
  };
@@ -20295,12 +20320,12 @@ async function createServer(opts) {
20295
20320
  },
20296
20321
  upsertConnection: (record) => {
20297
20322
  const updated = upsertVercelTrafficConnection(opts.config, record);
20298
- saveConfigPatch(opts.config);
20323
+ persistConfigPatch(opts.config);
20299
20324
  return updated;
20300
20325
  },
20301
20326
  deleteConnection: (projectName) => {
20302
20327
  const removed = removeVercelTrafficConnection(opts.config, projectName);
20303
- if (removed) saveConfigPatch(opts.config);
20328
+ if (removed) persistConfigPatch(opts.config);
20304
20329
  return removed;
20305
20330
  }
20306
20331
  };
@@ -20313,12 +20338,12 @@ async function createServer(opts) {
20313
20338
  },
20314
20339
  upsertConnection: (record) => {
20315
20340
  const updated = upsertCloudflareTrafficConnection(opts.config, record);
20316
- saveConfigPatch(opts.config);
20341
+ persistConfigPatch(opts.config);
20317
20342
  return updated;
20318
20343
  },
20319
20344
  deleteConnection: (projectName) => {
20320
20345
  const removed = removeCloudflareTrafficConnection(opts.config, projectName);
20321
- if (removed) saveConfigPatch(opts.config);
20346
+ if (removed) persistConfigPatch(opts.config);
20322
20347
  return removed;
20323
20348
  },
20324
20349
  deleteConnectionBySourceId: (sourceId) => {
@@ -20326,7 +20351,7 @@ async function createServer(opts) {
20326
20351
  opts.config,
20327
20352
  sourceId
20328
20353
  );
20329
- if (removed) saveConfigPatch(opts.config);
20354
+ if (removed) persistConfigPatch(opts.config);
20330
20355
  return removed;
20331
20356
  }
20332
20357
  };
@@ -20336,7 +20361,7 @@ async function createServer(opts) {
20336
20361
  getConnection: (domain, connectionType) => getGoogleConnection(opts.config, domain, connectionType),
20337
20362
  upsertConnection: (connection) => {
20338
20363
  const updated = upsertGoogleConnection(opts.config, connection);
20339
- saveConfigPatch(opts.config);
20364
+ persistConfigPatch(opts.config);
20340
20365
  return updated;
20341
20366
  },
20342
20367
  updateConnection: (domain, connectionType, patch) => {
@@ -20346,7 +20371,7 @@ async function createServer(opts) {
20346
20371
  connectionType,
20347
20372
  patch
20348
20373
  );
20349
- if (updated) saveConfigPatch(opts.config);
20374
+ if (updated) persistConfigPatch(opts.config);
20350
20375
  return updated;
20351
20376
  },
20352
20377
  deleteConnection: (domain, connectionType) => {
@@ -20355,7 +20380,7 @@ async function createServer(opts) {
20355
20380
  domain,
20356
20381
  connectionType
20357
20382
  );
20358
- if (removed) saveConfigPatch(opts.config);
20383
+ if (removed) persistConfigPatch(opts.config);
20359
20384
  return removed;
20360
20385
  }
20361
20386
  };
@@ -20365,17 +20390,17 @@ async function createServer(opts) {
20365
20390
  },
20366
20391
  upsertConnection: (connection) => {
20367
20392
  const updated = upsertWordpressConnection(opts.config, connection);
20368
- saveConfigPatch(opts.config);
20393
+ persistConfigPatch(opts.config);
20369
20394
  return updated;
20370
20395
  },
20371
20396
  updateConnection: (projectName, patch) => {
20372
20397
  const updated = patchWordpressConnection(opts.config, projectName, patch);
20373
- if (updated) saveConfigPatch(opts.config);
20398
+ if (updated) persistConfigPatch(opts.config);
20374
20399
  return updated;
20375
20400
  },
20376
20401
  deleteConnection: (projectName) => {
20377
20402
  const removed = removeWordpressConnection(opts.config, projectName);
20378
- if (removed) saveConfigPatch(opts.config);
20403
+ if (removed) persistConfigPatch(opts.config);
20379
20404
  return removed;
20380
20405
  }
20381
20406
  };
@@ -20611,7 +20636,7 @@ async function createServer(opts) {
20611
20636
  diff: { authorizedBy: presentedRootKey ? "root-api-key" : "local-request" }
20612
20637
  }));
20613
20638
  const created = createSession(defaultKey, true, tx);
20614
- saveConfigPatch(opts.config, { setDashboardPasswordHash: passwordHash });
20639
+ persistConfigPatch(opts.config, { setDashboardPasswordHash: passwordHash });
20615
20640
  return created;
20616
20641
  });
20617
20642
  } catch (err) {
@@ -20642,18 +20667,20 @@ async function createServer(opts) {
20642
20667
  password,
20643
20668
  opts.config.dashboardPasswordHash
20644
20669
  );
20645
- const onDisk = verification.ok && verification.needsRehash ? loadConfigRaw() : null;
20670
+ const onDisk = verification.ok && verification.needsRehash && persistedConfigPath !== void 0 ? loadConfigRaw(persistedConfigPath) : null;
20646
20671
  if (!verification.ok || onDisk && onDisk.dashboardPasswordHash !== opts.config.dashboardPasswordHash) {
20647
20672
  return reply.status(401).send({
20648
20673
  error: { code: "AUTH_INVALID", message: "Incorrect password" }
20649
20674
  });
20650
20675
  }
20651
20676
  if (verification.needsRehash) {
20652
- if (fs5.existsSync(getConfigPath()) && (!onDisk || typeof onDisk !== "object" || Array.isArray(onDisk) || !onDisk.apiUrl || !onDisk.database || !onDisk.apiKey)) {
20677
+ if (persistedConfigPath !== void 0 && fs5.existsSync(persistedConfigPath) && (!onDisk || typeof onDisk !== "object" || Array.isArray(onDisk) || !onDisk.apiUrl || !onDisk.database || !onDisk.apiKey)) {
20653
20678
  throw new Error("Cannot migrate dashboard password: config.yaml is unreadable or invalid");
20654
20679
  }
20655
20680
  const migratedHash = hashDashboardPassword(password);
20656
- saveConfig({ ...onDisk ?? opts.config, dashboardPasswordHash: migratedHash });
20681
+ if (persistedConfigPath !== void 0) {
20682
+ saveConfig({ ...onDisk ?? opts.config, dashboardPasswordHash: migratedHash }, persistedConfigPath);
20683
+ }
20657
20684
  opts.config.dashboardPasswordHash = migratedHash;
20658
20685
  }
20659
20686
  if (!createPasswordSession(reply)) {
@@ -21068,9 +21095,10 @@ async function createServer(opts) {
21068
21095
  }
21069
21096
  executeGscSync(opts.db, runId, projectId, {
21070
21097
  ...syncOpts,
21071
- config: opts.config
21098
+ config: opts.config,
21099
+ saveConfigPatch: persistConfigPatch
21072
21100
  }).then(
21073
- () => maybeRefreshGscCoverage(opts.db, opts.config, projectId, void 0, Date.now(), {
21101
+ () => maybeRefreshGscCoverage(opts.db, opts.config, projectId, coverageRefreshDeps, Date.now(), {
21074
21102
  userInitiated: runWasUserInitiated(opts.db, runId)
21075
21103
  })
21076
21104
  ).catch((err) => {
@@ -21088,7 +21116,8 @@ async function createServer(opts) {
21088
21116
  }
21089
21117
  executeInspectSitemap(opts.db, runId, projectId, {
21090
21118
  ...inspectOpts,
21091
- config: opts.config
21119
+ config: opts.config,
21120
+ saveConfigPatch: persistConfigPatch
21092
21121
  }).catch((err) => {
21093
21122
  app.log.error({ runId, err }, "Inspect sitemap failed");
21094
21123
  });
@@ -21259,7 +21288,7 @@ async function createServer(opts) {
21259
21288
  opts.db,
21260
21289
  opts.config,
21261
21290
  projectId,
21262
- void 0,
21291
+ coverageRefreshDeps,
21263
21292
  Date.now(),
21264
21293
  { userInitiated: runWasUserInitiated(opts.db, runId) }
21265
21294
  );
@@ -21361,7 +21390,7 @@ async function createServer(opts) {
21361
21390
  ...existing?.pricing ? { pricing: existing.pricing } : {}
21362
21391
  };
21363
21392
  try {
21364
- saveConfigPatch(fs5.existsSync(runtimeConfigPath) ? { providers: { [name]: opts.config.providers[name] } } : opts.config);
21393
+ persistConfigPatch(fs5.existsSync(runtimeConfigPath) ? { providers: { [name]: opts.config.providers[name] } } : opts.config);
21365
21394
  } catch (err) {
21366
21395
  app.log.error({ err }, "Failed to save config");
21367
21396
  return null;
@@ -21381,7 +21410,7 @@ async function createServer(opts) {
21381
21410
  onGoogleSettingsUpdate: (clientId, clientSecret) => {
21382
21411
  try {
21383
21412
  setGoogleAuthConfig(opts.config, { clientId, clientSecret });
21384
- saveConfigPatch(opts.config);
21413
+ persistConfigPatch(opts.config);
21385
21414
  googleSettingsSummary.configured = true;
21386
21415
  return { ...googleSettingsSummary };
21387
21416
  } catch (err) {
@@ -21393,7 +21422,7 @@ async function createServer(opts) {
21393
21422
  try {
21394
21423
  if (!opts.config.bing) opts.config.bing = {};
21395
21424
  opts.config.bing.apiKey = apiKey;
21396
- saveConfigPatch(opts.config);
21425
+ persistConfigPatch(opts.config);
21397
21426
  bingSettingsSummary.configured = true;
21398
21427
  return { ...bingSettingsSummary };
21399
21428
  } catch (err) {
@@ -21420,7 +21449,7 @@ async function createServer(opts) {
21420
21449
  const removedGoogleAds = removeGoogleAdsConnection(opts.config, projectId);
21421
21450
  const removedGtm = removeGtmConnection(opts.config, projectId);
21422
21451
  if (removedGoogleAds || removedGtm) {
21423
- saveConfigPatch({
21452
+ persistConfigPatch({
21424
21453
  googleAds: opts.config.googleAds,
21425
21454
  gtm: opts.config.gtm
21426
21455
  });
@@ -21438,10 +21467,12 @@ async function createServer(opts) {
21438
21467
  operatorApiKeyIds,
21439
21468
  listOperationalLogs: (query) => operationalLogs.list(query),
21440
21469
  getTelemetryStatus,
21441
- setTelemetryEnabled: (enabled, attribution) => {
21470
+ // The preference lives in the default config.yaml; a server running from
21471
+ // any other config leaves it alone, and the route answers 501.
21472
+ setTelemetryEnabled: ownsDefaultConfig ? (enabled, attribution) => {
21442
21473
  void setTelemetryPreference(enabled, "api", outcomeAttribution(attribution));
21443
21474
  opts.config.telemetry = enabled;
21444
- },
21475
+ } : void 0,
21445
21476
  recordOnboardingEvent: (event) => recordDashboardEvent(event),
21446
21477
  // Answers false while telemetry is off or the per-process cap is spent, so
21447
21478
  // the dashboard stops sending for the session.
@@ -21452,7 +21483,7 @@ async function createServer(opts) {
21452
21483
  opts.config.cdp.host = host;
21453
21484
  opts.config.cdp.port = port2;
21454
21485
  try {
21455
- saveConfigPatch(opts.config);
21486
+ persistConfigPatch(opts.config);
21456
21487
  } catch (err) {
21457
21488
  app.log.error({ err }, "Failed to save CDP config");
21458
21489
  throw err;
@@ -2,7 +2,7 @@ import {
2
2
  configExists,
3
3
  loadConfigRaw,
4
4
  saveConfigPatch
5
- } from "./chunk-IFLPQ5RQ.js";
5
+ } from "./chunk-7JC4Z6FQ.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-7JC4Z6FQ.js";
14
14
  import {
15
15
  isMachineFormat
16
16
  } from "./chunk-HGMYEDAQ.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-WYQQTWUB.js";
3
+ } from "./chunk-JRVKW4OO.js";
4
4
  import {
5
5
  emitJsonl
6
6
  } from "./chunk-Z7IUAJOF.js";
@@ -2,10 +2,10 @@ import {
2
2
  bucketCliCommandDuration,
3
3
  isTelemetryEnabled,
4
4
  trackEvent
5
- } from "./chunk-IUVJLNW4.js";
5
+ } from "./chunk-6KPBYCPE.js";
6
6
  import {
7
7
  getConfigDir
8
- } from "./chunk-IFLPQ5RQ.js";
8
+ } from "./chunk-7JC4Z6FQ.js";
9
9
  import {
10
10
  currentOutcomeAttribution
11
11
  } from "./chunk-JPOIDGGF.js";
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  configExists,
6
6
  loadConfigRaw
7
- } from "./chunk-IFLPQ5RQ.js";
7
+ } from "./chunk-7JC4Z6FQ.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-PJXATOSY.js");
51
51
  await serveCommand(format);
52
52
  }
53
53
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  loadConfig
3
- } from "./chunk-IFLPQ5RQ.js";
3
+ } from "./chunk-7JC4Z6FQ.js";
4
4
  import {
5
5
  PACKAGE_VERSION
6
6
  } from "./chunk-AOJU5LKX.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-JRVKW4OO.js";
8
8
  import {
9
9
  CliError,
10
10
  isMachineFormat
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  createApiClient,
8
8
  runWithUsageTags
9
- } from "./chunk-WYQQTWUB.js";
9
+ } from "./chunk-JRVKW4OO.js";
10
10
  import {
11
11
  canonryMcpTools,
12
12
  mcpOutputSchema,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runWithUsageTags
3
- } from "./chunk-WYQQTWUB.js";
3
+ } from "./chunk-JRVKW4OO.js";
4
4
  import {
5
5
  CanonryMcpToolNames,
6
6
  canonryMcpTools