@ainyc/canonry 4.7.2 → 4.10.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.
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-Ca3kZYGw.js"></script>
16
- <link rel="stylesheet" crossorigin href="./assets/index-DAS6pOry.css">
15
+ <script type="module" crossorigin src="./assets/index-BdAFw2Gy.js"></script>
16
+ <link rel="stylesheet" crossorigin href="./assets/index-CGXCbiM_.css">
17
17
  </head>
18
18
  <body>
19
19
  <div id="root"></div>
@@ -12,7 +12,7 @@ import {
12
12
  queryGenerateRequestSchema,
13
13
  runTriggerRequestSchema,
14
14
  scheduleUpsertRequestSchema
15
- } from "./chunk-XAW66QUX.js";
15
+ } from "./chunk-GPJ3GLOE.js";
16
16
 
17
17
  // src/config.ts
18
18
  import fs from "fs";
@@ -1608,10 +1608,32 @@ var projectSearchResponseSchema = z15.object({
1608
1608
  import { z as z16 } from "zod";
1609
1609
  var contentActionSchema = z16.enum(["create", "expand", "refresh", "add-schema"]);
1610
1610
  var ContentActions = contentActionSchema.enum;
1611
+ function contentActionLabel(action) {
1612
+ switch (action) {
1613
+ case "create":
1614
+ return "Create";
1615
+ case "expand":
1616
+ return "Expand";
1617
+ case "refresh":
1618
+ return "Refresh";
1619
+ case "add-schema":
1620
+ return "Add schema";
1621
+ }
1622
+ }
1611
1623
  var demandSourceSchema = z16.enum(["gsc", "competitor-evidence", "both"]);
1612
1624
  var DemandSources = demandSourceSchema.enum;
1613
1625
  var actionConfidenceSchema = z16.enum(["high", "medium", "low"]);
1614
1626
  var ActionConfidences = actionConfidenceSchema.enum;
1627
+ function actionConfidenceLabel(confidence) {
1628
+ switch (confidence) {
1629
+ case "high":
1630
+ return "High";
1631
+ case "medium":
1632
+ return "Medium";
1633
+ case "low":
1634
+ return "Low";
1635
+ }
1636
+ }
1615
1637
  var pageTypeSchema = z16.enum([
1616
1638
  "blog-post",
1617
1639
  "comparison",
@@ -1969,6 +1991,123 @@ function reportActionTone(action) {
1969
1991
  if (action.confidence === "low") return "neutral";
1970
1992
  return "caution";
1971
1993
  }
1994
+ function reportSeverityLabel(severity) {
1995
+ switch (severity) {
1996
+ case "critical":
1997
+ return "Critical";
1998
+ case "high":
1999
+ return "High";
2000
+ case "medium":
2001
+ return "Medium";
2002
+ case "low":
2003
+ return "Low";
2004
+ }
2005
+ }
2006
+ function reportHorizonLabel(horizon) {
2007
+ switch (horizon) {
2008
+ case "immediate":
2009
+ return "Immediate";
2010
+ case "short-term":
2011
+ return "Short term";
2012
+ case "medium-term":
2013
+ return "Medium term";
2014
+ }
2015
+ }
2016
+ function reportActionCategoryLabel(category) {
2017
+ switch (category) {
2018
+ case "content":
2019
+ return "Content";
2020
+ case "competitors":
2021
+ return "Competitors";
2022
+ case "provider":
2023
+ return "Provider";
2024
+ case "search-demand":
2025
+ return "Search demand";
2026
+ case "indexing":
2027
+ return "Indexing";
2028
+ case "location":
2029
+ return "Location";
2030
+ case "monitoring":
2031
+ return "Monitoring";
2032
+ }
2033
+ }
2034
+ function reportConfidenceLabel(confidence) {
2035
+ switch (confidence) {
2036
+ case "high":
2037
+ return "High";
2038
+ case "medium":
2039
+ return "Medium";
2040
+ case "low":
2041
+ return "Low";
2042
+ }
2043
+ }
2044
+
2045
+ // ../contracts/src/report-dedup.ts
2046
+ var REPORT_INTENT_STOPWORDS = /* @__PURE__ */ new Set([
2047
+ "a",
2048
+ "an",
2049
+ "and",
2050
+ "for",
2051
+ "from",
2052
+ "in",
2053
+ "near",
2054
+ "of",
2055
+ "on",
2056
+ "or",
2057
+ "the",
2058
+ "to"
2059
+ ]);
2060
+ function tokenizeReportIntent(value) {
2061
+ return value.toLowerCase().match(/[a-z0-9]+/g) ?? [];
2062
+ }
2063
+ function normalizeReportIntentToken(token) {
2064
+ if (token.length > 4 && token.endsWith("ies")) return `${token.slice(0, -3)}y`;
2065
+ if (token.length > 4 && token.endsWith("s") && !token.endsWith("ss")) return token.slice(0, -1);
2066
+ return token;
2067
+ }
2068
+ function reportIntentModifiers(report) {
2069
+ const location = report.meta.location;
2070
+ if (!location) return /* @__PURE__ */ new Set();
2071
+ return new Set(
2072
+ [location.label, location.city, location.region, location.country].flatMap(tokenizeReportIntent).map(normalizeReportIntentToken).filter(Boolean)
2073
+ );
2074
+ }
2075
+ function reportIntentKey(value, modifiers) {
2076
+ const tokens = tokenizeReportIntent(value).map(normalizeReportIntentToken).filter(Boolean).filter((token) => !REPORT_INTENT_STOPWORDS.has(token)).filter((token) => !modifiers.has(token));
2077
+ return [...new Set(tokens)].sort().join(" ");
2078
+ }
2079
+ function extractActionQuery(action) {
2080
+ return action.title.match(/"([^"]+)"/)?.[1] ?? action.successMetric.match(/"([^"]+)"/)?.[1] ?? action.title;
2081
+ }
2082
+ function dedupeReportActions(report, actions) {
2083
+ const modifiers = reportIntentModifiers(report);
2084
+ if (actions.length <= 1 || modifiers.size === 0) return [...actions];
2085
+ const seen = /* @__PURE__ */ new Set();
2086
+ const result = [];
2087
+ for (const action of actions) {
2088
+ if (action.category !== "content") {
2089
+ result.push(action);
2090
+ continue;
2091
+ }
2092
+ const key = reportIntentKey(extractActionQuery(action), modifiers);
2093
+ if (!key || seen.has(key)) continue;
2094
+ seen.add(key);
2095
+ result.push(action);
2096
+ }
2097
+ return result;
2098
+ }
2099
+ function dedupeReportOpportunities(report) {
2100
+ const modifiers = reportIntentModifiers(report);
2101
+ const opportunities = report.contentOpportunities;
2102
+ if (opportunities.length <= 1 || modifiers.size === 0) return opportunities;
2103
+ const seen = /* @__PURE__ */ new Set();
2104
+ return opportunities.filter((opportunity) => {
2105
+ const key = reportIntentKey(opportunity.query, modifiers);
2106
+ if (!key || seen.has(key)) return false;
2107
+ seen.add(key);
2108
+ return true;
2109
+ });
2110
+ }
1972
2111
 
1973
2112
  // ../contracts/src/skills.ts
1974
2113
  import { z as z19 } from "zod";
@@ -2047,6 +2186,8 @@ export {
2047
2186
  agentMemoryDeleteRequestSchema,
2048
2187
  CcReleaseSyncStatuses,
2049
2188
  ContentActions,
2189
+ contentActionLabel,
2190
+ actionConfidenceLabel,
2050
2191
  CheckStatuses,
2051
2192
  CheckScopes,
2052
2193
  CheckCategories,
@@ -2056,6 +2197,12 @@ export {
2056
2197
  emptyCitationVisibility,
2057
2198
  citationStateToCited,
2058
2199
  reportActionTone,
2200
+ reportSeverityLabel,
2201
+ reportHorizonLabel,
2202
+ reportActionCategoryLabel,
2203
+ reportConfidenceLabel,
2204
+ dedupeReportActions,
2205
+ dedupeReportOpportunities,
2059
2206
  CodingAgents,
2060
2207
  skillsClientSchema,
2061
2208
  SkillsClients