@versini/sassysaint-common 4.66.0 → 4.68.0

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/dist/index.d.ts CHANGED
@@ -557,6 +557,8 @@ export declare const isHardCategory: (category: string) => boolean;
557
557
  */
558
558
  export declare const isModelAllowedForPlan: (selectedModel: string | undefined | null, allowedModels: string[]) => boolean;
559
559
 
560
+ export declare function isNewsImageUrl(value: unknown): value is string;
561
+
560
562
  /**
561
563
  * Runtime guard: true only for a real, SDK-instantiable provider literal.
562
564
  * Returns false for undefined, null, and anything else. Shared by the server
@@ -840,11 +842,14 @@ export declare const MODELS_PER_PROVIDER: {
840
842
  export declare interface NewsBrief {
841
843
  asOf: string;
842
844
  note?: string;
845
+ place?: string;
843
846
  earlier?: {
844
847
  chatId: string;
845
848
  time: string;
846
849
  };
847
850
  items: NewsBriefItem[];
851
+ otherCommentary?: NewsCommentary[];
852
+ onThisDay?: NewsOnThisDay;
848
853
  }
849
854
 
850
855
  export declare interface NewsBriefItem {
@@ -852,7 +857,17 @@ export declare interface NewsBriefItem {
852
857
  title: string;
853
858
  summary: string;
854
859
  local: boolean;
860
+ image?: string;
855
861
  evidence: NewsEvidence[];
862
+ commentary?: NewsCommentary[];
863
+ }
864
+
865
+ export declare interface NewsCommentary {
866
+ author: string;
867
+ newsletter: string;
868
+ title: string;
869
+ url: string;
870
+ summary: string;
856
871
  }
857
872
 
858
873
  export declare interface NewsEvidence {
@@ -861,6 +876,12 @@ export declare interface NewsEvidence {
861
876
  url: string;
862
877
  }
863
878
 
879
+ export declare interface NewsOnThisDay {
880
+ title: string;
881
+ url: string;
882
+ line: string;
883
+ }
884
+
864
885
  /**
865
886
  * Color class mappings and CSS variables for the theme. Covers both color
866
887
  * schemes at once, via Tailwind `dark:` prefixes inside the class strings.
@@ -1 +1 @@
1
- function t(t){return"string"==typeof t&&""!==t.trim()}let e=new Set(['"',"\\","/","b","f","n","r","t","u"]),r={"\n":"\\n","\r":"\\r"," ":"\\t"};function n(t){return t.replace(/\\([\\|[\]])/g,"$1")}function l(l){let a,i=l.trim();if(!i||i.length>4e4)return null;try{a=function(t){try{return JSON.parse(t)}catch{return JSON.parse(function(t){let n="",l=!1;for(let a=0;a<t.length;a++){let i=t[a];if(l)if("\\"===i){let r=t[a+1]??"";n+=e.has(r)?`\\${r}`:`\\\\${r}`,a++}else'"'===i?(l=!1,n+=i):i<" "?n+=r[i]??`\\u${i.charCodeAt(0).toString(16).padStart(4,"0")}`:n+=i;else l='"'===i,n+=i}return n}(t))}}(i)}catch{return null}if(!a||!t(a.asOf)||!Array.isArray(a.items))return null;let u=new Set,f=a.items.flatMap(e=>{let{id:r,title:l,summary:a,local:i,evidence:f}=e??{};return!t(r)||u.has(r)||!t(l)||!t(a)?[]:(u.add(r),[{id:r,title:l,summary:a,local:!0===i,evidence:function(e){if(!Array.isArray(e))return[];let r=new Set;return e.flatMap(e=>{let{outlet:l,headline:a,url:i}=e??{};return!t(l)||!t(a)||!function(e){if(!t(e))return!1;try{let{protocol:t}=new URL(e);return"http:"===t||"https:"===t}catch{return!1}}(i)||r.has(i)?[]:(r.add(i),[{outlet:n(l),headline:n(a),url:i}])})}(f)}])}),s=a.earlier;return{asOf:a.asOf,...t(a.note)?{note:a.note}:{},...s&&t(s.chatId)&&t(s.time)?{earlier:{chatId:s.chatId,time:s.time}}:{},items:f}}let a=/^[^\S\n]{0,3}```(\w*)[^\S\n]*\n([\s\S]*?)\n[^\S\n]{0,3}```/gm;function i(t){for(let[,e,r]of t.matchAll(a))if("newsbrief"===e.toLowerCase()||""===e&&/"asOf"/.test(r)){let t=l(r);if(t)return t}return null}export{i as findNewsBrief,l as parseNewsBrief};
1
+ let t=/^https:\/\/encrypted-tbn\d\.gstatic\.com\/images\?q=tbn:[\w-]+$/;function e(e){return"string"==typeof e&&t.test(e)}function r(t){return"string"==typeof t&&""!==t.trim()}let n=new Set(['"',"\\","/","b","f","n","r","t","u"]),a={"\n":"\\n","\r":"\\r"," ":"\\t"};function l(t){return t.replace(/\\([\\|[\]])/g,"$1")}function i(t){if(!r(t))return!1;try{let{protocol:e}=new URL(t);return"http:"===e||"https:"===e}catch{return!1}}function u(t,e){return Array.isArray(t)?t.flatMap(t=>{let{author:n,newsletter:a,title:u,url:f,summary:s}=t??{};return!r(n)||!r(a)||!r(u)||!r(s)||!i(f)||e.has(f)?[]:(e.add(f),[{author:l(n),newsletter:a,title:l(u),url:f,summary:s}])}):[]}function f(t){let f,s=t.trim();if(!s||s.length>4e4)return null;try{f=function(t){try{return JSON.parse(t)}catch{return JSON.parse(function(t){let e="",r=!1;for(let l=0;l<t.length;l++){let i=t[l];if(r)if("\\"===i){let r=t[l+1]??"";e+=n.has(r)?`\\${r}`:`\\\\${r}`,l++}else'"'===i?(r=!1,e+=i):i<" "?e+=a[i]??`\\u${i.charCodeAt(0).toString(16).padStart(4,"0")}`:e+=i;else r='"'===i,e+=i}return e}(t))}}(s)}catch{return null}if(!f||!r(f.asOf)||!Array.isArray(f.items))return null;let o=new Set,c=function(t){let{title:e,url:n,line:a}=t??{};return r(e)&&i(n)&&r(a)?{title:l(e),url:n,line:a}:void 0}(f.onThisDay),h=new Set(c?[c.url]:[]),p=f.items.flatMap(t=>{let{id:n,title:a,summary:f,local:s,image:c,evidence:p,commentary:d}=t??{};if(!r(n)||o.has(n)||!r(a)||!r(f))return[];o.add(n);let m=u(d,h);return[{id:n,title:a,summary:f,local:!0===s,...e(c)?{image:c}:{},evidence:function(t){if(!Array.isArray(t))return[];let e=new Set;return t.flatMap(t=>{let{outlet:n,headline:a,url:u}=t??{};return!r(n)||!r(a)||!i(u)||e.has(u)?[]:(e.add(u),[{outlet:l(n),headline:l(a),url:u}])})}(p),...m.length>0?{commentary:m}:{}}]}),d=u(f.otherCommentary,h),m=f.earlier;return{asOf:f.asOf,...r(f.note)?{note:f.note}:{},...r(f.place)?{place:f.place}:{},...m&&r(m.chatId)&&r(m.time)?{earlier:{chatId:m.chatId,time:m.time}}:{},items:p,...d.length>0?{otherCommentary:d}:{},...c?{onThisDay:c}:{}}}let s=/^[^\S\n]{0,3}```(\w*)[^\S\n]*\n([\s\S]*?)\n[^\S\n]{0,3}```/gm;function o(t){for(let[,e,r]of t.matchAll(s))if("newsbrief"===e.toLowerCase()||""===e&&/"asOf"/.test(r)){let t=f(r);if(t)return t}return null}export{o as findNewsBrief,e as isNewsImageUrl,f as parseNewsBrief};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versini/sassysaint-common",
3
- "version": "4.66.0",
3
+ "version": "4.68.0",
4
4
  "license": "MIT",
5
5
  "author": "Arno Versini",
6
6
  "publishConfig": {