@wolfx/opencode-magic-context 0.21.8 → 0.22.1-patch.0
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/magic-context-prompt.d.ts.map +1 -1
- package/dist/agents/permissions.d.ts +29 -14
- package/dist/agents/permissions.d.ts.map +1 -1
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/migrate-experimental.d.ts +30 -0
- package/dist/config/migrate-experimental.d.ts.map +1 -0
- package/dist/config/schema/agent-overrides.d.ts.map +1 -1
- package/dist/config/schema/magic-context.d.ts +110 -109
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/features/builtin-commands/commands.d.ts.map +1 -1
- package/dist/features/magic-context/compartment-embedding.d.ts +34 -0
- package/dist/features/magic-context/compartment-embedding.d.ts.map +1 -0
- package/dist/features/magic-context/compartment-events.d.ts +50 -0
- package/dist/features/magic-context/compartment-events.d.ts.map +1 -0
- package/dist/features/magic-context/compartment-storage.d.ts +22 -0
- package/dist/features/magic-context/compartment-storage.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/lease.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/queue.d.ts +13 -2
- package/dist/features/magic-context/dreamer/queue.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/runner.d.ts +11 -0
- package/dist/features/magic-context/dreamer/runner.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-prompts.d.ts +1 -1
- package/dist/features/magic-context/dreamer/task-prompts.d.ts.map +1 -1
- package/dist/features/magic-context/git-commits/git-log-reader.d.ts.map +1 -1
- package/dist/features/magic-context/key-files/identify-key-files.d.ts +1 -1
- package/dist/features/magic-context/key-files/identify-key-files.d.ts.map +1 -1
- package/dist/features/magic-context/key-files/project-key-files.d.ts.map +1 -1
- package/dist/features/magic-context/key-files/read-stats.d.ts +1 -1
- package/dist/features/magic-context/key-files/read-stats.d.ts.map +1 -1
- package/dist/features/magic-context/memory/constants.d.ts +4 -0
- package/dist/features/magic-context/memory/constants.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-identity.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-openai.d.ts +6 -0
- package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-probe.d.ts +5 -0
- package/dist/features/magic-context/memory/embedding-probe.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding.d.ts.map +1 -1
- package/dist/features/magic-context/memory/index.d.ts +1 -1
- package/dist/features/magic-context/memory/index.d.ts.map +1 -1
- package/dist/features/magic-context/memory/memory-migration.d.ts +133 -0
- package/dist/features/magic-context/memory/memory-migration.d.ts.map +1 -0
- package/dist/features/magic-context/memory/project-identity.d.ts +38 -7
- package/dist/features/magic-context/memory/project-identity.d.ts.map +1 -1
- package/dist/features/magic-context/memory/storage-memory-fts.d.ts.map +1 -1
- package/dist/features/magic-context/memory/storage-memory.d.ts +15 -1
- package/dist/features/magic-context/memory/storage-memory.d.ts.map +1 -1
- package/dist/features/magic-context/memory/types.d.ts +3 -1
- package/dist/features/magic-context/memory/types.d.ts.map +1 -1
- package/dist/features/magic-context/message-index.d.ts.map +1 -1
- package/dist/features/magic-context/migrations.d.ts +7 -0
- package/dist/features/magic-context/migrations.d.ts.map +1 -1
- package/dist/features/magic-context/project-docs-hash.d.ts +6 -0
- package/dist/features/magic-context/project-docs-hash.d.ts.map +1 -0
- package/dist/features/magic-context/project-identity.d.ts +2 -0
- package/dist/features/magic-context/project-identity.d.ts.map +1 -0
- package/dist/features/magic-context/storage-db.d.ts +51 -7
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/storage-historian-runs.d.ts +73 -0
- package/dist/features/magic-context/storage-historian-runs.d.ts.map +1 -0
- package/dist/features/magic-context/storage-identity-rekey-map.d.ts +11 -0
- package/dist/features/magic-context/storage-identity-rekey-map.d.ts.map +1 -0
- package/dist/features/magic-context/storage-m0-mutation-log.d.ts +22 -0
- package/dist/features/magic-context/storage-m0-mutation-log.d.ts.map +1 -0
- package/dist/features/magic-context/storage-memory-mutation-log.d.ts +25 -0
- package/dist/features/magic-context/storage-memory-mutation-log.d.ts.map +1 -0
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-shared.d.ts +44 -0
- package/dist/features/magic-context/storage-meta-shared.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta.d.ts +1 -0
- package/dist/features/magic-context/storage-meta.d.ts.map +1 -1
- package/dist/features/magic-context/storage-project-state.d.ts +19 -0
- package/dist/features/magic-context/storage-project-state.d.ts.map +1 -0
- package/dist/features/magic-context/storage-subagent-invocations.d.ts +9 -0
- package/dist/features/magic-context/storage-subagent-invocations.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tags.d.ts +21 -1
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/features/magic-context/storage-v22-backfill-failures.d.ts +24 -0
- package/dist/features/magic-context/storage-v22-backfill-failures.d.ts.map +1 -0
- package/dist/features/magic-context/storage.d.ts +12 -3
- package/dist/features/magic-context/storage.d.ts.map +1 -1
- package/dist/features/magic-context/subagent-token-capture.d.ts +1 -1
- package/dist/features/magic-context/subagent-token-capture.d.ts.map +1 -1
- package/dist/features/magic-context/tagger.d.ts +15 -1
- package/dist/features/magic-context/tagger.d.ts.map +1 -1
- package/dist/features/magic-context/types.d.ts +21 -0
- package/dist/features/magic-context/types.d.ts.map +1 -1
- package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
- package/dist/features/magic-context/user-memory/storage-user-memory.d.ts.map +1 -1
- package/dist/features/magic-context/v22-deferred-backfill.d.ts +46 -0
- package/dist/features/magic-context/v22-deferred-backfill.d.ts.map +1 -0
- package/dist/features/magic-context/work-metrics.d.ts +66 -0
- package/dist/features/magic-context/work-metrics.d.ts.map +1 -1
- package/dist/hooks/magic-context/cache-busting-signals.d.ts +9 -0
- package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -1
- package/dist/hooks/magic-context/command-handler.d.ts +13 -1
- package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-parser.d.ts +25 -0
- package/dist/hooks/magic-context/compartment-parser.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-prompt.d.ts +27 -16
- package/dist/hooks/magic-context/compartment-prompt.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-mapping.d.ts +6 -2
- package/dist/hooks/magic-context/compartment-runner-mapping.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-partial-recomp.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-recomp.d.ts +9 -1
- package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts +67 -4
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/decay-curve.d.ts +78 -0
- package/dist/hooks/magic-context/decay-curve.d.ts.map +1 -0
- package/dist/hooks/magic-context/decay-render.d.ts +67 -0
- package/dist/hooks/magic-context/decay-render.d.ts.map +1 -0
- package/dist/hooks/magic-context/event-handler.d.ts +1 -1
- package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-resolvers.d.ts +17 -0
- package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
- package/dist/hooks/magic-context/execute-status.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-prompt.generated.d.ts +2 -0
- package/dist/hooks/magic-context/historian-prompt.generated.d.ts.map +1 -0
- package/dist/hooks/magic-context/historian-state-file.d.ts +4 -4
- package/dist/hooks/magic-context/hook-handlers.d.ts +3 -0
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts +12 -20
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts +126 -0
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/key-files-block.d.ts.map +1 -1
- package/dist/hooks/magic-context/live-session-state.d.ts +9 -0
- package/dist/hooks/magic-context/live-session-state.d.ts.map +1 -1
- package/dist/hooks/magic-context/m0-token-breakdown.d.ts +35 -0
- package/dist/hooks/magic-context/m0-token-breakdown.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-chunk.d.ts +9 -0
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-db.d.ts +7 -0
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts +104 -0
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -0
- package/dist/hooks/magic-context/reference-retrieval.d.ts +61 -0
- package/dist/hooks/magic-context/reference-retrieval.d.ts.map +1 -0
- package/dist/hooks/magic-context/reference-seeds.generated.d.ts +8 -0
- package/dist/hooks/magic-context/reference-seeds.generated.d.ts.map +1 -0
- package/dist/hooks/magic-context/send-session-notification.d.ts +1 -1
- package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -1
- package/dist/hooks/magic-context/system-prompt-hash.d.ts +5 -6
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/text-complete.d.ts +41 -1
- package/dist/hooks/magic-context/text-complete.d.ts.map +1 -1
- package/dist/hooks/magic-context/tokenizer-calibration.d.ts +6 -0
- package/dist/hooks/magic-context/tokenizer-calibration.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +0 -7
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +18 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +9 -7
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/upgrade-reminder.d.ts +73 -0
- package/dist/hooks/magic-context/upgrade-reminder.d.ts.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10024 -5179
- package/dist/plugin/conflict-warning-hook.d.ts +13 -0
- package/dist/plugin/conflict-warning-hook.d.ts.map +1 -1
- package/dist/plugin/dream-timer.d.ts.map +1 -1
- package/dist/plugin/event.d.ts +10 -3
- package/dist/plugin/event.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/messages-transform.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/plugin/tool-registry.d.ts.map +1 -1
- package/dist/shared/announcement.d.ts +17 -1
- package/dist/shared/announcement.d.ts.map +1 -1
- package/dist/shared/data-path.d.ts +9 -11
- package/dist/shared/data-path.d.ts.map +1 -1
- package/dist/shared/models-dev-cache.d.ts.map +1 -1
- package/dist/shared/rpc-client.d.ts +1 -0
- package/dist/shared/rpc-client.d.ts.map +1 -1
- package/dist/shared/rpc-notifications.d.ts +27 -5
- package/dist/shared/rpc-notifications.d.ts.map +1 -1
- package/dist/shared/rpc-server.d.ts +1 -0
- package/dist/shared/rpc-server.d.ts.map +1 -1
- package/dist/shared/rpc-types.d.ts +30 -2
- package/dist/shared/rpc-types.d.ts.map +1 -1
- package/dist/shared/rpc-utils.d.ts +9 -0
- package/dist/shared/rpc-utils.d.ts.map +1 -1
- package/dist/shared/sqlite-helpers.d.ts +7 -7
- package/dist/shared/sqlite.d.ts +23 -14
- package/dist/shared/sqlite.d.ts.map +1 -1
- package/dist/shared/tag-transcript.d.ts +10 -1
- package/dist/shared/tag-transcript.d.ts.map +1 -1
- package/dist/tools/ctx-expand/tools.d.ts +5 -1
- package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
- package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
- package/dist/tui/data/context-db.d.ts +16 -1
- package/dist/tui/data/context-db.d.ts.map +1 -1
- package/package.json +2 -3
- package/src/shared/announcement.test.ts +23 -7
- package/src/shared/announcement.ts +30 -8
- package/src/shared/conflict-detector.test.ts +19 -6
- package/src/shared/conflict-detector.ts +1 -1
- package/src/shared/conflict-fixer.test.ts +7 -3
- package/src/shared/data-path.test.ts +9 -10
- package/src/shared/data-path.ts +10 -12
- package/src/shared/models-dev-cache.test.ts +72 -4
- package/src/shared/models-dev-cache.ts +47 -8
- package/src/shared/opencode-compaction-detector.test.ts +10 -2
- package/src/shared/rpc-client.test.ts +54 -3
- package/src/shared/rpc-client.ts +19 -9
- package/src/shared/rpc-notifications.test.ts +54 -1
- package/src/shared/rpc-notifications.ts +82 -13
- package/src/shared/rpc-server.ts +33 -4
- package/src/shared/rpc-types.ts +30 -2
- package/src/shared/rpc-utils.ts +10 -0
- package/src/shared/sqlite-helpers.ts +9 -9
- package/src/shared/sqlite.ts +99 -80
- package/src/shared/tag-transcript.test.ts +280 -0
- package/src/shared/tag-transcript.ts +162 -33
- package/src/shared/tui-config.ts +2 -2
- package/src/tui/data/context-db.ts +75 -11
- package/src/tui/index.tsx +227 -36
- package/src/tui/slots/sidebar-content.tsx +368 -36
- package/dist/hooks/auto-update-checker/cache.d.ts +0 -23
- package/dist/hooks/auto-update-checker/cache.d.ts.map +0 -1
- package/dist/hooks/auto-update-checker/checker.d.ts +0 -13
- package/dist/hooks/auto-update-checker/checker.d.ts.map +0 -1
- package/dist/hooks/auto-update-checker/constants.d.ts +0 -10
- package/dist/hooks/auto-update-checker/constants.d.ts.map +0 -1
- package/dist/hooks/auto-update-checker/index.d.ts +0 -40
- package/dist/hooks/auto-update-checker/index.d.ts.map +0 -1
- package/dist/hooks/auto-update-checker/types.d.ts +0 -50
- package/dist/hooks/auto-update-checker/types.d.ts.map +0 -1
- package/dist/hooks/magic-context/compartment-runner-compressor.d.ts +0 -87
- package/dist/hooks/magic-context/compartment-runner-compressor.d.ts.map +0 -1
- package/dist/shared/native-binding.d.ts +0 -87
- package/dist/shared/native-binding.d.ts.map +0 -1
- package/src/shared/native-binding.ts +0 -311
|
@@ -21,6 +21,19 @@ export declare function cleanupConflictWarnings(client: unknown, directory: stri
|
|
|
21
21
|
* Sends an ignored message that auto-deletes after 1 second.
|
|
22
22
|
*/
|
|
23
23
|
export declare function sendTuiSetupNotification(client: unknown, directory: string, serverUrl?: string): Promise<void>;
|
|
24
|
+
/**
|
|
25
|
+
* Desktop schema-fence warning. When OpenCode and Pi share context.db and one
|
|
26
|
+
* harness auto-updates first, it migrates the DB to a newer schema; the lagging
|
|
27
|
+
* harness then fail-closes and disables ALL of Magic Context. Previously this
|
|
28
|
+
* was log-only, so the user just saw the plugin silently stop working. Surface
|
|
29
|
+
* a clear ignored message telling them what happened and how to fix it. No
|
|
30
|
+
* auto-remove: this is a real blocking state the user must act on (update the
|
|
31
|
+
* lagging harness), unlike the transient TUI-setup notice.
|
|
32
|
+
*/
|
|
33
|
+
export declare function sendSchemaFenceWarning(client: unknown, directory: string, detail: {
|
|
34
|
+
persistedVersion: number;
|
|
35
|
+
supportedVersion: number;
|
|
36
|
+
}): Promise<void>;
|
|
24
37
|
/**
|
|
25
38
|
* Desktop startup announcement: post a one-shot ignored message describing
|
|
26
39
|
* what's new in this release. Mirrors the TUI's RPC-driven dialog path so both
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conflict-warning-hook.d.ts","sourceRoot":"","sources":["../../src/plugin/conflict-warning-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"conflict-warning-hook.d.ts","sourceRoot":"","sources":["../../src/plugin/conflict-warning-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAqLlE;;GAEG;AACH,wBAAsB,mBAAmB,CACrC,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,cAAc,GAC/B,OAAO,CAAC,IAAI,CAAC,CA+Cf;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CACzC,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAqHf;AAkCD;;;GAGG;AACH,wBAAsB,wBAAwB,CAC1C,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAkEf;AAED;;;;;;;;GAQG;AACH,wBAAsB,sBAAsB,CACxC,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE;IAAE,gBAAgB,EAAE,MAAM,CAAC;IAAC,gBAAgB,EAAE,MAAM,CAAA;CAAE,GAC/D,OAAO,CAAC,IAAI,CAAC,CAkCf;AAED;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CACzC,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,EAC/B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GACpC,OAAO,CAAC,IAAI,CAAC,CA8Df"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dream-timer.d.ts","sourceRoot":"","sources":["../../src/plugin/dream-timer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,a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AC;IAC9B,wBAAwB,CAAC,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5E,uBAAuB,CAAC,EAAE;QACtB,OAAO,EAAE,OAAO,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,iBAAiB,CAAC,EAAE;QAChB,OAAO,EAAE,OAAO,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE;AA2BD;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CACzC,IAAI,EAAE,mBAAmB,GAC1B,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC,CA6DnC"}
|
package/dist/plugin/event.d.ts
CHANGED
|
@@ -4,9 +4,16 @@ export declare function createEventHandler(args: {
|
|
|
4
4
|
event: import("@opencode-ai/sdk").Event;
|
|
5
5
|
}) => Promise<void>;
|
|
6
6
|
} | null;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Orderly cleanup for THIS plugin instance when OpenCode disposes it. Fires
|
|
9
|
+
* on the SDK `server.instance.disposed` event; the callback receives the
|
|
10
|
+
* disposed instance's `directory` so the caller can match it against its own
|
|
11
|
+
* `ctx.directory` (OpenCode Desktop runs multiple instances in one process,
|
|
12
|
+
* each disposed independently, so a dispose for a different directory must
|
|
13
|
+
* not tear down this instance's resources). Best-effort: failures are
|
|
14
|
+
* swallowed so a cleanup error never propagates into OpenCode's event loop.
|
|
15
|
+
*/
|
|
16
|
+
onInstanceDisposed?: (directory: string) => void | Promise<void>;
|
|
10
17
|
}): (input: {
|
|
11
18
|
event: import("@opencode-ai/sdk").Event;
|
|
12
19
|
}) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/plugin/event.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,YAAY,EAAE;QACV,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE;YAAE,KAAK,EAAE,OAAO,kBAAkB,EAAE,KAAK,CAAA;SAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KACjF,GAAG,IAAI,CAAC;IACT,
|
|
1
|
+
{"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../../src/plugin/event.ts"],"names":[],"mappings":"AAAA,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,YAAY,EAAE;QACV,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE;YAAE,KAAK,EAAE,OAAO,kBAAkB,EAAE,KAAK,CAAA;SAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;KACjF,GAAG,IAAI,CAAC;IACT;;;;;;;;OAQG;IACH,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpE,GAAG,CAAC,KAAK,EAAE;IAAE,KAAK,EAAE,OAAO,kBAAkB,EAAE,KAAK,CAAA;CAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAexE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-session-hooks.d.ts","sourceRoot":"","sources":["../../../src/plugin/hooks/create-session-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAU7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,aAAa,CAAC;IACnB,YAAY,EAAE,wBAAwB,CAAC;IACvC,gBAAgB,EAAE,gBAAgB,CAAC;CACtC;;;;;;
|
|
1
|
+
{"version":3,"file":"create-session-hooks.d.ts","sourceRoot":"","sources":["../../../src/plugin/hooks/create-session-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAU7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,aAAa,CAAC;IACnB,YAAY,EAAE,wBAAwB,CAAC;IACvC,gBAAgB,EAAE,gBAAgB,CAAC;CACtC;;;;;;qBAwD25F,CAAC;;;;;;;;;;;;qBAA+f,CAAC;mBAAyB,CAAC;iBAAuB,CAAC;iBAAuB,CAAC;0BAAc,CAAC;uBAAiB,CAAC;;;;;;0BAAwl0B,CAAC;;;;;;EADhm7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages-transform.d.ts","sourceRoot":"","sources":["../../src/plugin/messages-transform.ts"],"names":[],"mappings":"AAWA,KAAK,gBAAgB,GAAG;IACpB,IAAI,EAAE,OAAO,kBAAkB,EAAE,OAAO,CAAC;IACzC,KAAK,EAAE,OAAO,kBAAkB,EAAE,IAAI,EAAE,CAAC;CAC5C,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAA;CAAE,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE;IACjD,YAAY,EAAE;QACV,sCAAsC,CAAC,EAAE,CACrC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAC5B,MAAM,EAAE,uBAAuB,KAC9B,OAAO,CAAC,IAAI,CAAC,CAAC;KACtB,GAAG,IAAI,CAAC;CACZ,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,uBAAuB,KAAK,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"messages-transform.d.ts","sourceRoot":"","sources":["../../src/plugin/messages-transform.ts"],"names":[],"mappings":"AAWA,KAAK,gBAAgB,GAAG;IACpB,IAAI,EAAE,OAAO,kBAAkB,EAAE,OAAO,CAAC;IACzC,KAAK,EAAE,OAAO,kBAAkB,EAAE,IAAI,EAAE,CAAC;CAC5C,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAA;CAAE,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE;IACjD,YAAY,EAAE;QACV,sCAAsC,CAAC,EAAE,CACrC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAC5B,MAAM,EAAE,uBAAuB,KAC9B,OAAO,CAAC,IAAI,CAAC,CAAC;KACtB,GAAG,IAAI,CAAC;CACZ,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,uBAAuB,KAAK,OAAO,CAAC,IAAI,CAAC,CAoDnF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-handlers.d.ts","sourceRoot":"","sources":["../../src/plugin/rpc-handlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"rpc-handlers.d.ts","sourceRoot":"","sources":["../../src/plugin/rpc-handlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,kBAAkB,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E,wBAAwB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"tool-registry.d.ts","sourceRoot":"","sources":["../../src/plugin/tool-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAiB1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,aAAa,CAAC;IACnB,YAAY,EAAE,wBAAwB,CAAC;CAC1C,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CA6EjC"}
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
* Bump only when there are user-visible changes worth a startup dialog.
|
|
19
19
|
* Does NOT need to match the published package version.
|
|
20
20
|
*/
|
|
21
|
-
export declare const ANNOUNCEMENT_VERSION = "0.
|
|
21
|
+
export declare const ANNOUNCEMENT_VERSION = "0.22.0";
|
|
22
22
|
/**
|
|
23
23
|
* Short, user-facing bullet strings. Keep each line ~80 chars or shorter so the
|
|
24
24
|
* TUI dialog renders cleanly without horizontal scroll on a typical terminal.
|
|
@@ -50,6 +50,22 @@ export declare function markAnnouncementSeen(version: string): void;
|
|
|
50
50
|
* True when the configured `ANNOUNCEMENT_VERSION` has not yet been dismissed
|
|
51
51
|
* AND there is at least one feature to show. Used by both the TUI dialog path
|
|
52
52
|
* and the Desktop ignored-message fallback.
|
|
53
|
+
*
|
|
54
|
+
* First-run / sandbox handling: when NO state file exists yet, we seed it to the
|
|
55
|
+
* current `ANNOUNCEMENT_VERSION` and return false instead of announcing. This
|
|
56
|
+
* covers two cases that previously spammed the dialog (issue #99):
|
|
57
|
+
* - Fresh installs: a brand-new user shouldn't be shown a changelog of release
|
|
58
|
+
* bullets they have no context for — they need onboarding, not patch notes.
|
|
59
|
+
* - Ephemeral/sandbox environments (Docker, CI, disposable dev containers)
|
|
60
|
+
* where the storage dir is wiped between launches: without the seed, the
|
|
61
|
+
* missing file made the announcement re-show on every single startup.
|
|
62
|
+
* Real upgrades still announce exactly once: an existing user already has a
|
|
63
|
+
* state file at the prior version, so the version mismatch shows the dialog and
|
|
64
|
+
* dismissing it advances the file to the current version.
|
|
65
|
+
*
|
|
66
|
+
* The seed is a deliberate write side-effect on the "no file" branch — folding
|
|
67
|
+
* it here (rather than a separate startup call) makes every caller path (plugin
|
|
68
|
+
* startup, Pi startup, TUI rpc pull) consistent with no ordering dependency.
|
|
53
69
|
*/
|
|
54
70
|
export declare function shouldShowAnnouncement(): boolean;
|
|
55
71
|
//# sourceMappingURL=announcement.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"announcement.d.ts","sourceRoot":"","sources":["../../src/shared/announcement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH;;;GAGG;AACH,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"announcement.d.ts","sourceRoot":"","sources":["../../src/shared/announcement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH;;;GAGG;AACH,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC,MAAM,CAMvD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,qDAAqD,CAAC;AAQtF;;;;;;GAMG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAQjD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAS1D;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAUhD"}
|
|
@@ -47,21 +47,18 @@ export declare function getMagicContextHistorianDir(harness?: HarnessId): string
|
|
|
47
47
|
/**
|
|
48
48
|
* Project-local magic-context artifact directory.
|
|
49
49
|
*
|
|
50
|
-
* Layout: `<project-directory>/.
|
|
50
|
+
* Layout: `<project-directory>/.magic-context/`
|
|
51
51
|
*
|
|
52
52
|
* Used for artifacts that the historian/recomp pipeline writes during a run
|
|
53
53
|
* and that the model is asked to read via its native Read tool. OpenCode's
|
|
54
54
|
* `external_directory` permission system asks the user before reading any
|
|
55
55
|
* file outside the project directory or its worktree, which interrupts every
|
|
56
56
|
* historian run when artifacts live under `os.tmpdir()`. Writing under the
|
|
57
|
-
* project's own `.
|
|
58
|
-
* never triggers a permission prompt.
|
|
57
|
+
* project's own `.magic-context/` subtree falls inside the project boundary
|
|
58
|
+
* and never triggers a permission prompt.
|
|
59
59
|
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
* magic-context artifacts under `.opencode/magic-context/` keeps them
|
|
63
|
-
* co-located with related OpenCode metadata and makes them easy for users to
|
|
64
|
-
* locate when debugging.
|
|
60
|
+
* Using a harness-agnostic name (`/.magic-context/` rather than
|
|
61
|
+
* `/.opencode/`) ensures the same path works for both OpenCode and Pi.
|
|
65
62
|
*
|
|
66
63
|
* Logger does NOT use this — log files stay in the per-harness tmp subtree
|
|
67
64
|
* because they are written by the plugin process itself (no model-side Read
|
|
@@ -71,7 +68,7 @@ export declare function getProjectMagicContextDir(directory: string): string;
|
|
|
71
68
|
/**
|
|
72
69
|
* Project-local historian artifact directory.
|
|
73
70
|
*
|
|
74
|
-
* Layout: `<project-directory>/.
|
|
71
|
+
* Layout: `<project-directory>/.magic-context/historian/`
|
|
75
72
|
*
|
|
76
73
|
* Used for:
|
|
77
74
|
* - existing-state offload XMLs that long historian/recomp passes write
|
|
@@ -79,8 +76,9 @@ export declare function getProjectMagicContextDir(directory: string): string;
|
|
|
79
76
|
* - validation-failure dump XMLs preserved for debugging
|
|
80
77
|
*
|
|
81
78
|
* Callers must `mkdirSync(dir, { recursive: true })` before writing — the
|
|
82
|
-
* `.
|
|
83
|
-
* here must degrade gracefully (e.g. historian falls back to inline
|
|
79
|
+
* `.magic-context/` parent may not exist on a fresh project, and write
|
|
80
|
+
* failures here must degrade gracefully (e.g. historian falls back to inline
|
|
81
|
+
* state).
|
|
84
82
|
*/
|
|
85
83
|
export declare function getProjectMagicContextHistorianDir(directory: string): string;
|
|
86
84
|
export declare function getOpenCodeStorageDir(): string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"data-path.d.ts","sourceRoot":"","sources":["../../src/shared/data-path.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAEvD,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,SAAwB,GAAG,MAAM,CAEhF;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,SAAwB,GAAG,MAAM,CAEhF;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,GAAE,SAAwB,GAAG,MAAM,CAErF;AAED
|
|
1
|
+
{"version":3,"file":"data-path.d.ts","sourceRoot":"","sources":["../../src/shared/data-path.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,KAAK,SAAS,EAAE,MAAM,WAAW,CAAC;AAEvD,wBAAgB,UAAU,IAAI,MAAM,CAEnC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,SAAwB,GAAG,MAAM,CAEhF;AAED;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,OAAO,GAAE,SAAwB,GAAG,MAAM,CAEhF;AAED;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,GAAE,SAAwB,GAAG,MAAM,CAErF;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kCAAkC,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE5E;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAElD;AAED;;;;;;GAMG;AACH,wBAAgB,uCAAuC,IAAI,MAAM,CAEhE;AAED;;;;;;;;;GASG;AACH,wBAAgB,WAAW,IAAI,MAAM,CAEpC;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models-dev-cache.d.ts","sourceRoot":"","sources":["../../src/shared/models-dev-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAUH,UAAU,kBAAkB;IACxB,MAAM,EAAE;QACJ,SAAS,EAAE,MAAM,OAAO,CAAC;YAAE,IAAI,CAAC,EAAE;gBAAE,SAAS,CAAC,EAAE,OAAO,CAAA;aAAE,CAAA;SAAE,CAAC,CAAC;KAChE,CAAC;CACL;AA+LD;;;;;;;;;;GAUG;AACH,wBAAsB,yBAAyB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkDzF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"models-dev-cache.d.ts","sourceRoot":"","sources":["../../src/shared/models-dev-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAUH,UAAU,kBAAkB;IACxB,MAAM,EAAE;QACJ,SAAS,EAAE,MAAM,OAAO,CAAC;YAAE,IAAI,CAAC,EAAE;gBAAE,SAAS,CAAC,EAAE,OAAO,CAAA;aAAE,CAAA;SAAE,CAAC,CAAC;KAChE,CAAC;CACL;AA+LD;;;;;;;;;;GAUG;AACH,wBAAsB,yBAAyB,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAkDzF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAqBhG;AAkCD,4CAA4C;AAC5C,wBAAgB,mBAAmB,IAAI,IAAI,CAK1C;AAED,oDAAoD;AACpD,wBAAgB,sBAAsB,IAAI;IACtC,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACrB,CAOA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-client.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-client.ts"],"names":[],"mappings":"AAiBA,qBAAa,qBAAqB;IAC9B,OAAO,CAAC,IAAI,CAAuB;IACnC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,aAAa,CAAS;gBAElB,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAKjD,iFAAiF;IAC3E,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACrC,OAAO,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"rpc-client.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-client.ts"],"names":[],"mappings":"AAiBA,qBAAa,qBAAqB;IAC9B,OAAO,CAAC,IAAI,CAAuB;IACnC,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,aAAa,CAAS;gBAElB,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAKjD,iFAAiF;IAC3E,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACrC,OAAO,CAAC,CAAC,CAAC;IAwDb,4CAA4C;IACtC,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;YASvB,WAAW;IAmCzB,OAAO,CAAC,YAAY;YA4BN,WAAW;YAWX,gBAAgB;IAU9B,KAAK,IAAI,IAAI;CAKhB"}
|
|
@@ -15,10 +15,32 @@ export interface RpcNotification {
|
|
|
15
15
|
/** Push a notification for TUI to pick up via polling. */
|
|
16
16
|
export declare function pushNotification(type: string, payload: Record<string, unknown>, sessionId?: string): void;
|
|
17
17
|
/** Return pending notifications after acking the client's last received id.
|
|
18
|
-
* Updates lastDrainAt so isTuiConnected() reflects recent activity.
|
|
19
|
-
|
|
18
|
+
* Updates lastDrainAt so isTuiConnected() reflects recent activity.
|
|
19
|
+
*
|
|
20
|
+
* Session scoping: when `sessionId` is provided, only notifications tagged for
|
|
21
|
+
* that session (or session-less/global ones) are returned and pruned — a
|
|
22
|
+
* notification tagged for a DIFFERENT session is never handed to this client
|
|
23
|
+
* and is never pruned by this client's ack. This matters because the in-memory
|
|
24
|
+
* queue is per-process but a TUI can end up draining a process that also serves
|
|
25
|
+
* OTHER sessions: e.g. opening OpenCode Desktop on the same project starts a
|
|
26
|
+
* newer RPC server that the TUI's port discovery (newest-pid-wins) then selects,
|
|
27
|
+
* so a Desktop-session upgrade-dialog action would otherwise surface in an
|
|
28
|
+
* unrelated TUI session. Each client also tracks its own `lastReceivedId`, so a
|
|
29
|
+
* global watermark prune would let session A's ack drop session B's still-unseen
|
|
30
|
+
* notification — scoping the prune to the acking session prevents that too.
|
|
31
|
+
*
|
|
32
|
+
* Delivery is at-least-once (non-destructive return + prune-on-ack): a returned
|
|
33
|
+
* notification stays queued until a later call acks it via a higher
|
|
34
|
+
* `lastReceivedId`, so a lost poll response re-delivers on the next poll. */
|
|
35
|
+
export declare function drainNotifications(lastReceivedId?: number, sessionId?: string): RpcNotification[];
|
|
20
36
|
/** Whether a TUI client is actively polling for notifications.
|
|
21
|
-
* Returns true only if
|
|
22
|
-
*
|
|
23
|
-
|
|
37
|
+
* Returns true only if a TUI has drained within the last 3 seconds.
|
|
38
|
+
*
|
|
39
|
+
* Pass `sessionId` (preferred) to ask whether a TUI is polling FOR THAT
|
|
40
|
+
* SESSION — this is what producers (`/ctx-status`, `/ctx-recomp`, the upgrade
|
|
41
|
+
* reminder) must use to decide dialog-vs-message, so a TUI on a different
|
|
42
|
+
* session in the same process does not misroute their delivery. Omit it only
|
|
43
|
+
* for legacy/global callers that genuinely have no session context; they fall
|
|
44
|
+
* back to "any session recently drained" (the pre-per-session behavior). */
|
|
45
|
+
export declare function isTuiConnected(sessionId?: string): boolean;
|
|
24
46
|
//# sourceMappingURL=rpc-notifications.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-notifications.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;
|
|
1
|
+
{"version":3,"file":"rpc-notifications.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAsBD,0DAA0D;AAC1D,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,CAAC,EAAE,MAAM,GACnB,IAAI,CAwBN;AAED;;;;;;;;;;;;;;;;;8EAiB8E;AAC9E,wBAAgB,kBAAkB,CAAC,cAAc,SAAI,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,eAAe,EAAE,CAkB5F;AAED;;;;;;;;6EAQ6E;AAC7E,wBAAgB,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAO1D"}
|
|
@@ -6,6 +6,7 @@ export declare class MagicContextRpcServer {
|
|
|
6
6
|
private portFilePath;
|
|
7
7
|
private portDir;
|
|
8
8
|
private startedAt;
|
|
9
|
+
private readonly token;
|
|
9
10
|
constructor(storageDir: string, directory: string);
|
|
10
11
|
/** Register an RPC method handler. */
|
|
11
12
|
handle(method: string, handler: RpcHandler): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-server.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"rpc-server.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-server.ts"],"names":[],"mappings":"AAcA,KAAK,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAExF,qBAAa,qBAAqB;IAC9B,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,IAAI,CAAK;IACjB,OAAO,CAAC,QAAQ,CAAiC;IACjD,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,SAAS,CAAc;IAK/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmC;gBAE7C,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAKjD,sCAAsC;IACtC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,IAAI;IAIjD,6DAA6D;IACvD,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;IA2D9B,OAAO,CAAC,uBAAuB;IAgB/B,8CAA8C;IAC9C,IAAI,IAAI,IAAI;IAYZ,OAAO,CAAC,QAAQ;CA0EnB"}
|
|
@@ -23,10 +23,23 @@ export interface SidebarSnapshot {
|
|
|
23
23
|
compartmentTokens: number;
|
|
24
24
|
factTokens: number;
|
|
25
25
|
memoryTokens: number;
|
|
26
|
+
/**
|
|
27
|
+
* Token estimate of the injected <project-docs> block (root ARCHITECTURE.md
|
|
28
|
+
* + STRUCTURE.md) that lives in m[0] in v2. Part of the message stream, not
|
|
29
|
+
* conversation. Display layer shows this as "Docs".
|
|
30
|
+
*/
|
|
31
|
+
docsTokens: number;
|
|
32
|
+
/**
|
|
33
|
+
* Token estimate of the injected <user-profile> block (promoted user
|
|
34
|
+
* memories) that lives in m[0] in v2. Part of the message stream, not
|
|
35
|
+
* conversation. Display layer shows this as "Profile".
|
|
36
|
+
*/
|
|
37
|
+
profileTokens: number;
|
|
26
38
|
/**
|
|
27
39
|
* Token estimate of real user/assistant discussion (text + reasoning +
|
|
28
|
-
* image parts) inside messages, excluding injected <session-history
|
|
29
|
-
* blocks. Display layer shows this as
|
|
40
|
+
* image parts) inside messages, excluding injected <session-history>,
|
|
41
|
+
* <project-docs>, and <user-profile> blocks. Display layer shows this as
|
|
42
|
+
* "Conversation".
|
|
30
43
|
*/
|
|
31
44
|
conversationTokens: number;
|
|
32
45
|
/**
|
|
@@ -56,6 +69,21 @@ export interface SidebarSnapshot {
|
|
|
56
69
|
executeThreshold: number;
|
|
57
70
|
newWorkTokens?: number | null;
|
|
58
71
|
totalInputTokens?: number | null;
|
|
72
|
+
/**
|
|
73
|
+
* Live recomp / session-upgrade progress for this session, or null when no
|
|
74
|
+
* recomp is running (and no recent terminal state is being shown). Drives the
|
|
75
|
+
* sidebar "Recomp"/"Upgrade" progress bar and the /ctx-status dialog. Mirrors
|
|
76
|
+
* the runtime `RecompProgress` shape from compartment-runner-types.ts.
|
|
77
|
+
*/
|
|
78
|
+
recompProgress?: {
|
|
79
|
+
phase: "recomp" | "migration" | "done" | "failed";
|
|
80
|
+
processedMessages: number;
|
|
81
|
+
totalMessages: number;
|
|
82
|
+
passCount: number;
|
|
83
|
+
compartmentsCreated: number;
|
|
84
|
+
message?: string;
|
|
85
|
+
note?: string;
|
|
86
|
+
} | null;
|
|
59
87
|
}
|
|
60
88
|
export interface StatusDetail extends SidebarSnapshot {
|
|
61
89
|
tagCounter: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-types.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,eAAe;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CA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;IACnB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,OAAO,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,oBAAoB,EAAE,YAAY,GAAG,QAAQ,CAAC;IAC9C;;;OAGG;IACH,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,aAAa,EAAE,MAAM,CAAC;IACtB,uBAAuB,EAAE,MAAM,CAAC;IAChC,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED,MAAM,WAAW,sBAAsB;IACnC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -2,6 +2,15 @@ export interface RpcPortFileRecord {
|
|
|
2
2
|
port: number;
|
|
3
3
|
pid: number;
|
|
4
4
|
started_at: number;
|
|
5
|
+
/**
|
|
6
|
+
* Per-process bearer token. The server requires it on all non-health RPC
|
|
7
|
+
* calls so a random local process or browser-origin script that merely
|
|
8
|
+
* discovers/guesses the port cannot drive side-effecting endpoints
|
|
9
|
+
* (recomp/upgrade/dismiss). Optional in the type for forward/backward
|
|
10
|
+
* compatibility with port files written by older builds (treated as "no
|
|
11
|
+
* auth required" only when the server itself didn't set one).
|
|
12
|
+
*/
|
|
13
|
+
token?: string;
|
|
5
14
|
}
|
|
6
15
|
/**
|
|
7
16
|
* Stable hash for a project directory — scopes RPC port files per-project
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rpc-utils.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-utils.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"rpc-utils.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-utils.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED,0EAA0E;AAC1E,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAExE;AAED,sCAAsC;AACtC,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,SAAc,GAAG,MAAM,CAEhG;AAED,2DAA2D;AAC3D,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEnF;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAQ/C;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,SAAI,GAAG,iBAAiB,GAAG,IAAI,CAyB3F"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Cross-runtime helpers that smooth over the small bun:sqlite ↔
|
|
3
|
-
* API differences without leaking either
|
|
2
|
+
* Cross-runtime helpers that smooth over the small bun:sqlite ↔ node:sqlite
|
|
3
|
+
* API differences without leaking either backend into call sites.
|
|
4
4
|
*/
|
|
5
5
|
import type { Database } from "./sqlite";
|
|
6
6
|
/**
|
|
7
7
|
* Close a database, ignoring errors.
|
|
8
8
|
*
|
|
9
|
-
* bun:sqlite supports `db.close(throwOnError = false)`.
|
|
10
|
-
*
|
|
11
|
-
* mirrors the bun "swallow errors" semantics for both
|
|
12
|
-
* test teardown and `finally` blocks where the caller
|
|
13
|
-
* the close succeeded.
|
|
9
|
+
* bun:sqlite supports `db.close(throwOnError = false)`. node:sqlite has only
|
|
10
|
+
* `db.close()` and throws ("database is not open") on an already-closed
|
|
11
|
+
* handle. This helper mirrors the bun "swallow errors" semantics for both
|
|
12
|
+
* runtimes — useful in test teardown and `finally` blocks where the caller
|
|
13
|
+
* doesn't care whether the close succeeded.
|
|
14
14
|
*/
|
|
15
15
|
export declare function closeQuietly(db: Database | null | undefined): void;
|
|
16
16
|
//# sourceMappingURL=sqlite-helpers.d.ts.map
|
package/dist/shared/sqlite.d.ts
CHANGED
|
@@ -3,27 +3,36 @@
|
|
|
3
3
|
*
|
|
4
4
|
* The same shipped plugin artifact must run under two different runtimes:
|
|
5
5
|
* - Bun (current OpenCode releases) → uses `bun:sqlite` (built-in, fast)
|
|
6
|
-
* - Node
|
|
6
|
+
* - Node / Electron (Pi plugin, OpenCode Desktop) → uses `node:sqlite`
|
|
7
|
+
* (`DatabaseSync`, built into Node 22.5+ / Electron 41+, stable-enough and
|
|
8
|
+
* flag-free since Node 22.13/23.4).
|
|
7
9
|
*
|
|
8
|
-
* Bun
|
|
9
|
-
*
|
|
10
|
-
*
|
|
10
|
+
* Bun has no `node:sqlite`, and Node/Electron have no `bun:sqlite`. Static
|
|
11
|
+
* imports of either would crash at parse time in the wrong runtime, so we use
|
|
12
|
+
* dynamic imports gated by runtime detection.
|
|
11
13
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
14
|
+
* Why `node:sqlite` instead of `better-sqlite3`: better-sqlite3 is a native
|
|
15
|
+
* module requiring per-ABI prebuilds, and Electron's ABI never matches the npm
|
|
16
|
+
* Node prebuild — which forced a runtime download of an Electron-matched
|
|
17
|
+
* `.node` binary (a supply-chain + maintenance liability). `node:sqlite` is
|
|
18
|
+
* built into the runtime, so there is NOTHING to download or rebuild. Both Pi
|
|
19
|
+
* (plain Node 24) and OpenCode Desktop (Electron 41 → Node 24.14.1) ship it.
|
|
16
20
|
*
|
|
17
|
-
*
|
|
18
|
-
* - new Database(path, { readonly?: boolean })
|
|
21
|
+
* API surface we use (common across both backends, modulo the shims below):
|
|
22
|
+
* - new Database(path, { readonly?: boolean }) ← we map readonly→readOnly
|
|
19
23
|
* - db.prepare(sql).run/get/all
|
|
20
24
|
* - db.exec(multistatement)
|
|
21
|
-
* - db.transaction(fn) → wrapped function
|
|
25
|
+
* - db.transaction(fn) → wrapped function ← shimmed for node:sqlite
|
|
22
26
|
* - db.close()
|
|
23
27
|
*
|
|
24
|
-
* The
|
|
25
|
-
*
|
|
26
|
-
*
|
|
28
|
+
* The two backend differences we bridge for node:sqlite:
|
|
29
|
+
* 1. node:sqlite has no `db.transaction(fn)` helper — we add a savepoint-aware
|
|
30
|
+
* shim (below) that matches better-sqlite3/bun semantics.
|
|
31
|
+
* 2. node:sqlite's constructor option is `readOnly` (camel-case), not
|
|
32
|
+
* better-sqlite3/bun's `readonly` — we translate it so call sites are
|
|
33
|
+
* unchanged.
|
|
34
|
+
* Everything else (named params with bare keys, ATTACH under defensive mode,
|
|
35
|
+
* `run()` → {changes,lastInsertRowid}) is identical and was verified directly.
|
|
27
36
|
*/
|
|
28
37
|
import type BetterSqlite3 from "better-sqlite3";
|
|
29
38
|
export declare const Database: typeof BetterSqlite3;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/shared/sqlite.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/shared/sqlite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAMH,OAAO,KAAK,aAAa,MAAM,gBAAgB,CAAC;AAgGhD,eAAO,MAAM,QAAQ,EAAE,OAAO,aAA4B,CAAC;AAE3D,+DAA+D;AAC/D,MAAM,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC;AAE9C;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
* - Tag prefix primitives (`prependTag`, `stripTagPrefix`, `byteSize`).
|
|
46
46
|
*/
|
|
47
47
|
import type { ContextDatabase } from "../features/magic-context/storage";
|
|
48
|
-
import type
|
|
48
|
+
import { type Tagger } from "../features/magic-context/tagger";
|
|
49
49
|
import type { TagTarget } from "../hooks/magic-context/tag-messages";
|
|
50
50
|
import type { Transcript } from "./transcript";
|
|
51
51
|
export interface TagTranscriptOptions {
|
|
@@ -58,6 +58,15 @@ export interface TagTranscriptOptions {
|
|
|
58
58
|
* consistent across passes.
|
|
59
59
|
*/
|
|
60
60
|
skipPrefixInjection?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Pi-only: map of messageId → raw-message fingerprint. When a NEW message
|
|
63
|
+
* text tag is created, its fingerprint is persisted on the tag row so a
|
|
64
|
+
* later pass can adopt the fallback-id tag onto the real SessionEntry id
|
|
65
|
+
* (keeping tag_number/§N§ stable). OpenCode omits this → tags store NULL
|
|
66
|
+
* → adoption never fires. Keyed by the bare messageId (not the `:pN`
|
|
67
|
+
* contentId) since all parts of a message share one fingerprint.
|
|
68
|
+
*/
|
|
69
|
+
entryFingerprintByMessageId?: ReadonlyMap<string, string>;
|
|
61
70
|
}
|
|
62
71
|
export interface TagTranscriptResult {
|
|
63
72
|
targets: Map<number, TagTarget>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag-transcript.d.ts","sourceRoot":"","sources":["../../src/shared/tag-transcript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAGzE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"tag-transcript.d.ts","sourceRoot":"","sources":["../../src/shared/tag-transcript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mCAAmC,CAAC;AAGzE,OAAO,EAAwB,KAAK,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAMrF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,cAAc,CAAC;AAE/D,MAAM,WAAW,oBAAoB;IACjC;;;;;;;OAOG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;;;;OAOG;IACH,2BAA2B,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7D;AAED,MAAM,WAAW,mBAAmB;IAChC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACnC;AAyDD,wBAAgB,aAAa,CACzB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,eAAe,EACnB,OAAO,GAAE,oBAAyB,GACnC,mBAAmB,CA8MrB"}
|
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import { type ToolDefinition } from "@opencode-ai/plugin";
|
|
2
|
-
|
|
2
|
+
import type { ContextDatabase } from "../../features/magic-context/storage";
|
|
3
|
+
export interface CtxExpandToolDeps {
|
|
4
|
+
db: ContextDatabase;
|
|
5
|
+
}
|
|
6
|
+
export declare function createCtxExpandTools(deps: CtxExpandToolDeps): Record<string, ToolDefinition>;
|
|
3
7
|
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -1 +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;
|
|
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;AAEhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAK5E,MAAM,WAAW,iBAAiB;IAC9B,EAAE,EAAE,eAAe,CAAC;CACvB;AA8DD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAI5F"}
|
|
@@ -1 +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;
|
|
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;AA4BhE,OAAO,EAIH,KAAK,iBAAiB,EACzB,MAAM,SAAS,CAAC;AAyjBjB,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAI5F"}
|
|
@@ -2,6 +2,7 @@ import type { SidebarSnapshot, StatusDetail } from "../../shared/rpc-types";
|
|
|
2
2
|
export type { SidebarSnapshot, StatusDetail };
|
|
3
3
|
/** Initialize the RPC client. Call once on TUI startup. */
|
|
4
4
|
export declare function initRpcClient(directory: string): void;
|
|
5
|
+
export declare function getRpcGeneration(): number;
|
|
5
6
|
/** Clean up the RPC client. */
|
|
6
7
|
export declare function closeRpc(): void;
|
|
7
8
|
/** Fetch sidebar snapshot from the server via RPC. */
|
|
@@ -12,7 +13,15 @@ export declare function loadStatusDetail(sessionId: string, directory: string, m
|
|
|
12
13
|
export declare function getCompartmentCount(sessionId: string): Promise<number>;
|
|
13
14
|
/** Send recomp request to server via RPC. */
|
|
14
15
|
export declare function requestRecomp(sessionId: string): Promise<boolean>;
|
|
16
|
+
/** Run `/ctx-session-upgrade` for the session (full recomp + once-per-project
|
|
17
|
+
* memory migration). Fired from the upgrade dialog's "Run upgrade now" action. */
|
|
18
|
+
export declare function requestUpgrade(sessionId: string): Promise<boolean>;
|
|
19
|
+
/** Mark the upgrade reminder dismissed (the user made an explicit Confirm/Cancel
|
|
20
|
+
* choice), setting the durable stamp so the FRESH dialog won't re-show. Resume
|
|
21
|
+
* prompts are staging-driven and unaffected. */
|
|
22
|
+
export declare function dismissUpgradeReminder(sessionId: string): Promise<boolean>;
|
|
15
23
|
export interface TuiMessage {
|
|
24
|
+
id: number;
|
|
16
25
|
type: string;
|
|
17
26
|
payload: Record<string, unknown>;
|
|
18
27
|
sessionId?: string;
|
|
@@ -32,5 +41,11 @@ export declare function getAnnouncement(): Promise<AnnouncementResponse>;
|
|
|
32
41
|
/** Mark the current ANNOUNCEMENT_VERSION as dismissed on the server. */
|
|
33
42
|
export declare function markAnnounced(): Promise<boolean>;
|
|
34
43
|
/** Poll for pending server→TUI notifications via RPC. */
|
|
35
|
-
export declare function consumeTuiMessages(): Promise<TuiMessage[]>;
|
|
44
|
+
export declare function consumeTuiMessages(sessionId: string): Promise<TuiMessage[]>;
|
|
45
|
+
/**
|
|
46
|
+
* Advance the delivered-message cursor for one active TUI session.
|
|
47
|
+
* Callers must pass only the contiguous handled prefix of the drained batch;
|
|
48
|
+
* this helper remains empty-safe and monotonic for that prefix.
|
|
49
|
+
*/
|
|
50
|
+
export declare function markTuiMessagesHandled(sessionId: string, messages: TuiMessage[]): void;
|
|
36
51
|
//# sourceMappingURL=context-db.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-db.d.ts","sourceRoot":"","sources":["../../../src/tui/data/context-db.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAA0B,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEpG,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"context-db.d.ts","sourceRoot":"","sources":["../../../src/tui/data/context-db.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAA0B,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEpG,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC;AAe9C,2DAA2D;AAC3D,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAOrD;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,+BAA+B;AAC/B,wBAAgB,QAAQ,IAAI,IAAI,CAO/B;AA4FD,sDAAsD;AACtD,wBAAsB,mBAAmB,CACrC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAClB,OAAO,CAAC,eAAe,CAAC,CA4B1B;AAED,wDAAwD;AACxD,wBAAsB,gBAAgB,CAClC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,YAAY,CAAC,CA4CvB;AAED,qCAAqC;AACrC,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ5E;AAED,6CAA6C;AAC7C,wBAAsB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQvE;AAED;mFACmF;AACnF,wBAAsB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAQxE;AAED;;iDAEiD;AACjD,wBAAsB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAUhF;AAED,MAAM,WAAW,UAAU;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAsB,eAAe,IAAI,OAAO,CAAC,oBAAoB,CAAC,CAkBrE;AAED,wEAAwE;AACxE,wBAAsB,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC,CAQtD;AAED,yDAAyD;AACzD,wBAAsB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAyBjF;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,IAAI,CAWtF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wolfx/opencode-magic-context",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.1-patch.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenCode plugin for Magic Context — cross-session memory and context management",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -48,14 +48,13 @@
|
|
|
48
48
|
"@opencode-ai/plugin": "^1.14.39",
|
|
49
49
|
"@opencode-ai/sdk": "^1.14.39",
|
|
50
50
|
"ai-tokenizer": "^1.0.6",
|
|
51
|
-
"better-sqlite3": "^12.9.0",
|
|
52
51
|
"comment-json": "^4.2.5",
|
|
53
52
|
"nanotar": "^0.3.0",
|
|
54
53
|
"zod": "^4.1.8"
|
|
55
54
|
},
|
|
56
55
|
"devDependencies": {
|
|
57
56
|
"@biomejs/biome": "^2.4.7",
|
|
58
|
-
"
|
|
57
|
+
"better-sqlite3": "^12.9.0",
|
|
59
58
|
"@types/node": "^22.0.0",
|
|
60
59
|
"bun-types": "^1.3.10",
|
|
61
60
|
"typescript": "^5.8.0"
|