@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 @@
|
|
|
1
|
+
{"version":3,"file":"format-bytes.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/format-bytes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ContextDatabase } from "../../features/magic-context/storage";
|
|
2
|
+
import type { TagEntry } from "../../features/magic-context/types";
|
|
3
|
+
import { type CavemanCleanupConfig } from "./caveman-cleanup";
|
|
4
|
+
import type { MessageLike, TagTarget } from "./tag-messages";
|
|
5
|
+
export declare function applyHeuristicCleanup(sessionId: string, db: ContextDatabase, targets: Map<number, TagTarget>, messageTagNumbers: Map<MessageLike, number>, config: {
|
|
6
|
+
autoDropToolAge: number;
|
|
7
|
+
dropToolStructure: boolean;
|
|
8
|
+
protectedTags: number;
|
|
9
|
+
dropAllTools?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Age-tier caveman text compression settings. Only honored when the
|
|
12
|
+
* session is running with ctx_reduce_enabled=false — caller is
|
|
13
|
+
* responsible for zeroing this out when ctx_reduce is on.
|
|
14
|
+
*/
|
|
15
|
+
caveman?: CavemanCleanupConfig;
|
|
16
|
+
}, preloadedTags?: TagEntry[]): {
|
|
17
|
+
droppedTools: number;
|
|
18
|
+
deduplicatedTools: number;
|
|
19
|
+
droppedInjections: number;
|
|
20
|
+
compressedTextTags: number;
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=heuristic-cleanup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heuristic-cleanup.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/heuristic-cleanup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAQ5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAEnE,OAAO,EAAuB,KAAK,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEnF,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAe7D,wBAAgB,qBAAqB,CACjC,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,eAAe,EACnB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,EAC/B,iBAAiB,EAAE,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,EAC3C,MAAM,EAAE;IACJ,eAAe,EAAE,MAAM,CAAC;IACxB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;;;OAIG;IACH,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAClC,EACD,aAAa,CAAC,EAAE,QAAQ,EAAE,GAC3B;IACC,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,kBAAkB,EAAE,MAAM,CAAC;CAC9B,CA8KA"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Historian state-file offloading.
|
|
3
|
+
*
|
|
4
|
+
* When the existing-state XML (prior compartments + facts + project memory)
|
|
5
|
+
* exceeds {@link HISTORIAN_STATE_INLINE_THRESHOLD} characters, the historian
|
|
6
|
+
* caller writes it to a temp file under the project-local historian dir
|
|
7
|
+
* (`<project>/.opencode/magic-context/historian/`) and the prompt instructs
|
|
8
|
+
* the model to `Read this file first`. This avoids pushing 100K+ chars of
|
|
9
|
+
* inline reference state through the model's input on long sessions, which
|
|
10
|
+
* on some provider/model combinations (notably github-copilot/gpt-5.4 via
|
|
11
|
+
* the openai-responses API) causes the model to stall before emitting any
|
|
12
|
+
* output tokens.
|
|
13
|
+
*
|
|
14
|
+
* The state file lives INSIDE the project directory rather than under
|
|
15
|
+
* `os.tmpdir()` because OpenCode's `external_directory` permission system
|
|
16
|
+
* asks the user before letting the historian subagent's Read tool open any
|
|
17
|
+
* file outside the project. Anchoring under `<project>/.opencode/` keeps
|
|
18
|
+
* the file inside the project boundary so historian runs never trigger a
|
|
19
|
+
* permission prompt.
|
|
20
|
+
*
|
|
21
|
+
* The caller MUST delete the file in finally{} via
|
|
22
|
+
* {@link cleanupHistorianStateFile}.
|
|
23
|
+
*
|
|
24
|
+
* Shared between OpenCode (`compartment-runner-incremental.ts`,
|
|
25
|
+
* `compartment-runner-recomp.ts`) and Pi (`pi-historian-runner.ts`). The
|
|
26
|
+
* directory is resolved from the project directory the caller passes in —
|
|
27
|
+
* both harnesses already track this on their runner deps.
|
|
28
|
+
*/
|
|
29
|
+
export declare const HISTORIAN_STATE_INLINE_THRESHOLD = 30000;
|
|
30
|
+
/**
|
|
31
|
+
* When existingState is large, write it to a project-local file and return the
|
|
32
|
+
* path. Returns undefined when existingState is small enough to inline OR when
|
|
33
|
+
* writing fails (in which case the caller should fall back to inline).
|
|
34
|
+
*
|
|
35
|
+
* `directory` is the project directory; the helper writes under
|
|
36
|
+
* `<directory>/.opencode/magic-context/historian/`. The dir is created
|
|
37
|
+
* recursively on first write, so the call is safe on fresh projects that have
|
|
38
|
+
* never had a `.opencode/` subtree.
|
|
39
|
+
*/
|
|
40
|
+
export declare function maybeWriteHistorianStateFile(sessionId: string, existingState: string, directory: string): string | undefined;
|
|
41
|
+
/** Delete a previously written state file. Safe to call with undefined. */
|
|
42
|
+
export declare function cleanupHistorianStateFile(path: string | undefined): void;
|
|
43
|
+
//# sourceMappingURL=historian-state-file.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"historian-state-file.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/historian-state-file.ts"],"names":[],"mappings":"AAIA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,eAAO,MAAM,gCAAgC,QAAS,CAAC;AAEvD;;;;;;;;;GASG;AACH,wBAAgB,4BAA4B,CACxC,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,GAClB,MAAM,GAAG,SAAS,CAWpB;AAED,2EAA2E;AAC3E,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAOxE"}
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import { getOrCreateSessionMeta } from "../../features/magic-context/storage-meta";
|
|
2
|
+
import type { PluginContext } from "../../plugin/types";
|
|
3
|
+
export type LiveModelBySession = Map<string, {
|
|
4
|
+
providerID: string;
|
|
5
|
+
modelID: string;
|
|
6
|
+
}>;
|
|
7
|
+
export type VariantBySession = Map<string, string | undefined>;
|
|
8
|
+
export type AgentBySession = Map<string, string>;
|
|
9
|
+
export type RecentReduceBySession = Map<string, number>;
|
|
10
|
+
export type ToolUsageSinceUserTurn = Map<string, number>;
|
|
11
|
+
/**
|
|
12
|
+
* Cache-busting signal sets — replaces the old monolithic `flushedSessions`.
|
|
13
|
+
*
|
|
14
|
+
* The old `Set<string>` conflated three independent lifetimes into one flag,
|
|
15
|
+
* which caused defer passes blocked by an in-progress historian to keep
|
|
16
|
+
* re-firing the same flush signal across multiple turns (Oracle review,
|
|
17
|
+
* 2026-04-26). Each set now has exactly one consumer and one lifetime.
|
|
18
|
+
*
|
|
19
|
+
* Design rule: every producer that wants to refresh state should `add` to
|
|
20
|
+
* EVERY set whose consumer needs to react. Consumers are responsible for
|
|
21
|
+
* draining their own set after they consume the signal.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* One-shot: signals that `<session-history>` (compartments + facts +
|
|
25
|
+
* memories block in `message[0]`) needs to be rebuilt on the very next
|
|
26
|
+
* pass. Consumed by `prepareCompartmentInjection()` in `transform.ts`,
|
|
27
|
+
* which drains the entry after invocation regardless of whether a rebuild
|
|
28
|
+
* actually occurred — the next defer pass MUST hit the cache.
|
|
29
|
+
*
|
|
30
|
+
* Producers: `/ctx-flush`, real variant change, system-prompt hash change,
|
|
31
|
+
* explicit user refresh paths (flush/recomp/variant/system-prompt hash).
|
|
32
|
+
* Background historian/compressor publications use DeferredHistoryRefreshSessions.
|
|
33
|
+
*
|
|
34
|
+
* NOT a producer: the background compressor — its output deliberately
|
|
35
|
+
* lands on the next natural cache-bust pass instead of forcing one.
|
|
36
|
+
*/
|
|
37
|
+
export type HistoryRefreshSessions = Set<string>;
|
|
38
|
+
/** Persistent deferred history refresh from background historian/compressor publication. */
|
|
39
|
+
export type DeferredHistoryRefreshSessions = Set<string>;
|
|
40
|
+
/**
|
|
41
|
+
* One-shot: signals that the system-prompt adjuncts (project docs, user
|
|
42
|
+
* profile, key files, sticky date) should be re-read from disk on the
|
|
43
|
+
* very next system-transform call. Consumed by `system-prompt-hash.ts`,
|
|
44
|
+
* which drains the entry after refreshing.
|
|
45
|
+
*
|
|
46
|
+
* Producers: `/ctx-flush`, real variant change, system-prompt hash change.
|
|
47
|
+
*
|
|
48
|
+
* NOT a producer: historian/compressor/recomp — those don't change disk
|
|
49
|
+
* adjuncts, so refreshing them would burn IO for no reason.
|
|
50
|
+
*/
|
|
51
|
+
export type SystemPromptRefreshSessions = Set<string>;
|
|
52
|
+
/**
|
|
53
|
+
* Persistent: signals that there are queued user `ctx_reduce` ops or
|
|
54
|
+
* pending heuristic-cleanup work that MUST run, even if the current pass
|
|
55
|
+
* can't safely run heuristics yet (e.g. a compartment run is active).
|
|
56
|
+
* Consumed and drained by `transform-postprocess-phase.ts` only after
|
|
57
|
+
* `shouldRunHeuristics` actually executes — survives any number of
|
|
58
|
+
* blocked passes until the materialization succeeds.
|
|
59
|
+
*
|
|
60
|
+
* Producers: `/ctx-flush`, real variant change, system-prompt hash change,
|
|
61
|
+
* explicit user refresh paths (flush/recomp/variant/system-prompt hash).
|
|
62
|
+
* Background historian publications use DeferredMaterializationSessions.
|
|
63
|
+
*
|
|
64
|
+
* Why historian/recomp produce here too: those publish paths queue drop
|
|
65
|
+
* ops via `queueDropsForCompartmentalizedMessages`. The next safe pass
|
|
66
|
+
* needs to materialize those queued drops or context will accumulate.
|
|
67
|
+
*/
|
|
68
|
+
export type PendingMaterializationSessions = Set<string>;
|
|
69
|
+
/** Persistent deferred drop-materialization signal from background historian publication. */
|
|
70
|
+
export type DeferredMaterializationSessions = Set<string>;
|
|
71
|
+
/**
|
|
72
|
+
* @deprecated Use `HistoryRefreshSessions`, `SystemPromptRefreshSessions`,
|
|
73
|
+
* or `PendingMaterializationSessions` directly. Kept as a type alias only
|
|
74
|
+
* for any external consumers that may still import it. Will be removed in
|
|
75
|
+
* a future major.
|
|
76
|
+
*/
|
|
77
|
+
export type FlushedSessions = Set<string>;
|
|
78
|
+
export type LastHeuristicsTurnId = Map<string, string>;
|
|
79
|
+
export declare function getLiveNotificationParams(sessionId: string, liveModelBySession: LiveModelBySession, variantBySession: VariantBySession, agentBySession?: AgentBySession): {
|
|
80
|
+
agent?: string;
|
|
81
|
+
variant?: string;
|
|
82
|
+
providerId?: string;
|
|
83
|
+
modelId?: string;
|
|
84
|
+
};
|
|
85
|
+
export declare function createChatMessageHook(args: {
|
|
86
|
+
db: Parameters<typeof getOrCreateSessionMeta>[0];
|
|
87
|
+
toolUsageSinceUserTurn: ToolUsageSinceUserTurn;
|
|
88
|
+
recentReduceBySession: RecentReduceBySession;
|
|
89
|
+
liveModelBySession: LiveModelBySession;
|
|
90
|
+
variantBySession: VariantBySession;
|
|
91
|
+
agentBySession: AgentBySession;
|
|
92
|
+
/** Variant changes invalidate `<session-history>` injection cache and
|
|
93
|
+
* may pair with a different model whose pending drops still need to
|
|
94
|
+
* materialize — so a real variant flip signals all three sets. */
|
|
95
|
+
historyRefreshSessions: HistoryRefreshSessions;
|
|
96
|
+
systemPromptRefreshSessions: SystemPromptRefreshSessions;
|
|
97
|
+
pendingMaterializationSessions: PendingMaterializationSessions;
|
|
98
|
+
lastHeuristicsTurnId: LastHeuristicsTurnId;
|
|
99
|
+
ctxReduceEnabled?: boolean;
|
|
100
|
+
}): (input: {
|
|
101
|
+
sessionID?: string;
|
|
102
|
+
variant?: string;
|
|
103
|
+
agent?: string;
|
|
104
|
+
model?: {
|
|
105
|
+
providerID?: string;
|
|
106
|
+
modelID?: string;
|
|
107
|
+
};
|
|
108
|
+
}) => Promise<void>;
|
|
109
|
+
export declare function createEventHook(args: {
|
|
110
|
+
eventHandler: (input: {
|
|
111
|
+
event: {
|
|
112
|
+
type: string;
|
|
113
|
+
properties?: unknown;
|
|
114
|
+
};
|
|
115
|
+
}) => Promise<void>;
|
|
116
|
+
contextUsageMap: Map<string, {
|
|
117
|
+
usage: {
|
|
118
|
+
percentage: number;
|
|
119
|
+
inputTokens: number;
|
|
120
|
+
};
|
|
121
|
+
updatedAt: number;
|
|
122
|
+
}>;
|
|
123
|
+
db: Parameters<typeof getOrCreateSessionMeta>[0];
|
|
124
|
+
liveModelBySession: LiveModelBySession;
|
|
125
|
+
variantBySession: VariantBySession;
|
|
126
|
+
agentBySession: AgentBySession;
|
|
127
|
+
/**
|
|
128
|
+
* Cache of resolved session.directory values from `client.session.get(...)`.
|
|
129
|
+
* Cleaned on `session.deleted` to prevent leaks. See live-session-state.ts
|
|
130
|
+
* for the full doc-comment.
|
|
131
|
+
*/
|
|
132
|
+
sessionDirectoryBySession: Map<string, string>;
|
|
133
|
+
recentReduceBySession: RecentReduceBySession;
|
|
134
|
+
toolUsageSinceUserTurn: ToolUsageSinceUserTurn;
|
|
135
|
+
/** All signal sets are cleaned on `session.deleted` to prevent leaks. */
|
|
136
|
+
historyRefreshSessions: HistoryRefreshSessions;
|
|
137
|
+
deferredHistoryRefreshSessions: DeferredHistoryRefreshSessions;
|
|
138
|
+
systemPromptRefreshSessions: SystemPromptRefreshSessions;
|
|
139
|
+
pendingMaterializationSessions: PendingMaterializationSessions;
|
|
140
|
+
deferredMaterializationSessions: DeferredMaterializationSessions;
|
|
141
|
+
lastHeuristicsTurnId: LastHeuristicsTurnId;
|
|
142
|
+
commitSeenLastPass?: Map<string, boolean>;
|
|
143
|
+
client: PluginContext["client"];
|
|
144
|
+
protectedTags: number;
|
|
145
|
+
ctxReduceEnabled?: boolean;
|
|
146
|
+
}): (input: {
|
|
147
|
+
event: {
|
|
148
|
+
type: string;
|
|
149
|
+
properties?: unknown;
|
|
150
|
+
};
|
|
151
|
+
}) => Promise<void>;
|
|
152
|
+
export declare function createCommandExecuteBeforeHook(commandHandler: {
|
|
153
|
+
"command.execute.before": (input: import("./command-handler").CommandExecuteInput, output: import("./command-handler").CommandExecuteOutput, params: {
|
|
154
|
+
agent?: string;
|
|
155
|
+
variant?: string;
|
|
156
|
+
providerId?: string;
|
|
157
|
+
modelId?: string;
|
|
158
|
+
}) => Promise<unknown>;
|
|
159
|
+
}): (input: unknown, output: unknown) => Promise<unknown>;
|
|
160
|
+
export declare function createToolExecuteAfterHook(args: {
|
|
161
|
+
db: Parameters<typeof getOrCreateSessionMeta>[0];
|
|
162
|
+
recentReduceBySession: RecentReduceBySession;
|
|
163
|
+
toolUsageSinceUserTurn: ToolUsageSinceUserTurn;
|
|
164
|
+
}): (input: unknown) => Promise<void>;
|
|
165
|
+
//# sourceMappingURL=hook-handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook-handlers.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/hook-handlers.ts"],"names":[],"mappings":"AAUA,OAAO,EACH,sBAAsB,EAEzB,MAAM,2CAA2C,CAAC;AAGnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAqBxD,MAAM,MAAM,kBAAkB,GAAG,GAAG,CAAC,MAAM,EAAE;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AACtF,MAAM,MAAM,gBAAgB,GAAG,GA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AC;IACjD,qBAAqB,EAAE,qBAAqB,CAAC;IAC7C,sBAAsB,EAAE,sBAAsB,CAAC;CAClD,IACiB,OAAO,OAAO,mBAiD/B"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { type DreamerConfig, type HistorianConfig, type SidekickConfig } from "../../config/schema/magic-context";
|
|
2
|
+
import type { createCompactionHandler } from "../../features/magic-context/compaction";
|
|
3
|
+
import type { Scheduler } from "../../features/magic-context/scheduler";
|
|
4
|
+
import type { Tagger } from "../../features/magic-context/tagger";
|
|
5
|
+
import type { PluginContext } from "../../plugin/types";
|
|
6
|
+
export type { CommandExecuteInput, CommandExecuteOutput } from "./command-handler";
|
|
7
|
+
import type { LiveSessionState } from "./live-session-state";
|
|
8
|
+
export interface MagicContextDeps {
|
|
9
|
+
client: PluginContext["client"];
|
|
10
|
+
directory: string;
|
|
11
|
+
tagger: Tagger;
|
|
12
|
+
scheduler: Scheduler;
|
|
13
|
+
onSessionCacheInvalidated?: (sessionId: string) => void;
|
|
14
|
+
compactionHandler: ReturnType<typeof createCompactionHandler>;
|
|
15
|
+
liveSessionState?: LiveSessionState;
|
|
16
|
+
config: {
|
|
17
|
+
protected_tags: number;
|
|
18
|
+
ctx_reduce_enabled?: boolean;
|
|
19
|
+
nudge_interval_tokens?: number;
|
|
20
|
+
auto_drop_tool_age?: number;
|
|
21
|
+
drop_tool_structure?: boolean;
|
|
22
|
+
clear_reasoning_age?: number;
|
|
23
|
+
iteration_nudge_threshold?: number;
|
|
24
|
+
execute_threshold_percentage?: number | {
|
|
25
|
+
default: number;
|
|
26
|
+
[modelKey: string]: number;
|
|
27
|
+
};
|
|
28
|
+
execute_threshold_tokens?: {
|
|
29
|
+
default?: number;
|
|
30
|
+
[modelKey: string]: number | undefined;
|
|
31
|
+
};
|
|
32
|
+
cache_ttl: string | Record<string, string>;
|
|
33
|
+
historian?: HistorianConfig;
|
|
34
|
+
history_budget_percentage?: number;
|
|
35
|
+
historian_timeout_ms?: number;
|
|
36
|
+
memory?: {
|
|
37
|
+
enabled: boolean;
|
|
38
|
+
injection_budget_tokens: number;
|
|
39
|
+
/** When true, historian/recomp auto-promote eligible session facts
|
|
40
|
+
* to project memories. When false, promotion is skipped. Issue #44. */
|
|
41
|
+
auto_promote?: boolean;
|
|
42
|
+
};
|
|
43
|
+
embedding?: {
|
|
44
|
+
provider?: "local" | "openai-compatible" | "off";
|
|
45
|
+
};
|
|
46
|
+
sidekick?: SidekickConfig;
|
|
47
|
+
dreamer?: DreamerConfig;
|
|
48
|
+
commit_cluster_trigger?: {
|
|
49
|
+
enabled: boolean;
|
|
50
|
+
min_clusters: number;
|
|
51
|
+
};
|
|
52
|
+
/** Issue #53: per-agent system-prompt injection opt-out. Optional in
|
|
53
|
+
* the inline type so legacy tests/callers don't have to construct it;
|
|
54
|
+
* Zod's .default() guarantees it's present in real loaded configs. */
|
|
55
|
+
system_prompt_injection?: {
|
|
56
|
+
enabled: boolean;
|
|
57
|
+
skip_signatures: string[];
|
|
58
|
+
};
|
|
59
|
+
compressor?: {
|
|
60
|
+
enabled: boolean;
|
|
61
|
+
min_compartment_ratio: number;
|
|
62
|
+
max_merge_depth: number;
|
|
63
|
+
cooldown_ms: number;
|
|
64
|
+
};
|
|
65
|
+
experimental?: {
|
|
66
|
+
temporal_awareness?: boolean;
|
|
67
|
+
git_commit_indexing?: {
|
|
68
|
+
enabled: boolean;
|
|
69
|
+
since_days: number;
|
|
70
|
+
max_commits: number;
|
|
71
|
+
};
|
|
72
|
+
auto_search?: {
|
|
73
|
+
enabled: boolean;
|
|
74
|
+
score_threshold: number;
|
|
75
|
+
min_prompt_chars: number;
|
|
76
|
+
};
|
|
77
|
+
caveman_text_compression?: {
|
|
78
|
+
enabled: boolean;
|
|
79
|
+
min_chars: number;
|
|
80
|
+
};
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export declare function createMagicContextHook(deps: MagicContextDeps): {
|
|
85
|
+
"experimental.chat.messages.transform": (_input: Record<string, never>, output: {
|
|
86
|
+
messages: unknown[];
|
|
87
|
+
}) => Promise<void>;
|
|
88
|
+
"experimental.chat.system.transform": (input: {
|
|
89
|
+
sessionID?: string;
|
|
90
|
+
}, output: {
|
|
91
|
+
system: string[];
|
|
92
|
+
}) => Promise<void>;
|
|
93
|
+
"experimental.text.complete": (_input: {
|
|
94
|
+
sessionID: string;
|
|
95
|
+
messageID: string;
|
|
96
|
+
partID: string;
|
|
97
|
+
}, output: {
|
|
98
|
+
text: string;
|
|
99
|
+
}) => Promise<void>;
|
|
100
|
+
"chat.message": (input: {
|
|
101
|
+
sessionID?: string;
|
|
102
|
+
variant?: string;
|
|
103
|
+
agent?: string;
|
|
104
|
+
model?: {
|
|
105
|
+
providerID?: string;
|
|
106
|
+
modelID?: string;
|
|
107
|
+
};
|
|
108
|
+
}) => Promise<void>;
|
|
109
|
+
event: (input: {
|
|
110
|
+
event: {
|
|
111
|
+
type: string;
|
|
112
|
+
properties?: unknown;
|
|
113
|
+
};
|
|
114
|
+
}) => Promise<void>;
|
|
115
|
+
"command.execute.before": (input: unknown, output: unknown) => Promise<unknown>;
|
|
116
|
+
"tool.execute.after": (input: unknown) => Promise<void>;
|
|
117
|
+
} | null;
|
|
118
|
+
//# sourceMappingURL=hook.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hook.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/hook.ts"],"names":[],"mappings":"AAOA,OAAO,EAGH,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,cAAc,EACtB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAOvF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AAOxE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAGlE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC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AH;aACO,CAAV;aAAuB,CAAC;sBAAc,CAAC;mBAC7B,CAAJ;;;mBAsfiB;QAAE,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,UAAU,CAAC,EAAE,OAAO,CAAA;SAAE,CAAA;KAAE;;;SAa7E"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image-token-estimate.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/image-token-estimate.ts"],"names":[],"mappings":"AAaA;;;GAGG;AACH,wBAAgB,8BAA8B,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAkClE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Memory } from "../../features/magic-context/memory/types";
|
|
2
|
+
import type { Database } from "../../shared/sqlite";
|
|
3
|
+
import type { MessageLike } from "./tag-messages";
|
|
4
|
+
export interface PreparedCompartmentInjection {
|
|
5
|
+
block: string;
|
|
6
|
+
compartmentEndMessage: number;
|
|
7
|
+
compartmentEndMessageId: string | null;
|
|
8
|
+
compartmentCount: number;
|
|
9
|
+
skippedVisibleMessages: number;
|
|
10
|
+
factCount: number;
|
|
11
|
+
memoryCount: number;
|
|
12
|
+
rebuiltFromDb: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function clearInjectionCache(sessionId: string): void;
|
|
15
|
+
/**
|
|
16
|
+
* Return the set of memory ids currently rendered in the cached
|
|
17
|
+
* <session-history> block for this session, if any. Used by ctx_search
|
|
18
|
+
* to hard-filter memories the agent already sees in context — retrieving
|
|
19
|
+
* them from search wastes tokens and pushes high-signal raw-history hits
|
|
20
|
+
* further down the ranking.
|
|
21
|
+
*
|
|
22
|
+
* Returns null when no cache exists or the JSON payload is malformed
|
|
23
|
+
* (callers should treat null as "don't filter" — the worst case is a
|
|
24
|
+
* redundant memory result, not a correctness issue).
|
|
25
|
+
*/
|
|
26
|
+
export declare function getVisibleMemoryIds(db: Database, sessionId: string): Set<number> | null;
|
|
27
|
+
export interface CompartmentInjectionResult {
|
|
28
|
+
injected: boolean;
|
|
29
|
+
compartmentEndMessage: number;
|
|
30
|
+
compartmentCount: number;
|
|
31
|
+
skippedVisibleMessages: number;
|
|
32
|
+
}
|
|
33
|
+
export declare function renderMemoryBlock(memories: Memory[]): string | null;
|
|
34
|
+
/**
|
|
35
|
+
* Sort memories by priority and trim to budget.
|
|
36
|
+
*
|
|
37
|
+
* Priority order:
|
|
38
|
+
* 1. permanent status first
|
|
39
|
+
* 2. utility tier (retrieved > constraint > other)
|
|
40
|
+
* 3. seen count descending
|
|
41
|
+
* 4. shorter content first (fit more memories in budget)
|
|
42
|
+
* 5. deterministic id tiebreaker for cache stability
|
|
43
|
+
*
|
|
44
|
+
* Uses the real Claude tokenizer (via estimateTokens) so the trim stays
|
|
45
|
+
* consistent with the rest of the plugin's token math — mismatching units
|
|
46
|
+
* (chars/4 here vs real tokens elsewhere) caused either under- or
|
|
47
|
+
* over-injection of memories, depending on memory content shape.
|
|
48
|
+
*/
|
|
49
|
+
export declare function trimMemoriesToBudget(sessionId: string, memories: Memory[], budgetTokens: number): Memory[];
|
|
50
|
+
export declare function prepareCompartmentInjection(db: Database, sessionId: string, messages: MessageLike[], isCacheBusting: boolean, projectPath?: string, injectionBudgetTokens?: number, temporalAwareness?: boolean): PreparedCompartmentInjection | null;
|
|
51
|
+
export declare function renderCompartmentInjection(sessionId: string, messages: MessageLike[], prepared: PreparedCompartmentInjection): CompartmentInjectionResult;
|
|
52
|
+
//# sourceMappingURL=inject-compartments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inject-compartments.d.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AE,WAAW,EAAE,EACvB,cAAc,EAAE,OAAO,EACvB,WAAW,CAAC,EAAE,MAAM,EACpB,qBAAqB,CAAC,EAAE,MAAM,EAC9B,iBAAiB,CAAC,EAAE,OAAO,GAC5B,4BAA4B,GAAG,IAAI,CAuMrC;AAED,wBAAgB,0BAA0B,CACtC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,WAAW,EAAE,EACvB,QAAQ,EAAE,4BAA4B,GACvC,0BAA0B,CAgC5B"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type KeyFileStaleReason } from "../../features/magic-context/key-files/project-key-files";
|
|
2
|
+
import type { SessionMeta } from "../../features/magic-context/types";
|
|
3
|
+
import type { Database } from "../../shared/sqlite";
|
|
4
|
+
export interface KeyFilesConfigForRender {
|
|
5
|
+
enabled: boolean;
|
|
6
|
+
tokenBudget: number;
|
|
7
|
+
}
|
|
8
|
+
interface CacheEntry {
|
|
9
|
+
value: string | null;
|
|
10
|
+
version: number;
|
|
11
|
+
}
|
|
12
|
+
export declare const cachedKeyFilesBySession: Map<string, CacheEntry>;
|
|
13
|
+
export declare function queueStaleUpdate(projectPath: string, path: string, generatedAtWitness: number, staleReason: KeyFileStaleReason): void;
|
|
14
|
+
export declare function flushStaleUpdates(db: Database): number;
|
|
15
|
+
export declare function pendingStaleUpdateCount(): number;
|
|
16
|
+
export declare function clearKeyFilesCacheForSession(sessionId: string): void;
|
|
17
|
+
export declare function buildKeyFilesBlock(db: Database, projectPath: string, config?: KeyFilesConfigForRender): string | null;
|
|
18
|
+
export declare function readVersionedKeyFiles(args: {
|
|
19
|
+
db: Database;
|
|
20
|
+
sessionId: string | undefined;
|
|
21
|
+
sessionMeta: SessionMeta;
|
|
22
|
+
directory?: string;
|
|
23
|
+
isCacheBusting: boolean;
|
|
24
|
+
config?: KeyFilesConfigForRender;
|
|
25
|
+
}): string | null;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=key-files-block.d.ts.map
|
|
@@ -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AG,IAAI,CA2BhB"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { AgentBySession, LiveModelBySession, VariantBySession } from "./hook-handlers";
|
|
2
|
+
/**
|
|
3
|
+
* Plugin-process-scoped shared state. Lives in `index.ts` and is threaded into
|
|
4
|
+
* every component that needs to share signals with the others (the magic-
|
|
5
|
+
* context hook, RPC handlers, command handlers, etc).
|
|
6
|
+
*
|
|
7
|
+
* The `*Sessions` sets are the cache-busting signal channels added in
|
|
8
|
+
* the Oracle 2026-04-26 review (replaces the old single `flushedSessions`).
|
|
9
|
+
* See `hook-handlers.ts` for the full lifetime/semantics doc-comment on
|
|
10
|
+
* each set, and `system-prompt-hash.ts` / `transform.ts` /
|
|
11
|
+
* `transform-postprocess-phase.ts` for the consumer drain points.
|
|
12
|
+
*
|
|
13
|
+
* Storing them here lets RPC-driven recomp (TUI command path) signal the
|
|
14
|
+
* same sets the hook-driven recomp (server `/ctx-recomp` path) signals.
|
|
15
|
+
* Without this, the TUI recomp publish would silently leave injection cache
|
|
16
|
+
* stale and the next defer pass would reuse old `<session-history>`.
|
|
17
|
+
*/
|
|
18
|
+
export interface LiveSessionState {
|
|
19
|
+
liveModelBySession: LiveModelBySession;
|
|
20
|
+
variantBySession: VariantBySession;
|
|
21
|
+
agentBySession: AgentBySession;
|
|
22
|
+
historyRefreshSessions: Set<string>;
|
|
23
|
+
deferredHistoryRefreshSessions: Set<string>;
|
|
24
|
+
systemPromptRefreshSessions: Set<string>;
|
|
25
|
+
pendingMaterializationSessions: Set<string>;
|
|
26
|
+
deferredMaterializationSessions: Set<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Cache of resolved session.directory values from `client.session.get(...)`.
|
|
29
|
+
*
|
|
30
|
+
* The session→project binding is set at session create time and never
|
|
31
|
+
* changes (OpenCode source: `Session.directory` is read once from the
|
|
32
|
+
* session record, no migration path), so caching for the lifetime of the
|
|
33
|
+
* plugin process is safe. Without this, transform.ts hits OpenCode's
|
|
34
|
+
* local API on every transform pass — observed to be 1.5s+ for large
|
|
35
|
+
* sessions under Electron, accounting for the bulk of transform latency.
|
|
36
|
+
*
|
|
37
|
+
* Populated on first successful resolution; cleared on `session.deleted`.
|
|
38
|
+
*/
|
|
39
|
+
sessionDirectoryBySession: Map<string, string>;
|
|
40
|
+
}
|
|
41
|
+
export declare function createLiveSessionState(): LiveSessionState;
|
|
42
|
+
//# sourceMappingURL=live-session-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live-session-state.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/live-session-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAE5F;;;;;;;;;;;;;;;GAeG;AACH,MAAM,WAAW,gBAAgB;IAC7B,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,cAAc,EAAE,cAAc,CAAC;IAC/B,sBAAsB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACpC,8BAA8B,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5C,2BAA2B,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACzC,8BAA8B,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC5C,+BAA+B,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7C;;;;;;;;;;;OAWG;IACH,yBAAyB,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClD;AAED,wBAAgB,sBAAsB,IAAI,gBAAgB,CAYzD"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Note nudge state machine.
|
|
3
|
+
*
|
|
4
|
+
* State: idle → (trigger fires + notes exist) → nudged → (any trigger fires again) → nudged → ...
|
|
5
|
+
* Suppression: after a nudge fires, suppress until the NEXT trigger event (any of 3).
|
|
6
|
+
*
|
|
7
|
+
* Triggers:
|
|
8
|
+
* 1. Post-historian completion — compartments just compressed history
|
|
9
|
+
* 2. Post-commit detection — agent committed work, natural boundary
|
|
10
|
+
* 3. Todos complete — agent finished planned work, receptive to deferred items
|
|
11
|
+
*
|
|
12
|
+
* The nudge itself is a short reminder folded into the existing nudge anchor.
|
|
13
|
+
* It does NOT include note content — just a count and "use ctx_note read" hint.
|
|
14
|
+
*/
|
|
15
|
+
import { type NoteNudgeDeliveryOutcome } from "../../features/magic-context/storage-meta-persisted";
|
|
16
|
+
import type { Database } from "../../shared/sqlite";
|
|
17
|
+
export type NoteNudgeTrigger = "historian_complete" | "commit_detected" | "todos_complete";
|
|
18
|
+
export declare function recordNoteNudgeDeliveryTime(sessionId: string): void;
|
|
19
|
+
/**
|
|
20
|
+
* Signal that a trigger event occurred. Call from hook layer when any of the 3 triggers fire.
|
|
21
|
+
*/
|
|
22
|
+
export declare function onNoteTrigger(db: Database, sessionId: string, trigger: NoteNudgeTrigger): void;
|
|
23
|
+
/**
|
|
24
|
+
* Peek at whether a note nudge should be injected during this transform pass.
|
|
25
|
+
* Returns the nudge text if yes, null if no.
|
|
26
|
+
* Does NOT clear triggerPending — call markNoteNudgeDelivered() after successful placement.
|
|
27
|
+
*
|
|
28
|
+
* @param currentUserMessageId - The latest user message ID in this transform pass.
|
|
29
|
+
* If it matches the trigger-time message, delivery is deferred to avoid busting
|
|
30
|
+
* the Anthropic prompt-cache prefix (the trigger fired during the agent's turn,
|
|
31
|
+
* so injecting into the current user message would mutate cached content).
|
|
32
|
+
* @param projectIdentity - Project identity for resolving ready smart notes.
|
|
33
|
+
* @param noteReadStillVisible - True if the agent currently has a non-stripped
|
|
34
|
+
* `ctx_note(action="read")` tool call in their visible message context. When
|
|
35
|
+
* the agent has read the latest note state AND that read is still visible,
|
|
36
|
+
* the nudge is suppressed (no value re-surfacing what's already on screen).
|
|
37
|
+
* When the read has been dropped (compactified, ctx_reduce'd, age-cleaned),
|
|
38
|
+
* the nudge fires again at the next work boundary so the agent regains
|
|
39
|
+
* visibility into deferred intentions. Caller computes this via
|
|
40
|
+
* `hasVisibleNoteReadCall(messages)` AFTER drops are materialized.
|
|
41
|
+
*/
|
|
42
|
+
export declare function peekNoteNudgeText(db: Database, sessionId: string, currentUserMessageId?: string | null, projectIdentity?: string, noteReadStillVisible?: boolean): string | null;
|
|
43
|
+
/**
|
|
44
|
+
* Mark the note nudge as delivered after successful placement.
|
|
45
|
+
* Only call after appendReminderToLatestUserMessage returns an anchor (or null if no user message exists).
|
|
46
|
+
*/
|
|
47
|
+
export declare function markNoteNudgeDelivered(db: Database, sessionId: string, text: string, messageId: string | null): NoteNudgeDeliveryOutcome;
|
|
48
|
+
/**
|
|
49
|
+
* Get sticky note nudge for replay on subsequent transform passes.
|
|
50
|
+
* Returns { text, messageId } if a delivered nudge needs re-injection, null otherwise.
|
|
51
|
+
*/
|
|
52
|
+
export declare function getStickyNoteNudge(db: Database, sessionId: string): {
|
|
53
|
+
text: string;
|
|
54
|
+
messageId: string;
|
|
55
|
+
} | null;
|
|
56
|
+
/**
|
|
57
|
+
* Legacy wrapper — peek + mark in one call.
|
|
58
|
+
* Kept for tests; prefer peekNoteNudgeText + markNoteNudgeDelivered in production.
|
|
59
|
+
*/
|
|
60
|
+
export declare function getNoteNudgeText(db: Database, sessionId: string): string | null;
|
|
61
|
+
/**
|
|
62
|
+
* Call when session is deleted or notes are read to clear persisted state.
|
|
63
|
+
*/
|
|
64
|
+
export declare function clearNoteNudgeState(db: Database, sessionId: string, options?: {
|
|
65
|
+
persist?: boolean;
|
|
66
|
+
}): void;
|
|
67
|
+
export declare function clearAllNoteNudgeState(db: Database, sessionId: string): void;
|
|
68
|
+
export declare function clearNoteNudgeTriggerAndCooldown(db: Database, sessionId: string): void;
|
|
69
|
+
export declare function resetNoteNudgeCooldownOnly(sessionId: string): void;
|
|
70
|
+
export declare function clearNoteNudgeTriggerOnly(db: Database, sessionId: string): void;
|
|
71
|
+
//# sourceMappingURL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