sliccy 5.88.1 → 5.89.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/node-server/_shared/agent-wire-types.d.ts +19 -0
- package/dist/node-server/_shared/agent-wire-types.d.ts.map +1 -1
- package/dist/ui/assets/account-store-CY3L_cQF.js +44 -0
- package/dist/ui/assets/{account-store-BlsqL92L.js → account-store-DtZuHDmf.js} +1 -1
- package/dist/ui/assets/{adobe-DvE_Np41.js → adobe-BT4LLrpZ.js} +1 -1
- package/dist/ui/assets/adobe-Bc-6NIQr.js +1 -0
- package/dist/ui/assets/{agent-message-to-chat-QyCEPmi8.js → agent-message-to-chat-DH5qVsNo.js} +1 -1
- package/dist/ui/assets/{anthropic-messages-C8dDJE2X.js → anthropic-messages-Cx3KdHDK.js} +3 -3
- package/dist/ui/assets/{apps-DxHghmzu.js → apps-CDgCvWHN.js} +1 -1
- package/dist/ui/assets/{azure-openai-DtZRmgvm.js → azure-openai-BZYBbAzv.js} +1 -1
- package/dist/ui/assets/azure-openai-DXz4hF-c.js +1 -0
- package/dist/ui/assets/azure-openai-responses-D2e4727V.js +1 -0
- package/dist/ui/assets/bedrock-camp-CvcU-31w.js +1 -0
- package/dist/ui/assets/cerebras-CDYxWxu2.js +1 -0
- package/dist/ui/assets/{cerebras-Cx0ZgQXY.js → cerebras-CvIDBeTv.js} +1 -1
- package/dist/ui/assets/compat-BHfpuQ4D.js +1 -0
- package/dist/ui/assets/{connect-surface-BuUZt6Ip.js → connect-surface-Dg0fG3yA.js} +1 -1
- package/dist/ui/assets/context-compaction-DDE4L-Sj.js +58 -0
- package/dist/ui/assets/{cost-command-Cpg2Em0Q.js → cost-command-_BMgmnMI.js} +112 -111
- package/dist/ui/assets/{fs-CM-DwH_K.js → fs-CyLJ0TYi.js} +2 -2
- package/dist/ui/assets/{fs-DM4s8g2H.js → fs-DpuVKRCQ.js} +1 -1
- package/dist/ui/assets/{github-C5Z5e9up.js → github-15WpvjGl.js} +2 -2
- package/dist/ui/assets/{github-DzR_VkIs.js → github-CXAoEzN7.js} +1 -1
- package/dist/ui/assets/{github-copilot-BaIpP1i_.js → github-copilot-Ctq2koX1.js} +1 -1
- package/dist/ui/assets/github-copilot-Wogh9O3b.js +1 -0
- package/dist/ui/assets/google-generative-ai-BPByyH06.js +1 -0
- package/dist/ui/assets/{google-shared-BAKd3aSn.js → google-shared-DLE9jWCI.js} +1 -1
- package/dist/ui/assets/google-vertex-0jNZ5aI-.js +1 -0
- package/dist/ui/assets/{kernel-worker-BMk_Hanj.js → kernel-worker-CnX2JxSd.js} +598 -606
- package/dist/ui/assets/legacy-api-aliases-BLiHiLlu.js +1 -0
- package/dist/ui/assets/{local-llm-CcUDAbfs.js → local-llm-D6vzlH1q.js} +1 -1
- package/dist/ui/assets/{local-llm-CHZRZECl.js → local-llm-DUEO4jme.js} +1 -1
- package/dist/ui/assets/{main-B55fFwqN.js → main-YTQMsdfm.js} +3 -3
- package/dist/ui/assets/{mistral-conversations-CKK59QJS.js → mistral-conversations-BBexKxUC.js} +2 -2
- package/dist/ui/assets/{transform-messages-Bp94o3FD.js → models-CvUrqKSj.js} +1 -1
- package/dist/ui/assets/{mount-BDRtuCmi.js → mount-De_BQGq4.js} +2 -2
- package/dist/ui/assets/{mount-recovery-CnuIZk1w.js → mount-recovery-BZjiBIEQ.js} +1 -1
- package/dist/ui/assets/{mount-DtOQdoh4.js → mount-sGWapNTk.js} +1 -1
- package/dist/ui/assets/{new-session-CQvZiVOM.js → new-session-zluPrFE4.js} +2 -2
- package/dist/ui/assets/{oauth-bootstrap-Fdgu0Hiw.js → oauth-bootstrap-BgFk_VJ2.js} +2 -2
- package/dist/ui/assets/{openai-codex-CMjyOucr.js → openai-codex-C8iCsBD9.js} +1 -1
- package/dist/ui/assets/openai-codex-bEaU3e8X.js +1 -0
- package/dist/ui/assets/openai-codex-responses-CBhbcvRK.js +7 -0
- package/dist/ui/assets/openai-completions-CBeXb_ux.js +5 -0
- package/dist/ui/assets/openai-responses-B5d1rOIe.js +1 -0
- package/dist/ui/assets/{openai-responses-shared-CiIL52L-.js → openai-responses-shared-BU1VYwTh.js} +5 -5
- package/dist/ui/assets/openrouter-BM-UDhNC.js +1 -0
- package/dist/ui/assets/{openrouter-CbDtgu4X.js → openrouter-CF8xV5wq.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-DftLGLI3.js → openrouter-oauth-DjtLJhP8.js} +1 -1
- package/dist/ui/assets/{openrouter-oauth-BjWqlI0U.js → openrouter-oauth-a-7KEbrQ.js} +1 -1
- package/dist/ui/assets/{panel-rpc-handlers-iSOkt6dF.js → panel-rpc-handlers-MyjiRPfQ.js} +2 -2
- package/dist/ui/assets/{provider-B3ZNG-_w.js → provider-7LNCXB6L.js} +1 -1
- package/dist/ui/assets/{provider-HkcRYne7.js → provider-BH5wrYZm.js} +2 -2
- package/dist/ui/assets/{provider-settings-CvwIKkCB.js → provider-settings-DAQd7M-Z.js} +1 -1
- package/dist/ui/assets/{provider-settings-BAN99Ypu.js → provider-settings-D_k-XVth.js} +1 -1
- package/dist/ui/assets/provider-store-access-B-KfYV1X.js +1 -0
- package/dist/ui/assets/{provider-store-access-oGt3OTM2.js → provider-store-access-BIYwZNH0.js} +2 -2
- package/dist/ui/assets/{providers-DPnl8m-y.js → providers-DMaEp7Pj.js} +2 -2
- package/dist/ui/assets/{providers-Dc086P9b.js → providers-K6q9kDLS.js} +1 -1
- package/dist/ui/assets/{quick-llm-C6SOJSFV.js → quick-llm-Dg57FmQe.js} +1 -1
- package/dist/ui/assets/session-freezer-C7XAYYYW.js +23 -0
- package/dist/ui/assets/session-freezer-DbAlvJ0R.js +15 -0
- package/dist/ui/assets/{setup-standalone-prelude-CE6GZtVu.js → setup-standalone-prelude-C6YqJt2r.js} +1 -1
- package/dist/ui/assets/{setup-sudo-ysHAwoyc.js → setup-sudo-0ZNlYZ_b.js} +2 -2
- package/dist/ui/assets/{skills-hx0D6dkN.js → skills-B9c2PjwK.js} +1 -1
- package/dist/ui/assets/{src-DZ2yfAIc.js → src-mCXOSBtK.js} +44 -32
- package/dist/ui/assets/{store-DFZqmFiW.js → store-D0OiI-Xj.js} +1 -1
- package/dist/ui/assets/{sudo-CV6R2L8c.js → sudo-D0UbkO_d.js} +1 -1
- package/dist/ui/assets/{upgrade-detection-TeapWh_c.js → upgrade-detection-DMqexaA6.js} +1 -1
- package/dist/ui/assets/{wc-attach-BtJ9bT2T.js → wc-attach-BJk2fkdb.js} +2 -2
- package/dist/ui/assets/{wc-extension-CNKTM_Bn.js → wc-extension-BwLFa8q2.js} +2 -2
- package/dist/ui/assets/{wc-follower-DMTSyIzt.js → wc-follower-Dh_Vhf9K.js} +3 -3
- package/dist/ui/assets/wc-live-D2GKoip3.js +8 -0
- package/dist/ui/assets/{wc-nav-L-P0Pfmy.js → wc-nav-sQfzGmHv.js} +2 -2
- package/dist/ui/assets/{wc-onboarding-tdnkgUYr.js → wc-onboarding-BOSexBA4.js} +2 -2
- package/dist/ui/assets/{wc-placeholder-bh5_VDmb.js → wc-placeholder-BvaYuwiv.js} +2 -2
- package/dist/ui/assets/{wc-settings-CY-rYR1g.js → wc-settings-ZEBxc5EW.js} +2 -2
- package/dist/ui/assets/{wc-shell-BRZwJw30.js → wc-shell-D3tTSQTN.js} +3 -3
- package/dist/ui/assets/{wc-sprinkles-Bmwh47f2.js → wc-sprinkles-4EUT4NHo.js} +2 -2
- package/dist/ui/assets/{wc-tray-C_6fkC1s.js → wc-tray-DvhYzmJ9.js} +2 -2
- package/dist/ui/assets/{xai-grok-CmLmxZBM.js → xai-grok-BwI31S4-.js} +1 -1
- package/dist/ui/assets/xai-grok-CpSEkomD.js +1 -0
- package/dist/ui/index.html +6 -6
- package/dist/ui/packages/webapp/index.html +6 -6
- package/package.json +1 -1
- package/dist/ui/assets/account-store-CRV3xUQu.js +0 -101
- package/dist/ui/assets/adobe-CxrAt4oY.js +0 -1
- package/dist/ui/assets/azure-openai-DJayxp7Q.js +0 -1
- package/dist/ui/assets/azure-openai-responses-CzG7X9qb.js +0 -1
- package/dist/ui/assets/bedrock-camp-DS0ilb3O.js +0 -1
- package/dist/ui/assets/cerebras-CFn0w69c.js +0 -1
- package/dist/ui/assets/github-copilot-BVHb90c_.js +0 -1
- package/dist/ui/assets/google-generative-ai-DzD1vsXe.js +0 -1
- package/dist/ui/assets/google-vertex-oQOD3HKr.js +0 -1
- package/dist/ui/assets/legacy-api-aliases-YuuBU-he.js +0 -1
- package/dist/ui/assets/openai-codex-CZ_pyyXO.js +0 -1
- package/dist/ui/assets/openai-codex-responses-DU5CHdDQ.js +0 -7
- package/dist/ui/assets/openai-completions-DhKgaAgM.js +0 -5
- package/dist/ui/assets/openai-responses-C4_jiYtu.js +0 -1
- package/dist/ui/assets/openrouter-DtTAJoAB.js +0 -1
- package/dist/ui/assets/provider-store-access-C7h1-PtH.js +0 -1
- package/dist/ui/assets/session-freezer-sIuZduHO.js +0 -21
- package/dist/ui/assets/wc-live-DfdMxJgj.js +0 -8
- package/dist/ui/assets/xai-grok-BEgyT7QW.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{C as e,P as t,d as n,f as r}from"./account-store-
|
|
1
|
+
import{C as e,P as t,d as n,f as r}from"./account-store-DtZuHDmf.js";import{n as i}from"./provider-settings-D_k-XVth.js";var a=`slicc_cloud_model_catalog`,o=`adobe`;function s(t){if(t===o)return!1;let n=e(t);return!(n.hidden||n.onOAuthLoginIntercepted)}function c(){try{let e=r().map(e=>({providerId:e.providerId,providerName:e.providerName,models:e.models.map(e=>({id:e.id,name:e.name}))}));localStorage.setItem(a,JSON.stringify(e))}catch{}}async function l(r){for(;r.firstChild;)r.removeChild(r.firstChild);r.className=`connect-surface`;let a=document.createElement(`h1`);a.className=`connect-surface__title`,a.textContent=`Connect providers`,r.appendChild(a);let l=document.createElement(`p`);l.className=`connect-surface__desc`,l.textContent=`Log in or add API keys for the providers your cone should use, then click Done to return to the dashboard.`,r.appendChild(l);let u=document.createElement(`div`);u.className=`connect-surface__accounts`,r.appendChild(u);function d(){for(;u.firstChild;)u.removeChild(u.firstChild);let r=n().filter(e=>e.providerId!==o);if(r.length===0){let e=document.createElement(`div`);e.className=`connect-surface__empty`,e.textContent=`No providers connected yet.`,u.appendChild(e)}else{let n=document.createElement(`div`);n.className=`connect-surface__accounts-list`;for(let i of r){let r=e(i.providerId),a=document.createElement(`div`);a.className=`connect-surface__account-row`;let o=document.createElement(`div`);o.className=`connect-surface__account-info`;let s=document.createElement(`div`);s.className=`connect-surface__account-name`,s.textContent=r.name,o.appendChild(s);let l=document.createElement(`div`);l.className=`connect-surface__account-detail`,i.userName?l.textContent=i.userName:i.accessToken?l.textContent=`Logged in`:l.textContent=i.apiKey?`API key set`:`No credentials`,o.appendChild(l),a.appendChild(o);let u=document.createElement(`button`);u.className=`connect-surface__remove-btn`,u.textContent=`Remove`,u.onclick=async()=>{await t(i.providerId),c(),d()},a.appendChild(u),n.appendChild(a)}u.appendChild(n)}let a=document.createElement(`button`);a.className=`connect-surface__add-btn`,a.textContent=r.length===0?`Add provider`:`Manage providers`,a.onclick=async()=>{await i({startInAddAccount:!0,providerFilter:s})&&(c(),d())},u.appendChild(a)}d(),c();let f=document.createElement(`div`);f.className=`connect-surface__footer`;let p=document.createElement(`button`);if(p.className=`connect-surface__done-btn`,p.textContent=`Done — return to dashboard`,p.onclick=()=>{c(),window.close()},f.appendChild(p),r.appendChild(f),!document.getElementById(`connect-surface-style`)){let e=document.createElement(`style`);e.id=`connect-surface-style`,e.textContent=`
|
|
2
2
|
.connect-surface {
|
|
3
3
|
padding: 2rem;
|
|
4
4
|
max-width: 560px;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import{t as e}from"./logger-LESFN7Hj.js";import{t}from"./compat-BHfpuQ4D.js";const n={enabled:!0,reserveTokens:16384,keepRecentTokens:2e4};function r(e,t,n){return n.enabled?e>t-n.reserveTokens:!1}function i(e){if(typeof e==`string`)return e.length;let t=0;for(let n of e)n.type===`text`&&n.text?t+=n.text.length:n.type===`image`&&(t+=4800);return t}function a(e){let t=0;switch(e.role){case`user`:return t=i(e.content),Math.ceil(t/4);case`assistant`:{let n=e;for(let e of n.content)e.type===`text`?t+=e.text.length:e.type===`thinking`?t+=e.thinking.length:e.type===`toolCall`&&(t+=e.name.length+JSON.stringify(e.arguments).length);return Math.ceil(t/4)}case`custom`:case`toolResult`:return t=i(e.content),Math.ceil(t/4);case`bashExecution`:return t=e.command.length+e.output.length,Math.ceil(t/4);case`branchSummary`:case`compactionSummary`:return t=e.summary.length,Math.ceil(t/4)}return 0}const o=e(`context-compaction`);function s(e,t){return e.role===t}function c(e){let t=0;for(;t<e.length&&s(e[t],`toolResult`);){let n=e[t];o.warn(`Dropping orphaned toolResult (no preceding assistant message)`,{toolCallId:n.toolCallId}),t++}return t>0?e.slice(t):e}function l(e){let t=[];for(let n of e){let e=n;switch(e.role){case`user`:t.push(`<user>\n${u(e.content)}\n</user>`);break;case`assistant`:t.push(`<assistant>\n${u(e.content)}\n</assistant>`);break;case`toolResult`:{let n=e.toolName??`tool`;t.push(`<tool-result name="${n}">\n${u(e.content)}\n</tool-result>`);break}case`bashExecution`:t.push(`<bash>\n$ ${e.command??``}\n${e.output??``}\n</bash>`);break;case`branchSummary`:case`compactionSummary`:t.push(`<prior-summary>\n${e.summary??``}\n</prior-summary>`);break;default:t.push(`<${e.role}>\n${u(e.content)}\n</${e.role}>`)}}return t.join(`
|
|
2
|
+
|
|
3
|
+
`)}function u(e){if(typeof e==`string`)return e;if(!Array.isArray(e))return``;let t=[];for(let n of e){let e=n;e.type===`text`&&e.text?t.push(e.text):e.type===`thinking`&&e.thinking?t.push(`[thinking] ${e.thinking}`):e.type===`toolCall`?t.push(`[tool-call ${e.name??`?`}] ${JSON.stringify(e.arguments??{})}`):e.type===`image`&&t.push(`[image]`)}return t.join(`
|
|
4
|
+
`)}function d(e){return`You are a context compaction assistant. You are shown the prefix of a conversation between a user and an AI coding assistant, and asked to produce either a structured summary, durable memory bullets, or a short title — depending on the user's instruction.
|
|
5
|
+
|
|
6
|
+
Do NOT continue the conversation. Do NOT answer questions inside the conversation. Output ONLY what the user asks for in the format specified.
|
|
7
|
+
|
|
8
|
+
<conversation>
|
|
9
|
+
${e}
|
|
10
|
+
</conversation>`}async function f(e,n,r,i,a,o,s){let c=await t(e,{systemPrompt:r,messages:[{role:`user`,content:[{type:`text`,text:i}],timestamp:Date.now()}]},{maxTokens:a,apiKey:n,headers:o,signal:s});if(c.stopReason===`error`)throw Error(`Compaction call failed: ${c.errorMessage||`Unknown error`}`);return c.content.filter(e=>e.type===`text`).map(e=>e.text).join(`
|
|
11
|
+
`).trim()}function p(e){if(typeof e==`string`)return e.length;if(!Array.isArray(e))return 0;let t=0;for(let n of e){let e=n;if(e.type===`text`&&e.text)t+=e.text.length;else if(e.type===`thinking`&&e.thinking)t+=e.thinking.length;else if(e.type===`toolCall`&&e.arguments!==void 0)try{t+=JSON.stringify(e.arguments).length}catch{}else e.type===`image`&&e.source?.data&&(t+=e.source.data.length)}return t}function m(e,t){let n=Math.max(1,Math.round(e/1024));return`[${t===`assistant`?`Assistant message elided`:`Tool result elided`}: ${n} KB, exceeds half the context window. Re-run with smaller arguments — e.g. open --view --size low.]`}function h(e,t,n){let r=(t-n)/2,i=0,o=0;return{messages:e.map(e=>{if(a(e)<=r)return e;let t=e.role;if(t!==`toolResult`&&t!==`assistant`)return e;let n=e,s=p(n.content);if(t===`toolResult`)return i++,o+=s,{...e,content:[{type:`text`,text:m(s,`toolResult`)}]};let c=(Array.isArray(n.content)?n.content:[]).filter(e=>e.type===`toolCall`);if(c.length===0)return e;let l=c.map(e=>{let t=0;if(e.arguments!==void 0)try{t=JSON.stringify(e.arguments).length}catch{}return{type:e.type,id:e.id,name:e.name,arguments:{elided:!0,originalBytes:t}}});return i++,o+=s,{...e,content:[{type:`text`,text:m(s,`assistant`)},...l]}}),elidedCount:i,elidedBytes:o}}function g(e){let t=0;for(let n of e)t+=a(n);return t}function _(e,t){try{e.onCompactionStateChange?.(t)}catch(e){o.warn(`onCompactionStateChange listener threw`,{error:e instanceof Error?e.message:String(e)})}}function v(e,t,n,i,a,s){if(t<=n*a)return{messages:e,isHopeless:!1,earlyReturn:null};let c=h(e,n,i),l=c.messages;return o.warn(`Compaction hopeless branch`,{totalTokens:t,contextWindow:n,multiplier:a,elidedCount:c.elidedCount,elidedBytes:c.elidedBytes}),{messages:l,isHopeless:!0,earlyReturn:r(g(l),n,s)?null:l}}function y(e,t){let n=0,r=e.length;for(let i=e.length-1;i>=0;i--){let o=a(e[i]);if(n+o>t&&r<e.length)break;n+=o,r=i}for(;r>0&&s(e[r],`toolResult`);)r--;return r<=0||r>=e.length?(o.warn(`Cannot find valid cut point for compaction`),null):{messagesToSummarize:e.slice(0,r),messagesToKeep:c(e.slice(r))}}async function b(e,t,n,r){if(e.onMemoryUpdates)try{_(e,`extracting-memory`);let i=await f(e.model,t,n,`From the conversation above, extract durable memories worth persisting to a global memory file shared across future sessions.
|
|
12
|
+
|
|
13
|
+
Focus on:
|
|
14
|
+
- User preferences, working style, opinions stated explicitly.
|
|
15
|
+
- Stable project facts (architecture decisions, conventions, constraints).
|
|
16
|
+
- Validated approaches the user accepted ("yes, exactly", "perfect"), not just corrections.
|
|
17
|
+
- External resources/links the user named.
|
|
18
|
+
|
|
19
|
+
DO NOT include:
|
|
20
|
+
- Ephemeral state (current task, in-progress work).
|
|
21
|
+
- Information already obvious from the codebase (file paths, function names, framework conventions).
|
|
22
|
+
- Generic restatements of what the conversation was about.
|
|
23
|
+
|
|
24
|
+
If nothing in the conversation is worth persisting, return exactly the single line:
|
|
25
|
+
NONE
|
|
26
|
+
|
|
27
|
+
Otherwise, output ONLY a markdown bullet list (one bullet per memory), no headers, no preamble, no follow-up. Each bullet is one line. Be specific. Prefer one fact per bullet over multi-clause sentences.`,2048,e.headers,r);if(i?.trim()&&i.trim()!==`NONE`)try{await e.onMemoryUpdates(i.trim()),o.info(`Memory extraction applied`,{bulletsLength:i.length})}catch(e){o.warn(`onMemoryUpdates callback threw`,{error:e instanceof Error?e.message:String(e)})}else o.info(`Memory extraction returned no durable memories`)}catch(e){o.warn(`Memory extraction call failed (compaction still applied)`,{error:e instanceof Error?e.message:String(e)})}}async function x(e,t,n,r,i,a,s){try{let c=d(l(n)),u=Math.floor(.8*i);_(e,`summarizing`);let p=await f(e.model,t,c,`Produce a structured context checkpoint summary of the conversation above that another LLM can use to continue the work.
|
|
28
|
+
|
|
29
|
+
Use this EXACT format:
|
|
30
|
+
|
|
31
|
+
## Goal
|
|
32
|
+
[What is the user trying to accomplish? Can be multiple items if the session covers different tasks.]
|
|
33
|
+
|
|
34
|
+
## Constraints & Preferences
|
|
35
|
+
- [Any constraints, preferences, or requirements mentioned by user]
|
|
36
|
+
- [Or "(none)" if none were mentioned]
|
|
37
|
+
|
|
38
|
+
## Progress
|
|
39
|
+
### Done
|
|
40
|
+
- [x] [Completed tasks/changes]
|
|
41
|
+
|
|
42
|
+
### In Progress
|
|
43
|
+
- [ ] [Current work]
|
|
44
|
+
|
|
45
|
+
### Blocked
|
|
46
|
+
- [Issues preventing progress, if any]
|
|
47
|
+
|
|
48
|
+
## Key Decisions
|
|
49
|
+
- **[Decision]**: [Brief rationale]
|
|
50
|
+
|
|
51
|
+
## Next Steps
|
|
52
|
+
1. [Ordered list of what should happen next]
|
|
53
|
+
|
|
54
|
+
## Critical Context
|
|
55
|
+
- [Any data, examples, or references needed to continue]
|
|
56
|
+
- [Or "(none)" if not applicable]
|
|
57
|
+
|
|
58
|
+
Keep each section concise. Preserve exact file paths, function names, and error messages. Output ONLY the summary, with no preamble or follow-up.`,u,e.headers,s),m={role:`user`,content:[{type:`text`,text:`<context-summary>\n${p}\n</context-summary>`}],timestamp:Date.now()};return o.info(`LLM summarization successful`,{originalMessages:a,compactedMessages:1+r.length,summaryLength:p.length}),await b(e,t,c,s),_(e,`idle`),[m,...r]}catch(e){return o.warn(`LLM summarization failed, falling back to naive drop`,{error:e instanceof Error?e.message:String(e)}),null}}function S(e){let t=e.contextWindow??2e5,i=e.reserveTokens??n.reserveTokens,a=e.keepRecentTokens??n.keepRecentTokens,s=e.hopelessMultiplier??4,c={enabled:!0,reserveTokens:i,keepRecentTokens:a};return async(n,l)=>{if(n.length===0)return n;let u=g(n);if(!r(u,t,c))return n;let d=v(n,u,t,i,s,c);if(d.earlyReturn)return d.earlyReturn;let f=d.messages,p=d.isHopeless;o.info(`Context compaction triggered`,{totalTokens:u,contextWindow:t,threshold:t-i,messageCount:f.length});let m=y(f,a);if(!m)return f;let{messagesToSummarize:h,messagesToKeep:b}=m;o.info(`Compaction cut point`,{summarizing:h.length,keeping:b.length});let S=p?void 0:e.getApiKey();if(S){let t=await x(e,S,h,b,i,n.length,l);if(t)return t}else p||o.warn(`No API key available for LLM summarization, falling back to naive drop`);_(e,`idle`);let C={role:`user`,content:[{type:`text`,text:`[Earlier conversation messages were compacted to save context space]`}],timestamp:Date.now()};return o.info(`Naive compaction applied`,{originalMessages:n.length,compactedMessages:1+b.length}),[C,...b]}}export{c as n,S as t};
|