@canonry/canonry 7.83.1 → 7.84.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 (110) hide show
  1. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +4 -0
  2. package/assets/agent-workspace/skills/canonry/references/server-side-traffic.md +14 -1
  3. package/dist/{ads-BSVYKQ2L.js → ads-KBXA3LV6.js} +3 -3
  4. package/dist/{agent-L7VUHOHS.js → agent-OMNIUTNZ.js} +7 -7
  5. package/dist/{agent-ask-A4HQCNLV.js → agent-ask-3JQNG2PE.js} +3 -3
  6. package/dist/{agent-conversations-L3TJJKPJ.js → agent-conversations-KO5PDSM2.js} +3 -3
  7. package/dist/{agent-journeys-FEXRAZYN.js → agent-journeys-QL6NG3BE.js} +3 -3
  8. package/dist/{agent-memory-LBTLOHUA.js → agent-memory-2WZ6LVAN.js} +3 -3
  9. package/dist/{agent-providers-X7V2IHRK.js → agent-providers-TABMSD4J.js} +3 -3
  10. package/dist/{agent-transcript-YSP2HKUZ.js → agent-transcript-YNF63MPR.js} +3 -3
  11. package/dist/{analytics-FBPHES6M.js → analytics-5FGY3FHC.js} +3 -3
  12. package/dist/{apply-PBCXZC5F.js → apply-2HX4KYT6.js} +3 -3
  13. package/dist/{backfill-FPKFZZD6.js → backfill-ABSW6J3S.js} +10 -9
  14. package/dist/{backlinks-QMLTF2VF.js → backlinks-7CRPWNNN.js} +3 -3
  15. package/dist/{bing-H65WGTXU.js → bing-IT46EUFH.js} +3 -3
  16. package/dist/{bootstrap-JAZNMAKP.js → bootstrap-CHOXLC7Q.js} +10 -10
  17. package/dist/{cdp-4DAMAHTB.js → cdp-HQWKZGVQ.js} +7 -7
  18. package/dist/{chunk-QAJDHHC5.js → chunk-2MROJL32.js} +1 -1
  19. package/dist/{chunk-7M7X54PL.js → chunk-3EI4FHR5.js} +4 -4
  20. package/dist/{chunk-SKH3N6WI.js → chunk-3H6FSUKM.js} +3 -3
  21. package/dist/{chunk-LZGVQSZL.js → chunk-43CPBLRJ.js} +1 -1
  22. package/dist/{chunk-ITQ3KPG2.js → chunk-5PEVGTNX.js} +338 -338
  23. package/dist/{chunk-ZDOT2XF2.js → chunk-6SVAUILQ.js} +3233 -3211
  24. package/dist/{chunk-X7U7XYJQ.js → chunk-6TLHA6XA.js} +3 -3
  25. package/dist/{chunk-7Q5BSCKN.js → chunk-6Y75QV2S.js} +2 -2
  26. package/dist/{chunk-IPPNN5KE.js → chunk-AAKRCOQV.js} +2 -2
  27. package/dist/{chunk-OMNS42ZQ.js → chunk-B42R2SPU.js} +341 -4
  28. package/dist/{chunk-3UFQI4KL.js → chunk-BIGIIVGV.js} +21 -1
  29. package/dist/{chunk-W5ZBMBBZ.js → chunk-CEOIGQTS.js} +1 -1
  30. package/dist/{chunk-WDEDEEWA.js → chunk-D37PJYLD.js} +1 -1
  31. package/dist/{chunk-M3FWZMO4.js → chunk-EMSZDVDP.js} +7 -7
  32. package/dist/{chunk-32U5LFIT.js → chunk-GJE3OG4Y.js} +3 -3
  33. package/dist/{chunk-JCWXEVYW.js → chunk-HYEPL5UY.js} +3 -3
  34. package/dist/{chunk-KCFIQJOL.js → chunk-I642VITF.js} +2 -2
  35. package/dist/{chunk-PHVIMUAQ.js → chunk-K3OY52MI.js} +3 -1
  36. package/dist/{chunk-YJOGWS7F.js → chunk-LE6ZODCY.js} +2 -2
  37. package/dist/{chunk-YCRPOY2Y.js → chunk-LHAD6EK3.js} +2 -2
  38. package/dist/{chunk-P7UE7HIX.js → chunk-LWYALZ6F.js} +4 -4
  39. package/dist/{chunk-KFMU6CLU.js → chunk-LYNYNNOD.js} +1 -1
  40. package/dist/{chunk-DH4DXUX4.js → chunk-MZDIWY3K.js} +6 -6
  41. package/dist/{chunk-IQTMHY23.js → chunk-O7TWL6ZH.js} +17607 -17548
  42. package/dist/{chunk-Y7WHB65J.js → chunk-OBGP3DRQ.js} +2 -2
  43. package/dist/{chunk-AA6P5NK3.js → chunk-OMUINNSO.js} +1 -1
  44. package/dist/{chunk-NCM6PX64.js → chunk-Q57GN464.js} +1 -1
  45. package/dist/{chunk-BIBFCAYR.js → chunk-QLKG7G4Y.js} +30 -25
  46. package/dist/{chunk-2LHPVDO5.js → chunk-TZCUMC7U.js} +29 -171
  47. package/dist/{chunk-P76XOEWL.js → chunk-UYR5JI6R.js} +4 -4
  48. package/dist/{chunk-SEAXXCU6.js → chunk-VCUNNS4R.js} +1 -1
  49. package/dist/{chunk-SVMTN7MI.js → chunk-WJITVHAU.js} +2 -2
  50. package/dist/{chunk-WA4FD5Y6.js → chunk-WR4PA335.js} +1 -1
  51. package/dist/{chunk-CBAYQHNX.js → chunk-YPR2GVJC.js} +1 -1
  52. package/dist/{chunk-HIC62JTS.js → chunk-ZRL5FO5G.js} +3 -3
  53. package/dist/{citations-MNLMO33V.js → citations-YRBUXEWU.js} +3 -3
  54. package/dist/{cli-catalog-IKF4A7ZS.js → cli-catalog-JTIC72BY.js} +3 -3
  55. package/dist/{cli-commands-OFL44XAT.js → cli-commands-LUGJZGJU.js} +7 -7
  56. package/dist/cli.js +13 -13
  57. package/dist/{competitor-5DY5PKNU.js → competitor-ZKNDADMJ.js} +3 -3
  58. package/dist/{content-XNK2YY4S.js → content-ANRSBG3Y.js} +3 -3
  59. package/dist/{dashboard-TKY5UW2E.js → dashboard-HTJBWAPW.js} +6 -6
  60. package/dist/{demo-ZAVNNINJ.js → demo-V3ODU4JK.js} +1 -1
  61. package/dist/{demo-server-K5CZX35Q.js → demo-server-QYMT3KT7.js} +12 -12
  62. package/dist/{discover-D4H4ALIE.js → discover-DX7KIWHU.js} +3 -3
  63. package/dist/{discover-eval-2CID2IBT.js → discover-eval-PXWJYPHE.js} +3 -3
  64. package/dist/{doctor-OWRQNDWF.js → doctor-W2MTLKX7.js} +3 -3
  65. package/dist/{evidence-SQX4IMQM.js → evidence-PKKLSVNG.js} +3 -3
  66. package/dist/{export-cmd-73PYMZZ5.js → export-cmd-3PRWU7NH.js} +3 -3
  67. package/dist/{ga-S6AKEVAL.js → ga-QPH56JDO.js} +3 -3
  68. package/dist/{gbp-57J3AXEY.js → gbp-MJPIQZYZ.js} +3 -3
  69. package/dist/{google-PPU5MJSV.js → google-2XZC7DNJ.js} +4 -4
  70. package/dist/{google-marketing-W4KZ74HX.js → google-marketing-EDXL7ODG.js} +1 -1
  71. package/dist/{health-cmd-QYP4MS3E.js → health-cmd-YR2MFYNK.js} +3 -3
  72. package/dist/{history-MFHBHYH7.js → history-OM4OXDOZ.js} +3 -3
  73. package/dist/index.d.ts +160 -76
  74. package/dist/index.js +25 -25
  75. package/dist/{init-B3QKVWPF.js → init-5FAQPNH4.js} +12 -12
  76. package/dist/{insights-IIMMXGRO.js → insights-YGMPBDVA.js} +3 -3
  77. package/dist/intelligence-service-GCN4S6QT.js +16 -0
  78. package/dist/{journeys-DXXRNANM.js → journeys-ZPQCEHXY.js} +3 -3
  79. package/dist/{keys-O3T52MLX.js → keys-YZBRRGYE.js} +3 -3
  80. package/dist/{keyword-MS23BR7O.js → keyword-HSPNKAJQ.js} +3 -3
  81. package/dist/{logs-SKR5OLTY.js → logs-NO2N7W34.js} +3 -3
  82. package/dist/{mcp-NFC2PBGD.js → mcp-EAGJ2Y2D.js} +4 -4
  83. package/dist/mcp.js +9 -9
  84. package/dist/{measurement-plan-Z73LMQYB.js → measurement-plan-6VCBAM5B.js} +5 -5
  85. package/dist/{notify-2RUWK2AR.js → notify-SS5H5GRB.js} +3 -3
  86. package/dist/{organic-evidence-BGAOEVMZ.js → organic-evidence-XOZQXTHF.js} +3 -3
  87. package/dist/{overview-DONWVYZT.js → overview-3PLQYWDY.js} +4 -4
  88. package/dist/{project-FFSPWR6R.js → project-ARUHBFCG.js} +3 -3
  89. package/dist/{query-AXEUWIW3.js → query-4KCFDJ5V.js} +3 -3
  90. package/dist/{research-YURAJRCV.js → research-3NTYXGWN.js} +3 -3
  91. package/dist/{results-export-ECSJKZHZ.js → results-export-YOQQXBMP.js} +3 -3
  92. package/dist/{run-27EXPBE4.js → run-64UJAPPG.js} +4 -4
  93. package/dist/{schedule-NY55SZZF.js → schedule-JN5JE4EK.js} +3 -3
  94. package/dist/{search-RXCBX3ST.js → search-2QIHUMR7.js} +3 -3
  95. package/dist/{serve-E4HDMCY5.js → serve-V2NPNYMP.js} +26 -26
  96. package/dist/{session-EVHTLNIH.js → session-347VV5OG.js} +13 -13
  97. package/dist/{settings-IPC5SSDU.js → settings-XM5NGHFW.js} +3 -3
  98. package/dist/{skills-Y3VNCWQM.js → skills-4MWWCA36.js} +2 -2
  99. package/dist/{snapshot-TPDSMADU.js → snapshot-RWHR3VJ4.js} +3 -3
  100. package/dist/{src-IDX2F2SR.js → src-HUF2NBUG.js} +4 -2
  101. package/dist/{status-YSQJBNM7.js → status-3OI7PTQ5.js} +4 -4
  102. package/dist/{technical-aeo-NMUQVIFG.js → technical-aeo-RXHIFLHD.js} +3 -3
  103. package/dist/{telemetry-OA6W7Q54.js → telemetry-DZSITJKQ.js} +4 -4
  104. package/dist/{tools-JPYR7UTF.js → tools-ZUUOSB75.js} +11 -11
  105. package/dist/{traffic-CE47IFFI.js → traffic-KIQBUHJW.js} +5 -5
  106. package/dist/{users-NMWBTCDI.js → users-ID4O7NXQ.js} +3 -3
  107. package/dist/{visibility-stats-DE64FVOJ.js → visibility-stats-X5MTD47P.js} +3 -3
  108. package/dist/{wordpress-AJWIJSM7.js → wordpress-WU2HLWIW.js} +3 -3
  109. package/package.json +1 -1
  110. package/dist/intelligence-service-HZ2LWOHB.js +0 -16
@@ -5,7 +5,7 @@ import {
5
5
  siteCrawlGraphNodes,
6
6
  siteCrawlPages,
7
7
  siteCrawlSnapshots
8
- } from "./chunk-3UFQI4KL.js";
8
+ } from "./chunk-BIGIIVGV.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-PHVIMUAQ.js";
18
+ } from "./chunk-K3OY52MI.js";
19
19
 
20
20
  // src/site-audit-factors.ts
21
21
  function recordedSharePct(factor) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  API_PROVIDER_NAMES,
3
3
  ProviderNames
4
- } from "./chunk-PHVIMUAQ.js";
4
+ } from "./chunk-K3OY52MI.js";
5
5
 
6
6
  // src/provider-registration.ts
7
7
  function isApiProviderRegistrable(name, entry) {
@@ -28,7 +28,7 @@ import {
28
28
  unknownUsageObservation,
29
29
  usdToMicros,
30
30
  withRetry
31
- } from "./chunk-PHVIMUAQ.js";
31
+ } from "./chunk-K3OY52MI.js";
32
32
 
33
33
  // ../provider-answer-services/src/core/http.ts
34
34
  var MAX_RESPONSE_BYTES = 8 * 1024 * 1024;
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  answerServiceAdapters,
3
3
  answerServiceDescriptors
4
- } from "./chunk-NCM6PX64.js";
4
+ } from "./chunk-Q57GN464.js";
5
5
  import {
6
6
  AeroLlmUsageFeatures,
7
7
  aeroTurnStatus,
@@ -27,14 +27,14 @@ import {
27
27
  resolveConfiguredAgentProvider,
28
28
  resolveSessionProviderAndModel,
29
29
  setAeroSystemPrompt
30
- } from "./chunk-DH4DXUX4.js";
30
+ } from "./chunk-MZDIWY3K.js";
31
31
  import {
32
32
  AeroToolProfiles,
33
33
  AeroToolScopes,
34
34
  buildAeroStateTools,
35
35
  isAeroToolProfile,
36
36
  truncateToolResult
37
- } from "./chunk-7M7X54PL.js";
37
+ } from "./chunk-3EI4FHR5.js";
38
38
  import {
39
39
  getGoogleAuthConfig,
40
40
  getGoogleConnection,
@@ -53,7 +53,7 @@ import {
53
53
  removeCloudflareTrafficConnection,
54
54
  removeCloudflareTrafficConnectionBySourceId,
55
55
  upsertCloudflareTrafficConnection
56
- } from "./chunk-QAJDHHC5.js";
56
+ } from "./chunk-2MROJL32.js";
57
57
  import {
58
58
  claudeAdapter,
59
59
  embedQueries,
@@ -63,8 +63,9 @@ import {
63
63
  museAdapter,
64
64
  openaiAdapter,
65
65
  openrouterAdapter,
66
- perplexityAdapter
67
- } from "./chunk-OMNS42ZQ.js";
66
+ perplexityAdapter,
67
+ startTrafficReclassification
68
+ } from "./chunk-B42R2SPU.js";
68
69
  import {
69
70
  classifyUsageSurface,
70
71
  createApiUsageTelemetry,
@@ -76,7 +77,7 @@ import {
76
77
  startOutcomeTimer,
77
78
  trackFeatureCompleted,
78
79
  trackInstallState
79
- } from "./chunk-P76XOEWL.js";
80
+ } from "./chunk-UYR5JI6R.js";
80
81
  import {
81
82
  isLoopbackBindHost
82
83
  } from "./chunk-TSENU4GG.js";
@@ -84,7 +85,7 @@ import {
84
85
  isApiProviderRegistrable,
85
86
  isCdpProviderRegistrable,
86
87
  registeredProviderNames
87
- } from "./chunk-AA6P5NK3.js";
88
+ } from "./chunk-OMUINNSO.js";
88
89
  import {
89
90
  checkLatestVersionForServer,
90
91
  getOrCreateAnonymousId,
@@ -96,17 +97,17 @@ import {
96
97
  recordDashboardEvent,
97
98
  setTelemetryPreference,
98
99
  trackEvent
99
- } from "./chunk-YJOGWS7F.js";
100
+ } from "./chunk-LE6ZODCY.js";
100
101
  import {
101
102
  createCanonryMcpServer
102
- } from "./chunk-32U5LFIT.js";
103
+ } from "./chunk-GJE3OG4Y.js";
103
104
  import {
104
105
  CANONRY_MCP_TIERS,
105
106
  CANONRY_MCP_TOOLKIT_NAMES
106
107
  } from "./chunk-MTW37GXF.js";
107
108
  import {
108
109
  ApiClient
109
- } from "./chunk-IPPNN5KE.js";
110
+ } from "./chunk-AAKRCOQV.js";
110
111
  import {
111
112
  AGENT_PROVIDERS,
112
113
  adapterSupportsBatch,
@@ -138,21 +139,21 @@ import {
138
139
  saveConfigPatch,
139
140
  sentimentInstallReadiness,
140
141
  updateSharedProviderExecutionGate
141
- } from "./chunk-WA4FD5Y6.js";
142
+ } from "./chunk-WR4PA335.js";
142
143
  import {
143
144
  getBundledSkillSnapshots
144
- } from "./chunk-CBAYQHNX.js";
145
+ } from "./chunk-YPR2GVJC.js";
145
146
  import {
146
147
  computeFactorAverages,
147
148
  deleteSiteCrawlGraphLayout,
148
149
  persistSiteCrawlGraphLayout,
149
150
  prepareSiteCrawlGraphLayout,
150
151
  recordedSharePct
151
- } from "./chunk-Y7WHB65J.js";
152
+ } from "./chunk-OBGP3DRQ.js";
152
153
  import {
153
154
  CanonryMcpToolNames,
154
155
  canonryMcpTools
155
- } from "./chunk-HIC62JTS.js";
156
+ } from "./chunk-ZRL5FO5G.js";
156
157
  import {
157
158
  PACKAGE_VERSION
158
159
  } from "./chunk-AOJU5LKX.js";
@@ -161,16 +162,16 @@ import {
161
162
  } from "./chunk-HGMYEDAQ.js";
162
163
  import {
163
164
  IntelligenceService
164
- } from "./chunk-M3FWZMO4.js";
165
+ } from "./chunk-EMSZDVDP.js";
166
+ import {
167
+ computeCitedCompetitorDomains,
168
+ determineCitationState
169
+ } from "./chunk-43CPBLRJ.js";
165
170
  import {
166
171
  addLogListener,
167
172
  createFastifyLogger,
168
173
  createLogger
169
- } from "./chunk-SVMTN7MI.js";
170
- import {
171
- computeCitedCompetitorDomains,
172
- determineCitationState
173
- } from "./chunk-LZGVQSZL.js";
174
+ } from "./chunk-WJITVHAU.js";
174
175
  import {
175
176
  BingApiError,
176
177
  CC_CACHE_DIR,
@@ -291,7 +292,7 @@ import {
291
292
  webhookResponseReason,
292
293
  webhookTargetRefusalReason,
293
294
  writeAuditLog
294
- } from "./chunk-ZDOT2XF2.js";
295
+ } from "./chunk-6SVAUILQ.js";
295
296
  import {
296
297
  OperationalLogStore,
297
298
  SentimentIdempotencyConflict,
@@ -379,7 +380,7 @@ import {
379
380
  unrecognizedAgentEventsHourly,
380
381
  unrecognizedAgentNotifyState,
381
382
  usageCounters
382
- } from "./chunk-3UFQI4KL.js";
383
+ } from "./chunk-BIGIIVGV.js";
383
384
  import {
384
385
  AGENT_MEMORY_VALUE_MAX_BYTES,
385
386
  AI_ENGINE_DOMAINS,
@@ -635,7 +636,7 @@ import {
635
636
  winnabilityClassLabel,
636
637
  withRetry,
637
638
  withSkippedProviders
638
- } from "./chunk-PHVIMUAQ.js";
639
+ } from "./chunk-K3OY52MI.js";
639
640
 
640
641
  // src/google-marketing-runtime.ts
641
642
  import crypto2 from "crypto";
@@ -5939,7 +5940,7 @@ function nonBlank(value) {
5939
5940
  return trimmed ? trimmed : void 0;
5940
5941
  }
5941
5942
  function resolveBuildCommit(env = process.env) {
5942
- const embedded = true ? "32fe862d5a435b4df92c0452b82af35be0401698" : void 0;
5943
+ const embedded = true ? "88b182f4672a0864706cb31d16b494faad16468d" : void 0;
5943
5944
  return nonBlank(embedded) ?? nonBlank(env.CANONRY_COMMIT);
5944
5945
  }
5945
5946
  function resolveInstanceIdentity(env = process.env) {
@@ -20372,6 +20373,7 @@ async function createServer(opts) {
20372
20373
  let stopSiteLiveness = null;
20373
20374
  let stopReviewDeliveries = null;
20374
20375
  let stopUnrecognizedAgentAlerts = null;
20376
+ let stopTrafficReclassification = null;
20375
20377
  let stopProviderBatchPoller = null;
20376
20378
  let stopInstallState = null;
20377
20379
  const scheduler = new Scheduler(opts.db, {
@@ -22027,6 +22029,7 @@ async function createServer(opts) {
22027
22029
  });
22028
22030
  stopReviewDeliveries = startReviewDeliveryLoop(() => notifier.drainDueReviewDeliveries());
22029
22031
  stopUnrecognizedAgentAlerts = startUnrecognizedAgentAlertLoop(() => notifier.dispatchUnrecognizedAgentAlerts());
22032
+ stopTrafficReclassification = startTrafficReclassification({ db: opts.db });
22030
22033
  stopProviderBatchPoller = startProviderBatchPoller({ db: opts.db, registry, runner: jobRunner });
22031
22034
  if (!embed.enabled) {
22032
22035
  stopInstallState = startInstallStateTelemetry({
@@ -22055,6 +22058,8 @@ async function createServer(opts) {
22055
22058
  stopReviewDeliveries = null;
22056
22059
  stopUnrecognizedAgentAlerts?.();
22057
22060
  stopUnrecognizedAgentAlerts = null;
22061
+ stopTrafficReclassification?.();
22062
+ stopTrafficReclassification = null;
22058
22063
  stopProviderBatchPoller?.();
22059
22064
  stopProviderBatchPoller = null;
22060
22065
  stopInstallState?.();
@@ -1,40 +1,34 @@
1
1
  import {
2
2
  OPENAI_RETRIEVAL_CONTRACT,
3
3
  openrouterAdapter,
4
+ reclassifyStoredTraffic,
4
5
  reparseStoredResult,
5
6
  reparseStoredResult2,
6
7
  reparseStoredResult3,
7
8
  reparseStoredResult4,
8
9
  reparseStoredResult5,
9
10
  resolveStoredApiResponse
10
- } from "./chunk-OMNS42ZQ.js";
11
+ } from "./chunk-B42R2SPU.js";
11
12
  import {
12
13
  loadConfig
13
- } from "./chunk-WA4FD5Y6.js";
14
+ } from "./chunk-WR4PA335.js";
14
15
  import {
15
16
  isMachineFormat
16
17
  } from "./chunk-HGMYEDAQ.js";
17
18
  import {
18
19
  determineCitationState
19
- } from "./chunk-LZGVQSZL.js";
20
+ } from "./chunk-43CPBLRJ.js";
20
21
  import {
21
- addLikelyFakeAgentHits,
22
22
  backfillProjectAnswerMentions,
23
23
  competitorIdentityColumns,
24
24
  createRunCompetitorResolver,
25
25
  readMarketCompetitorNames,
26
26
  refreshSnapshotMentionIdentity
27
- } from "./chunk-ZDOT2XF2.js";
28
- import {
29
- classifyAiUserFetch,
30
- classifyCrawler
31
- } from "./chunk-IQTMHY23.js";
27
+ } from "./chunk-6SVAUILQ.js";
32
28
  import {
33
29
  RawEventSampleEventTypes,
34
- aiUserFetchEventsHourly,
35
30
  auditLog,
36
31
  competitors,
37
- crawlerEventsHourly,
38
32
  createClient,
39
33
  gaAiReferrals,
40
34
  gaTrafficSnapshots,
@@ -44,15 +38,11 @@ import {
44
38
  querySnapshots,
45
39
  rawEventSamples,
46
40
  runs
47
- } from "./chunk-3UFQI4KL.js";
41
+ } from "./chunk-BIGIIVGV.js";
48
42
  import {
49
- AgentTrustLevels,
50
43
  ProviderNames,
51
44
  RetrievalContracts,
52
45
  RunKinds,
53
- TrafficEventConfidences,
54
- TrafficEvidenceKinds,
55
- TrafficSourceTypes,
56
46
  computeCompetitorOverlap,
57
47
  countsAsMention,
58
48
  determineAnswerMentioned,
@@ -61,7 +51,7 @@ import {
61
51
  extractRecommendedCompetitors,
62
52
  normalizeUrlPath,
63
53
  openRouterRouteModel
64
- } from "./chunk-PHVIMUAQ.js";
54
+ } from "./chunk-K3OY52MI.js";
65
55
 
66
56
  // src/commands/backfill.ts
67
57
  import { setImmediate as yieldToEventLoop } from "timers/promises";
@@ -439,7 +429,7 @@ No DB writes performed. Re-run without --dry-run to apply.`);
439
429
  }
440
430
  }
441
431
  async function backfillInsightsCommand(project, opts) {
442
- const { IntelligenceService } = await import("./intelligence-service-HZ2LWOHB.js");
432
+ const { IntelligenceService } = await import("./intelligence-service-GCN4S6QT.js");
443
433
  const config = loadConfig();
444
434
  const db = createClient(config.database);
445
435
  migrate(db);
@@ -799,163 +789,30 @@ async function backfillTrafficClassificationCommand(opts) {
799
789
  if (!isJson) {
800
790
  const mode = isDryRun ? " [DRY RUN \u2014 no writes]" : "";
801
791
  const scope = projectFilter ? `"${projectFilter}"` : "all projects";
802
- process.stderr.write(`Re-classifying unknown traffic samples for ${scope}${mode}...
792
+ process.stderr.write(`Re-classifying stored unknown traffic for ${scope}${mode}...
803
793
  `);
804
794
  }
805
795
  const projectIds = scopedProjects.map((p) => p.id);
806
- const result = {
807
- project: projectFilter ?? null,
808
- examined: 0,
809
- reclassified: 0,
810
- unknownBefore: 0,
811
- unknownAfter: 0,
812
- dryRun: isDryRun,
813
- byBot: {}
814
- };
815
- const unknownCountRow = db.select({ n: sql`count(*)` }).from(rawEventSamples).where(and(
796
+ const countUnknown = () => Number(db.select({ n: sql`count(*)` }).from(rawEventSamples).where(and(
816
797
  eq(rawEventSamples.eventType, RawEventSampleEventTypes.unknown),
817
798
  inArray(rawEventSamples.projectId, projectIds)
818
- )).get();
819
- result.unknownBefore = Number(unknownCountRow?.n ?? 0);
820
- const unknownSamples = db.select({
821
- id: rawEventSamples.id,
822
- projectId: rawEventSamples.projectId,
823
- sourceId: rawEventSamples.sourceId,
824
- ts: rawEventSamples.ts,
825
- userAgent: rawEventSamples.userAgent,
826
- pathNormalized: rawEventSamples.pathNormalized,
827
- status: rawEventSamples.status
828
- }).from(rawEventSamples).where(and(
829
- eq(rawEventSamples.eventType, RawEventSampleEventTypes.unknown),
830
- inArray(rawEventSamples.projectId, projectIds)
831
- )).all();
832
- result.examined = unknownSamples.length;
833
- if (unknownSamples.length === 0) {
834
- result.unknownAfter = result.unknownBefore;
835
- emitTrafficClassificationReport(result, isJson);
836
- return;
837
- }
838
- const now = (/* @__PURE__ */ new Date()).toISOString();
839
- for (const snap of unknownSamples) {
840
- if (!snap.userAgent) continue;
841
- const probe = {
842
- sourceType: TrafficSourceTypes["cloud-run"],
843
- evidenceKind: TrafficEvidenceKinds["raw-request"],
844
- confidence: TrafficEventConfidences.observed,
845
- eventId: snap.id,
846
- observedAt: snap.ts,
847
- method: "GET",
848
- requestUrl: `https://placeholder${snap.pathNormalized}`,
849
- host: "placeholder",
850
- path: snap.pathNormalized,
851
- queryString: null,
852
- status: snap.status ?? 200,
853
- userAgent: snap.userAgent,
854
- remoteIp: null,
855
- referer: null,
856
- latencyMs: null,
857
- requestSizeBytes: null,
858
- responseSizeBytes: null,
859
- providerResource: { type: "cloud_run_revision", labels: {} },
860
- providerLabels: {}
861
- };
862
- const userFetch = classifyAiUserFetch(probe);
863
- const classified = userFetch ?? classifyCrawler(probe);
864
- if (!classified) continue;
865
- result.reclassified++;
866
- result.byBot[classified.botId] = (result.byBot[classified.botId] ?? 0) + 1;
867
- if (isDryRun) continue;
868
- const tsHour = new Date(snap.ts);
869
- tsHour.setUTCMinutes(0, 0, 0);
870
- const tsHourIso = tsHour.toISOString();
871
- const status = snap.status ?? 200;
872
- db.transaction((tx) => {
873
- tx.update(rawEventSamples).set({
874
- eventType: userFetch ? RawEventSampleEventTypes.aiUserFetch : RawEventSampleEventTypes.crawler,
875
- classifierDetailsJson: {
876
- crawler: userFetch ? null : { ...classified, verificationManifest: null },
877
- aiUserFetch: userFetch ? { ...userFetch, verificationManifest: null } : null,
878
- aiReferral: null
879
- }
880
- }).where(eq(rawEventSamples.id, snap.id)).run();
881
- if (userFetch?.trust === AgentTrustLevels.likely_fake) {
882
- addLikelyFakeAgentHits(tx, {
883
- projectId: snap.projectId,
884
- sourceId: snap.sourceId,
885
- buckets: [{ tsHour: tsHourIso, botId: userFetch.botId, operator: userFetch.operator, reason: userFetch.trustReasons[0], hits: 1 }],
886
- now
887
- });
888
- } else if (userFetch) {
889
- tx.insert(aiUserFetchEventsHourly).values({
890
- projectId: snap.projectId,
891
- sourceId: snap.sourceId,
892
- tsHour: tsHourIso,
893
- botId: userFetch.botId,
894
- operator: userFetch.operator,
895
- verificationStatus: userFetch.verificationStatus,
896
- pathNormalized: snap.pathNormalized,
897
- status,
898
- hits: 1,
899
- sampledUserAgent: snap.userAgent,
900
- createdAt: now,
901
- updatedAt: now
902
- }).onConflictDoUpdate({
903
- target: [
904
- aiUserFetchEventsHourly.projectId,
905
- aiUserFetchEventsHourly.sourceId,
906
- aiUserFetchEventsHourly.tsHour,
907
- aiUserFetchEventsHourly.botId,
908
- aiUserFetchEventsHourly.verificationStatus,
909
- aiUserFetchEventsHourly.pathNormalized,
910
- aiUserFetchEventsHourly.status
911
- ],
912
- set: {
913
- hits: sql`${aiUserFetchEventsHourly.hits} + 1`,
914
- updatedAt: now
915
- }
916
- }).run();
917
- } else {
918
- tx.insert(crawlerEventsHourly).values({
919
- projectId: snap.projectId,
920
- sourceId: snap.sourceId,
921
- tsHour: tsHourIso,
922
- botId: classified.botId,
923
- operator: classified.operator,
924
- verificationStatus: classified.verificationStatus,
925
- pathNormalized: snap.pathNormalized,
926
- status,
927
- hits: 1,
928
- sampledUserAgent: snap.userAgent,
929
- createdAt: now,
930
- updatedAt: now
931
- }).onConflictDoUpdate({
932
- target: [
933
- crawlerEventsHourly.projectId,
934
- crawlerEventsHourly.sourceId,
935
- crawlerEventsHourly.tsHour,
936
- crawlerEventsHourly.botId,
937
- crawlerEventsHourly.verificationStatus,
938
- crawlerEventsHourly.pathNormalized,
939
- crawlerEventsHourly.status
940
- ],
941
- set: {
942
- hits: sql`${crawlerEventsHourly.hits} + 1`,
943
- updatedAt: now
944
- }
945
- }).run();
946
- }
947
- });
948
- }
949
- if (!isDryRun) {
950
- const afterRow = db.select({ n: sql`count(*)` }).from(rawEventSamples).where(and(
951
- eq(rawEventSamples.eventType, RawEventSampleEventTypes.unknown),
952
- inArray(rawEventSamples.projectId, projectIds)
953
- )).get();
954
- result.unknownAfter = Number(afterRow?.n ?? 0);
955
- } else {
956
- result.unknownAfter = result.unknownBefore - result.reclassified;
957
- }
958
- emitTrafficClassificationReport(result, isJson);
799
+ )).get()?.n ?? 0);
800
+ 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;
804
+ emitTrafficClassificationReport({
805
+ project: projectFilter ?? null,
806
+ examined: stored.samples.examined,
807
+ reclassified: stored.samples.reclassified,
808
+ 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,
813
+ byBot,
814
+ unrecognized: stored.unrecognized
815
+ }, isJson);
959
816
  }
960
817
  function emitTrafficClassificationReport(result, isJson) {
961
818
  if (isJson) {
@@ -969,7 +826,8 @@ Traffic classification ${result.dryRun ? "preview" : "recovery"} complete.`);
969
826
  console.log(` ${verb}: ${result.reclassified}`);
970
827
  console.log(` Unknown before: ${result.unknownBefore}`);
971
828
  console.log(` Unknown after: ${result.unknownAfter}`);
972
- if (result.reclassified > 0) {
829
+ 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`);
830
+ if (Object.keys(result.byBot).length > 0) {
973
831
  console.log(` By bot:`);
974
832
  const sorted = Object.entries(result.byBot).sort(([, a], [, b]) => b - a);
975
833
  for (const [bot, count] of sorted) {
@@ -2,13 +2,13 @@ import {
2
2
  bucketCliCommandDuration,
3
3
  isTelemetryEnabled,
4
4
  trackEvent
5
- } from "./chunk-YJOGWS7F.js";
5
+ } from "./chunk-LE6ZODCY.js";
6
6
  import {
7
7
  getConfigDir
8
- } from "./chunk-WA4FD5Y6.js";
8
+ } from "./chunk-WR4PA335.js";
9
9
  import {
10
10
  currentOutcomeAttribution
11
- } from "./chunk-WDEDEEWA.js";
11
+ } from "./chunk-D37PJYLD.js";
12
12
  import {
13
13
  AGENT_NONE,
14
14
  OutcomeSurfaces,
@@ -19,7 +19,7 @@ import {
19
19
  integrationConnectionPropertiesSchema,
20
20
  normalizeAgentSlug,
21
21
  usageSurfaceSchema
22
- } from "./chunk-PHVIMUAQ.js";
22
+ } from "./chunk-K3OY52MI.js";
23
23
 
24
24
  // src/outcome-telemetry.ts
25
25
  import fs from "fs";
@@ -5,7 +5,7 @@ import {
5
5
  AppError,
6
6
  parseWindowIn,
7
7
  resolveDateRange
8
- } from "./chunk-PHVIMUAQ.js";
8
+ } from "./chunk-K3OY52MI.js";
9
9
 
10
10
  // src/cli-access.ts
11
11
  var CLI_ACCESS_BY_ID = Object.freeze({
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getRequestContext
3
- } from "./chunk-WDEDEEWA.js";
3
+ } from "./chunk-D37PJYLD.js";
4
4
  import {
5
5
  diagnosticIdentity,
6
6
  redactLogString,
7
7
  redactLogValue
8
- } from "./chunk-PHVIMUAQ.js";
8
+ } from "./chunk-K3OY52MI.js";
9
9
 
10
10
  // ../api-routes/src/runtime-logger.ts
11
11
  import { format } from "util";
@@ -20,7 +20,7 @@ import {
20
20
  resolveProviderModel,
21
21
  schedulableRunKindSchema,
22
22
  sentimentEvaluatorProviderSchema
23
- } from "./chunk-PHVIMUAQ.js";
23
+ } from "./chunk-K3OY52MI.js";
24
24
 
25
25
  // ../config/src/index.ts
26
26
  import { z as z5 } from "zod";
@@ -15,7 +15,7 @@ import {
15
15
  formatCanonryPluginUpdateHint,
16
16
  formatCanonryPluginVersionMismatch,
17
17
  skillsClientSchema
18
- } from "./chunk-PHVIMUAQ.js";
18
+ } from "./chunk-K3OY52MI.js";
19
19
 
20
20
  // src/commands/skills.ts
21
21
  import crypto from "crypto";
@@ -2,11 +2,11 @@ import {
2
2
  dedupeGscSitemapUrls,
3
3
  resolveDiscoveredGscSitemapUrls,
4
4
  submitGscSitemapBatches
5
- } from "./chunk-W5ZBMBBZ.js";
5
+ } from "./chunk-CEOIGQTS.js";
6
6
  import {
7
7
  measurementDraftOperationSchema,
8
8
  runMeasurementDraftAction
9
- } from "./chunk-KFMU6CLU.js";
9
+ } from "./chunk-LYNYNNOD.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-PHVIMUAQ.js";
187
+ } from "./chunk-K3OY52MI.js";
188
188
 
189
189
  // src/mcp/tool-registry.ts
190
190
  import { z as z2 } from "zod";
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-IPPNN5KE.js";
4
- import "./chunk-WA4FD5Y6.js";
3
+ } from "./chunk-AAKRCOQV.js";
4
+ import "./chunk-WR4PA335.js";
5
5
  import "./chunk-AOJU5LKX.js";
6
6
  import "./chunk-HGMYEDAQ.js";
7
- import "./chunk-PHVIMUAQ.js";
7
+ import "./chunk-K3OY52MI.js";
8
8
  import "./chunk-MLKGABMK.js";
9
9
 
10
10
  // src/commands/citations.ts
@@ -3,11 +3,11 @@ import {
3
3
  buildCliCatalog,
4
4
  printCliCatalog,
5
5
  renderTopLevelHelp
6
- } from "./chunk-X7U7XYJQ.js";
7
- import "./chunk-SEAXXCU6.js";
6
+ } from "./chunk-6TLHA6XA.js";
7
+ import "./chunk-VCUNNS4R.js";
8
8
  import "./chunk-Z7IUAJOF.js";
9
9
  import "./chunk-HGMYEDAQ.js";
10
- import "./chunk-PHVIMUAQ.js";
10
+ import "./chunk-K3OY52MI.js";
11
11
  import "./chunk-MLKGABMK.js";
12
12
  export {
13
13
  CLI_ROOT_SUMMARIES,
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  REGISTERED_CLI_COMMANDS
3
- } from "./chunk-ITQ3KPG2.js";
3
+ } from "./chunk-5PEVGTNX.js";
4
4
  import "./chunk-6GO5VVAC.js";
5
5
  import "./chunk-VJWDBFSL.js";
6
- import "./chunk-JCWXEVYW.js";
6
+ import "./chunk-HYEPL5UY.js";
7
7
  import "./chunk-TSENU4GG.js";
8
- import "./chunk-IPPNN5KE.js";
9
- import "./chunk-WA4FD5Y6.js";
10
- import "./chunk-SEAXXCU6.js";
8
+ import "./chunk-AAKRCOQV.js";
9
+ import "./chunk-WR4PA335.js";
10
+ import "./chunk-VCUNNS4R.js";
11
11
  import "./chunk-Z7IUAJOF.js";
12
- import "./chunk-KFMU6CLU.js";
12
+ import "./chunk-LYNYNNOD.js";
13
13
  import "./chunk-AOJU5LKX.js";
14
14
  import "./chunk-HGMYEDAQ.js";
15
- import "./chunk-PHVIMUAQ.js";
15
+ import "./chunk-K3OY52MI.js";
16
16
  import "./chunk-MLKGABMK.js";
17
17
  export {
18
18
  REGISTERED_CLI_COMMANDS