@canonry/canonry 7.84.0 → 7.86.0

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 (142) hide show
  1. package/assets/agent-workspace/skills/aero/references/ai-traffic-tracking.md +9 -5
  2. package/assets/agent-workspace/skills/canonry/references/ai-traffic-tracking.md +9 -5
  3. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +3 -1
  4. package/assets/agent-workspace/skills/canonry/references/server-side-traffic.md +36 -10
  5. package/assets/assets/{AgentSetupPage-B9NOQP8a.js → AgentSetupPage-0f7Ca4IZ.js} +4 -4
  6. package/assets/assets/{AuditHistoryPanel-Fvh4WFjq.js → AuditHistoryPanel-BAQuFTNl.js} +1 -1
  7. package/assets/assets/{BacklinksPage-D1UHFLoV.js → BacklinksPage-BK2bn9Xg.js} +1 -1
  8. package/assets/assets/{HistoryPage-CBcacDgP.js → HistoryPage-ZBfL9nGw.js} +1 -1
  9. package/assets/assets/{MeasurementPropertyPage-ZuZpurwr.js → MeasurementPropertyPage-DDSOq4aU.js} +3 -3
  10. package/assets/assets/ProjectPage-8cVgOm5o.js +11 -0
  11. package/assets/assets/{RunsPage-tlCk_gOw.js → RunsPage-ke0wMYLg.js} +1 -1
  12. package/assets/assets/{SettingsPage-7mRTFLFQ.js → SettingsPage-Bbi-sTBk.js} +1 -1
  13. package/assets/assets/{SiteHealthSection-l_A_AmY_.js → SiteHealthSection-eKxTDUE2.js} +2 -2
  14. package/assets/assets/{ToneBadge-CXyUIWzB.js → ToneBadge-WAMyKadz.js} +1 -1
  15. package/assets/assets/{TrafficPage-DQbBT3TP.js → TrafficPage-nXixENx9.js} +1 -1
  16. package/assets/assets/TrafficSourceDetailPage-ir5zJU_l.js +1 -0
  17. package/assets/assets/{account-context-Bhgg1lEH.js → account-context-BmN431xn.js} +1 -1
  18. package/assets/assets/agent-trust-copy-zfx8m-cx.js +1 -0
  19. package/assets/assets/{card-B16Dvxau.js → card-DUTMWeHB.js} +1 -1
  20. package/assets/assets/{extract-error-message-B5_v_-U8.js → extract-error-message-BFaIHLqb.js} +1 -1
  21. package/assets/assets/{format-helpers-Bs9rrO74.js → format-helpers-D1w2yznw.js} +1 -1
  22. package/assets/assets/index-C5r0VqgO.js +60 -0
  23. package/assets/assets/index-DIHdWY7b.css +1 -0
  24. package/assets/assets/{query-client-D-tt1sn3.js → query-client-DrIawr39.js} +1 -1
  25. package/assets/assets/react-query-DQuOVjDi.js +1 -0
  26. package/assets/assets/{react-sigma_core.esm.min-BfZVKh7v.js → react-sigma_core.esm.min-cvMDhRNS.js} +1 -1
  27. package/assets/assets/{service-Cmt36bhL.js → service-CvCKbPnf.js} +1 -1
  28. package/assets/index.html +8 -8
  29. package/dist/{ads-KBXA3LV6.js → ads-7IJTHW6T.js} +3 -3
  30. package/dist/{agent-OMNIUTNZ.js → agent-4UC2X7O2.js} +7 -7
  31. package/dist/{agent-ask-3JQNG2PE.js → agent-ask-SVPU2WQU.js} +3 -3
  32. package/dist/{agent-conversations-KO5PDSM2.js → agent-conversations-PJQRY5RX.js} +3 -3
  33. package/dist/{agent-journeys-QL6NG3BE.js → agent-journeys-JOD5DQ6G.js} +3 -3
  34. package/dist/{agent-memory-2WZ6LVAN.js → agent-memory-KTMZMUYF.js} +3 -3
  35. package/dist/{agent-providers-TABMSD4J.js → agent-providers-VEBB3WEW.js} +3 -3
  36. package/dist/{agent-transcript-YNF63MPR.js → agent-transcript-RRZJCMK2.js} +3 -3
  37. package/dist/{analytics-5FGY3FHC.js → analytics-EZV4XJKR.js} +3 -3
  38. package/dist/{apply-2HX4KYT6.js → apply-NP7ORQS4.js} +3 -3
  39. package/dist/{backfill-ABSW6J3S.js → backfill-7T6VFPWT.js} +10 -10
  40. package/dist/{backlinks-7CRPWNNN.js → backlinks-KTEJM2IP.js} +3 -3
  41. package/dist/{bing-IT46EUFH.js → bing-TC54HJUB.js} +3 -3
  42. package/dist/{bootstrap-CHOXLC7Q.js → bootstrap-UDSN22NT.js} +10 -10
  43. package/dist/{cdp-HQWKZGVQ.js → cdp-IZSHF3MS.js} +7 -7
  44. package/dist/{chunk-Q57GN464.js → chunk-2J5EUXO2.js} +1 -1
  45. package/dist/{chunk-HYEPL5UY.js → chunk-3K3QBKNC.js} +3 -3
  46. package/dist/{chunk-B42R2SPU.js → chunk-4EKPEVJ2.js} +191 -9
  47. package/dist/{chunk-LWYALZ6F.js → chunk-5KHF5FV5.js} +4 -4
  48. package/dist/{chunk-YPR2GVJC.js → chunk-5WEGX3H7.js} +1 -1
  49. package/dist/{chunk-OBGP3DRQ.js → chunk-5ZAQVRFL.js} +2 -2
  50. package/dist/{chunk-ZRL5FO5G.js → chunk-AZP37FMA.js} +3 -3
  51. package/dist/{chunk-43CPBLRJ.js → chunk-BLGYC2K7.js} +1 -1
  52. package/dist/{chunk-LE6ZODCY.js → chunk-CBNFWSWU.js} +2 -2
  53. package/dist/{chunk-6SVAUILQ.js → chunk-DU4QEC65.js} +2922 -2570
  54. package/dist/{chunk-LHAD6EK3.js → chunk-E6IZVSRY.js} +2 -2
  55. package/dist/{chunk-VCUNNS4R.js → chunk-EX6GVZAE.js} +1 -1
  56. package/dist/{chunk-LYNYNNOD.js → chunk-F5SQITTJ.js} +1 -1
  57. package/dist/{chunk-6TLHA6XA.js → chunk-GO4RP6XE.js} +3 -3
  58. package/dist/{chunk-EMSZDVDP.js → chunk-HHMOUS26.js} +5 -5
  59. package/dist/{chunk-I642VITF.js → chunk-IILPHGRC.js} +2 -2
  60. package/dist/{chunk-WJITVHAU.js → chunk-JAK37YKH.js} +2 -2
  61. package/dist/{chunk-OMUINNSO.js → chunk-KEIKD6JQ.js} +1 -1
  62. package/dist/{chunk-K3OY52MI.js → chunk-KUVTXIFX.js} +32 -10
  63. package/dist/{chunk-TZCUMC7U.js → chunk-LJ6VNMCY.js} +16 -8
  64. package/dist/{chunk-O7TWL6ZH.js → chunk-MJE3SGFW.js} +333 -203
  65. package/dist/{chunk-6Y75QV2S.js → chunk-OXI45LZP.js} +2 -2
  66. package/dist/{chunk-MZDIWY3K.js → chunk-RI2ZT3OR.js} +6 -6
  67. package/dist/{chunk-CEOIGQTS.js → chunk-RR76O744.js} +1 -1
  68. package/dist/{chunk-2MROJL32.js → chunk-STHWLBYT.js} +1 -1
  69. package/dist/{chunk-BIGIIVGV.js → chunk-SUSQEH2D.js} +55 -1
  70. package/dist/{chunk-QLKG7G4Y.js → chunk-TTXBQCE6.js} +21 -21
  71. package/dist/{chunk-WR4PA335.js → chunk-U3QNTJBP.js} +1 -1
  72. package/dist/{chunk-3EI4FHR5.js → chunk-UPFWF6TF.js} +4 -4
  73. package/dist/{chunk-D37PJYLD.js → chunk-UTG6UUGK.js} +1 -1
  74. package/dist/{chunk-AAKRCOQV.js → chunk-VBW33U4E.js} +2 -2
  75. package/dist/{chunk-GJE3OG4Y.js → chunk-WVMWY4SE.js} +3 -3
  76. package/dist/{chunk-3H6FSUKM.js → chunk-X3EU4UPS.js} +3 -3
  77. package/dist/{chunk-UYR5JI6R.js → chunk-Z5LJI5XK.js} +4 -4
  78. package/dist/{chunk-5PEVGTNX.js → chunk-ZFL5DOGJ.js} +341 -340
  79. package/dist/{citations-YRBUXEWU.js → citations-TOZK6OFP.js} +3 -3
  80. package/dist/{cli-catalog-JTIC72BY.js → cli-catalog-LNWBJNOD.js} +3 -3
  81. package/dist/{cli-commands-LUGJZGJU.js → cli-commands-3HX4JSDX.js} +7 -7
  82. package/dist/cli.js +13 -13
  83. package/dist/{competitor-ZKNDADMJ.js → competitor-54HLL354.js} +3 -3
  84. package/dist/{content-ANRSBG3Y.js → content-ZIGSMH5U.js} +3 -3
  85. package/dist/{dashboard-HTJBWAPW.js → dashboard-YJH6IQGK.js} +6 -6
  86. package/dist/{demo-V3ODU4JK.js → demo-ZYK5XCP3.js} +1 -1
  87. package/dist/{demo-server-QYMT3KT7.js → demo-server-LZ6MWJ2S.js} +12 -12
  88. package/dist/{discover-DX7KIWHU.js → discover-22QKOFIM.js} +3 -3
  89. package/dist/{discover-eval-PXWJYPHE.js → discover-eval-6IFCCH2S.js} +3 -3
  90. package/dist/{doctor-W2MTLKX7.js → doctor-WLLBFOJU.js} +3 -3
  91. package/dist/{evidence-PKKLSVNG.js → evidence-7VHTWNZW.js} +3 -3
  92. package/dist/{export-cmd-3PRWU7NH.js → export-cmd-5RZ3QDFH.js} +3 -3
  93. package/dist/{ga-QPH56JDO.js → ga-LPI3CWY4.js} +3 -3
  94. package/dist/{gbp-MJPIQZYZ.js → gbp-YBOMWR75.js} +3 -3
  95. package/dist/{google-2XZC7DNJ.js → google-N42X5FBH.js} +4 -4
  96. package/dist/{google-marketing-EDXL7ODG.js → google-marketing-SO4B7Z7L.js} +1 -1
  97. package/dist/{health-cmd-YR2MFYNK.js → health-cmd-W7RQWCEB.js} +3 -3
  98. package/dist/{history-OM4OXDOZ.js → history-SDRTOIDZ.js} +3 -3
  99. package/dist/index.d.ts +211 -5
  100. package/dist/index.js +25 -25
  101. package/dist/{init-5FAQPNH4.js → init-DPXOGP3P.js} +12 -12
  102. package/dist/{insights-YGMPBDVA.js → insights-636LLPVG.js} +3 -3
  103. package/dist/intelligence-service-JRVESWU2.js +16 -0
  104. package/dist/{journeys-ZPQCEHXY.js → journeys-NIXKVYA4.js} +21 -12
  105. package/dist/{keys-YZBRRGYE.js → keys-U2JR56TX.js} +3 -3
  106. package/dist/{keyword-HSPNKAJQ.js → keyword-GLRK2ZHR.js} +3 -3
  107. package/dist/{logs-NO2N7W34.js → logs-ENACGWGS.js} +3 -3
  108. package/dist/{mcp-EAGJ2Y2D.js → mcp-DST2XTP2.js} +4 -4
  109. package/dist/mcp.js +9 -9
  110. package/dist/{measurement-plan-6VCBAM5B.js → measurement-plan-Y3SA4ZQC.js} +5 -5
  111. package/dist/{notify-SS5H5GRB.js → notify-ZYXJQUHU.js} +3 -3
  112. package/dist/{organic-evidence-XOZQXTHF.js → organic-evidence-NSX7VCNW.js} +3 -3
  113. package/dist/{overview-3PLQYWDY.js → overview-UO6Z64IT.js} +4 -4
  114. package/dist/{project-ARUHBFCG.js → project-BHXUPHQA.js} +3 -3
  115. package/dist/{query-4KCFDJ5V.js → query-GDRAKEN5.js} +3 -3
  116. package/dist/{research-3NTYXGWN.js → research-YIOQ7WVP.js} +3 -3
  117. package/dist/{results-export-YOQQXBMP.js → results-export-KXMCAEHJ.js} +3 -3
  118. package/dist/{run-64UJAPPG.js → run-6PN5GOVE.js} +4 -4
  119. package/dist/{schedule-JN5JE4EK.js → schedule-5B67GLAM.js} +3 -3
  120. package/dist/{search-2QIHUMR7.js → search-BMVPCN2V.js} +3 -3
  121. package/dist/{serve-V2NPNYMP.js → serve-HB7DI7OC.js} +26 -26
  122. package/dist/{session-347VV5OG.js → session-3RTDTW6Z.js} +13 -13
  123. package/dist/{settings-XM5NGHFW.js → settings-FJEYHYRH.js} +3 -3
  124. package/dist/{skills-4MWWCA36.js → skills-6E7IUQUO.js} +2 -2
  125. package/dist/{snapshot-RWHR3VJ4.js → snapshot-BJQ7WPJZ.js} +3 -3
  126. package/dist/{src-HUF2NBUG.js → src-QU75IDHI.js} +6 -2
  127. package/dist/{status-3OI7PTQ5.js → status-3GHFPN54.js} +4 -4
  128. package/dist/{technical-aeo-RXHIFLHD.js → technical-aeo-76JRC66W.js} +3 -3
  129. package/dist/{telemetry-DZSITJKQ.js → telemetry-KB73JBDZ.js} +4 -4
  130. package/dist/{tools-ZUUOSB75.js → tools-6VWDHNPZ.js} +11 -11
  131. package/dist/{traffic-KIQBUHJW.js → traffic-XB7MZJ23.js} +5 -5
  132. package/dist/{users-ID4O7NXQ.js → users-HYBG3J72.js} +3 -3
  133. package/dist/{visibility-stats-X5MTD47P.js → visibility-stats-ZDB2LMRJ.js} +3 -3
  134. package/dist/{wordpress-WU2HLWIW.js → wordpress-SXKR6XNT.js} +3 -3
  135. package/package.json +1 -1
  136. package/assets/assets/ProjectPage-BoqDyoGi.js +0 -11
  137. package/assets/assets/TrafficSourceDetailPage-D3DwE6Qd.js +0 -1
  138. package/assets/assets/agent-trust-copy-CKZsKhc0.js +0 -1
  139. package/assets/assets/index-3aBRkQpI.js +0 -60
  140. package/assets/assets/index-BnmWwrZA.css +0 -1
  141. package/assets/assets/react-query-DQr9PoNm.js +0 -1
  142. package/dist/intelligence-service-GCN4S6QT.js +0 -16
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-AAKRCOQV.js";
3
+ } from "./chunk-VBW33U4E.js";
4
4
  import {
5
5
  emitJsonl
6
6
  } from "./chunk-Z7IUAJOF.js";
