@canonry/canonry 7.125.3 → 7.125.4

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 (119) hide show
  1. package/dist/activity-KCUWSNHF.js +13 -0
  2. package/dist/{ads-CKWRWWUL.js → ads-6ZCVMSJ2.js} +4 -4
  3. package/dist/{agent-ESSNC46H.js → agent-ZZJO7ET6.js} +8 -8
  4. package/dist/{agent-ask-37D6WCPX.js → agent-ask-CPRHVULM.js} +4 -4
  5. package/dist/{agent-conversations-GKY7Q2IO.js → agent-conversations-NIWKSUC2.js} +4 -4
  6. package/dist/{agent-journeys-FIH4K5PI.js → agent-journeys-SHNRNV5E.js} +4 -4
  7. package/dist/{agent-memory-FXWCBJRP.js → agent-memory-4IGCNFR5.js} +4 -4
  8. package/dist/{agent-providers-5AKSFZHC.js → agent-providers-3Q7NQS7Y.js} +4 -4
  9. package/dist/{agent-transcript-F4HO6LWW.js → agent-transcript-M3NYHNNV.js} +4 -4
  10. package/dist/{analytics-GJRUFRVW.js → analytics-UHBUOG4T.js} +4 -4
  11. package/dist/{answerability-L5MS4AKC.js → answerability-IRXQDOBX.js} +4 -4
  12. package/dist/{apply-ZZQIJN4W.js → apply-3HP75CA2.js} +4 -4
  13. package/dist/{backfill-WK2FPQA7.js → backfill-Y6M5HPT7.js} +11 -11
  14. package/dist/{backlinks-53DXYL4A.js → backlinks-O5IYHDAY.js} +4 -4
  15. package/dist/{bing-6G7LXZDT.js → bing-2MTKNQB2.js} +4 -4
  16. package/dist/{bootstrap-ESCW4ZGJ.js → bootstrap-O7FRHURI.js} +11 -11
  17. package/dist/{cdp-BR54QYDW.js → cdp-BTXUJFAN.js} +8 -8
  18. package/dist/{chunk-27MI43WQ.js → chunk-2MDEKCDU.js} +7 -12
  19. package/dist/{chunk-2T4IZBIB.js → chunk-32LTZWWW.js} +1 -1
  20. package/dist/{chunk-OC35PZAC.js → chunk-35NITZHC.js} +1 -1
  21. package/dist/{chunk-73ANFHPL.js → chunk-3FQMXAES.js} +4 -4
  22. package/dist/{chunk-G46YLF5X.js → chunk-3G5FQLF7.js} +2 -2
  23. package/dist/{chunk-LEW6WFYV.js → chunk-3OZ5WKRH.js} +1 -0
  24. package/dist/{chunk-J3C4XFWJ.js → chunk-A75GIIWP.js} +1 -1
  25. package/dist/{chunk-6ZL5ILQI.js → chunk-C5EK4TJ5.js} +3 -3
  26. package/dist/{chunk-P42TP4BJ.js → chunk-CD3XPOHP.js} +1 -1
  27. package/dist/{chunk-OZRJ73XU.js → chunk-DI5EEYDP.js} +2 -2
  28. package/dist/{chunk-7V3V5H7L.js → chunk-E57WK3OU.js} +5 -5
  29. package/dist/{chunk-FM56GWUC.js → chunk-EE73V5GU.js} +372 -372
  30. package/dist/{chunk-B63ZO4TX.js → chunk-FJRPVC6N.js} +6 -6
  31. package/dist/{chunk-P2RFC35A.js → chunk-IDMWQASY.js} +5 -5
  32. package/dist/{chunk-7Q5OVRVX.js → chunk-JTIFRAGE.js} +3 -3
  33. package/dist/{chunk-EWJKPCIT.js → chunk-K7BROEPL.js} +3 -3
  34. package/dist/{chunk-QFGEFEKV.js → chunk-KIO37ZVB.js} +4 -4
  35. package/dist/{chunk-ODEDQ4Z7.js → chunk-MB7VQPWX.js} +2 -2
  36. package/dist/{chunk-JXKRQ63F.js → chunk-ML7G6NS3.js} +2 -2
  37. package/dist/{chunk-FJHPA47P.js → chunk-OH3HQENA.js} +4 -4
  38. package/dist/{chunk-6E7BS7BA.js → chunk-OINP576M.js} +5 -5
  39. package/dist/{chunk-TZ5ALARK.js → chunk-OL6HAMWW.js} +2 -2
  40. package/dist/{chunk-2JMNIWOG.js → chunk-PAP62URW.js} +4 -4
  41. package/dist/{chunk-OXM2WUTJ.js → chunk-PDSB34VB.js} +1 -1
  42. package/dist/{chunk-R2F5JHCB.js → chunk-QCEXADUT.js} +2 -2
  43. package/dist/{chunk-EEYFNSVL.js → chunk-QQFTJVHT.js} +1 -1
  44. package/dist/{chunk-C7IGAN7U.js → chunk-QRA6GFXX.js} +1 -1
  45. package/dist/{chunk-Y7Y3GDOM.js → chunk-RSZ3L5FJ.js} +1 -1
  46. package/dist/{chunk-Z7TP2GD4.js → chunk-U2LYHQHF.js} +1 -1
  47. package/dist/{chunk-YKB75BPD.js → chunk-UG3NPUZQ.js} +4 -4
  48. package/dist/{chunk-XLJWITPC.js → chunk-UHUPDKPT.js} +8 -8
  49. package/dist/{chunk-DFEVW234.js → chunk-UU3EPUFY.js} +27 -25
  50. package/dist/{chunk-MXDKDPRJ.js → chunk-VD6Q7ZUX.js} +1 -1
  51. package/dist/{chunk-WHH3XSRE.js → chunk-VP3F4BOG.js} +2 -2
  52. package/dist/{chunk-SP44JHI4.js → chunk-VUL3BACZ.js} +4 -4
  53. package/dist/{chunk-HN6UIFHO.js → chunk-XQUGLXAN.js} +2 -2
  54. package/dist/{chunk-FBVCBRXQ.js → chunk-YYBYRAMI.js} +4 -4
  55. package/dist/{chunk-ZI5JGJFY.js → chunk-ZA624A36.js} +54 -30
  56. package/dist/{citations-ZIDSGKRU.js → citations-5JSLIPNI.js} +5 -5
  57. package/dist/{cli-catalog-6LW7C6JJ.js → cli-catalog-U3DKCQC5.js} +4 -4
  58. package/dist/cli-commands-RKEFA6I6.js +18 -0
  59. package/dist/cli.js +14 -14
  60. package/dist/{competitor-SL756CGS.js → competitor-AMA7WPH4.js} +4 -4
  61. package/dist/{content-K57ZUYTK.js → content-7HZ23UXM.js} +4 -4
  62. package/dist/{dashboard-XKP2Z7NL.js → dashboard-7DH4DFSJ.js} +7 -7
  63. package/dist/{demo-3KROYDH3.js → demo-FWGWENAZ.js} +3 -3
  64. package/dist/{demo-server-E7LTZ55I.js → demo-server-MQDIL5YL.js} +13 -13
  65. package/dist/{discover-RWVSCRJU.js → discover-TJXKEHVP.js} +5 -5
  66. package/dist/{discover-eval-N4M5JU6F.js → discover-eval-MUS46MSL.js} +4 -4
  67. package/dist/{doctor-NW4FDB77.js → doctor-5CIMYYUA.js} +4 -4
  68. package/dist/{evidence-FMUJNJSJ.js → evidence-MY4Z6VNC.js} +4 -4
  69. package/dist/{export-cmd-VALOYBEX.js → export-cmd-VBULRDSJ.js} +4 -4
  70. package/dist/{ga-DPMYKD4B.js → ga-ORQCNNJ6.js} +4 -4
  71. package/dist/{gbp-AVZSBYRE.js → gbp-LWVNCHMT.js} +4 -4
  72. package/dist/{google-YU4U7NGP.js → google-U6LQOAQ3.js} +5 -5
  73. package/dist/{google-marketing-6QVRXGBM.js → google-marketing-6RA4AOMN.js} +2 -2
  74. package/dist/{health-cmd-WWLJRTUO.js → health-cmd-LQGRFFT3.js} +5 -5
  75. package/dist/{history-TTA7FGQW.js → history-LYJAA6QI.js} +4 -4
  76. package/dist/index.d.ts +78 -78
  77. package/dist/index.js +26 -26
  78. package/dist/{init-7HJIOE4N.js → init-VSBN3TWT.js} +13 -13
  79. package/dist/{insights-Q5D55GAR.js → insights-OP7ZJLC5.js} +4 -4
  80. package/dist/intelligence-service-HMCHOTG5.js +15 -0
  81. package/dist/{journeys-6TQ4XKFU.js → journeys-ENN25PA5.js} +4 -4
  82. package/dist/{keys-GEKZTCDB.js → keys-FVPHQIOM.js} +4 -4
  83. package/dist/{keyword-RFOYIC3F.js → keyword-ELCUWNQC.js} +4 -4
  84. package/dist/{logs-JVV3JWBY.js → logs-SVKY3HXZ.js} +4 -4
  85. package/dist/{mcp-F5UBBUYS.js → mcp-W7AMWAST.js} +5 -5
  86. package/dist/mcp.js +10 -10
  87. package/dist/{measurement-plan-3MBPWMKF.js → measurement-plan-F3ZZ4MCG.js} +6 -6
  88. package/dist/{notify-I6PK7D5F.js → notify-U253YRTY.js} +4 -4
  89. package/dist/{organic-evidence-XGMEFGZV.js → organic-evidence-4GI6HG56.js} +4 -4
  90. package/dist/{overview-3CXTYKPK.js → overview-TPZI3OKL.js} +7 -7
  91. package/dist/{project-NODDRMYN.js → project-BZPMAZAH.js} +4 -4
  92. package/dist/{project-setup-O2ZHNOQA.js → project-setup-2NSUAFXD.js} +4 -4
  93. package/dist/{query-FS5JMNWT.js → query-4AL5P6DI.js} +4 -4
  94. package/dist/{research-PAQYTNO7.js → research-3WAJ6RWX.js} +4 -4
  95. package/dist/{results-export-SXJ7QORQ.js → results-export-VHA6BPC2.js} +4 -4
  96. package/dist/{run-AKHP63FR.js → run-3EEHYWIA.js} +6 -6
  97. package/dist/{schedule-4UJCAZRL.js → schedule-7CXVWV75.js} +4 -4
  98. package/dist/{search-M6F2BKN5.js → search-EPPXH2TK.js} +4 -4
  99. package/dist/{serve-M5CIAJQP.js → serve-CFXNLGUP.js} +27 -27
  100. package/dist/{session-FTWUJBXC.js → session-HATLEN7J.js} +14 -14
  101. package/dist/{settings-UYXGO73G.js → settings-UKIPQVIX.js} +4 -4
  102. package/dist/{sitemaps-UFZAM5AM.js → sitemaps-L2OOCCHX.js} +4 -4
  103. package/dist/{skills-CST64NUF.js → skills-VJSJNLWC.js} +3 -3
  104. package/dist/{snapshot-R7M77CR2.js → snapshot-SYVUVM7F.js} +4 -4
  105. package/dist/{src-NPY2WNGF.js → src-VYDX5USM.js} +2 -2
  106. package/dist/{status-NWAVNBJC.js → status-ALZWCQ7W.js} +6 -6
  107. package/dist/{support-AJYIPDYH.js → support-XRKYBNND.js} +2 -2
  108. package/dist/{technical-aeo-HNEUXZZ4.js → technical-aeo-JNYI6Q7L.js} +4 -4
  109. package/dist/{telemetry-4HMLYE5C.js → telemetry-ZENJ5BDE.js} +5 -5
  110. package/dist/{tools-HQ5AFHJ2.js → tools-L7J5NNSY.js} +12 -12
  111. package/dist/{traffic-MGZDVEAM.js → traffic-YWF6EAN7.js} +6 -6
  112. package/dist/{trends-NMJFTKOE.js → trends-3755UQT3.js} +4 -4
  113. package/dist/{users-HWBPRVSG.js → users-7XCGU7BU.js} +4 -4
  114. package/dist/{visibility-stats-DALS5MUL.js → visibility-stats-QJBO7HFN.js} +5 -5
  115. package/dist/{wordpress-23RX6PVT.js → wordpress-VC6UN5UK.js} +4 -4
  116. package/package.json +1 -1
  117. package/dist/activity-MYEOLXH7.js +0 -13
  118. package/dist/cli-commands-MAM3MHKR.js +0 -18
  119. package/dist/intelligence-service-EIVZPZDC.js +0 -15
@@ -5,7 +5,7 @@ import {
5
5
  loadConfig,
6
6
  loadConfigRaw,
7
7
  saveConfigPatch
8
- } from "./chunk-WHH3XSRE.js";
8
+ } from "./chunk-VP3F4BOG.js";
9
9
  import {
10
10
  CANONRY_NPM_PACKAGE_URL,
11
11
  compareSemver,
@@ -18,7 +18,7 @@ import {
18
18
  updateCheckEnvOptOut,
19
19
  upgradeCaveatFor,
20
20
  upgradeCommandFor
21
- } from "./chunk-LEW6WFYV.js";
21
+ } from "./chunk-3OZ5WKRH.js";
22
22
 
23
23
  // src/runtime-context.ts
24
24
  function cliRuntimeContext(env = process.env, stdio = process) {
@@ -7,25 +7,25 @@ import {
7
7
  import {
8
8
  createApiClient,
9
9
  runWithUsageTags
10
- } from "./chunk-27MI43WQ.js";
10
+ } from "./chunk-2MDEKCDU.js";
11
11
  import {
12
12
  canonryMcpTools,
13
13
  mcpOutputSchema,
14
14
  toolOperationAccess
15
- } from "./chunk-2JMNIWOG.js";
15
+ } from "./chunk-PAP62URW.js";
16
16
  import {
17
17
  PACKAGE_VERSION
18
18
  } from "./chunk-AOJU5LKX.js";
19
19
  import {
20
20
  CliError
21
- } from "./chunk-EEYFNSVL.js";
21
+ } from "./chunk-QQFTJVHT.js";
22
22
  import {
23
23
  OperationAccesses,
24
24
  RESEARCH_RUN_SCOPE,
25
25
  isReadOnlyKey,
26
26
  restrictedWriteScopes,
27
27
  upgradeCaveatFor
28
- } from "./chunk-LEW6WFYV.js";
28
+ } from "./chunk-3OZ5WKRH.js";
29
29
 
30
30
  // src/mcp/server.ts
31
31
  import { randomUUID } from "crypto";
@@ -19,14 +19,14 @@ import {
19
19
  normalizeTrafficPathPattern,
20
20
  sessionizeJourneyRequests,
21
21
  verifyRequestSignature
22
- } from "./chunk-2T4IZBIB.js";
22
+ } from "./chunk-32LTZWWW.js";
23
23
  import {
24
24
  currentOutcomeAttribution,
25
25
  getRequestContext,
26
26
  registerRequestContext,
27
27
  requestAuditIdentity,
28
28
  sanitizeRequestContext
29
- } from "./chunk-J3C4XFWJ.js";
29
+ } from "./chunk-A75GIIWP.js";
30
30
  import {
31
31
  RawEventSampleEventTypes,
32
32
  SentimentIdempotencyConflict,
@@ -191,7 +191,7 @@ import {
191
191
  userSessions,
192
192
  users,
193
193
  writeNegativeReviewMaxStars
194
- } from "./chunk-OC35PZAC.js";
194
+ } from "./chunk-35NITZHC.js";
195
195
  import {
196
196
  ADS_ACTIVATE_SCOPE,
197
197
  ADS_ACTIVATION_ABSOLUTE_MAX_ENTITIES,
@@ -568,6 +568,7 @@ import {
568
568
  apiKeyListDtoSchema,
569
569
  applyHarvestSemanticNovelty,
570
570
  applyPreviewDtoSchema,
571
+ asRecord,
571
572
  auditHistoryQuerySchema,
572
573
  auditLogEntrySchema,
573
574
  authInvalid,
@@ -1406,7 +1407,7 @@ import {
1406
1407
  wordpressSchemaDeployResultDtoSchema,
1407
1408
  wordpressSchemaStatusResultDtoSchema,
1408
1409
  wordpressStatusDtoSchema
1409
- } from "./chunk-LEW6WFYV.js";
1410
+ } from "./chunk-3OZ5WKRH.js";
1410
1411
 
1411
1412
  // ../api-routes/src/user-session.ts
1412
1413
  import crypto2 from "crypto";
@@ -58758,7 +58759,7 @@ async function googleRoutes(app, opts) {
58758
58759
  const project = resolveProject(app.db, request.params.name);
58759
58760
  const conn = store.getConnection(project.canonicalDomain, "gsc");
58760
58761
  if (!conn) {
58761
- throw validationError('No GSC connection found for this domain. Run "canonry google connect" first.');
58762
+ throw integrationNotConnected('No GSC connection found for this domain. Run "canonry google connect" first.');
58762
58763
  }
58763
58764
  const now = (/* @__PURE__ */ new Date()).toISOString();
58764
58765
  const runId = crypto47.randomUUID();
@@ -60311,10 +60312,15 @@ function normalizeConversionTrackingContractWrite(input) {
60311
60312
  }
60312
60313
  };
60313
60314
  }
60314
- function requiredCredential(opts, project, provider) {
60315
- const credential = opts.googleMarketingCredentialStore?.get(project, provider);
60315
+ function requiredCredential(app, opts, project, provider) {
60316
+ const credential = requireCredentialStore(opts).get(project, provider);
60316
60317
  if (!credential?.accessToken) {
60317
- throw integrationNotConnected(`No ${provider === GoogleMarketingProviders["google-ads"] ? "Google Ads" : "Google Tag Manager"} OAuth connection is available for this project.`);
60318
+ const label = provider === GoogleMarketingProviders["google-ads"] ? "Google Ads" : "Google Tag Manager";
60319
+ const connection = provider === GoogleMarketingProviders["google-ads"] ? app.db.select({ id: googleAdsConnections.id }).from(googleAdsConnections).where(eq100(googleAdsConnections.projectId, project.id)).get() : app.db.select({ id: gtmConnections.id }).from(gtmConnections).where(eq100(gtmConnections.projectId, project.id)).get();
60320
+ if (credential || connection) {
60321
+ throw validationError(`Saved ${label} OAuth credentials are unavailable. Reconnect before retrying.`);
60322
+ }
60323
+ throw integrationNotConnected(`No ${label} OAuth connection is available for this project.`);
60318
60324
  }
60319
60325
  return credential;
60320
60326
  }
@@ -61196,7 +61202,7 @@ async function googleMarketingRoutes(app, opts) {
61196
61202
  assertNotProjectScoped(request, "listing Google Ads customers");
61197
61203
  const project = resolveProject(app.db, request.params.name);
61198
61204
  const projectRef = asProjectRef(project);
61199
- requiredCredential(opts, projectRef, GoogleMarketingProviders["google-ads"]);
61205
+ requiredCredential(app, opts, projectRef, GoogleMarketingProviders["google-ads"]);
61200
61206
  const reader = requireLiveReader(opts);
61201
61207
  let result;
61202
61208
  try {
@@ -61211,7 +61217,7 @@ async function googleMarketingRoutes(app, opts) {
61211
61217
  assertNotProjectScoped(request, "listing Google Tag Manager accounts");
61212
61218
  const project = resolveProject(app.db, request.params.name);
61213
61219
  const projectRef = asProjectRef(project);
61214
- requiredCredential(opts, projectRef, GoogleMarketingProviders.gtm);
61220
+ requiredCredential(app, opts, projectRef, GoogleMarketingProviders.gtm);
61215
61221
  const reader = requireLiveReader(opts);
61216
61222
  try {
61217
61223
  return gtmAccountsResponseSchema.parse(await reader.listGtmAccounts(projectRef));
@@ -61224,7 +61230,7 @@ async function googleMarketingRoutes(app, opts) {
61224
61230
  assertNotProjectScoped(request, "listing Google Tag Manager containers");
61225
61231
  const project = resolveProject(app.db, request.params.name);
61226
61232
  const projectRef = asProjectRef(project);
61227
- requiredCredential(opts, projectRef, GoogleMarketingProviders.gtm);
61233
+ requiredCredential(app, opts, projectRef, GoogleMarketingProviders.gtm);
61228
61234
  const accountId = canonicalizeGtmAccountId(request.params.accountId);
61229
61235
  if (!accountId) throw validationError("Invalid GTM account resource path.");
61230
61236
  const reader = requireLiveReader(opts);
@@ -61239,7 +61245,7 @@ async function googleMarketingRoutes(app, opts) {
61239
61245
  assertNotProjectScoped(request, "listing Google Tag Manager workspaces");
61240
61246
  const project = resolveProject(app.db, request.params.name);
61241
61247
  const projectRef = asProjectRef(project);
61242
- requiredCredential(opts, projectRef, GoogleMarketingProviders.gtm);
61248
+ requiredCredential(app, opts, projectRef, GoogleMarketingProviders.gtm);
61243
61249
  const selection = canonicalizeGtmResourceSelection({
61244
61250
  accountId: request.params.accountId,
61245
61251
  containerId: request.params.containerId
@@ -61285,9 +61291,9 @@ async function googleMarketingRoutes(app, opts) {
61285
61291
  const project = resolveProject(app.db, request.params.name);
61286
61292
  const projectRef = asProjectRef(project);
61287
61293
  try {
61288
- requiredCredential(opts, projectRef, GoogleMarketingProviders["google-ads"]);
61294
+ requiredCredential(app, opts, projectRef, GoogleMarketingProviders["google-ads"]);
61289
61295
  } catch (err) {
61290
- attempt.failed(err, "NOT_CONNECTED");
61296
+ attempt.failed(err);
61291
61297
  throw err;
61292
61298
  }
61293
61299
  const existing = app.db.select().from(googleAdsConnections).where(eq100(googleAdsConnections.projectId, project.id)).get();
@@ -61336,9 +61342,9 @@ async function googleMarketingRoutes(app, opts) {
61336
61342
  const project = resolveProject(app.db, request.params.name);
61337
61343
  const projectRef = asProjectRef(project);
61338
61344
  try {
61339
- requiredCredential(opts, projectRef, GoogleMarketingProviders.gtm);
61345
+ requiredCredential(app, opts, projectRef, GoogleMarketingProviders.gtm);
61340
61346
  } catch (err) {
61341
- attempt.failed(err, "NOT_CONNECTED");
61347
+ attempt.failed(err);
61342
61348
  throw err;
61343
61349
  }
61344
61350
  const existing = app.db.select().from(gtmConnections).where(eq100(gtmConnections.projectId, project.id)).get();
@@ -61387,9 +61393,9 @@ async function googleMarketingRoutes(app, opts) {
61387
61393
  throw notImplemented("Google Ads sync is not configured for this deployment.");
61388
61394
  }
61389
61395
  const project = resolveProject(app.db, request.params.name);
61390
- requiredCredential(opts, asProjectRef(project), GoogleMarketingProviders["google-ads"]);
61396
+ requiredCredential(app, opts, asProjectRef(project), GoogleMarketingProviders["google-ads"]);
61391
61397
  const connection = app.db.select().from(googleAdsConnections).where(eq100(googleAdsConnections.projectId, project.id)).get();
61392
- if (!connection) throw validationError("Connect Google Ads before starting a sync.");
61398
+ if (!connection) throw integrationNotConnected("Connect Google Ads before starting a sync.");
61393
61399
  const candidateRun = queuedRun(project.id, RunKinds["google-ads-sync"], project.name, opts.claimScheduledSync);
61394
61400
  let run = candidateRun;
61395
61401
  let queued = false;
@@ -61423,9 +61429,9 @@ async function googleMarketingRoutes(app, opts) {
61423
61429
  throw notImplemented("Google Tag Manager sync is not configured for this deployment.");
61424
61430
  }
61425
61431
  const project = resolveProject(app.db, request.params.name);
61426
- requiredCredential(opts, asProjectRef(project), GoogleMarketingProviders.gtm);
61432
+ requiredCredential(app, opts, asProjectRef(project), GoogleMarketingProviders.gtm);
61427
61433
  const connection = app.db.select().from(gtmConnections).where(eq100(gtmConnections.projectId, project.id)).get();
61428
- if (!connection) throw validationError("Connect Google Tag Manager before starting a sync.");
61434
+ if (!connection) throw integrationNotConnected("Connect Google Tag Manager before starting a sync.");
61429
61435
  const candidateRun = queuedRun(project.id, RunKinds["gtm-sync"], project.name, opts.claimScheduledSync);
61430
61436
  let run = candidateRun;
61431
61437
  let queued = false;
@@ -68010,7 +68016,7 @@ async function bingRoutes(app, opts) {
68010
68016
  function requireConnection(store, domain) {
68011
68017
  const conn = store.getConnection(domain);
68012
68018
  if (!conn) {
68013
- throw validationError('No Bing connection found for this domain. Run "canonry bing connect <project>" first.');
68019
+ throw integrationNotConnected('No Bing connection found for this domain. Run "canonry bing connect <project>" first.');
68014
68020
  }
68015
68021
  return conn;
68016
68022
  }
@@ -70166,6 +70172,17 @@ async function ga4Routes(app, opts) {
70166
70172
  if (only !== void 0 && !gaSyncOnlySchema.safeParse(only).success) {
70167
70173
  throw validationError(`Invalid "only" value "${only}". Must be one of: ${gaSyncOnlySchema.options.join(", ")}`);
70168
70174
  }
70175
+ const outcome2 = startRouteOutcome(app, FeatureNames.ga4, "sync");
70176
+ const serviceAccount = opts.ga4CredentialStore?.getConnection(project.name);
70177
+ const oauth = opts.googleConnectionStore?.getConnection(project.canonicalDomain, "ga4");
70178
+ if (!serviceAccount && !oauth) {
70179
+ const auth = opts.ga4CredentialStore ? void 0 : opts.getGoogleAuthConfig?.();
70180
+ if (opts.ga4CredentialStore || opts.googleConnectionStore && auth?.clientId && auth.clientSecret) {
70181
+ const error = integrationNotConnected('No GA4 connection found. Run "canonry ga connect <project>" first.');
70182
+ outcome2.report({ status: OutcomeStatuses.failed, ...classifyOutcomeError(error) });
70183
+ throw error;
70184
+ }
70185
+ }
70169
70186
  const syncTraffic = true;
70170
70187
  const syncSummary = true;
70171
70188
  const syncAi = !only || only === "ai";
@@ -70187,7 +70204,6 @@ async function ga4Routes(app, opts) {
70187
70204
  startedAt,
70188
70205
  createdAt: startedAt
70189
70206
  }).run();
70190
- const outcome2 = startRouteOutcome(app, FeatureNames.ga4, "sync");
70191
70207
  let credentialsResolved = false;
70192
70208
  let componentFailure;
70193
70209
  try {
@@ -70656,9 +70672,17 @@ async function ga4Routes(app, opts) {
70656
70672
  } catch (e) {
70657
70673
  const msg = describeError(e);
70658
70674
  gaLog("error", "sync.fetch-failed", { projectId: project.id, runId, error: msg });
70659
- app.db.update(runs).set({ status: RunStatuses.failed, error: msg, finishedAt: (/* @__PURE__ */ new Date()).toISOString() }).where(eq110(runs.id, runId)).run();
70675
+ const saved = app.db.update(runs).set({ status: RunStatuses.failed, error: msg, finishedAt: (/* @__PURE__ */ new Date()).toISOString() }).where(eq110(runs.id, runId)).run().changes === 1;
70660
70676
  outcome2.report({ status: OutcomeStatuses.failed, ...ga4SyncFailure(e, credentialsResolved, opts, project) });
70661
- throw e;
70677
+ if (!saved) throw e;
70678
+ if (e instanceof AppError) {
70679
+ throw new AppError(e.code, e.message, e.statusCode, { ...e.details, runId });
70680
+ }
70681
+ const error = asRecord(e);
70682
+ const httpStatus = error?.statusCode ?? error?.status ?? 500;
70683
+ if (typeof httpStatus === "number" && httpStatus >= 400 && httpStatus < 500) throw e;
70684
+ app.log.error(e);
70685
+ throw internalError("An unexpected error occurred", { runId });
70662
70686
  }
70663
70687
  });
70664
70688
  app.get("/projects/:name/ga/traffic", async (request, _reply) => {
@@ -74885,7 +74909,7 @@ async function requestJson(options, request, signal) {
74885
74909
  sleep: options.sleep
74886
74910
  });
74887
74911
  }
74888
- function asRecord(value, label) {
74912
+ function asRecord2(value, label) {
74889
74913
  if (value == null || typeof value !== "object" || Array.isArray(value)) {
74890
74914
  throw new CloudflareQueueApiError(`Cloudflare Queue ${label} is malformed`, 502);
74891
74915
  }
@@ -74906,7 +74930,7 @@ function stringField(record3, key, label) {
74906
74930
  return value;
74907
74931
  }
74908
74932
  function metadata(record3) {
74909
- const value = asRecord(record3.metadata, "message metadata");
74933
+ const value = asRecord2(record3.metadata, "message metadata");
74910
74934
  const parsed = {};
74911
74935
  for (const [key, entry] of Object.entries(value)) {
74912
74936
  if (typeof entry !== "string") {
@@ -75011,11 +75035,11 @@ function decodeMessage(record3) {
75011
75035
  return poison("unsupported-content-type");
75012
75036
  }
75013
75037
  function parsePullEnvelope(value) {
75014
- const envelope = asRecord(value, "pull response");
75038
+ const envelope = asRecord2(value, "pull response");
75015
75039
  if (envelope.success !== true) {
75016
75040
  throw new CloudflareQueueApiError("Cloudflare Queue pull was not successful", 502);
75017
75041
  }
75018
- const result = asRecord(envelope.result, "pull result");
75042
+ const result = asRecord2(envelope.result, "pull result");
75019
75043
  const messageBacklogCount = nonNegativeInteger(result.message_backlog_count, "message_backlog_count");
75020
75044
  if (!Array.isArray(result.messages)) {
75021
75045
  throw new CloudflareQueueApiError("Cloudflare Queue messages is malformed", 502);
@@ -75055,12 +75079,12 @@ function ackWarningCount(value) {
75055
75079
  return Object.keys(warnings).length;
75056
75080
  }
75057
75081
  function parseAckEnvelope(value, expectedAckCount, expectedRetryCount) {
75058
- const envelope = asRecord(value, "ack response");
75082
+ const envelope = asRecord2(value, "ack response");
75059
75083
  if (envelope.success !== true) {
75060
75084
  throw new CloudflareQueueApiError("Cloudflare Queue acknowledgement was not successful", 502);
75061
75085
  }
75062
75086
  if (envelope.result == null) return 0;
75063
- const result = asRecord(envelope.result, "ack result");
75087
+ const result = asRecord2(envelope.result, "ack result");
75064
75088
  const ackCount = optionalAckCount(result, "ackCount");
75065
75089
  const retryCount = optionalAckCount(result, "retryCount");
75066
75090
  if (ackCount !== void 0 && ackCount !== expectedAckCount || retryCount !== void 0 && retryCount !== expectedRetryCount) {
@@ -3,19 +3,19 @@ import {
3
3
  citationGlyph,
4
4
  citedBase,
5
5
  mentionGlyph
6
- } from "./chunk-MXDKDPRJ.js";
6
+ } from "./chunk-VD6Q7ZUX.js";
7
7
  import {
8
8
  createApiClient
9
- } from "./chunk-27MI43WQ.js";
10
- import "./chunk-WHH3XSRE.js";
9
+ } from "./chunk-2MDEKCDU.js";
10
+ import "./chunk-VP3F4BOG.js";
11
11
  import {
12
12
  emitJsonl
13
13
  } from "./chunk-Z7IUAJOF.js";
14
14
  import "./chunk-AOJU5LKX.js";
15
15
  import {
16
16
  isMachineFormat
17
- } from "./chunk-EEYFNSVL.js";
18
- import "./chunk-LEW6WFYV.js";
17
+ } from "./chunk-QQFTJVHT.js";
18
+ import "./chunk-3OZ5WKRH.js";
19
19
 
20
20
  // src/commands/citations.ts
21
21
  async function showCitationVisibility(project, opts) {
@@ -3,11 +3,11 @@ import {
3
3
  buildCliCatalog,
4
4
  printCliCatalog,
5
5
  renderTopLevelHelp
6
- } from "./chunk-QFGEFEKV.js";
7
- import "./chunk-JXKRQ63F.js";
6
+ } from "./chunk-KIO37ZVB.js";
7
+ import "./chunk-ML7G6NS3.js";
8
8
  import "./chunk-Z7IUAJOF.js";
9
- import "./chunk-EEYFNSVL.js";
10
- import "./chunk-LEW6WFYV.js";
9
+ import "./chunk-QQFTJVHT.js";
10
+ import "./chunk-3OZ5WKRH.js";
11
11
  export {
12
12
  CLI_ROOT_SUMMARIES,
13
13
  buildCliCatalog,
@@ -0,0 +1,18 @@
1
+ import {
2
+ REGISTERED_CLI_COMMANDS
3
+ } from "./chunk-EE73V5GU.js";
4
+ import "./chunk-6GO5VVAC.js";
5
+ import "./chunk-VJWDBFSL.js";
6
+ import "./chunk-VUL3BACZ.js";
7
+ import "./chunk-TSENU4GG.js";
8
+ import "./chunk-2MDEKCDU.js";
9
+ import "./chunk-VP3F4BOG.js";
10
+ import "./chunk-ML7G6NS3.js";
11
+ import "./chunk-Z7IUAJOF.js";
12
+ import "./chunk-PDSB34VB.js";
13
+ import "./chunk-AOJU5LKX.js";
14
+ import "./chunk-QQFTJVHT.js";
15
+ import "./chunk-3OZ5WKRH.js";
16
+ export {
17
+ REGISTERED_CLI_COMMANDS
18
+ };
package/dist/cli.js CHANGED
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node --import tsx
2
2
  import {
3
3
  REGISTERED_CLI_COMMANDS
4
- } from "./chunk-FM56GWUC.js";
4
+ } from "./chunk-EE73V5GU.js";
5
5
  import "./chunk-6GO5VVAC.js";
6
6
  import {
7
7
  buildSetupState,
8
8
  runPendingServeHandoff
9
- } from "./chunk-YKB75BPD.js";
9
+ } from "./chunk-UG3NPUZQ.js";
10
10
  import "./chunk-VJWDBFSL.js";
11
- import "./chunk-SP44JHI4.js";
11
+ import "./chunk-VUL3BACZ.js";
12
12
  import "./chunk-TSENU4GG.js";
13
- import "./chunk-Z7TP2GD4.js";
13
+ import "./chunk-U2LYHQHF.js";
14
14
  import {
15
15
  checkLatestVersionForCli,
16
16
  cliRuntimeContext,
@@ -24,24 +24,24 @@ import {
24
24
  showFirstRunNotice,
25
25
  trackCliCommandFinished,
26
26
  trackEvent
27
- } from "./chunk-HN6UIFHO.js";
27
+ } from "./chunk-XQUGLXAN.js";
28
28
  import {
29
29
  autoSyncSkills,
30
30
  formatAutoSyncNotice
31
- } from "./chunk-6ZL5ILQI.js";
32
- import "./chunk-27MI43WQ.js";
33
- import "./chunk-WHH3XSRE.js";
31
+ } from "./chunk-C5EK4TJ5.js";
32
+ import "./chunk-2MDEKCDU.js";
33
+ import "./chunk-VP3F4BOG.js";
34
34
  import {
35
35
  accessFilterFromArgs,
36
36
  dispatchRegisteredCommand,
37
37
  printCliCatalog
38
- } from "./chunk-QFGEFEKV.js";
38
+ } from "./chunk-KIO37ZVB.js";
39
39
  import {
40
40
  resolveCliAccess
41
- } from "./chunk-JXKRQ63F.js";
41
+ } from "./chunk-ML7G6NS3.js";
42
42
  import "./chunk-Z7IUAJOF.js";
43
- import "./chunk-G46YLF5X.js";
44
- import "./chunk-OXM2WUTJ.js";
43
+ import "./chunk-3G5FQLF7.js";
44
+ import "./chunk-PDSB34VB.js";
45
45
  import "./chunk-AOJU5LKX.js";
46
46
  import {
47
47
  CliError,
@@ -49,10 +49,10 @@ import {
49
49
  isMachineFormat,
50
50
  printCliError,
51
51
  usageError
52
- } from "./chunk-EEYFNSVL.js";
52
+ } from "./chunk-QQFTJVHT.js";
53
53
  import {
54
54
  OperationAccesses
55
- } from "./chunk-LEW6WFYV.js";
55
+ } from "./chunk-3OZ5WKRH.js";
56
56
 
57
57
  // src/cli.ts
58
58
  import { pathToFileURL } from "url";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-27MI43WQ.js";
4
- import "./chunk-WHH3XSRE.js";
3
+ } from "./chunk-2MDEKCDU.js";
4
+ import "./chunk-VP3F4BOG.js";
5
5
  import {
6
6
  emitJsonl
7
7
  } from "./chunk-Z7IUAJOF.js";
@@ -10,7 +10,7 @@ import {
10
10
  CliError,
11
11
  isMachineFormat,
12
12
  usageError
13
- } from "./chunk-EEYFNSVL.js";
13
+ } from "./chunk-QQFTJVHT.js";
14
14
  import {
15
15
  CompetitorChangeKinds,
16
16
  CompetitorShareImpactCaveats,
@@ -21,7 +21,7 @@ import {
21
21
  normalizeCompetitorDomain,
22
22
  shareOfVoiceLabel,
23
23
  shareOfVoiceReason
24
- } from "./chunk-LEW6WFYV.js";
24
+ } from "./chunk-3OZ5WKRH.js";
25
25
 
26
26
  // src/commands/competitor.ts
27
27
  import fs from "fs";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-27MI43WQ.js";
4
- import "./chunk-WHH3XSRE.js";
3
+ } from "./chunk-2MDEKCDU.js";
4
+ import "./chunk-VP3F4BOG.js";
5
5
  import {
6
6
  emitJsonl
7
7
  } from "./chunk-Z7IUAJOF.js";
@@ -10,11 +10,11 @@ import {
10
10
  CliError,
11
11
  isMachineFormat,
12
12
  usageError
13
- } from "./chunk-EEYFNSVL.js";
13
+ } from "./chunk-QQFTJVHT.js";
14
14
  import {
15
15
  contentTargetDismissRequestSchema,
16
16
  formatPercent
17
- } from "./chunk-LEW6WFYV.js";
17
+ } from "./chunk-3OZ5WKRH.js";
18
18
 
19
19
  // src/commands/content.ts
20
20
  var WINNABILITY_COVERAGE_CHECK_ID = "content.winnability.coverage";
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  clearDashboardPassword,
3
3
  loadConfigRaw
4
- } from "./chunk-WHH3XSRE.js";
4
+ } from "./chunk-VP3F4BOG.js";
5
5
  import {
6
6
  isMachineFormat
7
- } from "./chunk-EEYFNSVL.js";
7
+ } from "./chunk-QQFTJVHT.js";
8
8
  import {
9
9
  anyUsersExist
10
- } from "./chunk-ZI5JGJFY.js";
11
- import "./chunk-2T4IZBIB.js";
12
- import "./chunk-J3C4XFWJ.js";
10
+ } from "./chunk-ZA624A36.js";
11
+ import "./chunk-32LTZWWW.js";
12
+ import "./chunk-A75GIIWP.js";
13
13
  import {
14
14
  createClient
15
- } from "./chunk-OC35PZAC.js";
16
- import "./chunk-LEW6WFYV.js";
15
+ } from "./chunk-35NITZHC.js";
16
+ import "./chunk-3OZ5WKRH.js";
17
17
 
18
18
  // src/commands/dashboard.ts
19
19
  import fs from "fs";
@@ -6,8 +6,8 @@ import {
6
6
  import {
7
7
  CliError,
8
8
  isMachineFormat
9
- } from "./chunk-EEYFNSVL.js";
10
- import "./chunk-LEW6WFYV.js";
9
+ } from "./chunk-QQFTJVHT.js";
10
+ import "./chunk-3OZ5WKRH.js";
11
11
 
12
12
  // src/commands/demo.ts
13
13
  function parseDemoListenOptions(options) {
@@ -40,7 +40,7 @@ function parseDemoTrustedProxies(values) {
40
40
  async function demoCommand(options) {
41
41
  const { host, port } = parseDemoListenOptions(options);
42
42
  const trustProxy = parseDemoTrustedProxies(options.trustProxy);
43
- const { createDemoServer } = await import("./demo-server-E7LTZ55I.js");
43
+ const { createDemoServer } = await import("./demo-server-MQDIL5YL.js");
44
44
  const app = await createDemoServer({ trustProxy });
45
45
  let stopping = false;
46
46
  const stop = () => {
@@ -5,31 +5,31 @@ import {
5
5
  computeFactorAverages,
6
6
  layoutSiteCrawlGraphInput,
7
7
  persistSiteCrawlGraphLayout
8
- } from "./chunk-R2F5JHCB.js";
8
+ } from "./chunk-QCEXADUT.js";
9
9
  import {
10
10
  canonryMcpTools
11
- } from "./chunk-2JMNIWOG.js";
11
+ } from "./chunk-PAP62URW.js";
12
12
  import "./chunk-UX3HJV2V.js";
13
- import "./chunk-ODEDQ4Z7.js";
14
- import "./chunk-OXM2WUTJ.js";
13
+ import "./chunk-MB7VQPWX.js";
14
+ import "./chunk-PDSB34VB.js";
15
15
  import {
16
16
  PACKAGE_VERSION
17
17
  } from "./chunk-AOJU5LKX.js";
18
- import "./chunk-EEYFNSVL.js";
18
+ import "./chunk-QQFTJVHT.js";
19
19
  import {
20
20
  HISTORY_WINDOW_RUNS,
21
21
  IntelligenceService
22
- } from "./chunk-7V3V5H7L.js";
22
+ } from "./chunk-E57WK3OU.js";
23
23
  import {
24
24
  determineCitationState
25
- } from "./chunk-C7IGAN7U.js";
26
- import "./chunk-OZRJ73XU.js";
25
+ } from "./chunk-QRA6GFXX.js";
26
+ import "./chunk-DI5EEYDP.js";
27
27
  import {
28
28
  apiRoutes,
29
29
  assessConversionTrackingIntegrity
30
- } from "./chunk-ZI5JGJFY.js";
31
- import "./chunk-2T4IZBIB.js";
32
- import "./chunk-J3C4XFWJ.js";
30
+ } from "./chunk-ZA624A36.js";
31
+ import "./chunk-32LTZWWW.js";
32
+ import "./chunk-A75GIIWP.js";
33
33
  import {
34
34
  adsAdGroups,
35
35
  adsAds,
@@ -105,7 +105,7 @@ import {
105
105
  siteCrawlPages,
106
106
  siteCrawlSnapshots,
107
107
  trafficSources
108
- } from "./chunk-OC35PZAC.js";
108
+ } from "./chunk-35NITZHC.js";
109
109
  import {
110
110
  AI_ENGINE_DOMAINS,
111
111
  CitationStates,
@@ -154,7 +154,7 @@ import {
154
154
  siteAuditPageFactorSchema,
155
155
  wilsonInterval,
156
156
  withLegacyAgentReadinessPaths
157
- } from "./chunk-LEW6WFYV.js";
157
+ } from "./chunk-3OZ5WKRH.js";
158
158
 
159
159
  // src/demo-server.ts
160
160
  import { dirname, join as join2 } from "path";
@@ -2,11 +2,11 @@ import {
2
2
  SNAPSHOT_CELL_LEGEND,
3
3
  citationGlyph,
4
4
  mentionGlyph
5
- } from "./chunk-MXDKDPRJ.js";
5
+ } from "./chunk-VD6Q7ZUX.js";
6
6
  import {
7
7
  createApiClient
8
- } from "./chunk-27MI43WQ.js";
9
- import "./chunk-WHH3XSRE.js";
8
+ } from "./chunk-2MDEKCDU.js";
9
+ import "./chunk-VP3F4BOG.js";
10
10
  import {
11
11
  emitJsonl
12
12
  } from "./chunk-Z7IUAJOF.js";
@@ -14,11 +14,11 @@ import "./chunk-AOJU5LKX.js";
14
14
  import {
15
15
  CliError,
16
16
  isMachineFormat
17
- } from "./chunk-EEYFNSVL.js";
17
+ } from "./chunk-QQFTJVHT.js";
18
18
  import {
19
19
  DiscoveryPromoteCompetitorSkipReasons,
20
20
  describeError
21
- } from "./chunk-LEW6WFYV.js";
21
+ } from "./chunk-3OZ5WKRH.js";
22
22
 
23
23
  // src/commands/discover.ts
24
24
  var TERMINAL_DISCOVERY_STATUSES = /* @__PURE__ */ new Set([
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-27MI43WQ.js";
4
- import "./chunk-WHH3XSRE.js";
3
+ } from "./chunk-2MDEKCDU.js";
4
+ import "./chunk-VP3F4BOG.js";
5
5
  import "./chunk-AOJU5LKX.js";
6
6
  import {
7
7
  CliError,
8
8
  EXIT_USER_ERROR
9
- } from "./chunk-EEYFNSVL.js";
10
- import "./chunk-LEW6WFYV.js";
9
+ } from "./chunk-QQFTJVHT.js";
10
+ import "./chunk-3OZ5WKRH.js";
11
11
 
12
12
  // src/commands/discover-eval.ts
13
13
  import fs from "fs";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-27MI43WQ.js";
4
- import "./chunk-WHH3XSRE.js";
3
+ } from "./chunk-2MDEKCDU.js";
4
+ import "./chunk-VP3F4BOG.js";
5
5
  import {
6
6
  emitJsonl
7
7
  } from "./chunk-Z7IUAJOF.js";
@@ -9,11 +9,11 @@ import "./chunk-AOJU5LKX.js";
9
9
  import {
10
10
  CliError,
11
11
  EXIT_USER_ERROR
12
- } from "./chunk-EEYFNSVL.js";
12
+ } from "./chunk-QQFTJVHT.js";
13
13
  import {
14
14
  CheckScopes,
15
15
  CheckStatuses
16
- } from "./chunk-LEW6WFYV.js";
16
+ } from "./chunk-3OZ5WKRH.js";
17
17
 
18
18
  // src/commands/doctor.ts
19
19
  async function doctorCommand(opts) {