@canonry/canonry 7.51.6 → 7.52.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 (129) hide show
  1. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +8 -0
  2. package/assets/assets/{AccessControls-B5TqDgeq.js → AccessControls-CteIuEGI.js} +1 -1
  3. package/assets/assets/{AuditHistoryPanel-DgxiizOW.js → AuditHistoryPanel-DqJGiLsf.js} +1 -1
  4. package/assets/assets/{BacklinksPage-Ay6pdphx.js → BacklinksPage-DotWEPQt.js} +1 -1
  5. package/assets/assets/{HistoryPage-B11eFH21.js → HistoryPage-aOd198dT.js} +1 -1
  6. package/assets/assets/MeasurementPropertyPage-CuaKVK8x.js +4 -0
  7. package/assets/assets/{ProjectPage-DoY0hftd.js → ProjectPage-O9oufMgi.js} +4 -4
  8. package/assets/assets/{RunsPage-BPBmuQAS.js → RunsPage-DIXMrc-N.js} +1 -1
  9. package/assets/assets/{SettingsPage-ClKnP8xy.js → SettingsPage-BuGb6AGa.js} +1 -1
  10. package/assets/assets/SiteHealthSection-CweaKjCo.js +2 -0
  11. package/assets/assets/TrafficPage-B7MaQalp.js +40 -0
  12. package/assets/assets/{TrafficSourceDetailPage-DQu0YNt2.js → TrafficSourceDetailPage-BPtjnF9s.js} +1 -1
  13. package/assets/assets/{card-DYMyvhB9.js → card-DoV-8Txo.js} +1 -1
  14. package/assets/assets/{extract-error-message-BRM1I_3L.js → extract-error-message-DKQJJlZ-.js} +1 -1
  15. package/assets/assets/{format-helpers-DrkFERj3.js → format-helpers-BWnMmkiO.js} +1 -1
  16. package/assets/assets/index-Z63c4PeO.js +39 -0
  17. package/assets/assets/{query-client-gRFnU4VF.js → query-client-vB35tVTz.js} +1 -1
  18. package/assets/assets/{react-query-lH82FULK.js → react-query-BI0567qs.js} +1 -1
  19. package/assets/assets/{react-sigma_core.esm.min-D09H4byP.js → react-sigma_core.esm.min-hGyOC4V_.js} +1 -1
  20. package/assets/assets/{service-Cx0HSnE9.js → service-c4YvpVKX.js} +1 -1
  21. package/assets/index.html +6 -6
  22. package/dist/{ads-ABAT3K4K.js → ads-MREK2AGL.js} +3 -3
  23. package/dist/{agent-5G4DRLYX.js → agent-4RUZ3MC4.js} +7 -7
  24. package/dist/{agent-ask-UDVCZRO7.js → agent-ask-YLTYBEYH.js} +3 -3
  25. package/dist/{agent-conversations-5E4JP2QZ.js → agent-conversations-QA6IKDGR.js} +3 -3
  26. package/dist/{agent-memory-7IIJ4HGZ.js → agent-memory-MEQAJOB3.js} +3 -3
  27. package/dist/{agent-providers-BOXPUXZ4.js → agent-providers-AXYPDJHL.js} +3 -3
  28. package/dist/{agent-transcript-4O56G6PQ.js → agent-transcript-SMNQNYCD.js} +3 -3
  29. package/dist/{analytics-PKMWX5XL.js → analytics-4OR64IGV.js} +3 -3
  30. package/dist/{apply-OK4XEBDA.js → apply-CQXCFXAH.js} +3 -3
  31. package/dist/{backfill-2OT56CX2.js → backfill-TMXCNVOB.js} +9 -9
  32. package/dist/{backlinks-547WCHND.js → backlinks-6KFAQGYV.js} +3 -3
  33. package/dist/{bing-ZVBV4ZD5.js → bing-HFCACTAC.js} +3 -3
  34. package/dist/{bootstrap-HUB7XQ73.js → bootstrap-SQVQXOJC.js} +9 -9
  35. package/dist/{cdp-KQKQ4PWJ.js → cdp-IACL7EXU.js} +7 -7
  36. package/dist/{chunk-U3AHE2RT.js → chunk-5N6245R7.js} +4 -4
  37. package/dist/{chunk-KFT5LOP2.js → chunk-6BPZHNDC.js} +10 -3
  38. package/dist/{chunk-RKIXES2B.js → chunk-7244X3K6.js} +2 -2
  39. package/dist/{chunk-WDFI5YMD.js → chunk-7XE2IRBG.js} +1 -1
  40. package/dist/{chunk-WAULJDKO.js → chunk-AWCWIQAU.js} +2 -2
  41. package/dist/{chunk-7WZ2FPB4.js → chunk-BBOHY2DQ.js} +1 -1
  42. package/dist/{chunk-VBCE4CLX.js → chunk-BU3VAG5J.js} +3 -3
  43. package/dist/{chunk-73P65KPW.js → chunk-BYOK6Z4F.js} +2 -2
  44. package/dist/{chunk-I77PLCWG.js → chunk-DSNSD5J3.js} +21 -11
  45. package/dist/{chunk-HM4NNKLG.js → chunk-EGIZNSDA.js} +1 -1
  46. package/dist/{chunk-MMEO22MF.js → chunk-FC4XND45.js} +1 -1
  47. package/dist/{chunk-I3A56PFP.js → chunk-GNKOBKPW.js} +4 -4
  48. package/dist/{chunk-2G6IP3MO.js → chunk-HEGXGCGL.js} +11 -4
  49. package/dist/{chunk-ISOQPVPY.js → chunk-I6KNMZ77.js} +4 -4
  50. package/dist/{chunk-TUTKNUMV.js → chunk-IIOEAJTV.js} +3 -3
  51. package/dist/{chunk-42D2LE2B.js → chunk-ILDT4LPB.js} +5 -5
  52. package/dist/{chunk-QWKPSFGL.js → chunk-JY3RLZGB.js} +1 -1
  53. package/dist/{chunk-6G6FTDWC.js → chunk-K5I45PZI.js} +25 -21
  54. package/dist/{chunk-GO2J7SYT.js → chunk-KXAOMTXN.js} +5 -5
  55. package/dist/{chunk-HACZUMGM.js → chunk-LK2BG6EX.js} +1 -1
  56. package/dist/{chunk-ZXUAWVWM.js → chunk-MJNUSPO4.js} +2 -2
  57. package/dist/{chunk-63ISSSGX.js → chunk-MKAC7HKH.js} +30 -2
  58. package/dist/{chunk-D6COIM3U.js → chunk-O4RMPA6H.js} +5879 -5836
  59. package/dist/{chunk-VYMZ3QXG.js → chunk-O77IBNVO.js} +324 -324
  60. package/dist/{chunk-UQ3MOZGC.js → chunk-OFL4PTYU.js} +1 -1
  61. package/dist/{chunk-7B2Q4NJE.js → chunk-QLPLENDT.js} +1 -1
  62. package/dist/{chunk-NHQ2U5I4.js → chunk-R2J4SNKF.js} +1 -1
  63. package/dist/{chunk-ZWJRY5UI.js → chunk-RVUCY4ZV.js} +3 -3
  64. package/dist/{chunk-PCXRFT3N.js → chunk-SNFBJKAW.js} +3 -3
  65. package/dist/{chunk-B2FR2ZQ4.js → chunk-TALC5DX5.js} +1 -1
  66. package/dist/{chunk-B5J675KK.js → chunk-V5D4XNWV.js} +2 -2
  67. package/dist/{chunk-PITHTCAX.js → chunk-Y4GK7GCV.js} +1 -1
  68. package/dist/{chunk-DGVUTH7W.js → chunk-YSEC6TIB.js} +2221 -2067
  69. package/dist/{citations-UYB2RU5U.js → citations-NSBBWRZ4.js} +3 -3
  70. package/dist/{cli-catalog-F6FI7NB2.js → cli-catalog-OFWJMNMD.js} +3 -3
  71. package/dist/{cli-commands-ZG5ILKDA.js → cli-commands-WVBL337U.js} +7 -7
  72. package/dist/cli.js +13 -13
  73. package/dist/{competitor-EKP4R7YY.js → competitor-V4OHORBC.js} +3 -3
  74. package/dist/{content-DREE6JF3.js → content-RUXRI5IC.js} +3 -3
  75. package/dist/{dashboard-ZALEOLLU.js → dashboard-JXB2YAQJ.js} +6 -6
  76. package/dist/{demo-JG4Y22O4.js → demo-55ZNUOXU.js} +1 -1
  77. package/dist/{demo-server-3A4J2C65.js → demo-server-XO7PHM4I.js} +11 -11
  78. package/dist/{discover-W6GMD2HS.js → discover-JJQ564HS.js} +3 -3
  79. package/dist/{discover-eval-CKFZHRBW.js → discover-eval-KLEKZ6U4.js} +3 -3
  80. package/dist/{doctor-TNGBSUMA.js → doctor-JAMQZCMZ.js} +3 -3
  81. package/dist/{evidence-3H2GFQBZ.js → evidence-YRSB7GFE.js} +3 -3
  82. package/dist/{export-cmd-WUIKU5GK.js → export-cmd-MHML4OYU.js} +3 -3
  83. package/dist/{ga-JI6REFO4.js → ga-LSXPE2MN.js} +3 -3
  84. package/dist/{gbp-4ENDM5NS.js → gbp-RMKMLOC7.js} +3 -3
  85. package/dist/{google-HKQSCLOC.js → google-JQ4T6JTQ.js} +4 -4
  86. package/dist/{google-marketing-KQR5J2S4.js → google-marketing-J6SEODYC.js} +1 -1
  87. package/dist/{health-cmd-TS7EMMCS.js → health-cmd-MV2JM2C3.js} +3 -3
  88. package/dist/{history-MSD5DK6K.js → history-SRRH7A2E.js} +3 -3
  89. package/dist/index.d.ts +86 -47
  90. package/dist/index.js +23 -23
  91. package/dist/{init-L6WAEOWX.js → init-ZJZFUERV.js} +11 -11
  92. package/dist/{insights-RTZ3IZTD.js → insights-PMMGNWZH.js} +3 -3
  93. package/dist/intelligence-service-KCSU6ZUJ.js +15 -0
  94. package/dist/{keys-625DZBRM.js → keys-TS7NZANS.js} +3 -3
  95. package/dist/{keyword-CW46RNRR.js → keyword-VNCKDUGC.js} +3 -3
  96. package/dist/{logs-V33SHBIW.js → logs-VH3WOTZJ.js} +3 -3
  97. package/dist/{mcp-DFEDPSEG.js → mcp-DG2RROB3.js} +2 -2
  98. package/dist/mcp.js +9 -9
  99. package/dist/{measurement-plan-6W37RUOP.js → measurement-plan-4T35TUGG.js} +5 -5
  100. package/dist/{notify-DSUOT7WO.js → notify-BWHUSKL7.js} +3 -3
  101. package/dist/{organic-evidence-BMN6L4OB.js → organic-evidence-QX4SXXJP.js} +3 -3
  102. package/dist/{overview-WRRMBZ6S.js → overview-7IHUTKUV.js} +4 -4
  103. package/dist/{project-2GJIU3FE.js → project-JXLSWDE2.js} +3 -3
  104. package/dist/{query-3XPMGJUA.js → query-S75EL25H.js} +3 -3
  105. package/dist/{research-V433CKJ4.js → research-KFTV3IP4.js} +3 -3
  106. package/dist/{results-export-RGBU7QQQ.js → results-export-GTKVBU34.js} +3 -3
  107. package/dist/{run-NIAC6OJN.js → run-26HDIRHF.js} +4 -4
  108. package/dist/{schedule-KDWXRIE7.js → schedule-N6G4SVHQ.js} +3 -3
  109. package/dist/{search-626MPUJN.js → search-MI32EPYM.js} +3 -3
  110. package/dist/{serve-73SMMASI.js → serve-XLGE42AG.js} +67 -26
  111. package/dist/{session-7WWOETZB.js → session-W5DXWIYM.js} +12 -12
  112. package/dist/{settings-VKFQO6F2.js → settings-T7WI2UVE.js} +3 -3
  113. package/dist/{skills-5HC5H7TE.js → skills-F3WPKPTK.js} +2 -2
  114. package/dist/{snapshot-BSJUHFBC.js → snapshot-PD3EAVEX.js} +3 -3
  115. package/dist/{src-F6HM73TN.js → src-XDUXMJC3.js} +2 -2
  116. package/dist/{status-V4OWP7LZ.js → status-PUH7JFZ4.js} +4 -4
  117. package/dist/{technical-aeo-TG7CGU3F.js → technical-aeo-AUFWWJIP.js} +3 -3
  118. package/dist/{telemetry-O2IUNUBW.js → telemetry-XBYT7G2K.js} +4 -4
  119. package/dist/{tools-2GJIDKND.js → tools-GVHIRWSN.js} +11 -11
  120. package/dist/{traffic-XV4I3UPH.js → traffic-B3HW2ZWG.js} +5 -5
  121. package/dist/{users-VGBLDL5K.js → users-M5HNQZYI.js} +3 -3
  122. package/dist/{visibility-stats-UKJYJ6PP.js → visibility-stats-Y7GJKMHN.js} +3 -3
  123. package/dist/{wordpress-JZA7CGC6.js → wordpress-GCIURYPN.js} +3 -3
  124. package/package.json +1 -1
  125. package/assets/assets/MeasurementPropertyPage-1UYI7mzP.js +0 -4
  126. package/assets/assets/SiteHealthSection-PWjKMmEn.js +0 -2
  127. package/assets/assets/TrafficPage-DkfGiJXR.js +0 -40
  128. package/assets/assets/index-CG1Jox52.js +0 -39
  129. package/dist/intelligence-service-TH52PCNJ.js +0 -15
@@ -33,14 +33,14 @@ import {
33
33
  resolveModelForCapability,
34
34
  resolveSessionProviderAndModel,
35
35
  setAeroSystemPrompt
36
- } from "./chunk-42D2LE2B.js";
36
+ } from "./chunk-ILDT4LPB.js";
37
37
  import {
38
38
  AeroToolProfiles,
39
39
  AeroToolScopes,
40
40
  buildAeroStateTools,
41
41
  isAeroToolProfile,
42
42
  truncateToolResult
43
- } from "./chunk-U3AHE2RT.js";
43
+ } from "./chunk-5N6245R7.js";
44
44
  import {
45
45
  getGoogleAuthConfig,
46
46
  getGoogleConnection,
@@ -59,7 +59,7 @@ import {
59
59
  removeCloudflareTrafficConnection,
60
60
  removeCloudflareTrafficConnectionBySourceId,
61
61
  upsertCloudflareTrafficConnection
62
- } from "./chunk-NHQ2U5I4.js";
62
+ } from "./chunk-R2J4SNKF.js";
63
63
  import {
64
64
  claudeAdapter,
65
65
  embedQueries,
@@ -69,7 +69,7 @@ import {
69
69
  museAdapter,
70
70
  openaiAdapter,
71
71
  perplexityAdapter
72
- } from "./chunk-WAULJDKO.js";
72
+ } from "./chunk-AWCWIQAU.js";
73
73
  import {
74
74
  classifyUsageSurface,
75
75
  createApiUsageTelemetry,
@@ -81,7 +81,7 @@ import {
81
81
  startOutcomeTimer,
82
82
  trackFeatureCompleted,
83
83
  trackInstallState
84
- } from "./chunk-ISOQPVPY.js";
84
+ } from "./chunk-I6KNMZ77.js";
85
85
  import {
86
86
  isLoopbackBindHost
87
87
  } from "./chunk-TSENU4GG.js";
@@ -89,7 +89,7 @@ import {
89
89
  isApiProviderRegistrable,
90
90
  isCdpProviderRegistrable,
91
91
  registeredProviderNames
92
- } from "./chunk-QWKPSFGL.js";
92
+ } from "./chunk-JY3RLZGB.js";
93
93
  import {
94
94
  checkLatestVersionForServer,
95
95
  getOrCreateAnonymousId,
@@ -100,17 +100,17 @@ import {
100
100
  recordDashboardEvent,
101
101
  setTelemetryPreference,
102
102
  trackEvent
103
- } from "./chunk-RKIXES2B.js";
103
+ } from "./chunk-7244X3K6.js";
104
104
  import {
105
105
  createCanonryMcpServer
106
- } from "./chunk-PCXRFT3N.js";
106
+ } from "./chunk-SNFBJKAW.js";
107
107
  import {
108
108
  CANONRY_MCP_TIERS,
109
109
  CANONRY_MCP_TOOLKIT_NAMES
110
110
  } from "./chunk-4MJYGB56.js";
111
111
  import {
112
112
  ApiClient
113
- } from "./chunk-B5J675KK.js";
113
+ } from "./chunk-V5D4XNWV.js";
114
114
  import {
115
115
  adapterSupportsBatch,
116
116
  batchEligibleProviderNames,
@@ -125,21 +125,21 @@ import {
125
125
  saveConfig,
126
126
  saveConfigPatch,
127
127
  sentimentInstallReadiness
128
- } from "./chunk-UQ3MOZGC.js";
128
+ } from "./chunk-OFL4PTYU.js";
129
129
  import {
130
130
  getBundledSkillSnapshots
131
- } from "./chunk-B2FR2ZQ4.js";
131
+ } from "./chunk-TALC5DX5.js";
132
132
  import {
133
133
  computeFactorAverages,
134
134
  deleteSiteCrawlGraphLayout,
135
135
  persistSiteCrawlGraphLayout,
136
136
  prepareSiteCrawlGraphLayout,
137
137
  recordedSharePct
138
- } from "./chunk-73P65KPW.js";
138
+ } from "./chunk-BYOK6Z4F.js";
139
139
  import {
140
140
  CanonryMcpToolNames,
141
141
  canonryMcpTools
142
- } from "./chunk-ZWJRY5UI.js";
142
+ } from "./chunk-RVUCY4ZV.js";
143
143
  import {
144
144
  PACKAGE_VERSION
145
145
  } from "./chunk-AOJU5LKX.js";
