1import{r as v,j as e}from"./react-vendor-DbzdS4FP.js";import{u as K,f as Y,l as Z}from"./index-kSfDswZP.js";import{s as n}from"./index.module-CzrQATot.js";import{useMemoryMaintenance as ee}from"./memoryMaintenanceContext-DxqV1BjJ.js";import{ReMeStatusModal as re}from"./ReMeStatusModal-tYHKCjZ5.js";import{u as ne}from"./i18n-vendor-BrUIoOSg.js";import{cE as o,cb as ie,cQ as oe,cR as ae,cL as x,cS as se,cT as te,cG as m,cA as R,cU as z,cF as p}from"./ui-vendor-DCtmHMLE.js";import"./dnd-vendor-DdAwup11.js";import"./markdown-vendor-DonjKQI4.js";const M=168;function D(r){if(!(r!=null&&r.trim()))return!1;const y=r.trim().split(/\s+/);if(y.length!==5||!y.every(g=>/^[a-z0-9*/,-]+$/i.test(g)))return!1;const b=[[0,59],[0,23],[1,31],[1,12],[0,6]];return y.every((g,S)=>{const[j,f]=b[S];return[...g.matchAll(/\d+/g)].every(({0:l})=>{const c=Number(l);return c>=j&&c<=f})})}function pe(){var q;const{t:r}=ne(),{message:y,modal:b}=K(),g=o.useFormInstance(),{selectedAgent:S}=Y(),{reindexing:j,setReindexing:f,runtimeStatus:l,diagnosticsStatus:c,checkMemoryStatus:N}=ee(),[C,F]=v.useState(null),[w,E]=v.useState(!1),[T,I]=v.useState(()=>!!g.getFieldValue(["reme_light_memory_config","auto_fin_cron_enabled"])),B=()=>{b.confirm({title:r("agentConfig.rebuildBm25IndexConfirmTitle"),content:r("agentConfig.rebuildBm25IndexConfirm"),okText:r("agentConfig.rebuildBm25Index"),cancelText:r("common.cancel"),onOk:async()=>{f(!0);try{await Z.rebuildMemoryIndex(S||"default","bm25"),y.success(r("agentConfig.rebuildBm25IndexSuccess"))}catch(i){const a=i instanceof Error?i.message:String(i);throw y.error(r("agentConfig.rebuildMemoryIndexFailed",{error:a})),i}finally{f(!1),N()}}})},O=i=>{F(i),N(i==="diagnostics")},L=l.type==="checking",t=l.type==="healthy"?l.data:null,h=c.type==="healthy"?c.data:null,V=l.type==="error"?l.message:"",W=c.type==="error"?c.message:"",d=t==null?void 0:t.worker.status,U=d==="error"?"error":d==="busy"||d==="stopping"||t!=null&&t.reindexing?"checking":l.type,k={unknown:{className:n.memoryStatusUnknown,label:r("agentConfig.memoryStatusUnknown")},checking:{className:n.memoryStatusChecking,label:r("agentConfig.memoryStatusChecking")},healthy:{className:n.memoryStatusHealthy,label:r("agentConfig.memoryStatusRunning")},error:{className:n.memoryStatusError,label:r("agentConfig.memoryStatusCheckFailed")}}[U],H=d==="error"?r("agentConfig.memoryStatusNeedsAttention"):d==="busy"||t!=null&&t.reindexing?r("agentConfig.memoryStatusBusy"):d==="stopping"?r("agentConfig.memoryStatusStopping"):k.label,G=d?r(`agentConfig.memoryWorkerStatus.${d}`):"â",J=t?r("agentConfig.memoryQueueSummary",{running:t.worker.tasks_running,pending:t.worker.queue_pending}):"â",s=o.useWatch(["reme_light_memory_config"],g),$=Number((s==null?void 0:s.auto_memory_interval)??0),P=$>0,A=(s==null?void 0:s.dream_cron_enabled)??!0,_=(s==null?void 0:s.daily_paper_cron_enabled)??!1,u=(s==null?void 0:s.auto_fin_cron_enabled)??!1,Q=((q=s==null?void 0:s.auto_memory_search_config)==null?void 0:q.enabled)??!1;v.useEffect(()=>{u&&I(!0)},[u]);const X=i=>{g.setFieldValue(["reme_light_memory_config","auto_memory_interval"],i?Math.max($,1):0)};return e.jsxs(ie,{className:n.formCard,children:[e.jsxs("section",{className:n.memoryOverview,children:[e.jsx("div",{className:n.memoryOverviewHeader,children:e.jsxs("div",{children:[e.jsx("h3",{children:r("agentConfig.memoryOverviewTitle")}),e.jsx("p",{children:r("agentConfig.memoryPageDescription")})]})}),e.jsxs("div",{className:n.memoryOverviewGrid,children:[e.jsxs("div",{className:`${n.memoryOverviewItem} ${n.memoryServiceStatusItem}`,children:[e.jsxs("span",{className:n.memoryOverviewLabel,children:[e.jsx(oe,{size:14,"aria-hidden":"true"}),r("agentConfig.memoryRuntimeStatus")]}),e.jsxs("div",{className:n.memoryServiceStatusLine,children:[e.jsxs("strong",{className:`${n.memoryStatusBadge} ${k.className}`,children:[e.jsx("i",{}),H]}),e.jsxs("div",{className:n.memoryReferences,children:[e.jsx("span",{children:r("agentConfig.memoryPoweredBy")}),e.jsx("a",{href:"https://github.com/agentscope-ai/ReMe",target:"_blank",rel:"noreferrer",children:"ReMe"}),e.jsx("i",{}),e.jsx("a",{href:"https://qwenpaw.agentscope.io/docs/memory",target:"_blank",rel:"noreferrer",children:r("agentConfig.memoryDocumentation")})]})]})]}),e.jsxs("button",{type:"button",className:`${n.memoryOverviewItem} ${n.memoryOverviewClickableItem}`,onClick:()=>O("tasks"),children:[e.jsxs("span",{className:n.memoryOverviewLabel,children:[e.jsx(ae,{size:14,"aria-hidden":"true"}
1),r("agentConfig.memoryBackgroundTasks")]}),e.jsx("strong",{children:G}),e.jsx("small",{children:J}),e.jsx(x,{size:16,"aria-hidden":"true"})]}),e.jsxs("button",{type:"button",className:`${n.memoryOverviewItem} ${n.memoryOverviewClickableItem}`,onClick:()=>O("diagnostics"),children:[e.jsxs("span",{className:n.memoryOverviewLabel,children:[e.jsx(se,{size:14,"aria-hidden":"true"}),r("agentConfig.memoryDiagnostics")]}),e.jsxs("div",{className:n.memoryOverviewMetrics,children:[e.jsxs("div",{children:[e.jsx("small",{children:r("agentConfig.memoryComponentsMetric")}),e.jsx("strong",{children:(h==null?void 0:h.components_total)??"â"})]}),e.jsxs("div",{children:[e.jsx("small",{children:r("agentConfig.memoryProcessMetric")}),e.jsx("strong",{children:(h==null?void 0:h.process_rss)??"â"})]})]}),e.jsx("small",{children:r("agentConfig.memoryDiagnosticsHint")}),e.jsx(x,{size:16,"aria-hidden":"true"})]}),e.jsxs("button",{type:"button",className:`${n.memoryOverviewItem} ${n.memoryOverviewClickableItem} ${n.memoryOverviewMaintenance}`,onClick:B,disabled:j,"aria-busy":j,children:[e.jsxs("div",{children:[e.jsxs("span",{children:[e.jsx(te,{size:14,"aria-hidden":"true"}),r("agentConfig.memoryMaintenanceEyebrow")]}),e.jsx("strong",{children:r("agentConfig.rebuildBm25Index")}),e.jsx("small",{children:r("agentConfig.rebuildBm25IndexDescription")})]}),e.jsx(x,{size:16,"aria-hidden":"true"})]})]})]}),e.jsxs("div",{className:n.memoryConfigGrid,children:[e.jsxs("section",{className:n.memoryConfigPanel,children:[e.jsxs("div",{className:n.memorySectionHeader,children:[e.jsx("div",{className:`${n.memorySectionIcon} ${n.memorySectionIconPrimary}`,children:"01"}),e.jsxs("div",{children:[e.jsx("h3",{children:r("agentConfig.memoryJournalTitle")}),e.jsx("p",{children:r("agentConfig.memoryJournalDescription")})]})]}),e.jsxs("div",{className:n.memoryCapabilityHeader,children:[e.jsx("h4",{children:r("agentConfig.memoryConversationJournalTitle")}),e.jsx("code",{children:"auto-memory"})]}),e.jsxs("div",{className:n.memoryToggleRow,children:[e.jsxs("div",{children:[e.jsx("strong",{children:r("agentConfig.memoryAutoRecordTitle")}),e.jsx("span",{children:r("agentConfig.memoryAutoRecordDescription")})]}),e.jsx(m,{checked:P,onChange:X})]}),e.jsx(o.Item,{label:r("agentConfig.memoryAutoRecordFrequency"),name:["reme_light_memory_config","auto_memory_interval"],rules:[{required:!0,message:r("agentConfig.autoMemoryIntervalRequired")},{type:"number",min:0,message:r("agentConfig.autoMemoryIntervalMin")}],tooltip:r("agentConfig.autoMemoryIntervalTooltip"),children:e.jsx(R,{style:{width:"100%"},min:P?1:0,step:1,disabled:!P,placeholder:r("agentConfig.autoMemoryIntervalPlaceholder")})}),e.jsxs("div",{className:n.memoryToggleRow,children:[e.jsxs("div",{children:[e.jsx("strong",{children:r("agentConfig.memoryNotifyTitle")}),e.jsx("span",{children:r("agentConfig.memoryNotifyDescription")})]}),e.jsx(o.Item,{name:["reme_light_memory_config","auto_memory_inbox_push_enabled"],initialValue:!0,valuePropName:"checked",noStyle:!0,children:e.jsx(m,{})})]}),e.jsx("div",{className:n.memoryCapabilityDivider}),e.jsx("div",{className:n.memoryCapabilityHeader,children:e.jsxs("div",{className:n.memoryCapabilityTitleRow,children:[e.jsx("h4",{children:r("agentConfig.memoryExternalSourcesTitle")}),e.jsx("span",{className:n.memoryDevelopingBadge,children:r("agentConfig.memoryExternalSourcesDevelopingLabel")})]})}),e.jsxs("div",{className:n.memorySourceCard,children:[e.jsxs("div",{className:n.memorySourceHeader,children:[e.jsxs("button",{type:"button",className:n.memorySourceToggle,"aria-expanded":w,onClick:()=>E(i=>!i),children:[e.jsx("span",{className:`${n.memorySourceChevron} ${w?n.memorySourceChevronExpanded:""}`,"aria-hidden":"true",children:e.jsx(x,{size:18})}),e.jsxs("span",{children:[e.jsx("strong",{children:r("agentConfig.memoryDailyPaperTitle")}),e.jsx("small",{children:r("agentConfig.memoryDailyPaperDescription")})]})]}),e.jsxs("div",{className:n.memorySourceActions,children:[e.jsxs("a",{href:"https://qwenpaw.agentscope.io/docs/memory",target:"_blank",rel:"noreferrer",children:[r("agentConfig.dailyPaperDocumentation"),e.jsx(z,{size:14,"aria-hidden":"true"})]}),e.jsx("code",{children:"daily-paper"}),e.jsx(o.Item,{name:["reme_light_memory_config","daily_paper_cron_enabled"],valuePropName:"checked",noStyle:!0,children:e.jsx(m,{onChange:i=>{i&&E(!0)}})})]})]}),w&&e.jsxs("div",{className:n.memorySourceContent,children:[e.jsx(o.Item,{label:r("agentConfig.dailyPaperCron"),name:["reme_light_memory_config","daily_paper_cron"],tooltip:r("agentConfig.dailyPaperCronTooltip"),rules:_?[{required:!0,whitespace:!0,message:r("agentConfig.dailyPaperCronRequired")},{validator:(i,a)=>!(a!=null&&a.trim())||D(a)?Promise.resolve():Promise.reject(new Error(r("agentConfig.dailyPaperCronInvalid")))}]:[],children:e.jsx(p,{disabled:!_,placeholder:r("agentConfig.dailyPaperCronPlaceholder")})}),e.jsx(o.Item,{label:r("agentConfig.dailyPaperTopics"),name:["reme_light_memory_config","daily_paper_topics"],tooltip:r("agentConfig.dailyPaperTopicsTooltip"),children:e.jsx(p,{disabled:!_,placeholder:r("agentConfig.dailyPaperTopicsPlaceholder")})}),e.jsxs("div",{className:n.memoryToggleRow,children:[e.jsxs("div",{children:[e.jsx("strong",{children:r("agentConfig.dailyPaperUseHfMirror")}),e.jsx("span",{children:r("agentConfig.dailyPaperUseHfMirrorDescription")})]}),e.jsx(o.Item,{name:["reme_light_memory_config","daily_paper_use_hf_mirror"],valuePropName:"checked",noStyle:!0,children:e.jsx(m,{disabled:!_})})]}),e.jsxs("div",{className:n.memoryToggleRow,children:[e.jsxs("div",{children:[e.jsx("strong",{children:r("agentConfig.memoryNotifyTitle")}),e.jsx("span",{children:r("agentConfig.dailyPaperNotifyDescription")})]}),e.jsx(o.Item,{name:["reme_light_memory_config","daily_paper_inbox_push_enabled"],initialValue:!0,valuePropName:"checked",noStyle:!0,children:e.jsx(m,{})})]})]})]}),e.jsxs("div",{className:n.memorySourceCard,children:[e.jsxs("div",{className:n.memorySourceHeader,children:[e.jsxs("button",{type:"button",className:n.memorySourceToggle,"aria-expanded":T,onClick:()=>I(i=>!i),children:[e.jsx("span",{className:`${n.memorySourceChevron} ${T?n.memorySourceChevronExpanded:""}`,"aria-hidden":"true",children:e.jsx(x,{size:18})}),e.jsxs("span",{children:[e.jsx("strong",{children:r("agentConfig.memoryAutoFinTitle")}),e.jsx("small",{children:r("agentConfig.memoryAutoFinDescription")})]})]}),e.jsxs("div",{className:n.memorySourceActions,children:[e.jsxs("a",{href:"https://qwenpaw.agentscope.io/docs/memory",target:"_blank",rel:"noreferrer",children:[r("agentConfig.autoFinDocumentation"),e.jsx(z,{size:14,"aria-hidden":"true"})]}),e.jsx("code",{children:"auto-fin"}),e.jsx(o.Item,{name:["reme_light_memory_config","auto_fin_cron_enabled"],valuePropName:"checked",noStyle:!0,children:e.jsx(m,{onChange:i=>{i&&I(!0)}})})]})]}),T&&e.jsxs("div",{className:n.memorySourceContent,children:[e.jsx(o.Item,{label:r("agentConfig.autoFinCron"),name:["reme_light_memory_config","auto_fin_cron"],tooltip:r("agentConfig.autoFinCronTooltip"),rules:u?[{required:!0,whitespace:!0,message:r("agentConfig.autoFinCronRequired")},{validator:(i,a)=>!(a!=null&&a.trim())||D(a)?Promise.resolve():Promise.reject(new Error(r("agentConfig.autoFinCronInvalid")))}]:[],children:e.jsx(p,{disabled:!u,placeholder:r("agentConfig.autoFinCronPlaceholder")})}),e.jsx(o.Item,{label:r("agentConfig.autoFinTopics"),name:["reme_light_memory_config","auto_fin_topics"],tooltip:r("agentConfig.autoFinTopicsTooltip"),children:e.jsx(p,{disabled:!u,placeholder:r("agentConfig.autoFinTopicsPlaceholder")})}),e.jsx(o.Item,{label:r("agentConfig.autoFinWindowHours"),name:["reme_light_memory_config","auto_fin_window_hours"],tooltip:r("agentConfig.autoFinWindowHoursTooltip"),rules:u?[{required:!0,message:r("agentConfig.autoFinWindowHoursRequired")},{type:"number",min:1,message:r("agentConfig.autoFinWindowHoursMin")},{type:"number",max:M,message:r("agentConfig.autoFinWindowHoursMax",{max:M})}]:[],children:e.jsx(R,{style:{width:"100%"},min:1,max:M,step:1,disabled:!u,placeholder:r("agentConfig.autoFinWindowHoursPlaceholder")})}),e.jsxs("div",{className:n.memoryToggleRow,children:[e.jsxs("div",{children:[e.jsx("strong",{children:r("agentConfig.memoryNotifyTitle")}),e.jsx("span",{children:r("agentConfig.autoFinNotifyDescription")})]}),e.jsx(o.Item,{name:["reme_light_memory_config","auto_fin_inbox_push_enabled"],initialValue:!0,valuePropName:"checked",noStyle:!0,children:e.jsx(m,{})})]}),e.jsx("p",{className:n.memorySourceDisclaimer,children:r("agentConfig.autoFinDisclaimer")})]})]})]}),e.jsxs("div",{className:n.memoryConfigStack,children:[e.jsxs("section",{className:n.memoryConfigPanel,children:[e.jsxs("div",{className:n.memorySectionHeader,children:[e.jsx("div",{className:`${n.memorySectionIcon} ${n.memorySectionIconSecondary}`,children:"02"}),e.jsxs("div",{children:[e.jsx("h3",{children:r("agentConfig.memoryOrganizeSectionTitle")}),e.jsx("p",{children:r("agentConfig.memoryOrganizeSectionDescription")})]})]}),e.jsxs("div",{className:n.memoryCapabilityHeader,children:[e.jsx("h4",{children:r("agentConfig.memoryOrganizeTitle")}),e.jsx("code",{children:"auto-dream"})]}),e.jsxs("div",{className:n.memoryToggleRow,children:[e.jsxs("div",{children:[e.jsx("strong",{children:r("agentConfig.memoryScheduledOrganizeTitle")}),e.jsx("span",{children:r("agentConfig.memoryScheduledOrganizeDescription")})]}),e.jsx(o.Item,{name:["reme_light_memory_config","dream_cron_enabled"],valuePropName:"checked",noStyle:!0,children:e.jsx(m,{})})]}),e.jsx(o.Item,{label:r("agentConfig.dreamCron"),name:["reme_light_memory_config","dream_cron"],tooltip:r("agentConfig.dreamCronTooltip"),rules:A?[{required:!0,whitespace:!0,message:r("agentConfig.dreamCronRequired")},{validator:(i,a)=>!(a!=null&&a.trim())||D(a)?Promise.resolve():Promise.reject(new Error(r("agentConfig.dreamCronInvalid")))}]:[],children:e.jsx(p,{disabled:!A,placeholder:r("agentConfig.dreamCronPlaceholder")})}),e.jsxs("div",{className:n.memoryToggleRow,children:[e.jsxs("div",{children:[e.jsx("strong",{children:r("agentConfig.memoryNotifyTitle")}),e.jsx("span",{children:r("agentConfig.autoDreamNotifyDescription")})]}),e.jsx(o.Item,{name:["reme_light_memory_config","auto_dream_inbox_push_enabled"],initialValue:!0,valuePropName:"checked",noStyle:!0,children:e.jsx(m,{})})]})]}),e.jsxs("section",{className:n.memoryRecallPanel,children:[e.jsxs("div",{className:n.memorySectionHeader,children:[e.jsx("div",{className:`${n.memorySectionIcon} ${n.memorySectionIconTertiary}`,children:"03"}),e.jsxs("div",{children:[e.jsx("h3",{children:r("agentConfig.memorySearchSectionTitle")}),e.jsx("p",{children:r("agentConfig.memorySearchSectionDescription")})]})]}),e.jsxs("div",{className:n.memoryCapabilityHeader,children:[e.jsx("h4",{children:r("agentConfig.memoryRecallTitle")}),e.jsx("code",{children:"memory-search"})]}),e.jsxs("div",{className:n.memoryToggleRow,children:[e.jsxs("div",{children:[e.jsx("strong",{children:r("agentConfig.memorySearchToolTitle")}),e.jsx("span",{children:r("agentConfig.memorySearchToolDescription")})]}),e.jsx(o.Item,{name:["reme_light_memory_config","memory_search_enabled"],initialValue:!0,valuePropName:"checked",noStyle:!0,children:e.jsx(m,{})})]}),e.jsxs("div",{className:n.memoryToggleRow,children:[e.jsxs("div",{children:[e.jsx("strong",{children:r("agentConfig.memoryAutoRecallTitle")}),e.jsx("span",{children:r("agentConfig.memoryAutoRecallDescription")})]}),e.jsx(o.Item,{name:["reme_light_memory_config","auto_memory_search_config","enabled"],initialValue:!1,valuePropName:"checked",noStyle:!0,children:e.jsx(m,{})})]}
1),e.jsxs("div",{className:n.memorySettingRow,children:[e.jsxs("div",{children:[e.jsxs("strong",{children:[r("agentConfig.autoMaxResults"),e.jsx("span",{className:n.memoryRequiredMark,children:"*"})]}),e.jsx("span",{children:r("agentConfig.autoMaxResultsTooltip")})]}),e.jsx(o.Item,{className:n.memoryInlineField,name:["reme_light_memory_config","auto_memory_search_config","max_results"],rules:[{required:!0,message:r("agentConfig.autoMaxResultsRequired")},{type:"number",min:1,message:r("agentConfig.autoMaxResultsMin")}],children:e.jsx(R,{style:{width:"100%"},min:1,step:1,disabled:!Q})})]})]})]})]}),e.jsx(re,{view:C,loading:C==="diagnostics"?c.type==="checking":L,error:C==="diagnostics"?W:V,runtime:t,diagnostics:h,statusBadge:k,statusBadgeLabel:H,onRefresh:()=>void N(C==="diagnostics"),onClose:()=>F(null)})]})}export{pe as ReMeLightMemoryCard,D as isValidDreamCronShape};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.