@muyichengshayu/promptx 0.1.47 → 0.2.0

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.
Files changed (30) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.en.md +68 -27
  3. package/README.md +67 -26
  4. package/apps/server/src/codexRoutes.js +36 -8
  5. package/apps/server/src/codexSessions.js +273 -37
  6. package/apps/server/src/index.js +22 -13
  7. package/apps/server/src/runDispatchService.js +21 -5
  8. package/apps/server/src/runEventIngest.js +44 -4
  9. package/apps/server/src/taskRoutes.js +1 -0
  10. package/apps/web/dist/assets/CodexSessionManagerDialog-BbaObUl_.js +3 -0
  11. package/apps/web/dist/assets/{TaskDiffReviewDialog-B28M4Rwo.js → TaskDiffReviewDialog-ClUn4Ni4.js} +1 -1
  12. package/apps/web/dist/assets/{WorkbenchSettingsDialog-DrXiTtO_.js → WorkbenchSettingsDialog-C74C5fs1.js} +1 -1
  13. package/apps/web/dist/assets/WorkbenchView-BgfyrrvY.js +57 -0
  14. package/apps/web/dist/assets/index-BIa_ZvMq.js +2 -0
  15. package/apps/web/dist/assets/index-CTHBQ5Ng.css +1 -0
  16. package/apps/web/dist/assets/{vendor-ui-C5E3MVzU.js → vendor-ui-BwEQCho1.js} +1 -1
  17. package/apps/web/dist/index.html +2 -2
  18. package/docs/assets/readme-diff-wechat.png +0 -0
  19. package/docs/assets/readme-execution-focus-wechat.png +0 -0
  20. package/docs/assets/readme-mobile-wechat.png +0 -0
  21. package/docs/assets/readme-project-manager-wechat.png +0 -0
  22. package/docs/assets/readme-settings-system-wechat.png +0 -0
  23. package/docs/assets/readme-settings-theme-wechat.png +0 -0
  24. package/docs/assets/readme-source-browser-wechat.png +0 -0
  25. package/docs/assets/readme-workbench-wechat.png +0 -0
  26. package/package.json +1 -1
  27. package/apps/web/dist/assets/CodexSessionManagerDialog-DZk_ClXW.js +0 -3
  28. package/apps/web/dist/assets/WorkbenchView-BdPC47JX.js +0 -53
  29. package/apps/web/dist/assets/index-Bx48HpZF.js +0 -2
  30. package/apps/web/dist/assets/index-DaELubyR.css +0 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0
4
+
5
+ - 项目正式升级为多 Agent 协作模型:一个项目可同时绑定 `Codex / Claude Code / OpenCode`,右侧可直接切换本轮发送目标,中栏也支持按 Agent 过滤整轮消息流,适合同一任务里拆分“方案 / 执行 / 复核”等分工。
6
+ - 加强项目与本机会话的双向复用:创建或编辑项目时可直接发现并选择本机已有 session,`PromptX` 内新建和推进出来的会话也能稳定回流到候选列表;同时补齐 root project session 与 hidden member sessions 的绑定、回写、重置与删除语义。
7
+ - 收敛多 Agent 下的事件与状态同步:runner 派发会把 run 正确绑定到实际 member session,事件回写后仍广播完整项目快照,避免 partial session 更新把 `agentBindings` 冲掉;同时为这条链路补齐服务端回归测试与真实浏览器 E2E。
8
+ - 持续打磨源码查看、代码变更与上下文回插体验:支持在回复、源码与 diff 中直接选中片段插回右侧编辑区,并统一源码 / 搜索 / 代码变更 / Agent selector 的交互与选中态,减少桌面端与移动端的割裂感。
9
+ - 更新产品文档与展示素材:中英文 README 重写为当前产品结构,截图统一切换为 `WeChat` 主题,并新增工作台总览、多 Agent 项目管理、源码查看、代码变更、设置页与手机端等多组场景图。
10
+ - 修复 relay 场景下图片下发给 agent 时的地址问题:发送给 `Codex / Claude Code / OpenCode` 的图片 URL 改为优先使用本机 PromptX 服务地址,避免 relay 域名下的临时图片链接因鉴权或过期导致模型看图失败。
11
+
12
+ ## 0.1.48
13
+
14
+ - 修复移动端“选中后插入到编辑区”偶发无效的问题:选区按钮改为更早的 `pointerdown` 触发,避免手机上点击按钮时浏览器先清掉选区,导致按钮消失但内容没有真正插入。
15
+ - 修复 OpenCode 本机会话发现排序在发布测试中不稳定的问题:当候选时间同时存在“显式会话时间”和“文件推断时间”时,改为优先使用 OpenCode 自身记录的显式时间,避免同目录下候选顺序偶发抖动。
16
+ - 局域网联调结束后,前端开发服务默认 host 恢复为 `127.0.0.1`,避免开发机在日常使用时继续暴露到本地网络。
17
+
3
18
  ## 0.1.47
