@staff0rd/assist 0.1137.0 → 0.1138.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.1137.0",
9
+ version: "0.1138.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -60640,12 +60640,12 @@ function conversationResumeOutcome(session) {
60640
60640
  }
60641
60641
 
60642
60642
  // src/commands/sessions/daemon/interactiveRespawnPlan.ts
60643
- function interactiveRespawnPlan(session) {
60643
+ function interactiveRespawnPlan(session, fresh = false) {
60644
60644
  const adapter = harnessAdapter(session.harness);
60645
60645
  if (!resolveCapability(adapter.capabilities, "conversation.resume").supported)
60646
60646
  return null;
60647
60647
  const { cwd, initialPrompt } = session;
60648
- const resumeId = adapter.conversation.findResumable(session);
60648
+ const resumeId = fresh ? void 0 : adapter.conversation.findResumable(session);
60649
60649
  if (resumeId)
60650
60650
  return {
60651
60651
  spawn: () => adapter.interactive({
@@ -60656,7 +60656,7 @@ function interactiveRespawnPlan(session) {
60656
60656
  }),
60657
60657
  status: "waiting"
60658
60658
  };
60659
- if (!initialPrompt && !cwd) return null;
60659
+ if (!fresh && !initialPrompt && !cwd) return null;
60660
60660
  return freshPlan(session, adapter, initialPrompt);
60661
60661
  }
60662
60662
  function freshPlan(session, adapter, prompt) {
@@ -60680,17 +60680,21 @@ function freshPlan(session, adapter, prompt) {
60680
60680
  }
60681
60681
 
60682
60682
  // src/commands/sessions/daemon/respawnPlan.ts
60683
- function respawnPlan(session) {
60683
+ function respawnPlan(session, fresh = false) {
60684
60684
  const { commandType, cwd, assistArgs } = session;
60685
- if (commandType === "claude") return interactiveRespawnPlan(session);
60685
+ if (commandType === "claude") return interactiveRespawnPlan(session, fresh);
60686
60686
  if (commandType === "assist" && assistArgs) {
60687
- const idle = session.status === "waiting";
60687
+ const idle = !fresh && session.status === "waiting";
60688
60688
  let resume;
60689
60689
  return {
60690
60690
  spawn: () => {
60691
- resume = conversationResumeOutcome(session);
60691
+ if (fresh) {
60692
+ session.claudeSessionId = void 0;
60693
+ session.harnessSessionId = void 0;
60694
+ }
60695
+ resume = fresh ? void 0 : conversationResumeOutcome(session);
60692
60696
  return spawnPty(
60693
- assistResumeArgs({ assistArgs, resumeSessionId: resume.id }),
60697
+ assistResumeArgs({ assistArgs, resumeSessionId: resume?.id }),
60694
60698
  cwd,
60695
60699
  session.id,
60696
60700
  idle ? { ASSIST_RESUME_IDLE: "1" } : void 0
@@ -60704,8 +60708,10 @@ function respawnPlan(session) {
60704
60708
  }
60705
60709
 
60706
60710
  // src/commands/sessions/daemon/restartSession.ts
60707
- function restartSession(session, clients, onStatusChange) {
60708
- const plan2 = respawnPlan(session);
60711
+ function restartSession(session, clients, onStatusChange, fresh = false) {
60712
+ if (fresh)
60713
+ daemonLog(`session ${session.id} start-over requested: ${session.name}`);
60714
+ const plan2 = respawnPlan(session, fresh);
60709
60715
  if (!plan2) return false;
60710
60716
  const respawn = () => {
60711
60717
  respawnSession(session, plan2.spawn, plan2.status, clients, onStatusChange);
@@ -60733,7 +60739,7 @@ function restartSession(session, clients, onStatusChange) {
60733
60739
  }
60734
60740
 
60735
60741
  // src/commands/sessions/daemon/restartManagedSession.ts
60736
- function restartManagedSession(sessions, id, clients, onStatusChange) {
60742
+ function restartManagedSession(sessions, id, clients, onStatusChange, fresh = false) {
60737
60743
  const s = sessions.get(id);
60738
60744
  if (!s) {
60739
60745
  daemonLog(
@@ -60745,7 +60751,7 @@ function restartManagedSession(sessions, id, clients, onStatusChange) {
60745
60751
  };
60746
60752
  }
60747
60753
  daemonLog(`restart requested: id=${id} status=${s.status} (${s.name})`);
60748
- if (!restartSession(s, clients, onStatusChange)) {
60754
+ if (!restartSession(s, clients, onStatusChange, fresh)) {
60749
60755
  daemonLog(`restart for session ${id} did nothing: no respawn plan`);
60750
60756
  return {
60751
60757
  ok: false,
@@ -60756,8 +60762,14 @@ function restartManagedSession(sessions, id, clients, onStatusChange) {
60756
60762
  }
60757
60763
 
60758
60764
  // src/commands/sessions/daemon/restartAndNotify.ts
60759
- function restartAndNotify(sessions, id, clients, onStatusChange, notify2) {
60760
- const result = restartManagedSession(sessions, id, clients, onStatusChange);
60765
+ function restartAndNotify(sessions, id, clients, onStatusChange, notify2, fresh = false) {
60766
+ const result = restartManagedSession(
60767
+ sessions,
60768
+ id,
60769
+ clients,
60770
+ onStatusChange,
60771
+ fresh
60772
+ );
60761
60773
  if (result.ok) notify2();
60762
60774
  return result;
60763
60775
  }
@@ -63361,13 +63373,14 @@ var SessionManager = class {
63361
63373
  notify: this.notify
63362
63374
  });
63363
63375
  }
63364
- restart(id) {
63376
+ restart(id, fresh = false) {
63365
63377
  return restartAndNotify(
63366
63378
  this.sessions,
63367
63379
  id,
63368
63380
  this.clients,
63369
63381
  this.onStatusChange,
63370
- this.notify
63382
+ this.notify,
63383
+ fresh
63371
63384
  );
63372
63385
  }
63373
63386
  dismissSession = (id, closeServerRuns = false) => {
@@ -64310,6 +64323,11 @@ var retryHandlers = {
64310
64323
  existing: conflict
64311
64324
  });
64312
64325
  }),
64326
+ "start-over": routed((client, m, d) => {
64327
+ const result = m.restart(d.sessionId, true);
64328
+ if (!result.ok && result.reason)
64329
+ sendTo(client, { type: "error", message: result.reason });
64330
+ }),
64313
64331
  restart: routed((client, m, d) => {
64314
64332
  const result = m.restart(d.sessionId);
64315
64333
  if (!result.ok && result.reason)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.1137.0",
3
+ "version": "0.1138.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {