@staff0rd/assist 0.546.1 → 0.547.1

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.1",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -16953,19 +16953,16 @@ function codexStatusFor(event, autoDecided) {
16953
16953
  return { status: "running", source: "prompt" };
16954
16954
  if (event === "PreToolUse") return { status: "running", source: "pretool" };
16955
16955
  if (event === "PostToolUse") return { status: "running", source: "posttool" };
16956
- if (event === "Stop") return { status: "waiting", source: "stop", ack: true };
16956
+ if (event === "Stop") return { status: "waiting", source: "stop" };
16957
16957
  if (event !== "PermissionRequest") return void 0;
16958
- return autoDecided ? { status: "running", source: "permission" } : { status: "waiting", source: "permission", ack: true };
16958
+ return autoDecided ? { status: "running", source: "permission" } : { status: "waiting", source: "permission" };
16959
16959
  }
16960
16960
 
16961
16961
  // src/commands/codexHook/reportCodexStatus.ts
16962
16962
  async function reportCodexStatus(event, autoDecided) {
16963
16963
  const report2 = codexStatusFor(event, autoDecided);
16964
16964
  if (!report2) return;
16965
- await setSessionStatus(report2.status, {
16966
- source: report2.source,
16967
- ack: report2.ack
16968
- });
16965
+ await setSessionStatus(report2.status, { source: report2.source, ack: true });
16969
16966
  }
16970
16967
 
16971
16968
  // src/commands/codexHook/index.ts
@@ -30452,6 +30449,17 @@ function toSessionRunInfo({
30452
30449
  };
30453
30450
  }
30454
30451
 
30452
+ // src/commands/sessions/daemon/worktree/joinRefusal.ts
30453
+ import { existsSync as existsSync68 } from "fs";
30454
+ function joinRefusal(session) {
30455
+ if (session.commandType === "run") return "a server run has no agent stream";
30456
+ if (session.closing === true) return "the session is closing";
30457
+ if (!session.cwd) return "the session has no working directory";
30458
+ if (!existsSync68(session.cwd))
30459
+ return "the session's workspace no longer exists";
30460
+ return void 0;
30461
+ }
30462
+
30455
30463
  // src/commands/sessions/daemon/toSessionInfo.ts
30456
30464
  function toSessionInfo(session) {
30457
30465
  const {
@@ -30496,7 +30504,8 @@ function toSessionInfo(session) {
30496
30504
  design,
30497
30505
  verifying,
30498
30506
  pendingPrPreview,
30499
- undurable
30507
+ undurable,
30508
+ joinable: joinRefusal(session) === void 0
30500
30509
  };
30501
30510
  }
30502
30511
 
@@ -30606,11 +30615,11 @@ function sessionBase(id, status3) {
30606
30615
  }
30607
30616
 
30608
30617
  // src/commands/sessions/daemon/spawnPty.ts
30609
- import { existsSync as existsSync69 } from "fs";
30618
+ import { existsSync as existsSync70 } from "fs";
30610
30619
  import * as pty from "node-pty";
30611
30620
 
30612
30621
  // src/commands/sessions/daemon/ensureSpawnHelperExecutable.ts
30613
- import { chmodSync, existsSync as existsSync68, statSync as statSync11 } from "fs";
30622
+ import { chmodSync, existsSync as existsSync69, statSync as statSync11 } from "fs";
30614
30623
  import { createRequire as createRequire3 } from "module";
30615
30624
  import path69 from "path";
30616
30625
  var require4 = createRequire3(import.meta.url);
@@ -30625,7 +30634,7 @@ function ensureSpawnHelperExecutable() {
30625
30634
  `${process.platform}-${process.arch}`,
30626
30635
  "spawn-helper"
30627
30636
  );
30628
- if (!existsSync68(helper)) return;
30637
+ if (!existsSync69(helper)) return;
30629
30638
  const mode = statSync11(helper).mode;
30630
30639
  if ((mode & 73) === 0) chmodSync(helper, mode | 493);
30631
30640
  }
@@ -30661,7 +30670,7 @@ function spawnPty(args, cwd, sessionId, extraEnv) {
30661
30670
  });
30662
30671
  }
30663
30672
  function refuseMissingCwd(cwd, sessionId) {
30664
- if (!cwd || existsSync69(cwd)) return;
30673
+ if (!cwd || existsSync70(cwd)) return;
30665
30674
  daemonLog(
30666
30675
  `${sessionId ? `session ${sessionId}` : "pty"} not spawned: working directory ${cwd} no longer exists`
30667
30676
  );
@@ -30830,11 +30839,11 @@ function setStatus2(session, newStatus) {
30830
30839
  }
30831
30840
 
30832
30841
  // src/commands/sessions/daemon/worktree/reapWorktree.ts
30833
- import { existsSync as existsSync71 } from "fs";
30842
+ import { existsSync as existsSync72 } from "fs";
30834
30843
  import { basename as basename20 } from "path";
30835
30844
 
30836
30845
  // src/commands/sessions/daemon/worktree/deleteStrandedTree.ts
30837
- import { existsSync as existsSync70 } from "fs";
30846
+ import { existsSync as existsSync71 } from "fs";
30838
30847
  import { join as join86 } from "path";
30839
30848
 
30840
30849
  // src/commands/sessions/daemon/worktree/deleteTreeDirectly.ts
@@ -30904,7 +30913,7 @@ async function deleteStrandedTree(clone, worktreePath, cause) {
30904
30913
  );
30905
30914
  }