4
19
 
5
20
  - 工作台新增“选中插入到编辑区”能力:在模型回复、项目源码查看与代码变更里都可直接拖选内容并一键插入右侧编辑区;其中模型回复按普通文本插入,更适合二次处理,源码与 diff 继续按代码上下文块插入。
package/README.en.md CHANGED
@@ -2,21 +2,31 @@
2
2
 
3
3
  [中文 README](README.md)
4
4
 
5
- PromptX is a local AI agent workspace.
5
+ PromptX is a local workspace for AI agents.
6
6
 
7
- It organizes `Codex`, `Claude Code`, and `OpenCode` into a cleaner workflow:
7
+ It takes the CLI tools you already use — `Codex`, `Claude Code`, and `OpenCode` — and organizes them into a workflow that is easier to keep running over time:
8
8
 
9
9
  ```text
10
10
  Task -> Project -> Directory -> Thread -> Run -> Diff
11
11
  ```
12
12
 
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.
13
+ You keep using the agent and model you already know. PromptX brings structured input, project binding, execution logs, final replies, code review, and source browsing into one workspace.
14
14
 
15
15
  PromptX can also reuse sessions with these agent CLIs in both directions:
16
16
 
17
17
  - Start a session in `Codex`, `Claude Code`, or `OpenCode`, then continue it inside PromptX
18
18
  - Start and advance a project inside PromptX, then resume the same session back in the agent CLI
19
19
 
20
+ ## Why It Is More Useful Now
21
+
22
+ - One project can attach multiple agents, and you can switch the send target from the right panel
23
+ - Review `PromptX` input cards, execution logs, final replies, and run history on the same page
24
+ - Browse the current project source code in read-only mode, with path and content search
25
+ - Inspect workspace-level, task-level, or per-run diffs without leaving the app
26
+ - Insert useful fragments from prompts, replies, source files, and diffs back into the editor
27
+ - Multiple built-in themes are available; the screenshots below use the `WeChat` theme
28
+ - Relay support lets you access your local PromptX from mobile or external networks
29
+
20
30
  ## Quick Start
21
31
 
22
32
  ### Requirements
@@ -45,51 +55,82 @@ promptx status
45
55
  promptx stop
46
56
  ```
47
57
 
48
- ### How To Use
58
+ ### Basic Workflow
49
59
 
50
- 1. Create a task and prepare the context you want to send
51
- 2. Bind the task to a project
52
- 3. Choose a working directory and engine for that project
53
- 4. Send and review execution logs, final replies, and code diffs on the same page
60
+ 1. Create a task and prepare the requirements, logs, screenshots, and files you want to send
61
+ 2. Bind that task to a project
62
+ 3. Choose a working directory, default engine, and optional collaborating agents
63
+ 4. Pick which agent should receive this round from the right panel
64
+ 5. Send and review logs, replies, source files, and diffs in the same workspace
65
+ 6. Insert useful snippets back into the editor and continue the next round
54
66
 
55
67
  ## Core Features
56
68
 
57
69
  - Structured input: text, images, `md`, `txt`, and `pdf`
58
- - Project reuse: keep a stable directory and engine/thread context
59
- - Visible process: inspect logs, final replies, and run history
70
+ - Project reuse: keep a stable directory and default engine/thread context
71
+ - Multi-agent collaboration: one project can attach `Codex`, `Claude Code`, and `OpenCode`
72
+ - Visible process: inspect execution logs, final replies, and run history
73
+ - Source browser: read-only source browsing with path search and content search
60
74
  - Built-in diff review: inspect workspace, accumulated task, or per-run changes
61
- - Multi-engine support: `Codex`, `Claude Code`, `OpenCode`
75
+ - Context reinsertion: insert content from prompts, replies, source files, and diffs back into the editor
62
76
  - Session interoperability: PromptX can reuse sessions with `Codex`, `Claude Code`, and `OpenCode`
63
77
  - Remote access: connect from mobile or external networks through Relay
64
78
 
65
79
  ## Screenshots
66
80
 
67
- ### Workspace
81
+ All screenshots below use the `WeChat` theme.
82
+
83
+ ### 1. Workspace Overview
84
+
85
+ See the task list, agent filter, input cards, execution logs, and final replies together.
86
+
87
+ ![PromptX workspace overview](docs/assets/readme-workbench-wechat.png)
88
+
89
+ ### 2. Execution Logs and Replies
90
+
91
+ Review prompts, process logs, and final replies from the same round without bouncing between the terminal and diff tools.
92
+
93
+ ![PromptX execution focus](docs/assets/readme-execution-focus-wechat.png)
94
+
95
+ ### 3. Multi-Agent Project Management
96
+
97
+ One project can attach multiple agents while sharing the same directory. Each agent builds its own thread on first send.
98
+
99
+ ![PromptX multi-agent project management](docs/assets/readme-project-manager-wechat.png)
100
+
101
+ ### 4. Read-Only Source Browser
102
+
103
+ Use the directory tree and search results on the left, with file preview on the right, to inspect code and send context back into the editor.
104
+
105
+ ![PromptX source browser](docs/assets/readme-source-browser-wechat.png)
106
+
107
+ ### 5. Diff Review
108
+
109
+ Inspect workspace-level, task-level, or single-run changes to understand exactly what an agent changed.
110
+
111
+ ![PromptX diff review](docs/assets/readme-diff-wechat.png)
68
112
 
69
- ![PromptX workspace](docs/assets/readme-workbench-glass.png)
113
+ ### 6. Settings and System Panels
70
114
 
71
- ### Settings
115
+ Theme, shortcuts, remote access, and system configuration all live in the same settings dialog.
72
116
 
73
- ![PromptX settings](docs/assets/readme-settings-theme-glass.png)
117
+ ![PromptX theme settings](docs/assets/readme-settings-theme-wechat.png)
74
118
 
75
- ### Mobile
119
+ ![PromptX system settings](docs/assets/readme-settings-system-wechat.png)
76
120
 
77
- ![PromptX mobile](docs/assets/readme-mobile-remote-glass.png)
121
+ ### 7. Mobile
78
122
 
79
- ## Why It Helps
123
+ With Relay or local network access, you can keep reading replies and pushing work forward from your phone.
80
124
 
81
- - Keeps long-running tasks out of scattered terminal tabs and notes
82
- - Avoids re-explaining directories, projects, and context every round
83
- - Lets you review process and result together, not just the final answer
84
- - Makes code review easier with built-in diff inspection
85
- - Keeps tasks accessible on mobile when you are away from your desk
125
+ ![PromptX mobile](docs/assets/readme-mobile-wechat.png)
86
126
 
87
127
  ## Good Fit For
88
128
 
89
- - Preparing requirements, screenshots, logs, and files before sending
90
- - Reusing the same project and directory across many rounds
91
- - Reviewing execution logs, final output, and code changes together
92
- - Exposing local PromptX to phones or external networks through Relay
129
+ - Preparing requirements, screenshots, logs, and files before sending them to an agent
130
+ - Reusing the same project, directory, and thread across many rounds
131
+ - Coordinating multiple agents in one task without bouncing between terminals
132
+ - Reviewing execution logs, replies, source files, and code changes together
133
+ - Continuing local PromptX work from your phone when you are away from your desk
93
134
 
94
135
  ## Development
95
136
 
package/README.md CHANGED
@@ -2,20 +2,30 @@
2
2
 
3
3
  [English README](README.en.md)
4
4
 
5
- PromptX 是一个面向本机 AI Agent 协作的工作台。
5
+ PromptX 是一个面向本机 AI Agent 的协作工作台。
6
6
 
7
- 它把 `Codex`、`Claude Code`、`OpenCode` 的使用过程整理成一套更顺手的结构:
7
+ 它把 `Codex`、`Claude Code`、`OpenCode` 这些你已经熟悉的 CLI,整理成一套更适合持续协作的界面:
8
8
 
9
9
  ```text
