@startsimpli/integrations 0.2.123 → 0.2.124

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@startsimpli/integrations",
3
- "version": "0.2.123",
3
+ "version": "0.2.124",
4
4
  "description": "Provider-agnostic types, API clients, hooks, and UI primitives for email + calendar integrations across StartSimpli apps, plus foundry customer email (subpath ./comms).",
5
5
  "license": "MIT",
6
6
  "homepage": "https://startsimpli.com",
@@ -99,10 +99,10 @@
99
99
  "react-native": "0.85.3",
100
100
  "react-native-safe-area-context": "~5.7.0",
101
101
  "@startsimpli/llm": "0.4.30",
102
- "@startsimpli/ui": "0.4.171",
103
102
  "@startsimpli/ui-native": "0.1.14",
104
- "@startsimpli/utils": "0.4.17",
105
- "@startsimpli/auth": "0.4.50"
103
+ "@startsimpli/auth": "0.4.50",
104
+ "@startsimpli/ui": "0.4.171",
105
+ "@startsimpli/utils": "0.4.17"
106
106
  },
107
107
  "scripts": {
108
108
  "type-check": "tsc --noEmit && tsc --noEmit -p tsconfig.native.json",
@@ -22,12 +22,13 @@ function setup(over: { playing?: boolean } = {}) {
22
22
  onInterruption: (cb) => { listeners.interruption = cb; return () => { listeners.interruption = undefined; }; },
23
23
  onRouteChange: (cb) => { listeners.route = cb; return () => { listeners.route = undefined; }; },
24
24
  };
25
+ const sleep = vi.fn(async (_ms: number) => undefined);
25
26
  let tick: (() => void) | undefined;
26
27
  const diag = { log: vi.fn() };
27
28
  const player = createAudioPlayer({
28
29
  driver, session, diag,
29
30
  poll: (fn) => { tick = fn; return () => { tick = undefined; }; },
30
- sleep: async () => undefined,
31
+ sleep,
31
32
  stepTimeoutMs: 30,
32
33
  });
33
34
  const recorderDriver: AudioDriver = {
@@ -43,7 +44,7 @@ function setup(over: { playing?: boolean } = {}) {
43
44
  sleep: async () => undefined, diag, onInterrupted: vi.fn(),
44
45
  });
45
46
  return {
46
- player, driver, order, diag, listeners, recorder, tick: () => tick?.(),
47
+ player, driver, order, diag, sleep, listeners, recorder, tick: () => tick?.(),
47
48
  setStatus: (s: Partial<PlaybackStatus>) => { status = { ...status, ...s }; },
48
49
  category: () => category,
49
50
  };
@@ -71,6 +72,15 @@ describe('briefing playback and the recorder share one audio session', () => {
71
72
  ]);
72
73
  });
73
74
 
75
+ it('waits for the OS to settle after releasing the player, before the recorder may start (a start 200 ms after playback failed on the simulator)', async () => {
76
+ const s = setup();
77
+ await s.player.play(SOURCE);
78
+ s.sleep.mockClear();
79
+ await s.player.handoffToRecording();
80
+ expect(s.sleep).toHaveBeenCalledWith(expect.any(Number));
81
+ expect(Math.max(...s.sleep.mock.calls.map((c) => c[0]))).toBeGreaterThanOrEqual(500);
82
+ });
83
+
74
84
  it('logs the session before and after the handoff', async () => {
75
85
  const s = setup();
76
86
  await s.player.play(SOURCE);
@@ -43,6 +43,8 @@ export interface PlayerState {
43
43
  const POLL_MS = 250;
44
44
  const START_TRIES = 80;
45
45
  const START_STEP_MS = 100;
46
+ /** After releasing the player, the OS needs a moment before the recorder can take the session (a start 200 ms after playback failed with '!rec'). */
47
+ const HANDOFF_SETTLE_MS = 600;
46
48
 
47
49
  export function createAudioPlayer(deps: {
48
50
  driver: AudioPlayerDriver;
@@ -172,6 +174,7 @@ export function createAudioPlayer(deps: {
172
174
  async handoffToRecording(): Promise<void> {
173
175
  const before = await facts();
174
176
  await release();
177
+ await deps.sleep(HANDOFF_SETTLE_MS);
175
178
  set({ phase: 'idle', positionMillis: 0 });
176
179
  deps.diag.log('audio.handoff', { before, after: await facts() });
177
180
  },