@xevy/cli 0.1.16 → 0.1.18
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/README.md +9 -7
- package/bin/dev-session.mjs +24 -19
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -150,9 +150,9 @@ xevy dev VI22-07 --base https://xevy.example.com
|
|
|
150
150
|
```
|
|
151
151
|
|
|
152
152
|
The command stays attached across normal Pi exits and transient terminal
|
|
153
|
-
disconnects.
|
|
154
|
-
|
|
155
|
-
running.
|
|
153
|
+
disconnects. After Pi exits, it waits three seconds before restarting and shows
|
|
154
|
+
a `Ctrl+C` detach hint; press `Ctrl+]` while attached to leave the Dev Session
|
|
155
|
+
running immediately.
|
|
156
156
|
|
|
157
157
|
The CLI resolves an exact task ID or task code, attaches to its existing Dev
|
|
158
158
|
Session, or starts one from a linked repository. It then renders Pi's native TUI
|
|
@@ -165,8 +165,9 @@ repositories, the CLI presents a numbered selector first.
|
|
|
165
165
|
and Docker remain on the server. Press `Ctrl+]` to detach without stopping Pi;
|
|
166
166
|
run the same command again to reattach. Pi conversation history is stored in the
|
|
167
167
|
bounded Dev Session volume. The controller periodically commits work and pushes
|
|
168
|
-
the
|
|
169
|
-
|
|
168
|
+
the canonical task branch; exiting Pi also commits and pushes any final edits.
|
|
169
|
+
You do not need to ask the agent to commit after every prompt or merge a second
|
|
170
|
+
Dev Session branch when finishing.
|
|
170
171
|
|
|
171
172
|
Terminal control:
|
|
172
173
|
|
|
@@ -175,8 +176,9 @@ Ctrl+] Disconnect this terminal without stopping Pi or the Dev Session
|
|
|
175
176
|
```
|
|
176
177
|
|
|
177
178
|
Use the task's Dev Session panel in Xevy to open the live site, stop the session,
|
|
178
|
-
or finish
|
|
179
|
-
while the CLI is attached, within the
|
|
179
|
+
or finish it after exiting Pi. Preview redeploy remains a separate action. A
|
|
180
|
+
heartbeat keeps the session active while the CLI is attached, within the
|
|
181
|
+
server's hard expiry limit.
|
|
180
182
|
|
|
181
183
|
Host precedence is `--base`, `XEVY_BASE`, the saved credentials `baseUrl`, then
|
|
182
184
|
`https://xevy.ai`. API-key precedence is `XEVY_API_KEY`, then the saved key in
|
package/bin/dev-session.mjs
CHANGED
|
@@ -15,6 +15,7 @@ const SESSION_START_TIMEOUT_MS = 10 * 60_000;
|
|
|
15
15
|
const EXECUTION_RECONNECT_LIMIT = 8;
|
|
16
16
|
const TERMINAL_RECONNECT_LIMIT = 8;
|
|
17
17
|
const TERMINAL_RECONNECT_MAX_DELAY_MS = 5_000;
|
|
18
|
+
const TERMINAL_RESTART_GRACE_MS = 3_000;
|
|
18
19
|
const TERMINAL_STABLE_RUNTIME_MS = 10_000;
|
|
19
20
|
const TERMINAL_SPINNER_FRAMES = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
20
21
|
|
|
@@ -244,13 +245,12 @@ export function createApiClient({ base, token, fetchImpl, registerController, se
|
|
|
244
245
|
return { request };
|
|
245
246
|
}
|
|
246
247
|
|
|
247
|
-
function
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
return parsed.toString().replace(/\/$/, "");
|
|
248
|
+
export function devSessionLaunchUrl(base, task) {
|
|
249
|
+
const origin = normalizeBaseUrl(base);
|
|
250
|
+
return new URL(
|
|
251
|
+
`/${encodeURIComponent(task.workspaceIdentifier)}/${encodeURIComponent(task.projectIdentifier)}/task/${encodeURIComponent(task.id)}/dev-session/open`,
|
|
252
|
+
`${origin}/`,
|
|
253
|
+
).toString();
|
|
254
254
|
}
|
|
255
255
|
|
|
256
256
|
function formatTask(task) {
|
|
@@ -600,8 +600,8 @@ export function createTerminalStatus({ output, writeLine, animate }) {
|
|
|
600
600
|
};
|
|
601
601
|
}
|
|
602
602
|
|
|
603
|
-
function sessionSummary(task, session, writeLine) {
|
|
604
|
-
const url =
|
|
603
|
+
function sessionSummary(task, session, base, writeLine) {
|
|
604
|
+
const url = devSessionLaunchUrl(base, task);
|
|
605
605
|
writeLine("\nDev Session");
|
|
606
606
|
writeLine(` Task ${formatTask(task)}`);
|
|
607
607
|
writeLine(` Site ${url || "not available yet"}`);
|
|
@@ -741,6 +741,7 @@ async function attachNativeTerminalPersistently({
|
|
|
741
741
|
let consecutiveFailures = 0;
|
|
742
742
|
try {
|
|
743
743
|
while (!signal?.aborted) {
|
|
744
|
+
let reconnectDelayMs = null;
|
|
744
745
|
status.update(reconnecting ? "Restarting remote Pi terminal…" : "Starting remote Pi terminal…");
|
|
745
746
|
try {
|
|
746
747
|
const result = await attachNativeTerminal({
|
|
@@ -758,9 +759,12 @@ async function attachNativeTerminalPersistently({
|
|
|
758
759
|
consecutiveFailures = result?.durationMs >= TERMINAL_STABLE_RUNTIME_MS
|
|
759
760
|
? 0
|
|
760
761
|
: consecutiveFailures + 1;
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
762
|
+
if (result?.reason === "transport-lost") {
|
|
763
|
+
status.update("Terminal connection lost · reconnecting…");
|
|
764
|
+
} else {
|
|
765
|
+
reconnectDelayMs = TERMINAL_RESTART_GRACE_MS;
|
|
766
|
+
status.update("Pi exited · restarting in 3 seconds · Ctrl+C to detach");
|
|
767
|
+
}
|
|
764
768
|
} catch (error) {
|
|
765
769
|
if (signal?.aborted) throw error;
|
|
766
770
|
if (error instanceof DevSessionApiError && ![409, 502, 503, 504].includes(error.status)) throw error;
|
|
@@ -773,7 +777,8 @@ async function attachNativeTerminalPersistently({
|
|
|
773
777
|
throw new Error("The remote Pi terminal repeatedly exited before stabilizing. The Dev Session remains active; check its logs and rerun `xevy dev` after correcting the startup error.");
|
|
774
778
|
}
|
|
775
779
|
await sleep(
|
|
776
|
-
|
|
780
|
+
reconnectDelayMs
|
|
781
|
+
?? Math.min(500 * 2 ** Math.max(0, consecutiveFailures - 1), TERMINAL_RECONNECT_MAX_DELAY_MS),
|
|
777
782
|
signal,
|
|
778
783
|
);
|
|
779
784
|
let current = null;
|
|
@@ -799,7 +804,7 @@ function commandHelp(writeLine) {
|
|
|
799
804
|
writeLine(" /status Refresh session status");
|
|
800
805
|
writeLine(" /logs Show the latest Dev Session logs");
|
|
801
806
|
writeLine(" /open Open a fresh one-use Dev Session URL");
|
|
802
|
-
writeLine(" /finish
|
|
807
|
+
writeLine(" /finish Save the task branch and stop");
|
|
803
808
|
writeLine(" /stop Stop the Dev Session without finishing");
|
|
804
809
|
writeLine(" /detach Leave it running and exit this CLI");
|
|
805
810
|
writeLine(" /help Show these commands");
|
|
@@ -807,7 +812,7 @@ function commandHelp(writeLine) {
|
|
|
807
812
|
|
|
808
813
|
async function confirmAction({ interactive, ask, action }) {
|
|
809
814
|
if (!interactive) throw new Error(`/${action} requires an interactive confirmation.`);
|
|
810
|
-
const answer = (await ask(`${action === "finish" ? "
|
|
815
|
+
const answer = (await ask(`${action === "finish" ? "Save the task branch and finish this Dev Session" : "Stop this Dev Session"}? [y/N]: `)).toLowerCase();
|
|
811
816
|
return answer === "y" || answer === "yes";
|
|
812
817
|
}
|
|
813
818
|
|
|
@@ -991,7 +996,7 @@ export async function runDevSession(options) {
|
|
|
991
996
|
sleep,
|
|
992
997
|
signal: detachController.signal,
|
|
993
998
|
});
|
|
994
|
-
sessionSummary(task, session, writeLine);
|
|
999
|
+
sessionSummary(task, session, base, writeLine);
|
|
995
1000
|
|
|
996
1001
|
const nativeTerminal = options.nativeTerminal
|
|
997
1002
|
?? (input === process.stdin && output === process.stdout);
|
|
@@ -1058,7 +1063,7 @@ export async function runDevSession(options) {
|
|
|
1058
1063
|
const result = await api.request(`${sessionPath}/`, { signal: detachController.signal });
|
|
1059
1064
|
if (!result?.session) throw new Error("No active Dev Session remains for this task.");
|
|
1060
1065
|
session = result.session;
|
|
1061
|
-
sessionSummary(task, session, writeLine);
|
|
1066
|
+
sessionSummary(task, session, base, writeLine);
|
|
1062
1067
|
continue;
|
|
1063
1068
|
}
|
|
1064
1069
|
if (prompt === "/logs") {
|
|
@@ -1077,7 +1082,7 @@ export async function runDevSession(options) {
|
|
|
1077
1082
|
continue;
|
|
1078
1083
|
}
|
|
1079
1084
|
await api.request(`${sessionPath}/stop`, { method: "POST", body: {}, signal: detachController.signal });
|
|
1080
|
-
writeLine("Dev Session stopped.
|
|
1085
|
+
writeLine("Dev Session stopped. The pushed task branch is preserved for a safe resume.");
|
|
1081
1086
|
detached = true;
|
|
1082
1087
|
break;
|
|
1083
1088
|
}
|
|
@@ -1105,7 +1110,7 @@ export async function runDevSession(options) {
|
|
|
1105
1110
|
if (completed.status !== "succeeded") {
|
|
1106
1111
|
throw new Error(completed.errorMessage || `Finish ${completed.status}.`);
|
|
1107
1112
|
}
|
|
1108
|
-
writeLine("Finished: the
|
|
1113
|
+
writeLine("Finished: the task branch was saved and the workspace was stopped.");
|
|
1109
1114
|
detached = true;
|
|
1110
1115
|
break;
|
|
1111
1116
|
}
|
package/package.json
CHANGED