@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,121 @@
|
|
|
1
|
+
import { type HarnessId } from "./harness";
|
|
2
|
+
export declare function getDataDir(): string;
|
|
3
|
+
/**
|
|
4
|
+
* Per-harness scratch directory under the OS temp dir.
|
|
5
|
+
*
|
|
6
|
+
* Layout:
|
|
7
|
+
* - OpenCode: `${os.tmpdir()}/opencode/magic-context/`
|
|
8
|
+
* - Pi: `${os.tmpdir()}/pi/magic-context/`
|
|
9
|
+
*
|
|
10
|
+
* Why a per-harness subtree of `os.tmpdir()`:
|
|
11
|
+
* 1. OpenCode Desktop runs as an Electron app with a permission sandbox.
|
|
12
|
+
* Writing to arbitrary tmp paths can trigger user-visible permission
|
|
13
|
+
* prompts; the `${tmpdir}/opencode/` subtree is allow-listed by
|
|
14
|
+
* OpenCode, so anything we put under it never asks for permission.
|
|
15
|
+
* 2. Splitting OpenCode from Pi keeps their logs and historian dump
|
|
16
|
+
* directories cleanly separated. `doctor --issue` for each harness
|
|
17
|
+
* reports diagnostics from the matching subtree, so an OpenCode
|
|
18
|
+
* issue report never includes Pi log noise (and vice versa).
|
|
19
|
+
* 3. Pi has no permission sandbox, so the path choice is purely
|
|
20
|
+
* cosmetic for Pi — it just keeps the layout symmetric.
|
|
21
|
+
*
|
|
22
|
+
* Pass an explicit `harness` only when the caller already knows the
|
|
23
|
+
* harness without relying on the global `setHarness()` state (e.g. the
|
|
24
|
+
* CLI's doctor commands, which target a specific harness regardless of
|
|
25
|
+
* which plugin is loaded). Production runtime callers should omit it so
|
|
26
|
+
* the helper picks up the boot-time harness automatically.
|
|
27
|
+
*/
|
|
28
|
+
export declare function getMagicContextTempDir(harness?: HarnessId): string;
|
|
29
|
+
/**
|
|
30
|
+
* Standard log file path the plugin writes to. Pi and OpenCode write to
|
|
31
|
+
* SEPARATE logs under their respective harness subtrees so a single
|
|
32
|
+
* machine running both harnesses doesn't interleave session traces.
|
|
33
|
+
*
|
|
34
|
+
* The plugin's buffered logger calls this on every flush rather than
|
|
35
|
+
* caching, so `setHarness("pi")` taking effect after module load is
|
|
36
|
+
* reflected in the next flush.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getMagicContextLogPath(harness?: HarnessId): string;
|
|
39
|
+
/**
|
|
40
|
+
* Directory used for both historian validation-failure dumps and the
|
|
41
|
+
* existing-state offload XMLs that large historian/recomp passes write
|
|
42
|
+
* before invoking the model. Per-harness so dumps from different
|
|
43
|
+
* harnesses don't collide on filename and so `doctor --issue` for each
|
|
44
|
+
* harness reports only its own historian artifacts.
|
|
45
|
+
*/
|
|
46
|
+
export declare function getMagicContextHistorianDir(harness?: HarnessId): string;
|
|
47
|
+
/**
|
|
48
|
+
* Project-local magic-context artifact directory.
|
|
49
|
+
*
|
|
50
|
+
* Layout: `<project-directory>/.opencode/magic-context/`
|
|
51
|
+
*
|
|
52
|
+
* Used for artifacts that the historian/recomp pipeline writes during a run
|
|
53
|
+
* and that the model is asked to read via its native Read tool. OpenCode's
|
|
54
|
+
* `external_directory` permission system asks the user before reading any
|
|
55
|
+
* file outside the project directory or its worktree, which interrupts every
|
|
56
|
+
* historian run when artifacts live under `os.tmpdir()`. Writing under the
|
|
57
|
+
* project's own `.opencode/` subtree falls inside the project boundary and
|
|
58
|
+
* never triggers a permission prompt.
|
|
59
|
+
*
|
|
60
|
+
* The `.opencode/` parent dir is OpenCode's own per-project convention (used
|
|
61
|
+
* for project-local config, plans, dumps, plugin installs). Anchoring
|
|
62
|
+
* magic-context artifacts under `.opencode/magic-context/` keeps them
|
|
63
|
+
* co-located with related OpenCode metadata and makes them easy for users to
|
|
64
|
+
* locate when debugging.
|
|
65
|
+
*
|
|
66
|
+
* Logger does NOT use this — log files stay in the per-harness tmp subtree
|
|
67
|
+
* because they are written by the plugin process itself (no model-side Read
|
|
68
|
+
* tool call, no permission prompt) and span sessions/projects.
|
|
69
|
+
*/
|
|
70
|
+
export declare function getProjectMagicContextDir(directory: string): string;
|
|
71
|
+
/**
|
|
72
|
+
* Project-local historian artifact directory.
|
|
73
|
+
*
|
|
74
|
+
* Layout: `<project-directory>/.opencode/magic-context/historian/`
|
|
75
|
+
*
|
|
76
|
+
* Used for:
|
|
77
|
+
* - existing-state offload XMLs that long historian/recomp passes write
|
|
78
|
+
* before invoking the model (the model reads the file via Read tool)
|
|
79
|
+
* - validation-failure dump XMLs preserved for debugging
|
|
80
|
+
*
|
|
81
|
+
* Callers must `mkdirSync(dir, { recursive: true })` before writing — the
|
|
82
|
+
* `.opencode/` parent may not exist on a fresh project, and write failures
|
|
83
|
+
* here must degrade gracefully (e.g. historian falls back to inline state).
|
|
84
|
+
*/
|
|
85
|
+
export declare function getProjectMagicContextHistorianDir(directory: string): string;
|
|
86
|
+
export declare function getOpenCodeStorageDir(): string;
|
|
87
|
+
/**
|
|
88
|
+
* Resolve the shared magic-context storage directory.
|
|
89
|
+
*
|
|
90
|
+
* Magic-context's own data (compartments, facts, memories, embeddings, dream
|
|
91
|
+
* runs, notes, etc.) lives at this path regardless of which harness loaded the
|
|
92
|
+
* plugin (OpenCode or Pi). This enables:
|
|
93
|
+
* - Shared project memories across harnesses
|
|
94
|
+
* - Shared embedding cache
|
|
95
|
+
* - Shared Dreamer runs (one per project per machine)
|
|
96
|
+
* - Future cross-harness session migration
|
|
97
|
+
*
|
|
98
|
+
* Layout: <XDG_DATA_HOME>/cortexkit/magic-context/
|
|
99
|
+
*/
|
|
100
|
+
export declare function getMagicContextStorageDir(): string;
|
|
101
|
+
/**
|
|
102
|
+
* Legacy magic-context storage directory used by the OpenCode plugin before the
|
|
103
|
+
* shared cortexkit path. Used only for one-time migration of existing data into
|
|
104
|
+
* the new shared location. The legacy directory is left in place after copy so
|
|
105
|
+
* users can roll back if needed; manual cleanup is safe after one stable
|
|
106
|
+
* release.
|
|
107
|
+
*/
|
|
108
|
+
export declare function getLegacyOpenCodeMagicContextStorageDir(): string;
|
|
109
|
+
/**
|
|
110
|
+
* Resolve OpenCode's cache base directory.
|
|
111
|
+
*
|
|
112
|
+
* OpenCode uses the `xdg-basedir` package, which — on every platform, including
|
|
113
|
+
* Windows — falls back to `<homedir>/.cache` when `XDG_CACHE_HOME` is unset.
|
|
114
|
+
* A previous Windows-specific branch that resolved to `%LOCALAPPDATA%` did not
|
|
115
|
+
* match OpenCode's own resolution and caused `doctor --force` to target a
|
|
116
|
+
* non-existent directory, leaving the real cache at `C:\Users\<user>\.cache`
|
|
117
|
+
* untouched.
|
|
118
|
+
*/
|
|
119
|
+
export declare function getCacheDir(): string;
|
|
120
|
+
export declare function getOpenCodeCacheDir(): string;
|
|
121
|
+
//# sourceMappingURL=data-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-path.d.ts","sourceRoot":"","sources":["../../src/shared/data-path.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAEvD,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,SAAwB,GAAG,MAAM,CAEhF;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,SAAwB,GAAG,MAAM,CAEhF;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,GAAE,SAAwB,GAAG,MAAM,CAErF;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,kCAAkC,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAElD;AAED;;;;;;GAMG;AACH,wBAAgB,uCAAuC,IAAI,MAAM,CAEhE;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare function getErrorMessage(error: unknown): string;
|
|
2
|
+
/**
|
|
3
|
+
* Produce a rich, safe-to-log description of any thrown value.
|
|
4
|
+
*
|
|
5
|
+
* Motivated by SDK errors whose `.message` is empty while `.name`/`toString()`
|
|
6
|
+
* carry the actual signal (e.g. `NotFoundError` with no message on OpenCode
|
|
7
|
+
* session-delete races). Using {@link getErrorMessage} alone erases that signal.
|
|
8
|
+
*
|
|
9
|
+
* Captures:
|
|
10
|
+
* - `name` from the Error (defaults to `constructor.name`)
|
|
11
|
+
* - `message` (may be empty)
|
|
12
|
+
* - first few stack frames
|
|
13
|
+
* - `String(error)` so objects and custom toString surfaces are visible
|
|
14
|
+
* - Common HTTP-shape fields (`status`, `statusCode`, `code`)
|
|
15
|
+
* - `cause` chain summary (first level only)
|
|
16
|
+
*
|
|
17
|
+
* Returns a compact, single-line-friendly string suitable for log lines,
|
|
18
|
+
* plus a structured object for callers that want individual fields.
|
|
19
|
+
*/
|
|
20
|
+
export interface ErrorDescription {
|
|
21
|
+
name: string;
|
|
22
|
+
message: string;
|
|
23
|
+
status?: string;
|
|
24
|
+
code?: string;
|
|
25
|
+
causeName?: string;
|
|
26
|
+
stackHead?: string;
|
|
27
|
+
stringForm: string;
|
|
28
|
+
/** Best short summary for human-readable logs. Never empty. */
|
|
29
|
+
brief: string;
|
|
30
|
+
}
|
|
31
|
+
export declare function describeError(error: unknown): ErrorDescription;
|
|
32
|
+
//# sourceMappingURL=error-message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"error-message.d.ts","sourceRoot":"","sources":["../../src/shared/error-message.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEtD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;CACjB;AAaD,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CA6D9D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-bytes.d.ts","sourceRoot":"","sources":["../../src/shared/format-bytes.ts"],"names":[],"mappings":"AAAA,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAIjD"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Format an execute-threshold percentage for human-facing display.
|
|
3
|
+
*
|
|
4
|
+
* `executeThreshold` in the snapshot is always a percentage number, but it
|
|
5
|
+
* comes from two very different config paths:
|
|
6
|
+
* 1. `execute_threshold_percentage` (or its model-keyed variant) — user
|
|
7
|
+
* configures an integer like 65 directly. We must render exactly that.
|
|
8
|
+
* 2. `execute_threshold_tokens` — user configures absolute token cap (e.g.
|
|
9
|
+
* 128000). The resolver in `event-resolvers.ts` divides that by the
|
|
10
|
+
* model's context limit (`(128000 / 907788) * 100`) and the result is
|
|
11
|
+
* a long float like `14.099783080260304` that overflows the TUI cell
|
|
12
|
+
* (issue #90).
|
|
13
|
+
*
|
|
14
|
+
* Behaviour:
|
|
15
|
+
* - Integer input (≤0.05 fractional drift) renders without decimals.
|
|
16
|
+
* - Anything else is rendered with one decimal digit, which is precise
|
|
17
|
+
* enough to convey the configured token budget without smearing across
|
|
18
|
+
* two lines in a narrow sidebar.
|
|
19
|
+
*
|
|
20
|
+
* Returns the formatted percentage WITHOUT the trailing `%` so callers can
|
|
21
|
+
* compose richer strings like `47.5% / 65%` consistently.
|
|
22
|
+
*/
|
|
23
|
+
export declare function formatThresholdPercent(value: number | undefined | null): string;
|
|
24
|
+
//# sourceMappingURL=format-threshold.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format-threshold.d.ts","sourceRoot":"","sources":["../../src/shared/format-threshold.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,CAK/E"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identifier for the host harness this plugin is running inside.
|
|
3
|
+
*
|
|
4
|
+
* Magic Context's SQLite database lives at a vendor-scoped path
|
|
5
|
+
* (`~/.local/share/cortexkit/magic-context/`) so OpenCode and Pi can share
|
|
6
|
+
* project memories, embedding cache, dreamer runs, and other project-scoped
|
|
7
|
+
* state. Session-scoped tables carry a `harness` column populated from this
|
|
8
|
+
* module so we can disambiguate which harness wrote each session row,
|
|
9
|
+
* filter by harness in the dashboard, and (eventually) migrate sessions
|
|
10
|
+
* between harnesses.
|
|
11
|
+
*
|
|
12
|
+
* Each plugin entry point sets this once at boot, before any DB write
|
|
13
|
+
* happens:
|
|
14
|
+
* - OpenCode plugin: relies on the default ("opencode") — no setHarness call
|
|
15
|
+
* needed
|
|
16
|
+
* - Pi plugin: calls `setHarness("pi")` before opening the database
|
|
17
|
+
*
|
|
18
|
+
* NEVER read this from configuration or session state — it is a
|
|
19
|
+
* boot-time constant per plugin instance. Cross-harness leakage is a
|
|
20
|
+
* correctness bug, not a feature.
|
|
21
|
+
*/
|
|
22
|
+
export type HarnessId = "opencode" | "pi";
|
|
23
|
+
/**
|
|
24
|
+
* Set the harness identifier for this plugin instance. Must be called once
|
|
25
|
+
* at boot before any DB write happens. Subsequent calls with a different
|
|
26
|
+
* value throw to prevent accidental mid-session swaps that would corrupt
|
|
27
|
+
* the harness column and break per-harness session scoping.
|
|
28
|
+
*
|
|
29
|
+
* Calling with the same value as the current is a no-op (safe to call
|
|
30
|
+
* defensively).
|
|
31
|
+
*/
|
|
32
|
+
export declare function setHarness(value: HarnessId): void;
|
|
33
|
+
/**
|
|
34
|
+
* Get the current harness identifier. Used by storage modules when
|
|
35
|
+
* INSERTing session-scoped rows so each row is correctly attributed.
|
|
36
|
+
*/
|
|
37
|
+
export declare function getHarness(): HarnessId;
|
|
38
|
+
/**
|
|
39
|
+
* Test-only helper to reset harness state between test cases. Do NOT call
|
|
40
|
+
* from production code paths.
|
|
41
|
+
*/
|
|
42
|
+
export declare function _resetHarnessForTesting(): void;
|
|
43
|
+
//# sourceMappingURL=harness.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness.d.ts","sourceRoot":"","sources":["../../src/shared/harness.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,IAAI,CAAC;AAK1C;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,IAAI,CAQjD;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,SAAS,CAEtC;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAG9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,0BAA0B,CAAC;AACzC,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-initiator-marker.d.ts","sourceRoot":"","sources":["../../src/shared/internal-initiator-marker.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,6BAA6B,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function stripJsonComments(content: string): string;
|
|
2
|
+
export declare function parseJsonc<T = unknown>(content: string): T;
|
|
3
|
+
export declare function readJsoncFile<T = unknown>(filePath: string): T | null;
|
|
4
|
+
export declare function detectConfigFile(basePath: string): {
|
|
5
|
+
format: "json" | "jsonc" | "none";
|
|
6
|
+
path: string;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=jsonc-parser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonc-parser.d.ts","sourceRoot":"","sources":["../../src/shared/jsonc-parser.ts"],"names":[],"mappings":"AAEA,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA6DzD;AA6CD,wBAAgB,UAAU,CAAC,CAAC,GAAG,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,CAAC,CAG1D;AAED,wBAAgB,aAAa,CAAC,CAAC,GAAG,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,CAAC,GAAG,IAAI,CAMrE;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG;IAChD,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;IAClC,IAAI,EAAE,MAAM,CAAC;CAChB,CAaA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function log(message: string, data?: unknown): void;
|
|
2
|
+
export declare function sessionLog(sessionId: string, message: string, data?: unknown): void;
|
|
3
|
+
/**
|
|
4
|
+
* Resolve the current log file path. The path is harness-aware (see
|
|
5
|
+
* {@link getMagicContextLogPath}) and re-evaluated on every call, so callers
|
|
6
|
+
* who format diagnostic output with this value always see the path the next
|
|
7
|
+
* flush will actually use.
|
|
8
|
+
*/
|
|
9
|
+
export declare function getLogFilePath(): string;
|
|
10
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/shared/logger.ts"],"names":[],"mappings":"AAuDA,wBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAmBzD;AAED,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,IAAI,CAEnF;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Provider-agnostic fallback chain entry.
|
|
3
|
+
* Each entry specifies a model and the providers to try in priority order.
|
|
4
|
+
* Follows oh-my-opencode's FallbackEntry pattern — `opencode` acts as a
|
|
5
|
+
* catch-all proxy provider and is listed last in most entries.
|
|
6
|
+
*/
|
|
7
|
+
export type FallbackEntry = {
|
|
8
|
+
providers: string[];
|
|
9
|
+
model: string;
|
|
10
|
+
variant?: string;
|
|
11
|
+
};
|
|
12
|
+
export type AgentModelRequirement = {
|
|
13
|
+
fallbackChain: FallbackEntry[];
|
|
14
|
+
};
|
|
15
|
+
export declare const AGENT_MODEL_REQUIREMENTS: Record<string, AgentModelRequirement>;
|
|
16
|
+
/**
|
|
17
|
+
* Expand a provider-agnostic fallback chain into a flat `provider/model` list
|
|
18
|
+
* that OpenCode's agent config accepts as `fallback_models`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function expandFallbackChain(chain: FallbackEntry[]): string[];
|
|
21
|
+
/**
|
|
22
|
+
* Get the expanded fallback_models list for an agent.
|
|
23
|
+
* Returns undefined if no requirement is defined.
|
|
24
|
+
*/
|
|
25
|
+
export declare function getAgentFallbackModels(agent: string): string[] | undefined;
|
|
26
|
+
//# sourceMappingURL=model-requirements.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-requirements.d.ts","sourceRoot":"","sources":["../../src/shared/model-requirements.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG;IACxB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAChC,aAAa,EAAE,aAAa,EAAE,CAAC;CAClC,CAAC;AAqCF,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAM1E,CAAC;AAEF;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,CAQpE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAI1E"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import type { createOpencodeClient } from "@opencode-ai/sdk";
|
|
2
|
+
type Client = ReturnType<typeof createOpencodeClient>;
|
|
3
|
+
type PromptBody = {
|
|
4
|
+
model?: {
|
|
5
|
+
providerID: string;
|
|
6
|
+
modelID: string;
|
|
7
|
+
};
|
|
8
|
+
[key: string]: unknown;
|
|
9
|
+
};
|
|
10
|
+
type PromptArgs = {
|
|
11
|
+
path: {
|
|
12
|
+
id: string;
|
|
13
|
+
};
|
|
14
|
+
body: PromptBody;
|
|
15
|
+
signal?: AbortSignal;
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
};
|
|
18
|
+
export interface PromptRetryOptions {
|
|
19
|
+
timeoutMs?: number;
|
|
20
|
+
/** External abort signal — cancels the in-flight LLM prompt immediately when aborted */
|
|
21
|
+
signal?: AbortSignal;
|
|
22
|
+
/**
|
|
23
|
+
* Ordered list of "provider/modelID" alternates to try if the primary call
|
|
24
|
+
* (and its single-suggestion retry) fails. Empty / undefined = no fallback
|
|
25
|
+
* iteration (legacy behavior).
|
|
26
|
+
*
|
|
27
|
+
* Fallback policy:
|
|
28
|
+
* - Each fallback gets the FULL `timeoutMs` budget (per-attempt, not total).
|
|
29
|
+
* - Suggestion-retry runs inside each attempt (so "did you mean X?" errors
|
|
30
|
+
* still self-heal at the primary AND at each fallback).
|
|
31
|
+
* - Iteration stops immediately on abort/timeout/context-overflow errors —
|
|
32
|
+
* fallbacks won't help and the caller's emergency-recovery path needs
|
|
33
|
+
* to handle these.
|
|
34
|
+
* - On all-failed, the LAST error is thrown (matches legacy behavior when
|
|
35
|
+
* `fallbackModels` is empty).
|
|
36
|
+
*/
|
|
37
|
+
fallbackModels?: readonly string[];
|
|
38
|
+
/**
|
|
39
|
+
* Identifier for structured logging (e.g. "dreamer:consolidate",
|
|
40
|
+
* "historian", "compressor", "sidekick"). Helps correlate fallback
|
|
41
|
+
* attempts to a specific call site in `magic-context.log`. Defaults to
|
|
42
|
+
* "subagent" if not provided.
|
|
43
|
+
*/
|
|
44
|
+
callContext?: string;
|
|
45
|
+
}
|
|
46
|
+
export interface ModelSuggestionInfo {
|
|
47
|
+
providerID: string;
|
|
48
|
+
modelID: string;
|
|
49
|
+
suggestion: string;
|
|
50
|
+
}
|
|
51
|
+
export declare function parseModelSuggestion(error: unknown): ModelSuggestionInfo | null;
|
|
52
|
+
/**
|
|
53
|
+
* Run an OpenCode subagent prompt with model fallback support.
|
|
54
|
+
*
|
|
55
|
+
* Attempts the configured primary model first (whatever `args.body.model` or
|
|
56
|
+
* the registered agent default resolves to), then iterates through
|
|
57
|
+
* `options.fallbackModels` if provided. Each attempt internally retries once on
|
|
58
|
+
* the SDK's "model not found, did you mean X?" suggestion. Aborts, timeouts,
|
|
59
|
+
* and context-overflow errors short-circuit the fallback loop because retrying
|
|
60
|
+
* the same prompt against another model won't help.
|
|
61
|
+
*
|
|
62
|
+
* Behavior with `fallbackModels` empty/undefined is identical to the pre-v0.18
|
|
63
|
+
* single-suggestion retry — fully backward-compatible for callers that haven't
|
|
64
|
+
* been updated to thread a chain.
|
|
65
|
+
*/
|
|
66
|
+
export declare function promptSyncWithModelSuggestionRetry(client: Client, args: PromptArgs, options?: PromptRetryOptions): Promise<void>;
|
|
67
|
+
export {};
|
|
68
|
+
//# sourceMappingURL=model-suggestion-retry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model-suggestion-retry.d.ts","sourceRoot":"","sources":["../../src/shared/model-suggestion-retry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAM7D,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEtD,KAAK,UAAU,GAAG;IACd,KAAK,CAAC,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IAChD,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,CAAC;AAEF,KAAK,UAAU,GAAG;IACd,IAAI,EAAE;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC;IACrB,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,WAAW,kBAAkB;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wFAAwF;IACxF,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;;;;;;;;;OAcG;IACH,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,mBAAmB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;CACtB;AAiBD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,GAAG,mBAAmB,GAAG,IAAI,CA4C/E;AAuID;;;;;;;;;;;;;GAaG;AACH,wBAAsB,kCAAkC,CACpD,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,UAAU,EAChB,OAAO,GAAE,kBAAuB,GACjC,OAAO,CAAC,IAAI,CAAC,CAgFf"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve per-model context limits to match whatever OpenCode itself sees.
|
|
3
|
+
*
|
|
4
|
+
* Two layers:
|
|
5
|
+
*
|
|
6
|
+
* 1. API cache (primary): populated asynchronously via
|
|
7
|
+
* `client.config.providers()`. OpenCode's own provider service merges
|
|
8
|
+
* the live models.dev cache file, its compiled-in snapshot fallback,
|
|
9
|
+
* opencode.json custom provider overrides, and derived experimental
|
|
10
|
+
* modes. Whatever OpenCode reports is the source of truth.
|
|
11
|
+
*
|
|
12
|
+
* 2. File cache (fallback): read-from-disk parse of OpenCode's
|
|
13
|
+
* `models.json` plus `opencode.json(c)` custom provider entries.
|
|
14
|
+
* Used during cold starts before the API cache warms up and in any
|
|
15
|
+
* code path that cannot reach the SDK client.
|
|
16
|
+
*
|
|
17
|
+
* The public getter (`getModelsDevContextLimit()`) is synchronous: it checks
|
|
18
|
+
* the API cache first, then the file cache. The plugin warms the API cache
|
|
19
|
+
* once from `src/index.ts` at startup. Runtime retries are reserved for the
|
|
20
|
+
* issue #77 cache-regression recovery path.
|
|
21
|
+
*/
|
|
22
|
+
interface OpencodeClientLike {
|
|
23
|
+
config: {
|
|
24
|
+
providers: () => Promise<{
|
|
25
|
+
data?: {
|
|
26
|
+
providers?: unknown;
|
|
27
|
+
};
|
|
28
|
+
}>;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Asynchronously refresh the API-layer cache from OpenCode's SDK.
|
|
33
|
+
*
|
|
34
|
+
* Call this at plugin startup and from the issue #77 regression-recovery path.
|
|
35
|
+
* OpenCode's `/config/providers` endpoint returns every provider with full
|
|
36
|
+
* model metadata — including `limit.context` — resolved through the same path
|
|
37
|
+
* OpenCode itself uses (live cache + compiled-in snapshot + opencode.json
|
|
38
|
+
* overrides + derived experimental modes).
|
|
39
|
+
*
|
|
40
|
+
* Safe to call concurrently; only overwrites the cache on success.
|
|
41
|
+
*/
|
|
42
|
+
export declare function refreshModelLimitsFromApi(client: OpencodeClientLike): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Returns the context limit for a provider/model.
|
|
45
|
+
*
|
|
46
|
+
* Lookup order:
|
|
47
|
+
* 1. API cache (populated by {@link refreshModelLimitsFromApi}). Matches
|
|
48
|
+
* what OpenCode sees exactly, including snapshot-only models.
|
|
49
|
+
* 2. File cache (parsed from models.json + opencode.json overrides).
|
|
50
|
+
* Used before the API cache warms and as a last resort.
|
|
51
|
+
*
|
|
52
|
+
* Returns `undefined` if neither layer knows the model.
|
|
53
|
+
*/
|
|
54
|
+
export declare function getModelsDevContextLimit(providerID: string, modelID: string): number | undefined;
|
|
55
|
+
/** Clear in-memory caches (for testing). */
|
|
56
|
+
export declare function clearModelsDevCache(): void;
|
|
57
|
+
/** Inspection helpers (for logging / debugging). */
|
|
58
|
+
export declare function getModelsDevCacheState(): {
|
|
59
|
+
apiLoaded: boolean;
|
|
60
|
+
apiCount: number;
|
|
61
|
+
apiAgeMs: number;
|
|
62
|
+
fileCount: number;
|
|
63
|
+
};
|
|
64
|
+
export {};
|
|
65
|
+
//# sourceMappingURL=models-dev-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models-dev-cache.d.ts","sourceRoot":"","sources":["../../src/shared/models-dev-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAUH,UAAU,kBAAkB;IACxB,MAAM,EAAE;QACJ,SAAS,EAAE,MAAM,OAAO,CAAC;YAAE,IAAI,CAAC,EAAE;gBAAE,SAAS,CAAC,EAAE,OAAO,CAAA;aAAE,CAAA;SAAE,CAAC,CAAC;KAChE,CAAC;CACL;AA+LD;;;;;;;;;;GAUG;AACH,wBAAsB,yBAAyB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkDzF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAchG;AAED,4CAA4C;AAC5C,wBAAgB,mBAAmB,IAAI,IAAI,CAK1C;AAED,oDAAoD;AACpD,wBAAgB,sBAAsB,IAAI;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACrB,CAOA"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Native-binding resolver for Electron-runtime mismatches.
|
|
3
|
+
*
|
|
4
|
+
* Why this module exists
|
|
5
|
+
* ----------------------
|
|
6
|
+
* `better-sqlite3` uses raw v8/nan bindings, so its compiled `.node` file is
|
|
7
|
+
* locked to a specific NODE_MODULE_VERSION (Node-API ABI revision). When
|
|
8
|
+
* OpenCode Desktop (Electron 41 → ABI 145) loads a plugin whose `node_modules`
|
|
9
|
+
* was populated by `bun install` / `npm install` under a different runtime,
|
|
10
|
+
* the fetched prebuild is for `node-vNNN` (e.g. ABI 137 for Node 22) and
|
|
11
|
+
* Electron refuses to load it with:
|
|
12
|
+
*
|
|
13
|
+
* The module '...better_sqlite3.node' was compiled against a different
|
|
14
|
+
* Node.js version using NODE_MODULE_VERSION 137. This version of Node.js
|
|
15
|
+
* requires NODE_MODULE_VERSION 145.
|
|
16
|
+
*
|
|
17
|
+
* `onnxruntime-node` (used by `@huggingface/transformers` for local
|
|
18
|
+
* embeddings) is N-API v3 and is ABI-stable across runtimes, so it does NOT
|
|
19
|
+
* have this problem. Only `better-sqlite3` is affected.
|
|
20
|
+
*
|
|
21
|
+
* What this does
|
|
22
|
+
* --------------
|
|
23
|
+
* On plugin load, before constructing any `Database`:
|
|
24
|
+
*
|
|
25
|
+
* 1. If we are NOT running under Electron (`process.versions.electron` is
|
|
26
|
+
* unset), return null. Bun uses `bun:sqlite` and never reaches this code;
|
|
27
|
+
* Pi/Node-CLI install matching Node-vNNN prebuilds via npm, which work
|
|
28
|
+
* natively against the on-disk binary.
|
|
29
|
+
*
|
|
30
|
+
* 2. If we ARE on Electron, locate the `.node` file path that
|
|
31
|
+
* `better-sqlite3`'s default `bindings()` lookup would try first. Probe
|
|
32
|
+
* its ABI by attempting a sandboxed `process.dlopen`. If it succeeds
|
|
33
|
+
* (Electron-compatible), return null — the default lookup will work.
|
|
34
|
+
*
|
|
35
|
+
* 3. Otherwise, look for a cached Electron prebuild at
|
|
36
|
+
* `<XDG_CACHE_HOME>/cortexkit/native-bindings/better-sqlite3/v<version>/electron-v<abi>-<platform>-<arch>/better_sqlite3.node`.
|
|
37
|
+
* Download it from the `WiseLibs/better-sqlite3` GitHub release if
|
|
38
|
+
* missing, extract with `nanotar` (pure-JS, ~45 KB, zero deps), validate
|
|
39
|
+
* the ABI, and return the absolute path.
|
|
40
|
+
*
|
|
41
|
+
* The caller (`sqlite.ts`) then passes this path through `better-sqlite3`'s
|
|
42
|
+
* documented `nativeBinding` constructor option:
|
|
43
|
+
*
|
|
44
|
+
* new Database(filename, { nativeBinding: <our cached path> })
|
|
45
|
+
*
|
|
46
|
+
* `better-sqlite3` calls `require()` directly on that path, bypassing the
|
|
47
|
+
* normal `bindings()` lookup chain. This is a first-class API the maintainer
|
|
48
|
+
* added for exactly this kind of cross-runtime extension scenario — see
|
|
49
|
+
* `node_modules/better-sqlite3/lib/database.js` `nativeBinding` handling.
|
|
50
|
+
*
|
|
51
|
+
* Why we don't replace the on-disk binary
|
|
52
|
+
* ---------------------------------------
|
|
53
|
+
* An earlier iteration copied the cached Electron binary over the in-tree
|
|
54
|
+
* `node_modules/.../better_sqlite3.node`. That worked but mutates a shared
|
|
55
|
+
* resource: in monorepo dev setups (or any case where multiple runtimes
|
|
56
|
+
* share one `node_modules`), a Pi process opening the plugin from the same
|
|
57
|
+
* workspace would then load the Electron-ABI binary and fail. Returning a
|
|
58
|
+
* separate cached path keeps the on-disk file untouched so each runtime
|
|
59
|
+
* sees the binary it needs.
|
|
60
|
+
*
|
|
61
|
+
* Failure modes
|
|
62
|
+
* -------------
|
|
63
|
+
* If GitHub is unreachable (corporate firewall, offline laptop, rate limit)
|
|
64
|
+
* AND no cached binary exists, this throws. The caller (sqlite.ts →
|
|
65
|
+
* openDatabase) surfaces a `storage unavailable` error and Magic Context
|
|
66
|
+
* disables itself for the run. The user can connect to the network and
|
|
67
|
+
* restart, or wait for a cached binary from a previous successful launch.
|
|
68
|
+
*/
|
|
69
|
+
/**
|
|
70
|
+
* Resolve the absolute path to a `better-sqlite3` `.node` binary that the
|
|
71
|
+
* current runtime can load.
|
|
72
|
+
*
|
|
73
|
+
* - Returns `null` outside Electron (Bun uses `bun:sqlite`; Pi/Node CLI
|
|
74
|
+
* loads matching prebuilds from `node_modules` natively).
|
|
75
|
+
* - Returns `null` on Electron when the on-disk binary already matches
|
|
76
|
+
* the runtime's ABI (rare but possible — a future OpenCode build that
|
|
77
|
+
* post-install-rebuilds for Electron would hit this fast path).
|
|
78
|
+
* - Returns the cached/downloaded prebuild path on Electron when the
|
|
79
|
+
* on-disk binary's ABI doesn't match.
|
|
80
|
+
*
|
|
81
|
+
* The returned path is suitable as the `nativeBinding` option to
|
|
82
|
+
* `new Database(filename, { nativeBinding })`. better-sqlite3 calls `require()`
|
|
83
|
+
* directly on it, bypassing the default `bindings()` lookup chain — this is
|
|
84
|
+
* a documented public API in better-sqlite3, not an internal hack.
|
|
85
|
+
*/
|
|
86
|
+
export declare function resolveBetterSqliteNativeBinding(): Promise<string | null>;
|
|
87
|
+
//# sourceMappingURL=native-binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"native-binding.d.ts","sourceRoot":"","sources":["../../src/shared/native-binding.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmEG;AA2IH;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,gCAAgC,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAuF/E"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export interface NormalizeSDKResponseOptions {
|
|
2
|
+
preferResponseOnMissingData?: boolean;
|
|
3
|
+
}
|
|
4
|
+
export declare function normalizeSDKResponse<TData>(response: unknown, fallback: TData, options?: NormalizeSDKResponseOptions): TData;
|
|
5
|
+
//# sourceMappingURL=normalize-sdk-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-sdk-response.d.ts","sourceRoot":"","sources":["../../src/shared/normalize-sdk-response.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,2BAA2B;IACxC,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACzC;AAMD,wBAAgB,oBAAoB,CAAC,KAAK,EACtC,QAAQ,EAAE,OAAO,EACjB,QAAQ,EAAE,KAAK,EACf,OAAO,CAAC,EAAE,2BAA2B,GACtC,KAAK,CA2BP"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opencode-compaction-detector.d.ts","sourceRoot":"","sources":["../../src/shared/opencode-compaction-detector.ts"],"names":[],"mappings":"AAqBA,wBAAgB,+BAA+B,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAsB1E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export type OpenCodeBinaryType = "opencode" | "opencode-desktop";
|
|
2
|
+
export type OpenCodeConfigDirOptions = {
|
|
3
|
+
binary: OpenCodeBinaryType;
|
|
4
|
+
version?: string | null;
|
|
5
|
+
checkExisting?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type OpenCodeConfigPaths = {
|
|
8
|
+
configDir: string;
|
|
9
|
+
configJson: string;
|
|
10
|
+
configJsonc: string;
|
|
11
|
+
packageJson: string;
|
|
12
|
+
omoConfig: string;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=opencode-config-dir-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opencode-config-dir-types.d.ts","sourceRoot":"","sources":["../../src/shared/opencode-config-dir-types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,kBAAkB,CAAC;AAEjE,MAAM,MAAM,wBAAwB,GAAG;IACnC,MAAM,EAAE,kBAAkB,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { OpenCodeConfigDirOptions, OpenCodeConfigPaths } from "./opencode-config-dir-types";
|
|
2
|
+
export type { OpenCodeBinaryType, OpenCodeConfigDirOptions, OpenCodeConfigPaths, } from "./opencode-config-dir-types";
|
|
3
|
+
export declare function getOpenCodeConfigDir(_options: OpenCodeConfigDirOptions): string;
|
|
4
|
+
export declare function getOpenCodeConfigPaths(options: OpenCodeConfigDirOptions): OpenCodeConfigPaths;
|
|
5
|
+
//# sourceMappingURL=opencode-config-dir.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opencode-config-dir.d.ts","sourceRoot":"","sources":["../../src/shared/opencode-config-dir.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEjG,YAAY,EACR,kBAAkB,EAClB,wBAAwB,EACxB,mBAAmB,GACtB,MAAM,6BAA6B,CAAC;AAerC,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,wBAAwB,GAAG,MAAM,CAE/E;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,wBAAwB,GAAG,mBAAmB,CAS7F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"record-type-guard.d.ts","sourceRoot":"","sources":["../../src/shared/record-type-guard.ts"],"names":[],"mappings":"AAAA,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAEzE"}
|