@cortexkit/opencode-magic-context 0.2.0 → 0.2.2
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 +41 -6
- package/dist/cli/config-paths.d.ts +9 -0
- package/dist/cli/config-paths.d.ts.map +1 -0
- package/dist/cli/index.d.ts +3 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/opencode-helpers.d.ts +19 -0
- package/dist/cli/opencode-helpers.d.ts.map +1 -0
- package/dist/cli/prompts.d.ts +12 -0
- package/dist/cli/prompts.d.ts.map +1 -0
- package/dist/cli/setup.d.ts +2 -0
- package/dist/cli/setup.d.ts.map +1 -0
- package/dist/cli.js +442 -0
- package/dist/config/schema/magic-context.d.ts +0 -14
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/features/magic-context/compartment-storage.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/queue.d.ts +0 -2
- package/dist/features/magic-context/dreamer/queue.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-cache.d.ts +8 -0
- package/dist/features/magic-context/memory/embedding-cache.d.ts.map +1 -0
- package/dist/features/magic-context/memory/embedding.d.ts.map +1 -1
- package/dist/features/magic-context/memory/index.d.ts +1 -0
- package/dist/features/magic-context/memory/index.d.ts.map +1 -1
- package/dist/features/magic-context/memory/storage-memory-fts.d.ts.map +1 -1
- package/dist/features/magic-context/memory/storage-memory.d.ts.map +1 -1
- package/dist/features/magic-context/message-index.d.ts +1 -0
- package/dist/features/magic-context/message-index.d.ts.map +1 -1
- package/dist/features/magic-context/scheduler.d.ts +1 -1
- package/dist/features/magic-context/scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
- package/dist/features/magic-context/storage-ops.d.ts +0 -1
- package/dist/features/magic-context/storage-ops.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/features/magic-context/storage.d.ts +1 -1
- package/dist/features/magic-context/storage.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts +1 -0
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-id-fallback.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-context-state.d.ts +1 -1
- package/dist/hooks/magic-context/transform-context-state.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +1 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/index.js +1206 -1052
- package/dist/plugin/dream-timer.d.ts +1 -1
- package/dist/plugin/dream-timer.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/shared/jsonc-parser.d.ts +0 -9
- package/dist/shared/jsonc-parser.d.ts.map +1 -1
- package/package.json +6 -2
- package/scripts/install.sh +35 -0
- package/dist/plugin/hooks/create-tag-content-resolver.d.ts +0 -7
- package/dist/plugin/hooks/create-tag-content-resolver.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -27,18 +27,35 @@
|
|
|
27
27
|
|
|
28
28
|
## Get Started
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
### Quick Setup (Recommended)
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
Run the interactive setup wizard — it detects your models, configures everything, and handles compatibility:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# macOS / Linux
|
|
36
|
+
curl -fsSL https://raw.githubusercontent.com/cortexkit/opencode-magic-context/master/scripts/install.sh | bash
|
|
37
|
+
|
|
38
|
+
# Windows (PowerShell)
|
|
39
|
+
irm https://raw.githubusercontent.com/cortexkit/opencode-magic-context/master/scripts/install.ps1 | iex
|
|
40
|
+
|
|
41
|
+
# Or run directly (any OS)
|
|
42
|
+
bunx @cortexkit/opencode-magic-context setup
|
|
43
|
+
npx @cortexkit/opencode-magic-context setup
|
|
36
44
|
```
|
|
37
45
|
|
|
38
|
-
|
|
46
|
+
The wizard will:
|
|
47
|
+
1. Check your OpenCode installation and available models
|
|
48
|
+
2. Add the plugin and disable built-in compaction
|
|
49
|
+
3. Help you pick models for historian, dreamer, and sidekick
|
|
50
|
+
4. Handle oh-my-opencode compatibility if needed
|
|
51
|
+
|
|
52
|
+
### Manual Setup
|
|
53
|
+
|
|
54
|
+
Add to your OpenCode config (`opencode.json` or `opencode.jsonc`):
|
|
39
55
|
|
|
40
56
|
```jsonc
|
|
41
57
|
{
|
|
58
|
+
"plugin": ["@cortexkit/opencode-magic-context"],
|
|
42
59
|
"compaction": {
|
|
43
60
|
"auto": false,
|
|
44
61
|
"prune": false
|
|
@@ -46,6 +63,8 @@ Magic Context conflicts with OpenCode's built-in compaction — the two cannot r
|
|
|
46
63
|
}
|
|
47
64
|
```
|
|
48
65
|
|
|
66
|
+
> **Why disable compaction?** Magic Context manages context itself — built-in compaction interferes with its cache-aware deferred operations and would cause duplicate compression.
|
|
67
|
+
|
|
49
68
|
Create `magic-context.jsonc` in your project root, `.opencode/`, or `~/.config/opencode/`:
|
|
50
69
|
|
|
51
70
|
```jsonc
|
|
@@ -63,6 +82,22 @@ Create `magic-context.jsonc` in your project root, `.opencode/`, or `~/.config/o
|
|
|
63
82
|
|
|
64
83
|
That's it. Everything else has sensible defaults. Project config merges on top of user-wide settings.
|
|
65
84
|
|
|
85
|
+
### Oh-My-OpenCode Users
|
|
86
|
+
|
|
87
|
+
If you use [oh-my-opencode](https://github.com/code-yeongyu/oh-my-opencode), disable the hooks that conflict with Magic Context in your `oh-my-opencode.json`:
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"disabled_hooks": [
|
|
92
|
+
"context-window-monitor",
|
|
93
|
+
"preemptive-compaction",
|
|
94
|
+
"anthropic-context-window-limit-recovery"
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The setup wizard handles this automatically if it detects an oh-my-opencode config.
|
|
100
|
+
|
|
66
101
|
---
|
|
67
102
|
|
|
68
103
|
## What is Magic Context?
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface ConfigPaths {
|
|
2
|
+
configDir: string;
|
|
3
|
+
opencodeConfig: string;
|
|
4
|
+
opencodeConfigFormat: "json" | "jsonc" | "none";
|
|
5
|
+
magicContextConfig: string;
|
|
6
|
+
omoConfig: string | null;
|
|
7
|
+
}
|
|
8
|
+
export declare function detectConfigPaths(): ConfigPaths;
|
|
9
|
+
//# sourceMappingURL=config-paths.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-paths.d.ts","sourceRoot":"","sources":["../../src/cli/config-paths.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,WAAW;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,oBAAoB,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAChD,kBAAkB,EAAE,MAAM,CAAC;IAC3B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AA+BD,wBAAgB,iBAAiB,IAAI,WAAW,CA2B/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare function isOpenCodeInstalled(): boolean;
|
|
2
|
+
export declare function getOpenCodeVersion(): string | null;
|
|
3
|
+
export declare function getAvailableModels(): string[];
|
|
4
|
+
/** Group models by provider for display */
|
|
5
|
+
export declare function groupModelsByProvider(models: string[]): Map<string, string[]>;
|
|
6
|
+
/** Get unique providers from model list */
|
|
7
|
+
export declare function getProviders(models: string[]): string[];
|
|
8
|
+
/** Filter models matching any of the given patterns */
|
|
9
|
+
export declare function filterModels(models: string[], patterns: string[]): string[];
|
|
10
|
+
/**
|
|
11
|
+
* Build a curated model selection list for a given role.
|
|
12
|
+
* Returns models ordered by recommendation priority.
|
|
13
|
+
*/
|
|
14
|
+
export declare function buildModelSelection(allModels: string[], role: "historian" | "dreamer" | "sidekick"): {
|
|
15
|
+
label: string;
|
|
16
|
+
value: string;
|
|
17
|
+
recommended?: boolean;
|
|
18
|
+
}[];
|
|
19
|
+
//# sourceMappingURL=opencode-helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opencode-helpers.d.ts","sourceRoot":"","sources":["../../src/cli/opencode-helpers.ts"],"names":[],"mappings":"AAEA,wBAAgB,mBAAmB,IAAI,OAAO,CAO7C;AAED,wBAAgB,kBAAkB,IAAI,MAAM,GAAG,IAAI,CAMlD;AAED,wBAAgB,kBAAkB,IAAI,MAAM,EAAE,CAU7C;AAED,2CAA2C;AAC3C,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAU7E;AAED,2CAA2C;AAC3C,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CASvD;AAED,uDAAuD;AACvD,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAE3E;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAC/B,SAAS,EAAE,MAAM,EAAE,EACnB,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,UAAU,GAC3C;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,CA0E3D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function closePrompts(): void;
|
|
2
|
+
export declare function confirm(message: string, defaultYes?: boolean): Promise<boolean>;
|
|
3
|
+
export declare function selectOne(message: string, options: {
|
|
4
|
+
label: string;
|
|
5
|
+
value: string;
|
|
6
|
+
recommended?: boolean;
|
|
7
|
+
}[]): Promise<string>;
|
|
8
|
+
export declare function selectMultiple(message: string, options: {
|
|
9
|
+
label: string;
|
|
10
|
+
value: string;
|
|
11
|
+
}[]): Promise<string[]>;
|
|
12
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/cli/prompts.ts"],"names":[],"mappings":"AAUA,wBAAgB,YAAY,IAAI,IAAI,CAEnC;AAED,wBAAsB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,UAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAKlF;AAED,wBAAsB,SAAS,CAC3B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,GACnE,OAAO,CAAC,MAAM,CAAC,CAmBjB;AAED,wBAAsB,cAAc,CAChC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAAE,GAC5C,OAAO,CAAC,MAAM,EAAE,CAAC,CAcnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../../src/cli/setup.ts"],"names":[],"mappings":"AAmJA,wBAAsB,QAAQ,IAAI,OAAO,CAAC,MAAM,CAAC,CA8KhD"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/cli/setup.ts
|
|
4
|
+
import { existsSync as existsSync2, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
5
|
+
import { dirname } from "node:path";
|
|
6
|
+
|
|
7
|
+
// src/cli/config-paths.ts
|
|
8
|
+
import { existsSync } from "node:fs";
|
|
9
|
+
import { homedir } from "node:os";
|
|
10
|
+
import { join } from "node:path";
|
|
11
|
+
function getConfigDir() {
|
|
12
|
+
const envDir = process.env.OPENCODE_CONFIG_DIR?.trim();
|
|
13
|
+
if (envDir)
|
|
14
|
+
return envDir;
|
|
15
|
+
switch (process.platform) {
|
|
16
|
+
case "win32": {
|
|
17
|
+
const appData = process.env.APPDATA || join(homedir(), "AppData", "Roaming");
|
|
18
|
+
return join(appData, "opencode");
|
|
19
|
+
}
|
|
20
|
+
case "darwin":
|
|
21
|
+
case "linux":
|
|
22
|
+
default: {
|
|
23
|
+
const xdgConfig = process.env.XDG_CONFIG_HOME || join(homedir(), ".config");
|
|
24
|
+
return join(xdgConfig, "opencode");
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function findOmoConfig(configDir) {
|
|
29
|
+
const locations = [
|
|
30
|
+
join(configDir, "oh-my-opencode.jsonc"),
|
|
31
|
+
join(configDir, "oh-my-opencode.json")
|
|
32
|
+
];
|
|
33
|
+
for (const loc of locations) {
|
|
34
|
+
if (existsSync(loc))
|
|
35
|
+
return loc;
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
function detectConfigPaths() {
|
|
40
|
+
const configDir = getConfigDir();
|
|
41
|
+
let opencodeConfig;
|
|
42
|
+
let opencodeConfigFormat;
|
|
43
|
+
const jsoncPath = join(configDir, "opencode.jsonc");
|
|
44
|
+
const jsonPath = join(configDir, "opencode.json");
|
|
45
|
+
if (existsSync(jsoncPath)) {
|
|
46
|
+
opencodeConfig = jsoncPath;
|
|
47
|
+
opencodeConfigFormat = "jsonc";
|
|
48
|
+
} else if (existsSync(jsonPath)) {
|
|
49
|
+
opencodeConfig = jsonPath;
|
|
50
|
+
opencodeConfigFormat = "json";
|
|
51
|
+
} else {
|
|
52
|
+
opencodeConfig = jsonPath;
|
|
53
|
+
opencodeConfigFormat = "none";
|
|
54
|
+
}
|
|
55
|
+
return {
|
|
56
|
+
configDir,
|
|
57
|
+
opencodeConfig,
|
|
58
|
+
opencodeConfigFormat,
|
|
59
|
+
magicContextConfig: join(configDir, "magic-context.jsonc"),
|
|
60
|
+
omoConfig: findOmoConfig(configDir)
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// src/cli/opencode-helpers.ts
|
|
65
|
+
import { execSync } from "node:child_process";
|
|
66
|
+
function isOpenCodeInstalled() {
|
|
67
|
+
try {
|
|
68
|
+
execSync("opencode --version", { stdio: "pipe" });
|
|
69
|
+
return true;
|
|
70
|
+
} catch {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function getOpenCodeVersion() {
|
|
75
|
+
try {
|
|
76
|
+
return execSync("opencode --version", { stdio: "pipe" }).toString().trim();
|
|
77
|
+
} catch {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function getAvailableModels() {
|
|
82
|
+
try {
|
|
83
|
+
const output = execSync("opencode models", { stdio: "pipe" }).toString().trim();
|
|
84
|
+
return output.split(`
|
|
85
|
+
`).map((l) => l.trim()).filter(Boolean);
|
|
86
|
+
} catch {
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function buildModelSelection(allModels, role) {
|
|
91
|
+
const result = [];
|
|
92
|
+
const added = new Set;
|
|
93
|
+
const addIfAvailable = (pattern, recommended = false) => {
|
|
94
|
+
const matches = allModels.filter((m) => m === pattern || m.endsWith(`/${pattern}`));
|
|
95
|
+
for (const m of matches) {
|
|
96
|
+
if (!added.has(m)) {
|
|
97
|
+
added.add(m);
|
|
98
|
+
result.push({
|
|
99
|
+
label: m,
|
|
100
|
+
value: m,
|
|
101
|
+
recommended: recommended && result.length === 0
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
if (role === "historian") {
|
|
107
|
+
addIfAvailable("claude-sonnet-4-6", true);
|
|
108
|
+
addIfAvailable("claude-sonnet-4-5");
|
|
109
|
+
addIfAvailable("gemini-3.1-pro");
|
|
110
|
+
addIfAvailable("gpt-5.4");
|
|
111
|
+
addIfAvailable("glm-5");
|
|
112
|
+
addIfAvailable("minimax-m2.7");
|
|
113
|
+
for (const m of allModels.filter((m2) => m2.startsWith("github-copilot/"))) {
|
|
114
|
+
if (!added.has(m)) {
|
|
115
|
+
added.add(m);
|
|
116
|
+
result.push({ label: `${m} (free with Copilot)`, value: m });
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
} else if (role === "dreamer") {
|
|
120
|
+
for (const m of allModels.filter((m2) => m2.startsWith("ollama/"))) {
|
|
121
|
+
if (!added.has(m)) {
|
|
122
|
+
added.add(m);
|
|
123
|
+
result.push({ label: `${m} (local)`, value: m, recommended: result.length === 0 });
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
addIfAvailable("claude-sonnet-4-6", result.length === 0);
|
|
127
|
+
addIfAvailable("gemini-3-flash");
|
|
128
|
+
addIfAvailable("glm-5");
|
|
129
|
+
addIfAvailable("minimax-m2.7");
|
|
130
|
+
addIfAvailable("gpt-5.4-mini");
|
|
131
|
+
for (const m of allModels.filter((m2) => m2.startsWith("github-copilot/"))) {
|
|
132
|
+
if (!added.has(m)) {
|
|
133
|
+
added.add(m);
|
|
134
|
+
result.push({ label: `${m} (free with Copilot)`, value: m });
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
} else if (role === "sidekick") {
|
|
138
|
+
for (const m of allModels.filter((m2) => m2.startsWith("cerebras/"))) {
|
|
139
|
+
if (!added.has(m)) {
|
|
140
|
+
added.add(m);
|
|
141
|
+
result.push({
|
|
142
|
+
label: `${m} (fastest)`,
|
|
143
|
+
value: m,
|
|
144
|
+
recommended: result.length === 0
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
addIfAvailable("gpt-5-nano");
|
|
149
|
+
addIfAvailable("gemini-3-flash");
|
|
150
|
+
addIfAvailable("gpt-5.4-mini");
|
|
151
|
+
}
|
|
152
|
+
return result;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
// src/cli/prompts.ts
|
|
156
|
+
import { createInterface } from "node:readline";
|
|
157
|
+
var rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
158
|
+
function ask(question) {
|
|
159
|
+
return new Promise((resolve) => {
|
|
160
|
+
rl.question(question, (answer) => resolve(answer.trim()));
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
function closePrompts() {
|
|
164
|
+
rl.close();
|
|
165
|
+
}
|
|
166
|
+
async function confirm(message, defaultYes = true) {
|
|
167
|
+
const hint = defaultYes ? "Y/n" : "y/N";
|
|
168
|
+
const answer = await ask(` ${message} [${hint}] `);
|
|
169
|
+
if (answer === "")
|
|
170
|
+
return defaultYes;
|
|
171
|
+
return answer.toLowerCase().startsWith("y");
|
|
172
|
+
}
|
|
173
|
+
async function selectOne(message, options) {
|
|
174
|
+
console.log(` ${message}`);
|
|
175
|
+
console.log("");
|
|
176
|
+
for (let i = 0;i < options.length; i++) {
|
|
177
|
+
const opt = options[i];
|
|
178
|
+
const rec = opt.recommended ? " (recommended)" : "";
|
|
179
|
+
const num = `${i + 1}`.padStart(3);
|
|
180
|
+
console.log(` ${num}) ${opt.label}${rec}`);
|
|
181
|
+
}
|
|
182
|
+
console.log("");
|
|
183
|
+
while (true) {
|
|
184
|
+
const answer = await ask(" Enter number: ");
|
|
185
|
+
const idx = Number.parseInt(answer, 10) - 1;
|
|
186
|
+
if (idx >= 0 && idx < options.length) {
|
|
187
|
+
return options[idx].value;
|
|
188
|
+
}
|
|
189
|
+
console.log(" Invalid selection, try again.");
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// src/cli/setup.ts
|
|
194
|
+
var PLUGIN_NAME = "@cortexkit/opencode-magic-context";
|
|
195
|
+
function printStep(step, total, message) {
|
|
196
|
+
console.log(` [${step}/${total}] ${message}`);
|
|
197
|
+
}
|
|
198
|
+
function printSuccess(message) {
|
|
199
|
+
console.log(` ✓ ${message}`);
|
|
200
|
+
}
|
|
201
|
+
function printWarning(message) {
|
|
202
|
+
console.log(` ⚠ ${message}`);
|
|
203
|
+
}
|
|
204
|
+
function printInfo(message) {
|
|
205
|
+
console.log(` → ${message}`);
|
|
206
|
+
}
|
|
207
|
+
function ensureDir(dir) {
|
|
208
|
+
if (!existsSync2(dir)) {
|
|
209
|
+
mkdirSync(dir, { recursive: true });
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function stripJsoncComments(text) {
|
|
213
|
+
return text.replace(/\/\/.*$/gm, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
214
|
+
}
|
|
215
|
+
function readJsonc(path) {
|
|
216
|
+
const content = readFileSync(path, "utf-8");
|
|
217
|
+
try {
|
|
218
|
+
return JSON.parse(stripJsoncComments(content));
|
|
219
|
+
} catch {
|
|
220
|
+
return {};
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
function writeJsonc(path, data) {
|
|
224
|
+
writeFileSync(path, JSON.stringify(data, null, 2) + `
|
|
225
|
+
`);
|
|
226
|
+
}
|
|
227
|
+
function addPluginToOpenCodeConfig(configPath, format) {
|
|
228
|
+
ensureDir(dirname(configPath));
|
|
229
|
+
if (format === "none") {
|
|
230
|
+
const config2 = {
|
|
231
|
+
plugin: [PLUGIN_NAME],
|
|
232
|
+
compaction: { auto: false, prune: false }
|
|
233
|
+
};
|
|
234
|
+
writeJsonc(configPath, config2);
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
const config = readJsonc(configPath);
|
|
238
|
+
const plugins = config.plugin ?? [];
|
|
239
|
+
const hasPlugin = plugins.some((p) => p === PLUGIN_NAME || p.startsWith(`${PLUGIN_NAME}@`));
|
|
240
|
+
if (!hasPlugin) {
|
|
241
|
+
plugins.push(PLUGIN_NAME);
|
|
242
|
+
config.plugin = plugins;
|
|
243
|
+
}
|
|
244
|
+
const compaction = config.compaction ?? {};
|
|
245
|
+
compaction.auto = false;
|
|
246
|
+
compaction.prune = false;
|
|
247
|
+
config.compaction = compaction;
|
|
248
|
+
writeJsonc(configPath, config);
|
|
249
|
+
}
|
|
250
|
+
function writeMagicContextConfig(configPath, options) {
|
|
251
|
+
const config = {};
|
|
252
|
+
if (options.historianModel) {
|
|
253
|
+
config.historian = { model: options.historianModel };
|
|
254
|
+
}
|
|
255
|
+
if (options.dreamerEnabled) {
|
|
256
|
+
const dreamer = { enabled: true };
|
|
257
|
+
if (options.dreamerModel) {
|
|
258
|
+
dreamer.model = options.dreamerModel;
|
|
259
|
+
}
|
|
260
|
+
config.dreamer = dreamer;
|
|
261
|
+
} else {
|
|
262
|
+
config.dreamer = { enabled: false };
|
|
263
|
+
}
|
|
264
|
+
if (options.sidekickEnabled) {
|
|
265
|
+
const sidekick = { enabled: true };
|
|
266
|
+
if (options.sidekickModel) {
|
|
267
|
+
sidekick.model = options.sidekickModel;
|
|
268
|
+
}
|
|
269
|
+
config.sidekick = sidekick;
|
|
270
|
+
}
|
|
271
|
+
writeJsonc(configPath, config);
|
|
272
|
+
}
|
|
273
|
+
function disableOmoHooks(omoConfigPath) {
|
|
274
|
+
const config = readJsonc(omoConfigPath);
|
|
275
|
+
const disabledHooks = config.disabled_hooks ?? [];
|
|
276
|
+
const hooksToDisable = [
|
|
277
|
+
"context-window-monitor",
|
|
278
|
+
"preemptive-compaction",
|
|
279
|
+
"anthropic-context-window-limit-recovery"
|
|
280
|
+
];
|
|
281
|
+
for (const hook of hooksToDisable) {
|
|
282
|
+
if (!disabledHooks.includes(hook)) {
|
|
283
|
+
disabledHooks.push(hook);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
config.disabled_hooks = disabledHooks;
|
|
287
|
+
writeJsonc(omoConfigPath, config);
|
|
288
|
+
}
|
|
289
|
+
async function runSetup() {
|
|
290
|
+
console.log("");
|
|
291
|
+
console.log(" ✨ Magic Context — Setup Wizard");
|
|
292
|
+
console.log(" ═══════════════════════════════");
|
|
293
|
+
console.log("");
|
|
294
|
+
const totalSteps = 8;
|
|
295
|
+
let step = 1;
|
|
296
|
+
printStep(step++, totalSteps, "Checking OpenCode installation...");
|
|
297
|
+
const installed = isOpenCodeInstalled();
|
|
298
|
+
if (!installed) {
|
|
299
|
+
printWarning("OpenCode not found on PATH.");
|
|
300
|
+
const shouldContinue = await confirm("Continue setup anyway?", false);
|
|
301
|
+
if (!shouldContinue) {
|
|
302
|
+
console.log("");
|
|
303
|
+
printInfo("Install OpenCode: https://opencode.ai");
|
|
304
|
+
console.log("");
|
|
305
|
+
closePrompts();
|
|
306
|
+
return 1;
|
|
307
|
+
}
|
|
308
|
+
} else {
|
|
309
|
+
const version = getOpenCodeVersion();
|
|
310
|
+
printSuccess(`OpenCode ${version ?? ""} detected`);
|
|
311
|
+
}
|
|
312
|
+
console.log("");
|
|
313
|
+
printStep(step++, totalSteps, "Fetching available models...");
|
|
314
|
+
const allModels = installed ? getAvailableModels() : [];
|
|
315
|
+
if (allModels.length > 0) {
|
|
316
|
+
printSuccess(`Found ${allModels.length} models`);
|
|
317
|
+
} else {
|
|
318
|
+
printWarning("No models found (OpenCode not installed or no providers configured)");
|
|
319
|
+
printInfo("You can configure models manually in magic-context.jsonc later");
|
|
320
|
+
}
|
|
321
|
+
console.log("");
|
|
322
|
+
const paths = detectConfigPaths();
|
|
323
|
+
printStep(step++, totalSteps, "Configuring OpenCode...");
|
|
324
|
+
addPluginToOpenCodeConfig(paths.opencodeConfig, paths.opencodeConfigFormat);
|
|
325
|
+
printSuccess(`Plugin added to ${paths.opencodeConfig}`);
|
|
326
|
+
printInfo("Disabled built-in compaction (auto=false, prune=false)");
|
|
327
|
+
printInfo("Magic Context handles context management — built-in compaction would interfere");
|
|
328
|
+
console.log("");
|
|
329
|
+
printStep(step++, totalSteps, "Configure historian (background context compressor)...");
|
|
330
|
+
console.log("");
|
|
331
|
+
let historianModel = null;
|
|
332
|
+
if (allModels.length > 0) {
|
|
333
|
+
const historianOptions = buildModelSelection(allModels, "historian");
|
|
334
|
+
if (historianOptions.length > 0) {
|
|
335
|
+
historianModel = await selectOne("Select a model for historian (compresses conversation history):", historianOptions);
|
|
336
|
+
printSuccess(`Historian model: ${historianModel}`);
|
|
337
|
+
} else {
|
|
338
|
+
printInfo("No suitable historian models found. Using built-in fallback chain.");
|
|
339
|
+
}
|
|
340
|
+
} else {
|
|
341
|
+
printInfo("Skipping model selection (no models available). Using built-in fallback chain.");
|
|
342
|
+
}
|
|
343
|
+
console.log("");
|
|
344
|
+
printStep(step++, totalSteps, "Configure dreamer (overnight memory maintenance)...");
|
|
345
|
+
console.log("");
|
|
346
|
+
printInfo("The dreamer runs overnight to consolidate, verify, and maintain project memories.");
|
|
347
|
+
const dreamerEnabled = await confirm("Enable dreamer?", true);
|
|
348
|
+
let dreamerModel = null;
|
|
349
|
+
if (dreamerEnabled && allModels.length > 0) {
|
|
350
|
+
const dreamerOptions = buildModelSelection(allModels, "dreamer");
|
|
351
|
+
if (dreamerOptions.length > 0) {
|
|
352
|
+
dreamerModel = await selectOne("Select a model for dreamer (runs in background, local LLMs ideal):", dreamerOptions);
|
|
353
|
+
printSuccess(`Dreamer model: ${dreamerModel}`);
|
|
354
|
+
} else {
|
|
355
|
+
printInfo("No suitable dreamer models found. Using built-in fallback chain.");
|
|
356
|
+
}
|
|
357
|
+
} else if (dreamerEnabled) {
|
|
358
|
+
printInfo("Using built-in fallback chain for dreamer.");
|
|
359
|
+
}
|
|
360
|
+
console.log("");
|
|
361
|
+
printStep(step++, totalSteps, "Configure sidekick (on-demand prompt augmentation)...");
|
|
362
|
+
console.log("");
|
|
363
|
+
printInfo("Sidekick augments prompts with project context via /ctx-aug command.");
|
|
364
|
+
const sidekickEnabled = await confirm("Enable sidekick?", false);
|
|
365
|
+
let sidekickModel = null;
|
|
366
|
+
if (sidekickEnabled && allModels.length > 0) {
|
|
367
|
+
const sidekickOptions = buildModelSelection(allModels, "sidekick");
|
|
368
|
+
if (sidekickOptions.length > 0) {
|
|
369
|
+
sidekickModel = await selectOne("Select a model for sidekick (fast models preferred):", sidekickOptions);
|
|
370
|
+
printSuccess(`Sidekick model: ${sidekickModel}`);
|
|
371
|
+
} else {
|
|
372
|
+
printInfo("No suitable sidekick models found. Using built-in fallback chain.");
|
|
373
|
+
}
|
|
374
|
+
} else if (sidekickEnabled) {
|
|
375
|
+
printInfo("Using built-in fallback chain for sidekick.");
|
|
376
|
+
}
|
|
377
|
+
console.log("");
|
|
378
|
+
writeMagicContextConfig(paths.magicContextConfig, {
|
|
379
|
+
historianModel,
|
|
380
|
+
dreamerEnabled,
|
|
381
|
+
dreamerModel,
|
|
382
|
+
sidekickEnabled,
|
|
383
|
+
sidekickModel
|
|
384
|
+
});
|
|
385
|
+
printSuccess(`Config written to ${paths.magicContextConfig}`);
|
|
386
|
+
console.log("");
|
|
387
|
+
printStep(step++, totalSteps, "Checking for oh-my-opencode...");
|
|
388
|
+
if (paths.omoConfig) {
|
|
389
|
+
printWarning(`Found oh-my-opencode config: ${paths.omoConfig}`);
|
|
390
|
+
printInfo("The following hooks may interfere with Magic Context:");
|
|
391
|
+
console.log(" • context-window-monitor");
|
|
392
|
+
console.log(" • preemptive-compaction");
|
|
393
|
+
console.log(" • anthropic-context-window-limit-recovery");
|
|
394
|
+
console.log("");
|
|
395
|
+
const shouldDisable = await confirm("Disable these hooks in oh-my-opencode?", true);
|
|
396
|
+
if (shouldDisable) {
|
|
397
|
+
disableOmoHooks(paths.omoConfig);
|
|
398
|
+
printSuccess("Hooks disabled in oh-my-opencode config");
|
|
399
|
+
} else {
|
|
400
|
+
printWarning("Skipped — you may experience context management conflicts");
|
|
401
|
+
}
|
|
402
|
+
} else {
|
|
403
|
+
printSuccess("No oh-my-opencode config found (no conflicts)");
|
|
404
|
+
}
|
|
405
|
+
console.log("");
|
|
406
|
+
console.log(" ═══════════════════════════════");
|
|
407
|
+
console.log(" ✨ Setup complete!");
|
|
408
|
+
console.log("");
|
|
409
|
+
console.log(" What was configured:");
|
|
410
|
+
console.log(` • Plugin: ${PLUGIN_NAME}`);
|
|
411
|
+
console.log(` • Compaction: disabled (Magic Context manages context)`);
|
|
412
|
+
if (historianModel)
|
|
413
|
+
console.log(` • Historian: ${historianModel}`);
|
|
414
|
+
if (dreamerEnabled)
|
|
415
|
+
console.log(` • Dreamer: enabled${dreamerModel ? ` (${dreamerModel})` : ""}`);
|
|
416
|
+
if (sidekickEnabled)
|
|
417
|
+
console.log(` • Sidekick: enabled${sidekickModel ? ` (${sidekickModel})` : ""}`);
|
|
418
|
+
console.log("");
|
|
419
|
+
console.log(" Run 'opencode' to start!");
|
|
420
|
+
console.log("");
|
|
421
|
+
closePrompts();
|
|
422
|
+
return 0;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// src/cli/index.ts
|
|
426
|
+
var command = process.argv[2];
|
|
427
|
+
if (command === "setup") {
|
|
428
|
+
runSetup().then((code) => process.exit(code));
|
|
429
|
+
} else {
|
|
430
|
+
console.log("");
|
|
431
|
+
console.log(" Magic Context CLI");
|
|
432
|
+
console.log(" ─────────────────");
|
|
433
|
+
console.log("");
|
|
434
|
+
console.log(" Commands:");
|
|
435
|
+
console.log(" setup Interactive setup wizard");
|
|
436
|
+
console.log("");
|
|
437
|
+
console.log(" Usage:");
|
|
438
|
+
console.log(" bunx @cortexkit/opencode-magic-context setup");
|
|
439
|
+
console.log(" npx @cortexkit/opencode-magic-context setup");
|
|
440
|
+
console.log("");
|
|
441
|
+
process.exit(command ? 1 : 0);
|
|
442
|
+
}
|
|
@@ -16,19 +16,6 @@ export declare const DreamingTaskSchema: z.ZodEnum<{
|
|
|
16
16
|
}>;
|
|
17
17
|
export type DreamingTask = z.infer<typeof DreamingTaskSchema>;
|
|
18
18
|
export declare const DEFAULT_DREAMER_TASKS: DreamingTask[];
|
|
19
|
-
export declare const DreamingConfigSchema: z.ZodDefault<z.ZodObject<{
|
|
20
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
21
|
-
schedule: z.ZodDefault<z.ZodString>;
|
|
22
|
-
max_runtime_minutes: z.ZodDefault<z.ZodNumber>;
|
|
23
|
-
tasks: z.ZodDefault<z.ZodArray<z.ZodEnum<{
|
|
24
|
-
consolidate: "consolidate";
|
|
25
|
-
verify: "verify";
|
|
26
|
-
"archive-stale": "archive-stale";
|
|
27
|
-
improve: "improve";
|
|
28
|
-
"maintain-docs": "maintain-docs";
|
|
29
|
-
}>>>;
|
|
30
|
-
task_timeout_minutes: z.ZodDefault<z.ZodNumber>;
|
|
31
|
-
}, z.core.$strip>>;
|
|
32
19
|
/** Combined dreamer agent + scheduling configuration */
|
|
33
20
|
export declare const DreamerConfigSchema: z.ZodObject<{
|
|
34
21
|
model: z.ZodOptional<z.ZodString>;
|
|
@@ -173,7 +160,6 @@ export declare const EmbeddingConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
173
160
|
api_key?: string | undefined;
|
|
174
161
|
}>>;
|
|
175
162
|
export type EmbeddingConfig = z.infer<typeof EmbeddingConfigSchema>;
|
|
176
|
-
export type DreamingConfig = z.infer<typeof DreamingConfigSchema>;
|
|
177
163
|
export interface MagicContextConfig {
|
|
178
164
|
enabled: boolean;
|
|
179
165
|
/** When false, ctx_reduce tool is not registered, all nudges are disabled,
|
|
@@ -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,CAA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;QAChC,YAAY,EAAE,OAAO,CAAC;QACtB,mCAAmC,EAAE,MAAM,CAAC;KAC/C,CAAC;IACF,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC7B;AAED,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4E/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compartment-storage.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/compartment-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"compartment-storage.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/compartment-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AA6B3C,MAAM,WAAW,WAAW;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,WAAW;IAC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EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAKxE;AAwCD,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAO/C;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAElD"}
|
|
@@ -22,6 +22,4 @@ export declare function resetDreamEntry(db: Database, id: number): void;
|
|
|
22
22
|
export declare function getEntryRetryCount(db: Database, id: number): number;
|
|
23
23
|
/** Clear stale started entries (stuck for more than maxAgeMs). */
|
|
24
24
|
export declare function clearStaleEntries(db: Database, maxAgeMs: number): number;
|
|
25
|
-
/** Get current queue size (unstarted entries only). */
|
|
26
|
-
export declare function getQueueSize(db: Database): number;
|
|
27
25
|
//# sourceMappingURL=queue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/queue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,iEAAiE;IACjE,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/queue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,iEAAiE;IACjE,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAexD;AAED,iHAAiH;AACjH,wBAAgB,YAAY,CACxB,EAAE,EAAE,QAAQ,EACZ,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,MAAM,GACf,eAAe,GAAG,IAAI,CAuBxB;AAED,4DAA4D;AAC5D,wBAAgB,SAAS,CAAC,EAAE,EAAE,QAAQ,GAAG,eAAe,GAAG,IAAI,CAgB9D;AAED,uGAAuG;AACvG,wBAAgB,WAAW,CAAC,EAAE,EAAE,QAAQ,GAAG,eAAe,GAAG,IAAI,CAahE;AAED,yDAAyD;AACzD,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAE/D;AAED,uGAAuG;AACvG,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAI9D;AAED,6CAA6C;AAC7C,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAOnE;AAED,kEAAkE;AAClE,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMxE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
export declare function getProjectEmbeddings(db: Database, projectPath: string): Map<number, Float32Array>;
|
|
3
|
+
export declare function peekProjectEmbeddings(projectPath: string): Map<number, Float32Array> | null;
|
|
4
|
+
export declare function invalidateProject(projectPath: string): void;
|
|
5
|
+
export declare function invalidateMemory(projectPath: string, memoryId: number): void;
|
|
6
|
+
export declare function resetEmbeddingCacheForTests(): void;
|
|
7
|
+
export declare function setEmbeddingCacheTtlForTests(ttlMs: number): void;
|
|
8
|
+
//# sourceMappingURL=embedding-cache.d.ts.map
|