@ai-setting/roy-agent-core 1.5.17-beta.1 → 1.5.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/env/index.js +20 -8
- package/dist/env/log-trace/index.js +1 -1
- package/dist/env/prompt/index.js +1 -1
- package/dist/env/workflow/engine/index.js +1 -1
- package/dist/env/workflow/index.js +2 -2
- package/dist/index.js +6 -7
- package/dist/shared/@ai-setting/{roy-agent-core-xq8hhqb8.js → roy-agent-core-4wjywp3c.js} +4 -2
- package/dist/shared/@ai-setting/roy-agent-core-8jxva565.js +19 -0
- package/dist/shared/@ai-setting/roy-agent-core-avq1x4t7.js +84 -0
- package/dist/shared/@ai-setting/{roy-agent-core-gq20wsgv.js → roy-agent-core-ffb9fq4v.js} +23 -2
- package/dist/shared/@ai-setting/{roy-agent-core-93zfb3r1.js → roy-agent-core-mrcxzpbg.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-rhmtwnw1.js → roy-agent-core-pw7cv1px.js} +1 -1
- package/dist/shared/@ai-setting/{roy-agent-core-gbqcyegm.js → roy-agent-core-rccptwv0.js} +512 -673
- package/dist/shared/@ai-setting/{roy-agent-core-wrcy0h6z.js → roy-agent-core-ty94k28r.js} +1 -1
- package/package.json +8 -29
- package/dist/config/index.d.ts +0 -1250
- package/dist/env/agent/index.d.ts +0 -2279
- package/dist/env/commands/index.d.ts +0 -1131
- package/dist/env/debug/formatters/index.d.ts +0 -236
- package/dist/env/debug/index.d.ts +0 -1652
- package/dist/env/hook/index.d.ts +0 -279
- package/dist/env/index.d.ts +0 -3481
- package/dist/env/llm/index.d.ts +0 -1760
- package/dist/env/log-trace/index.d.ts +0 -1574
- package/dist/env/mcp/index.d.ts +0 -1331
- package/dist/env/mcp/tool/index.d.ts +0 -183
- package/dist/env/memory/built-in/index.d.ts +0 -232
- package/dist/env/memory/index.d.ts +0 -1799
- package/dist/env/memory/plugin/index.d.ts +0 -747
- package/dist/env/prompt/index.d.ts +0 -1164
- package/dist/env/session/index.d.ts +0 -1908
- package/dist/env/session/storage/index.d.ts +0 -564
- package/dist/env/skill/index.d.ts +0 -1266
- package/dist/env/skill/tool/index.d.ts +0 -193
- package/dist/env/task/delegate/index.d.ts +0 -1612
- package/dist/env/task/events/index.d.ts +0 -171
- package/dist/env/task/hooks/index.d.ts +0 -624
- package/dist/env/task/index.d.ts +0 -1553
- package/dist/env/task/plugins/index.d.ts +0 -466
- package/dist/env/task/storage/index.d.ts +0 -241
- package/dist/env/task/tools/index.d.ts +0 -1485
- package/dist/env/task/tools/operation/index.d.ts +0 -1484
- package/dist/env/tool/built-in/index.d.ts +0 -218
- package/dist/env/tool/index.d.ts +0 -1396
- package/dist/env/workflow/decorators/index.d.ts +0 -2161
- package/dist/env/workflow/engine/index.d.ts +0 -3453
- package/dist/env/workflow/index.d.ts +0 -3546
- package/dist/env/workflow/nodes/index.d.ts +0 -2092
- package/dist/env/workflow/service/index.d.ts +0 -227
- package/dist/env/workflow/storage/index.d.ts +0 -165
- package/dist/env/workflow/tools/index.d.ts +0 -416
- package/dist/env/workflow/types/index.d.ts +0 -2255
- package/dist/env/workflow/utils/index.d.ts +0 -2031
- package/dist/index.d.ts +0 -7858
|
@@ -1,564 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Checkpoint type
|
|
3
|
-
*/
|
|
4
|
-
type CheckpointType = "compact" | "manual";
|
|
5
|
-
/**
|
|
6
|
-
* Checkpoint metadata (stored in Session.metadata)
|
|
7
|
-
*/
|
|
8
|
-
interface CheckpointMeta {
|
|
9
|
-
id: string;
|
|
10
|
-
messageIndex: number;
|
|
11
|
-
title: string;
|
|
12
|
-
createdAt: number;
|
|
13
|
-
type: CheckpointType;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* User Intent type - represents a user's intent extracted from conversation
|
|
17
|
-
*/
|
|
18
|
-
type UserIntent = string;
|
|
19
|
-
/**
|
|
20
|
-
* Recent message for checkpoint
|
|
21
|
-
*
|
|
22
|
-
* Stores a simplified version of a message for context preservation
|
|
23
|
-
*/
|
|
24
|
-
interface RecentMessage {
|
|
25
|
-
role: string;
|
|
26
|
-
content: string;
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Complete checkpoint information (includes generated content)
|
|
30
|
-
*/
|
|
31
|
-
interface SessionCheckpoint extends CheckpointMeta {
|
|
32
|
-
summary: string;
|
|
33
|
-
processKeyPoints: string[];
|
|
34
|
-
currentState: string;
|
|
35
|
-
nextSteps: string[];
|
|
36
|
-
messageCountBefore: number;
|
|
37
|
-
metadata?: Record<string, unknown>;
|
|
38
|
-
/** User intents extracted from the conversation */
|
|
39
|
-
userIntents: UserIntent[];
|
|
40
|
-
/**
|
|
41
|
-
* Recent messages preserved from the compacted conversation
|
|
42
|
-
*
|
|
43
|
-
* Contains the last N turns of user query + assistant text response
|
|
44
|
-
* (excluding tool calls and tool results).
|
|
45
|
-
* This allows the checkpoint to serve as a fresh history context.
|
|
46
|
-
*
|
|
47
|
-
* Format: [user, assistant, user, assistant, ...] from most recent
|
|
48
|
-
*/
|
|
49
|
-
recentMessages?: RecentMessage[];
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Checkpoints metadata in session
|
|
53
|
-
*/
|
|
54
|
-
interface SessionCheckpointsMeta {
|
|
55
|
-
latestCheckpointId?: string;
|
|
56
|
-
checkpoints: CheckpointMeta[];
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Session entity
|
|
60
|
-
*/
|
|
61
|
-
interface Session {
|
|
62
|
-
id: string;
|
|
63
|
-
title: string;
|
|
64
|
-
directory: string;
|
|
65
|
-
parentID?: string;
|
|
66
|
-
createdAt: number;
|
|
67
|
-
updatedAt: number;
|
|
68
|
-
messageCount: number;
|
|
69
|
-
metadata?: SessionMetadata;
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* Session metadata
|
|
73
|
-
*/
|
|
74
|
-
interface SessionMetadata extends Record<string, unknown> {
|
|
75
|
-
/** Total number of messages in the session */
|
|
76
|
-
messageCount?: number;
|
|
77
|
-
checkpoints?: SessionCheckpointsMeta;
|
|
78
|
-
checkpointDetails?: Record<string, SessionCheckpoint>;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Session message
|
|
82
|
-
*/
|
|
83
|
-
interface SessionMessage {
|
|
84
|
-
id: string;
|
|
85
|
-
sessionID: string;
|
|
86
|
-
role: Role;
|
|
87
|
-
content: string;
|
|
88
|
-
timestamp: number;
|
|
89
|
-
parts?: MessagePart[];
|
|
90
|
-
/** Whether the message has been archived (compacted) */
|
|
91
|
-
isArchived?: boolean;
|
|
92
|
-
/** Timestamp when the message was archived */
|
|
93
|
-
archivedAt?: number;
|
|
94
|
-
/** Checkpoint ID this message belongs to */
|
|
95
|
-
checkpointId?: string;
|
|
96
|
-
/** Message metadata (includes checkpoint info if this is a checkpoint message) */
|
|
97
|
-
metadata?: MessageMetadata;
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Message metadata
|
|
101
|
-
*/
|
|
102
|
-
interface MessageMetadata extends Record<string, unknown> {
|
|
103
|
-
/** 消息类型标识,用于过滤和分类 */
|
|
104
|
-
type?: "tool_call" | "tool_result" | "checkpoint" | "user_intent" | "workflow.node.start" | "workflow.node.interrupt" | "workflow.node.end" | "workflow.node.resume";
|
|
105
|
-
isCheckpoint?: boolean;
|
|
106
|
-
checkpointId?: string;
|
|
107
|
-
checkpointMeta?: SessionCheckpoint;
|
|
108
|
-
/** Workflow node ID (for workflow.node.* messages) */
|
|
109
|
-
workflowNodeId?: string;
|
|
110
|
-
/** Workflow node type (for workflow.node.* messages) */
|
|
111
|
-
workflowNodeType?: string;
|
|
112
|
-
/** Agent session ID (for agent nodes in workflow) */
|
|
113
|
-
agentSessionId?: string;
|
|
114
|
-
/** User response (for workflow.node.resume messages) */
|
|
115
|
-
response?: string;
|
|
116
|
-
/** Success flag (for workflow.node.end messages) */
|
|
117
|
-
success?: boolean;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Message role
|
|
121
|
-
*/
|
|
122
|
-
type Role = "user" | "assistant" | "system" | "tool" | "workflow.node.start" | "workflow.node.interrupt" | "workflow.node.end" | "workflow.node.resume";
|
|
123
|
-
/**
|
|
124
|
-
* Message part
|
|
125
|
-
*/
|
|
126
|
-
type MessagePart = SessionPart;
|
|
127
|
-
/**
|
|
128
|
-
* Text part - plain text content
|
|
129
|
-
*/
|
|
130
|
-
interface TextPart {
|
|
131
|
-
type: "text";
|
|
132
|
-
content: string;
|
|
133
|
-
/** If true, this part was generated by the system (e.g., auto-summary) */
|
|
134
|
-
synthetic?: boolean;
|
|
135
|
-
/** If true, this part should be ignored (e.g., replaced by reasoning) */
|
|
136
|
-
ignored?: boolean;
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Tool call part - represents a tool invocation
|
|
140
|
-
*/
|
|
141
|
-
interface ToolCallPart {
|
|
142
|
-
type: "tool-call";
|
|
143
|
-
/** AI SDK standard field name */
|
|
144
|
-
toolCallId: string;
|
|
145
|
-
toolName: string;
|
|
146
|
-
/** Tool arguments - can be string (JSON) or object */
|
|
147
|
-
arguments: string | Record<string, unknown>;
|
|
148
|
-
state: "pending" | "running";
|
|
149
|
-
}
|
|
150
|
-
/**
|
|
151
|
-
* Tool result part - represents the result of a tool execution
|
|
152
|
-
*/
|
|
153
|
-
interface ToolResultPart {
|
|
154
|
-
type: "tool-result";
|
|
155
|
-
toolCallId: string;
|
|
156
|
-
toolName: string;
|
|
157
|
-
output: string;
|
|
158
|
-
error?: string;
|
|
159
|
-
state: "completed" | "error";
|
|
160
|
-
}
|
|
161
|
-
/**
|
|
162
|
-
* Reasoning part - AI thinking/thought content
|
|
163
|
-
*/
|
|
164
|
-
interface ReasoningPart {
|
|
165
|
-
type: "reasoning";
|
|
166
|
-
/** Reasoning content */
|
|
167
|
-
content: string;
|
|
168
|
-
/** Reasoning type (for different models) */
|
|
169
|
-
reasoningType?: "core" | "effort" | "summary";
|
|
170
|
-
/** State */
|
|
171
|
-
state?: "thinking" | "completed";
|
|
172
|
-
/** Whether to collapse by default (like AI SDK default) */
|
|
173
|
-
isCollapsed?: boolean;
|
|
174
|
-
/** Metadata */
|
|
175
|
-
metadata?: {
|
|
176
|
-
tokenCount?: number;
|
|
177
|
-
time?: {
|
|
178
|
-
start: number;
|
|
179
|
-
end?: number;
|
|
180
|
-
};
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* File part - file attachment
|
|
185
|
-
*/
|
|
186
|
-
interface FilePart {
|
|
187
|
-
type: "file";
|
|
188
|
-
mime: string;
|
|
189
|
-
url: string;
|
|
190
|
-
filename?: string;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* Checkpoint part - compaction checkpoint marker
|
|
194
|
-
*
|
|
195
|
-
* Represents a checkpoint message in the conversation history.
|
|
196
|
-
* This is stored as a user role message with markdown content summarizing
|
|
197
|
-
* the compacted conversation segment.
|
|
198
|
-
*/
|
|
199
|
-
interface CheckpointPart {
|
|
200
|
-
type: "checkpoint";
|
|
201
|
-
/** Checkpoint ID reference */
|
|
202
|
-
checkpointId: string;
|
|
203
|
-
/** Markdown content summarizing the checkpoint */
|
|
204
|
-
content: string;
|
|
205
|
-
/** Title of the checkpoint */
|
|
206
|
-
title?: string;
|
|
207
|
-
/** Process key points */
|
|
208
|
-
processKeyPoints?: string[];
|
|
209
|
-
/** Current state description */
|
|
210
|
-
currentState?: string;
|
|
211
|
-
/** Next steps */
|
|
212
|
-
nextSteps?: string[];
|
|
213
|
-
/** Number of messages that were compacted */
|
|
214
|
-
messageCountBefore?: number;
|
|
215
|
-
/** Creation timestamp */
|
|
216
|
-
createdAt?: number;
|
|
217
|
-
}
|
|
218
|
-
/**
|
|
219
|
-
* Union type for all Session Part types
|
|
220
|
-
*/
|
|
221
|
-
type SessionPart = TextPart | ToolCallPart | ToolResultPart | ReasoningPart | FilePart | CheckpointPart | WorkflowNodeStartPart | WorkflowNodeInterruptPart | WorkflowNodeEndPart | WorkflowNodeResumePart;
|
|
222
|
-
/**
|
|
223
|
-
* workflow.node.start 消息 part (对应 tool-call)
|
|
224
|
-
*/
|
|
225
|
-
interface WorkflowNodeStartPart {
|
|
226
|
-
type: "workflow-node-start";
|
|
227
|
-
nodeId: string;
|
|
228
|
-
nodeType: string;
|
|
229
|
-
input?: unknown;
|
|
230
|
-
startTime: number;
|
|
231
|
-
/** Agent session ID (only for agent nodes) */
|
|
232
|
-
agentSessionId?: string;
|
|
233
|
-
}
|
|
234
|
-
/**
|
|
235
|
-
* workflow.node.interrupt 消息 part
|
|
236
|
-
*/
|
|
237
|
-
interface WorkflowNodeInterruptPart {
|
|
238
|
-
type: "workflow-node-interrupt";
|
|
239
|
-
nodeId: string;
|
|
240
|
-
nodeType: string;
|
|
241
|
-
query: string;
|
|
242
|
-
options?: string[];
|
|
243
|
-
timestamp: number;
|
|
244
|
-
/** Agent session ID (only for agent nodes) */
|
|
245
|
-
agentSessionId?: string;
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* workflow.node.end 消息 part (对应 tool-result)
|
|
249
|
-
*/
|
|
250
|
-
interface WorkflowNodeEndPart {
|
|
251
|
-
type: "workflow-node-end";
|
|
252
|
-
nodeId: string;
|
|
253
|
-
nodeType: string;
|
|
254
|
-
output?: unknown;
|
|
255
|
-
error?: string;
|
|
256
|
-
durationMs: number;
|
|
257
|
-
/** Agent session ID (only for agent nodes) */
|
|
258
|
-
agentSessionId?: string;
|
|
259
|
-
}
|
|
260
|
-
/**
|
|
261
|
-
* workflow.node.resume 消息 part
|
|
262
|
-
*/
|
|
263
|
-
interface WorkflowNodeResumePart {
|
|
264
|
-
type: "workflow-node-resume";
|
|
265
|
-
nodeId: string;
|
|
266
|
-
response: string;
|
|
267
|
-
timestamp: number;
|
|
268
|
-
/** Agent session ID (only for agent nodes) */
|
|
269
|
-
agentSessionId?: string;
|
|
270
|
-
}
|
|
271
|
-
/**
|
|
272
|
-
* Options for creating a session
|
|
273
|
-
*/
|
|
274
|
-
interface CreateSessionOptions {
|
|
275
|
-
/** Custom session ID (optional, will be generated if not provided) */
|
|
276
|
-
id?: string;
|
|
277
|
-
title?: string;
|
|
278
|
-
directory?: string;
|
|
279
|
-
parentID?: string;
|
|
280
|
-
metadata?: Record<string, unknown>;
|
|
281
|
-
hooks?: SessionHooksConfig;
|
|
282
|
-
}
|
|
283
|
-
/**
|
|
284
|
-
* Options for updating a session
|
|
285
|
-
*/
|
|
286
|
-
interface UpdateSessionOptions {
|
|
287
|
-
title?: string;
|
|
288
|
-
metadata?: Record<string, unknown>;
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* Options for listing sessions
|
|
292
|
-
*/
|
|
293
|
-
interface ListSessionsOptions {
|
|
294
|
-
filter?: {
|
|
295
|
-
metadata?: Record<string, unknown>;
|
|
296
|
-
startTime?: number;
|
|
297
|
-
endTime?: number;
|
|
298
|
-
};
|
|
299
|
-
sort?: {
|
|
300
|
-
field: "updatedAt" | "createdAt" | "title";
|
|
301
|
-
order: "asc" | "desc";
|
|
302
|
-
};
|
|
303
|
-
offset?: number;
|
|
304
|
-
limit?: number;
|
|
305
|
-
}
|
|
306
|
-
/**
|
|
307
|
-
* Options for getting messages
|
|
308
|
-
*/
|
|
309
|
-
interface GetMessagesOptions {
|
|
310
|
-
/** Include archived messages */
|
|
311
|
-
includeArchived?: boolean;
|
|
312
|
-
/** From checkpoint ID */
|
|
313
|
-
fromCheckpointId?: string;
|
|
314
|
-
/** Reverse order */
|
|
315
|
-
reverse?: boolean;
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* Session hook callback
|
|
319
|
-
*/
|
|
320
|
-
type SessionHookCallback = (context?: any) => Promise<void>;
|
|
321
|
-
/**
|
|
322
|
-
* Session hook definition
|
|
323
|
-
*/
|
|
324
|
-
interface SessionHook {
|
|
325
|
-
name: string;
|
|
326
|
-
before?: SessionHookCallback;
|
|
327
|
-
after?: SessionHookCallback;
|
|
328
|
-
}
|
|
329
|
-
/**
|
|
330
|
-
* Session hooks configuration
|
|
331
|
-
*/
|
|
332
|
-
interface SessionHooksConfig {
|
|
333
|
-
[key: string]: SessionHook[];
|
|
334
|
-
}
|
|
335
|
-
/**
|
|
336
|
-
* Options for searching messages
|
|
337
|
-
*/
|
|
338
|
-
interface SearchMessagesOptions {
|
|
339
|
-
/** Search query (supports AND/OR/NOT syntax) */
|
|
340
|
-
query: string;
|
|
341
|
-
/** Limit search to specific session ID */
|
|
342
|
-
sessionId?: string;
|
|
343
|
-
/** Maximum number of results per session */
|
|
344
|
-
limit?: number;
|
|
345
|
-
/** Maximum total results */
|
|
346
|
-
maxResults?: number;
|
|
347
|
-
/** Only search messages before this timestamp */
|
|
348
|
-
beforeTime?: number;
|
|
349
|
-
/** Only search messages after this timestamp */
|
|
350
|
-
afterTime?: number;
|
|
351
|
-
/** Include archived messages */
|
|
352
|
-
includeArchived?: boolean;
|
|
353
|
-
/** Include context (messages before/after matches) */
|
|
354
|
-
includeContext?: boolean;
|
|
355
|
-
/** Number of context lines before/after */
|
|
356
|
-
contextLines?: number;
|
|
357
|
-
}
|
|
358
|
-
/**
|
|
359
|
-
* A single message match
|
|
360
|
-
*/
|
|
361
|
-
interface MessageMatch {
|
|
362
|
-
/** Message ID */
|
|
363
|
-
messageId: string;
|
|
364
|
-
/** Session ID */
|
|
365
|
-
sessionId: string;
|
|
366
|
-
/** Message role */
|
|
367
|
-
role: Role;
|
|
368
|
-
/** Message content */
|
|
369
|
-
content: string;
|
|
370
|
-
/** Message timestamp */
|
|
371
|
-
timestamp: number;
|
|
372
|
-
/** Context before the match (if enabled) */
|
|
373
|
-
contextBefore?: string;
|
|
374
|
-
/** Context after the match (if enabled) */
|
|
375
|
-
contextAfter?: string;
|
|
376
|
-
/** Match score (relevance) */
|
|
377
|
-
score?: number;
|
|
378
|
-
}
|
|
379
|
-
/**
|
|
380
|
-
* Session Store Interface
|
|
381
|
-
* Defines the contract for session storage implementations
|
|
382
|
-
*/
|
|
383
|
-
interface SessionStore {
|
|
384
|
-
/**
|
|
385
|
-
* Create a new session
|
|
386
|
-
*/
|
|
387
|
-
create(options: CreateSessionOptions): Promise<Session>;
|
|
388
|
-
/**
|
|
389
|
-
* Get a session by ID
|
|
390
|
-
*/
|
|
391
|
-
get(id: string): Promise<Session | undefined>;
|
|
392
|
-
/**
|
|
393
|
-
* List sessions with optional filtering
|
|
394
|
-
*/
|
|
395
|
-
list(options?: ListSessionsOptions): Promise<Session[]>;
|
|
396
|
-
/**
|
|
397
|
-
* Update a session
|
|
398
|
-
*/
|
|
399
|
-
update(id: string, updates: UpdateSessionOptions): Promise<boolean>;
|
|
400
|
-
/**
|
|
401
|
-
* Delete a session
|
|
402
|
-
*/
|
|
403
|
-
delete(id: string): Promise<boolean>;
|
|
404
|
-
/**
|
|
405
|
-
* Get total session count (without pagination)
|
|
406
|
-
*/
|
|
407
|
-
getCount(): Promise<number>;
|
|
408
|
-
/**
|
|
409
|
-
* Add a message to a session
|
|
410
|
-
*/
|
|
411
|
-
addMessage(sessionId: string, message: {
|
|
412
|
-
role: string;
|
|
413
|
-
content: string;
|
|
414
|
-
parts?: unknown[];
|
|
415
|
-
metadata?: Record<string, unknown>;
|
|
416
|
-
}): Promise<string>;
|
|
417
|
-
/**
|
|
418
|
-
* Get messages from a session
|
|
419
|
-
* @param sessionId - Session ID
|
|
420
|
-
* @param offset - Starting index
|
|
421
|
-
* @param limit - Number of messages to return
|
|
422
|
-
* @param options - Additional options (includeArchived, fromCheckpointId, reverse)
|
|
423
|
-
*/
|
|
424
|
-
getMessages(sessionId: string, offset?: number, limit?: number, options?: GetMessagesOptions): Promise<SessionMessage[]>;
|
|
425
|
-
/**
|
|
426
|
-
* Get message indexes by role
|
|
427
|
-
* @param sessionId - Session ID
|
|
428
|
-
* @param role - Role to filter by
|
|
429
|
-
*/
|
|
430
|
-
getMessageIndexes(sessionId: string, role: string): Promise<number[]>;
|
|
431
|
-
/**
|
|
432
|
-
* Get message count for a session
|
|
433
|
-
* @param sessionId - Session ID
|
|
434
|
-
* @param includeArchived - Whether to include archived messages
|
|
435
|
-
*/
|
|
436
|
-
getMessageCount(sessionId: string, includeArchived?: boolean): Promise<number>;
|
|
437
|
-
/**
|
|
438
|
-
* Save a checkpoint to session metadata
|
|
439
|
-
*/
|
|
440
|
-
saveCheckpoint(sessionId: string, checkpoint: SessionCheckpoint): Promise<void>;
|
|
441
|
-
/**
|
|
442
|
-
* Get all checkpoints for a session
|
|
443
|
-
*/
|
|
444
|
-
getCheckpoints(sessionId: string): Promise<SessionCheckpoint[]>;
|
|
445
|
-
/**
|
|
446
|
-
* Get a specific checkpoint
|
|
447
|
-
*/
|
|
448
|
-
getCheckpoint(sessionId: string, checkpointId: string): Promise<SessionCheckpoint | undefined>;
|
|
449
|
-
/**
|
|
450
|
-
* Delete a checkpoint and restore archived messages
|
|
451
|
-
*/
|
|
452
|
-
deleteCheckpoint(sessionId: string, checkpointId: string): Promise<boolean>;
|
|
453
|
-
/**
|
|
454
|
-
* Archive messages (mark as archived for compact)
|
|
455
|
-
* @returns Number of messages archived
|
|
456
|
-
*/
|
|
457
|
-
archiveMessages(sessionId: string, checkpointId: string, beforeIndex: number): Promise<number>;
|
|
458
|
-
/**
|
|
459
|
-
* Get active (non-archived) messages only
|
|
460
|
-
*/
|
|
461
|
-
getActiveMessages(sessionId: string, offset?: number, limit?: number): Promise<SessionMessage[]>;
|
|
462
|
-
/**
|
|
463
|
-
* Close and cleanup resources
|
|
464
|
-
*/
|
|
465
|
-
close(): Promise<void>;
|
|
466
|
-
/**
|
|
467
|
-
* Search messages across all sessions
|
|
468
|
-
*
|
|
469
|
-
* @param options - Search options including query, session filter, time range
|
|
470
|
-
* @returns Array of message matches
|
|
471
|
-
*/
|
|
472
|
-
searchMessages(options: SearchMessagesOptions): Promise<MessageMatch[]>;
|
|
473
|
-
}
|
|
474
|
-
/**
|
|
475
|
-
* Memory-based Session Store with checkpoint support
|
|
476
|
-
*/
|
|
477
|
-
declare class MemorySessionStore implements SessionStore {
|
|
478
|
-
private sessions;
|
|
479
|
-
private messages;
|
|
480
|
-
private checkpoints;
|
|
481
|
-
private messageConverter;
|
|
482
|
-
create(options: CreateSessionOptions): Promise<Session>;
|
|
483
|
-
get(id: string): Promise<Session | undefined>;
|
|
484
|
-
list(options?: ListSessionsOptions): Promise<Session[]>;
|
|
485
|
-
update(id: string, updates: UpdateSessionOptions): Promise<boolean>;
|
|
486
|
-
delete(id: string): Promise<boolean>;
|
|
487
|
-
getCount(): Promise<number>;
|
|
488
|
-
addMessage(sessionId: string, message: {
|
|
489
|
-
role: string;
|
|
490
|
-
content: string;
|
|
491
|
-
parts?: unknown[];
|
|
492
|
-
metadata?: Record<string, unknown>;
|
|
493
|
-
}): Promise<string>;
|
|
494
|
-
getMessages(sessionId: string, offset?: number, limit?: number, options?: GetMessagesOptions): Promise<SessionMessage[]>;
|
|
495
|
-
getMessageCount(sessionId: string, includeArchived?: boolean): Promise<number>;
|
|
496
|
-
getMessageIndexes(sessionId: string, role: string): Promise<number[]>;
|
|
497
|
-
saveCheckpoint(sessionId: string, checkpoint: SessionCheckpoint): Promise<void>;
|
|
498
|
-
getCheckpoints(sessionId: string): Promise<SessionCheckpoint[]>;
|
|
499
|
-
getCheckpoint(sessionId: string, checkpointId: string): Promise<SessionCheckpoint | undefined>;
|
|
500
|
-
deleteCheckpoint(sessionId: string, checkpointId: string): Promise<boolean>;
|
|
501
|
-
archiveMessages(sessionId: string, checkpointId: string, beforeIndex: number): Promise<number>;
|
|
502
|
-
getActiveMessages(sessionId: string, offset?: number, limit?: number): Promise<SessionMessage[]>;
|
|
503
|
-
searchMessages(options: SearchMessagesOptions): Promise<MessageMatch[]>;
|
|
504
|
-
/**
|
|
505
|
-
* Parse simple query into terms
|
|
506
|
-
*/
|
|
507
|
-
private parseQuery;
|
|
508
|
-
close(): Promise<void>;
|
|
509
|
-
}
|
|
510
|
-
/**
|
|
511
|
-
* Get default data directory for session storage
|
|
512
|
-
*/
|
|
513
|
-
declare function getDefaultDataDir(): string;
|
|
514
|
-
/**
|
|
515
|
-
* Get default database path for session storage
|
|
516
|
-
*/
|
|
517
|
-
declare function getDefaultSessionDbPath(): string;
|
|
518
|
-
/**
|
|
519
|
-
* SQLite-based Session Store with checkpoint support
|
|
520
|
-
*
|
|
521
|
-
* Provides persistent storage for sessions and messages using SQLite.
|
|
522
|
-
* Follows the same interface as MemorySessionStore but persists to disk.
|
|
523
|
-
*/
|
|
524
|
-
declare class SQLiteSessionStore implements SessionStore {
|
|
525
|
-
private db;
|
|
526
|
-
private dbPath;
|
|
527
|
-
private initialized;
|
|
528
|
-
private sessionsCache;
|
|
529
|
-
private messagesCache;
|
|
530
|
-
private checkpointsCache;
|
|
531
|
-
private messageConverter;
|
|
532
|
-
constructor(dbPath?: string);
|
|
533
|
-
private initialize;
|
|
534
|
-
create(options: CreateSessionOptions): Promise<Session>;
|
|
535
|
-
get(id: string): Promise<Session | undefined>;
|
|
536
|
-
list(options?: ListSessionsOptions): Promise<Session[]>;
|
|
537
|
-
getCount(): Promise<number>;
|
|
538
|
-
update(id: string, updates: UpdateSessionOptions): Promise<boolean>;
|
|
539
|
-
delete(id: string): Promise<boolean>;
|
|
540
|
-
addMessage(sessionId: string, message: {
|
|
541
|
-
role: string;
|
|
542
|
-
content: string;
|
|
543
|
-
parts?: unknown[];
|
|
544
|
-
metadata?: Record<string, unknown>;
|
|
545
|
-
}): Promise<string>;
|
|
546
|
-
getMessages(sessionId: string, offset?: number, limit?: number, options?: GetMessagesOptions): Promise<SessionMessage[]>;
|
|
547
|
-
getMessageCount(sessionId: string, includeArchived?: boolean): Promise<number>;
|
|
548
|
-
getMessageIndexes(sessionId: string, role: string): Promise<number[]>;
|
|
549
|
-
saveCheckpoint(sessionId: string, checkpoint: SessionCheckpoint): Promise<void>;
|
|
550
|
-
getCheckpoints(sessionId: string): Promise<SessionCheckpoint[]>;
|
|
551
|
-
getCheckpoint(sessionId: string, checkpointId: string): Promise<SessionCheckpoint | undefined>;
|
|
552
|
-
deleteCheckpoint(sessionId: string, checkpointId: string): Promise<boolean>;
|
|
553
|
-
archiveMessages(sessionId: string, checkpointId: string, beforeIndex: number): Promise<number>;
|
|
554
|
-
getActiveMessages(sessionId: string, offset?: number, limit?: number): Promise<SessionMessage[]>;
|
|
555
|
-
searchMessages(options: SearchMessagesOptions): Promise<MessageMatch[]>;
|
|
556
|
-
/**
|
|
557
|
-
* Parse simple query into terms
|
|
558
|
-
*/
|
|
559
|
-
private parseQuery;
|
|
560
|
-
close(): Promise<void>;
|
|
561
|
-
private rowToSession;
|
|
562
|
-
private rowToMessage;
|
|
563
|
-
}
|
|
564
|
-
export { getDefaultSessionDbPath, getDefaultDataDir, SQLiteSessionStore, MemorySessionStore };
|