@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,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* OpenCode adapter for the harness-agnostic transcript interface.
|
|
3
|
+
*
|
|
4
|
+
* This is a thin proxy over OpenCode's `MessageLike[]` (i.e. `{ info,
|
|
5
|
+
* parts: unknown[] }[]`) — it does NOT copy data. Mutations through
|
|
6
|
+
* `setText`/`setToolOutput`/`replaceWithSentinel` write directly into
|
|
7
|
+
* the source `parts[]` arrays, exactly as the existing OpenCode-only
|
|
8
|
+
* transform code does today. `commit()` is a no-op because OpenCode's
|
|
9
|
+
* AI SDK reads `parts[]` back from the same array we mutated.
|
|
10
|
+
*
|
|
11
|
+
* This module is the boundary that lets the rest of the transform code
|
|
12
|
+
* (which moves to use the Transcript interface in 4b.2) work both for
|
|
13
|
+
* OpenCode and Pi without branching on harness type. By the end of 4b
|
|
14
|
+
* the only OpenCode-aware code in the plugin is this file plus
|
|
15
|
+
* `messages-transform.ts`.
|
|
16
|
+
*
|
|
17
|
+
* ## Mutation contract recap
|
|
18
|
+
*
|
|
19
|
+
* Magic Context's transform mutates message parts in three ways:
|
|
20
|
+
*
|
|
21
|
+
* 1. **Tag prefix injection** — prepends `§N§ ` to text parts and
|
|
22
|
+
* tool result outputs. Repeated tagging is idempotent because
|
|
23
|
+
* `prependTag` strips any existing prefix first.
|
|
24
|
+
*
|
|
25
|
+
* 2. **Sentinel replacement** — when a queued drop fires, the part is
|
|
26
|
+
* replaced with a `[dropped §N§]` or `[truncated §N§]` placeholder.
|
|
27
|
+
* The original tag number is preserved so the agent's mental
|
|
28
|
+
* model of "what was here" survives.
|
|
29
|
+
*
|
|
30
|
+
* 3. **Structural noise stripping** — `step-start`/`step-finish`
|
|
31
|
+
* wrappers and similar structural metadata are replaced with empty
|
|
32
|
+
* sentinel parts so they don't consume tag numbers or get tagged
|
|
33
|
+
* themselves.
|
|
34
|
+
*
|
|
35
|
+
* The OpenCode adapter implements (1) and (2) by editing `part.text` /
|
|
36
|
+
* `part.state.output` in place. For (3), structural parts surface as
|
|
37
|
+
* `kind: "structural"` so callers can filter them out. Adapter does NOT
|
|
38
|
+
* itself perform stripping — that's the transform pipeline's job, called
|
|
39
|
+
* after the adapter wraps the messages.
|
|
40
|
+
*
|
|
41
|
+
* Step 4b.1 ships the adapter alone. The existing OpenCode transform
|
|
42
|
+
* code keeps using `MessageLike[]` directly until 4b.2 migrates the
|
|
43
|
+
* tagging+drops layer to use Transcript instances.
|
|
44
|
+
*/
|
|
45
|
+
import type { Transcript } from "./transcript";
|
|
46
|
+
/**
|
|
47
|
+
* The OpenCode `MessageLike` shape. Re-declared here to avoid a circular
|
|
48
|
+
* import with `tag-messages.ts` (which lives in the magic-context hooks
|
|
49
|
+
* tree and depends on storage). Keeping a local minimal type also makes
|
|
50
|
+
* the adapter trivially unit-testable without booting OpenCode SDK
|
|
51
|
+
* types.
|
|
52
|
+
*
|
|
53
|
+
* MUST stay structurally compatible with `tag-messages.ts MessageLike` —
|
|
54
|
+
* if that file's MessageLike adds a required field, this one needs to
|
|
55
|
+
* add it too. The build will fail loudly if the shapes diverge.
|
|
56
|
+
*/
|
|
57
|
+
export interface OpenCodeMessageLike {
|
|
58
|
+
info: {
|
|
59
|
+
id?: string;
|
|
60
|
+
role?: string;
|
|
61
|
+
sessionID?: string;
|
|
62
|
+
};
|
|
63
|
+
parts: unknown[];
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Wrap an existing `MessageLike[]` as a Transcript. Zero copies — every
|
|
67
|
+
* `TranscriptPart` returned proxies the matching entry in the source
|
|
68
|
+
* `parts` array, and mutations are reflected immediately.
|
|
69
|
+
*/
|
|
70
|
+
export declare function createOpenCodeTranscript(messages: OpenCodeMessageLike[]): Transcript;
|
|
71
|
+
//# sourceMappingURL=transcript-opencode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcript-opencode.d.ts","sourceRoot":"","sources":["../../src/shared/transcript-opencode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AAGH,OAAO,KAAK,EACR,UAAU,EAIb,MAAM,cAAc,CAAC;AAEtB;;;;;;;;;;GAUG;AACH,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACzD,KAAK,EAAE,OAAO,EAAE,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,mBAAmB,EAAE,GAAG,UAAU,CA2BpF"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Harness-agnostic transcript interface.
|
|
3
|
+
*
|
|
4
|
+
* Magic Context's transform pipeline operates on messages in a specific
|
|
5
|
+
* shape: ordered messages with role-tagged parts (text, tool, reasoning,
|
|
6
|
+
* tool_result, image), where tagging, sentinel stripping, and queued-drop
|
|
7
|
+
* application MUTATE part content in-place. OpenCode's plugin transform
|
|
8
|
+
* receives a `{ info, parts: unknown[] }[]` array and the AI SDK reads
|
|
9
|
+
* those mutations directly. Pi's `pi.on("context", ...)` event delivers a
|
|
10
|
+
* `AgentMessage[]` and accepts a fully-replaced array as the result.
|
|
11
|
+
*
|
|
12
|
+
* Rather than building a bidirectional `MessageLike[] ↔ AgentMessage[]`
|
|
13
|
+
* adapter (Oracle's rejected Q1 alternative — too much round-trip
|
|
14
|
+
* complexity, double-conversion bugs), this module defines a small
|
|
15
|
+
* adapter contract that:
|
|
16
|
+
*
|
|
17
|
+
* 1. Exposes ordered messages with a *uniform* part-level mutation
|
|
18
|
+
* surface, regardless of underlying shape.
|
|
19
|
+
* 2. Is owned by the harness — OpenCode's adapter mutates `parts[]`
|
|
20
|
+
* directly (zero copies), Pi's adapter rebuilds an `AgentMessage[]`
|
|
21
|
+
* from the mutated transcript only at commit time.
|
|
22
|
+
* 3. Lets the shared transform code (tagging, stripping, drops)
|
|
23
|
+
* operate on `TranscriptPart` interface instances without caring
|
|
24
|
+
* whether they're wrapping `Part` from `@opencode-ai/sdk` or
|
|
25
|
+
* `TextContent | ToolCall | ThinkingContent` from `@earendil-works/pi-ai`.
|
|
26
|
+
*
|
|
27
|
+
* What this interface deliberately does NOT do:
|
|
28
|
+
*
|
|
29
|
+
* - **No data round-trip.** The transcript is a *view* over harness data;
|
|
30
|
+
* it doesn't define a third canonical message shape. There's no JSON
|
|
31
|
+
* serialization, no normalization to a common DTO. Round-trip-free
|
|
32
|
+
* adapters are 10x simpler and faster.
|
|
33
|
+
*
|
|
34
|
+
* - **No mutation semantics divergence.** Both adapters expose the same
|
|
35
|
+
* in-place mutation API (`setText`, `setOutput`, `replaceWithSentinel`).
|
|
36
|
+
* Whether mutation flushes to the source array immediately (OpenCode)
|
|
37
|
+
* or accumulates until `commit()` (Pi) is the adapter's concern.
|
|
38
|
+
*
|
|
39
|
+
* - **No session-storage abstraction.** Compartment storage, ordinals,
|
|
40
|
+
* raw-history reads — those live in feature modules, not here. The
|
|
41
|
+
* transcript only models the *current turn's* live message buffer.
|
|
42
|
+
*
|
|
43
|
+
* Step 4b.1 ships ONLY the interface and OpenCode adapter migration.
|
|
44
|
+
* Pi adapter implementation lands in 4b.2 alongside the Pi context-event
|
|
45
|
+
* wire-up, since the two are co-designed (the Pi adapter has to satisfy
|
|
46
|
+
* the same operations the tagging code calls). 4b.3 wires the Pi
|
|
47
|
+
* compartment trigger and historian invocation. 4b.4 nudges + auto-search.
|
|
48
|
+
*/
|
|
49
|
+
/** Categorical kind of a transcript part, useful for filter predicates. */
|
|
50
|
+
export type TranscriptPartKind = "text" | "thinking" | "tool_use" | "tool_result" | "image" | "file" | "structural" | "unknown";
|
|
51
|
+
/**
|
|
52
|
+
* A single content fragment within a transcript message.
|
|
53
|
+
*
|
|
54
|
+
* The interface is intentionally narrow: it exposes the operations Magic
|
|
55
|
+
* Context's transform code performs (read kind, read text, mutate text,
|
|
56
|
+
* mutate tool output, drop, replace with sentinel) and nothing more. Each
|
|
57
|
+
* harness adapter implements these against its native part type.
|
|
58
|
+
*
|
|
59
|
+
* IMPORTANT: implementations are stateful proxies over the live source
|
|
60
|
+
* data. Calling `setText("...")` on an OpenCode part mutates the
|
|
61
|
+
* underlying `Part.text`; calling it on a Pi part flips a dirty flag and
|
|
62
|
+
* the adapter's `commit()` rebuilds the affected `AgentMessage`. Either
|
|
63
|
+
* way, the transcript code reads back consistent values via `getText()`.
|
|
64
|
+
*/
|
|
65
|
+
export interface TranscriptPart {
|
|
66
|
+
/** Discriminator for filter logic. Stable across mutations. */
|
|
67
|
+
readonly kind: TranscriptPartKind;
|
|
68
|
+
/**
|
|
69
|
+
* Best-effort identifier for cross-pass tracking. May be:
|
|
70
|
+
* - OpenCode part ID (e.g. "prt_..."), stable across passes.
|
|
71
|
+
* - Pi tool-call ID for tool_use/tool_result parts.
|
|
72
|
+
* - undefined for synthetic/structural parts.
|
|
73
|
+
*
|
|
74
|
+
* Pure parts without a stable ID return undefined and are tracked
|
|
75
|
+
* positionally within their containing message instead.
|
|
76
|
+
*/
|
|
77
|
+
readonly id: string | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* The user-/agent-visible text payload, if this part has one. Returns
|
|
80
|
+
* undefined for parts that have no text representation (image, file,
|
|
81
|
+
* structural-only). For thinking parts returns the thinking text. For
|
|
82
|
+
* tool_use returns the JSON-stringified arguments (so size accounting
|
|
83
|
+
* reflects what the model sees). For tool_result returns the
|
|
84
|
+
* concatenated text content of the result.
|
|
85
|
+
*/
|
|
86
|
+
getText(): string | undefined;
|
|
87
|
+
/**
|
|
88
|
+
* Replace the visible text payload. Applies only to text and thinking
|
|
89
|
+
* parts; throws for kinds where mutation isn't meaningful (the caller
|
|
90
|
+
* should check `kind` first).
|
|
91
|
+
*
|
|
92
|
+
* Returns true if the underlying source data actually changed (so
|
|
93
|
+
* deduplication helpers can short-circuit). Returns false when the
|
|
94
|
+
* new text equals the existing text byte-for-byte.
|
|
95
|
+
*/
|
|
96
|
+
setText(newText: string): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* For tool_result parts: replace the text content of the result.
|
|
99
|
+
* For tool_use parts: replace JSON-serialized arguments.
|
|
100
|
+
* For everything else: throws — caller should check `kind` first.
|
|
101
|
+
*/
|
|
102
|
+
setToolOutput(newText: string): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Tool-specific metadata exposed for tagging/drop accounting:
|
|
105
|
+
* - toolName: tool identifier (e.g. "bash", "ctx_search"). undefined
|
|
106
|
+
* for non-tool parts.
|
|
107
|
+
* - inputByteSize: serialized argument size; used by historian
|
|
108
|
+
* pressure projection to estimate post-drop savings.
|
|
109
|
+
*
|
|
110
|
+
* For non-tool parts both fields are undefined.
|
|
111
|
+
*/
|
|
112
|
+
getToolMetadata(): {
|
|
113
|
+
toolName: string | undefined;
|
|
114
|
+
inputByteSize: number;
|
|
115
|
+
};
|
|
116
|
+
/**
|
|
117
|
+
* Replace this part with a sentinel placeholder. Sentinels look like
|
|
118
|
+
* `[dropped §N§]` or `[truncated §N§]` and survive cache-busting
|
|
119
|
+
* cycles by carrying their original tag number. Used by the
|
|
120
|
+
* apply-operations flow when a queued drop fires.
|
|
121
|
+
*
|
|
122
|
+
* Implementations replace the part *in place* in the parent message's
|
|
123
|
+
* part array. The replaced part's `kind` shifts to "structural" so
|
|
124
|
+
* subsequent transform passes don't double-process it.
|
|
125
|
+
*
|
|
126
|
+
* Returns true on success; returns false if the part can't be
|
|
127
|
+
* replaced (e.g. it's already a sentinel, or it's an image part).
|
|
128
|
+
*/
|
|
129
|
+
replaceWithSentinel(sentinelText: string): boolean;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* A single message in the transcript, exposing role + ordered parts.
|
|
133
|
+
*
|
|
134
|
+
* Lifetime: a TranscriptMessage is valid only within a single transform
|
|
135
|
+
* pass. Adapters do not guarantee identity across passes — callers must
|
|
136
|
+
* use `info.id` for cross-pass correlation, never the message reference.
|
|
137
|
+
*/
|
|
138
|
+
export interface TranscriptMessage {
|
|
139
|
+
/**
|
|
140
|
+
* Lightweight metadata exposed for tagging, sentinel persistence, and
|
|
141
|
+
* cross-pass correlation. Adapters fill these from harness-native
|
|
142
|
+
* fields:
|
|
143
|
+
*
|
|
144
|
+
* - id: provider-stable message ID (OpenCode `msg_...`, Pi entryId).
|
|
145
|
+
* - role: "user" | "assistant" | "system" | "tool" | other custom roles.
|
|
146
|
+
* - sessionId: session identifier, used to scope DB writes.
|
|
147
|
+
*
|
|
148
|
+
* IMPORTANT for Pi: Pi's `ToolResultMessage` has role "toolResult"
|
|
149
|
+
* which the OpenCode-derived transform code expects to NOT be present
|
|
150
|
+
* (OpenCode folds tool results into the next user message's parts).
|
|
151
|
+
* The Pi adapter therefore exposes tool-result messages as parts of a
|
|
152
|
+
* synthetic "user" message in the transcript view, even though the
|
|
153
|
+
* underlying Pi storage has them as separate top-level entries. This
|
|
154
|
+
* is the *only* shape normalization the adapter performs.
|
|
155
|
+
*/
|
|
156
|
+
readonly info: {
|
|
157
|
+
id?: string;
|
|
158
|
+
role: string;
|
|
159
|
+
sessionId?: string;
|
|
160
|
+
};
|
|
161
|
+
/** Ordered parts. Same ordering invariants as the underlying source. */
|
|
162
|
+
readonly parts: TranscriptPart[];
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Adapter contract: everything the transform pipeline calls on a
|
|
166
|
+
* harness-specific transcript implementation.
|
|
167
|
+
*
|
|
168
|
+
* Adapters are owned by the harness adapter layer (OpenCode's
|
|
169
|
+
* messages-transform.ts, Pi's context-event handler). The shared
|
|
170
|
+
* transform code receives a Transcript and operates only through this
|
|
171
|
+
* interface — it never imports from `@opencode-ai/sdk` or
|
|
172
|
+
* `@earendil-works/pi-ai`.
|
|
173
|
+
*/
|
|
174
|
+
export interface Transcript {
|
|
175
|
+
/** Ordered messages in the current pass. */
|
|
176
|
+
readonly messages: TranscriptMessage[];
|
|
177
|
+
/**
|
|
178
|
+
* Adapter identification. Useful for:
|
|
179
|
+
* - Logging (`magic-context[opencode]` vs `magic-context[pi]`).
|
|
180
|
+
* - Per-harness behaviors gated at adapter level (e.g. opencode-only
|
|
181
|
+
* compaction marker injection).
|
|
182
|
+
* - Test assertions confirming the right adapter ran.
|
|
183
|
+
*/
|
|
184
|
+
readonly harness: "opencode" | "pi";
|
|
185
|
+
/**
|
|
186
|
+
* Commit accumulated mutations to the underlying source array.
|
|
187
|
+
*
|
|
188
|
+
* For OpenCode: no-op — parts are mutated directly in `Part.text`/
|
|
189
|
+
* `Part.state.output` and OpenCode reads them back from the same
|
|
190
|
+
* array, so changes are already visible.
|
|
191
|
+
*
|
|
192
|
+
* For Pi: rebuilds a new `AgentMessage[]` from the dirty messages
|
|
193
|
+
* and stores it on the adapter so `pi.on("context", ...)` can return
|
|
194
|
+
* `{ messages }` to Pi. Idempotent: calling twice is safe.
|
|
195
|
+
*
|
|
196
|
+
* Always called exactly once per pass, after the transform pipeline
|
|
197
|
+
* finishes. Adapters that don't need it implement it as a no-op.
|
|
198
|
+
*/
|
|
199
|
+
commit(): void;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Sentinel marker for transcript parts that should be ignored by all
|
|
203
|
+
* downstream transform stages (tagging, drops, indexing). Adapters set
|
|
204
|
+
* this on parts that exist only as structural artifacts (e.g. OpenCode's
|
|
205
|
+
* `step-start`/`step-finish`).
|
|
206
|
+
*
|
|
207
|
+
* Exported so harness adapters can stamp it on synthetic parts they
|
|
208
|
+
* create internally and so test fixtures can construct synthetic
|
|
209
|
+
* transcripts without needing real OpenCode/Pi structures.
|
|
210
|
+
*/
|
|
211
|
+
export declare const STRUCTURAL_SENTINEL_KIND: TranscriptPartKind;
|
|
212
|
+
//# sourceMappingURL=transcript.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transcript.d.ts","sourceRoot":"","sources":["../../src/shared/transcript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,2EAA2E;AAC3E,MAAM,MAAM,kBAAkB,GACxB,MAAM,GACN,UAAU,GACV,UAAU,GACV,aAAa,GACb,OAAO,GACP,MAAM,GACN,YAAY,GACZ,SAAS,CAAC;AAEhB;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,cAAc;IAC3B,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAC;IAElC;;;;;;;;OAQG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC;IAEhC;;;;;;;OAOG;IACH,OAAO,IAAI,MAAM,GAAG,SAAS,CAAC;IAE9B;;;;;;;;OAQG;IACH,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAElC;;;;OAIG;IACH,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;IAExC;;;;;;;;OAQG;IACH,eAAe,IAAI;QAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,aAAa,EAAE,MAAM,CAAA;KAAE,CAAC;IAE3E;;;;;;;;;;;;OAYG;IACH,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC;CACtD;AAED;;;;;;GAMG;AACH,MAAM,WAAW,iBAAiB;IAC9B;;;;;;;;;;;;;;;;OAgBG;IACH,QAAQ,CAAC,IAAI,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAEjE,wEAAwE;IACxE,QAAQ,CAAC,KAAK,EAAE,cAAc,EAAE,CAAC;CACpC;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,UAAU;IACvB,4CAA4C;IAC5C,QAAQ,CAAC,QAAQ,EAAE,iBAAiB,EAAE,CAAC;IAEvC;;;;;;OAMG;IACH,QAAQ,CAAC,OAAO,EAAE,UAAU,GAAG,IAAI,CAAC;IAEpC;;;;;;;;;;;;;OAaG;IACH,MAAM,IAAI,IAAI,CAAC;CAClB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,EAAE,kBAAiC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auto-configure tui.json with magic-context TUI plugin entry.
|
|
3
|
+
* Called from the server plugin at startup so the TUI sidebar loads on next restart.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Ensure tui.json has the magic-context TUI plugin entry.
|
|
7
|
+
* Creates tui.json if it doesn't exist. Silently skips if already present.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ensureTuiPluginEntry(): boolean;
|
|
10
|
+
//# sourceMappingURL=tui-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tui-config.d.ts","sourceRoot":"","sources":["../../src/shared/tui-config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4CH;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CA+C9C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-expand/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,QAGwD,CAAC;AAE5F,eAAO,MAAM,uBAAuB,QAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-expand/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-expand/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAqDhE,wBAAgB,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAIrE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-expand/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export declare const CTX_MEMORY_TOOL_NAME = "ctx_memory";
|
|
2
|
+
export declare const CTX_MEMORY_DESCRIPTION = "Manage cross-session project memories. Primary sessions can write new memories or delete stale ones. Dreamer sessions can also list, update, merge, and archive memories. Memories persist across sessions and are automatically injected into new sessions.\n\nSupported actions: write, delete, list, update, merge, archive.";
|
|
3
|
+
export declare const DEFAULT_SEARCH_LIMIT = 10;
|
|
4
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-memory/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,eAAe,CAAC;AACjD,eAAO,MAAM,sBAAsB,oUAE6B,CAAC;AACjE,eAAO,MAAM,oBAAoB,KAAK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-memory/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-memory/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAyBhE,OAAO,EAIH,KAAK,iBAAiB,EACzB,MAAM,SAAS,CAAC;AA+djB,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAI5F"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { MemorySourceType } from "../../features/magic-context/memory";
|
|
2
|
+
import type { Database } from "../../shared/sqlite";
|
|
3
|
+
export declare const CTX_MEMORY_ACTIONS: readonly ["write", "delete"];
|
|
4
|
+
export declare const CTX_MEMORY_DREAMER_ACTIONS: readonly ["write", "delete", "list", "update", "merge", "archive"];
|
|
5
|
+
export type CtxMemoryAction = (typeof CTX_MEMORY_DREAMER_ACTIONS)[number];
|
|
6
|
+
export interface CtxMemoryArgs {
|
|
7
|
+
action: CtxMemoryAction;
|
|
8
|
+
content?: string;
|
|
9
|
+
category?: string;
|
|
10
|
+
id?: number;
|
|
11
|
+
ids?: number[];
|
|
12
|
+
limit?: number;
|
|
13
|
+
reason?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface CtxMemoryToolDeps {
|
|
16
|
+
db: Database;
|
|
17
|
+
ensureProjectRegistered?: (directory: string, db: Database) => Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Resolve the project identity for the active session's directory.
|
|
20
|
+
*
|
|
21
|
+
* Why a function instead of a baked string: OpenCode's top-level
|
|
22
|
+
* `ctx.directory` is the directory the OpenCode process was started
|
|
23
|
+
* in (often `$HOME` when launched via `opencode -s <id>` from outside
|
|
24
|
+
* the project). The session's actual working directory is exposed
|
|
25
|
+
* per-call via `toolContext.directory`. Resolving here ensures
|
|
26
|
+
* `ctx_memory` operates on the session's project, not the launch
|
|
27
|
+
* directory's project.
|
|
28
|
+
*/
|
|
29
|
+
resolveProjectPath: (directory: string) => string;
|
|
30
|
+
memoryEnabled?: boolean;
|
|
31
|
+
embeddingEnabled?: boolean;
|
|
32
|
+
allowedActions?: CtxMemoryAction[];
|
|
33
|
+
sourceType?: MemorySourceType;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-memory/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AAC5E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,eAAO,MAAM,kBAAkB,8BAA+B,CAAC;AAE/D,eAAO,MAAM,0BAA0B,oEAM7B,CAAC;AAEX,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,0BAA0B,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1E,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,eAAe,CAAC;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAC9B,EAAE,EAAE,QAAQ,CAAC;IACb,uBAAuB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7E;;;;;;;;;;OAUG;IACH,kBAAkB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IAClD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,cAAc,CAAC,EAAE,eAAe,EAAE,CAAC;IACnC,UAAU,CAAC,EAAE,gBAAgB,CAAC;CACjC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const CTX_NOTE_DESCRIPTION = "Save or inspect durable session notes that persist for this session.\nUse this for short goals, constraints, decisions, or reminders worth carrying forward.\n\nActions:\n- `write`: Append one note. Optionally provide `surface_condition` to create a smart note.\n- `read`: Show current notes. Defaults to active session notes + ready smart notes; use `filter` to inspect all, pending, ready, active, or dismissed notes.\n- `dismiss`: Dismiss a note by `note_id`.\n- `update`: Update a note by `note_id`.\n\n**Smart Notes**: When `surface_condition` is provided with `write`, the note becomes a project-scoped smart note. A separate background process (the dreamer) periodically checks the condition using ONLY external, verifiable signals: GitHub state via `gh` CLI, web pages, files on disk, git history, etc. The dreamer cannot read your current conversation, cannot detect when the user says something, and has no memory of context that lives only in this session.\n\nWrite a smart note ONLY when the surface_condition is something an external agent with read-only tools can definitively check:\n\n\u2713 GOOD conditions (externally verifiable):\n- \"When PR #42 in cortexkit/magic-context is merged\"\n- \"When the file packages/plugin/src/foo.ts contains a function named bar\"\n- \"When the latest release tag is >= v0.22.0\"\n- \"When the GitHub Actions workflow runs/123 succeeds\"\n\n\u2717 BAD conditions (require knowing this session's context):\n- \"When the user mentions the worktree system has landed\" \u2192 dreamer cannot see user messages\n- \"When they ask to re-run the audit fixes\" \u2192 dreamer cannot see future requests\n- \"When we revisit this code path\" \u2192 no observable signal\n- \"When relevant to the current discussion\" \u2192 no observable signal\n- \"After we finish the current refactor\" \u2192 no externally checkable boundary\n\nIf you want context that surfaces based on what's happening in your session, use a regular note (omit surface_condition) \u2014 those show up on natural work boundaries within this session. If you want a reminder tied to your future work without a clean external trigger, just write a regular note describing what to do; you'll see it when you read notes later.\n\nExample: `ctx_note(action=\"write\", content=\"Implement X because Y\", surface_condition=\"When PR #42 in cortexkit/magic-context is merged\")`\n\nHistorian reads these notes, deduplicates them, and rewrites the remaining useful notes over time.";
|
|
2
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-note/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,mgFA8BkE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-note/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type ToolDefinition } from "@opencode-ai/plugin";
|
|
2
|
+
import type { Database } from "../../shared/sqlite";
|
|
3
|
+
export interface CtxNoteToolDeps {
|
|
4
|
+
db: Database;
|
|
5
|
+
dreamerEnabled?: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* Resolve the project identity for the session's directory at call time.
|
|
8
|
+
* See CtxMemoryToolDeps.resolveProjectPath for why this is a function.
|
|
9
|
+
* Optional — when undefined, smart-note creation is rejected with an
|
|
10
|
+
* explanatory error.
|
|
11
|
+
*/
|
|
12
|
+
resolveProjectPath?: (directory: string) => string;
|
|
13
|
+
}
|
|
14
|
+
export declare function createCtxNoteTools(deps: CtxNoteToolDeps): Record<string, ToolDefinition>;
|
|
15
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-note/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAWhE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAIpD,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,QAAQ,CAAC;IACb,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;;OAKG;IACH,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;CACtD;AA2OD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,eAAe,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAIxF"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type CtxNoteReadFilter = "all" | "active" | "pending" | "ready" | "dismissed";
|
|
2
|
+
export interface CtxNoteArgs {
|
|
3
|
+
action?: "write" | "read" | "dismiss" | "update";
|
|
4
|
+
content?: string;
|
|
5
|
+
surface_condition?: string;
|
|
6
|
+
filter?: CtxNoteReadFilter;
|
|
7
|
+
note_id?: number;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-note/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG,KAAK,GAAG,QAAQ,GAAG,SAAS,GAAG,OAAO,GAAG,WAAW,CAAC;AAErF,MAAM,WAAW,WAAW;IACxB,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const CTX_REDUCE_DESCRIPTION = "Reduce context by dropping tagged content you no longer need.\nUse \u00A7N\u00A7 identifiers visible in conversation. The `drop` param accepts ranges: \"3-5\", \"1,2,9\", \"1-5,8\".\n\nCRITICAL RULES:\n- NEVER blanket-drop large ranges (e.g., \"1-50\"). Always review what each tag contains first.\n- Only drop tool outputs you have already processed and no longer need.\n- Protected tags are accepted but deferred until they leave the last protected range.\n- Keep recent context \u2014 only reduce OLD content that is no longer relevant to current work.\n- Dropped content is gone forever.";
|
|
2
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-reduce/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,olBAQA,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-reduce/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ToolDefinition } from "@opencode-ai/plugin";
|
|
2
|
+
import type { Database } from "../../shared/sqlite";
|
|
3
|
+
export interface CtxReduceToolDeps {
|
|
4
|
+
db: Database;
|
|
5
|
+
protectedTags: number;
|
|
6
|
+
getSessionTokens?: (sessionId: string) => number;
|
|
7
|
+
}
|
|
8
|
+
export declare function createCtxReduceTools(deps: CtxReduceToolDeps): Record<string, ToolDefinition>;
|
|
9
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-reduce/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAUhE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAIpD,MAAM,WAAW,iBAAiB;IAC9B,EAAE,EAAE,QAAQ,CAAC;IACb,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;CACpD;AAuGD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAI5F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-reduce/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-search/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,oBAAoB,eAAe,CAAC;AACjD,eAAO,MAAM,sBAAsB,QAkBvB,CAAC;AACb,eAAO,MAAM,wBAAwB,KAAK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-search/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-search/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAahE,OAAO,KAAK,EAAkC,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAiKjF,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAI5F"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Database } from "../../shared/sqlite";
|
|
2
|
+
/** Sources the agent can narrow ctx_search to. Facts are intentionally NOT a
|
|
3
|
+
* source — they're always rendered in <session-history> in message[0], so
|
|
4
|
+
* searching them returns content already visible in context. */
|
|
5
|
+
export type CtxSearchSource = "memory" | "message" | "git_commit";
|
|
6
|
+
export interface CtxSearchArgs {
|
|
7
|
+
query: string;
|
|
8
|
+
limit?: number;
|
|
9
|
+
/** Restrict search to specific sources. Omit to search all. */
|
|
10
|
+
sources?: CtxSearchSource[];
|
|
11
|
+
}
|
|
12
|
+
export interface CtxSearchToolDeps {
|
|
13
|
+
db: Database;
|
|
14
|
+
ensureProjectRegistered?: (directory: string, db: Database) => Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Resolve the project identity for the session's directory at call time.
|
|
17
|
+
* See CtxMemoryToolDeps.resolveProjectPath for why this is a function:
|
|
18
|
+
* OpenCode's top-level `ctx.directory` reflects the launch dir, not the
|
|
19
|
+
* session's working directory.
|
|
20
|
+
*/
|
|
21
|
+
resolveProjectPath: (directory: string) => string;
|
|
22
|
+
memoryEnabled?: boolean;
|
|
23
|
+
embeddingEnabled?: boolean;
|
|
24
|
+
/** When true, ctx_search surfaces indexed git commits as a 3rd source. */
|
|
25
|
+
gitCommitsEnabled?: boolean;
|
|
26
|
+
/** Override message reader for testing (avoids opening OpenCode DB in CI). */
|
|
27
|
+
readMessages?: (sessionId: string) => Array<{
|
|
28
|
+
ordinal: number;
|
|
29
|
+
id: string;
|
|
30
|
+
role: string;
|
|
31
|
+
parts: unknown[];
|
|
32
|
+
}>;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-search/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD;;iEAEiE;AACjE,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,SAAS,GAAG,YAAY,CAAC;AAElE,MAAM,WAAW,aAAa;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+DAA+D;IAC/D,OAAO,CAAC,EAAE,eAAe,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,iBAAiB;IAC9B,EAAE,EAAE,QAAQ,CAAC;IACb,uBAAuB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7E;;;;;OAKG;IACH,kBAAkB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;IAClD,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,0EAA0E;IAC1E,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,8EAA8E;IAC9E,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,KAAK,CAAC;QACxC,OAAO,EAAE,MAAM,CAAC;QAChB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,OAAO,EAAE,CAAC;KACpB,CAAC,CAAC;CACN"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|