@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
|
@@ -92,7 +92,7 @@ Convert a single endpoint (by name) to an OpenAI function definition.
|
|
|
92
92
|
|
|
93
93
|
Return a compact JSON summary of all endpoints, useful for logging or REPL inspection.
|
|
94
94
|
|
|
95
|
-
**Returns:** `
|
|
95
|
+
**Returns:** `{ title: string, version: string, serverUrl: string, endpointCount: number, endpoints: object[]`
|
|
96
96
|
|
|
97
97
|
|
|
98
98
|
|
|
@@ -109,7 +109,7 @@ Return a compact JSON summary of all endpoints, useful for logging or REPL inspe
|
|
|
109
109
|
|
|
110
110
|
## Events (Zod v4 schema)
|
|
111
111
|
|
|
112
|
-
###
|
|
112
|
+
### started
|
|
113
113
|
|
|
114
114
|
Event emitted by OpenAPI
|
|
115
115
|
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# SkillsLibrary (features.skillsLibrary)
|
|
2
|
+
|
|
3
|
+
Manages a registry of skill locations — folders containing SKILL.md files. Persists known locations to ~/.luca/skills.json and scans them on start. Each skill folder can be opened as a DocsReader for AI-assisted Q&A. Exposes tools for assistant integration via assistant.use(skillsLibrary).
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
container.feature('skillsLibrary', {
|
|
9
|
+
// Override path for skills.json (defaults to ~/.luca/skills.json)
|
|
10
|
+
configPath,
|
|
11
|
+
})
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Options (Zod v4 schema)
|
|
15
|
+
|
|
16
|
+
| Property | Type | Description |
|
|
17
|
+
|----------|------|-------------|
|
|
18
|
+
| `configPath` | `string` | Override path for skills.json (defaults to ~/.luca/skills.json) |
|
|
19
|
+
|
|
20
|
+
## Methods
|
|
21
|
+
|
|
22
|
+
### start
|
|
23
|
+
|
|
24
|
+
Start the skills library: read config, scan all locations.
|
|
25
|
+
|
|
26
|
+
**Returns:** `Promise<SkillsLibrary>`
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
### addLocation
|
|
31
|
+
|
|
32
|
+
Add a new skill location folder and scan it for skills.
|
|
33
|
+
|
|
34
|
+
**Parameters:**
|
|
35
|
+
|
|
36
|
+
| Name | Type | Required | Description |
|
|
37
|
+
|------|------|----------|-------------|
|
|
38
|
+
| `locationPath` | `string` | ✓ | Path to a directory containing skill subfolders with SKILL.md |
|
|
39
|
+
|
|
40
|
+
**Returns:** `Promise<void>`
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
### removeLocation
|
|
45
|
+
|
|
46
|
+
Remove a skill location and its skills from the library.
|
|
47
|
+
|
|
48
|
+
**Parameters:**
|
|
49
|
+
|
|
50
|
+
| Name | Type | Required | Description |
|
|
51
|
+
|------|------|----------|-------------|
|
|
52
|
+
| `locationPath` | `string` | ✓ | The location path to remove |
|
|
53
|
+
|
|
54
|
+
**Returns:** `Promise<void>`
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
### scanLocation
|
|
59
|
+
|
|
60
|
+
Scan a location folder for skill subfolders containing SKILL.md.
|
|
61
|
+
|
|
62
|
+
**Parameters:**
|
|
63
|
+
|
|
64
|
+
| Name | Type | Required | Description |
|
|
65
|
+
|------|------|----------|-------------|
|
|
66
|
+
| `locationPath` | `string` | ✓ | Absolute path to scan |
|
|
67
|
+
|
|
68
|
+
**Returns:** `Promise<void>`
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
### list
|
|
73
|
+
|
|
74
|
+
Return all discovered skills.
|
|
75
|
+
|
|
76
|
+
**Returns:** `SkillInfo[]`
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
### find
|
|
81
|
+
|
|
82
|
+
Find a skill by name.
|
|
83
|
+
|
|
84
|
+
**Parameters:**
|
|
85
|
+
|
|
86
|
+
| Name | Type | Required | Description |
|
|
87
|
+
|------|------|----------|-------------|
|
|
88
|
+
| `skillName` | `string` | ✓ | Parameter skillName |
|
|
89
|
+
|
|
90
|
+
**Returns:** `SkillInfo | undefined`
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
### createSkillReader
|
|
95
|
+
|
|
96
|
+
Create a DocsReader for a skill's folder, enabling AI-assisted Q&A.
|
|
97
|
+
|
|
98
|
+
**Parameters:**
|
|
99
|
+
|
|
100
|
+
| Name | Type | Required | Description |
|
|
101
|
+
|------|------|----------|-------------|
|
|
102
|
+
| `skillName` | `string` | ✓ | Name of the skill to create a reader for |
|
|
103
|
+
|
|
104
|
+
**Returns:** `DocsReader`
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
### ensureFolderCreatedWithSkillsByName
|
|
109
|
+
|
|
110
|
+
Create a tmp directory containing symlinked/copied skill folders by name, suitable for passing to claude --add-dir.
|
|
111
|
+
|
|
112
|
+
**Parameters:**
|
|
113
|
+
|
|
114
|
+
| Name | Type | Required | Description |
|
|
115
|
+
|------|------|----------|-------------|
|
|
116
|
+
| `skillNames` | `string[]` | ✓ | Array of skill names to include |
|
|
117
|
+
|
|
118
|
+
**Returns:** `string`
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
### searchAvailableSkills
|
|
123
|
+
|
|
124
|
+
Search available skills, optionally filtered by a query string.
|
|
125
|
+
|
|
126
|
+
**Parameters:**
|
|
127
|
+
|
|
128
|
+
| Name | Type | Required | Description |
|
|
129
|
+
|------|------|----------|-------------|
|
|
130
|
+
| `{ query }` | `{ query?: string }` | | Parameter { query } |
|
|
131
|
+
|
|
132
|
+
**Returns:** `Promise<string>`
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
### loadSkill
|
|
137
|
+
|
|
138
|
+
Load a skill's full SKILL.md content and metadata.
|
|
139
|
+
|
|
140
|
+
**Parameters:**
|
|
141
|
+
|
|
142
|
+
| Name | Type | Required | Description |
|
|
143
|
+
|------|------|----------|-------------|
|
|
144
|
+
| `{ skillName }` | `{ skillName: string }` | ✓ | Parameter { skillName } |
|
|
145
|
+
|
|
146
|
+
**Returns:** `Promise<string>`
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
### askSkillBasedQuestion
|
|
151
|
+
|
|
152
|
+
Ask a question about a specific skill using a DocsReader.
|
|
153
|
+
|
|
154
|
+
**Parameters:**
|
|
155
|
+
|
|
156
|
+
| Name | Type | Required | Description |
|
|
157
|
+
|------|------|----------|-------------|
|
|
158
|
+
| `{ skillName, question }` | `{ skillName: string; question: string }` | ✓ | Parameter { skillName, question } |
|
|
159
|
+
|
|
160
|
+
**Returns:** `Promise<string>`
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
## Getters
|
|
165
|
+
|
|
166
|
+
| Property | Type | Description |
|
|
167
|
+
|----------|------|-------------|
|
|
168
|
+
| `skills` | `Record<string, SkillInfo>` | Discovered skills keyed by name. |
|
|
169
|
+
| `availableSkills` | `any` | |
|
|
170
|
+
| `skillsTable` | `Record<string, string>` | |
|
|
171
|
+
| `configPath` | `string` | Resolved path to the skills.json config file. |
|
|
172
|
+
| `isStarted` | `boolean` | Whether the library has been loaded. |
|
|
173
|
+
|
|
174
|
+
## Events (Zod v4 schema)
|
|
175
|
+
|
|
176
|
+
### started
|
|
177
|
+
|
|
178
|
+
Fired after all skill locations have been scanned
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
### locationAdded
|
|
183
|
+
|
|
184
|
+
Fired when a new skill location is registered
|
|
185
|
+
|
|
186
|
+
**Event Arguments:**
|
|
187
|
+
|
|
188
|
+
| Name | Type | Description |
|
|
189
|
+
|------|------|-------------|
|
|
190
|
+
| `arg0` | `string` | The absolute path of the added location |
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
### skillDiscovered
|
|
195
|
+
|
|
196
|
+
Fired when a skill is discovered during scanning
|
|
197
|
+
|
|
198
|
+
**Event Arguments:**
|
|
199
|
+
|
|
200
|
+
| Name | Type | Description |
|
|
201
|
+
|------|------|-------------|
|
|
202
|
+
| `arg0` | `any` | The SkillInfo object |
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
## State (Zod v4 schema)
|
|
207
|
+
|
|
208
|
+
| Property | Type | Description |
|
|
209
|
+
|----------|------|-------------|
|
|
210
|
+
| `enabled` | `boolean` | Whether this feature is currently enabled |
|
|
211
|
+
| `loaded` | `boolean` | Whether skill locations have been scanned |
|
|
212
|
+
| `locations` | `array` | Tracked skill location folder paths |
|
|
213
|
+
| `skillCount` | `number` | Total number of discovered skills |
|
|
214
|
+
| `skills` | `object` | Discovered skills keyed by name |
|
|
215
|
+
|
|
216
|
+
## Examples
|
|
217
|
+
|
|
218
|
+
**features.skillsLibrary**
|
|
219
|
+
|
|
220
|
+
```ts
|
|
221
|
+
const lib = container.feature('skillsLibrary')
|
|
222
|
+
await lib.start()
|
|
223
|
+
await lib.addLocation('~/.claude/skills')
|
|
224
|
+
lib.list() // => SkillInfo[]
|
|
225
|
+
const reader = lib.createSkillReader('my-skill')
|
|
226
|
+
```
|
|
227
|
+
|
|
@@ -19,6 +19,32 @@ container.feature('contentDb', {
|
|
|
19
19
|
|
|
20
20
|
## Methods
|
|
21
21
|
|
|
22
|
+
### renderTree
|
|
23
|
+
|
|
24
|
+
Render a tree view of the collection directory structure. Built with container.fs so it works without the `tree` binary.
|
|
25
|
+
|
|
26
|
+
**Parameters:**
|
|
27
|
+
|
|
28
|
+
| Name | Type | Required | Description |
|
|
29
|
+
|------|------|----------|-------------|
|
|
30
|
+
| `options` | `{ depth?: number; dirsOnly?: boolean }` | | Parameter options |
|
|
31
|
+
|
|
32
|
+
**Returns:** `string`
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### grep
|
|
37
|
+
|
|
38
|
+
**Parameters:**
|
|
39
|
+
|
|
40
|
+
| Name | Type | Required | Description |
|
|
41
|
+
|------|------|----------|-------------|
|
|
42
|
+
| `options` | `string | GrepOptions` | ✓ | Parameter options |
|
|
43
|
+
|
|
44
|
+
**Returns:** `void`
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
22
48
|
### query
|
|
23
49
|
|
|
24
50
|
Query documents belonging to a specific model definition.
|
|
@@ -228,16 +254,111 @@ Rebuild the entire search index from scratch.
|
|
|
228
254
|
|
|
229
255
|
|
|
230
256
|
|
|
257
|
+
### getCollectionOverview
|
|
258
|
+
|
|
259
|
+
Returns a high-level overview of the collection.
|
|
260
|
+
|
|
261
|
+
**Returns:** `void`
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
### listDocuments
|
|
266
|
+
|
|
267
|
+
List document IDs, optionally filtered by model or glob.
|
|
268
|
+
|
|
269
|
+
**Parameters:**
|
|
270
|
+
|
|
271
|
+
| Name | Type | Required | Description |
|
|
272
|
+
|------|------|----------|-------------|
|
|
273
|
+
| `args` | `{ model?: string; glob?: string }` | ✓ | Parameter args |
|
|
274
|
+
|
|
275
|
+
**Returns:** `void`
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
### readDocument
|
|
280
|
+
|
|
281
|
+
Read a single document with optional section filtering.
|
|
282
|
+
|
|
283
|
+
**Parameters:**
|
|
284
|
+
|
|
285
|
+
| Name | Type | Required | Description |
|
|
286
|
+
|------|------|----------|-------------|
|
|
287
|
+
| `args` | `{ id: string; include?: string[]; exclude?: string[]; meta?: boolean }` | ✓ | Parameter args |
|
|
288
|
+
|
|
289
|
+
**Returns:** `void`
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
### readMultipleDocuments
|
|
294
|
+
|
|
295
|
+
Read multiple documents with optional section filtering.
|
|
296
|
+
|
|
297
|
+
**Parameters:**
|
|
298
|
+
|
|
299
|
+
| Name | Type | Required | Description |
|
|
300
|
+
|------|------|----------|-------------|
|
|
301
|
+
| `args` | `{ ids: string[]; include?: string[]; exclude?: string[]; meta?: boolean }` | ✓ | Parameter args |
|
|
302
|
+
|
|
303
|
+
**Returns:** `void`
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
### queryDocuments
|
|
308
|
+
|
|
309
|
+
Query documents by model with filters, sort, limit.
|
|
310
|
+
|
|
311
|
+
**Parameters:**
|
|
312
|
+
|
|
313
|
+
| Name | Type | Required | Description |
|
|
314
|
+
|------|------|----------|-------------|
|
|
315
|
+
| `args` | `{ model: string; where?: string; sort?: string; limit?: number; offset?: number; select?: string[] }` | ✓ | Parameter args |
|
|
316
|
+
|
|
317
|
+
**Returns:** `void`
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
### searchContent
|
|
322
|
+
|
|
323
|
+
Grep/text search across the collection.
|
|
324
|
+
|
|
325
|
+
**Parameters:**
|
|
326
|
+
|
|
327
|
+
| Name | Type | Required | Description |
|
|
328
|
+
|------|------|----------|-------------|
|
|
329
|
+
| `args` | `{ pattern: string; caseSensitive?: boolean }` | ✓ | Parameter args |
|
|
330
|
+
|
|
331
|
+
**Returns:** `void`
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
|
|
335
|
+
### semanticSearch
|
|
336
|
+
|
|
337
|
+
Hybrid semantic search with graceful fallback to grep.
|
|
338
|
+
|
|
339
|
+
**Parameters:**
|
|
340
|
+
|
|
341
|
+
| Name | Type | Required | Description |
|
|
342
|
+
|------|------|----------|-------------|
|
|
343
|
+
| `args` | `{ query: string; limit?: number }` | ✓ | Parameter args |
|
|
344
|
+
|
|
345
|
+
**Returns:** `void`
|
|
346
|
+
|
|
347
|
+
|
|
348
|
+
|
|
231
349
|
## Getters
|
|
232
350
|
|
|
233
351
|
| Property | Type | Description |
|
|
234
352
|
|----------|------|-------------|
|
|
235
|
-
| `isLoaded` | `
|
|
236
|
-
| `collection` | `
|
|
237
|
-
| `collectionPath` | `
|
|
353
|
+
| `isLoaded` | `boolean` | Whether the content database has been loaded. |
|
|
354
|
+
| `collection` | `Collection` | Returns the lazily-initialized Collection instance for the configured rootPath. |
|
|
355
|
+
| `collectionPath` | `string` | Returns the absolute resolved path to the collection root directory. |
|
|
238
356
|
| `models` | `Record<string, ModelDefinition>` | Returns an object mapping model names to their model definitions, sourced from the collection. |
|
|
239
357
|
| `modelNames` | `string[]` | Returns an array of all registered model names from the collection. |
|
|
240
|
-
| `
|
|
358
|
+
| `available` | `string[]` | Returns the available document ids in the collection |
|
|
359
|
+
| `modelDefinitionTable` | `Record<string, { description: string; glob: string; routePatterns: string[] }>` | |
|
|
360
|
+
| `fileTree` | `string` | |
|
|
361
|
+
| `searchIndexStatus` | `{ exists: boolean; documentCount: number; chunkCount: number; embeddingCount: number; lastIndexedAt: any; provider: any; model: any; dimensions: number; dbSizeBytes: number }` | Get the current search index status. |
|
|
241
362
|
| `queries` | `Record<string, ReturnType<typeof this.query>>` | Returns an object with query builders keyed by model name (singular and plural, lowercased). Provides a convenient shorthand for querying without looking up model definitions manually. |
|
|
242
363
|
|
|
243
364
|
## Events (Zod v4 schema)
|
|
@@ -22,7 +22,7 @@ Retrieve a file from the disk cache and save it to the local disk
|
|
|
22
22
|
| `outputPath` | `string` | ✓ | The local path where the file should be saved |
|
|
23
23
|
| `isBase64` | `any` | | Whether the cached content is base64 encoded |
|
|
24
24
|
|
|
25
|
-
**Returns:** `
|
|
25
|
+
**Returns:** `Promise<Buffer | string>`
|
|
26
26
|
|
|
27
27
|
```ts
|
|
28
28
|
await diskCache.saveFile('myFile', './output/file.txt')
|
|
@@ -42,7 +42,7 @@ Ensure a key exists in the cache, setting it with the provided content if it doe
|
|
|
42
42
|
| `key` | `string` | ✓ | The cache key to check/set |
|
|
43
43
|
| `content` | `string` | ✓ | The content to set if the key doesn't exist |
|
|
44
44
|
|
|
45
|
-
**Returns:** `
|
|
45
|
+
**Returns:** `Promise<string>`
|
|
46
46
|
|
|
47
47
|
```ts
|
|
48
48
|
await diskCache.ensure('config', JSON.stringify(defaultConfig))
|
|
@@ -62,7 +62,7 @@ Copy a cached item from one key to another
|
|
|
62
62
|
| `destination` | `string` | ✓ | The destination cache key |
|
|
63
63
|
| `overwrite` | `boolean` | | Whether to overwrite if destination exists (default: false) |
|
|
64
64
|
|
|
65
|
-
**Returns:** `
|
|
65
|
+
**Returns:** `Promise<string>`
|
|
66
66
|
|
|
67
67
|
```ts
|
|
68
68
|
await diskCache.copy('original', 'backup')
|
|
@@ -83,7 +83,7 @@ Move a cached item from one key to another (copy then delete source)
|
|
|
83
83
|
| `destination` | `string` | ✓ | The destination cache key |
|
|
84
84
|
| `overwrite` | `boolean` | | Whether to overwrite if destination exists (default: false) |
|
|
85
85
|
|
|
86
|
-
**Returns:** `
|
|
86
|
+
**Returns:** `Promise<string>`
|
|
87
87
|
|
|
88
88
|
```ts
|
|
89
89
|
await diskCache.move('temp', 'permanent')
|
|
@@ -102,7 +102,7 @@ Check if a key exists in the cache
|
|
|
102
102
|
|------|------|----------|-------------|
|
|
103
103
|
| `key` | `string` | ✓ | The cache key to check |
|
|
104
104
|
|
|
105
|
-
**Returns:** `
|
|
105
|
+
**Returns:** `Promise<boolean>`
|
|
106
106
|
|
|
107
107
|
```ts
|
|
108
108
|
if (await diskCache.has('myKey')) {
|
|
@@ -123,7 +123,7 @@ Retrieve a value from the cache
|
|
|
123
123
|
| `key` | `string` | ✓ | The cache key to retrieve |
|
|
124
124
|
| `json` | `any` | | Whether to parse the value as JSON (default: false) |
|
|
125
125
|
|
|
126
|
-
**Returns:** `
|
|
126
|
+
**Returns:** `Promise<any>`
|
|
127
127
|
|
|
128
128
|
```ts
|
|
129
129
|
const text = await diskCache.get('myText')
|
|
@@ -144,7 +144,7 @@ Store a value in the cache
|
|
|
144
144
|
| `value` | `any` | ✓ | The value to store (string, object, or any serializable data) |
|
|
145
145
|
| `meta` | `any` | | Optional metadata to associate with the cached item |
|
|
146
146
|
|
|
147
|
-
**Returns:** `
|
|
147
|
+
**Returns:** `Promise<any>`
|
|
148
148
|
|
|
149
149
|
```ts
|
|
150
150
|
await diskCache.set('myKey', 'Hello World')
|
|
@@ -164,7 +164,7 @@ Remove a cached item
|
|
|
164
164
|
|------|------|----------|-------------|
|
|
165
165
|
| `key` | `string` | ✓ | The cache key to remove |
|
|
166
166
|
|
|
167
|
-
**Returns:** `
|
|
167
|
+
**Returns:** `Promise<any>`
|
|
168
168
|
|
|
169
169
|
```ts
|
|
170
170
|
await diskCache.rm('obsoleteKey')
|
|
@@ -182,7 +182,7 @@ Clear all cached items
|
|
|
182
182
|
|------|------|----------|-------------|
|
|
183
183
|
| `confirm` | `any` | | Must be set to true to confirm the operation |
|
|
184
184
|
|
|
185
|
-
**Returns:** `
|
|
185
|
+
**Returns:** `Promise<this>`
|
|
186
186
|
|
|
187
187
|
```ts
|
|
188
188
|
await diskCache.clearAll(true) // Must explicitly confirm
|
|
@@ -237,8 +237,8 @@ const customCache = diskCache.create('/custom/cache/path')
|
|
|
237
237
|
|
|
238
238
|
| Property | Type | Description |
|
|
239
239
|
|----------|------|-------------|
|
|
240
|
-
| `cache` | `
|
|
241
|
-
| `securely` | `any` | Get encrypted cache operations interface Requires encryption to be enabled and a secret to be provided |
|
|
240
|
+
| `cache` | `ReturnType<typeof this.create>` | Returns the underlying cacache instance configured with the cache directory path. |
|
|
241
|
+
| `securely` | `{ set(name: string, payload: any, meta?: any): Promise<any>; get(name: string): Promise<any> }` | Get encrypted cache operations interface Requires encryption to be enabled and a secret to be provided |
|
|
242
242
|
|
|
243
243
|
## State (Zod v4 schema)
|
|
244
244
|
|
|
@@ -21,7 +21,7 @@ Downloads a file from a URL and saves it to the specified local path. This metho
|
|
|
21
21
|
| `url` | `string` | ✓ | The URL to download the file from. Must be a valid HTTP/HTTPS URL. |
|
|
22
22
|
| `targetPath` | `string` | ✓ | The local file path where the downloaded file should be saved. |
|
|
23
23
|
|
|
24
|
-
**Returns:** `
|
|
24
|
+
**Returns:** `Promise<string>`
|
|
25
25
|
|
|
26
26
|
```ts
|
|
27
27
|
// Download an image file
|
|
@@ -29,7 +29,7 @@ Matches the file IDs against the pattern(s) provided
|
|
|
29
29
|
|------|------|----------|-------------|
|
|
30
30
|
| `patterns` | `string | string[]` | ✓ | The patterns to match against the file IDs |
|
|
31
31
|
|
|
32
|
-
**Returns:** `
|
|
32
|
+
**Returns:** `string[]`
|
|
33
33
|
|
|
34
34
|
|
|
35
35
|
|
|
@@ -43,7 +43,7 @@ Matches the file IDs against the pattern(s) provided and returns the file object
|
|
|
43
43
|
|------|------|----------|-------------|
|
|
44
44
|
| `patterns` | `string | string[]` | ✓ | The patterns to match against the file IDs |
|
|
45
45
|
|
|
46
|
-
**Returns:** `
|
|
46
|
+
**Returns:** `(File | undefined)[]`
|
|
47
47
|
|
|
48
48
|
|
|
49
49
|
|
|
@@ -63,7 +63,7 @@ Starts the file manager and scans the files in the project.
|
|
|
63
63
|
|----------|------|-------------|
|
|
64
64
|
| `exclude` | `any` | The patterns to exclude from the scan |
|
|
65
65
|
|
|
66
|
-
**Returns:** `
|
|
66
|
+
**Returns:** `Promise<this>`
|
|
67
67
|
|
|
68
68
|
|
|
69
69
|
|
|
@@ -83,7 +83,7 @@ Scans the files in the project and updates the file manager state.
|
|
|
83
83
|
|----------|------|-------------|
|
|
84
84
|
| `exclude` | `any` | The patterns to exclude from the scan |
|
|
85
85
|
|
|
86
|
-
**Returns:** `
|
|
86
|
+
**Returns:** `Promise<this>`
|
|
87
87
|
|
|
88
88
|
|
|
89
89
|
|
|
@@ -104,13 +104,13 @@ Watches directories for file changes. Can be called multiple times to add more d
|
|
|
104
104
|
| `paths` | `any` | Specific directories or globs to watch. Defaults to project directoryIds. |
|
|
105
105
|
| `exclude` | `any` | The patterns to exclude from the watch |
|
|
106
106
|
|
|
107
|
-
**Returns:** `void
|
|
107
|
+
**Returns:** `Promise<void>`
|
|
108
108
|
|
|
109
109
|
|
|
110
110
|
|
|
111
111
|
### stopWatching
|
|
112
112
|
|
|
113
|
-
**Returns:** `void
|
|
113
|
+
**Returns:** `Promise<void>`
|
|
114
114
|
|
|
115
115
|
|
|
116
116
|
|
|
@@ -122,7 +122,7 @@ Watches directories for file changes. Can be called multiple times to add more d
|
|
|
122
122
|
|------|------|----------|-------------|
|
|
123
123
|
| `path` | `string` | ✓ | Parameter path |
|
|
124
124
|
|
|
125
|
-
**Returns:** `void
|
|
125
|
+
**Returns:** `Promise<void>`
|
|
126
126
|
|
|
127
127
|
|
|
128
128
|
|
|
@@ -134,7 +134,7 @@ Watches directories for file changes. Can be called multiple times to add more d
|
|
|
134
134
|
|------|------|----------|-------------|
|
|
135
135
|
| `path` | `string` | ✓ | Parameter path |
|
|
136
136
|
|
|
137
|
-
**Returns:** `void
|
|
137
|
+
**Returns:** `Promise<void>`
|
|
138
138
|
|
|
139
139
|
|
|
140
140
|
|
|
@@ -142,13 +142,13 @@ Watches directories for file changes. Can be called multiple times to add more d
|
|
|
142
142
|
|
|
143
143
|
| Property | Type | Description |
|
|
144
144
|
|----------|------|-------------|
|
|
145
|
-
| `fileIds` | `
|
|
146
|
-
| `fileObjects` | `
|
|
147
|
-
| `directoryIds` | `
|
|
148
|
-
| `uniqueExtensions` | `
|
|
149
|
-
| `isStarted` | `
|
|
150
|
-
| `isStarting` | `
|
|
151
|
-
| `isWatching` | `
|
|
145
|
+
| `fileIds` | `string[]` | Returns an array of all relative file paths indexed by the file manager. |
|
|
146
|
+
| `fileObjects` | `File[]` | Returns an array of all file metadata objects indexed by the file manager. |
|
|
147
|
+
| `directoryIds` | `string[]` | Returns the directory IDs for all of the files in the project. |
|
|
148
|
+
| `uniqueExtensions` | `string[]` | Returns an array of unique file extensions found across all indexed files. |
|
|
149
|
+
| `isStarted` | `boolean` | Whether the file manager has completed its initial scan. |
|
|
150
|
+
| `isStarting` | `boolean` | Whether the file manager is currently performing its initial scan. |
|
|
151
|
+
| `isWatching` | `boolean` | Whether the file watcher is actively monitoring for changes. |
|
|
152
152
|
| `watchedPaths` | `string[]` | Returns the list of directories currently being watched. |
|
|
153
153
|
| `watchedFiles` | `Record<string, string[]>` | Returns the directories and files currently being watched by chokidar. |
|
|
154
154
|
|