@staff0rd/assist 0.588.3 → 0.589.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.
|
|
9
|
+
version: "0.589.1",
|
|
10
10
|
type: "module",
|
|
11
11
|
main: "dist/index.js",
|
|
12
12
|
bin: {
|
|
@@ -8001,6 +8001,17 @@ function isAck(line) {
|
|
|
8001
8001
|
}
|
|
8002
8002
|
}
|
|
8003
8003
|
|
|
8004
|
+
// src/commands/sessions/readHookClaudeSessionId.ts
|
|
8005
|
+
async function readHookClaudeSessionId() {
|
|
8006
|
+
if (process.stdin.isTTY) return void 0;
|
|
8007
|
+
try {
|
|
8008
|
+
const data = JSON.parse(await readStdin());
|
|
8009
|
+
return data.session_id;
|
|
8010
|
+
} catch {
|
|
8011
|
+
return void 0;
|
|
8012
|
+
}
|
|
8013
|
+
}
|
|
8014
|
+
|
|
8004
8015
|
// src/commands/sessions/setSessionStatus.ts
|
|
8005
8016
|
var DELIVERY_ATTEMPTS = 3;
|
|
8006
8017
|
var RETRY_DELAY_MS = 100;
|
|
@@ -8008,16 +8019,22 @@ async function setSessionStatus(status3, opts = {}) {
|
|
|
8008
8019
|
const sessionId = process.env.ASSIST_SESSION_ID;
|
|
8009
8020
|
logHookFired(status3, sessionId, opts.source);
|
|
8010
8021
|
if (!sessionId) return;
|
|
8011
|
-
const payload = buildPayload(
|
|
8022
|
+
const payload = buildPayload(
|
|
8023
|
+
sessionId,
|
|
8024
|
+
status3,
|
|
8025
|
+
opts,
|
|
8026
|
+
await readHookClaudeSessionId()
|
|
8027
|
+
);
|
|
8012
8028
|
if (opts.ack) await deliverReliably(sessionId, status3, payload);
|
|
8013
8029
|
else await deliverBestEffort(sessionId, status3, payload);
|
|
8014
8030
|
}
|
|
8015
|
-
function buildPayload(sessionId, status3, opts) {
|
|
8031
|
+
function buildPayload(sessionId, status3, opts, claudeSessionId) {
|
|
8016
8032
|
const payload = {
|
|
8017
8033
|
type: "set-status",
|
|
8018
8034
|
sessionId,
|
|
8019
8035
|
status: status3
|
|
8020
8036
|
};
|
|
8037
|
+
if (claudeSessionId) payload.claudeSessionId = claudeSessionId;
|
|
8021
8038
|
if (opts.source) payload.source = opts.source;
|
|
8022
8039
|
if (opts.ack) payload.ack = true;
|
|
8023
8040
|
return payload;
|
|
@@ -35319,26 +35336,6 @@ function makeSessionSpawner(sessions, clients, counter, onStatusChange, notify2)
|
|
|
35319
35336
|
};
|
|
35320
35337
|
}
|
|
35321
35338
|
|
|
35322
|
-
// src/commands/sessions/daemon/applySetStatus.ts
|
|
35323
|
-
function applySetStatus(sessions, id, status3, source, onStatusChange) {
|
|
35324
|
-
const session = sessions.get(id);
|
|
35325
|
-
if (!session) {
|
|
35326
|
-
daemonLog(
|
|
35327
|
-
`set-status for unknown session id=${id} status=${status3} (no live session; ignoring)`
|
|
35328
|
-
);
|
|
35329
|
-
return;
|
|
35330
|
-
}
|
|
35331
|
-
if (session.status === "stopped") {
|
|
35332
|
-
daemonLog(
|
|
35333
|
-
`set-status for stopped session id=${id} status=${status3} (held pending durable close; ignoring)`
|
|
35334
|
-
);
|
|
35335
|
-
return;
|
|
35336
|
-
}
|
|
35337
|
-
if (source === "permission") session.permissionActive = true;
|
|
35338
|
-
if (status3 === "running") session.permissionActive = false;
|
|
35339
|
-
onStatusChange(session, status3);
|
|
35340
|
-
}
|
|
35341
|
-
|
|
35342
35339
|
// src/shared/db/recordPhaseCycleContext.ts
|
|
35343
35340
|
import { sql as sql21 } from "drizzle-orm";
|
|
35344
35341
|
async function recordPhaseCycleContext(db, itemId2, phaseIdx, window, resetsAt, pct) {
|
|
@@ -35616,6 +35613,55 @@ function makeStatusChangeHandler(sessions, dismiss, notify2, reuseForRun) {
|
|
|
35616
35613
|
);
|
|
35617
35614
|
}
|
|
35618
35615
|
|
|
35616
|
+
// src/commands/sessions/daemon/applySetStatus.ts
|
|
35617
|
+
function applySetStatus(sessions, id, status3, source, onStatusChange, rebind) {
|
|
35618
|
+
const session = sessions.get(id);
|
|
35619
|
+
if (!session) {
|
|
35620
|
+
daemonLog(
|
|
35621
|
+
`set-status for unknown session id=${id} status=${status3} (no live session; ignoring)`
|
|
35622
|
+
);
|
|
35623
|
+
return;
|
|
35624
|
+
}
|
|
35625
|
+
if (session.status === "stopped") {
|
|
35626
|
+
daemonLog(
|
|
35627
|
+
`set-status for stopped session id=${id} status=${status3} (held pending durable close; ignoring)`
|
|
35628
|
+
);
|
|
35629
|
+
return;
|
|
35630
|
+
}
|
|
35631
|
+
rebind?.(session);
|
|
35632
|
+
if (source === "permission") session.permissionActive = true;
|
|
35633
|
+
if (status3 === "running") session.permissionActive = false;
|
|
35634
|
+
onStatusChange(session, status3);
|
|
35635
|
+
}
|
|
35636
|
+
|
|
35637
|
+
// src/commands/sessions/daemon/rebindClaudeSession.ts
|
|
35638
|
+
function rebindClaudeSession(session, claudeSessionId, notify2, onStatusChange) {
|
|
35639
|
+
if (!claudeSessionId) return;
|
|
35640
|
+
if (session.claudeSessionId === claudeSessionId) return;
|
|
35641
|
+
daemonLog(
|
|
35642
|
+
`session ${session.id} claude session moved: ${session.claudeSessionId ?? "none"} -> ${claudeSessionId}`
|
|
35643
|
+
);
|
|
35644
|
+
session.claudeSessionId = claudeSessionId;
|
|
35645
|
+
watchTranscript(session, notify2, onStatusChange);
|
|
35646
|
+
}
|
|
35647
|
+
|
|
35648
|
+
// src/commands/sessions/daemon/setStatusFromHook.ts
|
|
35649
|
+
function setStatusFromHook(sessions, report2, notify2, onStatusChange) {
|
|
35650
|
+
applySetStatus(
|
|
35651
|
+
sessions,
|
|
35652
|
+
report2.id,
|
|
35653
|
+
report2.status,
|
|
35654
|
+
report2.source,
|
|
35655
|
+
onStatusChange,
|
|
35656
|
+
(session) => rebindClaudeSession(
|
|
35657
|
+
session,
|
|
35658
|
+
report2.claudeSessionId,
|
|
35659
|
+
notify2,
|
|
35660
|
+
onStatusChange
|
|
35661
|
+
)
|
|
35662
|
+
);
|
|
35663
|
+
}
|
|
35664
|
+
|
|
35619
35665
|
// src/commands/sessions/daemon/refuseSpawn.ts
|
|
35620
35666
|
function refuseSpawn(session, error, clients, onStatusChange, stage = "respawned") {
|
|
35621
35667
|
const reason4 = error instanceof Error ? error.message : String(error);
|
|
@@ -38059,8 +38105,8 @@ var SessionManager = class {
|
|
|
38059
38105
|
setStarred(id, starred) {
|
|
38060
38106
|
if (setStarred2(this.sessions, id, starred)) this.notify();
|
|
38061
38107
|
}
|
|
38062
|
-
setStatus(
|
|
38063
|
-
|
|
38108
|
+
setStatus(report2) {
|
|
38109
|
+
setStatusFromHook(this.sessions, report2, this.notify, this.onStatusChange);
|
|
38064
38110
|
}
|
|
38065
38111
|
/* why: the status line relays token totals keyed by Claude's session id; join
|
|
38066
38112
|
* it to the running backlog phase so the spend accumulates against that row. */
|
|
@@ -38173,11 +38219,12 @@ function handleSetStatus(client, m, d) {
|
|
|
38173
38219
|
`set-status received: id=${d.sessionId} status=${d.status}${d.source ? ` source=${d.source}` : ""}`
|
|
38174
38220
|
);
|
|
38175
38221
|
if (m.windowsProxy.route(client, d)) return;
|
|
38176
|
-
m.setStatus(
|
|
38177
|
-
d.sessionId,
|
|
38178
|
-
d.status,
|
|
38179
|
-
d.source
|
|
38180
|
-
|
|
38222
|
+
m.setStatus({
|
|
38223
|
+
id: d.sessionId,
|
|
38224
|
+
status: d.status,
|
|
38225
|
+
source: d.source,
|
|
38226
|
+
claudeSessionId: d.claudeSessionId
|
|
38227
|
+
});
|
|
38181
38228
|
if (d.ack) sendTo(client, { type: "ack", sessionId: d.sessionId });
|
|
38182
38229
|
}
|
|
38183
38230
|
|