@staff0rd/assist 0.270.0 → 0.272.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.270.0",
9
+ version: "0.272.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -3758,12 +3758,8 @@ function buildPhasePrompt(item, phaseNumber, phase) {
3758
3758
  }
3759
3759
 
3760
3760
  // src/commands/backlog/buildResumePrompt.ts
3761
- function buildResumePrompt(phaseNumber, totalPhases) {
3762
- return [
3763
- `This conversation was interrupted partway through phase ${phaseNumber}/${totalPhases} by a restart.`,
3764
- "Review what you already did earlier in this conversation and continue from where you left off to finish the phase. Do not start the phase over.",
3765
- "When the phase is complete, run /verify and then the `assist backlog phase-done` command exactly as instructed earlier in this conversation."
3766
- ].join("\n");
3761
+ function buildResumePrompt() {
3762
+ return "A restart interrupted this conversation. Continue from where you left off.";
3767
3763
  }
3768
3764
 
3769
3765
  // src/commands/backlog/resolvePhaseResult.ts
@@ -3888,7 +3884,7 @@ async function executePhase(item, phaseIndex, phases, spawnOptions, totalPhases
3888
3884
  claudeSessionId
3889
3885
  });
3890
3886
  const { child, done: done2 } = spawnClaude(
3891
- resumeSessionId ? buildResumePrompt(phaseNumber, totalPhases) : buildPhasePrompt(item, phaseNumber, phase),
3887
+ resumeSessionId ? buildResumePrompt() : buildPhasePrompt(item, phaseNumber, phase),
3892
3888
  resumeSessionId ? spawnOptions : { ...spawnOptions, sessionId: claudeSessionId }
3893
3889
  );
3894
3890
  watchForMarker(child);
@@ -5913,7 +5909,12 @@ function buildSlashCommand(slashCommand, description) {
5913
5909
  async function launchMode(slashCommand, options2) {
5914
5910
  pullIfConfigured();
5915
5911
  process.env.ASSIST_SESSION_ID ??= String(process.pid);
5916
- emitActivity({ kind: "command", name: slashCommand });
5912
+ emitActivity({
5913
+ kind: "command",
5914
+ name: slashCommand,
5915
+ itemId: options2?.itemId,
5916
+ itemName: options2?.itemName
5917
+ });
5917
5918
  const { child, done: done2 } = spawnClaude(
5918
5919
  buildSlashCommand(slashCommand, options2?.description),
5919
5920
  { allowEdits: true }
@@ -5965,7 +5966,13 @@ async function pickItemForRefine() {
5965
5966
  async function refine(id, options2) {
5966
5967
  const itemId = id ?? await pickItemForRefine();
5967
5968
  if (!itemId) return;
5968
- await launchMode(`refine ${itemId}`, options2);
5969
+ const numericId = Number.parseInt(itemId, 10);
5970
+ const item = Number.isNaN(numericId) ? void 0 : await loadItem((await getReady()).orm, numericId);
5971
+ await launchMode(`refine ${itemId}`, {
5972
+ ...options2,
5973
+ itemId: item ? numericId : void 0,
5974
+ itemName: item?.name
5975
+ });
5969
5976
  }
5970
5977
 
5971
5978
  // src/commands/backlog/registerRefineCommand.ts
@@ -17837,17 +17844,20 @@ function shouldAutoRun(session, exitCode) {
17837
17844
  }
17838
17845
 
17839
17846
  // src/commands/sessions/daemon/applyStatusChange.ts
17840
- function applyStatusChange(session, status2, exitCode, dismiss, notify2, spawnRun2) {
17847
+ function applyStatusChange(session, status2, exitCode, dismiss, notify2, reuseForRun) {
17841
17848
  session.status = status2;
17842
- if (shouldAutoRun(session, exitCode) && session.activity?.itemId != null)
17843
- spawnRun2(session.activity.itemId, session.cwd);
17849
+ if (shouldAutoRun(session, exitCode) && session.activity?.itemId != null) {
17850
+ reuseForRun(session, session.activity.itemId);
17851
+ notify2();
17852
+ return;
17853
+ }
17844
17854
  if (shouldAutoDismiss(session, exitCode)) dismiss(session.id);
17845
17855
  else notify2();
17846
17856
  }
17847
17857
 
17848
17858
  // src/commands/sessions/daemon/makeStatusChangeHandler.ts
17849
- function makeStatusChangeHandler(dismiss, notify2, spawnRun2) {
17850
- return (s, status2, exitCode) => applyStatusChange(s, status2, exitCode, dismiss, notify2, spawnRun2);
17859
+ function makeStatusChangeHandler(dismiss, notify2, reuseForRun) {
17860
+ return (s, status2, exitCode) => applyStatusChange(s, status2, exitCode, dismiss, notify2, reuseForRun);
17851
17861
  }
17852
17862
 
17853
17863
  // src/commands/sessions/daemon/backlogRunArgs.ts
@@ -18031,6 +18041,21 @@ function respawnThunk(session) {
18031
18041
  return null;
18032
18042
  }
18033
18043
 
18044
+ // src/commands/sessions/daemon/reuseSessionForRun.ts
18045
+ function reuseSessionForRun(session, itemId, clients, onStatusChange) {
18046
+ const assistArgs = ["backlog", "run", String(itemId)];
18047
+ if (session.status !== "done") session.pty?.kill();
18048
+ clearIdle(session);
18049
+ session.assistArgs = assistArgs;
18050
+ session.name = `assist ${assistArgs.join(" ")}`;
18051
+ session.commandType = "assist";
18052
+ session.status = "running";
18053
+ session.startedAt = Date.now();
18054
+ session.restored = void 0;
18055
+ session.pty = spawnPty(["assist", ...assistArgs], session.cwd, session.id);
18056
+ wirePtyEvents(session, clients, onStatusChange);
18057
+ }
18058
+
18034
18059
  // src/commands/sessions/daemon/shutdownSessions.ts
18035
18060
  function shutdownSessions(sessions) {
18036
18061
  for (const session of sessions.values()) {
@@ -18190,7 +18215,7 @@ var SessionManager = class {
18190
18215
  onStatusChange = makeStatusChangeHandler(
18191
18216
  (id) => this.dismissSession(id),
18192
18217
  () => this.notify(),
18193
- (itemId, cwd) => this.spawnAssist(["backlog", "run", String(itemId)], cwd)
18218
+ (session, itemId) => reuseSessionForRun(session, itemId, this.clients, this.onStatusChange)
18194
18219
  );
18195
18220
  wire(session) {
18196
18221
  this.sessions.set(session.id, session);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.270.0",
3
+ "version": "0.272.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {