opencode-codex-memory 0.4.5 → 0.4.6
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 +3 -3
- package/dist/src/llm.js +17 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -52,7 +52,7 @@ If you want the mental model before the details, jump to
|
|
|
52
52
|
|
|
53
53
|
```json
|
|
54
54
|
{
|
|
55
|
-
"plugin": ["opencode-codex-memory@0.4.
|
|
55
|
+
"plugin": ["opencode-codex-memory@0.4.6"]
|
|
56
56
|
}
|
|
57
57
|
```
|
|
58
58
|
|
|
@@ -239,7 +239,7 @@ To set options, turn the plugin entry into a `[name, options]` pair:
|
|
|
239
239
|
```json
|
|
240
240
|
{
|
|
241
241
|
"plugin": [
|
|
242
|
-
["opencode-codex-memory@0.4.
|
|
242
|
+
["opencode-codex-memory@0.4.6", { "disable_on_external_context": true, "min_rollout_idle_hours": 2 }]
|
|
243
243
|
]
|
|
244
244
|
}
|
|
245
245
|
```
|
|
@@ -298,7 +298,7 @@ directions:
|
|
|
298
298
|
```json
|
|
299
299
|
{
|
|
300
300
|
"plugin": [
|
|
301
|
-
["opencode-codex-memory@0.4.
|
|
301
|
+
["opencode-codex-memory@0.4.6", { "codex_interop": { "import": true, "export": true } }]
|
|
302
302
|
]
|
|
303
303
|
}
|
|
304
304
|
```
|
package/dist/src/llm.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
|
+
import { memoryRoot } from "./paths.js";
|
|
3
4
|
let inputRef = null;
|
|
4
5
|
export function setPluginInput(input) {
|
|
5
6
|
inputRef = input;
|
|
@@ -20,11 +21,27 @@ const SUBSESSION_DELETE_TIMEOUT_MS = 10_000;
|
|
|
20
21
|
export function isMemorySubSession(sessionId) {
|
|
21
22
|
return activeSubSessions.has(sessionId);
|
|
22
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Host directory for memory sub-sessions. Must exist: OpenCode resolves it in
|
|
26
|
+
* SystemPrompt.environment and fails the turn with UnknownError/ENOENT when
|
|
27
|
+
* missing. Prefer the memory workspace itself — global, always ours, already
|
|
28
|
+
* granted to `memorize` via external_directory, and independent of whatever
|
|
29
|
+
* (possibly deleted) project PluginInput.directory points at.
|
|
30
|
+
*/
|
|
31
|
+
function resolveSubSessionDirectory() {
|
|
32
|
+
const root = memoryRoot();
|
|
33
|
+
fs.mkdirSync(root, { recursive: true });
|
|
34
|
+
return root;
|
|
35
|
+
}
|
|
23
36
|
async function createSession(agent, title) {
|
|
24
37
|
const input = getPluginInput();
|
|
25
38
|
if (!input)
|
|
26
39
|
throw new Error("plugin input not initialized");
|
|
40
|
+
const directory = resolveSubSessionDirectory();
|
|
27
41
|
const res = await input.client.session.create({
|
|
42
|
+
// directory is a query param (not body); without it the client inherits
|
|
43
|
+
// PluginInput.directory, which may be a deleted project path.
|
|
44
|
+
query: { directory },
|
|
28
45
|
body: {
|
|
29
46
|
title: title ?? `codex-memory-${agent}`,
|
|
30
47
|
metadata: { [SUBSESSION_METADATA_KEY]: true },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-codex-memory",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.6",
|
|
4
4
|
"description": "Persistent memory plugin for opencode — ports codex's two-phase memory system (extraction → consolidation → injection → citation feedback)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/src/index.js",
|