@versini/sassysaint-common 4.54.0 → 4.54.1
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 +51 -18
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -120,16 +120,30 @@ export declare const CHAT_COMPLETION_MARKER_KEY = "complete";
|
|
|
120
120
|
export declare type ColorMap = Partial<Record<ActionColor, string>>;
|
|
121
121
|
|
|
122
122
|
/**
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
*
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
123
|
+
* The ONLY threshold that triggers context compression, and it is a safety
|
|
124
|
+
* floor rather than an optimisation: an unbounded conversation would eventually
|
|
125
|
+
* exceed the model's context window and fail the request opaquely.
|
|
126
|
+
*
|
|
127
|
+
* There was a routine threshold above this (50k accumulated tokens) until
|
|
128
|
+
* #3184, on the assumption that summarising older turns saved money. The
|
|
129
|
+
* summary is regenerated every turn and sits at the head of the message array,
|
|
130
|
+
* so it invalidates the Anthropic cache prefix the whole history is read from —
|
|
131
|
+
* turning a 0.1x read of the full conversation into a 1.25x re-write of the
|
|
132
|
+
* compressed one, every turn, plus a summariser call on the critical path.
|
|
133
|
+
* `pnpm cache:probe --compressed` measured 12.19x the effective input of not
|
|
134
|
+
* compressing ON A DOCUMENT CHAT, warm cache, Anthropic; see the block at the
|
|
135
|
+
* compression call site in vercelEngine.ts for why none of those three
|
|
136
|
+
* qualifiers may be dropped when quoting that number.
|
|
137
|
+
*
|
|
138
|
+
* BEWARE THE UNIT. Both floors are compared against the client's accumulated
|
|
139
|
+
* `contextTokenUsage`, which sums each turn's full prompt plus output, so it
|
|
140
|
+
* grows quadratically in turns while real context grows linearly. They are not
|
|
141
|
+
* context-window percentages and must not be read as any: 100_000 accumulated
|
|
142
|
+
* is reached at roughly 13.5k of real context in an ordinary text chat. Fixing
|
|
143
|
+
* the unit is #3180; until then these numbers are calibration, not capacity.
|
|
144
|
+
*
|
|
145
|
+
* Premium's floor is far higher because its plans unlock large-context models
|
|
146
|
+
* and a flat low value would compress those chats needlessly early.
|
|
133
147
|
*
|
|
134
148
|
*/
|
|
135
149
|
export declare const CONTEXT_COMPRESSION_EMERGENCY_THRESHOLD = 100000;
|
|
@@ -141,8 +155,9 @@ export declare const CONTEXT_COMPRESSION_EMERGENCY_THRESHOLD_PREMIUM = 800000;
|
|
|
141
155
|
* are compressed into a text summary. Compression flattens older turns into
|
|
142
156
|
* image-blind text; without this the original upload and every previously
|
|
143
157
|
* generated image would silently vanish from what the model can see, breaking
|
|
144
|
-
* iterative image editing and vision follow-ups. Bounded so a few images
|
|
145
|
-
*
|
|
158
|
+
* iterative image editing and vision follow-ups. Bounded so a few images cannot
|
|
159
|
+
* stop an emergency compression from shrinking the context below the window it
|
|
160
|
+
* is protecting.
|
|
146
161
|
*/
|
|
147
162
|
export declare const CONTEXT_COMPRESSION_KEEP_IMAGES = 3;
|
|
148
163
|
|
|
@@ -154,16 +169,34 @@ export declare const CONTEXT_COMPRESSION_KEEP_IMAGES = 3;
|
|
|
154
169
|
export declare const CONTEXT_COMPRESSION_KEEP_RECENT = 4;
|
|
155
170
|
|
|
156
171
|
/**
|
|
157
|
-
*
|
|
158
|
-
*
|
|
172
|
+
* Byte budget for attached DOCUMENTS (non-image file parts) carried across a
|
|
173
|
+
* compression, measured on the `data:` URL string, newest kept first.
|
|
174
|
+
*
|
|
175
|
+
* A budget rather than a count, because documents vary by three orders of
|
|
176
|
+
* magnitude where images do not: one 20 MB PDF and twenty 40 KB ones are both
|
|
177
|
+
* plausible, and only bytes describe the wall we are avoiding. Two walls,
|
|
178
|
+
* specifically — MongoDB's 16 MiB per-document limit, where
|
|
179
|
+
* `persistChatSession` throws into a catch that only logs, and the route's 30
|
|
180
|
+
* MB bodyLimit, which returns a raw 413.
|
|
181
|
+
*
|
|
182
|
+
* There is deliberately no per-CHAT ceiling upstream: MAX_PDF_FILE_SIZE and
|
|
183
|
+
* MAX_TOTAL_UPLOAD_BYTES are both per-TURN, so before this budget existed a
|
|
184
|
+
* user attaching a document per turn accumulated them without bound (measured:
|
|
185
|
+
* 12 documents after 12 turns, and one still carried 50 unrelated turns later).
|
|
186
|
+
*
|
|
187
|
+
* 8 MiB leaves room for the rest of the chat inside the 16 MiB document limit.
|
|
188
|
+
* Anything dropped is ANNOUNCED in the summary text — a silent drop is the
|
|
189
|
+
* exact bug #3178 fixed, and a cap without the announcement would reintroduce
|
|
190
|
+
* it.
|
|
191
|
+
*
|
|
159
192
|
*/
|
|
160
|
-
export declare const
|
|
193
|
+
export declare const CONTEXT_COMPRESSION_MAX_DOCUMENT_BYTES: number;
|
|
161
194
|
|
|
162
195
|
/**
|
|
163
|
-
*
|
|
164
|
-
*
|
|
196
|
+
* Stable ID assigned to the summary message produced by context compression.
|
|
197
|
+
* Used to identify (and hide) the summary in the UI.
|
|
165
198
|
*/
|
|
166
|
-
export declare const
|
|
199
|
+
export declare const CONTEXT_COMPRESSION_SUMMARY_ID = "context-compression-summary";
|
|
167
200
|
|
|
168
201
|
/**
|
|
169
202
|
* CSS variables that can be dynamically applied to document.documentElement.
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
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 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.6-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",m="gemini-3.5-flash-lite",G="gemini-3.6-flash",
|
|
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 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.6-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",m="gemini-3.5-flash-lite",G="gemini-3.6-flash",f="gpt-5.6-terra",H="gpt-5.6-luna",y="gpt-5.6-luna",B="text-embedding-3-small",Y="gemini-3-pro-image",b=5,v=1e4,F=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.6 Flash",[c]:"Gemini 3.5 Flash-Lite",[D]:"Sonar",[d]:"Sonar Pro",[C]:"Perplexity Search",[Y]:"Nano Banana 3 Pro"},V=[l,L,M,P,g,N,c,u,Y],W=[l,L,M,P,g,u,c],X={[a]:[l,L,M],[_]:[P,N,g],[T]:[c,u],[S]:[D,d,C]},k={[a]:[r,i,o],[_]:[i,o],[s]:[i,o],[R]:[i,o],[T]:[i,o],[S]:[i,o]},x={[_]:["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"]},K="x-diggidy-chat-id",Z="x-diggidy-chat-timestamp",z="complete",j="timestamp",Q="tokenUsage",$="Diggidy",q="sassy:basic",J="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"}},eE={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..."},eO="Using tools...",en=1e5,er=8e5;function ei(e){return e===ee?er:en}let eo=16384,ea=4,e_=3,eT=8388608,es="context-compression-summary",eR=new Set(["OpenAI",_,"Google"]);function eS(e){return"string"==typeof e&&eR.has(e)}let eA=/^auto \((.+)\)$/;function eI(e){let t=e.match(eA);return t?t[1]:e}let el=e=>{for(let[t,E]of Object.entries(x))if(E.some(t=>e.startsWith(t)))return t;return null},eL=e=>{if(!e||0===e.length)return[];let t=new Set;for(let E of e)for(let[e,O]of Object.entries(X))O.includes(E)&&("OpenAI"===e||e===_||"Google"===e)&&t.add(e);return I.filter(e=>t.has(e))},eM=e=>{let t=new Map;if(!e||0===e.length)return t;for(let E of e)for(let[e,O]of Object.entries(X))if(O.includes(E)){t.has(e)||t.set(e,[]),t.get(e)?.push(E);break}return t},eP=e=>{for(let t of eM(e).values())if(t.length>1)return!0;return!1},eg=(e,t)=>!!e&&!!t&&0!==t.length&&t.includes(e);function eN(e,t,E){if(!t||Array.isArray(t)&&0===t.length)return!0;let O=e instanceof Set?e:e?new Set(e):null;return!!O&&0!==O.size&&("string"==typeof t?O.has(t):E?.any===!0?t.some(e=>O.has(e)):t.every(e=>O.has(e)))}function eu(e){return W.includes(e)}export{V as ALL_MODELS,I as ALL_PROVIDERS,W as ALL_REASONING_MODELS,$ as APPLICATION_NAME,x as APPROXIMATE_MODELS_PER_PROVIDER,et as CAPABILITIES,z as CHAT_COMPLETION_MARKER_KEY,en as CONTEXT_COMPRESSION_EMERGENCY_THRESHOLD,er as CONTEXT_COMPRESSION_EMERGENCY_THRESHOLD_PREMIUM,e_ as CONTEXT_COMPRESSION_KEEP_IMAGES,ea as CONTEXT_COMPRESSION_KEEP_RECENT,eT as CONTEXT_COMPRESSION_MAX_DOCUMENT_BYTES,es as CONTEXT_COMPRESSION_SUMMARY_ID,A as DEFAULT_PROVIDER,eO as DEFAULT_TOOL_LOADING_LABEL,K 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,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,B as MODEL_EMBEDDING_TEXT,Y as MODEL_GENERATE_IMAGE,c as MODEL_GOOGLE_MEDIUM,u as MODEL_GOOGLE_TOP,f as MODEL_HUMANIZE_AUDIT,G 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,m as MODEL_SEARCH_DECOMPOSER,D as MODEL_SONAR,d as MODEL_SONAR_PRO,q as PLAN_BASIC,J 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,k as PROVIDER_ROLE_MAP,s as PROVIDER_SUMMARY,o as ROLE_ASSISTANT,r as ROLE_SYSTEM,i 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,eE as TOOL_LOADING_LABELS,el as findProvider,ei as getCompressionEmergencyThreshold,eM as getModelsGroupedByProvider,eL as getProvidersFromModels,eP as hasMultipleModelsPerProvider,eN as isEntitled,E as isHardCategory,eg as isModelAllowedForPlan,eS as isRealProvider,eu as isReasoningModel,eI as stripAutoWrapper,n as ActionColor};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@versini/sassysaint-common",
|
|
3
|
-
"version": "4.54.
|
|
3
|
+
"version": "4.54.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Arno Versini",
|
|
6
6
|
"publishConfig": {
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"test:watch": "vitest",
|
|
33
33
|
"watch": "npm-run-all dev"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "13407acb1455804651f2d486fba775705063f569"
|
|
36
36
|
}
|