ltcai 12.1.0 → 12.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +33 -36
- package/docs/CHANGELOG.md +18 -0
- package/docs/CI_AND_RELEASE_GATES.md +7 -4
- package/docs/COMMUNITY_AND_PLUGINS.md +1 -1
- package/docs/DEVELOPMENT.md +11 -11
- package/docs/ONBOARDING.md +1 -1
- package/docs/OPERATIONS.md +1 -1
- package/docs/TRUST_MODEL.md +1 -1
- package/docs/WHY_LATTICE.md +1 -1
- package/docs/kg-schema.md +1 -1
- package/lattice_brain/__init__.py +1 -1
- package/latticeai/__init__.py +1 -1
- package/latticeai/services/architecture_readiness.py +1 -1
- package/latticeai/services/product_readiness.py +1 -1
- package/package.json +1 -1
- package/scripts/check_current_release_docs.mjs +1 -1
- package/scripts/release_screen_claims.json +23 -0
- package/src-tauri/Cargo.lock +10 -10
- package/src-tauri/Cargo.toml +1 -1
- package/src-tauri/tauri.conf.json +1 -1
- package/static/app/asset-manifest.json +45 -45
- package/static/app/assets/{Act-DCRUH46a.js → Act-BjGgeuQd.js} +2 -2
- package/static/app/assets/{AdminConsole-BFBj6OvN.js → AdminConsole-C6hcJGMr.js} +1 -1
- package/static/app/assets/{Brain-BXcoxIvb.js → Brain-CNQnIaA8.js} +2 -2
- package/static/app/assets/BrainHome-CGJ6O69l.js +2 -0
- package/static/app/assets/{BrainSignals-DrfYSNjR.js → BrainSignals-DONPljxz.js} +1 -1
- package/static/app/assets/{Capture-BsO_OAeh.js → Capture-BMCC5544.js} +1 -1
- package/static/app/assets/{Chronicle-BUj_UH3D.js → Chronicle-DF6sOonx.js} +1 -1
- package/static/app/assets/{CommandPalette-B4SWOaR-.js → CommandPalette-DiWyutdM.js} +1 -1
- package/static/app/assets/{DigitalBrainExplorer-S1GSsyIT.js → DigitalBrainExplorer-BL3V6Dqz.js} +1 -1
- package/static/app/assets/{Library-CKUR2eVb.js → Library-B-ue9hXL.js} +1 -1
- package/static/app/assets/{LivingBrain--2UoV3Ki.js → LivingBrain-b1RiM5Rh.js} +1 -1
- package/static/app/assets/{ProductFlow-D7rB6Xsu.js → ProductFlow-wZIKJW7G.js} +1 -1
- package/static/app/assets/{ReviewCard-UzQZ1ULT.js → ReviewCard-D1fGTEn7.js} +1 -1
- package/static/app/assets/{RunsListPanel-CDGFQYMo.js → RunsListPanel-DAirtLkS.js} +1 -1
- package/static/app/assets/System-BEI1eoC4.js +1 -0
- package/static/app/assets/{WorkflowGraph-BIcWZTUQ.js → WorkflowGraph-qrI6GU4R.js} +1 -1
- package/static/app/assets/{WorkflowsPanel-BeT5fmbk.js → WorkflowsPanel-CIMNTw-O.js} +2 -2
- package/static/app/assets/{actHelpers-DhutJObL.js → actHelpers-BMukIRnQ.js} +1 -1
- package/static/app/assets/arrow-left-iVa1goff.js +1 -0
- package/static/app/assets/{bot-D8tZzKMD.js → bot-Dkd-DbiP.js} +1 -1
- package/static/app/assets/brain-BsexlNOA.js +1 -0
- package/static/app/assets/{button-Tzf5D7L1.js → button-BA0N_zId.js} +1 -1
- package/static/app/assets/circle-check-BxaDWjPR.js +1 -0
- package/static/app/assets/{circle-pause-Druue_tZ.js → circle-pause-918Kuvk0.js} +1 -1
- package/static/app/assets/{circle-play-BAht4SSW.js → circle-play-CS0IbVDV.js} +1 -1
- package/static/app/assets/{cpu-BPbmZRPp.js → cpu-BpvoWsjk.js} +1 -1
- package/static/app/assets/{download-BmxPZEwU.js → download-BvkMLLLN.js} +1 -1
- package/static/app/assets/{folder-open-DokOmFQJ.js → folder-open-YmGugIBf.js} +1 -1
- package/static/app/assets/{hard-drive-Cw6aEA2h.js → hard-drive-BOzmS-cq.js} +1 -1
- package/static/app/assets/{index-CB93CZWW.css → index-C8gwOf0C.css} +1 -1
- package/static/app/assets/{index-DhszK7A3.js → index-CfeqZ9Ri.js} +3 -3
- package/static/app/assets/{input-BCdHoZXA.js → input-CFfCfMjO.js} +1 -1
- package/static/app/assets/{link-2-CCModn4z.js → link-2-CcYzeM7M.js} +1 -1
- package/static/app/assets/{permissionCopy-BSp1jYG7.js → permissionCopy-B23r24oX.js} +1 -1
- package/static/app/assets/{primitives-D01WcJn7.js → primitives-BDryQl6H.js} +1 -1
- package/static/app/assets/search-DHsPwmPw.js +1 -0
- package/static/app/assets/{share-2-DMMkM8Iu.js → share-2-B-gPv2ec.js} +1 -1
- package/static/app/assets/{shield-alert--mrCWQko.js → shield-alert-CfyRO1p0.js} +1 -1
- package/static/app/assets/{sourceMeta-nvd3Cdz3.js → sourceMeta-C4LDEy1S.js} +1 -1
- package/static/app/assets/{textarea-DfayhQiX.js → textarea-BdVMYEb1.js} +1 -1
- package/static/app/assets/{useFocusTrap-C5NsTvsI.js → useFocusTrap-CV73DLHn.js} +1 -1
- package/static/app/assets/{useMutation-D7IMQTeI.js → useMutation-B8QKq2NW.js} +1 -1
- package/static/app/assets/workspace-BmfVs66W.js +1 -0
- package/static/app/index.html +2 -2
- package/static/sw.js +1 -1
- package/static/app/assets/BrainHome-IhcEPC3v.js +0 -2
- package/static/app/assets/System-0OSxZrTp.js +0 -1
- package/static/app/assets/arrow-left-BwJfcH8J.js +0 -1
- package/static/app/assets/brain-DP2JPXSV.js +0 -1
- package/static/app/assets/circle-check-D68nHcgS.js +0 -1
- package/static/app/assets/search-C_zAGfvO.js +0 -1
- package/static/app/assets/workspace-C7xidB7c.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{n as r}from"./QueryClientProvider-B3OjqSyJ.js";import{t as i}from"./useMutation-D7IMQTeI.js";import{t as a}from"./circle-check-D68nHcgS.js";import{t as o}from"./circle-pause-Druue_tZ.js";import{A as s,E as c,H as l,O as u,R as d,S as f,c as p,f as m,l as h,p as g,v as _}from"./index-DhszK7A3.js";var ee=d(`brain-circuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),te=d(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),v=d(`database-backup`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 12a9 3 0 0 0 5 2.69`,key:`1ui2ym`}],[`path`,{d:`M21 9.3V5`,key:`6k6cib`}],[`path`,{d:`M3 5v14a9 3 0 0 0 6.47 2.88`,key:`i62tjy`}],[`path`,{d:`M12 12v4h4`,key:`1bxaet`}],[`path`,{d:`M13 20a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L12 16`,key:`1f4ei9`}]]),y=d(`folder-sync`,[[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v.5`,key:`1dkoa9`}],[`path`,{d:`M12 10v4h4`,key:`1czhmt`}],[`path`,{d:`m12 14 1.535-1.605a5 5 0 0 1 8 1.5`,key:`lvuxfi`}],[`path`,{d:`M22 22v-4h-4`,key:`1ewp4q`}],[`path`,{d:`m22 18-1.535 1.605a5 5 0 0 1-8-1.5`,key:`14ync0`}]]),b=e(t());function ne(e){return p(e).flatMap(e=>{let t=V(e,[`id`,`conversation_id`]);return t?[{id:t,title:V(e,[`title`,`summary`,`last_message`],t).trim(),messageCount:Math.max(0,Math.round(G(e,[`message_count`,`messages`]))),updatedAt:U(e,[`updated_at`,`updatedAt`,`created_at`,`createdAt`])}]:[]}).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0))}function re(e){return p((B(e)?e:{}).messages).flatMap(e=>{let t=V(e,[`role`]),n=typeof e.content==`string`?e.content:``;return t!==`user`&&t!==`assistant`||!n.trim()?[]:[{role:t,content:n}]})}function ie(e,t,n){let r=V(e,[`id`]);if(r){let e=`brain.memoryTier.${r}`,n=f(t,e);if(n!==e)return n}return n}function ae(e,t,n=`ko`){let r=B(e)?e:{},i=(p(r.sources).length?p(r.sources):p(r.tiers)).map((e,t)=>({id:V(e,[`id`,`source`,`label`],`memory-${t}`),title:ie(e,n,V(e,[`title`,`label`,`source`,`path`,`name`],`Workspace memory`)),kind:H(e,[`type`,`source_type`,`kind`,`health`],`Memory`),tags:[],agentGenerated:!1})),a=p(r.recent_memories||r.recentMemories).map((e,t)=>{let n=B(e.metadata)?e.metadata:{},r=W(e,[`tags`]),i=V(e,[`content`,`summary`,`detail`]),a=V(n,[`source`]),o=r.includes(`agent-synthesis`)||a===`agent_runtime`||a===`agent_runtime_synthesis`;return{id:V(e,[`id`],`recent-memory-${t}`),title:i?i.replace(/\s+/g,` `).slice(0,96):H(e,[`kind`],`Memory`),kind:H(e,[`kind`],`Memory`),detail:i,tags:r,agentGenerated:o}}),o=p(t).map((e,t)=>({id:V(e,[`id`,`conversation_id`],`conversation-${t}`),title:V(e,[`title`,`summary`,`id`],`Conversation`),kind:`Conversation`,tags:[],agentGenerated:!1}));return R([...a,...i,...o]).slice(0,12)}function oe(e){let t=B(e)?e:{},n=p(t.nodes),r=p(t.edges),i=n.flatMap(e=>{let t=V(e,[`id`,`node_id`,`title`,`label`]);if(!t)return[];let n=B(e.metadata)?e.metadata:{},r=H(e,[`type`,`kind`,`category`],`Concept`),i=V(e,[`title`,`label`,`name`],t.replace(/^[^:]+:/,``)),a=V(e,[`summary`,`description`,`snippet`])||V(n,[`summary`,`description`,`relative_path`,`filename`]),o=h(G(e,[`importance_norm`,`importance`,`score`])||.5,.08,1),s=U(e,[`created_at`,`createdAt`,`added_at`,`addedAt`,`timestamp`,`updated_at`,`updatedAt`])??U(n,[`created_at`,`createdAt`,`added_at`,`addedAt`,`timestamp`,`updated_at`,`updatedAt`]);return[{id:t,label:i,type:r,summary:a,importance:o,...s===void 0?{}:{createdAt:s}}]}).sort((e,t)=>t.importance-e.importance),a=new Set(i.map(e=>e.id));return{nodes:i,edges:r.flatMap((e,t)=>{let n=V(e,[`from`,`source`,`source_id`]),r=V(e,[`to`,`target`,`target_id`]);return!n||!r||!a.has(n)||!a.has(r)?[]:[{id:V(e,[`id`],`edge-${t}`),source:n,target:r,label:H(e,[`type`,`label`,`relationship`],`Relates`),weight:G(e,[`weight`,`score`,`confidence`])||1}]})}}function se(e){let t=B(e)?e:{},n=[t,t.knowledge_graph,t.ingestion,t.result].filter(B),r=new Set,i=0,a,o;for(let e of n){let t=V(e,[`node_id`,`graph_node`,`graph_node_id`]);t&&r.add(t);for(let t of p(e.indexed_nodes))if(typeof t==`string`&&t.trim())r.add(t.trim());else if(B(t)){let e=V(t,[`node_id`,`graph_node_id`,`id`]);e&&r.add(e)}i=Math.max(i,G(e,[`chunk_count`,`chunks`,`indexed_count`])),typeof e.duplicate==`boolean`&&(a=e.duplicate),o||=V(e,[`provenance_id`])}let s;for(let e of n){let t=ce(e);if(t){s=t;break}}return{nodeIds:Array.from(r),chunkCount:i,...a===void 0?{}:{duplicate:a},...o?{provenanceId:o}:{},...s?{extraction:s}:{}}}function ce(e){let t=B(e)?e:{},n=B(t.extraction_quality)?t.extraction_quality:null;if(!n)return null;let r=V(n,[`level`]);if(r!==`high`&&r!==`medium`&&r!==`low`)return null;let i=W(t,[`warnings`]).length?W(t,[`warnings`]):W(n,[`warnings`]);return{score:G(n,[`score`]),level:r,reasons:W(n,[`reasons`]),warnings:i}}function le(e){let t=B(e)?e:{},n=B(t.context_quality)?t.context_quality:null,r=!n&&B(t.trace)&&B(t.trace.context_quality)?t.trace.context_quality:null,i=n||r||(typeof t.mode==`string`&&typeof t.limited==`boolean`?t:null);if(!i)return null;let a=V(i,[`mode`]);if(!a)return null;let o=typeof i.reason==`string`&&i.reason.trim()?i.reason.trim():null;return{mode:a,nodes:Math.max(0,Math.round(G(i,[`nodes`]))),limited:K(i,[`limited`],!1),reason:o}}function ue(e){let t=B(e)?e:{},n=(B(t.grounding)?t.grounding:null)||(typeof t.status==`string`&&`label`in t?t:null);if(!n)return null;let r=V(n,[`status`]);return[`supported`,`unsupported`,`no_context`].includes(r)?{status:r,reason:typeof n.reason==`string`&&n.reason.trim()?n.reason.trim():null}:null}function de(e){if(!B(e))return null;let t=V(e,[`type`]);if(t&&t!==`hybrid_context`)return null;let n=Array.isArray(e.node_ids)||Array.isArray(e.nodeIds);return t!==`hybrid_context`&&!n?null:{nodeIds:W(e,[`node_ids`,`nodeIds`]),keywords:W(e,[`keywords`])}}function fe(e){if(!B(e))return null;let t=V(e,[`type`]);return t&&t!==`hybrid_done`||t!==`hybrid_done`&&!(`answer`in e)&&!(`kg_expansion`in e)&&!(`kgExpansion`in e)?null:{answer:typeof e.answer==`string`?e.answer:``,provider:V(e,[`provider`]),model:V(e,[`model`]),sentNodeIds:W(e,[`sent_node_ids`,`sentNodeIds`]),expansion:pe(e.kg_expansion??e.kgExpansion)}}function pe(e){if(!B(e))return null;let t=V(e,[`status`]),n=B(e.plan)?e.plan:{},r=B(n.provenance)?n.provenance:{},i=G(e,[`candidate_count`,`candidateCount`]),a=G(r,[`candidate_count`,`candidateCount`]),o=Array.isArray(n.new_nodes)?n.new_nodes.length:0,s=Math.max(0,Math.round(i||a||o)),c=t===`staged`||t===`queued_for_review`||!!e.review_item_id;return{status:t||`staged`,candidateCount:s,stagedForReview:c}}function me(e,t=0){return{provider:e.provider,model:e.model,sentNodeCount:e.sentNodeIds.length||t,expansion:e.expansion}}function x(e){if(!B(e))return null;let t=V(e,[`status`]);if(t!==`ok`&&t!==`pending`&&t!==`failed`)return null;let n=V(e,[`detail`]);return{status:t,...n?{detail:n}:{}}}function he(e){let t=!!e.generation?.repaired,n=new Map;for(let t of e.artifacts||[])t&&typeof t.path==`string`&&n.set(t.path,!!t.previewable);let r=new Map,i=null;if(Array.isArray(e.brain_ingest))for(let t of e.brain_ingest){let e=x(t);e&&B(t)&&typeof t.path==`string`&&r.set(t.path,e)}else i=x(e.brain_ingest);let a=e.created_files||[];return a.map(e=>{let o=r.get(e.path)||(a.length===1?i:null);return{path:e.path,filename:e.filename||e.path.split(`/`).pop()||e.path,bytes:e.bytes||0,repaired:t,...n.has(e.path)?{previewable:n.get(e.path)}:{},...o?{brainIngest:o}:{}}})}function S(e){if(!B(e))return null;let t=V(e,[`phase`]),n=V(e,[`event`]);if(!t||!n)return null;let r=Number(e.step);return{phase:t,event:n,...V(e,[`action`])?{action:V(e,[`action`])}:{},...V(e,[`path`])?{path:V(e,[`path`])}:{},...Number.isFinite(r)?{step:Math.round(r)}:{},...typeof e.ok==`boolean`?{ok:e.ok}:{},...V(e,[`decision`])?{decision:V(e,[`decision`])}:{},...V(e,[`verdict`])?{verdict:V(e,[`verdict`])}:{},...V(e,[`state`])?{state:V(e,[`state`])}:{},...V(e,[`detail`,`error`])?{detail:V(e,[`detail`,`error`])}:{}}}function C(e){return p(e).flatMap(e=>{if(!B(e))return[];let t=V(e,[`action`,`tool`]),n=V(e,[`state`]),r=V(e,[`error`]);if(!t&&!n&&!r)return[];let i=V(B(e.args)?e.args:{},[`path`,`target`,`file`]);return t?[{phase:`execute`,event:`tool`,action:t,...i?{path:i}:{},ok:!r,...r?{detail:r}:{}}]:r?[{phase:`execute`,event:`state`,...n?{state:n}:{},ok:!1,detail:r}]:[{phase:`terminal`,event:`state`,state:n}]})}function w(e){if(!B(e))return null;let t={};if(B(e.repairs))for(let[n,r]of Object.entries(e.repairs)){let e=Number(r);Number.isFinite(e)&&e>0&&(t[n]=Math.round(e))}let n=Math.max(0,Math.round(G(e,[`parse_errors`,`parseErrors`]))),r=Math.max(0,Math.round(G(e,[`parse_recovered`,`parseRecovered`]))),i=Object.values(t).reduce((e,t)=>e+t,0)+r;return i<1?null:{repairs:t,parseErrors:n,parseRecovered:r,total:i}}function T(e,t){if(!B(e))return null;let n=e=>{if(!B(e))return``;let n=e[t];return typeof n==`string`?n:``},r=n(e.headline),i=p(e.details).map(n).filter(Boolean),a=V(e,[`code`]);if(!r&&!i.length)return null;let o=B(e.model_strain)?V(e.model_strain,[`level`]):``,s=o===`light`||o===`moderate`||o===`heavy`?o:`none`,c=e.ok===!0;return c&&!i.length?null:{code:a,ok:c,headline:r,details:i,strainLevel:s}}function E(e){return p((B(e)?e:{}).pending).flatMap(e=>{let t=V(e,[`run_id`,`runId`]);return t?[{runId:t,goal:V(e,[`goal`]),expiresAt:V(e,[`expires_at`,`expiresAt`])}]:[]})}function D(e){let t=B(e)?e:{},n=p(t.watches).flatMap(e=>{if(!B(e))return[];let t=V(e,[`id`]),n=V(e,[`path`]);if(!t&&!n)return[];let r=B(e.last_result)?e.last_result:null,i=p(e.last_errors).flatMap(e=>{if(typeof e==`string`&&e.trim())return[{path:``,detail:e.trim()}];if(!B(e))return[];let t=V(e,[`detail`,`reason`,`error`]),n=V(e,[`path`,`source`,`file`]);return!t&&!n?[]:[{path:n,detail:t}]});return[{id:t||n,path:n,enabled:K(e,[`enabled`],!1),lastScanAt:V(e,[`last_scan_at`,`lastScanAt`]),lastResult:r?{status:V(r,[`status`]),ingested:Math.max(0,Math.round(G(r,[`ingested`]))),failed:Math.max(0,Math.round(G(r,[`failed`])))}:null,trackedFiles:Math.max(0,Math.round(G(e,[`tracked_files`,`trackedFiles`]))),lastErrors:i.slice(0,3)}]});return{enabledCount:Math.max(0,Math.round(G(t,[`enabled_count`,`enabledCount`]))),polling:K(t,[`polling`],!1),intervalSeconds:Math.max(0,Math.round(G(t,[`interval_seconds`,`intervalSeconds`]))),watches:n}}function O(e){let t=B(e)?e:{};return{status:V(t,[`status`],`unavailable`),pendingItems:Math.max(0,Math.round(G(t,[`pending_items`,`pendingItems`]))),totalItems:Math.max(0,Math.round(G(t,[`total_items`,`totalItems`]))),detail:V(t,[`detail`])}}function k(e){return typeof e==`string`?e.trim():B(e)?[V(e,[`source`,`path`,`file`]),V(e,[`detail`,`reason`,`error`])].filter(Boolean).join(` — `):``}function A(e){return p((B(e)?e:{}).jobs).flatMap(e=>{let t=V(e,[`job_id`,`jobId`,`id`]);if(!t)return[];let n=V(e,[`created_at`,`createdAt`]),r=V(e,[`updated_at`,`updatedAt`]);return[{jobId:t,status:V(e,[`status`],`queued`),total:Math.max(0,Math.round(G(e,[`total`]))),processed:Math.max(0,Math.round(G(e,[`processed`]))),failed:Math.max(0,Math.round(G(e,[`failed`]))),errors:p(e.errors).map(k).filter(Boolean).slice(0,10),...n?{createdAt:n}:{},...r?{updatedAt:r}:{}}]})}function j(e,t){for(let n of[`recommended`,`cloud`,`loaded`,`loaded_models`,`models`])for(let r of p(e[n])){if(V(r,[`id`,`model_id`,`name`])!==t)continue;let e=V(r,[`display_name`,`model_name`,`name`]);if(e&&e!==t)return e}return``}function M(e){let t=B(e)?e:{},n=V(t,[`current`,`current_model`,`local_model`]);if(n)return j(t,n)||m(n);let r=p(t.loaded||t.loaded_models).find(e=>e.id||e.name||e.model_id);if(!r)return`local mind`;let i=V(r,[`display_name`,`model_name`,`name`]),a=V(r,[`id`,`model_id`]);return i&&i!==a?i:a?j(t,a)||m(a):`local mind`}function N(e){let t=B(e)?e:{};return V(t,[`current`,`current_model`,`local_model`])?!0:p(t.loaded||t.loaded_models).some(e=>e.id||e.name||e.model_id)}function P(e,t,n){let r=B(e)?e:{},i=B(r.brain_readiness)?r.brain_readiness:{},a=V(i,[`state`]),o=G(i,[`depth`]),s=G(i,[`score`]);if((a===`quiet`||a===`forming`||a===`alive`)&&ve(o)){let e=B(i.signals)?i.signals:{};return{score:h(Math.round(s||0),0,100),state:a,depth:o,titleKey:V(i,[`title_key`,`titleKey`],`brain.readiness.${a}`),actionKey:V(i,[`action_key`,`actionKey`],_e(a)),source:`memory_service`,signals:{memoryCount:G(e,[`memory_count`,`memoryCount`]),conceptCount:G(e,[`concept_count`,`conceptCount`]),relationshipCount:G(e,[`relationship_count`,`relationshipCount`]),healthySources:G(e,[`healthy_sources`,`healthySources`])}}}return ge(t,n)}function F(e,t=``){let n=B(e)&&typeof e.ok==`boolean`&&`data`in e?e:null;if(n&&!n.ok)return I(t);let r=n?n.data:e,i=B(r)?r:{},a=B(i.model_continuity)?i.model_continuity:{},o=B(i.proofs)?i.proofs:{},s=B(i.recall)?i.recall:{},c=B(i.claims)?i.claims:{},l=G(o,[`durable_items`,`durableItems`]);return{status:V(i,[`status`],`quiet`),modelContinuity:{activeModel:V(a,[`active_model`,`activeModel`],t),brainOwner:V(a,[`brain_owner`,`brainOwner`],`lattice_brain`),capability:K(a,[`capability`],!0),survivesModelSwitch:K(a,[`survives_model_switch`,`survivesModelSwitch`],!1),proven:K(a,[`proven`],!1),contextStore:V(a,[`context_store`,`contextStore`],`workspace + conversation + graph + vector`)},proofs:{durableItems:l,hasDurableEvidence:K(o,[`has_durable_evidence`,`hasDurableEvidence`],l>0),workspaceMemories:G(o,[`workspace_memories`,`workspaceMemories`]),conversations:G(o,[`conversations`]),graphConcepts:G(o,[`graph_concepts`,`graphConcepts`]),vectorItems:G(o,[`vector_items`,`vectorItems`]),healthySources:G(o,[`healthy_sources`,`healthySources`])},recall:{query:V(s,[`query`]),count:G(s,[`count`]),items:p(s.items).map((e,t)=>({id:V(e,[`id`],`recall-${t}`),source:H(e,[`source`],`Memory`),title:V(e,[`title`],`Memory`),snippet:V(e,[`snippet`]),score:G(e,[`score`]),matchedTerms:W(e,[`matched_terms`,`matchedTerms`]),confidence:be(e,G(e,[`score`])),locator:V(e,[`locator`]),kind:V(e,[`kind`]),caption:V(e,[`caption`]),thumbnail:ye(e)}))},claims:{canRecallUserContext:K(c,[`can_recall_user_context`,`canRecallUserContext`],!1),keepsContextAcrossModels:K(c,[`keeps_context_across_models`,`keepsContextAcrossModels`],!1),isKnowledgeStore:K(c,[`is_knowledge_store`,`isKnowledgeStore`],!1)}}}function I(e){return{status:`unavailable`,modelContinuity:{activeModel:e,brainOwner:``,capability:!1,survivesModelSwitch:!1,proven:!1,contextStore:``},proofs:{durableItems:0,hasDurableEvidence:!1,workspaceMemories:0,conversations:0,graphConcepts:0,vectorItems:0,healthySources:0},recall:{query:``,count:0,items:[]},claims:{canRecallUserContext:!1,keepsContextAcrossModels:!1,isKnowledgeStore:!1}}}function L(e){let t=B(e)?e:{},n=B(t.focus)?t.focus:{},r=p(t.next_actions||t.nextActions),i=p(t.suggested_questions||t.suggestedQuestions),a=p(t.proactive_actions||t.proactiveActions),o=p(t.evidence),s=r.length?r:[{id:`add_source`,label_key:`brain.brief.action.add`,detail_key:`brain.brief.action.add.detail`,route:`/capture`,priority:10},{id:`ask_brain`,label_key:`brain.brief.action.ask`,detail_key:`brain.brief.action.ask.detail`,route:``,priority:9}],c=o.length?o:[{id:`durable`,label_key:`brain.brief.evidence.durable`,value:0,detail_key:`brain.brief.evidence.durable.detail`},{id:`graph`,label_key:`brain.brief.evidence.graph`,value:0,detail_key:`brain.brief.evidence.graph.detail`},{id:`sources`,label_key:`brain.brief.evidence.sources`,value:0,detail_key:`brain.brief.evidence.sources.detail`}];return{status:V(t,[`status`],`quiet`),score:h(Math.round(G(t,[`score`])),0,100),headlineKey:V(t,[`headline_key`,`headlineKey`],`brain.brief.headline.quiet`),bodyKey:V(t,[`body_key`,`bodyKey`],`brain.brief.body.quiet`),focus:{kind:V(n,[`kind`],`empty`),title:V(n,[`title`]),detail:V(n,[`detail`]),source:H(n,[`source`],`Memory`),score:G(n,[`score`]),empty:K(n,[`empty`],!V(n,[`title`]))},nextActions:s.map(e=>({id:V(e,[`id`],`ask_brain`),labelKey:V(e,[`label_key`,`labelKey`],`brain.brief.action.ask`),detailKey:V(e,[`detail_key`,`detailKey`],`brain.brief.action.ask.detail`),route:V(e,[`route`]),priority:G(e,[`priority`])})),suggestedQuestions:i.map(e=>({id:V(e,[`id`],`suggested-question`),labelKey:V(e,[`label_key`,`labelKey`],`brain.suggestion.focus.label`),detailKey:V(e,[`detail_key`,`detailKey`],`brain.suggestion.focus.detail`),promptKey:V(e,[`prompt_key`,`promptKey`],`brain.suggestion.focus.prompt`),params:z(e.params),priority:G(e,[`priority`])})).sort((e,t)=>t.priority-e.priority),proactiveActions:a.map(e=>({id:V(e,[`id`],`proactive-action`),intent:V(e,[`intent`],`ask`),labelKey:V(e,[`label_key`,`labelKey`],`brain.proactive.evidence.label`),detailKey:V(e,[`detail_key`,`detailKey`],`brain.proactive.evidence.detail`),prompt:V(e,[`prompt`]),route:V(e,[`route`]),priority:G(e,[`priority`]),context:z(e.context)})).sort((e,t)=>t.priority-e.priority),evidence:c.map(e=>({id:V(e,[`id`],`evidence`),labelKey:V(e,[`label_key`,`labelKey`],`brain.brief.evidence.durable`),value:G(e,[`value`]),detailKey:V(e,[`detail_key`,`detailKey`],`brain.brief.evidence.durable.detail`)})),generatedAt:V(t,[`generated_at`,`generatedAt`])}}function R(e){let t=new Set;return e.filter(e=>t.has(e.id)?!1:(t.add(e.id),!0))}function z(e){return B(e)?Object.entries(e).reduce((e,[t,n])=>((typeof n==`string`||typeof n==`number`)&&(e[t]=n),e),{}):{}}function ge(e,t){let n=Math.min(100,Math.round(e*12+t*10));return e<1?{score:Math.max(12,n),state:`quiet`,depth:2,titleKey:`brain.readiness.quiet`,actionKey:`brain.readiness.start`,source:`frontend_fallback`,signals:{memoryCount:e,conceptCount:t,relationshipCount:0,healthySources:0}}:t<3?{score:Math.max(38,n),state:`forming`,depth:3,titleKey:`brain.readiness.forming`,actionKey:`brain.readiness.grow`,source:`frontend_fallback`,signals:{memoryCount:e,conceptCount:t,relationshipCount:0,healthySources:0}}:{score:Math.max(72,n),state:`alive`,depth:5,titleKey:`brain.readiness.alive`,actionKey:`brain.readiness.map`,source:`frontend_fallback`,signals:{memoryCount:e,conceptCount:t,relationshipCount:0,healthySources:0}}}function _e(e){return e===`quiet`?`brain.readiness.start`:e===`forming`?`brain.readiness.grow`:`brain.readiness.map`}function ve(e){return e>=1&&e<=5&&Number.isInteger(e)}var B=g;function V(e,t,n=``){for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t;if(typeof t==`number`&&Number.isFinite(t))return String(t)}return n}function H(e,t,n=``){return V(e,t,n).replace(/[_-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function U(e,t){for(let n of t){let t=e[n];if(typeof t==`number`&&Number.isFinite(t))return t<0xe8d4a51000?t*1e3:t;if(typeof t==`string`&&t.trim()){let e=Number(t);if(Number.isFinite(e)&&/^\d+$/.test(t.trim()))return e<0xe8d4a51000?e*1e3:e;let n=Date.parse(t);if(Number.isFinite(n))return n}}}function W(e,t){for(let n of t){let t=e[n];if(Array.isArray(t))return t.filter(e=>typeof e==`string`&&e.trim().length>0)}return[]}function ye(e){let t=e.thumbnail;return typeof t==`string`&&t.startsWith(`data:image/`)?t:``}function be(e,t){let n=e.confidence;return n===`high`||n===`medium`||n===`low`?n:t>=.65?`high`:t>=.3?`medium`:`low`}function G(e,t){for(let n of t){let t=Number(e[n]);if(Number.isFinite(t))return t}return 0}function K(e,t,n){for(let n of t){let t=e[n];if(typeof t==`boolean`)return t}return n}var q=n();function J(){let e=l({queryKey:[`vectorFreshness`],queryFn:_.brainVectorFreshness,staleTime:6e4,refetchOnWindowFocus:!1,retry:!1});return b.useMemo(()=>e.data?.ok?O(e.data.data):null,[e.data])}function xe({language:e}){let t=r(),n=J(),a=i({mutationFn:()=>_.memoryRebuild(),onSuccess:async()=>{await t.invalidateQueries({queryKey:[`vectorFreshness`]})}});if(!n||n.status!==`stale_embedder`)return null;let o=a.isSuccess&&a.data&&!a.data.ok;return(0,q.jsxs)(`div`,{className:`brain-stale-embedder`,role:`status`,"data-testid":`stale-embedder-notice`,children:[(0,q.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:f(e,`brain.freshness.staleEmbedder`)}),(0,q.jsx)(`small`,{children:f(e,`brain.freshness.staleEmbedder.detail`)}),o?(0,q.jsx)(`small`,{className:`is-error`,children:f(e,`brain.freshness.reindex.failed`)}):null]}),(0,q.jsx)(`button`,{type:`button`,"data-testid":`stale-embedder-reindex`,disabled:a.isPending,onClick:()=>a.mutate(),children:f(e,a.isPending?`brain.freshness.reindex.running`:`brain.freshness.reindex`)})]})}function Se({language:e}){let t=J();return!t||t.status!==`pending`||t.pendingItems<1?null:(0,q.jsxs)(`p`,{className:`brain-freshness-chip`,role:`status`,"data-testid":`vector-freshness-chip`,children:[(0,q.jsx)(te,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:f(e,`brain.freshness.pending`,{count:t.pendingItems})})]})}var Y=new Set([`queued`,`running`]),X=new Set([`failed`,`partial`]);function Z(e){return Y.has(e.status)}function Ce(e){return e===`queued`||e===`running`||e===`completed`||e===`failed`||e===`partial`?`brain.jobs.status.${e}`:`brain.jobs.status.queued`}var we=new Set([`completed`,`partial`]),Q=3;function Te({language:e,job:t,freshness:n,onDismiss:r}){let i=n&&n.totalItems>0&&(n.status===`ready`||n.status===`pending`)?Math.max(0,Math.min(100,Math.round((n.totalItems-n.pendingItems)/n.totalItems*100))):null,o=t.errors.slice(0,Q);return(0,q.jsxs)(`div`,{className:`brain-jobs-report lattice-success-pulse is-${t.status}`,role:`status`,"data-testid":`ingestion-job-report`,children:[(0,q.jsxs)(`div`,{className:`brain-jobs-report-head`,children:[(0,q.jsx)(a,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,q.jsx)(`strong`,{children:f(e,t.status===`partial`?`brain.jobs.report.titlePartial`:`brain.jobs.report.title`)}),r?(0,q.jsx)(`button`,{type:`button`,className:`brain-jobs-report-dismiss`,"aria-label":f(e,`brain.jobs.report.dismiss`),onClick:r,children:(0,q.jsx)(c,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})}):null]}),(0,q.jsxs)(`div`,{className:`brain-jobs-report-stats`,children:[t.processed>0?(0,q.jsx)(`span`,{className:`brain-jobs-report-stat`,children:f(e,`brain.jobs.report.documents`,{count:t.processed})}):null,t.failed>0?(0,q.jsx)(`span`,{className:`brain-jobs-report-stat is-failed`,children:f(e,`brain.jobs.failedCount`,{count:t.failed})}):null,i===null?null:(0,q.jsx)(`span`,{className:`brain-jobs-report-stat`,children:f(e,`brain.jobs.report.vector`,{percent:i})})]}),o.length?(0,q.jsxs)(`div`,{className:`brain-jobs-report-samples`,children:[(0,q.jsx)(`small`,{children:f(e,`brain.jobs.report.skipped`)}),(0,q.jsx)(`ul`,{children:o.map(e=>(0,q.jsx)(`li`,{children:e},e))})]}):null]})}function Ee({language:e}){let t=r(),n=J(),a=l({queryKey:[`ingestionJobs`],queryFn:_.ingestionJobs,refetchOnWindowFocus:!1,retry:!1,refetchInterval:e=>{let t=e.state.data;return t?.ok&&A(t.data).some(Z)?4e3:!1}}),o=i({mutationFn:e=>_.resumeIngestionJob(e),onSettled:()=>void t.invalidateQueries({queryKey:[`ingestionJobs`]})}),c=b.useMemo(()=>a.data?.ok?A(a.data.data):[],[a.data]),d=b.useRef(new Map),[p,m]=b.useState([]);b.useEffect(()=>{let e=d.current,t=[];for(let n of c){let r=e.get(n.jobId);r&&Y.has(r)&&we.has(n.status)&&t.push(n.jobId),e.set(n.jobId,n.status)}t.length&&m(e=>[...t,...e.filter(e=>!t.includes(e))].slice(0,2))},[c]);let h=p.map(e=>c.find(t=>t.jobId===e)).filter(e=>!!e),g=c.filter(e=>Z(e)||X.has(e.status)).slice(0,4);return!g.length&&!h.length?null:(0,q.jsxs)(`section`,{className:`brain-jobs-panel`,"aria-label":f(e,`brain.jobs.aria`),"data-testid":`ingestion-jobs-panel`,children:[h.map(t=>(0,q.jsx)(Te,{language:e,job:t,freshness:n,onDismiss:()=>m(e=>e.filter(e=>e!==t.jobId))},t.jobId)),g.length?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`header`,{className:`brain-jobs-head`,children:(0,q.jsx)(`strong`,{children:f(e,`brain.jobs.title`)})}),(0,q.jsx)(`ul`,{className:`brain-jobs-list`,children:g.map(t=>{let n=Math.max(t.total,t.processed,1),r=Math.min(100,Math.round(t.processed/n*100)),i=X.has(t.status),a=o.isPending&&o.variables===t.jobId;return(0,q.jsxs)(`li`,{className:`brain-jobs-item is-${t.status}`,children:[(0,q.jsxs)(`div`,{className:`brain-jobs-item-row`,children:[(0,q.jsx)(`span`,{className:`brain-jobs-status`,children:f(e,Ce(t.status))}),(0,q.jsx)(`span`,{className:`brain-jobs-counts`,children:f(e,`brain.jobs.progress`,{processed:t.processed,total:t.total})}),t.failed>0?(0,q.jsxs)(`span`,{className:`brain-jobs-failed`,children:[(0,q.jsx)(u,{className:`h-3 w-3`,"aria-hidden":`true`}),f(e,`brain.jobs.failedCount`,{count:t.failed})]}):null]}),(0,q.jsx)(`div`,{className:`brain-jobs-bar`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r,"aria-label":f(e,`brain.jobs.progressAria`,{processed:t.processed,total:t.total}),children:(0,q.jsx)(`span`,{className:`brain-jobs-bar-fill`,style:{width:`${r}%`}})}),i?(0,q.jsxs)(`button`,{type:`button`,className:`brain-jobs-resume`,disabled:o.isPending,onClick:()=>o.mutate(t.jobId),children:[(0,q.jsx)(s,{className:`h-3 w-3`,"aria-hidden":`true`}),a?f(e,`brain.jobs.resuming`):f(e,`brain.jobs.resume`)]}):null]},t.jobId)})})]}):null]})}function $(e){return e.split(/[\\/]/).filter(Boolean).pop()||e}function De(e,t){if(!t)return f(e,`brain.watch.scan.never`);let n=Date.parse(t);if(!Number.isFinite(n))return f(e,`brain.watch.scan.never`);let r=Math.max(0,Date.now()-n),i=Math.floor(r/6e4);if(i<1)return f(e,`brain.watch.scan.now`);if(i<60)return f(e,`brain.watch.scan.minutes`,{count:i});let a=Math.floor(i/60);return a<24?f(e,`brain.watch.scan.hours`,{count:a}):f(e,`brain.watch.scan.days`,{count:Math.floor(a/24)})}var Oe=4;function ke({language:e}){let t=l({queryKey:[`ingestionWatch`],queryFn:_.ingestionWatchStatus,staleTime:3e4,refetchOnWindowFocus:!1,retry:!1}),n=b.useMemo(()=>t.data?.ok?D(t.data.data):null,[t.data]);if(!n||n.enabledCount<1)return null;let r=n.watches.filter(e=>e.enabled).slice(0,Oe);return r.length?(0,q.jsxs)(`section`,{className:`brain-watch-card`,"aria-label":f(e,`brain.watch.aria`),"data-testid":`watch-health-card`,children:[(0,q.jsxs)(`header`,{className:`brain-watch-head`,children:[(0,q.jsx)(y,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),(0,q.jsx)(`strong`,{children:f(e,`brain.watch.title`)})]}),n.polling?null:(0,q.jsxs)(`p`,{className:`brain-watch-note`,role:`note`,"data-testid":`watch-polling-note`,children:[(0,q.jsx)(o,{className:`h-3 w-3`,"aria-hidden":`true`}),f(e,`brain.watch.notLive`)]}),(0,q.jsx)(`ul`,{className:`brain-watch-list`,children:r.map(t=>(0,q.jsx)(Ae,{language:e,watch:t},t.id))})]}):null}function Ae({language:e,watch:t}){return(0,q.jsxs)(`li`,{className:`brain-watch-item`,children:[(0,q.jsxs)(`div`,{className:`brain-watch-item-row`,children:[(0,q.jsx)(`span`,{className:`brain-watch-path`,title:t.path,children:$(t.path)}),(0,q.jsx)(`small`,{className:`brain-watch-scan`,children:De(e,t.lastScanAt)})]}),(0,q.jsxs)(`div`,{className:`brain-watch-item-row`,children:[t.lastResult&&t.lastResult.ingested>0?(0,q.jsx)(`span`,{className:`brain-watch-stat`,children:f(e,`brain.watch.ingested`,{count:t.lastResult.ingested})}):null,t.lastResult&&t.lastResult.failed>0?(0,q.jsxs)(`span`,{className:`brain-watch-stat is-failed`,children:[(0,q.jsx)(u,{className:`h-3 w-3`,"aria-hidden":`true`}),f(e,`brain.jobs.failedCount`,{count:t.lastResult.failed})]}):null,t.trackedFiles>0?(0,q.jsx)(`small`,{className:`brain-watch-tracked`,children:f(e,`brain.watch.tracked`,{count:t.trackedFiles})}):null]}),t.lastErrors.length?(0,q.jsxs)(`div`,{className:`brain-watch-errors`,children:[(0,q.jsx)(`small`,{children:f(e,`brain.watch.errors`)}),(0,q.jsx)(`ul`,{children:t.lastErrors.slice(0,3).map((e,t)=>(0,q.jsx)(`li`,{children:[e.path?$(e.path):``,e.detail].filter(Boolean).join(` — `)},`${e.path}-${t}`))})]}):null]})}function je(e,t){if(!t)return``;let n=new Date(t);return Number.isNaN(n.getTime())?``:n.toLocaleTimeString(e===`ko`?`ko-KR`:`en-US`,{hour:`2-digit`,minute:`2-digit`})}function Me({language:e,knownRunIds:t}){let n=l({queryKey:[`agentApprovals`],queryFn:_.agentApprovals,staleTime:1/0,refetchOnWindowFocus:!1,retry:!1}),r=b.useMemo(()=>n.data?.ok?E(n.data.data):[],[n.data]),i=b.useMemo(()=>new Set(t),[t]),a=r.filter(e=>!i.has(e.runId));return a.length?(0,q.jsx)(`aside`,{className:`brain-pending-approvals`,role:`note`,"aria-label":f(e,`brain.approval.pendingNotice.aria`),"data-testid":`pending-approvals-notice`,children:a.slice(0,2).map(t=>{let n=je(e,t.expiresAt);return(0,q.jsxs)(`p`,{children:[(0,q.jsx)(`span`,{children:t.goal?f(e,`brain.approval.pendingNotice`,{goal:t.goal}):f(e,`brain.approval.pendingNotice.generic`)}),(0,q.jsx)(`small`,{children:n?f(e,`brain.approval.pendingNotice.expiry`,{time:n}):f(e,`brain.approval.pendingNotice.hint`)})]},t.runId)})}):null}export{fe as C,V as D,T as E,v as O,de as S,w as T,S as _,ke as a,re as b,F as c,ae as d,me as f,B as g,N as h,Se as i,ee as k,P as l,se as m,Me as n,he as o,M as p,xe as r,L as s,Ee as t,ne as u,C as v,oe as w,ue as x,le as y};
|
|
1
|
+
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{n as r}from"./QueryClientProvider-B3OjqSyJ.js";import{t as i}from"./useMutation-B8QKq2NW.js";import{t as a}from"./circle-check-BxaDWjPR.js";import{t as o}from"./circle-pause-918Kuvk0.js";import{A as s,E as c,H as l,O as u,R as d,S as f,c as p,f as m,l as h,p as g,v as _}from"./index-CfeqZ9Ri.js";var ee=d(`brain-circuit`,[[`path`,{d:`M12 5a3 3 0 1 0-5.997.125 4 4 0 0 0-2.526 5.77 4 4 0 0 0 .556 6.588A4 4 0 1 0 12 18Z`,key:`l5xja`}],[`path`,{d:`M9 13a4.5 4.5 0 0 0 3-4`,key:`10igwf`}],[`path`,{d:`M6.003 5.125A3 3 0 0 0 6.401 6.5`,key:`105sqy`}],[`path`,{d:`M3.477 10.896a4 4 0 0 1 .585-.396`,key:`ql3yin`}],[`path`,{d:`M6 18a4 4 0 0 1-1.967-.516`,key:`2e4loj`}],[`path`,{d:`M12 13h4`,key:`1ku699`}],[`path`,{d:`M12 18h6a2 2 0 0 1 2 2v1`,key:`105ag5`}],[`path`,{d:`M12 8h8`,key:`1lhi5i`}],[`path`,{d:`M16 8V5a2 2 0 0 1 2-2`,key:`u6izg6`}],[`circle`,{cx:`16`,cy:`13`,r:`.5`,key:`ry7gng`}],[`circle`,{cx:`18`,cy:`3`,r:`.5`,key:`1aiba7`}],[`circle`,{cx:`20`,cy:`21`,r:`.5`,key:`yhc1fs`}],[`circle`,{cx:`20`,cy:`8`,r:`.5`,key:`1e43v0`}]]),te=d(`clock-3`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 6v6h4`,key:`135r8i`}]]),v=d(`database-backup`,[[`ellipse`,{cx:`12`,cy:`5`,rx:`9`,ry:`3`,key:`msslwz`}],[`path`,{d:`M3 12a9 3 0 0 0 5 2.69`,key:`1ui2ym`}],[`path`,{d:`M21 9.3V5`,key:`6k6cib`}],[`path`,{d:`M3 5v14a9 3 0 0 0 6.47 2.88`,key:`i62tjy`}],[`path`,{d:`M12 12v4h4`,key:`1bxaet`}],[`path`,{d:`M13 20a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L12 16`,key:`1f4ei9`}]]),y=d(`folder-sync`,[[`path`,{d:`M9 20H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v.5`,key:`1dkoa9`}],[`path`,{d:`M12 10v4h4`,key:`1czhmt`}],[`path`,{d:`m12 14 1.535-1.605a5 5 0 0 1 8 1.5`,key:`lvuxfi`}],[`path`,{d:`M22 22v-4h-4`,key:`1ewp4q`}],[`path`,{d:`m22 18-1.535 1.605a5 5 0 0 1-8-1.5`,key:`14ync0`}]]),b=e(t());function ne(e){return p(e).flatMap(e=>{let t=V(e,[`id`,`conversation_id`]);return t?[{id:t,title:V(e,[`title`,`summary`,`last_message`],t).trim(),messageCount:Math.max(0,Math.round(G(e,[`message_count`,`messages`]))),updatedAt:U(e,[`updated_at`,`updatedAt`,`created_at`,`createdAt`])}]:[]}).sort((e,t)=>(t.updatedAt??0)-(e.updatedAt??0))}function re(e){return p((B(e)?e:{}).messages).flatMap(e=>{let t=V(e,[`role`]),n=typeof e.content==`string`?e.content:``;return t!==`user`&&t!==`assistant`||!n.trim()?[]:[{role:t,content:n}]})}function ie(e,t,n){let r=V(e,[`id`]);if(r){let e=`brain.memoryTier.${r}`,n=f(t,e);if(n!==e)return n}return n}function ae(e,t,n=`ko`){let r=B(e)?e:{},i=(p(r.sources).length?p(r.sources):p(r.tiers)).map((e,t)=>({id:V(e,[`id`,`source`,`label`],`memory-${t}`),title:ie(e,n,V(e,[`title`,`label`,`source`,`path`,`name`],`Workspace memory`)),kind:H(e,[`type`,`source_type`,`kind`,`health`],`Memory`),tags:[],agentGenerated:!1})),a=p(r.recent_memories||r.recentMemories).map((e,t)=>{let n=B(e.metadata)?e.metadata:{},r=W(e,[`tags`]),i=V(e,[`content`,`summary`,`detail`]),a=V(n,[`source`]),o=r.includes(`agent-synthesis`)||a===`agent_runtime`||a===`agent_runtime_synthesis`;return{id:V(e,[`id`],`recent-memory-${t}`),title:i?i.replace(/\s+/g,` `).slice(0,96):H(e,[`kind`],`Memory`),kind:H(e,[`kind`],`Memory`),detail:i,tags:r,agentGenerated:o}}),o=p(t).map((e,t)=>({id:V(e,[`id`,`conversation_id`],`conversation-${t}`),title:V(e,[`title`,`summary`,`id`],`Conversation`),kind:`Conversation`,tags:[],agentGenerated:!1}));return R([...a,...i,...o]).slice(0,12)}function oe(e){let t=B(e)?e:{},n=p(t.nodes),r=p(t.edges),i=n.flatMap(e=>{let t=V(e,[`id`,`node_id`,`title`,`label`]);if(!t)return[];let n=B(e.metadata)?e.metadata:{},r=H(e,[`type`,`kind`,`category`],`Concept`),i=V(e,[`title`,`label`,`name`],t.replace(/^[^:]+:/,``)),a=V(e,[`summary`,`description`,`snippet`])||V(n,[`summary`,`description`,`relative_path`,`filename`]),o=h(G(e,[`importance_norm`,`importance`,`score`])||.5,.08,1),s=U(e,[`created_at`,`createdAt`,`added_at`,`addedAt`,`timestamp`,`updated_at`,`updatedAt`])??U(n,[`created_at`,`createdAt`,`added_at`,`addedAt`,`timestamp`,`updated_at`,`updatedAt`]);return[{id:t,label:i,type:r,summary:a,importance:o,...s===void 0?{}:{createdAt:s}}]}).sort((e,t)=>t.importance-e.importance),a=new Set(i.map(e=>e.id));return{nodes:i,edges:r.flatMap((e,t)=>{let n=V(e,[`from`,`source`,`source_id`]),r=V(e,[`to`,`target`,`target_id`]);return!n||!r||!a.has(n)||!a.has(r)?[]:[{id:V(e,[`id`],`edge-${t}`),source:n,target:r,label:H(e,[`type`,`label`,`relationship`],`Relates`),weight:G(e,[`weight`,`score`,`confidence`])||1}]})}}function se(e){let t=B(e)?e:{},n=[t,t.knowledge_graph,t.ingestion,t.result].filter(B),r=new Set,i=0,a,o;for(let e of n){let t=V(e,[`node_id`,`graph_node`,`graph_node_id`]);t&&r.add(t);for(let t of p(e.indexed_nodes))if(typeof t==`string`&&t.trim())r.add(t.trim());else if(B(t)){let e=V(t,[`node_id`,`graph_node_id`,`id`]);e&&r.add(e)}i=Math.max(i,G(e,[`chunk_count`,`chunks`,`indexed_count`])),typeof e.duplicate==`boolean`&&(a=e.duplicate),o||=V(e,[`provenance_id`])}let s;for(let e of n){let t=ce(e);if(t){s=t;break}}return{nodeIds:Array.from(r),chunkCount:i,...a===void 0?{}:{duplicate:a},...o?{provenanceId:o}:{},...s?{extraction:s}:{}}}function ce(e){let t=B(e)?e:{},n=B(t.extraction_quality)?t.extraction_quality:null;if(!n)return null;let r=V(n,[`level`]);if(r!==`high`&&r!==`medium`&&r!==`low`)return null;let i=W(t,[`warnings`]).length?W(t,[`warnings`]):W(n,[`warnings`]);return{score:G(n,[`score`]),level:r,reasons:W(n,[`reasons`]),warnings:i}}function le(e){let t=B(e)?e:{},n=B(t.context_quality)?t.context_quality:null,r=!n&&B(t.trace)&&B(t.trace.context_quality)?t.trace.context_quality:null,i=n||r||(typeof t.mode==`string`&&typeof t.limited==`boolean`?t:null);if(!i)return null;let a=V(i,[`mode`]);if(!a)return null;let o=typeof i.reason==`string`&&i.reason.trim()?i.reason.trim():null;return{mode:a,nodes:Math.max(0,Math.round(G(i,[`nodes`]))),limited:K(i,[`limited`],!1),reason:o}}function ue(e){let t=B(e)?e:{},n=(B(t.grounding)?t.grounding:null)||(typeof t.status==`string`&&`label`in t?t:null);if(!n)return null;let r=V(n,[`status`]);return[`supported`,`unsupported`,`no_context`].includes(r)?{status:r,reason:typeof n.reason==`string`&&n.reason.trim()?n.reason.trim():null}:null}function de(e){if(!B(e))return null;let t=V(e,[`type`]);if(t&&t!==`hybrid_context`)return null;let n=Array.isArray(e.node_ids)||Array.isArray(e.nodeIds);return t!==`hybrid_context`&&!n?null:{nodeIds:W(e,[`node_ids`,`nodeIds`]),keywords:W(e,[`keywords`])}}function fe(e){if(!B(e))return null;let t=V(e,[`type`]);return t&&t!==`hybrid_done`||t!==`hybrid_done`&&!(`answer`in e)&&!(`kg_expansion`in e)&&!(`kgExpansion`in e)?null:{answer:typeof e.answer==`string`?e.answer:``,provider:V(e,[`provider`]),model:V(e,[`model`]),sentNodeIds:W(e,[`sent_node_ids`,`sentNodeIds`]),expansion:pe(e.kg_expansion??e.kgExpansion)}}function pe(e){if(!B(e))return null;let t=V(e,[`status`]),n=B(e.plan)?e.plan:{},r=B(n.provenance)?n.provenance:{},i=G(e,[`candidate_count`,`candidateCount`]),a=G(r,[`candidate_count`,`candidateCount`]),o=Array.isArray(n.new_nodes)?n.new_nodes.length:0,s=Math.max(0,Math.round(i||a||o)),c=t===`staged`||t===`queued_for_review`||!!e.review_item_id;return{status:t||`staged`,candidateCount:s,stagedForReview:c}}function me(e,t=0){return{provider:e.provider,model:e.model,sentNodeCount:e.sentNodeIds.length||t,expansion:e.expansion}}function x(e){if(!B(e))return null;let t=V(e,[`status`]);if(t!==`ok`&&t!==`pending`&&t!==`failed`)return null;let n=V(e,[`detail`]);return{status:t,...n?{detail:n}:{}}}function he(e){let t=!!e.generation?.repaired,n=new Map;for(let t of e.artifacts||[])t&&typeof t.path==`string`&&n.set(t.path,!!t.previewable);let r=new Map,i=null;if(Array.isArray(e.brain_ingest))for(let t of e.brain_ingest){let e=x(t);e&&B(t)&&typeof t.path==`string`&&r.set(t.path,e)}else i=x(e.brain_ingest);let a=e.created_files||[];return a.map(e=>{let o=r.get(e.path)||(a.length===1?i:null);return{path:e.path,filename:e.filename||e.path.split(`/`).pop()||e.path,bytes:e.bytes||0,repaired:t,...n.has(e.path)?{previewable:n.get(e.path)}:{},...o?{brainIngest:o}:{}}})}function S(e){if(!B(e))return null;let t=V(e,[`phase`]),n=V(e,[`event`]);if(!t||!n)return null;let r=Number(e.step);return{phase:t,event:n,...V(e,[`action`])?{action:V(e,[`action`])}:{},...V(e,[`path`])?{path:V(e,[`path`])}:{},...Number.isFinite(r)?{step:Math.round(r)}:{},...typeof e.ok==`boolean`?{ok:e.ok}:{},...V(e,[`decision`])?{decision:V(e,[`decision`])}:{},...V(e,[`verdict`])?{verdict:V(e,[`verdict`])}:{},...V(e,[`state`])?{state:V(e,[`state`])}:{},...V(e,[`detail`,`error`])?{detail:V(e,[`detail`,`error`])}:{}}}function C(e){return p(e).flatMap(e=>{if(!B(e))return[];let t=V(e,[`action`,`tool`]),n=V(e,[`state`]),r=V(e,[`error`]);if(!t&&!n&&!r)return[];let i=V(B(e.args)?e.args:{},[`path`,`target`,`file`]);return t?[{phase:`execute`,event:`tool`,action:t,...i?{path:i}:{},ok:!r,...r?{detail:r}:{}}]:r?[{phase:`execute`,event:`state`,...n?{state:n}:{},ok:!1,detail:r}]:[{phase:`terminal`,event:`state`,state:n}]})}function w(e){if(!B(e))return null;let t={};if(B(e.repairs))for(let[n,r]of Object.entries(e.repairs)){let e=Number(r);Number.isFinite(e)&&e>0&&(t[n]=Math.round(e))}let n=Math.max(0,Math.round(G(e,[`parse_errors`,`parseErrors`]))),r=Math.max(0,Math.round(G(e,[`parse_recovered`,`parseRecovered`]))),i=Object.values(t).reduce((e,t)=>e+t,0)+r;return i<1?null:{repairs:t,parseErrors:n,parseRecovered:r,total:i}}function T(e,t){if(!B(e))return null;let n=e=>{if(!B(e))return``;let n=e[t];return typeof n==`string`?n:``},r=n(e.headline),i=p(e.details).map(n).filter(Boolean),a=V(e,[`code`]);if(!r&&!i.length)return null;let o=B(e.model_strain)?V(e.model_strain,[`level`]):``,s=o===`light`||o===`moderate`||o===`heavy`?o:`none`,c=e.ok===!0;return c&&!i.length?null:{code:a,ok:c,headline:r,details:i,strainLevel:s}}function E(e){return p((B(e)?e:{}).pending).flatMap(e=>{let t=V(e,[`run_id`,`runId`]);return t?[{runId:t,goal:V(e,[`goal`]),expiresAt:V(e,[`expires_at`,`expiresAt`])}]:[]})}function D(e){let t=B(e)?e:{},n=p(t.watches).flatMap(e=>{if(!B(e))return[];let t=V(e,[`id`]),n=V(e,[`path`]);if(!t&&!n)return[];let r=B(e.last_result)?e.last_result:null,i=p(e.last_errors).flatMap(e=>{if(typeof e==`string`&&e.trim())return[{path:``,detail:e.trim()}];if(!B(e))return[];let t=V(e,[`detail`,`reason`,`error`]),n=V(e,[`path`,`source`,`file`]);return!t&&!n?[]:[{path:n,detail:t}]});return[{id:t||n,path:n,enabled:K(e,[`enabled`],!1),lastScanAt:V(e,[`last_scan_at`,`lastScanAt`]),lastResult:r?{status:V(r,[`status`]),ingested:Math.max(0,Math.round(G(r,[`ingested`]))),failed:Math.max(0,Math.round(G(r,[`failed`])))}:null,trackedFiles:Math.max(0,Math.round(G(e,[`tracked_files`,`trackedFiles`]))),lastErrors:i.slice(0,3)}]});return{enabledCount:Math.max(0,Math.round(G(t,[`enabled_count`,`enabledCount`]))),polling:K(t,[`polling`],!1),intervalSeconds:Math.max(0,Math.round(G(t,[`interval_seconds`,`intervalSeconds`]))),watches:n}}function O(e){let t=B(e)?e:{};return{status:V(t,[`status`],`unavailable`),pendingItems:Math.max(0,Math.round(G(t,[`pending_items`,`pendingItems`]))),totalItems:Math.max(0,Math.round(G(t,[`total_items`,`totalItems`]))),detail:V(t,[`detail`])}}function k(e){return typeof e==`string`?e.trim():B(e)?[V(e,[`source`,`path`,`file`]),V(e,[`detail`,`reason`,`error`])].filter(Boolean).join(` — `):``}function A(e){return p((B(e)?e:{}).jobs).flatMap(e=>{let t=V(e,[`job_id`,`jobId`,`id`]);if(!t)return[];let n=V(e,[`created_at`,`createdAt`]),r=V(e,[`updated_at`,`updatedAt`]);return[{jobId:t,status:V(e,[`status`],`queued`),total:Math.max(0,Math.round(G(e,[`total`]))),processed:Math.max(0,Math.round(G(e,[`processed`]))),failed:Math.max(0,Math.round(G(e,[`failed`]))),errors:p(e.errors).map(k).filter(Boolean).slice(0,10),...n?{createdAt:n}:{},...r?{updatedAt:r}:{}}]})}function j(e,t){for(let n of[`recommended`,`cloud`,`loaded`,`loaded_models`,`models`])for(let r of p(e[n])){if(V(r,[`id`,`model_id`,`name`])!==t)continue;let e=V(r,[`display_name`,`model_name`,`name`]);if(e&&e!==t)return e}return``}function M(e){let t=B(e)?e:{},n=V(t,[`current`,`current_model`,`local_model`]);if(n)return j(t,n)||m(n);let r=p(t.loaded||t.loaded_models).find(e=>e.id||e.name||e.model_id);if(!r)return`local mind`;let i=V(r,[`display_name`,`model_name`,`name`]),a=V(r,[`id`,`model_id`]);return i&&i!==a?i:a?j(t,a)||m(a):`local mind`}function N(e){let t=B(e)?e:{};return V(t,[`current`,`current_model`,`local_model`])?!0:p(t.loaded||t.loaded_models).some(e=>e.id||e.name||e.model_id)}function P(e,t,n){let r=B(e)?e:{},i=B(r.brain_readiness)?r.brain_readiness:{},a=V(i,[`state`]),o=G(i,[`depth`]),s=G(i,[`score`]);if((a===`quiet`||a===`forming`||a===`alive`)&&ve(o)){let e=B(i.signals)?i.signals:{};return{score:h(Math.round(s||0),0,100),state:a,depth:o,titleKey:V(i,[`title_key`,`titleKey`],`brain.readiness.${a}`),actionKey:V(i,[`action_key`,`actionKey`],_e(a)),source:`memory_service`,signals:{memoryCount:G(e,[`memory_count`,`memoryCount`]),conceptCount:G(e,[`concept_count`,`conceptCount`]),relationshipCount:G(e,[`relationship_count`,`relationshipCount`]),healthySources:G(e,[`healthy_sources`,`healthySources`])}}}return ge(t,n)}function F(e,t=``){let n=B(e)&&typeof e.ok==`boolean`&&`data`in e?e:null;if(n&&!n.ok)return I(t);let r=n?n.data:e,i=B(r)?r:{},a=B(i.model_continuity)?i.model_continuity:{},o=B(i.proofs)?i.proofs:{},s=B(i.recall)?i.recall:{},c=B(i.claims)?i.claims:{},l=G(o,[`durable_items`,`durableItems`]);return{status:V(i,[`status`],`quiet`),modelContinuity:{activeModel:V(a,[`active_model`,`activeModel`],t),brainOwner:V(a,[`brain_owner`,`brainOwner`],`lattice_brain`),capability:K(a,[`capability`],!0),survivesModelSwitch:K(a,[`survives_model_switch`,`survivesModelSwitch`],!1),proven:K(a,[`proven`],!1),contextStore:V(a,[`context_store`,`contextStore`],`workspace + conversation + graph + vector`)},proofs:{durableItems:l,hasDurableEvidence:K(o,[`has_durable_evidence`,`hasDurableEvidence`],l>0),workspaceMemories:G(o,[`workspace_memories`,`workspaceMemories`]),conversations:G(o,[`conversations`]),graphConcepts:G(o,[`graph_concepts`,`graphConcepts`]),vectorItems:G(o,[`vector_items`,`vectorItems`]),healthySources:G(o,[`healthy_sources`,`healthySources`])},recall:{query:V(s,[`query`]),count:G(s,[`count`]),items:p(s.items).map((e,t)=>({id:V(e,[`id`],`recall-${t}`),source:H(e,[`source`],`Memory`),title:V(e,[`title`],`Memory`),snippet:V(e,[`snippet`]),score:G(e,[`score`]),matchedTerms:W(e,[`matched_terms`,`matchedTerms`]),confidence:be(e,G(e,[`score`])),locator:V(e,[`locator`]),kind:V(e,[`kind`]),caption:V(e,[`caption`]),thumbnail:ye(e)}))},claims:{canRecallUserContext:K(c,[`can_recall_user_context`,`canRecallUserContext`],!1),keepsContextAcrossModels:K(c,[`keeps_context_across_models`,`keepsContextAcrossModels`],!1),isKnowledgeStore:K(c,[`is_knowledge_store`,`isKnowledgeStore`],!1)}}}function I(e){return{status:`unavailable`,modelContinuity:{activeModel:e,brainOwner:``,capability:!1,survivesModelSwitch:!1,proven:!1,contextStore:``},proofs:{durableItems:0,hasDurableEvidence:!1,workspaceMemories:0,conversations:0,graphConcepts:0,vectorItems:0,healthySources:0},recall:{query:``,count:0,items:[]},claims:{canRecallUserContext:!1,keepsContextAcrossModels:!1,isKnowledgeStore:!1}}}function L(e){let t=B(e)?e:{},n=B(t.focus)?t.focus:{},r=p(t.next_actions||t.nextActions),i=p(t.suggested_questions||t.suggestedQuestions),a=p(t.proactive_actions||t.proactiveActions),o=p(t.evidence),s=r.length?r:[{id:`add_source`,label_key:`brain.brief.action.add`,detail_key:`brain.brief.action.add.detail`,route:`/capture`,priority:10},{id:`ask_brain`,label_key:`brain.brief.action.ask`,detail_key:`brain.brief.action.ask.detail`,route:``,priority:9}],c=o.length?o:[{id:`durable`,label_key:`brain.brief.evidence.durable`,value:0,detail_key:`brain.brief.evidence.durable.detail`},{id:`graph`,label_key:`brain.brief.evidence.graph`,value:0,detail_key:`brain.brief.evidence.graph.detail`},{id:`sources`,label_key:`brain.brief.evidence.sources`,value:0,detail_key:`brain.brief.evidence.sources.detail`}];return{status:V(t,[`status`],`quiet`),score:h(Math.round(G(t,[`score`])),0,100),headlineKey:V(t,[`headline_key`,`headlineKey`],`brain.brief.headline.quiet`),bodyKey:V(t,[`body_key`,`bodyKey`],`brain.brief.body.quiet`),focus:{kind:V(n,[`kind`],`empty`),title:V(n,[`title`]),detail:V(n,[`detail`]),source:H(n,[`source`],`Memory`),score:G(n,[`score`]),empty:K(n,[`empty`],!V(n,[`title`]))},nextActions:s.map(e=>({id:V(e,[`id`],`ask_brain`),labelKey:V(e,[`label_key`,`labelKey`],`brain.brief.action.ask`),detailKey:V(e,[`detail_key`,`detailKey`],`brain.brief.action.ask.detail`),route:V(e,[`route`]),priority:G(e,[`priority`])})),suggestedQuestions:i.map(e=>({id:V(e,[`id`],`suggested-question`),labelKey:V(e,[`label_key`,`labelKey`],`brain.suggestion.focus.label`),detailKey:V(e,[`detail_key`,`detailKey`],`brain.suggestion.focus.detail`),promptKey:V(e,[`prompt_key`,`promptKey`],`brain.suggestion.focus.prompt`),params:z(e.params),priority:G(e,[`priority`])})).sort((e,t)=>t.priority-e.priority),proactiveActions:a.map(e=>({id:V(e,[`id`],`proactive-action`),intent:V(e,[`intent`],`ask`),labelKey:V(e,[`label_key`,`labelKey`],`brain.proactive.evidence.label`),detailKey:V(e,[`detail_key`,`detailKey`],`brain.proactive.evidence.detail`),prompt:V(e,[`prompt`]),route:V(e,[`route`]),priority:G(e,[`priority`]),context:z(e.context)})).sort((e,t)=>t.priority-e.priority),evidence:c.map(e=>({id:V(e,[`id`],`evidence`),labelKey:V(e,[`label_key`,`labelKey`],`brain.brief.evidence.durable`),value:G(e,[`value`]),detailKey:V(e,[`detail_key`,`detailKey`],`brain.brief.evidence.durable.detail`)})),generatedAt:V(t,[`generated_at`,`generatedAt`])}}function R(e){let t=new Set;return e.filter(e=>t.has(e.id)?!1:(t.add(e.id),!0))}function z(e){return B(e)?Object.entries(e).reduce((e,[t,n])=>((typeof n==`string`||typeof n==`number`)&&(e[t]=n),e),{}):{}}function ge(e,t){let n=Math.min(100,Math.round(e*12+t*10));return e<1?{score:Math.max(12,n),state:`quiet`,depth:2,titleKey:`brain.readiness.quiet`,actionKey:`brain.readiness.start`,source:`frontend_fallback`,signals:{memoryCount:e,conceptCount:t,relationshipCount:0,healthySources:0}}:t<3?{score:Math.max(38,n),state:`forming`,depth:3,titleKey:`brain.readiness.forming`,actionKey:`brain.readiness.grow`,source:`frontend_fallback`,signals:{memoryCount:e,conceptCount:t,relationshipCount:0,healthySources:0}}:{score:Math.max(72,n),state:`alive`,depth:5,titleKey:`brain.readiness.alive`,actionKey:`brain.readiness.map`,source:`frontend_fallback`,signals:{memoryCount:e,conceptCount:t,relationshipCount:0,healthySources:0}}}function _e(e){return e===`quiet`?`brain.readiness.start`:e===`forming`?`brain.readiness.grow`:`brain.readiness.map`}function ve(e){return e>=1&&e<=5&&Number.isInteger(e)}var B=g;function V(e,t,n=``){for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t;if(typeof t==`number`&&Number.isFinite(t))return String(t)}return n}function H(e,t,n=``){return V(e,t,n).replace(/[_-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function U(e,t){for(let n of t){let t=e[n];if(typeof t==`number`&&Number.isFinite(t))return t<0xe8d4a51000?t*1e3:t;if(typeof t==`string`&&t.trim()){let e=Number(t);if(Number.isFinite(e)&&/^\d+$/.test(t.trim()))return e<0xe8d4a51000?e*1e3:e;let n=Date.parse(t);if(Number.isFinite(n))return n}}}function W(e,t){for(let n of t){let t=e[n];if(Array.isArray(t))return t.filter(e=>typeof e==`string`&&e.trim().length>0)}return[]}function ye(e){let t=e.thumbnail;return typeof t==`string`&&t.startsWith(`data:image/`)?t:``}function be(e,t){let n=e.confidence;return n===`high`||n===`medium`||n===`low`?n:t>=.65?`high`:t>=.3?`medium`:`low`}function G(e,t){for(let n of t){let t=Number(e[n]);if(Number.isFinite(t))return t}return 0}function K(e,t,n){for(let n of t){let t=e[n];if(typeof t==`boolean`)return t}return n}var q=n();function J(){let e=l({queryKey:[`vectorFreshness`],queryFn:_.brainVectorFreshness,staleTime:6e4,refetchOnWindowFocus:!1,retry:!1});return b.useMemo(()=>e.data?.ok?O(e.data.data):null,[e.data])}function xe({language:e}){let t=r(),n=J(),a=i({mutationFn:()=>_.memoryRebuild(),onSuccess:async()=>{await t.invalidateQueries({queryKey:[`vectorFreshness`]})}});if(!n||n.status!==`stale_embedder`)return null;let o=a.isSuccess&&a.data&&!a.data.ok;return(0,q.jsxs)(`div`,{className:`brain-stale-embedder`,role:`status`,"data-testid":`stale-embedder-notice`,children:[(0,q.jsx)(u,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`strong`,{children:f(e,`brain.freshness.staleEmbedder`)}),(0,q.jsx)(`small`,{children:f(e,`brain.freshness.staleEmbedder.detail`)}),o?(0,q.jsx)(`small`,{className:`is-error`,children:f(e,`brain.freshness.reindex.failed`)}):null]}),(0,q.jsx)(`button`,{type:`button`,"data-testid":`stale-embedder-reindex`,disabled:a.isPending,onClick:()=>a.mutate(),children:f(e,a.isPending?`brain.freshness.reindex.running`:`brain.freshness.reindex`)})]})}function Se({language:e}){let t=J();return!t||t.status!==`pending`||t.pendingItems<1?null:(0,q.jsxs)(`p`,{className:`brain-freshness-chip`,role:`status`,"data-testid":`vector-freshness-chip`,children:[(0,q.jsx)(te,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:f(e,`brain.freshness.pending`,{count:t.pendingItems})})]})}var Y=new Set([`queued`,`running`]),X=new Set([`failed`,`partial`]);function Z(e){return Y.has(e.status)}function Ce(e){return e===`queued`||e===`running`||e===`completed`||e===`failed`||e===`partial`?`brain.jobs.status.${e}`:`brain.jobs.status.queued`}var we=new Set([`completed`,`partial`]),Q=3;function Te({language:e,job:t,freshness:n,onDismiss:r}){let i=n&&n.totalItems>0&&(n.status===`ready`||n.status===`pending`)?Math.max(0,Math.min(100,Math.round((n.totalItems-n.pendingItems)/n.totalItems*100))):null,o=t.errors.slice(0,Q);return(0,q.jsxs)(`div`,{className:`brain-jobs-report lattice-success-pulse is-${t.status}`,role:`status`,"data-testid":`ingestion-job-report`,children:[(0,q.jsxs)(`div`,{className:`brain-jobs-report-head`,children:[(0,q.jsx)(a,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,q.jsx)(`strong`,{children:f(e,t.status===`partial`?`brain.jobs.report.titlePartial`:`brain.jobs.report.title`)}),r?(0,q.jsx)(`button`,{type:`button`,className:`brain-jobs-report-dismiss`,"aria-label":f(e,`brain.jobs.report.dismiss`),onClick:r,children:(0,q.jsx)(c,{className:`h-3.5 w-3.5`,"aria-hidden":`true`})}):null]}),(0,q.jsxs)(`div`,{className:`brain-jobs-report-stats`,children:[t.processed>0?(0,q.jsx)(`span`,{className:`brain-jobs-report-stat`,children:f(e,`brain.jobs.report.documents`,{count:t.processed})}):null,t.failed>0?(0,q.jsx)(`span`,{className:`brain-jobs-report-stat is-failed`,children:f(e,`brain.jobs.failedCount`,{count:t.failed})}):null,i===null?null:(0,q.jsx)(`span`,{className:`brain-jobs-report-stat`,children:f(e,`brain.jobs.report.vector`,{percent:i})})]}),o.length?(0,q.jsxs)(`div`,{className:`brain-jobs-report-samples`,children:[(0,q.jsx)(`small`,{children:f(e,`brain.jobs.report.skipped`)}),(0,q.jsx)(`ul`,{children:o.map(e=>(0,q.jsx)(`li`,{children:e},e))})]}):null]})}function Ee({language:e}){let t=r(),n=J(),a=l({queryKey:[`ingestionJobs`],queryFn:_.ingestionJobs,refetchOnWindowFocus:!1,retry:!1,refetchInterval:e=>{let t=e.state.data;return t?.ok&&A(t.data).some(Z)?4e3:!1}}),o=i({mutationFn:e=>_.resumeIngestionJob(e),onSettled:()=>void t.invalidateQueries({queryKey:[`ingestionJobs`]})}),c=b.useMemo(()=>a.data?.ok?A(a.data.data):[],[a.data]),d=b.useRef(new Map),[p,m]=b.useState([]);b.useEffect(()=>{let e=d.current,t=[];for(let n of c){let r=e.get(n.jobId);r&&Y.has(r)&&we.has(n.status)&&t.push(n.jobId),e.set(n.jobId,n.status)}t.length&&m(e=>[...t,...e.filter(e=>!t.includes(e))].slice(0,2))},[c]);let h=p.map(e=>c.find(t=>t.jobId===e)).filter(e=>!!e),g=c.filter(e=>Z(e)||X.has(e.status)).slice(0,4);return!g.length&&!h.length?null:(0,q.jsxs)(`section`,{className:`brain-jobs-panel`,"aria-label":f(e,`brain.jobs.aria`),"data-testid":`ingestion-jobs-panel`,children:[h.map(t=>(0,q.jsx)(Te,{language:e,job:t,freshness:n,onDismiss:()=>m(e=>e.filter(e=>e!==t.jobId))},t.jobId)),g.length?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`header`,{className:`brain-jobs-head`,children:(0,q.jsx)(`strong`,{children:f(e,`brain.jobs.title`)})}),(0,q.jsx)(`ul`,{className:`brain-jobs-list`,children:g.map(t=>{let n=Math.max(t.total,t.processed,1),r=Math.min(100,Math.round(t.processed/n*100)),i=X.has(t.status),a=o.isPending&&o.variables===t.jobId;return(0,q.jsxs)(`li`,{className:`brain-jobs-item is-${t.status}`,children:[(0,q.jsxs)(`div`,{className:`brain-jobs-item-row`,children:[(0,q.jsx)(`span`,{className:`brain-jobs-status`,children:f(e,Ce(t.status))}),(0,q.jsx)(`span`,{className:`brain-jobs-counts`,children:f(e,`brain.jobs.progress`,{processed:t.processed,total:t.total})}),t.failed>0?(0,q.jsxs)(`span`,{className:`brain-jobs-failed`,children:[(0,q.jsx)(u,{className:`h-3 w-3`,"aria-hidden":`true`}),f(e,`brain.jobs.failedCount`,{count:t.failed})]}):null]}),(0,q.jsx)(`div`,{className:`brain-jobs-bar`,role:`progressbar`,"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":r,"aria-label":f(e,`brain.jobs.progressAria`,{processed:t.processed,total:t.total}),children:(0,q.jsx)(`span`,{className:`brain-jobs-bar-fill`,style:{width:`${r}%`}})}),i?(0,q.jsxs)(`button`,{type:`button`,className:`brain-jobs-resume`,disabled:o.isPending,onClick:()=>o.mutate(t.jobId),children:[(0,q.jsx)(s,{className:`h-3 w-3`,"aria-hidden":`true`}),a?f(e,`brain.jobs.resuming`):f(e,`brain.jobs.resume`)]}):null]},t.jobId)})})]}):null]})}function $(e){return e.split(/[\\/]/).filter(Boolean).pop()||e}function De(e,t){if(!t)return f(e,`brain.watch.scan.never`);let n=Date.parse(t);if(!Number.isFinite(n))return f(e,`brain.watch.scan.never`);let r=Math.max(0,Date.now()-n),i=Math.floor(r/6e4);if(i<1)return f(e,`brain.watch.scan.now`);if(i<60)return f(e,`brain.watch.scan.minutes`,{count:i});let a=Math.floor(i/60);return a<24?f(e,`brain.watch.scan.hours`,{count:a}):f(e,`brain.watch.scan.days`,{count:Math.floor(a/24)})}var Oe=4;function ke({language:e}){let t=l({queryKey:[`ingestionWatch`],queryFn:_.ingestionWatchStatus,staleTime:3e4,refetchOnWindowFocus:!1,retry:!1}),n=b.useMemo(()=>t.data?.ok?D(t.data.data):null,[t.data]);if(!n||n.enabledCount<1)return null;let r=n.watches.filter(e=>e.enabled).slice(0,Oe);return r.length?(0,q.jsxs)(`section`,{className:`brain-watch-card`,"aria-label":f(e,`brain.watch.aria`),"data-testid":`watch-health-card`,children:[(0,q.jsxs)(`header`,{className:`brain-watch-head`,children:[(0,q.jsx)(y,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}),(0,q.jsx)(`strong`,{children:f(e,`brain.watch.title`)})]}),n.polling?null:(0,q.jsxs)(`p`,{className:`brain-watch-note`,role:`note`,"data-testid":`watch-polling-note`,children:[(0,q.jsx)(o,{className:`h-3 w-3`,"aria-hidden":`true`}),f(e,`brain.watch.notLive`)]}),(0,q.jsx)(`ul`,{className:`brain-watch-list`,children:r.map(t=>(0,q.jsx)(Ae,{language:e,watch:t},t.id))})]}):null}function Ae({language:e,watch:t}){return(0,q.jsxs)(`li`,{className:`brain-watch-item`,children:[(0,q.jsxs)(`div`,{className:`brain-watch-item-row`,children:[(0,q.jsx)(`span`,{className:`brain-watch-path`,title:t.path,children:$(t.path)}),(0,q.jsx)(`small`,{className:`brain-watch-scan`,children:De(e,t.lastScanAt)})]}),(0,q.jsxs)(`div`,{className:`brain-watch-item-row`,children:[t.lastResult&&t.lastResult.ingested>0?(0,q.jsx)(`span`,{className:`brain-watch-stat`,children:f(e,`brain.watch.ingested`,{count:t.lastResult.ingested})}):null,t.lastResult&&t.lastResult.failed>0?(0,q.jsxs)(`span`,{className:`brain-watch-stat is-failed`,children:[(0,q.jsx)(u,{className:`h-3 w-3`,"aria-hidden":`true`}),f(e,`brain.jobs.failedCount`,{count:t.lastResult.failed})]}):null,t.trackedFiles>0?(0,q.jsx)(`small`,{className:`brain-watch-tracked`,children:f(e,`brain.watch.tracked`,{count:t.trackedFiles})}):null]}),t.lastErrors.length?(0,q.jsxs)(`div`,{className:`brain-watch-errors`,children:[(0,q.jsx)(`small`,{children:f(e,`brain.watch.errors`)}),(0,q.jsx)(`ul`,{children:t.lastErrors.slice(0,3).map((e,t)=>(0,q.jsx)(`li`,{children:[e.path?$(e.path):``,e.detail].filter(Boolean).join(` — `)},`${e.path}-${t}`))})]}):null]})}function je(e,t){if(!t)return``;let n=new Date(t);return Number.isNaN(n.getTime())?``:n.toLocaleTimeString(e===`ko`?`ko-KR`:`en-US`,{hour:`2-digit`,minute:`2-digit`})}function Me({language:e,knownRunIds:t}){let n=l({queryKey:[`agentApprovals`],queryFn:_.agentApprovals,staleTime:1/0,refetchOnWindowFocus:!1,retry:!1}),r=b.useMemo(()=>n.data?.ok?E(n.data.data):[],[n.data]),i=b.useMemo(()=>new Set(t),[t]),a=r.filter(e=>!i.has(e.runId));return a.length?(0,q.jsx)(`aside`,{className:`brain-pending-approvals`,role:`note`,"aria-label":f(e,`brain.approval.pendingNotice.aria`),"data-testid":`pending-approvals-notice`,children:a.slice(0,2).map(t=>{let n=je(e,t.expiresAt);return(0,q.jsxs)(`p`,{children:[(0,q.jsx)(`span`,{children:t.goal?f(e,`brain.approval.pendingNotice`,{goal:t.goal}):f(e,`brain.approval.pendingNotice.generic`)}),(0,q.jsx)(`small`,{children:n?f(e,`brain.approval.pendingNotice.expiry`,{time:n}):f(e,`brain.approval.pendingNotice.hint`)})]},t.runId)})}):null}export{fe as C,V as D,T as E,v as O,de as S,w as T,S as _,ke as a,re as b,F as c,ae as d,me as f,B as g,N as h,Se as i,ee as k,P as l,se as m,Me as n,he as o,M as p,xe as r,L as s,Ee as t,ne as u,C as v,oe as w,ue as x,le as y};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{n as r}from"./QueryClientProvider-B3OjqSyJ.js";import{t as i}from"./useMutation-D7IMQTeI.js";import{_ as a,b as o,c as s,g as c,h as l,i as u,m as d,n as f,p,t as m,u as h,v as g,x as _,y as v}from"./primitives-D01WcJn7.js";import{t as y}from"./circle-check-D68nHcgS.js";import{n as b,r as x,t as S}from"./hard-drive-Cw6aEA2h.js";import{t as ee}from"./folder-open-DokOmFQJ.js";import{t as C}from"./share-2-DMMkM8Iu.js";import{A as w,H as T,R as E,S as D,c as O,d as k,o as te,p as A,v as j,z as M}from"./index-DhszK7A3.js";import{t as N}from"./button-Tzf5D7L1.js";import{t as P}from"./input-BCdHoZXA.js";import"./workspace-C7xidB7c.js";var F=E(`clipboard-paste`,[[`path`,{d:`M11 14h10`,key:`1w8e9d`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v1.344`,key:`1e62lh`}],[`path`,{d:`m17 18 4-4-4-4`,key:`z2g111`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113`,key:`bjbb7m`}],[`rect`,{x:`8`,y:`2`,width:`8`,height:`4`,rx:`1`,key:`ublpy`}]]),I=E(`scan-line`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}]]),L=E(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),R=e(t()),z=n();function B(e,t){for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t.trim()}return``}function V(e,t){let n=Number(e[t]);return Number.isFinite(n)&&n>0?Math.round(n):0}function H(e){let t=A(e)?e:{},n=A(t.vector_freshness_global)?t.vector_freshness_global:{};return{vectorStatus:B(n,[`status`])||`unavailable`,vectorPending:V(n,`pending_items`),folders:O(t.folders).flatMap(e=>{let t=A(e)?e:{},n=B(t,[`id`]);if(!n)return[];let r=A(t.files)?t.files:{},i=t.coverage,a=O(t.deleted),o=V(r,`deleted`);return[{id:n,label:B(t,[`label`,`root_path`])||n,rootPath:B(t,[`root_path`,`label`])||``,status:B(t,[`status`]),watchActive:t.watch_active===!0,total:V(r,`total`),indexed:V(r,`indexed`),failed:V(r,`failed`),deleted:o>0?o:a.length,coverage:typeof i==`number`&&Number.isFinite(i)?i:null,errors:O(t.recent_errors).flatMap(e=>{let t=A(e)?e:{},n=B(t,[`detail`]);return n?[{path:B(t,[`path`]),detail:n}]:[]})}]})}}function ne(e){let t=A(e)?e:{},n=A(t.would_remove)?t.would_remove:{},r=e=>{let t=Number(n[e]);return Number.isFinite(t)&&t>0?Math.round(t):0},i=O(t.files).length;return{nodes:r(`nodes`),edges:r(`edges`),chunks:r(`chunks`),vectors:r(`vectors`),files:i}}function re({language:e}){let t=r(),[n,a]=R.useState(null),[o,s]=R.useState(null),[c,l]=R.useState(``),u=T({queryKey:[`folderMemoryHealth`],queryFn:()=>j.localFolderHealth(),staleTime:3e4}),d=R.useMemo(()=>u.data?.ok?H(u.data.data):null,[u.data]),f=i({mutationFn:e=>j.pruneFolderDeleted(e,!1),onSuccess:(t,n)=>{if(!t.ok){l(t.error||D(e,`capture.folderHealth.prune.error`,{reason:String(t.status)}));return}a(n),s(ne(t.data)),l(``)},onError:t=>{l(D(e,`capture.folderHealth.prune.error`,{reason:String(t)}))}}),p=i({mutationFn:e=>j.pruneFolderDeleted(e,!0),onSuccess:n=>{if(!n.ok){l(n.error||D(e,`capture.folderHealth.prune.error`,{reason:String(n.status)}));return}a(null),s(null),l(``),t.invalidateQueries({queryKey:[`folderMemoryHealth`]})},onError:t=>{l(D(e,`capture.folderHealth.prune.error`,{reason:String(t)}))}});return!d||!d.folders.length?null:(0,z.jsxs)(`section`,{className:`folder-memory-health`,"data-testid":`folder-memory-health`,children:[(0,z.jsx)(`h3`,{children:D(e,`capture.folderHealth.title`)}),(0,z.jsx)(`ul`,{children:d.folders.map(t=>(0,z.jsxs)(`li`,{"data-testid":`folder-health-${t.id}`,children:[(0,z.jsxs)(`div`,{className:`folder-memory-head`,children:[(0,z.jsx)(`strong`,{children:t.label}),(0,z.jsx)(`span`,{className:`folder-memory-coverage`,children:t.coverage===null?D(e,`capture.folderHealth.unknown`):D(e,`capture.folderHealth.coverage`,{percent:Math.round(t.coverage*100),indexed:t.indexed,total:t.total})})]}),t.coverage===null?null:(0,z.jsx)(`div`,{className:`folder-memory-bar`,role:`progressbar`,"aria-valuenow":Math.round(t.coverage*100),"aria-valuemin":0,"aria-valuemax":100,children:(0,z.jsx)(`span`,{style:{width:`${Math.round(t.coverage*100)}%`}})}),t.watchActive?(0,z.jsx)(`small`,{children:D(e,`capture.folderHealth.watching`)}):null,t.failed>0?(0,z.jsxs)(`details`,{className:`folder-memory-errors`,children:[(0,z.jsx)(`summary`,{children:D(e,`capture.folderHealth.failed`,{count:t.failed})}),(0,z.jsx)(`ul`,{children:t.errors.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsx)(`code`,{children:e.path}),(0,z.jsx)(`span`,{children:e.detail})]},`${t.id}-${e.path}-${e.detail}`))})]}):null,t.deleted>0&&t.rootPath?(0,z.jsx)(`div`,{className:`folder-memory-prune`,"data-testid":`folder-prune-${t.id}`,children:n===t.rootPath&&o?(0,z.jsxs)(`div`,{className:`folder-memory-prune-preview`,"data-testid":`folder-prune-preview-${t.id}`,children:[(0,z.jsx)(`p`,{children:D(e,`capture.folderHealth.prune.previewTitle`)}),(0,z.jsxs)(`ul`,{children:[(0,z.jsx)(`li`,{children:D(e,`capture.folderHealth.prune.files`,{count:o.files})}),(0,z.jsx)(`li`,{children:D(e,`capture.folderHealth.prune.nodes`,{count:o.nodes})}),(0,z.jsx)(`li`,{children:D(e,`capture.folderHealth.prune.edges`,{count:o.edges})}),(0,z.jsx)(`li`,{children:D(e,`capture.folderHealth.prune.chunks`,{count:o.chunks})}),(0,z.jsx)(`li`,{children:D(e,`capture.folderHealth.prune.vectors`,{count:o.vectors})})]}),(0,z.jsxs)(`div`,{className:`folder-memory-prune-actions`,children:[(0,z.jsx)(`button`,{type:`button`,"data-testid":`folder-prune-confirm-${t.id}`,disabled:p.isPending,onClick:()=>p.mutate(t.rootPath),children:D(e,`capture.folderHealth.prune.confirm`)}),(0,z.jsx)(`button`,{type:`button`,"data-testid":`folder-prune-cancel-${t.id}`,onClick:()=>{a(null),s(null)},children:D(e,`capture.folderHealth.prune.cancel`)})]})]}):(0,z.jsx)(`button`,{type:`button`,className:`folder-memory-prune-open`,"data-testid":`folder-prune-open-${t.id}`,disabled:f.isPending,onClick:()=>f.mutate(t.rootPath),children:D(e,`capture.folderHealth.prune`,{count:t.deleted})})}):null]},t.id))}),d.vectorPending>0?(0,z.jsx)(`small`,{className:`folder-memory-vector`,children:D(e,`capture.folderHealth.vectorGlobal`,{count:d.vectorPending})}):null,c?(0,z.jsx)(`small`,{className:`folder-memory-prune-error`,"data-testid":`folder-prune-error`,children:c}):null]})}var U=[{id:`files`,labelKey:`capture.method.files`,icon:L,path:`capture`},{id:`local`,labelKey:`capture.method.local`,icon:b,path:`my-computer`},{id:`browser`,labelKey:`capture.method.browser`,icon:x,path:`capture-browser`}];function W(e){return U.some(t=>t.id===e)?e:`files`}function G({initialTab:e}){let t=M(e=>e.language),[n,r]=R.useState(()=>W(e));R.useEffect(()=>{r(W(e))},[e]);let i=e=>{r(e),te(`/`+U.find(t=>t.id===e).path)};return(0,z.jsxs)(`div`,{className:`product-page capture-page space-y-5`,children:[(0,z.jsxs)(`header`,{className:`page-hero`,children:[(0,z.jsxs)(`div`,{className:`page-kicker`,children:[(0,z.jsx)(L,{className:`h-4 w-4`}),` `,D(t,`capture.kicker`)]}),(0,z.jsx)(`h1`,{className:`page-title`,children:D(t,`capture.title`)}),(0,z.jsx)(`p`,{className:`page-copy`,children:D(t,`capture.body`)})]}),(0,z.jsxs)(`section`,{className:`capture-station`,"aria-label":D(t,`capture.station.aria`),children:[(0,z.jsxs)(`div`,{className:`capture-station-head`,children:[(0,z.jsx)(`h2`,{children:D(t,`capture.station.title`)}),(0,z.jsx)(`p`,{children:D(t,`capture.station.detail`)})]}),(0,z.jsx)(`div`,{className:`capture-method-switch`,role:`group`,"aria-label":D(t,`capture.method.aria`),children:U.map(({id:e,labelKey:r,icon:a})=>(0,z.jsxs)(`button`,{type:`button`,"aria-pressed":n===e,className:n===e?`is-active`:``,"data-testid":`capture-method-${e}`,onClick:()=>i(e),children:[(0,z.jsx)(a,{className:`h-4 w-4`,"aria-hidden":`true`}),D(t,r)]},e))}),(0,z.jsxs)(`div`,{className:`capture-station-body`,children:[n===`files`?(0,z.jsx)(K,{}):null,n===`local`?(0,z.jsx)(Q,{}):null,n===`browser`?(0,z.jsx)(ue,{}):null]})]}),(0,z.jsxs)(`div`,{className:`capture-secondary`,children:[(0,z.jsx)(fe,{}),(0,z.jsx)(q,{})]})]})}function K(){let e=M(e=>e.language),t=r(),[n,a]=R.useState([]),o=i({mutationFn:e=>J(e,a),onSuccess:()=>{t.invalidateQueries({queryKey:[`documents`]}),t.invalidateQueries({queryKey:[`graphStats`]}),t.invalidateQueries({queryKey:[`memoryManager`]})}}),s=R.useCallback(e=>{let t=Array.from(e);t.length&&o.mutate(t)},[o]);return(0,z.jsxs)(`div`,{className:`space-y-4`,children:[(0,z.jsxs)(`label`,{className:`capture-dropzone`,onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),s(e.dataTransfer.files)},children:[(0,z.jsx)(`div`,{className:`capture-dropzone-mark`,children:(0,z.jsx)(L,{className:`h-6 w-6`})}),(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsx)(`span`,{className:`text-lg font-semibold block`,children:D(e,`capture.files.drop`)}),(0,z.jsx)(`span`,{className:`max-w-md text-sm text-muted-foreground block`,children:D(e,`capture.files.dropDetail`)})]}),(0,z.jsx)(`input`,{type:`file`,multiple:!0,className:`sr-only`,onChange:e=>e.target.files&&s(e.target.files)})]}),(0,z.jsx)(Y,{queue:n,onRetry:e=>s([e])})]})}function q(){let e=M(e=>e.language),t=M(e=>e.mode),n=T({queryKey:[`documents`],queryFn:()=>j.documents(200)}),r=T({queryKey:[`localSources`],queryFn:j.localSources}),i=T({queryKey:[`localAgent`],queryFn:j.localAgent});return(0,z.jsxs)(`div`,{className:`capture-secondary-column space-y-4`,children:[(0,z.jsx)(f,{title:D(e,`capture.files.uploaded`),result:n.data,children:t=>(0,z.jsxs)(`div`,{className:`space-y-3`,children:[(0,z.jsx)(u,{items:t.documents||t,titleKey:`filename`,metaKey:`ingest_state`,limit:12}),(0,z.jsx)(`div`,{className:`rounded-md border border-border bg-background/55 p-3 text-sm text-muted-foreground`,children:D(e,`capture.files.completed`)})]})}),(0,z.jsx)(re,{language:e}),(0,z.jsx)(f,{title:D(e,`capture.local.sources`),result:r.data,children:t=>(0,z.jsxs)(`div`,{className:`space-y-3`,children:[(0,z.jsx)(u,{items:t.sources,titleKey:`path`,metaKey:`status`}),O(t.sources).map(t=>(0,z.jsx)(m,{label:D(e,`capture.local.stop`,{source:String(t.path||t.id||D(e,`capture.local.source`))}),action:()=>j.localWatchStop(String(t.id||t.source_id)),invalidate:[`localSources`]},String(t.id||t.source_id||t.path)))]})}),t===`basic`?null:(0,z.jsx)(f,{title:D(e,`capture.local.access`),result:i.data,children:e=>(0,z.jsx)(h,{value:e})})]})}async function J(e,t){let n=e.map(e=>({id:`${e.name}-${e.size}-${e.lastModified}-${Date.now()}`,file:e,name:oe(e),size:e.size,status:`queued`}));t(e=>[...n,...e].slice(0,12));let r=[];for(let e of n){t(t=>t.map(t=>t.id===e.id?{...t,status:`uploading`}:t));let n=await j.uploadDocument(e.file);r.push(n),t(t=>t.map(t=>t.id===e.id?{...t,status:n.ok?`done`:`failed`,result:n}:t))}return r}function Y({queue:e,onRetry:t}){let n=M(e=>e.language);return e.length?(0,z.jsx)(`div`,{className:`mt-4 space-y-2`,children:e.map(e=>{let r=ie(e,n);return(0,z.jsxs)(`div`,{className:`rounded-md border border-border bg-background/55 p-3 text-sm`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[e.status===`done`?(0,z.jsx)(y,{className:`h-4 w-4 text-emerald-400`}):e.status===`failed`?(0,z.jsx)(_,{className:`h-4 w-4 text-amber-400`}):(0,z.jsx)(o,{className:`h-4 w-4 animate-spin text-primary`}),e.name]}),(0,z.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[Math.max(1,Math.round(e.size/1024)),` KB · `,r]})]}),e.status===`failed`?(0,z.jsxs)(N,{size:`sm`,variant:`outline`,onClick:()=>t(e.file),children:[(0,z.jsx)(w,{className:`h-3.5 w-3.5`}),` `,D(n,`capture.retry`)]}):null]}),e.result?(0,z.jsx)(s,{result:e.result,successLabel:D(n,`capture.files.success`)}):null]},e.id)})}):null}function ie(e,t){if(e.status===`queued`)return D(t,`capture.files.queued`);if(e.status===`uploading`)return D(t,`capture.files.uploading`);if(!e.result?.ok)return e.result?.error||D(t,`capture.files.failed`);let n=e.result.data||{},r=String(n.node_id||n.graph_node||n.provenance_id||``);return r?D(t,`capture.files.capturedWithNode`,{node:r}):D(t,`capture.files.captured`)}var ae={webkitdirectory:``,directory:``};function oe(e){return e.webkitRelativePath||e.name}function se(e){return(e[0]?.webkitRelativePath||``).split(`/`).filter(Boolean)[0]||``}function X(){let e=window;return!!(e.__TAURI__?.core?.invoke||e.latticeDesktop?.selectFolder||e.__TAURI_INTERNALS__&&window.location.protocol===`tauri:`)}function ce(e){return e instanceof DOMException&&e.name===`AbortError`}async function le(e){let t=[];if(typeof e.values==`function`){for await(let n of e.values())t.push(n);return t}if(typeof e.entries==`function`)for await(let[,n]of e.entries())t.push(n);return t}async function Z(e){let t=[];for(let n of await le(e)){if(n.kind===`file`){t.push(await n.getFile());continue}t.push(...await Z(n))}return t}function Q(){let e=M(e=>e.language),t=r(),n=R.useRef(null),[a,c]=R.useState(``),[l,u]=R.useState(null),[d,f]=R.useState(``),[p,m]=R.useState(!1),[h,g]=R.useState([]),_=i({mutationFn:e=>j.connectFolder(e.trim()),onSuccess:()=>{u(null),t.invalidateQueries({queryKey:[`localSources`]}),t.invalidateQueries({queryKey:[`graphStats`]}),t.invalidateQueries({queryKey:[`memoryManager`]})}}),v=i({mutationFn:e=>J(e,g),onSuccess:()=>{t.invalidateQueries({queryKey:[`documents`]}),t.invalidateQueries({queryKey:[`graphStats`]}),t.invalidateQueries({queryKey:[`memoryManager`]})}}),y=R.useCallback((t,n)=>{if(!t.length){u(D(e,`capture.local.emptyFolder`));return}u(null),f(n||se(t)||D(e,`capture.local.browserFolder`)),v.mutate(t)},[v,e]),x=R.useCallback(async()=>{if(!p){m(!0),u(null);try{let t=window.showDirectoryPicker;if(!X()&&typeof t==`function`){let e=await t.call(window);y(await Z(e),e.name);return}if(X()){let e=await j.selectFolder();if(e){f(``),c(e),_.mutate(e);return}}if(typeof t==`function`){let e=await t.call(window);y(await Z(e),e.name);return}if(n.current){n.current.click();return}u(D(e,`capture.local.pickUnavailable`))}catch(t){ce(t)||u(D(e,`capture.local.pickUnavailable`))}finally{m(!1)}}},[y,p,_,e]),S=R.useCallback(()=>{let e=a.trim();e&&(u(null),f(``),_.mutate(e))},[_,a]),C=(v.data||[]).find(e=>!e.ok)?.error,w=!!(v.error||C);return(0,z.jsxs)(`div`,{className:`space-y-3`,children:[(0,z.jsxs)(`div`,{className:`capture-intake-lead`,children:[(0,z.jsx)(b,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:D(e,`capture.local.title`)}),(0,z.jsx)(`p`,{children:D(e,`capture.local.description`)})]})]}),(0,z.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),S()},children:[(0,z.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,z.jsx)(P,{value:a,onChange:e=>c(e.target.value),placeholder:D(e,`capture.local.placeholder`)}),(0,z.jsxs)(N,{type:`button`,variant:`outline`,disabled:p||_.isPending||v.isPending,onClick:()=>void x(),children:[p?(0,z.jsx)(o,{className:`h-4 w-4 animate-spin`}):(0,z.jsx)(ee,{className:`h-4 w-4`}),p?D(e,`capture.local.choosing`):D(e,`capture.local.choose`)]})]}),(0,z.jsx)(`input`,{ref:n,type:`file`,multiple:!0,className:`sr-only`,"aria-hidden":`true`,tabIndex:-1,...ae,onChange:e=>{let t=Array.from(e.currentTarget.files||[]);e.currentTarget.value=``,y(t)}}),(0,z.jsxs)(N,{type:`submit`,disabled:!a.trim()||_.isPending,children:[_.isPending?(0,z.jsx)(o,{className:`h-4 w-4 animate-spin`}):(0,z.jsx)(I,{className:`h-4 w-4`}),D(e,`capture.local.connect`)]})]}),l?(0,z.jsx)(s,{result:{ok:!1,status:0,data:{},source:`unavailable`,error:l}}):null,_.data?(0,z.jsx)(s,{result:_.data,successLabel:D(e,`capture.local.success`)}):null,d?(0,z.jsx)(s,{result:{ok:v.isPending||!w,status:w?0:200,data:{folder:d},source:w?`unavailable`:`live`,error:v.error?D(e,`capture.local.browserImportFailed`):C},successLabel:v.isPending?D(e,`capture.local.browserImporting`):D(e,`capture.local.browserImportSuccess`,{folder:d})}):null,(0,z.jsx)(Y,{queue:h,onRetry:e=>y([e],d)})]})}function ue(){let e=M(e=>e.language),t=r(),[n,a]=R.useState(``),c=i({mutationFn:e=>j.browserReadUrl(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`graphStats`]}),t.invalidateQueries({queryKey:[`memoryManager`]})}}),l=R.useCallback(()=>{let e=$(n);e&&(a(e),c.mutate(e))},[c,n]),u=R.useCallback(async()=>{let e=$(await navigator.clipboard?.readText().catch(()=>``)||``);e&&(a(e),c.mutate(e))},[c]);return(0,z.jsxs)(`div`,{className:`space-y-3`,children:[(0,z.jsxs)(`div`,{className:`capture-intake-lead`,children:[(0,z.jsx)(x,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:D(e,`capture.browser.title`)}),(0,z.jsx)(`p`,{children:D(e,`capture.browser.description`)})]})]}),(0,z.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row`,onSubmit:e=>{e.preventDefault(),l()},children:[(0,z.jsx)(P,{value:n,onChange:e=>a(e.target.value),placeholder:D(e,`capture.browser.placeholder`),inputMode:`url`}),(0,z.jsxs)(N,{type:`button`,variant:`outline`,disabled:c.isPending,onClick:()=>void u(),children:[(0,z.jsx)(F,{className:`h-4 w-4`}),` `,D(e,`capture.browser.paste`)]}),(0,z.jsxs)(N,{type:`submit`,disabled:!n.trim()||c.isPending,children:[c.isPending?(0,z.jsx)(o,{className:`h-4 w-4 animate-spin`}):(0,z.jsx)(I,{className:`h-4 w-4`}),D(e,`capture.browser.capture`)]})]}),c.data?(0,z.jsx)(s,{result:c.data,successLabel:D(e,`capture.browser.success`)}):null]})}function $(e){let t=e.trim();return t?/^https?:\/\//i.test(t)?t:/^[\w.-]+\.[a-z]{2,}([/:?#].*)?$/i.test(t)?`https://${t}`:t:``}function de(e,t,n){let r=A(e)?e:{},i=A(t)?t:{},a=A(n)?n:{};A(i.pipelines)&&i.pipelines;let o=(...e)=>{for(let t of e){if(typeof t==`number`&&Number.isFinite(t)&&t>=0)return Math.round(t);let e=Number(t);if(Number.isFinite(e)&&e>0)return Math.round(e)}},s=o(r.received),c=o(r.extracted),l=o(r.connected),u=o(c,i.total,i.total_items,a.nodes,a.total_nodes)||0,d=o(l,a.edges,a.total_edges)||0,f=o(i.pending,i.pending_items)||0,p=(e,t)=>{let n=r.stages||{};for(let t of e){let e=n[t],r=typeof e==`object`&&e?e.status:e;if(r===`done`||r===`working`||r===`waiting`||r===`error`)return r}return t},m=s===void 0?f?`working`:u?`done`:`waiting`:s>0?`done`:`waiting`,h=c===void 0?u?`done`:`waiting`:c>0?`done`:`waiting`,g=l===void 0?d?`done`:`waiting`:l>0?`done`:`waiting`,_=p([`read`,`received`],m),v=p([`understand`,`extracted`],h),y=p([`connect`,`connected`],g);return{remembered:u,connections:d,waiting:f,received:s??f,extracted:c??u,connected:l??d,steps:[{key:`read`,state:_,count:s??(u||f)},{key:`understand`,state:v,count:c??u},{key:`connect`,state:y,count:l??d}]}}function fe(){let e=M(e=>e.language),t=M(e=>e.mode),n=T({queryKey:[`index`],queryFn:j.indexStatus}),r=T({queryKey:[`graphStats`],queryFn:j.graphStats}),i=T({queryKey:[`pipelineStatus`],queryFn:j.pipelineStatus}),o=de(i.data?.data||i.data,n.data?.data,r.data?.data),s={read:I,understand:v,connect:C},u=!!(o.remembered||o.connections||o.received&&o.received>0);return(0,z.jsxs)(`div`,{className:`capture-secondary-column space-y-4`,children:[(0,z.jsxs)(p,{children:[(0,z.jsxs)(c,{children:[(0,z.jsxs)(a,{className:`flex items-center gap-2`,children:[(0,z.jsx)(I,{className:`h-4 w-4`}),` `,D(e,`capture.pipeline.journey.title`)]}),(0,z.jsx)(l,{children:D(e,`capture.pipeline.journey.detail`)})]}),(0,z.jsxs)(d,{className:`space-y-4`,children:[(0,z.jsx)(`ol`,{className:`capture-journey flex flex-col md:flex-row gap-3 items-stretch`,"aria-label":D(e,`capture.pipeline.journey.aria`),children:o.steps.map(({key:t,state:n,count:r})=>{let i=s[t];return(0,z.jsxs)(`li`,{className:`capture-journey-step is-${n} flex-1 p-3 rounded-lg border border-border/60 bg-muted/20 flex flex-col justify-between`,children:[(0,z.jsxs)(`div`,{className:`capture-journey-step-header flex items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`capture-journey-mark`,"aria-hidden":`true`,children:(0,z.jsx)(i,{className:`h-4 w-4`})}),(0,z.jsxs)(`div`,{className:`capture-journey-copy min-w-0 flex-1`,children:[(0,z.jsx)(`strong`,{className:`block text-sm`,children:D(e,`capture.pipeline.step.${t}`)}),(0,z.jsx)(`small`,{className:`block text-xs text-muted-foreground`,children:D(e,`capture.pipeline.step.${t}.detail`)})]})]}),(0,z.jsxs)(`div`,{className:`capture-journey-step-meta flex items-center justify-between gap-2 mt-3 pt-2 border-t border-border/40 text-xs`,children:[(0,z.jsx)(g,{variant:`muted`,className:`capture-journey-count`,children:D(e,`ui.value.records`,{count:r})}),(0,z.jsx)(`span`,{className:`capture-journey-state`,children:D(e,`capture.pipeline.step.${n}`)})]})]},t)})}),u?(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-sm pt-2`,children:[(0,z.jsx)(g,{variant:`success`,children:D(e,`capture.pipeline.count.remembered`,{count:k(o.extracted)})}),(0,z.jsx)(g,{variant:`muted`,children:D(e,`capture.pipeline.count.connections`,{count:k(o.connected)})}),(0,z.jsx)(g,{variant:o.waiting?`warning`:`muted`,children:o.waiting?D(e,`capture.pipeline.count.waiting`,{count:k(o.waiting)}):D(e,`capture.pipeline.count.none`)})]}):(0,z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:D(e,`capture.pipeline.empty`)})]})]}),(0,z.jsxs)(p,{children:[(0,z.jsxs)(c,{children:[(0,z.jsxs)(a,{className:`flex items-center gap-2`,children:[(0,z.jsx)(S,{className:`h-4 w-4`}),` `,D(e,`capture.pipeline.refresh`)]}),(0,z.jsx)(l,{children:D(e,`capture.pipeline.description`)})]}),(0,z.jsx)(d,{children:(0,z.jsx)(m,{label:D(e,`capture.pipeline.rebuild`),action:()=>j.rebuildIndex(),invalidate:[`index`]})})]}),t===`basic`?null:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(f,{title:D(e,`capture.pipeline.status`),result:n.data,children:e=>(0,z.jsx)(h,{value:e})}),(0,z.jsx)(f,{title:D(e,`capture.pipeline.growth`),result:r.data,children:e=>(0,z.jsx)(h,{value:e})})]})]})}export{G as CapturePage};
|
|
1
|
+
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{n as r}from"./QueryClientProvider-B3OjqSyJ.js";import{t as i}from"./useMutation-B8QKq2NW.js";import{_ as a,b as o,c as s,g as c,h as l,i as u,m as d,n as f,p,t as m,u as h,v as g,x as _,y as v}from"./primitives-BDryQl6H.js";import{t as y}from"./circle-check-BxaDWjPR.js";import{n as b,r as x,t as S}from"./hard-drive-BOzmS-cq.js";import{t as ee}from"./folder-open-YmGugIBf.js";import{t as C}from"./share-2-B-gPv2ec.js";import{A as w,H as T,R as E,S as D,c as O,d as k,o as te,p as A,v as j,z as M}from"./index-CfeqZ9Ri.js";import{t as N}from"./button-BA0N_zId.js";import{t as P}from"./input-CFfCfMjO.js";import"./workspace-BmfVs66W.js";var F=E(`clipboard-paste`,[[`path`,{d:`M11 14h10`,key:`1w8e9d`}],[`path`,{d:`M16 4h2a2 2 0 0 1 2 2v1.344`,key:`1e62lh`}],[`path`,{d:`m17 18 4-4-4-4`,key:`z2g111`}],[`path`,{d:`M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 1.793-1.113`,key:`bjbb7m`}],[`rect`,{x:`8`,y:`2`,width:`8`,height:`4`,rx:`1`,key:`ublpy`}]]),I=E(`scan-line`,[[`path`,{d:`M3 7V5a2 2 0 0 1 2-2h2`,key:`aa7l1z`}],[`path`,{d:`M17 3h2a2 2 0 0 1 2 2v2`,key:`4qcy5o`}],[`path`,{d:`M21 17v2a2 2 0 0 1-2 2h-2`,key:`6vwrx8`}],[`path`,{d:`M7 21H5a2 2 0 0 1-2-2v-2`,key:`ioqczr`}],[`path`,{d:`M7 12h10`,key:`b7w52i`}]]),L=E(`upload`,[[`path`,{d:`M12 3v12`,key:`1x0j5s`}],[`path`,{d:`m17 8-5-5-5 5`,key:`7q97r8`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}]]),R=e(t()),z=n();function B(e,t){for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim())return t.trim()}return``}function V(e,t){let n=Number(e[t]);return Number.isFinite(n)&&n>0?Math.round(n):0}function H(e){let t=A(e)?e:{},n=A(t.vector_freshness_global)?t.vector_freshness_global:{};return{vectorStatus:B(n,[`status`])||`unavailable`,vectorPending:V(n,`pending_items`),folders:O(t.folders).flatMap(e=>{let t=A(e)?e:{},n=B(t,[`id`]);if(!n)return[];let r=A(t.files)?t.files:{},i=t.coverage,a=O(t.deleted),o=V(r,`deleted`);return[{id:n,label:B(t,[`label`,`root_path`])||n,rootPath:B(t,[`root_path`,`label`])||``,status:B(t,[`status`]),watchActive:t.watch_active===!0,total:V(r,`total`),indexed:V(r,`indexed`),failed:V(r,`failed`),deleted:o>0?o:a.length,coverage:typeof i==`number`&&Number.isFinite(i)?i:null,errors:O(t.recent_errors).flatMap(e=>{let t=A(e)?e:{},n=B(t,[`detail`]);return n?[{path:B(t,[`path`]),detail:n}]:[]})}]})}}function ne(e){let t=A(e)?e:{},n=A(t.would_remove)?t.would_remove:{},r=e=>{let t=Number(n[e]);return Number.isFinite(t)&&t>0?Math.round(t):0},i=O(t.files).length;return{nodes:r(`nodes`),edges:r(`edges`),chunks:r(`chunks`),vectors:r(`vectors`),files:i}}function re({language:e}){let t=r(),[n,a]=R.useState(null),[o,s]=R.useState(null),[c,l]=R.useState(``),u=T({queryKey:[`folderMemoryHealth`],queryFn:()=>j.localFolderHealth(),staleTime:3e4}),d=R.useMemo(()=>u.data?.ok?H(u.data.data):null,[u.data]),f=i({mutationFn:e=>j.pruneFolderDeleted(e,!1),onSuccess:(t,n)=>{if(!t.ok){l(t.error||D(e,`capture.folderHealth.prune.error`,{reason:String(t.status)}));return}a(n),s(ne(t.data)),l(``)},onError:t=>{l(D(e,`capture.folderHealth.prune.error`,{reason:String(t)}))}}),p=i({mutationFn:e=>j.pruneFolderDeleted(e,!0),onSuccess:n=>{if(!n.ok){l(n.error||D(e,`capture.folderHealth.prune.error`,{reason:String(n.status)}));return}a(null),s(null),l(``),t.invalidateQueries({queryKey:[`folderMemoryHealth`]})},onError:t=>{l(D(e,`capture.folderHealth.prune.error`,{reason:String(t)}))}});return!d||!d.folders.length?null:(0,z.jsxs)(`section`,{className:`folder-memory-health`,"data-testid":`folder-memory-health`,children:[(0,z.jsx)(`h3`,{children:D(e,`capture.folderHealth.title`)}),(0,z.jsx)(`ul`,{children:d.folders.map(t=>(0,z.jsxs)(`li`,{"data-testid":`folder-health-${t.id}`,children:[(0,z.jsxs)(`div`,{className:`folder-memory-head`,children:[(0,z.jsx)(`strong`,{children:t.label}),(0,z.jsx)(`span`,{className:`folder-memory-coverage`,children:t.coverage===null?D(e,`capture.folderHealth.unknown`):D(e,`capture.folderHealth.coverage`,{percent:Math.round(t.coverage*100),indexed:t.indexed,total:t.total})})]}),t.coverage===null?null:(0,z.jsx)(`div`,{className:`folder-memory-bar`,role:`progressbar`,"aria-valuenow":Math.round(t.coverage*100),"aria-valuemin":0,"aria-valuemax":100,children:(0,z.jsx)(`span`,{style:{width:`${Math.round(t.coverage*100)}%`}})}),t.watchActive?(0,z.jsx)(`small`,{children:D(e,`capture.folderHealth.watching`)}):null,t.failed>0?(0,z.jsxs)(`details`,{className:`folder-memory-errors`,children:[(0,z.jsx)(`summary`,{children:D(e,`capture.folderHealth.failed`,{count:t.failed})}),(0,z.jsx)(`ul`,{children:t.errors.map(e=>(0,z.jsxs)(`li`,{children:[(0,z.jsx)(`code`,{children:e.path}),(0,z.jsx)(`span`,{children:e.detail})]},`${t.id}-${e.path}-${e.detail}`))})]}):null,t.deleted>0&&t.rootPath?(0,z.jsx)(`div`,{className:`folder-memory-prune`,"data-testid":`folder-prune-${t.id}`,children:n===t.rootPath&&o?(0,z.jsxs)(`div`,{className:`folder-memory-prune-preview`,"data-testid":`folder-prune-preview-${t.id}`,children:[(0,z.jsx)(`p`,{children:D(e,`capture.folderHealth.prune.previewTitle`)}),(0,z.jsxs)(`ul`,{children:[(0,z.jsx)(`li`,{children:D(e,`capture.folderHealth.prune.files`,{count:o.files})}),(0,z.jsx)(`li`,{children:D(e,`capture.folderHealth.prune.nodes`,{count:o.nodes})}),(0,z.jsx)(`li`,{children:D(e,`capture.folderHealth.prune.edges`,{count:o.edges})}),(0,z.jsx)(`li`,{children:D(e,`capture.folderHealth.prune.chunks`,{count:o.chunks})}),(0,z.jsx)(`li`,{children:D(e,`capture.folderHealth.prune.vectors`,{count:o.vectors})})]}),(0,z.jsxs)(`div`,{className:`folder-memory-prune-actions`,children:[(0,z.jsx)(`button`,{type:`button`,"data-testid":`folder-prune-confirm-${t.id}`,disabled:p.isPending,onClick:()=>p.mutate(t.rootPath),children:D(e,`capture.folderHealth.prune.confirm`)}),(0,z.jsx)(`button`,{type:`button`,"data-testid":`folder-prune-cancel-${t.id}`,onClick:()=>{a(null),s(null)},children:D(e,`capture.folderHealth.prune.cancel`)})]})]}):(0,z.jsx)(`button`,{type:`button`,className:`folder-memory-prune-open`,"data-testid":`folder-prune-open-${t.id}`,disabled:f.isPending,onClick:()=>f.mutate(t.rootPath),children:D(e,`capture.folderHealth.prune`,{count:t.deleted})})}):null]},t.id))}),d.vectorPending>0?(0,z.jsx)(`small`,{className:`folder-memory-vector`,children:D(e,`capture.folderHealth.vectorGlobal`,{count:d.vectorPending})}):null,c?(0,z.jsx)(`small`,{className:`folder-memory-prune-error`,"data-testid":`folder-prune-error`,children:c}):null]})}var U=[{id:`files`,labelKey:`capture.method.files`,icon:L,path:`capture`},{id:`local`,labelKey:`capture.method.local`,icon:b,path:`my-computer`},{id:`browser`,labelKey:`capture.method.browser`,icon:x,path:`capture-browser`}];function W(e){return U.some(t=>t.id===e)?e:`files`}function G({initialTab:e}){let t=M(e=>e.language),[n,r]=R.useState(()=>W(e));R.useEffect(()=>{r(W(e))},[e]);let i=e=>{r(e),te(`/`+U.find(t=>t.id===e).path)};return(0,z.jsxs)(`div`,{className:`product-page capture-page space-y-5`,children:[(0,z.jsxs)(`header`,{className:`page-hero`,children:[(0,z.jsxs)(`div`,{className:`page-kicker`,children:[(0,z.jsx)(L,{className:`h-4 w-4`}),` `,D(t,`capture.kicker`)]}),(0,z.jsx)(`h1`,{className:`page-title`,children:D(t,`capture.title`)}),(0,z.jsx)(`p`,{className:`page-copy`,children:D(t,`capture.body`)})]}),(0,z.jsxs)(`section`,{className:`capture-station`,"aria-label":D(t,`capture.station.aria`),children:[(0,z.jsxs)(`div`,{className:`capture-station-head`,children:[(0,z.jsx)(`h2`,{children:D(t,`capture.station.title`)}),(0,z.jsx)(`p`,{children:D(t,`capture.station.detail`)})]}),(0,z.jsx)(`div`,{className:`capture-method-switch`,role:`group`,"aria-label":D(t,`capture.method.aria`),children:U.map(({id:e,labelKey:r,icon:a})=>(0,z.jsxs)(`button`,{type:`button`,"aria-pressed":n===e,className:n===e?`is-active`:``,"data-testid":`capture-method-${e}`,onClick:()=>i(e),children:[(0,z.jsx)(a,{className:`h-4 w-4`,"aria-hidden":`true`}),D(t,r)]},e))}),(0,z.jsxs)(`div`,{className:`capture-station-body`,children:[n===`files`?(0,z.jsx)(K,{}):null,n===`local`?(0,z.jsx)(Q,{}):null,n===`browser`?(0,z.jsx)(ue,{}):null]})]}),(0,z.jsxs)(`div`,{className:`capture-secondary`,children:[(0,z.jsx)(fe,{}),(0,z.jsx)(q,{})]})]})}function K(){let e=M(e=>e.language),t=r(),[n,a]=R.useState([]),o=i({mutationFn:e=>J(e,a),onSuccess:()=>{t.invalidateQueries({queryKey:[`documents`]}),t.invalidateQueries({queryKey:[`graphStats`]}),t.invalidateQueries({queryKey:[`memoryManager`]})}}),s=R.useCallback(e=>{let t=Array.from(e);t.length&&o.mutate(t)},[o]);return(0,z.jsxs)(`div`,{className:`space-y-4`,children:[(0,z.jsxs)(`label`,{className:`capture-dropzone`,onDragOver:e=>e.preventDefault(),onDrop:e=>{e.preventDefault(),s(e.dataTransfer.files)},children:[(0,z.jsx)(`div`,{className:`capture-dropzone-mark`,children:(0,z.jsx)(L,{className:`h-6 w-6`})}),(0,z.jsxs)(`div`,{className:`space-y-1`,children:[(0,z.jsx)(`span`,{className:`text-lg font-semibold block`,children:D(e,`capture.files.drop`)}),(0,z.jsx)(`span`,{className:`max-w-md text-sm text-muted-foreground block`,children:D(e,`capture.files.dropDetail`)})]}),(0,z.jsx)(`input`,{type:`file`,multiple:!0,className:`sr-only`,onChange:e=>e.target.files&&s(e.target.files)})]}),(0,z.jsx)(Y,{queue:n,onRetry:e=>s([e])})]})}function q(){let e=M(e=>e.language),t=M(e=>e.mode),n=T({queryKey:[`documents`],queryFn:()=>j.documents(200)}),r=T({queryKey:[`localSources`],queryFn:j.localSources}),i=T({queryKey:[`localAgent`],queryFn:j.localAgent});return(0,z.jsxs)(`div`,{className:`capture-secondary-column space-y-4`,children:[(0,z.jsx)(f,{title:D(e,`capture.files.uploaded`),result:n.data,children:t=>(0,z.jsxs)(`div`,{className:`space-y-3`,children:[(0,z.jsx)(u,{items:t.documents||t,titleKey:`filename`,metaKey:`ingest_state`,limit:12}),(0,z.jsx)(`div`,{className:`rounded-md border border-border bg-background/55 p-3 text-sm text-muted-foreground`,children:D(e,`capture.files.completed`)})]})}),(0,z.jsx)(re,{language:e}),(0,z.jsx)(f,{title:D(e,`capture.local.sources`),result:r.data,children:t=>(0,z.jsxs)(`div`,{className:`space-y-3`,children:[(0,z.jsx)(u,{items:t.sources,titleKey:`path`,metaKey:`status`}),O(t.sources).map(t=>(0,z.jsx)(m,{label:D(e,`capture.local.stop`,{source:String(t.path||t.id||D(e,`capture.local.source`))}),action:()=>j.localWatchStop(String(t.id||t.source_id)),invalidate:[`localSources`]},String(t.id||t.source_id||t.path)))]})}),t===`basic`?null:(0,z.jsx)(f,{title:D(e,`capture.local.access`),result:i.data,children:e=>(0,z.jsx)(h,{value:e})})]})}async function J(e,t){let n=e.map(e=>({id:`${e.name}-${e.size}-${e.lastModified}-${Date.now()}`,file:e,name:oe(e),size:e.size,status:`queued`}));t(e=>[...n,...e].slice(0,12));let r=[];for(let e of n){t(t=>t.map(t=>t.id===e.id?{...t,status:`uploading`}:t));let n=await j.uploadDocument(e.file);r.push(n),t(t=>t.map(t=>t.id===e.id?{...t,status:n.ok?`done`:`failed`,result:n}:t))}return r}function Y({queue:e,onRetry:t}){let n=M(e=>e.language);return e.length?(0,z.jsx)(`div`,{className:`mt-4 space-y-2`,children:e.map(e=>{let r=ie(e,n);return(0,z.jsxs)(`div`,{className:`rounded-md border border-border bg-background/55 p-3 text-sm`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start justify-between gap-3`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 font-medium`,children:[e.status===`done`?(0,z.jsx)(y,{className:`h-4 w-4 text-emerald-400`}):e.status===`failed`?(0,z.jsx)(_,{className:`h-4 w-4 text-amber-400`}):(0,z.jsx)(o,{className:`h-4 w-4 animate-spin text-primary`}),e.name]}),(0,z.jsxs)(`div`,{className:`mt-1 text-xs text-muted-foreground`,children:[Math.max(1,Math.round(e.size/1024)),` KB · `,r]})]}),e.status===`failed`?(0,z.jsxs)(N,{size:`sm`,variant:`outline`,onClick:()=>t(e.file),children:[(0,z.jsx)(w,{className:`h-3.5 w-3.5`}),` `,D(n,`capture.retry`)]}):null]}),e.result?(0,z.jsx)(s,{result:e.result,successLabel:D(n,`capture.files.success`)}):null]},e.id)})}):null}function ie(e,t){if(e.status===`queued`)return D(t,`capture.files.queued`);if(e.status===`uploading`)return D(t,`capture.files.uploading`);if(!e.result?.ok)return e.result?.error||D(t,`capture.files.failed`);let n=e.result.data||{},r=String(n.node_id||n.graph_node||n.provenance_id||``);return r?D(t,`capture.files.capturedWithNode`,{node:r}):D(t,`capture.files.captured`)}var ae={webkitdirectory:``,directory:``};function oe(e){return e.webkitRelativePath||e.name}function se(e){return(e[0]?.webkitRelativePath||``).split(`/`).filter(Boolean)[0]||``}function X(){let e=window;return!!(e.__TAURI__?.core?.invoke||e.latticeDesktop?.selectFolder||e.__TAURI_INTERNALS__&&window.location.protocol===`tauri:`)}function ce(e){return e instanceof DOMException&&e.name===`AbortError`}async function le(e){let t=[];if(typeof e.values==`function`){for await(let n of e.values())t.push(n);return t}if(typeof e.entries==`function`)for await(let[,n]of e.entries())t.push(n);return t}async function Z(e){let t=[];for(let n of await le(e)){if(n.kind===`file`){t.push(await n.getFile());continue}t.push(...await Z(n))}return t}function Q(){let e=M(e=>e.language),t=r(),n=R.useRef(null),[a,c]=R.useState(``),[l,u]=R.useState(null),[d,f]=R.useState(``),[p,m]=R.useState(!1),[h,g]=R.useState([]),_=i({mutationFn:e=>j.connectFolder(e.trim()),onSuccess:()=>{u(null),t.invalidateQueries({queryKey:[`localSources`]}),t.invalidateQueries({queryKey:[`graphStats`]}),t.invalidateQueries({queryKey:[`memoryManager`]})}}),v=i({mutationFn:e=>J(e,g),onSuccess:()=>{t.invalidateQueries({queryKey:[`documents`]}),t.invalidateQueries({queryKey:[`graphStats`]}),t.invalidateQueries({queryKey:[`memoryManager`]})}}),y=R.useCallback((t,n)=>{if(!t.length){u(D(e,`capture.local.emptyFolder`));return}u(null),f(n||se(t)||D(e,`capture.local.browserFolder`)),v.mutate(t)},[v,e]),x=R.useCallback(async()=>{if(!p){m(!0),u(null);try{let t=window.showDirectoryPicker;if(!X()&&typeof t==`function`){let e=await t.call(window);y(await Z(e),e.name);return}if(X()){let e=await j.selectFolder();if(e){f(``),c(e),_.mutate(e);return}}if(typeof t==`function`){let e=await t.call(window);y(await Z(e),e.name);return}if(n.current){n.current.click();return}u(D(e,`capture.local.pickUnavailable`))}catch(t){ce(t)||u(D(e,`capture.local.pickUnavailable`))}finally{m(!1)}}},[y,p,_,e]),S=R.useCallback(()=>{let e=a.trim();e&&(u(null),f(``),_.mutate(e))},[_,a]),C=(v.data||[]).find(e=>!e.ok)?.error,w=!!(v.error||C);return(0,z.jsxs)(`div`,{className:`space-y-3`,children:[(0,z.jsxs)(`div`,{className:`capture-intake-lead`,children:[(0,z.jsx)(b,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:D(e,`capture.local.title`)}),(0,z.jsx)(`p`,{children:D(e,`capture.local.description`)})]})]}),(0,z.jsxs)(`form`,{className:`space-y-3`,onSubmit:e=>{e.preventDefault(),S()},children:[(0,z.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row`,children:[(0,z.jsx)(P,{value:a,onChange:e=>c(e.target.value),placeholder:D(e,`capture.local.placeholder`)}),(0,z.jsxs)(N,{type:`button`,variant:`outline`,disabled:p||_.isPending||v.isPending,onClick:()=>void x(),children:[p?(0,z.jsx)(o,{className:`h-4 w-4 animate-spin`}):(0,z.jsx)(ee,{className:`h-4 w-4`}),p?D(e,`capture.local.choosing`):D(e,`capture.local.choose`)]})]}),(0,z.jsx)(`input`,{ref:n,type:`file`,multiple:!0,className:`sr-only`,"aria-hidden":`true`,tabIndex:-1,...ae,onChange:e=>{let t=Array.from(e.currentTarget.files||[]);e.currentTarget.value=``,y(t)}}),(0,z.jsxs)(N,{type:`submit`,disabled:!a.trim()||_.isPending,children:[_.isPending?(0,z.jsx)(o,{className:`h-4 w-4 animate-spin`}):(0,z.jsx)(I,{className:`h-4 w-4`}),D(e,`capture.local.connect`)]})]}),l?(0,z.jsx)(s,{result:{ok:!1,status:0,data:{},source:`unavailable`,error:l}}):null,_.data?(0,z.jsx)(s,{result:_.data,successLabel:D(e,`capture.local.success`)}):null,d?(0,z.jsx)(s,{result:{ok:v.isPending||!w,status:w?0:200,data:{folder:d},source:w?`unavailable`:`live`,error:v.error?D(e,`capture.local.browserImportFailed`):C},successLabel:v.isPending?D(e,`capture.local.browserImporting`):D(e,`capture.local.browserImportSuccess`,{folder:d})}):null,(0,z.jsx)(Y,{queue:h,onRetry:e=>y([e],d)})]})}function ue(){let e=M(e=>e.language),t=r(),[n,a]=R.useState(``),c=i({mutationFn:e=>j.browserReadUrl(e),onSuccess:()=>{t.invalidateQueries({queryKey:[`graphStats`]}),t.invalidateQueries({queryKey:[`memoryManager`]})}}),l=R.useCallback(()=>{let e=$(n);e&&(a(e),c.mutate(e))},[c,n]),u=R.useCallback(async()=>{let e=$(await navigator.clipboard?.readText().catch(()=>``)||``);e&&(a(e),c.mutate(e))},[c]);return(0,z.jsxs)(`div`,{className:`space-y-3`,children:[(0,z.jsxs)(`div`,{className:`capture-intake-lead`,children:[(0,z.jsx)(x,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`strong`,{children:D(e,`capture.browser.title`)}),(0,z.jsx)(`p`,{children:D(e,`capture.browser.description`)})]})]}),(0,z.jsxs)(`form`,{className:`flex flex-col gap-2 sm:flex-row`,onSubmit:e=>{e.preventDefault(),l()},children:[(0,z.jsx)(P,{value:n,onChange:e=>a(e.target.value),placeholder:D(e,`capture.browser.placeholder`),inputMode:`url`}),(0,z.jsxs)(N,{type:`button`,variant:`outline`,disabled:c.isPending,onClick:()=>void u(),children:[(0,z.jsx)(F,{className:`h-4 w-4`}),` `,D(e,`capture.browser.paste`)]}),(0,z.jsxs)(N,{type:`submit`,disabled:!n.trim()||c.isPending,children:[c.isPending?(0,z.jsx)(o,{className:`h-4 w-4 animate-spin`}):(0,z.jsx)(I,{className:`h-4 w-4`}),D(e,`capture.browser.capture`)]})]}),c.data?(0,z.jsx)(s,{result:c.data,successLabel:D(e,`capture.browser.success`)}):null]})}function $(e){let t=e.trim();return t?/^https?:\/\//i.test(t)?t:/^[\w.-]+\.[a-z]{2,}([/:?#].*)?$/i.test(t)?`https://${t}`:t:``}function de(e,t,n){let r=A(e)?e:{},i=A(t)?t:{},a=A(n)?n:{};A(i.pipelines)&&i.pipelines;let o=(...e)=>{for(let t of e){if(typeof t==`number`&&Number.isFinite(t)&&t>=0)return Math.round(t);let e=Number(t);if(Number.isFinite(e)&&e>0)return Math.round(e)}},s=o(r.received),c=o(r.extracted),l=o(r.connected),u=o(c,i.total,i.total_items,a.nodes,a.total_nodes)||0,d=o(l,a.edges,a.total_edges)||0,f=o(i.pending,i.pending_items)||0,p=(e,t)=>{let n=r.stages||{};for(let t of e){let e=n[t],r=typeof e==`object`&&e?e.status:e;if(r===`done`||r===`working`||r===`waiting`||r===`error`)return r}return t},m=s===void 0?f?`working`:u?`done`:`waiting`:s>0?`done`:`waiting`,h=c===void 0?u?`done`:`waiting`:c>0?`done`:`waiting`,g=l===void 0?d?`done`:`waiting`:l>0?`done`:`waiting`,_=p([`read`,`received`],m),v=p([`understand`,`extracted`],h),y=p([`connect`,`connected`],g);return{remembered:u,connections:d,waiting:f,received:s??f,extracted:c??u,connected:l??d,steps:[{key:`read`,state:_,count:s??(u||f)},{key:`understand`,state:v,count:c??u},{key:`connect`,state:y,count:l??d}]}}function fe(){let e=M(e=>e.language),t=M(e=>e.mode),n=T({queryKey:[`index`],queryFn:j.indexStatus}),r=T({queryKey:[`graphStats`],queryFn:j.graphStats}),i=T({queryKey:[`pipelineStatus`],queryFn:j.pipelineStatus}),o=de(i.data?.data||i.data,n.data?.data,r.data?.data),s={read:I,understand:v,connect:C},u=!!(o.remembered||o.connections||o.received&&o.received>0);return(0,z.jsxs)(`div`,{className:`capture-secondary-column space-y-4`,children:[(0,z.jsxs)(p,{children:[(0,z.jsxs)(c,{children:[(0,z.jsxs)(a,{className:`flex items-center gap-2`,children:[(0,z.jsx)(I,{className:`h-4 w-4`}),` `,D(e,`capture.pipeline.journey.title`)]}),(0,z.jsx)(l,{children:D(e,`capture.pipeline.journey.detail`)})]}),(0,z.jsxs)(d,{className:`space-y-4`,children:[(0,z.jsx)(`ol`,{className:`capture-journey flex flex-col md:flex-row gap-3 items-stretch`,"aria-label":D(e,`capture.pipeline.journey.aria`),children:o.steps.map(({key:t,state:n,count:r})=>{let i=s[t];return(0,z.jsxs)(`li`,{className:`capture-journey-step is-${n} flex-1 p-3 rounded-lg border border-border/60 bg-muted/20 flex flex-col justify-between`,children:[(0,z.jsxs)(`div`,{className:`capture-journey-step-header flex items-center gap-2`,children:[(0,z.jsx)(`span`,{className:`capture-journey-mark`,"aria-hidden":`true`,children:(0,z.jsx)(i,{className:`h-4 w-4`})}),(0,z.jsxs)(`div`,{className:`capture-journey-copy min-w-0 flex-1`,children:[(0,z.jsx)(`strong`,{className:`block text-sm`,children:D(e,`capture.pipeline.step.${t}`)}),(0,z.jsx)(`small`,{className:`block text-xs text-muted-foreground`,children:D(e,`capture.pipeline.step.${t}.detail`)})]})]}),(0,z.jsxs)(`div`,{className:`capture-journey-step-meta flex items-center justify-between gap-2 mt-3 pt-2 border-t border-border/40 text-xs`,children:[(0,z.jsx)(g,{variant:`muted`,className:`capture-journey-count`,children:D(e,`ui.value.records`,{count:r})}),(0,z.jsx)(`span`,{className:`capture-journey-state`,children:D(e,`capture.pipeline.step.${n}`)})]})]},t)})}),u?(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-sm pt-2`,children:[(0,z.jsx)(g,{variant:`success`,children:D(e,`capture.pipeline.count.remembered`,{count:k(o.extracted)})}),(0,z.jsx)(g,{variant:`muted`,children:D(e,`capture.pipeline.count.connections`,{count:k(o.connected)})}),(0,z.jsx)(g,{variant:o.waiting?`warning`:`muted`,children:o.waiting?D(e,`capture.pipeline.count.waiting`,{count:k(o.waiting)}):D(e,`capture.pipeline.count.none`)})]}):(0,z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:D(e,`capture.pipeline.empty`)})]})]}),(0,z.jsxs)(p,{children:[(0,z.jsxs)(c,{children:[(0,z.jsxs)(a,{className:`flex items-center gap-2`,children:[(0,z.jsx)(S,{className:`h-4 w-4`}),` `,D(e,`capture.pipeline.refresh`)]}),(0,z.jsx)(l,{children:D(e,`capture.pipeline.description`)})]}),(0,z.jsx)(d,{children:(0,z.jsx)(m,{label:D(e,`capture.pipeline.rebuild`),action:()=>j.rebuildIndex(),invalidate:[`index`]})})]}),t===`basic`?null:(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(f,{title:D(e,`capture.pipeline.status`),result:n.data,children:e=>(0,z.jsx)(h,{value:e})}),(0,z.jsx)(f,{title:D(e,`capture.pipeline.growth`),result:r.data,children:e=>(0,z.jsx)(h,{value:e})})]})]})}export{G as CapturePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{c as r,o as i,r as a,y as o}from"./primitives-D01WcJn7.js";import{t as s}from"./link-2-CCModn4z.js";import{A as c,H as l,R as u,S as d,d as f,j as p,o as m,v as h,w as g,z as _}from"./index-DhszK7A3.js";var v=u(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),y=u(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),b=e(t());g({ko:{"chronicle.kicker":`기억의 연대기`,"chronicle.title":`두뇌가 자라온 시간`,"chronicle.copy":`언제 무엇이 들어왔고 무엇이 달라졌는지, 날짜로 되짚어 봅니다.`,"chronicle.loading":`연대기를 불러오는 중입니다.`,"chronicle.empty.title":`오늘부터 기록이 쌓입니다`,"chronicle.empty.detail":`자료를 넣거나 대화를 나누면, 그날부터 이 자리에 하루하루가 남습니다.`,"chronicle.lane.sources":`자료`,"chronicle.lane.entities":`개념`,"chronicle.lane.connections":`연결`,"chronicle.lane.conversations":`대화`,"chronicle.growth.title":`쌓인 기억`,"chronicle.growth.hint":`손잡이를 좌우로 옮기면 그 시점으로 돌아갑니다. 방향키로도 하루씩 움직일 수 있어요.`,"chronicle.growth.aria":`시점 고르기`,"chronicle.growth.valueText":`{date} · 자료 {sources} · 개념 {entities} · 연결 {connections} · 대화 {conversations}`,"chronicle.growth.first":`처음`,"chronicle.growth.latest":`지금`,"chronicle.heatmap.title":`활동 달력`,"chronicle.heatmap.hint":`진한 칸일수록 그날 많이 쌓였다는 뜻이에요. 칸을 누르면 그날 이야기가 아래에 열립니다.`,"chronicle.heatmap.aria":`날짜별 활동`,"chronicle.heatmap.cell":`{date}, {count}가지`,"chronicle.heatmap.cellEmpty":`{date}, 쌓인 것 없음`,"chronicle.heatmap.less":`적음`,"chronicle.heatmap.more":`많음`,"chronicle.weekday.sun":`일`,"chronicle.weekday.mon":`월`,"chronicle.weekday.tue":`화`,"chronicle.weekday.wed":`수`,"chronicle.weekday.thu":`목`,"chronicle.weekday.fri":`금`,"chronicle.weekday.sat":`토`,"chronicle.day.title":`그날의 이야기`,"chronicle.day.loading":`그날 이야기를 불러오는 중입니다.`,"chronicle.day.quiet":`이 날은 조용했습니다. 남은 기록이 없어요.`,"chronicle.group.sources":`자료`,"chronicle.group.entities":`새로 생긴 개념`,"chronicle.group.conversations":`나눈 대화`,"chronicle.group.changes":`달라진 사실`,"chronicle.group.count":`{count}개`,"chronicle.group.empty":`이 날은 없어요.`,"chronicle.group.more":`이 밖에 {count}개가 더 있어요.`,"chronicle.open.source":`기억에서 찾아보기`,"chronicle.open.entity":`지도에서 보기`,"chronicle.open.conversation":`대화로 가기`,"chronicle.open.change":`지도에서 보기`,"chronicle.sourceType.upload":`올린 파일`,"chronicle.sourceType.note":`메모`,"chronicle.sourceType.web_url":`웹 페이지`,"chronicle.sourceType.conversation":`대화`,"chronicle.sourceType.local_file":`내 컴퓨터 파일`,"chronicle.sourceType.image":`그림`,"chronicle.sourceType.other":`자료`,"chronicle.entityType.other":`개념`,"chronicle.conversation.untitled":`제목 없는 대화`,"chronicle.conversation.messages":`{count}번 주고받음`,"chronicle.change.fact_superseded":`새 내용으로 바뀐 사실`,"chronicle.change.fact_retired":`더 이상 사실이 아닌 것`,"chronicle.change.connection_superseded":`다시 이어진 관계`,"chronicle.change.connection_ended":`끊어진 관계`,"chronicle.change.other":`달라진 것`,"chronicle.rewind.title":`그때의 두뇌`,"chronicle.rewind.subtitle":`{date}에 두뇌가 알고 있던 것`,"chronicle.rewind.loading":`그때 모습을 불러오는 중입니다.`,"chronicle.rewind.entities":`기억 조각`,"chronicle.rewind.connections":`이어진 관계`,"chronicle.rewind.note":`여기 두 숫자는 그때 저장돼 있던 모든 것을 셉니다. 위 곡선의 ‘개념’과는 세는 방식이 달라요.`,"chronicle.rewind.top":`그때 중요했던 개념`,"chronicle.rewind.topEmpty":`그때는 아직 눈에 띄는 개념이 없었어요.`,"chronicle.rewind.reset":`지금으로 돌아오기`},en:{"chronicle.kicker":`Brain Chronicle`,"chronicle.title":`How your Brain grew`,"chronicle.copy":`Walk back through what arrived, and what changed, one day at a time.`,"chronicle.loading":`Loading the chronicle.`,"chronicle.empty.title":`The record starts today`,"chronicle.empty.detail":`Add something or have a conversation, and that day will show up right here.`,"chronicle.lane.sources":`Sources`,"chronicle.lane.entities":`Ideas`,"chronicle.lane.connections":`Links`,"chronicle.lane.conversations":`Chats`,"chronicle.growth.title":`What has piled up`,"chronicle.growth.hint":`Drag the handle to travel back to that moment. Arrow keys move a day at a time.`,"chronicle.growth.aria":`Pick a moment`,"chronicle.growth.valueText":`{date} · {sources} sources · {entities} ideas · {connections} links · {conversations} chats`,"chronicle.growth.first":`First`,"chronicle.growth.latest":`Now`,"chronicle.heatmap.title":`Activity calendar`,"chronicle.heatmap.hint":`A darker square means more arrived that day. Pick one and its story opens below.`,"chronicle.heatmap.aria":`Activity by day`,"chronicle.heatmap.cell":`{date}, {count} things`,"chronicle.heatmap.cellEmpty":`{date}, nothing arrived`,"chronicle.heatmap.less":`Less`,"chronicle.heatmap.more":`More`,"chronicle.weekday.sun":`Sun`,"chronicle.weekday.mon":`Mon`,"chronicle.weekday.tue":`Tue`,"chronicle.weekday.wed":`Wed`,"chronicle.weekday.thu":`Thu`,"chronicle.weekday.fri":`Fri`,"chronicle.weekday.sat":`Sat`,"chronicle.day.title":`That day's story`,"chronicle.day.loading":`Loading that day.`,"chronicle.day.quiet":`A quiet day — nothing was recorded.`,"chronicle.group.sources":`Sources`,"chronicle.group.entities":`New ideas`,"chronicle.group.conversations":`Conversations`,"chronicle.group.changes":`What changed`,"chronicle.group.count":`{count}`,"chronicle.group.empty":`Nothing this day.`,"chronicle.group.more":`And {count} more.`,"chronicle.open.source":`Find it in memory`,"chronicle.open.entity":`See it on the map`,"chronicle.open.conversation":`Go to conversations`,"chronicle.open.change":`See it on the map`,"chronicle.sourceType.upload":`Uploaded file`,"chronicle.sourceType.note":`Note`,"chronicle.sourceType.web_url":`Web page`,"chronicle.sourceType.conversation":`Conversation`,"chronicle.sourceType.local_file":`File on this computer`,"chronicle.sourceType.image":`Picture`,"chronicle.sourceType.other":`Source`,"chronicle.entityType.other":`Idea`,"chronicle.conversation.untitled":`Untitled conversation`,"chronicle.conversation.messages":`{count} messages`,"chronicle.change.fact_superseded":`Replaced by newer wording`,"chronicle.change.fact_retired":`No longer true`,"chronicle.change.connection_superseded":`Relinked a different way`,"chronicle.change.connection_ended":`Link ended`,"chronicle.change.other":`Changed`,"chronicle.rewind.title":`Your Brain back then`,"chronicle.rewind.subtitle":`What it knew on {date}`,"chronicle.rewind.loading":`Loading how it looked then.`,"chronicle.rewind.entities":`Pieces of memory`,"chronicle.rewind.connections":`Links between them`,"chronicle.rewind.note":`These two count everything stored at that moment. That is a different measure from the “ideas” line in the curve above.`,"chronicle.rewind.top":`What mattered most then`,"chronicle.rewind.topEmpty":`Nothing stood out yet at that point.`,"chronicle.rewind.reset":`Back to now`}});var x=n(),S=[`chronicle.weekday.sun`,`chronicle.weekday.mon`,`chronicle.weekday.tue`,`chronicle.weekday.wed`,`chronicle.weekday.thu`,`chronicle.weekday.fri`,`chronicle.weekday.sat`];function C({weeks:e,selectedDate:t,onSelect:n,language:r}){return(0,x.jsxs)(`section`,{className:`chronicle-panel chronicle-heatmap`,"data-testid":`chronicle-heatmap`,children:[(0,x.jsxs)(`header`,{className:`chronicle-panel-head`,children:[(0,x.jsx)(`h2`,{className:`chronicle-panel-title`,children:d(r,`chronicle.heatmap.title`)}),(0,x.jsx)(`p`,{className:`chronicle-panel-hint`,children:d(r,`chronicle.heatmap.hint`)})]}),(0,x.jsxs)(`div`,{className:`chronicle-heatmap-scroll`,children:[(0,x.jsx)(`div`,{className:`chronicle-heatmap-weekdays`,"aria-hidden":`true`,children:S.map(e=>(0,x.jsx)(`span`,{children:d(r,e)},e))}),(0,x.jsx)(`div`,{className:`chronicle-heatmap-grid`,role:`group`,"aria-label":d(r,`chronicle.heatmap.aria`),children:e.map(e=>(0,x.jsx)(`div`,{className:`chronicle-heatmap-week`,children:e.cells.map((i,a)=>i?(0,x.jsx)(`button`,{type:`button`,className:`chronicle-heatmap-cell`,"data-level":i.level,"data-testid":`chronicle-heatmap-cell`,"aria-pressed":i.date===t,"aria-label":d(r,i.daily>0?`chronicle.heatmap.cell`:`chronicle.heatmap.cellEmpty`,{date:i.date,count:f(i.daily)}),onClick:()=>n(i.date)},i.date):(0,x.jsx)(`span`,{className:`chronicle-heatmap-cell is-blank`,"aria-hidden":`true`},`${e.key}-${a}`))},e.key))})]}),(0,x.jsxs)(`p`,{className:`chronicle-heatmap-legend`,children:[(0,x.jsx)(`span`,{children:d(r,`chronicle.heatmap.less`)}),(0,x.jsx)(`span`,{className:`chronicle-heatmap-swatches`,"aria-hidden":`true`,children:[0,1,2,3,4].map(e=>(0,x.jsx)(`span`,{className:`chronicle-heatmap-cell`,"data-level":e},e))}),(0,x.jsx)(`span`,{children:d(r,`chronicle.heatmap.more`)})]})]})}var w=864e5,T=/^(\d{4})-(\d{2})-(\d{2})$/;function E(e){let t=T.exec(e);if(!t)return null;let n=Date.UTC(Number(t[1]),Number(t[2])-1,Number(t[3]));return D(n)===e?n:null}function D(e){return new Date(e).toISOString().slice(0,10)}function O(e){let t=E(e);return t===null?0:new Date(t).getUTCDay()}function ee(e){let t=new Map;for(let n of e){let e=E(n.date);e!==null&&t.set(D(e),n)}let n=[...t.keys()].sort();if(!n.length)return[];let r=E(n[0]),i=E(n[n.length-1]),a=[],o=0,s=0,c=0,l=0;for(let e=r;e<=i;e+=w){let n=D(e),r=t.get(n),i=r?k(r.sources)+k(r.entities)+k(r.connections)+k(r.conversations):0;r&&(o+=k(r.sources),s+=k(r.entities),c+=k(r.connections),l+=k(r.conversations)),a.push({date:n,sources:o,entities:s,connections:c,conversations:l,total:o+s+c+l,daily:i})}return a}function k(e){return typeof e==`number`&&Number.isFinite(e)?e:0}function A(e,t){if(e<=0)return 0;if(t<=0)return 1;let n=e/t;return n>.66?4:n>.33?3:n>.12?2:1}function j(e){if(!e.length)return[];let t=e.reduce((e,t)=>Math.max(e,t.daily),0),n=E(e[0].date),r=E(e[e.length-1].date),i=n-O(e[0].date)*w,a=r+(6-O(e[e.length-1].date))*w,o=new Map(e.map(e=>[e.date,e.daily])),s=[];for(let e=i;e<=a;e+=7*w){let n=[];for(let r=0;r<7;r+=1){let i=D(e+r*w),a=o.get(i);n.push(a===void 0?null:{date:i,daily:a,level:A(a,t)})}s.push({key:D(e),cells:n})}return s}function M(e,t,n){if(!e.length)return{area:``,line:``};let r=e[e.length-1].total,i=Math.max(e.length-1,1),a=e.map((e,a)=>({x:a/i*t,y:n-(r>0?e.total/r*n:0)})),o=[`M ${N(a[0].x)} ${N(a[0].y)}`];for(let e=1;e<a.length;e+=1)o.push(`L ${N(a[e].x)} ${N(a[e-1].y)}`),o.push(`L ${N(a[e].x)} ${N(a[e].y)}`);let s=o.join(` `);return{area:`${s} ${`L ${N(a[a.length-1].x)} ${n} L ${N(a[0].x)} ${n} Z`}`,line:s}}function N(e){return Math.round(e*100)/100}function P(e){return`${e}T23:59:59`}var F=8,I=`/hybrid-search`,L=`/knowledge-graph`,R=`/brain`;function z({day:e,loading:t,language:n}){let r=(0,x.jsxs)(`header`,{className:`chronicle-panel-head`,children:[(0,x.jsx)(`h2`,{className:`chronicle-panel-title`,children:d(n,`chronicle.day.title`)}),(0,x.jsx)(`p`,{className:`chronicle-panel-hint`,"data-testid":`chronicle-day-date`,children:e?e.date:``})]});return t||!e?(0,x.jsxs)(`section`,{className:`chronicle-panel chronicle-day`,"data-testid":`chronicle-day`,children:[r,(0,x.jsx)(`p`,{className:`chronicle-note`,role:`status`,children:d(n,`chronicle.day.loading`)})]}):(0,x.jsxs)(`section`,{className:`chronicle-panel chronicle-day`,"data-testid":`chronicle-day`,children:[r,e.counts.sources+e.counts.entities+e.counts.conversations+e.counts.changes===0?(0,x.jsx)(`p`,{className:`chronicle-note`,"data-testid":`chronicle-day-quiet`,children:d(n,`chronicle.day.quiet`)}):(0,x.jsxs)(`div`,{className:`chronicle-day-groups`,children:[(0,x.jsx)(B,{titleKey:`chronicle.group.sources`,icon:(0,x.jsx)(v,{"aria-hidden":`true`}),count:e.counts.sources,items:V(e,n),language:n}),(0,x.jsx)(B,{titleKey:`chronicle.group.entities`,icon:(0,x.jsx)(o,{"aria-hidden":`true`}),count:e.counts.entities,items:H(e,n),language:n}),(0,x.jsx)(B,{titleKey:`chronicle.group.conversations`,icon:(0,x.jsx)(y,{"aria-hidden":`true`}),count:e.counts.conversations,items:U(e,n),language:n}),(0,x.jsx)(B,{titleKey:`chronicle.group.changes`,icon:(0,x.jsx)(s,{"aria-hidden":`true`}),count:e.counts.changes,items:W(e,n),language:n})]})]})}function B({titleKey:e,icon:t,count:n,items:r,language:i}){let a=r.slice(0,F),o=Math.max(n-a.length,0);return(0,x.jsxs)(`article`,{className:`chronicle-group`,"data-testid":`chronicle-group`,children:[(0,x.jsxs)(`h3`,{className:`chronicle-group-title`,children:[(0,x.jsx)(`span`,{className:`chronicle-group-icon`,children:t}),d(i,e),(0,x.jsx)(`span`,{className:`chronicle-group-count`,children:d(i,`chronicle.group.count`,{count:f(n)})})]}),a.length===0?(0,x.jsx)(`p`,{className:`chronicle-group-empty`,children:d(i,`chronicle.group.empty`)}):(0,x.jsx)(`ul`,{className:`chronicle-group-list`,children:a.map(e=>(0,x.jsx)(`li`,{children:(0,x.jsxs)(`button`,{type:`button`,className:`chronicle-item`,"aria-label":`${e.title} — ${e.openLabel}`,onClick:()=>m(e.target),children:[(0,x.jsx)(`span`,{className:`chronicle-item-title`,children:e.title}),(0,x.jsx)(`span`,{className:`chronicle-item-meta`,children:e.meta})]})},e.key))}),o>0?(0,x.jsx)(`p`,{className:`chronicle-group-more`,children:d(i,`chronicle.group.more`,{count:f(o)})}):null]})}function V(e,t){let n=d(t,`chronicle.open.source`);return e.groups.sources.map(e=>({key:e.id,title:e.title,meta:K(e.source_type,t),target:I,openLabel:n}))}function H(e,t){let n=d(t,`chronicle.open.entity`);return e.groups.entities.map(e=>({key:e.id,title:e.label,meta:q(e.type,t),target:L,openLabel:n}))}function U(e,t){let n=d(t,`chronicle.open.conversation`);return e.groups.conversations.map((e,r)=>({key:e.conversation_id||`loose-${r}`,title:e.preview||d(t,`chronicle.conversation.untitled`),meta:d(t,`chronicle.conversation.messages`,{count:f(e.messages)}),target:R,openLabel:n}))}function W(e,t){let n=d(t,`chronicle.open.change`);return e.groups.changes.map((e,r)=>({key:`${e.node_id}-${r}`,title:e.label,meta:Y(e.kind,t),target:L,openLabel:n}))}var G={upload:`chronicle.sourceType.upload`,note:`chronicle.sourceType.note`,web_url:`chronicle.sourceType.web_url`,conversation:`chronicle.sourceType.conversation`,local_file:`chronicle.sourceType.local_file`,image:`chronicle.sourceType.image`};function K(e,t){return d(t,G[e]||`chronicle.sourceType.other`)}function q(e,t){let n=`ui.entity.${e}`,r=d(t,n);return r===n?d(t,`chronicle.entityType.other`):r}var J={fact_superseded:`chronicle.change.fact_superseded`,fact_retired:`chronicle.change.fact_retired`,connection_superseded:`chronicle.change.connection_superseded`,connection_ended:`chronicle.change.connection_ended`};function Y(e,t){return d(t,J[e]||`chronicle.change.other`)}var X=1e3,Z=220,Q=7;function te({timeline:e,index:t,onIndexChange:n,language:r}){let[i,a]=b.useState(null),o=Math.max(e.length-1,0),s=e[t],c=b.useMemo(()=>M(e,X,Z),[e]),l=o>0?t/o*100:100,u=b.useCallback((e,t)=>{let r=t.getBoundingClientRect();if(r.width<=0)return;let i=(e-r.left)/r.width;n(Math.round(Math.min(Math.max(i,0),1)*o))},[o,n]);b.useEffect(()=>{if(!i)return;let e=e=>u(e.clientX,i),t=()=>a(null);return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[i,u]);let p=e=>{let r=ne(e.key,t,o);r!==null&&(e.preventDefault(),n(r))},m=s?d(r,`chronicle.growth.valueText`,{date:s.date,sources:f(s.sources),entities:f(s.entities),connections:f(s.connections),conversations:f(s.conversations)}):d(r,`chronicle.growth.aria`);return(0,x.jsxs)(`section`,{className:`chronicle-panel chronicle-growth`,"data-testid":`chronicle-growth`,children:[(0,x.jsxs)(`header`,{className:`chronicle-panel-head`,children:[(0,x.jsx)(`h2`,{className:`chronicle-panel-title`,children:d(r,`chronicle.growth.title`)}),(0,x.jsx)(`p`,{className:`chronicle-panel-hint`,children:d(r,`chronicle.growth.hint`)})]}),(0,x.jsxs)(`div`,{className:`chronicle-growth-plot`,children:[(0,x.jsxs)(`svg`,{className:`chronicle-growth-chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,x.jsx)(`path`,{className:`chronicle-growth-area`,d:c.area}),(0,x.jsx)(`path`,{className:`chronicle-growth-line`,d:c.line,vectorEffect:`non-scaling-stroke`})]}),(0,x.jsxs)(`div`,{className:`chronicle-growth-track${i?` is-dragging`:``}`,"data-testid":`chronicle-scrubber`,role:`slider`,tabIndex:0,"aria-label":d(r,`chronicle.growth.aria`),"aria-valuemin":0,"aria-valuemax":o,"aria-valuenow":t,"aria-valuetext":m,onKeyDown:p,onPointerDown:e=>{a(e.currentTarget),u(e.clientX,e.currentTarget)},children:[(0,x.jsx)(`span`,{className:`chronicle-growth-marker`,style:{left:`${l}%`},"aria-hidden":`true`}),(0,x.jsx)(`span`,{className:`chronicle-growth-handle`,style:{left:`${l}%`},"aria-hidden":`true`})]})]}),(0,x.jsxs)(`div`,{className:`chronicle-growth-axis`,children:[(0,x.jsx)(`span`,{children:d(r,`chronicle.growth.first`)}),(0,x.jsx)(`strong`,{"data-testid":`chronicle-scrubber-date`,children:s?s.date:d(r,`chronicle.growth.latest`)}),(0,x.jsx)(`span`,{children:d(r,`chronicle.growth.latest`)})]}),(0,x.jsxs)(`dl`,{className:`chronicle-lane-row`,children:[(0,x.jsx)($,{labelKey:`chronicle.lane.sources`,value:s?.sources,language:r}),(0,x.jsx)($,{labelKey:`chronicle.lane.entities`,value:s?.entities,language:r}),(0,x.jsx)($,{labelKey:`chronicle.lane.connections`,value:s?.connections,language:r}),(0,x.jsx)($,{labelKey:`chronicle.lane.conversations`,value:s?.conversations,language:r})]})]})}function $({labelKey:e,value:t,language:n}){return(0,x.jsxs)(`div`,{className:`chronicle-lane`,children:[(0,x.jsx)(`dt`,{children:d(n,e)}),(0,x.jsx)(`dd`,{children:f(t)})]})}function ne(e,t,n){let r={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-7,PageUp:Q};if(e===`Home`)return 0;if(e===`End`)return n;let i=r[e];return i===void 0?null:Math.min(Math.max(t+i,0),n)}function re({asOf:e,date:t,loading:n,onReset:r,language:i}){return(0,x.jsxs)(`section`,{className:`chronicle-panel chronicle-rewind`,"data-testid":`chronicle-rewind`,children:[(0,x.jsxs)(`header`,{className:`chronicle-panel-head`,children:[(0,x.jsx)(`h2`,{className:`chronicle-panel-title`,children:d(i,`chronicle.rewind.title`)}),(0,x.jsx)(`p`,{className:`chronicle-panel-hint`,children:d(i,`chronicle.rewind.subtitle`,{date:t})}),(0,x.jsxs)(`button`,{type:`button`,className:`chronicle-reset`,onClick:r,children:[(0,x.jsx)(c,{"aria-hidden":`true`}),d(i,`chronicle.rewind.reset`)]})]}),n||!e?(0,x.jsx)(`p`,{className:`chronicle-note`,role:`status`,children:d(i,`chronicle.rewind.loading`)}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`dl`,{className:`chronicle-lane-row chronicle-rewind-stats`,children:[(0,x.jsxs)(`div`,{className:`chronicle-lane`,children:[(0,x.jsx)(`dt`,{children:d(i,`chronicle.rewind.entities`)}),(0,x.jsx)(`dd`,{"data-testid":`chronicle-rewind-entities`,children:f(e.stats.entities)})]}),(0,x.jsxs)(`div`,{className:`chronicle-lane`,children:[(0,x.jsx)(`dt`,{children:d(i,`chronicle.rewind.connections`)}),(0,x.jsx)(`dd`,{children:f(e.stats.connections)})]})]}),(0,x.jsx)(`p`,{className:`chronicle-note chronicle-rewind-note`,children:d(i,`chronicle.rewind.note`)}),(0,x.jsx)(`h3`,{className:`chronicle-group-title`,children:d(i,`chronicle.rewind.top`)}),e.top_entities.length===0?(0,x.jsx)(`p`,{className:`chronicle-group-empty`,children:d(i,`chronicle.rewind.topEmpty`)}):(0,x.jsx)(`ul`,{className:`chronicle-group-list chronicle-rewind-list`,children:e.top_entities.map(e=>(0,x.jsx)(`li`,{children:(0,x.jsxs)(`button`,{type:`button`,className:`chronicle-item`,"aria-label":`${e.label} — ${d(i,`chronicle.open.entity`)}`,onClick:()=>m(`/knowledge-graph`),children:[(0,x.jsx)(`span`,{className:`chronicle-item-title`,children:e.label}),(0,x.jsx)(`span`,{className:`chronicle-item-meta`,children:q(e.type,i)})]})},e.id))})]})]})}function ie(){let e=_(e=>e.language),t=l({queryKey:[`chronicleOverview`],queryFn:h.chronicleOverview}),n=t.data,o=n?.data,s=b.useMemo(()=>ee(o?.series??[]),[o]),c=b.useMemo(()=>j(s),[s]),[u,f]=b.useState(null),m=Math.max(s.length-1,0),g=u===null?-1:s.findIndex(e=>e.date===u),v=g>=0?g:m,y=s[v],S=y?y.date:``,w=!!y&&v<m,T=l({queryKey:[`chronicleDay`,S],queryFn:()=>h.chronicleDay(S),enabled:S!==``}),E=l({queryKey:[`chronicleAsOf`,S],queryFn:()=>h.chronicleAsOf(P(S)),enabled:w});return(0,x.jsxs)(`div`,{className:`product-page chronicle-page`,"data-testid":`page-chronicle`,children:[(0,x.jsxs)(`header`,{className:`page-hero`,children:[(0,x.jsxs)(`div`,{className:`page-kicker`,children:[(0,x.jsx)(p,{className:`h-4 w-4`}),` `,d(e,`chronicle.kicker`)]}),(0,x.jsx)(`h1`,{className:`page-title`,children:d(e,`chronicle.title`)}),(0,x.jsx)(`p`,{className:`page-copy`,children:d(e,`chronicle.copy`)})]}),t.isLoading?(0,x.jsx)(i,{title:d(e,`chronicle.loading`)}):n&&!n.ok?(0,x.jsx)(r,{result:n}):s.length===0?(0,x.jsx)(a,{title:d(e,`chronicle.empty.title`),detail:d(e,`chronicle.empty.detail`)}):(0,x.jsxs)(`div`,{className:`chronicle-stack`,children:[(0,x.jsx)(te,{timeline:s,index:v,onIndexChange:e=>f(s[e].date),language:e}),(0,x.jsx)(C,{weeks:c,selectedDate:S,onSelect:f,language:e}),w?(0,x.jsx)(re,{asOf:E.data?.data??null,date:S,loading:E.isPending,onReset:()=>f(null),language:e}):null,(0,x.jsx)(z,{day:T.data?.data??null,loading:T.isPending,language:e})]})]})}export{ie as ChroniclePage};
|
|
1
|
+
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{c as r,o as i,r as a,y as o}from"./primitives-BDryQl6H.js";import{t as s}from"./link-2-CcYzeM7M.js";import{A as c,H as l,R as u,S as d,d as f,j as p,o as m,v as h,w as g,z as _}from"./index-CfeqZ9Ri.js";var v=u(`book-open`,[[`path`,{d:`M12 7v14`,key:`1akyts`}],[`path`,{d:`M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z`,key:`ruj8y`}]]),y=u(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),b=e(t());g({ko:{"chronicle.kicker":`기억의 연대기`,"chronicle.title":`두뇌가 자라온 시간`,"chronicle.copy":`언제 무엇이 들어왔고 무엇이 달라졌는지, 날짜로 되짚어 봅니다.`,"chronicle.loading":`연대기를 불러오는 중입니다.`,"chronicle.empty.title":`오늘부터 기록이 쌓입니다`,"chronicle.empty.detail":`자료를 넣거나 대화를 나누면, 그날부터 이 자리에 하루하루가 남습니다.`,"chronicle.lane.sources":`자료`,"chronicle.lane.entities":`개념`,"chronicle.lane.connections":`연결`,"chronicle.lane.conversations":`대화`,"chronicle.growth.title":`쌓인 기억`,"chronicle.growth.hint":`손잡이를 좌우로 옮기면 그 시점으로 돌아갑니다. 방향키로도 하루씩 움직일 수 있어요.`,"chronicle.growth.aria":`시점 고르기`,"chronicle.growth.valueText":`{date} · 자료 {sources} · 개념 {entities} · 연결 {connections} · 대화 {conversations}`,"chronicle.growth.first":`처음`,"chronicle.growth.latest":`지금`,"chronicle.heatmap.title":`활동 달력`,"chronicle.heatmap.hint":`진한 칸일수록 그날 많이 쌓였다는 뜻이에요. 칸을 누르면 그날 이야기가 아래에 열립니다.`,"chronicle.heatmap.aria":`날짜별 활동`,"chronicle.heatmap.cell":`{date}, {count}가지`,"chronicle.heatmap.cellEmpty":`{date}, 쌓인 것 없음`,"chronicle.heatmap.less":`적음`,"chronicle.heatmap.more":`많음`,"chronicle.weekday.sun":`일`,"chronicle.weekday.mon":`월`,"chronicle.weekday.tue":`화`,"chronicle.weekday.wed":`수`,"chronicle.weekday.thu":`목`,"chronicle.weekday.fri":`금`,"chronicle.weekday.sat":`토`,"chronicle.day.title":`그날의 이야기`,"chronicle.day.loading":`그날 이야기를 불러오는 중입니다.`,"chronicle.day.quiet":`이 날은 조용했습니다. 남은 기록이 없어요.`,"chronicle.group.sources":`자료`,"chronicle.group.entities":`새로 생긴 개념`,"chronicle.group.conversations":`나눈 대화`,"chronicle.group.changes":`달라진 사실`,"chronicle.group.count":`{count}개`,"chronicle.group.empty":`이 날은 없어요.`,"chronicle.group.more":`이 밖에 {count}개가 더 있어요.`,"chronicle.open.source":`기억에서 찾아보기`,"chronicle.open.entity":`지도에서 보기`,"chronicle.open.conversation":`대화로 가기`,"chronicle.open.change":`지도에서 보기`,"chronicle.sourceType.upload":`올린 파일`,"chronicle.sourceType.note":`메모`,"chronicle.sourceType.web_url":`웹 페이지`,"chronicle.sourceType.conversation":`대화`,"chronicle.sourceType.local_file":`내 컴퓨터 파일`,"chronicle.sourceType.image":`그림`,"chronicle.sourceType.other":`자료`,"chronicle.entityType.other":`개념`,"chronicle.conversation.untitled":`제목 없는 대화`,"chronicle.conversation.messages":`{count}번 주고받음`,"chronicle.change.fact_superseded":`새 내용으로 바뀐 사실`,"chronicle.change.fact_retired":`더 이상 사실이 아닌 것`,"chronicle.change.connection_superseded":`다시 이어진 관계`,"chronicle.change.connection_ended":`끊어진 관계`,"chronicle.change.other":`달라진 것`,"chronicle.rewind.title":`그때의 두뇌`,"chronicle.rewind.subtitle":`{date}에 두뇌가 알고 있던 것`,"chronicle.rewind.loading":`그때 모습을 불러오는 중입니다.`,"chronicle.rewind.entities":`기억 조각`,"chronicle.rewind.connections":`이어진 관계`,"chronicle.rewind.note":`여기 두 숫자는 그때 저장돼 있던 모든 것을 셉니다. 위 곡선의 ‘개념’과는 세는 방식이 달라요.`,"chronicle.rewind.top":`그때 중요했던 개념`,"chronicle.rewind.topEmpty":`그때는 아직 눈에 띄는 개념이 없었어요.`,"chronicle.rewind.reset":`지금으로 돌아오기`},en:{"chronicle.kicker":`Brain Chronicle`,"chronicle.title":`How your Brain grew`,"chronicle.copy":`Walk back through what arrived, and what changed, one day at a time.`,"chronicle.loading":`Loading the chronicle.`,"chronicle.empty.title":`The record starts today`,"chronicle.empty.detail":`Add something or have a conversation, and that day will show up right here.`,"chronicle.lane.sources":`Sources`,"chronicle.lane.entities":`Ideas`,"chronicle.lane.connections":`Links`,"chronicle.lane.conversations":`Chats`,"chronicle.growth.title":`What has piled up`,"chronicle.growth.hint":`Drag the handle to travel back to that moment. Arrow keys move a day at a time.`,"chronicle.growth.aria":`Pick a moment`,"chronicle.growth.valueText":`{date} · {sources} sources · {entities} ideas · {connections} links · {conversations} chats`,"chronicle.growth.first":`First`,"chronicle.growth.latest":`Now`,"chronicle.heatmap.title":`Activity calendar`,"chronicle.heatmap.hint":`A darker square means more arrived that day. Pick one and its story opens below.`,"chronicle.heatmap.aria":`Activity by day`,"chronicle.heatmap.cell":`{date}, {count} things`,"chronicle.heatmap.cellEmpty":`{date}, nothing arrived`,"chronicle.heatmap.less":`Less`,"chronicle.heatmap.more":`More`,"chronicle.weekday.sun":`Sun`,"chronicle.weekday.mon":`Mon`,"chronicle.weekday.tue":`Tue`,"chronicle.weekday.wed":`Wed`,"chronicle.weekday.thu":`Thu`,"chronicle.weekday.fri":`Fri`,"chronicle.weekday.sat":`Sat`,"chronicle.day.title":`That day's story`,"chronicle.day.loading":`Loading that day.`,"chronicle.day.quiet":`A quiet day — nothing was recorded.`,"chronicle.group.sources":`Sources`,"chronicle.group.entities":`New ideas`,"chronicle.group.conversations":`Conversations`,"chronicle.group.changes":`What changed`,"chronicle.group.count":`{count}`,"chronicle.group.empty":`Nothing this day.`,"chronicle.group.more":`And {count} more.`,"chronicle.open.source":`Find it in memory`,"chronicle.open.entity":`See it on the map`,"chronicle.open.conversation":`Go to conversations`,"chronicle.open.change":`See it on the map`,"chronicle.sourceType.upload":`Uploaded file`,"chronicle.sourceType.note":`Note`,"chronicle.sourceType.web_url":`Web page`,"chronicle.sourceType.conversation":`Conversation`,"chronicle.sourceType.local_file":`File on this computer`,"chronicle.sourceType.image":`Picture`,"chronicle.sourceType.other":`Source`,"chronicle.entityType.other":`Idea`,"chronicle.conversation.untitled":`Untitled conversation`,"chronicle.conversation.messages":`{count} messages`,"chronicle.change.fact_superseded":`Replaced by newer wording`,"chronicle.change.fact_retired":`No longer true`,"chronicle.change.connection_superseded":`Relinked a different way`,"chronicle.change.connection_ended":`Link ended`,"chronicle.change.other":`Changed`,"chronicle.rewind.title":`Your Brain back then`,"chronicle.rewind.subtitle":`What it knew on {date}`,"chronicle.rewind.loading":`Loading how it looked then.`,"chronicle.rewind.entities":`Pieces of memory`,"chronicle.rewind.connections":`Links between them`,"chronicle.rewind.note":`These two count everything stored at that moment. That is a different measure from the “ideas” line in the curve above.`,"chronicle.rewind.top":`What mattered most then`,"chronicle.rewind.topEmpty":`Nothing stood out yet at that point.`,"chronicle.rewind.reset":`Back to now`}});var x=n(),S=[`chronicle.weekday.sun`,`chronicle.weekday.mon`,`chronicle.weekday.tue`,`chronicle.weekday.wed`,`chronicle.weekday.thu`,`chronicle.weekday.fri`,`chronicle.weekday.sat`];function C({weeks:e,selectedDate:t,onSelect:n,language:r}){return(0,x.jsxs)(`section`,{className:`chronicle-panel chronicle-heatmap`,"data-testid":`chronicle-heatmap`,children:[(0,x.jsxs)(`header`,{className:`chronicle-panel-head`,children:[(0,x.jsx)(`h2`,{className:`chronicle-panel-title`,children:d(r,`chronicle.heatmap.title`)}),(0,x.jsx)(`p`,{className:`chronicle-panel-hint`,children:d(r,`chronicle.heatmap.hint`)})]}),(0,x.jsxs)(`div`,{className:`chronicle-heatmap-scroll`,children:[(0,x.jsx)(`div`,{className:`chronicle-heatmap-weekdays`,"aria-hidden":`true`,children:S.map(e=>(0,x.jsx)(`span`,{children:d(r,e)},e))}),(0,x.jsx)(`div`,{className:`chronicle-heatmap-grid`,role:`group`,"aria-label":d(r,`chronicle.heatmap.aria`),children:e.map(e=>(0,x.jsx)(`div`,{className:`chronicle-heatmap-week`,children:e.cells.map((i,a)=>i?(0,x.jsx)(`button`,{type:`button`,className:`chronicle-heatmap-cell`,"data-level":i.level,"data-testid":`chronicle-heatmap-cell`,"aria-pressed":i.date===t,"aria-label":d(r,i.daily>0?`chronicle.heatmap.cell`:`chronicle.heatmap.cellEmpty`,{date:i.date,count:f(i.daily)}),onClick:()=>n(i.date)},i.date):(0,x.jsx)(`span`,{className:`chronicle-heatmap-cell is-blank`,"aria-hidden":`true`},`${e.key}-${a}`))},e.key))})]}),(0,x.jsxs)(`p`,{className:`chronicle-heatmap-legend`,children:[(0,x.jsx)(`span`,{children:d(r,`chronicle.heatmap.less`)}),(0,x.jsx)(`span`,{className:`chronicle-heatmap-swatches`,"aria-hidden":`true`,children:[0,1,2,3,4].map(e=>(0,x.jsx)(`span`,{className:`chronicle-heatmap-cell`,"data-level":e},e))}),(0,x.jsx)(`span`,{children:d(r,`chronicle.heatmap.more`)})]})]})}var w=864e5,T=/^(\d{4})-(\d{2})-(\d{2})$/;function E(e){let t=T.exec(e);if(!t)return null;let n=Date.UTC(Number(t[1]),Number(t[2])-1,Number(t[3]));return D(n)===e?n:null}function D(e){return new Date(e).toISOString().slice(0,10)}function O(e){let t=E(e);return t===null?0:new Date(t).getUTCDay()}function ee(e){let t=new Map;for(let n of e){let e=E(n.date);e!==null&&t.set(D(e),n)}let n=[...t.keys()].sort();if(!n.length)return[];let r=E(n[0]),i=E(n[n.length-1]),a=[],o=0,s=0,c=0,l=0;for(let e=r;e<=i;e+=w){let n=D(e),r=t.get(n),i=r?k(r.sources)+k(r.entities)+k(r.connections)+k(r.conversations):0;r&&(o+=k(r.sources),s+=k(r.entities),c+=k(r.connections),l+=k(r.conversations)),a.push({date:n,sources:o,entities:s,connections:c,conversations:l,total:o+s+c+l,daily:i})}return a}function k(e){return typeof e==`number`&&Number.isFinite(e)?e:0}function A(e,t){if(e<=0)return 0;if(t<=0)return 1;let n=e/t;return n>.66?4:n>.33?3:n>.12?2:1}function j(e){if(!e.length)return[];let t=e.reduce((e,t)=>Math.max(e,t.daily),0),n=E(e[0].date),r=E(e[e.length-1].date),i=n-O(e[0].date)*w,a=r+(6-O(e[e.length-1].date))*w,o=new Map(e.map(e=>[e.date,e.daily])),s=[];for(let e=i;e<=a;e+=7*w){let n=[];for(let r=0;r<7;r+=1){let i=D(e+r*w),a=o.get(i);n.push(a===void 0?null:{date:i,daily:a,level:A(a,t)})}s.push({key:D(e),cells:n})}return s}function M(e,t,n){if(!e.length)return{area:``,line:``};let r=e[e.length-1].total,i=Math.max(e.length-1,1),a=e.map((e,a)=>({x:a/i*t,y:n-(r>0?e.total/r*n:0)})),o=[`M ${N(a[0].x)} ${N(a[0].y)}`];for(let e=1;e<a.length;e+=1)o.push(`L ${N(a[e].x)} ${N(a[e-1].y)}`),o.push(`L ${N(a[e].x)} ${N(a[e].y)}`);let s=o.join(` `);return{area:`${s} ${`L ${N(a[a.length-1].x)} ${n} L ${N(a[0].x)} ${n} Z`}`,line:s}}function N(e){return Math.round(e*100)/100}function P(e){return`${e}T23:59:59`}var F=8,I=`/hybrid-search`,L=`/knowledge-graph`,R=`/brain`;function z({day:e,loading:t,language:n}){let r=(0,x.jsxs)(`header`,{className:`chronicle-panel-head`,children:[(0,x.jsx)(`h2`,{className:`chronicle-panel-title`,children:d(n,`chronicle.day.title`)}),(0,x.jsx)(`p`,{className:`chronicle-panel-hint`,"data-testid":`chronicle-day-date`,children:e?e.date:``})]});return t||!e?(0,x.jsxs)(`section`,{className:`chronicle-panel chronicle-day`,"data-testid":`chronicle-day`,children:[r,(0,x.jsx)(`p`,{className:`chronicle-note`,role:`status`,children:d(n,`chronicle.day.loading`)})]}):(0,x.jsxs)(`section`,{className:`chronicle-panel chronicle-day`,"data-testid":`chronicle-day`,children:[r,e.counts.sources+e.counts.entities+e.counts.conversations+e.counts.changes===0?(0,x.jsx)(`p`,{className:`chronicle-note`,"data-testid":`chronicle-day-quiet`,children:d(n,`chronicle.day.quiet`)}):(0,x.jsxs)(`div`,{className:`chronicle-day-groups`,children:[(0,x.jsx)(B,{titleKey:`chronicle.group.sources`,icon:(0,x.jsx)(v,{"aria-hidden":`true`}),count:e.counts.sources,items:V(e,n),language:n}),(0,x.jsx)(B,{titleKey:`chronicle.group.entities`,icon:(0,x.jsx)(o,{"aria-hidden":`true`}),count:e.counts.entities,items:H(e,n),language:n}),(0,x.jsx)(B,{titleKey:`chronicle.group.conversations`,icon:(0,x.jsx)(y,{"aria-hidden":`true`}),count:e.counts.conversations,items:U(e,n),language:n}),(0,x.jsx)(B,{titleKey:`chronicle.group.changes`,icon:(0,x.jsx)(s,{"aria-hidden":`true`}),count:e.counts.changes,items:W(e,n),language:n})]})]})}function B({titleKey:e,icon:t,count:n,items:r,language:i}){let a=r.slice(0,F),o=Math.max(n-a.length,0);return(0,x.jsxs)(`article`,{className:`chronicle-group`,"data-testid":`chronicle-group`,children:[(0,x.jsxs)(`h3`,{className:`chronicle-group-title`,children:[(0,x.jsx)(`span`,{className:`chronicle-group-icon`,children:t}),d(i,e),(0,x.jsx)(`span`,{className:`chronicle-group-count`,children:d(i,`chronicle.group.count`,{count:f(n)})})]}),a.length===0?(0,x.jsx)(`p`,{className:`chronicle-group-empty`,children:d(i,`chronicle.group.empty`)}):(0,x.jsx)(`ul`,{className:`chronicle-group-list`,children:a.map(e=>(0,x.jsx)(`li`,{children:(0,x.jsxs)(`button`,{type:`button`,className:`chronicle-item`,"aria-label":`${e.title} — ${e.openLabel}`,onClick:()=>m(e.target),children:[(0,x.jsx)(`span`,{className:`chronicle-item-title`,children:e.title}),(0,x.jsx)(`span`,{className:`chronicle-item-meta`,children:e.meta})]})},e.key))}),o>0?(0,x.jsx)(`p`,{className:`chronicle-group-more`,children:d(i,`chronicle.group.more`,{count:f(o)})}):null]})}function V(e,t){let n=d(t,`chronicle.open.source`);return e.groups.sources.map(e=>({key:e.id,title:e.title,meta:K(e.source_type,t),target:I,openLabel:n}))}function H(e,t){let n=d(t,`chronicle.open.entity`);return e.groups.entities.map(e=>({key:e.id,title:e.label,meta:q(e.type,t),target:L,openLabel:n}))}function U(e,t){let n=d(t,`chronicle.open.conversation`);return e.groups.conversations.map((e,r)=>({key:e.conversation_id||`loose-${r}`,title:e.preview||d(t,`chronicle.conversation.untitled`),meta:d(t,`chronicle.conversation.messages`,{count:f(e.messages)}),target:R,openLabel:n}))}function W(e,t){let n=d(t,`chronicle.open.change`);return e.groups.changes.map((e,r)=>({key:`${e.node_id}-${r}`,title:e.label,meta:Y(e.kind,t),target:L,openLabel:n}))}var G={upload:`chronicle.sourceType.upload`,note:`chronicle.sourceType.note`,web_url:`chronicle.sourceType.web_url`,conversation:`chronicle.sourceType.conversation`,local_file:`chronicle.sourceType.local_file`,image:`chronicle.sourceType.image`};function K(e,t){return d(t,G[e]||`chronicle.sourceType.other`)}function q(e,t){let n=`ui.entity.${e}`,r=d(t,n);return r===n?d(t,`chronicle.entityType.other`):r}var J={fact_superseded:`chronicle.change.fact_superseded`,fact_retired:`chronicle.change.fact_retired`,connection_superseded:`chronicle.change.connection_superseded`,connection_ended:`chronicle.change.connection_ended`};function Y(e,t){return d(t,J[e]||`chronicle.change.other`)}var X=1e3,Z=220,Q=7;function te({timeline:e,index:t,onIndexChange:n,language:r}){let[i,a]=b.useState(null),o=Math.max(e.length-1,0),s=e[t],c=b.useMemo(()=>M(e,X,Z),[e]),l=o>0?t/o*100:100,u=b.useCallback((e,t)=>{let r=t.getBoundingClientRect();if(r.width<=0)return;let i=(e-r.left)/r.width;n(Math.round(Math.min(Math.max(i,0),1)*o))},[o,n]);b.useEffect(()=>{if(!i)return;let e=e=>u(e.clientX,i),t=()=>a(null);return window.addEventListener(`pointermove`,e),window.addEventListener(`pointerup`,t),window.addEventListener(`pointercancel`,t),()=>{window.removeEventListener(`pointermove`,e),window.removeEventListener(`pointerup`,t),window.removeEventListener(`pointercancel`,t)}},[i,u]);let p=e=>{let r=ne(e.key,t,o);r!==null&&(e.preventDefault(),n(r))},m=s?d(r,`chronicle.growth.valueText`,{date:s.date,sources:f(s.sources),entities:f(s.entities),connections:f(s.connections),conversations:f(s.conversations)}):d(r,`chronicle.growth.aria`);return(0,x.jsxs)(`section`,{className:`chronicle-panel chronicle-growth`,"data-testid":`chronicle-growth`,children:[(0,x.jsxs)(`header`,{className:`chronicle-panel-head`,children:[(0,x.jsx)(`h2`,{className:`chronicle-panel-title`,children:d(r,`chronicle.growth.title`)}),(0,x.jsx)(`p`,{className:`chronicle-panel-hint`,children:d(r,`chronicle.growth.hint`)})]}),(0,x.jsxs)(`div`,{className:`chronicle-growth-plot`,children:[(0,x.jsxs)(`svg`,{className:`chronicle-growth-chart`,viewBox:`0 0 ${X} ${Z}`,preserveAspectRatio:`none`,"aria-hidden":`true`,children:[(0,x.jsx)(`path`,{className:`chronicle-growth-area`,d:c.area}),(0,x.jsx)(`path`,{className:`chronicle-growth-line`,d:c.line,vectorEffect:`non-scaling-stroke`})]}),(0,x.jsxs)(`div`,{className:`chronicle-growth-track${i?` is-dragging`:``}`,"data-testid":`chronicle-scrubber`,role:`slider`,tabIndex:0,"aria-label":d(r,`chronicle.growth.aria`),"aria-valuemin":0,"aria-valuemax":o,"aria-valuenow":t,"aria-valuetext":m,onKeyDown:p,onPointerDown:e=>{a(e.currentTarget),u(e.clientX,e.currentTarget)},children:[(0,x.jsx)(`span`,{className:`chronicle-growth-marker`,style:{left:`${l}%`},"aria-hidden":`true`}),(0,x.jsx)(`span`,{className:`chronicle-growth-handle`,style:{left:`${l}%`},"aria-hidden":`true`})]})]}),(0,x.jsxs)(`div`,{className:`chronicle-growth-axis`,children:[(0,x.jsx)(`span`,{children:d(r,`chronicle.growth.first`)}),(0,x.jsx)(`strong`,{"data-testid":`chronicle-scrubber-date`,children:s?s.date:d(r,`chronicle.growth.latest`)}),(0,x.jsx)(`span`,{children:d(r,`chronicle.growth.latest`)})]}),(0,x.jsxs)(`dl`,{className:`chronicle-lane-row`,children:[(0,x.jsx)($,{labelKey:`chronicle.lane.sources`,value:s?.sources,language:r}),(0,x.jsx)($,{labelKey:`chronicle.lane.entities`,value:s?.entities,language:r}),(0,x.jsx)($,{labelKey:`chronicle.lane.connections`,value:s?.connections,language:r}),(0,x.jsx)($,{labelKey:`chronicle.lane.conversations`,value:s?.conversations,language:r})]})]})}function $({labelKey:e,value:t,language:n}){return(0,x.jsxs)(`div`,{className:`chronicle-lane`,children:[(0,x.jsx)(`dt`,{children:d(n,e)}),(0,x.jsx)(`dd`,{children:f(t)})]})}function ne(e,t,n){let r={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-7,PageUp:Q};if(e===`Home`)return 0;if(e===`End`)return n;let i=r[e];return i===void 0?null:Math.min(Math.max(t+i,0),n)}function re({asOf:e,date:t,loading:n,onReset:r,language:i}){return(0,x.jsxs)(`section`,{className:`chronicle-panel chronicle-rewind`,"data-testid":`chronicle-rewind`,children:[(0,x.jsxs)(`header`,{className:`chronicle-panel-head`,children:[(0,x.jsx)(`h2`,{className:`chronicle-panel-title`,children:d(i,`chronicle.rewind.title`)}),(0,x.jsx)(`p`,{className:`chronicle-panel-hint`,children:d(i,`chronicle.rewind.subtitle`,{date:t})}),(0,x.jsxs)(`button`,{type:`button`,className:`chronicle-reset`,onClick:r,children:[(0,x.jsx)(c,{"aria-hidden":`true`}),d(i,`chronicle.rewind.reset`)]})]}),n||!e?(0,x.jsx)(`p`,{className:`chronicle-note`,role:`status`,children:d(i,`chronicle.rewind.loading`)}):(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`dl`,{className:`chronicle-lane-row chronicle-rewind-stats`,children:[(0,x.jsxs)(`div`,{className:`chronicle-lane`,children:[(0,x.jsx)(`dt`,{children:d(i,`chronicle.rewind.entities`)}),(0,x.jsx)(`dd`,{"data-testid":`chronicle-rewind-entities`,children:f(e.stats.entities)})]}),(0,x.jsxs)(`div`,{className:`chronicle-lane`,children:[(0,x.jsx)(`dt`,{children:d(i,`chronicle.rewind.connections`)}),(0,x.jsx)(`dd`,{children:f(e.stats.connections)})]})]}),(0,x.jsx)(`p`,{className:`chronicle-note chronicle-rewind-note`,children:d(i,`chronicle.rewind.note`)}),(0,x.jsx)(`h3`,{className:`chronicle-group-title`,children:d(i,`chronicle.rewind.top`)}),e.top_entities.length===0?(0,x.jsx)(`p`,{className:`chronicle-group-empty`,children:d(i,`chronicle.rewind.topEmpty`)}):(0,x.jsx)(`ul`,{className:`chronicle-group-list chronicle-rewind-list`,children:e.top_entities.map(e=>(0,x.jsx)(`li`,{children:(0,x.jsxs)(`button`,{type:`button`,className:`chronicle-item`,"aria-label":`${e.label} — ${d(i,`chronicle.open.entity`)}`,onClick:()=>m(`/knowledge-graph`),children:[(0,x.jsx)(`span`,{className:`chronicle-item-title`,children:e.label}),(0,x.jsx)(`span`,{className:`chronicle-item-meta`,children:q(e.type,i)})]})},e.id))})]})]})}function ie(){let e=_(e=>e.language),t=l({queryKey:[`chronicleOverview`],queryFn:h.chronicleOverview}),n=t.data,o=n?.data,s=b.useMemo(()=>ee(o?.series??[]),[o]),c=b.useMemo(()=>j(s),[s]),[u,f]=b.useState(null),m=Math.max(s.length-1,0),g=u===null?-1:s.findIndex(e=>e.date===u),v=g>=0?g:m,y=s[v],S=y?y.date:``,w=!!y&&v<m,T=l({queryKey:[`chronicleDay`,S],queryFn:()=>h.chronicleDay(S),enabled:S!==``}),E=l({queryKey:[`chronicleAsOf`,S],queryFn:()=>h.chronicleAsOf(P(S)),enabled:w});return(0,x.jsxs)(`div`,{className:`product-page chronicle-page`,"data-testid":`page-chronicle`,children:[(0,x.jsxs)(`header`,{className:`page-hero`,children:[(0,x.jsxs)(`div`,{className:`page-kicker`,children:[(0,x.jsx)(p,{className:`h-4 w-4`}),` `,d(e,`chronicle.kicker`)]}),(0,x.jsx)(`h1`,{className:`page-title`,children:d(e,`chronicle.title`)}),(0,x.jsx)(`p`,{className:`page-copy`,children:d(e,`chronicle.copy`)})]}),t.isLoading?(0,x.jsx)(i,{title:d(e,`chronicle.loading`)}):n&&!n.ok?(0,x.jsx)(r,{result:n}):s.length===0?(0,x.jsx)(a,{title:d(e,`chronicle.empty.title`),detail:d(e,`chronicle.empty.detail`)}):(0,x.jsxs)(`div`,{className:`chronicle-stack`,children:[(0,x.jsx)(te,{timeline:s,index:v,onIndexChange:e=>f(s[e].date),language:e}),(0,x.jsx)(C,{weeks:c,selectedDate:S,onSelect:f,language:e}),w?(0,x.jsx)(re,{asOf:E.data?.data??null,date:S,loading:E.isPending,onReset:()=>f(null),language:e}):null,(0,x.jsx)(z,{day:T.data?.data??null,loading:T.isPending,language:e})]})]})}export{ie as ChroniclePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{t as r}from"./bot-
|
|
1
|
+
import{i as e,n as t,t as n}from"./jsx-runtime-bzQ4Vb5N.js";import{t as r}from"./bot-Dkd-DbiP.js";import{t as i}from"./search-DHsPwmPw.js";import{n as a,t as o}from"./useFocusTrap-CV73DLHn.js";import{H as s,M as c,P as l,R as u,S as d,T as f,c as p,o as m,v as h}from"./index-CfeqZ9Ri.js";var g=u(`command`,[[`path`,{d:`M15 6v12a3 3 0 1 0 3-3H6a3 3 0 1 0 3 3V6a3 3 0 1 0-3 3h12a3 3 0 1 0-3-3`,key:`11bfej`}]]),_=u(`corner-down-left`,[[`path`,{d:`M20 4v7a4 4 0 0 1-4 4H4`,key:`6o5b7l`}],[`path`,{d:`m9 10-5 5 5 5`,key:`1kshq7`}]]),v=u(`message-circle`,[[`path`,{d:`M2.992 16.342a2 2 0 0 1 .094 1.167l-1.065 3.29a1 1 0 0 0 1.236 1.168l3.413-.998a2 2 0 0 1 1.099.092 10 10 0 1 0-4.777-4.719`,key:`1sd12s`}]]),y=e(t()),b=n(),x=f.map(e=>{let t=e.icon;return{...e,icon:(0,b.jsx)(t,{className:`h-4 w-4`})}});function S(e,t){let[n,r]=y.useState(e);return y.useEffect(()=>{let n=window.setTimeout(()=>r(e),t);return()=>window.clearTimeout(n)},[e,t]),n}function C({language:e,initialOpen:t=!1}){let[n,u]=y.useState(t),[f,C]=y.useState(``),[w,T]=y.useState(0),E=y.useRef(null),D=S(f.trim(),220);y.useEffect(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`k`&&(e.preventDefault(),u(e=>!e))},t=()=>u(!0);return window.addEventListener(`keydown`,e),window.addEventListener(`lattice:open-command`,t),()=>{window.removeEventListener(`keydown`,e),window.removeEventListener(`lattice:open-command`,t)}},[]),y.useEffect(()=>{n&&(C(``),T(0),window.setTimeout(()=>E.current?.focus(),0))},[n]);let O=s({queryKey:[`commandSearch`,D],queryFn:()=>h.commandSearch(D),enabled:n&&D.length>0}),k=s({queryKey:[`commandBriefing`],queryFn:h.commandBriefing,enabled:n,staleTime:6e4}),A=y.useMemo(()=>{let t=f.trim().toLowerCase(),n=[];if(!t&&k.data?.ok){let t=(k.data.data||{}).sections||{},r=t.review||{},i=t.suggestions||{},o=Number(i.count??0)||0,s=Number(r.pending??0)||0;n.push({id:`proactive-briefing`,group:`proactive`,title:d(e,`command.proactive.briefing`),detail:o>0?d(e,`command.proactive.suggestions`,{count:o}):void 0,icon:(0,b.jsx)(a,{className:`h-4 w-4`}),target:`/brain`,action:`open-briefing`}),n.push({id:`proactive-review`,group:`proactive`,title:d(e,`command.proactive.review`),detail:s>0?d(e,`command.proactive.pending`,{count:s}):void 0,icon:(0,b.jsx)(c,{className:`h-4 w-4`}),target:`/act/review`}),n.push({id:`proactive-ask`,group:`proactive`,title:d(e,`briefing.action.askBrain`),icon:(0,b.jsx)(v,{className:`h-4 w-4`}),target:`/brain`})}let i=x.map(t=>({id:t.id,group:`pages`,title:d(e,t.labelKey),icon:t.icon,target:t.target})).filter(e=>!t||e.title.toLowerCase().includes(t)),o=p(O.data?.data?.groups),s=[];for(let t of o)for(let n of p(t.items))t.kind===`knowledge`?s.push({id:`kg-${String(n.id??s.length)}`,group:`knowledge`,title:String(n.title||n.id||``),detail:String(n.summary||n.type||``),icon:(0,b.jsx)(l,{className:`h-4 w-4`}),target:`/brain/graph`}):t.kind===`conversation`?s.push({id:`conv-${String(n.conversation_id??s.length)}`,group:`conversation`,title:String(n.snippet||``),detail:String(n.timestamp||``).slice(0,10),icon:(0,b.jsx)(v,{className:`h-4 w-4`}),target:`/brain`}):t.kind===`automation`&&s.push({id:`wf-${String(n.id??s.length)}`,group:`automation`,title:String(n.name||``),detail:n.enabled?d(e,`command.automation.enabled`):d(e,`command.automation.draft`),icon:(0,b.jsx)(r,{className:`h-4 w-4`}),target:`/act/workflows`});return[...n,...s,...i]},[e,f,O.data,k.data]);y.useEffect(()=>{T(0)},[A.length,D]);let j=y.useCallback(()=>u(!1),[]),M=o(j,n),N=y.useCallback(e=>{e&&(j(),m(e.target),e.action===`open-briefing`&&window.dispatchEvent(new Event(`lattice:open-briefing`)))},[j]),P=e=>{e.key===`Escape`?(e.preventDefault(),j()):e.key===`ArrowDown`?(e.preventDefault(),T(e=>Math.min(e+1,Math.max(A.length-1,0)))):e.key===`ArrowUp`?(e.preventDefault(),T(e=>Math.max(e-1,0))):e.key===`Enter`&&(e.preventDefault(),N(A[w]))};if(!n)return null;let F={proactive:d(e,`command.proactive.title`),pages:d(e,`command.group.pages`),knowledge:d(e,`command.group.knowledge`),conversation:d(e,`command.group.conversation`),automation:d(e,`command.group.automation`)},I=null;return(0,b.jsx)(`div`,{className:`command-palette-backdrop`,role:`presentation`,onMouseDown:e=>{e.target===e.currentTarget&&j()},children:(0,b.jsxs)(`div`,{ref:M,className:`command-palette`,role:`dialog`,"aria-modal":`true`,"aria-label":d(e,`command.title`),"data-testid":`command-palette`,children:[(0,b.jsxs)(`div`,{className:`command-palette-input`,children:[(0,b.jsx)(i,{className:`h-4 w-4`,"aria-hidden":`true`}),(0,b.jsx)(`input`,{ref:E,value:f,onChange:e=>C(e.target.value),onKeyDown:P,placeholder:d(e,`command.placeholder`),"aria-label":d(e,`command.title`),autoComplete:`off`,spellCheck:!1}),(0,b.jsxs)(`span`,{className:`command-palette-hint`,"aria-hidden":`true`,children:[(0,b.jsx)(g,{className:`h-3 w-3`}),d(e,`command.shortcutKey`)]})]}),(0,b.jsxs)(`div`,{className:`command-palette-results`,role:`listbox`,"aria-label":d(e,`command.results`),children:[O.isFetching?(0,b.jsx)(`p`,{className:`command-palette-note`,children:d(e,`command.searching`)}):null,A.length===0&&!O.isFetching?(0,b.jsx)(`p`,{className:`command-palette-note`,children:d(e,`command.empty`)}):null,A.map((e,t)=>{let n=e.group===I?null:(0,b.jsx)(`p`,{className:`command-palette-group`,children:F[e.group]},`h-${e.group}`);return I=e.group,(0,b.jsxs)(y.Fragment,{children:[n,(0,b.jsxs)(`button`,{type:`button`,role:`option`,"aria-selected":t===w,className:`command-palette-item ${t===w?`is-active`:``}`,onMouseEnter:()=>T(t),onClick:()=>N(e),children:[e.icon,(0,b.jsx)(`span`,{className:`command-palette-item-title`,children:e.title}),e.detail?(0,b.jsx)(`span`,{className:`command-palette-item-detail`,children:e.detail}):null,t===w?(0,b.jsx)(_,{className:`h-3.5 w-3.5`,"aria-hidden":`true`}):null]})]},e.id)})]}),(0,b.jsx)(`p`,{className:`command-palette-footer`,children:d(e,`command.footer`)})]})})}export{C as CommandPalette};
|