7
7
  import {
8
8
  measurementDraftOperationSchema,
9
9
  runMeasurementDraftAction
10
- } from "./chunk-LYNYNNOD.js";
10
+ } from "./chunk-F5SQITTJ.js";
11
11
  import {
12
12
  isMachineFormat,
13
13
  systemError
@@ -37,7 +37,7 @@ import {
37
37
  unattributedAnswersLabel,
38
38
  uncheckedSourcesLabel,
39
39
  visibilityReportRequestSchema
40
- } from "./chunk-K3OY52MI.js";
40
+ } from "./chunk-KUVTXIFX.js";
41
41
 
42
42
  // src/commands/measurement-plan.ts
43
43
  import crypto from "crypto";
@@ -1,36 +1,47 @@
1
1
  import {
2
2
  createLogger
3
- } from "./chunk-WJITVHAU.js";
3
+ } from "./chunk-JAK37YKH.js";
4
4
  import {
5
5
  addLikelyFakeAgentHits,
6
+ correctBackgroundCallJourneys,
7
+ mergeSplitJourneyVisitors,
6
8
  writeUnrecognizedAgentBuckets
7
- } from "./chunk-6SVAUILQ.js";
9
+ } from "./chunk-DU4QEC65.js";
8
10
  import {
11
+ AGENT_TRUST_RULES_VERSION,
9
12
  BROWSER_SHAPED_AGENT_MARKERS,
10
13
  DEFAULT_AI_CRAWLER_RULES,
11
14
  GENERIC_HTTP_CLIENTS,
15
+ JOURNEY_RULES_VERSION,
16
+ SCANNER_BURST_WINDOW_MS,
12
17
  SELF_TRAFFIC_USER_AGENT_PATTERNS,
13
18
  UNLISTED_AGENT_SKIPPED_EXTENSIONS,
14
19
  UNRECOGNIZED_AGENT_NAMING_VERSION,
15
20
  classifyAiUserFetch,
16
21
  classifyCrawler,
22
+ isScannerPath,
17
23
  isSelfTraffic,
24
+ normalizeTrafficPathPattern,
18
25
  unrecognizedAgentName
19
- } from "./chunk-O7TWL6ZH.js";
26
+ } from "./chunk-MJE3SGFW.js";
20
27
  import {
21
28
  RawEventSampleEventTypes,
29
+ agentJourneyCaptureDays,
30
+ agentJourneyEvents,
22
31
  aiUserFetchEventsHourly,
32
+ aiUserFetchVerificationManifestsHourly,
23
33
  crawlerEventsHourly,
24
34
  migrationsTable,
25
35
  parseJsonColumn,
26
36
  rawEventSamples,
27
37
  trafficReclassificationState,
28
38
  unrecognizedAgentEventsHourly
29
- } from "./chunk-BIGIIVGV.js";
39
+ } from "./chunk-SUSQEH2D.js";
30
40
  import {
31
41
  AI_ENGINE_DOMAINS,
32
42
  AI_ENGINE_SELF_DOMAINS,
33
43
  AgentTrustLevels,
44
+ AgentTrustReasons,
34
45
  AnchoredSpanSources,
35
46
  OPENROUTER_MODEL_PATTERN,
36
47
  OPENROUTER_ROUTE_FAMILY,
@@ -44,6 +55,7 @@ import {
44
55
  TrafficSourceTypes,
45
56
  UNRECORDED_TRAFFIC_PATH,
46
57
  VERTEX_AI_SEARCH_PROXY_DOMAIN,
58
+ VerificationStatuses,
47
59
  asRecord,
48
60
  describeError,
49
61
  hostMatchesAnyDomain,
@@ -57,7 +69,7 @@ import {
57
69
  retryAfterDelayMs,
58
70
  usageCount,
59
71
  withRetry
60
- } from "./chunk-K3OY52MI.js";
72
+ } from "./chunk-KUVTXIFX.js";
61
73
 
62
74
  // ../provider-openai/src/normalize.ts
63
75
  import OpenAI from "openai";
@@ -2929,7 +2941,7 @@ function extractStoredAnswerAnchors(provider, rawResponse) {
2929
2941
  // src/traffic-reclassify.ts
2930
2942
  import { createHash } from "crypto";
2931
2943
  import { setImmediate as yieldToEventLoop } from "timers/promises";
2932
- import { and, eq, inArray, sql } from "drizzle-orm";
2944
+ import { and, eq, gte, inArray, lte, ne, sql } from "drizzle-orm";
2933
2945
  var log = createLogger("TrafficReclassify");
2934
2946
  var STATE_ID = "default";
2935
2947
  var BATCH_SIZE = 200;
@@ -2947,6 +2959,8 @@ function trafficClassificationFingerprint() {
2947
2959
  })),
