context-mode 2.1.6 → 2.1.7

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.
@@ -12,5 +12,5 @@
12
12
  }
13
13
  },
14
14
  "name": "context-mode",
15
- "version": "2.1.6"
15
+ "version": "2.1.7"
16
16
  }
package/run.mjs CHANGED
@@ -158,6 +158,8 @@ var DECAY_X1000 = Object.freeze([
158
158
  ]);
159
159
  var EXEC_TIMEOUT_MS = 6e5;
160
160
  var KILL_GRACE_MS = 1e3;
161
+ var PIPE_EOF_GRACE_MS = 250;
162
+ var PIPE_DRAIN_MAX_MS = 2e3;
161
163
  var DB_TIMEOUT_MS = 5e3;
162
164
  var DB_WAL_SUFFIX = "-wal";
163
165
  var DB_SHM_SUFFIX = "-shm";
@@ -379,6 +381,89 @@ var OPS_SPLIT_FILES = Object.freeze([
379
381
  "v1-remove.ts",
380
382
  "uninstall.ts"
381
383
  ]);
384
+ var unsupported = (h) => Object.freeze(h);
385
+ var UNSUPPORTED_HOSTS = Object.freeze([
386
+ unsupported({
387
+ id: "antigravity",
388
+ name: "Antigravity",
389
+ clientNames: ["antigravity", "antigravity-client", "antigravity-cli", "agy"],
390
+ envVars: ["ANTIGRAVITY_CLI_ALIAS"],
391
+ pluginPaths: [[".gemini", "config", "plugins"], [".gemini", "antigravity", "plugins"], [".gemini", "antigravity-cli", "plugins"], [".gemini", "antigravity-ide", "plugins"]],
392
+ configDirs: [".gemini/antigravity", ".gemini/antigravity-cli", ".gemini/config"],
393
+ binaries: ["agy"],
394
+ source: "v1.0.169:src/adapters/client-map.ts:15-17; detect.ts:156,481-483; #1340"
395
+ }),
396
+ unsupported({
397
+ id: "cursor",
398
+ name: "Cursor",
399
+ clientNames: ["cursor-vscode"],
400
+ envVars: ["CURSOR_TRACE_ID", "CURSOR_CLI", "CURSOR_CWD"],
401
+ pluginPaths: [],
402
+ configDirs: [".cursor"],
403
+ binaries: [],
404
+ source: "v1.0.169:src/adapters/client-map.ts:18; detect.ts:163-165,584"
405
+ }),
406
+ unsupported({
407
+ id: "omp",
408
+ name: "OMP (oh-my-pi)",
409
+ clientNames: ["omp-coding-agent"],
410
+ envVars: [],
411
+ pluginPaths: [],
412
+ configDirs: [".omp"],
413
+ binaries: ["omp"],
414
+ source: "v1.0.169:src/adapters/client-map.ts:37; detect.ts:543 (PI_CODING_AGENT_DIR is not a signal: supported Pi reads it too)"
415
+ }),
416
+ unsupported({
417
+ id: "openclaw",
418
+ name: "OpenClaw",
419
+ clientNames: [],
420
+ envVars: [],
421
+ pluginPaths: [],
422
+ configDirs: [".openclaw"],
423
+ binaries: [],
424
+ source: "v1.0.169:src/adapters/detect.ts:252,575 (the runtime sets no env var)"
425
+ }),
426
+ unsupported({
427
+ id: "kimi",
428
+ name: "Kimi Code",
429
+ clientNames: ["kimi-code", "kimi"],
430
+ envVars: [],
431
+ pluginPaths: [],
432
+ configDirs: [".kimi-code"],
433
+ binaries: ["kimi"],
434
+ source: "v1.0.169:src/adapters/client-map.ts:42-44; detect.ts:567; adapters/kimi/index.ts:127"
435
+ }),
436
+ unsupported({
437
+ id: "kilo",
438
+ name: "Kilo Code",
439
+ clientNames: ["kilo code"],
440
+ envVars: ["KILO", "KILO_PID"],
441
+ pluginPaths: [],
442
+ configDirs: [".config/kilo"],
443
+ binaries: [],
444
+ source: "v1.0.169:src/adapters/client-map.ts:28; detect.ts:170-171,592"
445
+ }),
446
+ unsupported({
447
+ id: "zed",
448
+ name: "Zed",
449
+ clientNames: ["zed"],
450
+ envVars: ["ZED_SESSION_ID", "ZED_TERM"],
451
+ pluginPaths: [],
452
+ configDirs: [".config/zed"],
453
+ binaries: [],
454
+ source: "v1.0.169:src/adapters/client-map.ts:38-39; detect.ts:189-190,616"
455
+ }),
456
+ unsupported({
457
+ id: "jetbrains-copilot",
458
+ name: "JetBrains Copilot",
459
+ clientNames: ["jetbrains client", "intellij idea", "pycharm"],
460
+ envVars: ["IDEA_INITIAL_DIRECTORY"],
461
+ pluginPaths: [],
462
+ configDirs: [".config/JetBrains"],
463
+ binaries: [],
464
+ source: "v1.0.169:src/adapters/client-map.ts:23-25; detect.ts:213,600"
465
+ })
466
+ ]);
382
467
  var HOOK_HOST_FILE = Object.freeze({
383
468
  "claude-code": { root: "plugin", file: ["hooks", "claude-code.json"], key: ["hooks"], shape: "nested", timeoutKey: "timeout", matcher: true },
384
469
  codex: { root: "home", file: [".codex", "hooks.json"], key: ["hooks"], shape: "nested", timeoutKey: "timeout", matcher: true },
@@ -6121,11 +6206,11 @@ function noRuntimeError(lang) {
6121
6206
  }
6122
6207
 
6123
6208
  // src/core/sandbox/spawn.ts
6124
- import { spawn } from "node:child_process";
6209
+ import { spawn as spawn2 } from "node:child_process";
6125
6210
  import path2 from "node:path";
6126
6211
 
6127
6212
  // src/core/sandbox/kill.ts
6128
- import { execFileSync } from "node:child_process";
6213
+ import { spawn } from "node:child_process";
6129
6214
  function signalGroup(pid, signal) {
6130
6215
  try {
6131
6216
  process.kill(-pid, signal);
@@ -6139,7 +6224,10 @@ function killTree(pid) {
6139
6224
  return;
6140
6225
  }
6141
6226
  try {
6142
- execFileSync("taskkill", ["/F", "/T", "/PID", String(pid)], { stdio: "ignore", windowsHide: true });
6227
+ const t = spawn("taskkill", ["/F", "/T", "/PID", String(pid)], { stdio: "ignore", windowsHide: true });
6228
+ t.on("error", () => {
6229
+ });
6230
+ t.unref();
6143
6231
  } catch {
6144
6232
  }
6145
6233
  }
@@ -6158,7 +6246,7 @@ function runProcess(argv, o) {
6158
6246
  if (start === null) return resolve5(NOT_STARTED);
6159
6247
  let child;
6160
6248
  try {
6161
- child = spawn(start[0], start.slice(1), {
6249
+ child = spawn2(start[0], start.slice(1), {
6162
6250
  cwd: o.cwd,
6163
6251
  env: o.env,
6164
6252
  stdio: ["pipe", "pipe", "pipe"],
@@ -6175,8 +6263,14 @@ function runProcess(argv, o) {
6175
6263
  const stderrChunks = [];
6176
6264
  let killedBy = null;
6177
6265
  let settled = false;
6266
+ let held = false;
6267
+ let exited = false;
6268
+ let graceTimer;
6269
+ let drainTimer;
6270
+ let stopTimer;
6178
6271
  const kill = () => {
6179
6272
  if (child.pid !== void 0) killTree(child.pid);
6273
+ if (stopTimer === void 0) stopTimer = setTimeout(() => finishHeld(), KILL_GRACE_MS);
6180
6274
  };
6181
6275
  const onAbort = () => {
6182
6276
  if (killedBy !== null || settled) return;
@@ -6193,17 +6287,46 @@ function runProcess(argv, o) {
6193
6287
  if (settled) return;
6194
6288
  settled = true;
6195
6289
  clearTimeout(timer);
6290
+ clearTimeout(graceTimer);
6291
+ clearTimeout(drainTimer);
6292
+ clearTimeout(stopTimer);
6196
6293
  o.signal.removeEventListener("abort", onAbort);
6197
6294
  resolve5({
6198
6295
  stdout: Buffer.concat(stdoutChunks),
6199
6296
  stderr: Buffer.concat(stderrChunks),
6200
6297
  exitCode,
6201
- killed: killedBy
6298
+ killed: killedBy,
6299
+ ...held ? { held: true } : {}
6202
6300
  });
6203
6301
  };
6204
- child.stdout.on("data", (chunk) => stdoutChunks.push(chunk));
6205
- child.stderr.on("data", (chunk) => stderrChunks.push(chunk));
6302
+ const finishHeld = () => {
6303
+ if (settled) return;
6304
+ held = exited && killedBy === null;
6305
+ child.stdout.destroy();
6306
+ child.stderr.destroy();
6307
+ if (child.pid !== void 0) killTree(child.pid);
6308
+ settle(child.exitCode);
6309
+ };
6310
+ const bump = () => {
6311
+ if (!exited || settled) return;
6312
+ clearTimeout(graceTimer);
6313
+ graceTimer = setTimeout(finishHeld, PIPE_EOF_GRACE_MS);
6314
+ };
6315
+ child.stdout.on("data", (chunk) => {
6316
+ stdoutChunks.push(chunk);
6317
+ bump();
6318
+ });
6319
+ child.stderr.on("data", (chunk) => {
6320
+ stderrChunks.push(chunk);
6321
+ bump();
6322
+ });
6206
6323
  child.on("close", (code) => settle(code));
6324
+ child.on("exit", () => {
6325
+ if (settled) return;
6326
+ exited = true;
6327
+ graceTimer = setTimeout(finishHeld, PIPE_EOF_GRACE_MS);
6328
+ drainTimer = setTimeout(finishHeld, PIPE_DRAIN_MAX_MS);
6329
+ });
6207
6330
  child.on("error", () => settle(null));
6208
6331
  child.stdin.on("error", () => {
6209
6332
  });
package/search.mjs CHANGED
@@ -158,6 +158,8 @@ var DECAY_X1000 = Object.freeze([
158
158
  ]);
159
159
  var EXEC_TIMEOUT_MS = 6e5;
160
160
  var KILL_GRACE_MS = 1e3;
161
+ var PIPE_EOF_GRACE_MS = 250;
162
+ var PIPE_DRAIN_MAX_MS = 2e3;
161
163
  var DB_TIMEOUT_MS = 5e3;
162
164
  var DB_WAL_SUFFIX = "-wal";
163
165
  var DB_SHM_SUFFIX = "-shm";
@@ -379,6 +381,89 @@ var OPS_SPLIT_FILES = Object.freeze([
379
381
  "v1-remove.ts",
380
382
  "uninstall.ts"
381
383
  ]);
384
+ var unsupported = (h) => Object.freeze(h);
385
+ var UNSUPPORTED_HOSTS = Object.freeze([
386
+ unsupported({
387
+ id: "antigravity",
388
+ name: "Antigravity",
389
+ clientNames: ["antigravity", "antigravity-client", "antigravity-cli", "agy"],
390
+ envVars: ["ANTIGRAVITY_CLI_ALIAS"],
391
+ pluginPaths: [[".gemini", "config", "plugins"], [".gemini", "antigravity", "plugins"], [".gemini", "antigravity-cli", "plugins"], [".gemini", "antigravity-ide", "plugins"]],
392
+ configDirs: [".gemini/antigravity", ".gemini/antigravity-cli", ".gemini/config"],
393
+ binaries: ["agy"],
394
+ source: "v1.0.169:src/adapters/client-map.ts:15-17; detect.ts:156,481-483; #1340"
395
+ }),
396
+ unsupported({
397
+ id: "cursor",
398
+ name: "Cursor",
399
+ clientNames: ["cursor-vscode"],
400
+ envVars: ["CURSOR_TRACE_ID", "CURSOR_CLI", "CURSOR_CWD"],
401
+ pluginPaths: [],
402
+ configDirs: [".cursor"],
403
+ binaries: [],
404
+ source: "v1.0.169:src/adapters/client-map.ts:18; detect.ts:163-165,584"
405
+ }),
406
+ unsupported({
407
+ id: "omp",
408
+ name: "OMP (oh-my-pi)",
409
+ clientNames: ["omp-coding-agent"],
410
+ envVars: [],
411
+ pluginPaths: [],
412
+ configDirs: [".omp"],
413
+ binaries: ["omp"],
414
+ source: "v1.0.169:src/adapters/client-map.ts:37; detect.ts:543 (PI_CODING_AGENT_DIR is not a signal: supported Pi reads it too)"
415
+ }),
416
+ unsupported({
417
+ id: "openclaw",
418
+ name: "OpenClaw",
419
+ clientNames: [],
420
+ envVars: [],
421
+ pluginPaths: [],
422
+ configDirs: [".openclaw"],
423
+ binaries: [],
424
+ source: "v1.0.169:src/adapters/detect.ts:252,575 (the runtime sets no env var)"
425
+ }),
426
+ unsupported({
427
+ id: "kimi",
428
+ name: "Kimi Code",
429
+ clientNames: ["kimi-code", "kimi"],
430
+ envVars: [],
431
+ pluginPaths: [],
432
+ configDirs: [".kimi-code"],
433
+ binaries: ["kimi"],
434
+ source: "v1.0.169:src/adapters/client-map.ts:42-44; detect.ts:567; adapters/kimi/index.ts:127"
435
+ }),
436
+ unsupported({
437
+ id: "kilo",
438
+ name: "Kilo Code",
439
+ clientNames: ["kilo code"],
440
+ envVars: ["KILO", "KILO_PID"],
441
+ pluginPaths: [],
442
+ configDirs: [".config/kilo"],
443
+ binaries: [],
444
+ source: "v1.0.169:src/adapters/client-map.ts:28; detect.ts:170-171,592"
445
+ }),
446
+ unsupported({
447
+ id: "zed",
448
+ name: "Zed",
449
+ clientNames: ["zed"],
450
+ envVars: ["ZED_SESSION_ID", "ZED_TERM"],
451
+ pluginPaths: [],
452
+ configDirs: [".config/zed"],
453
+ binaries: [],
454
+ source: "v1.0.169:src/adapters/client-map.ts:38-39; detect.ts:189-190,616"
455
+ }),
456
+ unsupported({
457
+ id: "jetbrains-copilot",
458
+ name: "JetBrains Copilot",
459
+ clientNames: ["jetbrains client", "intellij idea", "pycharm"],
460
+ envVars: ["IDEA_INITIAL_DIRECTORY"],
461
+ pluginPaths: [],
462
+ configDirs: [".config/JetBrains"],
463
+ binaries: [],
464
+ source: "v1.0.169:src/adapters/client-map.ts:23-25; detect.ts:213,600"
465
+ })
466
+ ]);
382
467
  var HOOK_HOST_FILE = Object.freeze({
383
468
  "claude-code": { root: "plugin", file: ["hooks", "claude-code.json"], key: ["hooks"], shape: "nested", timeoutKey: "timeout", matcher: true },
384
469
  codex: { root: "home", file: [".codex", "hooks.json"], key: ["hooks"], shape: "nested", timeoutKey: "timeout", matcher: true },
@@ -6121,11 +6206,11 @@ function noRuntimeError(lang) {
6121
6206
  }
6122
6207
 
6123
6208
  // src/core/sandbox/spawn.ts
6124
- import { spawn } from "node:child_process";
6209
+ import { spawn as spawn2 } from "node:child_process";
6125
6210
  import path2 from "node:path";
6126
6211
 
6127
6212
  // src/core/sandbox/kill.ts
6128
- import { execFileSync } from "node:child_process";
6213
+ import { spawn } from "node:child_process";
6129
6214
  function signalGroup(pid, signal) {
6130
6215
  try {
6131
6216
  process.kill(-pid, signal);
@@ -6139,7 +6224,10 @@ function killTree(pid) {
6139
6224
  return;
6140
6225
  }
6141
6226
  try {
6142
- execFileSync("taskkill", ["/F", "/T", "/PID", String(pid)], { stdio: "ignore", windowsHide: true });
6227
+ const t = spawn("taskkill", ["/F", "/T", "/PID", String(pid)], { stdio: "ignore", windowsHide: true });
6228
+ t.on("error", () => {
6229
+ });
6230
+ t.unref();
6143
6231
  } catch {
6144
6232
  }
6145
6233
  }
@@ -6158,7 +6246,7 @@ function runProcess(argv, o) {
6158
6246
  if (start === null) return resolve5(NOT_STARTED);
6159
6247
  let child;
6160
6248
  try {
6161
- child = spawn(start[0], start.slice(1), {
6249
+ child = spawn2(start[0], start.slice(1), {
6162
6250
  cwd: o.cwd,
6163
6251
  env: o.env,
6164
6252
  stdio: ["pipe", "pipe", "pipe"],
@@ -6175,8 +6263,14 @@ function runProcess(argv, o) {
6175
6263
  const stderrChunks = [];
6176
6264
  let killedBy = null;
6177
6265
  let settled = false;
6266
+ let held = false;
6267
+ let exited = false;
6268
+ let graceTimer;
6269
+ let drainTimer;
6270
+ let stopTimer;
6178
6271
  const kill = () => {
6179
6272
  if (child.pid !== void 0) killTree(child.pid);
6273
+ if (stopTimer === void 0) stopTimer = setTimeout(() => finishHeld(), KILL_GRACE_MS);
6180
6274
  };
6181
6275
  const onAbort = () => {
6182
6276
  if (killedBy !== null || settled) return;
@@ -6193,17 +6287,46 @@ function runProcess(argv, o) {
6193
6287
  if (settled) return;
6194
6288
  settled = true;
6195
6289
  clearTimeout(timer);
6290
+ clearTimeout(graceTimer);
6291
+ clearTimeout(drainTimer);
6292
+ clearTimeout(stopTimer);
6196
6293
  o.signal.removeEventListener("abort", onAbort);
6197
6294
  resolve5({
6198
6295
  stdout: Buffer.concat(stdoutChunks),
6199
6296
  stderr: Buffer.concat(stderrChunks),
6200
6297
  exitCode,
6201
- killed: killedBy
6298
+ killed: killedBy,
6299
+ ...held ? { held: true } : {}
6202
6300
  });
6203
6301
  };
6204
- child.stdout.on("data", (chunk) => stdoutChunks.push(chunk));
6205
- child.stderr.on("data", (chunk) => stderrChunks.push(chunk));
6302
+ const finishHeld = () => {
6303
+ if (settled) return;
6304
+ held = exited && killedBy === null;
6305
+ child.stdout.destroy();
6306
+ child.stderr.destroy();
6307
+ if (child.pid !== void 0) killTree(child.pid);
6308
+ settle(child.exitCode);
6309
+ };
6310
+ const bump = () => {
6311
+ if (!exited || settled) return;
6312
+ clearTimeout(graceTimer);
6313
+ graceTimer = setTimeout(finishHeld, PIPE_EOF_GRACE_MS);
6314
+ };
6315
+ child.stdout.on("data", (chunk) => {
6316
+ stdoutChunks.push(chunk);
6317
+ bump();
6318
+ });
6319
+ child.stderr.on("data", (chunk) => {
6320
+ stderrChunks.push(chunk);
6321
+ bump();
6322
+ });
6206
6323
  child.on("close", (code) => settle(code));
6324
+ child.on("exit", () => {
6325
+ if (settled) return;
6326
+ exited = true;
6327
+ graceTimer = setTimeout(finishHeld, PIPE_EOF_GRACE_MS);
6328
+ drainTimer = setTimeout(finishHeld, PIPE_DRAIN_MAX_MS);
6329
+ });
6207
6330
  child.on("error", () => settle(null));
6208
6331
  child.stdin.on("error", () => {
6209
6332
  });