@cortexkit/opencode-magic-context 0.21.8 → 0.22.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.
- package/README.md +116 -325
- package/dist/agents/magic-context-prompt.d.ts.map +1 -1
- package/dist/agents/permissions.d.ts +29 -14
- package/dist/agents/permissions.d.ts.map +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/migrate-experimental.d.ts +29 -0
- package/dist/config/migrate-experimental.d.ts.map +1 -0
- package/dist/config/schema/magic-context.d.ts +80 -104
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/features/builtin-commands/commands.d.ts.map +1 -1
- package/dist/features/magic-context/compartment-embedding.d.ts +34 -0
- package/dist/features/magic-context/compartment-embedding.d.ts.map +1 -0
- package/dist/features/magic-context/compartment-events.d.ts +50 -0
- package/dist/features/magic-context/compartment-events.d.ts.map +1 -0
- package/dist/features/magic-context/compartment-storage.d.ts +22 -0
- package/dist/features/magic-context/compartment-storage.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/lease.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/queue.d.ts +13 -2
- package/dist/features/magic-context/dreamer/queue.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/runner.d.ts +11 -0
- package/dist/features/magic-context/dreamer/runner.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-prompts.d.ts +1 -1
- package/dist/features/magic-context/dreamer/task-prompts.d.ts.map +1 -1
- package/dist/features/magic-context/git-commits/git-log-reader.d.ts.map +1 -1
- package/dist/features/magic-context/key-files/identify-key-files.d.ts +1 -1
- package/dist/features/magic-context/key-files/identify-key-files.d.ts.map +1 -1
- package/dist/features/magic-context/key-files/project-key-files.d.ts.map +1 -1
- package/dist/features/magic-context/key-files/read-stats.d.ts +1 -1
- package/dist/features/magic-context/key-files/read-stats.d.ts.map +1 -1
- package/dist/features/magic-context/memory/constants.d.ts +4 -0
- package/dist/features/magic-context/memory/constants.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
- package/dist/features/magic-context/memory/index.d.ts +1 -1
- package/dist/features/magic-context/memory/index.d.ts.map +1 -1
- package/dist/features/magic-context/memory/memory-migration.d.ts +133 -0
- package/dist/features/magic-context/memory/memory-migration.d.ts.map +1 -0
- package/dist/features/magic-context/memory/project-identity.d.ts +38 -7
- package/dist/features/magic-context/memory/project-identity.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 +15 -1
- package/dist/features/magic-context/memory/storage-memory.d.ts.map +1 -1
- package/dist/features/magic-context/memory/types.d.ts +3 -1
- package/dist/features/magic-context/memory/types.d.ts.map +1 -1
- package/dist/features/magic-context/message-index.d.ts.map +1 -1
- package/dist/features/magic-context/migrations.d.ts +7 -0
- package/dist/features/magic-context/migrations.d.ts.map +1 -1
- package/dist/features/magic-context/project-docs-hash.d.ts +6 -0
- package/dist/features/magic-context/project-docs-hash.d.ts.map +1 -0
- package/dist/features/magic-context/project-identity.d.ts +2 -0
- package/dist/features/magic-context/project-identity.d.ts.map +1 -0
- package/dist/features/magic-context/storage-db.d.ts +51 -7
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/storage-historian-runs.d.ts +73 -0
- package/dist/features/magic-context/storage-historian-runs.d.ts.map +1 -0
- package/dist/features/magic-context/storage-identity-rekey-map.d.ts +11 -0
- package/dist/features/magic-context/storage-identity-rekey-map.d.ts.map +1 -0
- package/dist/features/magic-context/storage-m0-mutation-log.d.ts +22 -0
- package/dist/features/magic-context/storage-m0-mutation-log.d.ts.map +1 -0
- package/dist/features/magic-context/storage-memory-mutation-log.d.ts +25 -0
- package/dist/features/magic-context/storage-memory-mutation-log.d.ts.map +1 -0
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-shared.d.ts +44 -0
- package/dist/features/magic-context/storage-meta-shared.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta.d.ts +1 -0
- package/dist/features/magic-context/storage-meta.d.ts.map +1 -1
- package/dist/features/magic-context/storage-project-state.d.ts +19 -0
- package/dist/features/magic-context/storage-project-state.d.ts.map +1 -0
- package/dist/features/magic-context/storage-subagent-invocations.d.ts +9 -0
- package/dist/features/magic-context/storage-subagent-invocations.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tags.d.ts +21 -1
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/features/magic-context/storage-v22-backfill-failures.d.ts +24 -0
- package/dist/features/magic-context/storage-v22-backfill-failures.d.ts.map +1 -0
- package/dist/features/magic-context/storage.d.ts +12 -3
- package/dist/features/magic-context/storage.d.ts.map +1 -1
- package/dist/features/magic-context/subagent-token-capture.d.ts +1 -1
- package/dist/features/magic-context/subagent-token-capture.d.ts.map +1 -1
- package/dist/features/magic-context/tagger.d.ts +15 -1
- package/dist/features/magic-context/tagger.d.ts.map +1 -1
- package/dist/features/magic-context/types.d.ts +21 -0
- package/dist/features/magic-context/types.d.ts.map +1 -1
- package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
- package/dist/features/magic-context/user-memory/storage-user-memory.d.ts.map +1 -1
- package/dist/features/magic-context/v22-deferred-backfill.d.ts +46 -0
- package/dist/features/magic-context/v22-deferred-backfill.d.ts.map +1 -0
- package/dist/features/magic-context/work-metrics.d.ts +66 -0
- package/dist/features/magic-context/work-metrics.d.ts.map +1 -1
- package/dist/hooks/auto-update-checker/cache.d.ts.map +1 -1
- package/dist/hooks/auto-update-checker/checker.d.ts.map +1 -1
- package/dist/hooks/magic-context/cache-busting-signals.d.ts +9 -0
- package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -1
- package/dist/hooks/magic-context/command-handler.d.ts +13 -1
- package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-parser.d.ts +25 -0
- package/dist/hooks/magic-context/compartment-parser.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-prompt.d.ts +27 -16
- package/dist/hooks/magic-context/compartment-prompt.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-mapping.d.ts +6 -2
- package/dist/hooks/magic-context/compartment-runner-mapping.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-partial-recomp.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-recomp.d.ts +9 -1
- package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts +67 -4
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/decay-curve.d.ts +78 -0
- package/dist/hooks/magic-context/decay-curve.d.ts.map +1 -0
- package/dist/hooks/magic-context/decay-render.d.ts +67 -0
- package/dist/hooks/magic-context/decay-render.d.ts.map +1 -0
- package/dist/hooks/magic-context/event-handler.d.ts +1 -1
- package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-resolvers.d.ts +17 -0
- package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
- package/dist/hooks/magic-context/execute-status.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-prompt.generated.d.ts +2 -0
- package/dist/hooks/magic-context/historian-prompt.generated.d.ts.map +1 -0
- package/dist/hooks/magic-context/hook-handlers.d.ts +3 -0
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts +9 -21
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts +126 -0
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/key-files-block.d.ts.map +1 -1
- package/dist/hooks/magic-context/live-session-state.d.ts +9 -0
- package/dist/hooks/magic-context/live-session-state.d.ts.map +1 -1
- package/dist/hooks/magic-context/m0-token-breakdown.d.ts +35 -0
- package/dist/hooks/magic-context/m0-token-breakdown.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-chunk.d.ts +9 -0
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-db.d.ts +7 -0
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts +104 -0
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -0
- package/dist/hooks/magic-context/reference-retrieval.d.ts +61 -0
- package/dist/hooks/magic-context/reference-retrieval.d.ts.map +1 -0
- package/dist/hooks/magic-context/reference-seeds.generated.d.ts +8 -0
- package/dist/hooks/magic-context/reference-seeds.generated.d.ts.map +1 -0
- package/dist/hooks/magic-context/send-session-notification.d.ts +1 -1
- package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -1
- package/dist/hooks/magic-context/system-prompt-hash.d.ts +5 -6
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/tokenizer-calibration.d.ts +6 -0
- package/dist/hooks/magic-context/tokenizer-calibration.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +0 -7
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +18 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +9 -7
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/upgrade-reminder.d.ts +73 -0
- package/dist/hooks/magic-context/upgrade-reminder.d.ts.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9258 -3915
- package/dist/plugin/conflict-warning-hook.d.ts +13 -0
- package/dist/plugin/conflict-warning-hook.d.ts.map +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/plugin/messages-transform.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/plugin/tool-registry.d.ts.map +1 -1
- package/dist/shared/announcement.d.ts +1 -1
- package/dist/shared/announcement.d.ts.map +1 -1
- package/dist/shared/rpc-client.d.ts +1 -0
- package/dist/shared/rpc-client.d.ts.map +1 -1
- package/dist/shared/rpc-notifications.d.ts +27 -5
- package/dist/shared/rpc-notifications.d.ts.map +1 -1
- package/dist/shared/rpc-server.d.ts +1 -0
- package/dist/shared/rpc-server.d.ts.map +1 -1
- package/dist/shared/rpc-types.d.ts +30 -2
- package/dist/shared/rpc-types.d.ts.map +1 -1
- package/dist/shared/rpc-utils.d.ts +9 -0
- package/dist/shared/rpc-utils.d.ts.map +1 -1
- package/dist/shared/sqlite-helpers.d.ts +7 -7
- package/dist/shared/sqlite.d.ts +23 -14
- package/dist/shared/sqlite.d.ts.map +1 -1
- package/dist/shared/tag-transcript.d.ts +10 -1
- package/dist/shared/tag-transcript.d.ts.map +1 -1
- package/dist/tools/ctx-expand/tools.d.ts +5 -1
- package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
- package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
- package/dist/tui/data/context-db.d.ts +16 -1
- package/dist/tui/data/context-db.d.ts.map +1 -1
- package/package.json +2 -4
- package/src/shared/announcement.ts +6 -7
- package/src/shared/rpc-client.test.ts +49 -2
- package/src/shared/rpc-client.ts +19 -9
- package/src/shared/rpc-notifications.test.ts +54 -1
- package/src/shared/rpc-notifications.ts +82 -13
- package/src/shared/rpc-server.ts +33 -4
- package/src/shared/rpc-types.ts +30 -2
- package/src/shared/rpc-utils.ts +10 -0
- package/src/shared/sqlite-helpers.ts +9 -9
- package/src/shared/sqlite.ts +99 -80
- package/src/shared/tag-transcript.test.ts +280 -0
- package/src/shared/tag-transcript.ts +162 -33
- package/src/tui/data/context-db.ts +75 -11
- package/src/tui/index.tsx +223 -32
- package/src/tui/slots/sidebar-content.tsx +366 -34
- package/dist/hooks/magic-context/compartment-runner-compressor.d.ts +0 -87
- package/dist/hooks/magic-context/compartment-runner-compressor.d.ts.map +0 -1
- package/dist/shared/native-binding.d.ts +0 -87
- package/dist/shared/native-binding.d.ts.map +0 -1
- package/src/shared/native-binding.ts +0 -311
|
@@ -40,16 +40,17 @@
|
|
|
40
40
|
* # What each agent needs
|
|
41
41
|
*
|
|
42
42
|
* - **historian / historian-editor / compressor**: `read` plus the
|
|
43
|
-
* read-only AFT navigation tools `aft_outline
|
|
44
|
-
* The runner offloads large existing-state XML to
|
|
45
|
-
* under `<project>/.opencode/magic-context/historian/`
|
|
46
|
-
* prompt instructs the model to read that file. AFT
|
|
47
|
-
* is allowed so historian can verify a symbol or
|
|
48
|
-
* when writing accurate compartment summaries.
|
|
49
|
-
*
|
|
50
|
-
* - **dreamer**: `read`, `grep`, `glob`, `bash`,
|
|
51
|
-
* navigation tools `aft_outline
|
|
52
|
-
* Context MCP tools `ctx_memory`,
|
|
43
|
+
* read-only AFT navigation/search tools `aft_outline`, `aft_zoom`,
|
|
44
|
+
* and `aft_search`. The runner offloads large existing-state XML to
|
|
45
|
+
* a temp file under `<project>/.opencode/magic-context/historian/`
|
|
46
|
+
* and the prompt instructs the model to read that file. AFT
|
|
47
|
+
* navigation is allowed so historian can find or verify a symbol or
|
|
48
|
+
* file structure when writing accurate compartment summaries.
|
|
49
|
+
*
|
|
50
|
+
* - **dreamer**: `read`, `grep`, `glob`, `bash`, `write`, `edit`, the
|
|
51
|
+
* read-only AFT navigation/search tools `aft_outline`, `aft_zoom`,
|
|
52
|
+
* `aft_search`, plus the Magic Context MCP tools `ctx_memory`,
|
|
53
|
+
* `ctx_search`, `ctx_note`.
|
|
53
54
|
* Dreamer task prompts in
|
|
54
55
|
* `features/magic-context/dreamer/task-prompts.ts` explicitly tell
|
|
55
56
|
* the model to grep schema files for defaults, read source to
|
|
@@ -95,7 +96,7 @@ export declare function buildAllowOnlyPermission(allowedTools: readonly string[]
|
|
|
95
96
|
* websearch. Historian's job is summarizing the input it was given,
|
|
96
97
|
* not exploring the repo.
|
|
97
98
|
*/
|
|
98
|
-
export declare const HISTORIAN_ALLOWED_TOOLS: readonly ["read", "aft_outline", "aft_zoom"];
|
|
99
|
+
export declare const HISTORIAN_ALLOWED_TOOLS: readonly ["read", "aft_outline", "aft_zoom", "aft_search"];
|
|
99
100
|
/**
|
|
100
101
|
* Tools the dreamer agent needs. This is the broadest hidden-agent
|
|
101
102
|
* surface because dreamer's tasks legitimately require local-repo
|
|
@@ -116,15 +117,29 @@ export declare const HISTORIAN_ALLOWED_TOOLS: readonly ["read", "aft_outline", "
|
|
|
116
117
|
* consolidate / verify / improve / archive-stale / smart-notes
|
|
117
118
|
* dreamer child sessions, so removing it would regress real,
|
|
118
119
|
* documented dreamer behavior.
|
|
120
|
+
* - `write` / `edit` — the maintain-docs task (`task-prompts.ts`)
|
|
121
|
+
* explicitly instructs the model to "Write or update using the
|
|
122
|
+
* Write tool" to keep `ARCHITECTURE.md` / `STRUCTURE.md` at the
|
|
123
|
+
* project root synchronized. Without these tools the dreamer was
|
|
124
|
+
* forced to emit docs through `bash` heredocs/`sed` — fragile and
|
|
125
|
+
* hard to review. Granting `write` + `edit` lets it use the proper
|
|
126
|
+
* file tools (which back up + validate) instead.
|
|
127
|
+
* - `aft_search` — primary read-only code search for the verify /
|
|
128
|
+
* improve / maintain-docs tasks; finds the symbols and call sites a
|
|
129
|
+
* doc/memory rewrite must describe, more precisely than raw `grep`.
|
|
119
130
|
*
|
|
120
131
|
* Deliberately NOT allowed:
|
|
121
132
|
* - `task` — no subagent fanout from dreamer
|
|
122
|
-
* - `edit` / `write` — dreamer must not modify project files;
|
|
123
|
-
* `task-prompts.ts` explicitly states "Do not commit changes"
|
|
124
133
|
* - `webfetch` / `websearch` — out of scope; smart-note URL fetches
|
|
125
134
|
* go through `bash` + `curl` instead
|
|
135
|
+
*
|
|
136
|
+
* Note: `write` / `edit` grant general file-write capability (the
|
|
137
|
+
* permission gate is tool-level, not path-level). Dreamer is a trusted
|
|
138
|
+
* hidden agent whose prompts scope writes to docs + memory; the
|
|
139
|
+
* task-prompts still say "Do not commit changes," so it edits the
|
|
140
|
+
* working tree but never commits.
|
|
126
141
|
*/
|
|
127
|
-
export declare const DREAMER_ALLOWED_TOOLS: readonly ["read", "grep", "glob", "bash", "aft_outline", "aft_zoom", "ctx_memory", "ctx_search", "ctx_note"];
|
|
142
|
+
export declare const DREAMER_ALLOWED_TOOLS: readonly ["read", "grep", "glob", "bash", "write", "edit", "aft_outline", "aft_zoom", "aft_search", "ctx_memory", "ctx_search", "ctx_note"];
|
|
128
143
|
/**
|
|
129
144
|
* Tools the sidekick agent needs. Sidekick is a read-only memory
|
|
130
145
|
* retriever for `/ctx-aug` — it queries the project's memory store
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../src/agents/permissions.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"permissions.d.ts","sourceRoot":"","sources":["../../src/agents/permissions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AAEH;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CACpC,YAAY,EAAE,SAAS,MAAM,EAAE,GAChC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,CAMlC;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,uBAAuB,4DAA6D,CAAC;AAElG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,eAAO,MAAM,qBAAqB,6IAaxB,CAAC;AAEX;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,sBAAsB,kEAKzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,kBAAkB,EAA4B,MAAM,wBAAwB,CAAC;AAG3F,MAAM,WAAW,wBAAyB,SAAQ,kBAAkB;IAChE,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,CACZ,MAAM,EACN;QACI,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,OAAO,CAAC;KACrB,CACJ,CAAC;CACL;AAmBD,MAAM,MAAM,WAAW,GACjB,IAAI,GACJ,0BAA0B,GAC1B,uBAAuB,GACvB,iBAAiB,GACjB,sBAAsB,CAAC;AAE7B,MAAM,WAAW,kBAAkB;IAC/B,MAAM,EAAE,wBAAwB,GAAG;QAAE,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;IACjE,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,EAAE;QACL,UAAU,EAAE,WAAW,CAAC;QACxB,aAAa,EAAE,WAAW,CAAC;KAC9B,CAAC;IACF,oBAAoB,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC9F,qBAAqB,EAAE,MAAM,EAAE,CAAC;CACnC;AAyPD,wBAAgB,gBAAgB,CAC5B,SAAS,EAAE,MAAM,GAClB,wBAAwB,GAAG;IAAE,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,CA2E1D;AAgDD,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,kBAAkB,CAuE9E"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Startup-time shim for graduated experimental features (shared OpenCode + Pi).
|
|
3
|
+
*
|
|
4
|
+
* Features have graduated out of the `experimental.*` namespace across releases:
|
|
5
|
+
* - v0.14: `experimental.user_memories` / `experimental.pin_key_files` →
|
|
6
|
+
* `dreamer.user_memories` / `dreamer.pin_key_files`.
|
|
7
|
+
* - this release: `experimental.temporal_awareness` / `caveman_text_compression`
|
|
8
|
+
* → top-level keys; `experimental.auto_search` / `git_commit_indexing` →
|
|
9
|
+
* `memory.auto_search` / `memory.git_commit_indexing`.
|
|
10
|
+
*
|
|
11
|
+
* Doctor runs an on-disk migration, but users who never run doctor would
|
|
12
|
+
* otherwise lose their opt-in/opt-out because the graduated keys are no longer
|
|
13
|
+
* in the schema — Zod silently strips unknown keys. This shim runs in-memory on
|
|
14
|
+
* every load: if the user has legacy `experimental.<graduated-key>` blocks, it
|
|
15
|
+
* reshapes the raw config so the new schema sees them at their graduated path.
|
|
16
|
+
* The on-disk file stays untouched (doctor is the tool that cleans it up), and
|
|
17
|
+
* the user's explicit intent is preserved for this session's runtime behavior.
|
|
18
|
+
*
|
|
19
|
+
* Primitive values (e.g., `experimental.user_memories: true`) are coerced to
|
|
20
|
+
* `{ enabled: <bool> }` object form so Zod accepts them. Without this coercion,
|
|
21
|
+
* the primitive would fail schema validation and fall back to the graduated
|
|
22
|
+
* default — silently flipping a user's explicit `false` to the new `true`
|
|
23
|
+
* default, or vice versa.
|
|
24
|
+
*
|
|
25
|
+
* Idempotent: if the destination path already has a value, the destination wins
|
|
26
|
+
* (the user has started graduating), merging sub-fields so nothing is lost.
|
|
27
|
+
*/
|
|
28
|
+
export declare function migrateLegacyExperimental(rawConfig: Record<string, unknown>, warnings: string[]): Record<string, unknown>;
|
|
29
|
+
//# sourceMappingURL=migrate-experimental.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate-experimental.d.ts","sourceRoot":"","sources":["../../src/config/migrate-experimental.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,yBAAyB,CACrC,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,QAAQ,EAAE,MAAM,EAAE,GACnB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CA8HzB"}
|
|
@@ -4,20 +4,6 @@ export declare const DEFAULT_EXECUTE_THRESHOLD_PERCENTAGE = 65;
|
|
|
4
4
|
export declare const DEFAULT_HISTORIAN_TIMEOUT_MS = 300000;
|
|
5
5
|
export declare const DEFAULT_HISTORY_BUDGET_PERCENTAGE = 0.15;
|
|
6
6
|
export declare const DEFAULT_LOCAL_EMBEDDING_MODEL = "Xenova/all-MiniLM-L6-v2";
|
|
7
|
-
/** Compressor defaults — see CompressorConfigSchema below for details. */
|
|
8
|
-
export declare const DEFAULT_COMPRESSOR_MIN_COMPARTMENT_RATIO = 1000;
|
|
9
|
-
export declare const DEFAULT_COMPRESSOR_MAX_MERGE_DEPTH = 5;
|
|
10
|
-
export declare const DEFAULT_COMPRESSOR_COOLDOWN_MS = 600000;
|
|
11
|
-
/** Max compartments merged in one LLM pass. LLM quality degrades with larger inputs,
|
|
12
|
-
* and smaller batches reduce ordinal-drift risk when the model outputs merged boundaries. */
|
|
13
|
-
export declare const DEFAULT_COMPRESSOR_MAX_COMPARTMENTS_PER_PASS = 15;
|
|
14
|
-
/** Number of newest compartments always excluded from compression.
|
|
15
|
-
* Protects freshly-published historian compartments from immediate re-compression,
|
|
16
|
-
* which would lose narrative quality before the agent has even used the compartment. */
|
|
17
|
-
export declare const DEFAULT_COMPRESSOR_GRACE_COMPARTMENTS = 10;
|
|
18
|
-
/** Output count at each depth = ceil(input / ratio).
|
|
19
|
-
* Lower ratios = gentler compression. Depth 5 is title-only (no LLM call). */
|
|
20
|
-
export declare const COMPRESSOR_MERGE_RATIO_BY_DEPTH: Record<number, number>;
|
|
21
7
|
export declare const DREAMER_TASKS: readonly ["consolidate", "verify", "archive-stale", "improve", "maintain-docs"];
|
|
22
8
|
export declare const DreamingTaskSchema: z.ZodEnum<{
|
|
23
9
|
consolidate: "consolidate";
|
|
@@ -311,6 +297,11 @@ export interface MagicContextConfig {
|
|
|
311
297
|
enabled: boolean;
|
|
312
298
|
min_clusters: number;
|
|
313
299
|
};
|
|
300
|
+
/** Per-connection SQLite tuning for Magic Context's own context.db. */
|
|
301
|
+
sqlite: {
|
|
302
|
+
cache_size_mb: number;
|
|
303
|
+
mmap_size_mb: number;
|
|
304
|
+
};
|
|
314
305
|
/**
|
|
315
306
|
* Controls whether and where Magic Context augments the system prompt
|
|
316
307
|
* (`## Magic Context` guidance, `<project-docs>`, `<user-profile>`,
|
|
@@ -332,32 +323,42 @@ export interface MagicContextConfig {
|
|
|
332
323
|
*/
|
|
333
324
|
skip_signatures: string[];
|
|
334
325
|
};
|
|
335
|
-
|
|
326
|
+
/** Inject elapsed-time markers between user messages and date ranges on
|
|
327
|
+
* compartments so the agent has a wall-clock sense of the session.
|
|
328
|
+
* Graduated from `experimental.temporal_awareness`; default: true. */
|
|
329
|
+
temporal_awareness: boolean;
|
|
330
|
+
/**
|
|
331
|
+
* Age-tier caveman compression for long user/assistant text parts.
|
|
332
|
+
* Graduated from `experimental.caveman_text_compression`; opt-in, default off.
|
|
333
|
+
*
|
|
334
|
+
* Only active when `ctx_reduce_enabled: false`. Buckets eligible
|
|
335
|
+
* (outside-protected-tail) messages into four age tiers by tag
|
|
336
|
+
* position — oldest 20% → ultra, next 20% → full, next 20% → lite,
|
|
337
|
+
* newest 40% → untouched — and rewrites the text part in place.
|
|
338
|
+
* Always compresses from the original source (source_contents), so
|
|
339
|
+
* tier shifts produce the same result as if the target depth were
|
|
340
|
+
* applied directly to the original text.
|
|
341
|
+
*
|
|
342
|
+
* Disabled by default because it rewrites agent-visible history.
|
|
343
|
+
*/
|
|
344
|
+
caveman_text_compression: {
|
|
336
345
|
enabled: boolean;
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
cooldown_ms: number;
|
|
340
|
-
max_compartments_per_pass: number;
|
|
341
|
-
grace_compartments: number;
|
|
346
|
+
/** Text parts shorter than this (characters) are left untouched. */
|
|
347
|
+
min_chars: number;
|
|
342
348
|
};
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
* commit history without running git log manually. */
|
|
350
|
-
git_commit_indexing: {
|
|
351
|
-
enabled: boolean;
|
|
352
|
-
/** Days of history to index (default: 365) */
|
|
353
|
-
since_days: number;
|
|
354
|
-
/** Max commits kept per project; oldest evicted (default: 2000) */
|
|
355
|
-
max_commits: number;
|
|
356
|
-
};
|
|
349
|
+
embedding: EmbeddingConfig;
|
|
350
|
+
memory: {
|
|
351
|
+
enabled: boolean;
|
|
352
|
+
injection_budget_tokens: number;
|
|
353
|
+
auto_promote: boolean;
|
|
354
|
+
retrieval_count_promotion_threshold: number;
|
|
357
355
|
/** Appends a compact hint to new user messages when ctx_search finds
|
|
358
|
-
* highly-related memories,
|
|
359
|
-
* full content — just vague fragments that nudge the agent to
|
|
360
|
-
* ctx_search for full context if relevant.
|
|
356
|
+
* highly-related memories, conversation, or git commits. Does NOT
|
|
357
|
+
* inject full content — just vague fragments that nudge the agent to
|
|
358
|
+
* run ctx_search for full context if relevant. Graduated from
|
|
359
|
+
* `experimental.auto_search`; enabled by default. Independent of
|
|
360
|
+
* `memory.enabled` — it can still surface conversation/git hints when
|
|
361
|
+
* the memory store is off. */
|
|
361
362
|
auto_search: {
|
|
362
363
|
enabled: boolean;
|
|
363
364
|
/** Top hit score must exceed this threshold for the hint to fire. */
|
|
@@ -365,32 +366,19 @@ export interface MagicContextConfig {
|
|
|
365
366
|
/** Minimum user message length in characters (skip short prompts). */
|
|
366
367
|
min_prompt_chars: number;
|
|
367
368
|
};
|
|
368
|
-
/**
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
|
|
374
|
-
* newest 40% → untouched — and rewrites the text part in place.
|
|
375
|
-
* Always compresses from the original source (source_contents), so
|
|
376
|
-
* tier shifts produce the same result as if the target depth were
|
|
377
|
-
* applied directly to the original text.
|
|
378
|
-
*
|
|
379
|
-
* Disabled by default because it rewrites agent-visible history.
|
|
380
|
-
*/
|
|
381
|
-
caveman_text_compression: {
|
|
369
|
+
/** Index git commit messages from HEAD into a new ctx_search source so
|
|
370
|
+
* agents can recall recent regressions, fixes, and decisions from
|
|
371
|
+
* commit history without running git log manually. Graduated from
|
|
372
|
+
* `experimental.git_commit_indexing`; opt-in, default off. Independent
|
|
373
|
+
* of `memory.enabled`. */
|
|
374
|
+
git_commit_indexing: {
|
|
382
375
|
enabled: boolean;
|
|
383
|
-
/**
|
|
384
|
-
|
|
376
|
+
/** Days of history to index (default: 365) */
|
|
377
|
+
since_days: number;
|
|
378
|
+
/** Max commits kept per project; oldest evicted (default: 2000) */
|
|
379
|
+
max_commits: number;
|
|
385
380
|
};
|
|
386
381
|
};
|
|
387
|
-
embedding: EmbeddingConfig;
|
|
388
|
-
memory: {
|
|
389
|
-
enabled: boolean;
|
|
390
|
-
injection_budget_tokens: number;
|
|
391
|
-
auto_promote: boolean;
|
|
392
|
-
retrieval_count_promotion_threshold: number;
|
|
393
|
-
};
|
|
394
382
|
sidekick?: SidekickConfig;
|
|
395
383
|
}
|
|
396
384
|
export declare const MagicContextConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
@@ -559,13 +547,9 @@ export declare const MagicContextConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
559
547
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
560
548
|
skip_signatures: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
561
549
|
}, z.core.$strip>>;
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
max_merge_depth: z.ZodDefault<z.ZodNumber>;
|
|
566
|
-
cooldown_ms: z.ZodDefault<z.ZodNumber>;
|
|
567
|
-
max_compartments_per_pass: z.ZodDefault<z.ZodNumber>;
|
|
568
|
-
grace_compartments: z.ZodDefault<z.ZodNumber>;
|
|
550
|
+
sqlite: z.ZodDefault<z.ZodObject<{
|
|
551
|
+
cache_size_mb: z.ZodDefault<z.ZodNumber>;
|
|
552
|
+
mmap_size_mb: z.ZodDefault<z.ZodNumber>;
|
|
569
553
|
}, z.core.$strip>>;
|
|
570
554
|
embedding: z.ZodDefault<z.ZodPipe<z.ZodObject<{
|
|
571
555
|
provider: z.ZodDefault<z.ZodEnum<{
|
|
@@ -593,29 +577,27 @@ export declare const MagicContextConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
593
577
|
endpoint?: string | undefined;
|
|
594
578
|
api_key?: string | undefined;
|
|
595
579
|
}>>>;
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
580
|
+
temporal_awareness: z.ZodDefault<z.ZodBoolean>;
|
|
581
|
+
caveman_text_compression: z.ZodDefault<z.ZodObject<{
|
|
582
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
583
|
+
min_chars: z.ZodDefault<z.ZodNumber>;
|
|
584
|
+
}, z.core.$strip>>;
|
|
585
|
+
memory: z.ZodDefault<z.ZodObject<{
|
|
586
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
587
|
+
injection_budget_tokens: z.ZodDefault<z.ZodNumber>;
|
|
588
|
+
auto_promote: z.ZodDefault<z.ZodBoolean>;
|
|
589
|
+
retrieval_count_promotion_threshold: z.ZodDefault<z.ZodNumber>;
|
|
603
590
|
auto_search: z.ZodDefault<z.ZodObject<{
|
|
604
591
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
605
592
|
score_threshold: z.ZodDefault<z.ZodNumber>;
|
|
606
593
|
min_prompt_chars: z.ZodDefault<z.ZodNumber>;
|
|
607
594
|
}, z.core.$strip>>;
|
|
608
|
-
|
|
595
|
+
git_commit_indexing: z.ZodDefault<z.ZodObject<{
|
|
609
596
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
610
|
-
|
|
597
|
+
since_days: z.ZodDefault<z.ZodNumber>;
|
|
598
|
+
max_commits: z.ZodDefault<z.ZodNumber>;
|
|
611
599
|
}, z.core.$strip>>;
|
|
612
600
|
}, z.core.$strip>>;
|
|
613
|
-
memory: z.ZodDefault<z.ZodObject<{
|
|
614
|
-
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
615
|
-
injection_budget_tokens: z.ZodDefault<z.ZodNumber>;
|
|
616
|
-
auto_promote: z.ZodDefault<z.ZodBoolean>;
|
|
617
|
-
retrieval_count_promotion_threshold: z.ZodDefault<z.ZodNumber>;
|
|
618
|
-
}, z.core.$strip>>;
|
|
619
601
|
sidekick: z.ZodOptional<z.ZodObject<{
|
|
620
602
|
model: z.ZodOptional<z.ZodString>;
|
|
621
603
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
@@ -702,13 +684,9 @@ export declare const MagicContextConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
702
684
|
enabled: boolean;
|
|
703
685
|
skip_signatures: string[];
|
|
704
686
|
};
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
max_merge_depth: number;
|
|
709
|
-
cooldown_ms: number;
|
|
710
|
-
max_compartments_per_pass: number;
|
|
711
|
-
grace_compartments: number;
|
|
687
|
+
sqlite: {
|
|
688
|
+
cache_size_mb: number;
|
|
689
|
+
mmap_size_mb: number;
|
|
712
690
|
};
|
|
713
691
|
embedding: {
|
|
714
692
|
provider: "local";
|
|
@@ -722,29 +700,27 @@ export declare const MagicContextConfigSchema: z.ZodPipe<z.ZodObject<{
|
|
|
722
700
|
provider: "off";
|
|
723
701
|
model?: undefined;
|
|
724
702
|
};
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
703
|
+
temporal_awareness: boolean;
|
|
704
|
+
caveman_text_compression: {
|
|
705
|
+
enabled: boolean;
|
|
706
|
+
min_chars: number;
|
|
707
|
+
};
|
|
708
|
+
memory: {
|
|
709
|
+
enabled: boolean;
|
|
710
|
+
injection_budget_tokens: number;
|
|
711
|
+
auto_promote: boolean;
|
|
712
|
+
retrieval_count_promotion_threshold: number;
|
|
732
713
|
auto_search: {
|
|
733
714
|
enabled: boolean;
|
|
734
715
|
score_threshold: number;
|
|
735
716
|
min_prompt_chars: number;
|
|
736
717
|
};
|
|
737
|
-
|
|
718
|
+
git_commit_indexing: {
|
|
738
719
|
enabled: boolean;
|
|
739
|
-
|
|
720
|
+
since_days: number;
|
|
721
|
+
max_commits: number;
|
|
740
722
|
};
|
|
741
723
|
};
|
|
742
|
-
memory: {
|
|
743
|
-
enabled: boolean;
|
|
744
|
-
injection_budget_tokens: number;
|
|
745
|
-
auto_promote: boolean;
|
|
746
|
-
retrieval_count_promotion_threshold: number;
|
|
747
|
-
};
|
|
748
724
|
auto_update?: boolean | undefined;
|
|
749
725
|
historian?: {
|
|
750
726
|
two_pass: boolean;
|
|
@@ -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;AAKxB,eAAO,MAAM,6BAA6B,QAAS,CAAC;AACpD,eAAO,MAAM,oCAAoC,KAAK,CAAC;AACvD,eAAO,MAAM,4BAA4B,SAAU,CAAC;AACpD,eAAO,MAAM,iCAAiC,OAAO,CAAC;AACtD,eAAO,MAAM,6BAA6B,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2L/B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/features/builtin-commands/commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,wBAAgB,8BAA8B,IAAI,oBAAoB,
|
|
1
|
+
{"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../../../src/features/builtin-commands/commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAEpD,wBAAgB,8BAA8B,IAAI,oBAAoB,CA6BrE"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Database } from "../../shared/sqlite";
|
|
2
|
+
/**
|
|
3
|
+
* Compartment P1 embedding (v2 / E2).
|
|
4
|
+
*
|
|
5
|
+
* The LOCKED substrate decision: `p1_embedding` is computed + stored on EVERY
|
|
6
|
+
* compartment publish, even though the historian no longer uses embedding to
|
|
7
|
+
* pick its own reference block (that switched to recency). The embedding exists
|
|
8
|
+
* for two consumers:
|
|
9
|
+
* - ctx_search semantic retrieval over compartments (E2 consumption),
|
|
10
|
+
* - future dreamer cross-compartment linking (e.g. "key-files 2 months ago
|
|
11
|
+
* ↔ key-files now").
|
|
12
|
+
*
|
|
13
|
+
* Fire-and-forget + best-effort, mirroring memory promotion: a missing/slow
|
|
14
|
+
* embedding provider must never block or fail a historian publish. Gated by the
|
|
15
|
+
* same `memory.enabled` / `auto_promote` flags as memory promotion (no embedding
|
|
16
|
+
* endpoint hits when memory is off).
|
|
17
|
+
*/
|
|
18
|
+
interface CompartmentToEmbed {
|
|
19
|
+
id: number;
|
|
20
|
+
/** P1 tier text (fullest) — the embedding source. */
|
|
21
|
+
p1: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Embed the P1 text of the given compartments and persist each vector into
|
|
25
|
+
* `compartments.p1_embedding` (+ `p1_embedding_model_id`). Best-effort per row:
|
|
26
|
+
* one failure logs and continues. Never throws.
|
|
27
|
+
*
|
|
28
|
+
* `embedTextForProject` resolves the project's configured provider/model, so the
|
|
29
|
+
* stored `model_id` stays consistent with memory embeddings for the same project
|
|
30
|
+
* (vector compatibility for cross-corpus search later).
|
|
31
|
+
*/
|
|
32
|
+
export declare function embedAndStoreCompartments(db: Database, sessionId: string, projectPath: string, compartments: readonly CompartmentToEmbed[]): Promise<void>;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=compartment-embedding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compartment-embedding.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/compartment-embedding.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGpD;;;;;;;;;;;;;;;GAeG;AAEH,UAAU,kBAAkB;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,qDAAqD;IACrD,EAAE,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,CAC3C,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,SAAS,kBAAkB,EAAE,GAC5C,OAAO,CAAC,IAAI,CAAC,CAqBf"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { Database } from "../../shared/sqlite";
|
|
2
|
+
/**
|
|
3
|
+
* Compartment events storage (v2 / E2).
|
|
4
|
+
*
|
|
5
|
+
* The historian extracts discrete events (`causal_incident`,
|
|
6
|
+
* `trajectory_correction`, and any future kinds) while compartmentalizing. v2.0
|
|
7
|
+
* STORES these events but does NOT render them — they are a corpus for a future
|
|
8
|
+
* dreamer aggregation/steering feature (cross-session pattern detection). Parsed
|
|
9
|
+
* kind-agnostically (`kind` = element name, `fields` = child elements), so a new
|
|
10
|
+
* event kind or field needs no schema change — `fields` round-trips as JSON.
|
|
11
|
+
*
|
|
12
|
+
* Anchoring: `at_compartment="N"` is a 1-based index INTO THE CURRENT PUBLISH's
|
|
13
|
+
* emitted compartment list. We resolve it to the `compartment_id` of the matching
|
|
14
|
+
* persisted row at store time. When resolution fails (out-of-range index, e.g. an
|
|
15
|
+
* event anchored to a discard-last compartment), `compartment_id` is NULL and we
|
|
16
|
+
* keep the raw `at_compartment` for debugging.
|
|
17
|
+
*
|
|
18
|
+
* Durability caveat: `compartment_id` is a bare INTEGER (no FK). It points at the
|
|
19
|
+
* compartment row that existed at store time. Full/partial recomp deletes and
|
|
20
|
+
* re-inserts compartment rows, so a stored `compartment_id` can become stale
|
|
21
|
+
* (dangling) after recomp. This is acceptable for v2.0 because events are
|
|
22
|
+
* STORED-ONLY (not rendered or consumed yet); the future dreamer aggregation
|
|
23
|
+
* feature that reads events must re-anchor or tolerate dangling ids. Do NOT rely
|
|
24
|
+
* on `compartment_id` surviving recomp.
|
|
25
|
+
*/
|
|
26
|
+
export interface CompartmentEventInput {
|
|
27
|
+
/** Event element name, e.g. "causal_incident" | "trajectory_correction". */
|
|
28
|
+
kind: string;
|
|
29
|
+
/** 1-based index into the publish's emitted compartments; null if absent/invalid. */
|
|
30
|
+
atCompartment: number | null;
|
|
31
|
+
/** Child elements verbatim (e.g. trigger, implication). */
|
|
32
|
+
fields: Record<string, string>;
|
|
33
|
+
}
|
|
34
|
+
export interface StoredCompartmentEvent extends CompartmentEventInput {
|
|
35
|
+
id: number;
|
|
36
|
+
sessionId: string;
|
|
37
|
+
compartmentId: number | null;
|
|
38
|
+
createdAt: number;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Persist historian-extracted events for a publish.
|
|
42
|
+
*
|
|
43
|
+
* @param compartmentIds durable compartment ids for the publish's emitted
|
|
44
|
+
* compartments, in emission order (index i → the (i+1)-th emitted compartment).
|
|
45
|
+
* Used to resolve `at_compartment` (1-based) to a durable `compartment_id`.
|
|
46
|
+
*/
|
|
47
|
+
export declare function insertCompartmentEvents(db: Database, sessionId: string, events: readonly CompartmentEventInput[], compartmentIds: readonly number[]): void;
|
|
48
|
+
/** Load all stored events for a session (newest first). For diagnostics / future dreamer aggregation. */
|
|
49
|
+
export declare function getCompartmentEvents(db: Database, sessionId: string): StoredCompartmentEvent[];
|
|
50
|
+
//# sourceMappingURL=compartment-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compartment-events.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/compartment-events.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,MAAM,WAAW,qBAAqB;IAClC,4EAA4E;IAC5E,IAAI,EAAE,MAAM,CAAC;IACb,qFAAqF;IACrF,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,2DAA2D;IAC3D,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,sBAAuB,SAAQ,qBAAqB;IACjE,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACnC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,SAAS,qBAAqB,EAAE,EACxC,cAAc,EAAE,SAAS,MAAM,EAAE,GAClC,IAAI,CAqBN;AAED,yGAAyG;AACzG,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,sBAAsB,EAAE,CAuB9F"}
|
|
@@ -8,7 +8,19 @@ export interface Compartment {
|
|
|
8
8
|
startMessageId: string;
|
|
9
9
|
endMessageId: string;
|
|
10
10
|
title: string;
|
|
11
|
+
/** v2: P1 tier text (fullest). Legacy rows: flat v1 content. Always present (NOT NULL). */
|
|
11
12
|
content: string;
|
|
13
|
+
/** v2 paraphrase tiers (model B). NULL for legacy=1 rows. */
|
|
14
|
+
p1: string | null;
|
|
15
|
+
p2: string | null;
|
|
16
|
+
p3: string | null;
|
|
17
|
+
p4: string | null;
|
|
18
|
+
/** Decay-rate signal (1-100). Defaults to 50. */
|
|
19
|
+
importance: number;
|
|
20
|
+
/** Comma-separated activity types (e.g. "design,feature"). NULL for legacy rows. */
|
|
21
|
+
episodeType: string | null;
|
|
22
|
+
/** 1 = pre-v2 flat compartment (no tiers); 0 = v2 tiered. */
|
|
23
|
+
legacy: number;
|
|
12
24
|
createdAt: number;
|
|
13
25
|
}
|
|
14
26
|
export interface SessionFact {
|
|
@@ -26,7 +38,17 @@ export interface CompartmentInput {
|
|
|
26
38
|
startMessageId: string;
|
|
27
39
|
endMessageId: string;
|
|
28
40
|
title: string;
|
|
41
|
+
/** v2: P1 tier text. Legacy/compressor inserts: flat content. */
|
|
29
42
|
content: string;
|
|
43
|
+
/** v2 paraphrase tiers (model B). Omitted/null for legacy or compressor inserts → stored NULL. */
|
|
44
|
+
p1?: string | null;
|
|
45
|
+
p2?: string | null;
|
|
46
|
+
p3?: string | null;
|
|
47
|
+
p4?: string | null;
|
|
48
|
+
/** Decay-rate signal (1-100). Omitted → stored 50. */
|
|
49
|
+
importance?: number | null;
|
|
50
|
+
/** Comma-separated activity types. Omitted/null → stored NULL. */
|
|
51
|
+
episodeType?: string | null;
|
|
30
52
|
}
|
|
31
53
|
export declare function getCompartments(db: Database, sessionId: string): Compartment[];
|
|
32
54
|
export declare function getLastCompartmentEndMessage(db: Database, sessionId: string): number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compartment-storage.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/compartment-storage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAkC,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"compartment-storage.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/compartment-storage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAkC,MAAM,qBAAqB,CAAC;AA8BpF,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,2FAA2F;IAC3F,OAAO,EAAE,MAAM,CAAC;IAChB,6DAA6D;IAC7D,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClB,iDAAiD;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,oFAAoF;IACpF,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,6DAA6D;IAC7D,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAA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,EACZ,SAAS,EAAE,MAAM,GAClB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAcvC;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACjC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAC7C,IAAI,CASN;AAoDD,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAO/C;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAElD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lease.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/lease.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAkBvD,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAGnD;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAE1D;AAED,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAOtF;
|
|
1
|
+
{"version":3,"file":"lease.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/lease.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAkBvD,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAGnD;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAE1D;AAED,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAOtF;AA8BD,wBAAgB,YAAY,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAepE;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAWlE;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAUjE"}
|
|
@@ -8,6 +8,7 @@ export interface DreamQueueEntry {
|
|
|
8
8
|
startedAt: number | null;
|
|
9
9
|
}
|
|
10
10
|
export declare function ensureDreamQueueTable(db: Database): void;
|
|
11
|
+
export declare function hasActiveDreamLease(db: Database): boolean;
|
|
11
12
|
/** Enqueue a project for dreaming. Skips if the same project already has any queue entry (queued or running).
|
|
12
13
|
*
|
|
13
14
|
* @param force - When true (e.g. manual /ctx-dream), uses the lease TTL (2 min) as the stale threshold
|
|
@@ -39,6 +40,16 @@ export declare function removeDreamEntry(db: Database, id: number): void;
|
|
|
39
40
|
export declare function resetDreamEntry(db: Database, id: number): void;
|
|
40
41
|
/** Get the retry count for a queue entry. */
|
|
41
42
|
export declare function getEntryRetryCount(db: Database, id: number): number;
|
|
42
|
-
/**
|
|
43
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Clear stale started entries (stuck for more than maxAgeMs).
|
|
45
|
+
*
|
|
46
|
+
* Callers MUST gate this on `!hasActiveDreamLease(db)` — a healthy long-running
|
|
47
|
+
* dream can exceed `maxAgeMs` while still renewing its lease, and deleting its
|
|
48
|
+
* own row mid-run is the bug this guard prevents (mirrors the enqueue path).
|
|
49
|
+
*
|
|
50
|
+
* `projectIdentity` scopes the delete to one project. The shared `dream_queue`
|
|
51
|
+
* is cross-process (OpenCode + Pi); a global delete would reap other hosts'
|
|
52
|
+
* still-running rows. Omit only for the legacy "reap any" test path.
|
|
53
|
+
*/
|
|
54
|
+
export declare function clearStaleEntries(db: Database, maxAgeMs: number, projectIdentity?: string): number;
|
|
44
55
|
//# 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,wBAAwB,CAAC;AAGvD,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;
|
|
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,wBAAwB,CAAC;AAGvD,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,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CASzD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CACxB,EAAE,EAAE,QAAQ,EACZ,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,MAAM,EACd,KAAK,UAAQ,GACd,eAAe,GAAG,IAAI,CAsCxB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CA4BxF;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,QAAQ,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAa1F;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;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC7B,EAAE,EAAE,QAAQ,EACZ,QAAQ,EAAE,MAAM,EAChB,eAAe,CAAC,EAAE,MAAM,GACzB,MAAM,CAYR"}
|
|
@@ -71,6 +71,17 @@ export declare function processDreamQueue(args: {
|
|
|
71
71
|
* handler. Tests pass `undefined` to keep the legacy "dequeue any" semantics.
|
|
72
72
|
*/
|
|
73
73
|
projectIdentity?: string;
|
|
74
|
+
/**
|
|
75
|
+
* Filesystem directory of the project THIS draining process owns. Because
|
|
76
|
+
* project identity collapses worktrees/clones to one `git:<sha>`, resolving
|
|
77
|
+
* the execution directory from the shared in-memory map can pick a stale
|
|
78
|
+
* sibling checkout ("last-registered wins"). The drain caller always knows
|
|
79
|
+
* its own live directory, so passing it here guarantees the dream runs in a
|
|
80
|
+
* checkout this process actually registered. Paired with projectIdentity
|
|
81
|
+
* (the queue filter), so the dequeued entry is guaranteed to be this
|
|
82
|
+
* project's. Falls back to the map (then the identity string) when omitted.
|
|
83
|
+
*/
|
|
84
|
+
sessionDirectoryOverride?: string;
|
|
74
85
|
/**
|
|
75
86
|
* Resolved Dreamer fallback chain. See `runDream` for semantics. Callers
|
|
76
87
|
* compute via `resolveFallbackChain(DREAMER_AGENT, pluginConfig.dreamer?.fallback_models)`.
|