@staff0rd/assist 0.1018.0 → 0.1019.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.1018.0",
9
+ version: "0.1019.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -51689,6 +51689,7 @@ function finishStatusChange(session, status2, exitCode, deps2) {
51689
51689
  );
51690
51690
  deps2.dismiss(session.id);
51691
51691
  } else deps2.notify();
51692
+ if (status2 !== "running") deps2.idle?.(session);
51692
51693
  }
51693
51694
 
51694
51695
  // src/commands/sessions/daemon/applyStatusChange.ts
@@ -51721,6 +51722,268 @@ function makeStatusChangeHandler(sessions, deps2) {
51721
51722
  );
51722
51723
  }
51723
51724
 
51725
+ // src/commands/sessions/shared/backlogRunArgs.ts
51726
+ function backlogRunArgs(session) {
51727
+ const args = session.assistArgs;
51728
+ if (session.commandType !== "assist" || !args) return void 0;
51729
+ if (args[0] !== "backlog" || args[1] !== "run" || !args[2]) return void 0;
51730
+ return args;
51731
+ }
51732
+
51733
+ // src/commands/sessions/daemon/transfer/launchOnTarget.ts
51734
+ function launchOnTarget(route, request) {
51735
+ return new Promise((resolve32) => {
51736
+ const capture = {
51737
+ send: (raw) => {
51738
+ const msg = JSON.parse(raw);
51739
+ if (msg.type === "created")
51740
+ resolve32({ ok: true, sessionId: msg.sessionId });
51741
+ else if (msg.type === "error")
51742
+ resolve32({ ok: false, error: String(msg.message) });
51743
+ }
51744
+ };
51745
+ if (!route(capture, request))
51746
+ resolve32({ ok: false, error: `${request.node} is not a linked node` });
51747
+ });
51748
+ }
51749
+
51750
+ // src/commands/sessions/daemon/transfer/settleTransfer.ts
51751
+ function settleTransfer(client, deps2, s, outcome, traceId) {
51752
+ const target = s.transfer?.target ?? "target";
51753
+ if (!outcome.ok) {
51754
+ daemonLog(
51755
+ `session ${s.id} transfer to ${target} failed trace=${traceId}: ${outcome.error}; source kept`
51756
+ );
51757
+ s.transfer = { target, error: outcome.error };
51758
+ deps2.notify();
51759
+ sendTo(client, {
51760
+ type: "error",
51761
+ message: `Transfer to ${target} failed: ${outcome.error}`
51762
+ });
51763
+ return;
51764
+ }
51765
+ daemonLog(
51766
+ `session ${s.id} transferred to ${target} as ${outcome.sessionId} trace=${traceId}; closing source`
51767
+ );
51768
+ s.transfer = void 0;
51769
+ deps2.discard(s.id);
51770
+ sendTo(client, { type: "notice", message: `Transferred to ${target}` });
51771
+ }
51772
+
51773
+ // src/commands/sessions/daemon/transfer/handOffToTarget.ts
51774
+ async function handOffToTarget(client, deps2, s, { args, target, cwd, traceId, snapshot }) {
51775
+ deps2.stop(s.id);
51776
+ deps2.notify();
51777
+ const outcome = await launchOnTarget(deps2.links.route, {
51778
+ type: "create-assist",
51779
+ assistArgs: args,
51780
+ cwd,
51781
+ node: target,
51782
+ title: s.title,
51783
+ subtitle: s.subtitle,
51784
+ traceId,
51785
+ transfer: snapshot
51786
+ });
51787
+ settleTransfer(client, deps2, s, outcome, traceId);
51788
+ }
51789
+
51790
+ // src/commands/sessions/daemon/transfer/queueTransfer.ts
51791
+ function queueTransfer(client, notify2, s, target, cwd) {
51792
+ daemonLog(
51793
+ `session ${s.id} transfer to ${target} queued: agent mid-turn, waiting for idle`
51794
+ );
51795
+ s.transfer = { target, queued: { cwd } };
51796
+ notify2();
51797
+ sendTo(client, {
51798
+ type: "notice",
51799
+ message: `Transfer to ${target} will start once the agent is idle`
51800
+ });
51801
+ }
51802
+
51803
+ // src/commands/sessions/daemon/transfer/transferRefusal.ts
51804
+ function transferRefusal(s, target, links2) {
51805
+ if (!s) return "unknown session";
51806
+ if (!backlogRunArgs(s)) return "only backlog run sessions can be transferred";
51807
+ if (s.transfer?.queued)
51808
+ return `a transfer to ${s.transfer.target} is already pending`;
51809
+ if (s.transfer && !s.transfer.error)
51810
+ return `already transferring to ${s.transfer.target}`;
51811
+ if (!target || target === links2.localNode())
51812
+ return `the session already runs on ${links2.localNode()}`;
51813
+ if (!links2.isConnected(target)) return `${target} is not connected`;
51814
+ return void 0;
51815
+ }
51816
+
51817
+ // src/commands/sessions/daemon/transfer/pushTransferSnapshot.ts
51818
+ import { basename as basename32 } from "path";
51819
+
51820
+ // src/commands/sessions/daemon/transfer/TransferSnapshot.ts
51821
+ function transferRefFor(itemId2) {
51822
+ return `assist/transfer/${itemId2}`;
51823
+ }
51824
+ function parseTransferSnapshot(value) {
51825
+ if (!value || typeof value !== "object") return void 0;
51826
+ const { ref, branch: branch2, upstream } = value;
51827
+ if (typeof ref !== "string" || !ref.startsWith("assist/transfer/"))
51828
+ return void 0;
51829
+ return {
51830
+ ref,
51831
+ branch: typeof branch2 === "string" ? branch2 : void 0,
51832
+ upstream: typeof upstream === "string" ? upstream : void 0
51833
+ };
51834
+ }
51835
+
51836
+ // src/commands/sessions/daemon/transfer/pushTransferSnapshot.ts
51837
+ var PUSH_TIMEOUT_MS = 12e4;
51838
+ var WIP_COMMIT = [
51839
+ "-c",
51840
+ "user.name=assist",
51841
+ "-c",
51842
+ "user.email=assist@localhost",
51843
+ "-c",
51844
+ "commit.gpgsign=false",
51845
+ "commit",
51846
+ "--no-verify",
51847
+ "--allow-empty",
51848
+ "--quiet",
51849
+ "-m",
51850
+ "assist transfer WIP"
51851
+ ];
51852
+ async function currentBranch6(path109, treeRoot) {
51853
+ const branch2 = await gitOrNull(path109, ["symbolic-ref", "--short", "HEAD"]);
51854
+ if (!branch2 || treeRoot && branch2 === basename32(treeRoot)) return void 0;
51855
+ return branch2;
51856
+ }
51857
+ async function upstreamBranch2(path109) {
51858
+ const upstream = await gitOrNull(path109, [
51859
+ "rev-parse",
51860
+ "--abbrev-ref",
51861
+ "--symbolic-full-name",
51862
+ "@{u}"
51863
+ ]);
51864
+ if (!upstream?.startsWith("origin/")) return void 0;
51865
+ return upstream.slice("origin/".length);
51866
+ }
51867
+ async function pushTransferSnapshot(path109, itemId2, treeRoot) {
51868
+ const ref = transferRefFor(itemId2);
51869
+ const branch2 = await currentBranch6(path109, treeRoot);
51870
+ const upstream = await upstreamBranch2(path109);
51871
+ const head = (await git2(path109, ["rev-parse", "HEAD"])).trim();
51872
+ await git2(path109, ["add", "-A"]);
51873
+ try {
51874
+ await git2(path109, WIP_COMMIT);
51875
+ await git2(
51876
+ path109,
51877
+ ["push", "--no-verify", "--force", "origin", `HEAD:refs/heads/${ref}`],
51878
+ PUSH_TIMEOUT_MS
51879
+ );
51880
+ } finally {
51881
+ await git2(path109, ["reset", "--mixed", "--quiet", head]);
51882
+ }
51883
+ return { ref, branch: branch2, upstream };
51884
+ }
51885
+
51886
+ // src/commands/sessions/daemon/transfer/snapshotTree.ts
51887
+ async function snapshotTree(s, args, traceId) {
51888
+ const path109 = s.worktree?.path ?? s.cwd;
51889
+ if (!path109) return void 0;
51890
+ const snapshot = await pushTransferSnapshot(path109, args[2], s.worktree?.path);
51891
+ daemonLog(
51892
+ `session ${s.id} pushed ${path109} to ${snapshot.ref} (branch=${snapshot.branch ?? "tree"} upstream=${snapshot.upstream ?? "none"}) trace=${traceId}`
51893
+ );
51894
+ return snapshot;
51895
+ }
51896
+
51897
+ // src/commands/sessions/daemon/transfer/snapshotOrFail.ts
51898
+ async function snapshotOrFail(s, args, traceId) {
51899
+ try {
51900
+ return { ok: true, snapshot: await snapshotTree(s, args, traceId) };
51901
+ } catch (error) {
51902
+ const reason4 = error instanceof Error ? error.message : String(error);
51903
+ return { ok: false, error: `push failed: ${reason4}` };
51904
+ }
51905
+ }
51906
+
51907
+ // src/commands/sessions/daemon/transfer/transferSession.ts
51908
+ function refuse(client, id, message3) {
51909
+ daemonLog(`session ${id} transfer refused: ${message3}`);
51910
+ sendTo(client, { type: "error", message: `Transfer refused: ${message3}` });
51911
+ }
51912
+ async function transferSession(client, deps2, { sessionId: id, target, cwd }) {
51913
+ const s = deps2.session(id);
51914
+ const refused = transferRefusal(s, target, deps2.links);
51915
+ const args = s && backlogRunArgs(s);
51916
+ if (refused || !s || !args)
51917
+ return refuse(client, id, refused ?? "unknown session");
51918
+ if (s.status === "running")
51919
+ return queueTransfer(client, deps2.notify, s, target, cwd);
51920
+ const traceId = newTraceId();
51921
+ daemonLog(
51922
+ `session ${id} transfer to ${target} (cwd=${cwd ?? "default"}) trace=${traceId}: snapshotting tree`
51923
+ );
51924
+ s.transfer = { target };
51925
+ deps2.notify();
51926
+ const pushed = await snapshotOrFail(s, args, traceId);
51927
+ if (!pushed.ok) {
51928
+ s.transfer = { target, error: pushed.error };
51929
+ deps2.notify();
51930
+ return refuse(client, id, pushed.error);
51931
+ }
51932
+ await handOffToTarget(client, deps2, s, {
51933
+ args,
51934
+ target,
51935
+ cwd,
51936
+ traceId,
51937
+ snapshot: pushed.snapshot
51938
+ });
51939
+ }
51940
+
51941
+ // src/commands/sessions/daemon/transfer/runQueuedTransfer.ts
51942
+ function runQueuedTransfer(client, deps2, s) {
51943
+ const queued = s.transfer?.queued;
51944
+ if (!s.transfer || !queued || s.status === "running") return void 0;
51945
+ const { target } = s.transfer;
51946
+ daemonLog(
51947
+ `session ${s.id} went ${s.status}; running queued transfer to ${target}`
51948
+ );
51949
+ s.transfer = void 0;
51950
+ return transferSession(client, deps2, {
51951
+ sessionId: s.id,
51952
+ target,
51953
+ cwd: queued.cwd
51954
+ });
51955
+ }
51956
+
51957
+ // src/commands/sessions/daemon/transfer/transferDepsFor.ts
51958
+ function transferDepsFor(m) {
51959
+ return {
51960
+ session: m.session,
51961
+ links: m.links,
51962
+ stop: (id) => m.stopSession(id),
51963
+ discard: m.discardSession,
51964
+ notify: () => m.update(() => true)
51965
+ };
51966
+ }
51967
+
51968
+ // src/commands/sessions/daemon/transfer/queuedTransferTrigger.ts
51969
+ function queuedTransferTrigger(host) {
51970
+ const viewers = {
51971
+ send: (raw) => {
51972
+ for (const viewer of host.clients.viewers()) viewer.send(raw);
51973
+ }
51974
+ };
51975
+ return (s) => void runQueuedTransfer(viewers, transferDepsFor(host), s);
51976
+ }
51977
+
51978
+ // src/commands/sessions/daemon/makeManagerStatusHandler.ts
51979
+ function makeManagerStatusHandler(sessions, host) {
51980
+ return makeStatusChangeHandler(sessions, {
51981
+ dismiss: (id) => host.dismissSession(id),
51982
+ notify: () => host.update(() => true),
51983
+ idle: queuedTransferTrigger(host)
51984
+ });
51985
+ }
51986
+
51724
51987
  // src/commands/sessions/daemon/applySetStatus.ts
51725
51988
  function opensPrompt(status2, source) {
51726
51989
  const askUserQuestion = source === "pretool" && status2 === "waiting";
@@ -52804,7 +53067,7 @@ function rearmStoppedSessions(sessions, notify2) {
52804
53067
 
52805
53068
  // src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
52806
53069
  import { existsSync as existsSync100 } from "fs";
52807
- import { basename as basename33 } from "path";
53070
+ import { basename as basename34 } from "path";
52808
53071
 
52809
53072
  // src/commands/sessions/daemon/worktree/accountedTrees.ts
52810
53073
  function accountedTrees(sessions) {
@@ -52912,7 +53175,7 @@ function capped2(lines2) {
52912
53175
  }
52913
53176
 
52914
53177
  // src/commands/sessions/daemon/worktree/resurfaceOrphanedWorktree.ts
52915
- import { basename as basename32 } from "path";
53178
+ import { basename as basename33 } from "path";
52916
53179
  function resurfaceOrphanedWorktree(sessions, spawnWith, recovered, notify2) {
52917
53180
  const { orphan, reason: reason4, held } = recovered;
52918
53181
  let id;
@@ -52935,7 +53198,7 @@ function orphanedSession(id, recovered) {
52935
53198
  const { orphan, reason: reason4, held } = recovered;
52936
53199
  return {
52937
53200
  ...sessionBase(id, "stopped"),
52938
- name: `recovered ${basename32(orphan.path)}`,
53201
+ name: `recovered ${basename33(orphan.path)}`,
52939
53202
  subtitle: `${held.summary} in ${orphan.path}`,
52940
53203
  commandType: "claude",
52941
53204
  pty: null,
@@ -52996,7 +53259,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
52996
53259
  logVanishedTree(sessions, path109);
52997
53260
  vanished.set(clone, [
52998
53261
  ...vanished.get(clone) ?? [],
52999
- { path: path109, branch: basename33(path109) }
53262
+ { path: path109, branch: basename34(path109) }
53000
53263
  ]);
53001
53264
  continue;
53002
53265
  }
@@ -54353,10 +54616,10 @@ var SessionManager = class {
54353
54616
  resume(sessionId, cwd, name, harness) {
54354
54617
  return resumeInTree(this.treeCtx(), sessionId, cwd, name, harness);
54355
54618
  }
54356
- onStatusChange = makeStatusChangeHandler(this.sessions, {
54357
- dismiss: (id) => this.dismissSession(id),
54358
- notify: () => this.notify()
54359
- });
54619
+ onStatusChange = makeManagerStatusHandler(
54620
+ this.sessions,
54621
+ this
54622
+ );
54360
54623
  io = new SessionIo(
54361
54624
  this.sessions,
54362
54625
  () => this.onStatusChange,
@@ -55479,22 +55742,6 @@ async function spawnTransferredRun(ctx, discard, { assistArgs, cwd, meta, snapsh
55479
55742
  return id;
55480
55743
  }
55481
55744
 
55482
- // src/commands/sessions/daemon/transfer/TransferSnapshot.ts
55483
- function transferRefFor(itemId2) {
55484
- return `assist/transfer/${itemId2}`;
55485
- }
55486
- function parseTransferSnapshot(value) {
55487
- if (!value || typeof value !== "object") return void 0;
55488
- const { ref, branch: branch2, upstream } = value;
55489
- if (typeof ref !== "string" || !ref.startsWith("assist/transfer/"))
55490
- return void 0;
55491
- return {
55492
- ref,
55493
- branch: typeof branch2 === "string" ? branch2 : void 0,
55494
- upstream: typeof upstream === "string" ? upstream : void 0
55495
- };
55496
- }
55497
-
55498
55745
  // src/commands/sessions/daemon/worktree/prCheckoutNumber.ts
55499
55746
  var CHECKOUT_COMMANDS = /* @__PURE__ */ new Set([
55500
55747
  "review",
@@ -55602,205 +55849,30 @@ function spawnCreate(m, d) {
55602
55849
  );
55603
55850
  }
55604
55851
 
55605
- // src/commands/sessions/shared/backlogRunArgs.ts
55606
- function backlogRunArgs(session) {
55607
- const args = session.assistArgs;
55608
- if (session.commandType !== "assist" || !args) return void 0;
55609
- if (args[0] !== "backlog" || args[1] !== "run" || !args[2]) return void 0;
55610
- return args;
55611
- }
55612
-
55613
- // src/commands/sessions/daemon/transfer/launchOnTarget.ts
55614
- function launchOnTarget(route, request) {
55615
- return new Promise((resolve32) => {
55616
- const capture = {
55617
- send: (raw) => {
55618
- const msg = JSON.parse(raw);
55619
- if (msg.type === "created")
55620
- resolve32({ ok: true, sessionId: msg.sessionId });
55621
- else if (msg.type === "error")
55622
- resolve32({ ok: false, error: String(msg.message) });
55623
- }
55624
- };
55625
- if (!route(capture, request))
55626
- resolve32({ ok: false, error: `${request.node} is not a linked node` });
55627
- });
55628
- }
55629
-
55630
- // src/commands/sessions/daemon/transfer/settleTransfer.ts
55631
- function settleTransfer(client, deps2, s, outcome, traceId) {
55632
- const target = s.transfer?.target ?? "target";
55633
- if (!outcome.ok) {
55634
- daemonLog(
55635
- `session ${s.id} transfer to ${target} failed trace=${traceId}: ${outcome.error}; source kept`
55636
- );
55637
- s.transfer = { target, error: outcome.error };
55638
- deps2.notify();
55639
- sendTo(client, {
55640
- type: "error",
55641
- message: `Transfer to ${target} failed: ${outcome.error}`
55642
- });
55643
- return;
55852
+ // src/commands/sessions/daemon/transfer/cancelQueuedTransfer.ts
55853
+ function cancelQueuedTransfer(s, id) {
55854
+ if (!s?.transfer?.queued) {
55855
+ daemonLog(`session ${id} cancel-transfer ignored: no pending transfer`);
55856
+ return false;
55644
55857
  }
55645
- daemonLog(
55646
- `session ${s.id} transferred to ${target} as ${outcome.sessionId} trace=${traceId}; closing source`
55647
- );
55858
+ daemonLog(`session ${id} pending transfer to ${s.transfer.target} cancelled`);
55648
55859
  s.transfer = void 0;
55649
- deps2.discard(s.id);
55650
- sendTo(client, { type: "notice", message: `Transferred to ${target}` });
55651
- }
55652
-
55653
- // src/commands/sessions/daemon/transfer/handOffToTarget.ts
55654
- async function handOffToTarget(client, deps2, s, { args, target, cwd, traceId, snapshot }) {
55655
- deps2.stop(s.id);
55656
- deps2.notify();
55657
- const outcome = await launchOnTarget(deps2.links.route, {
55658
- type: "create-assist",
55659
- assistArgs: args,
55660
- cwd,
55661
- node: target,
55662
- title: s.title,
55663
- subtitle: s.subtitle,
55664
- traceId,
55665
- transfer: snapshot
55666
- });
55667
- settleTransfer(client, deps2, s, outcome, traceId);
55668
- }
55669
-
55670
- // src/commands/sessions/daemon/transfer/transferRefusal.ts
55671
- function transferRefusal(s, target, links2) {
55672
- if (!s) return "unknown session";
55673
- if (!backlogRunArgs(s)) return "only backlog run sessions can be transferred";
55674
- if (s.transfer && !s.transfer.error)
55675
- return `already transferring to ${s.transfer.target}`;
55676
- if (!target || target === links2.localNode())
55677
- return `the session already runs on ${links2.localNode()}`;
55678
- if (!links2.isConnected(target)) return `${target} is not connected`;
55679
- return void 0;
55680
- }
55681
-
55682
- // src/commands/sessions/daemon/transfer/pushTransferSnapshot.ts
55683
- import { basename as basename35 } from "path";
55684
- var PUSH_TIMEOUT_MS = 12e4;
55685
- var WIP_COMMIT = [
55686
- "-c",
55687
- "user.name=assist",
55688
- "-c",
55689
- "user.email=assist@localhost",
55690
- "-c",
55691
- "commit.gpgsign=false",
55692
- "commit",
55693
- "--no-verify",
55694
- "--allow-empty",
55695
- "--quiet",
55696
- "-m",
55697
- "assist transfer WIP"
55698
- ];
55699
- async function currentBranch6(path109, treeRoot) {
55700
- const branch2 = await gitOrNull(path109, ["symbolic-ref", "--short", "HEAD"]);
55701
- if (!branch2 || treeRoot && branch2 === basename35(treeRoot)) return void 0;
55702
- return branch2;
55703
- }
55704
- async function upstreamBranch2(path109) {
55705
- const upstream = await gitOrNull(path109, [
55706
- "rev-parse",
55707
- "--abbrev-ref",
55708
- "--symbolic-full-name",
55709
- "@{u}"
55710
- ]);
55711
- if (!upstream?.startsWith("origin/")) return void 0;
55712
- return upstream.slice("origin/".length);
55713
- }
55714
- async function pushTransferSnapshot(path109, itemId2, treeRoot) {
55715
- const ref = transferRefFor(itemId2);
55716
- const branch2 = await currentBranch6(path109, treeRoot);
55717
- const upstream = await upstreamBranch2(path109);
55718
- const head = (await git2(path109, ["rev-parse", "HEAD"])).trim();
55719
- await git2(path109, ["add", "-A"]);
55720
- try {
55721
- await git2(path109, WIP_COMMIT);
55722
- await git2(
55723
- path109,
55724
- ["push", "--no-verify", "--force", "origin", `HEAD:refs/heads/${ref}`],
55725
- PUSH_TIMEOUT_MS
55726
- );
55727
- } finally {
55728
- await git2(path109, ["reset", "--mixed", "--quiet", head]);
55729
- }
55730
- return { ref, branch: branch2, upstream };
55731
- }
55732
-
55733
- // src/commands/sessions/daemon/transfer/snapshotTree.ts
55734
- async function snapshotTree(s, args, traceId) {
55735
- const path109 = s.worktree?.path ?? s.cwd;
55736
- if (!path109) return void 0;
55737
- const snapshot = await pushTransferSnapshot(path109, args[2], s.worktree?.path);
55738
- daemonLog(
55739
- `session ${s.id} pushed ${path109} to ${snapshot.ref} (branch=${snapshot.branch ?? "tree"} upstream=${snapshot.upstream ?? "none"}) trace=${traceId}`
55740
- );
55741
- return snapshot;
55742
- }
55743
-
55744
- // src/commands/sessions/daemon/transfer/snapshotOrFail.ts
55745
- async function snapshotOrFail(s, args, traceId) {
55746
- try {
55747
- return { ok: true, snapshot: await snapshotTree(s, args, traceId) };
55748
- } catch (error) {
55749
- const reason4 = error instanceof Error ? error.message : String(error);
55750
- return { ok: false, error: `push failed: ${reason4}` };
55751
- }
55752
- }
55753
-
55754
- // src/commands/sessions/daemon/transfer/transferSession.ts
55755
- function refuse(client, id, message3) {
55756
- daemonLog(`session ${id} transfer refused: ${message3}`);
55757
- sendTo(client, { type: "error", message: `Transfer refused: ${message3}` });
55758
- }
55759
- async function transferSession(client, deps2, { sessionId: id, target, cwd }) {
55760
- const s = deps2.session(id);
55761
- const refused = transferRefusal(s, target, deps2.links);
55762
- const args = s && backlogRunArgs(s);
55763
- if (refused || !s || !args)
55764
- return refuse(client, id, refused ?? "unknown session");
55765
- const traceId = newTraceId();
55766
- daemonLog(
55767
- `session ${id} transfer to ${target} (cwd=${cwd ?? "default"}) trace=${traceId}: snapshotting tree`
55768
- );
55769
- s.transfer = { target };
55770
- deps2.notify();
55771
- const pushed = await snapshotOrFail(s, args, traceId);
55772
- if (!pushed.ok) {
55773
- s.transfer = { target, error: pushed.error };
55774
- deps2.notify();
55775
- return refuse(client, id, pushed.error);
55776
- }
55777
- await handOffToTarget(client, deps2, s, {
55778
- args,
55779
- target,
55780
- cwd,
55781
- traceId,
55782
- snapshot: pushed.snapshot
55783
- });
55860
+ return true;
55784
55861
  }
55785
55862
 
55786
55863
  // src/commands/sessions/daemon/transfer/handleTransfer.ts
55787
55864
  var handleTransfer = routed((client, m, d) => {
55788
55865
  daemonLog(`transfer received: id=${d.sessionId} target=${d.target}`);
55789
- void transferSession(
55790
- client,
55791
- {
55792
- session: m.session,
55793
- links: m.links,
55794
- stop: (id) => m.stopSession(id),
55795
- discard: m.discardSession,
55796
- notify: () => m.update(() => true)
55797
- },
55798
- {
55799
- sessionId: d.sessionId,
55800
- target: d.target,
55801
- cwd: d.cwd
55802
- }
55803
- );
55866
+ void transferSession(client, transferDepsFor(m), {
55867
+ sessionId: d.sessionId,
55868
+ target: d.target,
55869
+ cwd: d.cwd
55870
+ });
55871
+ });
55872
+ var handleCancelTransfer = routed((_client, m, d) => {
55873
+ const id = d.sessionId;
55874
+ daemonLog(`cancel-transfer received: id=${id}`);
55875
+ m.update(() => cancelQueuedTransfer(m.session(id), id));
55804
55876
  });
55805
55877
 
55806
55878
  // src/commands/sessions/daemon/messageHandlers.ts
@@ -55862,6 +55934,7 @@ var messageHandlers = {
55862
55934
  discard: routed((_client, m, d) => m.discardSession(d.sessionId)),
55863
55935
  stop: routed((_client, m, d) => m.stopSession(d.sessionId)),
55864
55936
  transfer: handleTransfer,
55937
+ "cancel-transfer": handleCancelTransfer,
55865
55938
  ...sessionSettingHandlers,
55866
55939
  "set-active": (_client, m, d) => m.active.set(d.cwd, d.sessionId),
55867
55940
  "set-status": handleSetStatus,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.1018.0",
3
+ "version": "0.1019.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {