@cortexkit/opencode-magic-context 0.31.5 → 0.32.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.
Files changed (144) hide show
  1. package/README.md +3 -3
  2. package/dist/agents/magic-context-prompt.d.ts.map +1 -1
  3. package/dist/config/project-security.d.ts +2 -0
  4. package/dist/config/project-security.d.ts.map +1 -1
  5. package/dist/config/schema/magic-context.d.ts +9 -0
  6. package/dist/config/schema/magic-context.d.ts.map +1 -1
  7. package/dist/features/magic-context/dreamer/cron.d.ts +2 -2
  8. package/dist/features/magic-context/dreamer/cron.d.ts.map +1 -1
  9. package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts.map +1 -1
  10. package/dist/features/magic-context/message-index-async.d.ts +6 -2
  11. package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
  12. package/dist/features/magic-context/message-index.d.ts +7 -4
  13. package/dist/features/magic-context/message-index.d.ts.map +1 -1
  14. package/dist/features/magic-context/migrations.d.ts +8 -16
  15. package/dist/features/magic-context/migrations.d.ts.map +1 -1
  16. package/dist/features/magic-context/plugin-messages.d.ts.map +1 -1
  17. package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
  18. package/dist/features/magic-context/session-project-backfill.d.ts +6 -3
  19. package/dist/features/magic-context/session-project-backfill.d.ts.map +1 -1
  20. package/dist/features/magic-context/session-project-storage.d.ts.map +1 -1
  21. package/dist/features/magic-context/smart-notes/capabilities.d.ts.map +1 -1
  22. package/dist/features/magic-context/smart-notes/compiler.d.ts +3 -1
  23. package/dist/features/magic-context/smart-notes/compiler.d.ts.map +1 -1
  24. package/dist/features/magic-context/smart-notes/runner.d.ts +1 -0
  25. package/dist/features/magic-context/smart-notes/runner.d.ts.map +1 -1
  26. package/dist/features/magic-context/smart-notes/sandbox-runner.d.ts +8 -1
  27. package/dist/features/magic-context/smart-notes/sandbox-runner.d.ts.map +1 -1
  28. package/dist/features/magic-context/smart-notes/ssrf-guard.d.ts +10 -0
  29. package/dist/features/magic-context/smart-notes/ssrf-guard.d.ts.map +1 -1
  30. package/dist/features/magic-context/smart-notes/storage.d.ts +16 -1
  31. package/dist/features/magic-context/smart-notes/storage.d.ts.map +1 -1
  32. package/dist/features/magic-context/storage-clone.d.ts +34 -0
  33. package/dist/features/magic-context/storage-clone.d.ts.map +1 -0
  34. package/dist/features/magic-context/storage-db.d.ts +1 -1
  35. package/dist/features/magic-context/storage-db.d.ts.map +1 -1
  36. package/dist/features/magic-context/storage-meta-persisted.d.ts +8 -5
  37. package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
  38. package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
  39. package/dist/features/magic-context/storage-schema-helpers.d.ts +3 -4
  40. package/dist/features/magic-context/storage-schema-helpers.d.ts.map +1 -1
  41. package/dist/features/magic-context/storage-tags.d.ts +11 -0
  42. package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
  43. package/dist/features/magic-context/storage.d.ts +2 -1
  44. package/dist/features/magic-context/storage.d.ts.map +1 -1
  45. package/dist/features/magic-context/tagger.d.ts +10 -0
  46. package/dist/features/magic-context/tagger.d.ts.map +1 -1
  47. package/dist/features/magic-context/tool-owner-backfill.d.ts +2 -0
  48. package/dist/features/magic-context/tool-owner-backfill.d.ts.map +1 -1
  49. package/dist/features/magic-context/transform-decision-log.d.ts +1 -1
  50. package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
  51. package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
  52. package/dist/hooks/magic-context/apply-operations.d.ts +24 -0
  53. package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
  54. package/dist/hooks/magic-context/compartment-render-epoch.d.ts +12 -0
  55. package/dist/hooks/magic-context/compartment-render-epoch.d.ts.map +1 -0
  56. package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
  57. package/dist/hooks/magic-context/compartment-trigger.d.ts +7 -1
  58. package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
  59. package/dist/hooks/magic-context/decay-render.d.ts +2 -0
  60. package/dist/hooks/magic-context/decay-render.d.ts.map +1 -1
  61. package/dist/hooks/magic-context/emergency-drop.d.ts +1 -0
  62. package/dist/hooks/magic-context/emergency-drop.d.ts.map +1 -1
  63. package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +29 -0
  64. package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -0
  65. package/dist/hooks/magic-context/heuristic-cleanup.d.ts +1 -0
  66. package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
  67. package/dist/hooks/magic-context/historian-prompt.generated.d.ts +1 -1
  68. package/dist/hooks/magic-context/historian-prompt.generated.d.ts.map +1 -1
  69. package/dist/hooks/magic-context/hook.d.ts +3 -0
  70. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  71. package/dist/hooks/magic-context/inject-compartments.d.ts +8 -9
  72. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
  73. package/dist/hooks/magic-context/m0-token-breakdown.d.ts +5 -4
  74. package/dist/hooks/magic-context/m0-token-breakdown.d.ts.map +1 -1
  75. package/dist/hooks/magic-context/read-session-chunk.d.ts +17 -1
  76. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  77. package/dist/hooks/magic-context/read-session-db.d.ts +2 -2
  78. package/dist/hooks/magic-context/read-session-raw.d.ts +32 -2
  79. package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -1
  80. package/dist/hooks/magic-context/shadow-sender.d.ts +300 -0
  81. package/dist/hooks/magic-context/shadow-sender.d.ts.map +1 -0
  82. package/dist/hooks/magic-context/tag-content-primitives.d.ts.map +1 -1
  83. package/dist/hooks/magic-context/tag-messages.d.ts +8 -0
  84. package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
  85. package/dist/hooks/magic-context/temporal-awareness.d.ts +3 -3
  86. package/dist/hooks/magic-context/transform-operations.d.ts +1 -1
  87. package/dist/hooks/magic-context/transform-operations.d.ts.map +1 -1
  88. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +32 -0
  89. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  90. package/dist/hooks/magic-context/transform.d.ts +4 -1
  91. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  92. package/dist/index.d.ts.map +1 -1
  93. package/dist/index.js +5418 -972
  94. package/dist/plugin/hooks/create-session-hooks.d.ts +48 -175
  95. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  96. package/dist/plugin/rpc-handlers.d.ts +3 -0
  97. package/dist/plugin/rpc-handlers.d.ts.map +1 -1
  98. package/dist/shared/models-dev-cache.d.ts +5 -0
  99. package/dist/shared/models-dev-cache.d.ts.map +1 -1
  100. package/dist/shared/rpc-client.d.ts +3 -1
  101. package/dist/shared/rpc-client.d.ts.map +1 -1
  102. package/dist/shared/rpc-notifications.d.ts +11 -6
  103. package/dist/shared/rpc-notifications.d.ts.map +1 -1
  104. package/dist/shared/rpc-server.d.ts +2 -2
  105. package/dist/shared/rpc-server.d.ts.map +1 -1
  106. package/dist/shared/sqlite.d.ts.map +1 -1
  107. package/dist/shared/tag-transcript.d.ts +18 -0
  108. package/dist/shared/tag-transcript.d.ts.map +1 -1
  109. package/dist/shared/tui-config.d.ts +5 -3
  110. package/dist/shared/tui-config.d.ts.map +1 -1
  111. package/dist/tools/ctx-expand/constants.d.ts +1 -1
  112. package/dist/tools/ctx-expand/constants.d.ts.map +1 -1
  113. package/dist/tui/data/context-db.d.ts +9 -2
  114. package/dist/tui/data/context-db.d.ts.map +1 -1
  115. package/dist/tui/data/notification-socket.d.ts +4 -5
  116. package/dist/tui/data/notification-socket.d.ts.map +1 -1
  117. package/dist/tui-compiled/data/context-db.d.ts +9 -2
  118. package/dist/tui-compiled/data/context-db.d.ts.map +1 -1
  119. package/dist/tui-compiled/data/notification-socket.d.ts +4 -5
  120. package/dist/tui-compiled/data/notification-socket.d.ts.map +1 -1
  121. package/package.json +2 -1
  122. package/src/shared/models-dev-cache.test.ts +5 -0
  123. package/src/shared/models-dev-cache.ts +44 -6
  124. package/src/shared/opencode-compaction-detector.test.ts +11 -2
  125. package/src/shared/rpc-client.test.ts +213 -9
  126. package/src/shared/rpc-client.ts +48 -39
  127. package/src/shared/rpc-notifications.test.ts +26 -5
  128. package/src/shared/rpc-notifications.ts +44 -35
  129. package/src/shared/rpc-server.ts +77 -33
  130. package/src/shared/sqlite.ts +22 -3
  131. package/src/shared/tag-transcript.test.ts +253 -7
  132. package/src/shared/tag-transcript.ts +422 -114
  133. package/src/shared/tui-config.test.ts +4 -12
  134. package/src/shared/tui-config.ts +6 -6
  135. package/src/tui/data/context-db.test.ts +113 -0
  136. package/src/tui/data/context-db.ts +26 -19
  137. package/src/tui/data/notification-socket.test.ts +277 -11
  138. package/src/tui/data/notification-socket.ts +257 -86
  139. package/src/tui/index.tsx +33 -25
  140. package/src/tui/slots/sidebar-content.tsx +62 -24
  141. package/src/tui-compiled/data/context-db.ts +26 -19
  142. package/src/tui-compiled/data/notification-socket.ts +257 -86
  143. package/src/tui-compiled/index.tsx +41 -24
  144. package/src/tui-compiled/slots/sidebar-content.tsx +45 -23
@@ -10,47 +10,59 @@ import type { PluginContext } from "../types";
10
10
  */
11
11
  export declare function buildMagicContextHookConfig(pluginConfig: MagicContextPluginConfig): {
12
12
  protected_tags: number;
13
- cache_ttl: string | {
14
- [modelKey: string]: string;
15
- default: string;
16
- };
17
- clear_reasoning_age: number;
18
- toast_duration_ms: number | undefined;
19
13
  execute_threshold_percentage: number | {
20
14
  [modelKey: string]: number;
21
15
  default: number;
22
16
  };
23
- execute_threshold_tokens: {
24
- [modelKey: string]: number | undefined;
17
+ disabled_hooks?: string[];
18
+ command?: Record<string, {
19
+ template: string;
20
+ description?: string;
21
+ agent?: string;
22
+ model?: string;
23
+ subtask?: boolean;
24
+ }>;
25
+ enabled: boolean;
26
+ auto_update?: boolean;
27
+ language?: string;
28
+ historian?: import("../../config/schema").HistorianConfig;
29
+ dreamer?: import("../../config/schema").DreamerConfig;
30
+ cache_ttl: string | {
31
+ default: string;
32
+ [modelKey: string]: string;
33
+ };
34
+ toast_duration_ms?: number;
35
+ execute_threshold_tokens?: {
25
36
  default?: number;
26
- } | undefined;
27
- historian: {
28
- two_pass: boolean;
29
- disallowed_tools: ("*" | "read" | "aft_outline" | "aft_zoom" | "aft_search")[];
30
- model?: string | undefined;
31
- temperature?: number | undefined;
32
- top_p?: number | undefined;
33
- prompt?: string | undefined;
34
- tools?: Record<string, boolean> | undefined;
35
- disable?: boolean | undefined;
36
- description?: string | undefined;
37
- mode?: "subagent" | "primary" | "all" | undefined;
38
- color?: string | undefined;
39
- maxSteps?: number | undefined;
40
- permission?: {
41
- edit?: "deny" | "allow" | "ask" | undefined;
42
- bash?: "deny" | "allow" | "ask" | Record<string, "deny" | "allow" | "ask"> | undefined;
43
- webfetch?: "deny" | "allow" | "ask" | undefined;
44
- doom_loop?: "deny" | "allow" | "ask" | undefined;
45
- external_directory?: "deny" | "allow" | "ask" | undefined;
46
- } | undefined;
47
- maxTokens?: number | undefined;
48
- variant?: string | undefined;
49
- fallback_models?: string | string[] | undefined;
50
- thinking_level?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
51
- } | undefined;
37
+ [modelKey: string]: number | undefined;
38
+ };
39
+ clear_reasoning_age: number;
52
40
  history_budget_percentage: number;
53
41
  historian_timeout_ms: number;
42
+ commit_cluster_trigger: {
43
+ enabled: boolean;
44
+ min_clusters: number;
45
+ };
46
+ sqlite: {
47
+ cache_size_mb: number;
48
+ mmap_size_mb: number;
49
+ };
50
+ system_prompt_injection: {
51
+ enabled: boolean;
52
+ skip_signatures: string[];
53
+ };
54
+ temporal_awareness: boolean;
55
+ keep_subagents: boolean;
56
+ todowrite: {
57
+ enabled: boolean;
58
+ overlay: boolean;
59
+ };
60
+ smart_drops: boolean;
61
+ caveman_text_compression: {
62
+ enabled: boolean;
63
+ min_chars: number;
64
+ };
65
+ embedding: import("../../config/schema").EmbeddingConfig;
54
66
  memory: {
55
67
  enabled: boolean;
56
68
  injection_budget_tokens: number;
@@ -67,149 +79,10 @@ export declare function buildMagicContextHookConfig(pluginConfig: MagicContextPl
67
79
  max_commits: number;
68
80
  };
69
81
  };
70
- sidekick: {
71
- timeout_ms: number;
72
- model?: string | undefined;
73
- temperature?: number | undefined;
74
- top_p?: number | undefined;
75
- prompt?: string | undefined;
76
- tools?: Record<string, boolean> | undefined;
77
- disable?: boolean | undefined;
78
- description?: string | undefined;
79
- mode?: "subagent" | "primary" | "all" | undefined;
80
- color?: string | undefined;
81
- maxSteps?: number | undefined;
82
- permission?: {
83
- edit?: "deny" | "allow" | "ask" | undefined;
84
- bash?: "deny" | "allow" | "ask" | Record<string, "deny" | "allow" | "ask"> | undefined;
85
- webfetch?: "deny" | "allow" | "ask" | undefined;
86
- doom_loop?: "deny" | "allow" | "ask" | undefined;
87
- external_directory?: "deny" | "allow" | "ask" | undefined;
88
- } | undefined;
89
- maxTokens?: number | undefined;
90
- variant?: string | undefined;
91
- fallback_models?: string | string[] | undefined;
92
- system_prompt?: string | undefined;
93
- thinking_level?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
94
- } | undefined;
95
- dreamer: {
96
- tasks: {
97
- "map-memories": {
98
- schedule: string;
99
- timeout_minutes: number;
100
- model?: string | undefined;
101
- fallback_models?: string | string[] | undefined;
102
- thinking_level?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
103
- };
104
- verify: {
105
- schedule: string;
106
- timeout_minutes: number;
107
- model?: string | undefined;
108
- fallback_models?: string | string[] | undefined;
109
- thinking_level?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
110
- };
111
- "verify-broad": {
112
- schedule: string;
113
- timeout_minutes: number;
114
- model?: string | undefined;
115
- fallback_models?: string | string[] | undefined;
116
- thinking_level?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
117
- };
118
- curate: {
119
- schedule: string;
120
- timeout_minutes: number;
121
- model?: string | undefined;
122
- fallback_models?: string | string[] | undefined;
123
- thinking_level?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
124
- };
125
- "classify-memories": {
126
- schedule: string;
127
- timeout_minutes: number;
128
- model?: string | undefined;
129
- fallback_models?: string | string[] | undefined;
130
- thinking_level?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
131
- };
132
- retrospective: {
133
- schedule: string;
134
- timeout_minutes: number;
135
- model?: string | undefined;
136
- fallback_models?: string | string[] | undefined;
137
- thinking_level?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
138
- };
139
- "maintain-docs": {
140
- schedule: string;
141
- timeout_minutes: number;
142
- model?: string | undefined;
143
- fallback_models?: string | string[] | undefined;
144
- thinking_level?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
145
- };
146
- "evaluate-smart-notes": {
147
- schedule: string;
148
- timeout_minutes: number;
149
- model?: string | undefined;
150
- fallback_models?: string | string[] | undefined;
151
- thinking_level?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
152
- };
153
- "review-user-memories": {
154
- schedule: string;
155
- timeout_minutes: number;
156
- model?: string | undefined;
157
- fallback_models?: string | string[] | undefined;
158
- thinking_level?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
159
- promotion_threshold?: number | undefined;
160
- };
161
- "promote-primers": {
162
- schedule: string;
163
- timeout_minutes: number;
164
- model?: string | undefined;
165
- fallback_models?: string | string[] | undefined;
166
- thinking_level?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
167
- promotion_threshold?: number | undefined;
168
- };
169
- "refresh-primers": {
170
- schedule: string;
171
- timeout_minutes: number;
172
- model?: string | undefined;
173
- fallback_models?: string | string[] | undefined;
174
- thinking_level?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
175
- };
176
- };
177
- inject_docs: boolean;
178
- model?: string | undefined;
179
- temperature?: number | undefined;
180
- top_p?: number | undefined;
181
- prompt?: string | undefined;
182
- tools?: Record<string, boolean> | undefined;
183
- disable?: boolean | undefined;
184
- description?: string | undefined;
185
- mode?: "subagent" | "primary" | "all" | undefined;
186
- color?: string | undefined;
187
- maxSteps?: number | undefined;
188
- permission?: {
189
- edit?: "deny" | "allow" | "ask" | undefined;
190
- bash?: "deny" | "allow" | "ask" | Record<string, "deny" | "allow" | "ask"> | undefined;
191
- webfetch?: "deny" | "allow" | "ask" | undefined;
192
- doom_loop?: "deny" | "allow" | "ask" | undefined;
193
- external_directory?: "deny" | "allow" | "ask" | undefined;
194
- } | undefined;
195
- maxTokens?: number | undefined;
196
- variant?: string | undefined;
197
- fallback_models?: string | string[] | undefined;
198
- thinking_level?: "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | undefined;
199
- } | undefined;
200
- commit_cluster_trigger: {
201
- enabled: boolean;
202
- min_clusters: number;
203
- };
204
- system_prompt_injection: {
82
+ shadow_transform: {
205
83
  enabled: boolean;
206
- skip_signatures: string[];
207
- };
208
- temporal_awareness: boolean;
209
- caveman_text_compression: {
210
- enabled: boolean;
211
- min_chars: number;
212
84
  };
85
+ sidekick?: import("../../config/schema").SidekickConfig;
213
86
  };
214
87
  export declare function createSessionHooks(args: {
215
88
  ctx: PluginContext;
@@ -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;AAO7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;0BAA+trC,CAAC;;;;;;EADp0zC"}
@@ -8,6 +8,9 @@ import type { LiveSessionState } from "../hooks/magic-context/live-session-state
8
8
  import type { MagicContextRpcServer } from "../shared/rpc-server";
9
9
  import type { SidebarSnapshot, StatusDetail } from "../shared/rpc-types";
10
10
  export declare function buildSidebarSnapshot(db: Database, sessionId: string, directory: string, liveSessionState?: LiveSessionState, injectionBudgetTokens?: number, config?: Record<string, unknown>): SidebarSnapshot;
11
+ /** Convert snapshot-build failures into a transport-failure envelope. A genuine
12
+ * zero snapshot remains a successful value so deleted sessions stay deleted. */
13
+ export declare function buildSidebarSnapshotRpcResponse(db: Database, sessionId: string, directory: string, liveSessionState?: LiveSessionState, injectionBudgetTokens?: number, config?: Record<string, unknown>): Record<string, unknown>;
11
14
  export declare function buildStatusDetail(db: Database, sessionId: string, directory: string, modelKey?: string, config?: Record<string, unknown>, liveSessionState?: LiveSessionState, injectionBudgetTokens?: number): StatusDetail;
12
15
  /**
13
16
  * Register all RPC handlers on the server.
@@ -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;AAIzE,OAAO,EACH,KAAK,eAAe,IAAI,QAAQ,EAGnC,MAAM,mCAAmC,CAAC;AAc3C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAoBlF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,KAAK,EAAe,eAAe,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AA0FtF,wBAAgB,oBAAoB,CAChC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,qBAAqB,CAAC,EAAE,MAAM,EAK9B,M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ACjC,eAAe,CA8RjB;AAED;gFACgF;AAChF,wBAAgB,+BAA+B,CAC3C,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,qBAAqB,CAAC,EAAE,MAAM,EAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACjC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAazB;AAED,wBAAgB,iBAAiB,CAC7B,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,qBAAqB,CAAC,EAAE,MAAM,GAC/B,YAAY,CAyKd;AA4BD;;GAEG;AACH,wBAAgB,mBAAmB,CAC/B,SAAS,EAAE,qBAAqB,EAChC,IAAI,EAAE;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,kBAAkB,CAAC;IAC3B,MAAM,EAAE,OAAO,CAAC;IAChB,gBAAgB,EAAE,gBAAgB,CAAC;CACtC,GACF,IAAI,CA4ON"}
@@ -103,6 +103,11 @@ export declare function resetAuthRewarmLatchForTest(): void;
103
103
  * own resolution path is used.
104
104
  */
105
105
  export declare function getSdkContextLimit(providerID: string, modelID: string): number | undefined;
106
+ /**
107
+ * Return only a provider-declared input cap. A combined context window is useful
108
+ * for scheduling but is not safe as a fail-closed prompt boundary.
109
+ */
110
+ export declare function getSdkInputLimit(providerID: string, modelID: string): number | undefined;
106
111
  /** Clear in-memory caches (for testing and the regression-recovery refetch). */
107
112
  export declare function clearModelsDevCache(): void;
108
113
  /** Inspection helpers (for logging / debugging). */
@@ -1 +1 @@
1
- {"version":3,"file":"models-dev-cache.d.ts","sourceRoot":"","sources":["../../src/sh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AAQ,EAAE,MAAM,CAAC;CACpB,CAMA"}
@@ -1,6 +1,7 @@
1
1
  export declare class MagicContextRpcClient {
2
2
  private port;
3
3
  private token;
4
+ private instanceId;
4
5
  private portDir;
5
6
  private legacyPortFilePath;
6
7
  private healthChecked;
@@ -16,9 +17,10 @@ export declare class MagicContextRpcClient {
16
17
  resolveEndpoint(): Promise<{
17
18
  port: number;
18
19
  token: string | null;
20
+ instanceId: string | null;
19
21
  } | null>;
20
22
  private resolvePort;
21
- private readPortFile;
23
+ private readPortFiles;
22
24
  private healthCheck;
23
25
  private fetchWithTimeout;
24
26
  reset(): void;
@@ -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,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;IASrC;;;yEAGqE;IAC/D,eAAe,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;YAUjE,WAAW;IAmCzB,OAAO,CAAC,YAAY;YA4BN,WAAW;YAWX,gBAAgB;IAU9B,KAAK,IAAI,IAAI;CAKhB"}
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,UAAU,CAAuB;IACzC,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;IASrC;;;yEAGqE;IAC/D,eAAe,IAAI,OAAO,CAAC;QAC7B,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;QACrB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;KAC7B,GAAG,IAAI,CAAC;YAYK,WAAW;IAwBzB,OAAO,CAAC,aAAa;YA+BP,WAAW;YAoBX,gBAAgB;IAU9B,KAAK,IAAI,IAAI;CAMhB"}
@@ -21,6 +21,8 @@ export interface RpcNotification {
21
21
  export interface NotificationSink {
22
22
  /** The TUI's active session at connect time (its hello scope). */
23
23
  sessionId?: string;
24
+ /** Protocol 2 clients use strict session scoping; absent means legacy behavior. */
25
+ protocol?: number;
24
26
  /** Deliver one notification over this sink's live socket. */
25
27
  send: (notification: RpcNotification) => void;
26
28
  }
@@ -30,8 +32,11 @@ export declare function registerNotificationSink(sink: NotificationSink): () =>
30
32
  * also enqueues it so a TUI that is momentarily disconnected (reconnecting, or
31
33
  * not yet connected) still receives it on its next hello via the backlog drain.
32
34
  * At-least-once: a live push that the socket drops is re-delivered from the
33
- * queue on reconnect (pruned only when the client acks via `lastReceivedId`). */
35
+ * queue on reconnect (pruned only when the client acknowledges it). */
34
36
  export declare function pushNotification(type: string, payload: Record<string, unknown>, sessionId?: string): void;
37
+ export declare function acknowledgeNotifications(ids: readonly number[]): void;
38
+ /** Reset process-local state to simulate a fresh server module in protocol tests. */
39
+ export declare function __resetNotificationStateForTests(): void;
35
40
  export interface DrainNotificationsOptions {
36
41
  /**
37
42
  * Cursor for global notifications when a session-scoped client sends separate
@@ -53,8 +58,8 @@ export interface DrainNotificationsOptions {
53
58
  * behavior.
54
59
  *
55
60
  * Delivery is at-least-once (non-destructive return + prune-on-ack): a returned
56
- * notification stays queued until a later call acks it via the matching scope's
57
- * cursor, so a dropped WS socket re-delivers unhandled backlog on reconnect. */
61
+ * notification stays queued until an exact acknowledgement or a legacy cursor
62
+ * removes it, so a dropped WS socket re-delivers unhandled backlog on reconnect. */
58
63
  export declare function drainNotifications(lastReceivedId?: number, sessionId?: string, options?: DrainNotificationsOptions): RpcNotification[];
59
64
  /** Whether a TUI client is connected via a live notification socket.
60
65
  * Now exact socket liveness (a registered WS sink), not a poll-drain timestamp.
@@ -62,8 +67,8 @@ export declare function drainNotifications(lastReceivedId?: number, sessionId?:
62
67
  * Pass `sessionId` (preferred) to ask whether a TUI is connected FOR THAT
63
68
  * SESSION — this is what producers (`/ctx-status`, `/ctx-recomp`, the upgrade
64
69
  * reminder) must use to decide dialog-vs-message, so a TUI on a different
65
- * session in the same process does not misroute their delivery. A session-less
66
- * sink (legacy/global) counts for any session query. Omit `sessionId` only for
67
- * callers with no session context; they get "any sink connected". */
70
+ * session in the same process does not misroute their delivery. A modern
71
+ * session-less sink is global-only; a legacy sink retains broad compatibility.
72
+ * Omit `sessionId` only for callers with no session context. */
68
73
  export declare function isTuiConnected(sessionId?: string): boolean;
69
74
  //# 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;AAKD;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAC7B,kEAAkE;IAClE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6DAA6D;IAC7D,IAAI,EAAE,CAAC,YAAY,EAAE,eAAe,KAAK,IAAI,CAAC;CACjD;AAYD,iFAAiF;AACjF,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,gBAAgB,GAAG,MAAM,IAAI,CAK3E;AAcD;;;;kFAIkF;AAClF,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,CAAC,EAAE,MAAM,GACnB,IAAI,CAoCN;AAED,MAAM,WAAW,yBAAyB;IACtC;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,kEAAkE;IAClE,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,wDAAwD;IACxD,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB;AAMD;;;;;;;;;;;iFAWiF;AACjF,wBAAgB,kBAAkB,CAC9B,cAAc,SAAI,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,GAAE,yBAA8B,GACxC,eAAe,EAAE,CAqDnB;AAED;;;;;;;;sEAQsE;AACtE,wBAAgB,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAO1D"}
1
+ {"version":3,"file":"rpc-notifications.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,eAAe;I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are class MagicContextRpcServer {
33
33
  /** HTTP route handler (Bun fetch). Returns a Response, or undefined when the
34
34
  * request was upgraded to a WebSocket. */
35
35
  private handleFetch;
36
- /** WS message handler: hello (auth + sink registration + backlog drain) and
37
- * ack (cursor advance → queue prune). All other messages are ignored. */
36
+ /** WS message handler: hello (auth + sink registration + backlog delivery) and
37
+ * ack (exact removal or legacy cursor pruning). All other messages are ignored. */
38
38
  private handleWsMessage;
39
39
  }
40
40
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-server.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-server.ts"],"names":[],"mappings":"AAqBA,KAAK,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AA0CxF;;;;;;;;;;;GAWG;AACH,qBAAa,qBAAqB;IAC9B,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,IAAI,CAAK;IACjB,OAAO,CAAC,QAAQ,CAAiC;IACjD,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkC;IAC7D,oEAAoE;IACpE,OAAO,CAAC,OAAO,CAAsC;IAMrD,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;IAqF9B,6EAA6E;IAC7E,IAAI,IAAI,IAAI;IAuBZ,OAAO,CAAC,uBAAuB;IAgB/B;+CAC2C;YAC7B,WAAW;IAyDzB;8EAC0E;IAC1E,OAAO,CAAC,eAAe;CA+F1B"}
1
+ {"version":3,"file":"rpc-server.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-server.ts"],"names":[],"mappings":"AAsBA,KAAK,UAAU,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AA8CxF;;;;;;;;;;;GAWG;AACH,qBAAa,qBAAqB;IAC9B,OAAO,CAAC,MAAM,CAA+B;IAC7C,OAAO,CAAC,IAAI,CAAK;IACjB,OAAO,CAAC,QAAQ,CAAiC;IACjD,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,SAAS,CAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkC;IAC7D,oEAAoE;IACpE,OAAO,CAAC,OAAO,CAAsC;IAMrD,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;IA6F9B,6EAA6E;IAC7E,IAAI,IAAI,IAAI;IAuBZ,OAAO,CAAC,uBAAuB;IAgB/B;+CAC2C;YAC7B,WAAW;IAyDzB;wFACoF;IACpF,OAAO,CAAC,eAAe;CA8H1B"}
@@ -1 +1 @@
1
- {"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/shared/sqlite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAMH,OAAO,KAAK,aAAa,MAAM,gBAAgB,CAAC;AAyHhD,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"}
1
+ {"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/shared/sqlite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AAMH,OAAO,KAAK,aAAa,MAAM,gBAAgB,CAAC;AA4IhD,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"}
@@ -66,6 +66,24 @@ export interface TagTranscriptOptions {
66
66
  * contentId) since all parts of a message share one fingerprint.
67
67
  */
68
68
  entryFingerprintByMessageId?: ReadonlyMap<string, string>;
69
+ /**
70
+ * Stable Pi message ids observed on a prior pass. Their immutable parts may
71
+ * reuse tag assignments while this pass still reapplies visible prefixes and
72
+ * rebuilds the complete set of messages affected by each tag.
73
+ */
74
+ reuseMessageIds?: ReadonlySet<string>;
75
+ /** Exact text/count pairs retained by Pi for safe lazy-token backfill reuse. */
76
+ textTokenCache?: Map<string, {
77
+ text: string;
78
+ tokenCount: number;
79
+ }>;
80
+ /** Exact tool-result text/count pairs retained under composite tag identity. */
81
+ toolTokenCache?: Map<string, {
82
+ text: string;
83
+ tokenCount: number;
84
+ }>;
85
+ /** Optional process-local benchmark callback; production callers omit it. */
86
+ onTiming?: (phase: "identity" | "prefix" | "targets" | "tokenCounting", elapsedMs: number) => void;
69
87
  }
70
88
  export interface TagTranscriptResult {
71
89
  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;AAQzE,OAAO,EAAwB,KAAK,MAAM,EAAE,MAAM,kCAAkC,CAAC;AASrF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,cAAc,CAAC;AAE/D,MAAM,WAAW,oBAAoB;IACjC;;;;;;OAMG;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;AA8DD,wBAAgB,aAAa,CACzB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,eAAe,EACnB,OAAO,GAAE,oBAAyB,GACnC,mBAAmB,CAiPrB"}
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;AAQzE,OAAO,EAAwB,KAAK,MAAM,EAAE,MAAM,kCAAkC,CAAC;AASrF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,KAAK,EAAE,UAAU,EAAkB,MAAM,cAAc,CAAC;AAE/D,MAAM,WAAW,oBAAoB;IACjC;;;;;;OAMG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B;;;;;;;OAOG;IACH,2BAA2B,CAAC,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1D;;;;OAIG;IACH,eAAe,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IACtC,gFAAgF;IAChF,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnE,gFAAgF;IAChF,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACnE,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,CACP,KAAK,EAAE,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,eAAe,EAC1D,SAAS,EAAE,MAAM,KAChB,IAAI,CAAC;CACb;AAED,MAAM,WAAW,mBAAmB;IAChC,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;CACnC;AAuED,wBAAgB,aAAa,CACzB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,eAAe,EACnB,OAAO,GAAE,oBAAyB,GACnC,mBAAmB,CA2VrB"}
@@ -8,8 +8,10 @@
8
8
  * through setup or doctor.
9
9
  */
10
10
  /**
11
- * Ensure tui.json has the magic-context TUI plugin entry.
12
- * Creates tui.json if it doesn't exist. Silently skips if already present.
11
+ * Ensure the selected TUI config has the magic-context plugin entry.
12
+ * Creates tui.jsonc if neither TUI config exists. Silently skips if already present.
13
13
  */
14
- export declare function ensureTuiPluginEntry(): boolean;
14
+ export declare function ensureTuiPluginEntry(options?: {
15
+ configDir?: string;
16
+ }): boolean;
15
17
  //# sourceMappingURL=tui-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tui-config.d.ts","sourceRoot":"","sources":["../../src/shared/tui-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAyEH;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAqD9C"}
1
+ {"version":3,"file":"tui-config.d.ts","sourceRoot":"","sources":["../../src/shared/tui-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAyEH;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,GAAG,OAAO,CAqDlF"}
@@ -1,3 +1,3 @@
1
- export declare const CTX_EXPAND_DESCRIPTION = "Recover the original conversation from your compacted history.\n\nOlder parts of this session are summarized into <compartment> blocks inside <session-history> \u2014 e.g. <compartment start=\"120\" end=\"245\" title=\"Fixed tagger collision\">. Each one replaces the raw messages in that ordinal range with a summary. When the summary isn't enough \u2014 you need exact wording, a specific value, an error message, or the reasoning behind a decision \u2014 expand the range:\n\nctx_expand(start=120, end=245) \u2190 the compartment's own start/end attributes\n\nReturns the raw transcript as [N] U:/A: lines, capped at ~15K tokens; an oversized range returns the head and tells you where to continue. Also works with ordinals from ctx_search message results \u2014 expand a window around a hit (e.g. start=N-10, end=N+5). Ranges after the last compartment are your live tail \u2014 already visible in context, not expandable.\n\nTwo recovery modes for finer detail:\n- ctx_expand(start=120, end=245, verbose=true) \u2014 lists each message SEPARATELY with its ordinal [N] and a per-part preview (each tool call shown with its output size). Use this to find the exact message or tool call you want, then recover it in full by ordinal.\n- ctx_expand(message=138) \u2014 returns the FULL untruncated content of the message at that ordinal: every text part, and every tool call's complete input + output, read from stored history. This is the cheap way to get back a tool output you dropped with ctx_reduce \u2014 the original is still in storage even though the wire shows [dropped \u00A7N\u00A7]. If the message was deleted from history (session prune/revert), it says so.";
1
+ export declare const CTX_EXPAND_DESCRIPTION = "Recover the original conversation from your compacted history.\n\nOlder parts of this session are summarized under `## start-end \u00B7 date \u00B7 title` headings inside <session-history> \u2014 e.g. `## 120-245 \u00B7 \u2026 \u00B7 Fixed tagger collision`. Each heading replaces the raw messages in that ordinal range with a summary. When the summary isn't enough \u2014 you need exact wording, a specific value, an error message, or the reasoning behind a decision \u2014 expand the range:\n\nctx_expand(start=120, end=245) \u2190 the heading's start/end range\n\nReturns the raw transcript as [N] U:/A: lines, capped at ~15K tokens; an oversized range returns the head and tells you where to continue. Also works with ordinals from ctx_search message results \u2014 expand a window around a hit (e.g. start=N-10, end=N+5). Ranges after the last compartment are your live tail \u2014 already visible in context, not expandable.\n\nTwo recovery modes for finer detail:\n- ctx_expand(start=120, end=245, verbose=true) \u2014 lists each message SEPARATELY with its ordinal [N] and a per-part preview (each tool call shown with its output size). Use this to find the exact message or tool call you want, then recover it in full by ordinal.\n- ctx_expand(message=138) \u2014 returns the FULL untruncated content of the message at that ordinal: every text part, and every tool call's complete input + output, read from stored history. This is the cheap way to get back a tool output you dropped with ctx_reduce \u2014 the original is still in storage even though the wire shows [dropped \u00A7N\u00A7]. If the message was deleted from history (session prune/revert), it says so.";
2
2
  export declare const CTX_EXPAND_TOKEN_BUDGET = 15000;
3
3
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-expand/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,6oDAU6X,CAAC;AAEja,eAAO,MAAM,uBAAuB,QAAS,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-expand/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,sBAAsB,ipDAU6X,CAAC;AAEja,eAAO,MAAM,uBAAuB,QAAS,CAAC"}
@@ -15,8 +15,15 @@ export declare function loadSidebarSnapshot(sessionId: string, directory: string
15
15
  export declare function loadStatusDetail(sessionId: string, directory: string, modelKey?: string): Promise<StatusDetail>;
16
16
  /** Fetch embedding coverage status for `/ctx-embed` via RPC. */
17
17
  export declare function loadEmbedDetail(sessionId: string, directory: string): Promise<EmbedDetail>;
18
- /** Get compartment count via RPC. */
19
- export declare function getCompartmentCount(sessionId: string): Promise<number>;
18
+ export type CompartmentCountResult = {
19
+ ok: true;
20
+ count: number;
21
+ } | {
22
+ ok: false;
23
+ error: string;
24
+ };
25
+ /** Get compartment count without making transport failure look like a real zero. */
26
+ export declare function getCompartmentCount(sessionId: string): Promise<CompartmentCountResult>;
20
27
  /** Send recomp request to server via RPC. */
21
28
  export declare function requestRecomp(sessionId: string): Promise<boolean>;
22
29
  /** Run `/ctx-session-upgrade` for the session (full recomp + once-per-project
@@ -1 +1 @@
1
- {"version":3,"file":"context-db.d.ts","sourceRoot":"","sources":["../../../src/tui/data/context-db.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEzF,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC;AAc3D,2DAA2D;AAC3D,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAOrD;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED;sCACsC;AACtC,wBAAgB,YAAY,IAAI,qBAAqB,GAAG,IAAI,CAE3D;AAED,+BAA+B;AAC/B,wBAAgB,QAAQ,IAAI,IAAI,CAM/B;AA2FD,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,CA0CvB;AAYD,gEAAgE;AAChE,wBAAsB,eAAe,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;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"}
@@ -26,14 +26,13 @@ export interface SocketNotification {
26
26
  interface NotificationSocketOptions {
27
27
  /** Current active session id (re-read cheaply to follow session switches). */
28
28
  getSessionId: () => string | null;
29
- /** Handle one delivered notification. Returns true if it was consumed (so its
30
- * id can advance the ack cursor). Async because dialog handlers await. */
29
+ /** Handle one delivered notification. Returns true only after it is fully
30
+ * consumed and can be acknowledged. Async because dialog handlers await. */
31
31
  onNotification: (notification: SocketNotification) => boolean | Promise<boolean>;
32
32
  }
33
- /** Open the persistent notification socket. Idempotent: a second call while open
34
- * is a no-op. Reconnects on its own after any drop. */
33
+ /** Open the persistent notification socket. Reconnects on its own after a drop. */
35
34
  export declare function startNotificationSocket(options: NotificationSocketOptions): void;
36
- /** Close the socket and stop reconnecting. Call on TUI dispose. */
35
+ /** Close the socket and release all state owned by this TUI initialization. */
37
36
  export declare function stopNotificationSocket(): void;
38
37
  export declare function _resetNotificationSocketStateForTesting(): void;
39
38
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"notification-socket.d.ts","sourceRoot":"","sources":["../../../src/tui/data/notification-socket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,MAAM,WAAW,kBAAkB;IAC/B,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,UAAU,yBAAyB;IAC/B,8EAA8E;IAC9E,YAAY,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAClC;+EAC2E;IAC3E,cAAc,EAAE,CAAC,YAAY,EAAE,kBAAkB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpF;AAkCD;wDACwD;AACxD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI,CAQhF;AAED,mEAAmE;AACnE,wBAAgB,sBAAsB,IAAI,IAAI,CAkB7C;AA6KD,wBAAgB,uCAAuC,IAAI,IAAI,CAM9D"}
1
+ {"version":3,"file":"notification-socket.d.ts","sourceRoot":"","sources":["../../../src/tui/data/notification-socket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,MAAM,WAAW,kBAAkB;IAC/B,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,UAAU,yBAAyB;IAC/B,8EAA8E;IAC9E,YAAY,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAClC;iFAC6E;IAC7E,cAAc,EAAE,CAAC,YAAY,EAAE,kBAAkB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpF;AA6CD,mFAAmF;AACnF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI,CAOhF;AAED,+EAA+E;AAC/E,wBAAgB,sBAAsB,IAAI,IAAI,CA+B7C;AAyUD,wBAAgB,uCAAuC,IAAI,IAAI,CAE9D"}
@@ -15,8 +15,15 @@ export declare function loadSidebarSnapshot(sessionId: string, directory: string
15
15
  export declare function loadStatusDetail(sessionId: string, directory: string, modelKey?: string): Promise<StatusDetail>;
16
16
  /** Fetch embedding coverage status for `/ctx-embed` via RPC. */
17
17
  export declare function loadEmbedDetail(sessionId: string, directory: string): Promise<EmbedDetail>;
18
- /** Get compartment count via RPC. */
19
- export declare function getCompartmentCount(sessionId: string): Promise<number>;
18
+ export type CompartmentCountResult = {
19
+ ok: true;
20
+ count: number;
21
+ } | {
22
+ ok: false;
23
+ error: string;
24
+ };
25
+ /** Get compartment count without making transport failure look like a real zero. */
26
+ export declare function getCompartmentCount(sessionId: string): Promise<CompartmentCountResult>;
20
27
  /** Send recomp request to server via RPC. */
21
28
  export declare function requestRecomp(sessionId: string): Promise<boolean>;
22
29
  /** Run `/ctx-session-upgrade` for the session (full recomp + once-per-project
@@ -1 +1 @@
1
- {"version":3,"file":"context-db.d.ts","sourceRoot":"","sources":["../../../src/tui-compiled/data/context-db.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEzF,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC;AAc3D,2DAA2D;AAC3D,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAOrD;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED;sCACsC;AACtC,wBAAgB,YAAY,IAAI,qBAAqB,GAAG,IAAI,CAE3D;AAED,+BAA+B;AAC/B,wBAAgB,QAAQ,IAAI,IAAI,CAM/B;AA2FD,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,CA0CvB;AAYD,gEAAgE;AAChE,wBAAsB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,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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"}
@@ -26,14 +26,13 @@ export interface SocketNotification {
26
26
  interface NotificationSocketOptions {
27
27
  /** Current active session id (re-read cheaply to follow session switches). */
28
28
  getSessionId: () => string | null;
29
- /** Handle one delivered notification. Returns true if it was consumed (so its
30
- * id can advance the ack cursor). Async because dialog handlers await. */
29
+ /** Handle one delivered notification. Returns true only after it is fully
30
+ * consumed and can be acknowledged. Async because dialog handlers await. */
31
31
  onNotification: (notification: SocketNotification) => boolean | Promise<boolean>;
32
32
  }
33
- /** Open the persistent notification socket. Idempotent: a second call while open
34
- * is a no-op. Reconnects on its own after any drop. */
33
+ /** Open the persistent notification socket. Reconnects on its own after a drop. */
35
34
  export declare function startNotificationSocket(options: NotificationSocketOptions): void;
36
- /** Close the socket and stop reconnecting. Call on TUI dispose. */
35
+ /** Close the socket and release all state owned by this TUI initialization. */
37
36
  export declare function stopNotificationSocket(): void;
38
37
  export declare function _resetNotificationSocketStateForTesting(): void;
39
38
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"notification-socket.d.ts","sourceRoot":"","sources":["../../../src/tui-compiled/data/notification-socket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,MAAM,WAAW,kBAAkB;IAC/B,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,UAAU,yBAAyB;IAC/B,8EAA8E;IAC9E,YAAY,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAClC;+EAC2E;IAC3E,cAAc,EAAE,CAAC,YAAY,EAAE,kBAAkB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpF;AAkCD;wDACwD;AACxD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI,CAQhF;AAED,mEAAmE;AACnE,wBAAgB,sBAAsB,IAAI,IAAI,CAkB7C;AA6KD,wBAAgB,uCAAuC,IAAI,IAAI,CAM9D"}
1
+ {"version":3,"file":"notification-socket.d.ts","sourceRoot":"","sources":["../../../src/tui-compiled/data/notification-socket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,MAAM,WAAW,kBAAkB;IAC/B,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,UAAU,yBAAyB;IAC/B,8EAA8E;IAC9E,YAAY,EAAE,MAAM,MAAM,GAAG,IAAI,CAAC;IAClC;iFAC6E;IAC7E,cAAc,EAAE,CAAC,YAAY,EAAE,kBAAkB,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CACpF;AA6CD,mFAAmF;AACnF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI,CAOhF;AAED,+EAA+E;AAC/E,wBAAgB,sBAAsB,IAAI,IAAI,CA+B7C;AAyUD,wBAAgB,uCAAuC,IAAI,IAAI,CAE9D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/opencode-magic-context",
3
- "version": "0.31.5",
3
+ "version": "0.32.1",
4
4
  "type": "module",
5
5
  "description": "OpenCode plugin for Magic Context — cross-session memory and context management",
6
6
  "main": "dist/index.js",
@@ -43,6 +43,7 @@
43
43
  "prepublishOnly": "bun run build && bun run build:tui"
44
44
  },
45
45
  "dependencies": {
46
+ "@cortexkit/subc-client": "0.4.1",
46
47
  "@huggingface/transformers": "^4.1.0",
47
48
  "@jitl/quickjs-singlefile-cjs-release-asyncify": "0.32.0",
48
49
  "@opencode-ai/plugin": "^1.17.11",