@ainyc/canonry 4.191.0 → 4.192.1

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 (33) hide show
  1. package/assets/assets/{AuditHistoryPanel-C2dvjYNh.js → AuditHistoryPanel-DvqnrQc_.js} +1 -1
  2. package/assets/assets/{BacklinksPage-D1yPQtfF.js → BacklinksPage-BCk2qBfC.js} +1 -1
  3. package/assets/assets/{ChartPrimitives-DLEICrrL.js → ChartPrimitives-Bxa_vFmq.js} +1 -1
  4. package/assets/assets/{HistoryPage-DOEa7naA.js → HistoryPage-IMlkx--Q.js} +1 -1
  5. package/assets/assets/MeasurementPropertyPage-1o1e5vmH.js +1 -0
  6. package/assets/assets/ProjectPage-BusVoYaC.js +8 -0
  7. package/assets/assets/{RunRow-BO7lyC1C.js → RunRow-BherM7NU.js} +1 -1
  8. package/assets/assets/{RunsPage-DHSWfTav.js → RunsPage-B5G_OrmE.js} +1 -1
  9. package/assets/assets/{SettingsPage-oiJdhiq0.js → SettingsPage-CMeCn5uk.js} +1 -1
  10. package/assets/assets/{SiteHealthSection-gVdylFY-.js → SiteHealthSection-DZX1yv4k.js} +3 -3
  11. package/assets/assets/{TrafficPage-YIdwRpQh.js → TrafficPage-BV-HOztp.js} +1 -1
  12. package/assets/assets/{TrafficSourceDetailPage-B4Cop6ox.js → TrafficSourceDetailPage-9IN0q7bd.js} +1 -1
  13. package/assets/assets/{extract-error-message-XavUZNf3.js → extract-error-message-c7zJp5uX.js} +1 -1
  14. package/assets/assets/{index-njfYnO22.js → index-D3KGn0S0.js} +26 -26
  15. package/assets/assets/{react-sigma_core.esm.min-V7giUpEn.js → react-sigma_core.esm.min-DxHkjhKC.js} +1 -1
  16. package/assets/assets/{vendor-lucide-dNHw1I5G.js → vendor-lucide-CW2qe0uH.js} +1 -1
  17. package/assets/assets/{vendor-markdown-9tTeP8v7.js → vendor-markdown-B-Oq2NYq.js} +1 -1
  18. package/assets/assets/{vendor-radix-BpmvLvpp.js → vendor-radix-twS1M3FF.js} +1 -1
  19. package/assets/assets/{vendor-recharts-FA0uySU7.js → vendor-recharts-D-cUuLZo.js} +1 -1
  20. package/assets/assets/{vendor-tanstack-CYBjbqVr.js → vendor-tanstack-ZXXkndVj.js} +1 -1
  21. package/assets/index.html +6 -6
  22. package/dist/{chunk-KBUV3HGS.js → chunk-QRNKMGVD.js} +1351 -1228
  23. package/dist/{chunk-WSD5J6O4.js → chunk-S5QNBQ72.js} +2 -2
  24. package/dist/{chunk-XI6FN52S.js → chunk-T4OO575U.js} +45 -14
  25. package/dist/{chunk-ZK4FJDCH.js → chunk-T6GRXUOE.js} +519 -231
  26. package/dist/{chunk-2A7E5TDU.js → chunk-V4ZLHKOG.js} +5 -4
  27. package/dist/cli.js +14 -10
  28. package/dist/index.js +4 -4
  29. package/dist/{intelligence-service-EVRWZHDG.js → intelligence-service-QYRQHSJH.js} +2 -2
  30. package/dist/mcp.js +3 -3
  31. package/package.json +13 -13
  32. package/assets/assets/MeasurementPropertyPage-D-O8vnMS.js +0 -1
  33. package/assets/assets/ProjectPage-DqTCcimz.js +0 -8
@@ -5,11 +5,11 @@ import {
5
5
  installSkills,
6
6
  loadConfigRaw,
7
7
  saveConfigPatch
8
- } from "./chunk-2A7E5TDU.js";
8
+ } from "./chunk-V4ZLHKOG.js";
9
9
  import {
10
10
  SKILL_MANIFEST_FILENAME,
11
11
  SkillsClients
12
- } from "./chunk-KBUV3HGS.js";
12
+ } from "./chunk-QRNKMGVD.js";
13
13
 
14
14
  // src/skills-autosync.ts
15
15
  import fs from "fs";
@@ -14,7 +14,7 @@ import {
14
14
  loadConfig,
15
15
  loadConfigRaw,
16
16
  saveConfigPatch
17
- } from "./chunk-2A7E5TDU.js";
17
+ } from "./chunk-V4ZLHKOG.js";
18
18
  import {
19
19
  CC_CACHE_DIR,
20
20
  DUCKDB_SPEC,
@@ -162,7 +162,7 @@ import {
162
162
  siteCrawlSnapshots,
163
163
  toAlertView,
164
164
  usageCounters
165
- } from "./chunk-ZK4FJDCH.js";
165
+ } from "./chunk-T6GRXUOE.js";
166
166
  import {
167
167
  AGENT_MEMORY_VALUE_MAX_BYTES,
168
168
  AGENT_PROVIDER_IDS,
@@ -305,7 +305,7 @@ import {
305
305
  validationError,
306
306
  winnabilityClassLabel,
307
307
  withRetry
308
- } from "./chunk-KBUV3HGS.js";
308
+ } from "./chunk-QRNKMGVD.js";
309
309
 
310
310
  // src/telemetry.ts
311
311
  import crypto from "crypto";
@@ -12041,7 +12041,7 @@ function readStoredGroundingSources(rawResponse) {
12041
12041
  return result;
12042
12042
  }
12043
12043
  async function backfillInsightsCommand(project, opts) {
12044
- const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-EVRWZHDG.js");
12044
+ const { IntelligenceService: IntelligenceService2 } = await import("./intelligence-service-QYRQHSJH.js");
12045
12045
  const config = loadConfig();
12046
12046
  const db = createClient(config.database);
12047
12047
  migrate(db);
@@ -15711,6 +15711,7 @@ ${lines.join("\n")}
15711
15711
  import crypto26 from "crypto";
15712
15712
  import { eq as eq22 } from "drizzle-orm";
15713
15713
  import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
15714
+ import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
15714
15715
  var SESSION_IDLE_MS = 10 * 60 * 1e3;
15715
15716
  var SWEEP_INTERVAL_MS = 60 * 1e3;
15716
15717
  function mintSessionKey(db, scopes, userId) {
@@ -15795,12 +15796,18 @@ function registerMcpHttpRoutes(scope, opts) {
15795
15796
  sessionKey = mintSessionKey(opts.db, scopes, request.principal.id);
15796
15797
  }
15797
15798
  const client = new ApiClient(opts.selfApiUrl, sessionKey?.raw ?? bearer, { skipProbe: true });
15798
- const server = createCanonryMcpServer({
15799
- scope: segment.readOnly || isReadOnlyKey(scopes) ? "read-only" : "all",
15800
- credentialScopes: scopes,
15801
- tiers: segment.tiers,
15802
- clientFactory: () => client
15803
- });
15799
+ let server;
15800
+ try {
15801
+ server = createCanonryMcpServer({
15802
+ scope: segment.readOnly || isReadOnlyKey(scopes) ? "read-only" : "all",
15803
+ credentialScopes: scopes,
15804
+ tiers: segment.tiers,
15805
+ clientFactory: () => client
15806
+ });
15807
+ } catch (error) {
15808
+ if (sessionKey) revokeSessionKey(opts.db, sessionKey.id);
15809
+ throw error;
15810
+ }
15804
15811
  const transport = new StreamableHTTPServerTransport({
15805
15812
  sessionIdGenerator: () => crypto26.randomUUID(),
15806
15813
  onsessioninitialized: (id) => {
@@ -15808,16 +15815,25 @@ function registerMcpHttpRoutes(scope, opts) {
15808
15815
  }
15809
15816
  });
15810
15817
  async function close() {
15811
- await transport.close();
15812
- await server.close();
15813
15818
  if (sessionKey) revokeSessionKey(opts.db, sessionKey.id);
15819
+ try {
15820
+ await transport.close();
15821
+ } finally {
15822
+ await server.close();
15823
+ }
15814
15824
  }
15815
15825
  transport.onclose = () => {
15816
15826
  const id = transport.sessionId;
15817
15827
  if (id) sessions.delete(id);
15818
15828
  if (sessionKey) revokeSessionKey(opts.db, sessionKey.id);
15819
15829
  };
15820
- await server.connect(transport);
15830
+ try {
15831
+ await server.connect(transport);
15832
+ } catch (error) {
15833
+ await close().catch(() => {
15834
+ });
15835
+ throw error;
15836
+ }
15821
15837
  return { transport, close, authorizationId, segmentId: segment.id, lastSeenAt: now() };
15822
15838
  }
15823
15839
  async function handle(request, reply, segment) {
@@ -15849,12 +15865,27 @@ function registerMcpHttpRoutes(scope, opts) {
15849
15865
  await reply.status(404).send({ error: { code: "NOT_FOUND", message: "Unknown MCP session." } });
15850
15866
  return;
15851
15867
  }
15868
+ if (request.method !== "POST" || !isInitializeRequest(request.body)) {
15869
+ await reply.status(400).send({ jsonrpc: "2.0", error: { code: -32e3, message: "Bad Request: Expected an initialize request." }, id: null });
15870
+ return;
15871
+ }
15852
15872
  const opened = await openSession(request, authorizationId, segment);
15853
15873
  if (!opened) {
15854
15874
  await reply.status(401).send({ error: { code: "AUTH_REQUIRED", message: "Authentication required." } });
15855
15875
  return;
15856
15876
  }
15857
- await opened.transport.handleRequest(request.raw, reply.raw, request.body);
15877
+ let handled = false;
15878
+ try {
15879
+ await opened.transport.handleRequest(request.raw, reply.raw, request.body);
15880
+ handled = true;
15881
+ } finally {
15882
+ const openedId = opened.transport.sessionId;
15883
+ if (!handled || reply.raw.statusCode >= 400 || openedId === void 0 || !sessions.has(openedId)) {
15884
+ if (openedId !== void 0) sessions.delete(openedId);
15885
+ await opened.close().catch(() => {
15886
+ });
15887
+ }
15888
+ }
15858
15889
  }
15859
15890
  const config = { transportEnvelope: true };
15860
15891
  function mount(pathname, segment) {