context-mode 0.7.2 → 0.7.3
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/build/server.js +1 -1
- package/hooks/pretooluse.sh +15 -0
- package/package.json +1 -1
- package/server.bundle.mjs +1 -1
package/build/server.js
CHANGED
|
@@ -5,7 +5,7 @@ import { z } from "zod";
|
|
|
5
5
|
import { PolyglotExecutor } from "./executor.js";
|
|
6
6
|
import { ContentStore, cleanupStaleDBs } from "./store.js";
|
|
7
7
|
import { detectRuntimes, getRuntimeSummary, getAvailableLanguages, hasBunRuntime, } from "./runtime.js";
|
|
8
|
-
const VERSION = "0.7.
|
|
8
|
+
const VERSION = "0.7.3";
|
|
9
9
|
const runtimes = detectRuntimes();
|
|
10
10
|
const available = getAvailableLanguages(runtimes);
|
|
11
11
|
const server = new McpServer({
|
package/hooks/pretooluse.sh
CHANGED
|
@@ -107,6 +107,21 @@ STEP 2 — FOLLOW-UP: mcp__context-mode__search(queries: ["q1", "q2", "q3", ...]
|
|
|
107
107
|
OTHER: execute(language, code) | execute_file(path, language, code) | fetch_and_index(url) + search
|
|
108
108
|
|
|
109
109
|
FORBIDDEN: Bash for output, Read for files, WebFetch. Bash is ONLY for git/mkdir/rm/mv.
|
|
110
|
+
|
|
111
|
+
OUTPUT FORMAT — KEEP YOUR FINAL RESPONSE UNDER 500 WORDS:
|
|
112
|
+
The parent agent context window is precious. Your full response gets injected into it.
|
|
113
|
+
|
|
114
|
+
1. ARTIFACTS (PRDs, configs, code files) → Write to FILES, never return as inline text.
|
|
115
|
+
Return only: file path + 1-line description.
|
|
116
|
+
2. DETAILED FINDINGS → Index into knowledge base:
|
|
117
|
+
mcp__context-mode__index(content: "...", source: "descriptive-label")
|
|
118
|
+
The parent agent shares the SAME knowledge base and can search() your indexed content.
|
|
119
|
+
3. YOUR RESPONSE must be a concise summary:
|
|
120
|
+
- What you did (2-3 bullets)
|
|
121
|
+
- File paths created/modified (if any)
|
|
122
|
+
- Source labels you indexed (so parent can search)
|
|
123
|
+
- Key findings in bullet points
|
|
124
|
+
Do NOT return raw data, full file contents, or lengthy explanations.
|
|
110
125
|
---'
|
|
111
126
|
|
|
112
127
|
if [ "$SUBAGENT_TYPE" = "Bash" ]; then
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-mode",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
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
|
@@ -160,7 +160,7 @@ ${n}`}}};import{createRequire as bT}from"node:module";import{readFileSync as xT,
|
|
|
160
160
|
`).trim();u.length!==0&&(r.push({title:this.#s(o,i),content:u,hasCode:s.some(l=>/^`{3,}/.test(l))}),s=[])},c=0;for(;c<n.length;){let u=n[c];if(/^[-_*]{3,}\s*$/.test(u)){a(),c++;continue}let l=u.match(/^(#{1,4})\s+(.+)$/);if(l){a();let m=l[1].length,f=l[2].trim();for(;o.length>0&&o[o.length-1].level>=m;)o.pop();o.push({level:m,text:f}),i=f,s.push(u),c++;continue}let d=u.match(/^(`{3,})(.*)?$/);if(d){let m=d[1],f=[u];for(c++;c<n.length;){if(f.push(n[c]),n[c].startsWith(m)&&n[c].trim()===m){c++;break}c++}s.push(...f);continue}s.push(u),c++}return a(),r}#o(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(`
|
|
161
161
|
`)[0].slice(0,80)||`Section ${u+1}`,content:l}}).filter(c=>c.content.length>0);let o=e.split(`
|
|
162
162
|
`);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(`
|
|
163
|
-
`)})}return s}#s(e,r){return e.length===0?r||"Untitled":e.map(n=>n.text).join(" > ")}};var dy="0.7.
|
|
163
|
+
`)})}return s}#s(e,r){return e.length===0?r||"Untitled":e.map(n=>n.text).join(" > ")}};var dy="0.7.3",rd=fi(),ET=ey(rd),er=new li({name:"context-mode",version:dy}),yi=new mi({runtimes:rd}),$o=null;function wo(){return $o||($o=new xo),$o}var Ze={calls:{},bytesReturned:{},bytesIndexed:0,bytesSandboxed:0,sessionStart:Date.now()};function ne(t,e){let r=e.content.reduce((n,o)=>n+Buffer.byteLength(o.text),0);return Ze.calls[t]=(Ze.calls[t]||0)+1,Ze.bytesReturned[t]=(Ze.bytesReturned[t]||0)+r,e}function Qt(t){Ze.bytesIndexed+=t}var PT=ET.join(", "),RT=Ql()?" (Bun detected \u2014 JS/TS runs 3-5x faster)":"";function py(t,e,r=1500){if(t.length<=r)return t;let n=e.toLowerCase().split(/\s+/).filter(l=>l.length>2),o=t.toLowerCase(),s=[];for(let l of n){let d=o.indexOf(l);for(;d!==-1;)s.push(d),d=o.indexOf(l,d+1)}if(s.length===0)return t.slice(0,r)+`
|
|
164
164
|
\u2026`;s.sort((l,d)=>l-d);let i=300,a=[];for(let l of s){let d=Math.max(0,l-i),m=Math.min(t.length,l+i);a.length>0&&d<=a[a.length-1][1]?a[a.length-1][1]=m:a.push([d,m])}let c=[],u=0;for(let[l,d]of a){if(u>=r)break;let m=t.slice(l,Math.min(d,l+(r-u)));c.push((l>0?"\u2026":"")+m+(d<t.length?"\u2026":"")),u+=m.length}return c.join(`
|
|
165
165
|
|
|
166
166
|
`)}er.registerTool("execute",{title:"Execute Code",description:`Execute code in a sandboxed subprocess. Only stdout enters context \u2014 raw data stays in the subprocess. Use instead of bash/cat when output would exceed 20 lines.${RT} Available: ${PT}.
|