@@ -151,11 +151,11 @@ import {
151
151
  addLogListener,
152
152
  createFastifyLogger,
153
153
  createLogger
154
- } from "./chunk-GO2J7SYT.js";
154
+ } from "./chunk-KXAOMTXN.js";
155
155
  import {
156
156
  computeCitedCompetitorDomains,
157
157
  determineCitationState
158
- } from "./chunk-MMEO22MF.js";
158
+ } from "./chunk-FC4XND45.js";
159
159
  import {
160
160
  BingApiError,
161
161
  CC_CACHE_DIR,
@@ -248,6 +248,7 @@ import {
248
248
  readMarketCompetitorNames,
249
249
  redactNotificationUrl,
250
250
  refreshAccessToken,
251
+ refreshSnapshotMentionIdentity,
251
252
  registerAgentConversationRoutes,
252
253
  registerOAuthAdminRoutes,
253
254
  registerOAuthRoutes,
@@ -270,7 +271,7 @@ import {
270
271
  webhookResponseReason,
271
272
  webhookTargetRefusalReason,
272
273
  writeAuditLog
273
- } from "./chunk-DGVUTH7W.js";
274
+ } from "./chunk-YSEC6TIB.js";
274
275
  import {
275
276
  OperationalLogStore,
276
277
  SentimentIdempotencyConflict,
@@ -352,7 +353,7 @@ import {
352
353
  siteLivenessState,
353
354
  trafficSources,
354
355
  usageCounters
355
- } from "./chunk-63ISSSGX.js";
356
+ } from "./chunk-MKAC7HKH.js";
356
357
  import {
357
358
  AGENT_MEMORY_VALUE_MAX_BYTES,
358
359
  AI_ENGINE_DOMAINS,
@@ -565,7 +566,7 @@ import {
565
566
  winnabilityClassLabel,
566
567
  withRetry,
567
568
  withSkippedProviders
568
- } from "./chunk-D6COIM3U.js";
569
+ } from "./chunk-O4RMPA6H.js";
569
570
 
570
571
  // src/google-marketing-runtime.ts
571
572
  import crypto2 from "crypto";
@@ -3498,6 +3499,9 @@ function abstentionReason(outcome) {
3498
3499
  if (outcome === "unsupported-language" || outcome === "ambiguous-judgment") return OutcomeReasonCodes.UNSUPPORTED;
3499
3500
  return OutcomeReasonCodes.NO_DATA;
3500
3501
  }
3502
+ var applyMentionIdentity = (tx, work) => {
3503
+ refreshSnapshotMentionIdentity(tx, [work.snapshotId]);
3504
+ };
3501
3505
  function credentialFingerprint(apiKey) {
3502
3506
  return createHash3("sha256").update("canonry-sentiment-credential\0").update(apiKey ?? "").digest("hex");
3503
3507
  }
@@ -3626,7 +3630,7 @@ var SentimentWorker = class {
3626
3630
  const prepared = this.options.prepare?.(input);
3627
3631
  if (unavailable || prepared?.ok === false) {
3628
3632
  const result2 = { kind: "abstained", outcome: unavailable ?? (prepared.ok === false ? prepared.outcome : "input-too-large"), reason: unavailable ?? (prepared.ok === false ? prepared.reason : "Input unavailable"), returnedModel: null, usage: { kind: "unknown", inputTokens: null, outputTokens: null } };
3629
- this.repository.completeWork({ workItemId: work.id, owner, outcome: result2.outcome, result: result2, returnedModel: null, now: this.now() });
3633
+ this.repository.completeWork({ workItemId: work.id, owner, outcome: result2.outcome, result: result2, returnedModel: null, now: this.now() }, applyMentionIdentity);
3630
3634
  report({ status: OutcomeStatuses.skipped, reasonCode: abstentionReason(result2.outcome) });
3631
3635
  return;
3632
3636
  }
@@ -3704,7 +3708,7 @@ var SentimentWorker = class {
3704
3708
  this.repository.failWork({ workItemId: work.id, owner, now, errorCode: result.error.code, ...result.error.retryable && attempt.attemptNumber - work.attemptBudgetStart < latest.maxAttempts ? { retryAt: new Date(Date.parse(now) + retryMs).toISOString() } : {} });
3705
3709
  reportFailed();
3706
3710
  } else {
3707
- this.repository.completeWork({ workItemId: work.id, owner, outcome: result.outcome, result, returnedModel: result.returnedModel, now });
3711
+ this.repository.completeWork({ workItemId: work.id, owner, outcome: result.outcome, result, returnedModel: result.returnedModel, now }, applyMentionIdentity);
3708
3712
  this.repository.releaseDispatchPause({ now, dispatchedAt: attempt.dispatchedAt });
3709
3713
  report({ status: OutcomeStatuses.succeeded, counts });
3710
3714
  }
@@ -4984,7 +4988,7 @@ function nonBlank(value) {
4984
4988
  return trimmed ? trimmed : void 0;
4985
4989
  }
4986
4990
  function resolveBuildCommit(env = process.env) {
4987
- const embedded = true ? "ad7b989ea23d3c838b86f010ddb6122f16dab26a" : void 0;
4991
+ const embedded = true ? "a0cad23352ac931aea4592fb0e0e21885b2559b4" : void 0;
4988
4992
  return nonBlank(embedded) ?? nonBlank(env.CANONRY_COMMIT);
4989
4993
  }
4990
4994
  function resolveInstanceIdentity(env = process.env) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  pickProjectCitedDomain
3
- } from "./chunk-MMEO22MF.js";
3
+ } from "./chunk-FC4XND45.js";
4
4
  import {
5
5
  GBP_INSIGHT_PROVIDER,
6
6
  PERSISTENT_GAP_THRESHOLD,
@@ -14,10 +14,10 @@ import {
14
14
  mergeGscQueryTotalsWithFallback,
15
15
  readGscQueryDailyRows,
16
16
  readLatestGscDataDate
17
- } from "./chunk-DGVUTH7W.js";
17
+ } from "./chunk-YSEC6TIB.js";
18
18
  import {
19
19
  getRequestContext
20
- } from "./chunk-7B2Q4NJE.js";
20
+ } from "./chunk-QLPLENDT.js";
21
21
  import {
22
22
  competitors,
23
23
  gbpDailyMetrics,
@@ -35,7 +35,7 @@ import {
35
35
  queries,
36
36
  querySnapshots,
37
37
  runs
38
- } from "./chunk-63ISSSGX.js";
38
+ } from "./chunk-MKAC7HKH.js";
39
39
  import {
40
40
  CitationStates,
41
41
  RunKinds,
@@ -45,7 +45,7 @@ import {
45
45
  effectiveDomains,
46
46
  redactLogString,
47
47
  redactLogValue
48
- } from "./chunk-D6COIM3U.js";
48
+ } from "./chunk-O4RMPA6H.js";
49
49
 
50
50
  // src/intelligence-service.ts
51
51
  import { eq, desc, asc, and, ne, or, inArray, gte, lte, isNull, sql, exists } from "drizzle-orm";
@@ -22,7 +22,7 @@ import {
22
22
  measurementDraftUpsertGroupRequestSchema,
23
23
  measurementDraftUpsertMarketRequestSchema,
24
24
  measurementDraftUpsertTargetRequestSchema
25
- } from "./chunk-D6COIM3U.js";
25
+ } from "./chunk-O4RMPA6H.js";
26
26
 
27
27
  // src/measurement-draft-actions.ts
28
28
  import { z } from "zod";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  trackIntegrationConnection
3
- } from "./chunk-ISOQPVPY.js";
3
+ } from "./chunk-I6KNMZ77.js";
4
4
  import {
5
5
  cliRuntimeContext
6
- } from "./chunk-RKIXES2B.js";
6
+ } from "./chunk-7244X3K6.js";
7
7
 
8
8
  // src/cli-connection-telemetry.ts
9
9
  function trackCliConnection(properties) {
@@ -17,7 +17,7 @@ import {
17
17
  templateLinkRatio,
18
18
  templateLinkUbiquityAvailable,
19
19
  validationError
20
- } from "./chunk-D6COIM3U.js";
20
+ } from "./chunk-O4RMPA6H.js";
21
21
  import {
22
22
  __export
23
23
  } from "./chunk-MLKGABMK.js";
@@ -542,6 +542,15 @@ var querySnapshots = sqliteTable("query_snapshots", {
542
542
  servedModel: text("served_model"),
543
543
  citationState: text("citation_state").notNull(),
544
544
  answerMentioned: integer("answer_mentioned", { mode: "boolean" }),
545
+ // Sentiment's identity verdict on a Simple answer, kept by
546
+ // `refreshSnapshotMentionIdentity` (api-routes) when a verdict is stored:
547
+ // `wrong-subject` means the evaluator found the answer is about another
548
+ // subject, so a name match is not a mention (`countsAsMention`). Null when
549
+ // no completed verdict says so, which includes every answer never assessed.
550
+ mentionIdentity: text("mention_identity").$type(),
551
+ // The Advanced counterpart: stable keys of the Properties whose latest
552
+ // sentiment verdict on this answer is `wrong-subject`. Null when none.
553
+ wrongSubjectTargetKeys: text("wrong_subject_target_keys", { mode: "json" }).$type(),
545
554
  answerText: text("answer_text"),
546
555
  citedDomains: text("cited_domains", { mode: "json" }).$type().notNull().default([]),
547
556
  // Flat capture fields are deliberately nullable: historical rows are not
@@ -7794,6 +7803,18 @@ var MIGRATION_VERSIONS = [
7794
7803
  statements: [
7795
7804
  `ALTER TABLE research_run_queries ADD COLUMN retrieved_sources TEXT`
7796
7805
  ]
7806
+ },
7807
+ {
7808
+ // Sentiment's identity verdicts as they bear on mentions: a Simple answer's
7809
+ // `wrong-subject` verdict, and the Advanced Properties judged wrong-subject.
7810
+ // NULL on every existing row; the local server fills them from stored
7811
+ // sentiment results once on startup (`sentiment-mention-identity`).
7812
+ version: 185,
7813
+ name: "snapshot-sentiment-mention-identity",
7814
+ statements: [
7815
+ `ALTER TABLE query_snapshots ADD COLUMN mention_identity TEXT`,
7816
+ `ALTER TABLE query_snapshots ADD COLUMN wrong_subject_target_keys TEXT`
7817
+ ]
7797
7818
  }
7798
7819
  ];
7799
7820
  var AERO_LEDGER_REBUILDS = [
@@ -8864,7 +8885,13 @@ var SentimentRepository = class {
8864
8885
  return true;
8865
8886
  }, { behavior: "immediate" });
8866
8887
  }
8867
- completeWork(input) {
8888
+ /**
8889
+ * `onCompleted` runs in the same transaction once a completed result is
8890
+ * stored, so state derived from the verdict (the snapshot's mention identity)
8891
+ * commits with it or not at all. It does not run for work canceled while it
8892
+ * ran: that result stays out of every read.
8893
+ */
8894
+ completeWork(input, onCompleted) {
8868
8895
  return this.db.transaction((tx) => {
8869
8896
  const work = tx.select().from(sentimentWorkItems).where(and(
8870
8897
  eq2(sentimentWorkItems.id, input.workItemId),
@@ -8889,6 +8916,7 @@ var SentimentRepository = class {
8889
8916
  updatedAt: input.now
8890
8917
  }).where(eq2(sentimentWorkItems.id, work.id)).run();
8891
8918
  shiftJobs(tx, work.id, work.status, status, input.now);
8919
+ if (status === "completed") onCompleted?.(tx, work);
8892
8920
  return true;
8893
8921
  }, { behavior: "immediate" });
8894
8922
  }