@staff0rd/assist 0.1139.3 → 0.1140.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.1139.3",
9
+ version: "0.1140.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -56564,6 +56564,29 @@ var ActiveSelection = class {
56564
56564
  }
56565
56565
  };
56566
56566
 
56567
+ // src/commands/sessions/daemon/mergeNodeSessions.ts
56568
+ function mergeNodeSessions(local, linked) {
56569
+ const byNode2 = /* @__PURE__ */ new Map([
56570
+ [void 0, [...local]]
56571
+ ]);
56572
+ for (const session of linked) {
56573
+ const list7 = byNode2.get(session.node);
56574
+ if (list7) list7.push(session);
56575
+ else byNode2.set(session.node, [session]);
56576
+ }
56577
+ const queues = [...byNode2.values()];
56578
+ const merged = [];
56579
+ for (; ; ) {
56580
+ let next3;
56581
+ for (const queue of queues) {
56582
+ if (queue.length === 0) continue;
56583
+ if (!next3 || queue[0].startedAt < next3[0].startedAt) next3 = queue;
56584
+ }
56585
+ if (!next3) return merged;
56586
+ merged.push(next3.shift());
56587
+ }
56588
+ }
56589
+
56567
56590
  // src/commands/sessions/shared/promptIssueRef.ts
56568
56591
  var issuePrompt = /^Issue ([^\s#]+\/[^\s#]+)#(\d+):/;
56569
56592
  var issueUrlPrompt = /^https?:\/\/(?:www\.)?github\.com\/([^\s/#?]+\/[^\s/#?]+)\/issues\/(\d+)(?![^\s?#])/;
@@ -56744,7 +56767,7 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
56744
56767
  type: "sessions",
56745
56768
  restartActivity,
56746
56769
  lastUserActivityAt: clients.userActivity.get(),
56747
- sessions: local.concat(linkedSessions),
56770
+ sessions: mergeNodeSessions(local, linkedSessions),
56748
56771
  active: active?.toJSON() ?? {}
56749
56772
  });
56750
56773
  const peers = new Set([...clients].filter((c) => !viewers.has(c)));
@@ -63442,7 +63465,7 @@ var SessionManager = class {
63442
63465
  hasSession = (id) => this.sessions.has(id);
63443
63466
  session = (id) => this.sessions.get(id);
63444
63467
  localSessions = () => [...this.sessions.values()].map(toSessionInfo);
63445
- listSessions = () => this.localSessions().concat(this.links.sessions());
63468
+ listSessions = () => mergeNodeSessions(this.localSessions(), this.links.sessions());
63446
63469
  notify = () => {
63447
63470
  if (this.shuttingDown) return;
63448
63471
  const linked = this.links.sessions();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.1139.3",
3
+ "version": "0.1140.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {