@canonry/canonry 7.72.1 → 7.73.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 (131) hide show
  1. package/assets/assets/{AgentSetupPage-D39M9CRK.js → AgentSetupPage-D7YVdPWO.js} +1 -1
  2. package/assets/assets/{AuditHistoryPanel-BS-iFyHX.js → AuditHistoryPanel-yrgfS5B_.js} +1 -1
  3. package/assets/assets/{BacklinksPage-BW2bEGF4.js → BacklinksPage-DJM6z03g.js} +1 -1
  4. package/assets/assets/{HistoryPage-Dh6o2iVd.js → HistoryPage-CNvAVJ1S.js} +1 -1
  5. package/assets/assets/{MeasurementPropertyPage-DL9cbtVz.js → MeasurementPropertyPage-BVVYhOxR.js} +1 -1
  6. package/assets/assets/{ProjectPage-DXh97uDN.js → ProjectPage-CPRD8kR9.js} +1 -1
  7. package/assets/assets/{RunsPage-BM4ETLsm.js → RunsPage-Ck33dcjz.js} +1 -1
  8. package/assets/assets/{SettingsPage-DpJTB2-Q.js → SettingsPage-CS_t4Dai.js} +1 -1
  9. package/assets/assets/{SiteHealthSection-CmlMQ17V.js → SiteHealthSection-BurKnHpn.js} +2 -2
  10. package/assets/assets/ToneBadge-Df8oiKsQ.js +60 -0
  11. package/assets/assets/{TrafficPage-ClH3Dxnm.js → TrafficPage-DAiY698E.js} +1 -1
  12. package/assets/assets/{TrafficSourceDetailPage-DE-NyNGz.js → TrafficSourceDetailPage-clJSX2rr.js} +1 -1
  13. package/assets/assets/{account-context-BwV6ox8O.js → account-context-DDEhuoP2.js} +1 -1
  14. package/assets/assets/{card-DhkoBNyY.js → card-DbR-lBY3.js} +1 -1
  15. package/assets/assets/{extract-error-message-dNDtiSBo.js → extract-error-message-7_Vm2DQF.js} +1 -1
  16. package/assets/assets/{format-helpers-Bt4tx-f3.js → format-helpers-vtahpXTQ.js} +1 -1
  17. package/assets/assets/{index-MbApCekj.js → index-BIhCeXvc.js} +4 -4
  18. package/assets/assets/{query-client-D-zMw63p.js → query-client-TlFXYJ9o.js} +1 -1
  19. package/assets/assets/{react-query-EdiRRB2q.js → react-query-C5Mv8xfD.js} +1 -1
  20. package/assets/assets/{react-sigma_core.esm.min-Bidr1Gxk.js → react-sigma_core.esm.min-DmggJ7YC.js} +1 -1
  21. package/assets/assets/{service-BUi8JgGI.js → service-CLFURPuM.js} +1 -1
  22. package/assets/index.html +7 -7
  23. package/dist/{ads-FFUUMS4J.js → ads-TX5622SS.js} +3 -3
  24. package/dist/{agent-LCD2VG7C.js → agent-AIOQL66U.js} +7 -7
  25. package/dist/{agent-ask-OBHTCYFR.js → agent-ask-A6GIJTBX.js} +3 -3
  26. package/dist/{agent-conversations-VMZ4NFIX.js → agent-conversations-LHWLKOPQ.js} +3 -3
  27. package/dist/{agent-memory-UPFJFNWC.js → agent-memory-F54BPEYN.js} +3 -3
  28. package/dist/{agent-providers-4GOWLBZK.js → agent-providers-L74KZOSG.js} +3 -3
  29. package/dist/{agent-transcript-RGXIVZUP.js → agent-transcript-IH65H755.js} +3 -3
  30. package/dist/{analytics-FBK4XV5P.js → analytics-YWCY2KSY.js} +3 -3
  31. package/dist/{apply-Y2DVE3YB.js → apply-BLUUYG2N.js} +3 -3
  32. package/dist/{backfill-7SGCPH6J.js → backfill-6WO5CH6Z.js} +9 -9
  33. package/dist/{backlinks-YWHFC7DZ.js → backlinks-NC7AUGTK.js} +3 -3
  34. package/dist/{bing-7BP3DWPK.js → bing-WQUEYHVC.js} +3 -3
  35. package/dist/{bootstrap-Z7QSKVPL.js → bootstrap-AXZV4BBC.js} +10 -10
  36. package/dist/{cdp-OL6RENO3.js → cdp-DUG5PMUD.js} +7 -7
  37. package/dist/{chunk-J523Y7X2.js → chunk-2Y6MSB4J.js} +1 -1
  38. package/dist/{chunk-YFITKHCV.js → chunk-3ANSG6YT.js} +345 -337
  39. package/dist/{chunk-GA2EHZTI.js → chunk-3WPTMLQI.js} +22 -6
  40. package/dist/{chunk-QDN3FL2A.js → chunk-3YIKSZHN.js} +2 -1
  41. package/dist/{chunk-H4HNXCDF.js → chunk-4B6DE7BB.js} +2 -2
  42. package/dist/{chunk-UWBJWKDQ.js → chunk-4JMTDLFV.js} +2 -2
  43. package/dist/{chunk-QKMGGM4B.js → chunk-5PA7SJ2M.js} +8 -271
  44. package/dist/{chunk-JO73L677.js → chunk-6ATKY252.js} +2 -2
  45. package/dist/{chunk-XR6ZVMYK.js → chunk-6W5AR4IW.js} +1 -1
  46. package/dist/{chunk-IZMT4WLZ.js → chunk-6YW24AUN.js} +2 -2
  47. package/dist/chunk-AZQNJX3T.js +269 -0
  48. package/dist/{chunk-TUVG7BIF.js → chunk-B6R223HQ.js} +8 -8
  49. package/dist/{chunk-6MYHGP46.js → chunk-DLVGMRM5.js} +1 -1
  50. package/dist/{chunk-P3UGNR2Y.js → chunk-ETVM3T7K.js} +5 -5
  51. package/dist/{chunk-IV6VZ63E.js → chunk-F5D4GPZQ.js} +18 -14
  52. package/dist/{chunk-WJ2JU32O.js → chunk-GNBATQS3.js} +23 -6
  53. package/dist/{chunk-TEDY3MHN.js → chunk-GUFKUPKZ.js} +3 -3
  54. package/dist/{chunk-BADJCT6U.js → chunk-GWDMWKM6.js} +1 -1
  55. package/dist/{chunk-PPM6Z7CM.js → chunk-HEL6DKDN.js} +1 -1
  56. package/dist/{chunk-DFCKSJQI.js → chunk-HGMTGC34.js} +4 -4
  57. package/dist/{chunk-GPTRCOKV.js → chunk-HIGBV77K.js} +259 -95
  58. package/dist/{chunk-NZZWJCKS.js → chunk-HJHFW455.js} +3 -3
  59. package/dist/{chunk-JE5QURTR.js → chunk-HKV4UWG5.js} +1 -1
  60. package/dist/{chunk-DRGCVTYH.js → chunk-JPM3VC6A.js} +1 -1
  61. package/dist/{chunk-TOX6HAQJ.js → chunk-JQNVNB63.js} +3 -3
  62. package/dist/{chunk-3AG3LPZX.js → chunk-MRSNLKSM.js} +1 -1
  63. package/dist/{chunk-O7WOCTBD.js → chunk-PAIYFNNY.js} +71 -3
  64. package/dist/{chunk-MJYO6UK2.js → chunk-PRSQ4R47.js} +2 -2
  65. package/dist/{chunk-JEBY6MS6.js → chunk-QS6RIP37.js} +1 -1
  66. package/dist/{chunk-4LTL5RNY.js → chunk-S77W2XSI.js} +4 -4
  67. package/dist/{chunk-YXAKL5HM.js → chunk-SF5JLMLG.js} +6791 -6777
  68. package/dist/{chunk-Q25JQANW.js → chunk-T5PWWDMJ.js} +17 -2
  69. package/dist/{chunk-ATT3ZCSS.js → chunk-WH2M2MQF.js} +38 -16
  70. package/dist/{chunk-7KOAP47B.js → chunk-WLWOGBLJ.js} +363 -248
  71. package/dist/{chunk-BZZDFIY2.js → chunk-XDQJOZKJ.js} +1 -1
  72. package/dist/{citations-RVSC67GE.js → citations-FUZ6DGP5.js} +3 -3
  73. package/dist/{cli-catalog-NEZE5QU5.js → cli-catalog-BXHG544D.js} +3 -3
  74. package/dist/{cli-commands-HGCYU4MQ.js → cli-commands-GMOR67F5.js} +7 -7
  75. package/dist/cli.js +13 -13
  76. package/dist/{competitor-BX3M3OYS.js → competitor-QDCH7PLT.js} +3 -3
  77. package/dist/{content-PKJMVMHJ.js → content-JX2CPIPR.js} +3 -3
  78. package/dist/{dashboard-SVHZBVM6.js → dashboard-OOWMLMKV.js} +6 -6
  79. package/dist/{demo-HYDPECCK.js → demo-GKSMSKOY.js} +1 -1
  80. package/dist/{demo-server-KEOO7WFO.js → demo-server-UQO4XKHN.js} +12 -11
  81. package/dist/{discover-JDP44ZHX.js → discover-YQSVQRUV.js} +3 -3
  82. package/dist/{discover-eval-6ORCVYYR.js → discover-eval-FN5RL6QI.js} +3 -3
  83. package/dist/{doctor-TVZRMBSS.js → doctor-YHJLAEJJ.js} +3 -3
  84. package/dist/{evidence-FNIAFBBG.js → evidence-KUPZMBIK.js} +3 -3
  85. package/dist/{export-cmd-HQNF2SSD.js → export-cmd-YSEPTUUF.js} +3 -3
  86. package/dist/{ga-PIO5OXMK.js → ga-WNS7Q7TF.js} +3 -3
  87. package/dist/{gbp-3R5FME43.js → gbp-5NYFK4TW.js} +3 -3
  88. package/dist/{google-BYZREX2O.js → google-T4CF4WCI.js} +4 -4
  89. package/dist/{google-marketing-SPQ2GW6X.js → google-marketing-IXPMUBXZ.js} +1 -1
  90. package/dist/{health-cmd-HH5RYMSV.js → health-cmd-2W37CF6J.js} +3 -3
  91. package/dist/{history-Q35NLLMJ.js → history-PA3O6ZHX.js} +3 -3
  92. package/dist/index.d.ts +248 -71
  93. package/dist/index.js +25 -24
  94. package/dist/{init-TV4ZKAAW.js → init-I3P7FINF.js} +12 -11
  95. package/dist/{insights-SH73B4PD.js → insights-O5PUVHTW.js} +3 -3
  96. package/dist/intelligence-service-EJQQNO65.js +16 -0
  97. package/dist/{journeys-SIV7HPW7.js → journeys-GU34O3HE.js} +3 -3
  98. package/dist/{keys-O656YWSW.js → keys-RXBFRNUS.js} +3 -3
  99. package/dist/{keyword-FZ2N4EW7.js → keyword-MASR36DK.js} +3 -3
  100. package/dist/{logs-2NPN7HBI.js → logs-OTA7MV4P.js} +3 -3
  101. package/dist/mcp-ZQYN2NET.js +19 -0
  102. package/dist/mcp.js +20 -14
  103. package/dist/{measurement-plan-JQKVSJRL.js → measurement-plan-ZGVO36TN.js} +5 -5
  104. package/dist/{notify-VTAYBHC6.js → notify-KS5CR3S2.js} +3 -3
  105. package/dist/{organic-evidence-HPXXEPOW.js → organic-evidence-CTH52AC5.js} +3 -3
  106. package/dist/{overview-FSBNDYZJ.js → overview-IRCIDE5H.js} +4 -4
  107. package/dist/{project-MAPPXURS.js → project-H5XPI5CT.js} +3 -3
  108. package/dist/{query-R6DLPIPJ.js → query-2R6EZG5T.js} +3 -3
  109. package/dist/{research-FXKOEUQB.js → research-OA3UQAV3.js} +3 -3
  110. package/dist/{results-export-X2PUM63S.js → results-export-XUXU3WMX.js} +3 -3
  111. package/dist/{run-6ENTG4IO.js → run-7IIOB6AS.js} +4 -4
  112. package/dist/{schedule-DMMVRT7P.js → schedule-DUTPZB5C.js} +3 -3
  113. package/dist/{search-FHI6APT7.js → search-TWUJD7KH.js} +3 -3
  114. package/dist/{serve-76BGQFPW.js → serve-BYHHULUU.js} +26 -25
  115. package/dist/{session-JBTIV7SS.js → session-M5XSTGPI.js} +13 -12
  116. package/dist/{settings-FMB4QED4.js → settings-GQXU5M3H.js} +3 -3
  117. package/dist/{skills-HBIMHSOI.js → skills-F6AXQHTO.js} +2 -2
  118. package/dist/{snapshot-RBA2EL7R.js → snapshot-QFKUO4QK.js} +3 -3
  119. package/dist/{src-BXXGJOQB.js → src-52USCS7O.js} +4 -2
  120. package/dist/{status-ATFDFAVG.js → status-42LPR7YH.js} +4 -4
  121. package/dist/{technical-aeo-JWQTGCTB.js → technical-aeo-SUILL4MY.js} +3 -3
  122. package/dist/{telemetry-6QFGJL2I.js → telemetry-RITB7YZH.js} +4 -4
  123. package/dist/{tools-4VRHKUBE.js → tools-DGWJOLNS.js} +11 -11
  124. package/dist/{traffic-5R7M4CK5.js → traffic-3YC3HUNT.js} +5 -5
  125. package/dist/{users-24TIUYJY.js → users-BST5DQ5R.js} +3 -3
  126. package/dist/{visibility-stats-YLQPPBJJ.js → visibility-stats-NCNP4AL2.js} +3 -3
  127. package/dist/{wordpress-7VDPHMUZ.js → wordpress-4HQDLQVE.js} +3 -3
  128. package/package.json +10 -6
  129. package/assets/assets/ToneBadge-CmvL5mFG.js +0 -60
  130. package/dist/intelligence-service-YNHDEY4M.js +0 -15
  131. package/dist/mcp-RHQY3DV6.js +0 -14
@@ -2,11 +2,11 @@ import {
2
2
  dedupeGscSitemapUrls,
3
3
  resolveDiscoveredGscSitemapUrls,
4
4
  submitGscSitemapBatches
5
- } from "./chunk-J523Y7X2.js";
5
+ } from "./chunk-2Y6MSB4J.js";
6
6
  import {
7
7
  measurementDraftOperationSchema,
8
8
  runMeasurementDraftAction
9
- } from "./chunk-3AG3LPZX.js";
9
+ } from "./chunk-MRSNLKSM.js";
10
10
  import {
11
11
  CliError
12
12
  } from "./chunk-HGMYEDAQ.js";
@@ -77,6 +77,7 @@ import {
77
77
  keywordGenerateRequestSchema,
78
78
  logQuerySchema,
79
79
  maxOperationAccess,
80
+ mcpProfileDtoSchema,
80
81
  measurementChangesQuerySchema,
81
82
  measurementDataQualityQuerySchema,
82
83
  measurementDiscoveryRequestSchema,
@@ -177,7 +178,7 @@ import {
177
178
  trafficSeriesGranularitySchema,
178
179
  visibilityCompareSelectionSchema,
179
180
  visibilityReportRequestSchema
180
- } from "./chunk-YXAKL5HM.js";
181
+ } from "./chunk-SF5JLMLG.js";
181
182
 
182
183
  // src/mcp/tool-registry.ts
183
184
  import { z as z2 } from "zod";
@@ -239,13 +240,15 @@ function uniqueStrings(values) {
239
240
  // src/mcp/tool-registry.ts
240
241
  var readAnnotations = (openWorldHint) => ({
241
242
  readOnlyHint: true,
242
- ...openWorldHint ? { openWorldHint } : {}
243
+ idempotentHint: true,
244
+ destructiveHint: false,
245
+ openWorldHint: Boolean(openWorldHint)
243
246
  });
244
247
  var writeAnnotations = (opts) => ({
245
248
  readOnlyHint: false,
246
249
  idempotentHint: opts.idempotentHint,
247
250
  destructiveHint: Boolean(opts.destructiveHint),
248
- ...opts.openWorldHint ? { openWorldHint: opts.openWorldHint } : {}
251
+ openWorldHint: opts.openWorldHint ?? true
249
252
  });
250
253
  function toolOperationAccess(tool) {
251
254
  const derived = maxOperationAccess(tool.openApiOperations.map((operation) => {
@@ -1557,6 +1560,19 @@ var rawCanonryMcpTools = [
1557
1560
  openApiOperations: ["POST /api/v1/projects/{name}/query-tracking/commit"],
1558
1561
  handler: (client, input) => client.commitQueryTracking(input.project, input.request)
1559
1562
  }),
1563
+ defineTool({
1564
+ name: "canonry_mcp_profile",
1565
+ requiresConnectionProfile: true,
1566
+ title: "Read the connected Canonry identity",
1567
+ description: "Read the signed-in user identity, effective read scope and instance audience. Requires a named user connection; an unbound API key has no user profile.",
1568
+ access: "read",
1569
+ tier: "core",
1570
+ inputSchema: emptyInputSchema,
1571
+ outputSchema: mcpProfileDtoSchema,
1572
+ annotations: readAnnotations(),
1573
+ openApiOperations: ["GET /api/v1/mcp/profile"],
1574
+ handler: (client) => client.getMcpProfile()
1575
+ }),
1560
1576
  defineTool({
1561
1577
  name: "canonry_projects_list",
1562
1578
  title: "List Canonry projects",
@@ -2398,7 +2414,7 @@ var rawCanonryMcpTools = [
2398
2414
  access: "write",
2399
2415
  tier: "bing",
2400
2416
  inputSchema: projectInputSchema,
2401
- annotations: writeAnnotations({ idempotentHint: true }),
2417
+ annotations: writeAnnotations({ idempotentHint: true, openWorldHint: false }),
2402
2418
  openApiOperations: ["GET /api/v1/projects/{name}/bing/coverage"],
2403
2419
  handler: (client, input) => client.bingCoverage(input.project)
2404
2420
  }),
@@ -5,7 +5,7 @@ import {
5
5
  AppError,
6
6
  parseWindowIn,
7
7
  resolveDateRange
8
- } from "./chunk-YXAKL5HM.js";
8
+ } from "./chunk-SF5JLMLG.js";
9
9
 
10
10
  // src/cli-access.ts
11
11
  var CLI_ACCESS_BY_ID = Object.freeze({
@@ -245,6 +245,7 @@ var CLI_ACCESS_BY_ID = Object.freeze({
245
245
  "mcp": "write",
246
246
  "mcp.config": "write",
247
247
  "mcp.install": "write",
248
+ "mcp.profile": "stored",
248
249
  "measurement-plan.advanced": "write",
249
250
  "measurement-plan.assignments.apply": "write",
250
251
  "measurement-plan.assignments.preview": "stored",
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  trackIntegrationConnection
3
- } from "./chunk-4LTL5RNY.js";
3
+ } from "./chunk-S77W2XSI.js";
4
4
  import {
5
5
  cliRuntimeContext
6
- } from "./chunk-MJYO6UK2.js";
6
+ } from "./chunk-PRSQ4R47.js";
7
7
 
8
8
  // src/cli-connection-telemetry.ts
9
9
  function trackCliConnection(properties) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createApiClient
3
- } from "./chunk-ATT3ZCSS.js";
3
+ } from "./chunk-WH2M2MQF.js";
4
4
  import {
5
5
  emitJsonl
6
6
  } from "./chunk-Z7IUAJOF.js";
@@ -19,7 +19,7 @@ import {
19
19
  formatMicros,
20
20
  formatRunErrorOneLine,
21
21
  resolveProviderInput
22
- } from "./chunk-YXAKL5HM.js";
22
+ } from "./chunk-SF5JLMLG.js";
23
23
 
24
24
  // src/commands/run.ts
25
25
  function getClient() {
@@ -1,6 +1,9 @@
1
+ import {
2
+ createLogger
3
+ } from "./chunk-AZQNJX3T.js";
1
4
  import {
2
5
  pickProjectCitedDomain
3
- } from "./chunk-DRGCVTYH.js";
6
+ } from "./chunk-JPM3VC6A.js";
4
7
  import {
5
8
  GBP_INSIGHT_PROVIDER,
6
9
  PERSISTENT_GAP_THRESHOLD,
@@ -14,10 +17,7 @@ import {
14
17
  mergeGscQueryTotalsWithFallback,
15
18
  readGscQueryDailyRows,
16
19
  readLatestGscDataDate
17
- } from "./chunk-7KOAP47B.js";
18
- import {
19
- getRequestContext
20
- } from "./chunk-BADJCT6U.js";
20
+ } from "./chunk-WLWOGBLJ.js";
21
21
  import {
22
22
  competitors,
23
23
  gbpDailyMetrics,
@@ -35,278 +35,18 @@ import {
35
35
  queries,
36
36
  querySnapshots,
37
37
  runs
38
- } from "./chunk-O7WOCTBD.js";
38
+ } from "./chunk-PAIYFNNY.js";
39
39
  import {
40
40
  CitationStates,
41
41
  RunKinds,
42
42
  RunStatuses,
43
43
  RunTriggers,
44
- diagnosticIdentity,
45
- effectiveDomains,
46
- redactLogString,
47
- redactLogValue
48
- } from "./chunk-YXAKL5HM.js";
44
+ effectiveDomains
45
+ } from "./chunk-SF5JLMLG.js";
49
46
 
50
47
  // src/intelligence-service.ts
51
48
  import { eq, desc, asc, and, ne, or, inArray, gte, lte, isNull, sql, exists } from "drizzle-orm";
52
49
  import crypto from "crypto";
53
-
54
- // ../api-routes/src/runtime-logger.ts
55
- import { format } from "util";
56
- var IS_TTY = process.stdout.isTTY === true;
57
- var MAX_IDENTITY_LENGTH = 512;
58
- var RESERVED_FIELDS = /* @__PURE__ */ new Set([
59
- "ts",
60
- "level",
61
- "module",
62
- "action",
63
- "msg",
64
- "requestId",
65
- "actor",
66
- "credentialId",
67
- "userAgent",
68
- "actorSession",
69
- "__runtimeRequestId"
70
- ]);
71
- var listeners = /* @__PURE__ */ new Set();
72
- function addLogListener(listener) {
73
- listeners.add(listener);
74
- return () => listeners.delete(listener);
75
- }
76
- function createLogger(module) {
77
- const emit = (level, action, context) => {
78
- const msg = context ? safeProperty(context, "msg") : void 0;
79
- emitRuntimeLog({ level, module, action, context, ...typeof msg === "string" ? { msg } : {} });
80
- };
81
- return {
82
- info: (action, ctx) => emit("info", action, ctx),
83
- warn: (action, ctx) => emit("warn", action, ctx),
84
- error: (action, ctx) => emit("error", action, ctx)
85
- };
86
- }
87
- function createFastifyLogger(options = {}) {
88
- return buildFastifyLogger(options.module ?? "HTTP", options.enabled !== false, {});
89
- }
90
- var LEVELS = { trace: 10, debug: 20, info: 30, warn: 40, error: 50, fatal: 60, silent: Infinity };
91
- function buildFastifyLogger(module, enabled, bindings, inheritedLevel = "info") {
92
- let level = inheritedLevel;
93
- const emit = (severity, args) => {
94
- if (LEVELS[severity] >= LEVELS[level]) logFastify(severity, module, enabled, bindings, args);
95
- };
96
- const logger = {
97
- get level() {
98
- return level;
99
- },
100
- set level(value) {
101
- if (Object.hasOwn(LEVELS, value)) level = value;
102
- },
103
- trace: (...args) => emit("trace", args),
104
- debug: (...args) => emit("debug", args),
105
- info: (...args) => emit("info", args),
106
- warn: (...args) => emit("warn", args),
107
- error: (...args) => emit("error", args),
108
- fatal: (...args) => emit("fatal", args),
109
- silent: () => void 0,
110
- child: (childBindings) => buildFastifyLogger(module, enabled, mergeBindings(bindings, childBindings), level)
111
- };
112
- return logger;
113
- }
114
- function logFastify(level, module, enabled, bindings, args) {
115
- const { context, msg } = normalizePinoArgs(args);
116
- emitRuntimeLog({
117
- level,
118
- module,
119
- action: `fastify.${level}`,
120
- msg,
121
- context: { ...bindings, ...context },
122
- trustedRequestId: asBoundString(bindings.__runtimeRequestId),
123
- enabled
124
- });
125
- }
126
- function normalizePinoArgs(args) {
127
- const first = args[0];
128
- const second = args[1];
129
- if (typeof first === "string") return { context: {}, msg: safeFormat(first, args.slice(1)) };
130
- if (first instanceof Error) {
131
- return { context: { err: first }, msg: typeof second === "string" ? safeFormat(second, args.slice(2)) : void 0 };
132
- }
133
- if (isObject(first)) {
134
- return { context: copyOwnData(first), msg: typeof second === "string" ? safeFormat(second, args.slice(2)) : void 0 };
135
- }
136
- return { context: {}, msg: typeof second === "string" ? safeFormat(second, args.slice(2)) : void 0 };
137
- }
138
- function emitRuntimeLog({
139
- level,
140
- module,
141
- action,
142
- msg,
143
- context,
144
- trustedRequestId,
145
- enabled = true
146
- }) {
147
- const safeContext = sanitizeContext(context);
148
- const error = safeContext.err ?? safeContext.error;
149
- const errorMessage = typeof error === "string" ? error : isRecord(error) && typeof error.message === "string" ? error.message : void 0;
150
- const message = errorMessage && errorMessage !== msg ? [msg, errorMessage].filter(Boolean).join(": ") : msg;
151
- const entry = {
152
- ts: (/* @__PURE__ */ new Date()).toISOString(),
153
- level,
154
- module: boundText(module, "Runtime"),
155
- action: boundText(action, "log"),
156
- ...message === void 0 ? {} : { msg: redactLogString(message) },
157
- ...safeContext,
158
- ...trustedAttribution(getRequestContext(trustedRequestId), trustedRequestId)
159
- };
160
- if (enabled) writeEntry(entry);
161
- for (const listener of listeners) {
162
- try {
163
- listener(entry);
164
- } catch {
165
- }
166
- }
167
- }
168
- function sanitizeContext(context) {
169
- if (!context) return {};
170
- const output = {};
171
- for (const key of safeKeys(context).slice(0, 100)) {
172
- if (RESERVED_FIELDS.has(key)) continue;
173
- const value = safeProperty(context, key);
174
- if (key === "req" || key === "request") {
175
- Object.assign(output, normalizeRequest(value));
176
- continue;
177
- }
178
- if (key === "res" || key === "reply") {
179
- Object.assign(output, normalizeReply(value));
180
- continue;
181
- }
182
- if (key === "responseTime" || key === "duration") {
183
- if (typeof value === "number" && Number.isFinite(value)) output.durationMs = value;
184
- continue;
185
- }
186
- output[key] = value;
187
- }
188
- delete output.__runtimeRequestId;
189
- const redacted = redactLogValue(output);
190
- return isRecord(redacted) ? redacted : {};
191
- }
192
- function trustedAttribution(context, trustedRequestId) {
193
- const requestId = boundOptional(context?.requestId) ?? trustedRequestId;
194
- const actor = diagnosticIdentity("actor", context?.actor);
195
- const credentialId = diagnosticIdentity("credentialId", context?.credentialId);
196
- const userAgent = boundOptional(context?.userAgent);
197
- const actorSession = boundOptional(context?.actorSession);
198
- const method = boundOptional(context?.method);
199
- const route = boundOptional(context?.route);
200
- return {
201
- ...requestId ? { requestId } : {},
202
- ...actor ? { actor } : {},
203
- ...credentialId ? { credentialId } : {},
204
- ...userAgent ? { userAgent } : {},
205
- ...actorSession ? { actorSession } : {},
206
- ...method ? { method } : {},
207
- ...route ? { route } : {},
208
- ...context?.statusCode === void 0 ? {} : { statusCode: context.statusCode }
209
- };
210
- }
211
- function mergeBindings(parent, child) {
212
- const merged = { ...parent };
213
- if (!isObject(child)) return merged;
214
- for (const key of safeKeys(child).slice(0, 100)) {
215
- const value = safeProperty(child, key);
216
- if (key === "req" || key === "request") Object.assign(merged, normalizeRequest(value));
217
- else if (key === "res" || key === "reply") Object.assign(merged, normalizeReply(value));
218
- else if (key === "reqId") {
219
- merged.reqId = value;
220
- merged.__runtimeRequestId = value;
221
- } else if (!RESERVED_FIELDS.has(key)) merged[key] = value;
222
- }
223
- return merged;
224
- }
225
- function normalizeRequest(value) {
226
- if (!isObject(value)) return {};
227
- const id = asBoundString(safeProperty(value, "id"));
228
- const method = asBoundString(safeProperty(value, "method"));
229
- const routeOptions = safeProperty(value, "routeOptions");
230
- const route = isObject(routeOptions) ? asBoundString(safeProperty(routeOptions, "url")) : void 0;
231
- return {
232
- ...id ? { reqId: id, __runtimeRequestId: id } : {},
233
- ...method ? { method } : {},
234
- ...route ? { route } : {}
235
- };
236
- }
237
- function normalizeReply(value) {
238
- if (!isObject(value)) return {};
239
- const statusCode = safeProperty(value, "statusCode");
240
- return typeof statusCode === "number" && Number.isFinite(statusCode) ? { statusCode } : {};
241
- }
242
- function writeEntry(entry) {
243
- const stream = entry.level === "error" || entry.level === "fatal" ? process.stderr : process.stdout;
244
- const line = IS_TTY ? formatTTY(entry) : JSON.stringify(entry);
245
- try {
246
- stream.write(`${line}
247
- `);
248
- } catch {
249
- }
250
- }
251
- function formatTTY(entry) {
252
- const { ts, level, module, action, msg, ...context } = entry;
253
- const levelTag = level === "fatal" || level === "error" ? "ERR" : level === "warn" ? "WRN" : "INF";
254
- const parts = safeKeys(context).map((key) => `${key}=${safeDisplay(safeProperty(context, key))}`);
255
- return `${ts.slice(11, 19)} ${levelTag} [${module}] ${action}${msg ? ` ${msg}` : ""}${parts.length ? ` ${parts.join(" ")}` : ""}`;
256
- }
257
- function safeDisplay(value) {
258
- try {
259
- return typeof value === "string" ? value : JSON.stringify(value);
260
- } catch {
261
- return "[UNSERIALIZABLE]";
262
- }
263
- }
264
- function safeFormat(message, args) {
265
- try {
266
- return args.length ? format(message, ...args) : message;
267
- } catch {
268
- return message;
269
- }
270
- }
271
- function isObject(value) {
272
- return value !== null && typeof value === "object";
273
- }
274
- function isRecord(value) {
275
- return isObject(value) && !Array.isArray(value);
276
- }
277
- function safeKeys(value) {
278
- try {
279
- return Object.keys(value);
280
- } catch {
281
- return [];
282
- }
283
- }
284
- function safeProperty(value, key) {
285
- try {
286
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
287
- return descriptor && "value" in descriptor ? descriptor.value : void 0;
288
- } catch {
289
- return void 0;
290
- }
291
- }
292
- function copyOwnData(value) {
293
- const output = {};
294
- for (const key of safeKeys(value)) output[key] = safeProperty(value, key);
295
- return output;
296
- }
297
- function boundText(value, fallback) {
298
- return boundOptional(value) ?? fallback;
299
- }
300
- function asBoundString(value) {
301
- return typeof value === "string" ? boundOptional(value) : void 0;
302
- }
303
- function boundOptional(value) {
304
- if (typeof value !== "string") return void 0;
305
- const redacted = redactLogString(value).replace(/[\r\n]+/g, " ").trim().slice(0, MAX_IDENTITY_LENGTH);
306
- return redacted || void 0;
307
- }
308
-
309
- // src/intelligence-service.ts
310
50
  var RECURRENCE_LOOKBACK_RUNS = 5;
311
51
  var HISTORY_WINDOW_RUNS = Math.max(PERSISTENT_GAP_THRESHOLD, 5);
312
52
  var log = createLogger("IntelligenceService");
@@ -1026,9 +766,6 @@ var IntelligenceService = class {
1026
766
  };
1027
767
 
1028
768
  export {
1029
- addLogListener,
1030
- createLogger,
1031
- createFastifyLogger,
1032
769
  HISTORY_WINDOW_RUNS,
1033
770
  IntelligenceService
1034
771
  };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  parseJsonColumn
3
- } from "./chunk-O7WOCTBD.js";
3
+ } from "./chunk-PAIYFNNY.js";
4
4
  import {
5
5
  AI_ENGINE_DOMAINS,
6
6
  AI_ENGINE_SELF_DOMAINS,
@@ -26,7 +26,7 @@ import {
26
26
  retryAfterDelayMs,
27
27
  usageCount,
28
28
  withRetry
29
- } from "./chunk-YXAKL5HM.js";
29
+ } from "./chunk-SF5JLMLG.js";
30
30
 
31
31
  // ../provider-openai/src/normalize.ts
32
32
  import OpenAI from "openai";
@@ -28,7 +28,7 @@ import {
28
28
  unknownUsageObservation,
29
29
  usdToMicros,
30
30
  withRetry
31
- } from "./chunk-YXAKL5HM.js";
31
+ } from "./chunk-SF5JLMLG.js";
32
32
 
33
33
  // ../provider-answer-services/src/core/http.ts
34
34
  var MAX_RESPONSE_BYTES = 8 * 1024 * 1024;
@@ -5,7 +5,7 @@ import {
5
5
  siteCrawlGraphNodes,
6
6
  siteCrawlPages,
7
7
  siteCrawlSnapshots
8
- } from "./chunk-O7WOCTBD.js";
8
+ } from "./chunk-PAIYFNNY.js";
9
9
  import {
10
10
  SITE_CRAWL_GRAPH_MAX_EDGES,
11
11
  SITE_CRAWL_GRAPH_MAX_NODES,
@@ -15,7 +15,7 @@ import {
15
15
  factorStatusFromDistribution,
16
16
  factorStatusFromScore,
17
17
  roundPreservingTotal
18
- } from "./chunk-YXAKL5HM.js";
18
+ } from "./chunk-SF5JLMLG.js";
19
19
 
20
20
  // src/site-audit-factors.ts
21
21
  function recordedSharePct(factor) {