@staff0rd/assist 0.1223.2 → 0.1225.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.
Files changed (114) hide show
  1. package/dist/.build-files +109 -109
  2. package/dist/{addActivity-VWYYD3S7.js → addActivity-WJKCXFFQ.js} +4 -4
  3. package/dist/{addPhase-AQRCH2ZL.js → addPhase-FCUFJU2C.js} +8 -8
  4. package/dist/{advise-J6HQWJUY.js → advise-G2OU45ZJ.js} +7 -7
  5. package/dist/{ask-BJ4PLVY7.js → ask-HU23YKRK.js} +5 -5
  6. package/dist/{askCheck-OM2V2ILE.js → askCheck-2DO2YPCV.js} +12 -12
  7. package/dist/{askDesign-67H56MMG.js → askDesign-AW6DZDD5.js} +7 -7
  8. package/dist/{askQuestion-3VF7VQOB.js → askQuestion-2AVDU7K3.js} +4 -4
  9. package/dist/{branch-GGYVVXEH.js → branch-PVVYH5PW.js} +6 -6
  10. package/dist/built-version +1 -1
  11. package/dist/{chunk-MN5WFVKQ.js → chunk-2IMSOUP4.js} +1 -1
  12. package/dist/{chunk-2PJELPWT.js → chunk-4KIWZE6L.js} +2 -2
  13. package/dist/{chunk-MA7HTHHM.js → chunk-54ACF6SA.js} +1 -1
  14. package/dist/{chunk-4TP22QIG.js → chunk-5FOLBCWJ.js} +1 -1
  15. package/dist/{chunk-ZYM4VXQ2.js → chunk-5K3J2ZIP.js} +1 -1
  16. package/dist/{chunk-3OYAER4L.js → chunk-6CVGPCIX.js} +2 -2
  17. package/dist/{chunk-WANQO25C.js → chunk-74S54O2J.js} +1 -1
  18. package/dist/{chunk-N7MOTWGW.js → chunk-7ORXMQKM.js} +1 -1
  19. package/dist/{chunk-S4OMYKFD.js → chunk-A6I3ZMDH.js} +1 -1
  20. package/dist/{chunk-2NSFICTL.js → chunk-ANO2DTZQ.js} +2 -2
  21. package/dist/{chunk-6MXYEGDK.js → chunk-AR4PXFLV.js} +1 -1
  22. package/dist/{chunk-7K7Y324W.js → chunk-ASTJWYWL.js} +2 -2
  23. package/dist/{chunk-LLUXIEWN.js → chunk-ATBTW52C.js} +1 -1
  24. package/dist/{chunk-MRHAE5BG.js → chunk-B7V52ERW.js} +1 -1
  25. package/dist/{chunk-PKEIJJ5G.js → chunk-CZZR4A3M.js} +2 -2
  26. package/dist/{chunk-BEVDTMKB.js → chunk-DZNGTNBE.js} +1 -1
  27. package/dist/{chunk-THOZAKU5.js → chunk-EN4GUAJN.js} +1 -1
  28. package/dist/{chunk-RJPUT3MG.js → chunk-ESOMHI4A.js} +1 -1
  29. package/dist/{chunk-LADJTWTG.js → chunk-EUCFTM2F.js} +3 -2
  30. package/dist/{chunk-YKONRK6A.js → chunk-FGAFY5FV.js} +1 -1
  31. package/dist/{chunk-QUHEM3YC.js → chunk-FNEBHLRA.js} +4 -4
  32. package/dist/{chunk-VXTOEVXP.js → chunk-G5BH7ZDN.js} +1 -1
  33. package/dist/{chunk-GKKYQHKI.js → chunk-GEHEJMHR.js} +1 -1
  34. package/dist/{chunk-2D3ZCQE3.js → chunk-GMUBETSU.js} +17 -1
  35. package/dist/{chunk-OX6NROSP.js → chunk-I3ZRJ3C7.js} +2 -2
  36. package/dist/{chunk-7MH4R4AR.js → chunk-IXU3HNPK.js} +7 -7
  37. package/dist/{chunk-SIQRT7KZ.js → chunk-JQG4UT5A.js} +1 -1
  38. package/dist/{chunk-W5B7I3PC.js → chunk-KHHBKYBD.js} +1 -1
  39. package/dist/{chunk-YBET4BRA.js → chunk-KPKEYIYJ.js} +1 -1
  40. package/dist/{chunk-DWDPHUZ5.js → chunk-L3KYYPAT.js} +1 -1
  41. package/dist/{chunk-QVHBQTYZ.js → chunk-L3NQEY2A.js} +1 -1
  42. package/dist/{chunk-TJYDNLJX.js → chunk-NVMMQ2CH.js} +2 -2
  43. package/dist/{chunk-HFONOHA7.js → chunk-OI5M5KLY.js} +3 -3
  44. package/dist/{chunk-3SPX33RA.js → chunk-QFBWUL4O.js} +4 -4
  45. package/dist/{chunk-4TOFIAJQ.js → chunk-QXQVZXWB.js} +1 -1
  46. package/dist/{chunk-XLAPIT6F.js → chunk-QYHWNCUB.js} +8 -8
  47. package/dist/{chunk-BU6VFZP4.js → chunk-R75YUFD3.js} +1 -1
  48. package/dist/{chunk-WXBTLN2E.js → chunk-RVX67NKA.js} +2 -2
  49. package/dist/{chunk-YLSVCL5Q.js → chunk-SLXNVY57.js} +1 -1
  50. package/dist/{chunk-KE6SKMNG.js → chunk-U572JQMZ.js} +1 -1
  51. package/dist/{chunk-CNMGUPR6.js → chunk-UU2FV576.js} +7 -7
  52. package/dist/{chunk-DQ6HCKXN.js → chunk-UYJIXQHJ.js} +1 -1
  53. package/dist/{chunk-24YN3552.js → chunk-UZWSCPAO.js} +1 -1
  54. package/dist/{chunk-BGN4WP7H.js → chunk-V3WEX475.js} +1 -1
  55. package/dist/{chunk-QC6JEJEO.js → chunk-VKMH4WCM.js} +1 -1
  56. package/dist/{chunk-VE2MTM7N.js → chunk-VOMQJC2G.js} +2 -2
  57. package/dist/{chunk-IXROSBZQ.js → chunk-WA2OUBCF.js} +1 -1
  58. package/dist/{chunk-B6XZ72DY.js → chunk-XOCRMXTJ.js} +1 -1
  59. package/dist/{chunk-QZXHLY6L.js → chunk-YOGFNYVD.js} +2 -2
  60. package/dist/{chunk-NBUBXIUE.js → chunk-YWRRBEIG.js} +4 -4
  61. package/dist/{cliHook-RXBTCBJ7.js → cliHook-IJSYDI35.js} +9 -9
  62. package/dist/{cliHookCheck-WTR47R4A.js → cliHookCheck-LW65BRGS.js} +4 -4
  63. package/dist/{codexHook-TCFGH5KU.js → codexHook-CNNUONVN.js} +12 -12
  64. package/dist/commands/sessions/web/bundle.js +466 -463
  65. package/dist/{comment-VKR6PKDM.js → comment-TFGXBDK5.js} +6 -6
  66. package/dist/{commentIssue-2MH2NGJJ.js → commentIssue-JPJGSAOB.js} +5 -5
  67. package/dist/{commit-4Z2XWLUX.js → commit-BS6KHIR6.js} +9 -9
  68. package/dist/{createIssue-HTUDGSFK.js → createIssue-LKMYVJ74.js} +4 -4
  69. package/dist/{doctorNodes-7H33WDF5.js → doctorNodes-4GXMK5OJ.js} +3 -3
  70. package/dist/{done-4774MHRU.js → done-CNIZAH52.js} +7 -7
  71. package/dist/{edit-BOIJGX7F.js → edit-HQQCQVO5.js} +4 -4
  72. package/dist/{editHook-TLWOG7DB.js → editHook-ZWGMUKCH.js} +9 -9
  73. package/dist/{editIssue-DTAH63OR.js → editIssue-U247BW6F.js} +4 -4
  74. package/dist/{editIssueComment-GITGWUHV.js → editIssueComment-V4E6E3JT.js} +5 -5
  75. package/dist/{fixConflict-SBQVCQBA.js → fixConflict-LIUQCMP7.js} +9 -9
  76. package/dist/{harnessFollowUps-GQEAJFWL.js → harnessFollowUps-GUL2JEGZ.js} +1 -1
  77. package/dist/index.js +66 -66
  78. package/dist/{launchMode-V7OUIUXV.js → launchMode-JSSZ3DLS.js} +19 -19
  79. package/dist/{list-7HBHDDY4.js → list-6NHAPSCV.js} +8 -8
  80. package/dist/{migrate-XRW3GOM6.js → migrate-XMEYPFSJ.js} +5 -5
  81. package/dist/{next-NHYC5CPD.js → next-NMZ4UYCL.js} +18 -18
  82. package/dist/{phaseDone-HZ2ZXRC2.js → phaseDone-6LWYT4A4.js} +8 -8
  83. package/dist/{piHook-WYM2A7MI.js → piHook-CVJF55AO.js} +9 -9
  84. package/dist/{postSlackMessage-3UJXP3L7.js → postSlackMessage-X5QM2Y6U.js} +5 -5
  85. package/dist/{propose-XOVJL7GW.js → propose-JMH555II.js} +9 -9
  86. package/dist/{raise-BJKFEN5V.js → raise-6IRIWUH5.js} +4 -4
  87. package/dist/{refine-2QSTHBGO.js → refine-NCUDNGNK.js} +20 -20
  88. package/dist/{reply-EDILRVRB.js → reply-EOZ2MMOO.js} +5 -5
  89. package/dist/{restartNode-I6Y2CRW7.js → restartNode-WAKNWHAC.js} +5 -5
  90. package/dist/{review-DCBA33AZ.js → review-IZ4KFJJB.js} +13 -13
  91. package/dist/{reviewPrComments-J23PK2NG.js → reviewPrComments-DLKTH372.js} +9 -9
  92. package/dist/{rewindPhase-3K5VYYKU.js → rewindPhase-KQVS5ZBR.js} +11 -11
  93. package/dist/{rulesAdd-D45FIH5B.js → rulesAdd-KREYXS4F.js} +5 -5
  94. package/dist/{run-YW2JUM6O.js → run-C2ASSPJD.js} +16 -16
  95. package/dist/{run-VJVMTOJD.js → run-G4AQNOSH.js} +16 -16
  96. package/dist/{runDaemon-HDBLBKSN.js → runDaemon-YWDRQWR2.js} +250 -95
  97. package/dist/{runExtract-3JTDFR6J.js → runExtract-4BGVMV4H.js} +4 -4
  98. package/dist/{runParallelPhase-KPCQWPFK.js → runParallelPhase-SBFLYBLY.js} +11 -11
  99. package/dist/{runRefine-XUWD6HYA.js → runRefine-XZBPOP4I.js} +20 -20
  100. package/dist/{scan-7Y747MSA.js → scan-5UFH4ICQ.js} +6 -6
  101. package/dist/{schemaConfirm-JFXCNJFJ.js → schemaConfirm-BXFM2472.js} +4 -4
  102. package/dist/{schemaLock-O6HASHR4.js → schemaLock-I46X5EFX.js} +4 -4
  103. package/dist/{schemaUnlock-5J3T4HRU.js → schemaUnlock-N337LSZD.js} +4 -4
  104. package/dist/{search-R23JJROM.js → search-EQ55NZEX.js} +8 -8
  105. package/dist/{show-UDZ6MAMB.js → show-7ID5EFBV.js} +6 -6
  106. package/dist/{show-BASBE5KD.js → show-KD7EKQLP.js} +5 -5
  107. package/dist/{signExtension-5QD6DOQG.js → signExtension-XYZ6JMKX.js} +1 -1
  108. package/dist/{slack-24IRGK5S.js → slack-KE7URAIF.js} +5 -5
  109. package/dist/{updateNode-WFRRGBMS.js → updateNode-PCHHTH5A.js} +5 -5
  110. package/dist/{updatePlan-4ORF5MXV.js → updatePlan-ZQYVVJK3.js} +9 -9
  111. package/dist/{web-PZZILTG2.js → web-QFFM3H6G.js} +19 -19
  112. package/dist/{web-R2YWW663.js → web-U2LADCUI.js} +19 -19
  113. package/dist/{wontfix-WGDQ5UU4.js → wontfix-VKIRGLUI.js} +5 -5
  114. package/package.json +1 -1
@@ -22,7 +22,7 @@ import {
22
22
  formatScanUsage,
23
23
  inboxScanBlocker,
24
24
  runInboxScan
25
- } from "./chunk-OX6NROSP.js";
25
+ } from "./chunk-I3ZRJ3C7.js";
26
26
  import {
27
27
  allocateTree,
28
28
  installFailureMessage,
@@ -32,7 +32,7 @@ import {
32
32
  stopInstall,
33
33
  tipSetFromRemote,
34
34
  worktreeWithBranch
35
- } from "./chunk-DQ6HCKXN.js";
35
+ } from "./chunk-UYJIXQHJ.js";
36
36
  import {
37
37
  describePersistedSession,
38
38
  loadPersistedSessions,
@@ -56,22 +56,22 @@ import {
56
56
  } from "./chunk-BXGPF3TG.js";
57
57
  import {
58
58
  launchBlocker
59
- } from "./chunk-24YN3552.js";
59
+ } from "./chunk-UZWSCPAO.js";
60
60
  import {
61
61
  OneShotUnavailableError,
62
62
  runOneShotPrompt
63
- } from "./chunk-WXBTLN2E.js";
63
+ } from "./chunk-RVX67NKA.js";
64
64
  import {
65
65
  backlogPhaseActivity,
66
66
  recordPhaseSession
67
- } from "./chunk-BEVDTMKB.js";
67
+ } from "./chunk-DZNGTNBE.js";
68
68
  import {
69
69
  buildResumePrompt,
70
70
  wrapRestartNudge
71
71
  } from "./chunk-F7QYFJB2.js";
72
72
  import {
73
73
  preassignedId
74
- } from "./chunk-BU6VFZP4.js";
74
+ } from "./chunk-R75YUFD3.js";
75
75
  import {
76
76
  activityPath,
77
77
  readActivity,
@@ -83,7 +83,7 @@ import {
83
83
  locateConversation,
84
84
  readTranscriptHead,
85
85
  transcriptMessages
86
- } from "./chunk-2NSFICTL.js";
86
+ } from "./chunk-ANO2DTZQ.js";
87
87
  import {
88
88
  CHECK_NOTE_KEY,
89
89
  CHECK_RESULT_KEY
@@ -119,7 +119,7 @@ import {
119
119
  toNodeSessionId,
120
120
  usageWindowKey,
121
121
  watcherLogPath
122
- } from "./chunk-4TOFIAJQ.js";
122
+ } from "./chunk-QXQVZXWB.js";
123
123
  import {
124
124
  newTraceId
125
125
  } from "./chunk-4HKB2TAG.js";
@@ -131,7 +131,7 @@ import {
131
131
  isHello,
132
132
  linkVersionCheck,
133
133
  negotiateProtocol
134
- } from "./chunk-VXTOEVXP.js";
134
+ } from "./chunk-G5BH7ZDN.js";
135
135
  import {
136
136
  loadLinkSpecs
137
137
  } from "./chunk-6KSMPTXN.js";
@@ -146,7 +146,7 @@ import "./chunk-XV2STPP6.js";
146
146
  import {
147
147
  conversationOf,
148
148
  lookupConversation
149
- } from "./chunk-VE2MTM7N.js";
149
+ } from "./chunk-VOMQJC2G.js";
150
150
  import {
151
151
  stripAnsi
152
152
  } from "./chunk-YJ72SXVD.js";
@@ -188,9 +188,9 @@ import {
188
188
  } from "./chunk-4OOUSHS4.js";
189
189
  import {
190
190
  resolvePlan
191
- } from "./chunk-4TP22QIG.js";
192
- import "./chunk-B6XZ72DY.js";
193
- import "./chunk-N7MOTWGW.js";
191
+ } from "./chunk-5FOLBCWJ.js";
192
+ import "./chunk-XOCRMXTJ.js";
193
+ import "./chunk-7ORXMQKM.js";
194
194
  import "./chunk-6Z7XJJNZ.js";
195
195
  import {
196
196
  loadItem
@@ -218,8 +218,8 @@ import {
218
218
  runConfigBaseDirFrom
219
219
  } from "./chunk-TUFEEHAQ.js";
220
220
  import "./chunk-NZYSENRR.js";
221
- import "./chunk-2PJELPWT.js";
222
- import "./chunk-6MXYEGDK.js";
221
+ import "./chunk-4KIWZE6L.js";
222
+ import "./chunk-AR4PXFLV.js";
223
223
  import {
224
224
  deriveHistoryFields,
225
225
  discoverCodexRolloutPaths,
@@ -231,6 +231,7 @@ import {
231
231
  noopDisposable,
232
232
  parseRestartNudge,
233
233
  parseSessionFile,
234
+ projectDirForCwd,
234
235
  quoteForLog,
235
236
  readCodexRolloutUsage,
236
237
  readTranscriptTail,
@@ -247,7 +248,7 @@ import {
247
248
  viewerSize,
248
249
  withHarnessPath,
249
250
  workflowQueryEnv
250
- } from "./chunk-LADJTWTG.js";
251
+ } from "./chunk-EUCFTM2F.js";
251
252
  import {
252
253
  daemonLog,
253
254
  recentDaemonLogLines,
@@ -262,8 +263,8 @@ import "./chunk-IBPSXDUB.js";
262
263
  import {
263
264
  harnessCapability,
264
265
  resolveCapability
265
- } from "./chunk-QC6JEJEO.js";
266
- import "./chunk-2D3ZCQE3.js";
266
+ } from "./chunk-VKMH4WCM.js";
267
+ import "./chunk-GMUBETSU.js";
267
268
  import {
268
269
  harnessLabel,
269
270
  resolveHarness
@@ -274,7 +275,7 @@ import {
274
275
  import "./chunk-APZ6ZTDA.js";
275
276
  import "./chunk-K4DJEFDZ.js";
276
277
  import "./chunk-D7UZLH36.js";
277
- import "./chunk-YBET4BRA.js";
278
+ import "./chunk-KPKEYIYJ.js";
278
279
  import "./chunk-EW2ZM2PC.js";
279
280
  import "./chunk-OTSOBFW2.js";
280
281
  import {
@@ -5660,6 +5661,44 @@ function backlogRunArgs(session) {
5660
5661
  return args;
5661
5662
  }
5662
5663
 
5664
+ // src/commands/sessions/shared/transferPlan.ts
5665
+ var TRANSFER_UNSUPPORTED = "only backlog run and resumable prompt sessions can be transferred";
5666
+ function transferPlan(session) {
5667
+ const args = backlogRunArgs(session);
5668
+ if (args) return { kind: "backlog-run", args };
5669
+ if (session.commandType !== "claude" || session.assistArgs) return void 0;
5670
+ if (!harnessCapability(session.harness, "conversation.transfer").supported)
5671
+ return void 0;
5672
+ if (!session.claudeSessionId) return void 0;
5673
+ return { kind: "prompt", conversationId: session.claudeSessionId };
5674
+ }
5675
+
5676
+ // src/commands/sessions/daemon/transfer/queueTransfer.ts
5677
+ function queueTransfer(client, notify, s, target, cwd) {
5678
+ daemonLog(
5679
+ `session ${s.id} transfer to ${target} queued: agent mid-turn, waiting for idle`
5680
+ );
5681
+ s.transfer = { target, queued: { cwd } };
5682
+ notify();
5683
+ sendTo(client, {
5684
+ type: "notice",
5685
+ message: `Transfer to ${target} will start once the agent is idle`
5686
+ });
5687
+ }
5688
+
5689
+ // src/commands/sessions/daemon/transfer/refuseTransfer.ts
5690
+ function refuseTransfer(client, id, message) {
5691
+ daemonLog(`session ${id} transfer refused: ${message}`);
5692
+ sendTo(client, { type: "error", message: `Transfer refused: ${message}` });
5693
+ }
5694
+
5695
+ // src/commands/sessions/daemon/transfer/failTransfer.ts
5696
+ function failTransfer(client, deps, s, target, error) {
5697
+ s.transfer = { target, error };
5698
+ deps.notify();
5699
+ refuseTransfer(client, s.id, error);
5700
+ }
5701
+
5663
5702
  // src/commands/sessions/daemon/transfer/launchOnTarget.ts
5664
5703
  function launchOnTarget(links, request) {
5665
5704
  return new Promise((resolve4) => {
@@ -5713,58 +5752,55 @@ function settleTransfer(client, deps, s, outcome, traceId) {
5713
5752
  }
5714
5753
 
5715
5754
  // src/commands/sessions/daemon/transfer/handOffToTarget.ts
5716
- async function handOffToTarget(client, deps, s, { args, target, cwd, traceId, snapshot }) {
5755
+ async function handOffToTarget(client, deps, s, { target, traceId, request }) {
5717
5756
  daemonLog(
5718
5757
  `session ${s.id} transfer to ${target} trace=${traceId}: launching on target`
5719
5758
  );
5720
5759
  s.transfer = { target, stage: "launching" };
5721
5760
  deps.notify();
5722
- const outcome = await launchOnTarget(deps.links, {
5723
- type: "create-assist",
5724
- assistArgs: args,
5761
+ const outcome = await launchOnTarget(deps.links, request);
5762
+ settleTransfer(client, deps, s, outcome, traceId);
5763
+ }
5764
+
5765
+ // src/commands/sessions/daemon/transfer/readTransferTranscript.ts
5766
+ import { readFile } from "fs/promises";
5767
+ async function readTransferTranscript(plan) {
5768
+ if (plan.kind !== "prompt") return { ok: true, conversation: void 0 };
5769
+ const id = plan.conversationId;
5770
+ try {
5771
+ const path2 = await harnessAdapter("claude").conversation.locate(id);
5772
+ if (!path2) throw new Error(`no transcript found for ${id}`);
5773
+ return {
5774
+ ok: true,
5775
+ conversation: { id, transcript: await readFile(path2, "utf8") }
5776
+ };
5777
+ } catch (error) {
5778
+ const reason6 = error instanceof Error ? error.message : String(error);
5779
+ return { ok: false, error: `transcript delivery failed: ${reason6}` };
5780
+ }
5781
+ }
5782
+
5783
+ // src/commands/sessions/daemon/transfer/transferLaunchRequest.ts
5784
+ function transferLaunchRequest(s, plan, { target, cwd, traceId, snapshot, conversation }) {
5785
+ const common = {
5725
5786
  cwd,
5726
5787
  node: target,
5727
5788
  title: s.title,
5728
5789
  subtitle: s.subtitle,
5729
5790
  traceId,
5730
5791
  transfer: snapshot
5731
- });
5732
- settleTransfer(client, deps, s, outcome, traceId);
5733
- }
5734
-
5735
- // src/commands/sessions/daemon/transfer/queueTransfer.ts
5736
- function queueTransfer(client, notify, s, target, cwd) {
5737
- daemonLog(
5738
- `session ${s.id} transfer to ${target} queued: agent mid-turn, waiting for idle`
5739
- );
5740
- s.transfer = { target, queued: { cwd } };
5741
- notify();
5742
- sendTo(client, {
5743
- type: "notice",
5744
- message: `Transfer to ${target} will start once the agent is idle`
5745
- });
5746
- }
5747
-
5748
- // src/commands/sessions/daemon/transfer/transferRefusal.ts
5749
- function transferRefusal(s, target, links) {
5750
- if (!s) return "unknown session";
5751
- if (!backlogRunArgs(s)) return "only backlog run sessions can be transferred";
5752
- if (s.transfer?.queued)
5753
- return `a transfer to ${s.transfer.target} is already pending`;
5754
- if (s.transfer && !s.transfer.error)
5755
- return `already transferring to ${s.transfer.target}`;
5756
- if (!target || target === links.localNode())
5757
- return `the session already runs on ${links.localNode()}`;
5758
- if (!links.isConnected(target)) return `${target} is not connected`;
5759
- return void 0;
5792
+ };
5793
+ if (plan.kind === "backlog-run")
5794
+ return { type: "create-assist", assistArgs: plan.args, ...common };
5795
+ return { type: "create", harness: "claude", conversation, ...common };
5760
5796
  }
5761
5797
 
5762
- // src/commands/sessions/daemon/transfer/pushTransferSnapshot.ts
5763
- import { basename as basename3 } from "path";
5764
-
5765
5798
  // src/commands/sessions/daemon/transfer/TransferSnapshot.ts
5766
- function transferRefFor(itemId) {
5767
- return `assist/transfer/${itemId}`;
5799
+ function transferRefFor(key) {
5800
+ return `assist/transfer/${key}`;
5801
+ }
5802
+ function promptTransferKey(node, sessionId) {
5803
+ return `${node}-${sessionId}`;
5768
5804
  }
5769
5805
  function parseTransferSnapshot(value) {
5770
5806
  if (!value || typeof value !== "object") return void 0;
@@ -5779,6 +5815,7 @@ function parseTransferSnapshot(value) {
5779
5815
  }
5780
5816
 
5781
5817
  // src/commands/sessions/daemon/transfer/pushTransferSnapshot.ts
5818
+ import { basename as basename3 } from "path";
5782
5819
  var PUSH_TIMEOUT_MS = 12e4;
5783
5820
  var WIP_COMMIT = [
5784
5821
  "-c",
@@ -5809,8 +5846,8 @@ async function upstreamBranch(path2) {
5809
5846
  if (!upstream?.startsWith("origin/")) return void 0;
5810
5847
  return upstream.slice("origin/".length);
5811
5848
  }
5812
- async function pushTransferSnapshot(path2, itemId, treeRoot) {
5813
- const ref = transferRefFor(itemId);
5849
+ async function pushTransferSnapshot(path2, key, treeRoot) {
5850
+ const ref = transferRefFor(key);
5814
5851
  const branch = await currentBranch(path2, treeRoot);
5815
5852
  const upstream = await upstreamBranch(path2);
5816
5853
  const head = (await git(path2, ["rev-parse", "HEAD"])).trim();
@@ -5829,10 +5866,10 @@ async function pushTransferSnapshot(path2, itemId, treeRoot) {
5829
5866
  }
5830
5867
 
5831
5868
  // src/commands/sessions/daemon/transfer/snapshotTree.ts
5832
- async function snapshotTree(s, args, traceId) {
5869
+ async function snapshotTree(s, key, traceId) {
5833
5870
  const path2 = s.worktree?.path ?? s.cwd;
5834
5871
  if (!path2) return void 0;
5835
- const snapshot = await pushTransferSnapshot(path2, args[2], s.worktree?.path);
5872
+ const snapshot = await pushTransferSnapshot(path2, key, s.worktree?.path);
5836
5873
  daemonLog(
5837
5874
  `session ${s.id} pushed ${path2} to ${snapshot.ref} (branch=${snapshot.branch ?? "tree"} upstream=${snapshot.upstream ?? "none"}) trace=${traceId}`
5838
5875
  );
@@ -5840,26 +5877,62 @@ async function snapshotTree(s, args, traceId) {
5840
5877
  }
5841
5878
 
5842
5879
  // src/commands/sessions/daemon/transfer/snapshotOrFail.ts
5843
- async function snapshotOrFail(s, args, traceId) {
5880
+ async function snapshotOrFail(s, key, traceId) {
5844
5881
  try {
5845
- return { ok: true, snapshot: await snapshotTree(s, args, traceId) };
5882
+ return { ok: true, snapshot: await snapshotTree(s, key, traceId) };
5846
5883
  } catch (error) {
5847
5884
  const reason6 = error instanceof Error ? error.message : String(error);
5848
5885
  return { ok: false, error: `push failed: ${reason6}` };
5849
5886
  }
5850
5887
  }
5851
5888
 
5852
- // src/commands/sessions/daemon/transfer/transferSession.ts
5853
- function refuse(client, id, message) {
5854
- daemonLog(`session ${id} transfer refused: ${message}`);
5855
- sendTo(client, { type: "error", message: `Transfer refused: ${message}` });
5889
+ // src/commands/sessions/daemon/transfer/snapshotAndHandOff.ts
5890
+ function snapshotKey(deps, s, plan) {
5891
+ return plan.kind === "backlog-run" ? plan.args[2] : promptTransferKey(deps.links.localNode(), s.id);
5856
5892
  }
5893
+ async function snapshotAndHandOff(client, deps, s, { plan, target, cwd, traceId }) {
5894
+ const transcript = await readTransferTranscript(plan);
5895
+ if (!transcript.ok)
5896
+ return failTransfer(client, deps, s, target, transcript.error);
5897
+ const pushed = await snapshotOrFail(s, snapshotKey(deps, s, plan), traceId);
5898
+ if (!pushed.ok) return failTransfer(client, deps, s, target, pushed.error);
5899
+ await handOffToTarget(client, deps, s, {
5900
+ target,
5901
+ traceId,
5902
+ request: transferLaunchRequest(s, plan, {
5903
+ target,
5904
+ cwd,
5905
+ traceId,
5906
+ snapshot: pushed.snapshot,
5907
+ conversation: transcript.conversation
5908
+ })
5909
+ });
5910
+ }
5911
+
5912
+ // src/commands/sessions/daemon/transfer/transferRefusal.ts
5913
+ function transferRefusal(s, target, links) {
5914
+ if (!s) return "unknown session";
5915
+ const plan = transferPlan(s);
5916
+ if (!plan) return TRANSFER_UNSUPPORTED;
5917
+ if (plan.kind === "prompt" && !(s.worktree?.path ?? s.cwd))
5918
+ return "the session has no working tree to transfer";
5919
+ if (s.transfer?.queued)
5920
+ return `a transfer to ${s.transfer.target} is already pending`;
5921
+ if (s.transfer && !s.transfer.error)
5922
+ return `already transferring to ${s.transfer.target}`;
5923
+ if (!target || target === links.localNode())
5924
+ return `the session already runs on ${links.localNode()}`;
5925
+ if (!links.isConnected(target)) return `${target} is not connected`;
5926
+ return void 0;
5927
+ }
5928
+
5929
+ // src/commands/sessions/daemon/transfer/transferSession.ts
5857
5930
  async function transferSession(client, deps, { sessionId: id, target, cwd, phaseEnded }) {
5858
5931
  const s = deps.session(id);
5859
5932
  const refused = transferRefusal(s, target, deps.links);
5860
- const args = s && backlogRunArgs(s);
5861
- if (refused || !s || !args)
5862
- return refuse(client, id, refused ?? "unknown session");
5933
+ const plan = s && transferPlan(s);
5934
+ if (refused || !s || !plan)
5935
+ return refuseTransfer(client, id, refused ?? "unknown session");
5863
5936
  if (s.status === "running" && !phaseEnded)
5864
5937
  return queueTransfer(client, deps.notify, s, target, cwd);
5865
5938
  const traceId = newTraceId();
@@ -5868,19 +5941,7 @@ async function transferSession(client, deps, { sessionId: id, target, cwd, phase
5868
5941
  );
5869
5942
  s.transfer = { target, stage: "snapshotting" };
5870
5943
  deps.notify();
5871
- const pushed = await snapshotOrFail(s, args, traceId);
5872
- if (!pushed.ok) {
5873
- s.transfer = { target, error: pushed.error };
5874
- deps.notify();
5875
- return refuse(client, id, pushed.error);
5876
- }
5877
- await handOffToTarget(client, deps, s, {
5878
- args,
5879
- target,
5880
- cwd,
5881
- traceId,
5882
- snapshot: pushed.snapshot
5883
- });
5944
+ await snapshotAndHandOff(client, deps, s, { plan, target, cwd, traceId });
5884
5945
  }
5885
5946
 
5886
5947
  // src/commands/sessions/daemon/transfer/runQueuedTransfer.ts
@@ -9365,15 +9426,15 @@ function sdkLaunchOpts(d, sessionId) {
9365
9426
  function launchSdkPhase(client, m, d) {
9366
9427
  const sessionId = String(d.sessionId);
9367
9428
  const { harness, label, drivenSession } = drivenLaunchTarget(d.harness);
9368
- const refuse2 = (reason6) => refuseSdkLaunch(client, sessionId, label, reason6);
9429
+ const refuse = (reason6) => refuseSdkLaunch(client, sessionId, label, reason6);
9369
9430
  if (!drivenSession)
9370
- return refuse2(
9431
+ return refuse(
9371
9432
  `named ${harness ?? "no harness"}, which does not run daemon-driven sessions`
9372
9433
  );
9373
9434
  const session = m.session(sessionId);
9374
9435
  const attach = session?.pty?.sdk?.attach;
9375
9436
  if (!attach)
9376
- return refuse2(
9437
+ return refuse(
9377
9438
  session ? "is not a driven workflow session" : "was not found"
9378
9439
  );
9379
9440
  const opts = sdkLaunchOpts(d, sessionId);
@@ -9384,7 +9445,7 @@ function launchSdkPhase(client, m, d) {
9384
9445
  try {
9385
9446
  query = drivenSession(opts);
9386
9447
  } catch (error) {
9387
- return refuse2(error instanceof Error ? error.message : String(error));
9448
+ return refuse(error instanceof Error ? error.message : String(error));
9388
9449
  }
9389
9450
  attach(query, !opts.prompt);
9390
9451
  linkWorkflowQuery(client, sessionId, query, () => {
@@ -10024,10 +10085,10 @@ function findSession(manager, id) {
10024
10085
  }
10025
10086
 
10026
10087
  // src/commands/sessions/daemon/handleFetchSessionTranscript.ts
10027
- import { readFile as readFile2 } from "fs/promises";
10088
+ import { readFile as readFile3 } from "fs/promises";
10028
10089
 
10029
10090
  // src/commands/sessions/daemon/readTranscriptEchoes.ts
10030
- import { readFile } from "fs/promises";
10091
+ import { readFile as readFile2 } from "fs/promises";
10031
10092
  function parseEcho(line) {
10032
10093
  try {
10033
10094
  const echo = JSON.parse(line);
@@ -10038,7 +10099,7 @@ function parseEcho(line) {
10038
10099
  }
10039
10100
  async function readTranscriptEchoes(conversationId) {
10040
10101
  try {
10041
- const raw = await readFile(transcriptEchoPath(conversationId), "utf8");
10102
+ const raw = await readFile2(transcriptEchoPath(conversationId), "utf8");
10042
10103
  return raw.split("\n").flatMap((line) => line.trim() ? parseEcho(line) : []);
10043
10104
  } catch {
10044
10105
  return [];
@@ -10053,7 +10114,7 @@ async function readMessages(session) {
10053
10114
  try {
10054
10115
  return transcriptMessages(
10055
10116
  conversation.reader,
10056
- (await readFile2(filePath, "utf8")).split("\n"),
10117
+ (await readFile3(filePath, "utf8")).split("\n"),
10057
10118
  await readTranscriptEchoes(conversation.id)
10058
10119
  );
10059
10120
  } catch {
@@ -10588,19 +10649,20 @@ async function restoreTransferSnapshot(path2, snapshot) {
10588
10649
  );
10589
10650
  }
10590
10651
 
10591
- // src/commands/sessions/daemon/transfer/spawnTransferredRun.ts
10592
- async function spawnTransferredRun(ctx, discard, { assistArgs, cwd, meta, snapshot, traceId }, context) {
10652
+ // src/commands/sessions/daemon/transfer/spawnRestored.ts
10653
+ async function spawnRestored(ctx, discard, { cwd, create, snapshot, traceId, inPlace, afterRestore }, context) {
10593
10654
  const trace = `trace=${traceId ?? "none"}`;
10594
10655
  const { id, prepared } = allocatePreparedAndBind(
10595
10656
  ctx,
10596
10657
  cwd,
10597
- (sid, resolvedCwd) => createAssistSession(sid, assistArgs, resolvedCwd, meta, true),
10658
+ create,
10598
10659
  async (path2) => {
10599
10660
  if (!path2) throw new Error("no working tree to restore into");
10600
10661
  daemonLog(`transfer restore ${path2}: fetching ${snapshot.ref} ${trace}`);
10601
10662
  await restoreTransferSnapshot(path2, snapshot);
10663
+ await afterRestore?.(path2);
10602
10664
  },
10603
- { inPlace: meta.inPlace },
10665
+ { inPlace },
10604
10666
  context
10605
10667
  );
10606
10668
  try {
@@ -10618,6 +10680,22 @@ async function spawnTransferredRun(ctx, discard, { assistArgs, cwd, meta, snapsh
10618
10680
  return id;
10619
10681
  }
10620
10682
 
10683
+ // src/commands/sessions/daemon/transfer/spawnTransferredRun.ts
10684
+ function spawnTransferredRun(ctx, discard, { assistArgs, cwd, meta, snapshot, traceId }, context) {
10685
+ return spawnRestored(
10686
+ ctx,
10687
+ discard,
10688
+ {
10689
+ cwd,
10690
+ create: (sid, resolvedCwd) => createAssistSession(sid, assistArgs, resolvedCwd, meta, true),
10691
+ snapshot,
10692
+ traceId,
10693
+ inPlace: meta.inPlace
10694
+ },
10695
+ context
10696
+ );
10697
+ }
10698
+
10621
10699
  // src/commands/sessions/daemon/worktree/prCheckoutNumber.ts
10622
10700
  var CHECKOUT_COMMANDS = /* @__PURE__ */ new Set([
10623
10701
  "review",
@@ -10706,8 +10784,85 @@ function sessionBlocker(harness, design) {
10706
10784
  );
10707
10785
  }
10708
10786
 
10787
+ // src/commands/sessions/daemon/transfer/placeClaudeTranscript.ts
10788
+ import { mkdir, writeFile } from "fs/promises";
10789
+ import { join as join7 } from "path";
10790
+ async function placeClaudeTranscript(conversation, cwd) {
10791
+ const dir = projectDirForCwd(cwd);
10792
+ const dest = join7(dir, `${conversation.id}.jsonl`);
10793
+ await mkdir(dir, { recursive: true });
10794
+ await writeFile(dest, conversation.transcript);
10795
+ daemonLog(
10796
+ `transcript ${conversation.id} placed at ${dest} so ${cwd} can resume it`
10797
+ );
10798
+ return dest;
10799
+ }
10800
+
10801
+ // src/commands/sessions/daemon/transfer/spawnTransferredConversation.ts
10802
+ function spawnTransferredConversation(ctx, discard, { cwd, conversation, snapshot, title, subtitle, traceId }, context) {
10803
+ return spawnRestored(
10804
+ ctx,
10805
+ discard,
10806
+ {
10807
+ cwd,
10808
+ create: (sid, resolvedCwd) => ({
10809
+ ...resumeSession(
10810
+ sid,
10811
+ conversation.id,
10812
+ resolvedCwd ?? cwd ?? "",
10813
+ title,
10814
+ true,
10815
+ "claude"
10816
+ ),
10817
+ title,
10818
+ subtitle
10819
+ }),
10820
+ snapshot,
10821
+ traceId,
10822
+ afterRestore: async (path2) => {
10823
+ await placeClaudeTranscript(conversation, path2);
10824
+ }
10825
+ },
10826
+ context
10827
+ );
10828
+ }
10829
+
10830
+ // src/commands/sessions/daemon/transfer/TransferredConversation.ts
10831
+ function parseTransferredConversation(value) {
10832
+ if (!value || typeof value !== "object") return void 0;
10833
+ const { id, transcript } = value;
10834
+ if (typeof id !== "string" || !id || typeof transcript !== "string")
10835
+ return void 0;
10836
+ return { id, transcript };
10837
+ }
10838
+
10839
+ // src/commands/sessions/daemon/transfer/spawnTransferredPrompt.ts
10840
+ function spawnTransferredPrompt(m, d) {
10841
+ const snapshot = parseTransferSnapshot(d.transfer);
10842
+ const conversation = parseTransferredConversation(d.conversation);
10843
+ if (!snapshot || !conversation) return void 0;
10844
+ daemonLog(
10845
+ `create: transferred conversation ${conversation.id} (cwd=${d.cwd ?? ""}) trace=${d.traceId ?? "none"}`
10846
+ );
10847
+ return spawnTransferredConversation(
10848
+ m.treeCtx(),
10849
+ m.discardSession,
10850
+ {
10851
+ cwd: d.cwd,
10852
+ conversation,
10853
+ snapshot,
10854
+ title: d.title,
10855
+ subtitle: d.subtitle,
10856
+ traceId: d.traceId
10857
+ },
10858
+ spawnContextFrom(d)
10859
+ );
10860
+ }
10861
+
10709
10862
  // src/commands/sessions/daemon/spawnCreate.ts
10710
10863
  function spawnCreate(m, d) {
10864
+ const transferred = spawnTransferredPrompt(m, d);
10865
+ if (transferred) return transferred;
10711
10866
  const design = d.design === true;
10712
10867
  const harness = d.harness;
10713
10868
  const prompt = d.prompt;
@@ -6,9 +6,9 @@ import {
6
6
  } from "./chunk-RFMBA6WA.js";
7
7
  import {
8
8
  awaitPreviewApproval
9
- } from "./chunk-YKONRK6A.js";
9
+ } from "./chunk-FGAFY5FV.js";
10
10
  import "./chunk-Y4C5PXGS.js";
11
- import "./chunk-MA7HTHHM.js";
11
+ import "./chunk-54ACF6SA.js";
12
12
  import "./chunk-3VDV7VHX.js";
13
13
  import {
14
14
  readRawConfigLayers
@@ -43,8 +43,8 @@ import "./chunk-XEHE4IC2.js";
43
43
  import "./chunk-EKKGNYON.js";
44
44
  import "./chunk-WPRXBDFP.js";
45
45
  import "./chunk-TBHJ7JDT.js";
46
- import "./chunk-QC6JEJEO.js";
47
- import "./chunk-2D3ZCQE3.js";
46
+ import "./chunk-VKMH4WCM.js";
47
+ import "./chunk-GMUBETSU.js";
48
48
  import "./chunk-XZSATLYY.js";
49
49
  import "./chunk-K4DJEFDZ.js";
50
50
  import "./chunk-D7UZLH36.js";
@@ -3,12 +3,12 @@ import {
3
3
  } from "./chunk-D6WBUFXT.js";
4
4
  import {
5
5
  executePhase
6
- } from "./chunk-QUHEM3YC.js";
7
- import "./chunk-BEVDTMKB.js";
6
+ } from "./chunk-FNEBHLRA.js";
7
+ import "./chunk-DZNGTNBE.js";
8
8
  import "./chunk-7NZOH4LN.js";
9
9
  import "./chunk-F7QYFJB2.js";
10
10
  import "./chunk-ZYK7V4PG.js";
11
- import "./chunk-BU6VFZP4.js";
11
+ import "./chunk-R75YUFD3.js";
12
12
  import "./chunk-3DNFNT2L.js";
13
13
  import "./chunk-7KDF6H4R.js";
14
14
  import {
@@ -28,9 +28,9 @@ import {
28
28
  import "./chunk-ZT3S2DV2.js";
29
29
  import {
30
30
  resolvePlan
31
- } from "./chunk-4TP22QIG.js";
32
- import "./chunk-B6XZ72DY.js";
33
- import "./chunk-N7MOTWGW.js";
31
+ } from "./chunk-5FOLBCWJ.js";
32
+ import "./chunk-XOCRMXTJ.js";
33
+ import "./chunk-7ORXMQKM.js";
34
34
  import "./chunk-6Z7XJJNZ.js";
35
35
  import {
36
36
  findOneItem,
@@ -50,19 +50,19 @@ import "./chunk-XEHE4IC2.js";
50
50
  import "./chunk-EKKGNYON.js";
51
51
  import "./chunk-WPRXBDFP.js";
52
52
  import "./chunk-TBHJ7JDT.js";
53
- import "./chunk-2PJELPWT.js";
54
- import "./chunk-6MXYEGDK.js";
53
+ import "./chunk-4KIWZE6L.js";
54
+ import "./chunk-AR4PXFLV.js";
55
55
  import {
56
56
  withoutResumeSession
57
- } from "./chunk-LADJTWTG.js";
57
+ } from "./chunk-EUCFTM2F.js";
58
58
  import "./chunk-MRUIXQXS.js";
59
59
  import "./chunk-YLQAQHRT.js";
60
60
  import "./chunk-HRQ7LBXR.js";
61
61
  import "./chunk-W7TRZLEM.js";
62
62
  import "./chunk-P26XSDFU.js";
63
63
  import "./chunk-IBPSXDUB.js";
64
- import "./chunk-QC6JEJEO.js";
65
- import "./chunk-2D3ZCQE3.js";
64
+ import "./chunk-VKMH4WCM.js";
65
+ import "./chunk-GMUBETSU.js";
66
66
  import "./chunk-XZSATLYY.js";
67
67
  import "./chunk-APZ6ZTDA.js";
68
68
  import "./chunk-K4DJEFDZ.js";