@staff0rd/assist 0.304.0 → 0.305.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 +56 -5
  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.304.0",
9
+ version: "0.305.2",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -5703,7 +5703,7 @@ function isDone(session) {
5703
5703
  return session.status === "done";
5704
5704
  }
5705
5705
  function logEvent(event, session) {
5706
- const origin = isWindowsSessionId(session.id) ? "windows" : "wsl";
5706
+ const origin = isWindowsSessionId(session.id) ? "windows" : detectPlatform();
5707
5707
  console.log(
5708
5708
  `${(/* @__PURE__ */ new Date()).toISOString()} session ${event}: ${session.id}${describe(session)} [${origin} daemon]`
5709
5709
  );
@@ -18902,6 +18902,36 @@ function greetClient(client, sessions, windowsProxy) {
18902
18902
  void windowsProxy.discover();
18903
18903
  }
18904
18904
 
18905
+ // src/commands/sessions/daemon/watchEscInterrupt.ts
18906
+ var ESC2 = "\x1B";
18907
+ var SETTLE_MS = 1e3;
18908
+ function isInterruptKey(data) {
18909
+ return data === ESC2;
18910
+ }
18911
+ function scheduleSettle(session, onStatusChange) {
18912
+ if (session.escInterruptTimer) clearTimeout(session.escInterruptTimer);
18913
+ session.escInterruptTimer = setTimeout(() => {
18914
+ session.escInterruptTimer = void 0;
18915
+ if (session.status !== "running") return;
18916
+ daemonLog(`session ${session.id} esc-interrupt settled -> waiting`);
18917
+ onStatusChange(session, "waiting");
18918
+ }, SETTLE_MS);
18919
+ }
18920
+ function watchEscInterrupt(session, data, onStatusChange) {
18921
+ if (session.status !== "running") return;
18922
+ if (!isInterruptKey(data)) return;
18923
+ scheduleSettle(session, onStatusChange);
18924
+ }
18925
+ function noteOutputForEscInterrupt(session, onStatusChange) {
18926
+ if (!session.escInterruptTimer) return;
18927
+ scheduleSettle(session, onStatusChange);
18928
+ }
18929
+ function disarmEscInterrupt(session) {
18930
+ if (!session.escInterruptTimer) return;
18931
+ clearTimeout(session.escInterruptTimer);
18932
+ session.escInterruptTimer = void 0;
18933
+ }
18934
+
18905
18935
  // src/commands/sessions/daemon/shouldAutoDismiss.ts
18906
18936
  function shouldAutoDismiss(session, exitCode) {
18907
18937
  const args = session.assistArgs;
@@ -18924,6 +18954,7 @@ function shouldAutoRun(session, exitCode) {
18924
18954
 
18925
18955
  // src/commands/sessions/daemon/applyStatusChange.ts
18926
18956
  function applyStatusChange(session, status2, exitCode, dismiss, notify2, reuseForRun) {
18957
+ disarmEscInterrupt(session);
18927
18958
  if (session.status === status2) return;
18928
18959
  daemonLog(`session ${session.id} status: ${session.status} -> ${status2}`);
18929
18960
  session.status = status2;
@@ -19119,6 +19150,7 @@ function wirePtyEvents(session, clients, onStatusChange) {
19119
19150
  if (!session.pty) return;
19120
19151
  session.pty.onData((data) => {
19121
19152
  appendScrollback(session, data);
19153
+ noteOutputForEscInterrupt(session, onStatusChange);
19122
19154
  broadcast(clients, { type: "output", sessionId: session.id, data });
19123
19155
  });
19124
19156
  session.pty.onExit(({ exitCode }) => {
@@ -19961,9 +19993,11 @@ function isBacklogRun2(session) {
19961
19993
  }
19962
19994
 
19963
19995
  // src/commands/sessions/daemon/writeToSession.ts
19964
- function writeToSession(sessions, id2, data) {
19996
+ function writeToSession(sessions, id2, data, onStatusChange) {
19965
19997
  const s = sessions.get(id2);
19966
- if (s && s.status !== "done") s.pty?.write(data);
19998
+ if (!s || s.status === "done") return;
19999
+ s.pty?.write(data);
20000
+ watchEscInterrupt(s, data, onStatusChange);
19967
20001
  }
19968
20002
  function resizeSession(sessions, id2, cols, rows) {
19969
20003
  const s = sessions.get(id2);
@@ -20057,7 +20091,7 @@ var SessionManager = class {
20057
20091
  this.notify();
20058
20092
  }
20059
20093
  writeToSession(id2, data) {
20060
- writeToSession(this.sessions, id2, data);
20094
+ writeToSession(this.sessions, id2, data, this.onStatusChange);
20061
20095
  }
20062
20096
  resizeSession(id2, cols, rows) {
20063
20097
  resizeSession(this.sessions, id2, cols, rows);
@@ -20883,6 +20917,22 @@ function syncCommands(claudeDir, targetBase) {
20883
20917
  // src/commands/update.ts
20884
20918
  import { execSync as execSync49 } from "child_process";
20885
20919
  import * as path57 from "path";
20920
+
20921
+ // src/commands/restartDaemonAfterUpdate.ts
20922
+ async function restartDaemonAfterUpdate() {
20923
+ if (!await isDaemonRunning()) return;
20924
+ console.log("Restarting sessions daemon to load the new build...");
20925
+ try {
20926
+ await restartDaemon();
20927
+ } catch (error) {
20928
+ console.error(
20929
+ `Failed to restart sessions daemon: ${error instanceof Error ? error.message : String(error)}`
20930
+ );
20931
+ process.exit(1);
20932
+ }
20933
+ }
20934
+
20935
+ // src/commands/update.ts
20886
20936
  function isGlobalNpmInstall(dir) {
20887
20937
  try {
20888
20938
  const resolved = path57.resolve(dir);
@@ -20918,6 +20968,7 @@ async function update2() {
20918
20968
  );
20919
20969
  process.exit(1);
20920
20970
  }
20971
+ await restartDaemonAfterUpdate();
20921
20972
  }
20922
20973
 
20923
20974
  // src/index.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.304.0",
3
+ "version": "0.305.2",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {