@startsimpli/integrations 0.2.215 → 0.2.216

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.215",
3
+ "version": "0.2.216",
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/ui": "^0.4.206",
54
- "@startsimpli/auth": "^0.4.61",
53
+ "@startsimpli/ui": "^0.4.207",
54
+ "@startsimpli/auth": "^0.4.62",
55
55
  "@startsimpli/utils": "^0.4.21"
56
56
  },
57
57
  "peerDependenciesMeta": {
@@ -99,9 +99,9 @@
99
99
  "react-native": "0.85.3",
100
100
  "react-native-safe-area-context": "~5.7.0",
101
101
  "@startsimpli/llm": "0.4.31",
102
- "@startsimpli/ui": "0.4.206",
102
+ "@startsimpli/ui": "0.4.207",
103
103
  "@startsimpli/ui-native": "0.1.15",
104
- "@startsimpli/auth": "0.4.61",
104
+ "@startsimpli/auth": "0.4.62",
105
105
  "@startsimpli/utils": "0.4.21"
106
106
  },
107
107
  "scripts": {
@@ -0,0 +1,47 @@
1
+ /**
2
+ * A briefing row is a source_document with NO body/summary (the to-do extractor
3
+ * must not re-extract from it) and its script in `briefing_text`. The Library
4
+ * must still SHOW that script, while Ask must never retrieve it: a briefing is a
5
+ * view of the to-dos, never a source of them.
6
+ */
7
+ import { describe, expect, it } from 'vitest';
8
+
9
+ import { toSourceDocument } from '../corpus/entities';
10
+ import { rankDocuments } from '../corpus/retrieval';
11
+
12
+ const SCOPE = { orgId: 'o' } as never;
13
+ const SAID = 'Good morning. You have three overdue items. First, send the quarterly deck to the board.';
14
+
15
+ const briefing = (data: Record<string, unknown> = {}) =>
16
+ toSourceDocument(
17
+ { id: 'b1', name: 'Briefing 2026-11-25', external_id: 'briefing:2026-11-25:u1', data: { source: 'briefing', briefing_text: SAID, ...data } } as never,
18
+ SCOPE,
19
+ );
20
+
21
+ describe('a briefing record in the Library', () => {
22
+ it('test_shows_what_was_said_as_a_section_not_an_empty_record', () => {
23
+ const doc = briefing();
24
+ expect(doc.sections.map((s) => s.text)).toContain(SAID);
25
+ expect(doc.sections[0].label).toBe('What was said');
26
+ });
27
+ it('test_still_has_no_body_or_summary_so_the_extractor_gets_nothing', () => {
28
+ const doc = briefing();
29
+ expect(doc.body).toBe('');
30
+ expect(doc.summary).toBeUndefined();
31
+ });
32
+ it('test_reads_the_camelCase_spelling_too', () => {
33
+ const doc = briefing({ briefing_text: undefined, briefingText: SAID });
34
+ expect(doc.sections.map((s) => s.text)).toContain(SAID);
35
+ });
36
+ });
37
+
38
+ describe('Ask retrieval', () => {
39
+ it('test_never_retrieves_a_briefing_even_when_the_question_matches_its_words', () => {
40
+ const other = toSourceDocument(
41
+ { id: 'n1', name: 'Board prep', data: { source: 'voice', title: 'Board prep', summary: 'Send the quarterly deck to the board.' } } as never,
42
+ SCOPE,
43
+ );
44
+ const ranked = rankDocuments([briefing(), other], 'quarterly deck board');
45
+ expect(ranked.map((r) => r.document.id)).toEqual(['n1']);
46
+ });
47
+ });
@@ -72,3 +72,11 @@ describe('an incremental run', () => {
72
72
  expect(second.since ?? null).toBeNull();
73
73
  });
74
74
  });
75
+
76
+ describe('the run record holds ids, never words from anyone\'s notes', () => {
77
+ it('keeps the item and document of a "needs review" claim and drops its quote', async () => {
78
+ const { reviewRefs } = await import('../corpus/runs');
79
+ expect(reviewRefs([{ commitmentId: 'commit:a', documentId: 'd1', quote: 'private words' }]))
80
+ .toEqual([{ commitmentId: 'commit:a', documentId: 'd1' }]);
81
+ });
82
+ });
@@ -0,0 +1,11 @@
1
+ /** A briefing row keeps its spoken script in `briefing_text`; the Library shows it as one section. */
2
+ import type { DocumentSection } from './types';
3
+
4
+ export const BRIEFING_SOURCE_KEY = 'briefing';
5
+
6
+ export function briefingSections(data: Record<string, unknown>): DocumentSection[] {
7
+ if (data.source !== BRIEFING_SOURCE_KEY) return [];
8
+ const raw = data.briefing_text ?? data.briefingText;
9
+ const text = typeof raw === 'string' ? raw.trim() : '';
10
+ return text ? [{ key: 'briefing_text', label: 'What was said', text }] : [];
11
+ }
@@ -22,6 +22,7 @@
22
22
  * blanks itself because an attribute was renamed is worse than one that shows a
23
23
  * row with a missing subtitle.
24
24
  */
25
+ import { briefingSections } from './briefing-text';
25
26
  import { readPossiblyDone, writePossiblyDone } from './possibly-done';
26
27
  import { readSuggestion, writeSuggestion } from './engine/suggestion';
27
28
  import { withSourceEntity } from './source-entity';
@@ -517,7 +518,7 @@ export function toSourceDocument(
517
518
  const summary = asText(pick(data, 'summary', 'description'));
518
519
  const fullText = asText(pick(data, 'body', 'text', 'content'));
519
520
 
520
- const sections = toSections(pick(data, 'sections'));
521
+ const sections = [...toSections(pick(data, 'sections')), ...briefingSections(data)];
521
522
  // A source that stored its long-form under a bare attribute rather than in
522
523
  // `sections` still contributes one. Listed keys are storage spellings, not
523
524
  // vendor knowledge: the same loop picks up a Drive connector's `extracted_text`.
@@ -29,6 +29,7 @@
29
29
  * what was dropped is surfaced rather than swallowed, because a non-zero drop is
30
30
  * a bug somewhere upstream that someone needs to see.
31
31
  */
32
+ import { BRIEFING_SOURCE_KEY } from './briefing-text';
32
33
  import { stem } from './text';
33
34
  import type { CorpusScope, RetrievedDocument, SourceDocument } from './types';
34
35
 
@@ -394,6 +395,8 @@ export function rankDocuments(
394
395
  options: RetrieveOptions = {},
395
396
  ): RetrievedDocument[] {
396
397
  const { limit = 8, now = Date.now(), minScore = 0.0001 } = options;
398
+ // A briefing is a view of the to-dos, never a source of them: Ask does not read it.
399
+ documents = documents.filter((document) => document.source !== BRIEFING_SOURCE_KEY);
397
400
  const { include, exclude } = questionTerms(question);
398
401
  const terms = new Set(include);
399
402
  if (terms.size === 0) {
@@ -297,6 +297,15 @@ export function newExtractionRun(input: {
297
297
  * • anything else → a new sweep, from the first document, with the previous
298
298
  * one filed in `history`.
299
299
  */
300
+ /**
301
+ * A run record is readable more widely than the notes it was made from, so it keeps
302
+ * only WHICH item and document need review; the words stay on the item itself, as
303
+ * its "possibly done" claim, under the item's own privacy (bd startsim-vrmx5).
304
+ */
305
+ export function reviewRefs(list: ReadonlyArray<{ commitmentId: string; documentId: string; quote?: string }> = []) {
306
+ return list.map(({ commitmentId, documentId }) => ({ commitmentId, documentId }));
307
+ }
308
+
300
309
  export async function startExtractionRun(
301
310
  request: StartExtractionRunRequest,
302
311
  deps: ExtractionRunDeps,
@@ -436,7 +445,7 @@ export async function advanceExtractionRun(
436
445
  modelIncompleteIds: result.modelFailure
437
446
  ? capped([...run.modelIncompleteIds, ...result.documentIds], config.idLimit)
438
447
  : run.modelIncompleteIds,
439
- needsReview: capped([...run.needsReview, ...result.needsReview], config.idLimit),
448
+ needsReview: capped([...reviewRefs(run.needsReview), ...reviewRefs(result.needsReview)], config.idLimit),
440
449
  // WHAT ANSWERED beats what was configured, and a slice where nothing
441
450
  // answered must not overwrite the name of the model that did.
442
451
  provider: result.provider.live ? result.provider : run.provider,
@@ -1336,7 +1336,7 @@ export interface ExtractionRun {
1336
1336
  processedIds: string[];
1337
1337
  /** Documents that got the deterministic pass only, because the model did not answer. */
1338
1338
  modelIncompleteIds: string[];
1339
- needsReview: Array<{ commitmentId: string; documentId: string; quote: string }>;
1339
+ needsReview: Array<{ commitmentId: string; documentId: string; quote?: string }>;
1340
1340
  provider: LlmDescription;
1341
1341
  startedAt: string;
1342
1342
  updatedAt: string;