@crewx/cli 0.9.0-rc.138 → 0.9.0-rc.139
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/dist/commands/restart.d.ts +3 -1
- package/dist/commands/restart.js +14 -4
- package/dist/commands/result.js +13 -6
- package/package.json +15 -15
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
* crewx restart <task-id>
|
|
15
15
|
*
|
|
16
16
|
* Behavior:
|
|
17
|
-
* - Only tasks with status='failed' can be restarted
|
|
17
|
+
* - Only tasks with status='failed' can be restarted, except a run whose end was not
|
|
18
|
+
* observed (`terminalReason: 'runner_lost'`): it may still be running, so it is refused
|
|
19
|
+
* by default (same decision as the SDK's `isTaskRetryableByDefault`).
|
|
18
20
|
* - A new taskId is generated; the original task row is never mutated.
|
|
19
21
|
* - metadata.restartedFromTaskId (+ retriedFromTaskId for compat) is recorded.
|
|
20
22
|
* - The Web UI `TSK.RETRY` system-message prefix is reused verbatim.
|
package/dist/commands/restart.js
CHANGED
|
@@ -15,7 +15,9 @@
|
|
|
15
15
|
* crewx restart <task-id>
|
|
16
16
|
*
|
|
17
17
|
* Behavior:
|
|
18
|
-
* - Only tasks with status='failed' can be restarted
|
|
18
|
+
* - Only tasks with status='failed' can be restarted, except a run whose end was not
|
|
19
|
+
* observed (`terminalReason: 'runner_lost'`): it may still be running, so it is refused
|
|
20
|
+
* by default (same decision as the SDK's `isTaskRetryableByDefault`).
|
|
19
21
|
* - A new taskId is generated; the original task row is never mutated.
|
|
20
22
|
* - metadata.restartedFromTaskId (+ retriedFromTaskId for compat) is recorded.
|
|
21
23
|
* - The Web UI `TSK.RETRY` system-message prefix is reused verbatim.
|
|
@@ -75,9 +77,17 @@ async function handleRestart(args) {
|
|
|
75
77
|
process.exit(1);
|
|
76
78
|
return;
|
|
77
79
|
}
|
|
78
|
-
if (
|
|
79
|
-
|
|
80
|
-
|
|
80
|
+
if (!(0, sdk_1.isTaskRetryableByDefault)(original)) {
|
|
81
|
+
if ((0, sdk_1.normalizeTaskStatus)(original) === 'failed') {
|
|
82
|
+
// failed + runner_lost: the run was marked failed without anyone seeing it end.
|
|
83
|
+
process.stderr.write(`Error: Task ${taskId} was not restarted: the end of the run was not observed (runner lost), ` +
|
|
84
|
+
`so it may have done part of the work or may still be running. ` +
|
|
85
|
+
`Check it with \`crewx log ${taskId}\` or \`crewx ps\` before running it again.\n`);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
process.stderr.write(`Error: Task ${taskId} is not in failed state (current: ${original.status ?? 'unknown'}). ` +
|
|
89
|
+
`Only failed tasks can be restarted.\n`);
|
|
90
|
+
}
|
|
81
91
|
process.exit(1);
|
|
82
92
|
return;
|
|
83
93
|
}
|
package/dist/commands/result.js
CHANGED
|
@@ -20,14 +20,22 @@ const repository_1 = require("@crewx/sdk/repository");
|
|
|
20
20
|
const cal_1 = require("./cal");
|
|
21
21
|
const POLL_INTERVAL_MS = 1000;
|
|
22
22
|
const REAP_INTERVAL_MS = 10_000;
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
/**
|
|
24
|
+
* A run whose end was not observed is `failed` with the structured reason `runner_lost`, not a
|
|
25
|
+
* status of its own: it may have done part of the work or may still be running.
|
|
26
|
+
*/
|
|
27
|
+
function isRunnerLost(task) {
|
|
28
|
+
return task.status === 'failed' && (0, repository_1.readTaskTerminalReason)(task) === 'runner_lost';
|
|
29
|
+
}
|
|
30
|
+
function statusIcon(task) {
|
|
31
|
+
if (isRunnerLost(task))
|
|
32
|
+
return '⚠️';
|
|
33
|
+
switch (task.status) {
|
|
25
34
|
case 'pending': return '🕓';
|
|
26
35
|
case 'running': return '⏳';
|
|
27
36
|
case 'success': return '✅';
|
|
28
37
|
case 'failed': return '❌';
|
|
29
38
|
case 'stopped': return '⏹';
|
|
30
|
-
case 'runner_lost': return '⚠️';
|
|
31
39
|
default: return '❓';
|
|
32
40
|
}
|
|
33
41
|
}
|
|
@@ -44,7 +52,6 @@ function resultCommandId(status) {
|
|
|
44
52
|
case 'success': return 'crewx.result-done';
|
|
45
53
|
case 'failed':
|
|
46
54
|
case 'stopped':
|
|
47
|
-
case 'runner_lost':
|
|
48
55
|
return 'crewx.result-terminal-abnormal';
|
|
49
56
|
default: return 'crewx.result';
|
|
50
57
|
}
|
|
@@ -103,7 +110,7 @@ async function handleResult(args) {
|
|
|
103
110
|
}
|
|
104
111
|
console.log('Recent Tasks (latest 10)\n');
|
|
105
112
|
recent.forEach((task, idx) => {
|
|
106
|
-
const icon = statusIcon(task
|
|
113
|
+
const icon = statusIcon(task);
|
|
107
114
|
console.log(`${idx + 1}. ${icon} ${task.id}`);
|
|
108
115
|
console.log(` Agent: ${task.agent_id ?? '—'} Mode: ${task.mode ?? '—'}`);
|
|
109
116
|
console.log(` Started: ${(0, sdk_1.formatDisplayTimestamp)(new Date(task.started_at))}`);
|
|
@@ -185,7 +192,7 @@ async function handleResult(args) {
|
|
|
185
192
|
process.exit(1);
|
|
186
193
|
return;
|
|
187
194
|
}
|
|
188
|
-
if (task
|
|
195
|
+
if (isRunnerLost(task)) {
|
|
189
196
|
console.error(`⚠️ Task ${taskId} runner lost before completion: ${task.error ?? 'no further details'}.`);
|
|
190
197
|
writeResultCalFooter(task);
|
|
191
198
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crewx/cli",
|
|
3
|
-
"version": "0.9.0-rc.
|
|
3
|
+
"version": "0.9.0-rc.139",
|
|
4
4
|
"license": "UNLICENSED",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20.19.0"
|
|
@@ -25,20 +25,20 @@
|
|
|
25
25
|
"better-sqlite3": "*",
|
|
26
26
|
"dotenv": "17.2.3",
|
|
27
27
|
"isomorphic-git": "1.37.1",
|
|
28
|
-
"@crewx/sdk": "0.9.0-rc.
|
|
29
|
-
"@crewx/
|
|
30
|
-
"@crewx/
|
|
31
|
-
"@crewx/search": "0.1.10-rc.
|
|
32
|
-
"@crewx/doc": "0.1.9-rc.
|
|
33
|
-
"@crewx/wbs": "0.1.10-rc.
|
|
34
|
-
"@crewx/workflow": "0.3.22-rc.
|
|
35
|
-
"@crewx/
|
|
36
|
-
"@crewx/
|
|
37
|
-
"@crewx/
|
|
38
|
-
"@crewx/
|
|
39
|
-
"@crewx/shared": "0.0.6-rc.
|
|
40
|
-
"@crewx/
|
|
41
|
-
"@crewx/
|
|
28
|
+
"@crewx/sdk": "0.9.0-rc.139",
|
|
29
|
+
"@crewx/knowledge-core": "0.1.17-rc.149",
|
|
30
|
+
"@crewx/memory": "0.1.23-rc.156",
|
|
31
|
+
"@crewx/search": "0.1.10-rc.135",
|
|
32
|
+
"@crewx/doc": "0.1.9-rc.132",
|
|
33
|
+
"@crewx/wbs": "0.1.10-rc.165",
|
|
34
|
+
"@crewx/workflow": "0.3.22-rc.185",
|
|
35
|
+
"@crewx/skill": "0.1.20-rc.33",
|
|
36
|
+
"@crewx/cron": "0.1.10-rc.174",
|
|
37
|
+
"@crewx/chromex": "0.1.0-rc.172",
|
|
38
|
+
"@crewx/app": "0.1.0-rc.20",
|
|
39
|
+
"@crewx/shared": "0.0.6-rc.54",
|
|
40
|
+
"@crewx/notify": "0.1.0-rc.110",
|
|
41
|
+
"@crewx/wi": "0.1.10-rc.159"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/better-sqlite3": "*",
|