10
10
  任务 -> 项目 -> 目录 -> 线程 -> Run -> Diff
11
11
  ```
12
12
 
13
- 你继续使用熟悉的 agent CLI,PromptX 负责把输入整理、项目绑定、执行过程、最终回复和代码变更放进同一个工作台里。
13
+ 你继续使用熟悉的 agent 与模型,PromptX 负责把输入整理、项目绑定、执行过程、最终回复、代码变更、源码查看放进同一个工作台里。
14
14
 
15
- 并且,PromptX 和这些 agent CLI 之间可以互相复用会话:
15
+ 并且,PromptX 与这些 agent CLI 可以双向复用会话:
16
16
 
17
- - 可以在 `Codex`、`Claude Code`、`OpenCode` 里先创建会话,再回到 PromptX 里继续
18
- - 也可以在 PromptX 里创建和推进项目,再回到 agent CLI 里直接恢复同一个会话
17
+ - 你可以先在 `Codex`、`Claude Code`、`OpenCode` 里创建会话,再回到 PromptX 继续
18
+ - 也可以在 PromptX 里创建和推进项目,再回到 agent CLI 里恢复同一个会话
19
+
20
+ ## 为什么现在值得用
21
+
22
+ - 一个项目可以挂多个 Agent,右侧直接切换发送目标
23
+ - 同页查看 `PromptX` 输入卡片、执行过程、最终回复、历史 run
24
+ - 直接查看当前项目源码,并支持按路径或内容搜索
25
+ - 直接审查 workspace / 任务累计 / 单轮 run 的代码变更
26
+ - 可以把 `Prompt`、回复、源码、Diff 中的内容再次插回编辑区,继续下一轮
27
+ - 内置多主题,当前 README 截图统一使用 `WeChat` 主题
28
+ - 可配合 Relay 从手机或外网访问自己的 PromptX
19
29
 
20
30
  ## 快速开始
21
31
 
@@ -45,51 +55,82 @@ promptx status
45
55
  promptx stop
46
56
  ```
47
57
 
48
- ### 怎么用
58
+ ### 基本使用流程
49
59
 
50
- 1. 新建任务,整理本轮要发给 agent 的内容
60
+ 1. 新建任务,先整理本轮要发给 agent 的需求、日志、图片、文件
51
61
  2. 给任务绑定一个项目
52
- 3. 给项目选择工作目录和执行引擎
53
- 4. 点击发送,在同一页查看执行过程、最终回复和代码变更
62
+ 3. 给项目选择工作目录、默认执行引擎,以及可协作的其他 Agents
63
+ 4. 在右侧选择这轮要发给哪个 Agent
64
+ 5. 发送后,在同一页查看执行过程、最终回复、源码、代码变更
65
+ 6. 把有价值的片段重新插回编辑区,继续下一轮
54
66
 
55
67
  ## 核心能力
56
68
 
57
69
  - 输入整理:支持文本、图片、`md`、`txt`、`pdf`
58
- - 项目复用:一个项目绑定固定目录和执行引擎,持续复用线程上下文
70
+ - 项目复用:一个项目绑定固定目录与默认执行引擎,持续复用线程上下文
71
+ - 多 Agent 协作:一个项目可同时挂 `Codex`、`Claude Code`、`OpenCode`
59
72
  - 过程可见:同页查看执行过程、最终回复、历史 run
73
+ - 源码查看:只读浏览当前项目源码,支持路径搜索与内容搜索
60
74
  - 代码审查:直接查看 workspace / 任务累计 / 单次 run 的 diff
61
- - 多引擎统一:当前支持 `Codex`、`Claude Code`、`OpenCode`
75
+ - 上下文回插:支持从 Prompt、回复、源码、Diff 中选取内容插回编辑区
62
76
  - 会话互通:PromptX 与 `Codex`、`Claude Code`、`OpenCode` 可双向复用会话
63
77
  - 远程访问:支持通过 Relay 从手机或外网访问自己的 PromptX
64
78
 
65
79
  ## 系统截图
66
80
 
67
- ### 工作台
81
+ 以下截图基于 `WeChat` 主题。
82
+
83
+ ### 1. 工作台总览
84
+
85
+ 可以同时看到任务列表、Agent 过滤、输入卡片、执行过程和最终回复。
86
+
87
+ ![PromptX 工作台总览](docs/assets/readme-workbench-wechat.png)
88
+
89
+ ### 2. 执行过程与回复
90
+
91
+ 同一轮里直接看 Prompt、过程日志、最终回复,不用在终端和 diff 工具之间来回切。
92
+
93
+ ![PromptX 执行过程与回复](docs/assets/readme-execution-focus-wechat.png)
94
+
95
+ ### 3. 多 Agent 项目管理
96
+
97
+ 一个项目可以挂多个 Agent,目录保持一致,首次发送时自动建立各自线程。
98
+
99
+ ![PromptX 多 Agent 项目管理](docs/assets/readme-project-manager-wechat.png)
100
+
101
+ ### 4. 只读源码查看
102
+
103
+ 左侧目录树与搜索结果,右侧文件预览;适合快速浏览、搜索、选中代码并插回编辑区。
104
+
105
+ ![PromptX 源码查看](docs/assets/readme-source-browser-wechat.png)
106
+
107
+ ### 5. 代码变更审查
108
+
109
+ 直接看当前项目、任务累计或单轮 run 的代码变更,适合回顾 agent 到底改了什么。
110
+
111
+ ![PromptX 代码变更审查](docs/assets/readme-diff-wechat.png)
68
112
 
69
- ![PromptX 工作台](docs/assets/readme-workbench-glass.png)
113
+ ### 6. 设置与系统
70
114
 
71
- ### 设置
115
+ 主题、快捷键、远程访问、系统配置集中在同一个设置面板里。
72
116
 
73
- ![PromptX 设置](docs/assets/readme-settings-theme-glass.png)
117
+ ![PromptX 主题设置](docs/assets/readme-settings-theme-wechat.png)
74
118
 
75
- ### 手机端
119
+ ![PromptX 系统设置](docs/assets/readme-settings-system-wechat.png)
76
120
 
77
- ![PromptX 手机端](docs/assets/readme-mobile-remote-glass.png)
121
+ ### 7. 手机端
78
122
 
79
- ## 为什么好用
123
+ 通过 Relay 或局域网访问时,可以在手机端继续查看任务、阅读回复、推进协作。
80
124
 
81
- - 不用把多轮任务散落在终端和聊天记录里
82
- - 不用每轮都重新交代目录、项目和上下文
83
- - 不只看最终一句回答,还能回看过程和 run 历史
84
- - 改完代码后不用再切回命令行单独看 diff
85
- - 离开电脑后,也能继续在手机上看任务和推进任务
125
+ ![PromptX 手机端](docs/assets/readme-mobile-wechat.png)
86
126
 
87
127
  ## 适合什么场景
88
128
 
89
129
  - 先整理需求、截图、日志、文件,再交给 agent 执行
90
130
  - 一个项目要持续多轮协作,希望稳定复用目录和线程
91
- - 需要同时看执行过程、最终回复和代码改动
92
- - 希望把本机 PromptX 通过 Relay 暴露给手机或外部网络
131
+ - 一个任务里需要多个 Agent 配合,但又不想来回切命令行
132
+ - 需要同时看执行过程、最终回复、源码与代码改动
133
+ - 离开电脑后,也想从手机继续推进本机 PromptX
93
134
 
94
135
  ## 源码开发
95
136
 
@@ -83,6 +83,30 @@ function registerCodexRoutes(app, options = {}) {
83
83
  updatePromptxCodexSession,
84
84
  } = options
85
85
 
86
+ function getProjectRelatedSessionIds(session = null) {
87
+ const ids = new Set()
88
+ const rootId = String(session?.id || '').trim()
89
+ if (rootId) {
90
+ ids.add(rootId)
91
+ }
92
+
93
+ ;(Array.isArray(session?.agentBindings) ? session.agentBindings : []).forEach((item) => {
94
+ const memberId = String(item?.sessionRecordId || '').trim()
95
+ if (memberId) {
96
+ ids.add(memberId)
97
+ }
98
+ })
99
+
100
+ return [...ids]
101
+ }
102
+
103
+ function findRunningProjectRun(session = null) {
104
+ const sessionIds = getProjectRelatedSessionIds(session)
105
+ return sessionIds
106
+ .map((sessionId) => getRunningCodexRunBySessionId(sessionId))
107
+ .find(Boolean) || null
108
+ }
109
+
86
110
  app.get('/api/codex/sessions', async () => ({
87
111
  items: decorateCodexSessionList(listPromptxCodexSessions()),
88
112
  }))
@@ -183,7 +207,12 @@ function registerCodexRoutes(app, options = {}) {
183
207
 
184
208
  app.post('/api/codex/sessions/:sessionId/reset', async (request, reply) => {
185
209
  const sessionId = String(request.params.sessionId || '').trim()
186
- if (getRunningCodexRunBySessionId(sessionId)) {
210
+ const projectSession = getPromptxCodexSessionById(sessionId)
211
+ if (!projectSession) {
212
+ return reply.code(404).send({ messageKey: 'errors.sessionNotFound', message: '没有找到对应的 PromptX 项目。' })
213
+ }
214
+
215
+ if (findRunningProjectRun(projectSession)) {
187
216
  return reply.code(409).send({
188
217
  messageKey: 'errors.currentProjectRunning',
189
218
  message: '当前项目正在执行中,请先停止后再新建会话。',
@@ -200,9 +229,6 @@ function registerCodexRoutes(app, options = {}) {
200
229
  }
201
230
 
202
231
  const session = resetPromptxCodexSession(sessionId)
203
- if (!session) {
204
- return reply.code(404).send({ messageKey: 'errors.sessionNotFound', message: '没有找到对应的 PromptX 项目。' })
205
- }
206
232
 
207
233
  affectedTaskSlugs.forEach((taskSlug) => {
208
234
  deleteTaskCodexRuns(taskSlug)
@@ -224,7 +250,12 @@ function registerCodexRoutes(app, options = {}) {
224
250
  })
225
251
 
226
252
  app.delete('/api/codex/sessions/:sessionId', async (request, reply) => {
227
- if (getRunningCodexRunBySessionId(request.params.sessionId)) {
253
+ const projectSession = getPromptxCodexSessionById(request.params.sessionId)
254
+ if (!projectSession) {
255
+ return reply.code(404).send({ messageKey: 'errors.sessionNotFound', message: '没有找到对应的 PromptX 项目。' })
256
+ }
257
+
258
+ if (findRunningProjectRun(projectSession)) {
228
259
  return reply.code(409).send({
229
260
  messageKey: 'errors.currentProjectDeleteWhileRunning',
230
261
  message: '当前项目正在执行中,请先停止后再删除。',
@@ -233,9 +264,6 @@ function registerCodexRoutes(app, options = {}) {
233
264
 
234
265
  const affectedTaskSlugs = clearTaskCodexSessionReferences(request.params.sessionId)
235
266
  const session = deletePromptxCodexSession(request.params.sessionId)
236
- if (!session) {
237
- return reply.code(404).send({ messageKey: 'errors.sessionNotFound', message: '没有找到对应的 PromptX 项目。' })
238
- }
239
267
 
240
268
  broadcastServerEvent('sessions.changed', {
241
269
  sessionId: request.params.sessionId,