@cortexkit/opencode-magic-context 0.22.3 → 0.22.4

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.
Files changed (34) hide show
  1. package/dist/config/schema/magic-context.d.ts +7 -0
  2. package/dist/config/schema/magic-context.d.ts.map +1 -1
  3. package/dist/features/magic-context/dreamer/runner.d.ts.map +1 -1
  4. package/dist/features/magic-context/key-files/aft-availability.d.ts.map +1 -1
  5. package/dist/features/magic-context/key-files/identify-key-files.d.ts.map +1 -1
  6. package/dist/features/magic-context/memory/memory-migration.d.ts.map +1 -1
  7. package/dist/features/magic-context/migrations.d.ts.map +1 -1
  8. package/dist/features/magic-context/sidekick/agent.d.ts.map +1 -1
  9. package/dist/features/magic-context/storage-db.d.ts +1 -1
  10. package/dist/features/magic-context/storage-db.d.ts.map +1 -1
  11. package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
  12. package/dist/features/magic-context/storage-meta-shared.d.ts +7 -1
  13. package/dist/features/magic-context/storage-meta-shared.d.ts.map +1 -1
  14. package/dist/features/magic-context/tool-definition-tokens.d.ts +21 -0
  15. package/dist/features/magic-context/tool-definition-tokens.d.ts.map +1 -1
  16. package/dist/features/magic-context/types.d.ts +4 -0
  17. package/dist/features/magic-context/types.d.ts.map +1 -1
  18. package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
  19. package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
  20. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  21. package/dist/hooks/magic-context/inject-compartments.d.ts +41 -0
  22. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
  23. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +2 -1
  24. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  25. package/dist/hooks/magic-context/transform.d.ts +8 -0
  26. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +268 -72
  29. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  30. package/dist/shared/keep-subagents.d.ts +7 -0
  31. package/dist/shared/keep-subagents.d.ts.map +1 -0
  32. package/package.json +1 -1
  33. package/src/shared/keep-subagents.test.ts +39 -0
  34. package/src/shared/keep-subagents.ts +33 -0
@@ -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;;;;;;qBAwDwlK,CAAC;;;;;;;;;;;;qBAA9rD,CAAC;mBAAyB,CAAC;iBAAuB,CAAC;iBAAuB,CAAC;0BAAc,CAAC;uBAAiB,CAAC;;;;;;0BAAyu0B,CAAC;;;;;;EADjv7B"}
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;;;;;;qBAwDwlK,CAAC;;;;;;;;;;;;qBAA9rD,CAAC;mBAAyB,CAAC;iBAAuB,CAAC;iBAAuB,CAAC;0BAAc,CAAC;uBAAiB,CAAC;;;;;;0BAAmo1B,CAAC;;;;;;EAD3o8B"}
@@ -0,0 +1,7 @@
1
+ /** Set at plugin boot from `keep_subagents` config. */
2
+ export declare function setKeepSubagents(value: boolean): void;
3
+ /** True when subagent child sessions should be retained (not deleted). */
4
+ export declare function shouldKeepSubagents(): boolean;
5
+ /** Test-only reset. Do NOT call from production paths. */
6
+ export declare function _resetKeepSubagentsForTesting(): void;
7
+ //# sourceMappingURL=keep-subagents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keep-subagents.d.ts","sourceRoot":"","sources":["../../src/shared/keep-subagents.ts"],"names":[],"mappings":"AAmBA,uDAAuD;AACvD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,CAErD;AAED,0EAA0E;AAC1E,wBAAgB,mBAAmB,IAAI,OAAO,CAE7C;AAED,0DAA0D;AAC1D,wBAAgB,6BAA6B,IAAI,IAAI,CAEpD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/opencode-magic-context",
3
- "version": "0.22.3",
3
+ "version": "0.22.4",
4
4
  "type": "module",
5
5
  "description": "OpenCode plugin for Magic Context — cross-session memory and context management",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,39 @@
1
+ import { afterEach, describe, expect, it } from "bun:test";
2
+ import {
3
+ _resetKeepSubagentsForTesting,
4
+ setKeepSubagents,
5
+ shouldKeepSubagents,
6
+ } from "./keep-subagents";
7
+
8
+ afterEach(() => {
9
+ _resetKeepSubagentsForTesting();
10
+ });
11
+
12
+ describe("keep-subagents flag", () => {
13
+ it("#given default #then subagent sessions are NOT kept (deleted on success)", () => {
14
+ expect(shouldKeepSubagents()).toBe(false);
15
+ });
16
+
17
+ it("#given setKeepSubagents(true) #then sessions are kept", () => {
18
+ setKeepSubagents(true);
19
+ expect(shouldKeepSubagents()).toBe(true);
20
+ });
21
+
22
+ it("#given setKeepSubagents(false) #then sessions are not kept", () => {
23
+ setKeepSubagents(true);
24
+ setKeepSubagents(false);
25
+ expect(shouldKeepSubagents()).toBe(false);
26
+ });
27
+
28
+ it("#given a non-true value #then coerces to false (only strict true keeps)", () => {
29
+ // boot wiring passes `config.keep_subagents === true`, but guard anyway.
30
+ setKeepSubagents(undefined as unknown as boolean);
31
+ expect(shouldKeepSubagents()).toBe(false);
32
+ });
33
+
34
+ it("#given reset helper #then returns to default false", () => {
35
+ setKeepSubagents(true);
36
+ _resetKeepSubagentsForTesting();
37
+ expect(shouldKeepSubagents()).toBe(false);
38
+ });
39
+ });
@@ -0,0 +1,33 @@
1
+ /**
2
+ * Debug / data-collection switch: when enabled, Magic Context does NOT delete
3
+ * the child sessions it spawns for its own subagents (historian, dreamer,
4
+ * sidekick, memory-migration, key-files, user-memory review, recomp).
5
+ *
6
+ * By default these child sessions are deleted on success (only FAILED ones are
7
+ * kept for debugging). With `keep_subagents: true` ALL of them are retained, so
8
+ * their full transcript — prompt, tool calls, token usage, model output — stays
9
+ * inspectable in OpenCode's session store / the dashboard. Intended for
10
+ * short-term data collection (e.g. profiling what the dreamer actually does)
11
+ * before the dreamer v2 overhaul, NOT for steady-state use — kept sessions
12
+ * accumulate in the host's session DB until manually cleared.
13
+ *
14
+ * Process-global, set once at boot from config (mirrors `harness.ts`). A
15
+ * config change requires a restart to take effect. NEVER thread this through
16
+ * per-call args — it's a coarse, boot-time debug toggle.
17
+ */
18
+ let keepSubagents = false;
19
+
20
+ /** Set at plugin boot from `keep_subagents` config. */
21
+ export function setKeepSubagents(value: boolean): void {
22
+ keepSubagents = value === true;
23
+ }
24
+
25
+ /** True when subagent child sessions should be retained (not deleted). */
26
+ export function shouldKeepSubagents(): boolean {
27
+ return keepSubagents;
28
+ }
29
+
30
+ /** Test-only reset. Do NOT call from production paths. */
31
+ export function _resetKeepSubagentsForTesting(): void {
32
+ keepSubagents = false;
33
+ }