@canonry/canonry 7.120.0 → 7.120.2

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.
@@ -10,8 +10,8 @@ import {
10
10
  backfillSnapshotAttributionCommand,
11
11
  backfillTrafficClassificationCommand,
12
12
  replayQueryAuditLog
13
- } from "./chunk-7R6I6AIP.js";
14
- import "./chunk-GVU4QOUA.js";
13
+ } from "./chunk-FYL67YEU.js";
14
+ import "./chunk-R2CBQPN6.js";
15
15
  import "./chunk-GDRZPBPF.js";
16
16
  import "./chunk-IWQFTZ75.js";
17
17
  import "./chunk-AOD35IKL.js";
@@ -19,7 +19,7 @@ import "./chunk-AHVF5OE5.js";
19
19
  import {
20
20
  backfillProjectAnswerMentions,
21
21
  backfillProjectAnswerMentionsInChunks
22
- } from "./chunk-5QNFX55U.js";
22
+ } from "./chunk-VK6SYZAH.js";
23
23
  import "./chunk-3Q2D53KV.js";
24
24
  import "./chunk-TTQBEFSU.js";
25
25
  import "./chunk-VCXKSGZF.js";
@@ -5,7 +5,7 @@ import {
5
5
  isStoredPageReadTool,
6
6
  isStoredReadTool,
7
7
  truncateToolResult
8
- } from "./chunk-IPOERWGQ.js";
8
+ } from "./chunk-WLG476HL.js";
9
9
  import {
10
10
  CANONRY_MCP_TOOLKITS,
11
11
  resolveAeroSkillDir
@@ -8,7 +8,7 @@ import {
8
8
  reparseStoredResult4,
9
9
  reparseStoredResult5,
10
10
  resolveStoredApiResponse
11
- } from "./chunk-GVU4QOUA.js";
11
+ } from "./chunk-R2CBQPN6.js";
12
12
  import {
13
13
  loadConfig
14
14
  } from "./chunk-GDRZPBPF.js";
@@ -25,7 +25,7 @@ import {
25
25
  createRunCompetitorResolver,
26
26
  readMarketCompetitorNames,
27
27
  refreshSnapshotMentionIdentity
28
- } from "./chunk-5QNFX55U.js";
28
+ } from "./chunk-VK6SYZAH.js";
29
29
  import {
30
30
  RawEventSampleEventTypes,
31
31
  auditLog,
@@ -430,7 +430,7 @@ No DB writes performed. Re-run without --dry-run to apply.`);
430
430
  }
431
431
  }
432
432
  async function backfillInsightsCommand(project, opts) {
433
- const { IntelligenceService } = await import("./intelligence-service-PJAISWKW.js");
433
+ const { IntelligenceService } = await import("./intelligence-service-7S4ZFNB6.js");
434
434
  const config = loadConfig();
435
435
  const db = createClient(config.database);
436
436
  migrate(db);
@@ -24,7 +24,7 @@ import {
24
24
  resolveConfiguredAgentProvider,
25
25
  resolveSessionProviderAndModel,
26
26
  setAeroSystemPrompt
27
- } from "./chunk-UA7WWHPW.js";
27
+ } from "./chunk-6WG3PZUR.js";
28
28
  import {
29
29
  answerServiceAdapters,
30
30
  answerServiceDescriptors
@@ -38,7 +38,7 @@ import {
38
38
  buildAeroStateTools,
39
39
  isAeroToolProfile,
40
40
  truncateToolResult
41
- } from "./chunk-IPOERWGQ.js";
41
+ } from "./chunk-WLG476HL.js";
42
42
  import {
43
43
  getGoogleAuthConfig,
44
44
  getGoogleConnection,
@@ -69,7 +69,7 @@ import {
69
69
  openrouterAdapter,
70
70
  perplexityAdapter,
71
71
  startTrafficReclassification
72
- } from "./chunk-GVU4QOUA.js";
72
+ } from "./chunk-R2CBQPN6.js";
73
73
  import {
74
74
  classifyUsageSurface,
75
75
  createApiUsageTelemetry,
@@ -169,7 +169,7 @@ import {
169
169
  } from "./chunk-IWQFTZ75.js";
170
170
  import {
171
171
  IntelligenceService
172
- } from "./chunk-3QOFLP4W.js";
172
+ } from "./chunk-RDISN2CO.js";
173
173
  import {
174
174
  computeCitedCompetitorDomains,
175
175
  determineCitationState
@@ -270,6 +270,7 @@ import {
270
270
  installDuckdb,
271
271
  isBlockingCrawlIssue,
272
272
  isDuckdbInstalled,
273
+ isScopedRun,
273
274
  isValidReleaseId,
274
275
  latestQueryBasketRevision,
275
276
  listCachedReleases,
@@ -287,6 +288,7 @@ import {
287
288
  nextRunFromCron,
288
289
  nextRunFromSchedule,
289
290
  notProbeRun,
291
+ notScopedRun,
290
292
  parseBingDate,
291
293
  parseChatGptTokenKey,
292
294
  parseCookieHeader,
@@ -330,7 +332,7 @@ import {
330
332
  webhookTargetRefusalReason,
331
333
  webhookUserAgent,
332
334
  writeAuditLog
333
- } from "./chunk-5QNFX55U.js";
335
+ } from "./chunk-VK6SYZAH.js";
334
336
  import {
335
337
  OperationalLogStore,
336
338
  SentimentIdempotencyConflict,
@@ -6467,7 +6469,7 @@ function nonBlank(value) {
6467
6469
  return trimmed ? trimmed : void 0;
6468
6470
  }
6469
6471
  function resolveBuildCommit(env = process.env) {
6470
- const embedded = true ? "fd47c72cf0bcef18f8192c8530c723a592c2c4ab" : void 0;
6472
+ const embedded = true ? "c6eb863a77d21a9dfef1ef7b8c6825eae93b8f68" : void 0;
6471
6473
  return nonBlank(embedded) ?? nonBlank(env.CANONRY_COMMIT);
6472
6474
  }
6473
6475
  function resolveInstanceIdentity(env = process.env) {
@@ -16778,6 +16780,10 @@ var Notifier = class {
16778
16780
  const projectId = project.id;
16779
16781
  const thisRun = this.db.select().from(runs).where(eq29(runs.id, runId)).get();
16780
16782
  if (!thisRun) return none;
16783
+ if (isScopedRun(thisRun)) {
16784
+ log26.info("transitions.skipped-spot-check", { runId });
16785
+ return none;
16786
+ }
16781
16787
  const completeness = measurementRunCompleteness(this.db, runId);
16782
16788
  if (completeness.planned && !completeness.complete) {
16783
16789
  log26.info("transitions.skipped-incomplete", {
@@ -16818,7 +16824,10 @@ var Notifier = class {
16818
16824
  eq29(runs.projectId, projectId),
16819
16825
  eq29(runs.kind, thisRun.kind),
16820
16826
  or2(eq29(runs.status, "completed"), eq29(runs.status, "partial")),
16821
- notProbeRun()
16827
+ notProbeRun(),
16828
+ // The previous sweep, never a spot check between the two: diffed
16829
+ // against a 2-query check, every other query's change is lost.
16830
+ notScopedRun()
16822
16831
  )
16823
16832
  ).orderBy(desc10(runs.createdAt), desc10(runs.id)).limit(RECENT_FETCH_LIMIT).all();
16824
16833
  const groups = groupRunsByCreatedAt(recentRuns);
@@ -17248,6 +17257,15 @@ var RunCoordinator = class {
17248
17257
  log27.error("answers-recorded.failed", { runId, projectId, error: describeError(err) });
17249
17258
  }
17250
17259
  }
17260
+ if (kind === RunKinds["answer-visibility"] && runRow && isScopedRun(runRow)) {
17261
+ log27.info("spot-check.skip-derived", { runId, projectId });
17262
+ try {
17263
+ await this.notifier.onRunCompleted(runId, projectId);
17264
+ } catch (err) {
17265
+ log27.error("notifier.failed", { runId, error: describeError(err) });
17266
+ }
17267
+ return;
17268
+ }
17251
17269
  const completeness = measurementRunCompleteness(this.db, runId);
17252
17270
  if (completeness.planned && !completeness.complete) {
17253
17271
  log27.info("measurement.incomplete-skip-derived", {
@@ -47,7 +47,7 @@ function queueServeHandoff() {
47
47
  async function runPendingServeHandoff(format) {
48
48
  if (!pendingServeHandoff) return;
49
49
  pendingServeHandoff = false;
50
- const { serveCommand } = await import("./serve-75GKRGUK.js");
50
+ const { serveCommand } = await import("./serve-GLPKVWZE.js");
51
51
  await serveCommand(format);
52
52
  }
53
53
 
@@ -783,7 +783,7 @@ var DEMO_CLI_COMMANDS = [{
783
783
  options: { host: stringOption(), port: stringOption(), "trust-proxy": multiStringOption() },
784
784
  allowPositionals: false,
785
785
  run: async (input) => {
786
- const { demoCommand } = await import("./demo-2P37KIQK.js");
786
+ const { demoCommand } = await import("./demo-JGVDDJYC.js");
787
787
  await demoCommand({
788
788
  host: getString(input.values, "host"),
789
789
  port: getString(input.values, "port"),
@@ -804,7 +804,7 @@ var BACKFILL_CLI_COMMANDS = [
804
804
  allowPositionals: false,
805
805
  supportsDryRun: true,
806
806
  run: async (input) => {
807
- const { backfillAnswerVisibilityCommand } = await import("./backfill-XBQYJBCL.js");
807
+ const { backfillAnswerVisibilityCommand } = await import("./backfill-AE23XODQ.js");
808
808
  await backfillAnswerVisibilityCommand({
809
809
  project: getString(input.values, "project"),
810
810
  dryRun: input.dryRun,
@@ -821,7 +821,7 @@ var BACKFILL_CLI_COMMANDS = [
821
821
  allowPositionals: false,
822
822
  supportsDryRun: true,
823
823
  run: async (input) => {
824
- const { backfillAnswerMentionsCommand } = await import("./backfill-XBQYJBCL.js");
824
+ const { backfillAnswerMentionsCommand } = await import("./backfill-AE23XODQ.js");
825
825
  await backfillAnswerMentionsCommand({
826
826
  project: getString(input.values, "project"),
827
827
  dryRun: input.dryRun,
@@ -839,7 +839,7 @@ var BACKFILL_CLI_COMMANDS = [
839
839
  },
840
840
  supportsDryRun: true,
841
841
  run: async (input) => {
842
- const { backfillInsightsCommand } = await import("./backfill-XBQYJBCL.js");
842
+ const { backfillInsightsCommand } = await import("./backfill-AE23XODQ.js");
843
843
  const usage = "canonry backfill insights <project> [--from-run <id>] [--to-run <id>] [--since <date>] [--dry-run] [--format json]";
844
844
  const project3 = requireProject(input, "backfill insights", usage);
845
845
  await backfillInsightsCommand(project3, {
@@ -859,7 +859,7 @@ var BACKFILL_CLI_COMMANDS = [
859
859
  },
860
860
  allowPositionals: false,
861
861
  run: async (input) => {
862
- const { backfillNormalizedPathsCommand } = await import("./backfill-XBQYJBCL.js");
862
+ const { backfillNormalizedPathsCommand } = await import("./backfill-AE23XODQ.js");
863
863
  await backfillNormalizedPathsCommand({
864
864
  project: getString(input.values, "project"),
865
865
  format: input.format
@@ -874,7 +874,7 @@ var BACKFILL_CLI_COMMANDS = [
874
874
  },
875
875
  allowPositionals: false,
876
876
  run: async (input) => {
877
- const { backfillAiReferralPathsCommand } = await import("./backfill-XBQYJBCL.js");
877
+ const { backfillAiReferralPathsCommand } = await import("./backfill-AE23XODQ.js");
878
878
  await backfillAiReferralPathsCommand({
879
879
  project: getString(input.values, "project"),
880
880
  format: input.format
@@ -886,7 +886,7 @@ var BACKFILL_CLI_COMMANDS = [
886
886
  usage: "canonry backfill snapshot-attribution <project> [--dry-run] [--format json]",
887
887
  supportsDryRun: true,
888
888
  run: async (input) => {
889
- const { backfillSnapshotAttributionCommand } = await import("./backfill-XBQYJBCL.js");
889
+ const { backfillSnapshotAttributionCommand } = await import("./backfill-AE23XODQ.js");
890
890
  const usage = "canonry backfill snapshot-attribution <project> [--dry-run] [--format json]";
891
891
  const project3 = requireProject(input, "backfill snapshot-attribution", usage);
892
892
  await backfillSnapshotAttributionCommand({
@@ -905,7 +905,7 @@ var BACKFILL_CLI_COMMANDS = [
905
905
  allowPositionals: false,
906
906
  supportsDryRun: true,
907
907
  run: async (input) => {
908
- const { backfillTrafficClassificationCommand } = await import("./backfill-XBQYJBCL.js");
908
+ const { backfillTrafficClassificationCommand } = await import("./backfill-AE23XODQ.js");
909
909
  await backfillTrafficClassificationCommand({
910
910
  project: getString(input.values, "project"),
911
911
  dryRun: input.dryRun,
@@ -1551,7 +1551,7 @@ var DASHBOARD_CLI_COMMANDS = [
1551
1551
  usage: "canonry dashboard reset-password [--format json]",
1552
1552
  help: "Clears the dashboard password from config.yaml, so the dashboard asks for a new one after a restart.\nLocal only: it edits the config file under CANONRY_CONFIG_DIR and does not call the server.",
1553
1553
  run: async (input) => {
1554
- const { resetDashboardPassword } = await import("./dashboard-IWBIZR3V.js");
1554
+ const { resetDashboardPassword } = await import("./dashboard-7I6A2XHW.js");
1555
1555
  await resetDashboardPassword({ format: input.format });
1556
1556
  }
1557
1557
  },
@@ -7390,7 +7390,7 @@ var SYSTEM_CLI_COMMANDS = [
7390
7390
  options: { access: stringOption() },
7391
7391
  run: async (input) => {
7392
7392
  if (input.positionals.length > 1) throw usageError("Expected at most one command group");
7393
- const [{ printCliCatalog }, { REGISTERED_CLI_COMMANDS: REGISTERED_CLI_COMMANDS2 }] = await Promise.all([import("./cli-catalog-4ZCK2TFK.js"), import("./cli-commands-6UBZGWKR.js")]);
7393
+ const [{ printCliCatalog }, { REGISTERED_CLI_COMMANDS: REGISTERED_CLI_COMMANDS2 }] = await Promise.all([import("./cli-catalog-4ZCK2TFK.js"), import("./cli-commands-Z7Q5HLBB.js")]);
7394
7394
  printCliCatalog(REGISTERED_CLI_COMMANDS2, input.format, input.positionals[0], getString(input.values, "access"));
7395
7395
  }
7396
7396
  },
@@ -7439,7 +7439,7 @@ var SYSTEM_CLI_COMMANDS = [
7439
7439
  },
7440
7440
  allowPositionals: false,
7441
7441
  run: async (input) => {
7442
- const { initCommand } = await import("./init-C2R2UJCE.js");
7442
+ const { initCommand } = await import("./init-BK6GYDZP.js");
7443
7443
  await initCommand({
7444
7444
  force: getBoolean(input.values, "force"),
7445
7445
  ref: getString(input.values, "ref"),
@@ -7495,7 +7495,7 @@ var SYSTEM_CLI_COMMANDS = [
7495
7495
  allowPositionals: false,
7496
7496
  run: async (input) => {
7497
7497
  applyServerEnv(input.values);
7498
- const { serveCommand } = await import("./serve-75GKRGUK.js");
7498
+ const { serveCommand } = await import("./serve-GLPKVWZE.js");
7499
7499
  await serveCommand(input.format);
7500
7500
  }
7501
7501
  },
@@ -8871,8 +8871,8 @@ var AGENT_CLI_COMMANDS = [
8871
8871
  "timeout-ms": stringOption()
8872
8872
  },
8873
8873
  run: async (input) => {
8874
- const { coerceAgentProvider } = await import("./session-GVLHMMVC.js");
8875
- const { AERO_TOOL_PROFILES, isAeroToolProfile } = await import("./tools-LAIZGKA3.js");
8874
+ const { coerceAgentProvider } = await import("./session-RJ5AYV6Q.js");
8875
+ const { AERO_TOOL_PROFILES, isAeroToolProfile } = await import("./tools-BCDSJTKK.js");
8876
8876
  const { agentAsk } = await import("./agent-ask-VAZUSWFA.js");
8877
8877
  const usage = `canonry agent ask <project> "<prompt>" [--provider ${AGENT_PROVIDER_IDS.join("|")}] [--model <id>] [--scope all|read-only] [--profile default|ads-operator] [--context <json>] [--conversation <id>] [--max-tool-calls <n>] [--timeout-ms <ms>] [--format json]`;
8878
8878
  const project3 = requireProject(input, "agent.ask", usage);
@@ -7,7 +7,7 @@ import {
7
7
  mergeSplitJourneyVisitors,
8
8
  repairAiReferralArrivalsOnStartup,
9
9
  writeUnrecognizedAgentBuckets
10
- } from "./chunk-5QNFX55U.js";
10
+ } from "./chunk-VK6SYZAH.js";
11
11
  import {
12
12
  AGENT_TRUST_RULES_VERSION,
13
13
  BROWSER_AGENT_BOT_IDS,
@@ -15,9 +15,10 @@ import {
15
15
  compileCompetitiveSignalResolver,
16
16
  extractPlaceAmenities,
17
17
  mergeGscQueryTotalsWithFallback,
18
+ notScopedRun,
18
19
  readGscQueryDailyRows,
19
20
  readLatestGscDataDate
20
- } from "./chunk-5QNFX55U.js";
21
+ } from "./chunk-VK6SYZAH.js";
21
22
  import {
22
23
  competitors,
23
24
  gbpDailyMetrics,
@@ -62,7 +63,12 @@ function analyzableRunPredicates(projectId) {
62
63
  // Defensive: RunCoordinator already skips probes before analyzeAndPersist
63
64
  // is called, but a future call site invoking it directly for a probe must
64
65
  // still not pollute the intelligence window.
65
- ne(runs.trigger, RunTriggers.probe)
66
+ ne(runs.trigger, RunTriggers.probe),
67
+ // A spot check measured a few queries on purpose. Analyzed, it writes
68
+ // insights and a health row about its slice; as a baseline it hides every
69
+ // other query's change from the next sweep; as a history entry it adds a
70
+ // run to the streaks of the queries it asked.
71
+ notScopedRun()
66
72
  ];
67
73
  }
68
74
  function readStoredGroundingSources(rawResponse) {
@@ -658,8 +664,9 @@ var IntelligenceService = class {
658
664
  eq(runs.projectId, projectId),
659
665
  eq(runs.kind, RunKinds["answer-visibility"]),
660
666
  or(eq(runs.status, "completed"), eq(runs.status, "partial")),
661
- // Defensive — see top of file.
662
- ne(runs.trigger, RunTriggers.probe)
667
+ // Defensive — see top of file. A spot check is not a sweep either.
668
+ ne(runs.trigger, RunTriggers.probe),
669
+ notScopedRun()
663
670
  )
664
671
  ).orderBy(desc(runs.createdAt), desc(runs.id)).limit((RECURRENCE_LOOKBACK_RUNS + 1) * ROWS_PER_GROUP_BUDGET).all();
665
672
  const recentGroups = groupRunsByCreatedAt(recentRunRows);