30906
30915
  function strandedReason(worktreePath, cause) {
30907
- if (!existsSync70(join86(worktreePath, ".git")))
30916
+ if (!existsSync71(join86(worktreePath, ".git")))
30908
30917
  return "its .git link is already gone";
30909
30918
  if (/not a working tree|not a git repository/i.test(reason2(cause)))
30910
30919
  return "git no longer recognises it as a working tree";
@@ -30956,7 +30965,7 @@ function reason3(error) {
30956
30965
 
30957
30966
  // src/commands/sessions/daemon/worktree/reapWorktree.ts
30958
30967
  async function reapWorktree(worktreePath, force = false) {
30959
- if (!existsSync71(worktreePath)) {
30968
+ if (!existsSync72(worktreePath)) {
30960
30969
  forgetWorktree(worktreePath);
30961
30970
  daemonLog(
30962
30971
  `worktree ${worktreePath} already gone; its record was forgotten`
@@ -30981,7 +30990,7 @@ async function reapWorktree(worktreePath, force = false) {
30981
30990
  }
30982
30991
  function owningClone(worktreePath) {
30983
30992
  const recorded = worktreeAttributionIncludingReaped(worktreePath)?.clone;
30984
- if (recorded && existsSync71(recorded)) return recorded;
30993
+ if (recorded && existsSync72(recorded)) return recorded;
30985
30994
  const detected = mainWorktree(worktreePath);
30986
30995
  if (detected) return detected;
30987
30996
  daemonLog(
@@ -31109,12 +31118,12 @@ function closeGateApplies(sessions, session) {
31109
31118
  }
31110
31119
 
31111
31120
  // src/commands/sessions/daemon/worktree/watchGitState.ts
31112
- import { existsSync as existsSync72, watch } from "fs";
31121
+ import { existsSync as existsSync73, watch } from "fs";
31113
31122
  var DEBOUNCE_MS = 500;
31114
31123
  var POLL_MS = 3e4;
31115
31124
  function watchGitState(cwd, onChange) {
31116
31125
  const common = gitCommonDir(cwd);
31117
- if (!common || !existsSync72(common)) return void 0;
31126
+ if (!common || !existsSync73(common)) return void 0;
31118
31127
  const watchers = [
31119
31128
  watchGitDir(common, onChange),
31120
31129
  pollGitState(cwd, onChange)
@@ -31559,10 +31568,10 @@ function emitSessionOutput(session, clients, data) {
31559
31568
  }
31560
31569
 
31561
31570
  // src/commands/sessions/daemon/exitReason.ts
31562
- import { existsSync as existsSync73 } from "fs";
31571
+ import { existsSync as existsSync74 } from "fs";
31563
31572
  import { resolve as resolve20 } from "path";
31564
31573
  function exitDetail(session) {
31565
- if (session.cwd && !existsSync73(session.cwd))
31574
+ if (session.cwd && !existsSync74(session.cwd))
31566
31575
  return `working directory ${session.cwd} no longer exists`;
31567
31576
  return missingRunConfigCwd(session);
31568
31577
  }
@@ -31576,7 +31585,7 @@ function missingRunConfigCwd(session) {
31576
31585
  const config = resolveRunConfig(session.runName, dir);
31577
31586
  if (!config?.cwd) return void 0;
31578
31587
  const configured = resolve20(runConfigBaseDirFrom(dir), config.cwd);
31579
- if (existsSync73(configured)) return void 0;
31588
+ if (existsSync74(configured)) return void 0;
31580
31589
  return `run config "${config.name}": cwd ${configured} does not exist`;
31581
31590
  }
31582
31591
 
@@ -31617,7 +31626,7 @@ function handleFailedResume(session, exitCode, onStatusChange) {
31617
31626
  }
31618
31627
 
31619
31628
  // src/commands/sessions/daemon/watchActivity.ts
31620
- import { existsSync as existsSync74, mkdirSync as mkdirSync31, watch as watch2 } from "fs";
31629
+ import { existsSync as existsSync75, mkdirSync as mkdirSync31, watch as watch2 } from "fs";
31621
31630
  import { dirname as dirname37 } from "path";
31622
31631
 
31623
31632
  // src/commands/sessions/daemon/applyActivityToSession.ts
@@ -31703,7 +31712,7 @@ function watchActivity(session, notify2, onClaudeSessionId) {
31703
31712
  if (timer) clearTimeout(timer);
31704
31713
  timer = setTimeout(read, DEBOUNCE_MS2);
31705
31714
  });
31706
- if (existsSync74(path73)) read();
31715
+ if (existsSync75(path73)) read();
31707
31716
  }
31708
31717
  function refreshActivity(session) {
31709
31718
  if (session.commandType !== "assist" || !session.cwd) return;
@@ -33086,7 +33095,7 @@ function rearmStoppedSessions(sessions, notify2) {
33086
33095
  }
33087
33096
 
33088
33097
  // src/commands/sessions/daemon/worktree/reconcileWorktreesOnRestore.ts
33089
- import { existsSync as existsSync77 } from "fs";
33098
+ import { existsSync as existsSync78 } from "fs";
33090
33099
  import { basename as basename22 } from "path";
33091
33100
 
33092
33101
  // src/commands/sessions/daemon/worktree/accountedTrees.ts
@@ -33176,9 +33185,9 @@ function capped(lines2) {
33176
33185
  }
33177
33186
 
33178
33187
  // src/commands/sessions/daemon/worktree/reclaimVanishedWorktrees.ts
33179
- import { existsSync as existsSync76 } from "fs";
33188
+ import { existsSync as existsSync77 } from "fs";
33180
33189
  async function reclaimVanishedWorktrees(clone, paths) {
33181
- if (!existsSync76(clone)) {
33190
+ if (!existsSync77(clone)) {
33182
33191
  for (const { path: path73 } of paths) forgetWorktree(path73);
33183
33192
  daemonLog(
33184
33193
  `clone ${clone} is gone; forgot ${paths.length} worktree record(s) it owned`
@@ -33285,7 +33294,7 @@ async function recoverOrphanedWorktrees(sessions, spawnWith, notify2) {
33285
33294
  const accounted = accountedTrees(sessions);
33286
33295
  const vanished = /* @__PURE__ */ new Map();
33287
33296
  for (const { path: path73, clone } of readWorktreeRegistry()) {
33288
- if (!existsSync77(path73)) {
33297
+ if (!existsSync78(path73)) {
33289
33298
  logVanishedTree(sessions, path73);
33290
33299
  vanished.set(clone, [
33291
33300
  ...vanished.get(clone) ?? [],
@@ -33882,13 +33891,13 @@ async function defaultConnect() {
33882
33891
  }
33883
33892
 
33884
33893
  // src/commands/sessions/daemon/hasPersistedWindowsSessions.ts
33885
- import { existsSync as existsSync78, readFileSync as readFileSync55 } from "fs";
33894
+ import { existsSync as existsSync79, readFileSync as readFileSync55 } from "fs";
33886
33895
  import { posix } from "path";
33887
33896
  function hasPersistedWindowsSessions() {
33888
33897
  const sessionsFile = windowsSessionsFileFromWsl();
33889
33898
  if (!sessionsFile) return false;
33890
33899
  try {
33891
- if (!existsSync78(sessionsFile)) return false;
33900
+ if (!existsSync79(sessionsFile)) return false;
33892
33901
  const data = JSON.parse(readFileSync55(sessionsFile, "utf8"));
33893
33902
  return Array.isArray(data) && data.length > 0;
33894
33903
  } catch (error) {
@@ -34430,11 +34439,8 @@ var WindowsProxy = class {
34430
34439
  function joinableStream(sessions, targetId) {
34431
34440
  const target = sessions.get(targetId);
34432
34441
  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 };
34442
+ const reason4 = joinRefusal(target);
34443
+ return reason4 ? { reason: reason4 } : { session: target };
34438
34444
  }
34439
34445
 
34440
34446
  // src/commands/sessions/daemon/worktree/spawnIntoStream.ts
@@ -34468,7 +34474,7 @@ function addAgentToStream(ctx, targetId, prompt, harness) {
34468
34474
  }
34469
34475
 
34470
34476
  // src/commands/sessions/daemon/worktree/spawnInTree.ts
34471
- import { existsSync as existsSync81 } from "fs";
34477
+ import { existsSync as existsSync82 } from "fs";
34472
34478
 
34473
34479
  // src/commands/sessions/daemon/createAssistSession.ts
34474
34480
  function createAssistSession(id, assistArgs, cwd, meta, holdPty) {
@@ -34520,10 +34526,10 @@ function resumeSession(id, sessionId, cwd, name, holdPty) {
34520
34526
  }
34521
34527
 
34522
34528
  // src/commands/sessions/daemon/worktree/resumeInReplacementTree.ts
34523
- import { existsSync as existsSync80 } from "fs";
34529
+ import { existsSync as existsSync81 } from "fs";
34524
34530
 
34525
34531
  // src/commands/sessions/daemon/worktree/carryTranscriptToTree.ts
34526
- import { copyFileSync as copyFileSync7, existsSync as existsSync79, mkdirSync as mkdirSync33 } from "fs";
34532
+ import { copyFileSync as copyFileSync7, existsSync as existsSync80, mkdirSync as mkdirSync33 } from "fs";
34527
34533
  import { join as join88 } from "path";
34528
34534
  function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
34529
34535
  const dir = projectDirForCwd(toCwd);
@@ -34534,7 +34540,7 @@ function carryTranscriptToTree(claudeSessionId, fromCwd, toCwd) {
34534
34540
  return;
34535
34541
  }
34536
34542
  const dest = join88(dir, `${claudeSessionId}.jsonl`);
34537
- if (existsSync79(dest)) {
34543
+ if (existsSync80(dest)) {
34538
34544
  daemonLog(`transcript ${claudeSessionId} already present in ${dir}`);
34539
34545
  return;
34540
34546
  }
@@ -34578,7 +34584,7 @@ function resumeInReplacementTree(ctx, claudeSessionId, missingCwd, name) {
34578
34584
  }
34579
34585
  function cloneForReapedTree(missingCwd) {
34580
34586
  const clone = worktreeAttributionIncludingReaped(missingCwd)?.clone;
34581
- if (!clone || !existsSync80(clone))
34587
+ if (!clone || !existsSync81(clone))
34582
34588
  throw new Error(
34583
34589
  `working directory no longer exists and no clone is recorded to re-allocate from: ${missingCwd}`
34584
34590
  );
@@ -34612,7 +34618,7 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
34612
34618
  return id;
34613
34619
  }
34614
34620
  function resumeInTree(ctx, sessionId, cwd, name) {
34615
- if (!existsSync81(cwd))
34621
+ if (!existsSync82(cwd))
34616
34622
  return resumeInReplacementTree(ctx, sessionId, cwd, name);
34617
34623
  const id = ctx.spawnWith((sid) => resumeSession(sid, sessionId, cwd, name));
34618
34624
  daemonLog(`session ${id} resuming ${sessionId} in ${cwd}`);
@@ -34945,9 +34951,9 @@ function safeParse2(line) {
34945
34951
  }
34946
34952
 
34947
34953
  // src/commands/sessions/daemon/repoDirExists.ts
34948
- import { existsSync as existsSync82 } from "fs";
34954
+ import { existsSync as existsSync83 } from "fs";
34949
34955
  function repoDirExists(cwd) {
34950
- return existsSync82(toGitCwd(cwd));
34956
+ return existsSync83(toGitCwd(cwd));
34951
34957
  }
34952
34958
 
34953
34959
  // 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.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {