noumen 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 +215 -0
- package/dist/index.d.ts +551 -0
- package/dist/index.js +1776 -0
- package/dist/index.js.map +1 -0
- package/package.json +41 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
type UUID = string & {
|
|
2
|
+
readonly __brand: unique symbol;
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
interface ToolCallContent {
|
|
6
|
+
id: string;
|
|
7
|
+
type: "function";
|
|
8
|
+
function: {
|
|
9
|
+
name: string;
|
|
10
|
+
arguments: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
interface UserMessage {
|
|
14
|
+
role: "user";
|
|
15
|
+
content: string;
|
|
16
|
+
}
|
|
17
|
+
interface AssistantMessage {
|
|
18
|
+
role: "assistant";
|
|
19
|
+
content: string | null;
|
|
20
|
+
tool_calls?: ToolCallContent[];
|
|
21
|
+
}
|
|
22
|
+
interface ToolResultMessage {
|
|
23
|
+
role: "tool";
|
|
24
|
+
tool_call_id: string;
|
|
25
|
+
content: string;
|
|
26
|
+
}
|
|
27
|
+
interface SystemMessage {
|
|
28
|
+
role: "system";
|
|
29
|
+
content: string;
|
|
30
|
+
}
|
|
31
|
+
type ChatMessage = UserMessage | AssistantMessage | ToolResultMessage | SystemMessage;
|
|
32
|
+
interface SerializedMessage {
|
|
33
|
+
uuid: UUID;
|
|
34
|
+
parentUuid: UUID | null;
|
|
35
|
+
sessionId: string;
|
|
36
|
+
timestamp: string;
|
|
37
|
+
message: ChatMessage;
|
|
38
|
+
}
|
|
39
|
+
interface MessageEntry {
|
|
40
|
+
type: "message";
|
|
41
|
+
uuid: UUID;
|
|
42
|
+
parentUuid: UUID | null;
|
|
43
|
+
sessionId: string;
|
|
44
|
+
timestamp: string;
|
|
45
|
+
message: ChatMessage;
|
|
46
|
+
}
|
|
47
|
+
interface CompactBoundaryEntry {
|
|
48
|
+
type: "compact-boundary";
|
|
49
|
+
uuid: UUID;
|
|
50
|
+
sessionId: string;
|
|
51
|
+
timestamp: string;
|
|
52
|
+
}
|
|
53
|
+
interface SummaryEntry {
|
|
54
|
+
type: "summary";
|
|
55
|
+
uuid: UUID;
|
|
56
|
+
parentUuid: UUID | null;
|
|
57
|
+
sessionId: string;
|
|
58
|
+
timestamp: string;
|
|
59
|
+
message: ChatMessage;
|
|
60
|
+
}
|
|
61
|
+
interface CustomTitleEntry {
|
|
62
|
+
type: "custom-title";
|
|
63
|
+
sessionId: string;
|
|
64
|
+
title: string;
|
|
65
|
+
timestamp: string;
|
|
66
|
+
}
|
|
67
|
+
interface MetadataEntry {
|
|
68
|
+
type: "metadata";
|
|
69
|
+
sessionId: string;
|
|
70
|
+
timestamp: string;
|
|
71
|
+
key: string;
|
|
72
|
+
value: unknown;
|
|
73
|
+
}
|
|
74
|
+
type Entry = MessageEntry | CompactBoundaryEntry | SummaryEntry | CustomTitleEntry | MetadataEntry;
|
|
75
|
+
interface SessionInfo {
|
|
76
|
+
sessionId: string;
|
|
77
|
+
createdAt: string;
|
|
78
|
+
lastMessageAt: string;
|
|
79
|
+
title?: string;
|
|
80
|
+
messageCount: number;
|
|
81
|
+
}
|
|
82
|
+
interface ToolResult$1 {
|
|
83
|
+
content: string;
|
|
84
|
+
isError?: boolean;
|
|
85
|
+
}
|
|
86
|
+
type StreamEvent = {
|
|
87
|
+
type: "text_delta";
|
|
88
|
+
text: string;
|
|
89
|
+
} | {
|
|
90
|
+
type: "tool_use_start";
|
|
91
|
+
toolName: string;
|
|
92
|
+
toolUseId: string;
|
|
93
|
+
} | {
|
|
94
|
+
type: "tool_use_delta";
|
|
95
|
+
input: string;
|
|
96
|
+
} | {
|
|
97
|
+
type: "tool_result";
|
|
98
|
+
toolUseId: string;
|
|
99
|
+
toolName: string;
|
|
100
|
+
result: ToolResult$1;
|
|
101
|
+
} | {
|
|
102
|
+
type: "message_complete";
|
|
103
|
+
message: AssistantMessage;
|
|
104
|
+
} | {
|
|
105
|
+
type: "compact_start";
|
|
106
|
+
} | {
|
|
107
|
+
type: "compact_complete";
|
|
108
|
+
} | {
|
|
109
|
+
type: "error";
|
|
110
|
+
error: Error;
|
|
111
|
+
};
|
|
112
|
+
interface RunOptions {
|
|
113
|
+
signal?: AbortSignal;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
interface ToolParameterProperty$1 {
|
|
117
|
+
type: string;
|
|
118
|
+
description?: string;
|
|
119
|
+
enum?: string[];
|
|
120
|
+
default?: unknown;
|
|
121
|
+
minimum?: number;
|
|
122
|
+
maximum?: number;
|
|
123
|
+
}
|
|
124
|
+
interface ToolDefinition {
|
|
125
|
+
type: "function";
|
|
126
|
+
function: {
|
|
127
|
+
name: string;
|
|
128
|
+
description: string;
|
|
129
|
+
parameters: {
|
|
130
|
+
type: "object";
|
|
131
|
+
properties: Record<string, ToolParameterProperty$1>;
|
|
132
|
+
required?: string[];
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
interface ChatStreamDelta {
|
|
137
|
+
role?: "assistant";
|
|
138
|
+
content?: string | null;
|
|
139
|
+
tool_calls?: Array<{
|
|
140
|
+
index: number;
|
|
141
|
+
id?: string;
|
|
142
|
+
type?: "function";
|
|
143
|
+
function?: {
|
|
144
|
+
name?: string;
|
|
145
|
+
arguments?: string;
|
|
146
|
+
};
|
|
147
|
+
}>;
|
|
148
|
+
}
|
|
149
|
+
interface ChatStreamChoice {
|
|
150
|
+
index: number;
|
|
151
|
+
delta: ChatStreamDelta;
|
|
152
|
+
finish_reason: string | null;
|
|
153
|
+
}
|
|
154
|
+
interface ChatStreamChunk {
|
|
155
|
+
id: string;
|
|
156
|
+
choices: ChatStreamChoice[];
|
|
157
|
+
model: string;
|
|
158
|
+
usage?: {
|
|
159
|
+
prompt_tokens: number;
|
|
160
|
+
completion_tokens: number;
|
|
161
|
+
total_tokens: number;
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
interface ChatCompletionUsage {
|
|
165
|
+
prompt_tokens: number;
|
|
166
|
+
completion_tokens: number;
|
|
167
|
+
total_tokens: number;
|
|
168
|
+
}
|
|
169
|
+
interface ChatParams {
|
|
170
|
+
model: string;
|
|
171
|
+
messages: ChatMessage[];
|
|
172
|
+
tools?: ToolDefinition[];
|
|
173
|
+
max_tokens?: number;
|
|
174
|
+
system?: string;
|
|
175
|
+
temperature?: number;
|
|
176
|
+
}
|
|
177
|
+
interface AIProvider {
|
|
178
|
+
chat(params: ChatParams): AsyncIterable<ChatStreamChunk>;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
interface FileEntry {
|
|
182
|
+
name: string;
|
|
183
|
+
path: string;
|
|
184
|
+
isDirectory: boolean;
|
|
185
|
+
isFile: boolean;
|
|
186
|
+
size?: number;
|
|
187
|
+
}
|
|
188
|
+
interface FileStat {
|
|
189
|
+
size: number;
|
|
190
|
+
isDirectory: boolean;
|
|
191
|
+
isFile: boolean;
|
|
192
|
+
createdAt?: Date;
|
|
193
|
+
modifiedAt?: Date;
|
|
194
|
+
}
|
|
195
|
+
interface ReadOptions {
|
|
196
|
+
encoding?: BufferEncoding;
|
|
197
|
+
}
|
|
198
|
+
interface VirtualFs {
|
|
199
|
+
readFile(path: string, opts?: ReadOptions): Promise<string>;
|
|
200
|
+
writeFile(path: string, content: string): Promise<void>;
|
|
201
|
+
appendFile(path: string, content: string): Promise<void>;
|
|
202
|
+
deleteFile(path: string, opts?: {
|
|
203
|
+
recursive?: boolean;
|
|
204
|
+
}): Promise<void>;
|
|
205
|
+
mkdir(path: string, opts?: {
|
|
206
|
+
recursive?: boolean;
|
|
207
|
+
}): Promise<void>;
|
|
208
|
+
readdir(path: string, opts?: {
|
|
209
|
+
recursive?: boolean;
|
|
210
|
+
}): Promise<FileEntry[]>;
|
|
211
|
+
exists(path: string): Promise<boolean>;
|
|
212
|
+
stat(path: string): Promise<FileStat>;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
interface ExecOptions {
|
|
216
|
+
timeout?: number;
|
|
217
|
+
cwd?: string;
|
|
218
|
+
env?: Record<string, string>;
|
|
219
|
+
}
|
|
220
|
+
interface CommandResult {
|
|
221
|
+
exitCode: number;
|
|
222
|
+
stdout: string;
|
|
223
|
+
stderr: string;
|
|
224
|
+
}
|
|
225
|
+
interface VirtualComputer {
|
|
226
|
+
executeCommand(command: string, opts?: ExecOptions): Promise<CommandResult>;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
interface SkillDefinition {
|
|
230
|
+
name: string;
|
|
231
|
+
content: string;
|
|
232
|
+
path?: string;
|
|
233
|
+
description?: string;
|
|
234
|
+
/** Glob patterns for files this skill applies to */
|
|
235
|
+
globs?: string[];
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
interface AutoCompactConfig {
|
|
239
|
+
enabled: boolean;
|
|
240
|
+
/** Token threshold at which to trigger compaction */
|
|
241
|
+
threshold: number;
|
|
242
|
+
}
|
|
243
|
+
declare function createAutoCompactConfig(opts?: {
|
|
244
|
+
enabled?: boolean;
|
|
245
|
+
threshold?: number;
|
|
246
|
+
}): AutoCompactConfig;
|
|
247
|
+
declare function shouldAutoCompact(messages: ChatMessage[], config: AutoCompactConfig): boolean;
|
|
248
|
+
|
|
249
|
+
interface ThreadOptions {
|
|
250
|
+
sessionId?: string;
|
|
251
|
+
resume?: boolean;
|
|
252
|
+
cwd?: string;
|
|
253
|
+
model?: string;
|
|
254
|
+
}
|
|
255
|
+
interface ThreadConfig {
|
|
256
|
+
aiProvider: AIProvider;
|
|
257
|
+
fs: VirtualFs;
|
|
258
|
+
computer: VirtualComputer;
|
|
259
|
+
sessionDir: string;
|
|
260
|
+
skills?: SkillDefinition[];
|
|
261
|
+
systemPrompt?: string;
|
|
262
|
+
model?: string;
|
|
263
|
+
maxTokens?: number;
|
|
264
|
+
autoCompact?: AutoCompactConfig;
|
|
265
|
+
}
|
|
266
|
+
declare class Thread {
|
|
267
|
+
readonly sessionId: string;
|
|
268
|
+
private config;
|
|
269
|
+
private storage;
|
|
270
|
+
private toolRegistry;
|
|
271
|
+
private messages;
|
|
272
|
+
private loaded;
|
|
273
|
+
private abortController;
|
|
274
|
+
private cwd;
|
|
275
|
+
private model;
|
|
276
|
+
constructor(config: ThreadConfig, opts?: ThreadOptions);
|
|
277
|
+
run(prompt: string, opts?: RunOptions): AsyncGenerator<StreamEvent, void, unknown>;
|
|
278
|
+
getMessages(): Promise<ChatMessage[]>;
|
|
279
|
+
compact(opts?: {
|
|
280
|
+
instructions?: string;
|
|
281
|
+
}): Promise<void>;
|
|
282
|
+
abort(): void;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
interface CodeOptions {
|
|
286
|
+
aiProvider: AIProvider;
|
|
287
|
+
virtualFs: VirtualFs;
|
|
288
|
+
virtualComputer: VirtualComputer;
|
|
289
|
+
options?: {
|
|
290
|
+
sessionDir?: string;
|
|
291
|
+
skills?: SkillDefinition[];
|
|
292
|
+
skillsPaths?: string[];
|
|
293
|
+
systemPrompt?: string;
|
|
294
|
+
model?: string;
|
|
295
|
+
maxTokens?: number;
|
|
296
|
+
autoCompact?: boolean;
|
|
297
|
+
autoCompactThreshold?: number;
|
|
298
|
+
cwd?: string;
|
|
299
|
+
};
|
|
300
|
+
}
|
|
301
|
+
declare class Code {
|
|
302
|
+
private aiProvider;
|
|
303
|
+
private fs;
|
|
304
|
+
private computer;
|
|
305
|
+
private sessionDir;
|
|
306
|
+
private skills;
|
|
307
|
+
private skillsPaths;
|
|
308
|
+
private systemPrompt?;
|
|
309
|
+
private model?;
|
|
310
|
+
private maxTokens?;
|
|
311
|
+
private autoCompactEnabled;
|
|
312
|
+
private autoCompactThreshold?;
|
|
313
|
+
private cwd;
|
|
314
|
+
private storage;
|
|
315
|
+
private resolvedSkills;
|
|
316
|
+
constructor(opts: CodeOptions);
|
|
317
|
+
private getSkills;
|
|
318
|
+
createThread(opts?: ThreadOptions): Thread;
|
|
319
|
+
listSessions(): Promise<SessionInfo[]>;
|
|
320
|
+
/**
|
|
321
|
+
* Pre-resolve skills from paths. Call this once after construction if using
|
|
322
|
+
* skillsPaths, so that createThread() has skills available synchronously.
|
|
323
|
+
*/
|
|
324
|
+
init(): Promise<void>;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
interface OpenAIProviderOptions {
|
|
328
|
+
apiKey: string;
|
|
329
|
+
baseURL?: string;
|
|
330
|
+
model?: string;
|
|
331
|
+
}
|
|
332
|
+
declare class OpenAIProvider implements AIProvider {
|
|
333
|
+
private client;
|
|
334
|
+
private defaultModel;
|
|
335
|
+
constructor(opts: OpenAIProviderOptions);
|
|
336
|
+
chat(params: ChatParams): AsyncIterable<ChatStreamChunk>;
|
|
337
|
+
private buildMessages;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
interface AnthropicProviderOptions {
|
|
341
|
+
apiKey: string;
|
|
342
|
+
baseURL?: string;
|
|
343
|
+
model?: string;
|
|
344
|
+
}
|
|
345
|
+
declare class AnthropicProvider implements AIProvider {
|
|
346
|
+
private client;
|
|
347
|
+
private defaultModel;
|
|
348
|
+
constructor(opts: AnthropicProviderOptions);
|
|
349
|
+
chat(params: ChatParams): AsyncIterable<ChatStreamChunk>;
|
|
350
|
+
private makeChunk;
|
|
351
|
+
private convertMessages;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
interface GeminiProviderOptions {
|
|
355
|
+
apiKey: string;
|
|
356
|
+
model?: string;
|
|
357
|
+
}
|
|
358
|
+
declare class GeminiProvider implements AIProvider {
|
|
359
|
+
private client;
|
|
360
|
+
private defaultModel;
|
|
361
|
+
constructor(opts: GeminiProviderOptions);
|
|
362
|
+
chat(params: ChatParams): AsyncIterable<ChatStreamChunk>;
|
|
363
|
+
private convertMessages;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
interface LocalFsOptions {
|
|
367
|
+
basePath?: string;
|
|
368
|
+
}
|
|
369
|
+
declare class LocalFs implements VirtualFs {
|
|
370
|
+
private basePath;
|
|
371
|
+
constructor(opts?: LocalFsOptions);
|
|
372
|
+
private resolve;
|
|
373
|
+
readFile(filePath: string, opts?: ReadOptions): Promise<string>;
|
|
374
|
+
writeFile(filePath: string, content: string): Promise<void>;
|
|
375
|
+
appendFile(filePath: string, content: string): Promise<void>;
|
|
376
|
+
deleteFile(filePath: string, opts?: {
|
|
377
|
+
recursive?: boolean;
|
|
378
|
+
}): Promise<void>;
|
|
379
|
+
mkdir(dirPath: string, opts?: {
|
|
380
|
+
recursive?: boolean;
|
|
381
|
+
}): Promise<void>;
|
|
382
|
+
readdir(dirPath: string, opts?: {
|
|
383
|
+
recursive?: boolean;
|
|
384
|
+
}): Promise<FileEntry[]>;
|
|
385
|
+
exists(filePath: string): Promise<boolean>;
|
|
386
|
+
stat(filePath: string): Promise<FileStat>;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
interface LocalComputerOptions {
|
|
390
|
+
defaultCwd?: string;
|
|
391
|
+
defaultTimeout?: number;
|
|
392
|
+
}
|
|
393
|
+
declare class LocalComputer implements VirtualComputer {
|
|
394
|
+
private defaultCwd;
|
|
395
|
+
private defaultTimeout;
|
|
396
|
+
constructor(opts?: LocalComputerOptions);
|
|
397
|
+
executeCommand(command: string, opts?: ExecOptions): Promise<CommandResult>;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
interface SpritesFsOptions {
|
|
401
|
+
/** sprites.dev API token */
|
|
402
|
+
token: string;
|
|
403
|
+
/** Name of the sprite container */
|
|
404
|
+
spriteName: string;
|
|
405
|
+
/** Base URL for sprites API (default: https://api.sprites.dev) */
|
|
406
|
+
baseURL?: string;
|
|
407
|
+
/** Working directory inside the sprite (default: /home/sprite) */
|
|
408
|
+
workingDir?: string;
|
|
409
|
+
}
|
|
410
|
+
declare class SpritesFs implements VirtualFs {
|
|
411
|
+
private token;
|
|
412
|
+
private spriteName;
|
|
413
|
+
private baseURL;
|
|
414
|
+
private workingDir;
|
|
415
|
+
constructor(opts: SpritesFsOptions);
|
|
416
|
+
private fsUrl;
|
|
417
|
+
private resolvePath;
|
|
418
|
+
private headers;
|
|
419
|
+
readFile(filePath: string, _opts?: ReadOptions): Promise<string>;
|
|
420
|
+
writeFile(filePath: string, content: string): Promise<void>;
|
|
421
|
+
appendFile(filePath: string, content: string): Promise<void>;
|
|
422
|
+
deleteFile(filePath: string, opts?: {
|
|
423
|
+
recursive?: boolean;
|
|
424
|
+
}): Promise<void>;
|
|
425
|
+
mkdir(dirPath: string, opts?: {
|
|
426
|
+
recursive?: boolean;
|
|
427
|
+
}): Promise<void>;
|
|
428
|
+
readdir(dirPath: string, _opts?: {
|
|
429
|
+
recursive?: boolean;
|
|
430
|
+
}): Promise<FileEntry[]>;
|
|
431
|
+
exists(filePath: string): Promise<boolean>;
|
|
432
|
+
stat(filePath: string): Promise<FileStat>;
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
interface SpritesComputerOptions {
|
|
436
|
+
/** sprites.dev API token */
|
|
437
|
+
token: string;
|
|
438
|
+
/** Name of the sprite container */
|
|
439
|
+
spriteName: string;
|
|
440
|
+
/** Base URL for sprites API (default: https://api.sprites.dev) */
|
|
441
|
+
baseURL?: string;
|
|
442
|
+
/** Working directory inside the sprite (default: /home/sprite) */
|
|
443
|
+
workingDir?: string;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Executes commands inside a sprites.dev container via the exec REST endpoint.
|
|
447
|
+
*
|
|
448
|
+
* Uses the non-interactive exec mode: POST a command and get back
|
|
449
|
+
* stdout/stderr/exit_code. For more complex use cases (streaming, TTY),
|
|
450
|
+
* the WebSocket exec endpoint would be used, but for tool-call purposes
|
|
451
|
+
* the REST endpoint is sufficient.
|
|
452
|
+
*/
|
|
453
|
+
declare class SpritesComputer implements VirtualComputer {
|
|
454
|
+
private token;
|
|
455
|
+
private spriteName;
|
|
456
|
+
private baseURL;
|
|
457
|
+
private workingDir;
|
|
458
|
+
constructor(opts: SpritesComputerOptions);
|
|
459
|
+
private headers;
|
|
460
|
+
executeCommand(command: string, opts?: ExecOptions): Promise<CommandResult>;
|
|
461
|
+
private shellEscape;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
interface ToolResult {
|
|
465
|
+
content: string;
|
|
466
|
+
isError?: boolean;
|
|
467
|
+
}
|
|
468
|
+
interface ToolContext {
|
|
469
|
+
fs: VirtualFs;
|
|
470
|
+
computer: VirtualComputer;
|
|
471
|
+
cwd: string;
|
|
472
|
+
}
|
|
473
|
+
interface ToolParameterProperty {
|
|
474
|
+
type: string;
|
|
475
|
+
description?: string;
|
|
476
|
+
enum?: string[];
|
|
477
|
+
default?: unknown;
|
|
478
|
+
minimum?: number;
|
|
479
|
+
maximum?: number;
|
|
480
|
+
}
|
|
481
|
+
interface ToolParameters {
|
|
482
|
+
type: "object";
|
|
483
|
+
properties: Record<string, ToolParameterProperty>;
|
|
484
|
+
required?: string[];
|
|
485
|
+
}
|
|
486
|
+
interface Tool {
|
|
487
|
+
name: string;
|
|
488
|
+
description: string;
|
|
489
|
+
parameters: ToolParameters;
|
|
490
|
+
call(args: Record<string, unknown>, ctx: ToolContext): Promise<ToolResult>;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
declare class ToolRegistry {
|
|
494
|
+
private tools;
|
|
495
|
+
constructor(additionalTools?: Tool[]);
|
|
496
|
+
get(name: string): Tool | undefined;
|
|
497
|
+
execute(name: string, args: Record<string, unknown>, ctx: ToolContext): Promise<{
|
|
498
|
+
content: string;
|
|
499
|
+
isError?: boolean;
|
|
500
|
+
}>;
|
|
501
|
+
toToolDefinitions(): ToolDefinition[];
|
|
502
|
+
listTools(): Tool[];
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
declare const readFileTool: Tool;
|
|
506
|
+
|
|
507
|
+
declare const writeFileTool: Tool;
|
|
508
|
+
|
|
509
|
+
declare const editFileTool: Tool;
|
|
510
|
+
|
|
511
|
+
declare const bashTool: Tool;
|
|
512
|
+
|
|
513
|
+
declare const globTool: Tool;
|
|
514
|
+
|
|
515
|
+
declare const grepTool: Tool;
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Load skill definitions from SKILL.md files found at the given paths on the VirtualFs.
|
|
519
|
+
* Each path can be a directory (scanned for SKILL.md files) or a direct file.
|
|
520
|
+
*/
|
|
521
|
+
declare function loadSkills(fs: VirtualFs, paths: string[]): Promise<SkillDefinition[]>;
|
|
522
|
+
|
|
523
|
+
declare class SessionStorage {
|
|
524
|
+
private fs;
|
|
525
|
+
private sessionDir;
|
|
526
|
+
constructor(fs: VirtualFs, sessionDir: string);
|
|
527
|
+
private getTranscriptPath;
|
|
528
|
+
ensureDir(): Promise<void>;
|
|
529
|
+
appendEntry(sessionId: string, entry: Entry): Promise<void>;
|
|
530
|
+
appendMessage(sessionId: string, message: ChatMessage, parentUuid?: UUID | null): Promise<UUID>;
|
|
531
|
+
appendCompactBoundary(sessionId: string): Promise<UUID>;
|
|
532
|
+
appendSummary(sessionId: string, summaryMessage: ChatMessage, parentUuid?: UUID | null): Promise<UUID>;
|
|
533
|
+
loadMessages(sessionId: string): Promise<ChatMessage[]>;
|
|
534
|
+
loadAllEntries(sessionId: string): Promise<Entry[]>;
|
|
535
|
+
sessionExists(sessionId: string): Promise<boolean>;
|
|
536
|
+
listSessions(): Promise<SessionInfo[]>;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
interface CompactOptions {
|
|
540
|
+
customInstructions?: string;
|
|
541
|
+
}
|
|
542
|
+
declare function compactConversation(aiProvider: AIProvider, model: string, messages: ChatMessage[], storage: SessionStorage, sessionId: string, opts?: CompactOptions): Promise<ChatMessage[]>;
|
|
543
|
+
|
|
544
|
+
declare function buildSystemPrompt(opts: {
|
|
545
|
+
customPrompt?: string;
|
|
546
|
+
skills?: SkillDefinition[];
|
|
547
|
+
tools?: Tool[];
|
|
548
|
+
date?: string;
|
|
549
|
+
}): string;
|
|
550
|
+
|
|
551
|
+
export { type AIProvider, AnthropicProvider, type AnthropicProviderOptions, type AssistantMessage, type AutoCompactConfig, type ChatCompletionUsage, type ChatMessage, type ChatParams, type ChatStreamChoice, type ChatStreamChunk, type ChatStreamDelta, Code, type CodeOptions, type CommandResult, type CompactBoundaryEntry, type CustomTitleEntry, type Entry, type ExecOptions, type FileEntry, type FileStat, GeminiProvider, type GeminiProviderOptions, LocalComputer, type LocalComputerOptions, LocalFs, type LocalFsOptions, type MessageEntry, type MetadataEntry, OpenAIProvider, type OpenAIProviderOptions, type ReadOptions, type RunOptions, type SerializedMessage, type SessionInfo, type SkillDefinition, SpritesComputer, type SpritesComputerOptions, SpritesFs, type SpritesFsOptions, type StreamEvent, type SummaryEntry, type SystemMessage, Thread, type ThreadConfig, type ThreadOptions, type Tool, type ToolCallContent, type ToolResult as ToolCallResult, type ToolContext, type ToolParameterProperty$1 as ToolDefParameterProperty, type ToolDefinition, type ToolParameters, ToolRegistry, type ToolResult$1 as ToolResult, type ToolResultMessage, type UserMessage, type VirtualComputer, type VirtualFs, bashTool, buildSystemPrompt, compactConversation, createAutoCompactConfig, editFileTool, globTool, grepTool, loadSkills, readFileTool, shouldAutoCompact, writeFileTool };
|