@staff0rd/assist 0.1024.1 → 0.1025.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.1024.1",
9
+ version: "0.1025.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -49671,6 +49671,31 @@ function startAutoUpdate(ctx) {
49671
49671
  );
49672
49672
  }
49673
49673
 
49674
+ // src/commands/sessions/daemon/worktree/treeUnderClose.ts
49675
+ function treeUnderClose(session) {
49676
+ if (session.worktree) return { path: session.worktree.path, removable: true };
49677
+ if (session.cwd) return { path: session.cwd, removable: false };
49678
+ return void 0;
49679
+ }
49680
+
49681
+ // src/commands/sessions/daemon/closeChildServerRuns.ts
49682
+ function isChildServerRun(child, parent) {
49683
+ if (!child.server || child.id === parent.id) return false;
49684
+ if (child.launchedFrom === parent.id) return true;
49685
+ return !!parent.worktree && treeUnderClose(child)?.path === parent.worktree.path;
49686
+ }
49687
+ function closeChildServerRuns(sessions, parentId, close) {
49688
+ const parent = sessions.get(parentId);
49689
+ if (!parent) return;
49690
+ const children = [...sessions.values()].filter(
49691
+ (s) => isChildServerRun(s, parent)
49692
+ );
49693
+ for (const child of children) {
49694
+ daemonLog(`closing server run ${child.id} with ${parentId}`);
49695
+ close(child.id);
49696
+ }
49697
+ }
49698
+
49674
49699
  // src/commands/sessions/daemon/setStatus.ts
49675
49700
  function setStatus2(session, newStatus) {
49676
49701
  const now = Date.now();
@@ -49928,13 +49953,6 @@ function reportUndeliveredPrompts(session, why) {
49928
49953
  }
49929
49954
  }
49930
49955
 
49931
- // src/commands/sessions/daemon/worktree/treeUnderClose.ts
49932
- function treeUnderClose(session) {
49933
- if (session.worktree) return { path: session.worktree.path, removable: true };
49934
- if (session.cwd) return { path: session.cwd, removable: false };
49935
- return void 0;
49936
- }
49937
-
49938
49956
  // src/commands/sessions/daemon/worktree/otherTreeHolders.ts
49939
49957
  function otherTreeHolders(sessions, session) {
49940
49958
  const tree = treeUnderClose(session)?.path;
@@ -50200,7 +50218,13 @@ function dismissSessionGated(sessions, id, notify2, discard = false) {
50200
50218
  }
50201
50219
 
50202
50220
  // src/commands/sessions/daemon/closeSession.ts
50203
- function closeSession(sessions, prPreview, notify2, id, discard) {
50221
+ function closeSession(sessions, prPreview, notify2, id, discard, { closeServerRuns = false } = {}) {
50222
+ if (closeServerRuns)
50223
+ closeChildServerRuns(
50224
+ sessions,
50225
+ id,
50226
+ (childId) => closeSession(sessions, prPreview, notify2, childId, false)
50227
+ );
50204
50228
  prPreview.closeAll(id, discard ? "session discarded" : "session dismissed");
50205
50229
  dismissSessionGated(sessions, id, notify2, discard);
50206
50230
  }
@@ -50277,6 +50301,11 @@ function flushPhaseActiveMs(session) {
50277
50301
  return chain2;
50278
50302
  }
50279
50303
 
50304
+ // src/commands/sessions/daemon/flushAllPhaseActiveMs.ts
50305
+ async function flushAllPhaseActiveMs(sessions) {
50306
+ await Promise.all([...sessions.values()].map((s) => flushPhaseActiveMs(s)));
50307
+ }
50308
+
50280
50309
  // src/commands/sessions/daemon/closeSessionPreviews.ts
50281
50310
  function closeSessionPreviews(session, waiters, reason4) {
50282
50311
  const previews = [session.pendingPrPreview, session.pendingShow].filter(
@@ -54671,11 +54700,7 @@ var SessionManager = class {
54671
54700
  this.shuttingDown = true;
54672
54701
  shutdownSessions(this.sessions);
54673
54702
  }
54674
- async flushActiveMs() {
54675
- await Promise.all(
54676
- [...this.sessions.values()].map((s) => flushPhaseActiveMs(s))
54677
- );
54678
- }
54703
+ flushActiveMs = () => flushAllPhaseActiveMs(this.sessions);
54679
54704
  restore() {
54680
54705
  return restoreAllSessions(this.spawner, {
54681
54706
  sessions: this.sessions,
@@ -54747,8 +54772,10 @@ var SessionManager = class {
54747
54772
  this.notify
54748
54773
  );
54749
54774
  }
54750
- dismissSession = (id) => {
54751
- closeSession(this.sessions, this.prPreview, this.notify, id, false);
54775
+ dismissSession = (id, closeServerRuns = false) => {
54776
+ closeSession(this.sessions, this.prPreview, this.notify, id, false, {
54777
+ closeServerRuns
54778
+ });
54752
54779
  };
54753
54780
  startAutoUpdate() {
54754
54781
  startAutoUpdate(() => this.treeCtx());
@@ -55335,6 +55362,18 @@ function handleCreateRun(client, m, d) {
55335
55362
  });
55336
55363
  }
55337
55364
 
55365
+ // src/commands/sessions/daemon/routed.ts
55366
+ function routed(local) {
55367
+ return (client, m, d) => {
55368
+ if (!m.links.route(client, d)) local(client, m, d);
55369
+ };
55370
+ }
55371
+
55372
+ // src/commands/sessions/daemon/handleDismiss.ts
55373
+ var handleDismiss = routed(
55374
+ (_client, m, d) => m.dismissSession(d.sessionId, d.closeServerRuns === true)
55375
+ );
55376
+
55338
55377
  // src/commands/sessions/daemon/handleOutputRequest.ts
55339
55378
  function resolveTarget3(m, d) {
55340
55379
  const server = d.server;
@@ -55370,6 +55409,13 @@ var handleOutputRequest = (client, m, d) => {
55370
55409
  );
55371
55410
  };
55372
55411
 
55412
+ // src/commands/sessions/daemon/handleReloadLinks.ts
55413
+ var handleReloadLinks = (client, m) => {
55414
+ daemonLog("reload-links received");
55415
+ m.links.reload();
55416
+ sendTo(client, { type: "ack" });
55417
+ };
55418
+
55373
55419
  // src/commands/sessions/daemon/handleSetStatus.ts
55374
55420
  function handleSetStatus(client, m, d) {
55375
55421
  daemonLog(
@@ -55488,13 +55534,6 @@ async function handleFetchUserMessages(client, manager, data) {
55488
55534
  sendTo(client, { type: "user-messages", sessionId, messages });
55489
55535
  }
55490
55536
 
55491
- // src/commands/sessions/daemon/routed.ts
55492
- function routed(local) {
55493
- return (client, m, d) => {
55494
- if (!m.links.route(client, d)) local(client, m, d);
55495
- };
55496
- }
55497
-
55498
55537
  // src/commands/sessions/daemon/lifecycleHandlers.ts
55499
55538
  async function handleHistory(client, manager) {
55500
55539
  const linked = manager.clients.isPeer(client) ? [] : manager.links.history();
@@ -55936,11 +55975,7 @@ var messageHandlers = {
55936
55975
  "auto-update-control": handleAutoUpdateControl,
55937
55976
  "search-history": (client, _m, d) => handleSearchHistory(client, d),
55938
55977
  ...inboxHandlers,
55939
- "reload-links": (client, m) => {
55940
- daemonLog("reload-links received");
55941
- m.links.reload();
55942
- sendTo(client, { type: "ack" });
55943
- },
55978
+ "reload-links": handleReloadLinks,
55944
55979
  create: creator(true, spawnCreate),
55945
55980
  "create-run": handleCreateRun,
55946
55981
  "create-assist": creator(true, spawnAssistCreate),
@@ -55980,7 +56015,7 @@ var messageHandlers = {
55980
56015
  if (!result.ok && result.reason)
55981
56016
  sendTo(client, { type: "error", message: result.reason });
55982
56017
  }),
55983
- dismiss: routed((_client, m, d) => m.dismissSession(d.sessionId)),
56018
+ dismiss: handleDismiss,
55984
56019
  discard: routed((_client, m, d) => m.discardSession(d.sessionId)),
55985
56020
  stop: routed((_client, m, d) => m.stopSession(d.sessionId)),
55986
56021
  transfer: handleTransfer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.1024.1",
3
+ "version": "0.1025.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {