context-mode 0.9.18 → 0.9.19
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/.claude-plugin/plugin.json +1 -1
- package/build/server.js +1 -1
- package/hooks/pretooluse.mjs +13 -2
- package/package.json +1 -1
- package/server.bundle.mjs +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-mode",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.19",
|
|
4
4
|
"description": "Claude Code MCP plugin that saves 98% of your context window. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and intent-driven search.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Mert Koseoğlu",
|
package/build/server.js
CHANGED
|
@@ -7,7 +7,7 @@ import { PolyglotExecutor } from "./executor.js";
|
|
|
7
7
|
import { ContentStore, cleanupStaleDBs } from "./store.js";
|
|
8
8
|
import { readBashPolicies, evaluateCommandDenyOnly, extractShellCommands, readToolDenyPatterns, evaluateFilePath, } from "./security.js";
|
|
9
9
|
import { detectRuntimes, getRuntimeSummary, getAvailableLanguages, hasBunRuntime, } from "./runtime.js";
|
|
10
|
-
const VERSION = "0.9.
|
|
10
|
+
const VERSION = "0.9.19";
|
|
11
11
|
const runtimes = detectRuntimes();
|
|
12
12
|
const available = getAvailableLanguages(runtimes);
|
|
13
13
|
const server = new McpServer({
|
package/hooks/pretooluse.mjs
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* stdout on Windows before the buffer is flushed.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { readFileSync, writeFileSync, existsSync, rmSync,
|
|
13
|
+
import { readFileSync, writeFileSync, existsSync, rmSync, mkdirSync, copyFileSync, readdirSync, statSync } from "node:fs";
|
|
14
14
|
import { resolve, dirname, basename } from "node:path";
|
|
15
15
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
16
16
|
import { homedir, tmpdir } from "node:os";
|
|
@@ -26,6 +26,17 @@ try {
|
|
|
26
26
|
// Build not available — skip security checks, rely on existing routing
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
// ─── Manual recursive copy (avoids cpSync libuv crash on non-ASCII paths, Windows + Node 24) ───
|
|
30
|
+
function copyDirSync(src, dest) {
|
|
31
|
+
mkdirSync(dest, { recursive: true });
|
|
32
|
+
for (const entry of readdirSync(src, { withFileTypes: true })) {
|
|
33
|
+
const srcPath = resolve(src, entry.name);
|
|
34
|
+
const destPath = resolve(dest, entry.name);
|
|
35
|
+
if (entry.isDirectory()) copyDirSync(srcPath, destPath);
|
|
36
|
+
else copyFileSync(srcPath, destPath);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
29
40
|
// ─── Self-heal: rename dir to correct version, fix registry + hooks ───
|
|
30
41
|
try {
|
|
31
42
|
const hookDir = dirname(fileURLToPath(import.meta.url));
|
|
@@ -41,7 +52,7 @@ try {
|
|
|
41
52
|
// create correct dir, copy files, update registry + hooks
|
|
42
53
|
const correctDir = resolve(cacheParent, myVersion);
|
|
43
54
|
if (myDirName !== myVersion && !existsSync(correctDir)) {
|
|
44
|
-
|
|
55
|
+
copyDirSync(myRoot, correctDir);
|
|
45
56
|
|
|
46
57
|
// Create start.mjs in new dir if missing
|
|
47
58
|
const startMjs = resolve(correctDir, "start.mjs");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-mode",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Claude Code MCP plugin that saves 98% of your context window. Sandboxed code execution, FTS5 knowledge base, and intent-driven search.",
|
|
6
6
|
"author": "Mert Koseoğlu",
|
package/server.bundle.mjs
CHANGED
|
@@ -203,7 +203,7 @@ ${n}`}}};import{createRequire as Uz}from"node:module";import{readFileSync as Vz,
|
|
|
203
203
|
`);Buffer.byteLength(b)>r&&p.length>1&&(p.pop(),g(),p=[v])}g(),i=[]},u=0;for(;u<o.length;){let l=o[u];if(/^[-_*]{3,}\s*$/.test(l)){c(),u++;continue}let d=l.match(/^(#{1,4})\s+(.+)$/);if(d){c();let f=d[1].length,p=d[2].trim();for(;s.length>0&&s[s.length-1].level>=f;)s.pop();s.push({level:f,text:p}),a=p,i.push(l),u++;continue}let m=l.match(/^(`{3,})(.*)?$/);if(m){let f=m[1],p=[l];for(u++;u<o.length;){if(p.push(o[u]),o[u].startsWith(f)&&o[u].trim()===f){u++;break}u++}i.push(...p);continue}i.push(l),u++}return c(),n}#w(e,r){let n=e.split(/\n\s*\n/);if(n.length>=3&&n.length<=200&&n.every(c=>Buffer.byteLength(c)<5e3))return n.map((c,u)=>{let l=c.trim();return{title:l.split(`
|
|
204
204
|
`)[0].slice(0,80)||`Section ${u+1}`,content:l}}).filter(c=>c.content.length>0);let o=e.split(`
|
|
205
205
|
`);if(o.length<=r)return[{title:"Output",content:e}];let s=[],a=Math.max(r-2,1);for(let c=0;c<o.length;c+=a){let u=o.slice(c,c+r);if(u.length===0)break;let l=c+1,d=Math.min(c+u.length,o.length),m=u[0]?.trim().slice(0,80);s.push({title:m||`Lines ${l}-${d}`,content:u.join(`
|
|
206
|
-
`)})}return s}#_(e,r,n,o){let s=r.length>0?r.join(" > "):"(root)",i=JSON.stringify(e,null,2);if(Buffer.byteLength(i)<=o&&!(typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.values(e).some(c=>typeof c=="object"&&c!==null))){n.push({title:s,content:i,hasCode:!0});return}if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let a=Object.entries(e);if(a.length>0){for(let[c,u]of a)this.#_(u,[...r,c],n,o);return}n.push({title:s,content:i,hasCode:!0});return}if(Array.isArray(e)){this.#T(e,r,n,o);return}n.push({title:s,content:i,hasCode:!1})}#k(e){if(e.length===0)return null;let r=e[0];if(typeof r!="object"||r===null||Array.isArray(r))return null;let n=["id","name","title","path","slug","key","label"],o=r;for(let s of n)if(s in o&&(typeof o[s]=="string"||typeof o[s]=="number"))return s;return null}#S(e,r,n,o,s){let i=e?`${e} > `:"";if(!s)return r===n?`${i}[${r}]`:`${i}[${r}-${n}]`;let a=c=>String(c[s]);return o.length===1?`${i}${a(o[0])}`:o.length<=3?i+o.map(a).join(", "):`${i}${a(o[0])}\u2026${a(o[o.length-1])}`}#T(e,r,n,o){let s=r.length>0?r.join(" > "):"(root)",i=this.#k(e),a=[],c=0,u=l=>{if(a.length===0)return;let d=this.#S(s,c,l,a,i);n.push({title:d,content:JSON.stringify(a,null,2),hasCode:!0})};for(let l=0;l<e.length;l++){a.push(e[l]);let d=JSON.stringify(a,null,2);Buffer.byteLength(d)>o&&a.length>1&&(a.pop(),u(l-1),a=[e[l]],c=l)}u(c+a.length-1)}#z(e,r){return e.length===0?r||"Untitled":e.map(n=>n.text).join(" > ")}};import{readFileSync as $y}from"node:fs";import{resolve as yn}from"node:path";import{homedir as wy}from"node:os";function ky(t){let e=t.match(/^Bash\((.+)\)$/);return e?e[1]:null}function Xz(t){let e=t.match(/^(\w+)\((.+)\)$/);return e?{tool:e[1],glob:e[2]}:null}function Yz(t){return t.replace(/[.*+?^${}()|[\]\\\/\-]/g,"\\$&")}function by(t){return t.replace(/[.+?^${}()|[\]\\\/\-]/g,"\\$&").replace(/\*/g,".*")}function Qz(t,e=!1){let r,n=t.indexOf(":");if(n!==-1){let o=t.slice(0,n),s=t.slice(n+1),i=Yz(o),a=by(s);r=`^${i}(\\s${a})?$`}else r=`^${by(t)}$`;return new RegExp(r,e?"i":"")}function eE(t,e=!1){let r="",n=0;for(;n<t.length;)t[n]==="*"&&t[n+1]==="*"?n+2<t.length&&t[n+2]==="/"?(r+="(.*/)?",n+=3):(r+=".*",n+=2):t[n]==="*"?(r+="[^/]*",n++):t[n]==="?"?(r+="[^/]",n++):(r+=t[n].replace(/[.+^${}()|[\]\\\/\-]/g,"\\$&"),n++);return new RegExp(`^${r}$`,e?"i":"")}function tE(t,e,r=!1){for(let n of e){let o=ky(n);if(o&&Qz(o,r).test(t))return n}return null}function rE(t){let e=[],r="",n=!1,o=!1,s=!1;for(let i=0;i<t.length;i++){let a=t[i],c=i>0?t[i-1]:"";a==="'"&&!o&&!s&&c!=="\\"?(n=!n,r+=a):a==='"'&&!n&&!s&&c!=="\\"?(o=!o,r+=a):a==="`"&&!n&&!o&&c!=="\\"?(s=!s,r+=a):!n&&!o&&!s?a===";"?(e.push(r.trim()),r=""):a==="|"&&t[i+1]==="|"||a==="&"&&t[i+1]==="&"?(e.push(r.trim()),r="",i++):a==="|"?(e.push(r.trim()),r=""):r+=a:r+=a}return r.trim()&&e.push(r.trim()),e.filter(i=>i.length>0)}function id(t){let e;try{e=$y(t,"utf-8")}catch{return null}let r;try{r=JSON.parse(e)}catch{return null}let n=r?.permissions;if(!n||typeof n!="object")return null;let o=s=>Array.isArray(s)?s.filter(i=>typeof i=="string"&&ky(i)!==null):[];return{allow:o(n.allow),deny:o(n.deny),ask:o(n.ask)}}function ad(t,e){let r=[];if(t){let s=yn(t,".claude","settings.local.json"),i=id(s);i&&r.push(i);let a=yn(t,".claude","settings.json"),c=id(a);c&&r.push(c)}let n=e??yn(wy(),".claude","settings.json"),o=id(n);return o&&r.push(o),r}function Sy(t,e,r){let n=[],o=a=>{let c;try{c=$y(a,"utf-8")}catch{return null}let u;try{u=JSON.parse(c)}catch{return null}let l=u?.permissions?.deny;if(!Array.isArray(l))return[];let d=[];for(let m of l){if(typeof m!="string")continue;let f=Xz(m);f&&f.tool===t&&d.push(f.glob)}return d};if(e){let a=o(yn(e,".claude","settings.local.json"));a!==null&&n.push(a);let c=o(yn(e,".claude","settings.json"));c!==null&&n.push(c)}let s=r??yn(wy(),".claude","settings.json"),i=o(s);return i!==null&&n.push(i),n}function cd(t,e,r=process.platform==="win32"){let n=rE(t);for(let o of n)for(let s of e){let i=tE(o,s.deny,r);if(i)return{decision:"deny",matchedPattern:i}}return{decision:"allow"}}function Ty(t,e,r=process.platform==="win32"){let n=t.replace(/\\/g,"/");for(let o of e)for(let s of o)if(eE(s,r).test(n))return{denied:!0,matchedPattern:s};return{denied:!1}}var nE={python:[/os\.system\(\s*(['"])(.*?)\1\s*\)/g,/subprocess\.(?:run|call|Popen|check_output|check_call)\(\s*(['"])(.*?)\1/g],javascript:[/exec(?:Sync|File|FileSync)?\(\s*(['"`])(.*?)\1/g,/spawn(?:Sync)?\(\s*(['"`])(.*?)\1/g],typescript:[/exec(?:Sync|File|FileSync)?\(\s*(['"`])(.*?)\1/g,/spawn(?:Sync)?\(\s*(['"`])(.*?)\1/g],ruby:[/system\(\s*(['"])(.*?)\1/g,/`(.*?)`/g],go:[/exec\.Command\(\s*(['"`])(.*?)\1/g],php:[/shell_exec\(\s*(['"`])(.*?)\1/g,/(?:^|[^.])exec\(\s*(['"`])(.*?)\1/g,/(?:^|[^.])system\(\s*(['"`])(.*?)\1/g,/passthru\(\s*(['"`])(.*?)\1/g,/proc_open\(\s*(['"`])(.*?)\1/g],rust:[/Command::new\(\s*(['"`])(.*?)\1/g]};function oE(t){let e=[],r=/subprocess\.(?:run|call|Popen|check_output|check_call)\(\s*\[([^\]]+)\]/g,n;for(;(n=r.exec(t))!==null;){let s=[...n[1].matchAll(/(['"])(.*?)\1/g)].map(i=>i[2]);s.length>0&&e.push(s.join(" "))}return e}function zy(t,e){let r=nE[e];if(!r&&e!=="python")return[];let n=[];if(r)for(let o of r){o.lastIndex=0;let s;for(;(s=o.exec(t))!==null;){let i=s[s.length-1];i&&n.push(i)}}return e==="python"&&n.push(...oE(t)),n}var Iy="0.9.
|
|
206
|
+
`)})}return s}#_(e,r,n,o){let s=r.length>0?r.join(" > "):"(root)",i=JSON.stringify(e,null,2);if(Buffer.byteLength(i)<=o&&!(typeof e=="object"&&e!==null&&!Array.isArray(e)&&Object.values(e).some(c=>typeof c=="object"&&c!==null))){n.push({title:s,content:i,hasCode:!0});return}if(typeof e=="object"&&e!==null&&!Array.isArray(e)){let a=Object.entries(e);if(a.length>0){for(let[c,u]of a)this.#_(u,[...r,c],n,o);return}n.push({title:s,content:i,hasCode:!0});return}if(Array.isArray(e)){this.#T(e,r,n,o);return}n.push({title:s,content:i,hasCode:!1})}#k(e){if(e.length===0)return null;let r=e[0];if(typeof r!="object"||r===null||Array.isArray(r))return null;let n=["id","name","title","path","slug","key","label"],o=r;for(let s of n)if(s in o&&(typeof o[s]=="string"||typeof o[s]=="number"))return s;return null}#S(e,r,n,o,s){let i=e?`${e} > `:"";if(!s)return r===n?`${i}[${r}]`:`${i}[${r}-${n}]`;let a=c=>String(c[s]);return o.length===1?`${i}${a(o[0])}`:o.length<=3?i+o.map(a).join(", "):`${i}${a(o[0])}\u2026${a(o[o.length-1])}`}#T(e,r,n,o){let s=r.length>0?r.join(" > "):"(root)",i=this.#k(e),a=[],c=0,u=l=>{if(a.length===0)return;let d=this.#S(s,c,l,a,i);n.push({title:d,content:JSON.stringify(a,null,2),hasCode:!0})};for(let l=0;l<e.length;l++){a.push(e[l]);let d=JSON.stringify(a,null,2);Buffer.byteLength(d)>o&&a.length>1&&(a.pop(),u(l-1),a=[e[l]],c=l)}u(c+a.length-1)}#z(e,r){return e.length===0?r||"Untitled":e.map(n=>n.text).join(" > ")}};import{readFileSync as $y}from"node:fs";import{resolve as yn}from"node:path";import{homedir as wy}from"node:os";function ky(t){let e=t.match(/^Bash\((.+)\)$/);return e?e[1]:null}function Xz(t){let e=t.match(/^(\w+)\((.+)\)$/);return e?{tool:e[1],glob:e[2]}:null}function Yz(t){return t.replace(/[.*+?^${}()|[\]\\\/\-]/g,"\\$&")}function by(t){return t.replace(/[.+?^${}()|[\]\\\/\-]/g,"\\$&").replace(/\*/g,".*")}function Qz(t,e=!1){let r,n=t.indexOf(":");if(n!==-1){let o=t.slice(0,n),s=t.slice(n+1),i=Yz(o),a=by(s);r=`^${i}(\\s${a})?$`}else r=`^${by(t)}$`;return new RegExp(r,e?"i":"")}function eE(t,e=!1){let r="",n=0;for(;n<t.length;)t[n]==="*"&&t[n+1]==="*"?n+2<t.length&&t[n+2]==="/"?(r+="(.*/)?",n+=3):(r+=".*",n+=2):t[n]==="*"?(r+="[^/]*",n++):t[n]==="?"?(r+="[^/]",n++):(r+=t[n].replace(/[.+^${}()|[\]\\\/\-]/g,"\\$&"),n++);return new RegExp(`^${r}$`,e?"i":"")}function tE(t,e,r=!1){for(let n of e){let o=ky(n);if(o&&Qz(o,r).test(t))return n}return null}function rE(t){let e=[],r="",n=!1,o=!1,s=!1;for(let i=0;i<t.length;i++){let a=t[i],c=i>0?t[i-1]:"";a==="'"&&!o&&!s&&c!=="\\"?(n=!n,r+=a):a==='"'&&!n&&!s&&c!=="\\"?(o=!o,r+=a):a==="`"&&!n&&!o&&c!=="\\"?(s=!s,r+=a):!n&&!o&&!s?a===";"?(e.push(r.trim()),r=""):a==="|"&&t[i+1]==="|"||a==="&"&&t[i+1]==="&"?(e.push(r.trim()),r="",i++):a==="|"?(e.push(r.trim()),r=""):r+=a:r+=a}return r.trim()&&e.push(r.trim()),e.filter(i=>i.length>0)}function id(t){let e;try{e=$y(t,"utf-8")}catch{return null}let r;try{r=JSON.parse(e)}catch{return null}let n=r?.permissions;if(!n||typeof n!="object")return null;let o=s=>Array.isArray(s)?s.filter(i=>typeof i=="string"&&ky(i)!==null):[];return{allow:o(n.allow),deny:o(n.deny),ask:o(n.ask)}}function ad(t,e){let r=[];if(t){let s=yn(t,".claude","settings.local.json"),i=id(s);i&&r.push(i);let a=yn(t,".claude","settings.json"),c=id(a);c&&r.push(c)}let n=e??yn(wy(),".claude","settings.json"),o=id(n);return o&&r.push(o),r}function Sy(t,e,r){let n=[],o=a=>{let c;try{c=$y(a,"utf-8")}catch{return null}let u;try{u=JSON.parse(c)}catch{return null}let l=u?.permissions?.deny;if(!Array.isArray(l))return[];let d=[];for(let m of l){if(typeof m!="string")continue;let f=Xz(m);f&&f.tool===t&&d.push(f.glob)}return d};if(e){let a=o(yn(e,".claude","settings.local.json"));a!==null&&n.push(a);let c=o(yn(e,".claude","settings.json"));c!==null&&n.push(c)}let s=r??yn(wy(),".claude","settings.json"),i=o(s);return i!==null&&n.push(i),n}function cd(t,e,r=process.platform==="win32"){let n=rE(t);for(let o of n)for(let s of e){let i=tE(o,s.deny,r);if(i)return{decision:"deny",matchedPattern:i}}return{decision:"allow"}}function Ty(t,e,r=process.platform==="win32"){let n=t.replace(/\\/g,"/");for(let o of e)for(let s of o)if(eE(s,r).test(n))return{denied:!0,matchedPattern:s};return{denied:!1}}var nE={python:[/os\.system\(\s*(['"])(.*?)\1\s*\)/g,/subprocess\.(?:run|call|Popen|check_output|check_call)\(\s*(['"])(.*?)\1/g],javascript:[/exec(?:Sync|File|FileSync)?\(\s*(['"`])(.*?)\1/g,/spawn(?:Sync)?\(\s*(['"`])(.*?)\1/g],typescript:[/exec(?:Sync|File|FileSync)?\(\s*(['"`])(.*?)\1/g,/spawn(?:Sync)?\(\s*(['"`])(.*?)\1/g],ruby:[/system\(\s*(['"])(.*?)\1/g,/`(.*?)`/g],go:[/exec\.Command\(\s*(['"`])(.*?)\1/g],php:[/shell_exec\(\s*(['"`])(.*?)\1/g,/(?:^|[^.])exec\(\s*(['"`])(.*?)\1/g,/(?:^|[^.])system\(\s*(['"`])(.*?)\1/g,/passthru\(\s*(['"`])(.*?)\1/g,/proc_open\(\s*(['"`])(.*?)\1/g],rust:[/Command::new\(\s*(['"`])(.*?)\1/g]};function oE(t){let e=[],r=/subprocess\.(?:run|call|Popen|check_output|check_call)\(\s*\[([^\]]+)\]/g,n;for(;(n=r.exec(t))!==null;){let s=[...n[1].matchAll(/(['"])(.*?)\1/g)].map(i=>i[2]);s.length>0&&e.push(s.join(" "))}return e}function zy(t,e){let r=nE[e];if(!r&&e!=="python")return[];let n=[];if(r)for(let o of r){o.lastIndex=0;let s;for(;(s=o.exec(t))!==null;){let i=s[s.length-1];i&&n.push(i)}}return e==="python"&&n.push(...oE(t)),n}var Iy="0.9.19",pd=mi(),sE=dy(pd),er=new di({name:"context-mode",version:Iy}),xi=new gi({runtimes:pd,projectRoot:process.env.CLAUDE_PROJECT_DIR}),wo=null;function ko(){return wo||(wo=new yi),wo}var Ae={calls:{},bytesReturned:{},bytesIndexed:0,bytesSandboxed:0,sessionStart:Date.now()};function ee(t,e){let r=e.content.reduce((n,o)=>n+Buffer.byteLength(o.text),0);return Ae.calls[t]=(Ae.calls[t]||0)+1,Ae.bytesReturned[t]=(Ae.bytesReturned[t]||0)+r,e}function Qt(t){Ae.bytesIndexed+=t}function fd(t,e){try{let r=ad(process.env.CLAUDE_PROJECT_DIR),n=cd(t,r);if(n.decision==="deny")return ee(e,{content:[{type:"text",text:`Command blocked by security policy: matches deny pattern ${n.matchedPattern}`}],isError:!0})}catch{}return null}function Oy(t,e,r){try{let n=zy(t,e);if(n.length===0)return null;let o=ad(process.env.CLAUDE_PROJECT_DIR);for(let s of n){let i=cd(s,o);if(i.decision==="deny")return ee(r,{content:[{type:"text",text:`Command blocked by security policy: embedded shell command "${s}" matches deny pattern ${i.matchedPattern}`}],isError:!0})}}catch{}return null}function iE(t,e){try{let r=Sy("Read",process.env.CLAUDE_PROJECT_DIR),n=Ty(t,r);if(n.denied)return ee(e,{content:[{type:"text",text:`File access blocked by security policy: path matches Read deny pattern ${n.matchedPattern}`}],isError:!0})}catch{}return null}var aE=sE.join(", "),cE=nd()?" (Bun detected \u2014 JS/TS runs 3-5x faster)":"",uE="",lE="";function dE(t){let e=[],r=0,n=0;for(;n<t.length;)if(t[n]===uE){for(e.push(r),n++;n<t.length&&t[n]!==lE;)r++,n++;n<t.length&&n++}else r++,n++;return e}function Ny(t,e,r=1500,n){if(t.length<=r)return t;let o=[];if(n)for(let u of dE(n))o.push(u);if(o.length===0){let u=e.toLowerCase().split(/\s+/).filter(d=>d.length>2),l=t.toLowerCase();for(let d of u){let m=l.indexOf(d);for(;m!==-1;)o.push(m),m=l.indexOf(d,m+1)}}if(o.length===0)return t.slice(0,r)+`
|
|
207
207
|
\u2026`;o.sort((u,l)=>u-l);let s=300,i=[];for(let u of o){let l=Math.max(0,u-s),d=Math.min(t.length,u+s);i.length>0&&l<=i[i.length-1][1]?i[i.length-1][1]=d:i.push([l,d])}let a=[],c=0;for(let[u,l]of i){if(c>=r)break;let d=t.slice(u,Math.min(l,u+(r-c)));a.push((u>0?"\u2026":"")+d+(l<t.length?"\u2026":"")),c+=d.length}return a.join(`
|
|
208
208
|
|
|
209
209
|
`)}er.registerTool("execute",{title:"Execute Code",description:`MANDATORY: Use for any command where output exceeds 20 lines. Execute code in a sandboxed subprocess. Only stdout enters context \u2014 raw data stays in the subprocess.${cE} Available: ${aE}.
|