@staff0rd/assist 0.546.1 → 0.547.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.546.1",
9
+ version: "0.547.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -30452,6 +30452,17 @@ function toSessionRunInfo({
30452
30452
  };
30453
30453
  }
30454
30454
 
30455
+ // src/commands/sessions/daemon/worktree/joinRefusal.ts
30456
+ import { existsSync as existsSync68 } from "fs";
30457
+ function joinRefusal(session) {
30458
+ if (session.commandType === "run") return "a server run has no agent stream";
30459
+ if (session.closing === true) return "the session is closing";
30460
+ if (!session.cwd) return "the session has no working directory";
30461
+ if (!existsSync68(session.cwd))
30462
+ return "the session's workspace no longer exists";
30463
+ return void 0;
30464
+ }
30465
+
30455
30466
  // src/commands/sessions/daemon/toSessionInfo.ts
30456
30467
  function toSessionInfo(session) {
30457
30468
  const {
@@ -30496,7 +30507,8 @@ function toSessionInfo(session) {
30496
30507
  design,
30497
30508
  verifying,
30498
30509
  pendingPrPreview,
30499
- undurable
30510
+ undurable,
30511
+ joinable: joinRefusal(session) === void 0
30500
30512
  };
30501
30513
  }
30502
30514
 
@@ -30606,11 +30618,11 @@ function sessionBase(id, status3) {
30606
30618
  }
30607
30619
 
30608
30620
  // src/commands/sessions/daemon/spawnPty.ts
30609
- import { existsSync as existsSync69 } from "fs";
30621
+ import { existsSync as existsSync70 } from "fs";
30610
30622
  import * as pty from "node-pty";
30611
30623
 
30612
30624
  // src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
30613
- import { chmodSync, existsSync as existsSync68, statSync as statSync11 } from "fs";
30625
+ import { chmodSync, existsSync as existsSync69, statSync as statSync11 } from "fs";
30614
30626
  import { createRequire as createRequire3 } from "module";
30615
30627
  import path69 from "path";
30616
30628
  var require4 = createRequire3(import.meta.url);
@@ -30625,7 +30637,7 @@ function ensureSpawnHelperExecutable() {
30625
30637
  `${process.platform}-${process.arch}`,
30626
30638
  "spawn-helper"
30627
30639
  );
30628
- if (!existsSync68(helper)) return;
30640
+ if (!existsSync69(helper)) return;
30629
30641
  const mode = statSync11(helper).mode;
30630
30642
  if ((mode & 73) === 0) chmodSync(helper, mode | 493);
30631
30643
  }
@@ -30661,7 +30673,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
30661
30673
  });
30662
30674
  }
30663
30675
  function refuseMissingCwd(cwd, sessionId) {
30664
- if (!cwd || existsSync69(cwd)) return;
30676
+ if (!cwd || existsSync70(cwd)) return;
30665
30677
  daemonLog(
30666
30678
  `${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
30667
30679
  );
@@ -30830,11 +30842,11 @@ function setStatus2(session, newStatus) {
30830
30842
  }
30831
30843
 
30832
30844
  // src/commands/sessions/daemon/worktree/reapWorktree.ts
30833
- import { existsSync as existsSync71 } from "fs";
30845
+ import { existsSync as existsSync72 } from "fs";
30834
30846
  import { basename as basename20 } from "path";
30835
30847
 
30836
30848
  // src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
30837
- import { existsSync as existsSync70 } from "fs";
30849
+ import { existsSync as existsSync71 } from "fs";
30838
30850
  import { join as join86 } from "path";
30839
30851
 
30840
30852
  // src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
@@ -30904,7 +30916,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
30904
30916
  );
30905
30917
  }
30906
30918
  function strandedReason(worktreePath, cause) {
30907
- if (!existsSync70(join86(worktreePath, ".git")))
30919
+ if (!existsSync71(join86(worktreePath, ".git")))
30908
30920
  return "its .git link is already gone";
30909
30921
  if (/not a working tree|not a git repository/i.test(reason2(cause)))
30910
30922
  return "git no longer recognises it as a working tree";
@@ -30956,7 +30968,7 @@ function reason3(error) {
30956
30968
 
30957
30969
  // src/commands/sessions/daemon/worktree/reapWorktree.ts
30958
30970
  async function reapWorktree(worktreePath, force = false) {
30959
- if (!existsSync71(worktreePath)) {
30971
+ if (!existsSync72(worktreePath)) {
30960
30972
  forgetWorktree(worktreePath);
30961
30973
  daemonLog(
30962
30974
  `worktree ${worktreePath} already gone; its record was forgotten`
@@ -30981,7 +30993,7 @@ async function reapWorktree(worktreePath, force = false) {
30981
30993
  }
30982
30994
  function owningClone(worktreePath) {
30983
30995
  const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
30984
- if (recorded && existsSync71(recorded)) return recorded;
30996
+ if (recorded && existsSync72(recorded)) return recorded;
30985
30997
  const detected = mainWorktree(worktreePath);
30986
30998
  if (detected) return detected;
30987
30999
  daemonLog(
@@ -31109,12 +31121,12 @@ function closeGateApplies(sessions, session) {
31109
31121
  }
31110
31122
 
31111
31123
  // src/commands/sessions/daemon/worktree/watchGitState.ts
31112
- import { existsSync as existsSync72, watch } from "fs";
31124
+ import { existsSync as existsSync73, watch } from "fs";
31113
31125
  var DEBOUNCE_MS = 500;
31114
31126
  var POLL_MS = 3e4;
31115
31127
  function watchGitState(cwd, onChange) {
31116
31128
  const common = gitCommonDir(cwd);
31117
- if (!common || !existsSync72(common)) return void 0;
31129
+ if (!common || !existsSync73(common)) return void 0;
31118
31130
  const watchers = [
31119
31131
  watchGitDir(common, onChange),
31120
31132
  pollGitState(cwd, onChange)
@@ -31559,10 +31571,10 @@ function emitSessionOutput(session, clients, data) {
31559
31571
  }
31560
31572
 
31561
31573
  // src/commands/sessions/daemon/exitReason.ts
31562
- import { existsSync as existsSync73 } from "fs";
31574
+ import { existsSync as existsSync74 } from "fs";
31563
31575
  import { resolve as resolve20 } from "path";
31564
31576
  function exitDetail(session) {
31565
- if (session.cwd && !existsSync73(session.cwd))
31577
+ if (session.cwd && !existsSync74(session.cwd))
31566
31578
  return `working directory ${session.cwd} no longer exists`;
31567
31579
  return missingRunConfigCwd(session);
31568
31580
  }
@@ -31576,7 +31588,7 @@ function missingRunConfigCwd(session) {
31576
31588
  const config = resolveRunConfig(session.runName, dir);
31577
31589
  if (!config?.cwd) return void 0;
31578
31590
  const configured = resolve20(runConfigBaseDirFrom(dir), config.cwd);
31579
- if (existsSync73(configured)) return void 0;
31591
+ if (existsSync74(configured)) return void 0;
31580
31592
  return `run config "${config.name}": cwd ${configured} does not exist`;
31581
31593
  }
31582
31594
 
@@ -31617,7 +31629,7 @@ function handleFailedResume(session, exitCode, onStatusChange) {
31617
31629
  }
31618
31630
 
31619
31631
  // src/commands/sessions/daemon/watchActivity.ts
31620
- import { existsSync as existsSync74, mkdirSync as mkdirSync31, watch as watch2 } from "fs";
31632
+ import { existsSync as existsSync75, mkdirSync as mkdirSync31, watch as watch2 } from "fs";
31621
31633
  import { dirname as dirname37 } from "path";
31622
31634
 
31623
31635
  // src/commands/sessions/daemon/applyActivityToSession.ts
@@ -31703,7 +31715,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
31703
31715
  if (timer) clearTimeout(timer);
31704
31716
  timer = setTimeout(read, DEBOUNCE_MS2);
31705
31717
  });
31706
- if (existsSync74(path73)) read();
31718
+ if (existsSync75(path73)) read();
31707
31719
  }
31708
31720
  function refreshActivity(session) {
31709
31721
  if (session.commandType !== "assist" || !session.cwd) return;
@@ -33086,7 +33098,7 @@ function rearmStoppedSessions(sessions, notify2) {
33086
33098
  }
33087
33099
 
33088
33100
  // src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
33089
- import { existsSync as existsSync77 } from "fs";
33101
+ import { existsSync as existsSync78 } from "fs";
33090
33102
  import { basename as basename22 } from "path";
33091
33103
 
33092
33104
  // src/commands/sessions/daemon/worktree/accountedTrees.ts
@@ -33176,9 +33188,9 @@ function capped(lines2) {
33176
33188
  }
33177
33189
 
33178
33190
  // src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
33179
- import { existsSync as existsSync76 } from "fs";
33191
+ import { existsSync as existsSync77 } from "fs";
33180
33192
  async function reclaimVanishedWorktrees(clone, paths) {
33181
- if (!existsSync76(clone)) {
33193
+ if (!existsSync77(clone)) {
33182
33194
  for (const { path: path73 } of paths) forgetWorktree(path73);
33183
33195
  daemonLog(
33184
33196
  `clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
@@ -33285,7 +33297,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
33285
33297
  const accounted = accountedTrees(sessions);
33286
33298
  const vanished = /* @__PURE__ */ new Map();
33287
33299
  for (const { path: path73, clone } of readWorktreeRegistry()) {
33288
- if (!existsSync77(path73)) {
33300
+ if (!existsSync78(path73)) {
33289
33301
  logVanishedTree(sessions, path73);
33290
33302
  vanished.set(clone, [
33291
33303
  ...vanished.get(clone) ?? [],
@@ -33882,13 +33894,13 @@ async function defaultConnect() {
33882
33894
  }
33883
33895
 
33884
33896
  // src/commands/sessions/daemon/hasPersistedWindowsSessions.ts
33885
- import { existsSync as existsSync78, readFileSync as readFileSync55 } from "fs";
33897
+ import { existsSync as existsSync79, readFileSync as readFileSync55 } from "fs";
33886
33898
  import { posix } from "path";
33887
33899
  function hasPersistedWindowsSessions() {
33888
33900
  const sessionsFile = windowsSessionsFileFromWsl();
33889
33901
  if (!sessionsFile) return false;
33890
33902
  try {
33891
- if (!existsSync78(sessionsFile)) return false;
33903
+ if (!existsSync79(sessionsFile)) return false;
33892
33904
  const data = JSON.parse(readFileSync55(sessionsFile, "utf8"));
33893
33905
  return Array.isArray(data) && data.length > 0;
33894
33906
  } catch (error) {
@@ -34430,11 +34442,8 @@ var WindowsProxy = class {
34430
34442
  function joinableStream(sessions, targetId) {
34431
34443
  const target = sessions.get(targetId);
34432
34444
  if (!target) return { reason: "no such session" };
34433
- if (target.commandType === "run")
34434
- return { reason: "a server run has no agent stream" };
34435
- if (target.closing === true) return { reason: "the session is closing" };
34436
- if (!target.cwd) return { reason: "the session has no working directory" };
34437
- return { session: target };
34445
+ const reason4 = joinRefusal(target);
34446
+ return reason4 ? { reason: reason4 } : { session: target };
34438
34447
  }
34439
34448
 
34440
34449
  // src/commands/sessions/daemon/worktree/spawnIntoStream.ts
@@ -34468,7 +34477,7 @@ function addAgentToStream(ctx, targetId, prompt, harness) {
34468
34477
  }
34469
34478
 
34470
34479
  // src/commands/sessions/daemon/worktree/spawnInTree.ts
34471
- import { existsSync as existsSync81 } from "fs";
34480
+ import { existsSync as existsSync82 } from "fs";
34472
34481
 
34473
34482
  // src/commands/sessions/daemon/createAssistSession.ts
34474
34483
  function createAssistSession(id, assistArgs, cwd, meta, holdPty) {
@@ -34520,10 +34529,10 @@ function resumeSession(id, sessionId, cwd, name, holdPty) {
34520
34529
  }
34521
34530
 
34522
34531
  // src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
34523
- import { existsSync as existsSync80 } from "fs";
34532
+ import { existsSync as existsSync81 } from "fs";
34524
34533
 
34525
34534
  // src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
34526
- import { copyFileSync as copyFileSync7, existsSync as existsSync79, mkdirSync as mkdirSync33 } from "fs";
34535
+ import { copyFileSync as copyFileSync7, existsSync as existsSync80, mkdirSync as mkdirSync33 } from "fs";
34527
34536
  import { join as join88 } from "path";
34528
34537
  function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
34529
34538
  const dir = projectDirForCwd(toCwd);
@@ -34534,7 +34543,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
34534
34543
  return;
34535
34544
  }
34536
34545
  const dest = join88(dir, `${claudeSessionId}.jsonl`);
34537
- if (existsSync79(dest)) {
34546
+ if (existsSync80(dest)) {
34538
34547
  daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
34539
34548
  return;
34540
34549
  }
@@ -34578,7 +34587,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name) {
34578
34587
  }
34579
34588
  function cloneForReapedTree(missingCwd) {
34580
34589
  const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
34581
- if (!clone || !existsSync80(clone))
34590
+ if (!clone || !existsSync81(clone))
34582
34591
  throw new Error(
34583
34592
  `working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
34584
34593
  );
@@ -34612,7 +34621,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
34612
34621
  return id;
34613
34622
  }
34614
34623
  function resumeInTree(ctx, sessionId, cwd, name) {
34615
- if (!existsSync81(cwd))
34624
+ if (!existsSync82(cwd))
34616
34625
  return resumeInReplacementTree(ctx, sessionId, cwd, name);
34617
34626
  const id = ctx.spawnWith((sid) => resumeSession(sid, sessionId, cwd, name));
34618
34627
  daemonLog(`session ${id} resuming ${sessionId} in ${cwd}`);
@@ -34945,9 +34954,9 @@ function safeParse2(line) {
34945
34954
  }
34946
34955
 
34947
34956
  // src/commands/sessions/daemon/repoDirExists.ts
34948
- import { existsSync as existsSync82 } from "fs";
34957
+ import { existsSync as existsSync83 } from "fs";
34949
34958
  function repoDirExists(cwd) {
34950
- return existsSync82(toGitCwd(cwd));
34959
+ return existsSync83(toGitCwd(cwd));
34951
34960
  }
34952
34961
 
34953
34962
  // src/commands/sessions/daemon/withRepoGroups.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.546.1",
3
+ "version": "0.547.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {