@cortexkit/opencode-magic-context 0.32.0 → 0.32.2
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/README.md +3 -3
- package/dist/config/index.d.ts.map +1 -1
- package/dist/config/project-security.d.ts +3 -0
- package/dist/config/project-security.d.ts.map +1 -1
- package/dist/config/schema/magic-context.d.ts +82 -2
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/config/transform-mode.d.ts +15 -0
- package/dist/config/transform-mode.d.ts.map +1 -0
- package/dist/features/magic-context/compartment-embedding.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/cron.d.ts +2 -2
- package/dist/features/magic-context/dreamer/cron.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts.map +1 -1
- package/dist/features/magic-context/git-commits/indexer.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-provider.d.ts +6 -0
- package/dist/features/magic-context/memory/embedding-provider.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-synapse.d.ts +98 -0
- package/dist/features/magic-context/memory/embedding-synapse.d.ts.map +1 -0
- package/dist/features/magic-context/memory/embedding.d.ts +1 -1
- package/dist/features/magic-context/memory/embedding.d.ts.map +1 -1
- package/dist/features/magic-context/message-index-async.d.ts +4 -1
- package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
- package/dist/features/magic-context/message-index.d.ts +7 -4
- package/dist/features/magic-context/message-index.d.ts.map +1 -1
- package/dist/features/magic-context/migrations.d.ts +21 -16
- package/dist/features/magic-context/migrations.d.ts.map +1 -1
- package/dist/features/magic-context/plugin-messages.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts +27 -0
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/search-measurement.d.ts +14 -0
- package/dist/features/magic-context/search-measurement.d.ts.map +1 -0
- package/dist/features/magic-context/search.d.ts +11 -1
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/session-project-backfill.d.ts +6 -3
- package/dist/features/magic-context/session-project-backfill.d.ts.map +1 -1
- package/dist/features/magic-context/session-project-storage.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/capabilities.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/compiler.d.ts +3 -1
- package/dist/features/magic-context/smart-notes/compiler.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/runner.d.ts +1 -0
- package/dist/features/magic-context/smart-notes/runner.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/sandbox-runner.d.ts +8 -1
- package/dist/features/magic-context/smart-notes/sandbox-runner.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/ssrf-guard.d.ts +10 -0
- package/dist/features/magic-context/smart-notes/ssrf-guard.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/storage.d.ts +16 -1
- package/dist/features/magic-context/smart-notes/storage.d.ts.map +1 -1
- package/dist/features/magic-context/storage-clone.d.ts +4 -0
- package/dist/features/magic-context/storage-clone.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.d.ts +7 -1
- package/dist/features/magic-context/storage-db.d.ts.map +1 -1
- package/dist/features/magic-context/storage-embedding-measurements.d.ts +60 -0
- package/dist/features/magic-context/storage-embedding-measurements.d.ts.map +1 -0
- package/dist/features/magic-context/storage-meta-persisted.d.ts +10 -5
- 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-schema-helpers.d.ts +3 -4
- package/dist/features/magic-context/storage-schema-helpers.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/features/magic-context/storage.d.ts +1 -0
- package/dist/features/magic-context/storage.d.ts.map +1 -1
- package/dist/features/magic-context/tool-owner-backfill.d.ts +2 -0
- package/dist/features/magic-context/tool-owner-backfill.d.ts.map +1 -1
- package/dist/features/magic-context/transform-decision-log.d.ts +1 -1
- package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
- package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-runner.d.ts +7 -1
- package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/channel2-delivery.d.ts +2 -0
- package/dist/hooks/magic-context/channel2-delivery.d.ts.map +1 -1
- package/dist/hooks/magic-context/command-handler.d.ts +5 -0
- package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/compaction-marker-manager.d.ts +4 -0
- package/dist/hooks/magic-context/compaction-marker-manager.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-render-epoch.d.ts +12 -0
- package/dist/hooks/magic-context/compartment-render-epoch.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
- package/dist/hooks/magic-context/decay-render.d.ts.map +1 -1
- package/dist/hooks/magic-context/emergency-drop.d.ts +1 -0
- package/dist/hooks/magic-context/emergency-drop.d.ts.map +1 -1
- package/dist/hooks/magic-context/emergency-fail-closed.d.ts +7 -0
- package/dist/hooks/magic-context/emergency-fail-closed.d.ts.map +1 -0
- package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +29 -0
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -0
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts +1 -0
- package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-prompt.generated.d.ts +1 -1
- package/dist/hooks/magic-context/historian-prompt.generated.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook-handlers.d.ts +6 -0
- package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts +19 -3
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/index.d.ts +1 -1
- package/dist/hooks/magic-context/index.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts +1 -0
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-replay.d.ts +51 -0
- package/dist/hooks/magic-context/lkg-replay.d.ts.map +1 -0
- package/dist/hooks/magic-context/lkg-slot.d.ts +25 -0
- package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -0
- package/dist/hooks/magic-context/module-state-sync.d.ts +169 -0
- package/dist/hooks/magic-context/module-state-sync.d.ts.map +1 -0
- package/dist/hooks/magic-context/module-wire.d.ts +73 -0
- package/dist/hooks/magic-context/module-wire.d.ts.map +1 -0
- package/dist/hooks/magic-context/pass-outcome.d.ts +15 -0
- package/dist/hooks/magic-context/pass-outcome.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-chunk.d.ts +17 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-raw.d.ts +30 -2
- package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -1
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts +64 -0
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -0
- package/dist/hooks/magic-context/shadow-sender.d.ts +84 -49
- package/dist/hooks/magic-context/shadow-sender.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-messages.d.ts +2 -0
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +56 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +9 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17355 -10510
- package/dist/plugin/boot-quiet.d.ts +12 -0
- package/dist/plugin/boot-quiet.d.ts.map +1 -0
- package/dist/plugin/dream-timer.d.ts +6 -2
- package/dist/plugin/dream-timer.d.ts.map +1 -1
- package/dist/plugin/embedding-bootstrap-helpers.d.ts.map +1 -1
- package/dist/plugin/embedding-bootstrap.d.ts.map +1 -1
- package/dist/plugin/embedding-routing.d.ts +32 -0
- package/dist/plugin/embedding-routing.d.ts.map +1 -0
- package/dist/plugin/hooks/create-session-hooks.d.ts +54 -2
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/messages-transform.d.ts +4 -3
- package/dist/plugin/messages-transform.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts +19 -2
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/plugin/rust-tool-backends.d.ts +10 -0
- package/dist/plugin/rust-tool-backends.d.ts.map +1 -0
- package/dist/plugin/tool-registry.d.ts +2 -0
- package/dist/plugin/tool-registry.d.ts.map +1 -1
- package/dist/shared/models-dev-cache.d.ts +5 -0
- package/dist/shared/models-dev-cache.d.ts.map +1 -1
- package/dist/shared/rpc-client.d.ts +3 -1
- package/dist/shared/rpc-client.d.ts.map +1 -1
- package/dist/shared/rpc-notifications.d.ts +11 -6
- package/dist/shared/rpc-notifications.d.ts.map +1 -1
- package/dist/shared/rpc-server.d.ts +2 -2
- package/dist/shared/rpc-server.d.ts.map +1 -1
- package/dist/shared/rpc-types.d.ts +3 -0
- package/dist/shared/rpc-types.d.ts.map +1 -1
- package/dist/shared/sqlite.d.ts.map +1 -1
- package/dist/shared/tui-config.d.ts +5 -3
- package/dist/shared/tui-config.d.ts.map +1 -1
- package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
- package/dist/tools/ctx-memory/types.d.ts +2 -0
- package/dist/tools/ctx-memory/types.d.ts.map +1 -1
- package/dist/tools/ctx-reduce/tools.d.ts +2 -0
- package/dist/tools/ctx-reduce/tools.d.ts.map +1 -1
- package/dist/tui/data/context-db.d.ts +9 -2
- package/dist/tui/data/context-db.d.ts.map +1 -1
- package/dist/tui/data/notification-socket.d.ts +4 -5
- package/dist/tui/data/notification-socket.d.ts.map +1 -1
- package/dist/tui-compiled/data/context-db.d.ts +9 -2
- package/dist/tui-compiled/data/context-db.d.ts.map +1 -1
- package/dist/tui-compiled/data/notification-socket.d.ts +4 -5
- package/dist/tui-compiled/data/notification-socket.d.ts.map +1 -1
- package/package.json +2 -1
- package/src/shared/models-dev-cache.test.ts +5 -0
- package/src/shared/models-dev-cache.ts +44 -6
- package/src/shared/opencode-compaction-detector.test.ts +11 -2
- package/src/shared/rpc-client.test.ts +213 -9
- package/src/shared/rpc-client.ts +48 -39
- package/src/shared/rpc-notifications.test.ts +26 -5
- package/src/shared/rpc-notifications.ts +44 -35
- package/src/shared/rpc-server.ts +69 -33
- package/src/shared/rpc-types.ts +3 -0
- package/src/shared/sqlite.ts +22 -3
- package/src/shared/tui-config.test.ts +4 -12
- package/src/shared/tui-config.ts +6 -6
- package/src/tui/data/context-db.test.ts +113 -0
- package/src/tui/data/context-db.ts +26 -19
- package/src/tui/data/notification-socket.test.ts +277 -11
- package/src/tui/data/notification-socket.ts +257 -86
- package/src/tui/index.tsx +42 -25
- package/src/tui/slots/sidebar-content.tsx +62 -24
- package/src/tui-compiled/data/context-db.ts +26 -19
- package/src/tui-compiled/data/notification-socket.ts +257 -86
- package/src/tui-compiled/index.tsx +83 -30
- package/src/tui-compiled/slots/sidebar-content.tsx +45 -23
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type { ContextDatabase } from "../../features/magic-context/storage";
|
|
2
|
+
import type { RawMessageParts } from "./read-session-raw";
|
|
3
|
+
export interface ModuleWatermarks {
|
|
4
|
+
compartment_sequence: number;
|
|
5
|
+
memory_id: number;
|
|
6
|
+
m0_mutation_id: number;
|
|
7
|
+
memory_mutation_id: number;
|
|
8
|
+
last_todo_state_hash: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ModuleWorkspacePayload {
|
|
11
|
+
fingerprint: string;
|
|
12
|
+
members: Array<{
|
|
13
|
+
project_path: string;
|
|
14
|
+
share_categories: string[];
|
|
15
|
+
}>;
|
|
16
|
+
}
|
|
17
|
+
export interface ModuleStateSyncPayload {
|
|
18
|
+
method: "state_sync";
|
|
19
|
+
params: {
|
|
20
|
+
session_id?: string;
|
|
21
|
+
shadow_generation: number;
|
|
22
|
+
expected_shadow_seq: number;
|
|
23
|
+
seed_id?: string;
|
|
24
|
+
seed_generation?: number;
|
|
25
|
+
seed_batch_index?: number;
|
|
26
|
+
seed_batch_total?: number;
|
|
27
|
+
seed_complete?: boolean;
|
|
28
|
+
seed_boundary_id?: string | null;
|
|
29
|
+
compartments: unknown[];
|
|
30
|
+
memories: unknown[];
|
|
31
|
+
memory_mutations: unknown[];
|
|
32
|
+
user_profile: string[];
|
|
33
|
+
workspace?: ModuleWorkspacePayload | null;
|
|
34
|
+
last_todo_state?: string;
|
|
35
|
+
acked_watermarks?: ModuleWatermarks;
|
|
36
|
+
};
|
|
37
|
+
watermarks: ModuleWatermarks;
|
|
38
|
+
wireBatches?: ModuleStateSyncPayload[];
|
|
39
|
+
}
|
|
40
|
+
/** The subset of sender state needed to serialize a state-sync payload. */
|
|
41
|
+
export interface ModuleStateSyncState {
|
|
42
|
+
shadowGeneration: number;
|
|
43
|
+
lastAckedSeq: number;
|
|
44
|
+
lastAckedWatermarks: ModuleWatermarks | null;
|
|
45
|
+
idOrdinalMemoGeneration: number;
|
|
46
|
+
idOrdinalMemo: Map<string, number>;
|
|
47
|
+
seedPassPending?: boolean;
|
|
48
|
+
}
|
|
49
|
+
export interface ModuleStateSyncPass {
|
|
50
|
+
db: ContextDatabase;
|
|
51
|
+
sessionId: string;
|
|
52
|
+
projectPath?: string;
|
|
53
|
+
nowMs: number;
|
|
54
|
+
}
|
|
55
|
+
export interface ModuleStateSyncOptions {
|
|
56
|
+
beforeSerializeCompartment?: () => void;
|
|
57
|
+
yieldEveryCompartments?: number;
|
|
58
|
+
shouldAbortSeed?: () => boolean;
|
|
59
|
+
/** Enable the authority sender's one-time durable-sequence adoption. */
|
|
60
|
+
authority?: boolean;
|
|
61
|
+
/** Share adoption state across every authority sync attempt in one transform pass. */
|
|
62
|
+
authoritySeqAdoption?: {
|
|
63
|
+
used: boolean;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
export interface ModuleCompartmentMirrorRow {
|
|
67
|
+
sequence: number;
|
|
68
|
+
start_message: number;
|
|
69
|
+
end_message: number;
|
|
70
|
+
start_message_id: string;
|
|
71
|
+
end_message_id: string;
|
|
72
|
+
title: string;
|
|
73
|
+
content: string;
|
|
74
|
+
p1?: string | null;
|
|
75
|
+
p2?: string | null;
|
|
76
|
+
p3?: string | null;
|
|
77
|
+
p4?: string | null;
|
|
78
|
+
importance?: number | null;
|
|
79
|
+
episode_type?: string | null;
|
|
80
|
+
legacy?: number | null;
|
|
81
|
+
created_at?: number;
|
|
82
|
+
}
|
|
83
|
+
export interface ModuleCompartmentMirrorResponse {
|
|
84
|
+
max_sequence: number;
|
|
85
|
+
compartments: ModuleCompartmentMirrorRow[];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The module owns its SQLite file, so TS cannot read rows directly. This narrow
|
|
89
|
+
* reader is the seam for the module's future `session.status` compartment page.
|
|
90
|
+
* It deliberately returns typed rows instead of pretending the TS database is
|
|
91
|
+
* authoritative for module-published content.
|
|
92
|
+
*/
|
|
93
|
+
export interface ModuleCompartmentReader {
|
|
94
|
+
getCompartmentsAfter(sessionId: string, afterSequence: number): Promise<ModuleCompartmentMirrorResponse>;
|
|
95
|
+
}
|
|
96
|
+
export declare function mirrorModuleCompartments(args: {
|
|
97
|
+
db: ContextDatabase;
|
|
98
|
+
sessionId: string;
|
|
99
|
+
reader: ModuleCompartmentReader;
|
|
100
|
+
}): Promise<number>;
|
|
101
|
+
export declare function loadModuleWatermarks(args: {
|
|
102
|
+
db: ContextDatabase;
|
|
103
|
+
sessionId: string;
|
|
104
|
+
projectPath?: string;
|
|
105
|
+
}): ModuleWatermarks;
|
|
106
|
+
export declare function moduleWatermarksEqual(left: ModuleWatermarks | null, right: ModuleWatermarks): boolean;
|
|
107
|
+
/**
|
|
108
|
+
* Compartment rows retain ordinals from the TS storage basis, which can include
|
|
109
|
+
* synthetic summary rows. Resolve module boundaries from the summary-excluding
|
|
110
|
+
* basis so the shared memo compares one canonical value everywhere.
|
|
111
|
+
*/
|
|
112
|
+
export declare function canonicalOrdinalForMessageId(args: {
|
|
113
|
+
sessionId: string;
|
|
114
|
+
raw: RawMessageParts | null;
|
|
115
|
+
messageId: string;
|
|
116
|
+
generation: number;
|
|
117
|
+
state: ModuleStateSyncState;
|
|
118
|
+
}): number | null | "mismatch";
|
|
119
|
+
export declare function buildPagedModuleStateSyncPayloads(args: {
|
|
120
|
+
shadowGeneration: number;
|
|
121
|
+
expectedShadowSeq: number;
|
|
122
|
+
seedId: string;
|
|
123
|
+
seedBoundaryId: string | null;
|
|
124
|
+
compartments: unknown[];
|
|
125
|
+
memories: unknown[];
|
|
126
|
+
memoryMutations: unknown[];
|
|
127
|
+
userProfile: string[];
|
|
128
|
+
workspace: ModuleWorkspacePayload | null;
|
|
129
|
+
lastTodoState: string;
|
|
130
|
+
watermarks: ModuleWatermarks;
|
|
131
|
+
}): ModuleStateSyncPayload[];
|
|
132
|
+
export declare function buildModuleStateSyncPayload(args: {
|
|
133
|
+
state: ModuleStateSyncState;
|
|
134
|
+
pass: ModuleStateSyncPass;
|
|
135
|
+
force: boolean;
|
|
136
|
+
options?: ModuleStateSyncOptions;
|
|
137
|
+
seedId?: string;
|
|
138
|
+
}): Promise<ModuleStateSyncPayload | null | "m0_mutation" | "mismatch" | "unresolved" | "seed_budget">;
|
|
139
|
+
export interface ModuleStateSyncClient {
|
|
140
|
+
call(args: {
|
|
141
|
+
sessionId: string;
|
|
142
|
+
projectRoot: string;
|
|
143
|
+
method: "state_sync" | "transform" | "session.status" | "session.flush" | "session.recomp" | "session.wrapup" | "todo_state.set" | "agent_drops.append";
|
|
144
|
+
body: unknown;
|
|
145
|
+
signal?: AbortSignal;
|
|
146
|
+
}): Promise<unknown>;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Mode-neutral state synchronization: the same watermark-triggered assembly is
|
|
150
|
+
* used by the mirror sender and the Rust authority path. Callers own retries and
|
|
151
|
+
* lineage handling because shadow and authority have different failure policy.
|
|
152
|
+
*/
|
|
153
|
+
export declare function syncModuleState(args: {
|
|
154
|
+
client: ModuleStateSyncClient;
|
|
155
|
+
state: ModuleStateSyncState;
|
|
156
|
+
pass: ModuleStateSyncPass;
|
|
157
|
+
projectRoot: string;
|
|
158
|
+
force: boolean;
|
|
159
|
+
options?: ModuleStateSyncOptions;
|
|
160
|
+
}): Promise<ModuleWatermarks | null>;
|
|
161
|
+
export declare const __moduleStateSyncTest: {
|
|
162
|
+
buildModuleStateSyncPayload: typeof buildModuleStateSyncPayload;
|
|
163
|
+
buildPagedModuleStateSyncPayloads: typeof buildPagedModuleStateSyncPayloads;
|
|
164
|
+
canonicalOrdinalForMessageId: typeof canonicalOrdinalForMessageId;
|
|
165
|
+
loadModuleWatermarks: typeof loadModuleWatermarks;
|
|
166
|
+
moduleWatermarksEqual: typeof moduleWatermarksEqual;
|
|
167
|
+
syncModuleState: typeof syncModuleState;
|
|
168
|
+
};
|
|
169
|
+
//# sourceMappingURL=module-state-sync.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-state-sync.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/module-state-sync.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAoB5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAG1D,MAAM,WAAW,gBAAgB;IAC7B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,EAAE,MAAM,CAAC;IACvB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-raw";
|
|
2
|
+
import type { MessageLike } from "./transform-operations";
|
|
3
|
+
/** The maximum request page size accepted by the module facade. */
|
|
4
|
+
export declare const MODULE_PAGE_MAX_BYTES: number;
|
|
5
|
+
/** Large individual values are split so one message cannot exceed a page. */
|
|
6
|
+
export declare const MODULE_ITEM_CONTINUATION_CHUNK_BYTES: number;
|
|
7
|
+
export declare const MODULE_ITEM_CONTINUATION_KEY = "__shadow_item_continuation";
|
|
8
|
+
export declare const MODULE_ORDINAL_PAGE_SIZE = 500;
|
|
9
|
+
export interface ModuleNormalizationRecord {
|
|
10
|
+
kind: "tag_prefix" | "ctx_search_hint" | "summary_message";
|
|
11
|
+
message_id: string | null;
|
|
12
|
+
part_index: number;
|
|
13
|
+
field: string;
|
|
14
|
+
tag_number?: number;
|
|
15
|
+
removed: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Resolve OpenCode message ids to the absolute ordinals used by the module.
|
|
19
|
+
* The module and shadow lanes must see the same provisional suffix behavior, so
|
|
20
|
+
* this is shared rather than reimplemented by the authority adapter.
|
|
21
|
+
*/
|
|
22
|
+
export declare function resolveOrdinalsForModule(args: {
|
|
23
|
+
sessionId: string;
|
|
24
|
+
messages: MessageLike[];
|
|
25
|
+
generation: number;
|
|
26
|
+
memoGeneration: number;
|
|
27
|
+
memo: Map<string, number>;
|
|
28
|
+
memoAnchor?: RawMessageOrdinalAnchor | null;
|
|
29
|
+
memoStoredCount?: number | null;
|
|
30
|
+
memoCanonicalCount?: number;
|
|
31
|
+
}): Promise<{
|
|
32
|
+
ok: true;
|
|
33
|
+
annotatedInput: unknown[];
|
|
34
|
+
memoGeneration: number;
|
|
35
|
+
memoAnchor: RawMessageOrdinalAnchor | null;
|
|
36
|
+
memoStoredCount: number;
|
|
37
|
+
memoCanonicalCount: number;
|
|
38
|
+
normalizations: ModuleNormalizationRecord[];
|
|
39
|
+
} | {
|
|
40
|
+
ok: false;
|
|
41
|
+
reason: "unresolved" | "mismatch";
|
|
42
|
+
messageId?: string;
|
|
43
|
+
messageIndex?: number;
|
|
44
|
+
messageRole?: string;
|
|
45
|
+
}>;
|
|
46
|
+
/** Flatten the typed builder shape to the module's top-level wire envelope. */
|
|
47
|
+
export declare function toFlatModuleWireBody(payload: {
|
|
48
|
+
method: string;
|
|
49
|
+
params: Record<string, unknown>;
|
|
50
|
+
}): Record<string, unknown>;
|
|
51
|
+
export declare function moduleWireBodyBytes(payload: {
|
|
52
|
+
method: string;
|
|
53
|
+
params: Record<string, unknown>;
|
|
54
|
+
}): number;
|
|
55
|
+
/**
|
|
56
|
+
* Page a transform request without changing any message value. Continuation
|
|
57
|
+
* markers are understood by the module and are only used when a single item is
|
|
58
|
+
* larger than the normal page envelope.
|
|
59
|
+
*/
|
|
60
|
+
export declare function buildPagedModuleTransformPayloads(body: Record<string, unknown>): Record<string, unknown>[];
|
|
61
|
+
export declare const __moduleWireTest: {
|
|
62
|
+
buildPagedModuleTransformPayloads: typeof buildPagedModuleTransformPayloads;
|
|
63
|
+
encodeOpenCodeMessagesToCk: typeof encodeOpenCodeMessagesToCk;
|
|
64
|
+
moduleWireBodyBytes: typeof moduleWireBodyBytes;
|
|
65
|
+
resolveOrdinalsForModule: typeof resolveOrdinalsForModule;
|
|
66
|
+
toFlatModuleWireBody: typeof toFlatModuleWireBody;
|
|
67
|
+
};
|
|
68
|
+
export declare function encodeOpenCodeMessagesToCk(messages: unknown[]): Array<{
|
|
69
|
+
mid: string;
|
|
70
|
+
ordinal: number;
|
|
71
|
+
ck: Record<string, unknown>;
|
|
72
|
+
}>;
|
|
73
|
+
//# sourceMappingURL=module-wire.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-wire.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/module-wire.ts"],"names":[],"mappings":"AAKA,OAAO,EAA8B,KAAK,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAC9F,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wB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IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,CACN,CA+JA;AAED,+EAA+E;AAC/E,wBAAgB,oBAAoB,CAAC,OAAO,EAAE;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE1B;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC,GAAG,MAAM,CAET;AAED;;;;GAIG;AACH,wBAAgB,iCAAiC,CAC7C,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC9B,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAwJ3B;AAED,eAAO,MAAM,gBAAgB;;;;;;CAM5B,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IACnE,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B,CAAC,CAiGD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type PassDegradationKind = "degraded" | "fatal";
|
|
2
|
+
export interface PassDegradation {
|
|
3
|
+
site: string;
|
|
4
|
+
kind: PassDegradationKind;
|
|
5
|
+
}
|
|
6
|
+
export interface PassOutcome {
|
|
7
|
+
degradations: PassDegradation[];
|
|
8
|
+
finalized: boolean;
|
|
9
|
+
record(site: string, kind?: PassDegradationKind): void;
|
|
10
|
+
markFinalized(): void;
|
|
11
|
+
readonly captureEligible: boolean;
|
|
12
|
+
isCaptureEligible(): boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function createPassOutcome(): PassOutcome;
|
|
15
|
+
//# sourceMappingURL=pass-outcome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pass-outcome.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/pass-outcome.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAAG,UAAU,GAAG,OAAO,CAAC;AAEvD,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,mBAAmB,CAAC;CAC7B;AAED,MAAM,WAAW,WAAW;IACxB,YAAY,EAAE,eAAe,EAAE,CAAC;IAChC,SAAS,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,mBAAmB,GAAG,IAAI,CAAC;IACvD,aAAa,IAAI,IAAI,CAAC;IACtB,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC,iBAAiB,IAAI,OAAO,CAAC;CAChC;AAED,wBAAgB,iBAAiB,IAAI,WAAW,CAqB/C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type SessionChunkLine } from "./read-session-formatting";
|
|
2
|
-
import { type RawMessage } from "./read-session-raw";
|
|
2
|
+
import { type RawMessage, type RawMessageOrdinalAnchor, type RawMessageOrdinalEntry, type RawMessageParts } from "./read-session-raw";
|
|
3
3
|
export { extractTexts, hasMeaningfulUserText } from "./read-session-formatting";
|
|
4
4
|
/**
|
|
5
5
|
* Per-session source override for raw message reading.
|
|
@@ -24,10 +24,16 @@ export { extractTexts, hasMeaningfulUserText } from "./read-session-formatting";
|
|
|
24
24
|
*/
|
|
25
25
|
export interface RawMessageProvider {
|
|
26
26
|
readMessages(): RawMessage[];
|
|
27
|
+
readMessagePage?: (afterOrdinal: number, limit: number, finalWatermark: number) => RawMessage[];
|
|
27
28
|
readMessageById?: (messageId: string) => RawMessage | null;
|
|
29
|
+
readMessagePartsById?: (messageId: string) => RawMessageParts | null;
|
|
30
|
+
readMessageOrdinalById?: (messageId: string) => number | null;
|
|
28
31
|
readMessageIdOrdinals?: () => Map<string, number>;
|
|
32
|
+
readMessageOrdinalPage?: (after: RawMessageOrdinalAnchor | null, limit: number) => RawMessageOrdinalEntry[];
|
|
29
33
|
/** Optional fast count path; falls back to readMessages().length. */
|
|
30
34
|
getMessageCount?: () => number;
|
|
35
|
+
/** Stored row count including compaction summaries, used for ordinal drift detection. */
|
|
36
|
+
getStoredMessageCount?: () => number;
|
|
31
37
|
}
|
|
32
38
|
/**
|
|
33
39
|
* Register a per-session source for raw message reading. Returns an
|
|
@@ -79,6 +85,12 @@ export interface SessionChunk {
|
|
|
79
85
|
}
|
|
80
86
|
export declare function withRawSessionMessageCache<T>(fn: () => T): T;
|
|
81
87
|
export declare function readRawSessionMessages(sessionId: string): RawMessage[];
|
|
88
|
+
export declare namespace readRawSessionMessages {
|
|
89
|
+
var readPage: typeof readRawSessionMessagePage;
|
|
90
|
+
var getCount: typeof getRawSessionMessageOrdinalCount;
|
|
91
|
+
}
|
|
92
|
+
export declare function readRawSessionMessagePage(sessionId: string, afterOrdinal: number, limit: number, finalWatermark: number): RawMessage[];
|
|
93
|
+
export declare function getRawSessionMessageOrdinalCount(sessionId: string): number;
|
|
82
94
|
/**
|
|
83
95
|
* Prime the active raw-message cache with a TAIL-ONLY read (only messages
|
|
84
96
|
* at/after the last compartment boundary), so subsequent
|
|
@@ -133,7 +145,11 @@ export declare function primeInMemoryTailRawMessageCache(args: {
|
|
|
133
145
|
messages: RawMessage[];
|
|
134
146
|
absoluteMessageCount: number;
|
|
135
147
|
}): boolean;
|
|
148
|
+
export declare function readRawSessionMessageOrdinalPage(sessionId: string, after: RawMessageOrdinalAnchor | null, limit: number): RawMessageOrdinalEntry[];
|
|
149
|
+
export declare function getRawSessionStoredMessageCount(sessionId: string): number;
|
|
136
150
|
export declare function readRawSessionMessageIdOrdinals(sessionId: string): Map<string, number>;
|
|
151
|
+
export declare function readRawSessionMessagePartsById(sessionId: string, messageId: string): RawMessageParts | null;
|
|
152
|
+
export declare function readRawSessionMessageOrdinalById(sessionId: string, messageId: string): number | null;
|
|
137
153
|
export declare function readRawSessionMessageById(sessionId: string, messageId: string): RawMessage | null;
|
|
138
154
|
export declare function getRawSessionMessageCount(sessionId: string): number;
|
|
139
155
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-session-chunk.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/read-session-chunk.ts"],"names":[],"mappings":"AAOA,OAAO,EAWH,KAAK,gBAAgB,EACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,
|
|
1
|
+
{"version":3,"file":"read-session-chunk.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/read-session-chunk.ts"],"names":[],"mappings":"AAOA,OAAO,EAWH,KAAK,gBAAgB,EACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAGH,KAAK,UAAU,EACf,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,EAC3B,KAAK,eAAe,EASvB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAgDhF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,kBAAkB;IAC/B,YAAY,IAAI,UAAU,EAAE,CAAC;IAC7B,eAAe,CAAC,EAAE,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,UAAU,EAAE,CAAC;IAChG,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,UAAU,GAAG,IAAI,CAAC;IAC3D,oBAAoB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,eAAe,GAAG,IAAI,CAAC;IACrE,sBAAsB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,GAAG,IAAI,CAAC;IAC9D,qBAAqB,CAAC,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E,MAAM,GAClB,MAAM,GAAG,IAAI,CAiCf;AAED,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAUjG;AAcD,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAQnE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,iBAAiB;IAC9B,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;CAC9C;AAED,wBAAgB,2BAA2B,CACvC,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,MAAM,GACzB,iBAAiB,CA2DnB;AAID,wBAAgB,kCAAkC,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAS5E;AAED,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEtE;AAED,wBAAgB,gBAAgB,CAC5B,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,MAAM,GAAE,MAAU,EAClB,kBAAkB,CAAC,EAAE,MAAM,GAC5B,YAAY,CAmNd;AAED,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAK9F"}
|
|
@@ -1,20 +1,41 @@
|
|
|
1
1
|
import type { Database } from "../../shared/sqlite";
|
|
2
|
-
export interface
|
|
3
|
-
ordinal: number;
|
|
2
|
+
export interface RawMessageParts {
|
|
4
3
|
id: string;
|
|
5
4
|
role: string;
|
|
6
5
|
parts: unknown[];
|
|
7
6
|
createdAt?: number | null;
|
|
8
7
|
version?: string | number | null;
|
|
9
8
|
}
|
|
9
|
+
export interface RawMessage extends RawMessageParts {
|
|
10
|
+
ordinal: number;
|
|
11
|
+
}
|
|
12
|
+
export interface RawMessageOrdinalAnchor {
|
|
13
|
+
timeCreated: number;
|
|
14
|
+
id: string;
|
|
15
|
+
}
|
|
16
|
+
export interface RawMessageOrdinalEntry extends RawMessageOrdinalAnchor {
|
|
17
|
+
contributesOrdinal: boolean;
|
|
18
|
+
hasValidInfo: boolean;
|
|
19
|
+
}
|
|
10
20
|
export declare function isRawCompactionSummaryInfo(info: unknown): boolean;
|
|
11
21
|
export declare function readRawSessionMessagesFromDb(db: Database, sessionId: string): RawMessage[];
|
|
22
|
+
/**
|
|
23
|
+
* Read one bounded page from the canonical raw-message ordinal space. Message
|
|
24
|
+
* and part JSON parsing is limited to the requested page so background FTS work
|
|
25
|
+
* cannot monopolize the event loop by hydrating an entire long session.
|
|
26
|
+
*/
|
|
27
|
+
export declare function readRawSessionMessagePageFromDb(db: Database, sessionId: string, afterOrdinal: number, limit: number, finalWatermark?: number): RawMessage[];
|
|
28
|
+
export declare function countRawSessionMessageOrdinalsFromDb(db: Database, sessionId: string): number;
|
|
12
29
|
/**
|
|
13
30
|
* Read the canonical raw-message ordinal space without loading or parsing part rows.
|
|
14
31
|
* Keep the ordering, summary predicate, and malformed-message behavior identical to
|
|
15
32
|
* `readRawSessionMessagesFromDb`; consumers compare these ordinals across passes.
|
|
16
33
|
*/
|
|
17
34
|
export declare function readRawSessionMessageIdOrdinalsFromDb(db: Database, sessionId: string): Map<string, number>;
|
|
35
|
+
/** Read a keyset page used to incrementally maintain shadow message ordinals. */
|
|
36
|
+
export declare function readRawSessionMessageOrdinalPageFromDb(db: Database, sessionId: string, after: RawMessageOrdinalAnchor | null, limit: number): RawMessageOrdinalEntry[];
|
|
37
|
+
/** Count stored rows without inspecting message JSON, allowing the session-id index to answer it. */
|
|
38
|
+
export declare function countStoredRawSessionMessagesFromDb(db: Database, sessionId: string): number;
|
|
18
39
|
/**
|
|
19
40
|
* Read ONLY the eligible tail — messages at/after the last compartment boundary
|
|
20
41
|
* — assigning them their correct ABSOLUTE ordinals (continuing from
|
|
@@ -105,5 +126,12 @@ export declare function buildInMemoryTailRawMessages(args: {
|
|
|
105
126
|
lastCompartmentEnd: number;
|
|
106
127
|
anchorMessageId: string | null;
|
|
107
128
|
}): InMemoryTailResult | null;
|
|
129
|
+
export declare function readRawSessionMessagePartsByIdFromDb(db: Database, sessionId: string, messageId: string): RawMessageParts | null;
|
|
130
|
+
/**
|
|
131
|
+
* Resolve one message ID in the canonical raw-message ordinal space. Synthetic
|
|
132
|
+
* compaction summaries are excluded so this count matches every module wire
|
|
133
|
+
* ordinal and does not depend on the stored compartment basis.
|
|
134
|
+
*/
|
|
135
|
+
export declare function readRawSessionMessageOrdinalByIdFromDb(db: Database, sessionId: string, messageId: string): number | null;
|
|
108
136
|
export declare function readRawSessionMessageByIdFromDb(db: Database, sessionId: string, messageId: string): RawMessage | null;
|
|
109
137
|
//# sourceMappingURL=read-session-raw.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"read-session-raw.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/read-session-raw.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"read-session-raw.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/read-session-raw.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,EAAE,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CACpC;AAED,MAAM,WAAW,UAAW,SAAQ,eAAe;IAC/C,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACpC,WAAW,EAAE,MAAM,CAAC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
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recomp-orchestrator.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/recomp-orchestrator.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAGH,KAAK,kBAAkB,EAC1B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"recomp-orchestrator.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/recomp-orchestrator.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAGH,KAAK,kBAAkB,EAC1B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAYtE;;;;;;;;;;;;;;;;GAgBG;AAEH;;mBAEmB;AACnB,MAAM,WAAW,oBAAoB;IACjC,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,EAAE,EAAE,QAAQ,CAAC;IACb,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,kFAAkF;IAClF,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,8EAA8E;IAC9E,cAAc,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;6EAGyE;I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EACpC,OAAO,EAAE,MAAM,GAChB,IAAI,CAyBN;AA4ED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAClC,GAAG,EAAE,oBAAoB,EACzB,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,kBAAkB,CAAA;CAAE,GACzC,OAAO,CAAC,MAAM,CAAC,CAyCjB;AAED,wBAAsB,iBAAiB,CACnC,GAAG,EAAE,oBAAoB,EACzB,SAAS,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CAqHjB"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { getOrCreateSessionMeta } from "../../features/magic-context/storage";
|
|
2
|
+
import { type ModuleCompartmentMirrorResponse, type ModuleStateSyncClient, type ModuleStateSyncState } from "./module-state-sync";
|
|
3
|
+
import type { RawMessageOrdinalAnchor } from "./read-session-raw";
|
|
4
|
+
import type { TransformDeps } from "./transform";
|
|
5
|
+
import type { MessageLike } from "./transform-operations";
|
|
6
|
+
export interface RustModeModuleClient extends ModuleStateSyncClient {
|
|
7
|
+
closeSession?(sessionId: string): void;
|
|
8
|
+
getCompartmentsAfter?(sessionId: string, afterSequence: number): Promise<ModuleCompartmentMirrorResponse>;
|
|
9
|
+
}
|
|
10
|
+
interface RustSessionState extends ModuleStateSyncState {
|
|
11
|
+
initialized: boolean;
|
|
12
|
+
consecutiveFailures: number;
|
|
13
|
+
passCount: number;
|
|
14
|
+
parked: boolean;
|
|
15
|
+
passesSincePark: number;
|
|
16
|
+
warningSent: boolean;
|
|
17
|
+
ordinalMemoAnchor: RawMessageOrdinalAnchor | null;
|
|
18
|
+
ordinalMemoStoredCount: number | null;
|
|
19
|
+
ordinalMemoCanonicalCount: number;
|
|
20
|
+
failureCount: number;
|
|
21
|
+
parkCount: number;
|
|
22
|
+
}
|
|
23
|
+
export interface RustModeTransformOptions {
|
|
24
|
+
moduleClient: RustModeModuleClient;
|
|
25
|
+
hostClient?: unknown;
|
|
26
|
+
projectRoot?: string;
|
|
27
|
+
notifyParked?: (sessionId: string, message: string) => void;
|
|
28
|
+
moduleTimeoutMs?: number;
|
|
29
|
+
memorySyncRequestedSessions?: Set<string>;
|
|
30
|
+
}
|
|
31
|
+
declare function directiveTextOf(response: Record<string, unknown>): string | undefined;
|
|
32
|
+
/** Single response-field seam for the parallel module encode-back contract. */
|
|
33
|
+
export declare function applyNativeMessagesVerbatim(output: {
|
|
34
|
+
messages: unknown[];
|
|
35
|
+
}, response: Record<string, unknown>): unknown[];
|
|
36
|
+
declare function buildTransformBody(args: {
|
|
37
|
+
sessionId: string;
|
|
38
|
+
input: unknown[];
|
|
39
|
+
nativeMessages: unknown[];
|
|
40
|
+
passInputs: Record<string, unknown>;
|
|
41
|
+
usage: Record<string, number>;
|
|
42
|
+
modelKey: string | null;
|
|
43
|
+
providerId: string | null;
|
|
44
|
+
midTurn: boolean;
|
|
45
|
+
declaredTrim?: unknown;
|
|
46
|
+
}): Record<string, unknown>;
|
|
47
|
+
export declare function createRustModeTransform(deps: TransformDeps, options: RustModeTransformOptions): {
|
|
48
|
+
run: (sessionId: string, messages: MessageLike[], output: {
|
|
49
|
+
messages: unknown[];
|
|
50
|
+
}, sessionMeta: ReturnType<typeof getOrCreateSessionMeta>) => Promise<void>;
|
|
51
|
+
clearSession: (sessionId: string) => void;
|
|
52
|
+
getState: (sessionId: string) => Readonly<RustSessionState>;
|
|
53
|
+
};
|
|
54
|
+
export declare function runRustModeTransform(transform: ReturnType<typeof createRustModeTransform>, sessionId: string, messages: MessageLike[], output: {
|
|
55
|
+
messages: unknown[];
|
|
56
|
+
}, sessionMeta: ReturnType<typeof getOrCreateSessionMeta>): Promise<void>;
|
|
57
|
+
export declare const __rustModeTransformTest: {
|
|
58
|
+
applyNativeMessagesVerbatim: typeof applyNativeMessagesVerbatim;
|
|
59
|
+
buildTransformBody: typeof buildTransformBody;
|
|
60
|
+
createRustModeTransform: typeof createRustModeTransform;
|
|
61
|
+
directiveTextOf: typeof directiveTextOf;
|
|
62
|
+
};
|
|
63
|
+
export {};
|
|
64
|
+
//# sourceMappingURL=rust-mode-transform.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rust-mode-transform.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/rust-mode-transform.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAgBnF,OAAO,EACH,KAAK,+BAA+B,EAEpC,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,EAG5B,MAAM,qBAAqB,CAAC;AAO7B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAM1D,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IAC/D,YAAY,CAAC,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACvC,oBAAoB,CAAC,CACjB,SAAS,EAAE,MAAM,EACjB,aAAa,EAAE,MAAM,GACtB,OAAO,CAAC,+BAA+B,CAAC,CAAC;CAC/C;AAED,UAAU,gBAAiB,SAAQ,oBAAoB;IACnD,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,OAAO,CAAC;IACrB,iBAAiB,EAAE,uBAAuB,GAAG,IAAI,CAAC;IAClD,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,yBAAyB,EAAE,MAAM,CAAC;IAClC,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,wBAAwB;IACrC,YAAY,EAAE,oBAAoB,CAAC;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