@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.
- package/assets/assets/{AgentSetupPage-D39M9CRK.js → AgentSetupPage-D7YVdPWO.js} +1 -1
- package/assets/assets/{AuditHistoryPanel-BS-iFyHX.js → AuditHistoryPanel-yrgfS5B_.js} +1 -1
- package/assets/assets/{BacklinksPage-BW2bEGF4.js → BacklinksPage-DJM6z03g.js} +1 -1
- package/assets/assets/{HistoryPage-Dh6o2iVd.js → HistoryPage-CNvAVJ1S.js} +1 -1
- package/assets/assets/{MeasurementPropertyPage-DL9cbtVz.js → MeasurementPropertyPage-BVVYhOxR.js} +1 -1
- package/assets/assets/{ProjectPage-DXh97uDN.js → ProjectPage-CPRD8kR9.js} +1 -1
- package/assets/assets/{RunsPage-BM4ETLsm.js → RunsPage-Ck33dcjz.js} +1 -1
- package/assets/assets/{SettingsPage-DpJTB2-Q.js → SettingsPage-CS_t4Dai.js} +1 -1
- package/assets/assets/{SiteHealthSection-CmlMQ17V.js → SiteHealthSection-BurKnHpn.js} +2 -2
- package/assets/assets/ToneBadge-Df8oiKsQ.js +60 -0
- package/assets/assets/{TrafficPage-ClH3Dxnm.js → TrafficPage-DAiY698E.js} +1 -1
- package/assets/assets/{TrafficSourceDetailPage-DE-NyNGz.js → TrafficSourceDetailPage-clJSX2rr.js} +1 -1
- package/assets/assets/{account-context-BwV6ox8O.js → account-context-DDEhuoP2.js} +1 -1
- package/assets/assets/{card-DhkoBNyY.js → card-DbR-lBY3.js} +1 -1
- package/assets/assets/{extract-error-message-dNDtiSBo.js → extract-error-message-7_Vm2DQF.js} +1 -1
- package/assets/assets/{format-helpers-Bt4tx-f3.js → format-helpers-vtahpXTQ.js} +1 -1
- package/assets/assets/{index-MbApCekj.js → index-BIhCeXvc.js} +4 -4
- package/assets/assets/{query-client-D-zMw63p.js → query-client-TlFXYJ9o.js} +1 -1
- package/assets/assets/{react-query-EdiRRB2q.js → react-query-C5Mv8xfD.js} +1 -1
- package/assets/assets/{react-sigma_core.esm.min-Bidr1Gxk.js → react-sigma_core.esm.min-DmggJ7YC.js} +1 -1
- package/assets/assets/{service-BUi8JgGI.js → service-CLFURPuM.js} +1 -1
- package/assets/index.html +7 -7
- package/dist/{ads-FFUUMS4J.js → ads-TX5622SS.js} +3 -3
- package/dist/{agent-LCD2VG7C.js → agent-AIOQL66U.js} +7 -7
- package/dist/{agent-ask-OBHTCYFR.js → agent-ask-A6GIJTBX.js} +3 -3
- package/dist/{agent-conversations-VMZ4NFIX.js → agent-conversations-LHWLKOPQ.js} +3 -3
- package/dist/{agent-memory-UPFJFNWC.js → agent-memory-F54BPEYN.js} +3 -3
- package/dist/{agent-providers-4GOWLBZK.js → agent-providers-L74KZOSG.js} +3 -3
- package/dist/{agent-transcript-RGXIVZUP.js → agent-transcript-IH65H755.js} +3 -3
- package/dist/{analytics-FBK4XV5P.js → analytics-YWCY2KSY.js} +3 -3
- package/dist/{apply-Y2DVE3YB.js → apply-BLUUYG2N.js} +3 -3
- package/dist/{backfill-7SGCPH6J.js → backfill-6WO5CH6Z.js} +9 -9
- package/dist/{backlinks-YWHFC7DZ.js → backlinks-NC7AUGTK.js} +3 -3
- package/dist/{bing-7BP3DWPK.js → bing-WQUEYHVC.js} +3 -3
- package/dist/{bootstrap-Z7QSKVPL.js → bootstrap-AXZV4BBC.js} +10 -10
- package/dist/{cdp-OL6RENO3.js → cdp-DUG5PMUD.js} +7 -7
- package/dist/{chunk-J523Y7X2.js → chunk-2Y6MSB4J.js} +1 -1
- package/dist/{chunk-YFITKHCV.js → chunk-3ANSG6YT.js} +345 -337
- package/dist/{chunk-GA2EHZTI.js → chunk-3WPTMLQI.js} +22 -6
- package/dist/{chunk-QDN3FL2A.js → chunk-3YIKSZHN.js} +2 -1
- package/dist/{chunk-H4HNXCDF.js → chunk-4B6DE7BB.js} +2 -2
- package/dist/{chunk-UWBJWKDQ.js → chunk-4JMTDLFV.js} +2 -2
- package/dist/{chunk-QKMGGM4B.js → chunk-5PA7SJ2M.js} +8 -271
- package/dist/{chunk-JO73L677.js → chunk-6ATKY252.js} +2 -2
- package/dist/{chunk-XR6ZVMYK.js → chunk-6W5AR4IW.js} +1 -1
- package/dist/{chunk-IZMT4WLZ.js → chunk-6YW24AUN.js} +2 -2
- package/dist/chunk-AZQNJX3T.js +269 -0
- package/dist/{chunk-TUVG7BIF.js → chunk-B6R223HQ.js} +8 -8
- package/dist/{chunk-6MYHGP46.js → chunk-DLVGMRM5.js} +1 -1
- package/dist/{chunk-P3UGNR2Y.js → chunk-ETVM3T7K.js} +5 -5
- package/dist/{chunk-IV6VZ63E.js → chunk-F5D4GPZQ.js} +18 -14
- package/dist/{chunk-WJ2JU32O.js → chunk-GNBATQS3.js} +23 -6
- package/dist/{chunk-TEDY3MHN.js → chunk-GUFKUPKZ.js} +3 -3
- package/dist/{chunk-BADJCT6U.js → chunk-GWDMWKM6.js} +1 -1
- package/dist/{chunk-PPM6Z7CM.js → chunk-HEL6DKDN.js} +1 -1
- package/dist/{chunk-DFCKSJQI.js → chunk-HGMTGC34.js} +4 -4
- package/dist/{chunk-GPTRCOKV.js → chunk-HIGBV77K.js} +259 -95
- package/dist/{chunk-NZZWJCKS.js → chunk-HJHFW455.js} +3 -3
- package/dist/{chunk-JE5QURTR.js → chunk-HKV4UWG5.js} +1 -1
- package/dist/{chunk-DRGCVTYH.js → chunk-JPM3VC6A.js} +1 -1
- package/dist/{chunk-TOX6HAQJ.js → chunk-JQNVNB63.js} +3 -3
- package/dist/{chunk-3AG3LPZX.js → chunk-MRSNLKSM.js} +1 -1
- package/dist/{chunk-O7WOCTBD.js → chunk-PAIYFNNY.js} +71 -3
- package/dist/{chunk-MJYO6UK2.js → chunk-PRSQ4R47.js} +2 -2
- package/dist/{chunk-JEBY6MS6.js → chunk-QS6RIP37.js} +1 -1
- package/dist/{chunk-4LTL5RNY.js → chunk-S77W2XSI.js} +4 -4
- package/dist/{chunk-YXAKL5HM.js → chunk-SF5JLMLG.js} +6791 -6777
- package/dist/{chunk-Q25JQANW.js → chunk-T5PWWDMJ.js} +17 -2
- package/dist/{chunk-ATT3ZCSS.js → chunk-WH2M2MQF.js} +38 -16
- package/dist/{chunk-7KOAP47B.js → chunk-WLWOGBLJ.js} +363 -248
- package/dist/{chunk-BZZDFIY2.js → chunk-XDQJOZKJ.js} +1 -1
- package/dist/{citations-RVSC67GE.js → citations-FUZ6DGP5.js} +3 -3
- package/dist/{cli-catalog-NEZE5QU5.js → cli-catalog-BXHG544D.js} +3 -3
- package/dist/{cli-commands-HGCYU4MQ.js → cli-commands-GMOR67F5.js} +7 -7
- package/dist/cli.js +13 -13
- package/dist/{competitor-BX3M3OYS.js → competitor-QDCH7PLT.js} +3 -3
- package/dist/{content-PKJMVMHJ.js → content-JX2CPIPR.js} +3 -3
- package/dist/{dashboard-SVHZBVM6.js → dashboard-OOWMLMKV.js} +6 -6
- package/dist/{demo-HYDPECCK.js → demo-GKSMSKOY.js} +1 -1
- package/dist/{demo-server-KEOO7WFO.js → demo-server-UQO4XKHN.js} +12 -11
- package/dist/{discover-JDP44ZHX.js → discover-YQSVQRUV.js} +3 -3
- package/dist/{discover-eval-6ORCVYYR.js → discover-eval-FN5RL6QI.js} +3 -3
- package/dist/{doctor-TVZRMBSS.js → doctor-YHJLAEJJ.js} +3 -3
- package/dist/{evidence-FNIAFBBG.js → evidence-KUPZMBIK.js} +3 -3
- package/dist/{export-cmd-HQNF2SSD.js → export-cmd-YSEPTUUF.js} +3 -3
- package/dist/{ga-PIO5OXMK.js → ga-WNS7Q7TF.js} +3 -3
- package/dist/{gbp-3R5FME43.js → gbp-5NYFK4TW.js} +3 -3
- package/dist/{google-BYZREX2O.js → google-T4CF4WCI.js} +4 -4
- package/dist/{google-marketing-SPQ2GW6X.js → google-marketing-IXPMUBXZ.js} +1 -1
- package/dist/{health-cmd-HH5RYMSV.js → health-cmd-2W37CF6J.js} +3 -3
- package/dist/{history-Q35NLLMJ.js → history-PA3O6ZHX.js} +3 -3
- package/dist/index.d.ts +248 -71
- package/dist/index.js +25 -24
- package/dist/{init-TV4ZKAAW.js → init-I3P7FINF.js} +12 -11
- package/dist/{insights-SH73B4PD.js → insights-O5PUVHTW.js} +3 -3
- package/dist/intelligence-service-EJQQNO65.js +16 -0
- package/dist/{journeys-SIV7HPW7.js → journeys-GU34O3HE.js} +3 -3
- package/dist/{keys-O656YWSW.js → keys-RXBFRNUS.js} +3 -3
- package/dist/{keyword-FZ2N4EW7.js → keyword-MASR36DK.js} +3 -3
- package/dist/{logs-2NPN7HBI.js → logs-OTA7MV4P.js} +3 -3
- package/dist/mcp-ZQYN2NET.js +19 -0
- package/dist/mcp.js +20 -14
- package/dist/{measurement-plan-JQKVSJRL.js → measurement-plan-ZGVO36TN.js} +5 -5
- package/dist/{notify-VTAYBHC6.js → notify-KS5CR3S2.js} +3 -3
- package/dist/{organic-evidence-HPXXEPOW.js → organic-evidence-CTH52AC5.js} +3 -3
- package/dist/{overview-FSBNDYZJ.js → overview-IRCIDE5H.js} +4 -4
- package/dist/{project-MAPPXURS.js → project-H5XPI5CT.js} +3 -3
- package/dist/{query-R6DLPIPJ.js → query-2R6EZG5T.js} +3 -3
- package/dist/{research-FXKOEUQB.js → research-OA3UQAV3.js} +3 -3
- package/dist/{results-export-X2PUM63S.js → results-export-XUXU3WMX.js} +3 -3
- package/dist/{run-6ENTG4IO.js → run-7IIOB6AS.js} +4 -4
- package/dist/{schedule-DMMVRT7P.js → schedule-DUTPZB5C.js} +3 -3
- package/dist/{search-FHI6APT7.js → search-TWUJD7KH.js} +3 -3
- package/dist/{serve-76BGQFPW.js → serve-BYHHULUU.js} +26 -25
- package/dist/{session-JBTIV7SS.js → session-M5XSTGPI.js} +13 -12
- package/dist/{settings-FMB4QED4.js → settings-GQXU5M3H.js} +3 -3
- package/dist/{skills-HBIMHSOI.js → skills-F6AXQHTO.js} +2 -2
- package/dist/{snapshot-RBA2EL7R.js → snapshot-QFKUO4QK.js} +3 -3
- package/dist/{src-BXXGJOQB.js → src-52USCS7O.js} +4 -2
- package/dist/{status-ATFDFAVG.js → status-42LPR7YH.js} +4 -4
- package/dist/{technical-aeo-JWQTGCTB.js → technical-aeo-SUILL4MY.js} +3 -3
- package/dist/{telemetry-6QFGJL2I.js → telemetry-RITB7YZH.js} +4 -4
- package/dist/{tools-4VRHKUBE.js → tools-DGWJOLNS.js} +11 -11
- package/dist/{traffic-5R7M4CK5.js → traffic-3YC3HUNT.js} +5 -5
- package/dist/{users-24TIUYJY.js → users-BST5DQ5R.js} +3 -3
- package/dist/{visibility-stats-YLQPPBJJ.js → visibility-stats-NCNP4AL2.js} +3 -3
- package/dist/{wordpress-7VDPHMUZ.js → wordpress-4HQDLQVE.js} +3 -3
- package/package.json +10 -6
- package/assets/assets/ToneBadge-CmvL5mFG.js +0 -60
- package/dist/intelligence-service-YNHDEY4M.js +0 -15
- package/dist/mcp-RHQY3DV6.js +0 -14
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getRequestContext
|
|
3
|
+
} from "./chunk-GWDMWKM6.js";
|
|
4
|
+
import {
|
|
5
|
+
diagnosticIdentity,
|
|
6
|
+
redactLogString,
|
|
7
|
+
redactLogValue
|
|
8
|
+
} from "./chunk-SF5JLMLG.js";
|
|
9
|
+
|
|
10
|
+
// ../api-routes/src/runtime-logger.ts
|
|
11
|
+
import { format } from "util";
|
|
12
|
+
var IS_TTY = process.stdout.isTTY === true;
|
|
13
|
+
var MAX_IDENTITY_LENGTH = 512;
|
|
14
|
+
var RESERVED_FIELDS = /* @__PURE__ */ new Set([
|
|
15
|
+
"ts",
|
|
16
|
+
"level",
|
|
17
|
+
"module",
|
|
18
|
+
"action",
|
|
19
|
+
"msg",
|
|
20
|
+
"requestId",
|
|
21
|
+
"actor",
|
|
22
|
+
"credentialId",
|
|
23
|
+
"userAgent",
|
|
24
|
+
"actorSession",
|
|
25
|
+
"__runtimeRequestId"
|
|
26
|
+
]);
|
|
27
|
+
var listeners = /* @__PURE__ */ new Set();
|
|
28
|
+
function addLogListener(listener) {
|
|
29
|
+
listeners.add(listener);
|
|
30
|
+
return () => listeners.delete(listener);
|
|
31
|
+
}
|
|
32
|
+
function createLogger(module) {
|
|
33
|
+
const emit = (level, action, context) => {
|
|
34
|
+
const msg = context ? safeProperty(context, "msg") : void 0;
|
|
35
|
+
emitRuntimeLog({ level, module, action, context, ...typeof msg === "string" ? { msg } : {} });
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
info: (action, ctx) => emit("info", action, ctx),
|
|
39
|
+
warn: (action, ctx) => emit("warn", action, ctx),
|
|
40
|
+
error: (action, ctx) => emit("error", action, ctx)
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function createFastifyLogger(options = {}) {
|
|
44
|
+
return buildFastifyLogger(options.module ?? "HTTP", options.enabled !== false, {});
|
|
45
|
+
}
|
|
46
|
+
var LEVELS = { trace: 10, debug: 20, info: 30, warn: 40, error: 50, fatal: 60, silent: Infinity };
|
|
47
|
+
function buildFastifyLogger(module, enabled, bindings, inheritedLevel = "info") {
|
|
48
|
+
let level = inheritedLevel;
|
|
49
|
+
const emit = (severity, args) => {
|
|
50
|
+
if (LEVELS[severity] >= LEVELS[level]) logFastify(severity, module, enabled, bindings, args);
|
|
51
|
+
};
|
|
52
|
+
const logger = {
|
|
53
|
+
get level() {
|
|
54
|
+
return level;
|
|
55
|
+
},
|
|
56
|
+
set level(value) {
|
|
57
|
+
if (Object.hasOwn(LEVELS, value)) level = value;
|
|
58
|
+
},
|
|
59
|
+
trace: (...args) => emit("trace", args),
|
|
60
|
+
debug: (...args) => emit("debug", args),
|
|
61
|
+
info: (...args) => emit("info", args),
|
|
62
|
+
warn: (...args) => emit("warn", args),
|
|
63
|
+
error: (...args) => emit("error", args),
|
|
64
|
+
fatal: (...args) => emit("fatal", args),
|
|
65
|
+
silent: () => void 0,
|
|
66
|
+
child: (childBindings) => buildFastifyLogger(module, enabled, mergeBindings(bindings, childBindings), level)
|
|
67
|
+
};
|
|
68
|
+
return logger;
|
|
69
|
+
}
|
|
70
|
+
function logFastify(level, module, enabled, bindings, args) {
|
|
71
|
+
const { context, msg } = normalizePinoArgs(args);
|
|
72
|
+
emitRuntimeLog({
|
|
73
|
+
level,
|
|
74
|
+
module,
|
|
75
|
+
action: `fastify.${level}`,
|
|
76
|
+
msg,
|
|
77
|
+
context: { ...bindings, ...context },
|
|
78
|
+
trustedRequestId: asBoundString(bindings.__runtimeRequestId),
|
|
79
|
+
enabled
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
function normalizePinoArgs(args) {
|
|
83
|
+
const first = args[0];
|
|
84
|
+
const second = args[1];
|
|
85
|
+
if (typeof first === "string") return { context: {}, msg: safeFormat(first, args.slice(1)) };
|
|
86
|
+
if (first instanceof Error) {
|
|
87
|
+
return { context: { err: first }, msg: typeof second === "string" ? safeFormat(second, args.slice(2)) : void 0 };
|
|
88
|
+
}
|
|
89
|
+
if (isObject(first)) {
|
|
90
|
+
return { context: copyOwnData(first), msg: typeof second === "string" ? safeFormat(second, args.slice(2)) : void 0 };
|
|
91
|
+
}
|
|
92
|
+
return { context: {}, msg: typeof second === "string" ? safeFormat(second, args.slice(2)) : void 0 };
|
|
93
|
+
}
|
|
94
|
+
function emitRuntimeLog({
|
|
95
|
+
level,
|
|
96
|
+
module,
|
|
97
|
+
action,
|
|
98
|
+
msg,
|
|
99
|
+
context,
|
|
100
|
+
trustedRequestId,
|
|
101
|
+
enabled = true
|
|
102
|
+
}) {
|
|
103
|
+
const safeContext = sanitizeContext(context);
|
|
104
|
+
const error = safeContext.err ?? safeContext.error;
|
|
105
|
+
const errorMessage = typeof error === "string" ? error : isRecord(error) && typeof error.message === "string" ? error.message : void 0;
|
|
106
|
+
const message = errorMessage && errorMessage !== msg ? [msg, errorMessage].filter(Boolean).join(": ") : msg;
|
|
107
|
+
const entry = {
|
|
108
|
+
ts: (/* @__PURE__ */ new Date()).toISOString(),
|
|
109
|
+
level,
|
|
110
|
+
module: boundText(module, "Runtime"),
|
|
111
|
+
action: boundText(action, "log"),
|
|
112
|
+
...message === void 0 ? {} : { msg: redactLogString(message) },
|
|
113
|
+
...safeContext,
|
|
114
|
+
...trustedAttribution(getRequestContext(trustedRequestId), trustedRequestId)
|
|
115
|
+
};
|
|
116
|
+
if (enabled) writeEntry(entry);
|
|
117
|
+
for (const listener of listeners) {
|
|
118
|
+
try {
|
|
119
|
+
listener(entry);
|
|
120
|
+
} catch {
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function sanitizeContext(context) {
|
|
125
|
+
if (!context) return {};
|
|
126
|
+
const output = {};
|
|
127
|
+
for (const key of safeKeys(context).slice(0, 100)) {
|
|
128
|
+
if (RESERVED_FIELDS.has(key)) continue;
|
|
129
|
+
const value = safeProperty(context, key);
|
|
130
|
+
if (key === "req" || key === "request") {
|
|
131
|
+
Object.assign(output, normalizeRequest(value));
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (key === "res" || key === "reply") {
|
|
135
|
+
Object.assign(output, normalizeReply(value));
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
if (key === "responseTime" || key === "duration") {
|
|
139
|
+
if (typeof value === "number" && Number.isFinite(value)) output.durationMs = value;
|
|
140
|
+
continue;
|
|
141
|
+
}
|
|
142
|
+
output[key] = value;
|
|
143
|
+
}
|
|
144
|
+
delete output.__runtimeRequestId;
|
|
145
|
+
const redacted = redactLogValue(output);
|
|
146
|
+
return isRecord(redacted) ? redacted : {};
|
|
147
|
+
}
|
|
148
|
+
function trustedAttribution(context, trustedRequestId) {
|
|
149
|
+
const requestId = boundOptional(context?.requestId) ?? trustedRequestId;
|
|
150
|
+
const actor = diagnosticIdentity("actor", context?.actor);
|
|
151
|
+
const credentialId = diagnosticIdentity("credentialId", context?.credentialId);
|
|
152
|
+
const userAgent = boundOptional(context?.userAgent);
|
|
153
|
+
const actorSession = boundOptional(context?.actorSession);
|
|
154
|
+
const method = boundOptional(context?.method);
|
|
155
|
+
const route = boundOptional(context?.route);
|
|
156
|
+
return {
|
|
157
|
+
...requestId ? { requestId } : {},
|
|
158
|
+
...actor ? { actor } : {},
|
|
159
|
+
...credentialId ? { credentialId } : {},
|
|
160
|
+
...userAgent ? { userAgent } : {},
|
|
161
|
+
...actorSession ? { actorSession } : {},
|
|
162
|
+
...method ? { method } : {},
|
|
163
|
+
...route ? { route } : {},
|
|
164
|
+
...context?.statusCode === void 0 ? {} : { statusCode: context.statusCode }
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
function mergeBindings(parent, child) {
|
|
168
|
+
const merged = { ...parent };
|
|
169
|
+
if (!isObject(child)) return merged;
|
|
170
|
+
for (const key of safeKeys(child).slice(0, 100)) {
|
|
171
|
+
const value = safeProperty(child, key);
|
|
172
|
+
if (key === "req" || key === "request") Object.assign(merged, normalizeRequest(value));
|
|
173
|
+
else if (key === "res" || key === "reply") Object.assign(merged, normalizeReply(value));
|
|
174
|
+
else if (key === "reqId") {
|
|
175
|
+
merged.reqId = value;
|
|
176
|
+
merged.__runtimeRequestId = value;
|
|
177
|
+
} else if (!RESERVED_FIELDS.has(key)) merged[key] = value;
|
|
178
|
+
}
|
|
179
|
+
return merged;
|
|
180
|
+
}
|
|
181
|
+
function normalizeRequest(value) {
|
|
182
|
+
if (!isObject(value)) return {};
|
|
183
|
+
const id = asBoundString(safeProperty(value, "id"));
|
|
184
|
+
const method = asBoundString(safeProperty(value, "method"));
|
|
185
|
+
const routeOptions = safeProperty(value, "routeOptions");
|
|
186
|
+
const route = isObject(routeOptions) ? asBoundString(safeProperty(routeOptions, "url")) : void 0;
|
|
187
|
+
return {
|
|
188
|
+
...id ? { reqId: id, __runtimeRequestId: id } : {},
|
|
189
|
+
...method ? { method } : {},
|
|
190
|
+
...route ? { route } : {}
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
function normalizeReply(value) {
|
|
194
|
+
if (!isObject(value)) return {};
|
|
195
|
+
const statusCode = safeProperty(value, "statusCode");
|
|
196
|
+
return typeof statusCode === "number" && Number.isFinite(statusCode) ? { statusCode } : {};
|
|
197
|
+
}
|
|
198
|
+
function writeEntry(entry) {
|
|
199
|
+
const stream = entry.level === "error" || entry.level === "fatal" ? process.stderr : process.stdout;
|
|
200
|
+
const line = IS_TTY ? formatTTY(entry) : JSON.stringify(entry);
|
|
201
|
+
try {
|
|
202
|
+
stream.write(`${line}
|
|
203
|
+
`);
|
|
204
|
+
} catch {
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function formatTTY(entry) {
|
|
208
|
+
const { ts, level, module, action, msg, ...context } = entry;
|
|
209
|
+
const levelTag = level === "fatal" || level === "error" ? "ERR" : level === "warn" ? "WRN" : "INF";
|
|
210
|
+
const parts = safeKeys(context).map((key) => `${key}=${safeDisplay(safeProperty(context, key))}`);
|
|
211
|
+
return `${ts.slice(11, 19)} ${levelTag} [${module}] ${action}${msg ? ` ${msg}` : ""}${parts.length ? ` ${parts.join(" ")}` : ""}`;
|
|
212
|
+
}
|
|
213
|
+
function safeDisplay(value) {
|
|
214
|
+
try {
|
|
215
|
+
return typeof value === "string" ? value : JSON.stringify(value);
|
|
216
|
+
} catch {
|
|
217
|
+
return "[UNSERIALIZABLE]";
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
function safeFormat(message, args) {
|
|
221
|
+
try {
|
|
222
|
+
return args.length ? format(message, ...args) : message;
|
|
223
|
+
} catch {
|
|
224
|
+
return message;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function isObject(value) {
|
|
228
|
+
return value !== null && typeof value === "object";
|
|
229
|
+
}
|
|
230
|
+
function isRecord(value) {
|
|
231
|
+
return isObject(value) && !Array.isArray(value);
|
|
232
|
+
}
|
|
233
|
+
function safeKeys(value) {
|
|
234
|
+
try {
|
|
235
|
+
return Object.keys(value);
|
|
236
|
+
} catch {
|
|
237
|
+
return [];
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
function safeProperty(value, key) {
|
|
241
|
+
try {
|
|
242
|
+
const descriptor = Object.getOwnPropertyDescriptor(value, key);
|
|
243
|
+
return descriptor && "value" in descriptor ? descriptor.value : void 0;
|
|
244
|
+
} catch {
|
|
245
|
+
return void 0;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function copyOwnData(value) {
|
|
249
|
+
const output = {};
|
|
250
|
+
for (const key of safeKeys(value)) output[key] = safeProperty(value, key);
|
|
251
|
+
return output;
|
|
252
|
+
}
|
|
253
|
+
function boundText(value, fallback) {
|
|
254
|
+
return boundOptional(value) ?? fallback;
|
|
255
|
+
}
|
|
256
|
+
function asBoundString(value) {
|
|
257
|
+
return typeof value === "string" ? boundOptional(value) : void 0;
|
|
258
|
+
}
|
|
259
|
+
function boundOptional(value) {
|
|
260
|
+
if (typeof value !== "string") return void 0;
|
|
261
|
+
const redacted = redactLogString(value).replace(/[\r\n]+/g, " ").trim().slice(0, MAX_IDENTITY_LENGTH);
|
|
262
|
+
return redacted || void 0;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
export {
|
|
266
|
+
addLogListener,
|
|
267
|
+
createLogger,
|
|
268
|
+
createFastifyLogger
|
|
269
|
+
};
|
|
@@ -7,27 +7,27 @@ import {
|
|
|
7
7
|
reparseStoredResult4,
|
|
8
8
|
reparseStoredResult5,
|
|
9
9
|
resolveStoredApiResponse
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-6ATKY252.js";
|
|
11
11
|
import {
|
|
12
12
|
loadConfig
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-HKV4UWG5.js";
|
|
14
14
|
import {
|
|
15
15
|
isMachineFormat
|
|
16
16
|
} from "./chunk-HGMYEDAQ.js";
|
|
17
17
|
import {
|
|
18
18
|
determineCitationState
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-JPM3VC6A.js";
|
|
20
20
|
import {
|
|
21
21
|
backfillProjectAnswerMentions,
|
|
22
22
|
competitorIdentityColumns,
|
|
23
23
|
createRunCompetitorResolver,
|
|
24
24
|
readMarketCompetitorNames,
|
|
25
25
|
refreshSnapshotMentionIdentity
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-WLWOGBLJ.js";
|
|
27
27
|
import {
|
|
28
28
|
classifyAiUserFetch,
|
|
29
29
|
classifyCrawler
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-QS6RIP37.js";
|
|
31
31
|
import {
|
|
32
32
|
aiUserFetchEventsHourly,
|
|
33
33
|
auditLog,
|
|
@@ -42,7 +42,7 @@ import {
|
|
|
42
42
|
querySnapshots,
|
|
43
43
|
rawEventSamples,
|
|
44
44
|
runs
|
|
45
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-PAIYFNNY.js";
|
|
46
46
|
import {
|
|
47
47
|
ProviderNames,
|
|
48
48
|
RetrievalContracts,
|
|
@@ -59,7 +59,7 @@ import {
|
|
|
59
59
|
extractRecommendedCompetitors,
|
|
60
60
|
normalizeUrlPath,
|
|
61
61
|
openRouterRouteModel
|
|
62
|
-
} from "./chunk-
|
|
62
|
+
} from "./chunk-SF5JLMLG.js";
|
|
63
63
|
|
|
64
64
|
// src/commands/backfill.ts
|
|
65
65
|
import { setImmediate as yieldToEventLoop } from "timers/promises";
|
|
@@ -437,7 +437,7 @@ No DB writes performed. Re-run without --dry-run to apply.`);
|
|
|
437
437
|
}
|
|
438
438
|
}
|
|
439
439
|
async function backfillInsightsCommand(project, opts) {
|
|
440
|
-
const { IntelligenceService } = await import("./intelligence-service-
|
|
440
|
+
const { IntelligenceService } = await import("./intelligence-service-EJQQNO65.js");
|
|
441
441
|
const config = loadConfig();
|
|
442
442
|
const db = createClient(config.database);
|
|
443
443
|
migrate(db);
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runWithUsageTags
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WH2M2MQF.js";
|
|
4
4
|
import {
|
|
5
5
|
CanonryMcpToolNames,
|
|
6
6
|
canonryMcpTools
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-3WPTMLQI.js";
|
|
8
8
|
import {
|
|
9
9
|
CliError
|
|
10
10
|
} from "./chunk-HGMYEDAQ.js";
|
|
11
11
|
import {
|
|
12
12
|
buildOpenApiDocument
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-WLWOGBLJ.js";
|
|
14
14
|
import {
|
|
15
15
|
DEFAULT_COMPETITOR_AUTO_ALIAS_MODE,
|
|
16
16
|
MeasurementPortfolioLists,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
seoDatasetWithoutVendor,
|
|
24
24
|
seoProviderSchema,
|
|
25
25
|
truncateUtf16
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-SF5JLMLG.js";
|
|
27
27
|
|
|
28
28
|
// src/agent/tools.ts
|
|
29
29
|
import { Type as Type2 } from "@earendil-works/pi-ai";
|
|
@@ -884,7 +884,7 @@ function refuseCompetitorBulkAddAcknowledgement(tool) {
|
|
|
884
884
|
};
|
|
885
885
|
}
|
|
886
886
|
function buildMcpAgentTools(registry, ctx, opts = {}) {
|
|
887
|
-
return registry.filter((tool) => !AERO_EXCLUDED_MCP_TOOLS.has(tool.name)).filter((tool) => opts.includeNames ? opts.includeNames.has(tool.name) : true).filter((tool) => opts.readOnly ? tool.access === "read" : true).filter((tool) => opts.managedSweeps ? !AERO_MANAGED_SWEEP_MCP_TOOLS.has(tool.name) : true).map((tool) => {
|
|
887
|
+
return registry.filter((tool) => !AERO_EXCLUDED_MCP_TOOLS.has(tool.name) && !tool.requiresConnectionProfile).filter((tool) => opts.includeNames ? opts.includeNames.has(tool.name) : true).filter((tool) => opts.readOnly ? tool.access === "read" : true).filter((tool) => opts.managedSweeps ? !AERO_MANAGED_SWEEP_MCP_TOOLS.has(tool.name) : true).map((tool) => {
|
|
888
888
|
const agentTool = mcpToAgentTool(tool, ctx);
|
|
889
889
|
if (COMPETITOR_AUTO_ALIAS_MODE_WRITES.has(tool.name)) return refuseCompetitorAutoAliasModeChange(agentTool, ctx);
|
|
890
890
|
if (tool.name === "canonry_competitors_add") return refuseCompetitorBulkAddAcknowledgement(agentTool);
|
|
@@ -6,12 +6,12 @@ import {
|
|
|
6
6
|
import {
|
|
7
7
|
createApiClient,
|
|
8
8
|
runWithUsageTags
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-WH2M2MQF.js";
|
|
10
10
|
import {
|
|
11
11
|
canonryMcpTools,
|
|
12
12
|
mcpOutputSchema,
|
|
13
13
|
toolOperationAccess
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-3WPTMLQI.js";
|
|
15
15
|
import {
|
|
16
16
|
PACKAGE_VERSION
|
|
17
17
|
} from "./chunk-AOJU5LKX.js";
|
|
@@ -24,11 +24,11 @@ import {
|
|
|
24
24
|
isReadOnlyKey,
|
|
25
25
|
restrictedWriteScopes,
|
|
26
26
|
upgradeCaveatFor
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-SF5JLMLG.js";
|
|
28
28
|
|
|
29
29
|
// src/mcp/server.ts
|
|
30
30
|
import { randomUUID } from "crypto";
|
|
31
|
-
import { McpServer } from "@modelcontextprotocol/
|
|
31
|
+
import { CLIENT_INFO_META_KEY, McpServer } from "@modelcontextprotocol/server";
|
|
32
32
|
import { z } from "zod";
|
|
33
33
|
|
|
34
34
|
// src/mcp/results.ts
|
|
@@ -452,7 +452,7 @@ ${updateNoticeInstructions(update)}` : SERVER_INSTRUCTIONS
|
|
|
452
452
|
});
|
|
453
453
|
server.validateToolInput = async (_tool, args) => args;
|
|
454
454
|
const entries = [];
|
|
455
|
-
for (const registryTool of getCanonryMcpTools(scope, options.tiers, options.credentialScopes, options.operator)) {
|
|
455
|
+
for (const registryTool of getCanonryMcpTools(scope, options.tiers, options.credentialScopes, options.operator, options.connectionProfile)) {
|
|
456
456
|
const tool = registryTool;
|
|
457
457
|
const handler = tool.handler;
|
|
458
458
|
const registered = server.registerTool(
|
|
@@ -464,12 +464,16 @@ ${updateNoticeInstructions(update)}` : SERVER_INSTRUCTIONS
|
|
|
464
464
|
outputSchema: tool.outputSchema ? mcpOutputSchema(tool.outputSchema) : void 0,
|
|
465
465
|
annotations: tool.annotations
|
|
466
466
|
},
|
|
467
|
-
async (input) => withToolErrors(async () => {
|
|
467
|
+
async (input, context) => withToolErrors(async () => {
|
|
468
468
|
const parsed = tool.inputSchema.parse(input ?? {});
|
|
469
|
+
const envelope = context.mcpReq.envelope;
|
|
470
|
+
const identity = envelope && CLIENT_INFO_META_KEY in envelope ? envelope[CLIENT_INFO_META_KEY] : void 0;
|
|
471
|
+
const clientName = typeof identity === "object" && identity !== null && "name" in identity && typeof identity.name === "string" ? identity.name : server.server.getClientVersion()?.name;
|
|
469
472
|
return runWithUsageTags(client, {
|
|
470
473
|
mcpTool: tool.name,
|
|
471
474
|
mcpCall: randomUUID(),
|
|
472
|
-
mcpClient:
|
|
475
|
+
mcpClient: clientName,
|
|
476
|
+
signal: context.mcpReq.signal
|
|
473
477
|
}, () => handler(client, parsed));
|
|
474
478
|
})
|
|
475
479
|
);
|
|
@@ -500,8 +504,8 @@ function registerMetaTools(server, catalog, opts) {
|
|
|
500
504
|
{
|
|
501
505
|
title: "Guide a Canonry workflow",
|
|
502
506
|
description: "Start here: route an intent to available stored-evidence tools, separately listed actions requiring approval, and workflow guidance. No provider calls or installation required. Optionally include full toolkit details.",
|
|
503
|
-
inputSchema: helpInputSchema
|
|
504
|
-
annotations: { readOnlyHint: true, idempotentHint: true, openWorldHint: false }
|
|
507
|
+
inputSchema: helpInputSchema,
|
|
508
|
+
annotations: { readOnlyHint: true, idempotentHint: true, destructiveHint: false, openWorldHint: false }
|
|
505
509
|
},
|
|
506
510
|
async (input) => {
|
|
507
511
|
try {
|
|
@@ -522,9 +526,9 @@ function registerMetaTools(server, catalog, opts) {
|
|
|
522
526
|
"canonry_load_toolkit",
|
|
523
527
|
{
|
|
524
528
|
title: "Load a Canonry MCP toolkit",
|
|
525
|
-
description: `Register a toolkit's tools for this session and emit one notifications/tools/list_changed. Idempotent. Loaded toolkits remain loaded for the rest of the session. Wait for this call to return before calling any newly enabled tool \u2014 pipelining the call with a tools/call on the same connection can race the registration and fail with "
|
|
526
|
-
inputSchema: loadToolkitInputSchema
|
|
527
|
-
annotations: { readOnlyHint: false, idempotentHint: true, destructiveHint: false }
|
|
529
|
+
description: `Register a toolkit's tools for this session and emit one notifications/tools/list_changed. Idempotent. Loaded toolkits remain loaded for the rest of the session. Wait for this call to return before calling any newly enabled tool \u2014 pipelining the call with a tools/call on the same connection can race the registration and fail with "Tool ... disabled".`,
|
|
530
|
+
inputSchema: loadToolkitInputSchema,
|
|
531
|
+
annotations: { readOnlyHint: false, idempotentHint: true, destructiveHint: false, openWorldHint: false }
|
|
528
532
|
},
|
|
529
533
|
async (input) => withToolErrors(async () => {
|
|
530
534
|
const parsed = loadToolkitInputSchema.parse(input ?? {});
|
|
@@ -532,10 +536,10 @@ function registerMetaTools(server, catalog, opts) {
|
|
|
532
536
|
})
|
|
533
537
|
);
|
|
534
538
|
}
|
|
535
|
-
function getCanonryMcpTools(scope = "all", tiers, credentialScopes, operator = false) {
|
|
539
|
+
function getCanonryMcpTools(scope = "all", tiers, credentialScopes, operator = false, connectionProfile = false) {
|
|
536
540
|
const readOnly = scope === "read-only" || credentialScopes !== void 0 && isReadOnlyKey(credentialScopes);
|
|
537
541
|
const restricted = credentialScopes && restrictedWriteScopes(credentialScopes);
|
|
538
|
-
const authorized = canonryMcpTools.filter((tool) => !tool.requiresOperator || operator);
|
|
542
|
+
const authorized = canonryMcpTools.filter((tool) => (!tool.requiresOperator || operator) && (!tool.requiresConnectionProfile || connectionProfile));
|
|
539
543
|
const byScope = scope === "stored-only" ? authorized.filter((tool) => toolOperationAccess(tool) === OperationAccesses.stored) : readOnly ? authorized.filter((tool) => tool.access === "read") : authorized.filter((tool) => {
|
|
540
544
|
if (!restricted || tool.access === "read") return true;
|
|
541
545
|
if (tool.requiredScope && restricted.includes(tool.requiredScope)) return true;
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
isStoredPageReadTool,
|
|
6
6
|
isStoredReadTool,
|
|
7
7
|
truncateToolResult
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-ETVM3T7K.js";
|
|
9
9
|
import {
|
|
10
10
|
CANONRY_MCP_TOOLKITS
|
|
11
11
|
} from "./chunk-NDTU7FGL.js";
|
|
@@ -22,15 +22,18 @@ import {
|
|
|
22
22
|
resolveApiKeyFor,
|
|
23
23
|
resolveModelForProvider,
|
|
24
24
|
validateAgentProviderRegistry
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-HKV4UWG5.js";
|
|
26
26
|
import {
|
|
27
27
|
CanonryMcpToolNames,
|
|
28
28
|
canonryMcpTools
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-3WPTMLQI.js";
|
|
30
|
+
import {
|
|
31
|
+
createLogger
|
|
32
|
+
} from "./chunk-AZQNJX3T.js";
|
|
30
33
|
import {
|
|
31
34
|
agentToolEvents,
|
|
32
35
|
llmUsageEvents
|
|
33
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-PAIYFNNY.js";
|
|
34
37
|
import {
|
|
35
38
|
MeasurementPortfolioLists,
|
|
36
39
|
SeoCapabilities,
|
|
@@ -39,7 +42,7 @@ import {
|
|
|
39
42
|
describeError,
|
|
40
43
|
validationError,
|
|
41
44
|
visibilityReportRequestSchema
|
|
42
|
-
} from "./chunk-
|
|
45
|
+
} from "./chunk-SF5JLMLG.js";
|
|
43
46
|
|
|
44
47
|
// src/agent/session.ts
|
|
45
48
|
import fs3 from "fs";
|
|
@@ -796,6 +799,20 @@ async function readAeroViewEvidence(options) {
|
|
|
796
799
|
const evidence = agentVisibilityEvidence(report, projectName, (/* @__PURE__ */ new Date()).toISOString());
|
|
797
800
|
return { ...evidence, source: { ...evidence.source, href: `${base}/${evidence.source.path}` } };
|
|
798
801
|
}
|
|
802
|
+
var log = createLogger("AeroView");
|
|
803
|
+
async function readAeroViewEvidenceForTurn(options, signal) {
|
|
804
|
+
try {
|
|
805
|
+
return await readAeroViewEvidence(options);
|
|
806
|
+
} catch (err) {
|
|
807
|
+
if (signal?.aborted || err?.code !== "NOT_FOUND") throw err;
|
|
808
|
+
log.warn("view-evidence.not-found", {
|
|
809
|
+
projectName: options.projectName,
|
|
810
|
+
view: options.context?.view ?? "visibility",
|
|
811
|
+
error: err instanceof Error ? err.message : String(err)
|
|
812
|
+
});
|
|
813
|
+
return void 0;
|
|
814
|
+
}
|
|
815
|
+
}
|
|
799
816
|
function buildAeroViewTool(options, validatedEvidence) {
|
|
800
817
|
return {
|
|
801
818
|
name: "aero_inspect_view",
|
|
@@ -1061,7 +1078,7 @@ export {
|
|
|
1061
1078
|
setAeroSystemPrompt,
|
|
1062
1079
|
aeroTurnUsage,
|
|
1063
1080
|
aeroTurnStatus,
|
|
1064
|
-
|
|
1081
|
+
readAeroViewEvidenceForTurn,
|
|
1065
1082
|
buildAeroViewTool,
|
|
1066
1083
|
aeroViewPrompt,
|
|
1067
1084
|
loadAeroSystemPrompt,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createApiClient
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-WH2M2MQF.js";
|
|
4
4
|
import {
|
|
5
5
|
emitJsonl
|
|
6
6
|
} from "./chunk-Z7IUAJOF.js";
|
|
7
7
|
import {
|
|
8
8
|
measurementDraftOperationSchema,
|
|
9
9
|
runMeasurementDraftAction
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-MRSNLKSM.js";
|
|
11
11
|
import {
|
|
12
12
|
isMachineFormat,
|
|
13
13
|
systemError
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
unattributedAnswersLabel,
|
|
38
38
|
uncheckedSourcesLabel,
|
|
39
39
|
visibilityReportRequestSchema
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-SF5JLMLG.js";
|
|
41
41
|
|
|
42
42
|
// src/commands/measurement-plan.ts
|
|
43
43
|
import crypto from "crypto";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
registeredProviderNames
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DLVGMRM5.js";
|
|
4
4
|
import {
|
|
5
5
|
configExists,
|
|
6
6
|
loadConfigRaw
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HKV4UWG5.js";
|
|
8
8
|
|
|
9
9
|
// src/setup-state.ts
|
|
10
10
|
import fs from "fs";
|
|
@@ -28,7 +28,7 @@ async function buildSetupState() {
|
|
|
28
28
|
}
|
|
29
29
|
if (dbPath && fs.existsSync(dbPath)) {
|
|
30
30
|
try {
|
|
31
|
-
const { createClient, projects, queries: queriesTable } = await import("./src-
|
|
31
|
+
const { createClient, projects, queries: queriesTable } = await import("./src-52USCS7O.js");
|
|
32
32
|
const db = createClient(dbPath);
|
|
33
33
|
project_count = db.select({ id: projects.id }).from(projects).all().length;
|
|
34
34
|
const firstQuery = db.select({ id: queriesTable.id }).from(queriesTable).limit(1).all();
|
|
@@ -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-
|
|
50
|
+
const { serveCommand } = await import("./serve-BYHHULUU.js");
|
|
51
51
|
await serveCommand(format);
|
|
52
52
|
}
|
|
53
53
|
|