@canonry/canonry 7.52.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 (147) hide show
  1. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +24 -1
  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-aOd198dT.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-BWnMmkiO.js → format-helpers-Gj1ekh6p.js} +1 -1
  18. package/assets/assets/index-B8W65ejO.css +1 -0
  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-hGyOC4V_.js → react-sigma_core.esm.min-j5DWE8Rk.js} +1 -1
  23. package/assets/assets/service-2DEngBCR.js +1 -0
  24. package/assets/index.html +9 -7
  25. package/dist/{ads-MREK2AGL.js → ads-A5S2NQBZ.js} +3 -3
  26. package/dist/{agent-4RUZ3MC4.js → agent-BV7G7QN7.js} +7 -7
  27. package/dist/{agent-ask-YLTYBEYH.js → agent-ask-5ALAHZ6T.js} +3 -3
  28. package/dist/{agent-conversations-QA6IKDGR.js → agent-conversations-MJPQCJYR.js} +3 -3
  29. package/dist/{agent-memory-MEQAJOB3.js → agent-memory-Z3VPA5KH.js} +3 -3
  30. package/dist/{agent-providers-AXYPDJHL.js → agent-providers-FP3LAZPG.js} +3 -3
  31. package/dist/{agent-transcript-SMNQNYCD.js → agent-transcript-4GXCOC73.js} +3 -3
  32. package/dist/{analytics-4OR64IGV.js → analytics-TOLSUYSN.js} +3 -3
  33. package/dist/{apply-CQXCFXAH.js → apply-EU5JAFVZ.js} +3 -3
  34. package/dist/{backfill-TMXCNVOB.js → backfill-3263IYJH.js} +9 -9
  35. package/dist/{backlinks-6KFAQGYV.js → backlinks-XQ5JTN6W.js} +3 -3
  36. package/dist/{bing-HFCACTAC.js → bing-LYHRD7BF.js} +3 -3
  37. package/dist/{bootstrap-SQVQXOJC.js → bootstrap-AKWTIMMH.js} +17 -9
  38. package/dist/{cdp-IACL7EXU.js → cdp-N4PQJWGQ.js} +7 -7
  39. package/dist/{chunk-K5I45PZI.js → chunk-2SY2FYFW.js} +556 -255
  40. package/dist/{chunk-KXAOMTXN.js → chunk-4LVJFSPH.js} +5 -5
  41. package/dist/{chunk-GNKOBKPW.js → chunk-5P7DSHNK.js} +4 -4
  42. package/dist/{chunk-6BPZHNDC.js → chunk-6WTSWWP6.js} +2 -2
  43. package/dist/{chunk-MJNUSPO4.js → chunk-75CFTTBF.js} +2 -2
  44. package/dist/{chunk-TALC5DX5.js → chunk-B37SDIGU.js} +1 -1
  45. package/dist/chunk-BQKKAPMW.js +1211 -0
  46. package/dist/{chunk-LK2BG6EX.js → chunk-D234NBWI.js} +11 -1
  47. package/dist/{chunk-QLPLENDT.js → chunk-EIG2V6UI.js} +1 -1
  48. package/dist/{chunk-MKAC7HKH.js → chunk-GFRIXUDK.js} +38 -4
  49. package/dist/{chunk-BBOHY2DQ.js → chunk-H6EQMYGT.js} +1 -1
  50. package/dist/{chunk-EGIZNSDA.js → chunk-J7VN3FZ3.js} +1 -1
  51. package/dist/{chunk-DSNSD5J3.js → chunk-K5MBEK4S.js} +19 -9
  52. package/dist/{chunk-SNFBJKAW.js → chunk-LCTYTGSE.js} +3 -3
  53. package/dist/{chunk-5N6245R7.js → chunk-MARVEIWH.js} +4 -4
  54. package/dist/{chunk-7XE2IRBG.js → chunk-OHVXKFQI.js} +1 -1
  55. package/dist/{chunk-O4RMPA6H.js → chunk-OMXWBR2R.js} +7294 -6533
  56. package/dist/{chunk-O77IBNVO.js → chunk-PFPTUCMG.js} +326 -324
  57. package/dist/{chunk-YSEC6TIB.js → chunk-PRNO5TLE.js} +1206 -405
  58. package/dist/{chunk-7244X3K6.js → chunk-QFKDFU73.js} +2 -2
  59. package/dist/chunk-R4AFXPM4.js +959 -0
  60. package/dist/{chunk-V5D4XNWV.js → chunk-RHCDUPD6.js} +39 -2
  61. package/dist/{chunk-AWCWIQAU.js → chunk-SKZVEZZK.js} +231 -5
  62. package/dist/{chunk-RVUCY4ZV.js → chunk-T63KVDWY.js} +6 -4
  63. package/dist/{chunk-IIOEAJTV.js → chunk-VB47PTY7.js} +3 -3
  64. package/dist/{chunk-ILDT4LPB.js → chunk-VCTP2RG6.js} +26 -240
  65. package/dist/{chunk-JY3RLZGB.js → chunk-VF7XGX2I.js} +1 -1
  66. package/dist/{chunk-I6KNMZ77.js → chunk-VMCVLESK.js} +4 -4
  67. package/dist/{chunk-R2J4SNKF.js → chunk-WDJMIIY2.js} +1 -1
  68. package/dist/{chunk-BU3VAG5J.js → chunk-XJVCTI2N.js} +3 -3
  69. package/dist/{chunk-HEGXGCGL.js → chunk-Y2YBRLSS.js} +3 -3
  70. package/dist/{chunk-Y4GK7GCV.js → chunk-YOZ35ZTT.js} +1 -1
  71. package/dist/{chunk-BYOK6Z4F.js → chunk-ZA7D7CCN.js} +2 -2
  72. package/dist/{chunk-FC4XND45.js → chunk-ZILJZNMQ.js} +1 -1
  73. package/dist/{citations-NSBBWRZ4.js → citations-JK3ZMAR7.js} +3 -3
  74. package/dist/{cli-catalog-OFWJMNMD.js → cli-catalog-P2I6IYNI.js} +3 -3
  75. package/dist/{cli-commands-WVBL337U.js → cli-commands-YDRKG6OC.js} +7 -7
  76. package/dist/cli.js +13 -13
  77. package/dist/{competitor-V4OHORBC.js → competitor-5CJPM36M.js} +3 -3
  78. package/dist/{content-RUXRI5IC.js → content-5FEDXNHR.js} +3 -3
  79. package/dist/{dashboard-JXB2YAQJ.js → dashboard-ME7MBJTX.js} +6 -6
  80. package/dist/{demo-55ZNUOXU.js → demo-N7MEASQP.js} +1 -1
  81. package/dist/{demo-server-XO7PHM4I.js → demo-server-IGTBANDC.js} +11 -11
  82. package/dist/{discover-JJQ564HS.js → discover-EAISVTA6.js} +3 -3
  83. package/dist/{discover-eval-KLEKZ6U4.js → discover-eval-JIBKK44Q.js} +3 -3
  84. package/dist/{doctor-JAMQZCMZ.js → doctor-HSQYOZ4C.js} +3 -3
  85. package/dist/{evidence-YRSB7GFE.js → evidence-PSYAWKPP.js} +3 -3
  86. package/dist/{export-cmd-MHML4OYU.js → export-cmd-MWJN6H7W.js} +3 -3
  87. package/dist/{ga-LSXPE2MN.js → ga-WSQWECYY.js} +3 -3
  88. package/dist/{gbp-RMKMLOC7.js → gbp-OD26AEPF.js} +3 -3
  89. package/dist/{google-JQ4T6JTQ.js → google-FMJ7IWAF.js} +4 -4
  90. package/dist/{google-marketing-J6SEODYC.js → google-marketing-66JL4V24.js} +1 -1
  91. package/dist/{health-cmd-MV2JM2C3.js → health-cmd-2RO5LAI4.js} +3 -3
  92. package/dist/{history-SRRH7A2E.js → history-X6CNPW7G.js} +3 -3
  93. package/dist/index.d.ts +518 -50
  94. package/dist/index.js +24 -23
  95. package/dist/{init-ZJZFUERV.js → init-25III66S.js} +11 -11
  96. package/dist/{insights-PMMGNWZH.js → insights-6IWWA6JU.js} +3 -3
  97. package/dist/intelligence-service-N334P6FH.js +15 -0
  98. package/dist/{keys-TS7NZANS.js → keys-ABXAPISY.js} +3 -3
  99. package/dist/{keyword-VNCKDUGC.js → keyword-LERAVMI3.js} +3 -3
  100. package/dist/{logs-VH3WOTZJ.js → logs-BTAB5SNZ.js} +3 -3
  101. package/dist/{mcp-DG2RROB3.js → mcp-5E42RT6R.js} +2 -2
  102. package/dist/mcp.js +9 -9
  103. package/dist/{measurement-plan-4T35TUGG.js → measurement-plan-MRZRNBJG.js} +5 -5
  104. package/dist/{notify-BWHUSKL7.js → notify-YQYGC5UZ.js} +3 -3
  105. package/dist/{organic-evidence-QX4SXXJP.js → organic-evidence-6QT4YT3K.js} +3 -3
  106. package/dist/{overview-7IHUTKUV.js → overview-EHZ3FTS2.js} +4 -4
  107. package/dist/{project-JXLSWDE2.js → project-RNLV2ARE.js} +3 -3
  108. package/dist/{query-S75EL25H.js → query-IM2RXI4L.js} +3 -3
  109. package/dist/{research-KFTV3IP4.js → research-4FALR336.js} +25 -10
  110. package/dist/{results-export-GTKVBU34.js → results-export-4ETSRUGO.js} +3 -3
  111. package/dist/{run-26HDIRHF.js → run-QL7226N7.js} +4 -4
  112. package/dist/{schedule-N6G4SVHQ.js → schedule-GJE634VO.js} +3 -3
  113. package/dist/{search-MI32EPYM.js → search-7OQL67R6.js} +3 -3
  114. package/dist/{serve-XLGE42AG.js → serve-UN2OEK2Q.js} +25 -24
  115. package/dist/{session-W5DXWIYM.js → session-5M54TVY5.js} +16 -15
  116. package/dist/{settings-T7WI2UVE.js → settings-2QOL7YBM.js} +15 -3
  117. package/dist/{skills-F3WPKPTK.js → skills-GPLAAU3I.js} +2 -2
  118. package/dist/{snapshot-PD3EAVEX.js → snapshot-5YMJFRJS.js} +8 -6
  119. package/dist/{src-XDUXMJC3.js → src-YF3JLURF.js} +2 -2
  120. package/dist/{status-PUH7JFZ4.js → status-WGWC6FLN.js} +33 -5
  121. package/dist/{technical-aeo-AUFWWJIP.js → technical-aeo-RNMLD7OL.js} +3 -3
  122. package/dist/{telemetry-XBYT7G2K.js → telemetry-7U3ZICU4.js} +4 -4
  123. package/dist/{tools-GVHIRWSN.js → tools-CSKTZTKT.js} +11 -11
  124. package/dist/{traffic-B3HW2ZWG.js → traffic-QIAXLW6J.js} +5 -5
  125. package/dist/{users-M5HNQZYI.js → users-I6X5P5AO.js} +3 -3
  126. package/dist/{visibility-stats-Y7GJKMHN.js → visibility-stats-33OUKQQL.js} +3 -3
  127. package/dist/{wordpress-GCIURYPN.js → wordpress-3IO3O27D.js} +3 -3
  128. package/package.json +3 -1
  129. package/assets/assets/AccessControls-CteIuEGI.js +0 -1
  130. package/assets/assets/AuditHistoryPanel-DqJGiLsf.js +0 -1
  131. package/assets/assets/BacklinksPage-DotWEPQt.js +0 -1
  132. package/assets/assets/MeasurementPropertyPage-CuaKVK8x.js +0 -4
  133. package/assets/assets/ProjectPage-O9oufMgi.js +0 -8
  134. package/assets/assets/RunsPage-DIXMrc-N.js +0 -1
  135. package/assets/assets/SettingsPage-BuGb6AGa.js +0 -1
  136. package/assets/assets/SiteHealthSection-CweaKjCo.js +0 -2
  137. package/assets/assets/TrafficPage-B7MaQalp.js +0 -40
  138. package/assets/assets/TrafficSourceDetailPage-BPtjnF9s.js +0 -1
  139. package/assets/assets/card-DoV-8Txo.js +0 -60
  140. package/assets/assets/extract-error-message-DKQJJlZ-.js +0 -1
  141. package/assets/assets/index-CsPsaUr7.css +0 -1
  142. package/assets/assets/index-Z63c4PeO.js +0 -39
  143. package/assets/assets/query-client-vB35tVTz.js +0 -1
  144. package/assets/assets/react-query-BI0567qs.js +0 -1
  145. package/assets/assets/service-c4YvpVKX.js +0 -1
  146. package/dist/chunk-OFL4PTYU.js +0 -644
  147. package/dist/intelligence-service-KCSU6ZUJ.js +0 -15
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  loadConfig
3
- } from "./chunk-OFL4PTYU.js";
3
+ } from "./chunk-BQKKAPMW.js";
4
4
  import {
5
5
  PACKAGE_VERSION
6
6
  } from "./chunk-AOJU5LKX.js";
@@ -36,7 +36,7 @@ import {
36
36
  sentimentSettingsReadSchema,
37
37
  sentimentSummaryReadSchema,
38
38
  upgradeCommandFor
39
- } from "./chunk-O4RMPA6H.js";
39
+ } from "./chunk-OMXWBR2R.js";
40
40
 
41
41
  // ../api-client-generated/src/generated/core/bodySerializer.gen.ts
42
42
  var jsonBodySerializer = {
@@ -1063,6 +1063,24 @@ var postApiV1ProjectsByNameMeasurementPlanDraftActionsApplyPairedAssignments = (
1063
1063
  ...options.headers
1064
1064
  }
1065
1065
  });
1066
+ var postApiV1ProjectsByNameMeasurementPlanDraftActionsPreviewRouteMarkets = (options) => (options.client ?? client).post({
1067
+ security: [{ scheme: "bearer", type: "http" }],
1068
+ url: "/api/v1/projects/{name}/measurement-plan/draft/actions/preview-route-markets",
1069
+ ...options,
1070
+ headers: {
1071
+ "Content-Type": "application/json",
1072
+ ...options.headers
1073
+ }
1074
+ });
1075
+ var postApiV1ProjectsByNameMeasurementPlanDraftActionsRouteMarkets = (options) => (options.client ?? client).post({
1076
+ security: [{ scheme: "bearer", type: "http" }],
1077
+ url: "/api/v1/projects/{name}/measurement-plan/draft/actions/route-markets",
1078
+ ...options,
1079
+ headers: {
1080
+ "Content-Type": "application/json",
1081
+ ...options.headers
1082
+ }
1083
+ });
1066
1084
  var postApiV1ProjectsByNameMeasurementPlanDraftActionsRemoveAssignment = (options) => (options.client ?? client).post({
1067
1085
  security: [{ scheme: "bearer", type: "http" }],
1068
1086
  url: "/api/v1/projects/{name}/measurement-plan/draft/actions/remove-assignment",
@@ -4228,6 +4246,25 @@ var ApiClient = class {
4228
4246
  })
4229
4247
  );
4230
4248
  }
4249
+ async previewMeasurementDraftMarketRouting(project, request) {
4250
+ return this.invoke(
4251
+ () => postApiV1ProjectsByNameMeasurementPlanDraftActionsPreviewRouteMarkets({
4252
+ client: this.heyClient,
4253
+ path: { name: project },
4254
+ body: request
4255
+ })
4256
+ );
4257
+ }
4258
+ async routeMeasurementDraftMarkets(project, request, idempotencyKey, etag) {
4259
+ return this.invoke(
4260
+ () => postApiV1ProjectsByNameMeasurementPlanDraftActionsRouteMarkets({
4261
+ client: this.heyClient,
4262
+ path: { name: project },
4263
+ body: request,
4264
+ headers: this.measurementDraftMutationHeaders(idempotencyKey, etag)
4265
+ })
4266
+ );
4267
+ }
4231
4268
  async removeMeasurementDraftAssignment(project, request, idempotencyKey, etag) {
4232
4269
  return this.invoke(
4233
4270
  () => postApiV1ProjectsByNameMeasurementPlanDraftActionsRemoveAssignment({
@@ -1,11 +1,14 @@
1
1
  import {
2
2
  parseJsonColumn
3
- } from "./chunk-MKAC7HKH.js";
3
+ } from "./chunk-GFRIXUDK.js";
4
4
  import {
5
5
  AI_ENGINE_DOMAINS,
6
6
  AI_ENGINE_SELF_DOMAINS,
7
7
  AnchoredSpanSources,
8
+ OPENROUTER_MODEL_PATTERN,
9
+ OPENROUTER_ROUTE_FAMILY,
8
10
  ProviderBatchSubmitError,
11
+ ProviderKinds,
9
12
  ProviderNames,
10
13
  RetrievalContracts,
11
14
  RetrievalStatuses,
@@ -16,12 +19,14 @@ import {
16
19
  hostOf,
17
20
  isRetryableHttpError,
18
21
  normalizeServedModel,
22
+ openRouterRouteModel,
23
+ openRouterRouteName,
19
24
  registrableDomain,
20
25
  resolveProviderModel,
21
26
  retryAfterDelayMs,
22
27
  usageCount,
23
28
  withRetry
24
- } from "./chunk-O4RMPA6H.js";
29
+ } from "./chunk-OMXWBR2R.js";
25
30
 
26
31
  // ../provider-openai/src/normalize.ts
27
32
  import OpenAI from "openai";
@@ -1295,16 +1300,16 @@ function buildTrackedQueryRequest3(input) {
1295
1300
  }
1296
1301
  async function executeTrackedQuery3(input) {
1297
1302
  const model = resolveModel2(input.config);
1298
- const request = buildTrackedQueryRequest3(input).body;
1303
+ const request2 = buildTrackedQueryRequest3(input).body;
1299
1304
  const client = createClient2(input.config);
1300
1305
  let result;
1301
1306
  try {
1302
1307
  result = await withRetry4(
1303
1308
  () => client.models.generateContent({
1304
1309
  model,
1305
- contents: request.contents,
1310
+ contents: request2.contents,
1306
1311
  config: {
1307
- tools: request.tools
1312
+ tools: request2.tools
1308
1313
  }
1309
1314
  })
1310
1315
  );
@@ -2631,6 +2636,226 @@ var museAdapter = {
2631
2636
  }
2632
2637
  };
2633
2638
 
2639
+ // ../provider-openrouter/src/adapter.ts
2640
+ var BASE_URL2 = "https://openrouter.ai/api/v1";
2641
+ function modelOf2(config) {
2642
+ const routeModel = openRouterRouteModel(config.provider);
2643
+ if (routeModel && config.model && routeModel !== config.model) throw new Error("OpenRouter route model cannot be overridden");
2644
+ const model = routeModel ?? config.model;
2645
+ if (!model || !openRouterRouteModel(`openrouter:${model}`)) throw new Error("Select a concrete OpenRouter text model (publisher/model)");
2646
+ return model;
2647
+ }
2648
+ var OpenRouterHttpError = class extends Error {
2649
+ constructor(status, retryAfter) {
2650
+ super(`OpenRouter request failed (HTTP ${status})`);
2651
+ this.status = status;
2652
+ this.retryAfter = retryAfter;
2653
+ this.name = "OpenRouterHttpError";
2654
+ }
2655
+ status;
2656
+ retryAfter;
2657
+ };
2658
+ function choiceFailure(body) {
2659
+ const choice = Array.isArray(body.choices) ? asRecord(body.choices[0]) : void 0;
2660
+ const error = asRecord(choice?.error);
2661
+ if (!error && choice?.finish_reason !== "error") return null;
2662
+ return typeof error?.code === "number" ? error.code : 502;
2663
+ }
2664
+ async function fetchOnce(config, resource, body, signal) {
2665
+ const response = await fetch(`${(config.baseUrl || BASE_URL2).replace(/\/+$/, "")}/${resource}`, {
2666
+ method: body ? "POST" : "GET",
2667
+ headers: { Authorization: `Bearer ${config.apiKey ?? ""}`, "Content-Type": "application/json" },
2668
+ ...body ? { body: JSON.stringify(body) } : {},
2669
+ signal: signal ?? AbortSignal.timeout(12e4)
2670
+ });
2671
+ if (!response.ok) throw new OpenRouterHttpError(response.status, response.headers.get("retry-after") ?? void 0);
2672
+ const value = asRecord(await response.json());
2673
+ if (!value) throw new Error("OpenRouter returned an invalid response");
2674
+ const error = asRecord(value.error);
2675
+ if (error) throw new OpenRouterHttpError(typeof error.code === "number" ? error.code : 502);
2676
+ const failed = choiceFailure(value);
2677
+ if (failed !== null) throw new OpenRouterHttpError(failed);
2678
+ return value;
2679
+ }
2680
+ function request(config, resource, body, signal) {
2681
+ return withRetry(() => fetchOnce(config, resource, body, signal), {
2682
+ isRetryable: (error) => !signal?.aborted && isRetryableHttpError(error),
2683
+ computeDelayMs: (_attempt, error, delay) => retryAfterDelayMs(error) ?? delay
2684
+ });
2685
+ }
2686
+ function messageOf(body) {
2687
+ const choice = Array.isArray(body.choices) ? asRecord(body.choices[0]) : void 0;
2688
+ return asRecord(choice?.message);
2689
+ }
2690
+ function sourcesOf(body) {
2691
+ const annotations = messageOf(body)?.annotations;
2692
+ const sources = /* @__PURE__ */ new Map();
2693
+ if (!Array.isArray(annotations)) return [];
2694
+ for (const value of annotations) {
2695
+ const annotation = asRecord(value);
2696
+ if (annotation?.type !== "url_citation") continue;
2697
+ const citation = asRecord(annotation.url_citation);
2698
+ if (typeof citation?.url !== "string") continue;
2699
+ let uri;
2700
+ try {
2701
+ const url = new URL(citation.url);
2702
+ if (!["http:", "https:"].includes(url.protocol)) continue;
2703
+ uri = url.href;
2704
+ } catch {
2705
+ continue;
2706
+ }
2707
+ if (!hostOf(uri)) continue;
2708
+ sources.set(uri, { uri, title: typeof citation.title === "string" ? citation.title : hostOf(uri) });
2709
+ }
2710
+ return [...sources.values()];
2711
+ }
2712
+ function parseResponse2(body, model, provider = openRouterRouteName(model)) {
2713
+ const failed = choiceFailure(body);
2714
+ if (failed !== null) throw new OpenRouterHttpError(failed);
2715
+ const message = messageOf(body);
2716
+ if (typeof message?.content !== "string" || !message.content.trim()) throw new Error("OpenRouter returned no answer text");
2717
+ const groundingSources = sourcesOf(body);
2718
+ const usage = asRecord(body.usage);
2719
+ const details = asRecord(usage?.input_tokens_details) ?? asRecord(usage?.prompt_tokens_details);
2720
+ const choice = Array.isArray(body.choices) ? asRecord(body.choices[0]) : void 0;
2721
+ const cached = usageCount(details?.cached_tokens);
2722
+ const searchCount = usageCount(asRecord(usage?.server_tool_use)?.web_search_requests);
2723
+ const inputTokens = usage?.input_tokens === void 0 ? usageCount(usage?.prompt_tokens) : usageCount(usage.input_tokens);
2724
+ const outputTokens = usage?.output_tokens === void 0 ? usageCount(usage?.completion_tokens) : usageCount(usage.output_tokens);
2725
+ return {
2726
+ provider,
2727
+ model,
2728
+ servedModel: normalizeServedModel(body.model),
2729
+ rawResponse: body,
2730
+ groundingSources,
2731
+ searchQueries: [],
2732
+ retrievalContract: RetrievalContracts["search-required-v1"],
2733
+ retrievalStatus: searchCount > 0 || groundingSources.length ? RetrievalStatuses.used : RetrievalStatuses.unknown,
2734
+ ...typeof choice?.finish_reason === "string" ? { stopReason: choice.finish_reason } : {},
2735
+ ...usage ? { usage: {
2736
+ inputTokens: Math.max(0, inputTokens - cached),
2737
+ cachedInputTokens: cached,
2738
+ cacheWriteTokens: 0,
2739
+ outputTokens,
2740
+ searchCount
2741
+ } } : {}
2742
+ };
2743
+ }
2744
+ function perMillionTokens(value) {
2745
+ if (typeof value === "string" ? !value.trim() : typeof value !== "number") return void 0;
2746
+ const perToken = Number(value);
2747
+ if (!Number.isFinite(perToken) || perToken < 0) return void 0;
2748
+ return Number((perToken * 1e6).toPrecision(12));
2749
+ }
2750
+ function positiveInteger(value) {
2751
+ return typeof value === "number" && Number.isInteger(value) && value > 0 ? value : void 0;
2752
+ }
2753
+ function catalogMetadata(model) {
2754
+ const topProvider = asRecord(model.top_provider);
2755
+ const pricing = asRecord(model.pricing);
2756
+ const input = perMillionTokens(pricing?.prompt);
2757
+ const output = perMillionTokens(pricing?.completion);
2758
+ const cacheRead = perMillionTokens(pricing?.input_cache_read);
2759
+ const cacheWrite = perMillionTokens(pricing?.input_cache_write);
2760
+ const modalities = asRecord(model.architecture)?.input_modalities;
2761
+ const parameters = Array.isArray(model.supported_parameters) ? model.supported_parameters : void 0;
2762
+ const contextWindow = positiveInteger(model.context_length) ?? positiveInteger(topProvider?.context_length);
2763
+ const maxOutputTokens = positiveInteger(topProvider?.max_completion_tokens);
2764
+ return {
2765
+ ...contextWindow ? { contextWindow } : {},
2766
+ ...maxOutputTokens ? { maxOutputTokens } : {},
2767
+ ...input !== void 0 && output !== void 0 ? { pricing: {
2768
+ input,
2769
+ output,
2770
+ ...cacheRead !== void 0 ? { cacheRead } : {},
2771
+ ...cacheWrite !== void 0 ? { cacheWrite } : {}
2772
+ } } : {},
2773
+ ...Array.isArray(modalities) ? { inputModalities: modalities.filter((entry) => typeof entry === "string") } : {},
2774
+ ...parameters ? { supportsTools: parameters.includes("tools"), supportsReasoning: parameters.includes("reasoning") } : {}
2775
+ };
2776
+ }
2777
+ function buildRequest(input, config) {
2778
+ const model = modelOf2(config);
2779
+ return { endpoint: "/chat/completions", body: {
2780
+ model,
2781
+ messages: [{ role: "user", content: input.query }],
2782
+ stream: false,
2783
+ tools: [{ type: "openrouter:web_search", parameters: { max_uses: 1, max_total_results: 5 } }],
2784
+ tool_choice: "required",
2785
+ max_tool_calls: 1,
2786
+ provider: { allow_fallbacks: false, require_parameters: true }
2787
+ } };
2788
+ }
2789
+ function normalize(raw) {
2790
+ const content = messageOf(raw.rawResponse)?.content;
2791
+ return {
2792
+ provider: raw.provider,
2793
+ answerText: typeof content === "string" ? content : "",
2794
+ citedDomains: [...new Set(raw.groundingSources.map((source) => hostOf(source.uri)).filter((host) => Boolean(host)).map((host) => registrableDomain(host) ?? host))],
2795
+ groundingSources: raw.groundingSources,
2796
+ searchQueries: raw.searchQueries,
2797
+ retrievalStatus: raw.retrievalStatus
2798
+ };
2799
+ }
2800
+ var openrouterAdapter = {
2801
+ name: "openrouter",
2802
+ displayName: "OpenRouter",
2803
+ mode: "api",
2804
+ supportsLocationContext: false,
2805
+ // One connection, many pinned model routes; the bare connection is never a sweep target.
2806
+ kind: ProviderKinds["model-gateway"],
2807
+ routes: OPENROUTER_ROUTE_FAMILY,
2808
+ keyUrl: "https://openrouter.ai/keys",
2809
+ modelRegistry: { defaultModel: "", validationPattern: OPENROUTER_MODEL_PATTERN, validationHint: "a concrete text model ID, publisher/model", knownModels: [] },
2810
+ validateConfig(config) {
2811
+ if (!config.apiKey?.trim()) return { ok: false, provider: config.provider, message: "Missing OpenRouter API key" };
2812
+ if (config.model || openRouterRouteModel(config.provider)) {
2813
+ try {
2814
+ modelOf2(config);
2815
+ } catch (error) {
2816
+ return { ok: false, provider: config.provider, message: describeError(error) };
2817
+ }
2818
+ }
2819
+ return { ok: true, provider: config.provider, message: "Configuration valid", model: config.model };
2820
+ },
2821
+ async healthcheck(config) {
2822
+ const valid = this.validateConfig(config);
2823
+ if (!valid.ok) return valid;
2824
+ try {
2825
+ await request(config, "auth/key");
2826
+ return { ...valid, message: "OpenRouter connected" };
2827
+ } catch (error) {
2828
+ return { ok: false, provider: config.provider, message: describeError(error) };
2829
+ }
2830
+ },
2831
+ async listModels(config, signal) {
2832
+ const body = await request(config, "models", void 0, signal);
2833
+ if (!Array.isArray(body.data)) throw new Error("OpenRouter returned no model catalog");
2834
+ return body.data.flatMap((value) => {
2835
+ const model = asRecord(value);
2836
+ if (typeof model?.id !== "string" || !openRouterRouteModel(`openrouter:${model.id}`)) return [];
2837
+ if (model.id.endsWith(":batch")) return [];
2838
+ const architecture = asRecord(model.architecture);
2839
+ const output = architecture?.output_modalities;
2840
+ if (Array.isArray(output) && (!output.includes("text") || output.includes("image") || output.includes("audio"))) return [];
2841
+ return [{ id: model.id, displayName: typeof model.name === "string" ? model.name : model.id, tier: "standard", ...catalogMetadata(model) }];
2842
+ });
2843
+ },
2844
+ buildTrackedQueryRequest: buildRequest,
2845
+ parseTrackedQueryResponse: parseResponse2,
2846
+ async executeTrackedQuery(input, config) {
2847
+ const built = buildRequest(input, config);
2848
+ return parseResponse2(await request(config, "chat/completions", built.body), modelOf2(config), config.provider);
2849
+ },
2850
+ normalizeResult: normalize,
2851
+ async generateText(prompt, config) {
2852
+ const response = await request(config, "chat/completions", { model: modelOf2(config), messages: [{ role: "user", content: prompt }], provider: { allow_fallbacks: false }, stream: false });
2853
+ const content = messageOf(response)?.content;
2854
+ if (typeof content !== "string") throw new Error("OpenRouter returned no text");
2855
+ return content;
2856
+ }
2857
+ };
2858
+
2634
2859
  // src/stored-answer-anchors.ts
2635
2860
  function resolveStoredApiResponse(parsed) {
2636
2861
  const nested = parsed.apiResponse;
@@ -2681,6 +2906,7 @@ export {
2681
2906
  perplexityAdapter,
2682
2907
  reparseStoredResult5,
2683
2908
  museAdapter,
2909
+ openrouterAdapter,
2684
2910
  resolveStoredApiResponse,
2685
2911
  extractStoredAnswerAnchors
2686
2912
  };
@@ -2,11 +2,11 @@ import {
2
2
  dedupeGscSitemapUrls,
3
3
  resolveDiscoveredGscSitemapUrls,
4
4
  submitGscSitemapBatches
5
- } from "./chunk-EGIZNSDA.js";
5
+ } from "./chunk-J7VN3FZ3.js";
6
6
  import {
7
7
  measurementDraftOperationSchema,
8
8
  runMeasurementDraftAction
9
- } from "./chunk-LK2BG6EX.js";
9
+ } from "./chunk-D234NBWI.js";
10
10
  import {
11
11
  CliError
12
12
  } from "./chunk-HGMYEDAQ.js";
@@ -147,7 +147,7 @@ import {
147
147
  trafficSeriesGranularitySchema,
148
148
  visibilityCompareSelectionSchema,
149
149
  visibilityReportRequestSchema
150
- } from "./chunk-O4RMPA6H.js";
150
+ } from "./chunk-OMXWBR2R.js";
151
151
 
152
152
  // src/mcp/tool-registry.ts
153
153
  import { z as z2 } from "zod";
@@ -348,6 +348,8 @@ var measurementDraftActionOpenApiOperations = [
348
348
  "POST /api/v1/projects/{name}/measurement-plan/draft/actions/preview-assignments",
349
349
  "POST /api/v1/projects/{name}/measurement-plan/draft/actions/replace-assignments",
350
350
  "POST /api/v1/projects/{name}/measurement-plan/draft/actions/apply-paired-assignments",
351
+ "POST /api/v1/projects/{name}/measurement-plan/draft/actions/preview-route-markets",
352
+ "POST /api/v1/projects/{name}/measurement-plan/draft/actions/route-markets",
351
353
  "POST /api/v1/projects/{name}/measurement-plan/draft/actions/remove-assignment",
352
354
  "POST /api/v1/projects/{name}/measurement-plan/draft/actions/clear-assignments",
353
355
  "POST /api/v1/projects/{name}/measurement-plan/draft/actions/classify-assignments",
@@ -3118,7 +3120,7 @@ var rawCanonryMcpTools = [
3118
3120
  defineTool({
3119
3121
  name: "canonry_run_trigger",
3120
3122
  title: "Trigger run",
3121
- description: `Trigger an answer-visibility run for a Canonry project. Omit both scoping fields for a full sweep. Pass request.queries[] to measure only some of the project's tracked questions. On a project with a published measurement plan, pass request.measurementScope with at least one group or target to measure one slice of that plan \u2014 a group stands for its member Targets, and only the questions those Targets selected are measured. A scope naming nothing is rejected rather than treated as a full sweep, so omit the field entirely when you want everything. Either kind of slice is recorded as a spot check: it never replaces a full sweep in the dashboard, analytics or report. For verification scenarios (testing whether a provider migration worked, reproducing a regression, sanity-checking after a code change), set request.trigger='probe' \u2014 probe runs write a snapshot you can inspect via canonry_runs_get but are EXCLUDED from dashboard, analytics, intelligence, report, and notifications. Use 'probe' whenever you are testing on your own initiative rather than producing data the user/dashboard will consume. request.dispatchMode='batch' sends every provider that can (a full sweep of a published plan, a batch-capable provider enabled in config.yaml, every answer's model frozen) to its asynchronous batch API at the batch price; the rest run sync and the run stays running until the batch ends (up to its deadline, 24h by default). A batch request no provider can honour is refused with each provider's reason. Omit it for the ordinary sync sweep. A run is refused with PROVIDERS_FAILING when every provider it would call failed on its account (rejected key, denied access, no credit) in each of its last ${PROVIDER_ACCOUNT_FAILURE_STREAK} runs; details.providers names each provider's code and details.retryAfter when one run is let through again (${PROVIDER_ACCOUNT_RETRY_HOURS}h after the newest failure). Tell the user to fix the key, access or billing; saving a new key, model or endpoint in the provider's settings lets the next run through at once. A probe (request.trigger='probe') is never refused, and one that succeeds clears the refusal, so use a probe to check a fix. When only some providers keep failing that way, the run is queued without them: skippedProviders on the returned run names each with its code and retryAfter, and the run ends partial. Set request.force=true (call every provider) only when the user asks to run anyway.`,
3123
+ description: `Trigger an answer-visibility run for a Canonry project. request.providers accepts direct provider names and pinned OpenRouter model routes such as openrouter:google/gemini-2.5-flash. Multiple routes share the OpenRouter connection credentials and account limits, while preserving independent observations. The bare openrouter connection is not a sweep model. Omit both scoping fields for a full sweep. Pass request.queries[] to measure only some of the project's tracked questions. On a project with a published measurement plan, pass request.measurementScope with at least one group or target to measure one slice of that plan \u2014 a group stands for its member Targets, and only the questions those Targets selected are measured. A scope naming nothing is rejected rather than treated as a full sweep, so omit the field entirely when you want everything. Either kind of slice is recorded as a spot check: it never replaces a full sweep in the dashboard, analytics or report. For verification scenarios (testing whether a provider migration worked, reproducing a regression, sanity-checking after a code change), set request.trigger='probe' \u2014 probe runs write a snapshot you can inspect via canonry_runs_get but are EXCLUDED from dashboard, analytics, intelligence, report, and notifications. Use 'probe' whenever you are testing on your own initiative rather than producing data the user/dashboard will consume. request.dispatchMode='batch' sends every provider that can (a full sweep of a published plan, a batch-capable provider enabled in config.yaml, every answer's model frozen) to its asynchronous batch API at the batch price; the rest run sync and the run stays running until the batch ends (up to its deadline, 24h by default). A batch request no provider can honour is refused with each provider's reason. Omit it for the ordinary sync sweep. A run is refused with PROVIDERS_FAILING when every provider it would call failed on its account (rejected key, denied access, no credit) in each of its last ${PROVIDER_ACCOUNT_FAILURE_STREAK} runs; details.providers names each provider's code and details.retryAfter when one run is let through again (${PROVIDER_ACCOUNT_RETRY_HOURS}h after the newest failure). Tell the user to fix the key, access or billing; saving a new key, model or endpoint in the provider's settings lets the next run through at once. A probe (request.trigger='probe') is never refused, and one that succeeds clears the refusal, so use a probe to check a fix. When only some providers keep failing that way, the run is queued without them: skippedProviders on the returned run names each with its code and retryAfter, and the run ends partial. Set request.force=true (call every provider) only when the user asks to run anyway.`,
3122
3124
  access: "write",
3123
3125
  tier: "core",
3124
3126
  inputSchema: runTriggerInputSchema,
@@ -2,18 +2,18 @@ import {
2
2
  configExists,
3
3
  loadConfigRaw,
4
4
  saveConfigPatch
5
- } from "./chunk-OFL4PTYU.js";
5
+ } from "./chunk-BQKKAPMW.js";
6
6
  import {
7
7
  BUNDLED_SKILL_NAMES,
8
8
  installSkills
9
- } from "./chunk-TALC5DX5.js";
9
+ } from "./chunk-B37SDIGU.js";
10
10
  import {
11
11
  PACKAGE_VERSION
12
12
  } from "./chunk-AOJU5LKX.js";
13
13
  import {
14
14
  SKILL_MANIFEST_FILENAME,
15
15
  SkillsClients
16
- } from "./chunk-O4RMPA6H.js";
16
+ } from "./chunk-OMXWBR2R.js";
17
17
 
18
18
  // src/skills-autosync.ts
19
19
  import fs from "fs";