@staff0rd/assist 0.1024.1 → 0.1025.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.1024.1",
9
+ version: "0.1025.1",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -25938,9 +25938,12 @@ function registerDevlogEntryCommands(devlogCommand) {
25938
25938
  "Show commits for the next completed ISO week after the last dev entry"
25939
25939
  ).option("-v, --verbose", "Show file names for each commit").action(next2);
25940
25940
  devlogCommand.command("skip <week>").description("Add an ISO week (YYYY-Www) to the skip list").action(skip2);
25941
- devlogCommand.command("write").description(
25942
- "Write a dev entry from JSON on stdin (week, title, versions, aiGenerated, added/changed/fixed, lede)"
25943
- ).action(write);
25941
+ internalCommand(
25942
+ devlogCommand.command("write").description(
25943
+ "Write a dev entry from JSON on stdin (week, title, versions, aiGenerated, added/changed/fixed, lede)"
25944
+ ).action(write),
25945
+ "/devlog"
25946
+ );
25944
25947
  }
25945
25948
 
25946
25949
  // src/commands/devlog/repos.ts
@@ -49671,6 +49674,31 @@ function startAutoUpdate(ctx) {
49671
49674
  );
49672
49675
  }
49673
49676
 
49677
+ // src/commands/sessions/daemon/worktree/treeUnderClose.ts
49678
+ function treeUnderClose(session) {
49679
+ if (session.worktree) return { path: session.worktree.path, removable: true };
49680
+ if (session.cwd) return { path: session.cwd, removable: false };
49681
+ return void 0;
49682
+ }
49683
+
49684
+ // src/commands/sessions/daemon/closeChildServerRuns.ts
49685
+ function isChildServerRun(child, parent) {
49686
+ if (!child.server || child.id === parent.id) return false;
49687
+ if (child.launchedFrom === parent.id) return true;
49688
+ return !!parent.worktree && treeUnderClose(child)?.path === parent.worktree.path;
49689
+ }
49690
+ function closeChildServerRuns(sessions, parentId, close) {
49691
+ const parent = sessions.get(parentId);
49692
+ if (!parent) return;
49693
+ const children = [...sessions.values()].filter(
49694
+ (s) => isChildServerRun(s, parent)
49695
+ );
49696
+ for (const child of children) {
49697
+ daemonLog(`closing server run ${child.id} with ${parentId}`);
49698
+ close(child.id);
49699
+ }
49700
+ }
49701
+
49674
49702
  // src/commands/sessions/daemon/setStatus.ts
49675
49703
  function setStatus2(session, newStatus) {
49676
49704
  const now = Date.now();
@@ -49928,13 +49956,6 @@ function reportUndeliveredPrompts(session, why) {
49928
49956
  }
49929
49957
  }
49930
49958
 
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
49959
  // src/commands/sessions/daemon/worktree/otherTreeHolders.ts
49939
49960
  function otherTreeHolders(sessions, session) {
49940
49961
  const tree = treeUnderClose(session)?.path;
@@ -50200,7 +50221,13 @@ function dismissSessionGated(sessions, id, notify2, discard = false) {
50200
50221
  }
50201
50222
 
50202
50223
  // src/commands/sessions/daemon/closeSession.ts
50203
- function closeSession(sessions, prPreview, notify2, id, discard) {
50224
+ function closeSession(sessions, prPreview, notify2, id, discard, { closeServerRuns = false } = {}) {
50225
+ if (closeServerRuns)
50226
+ closeChildServerRuns(
50227
+ sessions,
50228
+ id,
50229
+ (childId) => closeSession(sessions, prPreview, notify2, childId, false)
50230
+ );
50204
50231
  prPreview.closeAll(id, discard ? "session discarded" : "session dismissed");
50205
50232
  dismissSessionGated(sessions, id, notify2, discard);
50206
50233
  }
@@ -50277,6 +50304,11 @@ function flushPhaseActiveMs(session) {
50277
50304
  return chain2;
50278
50305
  }
50279
50306
 
50307
+ // src/commands/sessions/daemon/flushAllPhaseActiveMs.ts
50308
+ async function flushAllPhaseActiveMs(sessions) {
50309
+ await Promise.all([...sessions.values()].map((s) => flushPhaseActiveMs(s)));
50310
+ }
50311
+
50280
50312
  // src/commands/sessions/daemon/closeSessionPreviews.ts
50281
50313
  function closeSessionPreviews(session, waiters, reason4) {
50282
50314
  const previews = [session.pendingPrPreview, session.pendingShow].filter(
@@ -54671,11 +54703,7 @@ var SessionManager = class {
54671
54703
  this.shuttingDown = true;
54672
54704
  shutdownSessions(this.sessions);
54673
54705
  }
54674
- async flushActiveMs() {
54675
- await Promise.all(
54676
- [...this.sessions.values()].map((s) => flushPhaseActiveMs(s))
54677
- );
54678
- }
54706
+ flushActiveMs = () => flushAllPhaseActiveMs(this.sessions);
54679
54707
  restore() {
54680
54708
  return restoreAllSessions(this.spawner, {
54681
54709
  sessions: this.sessions,
@@ -54747,8 +54775,10 @@ var SessionManager = class {
54747
54775
  this.notify
54748
54776
  );
54749
54777
  }
54750
- dismissSession = (id) => {
54751
- closeSession(this.sessions, this.prPreview, this.notify, id, false);
54778
+ dismissSession = (id, closeServerRuns = false) => {
54779
+ closeSession(this.sessions, this.prPreview, this.notify, id, false, {
54780
+ closeServerRuns
54781
+ });
54752
54782
  };
54753
54783
  startAutoUpdate() {
54754
54784
  startAutoUpdate(() => this.treeCtx());
@@ -55335,6 +55365,18 @@ function handleCreateRun(client, m, d) {
55335
55365
  });
55336
55366
  }
55337
55367
 
55368
+ // src/commands/sessions/daemon/routed.ts
55369
+ function routed(local) {
55370
+ return (client, m, d) => {
55371
+ if (!m.links.route(client, d)) local(client, m, d);
55372
+ };
55373
+ }
55374
+
55375
+ // src/commands/sessions/daemon/handleDismiss.ts
55376
+ var handleDismiss = routed(
55377
+ (_client, m, d) => m.dismissSession(d.sessionId, d.closeServerRuns === true)
55378
+ );
55379
+
55338
55380
  // src/commands/sessions/daemon/handleOutputRequest.ts
55339
55381
  function resolveTarget3(m, d) {
55340
55382
  const server = d.server;
@@ -55370,6 +55412,13 @@ var handleOutputRequest = (client, m, d) => {
55370
55412
  );
55371
55413
  };
55372
55414
 
55415
+ // src/commands/sessions/daemon/handleReloadLinks.ts
55416
+ var handleReloadLinks = (client, m) => {
55417
+ daemonLog("reload-links received");
55418
+ m.links.reload();
55419
+ sendTo(client, { type: "ack" });
55420
+ };
55421
+
55373
55422
  // src/commands/sessions/daemon/handleSetStatus.ts
55374
55423
  function handleSetStatus(client, m, d) {
55375
55424
  daemonLog(
@@ -55488,13 +55537,6 @@ async function handleFetchUserMessages(client, manager, data) {
55488
55537
  sendTo(client, { type: "user-messages", sessionId, messages });
55489
55538
  }
55490
55539
 
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
55540
  // src/commands/sessions/daemon/lifecycleHandlers.ts
55499
55541
  async function handleHistory(client, manager) {
55500
55542
  const linked = manager.clients.isPeer(client) ? [] : manager.links.history();
@@ -55936,11 +55978,7 @@ var messageHandlers = {
55936
55978
  "auto-update-control": handleAutoUpdateControl,
55937
55979
  "search-history": (client, _m, d) => handleSearchHistory(client, d),
55938
55980
  ...inboxHandlers,
55939
- "reload-links": (client, m) => {
55940
- daemonLog("reload-links received");
55941
- m.links.reload();
55942
- sendTo(client, { type: "ack" });
55943
- },
55981
+ "reload-links": handleReloadLinks,
55944
55982
  create: creator(true, spawnCreate),
55945
55983
  "create-run": handleCreateRun,
55946
55984
  "create-assist": creator(true, spawnAssistCreate),
@@ -55980,7 +56018,7 @@ var messageHandlers = {
55980
56018
  if (!result.ok && result.reason)
55981
56019
  sendTo(client, { type: "error", message: result.reason });
55982
56020
  }),
55983
- dismiss: routed((_client, m, d) => m.dismissSession(d.sessionId)),
56021
+ dismiss: handleDismiss,
55984
56022
  discard: routed((_client, m, d) => m.discardSession(d.sessionId)),
55985
56023
  stop: routed((_client, m, d) => m.stopSession(d.sessionId)),
55986
56024
  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.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {