@canonry/canonry 7.0.0 → 7.2.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/canonry/references/aeo-analysis.md +5 -3
  2. package/assets/agent-workspace/skills/canonry/references/canonry-cli.md +19 -2
  3. package/assets/assets/AuditHistoryPanel-Duvyi8vx.js +1 -0
  4. package/assets/assets/{BacklinksPage-HIM0fmV7.js → BacklinksPage-CY5AllQu.js} +1 -1
  5. package/assets/assets/{HistoryPage-BjEVp-fk.js → HistoryPage-C0Gr0gcj.js} +1 -1
  6. package/assets/assets/{MeasurementPropertyPage-BnVDR2y_.js → MeasurementPropertyPage-DrAB6VKX.js} +1 -1
  7. package/assets/assets/ProjectPage-DSxvvnAd.js +8 -0
  8. package/assets/assets/{RunsPage-fJQe2qJc.js → RunsPage-DMxOrtfl.js} +1 -1
  9. package/assets/assets/{SettingsPage-1yam5tl6.js → SettingsPage-sxiUNt2A.js} +1 -1
  10. package/assets/assets/SiteHealthSection--6tZe3hM.js +4 -0
  11. package/assets/assets/{TrafficPage-BdNEscz8.js → TrafficPage-CvSQDNTi.js} +2 -2
  12. package/assets/assets/{TrafficSourceDetailPage-CMEgr4Aw.js → TrafficSourceDetailPage-BaYeIBmc.js} +1 -1
  13. package/assets/assets/{extract-error-message-D2dhaJaW.js → extract-error-message-76IWhqQF.js} +1 -1
  14. package/assets/assets/index-BlrH2zRW.js +86 -0
  15. package/assets/assets/index-HWSQgVum.css +1 -0
  16. package/assets/assets/{react-sigma_core.esm.min-oP23IWpt.js → react-sigma_core.esm.min-CkAcKW2k.js} +1 -1
  17. package/assets/assets/{v2-overview-adapter-DYatWs7N.js → v2-overview-adapter-DnEE4E9w.js} +1 -1
  18. package/assets/index.html +2 -2
  19. package/dist/{chunk-TUHQ5BBQ.js → chunk-BYSSJEL7.js} +9 -8
  20. package/dist/{chunk-LXWY4NKP.js → chunk-EQBYK77W.js} +3 -3
  21. package/dist/{chunk-HQJ25LI7.js → chunk-FDBQOQLP.js} +2 -2
  22. package/dist/{chunk-EZ54X4XH.js → chunk-RCQJI3UX.js} +125 -86
  23. package/dist/{chunk-RRIZ5AKI.js → chunk-SVTVBPIT.js} +2 -2
  24. package/dist/{chunk-OOUDIVIU.js → chunk-TY3CJKKR.js} +458 -184
  25. package/dist/{chunk-A5PALGQD.js → chunk-UIDHHZH3.js} +94 -190
  26. package/dist/cli.js +32 -16
  27. package/dist/{demo-server-LHHDVXQW.js → demo-server-GWRYDPJC.js} +4 -4
  28. package/dist/index.js +6 -6
  29. package/dist/{intelligence-service-ZVKZLLKL.js → intelligence-service-3L2665AK.js} +2 -2
  30. package/dist/mcp.js +4 -4
  31. package/package.json +12 -12
  32. package/assets/assets/AuditHistoryPanel-DBYsgVsn.js +0 -1
  33. package/assets/assets/ProjectPage-BhCM47KA.js +0 -8
  34. package/assets/assets/SiteHealthSection-DysU2M6C.js +0 -4
  35. package/assets/assets/index-CgT2Btdn.css +0 -1
  36. package/assets/assets/index-D9ODLKpH.js +0 -86
package/dist/cli.js CHANGED
@@ -35,11 +35,11 @@ import {
35
35
  trackCliCommandFinished,
36
36
  trackEvent,
37
37
  waitForServerRuntimeStartup
38
- } from "./chunk-A5PALGQD.js";
38
+ } from "./chunk-UIDHHZH3.js";
39
39
  import {
40
40
  autoSyncSkills,
41
41
  formatAutoSyncNotice
42
- } from "./chunk-LXWY4NKP.js";
42
+ } from "./chunk-EQBYK77W.js";
43
43
  import {
44
44
  configExists,
45
45
  createApiClient,
@@ -56,13 +56,13 @@ import {
56
56
  saveConfig,
57
57
  saveConfigPatch,
58
58
  shouldPrintServeSkillsNudge
59
- } from "./chunk-HQJ25LI7.js";
59
+ } from "./chunk-FDBQOQLP.js";
60
60
  import {
61
61
  DEFAULT_DEMO_TRUSTED_PROXIES,
62
62
  trustedProxiesProblem,
63
63
  trustedProxyProblem
64
64
  } from "./chunk-RB2F4D3Z.js";
65
- import "./chunk-RRIZ5AKI.js";
65
+ import "./chunk-SVTVBPIT.js";
66
66
  import {
67
67
  CliError,
68
68
  EXIT_SYSTEM_ERROR,
@@ -74,7 +74,7 @@ import {
74
74
  runMeasurementDraftAction,
75
75
  systemError,
76
76
  usageError
77
- } from "./chunk-TUHQ5BBQ.js";
77
+ } from "./chunk-BYSSJEL7.js";
78
78
  import {
79
79
  CLOUDFLARE_WORKER_BINDINGS,
80
80
  CLOUDFLARE_WORKER_GENERATED_MARKER,
@@ -89,7 +89,7 @@ import {
89
89
  projects,
90
90
  queries,
91
91
  runs
92
- } from "./chunk-EZ54X4XH.js";
92
+ } from "./chunk-RCQJI3UX.js";
93
93
  import {
94
94
  AdsDeliverySnapshotStatuses,
95
95
  AdsHistoricalCampaignRollupStatuses,
@@ -200,7 +200,7 @@ import {
200
200
  visibilityCompareSelectionSchema,
201
201
  visibilityReportRequestSchema,
202
202
  winnabilityClassSchema
203
- } from "./chunk-OOUDIVIU.js";
203
+ } from "./chunk-TY3CJKKR.js";
204
204
 
205
205
  // src/cli.ts
206
206
  import { pathToFileURL } from "url";
@@ -471,6 +471,19 @@ function ratedAnswersLine({ ratedAnswers, eligibleAnswers, ratedAnswerRate }) {
471
471
  if (ratedAnswerRate === null || ratedAnswerRate === void 0) return `Rated: Unavailable \xB7 ${eligibleAnswers} eligible ${eligibleAnswers === 1 ? "answer" : "answers"}`;
472
472
  return `Rated: ${formatPercent(ratedAnswerRate, RatioUnits.fraction)} \xB7 ${ratedAnswers} of ${eligibleAnswers} ${eligibleAnswers === 1 ? "answer" : "answers"} rated`;
473
473
  }
474
+ var CRITICIZED_PROPERTIES_TITLE = "Most criticized properties";
475
+ function printCriticizedProperties(value) {
476
+ const ranked = value.criticizedProperties;
477
+ if (!ranked?.keys.length) return;
478
+ const rows = new Map(value.breakdowns.filter((row) => row.dimension === "property").map((row) => [row.key, row]));
479
+ const listed = ranked.keys.flatMap((key) => rows.get(key) ?? []);
480
+ if (listed.length === 0) return;
481
+ console.log(`${CRITICIZED_PROPERTIES_TITLE}: ${listed.length} of ${ranked.total}`);
482
+ for (const row of listed) {
483
+ const { favorable, mixed, unfavorable } = row.coverage.counts;
484
+ console.log(` ${row.label} (${row.key}): ${favorable} favorable \xB7 ${mixed} mixed \xB7 ${unfavorable} unfavorable \xB7 ${row.coverage.judged} judged`);
485
+ }
486
+ }
474
487
  function printSummary(value) {
475
488
  const label = value.selection.queryClass === "branded" ? "Branded" : "Non-brand";
476
489
  console.log(`${label} sentiment: ${value.state}${value.provisional ? " \xB7 provisional" : ""}`);
@@ -497,6 +510,7 @@ function printSummary(value) {
497
510
  }
498
511
  }
499
512
  for (const row of value.breakdowns) if (row.dimension !== "query") console.log(`${row.dimension} ${row.label} \xB7 ${row.queryClass}: ${row.score.favorableDisplay} favorable \xB7 ${row.coverage.judged} of ${row.coverage.selected} judged`);
513
+ printCriticizedProperties(value);
500
514
  if (value.queryPage) console.log(`Query rows: ${value.queries.length} of ${value.queryPage.total}`);
501
515
  if (value.queryPage?.nextCursor) console.log(`Next query cursor: ${value.queryPage.nextCursor}`);
502
516
  }
@@ -511,7 +525,8 @@ async function configureSentiment(project2, request, format) {
511
525
  async function showSentimentEvidence(project2, query, format) {
512
526
  const value = await createApiClient().getSentimentEvidence(project2, query);
513
527
  if (machine(value, format)) return;
514
- console.log(`${value.selection.queryClass} sentiment evidence: ${value.state} \xB7 definition ${value.selection.evaluationDefinitionId ?? "not measured"}`);
528
+ const outcomes = value.selection.outcome?.length ? ` \xB7 outcomes ${value.selection.outcome.join(", ")}` : "";
529
+ console.log(`${value.selection.queryClass} sentiment evidence: ${value.state} \xB7 definition ${value.selection.evaluationDefinitionId ?? "not measured"}${outcomes}`);
515
530
  for (const item of value.items) {
516
531
  console.log(`
517
532
  ${item.subject.displayName} \xB7 ${item.outcome} \xB7 ${item.context.provider} \xB7 run ${item.runId}`);
@@ -629,12 +644,13 @@ var SENTIMENT_CLI_COMMANDS = [
629
644
  },
630
645
  {
631
646
  path: ["sentiment", "evidence"],
632
- usage: "canonry sentiment evidence <project> [selection options] [--assessment-id <id>] [--cursor <cursor>] [--limit 1..100] [--format json]",
633
- help: `${readSelectionHelp} Use --assessment-id from a query assessment to read that exact stored verdict; existing scope filters still apply. Keep all selection fields, including assessmentId and the returned evaluationDefinitionId, when following a cursor. JSONL preserves the entire page envelope, including empty state and next cursor.`,
634
- options: { ...readSelectionOptions, "assessment-id": stringOption(), cursor: stringOption(), limit: stringOption() },
647
+ usage: "canonry sentiment evidence <project> [selection options] [--assessment-id <id>] [--outcome mixed,unfavorable] [--cursor <cursor>] [--limit 1..100] [--format json]",
648
+ help: `${readSelectionHelp} Use --assessment-id from a query assessment to read that exact stored verdict; existing scope filters still apply. --outcome keeps only assessments with those outcomes (comma-separated or repeated, for example --outcome mixed,unfavorable for the criticism behind a branded score or the non-brand exceptions); it never changes how they were scored. Keep all selection fields, including assessmentId, outcome and the returned evaluationDefinitionId, when following a cursor. JSONL preserves the entire page envelope, including empty state and next cursor.`,
649
+ options: { ...readSelectionOptions, "assessment-id": stringOption(), outcome: multiStringOption(), cursor: stringOption(), limit: stringOption() },
635
650
  run: (input) => showSentimentEvidence(project(input, "evidence"), parse(sentimentEvidenceRequestSchema, {
636
651
  ...readSelection(input),
637
652
  assessmentId: getString(input.values, "assessment-id"),
653
+ outcome: getStringArray(input.values, "outcome")?.join(","),
638
654
  cursor: getString(input.values, "cursor"),
639
655
  limit: getString(input.values, "limit")
640
656
  }), input.format)
@@ -734,7 +750,7 @@ function parseDemoTrustedProxies(values) {
734
750
  async function demoCommand(options) {
735
751
  const { host, port } = parseDemoListenOptions(options);
736
752
  const trustProxy = parseDemoTrustedProxies(options.trustProxy);
737
- const { createDemoServer } = await import("./demo-server-LHHDVXQW.js");
753
+ const { createDemoServer } = await import("./demo-server-GWRYDPJC.js");
738
754
  const app = await createDemoServer({ trustProxy });
739
755
  let stopping = false;
740
756
  const stop = () => {
@@ -15110,11 +15126,11 @@ function renderHuman2(overview) {
15110
15126
  printScore("Index coverage ", scores.indexCoverage);
15111
15127
  printScore("Competitor press.", scores.competitorPressure);
15112
15128
  printScore("Run status ", scores.runStatus);
15113
- const overallSentiment = overview.sentiment?.overall;
15114
- if (overview.sentiment?.configured && overallSentiment && overallSentiment.coverage.judged > 0 && overallSentiment.score.favorableRate !== null) {
15129
+ const brandedSentiment = overview.sentiment?.branded;
15130
+ if (overview.sentiment?.configured && brandedSentiment && brandedSentiment.coverage.judged > 0 && brandedSentiment.score.favorableRate !== null) {
15115
15131
  console.log(`
15116
- Overall sentiment: ${overallSentiment.score.favorableDisplay} favorable \xB7 all query classes`);
15117
- console.log(` ${overallSentiment.coverage.counts.favorable} favorable / ${overallSentiment.coverage.judged} judged${overallSentiment.provisional ? " \xB7 provisional" : ""}`);
15132
+ Sentiment: ${brandedSentiment.score.favorableDisplay} favorable \xB7 branded queries`);
15133
+ console.log(` ${brandedSentiment.coverage.counts.favorable} favorable / ${brandedSentiment.coverage.judged} judged${brandedSentiment.provisional ? " \xB7 provisional" : ""}`);
15118
15134
  }
15119
15135
  console.log(`
15120
15136
  Queries cited: ${queryCounts.citedQueries}/${queryCounts.totalQueries} (${formatPercent(queryCounts.citedRate)})`);
@@ -5,11 +5,11 @@ import {
5
5
  computeFactorAverages,
6
6
  layoutSiteCrawlGraphInput,
7
7
  persistSiteCrawlGraphLayout
8
- } from "./chunk-RRIZ5AKI.js";
8
+ } from "./chunk-SVTVBPIT.js";
9
9
  import {
10
10
  PACKAGE_VERSION,
11
11
  canonryMcpTools
12
- } from "./chunk-TUHQ5BBQ.js";
12
+ } from "./chunk-BYSSJEL7.js";
13
13
  import {
14
14
  HISTORY_WINDOW_RUNS,
15
15
  IntelligenceService,
@@ -85,7 +85,7 @@ import {
85
85
  siteCrawlPages,
86
86
  siteCrawlSnapshots,
87
87
  trafficSources
88
- } from "./chunk-EZ54X4XH.js";
88
+ } from "./chunk-RCQJI3UX.js";
89
89
  import {
90
90
  RunKinds,
91
91
  SiteCrawlFetchStates,
@@ -112,7 +112,7 @@ import {
112
112
  roundPreservingTotal,
113
113
  siteAuditPageFactorSchema,
114
114
  wilsonInterval
115
- } from "./chunk-OOUDIVIU.js";
115
+ } from "./chunk-TY3CJKKR.js";
116
116
 
117
117
  // src/demo-server.ts
118
118
  import { dirname, join as join2 } from "path";
package/dist/index.js CHANGED
@@ -3,14 +3,14 @@ import {
3
3
  createGoogleMarketingCredentialStore,
4
4
  createGoogleMarketingRuntime,
5
5
  createServer
6
- } from "./chunk-A5PALGQD.js";
6
+ } from "./chunk-UIDHHZH3.js";
7
7
  import {
8
8
  loadConfig
9
- } from "./chunk-HQJ25LI7.js";
10
- import "./chunk-RRIZ5AKI.js";
11
- import "./chunk-TUHQ5BBQ.js";
12
- import "./chunk-EZ54X4XH.js";
13
- import "./chunk-OOUDIVIU.js";
9
+ } from "./chunk-FDBQOQLP.js";
10
+ import "./chunk-SVTVBPIT.js";
11
+ import "./chunk-BYSSJEL7.js";
12
+ import "./chunk-RCQJI3UX.js";
13
+ import "./chunk-TY3CJKKR.js";
14
14
  export {
15
15
  GoogleMarketingRuntimeError,
16
16
  createGoogleMarketingCredentialStore,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  HISTORY_WINDOW_RUNS,
3
3
  IntelligenceService
4
- } from "./chunk-EZ54X4XH.js";
5
- import "./chunk-OOUDIVIU.js";
4
+ } from "./chunk-RCQJI3UX.js";
5
+ import "./chunk-TY3CJKKR.js";
6
6
  export {
7
7
  HISTORY_WINDOW_RUNS,
8
8
  IntelligenceService
package/dist/mcp.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  autoSyncSkills
3
- } from "./chunk-LXWY4NKP.js";
3
+ } from "./chunk-EQBYK77W.js";
4
4
  import {
5
5
  createApiClient,
6
6
  createCanonryMcpServer
7
- } from "./chunk-HQJ25LI7.js";
8
- import "./chunk-TUHQ5BBQ.js";
7
+ } from "./chunk-FDBQOQLP.js";
8
+ import "./chunk-BYSSJEL7.js";
9
9
  import {
10
10
  isReadOnlyKey,
11
11
  updateCheckEnvOptOut
12
- } from "./chunk-OOUDIVIU.js";
12
+ } from "./chunk-TY3CJKKR.js";
13
13
 
14
14
  // src/mcp/cli.ts
15
15
  import { randomUUID } from "crypto";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canonry/canonry",
3
- "version": "7.0.0",
3
+ "version": "7.2.0",
4
4
  "type": "module",
5
5
  "description": "Self-hosted AI visibility (AEO) platform: track how ChatGPT, Claude, Gemini, and Perplexity cite your domain, join it with Search Console, GA4, server-side traffic, and paid media, and fix what you find through agent tools (CLI, REST, MCP). Local SQLite.",
6
6
  "keywords": [
@@ -87,29 +87,29 @@
87
87
  "tsx": "^4.19.0",
88
88
  "@ainyc/canonry-web": "0.0.0",
89
89
  "@ainyc/canonry-api-client": "0.0.0",
90
- "@ainyc/canonry-config": "0.0.0",
91
- "@ainyc/canonry-contracts": "0.0.0",
92
- "@ainyc/canonry-api-routes": "0.0.0",
93
90
  "@ainyc/canonry-db": "0.0.0",
91
+ "@ainyc/canonry-api-routes": "0.0.0",
92
+ "@ainyc/canonry-contracts": "0.0.0",
93
+ "@ainyc/canonry-config": "0.0.0",
94
94
  "@ainyc/canonry-integration-bing": "0.0.0",
95
95
  "@ainyc/canonry-integration-cloudflare-queue": "0.0.0",
96
96
  "@ainyc/canonry-integration-cloudflare-worker": "0.0.0",
97
+ "@ainyc/canonry-integration-cloud-run": "0.0.0",
98
+ "@ainyc/canonry-integration-google-ads": "0.0.0",
97
99
  "@ainyc/canonry-integration-commoncrawl": "0.0.0",
98
100
  "@ainyc/canonry-integration-google": "0.0.0",
99
- "@ainyc/canonry-integration-google-ads": "0.0.0",
100
- "@ainyc/canonry-integration-cloud-run": "0.0.0",
101
+ "@ainyc/canonry-integration-google-business-profile": "0.0.0",
101
102
  "@ainyc/canonry-integration-google-places": "0.0.0",
102
103
  "@ainyc/canonry-integration-google-tag-manager": "0.0.0",
103
- "@ainyc/canonry-integration-openai-ads": "0.0.0",
104
- "@ainyc/canonry-integration-google-business-profile": "0.0.0",
104
+ "@ainyc/canonry-integration-traffic": "0.0.0",
105
105
  "@ainyc/canonry-integration-wordpress": "0.0.0",
106
- "@ainyc/canonry-provider-cdp": "0.0.0",
107
106
  "@ainyc/canonry-intelligence": "0.0.0",
108
- "@ainyc/canonry-integration-traffic": "0.0.0",
107
+ "@ainyc/canonry-provider-cdp": "0.0.0",
109
108
  "@ainyc/canonry-provider-claude": "0.0.0",
110
- "@ainyc/canonry-provider-muse": "0.0.0",
111
- "@ainyc/canonry-provider-local": "0.0.0",
112
109
  "@ainyc/canonry-provider-gemini": "0.0.0",
110
+ "@ainyc/canonry-provider-local": "0.0.0",
111
+ "@ainyc/canonry-integration-openai-ads": "0.0.0",
112
+ "@ainyc/canonry-provider-muse": "0.0.0",
113
113
  "@ainyc/canonry-provider-openai": "0.0.0",
114
114
  "@ainyc/canonry-provider-perplexity": "0.0.0",
115
115
  "@ainyc/canonry-integration-typesafe": "0.0.0"
@@ -1 +0,0 @@
1
- import{r as a,u as h,j as e}from"./vendor-tanstack-ZXXkndVj.js";import{dv as L,dw as P,cq as E,w as u,B as x,r as v,T as M}from"./index-D9ODLKpH.js";const o=100;function k(s){if(s==="all")return;const n=Number.parseInt(s,10);return new Date(Date.now()-n*24*60*60*1e3).toISOString()}function O(s){const n=s.userAgent?.toLowerCase()??"";return n.includes("canonry-mcp")?"MCP":n.includes("canonry-cli")?"CLI":n.includes("mozilla/")?"Dashboard":s.actor==="scheduler"?"Scheduler":s.actor==="agent"?"Agent":s.actor==="mcp"?"MCP":s.actor==="cli"?"CLI":s.actor}function B(s){return/delete|remove|revoke|disconnect|failed/.test(s)?"negative":/create|add|connect|completed/.test(s)?"positive":/update|replace|sync|apply/.test(s)?"caution":"neutral"}function D(s){return[s.action,s.actor,s.entityType,s.entityId,s.actorSession,s.userAgent,s.diff==null?"":JSON.stringify(s.diff)].filter(Boolean).join(" ").toLowerCase()}function H({projectName:s}){const[n,l]=a.useState(0),[c,y]=a.useState("90d"),[m,w]=a.useState(""),[p,N]=a.useState(""),S=a.useMemo(()=>k(c),[c]),g={limit:o,offset:n*o,since:S,actor:m||void 0},C=h({...L({client:u,path:{name:s??""},query:g}),enabled:!!s}),A=h({...P({client:u,query:g}),enabled:!s}),f=h({...E({client:u}),enabled:!s}),i=s?C:A,r=i.data??[],I=a.useMemo(()=>new Map((f.data??[]).map(t=>[t.id,t.displayName||t.name])),[f.data]),d=p.trim().toLowerCase(),j=a.useMemo(()=>d?r.filter(t=>D(t).includes(d)):r,[r,d]),b=t=>{l(0),t()};return i.isLoading?e.jsx("p",{className:"supporting-copy mt-6",role:"status",children:"Loading change history…"}):e.jsxs("section",{className:"mt-6","aria-labelledby":"change-history-heading",children:[e.jsxs("div",{className:"section-head section-head-inline",children:[e.jsxs("div",{children:[e.jsx("p",{className:"eyebrow eyebrow-soft",children:"Audit trail"}),e.jsx("h2",{id:"change-history-heading",children:"Change history"}),e.jsx("p",{className:"supporting-copy mt-1 max-w-2xl",children:"Configuration and operator actions. Execution outcomes remain in Runs."})]}),e.jsx(x,{type:"button",variant:"outline",size:"sm",onClick:()=>{i.refetch()},disabled:i.isFetching,children:i.isFetching?"Refreshing…":"Refresh"})]}),e.jsxs("div",{className:"mt-4 grid gap-2 sm:grid-cols-3",children:[e.jsx("input",{type:"search","aria-label":"Search change history",value:p,onChange:t=>N(t.target.value),placeholder:"Search actions, entities, or details",className:"min-h-11 rounded-md border border-base bg-bg px-3 text-sm text-strong placeholder-mono-600 focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600"}),e.jsxs("select",{"aria-label":"Filter change history by actor",value:m,onChange:t=>b(()=>w(t.target.value)),className:"min-h-11 rounded-md border border-base bg-bg px-3 text-sm text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600",children:[e.jsx("option",{value:"",children:"All actors"}),e.jsx("option",{value:"api",children:"API and dashboard"}),e.jsx("option",{value:"cli",children:"CLI"}),e.jsx("option",{value:"scheduler",children:"Scheduler"}),e.jsx("option",{value:"agent",children:"Agent"}),e.jsx("option",{value:"mcp",children:"MCP"})]}),e.jsxs("select",{"aria-label":"Filter change history by date range",value:c,onChange:t=>b(()=>y(t.target.value)),className:"min-h-11 rounded-md border border-base bg-bg px-3 text-sm text-strong focus:outline-none focus-visible:ring-1 focus-visible:ring-mono-600",children:[e.jsx("option",{value:"30d",children:"Last 30 days"}),e.jsx("option",{value:"90d",children:"Last 90 days"}),e.jsx("option",{value:"365d",children:"Last year"}),e.jsx("option",{value:"all",children:"All retained history"})]})]}),i.isError?e.jsxs(v,{className:"surface-card empty-card mt-4",children:[e.jsx("h3",{children:"Change history unavailable"}),e.jsx("p",{children:i.error instanceof Error?i.error.message:"Could not load the audit trail."})]}):j.length===0?e.jsxs(v,{className:"surface-card empty-card mt-4",children:[e.jsx("h3",{children:"No changes match these filters"}),e.jsx("p",{children:"Widen the date range or clear the actor and search filters."})]}):e.jsx("div",{className:"evidence-table-wrap mt-4",children:e.jsxs("table",{className:"evidence-table",children:[e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{children:"When"}),s?null:e.jsx("th",{children:"Scope"}),e.jsx("th",{children:"Action"}),e.jsx("th",{children:"Entity"}),e.jsx("th",{children:"Origin"}),e.jsx("th",{children:"Details"})]})}),e.jsx("tbody",{children:j.map(t=>e.jsxs("tr",{children:[e.jsx("td",{className:"whitespace-nowrap tabular-nums text-muted",children:new Date(t.createdAt).toLocaleString()}),s?null:e.jsx("td",{className:"text-secondary",children:t.projectId?I.get(t.projectId)??`Deleted project · ${t.projectId}`:"Instance settings"}),e.jsx("td",{children:e.jsx(M,{tone:B(t.action),children:t.action})}),e.jsxs("td",{children:[e.jsx("span",{className:"text-strong",children:t.entityType}),t.entityId?e.jsx("span",{className:"mt-0.5 block max-w-48 truncate font-mono text-[11px] text-faint",title:t.entityId,children:t.entityId}):null]}),e.jsxs("td",{children:[e.jsx("span",{className:"text-secondary",children:O(t)}),t.actorSession?e.jsxs("span",{className:"mt-0.5 block max-w-40 truncate font-mono text-[11px] text-faint",title:t.actorSession,children:["Session ",t.actorSession]}):null]}),e.jsx("td",{children:t.diff==null?e.jsx("span",{className:"text-faint",children:"No field diff"}):e.jsxs("details",{children:[e.jsx("summary",{className:"min-h-11 cursor-pointer py-3 text-sm text-secondary hover:text-strong",children:"View diff"}),e.jsx("pre",{className:"max-h-72 max-w-xl overflow-auto whitespace-pre-wrap break-words rounded-md bg-bg-elevated p-3 text-xs text-secondary",children:JSON.stringify(t.diff,null,2)})]})})]},t.id))})]})}),!i.isError&&(n>0||r.length===o)?e.jsxs("div",{className:"mt-4 flex items-center justify-between gap-3",children:[e.jsx(x,{type:"button",variant:"outline",size:"sm",disabled:n===0,onClick:()=>l(t=>Math.max(0,t-1)),children:"Previous"}),e.jsxs("span",{className:"text-xs tabular-nums text-muted",children:["Page ",n+1]}),e.jsx(x,{type:"button",variant:"outline",size:"sm",disabled:r.length<o,onClick:()=>l(t=>t+1),children:"Next"})]}):null]})}export{H as A};