antigravity-plugin-context-mode 1.0.2 → 1.2.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/lib/tools.js CHANGED
@@ -89,10 +89,14 @@ export function createTools({ store, getCwd = () => process.cwd(), getSessionId
89
89
  sourceId = indexed.sourceId;
90
90
  }
91
91
 
92
+ const cutoffBytes = store.getCutoff(sessionId);
93
+ // Sandbox cap is dynamically double the current cutoff setting
94
+ const previewCapBytes = cutoffBytes > 0 ? cutoffBytes * 2 : EXEC_PREVIEW_BYTES * 8;
95
+
92
96
  let returnedText = fullOutput;
93
97
  let truncated = false;
94
- if (fullBytes > EXEC_PREVIEW_BYTES) {
95
- returnedText = fullOutput.slice(0, EXEC_PREVIEW_BYTES);
98
+ if (fullBytes > previewCapBytes) {
99
+ returnedText = fullOutput.slice(0, previewCapBytes);
96
100
  truncated = true;
97
101
  }
98
102
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "antigravity-plugin-context-mode",
3
- "version": "1.0.2",
3
+ "version": "1.2.1",
4
4
  "description": "Native Antigravity plugin for context-mode: SQLite FTS5 indexing, sandboxed execution, and lifecycle hook protection against context window bloat",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/plugin.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "antigravity-plugin-context-mode",
3
3
  "displayName": "Context Mode",
4
4
  "description": "Context window protection for Antigravity: local SQLite FTS5 search, sandboxed execution, and lifecycle hook gating against token bloat.",
5
- "version": "1.0.0",
5
+ "version": "1.2.1",
6
6
  "author": "Phillip Webber <github@webbsense.com>",
7
7
  "repository": {
8
8
  "type": "git",
package/server.js CHANGED
@@ -1,16 +1,33 @@
1
1
  #!/usr/bin/env node
2
+ import fs from "node:fs";
3
+ import path from "node:path";
2
4
  import readline from "node:readline";
5
+ import { fileURLToPath } from "node:url";
3
6
  import { ContextModeStore } from "./lib/store.js";
4
7
  import { createTools } from "./lib/tools.js";
5
8
 
9
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
10
+ let pkgVersion = "1.0.0";
11
+ try {
12
+ const pkg = JSON.parse(fs.readFileSync(path.join(__dirname, "package.json"), "utf8"));
13
+ if (pkg.version) pkgVersion = pkg.version;
14
+ } catch {}
15
+
6
16
  const store = new ContextModeStore();
7
17
  let currentCwd = process.cwd();
8
- let currentSessionId = "default";
18
+ let currentSessionId =
19
+ process.env.ANTIGRAVITY_CONVERSATION_ID ||
20
+ process.env.CONVERSATION_ID ||
21
+ "default";
9
22
 
10
23
  const tools = createTools({
11
24
  store,
12
25
  getCwd: () => currentCwd,
13
- getSessionId: () => currentSessionId
26
+ getSessionId: () =>
27
+ process.env.ANTIGRAVITY_CONVERSATION_ID ||
28
+ process.env.CONVERSATION_ID ||
29
+ currentSessionId ||
30
+ "default"
14
31
  });
15
32
 
16
33
  const TOOL_DEFINITIONS = [
@@ -189,7 +206,7 @@ rl.on("line", async (line) => {
189
206
  },
190
207
  serverInfo: {
191
208
  name: "antigravity-plugin-context-mode",
192
- version: "1.0.0"
209
+ version: pkgVersion
193
210
  }
194
211
  });
195
212
  break;
@@ -210,6 +227,14 @@ rl.on("line", async (line) => {
210
227
  case "tools/call": {
211
228
  const toolName = params?.name;
212
229
  const toolArgs = params?.arguments || {};
230
+ const callSessionId =
231
+ toolArgs.sessionId ||
232
+ params?._meta?.conversationId ||
233
+ params?._meta?.sessionId ||
234
+ params?.sessionId;
235
+ if (callSessionId) {
236
+ currentSessionId = callSessionId;
237
+ }
213
238
 
214
239
  if (!tools[toolName]) {
215
240
  sendError(id, -32601, `Unknown tool: ${toolName}`);