@canonry/canonry 6.2.0 → 6.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +12 -0
  2. package/assets/assets/{AuditHistoryPanel-CuEMfkaA.js → AuditHistoryPanel-BUYWIjlG.js} +1 -1
  3. package/assets/assets/{BacklinksPage-CftadZ1-.js → BacklinksPage-aBcxpN_9.js} +1 -1
  4. package/assets/assets/{HistoryPage-DouRgshN.js → HistoryPage-PoBuxiY_.js} +1 -1
  5. package/assets/assets/{MeasurementPropertyPage-qfqv2qs9.js → MeasurementPropertyPage-DyjyqHac.js} +1 -1
  6. package/assets/assets/{ProjectPage-DqEVwe4t.js → ProjectPage-Mmv5YW-K.js} +1 -1
  7. package/assets/assets/{RunsPage-CUkMs0gB.js → RunsPage-CHHxOpzo.js} +1 -1
  8. package/assets/assets/{SettingsPage-LLQ40tSh.js → SettingsPage-CNKnrLXC.js} +1 -1
  9. package/assets/assets/{SiteHealthSection-Ba7foDiU.js → SiteHealthSection-C9RivT7G.js} +3 -3
  10. package/assets/assets/{TrafficPage-Cu_ZR3--.js → TrafficPage-CY-ibXnb.js} +1 -1
  11. package/assets/assets/{TrafficSourceDetailPage-NKZq7jf9.js → TrafficSourceDetailPage-BgiPXubs.js} +1 -1
  12. package/assets/assets/{extract-error-message-BdQYrz9N.js → extract-error-message-H1dzzfBP.js} +1 -1
  13. package/assets/assets/{index-HOeLz1ZL.js → index-DSCun3I9.js} +21 -21
  14. package/assets/assets/{react-sigma_core.esm.min-CZaoE5cU.js → react-sigma_core.esm.min-uiYtR_DU.js} +1 -1
  15. package/assets/assets/{v2-overview-adapter-BVx4nI49.js → v2-overview-adapter-BQokN2eb.js} +1 -1
  16. package/assets/index.html +1 -1
  17. package/dist/{chunk-2RFHQ6XT.js → chunk-4WZUR7XX.js} +240 -119
  18. package/dist/{chunk-4EKOKWQT.js → chunk-5FYTFE5T.js} +2 -2
  19. package/dist/{chunk-Y2B7JRSB.js → chunk-5GY5WBAF.js} +3 -3
  20. package/dist/{chunk-ENI3GOWW.js → chunk-7CVTTQRV.js} +95 -26
  21. package/dist/{chunk-W3GDZZNF.js → chunk-DERWXLHX.js} +15 -1
  22. package/dist/{chunk-6EPN4XY5.js → chunk-EV5G5QRR.js} +324 -280
  23. package/dist/{chunk-V6JUBTNL.js → chunk-ZZEPF3A5.js} +23 -3
  24. package/dist/cli.js +53 -8
  25. package/dist/{demo-server-CH7MOBXW.js → demo-server-AIFR77TP.js} +4 -4
  26. package/dist/index.js +6 -6
  27. package/dist/{intelligence-service-4IONMOFB.js → intelligence-service-SYISPW25.js} +2 -2
  28. package/dist/mcp.js +4 -4
  29. package/package.json +13 -13
@@ -9775,14 +9775,14 @@ function breakdownShares(parts) {
9775
9775
  const total = parts.reduce((sum, part) => sum + Math.max(0, part), 0);
9776
9776
  return parts.map((part) => shareOf(part, total) ?? 0);
9777
9777
  }
9778
- function wilsonInterval(successes, n, z71 = 1.96) {
9778
+ function wilsonInterval(successes, n, z72 = 1.96) {
9779
9779
  if (!Number.isFinite(n) || n <= 0) return null;
9780
9780
  const s = Math.max(0, Math.min(successes, n));
9781
9781
  const p = s / n;
9782
- const z210 = z71 * z71;
9782
+ const z210 = z72 * z72;
9783
9783
  const denom = 1 + z210 / n;
9784
9784
  const center = (p + z210 / (2 * n)) / denom;
9785
- const margin = z71 / denom * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
9785
+ const margin = z72 / denom * Math.sqrt(p * (1 - p) / n + z210 / (4 * n * n));
9786
9786
  return {
9787
9787
  low: round(Math.max(0, center - margin)),
9788
9788
  high: round(Math.min(1, center + margin))
@@ -20105,6 +20105,193 @@ function detectAgentRuntime(env) {
20105
20105
  return AGENT_NONE;
20106
20106
  }
20107
20107
 
20108
+ // ../contracts/src/feedback.ts
20109
+ import { z as z66 } from "zod";
20110
+
20111
+ // ../contracts/src/log-redaction.ts
20112
+ var REDACTED = "[REDACTED]";
20113
+ var TRUNCATED = "[TRUNCATED]";
20114
+ var CIRCULAR = "[CIRCULAR]";
20115
+ var UNREADABLE = "[UNREADABLE]";
20116
+ var OMITTED = "[OMITTED]";
20117
+ var MAX_DEPTH = 6;
20118
+ var MAX_ARRAY_ITEMS = 50;
20119
+ var MAX_OBJECT_KEYS = 100;
20120
+ var MAX_STRING_LENGTH = 4096;
20121
+ var secretKey = /api[ _-]?key|authorization|auth(?:entication)?|cookie|password|secret|token|credential/i;
20122
+ var escapedSecretAssignment = /\\+["'][\w -]*(?:api[ _-]?key|auth|cookie|password|secret|token|credential)[\w -]*\\+["']\s*:/i;
20123
+ var unsafeGraphKey = /^(?:req|res|request|reply|raw|socket|headers?|body|responsebody|apiresponse|rawresponse|providerbody|providerresponse)$/i;
20124
+ var providerNameKey = /^provider$/i;
20125
+ function isSensitiveDiagnosticQueryKey(key) {
20126
+ return secretKey.test(key) || /^key$/i.test(key);
20127
+ }
20128
+ function redactLogValue(value) {
20129
+ try {
20130
+ return redactValue(value, 0, /* @__PURE__ */ new WeakSet());
20131
+ } catch {
20132
+ return UNREADABLE;
20133
+ }
20134
+ }
20135
+ function redactLogString(value) {
20136
+ try {
20137
+ const clipped = value.length > MAX_STRING_LENGTH ? `${value.slice(0, MAX_STRING_LENGTH)}${TRUNCATED}` : value;
20138
+ if (escapedSecretAssignment.test(clipped)) return REDACTED;
20139
+ return redactEmbeddedUrls(clipped).replace(/\b((?:set-cookie|cookie)\s*[:=]\s*)[^\r\n]*(?:\r?\n[ \t][^\r\n]*)*/gi, `$1${REDACTED}`).replace(
20140
+ /(["']?[\w-]*(?:api[ _-]?key|auth|cookie|password|secret|token|credential)[\w-]*["']?\s*[=:]\s*)(?:"(?:\\.|[^"\\])*(?:"|$)|'(?:\\.|[^'\\])*(?:'|$))/gi,
20141
+ `$1${REDACTED}`
20142
+ ).replace(/\b(Bearer|Basic)\s+[^\s,;]+/gi, (_match, scheme) => `${scheme} ${REDACTED}`).replace(
20143
+ /(api[ _-]?key|authorization|auth(?:entication)?|cookie|password|secret|token|credential)\s*([=:])\s*(?!\[REDACTED\])[^\s&,'")\]}]+/gi,
20144
+ `$1$2${REDACTED}`
20145
+ ).slice(0, MAX_STRING_LENGTH);
20146
+ } catch {
20147
+ return UNREADABLE;
20148
+ }
20149
+ }
20150
+ function redactValue(value, depth, seen, key) {
20151
+ if (key && diagnosticIdentity(key, value) !== void 0) return value;
20152
+ if (key && secretKey.test(key)) return REDACTED;
20153
+ if (key && unsafeGraphKey.test(key)) return OMITTED;
20154
+ if (key && providerNameKey.test(key) && typeof value === "object" && value !== null) return OMITTED;
20155
+ if (value === null || typeof value === "boolean") return value;
20156
+ if (typeof value === "number") return Number.isFinite(value) ? value : String(value);
20157
+ if (typeof value === "string") return redactLogString(value);
20158
+ if (typeof value === "bigint") return value.toString();
20159
+ if (typeof value === "undefined") return void 0;
20160
+ if (typeof value === "symbol" || typeof value === "function") return `[${typeof value}]`;
20161
+ if (depth >= MAX_DEPTH) return TRUNCATED;
20162
+ if (typeof value !== "object") return UNREADABLE;
20163
+ if (seen.has(value)) return CIRCULAR;
20164
+ seen.add(value);
20165
+ try {
20166
+ if (value instanceof Error) return redactError(value, depth, seen);
20167
+ if (Array.isArray(value)) {
20168
+ const output2 = [];
20169
+ const length = safeArrayLength(value);
20170
+ for (let index = 0; index < Math.min(length, MAX_ARRAY_ITEMS); index++) {
20171
+ output2.push(redactValue(safeProperty(value, String(index)), depth + 1, seen));
20172
+ }
20173
+ if (length > MAX_ARRAY_ITEMS) output2.push(TRUNCATED);
20174
+ return output2;
20175
+ }
20176
+ const output = {};
20177
+ const keys = safeKeys(value);
20178
+ for (const nestedKey of keys.slice(0, MAX_OBJECT_KEYS)) {
20179
+ output[nestedKey] = redactValue(safeProperty(value, nestedKey), depth + 1, seen, nestedKey);
20180
+ }
20181
+ if (keys.length > MAX_OBJECT_KEYS) output.__truncated = true;
20182
+ return output;
20183
+ } catch {
20184
+ return UNREADABLE;
20185
+ } finally {
20186
+ seen.delete(value);
20187
+ }
20188
+ }
20189
+ function diagnosticIdentity(key, value) {
20190
+ if (typeof value !== "string") return void 0;
20191
+ if (key === "actor" && /^(?:api-key|user):[\w.-]{1,256}$/.test(value)) return value;
20192
+ if (key === "credentialId" && /^[\w.-]{1,256}$/.test(value)) return value;
20193
+ return void 0;
20194
+ }
20195
+ function redactError(error, depth, seen) {
20196
+ const output = {
20197
+ name: redactLogString(safeErrorString(error, "name")),
20198
+ message: redactLogString(safeErrorString(error, "message"))
20199
+ };
20200
+ const stack = safeErrorString(error, "stack");
20201
+ if (stack) output.stack = redactLogString(stack);
20202
+ for (const key of safeKeys(error).slice(0, MAX_OBJECT_KEYS)) {
20203
+ output[key] = redactValue(safeProperty(error, key), depth + 1, seen, key);
20204
+ }
20205
+ return output;
20206
+ }
20207
+ function safeKeys(value) {
20208
+ try {
20209
+ return Object.keys(value);
20210
+ } catch {
20211
+ return [];
20212
+ }
20213
+ }
20214
+ function safeArrayLength(value) {
20215
+ try {
20216
+ return Number.isSafeInteger(value.length) && value.length >= 0 ? value.length : 0;
20217
+ } catch {
20218
+ return 0;
20219
+ }
20220
+ }
20221
+ function safeProperty(value, key) {
20222
+ try {
20223
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
20224
+ if (!descriptor || !("value" in descriptor)) return UNREADABLE;
20225
+ return descriptor.value;
20226
+ } catch {
20227
+ return UNREADABLE;
20228
+ }
20229
+ }
20230
+ function safeErrorString(error, key) {
20231
+ try {
20232
+ const value = error[key];
20233
+ return typeof value === "string" ? value : "";
20234
+ } catch {
20235
+ return UNREADABLE;
20236
+ }
20237
+ }
20238
+ function redactEmbeddedUrls(value) {
20239
+ return value.replace(/https?:\/\/[^\s<>"']+/gi, (candidate) => {
20240
+ if (candidate.includes(TRUNCATED)) return "[TRUNCATED_URL]";
20241
+ const suffix = candidate.match(/[),.;!?\]}]+$/)?.[0] ?? "";
20242
+ const rawUrl = suffix ? candidate.slice(0, -suffix.length) : candidate;
20243
+ try {
20244
+ const url = new URL(rawUrl);
20245
+ if (url.username || url.password) {
20246
+ url.username = REDACTED;
20247
+ url.password = REDACTED;
20248
+ }
20249
+ for (const key of [...url.searchParams.keys()]) {
20250
+ if (isSensitiveDiagnosticQueryKey(key)) url.searchParams.set(key, REDACTED);
20251
+ }
20252
+ return `${url.toString()}${suffix}`;
20253
+ } catch {
20254
+ return `[REDACTED_URL]${suffix}`;
20255
+ }
20256
+ });
20257
+ }
20258
+
20259
+ // ../contracts/src/feedback.ts
20260
+ var FEEDBACK_KINDS = ["struggle", "bug", "improvement", "other"];
20261
+ var feedbackKindSchema = z66.enum(FEEDBACK_KINDS);
20262
+ var FEEDBACK_LIMITS = {
20263
+ summary: 500,
20264
+ details: 4e3,
20265
+ area: 40,
20266
+ command: 120,
20267
+ errorCode: 40
20268
+ };
20269
+ var feedbackSubmissionSchema = z66.object({
20270
+ kind: feedbackKindSchema,
20271
+ summary: z66.string().trim().min(1).max(FEEDBACK_LIMITS.summary),
20272
+ details: z66.string().trim().min(1).max(FEEDBACK_LIMITS.details).optional(),
20273
+ area: z66.string().trim().min(1).max(FEEDBACK_LIMITS.area).optional(),
20274
+ command: z66.string().trim().min(1).max(FEEDBACK_LIMITS.command).optional(),
20275
+ errorCode: z66.string().trim().min(1).max(FEEDBACK_LIMITS.errorCode).optional()
20276
+ }).strict();
20277
+ var feedbackAcceptedDtoSchema = z66.object({
20278
+ accepted: z66.boolean(),
20279
+ id: z66.string()
20280
+ });
20281
+ function redactFeedbackText(value, limit) {
20282
+ return truncateUtf16(
20283
+ redactLogString(value).replace(SECRET_FLAG_VALUE, "$1 [REDACTED]").replace(BARE_CREDENTIAL, "[REDACTED]"),
20284
+ limit
20285
+ );
20286
+ }
20287
+ function truncateUtf16(value, limit) {
20288
+ if (value.length <= limit) return value;
20289
+ const cut = value.slice(0, limit);
20290
+ return /[\uD800-\uDBFF]$/.test(cut) ? cut.slice(0, -1) : cut;
20291
+ }
20292
+ var SECRET_FLAG_VALUE = /(?<=^|[ \t])(--?(?:[a-z\d]+-)*(?:key|token|secret|password|passwd|credential|credentials|auth|authorization|bearer)(?:-[a-z\d]+)*)(?:[ \t]*=[ \t]*|[ \t]+)(?!\[REDACTED\])(?:"[^"\n]*"|'[^'\n]*'|\S+)/gim;
20293
+ var BARE_CREDENTIAL = /\b(?:sk-[\w-]{16,}|AIza[\w-]{30,}|pplx-[A-Za-z0-9]{16,}|gh[pousr]_[A-Za-z0-9]{20,}|github_pat_\w{20,}|cnry_[\w-]{16,})/g;
20294
+
20108
20295
  // ../contracts/src/trend-stability.ts
20109
20296
  var MIN_TREND_POINTS = 4;
20110
20297
  function isTrendBaseline(points) {
@@ -20112,14 +20299,14 @@ function isTrendBaseline(points) {
20112
20299
  }
20113
20300
 
20114
20301
  // ../contracts/src/report-sections.ts
20115
- import { z as z66 } from "zod";
20302
+ import { z as z67 } from "zod";
20116
20303
  var CLIENT_AUDIENCE = reportAudienceSchema.enum.client;
20117
20304
  var BOTH_AUDIENCES = reportActionAudienceSchema.enum.both;
20118
20305
  var ADVANCED_MODE = visibilityReportResolvedModeSchema.enum.advanced;
20119
20306
  function pluralize(count2, singular, plural = `${singular}s`) {
20120
20307
  return count2 === 1 ? singular : plural;
20121
20308
  }
20122
- var reportSectionIdSchema = z66.enum([
20309
+ var reportSectionIdSchema = z67.enum([
20123
20310
  "client-summary",
20124
20311
  "executive-summary",
20125
20312
  "share-of-voice",
@@ -20842,240 +21029,92 @@ var REPORT_SECTION_COPY = {
20842
21029
  };
20843
21030
 
20844
21031
  // ../contracts/src/operational-logs.ts
20845
- import { z as z67 } from "zod";
20846
- var operationalLogLevelSchema = z67.enum(["trace", "debug", "info", "warn", "error", "fatal"]);
20847
- var diagnosticContextSchema = z67.object({
20848
- runId: z67.string().min(1).max(256).optional(),
20849
- projectId: z67.string().min(1).max(256).optional(),
20850
- requestId: z67.string().min(1).max(256).optional(),
20851
- actor: z67.string().min(1).max(512).optional(),
20852
- credentialId: z67.string().min(1).max(512).optional(),
20853
- userAgent: z67.string().min(1).max(512).optional(),
20854
- actorSession: z67.string().min(1).max(512).optional(),
20855
- method: z67.string().min(1).max(16).optional(),
20856
- route: z67.string().min(1).max(256).optional(),
20857
- operationId: z67.string().min(1).max(256).optional(),
20858
- jobId: z67.string().min(1).max(256).optional(),
20859
- taskId: z67.string().min(1).max(256).optional(),
20860
- traceId: z67.string().min(1).max(256).optional(),
20861
- provider: z67.string().min(1).max(256).optional(),
20862
- errorCode: z67.string().min(1).max(128).optional(),
20863
- attempt: z67.number().finite().optional(),
20864
- count: z67.number().finite().optional(),
20865
- total: z67.number().finite().optional(),
20866
- progress: z67.number().finite().optional(),
20867
- httpStatus: z67.number().finite().optional(),
20868
- statusCode: z67.number().finite().optional(),
20869
- durationMs: z67.number().finite().optional(),
20870
- bytes: z67.number().finite().optional(),
20871
- retryAfterMs: z67.number().finite().optional(),
20872
- retriable: z67.boolean().optional(),
20873
- retrying: z67.boolean().optional(),
20874
- cancelled: z67.boolean().optional(),
20875
- success: z67.boolean().optional()
20876
- }).strict();
20877
- var operationalLogEntryDtoSchema = z67.object({
20878
- cursor: z67.string().min(1).max(512),
20879
- ts: z67.string().datetime(),
21032
+ import { z as z68 } from "zod";
21033
+ var operationalLogLevelSchema = z68.enum(["trace", "debug", "info", "warn", "error", "fatal"]);
21034
+ var diagnosticContextSchema = z68.object({
21035
+ runId: z68.string().min(1).max(256).optional(),
21036
+ projectId: z68.string().min(1).max(256).optional(),
21037
+ requestId: z68.string().min(1).max(256).optional(),
21038
+ actor: z68.string().min(1).max(512).optional(),
21039
+ credentialId: z68.string().min(1).max(512).optional(),
21040
+ userAgent: z68.string().min(1).max(512).optional(),
21041
+ actorSession: z68.string().min(1).max(512).optional(),
21042
+ method: z68.string().min(1).max(16).optional(),
21043
+ route: z68.string().min(1).max(256).optional(),
21044
+ operationId: z68.string().min(1).max(256).optional(),
21045
+ jobId: z68.string().min(1).max(256).optional(),
21046
+ taskId: z68.string().min(1).max(256).optional(),
21047
+ traceId: z68.string().min(1).max(256).optional(),
21048
+ provider: z68.string().min(1).max(256).optional(),
21049
+ errorCode: z68.string().min(1).max(128).optional(),
21050
+ attempt: z68.number().finite().optional(),
21051
+ count: z68.number().finite().optional(),
21052
+ total: z68.number().finite().optional(),
21053
+ progress: z68.number().finite().optional(),
21054
+ httpStatus: z68.number().finite().optional(),
21055
+ statusCode: z68.number().finite().optional(),
21056
+ durationMs: z68.number().finite().optional(),
21057
+ bytes: z68.number().finite().optional(),
21058
+ retryAfterMs: z68.number().finite().optional(),
21059
+ retriable: z68.boolean().optional(),
21060
+ retrying: z68.boolean().optional(),
21061
+ cancelled: z68.boolean().optional(),
21062
+ success: z68.boolean().optional()
21063
+ }).strict();
21064
+ var operationalLogEntryDtoSchema = z68.object({
21065
+ cursor: z68.string().min(1).max(512),
21066
+ ts: z68.string().datetime(),
20880
21067
  level: operationalLogLevelSchema,
20881
- module: z67.string().min(1).max(256),
20882
- action: z67.string().min(1).max(256),
20883
- message: z67.string().max(4096).optional(),
20884
- runId: z67.string().min(1).max(256).optional(),
20885
- projectId: z67.string().min(1).max(256).optional(),
21068
+ module: z68.string().min(1).max(256),
21069
+ action: z68.string().min(1).max(256),
21070
+ message: z68.string().max(4096).optional(),
21071
+ runId: z68.string().min(1).max(256).optional(),
21072
+ projectId: z68.string().min(1).max(256).optional(),
20886
21073
  context: diagnosticContextSchema
20887
21074
  }).strict();
20888
- var logQuerySchema = z67.object({
21075
+ var logQuerySchema = z68.object({
20889
21076
  level: operationalLogLevelSchema.optional(),
20890
- module: z67.string().trim().min(1).max(256).optional(),
20891
- runId: z67.string().trim().min(1).max(256).optional(),
20892
- projectId: z67.string().trim().min(1).max(256).optional(),
20893
- actor: z67.string().trim().min(1).max(512).optional(),
20894
- requestId: z67.string().trim().min(1).max(256).optional(),
20895
- since: z67.string().datetime().optional(),
20896
- until: z67.string().datetime().optional(),
20897
- limit: z67.coerce.number().int().min(1).max(200).default(100),
20898
- cursor: z67.string().trim().min(1).max(512).optional()
21077
+ module: z68.string().trim().min(1).max(256).optional(),
21078
+ runId: z68.string().trim().min(1).max(256).optional(),
21079
+ projectId: z68.string().trim().min(1).max(256).optional(),
21080
+ actor: z68.string().trim().min(1).max(512).optional(),
21081
+ requestId: z68.string().trim().min(1).max(256).optional(),
21082
+ since: z68.string().datetime().optional(),
21083
+ until: z68.string().datetime().optional(),
21084
+ limit: z68.coerce.number().int().min(1).max(200).default(100),
21085
+ cursor: z68.string().trim().min(1).max(512).optional()
20899
21086
  }).strict().superRefine((query, ctx) => {
20900
21087
  if (query.since && query.until && Date.parse(query.since) > Date.parse(query.until)) {
20901
- ctx.addIssue({ code: z67.ZodIssueCode.custom, path: ["until"], message: '"until" must be on or after "since".' });
21088
+ ctx.addIssue({ code: z68.ZodIssueCode.custom, path: ["until"], message: '"until" must be on or after "since".' });
20902
21089
  }
20903
21090
  });
20904
- var retentionPolicySchema = z67.object({
20905
- maxEntries: z67.number().int().positive(),
20906
- maxAgeSeconds: z67.number().int().positive()
21091
+ var retentionPolicySchema = z68.object({
21092
+ maxEntries: z68.number().int().positive(),
21093
+ maxAgeSeconds: z68.number().int().positive()
20907
21094
  }).strict();
20908
- var operationalLogListDtoSchema = z67.object({
20909
- entries: z67.array(operationalLogEntryDtoSchema),
20910
- nextCursor: z67.string().min(1).max(512).nullable(),
21095
+ var operationalLogListDtoSchema = z68.object({
21096
+ entries: z68.array(operationalLogEntryDtoSchema),
21097
+ nextCursor: z68.string().min(1).max(512).nullable(),
20911
21098
  /** Matching entries left after this page. */
20912
- truncated: z67.number().int().nonnegative(),
21099
+ truncated: z68.number().int().nonnegative(),
20913
21100
  /** Entries evicted by the active retention policy. */
20914
- dropped: z67.number().int().nonnegative(),
20915
- retention: z67.enum(["process", "durable"]),
21101
+ dropped: z68.number().int().nonnegative(),
21102
+ retention: z68.enum(["process", "durable"]),
20916
21103
  retentionPolicy: retentionPolicySchema.optional(),
20917
21104
  /** Best-effort persistence failures observed by this store. */
20918
- captureErrors: z67.number().int().nonnegative().optional(),
20919
- observedAt: z67.string().datetime()
21105
+ captureErrors: z68.number().int().nonnegative().optional(),
21106
+ observedAt: z68.string().datetime()
20920
21107
  }).strict();
20921
21108
  var OPERATIONAL_LOG_FIELDS_HEADER = "x-canonry-log-fields";
20922
21109
  var OPERATIONAL_LOG_OPT_IN_CONTEXT_FIELDS = ["provider"];
20923
- var diagnosticContextReadSchema = z67.object(diagnosticContextSchema.shape);
20924
- var operationalLogEntryReadSchema = z67.object({ ...operationalLogEntryDtoSchema.shape, context: diagnosticContextReadSchema });
20925
- var operationalLogListReadSchema = z67.object({
21110
+ var diagnosticContextReadSchema = z68.object(diagnosticContextSchema.shape);
21111
+ var operationalLogEntryReadSchema = z68.object({ ...operationalLogEntryDtoSchema.shape, context: diagnosticContextReadSchema });
21112
+ var operationalLogListReadSchema = z68.object({
20926
21113
  ...operationalLogListDtoSchema.shape,
20927
- entries: z67.array(operationalLogEntryReadSchema),
20928
- retentionPolicy: z67.object(retentionPolicySchema.shape).optional()
21114
+ entries: z68.array(operationalLogEntryReadSchema),
21115
+ retentionPolicy: z68.object(retentionPolicySchema.shape).optional()
20929
21116
  });
20930
21117
 
20931
- // ../contracts/src/log-redaction.ts
20932
- var REDACTED = "[REDACTED]";
20933
- var TRUNCATED = "[TRUNCATED]";
20934
- var CIRCULAR = "[CIRCULAR]";
20935
- var UNREADABLE = "[UNREADABLE]";
20936
- var OMITTED = "[OMITTED]";
20937
- var MAX_DEPTH = 6;
20938
- var MAX_ARRAY_ITEMS = 50;
20939
- var MAX_OBJECT_KEYS = 100;
20940
- var MAX_STRING_LENGTH = 4096;
20941
- var secretKey = /api[ _-]?key|authorization|auth(?:entication)?|cookie|password|secret|token|credential/i;
20942
- var escapedSecretAssignment = /\\+["'][\w -]*(?:api[ _-]?key|auth|cookie|password|secret|token|credential)[\w -]*\\+["']\s*:/i;
20943
- var unsafeGraphKey = /^(?:req|res|request|reply|raw|socket|headers?|body|responsebody|apiresponse|rawresponse|providerbody|providerresponse)$/i;
20944
- var providerNameKey = /^provider$/i;
20945
- function isSensitiveDiagnosticQueryKey(key) {
20946
- return secretKey.test(key) || /^key$/i.test(key);
20947
- }
20948
- function redactLogValue(value) {
20949
- try {
20950
- return redactValue(value, 0, /* @__PURE__ */ new WeakSet());
20951
- } catch {
20952
- return UNREADABLE;
20953
- }
20954
- }
20955
- function redactLogString(value) {
20956
- try {
20957
- const clipped = value.length > MAX_STRING_LENGTH ? `${value.slice(0, MAX_STRING_LENGTH)}${TRUNCATED}` : value;
20958
- if (escapedSecretAssignment.test(clipped)) return REDACTED;
20959
- return redactEmbeddedUrls(clipped).replace(/\b((?:set-cookie|cookie)\s*[:=]\s*)[^\r\n]*(?:\r?\n[ \t][^\r\n]*)*/gi, `$1${REDACTED}`).replace(
20960
- /(["']?[\w-]*(?:api[ _-]?key|auth|cookie|password|secret|token|credential)[\w-]*["']?\s*[=:]\s*)(?:"(?:\\.|[^"\\])*(?:"|$)|'(?:\\.|[^'\\])*(?:'|$))/gi,
20961
- `$1${REDACTED}`
20962
- ).replace(/\b(Bearer|Basic)\s+[^\s,;]+/gi, (_match, scheme) => `${scheme} ${REDACTED}`).replace(
20963
- /(api[ _-]?key|authorization|auth(?:entication)?|cookie|password|secret|token|credential)\s*([=:])\s*(?!\[REDACTED\])[^\s&,'")\]}]+/gi,
20964
- `$1$2${REDACTED}`
20965
- ).slice(0, MAX_STRING_LENGTH);
20966
- } catch {
20967
- return UNREADABLE;
20968
- }
20969
- }
20970
- function redactValue(value, depth, seen, key) {
20971
- if (key && diagnosticIdentity(key, value) !== void 0) return value;
20972
- if (key && secretKey.test(key)) return REDACTED;
20973
- if (key && unsafeGraphKey.test(key)) return OMITTED;
20974
- if (key && providerNameKey.test(key) && typeof value === "object" && value !== null) return OMITTED;
20975
- if (value === null || typeof value === "boolean") return value;
20976
- if (typeof value === "number") return Number.isFinite(value) ? value : String(value);
20977
- if (typeof value === "string") return redactLogString(value);
20978
- if (typeof value === "bigint") return value.toString();
20979
- if (typeof value === "undefined") return void 0;
20980
- if (typeof value === "symbol" || typeof value === "function") return `[${typeof value}]`;
20981
- if (depth >= MAX_DEPTH) return TRUNCATED;
20982
- if (typeof value !== "object") return UNREADABLE;
20983
- if (seen.has(value)) return CIRCULAR;
20984
- seen.add(value);
20985
- try {
20986
- if (value instanceof Error) return redactError(value, depth, seen);
20987
- if (Array.isArray(value)) {
20988
- const output2 = [];
20989
- const length = safeArrayLength(value);
20990
- for (let index = 0; index < Math.min(length, MAX_ARRAY_ITEMS); index++) {
20991
- output2.push(redactValue(safeProperty(value, String(index)), depth + 1, seen));
20992
- }
20993
- if (length > MAX_ARRAY_ITEMS) output2.push(TRUNCATED);
20994
- return output2;
20995
- }
20996
- const output = {};
20997
- const keys = safeKeys(value);
20998
- for (const nestedKey of keys.slice(0, MAX_OBJECT_KEYS)) {
20999
- output[nestedKey] = redactValue(safeProperty(value, nestedKey), depth + 1, seen, nestedKey);
21000
- }
21001
- if (keys.length > MAX_OBJECT_KEYS) output.__truncated = true;
21002
- return output;
21003
- } catch {
21004
- return UNREADABLE;
21005
- } finally {
21006
- seen.delete(value);
21007
- }
21008
- }
21009
- function diagnosticIdentity(key, value) {
21010
- if (typeof value !== "string") return void 0;
21011
- if (key === "actor" && /^(?:api-key|user):[\w.-]{1,256}$/.test(value)) return value;
21012
- if (key === "credentialId" && /^[\w.-]{1,256}$/.test(value)) return value;
21013
- return void 0;
21014
- }
21015
- function redactError(error, depth, seen) {
21016
- const output = {
21017
- name: redactLogString(safeErrorString(error, "name")),
21018
- message: redactLogString(safeErrorString(error, "message"))
21019
- };
21020
- const stack = safeErrorString(error, "stack");
21021
- if (stack) output.stack = redactLogString(stack);
21022
- for (const key of safeKeys(error).slice(0, MAX_OBJECT_KEYS)) {
21023
- output[key] = redactValue(safeProperty(error, key), depth + 1, seen, key);
21024
- }
21025
- return output;
21026
- }
21027
- function safeKeys(value) {
21028
- try {
21029
- return Object.keys(value);
21030
- } catch {
21031
- return [];
21032
- }
21033
- }
21034
- function safeArrayLength(value) {
21035
- try {
21036
- return Number.isSafeInteger(value.length) && value.length >= 0 ? value.length : 0;
21037
- } catch {
21038
- return 0;
21039
- }
21040
- }
21041
- function safeProperty(value, key) {
21042
- try {
21043
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
21044
- if (!descriptor || !("value" in descriptor)) return UNREADABLE;
21045
- return descriptor.value;
21046
- } catch {
21047
- return UNREADABLE;
21048
- }
21049
- }
21050
- function safeErrorString(error, key) {
21051
- try {
21052
- const value = error[key];
21053
- return typeof value === "string" ? value : "";
21054
- } catch {
21055
- return UNREADABLE;
21056
- }
21057
- }
21058
- function redactEmbeddedUrls(value) {
21059
- return value.replace(/https?:\/\/[^\s<>"']+/gi, (candidate) => {
21060
- if (candidate.includes(TRUNCATED)) return "[TRUNCATED_URL]";
21061
- const suffix = candidate.match(/[),.;!?\]}]+$/)?.[0] ?? "";
21062
- const rawUrl = suffix ? candidate.slice(0, -suffix.length) : candidate;
21063
- try {
21064
- const url = new URL(rawUrl);
21065
- if (url.username || url.password) {
21066
- url.username = REDACTED;
21067
- url.password = REDACTED;
21068
- }
21069
- for (const key of [...url.searchParams.keys()]) {
21070
- if (isSensitiveDiagnosticQueryKey(key)) url.searchParams.set(key, REDACTED);
21071
- }
21072
- return `${url.toString()}${suffix}`;
21073
- } catch {
21074
- return `[REDACTED_URL]${suffix}`;
21075
- }
21076
- });
21077
- }
21078
-
21079
21118
  // ../contracts/src/semver.ts
21080
21119
  var STRICT_SEMVER = /^(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-[\da-z-]+(?:\.[\da-z-]+)*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?$/i;
21081
21120
  var MAX_SEMVER_LENGTH = 128;
@@ -21139,38 +21178,38 @@ function asRecord(value) {
21139
21178
  }
21140
21179
 
21141
21180
  // ../contracts/src/referral-assessment.ts
21142
- import { z as z68 } from "zod";
21143
- var referralAssessmentQuerySchema = z68.object({
21181
+ import { z as z69 } from "zod";
21182
+ var referralAssessmentQuerySchema = z69.object({
21144
21183
  startDate: calendarDateSchema,
21145
21184
  endDate: calendarDateSchema,
21146
- sourceId: z68.string().trim().min(1).optional(),
21147
- burstThreshold: z68.number().int().min(1).max(1e6).optional(),
21148
- ratioThreshold: z68.number().min(1).max(1e3).optional(),
21149
- limit: z68.number().int().min(1).max(500).optional()
21150
- }).strict();
21151
- var countsSchema = z68.object({
21152
- total: z68.number().int().nonnegative(),
21153
- paid: z68.number().int().nonnegative(),
21154
- organic: z68.number().int().nonnegative(),
21155
- unknown: z68.number().int().nonnegative()
21156
- });
21157
- var referralAssessmentSchema = z68.object({
21158
- scope: z68.object({
21159
- project: z68.string(),
21160
- sourceId: z68.string().nullable(),
21161
- attribution: z68.literal("project-source-only"),
21162
- unavailableDimensions: z68.array(z68.enum(["property", "target", "market"]))
21185
+ sourceId: z69.string().trim().min(1).optional(),
21186
+ burstThreshold: z69.number().int().min(1).max(1e6).optional(),
21187
+ ratioThreshold: z69.number().min(1).max(1e3).optional(),
21188
+ limit: z69.number().int().min(1).max(500).optional()
21189
+ }).strict();
21190
+ var countsSchema = z69.object({
21191
+ total: z69.number().int().nonnegative(),
21192
+ paid: z69.number().int().nonnegative(),
21193
+ organic: z69.number().int().nonnegative(),
21194
+ unknown: z69.number().int().nonnegative()
21195
+ });
21196
+ var referralAssessmentSchema = z69.object({
21197
+ scope: z69.object({
21198
+ project: z69.string(),
21199
+ sourceId: z69.string().nullable(),
21200
+ attribution: z69.literal("project-source-only"),
21201
+ unavailableDimensions: z69.array(z69.enum(["property", "target", "market"]))
21163
21202
  }),
21164
- window: z68.object({ startDate: calendarDateSchema, endDate: calendarDateSchema, timeZone: z68.literal("UTC") }),
21165
- rule: z68.object({
21166
- version: z68.literal("hourly-normalized-path-v1"),
21167
- burstThreshold: z68.number().int().positive(),
21168
- ratioThreshold: z68.number().positive(),
21169
- calibration: z68.enum(["uncalibrated-default", "request-override"]),
21170
- grouping: z68.array(z68.string()),
21171
- confirmsAutomation: z68.literal(false)
21203
+ window: z69.object({ startDate: calendarDateSchema, endDate: calendarDateSchema, timeZone: z69.literal("UTC") }),
21204
+ rule: z69.object({
21205
+ version: z69.literal("hourly-normalized-path-v1"),
21206
+ burstThreshold: z69.number().int().positive(),
21207
+ ratioThreshold: z69.number().positive(),
21208
+ calibration: z69.enum(["uncalibrated-default", "request-override"]),
21209
+ grouping: z69.array(z69.string()),
21210
+ confirmsAutomation: z69.literal(false)
21172
21211
  }),
21173
- totals: z68.object({
21212
+ totals: z69.object({
21174
21213
  raw: countsSchema,
21175
21214
  redirects: countsSchema,
21176
21215
  subresources: countsSchema,
@@ -21178,42 +21217,42 @@ var referralAssessmentSchema = z68.object({
21178
21217
  suspected: countsSchema,
21179
21218
  adjustedEstimate: countsSchema
21180
21219
  }),
21181
- bursts: z68.array(z68.object({
21182
- sourceId: z68.string(),
21183
- product: z68.string(),
21184
- landingPathNormalized: z68.string(),
21185
- tsHour: z68.string(),
21220
+ bursts: z69.array(z69.object({
21221
+ sourceId: z69.string(),
21222
+ product: z69.string(),
21223
+ landingPathNormalized: z69.string(),
21224
+ tsHour: z69.string(),
21186
21225
  counts: countsSchema
21187
21226
  })),
21188
- evidence: z68.object({ total: z68.number().int().nonnegative(), returned: z68.number().int().nonnegative(), truncated: z68.boolean() }),
21189
- comparison: z68.object({
21190
- status: z68.literal("unavailable"),
21191
- serverCountable: z68.number().int().nonnegative(),
21192
- serverObservation: z68.enum(["missing", "observed-zero", "observed-positive"]),
21227
+ evidence: z69.object({ total: z69.number().int().nonnegative(), returned: z69.number().int().nonnegative(), truncated: z69.boolean() }),
21228
+ comparison: z69.object({
21229
+ status: z69.literal("unavailable"),
21230
+ serverCountable: z69.number().int().nonnegative(),
21231
+ serverObservation: z69.enum(["missing", "observed-zero", "observed-positive"]),
21193
21232
  /**
21194
21233
  * Dimension-deduplicated GA AI sessions. With no stored AI row in the
21195
21234
  * window: `0` (`observed-zero`) when the latest GA sync queried the whole
21196
21235
  * window (GA4 omits zero rows), else `null` (`missing`).
21197
21236
  */
21198
- gaSessions: z68.number().int().nonnegative().nullable(),
21199
- gaObservation: z68.enum(["missing", "observed-zero", "observed-positive"]),
21237
+ gaSessions: z69.number().int().nonnegative().nullable(),
21238
+ gaObservation: z69.enum(["missing", "observed-zero", "observed-positive"]),
21200
21239
  /**
21201
21240
  * Descriptive quotient only (`serverCountable / gaSessions`, a multiplier
21202
21241
  * where 3 is three times as many, never a percent), rounded to 2
21203
21242
  * decimals. Not a matched, coverage-complete comparison.
21204
21243
  */
21205
- observedRatio: z68.number().nonnegative().nullable(),
21244
+ observedRatio: z69.number().nonnegative().nullable(),
21206
21245
  /** Compares the rounded `observedRatio` with `rule.ratioThreshold`. */
21207
- observedRatioAboveThreshold: z68.boolean().nullable(),
21208
- ratio: z68.null(),
21209
- reasons: z68.array(z68.string()),
21210
- gaScope: z68.literal("project")
21246
+ observedRatioAboveThreshold: z69.boolean().nullable(),
21247
+ ratio: z69.null(),
21248
+ reasons: z69.array(z69.string()),
21249
+ gaScope: z69.literal("project")
21211
21250
  }),
21212
- caveats: z68.array(z68.string())
21251
+ caveats: z69.array(z69.string())
21213
21252
  });
21214
21253
 
21215
21254
  // ../contracts/src/tolerant-read.ts
21216
- import { z as z69 } from "zod";
21255
+ import { z as z70 } from "zod";
21217
21256
  var WRAPPER_TYPES = /* @__PURE__ */ new Set(["optional", "nullable", "default", "prefault", "readonly", "catch", "nonoptional"]);
21218
21257
  var DEPTH_LIMIT = 64;
21219
21258
  function defOf(schema) {
@@ -21224,9 +21263,9 @@ function cloneWith(schema, changes) {
21224
21263
  }
21225
21264
  function openPrimitive(values) {
21226
21265
  if (values.length === 0) return void 0;
21227
- if (values.every((value) => typeof value === "string")) return z69.string();
21228
- if (values.every((value) => typeof value === "number")) return z69.number();
21229
- if (values.every((value) => typeof value === "boolean")) return z69.boolean();
21266
+ if (values.every((value) => typeof value === "string")) return z70.string();
21267
+ if (values.every((value) => typeof value === "number")) return z70.number();
21268
+ if (values.every((value) => typeof value === "boolean")) return z70.boolean();
21230
21269
  return void 0;
21231
21270
  }
21232
21271
  function walk2(schema, open, memo, depth) {
@@ -21240,7 +21279,7 @@ function walk2(schema, open, memo, depth) {
21240
21279
  const shape = Object.fromEntries(Object.entries(schema.shape).map(([key, child]) => [key, next(child)]));
21241
21280
  const declared = def.catchall;
21242
21281
  const catchall = open.get(schema) ?? (declared && defOf(declared).type !== "never" ? next(declared) : void 0);
21243
- result = catchall ? z69.object(shape).catchall(catchall) : z69.object(shape);
21282
+ result = catchall ? z70.object(shape).catchall(catchall) : z70.object(shape);
21244
21283
  } else if (WRAPPER_TYPES.has(def.type)) {
21245
21284
  const inner = def.innerType;
21246
21285
  const mapped = next(inner);
@@ -21257,10 +21296,10 @@ function walk2(schema, open, memo, depth) {
21257
21296
  const options = def.options;
21258
21297
  const mapped = options.map(next);
21259
21298
  const changed = mapped.some((option, index) => option !== options[index]);
21260
- result = !changed ? schema : def.discriminator ? z69.union(mapped) : cloneWith(schema, { options: mapped });
21299
+ result = !changed ? schema : def.discriminator ? z70.union(mapped) : cloneWith(schema, { options: mapped });
21261
21300
  } else if (def.type === "record") {
21262
21301
  const keyType = def.keyType, valueType = def.valueType;
21263
- const mappedKey = defOf(keyType).type === "enum" ? z69.string() : keyType;
21302
+ const mappedKey = defOf(keyType).type === "enum" ? z70.string() : keyType;
21264
21303
  const mappedValue = next(valueType);
21265
21304
  result = mappedKey === keyType && mappedValue === valueType ? schema : cloneWith(schema, { keyType: mappedKey, valueType: mappedValue });
21266
21305
  } else if (def.type === "intersection") {
@@ -21276,7 +21315,7 @@ function walk2(schema, open, memo, depth) {
21276
21315
  result = changed ? cloneWith(schema, { items: mappedItems, rest: mappedRest }) : schema;
21277
21316
  } else if (def.type === "lazy") {
21278
21317
  const getter = def.getter;
21279
- result = z69.lazy(() => next(getter()));
21318
+ result = z70.lazy(() => next(getter()));
21280
21319
  } else if (def.type === "enum") {
21281
21320
  result = openPrimitive(Object.values(def.entries)) ?? schema;
21282
21321
  } else if (def.type === "literal") {
@@ -21291,8 +21330,8 @@ function tolerantReadSchema(schema, options = {}) {
21291
21330
  }
21292
21331
 
21293
21332
  // ../contracts/src/sentiment-read.ts
21294
- import { z as z70 } from "zod";
21295
- var OPEN_COUNTS = { openKeys: [[sentimentCountsSchema, z70.number().int().nonnegative()]] };
21333
+ import { z as z71 } from "zod";
21334
+ var OPEN_COUNTS = { openKeys: [[sentimentCountsSchema, z71.number().int().nonnegative()]] };
21296
21335
  var sentimentSettingsReadSchema = tolerantReadSchema(sentimentSettingsSchema, OPEN_COUNTS);
21297
21336
  var sentimentSummaryReadSchema = tolerantReadSchema(sentimentSummarySchema, OPEN_COUNTS);
21298
21337
  var sentimentEvidencePageReadSchema = tolerantReadSchema(sentimentEvidencePageSchema, OPEN_COUNTS);
@@ -22228,6 +22267,15 @@ export {
22228
22267
  AGENT_NONE,
22229
22268
  normalizeAgentSlug,
22230
22269
  detectAgentRuntime,
22270
+ isSensitiveDiagnosticQueryKey,
22271
+ redactLogValue,
22272
+ redactLogString,
22273
+ diagnosticIdentity,
22274
+ FEEDBACK_KINDS,
22275
+ FEEDBACK_LIMITS,
22276
+ feedbackSubmissionSchema,
22277
+ feedbackAcceptedDtoSchema,
22278
+ redactFeedbackText,
22231
22279
  MIN_TREND_POINTS,
22232
22280
  isTrendBaseline,
22233
22281
  ReportSectionIds,
@@ -22295,10 +22343,6 @@ export {
22295
22343
  OPERATIONAL_LOG_FIELDS_HEADER,
22296
22344
  OPERATIONAL_LOG_OPT_IN_CONTEXT_FIELDS,
22297
22345
  operationalLogListReadSchema,
22298
- isSensitiveDiagnosticQueryKey,
22299
- redactLogValue,
22300
- redactLogString,
22301
- diagnosticIdentity,
22302
22346
  isStrictSemver,
22303
22347
  compareSemver,
22304
22348
  CANONRY_NPM_PACKAGE_URL,