@ainyc/canonry 4.46.0 → 4.47.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/index.html CHANGED
@@ -12,8 +12,8 @@
12
12
  <link rel="icon" type="image/png" sizes="32x32" href="./favicon-32.png" />
13
13
  <link rel="apple-touch-icon" href="./apple-touch-icon.png" />
14
14
  <title>Canonry</title>
15
- <script type="module" crossorigin src="./assets/index-CFKPcvOe.js"></script>
16
- <link rel="stylesheet" crossorigin href="./assets/index-BVHV03Fk.css">
15
+ <script type="module" crossorigin src="./assets/index-CPUAzk7n.js"></script>
16
+ <link rel="stylesheet" crossorigin href="./assets/index-BDMNXVHa.css">
17
17
  </head>
18
18
  <body>
19
19
  <div id="root"></div>
@@ -142,7 +142,7 @@ var runDtoSchema = z2.object({
142
142
  error: runErrorSchema.nullable().optional(),
143
143
  createdAt: z2.string()
144
144
  });
145
- var PROVIDER_PREFIX = /^\[provider-[a-zA-Z0-9_-]+\]\s+/;
145
+ var PROVIDER_PREFIX = /^\[provider-[\w-]+\]\s+/;
146
146
  function parseProviderErrorMessage(msg) {
147
147
  const stripped = msg.replace(PROVIDER_PREFIX, "");
148
148
  try {
@@ -2002,7 +2002,7 @@ function normalizeUrlPath(input) {
2002
2002
  trimmed = trimmed.replace(/&nbsp;/g, " ").replace(/\s+/g, " ").trim();
2003
2003
  if (trimmed === "" || trimmed === "/") return "/";
2004
2004
  if (trimmed === "(not set)") return null;
2005
- trimmed = trimmed.replace(/([a-zA-Z0-9])([).]+)$/, "$1");
2005
+ trimmed = trimmed.replace(/([a-z0-9])[).]+$/i, "$1");
2006
2006
  if (trimmed.startsWith("/)") || trimmed.startsWith("/ ")) {
2007
2007
  trimmed = "/";
2008
2008
  }
@@ -2701,6 +2701,48 @@ function formatDeltaCopy(d, suffix, windowLabel = "vs prior 7 days") {
2701
2701
  return `Flat ${windowLabel} (${formatNumber(d.prior)} ${suffix})`;
2702
2702
  }
2703
2703
 
2704
+ // ../contracts/src/ai-engines.ts
2705
+ var AI_ENGINE_DOMAINS = {
2706
+ /** OpenAI marketing/blog/API surface. */
2707
+ openai: "openai.com",
2708
+ /** ChatGPT consumer surface (separate from openai.com per OpenAI's domain split). */
2709
+ chatgpt: "chatgpt.com",
2710
+ /** Anthropic's Claude consumer surface. */
2711
+ claude: "claude.ai",
2712
+ /** Perplexity consumer + docs surface. */
2713
+ perplexity: "perplexity.ai",
2714
+ /** Google Gemini consumer surface. */
2715
+ gemini: "gemini.google.com",
2716
+ /** Google Bard (legacy alias for Gemini surface). */
2717
+ bard: "bard.google.com",
2718
+ /** Microsoft Copilot consumer surface. */
2719
+ copilotMicrosoft: "copilot.microsoft.com",
2720
+ /** Meta AI consumer surface. */
2721
+ metaAi: "meta.ai",
2722
+ /** xAI Grok. */
2723
+ grok: "grok.com",
2724
+ /** You.com. */
2725
+ you: "you.com",
2726
+ /** Phind. */
2727
+ phind: "phind.com"
2728
+ };
2729
+ var AI_ENGINE_SELF_DOMAINS = {
2730
+ chatgpt: [AI_ENGINE_DOMAINS.chatgpt, AI_ENGINE_DOMAINS.openai],
2731
+ claude: [AI_ENGINE_DOMAINS.claude],
2732
+ perplexity: [AI_ENGINE_DOMAINS.perplexity],
2733
+ gemini: [AI_ENGINE_DOMAINS.gemini, AI_ENGINE_DOMAINS.bard]
2734
+ };
2735
+ var ANTHROPIC_API_DOMAIN = "anthropic.com";
2736
+ var GOOGLE_APIS_DOMAIN = "googleapis.com";
2737
+ var VERTEX_AI_SEARCH_PROXY_DOMAIN = "vertexaisearch.cloud.google.com";
2738
+ var AI_PROVIDER_INFRA_DOMAINS = [
2739
+ AI_ENGINE_DOMAINS.openai,
2740
+ AI_ENGINE_DOMAINS.chatgpt,
2741
+ ANTHROPIC_API_DOMAIN,
2742
+ GOOGLE_APIS_DOMAIN,
2743
+ VERTEX_AI_SEARCH_PROXY_DOMAIN
2744
+ ];
2745
+
2704
2746
  export {
2705
2747
  __export,
2706
2748
  providerQuotaPolicySchema,
@@ -2830,5 +2872,9 @@ export {
2830
2872
  formatDateRange,
2831
2873
  deltaPercent,
2832
2874
  deltaTone,
2833
- formatDeltaCopy
2875
+ formatDeltaCopy,
2876
+ AI_ENGINE_DOMAINS,
2877
+ AI_ENGINE_SELF_DOMAINS,
2878
+ VERTEX_AI_SEARCH_PROXY_DOMAIN,
2879
+ AI_PROVIDER_INFRA_DOMAINS
2834
2880
  };
@@ -9,7 +9,7 @@ import {
9
9
  categoryLabel,
10
10
  determineAnswerMentioned,
11
11
  normalizeProjectDomain
12
- } from "./chunk-Q7XFJO2V.js";
12
+ } from "./chunk-4WXY57ET.js";
13
13
 
14
14
  // src/intelligence-service.ts
15
15
  import { eq, desc, asc, and, or, inArray } from "drizzle-orm";
@@ -2574,8 +2574,8 @@ function analyzeRuns(currentRun, previousRun, opts = {}) {
2574
2574
  }
2575
2575
 
2576
2576
  // ../intelligence/src/query-shape.ts
2577
- var TRANSACTIONAL = /\b(buy|price|pricing|cost|cheap|discount|coupon|deal|sale|trial|plan)\b/i;
2578
- var NAVIGATIONAL = /\b(login|sign[- ]?in|contact|support|help|download|app|homepage)\b|\.(com|io|net|org|app|ai)\b/i;
2577
+ var TRANSACTIONAL = /\b(?:buy|price|pricing|cost|cheap|discount|coupon|deal|sale|trial|plan)\b/i;
2578
+ var NAVIGATIONAL = /\b(?:login|sign[- ]?in|contact|support|help|download|app|homepage)\b|\.(?:com|io|net|org|app|ai)\b/i;
2579
2579
  function isBlogShapedQuery(query) {
2580
2580
  const trimmed = query.trim();
2581
2581
  if (!trimmed) return false;
@@ -2619,8 +2619,12 @@ function buildInventory(input) {
2619
2619
  function extractPath(url) {
2620
2620
  const trimmed = url.trim();
2621
2621
  if (!trimmed) return "";
2622
- const match = /^https?:\/\/[^/]+(.*)$/.exec(trimmed);
2623
- const path = match ? match[1] : trimmed;
2622
+ let path;
2623
+ try {
2624
+ path = new URL(trimmed).pathname;
2625
+ } catch {
2626
+ path = trimmed;
2627
+ }
2624
2628
  const stripped = path.replace(/\/+$/, "");
2625
2629
  return stripped || "/";
2626
2630
  }
@@ -3008,8 +3012,8 @@ function groupInsights(insights2, keyFn = (i) => JSON.stringify([i.query, i.prov
3008
3012
  }
3009
3013
 
3010
3014
  // ../intelligence/src/query-categorize.ts
3011
- var TRANSACTIONAL_RE = /\b(buy|price|pricing|cost|hire|near me|services?|agency|consultant|company)\b/i;
3012
- var INFORMATIONAL_RE = /\b(what|how|why|when|guide|tutorial|vs|versus|alternatives?|examples?|definition)\b/i;
3015
+ var TRANSACTIONAL_RE = /\b(?:buy|price|pricing|cost|hire|near me|services?|agency|consultant|company)\b/i;
3016
+ var INFORMATIONAL_RE = /\b(?:what|how|why|when|guide|tutorial|vs|versus|alternatives?|examples?|definition)\b/i;
3013
3017
  var MIN_BRAND_TOKEN_LENGTH = 3;
3014
3018
  function compact(value) {
3015
3019
  return value.toLowerCase().replace(/[^a-z0-9]/g, "");
@@ -22,7 +22,7 @@ import {
22
22
  trafficConnectVercelRequestSchema,
23
23
  trafficConnectWordpressRequestSchema,
24
24
  trafficEventKindSchema
25
- } from "./chunk-Q7XFJO2V.js";
25
+ } from "./chunk-4WXY57ET.js";
26
26
 
27
27
  // src/config.ts
28
28
  import fs from "fs";
@@ -1109,7 +1109,11 @@ function compactStringParams(values, keys) {
1109
1109
  for (const key of keys) {
1110
1110
  const value = values[key];
1111
1111
  if (value === void 0 || value === null || value === "") continue;
1112
- params[key] = String(value);
1112
+ if (typeof value === "string") {
1113
+ params[key] = value;
1114
+ } else if (typeof value === "number" || typeof value === "boolean") {
1115
+ params[key] = String(value);
1116
+ }
1113
1117
  }
1114
1118
  return Object.keys(params).length ? params : void 0;
1115
1119
  }