@bendyline/squisq 2.13.13 → 2.13.15

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.
Files changed (35) hide show
  1. package/dist/{Doc-BhvotZx_.d.ts → Doc-C_Sh49ot.d.ts} +59 -6
  2. package/dist/{ImageEditDoc-D8hYio6b.d.ts → ImageEditDoc-Sqw3Tw-R.d.ts} +1 -1
  3. package/dist/{chunk-OIQ2GO2O.js → chunk-2CB37BOU.js} +1 -1
  4. package/dist/{chunk-CTT4XAGO.js → chunk-4HQ7QZKB.js} +2289 -630
  5. package/dist/chunk-C7DKMO4H.js +88 -0
  6. package/dist/{chunk-C4SB3NN4.js → chunk-DDJHIZED.js} +1 -1
  7. package/dist/{chunk-TCGGJUKC.js → chunk-FYP7GNER.js} +93 -15
  8. package/dist/chunk-N3FQSUVT.js +515 -0
  9. package/dist/{chunk-SGNWO7OF.js → chunk-OFE5RZWW.js} +490 -24
  10. package/dist/{chunk-YQQWE4HG.js → chunk-OJCAKUHW.js} +192 -260
  11. package/dist/{chunk-7MS26OXD.js → chunk-UDPPWYYM.js} +6 -0
  12. package/dist/{chunk-5DFFVW75.js → chunk-Y34KYMAS.js} +1 -1
  13. package/dist/doc/index.d.ts +337 -22
  14. package/dist/doc/index.js +56 -8
  15. package/dist/fence/index.d.ts +1 -1
  16. package/dist/generate/index.d.ts +1 -1
  17. package/dist/imageEdit/index.d.ts +3 -3
  18. package/dist/index.d.ts +8 -8
  19. package/dist/index.js +127 -21
  20. package/dist/jsonForm/index.d.ts +1 -1
  21. package/dist/markdown/index.js +3 -3
  22. package/dist/{materializePageSection-CWxou4mX.d.ts → materializePageSection-Dmf-rf1b.d.ts} +121 -8
  23. package/dist/mediaEdit/index.d.ts +2 -2
  24. package/dist/narration/index.d.ts +1 -1
  25. package/dist/narration/index.js +4 -4
  26. package/dist/recommend/index.d.ts +129 -2
  27. package/dist/recommend/index.js +11 -3
  28. package/dist/schemas/index.d.ts +4 -4
  29. package/dist/{themeLibrary-BIYE6aLw.d.ts → themeLibrary-B4VLovhW.d.ts} +1 -1
  30. package/dist/timing/index.d.ts +66 -2
  31. package/dist/timing/index.js +12 -0
  32. package/dist/transform/index.d.ts +173 -16
  33. package/dist/transform/index.js +55 -16
  34. package/package.json +1 -1
  35. package/dist/chunk-FCB6JLWB.js +0 -125
@@ -1,6 +1,6 @@
1
- import { T as Doc, t as ColorScheme, k as Block, by as TemplateBlock } from '../Doc-BhvotZx_.js';
2
- import { l as PageTransformHints, n as PresentationBeatLayout, o as PresentationLayout, p as PresentationPlan } from '../materializePageSection-CWxou4mX.js';
3
- export { A as AUTHORED_PRESENTATION_LAYOUT, P as PRESENTATION_KEY, b as PRESENTATION_LAYOUTS, c as PRESENTATION_LIMITS, m as PresentationBeat, s as parsePresentationPlan, t as presentationLayoutFits, u as presentationStat, w as serializePresentationPlan } from '../materializePageSection-CWxou4mX.js';
1
+ import { U as Doc, t as ColorScheme, k as Block, bE as TemplateBlock } from '../Doc-C_Sh49ot.js';
2
+ import { s as PageTransformHints, u as PresentationBeatExtras, w as PresentationLayout, v as PresentationBeatLayout, x as PresentationPlan, t as PresentationBeat, g as ConceptTemplateName } from '../materializePageSection-Dmf-rf1b.js';
3
+ export { A as AUTHORED_PRESENTATION_LAYOUT, b as CONCEPT_TEMPLATES, P as PRESENTATION_KEY, i as PRESENTATION_LAYOUTS, j as PRESENTATION_LIMITS, E as conceptTemplate, H as parsePresentationPlan, I as presentationBeatExtras, J as presentationLayoutFits, K as presentationLayoutNeeds, L as presentationLayoutProblem, N as presentationStat, Q as serializePresentationPlan } from '../materializePageSection-Dmf-rf1b.js';
4
4
  import { d as ExtractionType, E as ExtractedElement, b as ExtractionOptions } from '../contentExtractor-BNfVJV2U.js';
5
5
  import { f as BuildSpec, M as MarkdownBlockNode } from '../types-Zk8qYuaT.js';
6
6
 
@@ -327,6 +327,14 @@ declare const DYNAMIC_PRESENTATION_STYLE = "dynamic-slides";
327
327
  /** A short, stable name for one slide's exact source passage. Saving it rather
328
328
  * than the passage keeps the document text out of the hints. */
329
329
  declare function presentationPassageKey(passage: string): string;
330
+ /** One slide's AI wording: a layout, a headline, points, and what the layout
331
+ * draws beyond them (a hub's centre, a matrix's axes). */
332
+ interface PresentationAiSuggestion extends PresentationBeatExtras {
333
+ source: string;
334
+ layout: PresentationLayout;
335
+ headline: string;
336
+ points: string[];
337
+ }
330
338
  interface PresentationBlockHint {
331
339
  build?: BuildSpec;
332
340
  blockId: string;
@@ -337,12 +345,7 @@ interface PresentationBlockHint {
337
345
  * Changing a passage, or how the section is split, shows its slide again. */
338
346
  hidden?: string[];
339
347
  /** Optional AI-authored display text, keyed to the exact passage it summarizes. */
340
- ai?: Array<{
341
- source: string;
342
- layout: PresentationLayout;
343
- headline: string;
344
- points: string[];
345
- }>;
348
+ ai?: PresentationAiSuggestion[];
346
349
  /** Explicit user wording, applied only while this section's source still matches. */
347
350
  wording?: {
348
351
  source: string;
@@ -516,8 +519,165 @@ declare function statedRanges(source: string): StatedRange[];
516
519
  declare function rangeEndOnly(value: string | number, source: string): StatedRange | undefined;
517
520
 
518
521
  /**
519
- * Concept reveals: a concept slide (`cards`, `process`, `cycle`, `layers`)
520
- * that shows its ideas one at a time, each as the narration reaches it.
522
+ * Presentation author — the protocol a model follows to word a deck's slides.
523
+ *
524
+ * Squisq plans a deck from prose on its own (`createPresentationPlan`). A
525
+ * host with a model can improve it: the model plans every slide's layout
526
+ * together (the storyboard), then words each slide (a layout, a headline and
527
+ * points). This module is everything about that exchange that is not
528
+ * transport, so every host asks the same questions and holds the answers to
529
+ * the same standard:
530
+ *
531
+ * - what the model is told ({@link presentationSlidePrompt},
532
+ * {@link presentationStoryboardPrompt}), rendered from the authoring guide,
533
+ * so a layout added to Squisq reaches every host's prompt;
534
+ * - what it is sent ({@link presentationSlideRequest},
535
+ * {@link presentationStoryboardRequest}) and the reply shape a host that can
536
+ * enforce structured output pins it to ({@link PRESENTATION_SLIDE_FORMAT},
537
+ * {@link PRESENTATION_STORYBOARD_FORMAT});
538
+ * - how a reply is read ({@link readPresentationSlideReply},
539
+ * {@link readPresentationStoryboardReply}): the fields, the plan's own
540
+ * limits, then faithfulness ({@link groundPresentationBeat}). A refused
541
+ * reply says why, in words a correction request can quote.
542
+ *
543
+ * The model chooses display wording and a layout, nothing else: source spans,
544
+ * order, media and timing stay the plan's. The host makes the calls (one for
545
+ * the storyboard, one per slide, a retry with {@link presentationCorrection})
546
+ * and keeps the automatic slide whenever a reply is refused.
547
+ *
548
+ * Related: `presentationPlanner.ts` (the automatic deck), `grounding.ts` (the
549
+ * fact checks), `recommend/listShape.ts` (whether a shape is stated),
550
+ * `doc/templates/authoringGuide.ts` (the layout guide and the craft).
551
+ */
552
+
553
+ /** What a host needs to size its requests; none of it is enforced here. */
554
+ declare const PRESENTATION_AUTHOR_LIMITS: {
555
+ /** A passage longer than this keeps its automatic slide: it would not fit a small model. */
556
+ readonly passageCharacters: 2400;
557
+ /** A reply longer than this is not a slide. */
558
+ readonly replyCharacters: 6000;
559
+ /** Output tokens that hold any valid slide. */
560
+ readonly slideTokens: 550;
561
+ readonly temperature: 0.3;
562
+ /** A deck of at least this many slides to word is storyboarded first… */
563
+ readonly storyboardMinimum: 3;
564
+ /** …and one of more than this many is not: a small model cannot see it at once. */
565
+ readonly storyboardLimit: 16;
566
+ /** How much of each passage the storyboard sees: enough to recognize its shape. */
567
+ readonly storyboardGist: 240;
568
+ };
569
+ /** Output tokens that hold a storyboard of `slides` layouts. */
570
+ declare function presentationStoryboardTokens(slides: number): number;
571
+ /** A reply shape for hosts that can enforce structured output (a JSON schema). */
572
+ interface PresentationAuthorFormat {
573
+ name: string;
574
+ schema: Record<string, unknown>;
575
+ }
576
+ /**
577
+ * One slide's wording. Without enforcement some small models answer with a
578
+ * key per layout name; with it, a reply can only be these fields.
579
+ */
580
+ declare const PRESENTATION_SLIDE_FORMAT: PresentationAuthorFormat;
581
+ declare const PRESENTATION_STORYBOARD_FORMAT: PresentationAuthorFormat;
582
+ /** The system prompt for wording one slide. */
583
+ declare function presentationSlidePrompt(): string;
584
+ /** The system prompt for planning every slide's layout together. */
585
+ declare function presentationStoryboardPrompt(): string;
586
+ /** Whether a passage addresses a model rather than a reader. */
587
+ declare function addressesAModel(passage: string): boolean;
588
+ /**
589
+ * The slides a model is asked about, by index. An authored section keeps its
590
+ * own block and a hidden slide is not shown; a passage too long for a small
591
+ * model, or one that addresses the model, keeps its automatic slide.
592
+ */
593
+ declare function presentationSlidesToWord(plan: PresentationPlan): number[];
594
+ /** Whether a deck with these slides to word is storyboarded first. */
595
+ declare function presentationUsesStoryboard(asked: readonly number[]): boolean;
596
+ /** The user message that asks for a storyboard of the slides at `asked`. */
597
+ declare function presentationStoryboardRequest(plan: PresentationPlan, asked: readonly number[]): string;
598
+ /**
599
+ * The layout a storyboard reply plans for each asked slide. Empty when the
600
+ * reply does not name one layout per slide; a picture keeps its image slide,
601
+ * and no other slide becomes one.
602
+ */
603
+ declare function readPresentationStoryboardReply(text: string, plan: PresentationPlan, asked: readonly number[]): Map<number, PresentationLayout>;
604
+ interface PresentationSlideContext {
605
+ /** The layout the storyboard planned for this slide. */
606
+ planned?: PresentationLayout;
607
+ /**
608
+ * Without a storyboard, the layouts of the slides just before (as they now
609
+ * stand), so the model can vary the deck.
610
+ */
611
+ previous?: readonly string[];
612
+ /** Why the prior reply for this slide was refused (`presentationCorrection`). */
613
+ correction?: string;
614
+ }
615
+ /** The user message that asks for one slide's wording. */
616
+ declare function presentationSlideRequest(plan: PresentationPlan, index: number, context?: PresentationSlideContext): string;
617
+ /**
618
+ * What to tell the model after a refused reply: what was wrong, then the
619
+ * rules it bears on. A layout the passage cannot fill is answered by asking
620
+ * for another one, since the same layout would be refused again.
621
+ */
622
+ declare function presentationCorrection(problem: string, kind?: PresentationRefusal): string;
623
+ /**
624
+ * The context for a second request after `read` was refused: the correction,
625
+ * and no planned layout when the planned one is what could not be filled
626
+ * (told to use it "unless the passage cannot fill it", a small model tries it again).
627
+ */
628
+ declare function presentationRetryContext(context: PresentationSlideContext, read: PresentationSlideReply): PresentationSlideContext;
629
+ interface GroundedPresentationBeat {
630
+ /** The beat as it may be shown, or null when it cannot be shown at all. */
631
+ beat: PresentationBeat | null;
632
+ /** Why it cannot be shown: an invented number, words the passage does not use. */
633
+ problem?: string;
634
+ /** What was changed to keep it faithful (a shape the passage does not state, drawn as cards). */
635
+ notes: string[];
636
+ }
637
+ interface GroundPresentationBeatOptions {
638
+ /** The heading over the passage, which may state its shape ("The water cycle"). */
639
+ heading?: string;
640
+ }
641
+ /**
642
+ * Hold a model-worded slide to its passage. Points may condense the passage
643
+ * but not add to it; the headline may paraphrase freely but cannot invent a
644
+ * number; a key figure the passage gives only as one end of a range must show
645
+ * the whole range. Those refuse the slide.
646
+ *
647
+ * A layout that asserts a relationship the passage does not state (a cycle
648
+ * that never comes round, a pyramid without a hierarchy) is not refused: its
649
+ * wording is good, only its claim is not, so it is drawn as cards or a
650
+ * process instead. A hub centre or an axis name with words the source does
651
+ * not use is dropped the same way.
652
+ */
653
+ declare function groundPresentationBeat(beat: PresentationBeat, passage: string, options?: GroundPresentationBeatOptions): GroundedPresentationBeat;
654
+ /**
655
+ * What was wrong with a refused reply: it was not the JSON asked for
656
+ * (`reply`), its layout cannot be filled from what it wrote (`layout`), or it
657
+ * says something the passage does not (`facts`).
658
+ */
659
+ type PresentationRefusal = 'reply' | 'layout' | 'facts';
660
+ interface PresentationSlideReply {
661
+ /** The slide to show, or null when the automatic one is kept. */
662
+ beat: PresentationBeat | null;
663
+ /** Why the reply was refused, for a log and for `presentationCorrection`. */
664
+ problem?: string;
665
+ /** What kind of problem it was, which decides how to ask again. */
666
+ kind?: PresentationRefusal;
667
+ /** What was changed to keep an accepted slide faithful. */
668
+ notes: string[];
669
+ }
670
+ /**
671
+ * Read a model's reply for the slide at `index`. The reply is refused (the
672
+ * automatic slide stands) when it is not the JSON asked for, breaks the
673
+ * plan's limits, cannot fill its layout, or fails {@link groundPresentationBeat}.
674
+ */
675
+ declare function readPresentationSlideReply(text: string, plan: PresentationPlan, index: number): PresentationSlideReply;
676
+
677
+ /**
678
+ * Concept reveals: a concept slide (`cards`, `process`, `cycle`, `layers`,
679
+ * `stats`, `pyramid`, `funnel`, `hub`, `venn`, `matrix`) that shows its ideas
680
+ * one at a time, each as the narration reaches it.
521
681
  *
522
682
  * Two steps, so any host with narration can use them: find where in the
523
683
  * script each idea is spoken ({@link matchPointsToSentences}), then turn
@@ -535,10 +695,7 @@ declare function rangeEndOnly(value: string | number, source: string): StatedRan
535
695
  * (`resolveBuildTimeline`), `transform/presentationCompiler.ts`.
536
696
  */
537
697
 
538
- declare const CONCEPT_TEMPLATES: readonly ["cards", "process", "cycle", "layers"];
539
- type ConceptTemplate = (typeof CONCEPT_TEMPLATES)[number];
540
- /** The concept template a name denotes, or `undefined`. */
541
- declare function conceptTemplate(template: string): ConceptTemplate | undefined;
698
+ type ConceptTemplate = ConceptTemplateName;
542
699
  /**
543
700
  * Where in `sourceText[start, end)` each point is spoken: the offset of the
544
701
  * sentence it shares the most words with (at least two). Points must land
@@ -558,4 +715,4 @@ declare function conceptBuildSpec(): BuildSpec;
558
715
  */
559
716
  declare function conceptRevealTiming(template: ConceptTemplate, items: readonly string[], itemTimes: readonly number[] | undefined, start: number, end: number): Pick<Block, 'build' | 'buildTiming'>;
560
717
 
561
- export { type AnalyzedBlock, type BlockImage, CONCEPT_TEMPLATES, type ConceptTemplate, DEFAULT_TRANSFORM_STYLE_ID, DYNAMIC_PRESENTATION_STYLE, type NarratedSegmentInput, type NarratedSegmentResult, type NarratedSegmentTransformOptions, type NarratedSegmentVideo, PRESENTATION_HINTS_KEY, type ParaphraseOptions, PresentationBeatLayout, type PresentationBlockHint, type PresentationHints, PresentationLayout, type PresentationMediaItem, PresentationPlan, type StatedRange, type TransformImage, type TransformOptions, type TransformResult, type TransformStyleConfig, type TransformStyleId, type TransformStyleInput, type TransformStyleRegistry, type TransformStyleSummary, type VerbatimQuoteOptions, allocateTiming, analyzeBlocks, applySavedPresentation, applyTransform, collectPresentationMedia, compilePresentationPlan, conceptBuildSpec, conceptRevealTiming, conceptTemplate, createPresentationPlan, createTransformStyleRegistry, defaultPresentationHints, distinctiveStems, extractDocImages, getTransformStyleIds, getTransformStyleSummaries, groundingSentences, isGroundedParaphrase, isVerbatimQuote, matchPointsToSentences, normalizeGroundingText, numbersIn, parsePresentationHints, presentationPassageKey, presentationSections, rangeEndOnly, resolveTransformStyle, restatesHeadline, serializePresentationHints, sourceNumbers, spelledNumbers, statedRanges, transformNarratedSegment, ungroundedNumber, usesDynamicPresentation };
718
+ export { type AnalyzedBlock, type BlockImage, type ConceptTemplate, DEFAULT_TRANSFORM_STYLE_ID, DYNAMIC_PRESENTATION_STYLE, type GroundPresentationBeatOptions, type GroundedPresentationBeat, type NarratedSegmentInput, type NarratedSegmentResult, type NarratedSegmentTransformOptions, type NarratedSegmentVideo, PRESENTATION_AUTHOR_LIMITS, PRESENTATION_HINTS_KEY, PRESENTATION_SLIDE_FORMAT, PRESENTATION_STORYBOARD_FORMAT, type ParaphraseOptions, type PresentationAiSuggestion, type PresentationAuthorFormat, PresentationBeat, PresentationBeatExtras, PresentationBeatLayout, type PresentationBlockHint, type PresentationHints, PresentationLayout, type PresentationMediaItem, PresentationPlan, type PresentationRefusal, type PresentationSlideContext, type PresentationSlideReply, type StatedRange, type TransformImage, type TransformOptions, type TransformResult, type TransformStyleConfig, type TransformStyleId, type TransformStyleInput, type TransformStyleRegistry, type TransformStyleSummary, type VerbatimQuoteOptions, addressesAModel, allocateTiming, analyzeBlocks, applySavedPresentation, applyTransform, collectPresentationMedia, compilePresentationPlan, conceptBuildSpec, conceptRevealTiming, createPresentationPlan, createTransformStyleRegistry, defaultPresentationHints, distinctiveStems, extractDocImages, getTransformStyleIds, getTransformStyleSummaries, groundPresentationBeat, groundingSentences, isGroundedParaphrase, isVerbatimQuote, matchPointsToSentences, normalizeGroundingText, numbersIn, parsePresentationHints, presentationCorrection, presentationPassageKey, presentationRetryContext, presentationSections, presentationSlidePrompt, presentationSlideRequest, presentationSlidesToWord, presentationStoryboardPrompt, presentationStoryboardRequest, presentationStoryboardTokens, presentationUsesStoryboard, rangeEndOnly, readPresentationSlideReply, readPresentationStoryboardReply, resolveTransformStyle, restatesHeadline, serializePresentationHints, sourceNumbers, spelledNumbers, statedRanges, transformNarratedSegment, ungroundedNumber, usesDynamicPresentation };
@@ -1,26 +1,37 @@
1
1
  import {
2
+ PRESENTATION_AUTHOR_LIMITS,
3
+ PRESENTATION_SLIDE_FORMAT,
4
+ PRESENTATION_STORYBOARD_FORMAT,
5
+ addressesAModel,
2
6
  distinctiveStems,
7
+ groundPresentationBeat,
3
8
  groundingSentences,
4
9
  isGroundedParaphrase,
5
10
  isVerbatimQuote,
6
11
  normalizeGroundingText,
7
12
  numbersIn,
13
+ presentationCorrection,
14
+ presentationRetryContext,
15
+ presentationSlidePrompt,
16
+ presentationSlideRequest,
17
+ presentationSlidesToWord,
18
+ presentationStoryboardPrompt,
19
+ presentationStoryboardRequest,
20
+ presentationStoryboardTokens,
21
+ presentationUsesStoryboard,
8
22
  rangeEndOnly,
23
+ readPresentationSlideReply,
24
+ readPresentationStoryboardReply,
9
25
  restatesHeadline,
10
26
  sourceNumbers,
11
27
  spelledNumbers,
12
28
  statedRanges,
13
29
  ungroundedNumber
14
- } from "../chunk-FCB6JLWB.js";
30
+ } from "../chunk-N3FQSUVT.js";
15
31
  import {
16
- AUTHORED_PRESENTATION_LAYOUT,
17
- CONCEPT_TEMPLATES,
18
32
  DEFAULT_TRANSFORM_STYLE_ID,
19
33
  DYNAMIC_PRESENTATION_STYLE,
20
34
  PRESENTATION_HINTS_KEY,
21
- PRESENTATION_KEY,
22
- PRESENTATION_LAYOUTS,
23
- PRESENTATION_LIMITS,
24
35
  allocateTiming,
25
36
  analyzeBlocks,
26
37
  applySavedPresentation,
@@ -29,7 +40,6 @@ import {
29
40
  compilePresentationPlan,
30
41
  conceptBuildSpec,
31
42
  conceptRevealTiming,
32
- conceptTemplate,
33
43
  createPresentationPlan,
34
44
  createTransformStyleRegistry,
35
45
  defaultPresentationHints,
@@ -38,25 +48,35 @@ import {
38
48
  getTransformStyleSummaries,
39
49
  matchPointsToSentences,
40
50
  parsePresentationHints,
41
- parsePresentationPlan,
42
- presentationLayoutFits,
43
51
  presentationPassageKey,
44
52
  presentationSections,
45
- presentationStat,
46
53
  resolveTransformStyle,
47
54
  serializePresentationHints,
48
- serializePresentationPlan,
49
55
  transformNarratedSegment,
50
56
  usesDynamicPresentation
51
- } from "../chunk-YQQWE4HG.js";
52
- import "../chunk-CTT4XAGO.js";
53
- import "../chunk-SGNWO7OF.js";
57
+ } from "../chunk-OJCAKUHW.js";
58
+ import {
59
+ AUTHORED_PRESENTATION_LAYOUT,
60
+ CONCEPT_TEMPLATES,
61
+ PRESENTATION_KEY,
62
+ PRESENTATION_LAYOUTS,
63
+ PRESENTATION_LIMITS,
64
+ conceptTemplate,
65
+ parsePresentationPlan,
66
+ presentationBeatExtras,
67
+ presentationLayoutFits,
68
+ presentationLayoutNeeds,
69
+ presentationLayoutProblem,
70
+ presentationStat,
71
+ serializePresentationPlan
72
+ } from "../chunk-4HQ7QZKB.js";
73
+ import "../chunk-OFE5RZWW.js";
54
74
  import "../chunk-SVN7T6BK.js";
55
75
  import "../chunk-FUBMT6SJ.js";
56
76
  import "../chunk-JNUNNQ74.js";
57
77
  import "../chunk-L7QZORLB.js";
58
- import "../chunk-C4SB3NN4.js";
59
- import "../chunk-7MS26OXD.js";
78
+ import "../chunk-DDJHIZED.js";
79
+ import "../chunk-UDPPWYYM.js";
60
80
  import "../chunk-L3KSFLTP.js";
61
81
  import "../chunk-CZ7AUSLI.js";
62
82
  import "../chunk-P53Z4RYC.js";
@@ -68,10 +88,14 @@ export {
68
88
  CONCEPT_TEMPLATES,
69
89
  DEFAULT_TRANSFORM_STYLE_ID,
70
90
  DYNAMIC_PRESENTATION_STYLE,
91
+ PRESENTATION_AUTHOR_LIMITS,
71
92
  PRESENTATION_HINTS_KEY,
72
93
  PRESENTATION_KEY,
73
94
  PRESENTATION_LAYOUTS,
74
95
  PRESENTATION_LIMITS,
96
+ PRESENTATION_SLIDE_FORMAT,
97
+ PRESENTATION_STORYBOARD_FORMAT,
98
+ addressesAModel,
75
99
  allocateTiming,
76
100
  analyzeBlocks,
77
101
  applySavedPresentation,
@@ -88,6 +112,7 @@ export {
88
112
  extractDocImages,
89
113
  getTransformStyleIds,
90
114
  getTransformStyleSummaries,
115
+ groundPresentationBeat,
91
116
  groundingSentences,
92
117
  isGroundedParaphrase,
93
118
  isVerbatimQuote,
@@ -96,11 +121,25 @@ export {
96
121
  numbersIn,
97
122
  parsePresentationHints,
98
123
  parsePresentationPlan,
124
+ presentationBeatExtras,
125
+ presentationCorrection,
99
126
  presentationLayoutFits,
127
+ presentationLayoutNeeds,
128
+ presentationLayoutProblem,
100
129
  presentationPassageKey,
130
+ presentationRetryContext,
101
131
  presentationSections,
132
+ presentationSlidePrompt,
133
+ presentationSlideRequest,
134
+ presentationSlidesToWord,
102
135
  presentationStat,
136
+ presentationStoryboardPrompt,
137
+ presentationStoryboardRequest,
138
+ presentationStoryboardTokens,
139
+ presentationUsesStoryboard,
103
140
  rangeEndOnly,
141
+ readPresentationSlideReply,
142
+ readPresentationStoryboardReply,
104
143
  resolveTransformStyle,
105
144
  restatesHeadline,
106
145
  serializePresentationHints,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bendyline/squisq",
3
- "version": "2.13.13",
3
+ "version": "2.13.15",
4
4
  "description": "Headless utilities for doc/block rendering, spatial math, Markdown, and storage",
5
5
  "license": "MIT",
6
6
  "author": "Bendyline",
@@ -1,125 +0,0 @@
1
- // src/transform/grounding.ts
2
- var NUMBER = /\d[\d,]*(?:\.\d+)?/gu;
3
- function normalizeGroundingText(text) {
4
- return text.toLowerCase().replace(/[‘’ʼ`]/gu, "'").replace(/[“”]/gu, '"').replace(/[–—]/gu, "-").replace(/[^a-z0-9'%\s-]/gu, " ").replace(/\s+/gu, " ").trim();
5
- }
6
- function numbersIn(value) {
7
- if (typeof value === "number") return Number.isFinite(value) ? [String(value)] : [];
8
- return (value.match(NUMBER) ?? []).map((number) => number.replace(/,/gu, ""));
9
- }
10
- var UNIT_WORDS = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine"];
11
- var TEEN_WORDS = [
12
- "ten",
13
- "eleven",
14
- "twelve",
15
- "thirteen",
16
- "fourteen",
17
- "fifteen",
18
- "sixteen",
19
- "seventeen",
20
- "eighteen",
21
- "nineteen"
22
- ];
23
- var TENS_WORDS = ["twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"];
24
- var NUMBER_WORD = new RegExp(
25
- `\\b(?:(${TENS_WORDS.join("|")})(?:[-\\s](${UNIT_WORDS.join("|")}))?|(${[...UNIT_WORDS.slice(1), ...TEEN_WORDS].join("|")}))\\b`,
26
- "giu"
27
- );
28
- function spelledNumbers(source) {
29
- return [...source.matchAll(NUMBER_WORD)].map((match) => {
30
- const [, tens, unit, small] = match;
31
- const value = small ? [...UNIT_WORDS, ...TEEN_WORDS].indexOf(small.toLowerCase()) + 1 : (TENS_WORDS.indexOf(tens.toLowerCase()) + 2) * 10 + (unit ? UNIT_WORDS.indexOf(unit.toLowerCase()) + 1 : 0);
32
- return { value: String(value), index: match.index };
33
- });
34
- }
35
- function sourceNumbers(source) {
36
- return /* @__PURE__ */ new Set([...numbersIn(source), ...spelledNumbers(source).map(({ value }) => value)]);
37
- }
38
- function ungroundedNumber(values, source) {
39
- const stated = typeof source === "string" ? sourceNumbers(source) : source;
40
- const list = Array.isArray(values) ? values : [values];
41
- for (const value of list) {
42
- const missing = numbersIn(value).find((number) => !stated.has(number));
43
- if (missing !== void 0) return missing;
44
- }
45
- return void 0;
46
- }
47
- function groundingSentences(text) {
48
- return (text.match(/[^.!?\n]+[.!?]*/gu) ?? []).map((sentence) => sentence.trim()).filter(Boolean);
49
- }
50
- function isVerbatimQuote(quote, source, options = {}) {
51
- const q = normalizeGroundingText(quote);
52
- if (!q) return false;
53
- if (normalizeGroundingText(source).includes(q)) return true;
54
- const words = q.split(" ").filter((word) => word.length > 1);
55
- if (words.length === 0) return false;
56
- const minShare = options.minShare ?? 0.9;
57
- for (const sentence of options.sentences ?? groundingSentences(source)) {
58
- const present = new Set(normalizeGroundingText(sentence).split(" "));
59
- const hits = words.filter((word) => present.has(word)).length;
60
- if (hits / words.length >= minShare) return true;
61
- }
62
- return false;
63
- }
64
- var COMMON = new Set(
65
- "about after also because been before being both could does each from have into just like more most much only other over same should some such than that their them then there these they this those through very what when where which while will with would your ours".split(
66
- " "
67
- )
68
- );
69
- function distinctiveStems(text) {
70
- return (text.toLowerCase().replace(/[‘’]/gu, "'").replace(/[“”]/gu, '"').replace(/[‐‑]/gu, "-").replace(/[‒–—―]/gu, " ").match(/[\p{L}\p{N}][\p{L}\p{N}'-]*/gu) ?? []).filter((word) => word.length >= 4 && !COMMON.has(word)).map((word) => word.slice(0, 4));
71
- }
72
- function isGroundedParaphrase(text, source, options = {}) {
73
- if (ungroundedNumber(text, source) !== void 0) return false;
74
- const stems = new Set(distinctiveStems(source));
75
- const words = distinctiveStems(text);
76
- const minShare = options.minShare ?? 2 / 3;
77
- return words.filter((word) => stems.has(word)).length >= Math.ceil(words.length * minShare);
78
- }
79
- function restatesHeadline(point, headline) {
80
- const title = distinctiveStems(headline);
81
- const words = distinctiveStems(point);
82
- const shared = words.filter((word) => title.includes(word)).length;
83
- return words.length > 0 && shared >= words.length * 0.6 || title.length >= 3 && title.every((word) => words.includes(word));
84
- }
85
- var RANGE = /(?:\bbetween\s+(\d[\d,]*(?:\.\d+)?)\s+and\s+(\d[\d,]*(?:\.\d+)?))|(?:(\d[\d,]*(?:\.\d+)?)\s*(?:[-–—]|\bto\b)\s*(\d[\d,]*(?:\.\d+)?))/giu;
86
- function statedRanges(source) {
87
- return [...source.matchAll(RANGE)].map((match) => ({
88
- low: (match[1] ?? match[3]).replace(/,/gu, ""),
89
- high: (match[2] ?? match[4]).replace(/,/gu, ""),
90
- text: match[0],
91
- index: match.index
92
- }));
93
- }
94
- function rangeEndOnly(value, source) {
95
- const [number] = numbersIn(value);
96
- if (number === void 0) return void 0;
97
- const ranges = statedRanges(source);
98
- if (ranges.length === 0) return void 0;
99
- if (spelledNumbers(source).some((spelled) => spelled.value === number)) return void 0;
100
- let first;
101
- for (const match of source.matchAll(NUMBER)) {
102
- if (match[0].replace(/,/gu, "") !== number) continue;
103
- const range = ranges.find(
104
- (candidate) => match.index >= candidate.index && match.index < candidate.index + candidate.text.length
105
- );
106
- if (!range) return void 0;
107
- first ?? (first = range);
108
- }
109
- return first;
110
- }
111
-
112
- export {
113
- normalizeGroundingText,
114
- numbersIn,
115
- spelledNumbers,
116
- sourceNumbers,
117
- ungroundedNumber,
118
- groundingSentences,
119
- isVerbatimQuote,
120
- distinctiveStems,
121
- isGroundedParaphrase,
122
- restatesHeadline,
123
- statedRanges,
124
- rangeEndOnly
125
- };