@soederpop/luca 0.0.31 → 0.0.34
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 +241 -36
- package/bun.lock +24 -5
- package/commands/build-python-bridge.ts +43 -0
- package/docs/apis/clients/rest.md +7 -7
- package/docs/apis/clients/websocket.md +23 -10
- package/docs/apis/features/agi/assistant.md +155 -8
- package/docs/apis/features/agi/assistants-manager.md +90 -22
- package/docs/apis/features/agi/auto-assistant.md +377 -0
- package/docs/apis/features/agi/browser-use.md +802 -0
- package/docs/apis/features/agi/claude-code.md +6 -1
- package/docs/apis/features/agi/conversation-history.md +7 -6
- package/docs/apis/features/agi/conversation.md +111 -38
- package/docs/apis/features/agi/docs-reader.md +35 -57
- package/docs/apis/features/agi/file-tools.md +163 -0
- package/docs/apis/features/agi/openapi.md +2 -2
- package/docs/apis/features/agi/skills-library.md +227 -0
- package/docs/apis/features/node/content-db.md +125 -4
- package/docs/apis/features/node/disk-cache.md +11 -11
- package/docs/apis/features/node/downloader.md +1 -1
- package/docs/apis/features/node/file-manager.md +15 -15
- package/docs/apis/features/node/fs.md +78 -21
- package/docs/apis/features/node/git.md +50 -10
- package/docs/apis/features/node/google-calendar.md +3 -0
- package/docs/apis/features/node/google-docs.md +10 -1
- package/docs/apis/features/node/google-drive.md +3 -0
- package/docs/apis/features/node/google-mail.md +214 -0
- package/docs/apis/features/node/google-sheets.md +3 -0
- package/docs/apis/features/node/ink.md +10 -10
- package/docs/apis/features/node/ipc-socket.md +83 -93
- package/docs/apis/features/node/networking.md +5 -5
- package/docs/apis/features/node/os.md +7 -7
- package/docs/apis/features/node/package-finder.md +14 -14
- package/docs/apis/features/node/proc.md +2 -1
- package/docs/apis/features/node/process-manager.md +70 -3
- package/docs/apis/features/node/python.md +265 -9
- package/docs/apis/features/node/redis.md +380 -0
- package/docs/apis/features/node/ui.md +13 -13
- package/docs/apis/servers/express.md +35 -7
- package/docs/apis/servers/mcp.md +3 -3
- package/docs/apis/servers/websocket.md +51 -8
- package/docs/bootstrap/CLAUDE.md +1 -1
- package/docs/bootstrap/SKILL.md +93 -7
- package/docs/examples/feature-as-tool-provider.md +143 -0
- package/docs/examples/python.md +42 -1
- package/docs/introspection.md +15 -5
- package/docs/tutorials/00-bootstrap.md +3 -3
- package/docs/tutorials/02-container.md +2 -2
- package/docs/tutorials/10-creating-features.md +5 -0
- package/docs/tutorials/13-introspection.md +12 -2
- package/docs/tutorials/19-python-sessions.md +401 -0
- package/package.json +8 -4
- package/src/agi/container.server.ts +8 -0
- package/src/agi/features/assistant.ts +19 -0
- package/src/agi/features/autonomous-assistant.ts +435 -0
- package/src/agi/features/conversation.ts +58 -6
- package/src/agi/features/file-tools.ts +286 -0
- package/src/agi/features/luca-coder.ts +643 -0
- package/src/bootstrap/generated.ts +705 -17
- package/src/cli/build-info.ts +2 -2
- package/src/cli/cli.ts +22 -13
- package/src/commands/bootstrap.ts +49 -6
- package/src/commands/code.ts +369 -0
- package/src/commands/describe.ts +7 -2
- package/src/commands/index.ts +1 -0
- package/src/commands/sandbox-mcp.ts +7 -7
- package/src/commands/save-api-docs.ts +1 -1
- package/src/container-describer.ts +4 -4
- package/src/container.ts +10 -19
- package/src/helper.ts +24 -33
- package/src/introspection/generated.agi.ts +2499 -63
- package/src/introspection/generated.node.ts +1625 -688
- package/src/introspection/generated.web.ts +15 -57
- package/src/node/container.ts +5 -0
- package/src/node/features/figlet-fonts.ts +597 -0
- package/src/node/features/fs.ts +3 -9
- package/src/node/features/helpers.ts +20 -0
- package/src/node/features/python.ts +429 -16
- package/src/node/features/redis.ts +446 -0
- package/src/node/features/ui.ts +4 -11
- package/src/python/bridge.py +220 -0
- package/src/python/generated.ts +227 -0
- package/src/scaffolds/generated.ts +1 -1
- package/test/python-session.test.ts +105 -0
- package/assistants/lucaExpert/CORE.md +0 -37
- package/assistants/lucaExpert/hooks.ts +0 -9
- package/assistants/lucaExpert/tools.ts +0 -177
|
@@ -52,6 +52,8 @@ container.feature('claudeCode', {
|
|
|
52
52
|
settingsFile,
|
|
53
53
|
// Directories containing Claude Code skills to load into sessions
|
|
54
54
|
skillsFolders,
|
|
55
|
+
// Launch Claude Code with a Chrome browser tool
|
|
56
|
+
chrome,
|
|
55
57
|
})
|
|
56
58
|
```
|
|
57
59
|
|
|
@@ -82,6 +84,7 @@ container.feature('claudeCode', {
|
|
|
82
84
|
| `strictMcpConfig` | `boolean` | Require strict MCP config validation |
|
|
83
85
|
| `settingsFile` | `string` | Path to a custom settings file |
|
|
84
86
|
| `skillsFolders` | `array` | Directories containing Claude Code skills to load into sessions |
|
|
87
|
+
| `chrome` | `boolean` | Launch Claude Code with a Chrome browser tool |
|
|
85
88
|
|
|
86
89
|
## Methods
|
|
87
90
|
|
|
@@ -180,6 +183,7 @@ Run a prompt in a new Claude Code session. Spawns a subprocess, streams NDJSON e
|
|
|
180
183
|
| `debug` | `string | boolean` | Enable debug output. Pass a string for specific debug channels, or true for all. |
|
|
181
184
|
| `debugFile` | `string` | Path to write debug output to a file. |
|
|
182
185
|
| `settingsFile` | `string` | Path to a custom settings file. |
|
|
186
|
+
| `chrome` | `boolean` | Launch Claude Code with a Chrome browser tool. |
|
|
183
187
|
|
|
184
188
|
**Returns:** `Promise<ClaudeSession>`
|
|
185
189
|
|
|
@@ -258,6 +262,7 @@ Run a prompt without waiting for completion. Returns the session ID immediately
|
|
|
258
262
|
| `debug` | `string | boolean` | Enable debug output. Pass a string for specific debug channels, or true for all. |
|
|
259
263
|
| `debugFile` | `string` | Path to write debug output to a file. |
|
|
260
264
|
| `settingsFile` | `string` | Path to a custom settings file. |
|
|
265
|
+
| `chrome` | `boolean` | Launch Claude Code with a Chrome browser tool. |
|
|
261
266
|
|
|
262
267
|
**Returns:** `Promise<string>`
|
|
263
268
|
|
|
@@ -346,7 +351,7 @@ Get aggregated usage statistics across all sessions, or for a specific session.
|
|
|
346
351
|
|------|------|----------|-------------|
|
|
347
352
|
| `sessionId` | `string` | | Optional session ID to get usage for a single session |
|
|
348
353
|
|
|
349
|
-
**Returns:** `
|
|
354
|
+
**Returns:** `{ totalCostUsd: number; totalInputTokens: number; totalOutputTokens: number; totalCacheReadTokens: number; totalCacheCreationTokens: number; totalTurns: number; sessionCount: number; sessions: Array<{ id: string; costUsd: number; turns: number; inputTokens: number; outputTokens: number; status: string`
|
|
350
355
|
|
|
351
356
|
```ts
|
|
352
357
|
const stats = cc.usage()
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# ConversationHistory (features.conversationHistory)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Persists conversations to disk using the diskCache feature (cacache). Each conversation is stored as a JSON blob keyed by ID, with metadata stored alongside for efficient listing and search without loading full message arrays.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
8
|
container.feature('conversationHistory', {
|
|
9
|
-
//
|
|
9
|
+
// Custom cache directory for conversation storage
|
|
10
10
|
cachePath,
|
|
11
|
-
// Namespace prefix to isolate datasets
|
|
11
|
+
// Namespace prefix for cache keys to isolate datasets
|
|
12
12
|
namespace,
|
|
13
13
|
})
|
|
14
14
|
```
|
|
@@ -17,8 +17,8 @@ container.feature('conversationHistory', {
|
|
|
17
17
|
|
|
18
18
|
| Property | Type | Description |
|
|
19
19
|
|----------|------|-------------|
|
|
20
|
-
| `cachePath` | `string` |
|
|
21
|
-
| `namespace` | `string` | Namespace prefix to isolate datasets |
|
|
20
|
+
| `cachePath` | `string` | Custom cache directory for conversation storage |
|
|
21
|
+
| `namespace` | `string` | Namespace prefix for cache keys to isolate datasets |
|
|
22
22
|
|
|
23
23
|
## Methods
|
|
24
24
|
|
|
@@ -307,7 +307,8 @@ Delete all conversations matching a thread prefix.
|
|
|
307
307
|
|
|
308
308
|
| Property | Type | Description |
|
|
309
309
|
|----------|------|-------------|
|
|
310
|
-
| `
|
|
310
|
+
| `diskCache` | `DiskCache` | |
|
|
311
|
+
| `namespace` | `string` | |
|
|
311
312
|
|
|
312
313
|
## Events (Zod v4 schema)
|
|
313
314
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Conversation (features.conversation)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A self-contained conversation with OpenAI that supports streaming, tool calling, and message state management.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
@@ -30,8 +30,20 @@ container.feature('conversation', {
|
|
|
30
30
|
clientOptions,
|
|
31
31
|
// Whether to use the local ollama models instead of the remote OpenAI models
|
|
32
32
|
local,
|
|
33
|
-
// Maximum number of output tokens per completion
|
|
33
|
+
// Maximum number of output tokens per completion (default 512)
|
|
34
34
|
maxTokens,
|
|
35
|
+
// Sampling temperature (0-2). Higher = more random, lower = more deterministic
|
|
36
|
+
temperature,
|
|
37
|
+
// Nucleus sampling cutoff (0-1). Lower = more focused
|
|
38
|
+
topP,
|
|
39
|
+
// Top-K sampling. Only supported by local/Anthropic models
|
|
40
|
+
topK,
|
|
41
|
+
// Frequency penalty (-2 to 2). Positive = discourage repetition
|
|
42
|
+
frequencyPenalty,
|
|
43
|
+
// Presence penalty (-2 to 2). Positive = encourage new topics
|
|
44
|
+
presencePenalty,
|
|
45
|
+
// Stop sequences — generation halts when any of these strings is produced
|
|
46
|
+
stop,
|
|
35
47
|
// Enable automatic compaction when input tokens approach the context limit
|
|
36
48
|
autoCompact,
|
|
37
49
|
// Fraction of context window at which auto-compact triggers (default 0.8)
|
|
@@ -59,7 +71,13 @@ container.feature('conversation', {
|
|
|
59
71
|
| `metadata` | `object` | Arbitrary metadata to attach to this conversation |
|
|
60
72
|
| `clientOptions` | `object` | Options for the OpenAI client |
|
|
61
73
|
| `local` | `boolean` | Whether to use the local ollama models instead of the remote OpenAI models |
|
|
62
|
-
| `maxTokens` | `number` | Maximum number of output tokens per completion |
|
|
74
|
+
| `maxTokens` | `number` | Maximum number of output tokens per completion (default 512) |
|
|
75
|
+
| `temperature` | `number` | Sampling temperature (0-2). Higher = more random, lower = more deterministic |
|
|
76
|
+
| `topP` | `number` | Nucleus sampling cutoff (0-1). Lower = more focused |
|
|
77
|
+
| `topK` | `number` | Top-K sampling. Only supported by local/Anthropic models |
|
|
78
|
+
| `frequencyPenalty` | `number` | Frequency penalty (-2 to 2). Positive = discourage repetition |
|
|
79
|
+
| `presencePenalty` | `number` | Presence penalty (-2 to 2). Positive = encourage new topics |
|
|
80
|
+
| `stop` | `array` | Stop sequences — generation halts when any of these strings is produced |
|
|
63
81
|
| `autoCompact` | `boolean` | Enable automatic compaction when input tokens approach the context limit |
|
|
64
82
|
| `compactThreshold` | `number` | Fraction of context window at which auto-compact triggers (default 0.8) |
|
|
65
83
|
| `contextWindow` | `number` | Override the inferred context window size for this model |
|
|
@@ -67,6 +85,57 @@ container.feature('conversation', {
|
|
|
67
85
|
|
|
68
86
|
## Methods
|
|
69
87
|
|
|
88
|
+
### addTool
|
|
89
|
+
|
|
90
|
+
Add or replace a single tool by name. Uses the same format as tools passed at construction time.
|
|
91
|
+
|
|
92
|
+
**Parameters:**
|
|
93
|
+
|
|
94
|
+
| Name | Type | Required | Description |
|
|
95
|
+
|------|------|----------|-------------|
|
|
96
|
+
| `name` | `string` | ✓ | Parameter name |
|
|
97
|
+
| `tool` | `ConversationTool` | ✓ | Parameter tool |
|
|
98
|
+
|
|
99
|
+
`ConversationTool` properties:
|
|
100
|
+
|
|
101
|
+
| Property | Type | Description |
|
|
102
|
+
|----------|------|-------------|
|
|
103
|
+
| `handler` | `(...args: any[]) => Promise<any>` | |
|
|
104
|
+
| `description` | `string` | |
|
|
105
|
+
| `parameters` | `Record<string, any>` | |
|
|
106
|
+
|
|
107
|
+
**Returns:** `this`
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
### removeTool
|
|
112
|
+
|
|
113
|
+
Remove a tool by name.
|
|
114
|
+
|
|
115
|
+
**Parameters:**
|
|
116
|
+
|
|
117
|
+
| Name | Type | Required | Description |
|
|
118
|
+
|------|------|----------|-------------|
|
|
119
|
+
| `name` | `string` | ✓ | Parameter name |
|
|
120
|
+
|
|
121
|
+
**Returns:** `this`
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
### updateTools
|
|
126
|
+
|
|
127
|
+
Merge new tools into the conversation, replacing any with the same name. Accepts the same Record<string, ConversationTool> format used at construction time.
|
|
128
|
+
|
|
129
|
+
**Parameters:**
|
|
130
|
+
|
|
131
|
+
| Name | Type | Required | Description |
|
|
132
|
+
|------|------|----------|-------------|
|
|
133
|
+
| `tools` | `Record<string, ConversationTool>` | ✓ | Parameter tools |
|
|
134
|
+
|
|
135
|
+
**Returns:** `this`
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
70
139
|
### estimateTokens
|
|
71
140
|
|
|
72
141
|
Estimate the input token count for the current messages array using the js-tiktoken tokenizer. Updates state.
|
|
@@ -113,6 +182,7 @@ Send a message and get a streamed response. Automatically handles tool calls by
|
|
|
113
182
|
| Property | Type | Description |
|
|
114
183
|
|----------|------|-------------|
|
|
115
184
|
| `maxTokens` | `number` | |
|
|
185
|
+
| `schema` | `z.ZodType` | When provided, enables OpenAI Structured Outputs. The model is constrained to return JSON matching this Zod schema. The return value of ask() will be the parsed object instead of a raw string. |
|
|
116
186
|
|
|
117
187
|
**Returns:** `Promise<string>`
|
|
118
188
|
|
|
@@ -159,7 +229,8 @@ Append a message to the conversation state.
|
|
|
159
229
|
|
|
160
230
|
| Property | Type | Description |
|
|
161
231
|
|----------|------|-------------|
|
|
162
|
-
| `tools` | `Record<string,
|
|
232
|
+
| `tools` | `Record<string, ConversationTool>` | Returns the registered tools available for the model to call. |
|
|
233
|
+
| `availableTools` | `any` | |
|
|
163
234
|
| `mcpServers` | `Record<string, ConversationMCPServer>` | Returns configured remote MCP servers keyed by server label. |
|
|
164
235
|
| `messages` | `Message[]` | Returns the full message history of the conversation. |
|
|
165
236
|
| `model` | `string` | Returns the OpenAI model name being used for completions. |
|
|
@@ -244,127 +315,127 @@ Fired when a user message is added to the conversation
|
|
|
244
315
|
|
|
245
316
|
|
|
246
317
|
|
|
247
|
-
###
|
|
318
|
+
### toolError
|
|
248
319
|
|
|
249
|
-
Fired
|
|
320
|
+
Fired when a tool handler throws or the tool is unknown
|
|
250
321
|
|
|
251
322
|
**Event Arguments:**
|
|
252
323
|
|
|
253
324
|
| Name | Type | Description |
|
|
254
325
|
|------|------|-------------|
|
|
255
|
-
| `
|
|
256
|
-
| `
|
|
326
|
+
| `arg0` | `string` | Tool name |
|
|
327
|
+
| `arg1` | `any` | Error object or message |
|
|
257
328
|
|
|
258
329
|
|
|
259
330
|
|
|
260
|
-
###
|
|
331
|
+
### toolCall
|
|
261
332
|
|
|
262
|
-
Fired
|
|
333
|
+
Fired before invoking a single tool handler
|
|
263
334
|
|
|
264
335
|
**Event Arguments:**
|
|
265
336
|
|
|
266
337
|
| Name | Type | Description |
|
|
267
338
|
|------|------|-------------|
|
|
268
|
-
| `arg0` | `
|
|
339
|
+
| `arg0` | `string` | Tool name |
|
|
340
|
+
| `arg1` | `any` | Parsed arguments object |
|
|
269
341
|
|
|
270
342
|
|
|
271
343
|
|
|
272
|
-
###
|
|
344
|
+
### toolResult
|
|
273
345
|
|
|
274
|
-
Fired
|
|
346
|
+
Fired after a tool handler returns successfully
|
|
275
347
|
|
|
276
348
|
**Event Arguments:**
|
|
277
349
|
|
|
278
350
|
| Name | Type | Description |
|
|
279
351
|
|------|------|-------------|
|
|
280
|
-
| `arg0` | `
|
|
352
|
+
| `arg0` | `string` | Tool name |
|
|
353
|
+
| `arg1` | `string` | Serialized result |
|
|
281
354
|
|
|
282
355
|
|
|
283
356
|
|
|
284
|
-
###
|
|
357
|
+
### turnStart
|
|
285
358
|
|
|
286
|
-
Fired
|
|
359
|
+
Fired at the start of each completion turn
|
|
287
360
|
|
|
288
361
|
**Event Arguments:**
|
|
289
362
|
|
|
290
363
|
| Name | Type | Description |
|
|
291
364
|
|------|------|-------------|
|
|
292
|
-
| `
|
|
365
|
+
| `turn` | `number` | |
|
|
366
|
+
| `isFollowUp` | `boolean` | |
|
|
293
367
|
|
|
294
368
|
|
|
295
369
|
|
|
296
|
-
###
|
|
370
|
+
### rawEvent
|
|
297
371
|
|
|
298
|
-
Fired
|
|
372
|
+
Fired for every raw event from the Responses API stream
|
|
299
373
|
|
|
300
374
|
**Event Arguments:**
|
|
301
375
|
|
|
302
376
|
| Name | Type | Description |
|
|
303
377
|
|------|------|-------------|
|
|
304
|
-
| `arg0` | `
|
|
378
|
+
| `arg0` | `any` | Raw stream event from the API |
|
|
305
379
|
|
|
306
380
|
|
|
307
381
|
|
|
308
|
-
###
|
|
382
|
+
### mcpEvent
|
|
309
383
|
|
|
310
|
-
Fired
|
|
384
|
+
Fired for MCP-related events from the Responses API
|
|
311
385
|
|
|
312
386
|
**Event Arguments:**
|
|
313
387
|
|
|
314
388
|
| Name | Type | Description |
|
|
315
389
|
|------|------|-------------|
|
|
316
|
-
| `arg0` | `any` |
|
|
390
|
+
| `arg0` | `any` | MCP-related stream event |
|
|
317
391
|
|
|
318
392
|
|
|
319
393
|
|
|
320
|
-
###
|
|
394
|
+
### chunk
|
|
321
395
|
|
|
322
|
-
Fired
|
|
396
|
+
Fired for each streaming text delta
|
|
323
397
|
|
|
324
398
|
**Event Arguments:**
|
|
325
399
|
|
|
326
400
|
| Name | Type | Description |
|
|
327
401
|
|------|------|-------------|
|
|
328
|
-
| `arg0` | `
|
|
402
|
+
| `arg0` | `string` | Text delta from the stream |
|
|
329
403
|
|
|
330
404
|
|
|
331
405
|
|
|
332
|
-
###
|
|
406
|
+
### preview
|
|
333
407
|
|
|
334
|
-
Fired
|
|
408
|
+
Fired after each chunk with the full accumulated text
|
|
335
409
|
|
|
336
410
|
**Event Arguments:**
|
|
337
411
|
|
|
338
412
|
| Name | Type | Description |
|
|
339
413
|
|------|------|-------------|
|
|
340
|
-
| `arg0` | `string` |
|
|
341
|
-
| `arg1` | `any` | Error object or message |
|
|
414
|
+
| `arg0` | `string` | Accumulated text so far |
|
|
342
415
|
|
|
343
416
|
|
|
344
417
|
|
|
345
|
-
###
|
|
418
|
+
### responseCompleted
|
|
346
419
|
|
|
347
|
-
Fired
|
|
420
|
+
Fired when the Responses API stream completes
|
|
348
421
|
|
|
349
422
|
**Event Arguments:**
|
|
350
423
|
|
|
351
424
|
| Name | Type | Description |
|
|
352
425
|
|------|------|-------------|
|
|
353
|
-
| `arg0` | `
|
|
354
|
-
| `arg1` | `any` | Parsed arguments object |
|
|
426
|
+
| `arg0` | `any` | The completed OpenAI Response object |
|
|
355
427
|
|
|
356
428
|
|
|
357
429
|
|
|
358
|
-
###
|
|
430
|
+
### toolCallsStart
|
|
359
431
|
|
|
360
|
-
Fired
|
|
432
|
+
Fired when the model begins a batch of tool calls
|
|
361
433
|
|
|
362
434
|
**Event Arguments:**
|
|
363
435
|
|
|
364
436
|
| Name | Type | Description |
|
|
365
437
|
|------|------|-------------|
|
|
366
|
-
| `arg0` | `
|
|
367
|
-
| `arg1` | `string` | Serialized result |
|
|
438
|
+
| `arg0` | `any` | Array of tool call objects from the model |
|
|
368
439
|
|
|
369
440
|
|
|
370
441
|
|
|
@@ -417,6 +488,8 @@ Fired when the final text response is produced
|
|
|
417
488
|
| `estimatedInputTokens` | `number` | Estimated input token count for the current messages array |
|
|
418
489
|
| `compactionCount` | `number` | Number of times compact() has been called |
|
|
419
490
|
| `contextWindow` | `number` | The context window size for the current model |
|
|
491
|
+
| `tools` | `object` | Active tools map including any runtime overrides |
|
|
492
|
+
| `callMaxTokens` | `any` | Per-call max tokens override, cleared after each ask() |
|
|
420
493
|
|
|
421
494
|
## Examples
|
|
422
495
|
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# DocsReader (features.docsReader)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The DocsReader feature is an AI Assisted wrapper around a ContentDB feature. You can ask it questions about the content, and it will use the ContentDB to find the answers from the documents.
|
|
4
4
|
|
|
5
5
|
## Usage
|
|
6
6
|
|
|
7
7
|
```ts
|
|
8
8
|
container.feature('docsReader', {
|
|
9
|
-
//
|
|
9
|
+
// Either the contentDb instance or the path to the contentDb you want to load
|
|
10
10
|
contentDb,
|
|
11
|
-
//
|
|
12
|
-
systemPrompt,
|
|
13
|
-
// OpenAI model to use for the conversation
|
|
11
|
+
// The model to use for the conversation
|
|
14
12
|
model,
|
|
13
|
+
// Whether to use a local model for the conversation
|
|
14
|
+
local,
|
|
15
15
|
})
|
|
16
16
|
```
|
|
17
17
|
|
|
@@ -19,55 +19,53 @@ container.feature('docsReader', {
|
|
|
19
19
|
|
|
20
20
|
| Property | Type | Description |
|
|
21
21
|
|----------|------|-------------|
|
|
22
|
-
| `contentDb` | `any` |
|
|
23
|
-
| `
|
|
24
|
-
| `
|
|
22
|
+
| `contentDb` | `any` | Either the contentDb instance or the path to the contentDb you want to load |
|
|
23
|
+
| `model` | `string` | The model to use for the conversation |
|
|
24
|
+
| `local` | `boolean` | Whether to use a local model for the conversation |
|
|
25
25
|
|
|
26
26
|
## Methods
|
|
27
27
|
|
|
28
|
-
###
|
|
29
|
-
|
|
30
|
-
Build the tool definitions (listDocs, readDoc, readDocOutline, readDocs) that the conversation model uses to query the content database.
|
|
31
|
-
|
|
32
|
-
**Returns:** `Record<string, ConversationTool>`
|
|
28
|
+
### calculateCacheKeyForQuestion
|
|
33
29
|
|
|
30
|
+
**Parameters:**
|
|
34
31
|
|
|
32
|
+
| Name | Type | Required | Description |
|
|
33
|
+
|------|------|----------|-------------|
|
|
34
|
+
| `question` | `string` | ✓ | Parameter question |
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
**Returns:** `void`
|
|
37
37
|
|
|
38
|
-
Build the system prompt by combining the optional prefix with a table of contents generated from the content database.
|
|
39
38
|
|
|
40
|
-
**Returns:** `string`
|
|
41
39
|
|
|
40
|
+
### ask
|
|
42
41
|
|
|
42
|
+
**Parameters:**
|
|
43
43
|
|
|
44
|
-
|
|
44
|
+
| Name | Type | Required | Description |
|
|
45
|
+
|------|------|----------|-------------|
|
|
46
|
+
| `question` | `string` | ✓ | Parameter question |
|
|
45
47
|
|
|
46
|
-
|
|
48
|
+
**Returns:** `void`
|
|
47
49
|
|
|
48
|
-
**Returns:** `Conversation`
|
|
49
50
|
|
|
50
51
|
|
|
52
|
+
### askCached
|
|
51
53
|
|
|
52
|
-
|
|
54
|
+
**Parameters:**
|
|
53
55
|
|
|
54
|
-
|
|
56
|
+
| Name | Type | Required | Description |
|
|
57
|
+
|------|------|----------|-------------|
|
|
58
|
+
| `question` | `string` | ✓ | Parameter question |
|
|
55
59
|
|
|
56
60
|
**Returns:** `void`
|
|
57
61
|
|
|
58
62
|
|
|
59
63
|
|
|
60
|
-
###
|
|
61
|
-
|
|
62
|
-
Ask the docs reader a question. It will read relevant documents and return an answer based on their content.
|
|
63
|
-
|
|
64
|
-
**Parameters:**
|
|
64
|
+
### start
|
|
65
65
|
|
|
66
|
-
|
|
67
|
-
|------|------|----------|-------------|
|
|
68
|
-
| `question` | `string` | ✓ | The question to ask |
|
|
66
|
+
Start the docs reader by loading the contentDb and wiring its tools into an assistant.
|
|
69
67
|
|
|
70
|
-
**Returns:** `
|
|
68
|
+
**Returns:** `Promise<DocsReader>`
|
|
71
69
|
|
|
72
70
|
|
|
73
71
|
|
|
@@ -75,26 +73,21 @@ Ask the docs reader a question. It will read relevant documents and return an an
|
|
|
75
73
|
|
|
76
74
|
| Property | Type | Description |
|
|
77
75
|
|----------|------|-------------|
|
|
78
|
-
| `
|
|
79
|
-
| `
|
|
76
|
+
| `isStarted` | `boolean` | Whether the docs reader has been started. |
|
|
77
|
+
| `answerCache` | `any` | |
|
|
78
|
+
| `contentDb` | `ContentDb` | |
|
|
80
79
|
|
|
81
80
|
## Events (Zod v4 schema)
|
|
82
81
|
|
|
83
|
-
###
|
|
84
|
-
|
|
85
|
-
Event emitted by DocsReader
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
### preview
|
|
82
|
+
### started
|
|
90
83
|
|
|
91
84
|
Event emitted by DocsReader
|
|
92
85
|
|
|
93
86
|
|
|
94
87
|
|
|
95
|
-
###
|
|
88
|
+
### loaded
|
|
96
89
|
|
|
97
|
-
|
|
90
|
+
Fired after the docs reader has been started
|
|
98
91
|
|
|
99
92
|
|
|
100
93
|
|
|
@@ -103,19 +96,4 @@ Event emitted by DocsReader
|
|
|
103
96
|
| Property | Type | Description |
|
|
104
97
|
|----------|------|-------------|
|
|
105
98
|
| `enabled` | `boolean` | Whether this feature is currently enabled |
|
|
106
|
-
| `started` | `boolean` | Whether the docs reader has been
|
|
107
|
-
| `docsLoaded` | `boolean` | Whether the content database has been loaded |
|
|
108
|
-
|
|
109
|
-
## Examples
|
|
110
|
-
|
|
111
|
-
**features.docsReader**
|
|
112
|
-
|
|
113
|
-
```ts
|
|
114
|
-
const reader = container.feature('docsReader', {
|
|
115
|
-
contentDb: myContentDb,
|
|
116
|
-
model: 'gpt-4.1'
|
|
117
|
-
})
|
|
118
|
-
await reader.start()
|
|
119
|
-
const answer = await reader.ask('How does authentication work?')
|
|
120
|
-
```
|
|
121
|
-
|
|
99
|
+
| `started` | `boolean` | Whether the docs reader has been started |
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# FileTools (features.fileTools)
|
|
2
|
+
|
|
3
|
+
Curated file-system and code-search tools for AI assistants. Wraps the container's `fs` and `grep` features into a focused tool surface modeled on the tools that coding assistants (Claude Code, Cursor, etc.) rely on: read, write, edit, list, search, find, stat, mkdir, move, copy, delete. Usage: ```typescript const fileTools = container.feature('fileTools') assistant.use(fileTools) // or selectively: assistant.use(fileTools.toTools({ only: ['readFile', 'searchFiles', 'listDirectory'] })) ```
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
container.feature('fileTools')
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Methods
|
|
12
|
+
|
|
13
|
+
### readFile
|
|
14
|
+
|
|
15
|
+
**Parameters:**
|
|
16
|
+
|
|
17
|
+
| Name | Type | Required | Description |
|
|
18
|
+
|------|------|----------|-------------|
|
|
19
|
+
| `args` | `{ path: string; offset?: number; limit?: number }` | ✓ | Parameter args |
|
|
20
|
+
|
|
21
|
+
**Returns:** `Promise<string>`
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### writeFile
|
|
26
|
+
|
|
27
|
+
**Parameters:**
|
|
28
|
+
|
|
29
|
+
| Name | Type | Required | Description |
|
|
30
|
+
|------|------|----------|-------------|
|
|
31
|
+
| `args` | `{ path: string; content: string }` | ✓ | Parameter args |
|
|
32
|
+
|
|
33
|
+
**Returns:** `Promise<string>`
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
### editFile
|
|
38
|
+
|
|
39
|
+
**Parameters:**
|
|
40
|
+
|
|
41
|
+
| Name | Type | Required | Description |
|
|
42
|
+
|------|------|----------|-------------|
|
|
43
|
+
| `args` | `{ path: string; oldString: string; newString: string; replaceAll?: boolean }` | ✓ | Parameter args |
|
|
44
|
+
|
|
45
|
+
**Returns:** `Promise<string>`
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
### listDirectory
|
|
50
|
+
|
|
51
|
+
**Parameters:**
|
|
52
|
+
|
|
53
|
+
| Name | Type | Required | Description |
|
|
54
|
+
|------|------|----------|-------------|
|
|
55
|
+
| `args` | `{ path?: string; recursive?: boolean; include?: string; exclude?: string }` | ✓ | Parameter args |
|
|
56
|
+
|
|
57
|
+
**Returns:** `Promise<string>`
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
### searchFiles
|
|
62
|
+
|
|
63
|
+
**Parameters:**
|
|
64
|
+
|
|
65
|
+
| Name | Type | Required | Description |
|
|
66
|
+
|------|------|----------|-------------|
|
|
67
|
+
| `args` | `{ pattern: string; path?: string; include?: string; exclude?: string; ignoreCase?: boolean; maxResults?: number }` | ✓ | Parameter args |
|
|
68
|
+
|
|
69
|
+
**Returns:** `Promise<string>`
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
### findFiles
|
|
74
|
+
|
|
75
|
+
**Parameters:**
|
|
76
|
+
|
|
77
|
+
| Name | Type | Required | Description |
|
|
78
|
+
|------|------|----------|-------------|
|
|
79
|
+
| `args` | `{ pattern: string; path?: string; exclude?: string }` | ✓ | Parameter args |
|
|
80
|
+
|
|
81
|
+
**Returns:** `Promise<string>`
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
### fileInfo
|
|
86
|
+
|
|
87
|
+
**Parameters:**
|
|
88
|
+
|
|
89
|
+
| Name | Type | Required | Description |
|
|
90
|
+
|------|------|----------|-------------|
|
|
91
|
+
| `args` | `{ path: string }` | ✓ | Parameter args |
|
|
92
|
+
|
|
93
|
+
**Returns:** `Promise<string>`
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
### createDirectory
|
|
98
|
+
|
|
99
|
+
**Parameters:**
|
|
100
|
+
|
|
101
|
+
| Name | Type | Required | Description |
|
|
102
|
+
|------|------|----------|-------------|
|
|
103
|
+
| `args` | `{ path: string }` | ✓ | Parameter args |
|
|
104
|
+
|
|
105
|
+
**Returns:** `Promise<string>`
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
### moveFile
|
|
110
|
+
|
|
111
|
+
**Parameters:**
|
|
112
|
+
|
|
113
|
+
| Name | Type | Required | Description |
|
|
114
|
+
|------|------|----------|-------------|
|
|
115
|
+
| `args` | `{ source: string; destination: string }` | ✓ | Parameter args |
|
|
116
|
+
|
|
117
|
+
**Returns:** `Promise<string>`
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
### copyFile
|
|
122
|
+
|
|
123
|
+
**Parameters:**
|
|
124
|
+
|
|
125
|
+
| Name | Type | Required | Description |
|
|
126
|
+
|------|------|----------|-------------|
|
|
127
|
+
| `args` | `{ source: string; destination: string }` | ✓ | Parameter args |
|
|
128
|
+
|
|
129
|
+
**Returns:** `Promise<string>`
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
### deleteFile
|
|
134
|
+
|
|
135
|
+
**Parameters:**
|
|
136
|
+
|
|
137
|
+
| Name | Type | Required | Description |
|
|
138
|
+
|------|------|----------|-------------|
|
|
139
|
+
| `args` | `{ path: string }` | ✓ | Parameter args |
|
|
140
|
+
|
|
141
|
+
**Returns:** `Promise<string>`
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
### setupToolsConsumer
|
|
146
|
+
|
|
147
|
+
When an assistant uses fileTools, inject system prompt guidance about how to use the tools effectively.
|
|
148
|
+
|
|
149
|
+
**Parameters:**
|
|
150
|
+
|
|
151
|
+
| Name | Type | Required | Description |
|
|
152
|
+
|------|------|----------|-------------|
|
|
153
|
+
| `consumer` | `Helper` | ✓ | Parameter consumer |
|
|
154
|
+
|
|
155
|
+
**Returns:** `void`
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
## State (Zod v4 schema)
|
|
160
|
+
|
|
161
|
+
| Property | Type | Description |
|
|
162
|
+
|----------|------|-------------|
|
|
163
|
+
| `enabled` | `boolean` | Whether this feature is currently enabled |
|