@cortexkit/opencode-magic-context 0.21.7 → 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/sidekick/agent.d.ts.map +1 -1
- 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 +5 -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 +2 -1
- 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 +61 -0
- package/dist/features/magic-context/storage-subagent-invocations.d.ts.map +1 -0
- 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 +13 -3
- package/dist/features/magic-context/storage.d.ts.map +1 -1
- package/dist/features/magic-context/subagent-token-capture.d.ts +33 -0
- package/dist/features/magic-context/subagent-token-capture.d.ts.map +1 -0
- 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 +79 -0
- package/dist/features/magic-context/work-metrics.d.ts.map +1 -0
- 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-historian.d.ts +2 -0
- package/dist/hooks/magic-context/compartment-runner-historian.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 +68 -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 +22111 -16352
- 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 +32 -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/subagent-runner.d.ts +5 -0
- package/dist/shared/subagent-runner.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 +32 -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/subagent-runner.ts +14 -0
- package/src/shared/tag-transcript.test.ts +280 -0
- package/src/shared/tag-transcript.ts +162 -33
- package/src/tui/data/context-db.ts +77 -11
- package/src/tui/index.tsx +240 -57
- package/src/tui/slots/sidebar-content.tsx +415 -101
- 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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/runner.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAM3D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/runner.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAM3D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAiDlD,UAAU,6BAA6B;IACnC,OAAO,EAAE,O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C,CAAC;IAChC,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wBAAwB,CAAC,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5E,uBAAuB,CAAC,EAAE,6BAA6B,CAAC;IACxD;;;;;;;;;;;;OAYG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;;;OASG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC;;;OAGG;IACH,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAoEjC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DreamingTask } from "../../../config/schema/magic-context";
|
|
2
|
-
export declare const DREAMER_SYSTEM_PROMPT = "You are a memory maintenance agent for the magic-context system.\nYou run during scheduled dream windows to maintain a project's cross-session memory store and codebase documentation.\n\n## Available Tools\n\n**Memory operations** (ctx_memory with extended dreamer actions):\n- `action=\"list\"` \u2014 browse all active memories, optionally filter by category\n- `action=\"update\", id=N, content=\"...\"` \u2014 rewrite a memory's content\n- `action=\"merge\", ids=[N,M,...], content=\"...\", category=\"...\"` \u2014 consolidate duplicates into one canonical memory\n- `action=\"archive\", id=N, reason=\"...\"` \u2014 archive a stale memory with provenance\n- `action=\"write\", category=\"...\", content=\"...\"` \u2014 create a new memory\n- `action=\"delete\", id=N` \u2014 permanently remove a memory\n\n**Codebase tools** (standard OpenCode tools):\n- Read files, grep, glob, bash \u2014 for verification against actual code\n\n## Rules\n\n1. **Work methodically.** Decide your own batch size based on the task \u2014 process as many items per round as makes sense.\n2. **Always verify against actual files** before declaring a memory stale or updating it.\n3. **Be conservative with archives.** Only archive when the codebase clearly contradicts the memory.\n4. **Explain reasoning briefly** before each action \u2014 one line is enough.\n5. **Use present-tense operational language** in all memory rewrites. \"X uses Y\" not \"X was changed to use Y.\"\n6. **One rule/fact per memory.** Split compound memories during improvement.\n7. **Never read or quote secrets** from .env, credentials, keys, or similar sensitive files.\n8. **Do not commit changes.** The user handles git operations.";
|
|
2
|
+
export declare const DREAMER_SYSTEM_PROMPT = "You are a memory maintenance agent for the magic-context system.\nYou run during scheduled dream windows to maintain a project's cross-session memory store and codebase documentation.\n\n## Available Tools\n\n**Memory operations** (ctx_memory with extended dreamer actions):\n- `action=\"list\"` \u2014 browse all active memories, optionally filter by category\n- `action=\"update\", id=N, content=\"...\"` \u2014 rewrite a memory's content\n- `action=\"merge\", ids=[N,M,...], content=\"...\", category=\"...\"` \u2014 consolidate duplicates into one canonical memory\n- `action=\"archive\", id=N, reason=\"...\"` \u2014 archive a stale memory with provenance\n- `action=\"write\", category=\"...\", content=\"...\"` \u2014 create a new memory\n- `action=\"delete\", id=N` \u2014 permanently remove a memory\n\n**Codebase tools** (standard OpenCode tools):\n- Read files, grep, glob, bash \u2014 for verification against actual code\n\n## Rules\n\n1. **Work methodically.** Decide your own batch size based on the task \u2014 process as many items per round as makes sense.\n2. **Always verify against actual files** before declaring a memory stale or updating it.\n3. **Be conservative with archives.** Only archive when the codebase clearly contradicts the memory.\n4. **Explain reasoning briefly** before each action \u2014 one line is enough.\n5. **Use present-tense operational language** in all memory rewrites. \"X uses Y\" not \"X was changed to use Y.\"\n6. **One rule/fact per memory.** Split compound memories during improvement.\n7. **Never read or quote secrets** from .env, credentials, keys, or similar sensitive files.\n8. **Do not commit changes.** The user handles git operations.\n\n## Memory Taxonomy (5 categories)\n\nProject memory uses exactly 5 categories. Every memory belongs to one:\n- **PROJECT_RULES** \u2014 durable process/workflow rules for this repo (releases, commits, testing, debugging conventions).\n- **ARCHITECTURE** \u2014 load-bearing design decisions and WHY they hold (not WHAT a file does).\n- **CONSTRAINTS** \u2014 hard limits imposed by EXTERNAL systems (APIs, providers, platforms, protocols). Not our own code's behavior.\n- **CONFIG_VALUES** \u2014 stable configuration keys/values and conventions. Not transient measurements (test counts, sizes, versions).\n- **NAMING** \u2014 naming conventions and canonical names. Not inventories.\n\n**Legacy categories during transition:** older memories may still carry pre-v2 category names. When you touch one, map it to its 5-category home with `action=\"update\"` (or `merge`): WORKFLOW_RULES\u2192PROJECT_RULES, ARCHITECTURE_DECISIONS\u2192ARCHITECTURE, CONFIG_DEFAULTS\u2192CONFIG_VALUES, ENVIRONMENT\u2192CONFIG_VALUES (paths) or CONSTRAINTS, KNOWN_ISSUES\u2192CONSTRAINTS only if it's an external-system limit (otherwise archive \u2014 our own fixed bugs are not world facts). USER_DIRECTIVES / USER_PREFERENCES are NOT project categories \u2014 they live in the global user profile; archive project copies only when they add zero project-specific detail.";
|
|
3
3
|
export declare function buildConsolidatePrompt(projectPath: string): string;
|
|
4
4
|
export declare function buildVerifyPrompt(projectPath: string): string;
|
|
5
5
|
export declare function buildArchiveStalePrompt(projectPath: string, userMemories?: Array<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-prompts.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/task-prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAIzE,eAAO,MAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"task-prompts.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/task-prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAIzE,eAAO,MAAM,qBAAqB,o/FAoCulB,CAAC;AAI1nB,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA+BlE;AAID,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAiC7D;AAID,wBAAgB,uBAAuB,CACnC,WAAW,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,KAAK,CAAC;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,GACtD,MAAM,CA0ER;AAID,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA0C9D;AAID,wBAAgB,uBAAuB,CACnC,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GAAG,IAAI,EAC1B,YAAY,EAAE;IAAE,YAAY,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,OAAO,CAAA;CAAE,GAC5D,MAAM,CA+CR;AA0GD,wBAAgB,oBAAoB,CAChC,IAAI,EAAE,YAAY,EAClB,IAAI,EAAE;IACF,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,YAAY,CAAC,EAAE;QAAE,YAAY,EAAE,OAAO,CAAC;QAAC,SAAS,EAAE,OAAO,CAAA;KAAE,CAAC;IAC7D,YAAY,CAAC,EAAE,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACzD,GACF,MAAM,CAiBR"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"git-log-reader.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/git-commits/git-log-reader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAeH,MAAM,WAAW,SAAS;IACtB,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,kDAAkD;IAClD,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,qBAAqB;IAClC,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,qBAA0B,GACpC,OAAO,CAAC,SAAS,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"git-log-reader.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/git-commits/git-log-reader.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAeH,MAAM,WAAW,SAAS;IACtB,wBAAwB;IACxB,GAAG,EAAE,MAAM,CAAC;IACZ,wCAAwC;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,iEAAiE;IACjE,OAAO,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,kDAAkD;IAClD,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,qBAAqB;IAClC,uEAAuE;IACvE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kDAAkD;IAClD,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,GAAE,qBAA0B,GACpC,OAAO,CAAC,SAAS,EAAE,CAAC,CAwDtB;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,CA6C7D"}
|
|
@@ -56,7 +56,7 @@ export declare class KeyFilesValidationError extends Error {
|
|
|
56
56
|
constructor(message: string);
|
|
57
57
|
}
|
|
58
58
|
export declare function computeGenerationConfigHash(config: Pick<V6KeyFilesConfig, "token_budget" | "min_reads">): string;
|
|
59
|
-
export declare function validateLlmOutput(raw: string, config: V6KeyFilesConfig, projectPath: string): ValidatedKeyFilesOutput;
|
|
59
|
+
export declare function validateLlmOutput(raw: string, config: V6KeyFilesConfig, projectPath: string, candidatePaths?: ReadonlySet<string>): ValidatedKeyFilesOutput;
|
|
60
60
|
export declare function commitKeyFiles(args: {
|
|
61
61
|
db: Database;
|
|
62
62
|
projectPath: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identify-key-files.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/key-files/identify-key-files.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAK3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGvD,OAAO,EACH,mBAAmB,EAOtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,YAAY,EAAuB,MAAM,cAAc,CAAC;AAGtE,eAAO,MAAM,uBAAuB,yLACsJ,CAAC;AAE3L;;;GAGG;AACH,wBAAgB,mBAAmB,CAC/B,UAAU,EAAE,YAAY,EAAE,EAC1B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GACjB,MAAM,CAqCR;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAqB7F;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAChC,UAAU,EAAE,QAAQ,EACpB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,gBAAgB,CAAC,EAAE,MAAM,GAC1B,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"identify-key-files.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/key-files/identify-key-files.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MA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ACpB,MAAM,EAAE,gBAAgB,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC,GAAG,OAAO,CAAC;IAAE,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC,CAsFtF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-key-files.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/key-files/project-key-files.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,eAAe,CAAC;AAE7D,MAAM,WAAW,iBAAiB;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,WAAW,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAC1C;AAED,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,oBAAoB,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,MAAM,CAAC;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AAG,OAAO,
|
|
1
|
+
{"version":3,"file":"project-key-files.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/key-files/project-key-files.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,eAAe,CAAC;AAE7D,MAAM,WAAW,iBAAiB;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,WAAW,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAC1C;AAED,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,oBAAoB,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IACxD,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAC1C;AAED,QAAA,MAAM,oBAAoB,cAAc,CAAC;AAGzC,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAO/E;AAiBD,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAY1F;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAM5E;AAED,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAQ7E;AAED,wBAAgB,kBAAkB,CAC9B,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,aAAa,EAAE,GACvB,qBAAqB,EAAE,CAiBzB;AAED,wBAAgB,sBAAsB,CAClC,EAAE,EAAE,QAAQ,EACZ,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,kBAAkB,EAAE,EAC3B,WAAW,SAAa,GACzB,MAAM,CAsCR;AAED,wBAAgB,sBAAsB,CAClC,EAAE,EAAE,QAAQ,EACZ,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,qBAAqB,EAAE,EAC9B,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,GAAG,IAAI,EAC/B,oBAAoB,EAAE,MAAM,GAC7B,IAAI,CAoBN;AAED,wBAAgB,2BAA2B,CAAC,EAAE,EAAE,QAAQ,EAAE,GAAG,SAAa,GAAG,MAAM,CA6BlF;AAED,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAexF;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
|
|
@@ -8,7 +8,7 @@ export interface FileReadStat {
|
|
|
8
8
|
editCount: number;
|
|
9
9
|
/** Byte size of the most recent full read output */
|
|
10
10
|
latestReadBytes: number;
|
|
11
|
-
/**
|
|
11
|
+
/** Token count of the most recent full read's output (real Claude tokenizer) */
|
|
12
12
|
latestReadTokens: number;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-stats.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/key-files/read-stats.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"read-stats.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/key-files/read-stats.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,WAAW,YAAY;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,wBAAwB,EAAE,MAAM,CAAC;IACjC,4EAA4E;IAC5E,SAAS,EAAE,MAAM,CAAC;IAClB,oDAAoD;IACpD,eAAe,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAC/B,UAAU,EAAE,QAAQ,EACpB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACjB,YAAY,EAAE,CAuFhB"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import type { MemoryCategory } from "./types";
|
|
2
2
|
export declare const PROMOTABLE_CATEGORIES: MemoryCategory[];
|
|
3
3
|
export declare const CATEGORY_PRIORITY: MemoryCategory[];
|
|
4
|
+
export declare const MEMORY_CATEGORY_ORDER_UNKNOWN = 99;
|
|
5
|
+
export declare const MEMORY_CATEGORY_ORDER_PRIORITY: Record<MemoryCategory, number>;
|
|
6
|
+
export declare const MEMORY_CATEGORY_ORDER_SQL: string;
|
|
7
|
+
export declare function getMemoryCategoryOrder(category: string): number;
|
|
4
8
|
export declare const CATEGORY_DEFAULT_TTL: Partial<Record<MemoryCategory, number>>;
|
|
5
9
|
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,eAAO,MAAM,qBAAqB,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,eAAO,MAAM,qBAAqB,EAAE,cAAc,EAgBjD,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,cAAc,EAe7C,CAAC;AAEF,eAAO,MAAM,6BAA6B,KAAK,CAAC;AAEhD,eAAO,MAAM,8BAA8B,EAAE,MAAM,CAAC,cAAc,EAAE,MAAM,CAOrE,CAAC;AAEN,eAAO,MAAM,yBAAyB,QAEiB,CAAC;AAExD,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAK/D;AAGD,eAAO,MAAM,oBAAoB,EAAE,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAGxE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embedding-local.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/embedding-local.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"embedding-local.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/embedding-local.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAmU9D,qBAAa,sBAAuB,YAAW,iBAAiB;IAC5D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAkC;IAClD,OAAO,CAAC,WAAW,CAA8B;IACjD,OAAO,CAAC,QAAQ,CAAK;IACrB,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,cAAc,CAA8B;IACpD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAyB;gBAE7C,KAAK,SAAgC;IAK3C,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAuIpC,OAAO,CAAC,sBAAsB;IAS9B,OAAO,CAAC,cAAc;IAShB,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAoCvE,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE,CAAC;IAyCnF,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IA8B9B,QAAQ,IAAI,OAAO;CAGtB"}
|
|
@@ -3,7 +3,7 @@ export * from "./embedding";
|
|
|
3
3
|
export * from "./embedding-backfill";
|
|
4
4
|
export * from "./embedding-cache";
|
|
5
5
|
export * from "./normalize-hash";
|
|
6
|
-
export
|
|
6
|
+
export * from "./project-identity";
|
|
7
7
|
export { promoteSessionFactsToMemory } from "./promotion";
|
|
8
8
|
export * from "./storage-memory";
|
|
9
9
|
export * from "./storage-memory-embeddings";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,2BAA2B,EAAE,MAAM,aAAa,CAAC;AAC1D,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,sBAAsB,CAAC;AACrC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { sessionLog } from "../../../shared/logger";
|
|
2
|
+
import type { Database } from "../../../shared/sqlite";
|
|
3
|
+
import type { Memory, MemoryCategory } from "./types";
|
|
4
|
+
type AnyFn = (...args: any[]) => Promise<unknown>;
|
|
5
|
+
interface MigrationClient {
|
|
6
|
+
session: {
|
|
7
|
+
create: AnyFn;
|
|
8
|
+
prompt: AnyFn;
|
|
9
|
+
messages: AnyFn;
|
|
10
|
+
delete: AnyFn;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Memory migration (v2 / E3.2): re-evaluate a project's existing memories into
|
|
15
|
+
* the 5-category v2 world taxonomy via a one-shot historian-model prompt.
|
|
16
|
+
*
|
|
17
|
+
* Why this exists: pre-v2 memories use the 9-category taxonomy (ARCHITECTURE_DECISIONS,
|
|
18
|
+
* USER_DIRECTIVES, WORKFLOW_RULES, KNOWN_ISSUES, ENVIRONMENT, USER_PREFERENCES, …)
|
|
19
|
+
* collected under LOOSER definitions. v2's 5 categories (PROJECT_RULES, ARCHITECTURE,
|
|
20
|
+
* CONSTRAINTS, CONFIG_VALUES, NAMING) have STRICTER definitions, so this is a quality
|
|
21
|
+
* re-evaluation (drop stale / demote-to-narrative / merge), not a relabel. USER_* traits
|
|
22
|
+
* leave project memory entirely (they belong in the global user-profile store).
|
|
23
|
+
*
|
|
24
|
+
* Runtime shape (locked):
|
|
25
|
+
* - Runs on-demand inside `/ctx-session-upgrade`, ONCE per project (idempotent guard).
|
|
26
|
+
* - Uses the HISTORIAN model/plumbing (not dreamer) so it works even when dreamer is
|
|
27
|
+
* disabled — the historian model is guaranteed present whenever an upgrade is relevant.
|
|
28
|
+
* - Project-scoped: operates on the project's memory pool, shared across sessions.
|
|
29
|
+
*
|
|
30
|
+
* This module owns the PURE pieces (prompt builder, parser, apply, guard). The LLM
|
|
31
|
+
* call + child-session orchestration lives in the caller (command-handler), mirroring
|
|
32
|
+
* how the dreamer/historian invoke `promptSyncWithModelSuggestionRetry`.
|
|
33
|
+
*/
|
|
34
|
+
/** Per-project guard key in `schema_migrations_meta` (precedent: v22 keys). */
|
|
35
|
+
export declare function memoryMigrationGuardKey(projectPath: string): string;
|
|
36
|
+
/** True if this project's memories were already migrated to the 5-cat taxonomy. */
|
|
37
|
+
export declare function isMemoryMigrationDone(db: Database, projectPath: string): boolean;
|
|
38
|
+
/** Mark this project's memory migration complete (idempotent). */
|
|
39
|
+
export declare function markMemoryMigrationDone(db: Database, projectPath: string): void;
|
|
40
|
+
/**
|
|
41
|
+
* Build the migration prompt. Pure + deterministic for a given memory list.
|
|
42
|
+
* The model receives every existing memory (with its legacy category) and the
|
|
43
|
+
* strict 5-category definitions, and must return a single `<migrated>` block.
|
|
44
|
+
*/
|
|
45
|
+
export declare function buildMemoryMigrationPrompt(memories: readonly Memory[]): string;
|
|
46
|
+
export interface MemoryMigrationResult {
|
|
47
|
+
/** Re-categorized project memories (5-cat). */
|
|
48
|
+
memories: Array<{
|
|
49
|
+
category: MemoryCategory;
|
|
50
|
+
content: string;
|
|
51
|
+
}>;
|
|
52
|
+
/** User traits to route to the global user-profile store. */
|
|
53
|
+
userObservations: string[];
|
|
54
|
+
/** True when a well-formed `<migrated>` block was present (even if empty).
|
|
55
|
+
* Distinguishes "model validly migrated to zero project memories" from
|
|
56
|
+
* "unparseable output" so the orchestrator never treats a real empty
|
|
57
|
+
* result as a failure (and never wipes the pool on a parse failure). */
|
|
58
|
+
parsed: boolean;
|
|
59
|
+
}
|
|
60
|
+
/** Parse the migration output. Pure. Unknown categories are ignored (defensive). */
|
|
61
|
+
export declare function parseMemoryMigrationOutput(text: string): MemoryMigrationResult;
|
|
62
|
+
/**
|
|
63
|
+
* Apply a parsed migration result to the project's memory pool, atomically:
|
|
64
|
+
* delete the project's current `active`/`permanent` memories and insert the
|
|
65
|
+
* re-categorized set. Returns counts for the result message.
|
|
66
|
+
*
|
|
67
|
+
* Caller is responsible for routing `userObservations` to the user-profile
|
|
68
|
+
* store (done in the orchestrator, gated by the user_memories feature).
|
|
69
|
+
*
|
|
70
|
+
* Row-state safety: only `active` memories are re-evaluated. `permanent`
|
|
71
|
+
* memories are USER-curated (the user explicitly promoted them), so the
|
|
72
|
+
* migration must NOT LLM-rewrite or delete them — that would silently demote
|
|
73
|
+
* curated knowledge to fresh `active`/`unverified` rows and lose seen/retrieval
|
|
74
|
+
* state. Permanent rows are left exactly as-is; the re-categorized set is
|
|
75
|
+
* inserted alongside them.
|
|
76
|
+
*
|
|
77
|
+
* Embeddings cascade-delete with their memory rows (FK ON DELETE CASCADE,
|
|
78
|
+
* migration v12); new rows get embeddings via the normal best-effort sweep.
|
|
79
|
+
*/
|
|
80
|
+
export declare function applyMemoryMigration(db: Database, projectPath: string, result: MemoryMigrationResult): {
|
|
81
|
+
removed: number;
|
|
82
|
+
inserted: number;
|
|
83
|
+
};
|
|
84
|
+
/** Resolve the project's memory list for the migration prompt.
|
|
85
|
+
* Shows ALL `active` memories (expired included — see
|
|
86
|
+
* getAllActiveMemoriesForMigration) so the LLM re-evaluates the exact set that
|
|
87
|
+
* applyMemoryMigration will delete; `permanent` (user-curated) memories are
|
|
88
|
+
* never re-evaluated, so they're excluded. */
|
|
89
|
+
export declare function loadMemoriesForMigration(db: Database, directory: string): Memory[];
|
|
90
|
+
export interface MemoryMigrationOutcome {
|
|
91
|
+
/** True when the migration actually ran (vs. skipped because already done / empty / disabled). */
|
|
92
|
+
ran: boolean;
|
|
93
|
+
/** Human-readable summary for the command result message. */
|
|
94
|
+
summary: string;
|
|
95
|
+
removed?: number;
|
|
96
|
+
inserted?: number;
|
|
97
|
+
userObservations?: number;
|
|
98
|
+
}
|
|
99
|
+
export interface RunMemoryMigrationDeps {
|
|
100
|
+
client: MigrationClient;
|
|
101
|
+
db: Database;
|
|
102
|
+
/** Session directory used to resolve project identity + route the child session. */
|
|
103
|
+
directory: string;
|
|
104
|
+
/** Parent session id (child session is created under it). */
|
|
105
|
+
parentSessionId: string;
|
|
106
|
+
/** Resolved historian fallback chain (forwarded to the prompt helper). */
|
|
107
|
+
fallbackModels?: readonly string[];
|
|
108
|
+
/** Primary model for the migration child session, as "provider/modelID".
|
|
109
|
+
* When set, this runs FIRST (ahead of the fallback chain) and the historian
|
|
110
|
+
* agent default is NOT used. The upgrade path passes the session's live main
|
|
111
|
+
* model here — it's the user's working interactive model (typically stronger
|
|
112
|
+
* and, unlike a possibly-misconfigured historian model, guaranteed present).
|
|
113
|
+
* When omitted, the chain starts at the historian agent default. */
|
|
114
|
+
primaryModelId?: string;
|
|
115
|
+
/** Prompt timeout. */
|
|
116
|
+
timeoutMs?: number;
|
|
117
|
+
/** When true, route user_observations into the user-memory candidate pool. */
|
|
118
|
+
userMemoriesEnabled?: boolean;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Run the one-shot memory migration for a project.
|
|
122
|
+
*
|
|
123
|
+
* Idempotent: returns `ran: false` immediately if the project's guard is already
|
|
124
|
+
* set, if there are no memories, or if a parse yields nothing. On success it
|
|
125
|
+
* replaces the project's memories with the 5-cat set, routes user observations
|
|
126
|
+
* to the user-memory candidate pool (when enabled), and flips the guard.
|
|
127
|
+
*
|
|
128
|
+
* Uses the HISTORIAN model (via HISTORIAN_AGENT) with a migration-specific system
|
|
129
|
+
* override — works even when the dreamer is disabled.
|
|
130
|
+
*/
|
|
131
|
+
export declare function runMemoryMigration(deps: RunMemoryMigrationDeps): Promise<MemoryMigrationOutcome>;
|
|
132
|
+
export { sessionLog };
|
|
133
|
+
//# sourceMappingURL=memory-migration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"memory-mig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
5
|
* 1. Git repo with commits → root commit hash (same across worktrees, clones, forks)
|
|
6
|
-
* 2. Git repo with no commits → fallback to directory
|
|
7
|
-
* 3. No git repo → fallback to directory
|
|
6
|
+
* 2. Git repo with no commits → fallback to directory hash via resolveProjectIdentity()
|
|
7
|
+
* 3. No git repo → fallback to directory hash via resolveProjectIdentity()
|
|
8
8
|
*
|
|
9
9
|
* The root commit hash is immutable and survives remote renames, host
|
|
10
10
|
* migrations, and SSH/HTTPS URL changes. It is the same across all
|
|
11
11
|
* worktrees and clones of the same repository.
|
|
12
12
|
*/
|
|
13
13
|
/**
|
|
14
|
-
*
|
|
14
|
+
* Type-checked project identity failure classes (Finding #16).
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
16
|
+
* Caller policy:
|
|
17
|
+
* - `not_git_repo` is deterministic: the directory is accessible but has no git root commit, so
|
|
18
|
+
* callers that preserve the production contract may fall back to `dir:<md5-12>`.
|
|
19
|
+
* - `git_missing` and `git_timeout` are transient: callers should retry later or record to
|
|
20
|
+
* `v22_backfill_failures`.
|
|
21
|
+
* - `permission_denied` and `unknown` are not safe to silently coerce during strict resolution:
|
|
22
|
+
* callers should record the failure for explicit recovery.
|
|
23
|
+
*/
|
|
24
|
+
export type ProjectIdentityErrorClass = "not_git_repo" | "git_missing" | "git_timeout" | "permission_denied" | "unknown";
|
|
25
|
+
/**
|
|
26
|
+
* Strict project identity resolution error with stable machine-readable classification.
|
|
27
|
+
*/
|
|
28
|
+
export declare class ProjectIdentityError extends Error {
|
|
29
|
+
readonly errorClass: ProjectIdentityErrorClass;
|
|
30
|
+
readonly rawDirectory: string;
|
|
31
|
+
constructor(errorClass: ProjectIdentityErrorClass, rawDirectory: string, message: string, cause?: Error);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Strictly resolve the project identity for a filesystem directory.
|
|
19
35
|
*
|
|
20
|
-
*
|
|
36
|
+
* Returns only `git:<root-commit-sha>` and never silently falls back. Failures are thrown as
|
|
37
|
+
* `ProjectIdentityError` with a stable `errorClass` so callers can distinguish deterministic
|
|
38
|
+
* non-git directories from transient git/runtime failures.
|
|
39
|
+
*
|
|
40
|
+
* The cache is process-local, keyed by `path.resolve(directory)`, and stores only successful git
|
|
41
|
+
* identities. Transient failures are never cached.
|
|
21
42
|
*/
|
|
43
|
+
export declare function resolveProjectIdentityStrict(directory: string): string;
|
|
22
44
|
export declare function resolveProjectIdentity(directory: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Normalize a stored project path or legacy raw filesystem path.
|
|
47
|
+
*
|
|
48
|
+
* Already-resolved `git:` / `dir:` identities are returned byte-for-byte. Raw filesystem paths are
|
|
49
|
+
* resolved through the production wrapper. This helper is intentionally best-effort for existing
|
|
50
|
+
* stored data: if strict resolution cannot classify the path, it falls back to the deterministic
|
|
51
|
+
* `dir:<md5-12>` identity instead of throwing.
|
|
52
|
+
*/
|
|
53
|
+
export declare function normalizeStoredProjectPath(rawOrStored: string): string;
|
|
23
54
|
//# sourceMappingURL=project-identity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project-identity.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/project-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;
|
|
1
|
+
{"version":3,"file":"project-identity.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/project-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAmBH;;;;;;;;;;GAUG;AACH,MAAM,MAAM,yBAAyB,GAC/B,cAAc,GACd,aAAa,GACb,aAAa,GACb,mBAAmB,GACnB,SAAS,CAAC;AAEhB;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,UAAU,EAAE,yBAAyB,CAAC;IAC/C,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;gBAG1B,UAAU,EAAE,yBAAyB,EACrC,YAAY,EAAE,MAAM,EACpB,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,KAAK;CAUpB;AAwJD;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAmCtE;AAqBD,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CA8BhE;AAaD;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAUtE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-memory-fts.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/storage-memory-fts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAkC,MAAM,wBAAwB,CAAC;AAEvF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"storage-memory-fts.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/storage-memory-fts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAkC,MAAM,wBAAwB,CAAC;AAEvF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAgBtC;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKtD;AAED,wBAAgB,iBAAiB,CAC7B,EAAE,EAAE,QAAQ,EACZ,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,KAAK,SAAuB,GAC7B,MAAM,EAAE,CAgBV"}
|
|
@@ -11,11 +11,25 @@ export interface MemoryCountsByStatus {
|
|
|
11
11
|
archivedIds: number[];
|
|
12
12
|
mergedIds: number[];
|
|
13
13
|
}
|
|
14
|
+
export declare function getMemorySelectColumns(db: Database, tableName?: string): string;
|
|
14
15
|
export declare function isMemoryRow(row: unknown): row is Memory;
|
|
15
16
|
export declare function toMemory(row: Memory): Memory;
|
|
16
17
|
export declare function insertMemory(db: Database, input: MemoryInput): Memory;
|
|
17
18
|
export declare function getMemoryByHash(db: Database, projectPath: string, category: MemoryCategory, normalizedHash: string): Memory | null;
|
|
18
|
-
export declare function getMemoriesByProject(db: Database, projectPath: string, statuses?: MemoryStatus[]): Memory[];
|
|
19
|
+
export declare function getMemoriesByProject(db: Database, projectPath: string, statuses?: MemoryStatus[], expiryCutoff?: number): Memory[];
|
|
20
|
+
/**
|
|
21
|
+
* Load ALL `active` memories for a project, INCLUDING expired ones.
|
|
22
|
+
*
|
|
23
|
+
* `getMemoriesByProject` filters out rows whose `expires_at` has passed (correct
|
|
24
|
+
* for the RENDER path — expired memories shouldn't be injected). But the memory
|
|
25
|
+
* MIGRATION (`/ctx-session-upgrade`) does a destructive delete+reinsert of the
|
|
26
|
+
* `active` pool, and it MUST operate on the full active set: if it only saw
|
|
27
|
+
* unexpired rows, it would delete those and leave expired `active` rows orphaned
|
|
28
|
+
* — a partial, inconsistent wipe (root cause, dogfood 2026-05-31: 831 unexpired
|
|
29
|
+
* deleted, 27 expired KNOWN_ISSUES stranded). Migration is a re-categorization,
|
|
30
|
+
* so it re-evaluates every active row regardless of TTL.
|
|
31
|
+
*/
|
|
32
|
+
export declare function getAllActiveMemoriesForMigration(db: Database, projectPath: string): Memory[];
|
|
19
33
|
export declare function getMemoryById(db: Database, id: number): Memory | null;
|
|
20
34
|
export declare function updateMemorySeenCount(db: Database, id: number): void;
|
|
21
35
|
export declare function updateMemoryRetrievalCount(db: Database, id: number): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-memory.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/storage-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAkC,MAAM,wBAAwB,CAAC;AAGvF,OAAO,KAAK,EACR,MAAM,EACN,cAAc,EACd,WAAW,EAEX,YAAY,EACZ,kBAAkB,EACrB,MAAM,SAAS,CAAC;AAEjB,eAA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,EAAE,MAAM,GAAG,IAAI,CAiB7E;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAW3D;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,QAAQ,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAWzE;AAED,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,oBAAoB,CAsC/F"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type MemoryCategory = "ARCHITECTURE_DECISIONS" | "CONSTRAINTS" | "CONFIG_DEFAULTS" | "NAMING" | "USER_PREFERENCES" | "USER_DIRECTIVES" | "ENVIRONMENT" | "WORKFLOW_RULES" | "KNOWN_ISSUES";
|
|
1
|
+
export type MemoryCategory = "PROJECT_RULES" | "ARCHITECTURE" | "CONFIG_VALUES" | "ARCHITECTURE_DECISIONS" | "CONSTRAINTS" | "CONFIG_DEFAULTS" | "NAMING" | "USER_PREFERENCES" | "USER_DIRECTIVES" | "ENVIRONMENT" | "WORKFLOW_RULES" | "KNOWN_ISSUES";
|
|
2
2
|
export type MemoryStatus = "active" | "permanent" | "archived";
|
|
3
3
|
export type VerificationStatus = "unverified" | "verified" | "stale" | "flagged";
|
|
4
4
|
export type MemorySourceType = "historian" | "agent" | "dreamer" | "user";
|
|
@@ -8,6 +8,7 @@ export interface Memory {
|
|
|
8
8
|
category: MemoryCategory;
|
|
9
9
|
content: string;
|
|
10
10
|
normalizedHash: string;
|
|
11
|
+
importance: number;
|
|
11
12
|
sourceSessionId: string | null;
|
|
12
13
|
sourceType: MemorySourceType;
|
|
13
14
|
seenCount: number;
|
|
@@ -29,6 +30,7 @@ export interface MemoryInput {
|
|
|
29
30
|
projectPath: string;
|
|
30
31
|
category: MemoryCategory;
|
|
31
32
|
content: string;
|
|
33
|
+
importance?: number | null;
|
|
32
34
|
sourceSessionId?: string;
|
|
33
35
|
sourceType?: MemorySourceType;
|
|
34
36
|
expiresAt?: number | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAIpB,eAAe,GACf,cAAc,GACd,eAAe,GAKf,wBAAwB,GACxB,aAAa,GACb,iBAAiB,GACjB,QAAQ,GACR,kBAAkB,GAClB,iBAAiB,GACjB,aAAa,GACb,gBAAgB,GAChB,cAAc,CAAC;AAErB,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,CAAC;AAC/D,MAAM,MAAM,kBAAkB,GAAG,YAAY,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,CAAC;AACjF,MAAM,MAAM,gBAAgB,GAAG,WAAW,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAE1E,MAAM,WAAW,MAAM;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,gBAAgB,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,MAAM,EAAE,YAAY,CAAC;IACrB,SAAS,EAAE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YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,UAAU,EAAE,GAClD,IAAI,CAmBN"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import type { Database } from "../../shared/sqlite";
|
|
2
|
+
/**
|
|
3
|
+
* Highest version in the MIGRATIONS array. `LATEST_SUPPORTED_VERSION` in
|
|
4
|
+
* storage-db.ts (the schema-fence ceiling) MUST equal this — a stale ceiling
|
|
5
|
+
* makes the DB refuse to open after the new migration applies (a real bug the
|
|
6
|
+
* project hit during v2 work). A unit test asserts the two stay in lockstep.
|
|
7
|
+
*/
|
|
8
|
+
export declare const LATEST_MIGRATION_VERSION: number;
|
|
2
9
|
/**
|
|
3
10
|
* Detect the specific case where a sibling process already committed the
|
|
4
11
|
* same `schema_migrations` row we're about to insert. Two OpenCode/Pi
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/migrations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"migrations.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/migrations.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAugCpD;;;;;GAKG;AACH,eAAO,MAAM,wBAAwB,EAAE,MAGtC,CAAC;AAmBF;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAkBjG;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAgEhD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-docs-hash.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/project-docs-hash.ts"],"names":[],"mappings":"AA0HA,wBAAgB,wBAAwB,CAAC,gBAAgB,EAAE,MAAM,GAAG;IAChE,aAAa,EAAE,MAAM,CAAC;IACtB,aAAa,EAAE,MAAM,CAAC;CACzB,CAyBA;AAED,wBAAgB,sBAAsB,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAEvE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-identity.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/project-identity.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/sidekick/agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/sidekick/agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAO3D,OAAO,EAAE,sBAAsB,EAAuB,MAAM,QAAQ,CAAC;AAKrE,OAAO,EAAE,sBAAsB,EAAE,CAAC;AAElC,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACpC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,cAAc,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAqGzB"}
|
|
@@ -1,4 +1,35 @@
|
|
|
1
1
|
import { Database } from "../../shared/sqlite";
|
|
2
|
+
export declare function getSchemaFenceRejection(): {
|
|
3
|
+
persistedVersion: number;
|
|
4
|
+
supportedVersion: number;
|
|
5
|
+
} | null;
|
|
6
|
+
export declare const LATEST_SUPPORTED_VERSION = 27;
|
|
7
|
+
export interface OpenDatabaseOptions {
|
|
8
|
+
dbPath?: string;
|
|
9
|
+
latestSupportedVersion?: number;
|
|
10
|
+
}
|
|
11
|
+
export declare function getPersistedSchemaVersion(db: Database): number;
|
|
12
|
+
export declare function schemaVersionIsSupported(db: Database, latestSupportedVersion?: number): boolean;
|
|
13
|
+
export declare function enforceSchemaFence(db: Database, dbPath: string, latestSupportedVersion: number): boolean;
|
|
14
|
+
export declare function setSqlitePragmaConfig(config: {
|
|
15
|
+
cacheSizeMb: number;
|
|
16
|
+
mmapSizeMb: number;
|
|
17
|
+
}): void;
|
|
18
|
+
/**
|
|
19
|
+
* Apply the tunable per-connection PRAGMAs (cache_size, mmap_size,
|
|
20
|
+
* analysis_limit) from the current `sqlitePragmaConfig`. Idempotent and safe on
|
|
21
|
+
* an already-open connection — cache_size/mmap_size take effect immediately —
|
|
22
|
+
* so harnesses that open the DB before loading config (Pi) can call this once
|
|
23
|
+
* config is available without reopening.
|
|
24
|
+
*/
|
|
25
|
+
export declare function applySqliteTuningPragmas(db: Database): void;
|
|
26
|
+
/**
|
|
27
|
+
* Run SQLite's self-gating planner-stats refresh. `analysis_limit=400` caps the
|
|
28
|
+
* rows sampled per index so even a huge table can't cause a multi-second
|
|
29
|
+
* ANALYZE; `optimize` then re-analyzes only tables whose row counts drifted
|
|
30
|
+
* since the last ANALYZE (a no-op otherwise). Cheap to call periodically.
|
|
31
|
+
*/
|
|
32
|
+
export declare function runSqliteOptimize(db: Database): void;
|
|
2
33
|
export declare function initializeDatabase(db: Database): void;
|
|
3
34
|
/**
|
|
4
35
|
* Heal NULL columns added via ensureColumn against pre-existing rows.
|
|
@@ -36,13 +67,26 @@ export declare function ensureColumn(db: Database, table: string, column: string
|
|
|
36
67
|
* raw history reach the model and overflow the context window — the
|
|
37
68
|
* exact failure mode that broke a real test session.
|
|
38
69
|
*
|
|
39
|
-
*
|
|
40
|
-
* (
|
|
41
|
-
*
|
|
70
|
+
* Two failure modes, both fail-closed:
|
|
71
|
+
* - **Schema fence** (the on-disk DB is newer than this binary supports, e.g.
|
|
72
|
+
* a stale process after a rolling upgrade): returns `null`. This is an
|
|
73
|
+
* expected, recoverable condition (restart onto the newer binary), so it is
|
|
74
|
+
* not exceptional.
|
|
75
|
+
* - **Fatal open error** (ABI mismatch, unwritable path, corrupt file):
|
|
76
|
+
* throws. The thrown message carries the failure detail for surfacing.
|
|
77
|
+
*
|
|
78
|
+
* The return type is therefore `Database | null`, and callers MUST both
|
|
79
|
+
* null-check the result AND be prepared for a throw (typically a try/catch that
|
|
80
|
+
* also treats a null result as "storage unavailable"). On either outcome the
|
|
81
|
+
* caller disables Magic Context for that run (server plugin: registers a
|
|
82
|
+
* startup warning + skips the runtime; Pi plugin: logs warning + skips the
|
|
83
|
+
* extension). There is NEVER a silent in-memory fallback.
|
|
42
84
|
*/
|
|
43
|
-
export declare function openDatabase(): Database;
|
|
44
|
-
export declare function
|
|
45
|
-
export declare function
|
|
85
|
+
export declare function openDatabase(): Database | null;
|
|
86
|
+
export declare function openDatabase(dbPath: string): Database | null;
|
|
87
|
+
export declare function openDatabase(options: OpenDatabaseOptions): Database | null;
|
|
88
|
+
export declare function isDatabasePersisted(db: Database | null): boolean;
|
|
89
|
+
export declare function getDatabasePersistenceError(db: Database | null): string | null;
|
|
46
90
|
export declare function closeDatabase(): void;
|
|
47
|
-
export type ContextDatabase =
|
|
91
|
+
export type ContextDatabase = Database;
|
|
48
92
|
//# sourceMappingURL=storage-db.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-db.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/storage-db.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE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