@staff0rd/assist 0.562.1 → 0.563.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.
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.562.1",
9
+ version: "0.563.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -35248,10 +35248,28 @@ function stripOutboundSessionId(data) {
35248
35248
  return stripped;
35249
35249
  }
35250
35250
 
35251
+ // src/commands/sessions/daemon/logWindowsForward.ts
35252
+ function logWindowsForward(delivered, type, sessionId) {
35253
+ if (!delivered)
35254
+ daemonLog(
35255
+ `windows proxy: DROPPED ${type} for ${sessionId} (windows connection not writable)`
35256
+ );
35257
+ else if (type !== "input")
35258
+ daemonLog(`windows proxy: forwarded ${type} for ${sessionId}`);
35259
+ }
35260
+
35261
+ // src/commands/sessions/daemon/forwardWindowsIo.ts
35262
+ function forwardWindowsIo(conn, data) {
35263
+ const sessionId = stripWindowsSessionId(data.sessionId);
35264
+ const delivered = conn.trySend({ ...data, sessionId });
35265
+ logWindowsForward(delivered, data.type, data.sessionId);
35266
+ }
35267
+
35251
35268
  // src/commands/sessions/daemon/WindowsProxyState.ts
35252
35269
  var MAX_SCROLLBACK2 = 256 * 1024;
35253
35270
  var DEFAULT_CREATE_TIMEOUT_MS = 5e3;
35254
- function createState(broadcast2, onSessionsChanged, onVersionMismatch, createTimeoutMs = DEFAULT_CREATE_TIMEOUT_MS) {
35271
+ function createState(broadcast2, onSessionsChanged, onVersionMismatch, onVersionOk = () => {
35272
+ }, createTimeoutMs = DEFAULT_CREATE_TIMEOUT_MS) {
35255
35273
  return {
35256
35274
  windowsSessions: [],
35257
35275
  scrollback: /* @__PURE__ */ new Map(),
@@ -35259,7 +35277,8 @@ function createState(broadcast2, onSessionsChanged, onVersionMismatch, createTim
35259
35277
  createTimeoutMs,
35260
35278
  broadcast: broadcast2,
35261
35279
  onSessionsChanged,
35262
- onVersionMismatch
35280
+ onVersionMismatch,
35281
+ onVersionOk
35263
35282
  };
35264
35283
  }
35265
35284
  function resetState(state) {
@@ -35337,7 +35356,11 @@ function windowsVersionCheck() {
35337
35356
 
35338
35357
  // src/commands/sessions/daemon/handleHello.ts
35339
35358
  function handleHello(state, msg) {
35340
- if (!isHello(msg) || helloCompatible(msg)) return;
35359
+ if (!isHello(msg)) return;
35360
+ if (helloCompatible(msg)) {
35361
+ state.onVersionOk();
35362
+ return;
35363
+ }
35341
35364
  const mode = windowsVersionCheck();
35342
35365
  const mismatch = `windows daemon ${helloMismatchKind(msg)} mismatch`;
35343
35366
  const detail = `protocol ${msg.protocol ?? "legacy"} version ${msg.version} (wsl protocol ${PROTOCOL_VERSION} version ${ASSIST_VERSION})`;
@@ -35473,16 +35496,6 @@ function isWindowsIo(data) {
35473
35496
  return typeof data.sessionId === "string" && isWindowsSessionId(data.sessionId);
35474
35497
  }
35475
35498
 
35476
- // src/commands/sessions/daemon/logWindowsForward.ts
35477
- function logWindowsForward(delivered, type, sessionId) {
35478
- if (!delivered)
35479
- daemonLog(
35480
- `windows proxy: DROPPED ${type} for ${sessionId} (windows connection not writable)`
35481
- );
35482
- else if (type !== "input")
35483
- daemonLog(`windows proxy: forwarded ${type} for ${sessionId}`);
35484
- }
35485
-
35486
35499
  // src/commands/sessions/daemon/WindowsConnection.ts
35487
35500
  import { createInterface as createInterface9 } from "readline";
35488
35501
 
@@ -35609,6 +35622,7 @@ function notifyHealing(state) {
35609
35622
 
35610
35623
  // src/commands/sessions/daemon/WindowsVersionHealer.ts
35611
35624
  var UNRECOVERABLE_MESSAGE = "Windows host is on an incompatible version that auto-update could not resolve; not reconnecting. Update the Windows host manually, then restart.";
35625
+ var HEALED_MESSAGE = "Windows host is up to date \u2014 you can reselect the repo now.";
35612
35626
  var WindowsVersionHealer = class {
35613
35627
  constructor(conn, state, heal) {
35614
35628
  this.conn = conn;
@@ -35618,6 +35632,7 @@ var WindowsVersionHealer = class {
35618
35632
  healAttempted = false;
35619
35633
  healing = false;
35620
35634
  unrecoverable = false;
35635
+ awaitingConfirmation = false;
35621
35636
  get blocked() {
35622
35637
  return this.unrecoverable;
35623
35638
  }
@@ -35629,14 +35644,24 @@ var WindowsVersionHealer = class {
35629
35644
  if (this.healAttempted) return this.giveUp(version2);
35630
35645
  this.healing = true;
35631
35646
  this.healAttempted = true;
35647
+ this.awaitingConfirmation = true;
35632
35648
  try {
35633
35649
  await autoHealWindowsDaemon(this.conn, this.state, this.heal, version2);
35634
35650
  } finally {
35635
35651
  this.healing = false;
35636
35652
  }
35637
35653
  }
35654
+ onCompatible() {
35655
+ if (!this.awaitingConfirmation) return;
35656
+ this.awaitingConfirmation = false;
35657
+ daemonLog(
35658
+ "windows proxy: post-heal handshake compatible; windows host is in step"
35659
+ );
35660
+ this.state.broadcast({ type: "notice", message: HEALED_MESSAGE });
35661
+ }
35638
35662
  giveUp(version2) {
35639
35663
  this.unrecoverable = true;
35664
+ this.awaitingConfirmation = false;
35640
35665
  daemonLog(
35641
35666
  `windows proxy: version mismatch ${version2} persists after heal; not reconnecting until the WSL daemon restarts`
35642
35667
  );
@@ -35657,6 +35682,7 @@ var WindowsProxy = class {
35657
35682
  (msg) => broadcast(clients, msg),
35658
35683
  onSessionsChanged,
35659
35684
  (version2) => void this.healer.onMismatch(version2),
35685
+ () => this.healer.onCompatible(),
35660
35686
  createTimeoutMs
35661
35687
  );
35662
35688
  this.conn = new WindowsConnection({
@@ -35681,7 +35707,10 @@ var WindowsProxy = class {
35681
35707
  route(client, data) {
35682
35708
  if (!this.enabled) return false;
35683
35709
  if (isWindowsCreate(data)) return this.routeCreate(client, data);
35684
- if (isWindowsIo(data)) return this.routeIo(data);
35710
+ if (isWindowsIo(data)) {
35711
+ forwardWindowsIo(this.conn, data);
35712
+ return true;
35713
+ }
35685
35714
  return false;
35686
35715
  }
35687
35716
  routeCreate(client, data) {
@@ -35693,12 +35722,6 @@ var WindowsProxy = class {
35693
35722
  } else void forwardWindowsCreate(this.conn, this.state, client, data);
35694
35723
  return true;
35695
35724
  }
35696
- routeIo(data) {
35697
- const sessionId = stripWindowsSessionId(data.sessionId);
35698
- const delivered = this.conn.trySend({ ...data, sessionId });
35699
- logWindowsForward(delivered, data.type, data.sessionId);
35700
- return true;
35701
- }
35702
35725
  dispose() {
35703
35726
  this.conn.dispose();
35704
35727
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.562.1",
3
+ "version": "0.563.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {