@versini/sassysaint-common 4.55.0 → 4.56.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
@@ -442,6 +442,54 @@ declare interface IsEntitledOptions {
442
442
  set?: Set<string>;
443
443
  }
444
444
 
445
+ /**
446
+ * Deterministic detection of an explicit "start a new chat" request typed into
447
+ * the composer.
448
+ *
449
+ * Some users ask for a new chat in prose instead of clicking the New Chat
450
+ * button. Honoring that is helpful, but starting a new chat is DISRUPTIVE: the
451
+ * current conversation is left behind and the composer is reset. So the client
452
+ * never acts on a match directly — it opens a confirmation dialog, and the user
453
+ * decides.
454
+ *
455
+ * That still makes a false positive expensive: a dialog thrown in the user's
456
+ * face mid-thought, over a sentence that merely mentioned the words. This
457
+ * predicate is therefore tuned hard for PRECISION over recall. A missed
458
+ * phrasing costs nothing — the New Chat button is right there — while a wrong
459
+ * fire interrupts.
460
+ *
461
+ * **A request must BE the sentence, not appear in it.** That single rule is
462
+ * what makes the predicate safe, and it was learned the hard way: an earlier
463
+ * cut also matched "start a new chat" anywhere in a sentence, on the theory
464
+ * that "chat" and "conversation" could only ever mean this app. Measured
465
+ * against real phrasings, that fired on `Translate to French: please start a
466
+ * new chat.`, `can you write code to open a new chat window?`, `the docs say to
467
+ * start a new chat` and `why did you start a new chat` — an assistant that
468
+ * answers programming and writing questions sees these constantly. Requiring
469
+ * the whole sentence removes the entire class, and it removes it for every noun
470
+ * at once, which is why there is one noun list here instead of the
471
+ * safe/ambiguous split an unanchored pattern needed.
472
+ *
473
+ * Deliberately NOT handled: "clear this chat", "reset", "start over". Those are
474
+ * different asks with different blast radii.
475
+ *
476
+ */
477
+ /**
478
+ * True when the text reads as an explicit instruction to start a new chat.
479
+ *
480
+ * The WHOLE message must be the request. An earlier cut split on sentence
481
+ * terminators and fired if any fragment matched, which meant a long paste
482
+ * ending in "Create a new thread." silently reset the chat — the terminator
483
+ * manufactured a bare-looking fragment out of ordinary prose. Requiring the
484
+ * entire composer to be the request removes that class outright, and it is what
485
+ * makes skipping the confirmation on an empty chat honest: if the message is
486
+ * nothing but "new chat", there is genuinely nothing to lose.
487
+ *
488
+ * @param text - Raw composer input.
489
+ *
490
+ */
491
+ export declare function isExplicitNewChatRequest(text: string): boolean;
492
+
445
493
  /**
446
494
  * True when `category` is a hard (auto-persist) category.
447
495
  */
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- let e=["preference","identity","constraint","habit","bio","device","location","finance","professional","interest","style","behavior","other"],E=["identity","bio","constraint","professional"],t=e=>E.includes(e);var O,n=((O={})[O.NewChat=0]="NewChat",O[O.Prompts=1]="Prompts",O[O.Attachment=2]="Attachment",O[O.PrivateChat=3]="PrivateChat",O[O.Send=4]="Send",O[O.Header=5]="Header",O[O.Provider=6]="Provider",O[O.Logo=7]="Logo",O[O.Placeholder=8]="Placeholder",O[O.Footer=9]="Footer",O);let r="system",i="user",o="assistant",a="OpenAI",_="Anthropic",T="Google",s="Summary",R="Memory",S="Perplexity",A=a,I=[a,_,T],l="gpt-5.6-sol",L="gpt-5.6-terra",M="gpt-5.6-luna",P="claude-opus-5",g="claude-sonnet-5",N="claude-haiku-4-5",u="gemini-3.7-flash",c="gemini-3.5-flash-lite",D="sonar",d="sonar-pro",C="perplexity-search",h="openai/gpt-oss-20b:free",p="gpt-5.6-luna",U="gpt-5.6-luna",G="gemini-3.5-flash-lite",m="gemini-3.7-flash",f="gpt-5.6-terra",H="gpt-5.6-luna",y="gpt-5.6-luna",B="gemini-3.6-flash",Y="text-embedding-3-small",b="gemini-3-pro-image",v=5,F=1e4,V=3e3,w={[l]:"GPT-5.6 Sol",[L]:"GPT-5.6 Terra",[M]:"GPT-5.6 Luna",[P]:"Claude Opus 5",[g]:"Claude Sonnet 5",[N]:"Claude Haiku 4.5",[u]:"Gemini 3.7 Flash",[c]:"Gemini 3.5 Flash-Lite",[D]:"Sonar",[d]:"Sonar Pro",[C]:"Perplexity Search",[b]:"Nano Banana 3 Pro"},W=[l,L,M,P,g,N,c,u,b],X=[l,L,M,P,g,u,c],k={[a]:[l,L,M],[_]:[P,N,g],[T]:[c,u],[S]:[D,d,C]},x={[a]:[r,i,o],[_]:[i,o],[s]:[i,o],[R]:[i,o],[T]:[i,o],[S]:[i,o]},K={[_]:["claude-opus-5","claude-opus-4","claude-sonnet-5","claude-sonnet-4","claude-haiku-4","claude-3"],[a]:["gpt-","o3","o4"],[T]:["gemini"],[S]:["sonar"]},Z="x-diggidy-chat-id",z="x-diggidy-chat-timestamp",j="complete",Q="timestamp",$="tokenUsage",q="Diggidy",J="sassy:basic",ee="sassy:plus",eE="sassy:advanced",et={TOOL:{BARCODE:"getProductByBarcode",BUNDLESIZE:"getBundleSize",DATETIME:"getDateTime",GENERATE_IMAGE:"generateImage",IMAGES:"getImages",NUTRITION_FACTS:"getNutritionFacts",POLLUTION:"getAirPollution",WEATHER:"getWeather",URLCONTENTPARSER:"getUrlContent",MEMORIES:"getUserMemories",HUMANIZE:"humanize",WEBSEARCH:"getWebSearch",GITREPOSITORY:"getGitRepoDetails",HOTELS:"getHotelDetails",LOCAL_BUSINESSES:"getLocalBusinesses",PRODUCTS:"getProducts",REVIEW_TRUST:"getReviewTrust",STREAMING_PICKS:"getStreamingPicks",PRONUNCIATION:"getPronunciation",FRENCH_TEACHINGS:"getFrenchTeachings"},ADDON:{ATTACHMENTS:"addon:attachments",CODEINTERPRETER:"addon:codeinterpreter",SHARE_CHAT:"addon:share-chat"}},eO={code_interpreter:"Running code...",web_search:"Searching the web...",[et.TOOL.WEATHER]:"Checking the weather...",[et.TOOL.POLLUTION]:"Fetching air pollution data...",[et.TOOL.BUNDLESIZE]:"Analyzing bundle size...",[et.TOOL.URLCONTENTPARSER]:"Reading a webpage...",[et.TOOL.WEBSEARCH]:"Searching the web...",[et.TOOL.GITREPOSITORY]:"Looking up repository...",[et.TOOL.HOTELS]:"Searching for hotels...",[et.TOOL.LOCAL_BUSINESSES]:"Searching for local businesses...",[et.TOOL.PRODUCTS]:"Searching for products...",[et.TOOL.REVIEW_TRUST]:"Checking reviews...",[et.TOOL.STREAMING_PICKS]:"Finding movies to stream...",[et.TOOL.NUTRITION_FACTS]:"Fetching nutrition facts...",[et.TOOL.GENERATE_IMAGE]:"Generating image...",[et.TOOL.BARCODE]:"Looking up product...",[et.TOOL.PRONUNCIATION]:"Generating pronunciation...",[et.TOOL.HUMANIZE]:"Rewriting text...",[et.TOOL.IMAGES]:"Searching for images..."},en="Using tools...",er=1e5,ei=8e5;function eo(e){return e===eE?ei:er}let ea=16384,e_=4,eT=3,es=8388608,eR="context-compression-summary",eS=new Set(["OpenAI",_,"Google"]);function eA(e){return"string"==typeof e&&eS.has(e)}let eI=/^auto \((.+)\)$/;function el(e){let E=e.match(eI);return E?E[1]:e}let eL=e=>{for(let[E,t]of Object.entries(K))if(t.some(E=>e.startsWith(E)))return E;return null},eM=e=>{if(!e||0===e.length)return[];let E=new Set;for(let t of e)for(let[e,O]of Object.entries(k))O.includes(t)&&("OpenAI"===e||e===_||"Google"===e)&&E.add(e);return I.filter(e=>E.has(e))},eP=e=>{let E=new Map;if(!e||0===e.length)return E;for(let t of e)for(let[e,O]of Object.entries(k))if(O.includes(t)){E.has(e)||E.set(e,[]),E.get(e)?.push(t);break}return E},eg=e=>{for(let E of eP(e).values())if(E.length>1)return!0;return!1},eN=(e,E)=>!!e&&!!E&&0!==E.length&&E.includes(e);function eu(e,E,t){if(!E||Array.isArray(E)&&0===E.length)return!0;let O=e instanceof Set?e:e?new Set(e):null;return!!O&&0!==O.size&&("string"==typeof E?O.has(E):t?.any===!0?E.some(e=>O.has(e)):E.every(e=>O.has(e)))}function ec(e){return X.includes(e)}export{W as ALL_MODELS,I as ALL_PROVIDERS,X as ALL_REASONING_MODELS,q as APPLICATION_NAME,K as APPROXIMATE_MODELS_PER_PROVIDER,et as CAPABILITIES,j as CHAT_COMPLETION_MARKER_KEY,er as CONTEXT_COMPRESSION_EMERGENCY_THRESHOLD,ei as CONTEXT_COMPRESSION_EMERGENCY_THRESHOLD_PREMIUM,eT as CONTEXT_COMPRESSION_KEEP_IMAGES,e_ as CONTEXT_COMPRESSION_KEEP_RECENT,es as CONTEXT_COMPRESSION_MAX_DOCUMENT_BYTES,eR as CONTEXT_COMPRESSION_SUMMARY_ID,A as DEFAULT_PROVIDER,en as DEFAULT_TOOL_LOADING_LABEL,Z as DIGGIDY_CHAT_ID_HEADER,z as DIGGIDY_CHAT_TIMESTAMP_HEADER,E as HARD_CATEGORIES,ea as MAX_OUTPUT_TOKENS,v as MAX_SEARCH_QUERIES,e as MEMORY_CATEGORIES,k as MODELS_PER_PROVIDER,N as MODEL_ANTHROPIC_LOW,g as MODEL_ANTHROPIC_MEDIUM,P as MODEL_ANTHROPIC_TOP,U as MODEL_CHAT_SUMMARY,h as MODEL_DEV,w as MODEL_DISPLAY_NAMES,Y as MODEL_EMBEDDING_TEXT,b as MODEL_GENERATE_IMAGE,c as MODEL_GOOGLE_MEDIUM,u as MODEL_GOOGLE_TOP,f as MODEL_HUMANIZE_AUDIT,m as MODEL_HUMANIZE_REWRITE,p as MODEL_MEMORY_INFERENCE,H as MODEL_NUTRITION_SEARCH,M as MODEL_OPENAI_LOW,L as MODEL_OPENAI_MEDIUM,l as MODEL_OPENAI_TOP,C as MODEL_PERPLEXITY_SEARCH,y as MODEL_REVIEW_TRUST_PANEL,B as MODEL_REVIEW_TRUST_PANEL_GOOGLE,G as MODEL_SEARCH_DECOMPOSER,D as MODEL_SONAR,d as MODEL_SONAR_PRO,J as PLAN_BASIC,ee as PLAN_PLUS,eE as PLAN_PREMIUM,_ as PROVIDER_ANTHROPIC,T as PROVIDER_GOOGLE,R as PROVIDER_MEMORY,a as PROVIDER_OPENAI,S as PROVIDER_PERPLEXITY,x as PROVIDER_ROLE_MAP,s as PROVIDER_SUMMARY,o as ROLE_ASSISTANT,r as ROLE_SYSTEM,i as ROLE_USER,V as SEARCH_DECOMPOSE_TIMEOUT_MS,F as SEARCH_QUERY_TIMEOUT_MS,Q as SORT_BY_TIMESTAMP,$ as SORT_BY_TOKEN_USAGE,eO as TOOL_LOADING_LABELS,eL as findProvider,eo as getCompressionEmergencyThreshold,eP as getModelsGroupedByProvider,eM as getProvidersFromModels,eg as hasMultipleModelsPerProvider,eu as isEntitled,t as isHardCategory,eN as isModelAllowedForPlan,eA as isRealProvider,ec as isReasoningModel,el as stripAutoWrapper,n as ActionColor};
1
+ let e=["preference","identity","constraint","habit","bio","device","location","finance","professional","interest","style","behavior","other"],t=["identity","bio","constraint","professional"],E=e=>t.includes(e);var n,r=((n={})[n.NewChat=0]="NewChat",n[n.Prompts=1]="Prompts",n[n.Attachment=2]="Attachment",n[n.PrivateChat=3]="PrivateChat",n[n.Send=4]="Send",n[n.Header=5]="Header",n[n.Provider=6]="Provider",n[n.Logo=7]="Logo",n[n.Placeholder=8]="Placeholder",n[n.Footer=9]="Footer",n);let O="system",a="user",i="assistant",o="OpenAI",s="Anthropic",_="Google",T="Summary",R="Memory",l="Perplexity",S=o,A=[o,s,_],I="gpt-5.6-sol",L="gpt-5.6-terra",M="gpt-5.6-luna",g="claude-opus-5",P="claude-sonnet-5",u="claude-haiku-4-5",c="gemini-3.7-flash",N="gemini-3.5-flash-lite",h="sonar",d="sonar-pro",D="perplexity-search",C="openai/gpt-oss-20b:free",p="gpt-5.6-luna",m="gpt-5.6-luna",U="gemini-3.5-flash-lite",f="gemini-3.7-flash",G="gpt-5.6-terra",H="gpt-5.6-luna",y="gpt-5.6-luna",B="gemini-3.6-flash",w="text-embedding-3-small",Y="gemini-3-pro-image",b=5,v=1e4,F=3e3,V={[I]:"GPT-5.6 Sol",[L]:"GPT-5.6 Terra",[M]:"GPT-5.6 Luna",[g]:"Claude Opus 5",[P]:"Claude Sonnet 5",[u]:"Claude Haiku 4.5",[c]:"Gemini 3.7 Flash",[N]:"Gemini 3.5 Flash-Lite",[h]:"Sonar",[d]:"Sonar Pro",[D]:"Perplexity Search",[Y]:"Nano Banana 3 Pro"},k=[I,L,M,g,P,u,N,c,Y],W=[I,L,M,g,P,c,N],X={[o]:[I,L,M],[s]:[g,u,P],[_]:[N,c],[l]:[h,d,D]},x={[o]:[O,a,i],[s]:[a,i],[T]:[a,i],[R]:[a,i],[_]:[a,i],[l]:[a,i]},K={[s]:["claude-opus-5","claude-opus-4","claude-sonnet-5","claude-sonnet-4","claude-haiku-4","claude-3"],[o]:["gpt-","o3","o4"],[_]:["gemini"],[l]:["sonar"]},z="x-diggidy-chat-id",Z="x-diggidy-chat-timestamp",$="complete",j="timestamp",Q="tokenUsage",q="Diggidy",J="sassy:basic",ee="sassy:plus",et="sassy:advanced",eE={TOOL:{BARCODE:"getProductByBarcode",BUNDLESIZE:"getBundleSize",DATETIME:"getDateTime",GENERATE_IMAGE:"generateImage",IMAGES:"getImages",NUTRITION_FACTS:"getNutritionFacts",POLLUTION:"getAirPollution",WEATHER:"getWeather",URLCONTENTPARSER:"getUrlContent",MEMORIES:"getUserMemories",HUMANIZE:"humanize",WEBSEARCH:"getWebSearch",GITREPOSITORY:"getGitRepoDetails",HOTELS:"getHotelDetails",LOCAL_BUSINESSES:"getLocalBusinesses",PRODUCTS:"getProducts",REVIEW_TRUST:"getReviewTrust",STREAMING_PICKS:"getStreamingPicks",PRONUNCIATION:"getPronunciation",FRENCH_TEACHINGS:"getFrenchTeachings"},ADDON:{ATTACHMENTS:"addon:attachments",CODEINTERPRETER:"addon:codeinterpreter",SHARE_CHAT:"addon:share-chat"}},en={code_interpreter:"Running code...",web_search:"Searching the web...",[eE.TOOL.WEATHER]:"Checking the weather...",[eE.TOOL.POLLUTION]:"Fetching air pollution data...",[eE.TOOL.BUNDLESIZE]:"Analyzing bundle size...",[eE.TOOL.URLCONTENTPARSER]:"Reading a webpage...",[eE.TOOL.WEBSEARCH]:"Searching the web...",[eE.TOOL.GITREPOSITORY]:"Looking up repository...",[eE.TOOL.HOTELS]:"Searching for hotels...",[eE.TOOL.LOCAL_BUSINESSES]:"Searching for local businesses...",[eE.TOOL.PRODUCTS]:"Searching for products...",[eE.TOOL.REVIEW_TRUST]:"Checking reviews...",[eE.TOOL.STREAMING_PICKS]:"Finding movies to stream...",[eE.TOOL.NUTRITION_FACTS]:"Fetching nutrition facts...",[eE.TOOL.GENERATE_IMAGE]:"Generating image...",[eE.TOOL.BARCODE]:"Looking up product...",[eE.TOOL.PRONUNCIATION]:"Generating pronunciation...",[eE.TOOL.HUMANIZE]:"Rewriting text...",[eE.TOOL.IMAGES]:"Searching for images..."},er="Using tools...",eO=1e5,ea=8e5;function ei(e){return e===et?ea:eO}let eo=16384,es=4,e_=3,eT=8388608,eR="context-compression-summary",el="(?:an?\\s+|another\\s+)?",eS=RegExp(`^(?:(?:ok(?:ay)?|alright|right|hey|hi|hello|yes|yep|yeah|sure|thanks|thank you|please|claude|diggidy)[\\s,]+)*(?:(?:(?:let'?s\\s+|can you\\s+|could you\\s+|can we\\s+|please\\s+)?(?:start|begin|create|open)\\s+)?${el}(?:new|fresh)\\s+(?:chat|conversation)|${el}(?:new|fresh)\\s+(?:thread|session))(?:[\\s,]+(?:please|pls|plz|now|thanks|thank you|thx|ty))*$`),eA=/^[^\p{L}\p{N}]+/u,eI=/[^\p{L}\p{N}]+$/u;function eL(e){if(!e||e.length>120)return!1;let t=e.toLowerCase().replace(/’/g,"'").replace(/\s+/g," ").trim().replace(eA,"").replace(eI,"").trim();return""!==t&&eS.test(t)}let eM=new Set(["OpenAI",s,"Google"]);function eg(e){return"string"==typeof e&&eM.has(e)}let eP=/^auto \((.+)\)$/;function eu(e){let t=e.match(eP);return t?t[1]:e}let ec=e=>{for(let[t,E]of Object.entries(K))if(E.some(t=>e.startsWith(t)))return t;return null},eN=e=>{if(!e||0===e.length)return[];let t=new Set;for(let E of e)for(let[e,n]of Object.entries(X))n.includes(E)&&("OpenAI"===e||e===s||"Google"===e)&&t.add(e);return A.filter(e=>t.has(e))},eh=e=>{let t=new Map;if(!e||0===e.length)return t;for(let E of e)for(let[e,n]of Object.entries(X))if(n.includes(E)){t.has(e)||t.set(e,[]),t.get(e)?.push(E);break}return t},ed=e=>{for(let t of eh(e).values())if(t.length>1)return!0;return!1},eD=(e,t)=>!!e&&!!t&&0!==t.length&&t.includes(e);function eC(e,t,E){if(!t||Array.isArray(t)&&0===t.length)return!0;let n=e instanceof Set?e:e?new Set(e):null;return!!n&&0!==n.size&&("string"==typeof t?n.has(t):E?.any===!0?t.some(e=>n.has(e)):t.every(e=>n.has(e)))}function ep(e){return W.includes(e)}export{k as ALL_MODELS,A as ALL_PROVIDERS,W as ALL_REASONING_MODELS,q as APPLICATION_NAME,K as APPROXIMATE_MODELS_PER_PROVIDER,eE as CAPABILITIES,$ as CHAT_COMPLETION_MARKER_KEY,eO as CONTEXT_COMPRESSION_EMERGENCY_THRESHOLD,ea as CONTEXT_COMPRESSION_EMERGENCY_THRESHOLD_PREMIUM,e_ as CONTEXT_COMPRESSION_KEEP_IMAGES,es as CONTEXT_COMPRESSION_KEEP_RECENT,eT as CONTEXT_COMPRESSION_MAX_DOCUMENT_BYTES,eR as CONTEXT_COMPRESSION_SUMMARY_ID,S as DEFAULT_PROVIDER,er as DEFAULT_TOOL_LOADING_LABEL,z as DIGGIDY_CHAT_ID_HEADER,Z as DIGGIDY_CHAT_TIMESTAMP_HEADER,t as HARD_CATEGORIES,eo as MAX_OUTPUT_TOKENS,b as MAX_SEARCH_QUERIES,e as MEMORY_CATEGORIES,X as MODELS_PER_PROVIDER,u as MODEL_ANTHROPIC_LOW,P as MODEL_ANTHROPIC_MEDIUM,g as MODEL_ANTHROPIC_TOP,m as MODEL_CHAT_SUMMARY,C as MODEL_DEV,V as MODEL_DISPLAY_NAMES,w as MODEL_EMBEDDING_TEXT,Y as MODEL_GENERATE_IMAGE,N as MODEL_GOOGLE_MEDIUM,c as MODEL_GOOGLE_TOP,G as MODEL_HUMANIZE_AUDIT,f as MODEL_HUMANIZE_REWRITE,p as MODEL_MEMORY_INFERENCE,H as MODEL_NUTRITION_SEARCH,M as MODEL_OPENAI_LOW,L as MODEL_OPENAI_MEDIUM,I as MODEL_OPENAI_TOP,D as MODEL_PERPLEXITY_SEARCH,y as MODEL_REVIEW_TRUST_PANEL,B as MODEL_REVIEW_TRUST_PANEL_GOOGLE,U as MODEL_SEARCH_DECOMPOSER,h as MODEL_SONAR,d as MODEL_SONAR_PRO,J as PLAN_BASIC,ee as PLAN_PLUS,et as PLAN_PREMIUM,s as PROVIDER_ANTHROPIC,_ as PROVIDER_GOOGLE,R as PROVIDER_MEMORY,o as PROVIDER_OPENAI,l as PROVIDER_PERPLEXITY,x as PROVIDER_ROLE_MAP,T as PROVIDER_SUMMARY,i as ROLE_ASSISTANT,O as ROLE_SYSTEM,a as ROLE_USER,F as SEARCH_DECOMPOSE_TIMEOUT_MS,v as SEARCH_QUERY_TIMEOUT_MS,j as SORT_BY_TIMESTAMP,Q as SORT_BY_TOKEN_USAGE,en as TOOL_LOADING_LABELS,ec as findProvider,ei as getCompressionEmergencyThreshold,eh as getModelsGroupedByProvider,eN as getProvidersFromModels,ed as hasMultipleModelsPerProvider,eC as isEntitled,eL as isExplicitNewChatRequest,E as isHardCategory,eD as isModelAllowedForPlan,eg as isRealProvider,ep as isReasoningModel,eu as stripAutoWrapper,r as ActionColor};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@versini/sassysaint-common",
3
- "version": "4.55.0",
3
+ "version": "4.56.0",
4
4
  "license": "MIT",
5
5
  "author": "Arno Versini",
6
6
  "publishConfig": {