@wolfx/opencode-magic-context 0.21.8-patch.1
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/dist/agents/dreamer.d.ts +2 -0
- package/dist/agents/dreamer.d.ts.map +1 -0
- package/dist/agents/historian.d.ts +3 -0
- package/dist/agents/historian.d.ts.map +1 -0
- package/dist/agents/magic-context-prompt.d.ts +3 -0
- package/dist/agents/magic-context-prompt.d.ts.map +1 -0
- package/dist/agents/permissions.d.ts +142 -0
- package/dist/agents/permissions.d.ts.map +1 -0
- package/dist/agents/sidekick.d.ts +2 -0
- package/dist/agents/sidekick.d.ts.map +1 -0
- package/dist/config/agent-disable.d.ts +26 -0
- package/dist/config/agent-disable.d.ts.map +1 -0
- package/dist/config/index.d.ts +33 -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 +841 -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/config/variable.d.ts +48 -0
- package/dist/config/variable.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-marker.d.ts +91 -0
- package/dist/features/magic-context/compaction-marker.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-lease.d.ts +14 -0
- package/dist/features/magic-context/compartment-lease.d.ts.map +1 -0
- package/dist/features/magic-context/compartment-storage.d.ts +130 -0
- package/dist/features/magic-context/compartment-storage.d.ts.map +1 -0
- package/dist/features/magic-context/compression-depth-storage.d.ts +14 -0
- package/dist/features/magic-context/compression-depth-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 +8 -0
- package/dist/features/magic-context/dreamer/index.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/lease.d.ts +8 -0
- package/dist/features/magic-context/dreamer/lease.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/queue.d.ts +44 -0
- package/dist/features/magic-context/dreamer/queue.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/runner.d.ts +81 -0
- package/dist/features/magic-context/dreamer/runner.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/scheduler.d.ts +33 -0
- package/dist/features/magic-context/dreamer/scheduler.d.ts.map +1 -0
- package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts +41 -0
- package/dist/features/magic-context/dreamer/storage-dream-runs.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-prompts.d.ts +26 -0
- package/dist/features/magic-context/dreamer/task-prompts.d.ts.map +1 -0
- package/dist/features/magic-context/git-commits/git-log-reader.d.ts +57 -0
- package/dist/features/magic-context/git-commits/git-log-reader.d.ts.map +1 -0
- package/dist/features/magic-context/git-commits/index.d.ts +7 -0
- package/dist/features/magic-context/git-commits/index.d.ts.map +1 -0
- package/dist/features/magic-context/git-commits/indexer.d.ts +43 -0
- package/dist/features/magic-context/git-commits/indexer.d.ts.map +1 -0
- package/dist/features/magic-context/git-commits/search-git-commits.d.ts +32 -0
- package/dist/features/magic-context/git-commits/search-git-commits.d.ts.map +1 -0
- package/dist/features/magic-context/git-commits/storage-git-commit-embeddings.d.ts +19 -0
- package/dist/features/magic-context/git-commits/storage-git-commit-embeddings.d.ts.map +1 -0
- package/dist/features/magic-context/git-commits/storage-git-commits.d.ts +47 -0
- package/dist/features/magic-context/git-commits/storage-git-commits.d.ts.map +1 -0
- package/dist/features/magic-context/index.d.ts +12 -0
- package/dist/features/magic-context/index.d.ts.map +1 -0
- package/dist/features/magic-context/key-files/aft-availability.d.ts +11 -0
- package/dist/features/magic-context/key-files/aft-availability.d.ts.map +1 -0
- package/dist/features/magic-context/key-files/identify-key-files.d.ts +84 -0
- package/dist/features/magic-context/key-files/identify-key-files.d.ts.map +1 -0
- package/dist/features/magic-context/key-files/project-key-files.d.ts +42 -0
- package/dist/features/magic-context/key-files/project-key-files.d.ts.map +1 -0
- package/dist/features/magic-context/key-files/read-history.d.ts +26 -0
- package/dist/features/magic-context/key-files/read-history.d.ts.map +1 -0
- package/dist/features/magic-context/key-files/read-stats.d.ts +20 -0
- package/dist/features/magic-context/key-files/read-stats.d.ts.map +1 -0
- package/dist/features/magic-context/key-files/storage-key-files.d.ts +25 -0
- package/dist/features/magic-context/key-files/storage-key-files.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 +9 -0
- package/dist/features/magic-context/memory/embedding-backfill.d.ts.map +1 -0
- package/dist/features/magic-context/memory/embedding-cache.d.ts +8 -0
- package/dist/features/magic-context/memory/embedding-cache.d.ts.map +1 -0
- package/dist/features/magic-context/memory/embedding-identity.d.ts +11 -0
- package/dist/features/magic-context/memory/embedding-identity.d.ts.map +1 -0
- package/dist/features/magic-context/memory/embedding-local.d.ts +20 -0
- package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -0
- package/dist/features/magic-context/memory/embedding-openai.d.ts +44 -0
- package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -0
- package/dist/features/magic-context/memory/embedding-probe.d.ts +69 -0
- package/dist/features/magic-context/memory/embedding-probe.d.ts.map +1 -0
- package/dist/features/magic-context/memory/embedding-provider.d.ts +15 -0
- package/dist/features/magic-context/memory/embedding-provider.d.ts.map +1 -0
- package/dist/features/magic-context/memory/embedding.d.ts +39 -0
- package/dist/features/magic-context/memory/embedding.d.ts.map +1 -0
- package/dist/features/magic-context/memory/index.d.ts +12 -0
- package/dist/features/magic-context/memory/index.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 +8 -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 +12 -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 +31 -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/message-index-async.d.ts +12 -0
- package/dist/features/magic-context/message-index-async.d.ts.map +1 -0
- package/dist/features/magic-context/message-index.d.ts +10 -0
- package/dist/features/magic-context/message-index.d.ts.map +1 -0
- package/dist/features/magic-context/migrations.d.ts +33 -0
- package/dist/features/magic-context/migrations.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/overflow-detection.d.ts +51 -0
- package/dist/features/magic-context/overflow-detection.d.ts.map +1 -0
- package/dist/features/magic-context/plugin-messages.d.ts +75 -0
- package/dist/features/magic-context/plugin-messages.d.ts.map +1 -0
- package/dist/features/magic-context/project-embedding-registry.d.ts +44 -0
- package/dist/features/magic-context/project-embedding-registry.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/resolve-subagent-fallback.d.ts +40 -0
- package/dist/features/magic-context/resolve-subagent-fallback.d.ts.map +1 -0
- package/dist/features/magic-context/scheduler.d.ts +18 -0
- package/dist/features/magic-context/scheduler.d.ts.map +1 -0
- package/dist/features/magic-context/search.d.ts +69 -0
- package/dist/features/magic-context/search.d.ts.map +1 -0
- package/dist/features/magic-context/sidekick/agent.d.ts +13 -0
- package/dist/features/magic-context/sidekick/agent.d.ts.map +1 -0
- package/dist/features/magic-context/sidekick/core.d.ts +38 -0
- package/dist/features/magic-context/sidekick/core.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/storage-db.d.ts +48 -0
- package/dist/features/magic-context/storage-db.d.ts.map +1 -0
- package/dist/features/magic-context/storage-meta-persisted.d.ts +246 -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 +31 -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 +62 -0
- package/dist/features/magic-context/storage-notes.d.ts.map +1 -0
- package/dist/features/magic-context/storage-ops.d.ts +7 -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-subagent-invocations.d.ts +52 -0
- package/dist/features/magic-context/storage-subagent-invocations.d.ts.map +1 -0
- package/dist/features/magic-context/storage-tags.d.ts +206 -0
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -0
- package/dist/features/magic-context/storage.d.ts +11 -0
- package/dist/features/magic-context/storage.d.ts.map +1 -0
- 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 +64 -0
- package/dist/features/magic-context/tagger.d.ts.map +1 -0
- package/dist/features/magic-context/tool-definition-tokens.d.ts +79 -0
- package/dist/features/magic-context/tool-definition-tokens.d.ts.map +1 -0
- package/dist/features/magic-context/tool-owner-backfill.d.ts +90 -0
- package/dist/features/magic-context/tool-owner-backfill.d.ts.map +1 -0
- package/dist/features/magic-context/types.d.ts +72 -0
- package/dist/features/magic-context/types.d.ts.map +1 -0
- package/dist/features/magic-context/user-memory/review-user-memories.d.ts +22 -0
- package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -0
- package/dist/features/magic-context/user-memory/storage-user-memory.d.ts +33 -0
- package/dist/features/magic-context/user-memory/storage-user-memory.d.ts.map +1 -0
- package/dist/features/magic-context/work-metrics.d.ts +13 -0
- package/dist/features/magic-context/work-metrics.d.ts.map +1 -0
- package/dist/hooks/auto-update-checker/cache.d.ts +23 -0
- package/dist/hooks/auto-update-checker/cache.d.ts.map +1 -0
- package/dist/hooks/auto-update-checker/checker.d.ts +13 -0
- package/dist/hooks/auto-update-checker/checker.d.ts.map +1 -0
- package/dist/hooks/auto-update-checker/constants.d.ts +10 -0
- package/dist/hooks/auto-update-checker/constants.d.ts.map +1 -0
- package/dist/hooks/auto-update-checker/index.d.ts +40 -0
- package/dist/hooks/auto-update-checker/index.d.ts.map +1 -0
- package/dist/hooks/auto-update-checker/types.d.ts +50 -0
- package/dist/hooks/auto-update-checker/types.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/auto-search-hint.d.ts +34 -0
- package/dist/hooks/magic-context/auto-search-hint.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-runner.d.ts +53 -0
- package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -0
- package/dist/hooks/magic-context/boundary-execution.d.ts +24 -0
- package/dist/hooks/magic-context/boundary-execution.d.ts.map +1 -0
- package/dist/hooks/magic-context/cache-busting-signals.d.ts +10 -0
- package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -0
- package/dist/hooks/magic-context/caveman-cleanup.d.ts +86 -0
- package/dist/hooks/magic-context/caveman-cleanup.d.ts.map +1 -0
- package/dist/hooks/magic-context/caveman.d.ts +35 -0
- package/dist/hooks/magic-context/caveman.d.ts.map +1 -0
- package/dist/hooks/magic-context/command-handler.d.ts +89 -0
- package/dist/hooks/magic-context/command-handler.d.ts.map +1 -0
- package/dist/hooks/magic-context/compaction-marker-manager.d.ts +106 -0
- package/dist/hooks/magic-context/compaction-marker-manager.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-parser.d.ts +18 -0
- package/dist/hooks/magic-context/compartment-parser.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-prompt.d.ts +19 -0
- package/dist/hooks/magic-context/compartment-prompt.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-compressor.d.ts +87 -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 +26 -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 +42 -0
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts +6 -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-partial-recomp.d.ts +29 -0
- package/dist/hooks/magic-context/compartment-runner-partial-recomp.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 +102 -0
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts +28 -0
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner.d.ts +54 -0
- package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-trigger.d.ts +17 -0
- package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -0
- package/dist/hooks/magic-context/derive-budgets.d.ts +57 -0
- package/dist/hooks/magic-context/derive-budgets.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 +49 -0
- package/dist/hooks/magic-context/event-handler.d.ts.map +1 -0
- package/dist/hooks/magic-context/event-payloads.d.ts +62 -0
- package/dist/hooks/magic-context/event-payloads.d.ts.map +1 -0
- package/dist/hooks/magic-context/event-resolvers.d.ts +72 -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 +12 -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/heuristic-cleanup.d.ts +22 -0
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -0
- package/dist/hooks/magic-context/historian-state-file.d.ts +43 -0
- package/dist/hooks/magic-context/historian-state-file.d.ts.map +1 -0
- package/dist/hooks/magic-context/hook-handlers.d.ts +165 -0
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -0
- package/dist/hooks/magic-context/hook.d.ts +118 -0
- package/dist/hooks/magic-context/hook.d.ts.map +1 -0
- package/dist/hooks/magic-context/image-token-estimate.d.ts +6 -0
- package/dist/hooks/magic-context/image-token-estimate.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 +52 -0
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -0
- package/dist/hooks/magic-context/key-files-block.d.ts +27 -0
- package/dist/hooks/magic-context/key-files-block.d.ts.map +1 -0
- package/dist/hooks/magic-context/live-session-state.d.ts +42 -0
- package/dist/hooks/magic-context/live-session-state.d.ts.map +1 -0
- package/dist/hooks/magic-context/note-nudger.d.ts +71 -0
- package/dist/hooks/magic-context/note-nudger.d.ts.map +1 -0
- package/dist/hooks/magic-context/note-visibility.d.ts +43 -0
- package/dist/hooks/magic-context/note-visibility.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 +15 -0
- package/dist/hooks/magic-context/nudge-placement-store.d.ts.map +1 -0
- package/dist/hooks/magic-context/nudger.d.ts +21 -0
- package/dist/hooks/magic-context/nudger.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-chunk.d.ts +99 -0
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-db.d.ts +21 -0
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-formatting.d.ts +35 -0
- package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-raw.d.ts +10 -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/sentinel.d.ts +102 -0
- package/dist/hooks/magic-context/sentinel.d.ts.map +1 -0
- package/dist/hooks/magic-context/strip-content.d.ts +140 -0
- package/dist/hooks/magic-context/strip-content.d.ts.map +1 -0
- package/dist/hooks/magic-context/strip-structural-noise.d.ts +17 -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 +85 -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 +48 -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/temporal-awareness.d.ts +73 -0
- package/dist/hooks/magic-context/temporal-awareness.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/todo-view.d.ts +102 -0
- package/dist/hooks/magic-context/todo-view.d.ts.map +1 -0
- package/dist/hooks/magic-context/tokenizer-calibration.d.ts +85 -0
- package/dist/hooks/magic-context/tokenizer-calibration.d.ts.map +1 -0
- package/dist/hooks/magic-context/tool-drop-target.d.ts +48 -0
- package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +66 -0
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform-context-state.d.ts +12 -0
- package/dist/hooks/magic-context/transform-context-state.d.ts.map +1 -0
- package/dist/hooks/magic-context/transform-message-helpers.d.ts +29 -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 +100 -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 +145 -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 +179800 -0
- package/dist/plugin/conflict-warning-hook.d.ts +34 -0
- package/dist/plugin/conflict-warning-hook.d.ts.map +1 -0
- package/dist/plugin/dream-timer.d.ts +44 -0
- package/dist/plugin/dream-timer.d.ts.map +1 -0
- package/dist/plugin/embedding-bootstrap-helpers.d.ts +35 -0
- package/dist/plugin/embedding-bootstrap-helpers.d.ts.map +1 -0
- package/dist/plugin/embedding-bootstrap.d.ts +3 -0
- package/dist/plugin/embedding-bootstrap.d.ts.map +1 -0
- package/dist/plugin/event.d.ts +13 -0
- package/dist/plugin/event.d.ts.map +1 -0
- package/dist/plugin/hooks/create-session-hooks.d.ts +44 -0
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -0
- package/dist/plugin/messages-transform.d.ts +46 -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/rpc-handlers.d.ts +21 -0
- package/dist/plugin/rpc-handlers.d.ts.map +1 -0
- package/dist/plugin/sidebar-snapshot-cache.d.ts +19 -0
- package/dist/plugin/sidebar-snapshot-cache.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/announcement.d.ts +55 -0
- package/dist/shared/announcement.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/bounded-session-map.d.ts +45 -0
- package/dist/shared/bounded-session-map.d.ts.map +1 -0
- package/dist/shared/conflict-detector.d.ts +74 -0
- package/dist/shared/conflict-detector.d.ts.map +1 -0
- package/dist/shared/conflict-fixer.d.ts +3 -0
- package/dist/shared/conflict-fixer.d.ts.map +1 -0
- package/dist/shared/data-path.d.ts +121 -0
- package/dist/shared/data-path.d.ts.map +1 -0
- package/dist/shared/error-message.d.ts +32 -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/format-threshold.d.ts +24 -0
- package/dist/shared/format-threshold.d.ts.map +1 -0
- package/dist/shared/harness.d.ts +43 -0
- package/dist/shared/harness.d.ts.map +1 -0
- package/dist/shared/index.d.ts +6 -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 +8 -0
- package/dist/shared/jsonc-parser.d.ts.map +1 -0
- package/dist/shared/logger.d.ts +10 -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 +68 -0
- package/dist/shared/model-suggestion-retry.d.ts.map +1 -0
- package/dist/shared/models-dev-cache.d.ts +65 -0
- package/dist/shared/models-dev-cache.d.ts.map +1 -0
- package/dist/shared/native-binding.d.ts +87 -0
- package/dist/shared/native-binding.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/record-type-guard.d.ts +2 -0
- package/dist/shared/record-type-guard.d.ts.map +1 -0
- package/dist/shared/resolve-fallbacks.d.ts +32 -0
- package/dist/shared/resolve-fallbacks.d.ts.map +1 -0
- package/dist/shared/rpc-client.d.ts +17 -0
- package/dist/shared/rpc-client.d.ts.map +1 -0
- package/dist/shared/rpc-notifications.d.ts +24 -0
- package/dist/shared/rpc-notifications.d.ts.map +1 -0
- package/dist/shared/rpc-server.d.ts +20 -0
- package/dist/shared/rpc-server.d.ts.map +1 -0
- package/dist/shared/rpc-types.d.ts +105 -0
- package/dist/shared/rpc-types.d.ts.map +1 -0
- package/dist/shared/rpc-utils.d.ts +19 -0
- package/dist/shared/rpc-utils.d.ts.map +1 -0
- package/dist/shared/sqlite-helpers.d.ts +16 -0
- package/dist/shared/sqlite-helpers.d.ts.map +1 -0
- package/dist/shared/sqlite.d.ts +43 -0
- package/dist/shared/sqlite.d.ts.map +1 -0
- package/dist/shared/stable-json.d.ts +21 -0
- package/dist/shared/stable-json.d.ts.map +1 -0
- package/dist/shared/subagent-runner.d.ts +208 -0
- package/dist/shared/subagent-runner.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/shared/tag-transcript.d.ts +66 -0
- package/dist/shared/tag-transcript.d.ts.map +1 -0
- package/dist/shared/transcript-opencode.d.ts +71 -0
- package/dist/shared/transcript-opencode.d.ts.map +1 -0
- package/dist/shared/transcript.d.ts +212 -0
- package/dist/shared/transcript.d.ts.map +1 -0
- package/dist/shared/tui-config.d.ts +10 -0
- package/dist/shared/tui-config.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 +35 -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 +15 -0
- package/dist/tools/ctx-note/tools.d.ts.map +1 -0
- package/dist/tools/ctx-note/types.d.ts +9 -0
- package/dist/tools/ctx-note/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/ctx-search/constants.d.ts +4 -0
- package/dist/tools/ctx-search/constants.d.ts.map +1 -0
- package/dist/tools/ctx-search/index.d.ts +4 -0
- package/dist/tools/ctx-search/index.d.ts.map +1 -0
- package/dist/tools/ctx-search/tools.d.ts +4 -0
- package/dist/tools/ctx-search/tools.d.ts.map +1 -0
- package/dist/tools/ctx-search/types.d.ts +34 -0
- package/dist/tools/ctx-search/types.d.ts.map +1 -0
- package/dist/tools/index.d.ts +6 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tui/data/context-db.d.ts +36 -0
- package/dist/tui/data/context-db.d.ts.map +1 -0
- package/package.json +80 -0
- package/src/shared/announcement.test.ts +143 -0
- package/src/shared/announcement.ts +97 -0
- package/src/shared/assistant-message-extractor.ts +74 -0
- package/src/shared/bounded-session-map.test.ts +97 -0
- package/src/shared/bounded-session-map.ts +84 -0
- package/src/shared/conflict-detector.test.ts +232 -0
- package/src/shared/conflict-detector.ts +371 -0
- package/src/shared/conflict-fixer.test.ts +124 -0
- package/src/shared/conflict-fixer.ts +222 -0
- package/src/shared/data-path.test.ts +159 -0
- package/src/shared/data-path.ts +155 -0
- package/src/shared/error-message.test.ts +94 -0
- package/src/shared/error-message.ts +115 -0
- package/src/shared/format-bytes.ts +5 -0
- package/src/shared/format-threshold.ts +28 -0
- package/src/shared/harness.ts +61 -0
- package/src/shared/index.ts +5 -0
- package/src/shared/internal-initiator-marker.ts +1 -0
- package/src/shared/jsonc-parser.ts +138 -0
- package/src/shared/logger.ts +94 -0
- package/src/shared/model-requirements.ts +86 -0
- package/src/shared/model-suggestion-retry.test.ts +251 -0
- package/src/shared/model-suggestion-retry.ts +348 -0
- package/src/shared/models-dev-cache.test.ts +394 -0
- package/src/shared/models-dev-cache.ts +337 -0
- package/src/shared/native-binding.ts +311 -0
- package/src/shared/normalize-sdk-response.ts +40 -0
- package/src/shared/opencode-compaction-detector.test.ts +222 -0
- package/src/shared/opencode-compaction-detector.ts +81 -0
- package/src/shared/opencode-config-dir-types.ts +15 -0
- package/src/shared/opencode-config-dir.ts +38 -0
- package/src/shared/record-type-guard.ts +3 -0
- package/src/shared/resolve-fallbacks.test.ts +136 -0
- package/src/shared/resolve-fallbacks.ts +76 -0
- package/src/shared/rpc-client.test.ts +161 -0
- package/src/shared/rpc-client.ts +183 -0
- package/src/shared/rpc-notifications.test.ts +20 -0
- package/src/shared/rpc-notifications.ts +53 -0
- package/src/shared/rpc-server.ts +174 -0
- package/src/shared/rpc-types.ts +104 -0
- package/src/shared/rpc-utils.ts +72 -0
- package/src/shared/session-messages-bounded.test.ts +112 -0
- package/src/shared/sqlite-helpers.ts +27 -0
- package/src/shared/sqlite.ts +134 -0
- package/src/shared/stable-json.test.ts +87 -0
- package/src/shared/stable-json.ts +37 -0
- package/src/shared/subagent-runner.ts +222 -0
- package/src/shared/system-directive.ts +9 -0
- package/src/shared/tag-transcript.ts +553 -0
- package/src/shared/transcript-opencode.ts +259 -0
- package/src/shared/transcript.ts +226 -0
- package/src/shared/tui-config.ts +99 -0
- package/src/tui/data/context-db.ts +303 -0
- package/src/tui/index.tsx +692 -0
- package/src/tui/slots/sidebar-content.tsx +482 -0
- package/src/tui/types/opencode-plugin-tui.d.ts +232 -0
|
@@ -0,0 +1,20 @@
|
|
|
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
|
+
private inFlight;
|
|
8
|
+
private disposing;
|
|
9
|
+
private disposePromise;
|
|
10
|
+
private readonly inFlightWaiters;
|
|
11
|
+
constructor(model?: string);
|
|
12
|
+
initialize(): Promise<boolean>;
|
|
13
|
+
private waitForInFlightToDrain;
|
|
14
|
+
private finishInFlight;
|
|
15
|
+
embed(text: string, signal?: AbortSignal): Promise<Float32Array | null>;
|
|
16
|
+
embedBatch(texts: string[], signal?: AbortSignal): Promise<(Float32Array | null)[]>;
|
|
17
|
+
dispose(): Promise<void>;
|
|
18
|
+
isLoaded(): boolean;
|
|
19
|
+
}
|
|
20
|
+
//# 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":"AAQA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAyT9D,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"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { EmbeddingProvider } from "./embedding-provider";
|
|
2
|
+
interface OpenAICompatibleEmbeddingProviderOptions {
|
|
3
|
+
endpoint?: string;
|
|
4
|
+
model?: string;
|
|
5
|
+
apiKey?: string;
|
|
6
|
+
}
|
|
7
|
+
type CircuitState = "closed" | "open" | "half_open";
|
|
8
|
+
export declare class OpenAICompatibleEmbeddingProvider implements EmbeddingProvider {
|
|
9
|
+
readonly modelId: string;
|
|
10
|
+
private readonly endpoint;
|
|
11
|
+
private readonly model;
|
|
12
|
+
private readonly apiKey;
|
|
13
|
+
private initialized;
|
|
14
|
+
private failureTimes;
|
|
15
|
+
private circuitOpenUntil;
|
|
16
|
+
private openLogged;
|
|
17
|
+
/** True while a half-open probe is in flight. Only the caller who set this
|
|
18
|
+
* to true is allowed to make a real HTTP call; everyone else short-
|
|
19
|
+
* circuits as if the circuit were still OPEN. */
|
|
20
|
+
private halfOpenProbeInFlight;
|
|
21
|
+
constructor(options: OpenAICompatibleEmbeddingProviderOptions);
|
|
22
|
+
initialize(): Promise<boolean>;
|
|
23
|
+
embed(text: string, signal?: AbortSignal): Promise<Float32Array | null>;
|
|
24
|
+
embedBatch(texts: string[], signal?: AbortSignal): Promise<(Float32Array | null)[]>;
|
|
25
|
+
dispose(): Promise<void>;
|
|
26
|
+
isLoaded(): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Decide what this caller should do:
|
|
29
|
+
* - "allow": CLOSED — proceed with a real request, not as a probe
|
|
30
|
+
* - "probe": HALF_OPEN — this caller owns the probe slot
|
|
31
|
+
* - "short_circuit": OPEN or half-open probe already in flight — return nulls
|
|
32
|
+
*
|
|
33
|
+
* Claiming the probe slot (setting `halfOpenProbeInFlight = true`) is done
|
|
34
|
+
* here, synchronously, so concurrent callers see the flag and short-circuit.
|
|
35
|
+
*/
|
|
36
|
+
private claimProbeOrShortCircuit;
|
|
37
|
+
private recordFailure;
|
|
38
|
+
private recordSuccess;
|
|
39
|
+
_getCircuitState(): CircuitState;
|
|
40
|
+
_getFailureCount(): number;
|
|
41
|
+
_resetCircuit(): void;
|
|
42
|
+
}
|
|
43
|
+
export {};
|
|
44
|
+
//# 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":"AAEA,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;AAyCD,KAAK,YAAY,GAAG,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAC;AAEpD,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;IAI5B,OAAO,CAAC,YAAY,CAAgB;IACpC,OAAO,CAAC,gBAAgB,CAAK;IAC7B,OAAO,CAAC,UAAU,CAAS;IAC3B;;sDAEkD;IAClD,OAAO,CAAC,qBAAqB,CAAS;gBAE1B,OAAO,EAAE,wCAAwC;IAYvD,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAc9B,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC;IAKvE,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE,CAAC;IA4InF,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAI9B,QAAQ,IAAI,OAAO;IAInB;;;;;;;;OAQG;IACH,OAAO,CAAC,wBAAwB;IAsBhC,OAAO,CAAC,aAAa;IAiCrB,OAAO,CAAC,aAAa;IAUrB,gBAAgB,IAAI,YAAY;IAQhC,gBAAgB,IAAI,MAAM;IAG1B,aAAa,IAAI,IAAI;CAMxB"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Live verification of an OpenAI-compatible embeddings endpoint.
|
|
3
|
+
*
|
|
4
|
+
* Used by `doctor` (Node) and shared in spirit with the dashboard Rust
|
|
5
|
+
* `test_embedding_endpoint` command — both POST `{model, input}` to
|
|
6
|
+
* `${endpoint}/embeddings` and classify the response. Keeping the two
|
|
7
|
+
* implementations parallel is intentional: doctor runs in the plugin's Node
|
|
8
|
+
* runtime where `fetch` + `AbortSignal.timeout` are available, while the
|
|
9
|
+
* dashboard uses Rust `reqwest` for reasons of its own async stack.
|
|
10
|
+
*/
|
|
11
|
+
export type EmbeddingProbeOutcome = {
|
|
12
|
+
kind: "ok";
|
|
13
|
+
status: number;
|
|
14
|
+
dimensions: number | null;
|
|
15
|
+
} | {
|
|
16
|
+
kind: "auth_failed";
|
|
17
|
+
status: number;
|
|
18
|
+
preview: string;
|
|
19
|
+
} | {
|
|
20
|
+
kind: "endpoint_unsupported";
|
|
21
|
+
status: number;
|
|
22
|
+
preview: string;
|
|
23
|
+
} | {
|
|
24
|
+
kind: "http_error";
|
|
25
|
+
status: number;
|
|
26
|
+
preview: string;
|
|
27
|
+
} | {
|
|
28
|
+
kind: "network_error";
|
|
29
|
+
message: string;
|
|
30
|
+
} | {
|
|
31
|
+
kind: "timeout";
|
|
32
|
+
timeoutMs: number;
|
|
33
|
+
} | {
|
|
34
|
+
kind: "invalid_scheme";
|
|
35
|
+
endpoint: string;
|
|
36
|
+
};
|
|
37
|
+
export interface EmbeddingProbeOptions {
|
|
38
|
+
/**
|
|
39
|
+
* Base endpoint (e.g. `https://api.openai.com/v1`). `/embeddings` is
|
|
40
|
+
* appended by the probe. Trailing slashes are trimmed so both
|
|
41
|
+
* `https://host/v1` and `https://host/v1/` work.
|
|
42
|
+
*/
|
|
43
|
+
endpoint: string;
|
|
44
|
+
model: string;
|
|
45
|
+
apiKey?: string;
|
|
46
|
+
/** Milliseconds before aborting the request. Defaults to 10000. */
|
|
47
|
+
timeoutMs?: number;
|
|
48
|
+
/**
|
|
49
|
+
* Optional fetch override, used only by tests to avoid hitting real
|
|
50
|
+
* network endpoints. Matches the signature of the global `fetch` loosely
|
|
51
|
+
* so callers can drop a mock implementation in without overloads.
|
|
52
|
+
*/
|
|
53
|
+
fetch?: typeof fetch;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Probe an embeddings endpoint and classify the outcome.
|
|
57
|
+
*
|
|
58
|
+
* - 2xx with at least one `data[].embedding` array → `ok` with dimension count
|
|
59
|
+
* - 2xx without `data[].embedding` → `endpoint_unsupported` (e.g. routers
|
|
60
|
+
* that accept the URL but don't implement the embeddings spec)
|
|
61
|
+
* - 401 / 403 → `auth_failed`
|
|
62
|
+
* - 404 / 405 → `endpoint_unsupported` (route not available at this URL)
|
|
63
|
+
* - Other non-2xx → `http_error` with preview
|
|
64
|
+
* - `AbortError` from timeout → `timeout`
|
|
65
|
+
* - Any other thrown error → `network_error`
|
|
66
|
+
* - Missing or non-http(s) scheme → `invalid_scheme` (no request made)
|
|
67
|
+
*/
|
|
68
|
+
export declare function probeEmbeddingEndpoint(options: EmbeddingProbeOptions): Promise<EmbeddingProbeOutcome>;
|
|
69
|
+
//# sourceMappingURL=embedding-probe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"embedding-probe.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/embedding-probe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,MAAM,MAAM,qBAAqB,GAC3B;IAAE,IAAI,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GACzD;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACxD;IAAE,IAAI,EAAE,sBAAsB,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACjE;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GACvD;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC1C;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACtC;IAAE,IAAI,EAAE,gBAAgB,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnD,MAAM,WAAW,qBAAqB;IAClC;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACxB;AAKD;;;;;;;;;;;;GAYG;AACH,wBAAsB,sBAAsB,CACxC,OAAO,EAAE,qBAAqB,GAC/B,OAAO,CAAC,qBAAqB,CAAC,CA+EhC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface EmbeddingProvider {
|
|
2
|
+
readonly modelId: string;
|
|
3
|
+
initialize(): Promise<boolean>;
|
|
4
|
+
/** Embed a single text. `signal` lets callers abort the underlying network
|
|
5
|
+
* request (or long-running local inference) before the provider's internal
|
|
6
|
+
* timeout fires — used by transform-hot-path callers that have their own
|
|
7
|
+
* sub-timeout (e.g. 3s auto-search wants to cancel the 30s embed fetch). */
|
|
8
|
+
embed(text: string, signal?: AbortSignal): Promise<Float32Array | null>;
|
|
9
|
+
/** Batch variant of `embed`. Same signal semantics: aborting cancels the
|
|
10
|
+
* whole batch request (including the underlying HTTP call for remote providers). */
|
|
11
|
+
embedBatch(texts: string[], signal?: AbortSignal): Promise<(Float32Array | null)[]>;
|
|
12
|
+
dispose(): Promise<void>;
|
|
13
|
+
isLoaded(): boolean;
|
|
14
|
+
}
|
|
15
|
+
//# 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;;;iFAG6E;IAC7E,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IACxE;yFACqF;IACrF,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC;IACpF,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,QAAQ,IAAI,OAAO,CAAC;CACvB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { EmbeddingConfig } from "../../../config/schema/magic-context";
|
|
2
|
+
import type { Database } from "../../../shared/sqlite";
|
|
3
|
+
import { cosineSimilarity } from "./cosine-similarity";
|
|
4
|
+
export type { EmbeddingFeatures, ProjectEmbeddingRegistrationSnapshot, } from "../project-embedding-registry";
|
|
5
|
+
export { _resetProjectEmbeddingRegistryForTests, _setTestProviderFactoryForProject, embedBatchForProject, embedTextForProject, embedUnembeddedMemoriesForProject, getProjectEmbeddingSnapshot, registerProjectEmbeddingAndMaybeWipe, registerProjectInObservationMode, sweepAllRegisteredProjects, unregisterProjectEmbedding, } from "../project-embedding-registry";
|
|
6
|
+
export declare function initializeEmbedding(config: EmbeddingConfig): void;
|
|
7
|
+
export declare function isEmbeddingEnabled(): boolean;
|
|
8
|
+
export declare function ensureEmbeddingModel(): Promise<boolean>;
|
|
9
|
+
export declare function embedText(text: string, signal?: AbortSignal): Promise<Float32Array | null>;
|
|
10
|
+
export declare function embedBatch(texts: string[], signal?: AbortSignal): Promise<(Float32Array | null)[]>;
|
|
11
|
+
export declare function embedUnembeddedMemories(db: Database, projectPath: string, config: EmbeddingConfig, batchSize?: number): Promise<number>;
|
|
12
|
+
/**
|
|
13
|
+
* Sweep ALL projects for unembedded memories, draining each fully before
|
|
14
|
+
* moving to the next. Projects are ordered by most-recent memory activity
|
|
15
|
+
* (MAX(updated_at)), so the project you're actively working in gets
|
|
16
|
+
* embedded first after a provider switch.
|
|
17
|
+
*
|
|
18
|
+
* Within one invocation:
|
|
19
|
+
* - Each project is drained in batches of `batchSize` until `embedUnembeddedMemoriesForProject`
|
|
20
|
+
* returns 0 (nothing left, or a batch failure).
|
|
21
|
+
* - Wall-clock deadline + consecutive-empty fail-safe prevent runaway
|
|
22
|
+
* or infinite looping when the provider is unhealthy.
|
|
23
|
+
*
|
|
24
|
+
* Between invocations:
|
|
25
|
+
* - The module-level `sweepInProgress` flag guards against parallel runs
|
|
26
|
+
* from the same process. If a sweep is still running when the next
|
|
27
|
+
* 15-min tick fires, that tick is a no-op.
|
|
28
|
+
*
|
|
29
|
+
* Used by the dream timer for proactive embedding coverage. After a
|
|
30
|
+
* provider change wipes embeddings, this path drains the full backlog on
|
|
31
|
+
* a single tick (bounded by wall clock) instead of trickling 10/15min.
|
|
32
|
+
*/
|
|
33
|
+
export declare function embedAllUnembeddedMemories(db: Database, config: EmbeddingConfig, batchSize?: number): Promise<number>;
|
|
34
|
+
/** Test-only: reset the in-progress guard. */
|
|
35
|
+
export declare function _resetEmbeddingSweepGuard(): void;
|
|
36
|
+
export declare function getEmbeddingModelId(): string;
|
|
37
|
+
export { cosineSimilarity };
|
|
38
|
+
export declare function disposeEmbeddingModel(): Promise<void>;
|
|
39
|
+
//# 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,KAAK,EAAE,QAAQ,EAAkC,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAOvD,YAAY,EACR,iBAAiB,EACjB,oCAAoC,GACvC,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACH,sCAAsC,EACtC,iCAAiC,EACjC,oBAAoB,EACpB,mBAAmB,EACnB,iCAAiC,EACjC,2BAA2B,EAC3B,oCAAoC,EACpC,gCAAgC,EAChC,0BAA0B,EAC1B,0BAA0B,GAC7B,MAAM,+BAA+B,CAAC;AAwFvC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,eAAe,GAAG,IAAI,CAoBjE;AAED,wBAAgB,kBAAkB,IAAI,OAAO,CAE5C;AAED,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,OAAO,CAAC,CAO7D;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAWhG;AAED,wBAAsB,UAAU,CAC5B,KAAK,EAAE,MAAM,EAAE,EACf,MAAM,CAAC,EAAE,WAAW,GACrB,OAAO,CAAC,CAAC,YAAY,GAAG,IAAI,CAAC,EAAE,CAAC,CAelC;AAED,wBAAsB,uBAAuB,CACzC,EAAE,EAAE,QAAQ,EACZ,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,eAAe,EACvB,SAAS,SAAK,GACf,OAAO,CAAC,MAAM,CAAC,CAEjB;AAgBD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,0BAA0B,CAC5C,EAAE,EAAE,QAAQ,EACZ,MAAM,EAAE,eAAe,EACvB,SAAS,SAAK,GACf,OAAO,CAAC,MAAM,CAAC,CAsEjB;AAED,8CAA8C;AAC9C,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD;AAmDD,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC;AAE5B,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAS3D"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export * from "./constants";
|
|
2
|
+
export * from "./embedding";
|
|
3
|
+
export * from "./embedding-backfill";
|
|
4
|
+
export * from "./embedding-cache";
|
|
5
|
+
export * from "./normalize-hash";
|
|
6
|
+
export { resolveProjectIdentity } from "./project-identity";
|
|
7
|
+
export { promoteSessionFactsToMemory } from "./promotion";
|
|
8
|
+
export * from "./storage-memory";
|
|
9
|
+
export * from "./storage-memory-embeddings";
|
|
10
|
+
export * from "./storage-memory-fts";
|
|
11
|
+
export * from "./types";
|
|
12
|
+
//# 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,mBAAmB,CAAC;AAClC,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 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-hash.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/memory/normalize-hash.ts"],"names":[],"mappings":"AAEA,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAK7D"}
|
|
@@ -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;AA2CH;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAYhE"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Database } from "../../../shared/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":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAQvD,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,CAoCN"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Database } from "../../../shared/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
|
+
export declare function getDistinctStoredModelIds(db: Database, projectPath: string): Set<string | null>;
|
|
8
|
+
//# 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,EAAkC,MAAM,wBAAwB,CAAC;AAqGvF,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;AAED,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,GAAG,IAAI,CAAC,CAG/F"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Database } from "../../../shared/sqlite";
|
|
2
|
+
import type { Memory } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Sanitize a user query for FTS5 MATCH syntax.
|
|
5
|
+
*
|
|
6
|
+
* FTS5 interprets characters like `-`, `:`, `*`, `(`, `)` as operators.
|
|
7
|
+
* This wraps each whitespace-delimited token in double quotes so special
|
|
8
|
+
* characters are treated as literal content rather than query syntax.
|
|
9
|
+
*/
|
|
10
|
+
export declare function sanitizeFtsQuery(query: string): string;
|
|
11
|
+
export declare function searchMemoriesFTS(db: Database, projectPath: string, query: string, limit?: number): Memory[];
|
|
12
|
+
//# sourceMappingURL=storage-memory-fts.d.ts.map
|
|
@@ -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,EAAkC,MAAM,wBAAwB,CAAC;AAEvF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAoBtC;;;;;;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"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Database } from "../../../shared/sqlite";
|
|
2
|
+
import type { Memory, MemoryCategory, MemoryInput, MemoryStatus, VerificationStatus } from "./types";
|
|
3
|
+
export declare const COLUMN_MAP: Record<keyof Memory, string>;
|
|
4
|
+
export interface MemoryCountsByStatus {
|
|
5
|
+
total: number;
|
|
6
|
+
active: number;
|
|
7
|
+
permanent: number;
|
|
8
|
+
archived: number;
|
|
9
|
+
merged: number;
|
|
10
|
+
ids: number[];
|
|
11
|
+
archivedIds: number[];
|
|
12
|
+
mergedIds: number[];
|
|
13
|
+
}
|
|
14
|
+
export declare function isMemoryRow(row: unknown): row is Memory;
|
|
15
|
+
export declare function toMemory(row: Memory): Memory;
|
|
16
|
+
export declare function insertMemory(db: Database, input: MemoryInput): Memory;
|
|
17
|
+
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 getMemoryById(db: Database, id: number): Memory | null;
|
|
20
|
+
export declare function updateMemorySeenCount(db: Database, id: number): void;
|
|
21
|
+
export declare function updateMemoryRetrievalCount(db: Database, id: number): void;
|
|
22
|
+
export declare function updateMemoryStatus(db: Database, id: number, status: MemoryStatus): void;
|
|
23
|
+
export declare function updateMemoryVerification(db: Database, id: number, verificationStatus: VerificationStatus): void;
|
|
24
|
+
export declare function updateMemoryContent(db: Database, id: number, content: string, normalizedHash: string): void;
|
|
25
|
+
export declare function supersededMemory(db: Database, id: number, supersededById: number): void;
|
|
26
|
+
export declare function mergeMemoryStats(db: Database, id: number, seenCount: number, retrievalCount: number, mergedFrom: string, status: MemoryStatus): void;
|
|
27
|
+
export declare function archiveMemory(db: Database, id: number, reason?: string): void;
|
|
28
|
+
export declare function deleteMemory(db: Database, id: number): void;
|
|
29
|
+
export declare function getMemoryCount(db: Database, projectPath?: string): number;
|
|
30
|
+
export declare function getMemoryCountsByStatus(db: Database, projectPath: string): MemoryCountsByStatus;
|
|
31
|
+
//# 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,EAAkC,MAAM,wBAAwB,CAAC;AAGvF,OAAO,KAAK,EACR,MAAM,EACN,cAAc,EACd,WAAW,EAEX,YAAY,EACZ,kBAAkB,EACrB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,MAAM,MAAM,EAAE,MAAM,CAsBnD,CAAC;AAqDF,MAAM,WAAW,oBAAoB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,EAAE,MAAM,EAAE,CAAC;CACvB;AAgDD,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,GAAG,GAAG,IAAI,MAAM,CA0BvD;AAED,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAwB5C;AA0LD,wBAAgB,YAAY,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,WAAW,GAAG,MAAM,CAkCrE;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,CAuBN;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,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"}
|
|
@@ -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,12 @@
|
|
|
1
|
+
import type { RawMessage } from "../../hooks/magic-context/read-session-raw";
|
|
2
|
+
import type { Database } from "../../shared/sqlite";
|
|
3
|
+
type ReadMessages = (sessionId: string) => RawMessage[];
|
|
4
|
+
type ReadSingleMessage = (sessionId: string, messageId: string) => RawMessage | null;
|
|
5
|
+
export declare function scheduleReconciliation(db: Database, sessionId: string, readMessages: ReadMessages): void;
|
|
6
|
+
export declare function scheduleIncrementalIndex(db: Database, sessionId: string, messageId: string, readSingleMessage: ReadSingleMessage): void;
|
|
7
|
+
export declare function scheduleClearAndReindex(db: Database, sessionId: string, readMessages: ReadMessages): void;
|
|
8
|
+
export declare function isSessionReconciled(sessionId: string): boolean;
|
|
9
|
+
export declare function clearSessionTracking(sessionId: string): void;
|
|
10
|
+
export declare function __resetMessageIndexAsyncForTests(): void;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=message-index-async.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-index-async.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/message-index-async.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAE7E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAsEpD,KAAK,YAAY,GAAG,CAAC,SAAS,EAAE,MAAM,KAAK,UAAU,EAAE,CAAC;AACxD,KAAK,iBAAiB,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,UAAU,GAAG,IAAI,CAAC;AA8ErF,wBAAgB,sBAAsB,CAClC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,YAAY,GAC3B,IAAI,CAYN;AAED,wBAAgB,wBAAwB,CACpC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,iBAAiB,GACrC,IAAI,CAyBN;AAED,wBAAgB,uBAAuB,CACnC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,YAAY,GAC3B,IAAI,CAcN;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAE9D;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAkB5D;AAED,wBAAgB,gCAAgC,IAAI,IAAI,CASvD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { RawMessage } from "../../hooks/magic-context/read-session-raw";
|
|
2
|
+
import type { Database } from "../../shared/sqlite";
|
|
3
|
+
export declare function getLastIndexedOrdinal(db: Database, sessionId: string): number;
|
|
4
|
+
export declare function deleteIndexedMessage(db: Database, sessionId: string, messageId: string): number;
|
|
5
|
+
export declare function clearIndexedMessages(db: Database, sessionId: string): void;
|
|
6
|
+
export declare function getIndexableContent(role: string, parts: unknown[]): string;
|
|
7
|
+
export declare function indexSingleMessage(db: Database, sessionId: string, message: RawMessage): boolean;
|
|
8
|
+
export declare function indexMessagesAfterOrdinal(db: Database, sessionId: string, messages: RawMessage[], lastIndexedOrdinal: number, finalWatermark?: number): number;
|
|
9
|
+
export declare function ensureMessagesIndexed(db: Database, sessionId: string, readMessages: (sessionId: string) => RawMessage[]): void;
|
|
10
|
+
//# sourceMappingURL=message-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-index.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/message-index.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4CAA4C,CAAC;AAE7E,OAAO,KAAK,EAAE,QAAQ,EAAkC,MAAM,qBAAqB,CAAC;AAqFpF,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAG7E;AAiBD,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAU/F;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAM1E;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,CAsB1E;AAmCD,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAIhG;AAED,wBAAgB,yBAAyB,CACrC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,UAAU,EAAE,EACtB,kBAAkB,EAAE,MAAM,EAC1B,cAAc,GAAE,MAAwB,GACzC,MAAM,CAiDR;AAED,wBAAgB,qBAAqB,CACjC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,UAAU,EAAE,GAClD,IAAI,CAmBN"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Database } from "../../shared/sqlite";
|
|
2
|
+
/**
|
|
3
|
+
* Detect the specific case where a sibling process already committed the
|
|
4
|
+
* same `schema_migrations` row we're about to insert. Two OpenCode/Pi
|
|
5
|
+
* instances starting concurrently can both read `MAX(version)=N` before
|
|
6
|
+
* either commits. The first commits v(N+1); the second's transaction body
|
|
7
|
+
* runs `migration.up()` (a no-op now that the schema change already
|
|
8
|
+
* landed), then hits PRIMARY KEY conflict on the
|
|
9
|
+
* `INSERT INTO schema_migrations` row.
|
|
10
|
+
*
|
|
11
|
+
* Without this guard the plugin fail-closes and the second instance
|
|
12
|
+
* refuses to start. With it, we recognize "sibling beat us to it",
|
|
13
|
+
* re-read the version, and continue from the next pending migration.
|
|
14
|
+
*
|
|
15
|
+
* Important: only PRIMARY KEY conflicts on `schema_migrations` are
|
|
16
|
+
* swallowed. Any other failure (CREATE TABLE, ALTER TABLE, data heal,
|
|
17
|
+
* etc.) surfaces normally and fail-closes per contract.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isSiblingMigrationConflict(db: Database, error: unknown, version: number): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Run all pending migrations sequentially.
|
|
22
|
+
* Each migration runs in its own transaction — if it fails, only that migration rolls back.
|
|
23
|
+
* Already-applied migrations are skipped.
|
|
24
|
+
*
|
|
25
|
+
* Multi-instance race tolerance: when two plugin processes start against
|
|
26
|
+
* the same shared DB, both can read the same MAX(version) before either
|
|
27
|
+
* commits. The first wins; the second's INSERT into schema_migrations
|
|
28
|
+
* fails with a PRIMARY KEY conflict. We catch that specific case and
|
|
29
|
+
* resume from the next pending migration. All other migration errors
|
|
30
|
+
* still fail-close per the existing contract.
|
|
31
|
+
*/
|
|
32
|
+
export declare function runMigrations(db: Database): void;
|
|
33
|
+
//# sourceMappingURL=migrations.d.ts.map
|
|
@@ -0,0 +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;AAutBpD;;;;;;;;;;;;;;;;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":"mock-database.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/mock-database.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,wBAAgB,UAAU,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,QAAQ,CAE7C"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider-agnostic context-overflow error detection.
|
|
3
|
+
*
|
|
4
|
+
* When a provider rejects a request because the prompt exceeds its context
|
|
5
|
+
* window, we want to react:
|
|
6
|
+
* 1. Trigger emergency recovery (historian + aggressive drops) so the next
|
|
7
|
+
* turn fits.
|
|
8
|
+
* 2. If the error message reveals the real context limit, persist it as a
|
|
9
|
+
* session-specific override so pressure math is accurate going forward.
|
|
10
|
+
*
|
|
11
|
+
* Pattern list adapted from OpenCode's `packages/opencode/src/provider/error.ts`
|
|
12
|
+
* (BSD-licensed). We keep our own copy rather than importing OpenCode internals
|
|
13
|
+
* so the plugin stays decoupled from OpenCode versioning.
|
|
14
|
+
*
|
|
15
|
+
* References:
|
|
16
|
+
* - OpenCode overflow detection (origin of patterns):
|
|
17
|
+
* https://github.com/sst/opencode/blob/main/packages/opencode/src/provider/error.ts
|
|
18
|
+
* - Adapted originally from:
|
|
19
|
+
* https://github.com/earendil-works/pi-mono/blob/main/packages/ai/src/utils/overflow.ts
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Regexes that match provider-reported context-overflow errors. Keep in sync
|
|
23
|
+
* with upstream OpenCode patterns — new providers can be added here as they
|
|
24
|
+
* emerge.
|
|
25
|
+
*/
|
|
26
|
+
export declare const OVERFLOW_PATTERNS: ReadonlyArray<RegExp>;
|
|
27
|
+
export interface OverflowDetection {
|
|
28
|
+
/** True if the error message matches a known overflow pattern. */
|
|
29
|
+
isOverflow: boolean;
|
|
30
|
+
/** Reported context limit in tokens, if extractable from the message. */
|
|
31
|
+
reportedLimit?: number;
|
|
32
|
+
/** The pattern that matched, useful for logging/diagnostics. */
|
|
33
|
+
matchedPattern?: string;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Extract an error message from any reasonable shape. Events from OpenCode can
|
|
37
|
+
* deliver errors as strings, Error instances, or plain objects with `message`.
|
|
38
|
+
*/
|
|
39
|
+
export declare function extractErrorMessage(error: unknown): string;
|
|
40
|
+
/**
|
|
41
|
+
* Detect whether an error represents a provider-side context-overflow
|
|
42
|
+
* rejection, and optionally extract the reported limit.
|
|
43
|
+
*/
|
|
44
|
+
export declare function detectOverflow(error: unknown): OverflowDetection;
|
|
45
|
+
/**
|
|
46
|
+
* Extract the reported context-limit (in tokens) from an error message if one
|
|
47
|
+
* of the known patterns matches. Returns undefined when no plausible number
|
|
48
|
+
* can be extracted. Guards against false matches via plausibility clamp.
|
|
49
|
+
*/
|
|
50
|
+
export declare function parseReportedLimit(message: string): number | undefined;
|
|
51
|
+
//# sourceMappingURL=overflow-detection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"overflow-detection.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/overflow-detection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,aAAa,CAAC,MAAM,CAqBnD,CAAC;AA8BF,MAAM,WAAW,iBAAiB;IAC9B,kEAAkE;IAClE,UAAU,EAAE,OAAO,CAAC;IACpB,yEAAyE;IACzE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gEAAgE;IAChE,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CA6B1D;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,iBAAiB,CA8BhE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAatE"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import type { Database } from "../../shared/sqlite";
|
|
2
|
+
/**
|
|
3
|
+
* SQLite-backed message bus for TUI ↔ server plugin communication.
|
|
4
|
+
*
|
|
5
|
+
* Both the server plugin and TUI plugin share the same `context.db`.
|
|
6
|
+
* Messages are written by one side and consumed by the other via polling.
|
|
7
|
+
*
|
|
8
|
+
* Directions:
|
|
9
|
+
* - "server_to_tui": Server sends toasts, dialogs, state updates to TUI
|
|
10
|
+
* - "tui_to_server": TUI sends dialog confirmations, action triggers to server
|
|
11
|
+
*
|
|
12
|
+
* Message types:
|
|
13
|
+
* - "toast": Show a toast notification { message, variant?, duration? }
|
|
14
|
+
* - "dialog_confirm": Show a confirmation dialog { id, title, message }
|
|
15
|
+
* - "dialog_result": TUI response to a dialog { id, confirmed }
|
|
16
|
+
* - "state_update": State change hint { key, value }
|
|
17
|
+
*
|
|
18
|
+
* Messages are auto-cleaned after 5 minutes to prevent table bloat.
|
|
19
|
+
*/
|
|
20
|
+
export type MessageDirection = "server_to_tui" | "tui_to_server";
|
|
21
|
+
export type MessageType = "toast" | "dialog_confirm" | "dialog_result" | "state_update" | "action";
|
|
22
|
+
export interface PluginMessage {
|
|
23
|
+
id: number;
|
|
24
|
+
direction: MessageDirection;
|
|
25
|
+
type: MessageType;
|
|
26
|
+
payload: Record<string, unknown>;
|
|
27
|
+
sessionId: string | null;
|
|
28
|
+
createdAt: number;
|
|
29
|
+
consumedAt: number | null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Send a message from server to TUI.
|
|
33
|
+
*/
|
|
34
|
+
export declare function sendToTui(db: Database, type: MessageType, payload: Record<string, unknown>, sessionId?: string): number;
|
|
35
|
+
/**
|
|
36
|
+
* Send a message from TUI to server.
|
|
37
|
+
*/
|
|
38
|
+
export declare function sendToServer(db: Database, type: MessageType, payload: Record<string, unknown>, sessionId?: string): number;
|
|
39
|
+
/**
|
|
40
|
+
* Consume unconsumed messages for a given direction.
|
|
41
|
+
* Marks consumed messages and returns them.
|
|
42
|
+
* Also cleans up old messages (>5min) to prevent table bloat.
|
|
43
|
+
*/
|
|
44
|
+
export declare function consumeMessages(db: Database, direction: MessageDirection, options?: {
|
|
45
|
+
type?: MessageType;
|
|
46
|
+
sessionId?: string;
|
|
47
|
+
}): PluginMessage[];
|
|
48
|
+
/**
|
|
49
|
+
* Peek at unconsumed messages without consuming them.
|
|
50
|
+
*/
|
|
51
|
+
export declare function peekMessages(db: Database, direction: MessageDirection, options?: {
|
|
52
|
+
type?: MessageType;
|
|
53
|
+
sessionId?: string;
|
|
54
|
+
}): PluginMessage[];
|
|
55
|
+
/**
|
|
56
|
+
* Convenience: send a toast to TUI.
|
|
57
|
+
*/
|
|
58
|
+
export declare function sendTuiToast(db: Database, message: string, options?: {
|
|
59
|
+
variant?: "info" | "warning" | "error" | "success";
|
|
60
|
+
duration?: number;
|
|
61
|
+
sessionId?: string;
|
|
62
|
+
}): number;
|
|
63
|
+
/**
|
|
64
|
+
* Convenience: send a confirmation dialog request to TUI.
|
|
65
|
+
* Returns the message ID which the TUI will reference in its dialog_result response.
|
|
66
|
+
*/
|
|
67
|
+
export declare function sendTuiConfirmDialog(db: Database, id: string, title: string, message: string, sessionId?: string): number;
|
|
68
|
+
/**
|
|
69
|
+
* Convenience: check for a dialog result from TUI.
|
|
70
|
+
* Returns the confirmation result or null if not yet responded.
|
|
71
|
+
*/
|
|
72
|
+
export declare function checkDialogResult(db: Database, dialogId: string): {
|
|
73
|
+
confirmed: boolean;
|
|
74
|
+
} | null;
|
|
75
|
+
//# sourceMappingURL=plugin-messages.d.ts.map
|