@muyichengshayu/promptx 0.1.27 → 0.1.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.1.29
4
+
5
+ - 重做执行过程 detail 展示:新增结构化解析与渲染,针对 `Codex / Claude Code / OpenCode` 的过程事件统一支持待办列表、代码块、行号片段、XML-like 输出、编号列表、Markdown 表格/列表等内容,排版更稳定、更接近原生 CLI。
6
+ - 收敛执行过程样式细节:统一过程卡片、胶囊与详情区的字体、代码字体、长命令换行、圆角与主题表现;隐藏“已连接项目 / 会话已创建 / 已返回结果 / 本轮执行结束”等低价值系统噪音,提升过程区可读性。
7
+ - 修复 Claude / OpenCode 的待办展示:不再只显示“待办列表连续更新 N 次”,改为展示真实 checklist;同时补齐 Claude 401 认证错误识别与 fail-fast,避免在 PromptX 中一直卡住无反馈。
8
+ - 修复 Codex 同一轮运行中待办卡片重复且状态滞后的问题:同一轮执行现在只保留最新一张待办快照,避免用户看到旧的 `2/3` 卡片,最终完成态能稳定显示为 `3/3`。
9
+
10
+ ## 0.1.28
11
+
12
+ - 项目管理新增“新会话”能力:可一键清空当前项目绑定的线程/会话信息,并在下一次运行时从全新会话重新开始,行为更接近 Codex / Claude Code / OpenCode 里的 `/new`。
13
+ - “新会话”会同时清空该项目下所有任务的执行历史,但保留项目本身、工作目录、执行引擎配置以及右侧编辑区内容,避免新旧会话结果混在一起。
14
+ - 运行中的项目会被禁止执行“新会话”,并补充前后端提示、确认弹窗、中英双语文案与自动化测试,确保这条重置链路可用且稳定。
15
+
3
16
  ## 0.1.27
4
17
 
5
18
  - 左侧任务列表新增桌面端拖拽排序能力,并改用 `vue-draggable-plus` 接管交互,拖拽手感、占位反馈与排序稳定性更好。
package/README.en.md CHANGED
@@ -12,6 +12,11 @@ Task -> Project -> Directory -> Thread -> Run -> Diff
12
12
 
13
13
  You keep using the agent CLI you already know, while PromptX brings inputs, project binding, execution logs, final replies, and code diffs into one workspace.
14
14
 
15
+ PromptX can also reuse sessions with these agent CLIs in both directions:
16
+
17
+ - Start a session in `Codex`, `Claude Code`, or `OpenCode`, then continue it inside PromptX
18
+ - Start and advance a project inside PromptX, then resume the same session back in the agent CLI
19
+
15
20
  ## Quick Start
16
21
 
17
22
  ### Requirements
@@ -54,6 +59,7 @@ promptx stop
54
59
  - Visible process: inspect logs, final replies, and run history
55
60
  - Built-in diff review: inspect workspace, accumulated task, or per-run changes
56
61
  - Multi-engine support: `Codex`, `Claude Code`, `OpenCode`
62
+ - Session interoperability: PromptX can reuse sessions with `Codex`, `Claude Code`, and `OpenCode`
57
63
  - Remote access: connect from mobile or external networks through Relay
58
64
 
59
65
  ## Screenshots
package/README.md CHANGED
@@ -12,6 +12,11 @@ PromptX 是一个面向本机 AI Agent 协作的工作台。
12
12
 
13
13
  你继续使用熟悉的 agent CLI,PromptX 负责把输入整理、项目绑定、执行过程、最终回复和代码变更放进同一个工作台里。
14
14
 
15
+ 并且,PromptX 和这些 agent CLI 之间可以互相复用会话:
16
+
17
+ - 可以在 `Codex`、`Claude Code`、`OpenCode` 里先创建会话,再回到 PromptX 里继续
18
+ - 也可以在 PromptX 里创建和推进项目,再回到 agent CLI 里直接恢复同一个会话
19
+
15
20
  ## 快速开始
16
21
 
17
22
  ### 运行前提
@@ -54,6 +59,7 @@ promptx stop
54
59
  - 过程可见:同页查看执行过程、最终回复、历史 run
55
60
  - 代码审查:直接查看 workspace / 任务累计 / 单次 run 的 diff
56
61
  - 多引擎统一:当前支持 `Codex`、`Claude Code`、`OpenCode`
62
+ - 会话互通:PromptX 与 `Codex`、`Claude Code`、`OpenCode` 可双向复用会话
57
63
  - 远程访问:支持通过 Relay 从手机或外网访问自己的 PromptX
58
64
 
59
65
  ## 系统截图
@@ -289,6 +289,32 @@ function createClaudeToolResultEvent(block = {}, state = createClaudeNormalizati
289
289
  }
290
290
  }
291
291
 
292
+ function buildClaudeApiRetryReason(event = {}) {
293
+ const status = Number(event?.error_status) || 0
294
+ const code = String(event?.error || '').trim()
295
+ const parts = []
296
+ if (status > 0) {
297
+ parts.push(`HTTP ${status}`)
298
+ }
299
+ if (code) {
300
+ parts.push(code)
301
+ }
302
+ return parts.join(' ').trim()
303
+ }
304
+
305
+ function isClaudeFatalAuthRetry(event = {}) {
306
+ const status = Number(event?.error_status) || 0
307
+ const code = String(event?.error || '').trim().toLowerCase()
308
+ return status === 401 || code === 'authentication_failed'
309
+ }
310
+
311
+ function formatClaudeFatalAuthMessage(event = {}) {
312
+ const reason = buildClaudeApiRetryReason(event)
313
+ return reason
314
+ ? `Claude Code 认证失败(${reason})。请重新登录 Claude Code,或检查当前环境中的认证令牌配置。`
315
+ : 'Claude Code 认证失败。请重新登录 Claude Code,或检查当前环境中的认证令牌配置。'
316
+ }
317
+
292
318
  export function normalizeClaudeEvents(event = {}, state = createClaudeNormalizationState()) {
293
319
  const eventType = String(event?.type || '').trim().toLowerCase()
294
320
  const normalizedEvents = []
@@ -297,6 +323,17 @@ export function normalizeClaudeEvents(event = {}, state = createClaudeNormalizat
297
323
  return [createThreadStartedEvent(extractClaudeSessionId(event))]
298
324
  }
299
325
 
326
+ if (eventType === 'system' && String(event?.subtype || '').trim().toLowerCase() === 'api_retry') {
327
+ if (isClaudeFatalAuthRetry(event)) {
328
+ return [createErrorEvent(formatClaudeFatalAuthMessage(event))]
329
+ }
330
+
331
+ const attempt = Math.max(1, Number(event?.attempt) || 1)
332
+ const total = Math.max(attempt, Number(event?.max_retries) || attempt)
333
+ const reason = buildClaudeApiRetryReason(event) || 'request failed'
334
+ return [createErrorEvent(`Reconnecting... ${attempt}/${total} (${reason})`)]
335
+ }
336
+
300
337
  if (eventType === 'assistant') {
301
338
  const blocks = getClaudeMessageContentBlocks(event)
302
339
 
@@ -435,6 +472,8 @@ export function streamPromptToClaudeCodeSession(sessionInput, prompt, callbacks
435
472
  let lastStderrLine = ''
436
473
  let finalMessage = ''
437
474
  let finalSessionId = String(session.engineSessionId || session.engineThreadId || session.codexThreadId || '').trim()
475
+ let fatalClaudeErrorMessage = ''
476
+ let fatalClaudeErrorTriggered = false
438
477
  const normalizationState = createClaudeNormalizationState()
439
478
 
440
479
  const rememberSessionId = (sessionId) => {
@@ -465,6 +504,12 @@ export function streamPromptToClaudeCodeSession(sessionInput, prompt, callbacks
465
504
  onEvent(createAgentEventEnvelopeEvent(normalizedEvent))
466
505
  })
467
506
 
507
+ if (!fatalClaudeErrorTriggered && isClaudeFatalAuthRetry(event)) {
508
+ fatalClaudeErrorTriggered = true
509
+ fatalClaudeErrorMessage = formatClaudeFatalAuthMessage(event)
510
+ forceStopChildProcess(child)
511
+ }
512
+
468
513
  if (String(event?.type || '').trim().toLowerCase() === 'result') {
469
514
  finalMessage = extractClaudeResultText(event) || finalMessage
470
515
  }
@@ -500,7 +545,7 @@ export function streamPromptToClaudeCodeSession(sessionInput, prompt, callbacks
500
545
  })
501
546
 
502
547
  if (code !== 0) {
503
- const detail = lastStderrLine || 'Claude Code 执行失败。'
548
+ const detail = fatalClaudeErrorMessage || lastStderrLine || 'Claude Code 执行失败。'
504
549
  reject(new Error(detail))
505
550
  return
506
551
  }
@@ -168,6 +168,29 @@ function collectTextParts(value, parts = []) {
168
168
  return parts
169
169
  }
170
170
 
171
+ function stringifyClaudeToolResultContent(value) {
172
+ const parts = []
173
+ collectTextParts(value, parts)
174
+ if (parts.length) {
175
+ return parts.join('\n').trim()
176
+ }
177
+
178
+ if (typeof value === 'string') {
179
+ return value.trim()
180
+ }
181
+
182
+ if (value == null) {
183
+ return ''
184
+ }
185
+
186
+ try {
187
+ const compact = JSON.stringify(value)
188
+ return compact.length <= 12000 ? compact : `${compact.slice(0, 11997)}...`
189
+ } catch {
190
+ return String(value || '').trim()
191
+ }
192
+ }
193
+
171
194
  export function extractClaudeAssistantText(event = {}) {
172
195
  const parts = []
173
196
  if (event?.message?.content) {
@@ -214,11 +237,21 @@ function getClaudeMessageContentBlocks(event = {}) {
214
237
  return Array.isArray(content) ? content : []
215
238
  }
216
239
 
217
- function stringifyClaudeToolInput(input = {}) {
240
+ function stringifyClaudeToolInput(input = {}, toolName = '') {
218
241
  if (!input || typeof input !== 'object') {
219
242
  return ''
220
243
  }
221
244
 
245
+ const normalizedToolName = String(toolName || '').trim().toLowerCase()
246
+ if (normalizedToolName === 'todowrite') {
247
+ try {
248
+ const serialized = JSON.stringify(input)
249
+ return serialized.length <= 12000 ? serialized : `${serialized.slice(0, 11997)}...`
250
+ } catch {
251
+ // fall through
252
+ }
253
+ }
254
+
222
255
  const command = String(input.command || '').trim()
223
256
  if (command) {
224
257
  return command
@@ -242,7 +275,7 @@ function stringifyClaudeToolInput(input = {}) {
242
275
 
243
276
  function buildClaudeToolCommand(name = '', input = {}) {
244
277
  const toolName = String(name || 'Claude Code tool').trim() || 'Claude Code tool'
245
- const inputSummary = stringifyClaudeToolInput(input)
278
+ const inputSummary = stringifyClaudeToolInput(input, toolName)
246
279
  return inputSummary ? `${toolName}: ${inputSummary}` : toolName
247
280
  }
248
281
 
@@ -271,7 +304,7 @@ function createClaudeToolUseEvent(block = {}, state = createClaudeNormalizationS
271
304
  function createClaudeToolResultEvent(block = {}, state = createClaudeNormalizationState()) {
272
305
  const toolUseId = String(block?.tool_use_id || block?.toolUseId || '').trim()
273
306
  const remembered = toolUseId ? state.toolUses.get(toolUseId) : null
274
- const output = String(block?.content || block?.result || '').trim()
307
+ const output = stringifyClaudeToolResultContent(block?.content ?? block?.result)
275
308
  const isError = Boolean(block?.is_error)
276
309
 
277
310
  if (toolUseId) {
@@ -289,6 +322,32 @@ function createClaudeToolResultEvent(block = {}, state = createClaudeNormalizati
289
322
  }
290
323
  }
291
324
 
325
+ function buildClaudeApiRetryReason(event = {}) {
326
+ const status = Number(event?.error_status) || 0
327
+ const code = String(event?.error || '').trim()
328
+ const parts = []
329
+ if (status > 0) {
330
+ parts.push(`HTTP ${status}`)
331
+ }
332
+ if (code) {
333
+ parts.push(code)
334
+ }
335
+ return parts.join(' ').trim()
336
+ }
337
+
338
+ function isClaudeFatalAuthRetry(event = {}) {
339
+ const status = Number(event?.error_status) || 0
340
+ const code = String(event?.error || '').trim().toLowerCase()
341
+ return status === 401 || code === 'authentication_failed'
342
+ }
343
+
344
+ function formatClaudeFatalAuthMessage(event = {}) {
345
+ const reason = buildClaudeApiRetryReason(event)
346
+ return reason
347
+ ? `Claude Code 认证失败(${reason})。请重新登录 Claude Code,或检查当前环境中的认证令牌配置。`
348
+ : 'Claude Code 认证失败。请重新登录 Claude Code,或检查当前环境中的认证令牌配置。'
349
+ }
350
+
292
351
  export function normalizeClaudeEvents(event = {}, state = createClaudeNormalizationState()) {
293
352
  const eventType = String(event?.type || '').trim().toLowerCase()
294
353
  const normalizedEvents = []
@@ -297,6 +356,17 @@ export function normalizeClaudeEvents(event = {}, state = createClaudeNormalizat
297
356
  return [createThreadStartedEvent(extractClaudeSessionId(event))]
298
357
  }
299
358
 
359
+ if (eventType === 'system' && String(event?.subtype || '').trim().toLowerCase() === 'api_retry') {
360
+ if (isClaudeFatalAuthRetry(event)) {
361
+ return [createErrorEvent(formatClaudeFatalAuthMessage(event))]
362
+ }
363
+
364
+ const attempt = Math.max(1, Number(event?.attempt) || 1)
365
+ const total = Math.max(attempt, Number(event?.max_retries) || attempt)
366
+ const reason = buildClaudeApiRetryReason(event) || 'request failed'
367
+ return [createErrorEvent(`Reconnecting... ${attempt}/${total} (${reason})`)]
368
+ }
369
+
300
370
  if (eventType === 'assistant') {
301
371
  const blocks = getClaudeMessageContentBlocks(event)
302
372
 
@@ -435,6 +505,8 @@ export function streamPromptToClaudeCodeSession(sessionInput, prompt, callbacks
435
505
  let lastStderrLine = ''
436
506
  let finalMessage = ''
437
507
  let finalSessionId = String(session.engineSessionId || session.engineThreadId || session.codexThreadId || '').trim()
508
+ let fatalClaudeErrorMessage = ''
509
+ let fatalClaudeErrorTriggered = false
438
510
  const normalizationState = createClaudeNormalizationState()
439
511
 
440
512
  const rememberSessionId = (sessionId) => {
@@ -465,6 +537,12 @@ export function streamPromptToClaudeCodeSession(sessionInput, prompt, callbacks
465
537
  onEvent(createAgentEventEnvelopeEvent(normalizedEvent))
466
538
  })
467
539
 
540
+ if (!fatalClaudeErrorTriggered && isClaudeFatalAuthRetry(event)) {
541
+ fatalClaudeErrorTriggered = true
542
+ fatalClaudeErrorMessage = formatClaudeFatalAuthMessage(event)
543
+ forceStopChildProcess(child)
544
+ }
545
+
468
546
  if (String(event?.type || '').trim().toLowerCase() === 'result') {
469
547
  finalMessage = extractClaudeResultText(event) || finalMessage
470
548
  }
@@ -500,7 +578,7 @@ export function streamPromptToClaudeCodeSession(sessionInput, prompt, callbacks
500
578
  })
501
579
 
502
580
  if (code !== 0) {
503
- const detail = lastStderrLine || 'Claude Code 执行失败。'
581
+ const detail = fatalClaudeErrorMessage || lastStderrLine || 'Claude Code 执行失败。'
504
582
  reject(new Error(detail))
505
583
  return
506
584
  }
@@ -61,15 +61,19 @@ function registerCodexRoutes(app, options = {}) {
61
61
  decorateCodexSession,
62
62
  decorateCodexSessionList,
63
63
  deletePromptxCodexSession,
64
+ deleteTaskCodexRuns = () => {},
64
65
  getCodexRunById,
65
66
  getPromptxCodexSessionById,
66
67
  getRunningCodexRunBySessionId,
68
+ getRunningCodexRunByTaskSlug = () => null,
67
69
  isActiveRunStatus,
68
70
  listCodexRunEvents,
69
71
  listDirectoryPickerTree,
70
72
  listPromptxCodexSessions,
73
+ listTaskSlugsByCodexSessionId = () => [],
71
74
  listWorkspaceSuggestions,
72
75
  listWorkspaceTree,
76
+ resetPromptxCodexSession = () => null,
73
77
  runDispatchService,
74
78
  searchDirectoryPickerEntries,
75
79
  searchWorkspaceEntries,
@@ -143,6 +147,48 @@ function registerCodexRoutes(app, options = {}) {
143
147
  return decorateCodexSession(session)
144
148
  })
145
149
 
150
+ app.post('/api/codex/sessions/:sessionId/reset', async (request, reply) => {
151
+ const sessionId = String(request.params.sessionId || '').trim()
152
+ if (getRunningCodexRunBySessionId(sessionId)) {
153
+ return reply.code(409).send({
154
+ messageKey: 'errors.currentProjectRunning',
155
+ message: '当前项目正在执行中,请先停止后再新建会话。',
156
+ })
157
+ }
158
+
159
+ const affectedTaskSlugs = listTaskSlugsByCodexSessionId(sessionId)
160
+ const runningTaskSlug = affectedTaskSlugs.find((taskSlug) => getRunningCodexRunByTaskSlug(taskSlug))
161
+ if (runningTaskSlug) {
162
+ return reply.code(409).send({
163
+ messageKey: 'errors.currentProjectRunning',
164
+ message: '当前项目正在执行中,请先停止后再新建会话。',
165
+ })
166
+ }
167
+
168
+ const session = resetPromptxCodexSession(sessionId)
169
+ if (!session) {
170
+ return reply.code(404).send({ messageKey: 'errors.sessionNotFound', message: '没有找到对应的 PromptX 项目。' })
171
+ }
172
+
173
+ affectedTaskSlugs.forEach((taskSlug) => {
174
+ deleteTaskCodexRuns(taskSlug)
175
+ })
176
+
177
+ broadcastServerEvent('sessions.changed', {
178
+ sessionId: session.id,
179
+ })
180
+ affectedTaskSlugs.forEach((taskSlug) => {
181
+ broadcastServerEvent('runs.changed', {
182
+ taskSlug,
183
+ })
184
+ })
185
+
186
+ return {
187
+ session: decorateCodexSession(session),
188
+ affectedTaskSlugs,
189
+ }
190
+ })
191
+
146
192
  app.delete('/api/codex/sessions/:sessionId', async (request, reply) => {
147
193
  if (getRunningCodexRunBySessionId(request.params.sessionId)) {
148
194
  return reply.code(409).send({
@@ -286,6 +286,26 @@ export function updatePromptxCodexSession(sessionId, patch = {}) {
286
286
  return getPromptxCodexSessionById(existing.id)
287
287
  }
288
288
 
289
+ export function resetPromptxCodexSession(sessionId) {
290
+ const existing = getPromptxCodexSessionById(sessionId)
291
+ if (!existing) {
292
+ return null
293
+ }
294
+
295
+ const updatedAt = new Date().toISOString()
296
+
297
+ transaction(() => {
298
+ run(
299
+ `UPDATE codex_sessions
300
+ SET codex_thread_id = '', engine_session_id = '', engine_thread_id = '', engine_meta_json = '{}', updated_at = ?
301
+ WHERE id = ?`,
302
+ [updatedAt, existing.id]
303
+ )
304
+ })
305
+
306
+ return getPromptxCodexSessionById(existing.id)
307
+ }
308
+
289
309
  export function deletePromptxCodexSession(sessionId) {
290
310
  const existing = getPromptxCodexSessionById(sessionId)
291
311
  if (!existing) {
@@ -12,6 +12,7 @@ import {
12
12
  deleteTask,
13
13
  getTaskBySlug,
14
14
  listAutomationEnabledTasks,
15
+ listTaskSlugsByCodexSessionId,
15
16
  listTasks,
16
17
  purgeExpiredTasks,
17
18
  reorderTasks,
@@ -28,11 +29,12 @@ import {
28
29
  getTaskGitDiffReviewInSubprocess,
29
30
  } from './gitDiffClient.js'
30
31
  import {
31
- createPromptxCodexSession,
32
- deletePromptxCodexSession,
33
- getPromptxCodexSessionById,
34
- listPromptxCodexSessions,
35
- updatePromptxCodexSession,
32
+ createPromptxCodexSession,
33
+ deletePromptxCodexSession,
34
+ getPromptxCodexSessionById,
35
+ listPromptxCodexSessions,
36
+ resetPromptxCodexSession,
37
+ updatePromptxCodexSession,
36
38
  } from './codexSessions.js'
37
39
  import {
38
40
  createCodexRun,
@@ -400,15 +402,19 @@ registerCodexRoutes(app, {
400
402
  decorateCodexSession,
401
403
  decorateCodexSessionList,
402
404
  deletePromptxCodexSession,
405
+ deleteTaskCodexRuns,
403
406
  getCodexRunById,
404
407
  getPromptxCodexSessionById,
405
408
  getRunningCodexRunBySessionId,
409
+ getRunningCodexRunByTaskSlug,
406
410
  isActiveRunStatus,
407
411
  listCodexRunEvents,
408
412
  listDirectoryPickerTree,
409
413
  listPromptxCodexSessions,
414
+ listTaskSlugsByCodexSessionId,
410
415
  listWorkspaceSuggestions: workspaceSuggestionService.listWorkspaceSuggestions,
411
416
  listWorkspaceTree,
417
+ resetPromptxCodexSession,
412
418
  runDispatchService,
413
419
  searchDirectoryPickerEntries,
414
420
  searchWorkspaceEntries,
@@ -851,6 +851,23 @@ export function clearTaskCodexSessionReferences(codexSessionId = '') {
851
851
  return matchedTaskSlugs
852
852
  }
853
853
 
854
+ export function listTaskSlugsByCodexSessionId(codexSessionId = '') {
855
+ const normalizedSessionId = String(codexSessionId || '').trim()
856
+ if (!normalizedSessionId) {
857
+ return []
858
+ }
859
+
860
+ return all(
861
+ `SELECT slug
862
+ FROM tasks
863
+ WHERE codex_session_id = ?
864
+ ORDER BY sort_order ASC, created_at DESC, id DESC`,
865
+ [normalizedSessionId]
866
+ )
867
+ .map((row) => String(row?.slug || '').trim())
868
+ .filter(Boolean)
869
+ }
870
+
854
871
  export function listAutomationEnabledTasks(limit = 200) {
855
872
  const rows = all(
856
873
  `SELECT id, slug, title, auto_title, last_prompt_preview, codex_session_id,
@@ -0,0 +1,16 @@
1
+ import{w as he,a as p,c as se,d as le,g as t,t as o,u as a,b as S,A as lt,B as it,n as P,e as v,F as xe,m as _e,i as j,v as ot,f as rt,x as $,l as ye,k as _,G as Ke,o as dt,D as ct,E as ut,X as pt,y as gt}from"./index-DlMwVg8o.js";import{c as Re,A as mt,n as Pe,o as Me,r as vt,S as Ue,f as fe,L as Ie,p as ft,d as Qe,h as Xe,s as ht,q as He,_ as xt,P as yt,I as bt,b as wt,t as qe,v as St,e as Ve,T as kt,w as $t}from"./WorkbenchView-C_25_arF.js";/**
2
+ * @license lucide-vue-next v0.577.0 - ISC
3
+ *
4
+ * This source code is licensed under the ISC license.
5
+ * See the LICENSE file in the root directory of this source tree.
6
+ */const _t=Re("bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]]);/**
7
+ * @license lucide-vue-next v0.577.0 - ISC
8
+ *
9
+ * This source code is licensed under the ISC license.
10
+ * See the LICENSE file in the root directory of this source tree.
11
+ */const Mt=Re("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
12
+ * @license lucide-vue-next v0.577.0 - ISC
13
+ *
14
+ * This source code is licensed under the ISC license.
15
+ * See the LICENSE file in the root directory of this source tree.
16
+ */const Ct=Re("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);function jt(i=[]){return(Array.isArray(i)&&i.length?i:mt).filter(u=>u&&typeof u=="object").map(u=>{const k=Pe(u.value);return{...u,value:k,label:String(u.label||Me(k)).trim()||Me(k),enabled:u.enabled!==!1,available:u.available!==!1}})}function Te(i=[]){return jt(i).filter(T=>T.enabled&&T.available)}async function It(){const i=await vt("/api/meta",{cache:"no-store"});return Te(i==null?void 0:i.agentEngineOptions)}const Pt={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},Tt={class:"theme-muted-text mt-1 text-xs leading-5"},Rt={class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Dt={class:"theme-divider mt-4 rounded-sm border border-dashed px-3 py-2"},Lt={class:"flex items-start gap-2 text-xs leading-5"},Et={class:"theme-muted-text shrink-0"},Ft={class:"min-w-0 break-all font-mono text-[var(--theme-textPrimary)]"},Bt={class:"theme-muted-text mt-4 block text-xs"},At={class:"theme-input-shell mt-1 flex h-10 items-center gap-2 rounded-sm border px-3 transition focus-within:ring-2"},Nt=["placeholder"],zt={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"},Ut={key:0,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},Ht={key:1,class:"theme-status-danger rounded-sm border border-dashed px-3 py-3 text-xs"},qt={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"},Wt={key:4,class:"theme-empty-state px-3 py-8 text-sm"},Gt={key:5,class:"theme-empty-state px-3 py-8 text-sm"},Kt={key:6,class:"theme-empty-state px-3 py-8 text-sm"},Qt={key:7,class:"space-y-1"},Xt=["onClick"],Jt={class:"min-w-0 flex-1"},Yt=["innerHTML"],Zt=["innerHTML"],en={key:0,class:"theme-muted-text px-1 pt-2 text-xs"},tn={key:8,class:"space-y-1"},nn={class:"flex items-start gap-1.5"},an=["onClick"],sn=["onClick"],ln={class:"min-w-0 flex-1"},on={key:0,class:"theme-muted-text truncate font-mono text-[10px]"},rn={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"},dn={class:"flex flex-col-reverse gap-2 sm:flex-row sm:items-center"},cn=["disabled"],un=["disabled"],pn={__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:f}=ye(),c=$(""),h=$(null),C=$(!1),r=$(""),d=$(!1),w=$(""),E=$([]),F=$(!1),R=$(""),M=$("tree"),L=$(""),G=$("");let B=null,A=0;const K=_(()=>de(h.value?[h.value]:[])),z=_(()=>M.value==="search"&&!R.value.trim()),ie=_(()=>M.value==="search"&&!!R.value.trim()&&!d.value&&!w.value&&!E.value.length),q=_(()=>M.value==="tree"&&!C.value&&!r.value&&!K.value.length);function ne(n=""){const g=String(n||"").trim();return/^[a-z]:[\\/]/i.test(g)||g.includes("\\")}function b(n=""){const g=String(n||"").trim();if(!g)return"";const l=ne(g);let m=g.replace(/\\/g,"/");return m.length>1&&!/^[a-z]:\/?$/i.test(m)&&m!=="/"&&(m=m.replace(/\/+$/,"")),l?m.toLowerCase():m}function Z(n="",g=""){const l=b(n),m=b(g);return!l||!m?!1:l===m||l.startsWith(`${m}/`)}function Ce(n="",g=""){const l=String(n||"").trim(),m=String(g||"").trim();return l?m?ne(l)?/^[a-z]:\\?$/i.test(l)?`${l.replace(/[\\/]+$/,"")}\\${m}`:`${l.replace(/[\\/]+$/,"")}\\${m}`:l==="/"?`/${m}`:`${l.replace(/\/+$/,"")}/${m}`:l:m}function ae(n="",g=""){const l=b(n),m=b(g);if(!l||!m||!Z(m,l))return[];const D=m===l?"":m.slice(l.length).replace(/^\//,"");return D?D.split("/").filter(Boolean):[]}function Q(n){return(n==null?void 0:n.name)||(n==null?void 0:n.path)||f("directoryPicker.unnamedDirectory")}function oe(n=""){const g=String(n||"").trim();return g?g.split(/[\\/]/).filter(Boolean).at(-1)||g:"Home"}function V(n=""){return String(n||"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function I(n="",g=""){const l=String(n||""),m=String(g||"").trim().toLowerCase();if(!l||!m)return null;const D=l.toLowerCase(),U=D.indexOf(m);if(U>=0)return{start:U,end:U+m.length};const $e=m.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="",g=""){const l=String(n||""),m=I(l,g);return m?`${V(l.slice(0,m.start))}<mark class="theme-search-highlight">${V(l.slice(m.start,m.end))}</mark>${V(l.slice(m.end))}`:V(l)}function re(n){return be(Q(n),R.value)}function we(n){return be((n==null?void 0:n.path)||"",R.value)}function ee(n,g=0){return{...n,depth:g,expanded:!1,loaded:!1,loading:!1,children:[]}}function de(n=[],g=[]){return n.forEach(l=>{g.push(l),l.expanded&&l.children.length&&de(l.children,g)}),g}function X(){h.value&&(h.value={...h.value})}function ce(n,g=h.value?[h.value]:[]){const l=b(n);if(!l)return null;for(const m of g){if(b(m.path)===l)return m;if(m.children.length){const D=ce(n,m.children);if(D)return D}}return null}function J(n){L.value=String((n==null?void 0:n.path)||"").trim(),G.value=Q(n)}async function ue(n,g={}){if(!(!n||n.loading)&&!(n.loaded&&!g.force)){n.loading=!0,r.value="",X();try{const l=await He({path:n.path,limit:240});n.children=(l.items||[]).map(m=>ee(m,n.depth+1)),n.loaded=!0}catch(l){r.value=l.message||f("directoryPicker.loadFailed")}finally{n.loading=!1,X()}}}async function je(){C.value=!0,r.value="";try{const n=await He({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(g=>ee(g,1)),h.value.loaded=!0,h.value.expanded=!0,J(h.value)}catch(n){r.value=n.message||f("directoryPicker.treeLoadFailed"),h.value=null,c.value=""}finally{C.value=!1}}async function pe(n=""){const g=String(n||"").trim();if(!g||!c.value||!Z(g,c.value))return;let l=h.value;if(!l)return;J(l);const m=ae(c.value,g);for(const D of m){await ue(l),l.expanded=!0,X();const U=ce(Ce(l.path,D),l.children);if(!U)break;l=U,J(l)}}async function Se(){R.value="",M.value="tree",E.value=[],w.value="",F.value=!1,L.value="",G.value="",await je();const n=String(u.initialPath||"").trim();n&&Z(n,c.value)&&await pe(n)}async function O(n){if(n!=null&&n.path&&(J(n),!!n.hasChildren)){if(!n.loaded){n.expanded=!0,X(),await ue(n);return}n.expanded=!n.expanded,X()}}function te(n){n!=null&&n.path&&(J(n),M.value="tree")}async function ke(){const n=String(R.value||"").trim();A+=1;const g=A;if(!u.open||!n||!c.value){d.value=!1,w.value="",E.value=[],F.value=!1;return}d.value=!0,w.value="";try{const l=await ht(n,{path:c.value,limit:80});if(g!==A)return;E.value=Array.isArray(l.items)?l.items:[],F.value=!!l.truncated}catch(l){if(g!==A)return;w.value=l.message||f("directoryPicker.searchFailed"),E.value=[],F.value=!1}finally{g===A&&(d.value=!1)}}function ge(){if(B&&(window.clearTimeout(B),B=null),!String(R.value||"").trim()){d.value=!1,w.value="",E.value=[],F.value=!1;return}d.value=!0,w.value="",B=window.setTimeout(()=>{ke()},120)}async function me(n){n!=null&&n.path&&(M.value="tree",await pe(n.path))}function ve(){L.value&&(k("select",L.value),k("close"))}return he(R,()=>{M.value=R.value.trim()?"search":"tree",ge()}),he(()=>u.open,n=>{if(n){Se().catch(()=>{});return}B&&(window.clearTimeout(B),B=null)}),(n,g)=>(p(),se(Xe,{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":C.value||d.value,"close-on-backdrop":!(C.value||d.value),"close-on-escape":!(C.value||d.value),onClose:g[4]||(g[4]=l=>k("close"))},{title:le(()=>[t("div",null,[t("div",Pt,[S(a(fe),{class:"h-4 w-4"}),t("span",null,o(a(f)("directoryPicker.title")),1)]),t("p",Tt,o(a(f)("directoryPicker.intro")),1)])]),default:le(()=>[t("div",Rt,[t("div",Dt,[t("div",Lt,[t("span",Et,o(a(f)("directoryPicker.currentSelection")),1),t("span",Ft,o(L.value||a(f)("directoryPicker.selectionPlaceholder")),1)])]),t("label",Bt,[t("span",null,o(a(f)("directoryPicker.searchLabel")),1),t("div",At,[S(a(Ue),{class:"h-4 w-4 shrink-0 text-[var(--theme-textMuted)]"}),lt(t("input",{"onUpdate:modelValue":g[0]||(g[0]=l=>R.value=l),type:"text",placeholder:a(f)("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,Nt),[[it,R.value]])])]),t("div",zt,[t("button",{type:"button",class:P(["inline-flex h-8 items-center gap-1 rounded-sm border px-2 text-[11px] transition",M.value==="search"?"tool-button-accent-subtle":"theme-filter-idle border-dashed"]),onClick:g[1]||(g[1]=l=>M.value="search")},[S(a(Ue),{class:"h-3.5 w-3.5"}),t("span",null,o(a(f)("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",M.value==="tree"?"tool-button-accent-subtle":"theme-filter-idle border-dashed"]),onClick:g[2]||(g[2]=l=>M.value="tree")},[S(a(fe),{class:"h-3.5 w-3.5"}),t("span",null,o(a(f)("directoryPicker.treeTab")),1)],2)]),t("div",Ot,[M.value==="search"&&w.value?(p(),v("div",Ut,o(w.value),1)):M.value==="tree"&&r.value?(p(),v("div",Ht,o(r.value),1)):M.value==="search"&&d.value?(p(),v("div",qt,[S(a(Ie),{class:"h-4 w-4 animate-spin"}),t("span",null,o(a(f)("directoryPicker.searching")),1)])):M.value==="tree"&&C.value?(p(),v("div",Vt,[S(a(Ie),{class:"h-4 w-4 animate-spin"}),t("span",null,o(a(f)("directoryPicker.treeLoading")),1)])):z.value?(p(),v("div",Wt,o(a(f)("directoryPicker.searchPrompt")),1)):ie.value?(p(),v("div",Gt,o(a(f)("directoryPicker.noSearchResults")),1)):q.value?(p(),v("div",Kt,o(a(f)("directoryPicker.emptyTree")),1)):M.value==="search"?(p(),v("div",Qt,[(p(!0),v(xe,null,_e(E.value,l=>(p(),v("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(L.value)===b(l.path)?"theme-list-item-active":"theme-list-item-hover"]),onClick:m=>me(l)},[S(a(fe),{class:"theme-muted-text mt-0.5 h-4 w-4 shrink-0"}),t("div",Jt,[t("div",null,[t("span",{class:"truncate text-[13px] text-[var(--theme-textPrimary)]",innerHTML:re(l)},null,8,Yt)]),t("div",{class:"theme-muted-text truncate font-mono text-[10px]",innerHTML:we(l)},null,8,Zt)])],10,Xt))),128)),F.value?(p(),v("p",en,o(a(f)("directoryPicker.truncatedHint")),1)):j("",!0)])):(p(),v("div",tn,[(p(!0),v(xe,null,_e(K.value,l=>(p(),v("div",{key:l.path,class:P(["rounded-sm border border-transparent px-1.5 py-1 transition",b(L.value)===b(l.path)?"theme-list-item-active":l.expanded?"theme-list-item-expanded":"theme-list-item-hover"]),style:ot({paddingLeft:`${l.depth*16+6}px`})},[t("div",nn,[t("button",{type:"button",class:P(["theme-icon-button h-5 w-5 shrink-0",l.hasChildren?"":"invisible pointer-events-none"]),onClick:rt(m=>O(l),["stop"])},[l.loading?(p(),se(a(Ie),{key:0,class:"h-3.5 w-3.5 animate-spin"})):(p(),se(a(ft),{key:1,class:P(["h-3.5 w-3.5 transition",l.expanded?"rotate-90 text-[var(--theme-textPrimary)]":""])},null,8,["class"]))],10,an),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:m=>te(l)},[S(a(fe),{class:P(["h-4 w-4 shrink-0",b(L.value)===b(l.path)?"text-[var(--theme-textPrimary)]":"text-[var(--theme-textMuted)]"])},null,8,["class"]),t("div",ln,[t("div",{class:P(["truncate text-[13px]",l.isHomeRoot?"font-medium text-[var(--theme-textSecondary)]":"font-medium text-[var(--theme-textPrimary)]"])},o(Q(l)),3),l.isHomeRoot?(p(),v("div",on,o(l.path),1)):j("",!0)])],8,sn)])],6))),128))]))])]),t("div",rn,[t("div",dn,[t("button",{type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:C.value||d.value,onClick:g[3]||(g[3]=l=>k("close"))},o(a(f)("directoryPicker.cancel")),9,cn),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:C.value||d.value||!L.value,onClick:ve},[S(a(Qe),{class:"h-4 w-4"}),t("span",null,o(a(f)("directoryPicker.useCurrentDirectory")),1)],8,un)])])]),_:1},8,["open","close-disabled","close-on-backdrop","close-on-escape"]))}},gn={class:"grid gap-4"},mn={class:"theme-muted-text block text-xs"},vn=["value","disabled"],fn={class:"theme-muted-text block text-xs"},hn={class:"mt-1 flex gap-2"},xn=["value","disabled"],yn=["disabled"],bn={id:"codex-manager-workspace-suggestions"},wn=["value"],Sn={key:0,class:"mt-2 text-[11px] leading-5 text-[var(--theme-warningText)]"},kn={key:1,class:"theme-muted-text mt-2 text-[11px] leading-5"},$n={class:"theme-muted-text block text-xs"},_n={class:"mt-1"},Mn={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]"},jn=["disabled","onClick"],In={class:"flex items-center justify-between gap-3"},Pn={class:"min-w-0 flex-1 truncate"},Tn={key:0,class:"theme-muted-text rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]"},Rn={key:0,class:"theme-muted-text mt-2 text-[11px] leading-5"},Dn={class:"theme-muted-text block text-xs"},Ln={class:"mt-1 flex gap-2"},En=["value","disabled"],Fn=["disabled"],Bn={key:0,class:"theme-muted-text mt-2 text-[11px] leading-5"},An={key:1,class:"theme-muted-text mt-2 text-[11px] leading-5"},We={__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:f}=ye(),c=_(()=>{const C=String(u.engine||"").trim();return u.engineOptions.find(r=>String((r==null?void 0:r.value)||"").trim()===C)||null}),h=_(()=>String(u.sessionId||"").trim());return(C,r)=>(p(),v("div",gn,[t("label",mn,[t("span",null,o(a(f)("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,vn)]),t("label",fn,[t("span",null,o(a(f)("projectManager.workingDirectoryField")),1),t("div",hn,[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,xn),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(fe),{class:"h-4 w-4"}),t("span",null,o(i.mobile?a(f)("projectManager.choose"):a(f)("projectManager.chooseDirectory")),1)],8,yn)]),t("datalist",bn,[(p(!0),v(xe,null,_e(i.workspaceSuggestions,d=>(p(),v("option",{key:d,value:d},null,8,wn))),128))]),i.duplicateCwdMessage?(p(),v("p",Sn,o(i.duplicateCwdMessage),1)):i.cwdReadonlyMessage?(p(),v("p",kn,o(i.cwdReadonlyMessage),1)):j("",!0)]),t("label",$n,[t("span",null,o(a(f)("projectManager.engineField")),1),t("div",_n,[S(xt,{"model-value":i.engine,options:i.engineOptions,disabled:i.busy||!i.canEditEngine,placeholder:a(f)("projectManager.selectEngine"),"empty-text":a(f)("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",Mn,[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(f)("projectManager.selectEngine")),3),c.value&&c.value.enabled===!1?(p(),v("span",Cn,o(a(f)("projectManager.comingSoon")),1)):j("",!0)])]}),option:le(({option:d,selected:w,select:E})=>[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:E},[t("div",In,[t("span",Pn,o(d.label),1),(d==null?void 0:d.enabled)===!1?(p(),v("span",Tn,o(a(f)("projectManager.comingSoon")),1)):j("",!0)])],10,jn)]),_:1},8,["model-value","options","disabled","placeholder","empty-text","get-option-value"])]),i.engineReadonlyMessage?(p(),v("p",Rn,o(i.engineReadonlyMessage),1)):j("",!0)]),t("label",Dn,[t("span",null,o(a(f)("projectManager.sessionId")),1),t("div",Ln,[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(),v("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(Qe),{key:0,class:"h-4 w-4"})):(p(),se(a(Mt),{key:1,class:"h-4 w-4"})),t("span",null,o(i.sessionIdCopied?a(f)("projectManager.sessionIdCopied"):a(f)("projectManager.copySessionId")),1)],8,Fn)):j("",!0)]),i.sessionIdReadonlyMessage?(p(),v("p",Bn,o(i.sessionIdReadonlyMessage),1)):(p(),v("p",An,o(a(f)("projectManager.sessionIdHint")),1))])]))}},Nn={class:"flex items-center justify-between gap-3"},zn={class:"theme-heading text-sm font-medium"},On={key:0,class:"theme-muted-text mt-1 text-xs"},Un=["disabled"],Hn=["onClick"],qn={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"},Wn={class:"theme-heading min-w-0 text-sm font-medium"},Gn=["title"],Kn=["title"],Qn={class:"theme-muted-text flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] leading-5"},Xn={key:0,"aria-hidden":"true"},Jn={key:1},Yn={class:"flex flex-wrap items-center gap-2 pt-1"},Zn={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},Ge={__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:f}=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)?f("projectManager.current"):f("projectManager.regular")}function C(r){return u.isCurrentSession(r.id)?"theme-status-info":"theme-status-neutral"}return(r,d)=>(p(),v("div",{class:P(i.mobile?"flex h-full min-h-0 flex-col":"")},[t("div",Nn,[t("div",null,[t("div",zn,o(a(f)("projectManager.projectList")),1),i.hasSessions?j("",!0):(p(),v("p",On,o(a(f)("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(yt),{class:"h-4 w-4"}),t("span",null,o(a(f)("projectManager.create")),1)],8,Un)]),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),v(xe,null,_e(i.sessions,w=>(p(),v("article",{key:w.id,class:P(["relative cursor-pointer rounded-sm border p-3 transition",c(w)]),onClick:E=>k("select",w.id)},[i.mode==="edit"&&i.editingSessionId===w.id?(p(),v("span",qn)):j("",!0),t("div",Vn,[t("div",Wn,[t("span",{class:"block truncate",title:w.title||a(f)("projectManager.untitledProject")},o(w.title||a(f)("projectManager.untitledProject")),9,Gn)]),t("div",{class:"theme-muted-text break-all font-mono text-[11px] leading-5",title:w.cwd},o(w.cwd),9,Kn),t("div",Qn,[t("span",null,o(a(Me)(w.engine)),1),i.mobile?j("",!0):(p(),v("span",Xn,"·")),i.mobile?j("",!0):(p(),v("span",Jn,o(i.formatUpdatedAt(w.updatedAt)),1))]),t("div",Yn,[t("span",{class:P(["inline-flex shrink-0 whitespace-nowrap rounded-sm border border-dashed px-1.5 py-0.5 text-[10px]",C(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(),v("span",Zn)):j("",!0),Ke(" "+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,Hn))),128))],2)],2))}},ea={class:"space-y-3"},ta={class:"dashed-panel px-3 py-3"},na={class:"theme-muted-text text-[11px]"},aa={class:"mt-2 flex flex-wrap gap-2"},sa={key:0,class:"h-1.5 w-1.5 rounded-full bg-current animate-pulse"},la={key:0,class:"theme-status-info inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs"},ia={class:"dashed-panel px-3 py-3"},oa={class:"theme-muted-text text-[11px]"},ra={class:"mt-2 text-sm text-[var(--theme-textPrimary)]"},da={class:"dashed-panel px-3 py-3"},ca={class:"theme-muted-text text-[11px]"},ua={class:"mt-2 break-all font-mono text-xs leading-6 text-[var(--theme-textPrimary)]"},pa={class:"dashed-panel px-3 py-3"},ga={class:"theme-muted-text text-[11px]"},ma={class:"mt-2 text-sm text-[var(--theme-textPrimary)]"},va={class:"dashed-panel px-3 py-3"},fa={class:"theme-muted-text inline-flex items-center gap-2 text-[11px]"},ha={class:"mt-2 text-xs leading-6 text-[var(--theme-textSecondary)]"},xa={__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 f,c,h,C,r,d,w;return p(),v("div",ea,[t("div",ta,[t("div",na,o(a(T)("projectManager.runtimeStatus")),1),t("div",aa,[t("span",{class:P(["inline-flex items-center gap-1 rounded-sm border border-dashed px-2 py-1 text-xs",i.getRuntimeStatusClass((f=i.activeSession)==null?void 0:f.id)])},[i.isSessionRunning((c=i.activeSession)==null?void 0:c.id)?(p(),v("span",sa)):j("",!0),Ke(" "+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),(C=i.activeSession)!=null&&C.id&&i.isCurrentSession(i.activeSession.id)?(p(),v("span",la,o(a(T)("projectManager.currentProject")),1)):j("",!0)])]),t("div",ia,[t("div",oa,o(a(T)("projectManager.engine")),1),t("div",ra,o(a(Me)((r=i.activeSession)==null?void 0:r.engine)),1)]),t("div",da,[t("div",ca,o(a(T)("projectManager.workingDirectory")),1),t("div",ua,o(((d=i.activeSession)==null?void 0:d.cwd)||a(T)("projectManager.notSet")),1)]),t("div",pa,[t("div",ga,o(a(T)("projectManager.updatedAt")),1),t("div",ma,o(i.formatUpdatedAt((w=i.activeSession)==null?void 0:w.updatedAt)),1)]),t("div",va,[t("div",fa,[S(a(bt),{class:"h-3.5 w-3.5"}),t("span",null,o(a(T)("projectManager.note")),1)]),t("p",ha,o(a(T)("projectManager.noteDescription")),1)])])}}},ya={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},ba={key:0,class:"grid min-h-0 flex-1 gap-0 lg:grid-cols-[minmax(0,300px)_minmax(0,1fr)]"},wa={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"},Sa={class:"min-h-0 overflow-y-auto px-4 py-4 sm:px-5"},ka={class:"flex flex-wrap items-start justify-between gap-3"},$a={class:"theme-heading inline-flex items-center gap-2 text-sm font-medium"},_a={class:"mt-5"},Ma={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"},ja={class:"flex flex-wrap items-center gap-2"},Ia=["disabled"],Pa=["disabled"],Ta={class:"flex flex-col-reverse gap-2 sm:flex-row sm:flex-wrap sm:items-center"},Ra=["disabled"],Da=["disabled"],La=["disabled"],Ea={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Fa={key:0,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Ba={class:"min-h-0 flex-1 overflow-hidden px-3 py-3"},Aa={key:1,class:"flex min-h-0 flex-1 flex-col overflow-hidden"},Na={class:"theme-divider flex items-center gap-3 border-b px-4 py-3"},za=["disabled"],Oa={class:"min-w-0 flex-1"},Ua={class:"theme-heading truncate text-sm font-medium"},Ha={key:0,class:"theme-muted-text mt-1 truncate text-xs"},qa={class:"theme-divider border-b px-4 py-3"},Va={class:"grid grid-cols-2 gap-2"},Wa=["disabled"],Ga={class:"min-h-0 flex-1 overflow-y-auto px-4 py-4"},Ka={key:0},Qa={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},Xa={class:"theme-divider mt-6 flex flex-col gap-3 border-t border-dashed pt-4"},Ja=["disabled"],Ya=["disabled"],Za=["disabled"],ns={__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:f,t:c}=ye(),h=$("edit"),C=$(""),r=ct({title:"",engine:"codex",cwd:"",sessionId:""}),d=$(""),w=$(!1),E=$(!1),F=$(!1),R=$(!1),M=$(!1),L=$(!1),G=$(!1),B=$(!1),{matches:A}=wt("(max-width: 767px)"),K=$("list"),z=$("basic"),ie=$(Te());let q=null;const ne=_(()=>ke(u.sessions)),b=_(()=>u.sessions.find(e=>e.id===C.value)||null),Z=_(()=>u.sessions.length>0),Ce=_(()=>u.sessions.find(e=>e.id===u.selectedSessionId)||null),ae=_(()=>!!(b.value&&O(b.value.id))),Q=_(()=>{var e;return!((e=b.value)!=null&&e.started)}),oe=_(()=>{var e;return!((e=b.value)!=null&&e.started)}),V=_(()=>{var e;return!((e=b.value)!=null&&e.started)}),I=_(()=>u.loading||w.value||E.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=Ce.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 f.value==="en-US"?`"${x}"`:`「${x}」`}).join(f.value==="en-US"?", ":"、");return c("projectManager.duplicateDirectory",{labels:e,count:ee.value.length})}),X=_(()=>h.value!=="edit"||Q.value?"":c("projectManager.cwdReadonly")),ce=_(()=>h.value!=="edit"||!b.value||oe.value?"":c("projectManager.engineReadonly")),J=_(()=>h.value!=="edit"||!b.value||V.value?"":c("projectManager.sessionIdReadonly")),ue=_(()=>h.value==="create"?w.value?c("projectManager.creatingProject"):c("projectManager.createProject"):E.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 O(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(O(x.id))-Number(O(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||pt(String(s.title||s.cwd||s.id),String(x.title||x.cwd||x.id))})}function ge(e){return O(e)?c("projectManager.running"):c("projectManager.idle")}function me(e){return O(e)?"theme-status-warning":"theme-status-success"}function ve(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 g(e=""){if(!e)return c("projectManager.unknown");const s=new Date(e);return Number.isNaN(s.getTime())?e:ut(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 m(){h.value="create",C.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",C.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"){K.value="detail",z.value=e}function W(){K.value="list",z.value="basic"}function Y(){m(),A.value&&$e("basic")}function De(e){I.value||(D(e),A.value&&$e("basic"))}function Je(e){r.cwd=String(e||"").trim()}function Le(e){r.title=String(e||"")}function Ee(e){r.engine=Pe(e)}function Fe(e){r.cwd=String(e||"")}function Be(e){r.sessionId=String(e||"")}function Ae(){d.value="",M.value=!1,L.value=!1,B.value=!1,z.value="basic",K.value=A.value?"list":"detail";const e=U();if(e){D(e);return}m()}async function Ye(){if(!(I.value||typeof u.onRefresh!="function")){d.value="";try{await Promise.all([u.onRefresh(),Ne()])}catch(e){d.value=e.message}}}async function Ne(){try{ie.value=await It()}catch{ie.value=Te()}}async function Ze(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 ze(){const e=be.value;if(e)try{await Ze(e),B.value=!0,q&&clearTimeout(q),q=setTimeout(()=>{B.value=!1,q=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=et();if(!e)return;await tt(e)}catch(e){d.value=e.message}}}function et(){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 Q.value&&(e.cwd=r.cwd),V.value&&(e.sessionId=String(r.sessionId||"").trim()),{type:"update",sessionId:b.value.id,payload:e}}async function tt(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 gt(),k("project-created",y),k("close"));return}finally{w.value=!1}}E.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{E.value=!1}}async function nt(){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));M.value=!1;const H=u.sessions.filter(st=>st.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()):(m(),A.value&&W())}catch(y){d.value=y.message}finally{F.value=!1}}async function at(){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));L.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){Ae(),typeof u.onRefresh=="function"?Ye().catch(()=>{}):Ne().catch(()=>{});return}G.value=!1,M.value=!1,L.value=!1,B.value=!1,d.value=""},{immediate:!0}),he(A,e=>{e||(K.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}m()}),dt(()=>{q&&(clearTimeout(q),q=null)}),(e,s)=>(p(),v(xe,null,[S(qe,{open:L.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=>L.value=!1),onConfirm:at},null,8,["open","title","description","confirm-text","cancel-text","loading"]),S(qe,{open:M.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=>M.value=!1),onConfirm:nt},null,8,["open","title","description","confirm-text","cancel-text","loading"]),S(pn,{open:G.value,"initial-path":r.cwd,suggestions:re.value,onClose:s[2]||(s[2]=x=>G.value=!1),onSelect:Je},null,8,["open","initial-path","suggestions"]),S(Xe,{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",ya,[S(a(_t),{class:"h-4 w-4"}),t("span",null,o(a(c)("projectManager.managingTitle")),1)])]),default:le(()=>{var x;return[a(A)?(p(),v("div",Ea,[K.value==="list"?(p(),v("div",Fa,[t("div",Ba,[S(Ge,{mobile:"",busy:I.value,"editing-session-id":C.value,"format-updated-at":g,"get-runtime-status-class":me,"get-runtime-status-label":ge,"get-thread-status-class":n,"get-thread-status-label":ve,"has-sessions":Z.value,"is-current-session":te,"is-session-running":O,mode:h.value,sessions:ne.value,onCreate:Y,onSelect:De},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])])])):(p(),v("div",Aa,[t("div",Na,[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,za),t("div",Oa,[t("div",Ua,o(je.value),1),h.value==="edit"&&((x=b.value)!=null&&x.cwd)?(p(),v("p",Ha,o(b.value.cwd),1)):j("",!0)])]),t("div",qa,[t("div",Va,[t("button",{type:"button",class:P(["tool-button px-3 py-2 text-sm",z.value==="basic"?"tool-button-accent-subtle":""]),onClick:s[7]||(s[7]=y=>z.value="basic")},o(a(c)("projectManager.basicInfo")),3),t("button",{type:"button",class:P(["tool-button px-3 py-2 text-sm",z.value==="status"?"tool-button-accent-subtle":""]),disabled:h.value==="create",onClick:s[8]||(s[8]=y=>z.value="status")},o(a(c)("projectManager.status")),11,Wa)])]),t("div",Ga,[z.value==="basic"?(p(),v("div",Ka,[S(We,{mobile:"",busy:I.value,"can-edit-engine":h.value!=="edit"||oe.value,"can-edit-cwd":h.value!=="edit"||Q.value,"can-edit-session-id":h.value!=="edit"||V.value,cwd:r.cwd,"cwd-readonly-message":X.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":J.value,title:r.title,"workspace-suggestions":re.value,onCopySessionId:ze,onOpenDirectoryPicker:s[9]||(s[9]=y=>G.value=!0),"onUpdate:cwd":Fe,"onUpdate:engine":Ee,"onUpdate:sessionId":Be,"onUpdate:title":Le},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(),v("p",Qa,[S(a(Ve),{class:"h-4 w-4"}),t("span",null,o(d.value),1)])):j("",!0),t("div",Xa,[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,Ja),h.value==="edit"&&b.value?(p(),v("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=>L.value=!0)},o(R.value?a(c)("projectManager.resettingSession"):a(c)("projectManager.newSession")),9,Ya)):j("",!0),h.value==="edit"&&b.value?(p(),v("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=>M.value=!0)},o(F.value?a(c)("projectManager.deletingProject"):a(c)("projectManager.deleteProject")),9,Za)):j("",!0)])])):(p(),se(xa,{key:1,"active-session":b.value,"format-updated-at":g,"get-runtime-status-class":me,"get-runtime-status-label":ge,"get-thread-status-class":n,"get-thread-status-label":ve,"is-current-session":te,"is-session-running":O},null,8,["active-session"]))])]))])):(p(),v("div",ba,[t("aside",wa,[S(Ge,{busy:I.value,"editing-session-id":C.value,"format-updated-at":g,"get-runtime-status-class":me,"get-runtime-status-label":ge,"get-thread-status-class":n,"get-thread-status-label":ve,"has-sessions":Z.value,"is-current-session":te,"is-session-running":O,mode:h.value,sessions:ne.value,onCreate:Y,onSelect:De},null,8,["busy","editing-session-id","has-sessions","mode","sessions"])]),t("div",Sa,[t("div",ka,[t("div",null,[t("div",$a,[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(We,{busy:I.value,"can-edit-engine":h.value!=="edit"||oe.value,"can-edit-cwd":h.value!=="edit"||Q.value,"can-edit-session-id":h.value!=="edit"||V.value,cwd:r.cwd,"cwd-readonly-message":X.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":J.value,title:r.title,"workspace-suggestions":re.value,onCopySessionId:ze,onOpenDirectoryPicker:s[3]||(s[3]=y=>G.value=!0),"onUpdate:cwd":Fe,"onUpdate:engine":Ee,"onUpdate:sessionId":Be,"onUpdate:title":Le},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(),v("p",Ma,[S(a(Ve),{class:"h-4 w-4"}),t("span",null,o(d.value),1)])):j("",!0),t("div",Ca,[t("div",ja,[h.value==="edit"&&b.value?(p(),v("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=>L.value=!0)},[S(a(Ct),{class:"h-4 w-4"}),t("span",null,o(R.value?a(c)("projectManager.resettingSession"):a(c)("projectManager.newSession")),1)],8,Ia)):j("",!0),h.value==="edit"&&b.value?(p(),v("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=>M.value=!0)},[S(a(kt),{class:"h-4 w-4"}),t("span",null,o(F.value?a(c)("projectManager.deletingProject"):a(c)("projectManager.deleteProject")),1)],8,Pa)):j("",!0)]),t("div",Ta,[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,Ra),h.value==="create"&&Z.value?(p(),v("button",{key:0,type:"button",class:"tool-button w-full px-3 py-2 text-xs sm:w-auto",disabled:I.value,onClick:Ae},o(a(c)("projectManager.backToList")),9,Da)):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,La)])])])]))]}),_:1},8,["open","close-disabled","close-on-backdrop","close-on-escape"])],64))}};export{ns as default};
@@ -1,4 +1,4 @@
1
- import{w as V,G as Ye,k as T,x as P,z as w,E as qe,y as Ze,a as h,e as p,g as a,F as te,m as Se,n as F,t as o,b as S,u as t,A as Me,B as et,i as B,l as Re,c as je,d as ue,H as tt,U as Ae}from"./index-BSJEmbKe.js";import{c as Ee,u as st,g as Le,l as at,S as nt,C as Ie,a as Ne,b as it,d as lt,_ as rt,e as ot,F as Ge,f as Be,h as ut}from"./WorkbenchView-CdTz2H8d.js";/**
1
+ import{w as V,H as Ye,k as T,x as P,z as w,E as qe,y as Ze,a as h,e as p,g as a,F as te,m as Se,n as F,t as o,b as S,u as t,A as Me,B as et,i as B,l as Re,c as je,d as ue,I as tt,U as Ae}from"./index-DlMwVg8o.js";import{c as Ee,u as st,g as Le,l as at,S as nt,C as Ie,a as Ne,b as it,d as lt,_ as rt,e as ot,F as Ge,f as Be,h as ut}from"./WorkbenchView-C_25_arF.js";/**
2
2
  * @license lucide-vue-next v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{a as o,e as c,g as e,t as a,u as i,F as se,m as ne,n as Xe,v as wt,c as $,i as h,l as Ye,V as Rt,k as v,w as Je,o as Tt,d as de,b as z,A as te,C as St,B as xe,W as Mt,x as m,D as pe,E as Et}from"./index-BSJEmbKe.js";import{c as _e,r as H,d as Pt,i as $t,_ as Ut,E as Bt,j as jt,L as me,k as Nt,h as Ft,I as Lt,m as It}from"./WorkbenchView-CdTz2H8d.js";/**
1
+ import{a as o,e as c,g as e,t as a,u as i,F as se,m as ne,n as Xe,v as wt,c as $,i as h,l as Ye,V as Rt,k as v,w as Je,o as Tt,d as de,b as z,A as te,C as St,B as xe,W as Mt,x as m,D as pe,E as Et}from"./index-DlMwVg8o.js";import{c as _e,r as H,d as Pt,i as $t,_ as Ut,E as Bt,j as jt,L as me,k as Nt,h as Ft,I as Lt,m as It}from"./WorkbenchView-C_25_arF.js";/**
2
2
  * @license lucide-vue-next v0.577.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.