@staff0rd/assist 0.759.0 → 0.759.2
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/commands/sessions/web/bundle.js +400 -400
- package/dist/index.js +133 -70
- package/package.json +1 -1
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.759.
|
|
9
|
+
version: "0.759.2",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -40651,7 +40651,8 @@ function toSessionInfo(session) {
|
|
|
40651
40651
|
verifying,
|
|
40652
40652
|
pendingPrPreview,
|
|
40653
40653
|
undurable,
|
|
40654
|
-
lastUserMessage
|
|
40654
|
+
lastUserMessage,
|
|
40655
|
+
activeViewer
|
|
40655
40656
|
} = session;
|
|
40656
40657
|
return {
|
|
40657
40658
|
...toSessionRunInfo(session),
|
|
@@ -40677,6 +40678,7 @@ function toSessionInfo(session) {
|
|
|
40677
40678
|
pendingPrPreview,
|
|
40678
40679
|
undurable,
|
|
40679
40680
|
lastUserMessage,
|
|
40681
|
+
activeViewer,
|
|
40680
40682
|
joinable: joinRefusal(session) === void 0
|
|
40681
40683
|
};
|
|
40682
40684
|
}
|
|
@@ -40695,6 +40697,121 @@ function broadcastSessions(sessions, clients, linkedSessions = [], active) {
|
|
|
40695
40697
|
broadcast(peers, { type: "sessions", sessions: local, active: {} });
|
|
40696
40698
|
}
|
|
40697
40699
|
|
|
40700
|
+
// src/commands/sessions/daemon/claimViewer.ts
|
|
40701
|
+
function claimViewer(session, { viewerId, onClaim }, via) {
|
|
40702
|
+
if (!viewerId || session.activeViewer === viewerId) return;
|
|
40703
|
+
session.activeViewer = viewerId;
|
|
40704
|
+
daemonLog(`session ${session.id} active viewer ${viewerId} (${via})`);
|
|
40705
|
+
onClaim?.();
|
|
40706
|
+
}
|
|
40707
|
+
|
|
40708
|
+
// src/commands/sessions/daemon/nudgePty.ts
|
|
40709
|
+
var NUDGE_RESTORE_MS = 50;
|
|
40710
|
+
function nudgePty(session, resize) {
|
|
40711
|
+
const { cols, rows } = session;
|
|
40712
|
+
if (!cols || !rows || cols < 2) return;
|
|
40713
|
+
resize(cols - 1, rows);
|
|
40714
|
+
setTimeout(() => {
|
|
40715
|
+
if (session.cols === cols && session.rows === rows) resize(cols, rows);
|
|
40716
|
+
}, NUDGE_RESTORE_MS);
|
|
40717
|
+
}
|
|
40718
|
+
|
|
40719
|
+
// src/commands/sessions/daemon/resizeSession.ts
|
|
40720
|
+
function resizeSession(sessions, id, cols, rows, viewer = {}) {
|
|
40721
|
+
const s = sessions.get(id);
|
|
40722
|
+
if (!s || s.status === "done" || !s.pty) return;
|
|
40723
|
+
if (isInactiveViewer(s, viewer)) return;
|
|
40724
|
+
claimViewer(s, viewer, "resize");
|
|
40725
|
+
const unchanged = s.cols === cols && s.rows === rows;
|
|
40726
|
+
s.cols = cols;
|
|
40727
|
+
s.rows = rows;
|
|
40728
|
+
const resize = (c, r) => resizePty(s, c, r);
|
|
40729
|
+
resize(cols, rows);
|
|
40730
|
+
if (viewer.claim && unchanged) nudgePty(s, resize);
|
|
40731
|
+
}
|
|
40732
|
+
function isInactiveViewer(s, { viewerId, claim }) {
|
|
40733
|
+
if (claim || !viewerId || !s.activeViewer) return false;
|
|
40734
|
+
return s.activeViewer !== viewerId;
|
|
40735
|
+
}
|
|
40736
|
+
function resizePty(s, cols, rows) {
|
|
40737
|
+
try {
|
|
40738
|
+
s.pty?.resize(cols, rows);
|
|
40739
|
+
} catch (error) {
|
|
40740
|
+
daemonLog(
|
|
40741
|
+
`session ${s.id} resize skipped (dead pty): ${error instanceof Error ? error.message : String(error)}`
|
|
40742
|
+
);
|
|
40743
|
+
}
|
|
40744
|
+
}
|
|
40745
|
+
|
|
40746
|
+
// src/commands/sessions/daemon/watchPromptSubmit.ts
|
|
40747
|
+
var CARRIAGE_RETURN = "\r";
|
|
40748
|
+
function isPromptSubmit(data) {
|
|
40749
|
+
return data.includes(CARRIAGE_RETURN);
|
|
40750
|
+
}
|
|
40751
|
+
function watchPromptSubmit(session, data, onStatusChange) {
|
|
40752
|
+
if (session.restored !== true) return;
|
|
40753
|
+
if (session.status !== "waiting") return;
|
|
40754
|
+
if (!isPromptSubmit(data)) return;
|
|
40755
|
+
daemonLog(`session ${session.id} resumed-prompt submit -> running`);
|
|
40756
|
+
onStatusChange(session, "running");
|
|
40757
|
+
}
|
|
40758
|
+
|
|
40759
|
+
// src/commands/sessions/daemon/writeToSession.ts
|
|
40760
|
+
function writeToSession(sessions, id, data, onStatusChange, viewer = {}) {
|
|
40761
|
+
const s = sessions.get(id);
|
|
40762
|
+
if (!s || s.status === "done") return;
|
|
40763
|
+
s.pty?.write(data);
|
|
40764
|
+
watchPromptSubmit(s, data, onStatusChange);
|
|
40765
|
+
claimViewer(s, viewer, "input");
|
|
40766
|
+
}
|
|
40767
|
+
function setAutoRun(sessions, id, enabled) {
|
|
40768
|
+
const s = sessions.get(id);
|
|
40769
|
+
if (!s) return false;
|
|
40770
|
+
s.autoRun = enabled;
|
|
40771
|
+
daemonLog(`session ${id} autorun ${enabled ? "on" : "off"}`);
|
|
40772
|
+
return true;
|
|
40773
|
+
}
|
|
40774
|
+
function setStarred2(sessions, id, starred) {
|
|
40775
|
+
const s = sessions.get(id);
|
|
40776
|
+
if (!s) return false;
|
|
40777
|
+
s.starred = starred;
|
|
40778
|
+
daemonLog(`session ${id} starred ${starred ? "on" : "off"}`);
|
|
40779
|
+
return true;
|
|
40780
|
+
}
|
|
40781
|
+
function setAutoAdvance(sessions, id, enabled) {
|
|
40782
|
+
const s = sessions.get(id);
|
|
40783
|
+
if (!s) return false;
|
|
40784
|
+
s.autoAdvance = enabled;
|
|
40785
|
+
const itemId2 = s.activity?.itemId;
|
|
40786
|
+
if (itemId2 != null) {
|
|
40787
|
+
if (enabled) clearPause(itemId2);
|
|
40788
|
+
else requestPause(itemId2);
|
|
40789
|
+
}
|
|
40790
|
+
daemonLog(`session ${id} autoadvance ${enabled ? "on" : "off"}`);
|
|
40791
|
+
return true;
|
|
40792
|
+
}
|
|
40793
|
+
|
|
40794
|
+
// src/commands/sessions/daemon/SessionIo.ts
|
|
40795
|
+
var SessionIo = class {
|
|
40796
|
+
constructor(sessions, onStatusChange, notify2) {
|
|
40797
|
+
this.sessions = sessions;
|
|
40798
|
+
this.onStatusChange = onStatusChange;
|
|
40799
|
+
this.notify = notify2;
|
|
40800
|
+
}
|
|
40801
|
+
write(id, data, viewerId) {
|
|
40802
|
+
writeToSession(this.sessions, id, data, this.onStatusChange(), {
|
|
40803
|
+
viewerId,
|
|
40804
|
+
onClaim: this.notify
|
|
40805
|
+
});
|
|
40806
|
+
}
|
|
40807
|
+
resize(id, cols, rows, viewer) {
|
|
40808
|
+
resizeSession(this.sessions, id, cols, rows, {
|
|
40809
|
+
...viewer,
|
|
40810
|
+
onClaim: this.notify
|
|
40811
|
+
});
|
|
40812
|
+
}
|
|
40813
|
+
};
|
|
40814
|
+
|
|
40698
40815
|
// src/shared/activeWindows.ts
|
|
40699
40816
|
function activeWindows(rateLimits, harness) {
|
|
40700
40817
|
if (!rateLimits) return [];
|
|
@@ -45595,66 +45712,6 @@ function spawnAssistInTree(ctx, assistArgs, cwd, meta, context) {
|
|
|
45595
45712
|
return id;
|
|
45596
45713
|
}
|
|
45597
45714
|
|
|
45598
|
-
// src/commands/sessions/daemon/watchPromptSubmit.ts
|
|
45599
|
-
var CARRIAGE_RETURN = "\r";
|
|
45600
|
-
function isPromptSubmit(data) {
|
|
45601
|
-
return data.includes(CARRIAGE_RETURN);
|
|
45602
|
-
}
|
|
45603
|
-
function watchPromptSubmit(session, data, onStatusChange) {
|
|
45604
|
-
if (session.restored !== true) return;
|
|
45605
|
-
if (session.status !== "waiting") return;
|
|
45606
|
-
if (!isPromptSubmit(data)) return;
|
|
45607
|
-
daemonLog(`session ${session.id} resumed-prompt submit -> running`);
|
|
45608
|
-
onStatusChange(session, "running");
|
|
45609
|
-
}
|
|
45610
|
-
|
|
45611
|
-
// src/commands/sessions/daemon/writeToSession.ts
|
|
45612
|
-
function writeToSession(sessions, id, data, onStatusChange) {
|
|
45613
|
-
const s = sessions.get(id);
|
|
45614
|
-
if (!s || s.status === "done") return;
|
|
45615
|
-
s.pty?.write(data);
|
|
45616
|
-
watchPromptSubmit(s, data, onStatusChange);
|
|
45617
|
-
}
|
|
45618
|
-
function resizeSession(sessions, id, cols, rows) {
|
|
45619
|
-
const s = sessions.get(id);
|
|
45620
|
-
if (!s || s.status === "done" || !s.pty) return;
|
|
45621
|
-
s.cols = cols;
|
|
45622
|
-
s.rows = rows;
|
|
45623
|
-
try {
|
|
45624
|
-
s.pty.resize(cols, rows);
|
|
45625
|
-
} catch (error) {
|
|
45626
|
-
daemonLog(
|
|
45627
|
-
`session ${id} resize skipped (dead pty): ${error instanceof Error ? error.message : String(error)}`
|
|
45628
|
-
);
|
|
45629
|
-
}
|
|
45630
|
-
}
|
|
45631
|
-
function setAutoRun(sessions, id, enabled) {
|
|
45632
|
-
const s = sessions.get(id);
|
|
45633
|
-
if (!s) return false;
|
|
45634
|
-
s.autoRun = enabled;
|
|
45635
|
-
daemonLog(`session ${id} autorun ${enabled ? "on" : "off"}`);
|
|
45636
|
-
return true;
|
|
45637
|
-
}
|
|
45638
|
-
function setStarred2(sessions, id, starred) {
|
|
45639
|
-
const s = sessions.get(id);
|
|
45640
|
-
if (!s) return false;
|
|
45641
|
-
s.starred = starred;
|
|
45642
|
-
daemonLog(`session ${id} starred ${starred ? "on" : "off"}`);
|
|
45643
|
-
return true;
|
|
45644
|
-
}
|
|
45645
|
-
function setAutoAdvance(sessions, id, enabled) {
|
|
45646
|
-
const s = sessions.get(id);
|
|
45647
|
-
if (!s) return false;
|
|
45648
|
-
s.autoAdvance = enabled;
|
|
45649
|
-
const itemId2 = s.activity?.itemId;
|
|
45650
|
-
if (itemId2 != null) {
|
|
45651
|
-
if (enabled) clearPause(itemId2);
|
|
45652
|
-
else requestPause(itemId2);
|
|
45653
|
-
}
|
|
45654
|
-
daemonLog(`session ${id} autoadvance ${enabled ? "on" : "off"}`);
|
|
45655
|
-
return true;
|
|
45656
|
-
}
|
|
45657
|
-
|
|
45658
45715
|
// src/commands/sessions/daemon/worktree/resumeInTree.ts
|
|
45659
45716
|
import { existsSync as existsSync95 } from "fs";
|
|
45660
45717
|
|
|
@@ -45859,12 +45916,11 @@ var SessionManager = class {
|
|
|
45859
45916
|
this.treeCtx()
|
|
45860
45917
|
)
|
|
45861
45918
|
);
|
|
45862
|
-
|
|
45863
|
-
|
|
45864
|
-
|
|
45865
|
-
|
|
45866
|
-
|
|
45867
|
-
}
|
|
45919
|
+
io = new SessionIo(
|
|
45920
|
+
this.sessions,
|
|
45921
|
+
() => this.onStatusChange,
|
|
45922
|
+
() => this.notify()
|
|
45923
|
+
);
|
|
45868
45924
|
retrySession(id, replace = false) {
|
|
45869
45925
|
return runRetry(this.sessions, id, replace, {
|
|
45870
45926
|
clients: this.clients,
|
|
@@ -46482,10 +46538,17 @@ var messageHandlers = {
|
|
|
46482
46538
|
),
|
|
46483
46539
|
"codex-usage": handleCodexUsage,
|
|
46484
46540
|
input: routed(
|
|
46485
|
-
(_client, m, d) => m.
|
|
46541
|
+
(_client, m, d) => m.io.write(
|
|
46542
|
+
d.sessionId,
|
|
46543
|
+
d.data,
|
|
46544
|
+
d.viewerId
|
|
46545
|
+
)
|
|
46486
46546
|
),
|
|
46487
46547
|
resize: routed(
|
|
46488
|
-
(_client, m, d) => m.
|
|
46548
|
+
(_client, m, d) => m.io.resize(d.sessionId, d.cols, d.rows, {
|
|
46549
|
+
viewerId: d.viewerId,
|
|
46550
|
+
claim: d.claim === true
|
|
46551
|
+
})
|
|
46489
46552
|
),
|
|
46490
46553
|
retry: routed((client, m, d) => {
|
|
46491
46554
|
const conflict = m.retrySession(d.sessionId, d.replace === true);
|