@staff0rd/assist 0.1024.0 → 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.0",
9
+ version: "0.1025.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -25865,7 +25865,15 @@ var devEntryInputSchema = z15.object({
25865
25865
  }).strict().refine((entry) => datesWithinWeek(entry.week, entry.dates), {
25866
25866
  message: "first and last must be in order and within the week",
25867
25867
  path: ["dates"]
25868
- });
25868
+ }).refine(
25869
+ (entry) => entry.versions !== void 0 || [...entry.added, ...entry.changed, ...entry.fixed].every(
25870
+ (item) => item.version === void 0
25871
+ ),
25872
+ {
25873
+ message: "items must not have a version when versions is omitted",
25874
+ path: ["versions"]
25875
+ }
25876
+ );
25869
25877
 
25870
25878
  // src/commands/devlog/write/formatDevEntry.ts
25871
25879
  import { parse as parseYaml4, stringify as stringifyYaml4 } from "yaml";
@@ -49663,6 +49671,31 @@ function startAutoUpdate(ctx) {
49663
49671
  );
49664
49672
  }
49665
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
+
49666
49699
  // src/commands/sessions/daemon/setStatus.ts
49667
49700
  function setStatus2(session, newStatus) {
49668
49701
  const now = Date.now();
@@ -49920,13 +49953,6 @@ function reportUndeliveredPrompts(session, why) {
49920
49953
  }
49921
49954
  }
49922
49955
 
49923
- // src/commands/sessions/daemon/worktree/treeUnderClose.ts
49924
- function treeUnderClose(session) {
49925
- if (session.worktree) return { path: session.worktree.path, removable: true };
49926
- if (session.cwd) return { path: session.cwd, removable: false };
49927
- return void 0;
49928
- }
49929
-
49930
49956
  // src/commands/sessions/daemon/worktree/otherTreeHolders.ts
49931
49957
  function otherTreeHolders(sessions, session) {
49932
49958
  const tree = treeUnderClose(session)?.path;
@@ -50192,7 +50218,13 @@ function dismissSessionGated(sessions, id, notify2, discard = false) {
50192
50218
  }
50193
50219
 
50194
50220
  // src/commands/sessions/daemon/closeSession.ts
50195
- 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
+ );
50196
50228
  prPreview.closeAll(id, discard ? "session discarded" : "session dismissed");
50197
50229
  dismissSessionGated(sessions, id, notify2, discard);
50198
50230
  }
@@ -50269,6 +50301,11 @@ function flushPhaseActiveMs(session) {
50269
50301
  return chain2;
50270
50302
  }
50271
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
+
50272
50309
  // src/commands/sessions/daemon/closeSessionPreviews.ts
50273
50310
  function closeSessionPreviews(session, waiters, reason4) {
50274
50311
  const previews = [session.pendingPrPreview, session.pendingShow].filter(
@@ -54663,11 +54700,7 @@ var SessionManager = class {
54663
54700
  this.shuttingDown = true;
54664
54701
  shutdownSessions(this.sessions);
54665
54702
  }
54666
- async flushActiveMs() {
54667
- await Promise.all(
54668
- [...this.sessions.values()].map((s) => flushPhaseActiveMs(s))
54669
- );
54670
- }
54703
+ flushActiveMs = () => flushAllPhaseActiveMs(this.sessions);
54671
54704
  restore() {
54672
54705
  return restoreAllSessions(this.spawner, {
54673
54706
  sessions: this.sessions,
@@ -54739,8 +54772,10 @@ var SessionManager = class {
54739
54772
  this.notify
54740
54773
  );
54741
54774
  }
54742
- dismissSession = (id) => {
54743
- 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
+ });
54744
54779
  };
54745
54780
  startAutoUpdate() {
54746
54781
  startAutoUpdate(() => this.treeCtx());
@@ -55327,6 +55362,18 @@ function handleCreateRun(client, m, d) {
55327
55362
  });
55328
55363
  }
55329
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
+
55330
55377
  // src/commands/sessions/daemon/handleOutputRequest.ts
55331
55378
  function resolveTarget3(m, d) {
55332
55379
  const server = d.server;
@@ -55362,6 +55409,13 @@ var handleOutputRequest = (client, m, d) => {
55362
55409
  );
55363
55410
  };
55364
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
+
55365
55419
  // src/commands/sessions/daemon/handleSetStatus.ts
55366
55420
  function handleSetStatus(client, m, d) {
55367
55421
  daemonLog(
@@ -55480,13 +55534,6 @@ async function handleFetchUserMessages(client, manager, data) {
55480
55534
  sendTo(client, { type: "user-messages", sessionId, messages });
55481
55535
  }
55482
55536
 
55483
- // src/commands/sessions/daemon/routed.ts
55484
- function routed(local) {
55485
- return (client, m, d) => {
55486
- if (!m.links.route(client, d)) local(client, m, d);
55487
- };
55488
- }
55489
-
55490
55537
  // src/commands/sessions/daemon/lifecycleHandlers.ts
55491
55538
  async function handleHistory(client, manager) {
55492
55539
  const linked = manager.clients.isPeer(client) ? [] : manager.links.history();
@@ -55928,11 +55975,7 @@ var messageHandlers = {
55928
55975
  "auto-update-control": handleAutoUpdateControl,
55929
55976
  "search-history": (client, _m, d) => handleSearchHistory(client, d),
55930
55977
  ...inboxHandlers,
55931
- "reload-links": (client, m) => {
55932
- daemonLog("reload-links received");
55933
- m.links.reload();
55934
- sendTo(client, { type: "ack" });
55935
- },
55978
+ "reload-links": handleReloadLinks,
55936
55979
  create: creator(true, spawnCreate),
55937
55980
  "create-run": handleCreateRun,
55938
55981
  "create-assist": creator(true, spawnAssistCreate),
@@ -55972,7 +56015,7 @@ var messageHandlers = {
55972
56015
  if (!result.ok && result.reason)
55973
56016
  sendTo(client, { type: "error", message: result.reason });
55974
56017
  }),
55975
- dismiss: routed((_client, m, d) => m.dismissSession(d.sessionId)),
56018
+ dismiss: handleDismiss,
55976
56019
  discard: routed((_client, m, d) => m.discardSession(d.sessionId)),
55977
56020
  stop: routed((_client, m, d) => m.stopSession(d.sessionId)),
55978
56021
  transfer: handleTransfer,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.1024.0",
3
+ "version": "0.1025.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {