@canonry/canonry 6.3.0 → 7.0.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 (42) hide show
  1. package/README.md +3 -3
  2. package/assets/agent-workspace/skills/aero/SKILL.md +2 -2
  3. package/assets/agent-workspace/skills/aero/references/reporting.md +26 -23
  4. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +52 -21
  5. package/assets/agent-workspace/skills/canonry/references/server-side-traffic.md +17 -6
  6. package/assets/assets/{AuditHistoryPanel-BUYWIjlG.js → AuditHistoryPanel-DBYsgVsn.js} +1 -1
  7. package/assets/assets/{BacklinksPage-aBcxpN_9.js → BacklinksPage-HIM0fmV7.js} +1 -1
  8. package/assets/assets/ChartPrimitives-CYlrwLJs.js +1 -0
  9. package/assets/assets/{HistoryPage-PoBuxiY_.js → HistoryPage-BjEVp-fk.js} +1 -1
  10. package/assets/assets/MeasurementPropertyPage-BnVDR2y_.js +1 -0
  11. package/assets/assets/ProjectPage-BhCM47KA.js +8 -0
  12. package/assets/assets/{RunsPage-CHHxOpzo.js → RunsPage-fJQe2qJc.js} +1 -1
  13. package/assets/assets/{SettingsPage-CNKnrLXC.js → SettingsPage-1yam5tl6.js} +1 -1
  14. package/assets/assets/{SiteHealthSection-C9RivT7G.js → SiteHealthSection-DysU2M6C.js} +3 -3
  15. package/assets/assets/{TrafficPage-CY-ibXnb.js → TrafficPage-BdNEscz8.js} +2 -2
  16. package/assets/assets/{TrafficSourceDetailPage-BgiPXubs.js → TrafficSourceDetailPage-CMEgr4Aw.js} +1 -1
  17. package/assets/assets/{extract-error-message-H1dzzfBP.js → extract-error-message-D2dhaJaW.js} +1 -1
  18. package/assets/assets/index-CgT2Btdn.css +1 -0
  19. package/assets/assets/index-D9ODLKpH.js +86 -0
  20. package/assets/assets/{react-sigma_core.esm.min-uiYtR_DU.js → react-sigma_core.esm.min-oP23IWpt.js} +1 -1
  21. package/assets/assets/v2-overview-adapter-DYatWs7N.js +1 -0
  22. package/assets/assets/{vendor-recharts-llkUFBGR.js → vendor-recharts-D-cUuLZo.js} +1 -1
  23. package/assets/index.html +3 -3
  24. package/dist/{chunk-OTROA7CN.js → chunk-A5PALGQD.js} +55 -22
  25. package/dist/{chunk-QVGG76UW.js → chunk-EZ54X4XH.js} +4386 -8275
  26. package/dist/{chunk-ZZEPF3A5.js → chunk-HQJ25LI7.js} +83 -19
  27. package/dist/{chunk-5GY5WBAF.js → chunk-LXWY4NKP.js} +3 -3
  28. package/dist/{chunk-EV5G5QRR.js → chunk-OOUDIVIU.js} +1224 -3003
  29. package/dist/{chunk-FSRVG2H7.js → chunk-RRIZ5AKI.js} +2 -2
  30. package/dist/{chunk-DERWXLHX.js → chunk-TUHQ5BBQ.js} +65 -16
  31. package/dist/cli.js +240 -178
  32. package/dist/{demo-server-5MNLI6GC.js → demo-server-LHHDVXQW.js} +5 -14
  33. package/dist/index.js +6 -6
  34. package/dist/{intelligence-service-5J36RBEM.js → intelligence-service-ZVKZLLKL.js} +2 -2
  35. package/dist/mcp.js +4 -4
  36. package/package.json +12 -12
  37. package/assets/assets/ChartPrimitives-B5okB5g-.js +0 -1
  38. package/assets/assets/MeasurementPropertyPage-DyjyqHac.js +0 -1
  39. package/assets/assets/ProjectPage-Mmv5YW-K.js +0 -8
  40. package/assets/assets/index-C17E5ZcA.css +0 -1
  41. package/assets/assets/index-DSCun3I9.js +0 -86
  42. package/assets/assets/v2-overview-adapter-BQokN2eb.js +0 -1
package/assets/index.html CHANGED
@@ -12,14 +12,14 @@
12
12
  <link rel="icon" type="image/png" sizes="32x32" href="./favicon-32.png" />
13
13
  <link rel="apple-touch-icon" href="./apple-touch-icon.png" />
14
14
  <title>Canonry</title>
15
- <script type="module" crossorigin src="./assets/index-DSCun3I9.js"></script>
15
+ <script type="module" crossorigin src="./assets/index-D9ODLKpH.js"></script>
16
16
  <link rel="modulepreload" crossorigin href="./assets/vendor-tanstack-ZXXkndVj.js">
17
17
  <link rel="modulepreload" crossorigin href="./assets/vendor-radix-twS1M3FF.js">
18
- <link rel="modulepreload" crossorigin href="./assets/vendor-recharts-llkUFBGR.js">
18
+ <link rel="modulepreload" crossorigin href="./assets/vendor-recharts-D-cUuLZo.js">
19
19
  <link rel="modulepreload" crossorigin href="./assets/vendor-lucide-N6vOpZmh.js">
20
20
  <link rel="modulepreload" crossorigin href="./assets/vendor-markdown-B4giJcws.js">
21
21
  <link rel="modulepreload" crossorigin href="./assets/vendor-yaml-GWJz5H2G.js">
22
- <link rel="stylesheet" crossorigin href="./assets/index-C17E5ZcA.css">
22
+ <link rel="stylesheet" crossorigin href="./assets/index-CgT2Btdn.css">
23
23
  </head>
24
24
  <body>
25
25
  <div id="root"></div>
@@ -19,21 +19,21 @@ import {
19
19
  runWithUsageTags,
20
20
  saveConfigPatch,
21
21
  sentimentInstallReadiness
22
- } from "./chunk-ZZEPF3A5.js";
22
+ } from "./chunk-HQJ25LI7.js";
23
23
  import {
24
24
  computeFactorAverages,
25
25
  deleteSiteCrawlGraphLayout,
26
26
  persistSiteCrawlGraphLayout,
27
27
  prepareSiteCrawlGraphLayout,
28
28
  recordedSharePct
29
- } from "./chunk-FSRVG2H7.js";
29
+ } from "./chunk-RRIZ5AKI.js";
30
30
  import {
31
31
  CanonryMcpToolNames,
32
32
  CliError,
33
33
  PACKAGE_VERSION,
34
34
  canonryMcpTools,
35
35
  isMachineFormat
36
- } from "./chunk-DERWXLHX.js";
36
+ } from "./chunk-TUHQ5BBQ.js";
37
37
  import {
38
38
  CC_CACHE_DIR,
39
39
  DUCKDB_SPEC,
@@ -214,7 +214,7 @@ import {
214
214
  siteLivenessState,
215
215
  toAlertView,
216
216
  usageCounters
217
- } from "./chunk-QVGG76UW.js";
217
+ } from "./chunk-EZ54X4XH.js";
218
218
  import {
219
219
  AGENT_MEMORY_VALUE_MAX_BYTES,
220
220
  AGENT_NONE,
@@ -330,6 +330,7 @@ import {
330
330
  effectiveBrandNames,
331
331
  effectiveDomains,
332
332
  embedClientConfigForRequest,
333
+ embedProjectTabsError,
333
334
  extractProviderHttpStatus,
334
335
  factorStatusFromScore,
335
336
  filterCapturedCitedUrls,
@@ -420,7 +421,7 @@ import {
420
421
  visibilityReportRequestSchema,
421
422
  winnabilityClassLabel,
422
423
  withRetry
423
- } from "./chunk-EV5G5QRR.js";
424
+ } from "./chunk-OOUDIVIU.js";
424
425
 
425
426
  // src/runtime-context.ts
426
427
  function cliRuntimeContext(env = process.env, stdio = process) {
@@ -3941,14 +3942,17 @@ var SentimentWorker = class {
3941
3942
  this.reconcile();
3942
3943
  const gate = this.repository.dispatchGate({ now: this.now(), credentialFingerprint: credentialFingerprint(config.apiKey) });
3943
3944
  if (gate === "closed") return 0;
3945
+ const used = this.repository.recentDispatch(this.now());
3946
+ if (used.tokens >= config.maxInputTokensPerMinute) return 0;
3947
+ const allowed = Math.min(gate === "probe" ? 1 : config.maxConcurrency, config.maxRequestsPerMinute - used.requests);
3944
3948
  const claims = [];
3945
- for (let index = 0; index < (gate === "probe" ? 1 : config.maxConcurrency); index++) {
3949
+ for (let index = 0; index < allowed; index++) {
3946
3950
  const claim = this.repository.claim({ owner: randomUUID(), now: this.now(), leaseMs: 12e4, maxConcurrent: config.maxConcurrency });
3947
3951
  if (!claim) break;
3948
3952
  claims.push(claim);
3949
3953
  }
3950
- await Promise.all(claims.map((work) => this.execute(work)));
3951
- return claims.length;
3954
+ const outcomes = await Promise.all(claims.map((work) => this.execute(work)));
3955
+ return outcomes.filter((outcome) => outcome !== "released").length;
3952
3956
  }
3953
3957
  async execute(work) {
3954
3958
  const owner = work.leaseOwner;
@@ -3990,6 +3994,11 @@ var SentimentWorker = class {
3990
3994
  }
3991
3995
  const attempt = this.repository.startAttempt({ workItemId: work.id, owner, requestedModel: input.definition.requestedModel, now: this.now(), estimatedInputTokens: estimate, maxRequestsPerMinute: config.maxRequestsPerMinute, maxAttempts: config.maxAttempts, maxInputTokensPerMinute: config.maxInputTokensPerMinute });
3992
3996
  if (!attempt) {
3997
+ const used = this.repository.recentDispatch(this.now());
3998
+ if (used.requests >= config.maxRequestsPerMinute || used.tokens + estimate > config.maxInputTokensPerMinute) {
3999
+ this.repository.releaseWork({ workItemId: work.id, owner, now: this.now() });
4000
+ return "released";
4001
+ }
3993
4002
  this.repository.failWork({ workItemId: work.id, owner, now: this.now(), errorCode: "RATE_LIMIT_WAIT", retryAt: new Date(Date.parse(this.now()) + 6e4).toISOString() });
3994
4003
  return;
3995
4004
  }
@@ -4030,6 +4039,28 @@ var SentimentWorker = class {
4030
4039
  }
4031
4040
  }
4032
4041
  };
4042
+ function createSentimentPoller(tick, onError, schedule = setImmediate) {
4043
+ let inFlight2 = null;
4044
+ let stopped = false;
4045
+ const poll = () => {
4046
+ if (inFlight2 || stopped) return;
4047
+ inFlight2 = tick().catch(() => {
4048
+ onError();
4049
+ return 0;
4050
+ }).then((claimed) => {
4051
+ inFlight2 = null;
4052
+ if (claimed > 0 && !stopped) schedule(poll);
4053
+ });
4054
+ };
4055
+ return {
4056
+ poll,
4057
+ /** The tick in flight, if any. */
4058
+ settled: () => inFlight2,
4059
+ stop: () => {
4060
+ stopped = true;
4061
+ }
4062
+ };
4063
+ }
4033
4064
 
4034
4065
  // src/sentiment-config.ts
4035
4066
  import fs2 from "fs";
@@ -7392,7 +7423,7 @@ var museAdapter = {
7392
7423
 
7393
7424
  // src/embed.ts
7394
7425
  var DEFAULT_EMBED_PROJECT_TABS = ["overview"];
7395
- var SERVER_ENFORCED_EMBED_PROJECT_TABS = ["overview", "technical-aeo", "report"];
7426
+ var SERVER_ENFORCED_EMBED_PROJECT_TABS = ["overview", "technical-aeo"];
7396
7427
  function unsupportedEmbedProjectTabs(projectTabs) {
7397
7428
  if (!projectTabs) return [];
7398
7429
  const supported = new Set(SERVER_ENFORCED_EMBED_PROJECT_TABS);
@@ -7407,6 +7438,8 @@ function resolveEmbedConfig(env, config) {
7407
7438
  const views = normalizeIdTokens(rawViews);
7408
7439
  const rawProjectTabs = env.CANONRY_EMBED_PROJECT_TABS !== void 0 ? splitList(env.CANONRY_EMBED_PROJECT_TABS) : splitList(embed?.projectTabs);
7409
7440
  const projectTabs = normalizeIdTokens(rawProjectTabs) ?? (enabled ? DEFAULT_EMBED_PROJECT_TABS : void 0);
7441
+ const projectTabsError = enabled ? embedProjectTabsError(projectTabs) : void 0;
7442
+ if (projectTabsError) throw new Error(projectTabsError);
7410
7443
  return {
7411
7444
  enabled,
7412
7445
  allowedOrigins,
@@ -7952,7 +7985,7 @@ function nonBlank(value) {
7952
7985
  return trimmed ? trimmed : void 0;
7953
7986
  }
7954
7987
  function resolveBuildCommit(env = process.env) {
7955
- const embedded = true ? "a0351a3c7ac5eb8e0e4028ee004ddd5a12874575" : void 0;
7988
+ const embedded = true ? "49491274532e363f77adf0d73eccaac7a5359a4c" : void 0;
7956
7989
  return nonBlank(embedded) ?? nonBlank(env.CANONRY_COMMIT);
7957
7990
  }
7958
7991
  function resolveInstanceIdentity(env = process.env) {
@@ -14765,7 +14798,7 @@ function readStoredGroundingSources(rawResponse) {
14765
14798
  return result2;
14766
14799
  }
14767
14800
  async function backfillInsightsCommand(project, opts) {
14768
- const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-5J36RBEM.js");
14801
+ const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-ZVKZLLKL.js");
14769
14802
  const config = loadConfig();
14770
14803
  const db = createClient(config.database);
14771
14804
  migrate(db);
@@ -22167,6 +22200,7 @@ function createGoogleMarketingConfigCredentialStore(input) {
22167
22200
  };
22168
22201
  }
22169
22202
  async function createServer(opts) {
22203
+ const embed = resolveEmbedConfig(process.env, opts.config);
22170
22204
  const operatorApiKeyIds = resolveOperatorApiKeyIds(process.env);
22171
22205
  const dashboardManagedRunKinds = resolveDashboardManagedRunKinds(process.env, opts.config);
22172
22206
  const operationalLogs = new OperationalLogStore(opts.db, {
@@ -22995,7 +23029,6 @@ async function createServer(opts) {
22995
23029
  const rawBasePath = process.env.CANONRY_BASE_PATH ?? opts.config.basePath;
22996
23030
  const normalizedBasePath = rawBasePath ? "/" + rawBasePath.replace(/^\//, "").replace(/\/?$/, "/") : void 0;
22997
23031
  const basePath = normalizedBasePath === "/" ? void 0 : normalizedBasePath;
22998
- const embed = resolveEmbedConfig(process.env, opts.config);
22999
23032
  const embedCsp = embed.enabled ? frameAncestorsHeaderValue(embed.allowedOrigins) : void 0;
23000
23033
  const unsupportedProjectTabs = unsupportedEmbedProjectTabs(embed.projectTabs);
23001
23034
  if (embed.enabled && unsupportedProjectTabs.length > 0) {
@@ -23277,16 +23310,13 @@ async function createServer(opts) {
23277
23310
  return built.ok ? { ok: true, estimatedInputTokens: built.estimate.inputTokens } : built;
23278
23311
  }
23279
23312
  });
23280
- let sentimentTick = null;
23281
- const pollSentiment = () => {
23282
- if (sentimentTick) return;
23283
- sentimentTick = sentimentWorker.tick().catch(() => {
23313
+ const sentimentPoller = createSentimentPoller(
23314
+ () => sentimentWorker.tick(),
23315
+ () => {
23284
23316
  log24.error("sentiment.worker-failed", { reason: "Stored sentiment worker could not finish its tick." });
23285
- return 0;
23286
- }).finally(() => {
23287
- sentimentTick = null;
23288
- });
23289
- };
23317
+ }
23318
+ );
23319
+ const pollSentiment = sentimentPoller.poll;
23290
23320
  let sentimentTimer;
23291
23321
  runCoordinator.onSentimentCompleted = async () => {
23292
23322
  pollSentiment();
@@ -23298,7 +23328,8 @@ async function createServer(opts) {
23298
23328
  });
23299
23329
  app.addHook("onClose", async () => {
23300
23330
  clearInterval(sentimentTimer);
23301
- await sentimentTick;
23331
+ sentimentPoller.stop();
23332
+ await sentimentPoller.settled();
23302
23333
  });
23303
23334
  const providerModelCatalog = createProviderModelCatalog(registry);
23304
23335
  await app.register(apiRoutes, {
@@ -23989,6 +24020,8 @@ async function createServer(opts) {
23989
24020
  }
23990
24021
  if (embed.enabled) {
23991
24022
  const embedClient = embedClientConfigForRequest(embed, projectTabsOverride, themeOverride, renderTokenOverride);
24023
+ const projectTabsError = embedProjectTabsError(embedClient?.projectTabs);
24024
+ if (projectTabsError) throw validationError(projectTabsError);
23992
24025
  if (embedClient) clientConfig.embed = embedClient;
23993
24026
  }
23994
24027
  const configScript = `<script>window.__CANONRY_CONFIG__=${serializeForInlineScript(clientConfig)}</script>`;