@cortexkit/opencode-magic-context 0.8.12 → 0.8.13

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/README.md CHANGED
@@ -70,7 +70,7 @@ irm https://raw.githubusercontent.com/cortexkit/opencode-magic-context/master/sc
70
70
 
71
71
  **Or run directly (any OS):**
72
72
  ```bash
73
- bunx @cortexkit/opencode-magic-context@latest setup
73
+ bunx --bun @cortexkit/opencode-magic-context@latest setup
74
74
  ```
75
75
 
76
76
  The wizard will:
@@ -136,7 +136,7 @@ The setup wizard handles this automatically if it detects an oh-my-openagent or
136
136
  Already installed but something isn't working? Run the doctor to check and auto-fix configuration issues:
137
137
 
138
138
  ```bash
139
- bunx @cortexkit/opencode-magic-context@latest doctor
139
+ bunx --bun @cortexkit/opencode-magic-context@latest doctor
140
140
  ```
141
141
 
142
142
  Doctor checks for conflicts (compaction, DCP, OMO hooks), ensures the TUI sidebar is configured, verifies the plugin is registered, and checks the npm cache — fixing what it can automatically.
@@ -144,13 +144,13 @@ Doctor checks for conflicts (compaction, DCP, OMO hooks), ensures the TUI sideba
144
144
  Use `--force` to force-clear the plugin cache even when versions match (fixes broken transitive dependencies):
145
145
 
146
146
  ```bash
147
- bunx @cortexkit/opencode-magic-context@latest doctor --force
147
+ bunx --bun @cortexkit/opencode-magic-context@latest doctor --force
148
148
  ```
149
149
 
150
150
  Hit a real bug? Use `--issue` to collect environment, sanitized config, and the last 200 log lines into a ready-to-submit report. It can also open the issue directly via `gh` if you have it installed:
151
151
 
152
152
  ```bash
153
- bunx @cortexkit/opencode-magic-context@latest doctor --issue
153
+ bunx --bun @cortexkit/opencode-magic-context@latest doctor --issue
154
154
  ```
155
155
 
156
156
  ---
@@ -312,7 +312,7 @@ The TUI plugin is configured automatically by the setup wizard and the `doctor`
312
312
 
313
313
  ### Startup conflict detection
314
314
 
315
- On startup, Magic Context checks for common configuration problems — OpenCode's built-in compaction being enabled, DCP plugin being active alongside Magic Context, or conflicting oh-my-openagent hooks. When conflicts are detected, it warns the active session with a fix suggestion pointing to `bunx @cortexkit/opencode-magic-context@latest doctor`.
315
+ On startup, Magic Context checks for common configuration problems — OpenCode's built-in compaction being enabled, DCP plugin being active alongside Magic Context, or conflicting oh-my-openagent hooks. When conflicts are detected, it warns the active session with a fix suggestion pointing to `bunx --bun @cortexkit/opencode-magic-context@latest doctor`.
316
316
 
317
317
  ---
318
318
 
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AA4MA,wBAAsB,SAAS,CAC3B,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GACnD,OAAO,CAAC,MAAM,CAAC,CAuNjB"}
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AA4MA,wBAAsB,SAAS,CAC3B,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GACnD,OAAO,CAAC,MAAM,CAAC,CA8VjB"}
package/dist/cli.js CHANGED
@@ -8398,7 +8398,12 @@ function ensureTuiPluginEntry() {
8398
8398
  if (plugins[existingIdx] === PLUGIN_ENTRY) {
8399
8399
  return false;
8400
8400
  }
8401
- plugins[existingIdx] = PLUGIN_ENTRY;
8401
+ const existing = plugins[existingIdx];
8402
+ if (existing === PLUGIN_NAME) {
8403
+ plugins[existingIdx] = PLUGIN_ENTRY;
8404
+ } else {
8405
+ return false;
8406
+ }
8402
8407
  } else {
8403
8408
  plugins.push(PLUGIN_ENTRY);
8404
8409
  }
@@ -10158,6 +10163,32 @@ async function runDoctor(options = {}) {
10158
10163
  R2.warn(`No magic-context.jsonc found — using defaults`);
10159
10164
  R2.info(" Run 'setup' to create one with model recommendations");
10160
10165
  }
10166
+ if (existsSync6(paths.magicContextConfig)) {
10167
+ try {
10168
+ const mcRaw = readFileSync5(paths.magicContextConfig, "utf-8");
10169
+ const mcConfig = import_comment_json3.parse(mcRaw);
10170
+ let mcChanged = false;
10171
+ const experimental = mcConfig.experimental;
10172
+ if (experimental && "compaction_markers" in experimental) {
10173
+ if (!("compaction_markers" in mcConfig)) {
10174
+ mcConfig.compaction_markers = experimental.compaction_markers;
10175
+ }
10176
+ delete experimental.compaction_markers;
10177
+ mcChanged = true;
10178
+ if (Object.keys(experimental).length === 0) {
10179
+ delete mcConfig.experimental;
10180
+ }
10181
+ R2.success("Migrated experimental.compaction_markers → compaction_markers (now default: true)");
10182
+ fixed++;
10183
+ }
10184
+ if (mcChanged) {
10185
+ writeFileSync4(paths.magicContextConfig, `${import_comment_json3.stringify(mcConfig, null, 2)}
10186
+ `);
10187
+ }
10188
+ } catch {
10189
+ R2.warn("Could not migrate deprecated config keys in magic-context.jsonc");
10190
+ }
10191
+ }
10161
10192
  if (paths.opencodeConfigFormat !== "none") {
10162
10193
  try {
10163
10194
  const raw = readFileSync5(paths.opencodeConfig, "utf-8");
@@ -10170,12 +10201,17 @@ async function runDoctor(options = {}) {
10170
10201
  R2.success(`Plugin registered in ${configName}`);
10171
10202
  } else if (existingIdx >= 0) {
10172
10203
  const oldEntry = pluginList[existingIdx];
10173
- pluginList[existingIdx] = PLUGIN_ENTRY_WITH_VERSION2;
10174
- config.plugin = pluginList;
10175
- writeFileSync4(paths.opencodeConfig, `${import_comment_json3.stringify(config, null, 2)}
10204
+ const isPinned = oldEntry !== PLUGIN_NAME3 && oldEntry !== PLUGIN_ENTRY_WITH_VERSION2 && /^@cortexkit\/opencode-magic-context@\d/.test(oldEntry);
10205
+ if (isPinned && !options.force) {
10206
+ R2.warn(`Plugin pinned to ${oldEntry} in ${configName} — use 'doctor --force' to upgrade`);
10207
+ } else {
10208
+ pluginList[existingIdx] = PLUGIN_ENTRY_WITH_VERSION2;
10209
+ config.plugin = pluginList;
10210
+ writeFileSync4(paths.opencodeConfig, `${import_comment_json3.stringify(config, null, 2)}
10176
10211
  `);
10177
- R2.success(`Upgraded plugin entry in ${configName}: ${oldEntry} → ${PLUGIN_ENTRY_WITH_VERSION2}`);
10178
- fixed++;
10212
+ R2.success(`Upgraded plugin entry in ${configName}: ${oldEntry} → ${PLUGIN_ENTRY_WITH_VERSION2}`);
10213
+ fixed++;
10214
+ }
10179
10215
  } else {
10180
10216
  pluginList.push(PLUGIN_ENTRY_WITH_VERSION2);
10181
10217
  config.plugin = pluginList;
@@ -10211,12 +10247,35 @@ async function runDoctor(options = {}) {
10211
10247
  R2.success("Added TUI sidebar plugin to tui.json");
10212
10248
  R2.warn("Restart OpenCode to see the sidebar");
10213
10249
  fixed++;
10214
- } else {
10215
- if (existsSync6(paths.tuiConfig)) {
10250
+ } else if (existsSync6(paths.tuiConfig)) {
10251
+ try {
10252
+ const tuiRaw = readFileSync5(paths.tuiConfig, "utf-8");
10253
+ const tuiConfig = import_comment_json3.parse(tuiRaw);
10254
+ const tuiPlugins = Array.isArray(tuiConfig?.plugin) ? tuiConfig.plugin.filter((p) => typeof p === "string") : [];
10255
+ const tuiIdx = tuiPlugins.findIndex((p) => p === PLUGIN_NAME3 || p.startsWith(`${PLUGIN_NAME3}@`));
10256
+ if (tuiIdx >= 0) {
10257
+ const tuiEntry = tuiPlugins[tuiIdx];
10258
+ const tuiPinned = tuiEntry !== PLUGIN_NAME3 && tuiEntry !== PLUGIN_ENTRY_WITH_VERSION2 && /^@cortexkit\/opencode-magic-context@\d/.test(tuiEntry);
10259
+ if (tuiPinned && !options.force) {
10260
+ R2.warn(`TUI plugin pinned to ${tuiEntry} — use 'doctor --force' to upgrade`);
10261
+ } else if (tuiPinned && options.force) {
10262
+ tuiPlugins[tuiIdx] = PLUGIN_ENTRY_WITH_VERSION2;
10263
+ tuiConfig.plugin = tuiPlugins;
10264
+ writeFileSync4(paths.tuiConfig, `${import_comment_json3.stringify(tuiConfig, null, 2)}
10265
+ `);
10266
+ R2.success(`Upgraded TUI plugin: ${tuiEntry} → ${PLUGIN_ENTRY_WITH_VERSION2}`);
10267
+ fixed++;
10268
+ } else {
10269
+ R2.success("TUI sidebar plugin configured");
10270
+ }
10271
+ } else {
10272
+ R2.success("TUI sidebar plugin configured");
10273
+ }
10274
+ } catch {
10216
10275
  R2.success("TUI sidebar plugin configured");
10217
- } else {
10218
- R2.success("TUI sidebar plugin configured (tui.json created)");
10219
10276
  }
10277
+ } else {
10278
+ R2.success("TUI sidebar plugin configured (tui.json created)");
10220
10279
  }
10221
10280
  if (existsSync6(paths.magicContextConfig)) {
10222
10281
  try {
@@ -10247,6 +10306,49 @@ async function runDoctor(options = {}) {
10247
10306
  } else {
10248
10307
  R2.success("Plugin cache clean (no cached version found)");
10249
10308
  }
10309
+ {
10310
+ const ageWarnings = [];
10311
+ const npmrcPath = join9(homedir5(), ".npmrc");
10312
+ if (existsSync6(npmrcPath)) {
10313
+ try {
10314
+ const npmrc = readFileSync5(npmrcPath, "utf-8");
10315
+ for (const line of npmrc.split(`
10316
+ `)) {
10317
+ const trimmed = line.trim();
10318
+ if (trimmed.startsWith("#") || trimmed.startsWith(";"))
10319
+ continue;
10320
+ const [key] = trimmed.split("=").map((s) => s.trim());
10321
+ if (key === "min-release-age" || key === "before") {
10322
+ ageWarnings.push(`~/.npmrc has '${trimmed}'`);
10323
+ }
10324
+ }
10325
+ } catch {}
10326
+ }
10327
+ const bunfigPath = join9(homedir5(), ".bunfig.toml");
10328
+ if (existsSync6(bunfigPath)) {
10329
+ try {
10330
+ const bunfig = readFileSync5(bunfigPath, "utf-8");
10331
+ for (const line of bunfig.split(`
10332
+ `)) {
10333
+ const trimmed = line.trim();
10334
+ if (trimmed.startsWith("#"))
10335
+ continue;
10336
+ if (/minimumReleaseAge\s*=/.test(trimmed)) {
10337
+ ageWarnings.push(`~/.bunfig.toml has '${trimmed}'`);
10338
+ }
10339
+ }
10340
+ } catch {}
10341
+ }
10342
+ if (ageWarnings.length > 0) {
10343
+ R2.warn("Package manager min-release-age restriction detected — this can prevent OpenCode from installing the latest plugin version");
10344
+ for (const w of ageWarnings) {
10345
+ R2.info(` ${w}`);
10346
+ }
10347
+ R2.info(" If the plugin stays on an old version after doctor --force, this is the likely cause.");
10348
+ R2.info(" Workaround: temporarily remove the restriction, restart OpenCode, then re-enable it.");
10349
+ issues++;
10350
+ }
10351
+ }
10250
10352
  const logPath = join9(tmpdir3(), "magic-context.log");
10251
10353
  if (existsSync6(logPath)) {
10252
10354
  const logStat = statSync2(logPath);
@@ -10606,9 +10708,9 @@ if (command === "setup") {
10606
10708
  console.log(" doctor --issue Collect diagnostics and open a GitHub issue");
10607
10709
  console.log("");
10608
10710
  console.log(" Usage:");
10609
- console.log(" bunx @cortexkit/opencode-magic-context@latest setup");
10610
- console.log(" bunx @cortexkit/opencode-magic-context@latest doctor");
10611
- console.log(" bunx @cortexkit/opencode-magic-context@latest doctor --issue");
10711
+ console.log(" bunx --bun @cortexkit/opencode-magic-context@latest setup");
10712
+ console.log(" bunx --bun @cortexkit/opencode-magic-context@latest doctor");
10713
+ console.log(" bunx --bun @cortexkit/opencode-magic-context@latest doctor --issue");
10612
10714
  console.log("");
10613
10715
  process.exit(command ? 1 : 0);
10614
10716
  }
@@ -190,8 +190,8 @@ export interface MagicContextConfig {
190
190
  enabled: boolean;
191
191
  min_clusters: number;
192
192
  };
193
+ compaction_markers: boolean;
193
194
  experimental: {
194
- compaction_markers: boolean;
195
195
  user_memories: {
196
196
  enabled: boolean;
197
197
  promotion_threshold: number;
@@ -347,6 +347,7 @@ export declare const MagicContextConfigSchema: z.ZodPipe<z.ZodObject<{
347
347
  enabled: z.ZodDefault<z.ZodBoolean>;
348
348
  min_clusters: z.ZodDefault<z.ZodNumber>;
349
349
  }, z.core.$strip>>;
350
+ compaction_markers: z.ZodDefault<z.ZodBoolean>;
350
351
  embedding: z.ZodDefault<z.ZodPipe<z.ZodObject<{
351
352
  provider: z.ZodDefault<z.ZodEnum<{
352
353
  local: "local";
@@ -374,7 +375,6 @@ export declare const MagicContextConfigSchema: z.ZodPipe<z.ZodObject<{
374
375
  api_key?: string | undefined;
375
376
  }>>>;
376
377
  experimental: z.ZodDefault<z.ZodObject<{
377
- compaction_markers: z.ZodDefault<z.ZodBoolean>;
378
378
  user_memories: z.ZodDefault<z.ZodObject<{
379
379
  enabled: z.ZodDefault<z.ZodBoolean>;
380
380
  promotion_threshold: z.ZodDefault<z.ZodNumber>;
@@ -467,6 +467,7 @@ export declare const MagicContextConfigSchema: z.ZodPipe<z.ZodObject<{
467
467
  enabled: boolean;
468
468
  min_clusters: number;
469
469
  };
470
+ compaction_markers: boolean;
470
471
  embedding: {
471
472
  provider: "local";
472
473
  model: string;
@@ -480,7 +481,6 @@ export declare const MagicContextConfigSchema: z.ZodPipe<z.ZodObject<{
480
481
  model?: undefined;
481
482
  };
482
483
  experimental: {
483
- compaction_markers: boolean;
484
484
  user_memories: {
485
485
  enabled: boolean;
486
486
  promotion_threshold: number;
@@ -1 +1 @@
1
- {"version":3,"file":"magic-context.d.ts","sourceRoot":"","sources":["../../../src/config/schema/magic-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,eAAO,MAAM,6BAA6B,QAAS,CAAC;AACpD,eAAO,MAAM,oCAAoC,KAAK,CAAC;AACvD,eAAO,MAAM,gCAAgC,QAAS,CAAC;AACvD,eAAO,MAAM,4BAA4B,SAAU,CAAC;AACpD,eAAO,MAAM,iCAAiC,OAAO,CAAC;AACtD,eAAO,MAAM,6BAA6B,4BAA4B,CAAC;AAEvE,eAAO,MAAM,aAAa,iFAMhB,CAAC;AAEX,eAAO,MAAM,kBAAkB;;;;;;EAAwB,CAAC;AACxD,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE9D,eAAO,MAAM,qBAAqB,EAAE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QACtB,mCAAmC,EAAE,MAAM,CAAC;KAC/C,CAAC;IACF,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC7B;AAED,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0H/B,CAAC"}
@@ -6,7 +6,7 @@
6
6
  * the transform hook receives only post-boundary messages instead
7
7
  * of the full session history.
8
8
  *
9
- * Gated behind `experimental_compaction_markers` config flag.
9
+ * Gated behind the `compaction_markers` config flag (default: true).
10
10
  *
11
11
  * ## What gets injected (3 rows):
12
12
  * 1. A `compaction` part on the boundary user message
@@ -1 +1 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAItC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AA2C3D,UAAU,6BAA6B;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,6BAA6B,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAE9F;A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1B,wBAAwB,CAAC,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5E,uBAAuB,CAAC,EAAE,6BAA6B,CAAC;CAC3D,GAAG,OAAO,CAAC,cAAc,CAAC,CA+U1B;AA0LD,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC1C,EAAE,EAAE,QAAQ,CAAC;IACb,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wBAAwB,CAAC,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5E,uBAAuB,CAAC,EAAE,6BAA6B,CAAC;CAC3D,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAyDjC"}
@@ -17,7 +17,7 @@ export declare function parseKeyFilesOutput(text: string): Array<{
17
17
  * Get candidate files for key-file analysis from OpenCode's DB.
18
18
  * Returns files with full reads >= minReads and size under half the budget.
19
19
  */
20
- export declare function getKeyFileCandidates(openCodeDb: Database, sessionId: string, minReads: number, tokenBudget: number): FileReadStat[];
20
+ export declare function getKeyFileCandidates(openCodeDb: Database, sessionId: string, minReads: number, tokenBudget: number, projectDirectory?: string): FileReadStat[];
21
21
  /**
22
22
  * Apply LLM-ranked results through the knapsack solver and persist.
23
23
  */
@@ -1 +1 @@
1
- {"version":3,"file":"identify-key-files.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/key-files/identify-key-files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,KAAK,YAAY,EAAuB,MAAM,cAAc,CAAC;AAGtE,eAAO,MAAM,uBAAuB,yLACsJ,CAAC;AAE3L;;;GAGG;AACH,wBAAgB,mBAAmB,CAC/B,UAAU,EAAE,YAAY,EAAE,EAC1B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GACjB,MAAM,CAqCR;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAqB7F;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAChC,UAAU,EAAE,QAAQ,EACpB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,GACpB,YAAY,EAAE,CAIhB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAC/B,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,EACtD,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAC7B;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAelD;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACrC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,YAAY,EAAE,EAC1B,WAAW,EAAE,MAAM,GACpB;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAmBlD"}
1
+ {"version":3,"file":"identify-key-files.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/key-files/identify-key-files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAE,KAAK,YAAY,EAAuB,MAAM,cAAc,CAAC;AAGtE,eAAO,MAAM,uBAAuB,yLACsJ,CAAC;AAE3L;;;GAGG;AACH,wBAAgB,mBAAmB,CAC/B,UAAU,EAAE,YAAY,EAAE,EAC1B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GACjB,MAAM,CAqCR;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAqB7F;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAChC,UAAU,EAAE,QAAQ,EACpB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,gBAAgB,CAAC,EAAE,MAAM,GAC1B,YAAY,EAAE,CAYhB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAC/B,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,EACtD,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAC7B;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAelD;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACrC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,YAAY,EAAE,EAC1B,WAAW,EAAE,MAAM,GACpB;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAmBlD"}
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Coordinates compaction marker injection/update/removal with historian
5
5
  * publication. Called after compartments are published, behind the
6
- * `experimental_compaction_markers` config flag.
6
+ * `compaction_markers` config flag (default: true).
7
7
  *
8
8
  * The marker summary text is a static placeholder — the real <session-history>
9
9
  * is injected by the transform pipeline via inject-compartments.ts. The marker
@@ -40,8 +40,8 @@ export interface MagicContextDeps {
40
40
  enabled: boolean;
41
41
  min_clusters: number;
42
42
  };
43
+ compaction_markers?: boolean;
43
44
  experimental?: {
44
- compaction_markers?: boolean;
45
45
  user_memories?: {
46
46
  enabled: boolean;
47
47
  promotion_threshold: number;
@@ -1 +1 @@
1
- {"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/hook.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,KAAK,aAAa,EAClB,KAAK,cAAc,EACtB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAOvF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AAMxE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAElE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAWxD,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAUnF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAQ7D,MAAM,WAAW,gBAAgB;IAC7B,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,SAAS,CAAC;IACrB,yBAAyB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,iBAAiB,EAAE,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;IAC9D,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,MAAM,EAAE;QACJ,cAAc,EAAE,MAAM,CAAC;QACvB,kBAAkB,CAAC,EAAE,OAAO,CAAC;QAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAC;QAC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UAAU,CAAC,EAAE,OAAO,CAAA;SAAE,CAAA;KAAE;;;SAa7E"}
package/dist/index.js CHANGED
@@ -14163,12 +14163,12 @@ var init_magic_context = __esm(() => {
14163
14163
  enabled: exports_external.boolean().default(true),
14164
14164
  min_clusters: exports_external.number().min(1).default(3)
14165
14165
  }).default({ enabled: true, min_clusters: 3 }),
14166
+ compaction_markers: exports_external.boolean().default(true),
14166
14167
  embedding: EmbeddingConfigSchema.default({
14167
14168
  provider: "local",
14168
14169
  model: DEFAULT_LOCAL_EMBEDDING_MODEL
14169
14170
  }),
14170
14171
  experimental: exports_external.object({
14171
- compaction_markers: exports_external.boolean().default(false),
14172
14172
  user_memories: exports_external.object({
14173
14173
  enabled: exports_external.boolean().default(false),
14174
14174
  promotion_threshold: exports_external.number().min(2).max(20).default(3)
@@ -14179,7 +14179,6 @@ var init_magic_context = __esm(() => {
14179
14179
  min_reads: exports_external.number().min(2).max(20).default(4)
14180
14180
  }).default({ enabled: false, token_budget: 1e4, min_reads: 4 })
14181
14181
  }).default({
14182
- compaction_markers: false,
14183
14182
  user_memories: { enabled: false, promotion_threshold: 3 },
14184
14183
  pin_key_files: { enabled: false, token_budget: 1e4, min_reads: 4 }
14185
14184
  }),
@@ -15072,7 +15071,7 @@ function formatConflictShort(result) {
15072
15071
  "",
15073
15072
  ...result.reasons.map((r) => `\u2022 ${r}`),
15074
15073
  "",
15075
- "Fix: run `bunx @cortexkit/opencode-magic-context@latest doctor`"
15074
+ "Fix: run `bunx --bun @cortexkit/opencode-magic-context@latest doctor`"
15076
15075
  ];
15077
15076
  return lines.join(`
15078
15077
  `);
@@ -28228,7 +28227,12 @@ function ensureTuiPluginEntry() {
28228
28227
  if (plugins[existingIdx] === PLUGIN_ENTRY) {
28229
28228
  return false;
28230
28229
  }
28231
- plugins[existingIdx] = PLUGIN_ENTRY;
28230
+ const existing = plugins[existingIdx];
28231
+ if (existing === PLUGIN_NAME) {
28232
+ plugins[existingIdx] = PLUGIN_ENTRY;
28233
+ } else {
28234
+ return false;
28235
+ }
28232
28236
  } else {
28233
28237
  plugins.push(PLUGIN_ENTRY);
28234
28238
  }
@@ -29177,10 +29181,11 @@ function parseKeyFilesOutput(text) {
29177
29181
  return [];
29178
29182
  }
29179
29183
  }
29180
- function getKeyFileCandidates(openCodeDb, sessionId, minReads, tokenBudget) {
29184
+ function getKeyFileCandidates(openCodeDb, sessionId, minReads, tokenBudget, projectDirectory) {
29181
29185
  const stats = getSessionReadStats(openCodeDb, sessionId, minReads);
29182
29186
  const maxPerFileTokens = Math.min(tokenBudget / 2, 5000);
29183
- return stats.filter((s) => s.latestReadTokens > 0 && s.latestReadTokens <= maxPerFileTokens);
29187
+ const projectPrefix = projectDirectory ? projectDirectory.replace(/\/$/, "") + "/" : undefined;
29188
+ return stats.filter((s) => s.latestReadTokens > 0 && s.latestReadTokens <= maxPerFileTokens && (!projectPrefix || s.filePath.startsWith(projectPrefix)));
29184
29189
  }
29185
29190
  function applyKeyFileResults(db, sessionId, llmRanked, tokenBudget, candidatePaths) {
29186
29191
  const filtered = candidatePaths ? llmRanked.filter((f) => candidatePaths.has(f.filePath)) : llmRanked;
@@ -29438,7 +29443,8 @@ async function getActiveProjectSessionIds(args) {
29438
29443
  try {
29439
29444
  const { withReadOnlySessionDb: withReadOnlySessionDb2 } = await Promise.resolve().then(() => (init_read_session_db(), exports_read_session_db));
29440
29445
  const projectSessionIds = withReadOnlySessionDb2((openCodeDb) => {
29441
- const rows = openCodeDb.prepare("SELECT id FROM session WHERE project_id = ? AND parent_id IS NULL ORDER BY time_updated DESC").all(args.projectIdentity);
29446
+ const bareIdentity = args.projectIdentity.replace(/^git:/, "");
29447
+ const rows = openCodeDb.prepare("SELECT id FROM session WHERE project_id = ? AND parent_id IS NULL ORDER BY time_updated DESC").all(bareIdentity);
29442
29448
  return new Set(rows.map((r) => r.id));
29443
29449
  });
29444
29450
  if (projectSessionIds.size === 0) {
@@ -29467,7 +29473,7 @@ async function identifyKeyFilesForSession(args) {
29467
29473
  if (!openCodeDb) {
29468
29474
  return;
29469
29475
  }
29470
- const candidates = getKeyFileCandidates(openCodeDb, args.sessionId, args.config.min_reads, args.config.token_budget);
29476
+ const candidates = getKeyFileCandidates(openCodeDb, args.sessionId, args.config.min_reads, args.config.token_budget, args.sessionDirectory);
29471
29477
  if (candidates.length === 0) {
29472
29478
  log(`[key-files][${args.sessionId}] no candidates found \u2014 skipping`);
29473
29479
  return;
@@ -34376,7 +34382,7 @@ function createMagicContextHook(deps) {
34376
34382
  return model ? `${model.providerID}/${model.modelID}` : undefined;
34377
34383
  },
34378
34384
  projectPath,
34379
- experimentalCompactionMarkers: deps.config.experimental?.compaction_markers,
34385
+ experimentalCompactionMarkers: deps.config.compaction_markers,
34380
34386
  experimentalUserMemories: deps.config.experimental?.user_memories?.enabled,
34381
34387
  liveModelBySession
34382
34388
  });
@@ -1 +1 @@
1
- {"version":3,"file":"create-session-hooks.d.ts","sourceRoot":"","sources":["../../../src/plugin/hooks/create-session-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAU7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,aAAa,CAAC;IACnB,YAAY,EAAE,wBAAwB,CAAC;IACvC,gBAAgB,EAAE,gBAAgB,CAAC;CACtC;;;;;;qBA8CgrB,CAAC;;;;;;;;;;;;qBAR/pB,CAAC;mBAAiB,CAAC;iBACtB,CAAP;;;;;0BAOo0a,CAAC;;;;;;EAD70a"}
1
+ {"version":3,"file":"create-session-hooks.d.ts","sourceRoot":"","sources":["../../../src/plugin/hooks/create-session-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAU7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,aAAa,CAAC;IACnB,YAAY,EAAE,wBAAwB,CAAC;IACvC,gBAAgB,EAAE,gBAAgB,CAAC;CACtC;;;;;;qBA8CgrB,CAAC;;;;;;;;;;;;qBAR/pB,CAAC;mBAAiB,CAAC;iBACtB,CAAP;;;;;0BAOkza,CAAC;;;;;;EAD3za"}
@@ -1 +1 @@
1
- {"version":3,"file":"tui-config.d.ts","sourceRoot":"","sources":["../../src/shared/tui-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqBH;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAsC9C"}
1
+ {"version":3,"file":"tui-config.d.ts","sourceRoot":"","sources":["../../src/shared/tui-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAqBH;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CA4C9C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/opencode-magic-context",
3
- "version": "0.8.12",
3
+ "version": "0.8.13",
4
4
  "type": "module",
5
5
  "description": "OpenCode plugin for Magic Context — cross-session memory and context management",
6
6
  "main": "dist/index.js",
@@ -288,7 +288,7 @@ export function formatConflictShort(result: ConflictResult): string {
288
288
  "",
289
289
  ...result.reasons.map((r) => `• ${r}`),
290
290
  "",
291
- "Fix: run `bunx @cortexkit/opencode-magic-context@latest doctor`",
291
+ "Fix: run `bunx --bun @cortexkit/opencode-magic-context@latest doctor`",
292
292
  ];
293
293
  return lines.join("\n");
294
294
  }
@@ -47,8 +47,14 @@ export function ensureTuiPluginEntry(): boolean {
47
47
  if (plugins[existingIdx] === PLUGIN_ENTRY) {
48
48
  return false; // Already @latest
49
49
  }
50
- // Upgrade pinned version to @latest
51
- plugins[existingIdx] = PLUGIN_ENTRY;
50
+ // Only upgrade versionless entries (bare package name) to @latest.
51
+ // Pinned versions (e.g. @0.8.10) are left as-is — user chose them intentionally.
52
+ const existing = plugins[existingIdx];
53
+ if (existing === PLUGIN_NAME) {
54
+ plugins[existingIdx] = PLUGIN_ENTRY;
55
+ } else {
56
+ return false; // Pinned version — don't touch
57
+ }
52
58
  } else {
53
59
  plugins.push(PLUGIN_ENTRY);
54
60
  }
package/src/tui/index.tsx CHANGED
@@ -103,7 +103,7 @@ function showConflictDialog(api: TuiPluginApi, directory: string, reasons: strin
103
103
  }, 50)
104
104
  }}
105
105
  onCancel={() => {
106
- api.ui.toast({ message: "Magic Context remains disabled. Run: bunx @cortexkit/opencode-magic-context@latest doctor", variant: "warning", duration: 5000 })
106
+ api.ui.toast({ message: "Magic Context remains disabled. Run: bunx --bun @cortexkit/opencode-magic-context@latest doctor", variant: "warning", duration: 5000 })
107
107
  }}
108
108
  />
109
109
  ))
@@ -152,7 +152,7 @@ function showTuiSetupDialog(api: TuiPluginApi) {
152
152
  }, 50)
153
153
  }}
154
154
  onCancel={() => {
155
- api.ui.toast({ message: "You can add the sidebar later via: bunx @cortexkit/opencode-magic-context@latest doctor", variant: "info", duration: 5000 })
155
+ api.ui.toast({ message: "You can add the sidebar later via: bunx --bun @cortexkit/opencode-magic-context@latest doctor", variant: "info", duration: 5000 })
156
156
  }}
157
157
  />
158
158
  ))