@startsimpli/integrations 0.2.121 → 0.2.122

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.121",
3
+ "version": "0.2.122",
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",
@@ -50,8 +50,8 @@
50
50
  "react-native": ">=0.74.0",
51
51
  "@startsimpli/ui-native": ">=0.1.12",
52
52
  "react-native-safe-area-context": ">=4.0.0",
53
- "@startsimpli/auth": "^0.4.50",
54
53
  "@startsimpli/ui": "^0.4.171",
54
+ "@startsimpli/auth": "^0.4.50",
55
55
  "@startsimpli/utils": "^0.4.17"
56
56
  },
57
57
  "peerDependenciesMeta": {
@@ -100,9 +100,9 @@
100
100
  "react-native-safe-area-context": "~5.7.0",
101
101
  "@startsimpli/llm": "0.4.30",
102
102
  "@startsimpli/ui": "0.4.171",
103
- "@startsimpli/ui-native": "0.1.14",
104
103
  "@startsimpli/auth": "0.4.50",
105
- "@startsimpli/utils": "0.4.17"
104
+ "@startsimpli/utils": "0.4.17",
105
+ "@startsimpli/ui-native": "0.1.14"
106
106
  },
107
107
  "scripts": {
108
108
  "type-check": "tsc --noEmit && tsc --noEmit -p tsconfig.native.json",
@@ -50,7 +50,7 @@ function setup(items: BriefingItem[], over: Partial<BriefingDeps> = {}, owner =
50
50
  }),
51
51
  };
52
52
  const put = vi.fn(async ({ noteId }: { noteId: string }) => `s3://voice-audio/voice/org/${noteId}.mp3`);
53
- const url = vi.fn(async (ref: string, ttl: number) => `https://signed.example/${encodeURIComponent(ref)}?ttl=${ttl}`);
53
+ const url = vi.fn(async (ref: string, ttl: number, _briefingId?: string) => `https://signed.example/${encodeURIComponent(ref)}?ttl=${ttl}`);
54
54
  const currentItems = { list: items };
55
55
  const deps: BriefingDeps = {
56
56
  http: tenant.http as never,
@@ -79,6 +79,14 @@ describe('briefing route', () => {
79
79
  expect(b.cached).toBe(false);
80
80
  });
81
81
 
82
+ it('hands the briefing id to audio.url so a mount can build an owner-checked link', async () => {
83
+ const { deps, url } = setup([mk('a')]);
84
+ const first = await generateBriefing(deps, {});
85
+ await generateBriefing(deps, {});
86
+ expect(url).toHaveBeenCalledTimes(2);
87
+ for (const call of url.mock.calls) expect((call as unknown[])[2]).toBe(first.briefingId);
88
+ });
89
+
82
90
  it('serves a second call the same day for the same set from cache: zero LLM, zero TTS', async () => {
83
91
  const { deps, llm, synthesize } = setup([mk('a')]);
84
92
  const first = await generateBriefing(deps, {});
@@ -34,7 +34,8 @@ export type BriefingSynthesize = (request: { text: string }) => Promise<{
34
34
  /** Audio bytes live in the workspace's voice-audio store; `url` turns a reference into a short-lived link. */
35
35
  export interface BriefingAudio {
36
36
  put(input: { noteId: string; audio: Uint8Array; mimeType: string }): Promise<string>;
37
- url(audioRef: string, ttlSeconds: number): Promise<string>;
37
+ /** `briefingId` lets a mount answer with its own owner-checked route instead of a presigned link. */
38
+ url(audioRef: string, ttlSeconds: number, briefingId: string): Promise<string>;
38
39
  }
39
40
 
40
41
  export interface BriefingDeps {
@@ -96,9 +97,9 @@ export async function generateBriefing(deps: BriefingDeps, request: BriefingRequ
96
97
  const stored = request.force ? null : await store.find(externalId);
97
98
  const current = stored && stored.contentHash === hash ? stored : null;
98
99
 
99
- const linkFor = async (ref: string | undefined): Promise<string | null> => {
100
+ const linkFor = async (ref: string | undefined, briefingId: string): Promise<string | null> => {
100
101
  if (!ref) return null;
101
- try { return await deps.audio.url(ref, ttl); } catch { return null; }
102
+ try { return await deps.audio.url(ref, ttl, briefingId); } catch { return null; }
102
103
  };
103
104
  const result = (record: BriefingRecord, audioUrl: string | null, cached: boolean, reason?: string): BriefingResult => ({
104
105
  briefingId: record.id,
@@ -115,7 +116,7 @@ export async function generateBriefing(deps: BriefingDeps, request: BriefingRequ
115
116
 
116
117
  // Hit: the stored briefing is exactly what would be said now.
117
118
  if (current?.audioRef) {
118
- const url = await linkFor(current.audioRef);
119
+ const url = await linkFor(current.audioRef, current.id);
119
120
  if (url) return result(current, url, true);
120
121
  }
121
122
 
@@ -155,5 +156,5 @@ export async function generateBriefing(deps: BriefingDeps, request: BriefingRequ
155
156
  ...(usage ? { usage } : {}),
156
157
  createdAt: new Date(now).toISOString(),
157
158
  });
158
- return result(saved, await linkFor(audioRef), Boolean(current), audioReason);
159
+ return result(saved, await linkFor(audioRef, saved.id), Boolean(current), audioReason);
159
160
  }