@ainyc/canonry 4.194.0 → 4.195.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 (28) hide show
  1. package/assets/agent-workspace/skills/canonry/SKILL.md +71 -1
  2. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +30 -0
  3. package/assets/assets/{AuditHistoryPanel-C8hUWnaD.js → AuditHistoryPanel-vWUtVXOI.js} +1 -1
  4. package/assets/assets/{BacklinksPage-BcIdghvA.js → BacklinksPage-CSzuMEuv.js} +1 -1
  5. package/assets/assets/{HistoryPage-DF7PLFi1.js → HistoryPage-DtCTQ7CQ.js} +1 -1
  6. package/assets/assets/{MeasurementPropertyPage-BTlXQbYt.js → MeasurementPropertyPage-B7gTMWNs.js} +1 -1
  7. package/assets/assets/{ProjectPage-YiZ_i5eX.js → ProjectPage-Bsm0_jUY.js} +1 -1
  8. package/assets/assets/{RunRow-CfzuyTSM.js → RunRow-D5k4Rdo4.js} +1 -1
  9. package/assets/assets/{RunsPage-Diu_-YWl.js → RunsPage-DIXBB2Om.js} +1 -1
  10. package/assets/assets/{SettingsPage-g93aqkg2.js → SettingsPage-wYhBm6Az.js} +1 -1
  11. package/assets/assets/{SiteHealthSection-DroMQJVF.js → SiteHealthSection-YebzsgDh.js} +3 -3
  12. package/assets/assets/{TrafficPage-BhHjy5Ee.js → TrafficPage-DtnSRFO8.js} +1 -1
  13. package/assets/assets/{TrafficSourceDetailPage-DI3aZIHo.js → TrafficSourceDetailPage-DYQ6mpYq.js} +1 -1
  14. package/assets/assets/{extract-error-message-DjXzzSl3.js → extract-error-message-BdChrkmo.js} +1 -1
  15. package/assets/assets/{index-33ZEL6A5.js → index-C_E2NRYY.js} +26 -26
  16. package/assets/assets/{react-sigma_core.esm.min-BlfsZb5G.js → react-sigma_core.esm.min-sKWUk_tG.js} +1 -1
  17. package/assets/assets/{v2-overview-adapter-C6cROMod.js → v2-overview-adapter-CkPt-sRK.js} +1 -1
  18. package/assets/index.html +1 -1
  19. package/dist/{chunk-X5AE3GNC.js → chunk-3WODA4JF.js} +276 -5
  20. package/dist/{chunk-7XXXNNE2.js → chunk-B2XM6AQ6.js} +280 -26
  21. package/dist/{chunk-ZA2QVBQO.js → chunk-H3RVNMOO.js} +73 -36
  22. package/dist/{chunk-AO5QJJE6.js → chunk-LJKAB4CX.js} +2 -2
  23. package/dist/{chunk-QVYGI6CL.js → chunk-UMU3IBXM.js} +1225 -474
  24. package/dist/cli.js +233 -154
  25. package/dist/index.js +4 -4
  26. package/dist/{intelligence-service-M4V3YPFZ.js → intelligence-service-MGQRJW4V.js} +2 -2
  27. package/dist/mcp.js +4 -4
  28. package/package.json +11 -11
@@ -4,6 +4,7 @@ import {
4
4
  CANONRY_MCP_TOOLKIT_NAMES,
5
5
  CanonryMcpToolNames,
6
6
  CliError,
7
+ PACKAGE_VERSION,
7
8
  canonryMcpTools,
8
9
  configExists,
9
10
  createCanonryMcpServer,
@@ -14,7 +15,7 @@ import {
14
15
  loadConfig,
15
16
  loadConfigRaw,
16
17
  saveConfigPatch
17
- } from "./chunk-7XXXNNE2.js";
18
+ } from "./chunk-B2XM6AQ6.js";
18
19
  import {
19
20
  CC_CACHE_DIR,
20
21
  DUCKDB_SPEC,
@@ -22,8 +23,10 @@ import {
22
23
  GSC_DATA_LAG_DAYS,
23
24
  GSC_REPORTING_TIME_ZONE,
24
25
  IntelligenceService,
26
+ OperationalLogStore,
25
27
  PLUGIN_DIR,
26
28
  USER_SESSION_COOKIE_NAME,
29
+ addLogListener,
27
30
  adsAdGroups,
28
31
  adsAds,
29
32
  adsCampaigns,
@@ -56,6 +59,7 @@ import {
56
59
  crawlerEventsHourly,
57
60
  createClient,
58
61
  createCredentialChecker,
62
+ createFastifyLogger,
59
63
  createLogger,
60
64
  createUserSession,
61
65
  deliverWebhook,
@@ -162,7 +166,7 @@ import {
162
166
  siteCrawlSnapshots,
163
167
  toAlertView,
164
168
  usageCounters
165
- } from "./chunk-QVYGI6CL.js";
169
+ } from "./chunk-UMU3IBXM.js";
166
170
  import {
167
171
  AGENT_MEMORY_VALUE_MAX_BYTES,
168
172
  AGENT_PROVIDER_IDS,
@@ -276,6 +280,7 @@ import {
276
280
  isSelfLink,
277
281
  isVertexGroundingRedirect,
278
282
  mapWithConcurrency,
283
+ maskTelemetryAnonymousId,
279
284
  nextScheduleUpdatedAt,
280
285
  normalizeIdTokens,
281
286
  normalizeMeasurementExecutionQueryText,
@@ -306,7 +311,7 @@ import {
306
311
  validationError,
307
312
  winnabilityClassLabel,
308
313
  withRetry
309
- } from "./chunk-X5AE3GNC.js";
314
+ } from "./chunk-3WODA4JF.js";
310
315
 
311
316
  // src/telemetry.ts
312
317
  import crypto from "crypto";
@@ -360,18 +365,51 @@ function envSourceOverride() {
360
365
  function setTelemetrySource(source) {
361
366
  CURRENT_SOURCE = source;
362
367
  }
363
- function isTelemetryEnabled() {
364
- if (process.env.CANONRY_TELEMETRY_DISABLED === "1") return false;
365
- if (process.env.DO_NOT_TRACK === "1") return false;
366
- if (process.env.CI) return false;
367
- if (!configExists()) return true;
368
+ function resolveTelemetryStatus(input) {
369
+ const base = {
370
+ configuredEnabled: input.configuredEnabled,
371
+ ...input.anonymousId ? { anonymousId: maskAnonymousId(input.anonymousId) } : {},
372
+ target: "local"
373
+ };
374
+ if (input.canonryTelemetryDisabled === "1") {
375
+ return { ...base, enabled: false, reason: "CANONRY_TELEMETRY_DISABLED" };
376
+ }
377
+ if (input.doNotTrack === "1") {
378
+ return { ...base, enabled: false, reason: "DO_NOT_TRACK" };
379
+ }
380
+ if (input.ci) return { ...base, enabled: false, reason: "CI" };
381
+ if (!input.configuredEnabled) return { ...base, enabled: false, reason: "configured_disabled" };
382
+ if (input.configState === "absent") return { ...base, enabled: true, reason: "NO_CONFIG" };
383
+ if (input.configState === "unavailable") return { ...base, enabled: true, reason: "CONFIG_UNAVAILABLE" };
384
+ return { ...base, enabled: true, reason: "enabled" };
385
+ }
386
+ function maskAnonymousId(value) {
387
+ return maskTelemetryAnonymousId(value);
388
+ }
389
+ function getTelemetryStatus() {
390
+ const env = {
391
+ canonryTelemetryDisabled: process.env.CANONRY_TELEMETRY_DISABLED,
392
+ doNotTrack: process.env.DO_NOT_TRACK,
393
+ ci: process.env.CI
394
+ };
395
+ if (!configExists()) {
396
+ return resolveTelemetryStatus({ ...env, configuredEnabled: true, configState: "absent" });
397
+ }
368
398
  try {
369
399
  const config = loadConfig();
370
- return config.telemetry !== false;
400
+ return resolveTelemetryStatus({
401
+ ...env,
402
+ configuredEnabled: config.telemetry !== false,
403
+ configState: "present",
404
+ anonymousId: config.anonymousId
405
+ });
371
406
  } catch {
372
- return true;
407
+ return resolveTelemetryStatus({ ...env, configuredEnabled: true, configState: "unavailable" });
373
408
  }
374
409
  }
410
+ function isTelemetryEnabled() {
411
+ return getTelemetryStatus().enabled;
412
+ }
375
413
  function getOrCreateAnonymousId() {
376
414
  const fromEnv = readEnvAnonymousId();
377
415
  if (fromEnv) return fromEnv;
@@ -6247,7 +6285,7 @@ function nonBlank(value) {
6247
6285
  return trimmed ? trimmed : void 0;
6248
6286
  }
6249
6287
  function resolveBuildCommit(env = process.env) {
6250
- const embedded = true ? "8d4ee4870a290e10a57c6f8455e98cf94ea48ae2" : void 0;
6288
+ const embedded = true ? "9cc37abc3436114b63ddd6722b5bfb1af0f85c02" : void 0;
6251
6289
  return nonBlank(embedded) ?? nonBlank(env.CANONRY_COMMIT);
6252
6290
  }
6253
6291
  function resolveInstanceIdentity(env = process.env) {
@@ -12058,7 +12096,7 @@ function readStoredGroundingSources(rawResponse) {
12058
12096
  return result;
12059
12097
  }
12060
12098
  async function backfillInsightsCommand(project, opts) {
12061
- const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-M4V3YPFZ.js");
12099
+ const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-MGQRJW4V.js");
12062
12100
  const config = loadConfig();
12063
12101
  const db = createClient(config.database);
12064
12102
  migrate(db);
@@ -15812,7 +15850,12 @@ function registerMcpHttpRoutes(scope, opts) {
15812
15850
  if (!request.apiKey && request.principal?.kind === "user") {
15813
15851
  sessionKey = mintSessionKey(opts.db, scopes, request.principal.id);
15814
15852
  }
15815
- const client = new ApiClient(opts.selfApiUrl, sessionKey?.raw ?? bearer, { skipProbe: true });
15853
+ const client = new ApiClient(opts.selfApiUrl, sessionKey?.raw ?? bearer, {
15854
+ skipProbe: true,
15855
+ clientName: `canonry-mcp/${PACKAGE_VERSION}`,
15856
+ // Correlation only: this is never accepted as caller identity or authority.
15857
+ actorSession: crypto26.randomUUID()
15858
+ });
15816
15859
  let server;
15817
15860
  try {
15818
15861
  server = createCanonryMcpServer({
@@ -17657,20 +17700,14 @@ function createGoogleMarketingConfigCredentialStore(input) {
17657
17700
  }
17658
17701
  async function createServer(opts) {
17659
17702
  const dashboardManagedRunKinds = resolveDashboardManagedRunKinds(process.env, opts.config);
17660
- const logger = opts.logger === false ? false : process.stdout.isTTY ? {
17661
- transport: {
17662
- target: "pino-pretty",
17663
- options: {
17664
- colorize: true,
17665
- translateTime: "HH:MM:ss",
17666
- ignore: "pid,hostname,reqId",
17667
- messageFormat: "{msg} {req.method} {req.url}"
17668
- }
17669
- }
17670
- } : true;
17703
+ const operationalLogs = new OperationalLogStore(opts.db, {
17704
+ retention: opts.config.database === ":memory:" ? "process" : "durable"
17705
+ });
17706
+ const logger = createFastifyLogger({ enabled: opts.logger !== false, module: "Server" });
17671
17707
  const trustProxy = resolveTrustProxy(process.env.CANONRY_TRUST_PROXY);
17672
17708
  const app = Fastify({
17673
- logger,
17709
+ loggerInstance: logger,
17710
+ genReqId: () => crypto27.randomUUID(),
17674
17711
  trustProxy
17675
17712
  });
17676
17713
  const registry = new ProviderRegistry();
@@ -19128,7 +19165,7 @@ async function createServer(opts) {
19128
19165
  },
19129
19166
  getRunnableProviderNames: () => registry.getAll().map((provider) => provider.adapter.name),
19130
19167
  getEffectiveProviderModels: () => effectiveProviderModels(registry),
19131
- onProviderUpdate: (providerName, apiKey, model, baseUrl, incomingQuota) => {
19168
+ onProviderUpdate: (providerName, apiKey, model, baseUrl, incomingQuota, auditContext) => {
19132
19169
  const name = providerName;
19133
19170
  if (!adapterMap[name]) return null;
19134
19171
  if (!opts.config.providers) opts.config.providers = {};
@@ -19188,7 +19225,11 @@ async function createServer(opts) {
19188
19225
  targetProjectIds.map((projectId) => ({
19189
19226
  id: crypto27.randomUUID(),
19190
19227
  projectId,
19191
- actor: "api",
19228
+ actor: auditContext?.actor ?? "api",
19229
+ userAgent: auditContext?.userAgent ?? null,
19230
+ actorSession: auditContext?.actorSession ?? null,
19231
+ credentialId: auditContext?.credentialId ?? null,
19232
+ requestId: auditContext?.requestId ?? null,
19192
19233
  action: existing ? "provider.updated" : "provider.created",
19193
19234
  entityType: "provider",
19194
19235
  entityId: name,
@@ -19264,15 +19305,8 @@ async function createServer(opts) {
19264
19305
  }
19265
19306
  });
19266
19307
  },
19267
- getTelemetryStatus: () => {
19268
- const enabled = isTelemetryEnabled();
19269
- return {
19270
- enabled,
19271
- // Only read/create the anonymous ID if telemetry is enabled.
19272
- // Don't mutate config for opted-out users.
19273
- anonymousId: enabled ? getOrCreateAnonymousId() : void 0
19274
- };
19275
- },
19308
+ listOperationalLogs: (query) => operationalLogs.list(query),
19309
+ getTelemetryStatus,
19276
19310
  setTelemetryEnabled: (enabled) => {
19277
19311
  const config = loadConfig();
19278
19312
  config.telemetry = enabled;
@@ -19543,7 +19577,9 @@ async function createServer(opts) {
19543
19577
  rejectRuntimeStartup(error);
19544
19578
  }
19545
19579
  });
19580
+ const stopLogCapture = addLogListener((entry) => operationalLogs.append(entry));
19546
19581
  app.addHook("onClose", async () => {
19582
+ stopLogCapture();
19547
19583
  scheduler.stop();
19548
19584
  });
19549
19585
  return app;
@@ -19608,6 +19644,7 @@ function parseQueryResponse(raw, count2) {
19608
19644
  export {
19609
19645
  trackCliCommandFinished,
19610
19646
  setTelemetrySource,
19647
+ getTelemetryStatus,
19611
19648
  isTelemetryEnabled,
19612
19649
  getOrCreateAnonymousId,
19613
19650
  isFirstRun,
@@ -5,11 +5,11 @@ import {
5
5
  installSkills,
6
6
  loadConfigRaw,
7
7
  saveConfigPatch
8
- } from "./chunk-7XXXNNE2.js";
8
+ } from "./chunk-B2XM6AQ6.js";
9
9
  import {
10
10
  SKILL_MANIFEST_FILENAME,
11
11
  SkillsClients
12
- } from "./chunk-X5AE3GNC.js";
12
+ } from "./chunk-3WODA4JF.js";
13
13
 
14
14
  // src/skills-autosync.ts
15
15
  import fs from "fs";