@muyichengshayu/promptx 0.1.47 → 0.1.48
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 +6 -0
- package/apps/runner/src/engines/claudeCodeRunner.test.js +181 -0
- package/apps/runner/src/engines/openCodeRunner.test.js +73 -0
- package/apps/runner/src/runManager.test.js +724 -0
- package/apps/runner/src/serverClient.test.js +93 -0
- package/apps/server/src/agentSessionDiscovery.test.js +127 -0
- package/apps/server/src/agents/claudeCodeRunner.test.js +433 -0
- package/apps/server/src/agents/openCodeRunner.test.js +236 -0
- package/apps/server/src/agents/runnerContract.test.js +382 -0
- package/apps/server/src/appPaths.test.js +52 -0
- package/apps/server/src/assetRoutes.test.js +168 -0
- package/apps/server/src/codex.test.js +518 -0
- package/apps/server/src/codexRoutes.test.js +376 -0
- package/apps/server/src/codexRuns.test.js +160 -0
- package/apps/server/src/codexSessions.test.js +131 -0
- package/apps/server/src/db.test.js +182 -0
- package/apps/server/src/gitDiff.test.js +278 -0
- package/apps/server/src/gitDiffClient.test.js +113 -0
- package/apps/server/src/internalRoutes.test.js +94 -0
- package/apps/server/src/maintenance.test.js +154 -0
- package/apps/server/src/processControl.test.js +147 -0
- package/apps/server/src/relayClient.test.js +478 -0
- package/apps/server/src/relayConfig.test.js +38 -0
- package/apps/server/src/relayProtocol.test.js +49 -0
- package/apps/server/src/relayServer.test.js +798 -0
- package/apps/server/src/relayTenants.test.js +137 -0
- package/apps/server/src/relayUsageStore.test.js +65 -0
- package/apps/server/src/repository.test.js +150 -0
- package/apps/server/src/runDispatchService.test.js +301 -0
- package/apps/server/src/runEventIngest.test.js +135 -0
- package/apps/server/src/runRecovery.test.js +73 -0
- package/apps/server/src/runnerClient.test.js +80 -0
- package/apps/server/src/runnerDispatch.test.js +136 -0
- package/apps/server/src/systemConfig.test.js +44 -0
- package/apps/server/src/systemRoutes.test.js +251 -0
- package/apps/server/src/taskRoutes.test.js +266 -0
- package/apps/server/src/upload.test.js +30 -0
- package/apps/server/src/webAppRoutes.test.js +67 -0
- package/apps/server/src/workspaceFiles.test.js +262 -0
- package/apps/web/dist/assets/{CodexSessionManagerDialog-DZk_ClXW.js → CodexSessionManagerDialog-CBD-Qfra.js} +1 -1
- package/apps/web/dist/assets/{TaskDiffReviewDialog-B28M4Rwo.js → TaskDiffReviewDialog-Dl_-f3f3.js} +1 -1
- package/apps/web/dist/assets/{WorkbenchSettingsDialog-DrXiTtO_.js → WorkbenchSettingsDialog-BN9QGfvY.js} +1 -1
- package/apps/web/dist/assets/{WorkbenchView-BdPC47JX.js → WorkbenchView-BQ8DWZ-_.js} +15 -15
- package/apps/web/dist/assets/{index-Bx48HpZF.js → index-OSgndpOb.js} +2 -2
- package/apps/web/dist/index.html +1 -1
- package/package.json +14 -21
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.48
|
|
4
|
+
|
|
5
|
+
- 修复移动端“选中后插入到编辑区”偶发无效的问题:选区按钮改为更早的 `pointerdown` 触发,避免手机上点击按钮时浏览器先清掉选区,导致按钮消失但内容没有真正插入。
|
|
6
|
+
- 修复 OpenCode 本机会话发现排序在发布测试中不稳定的问题:当候选时间同时存在“显式会话时间”和“文件推断时间”时,改为优先使用 OpenCode 自身记录的显式时间,避免同目录下候选顺序偶发抖动。
|
|
7
|
+
- 局域网联调结束后,前端开发服务默认 host 恢复为 `127.0.0.1`,避免开发机在日常使用时继续暴露到本地网络。
|
|
8
|
+
|
|
3
9
|
## 0.1.47
|
|
4
10
|
|
|
5
11
|
- 工作台新增“选中插入到编辑区”能力:在模型回复、项目源码查看与代码变更里都可直接拖选内容并一键插入右侧编辑区;其中模型回复按普通文本插入,更适合二次处理,源码与 diff 继续按代码上下文块插入。
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
import test from 'node:test'
|
|
2
|
+
import assert from 'node:assert/strict'
|
|
3
|
+
|
|
4
|
+
import { createClaudeNormalizationState, normalizeClaudeEvents } from './claudeCodeRunner.js'
|
|
5
|
+
|
|
6
|
+
test('runner claudeCodeRunner maps fatal auth api_retry to error event', () => {
|
|
7
|
+
assert.deepEqual(
|
|
8
|
+
normalizeClaudeEvents({
|
|
9
|
+
type: 'system',
|
|
10
|
+
subtype: 'api_retry',
|
|
11
|
+
attempt: 1,
|
|
12
|
+
max_retries: 10,
|
|
13
|
+
error_status: 401,
|
|
14
|
+
error: 'authentication_failed',
|
|
15
|
+
}),
|
|
16
|
+
[{
|
|
17
|
+
type: 'error',
|
|
18
|
+
message: 'Claude Code 认证失败(HTTP 401 authentication_failed)。请重新登录 Claude Code,或检查当前环境中的认证令牌配置。',
|
|
19
|
+
}]
|
|
20
|
+
)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
test('runner claudeCodeRunner maps transient api_retry to reconnecting error event', () => {
|
|
24
|
+
assert.deepEqual(
|
|
25
|
+
normalizeClaudeEvents({
|
|
26
|
+
type: 'system',
|
|
27
|
+
subtype: 'api_retry',
|
|
28
|
+
attempt: 2,
|
|
29
|
+
max_retries: 10,
|
|
30
|
+
error_status: 503,
|
|
31
|
+
error: 'overloaded',
|
|
32
|
+
}),
|
|
33
|
+
[{
|
|
34
|
+
type: 'error',
|
|
35
|
+
message: 'Reconnecting... 2/10 (HTTP 503 overloaded)',
|
|
36
|
+
}]
|
|
37
|
+
)
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
test('runner claudeCodeRunner maps Agent sub-agents into collaboration events', () => {
|
|
41
|
+
const state = createClaudeNormalizationState()
|
|
42
|
+
|
|
43
|
+
assert.deepEqual(
|
|
44
|
+
normalizeClaudeEvents({
|
|
45
|
+
type: 'assistant',
|
|
46
|
+
message: {
|
|
47
|
+
content: [
|
|
48
|
+
{
|
|
49
|
+
type: 'tool_use',
|
|
50
|
+
id: 'agent-tool-1',
|
|
51
|
+
name: 'Agent',
|
|
52
|
+
input: {
|
|
53
|
+
description: 'Analyze a.js exports',
|
|
54
|
+
subagent_type: 'general-purpose',
|
|
55
|
+
prompt: 'Analyze a.js in the current directory.',
|
|
56
|
+
model: 'sonnet',
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
}, state),
|
|
62
|
+
[{
|
|
63
|
+
type: 'item.started',
|
|
64
|
+
item: {
|
|
65
|
+
type: 'collab_tool_call',
|
|
66
|
+
tool: 'spawn_agent',
|
|
67
|
+
receiver_thread_ids: [],
|
|
68
|
+
prompt: 'Analyze a.js in the current directory.',
|
|
69
|
+
agents_states: {},
|
|
70
|
+
},
|
|
71
|
+
}]
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
assert.deepEqual(
|
|
75
|
+
normalizeClaudeEvents({
|
|
76
|
+
type: 'system',
|
|
77
|
+
subtype: 'task_started',
|
|
78
|
+
tool_use_id: 'agent-tool-1',
|
|
79
|
+
task_id: 'task-a',
|
|
80
|
+
description: 'Analyze a.js exports',
|
|
81
|
+
}, state),
|
|
82
|
+
[{
|
|
83
|
+
type: 'item.completed',
|
|
84
|
+
item: {
|
|
85
|
+
type: 'collab_tool_call',
|
|
86
|
+
tool: 'spawn_agent',
|
|
87
|
+
receiver_thread_ids: ['task-a'],
|
|
88
|
+
prompt: 'Analyze a.js in the current directory.',
|
|
89
|
+
agents_states: {
|
|
90
|
+
'task-a': {
|
|
91
|
+
status: 'running',
|
|
92
|
+
message: '',
|
|
93
|
+
title: 'Analyze a.js exports',
|
|
94
|
+
role: 'general-purpose',
|
|
95
|
+
target: 'a.js',
|
|
96
|
+
model: 'sonnet',
|
|
97
|
+
task_id: 'task-a',
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
}]
|
|
102
|
+
)
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
test('runner claudeCodeRunner maps task_completed and ignores duplicate tool_result for Agent sub-agents', () => {
|
|
106
|
+
const state = createClaudeNormalizationState()
|
|
107
|
+
|
|
108
|
+
normalizeClaudeEvents({
|
|
109
|
+
type: 'assistant',
|
|
110
|
+
message: {
|
|
111
|
+
content: [
|
|
112
|
+
{
|
|
113
|
+
type: 'tool_use',
|
|
114
|
+
id: 'agent-tool-2',
|
|
115
|
+
name: 'Agent',
|
|
116
|
+
input: {
|
|
117
|
+
description: 'Analyze b.js exports',
|
|
118
|
+
subagent_type: 'general-purpose',
|
|
119
|
+
prompt: 'Analyze b.js in the current directory.',
|
|
120
|
+
model: 'sonnet',
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
}, state)
|
|
126
|
+
|
|
127
|
+
normalizeClaudeEvents({
|
|
128
|
+
type: 'system',
|
|
129
|
+
subtype: 'task_started',
|
|
130
|
+
tool_use_id: 'agent-tool-2',
|
|
131
|
+
task_id: 'task-b',
|
|
132
|
+
description: 'Analyze b.js exports',
|
|
133
|
+
}, state)
|
|
134
|
+
|
|
135
|
+
assert.deepEqual(
|
|
136
|
+
normalizeClaudeEvents({
|
|
137
|
+
type: 'system',
|
|
138
|
+
subtype: 'task_completed',
|
|
139
|
+
task_id: 'task-b',
|
|
140
|
+
result: 'found 2 exports',
|
|
141
|
+
description: 'Analyze b.js exports',
|
|
142
|
+
}, state),
|
|
143
|
+
[{
|
|
144
|
+
type: 'item.completed',
|
|
145
|
+
item: {
|
|
146
|
+
type: 'collab_tool_call',
|
|
147
|
+
tool: 'wait',
|
|
148
|
+
receiver_thread_ids: ['task-b'],
|
|
149
|
+
prompt: 'Analyze b.js in the current directory.',
|
|
150
|
+
agents_states: {
|
|
151
|
+
'task-b': {
|
|
152
|
+
status: 'completed',
|
|
153
|
+
message: 'found 2 exports',
|
|
154
|
+
title: 'Analyze b.js exports',
|
|
155
|
+
role: 'general-purpose',
|
|
156
|
+
target: 'b.js',
|
|
157
|
+
model: 'sonnet',
|
|
158
|
+
task_id: 'task-b',
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
},
|
|
162
|
+
}]
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
assert.deepEqual(
|
|
166
|
+
normalizeClaudeEvents({
|
|
167
|
+
type: 'user',
|
|
168
|
+
message: {
|
|
169
|
+
content: [
|
|
170
|
+
{
|
|
171
|
+
type: 'tool_result',
|
|
172
|
+
tool_use_id: 'agent-tool-2',
|
|
173
|
+
content: 'duplicate result',
|
|
174
|
+
is_error: false,
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
},
|
|
178
|
+
}, state),
|
|
179
|
+
[]
|
|
180
|
+
)
|
|
181
|
+
})
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import test from 'node:test'
|
|
2
|
+
import assert from 'node:assert/strict'
|
|
3
|
+
|
|
4
|
+
import { normalizeOpenCodeEvents } from './openCodeRunner.js'
|
|
5
|
+
|
|
6
|
+
test('runner openCodeRunner maps sub-agent task tool_use to collaboration events', () => {
|
|
7
|
+
assert.deepEqual(
|
|
8
|
+
normalizeOpenCodeEvents({
|
|
9
|
+
type: 'tool_use',
|
|
10
|
+
sessionID: 'ses_main',
|
|
11
|
+
part: {
|
|
12
|
+
type: 'tool',
|
|
13
|
+
tool: 'task',
|
|
14
|
+
state: {
|
|
15
|
+
status: 'completed',
|
|
16
|
+
input: {
|
|
17
|
+
description: '分析 a.js 文件',
|
|
18
|
+
prompt: '请分析 /tmp/demo/a.js 文件',
|
|
19
|
+
subagent_type: 'explore',
|
|
20
|
+
},
|
|
21
|
+
output: 'task_id: ses_child_1\n\n<task_result>ok</task_result>',
|
|
22
|
+
metadata: {
|
|
23
|
+
sessionId: 'ses_child_1',
|
|
24
|
+
model: {
|
|
25
|
+
providerID: 'opencode',
|
|
26
|
+
modelID: 'minimax-m2.5-free',
|
|
27
|
+
},
|
|
28
|
+
},
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
[
|
|
33
|
+
{
|
|
34
|
+
type: 'item.completed',
|
|
35
|
+
item: {
|
|
36
|
+
type: 'collab_tool_call',
|
|
37
|
+
tool: 'spawn_agent',
|
|
38
|
+
receiver_thread_ids: ['ses_child_1'],
|
|
39
|
+
prompt: '请分析 /tmp/demo/a.js 文件',
|
|
40
|
+
agents_states: {
|
|
41
|
+
ses_child_1: {
|
|
42
|
+
status: 'completed',
|
|
43
|
+
message: 'task_id: ses_child_1\n\n<task_result>ok</task_result>',
|
|
44
|
+
title: '分析 a.js 文件',
|
|
45
|
+
role: 'explore',
|
|
46
|
+
target: 'a.js',
|
|
47
|
+
model: 'opencode/minimax-m2.5-free',
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
type: 'item.completed',
|
|
54
|
+
item: {
|
|
55
|
+
type: 'collab_tool_call',
|
|
56
|
+
tool: 'wait',
|
|
57
|
+
receiver_thread_ids: ['ses_child_1'],
|
|
58
|
+
prompt: '请分析 /tmp/demo/a.js 文件',
|
|
59
|
+
agents_states: {
|
|
60
|
+
ses_child_1: {
|
|
61
|
+
status: 'completed',
|
|
62
|
+
message: 'task_id: ses_child_1\n\n<task_result>ok</task_result>',
|
|
63
|
+
title: '分析 a.js 文件',
|
|
64
|
+
role: 'explore',
|
|
65
|
+
target: 'a.js',
|
|
66
|
+
model: 'opencode/minimax-m2.5-free',
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
]
|
|
72
|
+
)
|
|
73
|
+
})
|