@staff0rd/assist 0.322.1 → 0.322.2

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.
Files changed (2) hide show
  1. package/dist/index.js +30 -22
  2. package/package.json +1 -1
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.322.1",
9
+ version: "0.322.2",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -21162,6 +21162,18 @@ function nsId(msg) {
21162
21162
  return toWindowsSessionId(msg.sessionId);
21163
21163
  }
21164
21164
 
21165
+ // src/commands/sessions/daemon/handleWindowsClose.ts
21166
+ function handleWindowsClose(state) {
21167
+ daemonLog("windows proxy: connection to windows daemon closed");
21168
+ for (const client of state.pendingCreators)
21169
+ sendTo(client, {
21170
+ type: "error",
21171
+ message: "Windows daemon connection closed"
21172
+ });
21173
+ resetState(state);
21174
+ state.onSessionsChanged();
21175
+ }
21176
+
21165
21177
  // src/commands/sessions/daemon/healWindowsDaemon.ts
21166
21178
  import { spawn as spawn11 } from "child_process";
21167
21179
  var UPDATE_TIMEOUT_MS = 5 * 6e4;
@@ -21409,7 +21421,7 @@ var WindowsProxy = class {
21409
21421
  this.conn = new WindowsConnection({
21410
21422
  connect: connect4,
21411
21423
  onLine: (line) => handleInbound(this.state, line),
21412
- onClose: () => this.handleClose()
21424
+ onClose: () => handleWindowsClose(this.state)
21413
21425
  });
21414
21426
  this.healer = new WindowsVersionHealer(this.conn, this.state, heal);
21415
21427
  }
@@ -21427,31 +21439,27 @@ var WindowsProxy = class {
21427
21439
  // windows-origin cwd is forwarded, as is I/O for a namespaced session id.
21428
21440
  route(client, data) {
21429
21441
  if (!this.enabled) return false;
21430
- if (isWindowsCreate(data)) {
21431
- if (this.healer.blocked) sendTo(client, this.healer.refusal());
21432
- else void forwardWindowsCreate(this.conn, this.state, client, data);
21433
- return true;
21434
- }
21435
- if (isWindowsIo(data)) {
21436
- const sessionId = stripWindowsSessionId(data.sessionId);
21437
- this.conn.trySend({ ...data, sessionId });
21438
- return true;
21439
- }
21442
+ if (isWindowsCreate(data)) return this.routeCreate(client, data);
21443
+ if (isWindowsIo(data)) return this.routeIo(data);
21440
21444
  return false;
21441
21445
  }
21446
+ routeCreate(client, data) {
21447
+ if (this.healer.blocked) {
21448
+ daemonLog(
21449
+ `windows proxy: refusing ${data.type} (cwd=${data.cwd}); windows host version incompatible`
21450
+ );
21451
+ sendTo(client, this.healer.refusal());
21452
+ } else void forwardWindowsCreate(this.conn, this.state, client, data);
21453
+ return true;
21454
+ }
21455
+ routeIo(data) {
21456
+ const sessionId = stripWindowsSessionId(data.sessionId);
21457
+ this.conn.trySend({ ...data, sessionId });
21458
+ return true;
21459
+ }
21442
21460
  dispose() {
21443
21461
  this.conn.dispose();
21444
21462
  }
21445
- handleClose() {
21446
- daemonLog("windows proxy: connection to windows daemon closed");
21447
- for (const client of this.state.pendingCreators)
21448
- sendTo(client, {
21449
- type: "error",
21450
- message: "Windows daemon connection closed"
21451
- });
21452
- resetState(this.state);
21453
- this.state.onSessionsChanged();
21454
- }
21455
21463
  };
21456
21464
 
21457
21465
  // src/commands/sessions/daemon/writeToSession.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.322.1",
3
+ "version": "0.322.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {