@staff0rd/assist 0.1003.0 → 0.1004.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.1003.0",
9
+ version: "0.1004.1",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -53,6 +53,7 @@ var package_default = {
53
53
  url: "https://github.com/staff0rd/assist"
54
54
  },
55
55
  dependencies: {
56
+ "@capacitor/app": "^8.1.2",
56
57
  "@xterm/addon-fit": "^0.11.0",
57
58
  "@xterm/addon-serialize": "^0.14.0",
58
59
  "@xterm/addon-webgl": "^0.19.0",
@@ -8221,7 +8222,7 @@ function allowAppOrigin(req, res, pathname) {
8221
8222
  res.setHeader("Access-Control-Allow-Origin", origin);
8222
8223
  res.setHeader("Vary", "Origin");
8223
8224
  if (req.method !== "OPTIONS") return false;
8224
- res.setHeader("Access-Control-Allow-Methods", "GET, POST");
8225
+ res.setHeader("Access-Control-Allow-Methods", "GET, POST, PATCH, DELETE");
8225
8226
  res.setHeader(
8226
8227
  "Access-Control-Allow-Headers",
8227
8228
  req.headers["access-control-request-headers"] ?? "Content-Type"
@@ -49423,6 +49424,12 @@ function dismissSessionGated(sessions, id, notify2, discard = false) {
49423
49424
  settle();
49424
49425
  }
49425
49426
 
49427
+ // src/commands/sessions/daemon/closeSession.ts
49428
+ function closeSession(sessions, prPreview, notify2, id, discard) {
49429
+ prPreview.closeAll(id, discard ? "session discarded" : "session dismissed");
49430
+ dismissSessionGated(sessions, id, notify2, discard);
49431
+ }
49432
+
49426
49433
  // src/commands/sessions/daemon/drainSessions.ts
49427
49434
  function drainSessions(sessions, notify2) {
49428
49435
  const drained = [...sessions.values()].map((s) => ({
@@ -49495,6 +49502,31 @@ function flushPhaseActiveMs(session) {
49495
49502
  return chain2;
49496
49503
  }
49497
49504
 
49505
+ // src/commands/sessions/daemon/closeSessionPreviews.ts
49506
+ function closeSessionPreviews(session, waiters, reason4) {
49507
+ const previews = [session.pendingPrPreview, session.pendingShow].filter(
49508
+ (p) => p !== void 0
49509
+ );
49510
+ const waiter = waiters.get(session.id);
49511
+ const blocking = session.pendingPrPreview;
49512
+ if (waiter && blocking && blocking.kind !== "show")
49513
+ sendTo(waiter, {
49514
+ type: "pr-decision",
49515
+ requestId: blocking.requestId,
49516
+ decision: "reject",
49517
+ reason: reason4,
49518
+ dismissed: true
49519
+ });
49520
+ waiters.delete(session.id);
49521
+ session.pendingPrPreview = void 0;
49522
+ session.pendingShow = void 0;
49523
+ for (const p of previews)
49524
+ daemonLog(
49525
+ `pr-preview closed: id=${session.id} requestId=${p.requestId} kind=${p.kind ?? "pr"} (${reason4})`
49526
+ );
49527
+ return previews.length > 0;
49528
+ }
49529
+
49498
49530
  // src/commands/sessions/daemon/logPrDecision.ts
49499
49531
  function count9(value) {
49500
49532
  return Array.isArray(value) ? value.length : 0;
@@ -49736,6 +49768,11 @@ var PrPreviewCoordinator = class {
49736
49768
  decide(d) {
49737
49769
  decidePrPreview(this.sessions, this.waiters, this.notify, d);
49738
49770
  }
49771
+ closeAll(id, reason4) {
49772
+ const session = this.sessions.get(id);
49773
+ if (session && closeSessionPreviews(session, this.waiters, reason4))
49774
+ this.notify();
49775
+ }
49739
49776
  clearWaiter(client) {
49740
49777
  for (const [id, waiter] of this.waiters) {
49741
49778
  if (waiter !== client) continue;
@@ -53597,13 +53634,13 @@ var SessionManager = class {
53597
53634
  );
53598
53635
  }
53599
53636
  dismissSession = (id) => {
53600
- dismissSessionGated(this.sessions, id, this.notify);
53637
+ closeSession(this.sessions, this.prPreview, this.notify, id, false);
53601
53638
  };
53602
53639
  startAutoUpdate() {
53603
53640
  startAutoUpdate(() => this.treeCtx());
53604
53641
  }
53605
53642
  discardSession = (id) => {
53606
- dismissSessionGated(this.sessions, id, this.notify, true);
53643
+ closeSession(this.sessions, this.prPreview, this.notify, id, true);
53607
53644
  };
53608
53645
  stopSession(id) {
53609
53646
  stopServerSession(this.sessions, id);
@@ -54845,7 +54882,7 @@ function registerDaemon(program) {
54845
54882
  }
54846
54883
 
54847
54884
  // src/commands/sessions/closeSession.ts
54848
- async function closeSession() {
54885
+ async function closeSession2() {
54849
54886
  if (!inWebSession()) {
54850
54887
  console.log("No daemon-managed session to close.");
54851
54888
  return;
@@ -55443,7 +55480,7 @@ function registerSessions(program) {
55443
55480
  internalCommand(
55444
55481
  cmd.command("close").description(
55445
55482
  "Dismiss the current daemon-managed session, ending it and reaping its worktree"
55446
- ).action(closeSession),
55483
+ ).action(closeSession2),
55447
55484
  "/close"
55448
55485
  );
55449
55486
  internalCommand(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.1003.0",
3
+ "version": "0.1004.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -47,6 +47,7 @@
47
47
  "url": "https://github.com/staff0rd/assist"
48
48
  },
49
49
  "dependencies": {
50
+ "@capacitor/app": "^8.1.2",
50
51
  "@xterm/addon-fit": "^0.11.0",
51
52
  "@xterm/addon-serialize": "^0.14.0",
52
53
  "@xterm/addon-webgl": "^0.19.0",