@canonry/canonry 7.53.0 → 7.54.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 (145) hide show
  1. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +13 -0
  2. package/assets/assets/AgentSetupPage-Dr7UsGcq.js +17 -0
  3. package/assets/assets/AuditHistoryPanel-Dg9ZNNQw.js +1 -0
  4. package/assets/assets/BacklinksPage-DSgwyFCi.js +1 -0
  5. package/assets/assets/{HistoryPage-D2DOk7ms.js → HistoryPage-DaX20IWP.js} +1 -1
  6. package/assets/assets/MeasurementPropertyPage-FGhKdZAP.js +4 -0
  7. package/assets/assets/ProjectPage-BTJYS9gc.js +7 -0
  8. package/assets/assets/RunsPage-D06GJ47B.js +1 -0
  9. package/assets/assets/SettingsPage-MSgC8Zrc.js +1 -0
  10. package/assets/assets/SiteHealthSection-4PXTNjon.js +2 -0
  11. package/assets/assets/ToneBadge-AoUA_EpE.js +60 -0
  12. package/assets/assets/TrafficPage-DikPWmaU.js +40 -0
  13. package/assets/assets/TrafficSourceDetailPage-C1hfimWW.js +1 -0
  14. package/assets/assets/account-context-CHtJm4fz.js +1 -0
  15. package/assets/assets/card-BO6dtEV9.js +1 -0
  16. package/assets/assets/extract-error-message-Q9pkEqUE.js +1 -0
  17. package/assets/assets/{format-helpers-B_2jkVGI.js → format-helpers-Gj1ekh6p.js} +1 -1
  18. package/assets/assets/{index-DgS5TTSb.css → index-B8W65ejO.css} +1 -1
  19. package/assets/assets/index-BBfEsbxI.js +56 -0
  20. package/assets/assets/query-client-C22j0Z7h.js +1 -0
  21. package/assets/assets/react-query-BLKqSvlU.js +1 -0
  22. package/assets/assets/{react-sigma_core.esm.min-Bjux3j_1.js → react-sigma_core.esm.min-j5DWE8Rk.js} +1 -1
  23. package/assets/assets/service-2DEngBCR.js +1 -0
  24. package/assets/index.html +8 -7
  25. package/dist/{ads-S4S74OXM.js → ads-A5S2NQBZ.js} +3 -3
  26. package/dist/{agent-JZWKCI5V.js → agent-BV7G7QN7.js} +7 -7
  27. package/dist/{agent-ask-N2DG5ZLZ.js → agent-ask-5ALAHZ6T.js} +3 -3
  28. package/dist/{agent-conversations-7UDNE7YI.js → agent-conversations-MJPQCJYR.js} +3 -3
  29. package/dist/{agent-memory-I74OWTU7.js → agent-memory-Z3VPA5KH.js} +3 -3
  30. package/dist/{agent-providers-MEMCZPGE.js → agent-providers-FP3LAZPG.js} +3 -3
  31. package/dist/{agent-transcript-Z7VTL7PY.js → agent-transcript-4GXCOC73.js} +3 -3
  32. package/dist/{analytics-4NUSNTKT.js → analytics-TOLSUYSN.js} +3 -3
  33. package/dist/{apply-OZKQK3YF.js → apply-EU5JAFVZ.js} +3 -3
  34. package/dist/{backfill-PLY2NOOY.js → backfill-3263IYJH.js} +9 -9
  35. package/dist/{backlinks-2CMRJFWO.js → backlinks-XQ5JTN6W.js} +3 -3
  36. package/dist/{bing-RD3DDESD.js → bing-LYHRD7BF.js} +3 -3
  37. package/dist/{bootstrap-JOYV4SWM.js → bootstrap-AKWTIMMH.js} +17 -9
  38. package/dist/{cdp-LUGL3CT6.js → cdp-N4PQJWGQ.js} +7 -7
  39. package/dist/{chunk-P4SXRRB4.js → chunk-2SY2FYFW.js} +298 -110
  40. package/dist/{chunk-U7JJKXLA.js → chunk-4LVJFSPH.js} +5 -5
  41. package/dist/{chunk-3DO3CS7Y.js → chunk-5P7DSHNK.js} +4 -4
  42. package/dist/{chunk-C5GCRQ66.js → chunk-6WTSWWP6.js} +2 -2
  43. package/dist/{chunk-LGU3O5YP.js → chunk-75CFTTBF.js} +2 -2
  44. package/dist/{chunk-NKSASP4U.js → chunk-B37SDIGU.js} +1 -1
  45. package/dist/{chunk-N3WQHLDI.js → chunk-BQKKAPMW.js} +13 -1
  46. package/dist/{chunk-BQT7VLGM.js → chunk-D234NBWI.js} +1 -1
  47. package/dist/{chunk-DFQHGWPB.js → chunk-EIG2V6UI.js} +1 -1
  48. package/dist/{chunk-BH274VEO.js → chunk-GFRIXUDK.js} +36 -2
  49. package/dist/{chunk-LYCYSM6O.js → chunk-H6EQMYGT.js} +1 -1
  50. package/dist/{chunk-23UZNTF4.js → chunk-J7VN3FZ3.js} +1 -1
  51. package/dist/{chunk-IWQGZQHE.js → chunk-K5MBEK4S.js} +8 -8
  52. package/dist/{chunk-6VSKBVB3.js → chunk-LCTYTGSE.js} +3 -3
  53. package/dist/{chunk-ZXH5IFIA.js → chunk-MARVEIWH.js} +4 -4
  54. package/dist/{chunk-SZG7S7TE.js → chunk-OHVXKFQI.js} +1 -1
  55. package/dist/{chunk-2GAXZAQJ.js → chunk-OMXWBR2R.js} +7227 -6562
  56. package/dist/{chunk-QNU7IIO7.js → chunk-PFPTUCMG.js} +324 -324
  57. package/dist/{chunk-JZARXJV6.js → chunk-PRNO5TLE.js} +456 -249
  58. package/dist/{chunk-6ZCZRZ66.js → chunk-QFKDFU73.js} +2 -2
  59. package/dist/chunk-R4AFXPM4.js +959 -0
  60. package/dist/{chunk-O3OTW7F4.js → chunk-RHCDUPD6.js} +2 -2
  61. package/dist/{chunk-N6MS4VG2.js → chunk-SKZVEZZK.js} +7 -2
  62. package/dist/{chunk-2XDGFHPM.js → chunk-T63KVDWY.js} +3 -3
  63. package/dist/{chunk-F55ER5RQ.js → chunk-VB47PTY7.js} +3 -3
  64. package/dist/{chunk-QARV5HVI.js → chunk-VCTP2RG6.js} +5 -5
  65. package/dist/{chunk-RVBGFWJ3.js → chunk-VF7XGX2I.js} +1 -1
  66. package/dist/{chunk-QXJ356KK.js → chunk-VMCVLESK.js} +4 -4
  67. package/dist/{chunk-WNXKW3NS.js → chunk-WDJMIIY2.js} +1 -1
  68. package/dist/{chunk-2HWY4NRQ.js → chunk-XJVCTI2N.js} +3 -3
  69. package/dist/{chunk-XTIP5WSA.js → chunk-Y2YBRLSS.js} +3 -3
  70. package/dist/{chunk-VEH4YLWR.js → chunk-YOZ35ZTT.js} +1 -1
  71. package/dist/{chunk-2EYBZYDG.js → chunk-ZA7D7CCN.js} +2 -2
  72. package/dist/{chunk-BGZL5RCP.js → chunk-ZILJZNMQ.js} +1 -1
  73. package/dist/{citations-GMLBTNLW.js → citations-JK3ZMAR7.js} +3 -3
  74. package/dist/{cli-catalog-WKUCQEWA.js → cli-catalog-P2I6IYNI.js} +3 -3
  75. package/dist/{cli-commands-YCHQWUNK.js → cli-commands-YDRKG6OC.js} +7 -7
  76. package/dist/cli.js +13 -13
  77. package/dist/{competitor-QNPVJFEI.js → competitor-5CJPM36M.js} +3 -3
  78. package/dist/{content-NFTC74HD.js → content-5FEDXNHR.js} +3 -3
  79. package/dist/{dashboard-TMUQT5H5.js → dashboard-ME7MBJTX.js} +6 -6
  80. package/dist/{demo-O5SPVLZZ.js → demo-N7MEASQP.js} +1 -1
  81. package/dist/{demo-server-WKZ53RGK.js → demo-server-IGTBANDC.js} +11 -11
  82. package/dist/{discover-LTTO7KHN.js → discover-EAISVTA6.js} +3 -3
  83. package/dist/{discover-eval-QRDNMDUE.js → discover-eval-JIBKK44Q.js} +3 -3
  84. package/dist/{doctor-SFL5FOW4.js → doctor-HSQYOZ4C.js} +3 -3
  85. package/dist/{evidence-J6WZ767P.js → evidence-PSYAWKPP.js} +3 -3
  86. package/dist/{export-cmd-D3JDTBDV.js → export-cmd-MWJN6H7W.js} +3 -3
  87. package/dist/{ga-N56LXQUN.js → ga-WSQWECYY.js} +3 -3
  88. package/dist/{gbp-7WVJYWDR.js → gbp-OD26AEPF.js} +3 -3
  89. package/dist/{google-YLRVXYVJ.js → google-FMJ7IWAF.js} +4 -4
  90. package/dist/{google-marketing-4DGX3RBB.js → google-marketing-66JL4V24.js} +1 -1
  91. package/dist/{health-cmd-PK3BASF6.js → health-cmd-2RO5LAI4.js} +3 -3
  92. package/dist/{history-UWTEZ626.js → history-X6CNPW7G.js} +3 -3
  93. package/dist/index.d.ts +484 -49
  94. package/dist/index.js +24 -23
  95. package/dist/{init-RBI2IOBY.js → init-25III66S.js} +11 -11
  96. package/dist/{insights-ZUC5XHFD.js → insights-6IWWA6JU.js} +3 -3
  97. package/dist/intelligence-service-N334P6FH.js +15 -0
  98. package/dist/{keys-NOG3M76V.js → keys-ABXAPISY.js} +3 -3
  99. package/dist/{keyword-HD57L76I.js → keyword-LERAVMI3.js} +3 -3
  100. package/dist/{logs-VAB7ITBS.js → logs-BTAB5SNZ.js} +3 -3
  101. package/dist/{mcp-HYHIL5FB.js → mcp-5E42RT6R.js} +2 -2
  102. package/dist/mcp.js +9 -9
  103. package/dist/{measurement-plan-GEHOHCH3.js → measurement-plan-MRZRNBJG.js} +5 -5
  104. package/dist/{notify-VQ2ZDGN4.js → notify-YQYGC5UZ.js} +3 -3
  105. package/dist/{organic-evidence-6TX627YW.js → organic-evidence-6QT4YT3K.js} +3 -3
  106. package/dist/{overview-XBO7WYAV.js → overview-EHZ3FTS2.js} +4 -4
  107. package/dist/{project-DR6744WZ.js → project-RNLV2ARE.js} +3 -3
  108. package/dist/{query-OGVTCPG5.js → query-IM2RXI4L.js} +3 -3
  109. package/dist/{research-B2TGKSMC.js → research-4FALR336.js} +25 -10
  110. package/dist/{results-export-K7PAYPWQ.js → results-export-4ETSRUGO.js} +3 -3
  111. package/dist/{run-Y6LUMCVL.js → run-QL7226N7.js} +4 -4
  112. package/dist/{schedule-PNAUJ5FX.js → schedule-GJE634VO.js} +3 -3
  113. package/dist/{search-PMVOGL4U.js → search-7OQL67R6.js} +3 -3
  114. package/dist/{serve-PQHXSS5T.js → serve-UN2OEK2Q.js} +25 -24
  115. package/dist/{session-S5NDMMKF.js → session-5M54TVY5.js} +12 -12
  116. package/dist/{settings-AL7E7QUK.js → settings-2QOL7YBM.js} +15 -3
  117. package/dist/{skills-GQOOTDR7.js → skills-GPLAAU3I.js} +2 -2
  118. package/dist/{snapshot-W3FXRTZM.js → snapshot-5YMJFRJS.js} +8 -6
  119. package/dist/{src-WZLTQFCH.js → src-YF3JLURF.js} +2 -2
  120. package/dist/{status-MBJVN4W5.js → status-WGWC6FLN.js} +33 -5
  121. package/dist/{technical-aeo-Y4RFST72.js → technical-aeo-RNMLD7OL.js} +3 -3
  122. package/dist/{telemetry-VK6F5QSZ.js → telemetry-7U3ZICU4.js} +4 -4
  123. package/dist/{tools-W3AQY5TY.js → tools-CSKTZTKT.js} +11 -11
  124. package/dist/{traffic-ER4I6V3B.js → traffic-QIAXLW6J.js} +5 -5
  125. package/dist/{users-KZK2OF4L.js → users-I6X5P5AO.js} +3 -3
  126. package/dist/{visibility-stats-CR7BUG5G.js → visibility-stats-33OUKQQL.js} +3 -3
  127. package/dist/{wordpress-DG5JUCAC.js → wordpress-3IO3O27D.js} +3 -3
  128. package/package.json +2 -1
  129. package/assets/assets/AccessControls-B-5YUuLE.js +0 -1
  130. package/assets/assets/AuditHistoryPanel-BkCUPvPv.js +0 -1
  131. package/assets/assets/BacklinksPage-BMgHZKuw.js +0 -1
  132. package/assets/assets/MeasurementPropertyPage-Bwv8nKS7.js +0 -4
  133. package/assets/assets/ProjectPage-CsJfGPx3.js +0 -7
  134. package/assets/assets/RunsPage-DSHDuj9b.js +0 -1
  135. package/assets/assets/SettingsPage-BDRdWk5X.js +0 -1
  136. package/assets/assets/SiteHealthSection-DV06NTxC.js +0 -2
  137. package/assets/assets/TrafficPage-CBMMwRfw.js +0 -40
  138. package/assets/assets/TrafficSourceDetailPage-Czpt0S7j.js +0 -1
  139. package/assets/assets/card-CVejjbhs.js +0 -60
  140. package/assets/assets/extract-error-message-Co6zPipR.js +0 -1
  141. package/assets/assets/index-BnS2Vuv0.js +0 -40
  142. package/assets/assets/query-client-BKJLgjJd.js +0 -1
  143. package/assets/assets/react-query-ltP1RErY.js +0 -1
  144. package/assets/assets/service-CDsqgNrS.js +0 -1
  145. package/dist/intelligence-service-JXXB43RB.js +0 -15
@@ -1,3 +1,7 @@
1
+ import {
2
+ answerServiceAdapters,
3
+ answerServiceDescriptors
4
+ } from "./chunk-R4AFXPM4.js";
1
5
  import {
2
6
  AeroLlmUsageFeatures,
3
7
  aeroTurnStatus,
@@ -23,14 +27,14 @@ import {
23
27
  resolveConfiguredAgentProvider,
24
28
  resolveSessionProviderAndModel,
25
29
  setAeroSystemPrompt
26
- } from "./chunk-QARV5HVI.js";
30
+ } from "./chunk-VCTP2RG6.js";
27
31
  import {
28
32
  AeroToolProfiles,
29
33
  AeroToolScopes,
30
34
  buildAeroStateTools,
31
35
  isAeroToolProfile,
32
36
  truncateToolResult
33
- } from "./chunk-ZXH5IFIA.js";
37
+ } from "./chunk-MARVEIWH.js";
34
38
  import {
35
39
  getGoogleAuthConfig,
36
40
  getGoogleConnection,
@@ -49,7 +53,7 @@ import {
49
53
  removeCloudflareTrafficConnection,
50
54
  removeCloudflareTrafficConnectionBySourceId,
51
55
  upsertCloudflareTrafficConnection
52
- } from "./chunk-WNXKW3NS.js";
56
+ } from "./chunk-WDJMIIY2.js";
53
57
  import {
54
58
  claudeAdapter,
55
59
  embedQueries,
@@ -60,7 +64,7 @@ import {
60
64
  openaiAdapter,
61
65
  openrouterAdapter,
62
66
  perplexityAdapter
63
- } from "./chunk-N6MS4VG2.js";
67
+ } from "./chunk-SKZVEZZK.js";
64
68
  import {
65
69
  classifyUsageSurface,
66
70
  createApiUsageTelemetry,
@@ -72,7 +76,7 @@ import {
72
76
  startOutcomeTimer,
73
77
  trackFeatureCompleted,
74
78
  trackInstallState
75
- } from "./chunk-QXJ356KK.js";
79
+ } from "./chunk-VMCVLESK.js";
76
80
  import {
77
81
  isLoopbackBindHost
78
82
  } from "./chunk-TSENU4GG.js";
@@ -80,7 +84,7 @@ import {
80
84
  isApiProviderRegistrable,
81
85
  isCdpProviderRegistrable,
82
86
  registeredProviderNames
83
- } from "./chunk-RVBGFWJ3.js";
87
+ } from "./chunk-VF7XGX2I.js";
84
88
  import {
85
89
  checkLatestVersionForServer,
86
90
  getOrCreateAnonymousId,
@@ -91,17 +95,17 @@ import {
91
95
  recordDashboardEvent,
92
96
  setTelemetryPreference,
93
97
  trackEvent
94
- } from "./chunk-6ZCZRZ66.js";
98
+ } from "./chunk-QFKDFU73.js";
95
99
  import {
96
100
  createCanonryMcpServer
97
- } from "./chunk-6VSKBVB3.js";
101
+ } from "./chunk-LCTYTGSE.js";
98
102
  import {
99
103
  CANONRY_MCP_TIERS,
100
104
  CANONRY_MCP_TOOLKIT_NAMES
101
105
  } from "./chunk-4MJYGB56.js";
102
106
  import {
103
107
  ApiClient
104
- } from "./chunk-O3OTW7F4.js";
108
+ } from "./chunk-RHCDUPD6.js";
105
109
  import {
106
110
  AGENT_PROVIDERS,
107
111
  adapterSupportsBatch,
@@ -132,21 +136,21 @@ import {
132
136
  saveConfigPatch,
133
137
  sentimentInstallReadiness,
134
138
  updateSharedProviderExecutionGate
135
- } from "./chunk-N3WQHLDI.js";
139
+ } from "./chunk-BQKKAPMW.js";
136
140
  import {
137
141
  getBundledSkillSnapshots
138
- } from "./chunk-NKSASP4U.js";
142
+ } from "./chunk-B37SDIGU.js";
139
143
  import {
140
144
  computeFactorAverages,
141
145
  deleteSiteCrawlGraphLayout,
142
146
  persistSiteCrawlGraphLayout,
143
147
  prepareSiteCrawlGraphLayout,
144
148
  recordedSharePct
145
- } from "./chunk-2EYBZYDG.js";
149
+ } from "./chunk-ZA7D7CCN.js";
146
150
  import {
147
151
  CanonryMcpToolNames,
148
152
  canonryMcpTools
149
- } from "./chunk-2XDGFHPM.js";
153
+ } from "./chunk-T63KVDWY.js";
150
154
  import {
151
155
  PACKAGE_VERSION
152
156
  } from "./chunk-AOJU5LKX.js";
@@ -158,11 +162,11 @@ import {
158
162
  addLogListener,
159
163
  createFastifyLogger,
160
164
  createLogger
161
- } from "./chunk-U7JJKXLA.js";
165
+ } from "./chunk-4LVJFSPH.js";
162
166
  import {
163
167
  computeCitedCompetitorDomains,
164
168
  determineCitationState
165
- } from "./chunk-BGZL5RCP.js";
169
+ } from "./chunk-ZILJZNMQ.js";
166
170
  import {
167
171
  BingApiError,
168
172
  CC_CACHE_DIR,
@@ -189,6 +193,7 @@ import {
189
193
  auditFromRequest,
190
194
  backfillProjectAnswerMentions,
191
195
  backfillProjectAnswerMentionsInChunks,
196
+ blockedAddressReason,
192
197
  buildLocationProfileFields,
193
198
  captureSimpleMeasurementDefinition,
194
199
  ccReleasePaths,
@@ -272,13 +277,14 @@ import {
272
277
  sentimentClassifierInput,
273
278
  sentimentHash,
274
279
  serializeUserSessionCookie,
280
+ stripIpv6Brackets,
275
281
  syncRunClaimKey,
276
282
  toAlertView,
277
283
  webhookOutcomeTarget,
278
284
  webhookResponseReason,
279
285
  webhookTargetRefusalReason,
280
286
  writeAuditLog
281
- } from "./chunk-JZARXJV6.js";
287
+ } from "./chunk-PRNO5TLE.js";
282
288
  import {
283
289
  OperationalLogStore,
284
290
  SentimentIdempotencyConflict,
@@ -360,7 +366,7 @@ import {
360
366
  siteLivenessState,
361
367
  trafficSources,
362
368
  usageCounters
363
- } from "./chunk-BH274VEO.js";
369
+ } from "./chunk-GFRIXUDK.js";
364
370
  import {
365
371
  AGENT_MEMORY_VALUE_MAX_BYTES,
366
372
  AI_ENGINE_DOMAINS,
@@ -390,11 +396,16 @@ import {
390
396
  GoogleAdsSnapshotKinds,
391
397
  GoogleMarketingProviders,
392
398
  GtmSnapshotKinds,
399
+ HostedMcpStatuses,
400
+ HostedMcpUnavailableReasons,
393
401
  INTEGRATION_NAMES,
402
+ IncompleteAnswerError,
394
403
  IntegrationNames,
395
404
  LlmCapabilities,
405
+ LocationTreatmentStatuses,
396
406
  MEASUREMENT_CHANGES_NOISE_ANSWERS,
397
407
  MEASUREMENT_PLAN_V2_SCHEMA_VERSION,
408
+ McpTransportStatuses,
398
409
  MemorySources,
399
410
  ONBOARDING_FLOW_VERSION,
400
411
  OPERATION_ACCESS_HEADER,
@@ -412,6 +423,7 @@ import {
412
423
  ProviderDispatchModes,
413
424
  ProviderNames,
414
425
  ProviderReloadErrorReasons,
426
+ ProviderWorkflows,
415
427
  ROUTE_CAPABLE_CITED_URL_PROVIDERS,
416
428
  RUN_FILL_PROVIDER_BREAKER,
417
429
  ResearchQueryStatuses,
@@ -435,6 +447,7 @@ import {
435
447
  USAGE_TELEMETRY_HEADERS,
436
448
  UserRoles,
437
449
  actionConfidenceLabel,
450
+ adapterConnectionName,
438
451
  adsAccountDtoSchema,
439
452
  adsConversionEventSettingListResponseSchema,
440
453
  adsConversionPixelListResponseSchema,
@@ -444,6 +457,7 @@ import {
444
457
  agentMemoryUpsertRequestSchema,
445
458
  agentPromptRequestSchema,
446
459
  answerProseForMentions,
460
+ answerServiceCatalogFields,
447
461
  asRecord,
448
462
  authInvalid,
449
463
  authRequired,
@@ -456,6 +470,7 @@ import {
456
470
  buildSnapshotUsage,
457
471
  businessProfileReviewsCover,
458
472
  calendarRecurrenceSchema,
473
+ canGenerateText,
459
474
  canonicalSentimentJson,
460
475
  canonicalizeGtmAccountId,
461
476
  canonicalizeGtmContainerId,
@@ -511,11 +526,14 @@ import {
511
526
  gtmRawSnapshotDtoSchema,
512
527
  gtmWorkspaceListResponseSchema,
513
528
  hasCurrentSentimentTemplate,
529
+ hasDirectCitedUrls,
514
530
  hostMatchesAnyDomain,
515
531
  hostMatchesDomain,
516
532
  hostOf,
517
533
  inclusiveDayCount,
518
534
  isBrowserProvider,
535
+ isCitationMeasurable,
536
+ isEligibleFor,
519
537
  isNegativeReviewRating,
520
538
  isOpenRouterRoute,
521
539
  isReadOnlyKey,
@@ -541,7 +559,6 @@ import {
541
559
  notificationEventSchema,
542
560
  observeTemplateLinkDetection,
543
561
  observeTemplateLinkEdges,
544
- openRouterRouteModel,
545
562
  operationInProgress,
546
563
  parseMeasurementRunManifestV1,
547
564
  parseOriginList,
@@ -556,8 +573,10 @@ import {
556
573
  reportMonthsForDoctor,
557
574
  resolveNegativeReviewMaxStars,
558
575
  resolveProviderModel,
576
+ resolveProviderRoute,
559
577
  resolveSnapshotRequestQueries,
560
578
  retryAfterDelayMs,
579
+ routeFamiliesOf,
561
580
  sentimentClassifierInputSchema,
562
581
  sentimentClassifierOutputSchema,
563
582
  sentimentEvaluatorProvider,
@@ -582,7 +601,7 @@ import {
582
601
  winnabilityClassLabel,
583
602
  withRetry,
584
603
  withSkippedProviders
585
- } from "./chunk-2GAXZAQJ.js";
604
+ } from "./chunk-OMXWBR2R.js";
586
605
 
587
606
  // src/google-marketing-runtime.ts
588
607
  import crypto2 from "crypto";
@@ -3269,7 +3288,7 @@ import { createRequire } from "module";
3269
3288
  import crypto26 from "crypto";
3270
3289
  import fs5 from "fs";
3271
3290
  import path5 from "path";
3272
- import { isIP } from "net";
3291
+ import { isIP as isIP2 } from "net";
3273
3292
  import { fileURLToPath } from "url";
3274
3293
  import { setImmediate as yieldToEventLoop4 } from "timers/promises";
3275
3294
  import { and as and25, eq as eq31, isNotNull as isNotNull5, isNull as isNull5, lte as lte2, max, ne as ne4, or as or3, sql as sql13 } from "drizzle-orm";
@@ -5078,7 +5097,7 @@ function nonBlank(value) {
5078
5097
  return trimmed ? trimmed : void 0;
5079
5098
  }
5080
5099
  function resolveBuildCommit(env = process.env) {
5081
- const embedded = true ? "e27d5bf88109fe71ea2bfa3a1456e269ca3370d8" : void 0;
5100
+ const embedded = true ? "8a7aeb563a46919b478a60a2e42295365042c4db" : void 0;
5082
5101
  return nonBlank(embedded) ?? nonBlank(env.CANONRY_COMMIT);
5083
5102
  }
5084
5103
  function resolveInstanceIdentity(env = process.env) {
@@ -5098,6 +5117,12 @@ import { and as and3, asc as asc2, count, desc, eq as eq3, inArray, isNotNull, i
5098
5117
 
5099
5118
  // src/run-telemetry.ts
5100
5119
  import crypto4 from "crypto";
5120
+ function telemetryConnectionName(name) {
5121
+ const connection = providerConnectionName(name);
5122
+ if (connection !== name || isBrowserProvider(name)) return connection;
5123
+ const separator = name.indexOf(":");
5124
+ return separator > 0 ? name.slice(0, separator) : name;
5125
+ }
5101
5126
  function extractRegistrableHost(input) {
5102
5127
  if (!input) return null;
5103
5128
  const trimmed = input.trim();
@@ -5125,7 +5150,7 @@ function buildRunCompletedProps(input) {
5125
5150
  const props = {
5126
5151
  status: input.status,
5127
5152
  providerCount: input.providerCount,
5128
- providers: [...new Set(input.providers.map(providerConnectionName))],
5153
+ providers: [...new Set(input.providers.map(telemetryConnectionName))],
5129
5154
  queryCount: input.queryCount,
5130
5155
  durationMs: totalMs
5131
5156
  };
@@ -5138,7 +5163,7 @@ function buildRunCompletedProps(input) {
5138
5163
  return props;
5139
5164
  }
5140
5165
  function runUsageProps(answers) {
5141
- const counted = answers.map((answer) => ({ ...answer, provider: providerConnectionName(answer.provider) })).filter((answer) => KNOWN_PROVIDERS.has(answer.provider));
5166
+ const counted = answers.map((answer) => ({ ...answer, provider: telemetryConnectionName(answer.provider) })).filter((answer) => KNOWN_PROVIDERS.has(answer.provider));
5142
5167
  if (counted.length === 0) return {};
5143
5168
  const providerCalls = {};
5144
5169
  for (const answer of [...counted].sort((left, right) => compareText(left.provider, right.provider))) {
@@ -5160,7 +5185,7 @@ function runUsageProps(answers) {
5160
5185
  function providerLatencyProps(latencies) {
5161
5186
  const byConnection = /* @__PURE__ */ new Map();
5162
5187
  for (const [provider, values] of latencies ?? []) {
5163
- const connection = providerConnectionName(provider);
5188
+ const connection = telemetryConnectionName(provider);
5164
5189
  if (!KNOWN_PROVIDERS.has(connection)) continue;
5165
5190
  const samples = byConnection.get(connection) ?? [];
5166
5191
  samples.push(...values);
@@ -5203,7 +5228,7 @@ function buildProviderOutcomeProps(providers, providerErrors, skippedProviders =
5203
5228
  const skipped = new Set(skippedProviders);
5204
5229
  const grouped = /* @__PURE__ */ new Map();
5205
5230
  for (const provider of /* @__PURE__ */ new Set([...providers, ...providerErrors.keys(), ...skipped])) {
5206
- const name = providerConnectionName(provider);
5231
+ const name = telemetryConnectionName(provider);
5207
5232
  grouped.set(name, [...grouped.get(name) ?? [], provider]);
5208
5233
  }
5209
5234
  const providerOutcomes = {};
@@ -5228,7 +5253,7 @@ function buildProviderOutcomeProps(providers, providerErrors, skippedProviders =
5228
5253
  function buildRunRefusedProps(input) {
5229
5254
  const outcomes = /* @__PURE__ */ new Map();
5230
5255
  for (const [provider, code] of Object.entries(input.providers)) {
5231
- const name = providerConnectionName(provider);
5256
+ const name = telemetryConnectionName(provider);
5232
5257
  const previous = outcomes.get(name);
5233
5258
  outcomes.set(name, previous === void 0 ? code : mostActionableProviderErrorCode([previous, code]));
5234
5259
  }
@@ -5355,7 +5380,7 @@ async function resolveVertexGroundingRedirect(value, opts = {}) {
5355
5380
  }
5356
5381
  async function captureCitedUrls(provider, sources, opts = {}) {
5357
5382
  const sourceCount = sources.length;
5358
- if (!isRouteCapableProvider(provider)) {
5383
+ if (!(opts.directCitedSources ?? isRouteCapableProvider(provider))) {
5359
5384
  return {
5360
5385
  citedUrls: null,
5361
5386
  captureStatus: "unsupported",
@@ -5431,6 +5456,10 @@ function planlessDispatchColumns(registeredProvider, raw) {
5431
5456
  })
5432
5457
  };
5433
5458
  }
5459
+ function isRequestedLocationUnapplied(providerName, raw, retrievalStatus) {
5460
+ if (raw.evidence) return raw.evidence.location.status !== LocationTreatmentStatuses.applied;
5461
+ return isOpenRouterRoute(providerName) || isSearchLocationIgnored(providerName, retrievalStatus);
5462
+ }
5434
5463
  var HOUR_MS = 60 * 60 * 1e3;
5435
5464
  var RUN_HOLDING_BATCH_STATUSES = [
5436
5465
  ProviderBatchStatuses.submitting,
@@ -5730,6 +5759,7 @@ var JobRunner = class {
5730
5759
  let activeProviders = [];
5731
5760
  let projectQueries = [];
5732
5761
  let planExecution = null;
5762
+ const planIneligibleProviders = /* @__PURE__ */ new Set();
5733
5763
  let runTrigger;
5734
5764
  let canonicalDomain;
5735
5765
  let recording;
@@ -5790,7 +5820,11 @@ var JobRunner = class {
5790
5820
  if (planExecution) {
5791
5821
  const plan = planExecution;
5792
5822
  const manifestProviders = [...plan.unitsByProvider.keys()];
5793
- activeProviders = manifestProviders.map((name) => this.registry.get(name)).filter((entry) => entry !== void 0);
5823
+ const registered = manifestProviders.map((name) => this.registry.get(name)).filter((entry) => entry !== void 0);
5824
+ activeProviders = registered.filter((entry) => isEligibleFor(entry.adapter, ProviderWorkflows["visibility-sweep"], "explicit"));
5825
+ for (const entry of registered) {
5826
+ if (!activeProviders.includes(entry)) planIneligibleProviders.add(entry.adapter.name);
5827
+ }
5794
5828
  } else {
5795
5829
  const projectProviders = providerOverride ?? project.providers;
5796
5830
  activeProviders = this.registry.getForProject(projectProviders).map((entry) => {
@@ -5832,7 +5866,7 @@ var JobRunner = class {
5832
5866
  const todayPeriod = getCurrentUsageDay();
5833
5867
  for (const p of calledProviders) {
5834
5868
  const queriesPerProvider = planExecution ? planExecution.unitsByProvider.get(p.adapter.name)?.length ?? 0 : projectQueries.length;
5835
- const providerScope = `${projectId}:${providerConnectionName(p.adapter.name)}`;
5869
+ const providerScope = `${projectId}:${adapterConnectionName(p.adapter)}`;
5836
5870
  const limit = p.config.quotaPolicy.maxRequestsPerDay;
5837
5871
  const quota = reserveDailyQueryQuota(this.db, { scope: providerScope, period: todayPeriod, count: queriesPerProvider, limit });
5838
5872
  if (!quota.reserved) {
@@ -5847,7 +5881,7 @@ var JobRunner = class {
5847
5881
  executionGates.set(
5848
5882
  provider.adapter.name,
5849
5883
  getSharedProviderExecutionGate(
5850
- provider.adapter.name,
5884
+ adapterConnectionName(provider.adapter),
5851
5885
  provider.config.quotaPolicy.maxConcurrency,
5852
5886
  provider.config.quotaPolicy.maxRequestsPerMinute
5853
5887
  )
@@ -5900,7 +5934,7 @@ var JobRunner = class {
5900
5934
  };
5901
5935
  let citedUrlCapture;
5902
5936
  try {
5903
- citedUrlCapture = await captureCitedUrls(providerName, rawGroundingSources);
5937
+ citedUrlCapture = await captureCitedUrls(providerName, rawGroundingSources, raw.evidence ? { directCitedSources: hasDirectCitedUrls(raw.evidence) } : {});
5904
5938
  } catch (err) {
5905
5939
  citedUrlCapture = {
5906
5940
  citedUrls: [],
@@ -5933,7 +5967,7 @@ var JobRunner = class {
5933
5967
  allBrandNames,
5934
5968
  competitorAliases
5935
5969
  );
5936
- const answerLocation = runLocation && (isOpenRouterRoute(providerName) || isSearchLocationIgnored(providerName, normalized.retrievalStatus)) ? { location: null, requestedContext: runLocation, supportedContext: { status: "ignored" } } : { location: runLocation?.label ?? null };
5970
+ const answerLocation = runLocation && isRequestedLocationUnapplied(providerName, raw, normalized.retrievalStatus) ? { location: null, requestedContext: runLocation, supportedContext: { status: "ignored" } } : { location: runLocation?.label ?? null };
5937
5971
  let screenshotRelPath = null;
5938
5972
  if (raw.screenshotPath && fs3.existsSync(raw.screenshotPath)) {
5939
5973
  const snapshotId = crypto6.randomUUID();
@@ -5977,6 +6011,7 @@ var JobRunner = class {
5977
6011
  apiResponse: raw.rawResponse
5978
6012
  }),
5979
6013
  ...planlessDispatchColumns(registeredProvider, raw),
6014
+ answerEvidence: raw.evidence ?? null,
5980
6015
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
5981
6016
  }).run();
5982
6017
  } else {
@@ -6014,6 +6049,7 @@ var JobRunner = class {
6014
6049
  apiResponse: raw.rawResponse
6015
6050
  }),
6016
6051
  ...planlessDispatchColumns(registeredProvider, raw),
6052
+ answerEvidence: raw.evidence ?? null,
6017
6053
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
6018
6054
  }).run();
6019
6055
  }
@@ -6143,7 +6179,7 @@ var JobRunner = class {
6143
6179
  if (dispatched >= units.length || providerErrors.has(providerName) || providerName in skipped) continue;
6144
6180
  providerErrors.set(
6145
6181
  providerName,
6146
- `No ${provider} provider was available to this worker, so ${units.length - dispatched} expected measurement(s) did not run.`
6182
+ planIneligibleProviders.has(providerName) ? `${provider} does not run visibility sweeps, so ${units.length - dispatched} expected measurement(s) did not run.` : `No ${provider} provider was available to this worker, so ${units.length - dispatched} expected measurement(s) did not run.`
6147
6183
  );
6148
6184
  }
6149
6185
  }
@@ -6206,7 +6242,7 @@ var JobRunner = class {
6206
6242
  trackEvent("run.aborted", {
6207
6243
  reason: abortReason2,
6208
6244
  providerCount: executionContext.providerCount,
6209
- providers: [...new Set(executionContext.providers.map(providerConnectionName))],
6245
+ providers: [...new Set(executionContext.providers.map(telemetryConnectionName))],
6210
6246
  queryCount: executionContext.queryCount,
6211
6247
  durationMs: Date.now() - startTime,
6212
6248
  ...executionContext.trigger ? { trigger: executionContext.trigger } : {},
@@ -7028,15 +7064,16 @@ var JobRunner = class {
7028
7064
  const activeProviders = [];
7029
7065
  for (const provider of unitsByProvider.keys()) {
7030
7066
  const registered = this.registry.get(provider);
7031
- if (registered) activeProviders.push(registered);
7032
- else providerErrors.set(provider, `No ${provider} provider is configured on this instance, so its missing answers did not run.`);
7067
+ if (!registered) providerErrors.set(provider, `No ${provider} provider is configured on this instance, so its missing answers did not run.`);
7068
+ else if (!isEligibleFor(registered.adapter, ProviderWorkflows["visibility-sweep"], "explicit")) providerErrors.set(provider, `${provider} does not run visibility sweeps, so its missing answers did not run.`);
7069
+ else activeProviders.push(registered);
7033
7070
  }
7034
7071
  const todayPeriod = getCurrentUsageDay();
7035
7072
  const dispatchable = [];
7036
7073
  for (const registered of activeProviders) {
7037
7074
  const name = registered.adapter.name;
7038
7075
  const count4 = unitsByProvider.get(name)?.length ?? 0;
7039
- const scope = `${projectId}:${providerConnectionName(name)}`;
7076
+ const scope = `${projectId}:${adapterConnectionName(registered.adapter)}`;
7040
7077
  const limit = registered.config.quotaPolicy.maxRequestsPerDay;
7041
7078
  const quota = reserveDailyQueryQuota(this.db, { scope, period: todayPeriod, count: count4, limit });
7042
7079
  if (!quota.reserved) {
@@ -7051,7 +7088,7 @@ var JobRunner = class {
7051
7088
  executionGates.set(
7052
7089
  registered.adapter.name,
7053
7090
  getSharedProviderExecutionGate(
7054
- registered.adapter.name,
7091
+ adapterConnectionName(registered.adapter),
7055
7092
  registered.config.quotaPolicy.maxConcurrency,
7056
7093
  registered.config.quotaPolicy.maxRequestsPerMinute
7057
7094
  )
@@ -7244,7 +7281,7 @@ var JobRunner = class {
7244
7281
  const providerName = adapter.name;
7245
7282
  const { domains: competitorDomains, aliases: competitorAliases } = ctx.competitorsFor(unit.executionId);
7246
7283
  const requestedContext = unit.context;
7247
- const supportedContext = requestedContext && providerSupportsLocationContext(adapter) ? { status: "applied", resolved: requestedContext } : requestedContext && isOpenRouterRoute(providerName) ? { status: "ignored" } : null;
7284
+ const supportedContext = requestedContext && raw.evidence ? raw.evidence.location.status === LocationTreatmentStatuses.applied ? { status: "applied", resolved: requestedContext } : { status: "ignored" } : requestedContext && providerSupportsLocationContext(adapter) ? { status: "applied", resolved: requestedContext } : requestedContext && isOpenRouterRoute(providerName) ? { status: "ignored" } : null;
7248
7285
  this.throwIfRunCancelled(ctx.runId);
7249
7286
  const providerResult = adapter.normalizeResult(raw);
7250
7287
  const rawGroundingSources = providerResult.groundingSources;
@@ -7254,7 +7291,7 @@ var JobRunner = class {
7254
7291
  };
7255
7292
  let citedUrlCapture;
7256
7293
  try {
7257
- citedUrlCapture = await captureCitedUrls(providerName, rawGroundingSources);
7294
+ citedUrlCapture = await captureCitedUrls(providerName, rawGroundingSources, raw.evidence ? { directCitedSources: hasDirectCitedUrls(raw.evidence) } : {});
7258
7295
  } catch (err) {
7259
7296
  citedUrlCapture = {
7260
7297
  citedUrls: [],
@@ -7348,6 +7385,7 @@ var JobRunner = class {
7348
7385
  tier: dispatch.pricingTier,
7349
7386
  overrides: registeredProvider.config.pricing
7350
7387
  }),
7388
+ answerEvidence: raw.evidence ?? null,
7351
7389
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
7352
7390
  };
7353
7391
  return {
@@ -10610,6 +10648,7 @@ function buildDefaultDeps(registry, classifierConfig) {
10610
10648
  async classifyDomains(input) {
10611
10649
  const prompt = buildClassificationPrompt(input);
10612
10650
  if (!classifierModel) {
10651
+ if (!canGenerateText(adapter)) throw new Error(`${adapter.displayName} cannot generate text for domain classification.`);
10613
10652
  const text2 = await adapter.generateText(prompt, cfg);
10614
10653
  return { classifications: parseClassificationResponse(text2, input.domains), evaluator: { provider: "gemini", requestedModel: cfg.model ?? adapter.modelRegistry.defaultModel, servedModel: null, promptVersion: "domain-category-v1" } };
10615
10654
  }
@@ -10944,7 +10983,7 @@ function abortReason(signal) {
10944
10983
  function throwIfAborted(signal) {
10945
10984
  if (signal?.aborted) throw abortReason(signal);
10946
10985
  }
10947
- function stripIpv6Brackets(hostname) {
10986
+ function stripIpv6Brackets2(hostname) {
10948
10987
  return hostname.startsWith("[") && hostname.endsWith("]") ? hostname.slice(1, -1) : hostname;
10949
10988
  }
10950
10989
  function buildSiteAuditRootRequestOptions(target) {
@@ -10961,7 +11000,7 @@ function buildSiteAuditRootRequestOptions(target) {
10961
11000
  "User-Agent": USER_AGENT
10962
11001
  }
10963
11002
  };
10964
- if (secure) requestOptions.servername = stripIpv6Brackets(target.url.hostname);
11003
+ if (secure) requestOptions.servername = stripIpv6Brackets2(target.url.hostname);
10965
11004
  return requestOptions;
10966
11005
  }
10967
11006
  async function requestPinnedSiteAuditRoot(target, options) {
@@ -11947,30 +11986,43 @@ var ProviderRegistry = class {
11947
11986
  updateSharedProviderExecutionGate(adapter.name, config.quotaPolicy.maxConcurrency, config.quotaPolicy.maxRequestsPerMinute);
11948
11987
  }
11949
11988
  }
11989
+ /**
11990
+ * A registered provider, or the registration a route key runs as: the
11991
+ * route's connection supplies the key, quota and gate, and its selection
11992
+ * is pinned as the model.
11993
+ */
11950
11994
  get(name) {
11951
11995
  const registered = this.providers.get(name);
11952
11996
  if (registered) return registered;
11953
- const model = openRouterRouteModel(name);
11954
- const connection = model ? this.providers.get(providerConnectionName(name)) : void 0;
11955
- if (!connection || !model) return void 0;
11956
- const config = { ...connection.config, provider: name, model };
11997
+ const route = resolveProviderRoute(name, this.routeFamilies());
11998
+ const connection = route ? this.providers.get(route.connection) : void 0;
11999
+ if (!connection || !route) return void 0;
11957
12000
  return {
11958
- config,
11959
- adapter: {
11960
- ...connection.adapter,
11961
- name,
11962
- displayName: `${model} \xB7 OpenRouter`,
11963
- modelRegistry: { ...connection.adapter.modelRegistry, defaultModel: model },
11964
- parseTrackedQueryResponse: connection.adapter.parseTrackedQueryResponse ? (body, requestedModel) => ({ ...connection.adapter.parseTrackedQueryResponse(body, requestedModel), provider: name }) : void 0
11965
- }
12001
+ config: { ...connection.config, provider: name, model: route.selection },
12002
+ adapter: connection.adapter.forRoute ? connection.adapter.forRoute(route) : derivedRouteAdapter(connection.adapter, route)
11966
12003
  };
11967
12004
  }
12005
+ /** Route families of the registered connections (OpenRouter is always known). */
12006
+ routeFamilies() {
12007
+ return routeFamiliesOf(this.getAll().map((provider) => provider.adapter));
12008
+ }
12009
+ /** The connection that owns a provider key's credentials, quota and gate. */
12010
+ connectionOf(name) {
12011
+ const provider = this.get(name);
12012
+ return provider ? adapterConnectionName(provider.adapter) : name;
12013
+ }
11968
12014
  getAll() {
11969
12015
  return [...this.providers.values()];
11970
12016
  }
11971
- getForProject(projectProviders) {
12017
+ /**
12018
+ * The engines a project's sweep runs. An empty list means every configured
12019
+ * answer engine, and nothing else: a gateway or a hosted answer service is
12020
+ * only ever measured when a project names one of its routes.
12021
+ */
12022
+ getForProject(projectProviders, workflow = ProviderWorkflows["visibility-sweep"]) {
12023
+ const families = this.routeFamilies();
11972
12024
  if (projectProviders.length === 0) {
11973
- return this.getAll().filter((provider) => isSweepProvider(provider.adapter.name));
12025
+ return this.getAll().filter((provider) => isSweepProvider(provider.adapter.name, families) && isEligibleFor(provider.adapter, workflow, "implicit"));
11974
12026
  }
11975
12027
  const result = [];
11976
12028
  const seen = /* @__PURE__ */ new Set();
@@ -11978,7 +12030,7 @@ var ProviderRegistry = class {
11978
12030
  if (seen.has(name)) continue;
11979
12031
  seen.add(name);
11980
12032
  const provider = this.get(name);
11981
- if (provider && isSweepProvider(provider.adapter.name)) {
12033
+ if (provider && isSweepProvider(provider.adapter.name, families) && isEligibleFor(provider.adapter, workflow, "explicit")) {
11982
12034
  result.push(provider);
11983
12035
  }
11984
12036
  }
@@ -11988,9 +12040,10 @@ var ProviderRegistry = class {
11988
12040
  getBrowserProviders() {
11989
12041
  return this.getAll().filter((p) => isBrowserProvider(p.adapter.name));
11990
12042
  }
11991
- /** Get only API-based providers */
12043
+ /** Configured API answer engines (the implicit set; routed connections are excluded). */
11992
12044
  getApiProviders() {
11993
- return this.getAll().filter((p) => !isBrowserProvider(p.adapter.name) && isSweepProvider(p.adapter.name));
12045
+ const families = this.routeFamilies();
12046
+ return this.getAll().filter((p) => !isBrowserProvider(p.adapter.name) && isSweepProvider(p.adapter.name, families) && isEligibleFor(p.adapter, ProviderWorkflows["visibility-sweep"], "implicit"));
11994
12047
  }
11995
12048
  get size() {
11996
12049
  return this.providers.size;
@@ -12006,6 +12059,15 @@ var ProviderRegistry = class {
12006
12059
  return results;
12007
12060
  }
12008
12061
  };
12062
+ function derivedRouteAdapter(adapter, route) {
12063
+ return {
12064
+ ...adapter,
12065
+ name: route.name,
12066
+ displayName: `${route.selection} \xB7 ${adapter.displayName}`,
12067
+ modelRegistry: { ...adapter.modelRegistry, defaultModel: route.selection },
12068
+ parseTrackedQueryResponse: adapter.parseTrackedQueryResponse ? (body, requestedModel) => ({ ...adapter.parseTrackedQueryResponse(body, requestedModel), provider: route.name }) : void 0
12069
+ };
12070
+ }
12009
12071
 
12010
12072
  // src/install-state-telemetry.ts
12011
12073
  import { and as and15, count as count2, eq as eq18, gte as gte2, inArray as inArray7, isNotNull as isNotNull2, isNull as isNull2, ne as ne3, sql as sql7 } from "drizzle-orm";
@@ -12254,7 +12316,7 @@ function configuredProviderEntries(config, apiAdapters, cdpAdapter) {
12254
12316
  registered.push(resolveRegistration(adapter, providerConfigFromEntry(
12255
12317
  adapter.name,
12256
12318
  entry,
12257
- resolveProviderQuotaPolicy(entry.quota, DEFAULT_PROVIDER_QUOTA)
12319
+ resolveProviderQuotaPolicy(entry.quota, adapter.defaultQuota ?? DEFAULT_PROVIDER_QUOTA)
12258
12320
  )));
12259
12321
  }
12260
12322
  }
@@ -12863,6 +12925,7 @@ var Scheduler = class {
12863
12925
  location: locationLabel,
12864
12926
  providers,
12865
12927
  runnableProviders: this.callbacks.getRunnableProviderNames?.(),
12928
+ routeFamilies: this.callbacks.getProviderRouteFamilies?.(),
12866
12929
  providerModels: this.callbacks.getEffectiveProviderModels?.(),
12867
12930
  batchEligibleProviders: this.callbacks.getBatchEligibleProviderNames?.() ?? null,
12868
12931
  // A skipped slot is otherwise invisible: no run row, nothing in the
@@ -15769,6 +15832,7 @@ var ViewerAeroSessions = class {
15769
15832
 
15770
15833
  // src/mcp-http.ts
15771
15834
  import crypto25 from "crypto";
15835
+ import { isIP } from "net";
15772
15836
  import { eq as eq27 } from "drizzle-orm";
15773
15837
  import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
15774
15838
  import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
@@ -15804,11 +15868,49 @@ function mcpTransportPaths() {
15804
15868
  }
15805
15869
  return paths;
15806
15870
  }
15807
- function mcpHttpHealth(app, apiPrefix) {
15871
+ function mcpHttpHealth(app, apiPrefix, hosted) {
15808
15872
  const available = mcpTransportPaths().every(
15809
15873
  (path6) => ["POST", "GET", "DELETE"].every((method) => app.hasRoute({ method, url: `${apiPrefix}${path6}` }))
15810
15874
  );
15811
- return { status: available ? "available" : "unavailable" };
15875
+ const status = available ? McpTransportStatuses.available : McpTransportStatuses.unavailable;
15876
+ if (!hosted) return { status };
15877
+ const unavailable = (reason) => ({
15878
+ status,
15879
+ hosted: { status: HostedMcpStatuses.unavailable, reason }
15880
+ });
15881
+ if (!available) return unavailable(HostedMcpUnavailableReasons["transport-unavailable"]);
15882
+ if (!hosted.publicUrl) return unavailable(HostedMcpUnavailableReasons["public-url-required"]);
15883
+ let publicUrl;
15884
+ try {
15885
+ publicUrl = new URL(hosted.publicUrl);
15886
+ } catch {
15887
+ return unavailable(HostedMcpUnavailableReasons["public-url-required"]);
15888
+ }
15889
+ if (publicUrl.username || publicUrl.password || publicUrl.search || publicUrl.hash) {
15890
+ return unavailable(HostedMcpUnavailableReasons["public-url-required"]);
15891
+ }
15892
+ if (publicUrl.protocol !== "https:") return unavailable(HostedMcpUnavailableReasons["https-required"]);
15893
+ const hostname = stripIpv6Brackets(publicUrl.hostname).toLowerCase().replace(/\.$/, "");
15894
+ if (hostname === "localhost" || hostname.endsWith(".localhost") || hostname.endsWith(".local") || (isIP(hostname) !== 0 ? blockedAddressReason(hostname) !== null : !hostname.includes("."))) {
15895
+ return unavailable(HostedMcpUnavailableReasons["public-host-required"]);
15896
+ }
15897
+ const publicBasePath = publicUrl.pathname.replace(/\/$/, "");
15898
+ const mountedBasePath = apiPrefix.slice(0, -"/api/v1".length);
15899
+ if (publicBasePath !== mountedBasePath) return unavailable(HostedMcpUnavailableReasons["public-path-mismatch"]);
15900
+ const oauthRoutes = [
15901
+ ["GET", hosted.authorizationPath],
15902
+ ["POST", hosted.authorizationPath],
15903
+ ["POST", `${hosted.authorizationPath}/consent`],
15904
+ ["POST", "/oauth/token"],
15905
+ ["POST", "/oauth/register"],
15906
+ ["GET", "/.well-known/oauth-authorization-server"],
15907
+ ["GET", `/.well-known/oauth-protected-resource${apiPrefix}/mcp`]
15908
+ ];
15909
+ if (!oauthRoutes.every(([method, url]) => app.hasRoute({ method, url }))) {
15910
+ return unavailable(HostedMcpUnavailableReasons["oauth-unavailable"]);
15911
+ }
15912
+ if (!hosted.hasAccounts) return unavailable(HostedMcpUnavailableReasons["account-required"]);
15913
+ return { status, hosted: { status: HostedMcpStatuses.ready, url: `${publicUrl.origin}${apiPrefix}/mcp` } };
15812
15914
  }
15813
15915
  function registerMcpHttpRoutes(scope, opts) {
15814
15916
  const sessions = /* @__PURE__ */ new Map();
@@ -16627,10 +16729,14 @@ var SnapshotService = class {
16627
16729
  const manualCompetitors = normalizeStringList(input.competitors ?? []);
16628
16730
  const requestedNames = input.providers === void 0 ? void 0 : [...new Set(input.providers)];
16629
16731
  const mode = input.providerMode ?? SnapshotProviderModes.all;
16630
- const providers = requestedNames === void 0 ? this.registry.getAll().filter((provider) => isSweepProvider(provider.adapter.name) && (mode === SnapshotProviderModes.all || provider.adapter.mode === mode)) : requestedNames.map((name) => {
16732
+ const families = this.registry.routeFamilies();
16733
+ const providers = requestedNames === void 0 ? this.registry.getAll().filter((provider) => isSweepProvider(provider.adapter.name, families) && isEligibleFor(provider.adapter, ProviderWorkflows.snapshot, "implicit") && (mode === SnapshotProviderModes.all || provider.adapter.mode === mode)) : requestedNames.map((name) => {
16631
16734
  const provider = this.registry.get(name);
16632
16735
  if (!provider) throw validationError(`Snapshot provider "${name}" is not configured`);
16633
- if (!isSweepProvider(name)) throw validationError("Select a concrete OpenRouter model for the snapshot");
16736
+ if (!isSweepProvider(name, families)) throw validationError(`Select a concrete ${provider.adapter.displayName} model or profile for the snapshot`);
16737
+ if (!isEligibleFor(provider.adapter, ProviderWorkflows.snapshot, "explicit")) {
16738
+ throw validationError(`Snapshot provider "${name}" does not run snapshots`);
16739
+ }
16634
16740
  if (mode !== SnapshotProviderModes.all && provider.adapter.mode !== mode) {
16635
16741
  throw validationError(`Snapshot provider "${name}" does not match providerMode "${mode}"`);
16636
16742
  }
@@ -16642,9 +16748,9 @@ var SnapshotService = class {
16642
16748
  }
16643
16749
  throw new Error("No providers configured. Add at least one provider API key before running canonry snapshot.");
16644
16750
  }
16645
- const analysisProvider = pickAnalysisProvider(providers.filter((provider) => provider.adapter.mode === SnapshotProviderModes.api));
16751
+ const analysisProvider = pickAnalysisProvider(providers.filter((provider) => provider.adapter.mode === SnapshotProviderModes.api && canGenerateText(provider.adapter)));
16646
16752
  if (!analysisProvider && manualQueries.length === 0) {
16647
- throw validationError("Automatic category-query generation requires a selected API provider. Include an API provider or pass manual queries via --queries.");
16753
+ throw validationError("Automatic category-query generation requires a selected API provider that can generate text. Include one or pass manual queries via --queries.");
16648
16754
  }
16649
16755
  const homepageUrl = `https://${domain}`;
16650
16756
  const [siteText, audit] = await Promise.all([
@@ -16725,7 +16831,7 @@ var SnapshotService = class {
16725
16831
  if (ctx.analysisProvider && ctx.siteText) {
16726
16832
  const prompt = buildProfilePrompt(ctx);
16727
16833
  try {
16728
- const raw = await ctx.analysisProvider.adapter.generateText(prompt, ctx.analysisProvider.config);
16834
+ const raw = await generateAnalysisText(ctx.analysisProvider, prompt);
16729
16835
  const parsed = parseJsonObject(raw);
16730
16836
  const parsedQueries = ctx.manualQueries.length > 0 ? ctx.manualQueries : normalizeStringList(parsed.queries ?? []).slice(0, SNAPSHOT_QUERY_COUNT);
16731
16837
  if (ctx.manualQueries.length === 0 && parsedQueries.length === 0) {
@@ -16765,7 +16871,7 @@ var SnapshotService = class {
16765
16871
  gates2.set(
16766
16872
  provider.adapter.name,
16767
16873
  getSharedProviderExecutionGate(
16768
- provider.adapter.name,
16874
+ adapterConnectionName(provider.adapter),
16769
16875
  provider.config.quotaPolicy.maxConcurrency,
16770
16876
  provider.config.quotaPolicy.maxRequestsPerMinute
16771
16877
  )
@@ -16794,12 +16900,14 @@ var SnapshotService = class {
16794
16900
  targetDomain: ctx.domain
16795
16901
  });
16796
16902
  const answerVisibilityDomains = [ctx.domain];
16903
+ const citationMeasured = isCitationMeasurable(normalized);
16797
16904
  return {
16798
16905
  provider: provider.adapter.name,
16799
16906
  displayName: provider.adapter.displayName,
16800
16907
  model: raw.model,
16801
16908
  mentioned: determineAnswerMentioned(normalized.answerText, [ctx.companyName], answerVisibilityDomains),
16802
- cited: citesTargetDomain(normalized.citedDomains, normalized.groundingSources, ctx.domain),
16909
+ // Search results the answer is not tied to never make a domain cited.
16910
+ cited: citationMeasured && citesTargetDomain(normalized.citedDomains, normalized.groundingSources, ctx.domain),
16803
16911
  describedAccurately: "unknown",
16804
16912
  accuracyNotes: null,
16805
16913
  incorrectClaims: [],
@@ -16808,7 +16916,8 @@ var SnapshotService = class {
16808
16916
  groundingSources: normalized.groundingSources,
16809
16917
  searchQueries: uniqueStrings2(normalized.searchQueries),
16810
16918
  answerText: normalized.answerText,
16811
- error: null
16919
+ error: null,
16920
+ ...raw.evidence ? { evidence: raw.evidence, citationMeasured } : {}
16812
16921
  };
16813
16922
  } catch (err) {
16814
16923
  return {
@@ -16824,8 +16933,10 @@ var SnapshotService = class {
16824
16933
  citedDomains: [],
16825
16934
  groundingSources: [],
16826
16935
  searchQueries: [],
16827
- answerText: "",
16828
- error: describeError(err)
16936
+ answerText: err instanceof IncompleteAnswerError ? err.answerText ?? "" : "",
16937
+ error: describeError(err),
16938
+ // An incomplete answer keeps its evidence for inspection; it is never scored.
16939
+ ...err instanceof IncompleteAnswerError ? { evidence: err.evidence, citationMeasured: false } : {}
16829
16940
  };
16830
16941
  }
16831
16942
  });
@@ -16861,7 +16972,7 @@ var SnapshotService = class {
16861
16972
  responses,
16862
16973
  manualCompetitors: ctx.manualCompetitors
16863
16974
  });
16864
- const raw = await ctx.analysisProvider.adapter.generateText(prompt, ctx.analysisProvider.config);
16975
+ const raw = await generateAnalysisText(ctx.analysisProvider, prompt);
16865
16976
  const parsed = parseJsonObject(raw);
16866
16977
  return {
16867
16978
  assessments: (parsed.assessments ?? []).filter((assessment) => assessment.query && assessment.provider).map((assessment) => {
@@ -16890,6 +17001,10 @@ var SnapshotService = class {
16890
17001
  }
16891
17002
  }
16892
17003
  };
17004
+ async function generateAnalysisText(provider, prompt) {
17005
+ if (!canGenerateText(provider.adapter)) throw new Error(`${provider.adapter.displayName} cannot generate text`);
17006
+ return provider.adapter.generateText(prompt, provider.config);
17007
+ }
16893
17008
  function pickAnalysisProvider(providers) {
16894
17009
  return [...providers].sort((a, b) => {
16895
17010
  const aIndex = ANALYSIS_PROVIDER_PRIORITY.indexOf(a.adapter.name);
@@ -16994,7 +17109,9 @@ function buildSnapshotSummary(companyName, queries2, providers, queryResults, au
16994
17109
  const successfulResults = allResults.filter((result) => !result.error);
16995
17110
  const failedComparisons = allResults.length - successfulResults.length;
16996
17111
  const mentionCount = successfulResults.filter((result) => result.mentioned).length;
16997
- const citationCount = successfulResults.filter((result) => result.cited).length;
17112
+ const citationMeasured = successfulResults.filter((result) => result.citationMeasured !== false);
17113
+ const citationCount = citationMeasured.filter((result) => result.cited).length;
17114
+ const citationComparisons = citationMeasured.length;
16998
17115
  const totalComparisons = successfulResults.length;
16999
17116
  const competitorCounts = /* @__PURE__ */ new Map();
17000
17117
  for (const result of successfulResults) {
@@ -17018,6 +17135,7 @@ function buildSnapshotSummary(companyName, queries2, providers, queryResults, au
17018
17135
  totalComparisons,
17019
17136
  mentionCount,
17020
17137
  citationCount,
17138
+ citationComparisons,
17021
17139
  topCompetitors,
17022
17140
  visibilityGap: buildVisibilityGap(
17023
17141
  companyName,
@@ -17026,25 +17144,33 @@ function buildSnapshotSummary(companyName, queries2, providers, queryResults, au
17026
17144
  totalComparisons,
17027
17145
  mentionCount,
17028
17146
  citationCount,
17147
+ citationComparisons,
17029
17148
  failedComparisons
17030
17149
  ),
17031
17150
  whatThisMeans: combinedWhatThisMeans,
17032
17151
  recommendedActions
17033
17152
  };
17034
17153
  }
17035
- function buildVisibilityGap(companyName, queryCount, providerCount, totalComparisons, mentionCount, citationCount, failedComparisons) {
17154
+ function buildVisibilityGap(companyName, queryCount, providerCount, totalComparisons, mentionCount, citationCount, citationComparisons, failedComparisons) {
17036
17155
  const successfulLabel = `${totalComparisons} successful provider response${totalComparisons === 1 ? "" : "s"}`;
17037
17156
  const failureSuffix = failedComparisons > 0 ? ` ${failedComparisons} provider response${failedComparisons === 1 ? "" : "s"} failed.` : "";
17157
+ const unmeasured = totalComparisons - citationComparisons;
17158
+ const unmeasuredSuffix = unmeasured > 0 && citationComparisons > 0 ? ` Citation was not measured in ${unmeasured} of them, because those providers do not tie their sources to the answer.` : "";
17038
17159
  if (totalComparisons === 0) {
17039
17160
  return `No providers returned successful answers across ${queryCount} category queries and ${providerCount} providers.${failureSuffix}`.trim();
17040
17161
  }
17041
17162
  if (mentionCount === 0) {
17042
17163
  return `${companyName} was not mentioned in any of the ${successfulLabel} across ${queryCount} category queries and ${providerCount} providers.${failureSuffix}`.trim();
17043
17164
  }
17044
- if (citationCount === 0) {
17045
- return `${companyName} was mentioned in ${mentionCount}/${totalComparisons} successful provider response${totalComparisons === 1 ? "" : "s"}, but never linked or cited directly.${failureSuffix}`.trim();
17165
+ const mentioned = `${companyName} was mentioned in ${mentionCount}/${successfulLabel}`;
17166
+ if (citationComparisons === 0) {
17167
+ return `${mentioned}. Citation was not measured, because ${totalComparisons === 1 ? "that provider does" : "those providers do"} not tie ${totalComparisons === 1 ? "its" : "their"} sources to the answer.${failureSuffix}`.trim();
17168
+ }
17169
+ const citedPart = citationCount === 0 ? `never linked or cited directly in the ${citationComparisons} where citation was measured` : `cited in ${citationCount}/${citationComparisons}${unmeasured > 0 ? " where citation was measured" : ""}`;
17170
+ if (citationCount === 0 && unmeasured === 0) {
17171
+ return `${mentioned}, but never linked or cited directly.${failureSuffix}`.trim();
17046
17172
  }
17047
- return `${companyName} was mentioned in ${mentionCount}/${totalComparisons} successful provider response${totalComparisons === 1 ? "" : "s"} and cited in ${citationCount}/${totalComparisons}.${failureSuffix}`.trim();
17173
+ return `${mentioned}${citationCount === 0 ? ", but " : " and "}${citedPart}.${unmeasuredSuffix}${failureSuffix}`.trim();
17048
17174
  }
17049
17175
  function buildFallbackRecommendedActions(audit) {
17050
17176
  const weakestFactors = [...audit.factors].sort((a, b) => a.score - b.score || a.name.localeCompare(b.name)).slice(0, 3).map((factor) => `Improve ${factor.name.toLowerCase()}: ${formatAuditFactorScore(factor)}`);
@@ -17139,7 +17265,8 @@ function clipText(value, length) {
17139
17265
  // src/research-runner.ts
17140
17266
  import { and as and23, eq as eq29, inArray as inArray12, sql as sql11 } from "drizzle-orm";
17141
17267
  var unfinishedResearchQueryStatuses = [ResearchQueryStatuses.queued, ResearchQueryStatuses.running];
17142
- function finalResearchRunStatus(completed, failed) {
17268
+ function finalResearchRunStatus(completed, failed, waiting) {
17269
+ if (waiting > 0) return ResearchRunStatuses["waiting-upstream"];
17143
17270
  if (failed === 0) return ResearchRunStatuses.completed;
17144
17271
  return completed > 0 ? ResearchRunStatuses.partial : ResearchRunStatuses.failed;
17145
17272
  }
@@ -17166,8 +17293,12 @@ async function executeResearchRun(db, registry, runId, projectId, options = {})
17166
17293
  fatalReason = { reasonCode: OutcomeReasonCodes.NOT_CONNECTED };
17167
17294
  throw new Error("Configured API provider is unavailable.");
17168
17295
  }
17296
+ if (!isEligibleFor(provider.adapter, ProviderWorkflows.research, "explicit")) {
17297
+ fatalReason = { reasonCode: OutcomeReasonCodes.NOT_CONNECTED };
17298
+ throw new Error(`${provider.adapter.displayName} does not run research queries.`);
17299
+ }
17169
17300
  const period = getCurrentUsageDay();
17170
- const scope = `${projectId}:${providerConnectionName(run.provider)}`;
17301
+ const scope = `${projectId}:${adapterConnectionName(provider.adapter)}`;
17171
17302
  const quota = reserveDailyQueryQuota(db, {
17172
17303
  scope,
17173
17304
  period,
@@ -17187,7 +17318,7 @@ async function executeResearchRun(db, registry, runId, projectId, options = {})
17187
17318
  const domains = effectiveDomains(project);
17188
17319
  const brands = effectiveBrandNames(project);
17189
17320
  const config = { ...provider.config, model: run.resolvedModel };
17190
- const gate = getSharedProviderExecutionGate(run.provider, provider.config.quotaPolicy.maxConcurrency, provider.config.quotaPolicy.maxRequestsPerMinute);
17321
+ const gate = getSharedProviderExecutionGate(adapterConnectionName(provider.adapter), provider.config.quotaPolicy.maxConcurrency, provider.config.quotaPolicy.maxRequestsPerMinute);
17191
17322
  await mapWithConcurrency(rows, Math.max(1, provider.config.quotaPolicy.maxConcurrency), async (row) => {
17192
17323
  try {
17193
17324
  const startedAt = (/* @__PURE__ */ new Date()).toISOString();
@@ -17217,13 +17348,15 @@ async function executeResearchRun(db, registry, runId, projectId, options = {})
17217
17348
  namedCompetitors,
17218
17349
  citedCompetitorDomains,
17219
17350
  answerMentioned: determineAnswerMentioned(normalized.answerText, brands, domains),
17220
- citationState: determineCitationState(normalized, domains),
17351
+ // Sources the answer is not tied to cannot say whether a domain was cited.
17352
+ citationState: isCitationMeasurable(normalized) ? determineCitationState(normalized, domains) : null,
17221
17353
  rawResponse: raw.rawResponse,
17354
+ answerEvidence: raw.evidence ?? null,
17222
17355
  finishedAt: (/* @__PURE__ */ new Date()).toISOString()
17223
17356
  }).where(and23(eq29(researchRunQueries.id, row.id), eq29(researchRunQueries.status, ResearchQueryStatuses.running))).run();
17224
17357
  if (completed.changes === 1) incrementResearchProgress(db, runId, "completedQueries");
17225
17358
  } catch (error) {
17226
- queryFailure ??= error;
17359
+ if (!(error instanceof IncompleteAnswerError && error.resumable)) queryFailure ??= error;
17227
17360
  try {
17228
17361
  markResearchQueryFailed(db, runId, row.id, error);
17229
17362
  } catch (persistenceError) {
@@ -17259,15 +17392,35 @@ async function executeResearchRun(db, registry, runId, projectId, options = {})
17259
17392
  }
17260
17393
  }
17261
17394
  function researchOutcomeStatus(status) {
17262
- if (status === ResearchRunStatuses.completed) return OutcomeStatuses.succeeded;
17263
- return status === ResearchRunStatuses.partial ? OutcomeStatuses.partial : OutcomeStatuses.failed;
17395
+ switch (status) {
17396
+ case ResearchRunStatuses.completed:
17397
+ return OutcomeStatuses.succeeded;
17398
+ // Everything this dispatch could finish is in; the rest waits on upstream jobs.
17399
+ case ResearchRunStatuses.partial:
17400
+ case ResearchRunStatuses["waiting-upstream"]:
17401
+ return OutcomeStatuses.partial;
17402
+ case ResearchRunStatuses.failed:
17403
+ return OutcomeStatuses.failed;
17404
+ }
17264
17405
  }
17265
17406
  function incrementResearchProgress(db, runId, column) {
17266
17407
  db.update(researchRuns).set({ [column]: sql11`${researchRuns[column]} + 1` }).where(eq29(researchRuns.id, runId)).run();
17267
17408
  }
17268
17409
  function markResearchQueryFailed(db, runId, queryId, error) {
17269
17410
  const message = describeError(error);
17270
- const failed = db.update(researchRunQueries).set({ status: ResearchQueryStatuses.failed, error: message, finishedAt: (/* @__PURE__ */ new Date()).toISOString() }).where(and23(eq29(researchRunQueries.id, queryId), inArray12(researchRunQueries.status, unfinishedResearchQueryStatuses))).run();
17411
+ const unfinished = and23(eq29(researchRunQueries.id, queryId), inArray12(researchRunQueries.status, unfinishedResearchQueryStatuses));
17412
+ if (error instanceof IncompleteAnswerError && error.resumable) {
17413
+ db.update(researchRunQueries).set({
17414
+ status: ResearchQueryStatuses["waiting-upstream"],
17415
+ upstreamJobId: error.evidence.completion.upstreamJobId,
17416
+ answerEvidence: error.evidence,
17417
+ searchQueries: error.evidence.searchQueries,
17418
+ error: null
17419
+ }).where(unfinished).run();
17420
+ return;
17421
+ }
17422
+ const incomplete = error instanceof IncompleteAnswerError ? { answerEvidence: error.evidence, answerText: error.answerText, rawResponse: error.rawResponse, searchQueries: error.evidence.searchQueries } : {};
17423
+ const failed = db.update(researchRunQueries).set({ status: ResearchQueryStatuses.failed, error: message, ...incomplete, finishedAt: (/* @__PURE__ */ new Date()).toISOString() }).where(unfinished).run();
17271
17424
  if (failed.changes === 1) incrementResearchProgress(db, runId, "failedQueries");
17272
17425
  }
17273
17426
  function markUnfinishedResearchQueriesFailed(db, runId, error) {
@@ -17277,13 +17430,15 @@ function finalizeResearchRun(db, runId, fatalError) {
17277
17430
  const rows = db.select({ status: researchRunQueries.status }).from(researchRunQueries).where(eq29(researchRunQueries.researchRunId, runId)).all();
17278
17431
  const completed = rows.filter((row) => row.status === ResearchQueryStatuses.completed).length;
17279
17432
  const failed = rows.filter((row) => row.status === ResearchQueryStatuses.failed).length;
17280
- const status = finalResearchRunStatus(completed, failed);
17433
+ const waiting = rows.filter((row) => row.status === ResearchQueryStatuses["waiting-upstream"]).length;
17434
+ const status = finalResearchRunStatus(completed, failed, waiting);
17281
17435
  db.update(researchRuns).set({
17282
17436
  status,
17283
17437
  completedQueries: completed,
17284
17438
  failedQueries: failed,
17285
17439
  error: fatalError ?? (failed === rows.length ? "Every research query failed." : null),
17286
- finishedAt: (/* @__PURE__ */ new Date()).toISOString()
17440
+ // A run waiting on upstream jobs has not finished.
17441
+ finishedAt: waiting > 0 ? null : (/* @__PURE__ */ new Date()).toISOString()
17287
17442
  }).where(eq29(researchRuns.id, runId)).run();
17288
17443
  return { status, total: rows.length, completed, failed };
17289
17444
  }
@@ -17639,6 +17794,9 @@ function resolveDashboardRequirePassword(env, config) {
17639
17794
  function resolveDashboardShowResourceLinks(env, config) {
17640
17795
  return parseBooleanEnv(env.CANONRY_DASHBOARD_SHOW_RESOURCE_LINKS) ?? config.dashboard?.showResourceLinks ?? true;
17641
17796
  }
17797
+ function resolveDashboardShowLocalAgentSetup(env, config) {
17798
+ return parseBooleanEnv(env.CANONRY_DASHBOARD_SHOW_LOCAL_AGENT_SETUP) ?? config.dashboard?.showLocalAgentSetup ?? true;
17799
+ }
17642
17800
  function resolveDashboardManagedRunKinds(env, config) {
17643
17801
  const configured = dashboardManagedRunKindsSchema.safeParse(config.dashboard?.managedRunKinds);
17644
17802
  if (!configured.success) {
@@ -17679,8 +17837,28 @@ var API_ADAPTERS = [
17679
17837
  localAdapter,
17680
17838
  perplexityAdapter,
17681
17839
  museAdapter,
17682
- openrouterAdapter
17840
+ openrouterAdapter,
17841
+ ...answerServiceAdapters
17683
17842
  ];
17843
+ var PROVIDER_ROUTE_FAMILIES = routeFamiliesOf(API_ADAPTERS);
17844
+ var ANSWER_SERVICE_CATALOG = new Map(answerServiceDescriptors.map((descriptor) => [descriptor.id, answerServiceCatalogFields(descriptor)]));
17845
+ function providerAdapterInfo(adapter) {
17846
+ return {
17847
+ name: adapter.name,
17848
+ displayName: adapter.displayName,
17849
+ mode: adapter.mode,
17850
+ // An answer service takes a key only; its routes pin their profiles.
17851
+ modelConfigurable: adapter.mode === "api" && adapter.kind !== "answer-service",
17852
+ defaultModel: adapter.modelRegistry.defaultModel,
17853
+ knownModels: adapter.modelRegistry.knownModels,
17854
+ modelValidationPattern: adapter.modelRegistry.validationPattern,
17855
+ modelValidationHint: adapter.modelRegistry.validationHint,
17856
+ ...adapter.kind ? { kind: adapter.kind } : {},
17857
+ ...adapter.capabilities ? { capabilities: adapter.capabilities } : {},
17858
+ ...adapter.routes ? { routes: adapter.routes } : {},
17859
+ ...ANSWER_SERVICE_CATALOG.get(adapter.name)
17860
+ };
17861
+ }
17684
17862
  var BROWSER_ADAPTERS = [cdpChatgptAdapter];
17685
17863
  var adapterMap = Object.fromEntries(
17686
17864
  API_ADAPTERS.map((a) => [a.name, a])
@@ -17713,7 +17891,8 @@ function providerSummaries(registry, config, includeBrowser = false) {
17713
17891
  defaultModel: adapter.modelRegistry.defaultModel,
17714
17892
  configured: Boolean(registry.get(adapter.name)),
17715
17893
  quota: registry.get(adapter.name)?.config.quotaPolicy,
17716
- vertexConfigured: adapter.name === ProviderNames.gemini ? Boolean(config.providers?.gemini?.vertexProject) : void 0
17894
+ vertexConfigured: adapter.name === ProviderNames.gemini ? Boolean(config.providers?.gemini?.vertexProject) : void 0,
17895
+ ...adapter.kind ? { kind: adapter.kind } : {}
17717
17896
  }));
17718
17897
  }
17719
17898
  function runtimePathIdentity(runtimePath) {
@@ -17839,7 +18018,7 @@ function applyLegacyCredentials(rows, config) {
17839
18018
  function isLoopbackPeerAddress(address) {
17840
18019
  if (!address) return false;
17841
18020
  const normalized = address.toLowerCase().replace(/^::ffff:(?=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$)/, "");
17842
- return isIP(normalized) !== 0 && isLoopbackBindHost(normalized);
18021
+ return isIP2(normalized) !== 0 && isLoopbackBindHost(normalized);
17843
18022
  }
17844
18023
  function isDirectLocalRequest(request) {
17845
18024
  if (request.raw.httpVersion !== "1.1") return false;
@@ -17870,7 +18049,7 @@ function configuresExternalAccess(trustProxy, basePath, ...configuredUrls) {
17870
18049
  }
17871
18050
  function isAllowedHost(host, allowedHosts) {
17872
18051
  const normalized = host.trim().toLowerCase().replace(/^\[|\]$/g, "");
17873
- return allowedHosts.has(normalized) || isIP(normalized) !== 0;
18052
+ return allowedHosts.has(normalized) || isIP2(normalized) !== 0;
17874
18053
  }
17875
18054
  function buildAllowedHosts(bindHost, ...configuredUrls) {
17876
18055
  const allowed = /* @__PURE__ */ new Set(["localhost", "127.0.0.1", "::1"]);
@@ -18598,6 +18777,7 @@ async function createServer(opts) {
18598
18777
  // Same source of truth the HTTP routes use, so a scheduled sweep resolves
18599
18778
  // "all configured providers" exactly as a hand-triggered one does.
18600
18779
  getRunnableProviderNames: () => registry.getAll().map((provider) => provider.adapter.name),
18780
+ getProviderRouteFamilies: () => PROVIDER_ROUTE_FAMILIES,
18601
18781
  getEffectiveProviderModels: () => effectiveProviderModels(registry),
18602
18782
  getBatchEligibleProviderNames: () => batchEligibleProviderNames(registry),
18603
18783
  onTrafficSyncRequested: (projectName, sourceId) => {
@@ -18851,7 +19031,7 @@ async function createServer(opts) {
18851
19031
  }
18852
19032
  };
18853
19033
  const rawBasePath = process.env.CANONRY_BASE_PATH ?? opts.config.basePath;
18854
- const normalizedBasePath = rawBasePath ? "/" + rawBasePath.replace(/^\//, "").replace(/\/?$/, "/") : void 0;
19034
+ const normalizedBasePath = rawBasePath && rawBasePath !== "/" ? "/" + rawBasePath.replace(/^\//, "").replace(/\/?$/, "/") : void 0;
18855
19035
  const basePath = normalizedBasePath === "/" ? void 0 : normalizedBasePath;
18856
19036
  const embedCsp = embed.enabled ? frameAncestorsHeaderValue(embed.allowedOrigins) : void 0;
18857
19037
  const unsupportedProjectTabs = unsupportedEmbedProjectTabs(embed.projectTabs);
@@ -18866,6 +19046,7 @@ async function createServer(opts) {
18866
19046
  }
18867
19047
  const dashboardRequirePassword = resolveDashboardRequirePassword(process.env, opts.config);
18868
19048
  const dashboardShowResourceLinks = resolveDashboardShowResourceLinks(process.env, opts.config);
19049
+ const dashboardShowLocalAgentSetup = resolveDashboardShowLocalAgentSetup(process.env, opts.config);
18869
19050
  const dashboardShowUpdateNotification = resolveDashboardShowUpdateNotification(process.env, opts.config);
18870
19051
  const dashboardOnboardingMode = resolveDashboardOnboardingMode(process.env, opts.config);
18871
19052
  const researchAllowViewers = resolveResearchAllowViewers(process.env, opts.config);
@@ -18875,6 +19056,12 @@ async function createServer(opts) {
18875
19056
  "Dashboard password gate resolved"
18876
19057
  );
18877
19058
  const apiPrefix = basePath ? `${basePath}api/v1` : "/api/v1";
19059
+ const authorizationPath = `${basePath ?? "/"}oauth/authorize`;
19060
+ const getMcpHealth = () => mcpHttpHealth(app, apiPrefix, {
19061
+ publicUrl: opts.config.publicUrl,
19062
+ hasAccounts: anyUsersExist(opts.db),
19063
+ authorizationPath
19064
+ });
18878
19065
  const credentialChecker = createCredentialChecker({
18879
19066
  db: opts.db,
18880
19067
  trustProxyConfigured: trustProxy !== false
@@ -19440,6 +19627,7 @@ async function createServer(opts) {
19440
19627
  // Local-only Aero agent routes. Registered here so they inherit api-routes'
19441
19628
  // auth plugin — bare `registerAgentRoutes(app, ...)` would skip auth.
19442
19629
  credentials: credentialChecker,
19630
+ getMcpHealth,
19443
19631
  oauthResourceUrl: publicOrigin ? `${publicOrigin}${`${basePath ?? "/"}api/v1/mcp`.replace("//", "/")}` : void 0,
19444
19632
  registerAuthenticatedRoutes: async (scope) => {
19445
19633
  registerMcpHttpRoutes(scope, {
@@ -19699,16 +19887,7 @@ async function createServer(opts) {
19699
19887
  providerSummary,
19700
19888
  getProviderModels: providerModelCatalog,
19701
19889
  getCachedProviderModels: providerModelCatalog.cached,
19702
- providerAdapters: [...API_ADAPTERS, ...BROWSER_ADAPTERS].map((a) => ({
19703
- name: a.name,
19704
- displayName: a.displayName,
19705
- mode: a.mode,
19706
- modelConfigurable: a.mode === "api",
19707
- defaultModel: a.modelRegistry.defaultModel,
19708
- knownModels: a.modelRegistry.knownModels,
19709
- modelValidationPattern: a.modelRegistry.validationPattern,
19710
- modelValidationHint: a.modelRegistry.validationHint
19711
- })),
19890
+ providerAdapters: [...API_ADAPTERS, ...BROWSER_ADAPTERS].map(providerAdapterInfo),
19712
19891
  googleSettingsSummary,
19713
19892
  bingSettingsSummary,
19714
19893
  bingConnectionStore,
@@ -19798,17 +19977,20 @@ async function createServer(opts) {
19798
19977
  onProviderUpdate: (providerName, apiKey, model, baseUrl, incomingQuota, auditContext) => {
19799
19978
  const name = providerName;
19800
19979
  if (!adapterMap[name]) return null;
19980
+ const adapterDefaultQuota = adapterMap[name].defaultQuota ?? DEFAULT_QUOTA;
19981
+ const answerService = adapterMap[name].kind === "answer-service";
19801
19982
  if (!opts.config.providers) opts.config.providers = {};
19802
19983
  const existing = opts.config.providers[name];
19803
19984
  const previousProvider = registry.get(name) ?? (existing ? {
19804
19985
  adapter: adapterMap[name],
19805
- config: providerConfigFromEntry(name, existing, resolveProviderQuotaPolicy(existing.quota, DEFAULT_QUOTA))
19986
+ config: providerConfigFromEntry(name, existing, resolveProviderQuotaPolicy(existing.quota, adapterDefaultQuota))
19806
19987
  } : void 0);
19807
- const mergedQuota = incomingQuota ? { ...existing?.quota ?? DEFAULT_QUOTA, ...incomingQuota } : existing?.quota;
19988
+ const mergedQuota = incomingQuota ? { ...existing?.quota ?? adapterDefaultQuota, ...incomingQuota } : existing?.quota;
19808
19989
  opts.config.providers[name] = {
19809
19990
  apiKey: apiKey || existing?.apiKey,
19810
- baseUrl: baseUrl || existing?.baseUrl,
19811
- model: model || existing?.model,
19991
+ // An answer service's endpoint is fixed and its routes pin profiles.
19992
+ baseUrl: answerService ? void 0 : baseUrl || existing?.baseUrl,
19993
+ model: answerService ? void 0 : model || existing?.model,
19812
19994
  quota: mergedQuota,
19813
19995
  // Preserve Vertex AI config (Gemini provider) — these are set via
19814
19996
  // config file or env vars, not through the dashboard update payload
@@ -19826,7 +20008,7 @@ async function createServer(opts) {
19826
20008
  app.log.error({ err }, "Failed to save config");
19827
20009
  return null;
19828
20010
  }
19829
- const quota = resolveProviderQuotaPolicy(opts.config.providers[name].quota, DEFAULT_QUOTA);
20011
+ const quota = resolveProviderQuotaPolicy(opts.config.providers[name].quota, adapterDefaultQuota);
19830
20012
  registry.register(adapterMap[name], providerConfigFromEntry(name, opts.config.providers[name], quota));
19831
20013
  providerSummary.splice(0, providerSummary.length, ...providerSummaries(registry, opts.config));
19832
20014
  const entry = providerSummary.find((provider) => provider.name === name);
@@ -19961,6 +20143,8 @@ async function createServer(opts) {
19961
20143
  const provider = registry.get(providerName);
19962
20144
  if (!provider)
19963
20145
  throw new Error(`Provider "${providerName}" is not configured`);
20146
+ if (!canGenerateText(provider.adapter))
20147
+ throw validationError(`${provider.adapter.displayName} cannot generate queries. Choose a provider that generates text.`);
19964
20148
  const siteText = await fetchSiteText(project.domain);
19965
20149
  const prompt = buildQueryGenerationPrompt({
19966
20150
  domain: project.domain,
@@ -19992,6 +20176,9 @@ async function createServer(opts) {
19992
20176
  if (!dashboardShowResourceLinks) {
19993
20177
  dashboardConfig.showResourceLinks = false;
19994
20178
  }
20179
+ if (!dashboardShowLocalAgentSetup) {
20180
+ dashboardConfig.showLocalAgentSetup = false;
20181
+ }
19995
20182
  if (!dashboardShowUpdateNotification) {
19996
20183
  dashboardConfig.showUpdateNotification = false;
19997
20184
  }
@@ -20107,7 +20294,7 @@ async function createServer(opts) {
20107
20294
  status: "ok",
20108
20295
  service: "canonry",
20109
20296
  version: PKG_VERSION,
20110
- mcp: mcpHttpHealth(app, apiPrefix),
20297
+ mcp: getMcpHealth(),
20111
20298
  ...buildCommit ? { commit: buildCommit } : {},
20112
20299
  ...instance ? { instance } : {},
20113
20300
  ...basePath ? { basePath: basePath.replace(/\/$/, "") } : {},
@@ -20118,6 +20305,7 @@ async function createServer(opts) {
20118
20305
  registerOAuthRoutes(app, {
20119
20306
  db: opts.db,
20120
20307
  issuer: publicOrigin,
20308
+ authorizationPath,
20121
20309
  resourcePaths: mcpTransportPaths().map(
20122
20310
  (suffix) => `${basePath ?? "/"}api/v1${suffix}`.replace("//", "/")
20123
20311
  ),
@@ -20141,7 +20329,7 @@ async function createServer(opts) {
20141
20329
  return serializeUserSessionCookie({
20142
20330
  value: token,
20143
20331
  path: basePath ?? "/",
20144
- secure: opts.config.publicUrl?.startsWith("https://") ?? false
20332
+ secure: sessionCookieSecure
20145
20333
  });
20146
20334
  }
20147
20335
  });