@deadair/plugin-sdk 0.89.4 → 0.89.5

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.
@@ -68,6 +68,15 @@ export declare function truncateSentences(value: string, maxChars: number): stri
68
68
  * branching on the length itself.
69
69
  */
70
70
  export declare function sentencesWithin(value: string, maxWords: number): string | undefined;
71
+ /**
72
+ * A passage up to the end of its last WHOLE sentence, or nothing when it never finished one.
73
+ *
74
+ * For text that stopped rather than ended, such as a model's answer cut off at its token ceiling. On
75
+ * the same boundary {@link sentencesWithin} cuts at, and for the same reason it has no fallback: half
76
+ * a sentence read aloud is worse than anything a caller has instead. A passage that ends a sentence
77
+ * comes back trimmed and otherwise untouched.
78
+ */
79
+ export declare function wholeSentencesOf(value: string): string | undefined;
71
80
  /**
72
81
  * A passage as its whole sentences, in order, each with its closing quotes kept.
73
82
  *
@@ -1 +1 @@
1
- {"version":3,"file":"html.text.d.ts","sourceRoot":"","sources":["../src/html.text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA4BH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CASpD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAO5E;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMrE;AAkCD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAUnD;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAYzE;AAeD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAgBnF;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAiBnD"}
1
+ {"version":3,"file":"html.text.d.ts","sourceRoot":"","sources":["../src/html.text.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA4BH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CASpD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAO5E;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMrE;AAkCD;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAUnD;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAYzE;AAeD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAgBnF;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAelE;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAiBnD"}
package/dist/index.js CHANGED
@@ -550,6 +550,18 @@ function sentencesWithin(value, maxWords) {
550
550
  return fits;
551
551
  }
552
552
  __name(sentencesWithin, "sentencesWithin");
553
+ function wholeSentencesOf(value) {
554
+ const text2 = value.trim();
555
+ const last = /[.!?]["'”’»)\]]*$/u.exec(text2);
556
+ if (last !== null && endsSentence(text2, last.index)) return text2;
557
+ let whole;
558
+ SENTENCE_END.lastIndex = 0;
559
+ for (let match = SENTENCE_END.exec(text2); match !== null; match = SENTENCE_END.exec(text2)) {
560
+ if (endsSentence(text2, match.index)) whole = text2.slice(0, match.index + 1 + closersIn(match[0]).length);
561
+ }
562
+ return whole;
563
+ }
564
+ __name(wholeSentencesOf, "wholeSentencesOf");
553
565
  function sentencesOf(value) {
554
566
  const text2 = value.trim();
555
567
  const sentences = [];
@@ -1726,6 +1738,7 @@ export {
1726
1738
  upstreamDetail,
1727
1739
  upstreamField,
1728
1740
  variadicLogger,
1741
+ wholeSentencesOf,
1729
1742
  withoutCues
1730
1743
  };
1731
1744
  //# sourceMappingURL=index.js.map