@muyichengshayu/promptx 0.1.26 → 0.1.28
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 +13 -0
- package/README.en.md +6 -0
- package/README.md +6 -0
- package/apps/server/src/codexRoutes.js +46 -0
- package/apps/server/src/codexSessions.js +20 -0
- package/apps/server/src/db.js +29 -0
- package/apps/server/src/index.js +20 -12
- package/apps/server/src/repository.js +74 -5
- package/apps/server/src/taskRoutes.js +45 -0
- package/apps/web/dist/assets/CodexSessionManagerDialog-yWAxmwaM.js +16 -0
- package/apps/web/dist/assets/{TaskDiffReviewDialog-BJOR35hG.js → TaskDiffReviewDialog-C47Sgfas.js} +1 -1
- package/apps/web/dist/assets/{WorkbenchSettingsDialog-jyJ9EpE0.js → WorkbenchSettingsDialog-CcCcioEo.js} +2 -2
- package/apps/web/dist/assets/WorkbenchView-DVDqH0n1.js +256 -0
- package/apps/web/dist/assets/WorkbenchView-DqB2zkrZ.css +1 -0
- package/apps/web/dist/assets/index-BTVl1TvL.js +26 -0
- package/apps/web/dist/assets/{index-CtJnPgTH.css → index-CFYJqG5B.css} +1 -1
- package/apps/web/dist/index.html +2 -2
- package/package.json +1 -1
- package/apps/web/dist/assets/CodexSessionManagerDialog-Bp6iLH_5.js +0 -11
- package/apps/web/dist/assets/WorkbenchView-Dt2Cvuhj.js +0 -246
- package/apps/web/dist/assets/index-CTTVntNr.js +0 -25
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.28
|
|
4
|
+
|
|
5
|
+
- 项目管理新增“新会话”能力:可一键清空当前项目绑定的线程/会话信息,并在下一次运行时从全新会话重新开始,行为更接近 Codex / Claude Code / OpenCode 里的 `/new`。
|
|
6
|
+
- “新会话”会同时清空该项目下所有任务的执行历史,但保留项目本身、工作目录、执行引擎配置以及右侧编辑区内容,避免新旧会话结果混在一起。
|
|
7
|
+
- 运行中的项目会被禁止执行“新会话”,并补充前后端提示、确认弹窗、中英双语文案与自动化测试,确保这条重置链路可用且稳定。
|
|
8
|
+
|
|
9
|
+
## 0.1.27
|
|
10
|
+
|
|
11
|
+
- 左侧任务列表新增桌面端拖拽排序能力,并改用 `vue-draggable-plus` 接管交互,拖拽手感、占位反馈与排序稳定性更好。
|
|
12
|
+
- 任务排序改为服务端持久化:拖拽后的顺序会写入数据库,刷新页面、重启服务或远端页面同步后都能保持一致。
|
|
13
|
+
- 修复任务排序当前页不立即生效的问题:任务列表合并逻辑改为以服务端返回顺序为准,不再被本地旧顺序覆盖。
|
|
14
|
+
- 补充任务重排接口校验与相关前后端测试,同时收敛本地重排后的 SSE 冗余刷新,减少一次无意义列表拉取。
|
|
15
|
+
|
|
3
16
|
## 0.1.26
|
|
4
17
|
|
|
5
18
|
- 为当前运行任务补充低频状态对账:即使 SSE 漏掉终态事件,前端也会定时重新拉取当前任务的运行历史和项目状态,避免页面长时间停留在“运行中”,只有刷新后才恢复真实结果。
|
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
|
## 系统截图
|
|
@@ -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) {
|
package/apps/server/src/db.js
CHANGED
|
@@ -167,6 +167,7 @@ function migrateToV1() {
|
|
|
167
167
|
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
168
168
|
slug TEXT NOT NULL UNIQUE,
|
|
169
169
|
edit_token TEXT NOT NULL,
|
|
170
|
+
sort_order INTEGER NOT NULL DEFAULT 0,
|
|
170
171
|
title TEXT NOT NULL DEFAULT '',
|
|
171
172
|
auto_title TEXT NOT NULL DEFAULT '',
|
|
172
173
|
last_prompt_preview TEXT NOT NULL DEFAULT '',
|
|
@@ -205,6 +206,7 @@ function migrateToV1() {
|
|
|
205
206
|
FOREIGN KEY (task_id) REFERENCES tasks(id) ON DELETE CASCADE
|
|
206
207
|
);
|
|
207
208
|
|
|
209
|
+
CREATE INDEX IF NOT EXISTS idx_tasks_sort_order ON tasks(sort_order ASC, created_at DESC, id DESC);
|
|
208
210
|
CREATE INDEX IF NOT EXISTS idx_tasks_created_at ON tasks(created_at DESC);
|
|
209
211
|
CREATE INDEX IF NOT EXISTS idx_tasks_visibility ON tasks(visibility, created_at DESC);
|
|
210
212
|
CREATE INDEX IF NOT EXISTS idx_blocks_task_sort ON blocks(task_id, sort_order ASC);
|
|
@@ -325,6 +327,7 @@ function migrateToV1() {
|
|
|
325
327
|
function applyAdditiveSchemaPatches() {
|
|
326
328
|
const alterStatements = [
|
|
327
329
|
`ALTER TABLE tasks ADD COLUMN auto_title TEXT NOT NULL DEFAULT ''`,
|
|
330
|
+
`ALTER TABLE tasks ADD COLUMN sort_order INTEGER NOT NULL DEFAULT 0`,
|
|
328
331
|
`ALTER TABLE tasks ADD COLUMN last_prompt_preview TEXT NOT NULL DEFAULT ''`,
|
|
329
332
|
`ALTER TABLE tasks ADD COLUMN todo_items_json TEXT NOT NULL DEFAULT '[]'`,
|
|
330
333
|
`ALTER TABLE tasks ADD COLUMN codex_session_id TEXT NOT NULL DEFAULT ''`,
|
|
@@ -369,11 +372,37 @@ function applyAdditiveSchemaPatches() {
|
|
|
369
372
|
}
|
|
370
373
|
})
|
|
371
374
|
|
|
375
|
+
db.exec('CREATE INDEX IF NOT EXISTS idx_tasks_sort_order ON tasks(sort_order ASC, created_at DESC, id DESC)')
|
|
372
376
|
db.exec('CREATE INDEX IF NOT EXISTS idx_tasks_codex_session_id ON tasks(codex_session_id)')
|
|
373
377
|
db.exec(`
|
|
374
378
|
DELETE FROM blocks
|
|
375
379
|
WHERE task_id NOT IN (SELECT id FROM tasks);
|
|
376
380
|
`)
|
|
381
|
+
|
|
382
|
+
normalizeTaskSortOrder()
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
function normalizeTaskSortOrder() {
|
|
386
|
+
const rows = all(
|
|
387
|
+
`SELECT id, sort_order, created_at
|
|
388
|
+
FROM tasks
|
|
389
|
+
ORDER BY sort_order ASC, created_at DESC, id DESC`
|
|
390
|
+
)
|
|
391
|
+
|
|
392
|
+
if (rows.length < 2) {
|
|
393
|
+
return
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
const needsNormalization = rows.some((row, index) => Number(row.sort_order) !== index)
|
|
397
|
+
if (!needsNormalization) {
|
|
398
|
+
return
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
transaction(() => {
|
|
402
|
+
rows.forEach((row, index) => {
|
|
403
|
+
run('UPDATE tasks SET sort_order = ? WHERE id = ?', [index, Number(row.id)])
|
|
404
|
+
})
|
|
405
|
+
})
|
|
377
406
|
}
|
|
378
407
|
|
|
379
408
|
function ensureSchema() {
|
package/apps/server/src/index.js
CHANGED
|
@@ -8,13 +8,15 @@ import {
|
|
|
8
8
|
buildTaskExports,
|
|
9
9
|
canEditTask,
|
|
10
10
|
clearTaskCodexSessionReferences,
|
|
11
|
-
createTask,
|
|
12
|
-
deleteTask,
|
|
13
|
-
getTaskBySlug,
|
|
14
|
-
listAutomationEnabledTasks,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
11
|
+
createTask,
|
|
12
|
+
deleteTask,
|
|
13
|
+
getTaskBySlug,
|
|
14
|
+
listAutomationEnabledTasks,
|
|
15
|
+
listTaskSlugsByCodexSessionId,
|
|
16
|
+
listTasks,
|
|
17
|
+
purgeExpiredTasks,
|
|
18
|
+
reorderTasks,
|
|
19
|
+
updateTaskAutomationRuntime,
|
|
18
20
|
updateTaskCodexSession,
|
|
19
21
|
updateTaskNotificationDelivery,
|
|
20
22
|
updateTask,
|
|
@@ -27,11 +29,12 @@ import {
|
|
|
27
29
|
getTaskGitDiffReviewInSubprocess,
|
|
28
30
|
} from './gitDiffClient.js'
|
|
29
31
|
import {
|
|
30
|
-
createPromptxCodexSession,
|
|
31
|
-
deletePromptxCodexSession,
|
|
32
|
-
getPromptxCodexSessionById,
|
|
33
|
-
listPromptxCodexSessions,
|
|
34
|
-
|
|
32
|
+
createPromptxCodexSession,
|
|
33
|
+
deletePromptxCodexSession,
|
|
34
|
+
getPromptxCodexSessionById,
|
|
35
|
+
listPromptxCodexSessions,
|
|
36
|
+
resetPromptxCodexSession,
|
|
37
|
+
updatePromptxCodexSession,
|
|
35
38
|
} from './codexSessions.js'
|
|
36
39
|
import {
|
|
37
40
|
createCodexRun,
|
|
@@ -376,6 +379,7 @@ registerTaskRoutes(app, {
|
|
|
376
379
|
listTaskWorkspaceDiffSummaries: taskWorkspaceDiffSummaryService.listTaskWorkspaceDiffSummaries,
|
|
377
380
|
listTasks,
|
|
378
381
|
purgeExpiredContent,
|
|
382
|
+
reorderTasks,
|
|
379
383
|
removeAssetFiles,
|
|
380
384
|
runDispatchService,
|
|
381
385
|
updateTask,
|
|
@@ -398,15 +402,19 @@ registerCodexRoutes(app, {
|
|
|
398
402
|
decorateCodexSession,
|
|
399
403
|
decorateCodexSessionList,
|
|
400
404
|
deletePromptxCodexSession,
|
|
405
|
+
deleteTaskCodexRuns,
|
|
401
406
|
getCodexRunById,
|
|
402
407
|
getPromptxCodexSessionById,
|
|
403
408
|
getRunningCodexRunBySessionId,
|
|
409
|
+
getRunningCodexRunByTaskSlug,
|
|
404
410
|
isActiveRunStatus,
|
|
405
411
|
listCodexRunEvents,
|
|
406
412
|
listDirectoryPickerTree,
|
|
407
413
|
listPromptxCodexSessions,
|
|
414
|
+
listTaskSlugsByCodexSessionId,
|
|
408
415
|
listWorkspaceSuggestions: workspaceSuggestionService.listWorkspaceSuggestions,
|
|
409
416
|
listWorkspaceTree,
|
|
417
|
+
resetPromptxCodexSession,
|
|
410
418
|
runDispatchService,
|
|
411
419
|
searchDirectoryPickerEntries,
|
|
412
420
|
searchWorkspaceEntries,
|
|
@@ -43,6 +43,7 @@ function toTask(row, blocks = [], options = {}) {
|
|
|
43
43
|
return {
|
|
44
44
|
id: Number(row.id),
|
|
45
45
|
slug: row.slug,
|
|
46
|
+
sortOrder: Number(row.sort_order) || 0,
|
|
46
47
|
title: row.title,
|
|
47
48
|
autoTitle: row.auto_title || '',
|
|
48
49
|
lastPromptPreview: row.last_prompt_preview || '',
|
|
@@ -274,6 +275,7 @@ function mapTaskSummary(row, firstText = '', blockCount = 0, codexRunCount = 0)
|
|
|
274
275
|
|
|
275
276
|
return {
|
|
276
277
|
slug: row.slug,
|
|
278
|
+
sortOrder: Number(row.sort_order) || 0,
|
|
277
279
|
title: row.title || '',
|
|
278
280
|
autoTitle: row.auto_title || deriveTitleFromBlocks(textBlock) || '',
|
|
279
281
|
lastPromptPreview: row.last_prompt_preview || '',
|
|
@@ -379,12 +381,12 @@ function parseTaskTodoItems(rawValue = '[]') {
|
|
|
379
381
|
|
|
380
382
|
export function listTasks(limit = 30) {
|
|
381
383
|
const rows = all(
|
|
382
|
-
`SELECT id, slug, title, auto_title, last_prompt_preview, todo_items_json, codex_session_id,
|
|
384
|
+
`SELECT id, slug, sort_order, title, auto_title, last_prompt_preview, todo_items_json, codex_session_id,
|
|
383
385
|
automation_enabled, automation_cron, automation_timezone, automation_concurrency_policy, automation_last_triggered_at, automation_next_trigger_at,
|
|
384
386
|
notification_enabled, notification_channel_type, notification_webhook_url, notification_secret, notification_trigger_on, notification_locale, notification_message_mode, notification_last_status, notification_last_error, notification_last_sent_at,
|
|
385
387
|
visibility, expires_at, created_at, updated_at
|
|
386
388
|
FROM tasks
|
|
387
|
-
ORDER BY created_at DESC, id DESC
|
|
389
|
+
ORDER BY sort_order ASC, created_at DESC, id DESC
|
|
388
390
|
LIMIT ?`,
|
|
389
391
|
[Math.max(1, Number(limit) || 30)]
|
|
390
392
|
)
|
|
@@ -408,7 +410,7 @@ export function listTasks(limit = 30) {
|
|
|
408
410
|
|
|
409
411
|
export function getTaskBySlug(slug) {
|
|
410
412
|
const row = get(
|
|
411
|
-
`SELECT id, slug, title, auto_title, last_prompt_preview, todo_items_json, codex_session_id,
|
|
413
|
+
`SELECT id, slug, sort_order, title, auto_title, last_prompt_preview, todo_items_json, codex_session_id,
|
|
412
414
|
automation_enabled, automation_cron, automation_timezone, automation_concurrency_policy, automation_last_triggered_at, automation_next_trigger_at,
|
|
413
415
|
notification_enabled, notification_channel_type, notification_webhook_url, notification_secret, notification_trigger_on, notification_locale, notification_message_mode, notification_last_status, notification_last_error, notification_last_sent_at,
|
|
414
416
|
visibility, expires_at, created_at, updated_at
|
|
@@ -440,19 +442,22 @@ export function createTask(input = {}) {
|
|
|
440
442
|
const expiresAt = resolveExpiresAt(normalizeExpiry(input.expiry || 'none'))
|
|
441
443
|
const slug = ensureSlug(title)
|
|
442
444
|
const editToken = tokenId()
|
|
445
|
+
const topSortOrder = Number(get('SELECT MIN(sort_order) AS value FROM tasks')?.value)
|
|
446
|
+
const sortOrder = Number.isFinite(topSortOrder) ? topSortOrder - 1 : 0
|
|
443
447
|
|
|
444
448
|
transaction(() => {
|
|
445
449
|
run(
|
|
446
450
|
`INSERT INTO tasks (
|
|
447
|
-
slug, edit_token, title, auto_title, last_prompt_preview, todo_items_json, codex_session_id,
|
|
451
|
+
slug, edit_token, sort_order, title, auto_title, last_prompt_preview, todo_items_json, codex_session_id,
|
|
448
452
|
automation_enabled, automation_cron, automation_timezone, automation_concurrency_policy, automation_last_triggered_at, automation_next_trigger_at,
|
|
449
453
|
notification_enabled, notification_channel_type, notification_webhook_url, notification_secret, notification_trigger_on, notification_locale, notification_message_mode, notification_last_status, notification_last_error, notification_last_sent_at,
|
|
450
454
|
visibility, expires_at, created_at, updated_at
|
|
451
455
|
)
|
|
452
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` ,
|
|
456
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)` ,
|
|
453
457
|
[
|
|
454
458
|
slug,
|
|
455
459
|
editToken,
|
|
460
|
+
sortOrder,
|
|
456
461
|
title,
|
|
457
462
|
autoTitle,
|
|
458
463
|
lastPromptPreview,
|
|
@@ -767,6 +772,53 @@ export function updateTaskCodexSession(slug, codexSessionId = '') {
|
|
|
767
772
|
return getTaskBySlug(slug)
|
|
768
773
|
}
|
|
769
774
|
|
|
775
|
+
export function reorderTasks(taskSlugs = []) {
|
|
776
|
+
const requestedSlugs = [...new Set(
|
|
777
|
+
(Array.isArray(taskSlugs) ? taskSlugs : [])
|
|
778
|
+
.map((slug) => String(slug || '').trim())
|
|
779
|
+
.filter(Boolean)
|
|
780
|
+
)]
|
|
781
|
+
|
|
782
|
+
if (!requestedSlugs.length) {
|
|
783
|
+
throw new Error('缺少任务排序数据。')
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
const currentRows = all(
|
|
787
|
+
`SELECT slug
|
|
788
|
+
FROM tasks
|
|
789
|
+
ORDER BY sort_order ASC, created_at DESC, id DESC`
|
|
790
|
+
)
|
|
791
|
+
const currentOrder = currentRows.map((row) => String(row.slug || '').trim()).filter(Boolean)
|
|
792
|
+
const existingSlugSet = new Set(currentOrder)
|
|
793
|
+
const nextOrderedSlugs = requestedSlugs.filter((slug) => existingSlugSet.has(slug))
|
|
794
|
+
|
|
795
|
+
if (!nextOrderedSlugs.length) {
|
|
796
|
+
throw new Error('没有可排序的任务。')
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
const remainingSlugs = currentOrder.filter((slug) => !nextOrderedSlugs.includes(slug))
|
|
800
|
+
const finalOrder = [...nextOrderedSlugs, ...remainingSlugs]
|
|
801
|
+
const changed = finalOrder.some((slug, index) => slug !== currentOrder[index])
|
|
802
|
+
|
|
803
|
+
if (!changed) {
|
|
804
|
+
return {
|
|
805
|
+
changed: false,
|
|
806
|
+
items: listTasks(Math.max(finalOrder.length, 1)),
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
transaction(() => {
|
|
811
|
+
finalOrder.forEach((slug, index) => {
|
|
812
|
+
run('UPDATE tasks SET sort_order = ? WHERE slug = ?', [index, slug])
|
|
813
|
+
})
|
|
814
|
+
})
|
|
815
|
+
|
|
816
|
+
return {
|
|
817
|
+
changed: true,
|
|
818
|
+
items: listTasks(Math.max(finalOrder.length, 1)),
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
|
|
770
822
|
export function clearTaskCodexSessionReferences(codexSessionId = '') {
|
|
771
823
|
const normalizedSessionId = String(codexSessionId || '').trim()
|
|
772
824
|
if (!normalizedSessionId) {
|
|
@@ -799,6 +851,23 @@ export function clearTaskCodexSessionReferences(codexSessionId = '') {
|
|
|
799
851
|
return matchedTaskSlugs
|
|
800
852
|
}
|
|
801
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
|
+
|
|
802
871
|
export function listAutomationEnabledTasks(limit = 200) {
|
|
803
872
|
const rows = all(
|
|
804
873
|
`SELECT id, slug, title, auto_title, last_prompt_preview, codex_session_id,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { normalizeCodexRunEventsMode } from '../../../packages/shared/src/index.js'
|
|
2
2
|
import { getApiErrorPayload } from './apiErrors.js'
|
|
3
3
|
|
|
4
|
+
const MAX_TASK_REORDER_COUNT = 200
|
|
5
|
+
|
|
4
6
|
function createEmptyWorkspaceDiffSummary() {
|
|
5
7
|
return {
|
|
6
8
|
supported: false,
|
|
@@ -120,6 +122,7 @@ function registerTaskRoutes(app, options = {}) {
|
|
|
120
122
|
listTaskCodexRunsWithOptions,
|
|
121
123
|
listTaskWorkspaceDiffSummaries,
|
|
122
124
|
listTasks = () => [],
|
|
125
|
+
reorderTasks = () => ({ changed: false, items: [] }),
|
|
123
126
|
purgeExpiredContent = () => {},
|
|
124
127
|
removeAssetFiles = () => {},
|
|
125
128
|
runDispatchService,
|
|
@@ -159,6 +162,48 @@ function registerTaskRoutes(app, options = {}) {
|
|
|
159
162
|
return reply.code(201).send(decorateTask(task))
|
|
160
163
|
})
|
|
161
164
|
|
|
165
|
+
app.post('/api/tasks/reorder', async (request, reply) => {
|
|
166
|
+
purgeExpiredContent()
|
|
167
|
+
const rawSlugs = Array.isArray(request.body?.slugs) ? request.body.slugs : []
|
|
168
|
+
const normalizedSlugs = rawSlugs
|
|
169
|
+
.map((slug) => String(slug || '').trim())
|
|
170
|
+
.filter(Boolean)
|
|
171
|
+
|
|
172
|
+
if (!normalizedSlugs.length) {
|
|
173
|
+
return reply.code(400).send({
|
|
174
|
+
messageKey: 'errors.taskReorderFailed',
|
|
175
|
+
message: '任务排序数据无效。',
|
|
176
|
+
})
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (normalizedSlugs.length > MAX_TASK_REORDER_COUNT) {
|
|
180
|
+
return reply.code(400).send({
|
|
181
|
+
messageKey: 'errors.taskReorderFailed',
|
|
182
|
+
message: '一次最多只能排序 200 个任务。',
|
|
183
|
+
})
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
let result
|
|
187
|
+
try {
|
|
188
|
+
result = reorderTasks(normalizedSlugs)
|
|
189
|
+
} catch (error) {
|
|
190
|
+
return reply.code(400).send({
|
|
191
|
+
messageKey: 'errors.taskReorderFailed',
|
|
192
|
+
message: error.message || '任务排序失败。',
|
|
193
|
+
})
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (result?.changed) {
|
|
197
|
+
broadcastServerEvent('tasks.changed', {
|
|
198
|
+
reason: 'reordered',
|
|
199
|
+
})
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
return {
|
|
203
|
+
items: decorateTaskList(result?.items || listTasks()),
|
|
204
|
+
}
|
|
205
|
+
})
|
|
206
|
+
|
|
162
207
|
app.get('/api/tasks/:slug', async (request, reply) => {
|
|
163
208
|
purgeExpiredContent()
|
|
164
209
|
const task = getTaskBySlug(request.params.slug)
|
|
@@ -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 _,J as Je,o as dt,D as ct,E as ut,X as pt,y as gt}from"./index-BTVl1TvL.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 Ke,h as Qe,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-DVDqH0n1.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"},Jt={key:6,class:"theme-empty-state px-3 py-8 text-sm"},Kt={key:7,class:"space-y-1"},Qt=["onClick"],Xt={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 J=_(()=>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&&!J.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 K(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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}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(K(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 Q(){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 X(n){L.value=String((n==null?void 0:n.path)||"").trim(),G.value=K(n)}async function ue(n,g={}){if(!(!n||n.loading)&&!(n.loaded&&!g.force)){n.loading=!0,r.value="",Q();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,Q()}}}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,X(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;X(l);const m=ae(c.value,g);for(const D of m){await ue(l),l.expanded=!0,Q();const U=ce(Ce(l.path,D),l.children);if(!U)break;l=U,X(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&&(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),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(Qe,{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",Jt,o(a(f)("directoryPicker.emptyTree")),1)):M.value==="search"?(p(),v("div",Kt,[(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",Xt,[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,Qt))),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(J.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(K(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(Ke),{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(Ke),{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"],Jn=["title"],Kn={class:"theme-muted-text flex flex-wrap items-center gap-x-2 gap-y-1 text-[11px] leading-5"},Qn={key:0,"aria-hidden":"true"},Xn={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,Jn),t("div",Kn,[t("span",null,o(a(Me)(w.engine)),1),i.mobile?j("",!0):(p(),v("span",Qn,"·")),i.mobile?j("",!0):(p(),v("span",Xn,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),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,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),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),(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"},Ja={key:0},Ka={key:0,class:"theme-danger-text mt-4 inline-flex items-center gap-2 text-sm"},Qa={class:"theme-divider mt-6 flex flex-col gap-3 border-t border-dashed pt-4"},Xa=["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)"),J=$("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))),K=_(()=>{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})}),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||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"){J.value="detail",z.value=e}function W(){J.value="list",z.value="basic"}function Y(){m(),A.value&&$e("basic")}function De(e){I.value||(D(e),A.value&&$e("basic"))}function Xe(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",J.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 K.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||(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}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:Xe},null,8,["open","initial-path","suggestions"]),S(Qe,{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,[J.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",Ja,[S(We,{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"||V.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: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",Ka,[S(a(Ve),{class:"h-4 w-4"}),t("span",null,o(d.value),1)])):j("",!0),t("div",Qa,[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,Xa),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"||K.value,"can-edit-session-id":h.value!=="edit"||V.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: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};
|
package/apps/web/dist/assets/{TaskDiffReviewDialog-BJOR35hG.js → TaskDiffReviewDialog-C47Sgfas.js}
RENAMED
|
@@ -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,
|
|
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-BTVl1TvL.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-DVDqH0n1.js";/**
|
|
2
2
|
* @license lucide-vue-next v0.577.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|