@canonry/canonry 7.17.1 → 7.18.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 (36) hide show
  1. package/assets/agent-workspace/skills/aero/references/portfolio-analysis.md +8 -6
  2. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +1 -1
  3. package/assets/assets/{AuditHistoryPanel-CzjskfMX.js → AuditHistoryPanel-CgKpjgpq.js} +1 -1
  4. package/assets/assets/BacklinksPage-BBqbRSeG.js +1 -0
  5. package/assets/assets/Hint-DICI5Jq9.js +1 -0
  6. package/assets/assets/{HistoryPage-BZgVoYGm.js → HistoryPage-D8nQ8E8_.js} +1 -1
  7. package/assets/assets/{MeasurementPropertyPage-EBI5sn-D.js → MeasurementPropertyPage-CQ8lLoeA.js} +1 -1
  8. package/assets/assets/{ProjectPage-lGGjM_qj.js → ProjectPage-CP4fvluh.js} +6 -6
  9. package/assets/assets/{RunsPage-CuHi8241.js → RunsPage-D0qkTwas.js} +1 -1
  10. package/assets/assets/{SettingsPage-D0fgAoVu.js → SettingsPage-DaqR1wKC.js} +1 -1
  11. package/assets/assets/SiteHealthSection-dGXxZ8IR.js +4 -0
  12. package/assets/assets/{TrafficPage-DD65RqeR.js → TrafficPage-DodOmnVv.js} +1 -1
  13. package/assets/assets/{TrafficSourceDetailPage-CFVCj13J.js → TrafficSourceDetailPage-C7b-BcKF.js} +1 -1
  14. package/assets/assets/{extract-error-message-D118msoE.js → extract-error-message-BYvzTsML.js} +1 -1
  15. package/assets/assets/index-BVzozur0.js +86 -0
  16. package/assets/assets/{react-sigma_core.esm.min-DdlHLMEz.js → react-sigma_core.esm.min-DXcq1O0r.js} +1 -1
  17. package/assets/assets/{v2-overview-adapter-CoCb2aB0.js → v2-overview-adapter-1MHnrdnr.js} +1 -1
  18. package/assets/assets/{vendor-lucide-N6vOpZmh.js → vendor-lucide-Y6jANGfG.js} +1 -1
  19. package/assets/index.html +2 -2
  20. package/dist/{chunk-ORA5R7QM.js → chunk-5M2RY5WU.js} +132 -104
  21. package/dist/{chunk-ZQ7C6IFA.js → chunk-COQOQYRZ.js} +749 -614
  22. package/dist/{chunk-FK7AWV57.js → chunk-EAAM47H6.js} +24 -9
  23. package/dist/{chunk-PLS4EM2Y.js → chunk-JMC7CEJB.js} +4 -4
  24. package/dist/{chunk-OPJCFDNR.js → chunk-JUOFNJLV.js} +3 -3
  25. package/dist/{chunk-C6GWKYGE.js → chunk-U7D7LNVJ.js} +5 -4
  26. package/dist/{chunk-MHB23E3N.js → chunk-X2S7D3MN.js} +123 -82
  27. package/dist/cli.js +30 -22
  28. package/dist/{demo-server-WQDHQG6P.js → demo-server-XWRIXME5.js} +6 -5
  29. package/dist/index.d.ts +7 -5
  30. package/dist/index.js +6 -6
  31. package/dist/{intelligence-service-JWZRZ6JZ.js → intelligence-service-332S7D7Y.js} +2 -2
  32. package/dist/mcp.js +4 -4
  33. package/package.json +12 -12
  34. package/assets/assets/BacklinksPage-ToENGBdp.js +0 -1
  35. package/assets/assets/SiteHealthSection-DhLxldgs.js +0 -4
  36. package/assets/assets/index-DxFd1t4G.js +0 -86
@@ -2918,6 +2918,14 @@ function getDomainWithoutSuffix2(url, options) {
2918
2918
  return parseImpl(url, 5, suffixLookup, options, RESULT).domainWithoutSuffix;
2919
2919
  }
2920
2920
 
2921
+ // ../contracts/src/text-order.ts
2922
+ function compareText(left, right) {
2923
+ return left < right ? -1 : left > right ? 1 : 0;
2924
+ }
2925
+ function sortedUnique(values) {
2926
+ return [...new Set(values)].sort(compareText);
2927
+ }
2928
+
2921
2929
  // ../contracts/src/url-normalize.ts
2922
2930
  var DOMAIN_PARSE_OPTIONS = { allowPrivateDomains: true };
2923
2931
  var LINKIFY = new LinkifyIt({ fuzzyLink: true, fuzzyEmail: false }).tlds(tlds_default2);
@@ -3070,11 +3078,7 @@ function normalizeUrlPath(input) {
3070
3078
  pathPart = collapseRootIndex(pathPart);
3071
3079
  pathPart = dropTrailingSlash(pathPart);
3072
3080
  const pairs = parseQuery(queryPart).filter((p) => !shouldStrip(p.key));
3073
- pairs.sort((a, b) => {
3074
- if (a.key < b.key) return -1;
3075
- if (a.key > b.key) return 1;
3076
- return 0;
3077
- });
3081
+ pairs.sort((a, b) => compareText(a.key, b.key));
3078
3082
  if (pairs.length === 0) return pathPart;
3079
3083
  return `${pathPart}?${encodeQuery(pairs)}`;
3080
3084
  }
@@ -3594,9 +3598,6 @@ var measurementPlanV2Schema = z6.object({
3594
3598
  }
3595
3599
  }
3596
3600
  });
3597
- function compareText(left, right) {
3598
- return left < right ? -1 : left > right ? 1 : 0;
3599
- }
3600
3601
  function canonicalJsonValue(value) {
3601
3602
  if (Array.isArray(value)) return value.map(canonicalJsonValue);
3602
3603
  if (value && typeof value === "object") {
@@ -3719,8 +3720,9 @@ var measurementCountMetricValueSchema = z6.discriminatedUnion("state", [
3719
3720
  reason: measurementMetricUnavailableReasonSchema
3720
3721
  }).strict()
3721
3722
  ]);
3722
- var measurementOverviewScopeKindSchema = z6.enum(["all", "group", "property"]);
3723
+ var measurementOverviewScopeKindSchema = z6.enum(["all", "group", "market", "property"]);
3723
3724
  var measurementQueryClassFilterSchema = queryClassFilterSchema;
3725
+ var MEASUREMENT_DEFAULT_QUERY_CLASS = "non-brand";
3724
3726
  var measurementOverviewSortSchema = z6.enum([
3725
3727
  "label-asc",
3726
3728
  "label-desc",
@@ -3741,7 +3743,10 @@ var measurementNextActionKindSchema = z6.enum([
3741
3743
  var measurementOverviewQuerySchema = z6.object({
3742
3744
  scope: measurementOverviewScopeKindSchema,
3743
3745
  groupKey: measurementV2StableKeySchema.optional(),
3746
+ /** Required for market scope: a frozen reporting scope's stable key. */
3747
+ marketKey: measurementV2StableKeySchema.optional(),
3744
3748
  targetKey: measurementV2StableKeySchema.optional(),
3749
+ /** Omit for non-brand. `all` pools branded and non-brand into one rate. */
3745
3750
  queryClass: measurementQueryClassFilterSchema.optional(),
3746
3751
  provider: providerNameSchema.optional(),
3747
3752
  location: z6.string().trim().min(1).optional(),
@@ -4028,9 +4033,6 @@ var measurementTargetQuerySelectionSchema = z7.object({
4028
4033
  queryIds: z7.array(measurementQueryIdSchema).min(1),
4029
4034
  context: locationContextSchema.nullable().optional()
4030
4035
  }).strict();
4031
- function compareText2(left, right) {
4032
- return left < right ? -1 : left > right ? 1 : 0;
4033
- }
4034
4036
  function duplicateValues(values, normalize = (value) => value) {
4035
4037
  const seen = /* @__PURE__ */ new Set();
4036
4038
  const duplicates = /* @__PURE__ */ new Set();
@@ -4080,26 +4082,23 @@ function matcherCanonicalKey(matcher) {
4080
4082
  function compareMatchers(left, right) {
4081
4083
  const leftParts = matcherParts(left);
4082
4084
  const rightParts = matcherParts(right);
4083
- return compareText2(leftParts.host, rightParts.host) || matcherSpecificity(right) - matcherSpecificity(left) || compareText2(leftParts.pathname ?? "", rightParts.pathname ?? "") || compareText2(left.kind === "host" ? "" : left.pathCase, right.kind === "host" ? "" : right.pathCase);
4085
+ return compareText(leftParts.host, rightParts.host) || matcherSpecificity(right) - matcherSpecificity(left) || compareText(leftParts.pathname ?? "", rightParts.pathname ?? "") || compareText(left.kind === "host" ? "" : left.pathCase, right.kind === "host" ? "" : right.pathCase);
4084
4086
  }
4085
4087
  function canonicalAliases(values) {
4086
4088
  const seen = /* @__PURE__ */ new Set();
4087
- return [...values].sort(compareText2).filter((alias) => {
4089
+ return [...values].sort(compareText).filter((alias) => {
4088
4090
  const key = brandKeyFromText(alias);
4089
4091
  if (seen.has(key)) return false;
4090
4092
  seen.add(key);
4091
4093
  return true;
4092
4094
  });
4093
4095
  }
4094
- function canonicalStrings(values) {
4095
- return [...new Set(values)].sort(compareText2);
4096
- }
4097
4096
  function canonicalMatchers(values) {
4098
4097
  return [...new Map(values.map((matcher) => [matcherCanonicalKey(matcher), matcher])).values()].sort(compareMatchers);
4099
4098
  }
4100
4099
  function canonicalMetadata(value) {
4101
4100
  if (!value || Object.keys(value).length === 0) return void 0;
4102
- return Object.fromEntries(Object.entries(value).sort(([left], [right]) => compareText2(left, right)));
4101
+ return Object.fromEntries(Object.entries(value).sort(([left], [right]) => compareText(left, right)));
4103
4102
  }
4104
4103
  var measurementPlanAuthoringSchema = z7.object({
4105
4104
  schemaVersion: z7.literal(MEASUREMENT_PLAN_SCHEMA_VERSION),
@@ -4262,7 +4261,7 @@ var measurementExecutionIdentitySchema = z7.object({
4262
4261
  checksum: z7.string().regex(/^[a-f0-9]{64}$/)
4263
4262
  }).strict();
4264
4263
  function normalizeExecutionIdentity(input) {
4265
- const providers = [...new Set(input.providers.map((value) => value.trim().toLocaleLowerCase("en")).filter(Boolean))].sort(compareText2);
4264
+ const providers = sortedUnique(input.providers.map((value) => value.trim().toLocaleLowerCase("en")).filter(Boolean));
4266
4265
  const models = {};
4267
4266
  for (const provider of providers) {
4268
4267
  const model = input.models[provider];
@@ -4323,8 +4322,8 @@ function measurementRunScopeIsEmpty(scope) {
4323
4322
  return !scope || (scope.groups?.length ?? 0) === 0 && (scope.targets?.length ?? 0) === 0;
4324
4323
  }
4325
4324
  function resolveMeasurementRunScope(plan, scope) {
4326
- const requestedGroups = canonicalStrings(scope.groups ?? []);
4327
- const requestedTargets = canonicalStrings(scope.targets ?? []);
4325
+ const requestedGroups = sortedUnique(scope.groups ?? []);
4326
+ const requestedTargets = sortedUnique(scope.targets ?? []);
4328
4327
  const groupsByKey = new Map(plan.groups.map((group) => [group.stableKey, group]));
4329
4328
  const targetKeys = new Set(plan.targets.map((target) => target.stableKey));
4330
4329
  const unknownGroups = requestedGroups.filter((key) => !groupsByKey.has(key));
@@ -4343,7 +4342,7 @@ function resolveMeasurementRunScope(plan, scope) {
4343
4342
  for (const key of requestedGroups) {
4344
4343
  for (const targetKey of groupsByKey.get(key).targetKeys) selected.add(targetKey);
4345
4344
  }
4346
- const resolvedTargets = [...selected].sort(compareText2);
4345
+ const resolvedTargets = [...selected].sort(compareText);
4347
4346
  const usedNodeKeys = new Set(plan.usageEdges.filter((edge) => edge.kind !== "baseline" && selected.has(edge.targetKey)).map((edge) => edge.executionNodeKey));
4348
4347
  const executionNodes = plan.executionNodes.filter((node) => usedNodeKeys.has(node.stableKey));
4349
4348
  if (executionNodes.length === 0) {
@@ -4358,7 +4357,7 @@ function resolveMeasurementRunScope(plan, scope) {
4358
4357
  };
4359
4358
  }
4360
4359
  function resolveMeasurementRunQueryScope(plan, queryTexts) {
4361
- const requested = canonicalStrings(queryTexts.map(normalizeMeasurementExecutionQueryText).filter(Boolean));
4360
+ const requested = sortedUnique(queryTexts.map(normalizeMeasurementExecutionQueryText).filter(Boolean));
4362
4361
  const nodesByText = /* @__PURE__ */ new Map();
4363
4362
  for (const node of plan.executionNodes) {
4364
4363
  const key = normalizeMeasurementExecutionQueryText(node.queryText);
@@ -4536,7 +4535,7 @@ function canonicalJsonValue2(value) {
4536
4535
  if (Array.isArray(value)) return value.map(canonicalJsonValue2);
4537
4536
  if (value && typeof value === "object") {
4538
4537
  return Object.fromEntries(
4539
- Object.entries(value).filter(([, child]) => child !== void 0).sort(([left], [right]) => compareText2(left, right)).map(([key, child]) => [key, canonicalJsonValue2(child)])
4538
+ Object.entries(value).filter(([, child]) => child !== void 0).sort(([left], [right]) => compareText(left, right)).map(([key, child]) => [key, canonicalJsonValue2(child)])
4540
4539
  );
4541
4540
  }
4542
4541
  return value;
@@ -4575,7 +4574,7 @@ function issuePathKey(path) {
4575
4574
  return path.map((part) => String(part)).join("\0");
4576
4575
  }
4577
4576
  function sortedIssues(issues) {
4578
- return [...issues].sort((left, right) => compareText2(issuePathKey(left.path), issuePathKey(right.path)) || compareText2(left.message, right.message));
4577
+ return [...issues].sort((left, right) => compareText(issuePathKey(left.path), issuePathKey(right.path)) || compareText(left.message, right.message));
4579
4578
  }
4580
4579
  function throwValidation(issues) {
4581
4580
  throw new MeasurementPlanValidationError(sortedIssues(issues));
@@ -4589,7 +4588,7 @@ function usageEdgeKey(edge) {
4589
4588
  return [edge.kind, edge.targetKey ?? "", edge.queryId, edge.nodeSignature].join("\0");
4590
4589
  }
4591
4590
  function compareUsageEdges(left, right) {
4592
- return compareText2(left.kind, right.kind) || compareText2("targetKey" in left ? left.targetKey : "", "targetKey" in right ? right.targetKey : "") || compareText2(left.queryId, right.queryId) || compareText2(left.executionNodeKey, right.executionNodeKey);
4591
+ return compareText(left.kind, right.kind) || compareText("targetKey" in left ? left.targetKey : "", "targetKey" in right ? right.targetKey : "") || compareText(left.queryId, right.queryId) || compareText(left.executionNodeKey, right.executionNodeKey);
4593
4592
  }
4594
4593
  function warningsForAliases(targets) {
4595
4594
  const warnings = [];
@@ -4607,8 +4606,8 @@ function warningsForAliases(targets) {
4607
4606
  warnings.push({
4608
4607
  code: "target-alias-prefix-overlap",
4609
4608
  message: "Target aliases overlap by mention prefix",
4610
- targetKeys: canonicalStrings([left.targetKey, right.targetKey]),
4611
- aliases: canonicalStrings([left.alias, right.alias])
4609
+ targetKeys: sortedUnique([left.targetKey, right.targetKey]),
4610
+ aliases: sortedUnique([left.alias, right.alias])
4612
4611
  });
4613
4612
  }
4614
4613
  }
@@ -4618,7 +4617,7 @@ function warningsForAliases(targets) {
4618
4617
  const key = [warning.code, warning.targetKeys.join("\0"), warning.aliases.join("\0")].join("\0");
4619
4618
  deduped.set(key, warning);
4620
4619
  }
4621
- return [...deduped.values()].sort((left, right) => compareText2(left.code, right.code) || compareText2(left.targetKeys.join("\0"), right.targetKeys.join("\0")) || compareText2(left.aliases.join("\0"), right.aliases.join("\0")));
4620
+ return [...deduped.values()].sort((left, right) => compareText(left.code, right.code) || compareText(left.targetKeys.join("\0"), right.targetKeys.join("\0")) || compareText(left.aliases.join("\0"), right.aliases.join("\0")));
4622
4621
  }
4623
4622
  function compileMeasurementPlan(input, context) {
4624
4623
  const parsed = measurementPlanInputSchema.safeParse(input);
@@ -4645,7 +4644,7 @@ function compileMeasurementPlan(input, context) {
4645
4644
  issues.push({ path: ["context", index === 0 ? "canonicalDomain" : "ownedDomains", index - 1], message: "Project owned domain is invalid" });
4646
4645
  }
4647
4646
  });
4648
- const effectiveOwnedHosts = canonicalStrings(roots);
4647
+ const effectiveOwnedHosts = sortedUnique(roots);
4649
4648
  const projectBrandNames = canonicalAliases([
4650
4649
  ...(context.brandNames ?? []).filter((name) => brandKeyFromText(name).length > 0),
4651
4650
  ...effectiveOwnedHosts.map(brandLabelFromDomain).filter((name) => brandKeyFromText(name).length >= 4)
@@ -4727,7 +4726,7 @@ function compileMeasurementPlan(input, context) {
4727
4726
  };
4728
4727
  plan.targetQuerySelections.forEach((selection, selectionIndex) => {
4729
4728
  const resolved = resolvedSelectionContexts.get(selectionIndex) ?? null;
4730
- for (const queryId of canonicalStrings(selection.queryIds)) {
4729
+ for (const queryId of sortedUnique(selection.queryIds)) {
4731
4730
  noteTargetQueryAssignment(selection.targetKey, queryId, resolved, ["targetQuerySelections", selectionIndex, "context"]);
4732
4731
  }
4733
4732
  });
@@ -4755,13 +4754,13 @@ function compileMeasurementPlan(input, context) {
4755
4754
  ...metadata ? { metadata } : {},
4756
4755
  mentionNotApplicable: aliases.length === 0
4757
4756
  };
4758
- }).sort((left, right) => compareText2(left.stableKey, right.stableKey));
4757
+ }).sort((left, right) => compareText(left.stableKey, right.stableKey));
4759
4758
  const groups = plan.groups.map((group) => ({
4760
4759
  stableKey: group.stableKey,
4761
4760
  label: group.label,
4762
- targetKeys: canonicalStrings(group.targetKeys),
4763
- ...group.competitors && group.competitors.length > 0 ? { competitors: canonicalStrings(group.competitors) } : {}
4764
- })).sort((left, right) => compareText2(left.stableKey, right.stableKey));
4761
+ targetKeys: sortedUnique(group.targetKeys),
4762
+ ...group.competitors && group.competitors.length > 0 ? { competitors: sortedUnique(group.competitors) } : {}
4763
+ })).sort((left, right) => compareText(left.stableKey, right.stableKey));
4765
4764
  const mergedSelections = /* @__PURE__ */ new Map();
4766
4765
  plan.targetQuerySelections.forEach((selection, selectionIndex) => {
4767
4766
  const resolvedContext = resolvedSelectionContexts.get(selectionIndex) ?? null;
@@ -4779,10 +4778,10 @@ function compileMeasurementPlan(input, context) {
4779
4778
  });
4780
4779
  const targetQuerySelections = [...mergedSelections.values()].map((selection) => ({
4781
4780
  targetKey: selection.targetKey,
4782
- queryIds: canonicalStrings([...selection.queryIds]),
4781
+ queryIds: sortedUnique([...selection.queryIds]),
4783
4782
  ...contextsEqual(selection.resolvedContext, defaultContext) ? {} : { context: selection.resolvedContext }
4784
- })).sort((left, right) => compareText2(left.targetKey, right.targetKey) || compareText2(contextKey(resolveContext(left.context, defaultContext)), contextKey(resolveContext(right.context, defaultContext))) || compareText2(left.queryIds.join("\0"), right.queryIds.join("\0")));
4785
- const querySnapshots = [...knownQueries.values()].map((query) => ({ queryId: query.queryId, queryText: query.queryText })).sort((left, right) => compareText2(left.queryId, right.queryId));
4783
+ })).sort((left, right) => compareText(left.targetKey, right.targetKey) || compareText(contextKey(resolveContext(left.context, defaultContext)), contextKey(resolveContext(right.context, defaultContext))) || compareText(left.queryIds.join("\0"), right.queryIds.join("\0")));
4784
+ const querySnapshots = [...knownQueries.values()].map((query) => ({ queryId: query.queryId, queryText: query.queryText })).sort((left, right) => compareText(left.queryId, right.queryId));
4786
4785
  const pendingUsages = /* @__PURE__ */ new Map();
4787
4786
  const nodeSeeds = /* @__PURE__ */ new Map();
4788
4787
  const addUsage = (kind, queryId, resolvedContext, targetKey) => {
@@ -4796,9 +4795,9 @@ function compileMeasurementPlan(input, context) {
4796
4795
  for (const query of querySnapshots) addUsage("baseline", query.queryId, defaultContext);
4797
4796
  targetQuerySelections.forEach((selection) => {
4798
4797
  const resolved = resolveContext(selection.context, defaultContext);
4799
- for (const queryId of canonicalStrings(selection.queryIds)) addUsage("target", queryId, resolved, selection.targetKey);
4798
+ for (const queryId of sortedUnique(selection.queryIds)) addUsage("target", queryId, resolved, selection.targetKey);
4800
4799
  });
4801
- const executionNodes = [...nodeSeeds.entries()].sort(([left], [right]) => compareText2(left, right)).map(([signature, node]) => ({
4800
+ const executionNodes = [...nodeSeeds.entries()].sort(([left], [right]) => compareText(left, right)).map(([signature, node]) => ({
4802
4801
  stableKey: `execution-${base64UrlEncode(signature)}`,
4803
4802
  queryText: node.queryText,
4804
4803
  context: node.context,
@@ -6623,14 +6622,14 @@ var googleAdsEffectiveGoalGraphDtoSchema = z14.object({
6623
6622
  derivedAt: z14.string(),
6624
6623
  campaigns: z14.array(googleAdsEffectiveCampaignGoalDtoSchema)
6625
6624
  }).strict();
6626
- function sortedUnique(ids) {
6625
+ function sortedUnique2(ids) {
6627
6626
  return [...new Set(ids)].sort((left, right) => left.localeCompare(right));
6628
6627
  }
6629
6628
  function actionMembership(actionIds, actionsById) {
6630
6629
  const primary = [];
6631
6630
  const secondary = [];
6632
6631
  const missing = [];
6633
- for (const actionId of sortedUnique(actionIds)) {
6632
+ for (const actionId of sortedUnique2(actionIds)) {
6634
6633
  const action = actionsById.get(actionId);
6635
6634
  if (!action) {
6636
6635
  missing.push(actionId);
@@ -6640,7 +6639,7 @@ function actionMembership(actionIds, actionsById) {
6640
6639
  else secondary.push(actionId);
6641
6640
  }
6642
6641
  return {
6643
- conversionActionIds: sortedUnique(actionIds),
6642
+ conversionActionIds: sortedUnique2(actionIds),
6644
6643
  primaryConversionActionIds: primary,
6645
6644
  secondaryConversionActionIds: secondary,
6646
6645
  missingConversionActionIds: missing
@@ -9810,6 +9809,9 @@ var projectDtoSchema = z18.object({
9810
9809
  createdAt: z18.string().optional(),
9811
9810
  updatedAt: z18.string().optional()
9812
9811
  });
9812
+ var projectDefaultLocationResponseSchema = z18.object({
9813
+ defaultLocation: z18.string()
9814
+ });
9813
9815
  var queryDtoSchema = z18.object({
9814
9816
  id: z18.string(),
9815
9817
  query: z18.string(),
@@ -9830,7 +9832,15 @@ var queryGenerateRequestSchema = z18.object({
9830
9832
  provider: providerNameSchema,
9831
9833
  count: z18.number().int().min(1).max(20).optional()
9832
9834
  });
9835
+ var queryGenerateResponseSchema = z18.object({
9836
+ queries: z18.array(z18.string()),
9837
+ provider: z18.string()
9838
+ });
9833
9839
  var keywordGenerateRequestSchema = queryGenerateRequestSchema;
9840
+ var keywordGenerateResponseSchema = z18.object({
9841
+ keywords: z18.array(z18.string()),
9842
+ provider: z18.string()
9843
+ });
9834
9844
  var competitorDtoSchema = z18.object({
9835
9845
  id: z18.string(),
9836
9846
  domain: z18.string(),
@@ -10165,7 +10175,7 @@ var configMetadataSchema = z22.object({
10165
10175
  }),
10166
10176
  labels: z22.record(z22.string(), z22.string()).optional().default({})
10167
10177
  });
10168
- var configScheduleSchema = z22.object({
10178
+ var configScheduleObjectSchema = z22.object({
10169
10179
  preset: z22.string().min(1).optional(),
10170
10180
  cron: z22.string().min(1).optional(),
10171
10181
  recurrence: calendarRecurrenceSchema.optional(),
@@ -10179,10 +10189,12 @@ var configScheduleSchema = z22.object({
10179
10189
  * to enabled.
10180
10190
  */
10181
10191
  enabled: z22.boolean().optional()
10182
- }).refine(
10183
- (data) => [data.preset, data.cron, data.recurrence].filter((value) => value !== void 0).length === 1,
10184
- { message: 'Exactly one of "preset", "cron", or "recurrence" must be provided' }
10185
- ).optional();
10192
+ });
10193
+ function hasOneScheduleTiming(schedule) {
10194
+ return [schedule.preset, schedule.cron, schedule.recurrence].filter((value) => value !== void 0).length === 1;
10195
+ }
10196
+ var oneScheduleTimingMessage = { message: 'Exactly one of "preset", "cron", or "recurrence" must be provided' };
10197
+ var configScheduleSchema = configScheduleObjectSchema.refine(hasOneScheduleTiming, oneScheduleTimingMessage).optional();
10186
10198
  var configNotificationSchema = z22.object({
10187
10199
  channel: z22.literal("webhook"),
10188
10200
  url: z22.string().url(),
@@ -10198,7 +10210,7 @@ var configGoogleSchema = z22.object({
10198
10210
  }).optional()
10199
10211
  }).optional();
10200
10212
  var configQueryListSchema = z22.array(z22.string().min(1));
10201
- var configSpecSchema = z22.object({
10213
+ var configSpecShape = {
10202
10214
  displayName: z22.string().min(1),
10203
10215
  canonicalDomain: z22.string().min(1),
10204
10216
  ownedDomains: z22.array(z22.string().min(1)).optional().default([]),
@@ -10242,7 +10254,8 @@ var configSpecSchema = z22.object({
10242
10254
  * `preview`.
10243
10255
  */
10244
10256
  competitorAutoAliases: competitorAutoAliasModeInputSchema
10245
- }).superRefine((spec, ctx) => {
10257
+ };
10258
+ function checkConfigSpec(spec, ctx) {
10246
10259
  if (spec.queries !== void 0 && spec.keywords !== void 0) {
10247
10260
  ctx.addIssue({
10248
10261
  code: "custom",
@@ -10265,13 +10278,23 @@ var configSpecSchema = z22.object({
10265
10278
  path: ["defaultLocation"]
10266
10279
  });
10267
10280
  }
10268
- });
10281
+ }
10282
+ var configSpecSchema = z22.object(configSpecShape).superRefine(checkConfigSpec);
10269
10283
  var projectConfigSchema = z22.object({
10270
10284
  apiVersion: z22.literal("canonry/v1"),
10271
10285
  kind: z22.literal("Project"),
10272
10286
  metadata: configMetadataSchema,
10273
10287
  spec: configSpecSchema
10274
10288
  });
10289
+ var projectConfigExportSchema = projectConfigSchema.extend({
10290
+ spec: z22.object({
10291
+ ...configSpecShape,
10292
+ queries: configQueryListSchema,
10293
+ providerModels: providerModelsSchema.optional(),
10294
+ schedule: configScheduleObjectSchema.extend({ enabled: z22.boolean() }).refine(hasOneScheduleTiming, oneScheduleTimingMessage).optional(),
10295
+ autoExtractBacklinks: z22.boolean().optional()
10296
+ }).superRefine(checkConfigSpec)
10297
+ });
10275
10298
  function resolveConfigSpecQueries(spec) {
10276
10299
  return spec.queries ?? spec.keywords ?? [];
10277
10300
  }
@@ -10432,9 +10455,6 @@ function buildSimpleMeasurementDefinition(input) {
10432
10455
  }))
10433
10456
  });
10434
10457
  }
10435
- function compareText3(left, right) {
10436
- return left < right ? -1 : left > right ? 1 : 0;
10437
- }
10438
10458
  function canonicalSimpleMeasurementDefinitionJson(definition) {
10439
10459
  const parsed = simpleMeasurementDefinitionSchema.parse(definition);
10440
10460
  return JSON.stringify({
@@ -10442,11 +10462,11 @@ function canonicalSimpleMeasurementDefinitionJson(definition) {
10442
10462
  capturedAt: parsed.capturedAt,
10443
10463
  identity: {
10444
10464
  displayName: parsed.identity.displayName,
10445
- aliases: [...parsed.identity.aliases].sort(compareText3),
10465
+ aliases: [...parsed.identity.aliases].sort(compareText),
10446
10466
  canonicalDomain: parsed.identity.canonicalDomain,
10447
- ownedDomains: [...parsed.identity.ownedDomains].sort(compareText3),
10467
+ ownedDomains: [...parsed.identity.ownedDomains].sort(compareText),
10448
10468
  // Absent and empty serialize alike, so pre-feature checksums never move.
10449
- ...parsed.identity.qualifiedAliases?.length ? { qualifiedAliases: [...parsed.identity.qualifiedAliases].sort(compareText3) } : {}
10469
+ ...parsed.identity.qualifiedAliases?.length ? { qualifiedAliases: [...parsed.identity.qualifiedAliases].sort(compareText) } : {}
10450
10470
  },
10451
10471
  country: parsed.country,
10452
10472
  language: parsed.language,
@@ -10457,20 +10477,20 @@ function canonicalSimpleMeasurementDefinitionJson(definition) {
10457
10477
  country: parsed.location.country,
10458
10478
  ...parsed.location.timezone === void 0 ? {} : { timezone: parsed.location.timezone }
10459
10479
  },
10460
- engines: [...parsed.engines].map((engine) => ({ provider: engine.provider, requestedModel: engine.requestedModel })).sort((left, right) => compareText3(left.provider, right.provider)),
10480
+ engines: [...parsed.engines].map((engine) => ({ provider: engine.provider, requestedModel: engine.requestedModel })).sort((left, right) => compareText(left.provider, right.provider)),
10461
10481
  ...parsed.competitors === void 0 ? {} : {
10462
10482
  competitors: [...parsed.competitors].map((competitor) => ({
10463
10483
  domain: competitor.domain,
10464
10484
  label: competitor.label,
10465
- aliases: [...competitor.aliases].sort(compareText3)
10466
- })).sort((left, right) => compareText3(left.domain, right.domain))
10485
+ aliases: [...competitor.aliases].sort(compareText)
10486
+ })).sort((left, right) => compareText(left.domain, right.domain))
10467
10487
  },
10468
10488
  queries: [...parsed.queries].map((query) => ({
10469
10489
  queryId: query.queryId,
10470
10490
  queryText: query.queryText,
10471
10491
  provenance: query.provenance,
10472
10492
  queryClass: query.queryClass
10473
- })).sort((left, right) => compareText3(left.queryId, right.queryId))
10493
+ })).sort((left, right) => compareText(left.queryId, right.queryId))
10474
10494
  });
10475
10495
  }
10476
10496
 
@@ -11301,8 +11321,7 @@ function parseMeasurementRunManifestV1(value) {
11301
11321
  return measurementRunManifestV1Schema.parse(value);
11302
11322
  }
11303
11323
  function buildMeasurementRunManifestV1(input) {
11304
- const compareText5 = (left, right) => left < right ? -1 : left > right ? 1 : 0;
11305
- const expectedSlots = [...input.expectedSlots].map((slot) => measurementExpectedSlotV1Schema.parse(slot)).sort((left, right) => compareText5(left.executionId, right.executionId) || compareText5(left.provider, right.provider) || compareText5(left.queryText, right.queryText) || compareText5(left.context?.label ?? "", right.context?.label ?? "") || compareText5(left.requestedModel ?? "", right.requestedModel ?? ""));
11324
+ const expectedSlots = [...input.expectedSlots].map((slot) => measurementExpectedSlotV1Schema.parse(slot)).sort((left, right) => compareText(left.executionId, right.executionId) || compareText(left.provider, right.provider) || compareText(left.queryText, right.queryText) || compareText(left.context?.label ?? "", right.context?.label ?? "") || compareText(left.requestedModel ?? "", right.requestedModel ?? ""));
11306
11325
  return measurementRunManifestV1Schema.parse({ schemaVersion: 1, expectedSlots });
11307
11326
  }
11308
11327
  var measurementCompletenessSchema = z26.object({
@@ -11439,6 +11458,13 @@ var measurementReportRunSchema = z26.object({
11439
11458
  }).strict();
11440
11459
  var measurementReportResponseSchema = z26.object({
11441
11460
  revision: z26.number().int().positive(),
11461
+ /**
11462
+ * The query class every group, Target and evidence row below is taken over:
11463
+ * non-brand unless the request named another, and `all` pools branded with
11464
+ * non-brand. Null for a schema v1 revision, which records no class. Absent on
11465
+ * servers that predate it.
11466
+ */
11467
+ queryClass: measurementQueryClassFilterSchema.nullable().optional(),
11442
11468
  run: measurementReportRunSchema.nullable(),
11443
11469
  groups: z26.array(measurementGroupReportSchema),
11444
11470
  targets: z26.array(measurementTargetReportSchema),
@@ -12032,12 +12058,14 @@ var measurementPropertyCompetitorsResponseSchema = z28.object({
12032
12058
  var measurementChangesSortSchema = z28.enum(["magnitude", "label"]);
12033
12059
  var MEASUREMENT_CHANGES_DEFAULT_SORT = "magnitude";
12034
12060
  var MEASUREMENT_CHANGES_NOISE_ANSWERS = 2;
12061
+ var measurementChangesScopeKindSchema = z28.enum(["all", "group", "property"]);
12035
12062
  var measurementChangesQuerySchema = z28.object({
12036
12063
  runId: measurementDemoFilterQueryShape.runId,
12037
- scope: measurementOverviewScopeKindSchema.default("all"),
12064
+ scope: measurementChangesScopeKindSchema.default("all"),
12038
12065
  groupKey: measurementV2StableKeySchema.optional(),
12039
12066
  targetKey: measurementV2StableKeySchema.optional(),
12040
- queryClass: measurementQueryClassFilterSchema.default("all"),
12067
+ /** Defaults to non-brand. `all` pools both classes and adds `metricsByClass`. */
12068
+ queryClass: measurementQueryClassFilterSchema.default(MEASUREMENT_DEFAULT_QUERY_CLASS),
12041
12069
  provider: measurementDemoFilterQueryShape.provider,
12042
12070
  location: measurementDemoFilterQueryShape.location,
12043
12071
  limit: z28.number().int().positive().max(50).optional(),
@@ -13332,7 +13360,7 @@ function countOf(value) {
13332
13360
  function dayOf(value) {
13333
13361
  return typeof value === "string" && value.trim().length >= 10 ? value.trim().slice(0, 10) : null;
13334
13362
  }
13335
- function sortedUnique2(days) {
13363
+ function sortedUnique3(days) {
13336
13364
  return [...new Set(days.filter((d) => d !== null))].sort();
13337
13365
  }
13338
13366
  function normalizeEngineChange(provider, entry, engineName) {
@@ -13355,11 +13383,11 @@ function normalizeEngineChange(provider, entry, engineName) {
13355
13383
  if (perChange.length > 0) {
13356
13384
  return {
13357
13385
  ...common,
13358
- confirmedDates: sortedUnique2(perChange.filter((c) => c.confirmed !== false).map((c) => dayOf(c.date))),
13359
- unconfirmedDates: sortedUnique2(perChange.filter((c) => c.confirmed === false).map((c) => dayOf(c.date)))
13386
+ confirmedDates: sortedUnique3(perChange.filter((c) => c.confirmed !== false).map((c) => dayOf(c.date))),
13387
+ unconfirmedDates: sortedUnique3(perChange.filter((c) => c.confirmed === false).map((c) => dayOf(c.date)))
13360
13388
  };
13361
13389
  }
13362
- const span = sortedUnique2([dayOf(entry.firstChangeDate), dayOf(entry.lastChangeDate)]);
13390
+ const span = sortedUnique3([dayOf(entry.firstChangeDate), dayOf(entry.lastChangeDate)]);
13363
13391
  if (changeCount === 0) return { ...common, confirmedDates: [], unconfirmedDates: [] };
13364
13392
  if (unconfirmedCount === 0) return { ...common, confirmedDates: span, unconfirmedDates: [] };
13365
13393
  if (common.confirmedCount === 0) return { ...common, confirmedDates: [], unconfirmedDates: span };
@@ -14628,6 +14656,11 @@ function isRetryableHttpError(err) {
14628
14656
  return true;
14629
14657
  }
14630
14658
 
14659
+ // ../contracts/src/regexp.ts
14660
+ function escapeRegExp(str) {
14661
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
14662
+ }
14663
+
14631
14664
  // ../contracts/src/concurrency.ts
14632
14665
  async function mapWithConcurrency(items, concurrency, fn) {
14633
14666
  if (items.length === 0) return [];
@@ -14796,6 +14829,10 @@ var wordpressPageSummaryDtoSchema = z39.object({
14796
14829
  modifiedAt: z39.string().nullable().optional(),
14797
14830
  link: z39.string().nullable().optional()
14798
14831
  });
14832
+ var wordpressPageListDtoSchema = z39.object({
14833
+ env: wordpressEnvSchema,
14834
+ pages: z39.array(wordpressPageSummaryDtoSchema)
14835
+ });
14799
14836
  var wordpressSeoStateDtoSchema = z39.object({
14800
14837
  title: z39.string().nullable(),
14801
14838
  description: z39.string().nullable(),
@@ -15131,9 +15168,6 @@ function batchDispatchRefusalMessage(ineligible) {
15131
15168
  ].join(" ");
15132
15169
  }
15133
15170
  var PRICING_TIER_ORDER = [PricingTiers.standard, PricingTiers.batch];
15134
- function compareText4(left, right) {
15135
- return left < right ? -1 : left > right ? 1 : 0;
15136
- }
15137
15171
  function summarizeRunUsage(rows) {
15138
15172
  const groups = /* @__PURE__ */ new Map();
15139
15173
  for (const row of rows) {
@@ -15164,7 +15198,7 @@ function summarizeRunUsage(rows) {
15164
15198
  }
15165
15199
  groups.set(key, group);
15166
15200
  }
15167
- return [...groups.values()].sort((left, right) => compareText4(left.provider, right.provider) || PRICING_TIER_ORDER.indexOf(left.pricingTier) - PRICING_TIER_ORDER.indexOf(right.pricingTier));
15201
+ return [...groups.values()].sort((left, right) => compareText(left.provider, right.provider) || PRICING_TIER_ORDER.indexOf(left.pricingTier) - PRICING_TIER_ORDER.indexOf(right.pricingTier));
15168
15202
  }
15169
15203
 
15170
15204
  // ../contracts/src/snapshot.ts
@@ -19123,6 +19157,9 @@ function deriveIndexCoverage(input) {
19123
19157
  function normalizeQueryText(value) {
19124
19158
  return value.trim().toLowerCase();
19125
19159
  }
19160
+ function normalizeIdentityText(value) {
19161
+ return value.normalize("NFKC").trim().replace(/\s+/g, " ").toLocaleLowerCase("en");
19162
+ }
19126
19163
 
19127
19164
  // ../contracts/src/query-counts.ts
19128
19165
  function summarizeObservedQueryCounts(snapshots) {
@@ -20654,14 +20691,9 @@ var adsActivationAdGroupSchema = adsActivationEntityRefSchema.extend({
20654
20691
  var adsActivationCampaignSchema = adsActivationEntityRefSchema.extend({
20655
20692
  adGroups: z65.array(adsActivationAdGroupSchema).min(1).max(ADS_ACTIVATION_ABSOLUTE_MAX_ENTITIES - 1)
20656
20693
  }).strict();
20657
- function compareAdsActivationEntityIds(left, right) {
20658
- if (left < right) return -1;
20659
- if (left > right) return 1;
20660
- return 0;
20661
- }
20662
20694
  function addCanonicalEntityOrderIssue(items, path, ctx) {
20663
20695
  for (let index = 1; index < items.length; index += 1) {
20664
- if (compareAdsActivationEntityIds(items[index - 1].id, items[index].id) >= 0) {
20696
+ if (compareText(items[index - 1].id, items[index].id) >= 0) {
20665
20697
  ctx.addIssue({
20666
20698
  code: "custom",
20667
20699
  path,
@@ -20708,8 +20740,8 @@ function canonicalizeAdsActivationManifest(manifest) {
20708
20740
  adGroups: manifest.campaign.adGroups.map((group) => ({
20709
20741
  id: group.id,
20710
20742
  expectedUpdatedAt: group.expectedUpdatedAt,
20711
- ads: group.ads.map((ad) => ({ id: ad.id, expectedUpdatedAt: ad.expectedUpdatedAt })).sort((left, right) => compareAdsActivationEntityIds(left.id, right.id))
20712
- })).sort((left, right) => compareAdsActivationEntityIds(left.id, right.id))
20743
+ ads: group.ads.map((ad) => ({ id: ad.id, expectedUpdatedAt: ad.expectedUpdatedAt })).sort((left, right) => compareText(left.id, right.id))
20744
+ })).sort((left, right) => compareText(left.id, right.id))
20713
20745
  }
20714
20746
  };
20715
20747
  }
@@ -22553,6 +22585,8 @@ export {
22553
22585
  AI_ENGINE_SELF_DOMAINS,
22554
22586
  VERTEX_AI_SEARCH_PROXY_DOMAIN,
22555
22587
  AI_PROVIDER_INFRA_DOMAINS,
22588
+ compareText,
22589
+ sortedUnique,
22556
22590
  hostOf,
22557
22591
  registrableDomain,
22558
22592
  normalizeProjectDomain,
@@ -22649,6 +22683,7 @@ export {
22649
22683
  MEASUREMENT_PAGE_DEFAULT_LIMIT,
22650
22684
  MEASUREMENT_PAGE_MAX_LIMIT,
22651
22685
  measurementQueryClassFilterSchema,
22686
+ MEASUREMENT_DEFAULT_QUERY_CLASS,
22652
22687
  measurementOverviewSortSchema,
22653
22688
  MEASUREMENT_OVERVIEW_DEFAULT_SORT,
22654
22689
  measurementOverviewQuerySchema,
@@ -22829,12 +22864,15 @@ export {
22829
22864
  projectCreateRequestSchema,
22830
22865
  normalizeProjectName,
22831
22866
  projectDtoSchema,
22867
+ projectDefaultLocationResponseSchema,
22832
22868
  queryDtoSchema,
22833
22869
  keywordDtoSchema,
22834
22870
  queryBatchRequestSchema,
22835
22871
  keywordBatchRequestSchema,
22836
22872
  queryGenerateRequestSchema,
22873
+ queryGenerateResponseSchema,
22837
22874
  keywordGenerateRequestSchema,
22875
+ keywordGenerateResponseSchema,
22838
22876
  competitorDtoSchema,
22839
22877
  competitorBatchRequestSchema,
22840
22878
  competitorAppendRequestSchema,
@@ -22844,6 +22882,7 @@ export {
22844
22882
  effectiveBrandNames,
22845
22883
  competitorAliasProjectIdentity,
22846
22884
  projectConfigSchema,
22885
+ projectConfigExportSchema,
22847
22886
  resolveConfigSpecQueries,
22848
22887
  simpleMeasurementDefinitionSchema,
22849
22888
  simpleMeasurementCompetitorNames,
@@ -23039,6 +23078,7 @@ export {
23039
23078
  withRetry,
23040
23079
  retryAfterDelayMs,
23041
23080
  isRetryableHttpError,
23081
+ escapeRegExp,
23042
23082
  mapWithConcurrency,
23043
23083
  bingUrlInspectionDtoSchema,
23044
23084
  bingCoverageSummaryDtoSchema,
@@ -23052,7 +23092,7 @@ export {
23052
23092
  cdpStatusDtoSchema,
23053
23093
  wordpressEnvSchema,
23054
23094
  wordpressStatusDtoSchema,
23055
- wordpressPageSummaryDtoSchema,
23095
+ wordpressPageListDtoSchema,
23056
23096
  wordpressSchemaBlockDtoSchema,
23057
23097
  wordpressPageDetailDtoSchema,
23058
23098
  wordpressManualAssistDtoSchema,
@@ -23274,6 +23314,7 @@ export {
23274
23314
  groupIsoDateRanges,
23275
23315
  deriveIndexCoverage,
23276
23316
  normalizeQueryText,
23317
+ normalizeIdentityText,
23277
23318
  summarizeObservedQueryCounts,
23278
23319
  citationVisibilityResponseSchema,
23279
23320
  emptyCitationVisibility,