@yansigit/opencodex 2.36.1-dev.20260829.32 → 2.36.1-dev.20260829.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/gui/dist/assets/{ApiKeys-nJ-qJbkG.js → ApiKeys-BthcYAks.js} +1 -1
- package/gui/dist/assets/{Claude-Br34aNO2.js → Claude-D1uQ1rsr.js} +1 -1
- package/gui/dist/assets/{CodexSet-Bo2Vel9f.js → CodexSet-BUNKAStQ.js} +1 -1
- package/gui/dist/assets/{FileIntegrationPage-8JuhUwT7.js → FileIntegrationPage-CyrJ_kz1.js} +1 -1
- package/gui/dist/assets/{Grok-pTPUqi3L.js → Grok-CeSYaWba.js} +1 -1
- package/gui/dist/assets/{Integrations-N-s59k0n.js → Integrations-BkE9NLJW.js} +2 -2
- package/gui/dist/assets/{IntegrationsOverview-C6Mkt8OU.js → IntegrationsOverview-D-nDl5t5.js} +1 -1
- package/gui/dist/assets/{Logs-BzYAbD9a.js → Logs-uExIBMZr.js} +1 -1
- package/gui/dist/assets/{Models-8o4TdPzd.js → Models-CNpjs-ld.js} +1 -1
- package/gui/dist/assets/{NumberStepper-y1MLMfxu.js → NumberStepper-CKVXkKzE.js} +1 -1
- package/gui/dist/assets/{Providers-oTh_-wqc.js → Providers-D72-5Egl.js} +1 -1
- package/gui/dist/assets/{RestoreDialog-BnPA60nS.js → RestoreDialog-2MVe4MQR.js} +1 -1
- package/gui/dist/assets/{Startup-eM7zbmU_.js → Startup-ClZlpU_Z.js} +1 -1
- package/gui/dist/assets/{Storage-Cuf1wakW.js → Storage-ChC2WGMp.js} +1 -1
- package/gui/dist/assets/{Subagents-DEnwUJJx.js → Subagents-BpkXAXLZ.js} +1 -1
- package/gui/dist/assets/{Usage-BMBOTm6l.js → Usage-BkEOitI3.js} +1 -1
- package/gui/dist/assets/{data-surface-Cq2fDI2w.js → data-surface-BzhqUIJ_.js} +1 -1
- package/gui/dist/assets/{index-CEcmjvjC.js → index-DE4QGJSt.js} +2 -2
- package/gui/dist/assets/{model-display-CTtXLqIv.js → model-display-CCqxubZd.js} +1 -1
- package/gui/dist/assets/{provider-payload-Bs3Sdqv7.js → provider-payload-CI2ayvqv.js} +1 -1
- package/gui/dist/index.html +1 -1
- package/package.json +1 -1
- package/src/adapters/command-code-project-context.ts +24 -19
- package/src/codex/catalog/sync.ts +7 -2
- package/src/generated/compatibility-version.json +11 -11
- package/src/oauth/google-antigravity.ts +18 -5
- package/src/storage/cleanup.ts +11 -0
- package/src/storage/policy-job.ts +29 -3
- package/src/storage/policy-worker.ts +8 -1
- package/src/storage/policy.ts +3 -0
- package/src/storage/restore-job.ts +5 -0
- package/src/storage/restore-worker.ts +7 -1
- package/src/storage/storage-mutation-coordinator.ts +6 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,c as t,h as n,m as r}from"./shared-p0R307IX.js";import{F as i,M as a}from"./index-
|
|
1
|
+
import{_ as e,c as t,h as n,m as r}from"./shared-p0R307IX.js";import{F as i,M as a}from"./index-DE4QGJSt.js";var o=r(),s={"not-installed":`integrations.state.notInstalled`,unknown:`integrations.state.unknown`,absent:`integrations.state.absent`,current:`integrations.state.current`,stale:`integrations.state.stale`,conflict:`integrations.state.conflict`,unsafe:`integrations.state.unsafe`},c={"not-installed":`badge badge-muted`,unknown:`badge badge-muted`,absent:`badge badge-muted`,current:`badge badge-green`,stale:`badge badge-amber`,conflict:`badge integration-badge--danger`,unsafe:`badge integration-badge--danger-outline`};function l({state:e,installed:n,id:r}){let i=t(),a=e===`unknown`||e===`not-installed`||n?e:`not-installed`;return(0,o.jsx)(`span`,{id:r,className:c[a],"data-integration-state":a,children:i(s[a])})}var u=e(n(),1),d=[`opencode`,`pi`,`omp`,`hermes`,`openclaw`,`kimi`,`gajae`,`dsh`,`mcode`,`zcode`,`prime`],f=new Set([`not_installed`,`conflict`,`unsafe`,`non_loopback`,`drift_requires_confirm`,`snapshot_expired`,`write_failed`]),p=new Set([`integration_unsafe`,`integration_conflict`,`integration_drift_confirmation_required`,`integration_snapshot_expired`,`integration_mutation_failed`]),m=new Set([`absent`,`current`,`stale`,`conflict`,`unsafe`]);function h(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function g(e){return!h(e)||!f.has(String(e.reason))?!1:typeof e.error==`string`&&p.has(String(e.code))&&d.includes(e.clientId)&&m.has(String(e.state))&&typeof e.message==`string`}var _=class extends Error{refusal;status;body;constructor(e,t){let n=g(t)?t:null;super(n?.message??t.error??t.message??String(e)),this.name=`IntegrationApiError`,this.status=e,this.body=t,this.refusal=n}};async function v(e){try{let t=await e.json();return h(t)?t:{}}catch{return{}}}async function y(e){if(!e.ok)throw new _(e.status,await v(e));let t=await a(e);if(t==null)throw new _(e.status,{});return t}async function b(e,t){return y(await fetch(`${e}/api/client-integrations`,{signal:t}))}async function x(e,t,n){return y(await fetch(`${e}/api/client-integrations/${encodeURIComponent(t)}`,{signal:n}))}async function S(e,t,n){let r=t?`?client=${encodeURIComponent(t)}`:``;return y(await fetch(`${e}/api/client-integrations/journal${r}`,{signal:n}))}async function C(e,t,n,r){return y(await fetch(`${e}/api/client-integrations/${encodeURIComponent(t)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:n}),signal:r}))}async function w(e,t,n=!1,r){return y(await fetch(`${e}/api/client-integrations/restore`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({opId:t,confirmDrift:n}),signal:r}))}async function T(e){try{let t=await e;return t.ok?await a(t)??null:null}catch{return null}}async function E(e,t){let n=await T(fetch(`${e}/api/startup-health`,{signal:t}));return n?{routingInjected:n.routingInjected===!0,status:typeof n.status==`string`?n.status:void 0,recommendedCommand:typeof n.recommendedCommand==`string`?n.recommendedCommand:null}:null}async function D(e,t){let n=await fetch(`${e}/api/keys`,{signal:t});if(!n.ok)throw Error(`/api/keys responded ${n.status}`);let r=await a(n);if(!r||!Array.isArray(r.keys))throw Error(`/api/keys returned an unexpected body`);return r.keys.length}async function O(e,t){let n=await T(fetch(`${e}/api/claude-code`,{signal:t}));return n?{enabled:n.enabled===!0,authMode:typeof n.authMode==`string`?n.authMode:void 0}:null}async function k(e,t){let n=await T(fetch(`${e}/api/claude-desktop/status`,{signal:t}));return!n||typeof n.desiredEnabled!=`boolean`||typeof n.installed!=`boolean`||typeof n.observedKind!=`string`?null:{desiredEnabled:n.desiredEnabled,installed:n.installed,observedKind:n.observedKind,applied:n.applied===!0,stale:n.stale===!0,drift:n.drift===!0,driftReason:typeof n.driftReason==`string`?n.driftReason:null,activeProfile:typeof n.activeProfile==`boolean`?n.activeProfile:null,appliedAt:typeof n.appliedAt==`string`?n.appliedAt:null}}async function A(e,t){let n=await T(fetch(`${e}/api/grok`,{signal:t}));return n?{present:n.present===!0,models:Array.isArray(n.models)?n.models:[]}:null}var j=new Set([`claude`,`grok`,`codex`,`claude-desktop`]),M=new Set([`native_integration_refused`,`native_integration_failed`]),N=new Set([`not_installed`,`orphaned_marker`,`home_mismatch`,`config_busy`,`write_failed`,`metadata_unreadable`,`cleanup_incomplete`,`desired_state_changed`]);function P(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function F(e){return P(e)?typeof e.error==`string`&&M.has(String(e.code))&&j.has(String(e.clientId))&&N.has(String(e.reason))&&typeof e.message==`string`:!1}var I=class extends Error{refusal;status;body;constructor(e,t){let n=F(t)?t:null;super(n?.message??t.error??t.message??String(e)),this.name=`NativeApiError`,this.status=e,this.body=t,this.refusal=n}};async function L(e){try{let t=await e;return t.ok?await a(t)??null:null}catch{return null}}async function R(e){try{let t=await e.json();return P(t)?t:{}}catch{return{}}}async function z(e){if(!e.ok)throw new I(e.status,await R(e));let t=await a(e);if(t==null)throw new I(e.status,{});return t}function B(e,t){return L(fetch(`${e}/api/native-integrations`,{signal:t}))}async function V(e,t,n,r){return z(await fetch(`${e}/api/native-integrations/${encodeURIComponent(t)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({enabled:n}),signal:r}))}var H={integration_mutation_busy:`integrations.error.busy`};function U(e){return e instanceof _?e.refusal:null}function W(e){return e instanceof I?e.refusal:null}function G(e){return e===`conflict`?`integrations.error.conflict`:e===`unsafe`?`integrations.error.unsafe`:e===`non_loopback`?`integrations.error.nonLoopback`:`integrations.error.generic`}var K=new Set([`non_loopback`]);function q(e,t,n){return t.reason===`orphaned_marker`?e(`integrations.native.error.orphanedMarker`,{path:n??``}):t.reason===`home_mismatch`?`${e(`integrations.native.error.homeMismatch`)} ${t.message}`:t.reason===`not_installed`?e(`integrations.native.error.notInstalled`):t.reason===`config_busy`?e(`integrations.native.error.configBusy`):t.reason===`metadata_unreadable`?e(`integrations.native.error.desktopUnsafeMetadata`,{path:n??``}):t.reason===`cleanup_incomplete`?e(`integrations.native.error.desktopCleanupIncomplete`,{paths:(t.residualPaths??[]).join(`, `)}):t.message||e(`integrations.error.generic`)}function J(e,t,n,r){let i=W(t);if(i)return q(e,i,r);let a=U(t);if(!a){let r=H[t instanceof _?String(t.body.code??``):``];return r?e(r):t instanceof Error&&t.message?t.message:n??e(`integrations.error.generic`)}let o=K.has(a.reason)?e(G(a.reason),{client:a.clientId}):a.message||e(G(a.reason));return a.snapshotPath?e(a.residual?`integrations.error.residual`:`integrations.error.recover`,{message:o,path:a.snapshotPath}):a.reason===`conflict`||a.reason===`unsafe`?`${e(G(a.reason))} ${o}`:o}function Y({apiBase:e,row:n,onClose:r,onRestored:a}){let s=t(),[c,l]=(0,u.useState)(!1),[d,f]=(0,u.useState)(!1),[p,m]=(0,u.useState)(null),h=async()=>{if(!d){f(!0),m(null);try{await w(e,n.opId,c),a(),r()}catch(e){if(U(e)?.reason===`drift_requires_confirm`){l(!0),f(!1);return}m(J(s,e)),f(!1)}}};return(0,o.jsx)(`dialog`,{className:`modal-overlay`,open:!0,style:{display:`flex`,border:`none`,margin:0,maxWidth:`none`,maxHeight:`none`,width:`100%`,height:`100%`},"aria-labelledby":`integration-restore-title`,onCancel:e=>{e.preventDefault(),r()},children:(0,o.jsxs)(`div`,{className:`modal-card integration-restore-dialog`,children:[(0,o.jsx)(`div`,{className:`modal-head`,children:(0,o.jsx)(`h3`,{id:`integration-restore-title`,children:s(c?`integrations.restore.driftTitle`:`integrations.restore.title`)})}),(0,o.jsx)(`div`,{className:`modal-desc`,children:s(c?`integrations.restore.driftBody`:`integrations.restore.body`)}),(0,o.jsx)(`p`,{className:`integration-path`,children:n.configPath}),p&&(0,o.jsx)(i,{tone:`err`,children:p}),(0,o.jsxs)(`div`,{className:`modal-actions`,children:[(0,o.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,onClick:r,disabled:d,children:s(`common.cancel`)}),(0,o.jsx)(`button`,{type:`button`,className:`btn btn-primary`,onClick:()=>void h(),disabled:d,children:s(d?`integrations.restore.pending`:c?`integrations.restore.confirmDrift`:`integrations.restore.confirm`)})]})]})})}export{V as a,O as c,A as d,S as f,l as g,C as h,B as i,k as l,b as m,J as n,d as o,x as p,I as r,D as s,Y as t,E as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,h as t,m as n,s as r}from"./shared-p0R307IX.js";import{B as i,F as a,J as o,U as s,dt as c,f as l,gt as u,h as d,p as f,ut as p}from"./index-CEcmjvjC.js";import{t as m}from"./data-surface-Cq2fDI2w.js";import{t as h}from"./data-surface-D8RXShV2.js";var g=e(t(),1);function _(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.supported==`boolean`&&typeof t.installed==`boolean`&&typeof t.running==`boolean`&&typeof t.stale==`boolean`&&typeof t.summary==`string`}var v={native:`startup.status.native`,protected:`startup.status.protected`,"at-risk":`startup.status.atRisk`},y={native:`startup.summary.native`,protected:`startup.summary.protected`,"at-risk":`startup.summary.atRisk`},b={service:`startup.protection.service`,shim:`startup.protection.shim`,none:`startup.protection.none`},x=n();function S({ok:e,yes:t,no:n}){return(0,x.jsx)(`span`,{className:`badge ${e?`badge-green`:`badge-amber`}`,children:e?t:n})}function C({failed:e,data:t}){let{t:n}=r(),i=e?`startup-hero--risk`:t.status===`protected`?`startup-hero--safe`:t.status===`at-risk`?`startup-hero--risk`:`startup-hero--native`,a=e||t.status===`at-risk`?s:o,c=t.routingKind===`opencodex-local`?`startup.routing.proxy`:t.routingKind===`custom-local`?`startup.routing.customLocal`:t.routingKind===`custom-remote`?`startup.routing.customRemote`:t.routingKind===`unknown`?`startup.routing.unknown`:`startup.routing.native`;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`section`,{className:`panel startup-hero ${i}`,"aria-live":`polite`,children:[(0,x.jsx)(`div`,{className:`startup-hero-icon`,children:(0,x.jsx)(a,{})}),(0,x.jsxs)(`div`,{className:`startup-hero-copy`,children:[(0,x.jsx)(`span`,{className:`badge ${e||t.status===`at-risk`?`badge-amber`:`badge-green`}`,children:n(e?`startup.status.atRisk`:v[t.status])}),(0,x.jsx)(`h3`,{children:n(e?`startup.error`:y[t.status])}),(0,x.jsx)(`p`,{children:e?n(`startup.staleData`):t.status===`at-risk`?n(l(t)):n(`startup.safeDetail`)})]})]}),(0,x.jsxs)(`div`,{className:`startup-state-grid`,children:[(0,x.jsxs)(`section`,{className:`stat`,children:[(0,x.jsx)(`div`,{className:`label`,children:n(`startup.routing`)}),(0,x.jsx)(`div`,{className:`value`,children:n(c)})]}),(0,x.jsxs)(`section`,{className:`stat`,children:[(0,x.jsx)(`div`,{className:`label`,children:n(`startup.restartProtection`)}),(0,x.jsx)(`div`,{className:`value`,children:n(b[t.protection])})]}),(0,x.jsxs)(`section`,{className:`stat`,children:[(0,x.jsx)(`div`,{className:`label`,children:n(`startup.preference`)}),(0,x.jsx)(`div`,{className:`value`,children:n(t.autostartEnabled?`startup.enabled`:`startup.disabled`)})]})]})]})}function w({data:e,failed:t,loading:n=!1,installBusy:i,installResult:a,onInstall:o}){let{t:s}=r(),c=e.serviceSupported&&e.serviceInstalled&&e.serviceStale&&!e.serviceConflict,l=e.shimInstalled&&!e.shimHealthy,u=i!==null||t||n;return(0,x.jsxs)(`section`,{className:`panel startup-details`,children:[(0,x.jsxs)(`div`,{className:`panel-head`,children:[(0,x.jsx)(`h3`,{className:`panel-title`,children:s(`startup.details`)}),(0,x.jsx)(`span`,{className:`muted mono`,children:e.platform})]}),(0,x.jsxs)(`div`,{className:`startup-detail-row`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`strong`,{children:s(`startup.service`)}),(0,x.jsx)(`span`,{children:s(`startup.serviceHint`)})]}),(0,x.jsxs)(`div`,{className:`startup-detail-actions`,children:[(0,x.jsx)(S,{ok:e.serviceViable,yes:s(`startup.viable`),no:s(e.serviceConflict?`startup.conflict`:e.serviceStale?`startup.stale`:e.serviceInstalled?`startup.unhealthy`:e.serviceSupported?`startup.notInstalled`:`startup.unsupported`)}),e.serviceSupported&&!e.serviceInstalled&&(0,x.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,"aria-label":`${s(`startup.service`)} - ${s(`startup.install`)}`,disabled:u,onClick:()=>o(`install-service`),children:s(i===`install-service`?`startup.installing`:`startup.install`)}),c&&(0,x.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,"aria-label":`${s(`startup.service`)} - ${s(`startup.repair`)}`,disabled:u,onClick:()=>o(`install-service`,{repair:!0}),children:s(i===`install-service`?`startup.repairing`:`startup.repair`)})]})]}),(0,x.jsxs)(`div`,{className:`startup-detail-row`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`strong`,{children:s(`startup.shim`)}),(0,x.jsx)(`span`,{children:s(`startup.shimHint`)})]}),(0,x.jsxs)(`div`,{className:`startup-detail-actions`,children:[(0,x.jsx)(S,{ok:e.shimHealthy&&e.autostartEnabled,yes:s(e.shimCoverage===`cli-only`?`startup.cliOnly`:`startup.healthy`),no:s(e.shimInstalled?e.shimHealthy&&!e.autostartEnabled?`startup.installedDisabled`:`startup.stale`:`startup.notInstalled`)}),!e.shimInstalled&&(0,x.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,"aria-label":`${s(`startup.shim`)} - ${s(`startup.install`)}`,disabled:u,onClick:()=>o(`install-shim`),children:s(i===`install-shim`?`startup.installing`:`startup.install`)}),l&&(0,x.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,"aria-label":`${s(`startup.shim`)} - ${s(`startup.repair`)}`,disabled:u,onClick:()=>o(`install-shim`,{repair:!0}),children:s(i===`install-shim`?`startup.repairing`:`startup.repair`)})]})]}),a&&(0,x.jsx)(`div`,{className:`notice ${a.kind===`success`?`notice-ok`:`notice-warn`} startup-action-notice`,role:`status`,"aria-live":`polite`,children:a.kind===`success`?a.action===`install-service`?s(a.repair?`startup.serviceRepaired`:`startup.serviceInstalled`):s(a.repair?`startup.shimRepaired`:`startup.shimInstalled`):`${s(`startup.installFailed`)} ${a.detail??``}`})]})}function T({tray:e,trayLoading:t,trayError:n,trayBusy:i,onTrayAction:a}){let{t:o}=r();return(0,x.jsxs)(`section`,{className:`panel startup-actions`,children:[(0,x.jsxs)(`div`,{className:`panel-head`,children:[(0,x.jsx)(`h3`,{className:`panel-title`,children:o(`startup.tray.title`)}),(0,x.jsx)(p,{})]}),(0,x.jsx)(`p`,{className:`muted`,children:o(`startup.tray.hint`)}),(0,x.jsxs)(`div`,{className:`startup-detail-row`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`strong`,{children:o(`startup.tray.login`)}),(0,x.jsx)(`span`,{children:o(`startup.tray.notProtection`)})]}),t||n||!e?(0,x.jsx)(`span`,{className:`badge badge-amber`,children:o(t?`startup.tray.loading`:`startup.tray.unavailable`)}):(0,x.jsx)(S,{ok:e.running&&!e.stale,yes:o(`startup.tray.running`),no:o(e.stale?`startup.tray.stale`:e.installed?`startup.tray.stopped`:`startup.tray.notInstalled`)})]}),(0,x.jsxs)(`div`,{className:`startup-tray-buttons`,children:[!t&&!n&&e&&!e.installed&&!e.stale&&(0,x.jsx)(`button`,{type:`button`,className:`btn btn-primary`,disabled:i,onClick:()=>a(`install`),children:o(`startup.tray.install`)}),!t&&!n&&e?.installed&&!e.stale&&!e.running&&(0,x.jsx)(`button`,{type:`button`,className:`btn btn-primary`,disabled:i,onClick:()=>a(`start`),children:o(`startup.tray.start`)}),!t&&!n&&e?.running&&!e.stale&&(0,x.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,disabled:i,onClick:()=>a(`stop`),children:o(`startup.tray.stop`)}),!t&&!n&&e&&(e.installed||e.stale)&&(0,x.jsx)(`button`,{type:`button`,className:`btn btn-danger`,disabled:i,onClick:()=>{window.confirm(o(`startup.tray.uninstall`))&&a(`uninstall`)},children:o(`startup.tray.uninstall`)})]}),(n||e?.stale)&&(0,x.jsx)(`div`,{className:`notice notice-warn startup-tray-error`,role:`alert`,children:o(`startup.tray.error`)})]})}function E({data:e,copied:t,onCopy:n}){let{t:i}=r(),a=e.serviceInstalled&&!e.serviceConflict?e.commands.repairService:e.commands.installService;return(0,x.jsxs)(`section`,{className:`panel startup-actions`,children:[(0,x.jsxs)(`div`,{className:`panel-head`,children:[(0,x.jsx)(`h3`,{className:`panel-title`,children:i(`startup.recovery`)}),(0,x.jsx)(u,{})]}),(0,x.jsx)(`p`,{className:`muted`,children:i(`startup.recoveryHint`)}),(0,x.jsxs)(`div`,{className:`startup-command-list`,children:[e.serviceSupported&&(0,x.jsxs)(`div`,{className:`startup-command-row`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`strong`,{children:i(`startup.command.service`)}),(0,x.jsx)(`code`,{children:a})]}),(0,x.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>n(a),children:i(t===a?`startup.copied`:`startup.copy`)})]}),(0,x.jsxs)(`div`,{className:`startup-command-row`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`strong`,{children:i(`startup.command.shim`)}),(0,x.jsx)(`code`,{children:e.commands.installShim})]}),(0,x.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>n(e.commands.installShim),children:t===e.commands.installShim?i(`startup.copied`):i(`startup.copy`)})]}),(0,x.jsxs)(`div`,{className:`startup-command-row`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`strong`,{children:i(`startup.command.native`)}),(0,x.jsx)(`code`,{children:e.commands.restoreNative})]}),(0,x.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>n(e.commands.restoreNative),children:t===e.commands.restoreNative?i(`startup.copied`):i(`startup.copy`)})]})]}),e.status===`at-risk`&&(0,x.jsxs)(`div`,{className:`notice notice-warn startup-action-notice`,role:`alert`,children:[(0,x.jsx)(p,{}),` `,i(`startup.recommended`,{cmd:e.recommendedCommand??e.commands.installService})]})]})}var D=`ocx.startup.page.v1:`;function O(e,t){let n=t===`win32`?`; `:` && `;return e.join(n)}function k(e,t,n){if(!e)return{warning:null,fix:null};let r=!!e.catalogClamp?.active,i=!!e.newerAvailable,a=(r?e.catalogClamp?.runtimeVersion:e.version)??e.version??`unknown`,o=(e.catalogClamp?.removedEfforts??[]).join(`, `),s=O([`ocx doctor --fix-codex-runtime`,`ocx sync`],n);return r?{warning:o?t(`startup.codexRuntime.clampHiddenWithEfforts`,{version:a,efforts:o}):t(`startup.codexRuntime.clampHidden`,{version:a}),fix:i?s:`ocx sync`}:i?{warning:t(`startup.codexRuntime.olderBinary`,{version:a}),fix:s}:{warning:null,fix:null}}function A({apiBase:e}){let{t}=r(),n=`${D}${e}`,o=(0,g.useMemo)(()=>f(n),[n]),s=`startup-page:${e}`,[l,u]=(0,g.useState)(null),[p,v]=(0,g.useState)(()=>o?.tray??null),[y,b]=(0,g.useState)(()=>!o?.data),[S,O]=(0,g.useState)(!1),[A,j]=(0,g.useState)(!1),[M,N]=(0,g.useState)(null),[P,F]=(0,g.useState)(null),[I,L]=(0,g.useState)(()=>o?.warning??null),[R,z]=(0,g.useState)(()=>o?.fix??null),[B,V]=(0,g.useState)(()=>!o?.data),H=(0,g.useRef)(!!o?.data),U=(0,g.useRef)(0);(0,g.useEffect)(()=>()=>{U.current+=1},[e]);let W=(0,g.useCallback)(async r=>{let i=++U.current,a=H.current;a||(b(!0),V(!0));try{let a=fetch(`${e}/api/settings`,{signal:r}).then(async e=>e.ok?await e.json():null).catch(()=>null),o=await fetch(`${e}/api/startup-health`,{signal:r});if(!o.ok)throw Error(`fetch failed`);let s=await o.json();F(e=>e?.kind===`error`&&(s.status===`native`&&e.forLocalRouting===!0||(e.action===`install-service`?s.serviceViable:s.shimInstalled&&s.shimHealthy))?null:e),H.current=!0;let c=f(n);d(n,{data:s,warning:c?.warning??null,fix:c?.fix??null,tray:c?.tray??null});let l=s.platform===`win32`?fetch(`${e}/api/windows-tray`,{signal:r}).then(async e=>{if(!e.ok)throw Error(`tray status failed`);let t=await e.json();if(!_(t))throw Error(`invalid tray status`);return{tray:t,error:!1}}).catch(()=>({tray:null,error:!0})):Promise.resolve({tray:null,error:!1});return Promise.all([a,l]).then(([e,a])=>{if(r.aborted||i!==U.current)return;let o=s.platform===`win32`?a.tray:null;if(s.platform===`win32`?(v(o),j(a.error)):(v(null),j(!1)),b(!1),V(!1),e){let r=k(e.codexRuntime,t,s.platform);L(r.warning),z(r.fix),d(n,{data:s,warning:r.warning,fix:r.fix,tray:o});return}let c=f(n);d(n,{data:s,warning:c?.warning??null,fix:c?.fix??null,tray:o})}),s}catch(e){throw r.aborted?e:(a||(v(null),j(!0),L(null),z(null)),V(!1),b(!1),e)}},[e,n,t]),G=m(s,[e],W,{isEmpty:()=>!1,initialData:o?.data??void 0}),K=G.state,q=G.refresh,J=K.data??o?.data??null,Y=K.refreshing,X=!!J?.diagnosticStale||K.showError;(0,g.useEffect)(()=>{if(!J?.diagnosticStale)return;let e=window.setTimeout(q,2e3);return()=>window.clearTimeout(e)},[J,q]);let Z=async e=>{try{await navigator.clipboard.writeText(e),u(e),window.setTimeout(()=>u(t=>t===e?null:t),1600)}catch{u(null)}},Q=async t=>{O(!0),j(!1);try{let n=await fetch(`${e}/api/windows-tray`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:t})});if(!n.ok)throw Error(`tray action failed`);let r=await n.json();if(!_(r.status))throw Error(`invalid tray action status`);v(r.status),j(!1)}catch{v(null),j(!0)}finally{O(!1)}},$=async(t,n)=>{N(t),F(null);try{let r=await fetch(`${e}/api/startup-action`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:t,repair:n?.repair===!0})});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(typeof e?.error==`string`?e.error:`installation failed`)}F({kind:`success`,action:t,repair:n?.repair===!0}),q()}catch(e){F({kind:`error`,action:t,repair:n?.repair===!0,detail:e instanceof Error?e.message:String(e),forLocalRouting:J?.localRoutingDependency===!0})}finally{N(null)}};return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`page-head`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h2`,{children:t(`startup.title`)}),(0,x.jsx)(`p`,{className:`page-sub startup-page-sub`,children:t(`startup.subtitle`)})]}),(0,x.jsxs)(`div`,{className:`startup-page-head-actions`,children:[(0,x.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>i(`dashboard`),children:t(`startup.backToDashboard`)}),(0,x.jsxs)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>q(),disabled:Y,children:[(0,x.jsx)(c,{}),` `,t(`startup.refresh`)]})]})]}),K.showSkeleton&&!J?(0,x.jsx)(h,{label:t(`startup.loading`),rows:5}):K.kind===`failed-cold`?(0,x.jsxs)(`div`,{className:`startup-page-notice`,children:[(0,x.jsx)(a,{tone:`err`,children:K.error instanceof Error?K.error.message:t(`startup.error`)}),(0,x.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>q(),children:t(`common.retry`)})]}):J?(0,x.jsxs)(x.Fragment,{children:[K.showError&&(0,x.jsx)(a,{tone:`err`,children:t(`startup.error`)}),X&&(0,x.jsx)(`div`,{className:`notice notice-warn startup-page-notice`,role:`alert`,children:t(`startup.staleData`)}),(B||I)&&(0,x.jsx)(`div`,{className:`startup-runtime-notice-slot${B&&!I?` startup-runtime-notice-slot--pending`:``}`,"aria-hidden":B&&!I?!0:void 0,children:I&&(0,x.jsxs)(`div`,{className:`notice notice-warn startup-page-notice startup-runtime-notice`,role:`status`,children:[(0,x.jsx)(`p`,{className:`startup-runtime-notice__text`,children:I}),R&&(0,x.jsxs)(`div`,{className:`startup-runtime-notice__fix`,children:[(0,x.jsx)(`code`,{children:R}),(0,x.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>void Z(R),children:t(l===R?`startup.copied`:`startup.copy`)})]})]})}),(0,x.jsx)(C,{failed:X,data:J}),(0,x.jsx)(w,{data:J,failed:X,loading:Y,installBusy:M,installResult:P,onInstall:(e,t)=>{$(e,t)}}),J.platform===`win32`&&(0,x.jsx)(T,{tray:p,trayLoading:y,trayError:A,trayBusy:S,onTrayAction:e=>{Q(e)}}),(0,x.jsx)(E,{data:J,copied:l,onCopy:e=>{Z(e)}})]}):null]})}export{A as default};
|
|
1
|
+
import{_ as e,h as t,m as n,s as r}from"./shared-p0R307IX.js";import{B as i,F as a,J as o,U as s,dt as c,f as l,gt as u,h as d,p as f,ut as p}from"./index-DE4QGJSt.js";import{t as m}from"./data-surface-BzhqUIJ_.js";import{t as h}from"./data-surface-D8RXShV2.js";var g=e(t(),1);function _(e){if(!e||typeof e!=`object`)return!1;let t=e;return typeof t.supported==`boolean`&&typeof t.installed==`boolean`&&typeof t.running==`boolean`&&typeof t.stale==`boolean`&&typeof t.summary==`string`}var v={native:`startup.status.native`,protected:`startup.status.protected`,"at-risk":`startup.status.atRisk`},y={native:`startup.summary.native`,protected:`startup.summary.protected`,"at-risk":`startup.summary.atRisk`},b={service:`startup.protection.service`,shim:`startup.protection.shim`,none:`startup.protection.none`},x=n();function S({ok:e,yes:t,no:n}){return(0,x.jsx)(`span`,{className:`badge ${e?`badge-green`:`badge-amber`}`,children:e?t:n})}function C({failed:e,data:t}){let{t:n}=r(),i=e?`startup-hero--risk`:t.status===`protected`?`startup-hero--safe`:t.status===`at-risk`?`startup-hero--risk`:`startup-hero--native`,a=e||t.status===`at-risk`?s:o,c=t.routingKind===`opencodex-local`?`startup.routing.proxy`:t.routingKind===`custom-local`?`startup.routing.customLocal`:t.routingKind===`custom-remote`?`startup.routing.customRemote`:t.routingKind===`unknown`?`startup.routing.unknown`:`startup.routing.native`;return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`section`,{className:`panel startup-hero ${i}`,"aria-live":`polite`,children:[(0,x.jsx)(`div`,{className:`startup-hero-icon`,children:(0,x.jsx)(a,{})}),(0,x.jsxs)(`div`,{className:`startup-hero-copy`,children:[(0,x.jsx)(`span`,{className:`badge ${e||t.status===`at-risk`?`badge-amber`:`badge-green`}`,children:n(e?`startup.status.atRisk`:v[t.status])}),(0,x.jsx)(`h3`,{children:n(e?`startup.error`:y[t.status])}),(0,x.jsx)(`p`,{children:e?n(`startup.staleData`):t.status===`at-risk`?n(l(t)):n(`startup.safeDetail`)})]})]}),(0,x.jsxs)(`div`,{className:`startup-state-grid`,children:[(0,x.jsxs)(`section`,{className:`stat`,children:[(0,x.jsx)(`div`,{className:`label`,children:n(`startup.routing`)}),(0,x.jsx)(`div`,{className:`value`,children:n(c)})]}),(0,x.jsxs)(`section`,{className:`stat`,children:[(0,x.jsx)(`div`,{className:`label`,children:n(`startup.restartProtection`)}),(0,x.jsx)(`div`,{className:`value`,children:n(b[t.protection])})]}),(0,x.jsxs)(`section`,{className:`stat`,children:[(0,x.jsx)(`div`,{className:`label`,children:n(`startup.preference`)}),(0,x.jsx)(`div`,{className:`value`,children:n(t.autostartEnabled?`startup.enabled`:`startup.disabled`)})]})]})]})}function w({data:e,failed:t,loading:n=!1,installBusy:i,installResult:a,onInstall:o}){let{t:s}=r(),c=e.serviceSupported&&e.serviceInstalled&&e.serviceStale&&!e.serviceConflict,l=e.shimInstalled&&!e.shimHealthy,u=i!==null||t||n;return(0,x.jsxs)(`section`,{className:`panel startup-details`,children:[(0,x.jsxs)(`div`,{className:`panel-head`,children:[(0,x.jsx)(`h3`,{className:`panel-title`,children:s(`startup.details`)}),(0,x.jsx)(`span`,{className:`muted mono`,children:e.platform})]}),(0,x.jsxs)(`div`,{className:`startup-detail-row`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`strong`,{children:s(`startup.service`)}),(0,x.jsx)(`span`,{children:s(`startup.serviceHint`)})]}),(0,x.jsxs)(`div`,{className:`startup-detail-actions`,children:[(0,x.jsx)(S,{ok:e.serviceViable,yes:s(`startup.viable`),no:s(e.serviceConflict?`startup.conflict`:e.serviceStale?`startup.stale`:e.serviceInstalled?`startup.unhealthy`:e.serviceSupported?`startup.notInstalled`:`startup.unsupported`)}),e.serviceSupported&&!e.serviceInstalled&&(0,x.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,"aria-label":`${s(`startup.service`)} - ${s(`startup.install`)}`,disabled:u,onClick:()=>o(`install-service`),children:s(i===`install-service`?`startup.installing`:`startup.install`)}),c&&(0,x.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,"aria-label":`${s(`startup.service`)} - ${s(`startup.repair`)}`,disabled:u,onClick:()=>o(`install-service`,{repair:!0}),children:s(i===`install-service`?`startup.repairing`:`startup.repair`)})]})]}),(0,x.jsxs)(`div`,{className:`startup-detail-row`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`strong`,{children:s(`startup.shim`)}),(0,x.jsx)(`span`,{children:s(`startup.shimHint`)})]}),(0,x.jsxs)(`div`,{className:`startup-detail-actions`,children:[(0,x.jsx)(S,{ok:e.shimHealthy&&e.autostartEnabled,yes:s(e.shimCoverage===`cli-only`?`startup.cliOnly`:`startup.healthy`),no:s(e.shimInstalled?e.shimHealthy&&!e.autostartEnabled?`startup.installedDisabled`:`startup.stale`:`startup.notInstalled`)}),!e.shimInstalled&&(0,x.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,"aria-label":`${s(`startup.shim`)} - ${s(`startup.install`)}`,disabled:u,onClick:()=>o(`install-shim`),children:s(i===`install-shim`?`startup.installing`:`startup.install`)}),l&&(0,x.jsx)(`button`,{type:`button`,className:`btn btn-primary btn-sm`,"aria-label":`${s(`startup.shim`)} - ${s(`startup.repair`)}`,disabled:u,onClick:()=>o(`install-shim`,{repair:!0}),children:s(i===`install-shim`?`startup.repairing`:`startup.repair`)})]})]}),a&&(0,x.jsx)(`div`,{className:`notice ${a.kind===`success`?`notice-ok`:`notice-warn`} startup-action-notice`,role:`status`,"aria-live":`polite`,children:a.kind===`success`?a.action===`install-service`?s(a.repair?`startup.serviceRepaired`:`startup.serviceInstalled`):s(a.repair?`startup.shimRepaired`:`startup.shimInstalled`):`${s(`startup.installFailed`)} ${a.detail??``}`})]})}function T({tray:e,trayLoading:t,trayError:n,trayBusy:i,onTrayAction:a}){let{t:o}=r();return(0,x.jsxs)(`section`,{className:`panel startup-actions`,children:[(0,x.jsxs)(`div`,{className:`panel-head`,children:[(0,x.jsx)(`h3`,{className:`panel-title`,children:o(`startup.tray.title`)}),(0,x.jsx)(p,{})]}),(0,x.jsx)(`p`,{className:`muted`,children:o(`startup.tray.hint`)}),(0,x.jsxs)(`div`,{className:`startup-detail-row`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`strong`,{children:o(`startup.tray.login`)}),(0,x.jsx)(`span`,{children:o(`startup.tray.notProtection`)})]}),t||n||!e?(0,x.jsx)(`span`,{className:`badge badge-amber`,children:o(t?`startup.tray.loading`:`startup.tray.unavailable`)}):(0,x.jsx)(S,{ok:e.running&&!e.stale,yes:o(`startup.tray.running`),no:o(e.stale?`startup.tray.stale`:e.installed?`startup.tray.stopped`:`startup.tray.notInstalled`)})]}),(0,x.jsxs)(`div`,{className:`startup-tray-buttons`,children:[!t&&!n&&e&&!e.installed&&!e.stale&&(0,x.jsx)(`button`,{type:`button`,className:`btn btn-primary`,disabled:i,onClick:()=>a(`install`),children:o(`startup.tray.install`)}),!t&&!n&&e?.installed&&!e.stale&&!e.running&&(0,x.jsx)(`button`,{type:`button`,className:`btn btn-primary`,disabled:i,onClick:()=>a(`start`),children:o(`startup.tray.start`)}),!t&&!n&&e?.running&&!e.stale&&(0,x.jsx)(`button`,{type:`button`,className:`btn btn-ghost`,disabled:i,onClick:()=>a(`stop`),children:o(`startup.tray.stop`)}),!t&&!n&&e&&(e.installed||e.stale)&&(0,x.jsx)(`button`,{type:`button`,className:`btn btn-danger`,disabled:i,onClick:()=>{window.confirm(o(`startup.tray.uninstall`))&&a(`uninstall`)},children:o(`startup.tray.uninstall`)})]}),(n||e?.stale)&&(0,x.jsx)(`div`,{className:`notice notice-warn startup-tray-error`,role:`alert`,children:o(`startup.tray.error`)})]})}function E({data:e,copied:t,onCopy:n}){let{t:i}=r(),a=e.serviceInstalled&&!e.serviceConflict?e.commands.repairService:e.commands.installService;return(0,x.jsxs)(`section`,{className:`panel startup-actions`,children:[(0,x.jsxs)(`div`,{className:`panel-head`,children:[(0,x.jsx)(`h3`,{className:`panel-title`,children:i(`startup.recovery`)}),(0,x.jsx)(u,{})]}),(0,x.jsx)(`p`,{className:`muted`,children:i(`startup.recoveryHint`)}),(0,x.jsxs)(`div`,{className:`startup-command-list`,children:[e.serviceSupported&&(0,x.jsxs)(`div`,{className:`startup-command-row`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`strong`,{children:i(`startup.command.service`)}),(0,x.jsx)(`code`,{children:a})]}),(0,x.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>n(a),children:i(t===a?`startup.copied`:`startup.copy`)})]}),(0,x.jsxs)(`div`,{className:`startup-command-row`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`strong`,{children:i(`startup.command.shim`)}),(0,x.jsx)(`code`,{children:e.commands.installShim})]}),(0,x.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>n(e.commands.installShim),children:t===e.commands.installShim?i(`startup.copied`):i(`startup.copy`)})]}),(0,x.jsxs)(`div`,{className:`startup-command-row`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`strong`,{children:i(`startup.command.native`)}),(0,x.jsx)(`code`,{children:e.commands.restoreNative})]}),(0,x.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>n(e.commands.restoreNative),children:t===e.commands.restoreNative?i(`startup.copied`):i(`startup.copy`)})]})]}),e.status===`at-risk`&&(0,x.jsxs)(`div`,{className:`notice notice-warn startup-action-notice`,role:`alert`,children:[(0,x.jsx)(p,{}),` `,i(`startup.recommended`,{cmd:e.recommendedCommand??e.commands.installService})]})]})}var D=`ocx.startup.page.v1:`;function O(e,t){let n=t===`win32`?`; `:` && `;return e.join(n)}function k(e,t,n){if(!e)return{warning:null,fix:null};let r=!!e.catalogClamp?.active,i=!!e.newerAvailable,a=(r?e.catalogClamp?.runtimeVersion:e.version)??e.version??`unknown`,o=(e.catalogClamp?.removedEfforts??[]).join(`, `),s=O([`ocx doctor --fix-codex-runtime`,`ocx sync`],n);return r?{warning:o?t(`startup.codexRuntime.clampHiddenWithEfforts`,{version:a,efforts:o}):t(`startup.codexRuntime.clampHidden`,{version:a}),fix:i?s:`ocx sync`}:i?{warning:t(`startup.codexRuntime.olderBinary`,{version:a}),fix:s}:{warning:null,fix:null}}function A({apiBase:e}){let{t}=r(),n=`${D}${e}`,o=(0,g.useMemo)(()=>f(n),[n]),s=`startup-page:${e}`,[l,u]=(0,g.useState)(null),[p,v]=(0,g.useState)(()=>o?.tray??null),[y,b]=(0,g.useState)(()=>!o?.data),[S,O]=(0,g.useState)(!1),[A,j]=(0,g.useState)(!1),[M,N]=(0,g.useState)(null),[P,F]=(0,g.useState)(null),[I,L]=(0,g.useState)(()=>o?.warning??null),[R,z]=(0,g.useState)(()=>o?.fix??null),[B,V]=(0,g.useState)(()=>!o?.data),H=(0,g.useRef)(!!o?.data),U=(0,g.useRef)(0);(0,g.useEffect)(()=>()=>{U.current+=1},[e]);let W=(0,g.useCallback)(async r=>{let i=++U.current,a=H.current;a||(b(!0),V(!0));try{let a=fetch(`${e}/api/settings`,{signal:r}).then(async e=>e.ok?await e.json():null).catch(()=>null),o=await fetch(`${e}/api/startup-health`,{signal:r});if(!o.ok)throw Error(`fetch failed`);let s=await o.json();F(e=>e?.kind===`error`&&(s.status===`native`&&e.forLocalRouting===!0||(e.action===`install-service`?s.serviceViable:s.shimInstalled&&s.shimHealthy))?null:e),H.current=!0;let c=f(n);d(n,{data:s,warning:c?.warning??null,fix:c?.fix??null,tray:c?.tray??null});let l=s.platform===`win32`?fetch(`${e}/api/windows-tray`,{signal:r}).then(async e=>{if(!e.ok)throw Error(`tray status failed`);let t=await e.json();if(!_(t))throw Error(`invalid tray status`);return{tray:t,error:!1}}).catch(()=>({tray:null,error:!0})):Promise.resolve({tray:null,error:!1});return Promise.all([a,l]).then(([e,a])=>{if(r.aborted||i!==U.current)return;let o=s.platform===`win32`?a.tray:null;if(s.platform===`win32`?(v(o),j(a.error)):(v(null),j(!1)),b(!1),V(!1),e){let r=k(e.codexRuntime,t,s.platform);L(r.warning),z(r.fix),d(n,{data:s,warning:r.warning,fix:r.fix,tray:o});return}let c=f(n);d(n,{data:s,warning:c?.warning??null,fix:c?.fix??null,tray:o})}),s}catch(e){throw r.aborted?e:(a||(v(null),j(!0),L(null),z(null)),V(!1),b(!1),e)}},[e,n,t]),G=m(s,[e],W,{isEmpty:()=>!1,initialData:o?.data??void 0}),K=G.state,q=G.refresh,J=K.data??o?.data??null,Y=K.refreshing,X=!!J?.diagnosticStale||K.showError;(0,g.useEffect)(()=>{if(!J?.diagnosticStale)return;let e=window.setTimeout(q,2e3);return()=>window.clearTimeout(e)},[J,q]);let Z=async e=>{try{await navigator.clipboard.writeText(e),u(e),window.setTimeout(()=>u(t=>t===e?null:t),1600)}catch{u(null)}},Q=async t=>{O(!0),j(!1);try{let n=await fetch(`${e}/api/windows-tray`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:t})});if(!n.ok)throw Error(`tray action failed`);let r=await n.json();if(!_(r.status))throw Error(`invalid tray action status`);v(r.status),j(!1)}catch{v(null),j(!0)}finally{O(!1)}},$=async(t,n)=>{N(t),F(null);try{let r=await fetch(`${e}/api/startup-action`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({action:t,repair:n?.repair===!0})});if(!r.ok){let e=await r.json().catch(()=>null);throw Error(typeof e?.error==`string`?e.error:`installation failed`)}F({kind:`success`,action:t,repair:n?.repair===!0}),q()}catch(e){F({kind:`error`,action:t,repair:n?.repair===!0,detail:e instanceof Error?e.message:String(e),forLocalRouting:J?.localRoutingDependency===!0})}finally{N(null)}};return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`page-head`,children:[(0,x.jsxs)(`div`,{children:[(0,x.jsx)(`h2`,{children:t(`startup.title`)}),(0,x.jsx)(`p`,{className:`page-sub startup-page-sub`,children:t(`startup.subtitle`)})]}),(0,x.jsxs)(`div`,{className:`startup-page-head-actions`,children:[(0,x.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>i(`dashboard`),children:t(`startup.backToDashboard`)}),(0,x.jsxs)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>q(),disabled:Y,children:[(0,x.jsx)(c,{}),` `,t(`startup.refresh`)]})]})]}),K.showSkeleton&&!J?(0,x.jsx)(h,{label:t(`startup.loading`),rows:5}):K.kind===`failed-cold`?(0,x.jsxs)(`div`,{className:`startup-page-notice`,children:[(0,x.jsx)(a,{tone:`err`,children:K.error instanceof Error?K.error.message:t(`startup.error`)}),(0,x.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>q(),children:t(`common.retry`)})]}):J?(0,x.jsxs)(x.Fragment,{children:[K.showError&&(0,x.jsx)(a,{tone:`err`,children:t(`startup.error`)}),X&&(0,x.jsx)(`div`,{className:`notice notice-warn startup-page-notice`,role:`alert`,children:t(`startup.staleData`)}),(B||I)&&(0,x.jsx)(`div`,{className:`startup-runtime-notice-slot${B&&!I?` startup-runtime-notice-slot--pending`:``}`,"aria-hidden":B&&!I?!0:void 0,children:I&&(0,x.jsxs)(`div`,{className:`notice notice-warn startup-page-notice startup-runtime-notice`,role:`status`,children:[(0,x.jsx)(`p`,{className:`startup-runtime-notice__text`,children:I}),R&&(0,x.jsxs)(`div`,{className:`startup-runtime-notice__fix`,children:[(0,x.jsx)(`code`,{children:R}),(0,x.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>void Z(R),children:t(l===R?`startup.copied`:`startup.copy`)})]})]})}),(0,x.jsx)(C,{failed:X,data:J}),(0,x.jsx)(w,{data:J,failed:X,loading:Y,installBusy:M,installResult:P,onInstall:(e,t)=>{$(e,t)}}),J.platform===`win32`&&(0,x.jsx)(T,{tray:p,trayLoading:y,trayError:A,trayBusy:S,onTrayAction:e=>{Q(e)}}),(0,x.jsx)(E,{data:J,copied:l,onCopy:e=>{Z(e)}})]}):null]})}export{A as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,c as t,h as n,m as r,s as i}from"./shared-p0R307IX.js";import{P as a,Y as o,dt as s,et as c,h as l,j as u,p as d}from"./index-CEcmjvjC.js";import{t as f}from"./data-surface-Cq2fDI2w.js";import{n as p,t as m}from"./data-surface-D8RXShV2.js";import{n as h,t as g}from"./NumberStepper-y1MLMfxu.js";var _=e(n(),1);function v(e,t){if(e<1024)return`${e} B`;let n=[`KiB`,`MiB`,`GiB`,`TiB`],r=e,i=-1;do r/=1024,i++;while(r>=1024&&i<n.length-1);return`${r.toLocaleString(t,{maximumFractionDigits:1})} ${n[i]}`}var y={en:{compact:`Compact`,compactComplete:`Compaction complete (logical / on-disk reclaimed)`,pagesUnit:`pages`,compactPartial:`Compaction partial (logical / on-disk reclaimed)`,confirmCompact:`Confirm compaction`,cancel:`Cancel`,inspectionOnly:`Inspection only`,externalSqliteHome:`External SQLite storage`,inspectionUnavailable:`Diagnostic log inspection is unavailable.`,metricsSkippedLarge:`Row metrics skipped: the database is above {threshold}, and scanning it would stall the proxy.`,protection:`Protection`,compat:`Compatibility`,quiet:`Quiet`,disable:`Disable protection`,repair:`Repair protection`,applying:`Applying protection…`,"error.generic":`Could not change Codex log protection.`,"error.codex_running":`Quit Codex before changing log protection.`,"error.process_enumeration_failed":`Could not verify that Codex is stopped. Protection was not changed.`,"error.busy":`The Codex logs database is busy. Quit Codex and try again.`,"error.unsupported_schema":`This Codex logs schema is not supported for protection.`,"error.trigger_collision":`A reserved Log Guard trigger name is already in use. Protection was not changed.`,"error.unsafe_path":`The Codex logs database path failed the safety check.`,"error.database_error":`Could not update the Codex logs database.`,"error.config_write_failed":`The database changed, but OpenCodex could not save the protection setting. Fix config storage, then run Repair.`},de:{compact:`Komprimieren`,compactComplete:`Komprimierung abgeschlossen (logisch / auf Datentraeger freigegeben)`,pagesUnit:`Seiten`,compactPartial:`Komprimierung teilweise (logisch / auf Datentraeger freigegeben)`,confirmCompact:`Komprimierung bestätigen`,cancel:`Abbrechen`,inspectionOnly:`Nur Inspektion`,externalSqliteHome:`Externer SQLite-Speicher`,inspectionUnavailable:`Die Diagnoseprotokoll-Inspektion ist nicht verfügbar.`,metricsSkippedLarge:`Zeilenmetriken übersprungen: Die Datenbank ist größer als {threshold}; ein Scan würde den Proxy blockieren.`,protection:`Schutz`,compat:`Kompatibilität`,quiet:`Leise`,disable:`Schutz deaktivieren`,repair:`Schutz reparieren`,applying:`Schutz wird angewendet…`,"error.generic":`Der Schutz der Codex-Protokolle konnte nicht geändert werden.`,"error.codex_running":`Beende Codex, bevor du den Protokollschutz änderst.`,"error.process_enumeration_failed":`Es konnte nicht sicher festgestellt werden, dass Codex beendet ist. Der Schutz wurde nicht geändert.`,"error.busy":`Die Codex-Protokolldatenbank ist belegt. Beende Codex und versuche es erneut.`,"error.unsupported_schema":`Dieses Schema der Codex-Protokolldatenbank wird für den Schutz nicht unterstützt.`,"error.trigger_collision":`Ein reservierter Log-Guard-Triggername wird bereits verwendet. Der Schutz wurde nicht geändert.`,"error.unsafe_path":`Der Pfad der Codex-Protokolldatenbank hat die Sicherheitsprüfung nicht bestanden.`,"error.database_error":`Die Codex-Protokolldatenbank konnte nicht aktualisiert werden.`,"error.config_write_failed":`Die Datenbank wurde geändert, aber OpenCodex konnte die Schutzeinstellung nicht speichern. Repariere den Konfigurationsspeicher und führe danach Reparieren aus.`},fr:{compact:`Compacter`,compactComplete:`Compactage termine (logique / recupere sur disque)`,pagesUnit:`pages`,compactPartial:`Compactage partiel (logique / recupere sur disque)`,confirmCompact:`Confirmer le compactage`,cancel:`Annuler`,inspectionOnly:`Inspection uniquement`,externalSqliteHome:`Stockage SQLite externe`,inspectionUnavailable:`L’inspection des journaux de diagnostic est indisponible.`,metricsSkippedLarge:`Métriques de lignes ignorées : la base dépasse {threshold} et son analyse bloquerait le proxy.`,protection:`Protection`,compat:`Compatibilité`,quiet:`Silencieux`,disable:`Désactiver la protection`,repair:`Réparer la protection`,applying:`Application de la protection…`,"error.generic":`Impossible de modifier la protection des journaux Codex.`,"error.codex_running":`Quittez Codex avant de modifier la protection des journaux.`,"error.process_enumeration_failed":`Impossible de vérifier que Codex est arrêté. La protection n’a pas été modifiée.`,"error.busy":`La base de données des journaux Codex est occupée. Quittez Codex et réessayez.`,"error.unsupported_schema":`Ce schéma de journaux Codex n’est pas pris en charge pour la protection.`,"error.trigger_collision":`Un nom de déclencheur Log Guard réservé est déjà utilisé. La protection n’a pas été modifiée.`,"error.unsafe_path":`Le chemin de la base de données des journaux Codex a échoué au contrôle de sécurité.`,"error.database_error":`Impossible de mettre à jour la base de données des journaux Codex.`,"error.config_write_failed":`La base de données a été modifiée, mais OpenCodex n’a pas pu enregistrer le paramètre de protection. Corrigez le stockage de configuration, puis lancez Réparer.`},ko:{compact:`압축`,compactComplete:`압축 완료 (논리 / 디스크 회수량)`,pagesUnit:`페이지`,compactPartial:`압축 부분 완료 (논리 / 디스크 회수량)`,confirmCompact:`압축 확인`,cancel:`취소`,inspectionOnly:`검사 전용`,externalSqliteHome:`외부 SQLite 저장소`,inspectionUnavailable:`진단 로그 검사를 사용할 수 없습니다.`,metricsSkippedLarge:`행 지표를 건너뛰었습니다. 데이터베이스가 {threshold}보다 커서 스캔하면 프록시가 멈춥니다.`,protection:`보호`,compat:`호환 모드`,quiet:`조용한 모드`,disable:`보호 비활성화`,repair:`보호 복구`,applying:`보호 적용 중…`,"error.generic":`Codex 로그 보호를 변경하지 못했습니다.`,"error.codex_running":`로그 보호를 변경하기 전에 Codex를 종료하세요.`,"error.process_enumeration_failed":`Codex가 종료되었는지 확인할 수 없어 보호를 변경하지 않았습니다.`,"error.busy":`Codex 로그 데이터베이스가 사용 중입니다. Codex를 종료한 뒤 다시 시도하세요.`,"error.unsupported_schema":`이 Codex 로그 스키마는 보호 기능을 지원하지 않습니다.`,"error.trigger_collision":`예약된 Log Guard 트리거 이름이 이미 사용 중입니다. 보호를 변경하지 않았습니다.`,"error.unsafe_path":`Codex 로그 데이터베이스 경로가 안전성 검사를 통과하지 못했습니다.`,"error.database_error":`Codex 로그 데이터베이스를 업데이트하지 못했습니다.`,"error.config_write_failed":`데이터베이스는 변경되었지만 OpenCodex가 보호 설정을 저장하지 못했습니다. 구성 저장소를 수정한 뒤 복구를 실행하세요.`},zh:{compact:`压缩`,compactComplete:`压缩完成(逻辑 / 磁盘回收)`,pagesUnit:`页`,compactPartial:`压缩部分完成(逻辑 / 磁盘回收)`,confirmCompact:`确认压缩`,cancel:`取消`,inspectionOnly:`仅检查`,externalSqliteHome:`外部 SQLite 存储`,inspectionUnavailable:`诊断日志检查当前不可用。`,metricsSkippedLarge:`已跳过行指标:数据库超过 {threshold},扫描会阻塞代理。`,protection:`保护`,compat:`兼容模式`,quiet:`静默模式`,disable:`禁用保护`,repair:`修复保护`,applying:`正在应用保护…`,"error.generic":`无法更改 Codex 日志保护。`,"error.codex_running":`更改 Codex 日志保护前请先退出 Codex。`,"error.process_enumeration_failed":`无法确认 Codex 已停止,因此未更改保护设置。`,"error.busy":`Codex 日志数据库正忙。请退出 Codex 后重试。`,"error.unsupported_schema":`此 Codex 日志数据库结构不支持保护功能。`,"error.trigger_collision":`保留的 Log Guard 触发器名称已被占用,因此未更改保护设置。`,"error.unsafe_path":`Codex 日志数据库路径未通过安全检查。`,"error.database_error":`无法更新 Codex 日志数据库。`,"error.config_write_failed":`数据库已更改,但 OpenCodex 无法保存保护设置。请先修复配置存储,然后运行“修复保护”。`},"zh-TW":{compact:`壓縮`,compactComplete:`压缩完成(逻辑 / 磁盘回收)`,pagesUnit:`頁`,compactPartial:`压缩部分完成(逻辑 / 磁盘回收)`,confirmCompact:`確認壓縮`,cancel:`取消`,inspectionOnly:`僅檢查`,externalSqliteHome:`外部 SQLite 儲存空間`,inspectionUnavailable:`診斷記錄檢查目前無法使用。`,metricsSkippedLarge:`已略過列指標:資料庫超過 {threshold},掃描會阻塞代理。`,protection:`保護`,compat:`相容模式`,quiet:`靜默模式`,disable:`停用保護`,repair:`修復保護`,applying:`正在套用保護…`,"error.generic":`無法變更 Codex 日誌保護。`,"error.codex_running":`變更 Codex 日誌保護前請先退出 Codex。`,"error.process_enumeration_failed":`無法確認 Codex 已停止,因此未變更保護設定。`,"error.busy":`Codex 日誌資料庫忙碌中。請退出 Codex 後重試。`,"error.unsupported_schema":`此 Codex 日誌資料庫結構不支援保護功能。`,"error.trigger_collision":`保留的 Log Guard 觸發器名稱已被使用,因此未變更保護設定。`,"error.unsafe_path":`Codex 日誌資料庫路徑未通過安全檢查。`,"error.database_error":`無法更新 Codex 日誌資料庫。`,"error.config_write_failed":`資料庫已變更,但 OpenCodex 無法儲存保護設定。請先修復設定儲存空間,再執行「修復保護」。`},ru:{compact:`Сжать`,compactComplete:`Сжатие завершено (логически / освобождено на диске)`,pagesUnit:`страниц`,compactPartial:`Сжатие частичное (логически / освобождено на диске)`,confirmCompact:`Подтвердить сжатие`,cancel:`Отмена`,inspectionOnly:`Только проверка`,externalSqliteHome:`Внешнее хранилище SQLite`,inspectionUnavailable:`Проверка диагностических журналов недоступна.`,metricsSkippedLarge:`Метрики строк пропущены: база больше {threshold}, и её сканирование заблокировало бы прокси.`,protection:`Защита`,compat:`Совместимость`,quiet:`Тихий режим`,disable:`Отключить защиту`,repair:`Восстановить защиту`,applying:`Применение защиты…`,"error.generic":`Не удалось изменить защиту журналов Codex.`,"error.codex_running":`Закройте Codex перед изменением защиты журналов.`,"error.process_enumeration_failed":`Не удалось убедиться, что Codex остановлен. Защита не изменена.`,"error.busy":`База журналов Codex занята. Закройте Codex и повторите попытку.`,"error.unsupported_schema":`Эта схема базы журналов Codex не поддерживает защиту.`,"error.trigger_collision":`Зарезервированное имя триггера Log Guard уже используется. Защита не изменена.`,"error.unsafe_path":`Путь к базе журналов Codex не прошёл проверку безопасности.`,"error.database_error":`Не удалось обновить базу журналов Codex.`,"error.config_write_failed":`База была изменена, но OpenCodex не смог сохранить настройку защиты. Исправьте хранилище конфигурации и затем запустите восстановление.`},ja:{compact:`圧縮`,compactComplete:`圧縮完了(論理 / ディスク解放)`,pagesUnit:`ページ`,compactPartial:`圧縮は部分的に完了(論理 / ディスク解放)`,confirmCompact:`圧縮を確認`,cancel:`キャンセル`,inspectionOnly:`検査のみ`,externalSqliteHome:`外部 SQLite ストレージ`,inspectionUnavailable:`診断ログの検査を利用できません。`,metricsSkippedLarge:`行メトリクスをスキップしました。データベースが {threshold} を超えており、走査するとプロキシが停止します。`,protection:`保護`,compat:`互換モード`,quiet:`静音モード`,disable:`保護を無効化`,repair:`保護を修復`,applying:`保護を適用中…`,"error.generic":`Codex ログ保護を変更できませんでした。`,"error.codex_running":`ログ保護を変更する前に Codex を終了してください。`,"error.process_enumeration_failed":`Codex が停止していることを確認できなかったため、保護は変更されませんでした。`,"error.busy":`Codex ログデータベースが使用中です。Codex を終了して再試行してください。`,"error.unsupported_schema":`この Codex ログスキーマでは保護機能を使用できません。`,"error.trigger_collision":`予約済みの Log Guard トリガー名が既に使用されています。保護は変更されませんでした。`,"error.unsafe_path":`Codex ログデータベースのパスが安全性チェックに失敗しました。`,"error.database_error":`Codex ログデータベースを更新できませんでした。`,"error.config_write_failed":`データベースは変更されましたが、OpenCodex は保護設定を保存できませんでした。設定ストレージを修正してから保護を修復してください。`},tr:{compact:`Sıkıştır`,compactComplete:`Sikistirma tamamlandi (mantiksal / diskte geri kazanilan)`,pagesUnit:`sayfa`,compactPartial:`Sikistirma kismi (mantiksal / diskte geri kazanilan)`,confirmCompact:`Sıkıştırmayı onayla`,cancel:`İptal`,inspectionOnly:`Yalnızca inceleme`,externalSqliteHome:`Harici SQLite depolaması`,inspectionUnavailable:`Tanılama günlüğü incelemesi kullanılamıyor.`,metricsSkippedLarge:`Satır ölçümleri atlandı: veritabanı {threshold} sınırının üzerinde ve taranması proxy’yi kilitler.`,protection:`Koruma`,compat:`Uyumluluk`,quiet:`Sessiz`,disable:`Korumayı devre dışı bırak`,repair:`Korumayı onar`,applying:`Koruma uygulanıyor…`,"error.generic":`Codex günlük koruması değiştirilemedi.`,"error.codex_running":`Günlük korumasını değiştirmeden önce Codex'i kapatın.`,"error.process_enumeration_failed":`Codex'in kapalı olduğu doğrulanamadı. Koruma değiştirilmedi.`,"error.busy":`Codex günlük veritabanı meşgul. Codex'i kapatıp yeniden deneyin.`,"error.unsupported_schema":`Bu Codex günlük şeması koruma için desteklenmiyor.`,"error.trigger_collision":`Ayrılmış bir Log Guard tetikleyici adı zaten kullanılıyor. Koruma değiştirilmedi.`,"error.unsafe_path":`Codex günlük veritabanı yolu güvenlik denetimini geçemedi.`,"error.database_error":`Codex günlük veritabanı güncellenemedi.`,"error.config_write_failed":`Veritabanı değişti ancak OpenCodex koruma ayarını kaydedemedi. Yapılandırma depolamasını düzeltip ardından korumayı onarın.`}};function b(e,t){return y[e][t]}var x={en:{applying:`Applying Log Guard change…`,"error.generic":`Could not update Codex log storage.`,"error.codex_running":`Quit Codex before changing Codex log storage.`,"error.process_enumeration_failed":`Could not verify that Codex is stopped. The Log Guard operation was not started.`,"error.busy":`The Codex logs database is busy. Quit Codex and try again.`,"error.unsupported_schema":`This Codex logs schema is not supported for this operation.`,"error.unsafe_path":`The Codex logs database path failed the safety check.`,"error.database_error":`Could not update the Codex logs database.`,"error.auto_vacuum_not_incremental":`This Codex logs database is not configured for incremental vacuum, so space cannot be reclaimed without a full rebuild.`,"error.integrity_check_failed":`The Codex logs database failed its integrity check. No space was reclaimed.`},de:{applying:`Log-Guard-Änderung wird angewendet…`,"error.generic":`Der Codex-Protokollspeicher konnte nicht aktualisiert werden.`,"error.codex_running":`Beende Codex, bevor du den Codex-Protokollspeicher änderst.`,"error.process_enumeration_failed":`Es konnte nicht sicher festgestellt werden, dass Codex beendet ist. Der Log-Guard-Vorgang wurde nicht gestartet.`,"error.busy":`Die Codex-Protokolldatenbank ist belegt. Beende Codex und versuche es erneut.`,"error.unsupported_schema":`Dieses Schema der Codex-Protokolldatenbank wird für diesen Vorgang nicht unterstützt.`,"error.unsafe_path":`Der Pfad der Codex-Protokolldatenbank hat die Sicherheitsprüfung nicht bestanden.`,"error.database_error":`Die Codex-Protokolldatenbank konnte nicht aktualisiert werden.`,"error.auto_vacuum_not_incremental":`Diese Codex-Protokolldatenbank ist nicht fuer inkrementelles Vacuum konfiguriert; ohne vollstaendigen Neuaufbau kann kein Speicher freigegeben werden.`,"error.integrity_check_failed":`Die Integritaetspruefung der Codex-Protokolldatenbank ist fehlgeschlagen. Es wurde kein Speicher freigegeben.`},fr:{applying:`Application de la modification Log Guard…`,"error.generic":`Impossible de mettre à jour le stockage des journaux Codex.`,"error.codex_running":`Quittez Codex avant de modifier le stockage des journaux Codex.`,"error.process_enumeration_failed":`Impossible de vérifier que Codex est arrêté. L’opération Log Guard n’a pas été lancée.`,"error.busy":`La base de données des journaux Codex est occupée. Quittez Codex et réessayez.`,"error.unsupported_schema":`Ce schéma de journaux Codex n’est pas pris en charge pour cette opération.`,"error.unsafe_path":`Le chemin de la base de données des journaux Codex a échoué au contrôle de sécurité.`,"error.database_error":`Impossible de mettre à jour la base de données des journaux Codex.`,"error.auto_vacuum_not_incremental":`Cette base de donnees de journaux Codex n'est pas configuree pour le vacuum incrementiel : l'espace ne peut pas etre recupere sans reconstruction complete.`,"error.integrity_check_failed":`La verification d'integrite de la base de donnees de journaux Codex a echoue. Aucun espace n'a ete recupere.`},ko:{applying:`Log Guard 변경 적용 중…`,"error.generic":`Codex 로그 저장소를 업데이트하지 못했습니다.`,"error.codex_running":`Codex 로그 저장소를 변경하기 전에 Codex를 종료하세요.`,"error.process_enumeration_failed":`Codex가 종료되었는지 확인할 수 없어 Log Guard 작업을 시작하지 않았습니다.`,"error.busy":`Codex 로그 데이터베이스가 사용 중입니다. Codex를 종료한 뒤 다시 시도하세요.`,"error.unsupported_schema":`이 Codex 로그 스키마는 이 작업을 지원하지 않습니다.`,"error.unsafe_path":`Codex 로그 데이터베이스 경로가 안전성 검사를 통과하지 못했습니다.`,"error.database_error":`Codex 로그 데이터베이스를 업데이트하지 못했습니다.`,"error.auto_vacuum_not_incremental":`이 Codex 로그 데이터베이스는 증분 정리로 구성되어 있지 않아, 전체 재구축 없이는 공간을 회수할 수 없습니다.`,"error.integrity_check_failed":`Codex 로그 데이터베이스 무결성 검사에 실패했습니다. 공간이 회수되지 않았습니다.`},zh:{applying:`正在应用 Log Guard 更改…`,"error.generic":`无法更新 Codex 日志存储。`,"error.codex_running":`更改 Codex 日志存储前请先退出 Codex。`,"error.process_enumeration_failed":`无法确认 Codex 已停止,因此未启动 Log Guard 操作。`,"error.busy":`Codex 日志数据库正忙。请退出 Codex 后重试。`,"error.unsupported_schema":`此 Codex 日志数据库结构不支持此操作。`,"error.unsafe_path":`Codex 日志数据库路径未通过安全检查。`,"error.database_error":`无法更新 Codex 日志数据库。`,"error.auto_vacuum_not_incremental":`此 Codex 日志数据库未配置增量清理,因此不完整重建就无法回收空间。`,"error.integrity_check_failed":`Codex 日志数据库完整性检查失败,未回收任何空间。`},"zh-TW":{applying:`正在套用 Log Guard 變更…`,"error.generic":`無法更新 Codex 日誌儲存空間。`,"error.codex_running":`變更 Codex 日誌儲存空間前請先退出 Codex。`,"error.process_enumeration_failed":`無法確認 Codex 已停止,因此未啟動 Log Guard 操作。`,"error.busy":`Codex 日誌資料庫忙碌中。請退出 Codex 後重試。`,"error.unsupported_schema":`此 Codex 日誌資料庫結構不支援此操作。`,"error.unsafe_path":`Codex 日誌資料庫路徑未通過安全檢查。`,"error.database_error":`無法更新 Codex 日誌資料庫。`,"error.auto_vacuum_not_incremental":`此 Codex 日志数据库未配置增量清理,因此不完整重建就无法回收空间。`,"error.integrity_check_failed":`Codex 日志数据库完整性检查失败,未回收任何空间。`},ru:{applying:`Применение изменения Log Guard…`,"error.generic":`Не удалось обновить хранилище журналов Codex.`,"error.codex_running":`Закройте Codex перед изменением хранилища журналов Codex.`,"error.process_enumeration_failed":`Не удалось убедиться, что Codex остановлен. Операция Log Guard не запущена.`,"error.busy":`База журналов Codex занята. Закройте Codex и повторите попытку.`,"error.unsupported_schema":`Эта схема базы журналов Codex не поддерживает эту операцию.`,"error.unsafe_path":`Путь к базе журналов Codex не прошёл проверку безопасности.`,"error.database_error":`Не удалось обновить базу журналов Codex.`,"error.auto_vacuum_not_incremental":`Эта база данных журналов Codex не настроена на инкрементальную очистку, поэтому освободить место без полной перестройки невозможно.`,"error.integrity_check_failed":`Проверка целостности базы данных журналов Codex не пройдена. Место не освобождено.`},ja:{applying:`Log Guard の変更を適用中…`,"error.generic":`Codex ログストレージを更新できませんでした。`,"error.codex_running":`Codex ログストレージを変更する前に Codex を終了してください。`,"error.process_enumeration_failed":`Codex が停止していることを確認できなかったため、Log Guard 操作を開始しませんでした。`,"error.busy":`Codex ログデータベースが使用中です。Codex を終了して再試行してください。`,"error.unsupported_schema":`この Codex ログスキーマではこの操作を使用できません。`,"error.unsafe_path":`Codex ログデータベースのパスが安全性チェックに失敗しました。`,"error.database_error":`Codex ログデータベースを更新できませんでした。`,"error.auto_vacuum_not_incremental":`この Codex ログ データベースは増分バキューム用に構成されていないため、完全な再構築なしに領域を解放できません。`,"error.integrity_check_failed":`Codex ログ データベースの整合性チェックに失敗しました。領域は解放されていません。`},tr:{applying:`Log Guard değişikliği uygulanıyor…`,"error.generic":`Codex günlük depolaması güncellenemedi.`,"error.codex_running":`Codex günlük depolamasını değiştirmeden önce Codex'i kapatın.`,"error.process_enumeration_failed":`Codex'in kapalı olduğu doğrulanamadı. Log Guard işlemi başlatılmadı.`,"error.busy":`Codex günlük veritabanı meşgul. Codex'i kapatıp yeniden deneyin.`,"error.unsupported_schema":`Bu Codex günlük şeması bu işlem için desteklenmiyor.`,"error.unsafe_path":`Codex günlük veritabanı yolu güvenlik denetimini geçemedi.`,"error.database_error":`Codex günlük veritabanı güncellenemedi.`,"error.auto_vacuum_not_incremental":`Bu Codex gunluk veritabani artimli vacuum icin yapilandirilmamis; tam yeniden olusturma olmadan alan geri kazanilamaz.`,"error.integrity_check_failed":`Codex gunluk veritabani butunluk denetiminden gecemedi. Alan geri kazanilmadi.`}};function S(e,t){return x[e][t]}var C={en:{schema:{compatible:`Compatible`,missing:`Database not found`,unreadable:`Database unavailable`,unsupported:`Unsupported`},protection:{off:`Off`,active:`Active`,drifted:`Needs repair`,unsupported:`Unsupported`,unknown:`Unknown`},mode:{off:`Off`,compat:`Compatibility`,quiet:`Quiet`,collision:`Unknown`}},de:{schema:{compatible:`Kompatibel`,missing:`Datenbank nicht gefunden`,unreadable:`Datenbank nicht lesbar`,unsupported:`Nicht unterstützt`},protection:{off:`Aus`,active:`Aktiv`,drifted:`Reparatur erforderlich`,unsupported:`Nicht unterstützt`,unknown:`Unbekannt`},mode:{off:`Aus`,compat:`Kompatibilität`,quiet:`Leise`,collision:`Unbekannt`}},fr:{schema:{compatible:`Compatible`,missing:`Base de données introuvable`,unreadable:`Base de données indisponible`,unsupported:`Non pris en charge`},protection:{off:`Désactivée`,active:`Active`,drifted:`Réparation requise`,unsupported:`Non prise en charge`,unknown:`Inconnue`},mode:{off:`Désactivé`,compat:`Compatibilité`,quiet:`Silencieux`,collision:`Inconnu`}},ko:{schema:{compatible:`호환됨`,missing:`데이터베이스 없음`,unreadable:`데이터베이스를 읽을 수 없음`,unsupported:`지원되지 않음`},protection:{off:`꺼짐`,active:`활성`,drifted:`복구 필요`,unsupported:`지원되지 않음`,unknown:`알 수 없음`},mode:{off:`꺼짐`,compat:`호환 모드`,quiet:`조용한 모드`,collision:`알 수 없음`}},zh:{schema:{compatible:`兼容`,missing:`未找到数据库`,unreadable:`无法读取数据库`,unsupported:`不受支持`},protection:{off:`关闭`,active:`已启用`,drifted:`需要修复`,unsupported:`不受支持`,unknown:`未知`},mode:{off:`关闭`,compat:`兼容模式`,quiet:`静默模式`,collision:`未知`}},"zh-TW":{schema:{compatible:`相容`,missing:`找不到資料庫`,unreadable:`無法讀取資料庫`,unsupported:`不支援`},protection:{off:`關閉`,active:`已啟用`,drifted:`需要修復`,unsupported:`不支援`,unknown:`未知`},mode:{off:`關閉`,compat:`相容模式`,quiet:`靜默模式`,collision:`未知`}},ru:{schema:{compatible:`Совместимо`,missing:`База не найдена`,unreadable:`База недоступна`,unsupported:`Не поддерживается`},protection:{off:`Выключено`,active:`Активно`,drifted:`Требуется восстановление`,unsupported:`Не поддерживается`,unknown:`Неизвестно`},mode:{off:`Выключено`,compat:`Совместимость`,quiet:`Тихий режим`,collision:`Неизвестно`}},ja:{schema:{compatible:`互換`,missing:`データベースが見つかりません`,unreadable:`データベースを読み取れません`,unsupported:`未対応`},protection:{off:`オフ`,active:`有効`,drifted:`修復が必要`,unsupported:`未対応`,unknown:`不明`},mode:{off:`オフ`,compat:`互換モード`,quiet:`静音モード`,collision:`不明`}},tr:{schema:{compatible:`Uyumlu`,missing:`Veritabanı bulunamadı`,unreadable:`Veritabanı okunamıyor`,unsupported:`Desteklenmiyor`},protection:{off:`Kapalı`,active:`Etkin`,drifted:`Onarım gerekli`,unsupported:`Desteklenmiyor`,unknown:`Bilinmiyor`},mode:{off:`Kapalı`,compat:`Uyumluluk`,quiet:`Sessiz`,collision:`Bilinmiyor`}}};function w(e,t){return C[e].schema[t]}function T(e,t){return C[e].protection[t]}function E(e,t){return C[e].mode[t]}var D=r(),O=``,k={sessions:`storage.bucket.sessions`,archived_sessions:`storage.bucket.archived_sessions`,logs_db:`storage.bucket.logs_db`,state_db:`storage.bucket.state_db`,attachments:`storage.bucket.attachments`,deletion_manifests:`storage.bucket.deletion_manifests`,other:`storage.bucket.other`};function A(e,t){let n=k[e.key];return n?t(n):e.label}function j(e,t){return e===void 0?`—`:new Date(e).toLocaleDateString(t)}function M(e,t,n){return e.rows===void 0?`—`:e.rows===null?n(`storage.rows.unknown`):e.rows.toLocaleString(t)}function N(e,t){switch(t){case`codex_running`:return S(e,`error.codex_running`);case`process_enumeration_failed`:return S(e,`error.process_enumeration_failed`);case`busy`:return S(e,`error.busy`);case`unsupported_schema`:return S(e,`error.unsupported_schema`);case`trigger_collision`:return b(e,`error.trigger_collision`);case`unsafe_path`:return S(e,`error.unsafe_path`);case`database_error`:return S(e,`error.database_error`);case`auto_vacuum_not_incremental`:return S(e,`error.auto_vacuum_not_incremental`);case`integrity_check_failed`:return S(e,`error.integrity_check_failed`);case`config_write_failed`:return b(e,`error.config_write_failed`);default:return S(e,`error.generic`)}}function P({report:e,locale:t,t:n,busy:r,error:i,compaction:a,onAction:o}){let s=e.metrics,c=e.capabilities.protection.state===`unsupported`||e.capabilities.reclaim.state===`unsupported`,l=e.protection,u=r||e.capabilities.protection.state!==`supported`,d=l!==void 0&&e.capabilities.reclaim.state===`supported`&&(s?.reclaimableBytes??0)>0,[f,p]=(0,_.useState)(!1);return(0,D.jsxs)(`div`,{className:`stw-section`,"data-testid":`codex-log-guard`,children:[(0,D.jsx)(`h3`,{className:`stw-section-title`,children:n(`storage.bucket.logs_db`)}),(0,D.jsxs)(`dl`,{className:`stw-kv`,children:[(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:n(`dash.status`)}),(0,D.jsxs)(`dd`,{className:`stw-kv-mono`,children:[(0,D.jsx)(`code`,{children:w(t,e.schema.state)}),c&&e.schema.state===`unsupported`?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,D.jsx)(`code`,{children:b(t,`inspectionOnly`)})]}):null]})]}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:n(`storage.bucket.logs_db`)}),(0,D.jsx)(`dd`,{className:`stw-kv-mono`,children:v(e.files.databaseBytes,t)})]}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:(0,D.jsx)(`code`,{children:`WAL`})}),(0,D.jsx)(`dd`,{className:`stw-kv-mono`,children:v(e.files.walBytes,t)})]}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:(0,D.jsx)(`code`,{children:`SHM`})}),(0,D.jsx)(`dd`,{className:`stw-kv-mono`,children:v(e.files.shmBytes,t)})]}),s&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:n(`storage.col.rows`)}),(0,D.jsx)(`dd`,{className:`stw-kv-mono`,children:s.totalRows.toLocaleString(t)})]}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:(0,D.jsx)(`code`,{children:`TRACE`})}),(0,D.jsxs)(`dd`,{className:`stw-kv-mono`,children:[(s.traceShare*100).toFixed(1),`%`]})]}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:(0,D.jsx)(`code`,{children:`freelist`})}),(0,D.jsx)(`dd`,{className:`stw-kv-mono`,children:v(s.reclaimableBytes,t)})]})]}),!s&&e.metricsSkipped&&(0,D.jsxs)(`div`,{className:`stw-kv-row`,"data-testid":`log-guard-metrics-skipped`,children:[(0,D.jsx)(`dt`,{children:n(`storage.col.rows`)}),(0,D.jsx)(`dd`,{className:`muted`,children:b(t,`metricsSkippedLarge`).replace(`{threshold}`,v(e.metricsSkipped.thresholdBytes,t))})]}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:(0,D.jsx)(`code`,{children:`sqlite_home`})}),(0,D.jsx)(`dd`,{className:`stw-kv-mono`,children:(0,D.jsx)(`code`,{children:e.externalSqliteHome?b(t,`externalSqliteHome`):`CODEX_HOME`})})]})]}),l&&(0,D.jsxs)(`div`,{className:`stw-section`,"data-testid":`log-guard-protection`,children:[(0,D.jsx)(`h4`,{className:`stw-section-title`,children:b(t,`protection`)}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`span`,{className:`muted`,children:(0,D.jsx)(`code`,{children:T(t,l.state)})}),(0,D.jsxs)(`span`,{className:`stw-kv-mono`,children:[(0,D.jsx)(`code`,{children:E(t,l.desiredMode)}),l.observedMode===l.desiredMode?null:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,D.jsx)(`code`,{children:E(t,l.observedMode)})]})]})]}),(0,D.jsxs)(`div`,{className:`storage-policy-actions`,children:[(0,D.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,"data-testid":`log-guard-protect-compat`,disabled:u,"aria-pressed":l.desiredMode===`compat`,onClick:()=>o({action:`protect`,mode:`compat`}),children:b(t,`compat`)}),(0,D.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,"data-testid":`log-guard-protect-quiet`,disabled:u,"aria-pressed":l.desiredMode===`quiet`,onClick:()=>o({action:`protect`,mode:`quiet`}),children:b(t,`quiet`)}),(0,D.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,"data-testid":`log-guard-unprotect`,disabled:u||l.desiredMode===`off`,onClick:()=>o({action:`unprotect`}),children:b(t,`disable`)}),l.state===`drifted`&&(0,D.jsx)(`button`,{type:`button`,className:`btn btn-sm`,"data-testid":`log-guard-repair`,disabled:u,onClick:()=>o({action:`repair`}),children:b(t,`repair`)}),r&&(0,D.jsx)(`span`,{className:`muted`,role:`status`,children:S(t,`applying`)})]}),i&&(0,D.jsx)(`p`,{className:`err`,role:`alert`,children:i})]}),d&&(0,D.jsx)(`div`,{className:`stw-section`,"data-testid":`log-guard-reclaim`,children:(0,D.jsx)(`div`,{className:`storage-policy-actions`,children:f?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`button`,{type:`button`,className:`btn btn-sm`,"data-testid":`log-guard-compact-confirm`,disabled:r,onClick:()=>{p(!1),o({action:`compact`})},children:b(t,`confirmCompact`)}),(0,D.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,disabled:r,onClick:()=>p(!1),children:b(t,`cancel`)})]}):(0,D.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,"data-testid":`log-guard-compact`,disabled:r,onClick:()=>p(!0),children:b(t,`compact`)})})}),a&&(0,D.jsx)(`div`,{className:`stw-section`,children:(0,D.jsx)(`p`,{className:`stw-kv-mono`,role:`status`,"data-testid":`log-guard-compact-result`,children:a})}),s&&s.topTargets.length>0&&(0,D.jsxs)(`div`,{className:`stw-section`,children:[(0,D.jsx)(`h4`,{className:`stw-section-title`,children:(0,D.jsx)(`code`,{children:`target`})}),s.topTargets.slice(0,5).map(e=>(0,D.jsxs)(`div`,{className:`stw-file-row`,children:[(0,D.jsx)(`span`,{className:`stw-file-path`,title:e.target,children:(0,D.jsx)(`code`,{children:e.target})}),(0,D.jsx)(`span`,{className:`stw-file-size`,children:e.rows.toLocaleString(t)})]},e.target))]}),(0,D.jsx)(`p`,{className:`stw-hint`,children:(0,D.jsxs)(`code`,{children:[`immutable=1 · snapshot=`,e.snapshot]})})]})}function F({locale:e,t}){return(0,D.jsxs)(`div`,{className:`stw-section`,"data-testid":`codex-log-guard-unavailable`,children:[(0,D.jsx)(`h3`,{className:`stw-section-title`,children:t(`storage.bucket.logs_db`)}),(0,D.jsx)(`p`,{className:`stw-hint`,children:b(e,`inspectionUnavailable`)})]})}function I({report:e,locale:n,logGuardBusy:r=!1,onLogGuardAction:i}){let a=t(),[s,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(null),[g,y]=(0,_.useState)(null),x=(0,_.useMemo)(()=>e.buckets.toSorted((e,t)=>t.bytes-e.bytes),[e.buckets]),C=x.find(e=>e.key===s)??null,w=u?.generation===e.generatedAt?u.report:e.codexLogs??null,T=m?.generation===e.generatedAt?m.message:null,E=g?.generation===e.generatedAt?g.summary:null,k=r||f,I=(0,_.useMemo)(()=>{let t=[];for(let n of e.buckets)for(let e of n.largest??[])t.push({...e,bucketKey:n.key});return t.sort((e,t)=>t.bytes-e.bytes).slice(0,10)},[e.buckets]),L=(0,_.useMemo)(()=>new Map(e.buckets.map(e=>[e.key,e])),[e.buckets]);return(0,D.jsxs)(`div`,{className:`storage-workspace-root`,children:[(0,D.jsxs)(`aside`,{className:`storage-workspace-rail`,"aria-label":a(`storage.section.buckets`),children:[(0,D.jsxs)(`div`,{className:`storage-workspace-rail-header`,children:[(0,D.jsx)(`span`,{className:`storage-workspace-rail-title`,children:a(`storage.section.buckets`)}),(0,D.jsx)(`span`,{className:`storage-workspace-rail-count`,children:x.length})]}),(0,D.jsx)(`div`,{className:`storage-workspace-rail-list`,children:x.length===0?(0,D.jsx)(`span`,{className:`storage-workspace-rail-empty`,children:a(`storage.empty`)}):x.map(e=>(0,D.jsxs)(`button`,{type:`button`,className:`storage-workspace-rail-row${s===e.key?` storage-workspace-rail-row--selected`:``}`,onClick:()=>l(t=>t===e.key?null:e.key),"aria-current":s===e.key?`true`:void 0,children:[(0,D.jsxs)(`span`,{className:`storage-workspace-rail-primary`,children:[(0,D.jsx)(`span`,{className:`storage-workspace-rail-name`,children:A(e,a)}),(0,D.jsx)(`span`,{className:`storage-workspace-rail-size`,children:v(e.bytes,n)})]}),(0,D.jsxs)(`span`,{className:`storage-workspace-rail-meta`,children:[e.fileCount.toLocaleString(n),` `,a(`storage.col.files`).toLowerCase()]})]},e.key))})]}),(0,D.jsx)(`section`,{className:`storage-workspace-main`,"aria-label":C?A(C,a):a(`storage.section.largest`),children:C?(0,D.jsxs)(`div`,{className:`stw-detail`,children:[(0,D.jsx)(`div`,{className:`stw-detail-toolbar`,children:(0,D.jsxs)(`button`,{type:`button`,className:`stw-detail-back`,onClick:()=>l(null),children:[(0,D.jsx)(o,{className:`stw-detail-back-chevron`,"aria-hidden":`true`}),a(`modal.back`)]})}),(0,D.jsxs)(`div`,{className:`stw-detail-body`,children:[(0,D.jsx)(`h2`,{className:`stw-detail-title`,children:A(C,a)}),(0,D.jsxs)(`dl`,{className:`stw-kv`,children:[(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:a(`storage.col.size`)}),(0,D.jsx)(`dd`,{className:`stw-kv-mono`,children:v(C.bytes,n)})]}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:a(`storage.col.files`)}),(0,D.jsx)(`dd`,{className:`stw-kv-mono`,children:C.fileCount.toLocaleString(n)})]}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:a(`storage.col.oldest`)}),(0,D.jsx)(`dd`,{children:j(C.oldest,n)})]}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:a(`storage.col.newest`)}),(0,D.jsx)(`dd`,{children:j(C.newest,n)})]}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:a(`storage.col.rows`)}),(0,D.jsx)(`dd`,{className:`stw-kv-mono`,children:M(C,n,a)})]})]}),(C.largest?.length??0)>0&&(0,D.jsxs)(`div`,{className:`stw-section`,children:[(0,D.jsx)(`h3`,{className:`stw-section-title`,children:a(`storage.section.largest`)}),C.largest.map(e=>(0,D.jsxs)(`div`,{className:`stw-file-row`,children:[(0,D.jsx)(`span`,{className:`stw-file-path`,title:e.path,children:e.path}),(0,D.jsx)(`span`,{className:`stw-file-size`,children:v(e.bytes,n)})]},e.path))]})]})]}):(0,D.jsxs)(`div`,{className:`stw-overview`,children:[(0,D.jsxs)(`div`,{className:`stw-summary`,children:[(0,D.jsxs)(`div`,{className:`stw-summary-card`,children:[(0,D.jsx)(`div`,{className:`stw-summary-label`,children:a(`storage.card.total`)}),(0,D.jsx)(`div`,{className:`stw-summary-value`,children:v(e.total.bytes,n)})]}),(0,D.jsxs)(`div`,{className:`stw-summary-card`,children:[(0,D.jsx)(`div`,{className:`stw-summary-label`,children:a(`storage.card.files`)}),(0,D.jsx)(`div`,{className:`stw-summary-value`,children:e.total.fileCount.toLocaleString(n)})]}),(0,D.jsxs)(`div`,{className:`stw-summary-card`,children:[(0,D.jsx)(`div`,{className:`stw-summary-label`,children:a(`storage.card.home`)}),(0,D.jsx)(`div`,{className:`stw-summary-value mono stw-home-path`,title:e.codexHome,children:e.codexHome})]})]}),w?(0,D.jsx)(P,{report:w,locale:n,t:a,busy:k,error:T,compaction:E,onAction:t=>{if(i){i(t);return}if(f)return;let r=e.generatedAt;(async()=>{p(!0),h(null),t.action===`compact`&&y(null);try{let e=t.action===`protect`?`protect`:t.action,i={method:`POST`,...t.action===`protect`?{headers:{"content-type":`application/json`},body:JSON.stringify({mode:t.mode})}:{}},a=await fetch(`${O}/api/storage/codex-logs/${e}`,i);if(!a.ok){let e=await a.json().catch(()=>({}));h({generation:r,message:N(n,e.error)});return}if(t.action===`compact`){let e=(await a.json().catch(()=>null))?.report;if(e){let t=v(e.logicalBytesReclaimed??0,n),i=v(e.physicalDatabaseBytesReclaimed??0,n),a=e.complete?b(n,`compactComplete`):b(n,`compactPartial`),o=e.pagesReclaimed??0,s=!e.complete&&e.stopReason?` (${e.stopReason})`:``;y({generation:r,summary:[`${a}${s}`,`${o.toLocaleString(n)} ${b(n,`pagesUnit`)}`,`${t} / ${i}`].join(` — `)})}try{let e=await fetch(`${O}/api/storage/codex-logs`);if(e.ok){let t=await e.json();d({generation:r,report:t})}}catch{}return}let o=await a.json();d({generation:r,report:o})}catch{h({generation:r,message:S(n,`error.generic`)})}finally{p(!1)}})()}}):e.codexLogsError===`inspect_failed`?(0,D.jsx)(F,{locale:n,t:a}):null,I.length>0?(0,D.jsxs)(`div`,{className:`stw-section`,children:[(0,D.jsx)(`h3`,{className:`stw-section-title`,children:a(`storage.section.largest`)}),I.map(e=>{let t=L.get(e.bucketKey);return(0,D.jsxs)(`div`,{className:`stw-file-row`,children:[(0,D.jsx)(`span`,{className:`stw-file-path`,title:e.path,children:e.path}),t&&(0,D.jsx)(`span`,{className:`stw-file-bucket`,children:A(t,a)}),(0,D.jsx)(`span`,{className:`stw-file-size`,children:v(e.bytes,n)})]},`${e.bucketKey}:${e.path}`)})]}):(0,D.jsxs)(`p`,{className:`stw-hint`,children:[(0,D.jsx)(c,{style:{width:14,height:14,verticalAlign:`text-bottom`,marginRight:6},"aria-hidden":`true`}),a(`storage.workspace.selectBucket`)]})]})})]})}var L=1024**3,R=[10,25,50],z=(e,t)=>{if(!(e instanceof Error))return t;let n=e.message;return n===`Failed to fetch`||n.includes(`NetworkError`)||n.includes(`network error`)||n.includes(`JSON`)||n.includes(`Unexpected end of`)?t:n||t};function B({apiBase:e,locale:t,t:n,onDone:r}){let[i,a]=(0,_.useState)(25),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!1),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(null),[y,b]=(0,_.useState)(null),x=(0,_.useRef)(null),S=(0,_.useRef)(!1),C=(0,_.useRef)(null),w=u(c,C),T=(0,_.useCallback)((e=!1)=>{l(!1),f(!1),e&&s(null)},[]);(0,_.useEffect)(()=>{S.current=p},[p]),(0,_.useEffect)(()=>{c&&x.current?.focus()},[c]);let E=(e,t,r)=>{switch(e){case`codex_busy`:return n(`storage.cleanup.err.codex_busy`);case`stale_preview`:return n(`storage.cleanup.err.stale_preview`);case`restore_pending_overlap`:return n(`storage.cleanup.err.restore_pending_overlap`);case`referenced_history`:return n(`storage.cleanup.err.referenced_history`);case`invalid_digest`:return n(`storage.cleanup.err.invalid_digest`);case`invalid_mode`:return n(`storage.cleanup.err.invalid_mode`);case`fs_failed`:return r?n(`storage.cleanup.err.fs_failed_trash`,{trashDir:r}):n(`storage.cleanup.err.fs_failed`);case`db_reconcile_failed`:return n(`storage.cleanup.err.db_reconcile_failed`);case`cleanup_failed`:return n(`storage.cleanup.err.cleanup_failed`);default:return t??n(`storage.cleanup.cleanupFailed`)}},O=e=>n(`storage.cleanup.preset`,{percent:new Intl.NumberFormat(t,{style:`percent`,maximumFractionDigits:0}).format(e/100)}),k=async()=>{m(!0),b(null),g(null);try{let t=await fetch(`${e}/api/storage/cleanup/preview`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({percent:i})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(E(e.error,n(`storage.cleanup.previewFailed`)))}let r=await t.json();s(r),l(!0)}catch(e){b(z(e,n(`storage.cleanup.previewFailed`)))}finally{m(!1)}},A=async()=>{if(o){m(!0),b(null);try{let i=await fetch(`${e}/api/storage/cleanup`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({percent:o.percent,mode:d?`permanent`:`quarantine`,digest:o.digest})});if(!i.ok){let e=await i.json().catch(()=>({}));throw e.error===`stale_preview`&&T(!0),Error(E(e.error,e.message,e.trashDir))}let a=await i.json();if(!a.ok)throw a.error===`stale_preview`&&T(!0),Error(E(a.error,a.message,a.trashDir));T(!0),g(n(d?`storage.cleanup.donePermanent`:`storage.cleanup.doneQuarantine`,{count:String(a.count),size:v(a.bytes,t)})),r()}catch(e){b(z(e,n(`storage.cleanup.cleanupFailed`)))}finally{m(!1)}}};return(0,D.jsxs)(`section`,{className:`storage-cleanup-pane`,children:[(0,D.jsx)(`p`,{className:`muted storage-manual-panel__help`,children:n(`storage.cleanup.help`)}),(0,D.jsxs)(`div`,{className:`storage-manual-panel__controls`,children:[(0,D.jsxs)(`label`,{className:`storage-manual-panel__slider`,children:[(0,D.jsx)(`span`,{className:`muted mono`,style:{minWidth:`3.5rem`,fontVariantNumeric:`tabular-nums`},children:n(`storage.cleanup.percent`,{percent:String(i)})}),(0,D.jsx)(`input`,{type:`range`,min:1,max:100,value:i,onChange:e=>a(Number(e.target.value)),disabled:p,style:{flex:1,minWidth:0},"aria-label":n(`storage.cleanup.slider`)})]}),(0,D.jsx)(`div`,{className:`storage-manual-panel__presets`,children:R.map(e=>(0,D.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm${i===e?` active`:``}`,disabled:p,onClick:()=>a(e),children:O(e)},e))}),(0,D.jsx)(`button`,{type:`button`,className:`btn btn-sm`,disabled:p,onClick:e=>{C.current=e.currentTarget,k()},children:n(`storage.cleanup.preview`)})]}),h&&(0,D.jsx)(`p`,{className:`muted storage-manual-panel__status`,children:h}),y&&!c&&(0,D.jsx)(`p`,{className:`storage-manual-panel__status`,style:{color:`var(--red)`},children:y}),c&&o&&(0,D.jsxs)(`dialog`,{ref:w,className:`modal-overlay`,"aria-labelledby":`storage-cleanup-confirm-title`,onCancel:e=>{e.preventDefault(),S.current||T()},children:[(0,D.jsx)(`button`,{type:`button`,className:`modal-backdrop-dismiss`,"aria-label":n(`common.close`),tabIndex:-1,disabled:p,onClick:()=>T()}),(0,D.jsxs)(`div`,{className:`modal-card`,onClick:e=>e.stopPropagation(),children:[(0,D.jsx)(`h3`,{id:`storage-cleanup-confirm-title`,children:n(`storage.cleanup.confirmTitle`)}),(0,D.jsx)(`p`,{children:n(`storage.cleanup.confirmBody`,{count:String(o.count),size:v(o.bytes,t),percent:String(o.percent)})}),o.candidates.length>0&&(0,D.jsxs)(`ul`,{className:`mono muted`,style:{maxHeight:160,overflow:`auto`,fontSize:`var(--text-caption)`},children:[o.candidates.slice(0,8).map(e=>(0,D.jsx)(`li`,{children:e.relPath},e.relPath)),o.count>8&&(0,D.jsx)(`li`,{children:n(`storage.cleanup.moreFiles`,{n:String(Math.max(0,o.count-8))})})]}),(0,D.jsxs)(`label`,{style:{display:`flex`,gap:8,alignItems:`center`,marginTop:12},children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:d,disabled:p,onChange:e=>f(e.target.checked)}),(0,D.jsx)(`span`,{children:n(`storage.cleanup.permanent`)})]}),(0,D.jsx)(`p`,{className:`muted`,style:{marginTop:8,fontSize:`var(--text-caption)`},children:n(d?`storage.cleanup.permanentWarn`:`storage.cleanup.quarantineNote`)}),y&&(0,D.jsx)(`p`,{style:{marginTop:12,color:`var(--red)`},children:y}),(0,D.jsxs)(`div`,{className:`dialog-actions`,style:{marginTop:16},children:[(0,D.jsx)(`button`,{ref:x,type:`button`,className:`btn btn-ghost`,disabled:p,onClick:()=>T(),children:n(`storage.cleanup.cancel`)}),(0,D.jsx)(`button`,{type:`button`,className:d?`btn btn-danger`:`btn`,disabled:p||o.count===0,onClick:()=>void A(),children:n(d?`storage.cleanup.confirmPermanent`:`storage.cleanup.confirmQuarantine`)})]})]})]})]})}function V({apiBase:e,locale:t,t:n,onDone:r,reloadToken:i,onEntriesChange:a}){let[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null),[d,h]=(0,_.useState)(null),[g,y]=(0,_.useState)(null),b=(0,_.useRef)(null),x=(0,_.useRef)(!1),S=(0,_.useRef)(null),C=u(c!==null,S);(0,_.useEffect)(()=>{x.current=o},[o]);let w=(0,_.useCallback)(()=>l(null),[]);(0,_.useEffect)(()=>{c&&b.current?.focus()},[c]);let T=(0,_.useCallback)(async t=>{let r=await fetch(`${e}/api/storage/trash`,{signal:t});if(!r.ok)throw Error(n(`storage.trash.listFailed`));let i=await r.json(),o=Array.isArray(i.entries)?i.entries:[];return a?.(o),o},[e,a,n]),E=f(`storage-trash:${e}`,[e,i],T,{isEmpty:e=>e.length===0}).state,O=E.data??[],k=(e,t)=>{switch(e){case`codex_busy`:return n(`storage.trash.err.codex_busy`);case`invalid_trash`:return n(`storage.trash.err.invalid_trash`);case`missing_trash`:return n(`storage.trash.err.missing_trash`);case`dest_exists`:return n(`storage.trash.err.dest_exists`);case`fs_failed`:return n(`storage.trash.err.fs_failed`);case`db_reconcile_failed`:return n(`storage.trash.err.db_reconcile_failed`);case`storage_mutation_busy`:return n(`storage.trash.err.storage_mutation_busy`);case`restore_failed`:return n(`storage.trash.err.restore_failed`);case`restore_worker_timeout`:return n(`storage.trash.err.restore_worker_timeout`);case`restore_worker_aborted`:return n(`storage.trash.err.restore_worker_aborted`);case`restore_worker_failed`:return t??n(`storage.trash.err.restore_worker_failed`);default:return t??n(`storage.trash.restoreFailed`)}},A=async()=>{if(c){s(!0),y(null);try{let i=await fetch(`${e}/api/storage/trash/restore`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({id:c.id})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(k(e.error,e.message))}let a=await i.json();if(!a.ok)throw Error(k(a.error,a.message));w(),h(n(`storage.trash.done`,{count:String(a.count),size:v(a.bytes,t)})),r()}catch(e){y(z(e,n(`storage.trash.restoreFailed`)))}finally{s(!1)}}},j=e=>{let n=e.quarantinedAt??Number(e.epoch.split(`-`)[0]);return!Number.isFinite(n)||n<=0?`—`:new Date(n).toLocaleString(t)},M=e=>e===`permanent`?n(`storage.trash.mode.permanent`):e===`quarantine`?n(`storage.trash.mode.quarantine`):`—`;return(0,D.jsxs)(`section`,{className:`storage-cleanup-pane storage-quarantine-pane`,children:[(0,D.jsx)(`p`,{className:`muted storage-manual-panel__help`,children:n(`storage.trash.help`)}),d&&(0,D.jsx)(`p`,{className:`muted storage-manual-panel__status`,children:d}),g&&!c&&(0,D.jsx)(`p`,{className:`storage-manual-panel__status`,style:{color:`var(--red)`},role:`alert`,children:g}),E.showError&&!c&&(0,D.jsx)(`p`,{className:`storage-manual-panel__status`,style:{color:`var(--red)`},role:`alert`,children:E.error instanceof Error?E.error.message:n(`storage.trash.listFailed`)}),E.refreshing&&!E.showSkeleton&&(0,D.jsx)(p,{live:!E.showError,children:n(`storage.trash.loading`)}),E.showSkeleton?(0,D.jsx)(m,{label:n(`storage.trash.loading`),rows:2}):O.length===0?(0,D.jsx)(`p`,{className:`muted storage-manual-panel__status`,children:n(`storage.trash.empty`)}):(0,D.jsx)(`div`,{className:`tbl-wrap storage-manual-panel__table`,children:(0,D.jsxs)(`table`,{className:`tbl`,children:[(0,D.jsx)(`thead`,{children:(0,D.jsxs)(`tr`,{children:[(0,D.jsx)(`th`,{children:n(`storage.trash.col.when`)}),(0,D.jsx)(`th`,{className:`num`,children:n(`storage.trash.col.files`)}),(0,D.jsx)(`th`,{className:`num`,children:n(`storage.trash.col.size`)}),(0,D.jsx)(`th`,{children:n(`storage.trash.col.mode`)}),(0,D.jsx)(`th`,{children:n(`storage.trash.col.id`)}),(0,D.jsx)(`th`,{})]})}),(0,D.jsx)(`tbody`,{children:O.map(e=>(0,D.jsxs)(`tr`,{children:[(0,D.jsx)(`td`,{className:`muted`,children:j(e)}),(0,D.jsx)(`td`,{className:`num`,children:e.fileCount}),(0,D.jsx)(`td`,{className:`num mono`,children:v(e.bytes,t)}),(0,D.jsx)(`td`,{className:`muted`,children:M(e.mode)}),(0,D.jsx)(`td`,{className:`mono`,style:{fontSize:`var(--text-caption)`},children:e.id}),(0,D.jsx)(`td`,{children:(0,D.jsx)(`button`,{type:`button`,className:`btn btn-sm`,disabled:o,onClick:t=>{S.current=t.currentTarget,y(null),l(e)},children:n(`storage.trash.restore`)})})]},e.id))})]})}),c&&(0,D.jsxs)(`dialog`,{ref:C,className:`modal-overlay`,"aria-labelledby":`storage-trash-confirm-title`,onCancel:e=>{e.preventDefault(),x.current||w()},children:[(0,D.jsx)(`button`,{type:`button`,className:`modal-backdrop-dismiss`,"aria-label":n(`common.close`),tabIndex:-1,disabled:o,onClick:()=>w()}),(0,D.jsxs)(`div`,{className:`modal-card`,onClick:e=>e.stopPropagation(),children:[(0,D.jsx)(`h3`,{id:`storage-trash-confirm-title`,children:n(`storage.trash.confirmTitle`)}),(0,D.jsx)(`p`,{children:n(`storage.trash.confirmBody`,{count:String(c.fileCount),size:v(c.bytes,t),id:c.id})}),g&&(0,D.jsx)(`p`,{style:{marginTop:12,color:`var(--red)`},children:g}),(0,D.jsxs)(`div`,{className:`dialog-actions`,style:{marginTop:16},children:[(0,D.jsx)(`button`,{ref:b,type:`button`,className:`btn btn-ghost`,disabled:o,onClick:()=>w(),children:n(`storage.trash.cancel`)}),(0,D.jsx)(`button`,{type:`button`,className:`btn`,disabled:o,onClick:()=>void A(),children:n(`storage.trash.confirmRestore`)})]})]})]})]})}function H(e){let{job:t,...n}=e;return n}function U(e){let t=String(Math.max(0,Math.round(e.trigger.archivedBytesOver/L*100)/100));return e.target.reduceToBytes===void 0?{policy:H(e),thresholdGb:t,targetMode:`percent`,percent:String(Math.min(100,Math.max(1,Math.floor(e.target.removeOldestPercent??25)))),reduceGb:`4`}:{policy:H(e),thresholdGb:t,targetMode:`reduce`,percent:`25`,reduceGb:String(Math.max(0,Math.round(e.target.reduceToBytes/L*100)/100))}}async function W(e){await new Promise(t=>window.setTimeout(t,e))}function G({apiBase:e,locale:t,t:n,onDone:r}){let i=`ocx.storage.cleanup-policy.v1:${e}`,a=d(i),o=(0,_.useRef)(!!a),[s,c]=(0,_.useState)(()=>a?.policy??null),[u,f]=(0,_.useState)(()=>!a),[p,m]=(0,_.useState)(!1),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(null),[C,w]=(0,_.useState)(null),[T,E]=(0,_.useState)(()=>a?.targetMode??`percent`),[O,k]=(0,_.useState)(()=>a?.percent??`25`),[A,j]=(0,_.useState)(()=>a?.reduceGb??`4`),[M,N]=(0,_.useState)(()=>a?.thresholdGb??`5`),P=(0,_.useRef)(null),F=(0,_.useRef)(!1),I=(0,_.useRef)(!1),R=(0,_.useRef)(0),z=(0,_.useCallback)(e=>{let t=U(e);c(t.policy),N(t.thresholdGb),E(t.targetMode),k(t.percent),j(t.reduceGb),o.current=!0,l(i,t),F.current=!1},[i]),B=(0,_.useCallback)(()=>{F.current=!0},[]),V=(0,_.useCallback)(e=>{I.current=e},[]),G=(0,_.useCallback)(async t=>{let r=++R.current;o.current||f(!0),w(null);try{let n=await fetch(`${e}/api/storage/cleanup-policy`,{signal:t});if(!n.ok)throw Error(`load_failed`);let i=await n.json();if(t?.aborted||r!==R.current||F.current||I.current)return;z(i)}catch{if(t?.aborted||r!==R.current)return;o.current||(c(null),w(n(`storage.policy.loadFailed`)))}finally{!t?.aborted&&r===R.current&&f(!1)}},[e,z,n]);(0,_.useEffect)(()=>{let e=new AbortController,t=window.setTimeout(()=>{G(e.signal)},0);return()=>{window.clearTimeout(t),R.current+=1,e.abort()}},[G]),(0,_.useEffect)(()=>()=>{P.current?.abort(),P.current=null},[]);let K=()=>{if(!s)return null;let e=M.trim();if(e===``)return null;let t=Number(e);if(!Number.isFinite(t)||t<0)return null;let n;if(T===`reduce`){let e=A.trim();if(e===``)return null;let t=Number(e);if(!Number.isFinite(t)||t<0)return null;n={reduceToBytes:Math.floor(t*L)}}else{let e=Number(O);if(!Number.isFinite(e)||e<1||e>100)return null;n={removeOldestPercent:Math.min(100,Math.max(1,Math.floor(e)))}}return{enabled:s.enabled,trigger:{archivedBytesOver:Math.floor(t*L)},target:n,schedule:s.schedule,mode:s.mode}},q=async t=>{let r=K();if(!r){w(n(`storage.policy.invalid`));return}let i={...r,...t};m(!0),w(null),S(null);try{let t=await fetch(`${e}/api/storage/cleanup-policy`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(i)});if(!t.ok){w(n(`storage.policy.saveFailed`));return}let r=await t.json();if(!r.policy){w(n(`storage.policy.saveFailed`));return}z(r.policy),S(n(`storage.policy.saved`))}catch{w(n(`storage.policy.saveFailed`))}finally{m(!1)}},J=async()=>{P.current?.abort();let i=new AbortController;P.current=i;let{signal:a}=i;b(!0),w(null),S(null);try{let i=K();if(!i){w(n(`storage.policy.invalid`));return}let o=await fetch(`${e}/api/storage/cleanup-policy`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(i),signal:a});if(a.aborted)return;if(!o.ok){w(n(`storage.policy.saveFailed`));return}let s=await o.json();if(a.aborted)return;if(!s.policy){w(n(`storage.policy.saveFailed`));return}z(s.policy);let c=await fetch(`${e}/api/storage/cleanup-policy/run`,{method:`POST`,signal:a});if(a.aborted)return;if(c.status===409){let e=await c.json().catch(()=>({}));if(a.aborted)return;e.policy&&z(e.policy),w(n(`storage.policy.alreadyRunning`));return}if(!c.ok){let e=await c.json().catch(()=>({}));if(a.aborted)return;if(e.policy&&z(e.policy),e.error===`already_running`){w(n(`storage.policy.alreadyRunning`));return}w(n(`storage.policy.runFailed`));return}let l=await c.json();if(a.aborted)return;if(l.policy&&z(l.policy),l.error===`already_running`){w(n(`storage.policy.alreadyRunning`));return}if(!l.started||!l.job?.startedAt){w(n(`storage.policy.runFailed`));return}let u=l.job.startedAt,d=Date.now()+12e4,f,p;for(;Date.now()<d;){if(a.aborted||(await W(250),a.aborted))return;let t=await fetch(`${e}/api/storage/cleanup-policy`,{signal:a});if(a.aborted)return;if(!t.ok)continue;let n=await t.json();if(a.aborted)return;p=H(n),z(n);let r=n.job;if(r&&r.status!==`running`){if(r.startedAt===u&&r.lastOutcome){f=r.lastOutcome;break}if(r.finishedAt&&r.finishedAt>=u&&r.lastOutcome){f=r.lastOutcome;break}}}if(a.aborted)return;if(p&&z(p),!f){w(n(`storage.policy.runFailed`));return}f.skipped===`disabled`?S(n(`storage.policy.skippedDisabled`)):f.skipped===`under_threshold`?S(n(`storage.policy.skippedUnder`)):f.skipped===`nothing_selected`?S(n(`storage.policy.skippedEmpty`)):f.deferred===`codex_busy`||f.error===`codex_busy`?w(n(`storage.cleanup.err.codex_busy`)):f.ok?(S(f.mode===`permanent`?n(`storage.policy.donePermanent`,{count:String(f.removed??0),size:v(f.freedBytes??0,t)}):n(`storage.policy.doneQuarantine`,{count:String(f.removed??0),size:v(f.freedBytes??0,t)})),r()):w(n(`storage.policy.runFailed`))}catch(e){if(a.aborted||e instanceof DOMException&&e.name===`AbortError`)return;w(n(`storage.policy.runFailed`))}finally{P.current===i&&(P.current=null),a.aborted||b(!1)}},Y=e=>e===void 0?n(`storage.policy.never`):new Date(e).toLocaleString(t);return u&&!s?(0,D.jsx)(`section`,{className:`storage-cleanup-pane`,children:(0,D.jsx)(`p`,{className:`muted storage-policy-help`,children:n(`storage.policy.loading`)})}):s?(0,D.jsxs)(`section`,{className:`storage-cleanup-pane`,children:[(0,D.jsx)(`p`,{className:`muted storage-policy-help`,children:n(`storage.policy.help`)}),(0,D.jsx)(`div`,{className:`storage-policy-enable`,children:(0,D.jsxs)(`div`,{className:`storage-policy-enable-row`,children:[(0,D.jsx)(`button`,{type:`button`,className:`toggle${s.enabled?` on`:``}`,disabled:p||y,"aria-pressed":s.enabled,"aria-label":n(`storage.policy.enabled`),title:n(`storage.policy.enabledHint`),onClick:()=>void q({enabled:!s.enabled}),children:(0,D.jsx)(`span`,{className:`toggle-knob`})}),(0,D.jsx)(`span`,{children:n(`storage.policy.enabled`)})]})}),(0,D.jsxs)(`div`,{className:`storage-policy-fields`,children:[(0,D.jsxs)(`div`,{className:`field storage-policy-trigger`,children:[(0,D.jsx)(`label`,{className:`field-label`,htmlFor:`storage-policy-threshold`,children:n(`storage.policy.trigger`)}),(0,D.jsxs)(`div`,{className:`storage-policy-trigger-row`,children:[(0,D.jsx)(`span`,{className:`storage-policy-trigger-hint`,children:n(`storage.policy.threshold`)}),(0,D.jsxs)(`span`,{className:`codex-auto-switch-input-wrap`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(V(!1),q())},children:[(0,D.jsx)(`input`,{id:`storage-policy-threshold`,className:`input mono codex-auto-switch-input`,type:`number`,min:0,step:.1,inputMode:`decimal`,value:M,disabled:p||y,"aria-label":n(`storage.policy.threshold`),onFocus:()=>V(!0),onChange:e=>{B(),N(e.target.value)},onKeyDown:e=>{e.nativeEvent.isComposing||p||y||e.key===`Enter`&&(e.preventDefault(),q())}}),(0,D.jsx)(`span`,{className:`codex-auto-switch-unit`,"aria-hidden":`true`,children:`GiB`}),(0,D.jsx)(g,{disabled:p||y,incrementLabel:n(`storage.policy.thresholdInc`),decrementLabel:n(`storage.policy.thresholdDec`),onIncrement:()=>{B(),N(h(M,.1,0,1e4,.1))},onDecrement:()=>{B(),N(h(M,-.1,0,1e4,.1))}})]})]})]}),(0,D.jsxs)(`fieldset`,{className:`field storage-policy-target`,children:[(0,D.jsx)(`legend`,{className:`field-label`,children:n(`storage.policy.target`)}),(0,D.jsxs)(`label`,{className:`storage-policy-target-row`,children:[(0,D.jsx)(`input`,{type:`radio`,name:`storage-policy-target`,checked:T===`percent`,disabled:p||y,onChange:()=>{B(),E(`percent`)}}),(0,D.jsx)(`span`,{className:`storage-policy-target-label`,children:n(`storage.policy.targetPercent`)}),T===`percent`&&(0,D.jsxs)(`span`,{className:`codex-auto-switch-input-wrap`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(V(!1),q())},children:[(0,D.jsx)(`input`,{id:`storage-policy-percent`,className:`input mono codex-auto-switch-input`,type:`number`,min:1,max:100,step:1,inputMode:`numeric`,value:O,disabled:p||y,"aria-label":n(`storage.policy.targetPercent`),onFocus:()=>V(!0),onChange:e=>{B(),k(e.target.value)},onKeyDown:e=>{e.nativeEvent.isComposing||p||y||e.key===`Enter`&&(e.preventDefault(),q())}}),(0,D.jsx)(`span`,{className:`codex-auto-switch-unit`,"aria-hidden":`true`,children:`%`}),(0,D.jsx)(g,{disabled:p||y,incrementLabel:n(`storage.policy.percentInc`),decrementLabel:n(`storage.policy.percentDec`),onIncrement:()=>{B(),k(h(O,1,1,100))},onDecrement:()=>{B(),k(h(O,-1,1,100))}})]})]}),(0,D.jsxs)(`label`,{className:`storage-policy-target-row`,children:[(0,D.jsx)(`input`,{type:`radio`,name:`storage-policy-target`,checked:T===`reduce`,disabled:p||y,onChange:()=>{B(),E(`reduce`)}}),(0,D.jsx)(`span`,{className:`storage-policy-target-label`,children:n(`storage.policy.targetReduce`)}),T===`reduce`&&(0,D.jsxs)(`span`,{className:`codex-auto-switch-input-wrap`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(V(!1),q())},children:[(0,D.jsx)(`input`,{id:`storage-policy-reduce`,className:`input mono codex-auto-switch-input`,type:`number`,min:0,step:.1,inputMode:`decimal`,value:A,disabled:p||y,"aria-label":n(`storage.policy.targetReduce`),onFocus:()=>V(!0),onChange:e=>{B(),j(e.target.value)},onKeyDown:e=>{e.nativeEvent.isComposing||p||y||e.key===`Enter`&&(e.preventDefault(),q())}}),(0,D.jsx)(`span`,{className:`codex-auto-switch-unit`,"aria-hidden":`true`,children:`GiB`}),(0,D.jsx)(g,{disabled:p||y,incrementLabel:n(`storage.policy.reduceInc`),decrementLabel:n(`storage.policy.reduceDec`),onIncrement:()=>{B(),j(h(A,.1,0,1e4,.1))},onDecrement:()=>{B(),j(h(A,-.1,0,1e4,.1))}})]})]})]}),(0,D.jsxs)(`div`,{className:`storage-policy-selects`,children:[(0,D.jsxs)(`label`,{className:`field`,htmlFor:`storage-policy-schedule`,children:[(0,D.jsx)(`span`,{className:`field-label`,children:n(`storage.policy.schedule`)}),(0,D.jsxs)(`select`,{id:`storage-policy-schedule`,className:`input`,value:s.schedule,disabled:p||y,onChange:e=>{let t=e.target.value;q({schedule:t})},children:[(0,D.jsx)(`option`,{value:`manual`,children:n(`storage.policy.schedule.manual`)}),(0,D.jsx)(`option`,{value:`startup`,children:n(`storage.policy.schedule.startup`)}),(0,D.jsx)(`option`,{value:`daily`,children:n(`storage.policy.schedule.daily`)}),(0,D.jsx)(`option`,{value:`weekly`,children:n(`storage.policy.schedule.weekly`)})]})]}),(0,D.jsxs)(`label`,{className:`field`,htmlFor:`storage-policy-mode`,children:[(0,D.jsx)(`span`,{className:`field-label`,children:n(`storage.policy.mode`)}),(0,D.jsxs)(`select`,{id:`storage-policy-mode`,className:`input`,value:s.mode,disabled:p||y,onChange:e=>{let t=e.target.value;q({mode:t})},children:[(0,D.jsx)(`option`,{value:`quarantine`,children:n(`storage.policy.mode.quarantine`)}),(0,D.jsx)(`option`,{value:`permanent`,children:n(`storage.policy.mode.permanent`)})]})]})]}),s.mode===`permanent`&&(0,D.jsx)(`p`,{className:`err storage-policy-warn`,role:`status`,children:n(`storage.policy.permanentWarn`)})]}),(0,D.jsxs)(`div`,{className:`storage-policy-meta`,children:[(0,D.jsxs)(`div`,{className:`storage-policy-meta-item`,children:[(0,D.jsx)(`span`,{className:`muted`,children:n(`storage.policy.lastRun`)}),(0,D.jsxs)(`span`,{className:`storage-policy-meta-value`,children:[Y(s.lastRun?.at),s.lastRun?` · ${n(`storage.policy.lastRunDetail`,{count:String(s.lastRun.removed),size:v(s.lastRun.freedBytes,t)})}`:``]})]}),(0,D.jsxs)(`div`,{className:`storage-policy-meta-item`,children:[(0,D.jsx)(`span`,{className:`muted`,children:n(`storage.policy.nextRun`)}),(0,D.jsx)(`span`,{className:`storage-policy-meta-value`,children:Y(s.nextRun)})]})]}),(0,D.jsxs)(`div`,{className:`storage-policy-actions`,children:[(0,D.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,disabled:p||y,onClick:()=>void q(),children:n(`storage.policy.save`)}),(0,D.jsx)(`button`,{type:`button`,className:`btn btn-sm`,disabled:p||y,onClick:()=>void J(),children:n(y?`storage.policy.running`:`storage.policy.runNow`)}),(0,D.jsx)(`span`,{className:`storage-policy-actions__status${C?` is-error`:``}`,role:C?`alert`:`status`,"aria-live":`polite`,children:C??x??``})]})]}):(0,D.jsx)(`section`,{className:`storage-cleanup-pane`,children:C&&(0,D.jsx)(`p`,{className:`err`,role:`alert`,children:C})})}function K({apiBase:e,locale:t,t:n,archivedCount:r,showQuarantine:i,trashReloadToken:a,onDone:o,onTrashEntriesChange:s}){let[c,l]=(0,_.useState)(`policy`),u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=[{id:`policy`,label:n(`storage.cleanupCard.tab.policy`),ref:u},{id:`quarantine`,label:n(`storage.cleanupCard.tab.quarantine`),ref:d}],p=e=>{l(e),window.requestAnimationFrame(()=>(e===`policy`?u:d).current?.focus())},m=e=>{e.key===`ArrowLeft`||e.key===`ArrowRight`?(e.preventDefault(),p(c===`policy`?`quarantine`:`policy`)):e.key===`Home`?(e.preventDefault(),p(`policy`)):e.key===`End`&&(e.preventDefault(),p(`quarantine`))};return(0,D.jsxs)(`section`,{className:`panel storage-cleanup-card`,"aria-labelledby":`storage-cleanup-card-title`,children:[(0,D.jsx)(`div`,{className:`page-tabs storage-cleanup-card__tabs`,role:`tablist`,"aria-label":n(`storage.cleanupCard.tabs`),children:f.map(({id:e,label:t,ref:n})=>(0,D.jsx)(`button`,{type:`button`,role:`tab`,ref:n,id:`storage-cleanup-tab-${e}`,"aria-selected":c===e,"aria-controls":`storage-cleanup-panel-${e}`,tabIndex:c===e?0:-1,className:`page-tab${c===e?` page-tab--active`:``}`,onKeyDown:m,onClick:()=>p(e),children:t},e))}),(0,D.jsx)(`h3`,{id:`storage-cleanup-card-title`,className:`panel-title`,children:n(`storage.cleanupCard.title`)}),(0,D.jsxs)(`div`,{className:`storage-cleanup-card__stack`,children:[(0,D.jsxs)(`div`,{id:`storage-cleanup-panel-policy`,role:`tabpanel`,"aria-labelledby":`storage-cleanup-tab-policy`,className:`storage-cleanup-card__body storage-cleanup-policy-split`,"data-active":c===`policy`?`true`:`false`,"aria-hidden":c!==`policy`,...c===`policy`?{}:{inert:!0},children:[(0,D.jsx)(G,{apiBase:e,locale:t,t:n,onDone:o}),(0,D.jsxs)(`aside`,{className:`storage-cleanup-manual`,"aria-labelledby":`storage-cleanup-manual-title`,children:[(0,D.jsx)(`h4`,{id:`storage-cleanup-manual-title`,className:`storage-cleanup-manual__title`,children:n(`storage.cleanup.title`)}),r>0?(0,D.jsx)(B,{apiBase:e,locale:t,t:n,onDone:o}):(0,D.jsx)(`p`,{className:`muted storage-manual-panel__status`,children:n(`storage.cleanup.noArchives`)})]})]}),(0,D.jsx)(`div`,{id:`storage-cleanup-panel-quarantine`,role:`tabpanel`,"aria-labelledby":`storage-cleanup-tab-quarantine`,className:`storage-cleanup-card__body`,"data-active":c===`quarantine`?`true`:`false`,"aria-hidden":c!==`quarantine`,...c===`quarantine`?{}:{inert:!0},children:i?(0,D.jsx)(V,{apiBase:e,locale:t,t:n,onDone:o,reloadToken:a,onEntriesChange:s}):(0,D.jsx)(`p`,{className:`muted storage-manual-panel__status`,children:n(`storage.trash.empty`)})})]})]})}function q({apiBase:e}){let{t,locale:n}=i(),r=`ocx.storage.report.v1:${e}`,o=d(r),[c,u]=(0,_.useState)(null),[h,g]=(0,_.useState)(0),v=(0,_.useRef)(!1),[y,b]=(0,_.useState)({apiBase:e,settled:!1,hasEntries:!1}),x=(0,_.useCallback)(async n=>{try{let i=await fetch(`${e}/api/storage`,{signal:n});if(!i.ok)throw Error(t(`storage.error`));let a=await i.json();return l(r,a),v.current&&(v.current=!1,u(t(`storage.rescanned`))),a}catch(e){throw v.current&&(v.current=!1,u(t(`storage.error`))),n.aborted?e:Error(t(`storage.error`),{cause:e})}},[e,r,t]),S=f(`storage-report:${e}`,[e],x,{isEmpty:e=>e.total.fileCount===0&&e.error===void 0}),C=S.state,w=C.data??o,T=C.refreshing||C.showSkeleton&&!w,E=S.refresh,O=(0,_.useCallback)(()=>{u(null),v.current=!0,E(),g(e=>e+1)},[E]),k=(0,_.useCallback)(t=>{b({apiBase:e,settled:!0,hasEntries:t.length>0})},[e]),A=y.apiBase===e&&y.settled,j=y.apiBase===e&&y.hasEntries,M=w?.error!==void 0,N=!T&&!C.showError&&!M&&w.total.fileCount===0&&A&&!j,P=w?.buckets.find(e=>e.key===`archived_sessions`)?.fileCount??0,F=!!w&&!M,L=F&&(w.total.fileCount>0||!A||j);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`page-head`,children:[(0,D.jsx)(`h2`,{id:`storage-page-title`,children:t(`storage.title`)}),(0,D.jsxs)(`div`,{className:`storage-page-head-actions`,children:[(0,D.jsx)(`span`,{className:`storage-page-head-feedback`,role:`status`,"aria-live":`polite`,children:c??``}),(0,D.jsxs)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,disabled:T,onClick:()=>void O(),children:[(0,D.jsx)(s,{}),` `,t(`storage.refresh`)]})]})]}),(0,D.jsx)(`p`,{className:`page-sub`,children:t(`storage.subtitle`)}),w&&w.error===void 0&&(0,D.jsxs)(`p`,{className:`storage-page-meta`,children:[(0,D.jsx)(`code`,{className:`mono storage-page-meta__home`,title:w.codexHome,children:w.codexHome}),(0,D.jsx)(`span`,{className:`storage-page-meta__sep`,"aria-hidden":`true`,children:`·`}),(0,D.jsxs)(`span`,{children:[t(`storage.snapshot.lastScan`),`:`,` `,new Date(w.generatedAt).toLocaleString(n)]})]}),C.showSkeleton&&!w?(0,D.jsx)(m,{label:t(`storage.loading`),rows:5}):C.kind===`failed-cold`&&!w?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`div`,{className:`alert alert-err`,role:`alert`,children:C.error instanceof Error?C.error.message:t(`storage.error`)}),(0,D.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>E(),children:t(`common.retry`)})]}):M?(0,D.jsx)(D.Fragment,{children:(0,D.jsx)(`div`,{className:`alert alert-err`,role:`alert`,children:t(`storage.error`)})}):(0,D.jsxs)(D.Fragment,{children:[C.showError&&(0,D.jsx)(`div`,{className:`alert alert-err`,role:`alert`,children:t(`storage.error`)}),N?(0,D.jsx)(a,{title:t(`storage.empty`)}):w&&w.total.fileCount>0&&(0,D.jsx)(I,{report:w,locale:n})]}),w&&w.error===void 0&&C.refreshing&&!C.showSkeleton&&(0,D.jsx)(p,{live:!C.showError,children:t(`storage.loading`)}),F&&(0,D.jsx)(K,{apiBase:e,locale:n,t,archivedCount:P,showQuarantine:L,trashReloadToken:h,onDone:()=>void O(),onTrashEntriesChange:k})]})}export{q as default};
|
|
1
|
+
import{_ as e,c as t,h as n,m as r,s as i}from"./shared-p0R307IX.js";import{P as a,Y as o,dt as s,et as c,h as l,j as u,p as d}from"./index-DE4QGJSt.js";import{t as f}from"./data-surface-BzhqUIJ_.js";import{n as p,t as m}from"./data-surface-D8RXShV2.js";import{n as h,t as g}from"./NumberStepper-CKVXkKzE.js";var _=e(n(),1);function v(e,t){if(e<1024)return`${e} B`;let n=[`KiB`,`MiB`,`GiB`,`TiB`],r=e,i=-1;do r/=1024,i++;while(r>=1024&&i<n.length-1);return`${r.toLocaleString(t,{maximumFractionDigits:1})} ${n[i]}`}var y={en:{compact:`Compact`,compactComplete:`Compaction complete (logical / on-disk reclaimed)`,pagesUnit:`pages`,compactPartial:`Compaction partial (logical / on-disk reclaimed)`,confirmCompact:`Confirm compaction`,cancel:`Cancel`,inspectionOnly:`Inspection only`,externalSqliteHome:`External SQLite storage`,inspectionUnavailable:`Diagnostic log inspection is unavailable.`,metricsSkippedLarge:`Row metrics skipped: the database is above {threshold}, and scanning it would stall the proxy.`,protection:`Protection`,compat:`Compatibility`,quiet:`Quiet`,disable:`Disable protection`,repair:`Repair protection`,applying:`Applying protection…`,"error.generic":`Could not change Codex log protection.`,"error.codex_running":`Quit Codex before changing log protection.`,"error.process_enumeration_failed":`Could not verify that Codex is stopped. Protection was not changed.`,"error.busy":`The Codex logs database is busy. Quit Codex and try again.`,"error.unsupported_schema":`This Codex logs schema is not supported for protection.`,"error.trigger_collision":`A reserved Log Guard trigger name is already in use. Protection was not changed.`,"error.unsafe_path":`The Codex logs database path failed the safety check.`,"error.database_error":`Could not update the Codex logs database.`,"error.config_write_failed":`The database changed, but OpenCodex could not save the protection setting. Fix config storage, then run Repair.`},de:{compact:`Komprimieren`,compactComplete:`Komprimierung abgeschlossen (logisch / auf Datentraeger freigegeben)`,pagesUnit:`Seiten`,compactPartial:`Komprimierung teilweise (logisch / auf Datentraeger freigegeben)`,confirmCompact:`Komprimierung bestätigen`,cancel:`Abbrechen`,inspectionOnly:`Nur Inspektion`,externalSqliteHome:`Externer SQLite-Speicher`,inspectionUnavailable:`Die Diagnoseprotokoll-Inspektion ist nicht verfügbar.`,metricsSkippedLarge:`Zeilenmetriken übersprungen: Die Datenbank ist größer als {threshold}; ein Scan würde den Proxy blockieren.`,protection:`Schutz`,compat:`Kompatibilität`,quiet:`Leise`,disable:`Schutz deaktivieren`,repair:`Schutz reparieren`,applying:`Schutz wird angewendet…`,"error.generic":`Der Schutz der Codex-Protokolle konnte nicht geändert werden.`,"error.codex_running":`Beende Codex, bevor du den Protokollschutz änderst.`,"error.process_enumeration_failed":`Es konnte nicht sicher festgestellt werden, dass Codex beendet ist. Der Schutz wurde nicht geändert.`,"error.busy":`Die Codex-Protokolldatenbank ist belegt. Beende Codex und versuche es erneut.`,"error.unsupported_schema":`Dieses Schema der Codex-Protokolldatenbank wird für den Schutz nicht unterstützt.`,"error.trigger_collision":`Ein reservierter Log-Guard-Triggername wird bereits verwendet. Der Schutz wurde nicht geändert.`,"error.unsafe_path":`Der Pfad der Codex-Protokolldatenbank hat die Sicherheitsprüfung nicht bestanden.`,"error.database_error":`Die Codex-Protokolldatenbank konnte nicht aktualisiert werden.`,"error.config_write_failed":`Die Datenbank wurde geändert, aber OpenCodex konnte die Schutzeinstellung nicht speichern. Repariere den Konfigurationsspeicher und führe danach Reparieren aus.`},fr:{compact:`Compacter`,compactComplete:`Compactage termine (logique / recupere sur disque)`,pagesUnit:`pages`,compactPartial:`Compactage partiel (logique / recupere sur disque)`,confirmCompact:`Confirmer le compactage`,cancel:`Annuler`,inspectionOnly:`Inspection uniquement`,externalSqliteHome:`Stockage SQLite externe`,inspectionUnavailable:`L’inspection des journaux de diagnostic est indisponible.`,metricsSkippedLarge:`Métriques de lignes ignorées : la base dépasse {threshold} et son analyse bloquerait le proxy.`,protection:`Protection`,compat:`Compatibilité`,quiet:`Silencieux`,disable:`Désactiver la protection`,repair:`Réparer la protection`,applying:`Application de la protection…`,"error.generic":`Impossible de modifier la protection des journaux Codex.`,"error.codex_running":`Quittez Codex avant de modifier la protection des journaux.`,"error.process_enumeration_failed":`Impossible de vérifier que Codex est arrêté. La protection n’a pas été modifiée.`,"error.busy":`La base de données des journaux Codex est occupée. Quittez Codex et réessayez.`,"error.unsupported_schema":`Ce schéma de journaux Codex n’est pas pris en charge pour la protection.`,"error.trigger_collision":`Un nom de déclencheur Log Guard réservé est déjà utilisé. La protection n’a pas été modifiée.`,"error.unsafe_path":`Le chemin de la base de données des journaux Codex a échoué au contrôle de sécurité.`,"error.database_error":`Impossible de mettre à jour la base de données des journaux Codex.`,"error.config_write_failed":`La base de données a été modifiée, mais OpenCodex n’a pas pu enregistrer le paramètre de protection. Corrigez le stockage de configuration, puis lancez Réparer.`},ko:{compact:`압축`,compactComplete:`압축 완료 (논리 / 디스크 회수량)`,pagesUnit:`페이지`,compactPartial:`압축 부분 완료 (논리 / 디스크 회수량)`,confirmCompact:`압축 확인`,cancel:`취소`,inspectionOnly:`검사 전용`,externalSqliteHome:`외부 SQLite 저장소`,inspectionUnavailable:`진단 로그 검사를 사용할 수 없습니다.`,metricsSkippedLarge:`행 지표를 건너뛰었습니다. 데이터베이스가 {threshold}보다 커서 스캔하면 프록시가 멈춥니다.`,protection:`보호`,compat:`호환 모드`,quiet:`조용한 모드`,disable:`보호 비활성화`,repair:`보호 복구`,applying:`보호 적용 중…`,"error.generic":`Codex 로그 보호를 변경하지 못했습니다.`,"error.codex_running":`로그 보호를 변경하기 전에 Codex를 종료하세요.`,"error.process_enumeration_failed":`Codex가 종료되었는지 확인할 수 없어 보호를 변경하지 않았습니다.`,"error.busy":`Codex 로그 데이터베이스가 사용 중입니다. Codex를 종료한 뒤 다시 시도하세요.`,"error.unsupported_schema":`이 Codex 로그 스키마는 보호 기능을 지원하지 않습니다.`,"error.trigger_collision":`예약된 Log Guard 트리거 이름이 이미 사용 중입니다. 보호를 변경하지 않았습니다.`,"error.unsafe_path":`Codex 로그 데이터베이스 경로가 안전성 검사를 통과하지 못했습니다.`,"error.database_error":`Codex 로그 데이터베이스를 업데이트하지 못했습니다.`,"error.config_write_failed":`데이터베이스는 변경되었지만 OpenCodex가 보호 설정을 저장하지 못했습니다. 구성 저장소를 수정한 뒤 복구를 실행하세요.`},zh:{compact:`压缩`,compactComplete:`压缩完成(逻辑 / 磁盘回收)`,pagesUnit:`页`,compactPartial:`压缩部分完成(逻辑 / 磁盘回收)`,confirmCompact:`确认压缩`,cancel:`取消`,inspectionOnly:`仅检查`,externalSqliteHome:`外部 SQLite 存储`,inspectionUnavailable:`诊断日志检查当前不可用。`,metricsSkippedLarge:`已跳过行指标:数据库超过 {threshold},扫描会阻塞代理。`,protection:`保护`,compat:`兼容模式`,quiet:`静默模式`,disable:`禁用保护`,repair:`修复保护`,applying:`正在应用保护…`,"error.generic":`无法更改 Codex 日志保护。`,"error.codex_running":`更改 Codex 日志保护前请先退出 Codex。`,"error.process_enumeration_failed":`无法确认 Codex 已停止,因此未更改保护设置。`,"error.busy":`Codex 日志数据库正忙。请退出 Codex 后重试。`,"error.unsupported_schema":`此 Codex 日志数据库结构不支持保护功能。`,"error.trigger_collision":`保留的 Log Guard 触发器名称已被占用,因此未更改保护设置。`,"error.unsafe_path":`Codex 日志数据库路径未通过安全检查。`,"error.database_error":`无法更新 Codex 日志数据库。`,"error.config_write_failed":`数据库已更改,但 OpenCodex 无法保存保护设置。请先修复配置存储,然后运行“修复保护”。`},"zh-TW":{compact:`壓縮`,compactComplete:`压缩完成(逻辑 / 磁盘回收)`,pagesUnit:`頁`,compactPartial:`压缩部分完成(逻辑 / 磁盘回收)`,confirmCompact:`確認壓縮`,cancel:`取消`,inspectionOnly:`僅檢查`,externalSqliteHome:`外部 SQLite 儲存空間`,inspectionUnavailable:`診斷記錄檢查目前無法使用。`,metricsSkippedLarge:`已略過列指標:資料庫超過 {threshold},掃描會阻塞代理。`,protection:`保護`,compat:`相容模式`,quiet:`靜默模式`,disable:`停用保護`,repair:`修復保護`,applying:`正在套用保護…`,"error.generic":`無法變更 Codex 日誌保護。`,"error.codex_running":`變更 Codex 日誌保護前請先退出 Codex。`,"error.process_enumeration_failed":`無法確認 Codex 已停止,因此未變更保護設定。`,"error.busy":`Codex 日誌資料庫忙碌中。請退出 Codex 後重試。`,"error.unsupported_schema":`此 Codex 日誌資料庫結構不支援保護功能。`,"error.trigger_collision":`保留的 Log Guard 觸發器名稱已被使用,因此未變更保護設定。`,"error.unsafe_path":`Codex 日誌資料庫路徑未通過安全檢查。`,"error.database_error":`無法更新 Codex 日誌資料庫。`,"error.config_write_failed":`資料庫已變更,但 OpenCodex 無法儲存保護設定。請先修復設定儲存空間,再執行「修復保護」。`},ru:{compact:`Сжать`,compactComplete:`Сжатие завершено (логически / освобождено на диске)`,pagesUnit:`страниц`,compactPartial:`Сжатие частичное (логически / освобождено на диске)`,confirmCompact:`Подтвердить сжатие`,cancel:`Отмена`,inspectionOnly:`Только проверка`,externalSqliteHome:`Внешнее хранилище SQLite`,inspectionUnavailable:`Проверка диагностических журналов недоступна.`,metricsSkippedLarge:`Метрики строк пропущены: база больше {threshold}, и её сканирование заблокировало бы прокси.`,protection:`Защита`,compat:`Совместимость`,quiet:`Тихий режим`,disable:`Отключить защиту`,repair:`Восстановить защиту`,applying:`Применение защиты…`,"error.generic":`Не удалось изменить защиту журналов Codex.`,"error.codex_running":`Закройте Codex перед изменением защиты журналов.`,"error.process_enumeration_failed":`Не удалось убедиться, что Codex остановлен. Защита не изменена.`,"error.busy":`База журналов Codex занята. Закройте Codex и повторите попытку.`,"error.unsupported_schema":`Эта схема базы журналов Codex не поддерживает защиту.`,"error.trigger_collision":`Зарезервированное имя триггера Log Guard уже используется. Защита не изменена.`,"error.unsafe_path":`Путь к базе журналов Codex не прошёл проверку безопасности.`,"error.database_error":`Не удалось обновить базу журналов Codex.`,"error.config_write_failed":`База была изменена, но OpenCodex не смог сохранить настройку защиты. Исправьте хранилище конфигурации и затем запустите восстановление.`},ja:{compact:`圧縮`,compactComplete:`圧縮完了(論理 / ディスク解放)`,pagesUnit:`ページ`,compactPartial:`圧縮は部分的に完了(論理 / ディスク解放)`,confirmCompact:`圧縮を確認`,cancel:`キャンセル`,inspectionOnly:`検査のみ`,externalSqliteHome:`外部 SQLite ストレージ`,inspectionUnavailable:`診断ログの検査を利用できません。`,metricsSkippedLarge:`行メトリクスをスキップしました。データベースが {threshold} を超えており、走査するとプロキシが停止します。`,protection:`保護`,compat:`互換モード`,quiet:`静音モード`,disable:`保護を無効化`,repair:`保護を修復`,applying:`保護を適用中…`,"error.generic":`Codex ログ保護を変更できませんでした。`,"error.codex_running":`ログ保護を変更する前に Codex を終了してください。`,"error.process_enumeration_failed":`Codex が停止していることを確認できなかったため、保護は変更されませんでした。`,"error.busy":`Codex ログデータベースが使用中です。Codex を終了して再試行してください。`,"error.unsupported_schema":`この Codex ログスキーマでは保護機能を使用できません。`,"error.trigger_collision":`予約済みの Log Guard トリガー名が既に使用されています。保護は変更されませんでした。`,"error.unsafe_path":`Codex ログデータベースのパスが安全性チェックに失敗しました。`,"error.database_error":`Codex ログデータベースを更新できませんでした。`,"error.config_write_failed":`データベースは変更されましたが、OpenCodex は保護設定を保存できませんでした。設定ストレージを修正してから保護を修復してください。`},tr:{compact:`Sıkıştır`,compactComplete:`Sikistirma tamamlandi (mantiksal / diskte geri kazanilan)`,pagesUnit:`sayfa`,compactPartial:`Sikistirma kismi (mantiksal / diskte geri kazanilan)`,confirmCompact:`Sıkıştırmayı onayla`,cancel:`İptal`,inspectionOnly:`Yalnızca inceleme`,externalSqliteHome:`Harici SQLite depolaması`,inspectionUnavailable:`Tanılama günlüğü incelemesi kullanılamıyor.`,metricsSkippedLarge:`Satır ölçümleri atlandı: veritabanı {threshold} sınırının üzerinde ve taranması proxy’yi kilitler.`,protection:`Koruma`,compat:`Uyumluluk`,quiet:`Sessiz`,disable:`Korumayı devre dışı bırak`,repair:`Korumayı onar`,applying:`Koruma uygulanıyor…`,"error.generic":`Codex günlük koruması değiştirilemedi.`,"error.codex_running":`Günlük korumasını değiştirmeden önce Codex'i kapatın.`,"error.process_enumeration_failed":`Codex'in kapalı olduğu doğrulanamadı. Koruma değiştirilmedi.`,"error.busy":`Codex günlük veritabanı meşgul. Codex'i kapatıp yeniden deneyin.`,"error.unsupported_schema":`Bu Codex günlük şeması koruma için desteklenmiyor.`,"error.trigger_collision":`Ayrılmış bir Log Guard tetikleyici adı zaten kullanılıyor. Koruma değiştirilmedi.`,"error.unsafe_path":`Codex günlük veritabanı yolu güvenlik denetimini geçemedi.`,"error.database_error":`Codex günlük veritabanı güncellenemedi.`,"error.config_write_failed":`Veritabanı değişti ancak OpenCodex koruma ayarını kaydedemedi. Yapılandırma depolamasını düzeltip ardından korumayı onarın.`}};function b(e,t){return y[e][t]}var x={en:{applying:`Applying Log Guard change…`,"error.generic":`Could not update Codex log storage.`,"error.codex_running":`Quit Codex before changing Codex log storage.`,"error.process_enumeration_failed":`Could not verify that Codex is stopped. The Log Guard operation was not started.`,"error.busy":`The Codex logs database is busy. Quit Codex and try again.`,"error.unsupported_schema":`This Codex logs schema is not supported for this operation.`,"error.unsafe_path":`The Codex logs database path failed the safety check.`,"error.database_error":`Could not update the Codex logs database.`,"error.auto_vacuum_not_incremental":`This Codex logs database is not configured for incremental vacuum, so space cannot be reclaimed without a full rebuild.`,"error.integrity_check_failed":`The Codex logs database failed its integrity check. No space was reclaimed.`},de:{applying:`Log-Guard-Änderung wird angewendet…`,"error.generic":`Der Codex-Protokollspeicher konnte nicht aktualisiert werden.`,"error.codex_running":`Beende Codex, bevor du den Codex-Protokollspeicher änderst.`,"error.process_enumeration_failed":`Es konnte nicht sicher festgestellt werden, dass Codex beendet ist. Der Log-Guard-Vorgang wurde nicht gestartet.`,"error.busy":`Die Codex-Protokolldatenbank ist belegt. Beende Codex und versuche es erneut.`,"error.unsupported_schema":`Dieses Schema der Codex-Protokolldatenbank wird für diesen Vorgang nicht unterstützt.`,"error.unsafe_path":`Der Pfad der Codex-Protokolldatenbank hat die Sicherheitsprüfung nicht bestanden.`,"error.database_error":`Die Codex-Protokolldatenbank konnte nicht aktualisiert werden.`,"error.auto_vacuum_not_incremental":`Diese Codex-Protokolldatenbank ist nicht fuer inkrementelles Vacuum konfiguriert; ohne vollstaendigen Neuaufbau kann kein Speicher freigegeben werden.`,"error.integrity_check_failed":`Die Integritaetspruefung der Codex-Protokolldatenbank ist fehlgeschlagen. Es wurde kein Speicher freigegeben.`},fr:{applying:`Application de la modification Log Guard…`,"error.generic":`Impossible de mettre à jour le stockage des journaux Codex.`,"error.codex_running":`Quittez Codex avant de modifier le stockage des journaux Codex.`,"error.process_enumeration_failed":`Impossible de vérifier que Codex est arrêté. L’opération Log Guard n’a pas été lancée.`,"error.busy":`La base de données des journaux Codex est occupée. Quittez Codex et réessayez.`,"error.unsupported_schema":`Ce schéma de journaux Codex n’est pas pris en charge pour cette opération.`,"error.unsafe_path":`Le chemin de la base de données des journaux Codex a échoué au contrôle de sécurité.`,"error.database_error":`Impossible de mettre à jour la base de données des journaux Codex.`,"error.auto_vacuum_not_incremental":`Cette base de donnees de journaux Codex n'est pas configuree pour le vacuum incrementiel : l'espace ne peut pas etre recupere sans reconstruction complete.`,"error.integrity_check_failed":`La verification d'integrite de la base de donnees de journaux Codex a echoue. Aucun espace n'a ete recupere.`},ko:{applying:`Log Guard 변경 적용 중…`,"error.generic":`Codex 로그 저장소를 업데이트하지 못했습니다.`,"error.codex_running":`Codex 로그 저장소를 변경하기 전에 Codex를 종료하세요.`,"error.process_enumeration_failed":`Codex가 종료되었는지 확인할 수 없어 Log Guard 작업을 시작하지 않았습니다.`,"error.busy":`Codex 로그 데이터베이스가 사용 중입니다. Codex를 종료한 뒤 다시 시도하세요.`,"error.unsupported_schema":`이 Codex 로그 스키마는 이 작업을 지원하지 않습니다.`,"error.unsafe_path":`Codex 로그 데이터베이스 경로가 안전성 검사를 통과하지 못했습니다.`,"error.database_error":`Codex 로그 데이터베이스를 업데이트하지 못했습니다.`,"error.auto_vacuum_not_incremental":`이 Codex 로그 데이터베이스는 증분 정리로 구성되어 있지 않아, 전체 재구축 없이는 공간을 회수할 수 없습니다.`,"error.integrity_check_failed":`Codex 로그 데이터베이스 무결성 검사에 실패했습니다. 공간이 회수되지 않았습니다.`},zh:{applying:`正在应用 Log Guard 更改…`,"error.generic":`无法更新 Codex 日志存储。`,"error.codex_running":`更改 Codex 日志存储前请先退出 Codex。`,"error.process_enumeration_failed":`无法确认 Codex 已停止,因此未启动 Log Guard 操作。`,"error.busy":`Codex 日志数据库正忙。请退出 Codex 后重试。`,"error.unsupported_schema":`此 Codex 日志数据库结构不支持此操作。`,"error.unsafe_path":`Codex 日志数据库路径未通过安全检查。`,"error.database_error":`无法更新 Codex 日志数据库。`,"error.auto_vacuum_not_incremental":`此 Codex 日志数据库未配置增量清理,因此不完整重建就无法回收空间。`,"error.integrity_check_failed":`Codex 日志数据库完整性检查失败,未回收任何空间。`},"zh-TW":{applying:`正在套用 Log Guard 變更…`,"error.generic":`無法更新 Codex 日誌儲存空間。`,"error.codex_running":`變更 Codex 日誌儲存空間前請先退出 Codex。`,"error.process_enumeration_failed":`無法確認 Codex 已停止,因此未啟動 Log Guard 操作。`,"error.busy":`Codex 日誌資料庫忙碌中。請退出 Codex 後重試。`,"error.unsupported_schema":`此 Codex 日誌資料庫結構不支援此操作。`,"error.unsafe_path":`Codex 日誌資料庫路徑未通過安全檢查。`,"error.database_error":`無法更新 Codex 日誌資料庫。`,"error.auto_vacuum_not_incremental":`此 Codex 日志数据库未配置增量清理,因此不完整重建就无法回收空间。`,"error.integrity_check_failed":`Codex 日志数据库完整性检查失败,未回收任何空间。`},ru:{applying:`Применение изменения Log Guard…`,"error.generic":`Не удалось обновить хранилище журналов Codex.`,"error.codex_running":`Закройте Codex перед изменением хранилища журналов Codex.`,"error.process_enumeration_failed":`Не удалось убедиться, что Codex остановлен. Операция Log Guard не запущена.`,"error.busy":`База журналов Codex занята. Закройте Codex и повторите попытку.`,"error.unsupported_schema":`Эта схема базы журналов Codex не поддерживает эту операцию.`,"error.unsafe_path":`Путь к базе журналов Codex не прошёл проверку безопасности.`,"error.database_error":`Не удалось обновить базу журналов Codex.`,"error.auto_vacuum_not_incremental":`Эта база данных журналов Codex не настроена на инкрементальную очистку, поэтому освободить место без полной перестройки невозможно.`,"error.integrity_check_failed":`Проверка целостности базы данных журналов Codex не пройдена. Место не освобождено.`},ja:{applying:`Log Guard の変更を適用中…`,"error.generic":`Codex ログストレージを更新できませんでした。`,"error.codex_running":`Codex ログストレージを変更する前に Codex を終了してください。`,"error.process_enumeration_failed":`Codex が停止していることを確認できなかったため、Log Guard 操作を開始しませんでした。`,"error.busy":`Codex ログデータベースが使用中です。Codex を終了して再試行してください。`,"error.unsupported_schema":`この Codex ログスキーマではこの操作を使用できません。`,"error.unsafe_path":`Codex ログデータベースのパスが安全性チェックに失敗しました。`,"error.database_error":`Codex ログデータベースを更新できませんでした。`,"error.auto_vacuum_not_incremental":`この Codex ログ データベースは増分バキューム用に構成されていないため、完全な再構築なしに領域を解放できません。`,"error.integrity_check_failed":`Codex ログ データベースの整合性チェックに失敗しました。領域は解放されていません。`},tr:{applying:`Log Guard değişikliği uygulanıyor…`,"error.generic":`Codex günlük depolaması güncellenemedi.`,"error.codex_running":`Codex günlük depolamasını değiştirmeden önce Codex'i kapatın.`,"error.process_enumeration_failed":`Codex'in kapalı olduğu doğrulanamadı. Log Guard işlemi başlatılmadı.`,"error.busy":`Codex günlük veritabanı meşgul. Codex'i kapatıp yeniden deneyin.`,"error.unsupported_schema":`Bu Codex günlük şeması bu işlem için desteklenmiyor.`,"error.unsafe_path":`Codex günlük veritabanı yolu güvenlik denetimini geçemedi.`,"error.database_error":`Codex günlük veritabanı güncellenemedi.`,"error.auto_vacuum_not_incremental":`Bu Codex gunluk veritabani artimli vacuum icin yapilandirilmamis; tam yeniden olusturma olmadan alan geri kazanilamaz.`,"error.integrity_check_failed":`Codex gunluk veritabani butunluk denetiminden gecemedi. Alan geri kazanilmadi.`}};function S(e,t){return x[e][t]}var C={en:{schema:{compatible:`Compatible`,missing:`Database not found`,unreadable:`Database unavailable`,unsupported:`Unsupported`},protection:{off:`Off`,active:`Active`,drifted:`Needs repair`,unsupported:`Unsupported`,unknown:`Unknown`},mode:{off:`Off`,compat:`Compatibility`,quiet:`Quiet`,collision:`Unknown`}},de:{schema:{compatible:`Kompatibel`,missing:`Datenbank nicht gefunden`,unreadable:`Datenbank nicht lesbar`,unsupported:`Nicht unterstützt`},protection:{off:`Aus`,active:`Aktiv`,drifted:`Reparatur erforderlich`,unsupported:`Nicht unterstützt`,unknown:`Unbekannt`},mode:{off:`Aus`,compat:`Kompatibilität`,quiet:`Leise`,collision:`Unbekannt`}},fr:{schema:{compatible:`Compatible`,missing:`Base de données introuvable`,unreadable:`Base de données indisponible`,unsupported:`Non pris en charge`},protection:{off:`Désactivée`,active:`Active`,drifted:`Réparation requise`,unsupported:`Non prise en charge`,unknown:`Inconnue`},mode:{off:`Désactivé`,compat:`Compatibilité`,quiet:`Silencieux`,collision:`Inconnu`}},ko:{schema:{compatible:`호환됨`,missing:`데이터베이스 없음`,unreadable:`데이터베이스를 읽을 수 없음`,unsupported:`지원되지 않음`},protection:{off:`꺼짐`,active:`활성`,drifted:`복구 필요`,unsupported:`지원되지 않음`,unknown:`알 수 없음`},mode:{off:`꺼짐`,compat:`호환 모드`,quiet:`조용한 모드`,collision:`알 수 없음`}},zh:{schema:{compatible:`兼容`,missing:`未找到数据库`,unreadable:`无法读取数据库`,unsupported:`不受支持`},protection:{off:`关闭`,active:`已启用`,drifted:`需要修复`,unsupported:`不受支持`,unknown:`未知`},mode:{off:`关闭`,compat:`兼容模式`,quiet:`静默模式`,collision:`未知`}},"zh-TW":{schema:{compatible:`相容`,missing:`找不到資料庫`,unreadable:`無法讀取資料庫`,unsupported:`不支援`},protection:{off:`關閉`,active:`已啟用`,drifted:`需要修復`,unsupported:`不支援`,unknown:`未知`},mode:{off:`關閉`,compat:`相容模式`,quiet:`靜默模式`,collision:`未知`}},ru:{schema:{compatible:`Совместимо`,missing:`База не найдена`,unreadable:`База недоступна`,unsupported:`Не поддерживается`},protection:{off:`Выключено`,active:`Активно`,drifted:`Требуется восстановление`,unsupported:`Не поддерживается`,unknown:`Неизвестно`},mode:{off:`Выключено`,compat:`Совместимость`,quiet:`Тихий режим`,collision:`Неизвестно`}},ja:{schema:{compatible:`互換`,missing:`データベースが見つかりません`,unreadable:`データベースを読み取れません`,unsupported:`未対応`},protection:{off:`オフ`,active:`有効`,drifted:`修復が必要`,unsupported:`未対応`,unknown:`不明`},mode:{off:`オフ`,compat:`互換モード`,quiet:`静音モード`,collision:`不明`}},tr:{schema:{compatible:`Uyumlu`,missing:`Veritabanı bulunamadı`,unreadable:`Veritabanı okunamıyor`,unsupported:`Desteklenmiyor`},protection:{off:`Kapalı`,active:`Etkin`,drifted:`Onarım gerekli`,unsupported:`Desteklenmiyor`,unknown:`Bilinmiyor`},mode:{off:`Kapalı`,compat:`Uyumluluk`,quiet:`Sessiz`,collision:`Bilinmiyor`}}};function w(e,t){return C[e].schema[t]}function T(e,t){return C[e].protection[t]}function E(e,t){return C[e].mode[t]}var D=r(),O=``,k={sessions:`storage.bucket.sessions`,archived_sessions:`storage.bucket.archived_sessions`,logs_db:`storage.bucket.logs_db`,state_db:`storage.bucket.state_db`,attachments:`storage.bucket.attachments`,deletion_manifests:`storage.bucket.deletion_manifests`,other:`storage.bucket.other`};function A(e,t){let n=k[e.key];return n?t(n):e.label}function j(e,t){return e===void 0?`—`:new Date(e).toLocaleDateString(t)}function M(e,t,n){return e.rows===void 0?`—`:e.rows===null?n(`storage.rows.unknown`):e.rows.toLocaleString(t)}function N(e,t){switch(t){case`codex_running`:return S(e,`error.codex_running`);case`process_enumeration_failed`:return S(e,`error.process_enumeration_failed`);case`busy`:return S(e,`error.busy`);case`unsupported_schema`:return S(e,`error.unsupported_schema`);case`trigger_collision`:return b(e,`error.trigger_collision`);case`unsafe_path`:return S(e,`error.unsafe_path`);case`database_error`:return S(e,`error.database_error`);case`auto_vacuum_not_incremental`:return S(e,`error.auto_vacuum_not_incremental`);case`integrity_check_failed`:return S(e,`error.integrity_check_failed`);case`config_write_failed`:return b(e,`error.config_write_failed`);default:return S(e,`error.generic`)}}function P({report:e,locale:t,t:n,busy:r,error:i,compaction:a,onAction:o}){let s=e.metrics,c=e.capabilities.protection.state===`unsupported`||e.capabilities.reclaim.state===`unsupported`,l=e.protection,u=r||e.capabilities.protection.state!==`supported`,d=l!==void 0&&e.capabilities.reclaim.state===`supported`&&(s?.reclaimableBytes??0)>0,[f,p]=(0,_.useState)(!1);return(0,D.jsxs)(`div`,{className:`stw-section`,"data-testid":`codex-log-guard`,children:[(0,D.jsx)(`h3`,{className:`stw-section-title`,children:n(`storage.bucket.logs_db`)}),(0,D.jsxs)(`dl`,{className:`stw-kv`,children:[(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:n(`dash.status`)}),(0,D.jsxs)(`dd`,{className:`stw-kv-mono`,children:[(0,D.jsx)(`code`,{children:w(t,e.schema.state)}),c&&e.schema.state===`unsupported`?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,D.jsx)(`code`,{children:b(t,`inspectionOnly`)})]}):null]})]}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:n(`storage.bucket.logs_db`)}),(0,D.jsx)(`dd`,{className:`stw-kv-mono`,children:v(e.files.databaseBytes,t)})]}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:(0,D.jsx)(`code`,{children:`WAL`})}),(0,D.jsx)(`dd`,{className:`stw-kv-mono`,children:v(e.files.walBytes,t)})]}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:(0,D.jsx)(`code`,{children:`SHM`})}),(0,D.jsx)(`dd`,{className:`stw-kv-mono`,children:v(e.files.shmBytes,t)})]}),s&&(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:n(`storage.col.rows`)}),(0,D.jsx)(`dd`,{className:`stw-kv-mono`,children:s.totalRows.toLocaleString(t)})]}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:(0,D.jsx)(`code`,{children:`TRACE`})}),(0,D.jsxs)(`dd`,{className:`stw-kv-mono`,children:[(s.traceShare*100).toFixed(1),`%`]})]}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:(0,D.jsx)(`code`,{children:`freelist`})}),(0,D.jsx)(`dd`,{className:`stw-kv-mono`,children:v(s.reclaimableBytes,t)})]})]}),!s&&e.metricsSkipped&&(0,D.jsxs)(`div`,{className:`stw-kv-row`,"data-testid":`log-guard-metrics-skipped`,children:[(0,D.jsx)(`dt`,{children:n(`storage.col.rows`)}),(0,D.jsx)(`dd`,{className:`muted`,children:b(t,`metricsSkippedLarge`).replace(`{threshold}`,v(e.metricsSkipped.thresholdBytes,t))})]}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:(0,D.jsx)(`code`,{children:`sqlite_home`})}),(0,D.jsx)(`dd`,{className:`stw-kv-mono`,children:(0,D.jsx)(`code`,{children:e.externalSqliteHome?b(t,`externalSqliteHome`):`CODEX_HOME`})})]})]}),l&&(0,D.jsxs)(`div`,{className:`stw-section`,"data-testid":`log-guard-protection`,children:[(0,D.jsx)(`h4`,{className:`stw-section-title`,children:b(t,`protection`)}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`span`,{className:`muted`,children:(0,D.jsx)(`code`,{children:T(t,l.state)})}),(0,D.jsxs)(`span`,{className:`stw-kv-mono`,children:[(0,D.jsx)(`code`,{children:E(t,l.desiredMode)}),l.observedMode===l.desiredMode?null:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`span`,{"aria-hidden":`true`,children:` · `}),(0,D.jsx)(`code`,{children:E(t,l.observedMode)})]})]})]}),(0,D.jsxs)(`div`,{className:`storage-policy-actions`,children:[(0,D.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,"data-testid":`log-guard-protect-compat`,disabled:u,"aria-pressed":l.desiredMode===`compat`,onClick:()=>o({action:`protect`,mode:`compat`}),children:b(t,`compat`)}),(0,D.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,"data-testid":`log-guard-protect-quiet`,disabled:u,"aria-pressed":l.desiredMode===`quiet`,onClick:()=>o({action:`protect`,mode:`quiet`}),children:b(t,`quiet`)}),(0,D.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,"data-testid":`log-guard-unprotect`,disabled:u||l.desiredMode===`off`,onClick:()=>o({action:`unprotect`}),children:b(t,`disable`)}),l.state===`drifted`&&(0,D.jsx)(`button`,{type:`button`,className:`btn btn-sm`,"data-testid":`log-guard-repair`,disabled:u,onClick:()=>o({action:`repair`}),children:b(t,`repair`)}),r&&(0,D.jsx)(`span`,{className:`muted`,role:`status`,children:S(t,`applying`)})]}),i&&(0,D.jsx)(`p`,{className:`err`,role:`alert`,children:i})]}),d&&(0,D.jsx)(`div`,{className:`stw-section`,"data-testid":`log-guard-reclaim`,children:(0,D.jsx)(`div`,{className:`storage-policy-actions`,children:f?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`button`,{type:`button`,className:`btn btn-sm`,"data-testid":`log-guard-compact-confirm`,disabled:r,onClick:()=>{p(!1),o({action:`compact`})},children:b(t,`confirmCompact`)}),(0,D.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,disabled:r,onClick:()=>p(!1),children:b(t,`cancel`)})]}):(0,D.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,"data-testid":`log-guard-compact`,disabled:r,onClick:()=>p(!0),children:b(t,`compact`)})})}),a&&(0,D.jsx)(`div`,{className:`stw-section`,children:(0,D.jsx)(`p`,{className:`stw-kv-mono`,role:`status`,"data-testid":`log-guard-compact-result`,children:a})}),s&&s.topTargets.length>0&&(0,D.jsxs)(`div`,{className:`stw-section`,children:[(0,D.jsx)(`h4`,{className:`stw-section-title`,children:(0,D.jsx)(`code`,{children:`target`})}),s.topTargets.slice(0,5).map(e=>(0,D.jsxs)(`div`,{className:`stw-file-row`,children:[(0,D.jsx)(`span`,{className:`stw-file-path`,title:e.target,children:(0,D.jsx)(`code`,{children:e.target})}),(0,D.jsx)(`span`,{className:`stw-file-size`,children:e.rows.toLocaleString(t)})]},e.target))]}),(0,D.jsx)(`p`,{className:`stw-hint`,children:(0,D.jsxs)(`code`,{children:[`immutable=1 · snapshot=`,e.snapshot]})})]})}function F({locale:e,t}){return(0,D.jsxs)(`div`,{className:`stw-section`,"data-testid":`codex-log-guard-unavailable`,children:[(0,D.jsx)(`h3`,{className:`stw-section-title`,children:t(`storage.bucket.logs_db`)}),(0,D.jsx)(`p`,{className:`stw-hint`,children:b(e,`inspectionUnavailable`)})]})}function I({report:e,locale:n,logGuardBusy:r=!1,onLogGuardAction:i}){let a=t(),[s,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(null),[f,p]=(0,_.useState)(!1),[m,h]=(0,_.useState)(null),[g,y]=(0,_.useState)(null),x=(0,_.useMemo)(()=>e.buckets.toSorted((e,t)=>t.bytes-e.bytes),[e.buckets]),C=x.find(e=>e.key===s)??null,w=u?.generation===e.generatedAt?u.report:e.codexLogs??null,T=m?.generation===e.generatedAt?m.message:null,E=g?.generation===e.generatedAt?g.summary:null,k=r||f,I=(0,_.useMemo)(()=>{let t=[];for(let n of e.buckets)for(let e of n.largest??[])t.push({...e,bucketKey:n.key});return t.sort((e,t)=>t.bytes-e.bytes).slice(0,10)},[e.buckets]),L=(0,_.useMemo)(()=>new Map(e.buckets.map(e=>[e.key,e])),[e.buckets]);return(0,D.jsxs)(`div`,{className:`storage-workspace-root`,children:[(0,D.jsxs)(`aside`,{className:`storage-workspace-rail`,"aria-label":a(`storage.section.buckets`),children:[(0,D.jsxs)(`div`,{className:`storage-workspace-rail-header`,children:[(0,D.jsx)(`span`,{className:`storage-workspace-rail-title`,children:a(`storage.section.buckets`)}),(0,D.jsx)(`span`,{className:`storage-workspace-rail-count`,children:x.length})]}),(0,D.jsx)(`div`,{className:`storage-workspace-rail-list`,children:x.length===0?(0,D.jsx)(`span`,{className:`storage-workspace-rail-empty`,children:a(`storage.empty`)}):x.map(e=>(0,D.jsxs)(`button`,{type:`button`,className:`storage-workspace-rail-row${s===e.key?` storage-workspace-rail-row--selected`:``}`,onClick:()=>l(t=>t===e.key?null:e.key),"aria-current":s===e.key?`true`:void 0,children:[(0,D.jsxs)(`span`,{className:`storage-workspace-rail-primary`,children:[(0,D.jsx)(`span`,{className:`storage-workspace-rail-name`,children:A(e,a)}),(0,D.jsx)(`span`,{className:`storage-workspace-rail-size`,children:v(e.bytes,n)})]}),(0,D.jsxs)(`span`,{className:`storage-workspace-rail-meta`,children:[e.fileCount.toLocaleString(n),` `,a(`storage.col.files`).toLowerCase()]})]},e.key))})]}),(0,D.jsx)(`section`,{className:`storage-workspace-main`,"aria-label":C?A(C,a):a(`storage.section.largest`),children:C?(0,D.jsxs)(`div`,{className:`stw-detail`,children:[(0,D.jsx)(`div`,{className:`stw-detail-toolbar`,children:(0,D.jsxs)(`button`,{type:`button`,className:`stw-detail-back`,onClick:()=>l(null),children:[(0,D.jsx)(o,{className:`stw-detail-back-chevron`,"aria-hidden":`true`}),a(`modal.back`)]})}),(0,D.jsxs)(`div`,{className:`stw-detail-body`,children:[(0,D.jsx)(`h2`,{className:`stw-detail-title`,children:A(C,a)}),(0,D.jsxs)(`dl`,{className:`stw-kv`,children:[(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:a(`storage.col.size`)}),(0,D.jsx)(`dd`,{className:`stw-kv-mono`,children:v(C.bytes,n)})]}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:a(`storage.col.files`)}),(0,D.jsx)(`dd`,{className:`stw-kv-mono`,children:C.fileCount.toLocaleString(n)})]}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:a(`storage.col.oldest`)}),(0,D.jsx)(`dd`,{children:j(C.oldest,n)})]}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:a(`storage.col.newest`)}),(0,D.jsx)(`dd`,{children:j(C.newest,n)})]}),(0,D.jsxs)(`div`,{className:`stw-kv-row`,children:[(0,D.jsx)(`dt`,{children:a(`storage.col.rows`)}),(0,D.jsx)(`dd`,{className:`stw-kv-mono`,children:M(C,n,a)})]})]}),(C.largest?.length??0)>0&&(0,D.jsxs)(`div`,{className:`stw-section`,children:[(0,D.jsx)(`h3`,{className:`stw-section-title`,children:a(`storage.section.largest`)}),C.largest.map(e=>(0,D.jsxs)(`div`,{className:`stw-file-row`,children:[(0,D.jsx)(`span`,{className:`stw-file-path`,title:e.path,children:e.path}),(0,D.jsx)(`span`,{className:`stw-file-size`,children:v(e.bytes,n)})]},e.path))]})]})]}):(0,D.jsxs)(`div`,{className:`stw-overview`,children:[(0,D.jsxs)(`div`,{className:`stw-summary`,children:[(0,D.jsxs)(`div`,{className:`stw-summary-card`,children:[(0,D.jsx)(`div`,{className:`stw-summary-label`,children:a(`storage.card.total`)}),(0,D.jsx)(`div`,{className:`stw-summary-value`,children:v(e.total.bytes,n)})]}),(0,D.jsxs)(`div`,{className:`stw-summary-card`,children:[(0,D.jsx)(`div`,{className:`stw-summary-label`,children:a(`storage.card.files`)}),(0,D.jsx)(`div`,{className:`stw-summary-value`,children:e.total.fileCount.toLocaleString(n)})]}),(0,D.jsxs)(`div`,{className:`stw-summary-card`,children:[(0,D.jsx)(`div`,{className:`stw-summary-label`,children:a(`storage.card.home`)}),(0,D.jsx)(`div`,{className:`stw-summary-value mono stw-home-path`,title:e.codexHome,children:e.codexHome})]})]}),w?(0,D.jsx)(P,{report:w,locale:n,t:a,busy:k,error:T,compaction:E,onAction:t=>{if(i){i(t);return}if(f)return;let r=e.generatedAt;(async()=>{p(!0),h(null),t.action===`compact`&&y(null);try{let e=t.action===`protect`?`protect`:t.action,i={method:`POST`,...t.action===`protect`?{headers:{"content-type":`application/json`},body:JSON.stringify({mode:t.mode})}:{}},a=await fetch(`${O}/api/storage/codex-logs/${e}`,i);if(!a.ok){let e=await a.json().catch(()=>({}));h({generation:r,message:N(n,e.error)});return}if(t.action===`compact`){let e=(await a.json().catch(()=>null))?.report;if(e){let t=v(e.logicalBytesReclaimed??0,n),i=v(e.physicalDatabaseBytesReclaimed??0,n),a=e.complete?b(n,`compactComplete`):b(n,`compactPartial`),o=e.pagesReclaimed??0,s=!e.complete&&e.stopReason?` (${e.stopReason})`:``;y({generation:r,summary:[`${a}${s}`,`${o.toLocaleString(n)} ${b(n,`pagesUnit`)}`,`${t} / ${i}`].join(` — `)})}try{let e=await fetch(`${O}/api/storage/codex-logs`);if(e.ok){let t=await e.json();d({generation:r,report:t})}}catch{}return}let o=await a.json();d({generation:r,report:o})}catch{h({generation:r,message:S(n,`error.generic`)})}finally{p(!1)}})()}}):e.codexLogsError===`inspect_failed`?(0,D.jsx)(F,{locale:n,t:a}):null,I.length>0?(0,D.jsxs)(`div`,{className:`stw-section`,children:[(0,D.jsx)(`h3`,{className:`stw-section-title`,children:a(`storage.section.largest`)}),I.map(e=>{let t=L.get(e.bucketKey);return(0,D.jsxs)(`div`,{className:`stw-file-row`,children:[(0,D.jsx)(`span`,{className:`stw-file-path`,title:e.path,children:e.path}),t&&(0,D.jsx)(`span`,{className:`stw-file-bucket`,children:A(t,a)}),(0,D.jsx)(`span`,{className:`stw-file-size`,children:v(e.bytes,n)})]},`${e.bucketKey}:${e.path}`)})]}):(0,D.jsxs)(`p`,{className:`stw-hint`,children:[(0,D.jsx)(c,{style:{width:14,height:14,verticalAlign:`text-bottom`,marginRight:6},"aria-hidden":`true`}),a(`storage.workspace.selectBucket`)]})]})})]})}var L=1024**3,R=[10,25,50],z=(e,t)=>{if(!(e instanceof Error))return t;let n=e.message;return n===`Failed to fetch`||n.includes(`NetworkError`)||n.includes(`network error`)||n.includes(`JSON`)||n.includes(`Unexpected end of`)?t:n||t};function B({apiBase:e,locale:t,t:n,onDone:r}){let[i,a]=(0,_.useState)(25),[o,s]=(0,_.useState)(null),[c,l]=(0,_.useState)(!1),[d,f]=(0,_.useState)(!1),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(null),[y,b]=(0,_.useState)(null),x=(0,_.useRef)(null),S=(0,_.useRef)(!1),C=(0,_.useRef)(null),w=u(c,C),T=(0,_.useCallback)((e=!1)=>{l(!1),f(!1),e&&s(null)},[]);(0,_.useEffect)(()=>{S.current=p},[p]),(0,_.useEffect)(()=>{c&&x.current?.focus()},[c]);let E=(e,t,r)=>{switch(e){case`codex_busy`:return n(`storage.cleanup.err.codex_busy`);case`stale_preview`:return n(`storage.cleanup.err.stale_preview`);case`restore_pending_overlap`:return n(`storage.cleanup.err.restore_pending_overlap`);case`referenced_history`:return n(`storage.cleanup.err.referenced_history`);case`invalid_digest`:return n(`storage.cleanup.err.invalid_digest`);case`invalid_mode`:return n(`storage.cleanup.err.invalid_mode`);case`fs_failed`:return r?n(`storage.cleanup.err.fs_failed_trash`,{trashDir:r}):n(`storage.cleanup.err.fs_failed`);case`db_reconcile_failed`:return n(`storage.cleanup.err.db_reconcile_failed`);case`cleanup_failed`:return n(`storage.cleanup.err.cleanup_failed`);default:return t??n(`storage.cleanup.cleanupFailed`)}},O=e=>n(`storage.cleanup.preset`,{percent:new Intl.NumberFormat(t,{style:`percent`,maximumFractionDigits:0}).format(e/100)}),k=async()=>{m(!0),b(null),g(null);try{let t=await fetch(`${e}/api/storage/cleanup/preview`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({percent:i})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(E(e.error,n(`storage.cleanup.previewFailed`)))}let r=await t.json();s(r),l(!0)}catch(e){b(z(e,n(`storage.cleanup.previewFailed`)))}finally{m(!1)}},A=async()=>{if(o){m(!0),b(null);try{let i=await fetch(`${e}/api/storage/cleanup`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({percent:o.percent,mode:d?`permanent`:`quarantine`,digest:o.digest})});if(!i.ok){let e=await i.json().catch(()=>({}));throw e.error===`stale_preview`&&T(!0),Error(E(e.error,e.message,e.trashDir))}let a=await i.json();if(!a.ok)throw a.error===`stale_preview`&&T(!0),Error(E(a.error,a.message,a.trashDir));T(!0),g(n(d?`storage.cleanup.donePermanent`:`storage.cleanup.doneQuarantine`,{count:String(a.count),size:v(a.bytes,t)})),r()}catch(e){b(z(e,n(`storage.cleanup.cleanupFailed`)))}finally{m(!1)}}};return(0,D.jsxs)(`section`,{className:`storage-cleanup-pane`,children:[(0,D.jsx)(`p`,{className:`muted storage-manual-panel__help`,children:n(`storage.cleanup.help`)}),(0,D.jsxs)(`div`,{className:`storage-manual-panel__controls`,children:[(0,D.jsxs)(`label`,{className:`storage-manual-panel__slider`,children:[(0,D.jsx)(`span`,{className:`muted mono`,style:{minWidth:`3.5rem`,fontVariantNumeric:`tabular-nums`},children:n(`storage.cleanup.percent`,{percent:String(i)})}),(0,D.jsx)(`input`,{type:`range`,min:1,max:100,value:i,onChange:e=>a(Number(e.target.value)),disabled:p,style:{flex:1,minWidth:0},"aria-label":n(`storage.cleanup.slider`)})]}),(0,D.jsx)(`div`,{className:`storage-manual-panel__presets`,children:R.map(e=>(0,D.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm${i===e?` active`:``}`,disabled:p,onClick:()=>a(e),children:O(e)},e))}),(0,D.jsx)(`button`,{type:`button`,className:`btn btn-sm`,disabled:p,onClick:e=>{C.current=e.currentTarget,k()},children:n(`storage.cleanup.preview`)})]}),h&&(0,D.jsx)(`p`,{className:`muted storage-manual-panel__status`,children:h}),y&&!c&&(0,D.jsx)(`p`,{className:`storage-manual-panel__status`,style:{color:`var(--red)`},children:y}),c&&o&&(0,D.jsxs)(`dialog`,{ref:w,className:`modal-overlay`,"aria-labelledby":`storage-cleanup-confirm-title`,onCancel:e=>{e.preventDefault(),S.current||T()},children:[(0,D.jsx)(`button`,{type:`button`,className:`modal-backdrop-dismiss`,"aria-label":n(`common.close`),tabIndex:-1,disabled:p,onClick:()=>T()}),(0,D.jsxs)(`div`,{className:`modal-card`,onClick:e=>e.stopPropagation(),children:[(0,D.jsx)(`h3`,{id:`storage-cleanup-confirm-title`,children:n(`storage.cleanup.confirmTitle`)}),(0,D.jsx)(`p`,{children:n(`storage.cleanup.confirmBody`,{count:String(o.count),size:v(o.bytes,t),percent:String(o.percent)})}),o.candidates.length>0&&(0,D.jsxs)(`ul`,{className:`mono muted`,style:{maxHeight:160,overflow:`auto`,fontSize:`var(--text-caption)`},children:[o.candidates.slice(0,8).map(e=>(0,D.jsx)(`li`,{children:e.relPath},e.relPath)),o.count>8&&(0,D.jsx)(`li`,{children:n(`storage.cleanup.moreFiles`,{n:String(Math.max(0,o.count-8))})})]}),(0,D.jsxs)(`label`,{style:{display:`flex`,gap:8,alignItems:`center`,marginTop:12},children:[(0,D.jsx)(`input`,{type:`checkbox`,checked:d,disabled:p,onChange:e=>f(e.target.checked)}),(0,D.jsx)(`span`,{children:n(`storage.cleanup.permanent`)})]}),(0,D.jsx)(`p`,{className:`muted`,style:{marginTop:8,fontSize:`var(--text-caption)`},children:n(d?`storage.cleanup.permanentWarn`:`storage.cleanup.quarantineNote`)}),y&&(0,D.jsx)(`p`,{style:{marginTop:12,color:`var(--red)`},children:y}),(0,D.jsxs)(`div`,{className:`dialog-actions`,style:{marginTop:16},children:[(0,D.jsx)(`button`,{ref:x,type:`button`,className:`btn btn-ghost`,disabled:p,onClick:()=>T(),children:n(`storage.cleanup.cancel`)}),(0,D.jsx)(`button`,{type:`button`,className:d?`btn btn-danger`:`btn`,disabled:p||o.count===0,onClick:()=>void A(),children:n(d?`storage.cleanup.confirmPermanent`:`storage.cleanup.confirmQuarantine`)})]})]})]})]})}function V({apiBase:e,locale:t,t:n,onDone:r,reloadToken:i,onEntriesChange:a}){let[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(null),[d,h]=(0,_.useState)(null),[g,y]=(0,_.useState)(null),b=(0,_.useRef)(null),x=(0,_.useRef)(!1),S=(0,_.useRef)(null),C=u(c!==null,S);(0,_.useEffect)(()=>{x.current=o},[o]);let w=(0,_.useCallback)(()=>l(null),[]);(0,_.useEffect)(()=>{c&&b.current?.focus()},[c]);let T=(0,_.useCallback)(async t=>{let r=await fetch(`${e}/api/storage/trash`,{signal:t});if(!r.ok)throw Error(n(`storage.trash.listFailed`));let i=await r.json(),o=Array.isArray(i.entries)?i.entries:[];return a?.(o),o},[e,a,n]),E=f(`storage-trash:${e}`,[e,i],T,{isEmpty:e=>e.length===0}).state,O=E.data??[],k=(e,t)=>{switch(e){case`codex_busy`:return n(`storage.trash.err.codex_busy`);case`invalid_trash`:return n(`storage.trash.err.invalid_trash`);case`missing_trash`:return n(`storage.trash.err.missing_trash`);case`dest_exists`:return n(`storage.trash.err.dest_exists`);case`fs_failed`:return n(`storage.trash.err.fs_failed`);case`db_reconcile_failed`:return n(`storage.trash.err.db_reconcile_failed`);case`storage_mutation_busy`:return n(`storage.trash.err.storage_mutation_busy`);case`restore_failed`:return n(`storage.trash.err.restore_failed`);case`restore_worker_timeout`:return n(`storage.trash.err.restore_worker_timeout`);case`restore_worker_aborted`:return n(`storage.trash.err.restore_worker_aborted`);case`restore_worker_failed`:return t??n(`storage.trash.err.restore_worker_failed`);default:return t??n(`storage.trash.restoreFailed`)}},A=async()=>{if(c){s(!0),y(null);try{let i=await fetch(`${e}/api/storage/trash/restore`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({id:c.id})});if(!i.ok){let e=await i.json().catch(()=>({}));throw Error(k(e.error,e.message))}let a=await i.json();if(!a.ok)throw Error(k(a.error,a.message));w(),h(n(`storage.trash.done`,{count:String(a.count),size:v(a.bytes,t)})),r()}catch(e){y(z(e,n(`storage.trash.restoreFailed`)))}finally{s(!1)}}},j=e=>{let n=e.quarantinedAt??Number(e.epoch.split(`-`)[0]);return!Number.isFinite(n)||n<=0?`—`:new Date(n).toLocaleString(t)},M=e=>e===`permanent`?n(`storage.trash.mode.permanent`):e===`quarantine`?n(`storage.trash.mode.quarantine`):`—`;return(0,D.jsxs)(`section`,{className:`storage-cleanup-pane storage-quarantine-pane`,children:[(0,D.jsx)(`p`,{className:`muted storage-manual-panel__help`,children:n(`storage.trash.help`)}),d&&(0,D.jsx)(`p`,{className:`muted storage-manual-panel__status`,children:d}),g&&!c&&(0,D.jsx)(`p`,{className:`storage-manual-panel__status`,style:{color:`var(--red)`},role:`alert`,children:g}),E.showError&&!c&&(0,D.jsx)(`p`,{className:`storage-manual-panel__status`,style:{color:`var(--red)`},role:`alert`,children:E.error instanceof Error?E.error.message:n(`storage.trash.listFailed`)}),E.refreshing&&!E.showSkeleton&&(0,D.jsx)(p,{live:!E.showError,children:n(`storage.trash.loading`)}),E.showSkeleton?(0,D.jsx)(m,{label:n(`storage.trash.loading`),rows:2}):O.length===0?(0,D.jsx)(`p`,{className:`muted storage-manual-panel__status`,children:n(`storage.trash.empty`)}):(0,D.jsx)(`div`,{className:`tbl-wrap storage-manual-panel__table`,children:(0,D.jsxs)(`table`,{className:`tbl`,children:[(0,D.jsx)(`thead`,{children:(0,D.jsxs)(`tr`,{children:[(0,D.jsx)(`th`,{children:n(`storage.trash.col.when`)}),(0,D.jsx)(`th`,{className:`num`,children:n(`storage.trash.col.files`)}),(0,D.jsx)(`th`,{className:`num`,children:n(`storage.trash.col.size`)}),(0,D.jsx)(`th`,{children:n(`storage.trash.col.mode`)}),(0,D.jsx)(`th`,{children:n(`storage.trash.col.id`)}),(0,D.jsx)(`th`,{})]})}),(0,D.jsx)(`tbody`,{children:O.map(e=>(0,D.jsxs)(`tr`,{children:[(0,D.jsx)(`td`,{className:`muted`,children:j(e)}),(0,D.jsx)(`td`,{className:`num`,children:e.fileCount}),(0,D.jsx)(`td`,{className:`num mono`,children:v(e.bytes,t)}),(0,D.jsx)(`td`,{className:`muted`,children:M(e.mode)}),(0,D.jsx)(`td`,{className:`mono`,style:{fontSize:`var(--text-caption)`},children:e.id}),(0,D.jsx)(`td`,{children:(0,D.jsx)(`button`,{type:`button`,className:`btn btn-sm`,disabled:o,onClick:t=>{S.current=t.currentTarget,y(null),l(e)},children:n(`storage.trash.restore`)})})]},e.id))})]})}),c&&(0,D.jsxs)(`dialog`,{ref:C,className:`modal-overlay`,"aria-labelledby":`storage-trash-confirm-title`,onCancel:e=>{e.preventDefault(),x.current||w()},children:[(0,D.jsx)(`button`,{type:`button`,className:`modal-backdrop-dismiss`,"aria-label":n(`common.close`),tabIndex:-1,disabled:o,onClick:()=>w()}),(0,D.jsxs)(`div`,{className:`modal-card`,onClick:e=>e.stopPropagation(),children:[(0,D.jsx)(`h3`,{id:`storage-trash-confirm-title`,children:n(`storage.trash.confirmTitle`)}),(0,D.jsx)(`p`,{children:n(`storage.trash.confirmBody`,{count:String(c.fileCount),size:v(c.bytes,t),id:c.id})}),g&&(0,D.jsx)(`p`,{style:{marginTop:12,color:`var(--red)`},children:g}),(0,D.jsxs)(`div`,{className:`dialog-actions`,style:{marginTop:16},children:[(0,D.jsx)(`button`,{ref:b,type:`button`,className:`btn btn-ghost`,disabled:o,onClick:()=>w(),children:n(`storage.trash.cancel`)}),(0,D.jsx)(`button`,{type:`button`,className:`btn`,disabled:o,onClick:()=>void A(),children:n(`storage.trash.confirmRestore`)})]})]})]})]})}function H(e){let{job:t,...n}=e;return n}function U(e){let t=String(Math.max(0,Math.round(e.trigger.archivedBytesOver/L*100)/100));return e.target.reduceToBytes===void 0?{policy:H(e),thresholdGb:t,targetMode:`percent`,percent:String(Math.min(100,Math.max(1,Math.floor(e.target.removeOldestPercent??25)))),reduceGb:`4`}:{policy:H(e),thresholdGb:t,targetMode:`reduce`,percent:`25`,reduceGb:String(Math.max(0,Math.round(e.target.reduceToBytes/L*100)/100))}}async function W(e){await new Promise(t=>window.setTimeout(t,e))}function G({apiBase:e,locale:t,t:n,onDone:r}){let i=`ocx.storage.cleanup-policy.v1:${e}`,a=d(i),o=(0,_.useRef)(!!a),[s,c]=(0,_.useState)(()=>a?.policy??null),[u,f]=(0,_.useState)(()=>!a),[p,m]=(0,_.useState)(!1),[y,b]=(0,_.useState)(!1),[x,S]=(0,_.useState)(null),[C,w]=(0,_.useState)(null),[T,E]=(0,_.useState)(()=>a?.targetMode??`percent`),[O,k]=(0,_.useState)(()=>a?.percent??`25`),[A,j]=(0,_.useState)(()=>a?.reduceGb??`4`),[M,N]=(0,_.useState)(()=>a?.thresholdGb??`5`),P=(0,_.useRef)(null),F=(0,_.useRef)(!1),I=(0,_.useRef)(!1),R=(0,_.useRef)(0),z=(0,_.useCallback)(e=>{let t=U(e);c(t.policy),N(t.thresholdGb),E(t.targetMode),k(t.percent),j(t.reduceGb),o.current=!0,l(i,t),F.current=!1},[i]),B=(0,_.useCallback)(()=>{F.current=!0},[]),V=(0,_.useCallback)(e=>{I.current=e},[]),G=(0,_.useCallback)(async t=>{let r=++R.current;o.current||f(!0),w(null);try{let n=await fetch(`${e}/api/storage/cleanup-policy`,{signal:t});if(!n.ok)throw Error(`load_failed`);let i=await n.json();if(t?.aborted||r!==R.current||F.current||I.current)return;z(i)}catch{if(t?.aborted||r!==R.current)return;o.current||(c(null),w(n(`storage.policy.loadFailed`)))}finally{!t?.aborted&&r===R.current&&f(!1)}},[e,z,n]);(0,_.useEffect)(()=>{let e=new AbortController,t=window.setTimeout(()=>{G(e.signal)},0);return()=>{window.clearTimeout(t),R.current+=1,e.abort()}},[G]),(0,_.useEffect)(()=>()=>{P.current?.abort(),P.current=null},[]);let K=()=>{if(!s)return null;let e=M.trim();if(e===``)return null;let t=Number(e);if(!Number.isFinite(t)||t<0)return null;let n;if(T===`reduce`){let e=A.trim();if(e===``)return null;let t=Number(e);if(!Number.isFinite(t)||t<0)return null;n={reduceToBytes:Math.floor(t*L)}}else{let e=Number(O);if(!Number.isFinite(e)||e<1||e>100)return null;n={removeOldestPercent:Math.min(100,Math.max(1,Math.floor(e)))}}return{enabled:s.enabled,trigger:{archivedBytesOver:Math.floor(t*L)},target:n,schedule:s.schedule,mode:s.mode}},q=async t=>{let r=K();if(!r){w(n(`storage.policy.invalid`));return}let i={...r,...t};m(!0),w(null),S(null);try{let t=await fetch(`${e}/api/storage/cleanup-policy`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(i)});if(!t.ok){w(n(`storage.policy.saveFailed`));return}let r=await t.json();if(!r.policy){w(n(`storage.policy.saveFailed`));return}z(r.policy),S(n(`storage.policy.saved`))}catch{w(n(`storage.policy.saveFailed`))}finally{m(!1)}},J=async()=>{P.current?.abort();let i=new AbortController;P.current=i;let{signal:a}=i;b(!0),w(null),S(null);try{let i=K();if(!i){w(n(`storage.policy.invalid`));return}let o=await fetch(`${e}/api/storage/cleanup-policy`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify(i),signal:a});if(a.aborted)return;if(!o.ok){w(n(`storage.policy.saveFailed`));return}let s=await o.json();if(a.aborted)return;if(!s.policy){w(n(`storage.policy.saveFailed`));return}z(s.policy);let c=await fetch(`${e}/api/storage/cleanup-policy/run`,{method:`POST`,signal:a});if(a.aborted)return;if(c.status===409){let e=await c.json().catch(()=>({}));if(a.aborted)return;e.policy&&z(e.policy),w(n(`storage.policy.alreadyRunning`));return}if(!c.ok){let e=await c.json().catch(()=>({}));if(a.aborted)return;if(e.policy&&z(e.policy),e.error===`already_running`){w(n(`storage.policy.alreadyRunning`));return}w(n(`storage.policy.runFailed`));return}let l=await c.json();if(a.aborted)return;if(l.policy&&z(l.policy),l.error===`already_running`){w(n(`storage.policy.alreadyRunning`));return}if(!l.started||!l.job?.startedAt){w(n(`storage.policy.runFailed`));return}let u=l.job.startedAt,d=Date.now()+12e4,f,p;for(;Date.now()<d;){if(a.aborted||(await W(250),a.aborted))return;let t=await fetch(`${e}/api/storage/cleanup-policy`,{signal:a});if(a.aborted)return;if(!t.ok)continue;let n=await t.json();if(a.aborted)return;p=H(n),z(n);let r=n.job;if(r&&r.status!==`running`){if(r.startedAt===u&&r.lastOutcome){f=r.lastOutcome;break}if(r.finishedAt&&r.finishedAt>=u&&r.lastOutcome){f=r.lastOutcome;break}}}if(a.aborted)return;if(p&&z(p),!f){w(n(`storage.policy.runFailed`));return}f.skipped===`disabled`?S(n(`storage.policy.skippedDisabled`)):f.skipped===`under_threshold`?S(n(`storage.policy.skippedUnder`)):f.skipped===`nothing_selected`?S(n(`storage.policy.skippedEmpty`)):f.deferred===`codex_busy`||f.error===`codex_busy`?w(n(`storage.cleanup.err.codex_busy`)):f.ok?(S(f.mode===`permanent`?n(`storage.policy.donePermanent`,{count:String(f.removed??0),size:v(f.freedBytes??0,t)}):n(`storage.policy.doneQuarantine`,{count:String(f.removed??0),size:v(f.freedBytes??0,t)})),r()):w(n(`storage.policy.runFailed`))}catch(e){if(a.aborted||e instanceof DOMException&&e.name===`AbortError`)return;w(n(`storage.policy.runFailed`))}finally{P.current===i&&(P.current=null),a.aborted||b(!1)}},Y=e=>e===void 0?n(`storage.policy.never`):new Date(e).toLocaleString(t);return u&&!s?(0,D.jsx)(`section`,{className:`storage-cleanup-pane`,children:(0,D.jsx)(`p`,{className:`muted storage-policy-help`,children:n(`storage.policy.loading`)})}):s?(0,D.jsxs)(`section`,{className:`storage-cleanup-pane`,children:[(0,D.jsx)(`p`,{className:`muted storage-policy-help`,children:n(`storage.policy.help`)}),(0,D.jsx)(`div`,{className:`storage-policy-enable`,children:(0,D.jsxs)(`div`,{className:`storage-policy-enable-row`,children:[(0,D.jsx)(`button`,{type:`button`,className:`toggle${s.enabled?` on`:``}`,disabled:p||y,"aria-pressed":s.enabled,"aria-label":n(`storage.policy.enabled`),title:n(`storage.policy.enabledHint`),onClick:()=>void q({enabled:!s.enabled}),children:(0,D.jsx)(`span`,{className:`toggle-knob`})}),(0,D.jsx)(`span`,{children:n(`storage.policy.enabled`)})]})}),(0,D.jsxs)(`div`,{className:`storage-policy-fields`,children:[(0,D.jsxs)(`div`,{className:`field storage-policy-trigger`,children:[(0,D.jsx)(`label`,{className:`field-label`,htmlFor:`storage-policy-threshold`,children:n(`storage.policy.trigger`)}),(0,D.jsxs)(`div`,{className:`storage-policy-trigger-row`,children:[(0,D.jsx)(`span`,{className:`storage-policy-trigger-hint`,children:n(`storage.policy.threshold`)}),(0,D.jsxs)(`span`,{className:`codex-auto-switch-input-wrap`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(V(!1),q())},children:[(0,D.jsx)(`input`,{id:`storage-policy-threshold`,className:`input mono codex-auto-switch-input`,type:`number`,min:0,step:.1,inputMode:`decimal`,value:M,disabled:p||y,"aria-label":n(`storage.policy.threshold`),onFocus:()=>V(!0),onChange:e=>{B(),N(e.target.value)},onKeyDown:e=>{e.nativeEvent.isComposing||p||y||e.key===`Enter`&&(e.preventDefault(),q())}}),(0,D.jsx)(`span`,{className:`codex-auto-switch-unit`,"aria-hidden":`true`,children:`GiB`}),(0,D.jsx)(g,{disabled:p||y,incrementLabel:n(`storage.policy.thresholdInc`),decrementLabel:n(`storage.policy.thresholdDec`),onIncrement:()=>{B(),N(h(M,.1,0,1e4,.1))},onDecrement:()=>{B(),N(h(M,-.1,0,1e4,.1))}})]})]})]}),(0,D.jsxs)(`fieldset`,{className:`field storage-policy-target`,children:[(0,D.jsx)(`legend`,{className:`field-label`,children:n(`storage.policy.target`)}),(0,D.jsxs)(`label`,{className:`storage-policy-target-row`,children:[(0,D.jsx)(`input`,{type:`radio`,name:`storage-policy-target`,checked:T===`percent`,disabled:p||y,onChange:()=>{B(),E(`percent`)}}),(0,D.jsx)(`span`,{className:`storage-policy-target-label`,children:n(`storage.policy.targetPercent`)}),T===`percent`&&(0,D.jsxs)(`span`,{className:`codex-auto-switch-input-wrap`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(V(!1),q())},children:[(0,D.jsx)(`input`,{id:`storage-policy-percent`,className:`input mono codex-auto-switch-input`,type:`number`,min:1,max:100,step:1,inputMode:`numeric`,value:O,disabled:p||y,"aria-label":n(`storage.policy.targetPercent`),onFocus:()=>V(!0),onChange:e=>{B(),k(e.target.value)},onKeyDown:e=>{e.nativeEvent.isComposing||p||y||e.key===`Enter`&&(e.preventDefault(),q())}}),(0,D.jsx)(`span`,{className:`codex-auto-switch-unit`,"aria-hidden":`true`,children:`%`}),(0,D.jsx)(g,{disabled:p||y,incrementLabel:n(`storage.policy.percentInc`),decrementLabel:n(`storage.policy.percentDec`),onIncrement:()=>{B(),k(h(O,1,1,100))},onDecrement:()=>{B(),k(h(O,-1,1,100))}})]})]}),(0,D.jsxs)(`label`,{className:`storage-policy-target-row`,children:[(0,D.jsx)(`input`,{type:`radio`,name:`storage-policy-target`,checked:T===`reduce`,disabled:p||y,onChange:()=>{B(),E(`reduce`)}}),(0,D.jsx)(`span`,{className:`storage-policy-target-label`,children:n(`storage.policy.targetReduce`)}),T===`reduce`&&(0,D.jsxs)(`span`,{className:`codex-auto-switch-input-wrap`,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||(V(!1),q())},children:[(0,D.jsx)(`input`,{id:`storage-policy-reduce`,className:`input mono codex-auto-switch-input`,type:`number`,min:0,step:.1,inputMode:`decimal`,value:A,disabled:p||y,"aria-label":n(`storage.policy.targetReduce`),onFocus:()=>V(!0),onChange:e=>{B(),j(e.target.value)},onKeyDown:e=>{e.nativeEvent.isComposing||p||y||e.key===`Enter`&&(e.preventDefault(),q())}}),(0,D.jsx)(`span`,{className:`codex-auto-switch-unit`,"aria-hidden":`true`,children:`GiB`}),(0,D.jsx)(g,{disabled:p||y,incrementLabel:n(`storage.policy.reduceInc`),decrementLabel:n(`storage.policy.reduceDec`),onIncrement:()=>{B(),j(h(A,.1,0,1e4,.1))},onDecrement:()=>{B(),j(h(A,-.1,0,1e4,.1))}})]})]})]}),(0,D.jsxs)(`div`,{className:`storage-policy-selects`,children:[(0,D.jsxs)(`label`,{className:`field`,htmlFor:`storage-policy-schedule`,children:[(0,D.jsx)(`span`,{className:`field-label`,children:n(`storage.policy.schedule`)}),(0,D.jsxs)(`select`,{id:`storage-policy-schedule`,className:`input`,value:s.schedule,disabled:p||y,onChange:e=>{let t=e.target.value;q({schedule:t})},children:[(0,D.jsx)(`option`,{value:`manual`,children:n(`storage.policy.schedule.manual`)}),(0,D.jsx)(`option`,{value:`startup`,children:n(`storage.policy.schedule.startup`)}),(0,D.jsx)(`option`,{value:`daily`,children:n(`storage.policy.schedule.daily`)}),(0,D.jsx)(`option`,{value:`weekly`,children:n(`storage.policy.schedule.weekly`)})]})]}),(0,D.jsxs)(`label`,{className:`field`,htmlFor:`storage-policy-mode`,children:[(0,D.jsx)(`span`,{className:`field-label`,children:n(`storage.policy.mode`)}),(0,D.jsxs)(`select`,{id:`storage-policy-mode`,className:`input`,value:s.mode,disabled:p||y,onChange:e=>{let t=e.target.value;q({mode:t})},children:[(0,D.jsx)(`option`,{value:`quarantine`,children:n(`storage.policy.mode.quarantine`)}),(0,D.jsx)(`option`,{value:`permanent`,children:n(`storage.policy.mode.permanent`)})]})]})]}),s.mode===`permanent`&&(0,D.jsx)(`p`,{className:`err storage-policy-warn`,role:`status`,children:n(`storage.policy.permanentWarn`)})]}),(0,D.jsxs)(`div`,{className:`storage-policy-meta`,children:[(0,D.jsxs)(`div`,{className:`storage-policy-meta-item`,children:[(0,D.jsx)(`span`,{className:`muted`,children:n(`storage.policy.lastRun`)}),(0,D.jsxs)(`span`,{className:`storage-policy-meta-value`,children:[Y(s.lastRun?.at),s.lastRun?` · ${n(`storage.policy.lastRunDetail`,{count:String(s.lastRun.removed),size:v(s.lastRun.freedBytes,t)})}`:``]})]}),(0,D.jsxs)(`div`,{className:`storage-policy-meta-item`,children:[(0,D.jsx)(`span`,{className:`muted`,children:n(`storage.policy.nextRun`)}),(0,D.jsx)(`span`,{className:`storage-policy-meta-value`,children:Y(s.nextRun)})]})]}),(0,D.jsxs)(`div`,{className:`storage-policy-actions`,children:[(0,D.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,disabled:p||y,onClick:()=>void q(),children:n(`storage.policy.save`)}),(0,D.jsx)(`button`,{type:`button`,className:`btn btn-sm`,disabled:p||y,onClick:()=>void J(),children:n(y?`storage.policy.running`:`storage.policy.runNow`)}),(0,D.jsx)(`span`,{className:`storage-policy-actions__status${C?` is-error`:``}`,role:C?`alert`:`status`,"aria-live":`polite`,children:C??x??``})]})]}):(0,D.jsx)(`section`,{className:`storage-cleanup-pane`,children:C&&(0,D.jsx)(`p`,{className:`err`,role:`alert`,children:C})})}function K({apiBase:e,locale:t,t:n,archivedCount:r,showQuarantine:i,trashReloadToken:a,onDone:o,onTrashEntriesChange:s}){let[c,l]=(0,_.useState)(`policy`),u=(0,_.useRef)(null),d=(0,_.useRef)(null),f=[{id:`policy`,label:n(`storage.cleanupCard.tab.policy`),ref:u},{id:`quarantine`,label:n(`storage.cleanupCard.tab.quarantine`),ref:d}],p=e=>{l(e),window.requestAnimationFrame(()=>(e===`policy`?u:d).current?.focus())},m=e=>{e.key===`ArrowLeft`||e.key===`ArrowRight`?(e.preventDefault(),p(c===`policy`?`quarantine`:`policy`)):e.key===`Home`?(e.preventDefault(),p(`policy`)):e.key===`End`&&(e.preventDefault(),p(`quarantine`))};return(0,D.jsxs)(`section`,{className:`panel storage-cleanup-card`,"aria-labelledby":`storage-cleanup-card-title`,children:[(0,D.jsx)(`div`,{className:`page-tabs storage-cleanup-card__tabs`,role:`tablist`,"aria-label":n(`storage.cleanupCard.tabs`),children:f.map(({id:e,label:t,ref:n})=>(0,D.jsx)(`button`,{type:`button`,role:`tab`,ref:n,id:`storage-cleanup-tab-${e}`,"aria-selected":c===e,"aria-controls":`storage-cleanup-panel-${e}`,tabIndex:c===e?0:-1,className:`page-tab${c===e?` page-tab--active`:``}`,onKeyDown:m,onClick:()=>p(e),children:t},e))}),(0,D.jsx)(`h3`,{id:`storage-cleanup-card-title`,className:`panel-title`,children:n(`storage.cleanupCard.title`)}),(0,D.jsxs)(`div`,{className:`storage-cleanup-card__stack`,children:[(0,D.jsxs)(`div`,{id:`storage-cleanup-panel-policy`,role:`tabpanel`,"aria-labelledby":`storage-cleanup-tab-policy`,className:`storage-cleanup-card__body storage-cleanup-policy-split`,"data-active":c===`policy`?`true`:`false`,"aria-hidden":c!==`policy`,...c===`policy`?{}:{inert:!0},children:[(0,D.jsx)(G,{apiBase:e,locale:t,t:n,onDone:o}),(0,D.jsxs)(`aside`,{className:`storage-cleanup-manual`,"aria-labelledby":`storage-cleanup-manual-title`,children:[(0,D.jsx)(`h4`,{id:`storage-cleanup-manual-title`,className:`storage-cleanup-manual__title`,children:n(`storage.cleanup.title`)}),r>0?(0,D.jsx)(B,{apiBase:e,locale:t,t:n,onDone:o}):(0,D.jsx)(`p`,{className:`muted storage-manual-panel__status`,children:n(`storage.cleanup.noArchives`)})]})]}),(0,D.jsx)(`div`,{id:`storage-cleanup-panel-quarantine`,role:`tabpanel`,"aria-labelledby":`storage-cleanup-tab-quarantine`,className:`storage-cleanup-card__body`,"data-active":c===`quarantine`?`true`:`false`,"aria-hidden":c!==`quarantine`,...c===`quarantine`?{}:{inert:!0},children:i?(0,D.jsx)(V,{apiBase:e,locale:t,t:n,onDone:o,reloadToken:a,onEntriesChange:s}):(0,D.jsx)(`p`,{className:`muted storage-manual-panel__status`,children:n(`storage.trash.empty`)})})]})]})}function q({apiBase:e}){let{t,locale:n}=i(),r=`ocx.storage.report.v1:${e}`,o=d(r),[c,u]=(0,_.useState)(null),[h,g]=(0,_.useState)(0),v=(0,_.useRef)(!1),[y,b]=(0,_.useState)({apiBase:e,settled:!1,hasEntries:!1}),x=(0,_.useCallback)(async n=>{try{let i=await fetch(`${e}/api/storage`,{signal:n});if(!i.ok)throw Error(t(`storage.error`));let a=await i.json();return l(r,a),v.current&&(v.current=!1,u(t(`storage.rescanned`))),a}catch(e){throw v.current&&(v.current=!1,u(t(`storage.error`))),n.aborted?e:Error(t(`storage.error`),{cause:e})}},[e,r,t]),S=f(`storage-report:${e}`,[e],x,{isEmpty:e=>e.total.fileCount===0&&e.error===void 0}),C=S.state,w=C.data??o,T=C.refreshing||C.showSkeleton&&!w,E=S.refresh,O=(0,_.useCallback)(()=>{u(null),v.current=!0,E(),g(e=>e+1)},[E]),k=(0,_.useCallback)(t=>{b({apiBase:e,settled:!0,hasEntries:t.length>0})},[e]),A=y.apiBase===e&&y.settled,j=y.apiBase===e&&y.hasEntries,M=w?.error!==void 0,N=!T&&!C.showError&&!M&&w.total.fileCount===0&&A&&!j,P=w?.buckets.find(e=>e.key===`archived_sessions`)?.fileCount??0,F=!!w&&!M,L=F&&(w.total.fileCount>0||!A||j);return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`page-head`,children:[(0,D.jsx)(`h2`,{id:`storage-page-title`,children:t(`storage.title`)}),(0,D.jsxs)(`div`,{className:`storage-page-head-actions`,children:[(0,D.jsx)(`span`,{className:`storage-page-head-feedback`,role:`status`,"aria-live":`polite`,children:c??``}),(0,D.jsxs)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,disabled:T,onClick:()=>void O(),children:[(0,D.jsx)(s,{}),` `,t(`storage.refresh`)]})]})]}),(0,D.jsx)(`p`,{className:`page-sub`,children:t(`storage.subtitle`)}),w&&w.error===void 0&&(0,D.jsxs)(`p`,{className:`storage-page-meta`,children:[(0,D.jsx)(`code`,{className:`mono storage-page-meta__home`,title:w.codexHome,children:w.codexHome}),(0,D.jsx)(`span`,{className:`storage-page-meta__sep`,"aria-hidden":`true`,children:`·`}),(0,D.jsxs)(`span`,{children:[t(`storage.snapshot.lastScan`),`:`,` `,new Date(w.generatedAt).toLocaleString(n)]})]}),C.showSkeleton&&!w?(0,D.jsx)(m,{label:t(`storage.loading`),rows:5}):C.kind===`failed-cold`&&!w?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`div`,{className:`alert alert-err`,role:`alert`,children:C.error instanceof Error?C.error.message:t(`storage.error`)}),(0,D.jsx)(`button`,{type:`button`,className:`btn btn-ghost btn-sm`,onClick:()=>E(),children:t(`common.retry`)})]}):M?(0,D.jsx)(D.Fragment,{children:(0,D.jsx)(`div`,{className:`alert alert-err`,role:`alert`,children:t(`storage.error`)})}):(0,D.jsxs)(D.Fragment,{children:[C.showError&&(0,D.jsx)(`div`,{className:`alert alert-err`,role:`alert`,children:t(`storage.error`)}),N?(0,D.jsx)(a,{title:t(`storage.empty`)}):w&&w.total.fileCount>0&&(0,D.jsx)(I,{report:w,locale:n})]}),w&&w.error===void 0&&C.refreshing&&!C.showSkeleton&&(0,D.jsx)(p,{live:!C.showError,children:t(`storage.loading`)}),F&&(0,D.jsx)(K,{apiBase:e,locale:n,t,archivedCount:P,showQuarantine:L,trashReloadToken:h,onDone:()=>void O(),onTrashEntriesChange:k})]})}export{q as default};
|