@muyichengshayu/promptx 0.1.20 → 0.1.22

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/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.22
4
+
5
+ - 修复任务结束后工作台仍反复请求 `tasks`、`workspace-diff` 与当前任务详情接口的问题;收窄 realtime 同步范围,并避免重复终态事件触发无意义刷新。
6
+ - 修复发送消息后当前任务被持续判定为“未保存”从而每 1.5 秒重复自动保存的问题;对任务快照中的待办块内容补齐归一化,避免前端临时字段导致脏状态死循环。
7
+ - 为任务更新增加服务端幂等保护:当保存内容与当前存储完全一致时,不再更新 `updatedAt`、也不再广播 `tasks.changed`,降低多页面/弱网场景下的连锁刷新风险。
8
+
9
+ ## 0.1.21
10
+
11
+ - 优化右侧编辑区的焦点与滚动体验:插入图片、导入 Markdown/PDF 等内容后,当前输入框会尽量保持在视野内;可视区域内在不同文本块之间切换焦点时不再意外滚动。
12
+ - 调整文件处理与发送反馈:按钮 loading 统一改为图标动效,不再切换文案或撑开布局;并补充编辑区滚动相关的单测与浏览器级 E2E。
13
+ - 重做中栏运行态提示:移除会造成抖动的底部状态栏,改为右下角悬浮 `Stop` 按钮,并在按钮内加入动态状态点提示运行中。
14
+ - 优化手机端详情页页签区域:去掉多余外层包裹,收紧上下留白并拉满左右空间;同时让移动端的悬浮 `Stop` 更贴近右下角。
15
+
3
16
  ## 0.1.20
4
17
 
5
18
  - 修复同一任务在本地与远端同时打开时,远端页面查看历史消息仍会被强制拽回底部的问题;根因是任务同步刷新时错误触发了执行区滚底。
@@ -351,6 +351,24 @@ function normalizeTaskTodoItemsInput(items = []) {
351
351
  .slice(0, 100)
352
352
  }
353
353
 
