@staff0rd/assist 0.298.1 → 0.299.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/commands/sessions/web/bundle.js +68 -59
- package/dist/index.js +62 -12
- 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.
|
|
9
|
+
version: "0.299.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -18517,6 +18517,7 @@ function toSessionInfo({
|
|
|
18517
18517
|
assistArgs,
|
|
18518
18518
|
cwd,
|
|
18519
18519
|
restored,
|
|
18520
|
+
error,
|
|
18520
18521
|
activity: activity2,
|
|
18521
18522
|
autoRun,
|
|
18522
18523
|
autoAdvance
|
|
@@ -18532,6 +18533,7 @@ function toSessionInfo({
|
|
|
18532
18533
|
assistArgs,
|
|
18533
18534
|
cwd,
|
|
18534
18535
|
restored,
|
|
18536
|
+
error,
|
|
18535
18537
|
activity: activity2,
|
|
18536
18538
|
autoRun,
|
|
18537
18539
|
autoAdvance
|
|
@@ -18722,12 +18724,6 @@ function makeStatusChangeHandler(dismiss, notify2, reuseForRun) {
|
|
|
18722
18724
|
return (s, status2, exitCode) => applyStatusChange(s, status2, exitCode, dismiss, notify2, reuseForRun);
|
|
18723
18725
|
}
|
|
18724
18726
|
|
|
18725
|
-
// src/commands/sessions/daemon/backlogRunArgs.ts
|
|
18726
|
-
function backlogRunArgs(persisted) {
|
|
18727
|
-
const args = ["assist", ...persisted.assistArgs];
|
|
18728
|
-
return persisted.claudeSessionId ? [...args, "--resume-session", persisted.claudeSessionId] : args;
|
|
18729
|
-
}
|
|
18730
|
-
|
|
18731
18727
|
// src/commands/sessions/daemon/restoreBase.ts
|
|
18732
18728
|
function restoreBase(id2, persisted) {
|
|
18733
18729
|
return {
|
|
@@ -18742,6 +18738,26 @@ function restoreBase(id2, persisted) {
|
|
|
18742
18738
|
};
|
|
18743
18739
|
}
|
|
18744
18740
|
|
|
18741
|
+
// src/commands/sessions/daemon/errorSession.ts
|
|
18742
|
+
function errorSession(id2, persisted, error) {
|
|
18743
|
+
return {
|
|
18744
|
+
...restoreBase(id2, persisted),
|
|
18745
|
+
status: "error",
|
|
18746
|
+
startedAt: persisted.startedAt,
|
|
18747
|
+
pty: null,
|
|
18748
|
+
runName: persisted.runName,
|
|
18749
|
+
runArgs: persisted.runArgs,
|
|
18750
|
+
error,
|
|
18751
|
+
restored: false
|
|
18752
|
+
};
|
|
18753
|
+
}
|
|
18754
|
+
|
|
18755
|
+
// src/commands/sessions/daemon/backlogRunArgs.ts
|
|
18756
|
+
function backlogRunArgs(persisted) {
|
|
18757
|
+
const args = ["assist", ...persisted.assistArgs];
|
|
18758
|
+
return persisted.claudeSessionId ? [...args, "--resume-session", persisted.claudeSessionId] : args;
|
|
18759
|
+
}
|
|
18760
|
+
|
|
18745
18761
|
// src/commands/sessions/daemon/runningSession.ts
|
|
18746
18762
|
function runningSession(base, persisted, pty2) {
|
|
18747
18763
|
return {
|
|
@@ -18769,6 +18785,13 @@ function restoreSession(id2, persisted) {
|
|
|
18769
18785
|
});
|
|
18770
18786
|
return runningSession(base, persisted, pty2);
|
|
18771
18787
|
}
|
|
18788
|
+
if (persisted.commandType === "claude") {
|
|
18789
|
+
return errorSession(
|
|
18790
|
+
id2,
|
|
18791
|
+
persisted,
|
|
18792
|
+
"no claude session id was recorded before the daemon stopped, so the conversation cannot be resumed"
|
|
18793
|
+
);
|
|
18794
|
+
}
|
|
18772
18795
|
return {
|
|
18773
18796
|
...base,
|
|
18774
18797
|
status: "done",
|
|
@@ -18783,6 +18806,28 @@ function isBacklogRun(persisted) {
|
|
|
18783
18806
|
return persisted.commandType === "assist" && persisted.assistArgs?.[0] === "backlog" && persisted.assistArgs?.[1] === "run";
|
|
18784
18807
|
}
|
|
18785
18808
|
|
|
18809
|
+
// src/commands/sessions/daemon/restoreOne.ts
|
|
18810
|
+
function restoreOne(persisted, spawn12, sessions) {
|
|
18811
|
+
try {
|
|
18812
|
+
const id2 = spawn12((sid) => restoreSession(sid, persisted));
|
|
18813
|
+
logUnresumable(persisted.name, id2, sessions.get(id2));
|
|
18814
|
+
} catch (error) {
|
|
18815
|
+
const reason = logRestoreError(persisted.name, error);
|
|
18816
|
+
spawn12((id2) => errorSession(id2, persisted, reason));
|
|
18817
|
+
}
|
|
18818
|
+
}
|
|
18819
|
+
function logUnresumable(name, id2, session) {
|
|
18820
|
+
if (session?.status === "error")
|
|
18821
|
+
daemonLog(
|
|
18822
|
+
`could not resume restored session "${name}" (id ${id2}): ${session.error}`
|
|
18823
|
+
);
|
|
18824
|
+
}
|
|
18825
|
+
function logRestoreError(name, error) {
|
|
18826
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
18827
|
+
daemonLog(`failed to restore session "${name}": ${reason}`);
|
|
18828
|
+
return reason;
|
|
18829
|
+
}
|
|
18830
|
+
|
|
18786
18831
|
// src/commands/sessions/daemon/resumeSession.ts
|
|
18787
18832
|
function resumeSession(id2, sessionId, cwd, name) {
|
|
18788
18833
|
return {
|
|
@@ -18874,7 +18919,14 @@ function wirePtyEvents(session, clients, onStatusChange) {
|
|
|
18874
18919
|
session.pty.onExit(({ exitCode }) => {
|
|
18875
18920
|
clearIdle(session);
|
|
18876
18921
|
refreshActivity(session);
|
|
18877
|
-
|
|
18922
|
+
const failedResume = session.restored === true && exitCode !== 0 && session.scrollback.length === 0;
|
|
18923
|
+
if (failedResume) {
|
|
18924
|
+
session.error = `resume process exited with code ${exitCode} before producing any output`;
|
|
18925
|
+
daemonLog(
|
|
18926
|
+
`could not resume restored session "${session.name}" (id ${session.id}): ${session.error}`
|
|
18927
|
+
);
|
|
18928
|
+
}
|
|
18929
|
+
onStatusChange(session, failedResume ? "error" : "done", exitCode);
|
|
18878
18930
|
});
|
|
18879
18931
|
scheduleIdle(session, () => onStatusChange(session, "waiting"));
|
|
18880
18932
|
}
|
|
@@ -19778,7 +19830,7 @@ var SessionManager = class {
|
|
|
19778
19830
|
}
|
|
19779
19831
|
restore() {
|
|
19780
19832
|
return loadPersistedSessions().map((persisted) => {
|
|
19781
|
-
this.spawnWith
|
|
19833
|
+
restoreOne(persisted, this.spawnWith, this.sessions);
|
|
19782
19834
|
return persisted.name;
|
|
19783
19835
|
});
|
|
19784
19836
|
}
|
|
@@ -19788,9 +19840,7 @@ var SessionManager = class {
|
|
|
19788
19840
|
watchActivity(session, this.notify);
|
|
19789
19841
|
return session.id;
|
|
19790
19842
|
}
|
|
19791
|
-
spawnWith(create)
|
|
19792
|
-
return this.add(create(String(this.nextId++)));
|
|
19793
|
-
}
|
|
19843
|
+
spawnWith = (create) => this.add(create(String(this.nextId++)));
|
|
19794
19844
|
spawn(prompt, cwd) {
|
|
19795
19845
|
return this.spawnWith((id2) => createSession(id2, prompt, cwd));
|
|
19796
19846
|
}
|