context-mode 2.0.0-next.30 → 2.0.0-next.32
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 +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/README.md +22 -22
- package/SHA256SUMS +15 -15
- package/cli.mjs +325 -155
- package/copilot/plugin.json +1 -1
- package/gemini-extension.json +1 -1
- package/hook.mjs +75 -75
- package/opencode/plugin.js +636 -149
- package/package.json +1 -1
- package/pi/index.js +678 -191
- package/qwen-extension.json +1 -1
- package/run.mjs +66 -5
- package/search.mjs +66 -5
- package/server.mjs +665 -178
package/qwen-extension.json
CHANGED
package/run.mjs
CHANGED
|
@@ -262,17 +262,25 @@ var STATS_EMPTY_LINES = Object.freeze([
|
|
|
262
262
|
"sandbox, and only the short answer goes to the chat."
|
|
263
263
|
]);
|
|
264
264
|
var STATS_KIND_LABELS = Object.freeze([
|
|
265
|
-
|
|
265
|
+
// D-STATS-FIX-1 (8): the first five rows are call kinds, so they add up to the calls of the scope line.
|
|
266
266
|
["index", "Content indexed"],
|
|
267
267
|
["edit", "File edits"],
|
|
268
|
-
["toolerr", "
|
|
268
|
+
["toolerr", "Issues kept"],
|
|
269
269
|
["decision", "Your decisions"],
|
|
270
|
+
["cmd", "Other tool calls"],
|
|
270
271
|
["prompt", "Your prompts"]
|
|
271
272
|
]);
|
|
272
273
|
var STATS_JOURNAL_HINTS = Object.freeze([
|
|
273
|
-
"ctx_resume brings back your last task, files changed and open
|
|
274
|
+
"ctx_resume brings back your last task, files changed and open issues",
|
|
274
275
|
"after a compact or a restart; ctx_search finds indexed content by words."
|
|
275
276
|
]);
|
|
277
|
+
var STATS_WAYS = Object.freeze([
|
|
278
|
+
["sandbox", "\u2588", "sandbox run"],
|
|
279
|
+
["index", "\u2593", "index + search"],
|
|
280
|
+
["redirect", "\u2592", "hook sent to sandbox"],
|
|
281
|
+
["replace", "\u2591", "hook cut down"]
|
|
282
|
+
]);
|
|
283
|
+
var STATS_INDEX_TOOLS = Object.freeze(["ctx_index", "ctx_search"]);
|
|
276
284
|
var PURGE_SCOPES = Object.freeze(["session", "source", "project"]);
|
|
277
285
|
var RELEASE_REPO_URL = "https://github.com/mksglu/context-mode.git";
|
|
278
286
|
var RELEASE_BRANCH = "release";
|
|
@@ -400,7 +408,7 @@ var V1_REASON = Object.freeze({
|
|
|
400
408
|
dataDir: "old context-mode data dir <agent home>/context-mode/",
|
|
401
409
|
dataDirShared: "old context-mode data dir ~/.gemini/context-mode/: delete only after a prompt (Antigravity shares it)",
|
|
402
410
|
dataRoot: "old context-mode content under ~/.context-mode/",
|
|
403
|
-
tmpFile: "old context-mode temp file context-mode-* under the OS temp dir: report only,
|
|
411
|
+
tmpFile: "old context-mode temp file context-mode-* under the OS temp dir: report only, safe to keep"
|
|
404
412
|
});
|
|
405
413
|
var UPGRADE_REPORT_ONLY_REASONS = Object.freeze([V1_REASON.statusLine, V1_REASON.vscodeMcp, V1_REASON.dataDirShared, V1_REASON.tmpFile, V1_REASON.kiroSteering]);
|
|
406
414
|
var OPENCODE_TOOL_PREFIX = SERVER_KEY + "_";
|
|
@@ -424,6 +432,59 @@ var OWN_MCP_ENTRY = Object.freeze({
|
|
|
424
432
|
var REPORT_ENV_ENUMS = Object.freeze({
|
|
425
433
|
NODE_ENV: Object.freeze(["development", "production", "test"])
|
|
426
434
|
});
|
|
435
|
+
var DOCTOR_ENV_PREFIX = "Environment: ";
|
|
436
|
+
var DOCTOR_DOCS_LABEL = "Docs: ";
|
|
437
|
+
var DOCTOR_REPORT_LINE = "Report file: ";
|
|
438
|
+
var DOCTOR_GH_LINE = "File it: ";
|
|
439
|
+
var DOCTOR_URL_LINE = "Or open: ";
|
|
440
|
+
var DOCTOR_GH_NEXT = " --";
|
|
441
|
+
var DOCTOR_NOTE_PREFIXES = Object.freeze([
|
|
442
|
+
DOCTOR_ENV_PREFIX,
|
|
443
|
+
DOCTOR_DOCS_LABEL,
|
|
444
|
+
DOCTOR_REPORT_LINE,
|
|
445
|
+
DOCTOR_GH_LINE,
|
|
446
|
+
DOCTOR_GH_NEXT.trim(),
|
|
447
|
+
DOCTOR_URL_LINE
|
|
448
|
+
]);
|
|
449
|
+
var ISSUE_REPO_SLUG = "mksglu/context-mode";
|
|
450
|
+
var ISSUE_FORM_FILE = "agent-report.yml";
|
|
451
|
+
var ISSUE_FORM_HEADINGS = Object.freeze([
|
|
452
|
+
"Summary",
|
|
453
|
+
"ctx-report",
|
|
454
|
+
"What happened",
|
|
455
|
+
"Hook errors",
|
|
456
|
+
"Journal rows",
|
|
457
|
+
"Agent config",
|
|
458
|
+
"Expected",
|
|
459
|
+
"Steps",
|
|
460
|
+
"Environment"
|
|
461
|
+
]);
|
|
462
|
+
var DOCTOR_ENV_NAMES = Object.freeze([
|
|
463
|
+
"CODEX_HOME",
|
|
464
|
+
"CLAUDE_CONFIG_DIR",
|
|
465
|
+
"CLAUDE_PLUGIN_ROOT",
|
|
466
|
+
"COPILOT_HOME",
|
|
467
|
+
"KIRO_HOME",
|
|
468
|
+
"OPENCODE_CONFIG_DIR",
|
|
469
|
+
"PI_CODING_AGENT_DIR",
|
|
470
|
+
"XDG_CONFIG_HOME",
|
|
471
|
+
"SHELL"
|
|
472
|
+
]);
|
|
473
|
+
var DOCTOR_PATH_TOOLS = Object.freeze(["node", "git", "sh"]);
|
|
474
|
+
var DOCTOR_SECRET_WORDS = Object.freeze(["token", "secret", "password", "apikey", "api_key", "authorization", "bearer"]);
|
|
475
|
+
var NATIVE_INSTALL = Object.freeze({
|
|
476
|
+
"claude-code": ["claude plugin marketplace add mksglu/context-mode#release", "claude plugin install context-mode@context-mode"],
|
|
477
|
+
codex: ["codex plugin marketplace add mksglu/context-mode@release", "codex plugin add context-mode@context-mode"],
|
|
478
|
+
gemini: ["gemini extensions install https://github.com/mksglu/context-mode --ref release"],
|
|
479
|
+
qwen: ["qwen extensions install https://github.com/mksglu/context-mode:context-mode --ref release"],
|
|
480
|
+
opencode: ["opencode plugin add context-mode@next"],
|
|
481
|
+
pi: ["pi install npm:context-mode@next"],
|
|
482
|
+
"copilot-cli": ["npm i -g context-mode@next", "context-mode setup --agents copilot-cli"],
|
|
483
|
+
vscode: ["npm i -g context-mode@next", "context-mode setup --agents vscode"],
|
|
484
|
+
kiro: ["npm i -g context-mode@next", "context-mode setup --agents kiro"],
|
|
485
|
+
zcode: ["npm i -g context-mode@next", "context-mode setup --agents zcode"]
|
|
486
|
+
});
|
|
487
|
+
var ISSUE_FORM_URL = `https://github.com/${ISSUE_REPO_SLUG}/issues/new?template=${ISSUE_FORM_FILE}`;
|
|
427
488
|
|
|
428
489
|
// src/core/tools/run-wrapper.ts
|
|
429
490
|
import { randomUUID } from "node:crypto";
|
|
@@ -4957,7 +5018,7 @@ var TOOL_DESCRIPTIONS = Object.freeze({
|
|
|
4957
5018
|
ctx_search: 'Example: `ctx_search({queries:["auth middleware"]})`. Required: queries.\nSearches content stored with ctx_index and earlier sandbox output in this project. Pass several queries in one call. By default it searches the current worktree; set `scope` to `project` for all worktrees or `session` for this session only. Results from the current session rank first, then by relevance, ranked with measurably better recall than plain keyword search. Set `sort` to `timeline` for oldest-first order across this session, prior sessions and memory, paged with `after`; `offset` is for relevance order only. Set `source` to `decision` to search only rows where the user answered a question. Every hit names its source. When nothing matches, the reply states the scope and how many sources are indexed.',
|
|
4958
5019
|
ctx_resume: "Example: `ctx_resume({})`. Required: none.\nReturns a summary of up to 2 KB for this session: the last task and user request, files changed, open errors, and search terms for ctx_search. A large row is shown as a pointer line instead of its full text; call `ctx_resume(seq: N)` with that line's number to read the full row. Call it with no `seq` to get the state block on demand. Use it after the conversation was compacted or resumed, before you repeat earlier work.",
|
|
4959
5020
|
ctx_stats: "Example: `ctx_stats({})`. Required: none.\nReports the bytes context-mode kept out of the chat: a text report (bars, per tool, per agent) and a Markdown table. Show the text block to the user unchanged, in a code block. Use it when the user asks what it saved.",
|
|
4960
|
-
ctx_doctor: "Example: `ctx_doctor({})`. Required: none.\nChecks this context-mode install and reports a table with one row per check: version, Node and node:sqlite, host config and hooks for this agent, MCP connection, project and worktree, database health, index contents, and hook timing. Each failed row names its cause
|
|
5021
|
+
ctx_doctor: "Example: `ctx_doctor({})`. Required: none.\nChecks this context-mode install and reports a table with one row per check: version, Node and node:sqlite, host config and hooks for this agent, MCP connection, project and worktree, database health, index contents, and hook timing. Each failed row names its cause, the fix and a docs link. Use it when the user asks whether context-mode works, or after a context-mode error. Run each Fix first, then call ctx_doctor again. If a FAIL stays, show the user the report file it names (it holds paths and environment details) and ask before you run the printed gh issue command.\n",
|
|
4961
5022
|
ctx_upgrade: "Example: `ctx_upgrade({})`. Required: none.\nUpdates context-mode to the latest release for this agent and rewrites only context-mode's own entries in the host config. User entries and user settings such as hook timeouts are kept, and old entries are erased. Returns a table of what changed and whether a restart is needed. Use it only when the user asks to update context-mode.",
|
|
4962
5023
|
ctx_purge: 'Example: `ctx_purge({source:"old-docs"})`. Required: one of session, source, project.\nDeletes stored data: one session, one indexed source, or everything stored for this project. This cannot be undone. Use it only when the user asks to forget or reset data.'
|
|
4963
5024
|
});
|
package/search.mjs
CHANGED
|
@@ -262,17 +262,25 @@ var STATS_EMPTY_LINES = Object.freeze([
|
|
|
262
262
|
"sandbox, and only the short answer goes to the chat."
|
|
263
263
|
]);
|
|
264
264
|
var STATS_KIND_LABELS = Object.freeze([
|
|
265
|
-
|
|
265
|
+
// D-STATS-FIX-1 (8): the first five rows are call kinds, so they add up to the calls of the scope line.
|
|
266
266
|
["index", "Content indexed"],
|
|
267
267
|
["edit", "File edits"],
|
|
268
|
-
["toolerr", "
|
|
268
|
+
["toolerr", "Issues kept"],
|
|
269
269
|
["decision", "Your decisions"],
|
|
270
|
+
["cmd", "Other tool calls"],
|
|
270
271
|
["prompt", "Your prompts"]
|
|
271
272
|
]);
|
|
272
273
|
var STATS_JOURNAL_HINTS = Object.freeze([
|
|
273
|
-
"ctx_resume brings back your last task, files changed and open
|
|
274
|
+
"ctx_resume brings back your last task, files changed and open issues",
|
|
274
275
|
"after a compact or a restart; ctx_search finds indexed content by words."
|
|
275
276
|
]);
|
|
277
|
+
var STATS_WAYS = Object.freeze([
|
|
278
|
+
["sandbox", "\u2588", "sandbox run"],
|
|
279
|
+
["index", "\u2593", "index + search"],
|
|
280
|
+
["redirect", "\u2592", "hook sent to sandbox"],
|
|
281
|
+
["replace", "\u2591", "hook cut down"]
|
|
282
|
+
]);
|
|
283
|
+
var STATS_INDEX_TOOLS = Object.freeze(["ctx_index", "ctx_search"]);
|
|
276
284
|
var PURGE_SCOPES = Object.freeze(["session", "source", "project"]);
|
|
277
285
|
var RELEASE_REPO_URL = "https://github.com/mksglu/context-mode.git";
|
|
278
286
|
var RELEASE_BRANCH = "release";
|
|
@@ -400,7 +408,7 @@ var V1_REASON = Object.freeze({
|
|
|
400
408
|
dataDir: "old context-mode data dir <agent home>/context-mode/",
|
|
401
409
|
dataDirShared: "old context-mode data dir ~/.gemini/context-mode/: delete only after a prompt (Antigravity shares it)",
|
|
402
410
|
dataRoot: "old context-mode content under ~/.context-mode/",
|
|
403
|
-
tmpFile: "old context-mode temp file context-mode-* under the OS temp dir: report only,
|
|
411
|
+
tmpFile: "old context-mode temp file context-mode-* under the OS temp dir: report only, safe to keep"
|
|
404
412
|
});
|
|
405
413
|
var UPGRADE_REPORT_ONLY_REASONS = Object.freeze([V1_REASON.statusLine, V1_REASON.vscodeMcp, V1_REASON.dataDirShared, V1_REASON.tmpFile, V1_REASON.kiroSteering]);
|
|
406
414
|
var OPENCODE_TOOL_PREFIX = SERVER_KEY + "_";
|
|
@@ -424,6 +432,59 @@ var OWN_MCP_ENTRY = Object.freeze({
|
|
|
424
432
|
var REPORT_ENV_ENUMS = Object.freeze({
|
|
425
433
|
NODE_ENV: Object.freeze(["development", "production", "test"])
|
|
426
434
|
});
|
|
435
|
+
var DOCTOR_ENV_PREFIX = "Environment: ";
|
|
436
|
+
var DOCTOR_DOCS_LABEL = "Docs: ";
|
|
437
|
+
var DOCTOR_REPORT_LINE = "Report file: ";
|
|
438
|
+
var DOCTOR_GH_LINE = "File it: ";
|
|
439
|
+
var DOCTOR_URL_LINE = "Or open: ";
|
|
440
|
+
var DOCTOR_GH_NEXT = " --";
|
|
441
|
+
var DOCTOR_NOTE_PREFIXES = Object.freeze([
|
|
442
|
+
DOCTOR_ENV_PREFIX,
|
|
443
|
+
DOCTOR_DOCS_LABEL,
|
|
444
|
+
DOCTOR_REPORT_LINE,
|
|
445
|
+
DOCTOR_GH_LINE,
|
|
446
|
+
DOCTOR_GH_NEXT.trim(),
|
|
447
|
+
DOCTOR_URL_LINE
|
|
448
|
+
]);
|
|
449
|
+
var ISSUE_REPO_SLUG = "mksglu/context-mode";
|
|
450
|
+
var ISSUE_FORM_FILE = "agent-report.yml";
|
|
451
|
+
var ISSUE_FORM_HEADINGS = Object.freeze([
|
|
452
|
+
"Summary",
|
|
453
|
+
"ctx-report",
|
|
454
|
+
"What happened",
|
|
455
|
+
"Hook errors",
|
|
456
|
+
"Journal rows",
|
|
457
|
+
"Agent config",
|
|
458
|
+
"Expected",
|
|
459
|
+
"Steps",
|
|
460
|
+
"Environment"
|
|
461
|
+
]);
|
|
462
|
+
var DOCTOR_ENV_NAMES = Object.freeze([
|
|
463
|
+
"CODEX_HOME",
|
|
464
|
+
"CLAUDE_CONFIG_DIR",
|
|
465
|
+
"CLAUDE_PLUGIN_ROOT",
|
|
466
|
+
"COPILOT_HOME",
|
|
467
|
+
"KIRO_HOME",
|
|
468
|
+
"OPENCODE_CONFIG_DIR",
|
|
469
|
+
"PI_CODING_AGENT_DIR",
|
|
470
|
+
"XDG_CONFIG_HOME",
|
|
471
|
+
"SHELL"
|
|
472
|
+
]);
|
|
473
|
+
var DOCTOR_PATH_TOOLS = Object.freeze(["node", "git", "sh"]);
|
|
474
|
+
var DOCTOR_SECRET_WORDS = Object.freeze(["token", "secret", "password", "apikey", "api_key", "authorization", "bearer"]);
|
|
475
|
+
var NATIVE_INSTALL = Object.freeze({
|
|
476
|
+
"claude-code": ["claude plugin marketplace add mksglu/context-mode#release", "claude plugin install context-mode@context-mode"],
|
|
477
|
+
codex: ["codex plugin marketplace add mksglu/context-mode@release", "codex plugin add context-mode@context-mode"],
|
|
478
|
+
gemini: ["gemini extensions install https://github.com/mksglu/context-mode --ref release"],
|
|
479
|
+
qwen: ["qwen extensions install https://github.com/mksglu/context-mode:context-mode --ref release"],
|
|
480
|
+
opencode: ["opencode plugin add context-mode@next"],
|
|
481
|
+
pi: ["pi install npm:context-mode@next"],
|
|
482
|
+
"copilot-cli": ["npm i -g context-mode@next", "context-mode setup --agents copilot-cli"],
|
|
483
|
+
vscode: ["npm i -g context-mode@next", "context-mode setup --agents vscode"],
|
|
484
|
+
kiro: ["npm i -g context-mode@next", "context-mode setup --agents kiro"],
|
|
485
|
+
zcode: ["npm i -g context-mode@next", "context-mode setup --agents zcode"]
|
|
486
|
+
});
|
|
487
|
+
var ISSUE_FORM_URL = `https://github.com/${ISSUE_REPO_SLUG}/issues/new?template=${ISSUE_FORM_FILE}`;
|
|
427
488
|
|
|
428
489
|
// src/core/tools/run-wrapper.ts
|
|
429
490
|
import { randomUUID } from "node:crypto";
|
|
@@ -4957,7 +5018,7 @@ var TOOL_DESCRIPTIONS = Object.freeze({
|
|
|
4957
5018
|
ctx_search: 'Example: `ctx_search({queries:["auth middleware"]})`. Required: queries.\nSearches content stored with ctx_index and earlier sandbox output in this project. Pass several queries in one call. By default it searches the current worktree; set `scope` to `project` for all worktrees or `session` for this session only. Results from the current session rank first, then by relevance, ranked with measurably better recall than plain keyword search. Set `sort` to `timeline` for oldest-first order across this session, prior sessions and memory, paged with `after`; `offset` is for relevance order only. Set `source` to `decision` to search only rows where the user answered a question. Every hit names its source. When nothing matches, the reply states the scope and how many sources are indexed.',
|
|
4958
5019
|
ctx_resume: "Example: `ctx_resume({})`. Required: none.\nReturns a summary of up to 2 KB for this session: the last task and user request, files changed, open errors, and search terms for ctx_search. A large row is shown as a pointer line instead of its full text; call `ctx_resume(seq: N)` with that line's number to read the full row. Call it with no `seq` to get the state block on demand. Use it after the conversation was compacted or resumed, before you repeat earlier work.",
|
|
4959
5020
|
ctx_stats: "Example: `ctx_stats({})`. Required: none.\nReports the bytes context-mode kept out of the chat: a text report (bars, per tool, per agent) and a Markdown table. Show the text block to the user unchanged, in a code block. Use it when the user asks what it saved.",
|
|
4960
|
-
ctx_doctor: "Example: `ctx_doctor({})`. Required: none.\nChecks this context-mode install and reports a table with one row per check: version, Node and node:sqlite, host config and hooks for this agent, MCP connection, project and worktree, database health, index contents, and hook timing. Each failed row names its cause
|
|
5021
|
+
ctx_doctor: "Example: `ctx_doctor({})`. Required: none.\nChecks this context-mode install and reports a table with one row per check: version, Node and node:sqlite, host config and hooks for this agent, MCP connection, project and worktree, database health, index contents, and hook timing. Each failed row names its cause, the fix and a docs link. Use it when the user asks whether context-mode works, or after a context-mode error. Run each Fix first, then call ctx_doctor again. If a FAIL stays, show the user the report file it names (it holds paths and environment details) and ask before you run the printed gh issue command.\n",
|
|
4961
5022
|
ctx_upgrade: "Example: `ctx_upgrade({})`. Required: none.\nUpdates context-mode to the latest release for this agent and rewrites only context-mode's own entries in the host config. User entries and user settings such as hook timeouts are kept, and old entries are erased. Returns a table of what changed and whether a restart is needed. Use it only when the user asks to update context-mode.",
|
|
4962
5023
|
ctx_purge: 'Example: `ctx_purge({source:"old-docs"})`. Required: one of session, source, project.\nDeletes stored data: one session, one indexed source, or everything stored for this project. This cannot be undone. Use it only when the user asks to forget or reset data.'
|
|
4963
5024
|
});
|