354
+ function areNormalizedBlocksEqual(currentBlocks = [], nextBlocks = []) {
355
+ if (currentBlocks.length !== nextBlocks.length) {
356
+ return false
357
+ }
358
+
359
+ return currentBlocks.every((block, index) => {
360
+ const nextBlock = nextBlocks[index]
361
+ if (!nextBlock) {
362
+ return false
363
+ }
364
+
365
+ return block.type === nextBlock.type
366
+ && block.content === nextBlock.content
367
+ && Number(block.sortOrder) === index
368
+ && JSON.stringify(block.meta || {}) === nextBlock.metaJson
369
+ })
370
+ }
371
+
354
372
  function parseTaskTodoItems(rawValue = '[]') {
355
373
  try {
356
374
  return normalizeTaskTodoItemsInput(JSON.parse(String(rawValue || '[]')))
@@ -552,6 +570,38 @@ export function updateTask(slug, input = {}) {
552
570
  const blocks = hasBlocks ? input.blocks.map(normalizeBlockInput) : []
553
571
  const currentBlocks = loadBlocks(existing.id)
554
572
  const currentBlockMap = new Map(currentBlocks.map((block) => [block.id, block]))
573
+ const taskChanged =
574
+ title !== String(existing.title || '')
575
+ || autoTitle !== String(existing.auto_title || '')
576
+ || lastPromptPreview !== String(existing.last_prompt_preview || '')
577
+ || todoItemsJson !== String(existing.todo_items_json || '[]')
578
+ || codexSessionId !== String(existing.codex_session_id || '')
579
+ || visibility !== normalizeVisibility(existing.visibility)
580
+ || expiresAt !== existing.expires_at
581
+ || Number(automation.enabled ? 1 : 0) !== Number(existing.automation_enabled || 0)
582
+ || automation.cron !== String(existing.automation_cron || '')
583
+ || automation.timezone !== normalizeTaskAutomationTimezone(existing.automation_timezone)
584
+ || automation.concurrencyPolicy !== normalizeTaskAutomationConcurrencyPolicy(existing.automation_concurrency_policy)
585
+ || automation.lastTriggeredAt !== String(existing.automation_last_triggered_at || '')
586
+ || automation.nextTriggerAt !== String(existing.automation_next_trigger_at || '')
587
+ || Number(notification.enabled ? 1 : 0) !== Number(existing.notification_enabled || 0)
588
+ || notification.channelType !== String(existing.notification_channel_type || '')
589
+ || notification.webhookUrl !== String(existing.notification_webhook_url || '')
590
+ || notification.secret !== String(existing.notification_secret || '')
591
+ || notification.triggerOn !== String(existing.notification_trigger_on || '')
592
+ || notification.locale !== normalizeTaskNotificationLocale(existing.notification_locale)
593
+ || notification.messageMode !== normalizeTaskNotificationMessageMode(existing.notification_message_mode)
594
+ || notification.lastStatus !== String(existing.notification_last_status || '')
595
+ || notification.lastError !== String(existing.notification_last_error || '')
596
+ || notification.lastSentAt !== String(existing.notification_last_sent_at || '')
597
+ || (hasBlocks && !areNormalizedBlocksEqual(currentBlocks, blocks))
598
+
599
+ if (!taskChanged) {
600
+ return {
601
+ ...getTaskBySlug(slug),
602
+ changed: false,
603
+ }
604
+ }
555
605
 
556
606
  transaction(() => {
557
607
  run(
@@ -634,7 +684,10 @@ export function updateTask(slug, input = {}) {
634
684
  })
635
685
  })
636
686
 
637
- return getTaskBySlug(slug)
687
+ return {
688
+ ...getTaskBySlug(slug),
689
+ changed: true,
690
+ }
638
691
  }
639
692
 
640
693
  export function deleteTask(slug) {
@@ -189,10 +189,12 @@ function registerTaskRoutes(app, options = {}) {
189
189
  if (result.error === 'not_found') {
190
190
  return reply.code(404).send({ messageKey: 'errors.taskNotFound', message: '任务不存在。' })
191
191
  }
192
- broadcastServerEvent('tasks.changed', {
193
- taskSlug: request.params.slug,
194
- reason: 'updated',
195
- })
192
+ if (result.changed !== false) {
193
+ broadcastServerEvent('tasks.changed', {
194
+ taskSlug: request.params.slug,
195
+ reason: 'updated',
196
+ })
197
+ }
196
198
  return decorateTask(result)
197
199
  })
198
200
 
@@ -1 +1 @@
1
- import{w as he,o as Oe,a as p,c as ge,b as f,d as e,e as k,u as a,t as r,y as Qe,z as Xe,n as T,F as xe,r as $e,f as M,q as Je,g as Te,T as Ue,s as $,j as ye,i as j,B as Fe,I as He,C as Ye,D as Ze,R as et,v as tt}from"./index-CAxXWy_Y.js";import{A as nt,n as Le,k as Ce,r as st,f as ve,X as qe,S as Ie,L as Pe,m as at,d as it,s as lt,o as Be,_ as ot,P as rt,b as dt,p as ct,B as ut,q as pt,e as Ae,T as mt,t as ft}from"./WorkbenchView-BUYIusWV.js";import{I as vt}from"./info-BE3hW0WS.js";function ht(i=[]){return(Array.isArray(i)&&i.length?i:nt).filter(d=>d&&typeof d=="object").map(d=>{const S=Le(d.value);return{...d,value:S,label:String(d.label||Ce(S)).trim()||Ce(S),enabled:d.enabled!==!1,available:d.available!==!1}})}function Re(i=[]){return ht(i).filter(P=>P.enabled&&P.available)}async function gt(){const i=await st("/api/meta",{cache:"no-store"});return Re(i==null?void 0:i.agentEngineOptions)}const xt={class:"panel flex h-full w-full max-w-4xl flex-col overflow-hidden sm:h-auto sm:max-h-[86vh]"},yt={class:"theme-divider flex items-start justify-between gap-3 border-b px-4 py-3 sm:px-5 sm:py-4"},bt={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},wt={class:"theme-muted-text mt-1 text-xs leading-5"},St=["disabled"],kt={class:"flex min-h-0 flex-1 flex-col overflow-hidden px-4 py-4 sm:px-5"},_t={class:"theme-divider mt-4 rounded-sm border border-dashed px-3 py-2"},$t={class:"flex items-start gap-2 text-xs leading-5"},Ct={class:"theme-muted-text shrink-0"},jt={class:"min-w-0 break-all font-mono text-[var(--theme-textPrimary)]"},Mt={class:"theme-muted-text mt-4 block text-xs"},Pt={class:"theme-input-shell mt-1 flex h-10 items-center gap-2 rounded-sm border px-3 transition focus-within:ring-2"},Tt=["placeholder"],Lt={class:"mt-4 flex items-center gap-1.5"},Rt={class:"theme-content-panel mt-3 min-h-0 flex-1 overflow-y-auto p-2"},Dt={key:0,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},Et={key:1,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},Ft={key:2,class:"theme-empty-state flex items-center justify-center gap-2 px-3 py-8 text-sm"},It={key:3,class:"theme-empty-state flex items-center justify-center gap-2 px-3 py-8 text-sm"},Bt={key:4,class:"theme-empty-state px-3 py-8 text-sm"},At={key:5,class:"theme-empty-state px-3 py-8 text-sm"},Nt={key:6,class:"theme-empty-state px-3 py-8 text-sm"},zt={key:7,class:"space-y-1"},Ot=["onClick"],Ut={class:"min-w-0 flex-1"},Ht=["innerHTML"],qt=["innerHTML"],Vt={key:0,class:"theme-muted-text px-1 pt-2 text-xs"},Wt={key:8,class:"space-y-1"},Kt={class:"flex items-start gap-1.5"},Gt=["onClick"],Qt=["onClick"],Xt={class:"min-w-0 flex-1"},Jt={key:0,class:"theme-muted-text truncate font-mono text-[10px]"},Yt={class:"theme-divider flex flex-col-reverse gap-2 border-t border-dashed px-4 py-4 sm:flex-row sm:items-center sm:justify-end sm:px-5"},Zt={class:"flex flex-col-reverse gap-2 sm:flex-row sm:items-center"},en=["disabled"],tn=["disabled"],nn={__name:"CodexDirectoryPickerDialog",props:{open:{type:Boolean,default:!1},initialPath:{type:String,default:""}},emits:["close","select"],setup(i,{emit:P}){const d=i,S=P,{t:v}=ye(),u=$(""),h=$(null),w=$(!1),l=$(""),x=$(!1),y=$(""),A=$([]),I=$(!1),L=$(""),C=$("tree"),E=$(""),V=$("");let D=null,O=0;const Z=j(()=>ce(h.value?[h.value]:[])),_=j(()=>C.value==="search"&&!L.value.trim()),ie=j(()=>C.value==="search"&&!!L.value.trim()&&!x.value&&!y.value&&!A.value.length),je=j(()=>C.value==="tree"&&!w.value&&!l.value&&!Z.value.length);function le(n=""){const c=String(n||"").trim();return/^[a-z]:[\\/]/i.test(c)||c.includes("\\")}function F(n=""){const c=String(n||"").trim();if(!c)return"";const s=le(c);let m=c.replace(/\\/g,"/");return m.length>1&&!/^[a-z]:\/?$/i.test(m)&&m!=="/"&&(m=m.replace(/\/+$/,"")),s?m.toLowerCase():m}function Q(n="",c=""){const s=F(n),m=F(c);return!s||!m?!1:s===m||s.startsWith(`${m}/`)}function R(n="",c=""){const s=String(n||"").trim(),m=String(c||"").trim();return s?m?le(s)?/^[a-z]:\\?$/i.test(s)?`${s.replace(/[\\/]+$/,"")}\\${m}`:`${s.replace(/[\\/]+$/,"")}\\${m}`:s==="/"?`/${m}`:`${s.replace(/\/+$/,"")}/${m}`:s:m}function oe(n="",c=""){const s=F(n),m=F(c);if(!s||!m||!Q(m,s))return[];const N=m===s?"":m.slice(s.length).replace(/^\//,"");return N?N.split("/").filter(Boolean):[]}function ee(n){return(n==null?void 0:n.name)||(n==null?void 0:n.path)||v("directoryPicker.unnamedDirectory")}function re(n=""){const c=String(n||"").trim();return c?c.split(/[\\/]/).filter(Boolean).at(-1)||c:"Home"}function X(n=""){return String(n||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function be(n="",c=""){const s=String(n||""),m=String(c||"").trim().toLowerCase();if(!s||!m)return null;const N=s.toLowerCase(),H=N.indexOf(m);if(H>=0)return{start:H,end:H+m.length};const _e=m.split(/[\\/\s_.-]+/).filter(Boolean).sort((q,Y)=>Y.length-q.length);for(const q of _e){if(q.length<2)continue;const Y=N.indexOf(q);if(Y>=0)return{start:Y,end:Y+q.length}}return null}function de(n="",c=""){const s=String(n||""),m=be(s,c);return m?`${X(s.slice(0,m.start))}<mark class="theme-search-highlight">${X(s.slice(m.start,m.end))}</mark>${X(s.slice(m.end))}`:X(s)}function we(n){return de(ee(n),L.value)}function Me(n){return de((n==null?void 0:n.path)||"",L.value)}function te(n,c=0){return{...n,depth:c,expanded:!1,loaded:!1,loading:!1,children:[]}}function ce(n=[],c=[]){return n.forEach(s=>{c.push(s),s.expanded&&s.children.length&&ce(s.children,c)}),c}function B(){h.value&&(h.value={...h.value})}function W(n,c=h.value?[h.value]:[]){const s=F(n);if(!s)return null;for(const m of c){if(F(m.path)===s)return m;if(m.children.length){const N=W(n,m.children);if(N)return N}}return null}function K(n){E.value=String((n==null?void 0:n.path)||"").trim(),V.value=ee(n)}async function ne(n,c={}){if(!(!n||n.loading)&&!(n.loaded&&!c.force)){n.loading=!0,l.value="",B();try{const s=await Be({path:n.path,limit:240});n.children=(s.items||[]).map(m=>te(m,n.depth+1)),n.loaded=!0}catch(s){l.value=s.message||v("directoryPicker.loadFailed")}finally{n.loading=!1,B()}}}async function ue(){w.value=!0,l.value="";try{const n=await Be({limit:240});u.value=String(n.path||""),h.value=te({name:re(n.path||""),path:String(n.path||""),type:"directory",hasChildren:!0,isHomeRoot:!0},0),h.value.children=(n.items||[]).map(c=>te(c,1)),h.value.loaded=!0,h.value.expanded=!0,K(h.value)}catch(n){l.value=n.message||v("directoryPicker.treeLoadFailed"),h.value=null,u.value=""}finally{w.value=!1}}async function se(n=""){const c=String(n||"").trim();if(!c||!u.value||!Q(c,u.value))return;let s=h.value;if(!s)return;K(s);const m=oe(u.value,c);for(const N of m){await ne(s),s.expanded=!0,B();const H=W(R(s.path,N),s.children);if(!H)break;s=H,K(s)}}async function pe(){L.value="",C.value="tree",A.value=[],y.value="",I.value=!1,E.value="",V.value="",await ue();const n=String(d.initialPath||"").trim();n&&Q(n,u.value)&&await se(n)}async function me(n){if(n!=null&&n.path&&(K(n),!!n.hasChildren)){if(!n.loaded){n.expanded=!0,B(),await ne(n);return}n.expanded=!n.expanded,B()}}function Se(n){n!=null&&n.path&&(K(n),C.value="tree")}async function ae(){const n=String(L.value||"").trim();O+=1;const c=O;if(!d.open||!n||!u.value){x.value=!1,y.value="",A.value=[],I.value=!1;return}x.value=!0,y.value="";try{const s=await lt(n,{path:u.value,limit:80});if(c!==O)return;A.value=Array.isArray(s.items)?s.items:[],I.value=!!s.truncated}catch(s){if(c!==O)return;y.value=s.message||v("directoryPicker.searchFailed"),A.value=[],I.value=!1}finally{c===O&&(x.value=!1)}}function U(){if(D&&(window.clearTimeout(D),D=null),!String(L.value||"").trim()){x.value=!1,y.value="",A.value=[],I.value=!1;return}x.value=!0,y.value="",D=window.setTimeout(()=>{ae()},120)}async function fe(n){n!=null&&n.path&&(C.value="tree",await se(n.path))}function ke(){E.value&&(S("select",E.value),S("close"))}function J(n){d.open&&n.key==="Escape"&&S("close")}return he(L,()=>{C.value=L.value.trim()?"search":"tree",U()}),he(()=>d.open,n=>{if(document.body.classList.toggle("overflow-hidden",n),n){window.addEventListener("keydown",J),pe().catch(()=>{});return}window.removeEventListener("keydown",J),D&&(window.clearTimeout(D),D=null)}),Oe(()=>{document.body.classList.remove("overflow-hidden"),window.removeEventListener("keydown",J),D&&window.clearTimeout(D)}),(n,c)=>(p(),ge(Ue,{to:"body"},[i.open?(p(),f("div",{key:0,class:"theme-modal-backdrop fixed inset-0 z-[60] flex items-end justify-center px-0 py-0 sm:items-center sm:px-4 sm:py-6",onClick:c[5]||(c[5]=Te(s=>!(w.value||x.value)&&S("close"),["self"]))},[e("section",xt,[e("div",yt,[e("div",null,[e("div",bt,[k(a(ve),{class:"h-4 w-4"}),e("span",null,r(a(v)("directoryPicker.title")),1)]),e("p",wt,r(a(v)("directoryPicker.intro")),1)]),e("button",{type:"button",class:"theme-icon-button h-9 w-9",disabled:w.value||x.value,onClick:c[0]||(c[0]=s=>S("close"))},[k(a(qe),{class:"h-4 w-4"})],8,St)]),e("div",kt,[e("div",_t,[e("div",$t,[e("span",Ct,r(a(v)("directoryPicker.currentSelection")),1),e("span",jt,r(E.value||a(v)("directoryPicker.selectionPlaceholder")),1)])]),e("label",Mt,[e("span",null,r(a(v)("directoryPicker.searchLabel")),1),e("div",Pt,[k(a(Ie),{class:"h-4 w-4 shrink-0 text-[var(--theme-textMuted)]"}),Qe(e("input",{"onUpdate:modelValue":c[1]||(c[1]=s=>L.value=s),type:"text",placeholder:a(v)("directoryPicker.searchPlaceholder"),class:"min-w-0 flex-1 border-0 bg-transparent px-0 text-sm text-[var(--theme-textPrimary)] outline-none placeholder:text-[var(--theme-textMuted)]"},null,8,Tt),[[Xe,L.value]])])]),e("div",Lt,[e("button",{type:"button",class:T(["inline-flex h-8 items-center gap-1 rounded-sm border px-2 text-[11px] transition",C.value==="search"?"tool-button-accent-subtle":"theme-filter-idle border-dashed"]),onClick:c[2]||(c[2]=s=>C.value="search")},[k(a(Ie),{class:"h-3.5 w-3.5"}),e("span",null,r(a(v)("directoryPicker.searchTab")),1)],2),e("button",{type:"button",class:T(["inline-flex h-8 items-center gap-1 rounded-sm border px-2 text-[11px] transition",C.value==="tree"?"tool-button-accent-subtle":"theme-filter-idle border-dashed"]),onClick:c[3]||(c[3]=s=>C.value="tree")},[k(a(ve),{class:"h-3.5 w-3.5"}),e("span",null,r(a(v)("directoryPicker.treeTab")),1)],2)]),e("div",Rt,[C.value==="search"&&y.value?(p(),f("div",Dt,r(y.value),1)):C.value==="tree"&&l.value?(p(),f("div",Et,r(l.value),1)):C.value==="search"&&x.value?(p(),f("div",Ft,[k(a(Pe),{class:"h-4 w-4 animate-spin"}),e("span",null,r(a(v)("directoryPicker.searching")),1)])):C.value==="tree"&&w.value?(p(),f("div",It,[k(a(Pe),{class:"h-4 w-4 animate-spin"}),e("span",null,r(a(v)("directoryPicker.treeLoading")),1)])):_.value?(p(),f("div",Bt,r(a(v)("directoryPicker.searchPrompt")),1)):ie.value?(p(),f("div",At,r(a(v)("directoryPicker.noSearchResults")),1)):je.value?(p(),f("div",Nt,r(a(v)("directoryPicker.emptyTree")),1)):C.value==="search"?(p(),f("div",zt,[(p(!0),f(xe,null,$e(A.value,s=>(p(),f("button",{key:s.path,type:"button",class:T(["flex w-full items-start gap-2 rounded-sm border border-transparent px-2.5 py-1.5 text-left transition",F(E.value)===F(s.path)?"theme-list-item-active":"theme-list-item-hover"]),onClick:m=>fe(s)},[k(a(ve),{class:"theme-muted-text mt-0.5 h-4 w-4 shrink-0"}),e("div",Ut,[e("div",null,[e("span",{class:"truncate text-[13px] text-[var(--theme-textPrimary)]",innerHTML:we(s)},null,8,Ht)]),e("div",{class:"theme-muted-text truncate font-mono text-[10px]",innerHTML:Me(s)},null,8,qt)])],10,Ot))),128)),I.value?(p(),f("p",Vt,r(a(v)("directoryPicker.truncatedHint")),1)):M("",!0)])):(p(),f("div",Wt,[(p(!0),f(xe,null,$e(Z.value,s=>(p(),f("div",{key:s.path,class:T(["rounded-sm border border-transparent px-1.5 py-1 transition",F(E.value)===F(s.path)?"theme-list-item-active":s.expanded?"theme-list-item-expanded":"theme-list-item-hover"]),style:Je({paddingLeft:`${s.depth*16+6}px`})},[e("div",Kt,[e("button",{type:"button",class:T(["theme-icon-button h-5 w-5 shrink-0",s.hasChildren?"":"invisible pointer-events-none"]),onClick:Te(m=>me(s),["stop"])},[s.loading?(p(),ge(a(Pe),{key:0,class:"h-3.5 w-3.5 animate-spin"})):(p(),ge(a(at),{key:1,class:T(["h-3.5 w-3.5 transition",s.expanded?"rotate-90 text-[var(--theme-textPrimary)]":""])},null,8,["class"]))],10,Gt),e("button",{type:"button",class:"flex min-w-0 flex-1 items-start gap-1.5 rounded-sm px-0.5 py-0.5 text-left",onClick:m=>Se(s)},[k(a(ve),{class:T(["h-4 w-4 shrink-0",F(E.value)===F(s.path)?"text-[var(--theme-textPrimary)]":"text-[var(--theme-textMuted)]"])},null,8,["class"]),e("div",Xt,[e("div",{class:T(["truncate text-[13px]",s.isHomeRoot?"font-medium text-[var(--theme-textSecondary)]":"font-medium text-[var(--theme-textPrimary)]"])},r(ee(s)),3),s.isHomeRoot?(p(),f("div",Jt,r(s.path),1)):M("",!0)])],8,Qt)])],6))),128))]))])]),e("div",Yt,[e("div",Zt,[e("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:w.value||x.value,onClick:c[4]||(c[4]=s=>S("close"))},r(a(v)("directoryPicker.cancel")),9,en),e("button",{type:"button",class:"tool-button tool-button-primary inline-flex w-full items-center justify-center gap-2 px-3 py-2 text-xs sm:w-auto",disabled:w.value||x.value||!E.value,onClick:ke},[k(a(it),{class:"h-4 w-4"}),e("span",null,r(a(v)("directoryPicker.useCurrentDirectory")),1)],8,tn)])])])])):M("",!0)]))}},sn={class:"grid gap-4"},an={class:"theme-muted-text block text-xs"},ln=["value","disabled"],on={class:"theme-muted-text block text-xs"},rn={class:"mt-1 flex gap-2"},dn=["value","disabled"],cn=["disabled"],un={id:"codex-manager-workspace-suggestions"},pn=["value"],mn={key:0,class:"mt-2 text-[11px] leading-5 text-[var(--theme-warningText)]"},fn={key:1,class:"theme-muted-text mt-2 text-[11px] leading-5"},vn={class:"theme-muted-text block text-xs"},hn={class:"mt-1"},gn={class:"flex items-center gap-2 text-sm"},xn={key:0,class:"theme-muted-text rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]"},yn=["disabled","onClick"],bn={class:"flex items-center justify-between gap-3"},wn={class:"min-w-0 flex-1 truncate"},Sn={key:0,class:"theme-muted-text rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]"},kn={key:0,class:"theme-muted-text mt-2 text-[11px] leading-5"},Ne={__name:"CodexSessionManagerForm",props:{busy:{type:Boolean,default:!1},canEditEngine:{type:Boolean,default:!0},canEditCwd:{type:Boolean,default:!0},cwd:{type:String,default:""},cwdReadonlyMessage:{type:String,default:""},duplicateCwdMessage:{type:String,default:""},engine:{type:String,default:"codex"},engineOptions:{type:Array,default:()=>[]},engineReadonlyMessage:{type:String,default:""},mobile:{type:Boolean,default:!1},title:{type:String,default:""},workspaceSuggestions:{type:Array,default:()=>[]}},emits:["open-directory-picker","update:cwd","update:engine","update:title"],setup(i,{emit:P}){const d=i,S=P,{t:v}=ye(),u=j(()=>{const h=String(d.engine||"").trim();return d.engineOptions.find(w=>String((w==null?void 0:w.value)||"").trim()===h)||null});return(h,w)=>(p(),f("div",sn,[e("label",an,[e("span",null,r(a(v)("projectManager.projectTitleOptional")),1),e("input",{value:i.title,type:"text",maxlength:"140",placeholder:"",class:"tool-input mt-1",disabled:i.busy,onInput:w[0]||(w[0]=l=>S("update:title",l.target.value))},null,40,ln)]),e("label",on,[e("span",null,r(a(v)("projectManager.workingDirectoryField")),1),e("div",rn,[e("input",{value:i.cwd,type:"text",list:"codex-manager-workspace-suggestions",placeholder:"",class:T(["tool-input min-w-0 flex-1 disabled:cursor-not-allowed disabled:opacity-80",i.duplicateCwdMessage?"border-[var(--theme-warning)]":""]),disabled:i.busy||!i.canEditCwd,onInput:w[1]||(w[1]=l=>S("update:cwd",l.target.value))},null,42,dn),e("button",{type:"button",class:"tool-button inline-flex shrink-0 items-center gap-2 px-3 py-2 text-xs",disabled:i.busy||!i.canEditCwd,onClick:w[2]||(w[2]=l=>S("open-directory-picker"))},[k(a(ve),{class:"h-4 w-4"}),e("span",null,r(i.mobile?a(v)("projectManager.choose"):a(v)("projectManager.chooseDirectory")),1)],8,cn)]),e("datalist",un,[(p(!0),f(xe,null,$e(i.workspaceSuggestions,l=>(p(),f("option",{key:l,value:l},null,8,pn))),128))]),i.duplicateCwdMessage?(p(),f("p",mn,r(i.duplicateCwdMessage),1)):i.cwdReadonlyMessage?(p(),f("p",fn,r(i.cwdReadonlyMessage),1)):M("",!0)]),e("label",vn,[e("span",null,r(a(v)("projectManager.engineField")),1),e("div",hn,[k(ot,{"model-value":i.engine,options:i.engineOptions,disabled:i.busy||!i.canEditEngine,placeholder:a(v)("projectManager.selectEngine"),"empty-text":a(v)("projectManager.noEngines"),"get-option-value":l=>(l==null?void 0:l.value)||"","onUpdate:modelValue":w[3]||(w[3]=l=>S("update:engine",l))},{trigger:Fe(({disabled:l})=>{var x;return[e("div",gn,[e("span",{class:T(["min-w-0 flex-1 truncate",l?"theme-muted-text":"text-[var(--theme-textPrimary)]"])},r(((x=u.value)==null?void 0:x.label)||a(v)("projectManager.selectEngine")),3),u.value&&u.value.enabled===!1?(p(),f("span",xn,r(a(v)("projectManager.comingSoon")),1)):M("",!0)])]}),option:Fe(({option:l,selected:x,select:y})=>[e("button",{type:"button",class:T(["w-full rounded-sm border border-dashed px-3 py-2 text-left text-sm transition",x?"theme-filter-active":"theme-filter-idle"]),disabled:(l==null?void 0:l.enabled)===!1,onClick:y},[e("div",bn,[e("span",wn,r(l.label),1),(l==null?void 0:l.enabled)===!1?(p(),f("span",Sn,r(a(v)("projectManager.comingSoon")),1)):M("",!0)])],10,yn)]),_:1},8,["model-value","options","disabled","placeholder","empty-text","get-option-value"])]),i.engineReadonlyMessage?(p(),f("p",kn,r(i.engineReadonlyMessage),1)):M("",!0)])]))}},_n={class:"flex items-center justify-between gap-3"},$n={class:"theme-heading text-sm font-medium"},Cn={key:0,class:"theme-muted-text mt-1 text-xs"},jn=["disabled"],Mn=["onClick"],Pn={key:0,class:"theme-selection-indicator absolute inset-y-3 left-0 w-1 rounded-full"},Tn={class:"flex w-full flex-col gap-2 text-left"},Ln={class:"theme-heading min-w-0 text-sm font-medium"},Rn=["title"],Dn=["title"],En={class:"theme-muted-text flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] leading-5"},Fn={key:0,"aria-hidden":"true"},In={key:1},Bn={class:"flex flex-wrap items-center gap-2 pt-1"},An={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},ze={__name:"CodexSessionManagerList",props:{busy:{type:Boolean,default:!1},editingSessionId:{type:String,default:""},formatUpdatedAt:{type:Function,default:i=>i},getRuntimeStatusClass:{type:Function,default:()=>""},getRuntimeStatusLabel:{type:Function,default:()=>""},getThreadStatusClass:{type:Function,default:()=>""},getThreadStatusLabel:{type:Function,default:()=>""},hasSessions:{type:Boolean,default:!1},isCurrentSession:{type:Function,default:()=>!1},isSessionRunning:{type:Function,default:()=>!1},mode:{type:String,default:"edit"},mobile:{type:Boolean,default:!1},sessions:{type:Array,default:()=>[]}},emits:["create","select"],setup(i,{emit:P}){const d=i,S=P,{t:v}=ye();function u(l){return d.mode==="edit"&&d.editingSessionId===l.id?"theme-card-selected":d.isSessionRunning(l.id)?"theme-card-warning":"theme-card-idle-strong"}function h(l){return d.isCurrentSession(l.id)?v("projectManager.current"):v("projectManager.regular")}function w(l){return d.isCurrentSession(l.id)?"theme-status-info":"theme-status-neutral"}return(l,x)=>(p(),f(xe,null,[e("div",_n,[e("div",null,[e("div",$n,r(a(v)("projectManager.projectList")),1),i.hasSessions?M("",!0):(p(),f("p",Cn,r(a(v)("projectManager.noProjects")),1))]),e("button",{type:"button",class:"tool-button tool-button-primary inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:i.busy,onClick:x[0]||(x[0]=y=>S("create"))},[k(a(rt),{class:"h-4 w-4"}),e("span",null,r(a(v)("projectManager.create")),1)],8,jn)]),e("div",{class:T(["mt-4 space-y-2",i.mobile?"min-h-0 flex-1 overflow-y-auto":"max-h-52 overflow-y-auto pr-1 sm:max-h-64 lg:max-h-[calc(88vh-11rem)]"])},[(p(!0),f(xe,null,$e(i.sessions,y=>(p(),f("article",{key:y.id,class:T(["relative cursor-pointer rounded-sm border p-3 transition",u(y)]),onClick:A=>S("select",y.id)},[i.mode==="edit"&&i.editingSessionId===y.id?(p(),f("span",Pn)):M("",!0),e("div",Tn,[e("div",Ln,[e("span",{class:"block truncate",title:y.title||a(v)("projectManager.untitledProject")},r(y.title||a(v)("projectManager.untitledProject")),9,Rn)]),e("div",{class:"theme-muted-text break-all font-mono text-[11px] leading-5",title:y.cwd},r(y.cwd),9,Dn),e("div",En,[e("span",null,r(a(Ce)(y.engine)),1),i.mobile?M("",!0):(p(),f("span",Fn,"·")),i.mobile?M("",!0):(p(),f("span",In,r(i.formatUpdatedAt(y.updatedAt)),1))]),e("div",Bn,[e("span",{class:T(["inline-flex shrink-0 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",w(y)])},r(h(y)),3),e("span",{class:T(["inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",i.getRuntimeStatusClass(y.id)])},[i.isSessionRunning(y.id)?(p(),f("span",An)):M("",!0),He(" "+r(i.getRuntimeStatusLabel(y.id)),1)],2),e("span",{class:T(["inline-flex shrink-0 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",i.getThreadStatusClass(y)])},r(i.getThreadStatusLabel(y)),3)])])],10,Mn))),128))],2)],64))}},Nn={class:"space-y-3"},zn={class:"dashed-panel px-3 py-3"},On={class:"theme-muted-text text-[11px]"},Un={class:"mt-2 flex flex-wrap gap-2"},Hn={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},qn={key:0,class:"theme-status-info inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs"},Vn={class:"dashed-panel px-3 py-3"},Wn={class:"theme-muted-text text-[11px]"},Kn={class:"mt-2 text-sm text-[var(--theme-textPrimary)]"},Gn={class:"dashed-panel px-3 py-3"},Qn={class:"theme-muted-text text-[11px]"},Xn={class:"mt-2 break-all font-mono text-xs leading-6 text-[var(--theme-textPrimary)]"},Jn={class:"dashed-panel px-3 py-3"},Yn={class:"theme-muted-text text-[11px]"},Zn={class:"mt-2 text-sm text-[var(--theme-textPrimary)]"},es={class:"dashed-panel px-3 py-3"},ts={class:"theme-muted-text inline-flex items-center gap-2 text-[11px]"},ns={class:"mt-2 text-xs leading-6 text-[var(--theme-textSecondary)]"},ss={__name:"CodexSessionManagerStatus",props:{activeSession:{type:Object,default:null},formatUpdatedAt:{type:Function,default:i=>i},getRuntimeStatusClass:{type:Function,default:()=>""},getRuntimeStatusLabel:{type:Function,default:()=>""},getThreadStatusClass:{type:Function,default:()=>""},getThreadStatusLabel:{type:Function,default:()=>""},isCurrentSession:{type:Function,default:()=>!1},isSessionRunning:{type:Function,default:()=>!1}},setup(i){const{t:P}=ye();return(d,S)=>{var v,u,h,w,l,x,y;return p(),f("div",Nn,[e("div",zn,[e("div",On,r(a(P)("projectManager.runtimeStatus")),1),e("div",Un,[e("span",{class:T(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",i.getRuntimeStatusClass((v=i.activeSession)==null?void 0:v.id)])},[i.isSessionRunning((u=i.activeSession)==null?void 0:u.id)?(p(),f("span",Hn)):M("",!0),He(" "+r(i.getRuntimeStatusLabel((h=i.activeSession)==null?void 0:h.id)),1)],2),e("span",{class:T(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",i.getThreadStatusClass(i.activeSession)])},r(i.getThreadStatusLabel(i.activeSession)),3),(w=i.activeSession)!=null&&w.id&&i.isCurrentSession(i.activeSession.id)?(p(),f("span",qn,r(a(P)("projectManager.currentProject")),1)):M("",!0)])]),e("div",Vn,[e("div",Wn,r(a(P)("projectManager.engine")),1),e("div",Kn,r(a(Ce)((l=i.activeSession)==null?void 0:l.engine)),1)]),e("div",Gn,[e("div",Qn,r(a(P)("projectManager.workingDirectory")),1),e("div",Xn,r(((x=i.activeSession)==null?void 0:x.cwd)||a(P)("projectManager.notSet")),1)]),e("div",Jn,[e("div",Yn,r(a(P)("projectManager.updatedAt")),1),e("div",Zn,r(i.formatUpdatedAt((y=i.activeSession)==null?void 0:y.updatedAt)),1)]),e("div",es,[e("div",ts,[k(a(vt),{class:"h-3.5 w-3.5"}),e("span",null,r(a(P)("projectManager.note")),1)]),e("p",ns,r(a(P)("projectManager.noteDescription")),1)])])}}},as={class:"panel flex h-full w-full max-w-5xl flex-col overflow-hidden sm:h-auto sm:max-h-[88vh]"},is={class:"theme-divider flex flex-wrap items-start justify-between gap-3 border-b px-4 py-3 sm:px-5 sm:py-4"},ls={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},os={class:"flex items-center gap-2"},rs=["disabled"],ds={key:0,class:"grid min-h-0 flex-1 gap-0 lg:grid-cols-[minmax(0,300px)_minmax(0,1fr)]"},cs={class:"theme-divider theme-muted-panel border-b px-3 py-3 sm:px-4 sm:py-4 lg:border-b-0 lg:border-r"},us={class:"min-h-0 overflow-y-auto px-4 py-4 sm:px-5"},ps={class:"flex flex-wrap items-start justify-between gap-3"},ms={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},fs={class:"mt-5"},vs={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},hs={class:"theme-divider mt-6 flex flex-col gap-3 border-t border-dashed pt-4 sm:flex-row sm:items-center sm:justify-between"},gs={class:"flex flex-wrap items-center gap-2"},xs=["disabled"],ys={class:"flex flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:items-center"},bs=["disabled"],ws=["disabled"],Ss=["disabled"],ks={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},_s={key:0,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},$s={class:"min-h-0 flex-1 overflow-hidden px-3 py-3"},Cs={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},js={class:"theme-divider flex items-center gap-3 border-b px-4 py-3"},Ms=["disabled"],Ps={class:"min-w-0 flex-1"},Ts={class:"theme-heading truncate text-sm font-medium"},Ls={key:0,class:"theme-muted-text mt-1 truncate text-xs"},Rs={class:"theme-divider border-b px-4 py-3"},Ds={class:"grid grid-cols-2 gap-2"},Es=["disabled"],Fs={class:"min-h-0 flex-1 overflow-y-auto px-4 py-4"},Is={key:0},Bs={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},As={class:"theme-divider mt-6 flex flex-col gap-3 border-t border-dashed pt-4"},Ns=["disabled"],zs=["disabled"],qs={__name:"CodexSessionManagerDialog",props:{open:{type:Boolean,default:!1},sessions:{type:Array,default:()=>[]},workspaces:{type:Array,default:()=>[]},selectedSessionId:{type:String,default:""},selectionLocked:{type:Boolean,default:!1},selectionLockReason:{type:String,default:""},loading:{type:Boolean,default:!1},sending:{type:Boolean,default:!1},onRefresh:{type:Function,default:null},onCreate:{type:Function,default:null},onUpdate:{type:Function,default:null},onDelete:{type:Function,default:null}},emits:["close","project-created","select-session"],setup(i,{emit:P}){const d=i,S=P,{locale:v,t:u}=ye(),h=$("edit"),w=$(""),l=Ye({title:"",engine:"codex",cwd:""}),x=$(""),y=$(!1),A=$(!1),I=$(!1),L=$(!1),C=$(!1),{matches:E}=dt("(max-width: 767px)"),V=$("list"),D=$("basic"),O=$(Re()),Z=j(()=>K(d.sessions)),_=j(()=>d.sessions.find(t=>t.id===w.value)||null),ie=j(()=>d.sessions.length>0),je=j(()=>d.sessions.find(t=>t.id===d.selectedSessionId)||null),le=j(()=>!!(_.value&&B(_.value.id))),F=j(()=>{var t;return!((t=_.value)!=null&&t.started)}),Q=j(()=>{var t;return!((t=_.value)!=null&&t.started)}),R=j(()=>d.loading||y.value||A.value||I.value),oe=j(()=>{var b,g;const t=new Set,o=[];return[l.cwd,(b=_.value)==null?void 0:b.cwd,(g=je.value)==null?void 0:g.cwd,...d.workspaces,...d.sessions.map(G=>G.cwd)].forEach(G=>{const z=String(G||"").trim();!z||t.has(z)||(t.add(z),o.push(z))}),o.slice(0,12)}),ee=j(()=>O.value),re=j(()=>{const t=ce(l.cwd);return t?d.sessions.filter(o=>{var b;return o.id===((b=_.value)==null?void 0:b.id)?!1:ce(o.cwd)===t}):[]}),X=j(()=>{if(!re.value.length)return"";const t=re.value.slice(0,3).map(o=>{const b=o.title||u("projectManager.untitledProject");return v.value==="en-US"?`"${b}"`:`「${b}」`}).join(v.value==="en-US"?", ":"、");return u("projectManager.duplicateDirectory",{labels:t,count:re.value.length})}),be=j(()=>h.value!=="edit"||F.value?"":u("projectManager.cwdReadonly")),de=j(()=>h.value!=="edit"||!_.value||Q.value?"":u("projectManager.engineReadonly")),we=j(()=>h.value==="create"?y.value?u("projectManager.creatingProject"):u("projectManager.createProject"):A.value?u("projectManager.savingChanges"):u("projectManager.saveChanges")),Me=j(()=>{var t;return h.value==="create"?u("projectManager.newProject"):((t=_.value)==null?void 0:t.title)||u("projectManager.untitledProject")});function te(t=""){const o=Date.parse(String(t||""));return Number.isFinite(o)?o:0}function ce(t=""){const o=String(t||"").trim();if(!o)return"";const b=/^[a-z]:[\\/]/i.test(o)||o.includes("\\");let g=o.replace(/\\/g,"/");return g.length>1&&!/^[a-z]:\/$/i.test(g)&&(g=g.replace(/\/+$/,"")),b?g.toLowerCase():g}function B(t){var o;return!!((o=d.sessions.find(b=>b.id===t))!=null&&o.running)}function W(t){return!!t&&t===d.selectedSessionId}function K(t=[]){return[...t].sort((o,b)=>{const g=Number(B(b.id))-Number(B(o.id));if(g)return g;const G=Number(W(b.id))-Number(W(o.id));if(G)return G;const z=te(b.updatedAt)-te(o.updatedAt);return z||et(String(o.title||o.cwd||o.id),String(b.title||b.cwd||b.id))})}function ne(t){return B(t)?u("projectManager.running"):u("projectManager.idle")}function ue(t){return B(t)?"theme-status-warning":"theme-status-success"}function se(t){return t!=null&&t.started?u("projectManager.threadBound"):u("projectManager.notStarted")}function pe(t){return t!=null&&t.started?"theme-status-success":"theme-status-neutral"}function me(t=""){if(!t)return u("projectManager.unknown");const o=new Date(t);return Number.isNaN(o.getTime())?t:Ze(o.toISOString(),{year:"numeric",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Se(t){l.title=String((t==null?void 0:t.title)||""),l.engine=Le(t==null?void 0:t.engine),l.cwd=String((t==null?void 0:t.cwd)||"")}function ae(){h.value="create",w.value="",x.value="",l.title="",l.engine="codex",l.cwd=""}function U(t){const o=d.sessions.find(b=>b.id===t);o&&(h.value="edit",w.value=o.id,x.value="",Se(o))}function fe(){var t;return d.selectedSessionId&&d.sessions.some(o=>o.id===d.selectedSessionId)?d.selectedSessionId:((t=Z.value[0])==null?void 0:t.id)||""}function ke(t="basic"){V.value="detail",D.value=t}function J(){V.value="list",D.value="basic"}function n(){ae(),E.value&&ke("basic")}function c(t){R.value||(U(t),E.value&&ke("basic"))}function s(t){l.cwd=String(t||"").trim()}function m(t){l.title=String(t||"")}function N(t){l.engine=Le(t)}function H(t){l.cwd=String(t||"")}function _e(){x.value="",L.value=!1,D.value="basic",V.value=E.value?"list":"detail";const t=fe();if(t){U(t);return}ae()}function q(t){!d.open||R.value||t.key==="Escape"&&S("close")}async function Y(){if(!(R.value||typeof d.onRefresh!="function")){x.value="";try{await Promise.all([d.onRefresh(),De()])}catch(t){x.value=t.message}}}async function De(){try{O.value=await gt()}catch{O.value=Re()}}async function Ee(){if(!R.value){x.value="";try{const t=Ve();if(!t)return;await We(t)}catch(t){x.value=t.message}}}function Ve(){if(h.value==="create"){const o=String(l.cwd||"").trim();return o?{type:"create",cwd:o,payload:{title:l.title,engine:l.engine,cwd:o}}:(x.value=u("projectManager.directoryRequired"),null)}if(!_.value)return x.value=u("projectManager.projectMissing"),null;const t={title:l.title,engine:l.engine};return F.value&&(t.cwd=l.cwd),{type:"update",sessionId:_.value.id,payload:t}}async function We(t){var o,b;if(t.type==="create"){y.value=!0;try{const g=await((o=d.onCreate)==null?void 0:o.call(d,t.payload));g!=null&&g.id&&(U(g.id),S("select-session",g.id),await tt(),S("project-created",g),S("close"));return}finally{y.value=!1}}A.value=!0;try{const g=await((b=d.onUpdate)==null?void 0:b.call(d,t.sessionId,t.payload));g!=null&&g.id&&U(g.id)}finally{A.value=!1}}async function Ke(){var o,b;if(!_.value||I.value)return;const t=_.value.id;x.value="",I.value=!0;try{const g=await((o=d.onDelete)==null?void 0:o.call(d,t));L.value=!1;const G=d.sessions.filter(Ge=>Ge.id!==t),z=(g==null?void 0:g.selectedSessionId)||((b=K(G)[0])==null?void 0:b.id)||"";S("select-session",z),z?(U(z),E.value&&J()):(ae(),E.value&&J())}catch(g){x.value=g.message}finally{I.value=!1}}return he(()=>d.open,t=>{if(document.body.classList.toggle("overflow-hidden",t),t){window.addEventListener("keydown",q),_e(),typeof d.onRefresh=="function"?Y().catch(()=>{}):De().catch(()=>{});return}window.removeEventListener("keydown",q),C.value=!1,L.value=!1,x.value=""},{immediate:!0}),he(E,t=>{t||(V.value="detail")},{immediate:!0}),he(()=>d.sessions,()=>{if(!d.open)return;if(h.value==="create"){if(!!(String(l.title||"").trim()||String(l.cwd||"").trim()))return;const b=fe();b&&U(b);return}if(_.value){Se(_.value);return}const t=fe();if(t){U(t);return}ae()}),Oe(()=>{document.body.classList.remove("overflow-hidden"),window.removeEventListener("keydown",q)}),(t,o)=>{var b;return p(),ge(Ue,{to:"body"},[i.open?(p(),f("div",{key:0,class:"theme-modal-backdrop fixed inset-0 z-50 flex items-end justify-center px-0 py-0 sm:items-center sm:px-4 sm:py-6",onClick:o[10]||(o[10]=Te(g=>!R.value&&S("close"),["self"]))},[e("section",as,[k(ct,{open:L.value,title:a(u)("projectManager.confirmDeleteTitle"),description:_.value?a(u)("projectManager.confirmDeleteDescription",{title:_.value.title||a(u)("projectManager.untitledProject")}):"","confirm-text":a(u)("projectManager.confirmDelete"),"cancel-text":a(u)("projectManager.keep"),loading:I.value,danger:"",onCancel:o[0]||(o[0]=g=>L.value=!1),onConfirm:Ke},null,8,["open","title","description","confirm-text","cancel-text","loading"]),k(nn,{open:C.value,"initial-path":l.cwd,suggestions:oe.value,onClose:o[1]||(o[1]=g=>C.value=!1),onSelect:s},null,8,["open","initial-path","suggestions"]),e("div",is,[e("div",null,[e("div",ls,[k(a(ut),{class:"h-4 w-4"}),e("span",null,r(a(u)("projectManager.managingTitle")),1)])]),e("div",os,[e("button",{type:"button",class:"theme-icon-button h-9 w-9",disabled:R.value,onClick:o[2]||(o[2]=g=>S("close"))},[k(a(qe),{class:"h-4 w-4"})],8,rs)])]),a(E)?(p(),f("div",ks,[V.value==="list"?(p(),f("div",_s,[e("div",$s,[k(ze,{mobile:"",busy:R.value,"editing-session-id":w.value,"format-updated-at":me,"get-runtime-status-class":ue,"get-runtime-status-label":ne,"get-thread-status-class":pe,"get-thread-status-label":se,"has-sessions":ie.value,"is-current-session":W,"is-session-running":B,mode:h.value,sessions:Z.value,onCreate:n,onSelect:c},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])])])):(p(),f("div",Cs,[e("div",js,[e("button",{type:"button",class:"tool-button inline-flex items-center gap-1.5 px-3 py-2 text-xs",disabled:R.value,onClick:J},[k(a(ft),{class:"h-4 w-4"}),e("span",null,r(a(u)("projectManager.projectList")),1)],8,Ms),e("div",Ps,[e("div",Ts,r(Me.value),1),h.value==="edit"&&((b=_.value)!=null&&b.cwd)?(p(),f("p",Ls,r(_.value.cwd),1)):M("",!0)])]),e("div",Rs,[e("div",Ds,[e("button",{type:"button",class:T(["tool-button px-3 py-2 text-sm",D.value==="basic"?"tool-button-accent-subtle":""]),onClick:o[6]||(o[6]=g=>D.value="basic")},r(a(u)("projectManager.basicInfo")),3),e("button",{type:"button",class:T(["tool-button px-3 py-2 text-sm",D.value==="status"?"tool-button-accent-subtle":""]),disabled:h.value==="create",onClick:o[7]||(o[7]=g=>D.value="status")},r(a(u)("projectManager.status")),11,Es)])]),e("div",Fs,[D.value==="basic"?(p(),f("div",Is,[k(Ne,{mobile:"",busy:R.value,"can-edit-engine":h.value!=="edit"||Q.value,"can-edit-cwd":h.value!=="edit"||F.value,cwd:l.cwd,"cwd-readonly-message":be.value,"duplicate-cwd-message":X.value,engine:l.engine,"engine-options":ee.value,"engine-readonly-message":de.value,title:l.title,"workspace-suggestions":oe.value,onOpenDirectoryPicker:o[8]||(o[8]=g=>C.value=!0),"onUpdate:cwd":H,"onUpdate:engine":N,"onUpdate:title":m},null,8,["busy","can-edit-engine","can-edit-cwd","cwd","cwd-readonly-message","duplicate-cwd-message","engine","engine-options","engine-readonly-message","title","workspace-suggestions"]),x.value?(p(),f("p",Bs,[k(a(Ae),{class:"h-4 w-4"}),e("span",null,r(x.value),1)])):M("",!0),e("div",As,[e("button",{type:"button",class:"tool-button tool-button-primary w-full px-3 py-2 text-sm",disabled:R.value,onClick:Ee},r(we.value),9,Ns),h.value==="edit"&&_.value?(p(),f("button",{key:0,type:"button",class:"tool-button tool-button-danger-subtle w-full px-3 py-2 text-sm",disabled:R.value||le.value,onClick:o[9]||(o[9]=g=>L.value=!0)},r(I.value?a(u)("projectManager.deletingProject"):a(u)("projectManager.deleteProject")),9,zs)):M("",!0)])])):(p(),ge(ss,{key:1,"active-session":_.value,"format-updated-at":me,"get-runtime-status-class":ue,"get-runtime-status-label":ne,"get-thread-status-class":pe,"get-thread-status-label":se,"is-current-session":W,"is-session-running":B},null,8,["active-session"]))])]))])):(p(),f("div",ds,[e("aside",cs,[k(ze,{busy:R.value,"editing-session-id":w.value,"format-updated-at":me,"get-runtime-status-class":ue,"get-runtime-status-label":ne,"get-thread-status-class":pe,"get-thread-status-label":se,"has-sessions":ie.value,"is-current-session":W,"is-session-running":B,mode:h.value,sessions:Z.value,onCreate:n,onSelect:c},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])]),e("div",us,[e("div",ps,[e("div",null,[e("div",ms,[k(a(pt),{class:"h-4 w-4"}),e("span",null,r(h.value==="create"?a(u)("projectManager.createTitle"):a(u)("projectManager.editTitle")),1)])])]),e("div",fs,[k(Ne,{busy:R.value,"can-edit-engine":h.value!=="edit"||Q.value,"can-edit-cwd":h.value!=="edit"||F.value,cwd:l.cwd,"cwd-readonly-message":be.value,"duplicate-cwd-message":X.value,engine:l.engine,"engine-options":ee.value,"engine-readonly-message":de.value,title:l.title,"workspace-suggestions":oe.value,onOpenDirectoryPicker:o[3]||(o[3]=g=>C.value=!0),"onUpdate:cwd":H,"onUpdate:engine":N,"onUpdate:title":m},null,8,["busy","can-edit-engine","can-edit-cwd","cwd","cwd-readonly-message","duplicate-cwd-message","engine","engine-options","engine-readonly-message","title","workspace-suggestions"])]),x.value?(p(),f("p",vs,[k(a(Ae),{class:"h-4 w-4"}),e("span",null,r(x.value),1)])):M("",!0),e("div",hs,[e("div",gs,[h.value==="edit"&&_.value?(p(),f("button",{key:0,type:"button",class:"tool-button tool-button-danger-subtle inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:R.value||le.value,onClick:o[4]||(o[4]=g=>L.value=!0)},[k(a(mt),{class:"h-4 w-4"}),e("span",null,r(I.value?a(u)("projectManager.deletingProject"):a(u)("projectManager.deleteProject")),1)],8,xs)):M("",!0)]),e("div",ys,[e("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:R.value,onClick:o[5]||(o[5]=g=>S("close"))},r(a(u)("projectManager.close")),9,bs),h.value==="create"&&ie.value?(p(),f("button",{key:0,type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:R.value,onClick:_e},r(a(u)("projectManager.backToList")),9,ws)):M("",!0),e("button",{type:"button",class:"tool-button tool-button-primary w-full px-3 py-2 text-xs sm:w-auto",disabled:R.value,onClick:Ee},r(we.value),9,Ss)])])])]))])])):M("",!0)])}}};export{qs as default};
1
+ import{w as he,o as Oe,a as p,c as ge,b as f,d as e,e as k,u as a,t as r,y as Qe,z as Xe,n as T,F as xe,r as $e,f as M,q as Je,g as Te,T as Ue,s as $,j as ye,i as j,B as Fe,I as He,C as Ye,D as Ze,R as et,v as tt}from"./index-BcbMELCK.js";import{A as nt,n as Le,k as Ce,r as st,f as ve,X as qe,S as Ie,L as Pe,m as at,d as it,s as lt,o as Be,_ as ot,P as rt,b as dt,p as ct,B as ut,q as pt,e as Ae,T as mt,t as ft}from"./WorkbenchView-CC7DNNB_.js";import{I as vt}from"./info-Db3PDen4.js";function ht(i=[]){return(Array.isArray(i)&&i.length?i:nt).filter(d=>d&&typeof d=="object").map(d=>{const S=Le(d.value);return{...d,value:S,label:String(d.label||Ce(S)).trim()||Ce(S),enabled:d.enabled!==!1,available:d.available!==!1}})}function Re(i=[]){return ht(i).filter(P=>P.enabled&&P.available)}async function gt(){const i=await st("/api/meta",{cache:"no-store"});return Re(i==null?void 0:i.agentEngineOptions)}const xt={class:"panel flex h-full w-full max-w-4xl flex-col overflow-hidden sm:h-auto sm:max-h-[86vh]"},yt={class:"theme-divider flex items-start justify-between gap-3 border-b px-4 py-3 sm:px-5 sm:py-4"},bt={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},wt={class:"theme-muted-text mt-1 text-xs leading-5"},St=["disabled"],kt={class:"flex min-h-0 flex-1 flex-col overflow-hidden px-4 py-4 sm:px-5"},_t={class:"theme-divider mt-4 rounded-sm border border-dashed px-3 py-2"},$t={class:"flex items-start gap-2 text-xs leading-5"},Ct={class:"theme-muted-text shrink-0"},jt={class:"min-w-0 break-all font-mono text-[var(--theme-textPrimary)]"},Mt={class:"theme-muted-text mt-4 block text-xs"},Pt={class:"theme-input-shell mt-1 flex h-10 items-center gap-2 rounded-sm border px-3 transition focus-within:ring-2"},Tt=["placeholder"],Lt={class:"mt-4 flex items-center gap-1.5"},Rt={class:"theme-content-panel mt-3 min-h-0 flex-1 overflow-y-auto p-2"},Dt={key:0,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},Et={key:1,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},Ft={key:2,class:"theme-empty-state flex items-center justify-center gap-2 px-3 py-8 text-sm"},It={key:3,class:"theme-empty-state flex items-center justify-center gap-2 px-3 py-8 text-sm"},Bt={key:4,class:"theme-empty-state px-3 py-8 text-sm"},At={key:5,class:"theme-empty-state px-3 py-8 text-sm"},Nt={key:6,class:"theme-empty-state px-3 py-8 text-sm"},zt={key:7,class:"space-y-1"},Ot=["onClick"],Ut={class:"min-w-0 flex-1"},Ht=["innerHTML"],qt=["innerHTML"],Vt={key:0,class:"theme-muted-text px-1 pt-2 text-xs"},Wt={key:8,class:"space-y-1"},Kt={class:"flex items-start gap-1.5"},Gt=["onClick"],Qt=["onClick"],Xt={class:"min-w-0 flex-1"},Jt={key:0,class:"theme-muted-text truncate font-mono text-[10px]"},Yt={class:"theme-divider flex flex-col-reverse gap-2 border-t border-dashed px-4 py-4 sm:flex-row sm:items-center sm:justify-end sm:px-5"},Zt={class:"flex flex-col-reverse gap-2 sm:flex-row sm:items-center"},en=["disabled"],tn=["disabled"],nn={__name:"CodexDirectoryPickerDialog",props:{open:{type:Boolean,default:!1},initialPath:{type:String,default:""}},emits:["close","select"],setup(i,{emit:P}){const d=i,S=P,{t:v}=ye(),u=$(""),h=$(null),w=$(!1),l=$(""),x=$(!1),y=$(""),A=$([]),I=$(!1),L=$(""),C=$("tree"),E=$(""),V=$("");let D=null,O=0;const Z=j(()=>ce(h.value?[h.value]:[])),_=j(()=>C.value==="search"&&!L.value.trim()),ie=j(()=>C.value==="search"&&!!L.value.trim()&&!x.value&&!y.value&&!A.value.length),je=j(()=>C.value==="tree"&&!w.value&&!l.value&&!Z.value.length);function le(n=""){const c=String(n||"").trim();return/^[a-z]:[\\/]/i.test(c)||c.includes("\\")}function F(n=""){const c=String(n||"").trim();if(!c)return"";const s=le(c);let m=c.replace(/\\/g,"/");return m.length>1&&!/^[a-z]:\/?$/i.test(m)&&m!=="/"&&(m=m.replace(/\/+$/,"")),s?m.toLowerCase():m}function Q(n="",c=""){const s=F(n),m=F(c);return!s||!m?!1:s===m||s.startsWith(`${m}/`)}function R(n="",c=""){const s=String(n||"").trim(),m=String(c||"").trim();return s?m?le(s)?/^[a-z]:\\?$/i.test(s)?`${s.replace(/[\\/]+$/,"")}\\${m}`:`${s.replace(/[\\/]+$/,"")}\\${m}`:s==="/"?`/${m}`:`${s.replace(/\/+$/,"")}/${m}`:s:m}function oe(n="",c=""){const s=F(n),m=F(c);if(!s||!m||!Q(m,s))return[];const N=m===s?"":m.slice(s.length).replace(/^\//,"");return N?N.split("/").filter(Boolean):[]}function ee(n){return(n==null?void 0:n.name)||(n==null?void 0:n.path)||v("directoryPicker.unnamedDirectory")}function re(n=""){const c=String(n||"").trim();return c?c.split(/[\\/]/).filter(Boolean).at(-1)||c:"Home"}function X(n=""){return String(n||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function be(n="",c=""){const s=String(n||""),m=String(c||"").trim().toLowerCase();if(!s||!m)return null;const N=s.toLowerCase(),H=N.indexOf(m);if(H>=0)return{start:H,end:H+m.length};const _e=m.split(/[\\/\s_.-]+/).filter(Boolean).sort((q,Y)=>Y.length-q.length);for(const q of _e){if(q.length<2)continue;const Y=N.indexOf(q);if(Y>=0)return{start:Y,end:Y+q.length}}return null}function de(n="",c=""){const s=String(n||""),m=be(s,c);return m?`${X(s.slice(0,m.start))}<mark class="theme-search-highlight">${X(s.slice(m.start,m.end))}</mark>${X(s.slice(m.end))}`:X(s)}function we(n){return de(ee(n),L.value)}function Me(n){return de((n==null?void 0:n.path)||"",L.value)}function te(n,c=0){return{...n,depth:c,expanded:!1,loaded:!1,loading:!1,children:[]}}function ce(n=[],c=[]){return n.forEach(s=>{c.push(s),s.expanded&&s.children.length&&ce(s.children,c)}),c}function B(){h.value&&(h.value={...h.value})}function W(n,c=h.value?[h.value]:[]){const s=F(n);if(!s)return null;for(const m of c){if(F(m.path)===s)return m;if(m.children.length){const N=W(n,m.children);if(N)return N}}return null}function K(n){E.value=String((n==null?void 0:n.path)||"").trim(),V.value=ee(n)}async function ne(n,c={}){if(!(!n||n.loading)&&!(n.loaded&&!c.force)){n.loading=!0,l.value="",B();try{const s=await Be({path:n.path,limit:240});n.children=(s.items||[]).map(m=>te(m,n.depth+1)),n.loaded=!0}catch(s){l.value=s.message||v("directoryPicker.loadFailed")}finally{n.loading=!1,B()}}}async function ue(){w.value=!0,l.value="";try{const n=await Be({limit:240});u.value=String(n.path||""),h.value=te({name:re(n.path||""),path:String(n.path||""),type:"directory",hasChildren:!0,isHomeRoot:!0},0),h.value.children=(n.items||[]).map(c=>te(c,1)),h.value.loaded=!0,h.value.expanded=!0,K(h.value)}catch(n){l.value=n.message||v("directoryPicker.treeLoadFailed"),h.value=null,u.value=""}finally{w.value=!1}}async function se(n=""){const c=String(n||"").trim();if(!c||!u.value||!Q(c,u.value))return;let s=h.value;if(!s)return;K(s);const m=oe(u.value,c);for(const N of m){await ne(s),s.expanded=!0,B();const H=W(R(s.path,N),s.children);if(!H)break;s=H,K(s)}}async function pe(){L.value="",C.value="tree",A.value=[],y.value="",I.value=!1,E.value="",V.value="",await ue();const n=String(d.initialPath||"").trim();n&&Q(n,u.value)&&await se(n)}async function me(n){if(n!=null&&n.path&&(K(n),!!n.hasChildren)){if(!n.loaded){n.expanded=!0,B(),await ne(n);return}n.expanded=!n.expanded,B()}}function Se(n){n!=null&&n.path&&(K(n),C.value="tree")}async function ae(){const n=String(L.value||"").trim();O+=1;const c=O;if(!d.open||!n||!u.value){x.value=!1,y.value="",A.value=[],I.value=!1;return}x.value=!0,y.value="";try{const s=await lt(n,{path:u.value,limit:80});if(c!==O)return;A.value=Array.isArray(s.items)?s.items:[],I.value=!!s.truncated}catch(s){if(c!==O)return;y.value=s.message||v("directoryPicker.searchFailed"),A.value=[],I.value=!1}finally{c===O&&(x.value=!1)}}function U(){if(D&&(window.clearTimeout(D),D=null),!String(L.value||"").trim()){x.value=!1,y.value="",A.value=[],I.value=!1;return}x.value=!0,y.value="",D=window.setTimeout(()=>{ae()},120)}async function fe(n){n!=null&&n.path&&(C.value="tree",await se(n.path))}function ke(){E.value&&(S("select",E.value),S("close"))}function J(n){d.open&&n.key==="Escape"&&S("close")}return he(L,()=>{C.value=L.value.trim()?"search":"tree",U()}),he(()=>d.open,n=>{if(document.body.classList.toggle("overflow-hidden",n),n){window.addEventListener("keydown",J),pe().catch(()=>{});return}window.removeEventListener("keydown",J),D&&(window.clearTimeout(D),D=null)}),Oe(()=>{document.body.classList.remove("overflow-hidden"),window.removeEventListener("keydown",J),D&&window.clearTimeout(D)}),(n,c)=>(p(),ge(Ue,{to:"body"},[i.open?(p(),f("div",{key:0,class:"theme-modal-backdrop fixed inset-0 z-[60] flex items-end justify-center px-0 py-0 sm:items-center sm:px-4 sm:py-6",onClick:c[5]||(c[5]=Te(s=>!(w.value||x.value)&&S("close"),["self"]))},[e("section",xt,[e("div",yt,[e("div",null,[e("div",bt,[k(a(ve),{class:"h-4 w-4"}),e("span",null,r(a(v)("directoryPicker.title")),1)]),e("p",wt,r(a(v)("directoryPicker.intro")),1)]),e("button",{type:"button",class:"theme-icon-button h-9 w-9",disabled:w.value||x.value,onClick:c[0]||(c[0]=s=>S("close"))},[k(a(qe),{class:"h-4 w-4"})],8,St)]),e("div",kt,[e("div",_t,[e("div",$t,[e("span",Ct,r(a(v)("directoryPicker.currentSelection")),1),e("span",jt,r(E.value||a(v)("directoryPicker.selectionPlaceholder")),1)])]),e("label",Mt,[e("span",null,r(a(v)("directoryPicker.searchLabel")),1),e("div",Pt,[k(a(Ie),{class:"h-4 w-4 shrink-0 text-[var(--theme-textMuted)]"}),Qe(e("input",{"onUpdate:modelValue":c[1]||(c[1]=s=>L.value=s),type:"text",placeholder:a(v)("directoryPicker.searchPlaceholder"),class:"min-w-0 flex-1 border-0 bg-transparent px-0 text-sm text-[var(--theme-textPrimary)] outline-none placeholder:text-[var(--theme-textMuted)]"},null,8,Tt),[[Xe,L.value]])])]),e("div",Lt,[e("button",{type:"button",class:T(["inline-flex h-8 items-center gap-1 rounded-sm border px-2 text-[11px] transition",C.value==="search"?"tool-button-accent-subtle":"theme-filter-idle border-dashed"]),onClick:c[2]||(c[2]=s=>C.value="search")},[k(a(Ie),{class:"h-3.5 w-3.5"}),e("span",null,r(a(v)("directoryPicker.searchTab")),1)],2),e("button",{type:"button",class:T(["inline-flex h-8 items-center gap-1 rounded-sm border px-2 text-[11px] transition",C.value==="tree"?"tool-button-accent-subtle":"theme-filter-idle border-dashed"]),onClick:c[3]||(c[3]=s=>C.value="tree")},[k(a(ve),{class:"h-3.5 w-3.5"}),e("span",null,r(a(v)("directoryPicker.treeTab")),1)],2)]),e("div",Rt,[C.value==="search"&&y.value?(p(),f("div",Dt,r(y.value),1)):C.value==="tree"&&l.value?(p(),f("div",Et,r(l.value),1)):C.value==="search"&&x.value?(p(),f("div",Ft,[k(a(Pe),{class:"h-4 w-4 animate-spin"}),e("span",null,r(a(v)("directoryPicker.searching")),1)])):C.value==="tree"&&w.value?(p(),f("div",It,[k(a(Pe),{class:"h-4 w-4 animate-spin"}),e("span",null,r(a(v)("directoryPicker.treeLoading")),1)])):_.value?(p(),f("div",Bt,r(a(v)("directoryPicker.searchPrompt")),1)):ie.value?(p(),f("div",At,r(a(v)("directoryPicker.noSearchResults")),1)):je.value?(p(),f("div",Nt,r(a(v)("directoryPicker.emptyTree")),1)):C.value==="search"?(p(),f("div",zt,[(p(!0),f(xe,null,$e(A.value,s=>(p(),f("button",{key:s.path,type:"button",class:T(["flex w-full items-start gap-2 rounded-sm border border-transparent px-2.5 py-1.5 text-left transition",F(E.value)===F(s.path)?"theme-list-item-active":"theme-list-item-hover"]),onClick:m=>fe(s)},[k(a(ve),{class:"theme-muted-text mt-0.5 h-4 w-4 shrink-0"}),e("div",Ut,[e("div",null,[e("span",{class:"truncate text-[13px] text-[var(--theme-textPrimary)]",innerHTML:we(s)},null,8,Ht)]),e("div",{class:"theme-muted-text truncate font-mono text-[10px]",innerHTML:Me(s)},null,8,qt)])],10,Ot))),128)),I.value?(p(),f("p",Vt,r(a(v)("directoryPicker.truncatedHint")),1)):M("",!0)])):(p(),f("div",Wt,[(p(!0),f(xe,null,$e(Z.value,s=>(p(),f("div",{key:s.path,class:T(["rounded-sm border border-transparent px-1.5 py-1 transition",F(E.value)===F(s.path)?"theme-list-item-active":s.expanded?"theme-list-item-expanded":"theme-list-item-hover"]),style:Je({paddingLeft:`${s.depth*16+6}px`})},[e("div",Kt,[e("button",{type:"button",class:T(["theme-icon-button h-5 w-5 shrink-0",s.hasChildren?"":"invisible pointer-events-none"]),onClick:Te(m=>me(s),["stop"])},[s.loading?(p(),ge(a(Pe),{key:0,class:"h-3.5 w-3.5 animate-spin"})):(p(),ge(a(at),{key:1,class:T(["h-3.5 w-3.5 transition",s.expanded?"rotate-90 text-[var(--theme-textPrimary)]":""])},null,8,["class"]))],10,Gt),e("button",{type:"button",class:"flex min-w-0 flex-1 items-start gap-1.5 rounded-sm px-0.5 py-0.5 text-left",onClick:m=>Se(s)},[k(a(ve),{class:T(["h-4 w-4 shrink-0",F(E.value)===F(s.path)?"text-[var(--theme-textPrimary)]":"text-[var(--theme-textMuted)]"])},null,8,["class"]),e("div",Xt,[e("div",{class:T(["truncate text-[13px]",s.isHomeRoot?"font-medium text-[var(--theme-textSecondary)]":"font-medium text-[var(--theme-textPrimary)]"])},r(ee(s)),3),s.isHomeRoot?(p(),f("div",Jt,r(s.path),1)):M("",!0)])],8,Qt)])],6))),128))]))])]),e("div",Yt,[e("div",Zt,[e("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:w.value||x.value,onClick:c[4]||(c[4]=s=>S("close"))},r(a(v)("directoryPicker.cancel")),9,en),e("button",{type:"button",class:"tool-button tool-button-primary inline-flex w-full items-center justify-center gap-2 px-3 py-2 text-xs sm:w-auto",disabled:w.value||x.value||!E.value,onClick:ke},[k(a(it),{class:"h-4 w-4"}),e("span",null,r(a(v)("directoryPicker.useCurrentDirectory")),1)],8,tn)])])])])):M("",!0)]))}},sn={class:"grid gap-4"},an={class:"theme-muted-text block text-xs"},ln=["value","disabled"],on={class:"theme-muted-text block text-xs"},rn={class:"mt-1 flex gap-2"},dn=["value","disabled"],cn=["disabled"],un={id:"codex-manager-workspace-suggestions"},pn=["value"],mn={key:0,class:"mt-2 text-[11px] leading-5 text-[var(--theme-warningText)]"},fn={key:1,class:"theme-muted-text mt-2 text-[11px] leading-5"},vn={class:"theme-muted-text block text-xs"},hn={class:"mt-1"},gn={class:"flex items-center gap-2 text-sm"},xn={key:0,class:"theme-muted-text rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]"},yn=["disabled","onClick"],bn={class:"flex items-center justify-between gap-3"},wn={class:"min-w-0 flex-1 truncate"},Sn={key:0,class:"theme-muted-text rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]"},kn={key:0,class:"theme-muted-text mt-2 text-[11px] leading-5"},Ne={__name:"CodexSessionManagerForm",props:{busy:{type:Boolean,default:!1},canEditEngine:{type:Boolean,default:!0},canEditCwd:{type:Boolean,default:!0},cwd:{type:String,default:""},cwdReadonlyMessage:{type:String,default:""},duplicateCwdMessage:{type:String,default:""},engine:{type:String,default:"codex"},engineOptions:{type:Array,default:()=>[]},engineReadonlyMessage:{type:String,default:""},mobile:{type:Boolean,default:!1},title:{type:String,default:""},workspaceSuggestions:{type:Array,default:()=>[]}},emits:["open-directory-picker","update:cwd","update:engine","update:title"],setup(i,{emit:P}){const d=i,S=P,{t:v}=ye(),u=j(()=>{const h=String(d.engine||"").trim();return d.engineOptions.find(w=>String((w==null?void 0:w.value)||"").trim()===h)||null});return(h,w)=>(p(),f("div",sn,[e("label",an,[e("span",null,r(a(v)("projectManager.projectTitleOptional")),1),e("input",{value:i.title,type:"text",maxlength:"140",placeholder:"",class:"tool-input mt-1",disabled:i.busy,onInput:w[0]||(w[0]=l=>S("update:title",l.target.value))},null,40,ln)]),e("label",on,[e("span",null,r(a(v)("projectManager.workingDirectoryField")),1),e("div",rn,[e("input",{value:i.cwd,type:"text",list:"codex-manager-workspace-suggestions",placeholder:"",class:T(["tool-input min-w-0 flex-1 disabled:cursor-not-allowed disabled:opacity-80",i.duplicateCwdMessage?"border-[var(--theme-warning)]":""]),disabled:i.busy||!i.canEditCwd,onInput:w[1]||(w[1]=l=>S("update:cwd",l.target.value))},null,42,dn),e("button",{type:"button",class:"tool-button inline-flex shrink-0 items-center gap-2 px-3 py-2 text-xs",disabled:i.busy||!i.canEditCwd,onClick:w[2]||(w[2]=l=>S("open-directory-picker"))},[k(a(ve),{class:"h-4 w-4"}),e("span",null,r(i.mobile?a(v)("projectManager.choose"):a(v)("projectManager.chooseDirectory")),1)],8,cn)]),e("datalist",un,[(p(!0),f(xe,null,$e(i.workspaceSuggestions,l=>(p(),f("option",{key:l,value:l},null,8,pn))),128))]),i.duplicateCwdMessage?(p(),f("p",mn,r(i.duplicateCwdMessage),1)):i.cwdReadonlyMessage?(p(),f("p",fn,r(i.cwdReadonlyMessage),1)):M("",!0)]),e("label",vn,[e("span",null,r(a(v)("projectManager.engineField")),1),e("div",hn,[k(ot,{"model-value":i.engine,options:i.engineOptions,disabled:i.busy||!i.canEditEngine,placeholder:a(v)("projectManager.selectEngine"),"empty-text":a(v)("projectManager.noEngines"),"get-option-value":l=>(l==null?void 0:l.value)||"","onUpdate:modelValue":w[3]||(w[3]=l=>S("update:engine",l))},{trigger:Fe(({disabled:l})=>{var x;return[e("div",gn,[e("span",{class:T(["min-w-0 flex-1 truncate",l?"theme-muted-text":"text-[var(--theme-textPrimary)]"])},r(((x=u.value)==null?void 0:x.label)||a(v)("projectManager.selectEngine")),3),u.value&&u.value.enabled===!1?(p(),f("span",xn,r(a(v)("projectManager.comingSoon")),1)):M("",!0)])]}),option:Fe(({option:l,selected:x,select:y})=>[e("button",{type:"button",class:T(["w-full rounded-sm border border-dashed px-3 py-2 text-left text-sm transition",x?"theme-filter-active":"theme-filter-idle"]),disabled:(l==null?void 0:l.enabled)===!1,onClick:y},[e("div",bn,[e("span",wn,r(l.label),1),(l==null?void 0:l.enabled)===!1?(p(),f("span",Sn,r(a(v)("projectManager.comingSoon")),1)):M("",!0)])],10,yn)]),_:1},8,["model-value","options","disabled","placeholder","empty-text","get-option-value"])]),i.engineReadonlyMessage?(p(),f("p",kn,r(i.engineReadonlyMessage),1)):M("",!0)])]))}},_n={class:"flex items-center justify-between gap-3"},$n={class:"theme-heading text-sm font-medium"},Cn={key:0,class:"theme-muted-text mt-1 text-xs"},jn=["disabled"],Mn=["onClick"],Pn={key:0,class:"theme-selection-indicator absolute inset-y-3 left-0 w-1 rounded-full"},Tn={class:"flex w-full flex-col gap-2 text-left"},Ln={class:"theme-heading min-w-0 text-sm font-medium"},Rn=["title"],Dn=["title"],En={class:"theme-muted-text flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] leading-5"},Fn={key:0,"aria-hidden":"true"},In={key:1},Bn={class:"flex flex-wrap items-center gap-2 pt-1"},An={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},ze={__name:"CodexSessionManagerList",props:{busy:{type:Boolean,default:!1},editingSessionId:{type:String,default:""},formatUpdatedAt:{type:Function,default:i=>i},getRuntimeStatusClass:{type:Function,default:()=>""},getRuntimeStatusLabel:{type:Function,default:()=>""},getThreadStatusClass:{type:Function,default:()=>""},getThreadStatusLabel:{type:Function,default:()=>""},hasSessions:{type:Boolean,default:!1},isCurrentSession:{type:Function,default:()=>!1},isSessionRunning:{type:Function,default:()=>!1},mode:{type:String,default:"edit"},mobile:{type:Boolean,default:!1},sessions:{type:Array,default:()=>[]}},emits:["create","select"],setup(i,{emit:P}){const d=i,S=P,{t:v}=ye();function u(l){return d.mode==="edit"&&d.editingSessionId===l.id?"theme-card-selected":d.isSessionRunning(l.id)?"theme-card-warning":"theme-card-idle-strong"}function h(l){return d.isCurrentSession(l.id)?v("projectManager.current"):v("projectManager.regular")}function w(l){return d.isCurrentSession(l.id)?"theme-status-info":"theme-status-neutral"}return(l,x)=>(p(),f(xe,null,[e("div",_n,[e("div",null,[e("div",$n,r(a(v)("projectManager.projectList")),1),i.hasSessions?M("",!0):(p(),f("p",Cn,r(a(v)("projectManager.noProjects")),1))]),e("button",{type:"button",class:"tool-button tool-button-primary inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:i.busy,onClick:x[0]||(x[0]=y=>S("create"))},[k(a(rt),{class:"h-4 w-4"}),e("span",null,r(a(v)("projectManager.create")),1)],8,jn)]),e("div",{class:T(["mt-4 space-y-2",i.mobile?"min-h-0 flex-1 overflow-y-auto":"max-h-52 overflow-y-auto pr-1 sm:max-h-64 lg:max-h-[calc(88vh-11rem)]"])},[(p(!0),f(xe,null,$e(i.sessions,y=>(p(),f("article",{key:y.id,class:T(["relative cursor-pointer rounded-sm border p-3 transition",u(y)]),onClick:A=>S("select",y.id)},[i.mode==="edit"&&i.editingSessionId===y.id?(p(),f("span",Pn)):M("",!0),e("div",Tn,[e("div",Ln,[e("span",{class:"block truncate",title:y.title||a(v)("projectManager.untitledProject")},r(y.title||a(v)("projectManager.untitledProject")),9,Rn)]),e("div",{class:"theme-muted-text break-all font-mono text-[11px] leading-5",title:y.cwd},r(y.cwd),9,Dn),e("div",En,[e("span",null,r(a(Ce)(y.engine)),1),i.mobile?M("",!0):(p(),f("span",Fn,"·")),i.mobile?M("",!0):(p(),f("span",In,r(i.formatUpdatedAt(y.updatedAt)),1))]),e("div",Bn,[e("span",{class:T(["inline-flex shrink-0 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",w(y)])},r(h(y)),3),e("span",{class:T(["inline-flex shrink-0 items-center gap-1 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",i.getRuntimeStatusClass(y.id)])},[i.isSessionRunning(y.id)?(p(),f("span",An)):M("",!0),He(" "+r(i.getRuntimeStatusLabel(y.id)),1)],2),e("span",{class:T(["inline-flex shrink-0 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",i.getThreadStatusClass(y)])},r(i.getThreadStatusLabel(y)),3)])])],10,Mn))),128))],2)],64))}},Nn={class:"space-y-3"},zn={class:"dashed-panel px-3 py-3"},On={class:"theme-muted-text text-[11px]"},Un={class:"mt-2 flex flex-wrap gap-2"},Hn={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},qn={key:0,class:"theme-status-info inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs"},Vn={class:"dashed-panel px-3 py-3"},Wn={class:"theme-muted-text text-[11px]"},Kn={class:"mt-2 text-sm text-[var(--theme-textPrimary)]"},Gn={class:"dashed-panel px-3 py-3"},Qn={class:"theme-muted-text text-[11px]"},Xn={class:"mt-2 break-all font-mono text-xs leading-6 text-[var(--theme-textPrimary)]"},Jn={class:"dashed-panel px-3 py-3"},Yn={class:"theme-muted-text text-[11px]"},Zn={class:"mt-2 text-sm text-[var(--theme-textPrimary)]"},es={class:"dashed-panel px-3 py-3"},ts={class:"theme-muted-text inline-flex items-center gap-2 text-[11px]"},ns={class:"mt-2 text-xs leading-6 text-[var(--theme-textSecondary)]"},ss={__name:"CodexSessionManagerStatus",props:{activeSession:{type:Object,default:null},formatUpdatedAt:{type:Function,default:i=>i},getRuntimeStatusClass:{type:Function,default:()=>""},getRuntimeStatusLabel:{type:Function,default:()=>""},getThreadStatusClass:{type:Function,default:()=>""},getThreadStatusLabel:{type:Function,default:()=>""},isCurrentSession:{type:Function,default:()=>!1},isSessionRunning:{type:Function,default:()=>!1}},setup(i){const{t:P}=ye();return(d,S)=>{var v,u,h,w,l,x,y;return p(),f("div",Nn,[e("div",zn,[e("div",On,r(a(P)("projectManager.runtimeStatus")),1),e("div",Un,[e("span",{class:T(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",i.getRuntimeStatusClass((v=i.activeSession)==null?void 0:v.id)])},[i.isSessionRunning((u=i.activeSession)==null?void 0:u.id)?(p(),f("span",Hn)):M("",!0),He(" "+r(i.getRuntimeStatusLabel((h=i.activeSession)==null?void 0:h.id)),1)],2),e("span",{class:T(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",i.getThreadStatusClass(i.activeSession)])},r(i.getThreadStatusLabel(i.activeSession)),3),(w=i.activeSession)!=null&&w.id&&i.isCurrentSession(i.activeSession.id)?(p(),f("span",qn,r(a(P)("projectManager.currentProject")),1)):M("",!0)])]),e("div",Vn,[e("div",Wn,r(a(P)("projectManager.engine")),1),e("div",Kn,r(a(Ce)((l=i.activeSession)==null?void 0:l.engine)),1)]),e("div",Gn,[e("div",Qn,r(a(P)("projectManager.workingDirectory")),1),e("div",Xn,r(((x=i.activeSession)==null?void 0:x.cwd)||a(P)("projectManager.notSet")),1)]),e("div",Jn,[e("div",Yn,r(a(P)("projectManager.updatedAt")),1),e("div",Zn,r(i.formatUpdatedAt((y=i.activeSession)==null?void 0:y.updatedAt)),1)]),e("div",es,[e("div",ts,[k(a(vt),{class:"h-3.5 w-3.5"}),e("span",null,r(a(P)("projectManager.note")),1)]),e("p",ns,r(a(P)("projectManager.noteDescription")),1)])])}}},as={class:"panel flex h-full w-full max-w-5xl flex-col overflow-hidden sm:h-auto sm:max-h-[88vh]"},is={class:"theme-divider flex flex-wrap items-start justify-between gap-3 border-b px-4 py-3 sm:px-5 sm:py-4"},ls={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},os={class:"flex items-center gap-2"},rs=["disabled"],ds={key:0,class:"grid min-h-0 flex-1 gap-0 lg:grid-cols-[minmax(0,300px)_minmax(0,1fr)]"},cs={class:"theme-divider theme-muted-panel border-b px-3 py-3 sm:px-4 sm:py-4 lg:border-b-0 lg:border-r"},us={class:"min-h-0 overflow-y-auto px-4 py-4 sm:px-5"},ps={class:"flex flex-wrap items-start justify-between gap-3"},ms={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},fs={class:"mt-5"},vs={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},hs={class:"theme-divider mt-6 flex flex-col gap-3 border-t border-dashed pt-4 sm:flex-row sm:items-center sm:justify-between"},gs={class:"flex flex-wrap items-center gap-2"},xs=["disabled"],ys={class:"flex flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:items-center"},bs=["disabled"],ws=["disabled"],Ss=["disabled"],ks={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},_s={key:0,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},$s={class:"min-h-0 flex-1 overflow-hidden px-3 py-3"},Cs={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},js={class:"theme-divider flex items-center gap-3 border-b px-4 py-3"},Ms=["disabled"],Ps={class:"min-w-0 flex-1"},Ts={class:"theme-heading truncate text-sm font-medium"},Ls={key:0,class:"theme-muted-text mt-1 truncate text-xs"},Rs={class:"theme-divider border-b px-4 py-3"},Ds={class:"grid grid-cols-2 gap-2"},Es=["disabled"],Fs={class:"min-h-0 flex-1 overflow-y-auto px-4 py-4"},Is={key:0},Bs={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},As={class:"theme-divider mt-6 flex flex-col gap-3 border-t border-dashed pt-4"},Ns=["disabled"],zs=["disabled"],qs={__name:"CodexSessionManagerDialog",props:{open:{type:Boolean,default:!1},sessions:{type:Array,default:()=>[]},workspaces:{type:Array,default:()=>[]},selectedSessionId:{type:String,default:""},selectionLocked:{type:Boolean,default:!1},selectionLockReason:{type:String,default:""},loading:{type:Boolean,default:!1},sending:{type:Boolean,default:!1},onRefresh:{type:Function,default:null},onCreate:{type:Function,default:null},onUpdate:{type:Function,default:null},onDelete:{type:Function,default:null}},emits:["close","project-created","select-session"],setup(i,{emit:P}){const d=i,S=P,{locale:v,t:u}=ye(),h=$("edit"),w=$(""),l=Ye({title:"",engine:"codex",cwd:""}),x=$(""),y=$(!1),A=$(!1),I=$(!1),L=$(!1),C=$(!1),{matches:E}=dt("(max-width: 767px)"),V=$("list"),D=$("basic"),O=$(Re()),Z=j(()=>K(d.sessions)),_=j(()=>d.sessions.find(t=>t.id===w.value)||null),ie=j(()=>d.sessions.length>0),je=j(()=>d.sessions.find(t=>t.id===d.selectedSessionId)||null),le=j(()=>!!(_.value&&B(_.value.id))),F=j(()=>{var t;return!((t=_.value)!=null&&t.started)}),Q=j(()=>{var t;return!((t=_.value)!=null&&t.started)}),R=j(()=>d.loading||y.value||A.value||I.value),oe=j(()=>{var b,g;const t=new Set,o=[];return[l.cwd,(b=_.value)==null?void 0:b.cwd,(g=je.value)==null?void 0:g.cwd,...d.workspaces,...d.sessions.map(G=>G.cwd)].forEach(G=>{const z=String(G||"").trim();!z||t.has(z)||(t.add(z),o.push(z))}),o.slice(0,12)}),ee=j(()=>O.value),re=j(()=>{const t=ce(l.cwd);return t?d.sessions.filter(o=>{var b;return o.id===((b=_.value)==null?void 0:b.id)?!1:ce(o.cwd)===t}):[]}),X=j(()=>{if(!re.value.length)return"";const t=re.value.slice(0,3).map(o=>{const b=o.title||u("projectManager.untitledProject");return v.value==="en-US"?`"${b}"`:`「${b}」`}).join(v.value==="en-US"?", ":"、");return u("projectManager.duplicateDirectory",{labels:t,count:re.value.length})}),be=j(()=>h.value!=="edit"||F.value?"":u("projectManager.cwdReadonly")),de=j(()=>h.value!=="edit"||!_.value||Q.value?"":u("projectManager.engineReadonly")),we=j(()=>h.value==="create"?y.value?u("projectManager.creatingProject"):u("projectManager.createProject"):A.value?u("projectManager.savingChanges"):u("projectManager.saveChanges")),Me=j(()=>{var t;return h.value==="create"?u("projectManager.newProject"):((t=_.value)==null?void 0:t.title)||u("projectManager.untitledProject")});function te(t=""){const o=Date.parse(String(t||""));return Number.isFinite(o)?o:0}function ce(t=""){const o=String(t||"").trim();if(!o)return"";const b=/^[a-z]:[\\/]/i.test(o)||o.includes("\\");let g=o.replace(/\\/g,"/");return g.length>1&&!/^[a-z]:\/$/i.test(g)&&(g=g.replace(/\/+$/,"")),b?g.toLowerCase():g}function B(t){var o;return!!((o=d.sessions.find(b=>b.id===t))!=null&&o.running)}function W(t){return!!t&&t===d.selectedSessionId}function K(t=[]){return[...t].sort((o,b)=>{const g=Number(B(b.id))-Number(B(o.id));if(g)return g;const G=Number(W(b.id))-Number(W(o.id));if(G)return G;const z=te(b.updatedAt)-te(o.updatedAt);return z||et(String(o.title||o.cwd||o.id),String(b.title||b.cwd||b.id))})}function ne(t){return B(t)?u("projectManager.running"):u("projectManager.idle")}function ue(t){return B(t)?"theme-status-warning":"theme-status-success"}function se(t){return t!=null&&t.started?u("projectManager.threadBound"):u("projectManager.notStarted")}function pe(t){return t!=null&&t.started?"theme-status-success":"theme-status-neutral"}function me(t=""){if(!t)return u("projectManager.unknown");const o=new Date(t);return Number.isNaN(o.getTime())?t:Ze(o.toISOString(),{year:"numeric",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"})}function Se(t){l.title=String((t==null?void 0:t.title)||""),l.engine=Le(t==null?void 0:t.engine),l.cwd=String((t==null?void 0:t.cwd)||"")}function ae(){h.value="create",w.value="",x.value="",l.title="",l.engine="codex",l.cwd=""}function U(t){const o=d.sessions.find(b=>b.id===t);o&&(h.value="edit",w.value=o.id,x.value="",Se(o))}function fe(){var t;return d.selectedSessionId&&d.sessions.some(o=>o.id===d.selectedSessionId)?d.selectedSessionId:((t=Z.value[0])==null?void 0:t.id)||""}function ke(t="basic"){V.value="detail",D.value=t}function J(){V.value="list",D.value="basic"}function n(){ae(),E.value&&ke("basic")}function c(t){R.value||(U(t),E.value&&ke("basic"))}function s(t){l.cwd=String(t||"").trim()}function m(t){l.title=String(t||"")}function N(t){l.engine=Le(t)}function H(t){l.cwd=String(t||"")}function _e(){x.value="",L.value=!1,D.value="basic",V.value=E.value?"list":"detail";const t=fe();if(t){U(t);return}ae()}function q(t){!d.open||R.value||t.key==="Escape"&&S("close")}async function Y(){if(!(R.value||typeof d.onRefresh!="function")){x.value="";try{await Promise.all([d.onRefresh(),De()])}catch(t){x.value=t.message}}}async function De(){try{O.value=await gt()}catch{O.value=Re()}}async function Ee(){if(!R.value){x.value="";try{const t=Ve();if(!t)return;await We(t)}catch(t){x.value=t.message}}}function Ve(){if(h.value==="create"){const o=String(l.cwd||"").trim();return o?{type:"create",cwd:o,payload:{title:l.title,engine:l.engine,cwd:o}}:(x.value=u("projectManager.directoryRequired"),null)}if(!_.value)return x.value=u("projectManager.projectMissing"),null;const t={title:l.title,engine:l.engine};return F.value&&(t.cwd=l.cwd),{type:"update",sessionId:_.value.id,payload:t}}async function We(t){var o,b;if(t.type==="create"){y.value=!0;try{const g=await((o=d.onCreate)==null?void 0:o.call(d,t.payload));g!=null&&g.id&&(U(g.id),S("select-session",g.id),await tt(),S("project-created",g),S("close"));return}finally{y.value=!1}}A.value=!0;try{const g=await((b=d.onUpdate)==null?void 0:b.call(d,t.sessionId,t.payload));g!=null&&g.id&&U(g.id)}finally{A.value=!1}}async function Ke(){var o,b;if(!_.value||I.value)return;const t=_.value.id;x.value="",I.value=!0;try{const g=await((o=d.onDelete)==null?void 0:o.call(d,t));L.value=!1;const G=d.sessions.filter(Ge=>Ge.id!==t),z=(g==null?void 0:g.selectedSessionId)||((b=K(G)[0])==null?void 0:b.id)||"";S("select-session",z),z?(U(z),E.value&&J()):(ae(),E.value&&J())}catch(g){x.value=g.message}finally{I.value=!1}}return he(()=>d.open,t=>{if(document.body.classList.toggle("overflow-hidden",t),t){window.addEventListener("keydown",q),_e(),typeof d.onRefresh=="function"?Y().catch(()=>{}):De().catch(()=>{});return}window.removeEventListener("keydown",q),C.value=!1,L.value=!1,x.value=""},{immediate:!0}),he(E,t=>{t||(V.value="detail")},{immediate:!0}),he(()=>d.sessions,()=>{if(!d.open)return;if(h.value==="create"){if(!!(String(l.title||"").trim()||String(l.cwd||"").trim()))return;const b=fe();b&&U(b);return}if(_.value){Se(_.value);return}const t=fe();if(t){U(t);return}ae()}),Oe(()=>{document.body.classList.remove("overflow-hidden"),window.removeEventListener("keydown",q)}),(t,o)=>{var b;return p(),ge(Ue,{to:"body"},[i.open?(p(),f("div",{key:0,class:"theme-modal-backdrop fixed inset-0 z-50 flex items-end justify-center px-0 py-0 sm:items-center sm:px-4 sm:py-6",onClick:o[10]||(o[10]=Te(g=>!R.value&&S("close"),["self"]))},[e("section",as,[k(ct,{open:L.value,title:a(u)("projectManager.confirmDeleteTitle"),description:_.value?a(u)("projectManager.confirmDeleteDescription",{title:_.value.title||a(u)("projectManager.untitledProject")}):"","confirm-text":a(u)("projectManager.confirmDelete"),"cancel-text":a(u)("projectManager.keep"),loading:I.value,danger:"",onCancel:o[0]||(o[0]=g=>L.value=!1),onConfirm:Ke},null,8,["open","title","description","confirm-text","cancel-text","loading"]),k(nn,{open:C.value,"initial-path":l.cwd,suggestions:oe.value,onClose:o[1]||(o[1]=g=>C.value=!1),onSelect:s},null,8,["open","initial-path","suggestions"]),e("div",is,[e("div",null,[e("div",ls,[k(a(ut),{class:"h-4 w-4"}),e("span",null,r(a(u)("projectManager.managingTitle")),1)])]),e("div",os,[e("button",{type:"button",class:"theme-icon-button h-9 w-9",disabled:R.value,onClick:o[2]||(o[2]=g=>S("close"))},[k(a(qe),{class:"h-4 w-4"})],8,rs)])]),a(E)?(p(),f("div",ks,[V.value==="list"?(p(),f("div",_s,[e("div",$s,[k(ze,{mobile:"",busy:R.value,"editing-session-id":w.value,"format-updated-at":me,"get-runtime-status-class":ue,"get-runtime-status-label":ne,"get-thread-status-class":pe,"get-thread-status-label":se,"has-sessions":ie.value,"is-current-session":W,"is-session-running":B,mode:h.value,sessions:Z.value,onCreate:n,onSelect:c},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])])])):(p(),f("div",Cs,[e("div",js,[e("button",{type:"button",class:"tool-button inline-flex items-center gap-1.5 px-3 py-2 text-xs",disabled:R.value,onClick:J},[k(a(ft),{class:"h-4 w-4"}),e("span",null,r(a(u)("projectManager.projectList")),1)],8,Ms),e("div",Ps,[e("div",Ts,r(Me.value),1),h.value==="edit"&&((b=_.value)!=null&&b.cwd)?(p(),f("p",Ls,r(_.value.cwd),1)):M("",!0)])]),e("div",Rs,[e("div",Ds,[e("button",{type:"button",class:T(["tool-button px-3 py-2 text-sm",D.value==="basic"?"tool-button-accent-subtle":""]),onClick:o[6]||(o[6]=g=>D.value="basic")},r(a(u)("projectManager.basicInfo")),3),e("button",{type:"button",class:T(["tool-button px-3 py-2 text-sm",D.value==="status"?"tool-button-accent-subtle":""]),disabled:h.value==="create",onClick:o[7]||(o[7]=g=>D.value="status")},r(a(u)("projectManager.status")),11,Es)])]),e("div",Fs,[D.value==="basic"?(p(),f("div",Is,[k(Ne,{mobile:"",busy:R.value,"can-edit-engine":h.value!=="edit"||Q.value,"can-edit-cwd":h.value!=="edit"||F.value,cwd:l.cwd,"cwd-readonly-message":be.value,"duplicate-cwd-message":X.value,engine:l.engine,"engine-options":ee.value,"engine-readonly-message":de.value,title:l.title,"workspace-suggestions":oe.value,onOpenDirectoryPicker:o[8]||(o[8]=g=>C.value=!0),"onUpdate:cwd":H,"onUpdate:engine":N,"onUpdate:title":m},null,8,["busy","can-edit-engine","can-edit-cwd","cwd","cwd-readonly-message","duplicate-cwd-message","engine","engine-options","engine-readonly-message","title","workspace-suggestions"]),x.value?(p(),f("p",Bs,[k(a(Ae),{class:"h-4 w-4"}),e("span",null,r(x.value),1)])):M("",!0),e("div",As,[e("button",{type:"button",class:"tool-button tool-button-primary w-full px-3 py-2 text-sm",disabled:R.value,onClick:Ee},r(we.value),9,Ns),h.value==="edit"&&_.value?(p(),f("button",{key:0,type:"button",class:"tool-button tool-button-danger-subtle w-full px-3 py-2 text-sm",disabled:R.value||le.value,onClick:o[9]||(o[9]=g=>L.value=!0)},r(I.value?a(u)("projectManager.deletingProject"):a(u)("projectManager.deleteProject")),9,zs)):M("",!0)])])):(p(),ge(ss,{key:1,"active-session":_.value,"format-updated-at":me,"get-runtime-status-class":ue,"get-runtime-status-label":ne,"get-thread-status-class":pe,"get-thread-status-label":se,"is-current-session":W,"is-session-running":B},null,8,["active-session"]))])]))])):(p(),f("div",ds,[e("aside",cs,[k(ze,{busy:R.value,"editing-session-id":w.value,"format-updated-at":me,"get-runtime-status-class":ue,"get-runtime-status-label":ne,"get-thread-status-class":pe,"get-thread-status-label":se,"has-sessions":ie.value,"is-current-session":W,"is-session-running":B,mode:h.value,sessions:Z.value,onCreate:n,onSelect:c},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])]),e("div",us,[e("div",ps,[e("div",null,[e("div",ms,[k(a(pt),{class:"h-4 w-4"}),e("span",null,r(h.value==="create"?a(u)("projectManager.createTitle"):a(u)("projectManager.editTitle")),1)])])]),e("div",fs,[k(Ne,{busy:R.value,"can-edit-engine":h.value!=="edit"||Q.value,"can-edit-cwd":h.value!=="edit"||F.value,cwd:l.cwd,"cwd-readonly-message":be.value,"duplicate-cwd-message":X.value,engine:l.engine,"engine-options":ee.value,"engine-readonly-message":de.value,title:l.title,"workspace-suggestions":oe.value,onOpenDirectoryPicker:o[3]||(o[3]=g=>C.value=!0),"onUpdate:cwd":H,"onUpdate:engine":N,"onUpdate:title":m},null,8,["busy","can-edit-engine","can-edit-cwd","cwd","cwd-readonly-message","duplicate-cwd-message","engine","engine-options","engine-readonly-message","title","workspace-suggestions"])]),x.value?(p(),f("p",vs,[k(a(Ae),{class:"h-4 w-4"}),e("span",null,r(x.value),1)])):M("",!0),e("div",hs,[e("div",gs,[h.value==="edit"&&_.value?(p(),f("button",{key:0,type:"button",class:"tool-button tool-button-danger-subtle inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:R.value||le.value,onClick:o[4]||(o[4]=g=>L.value=!0)},[k(a(mt),{class:"h-4 w-4"}),e("span",null,r(I.value?a(u)("projectManager.deletingProject"):a(u)("projectManager.deleteProject")),1)],8,xs)):M("",!0)]),e("div",ys,[e("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:R.value,onClick:o[5]||(o[5]=g=>S("close"))},r(a(u)("projectManager.close")),9,bs),h.value==="create"&&ie.value?(p(),f("button",{key:0,type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:R.value,onClick:_e},r(a(u)("projectManager.backToList")),9,ws)):M("",!0),e("button",{type:"button",class:"tool-button tool-button-primary w-full px-3 py-2 text-xs sm:w-auto",disabled:R.value,onClick:Ee},r(we.value),9,Ss)])])])]))])])):M("",!0)])}}};export{qs as default};
@@ -1,4 +1,4 @@
1
- import{w as H,E as Je,i as M,s as P,x as S,D as Ue,v as Qe,a as c,b as v,d as a,F as Z,r as Se,n as F,t as r,e as k,u as t,y as Te,z as Xe,f as D,j as Re,c as je,B as $e,G as Ye,O as He,o as Ze,g as et,T as tt}from"./index-CAxXWy_Y.js";import{c as qe,u as st,g as Le,l as at,S as nt,C as Ae,a as Ie,b as it,d as lt,_ as ot,e as rt,F as We,f as Ne,X as dt}from"./WorkbenchView-BUYIusWV.js";/**
1
+ import{w as H,E as Je,i as M,s as P,x as S,D as Ue,v as Qe,a as c,b as v,d as a,F as Z,r as Se,n as F,t as r,e as k,u as t,y as Te,z as Xe,f as D,j as Re,c as je,B as $e,G as Ye,O as He,o as Ze,g as et,T as tt}from"./index-BcbMELCK.js";import{c as qe,u as st,g as Le,l as at,S as nt,C as Ae,a as Ie,b as it,d as lt,_ as ot,e as rt,F as We,f as Ne,X as dt}from"./WorkbenchView-CC7DNNB_.js";/**
2
2
  * @license lucide-vue-next v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{a as l,b as r,d as e,t as a,u as i,F as ne,r as ae,j as Ye,P as Rt,i as v,n as Ze,q as Tt,c as $,f as h,w as Je,o as St,e as N,B as Ke,y as se,A as Mt,z as pe,Q as Et,g as Pt,T as $t,s as m,C as _e,D as Ut}from"./index-CAxXWy_Y.js";import{c as ie,r as W,d as jt,h as Lt,X as Bt,i as Nt,_ as Ft,L as me,j as It}from"./WorkbenchView-BUYIusWV.js";import{I as qt}from"./info-BE3hW0WS.js";/**
1
+ import{a as l,b as r,d as e,t as a,u as i,F as ne,r as ae,j as Ye,P as Rt,i as v,n as Ze,q as Tt,c as $,f as h,w as Je,o as St,e as N,B as Ke,y as se,A as Mt,z as pe,Q as Et,g as Pt,T as $t,s as m,C as _e,D as Ut}from"./index-BcbMELCK.js";import{c as ie,r as W,d as jt,h as Lt,X as Bt,i as Nt,_ as Ft,L as me,j as It}from"./WorkbenchView-CC7DNNB_.js";import{I as qt}from"./info-Db3PDen4.js";/**
2
2
  * @license lucide-vue-next v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.