@cortexkit/opencode-magic-context 0.1.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/LICENSE +21 -0
- package/README.md +274 -0
- package/dist/agents/builtin-agents.d.ts +8 -0
- package/dist/agents/builtin-agents.d.ts.map +1 -0
- package/dist/agents/dreamer.d.ts +2 -0
- package/dist/agents/dreamer.d.ts.map +1 -0
- package/dist/agents/historian.d.ts +2 -0
- package/dist/agents/historian.d.ts.map +1 -0
- package/dist/agents/magic-context-prompt.d.ts +14 -0
- package/dist/agents/magic-context-prompt.d.ts.map +1 -0
- package/dist/agents/sidekick.d.ts +2 -0
- package/dist/agents/sidekick.d.ts.map +1 -0
- package/dist/agents/types.d.ts +19 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/cli/model-fallback-requirements.d.ts +2 -0
- package/dist/cli/model-fallback-requirements.d.ts.map +1 -0
- package/dist/config/index.d.ts +13 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/schema/agent-overrides.d.ts +55 -0
- package/dist/config/schema/agent-overrides.d.ts.map +1 -0
- package/dist/config/schema/magic-context.d.ts +529 -0
- package/dist/config/schema/magic-context.d.ts.map +1 -0
- package/dist/config/schema.d.ts +3 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/features/builtin-commands/commands.d.ts +3 -0
- package/dist/features/builtin-commands/commands.d.ts.map +1 -0
- package/dist/features/builtin-commands/types.d.ts +5 -0
- package/dist/features/builtin-commands/types.d.ts.map +1 -0
- package/dist/features/magic-context/compaction.d.ts +7 -0
- package/dist/features/magic-context/compaction.d.ts.map +1 -0
- package/dist/features/magic-context/compartment-storage.d.ts +83 -0
- package/dist/features/magic-context/compartment-storage.d.ts.map +1 -0
- package/dist/features/magic-context/defaults.d.ts +2 -0
- package/dist/features/magic-context/defaults.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/index.d.ts +7 -0
- package/dist/features/magic-context/dreamer/index.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/lease.d.ts +7 -0
- package/dist/features/magic-context/dreamer/lease.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/queue.d.ts +27 -0
- package/dist/features/magic-context/dreamer/queue.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/runner.d.ts +34 -0
- package/dist/features/magic-context/dreamer/runner.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/scheduler.d.ts +21 -0
- package/dist/features/magic-context/dreamer/scheduler.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/storage-dream-state.d.ts +5 -0
- package/dist/features/magic-context/dreamer/storage-dream-state.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/task-consolidate.d.ts +9 -0
- package/dist/features/magic-context/dreamer/task-consolidate.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/task-decay.d.ts +11 -0
- package/dist/features/magic-context/dreamer/task-decay.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/task-prompts.d.ts +19 -0
- package/dist/features/magic-context/dreamer/task-prompts.d.ts.map +1 -0
- package/dist/features/magic-context/index.d.ts +11 -0
- package/dist/features/magic-context/index.d.ts.map +1 -0
- package/dist/features/magic-context/memory/constants.d.ts +5 -0
- package/dist/features/magic-context/memory/constants.d.ts.map +1 -0
- package/dist/features/magic-context/memory/cosine-similarity.d.ts +2 -0
- package/dist/features/magic-context/memory/cosine-similarity.d.ts.map +1 -0
- package/dist/features/magic-context/memory/embedding-backfill.d.ts +8 -0
- package/dist/features/magic-context/memory/embedding-backfill.d.ts.map +1 -0
- package/dist/features/magic-context/memory/embedding-local.d.ts +14 -0
- package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -0
- package/dist/features/magic-context/memory/embedding-openai.d.ts +21 -0
- package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -0
- package/dist/features/magic-context/memory/embedding-provider.d.ts +9 -0
- package/dist/features/magic-context/memory/embedding-provider.d.ts.map +1 -0
- package/dist/features/magic-context/memory/embedding.d.ts +11 -0
- package/dist/features/magic-context/memory/embedding.d.ts.map +1 -0
- package/dist/features/magic-context/memory/index.d.ts +11 -0
- package/dist/features/magic-context/memory/index.d.ts.map +1 -0
- package/dist/features/magic-context/memory/injection.d.ts +10 -0
- package/dist/features/magic-context/memory/injection.d.ts.map +1 -0
- package/dist/features/magic-context/memory/normalize-hash.d.ts +3 -0
- package/dist/features/magic-context/memory/normalize-hash.d.ts.map +1 -0
- package/dist/features/magic-context/memory/project-identity.d.ts +23 -0
- package/dist/features/magic-context/memory/project-identity.d.ts.map +1 -0
- package/dist/features/magic-context/memory/promotion.d.ts +13 -0
- package/dist/features/magic-context/memory/promotion.d.ts.map +1 -0
- package/dist/features/magic-context/memory/storage-memory-embeddings.d.ts +7 -0
- package/dist/features/magic-context/memory/storage-memory-embeddings.d.ts.map +1 -0
- package/dist/features/magic-context/memory/storage-memory-fts.d.ts +4 -0
- package/dist/features/magic-context/memory/storage-memory-fts.d.ts.map +1 -0
- package/dist/features/magic-context/memory/storage-memory.d.ts +19 -0
- package/dist/features/magic-context/memory/storage-memory.d.ts.map +1 -0
- package/dist/features/magic-context/memory/types.d.ts +37 -0
- package/dist/features/magic-context/memory/types.d.ts.map +1 -0
- package/dist/features/magic-context/mock-database.d.ts +3 -0
- package/dist/features/magic-context/mock-database.d.ts.map +1 -0
- package/dist/features/magic-context/range-parser.d.ts +13 -0
- package/dist/features/magic-context/range-parser.d.ts.map +1 -0
- package/dist/features/magic-context/scheduler.d.ts +14 -0
- package/dist/features/magic-context/scheduler.d.ts.map +1 -0
- package/dist/features/magic-context/sidekick/agent.d.ts +12 -0
- package/dist/features/magic-context/sidekick/agent.d.ts.map +1 -0
- package/dist/features/magic-context/sidekick/client.d.ts +12 -0
- package/dist/features/magic-context/sidekick/client.d.ts.map +1 -0
- package/dist/features/magic-context/sidekick/index.d.ts +3 -0
- package/dist/features/magic-context/sidekick/index.d.ts.map +1 -0
- package/dist/features/magic-context/sidekick/types.d.ts +48 -0
- package/dist/features/magic-context/sidekick/types.d.ts.map +1 -0
- package/dist/features/magic-context/storage-db.d.ts +8 -0
- package/dist/features/magic-context/storage-db.d.ts.map +1 -0
- package/dist/features/magic-context/storage-meta-persisted.d.ts +20 -0
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -0
- package/dist/features/magic-context/storage-meta-session.d.ts +6 -0
- package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -0
- package/dist/features/magic-context/storage-meta-shared.d.ts +24 -0
- package/dist/features/magic-context/storage-meta-shared.d.ts.map +1 -0
- package/dist/features/magic-context/storage-meta.d.ts +3 -0
- package/dist/features/magic-context/storage-meta.d.ts.map +1 -0
- package/dist/features/magic-context/storage-notes.d.ts +12 -0
- package/dist/features/magic-context/storage-notes.d.ts.map +1 -0
- package/dist/features/magic-context/storage-ops.d.ts +8 -0
- package/dist/features/magic-context/storage-ops.d.ts.map +1 -0
- package/dist/features/magic-context/storage-source.d.ts +5 -0
- package/dist/features/magic-context/storage-source.d.ts.map +1 -0
- package/dist/features/magic-context/storage-tags.d.ts +9 -0
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -0
- package/dist/features/magic-context/storage.d.ts +8 -0
- package/dist/features/magic-context/storage.d.ts.map +1 -0
- package/dist/features/magic-context/tagger.d.ts +14 -0
- package/dist/features/magic-context/tagger.d.ts.map +1 -0
- package/dist/features/magic-context/types.d.ts +36 -0
- package/dist/features/magic-context/types.d.ts.map +1 -0
- package/dist/hooks/auto-slash-command/constants.d.ts +2 -0
- package/dist/hooks/auto-slash-command/constants.d.ts.map +1 -0
- package/dist/hooks/is-anthropic-provider.d.ts +2 -0
- package/dist/hooks/is-anthropic-provider.d.ts.map +1 -0
- package/dist/hooks/magic-context/apply-context-nudge.d.ts +5 -0
- package/dist/hooks/magic-context/apply-context-nudge.d.ts.map +1 -0
- package/dist/hooks/magic-context/apply-operations.d.ts +7 -0
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -0
- package/dist/hooks/magic-context/command-handler.d.ts +46 -0
- package/dist/hooks/magic-context/command-handler.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-parser.d.ts +17 -0
- package/dist/hooks/magic-context/compartment-parser.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-prompt.d.ts +10 -0
- package/dist/hooks/magic-context/compartment-prompt.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-compressor.d.ts +16 -0
- package/dist/hooks/magic-context/compartment-runner-compressor.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-drop-queue.d.ts +3 -0
- package/dist/hooks/magic-context/compartment-runner-drop-queue.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts +22 -0
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts +3 -0
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-mapping.d.ts +33 -0
- package/dist/hooks/magic-context/compartment-runner-mapping.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-recomp.d.ts +3 -0
- package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-state-xml.d.ts +21 -0
- package/dist/hooks/magic-context/compartment-runner-state-xml.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-types.d.ts +47 -0
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts +23 -0
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner.d.ts +6 -0
- package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-trigger.d.ts +14 -0
- package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -0
- package/dist/hooks/magic-context/drop-stale-reduce-calls.d.ts +4 -0
- package/dist/hooks/magic-context/drop-stale-reduce-calls.d.ts.map +1 -0
- package/dist/hooks/magic-context/event-handler.d.ts +34 -0
- package/dist/hooks/magic-context/event-handler.d.ts.map +1 -0
- package/dist/hooks/magic-context/event-payloads.d.ts +32 -0
- package/dist/hooks/magic-context/event-payloads.d.ts.map +1 -0
- package/dist/hooks/magic-context/event-resolvers.d.ts +17 -0
- package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -0
- package/dist/hooks/magic-context/execute-flush.d.ts +3 -0
- package/dist/hooks/magic-context/execute-flush.d.ts.map +1 -0
- package/dist/hooks/magic-context/execute-status.d.ts +6 -0
- package/dist/hooks/magic-context/execute-status.d.ts.map +1 -0
- package/dist/hooks/magic-context/format-bytes.d.ts +2 -0
- package/dist/hooks/magic-context/format-bytes.d.ts.map +1 -0
- package/dist/hooks/magic-context/get-error-message.d.ts +2 -0
- package/dist/hooks/magic-context/get-error-message.d.ts.map +1 -0
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts +13 -0
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -0
- package/dist/hooks/magic-context/hook-handlers.d.ts +72 -0
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -0
- package/dist/hooks/magic-context/hook.d.ts +66 -0
- package/dist/hooks/magic-context/hook.d.ts.map +1 -0
- package/dist/hooks/magic-context/index.d.ts +3 -0
- package/dist/hooks/magic-context/index.d.ts.map +1 -0
- package/dist/hooks/magic-context/inject-compartments.d.ts +21 -0
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -0
- package/dist/hooks/magic-context/note-nudger.d.ts +32 -0
- package/dist/hooks/magic-context/note-nudger.d.ts.map +1 -0
- package/dist/hooks/magic-context/nudge-bands.d.ts +6 -0
- package/dist/hooks/magic-context/nudge-bands.d.ts.map +1 -0
- package/dist/hooks/magic-context/nudge-injection.d.ts +7 -0
- package/dist/hooks/magic-context/nudge-injection.d.ts.map +1 -0
- package/dist/hooks/magic-context/nudge-placement-store.d.ts +13 -0
- package/dist/hooks/magic-context/nudge-placement-store.d.ts.map +1 -0
- package/dist/hooks/magic-context/nudger.d.ts +24 -0
- package/dist/hooks/magic-context/nudger.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-chunk.d.ts +20 -0
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-db.d.ts +5 -0
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-formatting.d.ts +25 -0
- package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-raw.d.ts +9 -0
- package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -0
- package/dist/hooks/magic-context/send-session-notification.d.ts +13 -0
- package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -0
- package/dist/hooks/magic-context/strip-content.d.ts +21 -0
- package/dist/hooks/magic-context/strip-content.d.ts.map +1 -0
- package/dist/hooks/magic-context/strip-structural-noise.d.ts +3 -0
- package/dist/hooks/magic-context/strip-structural-noise.d.ts.map +1 -0
- package/dist/hooks/magic-context/system-injection-stripper.d.ts +2 -0
- package/dist/hooks/magic-context/system-injection-stripper.d.ts.map +1 -0
- package/dist/hooks/magic-context/system-prompt-hash.d.ts +25 -0
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -0
- package/dist/hooks/magic-context/tag-content-primitives.d.ts +6 -0
- package/dist/hooks/magic-context/tag-content-primitives.d.ts.map +1 -0
- package/dist/hooks/magic-context/tag-id-fallback.d.ts +9 -0
- package/dist/hooks/magic-context/tag-id-fallback.d.ts.map +1 -0
- package/dist/hooks/magic-context/tag-messages.d.ts +35 -0
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -0
- package/dist/hooks/magic-context/tag-part-guards.d.ts +23 -0
- package/dist/hooks/magic-context/tag-part-guards.d.ts.map +1 -0
- package/dist/hooks/magic-context/text-complete.d.ts +8 -0
- package/dist/hooks/magic-context/text-complete.d.ts.map +1 -0
- package/dist/hooks/magic-context/tool-drop-target.d.ts +32 -0
- package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +36 -0
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform-context-state.d.ts +9 -0
- package/dist/hooks/magic-context/transform-context-state.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform-message-helpers.d.ts +7 -0
- package/dist/hooks/magic-context/transform-message-helpers.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform-operations.d.ts +5 -0
- package/dist/hooks/magic-context/transform-operations.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +53 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform-stage-logger.d.ts +2 -0
- package/dist/hooks/magic-context/transform-stage-logger.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform.d.ts +39 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +22571 -0
- package/dist/plugin/event.d.ts +10 -0
- package/dist/plugin/event.d.ts.map +1 -0
- package/dist/plugin/hooks/create-core-hooks.d.ts +37 -0
- package/dist/plugin/hooks/create-core-hooks.d.ts.map +1 -0
- package/dist/plugin/hooks/create-session-hooks.d.ts +37 -0
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -0
- package/dist/plugin/hooks/create-tag-content-resolver.d.ts +7 -0
- package/dist/plugin/hooks/create-tag-content-resolver.d.ts.map +1 -0
- package/dist/plugin/messages-transform.d.ts +14 -0
- package/dist/plugin/messages-transform.d.ts.map +1 -0
- package/dist/plugin/normalize-tool-arg-schemas.d.ts +7 -0
- package/dist/plugin/normalize-tool-arg-schemas.d.ts.map +1 -0
- package/dist/plugin/tool-registry.d.ts +8 -0
- package/dist/plugin/tool-registry.d.ts.map +1 -0
- package/dist/plugin/types.d.ts +3 -0
- package/dist/plugin/types.d.ts.map +1 -0
- package/dist/shared/agent-display-names.d.ts +2 -0
- package/dist/shared/agent-display-names.d.ts.map +1 -0
- package/dist/shared/assistant-message-extractor.d.ts +2 -0
- package/dist/shared/assistant-message-extractor.d.ts.map +1 -0
- package/dist/shared/data-path.d.ts +3 -0
- package/dist/shared/data-path.d.ts.map +1 -0
- package/dist/shared/error-message.d.ts +2 -0
- package/dist/shared/error-message.d.ts.map +1 -0
- package/dist/shared/format-bytes.d.ts +2 -0
- package/dist/shared/format-bytes.d.ts.map +1 -0
- package/dist/shared/index.d.ts +5 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/internal-initiator-marker.d.ts +2 -0
- package/dist/shared/internal-initiator-marker.d.ts.map +1 -0
- package/dist/shared/jsonc-parser.d.ts +16 -0
- package/dist/shared/jsonc-parser.d.ts.map +1 -0
- package/dist/shared/logger.d.ts +4 -0
- package/dist/shared/logger.d.ts.map +1 -0
- package/dist/shared/model-requirements.d.ts +26 -0
- package/dist/shared/model-requirements.d.ts.map +1 -0
- package/dist/shared/model-suggestion-retry.d.ts +31 -0
- package/dist/shared/model-suggestion-retry.d.ts.map +1 -0
- package/dist/shared/normalize-sdk-response.d.ts +5 -0
- package/dist/shared/normalize-sdk-response.d.ts.map +1 -0
- package/dist/shared/opencode-compaction-detector.d.ts +2 -0
- package/dist/shared/opencode-compaction-detector.d.ts.map +1 -0
- package/dist/shared/opencode-config-dir-types.d.ts +14 -0
- package/dist/shared/opencode-config-dir-types.d.ts.map +1 -0
- package/dist/shared/opencode-config-dir.d.ts +5 -0
- package/dist/shared/opencode-config-dir.d.ts.map +1 -0
- package/dist/shared/permission-compat.d.ts +6 -0
- package/dist/shared/permission-compat.d.ts.map +1 -0
- package/dist/shared/record-type-guard.d.ts +2 -0
- package/dist/shared/record-type-guard.d.ts.map +1 -0
- package/dist/shared/system-directive.d.ts +3 -0
- package/dist/shared/system-directive.d.ts.map +1 -0
- package/dist/tools/ctx-expand/constants.d.ts +3 -0
- package/dist/tools/ctx-expand/constants.d.ts.map +1 -0
- package/dist/tools/ctx-expand/index.d.ts +2 -0
- package/dist/tools/ctx-expand/index.d.ts.map +1 -0
- package/dist/tools/ctx-expand/tools.d.ts +3 -0
- package/dist/tools/ctx-expand/tools.d.ts.map +1 -0
- package/dist/tools/ctx-expand/types.d.ts +5 -0
- package/dist/tools/ctx-expand/types.d.ts.map +1 -0
- package/dist/tools/ctx-memory/constants.d.ts +4 -0
- package/dist/tools/ctx-memory/constants.d.ts.map +1 -0
- package/dist/tools/ctx-memory/index.d.ts +4 -0
- package/dist/tools/ctx-memory/index.d.ts.map +1 -0
- package/dist/tools/ctx-memory/tools.d.ts +4 -0
- package/dist/tools/ctx-memory/tools.d.ts.map +1 -0
- package/dist/tools/ctx-memory/types.d.ts +30 -0
- package/dist/tools/ctx-memory/types.d.ts.map +1 -0
- package/dist/tools/ctx-note/constants.d.ts +2 -0
- package/dist/tools/ctx-note/constants.d.ts.map +1 -0
- package/dist/tools/ctx-note/index.d.ts +4 -0
- package/dist/tools/ctx-note/index.d.ts.map +1 -0
- package/dist/tools/ctx-note/tools.d.ts +7 -0
- package/dist/tools/ctx-note/tools.d.ts.map +1 -0
- package/dist/tools/ctx-note/types.d.ts +5 -0
- package/dist/tools/ctx-note/types.d.ts.map +1 -0
- package/dist/tools/ctx-recall/constants.d.ts +4 -0
- package/dist/tools/ctx-recall/constants.d.ts.map +1 -0
- package/dist/tools/ctx-recall/index.d.ts +4 -0
- package/dist/tools/ctx-recall/index.d.ts.map +1 -0
- package/dist/tools/ctx-recall/tools.d.ts +4 -0
- package/dist/tools/ctx-recall/tools.d.ts.map +1 -0
- package/dist/tools/ctx-recall/types.d.ts +20 -0
- package/dist/tools/ctx-recall/types.d.ts.map +1 -0
- package/dist/tools/ctx-reduce/constants.d.ts +2 -0
- package/dist/tools/ctx-reduce/constants.d.ts.map +1 -0
- package/dist/tools/ctx-reduce/index.d.ts +4 -0
- package/dist/tools/ctx-reduce/index.d.ts.map +1 -0
- package/dist/tools/ctx-reduce/tools.d.ts +9 -0
- package/dist/tools/ctx-reduce/tools.d.ts.map +1 -0
- package/dist/tools/ctx-reduce/types.d.ts +4 -0
- package/dist/tools/ctx-reduce/types.d.ts.map +1 -0
- package/dist/tools/index.d.ts +5 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/look-at/assistant-message-extractor.d.ts +2 -0
- package/dist/tools/look-at/assistant-message-extractor.d.ts.map +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
export declare function isLeaseActive(db: Database): boolean;
|
|
3
|
+
export declare function getLeaseHolder(db: Database): string | null;
|
|
4
|
+
export declare function acquireLease(db: Database, holderId: string): boolean;
|
|
5
|
+
export declare function renewLease(db: Database, holderId: string): boolean;
|
|
6
|
+
export declare function releaseLease(db: Database, holderId: string): void;
|
|
7
|
+
//# sourceMappingURL=lease.d.ts.map
|
|
@@ -0,0 +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,YAAY,CAAC;AAkB3C,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAGnD;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,GAAG,IAAI,CAE1D;AAED,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"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
export interface DreamQueueEntry {
|
|
3
|
+
id: number;
|
|
4
|
+
/** Project identity (e.g. "git:<sha>"), NOT a filesystem path */
|
|
5
|
+
projectIdentity: string;
|
|
6
|
+
reason: string;
|
|
7
|
+
enqueuedAt: number;
|
|
8
|
+
startedAt: number | null;
|
|
9
|
+
}
|
|
10
|
+
export declare function ensureDreamQueueTable(db: Database): void;
|
|
11
|
+
/** Enqueue a project for dreaming. Skips if the same project already has any queue entry (queued or running). */
|
|
12
|
+
export declare function enqueueDream(db: Database, projectIdentity: string, reason: string): DreamQueueEntry | null;
|
|
13
|
+
/** Peek at the next unstarted entry without claiming it. */
|
|
14
|
+
export declare function peekQueue(db: Database): DreamQueueEntry | null;
|
|
15
|
+
/** Claim the next unstarted entry atomically by marking started_at. Returns null if queue is empty. */
|
|
16
|
+
export declare function dequeueNext(db: Database): DreamQueueEntry | null;
|
|
17
|
+
/** Remove a completed or failed entry from the queue. */
|
|
18
|
+
export declare function removeDreamEntry(db: Database, id: number): void;
|
|
19
|
+
/** Reset a dequeued entry so it can be retried (e.g., after lease failure). Increments retry_count. */
|
|
20
|
+
export declare function resetDreamEntry(db: Database, id: number): void;
|
|
21
|
+
/** Get the retry count for a queue entry. */
|
|
22
|
+
export declare function getEntryRetryCount(db: Database, id: number): number;
|
|
23
|
+
/** Clear stale started entries (stuck for more than maxAgeMs). */
|
|
24
|
+
export declare function clearStaleEntries(db: Database, maxAgeMs: number): number;
|
|
25
|
+
/** Get current queue size (unstarted entries only). */
|
|
26
|
+
export declare function getQueueSize(db: Database): number;
|
|
27
|
+
//# sourceMappingURL=queue.d.ts.map
|
|
@@ -0,0 +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,YAAY,CAAC;AAE3C,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,CAYxD;AAED,iHAAiH;AACjH,wBAAgB,YAAY,CACxB,EAAE,EAAE,QAAQ,EACZ,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,MAAM,GACf,eAAe,GAAG,IAAI,CAuBxB;AAED,4DAA4D;AAC5D,wBAAgB,SAAS,CAAC,EAAE,EAAE,QAAQ,GAAG,eAAe,GAAG,IAAI,CAgB9D;AAED,uGAAuG;AACvG,wBAAgB,WAAW,CAAC,EAAE,EAAE,QAAQ,GAAG,eAAe,GAAG,IAAI,CAahE;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,kEAAkE;AAClE,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMxE;AAED,uDAAuD;AACvD,wBAAgB,YAAY,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,CAOjD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
import type { DreamingTask } from "../../../config/schema/magic-context";
|
|
3
|
+
import type { PluginContext } from "../../../plugin/types";
|
|
4
|
+
export declare function registerDreamProjectDirectory(projectIdentity: string, directory: string): void;
|
|
5
|
+
export interface DreamRunResult {
|
|
6
|
+
startedAt: number;
|
|
7
|
+
finishedAt: number;
|
|
8
|
+
holderId: string;
|
|
9
|
+
tasks: {
|
|
10
|
+
name: string;
|
|
11
|
+
durationMs: number;
|
|
12
|
+
result: unknown;
|
|
13
|
+
error?: string;
|
|
14
|
+
}[];
|
|
15
|
+
}
|
|
16
|
+
export declare function runDream(args: {
|
|
17
|
+
db: Database;
|
|
18
|
+
client: PluginContext["client"];
|
|
19
|
+
/** Project identity (e.g. "git:<sha>"), NOT a filesystem path. Used for dream state keys. */
|
|
20
|
+
projectIdentity: string;
|
|
21
|
+
tasks: DreamingTask[];
|
|
22
|
+
taskTimeoutMinutes: number;
|
|
23
|
+
maxRuntimeMinutes: number;
|
|
24
|
+
parentSessionId?: string;
|
|
25
|
+
sessionDirectory?: string;
|
|
26
|
+
}): Promise<DreamRunResult>;
|
|
27
|
+
export declare function processDreamQueue(args: {
|
|
28
|
+
db: Database;
|
|
29
|
+
client: PluginContext["client"];
|
|
30
|
+
tasks: DreamingTask[];
|
|
31
|
+
taskTimeoutMinutes: number;
|
|
32
|
+
maxRuntimeMinutes: number;
|
|
33
|
+
}): Promise<DreamRunResult | null>;
|
|
34
|
+
//# sourceMappingURL=runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAI3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAqB3D,wBAAgB,6BAA6B,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAE9F;AAMD,MAAM,WAAW,cAAc;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE;QACH,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,OAAO,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAClB,EAAE,CAAC;CACP;AAED,wBAAsB,QAAQ,CAAC,IAAI,EAAE;IACjC,EAAE,EAAE,QAAQ,CAAC;IACb,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,6FAA6F;IAC7F,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B,GAAG,OAAO,CAAC,cAAc,CAAC,CA6M1B;AAID,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC1C,EAAE,EAAE,QAAQ,CAAC;IACb,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;CAC7B,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAsDjC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
export interface DreamScheduleConfig {
|
|
3
|
+
/** Time range string like "02:00-06:00" */
|
|
4
|
+
schedule: string;
|
|
5
|
+
}
|
|
6
|
+
/** Parse "HH:MM-HH:MM" into start/end minutes since midnight. */
|
|
7
|
+
export declare function parseScheduleWindow(schedule: string): {
|
|
8
|
+
startMinutes: number;
|
|
9
|
+
endMinutes: number;
|
|
10
|
+
} | null;
|
|
11
|
+
/** Check if the current time is inside the schedule window. Handles overnight windows (e.g. 23:00-05:00). */
|
|
12
|
+
export declare function isInScheduleWindow(schedule: string, now?: Date): boolean;
|
|
13
|
+
/** Find projects that have memory updates since their per-project last dream time. */
|
|
14
|
+
export declare function findProjectsNeedingDream(db: Database): string[];
|
|
15
|
+
/**
|
|
16
|
+
* Check schedule and enqueue eligible projects.
|
|
17
|
+
* Called periodically from the hook layer (debounced to once per hour).
|
|
18
|
+
* Returns the number of projects enqueued.
|
|
19
|
+
*/
|
|
20
|
+
export declare function checkScheduleAndEnqueue(db: Database, schedule: string): number;
|
|
21
|
+
//# sourceMappingURL=scheduler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/scheduler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAK3C,MAAM,WAAW,mBAAmB;IAChC,2CAA2C;IAC3C,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,iEAAiE;AACjE,wBAAgB,mBAAmB,CAC/B,QAAQ,EAAE,MAAM,GACjB;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAkBrD;AAED,6GAA6G;AAC7G,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAE,IAAiB,GAAG,OAAO,CAYpF;AAED,sFAAsF;AACtF,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,EAAE,CA4B/D;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAwB9E"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
export declare function getDreamState(db: Database, key: string): string | null;
|
|
3
|
+
export declare function setDreamState(db: Database, key: string, value: string): void;
|
|
4
|
+
export declare function deleteDreamState(db: Database, key: string): void;
|
|
5
|
+
//# sourceMappingURL=storage-dream-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-dream-state.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/storage-dream-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAqC3C,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGtE;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAE5E;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAEhE"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/** @deprecated Legacy deterministic dream task retained for fallback/debugging only. */
|
|
2
|
+
import type { Database } from "bun:sqlite";
|
|
3
|
+
export interface ConsolidationResult {
|
|
4
|
+
clustersFound: number;
|
|
5
|
+
memoriesMerged: number;
|
|
6
|
+
memoriesSuperseded: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function runConsolidateTask(db: Database, projectPath: string): Promise<ConsolidationResult>;
|
|
9
|
+
//# sourceMappingURL=task-consolidate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-consolidate.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/task-consolidate.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AA4B3C,MAAM,WAAW,mBAAmB;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;CAC9B;AAmCD,wBAAsB,kBAAkB,CACpC,EAAE,EAAE,QAAQ,EACZ,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,mBAAmB,CAAC,CA0G9B"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** @deprecated Legacy deterministic dream task retained for fallback/debugging only. */
|
|
2
|
+
import type { Database } from "bun:sqlite";
|
|
3
|
+
export interface DecayResult {
|
|
4
|
+
expired: number;
|
|
5
|
+
promoted: number;
|
|
6
|
+
archived: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function runDecayTask(db: Database, config: {
|
|
9
|
+
promotionThreshold: number;
|
|
10
|
+
}, projectPath: string): Promise<DecayResult>;
|
|
11
|
+
//# sourceMappingURL=task-decay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"task-decay.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/task-decay.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAS3C,MAAM,WAAW,WAAW;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;CACpB;AAMD,wBAAsB,YAAY,CAC9B,EAAE,EAAE,QAAQ,EACZ,MAAM,EAAE;IAAE,kBAAkB,EAAE,MAAM,CAAA;CAAE,EACtC,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,WAAW,CAAC,CAqDtB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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=\"search\", query=\"...\"` \u2014 semantic search across memories\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.";
|
|
3
|
+
export declare function buildConsolidatePrompt(projectPath: string): string;
|
|
4
|
+
export declare function buildVerifyPrompt(projectPath: string): string;
|
|
5
|
+
export declare function buildArchiveStalePrompt(projectPath: string): string;
|
|
6
|
+
export declare function buildImprovePrompt(projectPath: string): string;
|
|
7
|
+
export declare function buildMaintainDocsPrompt(projectPath: string, lastDreamAt: string | null, existingDocs: {
|
|
8
|
+
architecture: boolean;
|
|
9
|
+
structure: boolean;
|
|
10
|
+
}): string;
|
|
11
|
+
export declare function buildDreamTaskPrompt(task: DreamingTask, args: {
|
|
12
|
+
projectPath: string;
|
|
13
|
+
lastDreamAt?: string | null;
|
|
14
|
+
existingDocs?: {
|
|
15
|
+
architecture: boolean;
|
|
16
|
+
structure: boolean;
|
|
17
|
+
};
|
|
18
|
+
}): string;
|
|
19
|
+
//# sourceMappingURL=task-prompts.d.ts.map
|
|
@@ -0,0 +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,qvDA0B6B,CAAC;AAIhE,wBAAgB,sBAAsB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CA+BlE;AAID,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAoC7D;AAID,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAwCnE;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;CAChE,GACF,MAAM,CAiBR"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./compaction";
|
|
2
|
+
export * from "./compartment-storage";
|
|
3
|
+
export * from "./dreamer";
|
|
4
|
+
export * from "./memory";
|
|
5
|
+
export * from "./range-parser";
|
|
6
|
+
export * from "./scheduler";
|
|
7
|
+
export * from "./sidekick";
|
|
8
|
+
export * from "./storage";
|
|
9
|
+
export * from "./tagger";
|
|
10
|
+
export * from "./types";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { MemoryCategory } from "./types";
|
|
2
|
+
export declare const PROMOTABLE_CATEGORIES: MemoryCategory[];
|
|
3
|
+
export declare const CATEGORY_PRIORITY: MemoryCategory[];
|
|
4
|
+
export declare const CATEGORY_DEFAULT_TTL: Partial<Record<MemoryCategory, number>>;
|
|
5
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +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,EAUjD,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,cAAc,EAU7C,CAAC;AAGF,eAAO,MAAM,oBAAoB,EAAE,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,MAAM,CAAC,CAGxE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cosine-similarity.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/cosine-similarity.ts"],"names":[],"mappings":"AAAA,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,GAAG,MAAM,CAiBzE"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
import type { Memory } from "./types";
|
|
3
|
+
export declare function ensureMemoryEmbeddings(args: {
|
|
4
|
+
db: Database;
|
|
5
|
+
memories: Memory[];
|
|
6
|
+
existingEmbeddings: Map<number, Float32Array>;
|
|
7
|
+
}): Promise<Map<number, Float32Array>>;
|
|
8
|
+
//# sourceMappingURL=embedding-backfill.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedding-backfill.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/embedding-backfill.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAI3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,wBAAsB,sBAAsB,CAAC,IAAI,EAAE;IAC/C,EAAE,EAAE,QAAQ,CAAC;IACb,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,kBAAkB,EAAE,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;CACjD,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAwCrC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { EmbeddingProvider } from "./embedding-provider";
|
|
2
|
+
export declare class LocalEmbeddingProvider implements EmbeddingProvider {
|
|
3
|
+
readonly modelId: string;
|
|
4
|
+
private readonly model;
|
|
5
|
+
private pipeline;
|
|
6
|
+
private initPromise;
|
|
7
|
+
constructor(model?: string);
|
|
8
|
+
initialize(): Promise<boolean>;
|
|
9
|
+
embed(text: string): Promise<Float32Array | null>;
|
|
10
|
+
embedBatch(texts: string[]): Promise<(Float32Array | null)[]>;
|
|
11
|
+
dispose(): Promise<void>;
|
|
12
|
+
isLoaded(): boolean;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=embedding-local.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedding-local.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/embedding-local.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAsE9D,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;gBAErC,KAAK,SAAgC;IAK3C,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAiC9B,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAsBjD,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE,CAAC;IA0B7D,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAqB9B,QAAQ,IAAI,OAAO;CAGtB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { EmbeddingProvider } from "./embedding-provider";
|
|
2
|
+
interface OpenAICompatibleEmbeddingProviderOptions {
|
|
3
|
+
endpoint?: string;
|
|
4
|
+
model?: string;
|
|
5
|
+
apiKey?: string;
|
|
6
|
+
}
|
|
7
|
+
export declare class OpenAICompatibleEmbeddingProvider implements EmbeddingProvider {
|
|
8
|
+
readonly modelId: string;
|
|
9
|
+
private readonly endpoint;
|
|
10
|
+
private readonly model;
|
|
11
|
+
private readonly apiKey;
|
|
12
|
+
private initialized;
|
|
13
|
+
constructor(options: OpenAICompatibleEmbeddingProviderOptions);
|
|
14
|
+
initialize(): Promise<boolean>;
|
|
15
|
+
embed(text: string): Promise<Float32Array | null>;
|
|
16
|
+
embedBatch(texts: string[]): Promise<(Float32Array | null)[]>;
|
|
17
|
+
dispose(): Promise<void>;
|
|
18
|
+
isLoaded(): boolean;
|
|
19
|
+
}
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=embedding-openai.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedding-openai.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/embedding-openai.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAE9D,UAAU,wCAAwC;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAYD,qBAAa,iCAAkC,YAAW,iBAAiB;IACvE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAS;IAClC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAS;IAC/B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,WAAW,CAAS;gBAEhB,OAAO,EAAE,wCAAwC;IAOvD,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAc9B,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAKjD,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE,CAAC;IA0C7D,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B,QAAQ,IAAI,OAAO;CAGtB"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface EmbeddingProvider {
|
|
2
|
+
readonly modelId: string;
|
|
3
|
+
initialize(): Promise<boolean>;
|
|
4
|
+
embed(text: string): Promise<Float32Array | null>;
|
|
5
|
+
embedBatch(texts: string[]): Promise<(Float32Array | null)[]>;
|
|
6
|
+
dispose(): Promise<void>;
|
|
7
|
+
isLoaded(): boolean;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=embedding-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedding-provider.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/embedding-provider.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAClD,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;IAC9D,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,QAAQ,IAAI,OAAO,CAAC;CACvB"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { EmbeddingConfig } from "../../../config/schema/magic-context";
|
|
2
|
+
import { cosineSimilarity } from "./cosine-similarity";
|
|
3
|
+
export declare function initializeEmbedding(config: EmbeddingConfig): void;
|
|
4
|
+
export declare function isEmbeddingEnabled(): boolean;
|
|
5
|
+
export declare function ensureEmbeddingModel(): Promise<boolean>;
|
|
6
|
+
export declare function embedText(text: string): Promise<Float32Array | null>;
|
|
7
|
+
export declare function embedBatch(texts: string[]): Promise<(Float32Array | null)[]>;
|
|
8
|
+
export declare function getEmbeddingModelId(): string;
|
|
9
|
+
export { cosineSimilarity };
|
|
10
|
+
export declare function disposeEmbeddingModel(): Promise<void>;
|
|
11
|
+
//# sourceMappingURL=embedding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedding.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/embedding.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAG5E,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAyEvD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAmBjE;AAED,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAED,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC,CAO7D;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAW1E;AAED,wBAAsB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE,CAAC,CAelF;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAS3D"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export * from "./constants";
|
|
2
|
+
export * from "./embedding";
|
|
3
|
+
export * from "./embedding-backfill";
|
|
4
|
+
export * from "./normalize-hash";
|
|
5
|
+
export { resolveProjectIdentity } from "./project-identity";
|
|
6
|
+
export { promoteSessionFactsToMemory } from "./promotion";
|
|
7
|
+
export * from "./storage-memory";
|
|
8
|
+
export * from "./storage-memory-embeddings";
|
|
9
|
+
export * from "./storage-memory-fts";
|
|
10
|
+
export * from "./types";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +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,kBAAkB,CAAC;AACjC,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAC5D,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,10 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
import type { SidekickConfig, SidekickRunState } from "../sidekick/types";
|
|
3
|
+
/**
|
|
4
|
+
* Build the <project-memory> XML injection block from stored memories.
|
|
5
|
+
* Returns null if no memories are available for the project.
|
|
6
|
+
*
|
|
7
|
+
* Budget is in approximate tokens (~3.5 chars per token).
|
|
8
|
+
*/
|
|
9
|
+
export declare function buildMemoryInjectionBlock(db: Database, projectPath: string, budgetTokens: number, sidekickConfig?: SidekickConfig, sidekickState?: SidekickRunState, sessionId?: string, userMessage?: string): Promise<string | null>;
|
|
10
|
+
//# sourceMappingURL=injection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"injection.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/injection.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAG3C,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAwD1E;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC3C,EAAE,EAAE,QAAQ,EACZ,WAAW,EAAE,MAAM,EACnB,YAAY,EAAE,MAAM,EACpB,cAAc,CAAC,EAAE,cAAc,EAC/B,aAAa,CAAC,EAAE,gBAAgB,EAChC,SAAS,CAAC,EAAE,MAAM,EAClB,WAAW,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA4ExB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-hash.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/normalize-hash.ts"],"names":[],"mappings":"AAAA,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAG7D"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve a stable project identity from the working directory.
|
|
3
|
+
*
|
|
4
|
+
* Strategy:
|
|
5
|
+
* 1. Git repo with commits → root commit hash (same across worktrees, clones, forks)
|
|
6
|
+
* 2. Git repo with no commits → fallback to directory basename
|
|
7
|
+
* 3. No git repo → fallback to directory basename
|
|
8
|
+
*
|
|
9
|
+
* The root commit hash is immutable and survives remote renames, host
|
|
10
|
+
* migrations, and SSH/HTTPS URL changes. It is the same across all
|
|
11
|
+
* worktrees and clones of the same repository.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* Resolve the project identity for the given directory.
|
|
15
|
+
*
|
|
16
|
+
* Returns a stable string suitable for use as a database key:
|
|
17
|
+
* - `"git:<sha>"` for git repositories with at least one commit
|
|
18
|
+
* - `"dir:<basename>"` for non-git directories or empty repos
|
|
19
|
+
*
|
|
20
|
+
* Results are cached per directory path for the lifetime of the process.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveProjectIdentity(directory: string): string;
|
|
23
|
+
//# sourceMappingURL=project-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"project-identity.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/project-identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAqCH;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAYhE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
interface SessionFact {
|
|
3
|
+
category: string;
|
|
4
|
+
content: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Promote eligible session facts to cross-session memories.
|
|
8
|
+
* Called after replaceAllCompartmentState() commits.
|
|
9
|
+
* Uses normalized_hash for fast dedup. Async embedding runs post-commit.
|
|
10
|
+
*/
|
|
11
|
+
export declare function promoteSessionFactsToMemory(db: Database, sessionId: string, projectPath: string, facts: SessionFact[]): void;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=promotion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promotion.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/promotion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAS3C,UAAU,WAAW;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACnB;AAWD;;;;GAIG;AACH,wBAAgB,2BAA2B,CACvC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,WAAW,EAAE,GACrB,IAAI,CA8BN"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
export declare function saveEmbedding(db: Database, memoryId: number, embedding: Float32Array, modelId: string): void;
|
|
3
|
+
export declare function loadAllEmbeddings(db: Database, projectPath: string): Map<number, Float32Array>;
|
|
4
|
+
export declare function deleteEmbedding(db: Database, memoryId: number): void;
|
|
5
|
+
export declare function getStoredModelId(db: Database, projectPath: string): string | null;
|
|
6
|
+
export declare function clearEmbeddingsForProject(db: Database, projectPath: string): void;
|
|
7
|
+
//# sourceMappingURL=storage-memory-embeddings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-memory-embeddings.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/storage-memory-embeddings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AA2F3C,wBAAgB,aAAa,CACzB,EAAE,EAAE,QAAQ,EACZ,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,YAAY,EACvB,OAAO,EAAE,MAAM,GAChB,IAAI,CAGN;AAED,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,YAAY,CAAC,CAS9F;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAEpE;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGjF;AAED,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAEjF"}
|
|
@@ -0,0 +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,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAoCtC,wBAAgB,iBAAiB,CAC7B,EAAE,EAAE,QAAQ,EACZ,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,MAAM,EACb,KAAK,SAAuB,GAC7B,MAAM,EAAE,CAcV"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Database } from "bun:sqlite";
|
|
2
|
+
import type { Memory, MemoryCategory, MemoryInput, MemoryStatus, VerificationStatus } from "./types";
|
|
3
|
+
export declare const COLUMN_MAP: Record<keyof Memory, string>;
|
|
4
|
+
export declare function isMemoryRow(row: unknown): row is Memory;
|
|
5
|
+
export declare function insertMemory(db: Database, input: MemoryInput): Memory;
|
|
6
|
+
export declare function getMemoryByHash(db: Database, projectPath: string, category: MemoryCategory, normalizedHash: string): Memory | null;
|
|
7
|
+
export declare function getMemoriesByProject(db: Database, projectPath: string, statuses?: MemoryStatus[]): Memory[];
|
|
8
|
+
export declare function getMemoryById(db: Database, id: number): Memory | null;
|
|
9
|
+
export declare function updateMemorySeenCount(db: Database, id: number): void;
|
|
10
|
+
export declare function updateMemoryRetrievalCount(db: Database, id: number): void;
|
|
11
|
+
export declare function updateMemoryStatus(db: Database, id: number, status: MemoryStatus): void;
|
|
12
|
+
export declare function updateMemoryVerification(db: Database, id: number, verificationStatus: VerificationStatus): void;
|
|
13
|
+
export declare function updateMemoryContent(db: Database, id: number, content: string, normalizedHash: string): void;
|
|
14
|
+
export declare function supersededMemory(db: Database, id: number, supersededById: number): void;
|
|
15
|
+
export declare function mergeMemoryStats(db: Database, id: number, seenCount: number, retrievalCount: number, mergedFrom: string, status: MemoryStatus): void;
|
|
16
|
+
export declare function archiveMemory(db: Database, id: number, reason?: string): void;
|
|
17
|
+
export declare function deleteMemory(db: Database, id: number): void;
|
|
18
|
+
export declare function getMemoryCount(db: Database, projectPath?: string): number;
|
|
19
|
+
//# sourceMappingURL=storage-memory.d.ts.map
|
|
@@ -0,0 +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,EAAE,MAAM,YAAY,CAAC;AAE3C,OAAO,KAAK,EACR,MAAM,EACN,cAAc,EACd,WAAW,EAEX,YAAY,EACZ,kBAAkB,EACrB,MAAM,SAAS,CAAC;AAIjB,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,MAAM,EAAE,MAAM,CAsBnD,CAAC;AAkFF,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,MAAM,CA0BvD;AAyMD,wBAAgB,YAAY,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAgCrE;AAED,wBAAgB,eAAe,CAC3B,EAAE,EAAE,QAAQ,EACZ,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,cAAc,EACxB,cAAc,EAAE,MAAM,GACvB,MAAM,GAAG,IAAI,CAMf;AAED,wBAAgB,oBAAoB,CAChC,EAAE,EAAE,QAAQ,EACZ,WAAW,EAAE,MAAM,EACnB,QAAQ,GAAE,YAAY,EAA4B,GACnD,MAAM,EAAE,CAUV;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAMrE;AAED,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAGpE;AAED,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAGzE;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,IAAI,CAEvF;AAqBD,wBAAgB,wBAAwB,CACpC,EAAE,EAAE,QAAQ,EACZ,EAAE,EAAE,MAAM,EACV,kBAAkB,EAAE,kBAAkB,GACvC,IAAI,CASN;AAED,wBAAgB,mBAAmB,CAC/B,EAAE,EAAE,QAAQ,EACZ,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,MAAM,EACf,cAAc,EAAE,MAAM,GACvB,IAAI,CAcN;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,IAAI,CAEvF;AAED,wBAAgB,gBAAgB,CAC5B,EAAE,EAAE,QAAQ,EACZ,EAAE,EAAE,MAAM,EACV,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,YAAY,GACrB,IAAI,CASN;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAiB7E;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAK3D;AAED,wBAAgB,cAAc,CAAC,EAAE,EAAE,QAAQ,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CAWzE"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export type MemoryCategory = "ARCHITECTURE_DECISIONS" | "CONSTRAINTS" | "CONFIG_DEFAULTS" | "NAMING" | "USER_PREFERENCES" | "USER_DIRECTIVES" | "ENVIRONMENT" | "WORKFLOW_RULES" | "KNOWN_ISSUES";
|
|
2
|
+
export type MemoryStatus = "active" | "permanent" | "archived";
|
|
3
|
+
export type VerificationStatus = "unverified" | "verified" | "stale" | "flagged";
|
|
4
|
+
export type MemorySourceType = "historian" | "agent" | "dreamer" | "user";
|
|
5
|
+
export interface Memory {
|
|
6
|
+
id: number;
|
|
7
|
+
projectPath: string;
|
|
8
|
+
category: MemoryCategory;
|
|
9
|
+
content: string;
|
|
10
|
+
normalizedHash: string;
|
|
11
|
+
sourceSessionId: string | null;
|
|
12
|
+
sourceType: MemorySourceType;
|
|
13
|
+
seenCount: number;
|
|
14
|
+
retrievalCount: number;
|
|
15
|
+
firstSeenAt: number;
|
|
16
|
+
createdAt: number;
|
|
17
|
+
updatedAt: number;
|
|
18
|
+
lastSeenAt: number;
|
|
19
|
+
lastRetrievedAt: number | null;
|
|
20
|
+
status: MemoryStatus;
|
|
21
|
+
expiresAt: number | null;
|
|
22
|
+
verificationStatus: VerificationStatus;
|
|
23
|
+
verifiedAt: number | null;
|
|
24
|
+
supersededByMemoryId: number | null;
|
|
25
|
+
mergedFrom: string | null;
|
|
26
|
+
metadataJson: string | null;
|
|
27
|
+
}
|
|
28
|
+
export interface MemoryInput {
|
|
29
|
+
projectPath: string;
|
|
30
|
+
category: MemoryCategory;
|
|
31
|
+
content: string;
|
|
32
|
+
sourceSessionId?: string;
|
|
33
|
+
sourceType?: MemorySourceType;
|
|
34
|
+
expiresAt?: number | null;
|
|
35
|
+
metadataJson?: string | null;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GACpB,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,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,MAAM,GAAG,IAAI,CAAC;IACzB,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B;AAED,MAAM,WAAW,WAAW;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,cAAc,CAAC;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mock-database.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/mock-database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,wBAAgB,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,QAAQ,CAE7C"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parses a range string into a sorted, deduplicated array of integers.
|
|
3
|
+
*
|
|
4
|
+
* Supported syntax:
|
|
5
|
+
* - Single number: "5" → [5]
|
|
6
|
+
* - Range: "3-5" → [3, 4, 5]
|
|
7
|
+
* - Comma-separated: "1,2,9" → [1, 2, 9]
|
|
8
|
+
* - Mixed: "1-5,8,12-15" → [1, 2, 3, 4, 5, 8, 12, 13, 14, 15]
|
|
9
|
+
*
|
|
10
|
+
* @throws {Error} on empty string, non-numeric input, reversed ranges, or ranges exceeding 1000 elements
|
|
11
|
+
*/
|
|
12
|
+
export declare function parseRangeString(input: string): number[];
|
|
13
|
+
//# sourceMappingURL=range-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"range-parser.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/range-parser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAkDxD"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ContextUsage, SchedulerDecision, SessionMeta } from "./types";
|
|
2
|
+
export interface Scheduler {
|
|
3
|
+
shouldExecute(sessionMeta: SessionMeta, contextUsage: ContextUsage, currentTime?: number, sessionId?: string): SchedulerDecision;
|
|
4
|
+
}
|
|
5
|
+
interface SchedulerConfig {
|
|
6
|
+
executeThresholdPercentage: number | {
|
|
7
|
+
default: number;
|
|
8
|
+
[modelKey: string]: number;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export declare function parseCacheTtl(ttl: string): number;
|
|
12
|
+
export declare function createScheduler(config: SchedulerConfig): Scheduler;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=scheduler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/scheduler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAW5E,MAAM,WAAW,SAAS;IACtB,aAAa,CACT,WAAW,EAAE,WAAW,EACxB,YAAY,EAAE,YAAY,EAC1B,WAAW,CAAC,EAAE,MAAM,EACpB,SAAS,CAAC,EAAE,MAAM,GACnB,iBAAiB,CAAC;CACxB;AAED,UAAU,eAAe;IACrB,0BAA0B,EAAE,MAAM,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACxF;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAejD;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,SAAS,CA2ClE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { SidekickConfig } from "../../../config/schema/magic-context";
|
|
2
|
+
import type { PluginContext } from "../../../plugin/types";
|
|
3
|
+
export declare const SIDEKICK_SYSTEM_PROMPT = "You are Sidekick, a focused memory-retrieval subagent for an AI coding assistant.\n\nYour job is to search project memories and return a concise augmentation for the user's prompt.\n\nRules:\n- Use ctx_memory(action=\"search\", query=\"...\") to look up relevant memories before answering.\n- Run targeted searches only; prefer 1-3 precise queries.\n- Return only memories that materially help with the user's prompt.\n- If nothing useful is found, respond with exactly: No relevant memories found.\n- Keep the response focused and concise.\n- Do not invent facts or speculate beyond what memories support.";
|
|
4
|
+
export declare function runSidekick(deps: {
|
|
5
|
+
client: PluginContext["client"];
|
|
6
|
+
sessionId?: string;
|
|
7
|
+
projectPath: string;
|
|
8
|
+
userMessage: string;
|
|
9
|
+
config: SidekickConfig;
|
|
10
|
+
sessionDirectory?: string;
|
|
11
|
+
}): Promise<string | null>;
|
|
12
|
+
//# sourceMappingURL=agent.d.ts.map
|
|
@@ -0,0 +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;AAK3D,eAAO,MAAM,sBAAsB,mmBAU8B,CAAC;AAUlE,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,CAuEzB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { OpenAIChatCompletionResponse, OpenAIChatMessage, OpenAIChatTool } from "./types";
|
|
2
|
+
export declare function chatCompletions(args: {
|
|
3
|
+
endpoint: string;
|
|
4
|
+
apiKey: string;
|
|
5
|
+
model: string;
|
|
6
|
+
messages: OpenAIChatMessage[];
|
|
7
|
+
timeoutMs: number;
|
|
8
|
+
tools?: OpenAIChatTool[];
|
|
9
|
+
temperature?: number;
|
|
10
|
+
sessionId?: string;
|
|
11
|
+
}): Promise<OpenAIChatCompletionResponse>;
|
|
12
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/sidekick/client.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,4BAA4B,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAe/F,wBAAsB,eAAe,CAAC,IAAI,EAAE;IACxC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,cAAc,EAAE,CAAC;IACzB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB,GAAG,OAAO,CAAC,4BAA4B,CAAC,CA2DxC"}
|