@memory-river/core 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +222 -0
- package/README.zh-TW.md +186 -0
- package/dist/api.d.ts +100 -0
- package/dist/api.js +156 -0
- package/dist/cognition/causal-attribution.d.ts +36 -0
- package/dist/cognition/causal-attribution.js +239 -0
- package/dist/cognition/causal-engine.d.ts +105 -0
- package/dist/cognition/causal-engine.js +150 -0
- package/dist/cognition/conflict-detector.d.ts +39 -0
- package/dist/cognition/conflict-detector.js +193 -0
- package/dist/cognition/global-working-memory.d.ts +53 -0
- package/dist/cognition/global-working-memory.js +211 -0
- package/dist/cognition/hooks-engine.d.ts +99 -0
- package/dist/cognition/hooks-engine.js +672 -0
- package/dist/cognition/ralph-core.d.ts +28 -0
- package/dist/cognition/ralph-core.js +104 -0
- package/dist/distill/concentrator-adapter.d.ts +167 -0
- package/dist/distill/concentrator-adapter.js +1876 -0
- package/dist/engine.d.ts +402 -0
- package/dist/engine.js +2254 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +3 -0
- package/dist/lifecycle/cleanup-engine.d.ts +80 -0
- package/dist/lifecycle/cleanup-engine.js +162 -0
- package/dist/lifecycle/cleanup-state.d.ts +34 -0
- package/dist/lifecycle/cleanup-state.js +50 -0
- package/dist/lifecycle/night-consolidation.d.ts +102 -0
- package/dist/lifecycle/night-consolidation.js +640 -0
- package/dist/lifecycle/night-recovery.d.ts +40 -0
- package/dist/lifecycle/night-recovery.js +107 -0
- package/dist/paths.d.ts +17 -0
- package/dist/paths.js +16 -0
- package/dist/pipeline/capsule-bridge.d.ts +35 -0
- package/dist/pipeline/capsule-bridge.js +86 -0
- package/dist/pipeline/compact-request.d.ts +30 -0
- package/dist/pipeline/compact-request.js +66 -0
- package/dist/pipeline/inbox-watcher.d.ts +112 -0
- package/dist/pipeline/inbox-watcher.js +1039 -0
- package/dist/ports.d.ts +29 -0
- package/dist/ports.js +1 -0
- package/dist/providers/embedder-v5.d.ts +46 -0
- package/dist/providers/embedder-v5.js +155 -0
- package/dist/providers/ollama-embedding.d.ts +25 -0
- package/dist/providers/ollama-embedding.js +166 -0
- package/dist/retrieval/abstractness-judge.d.ts +14 -0
- package/dist/retrieval/abstractness-judge.js +87 -0
- package/dist/retrieval/coverage-selection.d.ts +3 -0
- package/dist/retrieval/coverage-selection.js +53 -0
- package/dist/retrieval/cross-encoder-gate.d.ts +40 -0
- package/dist/retrieval/cross-encoder-gate.js +239 -0
- package/dist/retrieval/retriever-v4.d.ts +78 -0
- package/dist/retrieval/retriever-v4.js +1200 -0
- package/dist/skills/validate.d.ts +6 -0
- package/dist/skills/validate.js +69 -0
- package/dist/storage.d.ts +19 -0
- package/dist/storage.js +54 -0
- package/dist/store/aux-table-maintenance.d.ts +5 -0
- package/dist/store/aux-table-maintenance.js +64 -0
- package/dist/store/graph-enumerator.d.ts +21 -0
- package/dist/store/graph-enumerator.js +185 -0
- package/dist/store/graph-store.d.ts +107 -0
- package/dist/store/graph-store.js +478 -0
- package/dist/store/status-manager.d.ts +44 -0
- package/dist/store/status-manager.js +235 -0
- package/dist/store/store-v4.d.ts +339 -0
- package/dist/store/store-v4.js +2871 -0
- package/dist/transcript/keyword-search.d.ts +9 -0
- package/dist/transcript/keyword-search.js +67 -0
- package/dist/transcript/rehydrate-keyword.d.ts +6 -0
- package/dist/transcript/rehydrate-keyword.js +29 -0
- package/dist/transcript/rehydrate.d.ts +33 -0
- package/dist/transcript/rehydrate.js +285 -0
- package/dist/transcript/transcript-archive.d.ts +46 -0
- package/dist/transcript/transcript-archive.js +516 -0
- package/dist/types.d.ts +409 -0
- package/dist/types.js +104 -0
- package/dist/util/bounded-map.d.ts +1 -0
- package/dist/util/bounded-map.js +8 -0
- package/dist/util/rate-limiter.d.ts +12 -0
- package/dist/util/rate-limiter.js +54 -0
- package/dist/util/session-identity.d.ts +65 -0
- package/dist/util/session-identity.js +227 -0
- package/dist/util/util-hash.d.ts +1 -0
- package/dist/util/util-hash.js +4 -0
- package/package.json +59 -0
package/dist/engine.d.ts
ADDED
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
import { MemoryStore } from './store/store-v4.js';
|
|
2
|
+
import { type HybridSearchResponse } from './retrieval/retriever-v4.js';
|
|
3
|
+
import { type InjectedMemory } from './cognition/causal-attribution.js';
|
|
4
|
+
import { type CleanupState, type StartupRecoveryLimits } from './lifecycle/cleanup-state.js';
|
|
5
|
+
import type { ArchiveSnapshotResult } from './transcript/transcript-archive.js';
|
|
6
|
+
import { type PluginConfig, type ContextMessage, type EnumerationPlan, type MemoryEntry, type MemorySearchResult, type SkillCapsuleV2, type SkillDef, type SkillIndexEntry, type StatusChangeRequest, type StatusChangeResult, type SubsystemEffectivenessEvent } from './types.js';
|
|
7
|
+
import type { EmbeddingProvider, LlmClient, Logger } from './ports.js';
|
|
8
|
+
import { type SessionIdentity } from './util/session-identity.js';
|
|
9
|
+
import { type AsyncCompactRequest } from './pipeline/compact-request.js';
|
|
10
|
+
import { type NightRecoverySource } from './lifecycle/night-recovery.js';
|
|
11
|
+
export interface MemoryRiverEngineDeps {
|
|
12
|
+
paths: {
|
|
13
|
+
rerankerCacheDir: string;
|
|
14
|
+
consolidationLog: string;
|
|
15
|
+
stateDir: string;
|
|
16
|
+
walFile: string;
|
|
17
|
+
sessionSummaryDir: string;
|
|
18
|
+
trashDir: string;
|
|
19
|
+
gwmStateFile: string;
|
|
20
|
+
};
|
|
21
|
+
transcriptArchive: {
|
|
22
|
+
archiveSnapshot: any;
|
|
23
|
+
clearTranscriptCache: () => void;
|
|
24
|
+
};
|
|
25
|
+
notifier?: import('./ports.js').Notifier;
|
|
26
|
+
embedder?: EmbeddingProvider;
|
|
27
|
+
llm?: LlmClient;
|
|
28
|
+
logger?: Logger;
|
|
29
|
+
deriveSessionFile(args: {
|
|
30
|
+
sessionId?: string;
|
|
31
|
+
sessionKey?: string;
|
|
32
|
+
}): string | null;
|
|
33
|
+
ollamaUrl: string;
|
|
34
|
+
geminiApiKey: string;
|
|
35
|
+
deepseekApiKey: string;
|
|
36
|
+
}
|
|
37
|
+
type SessionFileMappingRecord = {
|
|
38
|
+
trackingKey: string;
|
|
39
|
+
sessionKey?: string;
|
|
40
|
+
sessionId?: string;
|
|
41
|
+
sessionFile: string;
|
|
42
|
+
updatedAt: number;
|
|
43
|
+
source: 'maintain' | 'compact' | 'fallback';
|
|
44
|
+
};
|
|
45
|
+
type RecentLlmIdentity = {
|
|
46
|
+
model: string | null;
|
|
47
|
+
provider: string | null;
|
|
48
|
+
updatedAt: number;
|
|
49
|
+
};
|
|
50
|
+
type GwmPendingEpisode = {
|
|
51
|
+
episodeId: string;
|
|
52
|
+
injectionOrdinal: number;
|
|
53
|
+
queryHash: string;
|
|
54
|
+
similarityAtInjection: number;
|
|
55
|
+
preInjectDriftRoundCount: number | null;
|
|
56
|
+
roundsSinceLastInjection: number | null;
|
|
57
|
+
taskDescriptionHash: string;
|
|
58
|
+
llmModel: string | null;
|
|
59
|
+
llmProvider: string | null;
|
|
60
|
+
};
|
|
61
|
+
type GwmSessionEpisodeState = {
|
|
62
|
+
injectionCount: number;
|
|
63
|
+
turnIndex: number;
|
|
64
|
+
lastInjectionTurnIndex: number | null;
|
|
65
|
+
pendingEpisode: GwmPendingEpisode | null;
|
|
66
|
+
};
|
|
67
|
+
export declare class MemoryRiverEngine {
|
|
68
|
+
private config;
|
|
69
|
+
private deps;
|
|
70
|
+
constructor(config: Required<PluginConfig>, deps: MemoryRiverEngineDeps);
|
|
71
|
+
configure(config: Required<PluginConfig>, deps: MemoryRiverEngineDeps): void;
|
|
72
|
+
private activeConcentrator;
|
|
73
|
+
private retrieverRef;
|
|
74
|
+
private isAutoRecallEnabled;
|
|
75
|
+
private gwmRef;
|
|
76
|
+
private cleanupEngineRef;
|
|
77
|
+
private nightConsolidatorRef;
|
|
78
|
+
private memoryStoreRef;
|
|
79
|
+
private embedderRef;
|
|
80
|
+
private hooksEngineRef;
|
|
81
|
+
private graphStoreRef;
|
|
82
|
+
private inboxWatcherRef;
|
|
83
|
+
private causalEngineRef;
|
|
84
|
+
private conflictDetectorRef;
|
|
85
|
+
private statusManagerRef;
|
|
86
|
+
private capsuleBridgeRef;
|
|
87
|
+
private pluginInitPromise;
|
|
88
|
+
private pluginInitialized;
|
|
89
|
+
private pluginInitError;
|
|
90
|
+
private fallbackObserverRegistered;
|
|
91
|
+
private cleanupEngineInstanceRegistered;
|
|
92
|
+
private nightTimerId;
|
|
93
|
+
private nightIntervalId;
|
|
94
|
+
private nightHealthCheckIntervalId;
|
|
95
|
+
private nightStartupRecoveryTimerId;
|
|
96
|
+
private nightConsolidatorIsRunning;
|
|
97
|
+
private lastNightConsolidatorSuccessfulRunAt;
|
|
98
|
+
private cleanupTimeoutId;
|
|
99
|
+
private cleanupIntervalId;
|
|
100
|
+
private lastCleanupSuccessfulRunAt;
|
|
101
|
+
private activePluginConfig;
|
|
102
|
+
initFailedResult(err: any): {
|
|
103
|
+
content: {
|
|
104
|
+
type: string;
|
|
105
|
+
text: string;
|
|
106
|
+
}[];
|
|
107
|
+
isError: boolean;
|
|
108
|
+
};
|
|
109
|
+
recordPluginInitSmokeStat(store: any, outcome: 'succeeded' | 'failed', err?: any): Promise<void>;
|
|
110
|
+
private sessionTokenWatermark;
|
|
111
|
+
private sessionCompactWatermark;
|
|
112
|
+
private sessionFileMappings;
|
|
113
|
+
private recentlyCompacted;
|
|
114
|
+
private lastArchivedLineCount;
|
|
115
|
+
private maintainLocks;
|
|
116
|
+
private skillLocks;
|
|
117
|
+
private queuedAsyncCompactKeys;
|
|
118
|
+
private runningAsyncCompactKeys;
|
|
119
|
+
private pendingAttribution;
|
|
120
|
+
private recentLlmIdentityByKey;
|
|
121
|
+
private gwmSessionState;
|
|
122
|
+
private lastObservedSessionIdentity;
|
|
123
|
+
pickNonEmptyString(value: unknown): string | null;
|
|
124
|
+
addAttributionKey(keys: Set<string>, prefix: string, value: unknown): void;
|
|
125
|
+
extractAttributionRequestKeyFromArgs(...args: unknown[]): string | null;
|
|
126
|
+
extractAutoRecallResultsObserverFromArgs(...args: unknown[]): ((event: {
|
|
127
|
+
query: string;
|
|
128
|
+
results: MemorySearchResult[];
|
|
129
|
+
}) => void) | null;
|
|
130
|
+
attributionKeysFromIdentity(identity: SessionIdentity, requestKey?: string | null): string[];
|
|
131
|
+
attributionKeysFromLlmOutput(event: any, ctx: any): string[];
|
|
132
|
+
getRecentLlmIdentityForKeys(keys: string[]): RecentLlmIdentity | null;
|
|
133
|
+
getOrCreateGwmSessionState(sessionKey: string): GwmSessionEpisodeState;
|
|
134
|
+
cleanupPendingAttribution(now?: number): void;
|
|
135
|
+
rememberInjectedMemories(identity: SessionIdentity, injected: InjectedMemory[], requestKey?: string | null): void;
|
|
136
|
+
takePendingAttribution(keys: string[]): InjectedMemory[];
|
|
137
|
+
getAsyncCompactConcurrency(): number;
|
|
138
|
+
countFileLines(filePath: string): Promise<number>;
|
|
139
|
+
enqueueAsyncCompact(req: AsyncCompactRequest): void;
|
|
140
|
+
processAsyncCompactRequest(req: AsyncCompactRequest): Promise<void>;
|
|
141
|
+
get asyncCompactTestHooks(): {
|
|
142
|
+
enqueue: (req: AsyncCompactRequest) => void;
|
|
143
|
+
reset: () => void;
|
|
144
|
+
setInboxPath: (inboxPath: string) => void;
|
|
145
|
+
isQueued: (trackingKey: string) => boolean;
|
|
146
|
+
};
|
|
147
|
+
setWatermark(canonicalKey: string, value: number): void;
|
|
148
|
+
setCompactWatermark(canonicalKey: string, value: number): void;
|
|
149
|
+
setSessionFileMapping(canonicalKey: string, record: SessionFileMappingRecord): void;
|
|
150
|
+
setArchivedLineCount(key: string, sessionId: string | null, lineCount: number): void;
|
|
151
|
+
resolveArchivedLineCount(store: MemoryStore | null, canonicalKey: string, sessionId: string | null): Promise<{
|
|
152
|
+
sessionId: string | null;
|
|
153
|
+
lineCount: number;
|
|
154
|
+
}>;
|
|
155
|
+
persistArchivedLineCount(store: MemoryStore | null, canonicalKey: string, sessionId: string | null, lineCount: number): Promise<void>;
|
|
156
|
+
markRecentlyCompacted(canonicalKey: string): void;
|
|
157
|
+
wasRecentlyCompacted(canonicalKey: string): boolean;
|
|
158
|
+
deriveSessionFileFromStaticRule(args: {
|
|
159
|
+
sessionId?: string;
|
|
160
|
+
sessionKey?: string;
|
|
161
|
+
}): string | null;
|
|
162
|
+
resolveSessionFile(args: {
|
|
163
|
+
sessionKey?: string;
|
|
164
|
+
sessionId?: string;
|
|
165
|
+
session?: any;
|
|
166
|
+
}): {
|
|
167
|
+
sessionFile: string | null;
|
|
168
|
+
source: 'cache' | 'fallback' | 'none';
|
|
169
|
+
};
|
|
170
|
+
init(): Promise<void>;
|
|
171
|
+
clearNightConsolidatorTimers(): void;
|
|
172
|
+
recordNightConsolidationStat(stat: Parameters<MemoryStore['recordNightConsolidationStat']>[0]): void;
|
|
173
|
+
getLastSuccessfulNightRunTs(): Promise<number | null>;
|
|
174
|
+
runNightConsolidatorNow(runId?: `${string}-${string}-${string}-${string}-${string}`, scheduledFor?: number, source?: NightRecoverySource): Promise<void>;
|
|
175
|
+
tryRunNightConsolidator(source: NightRecoverySource, runId?: `${string}-${string}-${string}-${string}-${string}`, scheduledFor?: number): Promise<void>;
|
|
176
|
+
scheduleNightConsolidator(): void;
|
|
177
|
+
clearCleanupEngineTimers(): void;
|
|
178
|
+
runCleanupEngineNow(source: 'daily-schedule' | 'startup-recovery' | 'session-end'): Promise<void>;
|
|
179
|
+
recordCleanupSuccess(result: {
|
|
180
|
+
deleted: number;
|
|
181
|
+
updated: number;
|
|
182
|
+
}): void;
|
|
183
|
+
getStartupRecoveryLimits(): StartupRecoveryLimits;
|
|
184
|
+
formatHours(hours: number): string;
|
|
185
|
+
formatCandidateSummary(summary: {
|
|
186
|
+
count: number;
|
|
187
|
+
firstId: string | null;
|
|
188
|
+
lastId: string | null;
|
|
189
|
+
minCreatedAt: number | null;
|
|
190
|
+
maxCreatedAt: number | null;
|
|
191
|
+
createdAtByDay: Record<string, number>;
|
|
192
|
+
}): string;
|
|
193
|
+
shouldScheduleStartupRecoveryFromState(state: CleanupState | null, nowMs?: number): import("./lifecycle/cleanup-state.js").StartupRecoveryDecision;
|
|
194
|
+
runStartupRecoveryWithProtection(): Promise<void>;
|
|
195
|
+
scheduleCleanupEngine(): void;
|
|
196
|
+
/** 提取訊息陣列 */
|
|
197
|
+
extractMessages(...args: any[]): any[];
|
|
198
|
+
normalizeFrameworkLine(line: string): string;
|
|
199
|
+
metadataHeadingLength(text: string): number;
|
|
200
|
+
stripLeadingUntrustedMetadataBlocks(text: string): string;
|
|
201
|
+
/** 提取最後一則 User 訊息文字 */
|
|
202
|
+
extractLastUserMessage(msgs: any[]): string;
|
|
203
|
+
recordHookPromptIncludedEvents(store: any, results: any[], searchResponse: Pick<HybridSearchResponse, "hookOriginIds" | "hookOriginKeywords" | "queryHash"> | null | undefined): void;
|
|
204
|
+
recordGwmEffectiveness(store: any, event: Partial<SubsystemEffectivenessEvent>): void;
|
|
205
|
+
executeMemoryRecall(params: any): Promise<{
|
|
206
|
+
content: {
|
|
207
|
+
type: string;
|
|
208
|
+
text: string;
|
|
209
|
+
}[];
|
|
210
|
+
isError: boolean;
|
|
211
|
+
} | {
|
|
212
|
+
content: {
|
|
213
|
+
type: string;
|
|
214
|
+
text: string;
|
|
215
|
+
}[];
|
|
216
|
+
}>;
|
|
217
|
+
executeMemoryStore(params: any): Promise<{
|
|
218
|
+
content: {
|
|
219
|
+
type: string;
|
|
220
|
+
text: string;
|
|
221
|
+
}[];
|
|
222
|
+
isError: boolean;
|
|
223
|
+
} | {
|
|
224
|
+
content: {
|
|
225
|
+
type: string;
|
|
226
|
+
text: string;
|
|
227
|
+
}[];
|
|
228
|
+
isError?: undefined;
|
|
229
|
+
}>;
|
|
230
|
+
remember(text: string, opts?: {
|
|
231
|
+
category?: string;
|
|
232
|
+
importance?: number;
|
|
233
|
+
metadata?: object;
|
|
234
|
+
}): Promise<MemoryEntry>;
|
|
235
|
+
updateMemory(id: string, updates: Partial<Pick<MemoryEntry, 'text' | 'category' | 'importance' | 'metadata'>>): Promise<boolean>;
|
|
236
|
+
setMemoryStatus(req: StatusChangeRequest): Promise<StatusChangeResult>;
|
|
237
|
+
recall(query: string, limit?: number): Promise<MemorySearchResult[]>;
|
|
238
|
+
enumerate(plan: EnumerationPlan, limit?: number): Promise<MemorySearchResult[]>;
|
|
239
|
+
searchMemory(query: string, limit?: number): Promise<MemorySearchResult[]>;
|
|
240
|
+
private withSkillLock;
|
|
241
|
+
saveSkill(def: SkillDef): Promise<{
|
|
242
|
+
id: string;
|
|
243
|
+
}>;
|
|
244
|
+
searchSkills(query: string, limit?: number): Promise<SkillIndexEntry[]>;
|
|
245
|
+
loadSkill(name: string): Promise<SkillCapsuleV2 | null>;
|
|
246
|
+
listSkills(): Promise<SkillIndexEntry[]>;
|
|
247
|
+
private toSkillCapsuleV2;
|
|
248
|
+
gwmNotInitializedResult(): {
|
|
249
|
+
content: {
|
|
250
|
+
type: string;
|
|
251
|
+
text: string;
|
|
252
|
+
}[];
|
|
253
|
+
isError: boolean;
|
|
254
|
+
};
|
|
255
|
+
executeGwmOn(params: any): Promise<{
|
|
256
|
+
content: {
|
|
257
|
+
type: string;
|
|
258
|
+
text: string;
|
|
259
|
+
}[];
|
|
260
|
+
isError: boolean;
|
|
261
|
+
} | {
|
|
262
|
+
content: {
|
|
263
|
+
type: string;
|
|
264
|
+
text: string;
|
|
265
|
+
}[];
|
|
266
|
+
}>;
|
|
267
|
+
executeGwmOff(): Promise<{
|
|
268
|
+
content: {
|
|
269
|
+
type: string;
|
|
270
|
+
text: string;
|
|
271
|
+
}[];
|
|
272
|
+
isError: boolean;
|
|
273
|
+
} | {
|
|
274
|
+
content: {
|
|
275
|
+
type: string;
|
|
276
|
+
text: string;
|
|
277
|
+
}[];
|
|
278
|
+
}>;
|
|
279
|
+
executeGwmStatus(): {
|
|
280
|
+
content: {
|
|
281
|
+
type: string;
|
|
282
|
+
text: string;
|
|
283
|
+
}[];
|
|
284
|
+
isError: boolean;
|
|
285
|
+
} | {
|
|
286
|
+
content: {
|
|
287
|
+
type: string;
|
|
288
|
+
text: string;
|
|
289
|
+
}[];
|
|
290
|
+
};
|
|
291
|
+
executeGwmUpdate(params: any): Promise<{
|
|
292
|
+
content: {
|
|
293
|
+
type: string;
|
|
294
|
+
text: string;
|
|
295
|
+
}[];
|
|
296
|
+
isError: boolean;
|
|
297
|
+
} | {
|
|
298
|
+
content: {
|
|
299
|
+
type: string;
|
|
300
|
+
text: string;
|
|
301
|
+
}[];
|
|
302
|
+
}>;
|
|
303
|
+
get testHooks(): {
|
|
304
|
+
resetState: () => void;
|
|
305
|
+
setState: (state: any) => void;
|
|
306
|
+
getState: () => any;
|
|
307
|
+
ensurePluginInitialized: (_config?: PluginConfig) => Promise<void>;
|
|
308
|
+
recordPluginInitSmokeStat: (store: any, outcome: "succeeded" | "failed", err?: any) => Promise<void>;
|
|
309
|
+
executeMemoryRecall: (params: any, _config?: PluginConfig) => Promise<{
|
|
310
|
+
content: {
|
|
311
|
+
type: string;
|
|
312
|
+
text: string;
|
|
313
|
+
}[];
|
|
314
|
+
isError: boolean;
|
|
315
|
+
} | {
|
|
316
|
+
content: {
|
|
317
|
+
type: string;
|
|
318
|
+
text: string;
|
|
319
|
+
}[];
|
|
320
|
+
}>;
|
|
321
|
+
executeMemoryStore: (params: any) => Promise<{
|
|
322
|
+
content: {
|
|
323
|
+
type: string;
|
|
324
|
+
text: string;
|
|
325
|
+
}[];
|
|
326
|
+
isError: boolean;
|
|
327
|
+
} | {
|
|
328
|
+
content: {
|
|
329
|
+
type: string;
|
|
330
|
+
text: string;
|
|
331
|
+
}[];
|
|
332
|
+
isError?: undefined;
|
|
333
|
+
}>;
|
|
334
|
+
executeGwmOn: (params: any) => Promise<{
|
|
335
|
+
content: {
|
|
336
|
+
type: string;
|
|
337
|
+
text: string;
|
|
338
|
+
}[];
|
|
339
|
+
isError: boolean;
|
|
340
|
+
} | {
|
|
341
|
+
content: {
|
|
342
|
+
type: string;
|
|
343
|
+
text: string;
|
|
344
|
+
}[];
|
|
345
|
+
}>;
|
|
346
|
+
executeGwmOff: () => Promise<{
|
|
347
|
+
content: {
|
|
348
|
+
type: string;
|
|
349
|
+
text: string;
|
|
350
|
+
}[];
|
|
351
|
+
isError: boolean;
|
|
352
|
+
} | {
|
|
353
|
+
content: {
|
|
354
|
+
type: string;
|
|
355
|
+
text: string;
|
|
356
|
+
}[];
|
|
357
|
+
}>;
|
|
358
|
+
executeGwmStatus: () => {
|
|
359
|
+
content: {
|
|
360
|
+
type: string;
|
|
361
|
+
text: string;
|
|
362
|
+
}[];
|
|
363
|
+
isError: boolean;
|
|
364
|
+
} | {
|
|
365
|
+
content: {
|
|
366
|
+
type: string;
|
|
367
|
+
text: string;
|
|
368
|
+
}[];
|
|
369
|
+
};
|
|
370
|
+
executeGwmUpdate: (params: any) => Promise<{
|
|
371
|
+
content: {
|
|
372
|
+
type: string;
|
|
373
|
+
text: string;
|
|
374
|
+
}[];
|
|
375
|
+
isError: boolean;
|
|
376
|
+
} | {
|
|
377
|
+
content: {
|
|
378
|
+
type: string;
|
|
379
|
+
text: string;
|
|
380
|
+
}[];
|
|
381
|
+
}>;
|
|
382
|
+
};
|
|
383
|
+
private resetStateForTests;
|
|
384
|
+
private setStateForTests;
|
|
385
|
+
private getStateForTests;
|
|
386
|
+
start(onStateCleared?: () => void): void;
|
|
387
|
+
stop(): Promise<void>;
|
|
388
|
+
onSessionCompactBefore(event: any): Promise<void>;
|
|
389
|
+
onSessionEnd(event: any): void;
|
|
390
|
+
onLlmOutput(event: any, ctx: any): void;
|
|
391
|
+
get store(): MemoryStore | null;
|
|
392
|
+
assemble(...args: any[]): Promise<any>;
|
|
393
|
+
ingest(...args: any[]): Promise<void>;
|
|
394
|
+
archiveTranscript(session: {
|
|
395
|
+
sessionKey?: string;
|
|
396
|
+
sessionId?: string;
|
|
397
|
+
}, messages: ContextMessage[]): Promise<ArchiveSnapshotResult>;
|
|
398
|
+
private archiveSessionFileTail;
|
|
399
|
+
maintain(params: any): Promise<any>;
|
|
400
|
+
compact(params: any): Promise<any>;
|
|
401
|
+
}
|
|
402
|
+
export {};
|