@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,482 @@
|
|
|
1
|
+
/** @jsxImportSource @opentui/solid */
|
|
2
|
+
import { createEffect, createMemo, createSignal, on, onCleanup } from "solid-js"
|
|
3
|
+
import type { TuiSlotPlugin, TuiPluginApi, TuiThemeCurrent } from "@opencode-ai/plugin/tui"
|
|
4
|
+
import packageJson from "../../../package.json"
|
|
5
|
+
import { loadSidebarSnapshot, type SidebarSnapshot } from "../data/context-db"
|
|
6
|
+
import { formatThresholdPercent } from "../../shared/format-threshold"
|
|
7
|
+
|
|
8
|
+
const SINGLE_BORDER = { type: "single" } as any
|
|
9
|
+
const REFRESH_DEBOUNCE_MS = 150
|
|
10
|
+
|
|
11
|
+
function compactTokens(value: number): string {
|
|
12
|
+
if (value >= 1_000_000) return `${(value / 1_000_000).toFixed(1)}M`
|
|
13
|
+
if (value >= 1_000) return `${(value / 1_000).toFixed(0)}K`
|
|
14
|
+
return String(value)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
function relativeTime(ms: number): string {
|
|
18
|
+
const diff = Date.now() - ms
|
|
19
|
+
if (diff < 60_000) return "just now"
|
|
20
|
+
if (diff < 3_600_000) return `${Math.floor(diff / 60_000)}m ago`
|
|
21
|
+
if (diff < 86_400_000) return `${Math.floor(diff / 3_600_000)}h ago`
|
|
22
|
+
return `${Math.floor(diff / 86_400_000)}d ago`
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Token breakdown segment colors (hardcoded hex values)
|
|
26
|
+
const COLORS = {
|
|
27
|
+
// Cool / structured — injected by the plugin into message[0]
|
|
28
|
+
system: "#c084fc", // Purple
|
|
29
|
+
compartments: "#60a5fa", // Blue
|
|
30
|
+
facts: "#fbbf24", // Yellow/orange
|
|
31
|
+
memories: "#34d399", // Green
|
|
32
|
+
// Warm / user-facing — regular chat and tool traffic. Grouped visually
|
|
33
|
+
// by hue family so the user reads them as a related block.
|
|
34
|
+
conversation: "#f87171", // Red
|
|
35
|
+
toolCalls: "#fb923c", // Orange
|
|
36
|
+
toolDefs: "#f472b6", // Pink
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
interface TokenSegment {
|
|
40
|
+
key: string
|
|
41
|
+
tokens: number
|
|
42
|
+
color: string
|
|
43
|
+
label: string
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Segmented token breakdown bar with legend
|
|
47
|
+
const TokenBreakdown = (props: {
|
|
48
|
+
theme: TuiThemeCurrent
|
|
49
|
+
snapshot: SidebarSnapshot
|
|
50
|
+
}) => {
|
|
51
|
+
// The bar is rendered as a flex row of colored boxes, each with
|
|
52
|
+
// flexGrow=tokens and flexBasis=0. opentui distributes the parent
|
|
53
|
+
// container's full width proportionally, so the bar always fills the
|
|
54
|
+
// sidebar regardless of terminal size. No hardcoded width is needed —
|
|
55
|
+
// this fixes both the over-wide bar that wrapped onto a second line on
|
|
56
|
+
// narrow sidebars (issue #90) and the under-wide bar that left empty
|
|
57
|
+
// space on the right on wide sidebars.
|
|
58
|
+
const segments = createMemo<TokenSegment[]>(() => {
|
|
59
|
+
const s = props.snapshot
|
|
60
|
+
const total = s.inputTokens || 1
|
|
61
|
+
const result: TokenSegment[] = []
|
|
62
|
+
|
|
63
|
+
// System Prompt (purple)
|
|
64
|
+
if (s.systemPromptTokens > 0) {
|
|
65
|
+
result.push({
|
|
66
|
+
key: "sys",
|
|
67
|
+
tokens: s.systemPromptTokens,
|
|
68
|
+
color: COLORS.system,
|
|
69
|
+
label: "System",
|
|
70
|
+
})
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Compartments (blue)
|
|
74
|
+
if (s.compartmentTokens > 0) {
|
|
75
|
+
result.push({
|
|
76
|
+
key: "comp",
|
|
77
|
+
tokens: s.compartmentTokens,
|
|
78
|
+
color: COLORS.compartments,
|
|
79
|
+
label: "Compartments",
|
|
80
|
+
})
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Facts (yellow/orange)
|
|
84
|
+
if (s.factTokens > 0) {
|
|
85
|
+
result.push({
|
|
86
|
+
key: "fact",
|
|
87
|
+
tokens: s.factTokens,
|
|
88
|
+
color: COLORS.facts,
|
|
89
|
+
label: "Facts",
|
|
90
|
+
})
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
// Memories (green)
|
|
94
|
+
if (s.memoryTokens > 0) {
|
|
95
|
+
result.push({
|
|
96
|
+
key: "mem",
|
|
97
|
+
tokens: s.memoryTokens,
|
|
98
|
+
color: COLORS.memories,
|
|
99
|
+
label: "Memories",
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// Conversation = real user/assistant text/reasoning/images
|
|
104
|
+
// (excludes injected session-history and excludes tool call I/O).
|
|
105
|
+
//
|
|
106
|
+
// Always show this row even when conversationTokens === 0. The
|
|
107
|
+
// calibrator's residual-distribution math (tokenizer-calibration.ts)
|
|
108
|
+
// can round it down to zero when toolCallsLocal massively dominates
|
|
109
|
+
// conversationLocal — that's a calibration artifact, not a real
|
|
110
|
+
// "zero conversation". Suppressing the row leaves the legend looking
|
|
111
|
+
// truncated, which is more confusing than showing a 0% line. The
|
|
112
|
+
// segment is also skipped in the bar at 0 width because the segment
|
|
113
|
+
// builder uses `Math.max(1, ...)` only when tokens > 0 (see
|
|
114
|
+
// segmentWidths), so the visual bar stays correct either way.
|
|
115
|
+
result.push({
|
|
116
|
+
key: "conv",
|
|
117
|
+
tokens: s.conversationTokens,
|
|
118
|
+
color: COLORS.conversation,
|
|
119
|
+
label: "Conversation",
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
// Tool Calls = tool_use/tool_result/tool/tool-invocation parts in messages
|
|
123
|
+
// (actionable — users can reduce via ctx_reduce)
|
|
124
|
+
if (s.toolCallTokens > 0) {
|
|
125
|
+
result.push({
|
|
126
|
+
key: "tool-calls",
|
|
127
|
+
tokens: s.toolCallTokens,
|
|
128
|
+
color: COLORS.toolCalls,
|
|
129
|
+
label: "Tool Calls",
|
|
130
|
+
})
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Tool Definitions = measured description + JSON-schema parameters for
|
|
134
|
+
// each tool OpenCode sends in the `tools` request parameter, populated
|
|
135
|
+
// by the `tool.definition` plugin hook keyed by {provider, model, agent}.
|
|
136
|
+
// Zero until the first turn measures the active agent's tool set.
|
|
137
|
+
if (s.toolDefinitionTokens > 0) {
|
|
138
|
+
result.push({
|
|
139
|
+
key: "tool-defs",
|
|
140
|
+
tokens: s.toolDefinitionTokens,
|
|
141
|
+
color: COLORS.toolDefs,
|
|
142
|
+
label: "Tool Defs",
|
|
143
|
+
})
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
return result
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
const totalTokens = createMemo(() => props.snapshot.inputTokens || 1)
|
|
150
|
+
|
|
151
|
+
// Render-time segments for the bar. Zero-token segments are filtered out
|
|
152
|
+
// entirely (no flex weight, no rendered box) so they don't claim any
|
|
153
|
+
// width. Non-zero segments still get a Math.max(1, ...) floor on
|
|
154
|
+
// flexGrow so very small contributions remain visible as a thin sliver.
|
|
155
|
+
// The legend rows below show every segment (including zeros) for table
|
|
156
|
+
// stability — only the bar prunes them.
|
|
157
|
+
const barSegments = createMemo(() =>
|
|
158
|
+
segments().filter((seg) => seg.tokens > 0),
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
return (
|
|
162
|
+
<box width="100%" flexDirection="column">
|
|
163
|
+
{/* Segmented bar: a width="100%" flex row of colored boxes,
|
|
164
|
+
each with flexGrow proportional to its token count and
|
|
165
|
+
flexBasis=0. opentui distributes the parent's full width
|
|
166
|
+
proportionally, so the bar always fills the sidebar
|
|
167
|
+
regardless of terminal size. Height is fixed at 1 row;
|
|
168
|
+
backgroundColor renders the colored bar. */}
|
|
169
|
+
<box width="100%" flexDirection="row" height={1}>
|
|
170
|
+
{barSegments().map((seg) => (
|
|
171
|
+
<box
|
|
172
|
+
key={seg.key}
|
|
173
|
+
flexGrow={Math.max(1, seg.tokens)}
|
|
174
|
+
flexBasis={0}
|
|
175
|
+
height={1}
|
|
176
|
+
backgroundColor={seg.color}
|
|
177
|
+
/>
|
|
178
|
+
))}
|
|
179
|
+
</box>
|
|
180
|
+
|
|
181
|
+
{/* Legend rows */}
|
|
182
|
+
<box flexDirection="column" marginTop={0}>
|
|
183
|
+
{segments().map((seg) => {
|
|
184
|
+
const pct = ((seg.tokens / totalTokens()) * 100).toFixed(0)
|
|
185
|
+
return (
|
|
186
|
+
<box
|
|
187
|
+
key={seg.key}
|
|
188
|
+
width="100%"
|
|
189
|
+
flexDirection="row"
|
|
190
|
+
justifyContent="space-between"
|
|
191
|
+
>
|
|
192
|
+
<text fg={seg.color}>{seg.label}</text>
|
|
193
|
+
<text fg={props.theme.textMuted}>
|
|
194
|
+
{compactTokens(seg.tokens)} ({pct}%)
|
|
195
|
+
</text>
|
|
196
|
+
</box>
|
|
197
|
+
)
|
|
198
|
+
})}
|
|
199
|
+
</box>
|
|
200
|
+
</box>
|
|
201
|
+
)
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
const StatRow = (props: {
|
|
205
|
+
theme: TuiThemeCurrent
|
|
206
|
+
label: string
|
|
207
|
+
value: string
|
|
208
|
+
accent?: boolean
|
|
209
|
+
warning?: boolean
|
|
210
|
+
dim?: boolean
|
|
211
|
+
}) => {
|
|
212
|
+
const fg = createMemo(() => {
|
|
213
|
+
if (props.warning) return props.theme.warning
|
|
214
|
+
if (props.accent) return props.theme.accent
|
|
215
|
+
if (props.dim) return props.theme.textMuted
|
|
216
|
+
return props.theme.text
|
|
217
|
+
})
|
|
218
|
+
|
|
219
|
+
return (
|
|
220
|
+
<box width="100%" flexDirection="row" justifyContent="space-between">
|
|
221
|
+
<text fg={props.theme.textMuted}>{props.label}</text>
|
|
222
|
+
<text fg={fg()}>
|
|
223
|
+
<b>{props.value}</b>
|
|
224
|
+
</text>
|
|
225
|
+
</box>
|
|
226
|
+
)
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const SectionHeader = (props: { theme: TuiThemeCurrent; title: string }) => (
|
|
230
|
+
<box width="100%" marginTop={1}>
|
|
231
|
+
<text fg={props.theme.text}>
|
|
232
|
+
<b>{props.title}</b>
|
|
233
|
+
</text>
|
|
234
|
+
</box>
|
|
235
|
+
)
|
|
236
|
+
|
|
237
|
+
const SidebarContent = (props: {
|
|
238
|
+
api: TuiPluginApi
|
|
239
|
+
sessionID: () => string
|
|
240
|
+
theme: TuiThemeCurrent
|
|
241
|
+
}) => {
|
|
242
|
+
const [snapshot, setSnapshot] = createSignal<SidebarSnapshot | null>(null)
|
|
243
|
+
let refreshTimer: ReturnType<typeof setTimeout> | undefined
|
|
244
|
+
|
|
245
|
+
const refresh = () => {
|
|
246
|
+
const sid = props.sessionID()
|
|
247
|
+
if (!sid) return
|
|
248
|
+
const directory = props.api.state.path.directory ?? ""
|
|
249
|
+
void loadSidebarSnapshot(sid, directory).then((data) => {
|
|
250
|
+
setSnapshot(data)
|
|
251
|
+
try {
|
|
252
|
+
props.api.renderer.requestRender()
|
|
253
|
+
} catch {
|
|
254
|
+
// Ignore render errors
|
|
255
|
+
}
|
|
256
|
+
})
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
const scheduleRefresh = () => {
|
|
260
|
+
if (refreshTimer) clearTimeout(refreshTimer)
|
|
261
|
+
refreshTimer = setTimeout(() => {
|
|
262
|
+
refreshTimer = undefined
|
|
263
|
+
refresh()
|
|
264
|
+
}, REFRESH_DEBOUNCE_MS)
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
onCleanup(() => {
|
|
268
|
+
if (refreshTimer) clearTimeout(refreshTimer)
|
|
269
|
+
})
|
|
270
|
+
|
|
271
|
+
// Refresh on session change
|
|
272
|
+
createEffect(
|
|
273
|
+
on(props.sessionID, () => {
|
|
274
|
+
refresh()
|
|
275
|
+
}),
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
// Subscribe to events for live updates
|
|
279
|
+
createEffect(
|
|
280
|
+
on(
|
|
281
|
+
props.sessionID,
|
|
282
|
+
(sessionID) => {
|
|
283
|
+
const unsubs = [
|
|
284
|
+
props.api.event.on("message.updated", (event) => {
|
|
285
|
+
if (event.properties.info.sessionID !== sessionID) return
|
|
286
|
+
scheduleRefresh()
|
|
287
|
+
}),
|
|
288
|
+
props.api.event.on("session.updated", (event) => {
|
|
289
|
+
if (event.properties.info.id !== sessionID) return
|
|
290
|
+
scheduleRefresh()
|
|
291
|
+
}),
|
|
292
|
+
props.api.event.on("message.removed", (event) => {
|
|
293
|
+
if (event.properties.sessionID !== sessionID) return
|
|
294
|
+
scheduleRefresh()
|
|
295
|
+
}),
|
|
296
|
+
]
|
|
297
|
+
|
|
298
|
+
onCleanup(() => {
|
|
299
|
+
for (const unsub of unsubs) unsub()
|
|
300
|
+
})
|
|
301
|
+
},
|
|
302
|
+
{ defer: false },
|
|
303
|
+
),
|
|
304
|
+
)
|
|
305
|
+
|
|
306
|
+
const s = createMemo(() => snapshot())
|
|
307
|
+
const contextSummaryColor = createMemo(() => {
|
|
308
|
+
const usage = s()?.usagePercentage ?? 0
|
|
309
|
+
if (usage >= 80) return props.theme.error
|
|
310
|
+
if (usage >= 65) return props.theme.warning
|
|
311
|
+
return props.theme.accent
|
|
312
|
+
})
|
|
313
|
+
|
|
314
|
+
return (
|
|
315
|
+
<box
|
|
316
|
+
width="100%"
|
|
317
|
+
flexDirection="column"
|
|
318
|
+
border={SINGLE_BORDER}
|
|
319
|
+
borderColor={props.theme.borderActive}
|
|
320
|
+
paddingTop={1}
|
|
321
|
+
paddingBottom={1}
|
|
322
|
+
paddingLeft={0}
|
|
323
|
+
paddingRight={1}
|
|
324
|
+
>
|
|
325
|
+
{/* Header */}
|
|
326
|
+
<box flexDirection="row" justifyContent="space-between" alignItems="center">
|
|
327
|
+
<box paddingLeft={1} paddingRight={1} backgroundColor={props.theme.accent}>
|
|
328
|
+
<text fg={props.theme.background}>
|
|
329
|
+
<b>Magic Context</b>
|
|
330
|
+
</text>
|
|
331
|
+
</box>
|
|
332
|
+
<text fg={props.theme.textMuted}>v{packageJson.version}</text>
|
|
333
|
+
</box>
|
|
334
|
+
|
|
335
|
+
{/* Token breakdown bar */}
|
|
336
|
+
{s() && s()!.inputTokens > 0 && (
|
|
337
|
+
<box marginTop={1} flexDirection="column">
|
|
338
|
+
{(s()?.contextLimit ?? 0) > 0 && (
|
|
339
|
+
<box width="100%" flexDirection="row" justifyContent="space-between">
|
|
340
|
+
{/* Left: current usage vs the per-model execute
|
|
341
|
+
threshold (the value Magic Context compares
|
|
342
|
+
against when scheduling historian / drops).
|
|
343
|
+
"47.5% / 65%" tells the user how close they
|
|
344
|
+
are to the next compaction trigger. */}
|
|
345
|
+
<text fg={contextSummaryColor()}>
|
|
346
|
+
<b>{s()!.usagePercentage.toFixed(1)}%</b> / {formatThresholdPercent(s()!.executeThreshold)}%
|
|
347
|
+
</text>
|
|
348
|
+
{/* Right: absolute token usage vs the model's
|
|
349
|
+
full context window (separate from the
|
|
350
|
+
execute threshold so users still know how
|
|
351
|
+
much headroom remains beyond compaction). */}
|
|
352
|
+
<text fg={contextSummaryColor()}>
|
|
353
|
+
{compactTokens(s()!.inputTokens)} / {compactTokens(s()!.contextLimit)}
|
|
354
|
+
</text>
|
|
355
|
+
</box>
|
|
356
|
+
)}
|
|
357
|
+
<TokenBreakdown theme={props.theme} snapshot={s()!} />
|
|
358
|
+
</box>
|
|
359
|
+
)}
|
|
360
|
+
|
|
361
|
+
{/* Historian section */}
|
|
362
|
+
<box width="100%" marginTop={1} flexDirection="row" justifyContent="space-between">
|
|
363
|
+
<text fg={props.theme.text}>
|
|
364
|
+
<b>Historian</b>
|
|
365
|
+
</text>
|
|
366
|
+
{s()?.historianRunning ? (
|
|
367
|
+
<text fg={props.theme.warning}>compacting ⟳</text>
|
|
368
|
+
) : (
|
|
369
|
+
<text fg={props.theme.textMuted}>idle</text>
|
|
370
|
+
)}
|
|
371
|
+
</box>
|
|
372
|
+
<StatRow
|
|
373
|
+
theme={props.theme}
|
|
374
|
+
label="Compartments"
|
|
375
|
+
value={String(s()?.compartmentCount ?? 0)}
|
|
376
|
+
/>
|
|
377
|
+
<StatRow
|
|
378
|
+
theme={props.theme}
|
|
379
|
+
label="Facts"
|
|
380
|
+
value={String(s()?.factCount ?? 0)}
|
|
381
|
+
/>
|
|
382
|
+
|
|
383
|
+
{/* Memory section */}
|
|
384
|
+
<SectionHeader theme={props.theme} title="Memory" />
|
|
385
|
+
<StatRow
|
|
386
|
+
theme={props.theme}
|
|
387
|
+
label="Memories"
|
|
388
|
+
value={String(s()?.memoryCount ?? 0)}
|
|
389
|
+
accent
|
|
390
|
+
/>
|
|
391
|
+
{(s()?.memoryBlockCount ?? 0) > 0 && (
|
|
392
|
+
<StatRow
|
|
393
|
+
theme={props.theme}
|
|
394
|
+
label="Injected"
|
|
395
|
+
value={String(s()!.memoryBlockCount)}
|
|
396
|
+
dim
|
|
397
|
+
/>
|
|
398
|
+
)}
|
|
399
|
+
|
|
400
|
+
{/* Queue & Status */}
|
|
401
|
+
{((s()?.pendingOpsCount ?? 0) > 0 ||
|
|
402
|
+
(s()?.sessionNoteCount ?? 0) > 0 ||
|
|
403
|
+
(s()?.readySmartNoteCount ?? 0) > 0) && (
|
|
404
|
+
<>
|
|
405
|
+
<SectionHeader theme={props.theme} title="Status" />
|
|
406
|
+
{(s()?.pendingOpsCount ?? 0) > 0 && (
|
|
407
|
+
<StatRow
|
|
408
|
+
theme={props.theme}
|
|
409
|
+
label="Queue"
|
|
410
|
+
value={`${s()!.pendingOpsCount} pending`}
|
|
411
|
+
warning
|
|
412
|
+
/>
|
|
413
|
+
)}
|
|
414
|
+
{(s()?.sessionNoteCount ?? 0) > 0 && (
|
|
415
|
+
<StatRow
|
|
416
|
+
theme={props.theme}
|
|
417
|
+
label="Notes"
|
|
418
|
+
value={String(s()!.sessionNoteCount)}
|
|
419
|
+
/>
|
|
420
|
+
)}
|
|
421
|
+
{(s()?.readySmartNoteCount ?? 0) > 0 && (
|
|
422
|
+
<StatRow
|
|
423
|
+
theme={props.theme}
|
|
424
|
+
label="Smart Notes"
|
|
425
|
+
value={`${s()!.readySmartNoteCount} ready`}
|
|
426
|
+
accent
|
|
427
|
+
/>
|
|
428
|
+
)}
|
|
429
|
+
</>
|
|
430
|
+
)}
|
|
431
|
+
|
|
432
|
+
{/* Dreamer */}
|
|
433
|
+
{s()?.lastDreamerRunAt && (
|
|
434
|
+
<>
|
|
435
|
+
<SectionHeader theme={props.theme} title="Dreamer" />
|
|
436
|
+
<StatRow
|
|
437
|
+
theme={props.theme}
|
|
438
|
+
label="Last run"
|
|
439
|
+
value={relativeTime(s()!.lastDreamerRunAt!)}
|
|
440
|
+
dim
|
|
441
|
+
/>
|
|
442
|
+
</>
|
|
443
|
+
)}
|
|
444
|
+
|
|
445
|
+
{/* Stats — v0.21.8 ships a single "Total tokens" number while we
|
|
446
|
+
figure out how to present the new-work / reprocessed
|
|
447
|
+
categorization without confusing users. The underlying
|
|
448
|
+
snapshot fields (newWorkTokens, totalInputTokens) and the
|
|
449
|
+
session_meta columns are still populated; only the UI is
|
|
450
|
+
simplified for now. */}
|
|
451
|
+
{s()?.totalInputTokens != null && (
|
|
452
|
+
<>
|
|
453
|
+
<SectionHeader theme={props.theme} title="Stats" />
|
|
454
|
+
<StatRow
|
|
455
|
+
theme={props.theme}
|
|
456
|
+
label="Total tokens"
|
|
457
|
+
value={compactTokens(s()!.totalInputTokens ?? 0)}
|
|
458
|
+
dim
|
|
459
|
+
/>
|
|
460
|
+
</>
|
|
461
|
+
)}
|
|
462
|
+
</box>
|
|
463
|
+
)
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
export function createSidebarContentSlot(api: TuiPluginApi): TuiSlotPlugin {
|
|
467
|
+
return {
|
|
468
|
+
order: 151,
|
|
469
|
+
slots: {
|
|
470
|
+
sidebar_content: (ctx, value) => {
|
|
471
|
+
const theme = createMemo(() => ctx.theme.current)
|
|
472
|
+
return (
|
|
473
|
+
<SidebarContent
|
|
474
|
+
api={api}
|
|
475
|
+
sessionID={() => value.session_id}
|
|
476
|
+
theme={theme()}
|
|
477
|
+
/>
|
|
478
|
+
)
|
|
479
|
+
},
|
|
480
|
+
},
|
|
481
|
+
}
|
|
482
|
+
}
|