@cortexkit/opencode-magic-context 0.35.0 → 0.36.0

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 (91) hide show
  1. package/README.md +9 -5
  2. package/dist/agents/hidden-agent-registrations.d.ts +10 -2
  3. package/dist/agents/hidden-agent-registrations.d.ts.map +1 -1
  4. package/dist/agents/permissions.d.ts +21 -3
  5. package/dist/agents/permissions.d.ts.map +1 -1
  6. package/dist/{announcement-gms2nhya.js → announcement-6c1g4es4.js} +2 -2
  7. package/dist/config/schema/agent-overrides.d.ts +1 -1
  8. package/dist/config/schema/magic-context.d.ts +19 -9
  9. package/dist/config/schema/magic-context.d.ts.map +1 -1
  10. package/dist/{conflict-warning-hook-p2pmhvn7.js → conflict-warning-hook-dw9fs934.js} +4 -4
  11. package/dist/{derive-budgets-9crp0cvd.js → derive-budgets-88mxk2w1.js} +3 -3
  12. package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts +2 -0
  13. package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts.map +1 -1
  14. package/dist/features/magic-context/dreamer/task-executor.d.ts +1 -0
  15. package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
  16. package/dist/features/magic-context/migrations.d.ts.map +1 -1
  17. package/dist/features/magic-context/smart-notes/condition-compiler.d.ts +37 -0
  18. package/dist/features/magic-context/smart-notes/condition-compiler.d.ts.map +1 -0
  19. package/dist/features/magic-context/smart-notes/runner.d.ts +1 -0
  20. package/dist/features/magic-context/smart-notes/runner.d.ts.map +1 -1
  21. package/dist/features/magic-context/smart-notes/storage.d.ts +3 -3
  22. package/dist/features/magic-context/smart-notes/storage.d.ts.map +1 -1
  23. package/dist/features/magic-context/storage-db.d.ts +1 -1
  24. package/dist/features/magic-context/storage-db.d.ts.map +1 -1
  25. package/dist/features/magic-context/storage-notes.d.ts +13 -0
  26. package/dist/features/magic-context/storage-notes.d.ts.map +1 -1
  27. package/dist/features/magic-context/storage.d.ts +1 -1
  28. package/dist/features/magic-context/storage.d.ts.map +1 -1
  29. package/dist/hooks/magic-context/compartment-prompt.d.ts +6 -6
  30. package/dist/hooks/magic-context/compartment-prompt.d.ts.map +1 -1
  31. package/dist/hooks/magic-context/hook.d.ts +3 -0
  32. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  33. package/dist/hooks/magic-context/lkg-slot.d.ts +15 -1
  34. package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
  35. package/dist/hooks/magic-context/module-state-sync.d.ts +6 -0
  36. package/dist/hooks/magic-context/module-state-sync.d.ts.map +1 -1
  37. package/dist/hooks/magic-context/module-transport.d.ts +9 -0
  38. package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
  39. package/dist/hooks/magic-context/raw-fallback-context-limit.d.ts +10 -0
  40. package/dist/hooks/magic-context/raw-fallback-context-limit.d.ts.map +1 -0
  41. package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -1
  42. package/dist/hooks/magic-context/rust-mode-transform.d.ts +7 -2
  43. package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
  44. package/dist/{index-8aaadh98.js → index-37rt2bka.js} +2 -2
  45. package/dist/{index-4anesz49.js → index-3nfgbsp4.js} +103 -56
  46. package/dist/{index-fcyvznch.js → index-3tnkymva.js} +47 -4
  47. package/dist/{index-k1esqfwk.js → index-f1tnb3vm.js} +1 -1
  48. package/dist/{index-kvrcg31b.js → index-mmrhhk9a.js} +8 -1
  49. package/dist/{index-cn960ffd.js → index-nsx2n9eg.js} +3 -3
  50. package/dist/{index-dmr999a2.js → index-qf20mv7e.js} +1 -1
  51. package/dist/{index-73xz0247.js → index-tsgs7td8.js} +1 -1
  52. package/dist/{index-ry8rh8cv.js → index-wgvxkqpx.js} +5 -4
  53. package/dist/index-z8v31d85.js +2892 -0
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +822 -119
  56. package/dist/plugin/dream-timer.d.ts +1 -0
  57. package/dist/plugin/dream-timer.d.ts.map +1 -1
  58. package/dist/plugin/hooks/create-session-hooks.d.ts +3 -0
  59. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  60. package/dist/plugin/messages-transform.d.ts +5 -5
  61. package/dist/plugin/messages-transform.d.ts.map +1 -1
  62. package/dist/{recomp-orchestrator-zc915ceq.js → recomp-orchestrator-7wbbvf87.js} +7 -7
  63. package/dist/{safe-notification-target-q9jk5n44.js → safe-notification-target-c11fdda2.js} +3 -3
  64. package/dist/{send-session-notification-6njqewzk.js → send-session-notification-bgtf4853.js} +4 -4
  65. package/dist/shared/data-path.d.ts +27 -0
  66. package/dist/shared/data-path.d.ts.map +1 -1
  67. package/dist/shared/harness-provider-map.d.ts +23 -20
  68. package/dist/shared/harness-provider-map.d.ts.map +1 -1
  69. package/dist/shared/prompt-surface-a1-golden.d.ts +28 -0
  70. package/dist/shared/prompt-surface-a1-golden.d.ts.map +1 -0
  71. package/dist/shared/prompt-surface-runtime.d.ts +15 -2
  72. package/dist/shared/prompt-surface-runtime.d.ts.map +1 -1
  73. package/dist/shared/sqlite.d.ts +13 -0
  74. package/dist/shared/sqlite.d.ts.map +1 -1
  75. package/dist/{storage-meta-session-53cjs6mr.js → storage-meta-session-kh5egr11.js} +4 -4
  76. package/dist/tools/ctx-note/tools.d.ts.map +1 -1
  77. package/package.json +3 -3
  78. package/src/agents/hidden-agent-registrations.ts +49 -1
  79. package/src/agents/permissions.ts +91 -3
  80. package/src/config/compaction-accessor-guard.test.ts +9 -4
  81. package/src/config/schema/magic-context.test.ts +2 -0
  82. package/src/config/schema/magic-context.ts +15 -0
  83. package/src/shared/data-path.test.ts +65 -9
  84. package/src/shared/data-path.ts +66 -1
  85. package/src/shared/harness-provider-map.test.ts +42 -1
  86. package/src/shared/harness-provider-map.ts +48 -26
  87. package/src/shared/prompt-surface-a1-golden.ts +41 -0
  88. package/src/shared/prompt-surface-runtime.ts +13 -5
  89. package/src/shared/sqlite.test.ts +32 -0
  90. package/src/shared/sqlite.ts +85 -9
  91. package/dist/index-h8mk7vpa.js +0 -135318
@@ -28,6 +28,7 @@ interface ProjectRegistration {
28
28
  enabled: boolean;
29
29
  model?: string;
30
30
  };
31
+ retinaHandoff?: boolean;
31
32
  embeddingConfig?: {
32
33
  provider?: string;
33
34
  };
@@ -1 +1 @@
1
- {"version":3,"file":"dream-timer.d.ts","sourceRoot":"","sources":["../../src/plugin/dream-timer.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AASvF,OAAO,EAEH,KAAK,wBAAwB,EAChC,MAAM,8DAA8D,CAAC;AAOtE,OAAO,KAAK,EACR,aAAa,EACb,iBAAiB,EACpB,MAAM,iDAAiD,CAAC;AA4BzD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAGpF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAS7C;;;;;GAKG;AACH,UAAU,mBAAmB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iBAAiB,CAAC,EAAE;QAChB,OAAO,EAAE,OAAO,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,KAAK,CAAC,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7C,eAA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e,EAAE,MAAM,KACtB,wBAAwB,GAAG,IAAI,CAAC;IACrC;;;;;;OAMG;IACH,wBAAwB,CAAC,EAAE,CACvB,SAAS,EAAE,MAAM,KAChB,OAAO,CAAC,kBAAkB,GAAG,IAAI,CAAC,GAAG,kBAAkB,GAAG,IAAI,CAAC;IACpE,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAC9B,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI,EAAE,aAAa,CAAC,EAAE,aAAa,KAAK,IAAI,CAAC;IAChG,YAAY,CAAC,EAAE,oBAAoB,GAAG;QAClC,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE;YACrB,kBAAkB,EAAE,MAAM,CAAC;YAC3B,OAAO,EAAE,MAAM,CAAC;YAChB,WAAW,CAAC,EAAE,MAAM,CAAC;YACrB,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC;SAChC,KAAK,OAAO,CAAC;YAAE,SAAS,EAAE;gBAAE,KAAK,CAAC,EAAE,MAAM,CAAC;gBAAC,UAAU,CAAC,EAAE,MAAM,CAAA;aAAE,GAAG,IAAI,CAAA;SAAE,CAAC,CAAC;KAChF,CAAC;CACL;AAkDD;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CACzC,IAAI,EAAE,mBAAmB,GAC1B,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC,CAoEnC"}
@@ -32,6 +32,9 @@ export declare function buildMagicContextHookConfig(pluginConfig: MagicContextPl
32
32
  language?: string;
33
33
  historian?: import("../../config/schema/magic-context").HistorianConfig;
34
34
  dreamer?: import("../../config/schema/magic-context").DreamerConfig;
35
+ smart_notes: {
36
+ retina_handoff: boolean;
37
+ };
35
38
  cache_ttl: string | {
36
39
  default: string;
37
40
  [modelKey: string]: string;
@@ -1 +1 @@
1
- {"version":3,"file":"create-session-hooks.d.ts","sourceRoot":"","sources":["../../../src/plugin/hooks/create-session-hooks.ts"],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;;;0BAAuxzD,CAAC;;;;;;;;;EAvCj94D;AAED,wBAAsB,uBAAuB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,aAAa,CAAC;IACnB,YAAY,EAAE,wBAAwB,CAAC;IACvC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;CAC/C;;;;;;;;;qBA+BmpJ,CAAC;iBAA2B,CAAC;0BAAc,CAAC;uBAAiB,CAAC;;;;;;;;;;;;;qBAApoE,CAAC;mBAAyB,CAAC;iBAAuB,CAAC;iBAAuB,CAAC;0BAAc,CAAC;uBAAiB,CAAC;;;;;;0BAAuxzD,CAAC;;;;;;;;;GADj94D"}
@@ -17,9 +17,9 @@ type MagicContextTransformHooks = {
17
17
  *
18
18
  * Error handling is tiered:
19
19
  *
20
- * - **FailClosedBlockingError / EmergencyFailClosedError**: Intentional loud
21
- * aborts. Rethrown so the TUI surfaces the message and the turn does not
22
- * silently fall through to native compaction.
20
+ * - **FailClosedBlockingError / EmergencyFailClosedError / RawFallbackContextLimitError**:
21
+ * Intentional loud aborts. Rethrown so the TUI surfaces the message and the turn does not
22
+ * silently fall through to native compaction or a provider-rejected raw prompt.
23
23
  *
24
24
  * - **SQLITE_BUSY**: Transient, expected from concurrent plugin processes
25
25
  * (second OpenCode instance, long dreamer/historian child session, slow
@@ -39,8 +39,8 @@ type MagicContextTransformHooks = {
39
39
  * 3. Return with messages unmodified for this pass.
40
40
  *
41
41
  * Ordinary transform failures are not rethrown because OpenCode's Effect pipeline
42
- * turns thrown errors into user-visible prompt failures. FailClosedBlockingError
43
- * and EmergencyFailClosedError are the intentional exceptions and are rethrown.
42
+ * turns thrown errors into user-visible prompt failures. FailClosedBlockingError,
43
+ * EmergencyFailClosedError, and RawFallbackContextLimitError are intentional exceptions.
44
44
  * We accept degraded behavior (no injection / no drops this turn) rather than
45
45
  * blocking the user for ordinary bugs — but deterministic inoperability must
46
46
  * block loudly when fail_closed_blocking is on.
@@ -1 +1 @@
1
- {"version":3,"file":"messages-transform.d.ts","sourceRoot":"","sources":["../../src/plugin/messages-transform.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,oBAAoB,EAI5B,MAAM,6CAA6C,CAAC;AAoBrD,KAAK,gBAAgB,GAAG;IACpB,IAAI,EAAE,OAAO,kBAAkB,EAAE,OAAO,CAAC;IACzC,KAAK,EAAE,OAAO,kBAAkB,EAAE,IAAI,EAAE,CAAC;CAC5C,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAA;CAAE,CAAC;AAEhE,KAAK,0BAA0B,GAAG;IAC9B,sCAAsC,CAAC,EAAE,CACrC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAC5B,MAAM,EAAE,uBAAuB,KAC9B,OAAO,CAAC,IAAI,CAAC,CAAC;CACtB,GAAG,IAAI,CAAC;AAMT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE;IACjD,YAAY,EAAE,0BAA0B,CAAC;IACzC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,0BAA0B,CAAC;IACnD,UAAU,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACzC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qBAAqB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACpC,gBAAgB,CAAC,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACvD,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,uBAAuB,KAAK,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAsLjG"}
1
+ {"version":3,"file":"messages-transform.d.ts","sourceRoot":"","sources":["../../src/plugin/messages-transform.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,oBAAoB,EAI5B,MAAM,6CAA6C,CAAC;AAqBrD,KAAK,gBAAgB,GAAG;IACpB,IAAI,EAAE,OAAO,kBAAkB,EAAE,OAAO,CAAC;IACzC,KAAK,EAAE,OAAO,kBAAkB,EAAE,IAAI,EAAE,CAAC;CAC5C,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAA;CAAE,CAAC;AAEhE,KAAK,0BAA0B,GAAG;IAC9B,sCAAsC,CAAC,EAAE,CACrC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAC5B,MAAM,EAAE,uBAAuB,KAC9B,OAAO,CAAC,IAAI,CAAC,CAAC;CACtB,GAAG,IAAI,CAAC;AAMT;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE;IACjD,YAAY,EAAE,0BAA0B,CAAC;IACzC;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,0BAA0B,CAAC;IACnD,UAAU,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACzC,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,qBAAqB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACpC,gBAAgB,CAAC,EAAE,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACvD,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,uBAAuB,KAAK,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAuLjG"}
@@ -9,16 +9,16 @@ import {
9
9
  setRecompNote,
10
10
  setRecompStarting,
11
11
  setRecompTerminal
12
- } from "./index-4anesz49.js";
13
- import"./index-ry8rh8cv.js";
12
+ } from "./index-3nfgbsp4.js";
13
+ import"./index-wgvxkqpx.js";
14
14
  import"./index-td9depx5.js";
15
- import"./index-cn960ffd.js";
16
- import"./index-h8mk7vpa.js";
17
- import"./index-fcyvznch.js";
15
+ import"./index-nsx2n9eg.js";
16
+ import"./index-z8v31d85.js";
17
+ import"./index-3tnkymva.js";
18
18
  import"./index-0c9dmw9m.js";
19
19
  import"./index-d62ypazr.js";
20
- import"./index-k1esqfwk.js";
21
- import"./index-kvrcg31b.js";
20
+ import"./index-f1tnb3vm.js";
21
+ import"./index-mmrhhk9a.js";
22
22
  import"./index-wckvcay0.js";
23
23
  export {
24
24
  setRecompTerminal,
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  isDefaultSessionTitle,
3
3
  waitForSafeNotificationTarget
4
- } from "./index-73xz0247.js";
5
- import"./index-k1esqfwk.js";
6
- import"./index-kvrcg31b.js";
4
+ } from "./index-tsgs7td8.js";
5
+ import"./index-f1tnb3vm.js";
6
+ import"./index-mmrhhk9a.js";
7
7
  import"./index-wckvcay0.js";
8
8
  export {
9
9
  waitForSafeNotificationTarget,
@@ -5,10 +5,10 @@ import {
5
5
  flushIgnoredMessages,
6
6
  sendIgnoredMessage,
7
7
  sendUserPrompt
8
- } from "./index-cn960ffd.js";
9
- import"./index-fcyvznch.js";
10
- import"./index-k1esqfwk.js";
11
- import"./index-kvrcg31b.js";
8
+ } from "./index-nsx2n9eg.js";
9
+ import"./index-3tnkymva.js";
10
+ import"./index-f1tnb3vm.js";
11
+ import"./index-mmrhhk9a.js";
12
12
  import"./index-wckvcay0.js";
13
13
  export {
14
14
  sendUserPrompt,
@@ -115,6 +115,33 @@ export declare function getOpenCodeStorageDir(): string;
115
115
  * - Future cross-harness session migration
116
116
  *
117
117
  * Layout: <XDG_DATA_HOME>/cortexkit/magic-context/
118
+ *
119
+ * TEST-ISOLATION GUARD. `openDatabase()` has been guarded in
120
+ * `resolveDatabasePath()` since the 2026-06-01 (v26) and 2026-06-19 (v41)
121
+ * incidents, in which unisolated tests migrated the user's REAL shared DB.
122
+ * Every OTHER caller bypassed that guard — notably the CLI doctors, which
123
+ * build `join(getMagicContextStorageDir(), "context.db")` themselves and run
124
+ * `PRAGMA integrity_check` against it. A test that deletes XDG_DATA_HOME to
125
+ * exercise path fallbacks cannot restore isolation by setting
126
+ * `process.env.HOME`: bun caches `os.homedir()` at startup, so `getDataDir()`
127
+ * still resolves to the real home. MAGIC_CONTEXT_TEST_DATA_DIR — set by
128
+ * `packages/plugin/test-preload.ts`, and restored by any test that touches it
129
+ * — is honored here, so the preload's "cannot be defeated" guarantee holds for
130
+ * every caller, not just `openDatabase()`. It is never set in production.
131
+ *
132
+ * CWD-INDEPENDENT BACKSTOP. The preload only runs when `bun test`'s CWD has a
133
+ * bunfig wiring `[test] preload`. A run from a dir WITHOUT that wiring (a
134
+ * package missing its bunfig, or a brand-new one) executes every *.test.ts with
135
+ * NO preload, and this resolver would hand back the REAL shared path — which is
136
+ * how the live DB reached v41. Bun sets NODE_ENV=test for EVERY `bun test`
137
+ * regardless of CWD, and production never sets it, so that window redirects to
138
+ * a memoized throwaway dir instead. It lives here rather than in
139
+ * `resolveDatabasePath()` so direct callers (the CLI doctors' own
140
+ * `PRAGMA integrity_check`, announcements, the models.dev cache) are covered
141
+ * too — they never go through the DB resolver.
142
+ *
143
+ * XDG_DATA_HOME still wins over both: a test that manages its own data home is
144
+ * already controlled, and production has no test dir set at all.
118
145
  */
119
146
  export declare function getMagicContextStorageDir(): string;
120
147
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"data-path.d.ts","sourceRoot":"","sources":["../../src/shared/data-path.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAEvD,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,sBAAsB,CAAC,OA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;;GA0BG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEnE;AAKD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gCAAgC,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAkBxE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kCAAkC,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAWlD;AA+BD;;;;;;GAMG;AACH,wBAAgB,uCAAuC,IAAI,MAAM,CAEhE;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C"}
@@ -2,33 +2,32 @@
2
2
  * Provider-id translation between the canonical (OpenCode) form stored in the
3
3
  * shared magic-context config and Pi's harness-native provider ids.
4
4
  *
5
- * OpenCode and Pi now share ONE config, but a few auth-plugin providers were
6
- * named differently on each side. The model id AFTER the slash is identical;
7
- * only the provider prefix differs:
5
+ * Provider IDs are a harness boundary, not a database identity. Shared config
6
+ * always stores the canonical OpenCode form. Each non-OpenCode harness owns an
7
+ * explicit pair of edge transforms:
8
8
  *
9
- * canonical (OpenCode) Pi's preferred auth-plugin form
10
- * -------------------- ------------------------------
9
+ * canonical (OpenCode) Pi / OMP selector
10
+ * -------------------- -----------------
11
11
  * openai/<model> openai-codex/<model>
12
12
  * google/<model> google-antigravity/<model>
13
13
  * anthropic/<model> anthropic/<model> (same; every other provider too)
14
14
  *
15
- * The mapping is intentionally not a one-to-one provider identity. Pi also
16
- * exposes plain `openai` and `google` providers for direct API keys, while the
17
- * canonical prefix does not record whether a subscription or API-key backend
18
- * should win. Pi therefore starts with the preferred auth-plugin form at the
19
- * spawn boundary and subagent-runner may retry once with the untranslated
20
- * canonical form when that form reports missing credentials. The runner caches
21
- * the winning form per provider prefix in memory only; setup writes still use
22
- * the reverse mapping below so configs remain canonical.
15
+ * Pi and OMP currently expose the same two subscription-provider aliases, but
16
+ * their exported functions remain distinct deliberately. A future OMP catalog
17
+ * rename must not silently change plain-Pi behavior (or vice versa).
23
18
  *
24
- * Canonical = OpenCode: the config always stores the OpenCode form. Pi
25
- * translates at its edges:
26
- * - read: canonical -> Pi when spawning a configured model (subagent-runner),
27
- * with the runtime credential fallback described above.
28
- * - write: Pi -> canonical in the Pi setup wizard, so a config written from
29
- * the Pi side stays readable by OpenCode.
19
+ * The mapping is intentionally not a one-to-one provider identity. Both
20
+ * harnesses also expose plain `openai` and `google` providers for direct API
21
+ * keys, while the canonical prefix does not record whether a subscription or
22
+ * API-key backend should win. The runtime starts with the preferred
23
+ * subscription form and subagent-runner may retry once with the untranslated
24
+ * canonical form when that form reports missing credentials.
30
25
  *
31
- * OpenCode needs no translation (canonical IS the OpenCode form).
26
+ * Only the provider prefix before the first slash is translated. Model IDs,
27
+ * including nested IDs containing more slashes, are preserved byte-for-byte.
28
+ * Scoped or otherwise unknown provider prefixes are identities.
29
+ *
30
+ * OpenCode needs no translation because canonical is its native form.
32
31
  */
33
32
  /** Pi-native `provider/model` -> canonical (OpenCode). Identity when unmapped.
34
33
  * Used by the Pi setup wizard so configs it writes stay OpenCode-readable. */
@@ -37,4 +36,8 @@ export declare function piModelRefToCanonical(ref: string): string;
37
36
  * Pi. Idempotent: normalizes any Pi-form prefix back to canonical first, so it
38
37
  * is safe on a config that already holds Pi-form ids (hand-edited or pre-fix). */
39
38
  export declare function resolveModelRefForPi(ref: string): string;
39
+ /** OMP-native selector -> canonical shared-config model reference. */
40
+ export declare function ompModelRefToCanonical(ref: string): string;
41
+ /** Canonical shared-config model reference -> OMP-native selector. */
42
+ export declare function resolveModelRefForOmp(ref: string): string;
40
43
  //# sourceMappingURL=harness-provider-map.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"harness-provider-map.d.ts","sourceRoot":"","sources":["../../src/shared/harness-provider-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAuBH;+EAC+E;AAC/E,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;mFAEmF;AACnF,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAExD"}
1
+ {"version":3,"file":"harness-provider-map.d.ts","sourceRoot":"","sources":["../../src/shared/harness-provider-map.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAoCH;+EAC+E;AAC/E,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEzD;AAED;;mFAEmF;AACnF,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAExD;AAED,sEAAsE;AACtE,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,sEAAsE;AACtE,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEzD"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Shared accessors for the A1 prompt-surface golden.
3
+ *
4
+ * The golden (`prompt-surface-a1-golden.md`, generated by
5
+ * `scripts/export-agent-surface.ts`) is read by tests in BOTH packages, and its
6
+ * section headings are the contract between the generator and those readers.
7
+ * Keeping the path, the heading strings, and the offset guard here means a
8
+ * change to the golden's section format is a one-file edit rather than a hunt
9
+ * across packages.
10
+ *
11
+ * This module resolves the golden relative to ITSELF, so consumers never carry
12
+ * their own `../..` path arithmetic — that arithmetic differs per package and is
13
+ * exactly the kind of thing that rots silently when files move.
14
+ */
15
+ export declare const A1_TOOL_SECTION_HEADING = "## 2. Tool surface";
16
+ export declare const A1_HASH_BASELINE_HEADING = "## 3. System-prompt hash baseline";
17
+ export declare function readA1GoldenDocument(): string;
18
+ /**
19
+ * Locate a golden section heading, refusing to continue when it is absent.
20
+ *
21
+ * A bare `indexOf` returns -1 for a missing heading, and `slice(start, -1)`
22
+ * silently yields an empty (or truncated) section rather than failing: the
23
+ * golden then parses as ZERO tools and the consuming test passes by comparing
24
+ * empty to empty. Failing loudly here keeps a malformed golden from reading as a
25
+ * clean run.
26
+ */
27
+ export declare function a1GoldenSectionOffset(document: string, heading: string): number;
28
+ //# sourceMappingURL=prompt-surface-a1-golden.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompt-surface-a1-golden.d.ts","sourceRoot":"","sources":["../../src/shared/prompt-surface-a1-golden.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;GAaG;AAEH,eAAO,MAAM,uBAAuB,uBAAuB,CAAC;AAC5D,eAAO,MAAM,wBAAwB,sCAAsC,CAAC;AAE5E,wBAAgB,oBAAoB,IAAI,MAAM,CAE7C;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAM/E"}
@@ -1,8 +1,21 @@
1
1
  import { type ConfigHarness } from "../config/migrate-config-location";
2
2
  import { type PromptSurfaceConfig, type PromptSurfacePreset } from "./prompt-surface";
3
+ /**
4
+ * The single source of truth for the ctx_* tools exposed by the prompt surface.
5
+ * Consumers derive their registries and light-description catalogs from this list
6
+ * so adding a tool cannot silently skip one prompt-surface integration point.
7
+ */
8
+ export declare const ACTIVE_TOOL_IDS: readonly ["ctx_reduce", "ctx_expand", "ctx_note", "ctx_memory", "ctx_search"];
9
+ /** @deprecated Use ACTIVE_TOOL_IDS. Kept as an alias for existing consumers. */
3
10
  export declare const PROMPT_SURFACE_TOOL_IDS: readonly ["ctx_reduce", "ctx_expand", "ctx_note", "ctx_memory", "ctx_search"];
4
- export type PromptSurfaceToolId = (typeof PROMPT_SURFACE_TOOL_IDS)[number];
5
- export declare const LIGHT_TOOL_DESCRIPTIONS: Readonly<Record<PromptSurfaceToolId, string>>;
11
+ export type PromptSurfaceToolId = (typeof ACTIVE_TOOL_IDS)[number];
12
+ export declare const LIGHT_TOOL_DESCRIPTIONS: {
13
+ readonly ctx_reduce: "For ctx_reduce users, mark spent §N§ outputs discardable; release is QUEUED, not immediate, so content stays visible until space is needed. Newest tags stay protected until they age out. Released content becomes a placeholder; recover it only by rerunning the source or recovery tool, so mark only genuinely finished material. Mark analyzed, redundant, persisted, or merely confirmatory outputs; keep user messages, unresolved errors, unextracted evidence, and exact wording. NEVER blanket-mark a large range: review every tag first.";
14
+ readonly ctx_expand: "For ctx_expand users, recover compacted conversation by passing a session-history heading's inclusive start/end ordinals. Results are raw [N] U:/A: transcript capped near 15K tokens; oversized ranges return the head and a continuation. Use verbose=true to list each message ordinal, part previews, and tool-output sizes; use message=N for one complete stored message and its tool exchanges. NEVER expand ranges after the last compartment because that live tail is already visible.";
15
+ readonly ctx_note: "For ctx_note users, write saves, read lists, update changes, and dismiss retires future session notes; surface_condition creates a smart note. For smart notes, NEVER use a condition tied to this conversation or an unobservable future action because the background checker can inspect only external GitHub, disk, git, or web signals.";
16
+ readonly ctx_memory: "For ctx_memory users, write one standalone durable fact with category and content; update one ID, archive one or more IDs, merge two or more IDs, or get one to twenty numeric IDs. get reads memories in every status; list remains dreamer-only, so primary agents must NEVER assume bulk-list access.";
17
+ readonly ctx_search: "For ctx_search users, retrieve only hidden recall: memories not already in <project-memory>, compacted messages outside the live tail, commits, and notes. Omit sources for broad search; select memory, message, git_commit, or note to target a source, or pass memory IDs to bypass text search. Message hits continue through ctx_expand.";
18
+ };
6
19
  /**
7
20
  * Preserve the existing full-preset hash exactly while giving other presets a
8
21
  * distinct semantic cache identity, including during any future asset fallback.
@@ -1 +1 @@
1
- {"version":3,"file":"prompt-surface-runtime.d.ts","sourceRoot":"","sources":["../../src/shared/prompt-surface-runtime.ts"],"names":[],"mappings":"AAGA,OAAO,EACH,KAAK,aAAa,EAGrB,MAAM,mCAAmC,CAAC;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AAC;IACxC,eAAe,EAAE,CACb,MAAM,EAAE,mBAAmB,GAAG,SAAS,EACvC,QAAQ,EAAE,MAAM,GAAG,SAAS,KAC3B,8BAA8B,CAAC;CACvC;AAED,MAAM,WAAW,iCAAiC;IAC9C,OAAO,CAAC,EAAE,aAAa,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,oFAAoF;IACpF,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAwBD;;;;GAIG;AACH,wBAAgB,0BAA0B,CACtC,OAAO,EAAE,iCAAiC,GAC3C,oBAAoB,CAkGtB;AAQD,uFAAuF;AACvF,wBAAgB,qCAAqC,CAAC,OAAO,EAAE,oBAAoB,GAAG;IAClF,OAAO,EAAE,CACL,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,mBAAmB,GAAG,SAAS,EACvC,QAAQ,EAAE,MAAM,GAAG,SAAS,KAC3B,8BAA8B,CAAC;IACpC,KAAK,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC,CAkBA"}
@@ -39,6 +39,18 @@
39
39
  * `run()` → {changes,lastInsertRowid}) is identical and was verified directly.
40
40
  */
41
41
  import type BetterSqlite3 from "better-sqlite3";
42
+ export type SqliteRuntime = "Bun" | "Node.js";
43
+ type SqliteModule = {
44
+ Database?: unknown;
45
+ DatabaseSync?: unknown;
46
+ };
47
+ export declare function detectSqliteRuntime(): SqliteRuntime;
48
+ export declare class SqliteRuntimeUnavailableError extends Error {
49
+ readonly runtime: SqliteRuntime;
50
+ readonly specifier: string;
51
+ constructor(runtime: SqliteRuntime, specifier: string, cause: unknown);
52
+ }
53
+ export declare function loadSqliteModule(runtime?: SqliteRuntime, importer?: (specifier: string) => Promise<SqliteModule>): Promise<SqliteModule>;
42
54
  export declare const Database: typeof BetterSqlite3;
43
55
  /** Instance type alias used by helpers and storage modules. */
44
56
  export type Database = BetterSqlite3.Database;
@@ -65,4 +77,5 @@ export type Statement = BetterSqlite3.Statement<unknown[], unknown>;
65
77
  * flag, so an inner scope releasing does not drop permission out from under its caller.
66
78
  */
67
79
  export declare function withPrivilegedWriter<T>(db: Database, operation: () => T): T;
80
+ export {};
68
81
  //# sourceMappingURL=sqlite.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/shared/sqlite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAMH,OAAO,KAAK,aAAa,MAAM,gBAAgB,CAAC;AA4IhD,eAAO,MAAM,QAAQ,EAAE,OAAO,aAA4B,CAAC;AAE3D,+DAA+D;AAC/D,MAAM,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC;AAE9C;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;AASpE;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,CAwC3E"}
1
+ {"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/shared/sqlite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAMH,OAAO,KAAK,aAAa,MAAM,gBAAgB,CAAC;AAEhD,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,SAAS,CAAC;AAE9C,KAAK,YAAY,GAAG;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,wBAAgB,mBAAmB,IAAI,aAAa,CAWnD;AAgDD,qBAAa,6BAA8B,SAAQ,KAAK;IACpD,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;gBAEf,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO;CAaxE;AAED,wBAAsB,gBAAgB,CAClC,OAAO,GAAE,aAAqC,EAC9C,QAAQ,GAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,YAAY,CAAsB,GAC5E,OAAO,CAAC,YAAY,CAAC,CAUvB;AAoHD,eAAO,MAAM,QAAQ,EAAE,OAAO,aAA4B,CAAC;AAE3D,+DAA+D;AAC/D,MAAM,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC;AAE9C;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC;AASpE;;;;;;;;;;GAUG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,CAwC3E"}
@@ -5,10 +5,10 @@ import {
5
5
  markSessionCleanupPending,
6
6
  retryPendingSessionCleanups,
7
7
  updateSessionMeta
8
- } from "./index-h8mk7vpa.js";
9
- import"./index-fcyvznch.js";
10
- import"./index-k1esqfwk.js";
11
- import"./index-kvrcg31b.js";
8
+ } from "./index-z8v31d85.js";
9
+ import"./index-3tnkymva.js";
10
+ import"./index-f1tnb3vm.js";
11
+ import"./index-mmrhhk9a.js";
12
12
  import"./index-wckvcay0.js";
13
13
  export {
14
14
  updateSessionMeta,
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-note/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAahE,OAAO,KAAK,EAAuB,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAK7F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAKpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,QAAQ,CAAC;IACb,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC/D,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACvC;AAuaD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAIxF"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-note/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAmBhE,OAAO,KAAK,EAAuB,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAK7F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAKpD,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAEnE,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,QAAQ,CAAC;IACb,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;IAC/D,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACvC;AAmbD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAIxF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/opencode-magic-context",
3
- "version": "0.35.0",
3
+ "version": "0.36.0",
4
4
  "type": "module",
5
5
  "description": "OpenCode plugin for Magic Context — cross-session memory and context management",
6
6
  "main": "dist/index.js",
@@ -35,10 +35,10 @@
35
35
  "README.md"
36
36
  ],
37
37
  "scripts": {
38
- "build": "bun run build:tui && rm -f dist/index.js dist/*-*.js && bun build src/index.ts --outdir dist --target node --format esm --splitting --external @opencode-ai/plugin --external @huggingface/transformers --external onnxruntime-web --external bun:sqlite --external node:sqlite && tsc --emitDeclarationOnly",
38
+ "build": "tsc -p ../retina-local-fs/tsconfig.build.json && bun run build:tui && rm -f dist/index.js dist/*-*.js && bun build src/index.ts --outdir dist --target node --format esm --splitting --external @opencode-ai/plugin --external @huggingface/transformers --external onnxruntime-web --external bun:sqlite --external node:sqlite && tsc --emitDeclarationOnly",
39
39
  "build:tui": "bun scripts/build-tui.ts",
40
40
  "check:tui-compiled": "bun run build:tui && git diff --exit-code -- src/tui-compiled && test -z \"$(git status --porcelain -- src/tui-compiled)\"",
41
- "typecheck": "tsc --noEmit && tsc -p tsconfig.scripts.json",
41
+ "typecheck": "tsc -p ../retina-local-fs/tsconfig.build.json && tsc --noEmit && tsc -p tsconfig.scripts.json",
42
42
  "test": "bun test",
43
43
  "lint": "biome check .",
44
44
  "lint:fix": "biome check --write .",
@@ -54,8 +54,18 @@ function clampHiddenAgentStepLimit(value: unknown, cap: number): number {
54
54
  * byte-identical to the canonical exported constants so they can't silently
55
55
  * diverge.
56
56
  */
57
+ export const HIDDEN_AGENT_DESCRIPTION_MARKER = "Internal Magic Context";
58
+ const HIDDEN_AGENT_DESCRIPTION =
59
+ "Internal Magic Context maintenance agent. Not for general tasks — do not select for user work.";
60
+
57
61
  export interface HiddenAgentRegistration {
58
62
  id: string;
63
+ /** OpenCode's task registry excludes primary agents from general subagent routing. */
64
+ mode: "primary";
65
+ /** Hidden agents stay out of the UI picker while remaining directly resolvable. */
66
+ hidden: true;
67
+ /** Description used by OpenCode's automatic name/description-based task router; keep it generic so this hidden agent is not selected for unrelated tasks. */
68
+ description: string;
59
69
  prompt: string | undefined;
60
70
  allowedTools: readonly string[];
61
71
  maxSteps: number;
@@ -90,6 +100,9 @@ export function buildHiddenAgentRegistrations(args: {
90
100
  return [
91
101
  {
92
102
  id: "dreamer",
103
+ mode: "primary",
104
+ hidden: true,
105
+ description: HIDDEN_AGENT_DESCRIPTION,
93
106
  prompt: args.dreamerPrompt,
94
107
  // CURATE-ONLY now. Curate edits the memory store via ctx_memory and
95
108
  // never reads code (a separate verify task owns memory-vs-code
@@ -111,6 +124,9 @@ export function buildHiddenAgentRegistrations(args: {
111
124
  },
112
125
  {
113
126
  id: "dreamer-docs",
127
+ mode: "primary",
128
+ hidden: true,
129
+ description: HIDDEN_AGENT_DESCRIPTION,
114
130
  prompt: args.dreamerPrompt,
115
131
  // maintain-docs: explore code + write/edit ARCHITECTURE.md/STRUCTURE.md
116
132
  // + bash (git log, find). NO ctx_memory/ctx_search/ctx_note — it edits
@@ -136,6 +152,9 @@ export function buildHiddenAgentRegistrations(args: {
136
152
  },
137
153
  {
138
154
  id: "dreamer-reviewer",
155
+ mode: "primary",
156
+ hidden: true,
157
+ description: HIDDEN_AGENT_DESCRIPTION,
139
158
  prompt: args.dreamerPrompt,
140
159
  // review-user-memories: a pure JSON reviewer of behavioral observations.
141
160
  // It calls NO tools — the host applies its verdict — so zero tools,
@@ -147,6 +166,9 @@ export function buildHiddenAgentRegistrations(args: {
147
166
  },
148
167
  {
149
168
  id: "dreamer-retrospective",
169
+ mode: "primary",
170
+ hidden: true,
171
+ description: HIDDEN_AGENT_DESCRIPTION,
150
172
  prompt: args.dreamerPrompt,
151
173
  allowedTools: ["ctx_search"],
152
174
  maxSteps: 40,
@@ -158,6 +180,9 @@ export function buildHiddenAgentRegistrations(args: {
158
180
  },
159
181
  {
160
182
  id: "dreamer-primer-investigator",
183
+ mode: "primary",
184
+ hidden: true,
185
+ description: HIDDEN_AGENT_DESCRIPTION,
161
186
  prompt: args.dreamerPrompt,
162
187
  // Read-only code investigation: read/navigate/search the CURRENT
163
188
  // source to answer a primer. Deliberately NO write/edit/bash (could
@@ -184,6 +209,9 @@ export function buildHiddenAgentRegistrations(args: {
184
209
  },
185
210
  {
186
211
  id: "dreamer-memory-mapper",
212
+ mode: "primary",
213
+ hidden: true,
214
+ description: HIDDEN_AGENT_DESCRIPTION,
187
215
  prompt: args.dreamerPrompt,
188
216
  // Read-only local-source reader for map-memories / verify: open and
189
217
  // check the CURRENT source. NO write/edit/bash (could corrupt user
@@ -203,6 +231,9 @@ export function buildHiddenAgentRegistrations(args: {
203
231
  },
204
232
  {
205
233
  id: "dreamer-classifier",
234
+ mode: "primary",
235
+ hidden: true,
236
+ description: HIDDEN_AGENT_DESCRIPTION,
206
237
  prompt: args.dreamerPrompt,
207
238
  // ZERO tools: classify scores importance/scope/shareable from the
208
239
  // memory text alone (no code inspection), emits ONE XML manifest, and
@@ -215,6 +246,9 @@ export function buildHiddenAgentRegistrations(args: {
215
246
  },
216
247
  {
217
248
  id: "smart-note-compiler",
249
+ mode: "primary",
250
+ hidden: true,
251
+ description: HIDDEN_AGENT_DESCRIPTION,
218
252
  prompt: args.smartNoteCompilerPrompt,
219
253
  allowedTools: [],
220
254
  maxSteps: 8,
@@ -225,6 +259,9 @@ export function buildHiddenAgentRegistrations(args: {
225
259
  },
226
260
  {
227
261
  id: "historian",
262
+ mode: "primary",
263
+ hidden: true,
264
+ description: HIDDEN_AGENT_DESCRIPTION,
228
265
  prompt: args.historianPrompt,
229
266
  allowedTools: historianAllowedTools,
230
267
  maxSteps: 40,
@@ -232,6 +269,9 @@ export function buildHiddenAgentRegistrations(args: {
232
269
  },
233
270
  {
234
271
  id: "historian-recomp",
272
+ mode: "primary",
273
+ hidden: true,
274
+ description: HIDDEN_AGENT_DESCRIPTION,
235
275
  prompt: args.historianRecompPrompt ?? args.historianPrompt,
236
276
  allowedTools: historianAllowedTools,
237
277
  maxSteps: 40,
@@ -239,6 +279,9 @@ export function buildHiddenAgentRegistrations(args: {
239
279
  },
240
280
  {
241
281
  id: "historian-editor",
282
+ mode: "primary",
283
+ hidden: true,
284
+ description: HIDDEN_AGENT_DESCRIPTION,
242
285
  prompt: args.historianEditorPrompt,
243
286
  allowedTools: historianAllowedTools,
244
287
  maxSteps: 40,
@@ -246,6 +289,9 @@ export function buildHiddenAgentRegistrations(args: {
246
289
  },
247
290
  {
248
291
  id: "sidekick",
292
+ mode: "primary",
293
+ hidden: true,
294
+ description: HIDDEN_AGENT_DESCRIPTION,
249
295
  prompt: args.sidekickPrompt,
250
296
  allowedTools: ["ctx_search", "aft_outline", "aft_zoom"],
251
297
  maxSteps: 40,
@@ -266,6 +312,7 @@ export function buildHiddenAgentConfig(
266
312
  overrides?: Record<string, unknown>,
267
313
  agentLabel?: string,
268
314
  lockPermissions = false,
315
+ description?: string,
269
316
  ) {
270
317
  const {
271
318
  permission: overridePermission,
@@ -325,7 +372,8 @@ export function buildHiddenAgentConfig(
325
372
  ...basePermission,
326
373
  ...(lockPermissions ? {} : (overridePermission ?? {})),
327
374
  },
328
- mode: "subagent" as const,
375
+ mode: "primary" as const,
329
376
  hidden: true,
377
+ ...(description !== undefined ? { description } : {}),
330
378
  };
331
379
  }