@molecule/app-ide-panel-logic 1.3.1 → 1.4.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/README.md +285 -3
- package/dist/chatTimelineOrdering.d.ts +175 -1
- package/dist/chatTimelineOrdering.d.ts.map +1 -1
- package/dist/chatTimelineOrdering.js +192 -1
- package/dist/chatTimelineOrdering.js.map +1 -1
- package/dist/components/chat-card-event-utilities.d.ts +320 -0
- package/dist/components/chat-card-event-utilities.d.ts.map +1 -0
- package/dist/components/chat-card-event-utilities.js +198 -0
- package/dist/components/chat-card-event-utilities.js.map +1 -0
- package/dist/components/chat-card-style.d.ts +7 -1
- package/dist/components/chat-card-style.d.ts.map +1 -1
- package/dist/components/chat-card-style.js +8 -2
- package/dist/components/chat-card-style.js.map +1 -1
- package/dist/components/chat-composer-utilities.d.ts +472 -0
- package/dist/components/chat-composer-utilities.d.ts.map +1 -0
- package/dist/components/chat-composer-utilities.js +519 -0
- package/dist/components/chat-composer-utilities.js.map +1 -0
- package/dist/components/chat-dictation-controller.d.ts +376 -0
- package/dist/components/chat-dictation-controller.d.ts.map +1 -0
- package/dist/components/chat-dictation-controller.js +559 -0
- package/dist/components/chat-dictation-controller.js.map +1 -0
- package/dist/components/chat-effort-utilities.d.ts +24 -0
- package/dist/components/chat-effort-utilities.d.ts.map +1 -1
- package/dist/components/chat-effort-utilities.js +41 -0
- package/dist/components/chat-effort-utilities.js.map +1 -1
- package/dist/components/chat-format-utilities.d.ts +71 -0
- package/dist/components/chat-format-utilities.d.ts.map +1 -0
- package/dist/components/chat-format-utilities.js +192 -0
- package/dist/components/chat-format-utilities.js.map +1 -0
- package/dist/components/chat-models-utilities.d.ts +168 -0
- package/dist/components/chat-models-utilities.d.ts.map +1 -1
- package/dist/components/chat-models-utilities.js +253 -0
- package/dist/components/chat-models-utilities.js.map +1 -1
- package/dist/components/chat-settings-utilities.d.ts +153 -1
- package/dist/components/chat-settings-utilities.d.ts.map +1 -1
- package/dist/components/chat-settings-utilities.js +204 -1
- package/dist/components/chat-settings-utilities.js.map +1 -1
- package/dist/components/chat-stream-utilities.d.ts +165 -1
- package/dist/components/chat-stream-utilities.d.ts.map +1 -1
- package/dist/components/chat-stream-utilities.js +155 -1
- package/dist/components/chat-stream-utilities.js.map +1 -1
- package/dist/components/chat-tests-controller.d.ts +249 -0
- package/dist/components/chat-tests-controller.d.ts.map +1 -0
- package/dist/components/chat-tests-controller.js +504 -0
- package/dist/components/chat-tests-controller.js.map +1 -0
- package/dist/components/chat-timeline-utilities.d.ts +90 -0
- package/dist/components/chat-timeline-utilities.d.ts.map +1 -0
- package/dist/components/chat-timeline-utilities.js +71 -0
- package/dist/components/chat-timeline-utilities.js.map +1 -0
- package/dist/components/chat-ui-constants.d.ts +98 -0
- package/dist/components/chat-ui-constants.d.ts.map +1 -0
- package/dist/components/chat-ui-constants.js +146 -0
- package/dist/components/chat-ui-constants.js.map +1 -0
- package/dist/components/chat-undo-utilities.d.ts +47 -0
- package/dist/components/chat-undo-utilities.d.ts.map +1 -0
- package/dist/components/chat-undo-utilities.js +73 -0
- package/dist/components/chat-undo-utilities.js.map +1 -0
- package/dist/components/context-usage-utilities.d.ts +25 -3
- package/dist/components/context-usage-utilities.d.ts.map +1 -1
- package/dist/components/context-usage-utilities.js +42 -2
- package/dist/components/context-usage-utilities.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/panels.d.ts +6 -0
- package/dist/panels.d.ts.map +1 -1
- package/dist/panels.js +6 -0
- package/dist/panels.js.map +1 -1
- package/package.json +3 -3
|
@@ -24,11 +24,75 @@
|
|
|
24
24
|
* mode cycle types and the English mode labels) and the label helpers for
|
|
25
25
|
* them, so every framework's chat panel reads the SAME sound vocabulary — and
|
|
26
26
|
* so every sound label is a literal `t()` call the i18n gate can check, never
|
|
27
|
-
* a runtime-built `ide.chat.soundEvent.${event}` key.
|
|
27
|
+
* a runtime-built `ide.chat.soundEvent.${event}` key. The same module parses
|
|
28
|
+
* and cycles the per-device sounds preference and owns the notification tone
|
|
29
|
+
* (`playTone`, with an injectable AudioContext factory) and the focus-aware
|
|
30
|
+
* {@link shouldPlaySound} gate, so every port plays the same tones on the same
|
|
31
|
+
* events.
|
|
28
32
|
*
|
|
29
33
|
* @module
|
|
30
34
|
*/
|
|
31
35
|
import { SETTINGS } from '../settings-metadata.js';
|
|
36
|
+
import { MODEL_REGION_FLAGS } from './chat-models-utilities.js';
|
|
37
|
+
/**
|
|
38
|
+
* Parses the chat-related settings out of a project's `settings` bag — the
|
|
39
|
+
* untrusted JSON an initialized project stores. Both the mount hydration and
|
|
40
|
+
* the change-signal re-read run this exact parse, so they can never drift.
|
|
41
|
+
*
|
|
42
|
+
* @param raw - The project's `settings` bag (or `undefined` when absent).
|
|
43
|
+
* @returns The values that parsed cleanly, keyed by settings field.
|
|
44
|
+
*/
|
|
45
|
+
export function parseChatProjectSettings(raw) {
|
|
46
|
+
const parsed = {};
|
|
47
|
+
if (typeof raw?.chatModel === 'string') {
|
|
48
|
+
parsed.chatModel = raw.chatModel;
|
|
49
|
+
}
|
|
50
|
+
if (typeof raw?.planModel === 'string')
|
|
51
|
+
parsed.planModel = raw.planModel;
|
|
52
|
+
if (typeof raw?.executeModel === 'string')
|
|
53
|
+
parsed.executeModel = raw.executeModel;
|
|
54
|
+
if (typeof raw?.commitModel === 'string')
|
|
55
|
+
parsed.commitModel = raw.commitModel;
|
|
56
|
+
if (typeof raw?.compactModel === 'string')
|
|
57
|
+
parsed.compactModel = raw.compactModel;
|
|
58
|
+
// The persisted value is the model's own native level — accept any non-empty
|
|
59
|
+
// string; it's resolved against the active model at use time.
|
|
60
|
+
if (typeof raw?.effortLevel === 'string' && raw.effortLevel) {
|
|
61
|
+
parsed.effortLevel = raw.effortLevel;
|
|
62
|
+
}
|
|
63
|
+
// Per-mode effort map — accept each string entry (untrusted JSON bag).
|
|
64
|
+
if (raw?.effortByMode &&
|
|
65
|
+
typeof raw.effortByMode === 'object' &&
|
|
66
|
+
!Array.isArray(raw.effortByMode)) {
|
|
67
|
+
const next = {};
|
|
68
|
+
for (const m of ['plan', 'execute']) {
|
|
69
|
+
const value = raw.effortByMode[m];
|
|
70
|
+
if (typeof value === 'string' && value)
|
|
71
|
+
next[m] = value;
|
|
72
|
+
}
|
|
73
|
+
parsed.effortByMode = next;
|
|
74
|
+
}
|
|
75
|
+
// Per-model processing region map — accept each known-region entry
|
|
76
|
+
// (untrusted JSON bag), mirroring effortByMode above.
|
|
77
|
+
if (raw?.modelRegions &&
|
|
78
|
+
typeof raw.modelRegions === 'object' &&
|
|
79
|
+
!Array.isArray(raw.modelRegions)) {
|
|
80
|
+
const nextRegions = {};
|
|
81
|
+
for (const [id, value] of Object.entries(raw.modelRegions)) {
|
|
82
|
+
if (typeof value === 'string' && value in MODEL_REGION_FLAGS)
|
|
83
|
+
nextRegions[id] = value;
|
|
84
|
+
}
|
|
85
|
+
parsed.modelRegions = nextRegions;
|
|
86
|
+
}
|
|
87
|
+
if (typeof raw?.maxToolLoops === 'number')
|
|
88
|
+
parsed.maxToolLoops = raw.maxToolLoops;
|
|
89
|
+
if (typeof raw?.autoFix === 'boolean')
|
|
90
|
+
parsed.autoFix = raw.autoFix;
|
|
91
|
+
if (typeof raw?.autoApproveCommands === 'boolean') {
|
|
92
|
+
parsed.autoApproveCommands = raw.autoApproveCommands;
|
|
93
|
+
}
|
|
94
|
+
return parsed;
|
|
95
|
+
}
|
|
32
96
|
/**
|
|
33
97
|
* Builds the ordered list of user-controllable agent settings by zipping the
|
|
34
98
|
* canonical {@link SETTINGS} metadata together with the supplied display-ready
|
|
@@ -72,6 +136,145 @@ export const SOUND_EVENTS = [
|
|
|
72
136
|
'verification_result',
|
|
73
137
|
'preview_error',
|
|
74
138
|
];
|
|
139
|
+
/** Mode cycle order. */
|
|
140
|
+
export const SOUND_MODES = ['off', 'whenNotFocused', 'always'];
|
|
141
|
+
/** Per-device sounds preference (see the soundsConfig state comment). */
|
|
142
|
+
export const SOUNDS_STORAGE_KEY = 'molecule.ide.sounds';
|
|
143
|
+
/** The sound modes a device starts with, before any local preference is stored. */
|
|
144
|
+
export const DEFAULT_SOUNDS_CONFIG = {
|
|
145
|
+
message: 'always',
|
|
146
|
+
done: 'whenNotFocused',
|
|
147
|
+
error: 'whenNotFocused',
|
|
148
|
+
tool_result: 'off',
|
|
149
|
+
file_diff: 'off',
|
|
150
|
+
commit_suggestion: 'off',
|
|
151
|
+
mode: 'whenNotFocused',
|
|
152
|
+
loop_limit_reached: 'whenNotFocused',
|
|
153
|
+
verification_result: 'whenNotFocused',
|
|
154
|
+
preview_error: 'whenNotFocused',
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Whether a value is one of the {@link SOUND_MODES}.
|
|
158
|
+
*
|
|
159
|
+
* @param value - Any value, such as one read from storage.
|
|
160
|
+
* @returns True for `'off'`, `'whenNotFocused'` or `'always'`.
|
|
161
|
+
*/
|
|
162
|
+
export const isSoundMode = (value) => SOUND_MODES.some((mode) => mode === value);
|
|
163
|
+
/**
|
|
164
|
+
* Parses the stored per-device sounds preference, filling any missing event
|
|
165
|
+
* from {@link DEFAULT_SOUNDS_CONFIG}. A missing or corrupt stored value keeps
|
|
166
|
+
* the defaults, so an unreadable preference never silences the panel; so does
|
|
167
|
+
* an entry that is not a known event with a known mode (a value stored by an
|
|
168
|
+
* older or newer build), which is dropped rather than copied in.
|
|
169
|
+
*
|
|
170
|
+
* @param raw - The raw localStorage value (or `null` when nothing is stored).
|
|
171
|
+
* @returns The parsed sound modes, every event present.
|
|
172
|
+
*/
|
|
173
|
+
export function parseSoundsConfig(raw) {
|
|
174
|
+
if (!raw)
|
|
175
|
+
return { ...DEFAULT_SOUNDS_CONFIG };
|
|
176
|
+
let stored;
|
|
177
|
+
try {
|
|
178
|
+
stored = JSON.parse(raw);
|
|
179
|
+
}
|
|
180
|
+
catch (_error) {
|
|
181
|
+
// Bad JSON: the defaults stand.
|
|
182
|
+
return { ...DEFAULT_SOUNDS_CONFIG };
|
|
183
|
+
}
|
|
184
|
+
return mergeSoundsConfig(DEFAULT_SOUNDS_CONFIG, stored);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Overlays a stored sounds value on `base`: each known event whose stored mode is a
|
|
188
|
+
* known mode replaces the base's, and everything else (a non-object, an unknown event
|
|
189
|
+
* or mode) is ignored, as a project's legacy `settings.sounds` needs.
|
|
190
|
+
*
|
|
191
|
+
* @param base - The sound modes to start from.
|
|
192
|
+
* @param stored - The stored value, of any shape.
|
|
193
|
+
* @returns A new config, every event present.
|
|
194
|
+
*/
|
|
195
|
+
export function mergeSoundsConfig(base, stored) {
|
|
196
|
+
const config = { ...base };
|
|
197
|
+
if (typeof stored !== 'object' || stored === null || Array.isArray(stored))
|
|
198
|
+
return config;
|
|
199
|
+
for (const event of SOUND_EVENTS) {
|
|
200
|
+
const mode = Reflect.get(stored, event);
|
|
201
|
+
if (isSoundMode(mode))
|
|
202
|
+
config[event] = mode;
|
|
203
|
+
}
|
|
204
|
+
return config;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Cycles one sound event's mode to the next entry in {@link SOUND_MODES}, or
|
|
208
|
+
* every event at once when `eventType` is `'all'` — what the sounds picker
|
|
209
|
+
* applies on a row click.
|
|
210
|
+
*
|
|
211
|
+
* @param config - The current per-event sound modes.
|
|
212
|
+
* @param eventType - The event to cycle, or `'all'` for every event.
|
|
213
|
+
* @returns The updated config (a new object; the input is not mutated).
|
|
214
|
+
*/
|
|
215
|
+
export function cycleSoundsConfig(config, eventType) {
|
|
216
|
+
if (eventType === 'all') {
|
|
217
|
+
const current = config[SOUND_EVENTS[0]];
|
|
218
|
+
const nextIdx = (SOUND_MODES.indexOf(current) + 1) % SOUND_MODES.length;
|
|
219
|
+
const next = SOUND_MODES[nextIdx];
|
|
220
|
+
return Object.fromEntries(SOUND_EVENTS.map((e) => [e, next]));
|
|
221
|
+
}
|
|
222
|
+
const current = config[eventType];
|
|
223
|
+
const nextIdx = (SOUND_MODES.indexOf(current) + 1) % SOUND_MODES.length;
|
|
224
|
+
const next = SOUND_MODES[nextIdx];
|
|
225
|
+
return { ...config, [eventType]: next };
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Check if a sound should play based on the mode and current page focus.
|
|
229
|
+
*
|
|
230
|
+
* @param mode - The sound mode for the event.
|
|
231
|
+
* @param hasFocus - Whether the page currently has focus (the caller reads it, e.g. `document.hasFocus()`).
|
|
232
|
+
* @returns Whether the sound should play.
|
|
233
|
+
*/
|
|
234
|
+
export function shouldPlaySound(mode, hasFocus) {
|
|
235
|
+
if (mode === 'off')
|
|
236
|
+
return false;
|
|
237
|
+
if (mode === 'always')
|
|
238
|
+
return true;
|
|
239
|
+
return !hasFocus;
|
|
240
|
+
}
|
|
241
|
+
/** The lazily-created AudioContext shared by every {@link playTone} call. */
|
|
242
|
+
let audioCtx = null;
|
|
243
|
+
/** The default AudioContext factory: the browser's own `new AudioContext()`. */
|
|
244
|
+
const createDefaultAudioContext = () => new AudioContext();
|
|
245
|
+
/**
|
|
246
|
+
* Play a short notification tone using the Web Audio API.
|
|
247
|
+
* Creates the AudioContext lazily on first call (after user interaction).
|
|
248
|
+
*
|
|
249
|
+
* The default variant is a single 660 Hz blip (status events). The `team`
|
|
250
|
+
* variant is the SAME blip an octave up (1320 Hz) — recognizably "a message,
|
|
251
|
+
* not a status event" while staying consistent with the sound family.
|
|
252
|
+
* @param variant - Which tone to play.
|
|
253
|
+
* @param createAudioContext - Factory for the lazily-created AudioContext (defaults to `new AudioContext()`).
|
|
254
|
+
*/
|
|
255
|
+
export function playTone(variant = 'default', createAudioContext = createDefaultAudioContext) {
|
|
256
|
+
try {
|
|
257
|
+
if (!audioCtx)
|
|
258
|
+
audioCtx = createAudioContext();
|
|
259
|
+
const osc = audioCtx.createOscillator();
|
|
260
|
+
const gain = audioCtx.createGain();
|
|
261
|
+
osc.connect(gain);
|
|
262
|
+
gain.connect(audioCtx.destination);
|
|
263
|
+
osc.type = 'sine';
|
|
264
|
+
osc.frequency.value = variant === 'team' ? 1320 : 660;
|
|
265
|
+
// Equal-loudness compensation: hearing is far more sensitive near 1–4 kHz
|
|
266
|
+
// than at 660 Hz, so the octave-up tone needs roughly half the amplitude
|
|
267
|
+
// to sound the same volume as the default blip.
|
|
268
|
+
const peak = variant === 'team' ? 0.08 : 0.15;
|
|
269
|
+
gain.gain.setValueAtTime(peak, audioCtx.currentTime);
|
|
270
|
+
gain.gain.exponentialRampToValueAtTime(0.001, audioCtx.currentTime + 0.15);
|
|
271
|
+
osc.start(audioCtx.currentTime);
|
|
272
|
+
osc.stop(audioCtx.currentTime + 0.15);
|
|
273
|
+
}
|
|
274
|
+
catch (_error) {
|
|
275
|
+
// AudioContext not available in this environment — silently skip
|
|
276
|
+
}
|
|
277
|
+
}
|
|
75
278
|
/**
|
|
76
279
|
* English label per sound mode (also each key's `defaultValue` in
|
|
77
280
|
* {@link soundModeLabel}). Kept as a table because the chat panel spells the
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-settings-utilities.js","sourceRoot":"","sources":["../../src/components/chat-settings-utilities.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"chat-settings-utilities.js","sourceRoot":"","sources":["../../src/components/chat-settings-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAMH,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAElD,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AA2D/D;;;;;;;GAOG;AACH,MAAM,UAAU,wBAAwB,CACtC,GAAwC;IAExC,MAAM,MAAM,GAA8B,EAAE,CAAA;IAC5C,IAAI,OAAO,GAAG,EAAE,SAAS,KAAK,QAAQ,EAAE,CAAC;QACvC,MAAM,CAAC,SAAS,GAAG,GAAG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live streaming-message indicator (token estimate), the
|
|
3
|
+
* effects a chat stream event produces, and the verification auto-fix countdown.
|
|
4
|
+
*
|
|
5
|
+
* {@link streamEventEffects} turns one stream event into the ordered list of
|
|
6
|
+
* effects the panel applies (a usage update, a compaction card, an activity
|
|
7
|
+
* card, a host callback, a notification sound) so every framework's chat panel
|
|
8
|
+
* derives the same effects from the same event. {@link autoFixCountdownReducer}
|
|
9
|
+
* is the pure state machine behind the auto-fix countdown: it holds the pending
|
|
10
|
+
* verification errors, arms the three-second countdown when the turn ends, and
|
|
11
|
+
* handles tick/pause/resume/cancel. The component owns the side effects — the
|
|
12
|
+
* state setters, the interval, and the auto-sent message.
|
|
3
13
|
*
|
|
4
14
|
* @module
|
|
5
15
|
*/
|
|
16
|
+
import type { ContextCompaction, ContextUsage } from '@molecule/app-ai-chat';
|
|
17
|
+
import type { IdeClientAction } from '../types.js';
|
|
18
|
+
import type { Activity } from './activity-utilities.js';
|
|
19
|
+
import type { SoundsConfig } from './chat-settings-utilities.js';
|
|
6
20
|
/**
|
|
7
21
|
* Character length of a tool call's input, for the live token estimate. While the
|
|
8
22
|
* input is still streaming, counts the bytes seen so far; once the final input has
|
|
@@ -70,5 +84,155 @@ interface TurnTokenMessage {
|
|
|
70
84
|
* @returns The estimated token count for the in-progress turn.
|
|
71
85
|
*/
|
|
72
86
|
export declare function estimateTurnTokens(messages: ReadonlyArray<TurnTokenMessage>): number;
|
|
87
|
+
/**
|
|
88
|
+
* The stream event shape the chat effects read: a `type` discriminator, an
|
|
89
|
+
* optional context-usage sample, and any further event-specific fields.
|
|
90
|
+
*/
|
|
91
|
+
export interface StreamEvent {
|
|
92
|
+
/** The event type discriminator. */
|
|
93
|
+
type: string;
|
|
94
|
+
/** Context-usage sample carried by `context_usage` and `done` events. */
|
|
95
|
+
usage?: Partial<ContextUsage>;
|
|
96
|
+
/** Any further event-specific field, read where that event defines it. */
|
|
97
|
+
[key: string]: unknown;
|
|
98
|
+
}
|
|
99
|
+
/** The panel state {@link streamEventEffects} reads to decide its effects. */
|
|
100
|
+
export interface StreamEventEffectState {
|
|
101
|
+
/** The latest per-event sound modes. */
|
|
102
|
+
soundsConfig: SoundsConfig;
|
|
103
|
+
/** Whether the page currently has focus (`document.hasFocus()` in the browser). */
|
|
104
|
+
hasFocus: boolean;
|
|
105
|
+
/** Whether a teammate's pushed broadcast is being applied. */
|
|
106
|
+
applyingPushed: boolean;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The effects one stream event produces, in the order the panel applies them:
|
|
110
|
+
* a context-usage update, a compaction card, an activity card, the
|
|
111
|
+
* ready-to-build signal, a forwarded client action, the turn-complete signal,
|
|
112
|
+
* and a notification sound. The panel applies each to its own state, refs and
|
|
113
|
+
* host callbacks.
|
|
114
|
+
*/
|
|
115
|
+
export type StreamEventEffect = {
|
|
116
|
+
/** A `context_usage` / `done` sample for the usage ring and history. */
|
|
117
|
+
type: 'contextUsage';
|
|
118
|
+
/** The complete usage sample to apply. */
|
|
119
|
+
usage: ContextUsage;
|
|
120
|
+
/** Whether the sample came from the `done` event (its merge differs). */
|
|
121
|
+
done: boolean;
|
|
122
|
+
} | {
|
|
123
|
+
/** A completed compaction to add to the usage breakdown. */
|
|
124
|
+
type: 'compaction';
|
|
125
|
+
/** The compaction entry. */
|
|
126
|
+
compaction: ContextCompaction;
|
|
127
|
+
} | {
|
|
128
|
+
/** A captured outbound side effect to append as an activity card. */
|
|
129
|
+
type: 'activityCard';
|
|
130
|
+
/** The normalized activity. */
|
|
131
|
+
activity: Activity;
|
|
132
|
+
} | {
|
|
133
|
+
/** Discovery picked a starting point; the sender boots the sandbox. */
|
|
134
|
+
type: 'readyToBuild';
|
|
135
|
+
} | {
|
|
136
|
+
/** The agent asked the IDE to drive the preview. */
|
|
137
|
+
type: 'clientAction';
|
|
138
|
+
/** The forwarded client action. */
|
|
139
|
+
action: IdeClientAction;
|
|
140
|
+
} | {
|
|
141
|
+
/** The turn finished (done or error). */
|
|
142
|
+
type: 'turnComplete';
|
|
143
|
+
} | {
|
|
144
|
+
/** Play a notification tone. */
|
|
145
|
+
type: 'playSound';
|
|
146
|
+
/** Which tone: the plain status blip, or the octave-up team chime. */
|
|
147
|
+
variant: 'default' | 'team';
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Turns one chat stream event into its ordered effects — the framework-neutral
|
|
151
|
+
* half of the panel's stream-event handler. The caller applies each effect to
|
|
152
|
+
* its own React (or port) state, refs and host callbacks.
|
|
153
|
+
*
|
|
154
|
+
* Sender-only effects follow the same rule as the panel: a teammate's pushed
|
|
155
|
+
* `ready_to_build` never boots this client's sandbox, and only a TEAMMATE's
|
|
156
|
+
* `message` note plays the team chime (the sender's own echo is silent).
|
|
157
|
+
*
|
|
158
|
+
* @param event - The stream event.
|
|
159
|
+
* @param state - The panel state the decision reads (sounds config, focus, whether a pushed frame is being applied).
|
|
160
|
+
* @returns The effects to apply, in order.
|
|
161
|
+
*/
|
|
162
|
+
export declare function streamEventEffects(event: StreamEvent, state: StreamEventEffectState): StreamEventEffect[];
|
|
163
|
+
/** Verification errors waiting for the stream to finish. */
|
|
164
|
+
export interface PendingVerification {
|
|
165
|
+
/** The verification output shown in the auto-fix message. */
|
|
166
|
+
output: string;
|
|
167
|
+
/** The verification categories that failed. */
|
|
168
|
+
categories: string[];
|
|
169
|
+
/** The changed paths a file change can match to cancel the fix. */
|
|
170
|
+
changedPaths: string[];
|
|
171
|
+
}
|
|
172
|
+
/** The active auto-fix countdown. */
|
|
173
|
+
export interface AutoFixCountdown {
|
|
174
|
+
/** The verification output shown in the auto-fix message. */
|
|
175
|
+
output: string;
|
|
176
|
+
/** The verification categories that failed. */
|
|
177
|
+
categories: string[];
|
|
178
|
+
/** The changed paths a file change can match to cancel the fix. */
|
|
179
|
+
changedPaths: string[];
|
|
180
|
+
/** Seconds left until the fix message is sent. */
|
|
181
|
+
secondsLeft: number;
|
|
182
|
+
/** Whether the user paused the countdown. */
|
|
183
|
+
paused: boolean;
|
|
184
|
+
}
|
|
185
|
+
/** The verification auto-fix state: pending errors and the live countdown. */
|
|
186
|
+
export interface AutoFixState {
|
|
187
|
+
/** Verification errors captured from the stream, armed when the turn ends. */
|
|
188
|
+
pending: PendingVerification | null;
|
|
189
|
+
/** The countdown currently shown at the bottom of the chat, or `null`. */
|
|
190
|
+
countdown: AutoFixCountdown | null;
|
|
191
|
+
}
|
|
192
|
+
/** The idle auto-fix state — the reducer's initial value. */
|
|
193
|
+
export declare const AUTO_FIX_IDLE: AutoFixState;
|
|
194
|
+
/** The actions the auto-fix reducer accepts. */
|
|
195
|
+
export type AutoFixAction = {
|
|
196
|
+
/** A verification result from the stream. */
|
|
197
|
+
type: 'verificationResult';
|
|
198
|
+
/** Whether verification passed or failed. */
|
|
199
|
+
status: 'ok' | 'error';
|
|
200
|
+
/** The verification output (only meaningful for an error). */
|
|
201
|
+
output?: string;
|
|
202
|
+
/** The failed categories (defaults to an empty list). */
|
|
203
|
+
categories?: string[];
|
|
204
|
+
/** The changed paths (defaults to an empty list). */
|
|
205
|
+
changedPaths?: string[];
|
|
206
|
+
/** Whether a teammate's pushed broadcast is being applied (sender-only arming). */
|
|
207
|
+
applyingPushed: boolean;
|
|
208
|
+
} | {
|
|
209
|
+
/** The turn finished; arm the countdown when verification had failed. */
|
|
210
|
+
type: 'done';
|
|
211
|
+
} | {
|
|
212
|
+
/** One second of the countdown elapsed; the last second clears it. */
|
|
213
|
+
type: 'tick';
|
|
214
|
+
} | {
|
|
215
|
+
/** Pause the countdown (e.g. the user started typing). */
|
|
216
|
+
type: 'pause';
|
|
217
|
+
} | {
|
|
218
|
+
/** Resume the countdown, restarting at three seconds. */
|
|
219
|
+
type: 'resume';
|
|
220
|
+
} | {
|
|
221
|
+
/** Dismiss the countdown without sending. */
|
|
222
|
+
type: 'cancel';
|
|
223
|
+
} | {
|
|
224
|
+
/** Clear the pending errors and the countdown (the user stopped the turn). */
|
|
225
|
+
type: 'reset';
|
|
226
|
+
};
|
|
227
|
+
/**
|
|
228
|
+
* Pure reducer for the verification auto-fix countdown. Deterministic and
|
|
229
|
+
* side-effect free: the component sends the fix message when a `tick` on the
|
|
230
|
+
* last second clears the countdown, then applies the returned state.
|
|
231
|
+
*
|
|
232
|
+
* @param state - The current auto-fix state.
|
|
233
|
+
* @param action - The action to apply.
|
|
234
|
+
* @returns The next auto-fix state.
|
|
235
|
+
*/
|
|
236
|
+
export declare function autoFixCountdownReducer(state: AutoFixState, action: AutoFixAction): AutoFixState;
|
|
73
237
|
export {};
|
|
74
238
|
//# sourceMappingURL=chat-stream-utilities.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-stream-utilities.d.ts","sourceRoot":"","sources":["../../src/components/chat-stream-utilities.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"chat-stream-utilities.d.ts","sourceRoot":"","sources":["../../src/components/chat-stream-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAClD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAEvD,OAAO,KAAK,EAAkB,YAAY,EAAE,MAAM,8BAA8B,CAAA;AAchF;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,EAAE,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,gBAAgB,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAuBzF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE;IACxC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACl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GAAG,IAAI,CAAA;IACnC,0EAA0E;IAC1E,SAAS,EAAE,gBAAgB,GAAG,IAAI,CAAA;CACnC;AAED,6DAA6D;AAC7D,eAAO,MAAM,aAAa,EAAE,YAAiD,CAAA;AAE7E,gDAAgD;AAChD,MAAM,MAAM,aAAa,GACrB;IACE,6CAA6C;IAC7C,IAAI,EAAE,oBAAoB,CAAA;IAC1B,6CAA6C;IAC7C,MAAM,EAAE,IAAI,GAAG,OAAO,CAAA;IACtB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,yDAAyD;IACzD,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,qDAAqD;IACrD,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,mFAAmF;IACnF,cAAc,EAAE,OAAO,CAAA;CACxB,GACD;IACE,yEAAyE;IACzE,IAAI,EAAE,MAAM,CAAA;CACb,GACD;IACE,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAA;CACb,GACD;IACE,0DAA0D;IAC1D,IAAI,EAAE,OAAO,CAAA;CACd,GACD;IACE,yDAAyD;IACzD,IAAI,EAAE,QAAQ,CAAA;CACf,GACD;IACE,6CAA6C;IAC7C,IAAI,EAAE,QAAQ,CAAA;CACf,GACD;IACE,8EAA8E;IAC9E,IAAI,EAAE,OAAO,CAAA;CACd,CAAA;AAEL;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,GAAG,YAAY,CAyChG"}
|
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Helpers for the live streaming-message indicator (token estimate)
|
|
2
|
+
* Helpers for the live streaming-message indicator (token estimate), the
|
|
3
|
+
* effects a chat stream event produces, and the verification auto-fix countdown.
|
|
4
|
+
*
|
|
5
|
+
* {@link streamEventEffects} turns one stream event into the ordered list of
|
|
6
|
+
* effects the panel applies (a usage update, a compaction card, an activity
|
|
7
|
+
* card, a host callback, a notification sound) so every framework's chat panel
|
|
8
|
+
* derives the same effects from the same event. {@link autoFixCountdownReducer}
|
|
9
|
+
* is the pure state machine behind the auto-fix countdown: it holds the pending
|
|
10
|
+
* verification errors, arms the three-second countdown when the turn ends, and
|
|
11
|
+
* handles tick/pause/resume/cancel. The component owns the side effects — the
|
|
12
|
+
* state setters, the interval, and the auto-sent message.
|
|
3
13
|
*
|
|
4
14
|
* @module
|
|
5
15
|
*/
|
|
16
|
+
import { activityFromEvent } from './activity-utilities.js';
|
|
17
|
+
import { shouldPlaySound } from './chat-settings-utilities.js';
|
|
6
18
|
/**
|
|
7
19
|
* Cache of a tool input's serialized character length, keyed by the input object.
|
|
8
20
|
* A completed tool input is immutable, so we serialize it ONCE and reuse the length
|
|
@@ -100,4 +112,146 @@ export function estimateTurnTokens(messages) {
|
|
|
100
112
|
}
|
|
101
113
|
return total;
|
|
102
114
|
}
|
|
115
|
+
/**
|
|
116
|
+
* Turns one chat stream event into its ordered effects — the framework-neutral
|
|
117
|
+
* half of the panel's stream-event handler. The caller applies each effect to
|
|
118
|
+
* its own React (or port) state, refs and host callbacks.
|
|
119
|
+
*
|
|
120
|
+
* Sender-only effects follow the same rule as the panel: a teammate's pushed
|
|
121
|
+
* `ready_to_build` never boots this client's sandbox, and only a TEAMMATE's
|
|
122
|
+
* `message` note plays the team chime (the sender's own echo is silent).
|
|
123
|
+
*
|
|
124
|
+
* @param event - The stream event.
|
|
125
|
+
* @param state - The panel state the decision reads (sounds config, focus, whether a pushed frame is being applied).
|
|
126
|
+
* @returns The effects to apply, in order.
|
|
127
|
+
*/
|
|
128
|
+
export function streamEventEffects(event, state) {
|
|
129
|
+
const effects = [];
|
|
130
|
+
if ((event.type === 'context_usage' || event.type === 'done') &&
|
|
131
|
+
typeof event.usage?.inputTokens === 'number' &&
|
|
132
|
+
typeof event.usage.contextWindow === 'number') {
|
|
133
|
+
const usage = event.usage;
|
|
134
|
+
effects.push({ type: 'contextUsage', usage, done: event.type === 'done' });
|
|
135
|
+
}
|
|
136
|
+
if (event.type === 'compaction' &&
|
|
137
|
+
typeof event.at === 'string' &&
|
|
138
|
+
typeof event.compactedCount === 'number' &&
|
|
139
|
+
typeof event.elapsedMs === 'number' &&
|
|
140
|
+
typeof event.beforeChars === 'number' &&
|
|
141
|
+
typeof event.afterChars === 'number') {
|
|
142
|
+
const compaction = {
|
|
143
|
+
at: event.at,
|
|
144
|
+
compactedCount: event.compactedCount,
|
|
145
|
+
elapsedMs: event.elapsedMs,
|
|
146
|
+
beforeChars: event.beforeChars,
|
|
147
|
+
afterChars: event.afterChars,
|
|
148
|
+
};
|
|
149
|
+
effects.push({ type: 'compaction', compaction });
|
|
150
|
+
}
|
|
151
|
+
// Captured outbound side effect (email/sms/push/webhook/channel) — push an
|
|
152
|
+
// inline activity card into the timeline.
|
|
153
|
+
if (event.type === 'activity' && event.activity) {
|
|
154
|
+
effects.push({
|
|
155
|
+
type: 'activityCard',
|
|
156
|
+
activity: activityFromEvent(event.activity),
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
// Discovery finished and the server selected a starting point — boot the
|
|
160
|
+
// sandbox. SENDER-ONLY: the sender's client drives the boot.
|
|
161
|
+
if (event.type === 'ready_to_build' && !state.applyingPushed) {
|
|
162
|
+
effects.push({ type: 'readyToBuild' });
|
|
163
|
+
}
|
|
164
|
+
// The agent asked the IDE to reload/navigate the preview, open a file, or drive
|
|
165
|
+
// the preview bridge. Forward EVERY IdeClientAction field.
|
|
166
|
+
if (event.type === 'client_action' && typeof event.action === 'string') {
|
|
167
|
+
const e = event;
|
|
168
|
+
const str = (k) => typeof e[k] === 'string' ? e[k] : undefined;
|
|
169
|
+
effects.push({
|
|
170
|
+
type: 'clientAction',
|
|
171
|
+
action: {
|
|
172
|
+
action: event.action,
|
|
173
|
+
path: str('path'),
|
|
174
|
+
requestId: str('requestId'),
|
|
175
|
+
command: str('command'),
|
|
176
|
+
molId: str('molId'),
|
|
177
|
+
selector: str('selector'),
|
|
178
|
+
text: str('text'),
|
|
179
|
+
value: str('value'),
|
|
180
|
+
},
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
// Turn finished (done OR error) — let the host know.
|
|
184
|
+
if (event.type === 'done' || event.type === 'error') {
|
|
185
|
+
effects.push({ type: 'turnComplete' });
|
|
186
|
+
}
|
|
187
|
+
const cfg = state.soundsConfig;
|
|
188
|
+
const eventType = event.type;
|
|
189
|
+
// 'message' is the team-note ping: it fires only for a TEAMMATE's note
|
|
190
|
+
// (the pushed broadcast) — never for the sender's own SSE echo.
|
|
191
|
+
const isOwnTeamNote = event.type === 'message' && !state.applyingPushed;
|
|
192
|
+
if (!isOwnTeamNote && eventType in cfg && shouldPlaySound(cfg[eventType], state.hasFocus)) {
|
|
193
|
+
effects.push({ type: 'playSound', variant: eventType === 'message' ? 'team' : 'default' });
|
|
194
|
+
}
|
|
195
|
+
return effects;
|
|
196
|
+
}
|
|
197
|
+
/** The idle auto-fix state — the reducer's initial value. */
|
|
198
|
+
export const AUTO_FIX_IDLE = { pending: null, countdown: null };
|
|
199
|
+
/**
|
|
200
|
+
* Pure reducer for the verification auto-fix countdown. Deterministic and
|
|
201
|
+
* side-effect free: the component sends the fix message when a `tick` on the
|
|
202
|
+
* last second clears the countdown, then applies the returned state.
|
|
203
|
+
*
|
|
204
|
+
* @param state - The current auto-fix state.
|
|
205
|
+
* @param action - The action to apply.
|
|
206
|
+
* @returns The next auto-fix state.
|
|
207
|
+
*/
|
|
208
|
+
export function autoFixCountdownReducer(state, action) {
|
|
209
|
+
switch (action.type) {
|
|
210
|
+
case 'verificationResult':
|
|
211
|
+
// SENDER-ONLY arming: a pushed frame from a teammate's turn must not arm
|
|
212
|
+
// this client's auto-fix. A clean result always clears the pending errors.
|
|
213
|
+
if (action.status === 'ok')
|
|
214
|
+
return { ...state, pending: null };
|
|
215
|
+
if (action.applyingPushed || !action.output)
|
|
216
|
+
return state;
|
|
217
|
+
return {
|
|
218
|
+
...state,
|
|
219
|
+
pending: {
|
|
220
|
+
output: action.output,
|
|
221
|
+
categories: action.categories ?? [],
|
|
222
|
+
changedPaths: action.changedPaths ?? [],
|
|
223
|
+
},
|
|
224
|
+
};
|
|
225
|
+
case 'done':
|
|
226
|
+
// When the stream ends, start the countdown if verification errors are pending.
|
|
227
|
+
if (!state.pending)
|
|
228
|
+
return state;
|
|
229
|
+
return { pending: null, countdown: { ...state.pending, secondsLeft: 3, paused: false } };
|
|
230
|
+
case 'tick':
|
|
231
|
+
if (!state.countdown || state.countdown.paused)
|
|
232
|
+
return state;
|
|
233
|
+
if (state.countdown.secondsLeft > 1) {
|
|
234
|
+
return {
|
|
235
|
+
...state,
|
|
236
|
+
countdown: { ...state.countdown, secondsLeft: state.countdown.secondsLeft - 1 },
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
// Last second: the countdown is done; the component sends the fix message.
|
|
240
|
+
return { ...state, countdown: null };
|
|
241
|
+
case 'pause':
|
|
242
|
+
if (!state.countdown || state.countdown.paused)
|
|
243
|
+
return state;
|
|
244
|
+
return { ...state, countdown: { ...state.countdown, paused: true } };
|
|
245
|
+
case 'resume':
|
|
246
|
+
if (!state.countdown)
|
|
247
|
+
return state;
|
|
248
|
+
return { ...state, countdown: { ...state.countdown, paused: false, secondsLeft: 3 } };
|
|
249
|
+
case 'cancel':
|
|
250
|
+
if (!state.countdown)
|
|
251
|
+
return state;
|
|
252
|
+
return { ...state, countdown: null };
|
|
253
|
+
case 'reset':
|
|
254
|
+
return AUTO_FIX_IDLE;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
103
257
|
//# sourceMappingURL=chat-stream-utilities.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-stream-utilities.js","sourceRoot":"","sources":["../../src/components/chat-stream-utilities.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"chat-stream-utilities.js","sourceRoot":"","sources":["../../src/components/chat-stream-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;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