@soederpop/luca 0.0.25 → 0.0.28
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/docs/examples/assistant-with-process-manager.md +84 -0
- package/docs/examples/websocket-ask-and-reply-example.md +128 -0
- package/docs/window-manager-fix.md +249 -0
- package/package.json +1 -1
- package/src/agi/features/assistant.ts +75 -13
- package/src/agi/features/docs-reader.ts +25 -1
- package/src/bootstrap/generated.ts +215 -1
- package/src/cli/build-info.ts +2 -2
- package/src/clients/websocket.ts +76 -1
- package/src/command.ts +75 -0
- package/src/commands/describe.ts +29 -1089
- package/src/container-describer.ts +1098 -0
- package/src/container.ts +11 -0
- package/src/helper.ts +29 -2
- package/src/introspection/generated.agi.ts +1315 -611
- package/src/introspection/generated.node.ts +1168 -552
- package/src/introspection/generated.web.ts +9 -1
- package/src/node/features/content-db.ts +17 -0
- package/src/node/features/fs.ts +18 -0
- package/src/node/features/ipc-socket.ts +370 -180
- package/src/node/features/process-manager.ts +316 -49
- package/src/node/features/window-manager.ts +843 -235
- package/src/scaffolds/generated.ts +1 -1
- package/src/server.ts +40 -0
- package/src/servers/express.ts +2 -0
- package/src/servers/mcp.ts +1 -0
- package/src/servers/socket.ts +89 -0
- package/src/web/clients/socket.ts +22 -6
- package/test/websocket-ask.test.ts +101 -0
package/src/container.ts
CHANGED
|
@@ -10,6 +10,7 @@ import { pluralize, singularize } from 'inflect'
|
|
|
10
10
|
import { z } from 'zod'
|
|
11
11
|
import { ContainerStateSchema, describeZodShape } from './schemas/base'
|
|
12
12
|
import { getContainerBuildTimeData, type ContainerIntrospection, type RegistryIntrospection, type IntrospectionSection } from './introspection/index'
|
|
13
|
+
import { ContainerDescriber } from './container-describer'
|
|
13
14
|
|
|
14
15
|
export { z }
|
|
15
16
|
|
|
@@ -148,6 +149,16 @@ export class Container<Features extends AvailableFeatures = AvailableFeatures, C
|
|
|
148
149
|
}
|
|
149
150
|
}
|
|
150
151
|
|
|
152
|
+
private _describer?: ContainerDescriber
|
|
153
|
+
|
|
154
|
+
/** Lazy-initialized ContainerDescriber for introspecting registries, helpers, and members. */
|
|
155
|
+
get describer(): ContainerDescriber {
|
|
156
|
+
if (!this._describer) {
|
|
157
|
+
this._describer = new ContainerDescriber(this)
|
|
158
|
+
}
|
|
159
|
+
return this._describer
|
|
160
|
+
}
|
|
161
|
+
|
|
151
162
|
/**
|
|
152
163
|
* Add a value to the container's shared context, which is passed to all helper instances.
|
|
153
164
|
* Accepts either a key and value, or an object of key-value pairs to add.
|
package/src/helper.ts
CHANGED
|
@@ -138,9 +138,16 @@ export abstract class Helper<T extends HelperState = HelperState, K extends Help
|
|
|
138
138
|
this.container.emit('helperInitialized', this)
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
/**
|
|
141
|
+
/**
|
|
142
|
+
* The static shortcut identifier for this helper type, e.g. "features.assistant".
|
|
143
|
+
*/
|
|
144
|
+
get shortcut(): string {
|
|
145
|
+
return (this.constructor as any).shortcut || ''
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
142
149
|
* Every helper has a cache key which is computed at the time it is created through the container.
|
|
143
|
-
*
|
|
150
|
+
*
|
|
144
151
|
* This ensures only a single instance of the helper exists for the requested options.
|
|
145
152
|
*/
|
|
146
153
|
get cacheKey() {
|
|
@@ -189,6 +196,26 @@ export abstract class Helper<T extends HelperState = HelperState, K extends Help
|
|
|
189
196
|
return this
|
|
190
197
|
}
|
|
191
198
|
|
|
199
|
+
/**
|
|
200
|
+
* Called when another helper (e.g. an assistant) consumes this helper's
|
|
201
|
+
* tools via `use()`. Override this to detect the consumer type and react —
|
|
202
|
+
* for example, adding system prompt extensions to an assistant.
|
|
203
|
+
*
|
|
204
|
+
* Use `consumer.shortcut` to identify the consumer type:
|
|
205
|
+
* ```typescript
|
|
206
|
+
* override setupToolsConsumer(consumer: Helper) {
|
|
207
|
+
* if (consumer.shortcut === 'features.assistant') {
|
|
208
|
+
* (consumer as any).addSystemPromptExtension('myFeature', 'usage hints here')
|
|
209
|
+
* }
|
|
210
|
+
* }
|
|
211
|
+
* ```
|
|
212
|
+
*
|
|
213
|
+
* The default implementation is a no-op.
|
|
214
|
+
*
|
|
215
|
+
* @param consumer - The helper instance that is consuming this helper's tools
|
|
216
|
+
*/
|
|
217
|
+
setupToolsConsumer(consumer: Helper): void {}
|
|
218
|
+
|
|
192
219
|
/**
|
|
193
220
|
* Collect all tools from the inheritance chain and instance, returning
|
|
194
221
|
* { schemas, handlers } with matching keys. Walks the prototype chain
|