@startsimpli/integrations 0.2.145 → 0.2.146
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/package.json +4 -4
- package/src/__tests__/briefing-actions.test.ts +2 -0
- package/src/__tests__/briefing-reply.test.ts +334 -0
- package/src/__tests__/corpus-tracker.test.tsx +79 -0
- package/src/__tests__/owner-backfill.test.ts +114 -0
- package/src/__tests__/owner-link.test.ts +115 -0
- package/src/__tests__/owner-picker.test.tsx +70 -0
- package/src/__tests__/roster.test.ts +27 -0
- package/src/__tests__/tracker-sort.test.ts +28 -0
- package/src/components/index.ts +1 -0
- package/src/components/pages/TaskDetailPage.tsx +33 -2
- package/src/components/pages/TrackerPage.tsx +28 -6
- package/src/components/pages/task-tracker/OwnerPicker.tsx +82 -0
- package/src/components/pages/tracker/TrackerBoard.tsx +45 -0
- package/src/components/pages/tracker/TrackerToolbar.tsx +44 -0
- package/src/corpus/briefing/actions/execute.ts +5 -4
- package/src/corpus/briefing/actions/log.ts +1 -1
- package/src/corpus/briefing/actions/types.ts +21 -0
- package/src/corpus/briefing/index.ts +1 -0
- package/src/corpus/briefing/intent/model.ts +3 -0
- package/src/corpus/briefing/intent/resolve.ts +14 -6
- package/src/corpus/briefing/intent/types.ts +7 -0
- package/src/corpus/briefing/reply/handle.ts +174 -0
- package/src/corpus/briefing/reply/index.ts +6 -0
- package/src/corpus/briefing/reply/respond.ts +95 -0
- package/src/corpus/briefing/reply/types.ts +112 -0
- package/src/corpus/briefing/store.ts +14 -0
- package/src/corpus/client.ts +16 -18
- package/src/corpus/entities.ts +4 -0
- package/src/corpus/index.ts +4 -0
- package/src/corpus/owner-backfill.ts +200 -0
- package/src/corpus/owner-link.ts +160 -0
- package/src/corpus/roster.ts +53 -0
- package/src/corpus/tracker-groups.ts +8 -4
- package/src/corpus/tracker-sort.ts +51 -0
- package/src/corpus/types.ts +13 -1
- package/src/native/app/FoundryApp.tsx +25 -7
- package/src/native/app/__tests__/briefingLink.test.tsx +57 -0
- package/src/native/app/__tests__/briefingServices.test.ts +92 -0
- package/src/native/app/__tests__/launch.test.ts +2 -1
- package/src/native/app/briefingServices.ts +101 -0
- package/src/native/app/config/__tests__/briefingConfig.test.ts +49 -0
- package/src/native/app/config/links.ts +4 -1
- package/src/native/app/config/types.ts +13 -1
- package/src/native/app/config/validate.ts +20 -2
- package/src/native/app/data.ts +3 -3
- package/src/native/app/device.ts +3 -0
- package/src/native/app/launch.ts +4 -0
- package/src/native/app/registry.tsx +3 -1
- package/src/native/app/screens/RecordScreen.tsx +3 -2
- package/src/native/app/services.ts +11 -30
- package/src/native/app/strings.ts +28 -0
- package/src/native/briefing/BriefingCard.tsx +14 -2
- package/src/native/briefing/BriefingReply.tsx +68 -0
- package/src/native/briefing/__tests__/BriefingReply.test.tsx +144 -0
- package/src/native/briefing/__tests__/fakeReply.test.ts +46 -0
- package/src/native/briefing/__tests__/notify.test.ts +42 -1
- package/src/native/briefing/__tests__/replyApi.test.ts +43 -0
- package/src/native/briefing/__tests__/replyController.test.ts +230 -0
- package/src/native/briefing/__tests__/replyPosition.test.ts +116 -0
- package/src/native/briefing/audioPlayer.ts +9 -2
- package/src/native/briefing/controller.ts +50 -5
- package/src/native/briefing/fake.ts +25 -18
- package/src/native/briefing/fakeReply.ts +65 -0
- package/src/native/briefing/index.ts +8 -3
- package/src/native/briefing/notify.ts +42 -0
- package/src/native/briefing/reply.ts +261 -0
- package/src/native/briefing/replyApi.ts +82 -0
- package/src/native/recording/__tests__/deeplink.test.ts +20 -0
- package/src/native/recording/deeplink.ts +7 -0
- package/src/native/tracker/__tests__/itemsChanged.test.ts +13 -0
- package/src/native/tracker/tab.tsx +4 -1
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import type { ReplyResult } from '../../../corpus/briefing';
|
|
3
|
+
import { createBriefingReplyController } from '../reply';
|
|
4
|
+
import type { PlayerState } from '../audioPlayer';
|
|
5
|
+
|
|
6
|
+
const STRINGS = { micDenied: 'Mic is off.', tooShort: 'Hold while you speak.', notHeard: 'Could not make that out.', failed: 'Did not go through.', noAudio: 'No audio.' };
|
|
7
|
+
|
|
8
|
+
const result = (over: Partial<ReplyResult> = {}): ReplyResult => ({
|
|
9
|
+
kind: 'applied', clientActionId: 'x', utterance: 'push this to friday', understood: 'Move Send the deck to Friday',
|
|
10
|
+
actions: [{ type: 'defer', itemId: 'a', to: '2026-11-06' }], source: 'grammar', confidence: 1, needsConfirm: false,
|
|
11
|
+
results: [{ status: 'applied', spoken: 'Moved Send the deck to Friday.', itemId: 'a' }], question: null,
|
|
12
|
+
confirmation: { text: 'Moved Send the deck to Friday.', audioUrl: '/corpus/briefing/b1/reply/x/audio' }, undoDepth: 1, refresh: true, replayed: false, ...over,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
function setup(opts: { confirm?: 'auto' | 'ask'; permission?: 'granted' | 'denied'; api?: Record<string, unknown>; file?: Record<string, unknown>; allowSilence?: boolean } = {}) {
|
|
16
|
+
const order: string[] = [];
|
|
17
|
+
let n = 0;
|
|
18
|
+
const audio = {
|
|
19
|
+
start: vi.fn(async () => { order.push('audio.start'); }),
|
|
20
|
+
stop: vi.fn(async () => ({ uri: 'file:///r.m4a', durationMs: 1800, bytes: 9000, peakDb: -10, ...opts.file })),
|
|
21
|
+
};
|
|
22
|
+
const briefing = {
|
|
23
|
+
getState: () => ({ briefingId: 'b1', phase: 'playing' }),
|
|
24
|
+
snapshotPosition: vi.fn(() => { order.push('snapshot'); return { seconds: 3, durationSeconds: 10 }; }),
|
|
25
|
+
handoffToRecording: vi.fn(async () => { order.push('handoff'); }),
|
|
26
|
+
resumeAfter: vi.fn(async () => true),
|
|
27
|
+
};
|
|
28
|
+
const api = {
|
|
29
|
+
send: vi.fn(async () => result()),
|
|
30
|
+
confirmationSource: vi.fn(async () => ({ uri: 'http://x/c.mp3' })),
|
|
31
|
+
...opts.api,
|
|
32
|
+
};
|
|
33
|
+
let ps: PlayerState = { phase: 'idle', positionMillis: 0, durationMillis: 0 };
|
|
34
|
+
const ls = new Set<(s: PlayerState) => void>();
|
|
35
|
+
const speaker = {
|
|
36
|
+
getState: () => ps, subscribe: (cb: (s: PlayerState) => void) => { ls.add(cb); return () => ls.delete(cb); },
|
|
37
|
+
play: vi.fn(async () => { order.push('speak'); }), stop: vi.fn(async () => undefined),
|
|
38
|
+
};
|
|
39
|
+
const removeFile = vi.fn(async () => undefined);
|
|
40
|
+
const onChanged = vi.fn();
|
|
41
|
+
const c = createBriefingReplyController({
|
|
42
|
+
briefing: briefing as never, api: api as never, audio, speaker: speaker as never, removeFile,
|
|
43
|
+
ensurePermission: async () => opts.permission ?? 'granted', confirm: opts.confirm ?? 'auto',
|
|
44
|
+
newId: () => `press-${++n}`, strings: STRINGS, onChanged, diag: { log: vi.fn() }, allowSilence: opts.allowSilence,
|
|
45
|
+
});
|
|
46
|
+
return { c, order, audio, briefing, api, speaker, removeFile, onChanged };
|
|
47
|
+
}
|
|
48
|
+
const talk = async (s: ReturnType<typeof setup>) => { await s.c.pressStart(); await s.c.pressEnd(); };
|
|
49
|
+
|
|
50
|
+
describe('push to talk', () => {
|
|
51
|
+
it('test_press_takes_the_position_then_releases_the_session_before_the_mic_starts', async () => {
|
|
52
|
+
const s = setup();
|
|
53
|
+
await s.c.pressStart();
|
|
54
|
+
expect(s.order).toEqual(['snapshot', 'handoff', 'audio.start']);
|
|
55
|
+
expect(s.c.getState().phase).toBe('recording');
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
it('test_release_sends_the_recording_with_the_position_and_a_fresh_id_then_deletes_the_file', async () => {
|
|
59
|
+
const s = setup();
|
|
60
|
+
await talk(s);
|
|
61
|
+
expect(s.api.send).toHaveBeenCalledWith({
|
|
62
|
+
briefingId: 'b1', clientActionId: 'press-1', mode: 'auto', recording: { uri: 'file:///r.m4a', durationMs: 1800 }, position: { seconds: 3, durationSeconds: 10 },
|
|
63
|
+
});
|
|
64
|
+
expect(s.removeFile).toHaveBeenCalledWith('file:///r.m4a');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('test_release_before_the_mic_is_up_still_sends', async () => {
|
|
68
|
+
const s = setup();
|
|
69
|
+
let go!: () => void;
|
|
70
|
+
s.audio.start.mockImplementation(() => new Promise<void>((r) => { go = r; }));
|
|
71
|
+
const pressed = s.c.pressStart();
|
|
72
|
+
await Promise.resolve(); await Promise.resolve(); await Promise.resolve();
|
|
73
|
+
await s.c.pressEnd();
|
|
74
|
+
go();
|
|
75
|
+
await pressed;
|
|
76
|
+
expect(s.api.send).toHaveBeenCalledTimes(1);
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
it('test_a_tap_too_short_to_hold_a_sentence_sends_nothing_and_says_how', async () => {
|
|
80
|
+
const s = setup({ file: { durationMs: 200 } });
|
|
81
|
+
await talk(s);
|
|
82
|
+
expect(s.api.send).not.toHaveBeenCalled();
|
|
83
|
+
expect(s.removeFile).toHaveBeenCalledWith('file:///r.m4a');
|
|
84
|
+
expect(s.c.getState()).toMatchObject({ phase: 'error', error: STRINGS.tooShort, retryable: false });
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it('test_a_silent_recording_is_not_sent', async () => {
|
|
88
|
+
const s = setup({ file: { peakDb: -80 } });
|
|
89
|
+
await talk(s);
|
|
90
|
+
expect(s.api.send).not.toHaveBeenCalled();
|
|
91
|
+
expect(s.c.getState().error).toBe(STRINGS.noAudio);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('test_a_silent_recording_is_sent_when_the_fakes_ignore_the_audio', async () => {
|
|
95
|
+
const s = setup({ file: { peakDb: -80 }, allowSilence: true });
|
|
96
|
+
await talk(s);
|
|
97
|
+
expect(s.api.send).toHaveBeenCalledTimes(1);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
it('test_mic_permission_denied_is_a_message_not_a_recording', async () => {
|
|
101
|
+
const s = setup({ permission: 'denied' });
|
|
102
|
+
await s.c.pressStart();
|
|
103
|
+
expect(s.audio.start).not.toHaveBeenCalled();
|
|
104
|
+
expect(s.c.getState()).toMatchObject({ phase: 'error', error: STRINGS.micDenied });
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
describe('what happens with the answer', () => {
|
|
109
|
+
it('test_auto_mode_shows_the_result_speaks_it_and_offers_undo', async () => {
|
|
110
|
+
const s = setup();
|
|
111
|
+
await talk(s);
|
|
112
|
+
expect(s.c.getState()).toMatchObject({ phase: 'applied', confirmation: 'Moved Send the deck to Friday.', canUndo: true, targetId: 'a', utterance: 'push this to friday' });
|
|
113
|
+
expect(s.speaker.play).toHaveBeenCalledWith({ uri: 'http://x/c.mp3' });
|
|
114
|
+
expect(s.onChanged).toHaveBeenCalledTimes(1);
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
it('test_ask_mode_shows_what_was_understood_before_anything_is_applied_and_apply_sends_the_stored_id', async () => {
|
|
118
|
+
const s = setup({ confirm: 'ask' });
|
|
119
|
+
s.api.send.mockResolvedValueOnce(result({ kind: 'preview', needsConfirm: true, confirmation: null, results: [], undoDepth: 0, refresh: false, clientActionId: 'press-1' }));
|
|
120
|
+
await talk(s);
|
|
121
|
+
expect(s.api.send).toHaveBeenCalledWith(expect.objectContaining({ mode: 'preview' }));
|
|
122
|
+
expect(s.c.getState()).toMatchObject({ phase: 'preview', understood: 'Move Send the deck to Friday', targetId: 'a' });
|
|
123
|
+
expect(s.onChanged).not.toHaveBeenCalled();
|
|
124
|
+
await s.c.apply();
|
|
125
|
+
expect(s.api.send).toHaveBeenLastCalledWith({ briefingId: 'b1', clientActionId: 'press-1', apply: true });
|
|
126
|
+
expect(s.c.getState()).toMatchObject({ phase: 'applied', canUndo: true });
|
|
127
|
+
expect(s.onChanged).toHaveBeenCalledTimes(1);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it('test_cancel_drops_a_preview_without_calling_the_server', async () => {
|
|
131
|
+
const s = setup({ confirm: 'ask' });
|
|
132
|
+
s.api.send.mockResolvedValueOnce(result({ kind: 'preview', needsConfirm: true, confirmation: null, results: [], clientActionId: 'press-1' }));
|
|
133
|
+
await talk(s);
|
|
134
|
+
s.api.send.mockClear();
|
|
135
|
+
await s.c.cancel();
|
|
136
|
+
expect(s.api.send).not.toHaveBeenCalled();
|
|
137
|
+
expect(s.c.getState().phase).toBe('idle');
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
it('test_a_question_is_shown_and_spoken_and_the_next_press_answers_it', async () => {
|
|
141
|
+
const s = setup();
|
|
142
|
+
s.api.send.mockResolvedValueOnce(result({ kind: 'clarify', question: 'Which one: A, or B?', confirmation: { text: 'Which one: A, or B?', audioUrl: '/q' }, results: [{ status: 'asked', spoken: 'Which one: A, or B?' }], actions: [{ type: 'clarify', question: 'Which one: A, or B?' }], refresh: false, undoDepth: 0, clientActionId: 'press-1' }));
|
|
143
|
+
await talk(s);
|
|
144
|
+
expect(s.c.getState()).toMatchObject({ phase: 'asked', question: 'Which one: A, or B?', awaitingAnswer: true, targetId: null });
|
|
145
|
+
expect(s.speaker.play).toHaveBeenCalled();
|
|
146
|
+
expect(s.onChanged).not.toHaveBeenCalled();
|
|
147
|
+
await talk(s);
|
|
148
|
+
expect(s.api.send).toHaveBeenLastCalledWith(expect.objectContaining({ clientActionId: 'press-2', inReplyTo: 'press-1' }));
|
|
149
|
+
expect(s.c.getState().awaitingAnswer).toBe(false);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
it('test_undo_button_sends_undo_and_shows_the_result', async () => {
|
|
153
|
+
const s = setup();
|
|
154
|
+
await talk(s);
|
|
155
|
+
s.api.send.mockResolvedValueOnce(result({ confirmation: { text: 'Undid it. Send the deck is back to Wednesday.', audioUrl: null }, actions: [{ type: 'undo' }], undoDepth: 0 }));
|
|
156
|
+
await s.c.undo();
|
|
157
|
+
expect(s.api.send).toHaveBeenLastCalledWith({ briefingId: 'b1', clientActionId: 'press-2', undo: true });
|
|
158
|
+
expect(s.c.getState()).toMatchObject({ phase: 'applied', confirmation: 'Undid it. Send the deck is back to Wednesday.', canUndo: false });
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
it('test_text_survives_when_the_spoken_confirmation_cannot_play', async () => {
|
|
162
|
+
const s = setup();
|
|
163
|
+
s.speaker.play.mockRejectedValueOnce(new Error('no audio'));
|
|
164
|
+
await talk(s);
|
|
165
|
+
expect(s.c.getState()).toMatchObject({ phase: 'applied', confirmation: 'Moved Send the deck to Friday.' });
|
|
166
|
+
});
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
describe('when it goes wrong', () => {
|
|
170
|
+
it('test_stt_failure_keeps_the_recording_and_retry_resends_the_same_press', async () => {
|
|
171
|
+
const s = setup();
|
|
172
|
+
s.api.send.mockRejectedValueOnce(Object.assign(new Error('x'), { status: 502, code: 'transcription_failed' }));
|
|
173
|
+
await talk(s);
|
|
174
|
+
expect(s.c.getState()).toMatchObject({ phase: 'error', error: STRINGS.notHeard, retryable: true });
|
|
175
|
+
expect(s.removeFile).not.toHaveBeenCalled();
|
|
176
|
+
await s.c.retry();
|
|
177
|
+
expect(s.api.send).toHaveBeenCalledTimes(2);
|
|
178
|
+
expect(s.api.send.mock.calls[1][0]).toMatchObject({ clientActionId: 'press-1', recording: { uri: 'file:///r.m4a', durationMs: 1800 } });
|
|
179
|
+
expect(s.c.getState().phase).toBe('applied');
|
|
180
|
+
expect(s.removeFile).toHaveBeenCalledWith('file:///r.m4a');
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
it('test_cancel_after_a_failure_deletes_the_recording', async () => {
|
|
184
|
+
const s = setup();
|
|
185
|
+
s.api.send.mockRejectedValueOnce(Object.assign(new Error('offline'), { status: 0 }));
|
|
186
|
+
await talk(s);
|
|
187
|
+
expect(s.c.getState()).toMatchObject({ phase: 'error', error: STRINGS.failed, retryable: true });
|
|
188
|
+
await s.c.cancel();
|
|
189
|
+
expect(s.removeFile).toHaveBeenCalledWith('file:///r.m4a');
|
|
190
|
+
expect(s.c.getState().phase).toBe('idle');
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
it('test_a_failed_apply_or_undo_can_be_tried_again', async () => {
|
|
194
|
+
const s = setup({ confirm: 'ask' });
|
|
195
|
+
s.api.send.mockResolvedValueOnce(result({ kind: 'preview', needsConfirm: true, confirmation: null, results: [], clientActionId: 'press-1' }));
|
|
196
|
+
await talk(s);
|
|
197
|
+
s.api.send.mockRejectedValueOnce(Object.assign(new Error('offline'), { status: 0 }));
|
|
198
|
+
await s.c.apply();
|
|
199
|
+
expect(s.c.getState()).toMatchObject({ phase: 'error', retryable: true });
|
|
200
|
+
await s.c.retry();
|
|
201
|
+
expect(s.c.getState().phase).toBe('applied');
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
it('test_a_conflict_on_apply_says_to_try_again_from_the_top', async () => {
|
|
205
|
+
const s = setup({ confirm: 'ask' });
|
|
206
|
+
s.api.send.mockResolvedValueOnce(result({ kind: 'preview', needsConfirm: true, confirmation: null, results: [], clientActionId: 'press-1' }));
|
|
207
|
+
await talk(s);
|
|
208
|
+
s.api.send.mockRejectedValueOnce(Object.assign(new Error('That reply is no longer waiting. Say it again.'), { status: 409 }));
|
|
209
|
+
await s.c.apply();
|
|
210
|
+
expect(s.c.getState()).toMatchObject({ phase: 'error', error: 'That reply is no longer waiting. Say it again.', retryable: false });
|
|
211
|
+
});
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
describe('carrying on', () => {
|
|
215
|
+
it('test_continue_resumes_the_briefing_after_the_answered_item_and_clears_the_reply', async () => {
|
|
216
|
+
const s = setup();
|
|
217
|
+
await talk(s);
|
|
218
|
+
await s.c.continueBriefing();
|
|
219
|
+
expect(s.speaker.stop).toHaveBeenCalled();
|
|
220
|
+
expect(s.briefing.resumeAfter).toHaveBeenCalledWith('a');
|
|
221
|
+
expect(s.c.getState().phase).toBe('idle');
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
it('test_pressing_again_cuts_off_the_spoken_confirmation_first', async () => {
|
|
225
|
+
const s = setup();
|
|
226
|
+
await talk(s);
|
|
227
|
+
await s.c.pressStart();
|
|
228
|
+
expect(s.speaker.stop).toHaveBeenCalled();
|
|
229
|
+
});
|
|
230
|
+
});
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import type { BriefingResult } from '../../../corpus/briefing';
|
|
3
|
+
import { createBriefingController } from '../controller';
|
|
4
|
+
import { createAudioPlayer, type AudioPlayerDriver } from '../audioPlayer';
|
|
5
|
+
import type { PlayerState } from '../audioPlayer';
|
|
6
|
+
|
|
7
|
+
const TEXT = 'Good morning. Send the deck. Call Dana. That is everything.';
|
|
8
|
+
const result: BriefingResult = {
|
|
9
|
+
briefingId: 'b1', text: TEXT, audioUrl: '/a',
|
|
10
|
+
items: [{ id: 'a', title: 'Send the deck', kind: 'due_today', group: 'L', dueDate: null }, { id: 'b', title: 'Call Dana', kind: 'due_today', group: 'L', dueDate: null }],
|
|
11
|
+
remaining: 0, context: { itemIds: ['a', 'b'], localDate: '2026-11-05', timeZone: 'UTC', offsets: [{ id: 'a', start: 14, end: 28 }, { id: 'b', start: 29, end: 39 }] }, scriptSource: 'llm', cached: false, ms: 1,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function setup() {
|
|
15
|
+
let ps: PlayerState = { phase: 'idle', positionMillis: 0, durationMillis: 0 };
|
|
16
|
+
const ls = new Set<(s: PlayerState) => void>();
|
|
17
|
+
const emit = (p: Partial<PlayerState>) => { ps = { ...ps, ...p }; ls.forEach((l) => l(ps)); };
|
|
18
|
+
const player = {
|
|
19
|
+
getState: () => ps, subscribe: (cb: (s: PlayerState) => void) => { ls.add(cb); return () => ls.delete(cb); },
|
|
20
|
+
play: vi.fn(async (_s: unknown, _o?: unknown) => { emit({ phase: 'playing', durationMillis: 10_000, positionMillis: 0 }); }),
|
|
21
|
+
stop: vi.fn(async () => { emit({ phase: 'idle' }); }),
|
|
22
|
+
handoffToRecording: vi.fn(async () => { emit({ phase: 'idle', positionMillis: 0 }); }),
|
|
23
|
+
};
|
|
24
|
+
const controller = createBriefingController({
|
|
25
|
+
api: { fetch: async () => result, audioSource: async () => ({ uri: 'http://x/a' }) } as never, player: player as never,
|
|
26
|
+
messages: { failed: 'f', empty: 'e', textOnly: 't', audioFailed: 'a' },
|
|
27
|
+
});
|
|
28
|
+
return { controller, player, emit };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
describe('where the briefing was at the press', () => {
|
|
32
|
+
it('test_the_briefing_id_is_in_the_state_for_the_reply', async () => {
|
|
33
|
+
const s = setup();
|
|
34
|
+
expect(s.controller.getState().briefingId).toBeNull();
|
|
35
|
+
await s.controller.start();
|
|
36
|
+
expect(s.controller.getState().briefingId).toBe('b1');
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('test_position_is_taken_from_the_player_and_kept_after_the_handoff_resets_it', async () => {
|
|
40
|
+
const s = setup();
|
|
41
|
+
await s.controller.start();
|
|
42
|
+
s.emit({ positionMillis: 5200 });
|
|
43
|
+
expect(s.controller.snapshotPosition()).toEqual({ seconds: 5.2, durationSeconds: 10 });
|
|
44
|
+
await s.controller.handoffToRecording();
|
|
45
|
+
expect(s.controller.snapshotPosition()).toEqual({ seconds: 5.2, durationSeconds: 10 });
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('test_no_position_before_anything_has_played', () => {
|
|
49
|
+
expect(setup().controller.snapshotPosition()).toBeNull();
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('test_continue_plays_from_the_item_after_the_answered_one', async () => {
|
|
53
|
+
const s = setup();
|
|
54
|
+
await s.controller.start();
|
|
55
|
+
s.emit({ positionMillis: 3000 });
|
|
56
|
+
s.controller.snapshotPosition();
|
|
57
|
+
await s.controller.handoffToRecording();
|
|
58
|
+
expect(await s.controller.resumeAfter('a')).toBe(true);
|
|
59
|
+
// item b starts at char 29 of 59 -> 49% of 10 s
|
|
60
|
+
expect(s.player.play).toHaveBeenLastCalledWith({ uri: 'http://x/a' }, { startAtMillis: Math.round((29 / 59) * 10_000) });
|
|
61
|
+
expect(s.controller.getState().phase).toBe('playing');
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('test_continue_after_the_last_item_has_nothing_left_to_read', async () => {
|
|
65
|
+
const s = setup();
|
|
66
|
+
await s.controller.start();
|
|
67
|
+
s.emit({ positionMillis: 8000 });
|
|
68
|
+
s.controller.snapshotPosition();
|
|
69
|
+
await s.controller.handoffToRecording();
|
|
70
|
+
const calls = s.player.play.mock.calls.length;
|
|
71
|
+
expect(await s.controller.resumeAfter('b')).toBe(false);
|
|
72
|
+
expect(s.player.play.mock.calls.length).toBe(calls);
|
|
73
|
+
expect(s.controller.getState().phase).toBe('ended');
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('test_continue_with_no_item_resumes_where_it_was', async () => {
|
|
77
|
+
const s = setup();
|
|
78
|
+
await s.controller.start();
|
|
79
|
+
s.emit({ positionMillis: 3000 });
|
|
80
|
+
s.controller.snapshotPosition();
|
|
81
|
+
await s.controller.handoffToRecording();
|
|
82
|
+
await s.controller.resumeAfter(null);
|
|
83
|
+
expect(s.player.play).toHaveBeenLastCalledWith({ uri: 'http://x/a' }, { startAtMillis: 3000 });
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
describe('the player can start part-way in', () => {
|
|
88
|
+
function player(seek: boolean) {
|
|
89
|
+
const order: string[] = [];
|
|
90
|
+
const driver: AudioPlayerDriver = {
|
|
91
|
+
configureSession: async () => { order.push('configure'); }, load: () => { order.push('load'); },
|
|
92
|
+
play: () => { order.push('play'); }, pause: () => undefined, release: async () => undefined,
|
|
93
|
+
status: () => ({ playing: true, loaded: true, positionMillis: 1, durationMillis: 10_000, ended: false }),
|
|
94
|
+
...(seek ? { seekTo: async (ms: number) => { order.push(`seek ${ms}`); } } : {}),
|
|
95
|
+
};
|
|
96
|
+
const p = createAudioPlayer({
|
|
97
|
+
driver, session: { info: async () => ({ category: 'playback', mode: 'default', options: [], sampleRate: 48000, inputs: [] }), onInterruption: () => () => undefined, onRouteChange: () => () => undefined },
|
|
98
|
+
poll: () => () => undefined, sleep: async () => undefined, diag: { log: () => undefined }, stepTimeoutMs: 30,
|
|
99
|
+
});
|
|
100
|
+
return { p, order };
|
|
101
|
+
}
|
|
102
|
+
it('test_seeks_after_load_and_before_play', async () => {
|
|
103
|
+
const { p, order } = player(true);
|
|
104
|
+
await p.play({ uri: 'x' }, { startAtMillis: 4900 });
|
|
105
|
+
expect(order).toEqual(['configure', 'load', 'seek 4900', 'play']);
|
|
106
|
+
});
|
|
107
|
+
it('test_without_a_start_it_does_not_seek', async () => {
|
|
108
|
+
const { p, order } = player(true);
|
|
109
|
+
await p.play({ uri: 'x' });
|
|
110
|
+
expect(order).toEqual(['configure', 'load', 'play']);
|
|
111
|
+
});
|
|
112
|
+
it('test_a_driver_that_cannot_seek_fails_loudly_rather_than_replaying_from_the_top', async () => {
|
|
113
|
+
const { p } = player(false);
|
|
114
|
+
await expect(p.play({ uri: 'x' }, { startAtMillis: 4900 })).rejects.toThrow(/part-way/);
|
|
115
|
+
});
|
|
116
|
+
});
|
|
@@ -26,6 +26,8 @@ export interface AudioPlayerDriver {
|
|
|
26
26
|
/** Builds a NEW player on the source (a previous one is released first by the caller). */
|
|
27
27
|
load(source: PlaybackSource): void;
|
|
28
28
|
play(): void;
|
|
29
|
+
/** Jump to a position (ms) in the loaded source. Optional: without it a player can only start from the beginning. */
|
|
30
|
+
seekTo?(millis: number): Promise<void> | void;
|
|
29
31
|
pause(): void;
|
|
30
32
|
/** Removes the player so the session is free for the recorder. */
|
|
31
33
|
release(): Promise<void>;
|
|
@@ -107,8 +109,8 @@ export function createAudioPlayer(deps: {
|
|
|
107
109
|
return () => { listeners.delete(cb); };
|
|
108
110
|
},
|
|
109
111
|
|
|
110
|
-
/**
|
|
111
|
-
async play(source: PlaybackSource): Promise<void> {
|
|
112
|
+
/** From the start of the source, or from `startAtMillis` when the driver can seek. */
|
|
113
|
+
async play(source: PlaybackSource, options: { startAtMillis?: number } = {}): Promise<void> {
|
|
112
114
|
await release();
|
|
113
115
|
set({ phase: 'loading', positionMillis: 0, durationMillis: 0 });
|
|
114
116
|
try {
|
|
@@ -116,6 +118,11 @@ export function createAudioPlayer(deps: {
|
|
|
116
118
|
step = 'load';
|
|
117
119
|
live = true;
|
|
118
120
|
deps.driver.load(source);
|
|
121
|
+
if (options.startAtMillis && options.startAtMillis > 0) {
|
|
122
|
+
step = 'seek';
|
|
123
|
+
if (!deps.driver.seekTo) throw new Error('this player cannot start part-way in');
|
|
124
|
+
await guarded('seek', Promise.resolve(deps.driver.seekTo(options.startAtMillis)));
|
|
125
|
+
}
|
|
119
126
|
step = 'play';
|
|
120
127
|
deps.driver.play();
|
|
121
128
|
await guarded('start', startAudible());
|
|
@@ -10,6 +10,8 @@ export type BriefingPhase = 'idle' | 'loading' | 'playing' | 'paused' | 'ended'
|
|
|
10
10
|
|
|
11
11
|
export interface BriefingState {
|
|
12
12
|
phase: BriefingPhase;
|
|
13
|
+
/** The tenant row of the briefing on screen (what a spoken reply is a reply to), or null before one is loaded. */
|
|
14
|
+
briefingId: string | null;
|
|
13
15
|
text: string;
|
|
14
16
|
items: BriefingEntry[];
|
|
15
17
|
/** The item being spoken right now (from the playback position), or null for greeting and sign-off. */
|
|
@@ -36,12 +38,12 @@ export interface BriefingApi {
|
|
|
36
38
|
export interface BriefingPlayer {
|
|
37
39
|
getState(): PlayerState;
|
|
38
40
|
subscribe(cb: (s: PlayerState) => void): () => void;
|
|
39
|
-
play(source: PlaybackSource): Promise<void>;
|
|
41
|
+
play(source: PlaybackSource, options?: { startAtMillis?: number }): Promise<void>;
|
|
40
42
|
stop(): Promise<void>;
|
|
41
43
|
handoffToRecording(): Promise<void>;
|
|
42
44
|
}
|
|
43
45
|
|
|
44
|
-
const BLANK: BriefingState = { phase: 'idle', text: '', items: [], currentId: null, note: null, error: null, empty: false, offsets: [] };
|
|
46
|
+
const BLANK: BriefingState = { phase: 'idle', briefingId: null, text: '', items: [], currentId: null, note: null, error: null, empty: false, offsets: [] };
|
|
45
47
|
|
|
46
48
|
export function createBriefingController(deps: {
|
|
47
49
|
api: BriefingApi;
|
|
@@ -61,6 +63,9 @@ export function createBriefingController(deps: {
|
|
|
61
63
|
listeners.forEach((l) => l());
|
|
62
64
|
};
|
|
63
65
|
const dayKey = () => new Date(now()).toDateString();
|
|
66
|
+
/** Where playback was at the last reply press: the handoff zeroes the player, the reply still needs it. */
|
|
67
|
+
let lastPosition: BriefingPosition | null = null;
|
|
68
|
+
let lastDurationMillis = 0;
|
|
64
69
|
|
|
65
70
|
const currentOf = (p: PlayerState): string | null => {
|
|
66
71
|
if (!current || !p.durationMillis || p.positionMillis <= 0) return null;
|
|
@@ -69,6 +74,7 @@ export function createBriefingController(deps: {
|
|
|
69
74
|
};
|
|
70
75
|
|
|
71
76
|
deps.player.subscribe((p) => {
|
|
77
|
+
if (p.durationMillis > 0) lastDurationMillis = p.durationMillis;
|
|
72
78
|
if (!current || busy) return;
|
|
73
79
|
if (p.phase === 'playing') set({ phase: 'playing', currentId: currentOf(p) });
|
|
74
80
|
else if (p.phase === 'paused') set({ phase: 'paused' });
|
|
@@ -76,12 +82,12 @@ export function createBriefingController(deps: {
|
|
|
76
82
|
else if (p.phase === 'failed') set({ phase: 'text', note: deps.messages.audioFailed, currentId: null });
|
|
77
83
|
});
|
|
78
84
|
|
|
79
|
-
async function playCurrent(): Promise<void> {
|
|
85
|
+
async function playCurrent(startAtMillis?: number): Promise<void> {
|
|
80
86
|
if (!current) return;
|
|
81
87
|
const source = await deps.api.audioSource(current);
|
|
82
88
|
if (!source) { set({ phase: 'text', note: deps.messages.textOnly, currentId: null }); return; }
|
|
83
89
|
try {
|
|
84
|
-
await deps.player.play(source);
|
|
90
|
+
await (startAtMillis ? deps.player.play(source, { startAtMillis }) : deps.player.play(source));
|
|
85
91
|
set({ phase: 'playing', currentId: null, note: state.empty ? deps.messages.empty : null });
|
|
86
92
|
} catch (e) {
|
|
87
93
|
deps.diag?.log('briefing.play-failed', { error: e instanceof Error ? e.message : String(e) });
|
|
@@ -113,7 +119,7 @@ export function createBriefingController(deps: {
|
|
|
113
119
|
}
|
|
114
120
|
current = cache.result;
|
|
115
121
|
set({
|
|
116
|
-
text: current.text, items: current.items, offsets: current.context.offsets, error: null, currentId: null,
|
|
122
|
+
briefingId: current.briefingId, text: current.text, items: current.items, offsets: current.context.offsets, error: null, currentId: null,
|
|
117
123
|
empty: current.items.length === 0, note: current.items.length === 0 ? deps.messages.empty : null, phase: 'loading',
|
|
118
124
|
});
|
|
119
125
|
await playCurrent();
|
|
@@ -133,6 +139,39 @@ export function createBriefingController(deps: {
|
|
|
133
139
|
try { await playCurrent(); } finally { busy = false; }
|
|
134
140
|
},
|
|
135
141
|
|
|
142
|
+
/**
|
|
143
|
+
* Where the briefing is right now, for a spoken reply ("this one" is the item being read). Taken BEFORE the handoff
|
|
144
|
+
* (which resets the player) and kept, so a second press after the first reply still knows where the person was.
|
|
145
|
+
*/
|
|
146
|
+
snapshotPosition(): BriefingPosition | null {
|
|
147
|
+
const p = deps.player.getState();
|
|
148
|
+
if ((p.phase === 'playing' || p.phase === 'paused' || p.phase === 'ended') && p.durationMillis > 0) {
|
|
149
|
+
lastPosition = { seconds: p.positionMillis / 1000, durationSeconds: p.durationMillis / 1000 };
|
|
150
|
+
}
|
|
151
|
+
return lastPosition;
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Carry on after a reply: from the item AFTER `itemId` (the one just answered), or from where it was when there is no
|
|
156
|
+
* item. Resolves false when there is nothing left to read. Needs a player that can seek.
|
|
157
|
+
*/
|
|
158
|
+
async resumeAfter(itemId: string | null): Promise<boolean> {
|
|
159
|
+
if (!current || busy) return false;
|
|
160
|
+
const duration = (lastPosition?.durationSeconds ?? 0) * 1000 || lastDurationMillis;
|
|
161
|
+
let startAt: number;
|
|
162
|
+
if (itemId) {
|
|
163
|
+
const at = state.offsets.findIndex((o) => o.id === itemId);
|
|
164
|
+
const next = at >= 0 ? state.offsets[at + 1] : undefined;
|
|
165
|
+
if (!next || !duration) { set({ phase: 'ended', currentId: null }); return false; }
|
|
166
|
+
startAt = Math.round((next.start / Math.max(1, current.text.length)) * duration);
|
|
167
|
+
} else {
|
|
168
|
+
startAt = Math.round((lastPosition?.seconds ?? 0) * 1000);
|
|
169
|
+
}
|
|
170
|
+
busy = true;
|
|
171
|
+
try { await playCurrent(startAt); } finally { busy = false; }
|
|
172
|
+
return true;
|
|
173
|
+
},
|
|
174
|
+
|
|
136
175
|
/** The reply press: playback ends and the session is released for the recorder. */
|
|
137
176
|
async handoffToRecording(): Promise<void> {
|
|
138
177
|
if (state.phase !== 'playing' && state.phase !== 'paused') return;
|
|
@@ -142,6 +181,12 @@ export function createBriefingController(deps: {
|
|
|
142
181
|
};
|
|
143
182
|
}
|
|
144
183
|
|
|
184
|
+
/** Where playback was: seconds played of the whole. */
|
|
185
|
+
export interface BriefingPosition {
|
|
186
|
+
seconds: number;
|
|
187
|
+
durationSeconds: number;
|
|
188
|
+
}
|
|
189
|
+
|
|
145
190
|
export type BriefingController = ReturnType<typeof createBriefingController>;
|
|
146
191
|
|
|
147
192
|
/** The text cut into plain and current parts, for rendering the spoken item emphasised. Every character survives. */
|
|
@@ -4,29 +4,36 @@ import type { BriefingApi } from './controller';
|
|
|
4
4
|
|
|
5
5
|
const TEXT = "Good morning. You have three things on your plate today. Send Dana the take-home assignment, it is overdue. Review the launch checklist, due today. Book the car service. That is everything.";
|
|
6
6
|
|
|
7
|
+
const at = (needle: string) => { const start = TEXT.indexOf(needle); return { start, end: start + needle.length }; };
|
|
8
|
+
|
|
9
|
+
/** The fixed briefing `-tgFakeBriefing` returns (without audio). */
|
|
10
|
+
export const FAKE_BRIEFING: BriefingResult = {
|
|
11
|
+
briefingId: 'fake-briefing',
|
|
12
|
+
text: TEXT,
|
|
13
|
+
audioUrl: 'fixture://briefing',
|
|
14
|
+
items: [
|
|
15
|
+
{ id: 't1', title: 'Send Dana the take-home assignment', kind: 'overdue', group: 'Hiring', dueDate: '2026-11-03' },
|
|
16
|
+
{ id: 't2', title: 'Review the launch checklist', kind: 'due_today', group: 'Launch', dueDate: '2026-11-05' },
|
|
17
|
+
{ id: 't3', title: 'Book the car service', kind: 'in_progress', group: 'Personal', dueDate: null },
|
|
18
|
+
],
|
|
19
|
+
remaining: 0,
|
|
20
|
+
context: {
|
|
21
|
+
itemIds: ['t1', 't2', 't3'], localDate: '2026-11-05', timeZone: 'UTC',
|
|
22
|
+
offsets: [
|
|
23
|
+
{ id: 't1', ...at('Send Dana the take-home assignment, it is overdue.') },
|
|
24
|
+
{ id: 't2', ...at('Review the launch checklist, due today.') },
|
|
25
|
+
{ id: 't3', ...at('Book the car service.') },
|
|
26
|
+
],
|
|
27
|
+
},
|
|
28
|
+
scriptSource: 'template', cached: false, ms: 0,
|
|
29
|
+
};
|
|
30
|
+
|
|
7
31
|
/** The fixed briefing `-tgFakeBriefing` returns: no network, no sign-in. `clip` is the bundled audio it plays. */
|
|
8
32
|
export function createFakeBriefingApi(clip: PlaybackSource | undefined, delayMs = 400): BriefingApi {
|
|
9
|
-
const at = (needle: string) => { const start = TEXT.indexOf(needle); return { start, end: start + needle.length }; };
|
|
10
33
|
const result: BriefingResult = {
|
|
11
|
-
|
|
12
|
-
text: TEXT,
|
|
34
|
+
...FAKE_BRIEFING, ms: delayMs,
|
|
13
35
|
audioUrl: clip ? 'fixture://briefing' : null,
|
|
14
36
|
...(clip ? {} : { audioReason: 'No fixture audio is bundled.' }),
|
|
15
|
-
items: [
|
|
16
|
-
{ id: 't1', title: 'Send Dana the take-home assignment', kind: 'overdue', group: 'Hiring', dueDate: '2026-11-03' },
|
|
17
|
-
{ id: 't2', title: 'Review the launch checklist', kind: 'due_today', group: 'Launch', dueDate: '2026-11-05' },
|
|
18
|
-
{ id: 't3', title: 'Book the car service', kind: 'in_progress', group: 'Personal', dueDate: null },
|
|
19
|
-
],
|
|
20
|
-
remaining: 0,
|
|
21
|
-
context: {
|
|
22
|
-
itemIds: ['t1', 't2', 't3'], localDate: '2026-11-05', timeZone: 'UTC',
|
|
23
|
-
offsets: [
|
|
24
|
-
{ id: 't1', ...at('Send Dana the take-home assignment, it is overdue.') },
|
|
25
|
-
{ id: 't2', ...at('Review the launch checklist, due today.') },
|
|
26
|
-
{ id: 't3', ...at('Book the car service.') },
|
|
27
|
-
],
|
|
28
|
-
},
|
|
29
|
-
scriptSource: 'template', cached: false, ms: delayMs,
|
|
30
37
|
};
|
|
31
38
|
return {
|
|
32
39
|
fetch: () => new Promise((resolve) => setTimeout(() => resolve(result), delayMs)),
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { createMemoryActionLog, commitmentEditSeam, handleBriefingReply, type BriefingItem, type BriefingRecord, type BriefingStore } from '../../corpus/briefing';
|
|
2
|
+
import type { TenantEntity } from '../../corpus/entities';
|
|
3
|
+
import type { FakeNativeCorpusApi } from '../corpus/fake';
|
|
4
|
+
import { FAKE_BRIEFING } from './fake';
|
|
5
|
+
import type { BriefingReplyApi } from './replyApi';
|
|
6
|
+
|
|
7
|
+
/** The to-dos the fixed fake briefing is about, so a spoken reply to it has real rows to change (and the Tracker tab shows the change). */
|
|
8
|
+
export function fakeBriefingRows(): TenantEntity[] {
|
|
9
|
+
const row = (id: string, title: string, due: string | null, extra: Record<string, unknown> = {}): TenantEntity => ({
|
|
10
|
+
id, entity_type: 'commitment', external_id: `commit:${id}`, name: title, created_at: '2026-11-03T09:00:00Z', org_id: 'tandem',
|
|
11
|
+
data: { title, subtype: 'action', status: 'open', owner_name: 'Quinn', source: 'voice', source_label: 'Voice note', mentions: [], ...(due ? { due_at: `${due}T17:00:00Z` } : {}), ...extra },
|
|
12
|
+
});
|
|
13
|
+
return [
|
|
14
|
+
row('t1', 'Send Dana the take-home assignment', '2026-11-03'),
|
|
15
|
+
row('t2', 'Review the launch checklist', '2026-11-05'),
|
|
16
|
+
row('t3', 'Book the car service', null),
|
|
17
|
+
];
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* `-tgFakeReply "<what is said>|<the next thing>"`: the REAL reply route logic (intent grammar, executor, undo, spoken
|
|
22
|
+
* text) over the fake tenant, with the transcription replaced by the script. Each recording consumes the next line, so a
|
|
23
|
+
* flow can say a thing, get asked, and answer. No model, no network, no speech: the confirmation is text only.
|
|
24
|
+
*/
|
|
25
|
+
export function createFakeBriefingReplyApi(deps: { corpus: FakeNativeCorpusApi; script: string[]; now?: () => number }): BriefingReplyApi {
|
|
26
|
+
const ownerSub = 'fake-me';
|
|
27
|
+
const lines = deps.script.length ? deps.script : ['move this one to later'];
|
|
28
|
+
let heard = 0;
|
|
29
|
+
const record: BriefingRecord = {
|
|
30
|
+
id: FAKE_BRIEFING.briefingId, externalId: `briefing:${FAKE_BRIEFING.context.localDate}:${ownerSub}`, localDate: FAKE_BRIEFING.context.localDate,
|
|
31
|
+
contentHash: 'fake', text: FAKE_BRIEFING.text, scriptSource: 'template', items: FAKE_BRIEFING.items, remaining: 0,
|
|
32
|
+
context: { ...FAKE_BRIEFING.context }, createdAt: '2026-11-05T12:00:00Z',
|
|
33
|
+
};
|
|
34
|
+
const store: BriefingStore = {
|
|
35
|
+
find: async () => null,
|
|
36
|
+
get: async (id) => (id === record.id ? record : null),
|
|
37
|
+
save: async (draft) => ({ ...draft, id: record.id }),
|
|
38
|
+
};
|
|
39
|
+
const scope = { orgId: 'tandem' } as never;
|
|
40
|
+
const http = deps.corpus.tenant.http;
|
|
41
|
+
const log = createMemoryActionLog();
|
|
42
|
+
return {
|
|
43
|
+
async send(request) {
|
|
44
|
+
return handleBriefingReply({
|
|
45
|
+
http, ownerSub, store, log,
|
|
46
|
+
seam: commitmentEditSeam({ api: deps.corpus.corpus as never, http, scope }),
|
|
47
|
+
loadItems: async (): Promise<BriefingItem[]> => [],
|
|
48
|
+
transcribe: async () => lines[Math.min(heard++, lines.length - 1)],
|
|
49
|
+
now: deps.now,
|
|
50
|
+
timeZone: 'UTC',
|
|
51
|
+
intentLlm: null,
|
|
52
|
+
}, {
|
|
53
|
+
subject: { kind: 'briefing', id: request.briefingId },
|
|
54
|
+
clientActionId: request.clientActionId,
|
|
55
|
+
...(request.recording ? { audio: { audio: new Uint8Array([0]), mimeType: 'audio/mp4' } } : {}),
|
|
56
|
+
...(request.position ? { position: request.position } : {}),
|
|
57
|
+
...(request.mode ? { mode: request.mode } : {}),
|
|
58
|
+
...(request.apply ? { apply: true } : {}),
|
|
59
|
+
...(request.undo ? { undo: true } : {}),
|
|
60
|
+
...(request.inReplyTo ? { inReplyTo: request.inReplyTo } : {}),
|
|
61
|
+
});
|
|
62
|
+
},
|
|
63
|
+
confirmationSource: async () => null,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
@@ -2,8 +2,13 @@ export { createAudioPlayer } from './audioPlayer';
|
|
|
2
2
|
export type { AudioPlayer, AudioPlayerDriver, PlaybackSource, PlaybackStatus, PlayerPhase, PlayerState } from './audioPlayer';
|
|
3
3
|
export { createBriefingApi } from './api';
|
|
4
4
|
export { createBriefingController, transcriptParts } from './controller';
|
|
5
|
-
export type { BriefingApi, BriefingController, BriefingMessages, BriefingPhase, BriefingPlayer, BriefingState } from './controller';
|
|
5
|
+
export type { BriefingApi, BriefingController, BriefingPosition, BriefingMessages, BriefingPhase, BriefingPlayer, BriefingState } from './controller';
|
|
6
6
|
export { createFakeBriefingApi } from './fake';
|
|
7
7
|
export { BriefingCard } from './BriefingCard';
|
|
8
|
-
export { planMorningNotification, syncMorningNotification } from './notify';
|
|
9
|
-
export type { MorningNotifier, NotificationPlan } from './notify';
|
|
8
|
+
export { pickMorningSchedule, planMorningNotification, syncMorningFromCentral, syncMorningNotification } from './notify';
|
|
9
|
+
export type { MorningNotifier, MorningSchedule, NotificationPlan } from './notify';
|
|
10
|
+
export { BriefingReply } from './BriefingReply';
|
|
11
|
+
export { createBriefingReplyApi } from './replyApi';
|
|
12
|
+
export type { BriefingReplyApi, ReplySend } from './replyApi';
|
|
13
|
+
export { createBriefingReplyController } from './reply';
|
|
14
|
+
export type { BriefingReplyController, ReplyMessages, ReplyPhase, ReplyState } from './reply';
|