@ainyc/canonry 4.57.0 → 4.60.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/aero/references/regression-playbook.md +13 -0
- package/assets/agent-workspace/skills/canonry/SKILL.md +7 -0
- package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +45 -0
- package/assets/agent-workspace/skills/canonry/references/google-business-profile.md +257 -0
- package/assets/assets/BacklinksPage-CEL_F-c1.js +1 -0
- package/assets/assets/{ChartPrimitives-D7C1Cp8w.js → ChartPrimitives-B8Z6fjCY.js} +1 -1
- package/assets/assets/ProjectPage-ClmLZ1TC.js +6 -0
- package/assets/assets/{RunRow-BntNdrgM.js → RunRow-oSEdTjB1.js} +1 -1
- package/assets/assets/{RunsPage-Btp6qn10.js → RunsPage-k-TX3mbf.js} +1 -1
- package/assets/assets/{SettingsPage-DkyNiU2i.js → SettingsPage-VCOwDDIL.js} +1 -1
- package/assets/assets/{TrafficPage-CBl4Mwdc.js → TrafficPage-GgkjI5RL.js} +1 -1
- package/assets/assets/{TrafficSourceDetailPage-BZzuWCn-.js → TrafficSourceDetailPage-DhMF4157.js} +1 -1
- package/assets/assets/{extract-error-message-De8_qAzs.js → extract-error-message-CYGeEBx9.js} +1 -1
- package/assets/assets/{index-XUKhruAg.js → index-BdGCBd0G.js} +90 -90
- package/assets/assets/{index-9NRlymgj.css → index-bQ6xgP8c.css} +1 -1
- package/assets/assets/server-traffic-If2bUKTD.js +1 -0
- package/assets/assets/{trash-2-B5clF2rU.js → trash-2-NV5lw_nX.js} +1 -1
- package/assets/index.html +2 -2
- package/dist/{chunk-HL6JZUEW.js → chunk-3G3GAT3E.js} +30326 -33261
- package/dist/{chunk-6X5TF73A.js → chunk-CKWHFAVB.js} +414 -1
- package/dist/{chunk-WFVUZVJD.js → chunk-DXWUBWBD.js} +1427 -1191
- package/dist/chunk-X4ZZFZQZ.js +10210 -0
- package/dist/cli.js +618 -466
- package/dist/index.d.ts +2 -1
- package/dist/index.js +4 -4
- package/dist/{intelligence-service-NY3MAVPB.js → intelligence-service-UYVVKQ2K.js} +2 -2
- package/dist/mcp.js +10 -8
- package/package.json +8 -7
- package/assets/assets/BacklinksPage-CmeFZ8UJ.js +0 -1
- package/assets/assets/ProjectPage-Y6uCyjGb.js +0 -6
- package/assets/assets/server-traffic-bn9LSZN9.js +0 -1
- package/dist/chunk-4KWPOVIT.js +0 -4842
|
@@ -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", "gbp-sync", "data-refresh"]);
|
|
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",
|
|
@@ -1897,31 +2096,36 @@ var projectSearchInsightHitSchema = z17.object({
|
|
|
1897
2096
|
"provider-pickup",
|
|
1898
2097
|
"persistent-gap",
|
|
1899
2098
|
"competitor-gained",
|
|
1900
|
-
"competitor-lost"
|
|
2099
|
+
"competitor-lost",
|
|
2100
|
+
// Google Business Profile (local-AEO) insight types — see InsightType.
|
|
2101
|
+
"gbp-lodging-gap",
|
|
2102
|
+
"gbp-cta-gap",
|
|
2103
|
+
"gbp-metric-drop",
|
|
2104
|
+
"gbp-keyword-drop"
|
|
1901
2105
|
]),
|
|
1902
|
-
severity:
|
|
1903
|
-
title:
|
|
1904
|
-
query:
|
|
1905
|
-
provider:
|
|
1906
|
-
matchedField:
|
|
1907
|
-
snippet:
|
|
1908
|
-
dismissed:
|
|
1909
|
-
createdAt:
|
|
1910
|
-
});
|
|
1911
|
-
var projectSearchHitSchema =
|
|
2106
|
+
severity: z18.enum(["critical", "high", "medium", "low"]),
|
|
2107
|
+
title: z18.string(),
|
|
2108
|
+
query: z18.string(),
|
|
2109
|
+
provider: z18.string(),
|
|
2110
|
+
matchedField: z18.enum(["title", "query", "recommendation", "cause"]),
|
|
2111
|
+
snippet: z18.string(),
|
|
2112
|
+
dismissed: z18.boolean(),
|
|
2113
|
+
createdAt: z18.string()
|
|
2114
|
+
});
|
|
2115
|
+
var projectSearchHitSchema = z18.discriminatedUnion("kind", [
|
|
1912
2116
|
projectSearchSnapshotHitSchema,
|
|
1913
2117
|
projectSearchInsightHitSchema
|
|
1914
2118
|
]);
|
|
1915
|
-
var projectSearchResponseSchema =
|
|
1916
|
-
query:
|
|
1917
|
-
totalHits:
|
|
1918
|
-
truncated:
|
|
1919
|
-
hits:
|
|
2119
|
+
var projectSearchResponseSchema = z18.object({
|
|
2120
|
+
query: z18.string(),
|
|
2121
|
+
totalHits: z18.number().int().nonnegative(),
|
|
2122
|
+
truncated: z18.boolean(),
|
|
2123
|
+
hits: z18.array(projectSearchHitSchema)
|
|
1920
2124
|
});
|
|
1921
2125
|
|
|
1922
2126
|
// ../contracts/src/content.ts
|
|
1923
|
-
import { z as
|
|
1924
|
-
var contentActionSchema =
|
|
2127
|
+
import { z as z19 } from "zod";
|
|
2128
|
+
var contentActionSchema = z19.enum(["create", "expand", "refresh", "add-schema"]);
|
|
1925
2129
|
var ContentActions = contentActionSchema.enum;
|
|
1926
2130
|
function contentActionLabel(action) {
|
|
1927
2131
|
switch (action) {
|
|
@@ -1935,9 +2139,9 @@ function contentActionLabel(action) {
|
|
|
1935
2139
|
return "Add schema";
|
|
1936
2140
|
}
|
|
1937
2141
|
}
|
|
1938
|
-
var demandSourceSchema =
|
|
2142
|
+
var demandSourceSchema = z19.enum(["gsc", "competitor-evidence", "both"]);
|
|
1939
2143
|
var DemandSources = demandSourceSchema.enum;
|
|
1940
|
-
var actionConfidenceSchema =
|
|
2144
|
+
var actionConfidenceSchema = z19.enum(["high", "medium", "low"]);
|
|
1941
2145
|
var ActionConfidences = actionConfidenceSchema.enum;
|
|
1942
2146
|
function actionConfidenceLabel(confidence) {
|
|
1943
2147
|
switch (confidence) {
|
|
@@ -1949,7 +2153,7 @@ function actionConfidenceLabel(confidence) {
|
|
|
1949
2153
|
return "Low";
|
|
1950
2154
|
}
|
|
1951
2155
|
}
|
|
1952
|
-
var pageTypeSchema =
|
|
2156
|
+
var pageTypeSchema = z19.enum([
|
|
1953
2157
|
"blog-post",
|
|
1954
2158
|
"comparison",
|
|
1955
2159
|
"listicle",
|
|
@@ -1958,7 +2162,7 @@ var pageTypeSchema = z18.enum([
|
|
|
1958
2162
|
"glossary"
|
|
1959
2163
|
]);
|
|
1960
2164
|
var PageTypes = pageTypeSchema.enum;
|
|
1961
|
-
var contentActionStateSchema =
|
|
2165
|
+
var contentActionStateSchema = z19.enum([
|
|
1962
2166
|
"proposed",
|
|
1963
2167
|
"briefed",
|
|
1964
2168
|
"payload-generated",
|
|
@@ -1968,136 +2172,136 @@ var contentActionStateSchema = z18.enum([
|
|
|
1968
2172
|
"dismissed"
|
|
1969
2173
|
]);
|
|
1970
2174
|
var ContentActionStates = contentActionStateSchema.enum;
|
|
1971
|
-
var ourBestPageSchema =
|
|
1972
|
-
url:
|
|
1973
|
-
gscImpressions:
|
|
1974
|
-
gscClicks:
|
|
2175
|
+
var ourBestPageSchema = z19.object({
|
|
2176
|
+
url: z19.string(),
|
|
2177
|
+
gscImpressions: z19.number().nonnegative(),
|
|
2178
|
+
gscClicks: z19.number().nonnegative(),
|
|
1975
2179
|
// Null when the page came from the inventory fallback (no GSC ranking data).
|
|
1976
|
-
gscAvgPosition:
|
|
1977
|
-
organicSessions:
|
|
2180
|
+
gscAvgPosition: z19.number().nonnegative().nullable(),
|
|
2181
|
+
organicSessions: z19.number().nonnegative()
|
|
1978
2182
|
});
|
|
1979
|
-
var winningCompetitorSchema =
|
|
1980
|
-
domain:
|
|
1981
|
-
url:
|
|
1982
|
-
title:
|
|
1983
|
-
citationCount:
|
|
2183
|
+
var winningCompetitorSchema = z19.object({
|
|
2184
|
+
domain: z19.string(),
|
|
2185
|
+
url: z19.string(),
|
|
2186
|
+
title: z19.string(),
|
|
2187
|
+
citationCount: z19.number().int().nonnegative()
|
|
1984
2188
|
});
|
|
1985
|
-
var scoreBreakdownSchema =
|
|
1986
|
-
demand:
|
|
1987
|
-
competitor:
|
|
1988
|
-
absence:
|
|
1989
|
-
gapSeverity:
|
|
2189
|
+
var scoreBreakdownSchema = z19.object({
|
|
2190
|
+
demand: z19.number(),
|
|
2191
|
+
competitor: z19.number(),
|
|
2192
|
+
absence: z19.number(),
|
|
2193
|
+
gapSeverity: z19.number()
|
|
1990
2194
|
});
|
|
1991
|
-
var existingActionRefSchema =
|
|
1992
|
-
actionId:
|
|
2195
|
+
var existingActionRefSchema = z19.object({
|
|
2196
|
+
actionId: z19.string(),
|
|
1993
2197
|
state: contentActionStateSchema,
|
|
1994
|
-
lastUpdated:
|
|
2198
|
+
lastUpdated: z19.string()
|
|
1995
2199
|
});
|
|
1996
|
-
var contentTargetRowDtoSchema =
|
|
1997
|
-
targetRef:
|
|
1998
|
-
query:
|
|
2200
|
+
var contentTargetRowDtoSchema = z19.object({
|
|
2201
|
+
targetRef: z19.string(),
|
|
2202
|
+
query: z19.string(),
|
|
1999
2203
|
action: contentActionSchema,
|
|
2000
2204
|
ourBestPage: ourBestPageSchema.nullable(),
|
|
2001
2205
|
winningCompetitor: winningCompetitorSchema.nullable(),
|
|
2002
|
-
score:
|
|
2206
|
+
score: z19.number(),
|
|
2003
2207
|
scoreBreakdown: scoreBreakdownSchema,
|
|
2004
|
-
drivers:
|
|
2208
|
+
drivers: z19.array(z19.string()),
|
|
2005
2209
|
demandSource: demandSourceSchema,
|
|
2006
2210
|
actionConfidence: actionConfidenceSchema,
|
|
2007
2211
|
existingAction: existingActionRefSchema.nullable()
|
|
2008
2212
|
});
|
|
2009
|
-
var contentTargetsResponseDtoSchema =
|
|
2010
|
-
targets:
|
|
2011
|
-
contextMetrics:
|
|
2012
|
-
totalAiReferralSessions:
|
|
2013
|
-
latestRunId:
|
|
2014
|
-
runTimestamp:
|
|
2213
|
+
var contentTargetsResponseDtoSchema = z19.object({
|
|
2214
|
+
targets: z19.array(contentTargetRowDtoSchema),
|
|
2215
|
+
contextMetrics: z19.object({
|
|
2216
|
+
totalAiReferralSessions: z19.number().int().nonnegative(),
|
|
2217
|
+
latestRunId: z19.string(),
|
|
2218
|
+
runTimestamp: z19.string()
|
|
2015
2219
|
})
|
|
2016
2220
|
});
|
|
2017
|
-
var contentTargetDismissalDtoSchema =
|
|
2018
|
-
targetRef:
|
|
2019
|
-
addressedUrl:
|
|
2020
|
-
note:
|
|
2021
|
-
dismissedAt:
|
|
2221
|
+
var contentTargetDismissalDtoSchema = z19.object({
|
|
2222
|
+
targetRef: z19.string(),
|
|
2223
|
+
addressedUrl: z19.string().nullable(),
|
|
2224
|
+
note: z19.string().nullable(),
|
|
2225
|
+
dismissedAt: z19.string()
|
|
2022
2226
|
});
|
|
2023
|
-
var contentTargetDismissalsResponseDtoSchema =
|
|
2024
|
-
dismissals:
|
|
2227
|
+
var contentTargetDismissalsResponseDtoSchema = z19.object({
|
|
2228
|
+
dismissals: z19.array(contentTargetDismissalDtoSchema)
|
|
2025
2229
|
});
|
|
2026
|
-
var contentTargetDismissRequestSchema =
|
|
2027
|
-
targetRef:
|
|
2230
|
+
var contentTargetDismissRequestSchema = z19.object({
|
|
2231
|
+
targetRef: z19.string().min(1),
|
|
2028
2232
|
/** 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:
|
|
2233
|
+
addressedUrl: z19.string().url().optional(),
|
|
2030
2234
|
/** 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:
|
|
2235
|
+
note: z19.string().max(500).optional()
|
|
2032
2236
|
});
|
|
2033
|
-
var recommendationExplanationDtoSchema =
|
|
2034
|
-
targetRef:
|
|
2237
|
+
var recommendationExplanationDtoSchema = z19.object({
|
|
2238
|
+
targetRef: z19.string(),
|
|
2035
2239
|
/** Version of the prompt template used. Bumping the version invalidates the cache forward without touching the table. */
|
|
2036
|
-
promptVersion:
|
|
2240
|
+
promptVersion: z19.string(),
|
|
2037
2241
|
/** Provider that produced the explanation (e.g. "claude", "gemini"). */
|
|
2038
|
-
provider:
|
|
2242
|
+
provider: z19.string(),
|
|
2039
2243
|
/** Model id within that provider (e.g. "claude-sonnet-4-6"). */
|
|
2040
|
-
model:
|
|
2244
|
+
model: z19.string(),
|
|
2041
2245
|
/** Markdown-formatted rationale + recommended next steps. */
|
|
2042
|
-
responseText:
|
|
2246
|
+
responseText: z19.string(),
|
|
2043
2247
|
/** Estimated cost in millicents (1/100 of a cent). 0 when unknown. */
|
|
2044
|
-
costMillicents:
|
|
2045
|
-
generatedAt:
|
|
2248
|
+
costMillicents: z19.number().int().nonnegative(),
|
|
2249
|
+
generatedAt: z19.string()
|
|
2046
2250
|
});
|
|
2047
|
-
var recommendationExplainRequestSchema =
|
|
2251
|
+
var recommendationExplainRequestSchema = z19.object({
|
|
2048
2252
|
/**
|
|
2049
2253
|
* Optional provider override (e.g. "claude" to force Claude even if
|
|
2050
2254
|
* the project's default is Gemini). Falls through to project default
|
|
2051
2255
|
* → auto-detect when omitted.
|
|
2052
2256
|
*/
|
|
2053
|
-
provider:
|
|
2257
|
+
provider: z19.string().optional(),
|
|
2054
2258
|
/**
|
|
2055
2259
|
* Optional model override within the chosen provider. Falls through to
|
|
2056
2260
|
* the `analyze`-tier default model when omitted.
|
|
2057
2261
|
*/
|
|
2058
|
-
model:
|
|
2262
|
+
model: z19.string().optional(),
|
|
2059
2263
|
/**
|
|
2060
2264
|
* Force a fresh LLM call even if a cached explanation exists for the
|
|
2061
2265
|
* current prompt version. Use sparingly — defeats the cache.
|
|
2062
2266
|
*/
|
|
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()
|
|
2267
|
+
forceRefresh: z19.boolean().optional()
|
|
2088
2268
|
});
|
|
2089
|
-
var
|
|
2090
|
-
|
|
2091
|
-
|
|
2269
|
+
var contentGroundingSourceSchema = z19.object({
|
|
2270
|
+
uri: z19.string(),
|
|
2271
|
+
title: z19.string(),
|
|
2272
|
+
domain: z19.string(),
|
|
2273
|
+
isOurDomain: z19.boolean(),
|
|
2274
|
+
isCompetitor: z19.boolean(),
|
|
2275
|
+
citationCount: z19.number().int().nonnegative(),
|
|
2276
|
+
providers: z19.array(providerNameSchema)
|
|
2277
|
+
});
|
|
2278
|
+
var contentSourceRowDtoSchema = z19.object({
|
|
2279
|
+
query: z19.string(),
|
|
2280
|
+
groundingSources: z19.array(contentGroundingSourceSchema)
|
|
2281
|
+
});
|
|
2282
|
+
var contentSourcesResponseDtoSchema = z19.object({
|
|
2283
|
+
sources: z19.array(contentSourceRowDtoSchema),
|
|
2284
|
+
latestRunId: z19.string()
|
|
2285
|
+
});
|
|
2286
|
+
var contentGapRowDtoSchema = z19.object({
|
|
2287
|
+
query: z19.string(),
|
|
2288
|
+
competitorDomains: z19.array(z19.string()),
|
|
2289
|
+
competitorCount: z19.number().int().nonnegative(),
|
|
2290
|
+
missRate: z19.number().min(0).max(1),
|
|
2291
|
+
lastSeenInRunId: z19.string()
|
|
2292
|
+
});
|
|
2293
|
+
var contentGapsResponseDtoSchema = z19.object({
|
|
2294
|
+
gaps: z19.array(contentGapRowDtoSchema),
|
|
2295
|
+
latestRunId: z19.string()
|
|
2092
2296
|
});
|
|
2093
2297
|
|
|
2094
2298
|
// ../contracts/src/doctor.ts
|
|
2095
|
-
import { z as
|
|
2096
|
-
var checkStatusSchema =
|
|
2299
|
+
import { z as z20 } from "zod";
|
|
2300
|
+
var checkStatusSchema = z20.enum(["ok", "warn", "fail", "skipped"]);
|
|
2097
2301
|
var CheckStatuses = checkStatusSchema.enum;
|
|
2098
|
-
var checkScopeSchema =
|
|
2302
|
+
var checkScopeSchema = z20.enum(["global", "project"]);
|
|
2099
2303
|
var CheckScopes = checkScopeSchema.enum;
|
|
2100
|
-
var checkCategorySchema =
|
|
2304
|
+
var checkCategorySchema = z20.enum([
|
|
2101
2305
|
"auth",
|
|
2102
2306
|
"config",
|
|
2103
2307
|
"providers",
|
|
@@ -2108,31 +2312,31 @@ var checkCategorySchema = z19.enum([
|
|
|
2108
2312
|
"agent"
|
|
2109
2313
|
]);
|
|
2110
2314
|
var CheckCategories = checkCategorySchema.enum;
|
|
2111
|
-
var checkResultSchema =
|
|
2112
|
-
id:
|
|
2315
|
+
var checkResultSchema = z20.object({
|
|
2316
|
+
id: z20.string(),
|
|
2113
2317
|
category: checkCategorySchema,
|
|
2114
2318
|
scope: checkScopeSchema,
|
|
2115
|
-
title:
|
|
2319
|
+
title: z20.string(),
|
|
2116
2320
|
status: checkStatusSchema,
|
|
2117
|
-
code:
|
|
2118
|
-
summary:
|
|
2119
|
-
remediation:
|
|
2120
|
-
details:
|
|
2121
|
-
durationMs:
|
|
2321
|
+
code: z20.string().describe('Stable machine-readable code (e.g. "google.token.refresh-failed"). Use this for filtering and remediation logic.'),
|
|
2322
|
+
summary: z20.string(),
|
|
2323
|
+
remediation: z20.string().nullable().optional().describe('Operator-facing next step. Null when status is "ok" or no specific remediation applies.'),
|
|
2324
|
+
details: z20.record(z20.string(), z20.unknown()).optional().describe("Structured context \u2014 principal email, redirect URI, missing scopes, etc. Stable per check id."),
|
|
2325
|
+
durationMs: z20.number().int().nonnegative().describe("How long the check took to execute.")
|
|
2122
2326
|
});
|
|
2123
|
-
var doctorReportSchema =
|
|
2327
|
+
var doctorReportSchema = z20.object({
|
|
2124
2328
|
scope: checkScopeSchema,
|
|
2125
|
-
project:
|
|
2126
|
-
generatedAt:
|
|
2127
|
-
durationMs:
|
|
2128
|
-
summary:
|
|
2129
|
-
total:
|
|
2130
|
-
ok:
|
|
2131
|
-
warn:
|
|
2132
|
-
fail:
|
|
2133
|
-
skipped:
|
|
2329
|
+
project: z20.string().nullable().describe('Project name when scope is "project", null otherwise.'),
|
|
2330
|
+
generatedAt: z20.string().describe("ISO-8601 timestamp when this doctor run started."),
|
|
2331
|
+
durationMs: z20.number().int().nonnegative(),
|
|
2332
|
+
summary: z20.object({
|
|
2333
|
+
total: z20.number().int().nonnegative(),
|
|
2334
|
+
ok: z20.number().int().nonnegative(),
|
|
2335
|
+
warn: z20.number().int().nonnegative(),
|
|
2336
|
+
fail: z20.number().int().nonnegative(),
|
|
2337
|
+
skipped: z20.number().int().nonnegative()
|
|
2134
2338
|
}),
|
|
2135
|
-
checks:
|
|
2339
|
+
checks: z20.array(checkResultSchema)
|
|
2136
2340
|
});
|
|
2137
2341
|
function summarizeCheckResults(results) {
|
|
2138
2342
|
const summary = { total: results.length, ok: 0, warn: 0, fail: 0, skipped: 0 };
|
|
@@ -2278,52 +2482,52 @@ function normalizeUrlPath(input) {
|
|
|
2278
2482
|
}
|
|
2279
2483
|
|
|
2280
2484
|
// ../contracts/src/citations.ts
|
|
2281
|
-
import { z as
|
|
2282
|
-
var citationCoverageProviderSchema =
|
|
2283
|
-
provider:
|
|
2485
|
+
import { z as z21 } from "zod";
|
|
2486
|
+
var citationCoverageProviderSchema = z21.object({
|
|
2487
|
+
provider: z21.string(),
|
|
2284
2488
|
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:
|
|
2489
|
+
cited: z21.boolean(),
|
|
2490
|
+
mentioned: z21.boolean(),
|
|
2491
|
+
runId: z21.string(),
|
|
2492
|
+
runCreatedAt: z21.string()
|
|
2493
|
+
});
|
|
2494
|
+
var citationCoverageRowSchema = z21.object({
|
|
2495
|
+
queryId: z21.string(),
|
|
2496
|
+
query: z21.string(),
|
|
2497
|
+
providers: z21.array(citationCoverageProviderSchema),
|
|
2498
|
+
citedCount: z21.number().int().nonnegative(),
|
|
2499
|
+
mentionedCount: z21.number().int().nonnegative(),
|
|
2500
|
+
totalProviders: z21.number().int().nonnegative()
|
|
2501
|
+
});
|
|
2502
|
+
var competitorGapRowSchema = z21.object({
|
|
2503
|
+
queryId: z21.string(),
|
|
2504
|
+
query: z21.string(),
|
|
2505
|
+
provider: z21.string(),
|
|
2506
|
+
citingCompetitors: z21.array(z21.string()),
|
|
2507
|
+
runId: z21.string(),
|
|
2508
|
+
runCreatedAt: z21.string()
|
|
2509
|
+
});
|
|
2510
|
+
var citationVisibilitySummarySchema = z21.object({
|
|
2511
|
+
providersConfigured: z21.number().int().nonnegative(),
|
|
2512
|
+
providersCiting: z21.number().int().nonnegative(),
|
|
2513
|
+
providersMentioning: z21.number().int().nonnegative(),
|
|
2514
|
+
totalQueries: z21.number().int().nonnegative(),
|
|
2311
2515
|
// Cross-tab buckets — each tracked query with at least one snapshot lands
|
|
2312
2516
|
// in exactly one of these. Queries with zero snapshots are not counted in
|
|
2313
2517
|
// any bucket; (sum of buckets) ≤ totalQueries.
|
|
2314
|
-
queriesCitedAndMentioned:
|
|
2315
|
-
queriesCitedOnly:
|
|
2316
|
-
queriesMentionedOnly:
|
|
2317
|
-
queriesInvisible:
|
|
2318
|
-
latestRunId:
|
|
2319
|
-
latestRunAt:
|
|
2320
|
-
});
|
|
2321
|
-
var citationVisibilityResponseSchema =
|
|
2518
|
+
queriesCitedAndMentioned: z21.number().int().nonnegative(),
|
|
2519
|
+
queriesCitedOnly: z21.number().int().nonnegative(),
|
|
2520
|
+
queriesMentionedOnly: z21.number().int().nonnegative(),
|
|
2521
|
+
queriesInvisible: z21.number().int().nonnegative(),
|
|
2522
|
+
latestRunId: z21.string().nullable(),
|
|
2523
|
+
latestRunAt: z21.string().nullable()
|
|
2524
|
+
});
|
|
2525
|
+
var citationVisibilityResponseSchema = z21.object({
|
|
2322
2526
|
summary: citationVisibilitySummarySchema,
|
|
2323
|
-
byQuery:
|
|
2324
|
-
competitorGaps:
|
|
2325
|
-
status:
|
|
2326
|
-
reason:
|
|
2527
|
+
byQuery: z21.array(citationCoverageRowSchema),
|
|
2528
|
+
competitorGaps: z21.array(competitorGapRowSchema),
|
|
2529
|
+
status: z21.enum(["ready", "no-data"]),
|
|
2530
|
+
reason: z21.enum(["no-runs-yet", "no-queries"]).optional()
|
|
2327
2531
|
});
|
|
2328
2532
|
function emptyCitationVisibility(reason) {
|
|
2329
2533
|
return {
|
|
@@ -2350,46 +2554,46 @@ function citationStateToCited(state) {
|
|
|
2350
2554
|
}
|
|
2351
2555
|
|
|
2352
2556
|
// ../contracts/src/report.ts
|
|
2353
|
-
import { z as
|
|
2354
|
-
var providerLocationTreatmentSchema =
|
|
2557
|
+
import { z as z22 } from "zod";
|
|
2558
|
+
var providerLocationTreatmentSchema = z22.enum([
|
|
2355
2559
|
"prompt",
|
|
2356
2560
|
"request-param",
|
|
2357
2561
|
"browser-geo",
|
|
2358
2562
|
"ignored"
|
|
2359
2563
|
]);
|
|
2360
|
-
var reportMetaLocationSchema =
|
|
2564
|
+
var reportMetaLocationSchema = z22.object({
|
|
2361
2565
|
/** Human-readable label as configured on the project (e.g. "michigan"). */
|
|
2362
|
-
label:
|
|
2566
|
+
label: z22.string(),
|
|
2363
2567
|
/** Resolved city/region/country from the project's `LocationContext`. */
|
|
2364
|
-
city:
|
|
2365
|
-
region:
|
|
2366
|
-
country:
|
|
2568
|
+
city: z22.string(),
|
|
2569
|
+
region: z22.string(),
|
|
2570
|
+
country: z22.string(),
|
|
2367
2571
|
/**
|
|
2368
2572
|
* Other locations configured on the project that did NOT power this report.
|
|
2369
2573
|
* When non-empty, callers should make clear that the report is location-scoped:
|
|
2370
2574
|
* a separate sweep is needed to see how AI engines respond from each one.
|
|
2371
2575
|
*/
|
|
2372
|
-
otherConfiguredLabels:
|
|
2576
|
+
otherConfiguredLabels: z22.array(z22.string())
|
|
2373
2577
|
});
|
|
2374
|
-
var reportProviderLocationHandlingSchema =
|
|
2578
|
+
var reportProviderLocationHandlingSchema = z22.object({
|
|
2375
2579
|
/** Provider name (matches `query_snapshots.provider`). */
|
|
2376
|
-
provider:
|
|
2580
|
+
provider: z22.string(),
|
|
2377
2581
|
/** How this provider applied the configured location during this run. */
|
|
2378
2582
|
treatment: providerLocationTreatmentSchema,
|
|
2379
2583
|
/** One-sentence explanation suitable for the report. */
|
|
2380
|
-
description:
|
|
2584
|
+
description: z22.string()
|
|
2381
2585
|
});
|
|
2382
|
-
var reportMetaSchema =
|
|
2586
|
+
var reportMetaSchema = z22.object({
|
|
2383
2587
|
/** ISO timestamp the report was generated (server clock). */
|
|
2384
|
-
generatedAt:
|
|
2588
|
+
generatedAt: z22.string(),
|
|
2385
2589
|
/** Project the report covers. */
|
|
2386
|
-
project:
|
|
2387
|
-
id:
|
|
2388
|
-
name:
|
|
2389
|
-
displayName:
|
|
2390
|
-
canonicalDomain:
|
|
2391
|
-
country:
|
|
2392
|
-
language:
|
|
2590
|
+
project: z22.object({
|
|
2591
|
+
id: z22.string(),
|
|
2592
|
+
name: z22.string(),
|
|
2593
|
+
displayName: z22.string(),
|
|
2594
|
+
canonicalDomain: z22.string(),
|
|
2595
|
+
country: z22.string(),
|
|
2596
|
+
language: z22.string()
|
|
2393
2597
|
}),
|
|
2394
2598
|
/**
|
|
2395
2599
|
* The location that powered the latest visibility run, when one was set.
|
|
@@ -2404,24 +2608,24 @@ var reportMetaSchema = z21.object({
|
|
|
2404
2608
|
* each provider's answer — some providers append it to the prompt, some
|
|
2405
2609
|
* pass it as a structured request field, and some (CDP) ignore it.
|
|
2406
2610
|
*/
|
|
2407
|
-
providerLocationHandling:
|
|
2611
|
+
providerLocationHandling: z22.array(reportProviderLocationHandlingSchema),
|
|
2408
2612
|
/** Earliest data point referenced by the report (ISO date). */
|
|
2409
|
-
periodStart:
|
|
2613
|
+
periodStart: z22.string().nullable(),
|
|
2410
2614
|
/** Latest data point referenced by the report (ISO date). */
|
|
2411
|
-
periodEnd:
|
|
2615
|
+
periodEnd: z22.string().nullable()
|
|
2412
2616
|
});
|
|
2413
|
-
var reportExecutiveSummarySchema =
|
|
2617
|
+
var reportExecutiveSummarySchema = z22.object({
|
|
2414
2618
|
/**
|
|
2415
2619
|
* 0..100 — share of tracked queries that were cited by at least one
|
|
2416
2620
|
* provider in the latest run. "Cited" means the project's domain appeared
|
|
2417
2621
|
* in the source list / grounding the AI used to answer. Computed per-query
|
|
2418
2622
|
* (not per-(query × provider)) so the rate is invariant to provider count.
|
|
2419
2623
|
*/
|
|
2420
|
-
citationRate:
|
|
2624
|
+
citationRate: z22.number(),
|
|
2421
2625
|
/** Numerator of `citationRate` — distinct tracked queries cited by ≥1 provider in the latest run. */
|
|
2422
|
-
citedQueryCount:
|
|
2626
|
+
citedQueryCount: z22.number(),
|
|
2423
2627
|
/** Denominator of `citationRate` — total tracked queries. */
|
|
2424
|
-
totalQueryCount:
|
|
2628
|
+
totalQueryCount: z22.number(),
|
|
2425
2629
|
/**
|
|
2426
2630
|
* 0..100 — share of tracked queries where the project's brand or domain
|
|
2427
2631
|
* appeared in at least one provider's answer text in the latest run.
|
|
@@ -2429,68 +2633,68 @@ var reportExecutiveSummarySchema = z21.object({
|
|
|
2429
2633
|
* the prose without citing your domain in its sources, and vice versa.
|
|
2430
2634
|
* Same per-query denominator as `citationRate` for consistency.
|
|
2431
2635
|
*/
|
|
2432
|
-
mentionRate:
|
|
2636
|
+
mentionRate: z22.number(),
|
|
2433
2637
|
/** Numerator of `mentionRate` — distinct tracked queries mentioned in ≥1 provider's answer text. */
|
|
2434
|
-
mentionedQueryCount:
|
|
2638
|
+
mentionedQueryCount: z22.number(),
|
|
2435
2639
|
/** Compared to the previous run: 'up' | 'down' | 'flat' | 'unknown' (no prior run). */
|
|
2436
|
-
trend:
|
|
2640
|
+
trend: z22.enum(["up", "down", "flat", "unknown"]),
|
|
2437
2641
|
/** Total tracked queries. */
|
|
2438
|
-
queryCount:
|
|
2642
|
+
queryCount: z22.number(),
|
|
2439
2643
|
/** Total tracked competitors. */
|
|
2440
|
-
competitorCount:
|
|
2644
|
+
competitorCount: z22.number(),
|
|
2441
2645
|
/** Number of providers in the latest run. */
|
|
2442
|
-
providerCount:
|
|
2646
|
+
providerCount: z22.number(),
|
|
2443
2647
|
/** 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:
|
|
2648
|
+
gsc: z22.object({
|
|
2649
|
+
clicks: z22.number(),
|
|
2650
|
+
impressions: z22.number(),
|
|
2651
|
+
ctr: z22.number(),
|
|
2652
|
+
avgPosition: z22.number(),
|
|
2653
|
+
periodStart: z22.string(),
|
|
2654
|
+
periodEnd: z22.string()
|
|
2451
2655
|
}).nullable(),
|
|
2452
2656
|
/** GA4 totals across the most-recent sync period. Null when GA4 is not connected. */
|
|
2453
|
-
ga:
|
|
2454
|
-
sessions:
|
|
2455
|
-
users:
|
|
2456
|
-
periodStart:
|
|
2457
|
-
periodEnd:
|
|
2657
|
+
ga: z22.object({
|
|
2658
|
+
sessions: z22.number(),
|
|
2659
|
+
users: z22.number(),
|
|
2660
|
+
periodStart: z22.string(),
|
|
2661
|
+
periodEnd: z22.string()
|
|
2458
2662
|
}).nullable(),
|
|
2459
2663
|
/** Top 3-5 findings, each rendered as a single-sentence narrative. */
|
|
2460
|
-
findings:
|
|
2461
|
-
title:
|
|
2462
|
-
detail:
|
|
2463
|
-
tone:
|
|
2664
|
+
findings: z22.array(z22.object({
|
|
2665
|
+
title: z22.string(),
|
|
2666
|
+
detail: z22.string(),
|
|
2667
|
+
tone: z22.enum(["positive", "caution", "negative", "neutral"])
|
|
2464
2668
|
}))
|
|
2465
2669
|
});
|
|
2466
|
-
var citationCellSchema =
|
|
2467
|
-
citationState:
|
|
2468
|
-
answerMentioned:
|
|
2469
|
-
model:
|
|
2670
|
+
var citationCellSchema = z22.object({
|
|
2671
|
+
citationState: z22.enum(["cited", "not-cited", "pending"]),
|
|
2672
|
+
answerMentioned: z22.boolean().nullable(),
|
|
2673
|
+
model: z22.string().nullable()
|
|
2470
2674
|
});
|
|
2471
|
-
var citationScorecardSchema =
|
|
2472
|
-
queries:
|
|
2473
|
-
providers:
|
|
2675
|
+
var citationScorecardSchema = z22.object({
|
|
2676
|
+
queries: z22.array(z22.string()),
|
|
2677
|
+
providers: z22.array(z22.string()),
|
|
2474
2678
|
/** matrix[queryIndex][providerIndex] — null when no snapshot exists for the pair. */
|
|
2475
|
-
matrix:
|
|
2679
|
+
matrix: z22.array(z22.array(citationCellSchema.nullable())),
|
|
2476
2680
|
/** Per-provider citation rate (0..100). */
|
|
2477
|
-
providerRates:
|
|
2478
|
-
provider:
|
|
2479
|
-
citedCount:
|
|
2480
|
-
totalCount:
|
|
2481
|
-
citationRate:
|
|
2681
|
+
providerRates: z22.array(z22.object({
|
|
2682
|
+
provider: z22.string(),
|
|
2683
|
+
citedCount: z22.number(),
|
|
2684
|
+
totalCount: z22.number(),
|
|
2685
|
+
citationRate: z22.number()
|
|
2482
2686
|
}))
|
|
2483
2687
|
});
|
|
2484
|
-
var competitorRowSchema =
|
|
2485
|
-
domain:
|
|
2688
|
+
var competitorRowSchema = z22.object({
|
|
2689
|
+
domain: z22.string(),
|
|
2486
2690
|
/** Number of (query × provider) pairs that cited this competitor. */
|
|
2487
|
-
citationCount:
|
|
2691
|
+
citationCount: z22.number(),
|
|
2488
2692
|
/** Out-of count for the same denominator. */
|
|
2489
|
-
totalCount:
|
|
2693
|
+
totalCount: z22.number(),
|
|
2490
2694
|
/** 'High' | 'Moderate' | 'Low' | 'None' — from buildPortfolioProject pressure logic. */
|
|
2491
|
-
pressureLabel:
|
|
2695
|
+
pressureLabel: z22.enum(["High", "Moderate", "Low", "None"]),
|
|
2492
2696
|
/** Distinct queries on which this competitor was cited. */
|
|
2493
|
-
citedQueries:
|
|
2697
|
+
citedQueries: z22.array(z22.string()),
|
|
2494
2698
|
/**
|
|
2495
2699
|
* Citation share 0..100. Numerator = this competitor's `citationCount`.
|
|
2496
2700
|
* Denominator = sum of `citationCount` across all competitors plus the
|
|
@@ -2498,30 +2702,30 @@ var competitorRowSchema = z21.object({
|
|
|
2498
2702
|
* slots in the snapshot. Distinct from the project-level Mention Share
|
|
2499
2703
|
* gauge — that one is brand-in-answer-text, this one is domain-in-source-list.
|
|
2500
2704
|
*/
|
|
2501
|
-
sharePct:
|
|
2705
|
+
sharePct: z22.number(),
|
|
2502
2706
|
/**
|
|
2503
2707
|
* URLs from the latest run's grounding sources whose host matches this
|
|
2504
2708
|
* competitor's domain, with the queries each URL was cited for. Empty
|
|
2505
2709
|
* when no grounding-source data is available (e.g. no `rawResponse` JSON
|
|
2506
2710
|
* stored for the snapshots).
|
|
2507
2711
|
*/
|
|
2508
|
-
theirCitedPages:
|
|
2712
|
+
theirCitedPages: z22.array(z22.object({ url: z22.string(), citedFor: z22.array(z22.string()) }))
|
|
2509
2713
|
});
|
|
2510
|
-
var competitorLandscapeSchema =
|
|
2714
|
+
var competitorLandscapeSchema = z22.object({
|
|
2511
2715
|
/** Project's own citation count (for the bar chart comparing project vs competitors). */
|
|
2512
|
-
projectCitationCount:
|
|
2513
|
-
competitors:
|
|
2716
|
+
projectCitationCount: z22.number(),
|
|
2717
|
+
competitors: z22.array(competitorRowSchema)
|
|
2514
2718
|
});
|
|
2515
|
-
var mentionRowSchema =
|
|
2516
|
-
domain:
|
|
2719
|
+
var mentionRowSchema = z22.object({
|
|
2720
|
+
domain: z22.string(),
|
|
2517
2721
|
/** Number of (query × provider) pairs whose answer text mentioned this competitor's brand or domain. */
|
|
2518
|
-
mentionCount:
|
|
2722
|
+
mentionCount: z22.number(),
|
|
2519
2723
|
/** Out-of count for the same denominator (snapshots that had answer text). */
|
|
2520
|
-
totalCount:
|
|
2724
|
+
totalCount: z22.number(),
|
|
2521
2725
|
/** 'High' | 'Moderate' | 'Low' | 'None' — mention frequency tier (mirrors CompetitorRow.pressureLabel). */
|
|
2522
|
-
pressureLabel:
|
|
2726
|
+
pressureLabel: z22.enum(["High", "Moderate", "Low", "None"]),
|
|
2523
2727
|
/** Distinct queries on which this competitor was mentioned. */
|
|
2524
|
-
mentionedQueries:
|
|
2728
|
+
mentionedQueries: z22.array(z22.string()),
|
|
2525
2729
|
/**
|
|
2526
2730
|
* Mention share 0..100. Numerator = this competitor's `mentionCount`.
|
|
2527
2731
|
* Denominator = sum of `mentionCount` across all competitors plus the
|
|
@@ -2529,129 +2733,129 @@ var mentionRowSchema = z21.object({
|
|
|
2529
2733
|
* mention. Per-competitor split of the same head-to-head measure the
|
|
2530
2734
|
* project's hero `MentionShareDto` gauge headlines.
|
|
2531
2735
|
*/
|
|
2532
|
-
sharePct:
|
|
2736
|
+
sharePct: z22.number()
|
|
2533
2737
|
});
|
|
2534
|
-
var mentionLandscapeSchema =
|
|
2738
|
+
var mentionLandscapeSchema = z22.object({
|
|
2535
2739
|
/** Project's own mention count (for the bar chart comparing project vs competitors). */
|
|
2536
|
-
projectMentionCount:
|
|
2740
|
+
projectMentionCount: z22.number(),
|
|
2537
2741
|
/** Snapshots considered — those with non-empty answerText. Drives the totalCount denominator. */
|
|
2538
|
-
totalAnswerSnapshots:
|
|
2539
|
-
competitors:
|
|
2742
|
+
totalAnswerSnapshots: z22.number(),
|
|
2743
|
+
competitors: z22.array(mentionRowSchema)
|
|
2540
2744
|
});
|
|
2541
|
-
var aiSourceCategoryBucketSchema =
|
|
2745
|
+
var aiSourceCategoryBucketSchema = z22.object({
|
|
2542
2746
|
/** Category slug from packages/contracts/src/source-categories. */
|
|
2543
|
-
category:
|
|
2747
|
+
category: z22.string(),
|
|
2544
2748
|
/** Display label. */
|
|
2545
|
-
label:
|
|
2749
|
+
label: z22.string(),
|
|
2546
2750
|
/** Number of citations falling in this category. */
|
|
2547
|
-
count:
|
|
2751
|
+
count: z22.number(),
|
|
2548
2752
|
/** 0..100 share of total citations. */
|
|
2549
|
-
sharePct:
|
|
2753
|
+
sharePct: z22.number()
|
|
2550
2754
|
});
|
|
2551
|
-
var aiSourceOriginSchema =
|
|
2552
|
-
categories:
|
|
2755
|
+
var aiSourceOriginSchema = z22.object({
|
|
2756
|
+
categories: z22.array(aiSourceCategoryBucketSchema),
|
|
2553
2757
|
/** Top 20 source domains by citation count (excluding the project's own domain). */
|
|
2554
|
-
topDomains:
|
|
2555
|
-
domain:
|
|
2556
|
-
count:
|
|
2758
|
+
topDomains: z22.array(z22.object({
|
|
2759
|
+
domain: z22.string(),
|
|
2760
|
+
count: z22.number(),
|
|
2557
2761
|
/** True when the domain is one of the project's tracked competitors. */
|
|
2558
|
-
isCompetitor:
|
|
2762
|
+
isCompetitor: z22.boolean()
|
|
2559
2763
|
}))
|
|
2560
2764
|
});
|
|
2561
|
-
var gscQueryRowSchema =
|
|
2562
|
-
query:
|
|
2563
|
-
clicks:
|
|
2564
|
-
impressions:
|
|
2565
|
-
ctr:
|
|
2566
|
-
avgPosition:
|
|
2765
|
+
var gscQueryRowSchema = z22.object({
|
|
2766
|
+
query: z22.string(),
|
|
2767
|
+
clicks: z22.number(),
|
|
2768
|
+
impressions: z22.number(),
|
|
2769
|
+
ctr: z22.number(),
|
|
2770
|
+
avgPosition: z22.number(),
|
|
2567
2771
|
/** 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:
|
|
2772
|
+
category: z22.enum(["brand", "lead-gen", "industry", "other"])
|
|
2773
|
+
});
|
|
2774
|
+
var gscSectionSchema = z22.object({
|
|
2775
|
+
periodStart: z22.string(),
|
|
2776
|
+
periodEnd: z22.string(),
|
|
2777
|
+
totalClicks: z22.number(),
|
|
2778
|
+
totalImpressions: z22.number(),
|
|
2779
|
+
ctr: z22.number(),
|
|
2780
|
+
avgPosition: z22.number(),
|
|
2781
|
+
topQueries: z22.array(gscQueryRowSchema),
|
|
2782
|
+
categoryBreakdown: z22.array(z22.object({
|
|
2783
|
+
category: z22.enum(["brand", "lead-gen", "industry", "other"]),
|
|
2784
|
+
clicks: z22.number(),
|
|
2785
|
+
impressions: z22.number(),
|
|
2786
|
+
sharePct: z22.number()
|
|
2583
2787
|
})),
|
|
2584
|
-
trend:
|
|
2788
|
+
trend: z22.array(z22.object({ date: z22.string(), clicks: z22.number(), impressions: z22.number() })),
|
|
2585
2789
|
/**
|
|
2586
2790
|
* Tracked AEO queries that have no GSC impressions in the report window.
|
|
2587
2791
|
* Surfaces queries that may not represent real search demand.
|
|
2588
2792
|
*/
|
|
2589
|
-
trackedButNoGsc:
|
|
2793
|
+
trackedButNoGsc: z22.array(z22.string()),
|
|
2590
2794
|
/**
|
|
2591
2795
|
* GSC top queries (sorted by impressions desc) that are not tracked as
|
|
2592
2796
|
* AEO queries — the candidate set for adding to the AEO project.
|
|
2593
2797
|
*/
|
|
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:
|
|
2798
|
+
gscButNotTracked: z22.array(z22.string())
|
|
2799
|
+
});
|
|
2800
|
+
var gaTrafficSectionSchema = z22.object({
|
|
2801
|
+
totalSessions: z22.number(),
|
|
2802
|
+
totalUsers: z22.number(),
|
|
2803
|
+
totalOrganicSessions: z22.number(),
|
|
2804
|
+
periodStart: z22.string(),
|
|
2805
|
+
periodEnd: z22.string(),
|
|
2806
|
+
topLandingPages: z22.array(z22.object({
|
|
2807
|
+
page: z22.string(),
|
|
2808
|
+
sessions: z22.number(),
|
|
2809
|
+
users: z22.number(),
|
|
2810
|
+
organicSessions: z22.number()
|
|
2607
2811
|
})),
|
|
2608
|
-
channelBreakdown:
|
|
2609
|
-
channel:
|
|
2610
|
-
sessions:
|
|
2611
|
-
sharePct:
|
|
2812
|
+
channelBreakdown: z22.array(z22.object({
|
|
2813
|
+
channel: z22.string(),
|
|
2814
|
+
sessions: z22.number(),
|
|
2815
|
+
sharePct: z22.number()
|
|
2612
2816
|
}))
|
|
2613
2817
|
});
|
|
2614
|
-
var socialReferralSectionSchema =
|
|
2615
|
-
totalSessions:
|
|
2616
|
-
organicSessions:
|
|
2617
|
-
paidSessions:
|
|
2618
|
-
channels:
|
|
2619
|
-
channelGroup:
|
|
2620
|
-
sessions:
|
|
2621
|
-
sharePct:
|
|
2818
|
+
var socialReferralSectionSchema = z22.object({
|
|
2819
|
+
totalSessions: z22.number(),
|
|
2820
|
+
organicSessions: z22.number(),
|
|
2821
|
+
paidSessions: z22.number(),
|
|
2822
|
+
channels: z22.array(z22.object({
|
|
2823
|
+
channelGroup: z22.string(),
|
|
2824
|
+
sessions: z22.number(),
|
|
2825
|
+
sharePct: z22.number()
|
|
2622
2826
|
})),
|
|
2623
|
-
topCampaigns:
|
|
2624
|
-
source:
|
|
2625
|
-
medium:
|
|
2626
|
-
sessions:
|
|
2827
|
+
topCampaigns: z22.array(z22.object({
|
|
2828
|
+
source: z22.string(),
|
|
2829
|
+
medium: z22.string(),
|
|
2830
|
+
sessions: z22.number()
|
|
2627
2831
|
}))
|
|
2628
2832
|
});
|
|
2629
|
-
var aiReferralSectionSchema =
|
|
2630
|
-
totalSessions:
|
|
2631
|
-
totalUsers:
|
|
2632
|
-
bySource:
|
|
2633
|
-
source:
|
|
2634
|
-
sessions:
|
|
2635
|
-
users:
|
|
2636
|
-
sharePct:
|
|
2833
|
+
var aiReferralSectionSchema = z22.object({
|
|
2834
|
+
totalSessions: z22.number(),
|
|
2835
|
+
totalUsers: z22.number(),
|
|
2836
|
+
bySource: z22.array(z22.object({
|
|
2837
|
+
source: z22.string(),
|
|
2838
|
+
sessions: z22.number(),
|
|
2839
|
+
users: z22.number(),
|
|
2840
|
+
sharePct: z22.number()
|
|
2637
2841
|
})),
|
|
2638
|
-
trend:
|
|
2639
|
-
topLandingPages:
|
|
2640
|
-
page:
|
|
2641
|
-
sessions:
|
|
2642
|
-
users:
|
|
2842
|
+
trend: z22.array(z22.object({ date: z22.string(), sessions: z22.number() })),
|
|
2843
|
+
topLandingPages: z22.array(z22.object({
|
|
2844
|
+
page: z22.string(),
|
|
2845
|
+
sessions: z22.number(),
|
|
2846
|
+
users: z22.number()
|
|
2643
2847
|
}))
|
|
2644
2848
|
});
|
|
2645
|
-
var serverActivitySectionSchema =
|
|
2849
|
+
var serverActivitySectionSchema = z22.object({
|
|
2646
2850
|
/** ISO8601 inclusive lower bound of the report window (default: 7 days). */
|
|
2647
|
-
windowStart:
|
|
2851
|
+
windowStart: z22.string(),
|
|
2648
2852
|
/** ISO8601 inclusive upper bound. */
|
|
2649
|
-
windowEnd:
|
|
2650
|
-
hasData:
|
|
2853
|
+
windowEnd: z22.string(),
|
|
2854
|
+
hasData: z22.boolean(),
|
|
2651
2855
|
/** Last-7d total verified crawler hits, with prior 7d for delta. */
|
|
2652
|
-
verifiedCrawlerHits:
|
|
2856
|
+
verifiedCrawlerHits: z22.object({ current: z22.number(), prior: z22.number(), deltaPct: z22.number().nullable() }),
|
|
2653
2857
|
/** Last-7d total unverified crawler hits, separated from verified trust metrics. */
|
|
2654
|
-
unverifiedCrawlerHits:
|
|
2858
|
+
unverifiedCrawlerHits: z22.object({ current: z22.number(), prior: z22.number(), deltaPct: z22.number().nullable() }),
|
|
2655
2859
|
/**
|
|
2656
2860
|
* Last-7d on-demand per-user fetches from AI surfaces (ChatGPT-User,
|
|
2657
2861
|
* Perplexity-User, MistralAI-User). Disjoint from `verifiedCrawlerHits` /
|
|
@@ -2660,19 +2864,19 @@ var serverActivitySectionSchema = z21.object({
|
|
|
2660
2864
|
* because the operational question for user-fetch is "is this happening?"
|
|
2661
2865
|
* not "is this a confirmed bot identity?"
|
|
2662
2866
|
*/
|
|
2663
|
-
aiUserFetchHits:
|
|
2867
|
+
aiUserFetchHits: z22.object({ current: z22.number(), prior: z22.number(), deltaPct: z22.number().nullable() }),
|
|
2664
2868
|
/** Last-7d AI-referral sessions (sessionized from server-side request evidence). */
|
|
2665
|
-
referralArrivals:
|
|
2869
|
+
referralArrivals: z22.object({ current: z22.number(), prior: z22.number(), deltaPct: z22.number().nullable() }),
|
|
2666
2870
|
/** Per-AI-operator breakdown (OpenAI, Anthropic, Google AI, Perplexity, …). */
|
|
2667
|
-
byOperator:
|
|
2668
|
-
operator:
|
|
2669
|
-
verifiedHits:
|
|
2871
|
+
byOperator: z22.array(z22.object({
|
|
2872
|
+
operator: z22.string(),
|
|
2873
|
+
verifiedHits: z22.number(),
|
|
2670
2874
|
/** Shown to agency audience only: claimed-bot UA, source IP not in a published range. */
|
|
2671
|
-
unverifiedHits:
|
|
2875
|
+
unverifiedHits: z22.number(),
|
|
2672
2876
|
/** Per-user fetches from this operator's AI surface (ChatGPT-User, …). */
|
|
2673
|
-
userFetchHits:
|
|
2674
|
-
referralArrivals:
|
|
2675
|
-
deltaPct:
|
|
2877
|
+
userFetchHits: z22.number(),
|
|
2878
|
+
referralArrivals: z22.number(),
|
|
2879
|
+
deltaPct: z22.number().nullable()
|
|
2676
2880
|
})),
|
|
2677
2881
|
/**
|
|
2678
2882
|
* Top crawled paths (verified only, last-7d). Path-level citation cross-reference
|
|
@@ -2682,84 +2886,84 @@ var serverActivitySectionSchema = z21.object({
|
|
|
2682
2886
|
* citation evidence can extend this entry with a `citationState` field without
|
|
2683
2887
|
* breaking the contract.
|
|
2684
2888
|
*/
|
|
2685
|
-
topCrawledPaths:
|
|
2686
|
-
path:
|
|
2687
|
-
verifiedHits:
|
|
2889
|
+
topCrawledPaths: z22.array(z22.object({
|
|
2890
|
+
path: z22.string(),
|
|
2891
|
+
verifiedHits: z22.number(),
|
|
2688
2892
|
/** How many distinct AI operators crawled this path in the window. */
|
|
2689
|
-
distinctOperators:
|
|
2893
|
+
distinctOperators: z22.number()
|
|
2690
2894
|
})),
|
|
2691
2895
|
/** AI products that sent ≥1 session in the window (referral by destination). */
|
|
2692
|
-
referralProducts:
|
|
2693
|
-
product:
|
|
2694
|
-
arrivals:
|
|
2695
|
-
distinctLandingPaths:
|
|
2896
|
+
referralProducts: z22.array(z22.object({
|
|
2897
|
+
product: z22.string(),
|
|
2898
|
+
arrivals: z22.number(),
|
|
2899
|
+
distinctLandingPaths: z22.number()
|
|
2696
2900
|
})),
|
|
2697
2901
|
/** Daily trend, last 14d for sparkline / chart rendering. */
|
|
2698
|
-
dailyTrend:
|
|
2699
|
-
date:
|
|
2700
|
-
verifiedCrawlerHits:
|
|
2701
|
-
userFetchHits:
|
|
2702
|
-
referralArrivals:
|
|
2902
|
+
dailyTrend: z22.array(z22.object({
|
|
2903
|
+
date: z22.string(),
|
|
2904
|
+
verifiedCrawlerHits: z22.number(),
|
|
2905
|
+
userFetchHits: z22.number(),
|
|
2906
|
+
referralArrivals: z22.number()
|
|
2703
2907
|
})),
|
|
2704
2908
|
/**
|
|
2705
2909
|
* Top landing paths for AI-referral sessions (last-7d).
|
|
2706
2910
|
* Complements `topCrawledPaths` (what bots fetch) with what humans actually land on.
|
|
2707
2911
|
*/
|
|
2708
|
-
topReferralLandingPaths:
|
|
2709
|
-
path:
|
|
2710
|
-
arrivals:
|
|
2711
|
-
distinctProducts:
|
|
2912
|
+
topReferralLandingPaths: z22.array(z22.object({
|
|
2913
|
+
path: z22.string(),
|
|
2914
|
+
arrivals: z22.number(),
|
|
2915
|
+
distinctProducts: z22.number()
|
|
2712
2916
|
}))
|
|
2713
2917
|
});
|
|
2714
|
-
var indexingHealthSectionSchema =
|
|
2918
|
+
var indexingHealthSectionSchema = z22.object({
|
|
2715
2919
|
/** Source: 'google' | 'bing' | null when neither is connected. */
|
|
2716
|
-
provider:
|
|
2717
|
-
total:
|
|
2718
|
-
indexed:
|
|
2719
|
-
notIndexed:
|
|
2920
|
+
provider: z22.enum(["google", "bing"]).nullable(),
|
|
2921
|
+
total: z22.number(),
|
|
2922
|
+
indexed: z22.number(),
|
|
2923
|
+
notIndexed: z22.number(),
|
|
2720
2924
|
/** Google-only — pages explicitly marked as deindexed. Bing reports 'unknown' instead. */
|
|
2721
|
-
deindexed:
|
|
2925
|
+
deindexed: z22.number(),
|
|
2722
2926
|
/** Bing-only — pages with no inspection data yet. */
|
|
2723
|
-
unknown:
|
|
2927
|
+
unknown: z22.number(),
|
|
2724
2928
|
/** 0..100. */
|
|
2725
|
-
indexedPct:
|
|
2929
|
+
indexedPct: z22.number()
|
|
2726
2930
|
});
|
|
2727
|
-
var citationsTrendPointSchema =
|
|
2931
|
+
var citationsTrendPointSchema = z22.object({
|
|
2728
2932
|
/** Run ID — anchor for cross-section linking. */
|
|
2729
|
-
runId:
|
|
2933
|
+
runId: z22.string(),
|
|
2730
2934
|
/** ISO timestamp when the run finished (or createdAt fallback). */
|
|
2731
|
-
date:
|
|
2935
|
+
date: z22.string(),
|
|
2732
2936
|
/**
|
|
2733
2937
|
* 0..100 — same per-query unique-cited definition as
|
|
2734
2938
|
* `ReportExecutiveSummary.citationRate`. Stable across runs with different
|
|
2735
2939
|
* provider counts so the trend line measures real movement rather than
|
|
2736
2940
|
* provider-count variance.
|
|
2737
2941
|
*/
|
|
2738
|
-
citationRate:
|
|
2942
|
+
citationRate: z22.number(),
|
|
2739
2943
|
/** Numerator of `citationRate` for this run. */
|
|
2740
|
-
citedQueryCount:
|
|
2944
|
+
citedQueryCount: z22.number(),
|
|
2741
2945
|
/** Denominator of `citationRate` for this run. */
|
|
2742
|
-
totalQueryCount:
|
|
2946
|
+
totalQueryCount: z22.number(),
|
|
2743
2947
|
/** 0..100 — same per-query unique-mentioned definition as `ReportExecutiveSummary.mentionRate`. */
|
|
2744
|
-
mentionRate:
|
|
2948
|
+
mentionRate: z22.number(),
|
|
2745
2949
|
/** Numerator of `mentionRate` for this run. */
|
|
2746
|
-
mentionedQueryCount:
|
|
2950
|
+
mentionedQueryCount: z22.number(),
|
|
2747
2951
|
/**
|
|
2748
2952
|
* Per-provider rates for the same run. Each provider's rate is per-pair
|
|
2749
2953
|
* within that provider (`cited / scanned`), so it remains comparable
|
|
2750
2954
|
* between providers in the same run.
|
|
2751
2955
|
*/
|
|
2752
|
-
providerRates:
|
|
2753
|
-
});
|
|
2754
|
-
var reportInsightSchema =
|
|
2755
|
-
id:
|
|
2756
|
-
type:
|
|
2757
|
-
severity:
|
|
2758
|
-
title:
|
|
2759
|
-
query:
|
|
2760
|
-
provider:
|
|
2761
|
-
recommendation:
|
|
2762
|
-
createdAt:
|
|
2956
|
+
providerRates: z22.array(z22.object({ provider: z22.string(), citationRate: z22.number() }))
|
|
2957
|
+
});
|
|
2958
|
+
var reportInsightSchema = z22.object({
|
|
2959
|
+
id: z22.string(),
|
|
2960
|
+
type: z22.enum(["regression", "gain", "opportunity"]),
|
|
2961
|
+
severity: z22.enum(["critical", "high", "medium", "low"]),
|
|
2962
|
+
title: z22.string(),
|
|
2963
|
+
query: z22.string(),
|
|
2964
|
+
provider: z22.string(),
|
|
2965
|
+
recommendation: z22.string().nullable(),
|
|
2966
|
+
createdAt: z22.string(),
|
|
2763
2967
|
/**
|
|
2764
2968
|
* How many times this insight fired across recent runs for the same
|
|
2765
2969
|
* `(query, provider, type)` tuple. Always ≥ 1. Insights returned by the
|
|
@@ -2767,57 +2971,57 @@ var reportInsightSchema = z21.object({
|
|
|
2767
2971
|
* surfacing the multiplicity. Use it directly instead of grouping again
|
|
2768
2972
|
* client-side — counts derived from raw insight rows will overcount.
|
|
2769
2973
|
*/
|
|
2770
|
-
instanceCount:
|
|
2974
|
+
instanceCount: z22.number()
|
|
2771
2975
|
});
|
|
2772
|
-
var recommendedNextStepSchema =
|
|
2976
|
+
var recommendedNextStepSchema = z22.object({
|
|
2773
2977
|
/** 'immediate' | 'short-term' | 'medium-term' — bucketed by severity heuristic. */
|
|
2774
|
-
horizon:
|
|
2775
|
-
title:
|
|
2776
|
-
rationale:
|
|
2978
|
+
horizon: z22.enum(["immediate", "short-term", "medium-term"]),
|
|
2979
|
+
title: z22.string(),
|
|
2980
|
+
rationale: z22.string()
|
|
2777
2981
|
});
|
|
2778
|
-
var reportRateDeltaSchema =
|
|
2982
|
+
var reportRateDeltaSchema = z22.object({
|
|
2779
2983
|
/** Current value (0..100 for rates, raw count otherwise). When `window`
|
|
2780
2984
|
* is present this is the average over the last `window` checks. */
|
|
2781
|
-
current:
|
|
2985
|
+
current: z22.number(),
|
|
2782
2986
|
/** Prior value compared against. When `window` is present this is the
|
|
2783
2987
|
* average over the prior `window` checks before that. */
|
|
2784
|
-
prior:
|
|
2988
|
+
prior: z22.number(),
|
|
2785
2989
|
/** Absolute delta (current − prior). Negative = decrease. */
|
|
2786
|
-
deltaAbs:
|
|
2990
|
+
deltaAbs: z22.number(),
|
|
2787
2991
|
/**
|
|
2788
2992
|
* Direction tag for tone mapping. Threshold is metric-specific (3pp for
|
|
2789
2993
|
* rates, 0.5 for counts) so small noise lands as 'flat' rather than
|
|
2790
2994
|
* flipping up/down each run.
|
|
2791
2995
|
*/
|
|
2792
|
-
direction:
|
|
2996
|
+
direction: z22.enum(["up", "down", "flat"]),
|
|
2793
2997
|
/**
|
|
2794
2998
|
* How many points went into each side of the average. Omitted (or 1)
|
|
2795
2999
|
* means point-to-point (legacy "since last check"). Higher values mean
|
|
2796
3000
|
* a rolling-average comparison — renderers should label it as
|
|
2797
3001
|
* "vs prior N checks" when this is ≥ 2.
|
|
2798
3002
|
*/
|
|
2799
|
-
window:
|
|
3003
|
+
window: z22.number().optional()
|
|
2800
3004
|
});
|
|
2801
|
-
var reportProviderMovementSchema =
|
|
2802
|
-
provider:
|
|
2803
|
-
current:
|
|
2804
|
-
prior:
|
|
2805
|
-
deltaAbs:
|
|
2806
|
-
direction:
|
|
3005
|
+
var reportProviderMovementSchema = z22.object({
|
|
3006
|
+
provider: z22.string(),
|
|
3007
|
+
current: z22.number(),
|
|
3008
|
+
prior: z22.number(),
|
|
3009
|
+
deltaAbs: z22.number(),
|
|
3010
|
+
direction: z22.enum(["up", "down", "flat"])
|
|
2807
3011
|
});
|
|
2808
|
-
var whatsChangedSectionSchema =
|
|
3012
|
+
var whatsChangedSectionSchema = z22.object({
|
|
2809
3013
|
/**
|
|
2810
3014
|
* False when there's no prior run (or fewer than the trend baseline),
|
|
2811
3015
|
* meaning all per-metric deltas will be null. Renderers use this to swap
|
|
2812
3016
|
* in a "establishing baseline" fallback rather than rendering empty
|
|
2813
3017
|
* delta tiles.
|
|
2814
3018
|
*/
|
|
2815
|
-
enoughHistory:
|
|
3019
|
+
enoughHistory: z22.boolean(),
|
|
2816
3020
|
/**
|
|
2817
3021
|
* One-sentence narrative summary suitable as a section subtitle.
|
|
2818
3022
|
* Always present — even on baseline, narrates whatever signal exists.
|
|
2819
3023
|
*/
|
|
2820
|
-
headline:
|
|
3024
|
+
headline: z22.string(),
|
|
2821
3025
|
/** Citation rate delta vs the prior completed run. Null when no prior run. */
|
|
2822
3026
|
citationRate: reportRateDeltaSchema.nullable(),
|
|
2823
3027
|
/** Mention rate delta vs the prior completed run. Null when no prior run. */
|
|
@@ -2840,24 +3044,24 @@ var whatsChangedSectionSchema = z21.object({
|
|
|
2840
3044
|
* when no prior run. Sorted by |deltaAbs| desc — providers with the
|
|
2841
3045
|
* biggest swing first.
|
|
2842
3046
|
*/
|
|
2843
|
-
providerMovements:
|
|
3047
|
+
providerMovements: z22.array(reportProviderMovementSchema),
|
|
2844
3048
|
/**
|
|
2845
3049
|
* Top wins this period — gains surfaced by the intelligence engine.
|
|
2846
3050
|
* Capped at 5; sourced from `insights` filtered to `type: 'gain'`.
|
|
2847
3051
|
*/
|
|
2848
|
-
wins:
|
|
3052
|
+
wins: z22.array(reportInsightSchema),
|
|
2849
3053
|
/**
|
|
2850
3054
|
* Top regressions this period — citations or mentions lost. Capped at 5;
|
|
2851
3055
|
* sourced from `insights` filtered to `type: 'regression'`.
|
|
2852
3056
|
*/
|
|
2853
|
-
regressions:
|
|
2854
|
-
});
|
|
2855
|
-
var reportAudienceSchema =
|
|
2856
|
-
var reportActionAudienceSchema =
|
|
2857
|
-
var reportActionHorizonSchema =
|
|
2858
|
-
var reportActionConfidenceSchema =
|
|
2859
|
-
var reportToneSchema =
|
|
2860
|
-
var reportActionCategorySchema =
|
|
3057
|
+
regressions: z22.array(reportInsightSchema)
|
|
3058
|
+
});
|
|
3059
|
+
var reportAudienceSchema = z22.enum(["agency", "client"]);
|
|
3060
|
+
var reportActionAudienceSchema = z22.enum(["agency", "client", "both"]);
|
|
3061
|
+
var reportActionHorizonSchema = z22.enum(["immediate", "short-term", "medium-term"]);
|
|
3062
|
+
var reportActionConfidenceSchema = z22.enum(["high", "medium", "low"]);
|
|
3063
|
+
var reportToneSchema = z22.enum(["positive", "caution", "negative", "neutral"]);
|
|
3064
|
+
var reportActionCategorySchema = z22.enum([
|
|
2861
3065
|
"content",
|
|
2862
3066
|
"competitors",
|
|
2863
3067
|
"provider",
|
|
@@ -2866,23 +3070,23 @@ var reportActionCategorySchema = z21.enum([
|
|
|
2866
3070
|
"location",
|
|
2867
3071
|
"monitoring"
|
|
2868
3072
|
]);
|
|
2869
|
-
var reportActionPlanItemSchema =
|
|
3073
|
+
var reportActionPlanItemSchema = z22.object({
|
|
2870
3074
|
/** Which report audience should see this action. `both` renders in both modes. */
|
|
2871
3075
|
audience: reportActionAudienceSchema,
|
|
2872
3076
|
/** Stable sort priority. Lower numbers render earlier. */
|
|
2873
|
-
priority:
|
|
3077
|
+
priority: z22.number(),
|
|
2874
3078
|
/** When this should be tackled. */
|
|
2875
3079
|
horizon: reportActionHorizonSchema,
|
|
2876
3080
|
category: reportActionCategorySchema,
|
|
2877
|
-
title:
|
|
3081
|
+
title: z22.string(),
|
|
2878
3082
|
/** Direct next step written as an operator/client-friendly imperative. */
|
|
2879
|
-
action:
|
|
3083
|
+
action: z22.string(),
|
|
2880
3084
|
/** Why this matters. Keep each entry concise and evidence-backed. */
|
|
2881
|
-
why:
|
|
3085
|
+
why: z22.array(z22.string()),
|
|
2882
3086
|
/** Specific observations that justify the action. */
|
|
2883
|
-
evidence:
|
|
3087
|
+
evidence: z22.array(z22.string()),
|
|
2884
3088
|
/** What should move if the action worked. */
|
|
2885
|
-
successMetric:
|
|
3089
|
+
successMetric: z22.string(),
|
|
2886
3090
|
/** Confidence in the recommendation based on the available evidence. */
|
|
2887
3091
|
confidence: reportActionConfidenceSchema,
|
|
2888
3092
|
/**
|
|
@@ -2894,23 +3098,23 @@ var reportActionPlanItemSchema = z21.object({
|
|
|
2894
3098
|
* load. Actions sourced from other signals (competitor gaps, indexing
|
|
2895
3099
|
* issues, etc.) omit this and use their own dismiss flows.
|
|
2896
3100
|
*/
|
|
2897
|
-
targetRef:
|
|
3101
|
+
targetRef: z22.string().optional()
|
|
2898
3102
|
});
|
|
2899
|
-
var reportClientSummarySchema =
|
|
2900
|
-
headline:
|
|
2901
|
-
overview:
|
|
2902
|
-
actionItems:
|
|
2903
|
-
confidenceNotes:
|
|
3103
|
+
var reportClientSummarySchema = z22.object({
|
|
3104
|
+
headline: z22.string(),
|
|
3105
|
+
overview: z22.string(),
|
|
3106
|
+
actionItems: z22.array(reportActionPlanItemSchema),
|
|
3107
|
+
confidenceNotes: z22.array(z22.string())
|
|
2904
3108
|
});
|
|
2905
|
-
var reportAgencyDiagnosticSchema =
|
|
2906
|
-
title:
|
|
2907
|
-
detail:
|
|
2908
|
-
severity:
|
|
2909
|
-
evidence:
|
|
3109
|
+
var reportAgencyDiagnosticSchema = z22.object({
|
|
3110
|
+
title: z22.string(),
|
|
3111
|
+
detail: z22.string(),
|
|
3112
|
+
severity: z22.enum(["positive", "caution", "negative", "neutral"]),
|
|
3113
|
+
evidence: z22.array(z22.string())
|
|
2910
3114
|
});
|
|
2911
|
-
var reportAgencyDiagnosticsSchema =
|
|
2912
|
-
priorities:
|
|
2913
|
-
diagnostics:
|
|
3115
|
+
var reportAgencyDiagnosticsSchema = z22.object({
|
|
3116
|
+
priorities: z22.array(reportActionPlanItemSchema),
|
|
3117
|
+
diagnostics: z22.array(reportAgencyDiagnosticSchema)
|
|
2914
3118
|
});
|
|
2915
3119
|
function reportActionTone(action) {
|
|
2916
3120
|
if (action.horizon === "immediate") return "negative";
|
|
@@ -2968,7 +3172,7 @@ function reportConfidenceLabel(confidence) {
|
|
|
2968
3172
|
return "Low";
|
|
2969
3173
|
}
|
|
2970
3174
|
}
|
|
2971
|
-
var projectReportDtoSchema =
|
|
3175
|
+
var projectReportDtoSchema = z22.object({
|
|
2972
3176
|
meta: reportMetaSchema,
|
|
2973
3177
|
executiveSummary: reportExecutiveSummarySchema,
|
|
2974
3178
|
citationScorecard: citationScorecardSchema,
|
|
@@ -2982,16 +3186,16 @@ var projectReportDtoSchema = z21.object({
|
|
|
2982
3186
|
/** Server-side log-evidence visibility (crawls + click-through sessions). Null when no traffic source connected. */
|
|
2983
3187
|
serverActivity: serverActivitySectionSchema.nullable(),
|
|
2984
3188
|
indexingHealth: indexingHealthSectionSchema.nullable(),
|
|
2985
|
-
citationsTrend:
|
|
3189
|
+
citationsTrend: z22.array(citationsTrendPointSchema),
|
|
2986
3190
|
/**
|
|
2987
3191
|
* Trend-focused "what's changed" summary for the report's act 2. Always
|
|
2988
3192
|
* present; renderers gate empty/baseline states via `enoughHistory`.
|
|
2989
3193
|
*/
|
|
2990
3194
|
whatsChanged: whatsChangedSectionSchema,
|
|
2991
|
-
insights:
|
|
2992
|
-
recommendedNextSteps:
|
|
3195
|
+
insights: z22.array(reportInsightSchema),
|
|
3196
|
+
recommendedNextSteps: z22.array(recommendedNextStepSchema),
|
|
2993
3197
|
/** Canonical structured actions shared by the client and agency render modes. */
|
|
2994
|
-
actionPlan:
|
|
3198
|
+
actionPlan: z22.array(reportActionPlanItemSchema),
|
|
2995
3199
|
/** Polished client-facing summary and action shortlist. */
|
|
2996
3200
|
clientSummary: reportClientSummarySchema,
|
|
2997
3201
|
/** Technical, evidence-oriented operator diagnostics for agency mode. */
|
|
@@ -3001,17 +3205,17 @@ var projectReportDtoSchema = z21.object({
|
|
|
3001
3205
|
* intelligence layer (`buildContentTargetRows`). Empty when no run has
|
|
3002
3206
|
* produced candidate queries with demand or competitor signal.
|
|
3003
3207
|
*/
|
|
3004
|
-
contentOpportunities:
|
|
3208
|
+
contentOpportunities: z22.array(contentTargetRowDtoSchema),
|
|
3005
3209
|
/**
|
|
3006
3210
|
* Queries where competitors were cited but the project was not. Sourced
|
|
3007
3211
|
* from `buildContentGapRows`. Empty until the first answer-visibility run.
|
|
3008
3212
|
*/
|
|
3009
|
-
contentGaps:
|
|
3213
|
+
contentGaps: z22.array(contentGapRowDtoSchema),
|
|
3010
3214
|
/**
|
|
3011
3215
|
* Per-query grounding source map (own + competitor cited URLs). Sourced
|
|
3012
3216
|
* from `buildContentSourceRows`. Empty until the first answer-visibility run.
|
|
3013
3217
|
*/
|
|
3014
|
-
groundingSources:
|
|
3218
|
+
groundingSources: z22.array(contentSourceRowDtoSchema)
|
|
3015
3219
|
});
|
|
3016
3220
|
|
|
3017
3221
|
// ../contracts/src/report-dedup.ts
|
|
@@ -3082,15 +3286,29 @@ function dedupeReportOpportunities(report) {
|
|
|
3082
3286
|
}
|
|
3083
3287
|
|
|
3084
3288
|
// ../contracts/src/skills.ts
|
|
3085
|
-
import { z as
|
|
3086
|
-
var codingAgentSchema =
|
|
3289
|
+
import { z as z23 } from "zod";
|
|
3290
|
+
var codingAgentSchema = z23.enum(["claude", "codex"]);
|
|
3087
3291
|
var CodingAgents = codingAgentSchema.enum;
|
|
3088
|
-
var skillsClientSchema =
|
|
3292
|
+
var skillsClientSchema = z23.enum(["claude", "codex", "all"]);
|
|
3089
3293
|
var SkillsClients = skillsClientSchema.enum;
|
|
3294
|
+
var SKILL_MANIFEST_FILENAME = ".canonry-skill-manifest.json";
|
|
3295
|
+
function classifySkillFile(params) {
|
|
3296
|
+
const { bundledHash, installedHash, manifestHash } = params;
|
|
3297
|
+
if (installedHash == null) return "missing";
|
|
3298
|
+
if (installedHash === bundledHash) return "unchanged";
|
|
3299
|
+
if (manifestHash != null && installedHash === manifestHash) return "stale";
|
|
3300
|
+
return "edited";
|
|
3301
|
+
}
|
|
3302
|
+
function coerceSkillManifest(parsed) {
|
|
3303
|
+
if (parsed != null && typeof parsed === "object" && typeof parsed.files === "object" && parsed.files !== null) {
|
|
3304
|
+
return parsed;
|
|
3305
|
+
}
|
|
3306
|
+
return null;
|
|
3307
|
+
}
|
|
3090
3308
|
|
|
3091
3309
|
// ../contracts/src/traffic.ts
|
|
3092
|
-
import { z as
|
|
3093
|
-
var trafficSourceTypeSchema =
|
|
3310
|
+
import { z as z24 } from "zod";
|
|
3311
|
+
var trafficSourceTypeSchema = z24.enum([
|
|
3094
3312
|
"cloud-run",
|
|
3095
3313
|
"wordpress",
|
|
3096
3314
|
"cloudflare",
|
|
@@ -3098,7 +3316,7 @@ var trafficSourceTypeSchema = z23.enum([
|
|
|
3098
3316
|
"generic-log"
|
|
3099
3317
|
]);
|
|
3100
3318
|
var TrafficSourceTypes = trafficSourceTypeSchema.enum;
|
|
3101
|
-
var trafficAdapterCapabilitySchema =
|
|
3319
|
+
var trafficAdapterCapabilitySchema = z24.enum([
|
|
3102
3320
|
"raw-request-events",
|
|
3103
3321
|
"aggregate-request-metrics",
|
|
3104
3322
|
"request-url",
|
|
@@ -3109,217 +3327,217 @@ var trafficAdapterCapabilitySchema = z23.enum([
|
|
|
3109
3327
|
"cursor-pull"
|
|
3110
3328
|
]);
|
|
3111
3329
|
var TrafficAdapterCapabilities = trafficAdapterCapabilitySchema.enum;
|
|
3112
|
-
var trafficEvidenceKindSchema =
|
|
3330
|
+
var trafficEvidenceKindSchema = z24.enum(["raw-request", "aggregate-bucket"]);
|
|
3113
3331
|
var TrafficEvidenceKinds = trafficEvidenceKindSchema.enum;
|
|
3114
|
-
var trafficEventConfidenceSchema =
|
|
3332
|
+
var trafficEventConfidenceSchema = z24.enum(["observed", "provider-aggregated", "inferred"]);
|
|
3115
3333
|
var TrafficEventConfidences = trafficEventConfidenceSchema.enum;
|
|
3116
|
-
var trafficProviderResourceSchema =
|
|
3117
|
-
type:
|
|
3118
|
-
labels:
|
|
3334
|
+
var trafficProviderResourceSchema = z24.object({
|
|
3335
|
+
type: z24.string().nullable(),
|
|
3336
|
+
labels: z24.record(z24.string(), z24.string())
|
|
3119
3337
|
});
|
|
3120
|
-
var normalizedTrafficRequestSchema =
|
|
3338
|
+
var normalizedTrafficRequestSchema = z24.object({
|
|
3121
3339
|
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:
|
|
3340
|
+
evidenceKind: z24.literal(TrafficEvidenceKinds["raw-request"]),
|
|
3341
|
+
confidence: z24.literal(TrafficEventConfidences.observed),
|
|
3342
|
+
eventId: z24.string().min(1),
|
|
3343
|
+
observedAt: z24.string().min(1),
|
|
3344
|
+
method: z24.string().nullable(),
|
|
3345
|
+
requestUrl: z24.string().nullable(),
|
|
3346
|
+
host: z24.string().nullable(),
|
|
3347
|
+
path: z24.string().min(1),
|
|
3348
|
+
queryString: z24.string().nullable(),
|
|
3349
|
+
status: z24.number().int().nullable(),
|
|
3350
|
+
userAgent: z24.string().nullable(),
|
|
3351
|
+
remoteIp: z24.string().nullable(),
|
|
3352
|
+
referer: z24.string().nullable(),
|
|
3353
|
+
latencyMs: z24.number().nullable(),
|
|
3354
|
+
requestSizeBytes: z24.number().int().nullable(),
|
|
3355
|
+
responseSizeBytes: z24.number().int().nullable(),
|
|
3138
3356
|
providerResource: trafficProviderResourceSchema,
|
|
3139
|
-
providerLabels:
|
|
3357
|
+
providerLabels: z24.record(z24.string(), z24.string())
|
|
3140
3358
|
});
|
|
3141
|
-
var normalizedTrafficPullPageSchema =
|
|
3142
|
-
events:
|
|
3143
|
-
rawEntryCount:
|
|
3144
|
-
skippedEntryCount:
|
|
3145
|
-
nextPageToken:
|
|
3146
|
-
filter:
|
|
3359
|
+
var normalizedTrafficPullPageSchema = z24.object({
|
|
3360
|
+
events: z24.array(normalizedTrafficRequestSchema),
|
|
3361
|
+
rawEntryCount: z24.number().int().nonnegative(),
|
|
3362
|
+
skippedEntryCount: z24.number().int().nonnegative(),
|
|
3363
|
+
nextPageToken: z24.string().optional(),
|
|
3364
|
+
filter: z24.string()
|
|
3147
3365
|
});
|
|
3148
|
-
var trafficSourceStatusSchema =
|
|
3366
|
+
var trafficSourceStatusSchema = z24.enum(["connected", "paused", "error", "archived"]);
|
|
3149
3367
|
var TrafficSourceStatuses = trafficSourceStatusSchema.enum;
|
|
3150
|
-
var trafficSourceAuthModeSchema =
|
|
3368
|
+
var trafficSourceAuthModeSchema = z24.enum(["oauth", "service-account"]);
|
|
3151
3369
|
var TrafficSourceAuthModes = trafficSourceAuthModeSchema.enum;
|
|
3152
|
-
var verificationStatusSchema =
|
|
3370
|
+
var verificationStatusSchema = z24.enum(["verified", "claimed_unverified", "unknown_ai_like"]);
|
|
3153
3371
|
var VerificationStatuses = verificationStatusSchema.enum;
|
|
3154
|
-
var cloudRunSourceConfigSchema =
|
|
3155
|
-
gcpProjectId:
|
|
3156
|
-
serviceName:
|
|
3157
|
-
location:
|
|
3372
|
+
var cloudRunSourceConfigSchema = z24.object({
|
|
3373
|
+
gcpProjectId: z24.string().min(1),
|
|
3374
|
+
serviceName: z24.string().nullable().optional(),
|
|
3375
|
+
location: z24.string().nullable().optional(),
|
|
3158
3376
|
authMode: trafficSourceAuthModeSchema
|
|
3159
3377
|
});
|
|
3160
|
-
var wordpressTrafficSourceConfigSchema =
|
|
3161
|
-
baseUrl:
|
|
3162
|
-
username:
|
|
3378
|
+
var wordpressTrafficSourceConfigSchema = z24.object({
|
|
3379
|
+
baseUrl: z24.string().url(),
|
|
3380
|
+
username: z24.string().min(1)
|
|
3163
3381
|
});
|
|
3164
|
-
var vercelTrafficEnvironmentSchema =
|
|
3382
|
+
var vercelTrafficEnvironmentSchema = z24.enum(["production", "preview"]);
|
|
3165
3383
|
var VercelTrafficEnvironments = vercelTrafficEnvironmentSchema.enum;
|
|
3166
|
-
var vercelTrafficSourceConfigSchema =
|
|
3384
|
+
var vercelTrafficSourceConfigSchema = z24.object({
|
|
3167
3385
|
/** Vercel project id (e.g. `prj_...`). */
|
|
3168
|
-
projectId:
|
|
3386
|
+
projectId: z24.string().min(1),
|
|
3169
3387
|
/** Vercel team or account id: the org that owns the project. */
|
|
3170
|
-
teamId:
|
|
3388
|
+
teamId: z24.string().min(1),
|
|
3171
3389
|
environment: vercelTrafficEnvironmentSchema
|
|
3172
3390
|
});
|
|
3173
|
-
var trafficSourceDtoSchema =
|
|
3174
|
-
id:
|
|
3175
|
-
projectId:
|
|
3391
|
+
var trafficSourceDtoSchema = z24.object({
|
|
3392
|
+
id: z24.string(),
|
|
3393
|
+
projectId: z24.string(),
|
|
3176
3394
|
sourceType: trafficSourceTypeSchema,
|
|
3177
|
-
displayName:
|
|
3395
|
+
displayName: z24.string(),
|
|
3178
3396
|
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:
|
|
3397
|
+
lastSyncedAt: z24.string().nullable(),
|
|
3398
|
+
lastCursor: z24.string().nullable(),
|
|
3399
|
+
lastError: z24.string().nullable(),
|
|
3400
|
+
archivedAt: z24.string().nullable(),
|
|
3401
|
+
config: z24.record(z24.string(), z24.unknown()),
|
|
3402
|
+
createdAt: z24.string(),
|
|
3403
|
+
updatedAt: z24.string()
|
|
3404
|
+
});
|
|
3405
|
+
var trafficConnectCloudRunRequestSchema = z24.object({
|
|
3406
|
+
gcpProjectId: z24.string().min(1),
|
|
3407
|
+
serviceName: z24.string().min(1).optional(),
|
|
3408
|
+
location: z24.string().min(1).optional(),
|
|
3409
|
+
displayName: z24.string().min(1).optional(),
|
|
3192
3410
|
/** Service-account JSON content (string). When omitted, defaults to OAuth via `canonry google connect <project> --type ga4` flow. */
|
|
3193
|
-
keyJson:
|
|
3411
|
+
keyJson: z24.string().optional()
|
|
3194
3412
|
});
|
|
3195
|
-
var trafficConnectWordpressRequestSchema =
|
|
3196
|
-
baseUrl:
|
|
3197
|
-
username:
|
|
3413
|
+
var trafficConnectWordpressRequestSchema = z24.object({
|
|
3414
|
+
baseUrl: z24.string().url(),
|
|
3415
|
+
username: z24.string().min(1),
|
|
3198
3416
|
/** WordPress Application Password (the same auth used by the content client). */
|
|
3199
|
-
applicationPassword:
|
|
3200
|
-
displayName:
|
|
3417
|
+
applicationPassword: z24.string().min(1),
|
|
3418
|
+
displayName: z24.string().min(1).optional()
|
|
3201
3419
|
});
|
|
3202
|
-
var trafficConnectVercelRequestSchema =
|
|
3420
|
+
var trafficConnectVercelRequestSchema = z24.object({
|
|
3203
3421
|
/** Vercel project id (e.g. `prj_...`) — from the Vercel dashboard or `.vercel/project.json`. */
|
|
3204
|
-
projectId:
|
|
3422
|
+
projectId: z24.string().min(1),
|
|
3205
3423
|
/** Vercel team or account id: the org that owns the project ("orgId" in .vercel/project.json). */
|
|
3206
|
-
teamId:
|
|
3424
|
+
teamId: z24.string().min(1),
|
|
3207
3425
|
/** Vercel personal access token. Stored in `~/.canonry/config.yaml`, never the DB. */
|
|
3208
|
-
token:
|
|
3426
|
+
token: z24.string().min(1),
|
|
3209
3427
|
/** Which deployment environment's request logs to pull. Default: `production`. */
|
|
3210
3428
|
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 =
|
|
3429
|
+
displayName: z24.string().min(1).optional()
|
|
3430
|
+
});
|
|
3431
|
+
var trafficSyncResponseSchema = z24.object({
|
|
3432
|
+
sourceId: z24.string(),
|
|
3433
|
+
runId: z24.string(),
|
|
3434
|
+
syncedAt: z24.string(),
|
|
3435
|
+
pulledEvents: z24.number().int().nonnegative(),
|
|
3436
|
+
crawlerHits: z24.number().int().nonnegative(),
|
|
3437
|
+
aiUserFetchHits: z24.number().int().nonnegative(),
|
|
3438
|
+
aiReferralHits: z24.number().int().nonnegative(),
|
|
3439
|
+
unknownHits: z24.number().int().nonnegative(),
|
|
3440
|
+
crawlerBucketRows: z24.number().int().nonnegative(),
|
|
3441
|
+
aiUserFetchBucketRows: z24.number().int().nonnegative(),
|
|
3442
|
+
aiReferralBucketRows: z24.number().int().nonnegative(),
|
|
3443
|
+
sampleRows: z24.number().int().nonnegative(),
|
|
3444
|
+
windowStart: z24.string(),
|
|
3445
|
+
windowEnd: z24.string()
|
|
3446
|
+
});
|
|
3447
|
+
var trafficBackfillRequestSchema = z24.object({
|
|
3230
3448
|
/** Lookback window in days. Capped server-side at the upstream log retention ceiling (Cloud Logging _Default = 30d). Default: 30. */
|
|
3231
|
-
days:
|
|
3449
|
+
days: z24.number().int().positive().optional()
|
|
3232
3450
|
});
|
|
3233
|
-
var trafficResetRequestSchema =
|
|
3234
|
-
advanceToNow:
|
|
3451
|
+
var trafficResetRequestSchema = z24.object({
|
|
3452
|
+
advanceToNow: z24.literal(true)
|
|
3235
3453
|
});
|
|
3236
|
-
var trafficBackfillResponseSchema =
|
|
3237
|
-
sourceId:
|
|
3238
|
-
runId:
|
|
3454
|
+
var trafficBackfillResponseSchema = z24.object({
|
|
3455
|
+
sourceId: z24.string(),
|
|
3456
|
+
runId: z24.string(),
|
|
3239
3457
|
status: runStatusSchema,
|
|
3240
|
-
windowStart:
|
|
3241
|
-
windowEnd:
|
|
3458
|
+
windowStart: z24.string(),
|
|
3459
|
+
windowEnd: z24.string(),
|
|
3242
3460
|
/** Days actually used after server-side clamping (≤ requested). */
|
|
3243
|
-
daysRequested:
|
|
3244
|
-
daysApplied:
|
|
3461
|
+
daysRequested: z24.number().int().positive(),
|
|
3462
|
+
daysApplied: z24.number().int().positive()
|
|
3245
3463
|
});
|
|
3246
|
-
var trafficSourceTotalsSchema =
|
|
3247
|
-
crawlerHits:
|
|
3248
|
-
aiUserFetchHits:
|
|
3249
|
-
aiReferralHits:
|
|
3250
|
-
sampleCount:
|
|
3464
|
+
var trafficSourceTotalsSchema = z24.object({
|
|
3465
|
+
crawlerHits: z24.number().int().nonnegative(),
|
|
3466
|
+
aiUserFetchHits: z24.number().int().nonnegative(),
|
|
3467
|
+
aiReferralHits: z24.number().int().nonnegative(),
|
|
3468
|
+
sampleCount: z24.number().int().nonnegative()
|
|
3251
3469
|
});
|
|
3252
|
-
var trafficSourceListResponseSchema =
|
|
3253
|
-
sources:
|
|
3470
|
+
var trafficSourceListResponseSchema = z24.object({
|
|
3471
|
+
sources: z24.array(trafficSourceDtoSchema)
|
|
3254
3472
|
});
|
|
3255
3473
|
var trafficSourceDetailDtoSchema = trafficSourceDtoSchema.extend({
|
|
3256
3474
|
totals24h: trafficSourceTotalsSchema,
|
|
3257
|
-
latestRun:
|
|
3258
|
-
runId:
|
|
3475
|
+
latestRun: z24.object({
|
|
3476
|
+
runId: z24.string(),
|
|
3259
3477
|
status: runStatusSchema,
|
|
3260
|
-
startedAt:
|
|
3261
|
-
finishedAt:
|
|
3262
|
-
error:
|
|
3478
|
+
startedAt: z24.string().nullable(),
|
|
3479
|
+
finishedAt: z24.string().nullable(),
|
|
3480
|
+
error: z24.string().nullable()
|
|
3263
3481
|
}).nullable()
|
|
3264
3482
|
});
|
|
3265
|
-
var trafficStatusResponseSchema =
|
|
3266
|
-
sources:
|
|
3483
|
+
var trafficStatusResponseSchema = z24.object({
|
|
3484
|
+
sources: z24.array(trafficSourceDetailDtoSchema)
|
|
3267
3485
|
});
|
|
3268
|
-
var trafficEventKindSchema =
|
|
3486
|
+
var trafficEventKindSchema = z24.enum(["crawler", "ai-user-fetch", "ai-referral"]);
|
|
3269
3487
|
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 =
|
|
3488
|
+
var trafficCrawlerEventEntrySchema = z24.object({
|
|
3489
|
+
kind: z24.literal(TrafficEventKinds.crawler),
|
|
3490
|
+
sourceId: z24.string(),
|
|
3491
|
+
tsHour: z24.string(),
|
|
3492
|
+
botId: z24.string(),
|
|
3493
|
+
operator: z24.string(),
|
|
3494
|
+
verificationStatus: z24.string(),
|
|
3495
|
+
pathNormalized: z24.string(),
|
|
3496
|
+
status: z24.number().int(),
|
|
3497
|
+
hits: z24.number().int().nonnegative()
|
|
3498
|
+
});
|
|
3499
|
+
var trafficAiUserFetchEventEntrySchema = z24.object({
|
|
3500
|
+
kind: z24.literal(TrafficEventKinds["ai-user-fetch"]),
|
|
3501
|
+
sourceId: z24.string(),
|
|
3502
|
+
tsHour: z24.string(),
|
|
3503
|
+
botId: z24.string(),
|
|
3504
|
+
operator: z24.string(),
|
|
3505
|
+
verificationStatus: z24.string(),
|
|
3506
|
+
pathNormalized: z24.string(),
|
|
3507
|
+
status: z24.number().int(),
|
|
3508
|
+
hits: z24.number().int().nonnegative()
|
|
3509
|
+
});
|
|
3510
|
+
var trafficAiReferralEventEntrySchema = z24.object({
|
|
3511
|
+
kind: z24.literal(TrafficEventKinds["ai-referral"]),
|
|
3512
|
+
sourceId: z24.string(),
|
|
3513
|
+
tsHour: z24.string(),
|
|
3514
|
+
product: z24.string(),
|
|
3515
|
+
operator: z24.string(),
|
|
3516
|
+
sourceDomain: z24.string(),
|
|
3517
|
+
evidenceType: z24.string(),
|
|
3518
|
+
landingPathNormalized: z24.string(),
|
|
3519
|
+
status: z24.number().int(),
|
|
3520
|
+
hits: z24.number().int().nonnegative()
|
|
3521
|
+
});
|
|
3522
|
+
var trafficEventEntrySchema = z24.discriminatedUnion("kind", [
|
|
3305
3523
|
trafficCrawlerEventEntrySchema,
|
|
3306
3524
|
trafficAiUserFetchEventEntrySchema,
|
|
3307
3525
|
trafficAiReferralEventEntrySchema
|
|
3308
3526
|
]);
|
|
3309
|
-
var trafficEventsResponseSchema =
|
|
3310
|
-
windowStart:
|
|
3311
|
-
windowEnd:
|
|
3312
|
-
totals:
|
|
3313
|
-
crawlerHits:
|
|
3314
|
-
aiUserFetchHits:
|
|
3315
|
-
aiReferralHits:
|
|
3527
|
+
var trafficEventsResponseSchema = z24.object({
|
|
3528
|
+
windowStart: z24.string(),
|
|
3529
|
+
windowEnd: z24.string(),
|
|
3530
|
+
totals: z24.object({
|
|
3531
|
+
crawlerHits: z24.number().int().nonnegative(),
|
|
3532
|
+
aiUserFetchHits: z24.number().int().nonnegative(),
|
|
3533
|
+
aiReferralHits: z24.number().int().nonnegative()
|
|
3316
3534
|
}),
|
|
3317
|
-
events:
|
|
3535
|
+
events: z24.array(trafficEventEntrySchema)
|
|
3318
3536
|
});
|
|
3319
3537
|
|
|
3320
3538
|
// ../contracts/src/discovery.ts
|
|
3321
|
-
import { z as
|
|
3322
|
-
var discoveryBucketSchema =
|
|
3539
|
+
import { z as z25 } from "zod";
|
|
3540
|
+
var discoveryBucketSchema = z25.enum(["cited", "aspirational", "wasted-surface"]);
|
|
3323
3541
|
var DiscoveryBuckets = discoveryBucketSchema.enum;
|
|
3324
3542
|
var DEFAULT_DISCOVERY_PROMOTE_BUCKETS = [
|
|
3325
3543
|
DiscoveryBuckets.cited,
|
|
@@ -3327,7 +3545,7 @@ var DEFAULT_DISCOVERY_PROMOTE_BUCKETS = [
|
|
|
3327
3545
|
];
|
|
3328
3546
|
var DISCOVERY_PROMOTE_COMPETITOR_CAP = 20;
|
|
3329
3547
|
var DISCOVERY_PROMOTE_COMPETITOR_MIN_HITS = 2;
|
|
3330
|
-
var discoveryCompetitorTypeSchema =
|
|
3548
|
+
var discoveryCompetitorTypeSchema = z25.enum([
|
|
3331
3549
|
"direct-competitor",
|
|
3332
3550
|
"ota-aggregator",
|
|
3333
3551
|
"editorial-media",
|
|
@@ -3338,11 +3556,11 @@ var DiscoveryCompetitorTypes = discoveryCompetitorTypeSchema.enum;
|
|
|
3338
3556
|
var DEFAULT_DISCOVERY_PROMOTE_COMPETITOR_TYPES = [
|
|
3339
3557
|
DiscoveryCompetitorTypes["direct-competitor"]
|
|
3340
3558
|
];
|
|
3341
|
-
var discoverySessionStatusSchema =
|
|
3559
|
+
var discoverySessionStatusSchema = z25.enum(["queued", "seeding", "probing", "completed", "failed"]);
|
|
3342
3560
|
var DiscoverySessionStatuses = discoverySessionStatusSchema.enum;
|
|
3343
|
-
var discoveryCompetitorMapEntrySchema =
|
|
3344
|
-
domain:
|
|
3345
|
-
hits:
|
|
3561
|
+
var discoveryCompetitorMapEntrySchema = z25.object({
|
|
3562
|
+
domain: z25.string().min(1),
|
|
3563
|
+
hits: z25.number().int().positive(),
|
|
3346
3564
|
/**
|
|
3347
3565
|
* Domain classification from the session's post-probe AI classification
|
|
3348
3566
|
* pass. Defaults to `unknown` so competitor maps persisted before
|
|
@@ -3351,43 +3569,43 @@ var discoveryCompetitorMapEntrySchema = z24.object({
|
|
|
3351
3569
|
*/
|
|
3352
3570
|
competitorType: discoveryCompetitorTypeSchema.default("unknown")
|
|
3353
3571
|
});
|
|
3354
|
-
var discoveryProbeDtoSchema =
|
|
3355
|
-
id:
|
|
3356
|
-
sessionId:
|
|
3357
|
-
projectId:
|
|
3358
|
-
query:
|
|
3572
|
+
var discoveryProbeDtoSchema = z25.object({
|
|
3573
|
+
id: z25.string(),
|
|
3574
|
+
sessionId: z25.string(),
|
|
3575
|
+
projectId: z25.string(),
|
|
3576
|
+
query: z25.string(),
|
|
3359
3577
|
bucket: discoveryBucketSchema.nullable().default(null),
|
|
3360
3578
|
citationState: citationStateSchema,
|
|
3361
|
-
citedDomains:
|
|
3362
|
-
createdAt:
|
|
3579
|
+
citedDomains: z25.array(z25.string()).default([]),
|
|
3580
|
+
createdAt: z25.string()
|
|
3363
3581
|
});
|
|
3364
|
-
var discoverySessionDtoSchema =
|
|
3365
|
-
id:
|
|
3366
|
-
projectId:
|
|
3582
|
+
var discoverySessionDtoSchema = z25.object({
|
|
3583
|
+
id: z25.string(),
|
|
3584
|
+
projectId: z25.string(),
|
|
3367
3585
|
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:
|
|
3586
|
+
icpDescription: z25.string().nullable().optional(),
|
|
3587
|
+
seedProvider: z25.string().nullable().optional(),
|
|
3588
|
+
seedCountRaw: z25.number().int().nullable().optional(),
|
|
3589
|
+
seedCount: z25.number().int().nullable().optional(),
|
|
3590
|
+
dedupThreshold: z25.number().nullable().optional(),
|
|
3591
|
+
probeCount: z25.number().int().nullable().optional(),
|
|
3592
|
+
citedCount: z25.number().int().nullable().default(null),
|
|
3593
|
+
aspirationalCount: z25.number().int().nullable().default(null),
|
|
3594
|
+
wastedCount: z25.number().int().nullable().default(null),
|
|
3595
|
+
competitorMap: z25.array(discoveryCompetitorMapEntrySchema).default([]),
|
|
3596
|
+
error: z25.string().nullable().optional(),
|
|
3597
|
+
startedAt: z25.string().nullable().optional(),
|
|
3598
|
+
finishedAt: z25.string().nullable().optional(),
|
|
3599
|
+
createdAt: z25.string()
|
|
3382
3600
|
});
|
|
3383
3601
|
var discoverySessionDetailDtoSchema = discoverySessionDtoSchema.extend({
|
|
3384
|
-
probes:
|
|
3602
|
+
probes: z25.array(discoveryProbeDtoSchema).default([])
|
|
3385
3603
|
});
|
|
3386
3604
|
var DISCOVERY_MAX_PROBES_CAP = 500;
|
|
3387
|
-
var discoveryRunRequestSchema =
|
|
3388
|
-
icpDescription:
|
|
3389
|
-
dedupThreshold:
|
|
3390
|
-
maxProbes:
|
|
3605
|
+
var discoveryRunRequestSchema = z25.object({
|
|
3606
|
+
icpDescription: z25.string().min(1).optional(),
|
|
3607
|
+
dedupThreshold: z25.number().min(0).max(1).optional(),
|
|
3608
|
+
maxProbes: z25.number().int().positive().max(DISCOVERY_MAX_PROBES_CAP).optional(),
|
|
3391
3609
|
/**
|
|
3392
3610
|
* Optional override of the project's location labels, constraining seed
|
|
3393
3611
|
* generation to a subset of the configured service areas. Each label must
|
|
@@ -3395,39 +3613,39 @@ var discoveryRunRequestSchema = z24.object({
|
|
|
3395
3613
|
* `resolveLocations`). Omitted means "use every project location" — a
|
|
3396
3614
|
* project with no locations is unaffected.
|
|
3397
3615
|
*/
|
|
3398
|
-
locations:
|
|
3616
|
+
locations: z25.array(z25.string().min(1)).optional()
|
|
3399
3617
|
});
|
|
3400
|
-
var discoveryPromoteRequestSchema =
|
|
3401
|
-
buckets:
|
|
3402
|
-
includeCompetitors:
|
|
3403
|
-
competitorTypes:
|
|
3618
|
+
var discoveryPromoteRequestSchema = z25.object({
|
|
3619
|
+
buckets: z25.array(discoveryBucketSchema).min(1).optional(),
|
|
3620
|
+
includeCompetitors: z25.boolean().optional(),
|
|
3621
|
+
competitorTypes: z25.array(discoveryCompetitorTypeSchema).min(1).optional()
|
|
3404
3622
|
});
|
|
3405
|
-
var discoveryPromotePreviewSchema =
|
|
3406
|
-
sessionId:
|
|
3407
|
-
projectId:
|
|
3623
|
+
var discoveryPromotePreviewSchema = z25.object({
|
|
3624
|
+
sessionId: z25.string(),
|
|
3625
|
+
projectId: z25.string(),
|
|
3408
3626
|
status: discoverySessionStatusSchema,
|
|
3409
|
-
queriesByBucket:
|
|
3410
|
-
cited:
|
|
3411
|
-
aspirational:
|
|
3412
|
-
"wasted-surface":
|
|
3627
|
+
queriesByBucket: z25.object({
|
|
3628
|
+
cited: z25.array(z25.string()),
|
|
3629
|
+
aspirational: z25.array(z25.string()),
|
|
3630
|
+
"wasted-surface": z25.array(z25.string())
|
|
3413
3631
|
}),
|
|
3414
|
-
suggestedCompetitors:
|
|
3415
|
-
});
|
|
3416
|
-
var discoveryPromoteResultSchema =
|
|
3417
|
-
sessionId:
|
|
3418
|
-
projectId:
|
|
3419
|
-
promoted:
|
|
3420
|
-
queries:
|
|
3421
|
-
competitors:
|
|
3632
|
+
suggestedCompetitors: z25.array(discoveryCompetitorMapEntrySchema)
|
|
3633
|
+
});
|
|
3634
|
+
var discoveryPromoteResultSchema = z25.object({
|
|
3635
|
+
sessionId: z25.string(),
|
|
3636
|
+
projectId: z25.string(),
|
|
3637
|
+
promoted: z25.object({
|
|
3638
|
+
queries: z25.array(z25.string()),
|
|
3639
|
+
competitors: z25.array(z25.string())
|
|
3422
3640
|
}),
|
|
3423
|
-
skipped:
|
|
3424
|
-
queries:
|
|
3425
|
-
competitors:
|
|
3641
|
+
skipped: z25.object({
|
|
3642
|
+
queries: z25.array(z25.string()),
|
|
3643
|
+
competitors: z25.array(z25.string())
|
|
3426
3644
|
})
|
|
3427
3645
|
});
|
|
3428
|
-
var queryProvenanceSchema =
|
|
3429
|
-
|
|
3430
|
-
|
|
3646
|
+
var queryProvenanceSchema = z25.union([
|
|
3647
|
+
z25.literal("cli"),
|
|
3648
|
+
z25.string().regex(/^discovery:.+$/)
|
|
3431
3649
|
]);
|
|
3432
3650
|
|
|
3433
3651
|
// ../contracts/src/embeddings.ts
|
|
@@ -3616,6 +3834,7 @@ export {
|
|
|
3616
3834
|
authRequired,
|
|
3617
3835
|
authInvalid,
|
|
3618
3836
|
forbidden,
|
|
3837
|
+
quotaExceeded,
|
|
3619
3838
|
providerError,
|
|
3620
3839
|
runInProgress,
|
|
3621
3840
|
runNotCancellable,
|
|
@@ -3657,6 +3876,20 @@ export {
|
|
|
3657
3876
|
gscCoverageSnapshotDtoSchema,
|
|
3658
3877
|
gscSiteListResponseDtoSchema,
|
|
3659
3878
|
gscSitemapListResponseDtoSchema,
|
|
3879
|
+
gbpAccountListResponseSchema,
|
|
3880
|
+
gbpLocationDtoSchema,
|
|
3881
|
+
gbpLocationListResponseSchema,
|
|
3882
|
+
gbpDiscoverRequestSchema,
|
|
3883
|
+
gbpLocationSelectionRequestSchema,
|
|
3884
|
+
gbpSyncRequestSchema,
|
|
3885
|
+
gbpSyncResponseSchema,
|
|
3886
|
+
gbpDailyMetricListResponseSchema,
|
|
3887
|
+
gbpKeywordImpressionListResponseSchema,
|
|
3888
|
+
gbpPlaceActionListResponseSchema,
|
|
3889
|
+
gbpLodgingListResponseSchema,
|
|
3890
|
+
gbpSummaryDtoSchema,
|
|
3891
|
+
withRetry,
|
|
3892
|
+
isRetryableHttpError,
|
|
3660
3893
|
bingUrlInspectionDtoSchema,
|
|
3661
3894
|
bingCoverageSummaryDtoSchema,
|
|
3662
3895
|
bingKeywordStatsDtoSchema,
|
|
@@ -3770,6 +4003,9 @@ export {
|
|
|
3770
4003
|
CodingAgents,
|
|
3771
4004
|
skillsClientSchema,
|
|
3772
4005
|
SkillsClients,
|
|
4006
|
+
SKILL_MANIFEST_FILENAME,
|
|
4007
|
+
classifySkillFile,
|
|
4008
|
+
coerceSkillManifest,
|
|
3773
4009
|
TrafficSourceTypes,
|
|
3774
4010
|
TrafficEvidenceKinds,
|
|
3775
4011
|
TrafficEventConfidences,
|