@kybernesis/buzz 0.9.8 → 0.9.9
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/turn.d.ts +11 -1
- package/dist/turn.js +24 -1
- package/package.json +1 -1
package/dist/turn.d.ts
CHANGED
|
@@ -101,5 +101,15 @@ export declare function answerTurn(client: Client, sessions: SessionStore, chann
|
|
|
101
101
|
*/
|
|
102
102
|
export declare function isSessionGone(error: unknown): boolean;
|
|
103
103
|
export declare function rejectedTurnReply(error: unknown): string | null;
|
|
104
|
-
/**
|
|
104
|
+
/**
|
|
105
|
+
* Give the originating channel one accurate recovery message for bridge-owned silence.
|
|
106
|
+
*
|
|
107
|
+
* Two different failures wear the same timeout. Before the send, a stalled
|
|
108
|
+
* unread drain means the message never reached the agent: "try again here" is
|
|
109
|
+
* actively wrong, because there is nothing to resume and the agent will answer
|
|
110
|
+
* whatever it last genuinely received — a confident reply to a question nobody
|
|
111
|
+
* asked. After the send, the message did reach the agent and the conversation
|
|
112
|
+
* is kept, so trying again is the right advice. The phase on the error tells
|
|
113
|
+
* the two apart.
|
|
114
|
+
*/
|
|
105
115
|
export declare function agentSilenceReply(error: unknown): string | null;
|
package/dist/turn.js
CHANGED
|
@@ -17,6 +17,16 @@ export const DEFAULT_AGENT_SILENCE_TIMEOUT_MS = 5 * 60_000;
|
|
|
17
17
|
*/
|
|
18
18
|
export const DEFAULT_AGENT_WORK_TIMEOUT_MS = 60 * 60_000;
|
|
19
19
|
const isWorkPhase = (phase) => phase.endsWith("response stream");
|
|
20
|
+
/**
|
|
21
|
+
* A phase that runs BEFORE the message is sent to the agent.
|
|
22
|
+
*
|
|
23
|
+
* The unread drain runs before the send, so a timeout here means the message
|
|
24
|
+
* never reached the agent and no run was created. Every other phase — the
|
|
25
|
+
* send/create acknowledgement and the response stream — is after the POST that
|
|
26
|
+
* delivers it, so by then the agent has the message. This is the difference
|
|
27
|
+
* between a lost message and a lost turn, and the recovery text turns on it.
|
|
28
|
+
*/
|
|
29
|
+
const isPreSendPhase = (phase) => phase === "unread drain";
|
|
20
30
|
/** A caller-owned inactivity timeout. Aborting the transport does not cancel the eve session. */
|
|
21
31
|
export class AgentSilenceTimeoutError extends Error {
|
|
22
32
|
phase;
|
|
@@ -405,9 +415,22 @@ export function rejectedTurnReply(error) {
|
|
|
405
415
|
? `I couldn't read that message (${detail}). Try sending it again, or as plain text.`
|
|
406
416
|
: "I couldn't read that message. Try sending it again, or as plain text.";
|
|
407
417
|
}
|
|
408
|
-
/**
|
|
418
|
+
/**
|
|
419
|
+
* Give the originating channel one accurate recovery message for bridge-owned silence.
|
|
420
|
+
*
|
|
421
|
+
* Two different failures wear the same timeout. Before the send, a stalled
|
|
422
|
+
* unread drain means the message never reached the agent: "try again here" is
|
|
423
|
+
* actively wrong, because there is nothing to resume and the agent will answer
|
|
424
|
+
* whatever it last genuinely received — a confident reply to a question nobody
|
|
425
|
+
* asked. After the send, the message did reach the agent and the conversation
|
|
426
|
+
* is kept, so trying again is the right advice. The phase on the error tells
|
|
427
|
+
* the two apart.
|
|
428
|
+
*/
|
|
409
429
|
export function agentSilenceReply(error) {
|
|
410
430
|
if (!(error instanceof AgentSilenceTimeoutError))
|
|
411
431
|
return null;
|
|
432
|
+
if (isPreSendPhase(error.phase)) {
|
|
433
|
+
return "I couldn't get your message to the agent before it went quiet, so it was not delivered — nothing was sent and no answer is coming. Please send it again.";
|
|
434
|
+
}
|
|
412
435
|
return "The agent was silent for too long, so I stopped waiting. I kept this conversation, and you can try again here.";
|
|
413
436
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kybernesis/buzz",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.9",
|
|
4
4
|
"description": "Put an eve agent in a Buzz workspace as a member: per-speaker verified identity resolved through the control plane, self-service identity linking, presence, typing and seen signals.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|