@burdenoff/fe-libs 2026.1117.7 → 2026.1117.8
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.
|
@@ -106,3 +106,39 @@ export declare function planTurnAbort(args: {
|
|
|
106
106
|
send: boolean;
|
|
107
107
|
reason: TurnAbortReason;
|
|
108
108
|
};
|
|
109
|
+
/**
|
|
110
|
+
* ★ BOFF-12936: why a turn was cancelled, as the exit that cancelled it says.
|
|
111
|
+
* The turn's timing report carries it as its outcome, in the spelling
|
|
112
|
+
* wspace-sandbox-svc's turn histograms allowlist (#178), so `stopped` means
|
|
113
|
+
* only that the person stopped it:
|
|
114
|
+
*
|
|
115
|
+
* - `stopped`: an explicit Stop (the transcript's or the composer's), or a tap
|
|
116
|
+
* on the voice orb;
|
|
117
|
+
* - `superseded`: newer speech replaced it, a correction heard while it was
|
|
118
|
+
* being prepared (`supersedeVoiceTurn`) or a spoken correction sent while it
|
|
119
|
+
* still held the conversation (`correctsInFlightTurn`);
|
|
120
|
+
* - `bargeIn`: the person talked over its answer (the hands-free interrupt);
|
|
121
|
+
* - `sandboxReleased`: the page stopped the sandbox it ran on, a reaped or
|
|
122
|
+
* replaced one (`trackAssistantSandboxTurn`).
|
|
123
|
+
*/
|
|
124
|
+
export type TurnStopReason = 'stopped' | 'superseded' | 'bargeIn' | 'sandboxReleased';
|
|
125
|
+
/** …and `conversationDeleted`: its conversation was deleted while it ran. */
|
|
126
|
+
export type StoppedTurnOutcome = TurnStopReason | 'conversationDeleted';
|
|
127
|
+
/** One page's record of why each cancelled turn was cancelled (BOFF-12936). */
|
|
128
|
+
export interface TurnStopReasons {
|
|
129
|
+
/** Record why `turnId` was cancelled. The FIRST reason a turn is given stands. */
|
|
130
|
+
note(turnId: string, reason: TurnStopReason): void;
|
|
131
|
+
/**
|
|
132
|
+
* The outcome of a turn that ended without one of its own, forgetting the
|
|
133
|
+
* turn: the reason it was cancelled with; without one, `conversationDeleted`
|
|
134
|
+
* when its conversation is gone, and `stopped` otherwise.
|
|
135
|
+
*/
|
|
136
|
+
settle(turnId: string, conversationExists: boolean): StoppedTurnOutcome;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* More reasons than turns a page can have in flight. Every noted turn is in
|
|
140
|
+
* flight and settles in its own `finally`; the bound only keeps a turn that
|
|
141
|
+
* never settles from growing the record.
|
|
142
|
+
*/
|
|
143
|
+
export declare const MAX_TURN_STOP_REASONS = 64;
|
|
144
|
+
export declare function createTurnStopReasons(): TurnStopReasons;
|
|
@@ -30,4 +30,21 @@ function n(e) {
|
|
|
30
30
|
reason: "superseded"
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
var r = 64;
|
|
34
|
+
function i() {
|
|
35
|
+
let e = /* @__PURE__ */ new Map();
|
|
36
|
+
return {
|
|
37
|
+
note(t, n) {
|
|
38
|
+
if (!e.has(t)) for (e.set(t, n); e.size > 64;) {
|
|
39
|
+
let t = e.keys().next();
|
|
40
|
+
if (t.done) break;
|
|
41
|
+
e.delete(t.value);
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
settle(t, n) {
|
|
45
|
+
let r = e.get(t);
|
|
46
|
+
return e.delete(t), r ?? (n ? "stopped" : "conversationDeleted");
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
export { r as MAX_TURN_STOP_REASONS, i as createTurnStopReasons, e as isTurnInFlight, t as planAbandonedTurn, n as planTurnAbort };
|
|
@@ -1,90 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
* ★★ Where a turn's time goes — measured before anything is optimised
|
|
3
|
-
* (BOFF-7801).
|
|
4
|
-
*
|
|
5
|
-
* First answers took 55–150s+ in production, and nobody could say which part
|
|
6
|
-
* of that was the sandbox starting, a dead sandbox being probed, the model
|
|
7
|
-
* thinking, the poll noticing, our own bookkeeping, or the voice fetching
|
|
8
|
-
* audio. This records each milestone of a turn as it happens, so the slow part
|
|
9
|
-
* is measured instead of guessed.
|
|
10
|
-
*
|
|
11
|
-
* The chain, in order:
|
|
12
|
-
*
|
|
13
|
-
* speechEnded the last time the heard words CHANGED (voice only)
|
|
14
|
-
* graceStarted the correction grace began — the last result that re-armed
|
|
15
|
-
* it; after speechEnded when the recogniser re-commits late
|
|
16
|
-
* graceEnded the correction grace ran out; the turn was submitted
|
|
17
|
-
* handedOver its attachments settled and it went to the panel (voice)
|
|
18
|
-
* accepted the panel took the turn: the question is on screen
|
|
19
|
-
* cleared the send-time checks passed (mode access, write consent)
|
|
20
|
-
* attemptStarted this attempt at a runtime began (again, on a retry)
|
|
21
|
-
* prewarmJoined the send is waiting on a first-keystroke pre-warm in its
|
|
22
|
-
* mode that is BOOTING a sandbox — marked as it joins one
|
|
23
|
-
* already booting, or as the warm it joined begins the boot
|
|
24
|
-
* bootAdopted this attempt found a boot under way and is waiting it
|
|
25
|
-
* out: a sandbox listed PROVISIONING/PENDING, or a service
|
|
26
|
-
* that answered "not up yet" (the `adopted` runtime)
|
|
27
|
-
* provisionStarted no reusable sandbox — making room for a new one starts here
|
|
28
|
-
* createRequested the new sandbox was requested (after releasing old ones)
|
|
29
|
-
* sandboxRunning the created sandbox is running (cold)
|
|
30
|
-
* serviceReady the assistant service inside it answers (cold)
|
|
31
|
-
* runtimeReady a sandbox and a session are ready to take the prompt
|
|
32
|
-
* promptSent the sandbox accepted the prompt
|
|
33
|
-
* lastQuietPoll the last poll that saw nothing — with firstOutput, the
|
|
34
|
-
* UPPER bound of how late polling noticed the output
|
|
35
|
-
* streamOpen the turn stream said `open` (BOFF-7914 S3); it can precede
|
|
36
|
-
* `promptSent`, because the mint runs beside the prompt
|
|
37
|
-
* streamRemint the stream was minted again after it ended; the FIRST
|
|
38
|
-
* re-mint (the reasons are the `remintReasons` of the stream)
|
|
39
|
-
* firstDelta the first live text of this turn that could be shown
|
|
40
|
-
* firstOutput the first poll — or live render — that had anything to
|
|
41
|
-
* show (a tool line too)
|
|
42
|
-
* firstText the first poll that saw answer TEXT — prose not followed
|
|
43
|
-
* by a tool call, confirmed when the turn completes, so
|
|
44
|
-
* pre-tool narration does not count. In modes whose
|
|
45
|
-
* narration IS the answer (BigConsole's build log), the
|
|
46
|
-
* first narration: group reports by `mode`
|
|
47
|
-
* streamIdle the bridge said the turn is idle (stream turns only)
|
|
48
|
-
* answerDone the poll that saw the answer complete
|
|
49
|
-
* complete the turn ended (after artifacts and the credit report)
|
|
50
|
-
* speechQueued the answer was handed to the speech feed (BOFF-8062 C1):
|
|
51
|
-
* a voice turn publishes it at `answerDone`, before the
|
|
52
|
-
* artifacts and credit report — so `ttsStarted` and
|
|
53
|
-
* `firstAudio` can precede `complete`
|
|
54
|
-
* ttsStarted auto-speak handed the reply to the speech engine
|
|
55
|
-
* firstAudio the engine reported sound actually started
|
|
56
|
-
* audioEnded the auto-spoken reply finished playing
|
|
57
|
-
*
|
|
58
|
-
* ★ `graceStarted → graceEnded` is the 2s correction grace, and it is KEPT: it
|
|
59
|
-
* stops a pause mid-sentence from submitting half a question. It is a segment
|
|
60
|
-
* of its own so it can never be "optimised" away by accident — and the
|
|
61
|
-
* recogniser's own endpointing (`speechEnded → graceStarted`, 0.5–1.5s and
|
|
62
|
-
* longer on Android) is kept OUT of it, because that one can be optimised.
|
|
63
|
-
*
|
|
64
|
-
* ★ Filler is never output: the progress `content` is model output only
|
|
65
|
-
* (BOFF-7277) and the waiting copy is drawn by the bubble from the stage.
|
|
66
|
-
*
|
|
67
|
-
* ★ `prewarmJoined` and `bootAdopted` are marked the moment the wait is KNOWN,
|
|
68
|
-
* not once it pays off: the facts (`prewarm`, `runtime`) are only written
|
|
69
|
-
* when the wait ends, so a turn the person gives up on mid-wait would
|
|
70
|
-
* otherwise carry nothing to say it was waiting on a boot (BOFF-7801 review
|
|
71
|
-
* round 3). Once the facts are written, they are the answer.
|
|
72
|
-
*
|
|
73
|
-
* ★ A turn whose first attempt fails recoverably is retried under the SAME id.
|
|
74
|
-
* `restartAttempt` files the first attempt's marks under `attempts` so the
|
|
75
|
-
* second records its own — mixed attempts are not a timeline.
|
|
76
|
-
*
|
|
77
|
-
* Times are `performance.now()` — monotonic, comparable within the page. The
|
|
78
|
-
* event is visible to EVERY script on the page, so it carries timings and
|
|
79
|
-
* coarse dimensions only: never message text, never tenant, user, workspace or
|
|
80
|
-
* conversation ids. Delivery is asynchronous, so a listener never runs inside
|
|
81
|
-
* the step it measures.
|
|
82
|
-
*
|
|
83
|
-
* ★ Anything that ACTS on a timeline (the production latency reporter,
|
|
84
|
-
* `turnTimingReporter.ts`) subscribes with `subscribeTurnTimelines`, not the
|
|
85
|
-
* window event: any script on the page can dispatch that event, so a listener
|
|
86
|
-
* on it can be fed invented timings. Only this module calls subscribers.
|
|
87
|
-
*/
|
|
1
|
+
import { StoppedTurnOutcome } from './turnState';
|
|
88
2
|
export declare const TURN_MILESTONES: readonly ["speechEnded", "lastSpeechFrame", "recognizerSpeechEnded", "graceStarted", "graceEnded", "handedOver", "accepted", "cleared", "attemptStarted", "prewarmJoined", "bootAdopted", "provisionStarted", "createRequested", "sandboxRunning", "serviceReady", "runtimeReady", "promptSent", "lastQuietPoll", "streamOpen", "streamRemint", "firstDelta", "firstOutput", "firstText", "streamIdle", "answerDone", "complete", "speechQueued", "ttsStarted", "firstAudio", "audioEnded"];
|
|
89
3
|
export type TurnMilestone = (typeof TURN_MILESTONES)[number];
|
|
90
4
|
/**
|
|
@@ -117,8 +31,14 @@ export type TurnRuntime = 'warm' | 'preopened' | 'new-session' | 'probed' | 'ado
|
|
|
117
31
|
* - `timedOut`: the client's stream budget ran out before the answer finished.
|
|
118
32
|
* Only `answered` turns carry `firstText`; a timed-out turn's unconfirmed text
|
|
119
33
|
* is not recorded.
|
|
34
|
+
*
|
|
35
|
+
* ★ A turn that ended without an answer because it was cancelled says why
|
|
36
|
+
* (BOFF-12936, `TurnStopReason`): `stopped` only when the person stopped it,
|
|
37
|
+
* else `superseded`, `bargeIn`, `conversationDeleted` or `sandboxReleased`.
|
|
38
|
+
* wspace-sandbox-svc counts these four from #178 on; a service without them
|
|
39
|
+
* folds them into `other`.
|
|
120
40
|
*/
|
|
121
|
-
export type TurnTimelineOutcome = 'answered' | 'timedOut' | 'refused' | 'failed' |
|
|
41
|
+
export type TurnTimelineOutcome = 'answered' | 'timedOut' | 'refused' | 'failed' | StoppedTurnOutcome;
|
|
122
42
|
export interface TurnDimensions {
|
|
123
43
|
channel: 'chat' | 'voice' | 'listen';
|
|
124
44
|
mode: string;
|