@soederpop/luca 0.0.32 → 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 +18 -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 +3026 -590
- 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
|
@@ -0,0 +1,377 @@
|
|
|
1
|
+
# AutonomousAssistant (features.autoAssistant)
|
|
2
|
+
|
|
3
|
+
An autonomous assistant that owns a lower-level Assistant instance and gates all tool calls through a permission system. Tools are stacked from feature bundles (fileTools, processManager, etc.) and each tool can be set to 'allow' (runs immediately), 'ask' (blocks until user approves/denies), or 'deny' (always rejected).
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
container.feature('autoAssistant', {
|
|
9
|
+
// Tool bundles to register on the inner assistant
|
|
10
|
+
tools,
|
|
11
|
+
// Permission level per tool name
|
|
12
|
+
permissions,
|
|
13
|
+
// Default permission level for unconfigured tools
|
|
14
|
+
defaultPermission,
|
|
15
|
+
// System prompt for the inner assistant
|
|
16
|
+
systemPrompt,
|
|
17
|
+
// OpenAI model override
|
|
18
|
+
model,
|
|
19
|
+
// Conversation history persistence mode
|
|
20
|
+
historyMode,
|
|
21
|
+
// Assistant folder for disk-based definitions
|
|
22
|
+
folder,
|
|
23
|
+
})
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Options (Zod v4 schema)
|
|
27
|
+
|
|
28
|
+
| Property | Type | Description |
|
|
29
|
+
|----------|------|-------------|
|
|
30
|
+
| `tools` | `array` | Tool bundles to register on the inner assistant |
|
|
31
|
+
| `permissions` | `object` | Permission level per tool name |
|
|
32
|
+
| `defaultPermission` | `string` | Default permission level for unconfigured tools |
|
|
33
|
+
| `systemPrompt` | `string` | System prompt for the inner assistant |
|
|
34
|
+
| `model` | `string` | OpenAI model override |
|
|
35
|
+
| `historyMode` | `string` | Conversation history persistence mode |
|
|
36
|
+
| `folder` | `string` | Assistant folder for disk-based definitions |
|
|
37
|
+
|
|
38
|
+
## Methods
|
|
39
|
+
|
|
40
|
+
### getPermission
|
|
41
|
+
|
|
42
|
+
Get the effective permission level for a tool.
|
|
43
|
+
|
|
44
|
+
**Parameters:**
|
|
45
|
+
|
|
46
|
+
| Name | Type | Required | Description |
|
|
47
|
+
|------|------|----------|-------------|
|
|
48
|
+
| `toolName` | `string` | ✓ | Parameter toolName |
|
|
49
|
+
|
|
50
|
+
**Returns:** `PermissionLevel`
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### setPermission
|
|
55
|
+
|
|
56
|
+
Set permission level for one or more tools.
|
|
57
|
+
|
|
58
|
+
**Parameters:**
|
|
59
|
+
|
|
60
|
+
| Name | Type | Required | Description |
|
|
61
|
+
|------|------|----------|-------------|
|
|
62
|
+
| `toolName` | `string | string[]` | ✓ | Parameter toolName |
|
|
63
|
+
| `level` | `PermissionLevel` | ✓ | Parameter level |
|
|
64
|
+
|
|
65
|
+
**Returns:** `this`
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
### setDefaultPermission
|
|
70
|
+
|
|
71
|
+
Set the default permission level for unconfigured tools.
|
|
72
|
+
|
|
73
|
+
**Parameters:**
|
|
74
|
+
|
|
75
|
+
| Name | Type | Required | Description |
|
|
76
|
+
|------|------|----------|-------------|
|
|
77
|
+
| `level` | `PermissionLevel` | ✓ | Parameter level |
|
|
78
|
+
|
|
79
|
+
**Returns:** `this`
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
### permitTool
|
|
84
|
+
|
|
85
|
+
Allow a tool (or tools) to run without approval.
|
|
86
|
+
|
|
87
|
+
**Parameters:**
|
|
88
|
+
|
|
89
|
+
| Name | Type | Required | Description |
|
|
90
|
+
|------|------|----------|-------------|
|
|
91
|
+
| `toolNames` | `string[]` | ✓ | Parameter toolNames |
|
|
92
|
+
|
|
93
|
+
**Returns:** `this`
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
### gateTool
|
|
98
|
+
|
|
99
|
+
Require approval before a tool (or tools) can run.
|
|
100
|
+
|
|
101
|
+
**Parameters:**
|
|
102
|
+
|
|
103
|
+
| Name | Type | Required | Description |
|
|
104
|
+
|------|------|----------|-------------|
|
|
105
|
+
| `toolNames` | `string[]` | ✓ | Parameter toolNames |
|
|
106
|
+
|
|
107
|
+
**Returns:** `this`
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
### blockTool
|
|
112
|
+
|
|
113
|
+
Block a tool (or tools) from ever running.
|
|
114
|
+
|
|
115
|
+
**Parameters:**
|
|
116
|
+
|
|
117
|
+
| Name | Type | Required | Description |
|
|
118
|
+
|------|------|----------|-------------|
|
|
119
|
+
| `toolNames` | `string[]` | ✓ | Parameter toolNames |
|
|
120
|
+
|
|
121
|
+
**Returns:** `this`
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
### approve
|
|
126
|
+
|
|
127
|
+
Approve a pending tool call by ID. The tool will execute.
|
|
128
|
+
|
|
129
|
+
**Parameters:**
|
|
130
|
+
|
|
131
|
+
| Name | Type | Required | Description |
|
|
132
|
+
|------|------|----------|-------------|
|
|
133
|
+
| `id` | `string` | ✓ | Parameter id |
|
|
134
|
+
|
|
135
|
+
**Returns:** `this`
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
### deny
|
|
140
|
+
|
|
141
|
+
Deny a pending tool call by ID. The tool call will be skipped.
|
|
142
|
+
|
|
143
|
+
**Parameters:**
|
|
144
|
+
|
|
145
|
+
| Name | Type | Required | Description |
|
|
146
|
+
|------|------|----------|-------------|
|
|
147
|
+
| `id` | `string` | ✓ | Parameter id |
|
|
148
|
+
|
|
149
|
+
**Returns:** `this`
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
### approveAll
|
|
154
|
+
|
|
155
|
+
Approve all pending tool calls.
|
|
156
|
+
|
|
157
|
+
**Returns:** `this`
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
### denyAll
|
|
162
|
+
|
|
163
|
+
Deny all pending tool calls.
|
|
164
|
+
|
|
165
|
+
**Returns:** `this`
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
### start
|
|
170
|
+
|
|
171
|
+
Initialize the inner assistant, stack tool bundles, and wire up the permission interceptor.
|
|
172
|
+
|
|
173
|
+
**Returns:** `Promise<this>`
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
### ask
|
|
178
|
+
|
|
179
|
+
Ask the autonomous assistant a question. Auto-starts if needed. Tool calls will be gated by the permission system.
|
|
180
|
+
|
|
181
|
+
**Parameters:**
|
|
182
|
+
|
|
183
|
+
| Name | Type | Required | Description |
|
|
184
|
+
|------|------|----------|-------------|
|
|
185
|
+
| `question` | `string` | ✓ | Parameter question |
|
|
186
|
+
| `options` | `Record<string, any>` | | Parameter options |
|
|
187
|
+
|
|
188
|
+
**Returns:** `Promise<string>`
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
### use
|
|
193
|
+
|
|
194
|
+
Add a tool bundle after initialization. Useful for dynamically extending the assistant's capabilities.
|
|
195
|
+
|
|
196
|
+
**Parameters:**
|
|
197
|
+
|
|
198
|
+
| Name | Type | Required | Description |
|
|
199
|
+
|------|------|----------|-------------|
|
|
200
|
+
| `spec` | `ToolBundleSpec` | ✓ | Parameter spec |
|
|
201
|
+
|
|
202
|
+
**Returns:** `this`
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
## Getters
|
|
207
|
+
|
|
208
|
+
| Property | Type | Description |
|
|
209
|
+
|----------|------|-------------|
|
|
210
|
+
| `assistant` | `Assistant` | The inner assistant. Throws if not started. |
|
|
211
|
+
| `permissions` | `Record<string, PermissionLevel>` | Current permission map from state. |
|
|
212
|
+
| `pendingApprovals` | `PendingApproval[]` | Current pending approvals. |
|
|
213
|
+
| `isStarted` | `boolean` | Whether the assistant is started and ready. |
|
|
214
|
+
| `tools` | `Record<string, any>` | The tools registered on the inner assistant. |
|
|
215
|
+
| `conversation` | `any` | The conversation on the inner assistant (if started). |
|
|
216
|
+
| `messages` | `any` | Messages from the inner assistant's conversation. |
|
|
217
|
+
|
|
218
|
+
## Events (Zod v4 schema)
|
|
219
|
+
|
|
220
|
+
### permissionGranted
|
|
221
|
+
|
|
222
|
+
Emitted when a pending tool call is approved
|
|
223
|
+
|
|
224
|
+
**Event Arguments:**
|
|
225
|
+
|
|
226
|
+
| Name | Type | Description |
|
|
227
|
+
|------|------|-------------|
|
|
228
|
+
| `arg0` | `string` | Approval ID |
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
### permissionDenied
|
|
233
|
+
|
|
234
|
+
Emitted when a pending tool call is denied
|
|
235
|
+
|
|
236
|
+
**Event Arguments:**
|
|
237
|
+
|
|
238
|
+
| Name | Type | Description |
|
|
239
|
+
|------|------|-------------|
|
|
240
|
+
| `arg0` | `string` | Approval ID |
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
244
|
+
### toolBlocked
|
|
245
|
+
|
|
246
|
+
Emitted when a tool call is blocked by deny policy
|
|
247
|
+
|
|
248
|
+
**Event Arguments:**
|
|
249
|
+
|
|
250
|
+
| Name | Type | Description |
|
|
251
|
+
|------|------|-------------|
|
|
252
|
+
| `arg0` | `string` | Tool name |
|
|
253
|
+
| `arg1` | `string` | Reason |
|
|
254
|
+
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
### chunk
|
|
258
|
+
|
|
259
|
+
Forwarded: streamed token chunk from the inner assistant
|
|
260
|
+
|
|
261
|
+
**Event Arguments:**
|
|
262
|
+
|
|
263
|
+
| Name | Type | Description |
|
|
264
|
+
|------|------|-------------|
|
|
265
|
+
| `arg0` | `string` | A chunk of streamed text |
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
### response
|
|
270
|
+
|
|
271
|
+
Forwarded: complete response from the inner assistant
|
|
272
|
+
|
|
273
|
+
**Event Arguments:**
|
|
274
|
+
|
|
275
|
+
| Name | Type | Description |
|
|
276
|
+
|------|------|-------------|
|
|
277
|
+
| `arg0` | `string` | The final response text |
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
### toolCall
|
|
282
|
+
|
|
283
|
+
Forwarded: a tool was called
|
|
284
|
+
|
|
285
|
+
**Event Arguments:**
|
|
286
|
+
|
|
287
|
+
| Name | Type | Description |
|
|
288
|
+
|------|------|-------------|
|
|
289
|
+
| `arg0` | `string` | Tool name |
|
|
290
|
+
| `arg1` | `any` | Tool arguments |
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
### toolResult
|
|
295
|
+
|
|
296
|
+
Forwarded: a tool returned a result
|
|
297
|
+
|
|
298
|
+
**Event Arguments:**
|
|
299
|
+
|
|
300
|
+
| Name | Type | Description |
|
|
301
|
+
|------|------|-------------|
|
|
302
|
+
| `arg0` | `string` | Tool name |
|
|
303
|
+
| `arg1` | `any` | Result value |
|
|
304
|
+
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
### toolError
|
|
308
|
+
|
|
309
|
+
Forwarded: a tool call failed
|
|
310
|
+
|
|
311
|
+
**Event Arguments:**
|
|
312
|
+
|
|
313
|
+
| Name | Type | Description |
|
|
314
|
+
|------|------|-------------|
|
|
315
|
+
| `arg0` | `string` | Tool name |
|
|
316
|
+
| `arg1` | `any` | Error |
|
|
317
|
+
|
|
318
|
+
|
|
319
|
+
|
|
320
|
+
### started
|
|
321
|
+
|
|
322
|
+
Emitted when the autonomous assistant has been initialized
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
### permissionRequest
|
|
327
|
+
|
|
328
|
+
Emitted when a tool call requires user approval
|
|
329
|
+
|
|
330
|
+
**Event Arguments:**
|
|
331
|
+
|
|
332
|
+
| Name | Type | Description |
|
|
333
|
+
|------|------|-------------|
|
|
334
|
+
| `id` | `string` | Unique approval ID |
|
|
335
|
+
| `toolName` | `string` | The tool requesting permission |
|
|
336
|
+
| `args` | `object` | The arguments the tool was called with |
|
|
337
|
+
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
## State (Zod v4 schema)
|
|
341
|
+
|
|
342
|
+
| Property | Type | Description |
|
|
343
|
+
|----------|------|-------------|
|
|
344
|
+
| `enabled` | `boolean` | Whether this feature is currently enabled |
|
|
345
|
+
| `started` | `boolean` | Whether the assistant has been initialized |
|
|
346
|
+
| `permissions` | `object` | Permission level per tool name |
|
|
347
|
+
| `defaultPermission` | `string` | Permission level for tools not explicitly configured |
|
|
348
|
+
| `pendingApprovals` | `array` | Tool calls currently awaiting user approval |
|
|
349
|
+
| `approvalHistory` | `array` | Recent approval decisions |
|
|
350
|
+
|
|
351
|
+
## Examples
|
|
352
|
+
|
|
353
|
+
**features.autoAssistant**
|
|
354
|
+
|
|
355
|
+
```ts
|
|
356
|
+
const auto = container.feature('autoAssistant', {
|
|
357
|
+
tools: ['fileTools', { feature: 'processManager', except: ['killAllProcesses'] }],
|
|
358
|
+
permissions: {
|
|
359
|
+
readFile: 'allow',
|
|
360
|
+
searchFiles: 'allow',
|
|
361
|
+
writeFile: 'ask',
|
|
362
|
+
editFile: 'ask',
|
|
363
|
+
deleteFile: 'deny',
|
|
364
|
+
},
|
|
365
|
+
defaultPermission: 'ask',
|
|
366
|
+
systemPrompt: 'You are a coding assistant.',
|
|
367
|
+
})
|
|
368
|
+
|
|
369
|
+
auto.on('permissionRequest', ({ id, toolName, args }) => {
|
|
370
|
+
console.log(`Tool "${toolName}" wants to run with`, args)
|
|
371
|
+
// Show UI, then:
|
|
372
|
+
auto.approve(id) // or auto.deny(id)
|
|
373
|
+
})
|
|
374
|
+
|
|
375
|
+
await auto.ask('Refactor the auth module to use async/await')
|
|
376
|
+
```
|
|
377
|
+
|