pi-better-server 0.2.0 → 0.2.1
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/package.json
CHANGED
package/src/handshake.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { ServerBuild } from "./startup/managed-types.ts";
|
|
|
4
4
|
import { PROTOCOL_VERSION, type HelloCommand, type HelloData } from "./protocol.ts";
|
|
5
5
|
|
|
6
6
|
/** Kept equal to package.json `version`; a test pins that. */
|
|
7
|
-
export const SERVER_VERSION = "0.2.
|
|
7
|
+
export const SERVER_VERSION = "0.2.1";
|
|
8
8
|
|
|
9
9
|
export const SERVER_EXTENSION_VERSIONS: Readonly<Record<string, string>> = { "pi-better-server": SERVER_VERSION };
|
|
10
10
|
|
|
@@ -241,8 +241,6 @@ export async function connectHost(options: RemoteOptions, local: LocalFrontend):
|
|
|
241
241
|
: `Server update staged. The current daemon cannot perform a verified automatic handoff and was left running. ${deferredUpgrade}`, safe ? "info" : "warning");
|
|
242
242
|
}
|
|
243
243
|
let connection = client;
|
|
244
|
-
const targetLabel = isLocalHost(options.host) ? "local daemon" : `SSH: ${options.host}`;
|
|
245
|
-
ui.setStatus("pi-remote", `${targetLabel} (sessions)`);
|
|
246
244
|
if (!await syncPackages(connection, local, undefined, { scope: "global", host: options.host, onNotice: message => notices.push(message) })) return;
|
|
247
245
|
let choice: Exclude<RemoteSessionChoice, { action: "transfer" }> | undefined;
|
|
248
246
|
for (;;) {
|
|
@@ -274,10 +272,7 @@ export async function connectHost(options: RemoteOptions, local: LocalFrontend):
|
|
|
274
272
|
connection = replacement;
|
|
275
273
|
void closeInitialTransport().catch(error => ui.notify(`Remote tunnel cleanup: ${String(error)}`, "warning"));
|
|
276
274
|
},
|
|
277
|
-
onUpgradeStatus: phase => ui.setStatus("pi-remote", phase === "ready"
|
|
278
|
-
? targetLabel : `${targetLabel} (${phase === "restarting" ? "server restarting" : "reconnecting"})`),
|
|
279
275
|
onDisconnect: () => {
|
|
280
|
-
ui.setStatus("pi-remote", `${targetLabel} (disconnected)`);
|
|
281
276
|
ui.notify(`Disconnected from ${options.host}. Remote work has not been aborted. Use /remote disconnect to return locally, then reconnect.`, "warning");
|
|
282
277
|
},
|
|
283
278
|
localCommandCompletions: (prefix) => argumentCompletions(prefix, true),
|
|
@@ -312,11 +307,10 @@ export async function connectHost(options: RemoteOptions, local: LocalFrontend):
|
|
|
312
307
|
await bridge.attach(remote);
|
|
313
308
|
endBrowse = undefined;
|
|
314
309
|
attached = true;
|
|
315
|
-
ui.setStatus("pi-remote", targetLabel);
|
|
316
310
|
ui.notify(`Attached to ${options.host}:${cwd}. /remote opens the server's sessions; /remote disconnect returns locally.`, "info");
|
|
317
311
|
} finally {
|
|
318
312
|
try { endBrowse?.(); }
|
|
319
|
-
finally { if (!attached)
|
|
313
|
+
finally { if (!attached) await closeInitialTransport(); }
|
|
320
314
|
}
|
|
321
315
|
}
|
|
322
316
|
|
|
@@ -1156,6 +1156,8 @@ export class RemoteClientSession {
|
|
|
1156
1156
|
}
|
|
1157
1157
|
}
|
|
1158
1158
|
private present(request: SessionEvent): void {
|
|
1159
|
+
// Preserve status events on the wire, but never write them to the local footer.
|
|
1160
|
+
if (request.method === "setStatus") return;
|
|
1159
1161
|
if (["select", "confirm", "input", "editor"].includes(request.method)) {
|
|
1160
1162
|
this.dialogs.set(request.id, request);
|
|
1161
1163
|
this.presentDialogs();
|
|
@@ -1165,7 +1167,6 @@ export class RemoteClientSession {
|
|
|
1165
1167
|
const ui = this.uiContext;
|
|
1166
1168
|
switch (request.method) {
|
|
1167
1169
|
case "notify": ui.notify(request.message, request.notifyType); break;
|
|
1168
|
-
case "setStatus": ui.setStatus(request.statusKey, request.statusText); break;
|
|
1169
1170
|
case "setWidget":
|
|
1170
1171
|
if (request.widgetLines !== undefined && (!Array.isArray(request.widgetLines) || !request.widgetLines.every((line: unknown) => typeof line === "string"))) {
|
|
1171
1172
|
throw new Error("Remote custom widget components are not supported; only text lines are supported");
|