@canonry/canonry 7.102.0 → 7.104.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 (141) hide show
  1. package/assets/agent-workspace/skills/aero/references/ai-traffic-tracking.md +32 -4
  2. package/assets/agent-workspace/skills/canonry/references/ai-traffic-tracking.md +32 -4
  3. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +20 -2
  4. package/assets/agent-workspace/skills/canonry/references/server-side-traffic.md +51 -15
  5. package/assets/assets/{AccessControls-CpSlWN3W.js → AccessControls-CBkDcxwx.js} +1 -1
  6. package/assets/assets/{AgentSetupPage-0le_Bx7d.js → AgentSetupPage-iGYETW-I.js} +1 -1
  7. package/assets/assets/{AuditHistoryPanel-BQH1dQ4V.js → AuditHistoryPanel-DiFMK7eE.js} +1 -1
  8. package/assets/assets/{BacklinksPage-_ffwmtrl.js → BacklinksPage-Cg9LQLMo.js} +1 -1
  9. package/assets/assets/{ChartPrimitives-6Yq_3ION.js → ChartPrimitives-DYS88Zzt.js} +1 -1
  10. package/assets/assets/{HistoryPage-DUR17GrK.js → HistoryPage-CmI5CX94.js} +1 -1
  11. package/assets/assets/{MeasurementPropertyPage-dutXSW7s.js → MeasurementPropertyPage-DshJzp9b.js} +1 -1
  12. package/assets/assets/{ProjectPage-DA-07-jJ.js → ProjectPage-DwVxUhxM.js} +9 -9
  13. package/assets/assets/{RunsPage-Bs4f0-sW.js → RunsPage-BqvrT8Xm.js} +1 -1
  14. package/assets/assets/{ServerTrafficSection-qMBbUI-0.js → ServerTrafficSection-CtFe7WDd.js} +1 -1
  15. package/assets/assets/{SettingsPage-Bccypqbr.js → SettingsPage-snu8wJ8l.js} +1 -1
  16. package/assets/assets/{ToneBadge-DvK4cIwq.js → ToneBadge-CkTo2T8d.js} +4 -4
  17. package/assets/assets/{TrafficPage-BPojOqd_.js → TrafficPage-BxiiQjwl.js} +1 -1
  18. package/assets/assets/TrafficSourceDetailPage-8BKFz7py.js +1 -0
  19. package/assets/assets/{account-context-evpXzY8L.js → account-context-BlfC71NP.js} +1 -1
  20. package/assets/assets/{agent-trust-copy-CkaSg2FT.js → agent-trust-copy-C_J3OmRg.js} +1 -1
  21. package/assets/assets/{card-01OafAPU.js → card-CeXmlLH2.js} +1 -1
  22. package/assets/assets/{index-StZErOkd.js → index-BKbmkmyo.js} +3 -3
  23. package/assets/assets/{query-client-D6xwAuZW.js → query-client-DWYnC2Lg.js} +1 -1
  24. package/assets/assets/{react-query-CdE7FNH6.js → react-query-CQhkmL4O.js} +1 -1
  25. package/assets/assets/{react-sigma_core.esm.min-DlfcmDYc.js → react-sigma_core.esm.min-YHPB9pkU.js} +1 -1
  26. package/assets/assets/{server-traffic-yEflW4RI.js → server-traffic-ChxoKQ0y.js} +1 -1
  27. package/assets/assets/{service-DfuRVpyN.js → service-u1pn5oyA.js} +1 -1
  28. package/assets/index.html +8 -8
  29. package/dist/{ads-UDJVYKHF.js → ads-ARJJACSH.js} +3 -3
  30. package/dist/{agent-EOB54XNS.js → agent-57EQMSOO.js} +7 -7
  31. package/dist/{agent-ask-5V4LX4VW.js → agent-ask-TF2WTRTO.js} +3 -3
  32. package/dist/{agent-conversations-OAF6RCFP.js → agent-conversations-5GXNREFK.js} +3 -3
  33. package/dist/{agent-journeys-GETB4UGM.js → agent-journeys-6CDPI4TE.js} +3 -3
  34. package/dist/{agent-memory-JXHPH6H5.js → agent-memory-X3FQ4YDE.js} +3 -3
  35. package/dist/{agent-providers-AAUCUOKY.js → agent-providers-32Z3YXO4.js} +3 -3
  36. package/dist/{agent-transcript-WT4QH3ZY.js → agent-transcript-2S64XPF2.js} +3 -3
  37. package/dist/{analytics-JEZWLRTZ.js → analytics-WPCHRXQZ.js} +3 -3
  38. package/dist/{apply-LDIMMO4N.js → apply-3WHRQBQB.js} +3 -3
  39. package/dist/{backfill-JOJHBVGV.js → backfill-QD3I5MYX.js} +10 -10
  40. package/dist/{backlinks-D2O3UM6F.js → backlinks-TRVNCPUB.js} +3 -3
  41. package/dist/{bing-BG7KZZPK.js → bing-F3B76XX5.js} +3 -3
  42. package/dist/{bootstrap-IXVATZLB.js → bootstrap-QOAGLWNN.js} +10 -10
  43. package/dist/{cdp-3AJG7OLP.js → cdp-4I3DNMLG.js} +7 -7
  44. package/dist/{chunk-C2YVADFC.js → chunk-2AECECUY.js} +1 -1
  45. package/dist/{chunk-S7ZOYNW3.js → chunk-2VNQKUCW.js} +2 -2
  46. package/dist/{chunk-N7773GJW.js → chunk-3V5Y2XTA.js} +1 -1
  47. package/dist/{chunk-DP3FE2OW.js → chunk-47QPY6Y3.js} +5 -5
  48. package/dist/{chunk-M25KDHD4.js → chunk-52D6WBCZ.js} +1 -1
  49. package/dist/{chunk-LGTSVS6Q.js → chunk-5FMZGO6R.js} +4 -4
  50. package/dist/{chunk-N4VEG6GB.js → chunk-5UHNDYUH.js} +4 -4
  51. package/dist/{chunk-QK4IICRM.js → chunk-6AW6ONTF.js} +2 -2
  52. package/dist/{chunk-YTR2S4MU.js → chunk-756RPVYB.js} +4 -4
  53. package/dist/{chunk-G4ODBZO7.js → chunk-7UQZCDYK.js} +1 -1
  54. package/dist/{chunk-7JJCFGL2.js → chunk-7VKVGR6X.js} +3 -3
  55. package/dist/{chunk-BG6TVNA6.js → chunk-7XJG2OTB.js} +366 -366
  56. package/dist/{chunk-7I2NJ4BH.js → chunk-BYYP43Q3.js} +128 -1
  57. package/dist/{chunk-AENOUFTF.js → chunk-CCHYRLX4.js} +2 -2
  58. package/dist/{chunk-O5AIKUW3.js → chunk-CJ55MGWI.js} +1 -1
  59. package/dist/{chunk-WNR3YQAD.js → chunk-D76TB5JS.js} +1 -1
  60. package/dist/{chunk-GLKR6C2L.js → chunk-DLZCOJCY.js} +1 -1
  61. package/dist/{chunk-66EXWVMN.js → chunk-FCUUJO3Z.js} +2 -2
  62. package/dist/{chunk-ONHBQYSA.js → chunk-FYRNKI3A.js} +46 -31
  63. package/dist/{chunk-RXWD25P7.js → chunk-HLM3GYK4.js} +1 -1
  64. package/dist/{chunk-4CF5536B.js → chunk-HPFT4IKN.js} +1 -1
  65. package/dist/{chunk-AG6BTE7R.js → chunk-HTGJSXCR.js} +5 -5
  66. package/dist/{chunk-UX6XWC4F.js → chunk-IHY4Q74C.js} +567 -185
  67. package/dist/{chunk-CZOGOHIN.js → chunk-K32GU473.js} +632 -462
  68. package/dist/{chunk-BDLHLE2F.js → chunk-LCZZACLE.js} +3 -3
  69. package/dist/{chunk-NAJ3ZYZ2.js → chunk-MDRAKMCV.js} +3 -3
  70. package/dist/{chunk-VH424YVI.js → chunk-NGGMSNF6.js} +1714 -1714
  71. package/dist/{chunk-ZIKPEZ3K.js → chunk-NI2JFXIS.js} +21 -21
  72. package/dist/{chunk-DRNBMKR5.js → chunk-PU5OA57Z.js} +6 -6
  73. package/dist/{chunk-FHK6M4RK.js → chunk-QRR5ZW22.js} +3 -3
  74. package/dist/{chunk-2YLTELT2.js → chunk-SZ64N26K.js} +1 -1
  75. package/dist/{chunk-EXPBZFN4.js → chunk-TCXITSDO.js} +1 -1
  76. package/dist/{chunk-NJZVDUKD.js → chunk-TFP6UJXW.js} +3 -3
  77. package/dist/{chunk-3TPHFDZN.js → chunk-WQQ4TNIY.js} +2 -2
  78. package/dist/{chunk-NHBXQWE3.js → chunk-WT22Z3I7.js} +63 -4
  79. package/dist/{chunk-IBRABPHA.js → chunk-ZJFLVXDZ.js} +2 -2
  80. package/dist/{citations-GM42U2ZH.js → citations-6CW3G5YP.js} +4 -4
  81. package/dist/{cli-catalog-EMZPMAJP.js → cli-catalog-6B2O2JQE.js} +3 -3
  82. package/dist/{cli-commands-VDMZAETM.js → cli-commands-O46WFSHZ.js} +7 -7
  83. package/dist/cli.js +13 -13
  84. package/dist/{competitor-4ZLKGNQW.js → competitor-D4BVO2KQ.js} +3 -3
  85. package/dist/{content-YJRMT4JW.js → content-H2PGFRWM.js} +3 -3
  86. package/dist/{dashboard-L4EE3C5T.js → dashboard-4KP7KKMY.js} +6 -6
  87. package/dist/{demo-3XDVCUT5.js → demo-NKCOCN6Z.js} +1 -1
  88. package/dist/{demo-server-7ZJWSGE2.js → demo-server-RQB6VRBH.js} +12 -12
  89. package/dist/{discover-SQGUDXSU.js → discover-K4GIXAN5.js} +4 -4
  90. package/dist/{discover-eval-BUNKP6EW.js → discover-eval-L4IF5XFV.js} +3 -3
  91. package/dist/{doctor-HPIGLMRX.js → doctor-OVJTEQCK.js} +3 -3
  92. package/dist/{evidence-JKEM5BYW.js → evidence-MXQK4YYL.js} +3 -3
  93. package/dist/{export-cmd-KTQM455W.js → export-cmd-Z3CWJALI.js} +3 -3
  94. package/dist/{ga-D7ZLTSSA.js → ga-347UNNJP.js} +3 -3
  95. package/dist/{gbp-OWBX2BFK.js → gbp-47MIYIQC.js} +3 -3
  96. package/dist/{google-UNAGUCXQ.js → google-7Q3FYNVP.js} +4 -4
  97. package/dist/{google-marketing-AZC7WHZR.js → google-marketing-TMKWY5AP.js} +1 -1
  98. package/dist/{health-cmd-XHEDL6CF.js → health-cmd-77TMLQ6T.js} +4 -4
  99. package/dist/{history-MKQDN6LY.js → history-Q756HPJM.js} +3 -3
  100. package/dist/index.d.ts +89 -70
  101. package/dist/index.js +25 -25
  102. package/dist/{init-W4LWSMCC.js → init-WDRQTCKK.js} +12 -12
  103. package/dist/{insights-HNJR7UEC.js → insights-TPNHIVNH.js} +3 -3
  104. package/dist/intelligence-service-DAUXHAOP.js +16 -0
  105. package/dist/{journeys-RQBYPWHU.js → journeys-F6UAVPVI.js} +3 -3
  106. package/dist/{keys-KNZAMXJU.js → keys-Q6VMDIAH.js} +3 -3
  107. package/dist/{keyword-7SUZG7RB.js → keyword-7BH5P5P7.js} +3 -3
  108. package/dist/{logs-RTQFOKLJ.js → logs-P2J6XFVJ.js} +3 -3
  109. package/dist/{mcp-JWBPAYR4.js → mcp-RPXFNAKS.js} +4 -4
  110. package/dist/mcp.js +9 -9
  111. package/dist/{measurement-plan-AETWMIGC.js → measurement-plan-KKUB6SLB.js} +5 -5
  112. package/dist/{notify-DGFNKFVG.js → notify-2IK6NR7Y.js} +3 -3
  113. package/dist/{organic-evidence-VA47O6HU.js → organic-evidence-N4HIUIHJ.js} +3 -3
  114. package/dist/{overview-SMXNZLPG.js → overview-FSNB42W5.js} +5 -5
  115. package/dist/{project-WXEDQJLS.js → project-D5ODS46C.js} +3 -3
  116. package/dist/{project-setup-VFBTUA5W.js → project-setup-X7NGKC4R.js} +3 -3
  117. package/dist/{query-C2VIB2XW.js → query-JGCEDLI2.js} +3 -3
  118. package/dist/{research-76TYES7M.js → research-3S5FLAFX.js} +3 -3
  119. package/dist/{results-export-F4FKVOQN.js → results-export-YMX4F2K6.js} +3 -3
  120. package/dist/{run-H6GGXFKQ.js → run-MCJAGAHJ.js} +5 -5
  121. package/dist/{schedule-KTQNJGMO.js → schedule-CLWDPYZG.js} +3 -3
  122. package/dist/{search-YRFUC7SW.js → search-X7SXPESS.js} +3 -3
  123. package/dist/{serve-PWIVPUX7.js → serve-UHEE443J.js} +26 -26
  124. package/dist/{session-LRR2N6IP.js → session-AS2VQ7VL.js} +13 -13
  125. package/dist/{settings-TLDN77K4.js → settings-UZEODHZ3.js} +3 -3
  126. package/dist/{sitemaps-BQ6JI4EW.js → sitemaps-SK2ZE5EJ.js} +3 -3
  127. package/dist/{skills-SQBKFXAN.js → skills-SI6C7MPT.js} +2 -2
  128. package/dist/{snapshot-ICGETMOY.js → snapshot-AOQUU5Q2.js} +3 -3
  129. package/dist/{src-XW5T4IQS.js → src-BXXLPHVZ.js} +2 -2
  130. package/dist/{status-VN65JTUD.js → status-TMKQNQ74.js} +5 -5
  131. package/dist/{technical-aeo-OBCWTN3M.js → technical-aeo-WBLZMCUY.js} +3 -3
  132. package/dist/{telemetry-ZU6REKKU.js → telemetry-DS22S3C3.js} +4 -4
  133. package/dist/{tools-RQDMCSZB.js → tools-YGKVGB5M.js} +11 -11
  134. package/dist/{traffic-YLZSRX5P.js → traffic-6AIRXYMI.js} +24 -7
  135. package/dist/{trends-OWWELIE2.js → trends-LEAXHSM6.js} +3 -3
  136. package/dist/{users-2ICURHTW.js → users-VCNIWES5.js} +3 -3
  137. package/dist/{visibility-stats-FJK3MDYE.js → visibility-stats-4XA2YZET.js} +4 -4
  138. package/dist/{wordpress-UQFA5TFU.js → wordpress-YG3ECQXW.js} +3 -3
  139. package/package.json +1 -1
  140. package/assets/assets/TrafficSourceDetailPage-DSoQk94d.js +0 -1
  141. package/dist/intelligence-service-SWQABQ3X.js +0 -16
@@ -20,7 +20,7 @@ import {
20
20
  templateLinkRatio,
21
21
  templateLinkUbiquityAvailable,
22
22
  validationError
23
- } from "./chunk-NHBXQWE3.js";
23
+ } from "./chunk-WT22Z3I7.js";
24
24
  import {
25
25
  __export
26
26
  } from "./chunk-MLKGABMK.js";
@@ -2673,6 +2673,19 @@ var trafficSources = sqliteTable2("traffic_sources", {
2673
2673
  * back to where journeys began, or clears it when no older hour is left.
2674
2674
  */
2675
2675
  aiReferralOlderCountUntil: text2("ai_referral_older_count_until"),
2676
+ /**
2677
+ * The exclusive end of the last hour whose hosted browser agent (Google-Agent,
2678
+ * Claude-Agent) AI user fetches this source counted under older rules; hours
2679
+ * from it on count those agents' page loads only. Older hours were counted
2680
+ * differently and can read high (every file, data call and beacon counted)
2681
+ * or low (whole visits judged likely fake); they were not recounted
2682
+ * (hourly rows keep no method or query). NULL when the source holds no such
2683
+ * hour. Set by migration v222 and by the stored traffic pass; a replace-mode
2684
+ * backfill moves it back to the end of the last browser-agent hour before
2685
+ * its window, or clears it when none remains. Trend fits and comparisons
2686
+ * leave earlier hours out.
2687
+ */
2688
+ aiUserFetchOlderCountUntil: text2("ai_user_fetch_older_count_until"),
2676
2689
  archivedAt: text2("archived_at"),
2677
2690
  configJson: text2("config_json", { mode: "json" }).$type().notNull().default({}),
2678
2691
  // sha256 hex of the per-source bearer token issued at connect time. Only
@@ -9352,8 +9365,119 @@ var MIGRATION_VERSIONS = [
9352
9365
  `CREATE INDEX IF NOT EXISTS idx_chatgpt_login_transactions_expires
9353
9366
  ON chatgpt_login_transactions(expires_at)`
9354
9367
  ]
9368
+ },
9369
+ {
9370
+ version: 221,
9371
+ name: "claude-searchbot-own-bot",
9372
+ // Claude-SearchBot, Anthropic's search crawler, now has its own classifier
9373
+ // rule (`claude-searchbot`, purpose search). The `anthropic-claudebot` rule
9374
+ // (purpose training) used to match it too, so its hits were stored as
9375
+ // ClaudeBot. This moves the crawler rows whose sampled user agent is
9376
+ // Claude-SearchBot to the new bot, with their manifest provenance, and
9377
+ // relabels the crawler samples the old rule classified.
9378
+ //
9379
+ // Best effort, as v65's Mistral split: an hourly row is one (project,
9380
+ // source, hour, bot, verification, path, status) and keeps one sampled
9381
+ // user agent, the latest batch's, so a row that counted both bots in the
9382
+ // same hour moves or stays whole by that sample. New traffic splits
9383
+ // exactly. Both rules verify against Anthropic's one crawler manifest, so
9384
+ // a moved row keeps its verification status and provenance.
9385
+ //
9386
+ // A run hook because the statement allowlist is schema-shaped, and because
9387
+ // a legacy database that resumes past the migrations creating these tables
9388
+ // must skip the move rather than fail on a missing table.
9389
+ statements: [],
9390
+ run: (tx) => {
9391
+ moveClaudeSearchBotRows(tx);
9392
+ }
9393
+ },
9394
+ {
9395
+ version: 222,
9396
+ name: "ai-user-fetch-older-count-until",
9397
+ // Hosted browser agents (Google-Agent, Claude-Agent) now count only their
9398
+ // page loads as AI user fetches. Hours a source wrote before were counted
9399
+ // under older rules: every file, data call and beacon their pages made
9400
+ // counted (high), or the older trust rules judged whole visits likely fake
9401
+ // (low). They were not recounted (hourly rows keep no method or query).
9402
+ // Stamp where the older count ended on sources holding such hours: the end
9403
+ // of the last one, or the upgrade time if that is earlier. A fresh install
9404
+ // holds none and stamps nothing.
9405
+ //
9406
+ // A run hook because the statement allowlist is schema-shaped, and because
9407
+ // a legacy database that resumes past the migrations creating the hourly
9408
+ // tables must skip the stamp rather than fail on a missing table.
9409
+ statements: [
9410
+ `ALTER TABLE traffic_sources ADD COLUMN ai_user_fetch_older_count_until TEXT`
9411
+ ],
9412
+ run: (tx) => {
9413
+ stampBrowserAgentOlderCount(tx, (/* @__PURE__ */ new Date()).toISOString());
9414
+ }
9355
9415
  }
9356
9416
  ];
9417
+ var V222_BROWSER_AGENT_HOURLY_TABLES = ["ai_user_fetch_events_hourly", "ai_user_fetch_likely_fake_hourly"];
9418
+ function stampBrowserAgentOlderCount(tx, upgradedAt) {
9419
+ const lastHours = V222_BROWSER_AGENT_HOURLY_TABLES.filter((table) => tableExists(tx, table)).map((table) => `SELECT source_id, MAX(ts_hour) AS ts_hour FROM ${table}
9420
+ WHERE bot_id IN ('google-agent', 'claude-agent') GROUP BY source_id`);
9421
+ if (lastHours.length === 0) return;
9422
+ tx.run(sql2`UPDATE traffic_sources
9423
+ SET ai_user_fetch_older_count_until = min(${upgradedAt}, last_hour.hour_end)
9424
+ FROM (
9425
+ SELECT source_id, strftime('%Y-%m-%dT%H:%M:%fZ', MAX(ts_hour), '+1 hour') AS hour_end
9426
+ FROM (${sql2.raw(lastHours.join(" UNION ALL "))})
9427
+ GROUP BY source_id
9428
+ ) AS last_hour
9429
+ WHERE traffic_sources.id = last_hour.source_id
9430
+ AND traffic_sources.ai_user_fetch_older_count_until IS NULL`);
9431
+ }
9432
+ function moveClaudeSearchBotRows(tx) {
9433
+ if (tableExists(tx, "crawler_events_hourly")) {
9434
+ tx.run(sql2.raw("DROP TABLE IF EXISTS temp.v221_moved"));
9435
+ tx.run(sql2.raw(
9436
+ `CREATE TEMP TABLE v221_moved AS
9437
+ SELECT rowid AS rid, project_id, source_id, ts_hour, verification_status, path_normalized, status
9438
+ FROM crawler_events_hourly
9439
+ WHERE bot_id = 'anthropic-claudebot' AND sampled_user_agent LIKE '%Claude-SearchBot/%'`
9440
+ ));
9441
+ tx.run(sql2.raw(
9442
+ `INSERT INTO crawler_events_hourly (project_id, source_id, ts_hour, bot_id, operator, verification_status, path_normalized, status, hits, sampled_user_agent, created_at, updated_at)
9443
+ SELECT c.project_id, c.source_id, c.ts_hour, 'claude-searchbot', c.operator, c.verification_status, c.path_normalized, c.status, c.hits, c.sampled_user_agent, c.created_at, c.updated_at
9444
+ FROM v221_moved t JOIN crawler_events_hourly c ON c.rowid = t.rid
9445
+ WHERE true
9446
+ ON CONFLICT (project_id, source_id, ts_hour, bot_id, verification_status, path_normalized, status)
9447
+ DO UPDATE SET hits = crawler_events_hourly.hits + excluded.hits,
9448
+ updated_at = max(crawler_events_hourly.updated_at, excluded.updated_at)`
9449
+ ));
9450
+ if (tableExists(tx, "crawler_verification_manifests_hourly")) {
9451
+ tx.run(sql2.raw(
9452
+ `INSERT INTO crawler_verification_manifests_hourly (project_id, source_id, ts_hour, bot_id, verification_status, path_normalized, status, manifest_id, manifest_json, hits, created_at, updated_at)
9453
+ SELECT m.project_id, m.source_id, m.ts_hour, 'claude-searchbot', m.verification_status, m.path_normalized, m.status, m.manifest_id, m.manifest_json, m.hits, m.created_at, m.updated_at
9454
+ FROM v221_moved t JOIN crawler_verification_manifests_hourly m
9455
+ ON m.project_id = t.project_id AND m.source_id = t.source_id AND m.ts_hour = t.ts_hour
9456
+ AND m.bot_id = 'anthropic-claudebot' AND m.verification_status = t.verification_status
9457
+ AND m.path_normalized = t.path_normalized AND m.status = t.status
9458
+ WHERE true
9459
+ ON CONFLICT (project_id, source_id, ts_hour, bot_id, verification_status, path_normalized, status, manifest_id)
9460
+ DO UPDATE SET hits = crawler_verification_manifests_hourly.hits + excluded.hits,
9461
+ updated_at = max(crawler_verification_manifests_hourly.updated_at, excluded.updated_at)`
9462
+ ));
9463
+ }
9464
+ tx.run(sql2.raw("DELETE FROM crawler_events_hourly WHERE rowid IN (SELECT rid FROM v221_moved)"));
9465
+ tx.run(sql2.raw("DROP TABLE v221_moved"));
9466
+ }
9467
+ if (tableExists(tx, "raw_event_samples")) {
9468
+ tx.run(sql2.raw(
9469
+ `UPDATE raw_event_samples
9470
+ SET classifier_details_json = json_set(classifier_details_json,
9471
+ '$.crawler.botId', 'claude-searchbot',
9472
+ '$.crawler.product', 'Claude-SearchBot',
9473
+ '$.crawler.purpose', 'search')
9474
+ WHERE event_type = 'crawler'
9475
+ AND user_agent LIKE '%Claude-SearchBot/%'
9476
+ AND CASE WHEN json_valid(classifier_details_json)
9477
+ THEN json_extract(classifier_details_json, '$.crawler.botId') END = 'anthropic-claudebot'`
9478
+ ));
9479
+ }
9480
+ }
9357
9481
  var AERO_LEDGER_REBUILDS = [
9358
9482
  {
9359
9483
  table: "llm_usage_events",
@@ -9689,6 +9813,7 @@ function migrate(db, versions = MIGRATION_VERSIONS) {
9689
9813
  db.run(sql2.raw(statement));
9690
9814
  }
9691
9815
  const appliedVersion = getAppliedVersion(db);
9816
+ let appliedAny = false;
9692
9817
  for (const mv of versions) {
9693
9818
  if (mv.version <= appliedVersion) continue;
9694
9819
  if (mv.disableForeignKeys) db.run(sql2.raw("PRAGMA foreign_keys = OFF"));
@@ -9705,10 +9830,12 @@ function migrate(db, versions = MIGRATION_VERSIONS) {
9705
9830
  mv.run?.(tx);
9706
9831
  recordMigration(tx, mv.version, mv.name);
9707
9832
  });
9833
+ appliedAny = true;
9708
9834
  } finally {
9709
9835
  if (mv.disableForeignKeys) db.run(sql2.raw("PRAGMA foreign_keys = ON"));
9710
9836
  }
9711
9837
  }
9838
+ if (appliedAny) db.all(sql2.raw("PRAGMA wal_checkpoint(TRUNCATE)"));
9712
9839
  }
9713
9840
 
9714
9841
  // ../db/src/operational-logs.ts
@@ -4,14 +4,14 @@ import {
4
4
  } from "./chunk-VJWDBFSL.js";
5
5
  import {
6
6
  createApiClient
7
- } from "./chunk-S7ZOYNW3.js";
7
+ } from "./chunk-2VNQKUCW.js";
8
8
  import {
9
9
  CliError,
10
10
  isMachineFormat
11
11
  } from "./chunk-HGMYEDAQ.js";
12
12
  import {
13
13
  describeError
14
- } from "./chunk-NHBXQWE3.js";
14
+ } from "./chunk-WT22Z3I7.js";
15
15
 
16
16
  // src/commands/mcp.ts
17
17
  import fs from "fs";
@@ -2,7 +2,7 @@ import {
2
2
  CitationStates,
3
3
  hostMatchesDomain,
4
4
  isCitationMeasurable
5
- } from "./chunk-NHBXQWE3.js";
5
+ } from "./chunk-WT22Z3I7.js";
6
6
 
7
7
  // src/citation-utils.ts
8
8
  function pickProjectCitedDomain(citedDomains, projectDomains) {
@@ -23,7 +23,7 @@ import {
23
23
  measurementDraftUpsertGroupRequestSchema,
24
24
  measurementDraftUpsertMarketRequestSchema,
25
25
  measurementDraftUpsertTargetRequestSchema
26
- } from "./chunk-NHBXQWE3.js";
26
+ } from "./chunk-WT22Z3I7.js";
27
27
 
28
28
  // src/measurement-draft-actions.ts
29
29
  import { z } from "zod";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-HGMYEDAQ.js";
5
5
  import {
6
6
  describeError
7
- } from "./chunk-NHBXQWE3.js";
7
+ } from "./chunk-WT22Z3I7.js";
8
8
 
9
9
  // src/gsc-sitemap-submission.ts
10
10
  function dedupeGscSitemapUrls(urls) {
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  trackIntegrationConnection
3
- } from "./chunk-LGTSVS6Q.js";
3
+ } from "./chunk-5FMZGO6R.js";
4
4
  import {
5
5
  cliRuntimeContext
6
- } from "./chunk-IBRABPHA.js";
6
+ } from "./chunk-ZJFLVXDZ.js";
7
7
 
8
8
  // src/cli-connection-telemetry.ts
9
9
  function trackCliConnection(properties) {
@@ -8,23 +8,24 @@ import {
8
8
  reparseStoredResult4,
9
9
  reparseStoredResult5,
10
10
  resolveStoredApiResponse
11
- } from "./chunk-UX6XWC4F.js";
11
+ } from "./chunk-IHY4Q74C.js";
12
12
  import {
13
13
  loadConfig
14
- } from "./chunk-4CF5536B.js";
14
+ } from "./chunk-HPFT4IKN.js";
15
15
  import {
16
+ CliError,
16
17
  isMachineFormat
17
18
  } from "./chunk-HGMYEDAQ.js";
18
19
  import {
19
20
  determineCitationState
20
- } from "./chunk-O5AIKUW3.js";
21
+ } from "./chunk-CJ55MGWI.js";
21
22
  import {
22
23
  backfillProjectAnswerMentions,
23
24
  competitorIdentityColumns,
24
25
  createRunCompetitorResolver,
25
26
  readMarketCompetitorNames,
26
27
  refreshSnapshotMentionIdentity
27
- } from "./chunk-VH424YVI.js";
28
+ } from "./chunk-NGGMSNF6.js";
28
29
  import {
29
30
  RawEventSampleEventTypes,
30
31
  auditLog,
@@ -38,7 +39,7 @@ import {
38
39
  querySnapshots,
39
40
  rawEventSamples,
40
41
  runs
41
- } from "./chunk-7I2NJ4BH.js";
42
+ } from "./chunk-BYYP43Q3.js";
42
43
  import {
43
44
  ProviderNames,
44
45
  RetrievalContracts,
@@ -51,7 +52,7 @@ import {
51
52
  extractRecommendedCompetitors,
52
53
  normalizeUrlPath,
53
54
  openRouterRouteModel
54
- } from "./chunk-NHBXQWE3.js";
55
+ } from "./chunk-WT22Z3I7.js";
55
56
 
56
57
  // src/commands/backfill.ts
57
58
  import { setImmediate as yieldToEventLoop } from "timers/promises";
@@ -429,7 +430,7 @@ No DB writes performed. Re-run without --dry-run to apply.`);
429
430
  }
430
431
  }
431
432
  async function backfillInsightsCommand(project, opts) {
432
- const { IntelligenceService } = await import("./intelligence-service-SWQABQ3X.js");
433
+ const { IntelligenceService } = await import("./intelligence-service-DAUXHAOP.js");
433
434
  const config = loadConfig();
434
435
  const db = createClient(config.database);
435
436
  migrate(db);
@@ -777,53 +778,60 @@ async function backfillTrafficClassificationCommand(opts) {
777
778
  const projectFilter = opts?.project?.trim();
778
779
  const isDryRun = opts?.dryRun === true;
779
780
  const isJson = isMachineFormat(opts?.format);
780
- const scopedProjects = projectFilter ? db.select().from(projects).where(eq(projects.name, projectFilter)).all() : db.select().from(projects).all();
781
- if (scopedProjects.length === 0) {
782
- if (projectFilter && !isJson) {
783
- process.stderr.write(`No project named "${projectFilter}".
784
- `);
781
+ let projectIds;
782
+ if (projectFilter) {
783
+ const project = db.select({ id: projects.id }).from(projects).where(eq(projects.name, projectFilter)).get();
784
+ if (!project) {
785
+ throw new CliError({
786
+ code: "NOT_FOUND",
787
+ message: `Project "${projectFilter}" not found`,
788
+ displayMessage: `Error: no project named "${projectFilter}".`,
789
+ details: { project: projectFilter }
790
+ });
785
791
  }
786
- if (isJson) console.log(JSON.stringify({ project: projectFilter ?? null, examined: 0, reclassified: 0 }));
787
- return;
792
+ projectIds = [project.id];
788
793
  }
789
794
  if (!isJson) {
790
795
  const mode = isDryRun ? " [DRY RUN \u2014 no writes]" : "";
791
796
  const scope = projectFilter ? `"${projectFilter}"` : "all projects";
792
- process.stderr.write(`Re-classifying stored unknown traffic for ${scope}${mode}...
797
+ process.stderr.write(`Re-classifying stored traffic under today's rules for ${scope}${mode}...
793
798
  `);
794
799
  }
795
- const projectIds = scopedProjects.map((p) => p.id);
796
800
  const countUnknown = () => Number(db.select({ n: sql`count(*)` }).from(rawEventSamples).where(and(
797
801
  eq(rawEventSamples.eventType, RawEventSampleEventTypes.unknown),
798
- inArray(rawEventSamples.projectId, projectIds)
802
+ projectIds ? inArray(rawEventSamples.projectId, projectIds) : void 0
799
803
  )).get()?.n ?? 0);
800
804
  const unknownBefore = countUnknown();
801
- const stored = await reclassifyStoredTraffic(db, { projectIds, dryRun: isDryRun });
802
- const byBot = { ...stored.samples.byBot };
803
- for (const [bot, hits] of Object.entries(stored.unrecognized.byBot)) byBot[bot] = (byBot[bot] ?? 0) + hits;
805
+ const stored = await reclassifyStoredTraffic(db, { projectIds, dryRun: isDryRun, allowVerificationLoss: true });
806
+ const { samples, dryRun, ...sections } = stored;
807
+ const byBot = { ...samples.byBot };
808
+ for (const moved of [sections.unrecognized.byBot, sections.crawlers.byBot]) {
809
+ for (const [bot, hits] of Object.entries(moved)) byBot[bot] = (byBot[bot] ?? 0) + hits;
810
+ }
804
811
  emitTrafficClassificationReport({
805
812
  project: projectFilter ?? null,
806
- examined: stored.samples.examined,
807
- reclassified: stored.samples.reclassified,
813
+ examined: samples.examined,
814
+ reclassified: samples.reclassified,
808
815
  unknownBefore,
809
- unknownAfter: isDryRun ? unknownBefore - stored.samples.reclassified - stored.samples.removed : countUnknown(),
810
- samplesCounted: stored.samples.counted,
811
- samplesRemoved: stored.samples.removed,
812
- dryRun: isDryRun,
816
+ // A dry run writes nothing, so its count after is what the pass found.
817
+ unknownAfter: dryRun ? unknownBefore - samples.reclassified - samples.removed + sections.crawlers.samplesNowUnknown : countUnknown(),
818
+ samplesCounted: samples.counted,
819
+ samplesRemoved: samples.removed,
820
+ dryRun,
813
821
  byBot,
814
- unrecognized: stored.unrecognized,
815
- agentHits: stored.agentHits,
816
- agentRequests: stored.agentRequests,
817
- journeys: stored.journeys,
818
- journeyMerges: stored.journeyMerges
822
+ ...sections
819
823
  }, isJson);
820
824
  }
825
+ function formatHitsByBot(byBot) {
826
+ return Object.entries(byBot).sort(([, a], [, b]) => b - a).map(([bot, hits]) => `${bot} ${hits}`).join(", ");
827
+ }
821
828
  function emitTrafficClassificationReport(result, isJson) {
822
829
  if (isJson) {
823
830
  console.log(JSON.stringify(result, null, 2));
824
831
  return;
825
832
  }
826
833
  const verb = result.dryRun ? "Would re-classify" : "Re-classified";
834
+ const indent = " ";
827
835
  console.log(`
828
836
  Traffic classification ${result.dryRun ? "preview" : "recovery"} complete.`);
829
837
  console.log(` Examined unknowns: ${result.examined}`);
@@ -831,10 +839,17 @@ Traffic classification ${result.dryRun ? "preview" : "recovery"} complete.`);
831
839
  console.log(` Unknown before: ${result.unknownBefore}`);
832
840
  console.log(` Unknown after: ${result.unknownAfter}`);
833
841
  console.log(` Unrecognized rows: ${result.unrecognized.examined} examined, ${result.unrecognized.moved} moved to a bot (${result.unrecognized.movedHits} hits), ${result.unrecognized.renamed} renamed, ${result.unrecognized.removed} removed`);
842
+ const { crawlers } = result;
843
+ console.log(` Crawler rows: ${crawlers.examined} examined; ${crawlers.moved} moved to the crawler their user agent names today (${crawlers.movedHits} hits), ${crawlers.toUserFetch} to AI user fetch (${crawlers.toUserFetchHits} hits), ${crawlers.toUnrecognized} back to unrecognized agents (${crawlers.toUnrecognizedHits} hits), ${crawlers.removed} of Canonry's own tools removed (${crawlers.removedHits} hits)`);
844
+ if (Object.keys(crawlers.byBot).length > 0) console.log(`${indent}Hits moved to: ${formatHitsByBot(crawlers.byBot)}`);
845
+ console.log(`${indent}${crawlers.unverifiedHits} verified hits no longer verified; ${crawlers.samplesRelabeled} samples relabeled (${crawlers.samplesNowUnknown} now unknown), ${crawlers.samplesRemoved} removed`);
846
+ if (crawlers.unknownBot > 0) console.log(`${indent}${crawlers.unknownBot} rows under a bot this version has no rule for (a newer release wrote them) left as they are`);
834
847
  console.log(` Fake agent hits: ${result.agentHits.moved} hourly rows moved to likely fake (${result.agentHits.movedHits} hits)`);
835
848
  console.log(` Agent requests: ${result.agentRequests.removed} removed (${result.agentRequests.probes} asked for a scanner path)`);
849
+ console.log(` Browser agent files: ${result.agentRequests.pageResources} stored requests its pages made by themselves removed`);
836
850
  console.log(` Journeys: ${result.journeys.visitorsRemoved} visitors and ${result.journeys.visitsRemoved} visits removed, ${result.journeys.visitsRelanded} visits now start at a different page`);
837
851
  console.log(` Split visitors: ${result.journeyMerges.visitorsMerged} joined to the same person's first visitor, seen from another IP (${result.journeyMerges.visitsJoined} visits merged)`);
852
+ if (result.orphans > 0) console.log(` Orphaned rows: ${result.orphans} left as they are: their project or traffic source no longer exists`);
838
853
  if (Object.keys(result.byBot).length > 0) {
839
854
  console.log(` By bot:`);
840
855
  const sorted = Object.entries(result.byBot).sort(([, a], [, b]) => b - a);
@@ -15,7 +15,7 @@ import {
15
15
  formatCanonryPluginUpdateHint,
16
16
  formatCanonryPluginVersionMismatch,
17
17
  skillsClientSchema
18
- } from "./chunk-NHBXQWE3.js";
18
+ } from "./chunk-WT22Z3I7.js";
19
19
 
20
20
  // src/commands/skills.ts
21
21
  import crypto from "crypto";
@@ -22,7 +22,7 @@ import {
22
22
  resolveProviderModel,
23
23
  schedulableRunKindSchema,
24
24
  sentimentEvaluatorProviderSchema
25
- } from "./chunk-NHBXQWE3.js";
25
+ } from "./chunk-WT22Z3I7.js";
26
26
 
