@cortexkit/opencode-magic-context 0.8.10 → 0.8.11
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 +1 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli.js +22 -8
- package/dist/index.js +17 -6
- package/dist/shared/models-dev-cache.d.ts.map +1 -1
- package/dist/shared/tui-config.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/shared/models-dev-cache.ts +22 -3
- package/src/shared/tui-config.ts +12 -5
package/README.md
CHANGED
|
@@ -333,7 +333,7 @@ On startup, Magic Context checks for common configuration problems — OpenCode'
|
|
|
333
333
|
A companion desktop app for browsing and managing Magic Context state outside of OpenCode.
|
|
334
334
|
|
|
335
335
|
<p align="center">
|
|
336
|
-
<a href="https://github.com/cortexkit/opencode-magic-context/releases/tag/dashboard-v0.2.
|
|
336
|
+
<a href="https://github.com/cortexkit/opencode-magic-context/releases/tag/dashboard-v0.2.6"><strong>⬇️ Download for macOS · Windows · Linux</strong></a></p>
|
|
337
337
|
|
|
338
338
|
**Features:**
|
|
339
339
|
- **Memory Browser** — search, filter, and edit project memories with category and project filtering
|
package/dist/cli/doctor.d.ts.map
CHANGED
|
@@ -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,
|
|
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"}
|
package/dist/cli.js
CHANGED
|
@@ -8393,15 +8393,20 @@ function ensureTuiPluginEntry() {
|
|
|
8393
8393
|
config = import_comment_json.parse(raw) ?? {};
|
|
8394
8394
|
}
|
|
8395
8395
|
const plugins = Array.isArray(config.plugin) ? config.plugin.filter((p) => typeof p === "string") : [];
|
|
8396
|
-
|
|
8397
|
-
|
|
8396
|
+
const existingIdx = plugins.findIndex((p) => p === PLUGIN_NAME || p.startsWith(`${PLUGIN_NAME}@`));
|
|
8397
|
+
if (existingIdx >= 0) {
|
|
8398
|
+
if (plugins[existingIdx] === PLUGIN_ENTRY) {
|
|
8399
|
+
return false;
|
|
8400
|
+
}
|
|
8401
|
+
plugins[existingIdx] = PLUGIN_ENTRY;
|
|
8402
|
+
} else {
|
|
8403
|
+
plugins.push(PLUGIN_ENTRY);
|
|
8398
8404
|
}
|
|
8399
|
-
plugins.push(PLUGIN_ENTRY);
|
|
8400
8405
|
config.plugin = plugins;
|
|
8401
8406
|
mkdirSync2(dirname2(configPath), { recursive: true });
|
|
8402
8407
|
writeFileSync2(configPath, `${import_comment_json.stringify(config, null, 2)}
|
|
8403
8408
|
`);
|
|
8404
|
-
log(`[magic-context]
|
|
8409
|
+
log(`[magic-context] updated TUI plugin entry in ${configPath}`);
|
|
8405
8410
|
return true;
|
|
8406
8411
|
} catch (error) {
|
|
8407
8412
|
log(`[magic-context] failed to update tui.json: ${error instanceof Error ? error.message : String(error)}`);
|
|
@@ -10158,13 +10163,22 @@ async function runDoctor(options = {}) {
|
|
|
10158
10163
|
const raw = readFileSync5(paths.opencodeConfig, "utf-8");
|
|
10159
10164
|
const config = import_comment_json3.parse(raw);
|
|
10160
10165
|
const plugins = Array.isArray(config?.plugin) ? config.plugin : [];
|
|
10161
|
-
const
|
|
10166
|
+
const pluginList = plugins.filter((p) => typeof p === "string");
|
|
10167
|
+
const existingIdx = pluginList.findIndex((p) => p === PLUGIN_NAME3 || p.startsWith(`${PLUGIN_NAME3}@`) || p.includes("opencode-magic-context"));
|
|
10162
10168
|
const configName = paths.opencodeConfigFormat === "jsonc" ? "opencode.jsonc" : "opencode.json";
|
|
10163
|
-
if (
|
|
10169
|
+
if (existingIdx >= 0 && pluginList[existingIdx] === PLUGIN_ENTRY_WITH_VERSION2) {
|
|
10164
10170
|
R2.success(`Plugin registered in ${configName}`);
|
|
10171
|
+
} else if (existingIdx >= 0) {
|
|
10172
|
+
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)}
|
|
10176
|
+
`);
|
|
10177
|
+
R2.success(`Upgraded plugin entry in ${configName}: ${oldEntry} → ${PLUGIN_ENTRY_WITH_VERSION2}`);
|
|
10178
|
+
fixed++;
|
|
10165
10179
|
} else {
|
|
10166
|
-
|
|
10167
|
-
config.plugin =
|
|
10180
|
+
pluginList.push(PLUGIN_ENTRY_WITH_VERSION2);
|
|
10181
|
+
config.plugin = pluginList;
|
|
10168
10182
|
writeFileSync4(paths.opencodeConfig, `${import_comment_json3.stringify(config, null, 2)}
|
|
10169
10183
|
`);
|
|
10170
10184
|
R2.success(`Added plugin to ${configName}`);
|
package/dist/index.js
CHANGED
|
@@ -16916,7 +16916,7 @@ function isThinkingPart(part) {
|
|
|
16916
16916
|
var encoder, TAG_PREFIX_REGEX;
|
|
16917
16917
|
var init_tag_content_primitives = __esm(() => {
|
|
16918
16918
|
encoder = new TextEncoder;
|
|
16919
|
-
TAG_PREFIX_REGEX =
|
|
16919
|
+
TAG_PREFIX_REGEX = /^(?:\u00A7\d+\u00A7\s*)+/;
|
|
16920
16920
|
});
|
|
16921
16921
|
|
|
16922
16922
|
// src/hooks/magic-context/tag-part-guards.ts
|
|
@@ -28223,15 +28223,20 @@ function ensureTuiPluginEntry() {
|
|
|
28223
28223
|
config2 = import_comment_json.parse(raw) ?? {};
|
|
28224
28224
|
}
|
|
28225
28225
|
const plugins = Array.isArray(config2.plugin) ? config2.plugin.filter((p) => typeof p === "string") : [];
|
|
28226
|
-
|
|
28227
|
-
|
|
28226
|
+
const existingIdx = plugins.findIndex((p) => p === PLUGIN_NAME || p.startsWith(`${PLUGIN_NAME}@`));
|
|
28227
|
+
if (existingIdx >= 0) {
|
|
28228
|
+
if (plugins[existingIdx] === PLUGIN_ENTRY) {
|
|
28229
|
+
return false;
|
|
28230
|
+
}
|
|
28231
|
+
plugins[existingIdx] = PLUGIN_ENTRY;
|
|
28232
|
+
} else {
|
|
28233
|
+
plugins.push(PLUGIN_ENTRY);
|
|
28228
28234
|
}
|
|
28229
|
-
plugins.push(PLUGIN_ENTRY);
|
|
28230
28235
|
config2.plugin = plugins;
|
|
28231
28236
|
mkdirSync5(dirname2(configPath), { recursive: true });
|
|
28232
28237
|
writeFileSync3(configPath, `${import_comment_json.stringify(config2, null, 2)}
|
|
28233
28238
|
`);
|
|
28234
|
-
log(`[magic-context]
|
|
28239
|
+
log(`[magic-context] updated TUI plugin entry in ${configPath}`);
|
|
28235
28240
|
return true;
|
|
28236
28241
|
} catch (error48) {
|
|
28237
28242
|
log(`[magic-context] failed to update tui.json: ${error48 instanceof Error ? error48.message : String(error48)}`);
|
|
@@ -30246,6 +30251,12 @@ function loadModelsDevLimits() {
|
|
|
30246
30251
|
const context = model?.limit?.context;
|
|
30247
30252
|
if (typeof context === "number" && context > 0) {
|
|
30248
30253
|
limits.set(`${providerId}/${modelId}`, context);
|
|
30254
|
+
const modes = model?.experimental?.modes;
|
|
30255
|
+
if (modes && typeof modes === "object") {
|
|
30256
|
+
for (const mode of Object.keys(modes)) {
|
|
30257
|
+
limits.set(`${providerId}/${modelId}-${mode}`, context);
|
|
30258
|
+
}
|
|
30259
|
+
}
|
|
30249
30260
|
}
|
|
30250
30261
|
}
|
|
30251
30262
|
}
|
|
@@ -30257,7 +30268,7 @@ function loadModelsDevLimits() {
|
|
|
30257
30268
|
const configPath = getOpencodeConfigPath();
|
|
30258
30269
|
if (configPath && existsSync5(configPath)) {
|
|
30259
30270
|
let raw = readFileSync4(configPath, "utf-8");
|
|
30260
|
-
raw = raw.replace(
|
|
30271
|
+
raw = raw.replace(/"(?:[^"\\]|\\.)*"|\/\/.*$/gm, (match) => match.startsWith('"') ? match : "");
|
|
30261
30272
|
const config2 = JSON.parse(raw);
|
|
30262
30273
|
if (config2.provider && typeof config2.provider === "object") {
|
|
30263
30274
|
for (const [providerId, provider2] of Object.entries(config2.provider)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models-dev-cache.d.ts","sourceRoot":"","sources":["../../src/shared/models-dev-cache.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"models-dev-cache.d.ts","sourceRoot":"","sources":["../../src/shared/models-dev-cache.ts"],"names":[],"mappings":"AA6IA;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAShG;AAED,8CAA8C;AAC9C,wBAAgB,mBAAmB,IAAI,IAAI,CAG1C"}
|
|
@@ -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,
|
|
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"}
|
package/package.json
CHANGED
|
@@ -60,7 +60,15 @@ function loadModelsDevLimits(): Map<string, number> {
|
|
|
60
60
|
const raw = readFileSync(modelsJsonPath, "utf-8");
|
|
61
61
|
const data = JSON.parse(raw) as Record<
|
|
62
62
|
string,
|
|
63
|
-
{
|
|
63
|
+
{
|
|
64
|
+
models?: Record<
|
|
65
|
+
string,
|
|
66
|
+
{
|
|
67
|
+
limit?: { context?: number };
|
|
68
|
+
experimental?: { modes?: Record<string, unknown> };
|
|
69
|
+
}
|
|
70
|
+
>;
|
|
71
|
+
}
|
|
64
72
|
>;
|
|
65
73
|
|
|
66
74
|
for (const [providerId, provider] of Object.entries(data)) {
|
|
@@ -69,6 +77,14 @@ function loadModelsDevLimits(): Map<string, number> {
|
|
|
69
77
|
const context = model?.limit?.context;
|
|
70
78
|
if (typeof context === "number" && context > 0) {
|
|
71
79
|
limits.set(`${providerId}/${modelId}`, context);
|
|
80
|
+
// OpenCode creates derived model IDs from experimental.modes
|
|
81
|
+
// e.g. gpt-5.4 + modes.fast → gpt-5.4-fast (inherits parent limit)
|
|
82
|
+
const modes = model?.experimental?.modes;
|
|
83
|
+
if (modes && typeof modes === "object") {
|
|
84
|
+
for (const mode of Object.keys(modes)) {
|
|
85
|
+
limits.set(`${providerId}/${modelId}-${mode}`, context);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
72
88
|
}
|
|
73
89
|
}
|
|
74
90
|
}
|
|
@@ -88,8 +104,11 @@ function loadModelsDevLimits(): Map<string, number> {
|
|
|
88
104
|
const configPath = getOpencodeConfigPath();
|
|
89
105
|
if (configPath && existsSync(configPath)) {
|
|
90
106
|
let raw = readFileSync(configPath, "utf-8");
|
|
91
|
-
// Strip JSONC
|
|
92
|
-
|
|
107
|
+
// Strip JSONC single-line comments while preserving // inside strings.
|
|
108
|
+
// Match strings first (to skip them), then match comments outside strings.
|
|
109
|
+
raw = raw.replace(/"(?:[^"\\]|\\.)*"|\/\/.*$/gm, (match) =>
|
|
110
|
+
match.startsWith('"') ? match : "",
|
|
111
|
+
);
|
|
93
112
|
const config = JSON.parse(raw) as {
|
|
94
113
|
provider?: Record<
|
|
95
114
|
string,
|
package/src/shared/tui-config.ts
CHANGED
|
@@ -40,16 +40,23 @@ export function ensureTuiPluginEntry(): boolean {
|
|
|
40
40
|
? config.plugin.filter((p): p is string => typeof p === "string")
|
|
41
41
|
: [];
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
const existingIdx = plugins.findIndex(
|
|
44
|
+
(p) => p === PLUGIN_NAME || p.startsWith(`${PLUGIN_NAME}@`),
|
|
45
|
+
);
|
|
46
|
+
if (existingIdx >= 0) {
|
|
47
|
+
if (plugins[existingIdx] === PLUGIN_ENTRY) {
|
|
48
|
+
return false; // Already @latest
|
|
49
|
+
}
|
|
50
|
+
// Upgrade pinned version to @latest
|
|
51
|
+
plugins[existingIdx] = PLUGIN_ENTRY;
|
|
52
|
+
} else {
|
|
53
|
+
plugins.push(PLUGIN_ENTRY);
|
|
45
54
|
}
|
|
46
|
-
|
|
47
|
-
plugins.push(PLUGIN_ENTRY);
|
|
48
55
|
config.plugin = plugins;
|
|
49
56
|
|
|
50
57
|
mkdirSync(dirname(configPath), { recursive: true });
|
|
51
58
|
writeFileSync(configPath, `${stringify(config, null, 2)}\n`);
|
|
52
|
-
log(`[magic-context]
|
|
59
|
+
log(`[magic-context] updated TUI plugin entry in ${configPath}`);
|
|
53
60
|
return true;
|
|
54
61
|
} catch (error) {
|
|
55
62
|
log(
|