@threadbase-sh/streamer 1.69.5 → 1.69.6
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/api/handlers/sessions.handlers.d.ts +1 -0
- package/dist/api/handlers/sessions.handlers.d.ts.map +1 -1
- package/dist/cli.cjs +19 -8
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +19 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +19 -8
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -10002,6 +10002,13 @@ var SessionHandlers = class {
|
|
|
10002
10002
|
get sessionSubscribers() {
|
|
10003
10003
|
return this.deps.sessionSubscribers;
|
|
10004
10004
|
}
|
|
10005
|
+
// Prompt lifecycle events (question / permission and their cancellations)
|
|
10006
|
+
// carry prompt content and go ONLY to the session's subscribers — never to
|
|
10007
|
+
// every connected socket. A client that subscribes after a prompt opened
|
|
10008
|
+
// gets it from the subscribe replay (server-wiring), not from a broadcast.
|
|
10009
|
+
broadcastToSession(sessionId, message) {
|
|
10010
|
+
this.wsHub.broadcastToClients(this.sessionSubscribers.get(sessionId) ?? [], message);
|
|
10011
|
+
}
|
|
10005
10012
|
get agentConfig() {
|
|
10006
10013
|
return this.deps.agentConfig;
|
|
10007
10014
|
}
|
|
@@ -10556,7 +10563,7 @@ var SessionHandlers = class {
|
|
|
10556
10563
|
const toolUseId = `screen:${sessionId}:${key.length}`;
|
|
10557
10564
|
this.pendingQuestions.set(sessionId, { toolUseId, questions, origin: "pty" });
|
|
10558
10565
|
this.pendingQuestionKey.set(sessionId, key);
|
|
10559
|
-
this.
|
|
10566
|
+
this.broadcastToSession(sessionId, { type: "question", sessionId, toolUseId, questions });
|
|
10560
10567
|
}
|
|
10561
10568
|
// Permission gate opened/closed (OSC 777 + scraped options). Broadcasts the
|
|
10562
10569
|
// additive `permission` / `permission_cancelled` events. Mobile answers by
|
|
@@ -10566,7 +10573,7 @@ var SessionHandlers = class {
|
|
|
10566
10573
|
if (!this.pendingPermission.has(sessionId)) return;
|
|
10567
10574
|
this.pendingPermission.delete(sessionId);
|
|
10568
10575
|
this.pendingPermissionKey.delete(sessionId);
|
|
10569
|
-
this.
|
|
10576
|
+
this.broadcastToSession(sessionId, { type: "permission_cancelled", sessionId });
|
|
10570
10577
|
return;
|
|
10571
10578
|
}
|
|
10572
10579
|
const key = permissionContentKey(gate);
|
|
@@ -10580,7 +10587,7 @@ var SessionHandlers = class {
|
|
|
10580
10587
|
`[ws.broadcast_permission] ${sessionId.slice(0, 8)} subscribers=${subscriberCount}`,
|
|
10581
10588
|
{ event: "ws.broadcast_permission", sessionId, subscriberCount }
|
|
10582
10589
|
);
|
|
10583
|
-
this.
|
|
10590
|
+
this.broadcastToSession(sessionId, {
|
|
10584
10591
|
type: "permission",
|
|
10585
10592
|
sessionId,
|
|
10586
10593
|
...gate.prompt ? { prompt: gate.prompt } : {},
|
|
@@ -10628,7 +10635,7 @@ var SessionHandlers = class {
|
|
|
10628
10635
|
const gateClosed = () => {
|
|
10629
10636
|
this.pendingPermission.delete(sessionId);
|
|
10630
10637
|
this.pendingPermissionKey.delete(sessionId);
|
|
10631
|
-
this.
|
|
10638
|
+
this.broadcastToSession(sessionId, { type: "permission_cancelled", sessionId });
|
|
10632
10639
|
json(res, 409, { ok: false, reason: "gate_closed" });
|
|
10633
10640
|
};
|
|
10634
10641
|
const gate = this.pendingPermission.get(sessionId);
|
|
@@ -10714,7 +10721,7 @@ var SessionHandlers = class {
|
|
|
10714
10721
|
if (!await this.questionMenuStillOpen(sessionId)) {
|
|
10715
10722
|
this.pendingQuestions.delete(sessionId);
|
|
10716
10723
|
this.pendingQuestionKey.delete(sessionId);
|
|
10717
|
-
this.
|
|
10724
|
+
this.broadcastToSession(sessionId, { type: "question_cancelled", sessionId, toolUseId });
|
|
10718
10725
|
json(res, 409, { ok: false, reason: "question_gone" });
|
|
10719
10726
|
return;
|
|
10720
10727
|
}
|
|
@@ -10726,7 +10733,7 @@ var SessionHandlers = class {
|
|
|
10726
10733
|
return;
|
|
10727
10734
|
}
|
|
10728
10735
|
this.pendingQuestions.delete(sessionId);
|
|
10729
|
-
this.
|
|
10736
|
+
this.broadcastToSession(sessionId, { type: "question_cancelled", sessionId, toolUseId });
|
|
10730
10737
|
json(res, 200, { ok: true });
|
|
10731
10738
|
}
|
|
10732
10739
|
// Best-effort: a session we don't own a PTY for, or one that raced away
|
|
@@ -17836,7 +17843,7 @@ var StreamerServer = class {
|
|
|
17836
17843
|
priorToolUseId
|
|
17837
17844
|
});
|
|
17838
17845
|
this.pendingQuestionKey.set(sessionId, key);
|
|
17839
|
-
if (broadcast) this.wsHub.
|
|
17846
|
+
if (broadcast) this.wsHub.broadcastToClients(this.sessionSubscribers.get(sessionId) ?? [], m);
|
|
17840
17847
|
}
|
|
17841
17848
|
}
|
|
17842
17849
|
cancelPendingQuestion(sessionId) {
|
|
@@ -17844,7 +17851,11 @@ var StreamerServer = class {
|
|
|
17844
17851
|
if (!pq) return;
|
|
17845
17852
|
this.pendingQuestions.delete(sessionId);
|
|
17846
17853
|
this.pendingQuestionKey.delete(sessionId);
|
|
17847
|
-
this.wsHub.
|
|
17854
|
+
this.wsHub.broadcastToClients(this.sessionSubscribers.get(sessionId) ?? [], {
|
|
17855
|
+
type: "question_cancelled",
|
|
17856
|
+
sessionId,
|
|
17857
|
+
toolUseId: pq.toolUseId
|
|
17858
|
+
});
|
|
17848
17859
|
}
|
|
17849
17860
|
async handleBrowse(url, res) {
|
|
17850
17861
|
if (!this.browseRoot) {
|