@staff0rd/assist 0.269.1 → 0.271.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.269.1",
9
+ version: "0.271.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -17837,17 +17837,20 @@ function shouldAutoRun(session, exitCode) {
17837
17837
  }
17838
17838
 
17839
17839
  // src/commands/sessions/daemon/applyStatusChange.ts
17840
- function applyStatusChange(session, status2, exitCode, dismiss, notify2, spawnRun2) {
17840
+ function applyStatusChange(session, status2, exitCode, dismiss, notify2, reuseForRun) {
17841
17841
  session.status = status2;
17842
- if (shouldAutoRun(session, exitCode) && session.activity?.itemId != null)
17843
- spawnRun2(session.activity.itemId, session.cwd);
17842
+ if (shouldAutoRun(session, exitCode) && session.activity?.itemId != null) {
17843
+ reuseForRun(session, session.activity.itemId);
17844
+ notify2();
17845
+ return;
17846
+ }
17844
17847
  if (shouldAutoDismiss(session, exitCode)) dismiss(session.id);
17845
17848
  else notify2();
17846
17849
  }
17847
17850
 
17848
17851
  // src/commands/sessions/daemon/makeStatusChangeHandler.ts
17849
- function makeStatusChangeHandler(dismiss, notify2, spawnRun2) {
17850
- return (s, status2, exitCode) => applyStatusChange(s, status2, exitCode, dismiss, notify2, spawnRun2);
17852
+ function makeStatusChangeHandler(dismiss, notify2, reuseForRun) {
17853
+ return (s, status2, exitCode) => applyStatusChange(s, status2, exitCode, dismiss, notify2, reuseForRun);
17851
17854
  }
17852
17855
 
17853
17856
  // src/commands/sessions/daemon/backlogRunArgs.ts
@@ -18031,6 +18034,21 @@ function respawnThunk(session) {
18031
18034
  return null;
18032
18035
  }
18033
18036
 
18037
+ // src/commands/sessions/daemon/reuseSessionForRun.ts
18038
+ function reuseSessionForRun(session, itemId, clients, onStatusChange) {
18039
+ const assistArgs = ["backlog", "run", String(itemId)];
18040
+ if (session.status !== "done") session.pty?.kill();
18041
+ clearIdle(session);
18042
+ session.assistArgs = assistArgs;
18043
+ session.name = `assist ${assistArgs.join(" ")}`;
18044
+ session.commandType = "assist";
18045
+ session.status = "running";
18046
+ session.startedAt = Date.now();
18047
+ session.restored = void 0;
18048
+ session.pty = spawnPty(["assist", ...assistArgs], session.cwd, session.id);
18049
+ wirePtyEvents(session, clients, onStatusChange);
18050
+ }
18051
+
18034
18052
  // src/commands/sessions/daemon/shutdownSessions.ts
18035
18053
  function shutdownSessions(sessions) {
18036
18054
  for (const session of sessions.values()) {
@@ -18190,7 +18208,7 @@ var SessionManager = class {
18190
18208
  onStatusChange = makeStatusChangeHandler(
18191
18209
  (id) => this.dismissSession(id),
18192
18210
  () => this.notify(),
18193
- (itemId, cwd) => this.spawnAssist(["backlog", "run", String(itemId)], cwd)
18211
+ (session, itemId) => reuseSessionForRun(session, itemId, this.clients, this.onStatusChange)
18194
18212
  );
18195
18213
  wire(session) {
18196
18214
  this.sessions.set(session.id, session);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.269.1",
3
+ "version": "0.271.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {