@ainyc/canonry 3.6.3 → 4.1.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/README.md +10 -10
- package/assets/agent-workspace/AGENTS.md +4 -4
- package/assets/agent-workspace/USER.md +1 -1
- package/assets/agent-workspace/skills/aero/SKILL.md +4 -4
- package/assets/agent-workspace/skills/aero/references/memory-patterns.md +3 -3
- package/assets/agent-workspace/skills/aero/references/orchestration.md +6 -6
- package/assets/agent-workspace/skills/aero/references/regression-playbook.md +7 -7
- package/assets/agent-workspace/skills/aero/references/reporting.md +8 -8
- package/assets/agent-workspace/skills/aero/soul.md +1 -1
- package/assets/agent-workspace/skills/canonry-setup/SKILL.md +5 -5
- package/assets/agent-workspace/skills/canonry-setup/references/aeo-analysis.md +15 -15
- package/assets/agent-workspace/skills/canonry-setup/references/canonry-cli.md +8 -8
- package/assets/assets/index-D7T5wSBj.css +1 -0
- package/assets/assets/index-Dtgn4FDp.js +302 -0
- package/assets/index.html +2 -2
- package/dist/{chunk-CG4HEQAK.js → chunk-BQN6BBHI.js} +707 -456
- package/dist/{chunk-GLPZ5NVP.js → chunk-KCETXLDF.js} +106 -16
- package/dist/{chunk-W463NVVC.js → chunk-NCWCPBOT.js} +111 -49
- package/dist/{chunk-RDX6GBWM.js → chunk-O5JZQUPX.js} +91 -45
- package/dist/cli.js +472 -193
- package/dist/index.js +4 -4
- package/dist/{intelligence-service-WZUM3AX6.js → intelligence-service-EITZP4KG.js} +2 -2
- package/dist/mcp.js +4 -4
- package/package.json +9 -9
- package/assets/assets/index-1wUFsyjk.js +0 -302
- package/assets/assets/index-f8lqs-ju.css +0 -1
|
@@ -168,8 +168,8 @@ var groundingSourceSchema = z2.object({
|
|
|
168
168
|
var querySnapshotDtoSchema = z2.object({
|
|
169
169
|
id: z2.string(),
|
|
170
170
|
runId: z2.string(),
|
|
171
|
-
|
|
172
|
-
|
|
171
|
+
queryId: z2.string(),
|
|
172
|
+
query: z2.string().optional(),
|
|
173
173
|
provider: providerNameSchema,
|
|
174
174
|
citationState: citationStateSchema,
|
|
175
175
|
answerMentioned: z2.boolean().optional(),
|
|
@@ -191,8 +191,8 @@ var snapshotListResponseSchema = z2.object({
|
|
|
191
191
|
total: z2.number().int().nonnegative()
|
|
192
192
|
});
|
|
193
193
|
var snapshotDiffRowSchema = z2.object({
|
|
194
|
-
|
|
195
|
-
|
|
194
|
+
queryId: z2.string().nullable(),
|
|
195
|
+
query: z2.string().nullable(),
|
|
196
196
|
run1State: citationStateSchema.nullable(),
|
|
197
197
|
run2State: citationStateSchema.nullable(),
|
|
198
198
|
run1AnswerMentioned: z2.boolean().nullable(),
|
|
@@ -311,18 +311,27 @@ var projectDtoSchema = z4.object({
|
|
|
311
311
|
createdAt: z4.string().optional(),
|
|
312
312
|
updatedAt: z4.string().optional()
|
|
313
313
|
});
|
|
314
|
+
var queryDtoSchema = z4.object({
|
|
315
|
+
id: z4.string(),
|
|
316
|
+
query: z4.string(),
|
|
317
|
+
createdAt: z4.string()
|
|
318
|
+
});
|
|
314
319
|
var keywordDtoSchema = z4.object({
|
|
315
320
|
id: z4.string(),
|
|
316
321
|
keyword: z4.string(),
|
|
317
322
|
createdAt: z4.string()
|
|
318
323
|
});
|
|
324
|
+
var queryBatchRequestSchema = z4.object({
|
|
325
|
+
queries: z4.array(z4.string().trim().min(1)).min(1)
|
|
326
|
+
});
|
|
319
327
|
var keywordBatchRequestSchema = z4.object({
|
|
320
328
|
keywords: z4.array(z4.string().trim().min(1)).min(1)
|
|
321
329
|
});
|
|
322
|
-
var
|
|
330
|
+
var queryGenerateRequestSchema = z4.object({
|
|
323
331
|
provider: providerNameSchema,
|
|
324
332
|
count: z4.number().int().min(1).max(20).optional()
|
|
325
333
|
});
|
|
334
|
+
var keywordGenerateRequestSchema = queryGenerateRequestSchema;
|
|
326
335
|
var competitorDtoSchema = z4.object({
|
|
327
336
|
id: z4.string(),
|
|
328
337
|
domain: z4.string(),
|
|
@@ -444,13 +453,15 @@ var configGoogleSchema = z5.object({
|
|
|
444
453
|
cron: z5.string().optional()
|
|
445
454
|
}).optional()
|
|
446
455
|
}).optional();
|
|
456
|
+
var configQueryListSchema = z5.array(z5.string().min(1));
|
|
447
457
|
var configSpecSchema = z5.object({
|
|
448
458
|
displayName: z5.string().min(1),
|
|
449
459
|
canonicalDomain: z5.string().min(1),
|
|
450
460
|
ownedDomains: z5.array(z5.string().min(1)).optional().default([]),
|
|
451
461
|
country: z5.string().length(2),
|
|
452
462
|
language: z5.string().min(2),
|
|
453
|
-
|
|
463
|
+
queries: configQueryListSchema.optional(),
|
|
464
|
+
keywords: configQueryListSchema.optional(),
|
|
454
465
|
competitors: z5.array(z5.string().min(1)).optional().default([]),
|
|
455
466
|
providers: z5.array(providerNameSchema).optional().default([]),
|
|
456
467
|
locations: z5.array(locationContextSchema).optional().default([]),
|
|
@@ -460,6 +471,13 @@ var configSpecSchema = z5.object({
|
|
|
460
471
|
google: configGoogleSchema,
|
|
461
472
|
autoExtractBacklinks: z5.boolean().optional().default(false)
|
|
462
473
|
}).superRefine((spec, ctx) => {
|
|
474
|
+
if (spec.queries !== void 0 && spec.keywords !== void 0) {
|
|
475
|
+
ctx.addIssue({
|
|
476
|
+
code: "custom",
|
|
477
|
+
message: "Use spec.queries; spec.keywords is accepted only as a legacy alias when spec.queries is omitted",
|
|
478
|
+
path: ["keywords"]
|
|
479
|
+
});
|
|
480
|
+
}
|
|
463
481
|
const duplicateLabels = findDuplicateLocationLabels(spec.locations);
|
|
464
482
|
if (duplicateLabels.length > 0) {
|
|
465
483
|
ctx.addIssue({
|
|
@@ -482,6 +500,9 @@ var projectConfigSchema = z5.object({
|
|
|
482
500
|
metadata: configMetadataSchema,
|
|
483
501
|
spec: configSpecSchema
|
|
484
502
|
});
|
|
503
|
+
function resolveConfigSpecQueries(spec) {
|
|
504
|
+
return spec.queries ?? spec.keywords ?? [];
|
|
505
|
+
}
|
|
485
506
|
|
|
486
507
|
// ../contracts/src/errors.ts
|
|
487
508
|
var AppError = class extends Error {
|
|
@@ -870,12 +891,25 @@ function isAgentProviderId(value) {
|
|
|
870
891
|
// ../contracts/src/snapshot.ts
|
|
871
892
|
import { z as z9 } from "zod";
|
|
872
893
|
var snapshotAccuracySchema = z9.enum(["yes", "no", "unknown", "not-mentioned"]);
|
|
894
|
+
var snapshotQueryListSchema = z9.array(z9.string().min(1));
|
|
873
895
|
var snapshotRequestSchema = z9.object({
|
|
874
896
|
companyName: z9.string().min(1),
|
|
875
897
|
domain: z9.string().min(1),
|
|
876
|
-
|
|
898
|
+
queries: snapshotQueryListSchema.optional(),
|
|
899
|
+
phrases: snapshotQueryListSchema.optional(),
|
|
877
900
|
competitors: z9.array(z9.string().min(1)).optional().default([])
|
|
901
|
+
}).superRefine((input, ctx) => {
|
|
902
|
+
if (input.queries !== void 0 && input.phrases !== void 0) {
|
|
903
|
+
ctx.addIssue({
|
|
904
|
+
code: "custom",
|
|
905
|
+
message: "Use queries; phrases is accepted only as a legacy alias when queries is omitted",
|
|
906
|
+
path: ["phrases"]
|
|
907
|
+
});
|
|
908
|
+
}
|
|
878
909
|
});
|
|
910
|
+
function resolveSnapshotRequestQueries(input) {
|
|
911
|
+
return input.queries ?? input.phrases ?? [];
|
|
912
|
+
}
|
|
879
913
|
var snapshotCompetitorEntrySchema = z9.object({
|
|
880
914
|
name: z9.string(),
|
|
881
915
|
count: z9.number().int().nonnegative()
|
|
@@ -925,7 +959,7 @@ var snapshotProviderResultSchema = z9.object({
|
|
|
925
959
|
error: z9.string().nullable().optional()
|
|
926
960
|
});
|
|
927
961
|
var snapshotQueryResultSchema = z9.object({
|
|
928
|
-
|
|
962
|
+
query: z9.string(),
|
|
929
963
|
providerResults: z9.array(snapshotProviderResultSchema).default([])
|
|
930
964
|
});
|
|
931
965
|
var snapshotSummarySchema = z9.object({
|
|
@@ -944,7 +978,7 @@ var snapshotReportSchema = z9.object({
|
|
|
944
978
|
domain: z9.string(),
|
|
945
979
|
homepageUrl: z9.string(),
|
|
946
980
|
generatedAt: z9.string(),
|
|
947
|
-
|
|
981
|
+
queries: z9.array(z9.string()).default([]),
|
|
948
982
|
competitors: z9.array(z9.string()).default([]),
|
|
949
983
|
profile: snapshotProfileSchema,
|
|
950
984
|
audit: snapshotAuditSchema,
|
|
@@ -1264,18 +1298,20 @@ function extractAnswerMentions(answerText, displayName, domains) {
|
|
|
1264
1298
|
if (matchesNormalized || matchesBrandKey) {
|
|
1265
1299
|
matchedTerms.push(displayName);
|
|
1266
1300
|
}
|
|
1267
|
-
const
|
|
1301
|
+
const brandTokens = collectBrandTokens(displayName, domains);
|
|
1302
|
+
const allTokens = [...brandTokens.primary, ...brandTokens.secondary];
|
|
1303
|
+
const secondarySet = new Set(brandTokens.secondary);
|
|
1268
1304
|
let tokenMatches = 0;
|
|
1269
|
-
const
|
|
1270
|
-
for (const token of
|
|
1305
|
+
const matchedPrimary = [];
|
|
1306
|
+
for (const token of allTokens) {
|
|
1271
1307
|
if (new RegExp(`\\b${escapeRegExp(token)}\\b`).test(lowerAnswer)) {
|
|
1272
1308
|
tokenMatches++;
|
|
1273
|
-
|
|
1309
|
+
if (!secondarySet.has(token)) matchedPrimary.push(token);
|
|
1274
1310
|
}
|
|
1275
1311
|
}
|
|
1276
|
-
const tokenThresholdMet =
|
|
1312
|
+
const tokenThresholdMet = allTokens.length > 0 && (allTokens.length === 1 && tokenMatches >= 1 || tokenMatches >= Math.min(2, allTokens.length));
|
|
1277
1313
|
if (tokenThresholdMet) {
|
|
1278
|
-
matchedTerms.push(...
|
|
1314
|
+
matchedTerms.push(...matchedPrimary);
|
|
1279
1315
|
}
|
|
1280
1316
|
const unique = [...new Set(matchedTerms)];
|
|
1281
1317
|
const domainMatches = unique.filter((t) => t.includes("."));
|
|
@@ -1303,18 +1339,24 @@ function domainMentioned(lowerAnswer, normalizedDomain) {
|
|
|
1303
1339
|
];
|
|
1304
1340
|
return patterns.some((pattern) => pattern.test(lowerAnswer));
|
|
1305
1341
|
}
|
|
1306
|
-
function
|
|
1307
|
-
const
|
|
1308
|
-
|
|
1309
|
-
|
|
1342
|
+
function collectBrandTokens(displayName, domains) {
|
|
1343
|
+
const primary = /* @__PURE__ */ new Set();
|
|
1344
|
+
const secondary = /* @__PURE__ */ new Set();
|
|
1345
|
+
const distinctiveWords = extractDistinctiveTokens(displayName);
|
|
1346
|
+
if (distinctiveWords.length > 0) {
|
|
1347
|
+
primary.add(distinctiveWords[0]);
|
|
1348
|
+
for (let i = 1; i < distinctiveWords.length; i++) {
|
|
1349
|
+
secondary.add(distinctiveWords[i]);
|
|
1350
|
+
}
|
|
1310
1351
|
}
|
|
1311
1352
|
for (const domain of domains) {
|
|
1312
1353
|
const reg = registrableDomain(domain);
|
|
1313
1354
|
const brand = reg ? brandLabelFromDomain(reg) : normalizeProjectDomain(domain).split("/")[0]?.split(".")[0] ?? "";
|
|
1314
1355
|
const token = brand.replace(/[^a-z0-9]/gi, "").toLowerCase();
|
|
1315
|
-
if (isDistinctiveToken(token))
|
|
1356
|
+
if (isDistinctiveToken(token)) primary.add(token);
|
|
1316
1357
|
}
|
|
1317
|
-
|
|
1358
|
+
for (const t of primary) secondary.delete(t);
|
|
1359
|
+
return { primary: [...primary], secondary: [...secondary] };
|
|
1318
1360
|
}
|
|
1319
1361
|
function extractDistinctiveTokens(value) {
|
|
1320
1362
|
return normalizeText(value).split(" ").filter(isDistinctiveToken);
|
|
@@ -1455,11 +1497,11 @@ var projectSearchSnapshotHitSchema = z15.object({
|
|
|
1455
1497
|
kind: z15.literal("snapshot"),
|
|
1456
1498
|
id: z15.string(),
|
|
1457
1499
|
runId: z15.string(),
|
|
1458
|
-
|
|
1500
|
+
query: z15.string(),
|
|
1459
1501
|
provider: z15.string(),
|
|
1460
1502
|
model: z15.string().nullable(),
|
|
1461
1503
|
citationState: citationStateSchema,
|
|
1462
|
-
matchedField: z15.enum(["answerText", "citedDomains", "searchQueries", "
|
|
1504
|
+
matchedField: z15.enum(["answerText", "citedDomains", "searchQueries", "query"]),
|
|
1463
1505
|
snippet: z15.string(),
|
|
1464
1506
|
createdAt: z15.string()
|
|
1465
1507
|
});
|
|
@@ -1470,9 +1512,9 @@ var projectSearchInsightHitSchema = z15.object({
|
|
|
1470
1512
|
type: z15.enum(["regression", "gain", "opportunity"]),
|
|
1471
1513
|
severity: z15.enum(["critical", "high", "medium", "low"]),
|
|
1472
1514
|
title: z15.string(),
|
|
1473
|
-
|
|
1515
|
+
query: z15.string(),
|
|
1474
1516
|
provider: z15.string(),
|
|
1475
|
-
matchedField: z15.enum(["title", "
|
|
1517
|
+
matchedField: z15.enum(["title", "query", "recommendation", "cause"]),
|
|
1476
1518
|
snippet: z15.string(),
|
|
1477
1519
|
dismissed: z15.boolean(),
|
|
1478
1520
|
createdAt: z15.string()
|
|
@@ -1785,16 +1827,16 @@ var citationCoverageProviderSchema = z18.object({
|
|
|
1785
1827
|
runCreatedAt: z18.string()
|
|
1786
1828
|
});
|
|
1787
1829
|
var citationCoverageRowSchema = z18.object({
|
|
1788
|
-
|
|
1789
|
-
|
|
1830
|
+
queryId: z18.string(),
|
|
1831
|
+
query: z18.string(),
|
|
1790
1832
|
providers: z18.array(citationCoverageProviderSchema),
|
|
1791
1833
|
citedCount: z18.number().int().nonnegative(),
|
|
1792
1834
|
mentionedCount: z18.number().int().nonnegative(),
|
|
1793
1835
|
totalProviders: z18.number().int().nonnegative()
|
|
1794
1836
|
});
|
|
1795
1837
|
var competitorGapRowSchema = z18.object({
|
|
1796
|
-
|
|
1797
|
-
|
|
1838
|
+
queryId: z18.string(),
|
|
1839
|
+
query: z18.string(),
|
|
1798
1840
|
provider: z18.string(),
|
|
1799
1841
|
citingCompetitors: z18.array(z18.string()),
|
|
1800
1842
|
runId: z18.string(),
|
|
@@ -1804,23 +1846,23 @@ var citationVisibilitySummarySchema = z18.object({
|
|
|
1804
1846
|
providersConfigured: z18.number().int().nonnegative(),
|
|
1805
1847
|
providersCiting: z18.number().int().nonnegative(),
|
|
1806
1848
|
providersMentioning: z18.number().int().nonnegative(),
|
|
1807
|
-
|
|
1808
|
-
// Cross-tab buckets — each tracked
|
|
1809
|
-
// in exactly one of these.
|
|
1810
|
-
// any bucket; (sum of buckets) ≤
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1849
|
+
totalQueries: z18.number().int().nonnegative(),
|
|
1850
|
+
// Cross-tab buckets — each tracked query with at least one snapshot lands
|
|
1851
|
+
// in exactly one of these. Queries with zero snapshots are not counted in
|
|
1852
|
+
// any bucket; (sum of buckets) ≤ totalQueries.
|
|
1853
|
+
queriesCitedAndMentioned: z18.number().int().nonnegative(),
|
|
1854
|
+
queriesCitedOnly: z18.number().int().nonnegative(),
|
|
1855
|
+
queriesMentionedOnly: z18.number().int().nonnegative(),
|
|
1856
|
+
queriesInvisible: z18.number().int().nonnegative(),
|
|
1815
1857
|
latestRunId: z18.string().nullable(),
|
|
1816
1858
|
latestRunAt: z18.string().nullable()
|
|
1817
1859
|
});
|
|
1818
1860
|
var citationVisibilityResponseSchema = z18.object({
|
|
1819
1861
|
summary: citationVisibilitySummarySchema,
|
|
1820
|
-
|
|
1862
|
+
byQuery: z18.array(citationCoverageRowSchema),
|
|
1821
1863
|
competitorGaps: z18.array(competitorGapRowSchema),
|
|
1822
1864
|
status: z18.enum(["ready", "no-data"]),
|
|
1823
|
-
reason: z18.enum(["no-runs-yet", "no-
|
|
1865
|
+
reason: z18.enum(["no-runs-yet", "no-queries"]).optional()
|
|
1824
1866
|
});
|
|
1825
1867
|
function emptyCitationVisibility(reason) {
|
|
1826
1868
|
return {
|
|
@@ -1828,15 +1870,15 @@ function emptyCitationVisibility(reason) {
|
|
|
1828
1870
|
providersConfigured: 0,
|
|
1829
1871
|
providersCiting: 0,
|
|
1830
1872
|
providersMentioning: 0,
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1873
|
+
totalQueries: 0,
|
|
1874
|
+
queriesCitedAndMentioned: 0,
|
|
1875
|
+
queriesCitedOnly: 0,
|
|
1876
|
+
queriesMentionedOnly: 0,
|
|
1877
|
+
queriesInvisible: 0,
|
|
1836
1878
|
latestRunId: null,
|
|
1837
1879
|
latestRunAt: null
|
|
1838
1880
|
},
|
|
1839
|
-
|
|
1881
|
+
byQuery: [],
|
|
1840
1882
|
competitorGaps: [],
|
|
1841
1883
|
status: "no-data",
|
|
1842
1884
|
reason
|
|
@@ -1865,7 +1907,9 @@ export {
|
|
|
1865
1907
|
findDuplicateLocationLabels,
|
|
1866
1908
|
hasLocationLabel,
|
|
1867
1909
|
projectUpsertRequestSchema,
|
|
1910
|
+
queryBatchRequestSchema,
|
|
1868
1911
|
keywordBatchRequestSchema,
|
|
1912
|
+
queryGenerateRequestSchema,
|
|
1869
1913
|
keywordGenerateRequestSchema,
|
|
1870
1914
|
competitorBatchRequestSchema,
|
|
1871
1915
|
normalizeProjectDomain,
|
|
@@ -1873,6 +1917,7 @@ export {
|
|
|
1873
1917
|
brandLabelFromDomain,
|
|
1874
1918
|
effectiveDomains,
|
|
1875
1919
|
projectConfigSchema,
|
|
1920
|
+
resolveConfigSpecQueries,
|
|
1876
1921
|
AppError,
|
|
1877
1922
|
notFound,
|
|
1878
1923
|
validationError,
|
|
@@ -1901,6 +1946,7 @@ export {
|
|
|
1901
1946
|
serializeRunError,
|
|
1902
1947
|
formatRunErrorOneLine,
|
|
1903
1948
|
snapshotRequestSchema,
|
|
1949
|
+
resolveSnapshotRequestQueries,
|
|
1904
1950
|
scheduleUpsertRequestSchema,
|
|
1905
1951
|
parseWindow,
|
|
1906
1952
|
windowCutoff,
|