@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,31 @@
|
|
|
1
|
+
import type { Database } from "../../shared/sqlite";
|
|
2
|
+
import type { SessionMeta } from "./types";
|
|
3
|
+
export interface SessionMetaRow {
|
|
4
|
+
session_id: string;
|
|
5
|
+
last_response_time: number;
|
|
6
|
+
cache_ttl: string;
|
|
7
|
+
counter: number;
|
|
8
|
+
last_nudge_tokens: number;
|
|
9
|
+
last_nudge_band: string;
|
|
10
|
+
last_transform_error: string;
|
|
11
|
+
is_subagent: number;
|
|
12
|
+
last_context_percentage: number;
|
|
13
|
+
last_input_tokens: number;
|
|
14
|
+
observed_safe_input_tokens: number;
|
|
15
|
+
cache_alert_sent: number;
|
|
16
|
+
times_execute_threshold_reached: number;
|
|
17
|
+
compartment_in_progress: number;
|
|
18
|
+
system_prompt_hash: string | number;
|
|
19
|
+
system_prompt_tokens: number;
|
|
20
|
+
conversation_tokens: number;
|
|
21
|
+
tool_call_tokens: number;
|
|
22
|
+
cleared_reasoning_through_tag: number;
|
|
23
|
+
last_todo_state: string;
|
|
24
|
+
}
|
|
25
|
+
export declare const META_COLUMNS: Record<string, string>;
|
|
26
|
+
export declare const BOOLEAN_META_KEYS: Set<string>;
|
|
27
|
+
export declare function isSessionMetaRow(row: unknown): row is SessionMetaRow;
|
|
28
|
+
export declare function getDefaultSessionMeta(sessionId: string): SessionMeta;
|
|
29
|
+
export declare function ensureSessionMetaRow(db: Database, sessionId: string): void;
|
|
30
|
+
export declare function toSessionMeta(row: SessionMetaRow): SessionMeta;
|
|
31
|
+
//# sourceMappingURL=storage-meta-shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-meta-shared.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/storage-meta-shared.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAA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|
+
export { type AppendAutoSearchHintOutcome, type AutoSearchHintDecision, appendAutoSearchHintDecision, appendNoteNudgeAnchor, clearDeferredExecutePendingIfMatches, clearDetectedContextLimit, clearEmergencyRecovery, clearHistorianFailureState, clearPendingCompactionMarkerStateIf, clearPendingPiCompactionMarkerStateIf, clearPersistedNoteNudge, clearPersistedNudgePlacement, clearPersistedReasoningWatermark, clearPersistedStickyTurnReminder, clearPersistedTodoSyntheticAnchor, type DeferredExecutePayload, deliverNoteNudgeAtomic, getAutoSearchHintDecisions, getHistorianFailureState, getNoteLastReadAt, getNoteNudgeAnchors, getOverflowState, getPendingCompactionMarkerState, getPendingPiCompactionMarkerState, getPersistedNoteNudge, getPersistedNudgePlacement, getPersistedReasoningWatermark, getPersistedStickyTurnReminder, getPersistedTodoSyntheticAnchor, getSessionsWithPendingMarker, getSessionsWithPendingPiMarker, getSessionWorkMetrics, getStrippedPlaceholderIds, incrementHistorianFailure, loadPersistedUsage, type PendingCompactionMarker, type PendingPiCompactionMarker, type PersistedOverflowState, type PersistedTodoSyntheticAnchor, peekDeferredExecutePending, pruneAutoSearchHintDecisions, pruneNoteNudgeAnchors, recordDetectedContextLimit, recordOverflowDetected, removeAutoSearchHintDecisionByMessageId, removeNoteNudgeAnchorByMessageId, removeStrippedPlaceholderId, setDeferredExecutePendingIfAbsent, setNoteLastReadAt, setPendingCompactionMarkerState, setPendingPiCompactionMarkerState, setPersistedNudgePlacement, setPersistedReasoningWatermark, setPersistedStickyTurnReminder, setPersistedTodoSyntheticAnchor, setSessionWorkMetrics, setStrippedPlaceholderIds, } from "./storage-meta-persisted";
|
|
2
|
+
export { clearSession, getOrCreateSessionMeta, updateSessionMeta, } from "./storage-meta-session";
|
|
3
|
+
//# sourceMappingURL=storage-meta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-meta.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/storage-meta.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,4BAA4B,EAC5B,qBAAqB,EACrB,oCAAoC,EACpC,yBAAyB,EACzB,sBAAsB,EACtB,0BAA0B,EAC1B,mCAAmC,EACnC,qCAAqC,EACrC,uBAAuB,EACvB,4BAA4B,EAC5B,gCAAgC,EAChC,gCAAgC,EAChC,iCAAiC,EACjC,KAAK,sBAAsB,EAC3B,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,iBAAiB,EACjB,mBAAmB,EACnB,gBAAgB,EAChB,+BAA+B,EAC/B,iCAAiC,EACjC,qBAAqB,EACrB,0BAA0B,EAC1B,8BAA8B,EAC9B,8BAA8B,EAC9B,+BAA+B,EAC/B,4BAA4B,EAC5B,8BAA8B,EAC9B,qBAAqB,EACrB,yBAAyB,EACzB,yBAAyB,EACzB,kBAAkB,EAClB,KAAK,uBAAuB,EAC5B,KAAK,yBAAyB,EAC9B,KAAK,sBAAsB,EAC3B,KAAK,4BAA4B,EACjC,0BAA0B,EAC1B,4BAA4B,EAC5B,qBAAqB,EACrB,0BAA0B,EAC1B,sBAAsB,EACtB,uCAAuC,EACvC,gCAAgC,EAChC,2BAA2B,EAC3B,iCAAiC,EACjC,iBAAiB,EACjB,+BAA+B,EAC/B,iCAAiC,EACjC,0BAA0B,EAC1B,8BAA8B,EAC9B,8BAA8B,EAC9B,+BAA+B,EAC/B,qBAAqB,EACrB,yBAAyB,GAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACH,YAAY,EACZ,sBAAsB,EACtB,iBAAiB,GACpB,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Database } from "../../shared/sqlite";
|
|
2
|
+
export type NoteType = "session" | "smart";
|
|
3
|
+
export type NoteStatus = "active" | "pending" | "ready" | "dismissed";
|
|
4
|
+
export interface Note {
|
|
5
|
+
id: number;
|
|
6
|
+
type: NoteType;
|
|
7
|
+
status: NoteStatus;
|
|
8
|
+
content: string;
|
|
9
|
+
sessionId: string | null;
|
|
10
|
+
projectPath: string | null;
|
|
11
|
+
surfaceCondition: string | null;
|
|
12
|
+
createdAt: number;
|
|
13
|
+
updatedAt: number;
|
|
14
|
+
lastCheckedAt: number | null;
|
|
15
|
+
readyAt: number | null;
|
|
16
|
+
readyReason: string | null;
|
|
17
|
+
}
|
|
18
|
+
export interface GetNotesOptions {
|
|
19
|
+
sessionId?: string;
|
|
20
|
+
projectPath?: string;
|
|
21
|
+
type?: NoteType;
|
|
22
|
+
status?: NoteStatus | NoteStatus[];
|
|
23
|
+
}
|
|
24
|
+
export interface NoteMutationScope {
|
|
25
|
+
sessionId: string;
|
|
26
|
+
projectPath: string;
|
|
27
|
+
}
|
|
28
|
+
export interface UpdateNoteOptions {
|
|
29
|
+
content?: string;
|
|
30
|
+
sessionId?: string | null;
|
|
31
|
+
projectPath?: string | null;
|
|
32
|
+
surfaceCondition?: string | null;
|
|
33
|
+
status?: NoteStatus;
|
|
34
|
+
lastCheckedAt?: number | null;
|
|
35
|
+
readyAt?: number | null;
|
|
36
|
+
readyReason?: string | null;
|
|
37
|
+
}
|
|
38
|
+
interface SessionNoteInput {
|
|
39
|
+
sessionId: string;
|
|
40
|
+
content: string;
|
|
41
|
+
}
|
|
42
|
+
interface SmartNoteInput {
|
|
43
|
+
content: string;
|
|
44
|
+
sessionId?: string;
|
|
45
|
+
projectPath: string;
|
|
46
|
+
surfaceCondition: string;
|
|
47
|
+
}
|
|
48
|
+
export declare function getNotes(db: Database, options?: GetNotesOptions): Note[];
|
|
49
|
+
export declare function addNote(db: Database, type: "session", options: SessionNoteInput): Note;
|
|
50
|
+
export declare function addNote(db: Database, type: "smart", options: SmartNoteInput): Note;
|
|
51
|
+
export declare function getSessionNotes(db: Database, sessionId: string): Note[];
|
|
52
|
+
export declare function getSmartNotes(db: Database, projectPath: string, status?: NoteStatus): Note[];
|
|
53
|
+
export declare function getPendingSmartNotes(db: Database, projectPath: string): Note[];
|
|
54
|
+
export declare function getReadySmartNotes(db: Database, projectPath: string): Note[];
|
|
55
|
+
export declare function updateNote(db: Database, noteId: number, updates: UpdateNoteOptions, scope: NoteMutationScope): Note | null;
|
|
56
|
+
export declare function dismissNote(db: Database, noteId: number, scope: NoteMutationScope): boolean;
|
|
57
|
+
export declare function markNoteReady(db: Database, noteId: number, reason?: string): void;
|
|
58
|
+
export declare function markNoteChecked(db: Database, noteId: number): void;
|
|
59
|
+
export declare function deleteNote(db: Database, noteId: number): boolean;
|
|
60
|
+
export declare function replaceAllSessionNotes(db: Database, sessionId: string, notes: string[]): void;
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=storage-notes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-notes.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/storage-notes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,OAAO,CAAC;AAC3C,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;AAEtE,MAAM,WAAW,IAAI;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,QAAQ,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED,MAAM,WAAW,eAAe;IAC5B,SA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AgB,eAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,CAEvE;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,UAAU,GAAG,IAAI,EAAE,CAM5F;AAED,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,EAAE,CAE9E;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,EAAE,CAE5E;AAED,wBAAgB,UAAU,CACtB,EAAE,EAAE,QAAQ,EACZ,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,iBAAiB,EAC1B,KAAK,EAAE,iBAAiB,GACzB,IAAI,GAAG,IAAI,CAuDb;AAED,wBAAgB,WAAW,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAY3F;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAKjF;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAKlE;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAGhE;AAED,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,CAW7F"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Database } from "../../shared/sqlite";
|
|
2
|
+
import type { PendingOp } from "./types";
|
|
3
|
+
export declare function queuePendingOp(db: Database, sessionId: string, tagId: number, operation: PendingOp["operation"], queuedAt?: number): void;
|
|
4
|
+
export declare function getPendingOps(db: Database, sessionId: string): PendingOp[];
|
|
5
|
+
export declare function clearPendingOps(db: Database, sessionId: string): void;
|
|
6
|
+
export declare function removePendingOp(db: Database, sessionId: string, tagId: number): void;
|
|
7
|
+
//# sourceMappingURL=storage-ops.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-ops.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/storage-ops.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAkC,MAAM,qBAAqB,CAAC;AACpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAkFzC,wBAAgB,cAAc,CAC1B,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,SAAS,CAAC,WAAW,CAAC,EACjC,QAAQ,GAAE,MAAmB,GAC9B,IAAI,CAEN;AAED,wBAAgB,aAAa,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,CAI1E;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAErE;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAEpF"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Database } from "../../shared/sqlite";
|
|
2
|
+
export declare function saveSourceContent(db: Database, sessionId: string, tagId: number, content: string): void;
|
|
3
|
+
export declare function replaceSourceContent(db: Database, sessionId: string, tagId: number, content: string): void;
|
|
4
|
+
export declare function getSourceContents(db: Database, sessionId: string, tagIds: number[]): Map<number, string>;
|
|
5
|
+
//# sourceMappingURL=storage-source.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-source.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/storage-source.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAapD,wBAAgB,iBAAiB,CAC7B,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GAChB,IAAI,CAIN;AAED,wBAAgB,oBAAoB,CAChC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,MAAM,EACb,OAAO,EAAE,MAAM,GAChB,IAAI,CAON;AAED,wBAAgB,iBAAiB,CAC7B,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EAAE,GACjB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAmBrB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Database } from "../../shared/sqlite";
|
|
2
|
+
export type SubagentKind = "historian" | "historian_editor" | "compressor" | "dreamer" | "sidekick" | "user_memory_review" | "recomp";
|
|
3
|
+
export type SubagentInvocationStatus = "completed" | "failed" | "aborted";
|
|
4
|
+
export interface SubagentInvocationInput {
|
|
5
|
+
sessionId: string;
|
|
6
|
+
harness: "opencode" | "pi";
|
|
7
|
+
subagent: SubagentKind;
|
|
8
|
+
task?: string | null;
|
|
9
|
+
providerId?: string | null;
|
|
10
|
+
modelId?: string | null;
|
|
11
|
+
startedAt: number;
|
|
12
|
+
endedAt: number;
|
|
13
|
+
status: SubagentInvocationStatus;
|
|
14
|
+
inputTokens: number;
|
|
15
|
+
outputTokens: number;
|
|
16
|
+
cacheReadTokens: number;
|
|
17
|
+
cacheWriteTokens: number;
|
|
18
|
+
error?: string | null;
|
|
19
|
+
parentInvocationId?: number | null;
|
|
20
|
+
}
|
|
21
|
+
export interface SubagentInvocationRow {
|
|
22
|
+
id: number;
|
|
23
|
+
sessionId: string;
|
|
24
|
+
harness: "opencode" | "pi";
|
|
25
|
+
subagent: SubagentKind;
|
|
26
|
+
task: string | null;
|
|
27
|
+
providerId: string | null;
|
|
28
|
+
modelId: string | null;
|
|
29
|
+
startedAt: number;
|
|
30
|
+
endedAt: number | null;
|
|
31
|
+
status: SubagentInvocationStatus;
|
|
32
|
+
inputTokens: number;
|
|
33
|
+
outputTokens: number;
|
|
34
|
+
cacheReadTokens: number;
|
|
35
|
+
cacheWriteTokens: number;
|
|
36
|
+
error: string | null;
|
|
37
|
+
parentInvocationId: number | null;
|
|
38
|
+
}
|
|
39
|
+
export interface SubagentTotals {
|
|
40
|
+
invocations: number;
|
|
41
|
+
totalInput: number;
|
|
42
|
+
totalOutput: number;
|
|
43
|
+
totalCacheRead: number;
|
|
44
|
+
totalCacheWrite: number;
|
|
45
|
+
}
|
|
46
|
+
export declare function recordSubagentInvocation(db: Database, input: SubagentInvocationInput): number;
|
|
47
|
+
export declare function getSubagentInvocations(db: Database, sessionId: string, opts?: {
|
|
48
|
+
subagent?: SubagentKind;
|
|
49
|
+
limit?: number;
|
|
50
|
+
}): SubagentInvocationRow[];
|
|
51
|
+
export declare function getSubagentTotalsBySubagent(db: Database, sessionId: string): Partial<Record<SubagentKind, SubagentTotals>>;
|
|
52
|
+
//# sourceMappingURL=storage-subagent-invocations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-subagent-invocations.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/storage-subagent-invocations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,MAAM,YAAY,GAClB,WAAW,GACX,kBAAkB,GAClB,YAAY,GACZ,SAAS,GACT,UAAU,GACV,oBAAoB,GACpB,QAAQ,CAAC;AAEf,MAAM,MAAM,wBAAwB,GAAG,WAAW,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE1E,MAAM,WAAW,uBAAuB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IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;CAC3B;AA8CD,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,uBAAuB,GAAG,MAAM,CA4B7F;AAED,wBAAgB,sBAAsB,CAClC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,YAAY,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAO,GACvD,qBAAqB,EAAE,CAoBzB;AAED,wBAAgB,2BAA2B,CACvC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC,CAyB/C"}
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import type { Database } from "../../shared/sqlite";
|
|
2
|
+
import type { TagEntry } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Bump a tag's byte_size when a later occurrence of the same call_id
|
|
5
|
+
* carries a larger payload. Used by `tagTranscript` to record the
|
|
6
|
+
* tool-result payload size after the tool-use invocation already
|
|
7
|
+
* reserved the tag with the args size.
|
|
8
|
+
*
|
|
9
|
+
* No-op if newByteSize is not strictly larger than the stored value
|
|
10
|
+
* (caller should compare in memory and only call when necessary).
|
|
11
|
+
*/
|
|
12
|
+
export declare function updateTagByteSize(db: Database, sessionId: string, tagNumber: number, newByteSize: number): void;
|
|
13
|
+
/**
|
|
14
|
+
* Bump a tag's input_byte_size when a tool_use occurrence is seen
|
|
15
|
+
* after the result occurrence (rare in practice; supports both
|
|
16
|
+
* orderings).
|
|
17
|
+
*/
|
|
18
|
+
export declare function updateTagInputByteSize(db: Database, sessionId: string, tagNumber: number, newInputByteSize: number): void;
|
|
19
|
+
export declare function insertTag(db: Database, sessionId: string, messageId: string, type: TagEntry["type"], byteSize: number, tagNumber: number, reasoningByteSize?: number, toolName?: string | null, inputByteSize?: number, toolOwnerMessageId?: string | null): number;
|
|
20
|
+
export declare function updateTagStatus(db: Database, sessionId: string, tagId: number, status: TagEntry["status"]): void;
|
|
21
|
+
export declare function updateTagDropMode(db: Database, sessionId: string, tagNumber: number, dropMode: TagEntry["dropMode"]): void;
|
|
22
|
+
/**
|
|
23
|
+
* Set the caveman compression depth for a tag.
|
|
24
|
+
*
|
|
25
|
+
* Only message tags are expected to receive non-zero depth; callers enforce
|
|
26
|
+
* that. Persisted so later transform passes and restarts can resume without
|
|
27
|
+
* re-compressing text that already matches its target age-tier depth.
|
|
28
|
+
*/
|
|
29
|
+
export declare function updateCavemanDepth(db: Database, sessionId: string, tagNumber: number, depth: number): void;
|
|
30
|
+
export declare function updateTagMessageId(db: Database, sessionId: string, tagId: number, messageId: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* Delete every tag whose source content lives on `messageId`. This is
|
|
33
|
+
* the `message.removed` event handler's primary cleanup path.
|
|
34
|
+
*
|
|
35
|
+
* What gets deleted:
|
|
36
|
+
* - Message tags: `messageId == <removed-msg-id>` (text parts).
|
|
37
|
+
* - File tags: `messageId LIKE <removed-msg-id>:p%` /
|
|
38
|
+
* `<removed-msg-id>:file%`.
|
|
39
|
+
* - Tool tags owned by the removed message:
|
|
40
|
+
* `tool_owner_message_id == <removed-msg-id>` (v3.3.1 Layer C).
|
|
41
|
+
*
|
|
42
|
+
* Pre-v10 semantics: tool tags used `messageId = callId`, so a removed
|
|
43
|
+
* assistant message would not match any tool tag's `messageId` field
|
|
44
|
+
* (the message id was never written there for tool tags). The fix:
|
|
45
|
+
* include tool tags by composite-owner identity so an assistant
|
|
46
|
+
* message removal correctly cascades to the tool tags it hosted.
|
|
47
|
+
*
|
|
48
|
+
* Returns the tag numbers that were deleted (used by the event handler
|
|
49
|
+
* to re-anchor reasoning watermarks and audit logs).
|
|
50
|
+
*/
|
|
51
|
+
export declare function deleteTagsByMessageId(db: Database, sessionId: string, messageId: string): number[];
|
|
52
|
+
export declare function getMaxTagNumberBySession(db: Database, sessionId: string): number;
|
|
53
|
+
/**
|
|
54
|
+
* Look up the tag_number assigned to a specific (session_id, message_id).
|
|
55
|
+
*
|
|
56
|
+
* Used by the tagger's recovery path to bind an existing DB-assigned tag back
|
|
57
|
+
* into the in-memory assignment map without bumping the counter past the DB's
|
|
58
|
+
* actual max. Returns null when no tag exists for that message yet.
|
|
59
|
+
*/
|
|
60
|
+
export declare function getTagNumberByMessageId(db: Database, sessionId: string, messageId: string): number | null;
|
|
61
|
+
export declare function getTagsBySession(db: Database, sessionId: string): TagEntry[];
|
|
62
|
+
/**
|
|
63
|
+
* Return only the tags whose status is 'active' for this session.
|
|
64
|
+
*
|
|
65
|
+
* Backed by the partial index `idx_tags_active_session_tag_number` so the
|
|
66
|
+
* scan touches only active rows instead of every tag in the session.
|
|
67
|
+
*
|
|
68
|
+
* Use this in: heuristic cleanup, nudger, caveman replay scope, anywhere
|
|
69
|
+
* that filters `tags.filter(t => t.status === "active")` on the result of
|
|
70
|
+
* `getTagsBySession`.
|
|
71
|
+
*
|
|
72
|
+
* The returned shape matches `TagEntry` exactly so callers can swap with
|
|
73
|
+
* no behavior change beyond seeing fewer (active-only) rows.
|
|
74
|
+
*/
|
|
75
|
+
export declare function getActiveTagsBySession(db: Database, sessionId: string): TagEntry[];
|
|
76
|
+
/**
|
|
77
|
+
* Return the tags whose tag_number is in `tagNumbers` for this session.
|
|
78
|
+
*
|
|
79
|
+
* Used by `applyFlushedStatuses` (and similar replay loops) to fetch the
|
|
80
|
+
* subset of tags that match the current pass's visible target set rather
|
|
81
|
+
* than scanning every tag in the session.
|
|
82
|
+
*
|
|
83
|
+
* The IN-list is built dynamically because SQLite caches prepared
|
|
84
|
+
* statements per query string, but we still get prepared-statement reuse
|
|
85
|
+
* for any given list size that happens twice in a row (which is the
|
|
86
|
+
* common case during long sessions).
|
|
87
|
+
*
|
|
88
|
+
* Returns an empty array when `tagNumbers` is empty (avoids generating
|
|
89
|
+
* `IN ()` which is an SQL syntax error).
|
|
90
|
+
*/
|
|
91
|
+
export declare function getTagsByNumbers(db: Database, sessionId: string, tagNumbers: readonly number[]): TagEntry[];
|
|
92
|
+
/**
|
|
93
|
+
* Return the maximum tag_number among tags whose status is 'dropped' for
|
|
94
|
+
* this session, or 0 if no dropped tags exist.
|
|
95
|
+
*
|
|
96
|
+
* Replaces the full-array iteration `for (tag of tags) if (dropped &&
|
|
97
|
+
* tag_number > max) max = tag_number` with a single SQL aggregate.
|
|
98
|
+
* Backed by the partial index `idx_tags_dropped_session_tag_number` so
|
|
99
|
+
* SQLite resolves the MAX with a backward index seek (O(log N)).
|
|
100
|
+
*/
|
|
101
|
+
export declare function getMaxDroppedTagNumber(db: Database, sessionId: string): number;
|
|
102
|
+
export declare function getTagById(db: Database, sessionId: string, tagId: number): TagEntry | null;
|
|
103
|
+
export declare function getTopNBySize(db: Database, sessionId: string, n: number): TagEntry[];
|
|
104
|
+
/**
|
|
105
|
+
* Look up the tag_number for a specific composite tool identity.
|
|
106
|
+
*
|
|
107
|
+
* Returns null when no tag exists for `(sessionId, callId, ownerMsgId)`.
|
|
108
|
+
* This is the fast path for the runtime tagger after a tagger restart
|
|
109
|
+
* or cache eviction.
|
|
110
|
+
*/
|
|
111
|
+
export declare function getToolTagNumberByOwner(db: Database, sessionId: string, callId: string, ownerMsgId: string): number | null;
|
|
112
|
+
/**
|
|
113
|
+
* Find a NULL-owner tool tag row for `(sessionId, callId)`.
|
|
114
|
+
*
|
|
115
|
+
* Used by the lazy-adoption fast path: when the runtime tagger sees a
|
|
116
|
+
* tool with composite key `(ownerMsgId, callId)` that has no
|
|
117
|
+
* corresponding row in `assignments`, but the underlying callId already
|
|
118
|
+
* exists in DB with NULL owner (legacy pre-v10 row), we want to adopt
|
|
119
|
+
* the orphan rather than allocate a fresh tag. This preserves
|
|
120
|
+
* cache-stable tag numbers across the v9 → v10 upgrade.
|
|
121
|
+
*
|
|
122
|
+
* Returns the lowest-numbered NULL-owner row deterministically. The
|
|
123
|
+
* caller is expected to follow up with `adoptNullOwnerToolTag` to
|
|
124
|
+
* atomically claim ownership; if that returns false, another writer
|
|
125
|
+
* adopted first and the caller must re-check the composite-key fast
|
|
126
|
+
* path or allocate a fresh tag.
|
|
127
|
+
*/
|
|
128
|
+
export declare function getNullOwnerToolTag(db: Database, sessionId: string, callId: string): {
|
|
129
|
+
id: number;
|
|
130
|
+
tagNumber: number;
|
|
131
|
+
} | null;
|
|
132
|
+
/**
|
|
133
|
+
* Atomically adopt a NULL-owner tool tag row by setting
|
|
134
|
+
* `tool_owner_message_id = ownerMsgId`. Returns true if exactly one
|
|
135
|
+
* row was updated (we won the race), false if zero (someone else
|
|
136
|
+
* adopted between our SELECT and UPDATE).
|
|
137
|
+
*
|
|
138
|
+
* The NULL guard makes this concurrent-safe with both the backfill
|
|
139
|
+
* pass and concurrent runtime adoptions in other plugin processes.
|
|
140
|
+
*/
|
|
141
|
+
export declare function adoptNullOwnerToolTag(db: Database, rowId: number, ownerMsgId: string): boolean;
|
|
142
|
+
/**
|
|
143
|
+
* Returns the candidate tool-tag owner ids for `(sessionId, callId)` —
|
|
144
|
+
* every tag with a non-NULL owner. Used by the result-only-window
|
|
145
|
+
* fallback in `tag-messages.ts`: the caller resolves wall-clock times
|
|
146
|
+
* for every candidate against the OpenCode DB (via
|
|
147
|
+
* `getMessageTimesFromOpenCodeDb`) and picks the most recent one whose
|
|
148
|
+
* `time_created` precedes the current result message.
|
|
149
|
+
*
|
|
150
|
+
* The picking logic lives in the caller because resolving message times
|
|
151
|
+
* requires the OpenCode read-only DB handle, which lives in the hooks
|
|
152
|
+
* tree. Keeping that import one-way (hooks → features) avoids what
|
|
153
|
+
* would otherwise be a cycle through the storage barrel.
|
|
154
|
+
*
|
|
155
|
+
* Returns an empty array when no candidates exist; the caller falls back
|
|
156
|
+
* to `messageId` (the result's own id) in that case so the runtime
|
|
157
|
+
* still allocates a stable composite key.
|
|
158
|
+
*/
|
|
159
|
+
export declare function getCandidateToolOwners(db: Database, sessionId: string, callId: string): string[];
|
|
160
|
+
/**
|
|
161
|
+
* Pick the most recent (by OpenCode `time_created`) candidate owner
|
|
162
|
+
* whose message strictly precedes `currentMessageId`. Tie-break on
|
|
163
|
+
* lexicographic id, matching the legacy single-statement ordering
|
|
164
|
+
* (`ORDER BY time_created DESC, id DESC` limited to rows where
|
|
165
|
+
* `time_created < currentTime`).
|
|
166
|
+
*
|
|
167
|
+
* Returns null when:
|
|
168
|
+
* - The candidate list is empty
|
|
169
|
+
* - `currentMessageId` is not present in `times`
|
|
170
|
+
* - No candidate predates `currentMessageId` in OC time
|
|
171
|
+
*
|
|
172
|
+
* This helper is independent of any DB handle — the caller resolves the
|
|
173
|
+
* `times` map (typically via `getMessageTimesFromOpenCodeDb`) and passes
|
|
174
|
+
* it in. Splitting the lookup from the picking keeps `storage-tags.ts`
|
|
175
|
+
* free of any OpenCode-DB import.
|
|
176
|
+
*/
|
|
177
|
+
export declare function pickNearestPriorOwner(candidates: readonly string[], currentMessageId: string, times: ReadonlyMap<string, number>): string | null;
|
|
178
|
+
/**
|
|
179
|
+
* Legacy alias kept for the rare runtime call site that hasn't been
|
|
180
|
+
* migrated to the split lookup-then-pick form. Always returns null
|
|
181
|
+
* (no message-time data available without a DB handle the function
|
|
182
|
+
* itself can't reach). New call sites should use `getCandidateToolOwners`
|
|
183
|
+
* + `getMessageTimesFromOpenCodeDb` + `pickNearestPriorOwner` directly.
|
|
184
|
+
*
|
|
185
|
+
* Why we keep this name: the v3.3.1 plan documents this as the public
|
|
186
|
+
* entry point for the result-only-window fallback. Removing it would
|
|
187
|
+
* require touching `.alfonso/plans/tag-owner-fix-plan.md` and migrating
|
|
188
|
+
* the test fixtures that exercise it. Leaving the symbol present with
|
|
189
|
+
* a noop body keeps existing test scaffolds working while the actual
|
|
190
|
+
* pick happens in the hooks-tree caller.
|
|
191
|
+
*/
|
|
192
|
+
export declare function getPersistedToolOwnerNearestPrior(_db: Database, _sessionId: string, _callId: string, _currentMessageId: string): string | null;
|
|
193
|
+
/**
|
|
194
|
+
* Delete every tool tag owned by `ownerMsgId` in the session. Used by
|
|
195
|
+
* `message.removed` cleanup to scope the deletion correctly: pre-v10
|
|
196
|
+
* a removed assistant message would `deleteTagsByMessageId(messageId)`
|
|
197
|
+
* which only matched `message_id = messageId` (the contentId for text
|
|
198
|
+
* parts), missing tool tags whose `message_id` is the callID. Post-v10
|
|
199
|
+
* the owner column gives us the right scope.
|
|
200
|
+
*
|
|
201
|
+
* Returns the number of rows deleted. NULL-owner legacy rows are not
|
|
202
|
+
* matched by this helper — they remain reachable via `message_id`-only
|
|
203
|
+
* deletion paths until adopted or backfilled.
|
|
204
|
+
*/
|
|
205
|
+
export declare function deleteToolTagsByOwner(db: Database, sessionId: string, ownerMsgId: string): number;
|
|
206
|
+
//# sourceMappingURL=storage-tags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage-tags.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/storage-tags.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAkC,MAAM,qBAAqB,CAAC;AACpF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AA+DxC;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC7B,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GACpB,IAAI,CAEN;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAClC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,MAAM,GACzB,IAAI,CAEN;AA4ID,wBAAgB,SAAS,CACrB,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,IAAI,E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AG,OAAO,CAG9F;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,sBAAsB,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAYhG;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,qBAAqB,CACjC,UAAU,EAAE,SAAS,MAAM,EAAE,EAC7B,gBAAgB,EAAE,MAAM,EACxB,KAAK,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,GACnC,MAAM,GAAG,IAAI,CAef;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iCAAiC,CAC7C,GAAG,EAAE,QAAQ,EACb,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,iBAAiB,EAAE,MAAM,GAC1B,MAAM,GAAG,IAAI,CAEf;AAgBD;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAGjG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { buildCompartmentBlock, escapeXmlAttr, escapeXmlContent, getCompartments, getSessionFacts, replaceAllCompartmentState, replaceAllCompartmentStateAndBumpDepth, type SessionFact, } from "./compartment-storage";
|
|
2
|
+
export { clearCompressionDepth, getAverageCompressionDepth, getMaxCompressionDepth, incrementCompressionDepth, } from "./compression-depth-storage";
|
|
3
|
+
export { clearIndexedMessages, deleteIndexedMessage, } from "./message-index";
|
|
4
|
+
export { type ContextDatabase, closeDatabase, getDatabasePersistenceError, isDatabasePersisted, openDatabase, } from "./storage-db";
|
|
5
|
+
export { type AppendAutoSearchHintOutcome, type AutoSearchHintDecision, appendAutoSearchHintDecision, appendNoteNudgeAnchor, clearDeferredExecutePendingIfMatches, clearDetectedContextLimit, clearEmergencyRecovery, clearHistorianFailureState, clearPendingCompactionMarkerStateIf, clearPendingPiCompactionMarkerStateIf, clearPersistedNoteNudge, clearPersistedNudgePlacement, clearPersistedReasoningWatermark, clearPersistedStickyTurnReminder, clearPersistedTodoSyntheticAnchor, clearSession, type DeferredExecutePayload, deliverNoteNudgeAtomic, getAutoSearchHintDecisions, getHistorianFailureState, getNoteLastReadAt, getNoteNudgeAnchors, getOrCreateSessionMeta, getOverflowState, getPendingCompactionMarkerState, getPendingPiCompactionMarkerState, getPersistedNoteNudge, getPersistedNudgePlacement, getPersistedReasoningWatermark, getPersistedStickyTurnReminder, getPersistedTodoSyntheticAnchor, getSessionsWithPendingMarker, getSessionsWithPendingPiMarker, getSessionWorkMetrics, getStrippedPlaceholderIds, incrementHistorianFailure, loadPersistedUsage, type PendingCompactionMarker, type PendingPiCompactionMarker, type PersistedOverflowState, type PersistedTodoSyntheticAnchor, peekDeferredExecutePending, pruneAutoSearchHintDecisions, pruneNoteNudgeAnchors, recordDetectedContextLimit, recordOverflowDetected, removeAutoSearchHintDecisionByMessageId, removeNoteNudgeAnchorByMessageId, removeStrippedPlaceholderId, setDeferredExecutePendingIfAbsent, setNoteLastReadAt, setPendingCompactionMarkerState, setPendingPiCompactionMarkerState, setPersistedNudgePlacement, setPersistedReasoningWatermark, setPersistedStickyTurnReminder, setPersistedTodoSyntheticAnchor, setSessionWorkMetrics, setStrippedPlaceholderIds, updateSessionMeta, } from "./storage-meta";
|
|
6
|
+
export { addNote, deleteNote, dismissNote, getNotes, getPendingSmartNotes, getReadySmartNotes, getSessionNotes, getSmartNotes, markNoteChecked, markNoteReady, type Note, type NoteStatus, type NoteType, replaceAllSessionNotes, updateNote, } from "./storage-notes";
|
|
7
|
+
export { clearPendingOps, getPendingOps, queuePendingOp, removePendingOp, } from "./storage-ops";
|
|
8
|
+
export { getSourceContents, replaceSourceContent, saveSourceContent, } from "./storage-source";
|
|
9
|
+
export { getSubagentInvocations, getSubagentTotalsBySubagent, recordSubagentInvocation, type SubagentInvocationInput, type SubagentInvocationRow, type SubagentKind, type SubagentTotals, } from "./storage-subagent-invocations";
|
|
10
|
+
export { deleteTagsByMessageId, getActiveTagsBySession, getMaxDroppedTagNumber, getMaxTagNumberBySession, getTagById, getTagsByNumbers, getTagsBySession, getTopNBySize, insertTag, updateCavemanDepth, updateTagDropMode, updateTagMessageId, updateTagStatus, } from "./storage-tags";
|
|
11
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/storage.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,qBAAqB,EACrB,aAAa,EACb,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,0BAA0B,EAC1B,sCAAsC,EACtC,KAAK,WAAW,GACnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACH,qBAAqB,EACrB,0BAA0B,EAC1B,sBAAsB,EACtB,yBAAyB,GAC5B,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACH,oBAAoB,EACpB,oBAAoB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACH,KAAK,eAAe,EACpB,aAAa,EACb,2BAA2B,EAC3B,mBAAmB,EACnB,YAAY,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EACH,KAAK,2BAA2B,EAChC,KAAK,sBAAsB,EAC3B,4BAA4B,EAC5B,qBAAqB,EACrB,oCAAoC,EACpC,yBAAyB,EACzB,sBAAsB,EACtB,0BAA0B,EAC1B,mCAAmC,EACnC,qCAAqC,EACrC,uBAAuB,EACvB,4BAA4B,EAC5B,gCAAgC,EAChC,gCAAgC,EAChC,iCAAiC,EACjC,YAAY,EACZ,KAAK,sBAAsB,EAC3B,sBAAsB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,iBAAiB,EACjB,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,EAChB,+BAA+B,EAC/B,iCAAiC,EACjC,qBAAqB,EACrB,0BAA0B,EAC1B,8BAA8B,EAC9B,8BAA8B,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ClB,eAAe,GAClB,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { Database } from "../../shared/sqlite";
|
|
2
|
+
import { type SubagentInvocationStatus, type SubagentKind } from "./storage-subagent-invocations";
|
|
3
|
+
export interface TokenTotals {
|
|
4
|
+
input: number;
|
|
5
|
+
output: number;
|
|
6
|
+
cacheRead: number;
|
|
7
|
+
cacheWrite: number;
|
|
8
|
+
}
|
|
9
|
+
export interface LastAssistantModel {
|
|
10
|
+
providerId: string | null;
|
|
11
|
+
modelId: string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface ChildInvocationRecordInput {
|
|
14
|
+
db: Database;
|
|
15
|
+
parentSessionId: string;
|
|
16
|
+
harness: "opencode" | "pi";
|
|
17
|
+
subagent: SubagentKind;
|
|
18
|
+
startedAt: number;
|
|
19
|
+
endedAt?: number;
|
|
20
|
+
status: SubagentInvocationStatus;
|
|
21
|
+
task?: string | null;
|
|
22
|
+
messages?: unknown[];
|
|
23
|
+
tokens?: TokenTotals;
|
|
24
|
+
providerId?: string | null;
|
|
25
|
+
modelId?: string | null;
|
|
26
|
+
error?: unknown;
|
|
27
|
+
parentInvocationId?: number | null;
|
|
28
|
+
}
|
|
29
|
+
export declare function emptyTokenTotals(): TokenTotals;
|
|
30
|
+
export declare function sumTokensFromChildMessages(messages: unknown[]): TokenTotals;
|
|
31
|
+
export declare function findLastAssistantModel(messages: unknown[]): LastAssistantModel;
|
|
32
|
+
export declare function recordChildInvocation(input: ChildInvocationRecordInput): number | null;
|
|
33
|
+
//# sourceMappingURL=subagent-token-capture.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subagent-token-capture.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/subagent-token-capture.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAEH,KAAK,wBAAwB,EAC7B,KAAK,YAA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"./types";
|
|
3
|
+
export declare function makeToolCompositeKey(ownerMsgId: string, callId: string): string;
|
|
4
|
+
/**
|
|
5
|
+
* Narrowed type for non-tool tag operations. The compile-time exclusion
|
|
6
|
+
* of `"tool"` here is the v3.3.1 Layer C contract: every tool path MUST
|
|
7
|
+
* use `assignToolTag`/`getToolTag` so composite identity propagates.
|
|
8
|
+
*
|
|
9
|
+
* Any caller passing `"tool"` to `assignTag` or `getTag` triggers a TS
|
|
10
|
+
* compile error at the call site. Defense-in-depth: the runtime body
|
|
11
|
+
* also throws if it ever sees a "tool" type at runtime (caught by
|
|
12
|
+
* `as any` casts in legacy code).
|
|
13
|
+
*/
|
|
14
|
+
type NonToolTagType = Exclude<TagEntry["type"], "tool">;
|
|
15
|
+
export interface Tagger {
|
|
16
|
+
/**
|
|
17
|
+
* Assign a tag for a non-tool entity (message text or file part).
|
|
18
|
+
*
|
|
19
|
+
* Tool tags MUST use {@link assignToolTag}; the `type` parameter
|
|
20
|
+
* here is narrowed at compile time to forbid `"tool"`.
|
|
21
|
+
*/
|
|
22
|
+
assignTag(sessionId: string, messageId: string, type: NonToolTagType, byteSize: number, db: Database, reasoningByteSize?: number, toolName?: string | null, inputByteSize?: number): number;
|
|
23
|
+
/**
|
|
24
|
+
* Look up the tag number for a non-tool entity.
|
|
25
|
+
*
|
|
26
|
+
* The `type` parameter is required (and narrowed to non-tool) so a
|
|
27
|
+
* future tool-tag lookup can't accidentally fall through here. Use
|
|
28
|
+
* {@link getToolTag} for tool lookups.
|
|
29
|
+
*/
|
|
30
|
+
getTag(sessionId: string, messageId: string, type: NonToolTagType): number | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Assign a tag for a tool invocation. Composite identity
|
|
33
|
+
* `(sessionId, callId, ownerMsgId)` is mandatory — pre-v3.3.1 the
|
|
34
|
+
* tagger keyed tool tags by bare callId, and two assistant turns
|
|
35
|
+
* reusing the same callId would silently bind to the same tag,
|
|
36
|
+
* inheriting the older tag's drop status.
|
|
37
|
+
*
|
|
38
|
+
* `ownerMsgId` is the assistant message id that hosts the tool
|
|
39
|
+
* invocation. For Pi parallel-tool-calls without `part.id`, callers
|
|
40
|
+
* pass a synthetic locator equal to the contentId (owner == callId)
|
|
41
|
+
* to satisfy the contract while preserving the legacy "each part
|
|
42
|
+
* gets its own tag" behavior.
|
|
43
|
+
*/
|
|
44
|
+
assignToolTag(sessionId: string, callId: string, ownerMsgId: string, byteSize: number, db: Database, reasoningByteSize?: number, toolName?: string | null, inputByteSize?: number): number;
|
|
45
|
+
/**
|
|
46
|
+
* Look up the tag number for a tool invocation by composite
|
|
47
|
+
* identity.
|
|
48
|
+
*/
|
|
49
|
+
getToolTag(sessionId: string, callId: string, ownerMsgId: string): number | undefined;
|
|
50
|
+
bindTag(sessionId: string, messageId: string, tagNumber: number): void;
|
|
51
|
+
/**
|
|
52
|
+
* Bind a tool tag by composite key. The in-memory map keys this as
|
|
53
|
+
* `${ownerMsgId}\x00${callId}`.
|
|
54
|
+
*/
|
|
55
|
+
bindToolTag(sessionId: string, callId: string, ownerMsgId: string, tagNumber: number): void;
|
|
56
|
+
getAssignments(sessionId: string): ReadonlyMap<string, number>;
|
|
57
|
+
resetCounter(sessionId: string, db: Database): void;
|
|
58
|
+
getCounter(sessionId: string): number;
|
|
59
|
+
initFromDb(sessionId: string, db: Database): void;
|
|
60
|
+
cleanup(sessionId: string): void;
|
|
61
|
+
}
|
|
62
|
+
export declare function createTagger(): Tagger;
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=tagger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tagger.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/tagger.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAkC,MAAM,qBAAqB,CAAC;AASpF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAkBxC,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,MAAM,EAAE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,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/D,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,GAAG,IAAI,CAAC;IACpD,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IACtC,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,GAAG,IAAI,CAAC;IAClD,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAmJD,wBAAgB,YAAY,IAAI,MAAM,CAycrC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool-definition token measurement store.
|
|
3
|
+
*
|
|
4
|
+
* OpenCode's `tool.definition` hook fires once per tool per
|
|
5
|
+
* `ToolRegistry.tools()` call, with `{ toolID }` as input and
|
|
6
|
+
* `{ description, parameters }` as output. Crucially the hook input does NOT
|
|
7
|
+
* carry `sessionID` — the tool set is computed per
|
|
8
|
+
* `{providerID, modelID, agent}` combination, independent of session.
|
|
9
|
+
*
|
|
10
|
+
* We measure each tool's description + JSON-schema parameters, tokenize with
|
|
11
|
+
* the same Claude tokenizer used everywhere else in the plugin, and store
|
|
12
|
+
* per-tool totals keyed by `${providerID}/${modelID}/${agentName}`. Inner map
|
|
13
|
+
* keys on `toolID` so every hook fire idempotently overwrites its own slot
|
|
14
|
+
* (same tool set on each turn → same key → same measured total).
|
|
15
|
+
*
|
|
16
|
+
* Consumers (RPC sidebar/status handlers) look up the active session's
|
|
17
|
+
* measurement via `getMeasuredToolDefinitionTokens(providerID, modelID,
|
|
18
|
+
* agentName)`. Returns `undefined` when the key has never been measured — the
|
|
19
|
+
* caller is expected to fall back to residual math or show zero.
|
|
20
|
+
*
|
|
21
|
+
* Persistence (v9+): measurements are also written to SQLite so that a
|
|
22
|
+
* plugin restart can repopulate the in-memory map without waiting for the
|
|
23
|
+
* next chat.message → tool.definition hook chain. The in-memory Map remains
|
|
24
|
+
* the hot read path; SQLite is a write-through mirror that backs cold starts.
|
|
25
|
+
* If `setDatabase()` hasn't been called yet (cold path before openDatabase
|
|
26
|
+
* completes), `recordToolDefinition` still updates the in-memory map and
|
|
27
|
+
* silently skips persistence — first measurement after init lands both.
|
|
28
|
+
*
|
|
29
|
+
* Hot-path optimization: `tool.definition` fires once per tool per LLM
|
|
30
|
+
* flight (~58 tools × 5–18ms SQLite write = ~1.4s of redundant work per
|
|
31
|
+
* flight on large MC databases). Tool descriptions and parameters almost
|
|
32
|
+
* never change between flights, so we keep a per-key content-fingerprint
|
|
33
|
+
* Map and bail out at the top of `recordToolDefinition` when the new fire
|
|
34
|
+
* carries the same fingerprint as the previous one. This collapses
|
|
35
|
+
* steady-state hook overhead from ~1.4s to <1ms while still re-measuring
|
|
36
|
+
* any tool whose description/schema actually changed (e.g. MCP server
|
|
37
|
+
* restart, OpenCode upgrade). Cached prepared statement avoids repeated
|
|
38
|
+
* `db.prepare()` compile cost on first-flight rebuilds.
|
|
39
|
+
*/
|
|
40
|
+
import type { Database } from "../../shared/sqlite";
|
|
41
|
+
/**
|
|
42
|
+
* Register the database used to persist measurements. Called by
|
|
43
|
+
* openDatabase() after runMigrations() has ensured the
|
|
44
|
+
* `tool_definition_measurements` table exists. Subsequent
|
|
45
|
+
* recordToolDefinition() calls will write through to SQLite.
|
|
46
|
+
*/
|
|
47
|
+
export declare function setDatabase(db: Database): void;
|
|
48
|
+
/**
|
|
49
|
+
* Populate the in-memory measurements map from the
|
|
50
|
+
* `tool_definition_measurements` table. Called once at startup after
|
|
51
|
+
* setDatabase(), before the first sidebar snapshot or status query, so the
|
|
52
|
+
* sidebar's "Tool Defs" segment shows the correct value immediately on
|
|
53
|
+
* restart instead of 0.
|
|
54
|
+
*
|
|
55
|
+
* Idempotent: re-running over the same DB reapplies the same values; the
|
|
56
|
+
* inner-map key (toolID) ensures duplicates overwrite rather than accumulate.
|
|
57
|
+
*/
|
|
58
|
+
export declare function loadToolDefinitionMeasurements(db: Database): void;
|
|
59
|
+
/**
|
|
60
|
+
* Tokenize a single tool's schema and store it under the given key. Called
|
|
61
|
+
* from the `tool.definition` plugin hook once per tool per flight. Same
|
|
62
|
+
* toolID on a later flight overwrites its slot — the total for the key stays
|
|
63
|
+
* consistent even if descriptions or parameters drift between turns.
|
|
64
|
+
*/
|
|
65
|
+
export declare function recordToolDefinition(providerID: string, modelID: string, agentName: string | undefined, toolID: string, description: string, parameters: unknown): void;
|
|
66
|
+
/**
|
|
67
|
+
* Returns the summed measured tokens for a `{provider, model, agent}` key,
|
|
68
|
+
* or `undefined` when never measured (e.g. fresh session before first turn).
|
|
69
|
+
*/
|
|
70
|
+
export declare function getMeasuredToolDefinitionTokens(providerID: string, modelID: string, agentName: string | undefined): number | undefined;
|
|
71
|
+
/** Test helper: reset the store so suites don't leak measurements. */
|
|
72
|
+
export declare function __resetToolDefinitionMeasurements(): void;
|
|
73
|
+
/** Inspection helper: snapshot the current store (for debug logging/tests). */
|
|
74
|
+
export declare function getToolDefinitionSnapshot(): Array<{
|
|
75
|
+
key: string;
|
|
76
|
+
totalTokens: number;
|
|
77
|
+
toolCount: number;
|
|
78
|
+
}>;
|
|
79
|
+
//# sourceMappingURL=tool-definition-tokens.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-definition-tokens.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/tool-definition-tokens.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAa,MAAM,qBAAqB,CAAC;AA0C/D;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAK9C;AAED;;;;;;;;;GASG;AACH,wBAAgB,8BAA8B,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAkCjE;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAChC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,OAAO,GACpB,IAAI,CAwEN;AAED;;;GAGG;AACH,wBAAgB,+BAA+B,CAC3C,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAAG,SAAS,GAC9B,MAAM,GAAG,SAAS,CAOpB;AAED,sEAAsE;AACtE,wBAAgB,iCAAiC,IAAI,IAAI,CAKxD;AAED,+EAA+E;AAC/E,wBAAgB,yBAAyB,IAAI,KAAK,CAAC;IAC/C,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACrB,CAAC,CAMD"}
|