2948
2960
  self: SELF_TRAFFIC_USER_AGENT_PATTERNS.map(pattern),
2949
2961
  naming: UNRECOGNIZED_AGENT_NAMING_VERSION,
2962
+ trust: AGENT_TRUST_RULES_VERSION,
2963
+ journeys: JOURNEY_RULES_VERSION,
2950
2964
  genericClients: GENERIC_HTTP_CLIENTS,
2951
2965
  browserMarkers: BROWSER_SHAPED_AGENT_MARKERS,
2952
2966
  skippedExtensions: UNLISTED_AGENT_SKIPPED_EXTENSIONS
@@ -3178,6 +3192,163 @@ async function reclassifyUnknownSamples(db, opts) {
3178
3192
  }
3179
3193
  return result;
3180
3194
  }
3195
+ function hourlyAgentRow(key) {
3196
+ const table = aiUserFetchEventsHourly;
3197
+ return and(
3198
+ eq(table.projectId, key.projectId),
3199
+ eq(table.sourceId, key.sourceId),
3200
+ eq(table.tsHour, key.tsHour),
3201
+ eq(table.botId, key.botId),
3202
+ eq(table.verificationStatus, key.verificationStatus),
3203
+ eq(table.pathNormalized, key.pathNormalized),
3204
+ eq(table.status, key.status)
3205
+ );
3206
+ }
3207
+ async function reassessAgentHits(db, opts) {
3208
+ const result = { examined: 0, moved: 0, movedHits: 0 };
3209
+ const table = aiUserFetchEventsHourly;
3210
+ const lastStartingRowid = Number(db.select({ max: sql`max(rowid)` }).from(table).get()?.max ?? 0);
3211
+ let lastRowid = 0;
3212
+ for (; ; ) {
3213
+ if (opts.shouldStop()) break;
3214
+ const rows = db.select({
3215
+ rowid: sql`rowid`,
3216
+ projectId: table.projectId,
3217
+ sourceId: table.sourceId,
3218
+ tsHour: table.tsHour,
3219
+ botId: table.botId,
3220
+ operator: table.operator,
3221
+ verificationStatus: table.verificationStatus,
3222
+ pathNormalized: table.pathNormalized,
3223
+ status: table.status
3224
+ }).from(table).where(and(
3225
+ sql`rowid > ${lastRowid}`,
3226
+ sql`rowid <= ${lastStartingRowid}`,
3227
+ ne(table.verificationStatus, VerificationStatuses.verified),
3228
+ opts.projectIds ? inArray(table.projectId, [...opts.projectIds]) : void 0
3229
+ )).orderBy(sql`rowid`).limit(BATCH_SIZE).all();
3230
+ if (rows.length === 0) break;
3231
+ lastRowid = rows[rows.length - 1].rowid;
3232
+ result.examined += rows.length;
3233
+ const probes = rows.filter((row) => isScannerPath(row.pathNormalized));
3234
+ if (probes.length > 0) {
3235
+ db.transaction((tx) => {
3236
+ for (const row of probes) {
3237
+ const current = tx.select({ hits: table.hits }).from(table).where(hourlyAgentRow(row)).get();
3238
+ if (!current) continue;
3239
+ result.moved++;
3240
+ result.movedHits += current.hits;
3241
+ if (opts.dryRun) continue;
3242
+ addLikelyFakeAgentHits(tx, {
3243
+ projectId: row.projectId,
3244
+ sourceId: row.sourceId,
3245
+ buckets: [{ tsHour: row.tsHour, botId: row.botId, operator: row.operator, reason: AgentTrustReasons["scanner-path"], hits: current.hits }],
3246
+ now: opts.now
3247
+ });
3248
+ tx.delete(table).where(hourlyAgentRow(row)).run();
3249
+ }
3250
+ }, { behavior: "immediate" });
3251
+ }
3252
+ await yieldToEventLoop();
3253
+ }
3254
+ return result;
3255
+ }
3256
+ function moveAgentHitToBurst(tx, row, now) {
3257
+ const key = {
3258
+ projectId: row.projectId,
3259
+ sourceId: row.sourceId,
3260
+ tsHour: hourOf(row.ts),
3261
+ botId: row.agentId,
3262
+ verificationStatus: row.verificationStatus,
3263
+ pathNormalized: normalizeTrafficPathPattern(row.path),
3264
+ status: row.status ?? 0
3265
+ };
3266
+ const table = aiUserFetchEventsHourly;
3267
+ const taken = tx.update(table).set({ hits: sql`${table.hits} - 1`, updatedAt: now }).where(and(hourlyAgentRow(key), sql`${table.hits} > 0`)).run();
3268
+ if (taken.changes === 0) return;
3269
+ const manifests = aiUserFetchVerificationManifestsHourly;
3270
+ if (row.verificationManifest) {
3271
+ const manifestRow = and(
3272
+ eq(manifests.projectId, key.projectId),
3273
+ eq(manifests.sourceId, key.sourceId),
3274
+ eq(manifests.tsHour, key.tsHour),
3275
+ eq(manifests.botId, key.botId),
3276
+ eq(manifests.verificationStatus, key.verificationStatus),
3277
+ eq(manifests.pathNormalized, key.pathNormalized),
3278
+ eq(manifests.status, key.status),
3279
+ eq(manifests.manifestId, row.verificationManifest.id)
3280
+ );
3281
+ tx.update(manifests).set({ hits: sql`${manifests.hits} - 1`, updatedAt: now }).where(and(manifestRow, sql`${manifests.hits} > 0`)).run();
3282
+ tx.delete(manifests).where(and(manifestRow, sql`${manifests.hits} <= 0`)).run();
3283
+ }
3284
+ tx.delete(table).where(and(hourlyAgentRow(key), sql`${table.hits} <= 0`)).run();
3285
+ addLikelyFakeAgentHits(tx, {
3286
+ projectId: row.projectId,
3287
+ sourceId: row.sourceId,
3288
+ buckets: [{ tsHour: key.tsHour, botId: row.agentId, operator: row.operator, reason: AgentTrustReasons["scanner-burst"], hits: 1 }],
3289
+ now
3290
+ });
3291
+ }
3292
+ async function reassessAgentRequests(db, opts) {
3293
+ const result = { examined: 0, probes: 0, removed: 0 };
3294
+ const table = agentJourneyEvents;
3295
+ const clients = /* @__PURE__ */ new Map();
3296
+ const lastStartingRowid = Number(db.select({ max: sql`max(rowid)` }).from(table).get()?.max ?? 0);
3297
+ let lastRowid = 0;
3298
+ for (; ; ) {
3299
+ if (opts.shouldStop()) return result;
3300
+ const rows = db.select({ rowid: sql`rowid`, projectId: table.projectId, sourceId: table.sourceId, correlationKey: table.correlationKey, ts: table.ts, path: table.path }).from(table).where(and(
3301
+ sql`rowid > ${lastRowid}`,
3302
+ sql`rowid <= ${lastStartingRowid}`,
3303
+ ne(table.trust, AgentTrustLevels.verified),
3304
+ opts.projectIds ? inArray(table.projectId, [...opts.projectIds]) : void 0
3305
+ )).orderBy(sql`rowid`).limit(BATCH_SIZE).all();
3306
+ if (rows.length === 0) break;
3307
+ lastRowid = rows[rows.length - 1].rowid;
3308
+ result.examined += rows.length;
3309
+ for (const row of rows) {
3310
+ if (!isScannerPath(row.path)) continue;
3311
+ result.probes++;
3312
+ const id = JSON.stringify([row.projectId, row.sourceId, row.correlationKey]);
3313
+ const client = clients.get(id) ?? { projectId: row.projectId, sourceId: row.sourceId, correlationKey: row.correlationKey, probes: [] };
3314
+ client.probes.push(Date.parse(row.ts));
3315
+ clients.set(id, client);
3316
+ }
3317
+ await yieldToEventLoop();
3318
+ }
3319
+ for (const client of clients.values()) {
3320
+ if (opts.shouldStop()) break;
3321
+ const probes = client.probes.sort((a, b) => a - b);
3322
+ const from = new Date(probes[0] - SCANNER_BURST_WINDOW_MS).toISOString();
3323
+ const to = new Date(probes.at(-1) + SCANNER_BURST_WINDOW_MS).toISOString();
3324
+ db.transaction((tx) => {
3325
+ const rows = tx.select().from(table).where(and(
3326
+ eq(table.projectId, client.projectId),
3327
+ eq(table.sourceId, client.sourceId),
3328
+ eq(table.correlationKey, client.correlationKey),
3329
+ gte(table.ts, from),
3330
+ lte(table.ts, to),
3331
+ ne(table.trust, AgentTrustLevels.verified)
3332
+ )).all();
3333
+ for (const row of rows) {
3334
+ const probe = isScannerPath(row.path);
3335
+ const at = Date.parse(row.ts);
3336
+ if (!probe && !probes.some((t) => Math.abs(at - t) <= SCANNER_BURST_WINDOW_MS)) continue;
3337
+ result.removed++;
3338
+ if (opts.dryRun) continue;
3339
+ tx.delete(table).where(eq(table.id, row.id)).run();
3340
+ tx.update(agentJourneyCaptureDays).set({ storedEvents: sql`max(${agentJourneyCaptureDays.storedEvents} - 1, 0)` }).where(and(
3341
+ eq(agentJourneyCaptureDays.projectId, row.projectId),
3342
+ eq(agentJourneyCaptureDays.sourceId, row.sourceId),
3343
+ eq(agentJourneyCaptureDays.day, row.ts.slice(0, 10))
3344
+ )).run();
3345
+ if (!probe) moveAgentHitToBurst(tx, row, opts.now);
3346
+ }
3347
+ }, { behavior: "immediate" });
3348
+ await yieldToEventLoop();
3349
+ }
3350
+ return result;
3351
+ }
3181
3352
  async function reclassifyStoredTraffic(db, opts = {}) {
3182
3353
  const shared = {
3183
3354
  projectIds: opts.projectIds,
@@ -3187,7 +3358,11 @@ async function reclassifyStoredTraffic(db, opts = {}) {
3187
3358
  };
3188
3359
  const samples = await reclassifyUnknownSamples(db, shared);
3189
3360
  const unrecognized = shared.shouldStop() ? { examined: 0, moved: 0, movedHits: 0, renamed: 0, removed: 0, byBot: {} } : await reclassifyUnrecognizedRows(db, shared);
3190
- return { dryRun: shared.dryRun, samples, unrecognized };
3361
+ const agentHits = shared.shouldStop() ? { examined: 0, moved: 0, movedHits: 0 } : await reassessAgentHits(db, shared);
3362
+ const agentRequests = shared.shouldStop() ? { examined: 0, probes: 0, removed: 0 } : await reassessAgentRequests(db, shared);
3363
+ const journeys = shared.shouldStop() ? { visitors: 0, visitorsRemoved: 0, visitsRemoved: 0, visitsRelanded: 0 } : correctBackgroundCallJourneys(db, shared);
3364
+ const journeyMerges = shared.shouldStop() ? { visitorsMerged: 0, visitsJoined: 0 } : mergeSplitJourneyVisitors(db, shared);
3365
+ return { dryRun: shared.dryRun, samples, unrecognized, agentHits, agentRequests, journeys, journeyMerges };
3191
3366
  }
3192
3367
  async function reclassifyStoredTrafficIfRulesChanged(db, opts = {}) {
3193
3368
  const fingerprint = trafficClassificationFingerprint();
@@ -3209,7 +3384,7 @@ function startTrafficReclassification(opts) {
3209
3384
  const timer = setTimeout(() => {
3210
3385
  reclassifyStoredTrafficIfRulesChanged(opts.db, { shouldStop: () => stopped }).then((outcome) => {
3211
3386
  if (!outcome.ran || !outcome.result) return;
3212
- const { samples, unrecognized } = outcome.result;
3387
+ const { samples, unrecognized, agentHits, agentRequests, journeys, journeyMerges } = outcome.result;
3213
3388
  log.info("traffic-reclassify.completed", {
3214
3389
  samplesReclassified: samples.reclassified,
3215
3390
  samplesCounted: samples.counted,
@@ -3217,7 +3392,14 @@ function startTrafficReclassification(opts) {
3217
3392
  unrecognizedMoved: unrecognized.moved,
3218
3393
  unrecognizedMovedHits: unrecognized.movedHits,
3219
3394
  unrecognizedRenamed: unrecognized.renamed,
3220
- unrecognizedRemoved: unrecognized.removed
3395
+ unrecognizedRemoved: unrecognized.removed,
3396
+ agentHitsMoved: agentHits.movedHits,
3397
+ agentRequestsRemoved: agentRequests.removed,
3398
+ journeyVisitorsRemoved: journeys.visitorsRemoved,
3399
+ journeyVisitsRemoved: journeys.visitsRemoved,
3400
+ journeyVisitsRelanded: journeys.visitsRelanded,
3401
+ journeyVisitorsMerged: journeyMerges.visitorsMerged,
3402
+ journeyVisitsJoined: journeyMerges.visitsJoined
3221
3403
  });
3222
3404
  }).catch((err) => {
3223
3405
  if (!stopped) log.error("traffic-reclassify.failed", { error: describeError(err) });
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  registeredProviderNames
3
- } from "./chunk-OMUINNSO.js";
3
+ } from "./chunk-KEIKD6JQ.js";
4
4
  import {
5
5
  configExists,
6
6
  loadConfigRaw
7
- } from "./chunk-WR4PA335.js";
7
+ } from "./chunk-U3QNTJBP.js";
8
8
 
9
9
  // src/setup-state.ts
10
10
  import fs from "fs";
@@ -28,7 +28,7 @@ async function buildSetupState() {
28
28
  }
29
29
  if (dbPath && fs.existsSync(dbPath)) {
30
30
  try {
31
- const { createClient, projects, queries: queriesTable } = await import("./src-HUF2NBUG.js");
31
+ const { createClient, projects, queries: queriesTable } = await import("./src-QU75IDHI.js");
32
32
  const db = createClient(dbPath);
33
33
  project_count = db.select({ id: projects.id }).from(projects).all().length;
34
34
  const firstQuery = db.select({ id: queriesTable.id }).from(queriesTable).limit(1).all();
@@ -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-V2NPNYMP.js");
50
+ const { serveCommand } = await import("./serve-HB7DI7OC.js");
51
51
  await serveCommand(format);
52
52
  }
53
53
 
@@ -15,7 +15,7 @@ import {
15
15
  formatCanonryPluginUpdateHint,
16
16
  formatCanonryPluginVersionMismatch,
17
17
  skillsClientSchema
18
- } from "./chunk-K3OY52MI.js";
18
+ } from "./chunk-KUVTXIFX.js";
19
19
 
20
20
  // src/commands/skills.ts
21
21
  import crypto from "crypto";
@@ -5,7 +5,7 @@ import {
5
5
  siteCrawlGraphNodes,
6
6
  siteCrawlPages,
7
7
  siteCrawlSnapshots
8
- } from "./chunk-BIGIIVGV.js";
8
+ } from "./chunk-SUSQEH2D.js";
9
9
  import {
10
10
  SITE_CRAWL_GRAPH_MAX_EDGES,
11
11
  SITE_CRAWL_GRAPH_MAX_NODES,
@@ -15,7 +15,7 @@ import {
15
15
  factorStatusFromDistribution,
16
16
  factorStatusFromScore,
17
17
  roundPreservingTotal
18
- } from "./chunk-K3OY52MI.js";
18
+ } from "./chunk-KUVTXIFX.js";
19
19
 
20
20
  // src/site-audit-factors.ts
21
21
  function recordedSharePct(factor) {
@@ -2,11 +2,11 @@ import {
2
2
  dedupeGscSitemapUrls,
3
3
  resolveDiscoveredGscSitemapUrls,
4
4
  submitGscSitemapBatches
5
- } from "./chunk-CEOIGQTS.js";
5
+ } from "./chunk-RR76O744.js";
6
6
  import {
7
7
  measurementDraftOperationSchema,
8
8
  runMeasurementDraftAction
9
- } from "./chunk-LYNYNNOD.js";
9
+ } from "./chunk-F5SQITTJ.js";
10
10
  import {
11
11
  CliError
12
12
  } from "./chunk-HGMYEDAQ.js";
@@ -184,7 +184,7 @@ import {
184
184
  trafficUnrecognizedAgentsQuerySchema,
185
185
  visibilityCompareSelectionSchema,
186
186
  visibilityReportRequestSchema
187
- } from "./chunk-K3OY52MI.js";
187
+ } from "./chunk-KUVTXIFX.js";
188
188
 
189
189
  // src/mcp/tool-registry.ts
190
190
  import { z as z2 } from "zod";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  hostMatchesDomain
3
- } from "./chunk-K3OY52MI.js";
3
+ } from "./chunk-KUVTXIFX.js";
4
4
 
5
5
  // src/citation-utils.ts
6
6
  function pickProjectCitedDomain(citedDomains, projectDomains) {
@@ -5,7 +5,7 @@ import {
5
5
  loadConfig,
6
6
  loadConfigRaw,
7
7
  saveConfigPatch
8
- } from "./chunk-WR4PA335.js";
8
+ } from "./chunk-U3QNTJBP.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-K3OY52MI.js";
21
+ } from "./chunk-KUVTXIFX.js";
22
22
 
23
23
  // src/runtime-context.ts
24
24
  function cliRuntimeContext(env = process.env, stdio = process) {