@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.
Files changed (32) hide show
  1. package/assets/agent-workspace/skills/aero/references/regression-playbook.md +13 -0
  2. package/assets/agent-workspace/skills/canonry/SKILL.md +7 -0
  3. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +45 -0
  4. package/assets/agent-workspace/skills/canonry/references/google-business-profile.md +257 -0
  5. package/assets/assets/BacklinksPage-CEL_F-c1.js +1 -0
  6. package/assets/assets/{ChartPrimitives-D7C1Cp8w.js → ChartPrimitives-B8Z6fjCY.js} +1 -1
  7. package/assets/assets/ProjectPage-ClmLZ1TC.js +6 -0
  8. package/assets/assets/{RunRow-BntNdrgM.js → RunRow-oSEdTjB1.js} +1 -1
  9. package/assets/assets/{RunsPage-Btp6qn10.js → RunsPage-k-TX3mbf.js} +1 -1
  10. package/assets/assets/{SettingsPage-DkyNiU2i.js → SettingsPage-VCOwDDIL.js} +1 -1
  11. package/assets/assets/{TrafficPage-CBl4Mwdc.js → TrafficPage-GgkjI5RL.js} +1 -1
  12. package/assets/assets/{TrafficSourceDetailPage-BZzuWCn-.js → TrafficSourceDetailPage-DhMF4157.js} +1 -1
  13. package/assets/assets/{extract-error-message-De8_qAzs.js → extract-error-message-CYGeEBx9.js} +1 -1
  14. package/assets/assets/{index-XUKhruAg.js → index-BdGCBd0G.js} +90 -90
  15. package/assets/assets/{index-9NRlymgj.css → index-bQ6xgP8c.css} +1 -1
  16. package/assets/assets/server-traffic-If2bUKTD.js +1 -0
  17. package/assets/assets/{trash-2-B5clF2rU.js → trash-2-NV5lw_nX.js} +1 -1
  18. package/assets/index.html +2 -2
  19. package/dist/{chunk-HL6JZUEW.js → chunk-3G3GAT3E.js} +30326 -33261
  20. package/dist/{chunk-6X5TF73A.js → chunk-CKWHFAVB.js} +414 -1
  21. package/dist/{chunk-WFVUZVJD.js → chunk-DXWUBWBD.js} +1427 -1191
  22. package/dist/chunk-X4ZZFZQZ.js +10210 -0
  23. package/dist/cli.js +618 -466
  24. package/dist/index.d.ts +2 -1
  25. package/dist/index.js +4 -4
  26. package/dist/{intelligence-service-NY3MAVPB.js → intelligence-service-UYVVKQ2K.js} +2 -2
  27. package/dist/mcp.js +10 -8
  28. package/package.json +8 -7
  29. package/assets/assets/BacklinksPage-CmeFZ8UJ.js +0 -1
  30. package/assets/assets/ProjectPage-Y6uCyjGb.js +0 -6
  31. package/assets/assets/server-traffic-bn9LSZN9.js +0 -1
  32. 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/bing.ts
829
+ // ../contracts/src/gbp.ts
826
830
  import { z as z7 } from "zod";
827
- var bingConnectionDtoSchema = z7.object({
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
- domain: z7.string(),
830
- siteUrl: z7.string().nullable().optional(),
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 bingUrlInspectionDtoSchema = z7.object({
835
- id: z7.string(),
836
- url: z7.string(),
837
- httpCode: z7.number().nullable().optional(),
838
- inIndex: z7.boolean().nullable().optional(),
839
- lastCrawledDate: z7.string().nullable().optional(),
840
- inIndexDate: z7.string().nullable().optional(),
841
- inspectedAt: z7.string(),
842
- // Fields derived from GetUrlInfo response (more reliable than InIndex)
843
- documentSize: z7.number().nullable().optional(),
844
- anchorCount: z7.number().nullable().optional(),
845
- discoveryDate: z7.string().nullable().optional()
846
- });
847
- var bingCoverageSummaryDtoSchema = z7.object({
848
- summary: z7.object({
849
- total: z7.number(),
850
- indexed: z7.number(),
851
- notIndexed: z7.number(),
852
- unknown: z7.number().optional(),
853
- percentage: z7.number()
854
- }),
855
- lastInspectedAt: z7.string().nullable(),
856
- indexed: z7.array(bingUrlInspectionDtoSchema).default([]),
857
- notIndexed: z7.array(bingUrlInspectionDtoSchema).default([]),
858
- unknown: z7.array(bingUrlInspectionDtoSchema).default([]).optional()
859
- });
860
- var bingKeywordStatsDtoSchema = z7.object({
861
- query: z7.string(),
862
- impressions: z7.number(),
863
- clicks: z7.number(),
864
- ctr: z7.number(),
865
- averagePosition: z7.number()
866
- });
867
- var bingCoverageSnapshotDtoSchema = z7.object({
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
- indexed: z7.number(),
870
- notIndexed: z7.number(),
871
- unknown: z7.number()
872
- });
873
- var bingSubmitResultDtoSchema = z7.object({
874
- url: z7.string(),
875
- status: z7.enum(["success", "error"]),
876
- submittedAt: z7.string(),
877
- error: z7.string().optional()
878
- });
879
- var bingIndexingRequestResponseDtoSchema = z7.object({
880
- summary: z7.object({
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
- succeeded: z7.number().int().nonnegative(),
883
- failed: z7.number().int().nonnegative()
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: z7.array(bingSubmitResultDtoSchema).default([])
1084
+ results: z8.array(bingSubmitResultDtoSchema).default([])
886
1085
  });
887
- var bingSiteDtoSchema = z7.object({
888
- url: z7.string(),
889
- verified: z7.boolean()
1086
+ var bingSiteDtoSchema = z8.object({
1087
+ url: z8.string(),
1088
+ verified: z8.boolean()
890
1089
  });
891
- var bingSitesResponseDtoSchema = z7.object({
892
- sites: z7.array(bingSiteDtoSchema).default([])
1090
+ var bingSitesResponseDtoSchema = z8.object({
1091
+ sites: z8.array(bingSiteDtoSchema).default([])
893
1092
  });
894
- var bingStatusDtoSchema = z7.object({
895
- connected: z7.boolean(),
896
- domain: z7.string(),
897
- siteUrl: z7.string().nullable(),
898
- createdAt: z7.string().nullable(),
899
- updatedAt: z7.string().nullable()
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 = z7.object({
902
- connected: z7.boolean(),
903
- domain: z7.string(),
904
- siteUrl: z7.string().nullable(),
905
- availableSites: z7.array(bingSiteDtoSchema).default([])
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 = z7.object({
908
- siteUrl: z7.string()
1106
+ var bingSetSiteResponseDtoSchema = z8.object({
1107
+ siteUrl: z8.string()
909
1108
  });
910
1109
 
911
1110
  // ../contracts/src/cdp.ts
912
- import { z as z8 } from "zod";
913
- var cdpTargetStatusDtoSchema = z8.object({
914
- name: z8.string(),
915
- alive: z8.boolean(),
916
- lastUsed: z8.string().nullable()
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 = z8.object({
919
- connected: z8.boolean(),
920
- endpoint: z8.string(),
921
- version: z8.string().optional(),
922
- browserVersion: z8.string().optional(),
923
- targets: z8.array(cdpTargetStatusDtoSchema).default([])
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 z9 } from "zod";
928
- var wordpressEnvSchema = z9.enum(["live", "staging"]);
929
- var wordpressConnectionDtoSchema = z9.object({
930
- projectName: z9.string(),
931
- url: z9.string(),
932
- stagingUrl: z9.string().optional(),
933
- username: z9.string(),
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: z9.string(),
936
- updatedAt: z9.string()
937
- });
938
- var wordpressSiteStatusDtoSchema = z9.object({
939
- url: z9.string(),
940
- reachable: z9.boolean(),
941
- pageCount: z9.number().nullable().optional(),
942
- version: z9.string().nullable().optional(),
943
- error: z9.string().nullable().optional(),
944
- plugins: z9.array(z9.string()).optional(),
945
- authenticatedUser: z9.object({
946
- id: z9.number(),
947
- slug: z9.string()
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 = z9.object({
951
- connected: z9.boolean(),
952
- projectName: z9.string(),
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: z9.string().nullable().optional()
957
- });
958
- var wordpressPageSummaryDtoSchema = z9.object({
959
- id: z9.number(),
960
- slug: z9.string(),
961
- title: z9.string(),
962
- status: z9.string(),
963
- modifiedAt: z9.string().nullable().optional(),
964
- link: z9.string().nullable().optional()
965
- });
966
- var wordpressSeoStateDtoSchema = z9.object({
967
- title: z9.string().nullable(),
968
- description: z9.string().nullable(),
969
- noindex: z9.boolean().nullable(),
970
- writable: z9.boolean().default(false),
971
- writeTargets: z9.array(z9.string()).default([])
972
- });
973
- var wordpressSchemaBlockDtoSchema = z9.object({
974
- type: z9.string(),
975
- json: z9.record(z9.string(), z9.unknown())
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: z9.string(),
1178
+ content: z10.string(),
980
1179
  seo: wordpressSeoStateDtoSchema,
981
- schemaBlocks: z9.array(wordpressSchemaBlockDtoSchema).default([])
1180
+ schemaBlocks: z10.array(wordpressSchemaBlockDtoSchema).default([])
982
1181
  });
983
1182
  var wordpressDiffPageDtoSchema = wordpressPageDetailDtoSchema.extend({
984
- contentHash: z9.string(),
985
- contentSnippet: z9.string()
986
- });
987
- var wordpressManualAssistDtoSchema = z9.object({
988
- manualRequired: z9.literal(true),
989
- targetUrl: z9.string(),
990
- adminUrl: z9.string().nullable().optional(),
991
- content: z9.string(),
992
- nextSteps: z9.array(z9.string()).default([])
993
- });
994
- var wordpressAuditIssueDtoSchema = z9.object({
995
- slug: z9.string(),
996
- severity: z9.enum(["high", "medium", "low"]),
997
- code: z9.enum([
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: z9.string()
1203
+ message: z10.string()
1005
1204
  });
1006
- var wordpressAuditPageDtoSchema = z9.object({
1007
- slug: z9.string(),
1008
- title: z9.string(),
1009
- status: z9.string(),
1010
- wordCount: z9.number(),
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: z9.boolean(),
1013
- issues: z9.array(wordpressAuditIssueDtoSchema).default([])
1211
+ schemaPresent: z10.boolean(),
1212
+ issues: z10.array(wordpressAuditIssueDtoSchema).default([])
1014
1213
  });
1015
- var wordpressBulkMetaEntryResultDtoSchema = z9.object({
1016
- slug: z9.string(),
1017
- status: z9.enum(["applied", "skipped", "manual"]),
1018
- error: z9.string().optional(),
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 = z9.object({
1220
+ var wordpressBulkMetaResultDtoSchema = z10.object({
1022
1221
  env: wordpressEnvSchema,
1023
- strategy: z9.enum(["plugin", "manual"]),
1024
- results: z9.array(wordpressBulkMetaEntryResultDtoSchema)
1222
+ strategy: z10.enum(["plugin", "manual"]),
1223
+ results: z10.array(wordpressBulkMetaEntryResultDtoSchema)
1025
1224
  });
1026
- var wordpressSchemaDeployEntryResultDtoSchema = z9.object({
1027
- slug: z9.string(),
1028
- status: z9.enum(["deployed", "stripped", "skipped", "failed"]),
1029
- schemasInjected: z9.array(z9.string()).optional(),
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: z9.string().optional()
1230
+ error: z10.string().optional()
1032
1231
  });
1033
- var wordpressSchemaDeployResultDtoSchema = z9.object({
1232
+ var wordpressSchemaDeployResultDtoSchema = z10.object({
1034
1233
  env: wordpressEnvSchema,
1035
- results: z9.array(wordpressSchemaDeployEntryResultDtoSchema)
1234
+ results: z10.array(wordpressSchemaDeployEntryResultDtoSchema)
1036
1235
  });
1037
- var wordpressSchemaStatusPageDtoSchema = z9.object({
1038
- slug: z9.string(),
1039
- title: z9.string(),
1040
- canonrySchemas: z9.array(z9.string()),
1041
- thirdPartySchemas: z9.array(z9.string()),
1042
- hasCanonrySchema: z9.boolean()
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 = z9.object({
1243
+ var wordpressSchemaStatusResultDtoSchema = z10.object({
1045
1244
  env: wordpressEnvSchema,
1046
- pages: z9.array(wordpressSchemaStatusPageDtoSchema)
1245
+ pages: z10.array(wordpressSchemaStatusPageDtoSchema)
1047
1246
  });
1048
- var wordpressOnboardStepDtoSchema = z9.object({
1049
- name: z9.string(),
1050
- status: z9.enum(["completed", "skipped", "failed"]),
1051
- summary: z9.string().optional(),
1052
- error: z9.string().optional()
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 = z9.object({
1055
- projectName: z9.string(),
1056
- steps: z9.array(wordpressOnboardStepDtoSchema)
1253
+ var wordpressOnboardResultDtoSchema = z10.object({
1254
+ projectName: z10.string(),
1255
+ steps: z10.array(wordpressOnboardStepDtoSchema)
1057
1256
  });
1058
- var wordpressDiffDtoSchema = z9.object({
1059
- slug: z9.string(),
1257
+ var wordpressDiffDtoSchema = z10.object({
1258
+ slug: z10.string(),
1060
1259
  live: wordpressDiffPageDtoSchema,
1061
1260
  staging: wordpressDiffPageDtoSchema,
1062
- hasDifferences: z9.boolean(),
1063
- differences: z9.object({
1064
- title: z9.boolean(),
1065
- slug: z9.boolean(),
1066
- content: z9.boolean(),
1067
- seoTitle: z9.boolean(),
1068
- seoDescription: z9.boolean(),
1069
- noindex: z9.boolean(),
1070
- schema: z9.boolean()
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 z10 } from "zod";
1113
- var providerSummaryEntryDtoSchema = z10.object({
1114
- name: z10.string(),
1115
- displayName: z10.string().optional(),
1116
- keyUrl: z10.string().optional(),
1117
- modelHint: z10.string().optional(),
1118
- model: z10.string().optional(),
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: z10.string().optional(),
1124
- configured: z10.boolean(),
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: z10.boolean().optional()
1326
+ vertexConfigured: z11.boolean().optional()
1128
1327
  });
1129
- var integrationSettingsSummaryDtoSchema = z10.object({
1130
- configured: z10.boolean()
1328
+ var integrationSettingsSummaryDtoSchema = z11.object({
1329
+ configured: z11.boolean()
1131
1330
  });
1132
- var settingsDtoSchema = z10.object({
1133
- providers: z10.array(providerSummaryEntryDtoSchema).default([]),
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 z11 } from "zod";
1140
- var snapshotAccuracySchema = z11.enum(["yes", "no", "unknown", "not-mentioned"]);
1141
- var snapshotQueryListSchema = z11.array(z11.string().min(1));
1142
- var snapshotRequestSchema = z11.object({
1143
- companyName: z11.string().min(1),
1144
- domain: z11.string().min(1),
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: z11.array(z11.string().min(1)).optional().default([])
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 = z11.object({
1161
- name: z11.string(),
1162
- count: z11.number().int().nonnegative()
1359
+ var snapshotCompetitorEntrySchema = z12.object({
1360
+ name: z12.string(),
1361
+ count: z12.number().int().nonnegative()
1163
1362
  });
1164
- var snapshotAuditFactorSchema = z11.object({
1165
- id: z11.string(),
1166
- name: z11.string(),
1167
- weight: z11.number(),
1168
- score: z11.number(),
1169
- grade: z11.string(),
1170
- status: z11.enum(["pass", "partial", "fail"]),
1171
- findings: z11.array(z11.object({
1172
- type: z11.string(),
1173
- message: z11.string()
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: z11.array(z11.string()).default([])
1176
- });
1177
- var snapshotAuditSchema = z11.object({
1178
- url: z11.string(),
1179
- finalUrl: z11.string(),
1180
- auditedAt: z11.string(),
1181
- overallScore: z11.number(),
1182
- overallGrade: z11.string(),
1183
- summary: z11.string(),
1184
- factors: z11.array(snapshotAuditFactorSchema).default([])
1185
- });
1186
- var snapshotProfileSchema = z11.object({
1187
- industry: z11.string(),
1188
- summary: z11.string(),
1189
- services: z11.array(z11.string()).default([]),
1190
- categoryTerms: z11.array(z11.string()).default([])
1191
- });
1192
- var snapshotProviderResultSchema = z11.object({
1193
- provider: z11.string(),
1194
- displayName: z11.string(),
1195
- model: z11.string().nullable().optional(),
1196
- mentioned: z11.boolean(),
1197
- cited: z11.boolean(),
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: z11.string().nullable().optional(),
1200
- incorrectClaims: z11.array(z11.string()).default([]),
1201
- recommendedCompetitors: z11.array(z11.string()).default([]),
1202
- citedDomains: z11.array(z11.string()).default([]),
1203
- groundingSources: z11.array(groundingSourceSchema).default([]),
1204
- searchQueries: z11.array(z11.string()).default([]),
1205
- answerText: z11.string(),
1206
- error: z11.string().nullable().optional()
1207
- });
1208
- var snapshotQueryResultSchema = z11.object({
1209
- query: z11.string(),
1210
- providerResults: z11.array(snapshotProviderResultSchema).default([])
1211
- });
1212
- var snapshotSummarySchema = z11.object({
1213
- totalQueries: z11.number().int().nonnegative(),
1214
- totalProviders: z11.number().int().nonnegative(),
1215
- totalComparisons: z11.number().int().nonnegative(),
1216
- mentionCount: z11.number().int().nonnegative(),
1217
- citationCount: z11.number().int().nonnegative(),
1218
- topCompetitors: z11.array(snapshotCompetitorEntrySchema).default([]),
1219
- visibilityGap: z11.string(),
1220
- whatThisMeans: z11.array(z11.string()).default([]),
1221
- recommendedActions: z11.array(z11.string()).default([])
1222
- });
1223
- var snapshotReportSchema = z11.object({
1224
- companyName: z11.string(),
1225
- domain: z11.string(),
1226
- homepageUrl: z11.string(),
1227
- generatedAt: z11.string(),
1228
- queries: z11.array(z11.string()).default([]),
1229
- competitors: z11.array(z11.string()).default([]),
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: z11.array(snapshotQueryResultSchema).default([]),
1431
+ queryResults: z12.array(snapshotQueryResultSchema).default([]),
1233
1432
  summary: snapshotSummarySchema
1234
1433
  });
1235
1434
 
1236
1435
  // ../contracts/src/schedule.ts
1237
- import { z as z12 } from "zod";
1238
- var schedulableRunKindSchema = z12.enum(["answer-visibility", "traffic-sync"]);
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 = z12.object({
1241
- id: z12.string(),
1242
- projectId: z12.string(),
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: z12.string(),
1246
- preset: z12.string().nullable().optional(),
1247
- timezone: z12.string().default("UTC"),
1248
- enabled: z12.boolean().default(true),
1249
- providers: z12.array(providerNameSchema).default([]),
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: z12.string().nullable().optional(),
1252
- lastRunAt: z12.string().nullable().optional(),
1253
- nextRunAt: z12.string().nullable().optional(),
1254
- createdAt: z12.string(),
1255
- updatedAt: z12.string()
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 = z12.object({
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: z12.string().optional(),
1261
- cron: z12.string().optional(),
1262
- timezone: z12.string().optional().default("UTC"),
1263
- enabled: z12.boolean().optional().default(true),
1264
- providers: z12.array(providerNameSchema).optional().default([]),
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: z12.string().optional()
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 z13 } from "zod";
1274
- var visibilityMetricModeSchema = z13.enum(["mentioned", "cited"]);
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 z14 } from "zod";
1414
- var ga4ConnectionDtoSchema = z14.object({
1415
- id: z14.string(),
1416
- projectId: z14.string(),
1417
- propertyId: z14.string(),
1418
- clientEmail: z14.string(),
1419
- connected: z14.boolean(),
1420
- createdAt: z14.string(),
1421
- updatedAt: z14.string()
1422
- });
1423
- var ga4TrafficSnapshotDtoSchema = z14.object({
1424
- date: z14.string(),
1425
- landingPage: z14.string(),
1426
- sessions: z14.number(),
1427
- organicSessions: z14.number(),
1428
- users: z14.number()
1429
- });
1430
- var ga4SourceDimensionSchema = z14.enum(["session", "first_user", "manual_utm"]);
1431
- var ga4AiReferralDtoSchema = z14.object({
1432
- source: z14.string(),
1433
- medium: z14.string(),
1434
- sessions: z14.number(),
1435
- users: z14.number(),
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 = z14.object({
1446
- source: z14.string(),
1447
- medium: z14.string(),
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: z14.string(),
1454
- sessions: z14.number(),
1455
- users: z14.number()
1456
- });
1457
- var ga4SocialReferralDtoSchema = z14.object({
1458
- source: z14.string(),
1459
- medium: z14.string(),
1460
- sessions: z14.number(),
1461
- users: z14.number(),
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: z14.string()
1662
+ channelGroup: z15.string()
1464
1663
  });
1465
- var ga4ChannelBucketDtoSchema = z14.object({
1466
- sessions: z14.number(),
1467
- sharePct: z14.number(),
1468
- sharePctDisplay: z14.string()
1664
+ var ga4ChannelBucketDtoSchema = z15.object({
1665
+ sessions: z15.number(),
1666
+ sharePct: z15.number(),
1667
+ sharePctDisplay: z15.string()
1469
1668
  });
1470
- var ga4ChannelBreakdownDtoSchema = z14.object({
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 = z14.object({
1478
- totalSessions: z14.number(),
1479
- totalOrganicSessions: z14.number(),
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: z14.number(),
1482
- totalUsers: z14.number(),
1483
- topPages: z14.array(z14.object({
1484
- landingPage: z14.string(),
1485
- sessions: z14.number(),
1486
- organicSessions: z14.number(),
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: z14.number(),
1489
- users: z14.number()
1687
+ directSessions: z15.number(),
1688
+ users: z15.number()
1490
1689
  })),
1491
- aiReferrals: z14.array(ga4AiReferralDtoSchema),
1492
- aiReferralLandingPages: z14.array(ga4AiReferralLandingPageDtoSchema),
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: z14.number(),
1693
+ aiSessionsDeduped: z15.number(),
1495
1694
  /** Deduped AI user total: MAX(users) per date+source+medium across attribution dimensions, then summed. */
1496
- aiUsersDeduped: z14.number(),
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: z14.number(),
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: z14.number(),
1501
- socialReferrals: z14.array(ga4SocialReferralDtoSchema),
1699
+ aiUsersBySession: z15.number(),
1700
+ socialReferrals: z15.array(ga4SocialReferralDtoSchema),
1502
1701
  /** Total social sessions (session-scoped, no cross-dimension dedup needed). */
1503
- socialSessions: z14.number(),
1702
+ socialSessions: z15.number(),
1504
1703
  /** Total social users (session-scoped, no cross-dimension dedup needed). */
1505
- socialUsers: z14.number(),
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: z14.number(),
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: z14.number(),
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: z14.number(),
1712
+ aiSharePctBySession: z15.number(),
1514
1713
  /** Direct-channel sessions as a percentage of total sessions (0–100, rounded). */
1515
- directSharePct: z14.number(),
1714
+ directSharePct: z15.number(),
1516
1715
  /** Social sessions as a percentage of total sessions (0–100, rounded). */
1517
- socialSharePct: z14.number(),
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: z14.string(),
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: z14.string(),
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: z14.string(),
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: z14.string(),
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: z14.string(),
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: z14.number(),
1728
+ otherSessions: z15.number(),
1530
1729
  /** Other sessions as a percentage of total sessions (0–100, rounded). */
1531
- otherSharePct: z14.number(),
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: z14.string(),
1534
- lastSyncedAt: z14.string().nullable()
1535
- });
1536
- var ga4StatusDtoSchema = z14.object({
1537
- connected: z14.boolean(),
1538
- propertyId: z14.string().nullable(),
1539
- clientEmail: z14.string().nullable(),
1540
- authMethod: z14.enum(["service-account", "oauth"]).nullable(),
1541
- lastSyncedAt: z14.string().nullable(),
1542
- createdAt: z14.string().nullable().optional(),
1543
- updatedAt: z14.string().nullable().optional()
1544
- });
1545
- var ga4SyncResponseDtoSchema = z14.object({
1546
- synced: z14.boolean(),
1547
- rowCount: z14.number().int().nonnegative(),
1548
- aiReferralCount: z14.number().int().nonnegative(),
1549
- socialReferralCount: z14.number().int().nonnegative(),
1550
- days: z14.number().int().nonnegative(),
1551
- syncedAt: z14.string(),
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: z14.array(z14.string()).optional()
1558
- });
1559
- var ga4AiReferralHistoryEntrySchema = z14.object({
1560
- date: z14.string(),
1561
- source: z14.string(),
1562
- medium: z14.string(),
1563
- landingPage: z14.string(),
1564
- sessions: z14.number(),
1565
- users: z14.number(),
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 = z14.object({
1570
- date: z14.string(),
1571
- source: z14.string(),
1572
- medium: z14.string(),
1573
- sessions: z14.number(),
1574
- users: z14.number(),
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: z14.string()
1775
+ channelGroup: z15.string()
1577
1776
  });
1578
- var ga4SessionHistoryEntrySchema = z14.object({
1579
- date: z14.string(),
1580
- sessions: z14.number(),
1581
- organicSessions: z14.number(),
1582
- users: z14.number()
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 z15 } from "zod";
1751
- var agentProviderIdSchema = z15.enum(["claude", "openai", "gemini", "zai"]);
1752
- var agentProviderOptionDtoSchema = z15.object({
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: z15.string(),
1955
+ label: z16.string(),
1757
1956
  /** Default model if the caller doesn't pick one. */
1758
- defaultModel: z15.string(),
1957
+ defaultModel: z16.string(),
1759
1958
  /** Whether a usable API key was found (config.yaml or provider env var). */
1760
- configured: z15.boolean(),
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: z15.enum(["config", "env"]).nullable()
1964
+ keySource: z16.enum(["config", "env"]).nullable()
1766
1965
  });
1767
- var agentProvidersResponseDtoSchema = z15.object({
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: z15.array(agentProviderOptionDtoSchema).default([]),
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 = z15.enum(["aero", "user", "compaction"]);
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 = z15.object({
1784
- key: z15.string().min(1).max(AGENT_MEMORY_KEY_MAX_LENGTH),
1785
- value: z15.string().min(1)
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 = z15.object({
1788
- key: z15.string().min(1).max(AGENT_MEMORY_KEY_MAX_LENGTH)
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 z16 } from "zod";
1793
- var ccReleaseSyncStatusSchema = z16.enum(["queued", "downloading", "querying", "ready", "failed"]);
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 = z16.object({
1796
- id: z16.string(),
1797
- release: z16.string(),
1994
+ var ccReleaseSyncDtoSchema = z17.object({
1995
+ id: z17.string(),
1996
+ release: z17.string(),
1798
1997
  status: ccReleaseSyncStatusSchema,
1799
- phaseDetail: z16.string().nullable().optional(),
1800
- vertexPath: z16.string().nullable().optional(),
1801
- edgesPath: z16.string().nullable().optional(),
1802
- vertexSha256: z16.string().nullable().optional(),
1803
- edgesSha256: z16.string().nullable().optional(),
1804
- vertexBytes: z16.number().int().nullable().optional(),
1805
- edgesBytes: z16.number().int().nullable().optional(),
1806
- projectsProcessed: z16.number().int().nullable().optional(),
1807
- domainsDiscovered: z16.number().int().nullable().optional(),
1808
- downloadStartedAt: z16.string().nullable().optional(),
1809
- downloadFinishedAt: z16.string().nullable().optional(),
1810
- queryStartedAt: z16.string().nullable().optional(),
1811
- queryFinishedAt: z16.string().nullable().optional(),
1812
- error: z16.string().nullable().optional(),
1813
- createdAt: z16.string(),
1814
- updatedAt: z16.string()
1815
- });
1816
- var backlinkDomainDtoSchema = z16.object({
1817
- linkingDomain: z16.string(),
1818
- numHosts: z16.number().int()
1819
- });
1820
- var backlinkSummaryDtoSchema = z16.object({
1821
- projectId: z16.string(),
1822
- release: z16.string(),
1823
- targetDomain: z16.string(),
1824
- totalLinkingDomains: z16.number().int(),
1825
- totalHosts: z16.number().int(),
1826
- top10HostsShare: z16.string(),
1827
- queriedAt: z16.string(),
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: z16.number().int().optional(),
1832
- excludedHosts: z16.number().int().optional()
2030
+ excludedLinkingDomains: z17.number().int().optional(),
2031
+ excludedHosts: z17.number().int().optional()
1833
2032
  });
1834
- var backlinkListResponseSchema = z16.object({
2033
+ var backlinkListResponseSchema = z17.object({
1835
2034
  summary: backlinkSummaryDtoSchema.nullable(),
1836
- total: z16.number().int(),
1837
- rows: z16.array(backlinkDomainDtoSchema)
1838
- });
1839
- var backlinkHistoryEntrySchema = z16.object({
1840
- release: z16.string(),
1841
- totalLinkingDomains: z16.number().int(),
1842
- totalHosts: z16.number().int(),
1843
- top10HostsShare: z16.string(),
1844
- queriedAt: z16.string()
1845
- });
1846
- var backlinksInstallStatusDtoSchema = z16.object({
1847
- duckdbInstalled: z16.boolean(),
1848
- duckdbVersion: z16.string().nullable().optional(),
1849
- duckdbSpec: z16.string(),
1850
- pluginDir: z16.string()
1851
- });
1852
- var backlinksInstallResultDtoSchema = z16.object({
1853
- installed: z16.boolean(),
1854
- version: z16.string(),
1855
- path: z16.string(),
1856
- alreadyPresent: z16.boolean()
1857
- });
1858
- var ccAvailableReleaseSchema = z16.object({
1859
- release: z16.string(),
1860
- vertexUrl: z16.string(),
1861
- edgesUrl: z16.string(),
1862
- vertexBytes: z16.number().int().nullable(),
1863
- edgesBytes: z16.number().int().nullable(),
1864
- lastModified: z16.string().nullable()
1865
- });
1866
- var ccCachedReleaseSchema = z16.object({
1867
- release: z16.string(),
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: z16.number().int(),
1870
- lastUsedAt: z16.string().nullable()
2068
+ bytes: z17.number().int(),
2069
+ lastUsedAt: z17.string().nullable()
1871
2070
  });
1872
2071
 
1873
2072
  // ../contracts/src/composites.ts
1874
- import { z as z17 } from "zod";
1875
- var searchHitKindSchema = z17.enum(["snapshot", "insight"]);
1876
- var projectSearchSnapshotHitSchema = z17.object({
1877
- kind: z17.literal("snapshot"),
1878
- id: z17.string(),
1879
- runId: z17.string(),
1880
- query: z17.string(),
1881
- provider: z17.string(),
1882
- model: z17.string().nullable(),
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: z17.enum(["answerText", "citedDomains", "searchQueries", "query"]),
1885
- snippet: z17.string(),
1886
- createdAt: z17.string()
1887
- });
1888
- var projectSearchInsightHitSchema = z17.object({
1889
- kind: z17.literal("insight"),
1890
- id: z17.string(),
1891
- runId: z17.string().nullable(),
1892
- type: z17.enum([
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: z17.enum(["critical", "high", "medium", "low"]),
1903
- title: z17.string(),
1904
- query: z17.string(),
1905
- provider: z17.string(),
1906
- matchedField: z17.enum(["title", "query", "recommendation", "cause"]),
1907
- snippet: z17.string(),
1908
- dismissed: z17.boolean(),
1909
- createdAt: z17.string()
1910
- });
1911
- var projectSearchHitSchema = z17.discriminatedUnion("kind", [
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 = z17.object({
1916
- query: z17.string(),
1917
- totalHits: z17.number().int().nonnegative(),
1918
- truncated: z17.boolean(),
1919
- hits: z17.array(projectSearchHitSchema)
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 z18 } from "zod";
1924
- var contentActionSchema = z18.enum(["create", "expand", "refresh", "add-schema"]);
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 = z18.enum(["gsc", "competitor-evidence", "both"]);
2142
+ var demandSourceSchema = z19.enum(["gsc", "competitor-evidence", "both"]);
1939
2143
  var DemandSources = demandSourceSchema.enum;
1940
- var actionConfidenceSchema = z18.enum(["high", "medium", "low"]);
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 = z18.enum([
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 = z18.enum([
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 = z18.object({
1972
- url: z18.string(),
1973
- gscImpressions: z18.number().nonnegative(),
1974
- gscClicks: z18.number().nonnegative(),
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: z18.number().nonnegative().nullable(),
1977
- organicSessions: z18.number().nonnegative()
2180
+ gscAvgPosition: z19.number().nonnegative().nullable(),
2181
+ organicSessions: z19.number().nonnegative()
1978
2182
  });
1979
- var winningCompetitorSchema = z18.object({
1980
- domain: z18.string(),
1981
- url: z18.string(),
1982
- title: z18.string(),
1983
- citationCount: z18.number().int().nonnegative()
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 = z18.object({
1986
- demand: z18.number(),
1987
- competitor: z18.number(),
1988
- absence: z18.number(),
1989
- gapSeverity: z18.number()
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 = z18.object({
1992
- actionId: z18.string(),
2195
+ var existingActionRefSchema = z19.object({
2196
+ actionId: z19.string(),
1993
2197
  state: contentActionStateSchema,
1994
- lastUpdated: z18.string()
2198
+ lastUpdated: z19.string()
1995
2199
  });
1996
- var contentTargetRowDtoSchema = z18.object({
1997
- targetRef: z18.string(),
1998
- query: z18.string(),
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: z18.number(),
2206
+ score: z19.number(),
2003
2207
  scoreBreakdown: scoreBreakdownSchema,
2004
- drivers: z18.array(z18.string()),
2208
+ drivers: z19.array(z19.string()),
2005
2209
  demandSource: demandSourceSchema,
2006
2210
  actionConfidence: actionConfidenceSchema,
2007
2211
  existingAction: existingActionRefSchema.nullable()
2008
2212
  });
2009
- var contentTargetsResponseDtoSchema = z18.object({
2010
- targets: z18.array(contentTargetRowDtoSchema),
2011
- contextMetrics: z18.object({
2012
- totalAiReferralSessions: z18.number().int().nonnegative(),
2013
- latestRunId: z18.string(),
2014
- runTimestamp: z18.string()
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 = z18.object({
2018
- targetRef: z18.string(),
2019
- addressedUrl: z18.string().nullable(),
2020
- note: z18.string().nullable(),
2021
- dismissedAt: z18.string()
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 = z18.object({
2024
- dismissals: z18.array(contentTargetDismissalDtoSchema)
2227
+ var contentTargetDismissalsResponseDtoSchema = z19.object({
2228
+ dismissals: z19.array(contentTargetDismissalDtoSchema)
2025
2229
  });
2026
- var contentTargetDismissRequestSchema = z18.object({
2027
- targetRef: z18.string().min(1),
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: z18.string().url().optional(),
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: z18.string().max(500).optional()
2235
+ note: z19.string().max(500).optional()
2032
2236
  });
2033
- var recommendationExplanationDtoSchema = z18.object({
2034
- targetRef: z18.string(),
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: z18.string(),
2240
+ promptVersion: z19.string(),
2037
2241
  /** Provider that produced the explanation (e.g. "claude", "gemini"). */
2038
- provider: z18.string(),
2242
+ provider: z19.string(),
2039
2243
  /** Model id within that provider (e.g. "claude-sonnet-4-6"). */
2040
- model: z18.string(),
2244
+ model: z19.string(),
2041
2245
  /** Markdown-formatted rationale + recommended next steps. */
2042
- responseText: z18.string(),
2246
+ responseText: z19.string(),
2043
2247
  /** Estimated cost in millicents (1/100 of a cent). 0 when unknown. */
2044
- costMillicents: z18.number().int().nonnegative(),
2045
- generatedAt: z18.string()
2248
+ costMillicents: z19.number().int().nonnegative(),
2249
+ generatedAt: z19.string()
2046
2250
  });
2047
- var recommendationExplainRequestSchema = z18.object({
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: z18.string().optional(),
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: z18.string().optional(),
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: z18.boolean().optional()
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 contentGapsResponseDtoSchema = z18.object({
2090
- gaps: z18.array(contentGapRowDtoSchema),
2091
- latestRunId: z18.string()
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 z19 } from "zod";
2096
- var checkStatusSchema = z19.enum(["ok", "warn", "fail", "skipped"]);
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 = z19.enum(["global", "project"]);
2302
+ var checkScopeSchema = z20.enum(["global", "project"]);
2099
2303
  var CheckScopes = checkScopeSchema.enum;
2100
- var checkCategorySchema = z19.enum([
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 = z19.object({
2112
- id: z19.string(),
2315
+ var checkResultSchema = z20.object({
2316
+ id: z20.string(),
2113
2317
  category: checkCategorySchema,
2114
2318
  scope: checkScopeSchema,
2115
- title: z19.string(),
2319
+ title: z20.string(),
2116
2320
  status: checkStatusSchema,
2117
- code: z19.string().describe('Stable machine-readable code (e.g. "google.token.refresh-failed"). Use this for filtering and remediation logic.'),
2118
- summary: z19.string(),
2119
- remediation: z19.string().nullable().optional().describe('Operator-facing next step. Null when status is "ok" or no specific remediation applies.'),
2120
- details: z19.record(z19.string(), z19.unknown()).optional().describe("Structured context \u2014 principal email, redirect URI, missing scopes, etc. Stable per check id."),
2121
- durationMs: z19.number().int().nonnegative().describe("How long the check took to execute.")
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 = z19.object({
2327
+ var doctorReportSchema = z20.object({
2124
2328
  scope: checkScopeSchema,
2125
- project: z19.string().nullable().describe('Project name when scope is "project", null otherwise.'),
2126
- generatedAt: z19.string().describe("ISO-8601 timestamp when this doctor run started."),
2127
- durationMs: z19.number().int().nonnegative(),
2128
- summary: z19.object({
2129
- total: z19.number().int().nonnegative(),
2130
- ok: z19.number().int().nonnegative(),
2131
- warn: z19.number().int().nonnegative(),
2132
- fail: z19.number().int().nonnegative(),
2133
- skipped: z19.number().int().nonnegative()
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: z19.array(checkResultSchema)
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 z20 } from "zod";
2282
- var citationCoverageProviderSchema = z20.object({
2283
- provider: z20.string(),
2485
+ import { z as z21 } from "zod";
2486
+ var citationCoverageProviderSchema = z21.object({
2487
+ provider: z21.string(),
2284
2488
  citationState: citationStateSchema,
2285
- cited: z20.boolean(),
2286
- mentioned: z20.boolean(),
2287
- runId: z20.string(),
2288
- runCreatedAt: z20.string()
2289
- });
2290
- var citationCoverageRowSchema = z20.object({
2291
- queryId: z20.string(),
2292
- query: z20.string(),
2293
- providers: z20.array(citationCoverageProviderSchema),
2294
- citedCount: z20.number().int().nonnegative(),
2295
- mentionedCount: z20.number().int().nonnegative(),
2296
- totalProviders: z20.number().int().nonnegative()
2297
- });
2298
- var competitorGapRowSchema = z20.object({
2299
- queryId: z20.string(),
2300
- query: z20.string(),
2301
- provider: z20.string(),
2302
- citingCompetitors: z20.array(z20.string()),
2303
- runId: z20.string(),
2304
- runCreatedAt: z20.string()
2305
- });
2306
- var citationVisibilitySummarySchema = z20.object({
2307
- providersConfigured: z20.number().int().nonnegative(),
2308
- providersCiting: z20.number().int().nonnegative(),
2309
- providersMentioning: z20.number().int().nonnegative(),
2310
- totalQueries: z20.number().int().nonnegative(),
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: z20.number().int().nonnegative(),
2315
- queriesCitedOnly: z20.number().int().nonnegative(),
2316
- queriesMentionedOnly: z20.number().int().nonnegative(),
2317
- queriesInvisible: z20.number().int().nonnegative(),
2318
- latestRunId: z20.string().nullable(),
2319
- latestRunAt: z20.string().nullable()
2320
- });
2321
- var citationVisibilityResponseSchema = z20.object({
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: z20.array(citationCoverageRowSchema),
2324
- competitorGaps: z20.array(competitorGapRowSchema),
2325
- status: z20.enum(["ready", "no-data"]),
2326
- reason: z20.enum(["no-runs-yet", "no-queries"]).optional()
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 z21 } from "zod";
2354
- var providerLocationTreatmentSchema = z21.enum([
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 = z21.object({
2564
+ var reportMetaLocationSchema = z22.object({
2361
2565
  /** Human-readable label as configured on the project (e.g. "michigan"). */
2362
- label: z21.string(),
2566
+ label: z22.string(),
2363
2567
  /** Resolved city/region/country from the project's `LocationContext`. */
2364
- city: z21.string(),
2365
- region: z21.string(),
2366
- country: z21.string(),
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: z21.array(z21.string())
2576
+ otherConfiguredLabels: z22.array(z22.string())
2373
2577
  });
2374
- var reportProviderLocationHandlingSchema = z21.object({
2578
+ var reportProviderLocationHandlingSchema = z22.object({
2375
2579
  /** Provider name (matches `query_snapshots.provider`). */
2376
- provider: z21.string(),
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: z21.string()
2584
+ description: z22.string()
2381
2585
  });
2382
- var reportMetaSchema = z21.object({
2586
+ var reportMetaSchema = z22.object({
2383
2587
  /** ISO timestamp the report was generated (server clock). */
2384
- generatedAt: z21.string(),
2588
+ generatedAt: z22.string(),
2385
2589
  /** Project the report covers. */
2386
- project: z21.object({
2387
- id: z21.string(),
2388
- name: z21.string(),
2389
- displayName: z21.string(),
2390
- canonicalDomain: z21.string(),
2391
- country: z21.string(),
2392
- language: z21.string()
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: z21.array(reportProviderLocationHandlingSchema),
2611
+ providerLocationHandling: z22.array(reportProviderLocationHandlingSchema),
2408
2612
  /** Earliest data point referenced by the report (ISO date). */
2409
- periodStart: z21.string().nullable(),
2613
+ periodStart: z22.string().nullable(),
2410
2614
  /** Latest data point referenced by the report (ISO date). */
2411
- periodEnd: z21.string().nullable()
2615
+ periodEnd: z22.string().nullable()
2412
2616
  });
2413
- var reportExecutiveSummarySchema = z21.object({
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: z21.number(),
2624
+ citationRate: z22.number(),
2421
2625
  /** Numerator of `citationRate` — distinct tracked queries cited by ≥1 provider in the latest run. */
2422
- citedQueryCount: z21.number(),
2626
+ citedQueryCount: z22.number(),
2423
2627
  /** Denominator of `citationRate` — total tracked queries. */
2424
- totalQueryCount: z21.number(),
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: z21.number(),
2636
+ mentionRate: z22.number(),
2433
2637
  /** Numerator of `mentionRate` — distinct tracked queries mentioned in ≥1 provider's answer text. */
2434
- mentionedQueryCount: z21.number(),
2638
+ mentionedQueryCount: z22.number(),
2435
2639
  /** Compared to the previous run: 'up' | 'down' | 'flat' | 'unknown' (no prior run). */
2436
- trend: z21.enum(["up", "down", "flat", "unknown"]),
2640
+ trend: z22.enum(["up", "down", "flat", "unknown"]),
2437
2641
  /** Total tracked queries. */
2438
- queryCount: z21.number(),
2642
+ queryCount: z22.number(),
2439
2643
  /** Total tracked competitors. */
2440
- competitorCount: z21.number(),
2644
+ competitorCount: z22.number(),
2441
2645
  /** Number of providers in the latest run. */
2442
- providerCount: z21.number(),
2646
+ providerCount: z22.number(),
2443
2647
  /** GSC totals across the most-recent sync window. Null when GSC is not connected. */
2444
- gsc: z21.object({
2445
- clicks: z21.number(),
2446
- impressions: z21.number(),
2447
- ctr: z21.number(),
2448
- avgPosition: z21.number(),
2449
- periodStart: z21.string(),
2450
- periodEnd: z21.string()
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: z21.object({
2454
- sessions: z21.number(),
2455
- users: z21.number(),
2456
- periodStart: z21.string(),
2457
- periodEnd: z21.string()
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: z21.array(z21.object({
2461
- title: z21.string(),
2462
- detail: z21.string(),
2463
- tone: z21.enum(["positive", "caution", "negative", "neutral"])
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 = z21.object({
2467
- citationState: z21.enum(["cited", "not-cited", "pending"]),
2468
- answerMentioned: z21.boolean().nullable(),
2469
- model: z21.string().nullable()
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 = z21.object({
2472
- queries: z21.array(z21.string()),
2473
- providers: z21.array(z21.string()),
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: z21.array(z21.array(citationCellSchema.nullable())),
2679
+ matrix: z22.array(z22.array(citationCellSchema.nullable())),
2476
2680
  /** Per-provider citation rate (0..100). */
2477
- providerRates: z21.array(z21.object({
2478
- provider: z21.string(),
2479
- citedCount: z21.number(),
2480
- totalCount: z21.number(),
2481
- citationRate: z21.number()
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 = z21.object({
2485
- domain: z21.string(),
2688
+ var competitorRowSchema = z22.object({
2689
+ domain: z22.string(),
2486
2690
  /** Number of (query × provider) pairs that cited this competitor. */
2487
- citationCount: z21.number(),
2691
+ citationCount: z22.number(),
2488
2692
  /** Out-of count for the same denominator. */
2489
- totalCount: z21.number(),
2693
+ totalCount: z22.number(),
2490
2694
  /** 'High' | 'Moderate' | 'Low' | 'None' — from buildPortfolioProject pressure logic. */
2491
- pressureLabel: z21.enum(["High", "Moderate", "Low", "None"]),
2695
+ pressureLabel: z22.enum(["High", "Moderate", "Low", "None"]),
2492
2696
  /** Distinct queries on which this competitor was cited. */
2493
- citedQueries: z21.array(z21.string()),
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: z21.number(),
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: z21.array(z21.object({ url: z21.string(), citedFor: z21.array(z21.string()) }))
2712
+ theirCitedPages: z22.array(z22.object({ url: z22.string(), citedFor: z22.array(z22.string()) }))
2509
2713
  });
2510
- var competitorLandscapeSchema = z21.object({
2714
+ var competitorLandscapeSchema = z22.object({
2511
2715
  /** Project's own citation count (for the bar chart comparing project vs competitors). */
2512
- projectCitationCount: z21.number(),
2513
- competitors: z21.array(competitorRowSchema)
2716
+ projectCitationCount: z22.number(),
2717
+ competitors: z22.array(competitorRowSchema)
2514
2718
  });
2515
- var mentionRowSchema = z21.object({
2516
- domain: z21.string(),
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: z21.number(),
2722
+ mentionCount: z22.number(),
2519
2723
  /** Out-of count for the same denominator (snapshots that had answer text). */
2520
- totalCount: z21.number(),
2724
+ totalCount: z22.number(),
2521
2725
  /** 'High' | 'Moderate' | 'Low' | 'None' — mention frequency tier (mirrors CompetitorRow.pressureLabel). */
2522
- pressureLabel: z21.enum(["High", "Moderate", "Low", "None"]),
2726
+ pressureLabel: z22.enum(["High", "Moderate", "Low", "None"]),
2523
2727
  /** Distinct queries on which this competitor was mentioned. */
2524
- mentionedQueries: z21.array(z21.string()),
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: z21.number()
2736
+ sharePct: z22.number()
2533
2737
  });
2534
- var mentionLandscapeSchema = z21.object({
2738
+ var mentionLandscapeSchema = z22.object({
2535
2739
  /** Project's own mention count (for the bar chart comparing project vs competitors). */
2536
- projectMentionCount: z21.number(),
2740
+ projectMentionCount: z22.number(),
2537
2741
  /** Snapshots considered — those with non-empty answerText. Drives the totalCount denominator. */
2538
- totalAnswerSnapshots: z21.number(),
2539
- competitors: z21.array(mentionRowSchema)
2742
+ totalAnswerSnapshots: z22.number(),
2743
+ competitors: z22.array(mentionRowSchema)
2540
2744
  });
2541
- var aiSourceCategoryBucketSchema = z21.object({
2745
+ var aiSourceCategoryBucketSchema = z22.object({
2542
2746
  /** Category slug from packages/contracts/src/source-categories. */
2543
- category: z21.string(),
2747
+ category: z22.string(),
2544
2748
  /** Display label. */
2545
- label: z21.string(),
2749
+ label: z22.string(),
2546
2750
  /** Number of citations falling in this category. */
2547
- count: z21.number(),
2751
+ count: z22.number(),
2548
2752
  /** 0..100 share of total citations. */
2549
- sharePct: z21.number()
2753
+ sharePct: z22.number()
2550
2754
  });
2551
- var aiSourceOriginSchema = z21.object({
2552
- categories: z21.array(aiSourceCategoryBucketSchema),
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: z21.array(z21.object({
2555
- domain: z21.string(),
2556
- count: z21.number(),
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: z21.boolean()
2762
+ isCompetitor: z22.boolean()
2559
2763
  }))
2560
2764
  });
2561
- var gscQueryRowSchema = z21.object({
2562
- query: z21.string(),
2563
- clicks: z21.number(),
2564
- impressions: z21.number(),
2565
- ctr: z21.number(),
2566
- avgPosition: z21.number(),
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: z21.enum(["brand", "lead-gen", "industry", "other"])
2569
- });
2570
- var gscSectionSchema = z21.object({
2571
- periodStart: z21.string(),
2572
- periodEnd: z21.string(),
2573
- totalClicks: z21.number(),
2574
- totalImpressions: z21.number(),
2575
- ctr: z21.number(),
2576
- avgPosition: z21.number(),
2577
- topQueries: z21.array(gscQueryRowSchema),
2578
- categoryBreakdown: z21.array(z21.object({
2579
- category: z21.enum(["brand", "lead-gen", "industry", "other"]),
2580
- clicks: z21.number(),
2581
- impressions: z21.number(),
2582
- sharePct: z21.number()
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: z21.array(z21.object({ date: z21.string(), clicks: z21.number(), impressions: z21.number() })),
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: z21.array(z21.string()),
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: z21.array(z21.string())
2595
- });
2596
- var gaTrafficSectionSchema = z21.object({
2597
- totalSessions: z21.number(),
2598
- totalUsers: z21.number(),
2599
- totalOrganicSessions: z21.number(),
2600
- periodStart: z21.string(),
2601
- periodEnd: z21.string(),
2602
- topLandingPages: z21.array(z21.object({
2603
- page: z21.string(),
2604
- sessions: z21.number(),
2605
- users: z21.number(),
2606
- organicSessions: z21.number()
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: z21.array(z21.object({
2609
- channel: z21.string(),
2610
- sessions: z21.number(),
2611
- sharePct: z21.number()
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 = z21.object({
2615
- totalSessions: z21.number(),
2616
- organicSessions: z21.number(),
2617
- paidSessions: z21.number(),
2618
- channels: z21.array(z21.object({
2619
- channelGroup: z21.string(),
2620
- sessions: z21.number(),
2621
- sharePct: z21.number()
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: z21.array(z21.object({
2624
- source: z21.string(),
2625
- medium: z21.string(),
2626
- sessions: z21.number()
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 = z21.object({
2630
- totalSessions: z21.number(),
2631
- totalUsers: z21.number(),
2632
- bySource: z21.array(z21.object({
2633
- source: z21.string(),
2634
- sessions: z21.number(),
2635
- users: z21.number(),
2636
- sharePct: z21.number()
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: z21.array(z21.object({ date: z21.string(), sessions: z21.number() })),
2639
- topLandingPages: z21.array(z21.object({
2640
- page: z21.string(),
2641
- sessions: z21.number(),
2642
- users: z21.number()
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 = z21.object({
2849
+ var serverActivitySectionSchema = z22.object({
2646
2850
  /** ISO8601 inclusive lower bound of the report window (default: 7 days). */
2647
- windowStart: z21.string(),
2851
+ windowStart: z22.string(),
2648
2852
  /** ISO8601 inclusive upper bound. */
2649
- windowEnd: z21.string(),
2650
- hasData: z21.boolean(),
2853
+ windowEnd: z22.string(),
2854
+ hasData: z22.boolean(),
2651
2855
  /** Last-7d total verified crawler hits, with prior 7d for delta. */
2652
- verifiedCrawlerHits: z21.object({ current: z21.number(), prior: z21.number(), deltaPct: z21.number().nullable() }),
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: z21.object({ current: z21.number(), prior: z21.number(), deltaPct: z21.number().nullable() }),
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: z21.object({ current: z21.number(), prior: z21.number(), deltaPct: z21.number().nullable() }),
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: z21.object({ current: z21.number(), prior: z21.number(), deltaPct: z21.number().nullable() }),
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: z21.array(z21.object({
2668
- operator: z21.string(),
2669
- verifiedHits: z21.number(),
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: z21.number(),
2875
+ unverifiedHits: z22.number(),
2672
2876
  /** Per-user fetches from this operator's AI surface (ChatGPT-User, …). */
2673
- userFetchHits: z21.number(),
2674
- referralArrivals: z21.number(),
2675
- deltaPct: z21.number().nullable()
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: z21.array(z21.object({
2686
- path: z21.string(),
2687
- verifiedHits: z21.number(),
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: z21.number()
2893
+ distinctOperators: z22.number()
2690
2894
  })),
2691
2895
  /** AI products that sent ≥1 session in the window (referral by destination). */
2692
- referralProducts: z21.array(z21.object({
2693
- product: z21.string(),
2694
- arrivals: z21.number(),
2695
- distinctLandingPaths: z21.number()
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: z21.array(z21.object({
2699
- date: z21.string(),
2700
- verifiedCrawlerHits: z21.number(),
2701
- userFetchHits: z21.number(),
2702
- referralArrivals: z21.number()
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: z21.array(z21.object({
2709
- path: z21.string(),
2710
- arrivals: z21.number(),
2711
- distinctProducts: z21.number()
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 = z21.object({
2918
+ var indexingHealthSectionSchema = z22.object({
2715
2919
  /** Source: 'google' | 'bing' | null when neither is connected. */
2716
- provider: z21.enum(["google", "bing"]).nullable(),
2717
- total: z21.number(),
2718
- indexed: z21.number(),
2719
- notIndexed: z21.number(),
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: z21.number(),
2925
+ deindexed: z22.number(),
2722
2926
  /** Bing-only — pages with no inspection data yet. */
2723
- unknown: z21.number(),
2927
+ unknown: z22.number(),
2724
2928
  /** 0..100. */
2725
- indexedPct: z21.number()
2929
+ indexedPct: z22.number()
2726
2930
  });
2727
- var citationsTrendPointSchema = z21.object({
2931
+ var citationsTrendPointSchema = z22.object({
2728
2932
  /** Run ID — anchor for cross-section linking. */
2729
- runId: z21.string(),
2933
+ runId: z22.string(),
2730
2934
  /** ISO timestamp when the run finished (or createdAt fallback). */
2731
- date: z21.string(),
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: z21.number(),
2942
+ citationRate: z22.number(),
2739
2943
  /** Numerator of `citationRate` for this run. */
2740
- citedQueryCount: z21.number(),
2944
+ citedQueryCount: z22.number(),
2741
2945
  /** Denominator of `citationRate` for this run. */
2742
- totalQueryCount: z21.number(),
2946
+ totalQueryCount: z22.number(),
2743
2947
  /** 0..100 — same per-query unique-mentioned definition as `ReportExecutiveSummary.mentionRate`. */
2744
- mentionRate: z21.number(),
2948
+ mentionRate: z22.number(),
2745
2949
  /** Numerator of `mentionRate` for this run. */
2746
- mentionedQueryCount: z21.number(),
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: z21.array(z21.object({ provider: z21.string(), citationRate: z21.number() }))
2753
- });
2754
- var reportInsightSchema = z21.object({
2755
- id: z21.string(),
2756
- type: z21.enum(["regression", "gain", "opportunity"]),
2757
- severity: z21.enum(["critical", "high", "medium", "low"]),
2758
- title: z21.string(),
2759
- query: z21.string(),
2760
- provider: z21.string(),
2761
- recommendation: z21.string().nullable(),
2762
- createdAt: z21.string(),
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: z21.number()
2974
+ instanceCount: z22.number()
2771
2975
  });
2772
- var recommendedNextStepSchema = z21.object({
2976
+ var recommendedNextStepSchema = z22.object({
2773
2977
  /** 'immediate' | 'short-term' | 'medium-term' — bucketed by severity heuristic. */
2774
- horizon: z21.enum(["immediate", "short-term", "medium-term"]),
2775
- title: z21.string(),
2776
- rationale: z21.string()
2978
+ horizon: z22.enum(["immediate", "short-term", "medium-term"]),
2979
+ title: z22.string(),
2980
+ rationale: z22.string()
2777
2981
  });
2778
- var reportRateDeltaSchema = z21.object({
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: z21.number(),
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: z21.number(),
2988
+ prior: z22.number(),
2785
2989
  /** Absolute delta (current − prior). Negative = decrease. */
2786
- deltaAbs: z21.number(),
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: z21.enum(["up", "down", "flat"]),
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: z21.number().optional()
3003
+ window: z22.number().optional()
2800
3004
  });
2801
- var reportProviderMovementSchema = z21.object({
2802
- provider: z21.string(),
2803
- current: z21.number(),
2804
- prior: z21.number(),
2805
- deltaAbs: z21.number(),
2806
- direction: z21.enum(["up", "down", "flat"])
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 = z21.object({
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: z21.boolean(),
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: z21.string(),
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: z21.array(reportProviderMovementSchema),
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: z21.array(reportInsightSchema),
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: z21.array(reportInsightSchema)
2854
- });
2855
- var reportAudienceSchema = z21.enum(["agency", "client"]);
2856
- var reportActionAudienceSchema = z21.enum(["agency", "client", "both"]);
2857
- var reportActionHorizonSchema = z21.enum(["immediate", "short-term", "medium-term"]);
2858
- var reportActionConfidenceSchema = z21.enum(["high", "medium", "low"]);
2859
- var reportToneSchema = z21.enum(["positive", "caution", "negative", "neutral"]);
2860
- var reportActionCategorySchema = z21.enum([
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 = z21.object({
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: z21.number(),
3077
+ priority: z22.number(),
2874
3078
  /** When this should be tackled. */
2875
3079
  horizon: reportActionHorizonSchema,
2876
3080
  category: reportActionCategorySchema,
2877
- title: z21.string(),
3081
+ title: z22.string(),
2878
3082
  /** Direct next step written as an operator/client-friendly imperative. */
2879
- action: z21.string(),
3083
+ action: z22.string(),
2880
3084
  /** Why this matters. Keep each entry concise and evidence-backed. */
2881
- why: z21.array(z21.string()),
3085
+ why: z22.array(z22.string()),
2882
3086
  /** Specific observations that justify the action. */
2883
- evidence: z21.array(z21.string()),
3087
+ evidence: z22.array(z22.string()),
2884
3088
  /** What should move if the action worked. */
2885
- successMetric: z21.string(),
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: z21.string().optional()
3101
+ targetRef: z22.string().optional()
2898
3102
  });
2899
- var reportClientSummarySchema = z21.object({
2900
- headline: z21.string(),
2901
- overview: z21.string(),
2902
- actionItems: z21.array(reportActionPlanItemSchema),
2903
- confidenceNotes: z21.array(z21.string())
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 = z21.object({
2906
- title: z21.string(),
2907
- detail: z21.string(),
2908
- severity: z21.enum(["positive", "caution", "negative", "neutral"]),
2909
- evidence: z21.array(z21.string())
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 = z21.object({
2912
- priorities: z21.array(reportActionPlanItemSchema),
2913
- diagnostics: z21.array(reportAgencyDiagnosticSchema)
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 = z21.object({
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: z21.array(citationsTrendPointSchema),
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: z21.array(reportInsightSchema),
2992
- recommendedNextSteps: z21.array(recommendedNextStepSchema),
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: z21.array(reportActionPlanItemSchema),
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: z21.array(contentTargetRowDtoSchema),
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: z21.array(contentGapRowDtoSchema),
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: z21.array(contentSourceRowDtoSchema)
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 z22 } from "zod";
3086
- var codingAgentSchema = z22.enum(["claude", "codex"]);
3289
+ import { z as z23 } from "zod";
3290
+ var codingAgentSchema = z23.enum(["claude", "codex"]);
3087
3291
  var CodingAgents = codingAgentSchema.enum;
3088
- var skillsClientSchema = z22.enum(["claude", "codex", "all"]);
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 z23 } from "zod";
3093
- var trafficSourceTypeSchema = z23.enum([
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 = z23.enum([
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 = z23.enum(["raw-request", "aggregate-bucket"]);
3330
+ var trafficEvidenceKindSchema = z24.enum(["raw-request", "aggregate-bucket"]);
3113
3331
  var TrafficEvidenceKinds = trafficEvidenceKindSchema.enum;
3114
- var trafficEventConfidenceSchema = z23.enum(["observed", "provider-aggregated", "inferred"]);
3332
+ var trafficEventConfidenceSchema = z24.enum(["observed", "provider-aggregated", "inferred"]);
3115
3333
  var TrafficEventConfidences = trafficEventConfidenceSchema.enum;
3116
- var trafficProviderResourceSchema = z23.object({
3117
- type: z23.string().nullable(),
3118
- labels: z23.record(z23.string(), z23.string())
3334
+ var trafficProviderResourceSchema = z24.object({
3335
+ type: z24.string().nullable(),
3336
+ labels: z24.record(z24.string(), z24.string())
3119
3337
  });
3120
- var normalizedTrafficRequestSchema = z23.object({
3338
+ var normalizedTrafficRequestSchema = z24.object({
3121
3339
  sourceType: trafficSourceTypeSchema,
3122
- evidenceKind: z23.literal(TrafficEvidenceKinds["raw-request"]),
3123
- confidence: z23.literal(TrafficEventConfidences.observed),
3124
- eventId: z23.string().min(1),
3125
- observedAt: z23.string().min(1),
3126
- method: z23.string().nullable(),
3127
- requestUrl: z23.string().nullable(),
3128
- host: z23.string().nullable(),
3129
- path: z23.string().min(1),
3130
- queryString: z23.string().nullable(),
3131
- status: z23.number().int().nullable(),
3132
- userAgent: z23.string().nullable(),
3133
- remoteIp: z23.string().nullable(),
3134
- referer: z23.string().nullable(),
3135
- latencyMs: z23.number().nullable(),
3136
- requestSizeBytes: z23.number().int().nullable(),
3137
- responseSizeBytes: z23.number().int().nullable(),
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: z23.record(z23.string(), z23.string())
3357
+ providerLabels: z24.record(z24.string(), z24.string())
3140
3358
  });
3141
- var normalizedTrafficPullPageSchema = z23.object({
3142
- events: z23.array(normalizedTrafficRequestSchema),
3143
- rawEntryCount: z23.number().int().nonnegative(),
3144
- skippedEntryCount: z23.number().int().nonnegative(),
3145
- nextPageToken: z23.string().optional(),
3146
- filter: z23.string()
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 = z23.enum(["connected", "paused", "error", "archived"]);
3366
+ var trafficSourceStatusSchema = z24.enum(["connected", "paused", "error", "archived"]);
3149
3367
  var TrafficSourceStatuses = trafficSourceStatusSchema.enum;
3150
- var trafficSourceAuthModeSchema = z23.enum(["oauth", "service-account"]);
3368
+ var trafficSourceAuthModeSchema = z24.enum(["oauth", "service-account"]);
3151
3369
  var TrafficSourceAuthModes = trafficSourceAuthModeSchema.enum;
3152
- var verificationStatusSchema = z23.enum(["verified", "claimed_unverified", "unknown_ai_like"]);
3370
+ var verificationStatusSchema = z24.enum(["verified", "claimed_unverified", "unknown_ai_like"]);
3153
3371
  var VerificationStatuses = verificationStatusSchema.enum;
3154
- var cloudRunSourceConfigSchema = z23.object({
3155
- gcpProjectId: z23.string().min(1),
3156
- serviceName: z23.string().nullable().optional(),
3157
- location: z23.string().nullable().optional(),
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 = z23.object({
3161
- baseUrl: z23.string().url(),
3162
- username: z23.string().min(1)
3378
+ var wordpressTrafficSourceConfigSchema = z24.object({
3379
+ baseUrl: z24.string().url(),
3380
+ username: z24.string().min(1)
3163
3381
  });
3164
- var vercelTrafficEnvironmentSchema = z23.enum(["production", "preview"]);
3382
+ var vercelTrafficEnvironmentSchema = z24.enum(["production", "preview"]);
3165
3383
  var VercelTrafficEnvironments = vercelTrafficEnvironmentSchema.enum;
3166
- var vercelTrafficSourceConfigSchema = z23.object({
3384
+ var vercelTrafficSourceConfigSchema = z24.object({
3167
3385
  /** Vercel project id (e.g. `prj_...`). */
3168
- projectId: z23.string().min(1),
3386
+ projectId: z24.string().min(1),
3169
3387
  /** Vercel team or account id: the org that owns the project. */
3170
- teamId: z23.string().min(1),
3388
+ teamId: z24.string().min(1),
3171
3389
  environment: vercelTrafficEnvironmentSchema
3172
3390
  });
3173
- var trafficSourceDtoSchema = z23.object({
3174
- id: z23.string(),
3175
- projectId: z23.string(),
3391
+ var trafficSourceDtoSchema = z24.object({
3392
+ id: z24.string(),
3393
+ projectId: z24.string(),
3176
3394
  sourceType: trafficSourceTypeSchema,
3177
- displayName: z23.string(),
3395
+ displayName: z24.string(),
3178
3396
  status: trafficSourceStatusSchema,
3179
- lastSyncedAt: z23.string().nullable(),
3180
- lastCursor: z23.string().nullable(),
3181
- lastError: z23.string().nullable(),
3182
- archivedAt: z23.string().nullable(),
3183
- config: z23.record(z23.string(), z23.unknown()),
3184
- createdAt: z23.string(),
3185
- updatedAt: z23.string()
3186
- });
3187
- var trafficConnectCloudRunRequestSchema = z23.object({
3188
- gcpProjectId: z23.string().min(1),
3189
- serviceName: z23.string().min(1).optional(),
3190
- location: z23.string().min(1).optional(),
3191
- displayName: z23.string().min(1).optional(),
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: z23.string().optional()
3411
+ keyJson: z24.string().optional()
3194
3412
  });
3195
- var trafficConnectWordpressRequestSchema = z23.object({
3196
- baseUrl: z23.string().url(),
3197
- username: z23.string().min(1),
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: z23.string().min(1),
3200
- displayName: z23.string().min(1).optional()
3417
+ applicationPassword: z24.string().min(1),
3418
+ displayName: z24.string().min(1).optional()
3201
3419
  });
3202
- var trafficConnectVercelRequestSchema = z23.object({
3420
+ var trafficConnectVercelRequestSchema = z24.object({
3203
3421
  /** Vercel project id (e.g. `prj_...`) — from the Vercel dashboard or `.vercel/project.json`. */
3204
- projectId: z23.string().min(1),
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: z23.string().min(1),
3424
+ teamId: z24.string().min(1),
3207
3425
  /** Vercel personal access token. Stored in `~/.canonry/config.yaml`, never the DB. */
3208
- token: z23.string().min(1),
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: z23.string().min(1).optional()
3212
- });
3213
- var trafficSyncResponseSchema = z23.object({
3214
- sourceId: z23.string(),
3215
- runId: z23.string(),
3216
- syncedAt: z23.string(),
3217
- pulledEvents: z23.number().int().nonnegative(),
3218
- crawlerHits: z23.number().int().nonnegative(),
3219
- aiUserFetchHits: z23.number().int().nonnegative(),
3220
- aiReferralHits: z23.number().int().nonnegative(),
3221
- unknownHits: z23.number().int().nonnegative(),
3222
- crawlerBucketRows: z23.number().int().nonnegative(),
3223
- aiUserFetchBucketRows: z23.number().int().nonnegative(),
3224
- aiReferralBucketRows: z23.number().int().nonnegative(),
3225
- sampleRows: z23.number().int().nonnegative(),
3226
- windowStart: z23.string(),
3227
- windowEnd: z23.string()
3228
- });
3229
- var trafficBackfillRequestSchema = z23.object({
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: z23.number().int().positive().optional()
3449
+ days: z24.number().int().positive().optional()
3232
3450
  });
3233
- var trafficResetRequestSchema = z23.object({
3234
- advanceToNow: z23.literal(true)
3451
+ var trafficResetRequestSchema = z24.object({
3452
+ advanceToNow: z24.literal(true)
3235
3453
  });
3236
- var trafficBackfillResponseSchema = z23.object({
3237
- sourceId: z23.string(),
3238
- runId: z23.string(),
3454
+ var trafficBackfillResponseSchema = z24.object({
3455
+ sourceId: z24.string(),
3456
+ runId: z24.string(),
3239
3457
  status: runStatusSchema,
3240
- windowStart: z23.string(),
3241
- windowEnd: z23.string(),
3458
+ windowStart: z24.string(),
3459
+ windowEnd: z24.string(),
3242
3460
  /** Days actually used after server-side clamping (≤ requested). */
3243
- daysRequested: z23.number().int().positive(),
3244
- daysApplied: z23.number().int().positive()
3461
+ daysRequested: z24.number().int().positive(),
3462
+ daysApplied: z24.number().int().positive()
3245
3463
  });
3246
- var trafficSourceTotalsSchema = z23.object({
3247
- crawlerHits: z23.number().int().nonnegative(),
3248
- aiUserFetchHits: z23.number().int().nonnegative(),
3249
- aiReferralHits: z23.number().int().nonnegative(),
3250
- sampleCount: z23.number().int().nonnegative()
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 = z23.object({
3253
- sources: z23.array(trafficSourceDtoSchema)
3470
+ var trafficSourceListResponseSchema = z24.object({
3471
+ sources: z24.array(trafficSourceDtoSchema)
3254
3472
  });
3255
3473
  var trafficSourceDetailDtoSchema = trafficSourceDtoSchema.extend({
3256
3474
  totals24h: trafficSourceTotalsSchema,
3257
- latestRun: z23.object({
3258
- runId: z23.string(),
3475
+ latestRun: z24.object({
3476
+ runId: z24.string(),
3259
3477
  status: runStatusSchema,
3260
- startedAt: z23.string().nullable(),
3261
- finishedAt: z23.string().nullable(),
3262
- error: z23.string().nullable()
3478
+ startedAt: z24.string().nullable(),
3479
+ finishedAt: z24.string().nullable(),
3480
+ error: z24.string().nullable()
3263
3481
  }).nullable()
3264
3482
  });
3265
- var trafficStatusResponseSchema = z23.object({
3266
- sources: z23.array(trafficSourceDetailDtoSchema)
3483
+ var trafficStatusResponseSchema = z24.object({
3484
+ sources: z24.array(trafficSourceDetailDtoSchema)
3267
3485
  });
3268
- var trafficEventKindSchema = z23.enum(["crawler", "ai-user-fetch", "ai-referral"]);
3486
+ var trafficEventKindSchema = z24.enum(["crawler", "ai-user-fetch", "ai-referral"]);
3269
3487
  var TrafficEventKinds = trafficEventKindSchema.enum;
3270
- var trafficCrawlerEventEntrySchema = z23.object({
3271
- kind: z23.literal(TrafficEventKinds.crawler),
3272
- sourceId: z23.string(),
3273
- tsHour: z23.string(),
3274
- botId: z23.string(),
3275
- operator: z23.string(),
3276
- verificationStatus: z23.string(),
3277
- pathNormalized: z23.string(),
3278
- status: z23.number().int(),
3279
- hits: z23.number().int().nonnegative()
3280
- });
3281
- var trafficAiUserFetchEventEntrySchema = z23.object({
3282
- kind: z23.literal(TrafficEventKinds["ai-user-fetch"]),
3283
- sourceId: z23.string(),
3284
- tsHour: z23.string(),
3285
- botId: z23.string(),
3286
- operator: z23.string(),
3287
- verificationStatus: z23.string(),
3288
- pathNormalized: z23.string(),
3289
- status: z23.number().int(),
3290
- hits: z23.number().int().nonnegative()
3291
- });
3292
- var trafficAiReferralEventEntrySchema = z23.object({
3293
- kind: z23.literal(TrafficEventKinds["ai-referral"]),
3294
- sourceId: z23.string(),
3295
- tsHour: z23.string(),
3296
- product: z23.string(),
3297
- operator: z23.string(),
3298
- sourceDomain: z23.string(),
3299
- evidenceType: z23.string(),
3300
- landingPathNormalized: z23.string(),
3301
- status: z23.number().int(),
3302
- hits: z23.number().int().nonnegative()
3303
- });
3304
- var trafficEventEntrySchema = z23.discriminatedUnion("kind", [
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 = z23.object({
3310
- windowStart: z23.string(),
3311
- windowEnd: z23.string(),
3312
- totals: z23.object({
3313
- crawlerHits: z23.number().int().nonnegative(),
3314
- aiUserFetchHits: z23.number().int().nonnegative(),
3315
- aiReferralHits: z23.number().int().nonnegative()
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: z23.array(trafficEventEntrySchema)
3535
+ events: z24.array(trafficEventEntrySchema)
3318
3536
  });
3319
3537
 
3320
3538
  // ../contracts/src/discovery.ts
3321
- import { z as z24 } from "zod";
3322
- var discoveryBucketSchema = z24.enum(["cited", "aspirational", "wasted-surface"]);
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 = z24.enum([
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 = z24.enum(["queued", "seeding", "probing", "completed", "failed"]);
3559
+ var discoverySessionStatusSchema = z25.enum(["queued", "seeding", "probing", "completed", "failed"]);
3342
3560
  var DiscoverySessionStatuses = discoverySessionStatusSchema.enum;
3343
- var discoveryCompetitorMapEntrySchema = z24.object({
3344
- domain: z24.string().min(1),
3345
- hits: z24.number().int().positive(),
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 = z24.object({
3355
- id: z24.string(),
3356
- sessionId: z24.string(),
3357
- projectId: z24.string(),
3358
- query: z24.string(),
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: z24.array(z24.string()).default([]),
3362
- createdAt: z24.string()
3579
+ citedDomains: z25.array(z25.string()).default([]),
3580
+ createdAt: z25.string()
3363
3581
  });
3364
- var discoverySessionDtoSchema = z24.object({
3365
- id: z24.string(),
3366
- projectId: z24.string(),
3582
+ var discoverySessionDtoSchema = z25.object({
3583
+ id: z25.string(),
3584
+ projectId: z25.string(),
3367
3585
  status: discoverySessionStatusSchema,
3368
- icpDescription: z24.string().nullable().optional(),
3369
- seedProvider: z24.string().nullable().optional(),
3370
- seedCountRaw: z24.number().int().nullable().optional(),
3371
- seedCount: z24.number().int().nullable().optional(),
3372
- dedupThreshold: z24.number().nullable().optional(),
3373
- probeCount: z24.number().int().nullable().optional(),
3374
- citedCount: z24.number().int().nullable().default(null),
3375
- aspirationalCount: z24.number().int().nullable().default(null),
3376
- wastedCount: z24.number().int().nullable().default(null),
3377
- competitorMap: z24.array(discoveryCompetitorMapEntrySchema).default([]),
3378
- error: z24.string().nullable().optional(),
3379
- startedAt: z24.string().nullable().optional(),
3380
- finishedAt: z24.string().nullable().optional(),
3381
- createdAt: z24.string()
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: z24.array(discoveryProbeDtoSchema).default([])
3602
+ probes: z25.array(discoveryProbeDtoSchema).default([])
3385
3603
  });
3386
3604
  var DISCOVERY_MAX_PROBES_CAP = 500;
3387
- var discoveryRunRequestSchema = z24.object({
3388
- icpDescription: z24.string().min(1).optional(),
3389
- dedupThreshold: z24.number().min(0).max(1).optional(),
3390
- maxProbes: z24.number().int().positive().max(DISCOVERY_MAX_PROBES_CAP).optional(),
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: z24.array(z24.string().min(1)).optional()
3616
+ locations: z25.array(z25.string().min(1)).optional()
3399
3617
  });
3400
- var discoveryPromoteRequestSchema = z24.object({
3401
- buckets: z24.array(discoveryBucketSchema).min(1).optional(),
3402
- includeCompetitors: z24.boolean().optional(),
3403
- competitorTypes: z24.array(discoveryCompetitorTypeSchema).min(1).optional()
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 = z24.object({
3406
- sessionId: z24.string(),
3407
- projectId: z24.string(),
3623
+ var discoveryPromotePreviewSchema = z25.object({
3624
+ sessionId: z25.string(),
3625
+ projectId: z25.string(),
3408
3626
  status: discoverySessionStatusSchema,
3409
- queriesByBucket: z24.object({
3410
- cited: z24.array(z24.string()),
3411
- aspirational: z24.array(z24.string()),
3412
- "wasted-surface": z24.array(z24.string())
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: z24.array(discoveryCompetitorMapEntrySchema)
3415
- });
3416
- var discoveryPromoteResultSchema = z24.object({
3417
- sessionId: z24.string(),
3418
- projectId: z24.string(),
3419
- promoted: z24.object({
3420
- queries: z24.array(z24.string()),
3421
- competitors: z24.array(z24.string())
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: z24.object({
3424
- queries: z24.array(z24.string()),
3425
- competitors: z24.array(z24.string())
3641
+ skipped: z25.object({
3642
+ queries: z25.array(z25.string()),
3643
+ competitors: z25.array(z25.string())
3426
3644
  })
3427
3645
  });
3428
- var queryProvenanceSchema = z24.union([
3429
- z24.literal("cli"),
3430
- z24.string().regex(/^discovery:.+$/)
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,