@muyichengshayu/promptx 0.1.36 → 0.1.37
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 +9 -0
- package/apps/server/src/assetRoutes.js +45 -20
- package/apps/server/src/index.js +16 -13
- package/apps/server/src/runDispatchService.js +92 -2
- package/apps/web/dist/assets/{CodexSessionManagerDialog-C-FfLD35.js → CodexSessionManagerDialog-DPP8E6xF.js} +1 -1
- package/apps/web/dist/assets/{TaskDiffReviewDialog-Z6g8Hili.js → TaskDiffReviewDialog-CjE-oU0V.js} +2 -2
- package/apps/web/dist/assets/{WorkbenchSettingsDialog-CWz-CWfM.js → WorkbenchSettingsDialog-B1r9uGXR.js} +1 -1
- package/apps/web/dist/assets/WorkbenchView-BpZPP-RG.css +1 -0
- package/apps/web/dist/assets/WorkbenchView-D8Dofo5f.js +29 -0
- package/apps/web/dist/assets/index-Bd5S7OHB.js +2 -0
- package/apps/web/dist/assets/index-DLFSFjZB.css +1 -0
- package/apps/web/dist/assets/{vendor-markdown-CNlC48LI.js → vendor-markdown-CwTllcDY.js} +1 -1
- package/apps/web/dist/assets/{vendor-misc-CWjGI0ex.js → vendor-misc-Dbi9Va04.js} +1 -1
- package/apps/web/dist/assets/{vendor-router-Bcjfmow0.js → vendor-router-D4MjzL9m.js} +1 -1
- package/apps/web/dist/assets/{vendor-tiptap-BCwG_IWj.js → vendor-tiptap-DODYTmKM.js} +1 -1
- package/apps/web/dist/assets/{vendor-ui-D4mCpibF.js → vendor-ui-CJHzyOOw.js} +1 -1
- package/apps/web/dist/favicon.svg +20 -0
- package/apps/web/dist/index.html +5 -4
- package/package.json +1 -1
- package/apps/web/dist/assets/WorkbenchView-DqB2zkrZ.css +0 -1
- package/apps/web/dist/assets/WorkbenchView-Om8eCYyb.js +0 -29
- package/apps/web/dist/assets/index-BZAqOJwX.js +0 -2
- package/apps/web/dist/assets/index-Doax367I.css +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.37
|
|
4
|
+
|
|
5
|
+
- 新增 `WeChat Light` 主题,并围绕微信桌面端风格统一工作台配色:任务列表、输入区、执行区、回复卡片、弹窗与浮层改为更克制的白底、浅灰边框与绿色强调。
|
|
6
|
+
- 修复 Relay 场景下的图片下发地址:当远端页面把图片发送给 `Codex / Claude Code / OpenCode` 时,后端现在优先改写为本机 PromptX 服务地址(如 `127.0.0.1:3000/3001`)再交给 agent,避免 relay 域名下的图片 URL 因鉴权或时效问题返回 `401`,导致模型看图失败。
|
|
7
|
+
- 收敛移动端与桌面端样式分叉:任务列表的信息密度、时间、文件徽标和选中态重新统一;待办弹窗高度、卡片排版与其它弹窗保持一致,避免再出现“移动端单独一套”的割裂感。
|
|
8
|
+
- 重做右侧输入区特殊块头部:图片块压缩为“图标 + 图片 / 删除”单行;导入文件块改为“图标 + 文件 + 操作按钮”第一行、`文件名(xx 行,xx 字符)` 第二行,移动端可读性更好。
|
|
9
|
+
- 调整会话区细节:`diff` 查看入口从执行摘要迁到回复卡片头部,执行过程隐藏时也能直接访问;同时微调回复卡片头部的按钮顺序,阅读和操作更顺手。
|
|
10
|
+
- 顺手做了一轮无行为变化的前端整理:精简特殊块 frame 接口、清理未使用文案和死代码,并收掉一部分 `WeChat` 主题的重复样式规则。
|
|
11
|
+
|
|
3
12
|
## 0.1.36
|
|
4
13
|
|
|
5
14
|
- 统一中栏 `PromptX` 与 `Codex` 回复卡片头部的时间区样式:两侧元信息都改回同一套非等宽标题样式,时间与“展开 / 收起”按钮的紧凑度保持一致。
|
|
@@ -1,18 +1,47 @@
|
|
|
1
1
|
import fs from 'node:fs'
|
|
2
2
|
import path from 'node:path'
|
|
3
3
|
import { pipeline } from 'node:stream/promises'
|
|
4
|
-
import {
|
|
4
|
+
import { loadImage } from '@napi-rs/canvas'
|
|
5
5
|
import { nanoid } from 'nanoid'
|
|
6
6
|
import { createApiError } from './apiErrors.js'
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
const IMAGE_EXTENSION_BY_MIME_TYPE = {
|
|
9
|
+
'image/avif': '.avif',
|
|
10
|
+
'image/bmp': '.bmp',
|
|
11
|
+
'image/gif': '.gif',
|
|
12
|
+
'image/heic': '.heic',
|
|
13
|
+
'image/heif': '.heif',
|
|
14
|
+
'image/jpeg': '.jpg',
|
|
15
|
+
'image/jpg': '.jpg',
|
|
16
|
+
'image/png': '.png',
|
|
17
|
+
'image/svg+xml': '.svg',
|
|
18
|
+
'image/tiff': '.tiff',
|
|
19
|
+
'image/webp': '.webp',
|
|
20
|
+
'image/x-icon': '.ico',
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function resolveImageExtension(fileName = '', mimeType = '') {
|
|
24
|
+
const normalizedName = String(fileName || '').trim()
|
|
25
|
+
const extension = path.extname(normalizedName).toLowerCase()
|
|
26
|
+
if (/^\.[a-z0-9]{1,10}$/.test(extension)) {
|
|
27
|
+
return extension
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return IMAGE_EXTENSION_BY_MIME_TYPE[String(mimeType || '').toLowerCase()] || ''
|
|
31
|
+
}
|
|
12
32
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
33
|
+
async function readImageDimensions(filePath = '') {
|
|
34
|
+
try {
|
|
35
|
+
const source = await loadImage(filePath)
|
|
36
|
+
return {
|
|
37
|
+
width: Number.isFinite(Number(source.width)) ? Number(source.width) : null,
|
|
38
|
+
height: Number.isFinite(Number(source.height)) ? Number(source.height) : null,
|
|
39
|
+
}
|
|
40
|
+
} catch {
|
|
41
|
+
return {
|
|
42
|
+
width: null,
|
|
43
|
+
height: null,
|
|
44
|
+
}
|
|
16
45
|
}
|
|
17
46
|
}
|
|
18
47
|
|
|
@@ -42,24 +71,20 @@ function registerAssetRoutes(app, options = {}) {
|
|
|
42
71
|
try {
|
|
43
72
|
await pipeline(part.file, fs.createWriteStream(tempPath))
|
|
44
73
|
|
|
45
|
-
const
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
-
const context = canvas.getContext('2d')
|
|
49
|
-
context.drawImage(source, 0, 0, scaled.width, scaled.height)
|
|
50
|
-
|
|
51
|
-
const outputName = `${nanoid(16)}.jpg`
|
|
74
|
+
const mimeType = String(part.mimetype || '').toLowerCase().trim()
|
|
75
|
+
const outputExt = resolveImageExtension(normalizeUploadFileName(part.filename, 'image'), mimeType)
|
|
76
|
+
const outputName = `${nanoid(16)}${outputExt}`
|
|
52
77
|
outputPath = path.join(uploadsDir, outputName)
|
|
53
|
-
|
|
54
|
-
fs.writeFileSync(outputPath, outputBuffer)
|
|
78
|
+
fs.copyFileSync(tempPath, outputPath)
|
|
55
79
|
|
|
56
80
|
const stats = fs.statSync(outputPath)
|
|
81
|
+
const dimensions = await readImageDimensions(outputPath)
|
|
57
82
|
completed = true
|
|
58
83
|
return reply.code(201).send({
|
|
59
84
|
url: `/uploads/${outputName}`,
|
|
60
|
-
width:
|
|
61
|
-
height:
|
|
62
|
-
mimeType
|
|
85
|
+
width: dimensions.width,
|
|
86
|
+
height: dimensions.height,
|
|
87
|
+
mimeType,
|
|
63
88
|
size: stats.size,
|
|
64
89
|
})
|
|
65
90
|
} finally {
|
package/apps/server/src/index.js
CHANGED
|
@@ -207,19 +207,22 @@ function buildTaskDetailUrl(taskSlug = '', options = {}) {
|
|
|
207
207
|
return `${publicServerBaseUrl || localServerBaseUrl}/?task=${encodeURIComponent(normalizedSlug)}`
|
|
208
208
|
}
|
|
209
209
|
|
|
210
|
-
const runDispatchService = createRunDispatchService({
|
|
211
|
-
broadcastServerEvent,
|
|
212
|
-
createCodexRun,
|
|
213
|
-
decorateCodexSession,
|
|
214
|
-
getCodexRunById,
|
|
215
|
-
getPromptxCodexSessionById,
|
|
216
|
-
getRunningCodexRunBySessionId,
|
|
217
|
-
getTaskBySlug,
|
|
218
|
-
logger: app.log,
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
210
|
+
const runDispatchService = createRunDispatchService({
|
|
211
|
+
broadcastServerEvent,
|
|
212
|
+
createCodexRun,
|
|
213
|
+
decorateCodexSession,
|
|
214
|
+
getCodexRunById,
|
|
215
|
+
getPromptxCodexSessionById,
|
|
216
|
+
getRunningCodexRunBySessionId,
|
|
217
|
+
getTaskBySlug,
|
|
218
|
+
logger: app.log,
|
|
219
|
+
localServerBaseUrl,
|
|
220
|
+
publicServerBaseUrl,
|
|
221
|
+
relayUrl: relayConfig?.relayUrl || '',
|
|
222
|
+
runnerClient,
|
|
223
|
+
updateCodexRunFromRunnerStatus,
|
|
224
|
+
updateTaskCodexSession,
|
|
225
|
+
})
|
|
223
226
|
|
|
224
227
|
const taskAutomationService = createTaskAutomationService({
|
|
225
228
|
logger: app.log,
|
|
@@ -4,6 +4,84 @@ import {
|
|
|
4
4
|
} from './runnerDispatch.js'
|
|
5
5
|
import { createApiError } from './apiErrors.js'
|
|
6
6
|
|
|
7
|
+
function normalizeBaseUrl(value = '') {
|
|
8
|
+
return String(value || '').trim().replace(/\/+$/, '')
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function normalizeUploadPath(value = '') {
|
|
12
|
+
const text = String(value || '').trim()
|
|
13
|
+
if (!text) {
|
|
14
|
+
return ''
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
if (text.startsWith('/')) {
|
|
18
|
+
const [pathname = '', search = ''] = text.split('?')
|
|
19
|
+
return pathname.startsWith('/uploads/') ? `${pathname}${search ? `?${search}` : ''}` : ''
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
const url = new URL(text)
|
|
24
|
+
return url.pathname.startsWith('/uploads/') ? `${url.pathname}${url.search || ''}` : ''
|
|
25
|
+
} catch {
|
|
26
|
+
return ''
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function buildLocalUploadUrl(value = '', localServerBaseUrl = '') {
|
|
31
|
+
const normalizedBaseUrl = normalizeBaseUrl(localServerBaseUrl)
|
|
32
|
+
const uploadPath = normalizeUploadPath(value)
|
|
33
|
+
if (!normalizedBaseUrl || !uploadPath) {
|
|
34
|
+
return String(value || '').trim()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
return new URL(uploadPath, `${normalizedBaseUrl}/`).toString()
|
|
39
|
+
} catch {
|
|
40
|
+
return `${normalizedBaseUrl}${uploadPath.startsWith('/') ? '' : '/'}${uploadPath}`
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function rewritePromptUploadsToLocal(prompt = '', options = {}) {
|
|
45
|
+
const text = String(prompt || '').trim()
|
|
46
|
+
const localServerBaseUrl = String(options.localServerBaseUrl || '').trim()
|
|
47
|
+
if (!text || !localServerBaseUrl) {
|
|
48
|
+
return text
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const candidates = text.match(/https?:\/\/[^\s"'`<>]+/g) || []
|
|
52
|
+
|
|
53
|
+
let nextPrompt = text
|
|
54
|
+
candidates.forEach((candidate) => {
|
|
55
|
+
const localUrl = buildLocalUploadUrl(candidate, localServerBaseUrl)
|
|
56
|
+
if (normalizeUploadPath(candidate) && localUrl && candidate !== localUrl) {
|
|
57
|
+
nextPrompt = nextPrompt.split(candidate).join(localUrl)
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
return nextPrompt
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function buildRunnerPromptPayload(session = {}, input = {}, options = {}) {
|
|
64
|
+
const prompt = String(input.prompt || '').trim()
|
|
65
|
+
const promptBlocks = Array.isArray(input.promptBlocks) ? input.promptBlocks : []
|
|
66
|
+
|
|
67
|
+
const nextPromptBlocks = promptBlocks.map((block) => {
|
|
68
|
+
if (String(block?.type || '').trim() !== 'image') {
|
|
69
|
+
return block
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
...block,
|
|
74
|
+
meta: block?.meta ? { ...block.meta } : {},
|
|
75
|
+
content: buildLocalUploadUrl(block?.content, options.localServerBaseUrl),
|
|
76
|
+
}
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
prompt: rewritePromptUploadsToLocal(prompt, options),
|
|
81
|
+
promptBlocks: nextPromptBlocks,
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
7
85
|
export function createRunDispatchService(options = {}) {
|
|
8
86
|
const runnerClient = options.runnerClient
|
|
9
87
|
const logger = options.logger || console
|
|
@@ -16,6 +94,9 @@ export function createRunDispatchService(options = {}) {
|
|
|
16
94
|
const updateTaskCodexSession = options.updateTaskCodexSession || (() => null)
|
|
17
95
|
const decorateCodexSession = options.decorateCodexSession || ((session) => session)
|
|
18
96
|
const broadcastServerEvent = options.broadcastServerEvent || (() => {})
|
|
97
|
+
const localServerBaseUrl = String(options.localServerBaseUrl || '').trim()
|
|
98
|
+
const publicServerBaseUrl = String(options.publicServerBaseUrl || '').trim()
|
|
99
|
+
const relayUrl = String(options.relayUrl || '').trim()
|
|
19
100
|
|
|
20
101
|
async function startTaskRunForTask(payload = {}) {
|
|
21
102
|
const normalizedTaskSlug = String(payload.taskSlug || '').trim()
|
|
@@ -62,13 +143,22 @@ export function createRunDispatchService(options = {}) {
|
|
|
62
143
|
let runnerDispatchPending = false
|
|
63
144
|
|
|
64
145
|
try {
|
|
146
|
+
const runnerPromptPayload = buildRunnerPromptPayload(session, {
|
|
147
|
+
prompt: normalizedPrompt,
|
|
148
|
+
promptBlocks,
|
|
149
|
+
}, {
|
|
150
|
+
localServerBaseUrl,
|
|
151
|
+
publicServerBaseUrl,
|
|
152
|
+
relayUrl,
|
|
153
|
+
})
|
|
154
|
+
|
|
65
155
|
const runnerPayload = await runnerClient.startRun({
|
|
66
156
|
runId: runRecord.id,
|
|
67
157
|
taskSlug: normalizedTaskSlug,
|
|
68
158
|
sessionId: normalizedSessionId,
|
|
69
159
|
engine: session.engine,
|
|
70
|
-
prompt:
|
|
71
|
-
promptBlocks,
|
|
160
|
+
prompt: runnerPromptPayload.prompt,
|
|
161
|
+
promptBlocks: runnerPromptPayload.promptBlocks,
|
|
72
162
|
cwd: session.cwd,
|
|
73
163
|
title: session.title,
|
|
74
164
|
codexThreadId: session.codexThreadId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as ye,f as st,d as lt}from"./index-BZAqOJwX.js";import{A as it,n as Pe,e as _e,r as ot,b as Ge,s as rt,f as ze,_ as dt,a as ct,h as Ue}from"./WorkbenchView-Om8eCYyb.js";import{w as he,aB as p,aG as se,aH as le,aD as t,aO as o,u as a,aE as S,aU as ut,aV as pt,aJ as P,aC as f,aP as xe,aQ as Ce,aL as j,aT as mt,aI as gt,b as $,c as _,aX as Je,ak as ft,r as vt,n as ht}from"./vendor-misc-CWjGI0ex.js";import{g as He,h as ve,L as Ie,j as xt,b as Ke,H as yt,m as bt,v as wt,P as St,d as Ve,J as kt,l as $t,p as _t,K as Ct}from"./vendor-ui-D4mCpibF.js";import"./vendor-router-Bcjfmow0.js";import"./vendor-markdown-CNlC48LI.js";import"./vendor-tiptap-BCwG_IWj.js";function Mt(i=[]){return(Array.isArray(i)&&i.length?i:it).filter(u=>u&&typeof u=="object").map(u=>{const k=Pe(u.value);return{...u,value:k,label:String(u.label||_e(k)).trim()||_e(k),enabled:u.enabled!==!1,available:u.available!==!1}})}function Te(i=[]){return Mt(i).filter(T=>T.enabled&&T.available)}async function jt(){const i=await ot("/api/meta",{cache:"no-store"});return Te(i==null?void 0:i.agentEngineOptions)}const It={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},Pt={class:"theme-muted-text mt-1 text-xs leading-5"},Tt={class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Rt={class:"theme-divider mt-4 rounded-sm border border-dashed px-3 py-2"},Dt={class:"flex items-start gap-2 text-xs leading-5"},Et={class:"theme-muted-text shrink-0"},Lt={class:"min-w-0 break-all font-mono text-[var(--theme-textPrimary)]"},Ft={class:"theme-muted-text mt-4 block text-xs"},Bt={class:"theme-input-shell mt-1 flex h-10 items-center gap-2 rounded-sm border px-3 transition focus-within:ring-2"},At=["placeholder"],Nt={class:"mt-4 flex items-center gap-1.5"},Ot={class:"theme-content-panel mt-3 min-h-0 flex-1 overflow-y-auto p-2"},zt={key:0,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},Ut={key:1,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},Ht={key:2,class:"theme-empty-state flex items-center justify-center gap-2 px-3 py-8 text-sm"},Vt={key:3,class:"theme-empty-state flex items-center justify-center gap-2 px-3 py-8 text-sm"},qt={key:4,class:"theme-empty-state px-3 py-8 text-sm"},Wt={key:5,class:"theme-empty-state px-3 py-8 text-sm"},Gt={key:6,class:"theme-empty-state px-3 py-8 text-sm"},Jt={key:7,class:"space-y-1"},Kt=["onClick"],Qt={class:"min-w-0 flex-1"},Xt=["innerHTML"],Yt=["innerHTML"],Zt={key:0,class:"theme-muted-text px-1 pt-2 text-xs"},en={key:8,class:"space-y-1"},tn={class:"flex items-start gap-1.5"},nn=["onClick"],an=["onClick"],sn={class:"min-w-0 flex-1"},ln={key:0,class:"theme-muted-text truncate font-mono text-[10px]"},on={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"},rn={class:"flex flex-col-reverse gap-2 sm:flex-row sm:items-center"},dn=["disabled"],cn=["disabled"],un={__name:"CodexDirectoryPickerDialog",props:{open:{type:Boolean,default:!1},initialPath:{type:String,default:""},suggestions:{type:Array,default:()=>[]}},emits:["close","select"],setup(i,{emit:T}){const u=i,k=T,{t:v}=ye(),c=$(""),h=$(null),M=$(!1),r=$(""),d=$(!1),w=$(""),L=$([]),F=$(!1),R=$(""),C=$("tree"),E=$(""),G=$("");let B=null,A=0;const J=_(()=>de(h.value?[h.value]:[])),O=_(()=>C.value==="search"&&!R.value.trim()),ie=_(()=>C.value==="search"&&!!R.value.trim()&&!d.value&&!w.value&&!L.value.length),V=_(()=>C.value==="tree"&&!M.value&&!r.value&&!J.value.length);function ne(n=""){const m=String(n||"").trim();return/^[a-z]:[\\/]/i.test(m)||m.includes("\\")}function b(n=""){const m=String(n||"").trim();if(!m)return"";const l=ne(m);let g=m.replace(/\\/g,"/");return g.length>1&&!/^[a-z]:\/?$/i.test(g)&&g!=="/"&&(g=g.replace(/\/+$/,"")),l?g.toLowerCase():g}function Z(n="",m=""){const l=b(n),g=b(m);return!l||!g?!1:l===g||l.startsWith(`${g}/`)}function Me(n="",m=""){const l=String(n||"").trim(),g=String(m||"").trim();return l?g?ne(l)?/^[a-z]:\\?$/i.test(l)?`${l.replace(/[\\/]+$/,"")}\\${g}`:`${l.replace(/[\\/]+$/,"")}\\${g}`:l==="/"?`/${g}`:`${l.replace(/\/+$/,"")}/${g}`:l:g}function ae(n="",m=""){const l=b(n),g=b(m);if(!l||!g||!Z(g,l))return[];const D=g===l?"":g.slice(l.length).replace(/^\//,"");return D?D.split("/").filter(Boolean):[]}function K(n){return(n==null?void 0:n.name)||(n==null?void 0:n.path)||v("directoryPicker.unnamedDirectory")}function oe(n=""){const m=String(n||"").trim();return m?m.split(/[\\/]/).filter(Boolean).at(-1)||m:"Home"}function q(n=""){return String(n||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function I(n="",m=""){const l=String(n||""),g=String(m||"").trim().toLowerCase();if(!l||!g)return null;const D=l.toLowerCase(),U=D.indexOf(g);if(U>=0)return{start:U,end:U+g.length};const $e=g.split(/[\\/\s_.-]+/).filter(Boolean).sort((W,Y)=>Y.length-W.length);for(const W of $e){if(W.length<2)continue;const Y=D.indexOf(W);if(Y>=0)return{start:Y,end:Y+W.length}}return null}function be(n="",m=""){const l=String(n||""),g=I(l,m);return g?`${q(l.slice(0,g.start))}<mark class="theme-search-highlight">${q(l.slice(g.start,g.end))}</mark>${q(l.slice(g.end))}`:q(l)}function re(n){return be(K(n),R.value)}function we(n){return be((n==null?void 0:n.path)||"",R.value)}function ee(n,m=0){return{...n,depth:m,expanded:!1,loaded:!1,loading:!1,children:[]}}function de(n=[],m=[]){return n.forEach(l=>{m.push(l),l.expanded&&l.children.length&&de(l.children,m)}),m}function Q(){h.value&&(h.value={...h.value})}function ce(n,m=h.value?[h.value]:[]){const l=b(n);if(!l)return null;for(const g of m){if(b(g.path)===l)return g;if(g.children.length){const D=ce(n,g.children);if(D)return D}}return null}function X(n){E.value=String((n==null?void 0:n.path)||"").trim(),G.value=K(n)}async function ue(n,m={}){if(!(!n||n.loading)&&!(n.loaded&&!m.force)){n.loading=!0,r.value="",Q();try{const l=await ze({path:n.path,limit:240});n.children=(l.items||[]).map(g=>ee(g,n.depth+1)),n.loaded=!0}catch(l){r.value=l.message||v("directoryPicker.loadFailed")}finally{n.loading=!1,Q()}}}async function je(){M.value=!0,r.value="";try{const n=await ze({limit:240});c.value=String(n.path||""),h.value=ee({name:oe(n.path||""),path:String(n.path||""),type:"directory",hasChildren:!0,isHomeRoot:!0},0),h.value.children=(n.items||[]).map(m=>ee(m,1)),h.value.loaded=!0,h.value.expanded=!0,X(h.value)}catch(n){r.value=n.message||v("directoryPicker.treeLoadFailed"),h.value=null,c.value=""}finally{M.value=!1}}async function pe(n=""){const m=String(n||"").trim();if(!m||!c.value||!Z(m,c.value))return;let l=h.value;if(!l)return;X(l);const g=ae(c.value,m);for(const D of g){await ue(l),l.expanded=!0,Q();const U=ce(Me(l.path,D),l.children);if(!U)break;l=U,X(l)}}async function Se(){R.value="",C.value="tree",L.value=[],w.value="",F.value=!1,E.value="",G.value="",await je();const n=String(u.initialPath||"").trim();n&&Z(n,c.value)&&await pe(n)}async function z(n){if(n!=null&&n.path&&(X(n),!!n.hasChildren)){if(!n.loaded){n.expanded=!0,Q(),await ue(n);return}n.expanded=!n.expanded,Q()}}function te(n){n!=null&&n.path&&(X(n),C.value="tree")}async function ke(){const n=String(R.value||"").trim();A+=1;const m=A;if(!u.open||!n||!c.value){d.value=!1,w.value="",L.value=[],F.value=!1;return}d.value=!0,w.value="";try{const l=await rt(n,{path:c.value,limit:80});if(m!==A)return;L.value=Array.isArray(l.items)?l.items:[],F.value=!!l.truncated}catch(l){if(m!==A)return;w.value=l.message||v("directoryPicker.searchFailed"),L.value=[],F.value=!1}finally{m===A&&(d.value=!1)}}function me(){if(B&&(window.clearTimeout(B),B=null),!String(R.value||"").trim()){d.value=!1,w.value="",L.value=[],F.value=!1;return}d.value=!0,w.value="",B=window.setTimeout(()=>{ke()},120)}async function ge(n){n!=null&&n.path&&(C.value="tree",await pe(n.path))}function fe(){E.value&&(k("select",E.value),k("close"))}return he(R,()=>{C.value=R.value.trim()?"search":"tree",me()}),he(()=>u.open,n=>{if(n){Se().catch(()=>{});return}B&&(window.clearTimeout(B),B=null)}),(n,m)=>(p(),se(Ge,{open:i.open,"backdrop-class":"z-[60] items-end justify-center px-0 py-0 sm:items-center sm:px-4 sm:py-6","panel-class":"settings-dialog-panel h-full max-w-4xl sm:h-auto sm:max-h-[86vh]","header-class":"settings-dialog-header px-5 py-4","body-class":"settings-dialog-body flex min-h-0 flex-1 flex-col overflow-hidden px-4 py-4 sm:px-5","close-disabled":M.value||d.value,"close-on-backdrop":!(M.value||d.value),"close-on-escape":!(M.value||d.value),onClose:m[4]||(m[4]=l=>k("close"))},{title:le(()=>[t("div",null,[t("div",It,[S(a(ve),{class:"h-4 w-4"}),t("span",null,o(a(v)("directoryPicker.title")),1)]),t("p",Pt,o(a(v)("directoryPicker.intro")),1)])]),default:le(()=>[t("div",Tt,[t("div",Rt,[t("div",Dt,[t("span",Et,o(a(v)("directoryPicker.currentSelection")),1),t("span",Lt,o(E.value||a(v)("directoryPicker.selectionPlaceholder")),1)])]),t("label",Ft,[t("span",null,o(a(v)("directoryPicker.searchLabel")),1),t("div",Bt,[S(a(He),{class:"h-4 w-4 shrink-0 text-[var(--theme-textMuted)]"}),ut(t("input",{"onUpdate:modelValue":m[0]||(m[0]=l=>R.value=l),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,At),[[pt,R.value]])])]),t("div",Nt,[t("button",{type:"button",class:P(["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:m[1]||(m[1]=l=>C.value="search")},[S(a(He),{class:"h-3.5 w-3.5"}),t("span",null,o(a(v)("directoryPicker.searchTab")),1)],2),t("button",{type:"button",class:P(["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:m[2]||(m[2]=l=>C.value="tree")},[S(a(ve),{class:"h-3.5 w-3.5"}),t("span",null,o(a(v)("directoryPicker.treeTab")),1)],2)]),t("div",Ot,[C.value==="search"&&w.value?(p(),f("div",zt,o(w.value),1)):C.value==="tree"&&r.value?(p(),f("div",Ut,o(r.value),1)):C.value==="search"&&d.value?(p(),f("div",Ht,[S(a(Ie),{class:"h-4 w-4 animate-spin"}),t("span",null,o(a(v)("directoryPicker.searching")),1)])):C.value==="tree"&&M.value?(p(),f("div",Vt,[S(a(Ie),{class:"h-4 w-4 animate-spin"}),t("span",null,o(a(v)("directoryPicker.treeLoading")),1)])):O.value?(p(),f("div",qt,o(a(v)("directoryPicker.searchPrompt")),1)):ie.value?(p(),f("div",Wt,o(a(v)("directoryPicker.noSearchResults")),1)):V.value?(p(),f("div",Gt,o(a(v)("directoryPicker.emptyTree")),1)):C.value==="search"?(p(),f("div",Jt,[(p(!0),f(xe,null,Ce(L.value,l=>(p(),f("button",{key:l.path,type:"button",class:P(["flex w-full items-start gap-2 rounded-sm border border-transparent px-2.5 py-1.5 text-left transition",b(E.value)===b(l.path)?"theme-list-item-active":"theme-list-item-hover"]),onClick:g=>ge(l)},[S(a(ve),{class:"theme-muted-text mt-0.5 h-4 w-4 shrink-0"}),t("div",Qt,[t("div",null,[t("span",{class:"truncate text-[13px] text-[var(--theme-textPrimary)]",innerHTML:re(l)},null,8,Xt)]),t("div",{class:"theme-muted-text truncate font-mono text-[10px]",innerHTML:we(l)},null,8,Yt)])],10,Kt))),128)),F.value?(p(),f("p",Zt,o(a(v)("directoryPicker.truncatedHint")),1)):j("",!0)])):(p(),f("div",en,[(p(!0),f(xe,null,Ce(J.value,l=>(p(),f("div",{key:l.path,class:P(["rounded-sm border border-transparent px-1.5 py-1 transition",b(E.value)===b(l.path)?"theme-list-item-active":l.expanded?"theme-list-item-expanded":"theme-list-item-hover"]),style:mt({paddingLeft:`${l.depth*16+6}px`})},[t("div",tn,[t("button",{type:"button",class:P(["theme-icon-button h-5 w-5 shrink-0",l.hasChildren?"":"invisible pointer-events-none"]),onClick:gt(g=>z(l),["stop"])},[l.loading?(p(),se(a(Ie),{key:0,class:"h-3.5 w-3.5 animate-spin"})):(p(),se(a(xt),{key:1,class:P(["h-3.5 w-3.5 transition",l.expanded?"rotate-90 text-[var(--theme-textPrimary)]":""])},null,8,["class"]))],10,nn),t("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:g=>te(l)},[S(a(ve),{class:P(["h-4 w-4 shrink-0",b(E.value)===b(l.path)?"text-[var(--theme-textPrimary)]":"text-[var(--theme-textMuted)]"])},null,8,["class"]),t("div",sn,[t("div",{class:P(["truncate text-[13px]",l.isHomeRoot?"font-medium text-[var(--theme-textSecondary)]":"font-medium text-[var(--theme-textPrimary)]"])},o(K(l)),3),l.isHomeRoot?(p(),f("div",ln,o(l.path),1)):j("",!0)])],8,an)])],6))),128))]))])]),t("div",on,[t("div",rn,[t("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:M.value||d.value,onClick:m[3]||(m[3]=l=>k("close"))},o(a(v)("directoryPicker.cancel")),9,dn),t("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:M.value||d.value||!E.value,onClick:fe},[S(a(Ke),{class:"h-4 w-4"}),t("span",null,o(a(v)("directoryPicker.useCurrentDirectory")),1)],8,cn)])])]),_:1},8,["open","close-disabled","close-on-backdrop","close-on-escape"]))}},pn={class:"grid gap-4"},mn={class:"theme-muted-text block text-xs"},gn=["value","disabled"],fn={class:"theme-muted-text block text-xs"},vn={class:"mt-1 flex gap-2"},hn=["value","disabled"],xn=["disabled"],yn={id:"codex-manager-workspace-suggestions"},bn=["value"],wn={key:0,class:"mt-2 text-[11px] leading-5 text-[var(--theme-warningText)]"},Sn={key:1,class:"theme-muted-text mt-2 text-[11px] leading-5"},kn={class:"theme-muted-text block text-xs"},$n={class:"mt-1"},_n={class:"flex items-center gap-2 text-sm"},Cn={key:0,class:"theme-muted-text rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]"},Mn=["disabled","onClick"],jn={class:"flex items-center justify-between gap-3"},In={class:"min-w-0 flex-1 truncate"},Pn={key:0,class:"theme-muted-text rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]"},Tn={key:0,class:"theme-muted-text mt-2 text-[11px] leading-5"},Rn={class:"theme-muted-text block text-xs"},Dn={class:"mt-1 flex gap-2"},En=["value","disabled"],Ln=["disabled"],Fn={key:0,class:"theme-muted-text mt-2 text-[11px] leading-5"},Bn={key:1,class:"theme-muted-text mt-2 text-[11px] leading-5"},qe={__name:"CodexSessionManagerForm",props:{busy:{type:Boolean,default:!1},canEditEngine:{type:Boolean,default:!0},canEditCwd:{type:Boolean,default:!0},canEditSessionId:{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},sessionId:{type:String,default:""},sessionIdCopied:{type:Boolean,default:!1},sessionIdReadonlyMessage:{type:String,default:""},title:{type:String,default:""},workspaceSuggestions:{type:Array,default:()=>[]}},emits:["copy-session-id","open-directory-picker","update:cwd","update:engine","update:sessionId","update:title"],setup(i,{emit:T}){const u=i,k=T,{t:v}=ye(),c=_(()=>{const M=String(u.engine||"").trim();return u.engineOptions.find(r=>String((r==null?void 0:r.value)||"").trim()===M)||null}),h=_(()=>String(u.sessionId||"").trim());return(M,r)=>(p(),f("div",pn,[t("label",mn,[t("span",null,o(a(v)("projectManager.projectTitleOptional")),1),t("input",{value:i.title,type:"text",maxlength:"140",placeholder:"",class:"tool-input mt-1",disabled:i.busy,onInput:r[0]||(r[0]=d=>k("update:title",d.target.value))},null,40,gn)]),t("label",fn,[t("span",null,o(a(v)("projectManager.workingDirectoryField")),1),t("div",vn,[t("input",{value:i.cwd,type:"text",list:"codex-manager-workspace-suggestions",placeholder:"",class:P(["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:r[1]||(r[1]=d=>k("update:cwd",d.target.value))},null,42,hn),t("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:r[2]||(r[2]=d=>k("open-directory-picker"))},[S(a(ve),{class:"h-4 w-4"}),t("span",null,o(i.mobile?a(v)("projectManager.choose"):a(v)("projectManager.chooseDirectory")),1)],8,xn)]),t("datalist",yn,[(p(!0),f(xe,null,Ce(i.workspaceSuggestions,d=>(p(),f("option",{key:d,value:d},null,8,bn))),128))]),i.duplicateCwdMessage?(p(),f("p",wn,o(i.duplicateCwdMessage),1)):i.cwdReadonlyMessage?(p(),f("p",Sn,o(i.cwdReadonlyMessage),1)):j("",!0)]),t("label",kn,[t("span",null,o(a(v)("projectManager.engineField")),1),t("div",$n,[S(dt,{"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":d=>(d==null?void 0:d.value)||"","onUpdate:modelValue":r[3]||(r[3]=d=>k("update:engine",d))},{trigger:le(({disabled:d})=>{var w;return[t("div",_n,[t("span",{class:P(["min-w-0 flex-1 truncate",d?"theme-muted-text":"text-[var(--theme-textPrimary)]"])},o(((w=c.value)==null?void 0:w.label)||a(v)("projectManager.selectEngine")),3),c.value&&c.value.enabled===!1?(p(),f("span",Cn,o(a(v)("projectManager.comingSoon")),1)):j("",!0)])]}),option:le(({option:d,selected:w,select:L})=>[t("button",{type:"button",class:P(["w-full rounded-sm border border-dashed px-3 py-2 text-left text-sm transition",w?"theme-filter-active":"theme-filter-idle"]),disabled:(d==null?void 0:d.enabled)===!1,onClick:L},[t("div",jn,[t("span",In,o(d.label),1),(d==null?void 0:d.enabled)===!1?(p(),f("span",Pn,o(a(v)("projectManager.comingSoon")),1)):j("",!0)])],10,Mn)]),_:1},8,["model-value","options","disabled","placeholder","empty-text","get-option-value"])]),i.engineReadonlyMessage?(p(),f("p",Tn,o(i.engineReadonlyMessage),1)):j("",!0)]),t("label",Rn,[t("span",null,o(a(v)("projectManager.sessionId")),1),t("div",Dn,[t("input",{value:i.sessionId,type:"text",placeholder:"",class:"tool-input min-w-0 flex-1 disabled:cursor-not-allowed disabled:opacity-80",disabled:i.busy||!i.canEditSessionId,onInput:r[4]||(r[4]=d=>k("update:sessionId",d.target.value))},null,40,En),h.value?(p(),f("button",{key:0,type:"button",class:"tool-button inline-flex shrink-0 items-center gap-2 px-3 py-2 text-xs",disabled:i.busy,onClick:r[5]||(r[5]=d=>k("copy-session-id"))},[i.sessionIdCopied?(p(),se(a(Ke),{key:0,class:"h-4 w-4"})):(p(),se(a(yt),{key:1,class:"h-4 w-4"})),t("span",null,o(i.sessionIdCopied?a(v)("projectManager.sessionIdCopied"):a(v)("projectManager.copySessionId")),1)],8,Ln)):j("",!0)]),i.sessionIdReadonlyMessage?(p(),f("p",Fn,o(i.sessionIdReadonlyMessage),1)):(p(),f("p",Bn,o(a(v)("projectManager.sessionIdHint")),1))])]))}},An={class:"flex items-center justify-between gap-3"},Nn={class:"theme-heading text-sm font-medium"},On={key:0,class:"theme-muted-text mt-1 text-xs"},zn=["disabled"],Un=["onClick"],Hn={key:0,class:"theme-selection-indicator absolute inset-y-3 left-0 w-1 rounded-full"},Vn={class:"flex w-full flex-col gap-2 text-left"},qn={class:"theme-heading min-w-0 text-sm font-medium"},Wn=["title"],Gn=["title"],Jn={class:"theme-muted-text flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] leading-5"},Kn={key:0,"aria-hidden":"true"},Qn={key:1},Xn={class:"flex flex-wrap items-center gap-2 pt-1"},Yn={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},We={__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:T}){const u=i,k=T,{t:v}=ye();function c(r){return u.mode==="edit"&&u.editingSessionId===r.id?"theme-card-selected":u.isSessionRunning(r.id)?"theme-card-warning":"theme-card-idle-strong"}function h(r){return u.isCurrentSession(r.id)?v("projectManager.current"):v("projectManager.regular")}function M(r){return u.isCurrentSession(r.id)?"theme-status-info":"theme-status-neutral"}return(r,d)=>(p(),f("div",{class:P(i.mobile?"flex h-full min-h-0 flex-col":"")},[t("div",An,[t("div",null,[t("div",Nn,o(a(v)("projectManager.projectList")),1),i.hasSessions?j("",!0):(p(),f("p",On,o(a(v)("projectManager.noProjects")),1))]),t("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:d[0]||(d[0]=w=>k("create"))},[S(a(bt),{class:"h-4 w-4"}),t("span",null,o(a(v)("projectManager.create")),1)],8,zn)]),t("div",{class:P(["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,Ce(i.sessions,w=>(p(),f("article",{key:w.id,class:P(["relative cursor-pointer rounded-sm border p-3 transition",c(w)]),onClick:L=>k("select",w.id)},[i.mode==="edit"&&i.editingSessionId===w.id?(p(),f("span",Hn)):j("",!0),t("div",Vn,[t("div",qn,[t("span",{class:"block truncate",title:w.title||a(v)("projectManager.untitledProject")},o(w.title||a(v)("projectManager.untitledProject")),9,Wn)]),t("div",{class:"theme-muted-text break-all font-mono text-[11px] leading-5",title:w.cwd},o(w.cwd),9,Gn),t("div",Jn,[t("span",null,o(a(_e)(w.engine)),1),i.mobile?j("",!0):(p(),f("span",Kn,"·")),i.mobile?j("",!0):(p(),f("span",Qn,o(i.formatUpdatedAt(w.updatedAt)),1))]),t("div",Xn,[t("span",{class:P(["inline-flex shrink-0 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",M(w)])},o(h(w)),3),t("span",{class:P(["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(w.id)])},[i.isSessionRunning(w.id)?(p(),f("span",Yn)):j("",!0),Je(" "+o(i.getRuntimeStatusLabel(w.id)),1)],2),t("span",{class:P(["inline-flex shrink-0 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",i.getThreadStatusClass(w)])},o(i.getThreadStatusLabel(w)),3)])])],10,Un))),128))],2)],2))}},Zn={class:"space-y-3"},ea={class:"dashed-panel px-3 py-3"},ta={class:"theme-muted-text text-[11px]"},na={class:"mt-2 flex flex-wrap gap-2"},aa={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},sa={key:0,class:"theme-status-info inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs"},la={class:"dashed-panel px-3 py-3"},ia={class:"theme-muted-text text-[11px]"},oa={class:"mt-2 text-sm text-[var(--theme-textPrimary)]"},ra={class:"dashed-panel px-3 py-3"},da={class:"theme-muted-text text-[11px]"},ca={class:"mt-2 break-all font-mono text-xs leading-6 text-[var(--theme-textPrimary)]"},ua={class:"dashed-panel px-3 py-3"},pa={class:"theme-muted-text text-[11px]"},ma={class:"mt-2 text-sm text-[var(--theme-textPrimary)]"},ga={class:"dashed-panel px-3 py-3"},fa={class:"theme-muted-text inline-flex items-center gap-2 text-[11px]"},va={class:"mt-2 text-xs leading-6 text-[var(--theme-textSecondary)]"},ha={__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:T}=ye();return(u,k)=>{var v,c,h,M,r,d,w;return p(),f("div",Zn,[t("div",ea,[t("div",ta,o(a(T)("projectManager.runtimeStatus")),1),t("div",na,[t("span",{class:P(["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((c=i.activeSession)==null?void 0:c.id)?(p(),f("span",aa)):j("",!0),Je(" "+o(i.getRuntimeStatusLabel((h=i.activeSession)==null?void 0:h.id)),1)],2),t("span",{class:P(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",i.getThreadStatusClass(i.activeSession)])},o(i.getThreadStatusLabel(i.activeSession)),3),(M=i.activeSession)!=null&&M.id&&i.isCurrentSession(i.activeSession.id)?(p(),f("span",sa,o(a(T)("projectManager.currentProject")),1)):j("",!0)])]),t("div",la,[t("div",ia,o(a(T)("projectManager.engine")),1),t("div",oa,o(a(_e)((r=i.activeSession)==null?void 0:r.engine)),1)]),t("div",ra,[t("div",da,o(a(T)("projectManager.workingDirectory")),1),t("div",ca,o(((d=i.activeSession)==null?void 0:d.cwd)||a(T)("projectManager.notSet")),1)]),t("div",ua,[t("div",pa,o(a(T)("projectManager.updatedAt")),1),t("div",ma,o(i.formatUpdatedAt((w=i.activeSession)==null?void 0:w.updatedAt)),1)]),t("div",ga,[t("div",fa,[S(a(wt),{class:"h-3.5 w-3.5"}),t("span",null,o(a(T)("projectManager.note")),1)]),t("p",va,o(a(T)("projectManager.noteDescription")),1)])])}}},xa={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},ya={key:0,class:"grid min-h-0 flex-1 gap-0 lg:grid-cols-[minmax(0,300px)_minmax(0,1fr)]"},ba={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"},wa={class:"min-h-0 overflow-y-auto px-4 py-4 sm:px-5"},Sa={class:"flex flex-wrap items-start justify-between gap-3"},ka={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},$a={class:"mt-5"},_a={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},Ca={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"},Ma={class:"flex flex-wrap items-center gap-2"},ja=["disabled"],Ia=["disabled"],Pa={class:"flex flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:items-center"},Ta=["disabled"],Ra=["disabled"],Da=["disabled"],Ea={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},La={key:0,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Fa={class:"min-h-0 flex-1 overflow-hidden px-3 py-3"},Ba={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Aa={class:"theme-divider flex items-center gap-3 border-b px-4 py-3"},Na=["disabled"],Oa={class:"min-w-0 flex-1"},za={class:"theme-heading truncate text-sm font-medium"},Ua={key:0,class:"theme-muted-text mt-1 truncate text-xs"},Ha={class:"theme-divider border-b px-4 py-3"},Va={class:"grid grid-cols-2 gap-2"},qa=["disabled"],Wa={class:"min-h-0 flex-1 overflow-y-auto px-4 py-4"},Ga={key:0},Ja={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},Ka={class:"theme-divider mt-6 flex flex-col gap-3 border-t border-dashed pt-4"},Qa=["disabled"],Xa=["disabled"],Ya=["disabled"],is={__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},onReset:{type:Function,default:null}},emits:["close","project-created","select-session"],setup(i,{emit:T}){const u=i,k=T,{locale:v,t:c}=ye(),h=$("edit"),M=$(""),r=vt({title:"",engine:"codex",cwd:"",sessionId:""}),d=$(""),w=$(!1),L=$(!1),F=$(!1),R=$(!1),C=$(!1),E=$(!1),G=$(!1),B=$(!1),{matches:A}=ct("(max-width: 767px)"),J=$("list"),O=$("basic"),ie=$(Te());let V=null;const ne=_(()=>ke(u.sessions)),b=_(()=>u.sessions.find(e=>e.id===M.value)||null),Z=_(()=>u.sessions.length>0),Me=_(()=>u.sessions.find(e=>e.id===u.selectedSessionId)||null),ae=_(()=>!!(b.value&&z(b.value.id))),K=_(()=>{var e;return!((e=b.value)!=null&&e.started)}),oe=_(()=>{var e;return!((e=b.value)!=null&&e.started)}),q=_(()=>{var e;return!((e=b.value)!=null&&e.started)}),I=_(()=>u.loading||w.value||L.value||F.value||R.value),be=_(()=>String(r.sessionId||"").trim()),re=_(()=>{var x,y;const e=new Set,s=[];return[r.cwd,(x=b.value)==null?void 0:x.cwd,(y=Me.value)==null?void 0:y.cwd,...u.workspaces,...u.sessions.map(H=>H.cwd)].forEach(H=>{const N=String(H||"").trim();!N||e.has(N)||(e.add(N),s.push(N))}),s.slice(0,12)}),we=_(()=>ie.value),ee=_(()=>{const e=Se(r.cwd);return e?u.sessions.filter(s=>{var x;return s.id===((x=b.value)==null?void 0:x.id)?!1:Se(s.cwd)===e}):[]}),de=_(()=>{if(!ee.value.length)return"";const e=ee.value.slice(0,3).map(s=>{const x=s.title||c("projectManager.untitledProject");return v.value==="en-US"?`"${x}"`:`「${x}」`}).join(v.value==="en-US"?", ":"、");return c("projectManager.duplicateDirectory",{labels:e,count:ee.value.length})}),Q=_(()=>h.value!=="edit"||K.value?"":c("projectManager.cwdReadonly")),ce=_(()=>h.value!=="edit"||!b.value||oe.value?"":c("projectManager.engineReadonly")),X=_(()=>h.value!=="edit"||!b.value||q.value?"":c("projectManager.sessionIdReadonly")),ue=_(()=>h.value==="create"?w.value?c("projectManager.creatingProject"):c("projectManager.createProject"):L.value?c("projectManager.savingChanges"):c("projectManager.saveChanges")),je=_(()=>{var e;return h.value==="create"?c("projectManager.newProject"):((e=b.value)==null?void 0:e.title)||c("projectManager.untitledProject")});function pe(e=""){const s=Date.parse(String(e||""));return Number.isFinite(s)?s:0}function Se(e=""){const s=String(e||"").trim();if(!s)return"";const x=/^[a-z]:[\\/]/i.test(s)||s.includes("\\");let y=s.replace(/\\/g,"/");return y.length>1&&!/^[a-z]:\/$/i.test(y)&&(y=y.replace(/\/+$/,"")),x?y.toLowerCase():y}function z(e){var s;return!!((s=u.sessions.find(x=>x.id===e))!=null&&s.running)}function te(e){return!!e&&e===u.selectedSessionId}function ke(e=[]){return[...e].sort((s,x)=>{const y=Number(z(x.id))-Number(z(s.id));if(y)return y;const H=Number(te(x.id))-Number(te(s.id));if(H)return H;const N=pe(x.updatedAt)-pe(s.updatedAt);return N||lt(String(s.title||s.cwd||s.id),String(x.title||x.cwd||x.id))})}function me(e){return z(e)?c("projectManager.running"):c("projectManager.idle")}function ge(e){return z(e)?"theme-status-warning":"theme-status-success"}function fe(e){return e!=null&&e.started?c("projectManager.threadBound"):c("projectManager.notStarted")}function n(e){return e!=null&&e.started?"theme-status-success":"theme-status-neutral"}function m(e=""){if(!e)return c("projectManager.unknown");const s=new Date(e);return Number.isNaN(s.getTime())?e:st(s.toISOString(),{year:"numeric",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"})}function l(e){r.title=String((e==null?void 0:e.title)||""),r.engine=Pe(e==null?void 0:e.engine),r.cwd=String((e==null?void 0:e.cwd)||""),r.sessionId=String((e==null?void 0:e.sessionId)||(e==null?void 0:e.engineSessionId)||(e==null?void 0:e.engineThreadId)||(e==null?void 0:e.codexThreadId)||"").trim()}function g(){h.value="create",M.value="",d.value="",r.title="",r.engine="codex",r.cwd="",r.sessionId=""}function D(e){const s=u.sessions.find(x=>x.id===e);s&&(h.value="edit",M.value=s.id,d.value="",l(s))}function U(){var e;return u.selectedSessionId&&u.sessions.some(s=>s.id===u.selectedSessionId)?u.selectedSessionId:((e=ne.value[0])==null?void 0:e.id)||""}function $e(e="basic"){J.value="detail",O.value=e}function W(){J.value="list",O.value="basic"}function Y(){g(),A.value&&$e("basic")}function Re(e){I.value||(D(e),A.value&&$e("basic"))}function Qe(e){r.cwd=String(e||"").trim()}function De(e){r.title=String(e||"")}function Ee(e){r.engine=Pe(e)}function Le(e){r.cwd=String(e||"")}function Fe(e){r.sessionId=String(e||"")}function Be(){d.value="",C.value=!1,E.value=!1,B.value=!1,O.value="basic",J.value=A.value?"list":"detail";const e=U();if(e){D(e);return}g()}async function Xe(){if(!(I.value||typeof u.onRefresh!="function")){d.value="";try{await Promise.all([u.onRefresh(),Ae()])}catch(e){d.value=e.message}}}async function Ae(){try{ie.value=await jt()}catch{ie.value=Te()}}async function Ye(e){var x;if((x=navigator.clipboard)!=null&&x.writeText&&window.isSecureContext){await navigator.clipboard.writeText(e);return}const s=document.createElement("textarea");s.value=e,s.setAttribute("readonly","true"),s.style.position="fixed",s.style.opacity="0",s.style.pointerEvents="none",document.body.appendChild(s),s.select(),document.execCommand("copy"),document.body.removeChild(s)}async function Ne(){const e=be.value;if(e)try{await Ye(e),B.value=!0,V&&clearTimeout(V),V=setTimeout(()=>{B.value=!1,V=null},1800)}catch(s){d.value=(s==null?void 0:s.message)||c("projectManager.copySessionIdFailed")}}async function Oe(){if(!I.value){d.value="";try{const e=Ze();if(!e)return;await et(e)}catch(e){d.value=e.message}}}function Ze(){if(h.value==="create"){const s=String(r.cwd||"").trim();return s?{type:"create",cwd:s,payload:{title:r.title,engine:r.engine,cwd:s,sessionId:String(r.sessionId||"").trim()}}:(d.value=c("projectManager.directoryRequired"),null)}if(!b.value)return d.value=c("projectManager.projectMissing"),null;const e={title:r.title,engine:r.engine};return K.value&&(e.cwd=r.cwd),q.value&&(e.sessionId=String(r.sessionId||"").trim()),{type:"update",sessionId:b.value.id,payload:e}}async function et(e){var s,x;if(e.type==="create"){w.value=!0;try{const y=await((s=u.onCreate)==null?void 0:s.call(u,e.payload));y!=null&&y.id&&(D(y.id),k("select-session",y.id),await ht(),k("project-created",y),k("close"));return}finally{w.value=!1}}L.value=!0;try{const y=await((x=u.onUpdate)==null?void 0:x.call(u,e.sessionId,e.payload));y!=null&&y.id&&D(y.id)}finally{L.value=!1}}async function tt(){var s,x;if(!b.value||F.value)return;const e=b.value.id;d.value="",F.value=!0;try{const y=await((s=u.onDelete)==null?void 0:s.call(u,e));C.value=!1;const H=u.sessions.filter(at=>at.id!==e),N=(y==null?void 0:y.selectedSessionId)||((x=ke(H)[0])==null?void 0:x.id)||"";k("select-session",N),N?(D(N),A.value&&W()):(g(),A.value&&W())}catch(y){d.value=y.message}finally{F.value=!1}}async function nt(){var s;if(!b.value||R.value)return;const e=b.value.id;d.value="",R.value=!0;try{const x=await((s=u.onReset)==null?void 0:s.call(u,e));E.value=!1;const y=(x==null?void 0:x.session)||u.sessions.find(H=>H.id===e)||null;y!=null&&y.id&&D(y.id)}catch(x){d.value=x.message}finally{R.value=!1}}return he(()=>u.open,e=>{if(e){Be(),typeof u.onRefresh=="function"?Xe().catch(()=>{}):Ae().catch(()=>{});return}G.value=!1,C.value=!1,E.value=!1,B.value=!1,d.value=""},{immediate:!0}),he(A,e=>{e||(J.value="detail")},{immediate:!0}),he(()=>u.sessions,()=>{if(!u.open)return;if(h.value==="create"){if(!!(String(r.title||"").trim()||String(r.cwd||"").trim())||!!String(r.sessionId||"").trim())return;const x=U();x&&D(x);return}if(b.value){l(b.value);return}const e=U();if(e){D(e);return}g()}),ft(()=>{V&&(clearTimeout(V),V=null)}),(e,s)=>(p(),f(xe,null,[S(Ue,{open:E.value,title:a(c)("projectManager.confirmResetTitle"),description:b.value?a(c)("projectManager.confirmResetDescription",{title:b.value.title||a(c)("projectManager.untitledProject")}):"","confirm-text":a(c)("projectManager.confirmReset"),"cancel-text":a(c)("projectManager.keep"),loading:R.value,onCancel:s[0]||(s[0]=x=>E.value=!1),onConfirm:nt},null,8,["open","title","description","confirm-text","cancel-text","loading"]),S(Ue,{open:C.value,title:a(c)("projectManager.confirmDeleteTitle"),description:b.value?a(c)("projectManager.confirmDeleteDescription",{title:b.value.title||a(c)("projectManager.untitledProject")}):"","confirm-text":a(c)("projectManager.confirmDelete"),"cancel-text":a(c)("projectManager.keep"),loading:F.value,danger:"",onCancel:s[1]||(s[1]=x=>C.value=!1),onConfirm:tt},null,8,["open","title","description","confirm-text","cancel-text","loading"]),S(un,{open:G.value,"initial-path":r.cwd,suggestions:re.value,onClose:s[2]||(s[2]=x=>G.value=!1),onSelect:Qe},null,8,["open","initial-path","suggestions"]),S(Ge,{open:i.open,"panel-class":"settings-dialog-panel h-full max-w-5xl sm:h-auto sm:max-h-[88vh]","header-class":"settings-dialog-header px-5 py-4","body-class":"settings-dialog-body flex min-h-0 flex-1 overflow-hidden","close-disabled":I.value,"close-on-backdrop":!I.value,"close-on-escape":!I.value,onClose:s[12]||(s[12]=x=>k("close"))},{title:le(()=>[t("div",xa,[S(a(Ct),{class:"h-4 w-4"}),t("span",null,o(a(c)("projectManager.managingTitle")),1)])]),default:le(()=>{var x;return[a(A)?(p(),f("div",Ea,[J.value==="list"?(p(),f("div",La,[t("div",Fa,[S(We,{mobile:"",busy:I.value,"editing-session-id":M.value,"format-updated-at":m,"get-runtime-status-class":ge,"get-runtime-status-label":me,"get-thread-status-class":n,"get-thread-status-label":fe,"has-sessions":Z.value,"is-current-session":te,"is-session-running":z,mode:h.value,sessions:ne.value,onCreate:Y,onSelect:Re},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])])])):(p(),f("div",Ba,[t("div",Aa,[t("button",{type:"button",class:"tool-button inline-flex items-center gap-1.5 px-3 py-2 text-xs",disabled:I.value,onClick:W},[S(a(_t),{class:"h-4 w-4"}),t("span",null,o(a(c)("projectManager.projectList")),1)],8,Na),t("div",Oa,[t("div",za,o(je.value),1),h.value==="edit"&&((x=b.value)!=null&&x.cwd)?(p(),f("p",Ua,o(b.value.cwd),1)):j("",!0)])]),t("div",Ha,[t("div",Va,[t("button",{type:"button",class:P(["tool-button px-3 py-2 text-sm",O.value==="basic"?"tool-button-accent-subtle":""]),onClick:s[7]||(s[7]=y=>O.value="basic")},o(a(c)("projectManager.basicInfo")),3),t("button",{type:"button",class:P(["tool-button px-3 py-2 text-sm",O.value==="status"?"tool-button-accent-subtle":""]),disabled:h.value==="create",onClick:s[8]||(s[8]=y=>O.value="status")},o(a(c)("projectManager.status")),11,qa)])]),t("div",Wa,[O.value==="basic"?(p(),f("div",Ga,[S(qe,{mobile:"",busy:I.value,"can-edit-engine":h.value!=="edit"||oe.value,"can-edit-cwd":h.value!=="edit"||K.value,"can-edit-session-id":h.value!=="edit"||q.value,cwd:r.cwd,"cwd-readonly-message":Q.value,"duplicate-cwd-message":de.value,engine:r.engine,"engine-options":we.value,"engine-readonly-message":ce.value,"session-id":r.sessionId,"session-id-copied":B.value,"session-id-readonly-message":X.value,title:r.title,"workspace-suggestions":re.value,onCopySessionId:Ne,onOpenDirectoryPicker:s[9]||(s[9]=y=>G.value=!0),"onUpdate:cwd":Le,"onUpdate:engine":Ee,"onUpdate:sessionId":Fe,"onUpdate:title":De},null,8,["busy","can-edit-engine","can-edit-cwd","can-edit-session-id","cwd","cwd-readonly-message","duplicate-cwd-message","engine","engine-options","engine-readonly-message","session-id","session-id-copied","session-id-readonly-message","title","workspace-suggestions"]),d.value?(p(),f("p",Ja,[S(a(Ve),{class:"h-4 w-4"}),t("span",null,o(d.value),1)])):j("",!0),t("div",Ka,[t("button",{type:"button",class:"tool-button tool-button-primary w-full px-3 py-2 text-sm",disabled:I.value,onClick:Oe},o(ue.value),9,Qa),h.value==="edit"&&b.value?(p(),f("button",{key:0,type:"button",class:"tool-button w-full px-3 py-2 text-sm",disabled:I.value||ae.value,onClick:s[10]||(s[10]=y=>E.value=!0)},o(R.value?a(c)("projectManager.resettingSession"):a(c)("projectManager.newSession")),9,Xa)):j("",!0),h.value==="edit"&&b.value?(p(),f("button",{key:1,type:"button",class:"tool-button tool-button-danger-subtle w-full px-3 py-2 text-sm",disabled:I.value||ae.value,onClick:s[11]||(s[11]=y=>C.value=!0)},o(F.value?a(c)("projectManager.deletingProject"):a(c)("projectManager.deleteProject")),9,Ya)):j("",!0)])])):(p(),se(ha,{key:1,"active-session":b.value,"format-updated-at":m,"get-runtime-status-class":ge,"get-runtime-status-label":me,"get-thread-status-class":n,"get-thread-status-label":fe,"is-current-session":te,"is-session-running":z},null,8,["active-session"]))])]))])):(p(),f("div",ya,[t("aside",ba,[S(We,{busy:I.value,"editing-session-id":M.value,"format-updated-at":m,"get-runtime-status-class":ge,"get-runtime-status-label":me,"get-thread-status-class":n,"get-thread-status-label":fe,"has-sessions":Z.value,"is-current-session":te,"is-session-running":z,mode:h.value,sessions:ne.value,onCreate:Y,onSelect:Re},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])]),t("div",wa,[t("div",Sa,[t("div",null,[t("div",ka,[S(a(St),{class:"h-4 w-4"}),t("span",null,o(h.value==="create"?a(c)("projectManager.createTitle"):a(c)("projectManager.editTitle")),1)])])]),t("div",$a,[S(qe,{busy:I.value,"can-edit-engine":h.value!=="edit"||oe.value,"can-edit-cwd":h.value!=="edit"||K.value,"can-edit-session-id":h.value!=="edit"||q.value,cwd:r.cwd,"cwd-readonly-message":Q.value,"duplicate-cwd-message":de.value,engine:r.engine,"engine-options":we.value,"engine-readonly-message":ce.value,"session-id":r.sessionId,"session-id-copied":B.value,"session-id-readonly-message":X.value,title:r.title,"workspace-suggestions":re.value,onCopySessionId:Ne,onOpenDirectoryPicker:s[3]||(s[3]=y=>G.value=!0),"onUpdate:cwd":Le,"onUpdate:engine":Ee,"onUpdate:sessionId":Fe,"onUpdate:title":De},null,8,["busy","can-edit-engine","can-edit-cwd","can-edit-session-id","cwd","cwd-readonly-message","duplicate-cwd-message","engine","engine-options","engine-readonly-message","session-id","session-id-copied","session-id-readonly-message","title","workspace-suggestions"])]),d.value?(p(),f("p",_a,[S(a(Ve),{class:"h-4 w-4"}),t("span",null,o(d.value),1)])):j("",!0),t("div",Ca,[t("div",Ma,[h.value==="edit"&&b.value?(p(),f("button",{key:0,type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:I.value||ae.value,onClick:s[4]||(s[4]=y=>E.value=!0)},[S(a(kt),{class:"h-4 w-4"}),t("span",null,o(R.value?a(c)("projectManager.resettingSession"):a(c)("projectManager.newSession")),1)],8,ja)):j("",!0),h.value==="edit"&&b.value?(p(),f("button",{key:1,type:"button",class:"tool-button tool-button-danger-subtle inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:I.value||ae.value,onClick:s[5]||(s[5]=y=>C.value=!0)},[S(a($t),{class:"h-4 w-4"}),t("span",null,o(F.value?a(c)("projectManager.deletingProject"):a(c)("projectManager.deleteProject")),1)],8,Ia)):j("",!0)]),t("div",Pa,[t("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:I.value,onClick:s[6]||(s[6]=y=>k("close"))},o(a(c)("projectManager.close")),9,Ta),h.value==="create"&&Z.value?(p(),f("button",{key:0,type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:I.value,onClick:Be},o(a(c)("projectManager.backToList")),9,Ra)):j("",!0),t("button",{type:"button",class:"tool-button tool-button-primary w-full px-3 py-2 text-xs sm:w-auto",disabled:I.value,onClick:Oe},o(ue.value),9,Da)])])])]))]}),_:1},8,["open","close-disabled","close-on-backdrop","close-on-escape"])],64))}};export{is as default};
|
|
1
|
+
import{u as ye,f as st,c as lt}from"./index-Bd5S7OHB.js";import{A as it,n as Pe,e as _e,r as ot,b as Ge,s as rt,f as ze,_ as dt,a as ct,h as Ue}from"./WorkbenchView-D8Dofo5f.js";import{w as he,aB as p,aG as se,aH as le,aD as t,aO as o,u as a,aE as S,aU as ut,aV as pt,aJ as P,aC as f,aP as xe,aQ as Ce,aL as j,aT as mt,aI as gt,b as $,c as _,aX as Je,ak as ft,r as vt,n as ht}from"./vendor-misc-Dbi9Va04.js";import{g as He,h as ve,L as Ie,j as xt,b as Ke,H as yt,m as bt,v as wt,P as St,d as Ve,J as kt,l as $t,p as _t,K as Ct}from"./vendor-ui-CJHzyOOw.js";import"./vendor-router-D4MjzL9m.js";import"./vendor-markdown-CwTllcDY.js";import"./vendor-tiptap-DODYTmKM.js";function Mt(i=[]){return(Array.isArray(i)&&i.length?i:it).filter(u=>u&&typeof u=="object").map(u=>{const k=Pe(u.value);return{...u,value:k,label:String(u.label||_e(k)).trim()||_e(k),enabled:u.enabled!==!1,available:u.available!==!1}})}function Te(i=[]){return Mt(i).filter(T=>T.enabled&&T.available)}async function jt(){const i=await ot("/api/meta",{cache:"no-store"});return Te(i==null?void 0:i.agentEngineOptions)}const It={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},Pt={class:"theme-muted-text mt-1 text-xs leading-5"},Tt={class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Rt={class:"theme-divider mt-4 rounded-sm border border-dashed px-3 py-2"},Dt={class:"flex items-start gap-2 text-xs leading-5"},Et={class:"theme-muted-text shrink-0"},Lt={class:"min-w-0 break-all font-mono text-[var(--theme-textPrimary)]"},Ft={class:"theme-muted-text mt-4 block text-xs"},Bt={class:"theme-input-shell mt-1 flex h-10 items-center gap-2 rounded-sm border px-3 transition focus-within:ring-2"},At=["placeholder"],Nt={class:"mt-4 flex items-center gap-1.5"},Ot={class:"theme-content-panel mt-3 min-h-0 flex-1 overflow-y-auto p-2"},zt={key:0,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},Ut={key:1,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},Ht={key:2,class:"theme-empty-state flex items-center justify-center gap-2 px-3 py-8 text-sm"},Vt={key:3,class:"theme-empty-state flex items-center justify-center gap-2 px-3 py-8 text-sm"},qt={key:4,class:"theme-empty-state px-3 py-8 text-sm"},Wt={key:5,class:"theme-empty-state px-3 py-8 text-sm"},Gt={key:6,class:"theme-empty-state px-3 py-8 text-sm"},Jt={key:7,class:"space-y-1"},Kt=["onClick"],Qt={class:"min-w-0 flex-1"},Xt=["innerHTML"],Yt=["innerHTML"],Zt={key:0,class:"theme-muted-text px-1 pt-2 text-xs"},en={key:8,class:"space-y-1"},tn={class:"flex items-start gap-1.5"},nn=["onClick"],an=["onClick"],sn={class:"min-w-0 flex-1"},ln={key:0,class:"theme-muted-text truncate font-mono text-[10px]"},on={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"},rn={class:"flex flex-col-reverse gap-2 sm:flex-row sm:items-center"},dn=["disabled"],cn=["disabled"],un={__name:"CodexDirectoryPickerDialog",props:{open:{type:Boolean,default:!1},initialPath:{type:String,default:""},suggestions:{type:Array,default:()=>[]}},emits:["close","select"],setup(i,{emit:T}){const u=i,k=T,{t:v}=ye(),c=$(""),h=$(null),M=$(!1),r=$(""),d=$(!1),w=$(""),L=$([]),F=$(!1),R=$(""),C=$("tree"),E=$(""),G=$("");let B=null,A=0;const J=_(()=>de(h.value?[h.value]:[])),O=_(()=>C.value==="search"&&!R.value.trim()),ie=_(()=>C.value==="search"&&!!R.value.trim()&&!d.value&&!w.value&&!L.value.length),V=_(()=>C.value==="tree"&&!M.value&&!r.value&&!J.value.length);function ne(n=""){const m=String(n||"").trim();return/^[a-z]:[\\/]/i.test(m)||m.includes("\\")}function b(n=""){const m=String(n||"").trim();if(!m)return"";const l=ne(m);let g=m.replace(/\\/g,"/");return g.length>1&&!/^[a-z]:\/?$/i.test(g)&&g!=="/"&&(g=g.replace(/\/+$/,"")),l?g.toLowerCase():g}function Z(n="",m=""){const l=b(n),g=b(m);return!l||!g?!1:l===g||l.startsWith(`${g}/`)}function Me(n="",m=""){const l=String(n||"").trim(),g=String(m||"").trim();return l?g?ne(l)?/^[a-z]:\\?$/i.test(l)?`${l.replace(/[\\/]+$/,"")}\\${g}`:`${l.replace(/[\\/]+$/,"")}\\${g}`:l==="/"?`/${g}`:`${l.replace(/\/+$/,"")}/${g}`:l:g}function ae(n="",m=""){const l=b(n),g=b(m);if(!l||!g||!Z(g,l))return[];const D=g===l?"":g.slice(l.length).replace(/^\//,"");return D?D.split("/").filter(Boolean):[]}function K(n){return(n==null?void 0:n.name)||(n==null?void 0:n.path)||v("directoryPicker.unnamedDirectory")}function oe(n=""){const m=String(n||"").trim();return m?m.split(/[\\/]/).filter(Boolean).at(-1)||m:"Home"}function q(n=""){return String(n||"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function I(n="",m=""){const l=String(n||""),g=String(m||"").trim().toLowerCase();if(!l||!g)return null;const D=l.toLowerCase(),U=D.indexOf(g);if(U>=0)return{start:U,end:U+g.length};const $e=g.split(/[\\/\s_.-]+/).filter(Boolean).sort((W,Y)=>Y.length-W.length);for(const W of $e){if(W.length<2)continue;const Y=D.indexOf(W);if(Y>=0)return{start:Y,end:Y+W.length}}return null}function be(n="",m=""){const l=String(n||""),g=I(l,m);return g?`${q(l.slice(0,g.start))}<mark class="theme-search-highlight">${q(l.slice(g.start,g.end))}</mark>${q(l.slice(g.end))}`:q(l)}function re(n){return be(K(n),R.value)}function we(n){return be((n==null?void 0:n.path)||"",R.value)}function ee(n,m=0){return{...n,depth:m,expanded:!1,loaded:!1,loading:!1,children:[]}}function de(n=[],m=[]){return n.forEach(l=>{m.push(l),l.expanded&&l.children.length&&de(l.children,m)}),m}function Q(){h.value&&(h.value={...h.value})}function ce(n,m=h.value?[h.value]:[]){const l=b(n);if(!l)return null;for(const g of m){if(b(g.path)===l)return g;if(g.children.length){const D=ce(n,g.children);if(D)return D}}return null}function X(n){E.value=String((n==null?void 0:n.path)||"").trim(),G.value=K(n)}async function ue(n,m={}){if(!(!n||n.loading)&&!(n.loaded&&!m.force)){n.loading=!0,r.value="",Q();try{const l=await ze({path:n.path,limit:240});n.children=(l.items||[]).map(g=>ee(g,n.depth+1)),n.loaded=!0}catch(l){r.value=l.message||v("directoryPicker.loadFailed")}finally{n.loading=!1,Q()}}}async function je(){M.value=!0,r.value="";try{const n=await ze({limit:240});c.value=String(n.path||""),h.value=ee({name:oe(n.path||""),path:String(n.path||""),type:"directory",hasChildren:!0,isHomeRoot:!0},0),h.value.children=(n.items||[]).map(m=>ee(m,1)),h.value.loaded=!0,h.value.expanded=!0,X(h.value)}catch(n){r.value=n.message||v("directoryPicker.treeLoadFailed"),h.value=null,c.value=""}finally{M.value=!1}}async function pe(n=""){const m=String(n||"").trim();if(!m||!c.value||!Z(m,c.value))return;let l=h.value;if(!l)return;X(l);const g=ae(c.value,m);for(const D of g){await ue(l),l.expanded=!0,Q();const U=ce(Me(l.path,D),l.children);if(!U)break;l=U,X(l)}}async function Se(){R.value="",C.value="tree",L.value=[],w.value="",F.value=!1,E.value="",G.value="",await je();const n=String(u.initialPath||"").trim();n&&Z(n,c.value)&&await pe(n)}async function z(n){if(n!=null&&n.path&&(X(n),!!n.hasChildren)){if(!n.loaded){n.expanded=!0,Q(),await ue(n);return}n.expanded=!n.expanded,Q()}}function te(n){n!=null&&n.path&&(X(n),C.value="tree")}async function ke(){const n=String(R.value||"").trim();A+=1;const m=A;if(!u.open||!n||!c.value){d.value=!1,w.value="",L.value=[],F.value=!1;return}d.value=!0,w.value="";try{const l=await rt(n,{path:c.value,limit:80});if(m!==A)return;L.value=Array.isArray(l.items)?l.items:[],F.value=!!l.truncated}catch(l){if(m!==A)return;w.value=l.message||v("directoryPicker.searchFailed"),L.value=[],F.value=!1}finally{m===A&&(d.value=!1)}}function me(){if(B&&(window.clearTimeout(B),B=null),!String(R.value||"").trim()){d.value=!1,w.value="",L.value=[],F.value=!1;return}d.value=!0,w.value="",B=window.setTimeout(()=>{ke()},120)}async function ge(n){n!=null&&n.path&&(C.value="tree",await pe(n.path))}function fe(){E.value&&(k("select",E.value),k("close"))}return he(R,()=>{C.value=R.value.trim()?"search":"tree",me()}),he(()=>u.open,n=>{if(n){Se().catch(()=>{});return}B&&(window.clearTimeout(B),B=null)}),(n,m)=>(p(),se(Ge,{open:i.open,"backdrop-class":"z-[60] items-end justify-center px-0 py-0 sm:items-center sm:px-4 sm:py-6","panel-class":"settings-dialog-panel h-full max-w-4xl sm:h-auto sm:max-h-[86vh]","header-class":"settings-dialog-header px-5 py-4","body-class":"settings-dialog-body flex min-h-0 flex-1 flex-col overflow-hidden px-4 py-4 sm:px-5","close-disabled":M.value||d.value,"close-on-backdrop":!(M.value||d.value),"close-on-escape":!(M.value||d.value),onClose:m[4]||(m[4]=l=>k("close"))},{title:le(()=>[t("div",null,[t("div",It,[S(a(ve),{class:"h-4 w-4"}),t("span",null,o(a(v)("directoryPicker.title")),1)]),t("p",Pt,o(a(v)("directoryPicker.intro")),1)])]),default:le(()=>[t("div",Tt,[t("div",Rt,[t("div",Dt,[t("span",Et,o(a(v)("directoryPicker.currentSelection")),1),t("span",Lt,o(E.value||a(v)("directoryPicker.selectionPlaceholder")),1)])]),t("label",Ft,[t("span",null,o(a(v)("directoryPicker.searchLabel")),1),t("div",Bt,[S(a(He),{class:"h-4 w-4 shrink-0 text-[var(--theme-textMuted)]"}),ut(t("input",{"onUpdate:modelValue":m[0]||(m[0]=l=>R.value=l),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,At),[[pt,R.value]])])]),t("div",Nt,[t("button",{type:"button",class:P(["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:m[1]||(m[1]=l=>C.value="search")},[S(a(He),{class:"h-3.5 w-3.5"}),t("span",null,o(a(v)("directoryPicker.searchTab")),1)],2),t("button",{type:"button",class:P(["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:m[2]||(m[2]=l=>C.value="tree")},[S(a(ve),{class:"h-3.5 w-3.5"}),t("span",null,o(a(v)("directoryPicker.treeTab")),1)],2)]),t("div",Ot,[C.value==="search"&&w.value?(p(),f("div",zt,o(w.value),1)):C.value==="tree"&&r.value?(p(),f("div",Ut,o(r.value),1)):C.value==="search"&&d.value?(p(),f("div",Ht,[S(a(Ie),{class:"h-4 w-4 animate-spin"}),t("span",null,o(a(v)("directoryPicker.searching")),1)])):C.value==="tree"&&M.value?(p(),f("div",Vt,[S(a(Ie),{class:"h-4 w-4 animate-spin"}),t("span",null,o(a(v)("directoryPicker.treeLoading")),1)])):O.value?(p(),f("div",qt,o(a(v)("directoryPicker.searchPrompt")),1)):ie.value?(p(),f("div",Wt,o(a(v)("directoryPicker.noSearchResults")),1)):V.value?(p(),f("div",Gt,o(a(v)("directoryPicker.emptyTree")),1)):C.value==="search"?(p(),f("div",Jt,[(p(!0),f(xe,null,Ce(L.value,l=>(p(),f("button",{key:l.path,type:"button",class:P(["flex w-full items-start gap-2 rounded-sm border border-transparent px-2.5 py-1.5 text-left transition",b(E.value)===b(l.path)?"theme-list-item-active":"theme-list-item-hover"]),onClick:g=>ge(l)},[S(a(ve),{class:"theme-muted-text mt-0.5 h-4 w-4 shrink-0"}),t("div",Qt,[t("div",null,[t("span",{class:"truncate text-[13px] text-[var(--theme-textPrimary)]",innerHTML:re(l)},null,8,Xt)]),t("div",{class:"theme-muted-text truncate font-mono text-[10px]",innerHTML:we(l)},null,8,Yt)])],10,Kt))),128)),F.value?(p(),f("p",Zt,o(a(v)("directoryPicker.truncatedHint")),1)):j("",!0)])):(p(),f("div",en,[(p(!0),f(xe,null,Ce(J.value,l=>(p(),f("div",{key:l.path,class:P(["rounded-sm border border-transparent px-1.5 py-1 transition",b(E.value)===b(l.path)?"theme-list-item-active":l.expanded?"theme-list-item-expanded":"theme-list-item-hover"]),style:mt({paddingLeft:`${l.depth*16+6}px`})},[t("div",tn,[t("button",{type:"button",class:P(["theme-icon-button h-5 w-5 shrink-0",l.hasChildren?"":"invisible pointer-events-none"]),onClick:gt(g=>z(l),["stop"])},[l.loading?(p(),se(a(Ie),{key:0,class:"h-3.5 w-3.5 animate-spin"})):(p(),se(a(xt),{key:1,class:P(["h-3.5 w-3.5 transition",l.expanded?"rotate-90 text-[var(--theme-textPrimary)]":""])},null,8,["class"]))],10,nn),t("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:g=>te(l)},[S(a(ve),{class:P(["h-4 w-4 shrink-0",b(E.value)===b(l.path)?"text-[var(--theme-textPrimary)]":"text-[var(--theme-textMuted)]"])},null,8,["class"]),t("div",sn,[t("div",{class:P(["truncate text-[13px]",l.isHomeRoot?"font-medium text-[var(--theme-textSecondary)]":"font-medium text-[var(--theme-textPrimary)]"])},o(K(l)),3),l.isHomeRoot?(p(),f("div",ln,o(l.path),1)):j("",!0)])],8,an)])],6))),128))]))])]),t("div",on,[t("div",rn,[t("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:M.value||d.value,onClick:m[3]||(m[3]=l=>k("close"))},o(a(v)("directoryPicker.cancel")),9,dn),t("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:M.value||d.value||!E.value,onClick:fe},[S(a(Ke),{class:"h-4 w-4"}),t("span",null,o(a(v)("directoryPicker.useCurrentDirectory")),1)],8,cn)])])]),_:1},8,["open","close-disabled","close-on-backdrop","close-on-escape"]))}},pn={class:"grid gap-4"},mn={class:"theme-muted-text block text-xs"},gn=["value","disabled"],fn={class:"theme-muted-text block text-xs"},vn={class:"mt-1 flex gap-2"},hn=["value","disabled"],xn=["disabled"],yn={id:"codex-manager-workspace-suggestions"},bn=["value"],wn={key:0,class:"mt-2 text-[11px] leading-5 text-[var(--theme-warningText)]"},Sn={key:1,class:"theme-muted-text mt-2 text-[11px] leading-5"},kn={class:"theme-muted-text block text-xs"},$n={class:"mt-1"},_n={class:"flex items-center gap-2 text-sm"},Cn={key:0,class:"theme-muted-text rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]"},Mn=["disabled","onClick"],jn={class:"flex items-center justify-between gap-3"},In={class:"min-w-0 flex-1 truncate"},Pn={key:0,class:"theme-muted-text rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]"},Tn={key:0,class:"theme-muted-text mt-2 text-[11px] leading-5"},Rn={class:"theme-muted-text block text-xs"},Dn={class:"mt-1 flex gap-2"},En=["value","disabled"],Ln=["disabled"],Fn={key:0,class:"theme-muted-text mt-2 text-[11px] leading-5"},Bn={key:1,class:"theme-muted-text mt-2 text-[11px] leading-5"},qe={__name:"CodexSessionManagerForm",props:{busy:{type:Boolean,default:!1},canEditEngine:{type:Boolean,default:!0},canEditCwd:{type:Boolean,default:!0},canEditSessionId:{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},sessionId:{type:String,default:""},sessionIdCopied:{type:Boolean,default:!1},sessionIdReadonlyMessage:{type:String,default:""},title:{type:String,default:""},workspaceSuggestions:{type:Array,default:()=>[]}},emits:["copy-session-id","open-directory-picker","update:cwd","update:engine","update:sessionId","update:title"],setup(i,{emit:T}){const u=i,k=T,{t:v}=ye(),c=_(()=>{const M=String(u.engine||"").trim();return u.engineOptions.find(r=>String((r==null?void 0:r.value)||"").trim()===M)||null}),h=_(()=>String(u.sessionId||"").trim());return(M,r)=>(p(),f("div",pn,[t("label",mn,[t("span",null,o(a(v)("projectManager.projectTitleOptional")),1),t("input",{value:i.title,type:"text",maxlength:"140",placeholder:"",class:"tool-input mt-1",disabled:i.busy,onInput:r[0]||(r[0]=d=>k("update:title",d.target.value))},null,40,gn)]),t("label",fn,[t("span",null,o(a(v)("projectManager.workingDirectoryField")),1),t("div",vn,[t("input",{value:i.cwd,type:"text",list:"codex-manager-workspace-suggestions",placeholder:"",class:P(["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:r[1]||(r[1]=d=>k("update:cwd",d.target.value))},null,42,hn),t("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:r[2]||(r[2]=d=>k("open-directory-picker"))},[S(a(ve),{class:"h-4 w-4"}),t("span",null,o(i.mobile?a(v)("projectManager.choose"):a(v)("projectManager.chooseDirectory")),1)],8,xn)]),t("datalist",yn,[(p(!0),f(xe,null,Ce(i.workspaceSuggestions,d=>(p(),f("option",{key:d,value:d},null,8,bn))),128))]),i.duplicateCwdMessage?(p(),f("p",wn,o(i.duplicateCwdMessage),1)):i.cwdReadonlyMessage?(p(),f("p",Sn,o(i.cwdReadonlyMessage),1)):j("",!0)]),t("label",kn,[t("span",null,o(a(v)("projectManager.engineField")),1),t("div",$n,[S(dt,{"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":d=>(d==null?void 0:d.value)||"","onUpdate:modelValue":r[3]||(r[3]=d=>k("update:engine",d))},{trigger:le(({disabled:d})=>{var w;return[t("div",_n,[t("span",{class:P(["min-w-0 flex-1 truncate",d?"theme-muted-text":"text-[var(--theme-textPrimary)]"])},o(((w=c.value)==null?void 0:w.label)||a(v)("projectManager.selectEngine")),3),c.value&&c.value.enabled===!1?(p(),f("span",Cn,o(a(v)("projectManager.comingSoon")),1)):j("",!0)])]}),option:le(({option:d,selected:w,select:L})=>[t("button",{type:"button",class:P(["w-full rounded-sm border border-dashed px-3 py-2 text-left text-sm transition",w?"theme-filter-active":"theme-filter-idle"]),disabled:(d==null?void 0:d.enabled)===!1,onClick:L},[t("div",jn,[t("span",In,o(d.label),1),(d==null?void 0:d.enabled)===!1?(p(),f("span",Pn,o(a(v)("projectManager.comingSoon")),1)):j("",!0)])],10,Mn)]),_:1},8,["model-value","options","disabled","placeholder","empty-text","get-option-value"])]),i.engineReadonlyMessage?(p(),f("p",Tn,o(i.engineReadonlyMessage),1)):j("",!0)]),t("label",Rn,[t("span",null,o(a(v)("projectManager.sessionId")),1),t("div",Dn,[t("input",{value:i.sessionId,type:"text",placeholder:"",class:"tool-input min-w-0 flex-1 disabled:cursor-not-allowed disabled:opacity-80",disabled:i.busy||!i.canEditSessionId,onInput:r[4]||(r[4]=d=>k("update:sessionId",d.target.value))},null,40,En),h.value?(p(),f("button",{key:0,type:"button",class:"tool-button inline-flex shrink-0 items-center gap-2 px-3 py-2 text-xs",disabled:i.busy,onClick:r[5]||(r[5]=d=>k("copy-session-id"))},[i.sessionIdCopied?(p(),se(a(Ke),{key:0,class:"h-4 w-4"})):(p(),se(a(yt),{key:1,class:"h-4 w-4"})),t("span",null,o(i.sessionIdCopied?a(v)("projectManager.sessionIdCopied"):a(v)("projectManager.copySessionId")),1)],8,Ln)):j("",!0)]),i.sessionIdReadonlyMessage?(p(),f("p",Fn,o(i.sessionIdReadonlyMessage),1)):(p(),f("p",Bn,o(a(v)("projectManager.sessionIdHint")),1))])]))}},An={class:"flex items-center justify-between gap-3"},Nn={class:"theme-heading text-sm font-medium"},On={key:0,class:"theme-muted-text mt-1 text-xs"},zn=["disabled"],Un=["onClick"],Hn={key:0,class:"theme-selection-indicator absolute inset-y-3 left-0 w-1 rounded-full"},Vn={class:"flex w-full flex-col gap-2 text-left"},qn={class:"theme-heading min-w-0 text-sm font-medium"},Wn=["title"],Gn=["title"],Jn={class:"theme-muted-text flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] leading-5"},Kn={key:0,"aria-hidden":"true"},Qn={key:1},Xn={class:"flex flex-wrap items-center gap-2 pt-1"},Yn={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},We={__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:T}){const u=i,k=T,{t:v}=ye();function c(r){return u.mode==="edit"&&u.editingSessionId===r.id?"theme-card-selected":u.isSessionRunning(r.id)?"theme-card-warning":"theme-card-idle-strong"}function h(r){return u.isCurrentSession(r.id)?v("projectManager.current"):v("projectManager.regular")}function M(r){return u.isCurrentSession(r.id)?"theme-status-info":"theme-status-neutral"}return(r,d)=>(p(),f("div",{class:P(i.mobile?"flex h-full min-h-0 flex-col":"")},[t("div",An,[t("div",null,[t("div",Nn,o(a(v)("projectManager.projectList")),1),i.hasSessions?j("",!0):(p(),f("p",On,o(a(v)("projectManager.noProjects")),1))]),t("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:d[0]||(d[0]=w=>k("create"))},[S(a(bt),{class:"h-4 w-4"}),t("span",null,o(a(v)("projectManager.create")),1)],8,zn)]),t("div",{class:P(["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,Ce(i.sessions,w=>(p(),f("article",{key:w.id,class:P(["relative cursor-pointer rounded-sm border p-3 transition",c(w)]),onClick:L=>k("select",w.id)},[i.mode==="edit"&&i.editingSessionId===w.id?(p(),f("span",Hn)):j("",!0),t("div",Vn,[t("div",qn,[t("span",{class:"block truncate",title:w.title||a(v)("projectManager.untitledProject")},o(w.title||a(v)("projectManager.untitledProject")),9,Wn)]),t("div",{class:"theme-muted-text break-all font-mono text-[11px] leading-5",title:w.cwd},o(w.cwd),9,Gn),t("div",Jn,[t("span",null,o(a(_e)(w.engine)),1),i.mobile?j("",!0):(p(),f("span",Kn,"·")),i.mobile?j("",!0):(p(),f("span",Qn,o(i.formatUpdatedAt(w.updatedAt)),1))]),t("div",Xn,[t("span",{class:P(["inline-flex shrink-0 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",M(w)])},o(h(w)),3),t("span",{class:P(["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(w.id)])},[i.isSessionRunning(w.id)?(p(),f("span",Yn)):j("",!0),Je(" "+o(i.getRuntimeStatusLabel(w.id)),1)],2),t("span",{class:P(["inline-flex shrink-0 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",i.getThreadStatusClass(w)])},o(i.getThreadStatusLabel(w)),3)])])],10,Un))),128))],2)],2))}},Zn={class:"space-y-3"},ea={class:"dashed-panel px-3 py-3"},ta={class:"theme-muted-text text-[11px]"},na={class:"mt-2 flex flex-wrap gap-2"},aa={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},sa={key:0,class:"theme-status-info inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs"},la={class:"dashed-panel px-3 py-3"},ia={class:"theme-muted-text text-[11px]"},oa={class:"mt-2 text-sm text-[var(--theme-textPrimary)]"},ra={class:"dashed-panel px-3 py-3"},da={class:"theme-muted-text text-[11px]"},ca={class:"mt-2 break-all font-mono text-xs leading-6 text-[var(--theme-textPrimary)]"},ua={class:"dashed-panel px-3 py-3"},pa={class:"theme-muted-text text-[11px]"},ma={class:"mt-2 text-sm text-[var(--theme-textPrimary)]"},ga={class:"dashed-panel px-3 py-3"},fa={class:"theme-muted-text inline-flex items-center gap-2 text-[11px]"},va={class:"mt-2 text-xs leading-6 text-[var(--theme-textSecondary)]"},ha={__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:T}=ye();return(u,k)=>{var v,c,h,M,r,d,w;return p(),f("div",Zn,[t("div",ea,[t("div",ta,o(a(T)("projectManager.runtimeStatus")),1),t("div",na,[t("span",{class:P(["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((c=i.activeSession)==null?void 0:c.id)?(p(),f("span",aa)):j("",!0),Je(" "+o(i.getRuntimeStatusLabel((h=i.activeSession)==null?void 0:h.id)),1)],2),t("span",{class:P(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",i.getThreadStatusClass(i.activeSession)])},o(i.getThreadStatusLabel(i.activeSession)),3),(M=i.activeSession)!=null&&M.id&&i.isCurrentSession(i.activeSession.id)?(p(),f("span",sa,o(a(T)("projectManager.currentProject")),1)):j("",!0)])]),t("div",la,[t("div",ia,o(a(T)("projectManager.engine")),1),t("div",oa,o(a(_e)((r=i.activeSession)==null?void 0:r.engine)),1)]),t("div",ra,[t("div",da,o(a(T)("projectManager.workingDirectory")),1),t("div",ca,o(((d=i.activeSession)==null?void 0:d.cwd)||a(T)("projectManager.notSet")),1)]),t("div",ua,[t("div",pa,o(a(T)("projectManager.updatedAt")),1),t("div",ma,o(i.formatUpdatedAt((w=i.activeSession)==null?void 0:w.updatedAt)),1)]),t("div",ga,[t("div",fa,[S(a(wt),{class:"h-3.5 w-3.5"}),t("span",null,o(a(T)("projectManager.note")),1)]),t("p",va,o(a(T)("projectManager.noteDescription")),1)])])}}},xa={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},ya={key:0,class:"grid min-h-0 flex-1 gap-0 lg:grid-cols-[minmax(0,300px)_minmax(0,1fr)]"},ba={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"},wa={class:"min-h-0 overflow-y-auto px-4 py-4 sm:px-5"},Sa={class:"flex flex-wrap items-start justify-between gap-3"},ka={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},$a={class:"mt-5"},_a={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},Ca={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"},Ma={class:"flex flex-wrap items-center gap-2"},ja=["disabled"],Ia=["disabled"],Pa={class:"flex flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:items-center"},Ta=["disabled"],Ra=["disabled"],Da=["disabled"],Ea={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},La={key:0,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Fa={class:"min-h-0 flex-1 overflow-hidden px-3 py-3"},Ba={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Aa={class:"theme-divider flex items-center gap-3 border-b px-4 py-3"},Na=["disabled"],Oa={class:"min-w-0 flex-1"},za={class:"theme-heading truncate text-sm font-medium"},Ua={key:0,class:"theme-muted-text mt-1 truncate text-xs"},Ha={class:"theme-divider border-b px-4 py-3"},Va={class:"grid grid-cols-2 gap-2"},qa=["disabled"],Wa={class:"min-h-0 flex-1 overflow-y-auto px-4 py-4"},Ga={key:0},Ja={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},Ka={class:"theme-divider mt-6 flex flex-col gap-3 border-t border-dashed pt-4"},Qa=["disabled"],Xa=["disabled"],Ya=["disabled"],is={__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},onReset:{type:Function,default:null}},emits:["close","project-created","select-session"],setup(i,{emit:T}){const u=i,k=T,{locale:v,t:c}=ye(),h=$("edit"),M=$(""),r=vt({title:"",engine:"codex",cwd:"",sessionId:""}),d=$(""),w=$(!1),L=$(!1),F=$(!1),R=$(!1),C=$(!1),E=$(!1),G=$(!1),B=$(!1),{matches:A}=ct("(max-width: 767px)"),J=$("list"),O=$("basic"),ie=$(Te());let V=null;const ne=_(()=>ke(u.sessions)),b=_(()=>u.sessions.find(e=>e.id===M.value)||null),Z=_(()=>u.sessions.length>0),Me=_(()=>u.sessions.find(e=>e.id===u.selectedSessionId)||null),ae=_(()=>!!(b.value&&z(b.value.id))),K=_(()=>{var e;return!((e=b.value)!=null&&e.started)}),oe=_(()=>{var e;return!((e=b.value)!=null&&e.started)}),q=_(()=>{var e;return!((e=b.value)!=null&&e.started)}),I=_(()=>u.loading||w.value||L.value||F.value||R.value),be=_(()=>String(r.sessionId||"").trim()),re=_(()=>{var x,y;const e=new Set,s=[];return[r.cwd,(x=b.value)==null?void 0:x.cwd,(y=Me.value)==null?void 0:y.cwd,...u.workspaces,...u.sessions.map(H=>H.cwd)].forEach(H=>{const N=String(H||"").trim();!N||e.has(N)||(e.add(N),s.push(N))}),s.slice(0,12)}),we=_(()=>ie.value),ee=_(()=>{const e=Se(r.cwd);return e?u.sessions.filter(s=>{var x;return s.id===((x=b.value)==null?void 0:x.id)?!1:Se(s.cwd)===e}):[]}),de=_(()=>{if(!ee.value.length)return"";const e=ee.value.slice(0,3).map(s=>{const x=s.title||c("projectManager.untitledProject");return v.value==="en-US"?`"${x}"`:`「${x}」`}).join(v.value==="en-US"?", ":"、");return c("projectManager.duplicateDirectory",{labels:e,count:ee.value.length})}),Q=_(()=>h.value!=="edit"||K.value?"":c("projectManager.cwdReadonly")),ce=_(()=>h.value!=="edit"||!b.value||oe.value?"":c("projectManager.engineReadonly")),X=_(()=>h.value!=="edit"||!b.value||q.value?"":c("projectManager.sessionIdReadonly")),ue=_(()=>h.value==="create"?w.value?c("projectManager.creatingProject"):c("projectManager.createProject"):L.value?c("projectManager.savingChanges"):c("projectManager.saveChanges")),je=_(()=>{var e;return h.value==="create"?c("projectManager.newProject"):((e=b.value)==null?void 0:e.title)||c("projectManager.untitledProject")});function pe(e=""){const s=Date.parse(String(e||""));return Number.isFinite(s)?s:0}function Se(e=""){const s=String(e||"").trim();if(!s)return"";const x=/^[a-z]:[\\/]/i.test(s)||s.includes("\\");let y=s.replace(/\\/g,"/");return y.length>1&&!/^[a-z]:\/$/i.test(y)&&(y=y.replace(/\/+$/,"")),x?y.toLowerCase():y}function z(e){var s;return!!((s=u.sessions.find(x=>x.id===e))!=null&&s.running)}function te(e){return!!e&&e===u.selectedSessionId}function ke(e=[]){return[...e].sort((s,x)=>{const y=Number(z(x.id))-Number(z(s.id));if(y)return y;const H=Number(te(x.id))-Number(te(s.id));if(H)return H;const N=pe(x.updatedAt)-pe(s.updatedAt);return N||lt(String(s.title||s.cwd||s.id),String(x.title||x.cwd||x.id))})}function me(e){return z(e)?c("projectManager.running"):c("projectManager.idle")}function ge(e){return z(e)?"theme-status-warning":"theme-status-success"}function fe(e){return e!=null&&e.started?c("projectManager.threadBound"):c("projectManager.notStarted")}function n(e){return e!=null&&e.started?"theme-status-success":"theme-status-neutral"}function m(e=""){if(!e)return c("projectManager.unknown");const s=new Date(e);return Number.isNaN(s.getTime())?e:st(s.toISOString(),{year:"numeric",month:"numeric",day:"numeric",hour:"2-digit",minute:"2-digit"})}function l(e){r.title=String((e==null?void 0:e.title)||""),r.engine=Pe(e==null?void 0:e.engine),r.cwd=String((e==null?void 0:e.cwd)||""),r.sessionId=String((e==null?void 0:e.sessionId)||(e==null?void 0:e.engineSessionId)||(e==null?void 0:e.engineThreadId)||(e==null?void 0:e.codexThreadId)||"").trim()}function g(){h.value="create",M.value="",d.value="",r.title="",r.engine="codex",r.cwd="",r.sessionId=""}function D(e){const s=u.sessions.find(x=>x.id===e);s&&(h.value="edit",M.value=s.id,d.value="",l(s))}function U(){var e;return u.selectedSessionId&&u.sessions.some(s=>s.id===u.selectedSessionId)?u.selectedSessionId:((e=ne.value[0])==null?void 0:e.id)||""}function $e(e="basic"){J.value="detail",O.value=e}function W(){J.value="list",O.value="basic"}function Y(){g(),A.value&&$e("basic")}function Re(e){I.value||(D(e),A.value&&$e("basic"))}function Qe(e){r.cwd=String(e||"").trim()}function De(e){r.title=String(e||"")}function Ee(e){r.engine=Pe(e)}function Le(e){r.cwd=String(e||"")}function Fe(e){r.sessionId=String(e||"")}function Be(){d.value="",C.value=!1,E.value=!1,B.value=!1,O.value="basic",J.value=A.value?"list":"detail";const e=U();if(e){D(e);return}g()}async function Xe(){if(!(I.value||typeof u.onRefresh!="function")){d.value="";try{await Promise.all([u.onRefresh(),Ae()])}catch(e){d.value=e.message}}}async function Ae(){try{ie.value=await jt()}catch{ie.value=Te()}}async function Ye(e){var x;if((x=navigator.clipboard)!=null&&x.writeText&&window.isSecureContext){await navigator.clipboard.writeText(e);return}const s=document.createElement("textarea");s.value=e,s.setAttribute("readonly","true"),s.style.position="fixed",s.style.opacity="0",s.style.pointerEvents="none",document.body.appendChild(s),s.select(),document.execCommand("copy"),document.body.removeChild(s)}async function Ne(){const e=be.value;if(e)try{await Ye(e),B.value=!0,V&&clearTimeout(V),V=setTimeout(()=>{B.value=!1,V=null},1800)}catch(s){d.value=(s==null?void 0:s.message)||c("projectManager.copySessionIdFailed")}}async function Oe(){if(!I.value){d.value="";try{const e=Ze();if(!e)return;await et(e)}catch(e){d.value=e.message}}}function Ze(){if(h.value==="create"){const s=String(r.cwd||"").trim();return s?{type:"create",cwd:s,payload:{title:r.title,engine:r.engine,cwd:s,sessionId:String(r.sessionId||"").trim()}}:(d.value=c("projectManager.directoryRequired"),null)}if(!b.value)return d.value=c("projectManager.projectMissing"),null;const e={title:r.title,engine:r.engine};return K.value&&(e.cwd=r.cwd),q.value&&(e.sessionId=String(r.sessionId||"").trim()),{type:"update",sessionId:b.value.id,payload:e}}async function et(e){var s,x;if(e.type==="create"){w.value=!0;try{const y=await((s=u.onCreate)==null?void 0:s.call(u,e.payload));y!=null&&y.id&&(D(y.id),k("select-session",y.id),await ht(),k("project-created",y),k("close"));return}finally{w.value=!1}}L.value=!0;try{const y=await((x=u.onUpdate)==null?void 0:x.call(u,e.sessionId,e.payload));y!=null&&y.id&&D(y.id)}finally{L.value=!1}}async function tt(){var s,x;if(!b.value||F.value)return;const e=b.value.id;d.value="",F.value=!0;try{const y=await((s=u.onDelete)==null?void 0:s.call(u,e));C.value=!1;const H=u.sessions.filter(at=>at.id!==e),N=(y==null?void 0:y.selectedSessionId)||((x=ke(H)[0])==null?void 0:x.id)||"";k("select-session",N),N?(D(N),A.value&&W()):(g(),A.value&&W())}catch(y){d.value=y.message}finally{F.value=!1}}async function nt(){var s;if(!b.value||R.value)return;const e=b.value.id;d.value="",R.value=!0;try{const x=await((s=u.onReset)==null?void 0:s.call(u,e));E.value=!1;const y=(x==null?void 0:x.session)||u.sessions.find(H=>H.id===e)||null;y!=null&&y.id&&D(y.id)}catch(x){d.value=x.message}finally{R.value=!1}}return he(()=>u.open,e=>{if(e){Be(),typeof u.onRefresh=="function"?Xe().catch(()=>{}):Ae().catch(()=>{});return}G.value=!1,C.value=!1,E.value=!1,B.value=!1,d.value=""},{immediate:!0}),he(A,e=>{e||(J.value="detail")},{immediate:!0}),he(()=>u.sessions,()=>{if(!u.open)return;if(h.value==="create"){if(!!(String(r.title||"").trim()||String(r.cwd||"").trim())||!!String(r.sessionId||"").trim())return;const x=U();x&&D(x);return}if(b.value){l(b.value);return}const e=U();if(e){D(e);return}g()}),ft(()=>{V&&(clearTimeout(V),V=null)}),(e,s)=>(p(),f(xe,null,[S(Ue,{open:E.value,title:a(c)("projectManager.confirmResetTitle"),description:b.value?a(c)("projectManager.confirmResetDescription",{title:b.value.title||a(c)("projectManager.untitledProject")}):"","confirm-text":a(c)("projectManager.confirmReset"),"cancel-text":a(c)("projectManager.keep"),loading:R.value,onCancel:s[0]||(s[0]=x=>E.value=!1),onConfirm:nt},null,8,["open","title","description","confirm-text","cancel-text","loading"]),S(Ue,{open:C.value,title:a(c)("projectManager.confirmDeleteTitle"),description:b.value?a(c)("projectManager.confirmDeleteDescription",{title:b.value.title||a(c)("projectManager.untitledProject")}):"","confirm-text":a(c)("projectManager.confirmDelete"),"cancel-text":a(c)("projectManager.keep"),loading:F.value,danger:"",onCancel:s[1]||(s[1]=x=>C.value=!1),onConfirm:tt},null,8,["open","title","description","confirm-text","cancel-text","loading"]),S(un,{open:G.value,"initial-path":r.cwd,suggestions:re.value,onClose:s[2]||(s[2]=x=>G.value=!1),onSelect:Qe},null,8,["open","initial-path","suggestions"]),S(Ge,{open:i.open,"panel-class":"settings-dialog-panel h-full max-w-5xl sm:h-auto sm:max-h-[88vh]","header-class":"settings-dialog-header px-5 py-4","body-class":"settings-dialog-body flex min-h-0 flex-1 overflow-hidden","close-disabled":I.value,"close-on-backdrop":!I.value,"close-on-escape":!I.value,onClose:s[12]||(s[12]=x=>k("close"))},{title:le(()=>[t("div",xa,[S(a(Ct),{class:"h-4 w-4"}),t("span",null,o(a(c)("projectManager.managingTitle")),1)])]),default:le(()=>{var x;return[a(A)?(p(),f("div",Ea,[J.value==="list"?(p(),f("div",La,[t("div",Fa,[S(We,{mobile:"",busy:I.value,"editing-session-id":M.value,"format-updated-at":m,"get-runtime-status-class":ge,"get-runtime-status-label":me,"get-thread-status-class":n,"get-thread-status-label":fe,"has-sessions":Z.value,"is-current-session":te,"is-session-running":z,mode:h.value,sessions:ne.value,onCreate:Y,onSelect:Re},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])])])):(p(),f("div",Ba,[t("div",Aa,[t("button",{type:"button",class:"tool-button inline-flex items-center gap-1.5 px-3 py-2 text-xs",disabled:I.value,onClick:W},[S(a(_t),{class:"h-4 w-4"}),t("span",null,o(a(c)("projectManager.projectList")),1)],8,Na),t("div",Oa,[t("div",za,o(je.value),1),h.value==="edit"&&((x=b.value)!=null&&x.cwd)?(p(),f("p",Ua,o(b.value.cwd),1)):j("",!0)])]),t("div",Ha,[t("div",Va,[t("button",{type:"button",class:P(["tool-button px-3 py-2 text-sm",O.value==="basic"?"tool-button-accent-subtle":""]),onClick:s[7]||(s[7]=y=>O.value="basic")},o(a(c)("projectManager.basicInfo")),3),t("button",{type:"button",class:P(["tool-button px-3 py-2 text-sm",O.value==="status"?"tool-button-accent-subtle":""]),disabled:h.value==="create",onClick:s[8]||(s[8]=y=>O.value="status")},o(a(c)("projectManager.status")),11,qa)])]),t("div",Wa,[O.value==="basic"?(p(),f("div",Ga,[S(qe,{mobile:"",busy:I.value,"can-edit-engine":h.value!=="edit"||oe.value,"can-edit-cwd":h.value!=="edit"||K.value,"can-edit-session-id":h.value!=="edit"||q.value,cwd:r.cwd,"cwd-readonly-message":Q.value,"duplicate-cwd-message":de.value,engine:r.engine,"engine-options":we.value,"engine-readonly-message":ce.value,"session-id":r.sessionId,"session-id-copied":B.value,"session-id-readonly-message":X.value,title:r.title,"workspace-suggestions":re.value,onCopySessionId:Ne,onOpenDirectoryPicker:s[9]||(s[9]=y=>G.value=!0),"onUpdate:cwd":Le,"onUpdate:engine":Ee,"onUpdate:sessionId":Fe,"onUpdate:title":De},null,8,["busy","can-edit-engine","can-edit-cwd","can-edit-session-id","cwd","cwd-readonly-message","duplicate-cwd-message","engine","engine-options","engine-readonly-message","session-id","session-id-copied","session-id-readonly-message","title","workspace-suggestions"]),d.value?(p(),f("p",Ja,[S(a(Ve),{class:"h-4 w-4"}),t("span",null,o(d.value),1)])):j("",!0),t("div",Ka,[t("button",{type:"button",class:"tool-button tool-button-primary w-full px-3 py-2 text-sm",disabled:I.value,onClick:Oe},o(ue.value),9,Qa),h.value==="edit"&&b.value?(p(),f("button",{key:0,type:"button",class:"tool-button w-full px-3 py-2 text-sm",disabled:I.value||ae.value,onClick:s[10]||(s[10]=y=>E.value=!0)},o(R.value?a(c)("projectManager.resettingSession"):a(c)("projectManager.newSession")),9,Xa)):j("",!0),h.value==="edit"&&b.value?(p(),f("button",{key:1,type:"button",class:"tool-button tool-button-danger-subtle w-full px-3 py-2 text-sm",disabled:I.value||ae.value,onClick:s[11]||(s[11]=y=>C.value=!0)},o(F.value?a(c)("projectManager.deletingProject"):a(c)("projectManager.deleteProject")),9,Ya)):j("",!0)])])):(p(),se(ha,{key:1,"active-session":b.value,"format-updated-at":m,"get-runtime-status-class":ge,"get-runtime-status-label":me,"get-thread-status-class":n,"get-thread-status-label":fe,"is-current-session":te,"is-session-running":z},null,8,["active-session"]))])]))])):(p(),f("div",ya,[t("aside",ba,[S(We,{busy:I.value,"editing-session-id":M.value,"format-updated-at":m,"get-runtime-status-class":ge,"get-runtime-status-label":me,"get-thread-status-class":n,"get-thread-status-label":fe,"has-sessions":Z.value,"is-current-session":te,"is-session-running":z,mode:h.value,sessions:ne.value,onCreate:Y,onSelect:Re},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])]),t("div",wa,[t("div",Sa,[t("div",null,[t("div",ka,[S(a(St),{class:"h-4 w-4"}),t("span",null,o(h.value==="create"?a(c)("projectManager.createTitle"):a(c)("projectManager.editTitle")),1)])])]),t("div",$a,[S(qe,{busy:I.value,"can-edit-engine":h.value!=="edit"||oe.value,"can-edit-cwd":h.value!=="edit"||K.value,"can-edit-session-id":h.value!=="edit"||q.value,cwd:r.cwd,"cwd-readonly-message":Q.value,"duplicate-cwd-message":de.value,engine:r.engine,"engine-options":we.value,"engine-readonly-message":ce.value,"session-id":r.sessionId,"session-id-copied":B.value,"session-id-readonly-message":X.value,title:r.title,"workspace-suggestions":re.value,onCopySessionId:Ne,onOpenDirectoryPicker:s[3]||(s[3]=y=>G.value=!0),"onUpdate:cwd":Le,"onUpdate:engine":Ee,"onUpdate:sessionId":Fe,"onUpdate:title":De},null,8,["busy","can-edit-engine","can-edit-cwd","can-edit-session-id","cwd","cwd-readonly-message","duplicate-cwd-message","engine","engine-options","engine-readonly-message","session-id","session-id-copied","session-id-readonly-message","title","workspace-suggestions"])]),d.value?(p(),f("p",_a,[S(a(Ve),{class:"h-4 w-4"}),t("span",null,o(d.value),1)])):j("",!0),t("div",Ca,[t("div",Ma,[h.value==="edit"&&b.value?(p(),f("button",{key:0,type:"button",class:"tool-button inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:I.value||ae.value,onClick:s[4]||(s[4]=y=>E.value=!0)},[S(a(kt),{class:"h-4 w-4"}),t("span",null,o(R.value?a(c)("projectManager.resettingSession"):a(c)("projectManager.newSession")),1)],8,ja)):j("",!0),h.value==="edit"&&b.value?(p(),f("button",{key:1,type:"button",class:"tool-button tool-button-danger-subtle inline-flex items-center gap-2 px-3 py-2 text-xs",disabled:I.value||ae.value,onClick:s[5]||(s[5]=y=>C.value=!0)},[S(a($t),{class:"h-4 w-4"}),t("span",null,o(F.value?a(c)("projectManager.deletingProject"):a(c)("projectManager.deleteProject")),1)],8,Ia)):j("",!0)]),t("div",Pa,[t("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:I.value,onClick:s[6]||(s[6]=y=>k("close"))},o(a(c)("projectManager.close")),9,Ta),h.value==="create"&&Z.value?(p(),f("button",{key:0,type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:I.value,onClick:Be},o(a(c)("projectManager.backToList")),9,Ra)):j("",!0),t("button",{type:"button",class:"tool-button tool-button-primary w-full px-3 py-2 text-xs sm:w-auto",disabled:I.value,onClick:Oe},o(ue.value),9,Da)])])])]))]}),_:1},8,["open","close-disabled","close-on-backdrop","close-on-escape"])],64))}};export{is as default};
|