@wolfx/opencode-magic-context 0.21.8-patch.6 → 0.21.8-patch.8

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.
@@ -42,7 +42,7 @@
42
42
  * - **historian / historian-editor / compressor**: `read` plus the
43
43
  * read-only AFT navigation tools `aft_outline` and `aft_zoom`.
44
44
  * The runner offloads large existing-state XML to a temp file
45
- * under `<project>/.opencode/magic-context/historian/` and the
45
+ * under `<project>/.magic-context/historian/` and the
46
46
  * prompt instructs the model to read that file. AFT navigation
47
47
  * is allowed so historian can verify a symbol or file structure
48
48
  * when writing accurate compartment summaries.
@@ -4,7 +4,7 @@
4
4
  * When the existing-state XML (prior compartments + facts + project memory)
5
5
  * exceeds {@link HISTORIAN_STATE_INLINE_THRESHOLD} characters, the historian
6
6
  * caller writes it to a temp file under the project-local historian dir
7
- * (`<project>/.opencode/magic-context/historian/`) and the prompt instructs
7
+ * (`<project>/.magic-context/historian/`) and the prompt instructs
8
8
  * the model to `Read this file first`. This avoids pushing 100K+ chars of
9
9
  * inline reference state through the model's input on long sessions, which
10
10
  * on some provider/model combinations (notably github-copilot/gpt-5.4 via
@@ -14,7 +14,7 @@
14
14
  * The state file lives INSIDE the project directory rather than under
15
15
  * `os.tmpdir()` because OpenCode's `external_directory` permission system
16
16
  * asks the user before letting the historian subagent's Read tool open any
17
- * file outside the project. Anchoring under `<project>/.opencode/` keeps
17
+ * file outside the project. Anchoring under `<project>/.magic-context/` keeps
18
18
  * the file inside the project boundary so historian runs never trigger a
19
19
  * permission prompt.
20
20
  *
@@ -33,9 +33,9 @@ export declare const HISTORIAN_STATE_INLINE_THRESHOLD = 30000;
33
33
  * writing fails (in which case the caller should fall back to inline).
34
34
  *
35
35
  * `directory` is the project directory; the helper writes under
36
- * `<directory>/.opencode/magic-context/historian/`. The dir is created
36
+ * `<directory>/.magic-context/historian/`. The dir is created
37
37
  * recursively on first write, so the call is safe on fresh projects that have
38
- * never had a `.opencode/` subtree.
38
+ * never had a `.magic-context/` subtree.
39
39
  */
40
40
  export declare function maybeWriteHistorianStateFile(sessionId: string, existingState: string, directory: string): string | undefined;
41
41
  /** Delete a previously written state file. Safe to call with undefined. */
package/dist/index.js CHANGED
@@ -15078,7 +15078,7 @@ function getMagicContextLogPath(harness = getHarness()) {
15078
15078
  return path2.join(getMagicContextTempDir(harness), "magic-context.log");
15079
15079
  }
15080
15080
  function getProjectMagicContextDir(directory) {
15081
- return path2.join(directory, ".opencode", "magic-context");
15081
+ return path2.join(directory, ".magic-context");
15082
15082
  }
15083
15083
  function getProjectMagicContextHistorianDir(directory) {
15084
15084
  return path2.join(getProjectMagicContextDir(directory), "historian");
@@ -47,21 +47,18 @@ export declare function getMagicContextHistorianDir(harness?: HarnessId): string
47
47
  /**
48
48
  * Project-local magic-context artifact directory.
49
49
  *
50
- * Layout: `<project-directory>/.opencode/magic-context/`
50
+ * Layout: `<project-directory>/.magic-context/`
51
51
  *
52
52
  * Used for artifacts that the historian/recomp pipeline writes during a run
53
53
  * and that the model is asked to read via its native Read tool. OpenCode's
54
54
  * `external_directory` permission system asks the user before reading any
55
55
  * file outside the project directory or its worktree, which interrupts every
56
56
  * historian run when artifacts live under `os.tmpdir()`. Writing under the
57
- * project's own `.opencode/` subtree falls inside the project boundary and
58
- * never triggers a permission prompt.
57
+ * project's own `.magic-context/` subtree falls inside the project boundary
58
+ * and never triggers a permission prompt.
59
59
  *
60
- * The `.opencode/` parent dir is OpenCode's own per-project convention (used
61
- * for project-local config, plans, dumps, plugin installs). Anchoring
62
- * magic-context artifacts under `.opencode/magic-context/` keeps them
63
- * co-located with related OpenCode metadata and makes them easy for users to
64
- * locate when debugging.
60
+ * Using a harness-agnostic name (`/.magic-context/` rather than
61
+ * `/.opencode/`) ensures the same path works for both OpenCode and Pi.
65
62
  *
66
63
  * Logger does NOT use this — log files stay in the per-harness tmp subtree
67
64
  * because they are written by the plugin process itself (no model-side Read
@@ -71,7 +68,7 @@ export declare function getProjectMagicContextDir(directory: string): string;
71
68
  /**
72
69
  * Project-local historian artifact directory.
73
70
  *
74
- * Layout: `<project-directory>/.opencode/magic-context/historian/`
71
+ * Layout: `<project-directory>/.magic-context/historian/`
75
72
  *
76
73
  * Used for:
77
74
  * - existing-state offload XMLs that long historian/recomp passes write
@@ -79,8 +76,9 @@ export declare function getProjectMagicContextDir(directory: string): string;
79
76
  * - validation-failure dump XMLs preserved for debugging
80
77
  *
81
78
  * Callers must `mkdirSync(dir, { recursive: true })` before writing — the
82
- * `.opencode/` parent may not exist on a fresh project, and write failures
83
- * here must degrade gracefully (e.g. historian falls back to inline state).
79
+ * `.magic-context/` parent may not exist on a fresh project, and write
80
+ * failures here must degrade gracefully (e.g. historian falls back to inline
81
+ * state).
84
82
  */
85
83
  export declare function getProjectMagicContextHistorianDir(directory: string): string;
86
84
  export declare function getOpenCodeStorageDir(): string;
@@ -1 +1 @@
1
- {"version":3,"file":"data-path.d.ts","sourceRoot":"","sources":["../../src/shared/data-path.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAEvD,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,SAAwB,GAAG,MAAM,CAEhF;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,SAAwB,GAAG,MAAM,CAEhF;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,GAAE,SAAwB,GAAG,MAAM,CAErF;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kCAAkC,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAElD;AAED;;;;;;GAMG;AACH,wBAAgB,uCAAuC,IAAI,MAAM,CAEhE;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C"}
1
+ {"version":3,"file":"data-path.d.ts","sourceRoot":"","sources":["../../src/shared/data-path.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAEvD,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,SAAwB,GAAG,MAAM,CAEhF;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,SAAwB,GAAG,MAAM,CAEhF;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,GAAE,SAAwB,GAAG,MAAM,CAErF;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kCAAkC,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAElD;AAED;;;;;;GAMG;AACH,wBAAgB,uCAAuC,IAAI,MAAM,CAEhE;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wolfx/opencode-magic-context",
3
- "version": "0.21.8-patch.6",
3
+ "version": "0.21.8-patch.8",
4
4
  "type": "module",
5
5
  "description": "OpenCode plugin for Magic Context — cross-session memory and context management",
6
6
  "main": "dist/index.js",
@@ -121,20 +121,19 @@ describe("data-path", () => {
121
121
  expect(shared).toContain("cortexkit");
122
122
  });
123
123
 
124
- test("getProjectMagicContextDir composes <project>/.opencode/magic-context", () => {
125
- // Project-local artifacts (historian state file, failure dumps) live
126
- // inside the project so OpenCode's external_directory permission system
127
- // treats them as project-internal. Without this, historian's Read tool
128
- // would trigger a permission prompt on every run when artifacts lived
129
- // under os.tmpdir().
124
+ test("getProjectMagicContextDir composes <project>/.magic-context", () => {
125
+ // Project-local artifacts live inside the project so OpenCode's
126
+ // external_directory permission system treats them as project-internal.
127
+ // Without this, historian's Read tool would trigger a permission prompt
128
+ // on every run when artifacts lived under os.tmpdir().
130
129
  expect(getProjectMagicContextDir("/Users/me/Work/proj")).toBe(
131
- path.join("/Users/me/Work/proj", ".opencode", "magic-context"),
130
+ path.join("/Users/me/Work/proj", ".magic-context"),
132
131
  );
133
132
  });
134
133
 
135
134
  test("getProjectMagicContextHistorianDir appends historian/", () => {
136
135
  expect(getProjectMagicContextHistorianDir("/Users/me/Work/proj")).toBe(
137
- path.join("/Users/me/Work/proj", ".opencode", "magic-context", "historian"),
136
+ path.join("/Users/me/Work/proj", ".magic-context", "historian"),
138
137
  );
139
138
  });
140
139
 
@@ -145,7 +144,7 @@ describe("data-path", () => {
145
144
  // project-local historian dir.
146
145
  process.env.XDG_DATA_HOME = "/tmp/custom-data";
147
146
  expect(getProjectMagicContextDir("/some/project")).toBe(
148
- path.join("/some/project", ".opencode", "magic-context"),
147
+ path.join("/some/project", ".magic-context"),
149
148
  );
150
149
  });
151
150
 
@@ -153,7 +152,7 @@ describe("data-path", () => {
153
152
  // path.join normalizes redundant separators so callers don't need to
154
153
  // worry about how the project directory was constructed.
155
154
  expect(getProjectMagicContextDir("/some/project/")).toBe(
156
- path.join("/some/project/", ".opencode", "magic-context"),
155
+ path.join("/some/project/", ".magic-context"),
157
156
  );
158
157
  });
159
158
  });
@@ -62,34 +62,31 @@ export function getMagicContextHistorianDir(harness: HarnessId = getHarness()):
62
62
  /**
63
63
  * Project-local magic-context artifact directory.
64
64
  *
65
- * Layout: `<project-directory>/.opencode/magic-context/`
65
+ * Layout: `<project-directory>/.magic-context/`
66
66
  *
67
67
  * Used for artifacts that the historian/recomp pipeline writes during a run
68
68
  * and that the model is asked to read via its native Read tool. OpenCode's
69
69
  * `external_directory` permission system asks the user before reading any
70
70
  * file outside the project directory or its worktree, which interrupts every
71
71
  * historian run when artifacts live under `os.tmpdir()`. Writing under the
72
- * project's own `.opencode/` subtree falls inside the project boundary and
73
- * never triggers a permission prompt.
72
+ * project's own `.magic-context/` subtree falls inside the project boundary
73
+ * and never triggers a permission prompt.
74
74
  *
75
- * The `.opencode/` parent dir is OpenCode's own per-project convention (used
76
- * for project-local config, plans, dumps, plugin installs). Anchoring
77
- * magic-context artifacts under `.opencode/magic-context/` keeps them
78
- * co-located with related OpenCode metadata and makes them easy for users to
79
- * locate when debugging.
75
+ * Using a harness-agnostic name (`/.magic-context/` rather than
76
+ * `/.opencode/`) ensures the same path works for both OpenCode and Pi.
80
77
  *
81
78
  * Logger does NOT use this — log files stay in the per-harness tmp subtree
82
79
  * because they are written by the plugin process itself (no model-side Read
83
80
  * tool call, no permission prompt) and span sessions/projects.
84
81
  */
85
82
  export function getProjectMagicContextDir(directory: string): string {
86
- return path.join(directory, ".opencode", "magic-context");
83
+ return path.join(directory, ".magic-context");
87
84
  }
88
85
 
89
86
  /**
90
87
  * Project-local historian artifact directory.
91
88
  *
92
- * Layout: `<project-directory>/.opencode/magic-context/historian/`
89
+ * Layout: `<project-directory>/.magic-context/historian/`
93
90
  *
94
91
  * Used for:
95
92
  * - existing-state offload XMLs that long historian/recomp passes write
@@ -97,8 +94,9 @@ export function getProjectMagicContextDir(directory: string): string {
97
94
  * - validation-failure dump XMLs preserved for debugging
98
95
  *
99
96
  * Callers must `mkdirSync(dir, { recursive: true })` before writing — the
100
- * `.opencode/` parent may not exist on a fresh project, and write failures
101
- * here must degrade gracefully (e.g. historian falls back to inline state).
97
+ * `.magic-context/` parent may not exist on a fresh project, and write
98
+ * failures here must degrade gracefully (e.g. historian falls back to inline
99
+ * state).
102
100
  */
103
101
  export function getProjectMagicContextHistorianDir(directory: string): string {
104
102
  return path.join(getProjectMagicContextDir(directory), "historian");