@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,33 @@
|
|
|
1
|
+
import type { CandidateCompartment } from "./compartment-runner-types";
|
|
2
|
+
export declare function mapParsedCompartmentsToChunk(compartments: Array<{
|
|
3
|
+
startMessage: number;
|
|
4
|
+
endMessage: number;
|
|
5
|
+
title: string;
|
|
6
|
+
content: string;
|
|
7
|
+
}>, chunk: {
|
|
8
|
+
startIndex: number;
|
|
9
|
+
endIndex: number;
|
|
10
|
+
lines: Array<{
|
|
11
|
+
ordinal: number;
|
|
12
|
+
messageId: string;
|
|
13
|
+
}>;
|
|
14
|
+
}, sequenceOffset: number): {
|
|
15
|
+
ok: true;
|
|
16
|
+
compartments: CandidateCompartment[];
|
|
17
|
+
} | {
|
|
18
|
+
ok: false;
|
|
19
|
+
error: string;
|
|
20
|
+
};
|
|
21
|
+
export declare function mapParsedCompartmentsToSession(compartments: Array<{
|
|
22
|
+
startMessage: number;
|
|
23
|
+
endMessage: number;
|
|
24
|
+
title: string;
|
|
25
|
+
content: string;
|
|
26
|
+
}>, sessionId: string): {
|
|
27
|
+
ok: true;
|
|
28
|
+
compartments: CandidateCompartment[];
|
|
29
|
+
} | {
|
|
30
|
+
ok: false;
|
|
31
|
+
error: string;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=compartment-runner-mapping.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compartment-runner-mapping.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-runner-mapping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGvE,wBAAgB,4BAA4B,CACxC,YAAY,EAAE,KAAK,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC,EACF,KAAK,EAAE;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACxD,EACD,cAAc,EAAE,MAAM,GACvB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,YAAY,EAAE,oBAAoB,EAAE,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAuBnF;AAED,wBAAgB,8BAA8B,CAC1C,YAAY,EAAE,KAAK,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC,EACF,SAAS,EAAE,MAAM,GAClB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,YAAY,EAAE,oBAAoB,EAAE,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CA8BnF"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { Compartment } from "../../features/magic-context/compartment-storage";
|
|
2
|
+
import type { CompartmentRunnerDeps } from "./compartment-runner-types";
|
|
3
|
+
export interface PartialRecompRange {
|
|
4
|
+
/** Inclusive raw message ordinal to start rebuilding from. */
|
|
5
|
+
start: number;
|
|
6
|
+
/** Inclusive raw message ordinal to stop rebuilding at. */
|
|
7
|
+
end: number;
|
|
8
|
+
}
|
|
9
|
+
export interface SnappedPartialRange {
|
|
10
|
+
/** Snapped start = first enclosing compartment's startMessage. */
|
|
11
|
+
snapStart: number;
|
|
12
|
+
/** Snapped end = last enclosing compartment's endMessage. */
|
|
13
|
+
snapEnd: number;
|
|
14
|
+
priorCompartments: Compartment[];
|
|
15
|
+
rangeCompartments: Compartment[];
|
|
16
|
+
tailCompartments: Compartment[];
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Preview-only snap computation. Shown in the first-tap confirmation warning so
|
|
20
|
+
* the user sees which compartments will be replaced before executing.
|
|
21
|
+
*
|
|
22
|
+
* Returns an error string when the requested range cannot be snapped (e.g. no
|
|
23
|
+
* compartments exist yet, or the range is entirely after the last compartment).
|
|
24
|
+
*/
|
|
25
|
+
export declare function snapRangeToCompartments(compartments: Compartment[], range: PartialRecompRange): SnappedPartialRange | {
|
|
26
|
+
error: string;
|
|
27
|
+
};
|
|
28
|
+
export declare function executePartialRecompInternal(deps: CompartmentRunnerDeps, range: PartialRecompRange): Promise<string>;
|
|
29
|
+
//# sourceMappingURL=compartment-runner-partial-recomp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compartment-runner-partial-recomp.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-runner-partial-recomp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,WAAW,EAEd,MAAM,kDAAkD,CAAC;AA0B1D,OAAO,KAAK,EAAwB,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAU9F,MAAM,WAAW,kBAAkB;IAC/B,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,GAAG,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAChC,kEAAkE;IAClE,SAAS,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,WAAW,EAAE,CAAC;IACjC,iBAAiB,EAAE,WAAW,EAAE,CAAC;IACjC,gBAAgB,EAAE,WAAW,EAAE,CAAC;CACnC;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACnC,YAAY,EAAE,WAAW,EAAE,EAC3B,KAAK,EAAE,kBAAkB,GAC1B,mBAAmB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CA2CzC;AAcD,wBAAsB,4BAA4B,CAC9C,IAAI,EAAE,qBAAqB,EAC3B,KAAK,EAAE,kBAAkB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAmXjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compartment-runner-recomp.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-runner-recomp.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAwB,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAc9F,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,CA+V/F"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { CandidateCompartment } from "./compartment-runner-types";
|
|
2
|
+
export declare function buildExistingStateXml(compartments: Array<{
|
|
3
|
+
startMessage: number;
|
|
4
|
+
endMessage: number;
|
|
5
|
+
startMessageId: string;
|
|
6
|
+
endMessageId: string;
|
|
7
|
+
title: string;
|
|
8
|
+
content: string;
|
|
9
|
+
}>, facts: Array<{
|
|
10
|
+
category: string;
|
|
11
|
+
content: string;
|
|
12
|
+
}>, memoryBlock?: string): string;
|
|
13
|
+
export declare function mergePriorCompartments(priorCompartments: Array<{
|
|
14
|
+
startMessage: number;
|
|
15
|
+
endMessage: number;
|
|
16
|
+
startMessageId: string;
|
|
17
|
+
endMessageId: string;
|
|
18
|
+
title: string;
|
|
19
|
+
content: string;
|
|
20
|
+
}>, newCompartments: CandidateCompartment[]): CandidateCompartment[];
|
|
21
|
+
//# sourceMappingURL=compartment-runner-state-xml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compartment-runner-state-xml.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-runner-state-xml.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAEvE,wBAAgB,qBAAqB,CACjC,YAAY,EAAE,KAAK,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC,EACF,KAAK,EAAE,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,EACnD,WAAW,CAAC,EAAE,MAAM,GACrB,MAAM,CA2CR;AAED,wBAAgB,sBAAsB,CAClC,iBAAiB,EAAE,KAAK,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC,EACF,eAAe,EAAE,oBAAoB,EAAE,GACxC,oBAAoB,EAAE,CAaxB"}
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import type { PluginContext } from "../../plugin/types";
|
|
2
|
+
import type { Database } from "../../shared/sqlite";
|
|
3
|
+
import type { NotificationParams } from "./send-session-notification";
|
|
4
|
+
export interface CompartmentRunnerDeps {
|
|
5
|
+
client: PluginContext["client"];
|
|
6
|
+
db: Database;
|
|
7
|
+
sessionId: string;
|
|
8
|
+
/**
|
|
9
|
+
* Historian chunk budget — how much raw history historian processes per
|
|
10
|
+
* call. Bounded by the HISTORIAN model's context window, not main's.
|
|
11
|
+
* Derived via `deriveHistorianChunkTokens(historianContextLimit)`.
|
|
12
|
+
*/
|
|
13
|
+
historianChunkTokens: number;
|
|
14
|
+
historianTimeoutMs?: number;
|
|
15
|
+
/** Resolved fallback chain for historian-family calls (historian + compressor). */
|
|
16
|
+
fallbackModels?: readonly string[];
|
|
17
|
+
directory: string;
|
|
18
|
+
historyBudgetTokens?: number;
|
|
19
|
+
fallbackModelId?: string;
|
|
20
|
+
ensureProjectRegistered?: (directory: string, db: Database) => Promise<void>;
|
|
21
|
+
getNotificationParams?: () => NotificationParams;
|
|
22
|
+
/** When true, extract user behavior observations from historian output */
|
|
23
|
+
experimentalUserMemories?: boolean;
|
|
24
|
+
/** When true, inject wall-clock dates on compartments in <session-history>. */
|
|
25
|
+
experimentalTemporalAwareness?: boolean;
|
|
26
|
+
/** When true, run an editor pass after successful historian output to clean
|
|
27
|
+
* low-signal U: lines and cross-compartment duplicates. */
|
|
28
|
+
historianTwoPass?: boolean;
|
|
29
|
+
/** Compressor floor ratio: floor = ceil(lastEndMessage / minCompartmentRatio). */
|
|
30
|
+
compressorMinCompartmentRatio?: number;
|
|
31
|
+
/** Compressor max merge depth (1-5). Compartments at or above this depth are skipped. */
|
|
32
|
+
compressorMaxMergeDepth?: number;
|
|
33
|
+
/**
|
|
34
|
+
* Cross-session memory feature gate (`memory.enabled` config). When false,
|
|
35
|
+
* historian/recomp must NOT promote session facts into project memories
|
|
36
|
+
* and must NOT generate or store embeddings. Issue #44.
|
|
37
|
+
*/
|
|
38
|
+
memoryEnabled?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Automatic-promotion gate (`memory.auto_promote` config). When false (and
|
|
41
|
+
* memory is otherwise enabled), tools and search still work, but historian
|
|
42
|
+
* does not auto-promote session facts to memories. Users can still write
|
|
43
|
+
* memories explicitly via `ctx_memory write`. Issue #44.
|
|
44
|
+
*/
|
|
45
|
+
autoPromote?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Called after compartment state is published. The runner marks the active
|
|
48
|
+
* run as published before invoking this callback.
|
|
49
|
+
*/
|
|
50
|
+
onCompartmentStatePublished?: (sessionId: string) => void;
|
|
51
|
+
/**
|
|
52
|
+
* When true, publication preserves the in-memory injection cache until a
|
|
53
|
+
* later materializing pass consumes the deferred refresh.
|
|
54
|
+
*/
|
|
55
|
+
preserveInjectionCacheUntilConsumed?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Plan v6 §4: Called when historian/recomp publication wrote a pending
|
|
58
|
+
* compaction-marker row in-transaction (deferring marker application to a
|
|
59
|
+
* later materializing pass). Consumer (hook.ts) seeds
|
|
60
|
+
* `liveSessionState.deferredHistoryRefreshSessions` so the next consuming
|
|
61
|
+
* postprocess pass drains the pending blob and applies the marker.
|
|
62
|
+
*/
|
|
63
|
+
onDeferredMarkerPending?: (sessionId: string) => void;
|
|
64
|
+
/** Holder id for the DB-backed compartment-state lease guarding publish paths. */
|
|
65
|
+
compartmentLeaseHolderId?: string;
|
|
66
|
+
}
|
|
67
|
+
export interface CandidateCompartment {
|
|
68
|
+
sequence: number;
|
|
69
|
+
startMessage: number;
|
|
70
|
+
endMessage: number;
|
|
71
|
+
startMessageId: string;
|
|
72
|
+
endMessageId: string;
|
|
73
|
+
title: string;
|
|
74
|
+
content: string;
|
|
75
|
+
}
|
|
76
|
+
export interface HistorianRunResult {
|
|
77
|
+
ok: boolean;
|
|
78
|
+
result?: string;
|
|
79
|
+
error?: string;
|
|
80
|
+
dumpPath?: string;
|
|
81
|
+
invocationId?: number;
|
|
82
|
+
}
|
|
83
|
+
export type ValidatedHistorianPassResult = {
|
|
84
|
+
ok: true;
|
|
85
|
+
compartments: CandidateCompartment[];
|
|
86
|
+
facts: Array<{
|
|
87
|
+
category: string;
|
|
88
|
+
content: string;
|
|
89
|
+
}>;
|
|
90
|
+
userObservations?: string[];
|
|
91
|
+
} | {
|
|
92
|
+
ok: false;
|
|
93
|
+
error: string;
|
|
94
|
+
};
|
|
95
|
+
export interface StoredCompartmentRange {
|
|
96
|
+
startMessage: number;
|
|
97
|
+
endMessage: number;
|
|
98
|
+
}
|
|
99
|
+
export interface HistorianProgressCallbacks {
|
|
100
|
+
onRepairRetry?: (error: string) => Promise<void>;
|
|
101
|
+
}
|
|
102
|
+
//# sourceMappingURL=compartment-runner-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compartment-runner-types.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-runner-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAEtE,MAAM,WAAW,qBAAqB;IAClC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,EAAE,EAAE,QAAQ,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAC7B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mFAAmF;IACnF,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uBAAuB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7E,qBAAqB,CAAC,EAAE,MAAM,kBAAkB,CAAC;IACjD,0EAA0E;IAC1E,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC,+EAA+E;IAC/E,6BAA6B,CAAC,EAAE,OAAO,CAAC;IACxC;gEAC4D;IAC5D,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kFAAkF;IAClF,6BAA6B,CAAC,EAAE,MAAM,CAAC;IACvC,yFAAyF;IACzF,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;;OAGG;IACH,2BAA2B,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC1D;;;OAGG;IACH,mCAAmC,CAAC,EAAE,OAAO,CAAC;IAC9C;;;;;;OAMG;IACH,uBAAuB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACtD,kFAAkF;IAClF,wBAAwB,CAAC,EAAE,MAAM,CAAC;CACrC;AAED,MAAM,WAAW,oBAAoB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IAC/B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,4BAA4B,GAClC;IACI,EAAE,EAAE,IAAI,CAAC;IACT,YAAY,EAAE,oBAAoB,EAAE,CAAC;IACrC,KAAK,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACpD,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B,GACD;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnC,MAAM,WAAW,sBAAsB;IACnC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,0BAA0B;IACvC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACpD"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { StoredCompartmentRange, ValidatedHistorianPassResult } from "./compartment-runner-types";
|
|
2
|
+
export declare function validateHistorianOutput(text: string, _sessionId: string, chunk: {
|
|
3
|
+
startIndex: number;
|
|
4
|
+
endIndex: number;
|
|
5
|
+
lines: Array<{
|
|
6
|
+
ordinal: number;
|
|
7
|
+
messageId: string;
|
|
8
|
+
}>;
|
|
9
|
+
/** Optional — when provided, gaps inside these ranges heal at any size. */
|
|
10
|
+
toolOnlyRanges?: ReadonlyArray<{
|
|
11
|
+
start: number;
|
|
12
|
+
end: number;
|
|
13
|
+
}>;
|
|
14
|
+
}, _priorCompartments: StoredCompartmentRange[], sequenceOffset: number): ValidatedHistorianPassResult;
|
|
15
|
+
export declare function buildHistorianRepairPrompt(originalPrompt: string, previousOutput: string, validationError: string): string;
|
|
16
|
+
export declare function validateStoredCompartments(compartments: Array<{
|
|
17
|
+
startMessage: number;
|
|
18
|
+
endMessage: number;
|
|
19
|
+
}>): string | null;
|
|
20
|
+
export declare function validateChunkCoverage(chunk: {
|
|
21
|
+
startIndex: number;
|
|
22
|
+
endIndex: number;
|
|
23
|
+
lines: Array<{
|
|
24
|
+
ordinal: number;
|
|
25
|
+
}>;
|
|
26
|
+
}): string | null;
|
|
27
|
+
export declare function getReducedRecompTokenBudget(currentBudget: number): number | null;
|
|
28
|
+
//# sourceMappingURL=compartment-runner-validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compartment-runner-validation.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-runner-validation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,sBAAsB,EACtB,4BAA4B,EAC/B,MAAM,4BAA4B,CAAC;AAmDpC,wBAAgB,uBAAuB,CACnC,IAAI,EAAE,MAAM,EACZ,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrD,2EAA2E;IAC3E,cAAc,CAAC,EAAE,aAAa,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClE,EACD,kBAAkB,EAAE,sBAAsB,EAAE,EAC5C,cAAc,EAAE,MAAM,GACvB,4BAA4B,CAyC9B;AAED,wBAAgB,0BAA0B,CACtC,cAAc,EAAE,MAAM,EACtB,cAAc,EAAE,MAAM,EACtB,eAAe,EAAE,MAAM,GACxB,MAAM,CAaR;AAED,wBAAgB,0BAA0B,CACtC,YAAY,EAAE,KAAK,CAAC;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAAC,GAClE,MAAM,GAAG,IAAI,CAoBf;AAgDD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE;IACzC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrC,GAAG,MAAM,GAAG,IAAI,CAkBhB;AAED,wBAAgB,2BAA2B,CAAC,aAAa,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAGhF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { type PartialRecompRange } from "./compartment-runner-partial-recomp";
|
|
2
|
+
import type { CompartmentRunnerDeps } from "./compartment-runner-types";
|
|
3
|
+
export interface ActiveCompartmentRun {
|
|
4
|
+
promise: Promise<void>;
|
|
5
|
+
published: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Set to true once the 95%-emergency user-facing notification has been
|
|
8
|
+
* dispatched for this run. Prevents the notification from re-firing on
|
|
9
|
+
* every subsequent transform pass while the same compartment run is
|
|
10
|
+
* still active — which would otherwise persist a fresh ignored user
|
|
11
|
+
* message every pass and drive OpenCode's runLoop break condition false.
|
|
12
|
+
*/
|
|
13
|
+
notificationSent?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function getActiveCompartmentRun(sessionId: string): ActiveCompartmentRun | undefined;
|
|
16
|
+
export declare function markActiveCompartmentRunPublished(sessionId: string): void;
|
|
17
|
+
/**
|
|
18
|
+
* Register a compartment-state-mutating promise with the active-runs map.
|
|
19
|
+
*
|
|
20
|
+
* Use this to serialize background compressor runs against historian/recomp
|
|
21
|
+
* runs: both read-modify-write compartment rows, and while SQLite serializes
|
|
22
|
+
* individual statements it does NOT serialize multi-step update cycles. If a
|
|
23
|
+
* historian starts while a background compressor is still running, either
|
|
24
|
+
* side's final write can overwrite the other's work.
|
|
25
|
+
*
|
|
26
|
+
* The registered promise is cleared from activeRuns on settle so later passes
|
|
27
|
+
* can start a new run. If a run is already registered for the session, the
|
|
28
|
+
* caller is expected to have checked getActiveCompartmentRun() first and
|
|
29
|
+
* bailed — this function will overwrite silently if called anyway, which is
|
|
30
|
+
* the desired behavior for the retry path.
|
|
31
|
+
*/
|
|
32
|
+
export declare function registerActiveCompartmentRun(sessionId: string, promise: Promise<void>): ActiveCompartmentRun;
|
|
33
|
+
export declare function startCompartmentAgent(deps: CompartmentRunnerDeps): void;
|
|
34
|
+
export interface ExecuteContextRecompOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Optional partial range (inclusive raw message ordinals). When provided,
|
|
37
|
+
* runs partial recomp — snaps to enclosing compartment boundaries and
|
|
38
|
+
* rebuilds only the matching compartments, preserving prior/tail
|
|
39
|
+
* compartments and all session facts.
|
|
40
|
+
*
|
|
41
|
+
* When omitted, runs full recomp from message 1 to the protected tail,
|
|
42
|
+
* replacing all compartments and facts.
|
|
43
|
+
*/
|
|
44
|
+
range?: PartialRecompRange;
|
|
45
|
+
}
|
|
46
|
+
export interface ExecuteContextRecompResult {
|
|
47
|
+
message: string;
|
|
48
|
+
published: boolean;
|
|
49
|
+
}
|
|
50
|
+
export declare function executeContextRecompWithResult(deps: CompartmentRunnerDeps, options?: ExecuteContextRecompOptions): Promise<ExecuteContextRecompResult>;
|
|
51
|
+
export declare function executeContextRecomp(deps: CompartmentRunnerDeps, options?: ExecuteContextRecompOptions): Promise<string>;
|
|
52
|
+
export { runCompartmentAgent } from "./compartment-runner-incremental";
|
|
53
|
+
export type { PartialRecompRange } from "./compartment-runner-partial-recomp";
|
|
54
|
+
//# sourceMappingURL=compartment-runner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compartment-runner.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-runner.ts"],"names":[],"mappings":"AASA,OAAO,EAEH,KAAK,kBAAkB,EAC1B,MAAM,qCAAqC,CAAC;AAE7C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAExE,MAAM,WAAW,oBAAoB;IACjC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,SAAS,EAAE,OAAO,CAAC;IACnB;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAID,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,oBAAoB,GAAG,SAAS,CAE3F;AAED,wBAAgB,iCAAiC,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAGzE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,4BAA4B,CACxC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,GACvB,oBAAoB,CAetB;AA0BD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,qBAAqB,GAAG,IAAI,CA0CvE;AAED,MAAM,WAAW,2BAA2B;IACxC;;;;;;;;OAQG;IACH,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC9B;AAED,MAAM,WAAW,0BAA0B;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,OAAO,CAAC;CACtB;AAED,wBAAsB,8BAA8B,CAChD,IAAI,EAAE,qBAAqB,EAC3B,OAAO,GAAE,2BAAgC,GAC1C,OAAO,CAAC,0BAA0B,CAAC,CA4CrC;AAED,wBAAsB,oBAAoB,CACtC,IAAI,EAAE,qBAAqB,EAC3B,OAAO,GAAE,2BAAgC,GAC1C,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AACvE,YAAY,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ContextUsage, SessionMeta, TagEntry } from "../../features/magic-context/types";
|
|
2
|
+
import type { Database } from "../../shared/sqlite";
|
|
3
|
+
declare const POST_DROP_TARGET_RATIO = 0.75;
|
|
4
|
+
declare const FORCE_COMPARTMENT_PERCENTAGE = 80;
|
|
5
|
+
declare const BLOCK_UNTIL_DONE_PERCENTAGE = 95;
|
|
6
|
+
declare const FORCE_MATERIALIZE_PERCENTAGE = 85;
|
|
7
|
+
export { BLOCK_UNTIL_DONE_PERCENTAGE, FORCE_COMPARTMENT_PERCENTAGE, FORCE_MATERIALIZE_PERCENTAGE, POST_DROP_TARGET_RATIO, };
|
|
8
|
+
export interface CompartmentTriggerResult {
|
|
9
|
+
shouldFire: boolean;
|
|
10
|
+
reason?: "projected_headroom" | "force_80" | "commit_clusters" | "tail_size";
|
|
11
|
+
}
|
|
12
|
+
export declare function getProactiveCompartmentTriggerPercentage(executeThresholdPercentage: number): number;
|
|
13
|
+
export declare function checkCompartmentTrigger(db: Database, sessionId: string, sessionMeta: SessionMeta, usage: ContextUsage, _previousPercentage: number, executeThresholdPercentage: number, triggerBudget: number, autoDropToolAge?: number, protectedTagCount?: number, clearReasoningAge?: number, dropToolStructure?: boolean, commitClusterTrigger?: {
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
min_clusters: number;
|
|
16
|
+
}, preloadedActiveTags?: readonly TagEntry[]): CompartmentTriggerResult;
|
|
17
|
+
//# sourceMappingURL=compartment-trigger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compartment-trigger.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-trigger.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAE9F,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AASpD,QAAA,MAAM,sBAAsB,OAAO,CAAC;AAKpC,QAAA,MAAM,4BAA4B,KAAK,CAAC;AACxC,QAAA,MAAM,2BAA2B,KAAK,CAAC;AACvC,QAAA,MAAM,4BAA4B,KAAK,CAAC;AAExC,OAAO,EACH,2BAA2B,EAC3B,4BAA4B,EAC5B,4BAA4B,EAC5B,sBAAsB,GACzB,CAAC;AAEF,MAAM,WAAW,wBAAwB;IACrC,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,CAAC,EAAE,oBAAoB,GAAG,UAAU,GAAG,iBAAiB,GAAG,WAAW,CAAC;CAChF;AAED,wBAAgB,wCAAwC,CACpD,0BAA0B,EAAE,MAAM,GACnC,MAAM,CAER;AAgJD,wBAAgB,uBAAuB,CACnC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,WAAW,EACxB,KAAK,EAAE,YAAY,EACnB,mBAAmB,EAAE,MAAM,EAC3B,0BAA0B,EAAE,MAAM,EAClC,aAAa,EAAE,MAAM,EACrB,eAAe,CAAC,EAAE,MAAM,EACxB,iBAAiB,CAAC,EAAE,MAAM,EAC1B,iBAAiB,CAAC,EAAE,MAAM,EAC1B,iBAAiB,UAAO,EACxB,oBAAoB,CAAC,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,EACjE,mBAAmB,CAAC,EAAE,SAAS,QAAQ,EAAE,GAC1C,wBAAwB,CAiI1B"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Budget derivation
|
|
3
|
+
*
|
|
4
|
+
* Two scaling bases, two clamps. Replaces the old static
|
|
5
|
+
* `compartment_token_budget` setting which tried to serve both roles
|
|
6
|
+
* and scaled with neither model.
|
|
7
|
+
*
|
|
8
|
+
* - triggerBudget: scales with (main model × executeThreshold).
|
|
9
|
+
* Drives size-based historian triggers (`tail_size`, `commit_clusters`).
|
|
10
|
+
* "How big can the uncompartmentalized tail get before we force
|
|
11
|
+
* historian to run." This is anchored to the MAIN model's usable
|
|
12
|
+
* working space, not its total context.
|
|
13
|
+
*
|
|
14
|
+
* - historianChunkTokens: scales with the HISTORIAN model's context.
|
|
15
|
+
* The raw-history window historian processes per call. Different
|
|
16
|
+
* scaling basis because historian is a single-shot summarizer bound
|
|
17
|
+
* by its own context, not the main session's pressure math.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Budget basis for size-based historian triggers (tail_size, commit_clusters).
|
|
21
|
+
* Anchored to the MAIN model's usable working space, not its total context.
|
|
22
|
+
*
|
|
23
|
+
* @param mainContextLimit Main session model's context window (tokens).
|
|
24
|
+
* @param executeThresholdPercentage The effective execute threshold (0-100).
|
|
25
|
+
*/
|
|
26
|
+
export declare function deriveTriggerBudget(mainContextLimit: number, executeThresholdPercentage: number): number;
|
|
27
|
+
/**
|
|
28
|
+
* Raw-history chunk budget for historian's own context window.
|
|
29
|
+
* Historian formats tool calls as compact `TC:` summaries and drops tool results,
|
|
30
|
+
* so a 50K-token chunk typically represents far more raw messages than its token
|
|
31
|
+
* count implies. The max is tuned around that compression.
|
|
32
|
+
*
|
|
33
|
+
* @param historianContextLimit Historian model's context window (tokens).
|
|
34
|
+
*/
|
|
35
|
+
export declare function deriveHistorianChunkTokens(historianContextLimit: number): number;
|
|
36
|
+
/**
|
|
37
|
+
* Resolve the historian model's context limit for chunk budget sizing.
|
|
38
|
+
*
|
|
39
|
+
* Behavior:
|
|
40
|
+
* - If `historianModelOverride` is a full `provider/model-id` → use that model's
|
|
41
|
+
* context directly. This honors explicit user intent.
|
|
42
|
+
* - If the override is set but lacks `/` (e.g. `"llama3-32k"`) → warn and fall
|
|
43
|
+
* through to the fallback chain, since we can't look up models without a
|
|
44
|
+
* provider and silently ignoring would produce incorrect chunk sizes.
|
|
45
|
+
* - If no override → scan the expanded fallback chain (all `provider/model`
|
|
46
|
+
* combinations OpenCode might try) and use the MINIMUM resolved context.
|
|
47
|
+
* This is defensive: if the first-choice model is unavailable and OpenCode
|
|
48
|
+
* falls back to a smaller-context entry, the chunk budget is still safe.
|
|
49
|
+
* - If neither models.dev nor opencode.json custom providers know the model,
|
|
50
|
+
* fall back to 128K as a conservative default.
|
|
51
|
+
*
|
|
52
|
+
* Context limits are resolved through `getModelsDevContextLimit`, which reads
|
|
53
|
+
* both OpenCode's models.dev cache and custom `provider.*.models.*.limit.context`
|
|
54
|
+
* entries from `opencode.json(c)`.
|
|
55
|
+
*/
|
|
56
|
+
export declare function resolveHistorianContextLimit(historianModelOverride?: string): number;
|
|
57
|
+
//# sourceMappingURL=derive-budgets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derive-budgets.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/derive-budgets.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAoBH;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAC/B,gBAAgB,EAAE,MAAM,EACxB,0BAA0B,EAAE,MAAM,GACnC,MAAM,CAYR;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,qBAAqB,EAAE,MAAM,GAAG,MAAM,CAMhF;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,4BAA4B,CAAC,sBAAsB,CAAC,EAAE,MAAM,GAAG,MAAM,CAuCpF"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { MessageLike } from "./tag-messages";
|
|
2
|
+
export declare function isReduceToolPart(part: unknown): boolean;
|
|
3
|
+
export declare function dropStaleReduceCalls(messages: MessageLike[], protectedCount?: number): boolean;
|
|
4
|
+
//# sourceMappingURL=drop-stale-reduce-calls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drop-stale-reduce-calls.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/drop-stale-reduce-calls.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAoBvD;AAoBD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,WAAW,EAAE,EAAE,cAAc,GAAE,MAAU,GAAG,OAAO,CAiCjG"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { createCompactionHandler } from "../../features/magic-context/compaction";
|
|
2
|
+
import type { Tagger } from "../../features/magic-context/tagger";
|
|
3
|
+
import type { ContextUsage } from "../../features/magic-context/types";
|
|
4
|
+
import { type NotificationParams } from "./send-session-notification";
|
|
5
|
+
import { type NudgePlacementStore } from "./transform";
|
|
6
|
+
type CacheTtlConfig = string | Record<string, string>;
|
|
7
|
+
interface ContextUsageEntry {
|
|
8
|
+
usage: ContextUsage;
|
|
9
|
+
updatedAt: number;
|
|
10
|
+
lastResponseTime?: number;
|
|
11
|
+
}
|
|
12
|
+
export interface EventHandlerDeps {
|
|
13
|
+
contextUsageMap: Map<string, ContextUsageEntry>;
|
|
14
|
+
compactionHandler: ReturnType<typeof createCompactionHandler>;
|
|
15
|
+
nudgePlacements: NudgePlacementStore;
|
|
16
|
+
onSessionCacheInvalidated?: (sessionId: string) => void;
|
|
17
|
+
onSessionDeleted?: (sessionId: string) => void;
|
|
18
|
+
config: {
|
|
19
|
+
protected_tags: number;
|
|
20
|
+
auto_drop_tool_age?: number;
|
|
21
|
+
drop_tool_structure?: boolean;
|
|
22
|
+
clear_reasoning_age?: number;
|
|
23
|
+
execute_threshold_percentage?: number | {
|
|
24
|
+
default: number;
|
|
25
|
+
[modelKey: string]: number;
|
|
26
|
+
};
|
|
27
|
+
execute_threshold_tokens?: {
|
|
28
|
+
default?: number;
|
|
29
|
+
[modelKey: string]: number | undefined;
|
|
30
|
+
};
|
|
31
|
+
cache_ttl: CacheTtlConfig;
|
|
32
|
+
commit_cluster_trigger?: {
|
|
33
|
+
enabled: boolean;
|
|
34
|
+
min_clusters: number;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
tagger: Tagger;
|
|
38
|
+
db: ReturnType<typeof import("../../features/magic-context/storage").openDatabase>;
|
|
39
|
+
client?: unknown;
|
|
40
|
+
getNotificationParams?: (sessionId: string) => NotificationParams;
|
|
41
|
+
}
|
|
42
|
+
export declare function createEventHandler(deps: EventHandlerDeps): (input: {
|
|
43
|
+
event: {
|
|
44
|
+
type: string;
|
|
45
|
+
properties?: unknown;
|
|
46
|
+
};
|
|
47
|
+
}) => Promise<void>;
|
|
48
|
+
export {};
|
|
49
|
+
//# sourceMappingURL=event-handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-handler.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/event-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AA6BvF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AAsBvE,OAAO,EAAE,KAAK,kBAAkB,EAAsB,MAAM,6BAA6B,CAAC;AAC1F,OAAO,EAA2B,KAAK,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAMhF,KAAK,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEtD,UAAU,iBAAiB;IACvB,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAOD,MAAM,WAAW,gBAAgB;IAC7B,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAChD,iBAAiB,EAAE,UAAU,CAAC,OAAO,uBAAuB,CAAC,CAAC;IAC9D,eAAe,EAAE,mBAAmB,CAAC;IACrC,yBAAyB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC/C,MAAM,EAAE;QACJ,cAAc,EAAE,MAAM,CAAC;QACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;QAC5B,mBAAmB,CAAC,EAAE,OAAO,CAAC;QAC9B,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,4BAA4B,CAAC,EAAE,MAAM,GAAG;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE,CAAC;QACxF,wBAAwB,CAAC,EAAE;YAAE,OAAO,CAAC,EAAE,MAAM,CAAC;YAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;SAAE,CAAC;QACxF,SAAS,EAAE,cAAc,CAAC;QAC1B,sBAAsB,CAAC,EAAE;YAAE,OAAO,EAAE,OAAO,CAAC;YAAC,YAAY,EAAE,MAAM,CAAA;SAAE,CAAC;KACvE,CAAC;IACF,MAAM,EAAE,MAAM,CAAC;IACf,EAAE,EAAE,UAAU,CAAC,cAAc,sCAAsC,EAAE,YAAY,CAAC,CAAC;IACnF,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,qBAAqB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,kBAAkB,CAAC;CACrE;AAwHD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,gBAAgB,IACvC,OAAO;IAAE,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;CAAE,KAAG,OAAO,CAAC,IAAI,CAAC,CA2dzF"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export type MagicContextEventType = "session.created" | "session.error" | "message.updated" | "message.removed" | "session.compacted" | "session.deleted";
|
|
2
|
+
export type MagicContextEvent = {
|
|
3
|
+
type: MagicContextEventType;
|
|
4
|
+
properties?: unknown;
|
|
5
|
+
};
|
|
6
|
+
export interface SessionCreatedInfo {
|
|
7
|
+
id: string;
|
|
8
|
+
parentID: string;
|
|
9
|
+
providerID?: string;
|
|
10
|
+
modelID?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface MessageUpdatedAssistantInfo {
|
|
13
|
+
role: "assistant";
|
|
14
|
+
finish?: string;
|
|
15
|
+
sessionID: string;
|
|
16
|
+
/** OpenCode assistant message id. Undefined only when the event payload
|
|
17
|
+
* doesn't include one (older SDK versions or malformed events). */
|
|
18
|
+
messageID?: string;
|
|
19
|
+
providerID?: string;
|
|
20
|
+
modelID?: string;
|
|
21
|
+
tokens?: {
|
|
22
|
+
input?: number;
|
|
23
|
+
cache?: {
|
|
24
|
+
read?: number;
|
|
25
|
+
write?: number;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
/** Error attached to the assistant message, if any. OpenCode attaches
|
|
29
|
+
* context-overflow errors here in addition to emitting session.error. */
|
|
30
|
+
error?: unknown;
|
|
31
|
+
}
|
|
32
|
+
export interface MessageUpdatedInfo {
|
|
33
|
+
role: "user" | "assistant" | string;
|
|
34
|
+
sessionID: string;
|
|
35
|
+
messageID?: string;
|
|
36
|
+
finish?: string;
|
|
37
|
+
completedAt?: number;
|
|
38
|
+
}
|
|
39
|
+
export interface SessionErrorInfo {
|
|
40
|
+
sessionID: string;
|
|
41
|
+
error: unknown;
|
|
42
|
+
}
|
|
43
|
+
export interface MessageRemovedInfo {
|
|
44
|
+
sessionID: string;
|
|
45
|
+
messageID: string;
|
|
46
|
+
}
|
|
47
|
+
export declare function getSessionProperties(properties: unknown): {
|
|
48
|
+
info?: unknown;
|
|
49
|
+
sessionID?: string;
|
|
50
|
+
} | undefined;
|
|
51
|
+
export declare function getSessionCreatedInfo(properties: unknown): SessionCreatedInfo | null;
|
|
52
|
+
export declare function getMessageUpdatedAssistantInfo(properties: unknown): MessageUpdatedAssistantInfo | null;
|
|
53
|
+
export declare function getMessageUpdatedInfo(properties: unknown): MessageUpdatedInfo | null;
|
|
54
|
+
/**
|
|
55
|
+
* Extract `session.error` event payload. The event carries `{ sessionID, error }`
|
|
56
|
+
* at the top level (no `info` wrapper). We intentionally keep `error` as
|
|
57
|
+
* `unknown` — the plugin does not depend on OpenCode's NamedError shape, the
|
|
58
|
+
* overflow detector accepts strings, Errors, or objects with `message`.
|
|
59
|
+
*/
|
|
60
|
+
export declare function getSessionErrorInfo(properties: unknown): SessionErrorInfo | null;
|
|
61
|
+
export declare function getMessageRemovedInfo(properties: unknown): MessageRemovedInfo | null;
|
|
62
|
+
//# sourceMappingURL=event-payloads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-payloads.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/event-payloads.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,qBAAqB,GAC3B,iBAAiB,GACjB,eAAe,GACf,iBAAiB,GACjB,iBAAiB,GACjB,mBAAmB,GACnB,iBAAiB,CAAC;AAExB,MAAM,MAAM,iBAAiB,GAAG;IAC5B,IAAI,EAAE,qBAAqB,CAAC;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAEF,MAAM,WAAW,kBAAkB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,2BAA2B;IACxC,IAAI,EAAE,WAAW,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB;wEACoE;IACpE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE;QACL,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE;YACJ,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,KAAK,CAAC,EAAE,MAAM,CAAC;SAClB,CAAC;KACL,CAAC;IACF;8EAC0E;IAC1E,KAAK,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,gBAAgB;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,oBAAoB,CAChC,UAAU,EAAE,OAAO,GACpB;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAUpD;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,OAAO,GAAG,kBAAkB,GAAG,IAAI,CAiBpF;AAED,wBAAgB,8BAA8B,CAC1C,UAAU,EAAE,OAAO,GACpB,2BAA2B,GAAG,IAAI,CA8BpC;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,OAAO,GAAG,kBAAkB,GAAG,IAAI,CAmBpF;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,OAAO,GAAG,gBAAgB,GAAG,IAAI,CAMhF;AAED,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,OAAO,GAAG,kBAAkB,GAAG,IAAI,CAapF"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ContextDatabase } from "../../features/magic-context/storage";
|
|
2
|
+
type CacheTtlConfig = string | Record<string, string>;
|
|
3
|
+
/**
|
|
4
|
+
* Resolve the effective context limit for a (providerID, modelID) pair.
|
|
5
|
+
*
|
|
6
|
+
* Resolution order:
|
|
7
|
+
* 1. Detected limit from a prior overflow error, when smaller than the
|
|
8
|
+
* configured/cache limit. Providers report the REAL limit in the error
|
|
9
|
+
* message, which is authoritative for the current deployment.
|
|
10
|
+
* 2. OpenCode's models.dev cache (overlaid with user's
|
|
11
|
+
* `provider.*.models.*.limit.context`).
|
|
12
|
+
* 3. Conservative default (128k).
|
|
13
|
+
*
|
|
14
|
+
* The session context (db + sessionID) is optional — callers that operate
|
|
15
|
+
* outside a specific session (e.g. warm-up, status-bar summaries) can omit it
|
|
16
|
+
* and fall back to the global cache/default.
|
|
17
|
+
*/
|
|
18
|
+
export declare function resolveContextLimit(providerID: string | undefined, modelID: string | undefined, ctx?: {
|
|
19
|
+
db?: ContextDatabase;
|
|
20
|
+
sessionID?: string;
|
|
21
|
+
}): number;
|
|
22
|
+
export declare function resolveCacheTtl(cacheTtl: CacheTtlConfig, modelKey: string | undefined): string;
|
|
23
|
+
type ExecuteThresholdConfig = number | {
|
|
24
|
+
default: number;
|
|
25
|
+
[modelKey: string]: number;
|
|
26
|
+
};
|
|
27
|
+
type ExecuteThresholdTokensConfig = {
|
|
28
|
+
default?: number;
|
|
29
|
+
[modelKey: string]: number | undefined;
|
|
30
|
+
} | undefined;
|
|
31
|
+
export interface ExecuteThresholdOptions {
|
|
32
|
+
/** Optional tokens-based threshold config. When matched for the given modelKey,
|
|
33
|
+
* overrides the percentage-based threshold. */
|
|
34
|
+
tokensConfig?: ExecuteThresholdTokensConfig;
|
|
35
|
+
/** Required when `tokensConfig` is provided — used to convert tokens → percentage
|
|
36
|
+
* and to clamp values above 80% × context_limit. */
|
|
37
|
+
contextLimit?: number;
|
|
38
|
+
/** Session ID for warn logs when clamping. If absent, warns to global log. */
|
|
39
|
+
sessionId?: string;
|
|
40
|
+
}
|
|
41
|
+
export type ExecuteThresholdMode = "percentage" | "tokens";
|
|
42
|
+
export interface ExecuteThresholdDetail {
|
|
43
|
+
/** Effective execute threshold as a percentage (0–80). Downstream math keys off this. */
|
|
44
|
+
percentage: number;
|
|
45
|
+
/** Which source was authoritative: tokens config (when matched + valid context) or percentage. */
|
|
46
|
+
mode: ExecuteThresholdMode;
|
|
47
|
+
/** When mode is "tokens", the absolute token value after clamping (≤ 80% × contextLimit). */
|
|
48
|
+
absoluteTokens?: number;
|
|
49
|
+
/** The config key that matched, if any (for display/debugging). `"default"` when default fallback. */
|
|
50
|
+
matchedKey?: string;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Single source of truth for execute-threshold resolution. Returns the effective
|
|
54
|
+
* percentage plus which config source was authoritative. Callers that only need
|
|
55
|
+
* the percentage can use `resolveExecuteThreshold` (thin wrapper below); callers
|
|
56
|
+
* that surface the mode to users (`/ctx-status`, TUI, RPC) must use this directly
|
|
57
|
+
* to avoid the "progressive lookup drift" bug where two call sites disagree on
|
|
58
|
+
* whether tokens mode is active.
|
|
59
|
+
*/
|
|
60
|
+
export declare function resolveExecuteThresholdDetail(config: ExecuteThresholdConfig, modelKey: string | undefined, fallback: number, options?: ExecuteThresholdOptions): ExecuteThresholdDetail;
|
|
61
|
+
/**
|
|
62
|
+
* Backward-compatible wrapper around `resolveExecuteThresholdDetail`.
|
|
63
|
+
* Use the detail version when you also need the mode or absolute token value.
|
|
64
|
+
*/
|
|
65
|
+
export declare function resolveExecuteThreshold(config: ExecuteThresholdConfig, modelKey: string | undefined, fallback: number, options?: ExecuteThresholdOptions): number;
|
|
66
|
+
export declare function resolveModelKey(providerID: string | undefined, modelID: string | undefined): string | undefined;
|
|
67
|
+
export declare function resolveSessionId(properties: {
|
|
68
|
+
info?: unknown;
|
|
69
|
+
sessionID?: string;
|
|
70
|
+
} | undefined): string | undefined;
|
|
71
|
+
export {};
|
|
72
|
+
//# sourceMappingURL=event-resolvers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-resolvers.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/event-resolvers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAQ5E,KAAK,cAAc,GAAG,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEtD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,mBAAmB,CAC/B,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,GAAG,CAAC,EAAE;IAAE,EAAE,CAAC,EAAE,eAAe,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GACnD,MAAM,CAoBR;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAiB9F;AAED,KAAK,sBAAsB,GAAG,MAAM,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;CAAE,CAAC;AACvF,KAAK,4BAA4B,GAC3B;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAAE,GAC5D,SAAS,CAAC;AAEhB,MAAM,WAAW,uBAAuB;IACpC;oDACgD;IAChD,YAAY,CAAC,EAAE,4BAA4B,CAAC;IAC5C;yDACqD;IACrD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,8EAA8E;IAC9E,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,oBAAoB,GAAG,YAAY,GAAG,QAAQ,CAAC;AAE3D,MAAM,WAAW,sBAAsB;IACnC,yFAAyF;IACzF,UAAU,EAAE,MAAM,CAAC;IACnB,kGAAkG;IAClG,IAAI,EAAE,oBAAoB,CAAC;IAC3B,6FAA6F;IAC7F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,sGAAsG;IACtG,UAAU,CAAC,EAAE,MAAM,CAAC;CACvB;AA8CD;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CACzC,MAAM,EAAE,sBAAsB,EAC9B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,uBAAuB,GAClC,sBAAsB,CA+ExB;AAED;;;GAGG;AACH,wBAAgB,uBAAuB,CACnC,MAAM,EAAE,sBAAsB,EAC9B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,uBAAuB,GAClC,MAAM,CAER;AA2BD,wBAAgB,eAAe,CAC3B,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,OAAO,EAAE,MAAM,GAAG,SAAS,GAC5B,MAAM,GAAG,SAAS,CAMpB;AAED,wBAAgB,gBAAgB,CAC5B,UAAU,EAAE;IAAE,IAAI,CAAC,EAAE,OAAO,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,GAC/D,MAAM,GAAG,SAAS,CAmBpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute-flush.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/execute-flush.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,wBAAgB,YAAY,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CA8BpE"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Database } from "../../shared/sqlite";
|
|
2
|
+
export declare function executeStatus(db: Database, sessionId: string, protectedTags: number, nudgeIntervalTokens?: number, executeThresholdPercentageConfig?: number | {
|
|
3
|
+
default: number;
|
|
4
|
+
[modelKey: string]: number;
|
|
5
|
+
}, liveModelKey?: string, historyBudgetPercentage?: number, commitClusterTrigger?: {
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
min_clusters: number;
|
|
8
|
+
}, executeThresholdTokens?: {
|
|
9
|
+
default?: number;
|
|
10
|
+
[modelKey: string]: number | undefined;
|
|
11
|
+
}, contextLimit?: number): string;
|
|
12
|
+
//# sourceMappingURL=execute-status.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"execute-status.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/execute-status.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AA8BpD,wBAAgB,aAAa,CACzB,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,mBAAmB,GAAE,MAAsC,EAC3D,gCAAgC,GAC1B,MAAM,GACN;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;CAAyC,EAC5F,YAAY,CAAC,EAAE,MAAM,EACrB,uBAAuB,CAAC,EAAE,MAAM,EAChC,oBAAoB,CAAC,EAAE;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,EACjE,sBAAsB,CAAC,EAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAAE,EACrF,YAAY,CAAC,EAAE,MAAM,GACtB,MAAM,CA8JR"}
|