context-mode 1.0.5 → 1.0.6
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/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/build/server.js +1 -1
- package/build/session/extract.js +11 -5
- package/build/session/snapshot.d.ts +5 -0
- package/build/session/snapshot.js +28 -2
- package/package.json +1 -1
- package/server.bundle.mjs +0 -389
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
},
|
|
7
7
|
"metadata": {
|
|
8
8
|
"description": "Claude Code plugins by Mert Koseoğlu",
|
|
9
|
-
"version": "1.0.
|
|
9
|
+
"version": "1.0.6"
|
|
10
10
|
},
|
|
11
11
|
"plugins": [
|
|
12
12
|
{
|
|
13
13
|
"name": "context-mode",
|
|
14
14
|
"source": "./",
|
|
15
15
|
"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.",
|
|
16
|
-
"version": "1.0.
|
|
16
|
+
"version": "1.0.6",
|
|
17
17
|
"author": {
|
|
18
18
|
"name": "Mert Koseoğlu"
|
|
19
19
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-mode",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "MCP server that saves 98% of your context window with session continuity. Sandboxed code execution in 11 languages, FTS5 knowledge base with BM25 ranking, and automatic state restore across compactions.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Mert Koseoğlu",
|
package/build/server.js
CHANGED
|
@@ -12,7 +12,7 @@ import { PolyglotExecutor } from "./executor.js";
|
|
|
12
12
|
import { ContentStore, cleanupStaleDBs } from "./store.js";
|
|
13
13
|
import { readBashPolicies, evaluateCommandDenyOnly, extractShellCommands, readToolDenyPatterns, evaluateFilePath, } from "./security.js";
|
|
14
14
|
import { detectRuntimes, getRuntimeSummary, getAvailableLanguages, hasBunRuntime, } from "./runtime.js";
|
|
15
|
-
const VERSION = "1.0.
|
|
15
|
+
const VERSION = "1.0.6";
|
|
16
16
|
// Prevent silent server death from unhandled async errors
|
|
17
17
|
process.on("unhandledRejection", (err) => {
|
|
18
18
|
process.stderr.write(`[context-mode] unhandledRejection: ${err}\n`);
|
package/build/session/extract.js
CHANGED
|
@@ -244,17 +244,23 @@ function extractSkill(input) {
|
|
|
244
244
|
}
|
|
245
245
|
/**
|
|
246
246
|
* Category 9: subagent
|
|
247
|
-
* Agent tool calls
|
|
247
|
+
* Agent tool calls — tracks both launch and completion.
|
|
248
|
+
* When tool_response is present, the agent has completed and the result
|
|
249
|
+
* is captured at higher priority (P2) so it survives budget trimming.
|
|
248
250
|
*/
|
|
249
251
|
function extractSubagent(input) {
|
|
250
252
|
if (input.tool_name !== "Agent")
|
|
251
253
|
return [];
|
|
252
|
-
const prompt = String(input.tool_input["prompt"] ?? input.tool_input["description"] ?? "");
|
|
254
|
+
const prompt = truncate(String(input.tool_input["prompt"] ?? input.tool_input["description"] ?? ""), 200);
|
|
255
|
+
const response = input.tool_response ? truncate(String(input.tool_response), 300) : "";
|
|
256
|
+
const isCompleted = response.length > 0;
|
|
253
257
|
return [{
|
|
254
|
-
type: "
|
|
258
|
+
type: isCompleted ? "subagent_completed" : "subagent_launched",
|
|
255
259
|
category: "subagent",
|
|
256
|
-
data:
|
|
257
|
-
|
|
260
|
+
data: isCompleted
|
|
261
|
+
? truncate(`[completed] ${prompt} → ${response}`, 300)
|
|
262
|
+
: truncate(`[launched] ${prompt}`, 300),
|
|
263
|
+
priority: isCompleted ? 2 : 3,
|
|
258
264
|
}];
|
|
259
265
|
}
|
|
260
266
|
/**
|
|
@@ -57,6 +57,11 @@ export declare function renderErrors(errorEvents: StoredEvent[]): string;
|
|
|
57
57
|
* Render <intent> from the most recent intent event.
|
|
58
58
|
*/
|
|
59
59
|
export declare function renderIntent(intentEvent: StoredEvent): string;
|
|
60
|
+
/**
|
|
61
|
+
* Render <subagents> from subagent events.
|
|
62
|
+
* Shows agent dispatch status (launched/completed) and result summaries.
|
|
63
|
+
*/
|
|
64
|
+
export declare function renderSubagents(subagentEvents: StoredEvent[]): string;
|
|
60
65
|
/**
|
|
61
66
|
* Render <mcp_tools> from MCP tool call events.
|
|
62
67
|
* Deduplicates by tool name, shows usage count.
|
|
@@ -190,6 +190,23 @@ export function renderErrors(errorEvents) {
|
|
|
190
190
|
export function renderIntent(intentEvent) {
|
|
191
191
|
return ` <intent mode="${escapeXML(intentEvent.data)}">${escapeXML(truncateString(intentEvent.data, 100))}</intent>`;
|
|
192
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Render <subagents> from subagent events.
|
|
195
|
+
* Shows agent dispatch status (launched/completed) and result summaries.
|
|
196
|
+
*/
|
|
197
|
+
export function renderSubagents(subagentEvents) {
|
|
198
|
+
if (subagentEvents.length === 0)
|
|
199
|
+
return "";
|
|
200
|
+
const lines = [" <subagents>"];
|
|
201
|
+
for (const ev of subagentEvents) {
|
|
202
|
+
const status = ev.type === "subagent_completed" ? "completed"
|
|
203
|
+
: ev.type === "subagent_launched" ? "launched"
|
|
204
|
+
: "unknown";
|
|
205
|
+
lines.push(` <agent status="${status}">${escapeXML(truncateString(ev.data, 200))}</agent>`);
|
|
206
|
+
}
|
|
207
|
+
lines.push(" </subagents>");
|
|
208
|
+
return lines.join("\n");
|
|
209
|
+
}
|
|
193
210
|
/**
|
|
194
211
|
* Render <mcp_tools> from MCP tool call events.
|
|
195
212
|
* Deduplicates by tool name, shows usage count.
|
|
@@ -297,7 +314,7 @@ export function buildResumeSnapshot(events, opts) {
|
|
|
297
314
|
const rules = renderRules(ruleEvents);
|
|
298
315
|
if (rules)
|
|
299
316
|
p1Sections.push(rules);
|
|
300
|
-
// P2 sections (35% budget): decisions, environment, errors_resolved
|
|
317
|
+
// P2 sections (35% budget): decisions, environment, errors_resolved, completed subagents
|
|
301
318
|
const p2Sections = [];
|
|
302
319
|
const decisions = renderDecisions(decisionEvents);
|
|
303
320
|
if (decisions)
|
|
@@ -310,7 +327,12 @@ export function buildResumeSnapshot(events, opts) {
|
|
|
310
327
|
const errors = renderErrors(errorEvents);
|
|
311
328
|
if (errors)
|
|
312
329
|
p2Sections.push(errors);
|
|
313
|
-
//
|
|
330
|
+
// Completed subagents are P2 — their results must survive budget trimming
|
|
331
|
+
const completedSubagents = subagentEvents.filter(e => e.type === "subagent_completed");
|
|
332
|
+
const subagentsP2 = renderSubagents(completedSubagents);
|
|
333
|
+
if (subagentsP2)
|
|
334
|
+
p2Sections.push(subagentsP2);
|
|
335
|
+
// P3-P4 sections (15% budget): intent, mcp_tools, launched subagents
|
|
314
336
|
const p3Sections = [];
|
|
315
337
|
if (intentEvents.length > 0) {
|
|
316
338
|
const lastIntent = intentEvents[intentEvents.length - 1];
|
|
@@ -319,6 +341,10 @@ export function buildResumeSnapshot(events, opts) {
|
|
|
319
341
|
const mcpTools = renderMcpTools(mcpEvents);
|
|
320
342
|
if (mcpTools)
|
|
321
343
|
p3Sections.push(mcpTools);
|
|
344
|
+
const launchedSubagents = subagentEvents.filter(e => e.type === "subagent_launched");
|
|
345
|
+
const subagentsP3 = renderSubagents(launchedSubagents);
|
|
346
|
+
if (subagentsP3)
|
|
347
|
+
p3Sections.push(subagentsP3);
|
|
322
348
|
// ── Assemble with budget trimming ──
|
|
323
349
|
const header = `<session_resume compact_count="${compactCount}" events_captured="${events.length}" generated_at="${now}">`;
|
|
324
350
|
const footer = `</session_resume>`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "context-mode",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "MCP plugin that saves 98% of your context window. Works with Claude Code, Gemini CLI, VS Code Copilot, OpenCode, and Codex CLI. Sandboxed code execution, FTS5 knowledge base, and intent-driven search.",
|
|
6
6
|
"author": "Mert Koseoğlu",
|