opencode-memory-plugin 0.1.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/README.md +73 -0
- package/dist/compression/compressor.d.ts +86 -0
- package/dist/compression/compressor.d.ts.map +1 -0
- package/dist/compression/compressor.js +142 -0
- package/dist/compression/compressor.js.map +1 -0
- package/dist/compression/parser.d.ts +73 -0
- package/dist/compression/parser.d.ts.map +1 -0
- package/dist/compression/parser.js +139 -0
- package/dist/compression/parser.js.map +1 -0
- package/dist/compression/pipeline.d.ts +73 -0
- package/dist/compression/pipeline.d.ts.map +1 -0
- package/dist/compression/pipeline.js +205 -0
- package/dist/compression/pipeline.js.map +1 -0
- package/dist/compression/privacy.d.ts +8 -0
- package/dist/compression/privacy.d.ts.map +1 -0
- package/dist/compression/privacy.js +30 -0
- package/dist/compression/privacy.js.map +1 -0
- package/dist/compression/prompts.d.ts +24 -0
- package/dist/compression/prompts.d.ts.map +1 -0
- package/dist/compression/prompts.js +106 -0
- package/dist/compression/prompts.js.map +1 -0
- package/dist/compression/quality.d.ts +48 -0
- package/dist/compression/quality.d.ts.map +1 -0
- package/dist/compression/quality.js +159 -0
- package/dist/compression/quality.js.map +1 -0
- package/dist/config.d.ts +114 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +265 -0
- package/dist/config.js.map +1 -0
- package/dist/context/generator.d.ts +28 -0
- package/dist/context/generator.d.ts.map +1 -0
- package/dist/context/generator.js +80 -0
- package/dist/context/generator.js.map +1 -0
- package/dist/hooks/chat-message.d.ts +14 -0
- package/dist/hooks/chat-message.d.ts.map +1 -0
- package/dist/hooks/chat-message.js +35 -0
- package/dist/hooks/chat-message.js.map +1 -0
- package/dist/hooks/compaction.d.ts +13 -0
- package/dist/hooks/compaction.d.ts.map +1 -0
- package/dist/hooks/compaction.js +22 -0
- package/dist/hooks/compaction.js.map +1 -0
- package/dist/hooks/events.d.ts +52 -0
- package/dist/hooks/events.d.ts.map +1 -0
- package/dist/hooks/events.js +138 -0
- package/dist/hooks/events.js.map +1 -0
- package/dist/hooks/system-transform.d.ts +14 -0
- package/dist/hooks/system-transform.d.ts.map +1 -0
- package/dist/hooks/system-transform.js +26 -0
- package/dist/hooks/system-transform.js.map +1 -0
- package/dist/hooks/tool-after.d.ts +26 -0
- package/dist/hooks/tool-after.d.ts.map +1 -0
- package/dist/hooks/tool-after.js +88 -0
- package/dist/hooks/tool-after.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +79 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +60 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +91 -0
- package/dist/logger.js.map +1 -0
- package/dist/storage/db.d.ts +22 -0
- package/dist/storage/db.d.ts.map +1 -0
- package/dist/storage/db.js +198 -0
- package/dist/storage/db.js.map +1 -0
- package/dist/storage/schema.d.ts +2473 -0
- package/dist/storage/schema.d.ts.map +1 -0
- package/dist/storage/schema.js +100 -0
- package/dist/storage/schema.js.map +1 -0
- package/dist/storage/store.d.ts +376 -0
- package/dist/storage/store.d.ts.map +1 -0
- package/dist/storage/store.js +1025 -0
- package/dist/storage/store.js.map +1 -0
- package/dist/tools/memory-forget.d.ts +11 -0
- package/dist/tools/memory-forget.d.ts.map +1 -0
- package/dist/tools/memory-forget.js +249 -0
- package/dist/tools/memory-forget.js.map +1 -0
- package/dist/tools/memory-get.d.ts +10 -0
- package/dist/tools/memory-get.d.ts.map +1 -0
- package/dist/tools/memory-get.js +50 -0
- package/dist/tools/memory-get.js.map +1 -0
- package/dist/tools/memory-search.d.ts +11 -0
- package/dist/tools/memory-search.d.ts.map +1 -0
- package/dist/tools/memory-search.js +38 -0
- package/dist/tools/memory-search.js.map +1 -0
- package/dist/tools/memory-stats.d.ts +39 -0
- package/dist/tools/memory-stats.d.ts.map +1 -0
- package/dist/tools/memory-stats.js +121 -0
- package/dist/tools/memory-stats.js.map +1 -0
- package/dist/tools/memory-timeline.d.ts +10 -0
- package/dist/tools/memory-timeline.d.ts.map +1 -0
- package/dist/tools/memory-timeline.js +49 -0
- package/dist/tools/memory-timeline.js.map +1 -0
- package/dist/types.d.ts +178 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +4 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +130 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +308 -0
- package/dist/utils.js.map +1 -0
- package/package.json +36 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/storage/schema.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4BxB,CAAA;AAED,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoB5B,CAAA;AAED,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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,GAAG,OAAO,eAAe,CAAC,YAAY,CAAA;AAEnE,MAAM,MAAM,iBAAiB,GAAG,OAAO,gBAAgB,CAAC,YAAY,CAAA;AAEpE,MAAM,MAAM,cAAc,GAAG,OAAO,WAAW,CAAC,YAAY,CAAA;AAE5D,MAAM,MAAM,gBAAgB,GAAG,OAAO,cAAc,CAAC,YAAY,CAAA;AAEjE,MAAM,MAAM,aAAa,GAAG,OAAO,WAAW,CAAC,YAAY,CAAA"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { index, integer, sqliteTable, text, uniqueIndex } from "drizzle-orm/sqlite-core";
|
|
2
|
+
export const observations = sqliteTable("observations", {
|
|
3
|
+
id: text("id").primaryKey(),
|
|
4
|
+
projectId: text("project_id").notNull(),
|
|
5
|
+
projectRoot: text("project_root").notNull(),
|
|
6
|
+
sessionId: text("session_id").notNull(),
|
|
7
|
+
type: text("type").notNull(),
|
|
8
|
+
title: text("title").notNull(),
|
|
9
|
+
subtitle: text("subtitle"),
|
|
10
|
+
narrative: text("narrative").notNull(),
|
|
11
|
+
facts: text("facts").notNull().default("[]"),
|
|
12
|
+
concepts: text("concepts").notNull().default("[]"),
|
|
13
|
+
filesInvolved: text("files_involved").notNull().default("[]"),
|
|
14
|
+
rawTokenCount: integer("raw_token_count").notNull().default(0),
|
|
15
|
+
compressedTokenCount: integer("compressed_token_count").notNull().default(0),
|
|
16
|
+
toolName: text("tool_name"),
|
|
17
|
+
modelUsed: text("model_used"),
|
|
18
|
+
quality: text("quality").notNull().default("high"),
|
|
19
|
+
rawFallback: text("raw_fallback"),
|
|
20
|
+
createdAt: integer("created_at").notNull(),
|
|
21
|
+
}, (table) => [
|
|
22
|
+
index("observations_project_created_idx").on(table.projectId, table.createdAt),
|
|
23
|
+
index("observations_session_idx").on(table.sessionId),
|
|
24
|
+
index("observations_type_idx").on(table.type),
|
|
25
|
+
index("observations_quality_idx").on(table.quality),
|
|
26
|
+
]);
|
|
27
|
+
export const sessionSummaries = sqliteTable("session_summaries", {
|
|
28
|
+
id: text("id").primaryKey(),
|
|
29
|
+
projectId: text("project_id").notNull(),
|
|
30
|
+
projectRoot: text("project_root").notNull(),
|
|
31
|
+
sessionId: text("session_id").notNull(),
|
|
32
|
+
requested: text("requested"),
|
|
33
|
+
investigated: text("investigated"),
|
|
34
|
+
learned: text("learned"),
|
|
35
|
+
completed: text("completed"),
|
|
36
|
+
nextSteps: text("next_steps"),
|
|
37
|
+
observationCount: integer("observation_count").notNull().default(0),
|
|
38
|
+
modelUsed: text("model_used"),
|
|
39
|
+
createdAt: integer("created_at").notNull(),
|
|
40
|
+
}, (table) => [
|
|
41
|
+
uniqueIndex("session_summaries_session_unique_idx").on(table.projectId, table.sessionId),
|
|
42
|
+
index("session_summaries_created_idx").on(table.projectId, table.createdAt),
|
|
43
|
+
]);
|
|
44
|
+
export const pendingMessages = sqliteTable("pending_messages", {
|
|
45
|
+
id: text("id").primaryKey(),
|
|
46
|
+
projectId: text("project_id").notNull(),
|
|
47
|
+
projectRoot: text("project_root").notNull(),
|
|
48
|
+
sessionId: text("session_id").notNull(),
|
|
49
|
+
toolName: text("tool_name").notNull(),
|
|
50
|
+
title: text("title"),
|
|
51
|
+
rawContent: text("raw_content").notNull(),
|
|
52
|
+
rawMetadata: text("raw_metadata"),
|
|
53
|
+
status: text("status").notNull().default("pending"),
|
|
54
|
+
retryCount: integer("retry_count").notNull().default(0),
|
|
55
|
+
errorMessage: text("error_message"),
|
|
56
|
+
createdAt: integer("created_at").notNull(),
|
|
57
|
+
processedAt: integer("processed_at"),
|
|
58
|
+
}, (table) => [
|
|
59
|
+
index("pending_messages_status_created_idx").on(table.projectId, table.status, table.createdAt),
|
|
60
|
+
index("pending_messages_session_idx").on(table.sessionId),
|
|
61
|
+
]);
|
|
62
|
+
export const userPrompts = sqliteTable("user_prompts", {
|
|
63
|
+
id: text("id").primaryKey(),
|
|
64
|
+
projectId: text("project_id").notNull(),
|
|
65
|
+
projectRoot: text("project_root").notNull(),
|
|
66
|
+
sessionId: text("session_id").notNull(),
|
|
67
|
+
messageId: text("message_id").notNull(),
|
|
68
|
+
content: text("content").notNull(),
|
|
69
|
+
createdAt: integer("created_at").notNull(),
|
|
70
|
+
}, (table) => [
|
|
71
|
+
uniqueIndex("user_prompts_message_unique_idx").on(table.messageId),
|
|
72
|
+
index("user_prompts_session_idx").on(table.projectId, table.sessionId),
|
|
73
|
+
]);
|
|
74
|
+
export const deletionLog = sqliteTable("deletion_log", {
|
|
75
|
+
id: text("id").primaryKey(),
|
|
76
|
+
projectId: text("project_id").notNull(),
|
|
77
|
+
projectRoot: text("project_root").notNull(),
|
|
78
|
+
timestamp: integer("timestamp").notNull(),
|
|
79
|
+
criteria: text("criteria").notNull(),
|
|
80
|
+
count: integer("count").notNull(),
|
|
81
|
+
initiator: text("initiator").notNull(),
|
|
82
|
+
}, (table) => [index("deletion_log_timestamp_idx").on(table.projectId, table.timestamp)]);
|
|
83
|
+
export const toolUsageStats = sqliteTable("tool_usage_stats", {
|
|
84
|
+
id: text("id").primaryKey(),
|
|
85
|
+
projectId: text("project_id").notNull(),
|
|
86
|
+
projectRoot: text("project_root").notNull(),
|
|
87
|
+
sessionId: text("session_id").notNull(),
|
|
88
|
+
toolName: text("tool_name").notNull(),
|
|
89
|
+
callCount: integer("call_count").notNull().default(1),
|
|
90
|
+
createdAt: integer("created_at").notNull(),
|
|
91
|
+
}, (table) => [index("tool_usage_stats_session_tool_idx").on(table.projectId, table.sessionId, table.toolName)]);
|
|
92
|
+
export const schema = {
|
|
93
|
+
deletionLog,
|
|
94
|
+
observations,
|
|
95
|
+
pendingMessages,
|
|
96
|
+
sessionSummaries,
|
|
97
|
+
toolUsageStats,
|
|
98
|
+
userPrompts,
|
|
99
|
+
};
|
|
100
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/storage/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,K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O,EAAE;IACjC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE;CACvC,EACD,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CACtF,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,WAAW,CACvC,kBAAkB,EAClB;IACE,EAAE,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE;IAC3B,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;IACvC,WAAW,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,EAAE;IAC3C,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;IACvC,QAAQ,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,OAAO,EAAE;IACrC,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACrD,SAAS,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,EAAE;CAC3C,EACD,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,QAAQ,CAAC,CAAC,CAC7G,CAAA;AAED,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,WAAW;IACX,YAAY;IACZ,eAAe;IACf,gBAAgB;IAChB,cAAc;IACd,WAAW;CACZ,CAAA"}
|
|
@@ -0,0 +1,376 @@
|
|
|
1
|
+
import { type DeletionLogRow, type ObservationRow, type PendingMessageRow, type SessionSummaryRow, type ToolUsageStatRow, type UserPromptRow } from "./schema";
|
|
2
|
+
import type { MemoryDatabase } from "./db";
|
|
3
|
+
import type { DeletionInitiator, DeletionLogEntry, MemorySearchResult, Observation, ObservationType, PendingMessage, PendingStatus, ProjectScope, SessionSummary, TimelinePage, TimelineQuery, ToolUsageStat, UserPromptRecord } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* Provides project-scoped persistence and retrieval operations for the memory plugin.
|
|
6
|
+
*/
|
|
7
|
+
export declare class MemoryStore {
|
|
8
|
+
private readonly database;
|
|
9
|
+
private readonly scope;
|
|
10
|
+
private readonly now;
|
|
11
|
+
constructor(database: MemoryDatabase, scope: ProjectScope, now: () => number);
|
|
12
|
+
/**
|
|
13
|
+
* Closes the underlying SQLite connection.
|
|
14
|
+
*
|
|
15
|
+
* @returns Nothing.
|
|
16
|
+
*/
|
|
17
|
+
close(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Persists a compressed observation.
|
|
20
|
+
*
|
|
21
|
+
* @param observation - Observation to save.
|
|
22
|
+
* @returns A promise that resolves after insertion.
|
|
23
|
+
*/
|
|
24
|
+
saveObservation(observation: Observation): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Retrieves a single observation by identifier.
|
|
27
|
+
*
|
|
28
|
+
* @param id - Observation identifier.
|
|
29
|
+
* @returns The observation or null.
|
|
30
|
+
*/
|
|
31
|
+
getObservation(id: string): Promise<Observation | null>;
|
|
32
|
+
/**
|
|
33
|
+
* Retrieves multiple observations in a single query.
|
|
34
|
+
*
|
|
35
|
+
* @param ids - Observation identifiers.
|
|
36
|
+
* @returns Matching observations.
|
|
37
|
+
*/
|
|
38
|
+
getObservationsBatch(ids: string[]): Promise<Observation[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Retrieves the most recent observations for the current project.
|
|
41
|
+
*
|
|
42
|
+
* @param limit - Maximum number of rows.
|
|
43
|
+
* @returns Recent observations ordered from newest to oldest.
|
|
44
|
+
*/
|
|
45
|
+
getRecentObservations(limit: number): Promise<Observation[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Retrieves all observations recorded for a session.
|
|
48
|
+
*
|
|
49
|
+
* @param sessionId - OpenCode session identifier.
|
|
50
|
+
* @returns Observations ordered from oldest to newest.
|
|
51
|
+
*/
|
|
52
|
+
getSessionObservations(sessionId: string): Promise<Observation[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Returns the total number of stored observations for the current project.
|
|
55
|
+
*
|
|
56
|
+
* @returns Observation count.
|
|
57
|
+
*/
|
|
58
|
+
countObservations(): Promise<number>;
|
|
59
|
+
/**
|
|
60
|
+
* Adds a pending raw tool result to the crash-safe queue.
|
|
61
|
+
*
|
|
62
|
+
* @param pendingMessage - Pending message payload.
|
|
63
|
+
* @returns A promise that resolves after insertion.
|
|
64
|
+
*/
|
|
65
|
+
enqueuePending(pendingMessage: PendingMessage): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Fetches pending messages by status.
|
|
68
|
+
*
|
|
69
|
+
* @param statuses - Accepted queue statuses.
|
|
70
|
+
* @param limit - Maximum number of rows.
|
|
71
|
+
* @returns Matching pending messages.
|
|
72
|
+
*/
|
|
73
|
+
getPendingMessages(statuses: PendingStatus[], limit: number): Promise<PendingMessage[]>;
|
|
74
|
+
/**
|
|
75
|
+
* Finds queue items that were left in processing state past the orphan threshold.
|
|
76
|
+
*
|
|
77
|
+
* @param orphanThresholdMs - Threshold in milliseconds.
|
|
78
|
+
* @returns Orphaned pending messages.
|
|
79
|
+
*/
|
|
80
|
+
getOrphanedMessages(orphanThresholdMs: number): Promise<PendingMessage[]>;
|
|
81
|
+
/**
|
|
82
|
+
* Updates the status for a queued message.
|
|
83
|
+
*
|
|
84
|
+
* @param id - Pending message identifier.
|
|
85
|
+
* @param status - Next queue status.
|
|
86
|
+
* @param retryCount - Updated retry count.
|
|
87
|
+
* @param errorMessage - Optional error message.
|
|
88
|
+
* @returns A promise that resolves after the update.
|
|
89
|
+
*/
|
|
90
|
+
updatePendingStatus(id: string, status: PendingStatus, retryCount: number, errorMessage: string | null): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Counts queued items for a specific session.
|
|
93
|
+
*
|
|
94
|
+
* @param sessionId - OpenCode session identifier.
|
|
95
|
+
* @returns Queue size for that session.
|
|
96
|
+
*/
|
|
97
|
+
countPendingForSession(sessionId: string): Promise<number>;
|
|
98
|
+
/**
|
|
99
|
+
* Saves or replaces a session summary.
|
|
100
|
+
*
|
|
101
|
+
* @param summary - Summary payload.
|
|
102
|
+
* @returns A promise that resolves after persistence.
|
|
103
|
+
*/
|
|
104
|
+
saveSessionSummary(summary: SessionSummary): Promise<void>;
|
|
105
|
+
/**
|
|
106
|
+
* Retrieves the latest summary for a session.
|
|
107
|
+
*
|
|
108
|
+
* @param sessionId - OpenCode session identifier.
|
|
109
|
+
* @returns The stored summary or null.
|
|
110
|
+
*/
|
|
111
|
+
getSessionSummary(sessionId: string): Promise<SessionSummary | null>;
|
|
112
|
+
/**
|
|
113
|
+
* Retrieves the most recent summaries for the current project.
|
|
114
|
+
*
|
|
115
|
+
* @param limit - Maximum number of summaries.
|
|
116
|
+
* @returns Recent summaries ordered from newest to oldest.
|
|
117
|
+
*/
|
|
118
|
+
getRecentSummaries(limit: number): Promise<SessionSummary[]>;
|
|
119
|
+
/**
|
|
120
|
+
* Stores a user prompt for later summarization and retrieval.
|
|
121
|
+
*
|
|
122
|
+
* @param prompt - Prompt payload.
|
|
123
|
+
* @returns A promise that resolves after insertion.
|
|
124
|
+
*/
|
|
125
|
+
saveUserPrompt(prompt: UserPromptRecord): Promise<void>;
|
|
126
|
+
/**
|
|
127
|
+
* Returns prompts associated with a session.
|
|
128
|
+
*
|
|
129
|
+
* @param sessionId - OpenCode session identifier.
|
|
130
|
+
* @returns Session prompts ordered from oldest to newest.
|
|
131
|
+
*/
|
|
132
|
+
getSessionUserPrompts(sessionId: string): Promise<UserPromptRecord[]>;
|
|
133
|
+
/**
|
|
134
|
+
* Searches observations through the FTS5 index.
|
|
135
|
+
*
|
|
136
|
+
* @param query - User-entered search text.
|
|
137
|
+
* @param limit - Maximum number of results.
|
|
138
|
+
* @param typeFilter - Optional observation type filter.
|
|
139
|
+
* @returns Compact search results.
|
|
140
|
+
*/
|
|
141
|
+
searchFTS(query: string, limit: number, typeFilter?: ObservationType): Promise<MemorySearchResult[]>;
|
|
142
|
+
/**
|
|
143
|
+
* Retrieves a timeline page for the current project.
|
|
144
|
+
*
|
|
145
|
+
* @param query - Timeline filters and pagination options.
|
|
146
|
+
* @returns Timeline page with the next cursor.
|
|
147
|
+
*/
|
|
148
|
+
getTimeline(query: TimelineQuery): Promise<TimelinePage>;
|
|
149
|
+
/**
|
|
150
|
+
* Determines whether a session has new activity after its current summary.
|
|
151
|
+
*
|
|
152
|
+
* @param sessionId - OpenCode session identifier.
|
|
153
|
+
* @returns True when a summary refresh is needed.
|
|
154
|
+
*/
|
|
155
|
+
hasSessionActivityAfterSummary(sessionId: string): Promise<boolean>;
|
|
156
|
+
/**
|
|
157
|
+
* Counts observations for a session.
|
|
158
|
+
*
|
|
159
|
+
* @param sessionId - OpenCode session identifier.
|
|
160
|
+
* @returns Observation count.
|
|
161
|
+
*/
|
|
162
|
+
countSessionObservations(sessionId: string): Promise<number>;
|
|
163
|
+
/**
|
|
164
|
+
* Counts prompts for a session.
|
|
165
|
+
*
|
|
166
|
+
* @param sessionId - OpenCode session identifier.
|
|
167
|
+
* @returns Prompt count.
|
|
168
|
+
*/
|
|
169
|
+
countSessionPrompts(sessionId: string): Promise<number>;
|
|
170
|
+
/**
|
|
171
|
+
* Deletes a set of observations by identifier.
|
|
172
|
+
*
|
|
173
|
+
* @param ids - Observation identifiers.
|
|
174
|
+
* @returns Number of deleted observations.
|
|
175
|
+
*/
|
|
176
|
+
deleteObservations(ids: string[]): Promise<number>;
|
|
177
|
+
/**
|
|
178
|
+
* Deletes observations that match an FTS query.
|
|
179
|
+
*
|
|
180
|
+
* @param ftsQuery - Raw user query.
|
|
181
|
+
* @returns Number of deleted observations.
|
|
182
|
+
*/
|
|
183
|
+
deleteByQuery(ftsQuery: string): Promise<number>;
|
|
184
|
+
/**
|
|
185
|
+
* Deletes all observations and summary for a session.
|
|
186
|
+
*
|
|
187
|
+
* @param sessionId - OpenCode session identifier.
|
|
188
|
+
* @returns Number of deleted observations.
|
|
189
|
+
*/
|
|
190
|
+
deleteBySession(sessionId: string): Promise<number>;
|
|
191
|
+
/**
|
|
192
|
+
* Deletes observations created before or at a given date.
|
|
193
|
+
*
|
|
194
|
+
* @param date - Cutoff date.
|
|
195
|
+
* @returns Number of deleted observations.
|
|
196
|
+
*/
|
|
197
|
+
deleteBefore(date: Date): Promise<number>;
|
|
198
|
+
/**
|
|
199
|
+
* Stores a deletion audit log entry.
|
|
200
|
+
*
|
|
201
|
+
* @param criteria - JSON criteria description.
|
|
202
|
+
* @param count - Deleted observation count.
|
|
203
|
+
* @param initiator - Operation initiator.
|
|
204
|
+
* @returns A promise that resolves after insertion.
|
|
205
|
+
*/
|
|
206
|
+
logDeletion(criteria: string, count: number, initiator: DeletionInitiator): Promise<void>;
|
|
207
|
+
/**
|
|
208
|
+
* Increments tool usage counters for a session.
|
|
209
|
+
*
|
|
210
|
+
* @param sessionId - OpenCode session identifier.
|
|
211
|
+
* @param toolName - Tool name.
|
|
212
|
+
* @returns A promise that resolves after update.
|
|
213
|
+
*/
|
|
214
|
+
incrementToolUsage(sessionId: string, toolName: string): Promise<void>;
|
|
215
|
+
/**
|
|
216
|
+
* Retrieves tool usage stats from the last N days.
|
|
217
|
+
*
|
|
218
|
+
* @param days - Lookback window in days.
|
|
219
|
+
* @returns Matching tool usage rows.
|
|
220
|
+
*/
|
|
221
|
+
getToolUsageStats(days: number): Promise<ToolUsageStat[]>;
|
|
222
|
+
/**
|
|
223
|
+
* Returns observation quality distribution counts.
|
|
224
|
+
*
|
|
225
|
+
* @returns Quality counts by bucket.
|
|
226
|
+
*/
|
|
227
|
+
getQualityDistribution(): Promise<{
|
|
228
|
+
high: number;
|
|
229
|
+
medium: number;
|
|
230
|
+
low: number;
|
|
231
|
+
}>;
|
|
232
|
+
/**
|
|
233
|
+
* Returns success metrics for a compression model.
|
|
234
|
+
*
|
|
235
|
+
* @param modelName - Model identifier.
|
|
236
|
+
* @returns Total, success and rate values.
|
|
237
|
+
*/
|
|
238
|
+
getModelSuccessRate(modelName: string): Promise<{
|
|
239
|
+
total: number;
|
|
240
|
+
success: number;
|
|
241
|
+
rate: number;
|
|
242
|
+
}>;
|
|
243
|
+
/**
|
|
244
|
+
* Searches observations within a date range.
|
|
245
|
+
*
|
|
246
|
+
* @param from - Range start.
|
|
247
|
+
* @param to - Range end.
|
|
248
|
+
* @param limit - Maximum number of rows.
|
|
249
|
+
* @returns Matching observations.
|
|
250
|
+
*/
|
|
251
|
+
searchByDateRange(from: Date, to: Date, limit: number): Promise<Observation[]>;
|
|
252
|
+
/**
|
|
253
|
+
* Searches observations by matching file paths against the FTS index.
|
|
254
|
+
*
|
|
255
|
+
* @param filePaths - File path patterns.
|
|
256
|
+
* @returns Matching observations.
|
|
257
|
+
*/
|
|
258
|
+
searchByFiles(filePaths: string[]): Promise<Observation[]>;
|
|
259
|
+
/**
|
|
260
|
+
* Returns the number of summaries for the current project.
|
|
261
|
+
*
|
|
262
|
+
* @returns Summary count.
|
|
263
|
+
*/
|
|
264
|
+
countSessionSummaries(): Promise<number>;
|
|
265
|
+
/**
|
|
266
|
+
* Returns pending queue counts grouped by status.
|
|
267
|
+
*
|
|
268
|
+
* @returns Status count object.
|
|
269
|
+
*/
|
|
270
|
+
getPendingStatusCounts(): Promise<Record<PendingStatus, number>>;
|
|
271
|
+
/**
|
|
272
|
+
* Counts observations since a timestamp.
|
|
273
|
+
*
|
|
274
|
+
* @param timestamp - Lower bound timestamp.
|
|
275
|
+
* @returns Observation count.
|
|
276
|
+
*/
|
|
277
|
+
countObservationsSince(timestamp: number): Promise<number>;
|
|
278
|
+
/**
|
|
279
|
+
* Calculates compression ratio and last compression timestamp.
|
|
280
|
+
*
|
|
281
|
+
* @returns Compression summary values.
|
|
282
|
+
*/
|
|
283
|
+
getCompressionStats(): Promise<{
|
|
284
|
+
averageRatio: number;
|
|
285
|
+
lastCompressedAt: number | null;
|
|
286
|
+
}>;
|
|
287
|
+
/**
|
|
288
|
+
* Returns deletion log totals for a lookback window.
|
|
289
|
+
*
|
|
290
|
+
* @param days - Lookback in days.
|
|
291
|
+
* @returns Operation and deletion totals.
|
|
292
|
+
*/
|
|
293
|
+
getDeletionStats(days: number): Promise<{
|
|
294
|
+
operations: number;
|
|
295
|
+
removed: number;
|
|
296
|
+
}>;
|
|
297
|
+
/**
|
|
298
|
+
* Returns the current SQLite database size in bytes.
|
|
299
|
+
*
|
|
300
|
+
* @returns Database file size estimate.
|
|
301
|
+
*/
|
|
302
|
+
getDatabaseSizeBytes(): Promise<number>;
|
|
303
|
+
/**
|
|
304
|
+
* Returns deletion log entries from the last N days.
|
|
305
|
+
*
|
|
306
|
+
* @param days - Lookback window in days.
|
|
307
|
+
* @returns Matching deletion entries.
|
|
308
|
+
*/
|
|
309
|
+
getDeletionLog(days: number): Promise<DeletionLogEntry[]>;
|
|
310
|
+
/**
|
|
311
|
+
* Deletes data older than the configured retention windows.
|
|
312
|
+
*
|
|
313
|
+
* @param retentionDays - Number of days to keep observations and prompts.
|
|
314
|
+
* @returns A promise that resolves after cleanup.
|
|
315
|
+
*/
|
|
316
|
+
cleanupOldData(retentionDays: number): Promise<void>;
|
|
317
|
+
/**
|
|
318
|
+
* Creates a new project-scoped record identifier.
|
|
319
|
+
*
|
|
320
|
+
* @returns A sortable identifier.
|
|
321
|
+
*/
|
|
322
|
+
createId(): string;
|
|
323
|
+
/**
|
|
324
|
+
* Returns the last activity timestamp for a table and session.
|
|
325
|
+
*
|
|
326
|
+
* @param sqlite - SQLite client.
|
|
327
|
+
* @param tableName - Table to inspect.
|
|
328
|
+
* @param sessionId - OpenCode session identifier.
|
|
329
|
+
* @param projectId - Current project identifier.
|
|
330
|
+
* @returns The last timestamp or zero.
|
|
331
|
+
*/
|
|
332
|
+
private getLastTimestamp;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Maps an observation row into the runtime shape.
|
|
336
|
+
*
|
|
337
|
+
* @param row - Database row.
|
|
338
|
+
* @returns Normalized observation.
|
|
339
|
+
*/
|
|
340
|
+
export declare function mapObservation(row: ObservationRow): Observation;
|
|
341
|
+
/**
|
|
342
|
+
* Maps a pending queue row into the runtime shape.
|
|
343
|
+
*
|
|
344
|
+
* @param row - Database row.
|
|
345
|
+
* @returns Normalized pending message.
|
|
346
|
+
*/
|
|
347
|
+
export declare function mapPendingMessage(row: PendingMessageRow): PendingMessage;
|
|
348
|
+
/**
|
|
349
|
+
* Maps a summary row into the runtime shape.
|
|
350
|
+
*
|
|
351
|
+
* @param row - Database row.
|
|
352
|
+
* @returns Normalized session summary.
|
|
353
|
+
*/
|
|
354
|
+
export declare function mapSessionSummary(row: SessionSummaryRow): SessionSummary;
|
|
355
|
+
/**
|
|
356
|
+
* Maps a prompt row into the runtime shape.
|
|
357
|
+
*
|
|
358
|
+
* @param row - Database row.
|
|
359
|
+
* @returns Normalized user prompt.
|
|
360
|
+
*/
|
|
361
|
+
export declare function mapUserPrompt(row: UserPromptRow): UserPromptRecord;
|
|
362
|
+
/**
|
|
363
|
+
* Maps a deletion log row into the runtime shape.
|
|
364
|
+
*
|
|
365
|
+
* @param row - Database row.
|
|
366
|
+
* @returns Normalized deletion log entry.
|
|
367
|
+
*/
|
|
368
|
+
export declare function mapDeletionLogEntry(row: DeletionLogRow): DeletionLogEntry;
|
|
369
|
+
/**
|
|
370
|
+
* Maps a tool usage stats row into the runtime shape.
|
|
371
|
+
*
|
|
372
|
+
* @param row - Database row.
|
|
373
|
+
* @returns Normalized tool usage stats entry.
|
|
374
|
+
*/
|
|
375
|
+
export declare function mapToolUsageStat(row: ToolUsageStatRow): ToolUsageStat;
|
|
376
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/storage/store.ts"],"names":[],"mappings":"AAEA,OAAO,EAOL,K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