27
27
  // ../config/src/index.ts
28
28
  import { z as z5 } from "zod";
@@ -2,11 +2,11 @@ import {
2
2
  dedupeGscSitemapUrls,
3
3
  resolveDiscoveredGscSitemapUrls,
4
4
  submitGscSitemapBatches
5
- } from "./chunk-GLKR6C2L.js";
5
+ } from "./chunk-DLZCOJCY.js";
6
6
  import {
7
7
  measurementDraftOperationSchema,
8
8
  runMeasurementDraftAction
9
- } from "./chunk-WNR3YQAD.js";
9
+ } from "./chunk-D76TB5JS.js";
10
10
  import {
11
11
  CliError
12
12
  } from "./chunk-HGMYEDAQ.js";
@@ -195,7 +195,7 @@ import {
195
195
  trendSurfaceSchema,
196
196
  visibilityCompareSelectionSchema,
197
197
  visibilityReportRequestSchema
198
- } from "./chunk-NHBXQWE3.js";
198
+ } from "./chunk-WT22Z3I7.js";
199
199
 
200
200
  // src/mcp/tool-registry.ts
201
201
  import { z as z2 } from "zod";
@@ -3222,7 +3222,7 @@ var rawCanonryMcpTools = [
3222
3222
  defineTool({
3223
3223
  name: "canonry_traffic_samples",
3224
3224
  title: "Read stored traffic samples",
3225
- description: "Read the stored sampled tail of server-side traffic with 30-day retention. Sample rows are not a count of visits. Default kind excludes unknown requests. Project/source only; Property, Target and market dimensions are unavailable. No provider call or write.",
3225
+ description: "Read the stored sampled tail of server-side traffic with 30-day retention. Sample rows are not a count of visits. Default kind excludes unknown requests. A browser agent's (Google-Agent, Claude-Agent) AI user fetch sample carries classifier.aiUserFetch.requestKind; unless it is likely fake, only a page sample was counted as an AI user fetch. Project/source only; Property, Target and market dimensions are unavailable. No provider call or write.",
3226
3226
  access: "read",
3227
3227
  tier: "traffic",
3228
3228
  inputSchema: trafficSamplesQuerySchema.extend({ project: projectNameSchema }),
@@ -3373,7 +3373,7 @@ var rawCanonryMcpTools = [
3373
3373
  defineTool({
3374
3374
  name: "canonry_traffic_sync",
3375
3375
  title: "Sync traffic source",
3376
- description: "Pull a Cloud Run, WordPress, Vercel, or Cloudflare Queue traffic source, classify crawler / AI-referral / unknown traffic, and upsert hourly rollups plus raw samples. Time-window pulls clamp forward to lastSyncedAt. WordPress uses a fixed bounded window, defaults a new or idle source to 365d, validates the returned events remain inside that window, and serializes syncs with a source lease.",
3376
+ description: "Pull a Cloud Run, WordPress, Vercel, or Cloudflare Queue traffic source, classify crawler / AI user fetch / AI-referral / unknown traffic, and upsert hourly rollups plus raw samples. A browser agent's (Google-Agent, Claude-Agent) requests other than page loads go to no rollup; the result counts them in aiUserFetchBrowserNonPageHits. Time-window pulls clamp forward to lastSyncedAt. WordPress uses a fixed bounded window, defaults a new or idle source to 365d, validates the returned events remain inside that window, and serializes syncs with a source lease.",
3377
3377
  access: "write",
3378
3378
  tier: "traffic",
3379
3379
  inputSchema: trafficSyncInputSchema,