@ainyc/canonry 4.57.0 → 4.59.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/agent-workspace/skills/canonry/SKILL.md +7 -0
- package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +44 -0
- package/assets/agent-workspace/skills/canonry/references/google-business-profile.md +219 -0
- package/assets/assets/{BacklinksPage-CmeFZ8UJ.js → BacklinksPage-D_mc7c-b.js} +1 -1
- package/assets/assets/{ChartPrimitives-D7C1Cp8w.js → ChartPrimitives-BViWneKX.js} +1 -1
- package/assets/assets/{ProjectPage-Y6uCyjGb.js → ProjectPage-_hpYJAN1.js} +1 -1
- package/assets/assets/{RunRow-BntNdrgM.js → RunRow-DK69_0iD.js} +1 -1
- package/assets/assets/{RunsPage-Btp6qn10.js → RunsPage-DRu1peAA.js} +1 -1
- package/assets/assets/{SettingsPage-DkyNiU2i.js → SettingsPage-BrednApH.js} +1 -1
- package/assets/assets/{TrafficPage-CBl4Mwdc.js → TrafficPage-oFA65ZZc.js} +1 -1
- package/assets/assets/{TrafficSourceDetailPage-BZzuWCn-.js → TrafficSourceDetailPage-CUzzaYFC.js} +1 -1
- package/assets/assets/{extract-error-message-De8_qAzs.js → extract-error-message-Cv4MXGtB.js} +1 -1
- package/assets/assets/{index-XUKhruAg.js → index-BrCh3uvb.js} +90 -90
- package/assets/assets/{server-traffic-bn9LSZN9.js → server-traffic-rYE-NlE-.js} +1 -1
- package/assets/assets/{trash-2-B5clF2rU.js → trash-2-BgGGPjQf.js} +1 -1
- package/assets/index.html +1 -1
- package/dist/{chunk-4KWPOVIT.js → chunk-JW6TQFU7.js} +171 -1
- package/dist/{chunk-WFVUZVJD.js → chunk-LPPW7O26.js} +1421 -1190
- package/dist/{chunk-HL6JZUEW.js → chunk-NOQ4ZE3E.js} +2158 -624
- package/dist/{chunk-6X5TF73A.js → chunk-TFBPLY77.js} +414 -1
- package/dist/cli.js +610 -458
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4 -4
- package/dist/{intelligence-service-NY3MAVPB.js → intelligence-service-V4SWVKEQ.js} +2 -2
- package/dist/mcp.js +10 -8
- package/package.json +8 -7
|
@@ -44,6 +44,9 @@ function authInvalid() {
|
|
|
44
44
|
function forbidden(message = "Forbidden") {
|
|
45
45
|
return new AppError("FORBIDDEN", message, 403);
|
|
46
46
|
}
|
|
47
|
+
function quotaExceeded(metric) {
|
|
48
|
+
return new AppError("QUOTA_EXCEEDED", `Quota exceeded for ${metric}`, 429);
|
|
49
|
+
}
|
|
47
50
|
function providerError(message, details) {
|
|
48
51
|
return new AppError("PROVIDER_ERROR", message, 502, details);
|
|
49
52
|
}
|
|
@@ -379,7 +382,8 @@ var runKindSchema = z3.enum([
|
|
|
379
382
|
"backlink-extract",
|
|
380
383
|
"traffic-sync",
|
|
381
384
|
"aeo-discover-seed",
|
|
382
|
-
"aeo-discover-probe"
|
|
385
|
+
"aeo-discover-probe",
|
|
386
|
+
"gbp-sync"
|
|
383
387
|
]);
|
|
384
388
|
var RunKinds = runKindSchema.enum;
|
|
385
389
|
var runTriggerSchema = z3.enum(["manual", "scheduled", "config-apply", "backfill", "probe"]);
|
|
@@ -685,7 +689,7 @@ function resolveConfigSpecQueries(spec) {
|
|
|
685
689
|
|
|
686
690
|
// ../contracts/src/google.ts
|
|
687
691
|
import { z as z6 } from "zod";
|
|
688
|
-
var googleConnectionTypeSchema = z6.enum(["gsc", "ga4"]);
|
|
692
|
+
var googleConnectionTypeSchema = z6.enum(["gsc", "ga4", "gbp"]);
|
|
689
693
|
var googleConnectionDtoSchema = z6.object({
|
|
690
694
|
id: z6.string(),
|
|
691
695
|
domain: z6.string(),
|
|
@@ -822,252 +826,447 @@ var gscSitemapListResponseDtoSchema = z6.object({
|
|
|
822
826
|
sitemaps: z6.array(gscSitemapDtoSchema).default([])
|
|
823
827
|
});
|
|
824
828
|
|
|
825
|
-
// ../contracts/src/
|
|
829
|
+
// ../contracts/src/gbp.ts
|
|
826
830
|
import { z as z7 } from "zod";
|
|
827
|
-
var
|
|
831
|
+
var gbpAccountDtoSchema = z7.object({
|
|
832
|
+
/** Resource name, "accounts/{n}". */
|
|
833
|
+
name: z7.string(),
|
|
834
|
+
/** Human-readable account name, or null when Google omits it. */
|
|
835
|
+
accountName: z7.string().nullable(),
|
|
836
|
+
/** Account type (PERSONAL, LOCATION_GROUP, ORGANIZATION, …) when present. */
|
|
837
|
+
type: z7.string().nullable(),
|
|
838
|
+
/** The OAuth user's role on the account (OWNER, MANAGER, …) when present. */
|
|
839
|
+
role: z7.string().nullable()
|
|
840
|
+
});
|
|
841
|
+
var gbpAccountListResponseSchema = z7.object({
|
|
842
|
+
accounts: z7.array(gbpAccountDtoSchema),
|
|
843
|
+
total: z7.number().int().nonnegative()
|
|
844
|
+
});
|
|
845
|
+
var gbpLocationDtoSchema = z7.object({
|
|
828
846
|
id: z7.string(),
|
|
829
|
-
|
|
830
|
-
|
|
847
|
+
projectId: z7.string(),
|
|
848
|
+
accountName: z7.string(),
|
|
849
|
+
locationName: z7.string(),
|
|
850
|
+
displayName: z7.string(),
|
|
851
|
+
primaryCategoryDisplayName: z7.string().nullable(),
|
|
852
|
+
storefrontAddress: z7.string().nullable(),
|
|
853
|
+
websiteUri: z7.string().nullable(),
|
|
854
|
+
selected: z7.boolean(),
|
|
855
|
+
syncedAt: z7.string().nullable(),
|
|
831
856
|
createdAt: z7.string(),
|
|
832
857
|
updatedAt: z7.string()
|
|
833
858
|
});
|
|
834
|
-
var
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
859
|
+
var gbpLocationListResponseSchema = z7.object({
|
|
860
|
+
locations: z7.array(gbpLocationDtoSchema),
|
|
861
|
+
totalDiscovered: z7.number().int().nonnegative(),
|
|
862
|
+
totalSelected: z7.number().int().nonnegative()
|
|
863
|
+
});
|
|
864
|
+
var gbpDiscoverRequestSchema = z7.object({
|
|
865
|
+
selectAllNew: z7.boolean().default(true),
|
|
866
|
+
/**
|
|
867
|
+
* Discover locations under this specific account ("accounts/{n}"). Omit to
|
|
868
|
+
* use the account the project already tracks, falling back to the first
|
|
869
|
+
* account the OAuth user can see on the very first discover.
|
|
870
|
+
*/
|
|
871
|
+
accountName: z7.string().optional(),
|
|
872
|
+
/**
|
|
873
|
+
* Permit replacing the project's locations when `accountName` names a
|
|
874
|
+
* DIFFERENT account than the one currently tracked. Switching is destructive
|
|
875
|
+
* (it clears the old account's locations + synced data), so it must be opted
|
|
876
|
+
* into explicitly — otherwise a mismatched account is rejected.
|
|
877
|
+
*/
|
|
878
|
+
switchAccount: z7.boolean().default(false)
|
|
879
|
+
});
|
|
880
|
+
var gbpLocationSelectionRequestSchema = z7.object({
|
|
881
|
+
selected: z7.boolean()
|
|
882
|
+
});
|
|
883
|
+
var gbpSyncRequestSchema = z7.object({
|
|
884
|
+
/** Restrict the sync to specific locations (resource names). Omit = all selected. */
|
|
885
|
+
locationNames: z7.array(z7.string()).optional(),
|
|
886
|
+
daysOfMetrics: z7.number().int().positive().max(540).optional(),
|
|
887
|
+
monthsOfKeywords: z7.number().int().positive().max(18).optional()
|
|
888
|
+
});
|
|
889
|
+
var gbpSyncResponseSchema = z7.object({
|
|
890
|
+
runId: z7.string(),
|
|
891
|
+
status: z7.string()
|
|
892
|
+
});
|
|
893
|
+
var gbpDailyMetricDtoSchema = z7.object({
|
|
894
|
+
locationName: z7.string(),
|
|
868
895
|
date: z7.string(),
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
896
|
+
metric: z7.string(),
|
|
897
|
+
value: z7.number().int()
|
|
898
|
+
});
|
|
899
|
+
var gbpDailyMetricListResponseSchema = z7.object({
|
|
900
|
+
metrics: z7.array(gbpDailyMetricDtoSchema),
|
|
901
|
+
total: z7.number().int().nonnegative()
|
|
902
|
+
});
|
|
903
|
+
var gbpKeywordImpressionDtoSchema = z7.object({
|
|
904
|
+
locationName: z7.string(),
|
|
905
|
+
// The Performance API returns one impressions figure per keyword aggregated
|
|
906
|
+
// over the whole requested range — it does NOT break the count down by month.
|
|
907
|
+
// `periodStart`/`periodEnd` (both YYYY-MM, inclusive) record that trailing
|
|
908
|
+
// window so the figure is never mistaken for a single calendar month.
|
|
909
|
+
periodStart: z7.string(),
|
|
910
|
+
periodEnd: z7.string(),
|
|
911
|
+
keyword: z7.string(),
|
|
912
|
+
/** Exact impressions over [periodStart, periodEnd], or null when Google redacted to a threshold. */
|
|
913
|
+
valueCount: z7.number().int().nullable(),
|
|
914
|
+
/** Privacy floor, or null when an exact value is available. */
|
|
915
|
+
valueThreshold: z7.number().int().nullable()
|
|
916
|
+
});
|
|
917
|
+
var gbpKeywordImpressionListResponseSchema = z7.object({
|
|
918
|
+
keywords: z7.array(gbpKeywordImpressionDtoSchema),
|
|
919
|
+
total: z7.number().int().nonnegative(),
|
|
920
|
+
/** Share of returned keywords that are privacy-thresholded (0–100, rounded). */
|
|
921
|
+
thresholdedPct: z7.number().int().min(0).max(100)
|
|
922
|
+
});
|
|
923
|
+
var gbpPlaceActionDtoSchema = z7.object({
|
|
924
|
+
locationName: z7.string(),
|
|
925
|
+
placeActionLinkName: z7.string(),
|
|
926
|
+
placeActionType: z7.string(),
|
|
927
|
+
uri: z7.string().nullable(),
|
|
928
|
+
isPreferred: z7.boolean(),
|
|
929
|
+
providerType: z7.string().nullable()
|
|
930
|
+
});
|
|
931
|
+
var gbpPlaceActionListResponseSchema = z7.object({
|
|
932
|
+
placeActions: z7.array(gbpPlaceActionDtoSchema),
|
|
933
|
+
total: z7.number().int().nonnegative()
|
|
934
|
+
});
|
|
935
|
+
var gbpLodgingDtoSchema = z7.object({
|
|
936
|
+
locationName: z7.string(),
|
|
937
|
+
/** Count of non-empty top-level attribute groups (0 = empty profile / AEO gap). */
|
|
938
|
+
populatedGroupCount: z7.number().int().nonnegative(),
|
|
939
|
+
syncedAt: z7.string(),
|
|
940
|
+
/** Raw Lodging resource as Google returned it. */
|
|
941
|
+
attributes: z7.record(z7.string(), z7.unknown())
|
|
942
|
+
});
|
|
943
|
+
var gbpLodgingListResponseSchema = z7.object({
|
|
944
|
+
lodging: z7.array(gbpLodgingDtoSchema),
|
|
945
|
+
total: z7.number().int().nonnegative()
|
|
946
|
+
});
|
|
947
|
+
var gbpSummaryDtoSchema = z7.object({
|
|
948
|
+
scope: z7.object({
|
|
949
|
+
locationName: z7.string().nullable(),
|
|
950
|
+
locationCount: z7.number().int().nonnegative()
|
|
951
|
+
}),
|
|
952
|
+
performance: z7.object({
|
|
953
|
+
totals: z7.record(z7.string(), z7.number()),
|
|
954
|
+
recent7d: z7.record(z7.string(), z7.number()),
|
|
955
|
+
prior7d: z7.record(z7.string(), z7.number()),
|
|
956
|
+
deltaPct: z7.record(z7.string(), z7.number().nullable())
|
|
957
|
+
}),
|
|
958
|
+
keywords: z7.object({
|
|
959
|
+
total: z7.number().int().nonnegative(),
|
|
960
|
+
thresholdedCount: z7.number().int().nonnegative(),
|
|
961
|
+
thresholdedPct: z7.number().int().min(0).max(100)
|
|
962
|
+
}),
|
|
963
|
+
placeActions: z7.object({
|
|
881
964
|
total: z7.number().int().nonnegative(),
|
|
882
|
-
|
|
883
|
-
|
|
965
|
+
hasReservationCta: z7.boolean(),
|
|
966
|
+
hasBookingCta: z7.boolean(),
|
|
967
|
+
hasDirectMerchantCta: z7.boolean()
|
|
968
|
+
}),
|
|
969
|
+
lodging: z7.object({
|
|
970
|
+
lodgingLocationCount: z7.number().int().nonnegative(),
|
|
971
|
+
populatedLodgingCount: z7.number().int().nonnegative(),
|
|
972
|
+
emptyLodgingCount: z7.number().int().nonnegative()
|
|
973
|
+
})
|
|
974
|
+
});
|
|
975
|
+
|
|
976
|
+
// ../contracts/src/retry.ts
|
|
977
|
+
var DEFAULT_BASE_DELAY_MS = 1e3;
|
|
978
|
+
function backoffDelayMs(attempt, opts = {}) {
|
|
979
|
+
const base = opts.baseDelayMs ?? DEFAULT_BASE_DELAY_MS;
|
|
980
|
+
const jitter = opts.jitter ?? true;
|
|
981
|
+
const raw = base * Math.pow(2, attempt);
|
|
982
|
+
const delay = jitter ? Math.random() * raw : raw;
|
|
983
|
+
return opts.maxDelayMs !== void 0 ? Math.min(opts.maxDelayMs, delay) : delay;
|
|
984
|
+
}
|
|
985
|
+
var DEFAULT_MAX_RETRIES = 3;
|
|
986
|
+
function defaultSleep(ms) {
|
|
987
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
988
|
+
}
|
|
989
|
+
async function withRetry(fn, opts = {}) {
|
|
990
|
+
const maxRetries = opts.maxRetries ?? DEFAULT_MAX_RETRIES;
|
|
991
|
+
const isRetryable = opts.isRetryable ?? (() => true);
|
|
992
|
+
const sleep = opts.sleep ?? defaultSleep;
|
|
993
|
+
let lastErr;
|
|
994
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
995
|
+
try {
|
|
996
|
+
return await fn();
|
|
997
|
+
} catch (err) {
|
|
998
|
+
lastErr = err;
|
|
999
|
+
if (attempt >= maxRetries || !isRetryable(err)) throw err;
|
|
1000
|
+
const defaultMs = backoffDelayMs(attempt, opts);
|
|
1001
|
+
const delayMs = opts.computeDelayMs?.(attempt, err, defaultMs) ?? defaultMs;
|
|
1002
|
+
opts.onRetry?.({ attempt, err, delayMs });
|
|
1003
|
+
await sleep(delayMs);
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
throw lastErr;
|
|
1007
|
+
}
|
|
1008
|
+
function isRetryableHttpError(err) {
|
|
1009
|
+
if (err != null && typeof err === "object" && "status" in err) {
|
|
1010
|
+
const status = err.status;
|
|
1011
|
+
if (typeof status === "number") {
|
|
1012
|
+
return status >= 500 || status === 429;
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
if (err instanceof Error) {
|
|
1016
|
+
const msg = err.message.toLowerCase();
|
|
1017
|
+
if (msg.includes("fetch failed") || msg.includes("econnreset") || msg.includes("etimedout") || msg.includes("enotfound") || msg.includes("econnrefused") || msg.includes("network error")) {
|
|
1018
|
+
return true;
|
|
1019
|
+
}
|
|
1020
|
+
}
|
|
1021
|
+
return true;
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
// ../contracts/src/bing.ts
|
|
1025
|
+
import { z as z8 } from "zod";
|
|
1026
|
+
var bingConnectionDtoSchema = z8.object({
|
|
1027
|
+
id: z8.string(),
|
|
1028
|
+
domain: z8.string(),
|
|
1029
|
+
siteUrl: z8.string().nullable().optional(),
|
|
1030
|
+
createdAt: z8.string(),
|
|
1031
|
+
updatedAt: z8.string()
|
|
1032
|
+
});
|
|
1033
|
+
var bingUrlInspectionDtoSchema = z8.object({
|
|
1034
|
+
id: z8.string(),
|
|
1035
|
+
url: z8.string(),
|
|
1036
|
+
httpCode: z8.number().nullable().optional(),
|
|
1037
|
+
inIndex: z8.boolean().nullable().optional(),
|
|
1038
|
+
lastCrawledDate: z8.string().nullable().optional(),
|
|
1039
|
+
inIndexDate: z8.string().nullable().optional(),
|
|
1040
|
+
inspectedAt: z8.string(),
|
|
1041
|
+
// Fields derived from GetUrlInfo response (more reliable than InIndex)
|
|
1042
|
+
documentSize: z8.number().nullable().optional(),
|
|
1043
|
+
anchorCount: z8.number().nullable().optional(),
|
|
1044
|
+
discoveryDate: z8.string().nullable().optional()
|
|
1045
|
+
});
|
|
1046
|
+
var bingCoverageSummaryDtoSchema = z8.object({
|
|
1047
|
+
summary: z8.object({
|
|
1048
|
+
total: z8.number(),
|
|
1049
|
+
indexed: z8.number(),
|
|
1050
|
+
notIndexed: z8.number(),
|
|
1051
|
+
unknown: z8.number().optional(),
|
|
1052
|
+
percentage: z8.number()
|
|
1053
|
+
}),
|
|
1054
|
+
lastInspectedAt: z8.string().nullable(),
|
|
1055
|
+
indexed: z8.array(bingUrlInspectionDtoSchema).default([]),
|
|
1056
|
+
notIndexed: z8.array(bingUrlInspectionDtoSchema).default([]),
|
|
1057
|
+
unknown: z8.array(bingUrlInspectionDtoSchema).default([]).optional()
|
|
1058
|
+
});
|
|
1059
|
+
var bingKeywordStatsDtoSchema = z8.object({
|
|
1060
|
+
query: z8.string(),
|
|
1061
|
+
impressions: z8.number(),
|
|
1062
|
+
clicks: z8.number(),
|
|
1063
|
+
ctr: z8.number(),
|
|
1064
|
+
averagePosition: z8.number()
|
|
1065
|
+
});
|
|
1066
|
+
var bingCoverageSnapshotDtoSchema = z8.object({
|
|
1067
|
+
date: z8.string(),
|
|
1068
|
+
indexed: z8.number(),
|
|
1069
|
+
notIndexed: z8.number(),
|
|
1070
|
+
unknown: z8.number()
|
|
1071
|
+
});
|
|
1072
|
+
var bingSubmitResultDtoSchema = z8.object({
|
|
1073
|
+
url: z8.string(),
|
|
1074
|
+
status: z8.enum(["success", "error"]),
|
|
1075
|
+
submittedAt: z8.string(),
|
|
1076
|
+
error: z8.string().optional()
|
|
1077
|
+
});
|
|
1078
|
+
var bingIndexingRequestResponseDtoSchema = z8.object({
|
|
1079
|
+
summary: z8.object({
|
|
1080
|
+
total: z8.number().int().nonnegative(),
|
|
1081
|
+
succeeded: z8.number().int().nonnegative(),
|
|
1082
|
+
failed: z8.number().int().nonnegative()
|
|
884
1083
|
}),
|
|
885
|
-
results:
|
|
1084
|
+
results: z8.array(bingSubmitResultDtoSchema).default([])
|
|
886
1085
|
});
|
|
887
|
-
var bingSiteDtoSchema =
|
|
888
|
-
url:
|
|
889
|
-
verified:
|
|
1086
|
+
var bingSiteDtoSchema = z8.object({
|
|
1087
|
+
url: z8.string(),
|
|
1088
|
+
verified: z8.boolean()
|
|
890
1089
|
});
|
|
891
|
-
var bingSitesResponseDtoSchema =
|
|
892
|
-
sites:
|
|
1090
|
+
var bingSitesResponseDtoSchema = z8.object({
|
|
1091
|
+
sites: z8.array(bingSiteDtoSchema).default([])
|
|
893
1092
|
});
|
|
894
|
-
var bingStatusDtoSchema =
|
|
895
|
-
connected:
|
|
896
|
-
domain:
|
|
897
|
-
siteUrl:
|
|
898
|
-
createdAt:
|
|
899
|
-
updatedAt:
|
|
1093
|
+
var bingStatusDtoSchema = z8.object({
|
|
1094
|
+
connected: z8.boolean(),
|
|
1095
|
+
domain: z8.string(),
|
|
1096
|
+
siteUrl: z8.string().nullable(),
|
|
1097
|
+
createdAt: z8.string().nullable(),
|
|
1098
|
+
updatedAt: z8.string().nullable()
|
|
900
1099
|
});
|
|
901
|
-
var bingConnectResponseDtoSchema =
|
|
902
|
-
connected:
|
|
903
|
-
domain:
|
|
904
|
-
siteUrl:
|
|
905
|
-
availableSites:
|
|
1100
|
+
var bingConnectResponseDtoSchema = z8.object({
|
|
1101
|
+
connected: z8.boolean(),
|
|
1102
|
+
domain: z8.string(),
|
|
1103
|
+
siteUrl: z8.string().nullable(),
|
|
1104
|
+
availableSites: z8.array(bingSiteDtoSchema).default([])
|
|
906
1105
|
});
|
|
907
|
-
var bingSetSiteResponseDtoSchema =
|
|
908
|
-
siteUrl:
|
|
1106
|
+
var bingSetSiteResponseDtoSchema = z8.object({
|
|
1107
|
+
siteUrl: z8.string()
|
|
909
1108
|
});
|
|
910
1109
|
|
|
911
1110
|
// ../contracts/src/cdp.ts
|
|
912
|
-
import { z as
|
|
913
|
-
var cdpTargetStatusDtoSchema =
|
|
914
|
-
name:
|
|
915
|
-
alive:
|
|
916
|
-
lastUsed:
|
|
1111
|
+
import { z as z9 } from "zod";
|
|
1112
|
+
var cdpTargetStatusDtoSchema = z9.object({
|
|
1113
|
+
name: z9.string(),
|
|
1114
|
+
alive: z9.boolean(),
|
|
1115
|
+
lastUsed: z9.string().nullable()
|
|
917
1116
|
});
|
|
918
|
-
var cdpStatusDtoSchema =
|
|
919
|
-
connected:
|
|
920
|
-
endpoint:
|
|
921
|
-
version:
|
|
922
|
-
browserVersion:
|
|
923
|
-
targets:
|
|
1117
|
+
var cdpStatusDtoSchema = z9.object({
|
|
1118
|
+
connected: z9.boolean(),
|
|
1119
|
+
endpoint: z9.string(),
|
|
1120
|
+
version: z9.string().optional(),
|
|
1121
|
+
browserVersion: z9.string().optional(),
|
|
1122
|
+
targets: z9.array(cdpTargetStatusDtoSchema).default([])
|
|
924
1123
|
});
|
|
925
1124
|
|
|
926
1125
|
// ../contracts/src/wordpress.ts
|
|
927
|
-
import { z as
|
|
928
|
-
var wordpressEnvSchema =
|
|
929
|
-
var wordpressConnectionDtoSchema =
|
|
930
|
-
projectName:
|
|
931
|
-
url:
|
|
932
|
-
stagingUrl:
|
|
933
|
-
username:
|
|
1126
|
+
import { z as z10 } from "zod";
|
|
1127
|
+
var wordpressEnvSchema = z10.enum(["live", "staging"]);
|
|
1128
|
+
var wordpressConnectionDtoSchema = z10.object({
|
|
1129
|
+
projectName: z10.string(),
|
|
1130
|
+
url: z10.string(),
|
|
1131
|
+
stagingUrl: z10.string().optional(),
|
|
1132
|
+
username: z10.string(),
|
|
934
1133
|
defaultEnv: wordpressEnvSchema,
|
|
935
|
-
createdAt:
|
|
936
|
-
updatedAt:
|
|
937
|
-
});
|
|
938
|
-
var wordpressSiteStatusDtoSchema =
|
|
939
|
-
url:
|
|
940
|
-
reachable:
|
|
941
|
-
pageCount:
|
|
942
|
-
version:
|
|
943
|
-
error:
|
|
944
|
-
plugins:
|
|
945
|
-
authenticatedUser:
|
|
946
|
-
id:
|
|
947
|
-
slug:
|
|
1134
|
+
createdAt: z10.string(),
|
|
1135
|
+
updatedAt: z10.string()
|
|
1136
|
+
});
|
|
1137
|
+
var wordpressSiteStatusDtoSchema = z10.object({
|
|
1138
|
+
url: z10.string(),
|
|
1139
|
+
reachable: z10.boolean(),
|
|
1140
|
+
pageCount: z10.number().nullable().optional(),
|
|
1141
|
+
version: z10.string().nullable().optional(),
|
|
1142
|
+
error: z10.string().nullable().optional(),
|
|
1143
|
+
plugins: z10.array(z10.string()).optional(),
|
|
1144
|
+
authenticatedUser: z10.object({
|
|
1145
|
+
id: z10.number(),
|
|
1146
|
+
slug: z10.string()
|
|
948
1147
|
}).nullable().optional()
|
|
949
1148
|
});
|
|
950
|
-
var wordpressStatusDtoSchema =
|
|
951
|
-
connected:
|
|
952
|
-
projectName:
|
|
1149
|
+
var wordpressStatusDtoSchema = z10.object({
|
|
1150
|
+
connected: z10.boolean(),
|
|
1151
|
+
projectName: z10.string(),
|
|
953
1152
|
defaultEnv: wordpressEnvSchema,
|
|
954
1153
|
live: wordpressSiteStatusDtoSchema.nullable(),
|
|
955
1154
|
staging: wordpressSiteStatusDtoSchema.nullable(),
|
|
956
|
-
adminUrl:
|
|
957
|
-
});
|
|
958
|
-
var wordpressPageSummaryDtoSchema =
|
|
959
|
-
id:
|
|
960
|
-
slug:
|
|
961
|
-
title:
|
|
962
|
-
status:
|
|
963
|
-
modifiedAt:
|
|
964
|
-
link:
|
|
965
|
-
});
|
|
966
|
-
var wordpressSeoStateDtoSchema =
|
|
967
|
-
title:
|
|
968
|
-
description:
|
|
969
|
-
noindex:
|
|
970
|
-
writable:
|
|
971
|
-
writeTargets:
|
|
972
|
-
});
|
|
973
|
-
var wordpressSchemaBlockDtoSchema =
|
|
974
|
-
type:
|
|
975
|
-
json:
|
|
1155
|
+
adminUrl: z10.string().nullable().optional()
|
|
1156
|
+
});
|
|
1157
|
+
var wordpressPageSummaryDtoSchema = z10.object({
|
|
1158
|
+
id: z10.number(),
|
|
1159
|
+
slug: z10.string(),
|
|
1160
|
+
title: z10.string(),
|
|
1161
|
+
status: z10.string(),
|
|
1162
|
+
modifiedAt: z10.string().nullable().optional(),
|
|
1163
|
+
link: z10.string().nullable().optional()
|
|
1164
|
+
});
|
|
1165
|
+
var wordpressSeoStateDtoSchema = z10.object({
|
|
1166
|
+
title: z10.string().nullable(),
|
|
1167
|
+
description: z10.string().nullable(),
|
|
1168
|
+
noindex: z10.boolean().nullable(),
|
|
1169
|
+
writable: z10.boolean().default(false),
|
|
1170
|
+
writeTargets: z10.array(z10.string()).default([])
|
|
1171
|
+
});
|
|
1172
|
+
var wordpressSchemaBlockDtoSchema = z10.object({
|
|
1173
|
+
type: z10.string(),
|
|
1174
|
+
json: z10.record(z10.string(), z10.unknown())
|
|
976
1175
|
});
|
|
977
1176
|
var wordpressPageDetailDtoSchema = wordpressPageSummaryDtoSchema.extend({
|
|
978
1177
|
env: wordpressEnvSchema,
|
|
979
|
-
content:
|
|
1178
|
+
content: z10.string(),
|
|
980
1179
|
seo: wordpressSeoStateDtoSchema,
|
|
981
|
-
schemaBlocks:
|
|
1180
|
+
schemaBlocks: z10.array(wordpressSchemaBlockDtoSchema).default([])
|
|
982
1181
|
});
|
|
983
1182
|
var wordpressDiffPageDtoSchema = wordpressPageDetailDtoSchema.extend({
|
|
984
|
-
contentHash:
|
|
985
|
-
contentSnippet:
|
|
986
|
-
});
|
|
987
|
-
var wordpressManualAssistDtoSchema =
|
|
988
|
-
manualRequired:
|
|
989
|
-
targetUrl:
|
|
990
|
-
adminUrl:
|
|
991
|
-
content:
|
|
992
|
-
nextSteps:
|
|
993
|
-
});
|
|
994
|
-
var wordpressAuditIssueDtoSchema =
|
|
995
|
-
slug:
|
|
996
|
-
severity:
|
|
997
|
-
code:
|
|
1183
|
+
contentHash: z10.string(),
|
|
1184
|
+
contentSnippet: z10.string()
|
|
1185
|
+
});
|
|
1186
|
+
var wordpressManualAssistDtoSchema = z10.object({
|
|
1187
|
+
manualRequired: z10.literal(true),
|
|
1188
|
+
targetUrl: z10.string(),
|
|
1189
|
+
adminUrl: z10.string().nullable().optional(),
|
|
1190
|
+
content: z10.string(),
|
|
1191
|
+
nextSteps: z10.array(z10.string()).default([])
|
|
1192
|
+
});
|
|
1193
|
+
var wordpressAuditIssueDtoSchema = z10.object({
|
|
1194
|
+
slug: z10.string(),
|
|
1195
|
+
severity: z10.enum(["high", "medium", "low"]),
|
|
1196
|
+
code: z10.enum([
|
|
998
1197
|
"noindex",
|
|
999
1198
|
"missing-seo-title",
|
|
1000
1199
|
"missing-meta-description",
|
|
1001
1200
|
"missing-schema",
|
|
1002
1201
|
"thin-content"
|
|
1003
1202
|
]),
|
|
1004
|
-
message:
|
|
1203
|
+
message: z10.string()
|
|
1005
1204
|
});
|
|
1006
|
-
var wordpressAuditPageDtoSchema =
|
|
1007
|
-
slug:
|
|
1008
|
-
title:
|
|
1009
|
-
status:
|
|
1010
|
-
wordCount:
|
|
1205
|
+
var wordpressAuditPageDtoSchema = z10.object({
|
|
1206
|
+
slug: z10.string(),
|
|
1207
|
+
title: z10.string(),
|
|
1208
|
+
status: z10.string(),
|
|
1209
|
+
wordCount: z10.number(),
|
|
1011
1210
|
seo: wordpressSeoStateDtoSchema,
|
|
1012
|
-
schemaPresent:
|
|
1013
|
-
issues:
|
|
1211
|
+
schemaPresent: z10.boolean(),
|
|
1212
|
+
issues: z10.array(wordpressAuditIssueDtoSchema).default([])
|
|
1014
1213
|
});
|
|
1015
|
-
var wordpressBulkMetaEntryResultDtoSchema =
|
|
1016
|
-
slug:
|
|
1017
|
-
status:
|
|
1018
|
-
error:
|
|
1214
|
+
var wordpressBulkMetaEntryResultDtoSchema = z10.object({
|
|
1215
|
+
slug: z10.string(),
|
|
1216
|
+
status: z10.enum(["applied", "skipped", "manual"]),
|
|
1217
|
+
error: z10.string().optional(),
|
|
1019
1218
|
manualAssist: wordpressManualAssistDtoSchema.optional()
|
|
1020
1219
|
});
|
|
1021
|
-
var wordpressBulkMetaResultDtoSchema =
|
|
1220
|
+
var wordpressBulkMetaResultDtoSchema = z10.object({
|
|
1022
1221
|
env: wordpressEnvSchema,
|
|
1023
|
-
strategy:
|
|
1024
|
-
results:
|
|
1222
|
+
strategy: z10.enum(["plugin", "manual"]),
|
|
1223
|
+
results: z10.array(wordpressBulkMetaEntryResultDtoSchema)
|
|
1025
1224
|
});
|
|
1026
|
-
var wordpressSchemaDeployEntryResultDtoSchema =
|
|
1027
|
-
slug:
|
|
1028
|
-
status:
|
|
1029
|
-
schemasInjected:
|
|
1225
|
+
var wordpressSchemaDeployEntryResultDtoSchema = z10.object({
|
|
1226
|
+
slug: z10.string(),
|
|
1227
|
+
status: z10.enum(["deployed", "stripped", "skipped", "failed"]),
|
|
1228
|
+
schemasInjected: z10.array(z10.string()).optional(),
|
|
1030
1229
|
manualAssist: wordpressManualAssistDtoSchema.optional(),
|
|
1031
|
-
error:
|
|
1230
|
+
error: z10.string().optional()
|
|
1032
1231
|
});
|
|
1033
|
-
var wordpressSchemaDeployResultDtoSchema =
|
|
1232
|
+
var wordpressSchemaDeployResultDtoSchema = z10.object({
|
|
1034
1233
|
env: wordpressEnvSchema,
|
|
1035
|
-
results:
|
|
1234
|
+
results: z10.array(wordpressSchemaDeployEntryResultDtoSchema)
|
|
1036
1235
|
});
|
|
1037
|
-
var wordpressSchemaStatusPageDtoSchema =
|
|
1038
|
-
slug:
|
|
1039
|
-
title:
|
|
1040
|
-
canonrySchemas:
|
|
1041
|
-
thirdPartySchemas:
|
|
1042
|
-
hasCanonrySchema:
|
|
1236
|
+
var wordpressSchemaStatusPageDtoSchema = z10.object({
|
|
1237
|
+
slug: z10.string(),
|
|
1238
|
+
title: z10.string(),
|
|
1239
|
+
canonrySchemas: z10.array(z10.string()),
|
|
1240
|
+
thirdPartySchemas: z10.array(z10.string()),
|
|
1241
|
+
hasCanonrySchema: z10.boolean()
|
|
1043
1242
|
});
|
|
1044
|
-
var wordpressSchemaStatusResultDtoSchema =
|
|
1243
|
+
var wordpressSchemaStatusResultDtoSchema = z10.object({
|
|
1045
1244
|
env: wordpressEnvSchema,
|
|
1046
|
-
pages:
|
|
1245
|
+
pages: z10.array(wordpressSchemaStatusPageDtoSchema)
|
|
1047
1246
|
});
|
|
1048
|
-
var wordpressOnboardStepDtoSchema =
|
|
1049
|
-
name:
|
|
1050
|
-
status:
|
|
1051
|
-
summary:
|
|
1052
|
-
error:
|
|
1247
|
+
var wordpressOnboardStepDtoSchema = z10.object({
|
|
1248
|
+
name: z10.string(),
|
|
1249
|
+
status: z10.enum(["completed", "skipped", "failed"]),
|
|
1250
|
+
summary: z10.string().optional(),
|
|
1251
|
+
error: z10.string().optional()
|
|
1053
1252
|
});
|
|
1054
|
-
var wordpressOnboardResultDtoSchema =
|
|
1055
|
-
projectName:
|
|
1056
|
-
steps:
|
|
1253
|
+
var wordpressOnboardResultDtoSchema = z10.object({
|
|
1254
|
+
projectName: z10.string(),
|
|
1255
|
+
steps: z10.array(wordpressOnboardStepDtoSchema)
|
|
1057
1256
|
});
|
|
1058
|
-
var wordpressDiffDtoSchema =
|
|
1059
|
-
slug:
|
|
1257
|
+
var wordpressDiffDtoSchema = z10.object({
|
|
1258
|
+
slug: z10.string(),
|
|
1060
1259
|
live: wordpressDiffPageDtoSchema,
|
|
1061
1260
|
staging: wordpressDiffPageDtoSchema,
|
|
1062
|
-
hasDifferences:
|
|
1063
|
-
differences:
|
|
1064
|
-
title:
|
|
1065
|
-
slug:
|
|
1066
|
-
content:
|
|
1067
|
-
seoTitle:
|
|
1068
|
-
seoDescription:
|
|
1069
|
-
noindex:
|
|
1070
|
-
schema:
|
|
1261
|
+
hasDifferences: z10.boolean(),
|
|
1262
|
+
differences: z10.object({
|
|
1263
|
+
title: z10.boolean(),
|
|
1264
|
+
slug: z10.boolean(),
|
|
1265
|
+
content: z10.boolean(),
|
|
1266
|
+
seoTitle: z10.boolean(),
|
|
1267
|
+
seoDescription: z10.boolean(),
|
|
1268
|
+
noindex: z10.boolean(),
|
|
1269
|
+
schema: z10.boolean()
|
|
1071
1270
|
})
|
|
1072
1271
|
});
|
|
1073
1272
|
|
|
@@ -1109,42 +1308,42 @@ var LlmCapabilities = {
|
|
|
1109
1308
|
var LLM_CAPABILITIES = Object.values(LlmCapabilities);
|
|
1110
1309
|
|
|
1111
1310
|
// ../contracts/src/settings.ts
|
|
1112
|
-
import { z as
|
|
1113
|
-
var providerSummaryEntryDtoSchema =
|
|
1114
|
-
name:
|
|
1115
|
-
displayName:
|
|
1116
|
-
keyUrl:
|
|
1117
|
-
modelHint:
|
|
1118
|
-
model:
|
|
1311
|
+
import { z as z11 } from "zod";
|
|
1312
|
+
var providerSummaryEntryDtoSchema = z11.object({
|
|
1313
|
+
name: z11.string(),
|
|
1314
|
+
displayName: z11.string().optional(),
|
|
1315
|
+
keyUrl: z11.string().optional(),
|
|
1316
|
+
modelHint: z11.string().optional(),
|
|
1317
|
+
model: z11.string().optional(),
|
|
1119
1318
|
/**
|
|
1120
1319
|
* The adapter's built-in default model. Surfaced so the UI and CLI can show
|
|
1121
1320
|
* the effective model even when no explicit `model` override is configured.
|
|
1122
1321
|
*/
|
|
1123
|
-
defaultModel:
|
|
1124
|
-
configured:
|
|
1322
|
+
defaultModel: z11.string().optional(),
|
|
1323
|
+
configured: z11.boolean(),
|
|
1125
1324
|
quota: providerQuotaPolicySchema.optional(),
|
|
1126
1325
|
/** Whether Vertex AI is configured for this provider (Gemini only). */
|
|
1127
|
-
vertexConfigured:
|
|
1326
|
+
vertexConfigured: z11.boolean().optional()
|
|
1128
1327
|
});
|
|
1129
|
-
var integrationSettingsSummaryDtoSchema =
|
|
1130
|
-
configured:
|
|
1328
|
+
var integrationSettingsSummaryDtoSchema = z11.object({
|
|
1329
|
+
configured: z11.boolean()
|
|
1131
1330
|
});
|
|
1132
|
-
var settingsDtoSchema =
|
|
1133
|
-
providers:
|
|
1331
|
+
var settingsDtoSchema = z11.object({
|
|
1332
|
+
providers: z11.array(providerSummaryEntryDtoSchema).default([]),
|
|
1134
1333
|
google: integrationSettingsSummaryDtoSchema,
|
|
1135
1334
|
bing: integrationSettingsSummaryDtoSchema
|
|
1136
1335
|
});
|
|
1137
1336
|
|
|
1138
1337
|
// ../contracts/src/snapshot.ts
|
|
1139
|
-
import { z as
|
|
1140
|
-
var snapshotAccuracySchema =
|
|
1141
|
-
var snapshotQueryListSchema =
|
|
1142
|
-
var snapshotRequestSchema =
|
|
1143
|
-
companyName:
|
|
1144
|
-
domain:
|
|
1338
|
+
import { z as z12 } from "zod";
|
|
1339
|
+
var snapshotAccuracySchema = z12.enum(["yes", "no", "unknown", "not-mentioned"]);
|
|
1340
|
+
var snapshotQueryListSchema = z12.array(z12.string().min(1));
|
|
1341
|
+
var snapshotRequestSchema = z12.object({
|
|
1342
|
+
companyName: z12.string().min(1),
|
|
1343
|
+
domain: z12.string().min(1),
|
|
1145
1344
|
queries: snapshotQueryListSchema.optional(),
|
|
1146
1345
|
phrases: snapshotQueryListSchema.optional(),
|
|
1147
|
-
competitors:
|
|
1346
|
+
competitors: z12.array(z12.string().min(1)).optional().default([])
|
|
1148
1347
|
}).superRefine((input, ctx) => {
|
|
1149
1348
|
if (input.queries !== void 0 && input.phrases !== void 0) {
|
|
1150
1349
|
ctx.addIssue({
|
|
@@ -1157,121 +1356,121 @@ var snapshotRequestSchema = z11.object({
|
|
|
1157
1356
|
function resolveSnapshotRequestQueries(input) {
|
|
1158
1357
|
return input.queries ?? input.phrases ?? [];
|
|
1159
1358
|
}
|
|
1160
|
-
var snapshotCompetitorEntrySchema =
|
|
1161
|
-
name:
|
|
1162
|
-
count:
|
|
1359
|
+
var snapshotCompetitorEntrySchema = z12.object({
|
|
1360
|
+
name: z12.string(),
|
|
1361
|
+
count: z12.number().int().nonnegative()
|
|
1163
1362
|
});
|
|
1164
|
-
var snapshotAuditFactorSchema =
|
|
1165
|
-
id:
|
|
1166
|
-
name:
|
|
1167
|
-
weight:
|
|
1168
|
-
score:
|
|
1169
|
-
grade:
|
|
1170
|
-
status:
|
|
1171
|
-
findings:
|
|
1172
|
-
type:
|
|
1173
|
-
message:
|
|
1363
|
+
var snapshotAuditFactorSchema = z12.object({
|
|
1364
|
+
id: z12.string(),
|
|
1365
|
+
name: z12.string(),
|
|
1366
|
+
weight: z12.number(),
|
|
1367
|
+
score: z12.number(),
|
|
1368
|
+
grade: z12.string(),
|
|
1369
|
+
status: z12.enum(["pass", "partial", "fail"]),
|
|
1370
|
+
findings: z12.array(z12.object({
|
|
1371
|
+
type: z12.string(),
|
|
1372
|
+
message: z12.string()
|
|
1174
1373
|
})).default([]),
|
|
1175
|
-
recommendations:
|
|
1176
|
-
});
|
|
1177
|
-
var snapshotAuditSchema =
|
|
1178
|
-
url:
|
|
1179
|
-
finalUrl:
|
|
1180
|
-
auditedAt:
|
|
1181
|
-
overallScore:
|
|
1182
|
-
overallGrade:
|
|
1183
|
-
summary:
|
|
1184
|
-
factors:
|
|
1185
|
-
});
|
|
1186
|
-
var snapshotProfileSchema =
|
|
1187
|
-
industry:
|
|
1188
|
-
summary:
|
|
1189
|
-
services:
|
|
1190
|
-
categoryTerms:
|
|
1191
|
-
});
|
|
1192
|
-
var snapshotProviderResultSchema =
|
|
1193
|
-
provider:
|
|
1194
|
-
displayName:
|
|
1195
|
-
model:
|
|
1196
|
-
mentioned:
|
|
1197
|
-
cited:
|
|
1374
|
+
recommendations: z12.array(z12.string()).default([])
|
|
1375
|
+
});
|
|
1376
|
+
var snapshotAuditSchema = z12.object({
|
|
1377
|
+
url: z12.string(),
|
|
1378
|
+
finalUrl: z12.string(),
|
|
1379
|
+
auditedAt: z12.string(),
|
|
1380
|
+
overallScore: z12.number(),
|
|
1381
|
+
overallGrade: z12.string(),
|
|
1382
|
+
summary: z12.string(),
|
|
1383
|
+
factors: z12.array(snapshotAuditFactorSchema).default([])
|
|
1384
|
+
});
|
|
1385
|
+
var snapshotProfileSchema = z12.object({
|
|
1386
|
+
industry: z12.string(),
|
|
1387
|
+
summary: z12.string(),
|
|
1388
|
+
services: z12.array(z12.string()).default([]),
|
|
1389
|
+
categoryTerms: z12.array(z12.string()).default([])
|
|
1390
|
+
});
|
|
1391
|
+
var snapshotProviderResultSchema = z12.object({
|
|
1392
|
+
provider: z12.string(),
|
|
1393
|
+
displayName: z12.string(),
|
|
1394
|
+
model: z12.string().nullable().optional(),
|
|
1395
|
+
mentioned: z12.boolean(),
|
|
1396
|
+
cited: z12.boolean(),
|
|
1198
1397
|
describedAccurately: snapshotAccuracySchema,
|
|
1199
|
-
accuracyNotes:
|
|
1200
|
-
incorrectClaims:
|
|
1201
|
-
recommendedCompetitors:
|
|
1202
|
-
citedDomains:
|
|
1203
|
-
groundingSources:
|
|
1204
|
-
searchQueries:
|
|
1205
|
-
answerText:
|
|
1206
|
-
error:
|
|
1207
|
-
});
|
|
1208
|
-
var snapshotQueryResultSchema =
|
|
1209
|
-
query:
|
|
1210
|
-
providerResults:
|
|
1211
|
-
});
|
|
1212
|
-
var snapshotSummarySchema =
|
|
1213
|
-
totalQueries:
|
|
1214
|
-
totalProviders:
|
|
1215
|
-
totalComparisons:
|
|
1216
|
-
mentionCount:
|
|
1217
|
-
citationCount:
|
|
1218
|
-
topCompetitors:
|
|
1219
|
-
visibilityGap:
|
|
1220
|
-
whatThisMeans:
|
|
1221
|
-
recommendedActions:
|
|
1222
|
-
});
|
|
1223
|
-
var snapshotReportSchema =
|
|
1224
|
-
companyName:
|
|
1225
|
-
domain:
|
|
1226
|
-
homepageUrl:
|
|
1227
|
-
generatedAt:
|
|
1228
|
-
queries:
|
|
1229
|
-
competitors:
|
|
1398
|
+
accuracyNotes: z12.string().nullable().optional(),
|
|
1399
|
+
incorrectClaims: z12.array(z12.string()).default([]),
|
|
1400
|
+
recommendedCompetitors: z12.array(z12.string()).default([]),
|
|
1401
|
+
citedDomains: z12.array(z12.string()).default([]),
|
|
1402
|
+
groundingSources: z12.array(groundingSourceSchema).default([]),
|
|
1403
|
+
searchQueries: z12.array(z12.string()).default([]),
|
|
1404
|
+
answerText: z12.string(),
|
|
1405
|
+
error: z12.string().nullable().optional()
|
|
1406
|
+
});
|
|
1407
|
+
var snapshotQueryResultSchema = z12.object({
|
|
1408
|
+
query: z12.string(),
|
|
1409
|
+
providerResults: z12.array(snapshotProviderResultSchema).default([])
|
|
1410
|
+
});
|
|
1411
|
+
var snapshotSummarySchema = z12.object({
|
|
1412
|
+
totalQueries: z12.number().int().nonnegative(),
|
|
1413
|
+
totalProviders: z12.number().int().nonnegative(),
|
|
1414
|
+
totalComparisons: z12.number().int().nonnegative(),
|
|
1415
|
+
mentionCount: z12.number().int().nonnegative(),
|
|
1416
|
+
citationCount: z12.number().int().nonnegative(),
|
|
1417
|
+
topCompetitors: z12.array(snapshotCompetitorEntrySchema).default([]),
|
|
1418
|
+
visibilityGap: z12.string(),
|
|
1419
|
+
whatThisMeans: z12.array(z12.string()).default([]),
|
|
1420
|
+
recommendedActions: z12.array(z12.string()).default([])
|
|
1421
|
+
});
|
|
1422
|
+
var snapshotReportSchema = z12.object({
|
|
1423
|
+
companyName: z12.string(),
|
|
1424
|
+
domain: z12.string(),
|
|
1425
|
+
homepageUrl: z12.string(),
|
|
1426
|
+
generatedAt: z12.string(),
|
|
1427
|
+
queries: z12.array(z12.string()).default([]),
|
|
1428
|
+
competitors: z12.array(z12.string()).default([]),
|
|
1230
1429
|
profile: snapshotProfileSchema,
|
|
1231
1430
|
audit: snapshotAuditSchema,
|
|
1232
|
-
queryResults:
|
|
1431
|
+
queryResults: z12.array(snapshotQueryResultSchema).default([]),
|
|
1233
1432
|
summary: snapshotSummarySchema
|
|
1234
1433
|
});
|
|
1235
1434
|
|
|
1236
1435
|
// ../contracts/src/schedule.ts
|
|
1237
|
-
import { z as
|
|
1238
|
-
var schedulableRunKindSchema =
|
|
1436
|
+
import { z as z13 } from "zod";
|
|
1437
|
+
var schedulableRunKindSchema = z13.enum(["answer-visibility", "traffic-sync"]);
|
|
1239
1438
|
var SchedulableRunKinds = schedulableRunKindSchema.enum;
|
|
1240
|
-
var scheduleDtoSchema =
|
|
1241
|
-
id:
|
|
1242
|
-
projectId:
|
|
1439
|
+
var scheduleDtoSchema = z13.object({
|
|
1440
|
+
id: z13.string(),
|
|
1441
|
+
projectId: z13.string(),
|
|
1243
1442
|
/** Run kind dispatched when this schedule fires. Defaults to 'answer-visibility' for legacy rows. */
|
|
1244
1443
|
kind: schedulableRunKindSchema,
|
|
1245
|
-
cronExpr:
|
|
1246
|
-
preset:
|
|
1247
|
-
timezone:
|
|
1248
|
-
enabled:
|
|
1249
|
-
providers:
|
|
1444
|
+
cronExpr: z13.string(),
|
|
1445
|
+
preset: z13.string().nullable().optional(),
|
|
1446
|
+
timezone: z13.string().default("UTC"),
|
|
1447
|
+
enabled: z13.boolean().default(true),
|
|
1448
|
+
providers: z13.array(providerNameSchema).default([]),
|
|
1250
1449
|
/** Traffic-source UUID for `kind === 'traffic-sync'` schedules. Null otherwise. */
|
|
1251
|
-
sourceId:
|
|
1252
|
-
lastRunAt:
|
|
1253
|
-
nextRunAt:
|
|
1254
|
-
createdAt:
|
|
1255
|
-
updatedAt:
|
|
1450
|
+
sourceId: z13.string().nullable().optional(),
|
|
1451
|
+
lastRunAt: z13.string().nullable().optional(),
|
|
1452
|
+
nextRunAt: z13.string().nullable().optional(),
|
|
1453
|
+
createdAt: z13.string(),
|
|
1454
|
+
updatedAt: z13.string()
|
|
1256
1455
|
});
|
|
1257
|
-
var scheduleUpsertRequestSchema =
|
|
1456
|
+
var scheduleUpsertRequestSchema = z13.object({
|
|
1258
1457
|
/** Run kind. Defaults to 'answer-visibility' so existing callers don't have to change. */
|
|
1259
1458
|
kind: schedulableRunKindSchema.optional(),
|
|
1260
|
-
preset:
|
|
1261
|
-
cron:
|
|
1262
|
-
timezone:
|
|
1263
|
-
enabled:
|
|
1264
|
-
providers:
|
|
1459
|
+
preset: z13.string().optional(),
|
|
1460
|
+
cron: z13.string().optional(),
|
|
1461
|
+
timezone: z13.string().optional().default("UTC"),
|
|
1462
|
+
enabled: z13.boolean().optional().default(true),
|
|
1463
|
+
providers: z13.array(providerNameSchema).optional().default([]),
|
|
1265
1464
|
/** Required when kind === 'traffic-sync'. Forbidden for other kinds. Validated server-side. */
|
|
1266
|
-
sourceId:
|
|
1465
|
+
sourceId: z13.string().optional()
|
|
1267
1466
|
}).refine(
|
|
1268
1467
|
(data) => data.preset && !data.cron || !data.preset && data.cron,
|
|
1269
1468
|
{ message: 'Exactly one of "preset" or "cron" must be provided' }
|
|
1270
1469
|
);
|
|
1271
1470
|
|
|
1272
1471
|
// ../contracts/src/analytics.ts
|
|
1273
|
-
import { z as
|
|
1274
|
-
var visibilityMetricModeSchema =
|
|
1472
|
+
import { z as z14 } from "zod";
|
|
1473
|
+
var visibilityMetricModeSchema = z14.enum(["mentioned", "cited"]);
|
|
1275
1474
|
var VisibilityMetricModes = visibilityMetricModeSchema.enum;
|
|
1276
1475
|
function parseWindow(value) {
|
|
1277
1476
|
if (value === "7d" || value === "30d" || value === "90d" || value === "all") return value;
|
|
@@ -1410,29 +1609,29 @@ function categoryLabel(category) {
|
|
|
1410
1609
|
}
|
|
1411
1610
|
|
|
1412
1611
|
// ../contracts/src/ga.ts
|
|
1413
|
-
import { z as
|
|
1414
|
-
var ga4ConnectionDtoSchema =
|
|
1415
|
-
id:
|
|
1416
|
-
projectId:
|
|
1417
|
-
propertyId:
|
|
1418
|
-
clientEmail:
|
|
1419
|
-
connected:
|
|
1420
|
-
createdAt:
|
|
1421
|
-
updatedAt:
|
|
1422
|
-
});
|
|
1423
|
-
var ga4TrafficSnapshotDtoSchema =
|
|
1424
|
-
date:
|
|
1425
|
-
landingPage:
|
|
1426
|
-
sessions:
|
|
1427
|
-
organicSessions:
|
|
1428
|
-
users:
|
|
1429
|
-
});
|
|
1430
|
-
var ga4SourceDimensionSchema =
|
|
1431
|
-
var ga4AiReferralDtoSchema =
|
|
1432
|
-
source:
|
|
1433
|
-
medium:
|
|
1434
|
-
sessions:
|
|
1435
|
-
users:
|
|
1612
|
+
import { z as z15 } from "zod";
|
|
1613
|
+
var ga4ConnectionDtoSchema = z15.object({
|
|
1614
|
+
id: z15.string(),
|
|
1615
|
+
projectId: z15.string(),
|
|
1616
|
+
propertyId: z15.string(),
|
|
1617
|
+
clientEmail: z15.string(),
|
|
1618
|
+
connected: z15.boolean(),
|
|
1619
|
+
createdAt: z15.string(),
|
|
1620
|
+
updatedAt: z15.string()
|
|
1621
|
+
});
|
|
1622
|
+
var ga4TrafficSnapshotDtoSchema = z15.object({
|
|
1623
|
+
date: z15.string(),
|
|
1624
|
+
landingPage: z15.string(),
|
|
1625
|
+
sessions: z15.number(),
|
|
1626
|
+
organicSessions: z15.number(),
|
|
1627
|
+
users: z15.number()
|
|
1628
|
+
});
|
|
1629
|
+
var ga4SourceDimensionSchema = z15.enum(["session", "first_user", "manual_utm"]);
|
|
1630
|
+
var ga4AiReferralDtoSchema = z15.object({
|
|
1631
|
+
source: z15.string(),
|
|
1632
|
+
medium: z15.string(),
|
|
1633
|
+
sessions: z15.number(),
|
|
1634
|
+
users: z15.number(),
|
|
1436
1635
|
/**
|
|
1437
1636
|
* The winning attribution dimension for this (source, medium) tuple — the
|
|
1438
1637
|
* one with the highest session count. GA4 emits one row per dimension
|
|
@@ -1442,144 +1641,144 @@ var ga4AiReferralDtoSchema = z14.object({
|
|
|
1442
1641
|
*/
|
|
1443
1642
|
sourceDimension: ga4SourceDimensionSchema
|
|
1444
1643
|
});
|
|
1445
|
-
var ga4AiReferralLandingPageDtoSchema =
|
|
1446
|
-
source:
|
|
1447
|
-
medium:
|
|
1644
|
+
var ga4AiReferralLandingPageDtoSchema = z15.object({
|
|
1645
|
+
source: z15.string(),
|
|
1646
|
+
medium: z15.string(),
|
|
1448
1647
|
/**
|
|
1449
1648
|
* The winning attribution dimension for this (source, medium, landingPage)
|
|
1450
1649
|
* tuple — the one with the highest session count.
|
|
1451
1650
|
*/
|
|
1452
1651
|
sourceDimension: ga4SourceDimensionSchema,
|
|
1453
|
-
landingPage:
|
|
1454
|
-
sessions:
|
|
1455
|
-
users:
|
|
1456
|
-
});
|
|
1457
|
-
var ga4SocialReferralDtoSchema =
|
|
1458
|
-
source:
|
|
1459
|
-
medium:
|
|
1460
|
-
sessions:
|
|
1461
|
-
users:
|
|
1652
|
+
landingPage: z15.string(),
|
|
1653
|
+
sessions: z15.number(),
|
|
1654
|
+
users: z15.number()
|
|
1655
|
+
});
|
|
1656
|
+
var ga4SocialReferralDtoSchema = z15.object({
|
|
1657
|
+
source: z15.string(),
|
|
1658
|
+
medium: z15.string(),
|
|
1659
|
+
sessions: z15.number(),
|
|
1660
|
+
users: z15.number(),
|
|
1462
1661
|
/** GA4 default channel group (e.g. 'Organic Social', 'Paid Social') */
|
|
1463
|
-
channelGroup:
|
|
1662
|
+
channelGroup: z15.string()
|
|
1464
1663
|
});
|
|
1465
|
-
var ga4ChannelBucketDtoSchema =
|
|
1466
|
-
sessions:
|
|
1467
|
-
sharePct:
|
|
1468
|
-
sharePctDisplay:
|
|
1664
|
+
var ga4ChannelBucketDtoSchema = z15.object({
|
|
1665
|
+
sessions: z15.number(),
|
|
1666
|
+
sharePct: z15.number(),
|
|
1667
|
+
sharePctDisplay: z15.string()
|
|
1469
1668
|
});
|
|
1470
|
-
var ga4ChannelBreakdownDtoSchema =
|
|
1669
|
+
var ga4ChannelBreakdownDtoSchema = z15.object({
|
|
1471
1670
|
organic: ga4ChannelBucketDtoSchema,
|
|
1472
1671
|
social: ga4ChannelBucketDtoSchema,
|
|
1473
1672
|
direct: ga4ChannelBucketDtoSchema,
|
|
1474
1673
|
ai: ga4ChannelBucketDtoSchema,
|
|
1475
1674
|
other: ga4ChannelBucketDtoSchema
|
|
1476
1675
|
});
|
|
1477
|
-
var ga4TrafficSummaryDtoSchema =
|
|
1478
|
-
totalSessions:
|
|
1479
|
-
totalOrganicSessions:
|
|
1676
|
+
var ga4TrafficSummaryDtoSchema = z15.object({
|
|
1677
|
+
totalSessions: z15.number(),
|
|
1678
|
+
totalOrganicSessions: z15.number(),
|
|
1480
1679
|
/** Direct-channel sessions (sessions with no source — bookmarks, typed URLs, AI-driven traffic with stripped referrer). 0 for legacy rows from before the column was added. */
|
|
1481
|
-
totalDirectSessions:
|
|
1482
|
-
totalUsers:
|
|
1483
|
-
topPages:
|
|
1484
|
-
landingPage:
|
|
1485
|
-
sessions:
|
|
1486
|
-
organicSessions:
|
|
1680
|
+
totalDirectSessions: z15.number(),
|
|
1681
|
+
totalUsers: z15.number(),
|
|
1682
|
+
topPages: z15.array(z15.object({
|
|
1683
|
+
landingPage: z15.string(),
|
|
1684
|
+
sessions: z15.number(),
|
|
1685
|
+
organicSessions: z15.number(),
|
|
1487
1686
|
/** Per-page Direct-channel sessions. 0 for legacy rows. */
|
|
1488
|
-
directSessions:
|
|
1489
|
-
users:
|
|
1687
|
+
directSessions: z15.number(),
|
|
1688
|
+
users: z15.number()
|
|
1490
1689
|
})),
|
|
1491
|
-
aiReferrals:
|
|
1492
|
-
aiReferralLandingPages:
|
|
1690
|
+
aiReferrals: z15.array(ga4AiReferralDtoSchema),
|
|
1691
|
+
aiReferralLandingPages: z15.array(ga4AiReferralLandingPageDtoSchema),
|
|
1493
1692
|
/** Deduped AI session total: MAX(sessions) per date+source+medium across attribution dimensions, then summed. Cross-cutting: can overlap with Direct/Organic/Social via firstUserSource. */
|
|
1494
|
-
aiSessionsDeduped:
|
|
1693
|
+
aiSessionsDeduped: z15.number(),
|
|
1495
1694
|
/** Deduped AI user total: MAX(users) per date+source+medium across attribution dimensions, then summed. */
|
|
1496
|
-
aiUsersDeduped:
|
|
1695
|
+
aiUsersDeduped: z15.number(),
|
|
1497
1696
|
/** AI sessions whose CURRENT sessionSource matched an AI engine. Can overlap with raw Organic/Social/Direct totals; `channelBreakdown` removes those overlaps for display. */
|
|
1498
|
-
aiSessionsBySession:
|
|
1697
|
+
aiSessionsBySession: z15.number(),
|
|
1499
1698
|
/** AI users whose CURRENT sessionSource matched an AI engine. Can overlap with raw Organic/Social/Direct totals. */
|
|
1500
|
-
aiUsersBySession:
|
|
1501
|
-
socialReferrals:
|
|
1699
|
+
aiUsersBySession: z15.number(),
|
|
1700
|
+
socialReferrals: z15.array(ga4SocialReferralDtoSchema),
|
|
1502
1701
|
/** Total social sessions (session-scoped, no cross-dimension dedup needed). */
|
|
1503
|
-
socialSessions:
|
|
1702
|
+
socialSessions: z15.number(),
|
|
1504
1703
|
/** Total social users (session-scoped, no cross-dimension dedup needed). */
|
|
1505
|
-
socialUsers:
|
|
1704
|
+
socialUsers: z15.number(),
|
|
1506
1705
|
/** Five disjoint buckets used for the channel breakdown. Known AI session-source matches are removed from their native GA4 bucket before shares are computed. */
|
|
1507
1706
|
channelBreakdown: ga4ChannelBreakdownDtoSchema,
|
|
1508
1707
|
/** Organic sessions as a percentage of total sessions (0–100, rounded). */
|
|
1509
|
-
organicSharePct:
|
|
1708
|
+
organicSharePct: z15.number(),
|
|
1510
1709
|
/** Deduped AI sessions as a percentage of total sessions (0–100, rounded). Cross-cutting: can overlap with Direct/Organic/Social. */
|
|
1511
|
-
aiSharePct:
|
|
1710
|
+
aiSharePct: z15.number(),
|
|
1512
1711
|
/** Session-source-only AI sessions as a percentage of total sessions (0–100, rounded). Can overlap with raw Organic/Social/Direct totals. */
|
|
1513
|
-
aiSharePctBySession:
|
|
1712
|
+
aiSharePctBySession: z15.number(),
|
|
1514
1713
|
/** Direct-channel sessions as a percentage of total sessions (0–100, rounded). */
|
|
1515
|
-
directSharePct:
|
|
1714
|
+
directSharePct: z15.number(),
|
|
1516
1715
|
/** Social sessions as a percentage of total sessions (0–100, rounded). */
|
|
1517
|
-
socialSharePct:
|
|
1716
|
+
socialSharePct: z15.number(),
|
|
1518
1717
|
/** Display string for organicSharePct: 'X%', '<1%' for non-zero shares that round below 1, or '—' when sessions exist but total is unknown (partial sync). */
|
|
1519
|
-
organicSharePctDisplay:
|
|
1718
|
+
organicSharePctDisplay: z15.string(),
|
|
1520
1719
|
/** Display string for aiSharePct: 'X%', '<1%' for non-zero shares that round below 1, or '—' when sessions exist but total is unknown (partial sync). */
|
|
1521
|
-
aiSharePctDisplay:
|
|
1720
|
+
aiSharePctDisplay: z15.string(),
|
|
1522
1721
|
/** Display string for aiSharePctBySession: 'X%', '<1%' for non-zero shares that round below 1, or '—' when sessions exist but total is unknown (partial sync). */
|
|
1523
|
-
aiSharePctBySessionDisplay:
|
|
1722
|
+
aiSharePctBySessionDisplay: z15.string(),
|
|
1524
1723
|
/** Display string for directSharePct: 'X%', '<1%' for non-zero shares that round below 1, or '—' when sessions exist but total is unknown (partial sync). */
|
|
1525
|
-
directSharePctDisplay:
|
|
1724
|
+
directSharePctDisplay: z15.string(),
|
|
1526
1725
|
/** Display string for socialSharePct: 'X%', '<1%' for non-zero shares that round below 1, or '—' when sessions exist but total is unknown (partial sync). */
|
|
1527
|
-
socialSharePctDisplay:
|
|
1726
|
+
socialSharePctDisplay: z15.string(),
|
|
1528
1727
|
/** Sessions not covered by Organic, Social, Direct, or AI (session) channels — e.g. Referral, Email, Paid Search, Display. Always non-negative; clamped to 0 when the four disjoint channels sum above total (rounding edge). */
|
|
1529
|
-
otherSessions:
|
|
1728
|
+
otherSessions: z15.number(),
|
|
1530
1729
|
/** Other sessions as a percentage of total sessions (0–100, rounded). */
|
|
1531
|
-
otherSharePct:
|
|
1730
|
+
otherSharePct: z15.number(),
|
|
1532
1731
|
/** Display string for otherSharePct: 'X%', '<1%' for non-zero shares that round below 1, or '—' when sessions exist but total is unknown (partial sync). */
|
|
1533
|
-
otherSharePctDisplay:
|
|
1534
|
-
lastSyncedAt:
|
|
1535
|
-
});
|
|
1536
|
-
var ga4StatusDtoSchema =
|
|
1537
|
-
connected:
|
|
1538
|
-
propertyId:
|
|
1539
|
-
clientEmail:
|
|
1540
|
-
authMethod:
|
|
1541
|
-
lastSyncedAt:
|
|
1542
|
-
createdAt:
|
|
1543
|
-
updatedAt:
|
|
1544
|
-
});
|
|
1545
|
-
var ga4SyncResponseDtoSchema =
|
|
1546
|
-
synced:
|
|
1547
|
-
rowCount:
|
|
1548
|
-
aiReferralCount:
|
|
1549
|
-
socialReferralCount:
|
|
1550
|
-
days:
|
|
1551
|
-
syncedAt:
|
|
1732
|
+
otherSharePctDisplay: z15.string(),
|
|
1733
|
+
lastSyncedAt: z15.string().nullable()
|
|
1734
|
+
});
|
|
1735
|
+
var ga4StatusDtoSchema = z15.object({
|
|
1736
|
+
connected: z15.boolean(),
|
|
1737
|
+
propertyId: z15.string().nullable(),
|
|
1738
|
+
clientEmail: z15.string().nullable(),
|
|
1739
|
+
authMethod: z15.enum(["service-account", "oauth"]).nullable(),
|
|
1740
|
+
lastSyncedAt: z15.string().nullable(),
|
|
1741
|
+
createdAt: z15.string().nullable().optional(),
|
|
1742
|
+
updatedAt: z15.string().nullable().optional()
|
|
1743
|
+
});
|
|
1744
|
+
var ga4SyncResponseDtoSchema = z15.object({
|
|
1745
|
+
synced: z15.boolean(),
|
|
1746
|
+
rowCount: z15.number().int().nonnegative(),
|
|
1747
|
+
aiReferralCount: z15.number().int().nonnegative(),
|
|
1748
|
+
socialReferralCount: z15.number().int().nonnegative(),
|
|
1749
|
+
days: z15.number().int().nonnegative(),
|
|
1750
|
+
syncedAt: z15.string(),
|
|
1552
1751
|
/**
|
|
1553
1752
|
* Components that were written this run. Present when `only` is set.
|
|
1554
1753
|
* Always includes `traffic` and `summary` (the share denominator) plus
|
|
1555
1754
|
* the requested channel breakdown — `ai` and/or `social`.
|
|
1556
1755
|
*/
|
|
1557
|
-
syncedComponents:
|
|
1558
|
-
});
|
|
1559
|
-
var ga4AiReferralHistoryEntrySchema =
|
|
1560
|
-
date:
|
|
1561
|
-
source:
|
|
1562
|
-
medium:
|
|
1563
|
-
landingPage:
|
|
1564
|
-
sessions:
|
|
1565
|
-
users:
|
|
1756
|
+
syncedComponents: z15.array(z15.string()).optional()
|
|
1757
|
+
});
|
|
1758
|
+
var ga4AiReferralHistoryEntrySchema = z15.object({
|
|
1759
|
+
date: z15.string(),
|
|
1760
|
+
source: z15.string(),
|
|
1761
|
+
medium: z15.string(),
|
|
1762
|
+
landingPage: z15.string(),
|
|
1763
|
+
sessions: z15.number(),
|
|
1764
|
+
users: z15.number(),
|
|
1566
1765
|
/** Which GA4 dimension this row came from: session (sessionSource), first_user (firstUserSource), or manual_utm (utm_source parameter) */
|
|
1567
1766
|
sourceDimension: ga4SourceDimensionSchema
|
|
1568
1767
|
});
|
|
1569
|
-
var ga4SocialReferralHistoryEntrySchema =
|
|
1570
|
-
date:
|
|
1571
|
-
source:
|
|
1572
|
-
medium:
|
|
1573
|
-
sessions:
|
|
1574
|
-
users:
|
|
1768
|
+
var ga4SocialReferralHistoryEntrySchema = z15.object({
|
|
1769
|
+
date: z15.string(),
|
|
1770
|
+
source: z15.string(),
|
|
1771
|
+
medium: z15.string(),
|
|
1772
|
+
sessions: z15.number(),
|
|
1773
|
+
users: z15.number(),
|
|
1575
1774
|
/** GA4 default channel group (e.g. 'Organic Social', 'Paid Social') */
|
|
1576
|
-
channelGroup:
|
|
1775
|
+
channelGroup: z15.string()
|
|
1577
1776
|
});
|
|
1578
|
-
var ga4SessionHistoryEntrySchema =
|
|
1579
|
-
date:
|
|
1580
|
-
sessions:
|
|
1581
|
-
organicSessions:
|
|
1582
|
-
users:
|
|
1777
|
+
var ga4SessionHistoryEntrySchema = z15.object({
|
|
1778
|
+
date: z15.string(),
|
|
1779
|
+
sessions: z15.number(),
|
|
1780
|
+
organicSessions: z15.number(),
|
|
1781
|
+
users: z15.number()
|
|
1583
1782
|
});
|
|
1584
1783
|
|
|
1585
1784
|
// ../contracts/src/answer-visibility.ts
|
|
@@ -1747,149 +1946,149 @@ function escapeRegExp(value) {
|
|
|
1747
1946
|
}
|
|
1748
1947
|
|
|
1749
1948
|
// ../contracts/src/agent.ts
|
|
1750
|
-
import { z as
|
|
1751
|
-
var agentProviderIdSchema =
|
|
1752
|
-
var agentProviderOptionDtoSchema =
|
|
1949
|
+
import { z as z16 } from "zod";
|
|
1950
|
+
var agentProviderIdSchema = z16.enum(["claude", "openai", "gemini", "zai"]);
|
|
1951
|
+
var agentProviderOptionDtoSchema = z16.object({
|
|
1753
1952
|
/** Stable identifier — what clients pass back as `provider` on the prompt endpoint. */
|
|
1754
1953
|
id: agentProviderIdSchema,
|
|
1755
1954
|
/** Human-readable label for UI pickers, e.g. "Anthropic (Claude)". */
|
|
1756
|
-
label:
|
|
1955
|
+
label: z16.string(),
|
|
1757
1956
|
/** Default model if the caller doesn't pick one. */
|
|
1758
|
-
defaultModel:
|
|
1957
|
+
defaultModel: z16.string(),
|
|
1759
1958
|
/** Whether a usable API key was found (config.yaml or provider env var). */
|
|
1760
|
-
configured:
|
|
1959
|
+
configured: z16.boolean(),
|
|
1761
1960
|
/**
|
|
1762
1961
|
* Where the key resolved from, if any. `null` when `configured === false`.
|
|
1763
1962
|
* Surfaced so the UI can nudge users toward their preferred source of truth.
|
|
1764
1963
|
*/
|
|
1765
|
-
keySource:
|
|
1964
|
+
keySource: z16.enum(["config", "env"]).nullable()
|
|
1766
1965
|
});
|
|
1767
|
-
var agentProvidersResponseDtoSchema =
|
|
1966
|
+
var agentProvidersResponseDtoSchema = z16.object({
|
|
1768
1967
|
/**
|
|
1769
1968
|
* Every provider Aero knows about. `configured === false` entries are
|
|
1770
1969
|
* included so the UI can render them disabled with an onboarding hint.
|
|
1771
1970
|
*/
|
|
1772
|
-
providers:
|
|
1971
|
+
providers: z16.array(agentProviderOptionDtoSchema).default([]),
|
|
1773
1972
|
/**
|
|
1774
1973
|
* Provider Aero auto-picks when no explicit override is passed. Null if
|
|
1775
1974
|
* nothing is configured (install never exchanged a key).
|
|
1776
1975
|
*/
|
|
1777
1976
|
defaultProvider: agentProviderIdSchema.nullable()
|
|
1778
1977
|
});
|
|
1779
|
-
var memorySourceSchema =
|
|
1978
|
+
var memorySourceSchema = z16.enum(["aero", "user", "compaction"]);
|
|
1780
1979
|
var MemorySources = memorySourceSchema.enum;
|
|
1781
1980
|
var AGENT_MEMORY_VALUE_MAX_BYTES = 2 * 1024;
|
|
1782
1981
|
var AGENT_MEMORY_KEY_MAX_LENGTH = 128;
|
|
1783
|
-
var agentMemoryUpsertRequestSchema =
|
|
1784
|
-
key:
|
|
1785
|
-
value:
|
|
1982
|
+
var agentMemoryUpsertRequestSchema = z16.object({
|
|
1983
|
+
key: z16.string().min(1).max(AGENT_MEMORY_KEY_MAX_LENGTH),
|
|
1984
|
+
value: z16.string().min(1)
|
|
1786
1985
|
});
|
|
1787
|
-
var agentMemoryDeleteRequestSchema =
|
|
1788
|
-
key:
|
|
1986
|
+
var agentMemoryDeleteRequestSchema = z16.object({
|
|
1987
|
+
key: z16.string().min(1).max(AGENT_MEMORY_KEY_MAX_LENGTH)
|
|
1789
1988
|
});
|
|
1790
1989
|
|
|
1791
1990
|
// ../contracts/src/backlinks.ts
|
|
1792
|
-
import { z as
|
|
1793
|
-
var ccReleaseSyncStatusSchema =
|
|
1991
|
+
import { z as z17 } from "zod";
|
|
1992
|
+
var ccReleaseSyncStatusSchema = z17.enum(["queued", "downloading", "querying", "ready", "failed"]);
|
|
1794
1993
|
var CcReleaseSyncStatuses = ccReleaseSyncStatusSchema.enum;
|
|
1795
|
-
var ccReleaseSyncDtoSchema =
|
|
1796
|
-
id:
|
|
1797
|
-
release:
|
|
1994
|
+
var ccReleaseSyncDtoSchema = z17.object({
|
|
1995
|
+
id: z17.string(),
|
|
1996
|
+
release: z17.string(),
|
|
1798
1997
|
status: ccReleaseSyncStatusSchema,
|
|
1799
|
-
phaseDetail:
|
|
1800
|
-
vertexPath:
|
|
1801
|
-
edgesPath:
|
|
1802
|
-
vertexSha256:
|
|
1803
|
-
edgesSha256:
|
|
1804
|
-
vertexBytes:
|
|
1805
|
-
edgesBytes:
|
|
1806
|
-
projectsProcessed:
|
|
1807
|
-
domainsDiscovered:
|
|
1808
|
-
downloadStartedAt:
|
|
1809
|
-
downloadFinishedAt:
|
|
1810
|
-
queryStartedAt:
|
|
1811
|
-
queryFinishedAt:
|
|
1812
|
-
error:
|
|
1813
|
-
createdAt:
|
|
1814
|
-
updatedAt:
|
|
1815
|
-
});
|
|
1816
|
-
var backlinkDomainDtoSchema =
|
|
1817
|
-
linkingDomain:
|
|
1818
|
-
numHosts:
|
|
1819
|
-
});
|
|
1820
|
-
var backlinkSummaryDtoSchema =
|
|
1821
|
-
projectId:
|
|
1822
|
-
release:
|
|
1823
|
-
targetDomain:
|
|
1824
|
-
totalLinkingDomains:
|
|
1825
|
-
totalHosts:
|
|
1826
|
-
top10HostsShare:
|
|
1827
|
-
queriedAt:
|
|
1998
|
+
phaseDetail: z17.string().nullable().optional(),
|
|
1999
|
+
vertexPath: z17.string().nullable().optional(),
|
|
2000
|
+
edgesPath: z17.string().nullable().optional(),
|
|
2001
|
+
vertexSha256: z17.string().nullable().optional(),
|
|
2002
|
+
edgesSha256: z17.string().nullable().optional(),
|
|
2003
|
+
vertexBytes: z17.number().int().nullable().optional(),
|
|
2004
|
+
edgesBytes: z17.number().int().nullable().optional(),
|
|
2005
|
+
projectsProcessed: z17.number().int().nullable().optional(),
|
|
2006
|
+
domainsDiscovered: z17.number().int().nullable().optional(),
|
|
2007
|
+
downloadStartedAt: z17.string().nullable().optional(),
|
|
2008
|
+
downloadFinishedAt: z17.string().nullable().optional(),
|
|
2009
|
+
queryStartedAt: z17.string().nullable().optional(),
|
|
2010
|
+
queryFinishedAt: z17.string().nullable().optional(),
|
|
2011
|
+
error: z17.string().nullable().optional(),
|
|
2012
|
+
createdAt: z17.string(),
|
|
2013
|
+
updatedAt: z17.string()
|
|
2014
|
+
});
|
|
2015
|
+
var backlinkDomainDtoSchema = z17.object({
|
|
2016
|
+
linkingDomain: z17.string(),
|
|
2017
|
+
numHosts: z17.number().int()
|
|
2018
|
+
});
|
|
2019
|
+
var backlinkSummaryDtoSchema = z17.object({
|
|
2020
|
+
projectId: z17.string(),
|
|
2021
|
+
release: z17.string(),
|
|
2022
|
+
targetDomain: z17.string(),
|
|
2023
|
+
totalLinkingDomains: z17.number().int(),
|
|
2024
|
+
totalHosts: z17.number().int(),
|
|
2025
|
+
top10HostsShare: z17.string(),
|
|
2026
|
+
queriedAt: z17.string(),
|
|
1828
2027
|
// Populated when the response is filtered (e.g. ?excludeCrawlers=1).
|
|
1829
2028
|
// Counts the rows omitted from totalLinkingDomains/totalHosts so callers
|
|
1830
2029
|
// can show "N hidden" hints without re-deriving them.
|
|
1831
|
-
excludedLinkingDomains:
|
|
1832
|
-
excludedHosts:
|
|
2030
|
+
excludedLinkingDomains: z17.number().int().optional(),
|
|
2031
|
+
excludedHosts: z17.number().int().optional()
|
|
1833
2032
|
});
|
|
1834
|
-
var backlinkListResponseSchema =
|
|
2033
|
+
var backlinkListResponseSchema = z17.object({
|
|
1835
2034
|
summary: backlinkSummaryDtoSchema.nullable(),
|
|
1836
|
-
total:
|
|
1837
|
-
rows:
|
|
1838
|
-
});
|
|
1839
|
-
var backlinkHistoryEntrySchema =
|
|
1840
|
-
release:
|
|
1841
|
-
totalLinkingDomains:
|
|
1842
|
-
totalHosts:
|
|
1843
|
-
top10HostsShare:
|
|
1844
|
-
queriedAt:
|
|
1845
|
-
});
|
|
1846
|
-
var backlinksInstallStatusDtoSchema =
|
|
1847
|
-
duckdbInstalled:
|
|
1848
|
-
duckdbVersion:
|
|
1849
|
-
duckdbSpec:
|
|
1850
|
-
pluginDir:
|
|
1851
|
-
});
|
|
1852
|
-
var backlinksInstallResultDtoSchema =
|
|
1853
|
-
installed:
|
|
1854
|
-
version:
|
|
1855
|
-
path:
|
|
1856
|
-
alreadyPresent:
|
|
1857
|
-
});
|
|
1858
|
-
var ccAvailableReleaseSchema =
|
|
1859
|
-
release:
|
|
1860
|
-
vertexUrl:
|
|
1861
|
-
edgesUrl:
|
|
1862
|
-
vertexBytes:
|
|
1863
|
-
edgesBytes:
|
|
1864
|
-
lastModified:
|
|
1865
|
-
});
|
|
1866
|
-
var ccCachedReleaseSchema =
|
|
1867
|
-
release:
|
|
2035
|
+
total: z17.number().int(),
|
|
2036
|
+
rows: z17.array(backlinkDomainDtoSchema)
|
|
2037
|
+
});
|
|
2038
|
+
var backlinkHistoryEntrySchema = z17.object({
|
|
2039
|
+
release: z17.string(),
|
|
2040
|
+
totalLinkingDomains: z17.number().int(),
|
|
2041
|
+
totalHosts: z17.number().int(),
|
|
2042
|
+
top10HostsShare: z17.string(),
|
|
2043
|
+
queriedAt: z17.string()
|
|
2044
|
+
});
|
|
2045
|
+
var backlinksInstallStatusDtoSchema = z17.object({
|
|
2046
|
+
duckdbInstalled: z17.boolean(),
|
|
2047
|
+
duckdbVersion: z17.string().nullable().optional(),
|
|
2048
|
+
duckdbSpec: z17.string(),
|
|
2049
|
+
pluginDir: z17.string()
|
|
2050
|
+
});
|
|
2051
|
+
var backlinksInstallResultDtoSchema = z17.object({
|
|
2052
|
+
installed: z17.boolean(),
|
|
2053
|
+
version: z17.string(),
|
|
2054
|
+
path: z17.string(),
|
|
2055
|
+
alreadyPresent: z17.boolean()
|
|
2056
|
+
});
|
|
2057
|
+
var ccAvailableReleaseSchema = z17.object({
|
|
2058
|
+
release: z17.string(),
|
|
2059
|
+
vertexUrl: z17.string(),
|
|
2060
|
+
edgesUrl: z17.string(),
|
|
2061
|
+
vertexBytes: z17.number().int().nullable(),
|
|
2062
|
+
edgesBytes: z17.number().int().nullable(),
|
|
2063
|
+
lastModified: z17.string().nullable()
|
|
2064
|
+
});
|
|
2065
|
+
var ccCachedReleaseSchema = z17.object({
|
|
2066
|
+
release: z17.string(),
|
|
1868
2067
|
syncStatus: ccReleaseSyncStatusSchema.nullable(),
|
|
1869
|
-
bytes:
|
|
1870
|
-
lastUsedAt:
|
|
2068
|
+
bytes: z17.number().int(),
|
|
2069
|
+
lastUsedAt: z17.string().nullable()
|
|
1871
2070
|
});
|
|
1872
2071
|
|
|
1873
2072
|
// ../contracts/src/composites.ts
|
|
1874
|
-
import { z as
|
|
1875
|
-
var searchHitKindSchema =
|
|
1876
|
-
var projectSearchSnapshotHitSchema =
|
|
1877
|
-
kind:
|
|
1878
|
-
id:
|
|
1879
|
-
runId:
|
|
1880
|
-
query:
|
|
1881
|
-
provider:
|
|
1882
|
-
model:
|
|
2073
|
+
import { z as z18 } from "zod";
|
|
2074
|
+
var searchHitKindSchema = z18.enum(["snapshot", "insight"]);
|
|
2075
|
+
var projectSearchSnapshotHitSchema = z18.object({
|
|
2076
|
+
kind: z18.literal("snapshot"),
|
|
2077
|
+
id: z18.string(),
|
|
2078
|
+
runId: z18.string(),
|
|
2079
|
+
query: z18.string(),
|
|
2080
|
+
provider: z18.string(),
|
|
2081
|
+
model: z18.string().nullable(),
|
|
1883
2082
|
citationState: citationStateSchema,
|
|
1884
|
-
matchedField:
|
|
1885
|
-
snippet:
|
|
1886
|
-
createdAt:
|
|
1887
|
-
});
|
|
1888
|
-
var projectSearchInsightHitSchema =
|
|
1889
|
-
kind:
|
|
1890
|
-
id:
|
|
1891
|
-
runId:
|
|
1892
|
-
type:
|
|
2083
|
+
matchedField: z18.enum(["answerText", "citedDomains", "searchQueries", "query"]),
|
|
2084
|
+
snippet: z18.string(),
|
|
2085
|
+
createdAt: z18.string()
|
|
2086
|
+
});
|
|
2087
|
+
var projectSearchInsightHitSchema = z18.object({
|
|
2088
|
+
kind: z18.literal("insight"),
|
|
2089
|
+
id: z18.string(),
|
|
2090
|
+
runId: z18.string().nullable(),
|
|
2091
|
+
type: z18.enum([
|
|
1893
2092
|
"regression",
|
|
1894
2093
|
"gain",
|
|
1895
2094
|
"opportunity",
|
|
@@ -1899,29 +2098,29 @@ var projectSearchInsightHitSchema = z17.object({
|
|
|
1899
2098
|
"competitor-gained",
|
|
1900
2099
|
"competitor-lost"
|
|
1901
2100
|
]),
|
|
1902
|
-
severity:
|
|
1903
|
-
title:
|
|
1904
|
-
query:
|
|
1905
|
-
provider:
|
|
1906
|
-
matchedField:
|
|
1907
|
-
snippet:
|
|
1908
|
-
dismissed:
|
|
1909
|
-
createdAt:
|
|
1910
|
-
});
|
|
1911
|
-
var projectSearchHitSchema =
|
|
2101
|
+
severity: z18.enum(["critical", "high", "medium", "low"]),
|
|
2102
|
+
title: z18.string(),
|
|
2103
|
+
query: z18.string(),
|
|
2104
|
+
provider: z18.string(),
|
|
2105
|
+
matchedField: z18.enum(["title", "query", "recommendation", "cause"]),
|
|
2106
|
+
snippet: z18.string(),
|
|
2107
|
+
dismissed: z18.boolean(),
|
|
2108
|
+
createdAt: z18.string()
|
|
2109
|
+
});
|
|
2110
|
+
var projectSearchHitSchema = z18.discriminatedUnion("kind", [
|
|
1912
2111
|
projectSearchSnapshotHitSchema,
|
|
1913
2112
|
projectSearchInsightHitSchema
|
|
1914
2113
|
]);
|
|
1915
|
-
var projectSearchResponseSchema =
|
|
1916
|
-
query:
|
|
1917
|
-
totalHits:
|
|
1918
|
-
truncated:
|
|
1919
|
-
hits:
|
|
2114
|
+
var projectSearchResponseSchema = z18.object({
|
|
2115
|
+
query: z18.string(),
|
|
2116
|
+
totalHits: z18.number().int().nonnegative(),
|
|
2117
|
+
truncated: z18.boolean(),
|
|
2118
|
+
hits: z18.array(projectSearchHitSchema)
|
|
1920
2119
|
});
|
|
1921
2120
|
|
|
1922
2121
|
// ../contracts/src/content.ts
|
|
1923
|
-
import { z as
|
|
1924
|
-
var contentActionSchema =
|
|
2122
|
+
import { z as z19 } from "zod";
|
|
2123
|
+
var contentActionSchema = z19.enum(["create", "expand", "refresh", "add-schema"]);
|
|
1925
2124
|
var ContentActions = contentActionSchema.enum;
|
|
1926
2125
|
function contentActionLabel(action) {
|
|
1927
2126
|
switch (action) {
|
|
@@ -1935,9 +2134,9 @@ function contentActionLabel(action) {
|
|
|
1935
2134
|
return "Add schema";
|
|
1936
2135
|
}
|
|
1937
2136
|
}
|
|
1938
|
-
var demandSourceSchema =
|
|
2137
|
+
var demandSourceSchema = z19.enum(["gsc", "competitor-evidence", "both"]);
|
|
1939
2138
|
var DemandSources = demandSourceSchema.enum;
|
|
1940
|
-
var actionConfidenceSchema =
|
|
2139
|
+
var actionConfidenceSchema = z19.enum(["high", "medium", "low"]);
|
|
1941
2140
|
var ActionConfidences = actionConfidenceSchema.enum;
|
|
1942
2141
|
function actionConfidenceLabel(confidence) {
|
|
1943
2142
|
switch (confidence) {
|
|
@@ -1949,7 +2148,7 @@ function actionConfidenceLabel(confidence) {
|
|
|
1949
2148
|
return "Low";
|
|
1950
2149
|
}
|
|
1951
2150
|
}
|
|
1952
|
-
var pageTypeSchema =
|
|
2151
|
+
var pageTypeSchema = z19.enum([
|
|
1953
2152
|
"blog-post",
|
|
1954
2153
|
"comparison",
|
|
1955
2154
|
"listicle",
|
|
@@ -1958,7 +2157,7 @@ var pageTypeSchema = z18.enum([
|
|
|
1958
2157
|
"glossary"
|
|
1959
2158
|
]);
|
|
1960
2159
|
var PageTypes = pageTypeSchema.enum;
|
|
1961
|
-
var contentActionStateSchema =
|
|
2160
|
+
var contentActionStateSchema = z19.enum([
|
|
1962
2161
|
"proposed",
|
|
1963
2162
|
"briefed",
|
|
1964
2163
|
"payload-generated",
|
|
@@ -1968,136 +2167,136 @@ var contentActionStateSchema = z18.enum([
|
|
|
1968
2167
|
"dismissed"
|
|
1969
2168
|
]);
|
|
1970
2169
|
var ContentActionStates = contentActionStateSchema.enum;
|
|
1971
|
-
var ourBestPageSchema =
|
|
1972
|
-
url:
|
|
1973
|
-
gscImpressions:
|
|
1974
|
-
gscClicks:
|
|
2170
|
+
var ourBestPageSchema = z19.object({
|
|
2171
|
+
url: z19.string(),
|
|
2172
|
+
gscImpressions: z19.number().nonnegative(),
|
|
2173
|
+
gscClicks: z19.number().nonnegative(),
|
|
1975
2174
|
// Null when the page came from the inventory fallback (no GSC ranking data).
|
|
1976
|
-
gscAvgPosition:
|
|
1977
|
-
organicSessions:
|
|
2175
|
+
gscAvgPosition: z19.number().nonnegative().nullable(),
|
|
2176
|
+
organicSessions: z19.number().nonnegative()
|
|
1978
2177
|
});
|
|
1979
|
-
var winningCompetitorSchema =
|
|
1980
|
-
domain:
|
|
1981
|
-
url:
|
|
1982
|
-
title:
|
|
1983
|
-
citationCount:
|
|
2178
|
+
var winningCompetitorSchema = z19.object({
|
|
2179
|
+
domain: z19.string(),
|
|
2180
|
+
url: z19.string(),
|
|
2181
|
+
title: z19.string(),
|
|
2182
|
+
citationCount: z19.number().int().nonnegative()
|
|
1984
2183
|
});
|
|
1985
|
-
var scoreBreakdownSchema =
|
|
1986
|
-
demand:
|
|
1987
|
-
competitor:
|
|
1988
|
-
absence:
|
|
1989
|
-
gapSeverity:
|
|
2184
|
+
var scoreBreakdownSchema = z19.object({
|
|
2185
|
+
demand: z19.number(),
|
|
2186
|
+
competitor: z19.number(),
|
|
2187
|
+
absence: z19.number(),
|
|
2188
|
+
gapSeverity: z19.number()
|
|
1990
2189
|
});
|
|
1991
|
-
var existingActionRefSchema =
|
|
1992
|
-
actionId:
|
|
2190
|
+
var existingActionRefSchema = z19.object({
|
|
2191
|
+
actionId: z19.string(),
|
|
1993
2192
|
state: contentActionStateSchema,
|
|
1994
|
-
lastUpdated:
|
|
2193
|
+
lastUpdated: z19.string()
|
|
1995
2194
|
});
|
|
1996
|
-
var contentTargetRowDtoSchema =
|
|
1997
|
-
targetRef:
|
|
1998
|
-
query:
|
|
2195
|
+
var contentTargetRowDtoSchema = z19.object({
|
|
2196
|
+
targetRef: z19.string(),
|
|
2197
|
+
query: z19.string(),
|
|
1999
2198
|
action: contentActionSchema,
|
|
2000
2199
|
ourBestPage: ourBestPageSchema.nullable(),
|
|
2001
2200
|
winningCompetitor: winningCompetitorSchema.nullable(),
|
|
2002
|
-
score:
|
|
2201
|
+
score: z19.number(),
|
|
2003
2202
|
scoreBreakdown: scoreBreakdownSchema,
|
|
2004
|
-
drivers:
|
|
2203
|
+
drivers: z19.array(z19.string()),
|
|
2005
2204
|
demandSource: demandSourceSchema,
|
|
2006
2205
|
actionConfidence: actionConfidenceSchema,
|
|
2007
2206
|
existingAction: existingActionRefSchema.nullable()
|
|
2008
2207
|
});
|
|
2009
|
-
var contentTargetsResponseDtoSchema =
|
|
2010
|
-
targets:
|
|
2011
|
-
contextMetrics:
|
|
2012
|
-
totalAiReferralSessions:
|
|
2013
|
-
latestRunId:
|
|
2014
|
-
runTimestamp:
|
|
2208
|
+
var contentTargetsResponseDtoSchema = z19.object({
|
|
2209
|
+
targets: z19.array(contentTargetRowDtoSchema),
|
|
2210
|
+
contextMetrics: z19.object({
|
|
2211
|
+
totalAiReferralSessions: z19.number().int().nonnegative(),
|
|
2212
|
+
latestRunId: z19.string(),
|
|
2213
|
+
runTimestamp: z19.string()
|
|
2015
2214
|
})
|
|
2016
2215
|
});
|
|
2017
|
-
var contentTargetDismissalDtoSchema =
|
|
2018
|
-
targetRef:
|
|
2019
|
-
addressedUrl:
|
|
2020
|
-
note:
|
|
2021
|
-
dismissedAt:
|
|
2216
|
+
var contentTargetDismissalDtoSchema = z19.object({
|
|
2217
|
+
targetRef: z19.string(),
|
|
2218
|
+
addressedUrl: z19.string().nullable(),
|
|
2219
|
+
note: z19.string().nullable(),
|
|
2220
|
+
dismissedAt: z19.string()
|
|
2022
2221
|
});
|
|
2023
|
-
var contentTargetDismissalsResponseDtoSchema =
|
|
2024
|
-
dismissals:
|
|
2222
|
+
var contentTargetDismissalsResponseDtoSchema = z19.object({
|
|
2223
|
+
dismissals: z19.array(contentTargetDismissalDtoSchema)
|
|
2025
2224
|
});
|
|
2026
|
-
var contentTargetDismissRequestSchema =
|
|
2027
|
-
targetRef:
|
|
2225
|
+
var contentTargetDismissRequestSchema = z19.object({
|
|
2226
|
+
targetRef: z19.string().min(1),
|
|
2028
2227
|
/** URL of the page the user wrote that addresses this recommendation. Stored verbatim for the audit trail; not currently used to suppress the slug-token matcher. */
|
|
2029
|
-
addressedUrl:
|
|
2228
|
+
addressedUrl: z19.string().url().optional(),
|
|
2030
2229
|
/** Free-form note (e.g. "covered in our Q1 content sprint"). 500 char cap is the API surface limit; the DB column is unbounded. */
|
|
2031
|
-
note:
|
|
2230
|
+
note: z19.string().max(500).optional()
|
|
2032
2231
|
});
|
|
2033
|
-
var recommendationExplanationDtoSchema =
|
|
2034
|
-
targetRef:
|
|
2232
|
+
var recommendationExplanationDtoSchema = z19.object({
|
|
2233
|
+
targetRef: z19.string(),
|
|
2035
2234
|
/** Version of the prompt template used. Bumping the version invalidates the cache forward without touching the table. */
|
|
2036
|
-
promptVersion:
|
|
2235
|
+
promptVersion: z19.string(),
|
|
2037
2236
|
/** Provider that produced the explanation (e.g. "claude", "gemini"). */
|
|
2038
|
-
provider:
|
|
2237
|
+
provider: z19.string(),
|
|
2039
2238
|
/** Model id within that provider (e.g. "claude-sonnet-4-6"). */
|
|
2040
|
-
model:
|
|
2239
|
+
model: z19.string(),
|
|
2041
2240
|
/** Markdown-formatted rationale + recommended next steps. */
|
|
2042
|
-
responseText:
|
|
2241
|
+
responseText: z19.string(),
|
|
2043
2242
|
/** Estimated cost in millicents (1/100 of a cent). 0 when unknown. */
|
|
2044
|
-
costMillicents:
|
|
2045
|
-
generatedAt:
|
|
2243
|
+
costMillicents: z19.number().int().nonnegative(),
|
|
2244
|
+
generatedAt: z19.string()
|
|
2046
2245
|
});
|
|
2047
|
-
var recommendationExplainRequestSchema =
|
|
2246
|
+
var recommendationExplainRequestSchema = z19.object({
|
|
2048
2247
|
/**
|
|
2049
2248
|
* Optional provider override (e.g. "claude" to force Claude even if
|
|
2050
2249
|
* the project's default is Gemini). Falls through to project default
|
|
2051
2250
|
* → auto-detect when omitted.
|
|
2052
2251
|
*/
|
|
2053
|
-
provider:
|
|
2252
|
+
provider: z19.string().optional(),
|
|
2054
2253
|
/**
|
|
2055
2254
|
* Optional model override within the chosen provider. Falls through to
|
|
2056
2255
|
* the `analyze`-tier default model when omitted.
|
|
2057
2256
|
*/
|
|
2058
|
-
model:
|
|
2257
|
+
model: z19.string().optional(),
|
|
2059
2258
|
/**
|
|
2060
2259
|
* Force a fresh LLM call even if a cached explanation exists for the
|
|
2061
2260
|
* current prompt version. Use sparingly — defeats the cache.
|
|
2062
2261
|
*/
|
|
2063
|
-
forceRefresh:
|
|
2064
|
-
});
|
|
2065
|
-
var contentGroundingSourceSchema = z18.object({
|
|
2066
|
-
uri: z18.string(),
|
|
2067
|
-
title: z18.string(),
|
|
2068
|
-
domain: z18.string(),
|
|
2069
|
-
isOurDomain: z18.boolean(),
|
|
2070
|
-
isCompetitor: z18.boolean(),
|
|
2071
|
-
citationCount: z18.number().int().nonnegative(),
|
|
2072
|
-
providers: z18.array(providerNameSchema)
|
|
2073
|
-
});
|
|
2074
|
-
var contentSourceRowDtoSchema = z18.object({
|
|
2075
|
-
query: z18.string(),
|
|
2076
|
-
groundingSources: z18.array(contentGroundingSourceSchema)
|
|
2077
|
-
});
|
|
2078
|
-
var contentSourcesResponseDtoSchema = z18.object({
|
|
2079
|
-
sources: z18.array(contentSourceRowDtoSchema),
|
|
2080
|
-
latestRunId: z18.string()
|
|
2081
|
-
});
|
|
2082
|
-
var contentGapRowDtoSchema = z18.object({
|
|
2083
|
-
query: z18.string(),
|
|
2084
|
-
competitorDomains: z18.array(z18.string()),
|
|
2085
|
-
competitorCount: z18.number().int().nonnegative(),
|
|
2086
|
-
missRate: z18.number().min(0).max(1),
|
|
2087
|
-
lastSeenInRunId: z18.string()
|
|
2262
|
+
forceRefresh: z19.boolean().optional()
|
|
2088
2263
|
});
|
|
2089
|
-
var
|
|
2090
|
-
|
|
2091
|
-
|
|
2264
|
+
var contentGroundingSourceSchema = z19.object({
|
|
2265
|
+
uri: z19.string(),
|
|
2266
|
+
title: z19.string(),
|
|
2267
|
+
domain: z19.string(),
|
|
2268
|
+
isOurDomain: z19.boolean(),
|
|
2269
|
+
isCompetitor: z19.boolean(),
|
|
2270
|
+
citationCount: z19.number().int().nonnegative(),
|
|
2271
|
+
providers: z19.array(providerNameSchema)
|
|
2272
|
+
});
|
|
2273
|
+
var contentSourceRowDtoSchema = z19.object({
|
|
2274
|
+
query: z19.string(),
|
|
2275
|
+
groundingSources: z19.array(contentGroundingSourceSchema)
|
|
2276
|
+
});
|
|
2277
|
+
var contentSourcesResponseDtoSchema = z19.object({
|
|
2278
|
+
sources: z19.array(contentSourceRowDtoSchema),
|
|
2279
|
+
latestRunId: z19.string()
|
|
2280
|
+
});
|
|
2281
|
+
var contentGapRowDtoSchema = z19.object({
|
|
2282
|
+
query: z19.string(),
|
|
2283
|
+
competitorDomains: z19.array(z19.string()),
|
|
2284
|
+
competitorCount: z19.number().int().nonnegative(),
|
|
2285
|
+
missRate: z19.number().min(0).max(1),
|
|
2286
|
+
lastSeenInRunId: z19.string()
|
|
2287
|
+
});
|
|
2288
|
+
var contentGapsResponseDtoSchema = z19.object({
|
|
2289
|
+
gaps: z19.array(contentGapRowDtoSchema),
|
|
2290
|
+
latestRunId: z19.string()
|
|
2092
2291
|
});
|
|
2093
2292
|
|
|
2094
2293
|
// ../contracts/src/doctor.ts
|
|
2095
|
-
import { z as
|
|
2096
|
-
var checkStatusSchema =
|
|
2294
|
+
import { z as z20 } from "zod";
|
|
2295
|
+
var checkStatusSchema = z20.enum(["ok", "warn", "fail", "skipped"]);
|
|
2097
2296
|
var CheckStatuses = checkStatusSchema.enum;
|
|
2098
|
-
var checkScopeSchema =
|
|
2297
|
+
var checkScopeSchema = z20.enum(["global", "project"]);
|
|
2099
2298
|
var CheckScopes = checkScopeSchema.enum;
|
|
2100
|
-
var checkCategorySchema =
|
|
2299
|
+
var checkCategorySchema = z20.enum([
|
|
2101
2300
|
"auth",
|
|
2102
2301
|
"config",
|
|
2103
2302
|
"providers",
|
|
@@ -2108,31 +2307,31 @@ var checkCategorySchema = z19.enum([
|
|
|
2108
2307
|
"agent"
|
|
2109
2308
|
]);
|
|
2110
2309
|
var CheckCategories = checkCategorySchema.enum;
|
|
2111
|
-
var checkResultSchema =
|
|
2112
|
-
id:
|
|
2310
|
+
var checkResultSchema = z20.object({
|
|
2311
|
+
id: z20.string(),
|
|
2113
2312
|
category: checkCategorySchema,
|
|
2114
2313
|
scope: checkScopeSchema,
|
|
2115
|
-
title:
|
|
2314
|
+
title: z20.string(),
|
|
2116
2315
|
status: checkStatusSchema,
|
|
2117
|
-
code:
|
|
2118
|
-
summary:
|
|
2119
|
-
remediation:
|
|
2120
|
-
details:
|
|
2121
|
-
durationMs:
|
|
2316
|
+
code: z20.string().describe('Stable machine-readable code (e.g. "google.token.refresh-failed"). Use this for filtering and remediation logic.'),
|
|
2317
|
+
summary: z20.string(),
|
|
2318
|
+
remediation: z20.string().nullable().optional().describe('Operator-facing next step. Null when status is "ok" or no specific remediation applies.'),
|
|
2319
|
+
details: z20.record(z20.string(), z20.unknown()).optional().describe("Structured context \u2014 principal email, redirect URI, missing scopes, etc. Stable per check id."),
|
|
2320
|
+
durationMs: z20.number().int().nonnegative().describe("How long the check took to execute.")
|
|
2122
2321
|
});
|
|
2123
|
-
var doctorReportSchema =
|
|
2322
|
+
var doctorReportSchema = z20.object({
|
|
2124
2323
|
scope: checkScopeSchema,
|
|
2125
|
-
project:
|
|
2126
|
-
generatedAt:
|
|
2127
|
-
durationMs:
|
|
2128
|
-
summary:
|
|
2129
|
-
total:
|
|
2130
|
-
ok:
|
|
2131
|
-
warn:
|
|
2132
|
-
fail:
|
|
2133
|
-
skipped:
|
|
2324
|
+
project: z20.string().nullable().describe('Project name when scope is "project", null otherwise.'),
|
|
2325
|
+
generatedAt: z20.string().describe("ISO-8601 timestamp when this doctor run started."),
|
|
2326
|
+
durationMs: z20.number().int().nonnegative(),
|
|
2327
|
+
summary: z20.object({
|
|
2328
|
+
total: z20.number().int().nonnegative(),
|
|
2329
|
+
ok: z20.number().int().nonnegative(),
|
|
2330
|
+
warn: z20.number().int().nonnegative(),
|
|
2331
|
+
fail: z20.number().int().nonnegative(),
|
|
2332
|
+
skipped: z20.number().int().nonnegative()
|
|
2134
2333
|
}),
|
|
2135
|
-
checks:
|
|
2334
|
+
checks: z20.array(checkResultSchema)
|
|
2136
2335
|
});
|
|
2137
2336
|
function summarizeCheckResults(results) {
|
|
2138
2337
|
const summary = { total: results.length, ok: 0, warn: 0, fail: 0, skipped: 0 };
|
|
@@ -2278,52 +2477,52 @@ function normalizeUrlPath(input) {
|
|
|
2278
2477
|
}
|
|
2279
2478
|
|
|
2280
2479
|
// ../contracts/src/citations.ts
|
|
2281
|
-
import { z as
|
|
2282
|
-
var citationCoverageProviderSchema =
|
|
2283
|
-
provider:
|
|
2480
|
+
import { z as z21 } from "zod";
|
|
2481
|
+
var citationCoverageProviderSchema = z21.object({
|
|
2482
|
+
provider: z21.string(),
|
|
2284
2483
|
citationState: citationStateSchema,
|
|
2285
|
-
cited:
|
|
2286
|
-
mentioned:
|
|
2287
|
-
runId:
|
|
2288
|
-
runCreatedAt:
|
|
2289
|
-
});
|
|
2290
|
-
var citationCoverageRowSchema =
|
|
2291
|
-
queryId:
|
|
2292
|
-
query:
|
|
2293
|
-
providers:
|
|
2294
|
-
citedCount:
|
|
2295
|
-
mentionedCount:
|
|
2296
|
-
totalProviders:
|
|
2297
|
-
});
|
|
2298
|
-
var competitorGapRowSchema =
|
|
2299
|
-
queryId:
|
|
2300
|
-
query:
|
|
2301
|
-
provider:
|
|
2302
|
-
citingCompetitors:
|
|
2303
|
-
runId:
|
|
2304
|
-
runCreatedAt:
|
|
2305
|
-
});
|
|
2306
|
-
var citationVisibilitySummarySchema =
|
|
2307
|
-
providersConfigured:
|
|
2308
|
-
providersCiting:
|
|
2309
|
-
providersMentioning:
|
|
2310
|
-
totalQueries:
|
|
2484
|
+
cited: z21.boolean(),
|
|
2485
|
+
mentioned: z21.boolean(),
|
|
2486
|
+
runId: z21.string(),
|
|
2487
|
+
runCreatedAt: z21.string()
|
|
2488
|
+
});
|
|
2489
|
+
var citationCoverageRowSchema = z21.object({
|
|
2490
|
+
queryId: z21.string(),
|
|
2491
|
+
query: z21.string(),
|
|
2492
|
+
providers: z21.array(citationCoverageProviderSchema),
|
|
2493
|
+
citedCount: z21.number().int().nonnegative(),
|
|
2494
|
+
mentionedCount: z21.number().int().nonnegative(),
|
|
2495
|
+
totalProviders: z21.number().int().nonnegative()
|
|
2496
|
+
});
|
|
2497
|
+
var competitorGapRowSchema = z21.object({
|
|
2498
|
+
queryId: z21.string(),
|
|
2499
|
+
query: z21.string(),
|
|
2500
|
+
provider: z21.string(),
|
|
2501
|
+
citingCompetitors: z21.array(z21.string()),
|
|
2502
|
+
runId: z21.string(),
|
|
2503
|
+
runCreatedAt: z21.string()
|
|
2504
|
+
});
|
|
2505
|
+
var citationVisibilitySummarySchema = z21.object({
|
|
2506
|
+
providersConfigured: z21.number().int().nonnegative(),
|
|
2507
|
+
providersCiting: z21.number().int().nonnegative(),
|
|
2508
|
+
providersMentioning: z21.number().int().nonnegative(),
|
|
2509
|
+
totalQueries: z21.number().int().nonnegative(),
|
|
2311
2510
|
// Cross-tab buckets — each tracked query with at least one snapshot lands
|
|
2312
2511
|
// in exactly one of these. Queries with zero snapshots are not counted in
|
|
2313
2512
|
// any bucket; (sum of buckets) ≤ totalQueries.
|
|
2314
|
-
queriesCitedAndMentioned:
|
|
2315
|
-
queriesCitedOnly:
|
|
2316
|
-
queriesMentionedOnly:
|
|
2317
|
-
queriesInvisible:
|
|
2318
|
-
latestRunId:
|
|
2319
|
-
latestRunAt:
|
|
2320
|
-
});
|
|
2321
|
-
var citationVisibilityResponseSchema =
|
|
2513
|
+
queriesCitedAndMentioned: z21.number().int().nonnegative(),
|
|
2514
|
+
queriesCitedOnly: z21.number().int().nonnegative(),
|
|
2515
|
+
queriesMentionedOnly: z21.number().int().nonnegative(),
|
|
2516
|
+
queriesInvisible: z21.number().int().nonnegative(),
|
|
2517
|
+
latestRunId: z21.string().nullable(),
|
|
2518
|
+
latestRunAt: z21.string().nullable()
|
|
2519
|
+
});
|
|
2520
|
+
var citationVisibilityResponseSchema = z21.object({
|
|
2322
2521
|
summary: citationVisibilitySummarySchema,
|
|
2323
|
-
byQuery:
|
|
2324
|
-
competitorGaps:
|
|
2325
|
-
status:
|
|
2326
|
-
reason:
|
|
2522
|
+
byQuery: z21.array(citationCoverageRowSchema),
|
|
2523
|
+
competitorGaps: z21.array(competitorGapRowSchema),
|
|
2524
|
+
status: z21.enum(["ready", "no-data"]),
|
|
2525
|
+
reason: z21.enum(["no-runs-yet", "no-queries"]).optional()
|
|
2327
2526
|
});
|
|
2328
2527
|
function emptyCitationVisibility(reason) {
|
|
2329
2528
|
return {
|
|
@@ -2350,46 +2549,46 @@ function citationStateToCited(state) {
|
|
|
2350
2549
|
}
|
|
2351
2550
|
|
|
2352
2551
|
// ../contracts/src/report.ts
|
|
2353
|
-
import { z as
|
|
2354
|
-
var providerLocationTreatmentSchema =
|
|
2552
|
+
import { z as z22 } from "zod";
|
|
2553
|
+
var providerLocationTreatmentSchema = z22.enum([
|
|
2355
2554
|
"prompt",
|
|
2356
2555
|
"request-param",
|
|
2357
2556
|
"browser-geo",
|
|
2358
2557
|
"ignored"
|
|
2359
2558
|
]);
|
|
2360
|
-
var reportMetaLocationSchema =
|
|
2559
|
+
var reportMetaLocationSchema = z22.object({
|
|
2361
2560
|
/** Human-readable label as configured on the project (e.g. "michigan"). */
|
|
2362
|
-
label:
|
|
2561
|
+
label: z22.string(),
|
|
2363
2562
|
/** Resolved city/region/country from the project's `LocationContext`. */
|
|
2364
|
-
city:
|
|
2365
|
-
region:
|
|
2366
|
-
country:
|
|
2563
|
+
city: z22.string(),
|
|
2564
|
+
region: z22.string(),
|
|
2565
|
+
country: z22.string(),
|
|
2367
2566
|
/**
|
|
2368
2567
|
* Other locations configured on the project that did NOT power this report.
|
|
2369
2568
|
* When non-empty, callers should make clear that the report is location-scoped:
|
|
2370
2569
|
* a separate sweep is needed to see how AI engines respond from each one.
|
|
2371
2570
|
*/
|
|
2372
|
-
otherConfiguredLabels:
|
|
2571
|
+
otherConfiguredLabels: z22.array(z22.string())
|
|
2373
2572
|
});
|
|
2374
|
-
var reportProviderLocationHandlingSchema =
|
|
2573
|
+
var reportProviderLocationHandlingSchema = z22.object({
|
|
2375
2574
|
/** Provider name (matches `query_snapshots.provider`). */
|
|
2376
|
-
provider:
|
|
2575
|
+
provider: z22.string(),
|
|
2377
2576
|
/** How this provider applied the configured location during this run. */
|
|
2378
2577
|
treatment: providerLocationTreatmentSchema,
|
|
2379
2578
|
/** One-sentence explanation suitable for the report. */
|
|
2380
|
-
description:
|
|
2579
|
+
description: z22.string()
|
|
2381
2580
|
});
|
|
2382
|
-
var reportMetaSchema =
|
|
2581
|
+
var reportMetaSchema = z22.object({
|
|
2383
2582
|
/** ISO timestamp the report was generated (server clock). */
|
|
2384
|
-
generatedAt:
|
|
2583
|
+
generatedAt: z22.string(),
|
|
2385
2584
|
/** Project the report covers. */
|
|
2386
|
-
project:
|
|
2387
|
-
id:
|
|
2388
|
-
name:
|
|
2389
|
-
displayName:
|
|
2390
|
-
canonicalDomain:
|
|
2391
|
-
country:
|
|
2392
|
-
language:
|
|
2585
|
+
project: z22.object({
|
|
2586
|
+
id: z22.string(),
|
|
2587
|
+
name: z22.string(),
|
|
2588
|
+
displayName: z22.string(),
|
|
2589
|
+
canonicalDomain: z22.string(),
|
|
2590
|
+
country: z22.string(),
|
|
2591
|
+
language: z22.string()
|
|
2393
2592
|
}),
|
|
2394
2593
|
/**
|
|
2395
2594
|
* The location that powered the latest visibility run, when one was set.
|
|
@@ -2404,24 +2603,24 @@ var reportMetaSchema = z21.object({
|
|
|
2404
2603
|
* each provider's answer — some providers append it to the prompt, some
|
|
2405
2604
|
* pass it as a structured request field, and some (CDP) ignore it.
|
|
2406
2605
|
*/
|
|
2407
|
-
providerLocationHandling:
|
|
2606
|
+
providerLocationHandling: z22.array(reportProviderLocationHandlingSchema),
|
|
2408
2607
|
/** Earliest data point referenced by the report (ISO date). */
|
|
2409
|
-
periodStart:
|
|
2608
|
+
periodStart: z22.string().nullable(),
|
|
2410
2609
|
/** Latest data point referenced by the report (ISO date). */
|
|
2411
|
-
periodEnd:
|
|
2610
|
+
periodEnd: z22.string().nullable()
|
|
2412
2611
|
});
|
|
2413
|
-
var reportExecutiveSummarySchema =
|
|
2612
|
+
var reportExecutiveSummarySchema = z22.object({
|
|
2414
2613
|
/**
|
|
2415
2614
|
* 0..100 — share of tracked queries that were cited by at least one
|
|
2416
2615
|
* provider in the latest run. "Cited" means the project's domain appeared
|
|
2417
2616
|
* in the source list / grounding the AI used to answer. Computed per-query
|
|
2418
2617
|
* (not per-(query × provider)) so the rate is invariant to provider count.
|
|
2419
2618
|
*/
|
|
2420
|
-
citationRate:
|
|
2619
|
+
citationRate: z22.number(),
|
|
2421
2620
|
/** Numerator of `citationRate` — distinct tracked queries cited by ≥1 provider in the latest run. */
|
|
2422
|
-
citedQueryCount:
|
|
2621
|
+
citedQueryCount: z22.number(),
|
|
2423
2622
|
/** Denominator of `citationRate` — total tracked queries. */
|
|
2424
|
-
totalQueryCount:
|
|
2623
|
+
totalQueryCount: z22.number(),
|
|
2425
2624
|
/**
|
|
2426
2625
|
* 0..100 — share of tracked queries where the project's brand or domain
|
|
2427
2626
|
* appeared in at least one provider's answer text in the latest run.
|
|
@@ -2429,68 +2628,68 @@ var reportExecutiveSummarySchema = z21.object({
|
|
|
2429
2628
|
* the prose without citing your domain in its sources, and vice versa.
|
|
2430
2629
|
* Same per-query denominator as `citationRate` for consistency.
|
|
2431
2630
|
*/
|
|
2432
|
-
mentionRate:
|
|
2631
|
+
mentionRate: z22.number(),
|
|
2433
2632
|
/** Numerator of `mentionRate` — distinct tracked queries mentioned in ≥1 provider's answer text. */
|
|
2434
|
-
mentionedQueryCount:
|
|
2633
|
+
mentionedQueryCount: z22.number(),
|
|
2435
2634
|
/** Compared to the previous run: 'up' | 'down' | 'flat' | 'unknown' (no prior run). */
|
|
2436
|
-
trend:
|
|
2635
|
+
trend: z22.enum(["up", "down", "flat", "unknown"]),
|
|
2437
2636
|
/** Total tracked queries. */
|
|
2438
|
-
queryCount:
|
|
2637
|
+
queryCount: z22.number(),
|
|
2439
2638
|
/** Total tracked competitors. */
|
|
2440
|
-
competitorCount:
|
|
2639
|
+
competitorCount: z22.number(),
|
|
2441
2640
|
/** Number of providers in the latest run. */
|
|
2442
|
-
providerCount:
|
|
2641
|
+
providerCount: z22.number(),
|
|
2443
2642
|
/** GSC totals across the most-recent sync window. Null when GSC is not connected. */
|
|
2444
|
-
gsc:
|
|
2445
|
-
clicks:
|
|
2446
|
-
impressions:
|
|
2447
|
-
ctr:
|
|
2448
|
-
avgPosition:
|
|
2449
|
-
periodStart:
|
|
2450
|
-
periodEnd:
|
|
2643
|
+
gsc: z22.object({
|
|
2644
|
+
clicks: z22.number(),
|
|
2645
|
+
impressions: z22.number(),
|
|
2646
|
+
ctr: z22.number(),
|
|
2647
|
+
avgPosition: z22.number(),
|
|
2648
|
+
periodStart: z22.string(),
|
|
2649
|
+
periodEnd: z22.string()
|
|
2451
2650
|
}).nullable(),
|
|
2452
2651
|
/** GA4 totals across the most-recent sync period. Null when GA4 is not connected. */
|
|
2453
|
-
ga:
|
|
2454
|
-
sessions:
|
|
2455
|
-
users:
|
|
2456
|
-
periodStart:
|
|
2457
|
-
periodEnd:
|
|
2652
|
+
ga: z22.object({
|
|
2653
|
+
sessions: z22.number(),
|
|
2654
|
+
users: z22.number(),
|
|
2655
|
+
periodStart: z22.string(),
|
|
2656
|
+
periodEnd: z22.string()
|
|
2458
2657
|
}).nullable(),
|
|
2459
2658
|
/** Top 3-5 findings, each rendered as a single-sentence narrative. */
|
|
2460
|
-
findings:
|
|
2461
|
-
title:
|
|
2462
|
-
detail:
|
|
2463
|
-
tone:
|
|
2659
|
+
findings: z22.array(z22.object({
|
|
2660
|
+
title: z22.string(),
|
|
2661
|
+
detail: z22.string(),
|
|
2662
|
+
tone: z22.enum(["positive", "caution", "negative", "neutral"])
|
|
2464
2663
|
}))
|
|
2465
2664
|
});
|
|
2466
|
-
var citationCellSchema =
|
|
2467
|
-
citationState:
|
|
2468
|
-
answerMentioned:
|
|
2469
|
-
model:
|
|
2665
|
+
var citationCellSchema = z22.object({
|
|
2666
|
+
citationState: z22.enum(["cited", "not-cited", "pending"]),
|
|
2667
|
+
answerMentioned: z22.boolean().nullable(),
|
|
2668
|
+
model: z22.string().nullable()
|
|
2470
2669
|
});
|
|
2471
|
-
var citationScorecardSchema =
|
|
2472
|
-
queries:
|
|
2473
|
-
providers:
|
|
2670
|
+
var citationScorecardSchema = z22.object({
|
|
2671
|
+
queries: z22.array(z22.string()),
|
|
2672
|
+
providers: z22.array(z22.string()),
|
|
2474
2673
|
/** matrix[queryIndex][providerIndex] — null when no snapshot exists for the pair. */
|
|
2475
|
-
matrix:
|
|
2674
|
+
matrix: z22.array(z22.array(citationCellSchema.nullable())),
|
|
2476
2675
|
/** Per-provider citation rate (0..100). */
|
|
2477
|
-
providerRates:
|
|
2478
|
-
provider:
|
|
2479
|
-
citedCount:
|
|
2480
|
-
totalCount:
|
|
2481
|
-
citationRate:
|
|
2676
|
+
providerRates: z22.array(z22.object({
|
|
2677
|
+
provider: z22.string(),
|
|
2678
|
+
citedCount: z22.number(),
|
|
2679
|
+
totalCount: z22.number(),
|
|
2680
|
+
citationRate: z22.number()
|
|
2482
2681
|
}))
|
|
2483
2682
|
});
|
|
2484
|
-
var competitorRowSchema =
|
|
2485
|
-
domain:
|
|
2683
|
+
var competitorRowSchema = z22.object({
|
|
2684
|
+
domain: z22.string(),
|
|
2486
2685
|
/** Number of (query × provider) pairs that cited this competitor. */
|
|
2487
|
-
citationCount:
|
|
2686
|
+
citationCount: z22.number(),
|
|
2488
2687
|
/** Out-of count for the same denominator. */
|
|
2489
|
-
totalCount:
|
|
2688
|
+
totalCount: z22.number(),
|
|
2490
2689
|
/** 'High' | 'Moderate' | 'Low' | 'None' — from buildPortfolioProject pressure logic. */
|
|
2491
|
-
pressureLabel:
|
|
2690
|
+
pressureLabel: z22.enum(["High", "Moderate", "Low", "None"]),
|
|
2492
2691
|
/** Distinct queries on which this competitor was cited. */
|
|
2493
|
-
citedQueries:
|
|
2692
|
+
citedQueries: z22.array(z22.string()),
|
|
2494
2693
|
/**
|
|
2495
2694
|
* Citation share 0..100. Numerator = this competitor's `citationCount`.
|
|
2496
2695
|
* Denominator = sum of `citationCount` across all competitors plus the
|
|
@@ -2498,30 +2697,30 @@ var competitorRowSchema = z21.object({
|
|
|
2498
2697
|
* slots in the snapshot. Distinct from the project-level Mention Share
|
|
2499
2698
|
* gauge — that one is brand-in-answer-text, this one is domain-in-source-list.
|
|
2500
2699
|
*/
|
|
2501
|
-
sharePct:
|
|
2700
|
+
sharePct: z22.number(),
|
|
2502
2701
|
/**
|
|
2503
2702
|
* URLs from the latest run's grounding sources whose host matches this
|
|
2504
2703
|
* competitor's domain, with the queries each URL was cited for. Empty
|
|
2505
2704
|
* when no grounding-source data is available (e.g. no `rawResponse` JSON
|
|
2506
2705
|
* stored for the snapshots).
|
|
2507
2706
|
*/
|
|
2508
|
-
theirCitedPages:
|
|
2707
|
+
theirCitedPages: z22.array(z22.object({ url: z22.string(), citedFor: z22.array(z22.string()) }))
|
|
2509
2708
|
});
|
|
2510
|
-
var competitorLandscapeSchema =
|
|
2709
|
+
var competitorLandscapeSchema = z22.object({
|
|
2511
2710
|
/** Project's own citation count (for the bar chart comparing project vs competitors). */
|
|
2512
|
-
projectCitationCount:
|
|
2513
|
-
competitors:
|
|
2711
|
+
projectCitationCount: z22.number(),
|
|
2712
|
+
competitors: z22.array(competitorRowSchema)
|
|
2514
2713
|
});
|
|
2515
|
-
var mentionRowSchema =
|
|
2516
|
-
domain:
|
|
2714
|
+
var mentionRowSchema = z22.object({
|
|
2715
|
+
domain: z22.string(),
|
|
2517
2716
|
/** Number of (query × provider) pairs whose answer text mentioned this competitor's brand or domain. */
|
|
2518
|
-
mentionCount:
|
|
2717
|
+
mentionCount: z22.number(),
|
|
2519
2718
|
/** Out-of count for the same denominator (snapshots that had answer text). */
|
|
2520
|
-
totalCount:
|
|
2719
|
+
totalCount: z22.number(),
|
|
2521
2720
|
/** 'High' | 'Moderate' | 'Low' | 'None' — mention frequency tier (mirrors CompetitorRow.pressureLabel). */
|
|
2522
|
-
pressureLabel:
|
|
2721
|
+
pressureLabel: z22.enum(["High", "Moderate", "Low", "None"]),
|
|
2523
2722
|
/** Distinct queries on which this competitor was mentioned. */
|
|
2524
|
-
mentionedQueries:
|
|
2723
|
+
mentionedQueries: z22.array(z22.string()),
|
|
2525
2724
|
/**
|
|
2526
2725
|
* Mention share 0..100. Numerator = this competitor's `mentionCount`.
|
|
2527
2726
|
* Denominator = sum of `mentionCount` across all competitors plus the
|
|
@@ -2529,129 +2728,129 @@ var mentionRowSchema = z21.object({
|
|
|
2529
2728
|
* mention. Per-competitor split of the same head-to-head measure the
|
|
2530
2729
|
* project's hero `MentionShareDto` gauge headlines.
|
|
2531
2730
|
*/
|
|
2532
|
-
sharePct:
|
|
2731
|
+
sharePct: z22.number()
|
|
2533
2732
|
});
|
|
2534
|
-
var mentionLandscapeSchema =
|
|
2733
|
+
var mentionLandscapeSchema = z22.object({
|
|
2535
2734
|
/** Project's own mention count (for the bar chart comparing project vs competitors). */
|
|
2536
|
-
projectMentionCount:
|
|
2735
|
+
projectMentionCount: z22.number(),
|
|
2537
2736
|
/** Snapshots considered — those with non-empty answerText. Drives the totalCount denominator. */
|
|
2538
|
-
totalAnswerSnapshots:
|
|
2539
|
-
competitors:
|
|
2737
|
+
totalAnswerSnapshots: z22.number(),
|
|
2738
|
+
competitors: z22.array(mentionRowSchema)
|
|
2540
2739
|
});
|
|
2541
|
-
var aiSourceCategoryBucketSchema =
|
|
2740
|
+
var aiSourceCategoryBucketSchema = z22.object({
|
|
2542
2741
|
/** Category slug from packages/contracts/src/source-categories. */
|
|
2543
|
-
category:
|
|
2742
|
+
category: z22.string(),
|
|
2544
2743
|
/** Display label. */
|
|
2545
|
-
label:
|
|
2744
|
+
label: z22.string(),
|
|
2546
2745
|
/** Number of citations falling in this category. */
|
|
2547
|
-
count:
|
|
2746
|
+
count: z22.number(),
|
|
2548
2747
|
/** 0..100 share of total citations. */
|
|
2549
|
-
sharePct:
|
|
2748
|
+
sharePct: z22.number()
|
|
2550
2749
|
});
|
|
2551
|
-
var aiSourceOriginSchema =
|
|
2552
|
-
categories:
|
|
2750
|
+
var aiSourceOriginSchema = z22.object({
|
|
2751
|
+
categories: z22.array(aiSourceCategoryBucketSchema),
|
|
2553
2752
|
/** Top 20 source domains by citation count (excluding the project's own domain). */
|
|
2554
|
-
topDomains:
|
|
2555
|
-
domain:
|
|
2556
|
-
count:
|
|
2753
|
+
topDomains: z22.array(z22.object({
|
|
2754
|
+
domain: z22.string(),
|
|
2755
|
+
count: z22.number(),
|
|
2557
2756
|
/** True when the domain is one of the project's tracked competitors. */
|
|
2558
|
-
isCompetitor:
|
|
2757
|
+
isCompetitor: z22.boolean()
|
|
2559
2758
|
}))
|
|
2560
2759
|
});
|
|
2561
|
-
var gscQueryRowSchema =
|
|
2562
|
-
query:
|
|
2563
|
-
clicks:
|
|
2564
|
-
impressions:
|
|
2565
|
-
ctr:
|
|
2566
|
-
avgPosition:
|
|
2760
|
+
var gscQueryRowSchema = z22.object({
|
|
2761
|
+
query: z22.string(),
|
|
2762
|
+
clicks: z22.number(),
|
|
2763
|
+
impressions: z22.number(),
|
|
2764
|
+
ctr: z22.number(),
|
|
2765
|
+
avgPosition: z22.number(),
|
|
2567
2766
|
/** Heuristic categorization: 'brand' | 'lead-gen' | 'industry' | 'other'. */
|
|
2568
|
-
category:
|
|
2569
|
-
});
|
|
2570
|
-
var gscSectionSchema =
|
|
2571
|
-
periodStart:
|
|
2572
|
-
periodEnd:
|
|
2573
|
-
totalClicks:
|
|
2574
|
-
totalImpressions:
|
|
2575
|
-
ctr:
|
|
2576
|
-
avgPosition:
|
|
2577
|
-
topQueries:
|
|
2578
|
-
categoryBreakdown:
|
|
2579
|
-
category:
|
|
2580
|
-
clicks:
|
|
2581
|
-
impressions:
|
|
2582
|
-
sharePct:
|
|
2767
|
+
category: z22.enum(["brand", "lead-gen", "industry", "other"])
|
|
2768
|
+
});
|
|
2769
|
+
var gscSectionSchema = z22.object({
|
|
2770
|
+
periodStart: z22.string(),
|
|
2771
|
+
periodEnd: z22.string(),
|
|
2772
|
+
totalClicks: z22.number(),
|
|
2773
|
+
totalImpressions: z22.number(),
|
|
2774
|
+
ctr: z22.number(),
|
|
2775
|
+
avgPosition: z22.number(),
|
|
2776
|
+
topQueries: z22.array(gscQueryRowSchema),
|
|
2777
|
+
categoryBreakdown: z22.array(z22.object({
|
|
2778
|
+
category: z22.enum(["brand", "lead-gen", "industry", "other"]),
|
|
2779
|
+
clicks: z22.number(),
|
|
2780
|
+
impressions: z22.number(),
|
|
2781
|
+
sharePct: z22.number()
|
|
2583
2782
|
})),
|
|
2584
|
-
trend:
|
|
2783
|
+
trend: z22.array(z22.object({ date: z22.string(), clicks: z22.number(), impressions: z22.number() })),
|
|
2585
2784
|
/**
|
|
2586
2785
|
* Tracked AEO queries that have no GSC impressions in the report window.
|
|
2587
2786
|
* Surfaces queries that may not represent real search demand.
|
|
2588
2787
|
*/
|
|
2589
|
-
trackedButNoGsc:
|
|
2788
|
+
trackedButNoGsc: z22.array(z22.string()),
|
|
2590
2789
|
/**
|
|
2591
2790
|
* GSC top queries (sorted by impressions desc) that are not tracked as
|
|
2592
2791
|
* AEO queries — the candidate set for adding to the AEO project.
|
|
2593
2792
|
*/
|
|
2594
|
-
gscButNotTracked:
|
|
2595
|
-
});
|
|
2596
|
-
var gaTrafficSectionSchema =
|
|
2597
|
-
totalSessions:
|
|
2598
|
-
totalUsers:
|
|
2599
|
-
totalOrganicSessions:
|
|
2600
|
-
periodStart:
|
|
2601
|
-
periodEnd:
|
|
2602
|
-
topLandingPages:
|
|
2603
|
-
page:
|
|
2604
|
-
sessions:
|
|
2605
|
-
users:
|
|
2606
|
-
organicSessions:
|
|
2793
|
+
gscButNotTracked: z22.array(z22.string())
|
|
2794
|
+
});
|
|
2795
|
+
var gaTrafficSectionSchema = z22.object({
|
|
2796
|
+
totalSessions: z22.number(),
|
|
2797
|
+
totalUsers: z22.number(),
|
|
2798
|
+
totalOrganicSessions: z22.number(),
|
|
2799
|
+
periodStart: z22.string(),
|
|
2800
|
+
periodEnd: z22.string(),
|
|
2801
|
+
topLandingPages: z22.array(z22.object({
|
|
2802
|
+
page: z22.string(),
|
|
2803
|
+
sessions: z22.number(),
|
|
2804
|
+
users: z22.number(),
|
|
2805
|
+
organicSessions: z22.number()
|
|
2607
2806
|
})),
|
|
2608
|
-
channelBreakdown:
|
|
2609
|
-
channel:
|
|
2610
|
-
sessions:
|
|
2611
|
-
sharePct:
|
|
2807
|
+
channelBreakdown: z22.array(z22.object({
|
|
2808
|
+
channel: z22.string(),
|
|
2809
|
+
sessions: z22.number(),
|
|
2810
|
+
sharePct: z22.number()
|
|
2612
2811
|
}))
|
|
2613
2812
|
});
|
|
2614
|
-
var socialReferralSectionSchema =
|
|
2615
|
-
totalSessions:
|
|
2616
|
-
organicSessions:
|
|
2617
|
-
paidSessions:
|
|
2618
|
-
channels:
|
|
2619
|
-
channelGroup:
|
|
2620
|
-
sessions:
|
|
2621
|
-
sharePct:
|
|
2813
|
+
var socialReferralSectionSchema = z22.object({
|
|
2814
|
+
totalSessions: z22.number(),
|
|
2815
|
+
organicSessions: z22.number(),
|
|
2816
|
+
paidSessions: z22.number(),
|
|
2817
|
+
channels: z22.array(z22.object({
|
|
2818
|
+
channelGroup: z22.string(),
|
|
2819
|
+
sessions: z22.number(),
|
|
2820
|
+
sharePct: z22.number()
|
|
2622
2821
|
})),
|
|
2623
|
-
topCampaigns:
|
|
2624
|
-
source:
|
|
2625
|
-
medium:
|
|
2626
|
-
sessions:
|
|
2822
|
+
topCampaigns: z22.array(z22.object({
|
|
2823
|
+
source: z22.string(),
|
|
2824
|
+
medium: z22.string(),
|
|
2825
|
+
sessions: z22.number()
|
|
2627
2826
|
}))
|
|
2628
2827
|
});
|
|
2629
|
-
var aiReferralSectionSchema =
|
|
2630
|
-
totalSessions:
|
|
2631
|
-
totalUsers:
|
|
2632
|
-
bySource:
|
|
2633
|
-
source:
|
|
2634
|
-
sessions:
|
|
2635
|
-
users:
|
|
2636
|
-
sharePct:
|
|
2828
|
+
var aiReferralSectionSchema = z22.object({
|
|
2829
|
+
totalSessions: z22.number(),
|
|
2830
|
+
totalUsers: z22.number(),
|
|
2831
|
+
bySource: z22.array(z22.object({
|
|
2832
|
+
source: z22.string(),
|
|
2833
|
+
sessions: z22.number(),
|
|
2834
|
+
users: z22.number(),
|
|
2835
|
+
sharePct: z22.number()
|
|
2637
2836
|
})),
|
|
2638
|
-
trend:
|
|
2639
|
-
topLandingPages:
|
|
2640
|
-
page:
|
|
2641
|
-
sessions:
|
|
2642
|
-
users:
|
|
2837
|
+
trend: z22.array(z22.object({ date: z22.string(), sessions: z22.number() })),
|
|
2838
|
+
topLandingPages: z22.array(z22.object({
|
|
2839
|
+
page: z22.string(),
|
|
2840
|
+
sessions: z22.number(),
|
|
2841
|
+
users: z22.number()
|
|
2643
2842
|
}))
|
|
2644
2843
|
});
|
|
2645
|
-
var serverActivitySectionSchema =
|
|
2844
|
+
var serverActivitySectionSchema = z22.object({
|
|
2646
2845
|
/** ISO8601 inclusive lower bound of the report window (default: 7 days). */
|
|
2647
|
-
windowStart:
|
|
2846
|
+
windowStart: z22.string(),
|
|
2648
2847
|
/** ISO8601 inclusive upper bound. */
|
|
2649
|
-
windowEnd:
|
|
2650
|
-
hasData:
|
|
2848
|
+
windowEnd: z22.string(),
|
|
2849
|
+
hasData: z22.boolean(),
|
|
2651
2850
|
/** Last-7d total verified crawler hits, with prior 7d for delta. */
|
|
2652
|
-
verifiedCrawlerHits:
|
|
2851
|
+
verifiedCrawlerHits: z22.object({ current: z22.number(), prior: z22.number(), deltaPct: z22.number().nullable() }),
|
|
2653
2852
|
/** Last-7d total unverified crawler hits, separated from verified trust metrics. */
|
|
2654
|
-
unverifiedCrawlerHits:
|
|
2853
|
+
unverifiedCrawlerHits: z22.object({ current: z22.number(), prior: z22.number(), deltaPct: z22.number().nullable() }),
|
|
2655
2854
|
/**
|
|
2656
2855
|
* Last-7d on-demand per-user fetches from AI surfaces (ChatGPT-User,
|
|
2657
2856
|
* Perplexity-User, MistralAI-User). Disjoint from `verifiedCrawlerHits` /
|
|
@@ -2660,19 +2859,19 @@ var serverActivitySectionSchema = z21.object({
|
|
|
2660
2859
|
* because the operational question for user-fetch is "is this happening?"
|
|
2661
2860
|
* not "is this a confirmed bot identity?"
|
|
2662
2861
|
*/
|
|
2663
|
-
aiUserFetchHits:
|
|
2862
|
+
aiUserFetchHits: z22.object({ current: z22.number(), prior: z22.number(), deltaPct: z22.number().nullable() }),
|
|
2664
2863
|
/** Last-7d AI-referral sessions (sessionized from server-side request evidence). */
|
|
2665
|
-
referralArrivals:
|
|
2864
|
+
referralArrivals: z22.object({ current: z22.number(), prior: z22.number(), deltaPct: z22.number().nullable() }),
|
|
2666
2865
|
/** Per-AI-operator breakdown (OpenAI, Anthropic, Google AI, Perplexity, …). */
|
|
2667
|
-
byOperator:
|
|
2668
|
-
operator:
|
|
2669
|
-
verifiedHits:
|
|
2866
|
+
byOperator: z22.array(z22.object({
|
|
2867
|
+
operator: z22.string(),
|
|
2868
|
+
verifiedHits: z22.number(),
|
|
2670
2869
|
/** Shown to agency audience only: claimed-bot UA, source IP not in a published range. */
|
|
2671
|
-
unverifiedHits:
|
|
2870
|
+
unverifiedHits: z22.number(),
|
|
2672
2871
|
/** Per-user fetches from this operator's AI surface (ChatGPT-User, …). */
|
|
2673
|
-
userFetchHits:
|
|
2674
|
-
referralArrivals:
|
|
2675
|
-
deltaPct:
|
|
2872
|
+
userFetchHits: z22.number(),
|
|
2873
|
+
referralArrivals: z22.number(),
|
|
2874
|
+
deltaPct: z22.number().nullable()
|
|
2676
2875
|
})),
|
|
2677
2876
|
/**
|
|
2678
2877
|
* Top crawled paths (verified only, last-7d). Path-level citation cross-reference
|
|
@@ -2682,84 +2881,84 @@ var serverActivitySectionSchema = z21.object({
|
|
|
2682
2881
|
* citation evidence can extend this entry with a `citationState` field without
|
|
2683
2882
|
* breaking the contract.
|
|
2684
2883
|
*/
|
|
2685
|
-
topCrawledPaths:
|
|
2686
|
-
path:
|
|
2687
|
-
verifiedHits:
|
|
2884
|
+
topCrawledPaths: z22.array(z22.object({
|
|
2885
|
+
path: z22.string(),
|
|
2886
|
+
verifiedHits: z22.number(),
|
|
2688
2887
|
/** How many distinct AI operators crawled this path in the window. */
|
|
2689
|
-
distinctOperators:
|
|
2888
|
+
distinctOperators: z22.number()
|
|
2690
2889
|
})),
|
|
2691
2890
|
/** AI products that sent ≥1 session in the window (referral by destination). */
|
|
2692
|
-
referralProducts:
|
|
2693
|
-
product:
|
|
2694
|
-
arrivals:
|
|
2695
|
-
distinctLandingPaths:
|
|
2891
|
+
referralProducts: z22.array(z22.object({
|
|
2892
|
+
product: z22.string(),
|
|
2893
|
+
arrivals: z22.number(),
|
|
2894
|
+
distinctLandingPaths: z22.number()
|
|
2696
2895
|
})),
|
|
2697
2896
|
/** Daily trend, last 14d for sparkline / chart rendering. */
|
|
2698
|
-
dailyTrend:
|
|
2699
|
-
date:
|
|
2700
|
-
verifiedCrawlerHits:
|
|
2701
|
-
userFetchHits:
|
|
2702
|
-
referralArrivals:
|
|
2897
|
+
dailyTrend: z22.array(z22.object({
|
|
2898
|
+
date: z22.string(),
|
|
2899
|
+
verifiedCrawlerHits: z22.number(),
|
|
2900
|
+
userFetchHits: z22.number(),
|
|
2901
|
+
referralArrivals: z22.number()
|
|
2703
2902
|
})),
|
|
2704
2903
|
/**
|
|
2705
2904
|
* Top landing paths for AI-referral sessions (last-7d).
|
|
2706
2905
|
* Complements `topCrawledPaths` (what bots fetch) with what humans actually land on.
|
|
2707
2906
|
*/
|
|
2708
|
-
topReferralLandingPaths:
|
|
2709
|
-
path:
|
|
2710
|
-
arrivals:
|
|
2711
|
-
distinctProducts:
|
|
2907
|
+
topReferralLandingPaths: z22.array(z22.object({
|
|
2908
|
+
path: z22.string(),
|
|
2909
|
+
arrivals: z22.number(),
|
|
2910
|
+
distinctProducts: z22.number()
|
|
2712
2911
|
}))
|
|
2713
2912
|
});
|
|
2714
|
-
var indexingHealthSectionSchema =
|
|
2913
|
+
var indexingHealthSectionSchema = z22.object({
|
|
2715
2914
|
/** Source: 'google' | 'bing' | null when neither is connected. */
|
|
2716
|
-
provider:
|
|
2717
|
-
total:
|
|
2718
|
-
indexed:
|
|
2719
|
-
notIndexed:
|
|
2915
|
+
provider: z22.enum(["google", "bing"]).nullable(),
|
|
2916
|
+
total: z22.number(),
|
|
2917
|
+
indexed: z22.number(),
|
|
2918
|
+
notIndexed: z22.number(),
|
|
2720
2919
|
/** Google-only — pages explicitly marked as deindexed. Bing reports 'unknown' instead. */
|
|
2721
|
-
deindexed:
|
|
2920
|
+
deindexed: z22.number(),
|
|
2722
2921
|
/** Bing-only — pages with no inspection data yet. */
|
|
2723
|
-
unknown:
|
|
2922
|
+
unknown: z22.number(),
|
|
2724
2923
|
/** 0..100. */
|
|
2725
|
-
indexedPct:
|
|
2924
|
+
indexedPct: z22.number()
|
|
2726
2925
|
});
|
|
2727
|
-
var citationsTrendPointSchema =
|
|
2926
|
+
var citationsTrendPointSchema = z22.object({
|
|
2728
2927
|
/** Run ID — anchor for cross-section linking. */
|
|
2729
|
-
runId:
|
|
2928
|
+
runId: z22.string(),
|
|
2730
2929
|
/** ISO timestamp when the run finished (or createdAt fallback). */
|
|
2731
|
-
date:
|
|
2930
|
+
date: z22.string(),
|
|
2732
2931
|
/**
|
|
2733
2932
|
* 0..100 — same per-query unique-cited definition as
|
|
2734
2933
|
* `ReportExecutiveSummary.citationRate`. Stable across runs with different
|
|
2735
2934
|
* provider counts so the trend line measures real movement rather than
|
|
2736
2935
|
* provider-count variance.
|
|
2737
2936
|
*/
|
|
2738
|
-
citationRate:
|
|
2937
|
+
citationRate: z22.number(),
|
|
2739
2938
|
/** Numerator of `citationRate` for this run. */
|
|
2740
|
-
citedQueryCount:
|
|
2939
|
+
citedQueryCount: z22.number(),
|
|
2741
2940
|
/** Denominator of `citationRate` for this run. */
|
|
2742
|
-
totalQueryCount:
|
|
2941
|
+
totalQueryCount: z22.number(),
|
|
2743
2942
|
/** 0..100 — same per-query unique-mentioned definition as `ReportExecutiveSummary.mentionRate`. */
|
|
2744
|
-
mentionRate:
|
|
2943
|
+
mentionRate: z22.number(),
|
|
2745
2944
|
/** Numerator of `mentionRate` for this run. */
|
|
2746
|
-
mentionedQueryCount:
|
|
2945
|
+
mentionedQueryCount: z22.number(),
|
|
2747
2946
|
/**
|
|
2748
2947
|
* Per-provider rates for the same run. Each provider's rate is per-pair
|
|
2749
2948
|
* within that provider (`cited / scanned`), so it remains comparable
|
|
2750
2949
|
* between providers in the same run.
|
|
2751
2950
|
*/
|
|
2752
|
-
providerRates:
|
|
2753
|
-
});
|
|
2754
|
-
var reportInsightSchema =
|
|
2755
|
-
id:
|
|
2756
|
-
type:
|
|
2757
|
-
severity:
|
|
2758
|
-
title:
|
|
2759
|
-
query:
|
|
2760
|
-
provider:
|
|
2761
|
-
recommendation:
|
|
2762
|
-
createdAt:
|
|
2951
|
+
providerRates: z22.array(z22.object({ provider: z22.string(), citationRate: z22.number() }))
|
|
2952
|
+
});
|
|
2953
|
+
var reportInsightSchema = z22.object({
|
|
2954
|
+
id: z22.string(),
|
|
2955
|
+
type: z22.enum(["regression", "gain", "opportunity"]),
|
|
2956
|
+
severity: z22.enum(["critical", "high", "medium", "low"]),
|
|
2957
|
+
title: z22.string(),
|
|
2958
|
+
query: z22.string(),
|
|
2959
|
+
provider: z22.string(),
|
|
2960
|
+
recommendation: z22.string().nullable(),
|
|
2961
|
+
createdAt: z22.string(),
|
|
2763
2962
|
/**
|
|
2764
2963
|
* How many times this insight fired across recent runs for the same
|
|
2765
2964
|
* `(query, provider, type)` tuple. Always ≥ 1. Insights returned by the
|
|
@@ -2767,57 +2966,57 @@ var reportInsightSchema = z21.object({
|
|
|
2767
2966
|
* surfacing the multiplicity. Use it directly instead of grouping again
|
|
2768
2967
|
* client-side — counts derived from raw insight rows will overcount.
|
|
2769
2968
|
*/
|
|
2770
|
-
instanceCount:
|
|
2969
|
+
instanceCount: z22.number()
|
|
2771
2970
|
});
|
|
2772
|
-
var recommendedNextStepSchema =
|
|
2971
|
+
var recommendedNextStepSchema = z22.object({
|
|
2773
2972
|
/** 'immediate' | 'short-term' | 'medium-term' — bucketed by severity heuristic. */
|
|
2774
|
-
horizon:
|
|
2775
|
-
title:
|
|
2776
|
-
rationale:
|
|
2973
|
+
horizon: z22.enum(["immediate", "short-term", "medium-term"]),
|
|
2974
|
+
title: z22.string(),
|
|
2975
|
+
rationale: z22.string()
|
|
2777
2976
|
});
|
|
2778
|
-
var reportRateDeltaSchema =
|
|
2977
|
+
var reportRateDeltaSchema = z22.object({
|
|
2779
2978
|
/** Current value (0..100 for rates, raw count otherwise). When `window`
|
|
2780
2979
|
* is present this is the average over the last `window` checks. */
|
|
2781
|
-
current:
|
|
2980
|
+
current: z22.number(),
|
|
2782
2981
|
/** Prior value compared against. When `window` is present this is the
|
|
2783
2982
|
* average over the prior `window` checks before that. */
|
|
2784
|
-
prior:
|
|
2983
|
+
prior: z22.number(),
|
|
2785
2984
|
/** Absolute delta (current − prior). Negative = decrease. */
|
|
2786
|
-
deltaAbs:
|
|
2985
|
+
deltaAbs: z22.number(),
|
|
2787
2986
|
/**
|
|
2788
2987
|
* Direction tag for tone mapping. Threshold is metric-specific (3pp for
|
|
2789
2988
|
* rates, 0.5 for counts) so small noise lands as 'flat' rather than
|
|
2790
2989
|
* flipping up/down each run.
|
|
2791
2990
|
*/
|
|
2792
|
-
direction:
|
|
2991
|
+
direction: z22.enum(["up", "down", "flat"]),
|
|
2793
2992
|
/**
|
|
2794
2993
|
* How many points went into each side of the average. Omitted (or 1)
|
|
2795
2994
|
* means point-to-point (legacy "since last check"). Higher values mean
|
|
2796
2995
|
* a rolling-average comparison — renderers should label it as
|
|
2797
2996
|
* "vs prior N checks" when this is ≥ 2.
|
|
2798
2997
|
*/
|
|
2799
|
-
window:
|
|
2998
|
+
window: z22.number().optional()
|
|
2800
2999
|
});
|
|
2801
|
-
var reportProviderMovementSchema =
|
|
2802
|
-
provider:
|
|
2803
|
-
current:
|
|
2804
|
-
prior:
|
|
2805
|
-
deltaAbs:
|
|
2806
|
-
direction:
|
|
3000
|
+
var reportProviderMovementSchema = z22.object({
|
|
3001
|
+
provider: z22.string(),
|
|
3002
|
+
current: z22.number(),
|
|
3003
|
+
prior: z22.number(),
|
|
3004
|
+
deltaAbs: z22.number(),
|
|
3005
|
+
direction: z22.enum(["up", "down", "flat"])
|
|
2807
3006
|
});
|
|
2808
|
-
var whatsChangedSectionSchema =
|
|
3007
|
+
var whatsChangedSectionSchema = z22.object({
|
|
2809
3008
|
/**
|
|
2810
3009
|
* False when there's no prior run (or fewer than the trend baseline),
|
|
2811
3010
|
* meaning all per-metric deltas will be null. Renderers use this to swap
|
|
2812
3011
|
* in a "establishing baseline" fallback rather than rendering empty
|
|
2813
3012
|
* delta tiles.
|
|
2814
3013
|
*/
|
|
2815
|
-
enoughHistory:
|
|
3014
|
+
enoughHistory: z22.boolean(),
|
|
2816
3015
|
/**
|
|
2817
3016
|
* One-sentence narrative summary suitable as a section subtitle.
|
|
2818
3017
|
* Always present — even on baseline, narrates whatever signal exists.
|
|
2819
3018
|
*/
|
|
2820
|
-
headline:
|
|
3019
|
+
headline: z22.string(),
|
|
2821
3020
|
/** Citation rate delta vs the prior completed run. Null when no prior run. */
|
|
2822
3021
|
citationRate: reportRateDeltaSchema.nullable(),
|
|
2823
3022
|
/** Mention rate delta vs the prior completed run. Null when no prior run. */
|
|
@@ -2840,24 +3039,24 @@ var whatsChangedSectionSchema = z21.object({
|
|
|
2840
3039
|
* when no prior run. Sorted by |deltaAbs| desc — providers with the
|
|
2841
3040
|
* biggest swing first.
|
|
2842
3041
|
*/
|
|
2843
|
-
providerMovements:
|
|
3042
|
+
providerMovements: z22.array(reportProviderMovementSchema),
|
|
2844
3043
|
/**
|
|
2845
3044
|
* Top wins this period — gains surfaced by the intelligence engine.
|
|
2846
3045
|
* Capped at 5; sourced from `insights` filtered to `type: 'gain'`.
|
|
2847
3046
|
*/
|
|
2848
|
-
wins:
|
|
3047
|
+
wins: z22.array(reportInsightSchema),
|
|
2849
3048
|
/**
|
|
2850
3049
|
* Top regressions this period — citations or mentions lost. Capped at 5;
|
|
2851
3050
|
* sourced from `insights` filtered to `type: 'regression'`.
|
|
2852
3051
|
*/
|
|
2853
|
-
regressions:
|
|
2854
|
-
});
|
|
2855
|
-
var reportAudienceSchema =
|
|
2856
|
-
var reportActionAudienceSchema =
|
|
2857
|
-
var reportActionHorizonSchema =
|
|
2858
|
-
var reportActionConfidenceSchema =
|
|
2859
|
-
var reportToneSchema =
|
|
2860
|
-
var reportActionCategorySchema =
|
|
3052
|
+
regressions: z22.array(reportInsightSchema)
|
|
3053
|
+
});
|
|
3054
|
+
var reportAudienceSchema = z22.enum(["agency", "client"]);
|
|
3055
|
+
var reportActionAudienceSchema = z22.enum(["agency", "client", "both"]);
|
|
3056
|
+
var reportActionHorizonSchema = z22.enum(["immediate", "short-term", "medium-term"]);
|
|
3057
|
+
var reportActionConfidenceSchema = z22.enum(["high", "medium", "low"]);
|
|
3058
|
+
var reportToneSchema = z22.enum(["positive", "caution", "negative", "neutral"]);
|
|
3059
|
+
var reportActionCategorySchema = z22.enum([
|
|
2861
3060
|
"content",
|
|
2862
3061
|
"competitors",
|
|
2863
3062
|
"provider",
|
|
@@ -2866,23 +3065,23 @@ var reportActionCategorySchema = z21.enum([
|
|
|
2866
3065
|
"location",
|
|
2867
3066
|
"monitoring"
|
|
2868
3067
|
]);
|
|
2869
|
-
var reportActionPlanItemSchema =
|
|
3068
|
+
var reportActionPlanItemSchema = z22.object({
|
|
2870
3069
|
/** Which report audience should see this action. `both` renders in both modes. */
|
|
2871
3070
|
audience: reportActionAudienceSchema,
|
|
2872
3071
|
/** Stable sort priority. Lower numbers render earlier. */
|
|
2873
|
-
priority:
|
|
3072
|
+
priority: z22.number(),
|
|
2874
3073
|
/** When this should be tackled. */
|
|
2875
3074
|
horizon: reportActionHorizonSchema,
|
|
2876
3075
|
category: reportActionCategorySchema,
|
|
2877
|
-
title:
|
|
3076
|
+
title: z22.string(),
|
|
2878
3077
|
/** Direct next step written as an operator/client-friendly imperative. */
|
|
2879
|
-
action:
|
|
3078
|
+
action: z22.string(),
|
|
2880
3079
|
/** Why this matters. Keep each entry concise and evidence-backed. */
|
|
2881
|
-
why:
|
|
3080
|
+
why: z22.array(z22.string()),
|
|
2882
3081
|
/** Specific observations that justify the action. */
|
|
2883
|
-
evidence:
|
|
3082
|
+
evidence: z22.array(z22.string()),
|
|
2884
3083
|
/** What should move if the action worked. */
|
|
2885
|
-
successMetric:
|
|
3084
|
+
successMetric: z22.string(),
|
|
2886
3085
|
/** Confidence in the recommendation based on the available evidence. */
|
|
2887
3086
|
confidence: reportActionConfidenceSchema,
|
|
2888
3087
|
/**
|
|
@@ -2894,23 +3093,23 @@ var reportActionPlanItemSchema = z21.object({
|
|
|
2894
3093
|
* load. Actions sourced from other signals (competitor gaps, indexing
|
|
2895
3094
|
* issues, etc.) omit this and use their own dismiss flows.
|
|
2896
3095
|
*/
|
|
2897
|
-
targetRef:
|
|
3096
|
+
targetRef: z22.string().optional()
|
|
2898
3097
|
});
|
|
2899
|
-
var reportClientSummarySchema =
|
|
2900
|
-
headline:
|
|
2901
|
-
overview:
|
|
2902
|
-
actionItems:
|
|
2903
|
-
confidenceNotes:
|
|
3098
|
+
var reportClientSummarySchema = z22.object({
|
|
3099
|
+
headline: z22.string(),
|
|
3100
|
+
overview: z22.string(),
|
|
3101
|
+
actionItems: z22.array(reportActionPlanItemSchema),
|
|
3102
|
+
confidenceNotes: z22.array(z22.string())
|
|
2904
3103
|
});
|
|
2905
|
-
var reportAgencyDiagnosticSchema =
|
|
2906
|
-
title:
|
|
2907
|
-
detail:
|
|
2908
|
-
severity:
|
|
2909
|
-
evidence:
|
|
3104
|
+
var reportAgencyDiagnosticSchema = z22.object({
|
|
3105
|
+
title: z22.string(),
|
|
3106
|
+
detail: z22.string(),
|
|
3107
|
+
severity: z22.enum(["positive", "caution", "negative", "neutral"]),
|
|
3108
|
+
evidence: z22.array(z22.string())
|
|
2910
3109
|
});
|
|
2911
|
-
var reportAgencyDiagnosticsSchema =
|
|
2912
|
-
priorities:
|
|
2913
|
-
diagnostics:
|
|
3110
|
+
var reportAgencyDiagnosticsSchema = z22.object({
|
|
3111
|
+
priorities: z22.array(reportActionPlanItemSchema),
|
|
3112
|
+
diagnostics: z22.array(reportAgencyDiagnosticSchema)
|
|
2914
3113
|
});
|
|
2915
3114
|
function reportActionTone(action) {
|
|
2916
3115
|
if (action.horizon === "immediate") return "negative";
|
|
@@ -2968,7 +3167,7 @@ function reportConfidenceLabel(confidence) {
|
|
|
2968
3167
|
return "Low";
|
|
2969
3168
|
}
|
|
2970
3169
|
}
|
|
2971
|
-
var projectReportDtoSchema =
|
|
3170
|
+
var projectReportDtoSchema = z22.object({
|
|
2972
3171
|
meta: reportMetaSchema,
|
|
2973
3172
|
executiveSummary: reportExecutiveSummarySchema,
|
|
2974
3173
|
citationScorecard: citationScorecardSchema,
|
|
@@ -2982,16 +3181,16 @@ var projectReportDtoSchema = z21.object({
|
|
|
2982
3181
|
/** Server-side log-evidence visibility (crawls + click-through sessions). Null when no traffic source connected. */
|
|
2983
3182
|
serverActivity: serverActivitySectionSchema.nullable(),
|
|
2984
3183
|
indexingHealth: indexingHealthSectionSchema.nullable(),
|
|
2985
|
-
citationsTrend:
|
|
3184
|
+
citationsTrend: z22.array(citationsTrendPointSchema),
|
|
2986
3185
|
/**
|
|
2987
3186
|
* Trend-focused "what's changed" summary for the report's act 2. Always
|
|
2988
3187
|
* present; renderers gate empty/baseline states via `enoughHistory`.
|
|
2989
3188
|
*/
|
|
2990
3189
|
whatsChanged: whatsChangedSectionSchema,
|
|
2991
|
-
insights:
|
|
2992
|
-
recommendedNextSteps:
|
|
3190
|
+
insights: z22.array(reportInsightSchema),
|
|
3191
|
+
recommendedNextSteps: z22.array(recommendedNextStepSchema),
|
|
2993
3192
|
/** Canonical structured actions shared by the client and agency render modes. */
|
|
2994
|
-
actionPlan:
|
|
3193
|
+
actionPlan: z22.array(reportActionPlanItemSchema),
|
|
2995
3194
|
/** Polished client-facing summary and action shortlist. */
|
|
2996
3195
|
clientSummary: reportClientSummarySchema,
|
|
2997
3196
|
/** Technical, evidence-oriented operator diagnostics for agency mode. */
|
|
@@ -3001,17 +3200,17 @@ var projectReportDtoSchema = z21.object({
|
|
|
3001
3200
|
* intelligence layer (`buildContentTargetRows`). Empty when no run has
|
|
3002
3201
|
* produced candidate queries with demand or competitor signal.
|
|
3003
3202
|
*/
|
|
3004
|
-
contentOpportunities:
|
|
3203
|
+
contentOpportunities: z22.array(contentTargetRowDtoSchema),
|
|
3005
3204
|
/**
|
|
3006
3205
|
* Queries where competitors were cited but the project was not. Sourced
|
|
3007
3206
|
* from `buildContentGapRows`. Empty until the first answer-visibility run.
|
|
3008
3207
|
*/
|
|
3009
|
-
contentGaps:
|
|
3208
|
+
contentGaps: z22.array(contentGapRowDtoSchema),
|
|
3010
3209
|
/**
|
|
3011
3210
|
* Per-query grounding source map (own + competitor cited URLs). Sourced
|
|
3012
3211
|
* from `buildContentSourceRows`. Empty until the first answer-visibility run.
|
|
3013
3212
|
*/
|
|
3014
|
-
groundingSources:
|
|
3213
|
+
groundingSources: z22.array(contentSourceRowDtoSchema)
|
|
3015
3214
|
});
|
|
3016
3215
|
|
|
3017
3216
|
// ../contracts/src/report-dedup.ts
|
|
@@ -3082,15 +3281,29 @@ function dedupeReportOpportunities(report) {
|
|
|
3082
3281
|
}
|
|
3083
3282
|
|
|
3084
3283
|
// ../contracts/src/skills.ts
|
|
3085
|
-
import { z as
|
|
3086
|
-
var codingAgentSchema =
|
|
3284
|
+
import { z as z23 } from "zod";
|
|
3285
|
+
var codingAgentSchema = z23.enum(["claude", "codex"]);
|
|
3087
3286
|
var CodingAgents = codingAgentSchema.enum;
|
|
3088
|
-
var skillsClientSchema =
|
|
3287
|
+
var skillsClientSchema = z23.enum(["claude", "codex", "all"]);
|
|
3089
3288
|
var SkillsClients = skillsClientSchema.enum;
|
|
3289
|
+
var SKILL_MANIFEST_FILENAME = ".canonry-skill-manifest.json";
|
|
3290
|
+
function classifySkillFile(params) {
|
|
3291
|
+
const { bundledHash, installedHash, manifestHash } = params;
|
|
3292
|
+
if (installedHash == null) return "missing";
|
|
3293
|
+
if (installedHash === bundledHash) return "unchanged";
|
|
3294
|
+
if (manifestHash != null && installedHash === manifestHash) return "stale";
|
|
3295
|
+
return "edited";
|
|
3296
|
+
}
|
|
3297
|
+
function coerceSkillManifest(parsed) {
|
|
3298
|
+
if (parsed != null && typeof parsed === "object" && typeof parsed.files === "object" && parsed.files !== null) {
|
|
3299
|
+
return parsed;
|
|
3300
|
+
}
|
|
3301
|
+
return null;
|
|
3302
|
+
}
|
|
3090
3303
|
|
|
3091
3304
|
// ../contracts/src/traffic.ts
|
|
3092
|
-
import { z as
|
|
3093
|
-
var trafficSourceTypeSchema =
|
|
3305
|
+
import { z as z24 } from "zod";
|
|
3306
|
+
var trafficSourceTypeSchema = z24.enum([
|
|
3094
3307
|
"cloud-run",
|
|
3095
3308
|
"wordpress",
|
|
3096
3309
|
"cloudflare",
|
|
@@ -3098,7 +3311,7 @@ var trafficSourceTypeSchema = z23.enum([
|
|
|
3098
3311
|
"generic-log"
|
|
3099
3312
|
]);
|
|
3100
3313
|
var TrafficSourceTypes = trafficSourceTypeSchema.enum;
|
|
3101
|
-
var trafficAdapterCapabilitySchema =
|
|
3314
|
+
var trafficAdapterCapabilitySchema = z24.enum([
|
|
3102
3315
|
"raw-request-events",
|
|
3103
3316
|
"aggregate-request-metrics",
|
|
3104
3317
|
"request-url",
|
|
@@ -3109,217 +3322,217 @@ var trafficAdapterCapabilitySchema = z23.enum([
|
|
|
3109
3322
|
"cursor-pull"
|
|
3110
3323
|
]);
|
|
3111
3324
|
var TrafficAdapterCapabilities = trafficAdapterCapabilitySchema.enum;
|
|
3112
|
-
var trafficEvidenceKindSchema =
|
|
3325
|
+
var trafficEvidenceKindSchema = z24.enum(["raw-request", "aggregate-bucket"]);
|
|
3113
3326
|
var TrafficEvidenceKinds = trafficEvidenceKindSchema.enum;
|
|
3114
|
-
var trafficEventConfidenceSchema =
|
|
3327
|
+
var trafficEventConfidenceSchema = z24.enum(["observed", "provider-aggregated", "inferred"]);
|
|
3115
3328
|
var TrafficEventConfidences = trafficEventConfidenceSchema.enum;
|
|
3116
|
-
var trafficProviderResourceSchema =
|
|
3117
|
-
type:
|
|
3118
|
-
labels:
|
|
3329
|
+
var trafficProviderResourceSchema = z24.object({
|
|
3330
|
+
type: z24.string().nullable(),
|
|
3331
|
+
labels: z24.record(z24.string(), z24.string())
|
|
3119
3332
|
});
|
|
3120
|
-
var normalizedTrafficRequestSchema =
|
|
3333
|
+
var normalizedTrafficRequestSchema = z24.object({
|
|
3121
3334
|
sourceType: trafficSourceTypeSchema,
|
|
3122
|
-
evidenceKind:
|
|
3123
|
-
confidence:
|
|
3124
|
-
eventId:
|
|
3125
|
-
observedAt:
|
|
3126
|
-
method:
|
|
3127
|
-
requestUrl:
|
|
3128
|
-
host:
|
|
3129
|
-
path:
|
|
3130
|
-
queryString:
|
|
3131
|
-
status:
|
|
3132
|
-
userAgent:
|
|
3133
|
-
remoteIp:
|
|
3134
|
-
referer:
|
|
3135
|
-
latencyMs:
|
|
3136
|
-
requestSizeBytes:
|
|
3137
|
-
responseSizeBytes:
|
|
3335
|
+
evidenceKind: z24.literal(TrafficEvidenceKinds["raw-request"]),
|
|
3336
|
+
confidence: z24.literal(TrafficEventConfidences.observed),
|
|
3337
|
+
eventId: z24.string().min(1),
|
|
3338
|
+
observedAt: z24.string().min(1),
|
|
3339
|
+
method: z24.string().nullable(),
|
|
3340
|
+
requestUrl: z24.string().nullable(),
|
|
3341
|
+
host: z24.string().nullable(),
|
|
3342
|
+
path: z24.string().min(1),
|
|
3343
|
+
queryString: z24.string().nullable(),
|
|
3344
|
+
status: z24.number().int().nullable(),
|
|
3345
|
+
userAgent: z24.string().nullable(),
|
|
3346
|
+
remoteIp: z24.string().nullable(),
|
|
3347
|
+
referer: z24.string().nullable(),
|
|
3348
|
+
latencyMs: z24.number().nullable(),
|
|
3349
|
+
requestSizeBytes: z24.number().int().nullable(),
|
|
3350
|
+
responseSizeBytes: z24.number().int().nullable(),
|
|
3138
3351
|
providerResource: trafficProviderResourceSchema,
|
|
3139
|
-
providerLabels:
|
|
3352
|
+
providerLabels: z24.record(z24.string(), z24.string())
|
|
3140
3353
|
});
|
|
3141
|
-
var normalizedTrafficPullPageSchema =
|
|
3142
|
-
events:
|
|
3143
|
-
rawEntryCount:
|
|
3144
|
-
skippedEntryCount:
|
|
3145
|
-
nextPageToken:
|
|
3146
|
-
filter:
|
|
3354
|
+
var normalizedTrafficPullPageSchema = z24.object({
|
|
3355
|
+
events: z24.array(normalizedTrafficRequestSchema),
|
|
3356
|
+
rawEntryCount: z24.number().int().nonnegative(),
|
|
3357
|
+
skippedEntryCount: z24.number().int().nonnegative(),
|
|
3358
|
+
nextPageToken: z24.string().optional(),
|
|
3359
|
+
filter: z24.string()
|
|
3147
3360
|
});
|
|
3148
|
-
var trafficSourceStatusSchema =
|
|
3361
|
+
var trafficSourceStatusSchema = z24.enum(["connected", "paused", "error", "archived"]);
|
|
3149
3362
|
var TrafficSourceStatuses = trafficSourceStatusSchema.enum;
|
|
3150
|
-
var trafficSourceAuthModeSchema =
|
|
3363
|
+
var trafficSourceAuthModeSchema = z24.enum(["oauth", "service-account"]);
|
|
3151
3364
|
var TrafficSourceAuthModes = trafficSourceAuthModeSchema.enum;
|
|
3152
|
-
var verificationStatusSchema =
|
|
3365
|
+
var verificationStatusSchema = z24.enum(["verified", "claimed_unverified", "unknown_ai_like"]);
|
|
3153
3366
|
var VerificationStatuses = verificationStatusSchema.enum;
|
|
3154
|
-
var cloudRunSourceConfigSchema =
|
|
3155
|
-
gcpProjectId:
|
|
3156
|
-
serviceName:
|
|
3157
|
-
location:
|
|
3367
|
+
var cloudRunSourceConfigSchema = z24.object({
|
|
3368
|
+
gcpProjectId: z24.string().min(1),
|
|
3369
|
+
serviceName: z24.string().nullable().optional(),
|
|
3370
|
+
location: z24.string().nullable().optional(),
|
|
3158
3371
|
authMode: trafficSourceAuthModeSchema
|
|
3159
3372
|
});
|
|
3160
|
-
var wordpressTrafficSourceConfigSchema =
|
|
3161
|
-
baseUrl:
|
|
3162
|
-
username:
|
|
3373
|
+
var wordpressTrafficSourceConfigSchema = z24.object({
|
|
3374
|
+
baseUrl: z24.string().url(),
|
|
3375
|
+
username: z24.string().min(1)
|
|
3163
3376
|
});
|
|
3164
|
-
var vercelTrafficEnvironmentSchema =
|
|
3377
|
+
var vercelTrafficEnvironmentSchema = z24.enum(["production", "preview"]);
|
|
3165
3378
|
var VercelTrafficEnvironments = vercelTrafficEnvironmentSchema.enum;
|
|
3166
|
-
var vercelTrafficSourceConfigSchema =
|
|
3379
|
+
var vercelTrafficSourceConfigSchema = z24.object({
|
|
3167
3380
|
/** Vercel project id (e.g. `prj_...`). */
|
|
3168
|
-
projectId:
|
|
3381
|
+
projectId: z24.string().min(1),
|
|
3169
3382
|
/** Vercel team or account id: the org that owns the project. */
|
|
3170
|
-
teamId:
|
|
3383
|
+
teamId: z24.string().min(1),
|
|
3171
3384
|
environment: vercelTrafficEnvironmentSchema
|
|
3172
3385
|
});
|
|
3173
|
-
var trafficSourceDtoSchema =
|
|
3174
|
-
id:
|
|
3175
|
-
projectId:
|
|
3386
|
+
var trafficSourceDtoSchema = z24.object({
|
|
3387
|
+
id: z24.string(),
|
|
3388
|
+
projectId: z24.string(),
|
|
3176
3389
|
sourceType: trafficSourceTypeSchema,
|
|
3177
|
-
displayName:
|
|
3390
|
+
displayName: z24.string(),
|
|
3178
3391
|
status: trafficSourceStatusSchema,
|
|
3179
|
-
lastSyncedAt:
|
|
3180
|
-
lastCursor:
|
|
3181
|
-
lastError:
|
|
3182
|
-
archivedAt:
|
|
3183
|
-
config:
|
|
3184
|
-
createdAt:
|
|
3185
|
-
updatedAt:
|
|
3186
|
-
});
|
|
3187
|
-
var trafficConnectCloudRunRequestSchema =
|
|
3188
|
-
gcpProjectId:
|
|
3189
|
-
serviceName:
|
|
3190
|
-
location:
|
|
3191
|
-
displayName:
|
|
3392
|
+
lastSyncedAt: z24.string().nullable(),
|
|
3393
|
+
lastCursor: z24.string().nullable(),
|
|
3394
|
+
lastError: z24.string().nullable(),
|
|
3395
|
+
archivedAt: z24.string().nullable(),
|
|
3396
|
+
config: z24.record(z24.string(), z24.unknown()),
|
|
3397
|
+
createdAt: z24.string(),
|
|
3398
|
+
updatedAt: z24.string()
|
|
3399
|
+
});
|
|
3400
|
+
var trafficConnectCloudRunRequestSchema = z24.object({
|
|
3401
|
+
gcpProjectId: z24.string().min(1),
|
|
3402
|
+
serviceName: z24.string().min(1).optional(),
|
|
3403
|
+
location: z24.string().min(1).optional(),
|
|
3404
|
+
displayName: z24.string().min(1).optional(),
|
|
3192
3405
|
/** Service-account JSON content (string). When omitted, defaults to OAuth via `canonry google connect <project> --type ga4` flow. */
|
|
3193
|
-
keyJson:
|
|
3406
|
+
keyJson: z24.string().optional()
|
|
3194
3407
|
});
|
|
3195
|
-
var trafficConnectWordpressRequestSchema =
|
|
3196
|
-
baseUrl:
|
|
3197
|
-
username:
|
|
3408
|
+
var trafficConnectWordpressRequestSchema = z24.object({
|
|
3409
|
+
baseUrl: z24.string().url(),
|
|
3410
|
+
username: z24.string().min(1),
|
|
3198
3411
|
/** WordPress Application Password (the same auth used by the content client). */
|
|
3199
|
-
applicationPassword:
|
|
3200
|
-
displayName:
|
|
3412
|
+
applicationPassword: z24.string().min(1),
|
|
3413
|
+
displayName: z24.string().min(1).optional()
|
|
3201
3414
|
});
|
|
3202
|
-
var trafficConnectVercelRequestSchema =
|
|
3415
|
+
var trafficConnectVercelRequestSchema = z24.object({
|
|
3203
3416
|
/** Vercel project id (e.g. `prj_...`) — from the Vercel dashboard or `.vercel/project.json`. */
|
|
3204
|
-
projectId:
|
|
3417
|
+
projectId: z24.string().min(1),
|
|
3205
3418
|
/** Vercel team or account id: the org that owns the project ("orgId" in .vercel/project.json). */
|
|
3206
|
-
teamId:
|
|
3419
|
+
teamId: z24.string().min(1),
|
|
3207
3420
|
/** Vercel personal access token. Stored in `~/.canonry/config.yaml`, never the DB. */
|
|
3208
|
-
token:
|
|
3421
|
+
token: z24.string().min(1),
|
|
3209
3422
|
/** Which deployment environment's request logs to pull. Default: `production`. */
|
|
3210
3423
|
environment: vercelTrafficEnvironmentSchema.optional(),
|
|
3211
|
-
displayName:
|
|
3212
|
-
});
|
|
3213
|
-
var trafficSyncResponseSchema =
|
|
3214
|
-
sourceId:
|
|
3215
|
-
runId:
|
|
3216
|
-
syncedAt:
|
|
3217
|
-
pulledEvents:
|
|
3218
|
-
crawlerHits:
|
|
3219
|
-
aiUserFetchHits:
|
|
3220
|
-
aiReferralHits:
|
|
3221
|
-
unknownHits:
|
|
3222
|
-
crawlerBucketRows:
|
|
3223
|
-
aiUserFetchBucketRows:
|
|
3224
|
-
aiReferralBucketRows:
|
|
3225
|
-
sampleRows:
|
|
3226
|
-
windowStart:
|
|
3227
|
-
windowEnd:
|
|
3228
|
-
});
|
|
3229
|
-
var trafficBackfillRequestSchema =
|
|
3424
|
+
displayName: z24.string().min(1).optional()
|
|
3425
|
+
});
|
|
3426
|
+
var trafficSyncResponseSchema = z24.object({
|
|
3427
|
+
sourceId: z24.string(),
|
|
3428
|
+
runId: z24.string(),
|
|
3429
|
+
syncedAt: z24.string(),
|
|
3430
|
+
pulledEvents: z24.number().int().nonnegative(),
|
|
3431
|
+
crawlerHits: z24.number().int().nonnegative(),
|
|
3432
|
+
aiUserFetchHits: z24.number().int().nonnegative(),
|
|
3433
|
+
aiReferralHits: z24.number().int().nonnegative(),
|
|
3434
|
+
unknownHits: z24.number().int().nonnegative(),
|
|
3435
|
+
crawlerBucketRows: z24.number().int().nonnegative(),
|
|
3436
|
+
aiUserFetchBucketRows: z24.number().int().nonnegative(),
|
|
3437
|
+
aiReferralBucketRows: z24.number().int().nonnegative(),
|
|
3438
|
+
sampleRows: z24.number().int().nonnegative(),
|
|
3439
|
+
windowStart: z24.string(),
|
|
3440
|
+
windowEnd: z24.string()
|
|
3441
|
+
});
|
|
3442
|
+
var trafficBackfillRequestSchema = z24.object({
|
|
3230
3443
|
/** Lookback window in days. Capped server-side at the upstream log retention ceiling (Cloud Logging _Default = 30d). Default: 30. */
|
|
3231
|
-
days:
|
|
3444
|
+
days: z24.number().int().positive().optional()
|
|
3232
3445
|
});
|
|
3233
|
-
var trafficResetRequestSchema =
|
|
3234
|
-
advanceToNow:
|
|
3446
|
+
var trafficResetRequestSchema = z24.object({
|
|
3447
|
+
advanceToNow: z24.literal(true)
|
|
3235
3448
|
});
|
|
3236
|
-
var trafficBackfillResponseSchema =
|
|
3237
|
-
sourceId:
|
|
3238
|
-
runId:
|
|
3449
|
+
var trafficBackfillResponseSchema = z24.object({
|
|
3450
|
+
sourceId: z24.string(),
|
|
3451
|
+
runId: z24.string(),
|
|
3239
3452
|
status: runStatusSchema,
|
|
3240
|
-
windowStart:
|
|
3241
|
-
windowEnd:
|
|
3453
|
+
windowStart: z24.string(),
|
|
3454
|
+
windowEnd: z24.string(),
|
|
3242
3455
|
/** Days actually used after server-side clamping (≤ requested). */
|
|
3243
|
-
daysRequested:
|
|
3244
|
-
daysApplied:
|
|
3456
|
+
daysRequested: z24.number().int().positive(),
|
|
3457
|
+
daysApplied: z24.number().int().positive()
|
|
3245
3458
|
});
|
|
3246
|
-
var trafficSourceTotalsSchema =
|
|
3247
|
-
crawlerHits:
|
|
3248
|
-
aiUserFetchHits:
|
|
3249
|
-
aiReferralHits:
|
|
3250
|
-
sampleCount:
|
|
3459
|
+
var trafficSourceTotalsSchema = z24.object({
|
|
3460
|
+
crawlerHits: z24.number().int().nonnegative(),
|
|
3461
|
+
aiUserFetchHits: z24.number().int().nonnegative(),
|
|
3462
|
+
aiReferralHits: z24.number().int().nonnegative(),
|
|
3463
|
+
sampleCount: z24.number().int().nonnegative()
|
|
3251
3464
|
});
|
|
3252
|
-
var trafficSourceListResponseSchema =
|
|
3253
|
-
sources:
|
|
3465
|
+
var trafficSourceListResponseSchema = z24.object({
|
|
3466
|
+
sources: z24.array(trafficSourceDtoSchema)
|
|
3254
3467
|
});
|
|
3255
3468
|
var trafficSourceDetailDtoSchema = trafficSourceDtoSchema.extend({
|
|
3256
3469
|
totals24h: trafficSourceTotalsSchema,
|
|
3257
|
-
latestRun:
|
|
3258
|
-
runId:
|
|
3470
|
+
latestRun: z24.object({
|
|
3471
|
+
runId: z24.string(),
|
|
3259
3472
|
status: runStatusSchema,
|
|
3260
|
-
startedAt:
|
|
3261
|
-
finishedAt:
|
|
3262
|
-
error:
|
|
3473
|
+
startedAt: z24.string().nullable(),
|
|
3474
|
+
finishedAt: z24.string().nullable(),
|
|
3475
|
+
error: z24.string().nullable()
|
|
3263
3476
|
}).nullable()
|
|
3264
3477
|
});
|
|
3265
|
-
var trafficStatusResponseSchema =
|
|
3266
|
-
sources:
|
|
3478
|
+
var trafficStatusResponseSchema = z24.object({
|
|
3479
|
+
sources: z24.array(trafficSourceDetailDtoSchema)
|
|
3267
3480
|
});
|
|
3268
|
-
var trafficEventKindSchema =
|
|
3481
|
+
var trafficEventKindSchema = z24.enum(["crawler", "ai-user-fetch", "ai-referral"]);
|
|
3269
3482
|
var TrafficEventKinds = trafficEventKindSchema.enum;
|
|
3270
|
-
var trafficCrawlerEventEntrySchema =
|
|
3271
|
-
kind:
|
|
3272
|
-
sourceId:
|
|
3273
|
-
tsHour:
|
|
3274
|
-
botId:
|
|
3275
|
-
operator:
|
|
3276
|
-
verificationStatus:
|
|
3277
|
-
pathNormalized:
|
|
3278
|
-
status:
|
|
3279
|
-
hits:
|
|
3280
|
-
});
|
|
3281
|
-
var trafficAiUserFetchEventEntrySchema =
|
|
3282
|
-
kind:
|
|
3283
|
-
sourceId:
|
|
3284
|
-
tsHour:
|
|
3285
|
-
botId:
|
|
3286
|
-
operator:
|
|
3287
|
-
verificationStatus:
|
|
3288
|
-
pathNormalized:
|
|
3289
|
-
status:
|
|
3290
|
-
hits:
|
|
3291
|
-
});
|
|
3292
|
-
var trafficAiReferralEventEntrySchema =
|
|
3293
|
-
kind:
|
|
3294
|
-
sourceId:
|
|
3295
|
-
tsHour:
|
|
3296
|
-
product:
|
|
3297
|
-
operator:
|
|
3298
|
-
sourceDomain:
|
|
3299
|
-
evidenceType:
|
|
3300
|
-
landingPathNormalized:
|
|
3301
|
-
status:
|
|
3302
|
-
hits:
|
|
3303
|
-
});
|
|
3304
|
-
var trafficEventEntrySchema =
|
|
3483
|
+
var trafficCrawlerEventEntrySchema = z24.object({
|
|
3484
|
+
kind: z24.literal(TrafficEventKinds.crawler),
|
|
3485
|
+
sourceId: z24.string(),
|
|
3486
|
+
tsHour: z24.string(),
|
|
3487
|
+
botId: z24.string(),
|
|
3488
|
+
operator: z24.string(),
|
|
3489
|
+
verificationStatus: z24.string(),
|
|
3490
|
+
pathNormalized: z24.string(),
|
|
3491
|
+
status: z24.number().int(),
|
|
3492
|
+
hits: z24.number().int().nonnegative()
|
|
3493
|
+
});
|
|
3494
|
+
var trafficAiUserFetchEventEntrySchema = z24.object({
|
|
3495
|
+
kind: z24.literal(TrafficEventKinds["ai-user-fetch"]),
|
|
3496
|
+
sourceId: z24.string(),
|
|
3497
|
+
tsHour: z24.string(),
|
|
3498
|
+
botId: z24.string(),
|
|
3499
|
+
operator: z24.string(),
|
|
3500
|
+
verificationStatus: z24.string(),
|
|
3501
|
+
pathNormalized: z24.string(),
|
|
3502
|
+
status: z24.number().int(),
|
|
3503
|
+
hits: z24.number().int().nonnegative()
|
|
3504
|
+
});
|
|
3505
|
+
var trafficAiReferralEventEntrySchema = z24.object({
|
|
3506
|
+
kind: z24.literal(TrafficEventKinds["ai-referral"]),
|
|
3507
|
+
sourceId: z24.string(),
|
|
3508
|
+
tsHour: z24.string(),
|
|
3509
|
+
product: z24.string(),
|
|
3510
|
+
operator: z24.string(),
|
|
3511
|
+
sourceDomain: z24.string(),
|
|
3512
|
+
evidenceType: z24.string(),
|
|
3513
|
+
landingPathNormalized: z24.string(),
|
|
3514
|
+
status: z24.number().int(),
|
|
3515
|
+
hits: z24.number().int().nonnegative()
|
|
3516
|
+
});
|
|
3517
|
+
var trafficEventEntrySchema = z24.discriminatedUnion("kind", [
|
|
3305
3518
|
trafficCrawlerEventEntrySchema,
|
|
3306
3519
|
trafficAiUserFetchEventEntrySchema,
|
|
3307
3520
|
trafficAiReferralEventEntrySchema
|
|
3308
3521
|
]);
|
|
3309
|
-
var trafficEventsResponseSchema =
|
|
3310
|
-
windowStart:
|
|
3311
|
-
windowEnd:
|
|
3312
|
-
totals:
|
|
3313
|
-
crawlerHits:
|
|
3314
|
-
aiUserFetchHits:
|
|
3315
|
-
aiReferralHits:
|
|
3522
|
+
var trafficEventsResponseSchema = z24.object({
|
|
3523
|
+
windowStart: z24.string(),
|
|
3524
|
+
windowEnd: z24.string(),
|
|
3525
|
+
totals: z24.object({
|
|
3526
|
+
crawlerHits: z24.number().int().nonnegative(),
|
|
3527
|
+
aiUserFetchHits: z24.number().int().nonnegative(),
|
|
3528
|
+
aiReferralHits: z24.number().int().nonnegative()
|
|
3316
3529
|
}),
|
|
3317
|
-
events:
|
|
3530
|
+
events: z24.array(trafficEventEntrySchema)
|
|
3318
3531
|
});
|
|
3319
3532
|
|
|
3320
3533
|
// ../contracts/src/discovery.ts
|
|
3321
|
-
import { z as
|
|
3322
|
-
var discoveryBucketSchema =
|
|
3534
|
+
import { z as z25 } from "zod";
|
|
3535
|
+
var discoveryBucketSchema = z25.enum(["cited", "aspirational", "wasted-surface"]);
|
|
3323
3536
|
var DiscoveryBuckets = discoveryBucketSchema.enum;
|
|
3324
3537
|
var DEFAULT_DISCOVERY_PROMOTE_BUCKETS = [
|
|
3325
3538
|
DiscoveryBuckets.cited,
|
|
@@ -3327,7 +3540,7 @@ var DEFAULT_DISCOVERY_PROMOTE_BUCKETS = [
|
|
|
3327
3540
|
];
|
|
3328
3541
|
var DISCOVERY_PROMOTE_COMPETITOR_CAP = 20;
|
|
3329
3542
|
var DISCOVERY_PROMOTE_COMPETITOR_MIN_HITS = 2;
|
|
3330
|
-
var discoveryCompetitorTypeSchema =
|
|
3543
|
+
var discoveryCompetitorTypeSchema = z25.enum([
|
|
3331
3544
|
"direct-competitor",
|
|
3332
3545
|
"ota-aggregator",
|
|
3333
3546
|
"editorial-media",
|
|
@@ -3338,11 +3551,11 @@ var DiscoveryCompetitorTypes = discoveryCompetitorTypeSchema.enum;
|
|
|
3338
3551
|
var DEFAULT_DISCOVERY_PROMOTE_COMPETITOR_TYPES = [
|
|
3339
3552
|
DiscoveryCompetitorTypes["direct-competitor"]
|
|
3340
3553
|
];
|
|
3341
|
-
var discoverySessionStatusSchema =
|
|
3554
|
+
var discoverySessionStatusSchema = z25.enum(["queued", "seeding", "probing", "completed", "failed"]);
|
|
3342
3555
|
var DiscoverySessionStatuses = discoverySessionStatusSchema.enum;
|
|
3343
|
-
var discoveryCompetitorMapEntrySchema =
|
|
3344
|
-
domain:
|
|
3345
|
-
hits:
|
|
3556
|
+
var discoveryCompetitorMapEntrySchema = z25.object({
|
|
3557
|
+
domain: z25.string().min(1),
|
|
3558
|
+
hits: z25.number().int().positive(),
|
|
3346
3559
|
/**
|
|
3347
3560
|
* Domain classification from the session's post-probe AI classification
|
|
3348
3561
|
* pass. Defaults to `unknown` so competitor maps persisted before
|
|
@@ -3351,43 +3564,43 @@ var discoveryCompetitorMapEntrySchema = z24.object({
|
|
|
3351
3564
|
*/
|
|
3352
3565
|
competitorType: discoveryCompetitorTypeSchema.default("unknown")
|
|
3353
3566
|
});
|
|
3354
|
-
var discoveryProbeDtoSchema =
|
|
3355
|
-
id:
|
|
3356
|
-
sessionId:
|
|
3357
|
-
projectId:
|
|
3358
|
-
query:
|
|
3567
|
+
var discoveryProbeDtoSchema = z25.object({
|
|
3568
|
+
id: z25.string(),
|
|
3569
|
+
sessionId: z25.string(),
|
|
3570
|
+
projectId: z25.string(),
|
|
3571
|
+
query: z25.string(),
|
|
3359
3572
|
bucket: discoveryBucketSchema.nullable().default(null),
|
|
3360
3573
|
citationState: citationStateSchema,
|
|
3361
|
-
citedDomains:
|
|
3362
|
-
createdAt:
|
|
3574
|
+
citedDomains: z25.array(z25.string()).default([]),
|
|
3575
|
+
createdAt: z25.string()
|
|
3363
3576
|
});
|
|
3364
|
-
var discoverySessionDtoSchema =
|
|
3365
|
-
id:
|
|
3366
|
-
projectId:
|
|
3577
|
+
var discoverySessionDtoSchema = z25.object({
|
|
3578
|
+
id: z25.string(),
|
|
3579
|
+
projectId: z25.string(),
|
|
3367
3580
|
status: discoverySessionStatusSchema,
|
|
3368
|
-
icpDescription:
|
|
3369
|
-
seedProvider:
|
|
3370
|
-
seedCountRaw:
|
|
3371
|
-
seedCount:
|
|
3372
|
-
dedupThreshold:
|
|
3373
|
-
probeCount:
|
|
3374
|
-
citedCount:
|
|
3375
|
-
aspirationalCount:
|
|
3376
|
-
wastedCount:
|
|
3377
|
-
competitorMap:
|
|
3378
|
-
error:
|
|
3379
|
-
startedAt:
|
|
3380
|
-
finishedAt:
|
|
3381
|
-
createdAt:
|
|
3581
|
+
icpDescription: z25.string().nullable().optional(),
|
|
3582
|
+
seedProvider: z25.string().nullable().optional(),
|
|
3583
|
+
seedCountRaw: z25.number().int().nullable().optional(),
|
|
3584
|
+
seedCount: z25.number().int().nullable().optional(),
|
|
3585
|
+
dedupThreshold: z25.number().nullable().optional(),
|
|
3586
|
+
probeCount: z25.number().int().nullable().optional(),
|
|
3587
|
+
citedCount: z25.number().int().nullable().default(null),
|
|
3588
|
+
aspirationalCount: z25.number().int().nullable().default(null),
|
|
3589
|
+
wastedCount: z25.number().int().nullable().default(null),
|
|
3590
|
+
competitorMap: z25.array(discoveryCompetitorMapEntrySchema).default([]),
|
|
3591
|
+
error: z25.string().nullable().optional(),
|
|
3592
|
+
startedAt: z25.string().nullable().optional(),
|
|
3593
|
+
finishedAt: z25.string().nullable().optional(),
|
|
3594
|
+
createdAt: z25.string()
|
|
3382
3595
|
});
|
|
3383
3596
|
var discoverySessionDetailDtoSchema = discoverySessionDtoSchema.extend({
|
|
3384
|
-
probes:
|
|
3597
|
+
probes: z25.array(discoveryProbeDtoSchema).default([])
|
|
3385
3598
|
});
|
|
3386
3599
|
var DISCOVERY_MAX_PROBES_CAP = 500;
|
|
3387
|
-
var discoveryRunRequestSchema =
|
|
3388
|
-
icpDescription:
|
|
3389
|
-
dedupThreshold:
|
|
3390
|
-
maxProbes:
|
|
3600
|
+
var discoveryRunRequestSchema = z25.object({
|
|
3601
|
+
icpDescription: z25.string().min(1).optional(),
|
|
3602
|
+
dedupThreshold: z25.number().min(0).max(1).optional(),
|
|
3603
|
+
maxProbes: z25.number().int().positive().max(DISCOVERY_MAX_PROBES_CAP).optional(),
|
|
3391
3604
|
/**
|
|
3392
3605
|
* Optional override of the project's location labels, constraining seed
|
|
3393
3606
|
* generation to a subset of the configured service areas. Each label must
|
|
@@ -3395,39 +3608,39 @@ var discoveryRunRequestSchema = z24.object({
|
|
|
3395
3608
|
* `resolveLocations`). Omitted means "use every project location" — a
|
|
3396
3609
|
* project with no locations is unaffected.
|
|
3397
3610
|
*/
|
|
3398
|
-
locations:
|
|
3611
|
+
locations: z25.array(z25.string().min(1)).optional()
|
|
3399
3612
|
});
|
|
3400
|
-
var discoveryPromoteRequestSchema =
|
|
3401
|
-
buckets:
|
|
3402
|
-
includeCompetitors:
|
|
3403
|
-
competitorTypes:
|
|
3613
|
+
var discoveryPromoteRequestSchema = z25.object({
|
|
3614
|
+
buckets: z25.array(discoveryBucketSchema).min(1).optional(),
|
|
3615
|
+
includeCompetitors: z25.boolean().optional(),
|
|
3616
|
+
competitorTypes: z25.array(discoveryCompetitorTypeSchema).min(1).optional()
|
|
3404
3617
|
});
|
|
3405
|
-
var discoveryPromotePreviewSchema =
|
|
3406
|
-
sessionId:
|
|
3407
|
-
projectId:
|
|
3618
|
+
var discoveryPromotePreviewSchema = z25.object({
|
|
3619
|
+
sessionId: z25.string(),
|
|
3620
|
+
projectId: z25.string(),
|
|
3408
3621
|
status: discoverySessionStatusSchema,
|
|
3409
|
-
queriesByBucket:
|
|
3410
|
-
cited:
|
|
3411
|
-
aspirational:
|
|
3412
|
-
"wasted-surface":
|
|
3622
|
+
queriesByBucket: z25.object({
|
|
3623
|
+
cited: z25.array(z25.string()),
|
|
3624
|
+
aspirational: z25.array(z25.string()),
|
|
3625
|
+
"wasted-surface": z25.array(z25.string())
|
|
3413
3626
|
}),
|
|
3414
|
-
suggestedCompetitors:
|
|
3415
|
-
});
|
|
3416
|
-
var discoveryPromoteResultSchema =
|
|
3417
|
-
sessionId:
|
|
3418
|
-
projectId:
|
|
3419
|
-
promoted:
|
|
3420
|
-
queries:
|
|
3421
|
-
competitors:
|
|
3627
|
+
suggestedCompetitors: z25.array(discoveryCompetitorMapEntrySchema)
|
|
3628
|
+
});
|
|
3629
|
+
var discoveryPromoteResultSchema = z25.object({
|
|
3630
|
+
sessionId: z25.string(),
|
|
3631
|
+
projectId: z25.string(),
|
|
3632
|
+
promoted: z25.object({
|
|
3633
|
+
queries: z25.array(z25.string()),
|
|
3634
|
+
competitors: z25.array(z25.string())
|
|
3422
3635
|
}),
|
|
3423
|
-
skipped:
|
|
3424
|
-
queries:
|
|
3425
|
-
competitors:
|
|
3636
|
+
skipped: z25.object({
|
|
3637
|
+
queries: z25.array(z25.string()),
|
|
3638
|
+
competitors: z25.array(z25.string())
|
|
3426
3639
|
})
|
|
3427
3640
|
});
|
|
3428
|
-
var queryProvenanceSchema =
|
|
3429
|
-
|
|
3430
|
-
|
|
3641
|
+
var queryProvenanceSchema = z25.union([
|
|
3642
|
+
z25.literal("cli"),
|
|
3643
|
+
z25.string().regex(/^discovery:.+$/)
|
|
3431
3644
|
]);
|
|
3432
3645
|
|
|
3433
3646
|
// ../contracts/src/embeddings.ts
|
|
@@ -3616,6 +3829,7 @@ export {
|
|
|
3616
3829
|
authRequired,
|
|
3617
3830
|
authInvalid,
|
|
3618
3831
|
forbidden,
|
|
3832
|
+
quotaExceeded,
|
|
3619
3833
|
providerError,
|
|
3620
3834
|
runInProgress,
|
|
3621
3835
|
runNotCancellable,
|
|
@@ -3657,6 +3871,20 @@ export {
|
|
|
3657
3871
|
gscCoverageSnapshotDtoSchema,
|
|
3658
3872
|
gscSiteListResponseDtoSchema,
|
|
3659
3873
|
gscSitemapListResponseDtoSchema,
|
|
3874
|
+
gbpAccountListResponseSchema,
|
|
3875
|
+
gbpLocationDtoSchema,
|
|
3876
|
+
gbpLocationListResponseSchema,
|
|
3877
|
+
gbpDiscoverRequestSchema,
|
|
3878
|
+
gbpLocationSelectionRequestSchema,
|
|
3879
|
+
gbpSyncRequestSchema,
|
|
3880
|
+
gbpSyncResponseSchema,
|
|
3881
|
+
gbpDailyMetricListResponseSchema,
|
|
3882
|
+
gbpKeywordImpressionListResponseSchema,
|
|
3883
|
+
gbpPlaceActionListResponseSchema,
|
|
3884
|
+
gbpLodgingListResponseSchema,
|
|
3885
|
+
gbpSummaryDtoSchema,
|
|
3886
|
+
withRetry,
|
|
3887
|
+
isRetryableHttpError,
|
|
3660
3888
|
bingUrlInspectionDtoSchema,
|
|
3661
3889
|
bingCoverageSummaryDtoSchema,
|
|
3662
3890
|
bingKeywordStatsDtoSchema,
|
|
@@ -3770,6 +3998,9 @@ export {
|
|
|
3770
3998
|
CodingAgents,
|
|
3771
3999
|
skillsClientSchema,
|
|
3772
4000
|
SkillsClients,
|
|
4001
|
+
SKILL_MANIFEST_FILENAME,
|
|
4002
|
+
classifySkillFile,
|
|
4003
|
+
coerceSkillManifest,
|
|
3773
4004
|
TrafficSourceTypes,
|
|
3774
4005
|
TrafficEvidenceKinds,
|
|
3775
4006
|
TrafficEventConfidences,
|