@soederpop/luca 0.0.23 → 0.0.26

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.
Files changed (67) hide show
  1. package/AGENTS.md +1 -1
  2. package/CLAUDE.md +6 -1
  3. package/assistants/codingAssistant/hooks.ts +0 -1
  4. package/assistants/lucaExpert/CORE.md +37 -0
  5. package/assistants/lucaExpert/hooks.ts +9 -0
  6. package/assistants/lucaExpert/tools.ts +177 -0
  7. package/commands/build-bootstrap.ts +41 -1
  8. package/docs/TABLE-OF-CONTENTS.md +0 -1
  9. package/docs/apis/clients/rest.md +5 -5
  10. package/docs/apis/features/agi/assistant.md +1 -1
  11. package/docs/apis/features/agi/conversation-history.md +6 -7
  12. package/docs/apis/features/agi/conversation.md +1 -1
  13. package/docs/apis/features/agi/semantic-search.md +1 -1
  14. package/docs/bootstrap/CLAUDE.md +1 -1
  15. package/docs/bootstrap/SKILL.md +7 -3
  16. package/docs/bootstrap/templates/luca-cli.ts +5 -0
  17. package/docs/mcp/readme.md +1 -1
  18. package/docs/tutorials/00-bootstrap.md +18 -0
  19. package/package.json +2 -2
  20. package/scripts/stamp-build.sh +12 -0
  21. package/scripts/test-docs-reader.ts +10 -0
  22. package/src/agi/container.server.ts +8 -5
  23. package/src/agi/features/assistant.ts +210 -55
  24. package/src/agi/features/assistants-manager.ts +138 -66
  25. package/src/agi/features/conversation.ts +46 -14
  26. package/src/agi/features/docs-reader.ts +166 -0
  27. package/src/agi/features/openapi.ts +1 -1
  28. package/src/agi/features/skills-library.ts +257 -313
  29. package/src/bootstrap/generated.ts +8163 -6
  30. package/src/cli/build-info.ts +4 -0
  31. package/src/cli/cli.ts +2 -1
  32. package/src/command.ts +75 -0
  33. package/src/commands/bootstrap.ts +16 -1
  34. package/src/commands/describe.ts +29 -1089
  35. package/src/commands/eval.ts +6 -1
  36. package/src/commands/sandbox-mcp.ts +17 -7
  37. package/src/container-describer.ts +1098 -0
  38. package/src/container.ts +11 -0
  39. package/src/helper.ts +56 -2
  40. package/src/introspection/generated.agi.ts +1684 -799
  41. package/src/introspection/generated.node.ts +964 -572
  42. package/src/introspection/generated.web.ts +9 -1
  43. package/src/node/container.ts +1 -1
  44. package/src/node/features/content-db.ts +268 -13
  45. package/src/node/features/fs.ts +18 -0
  46. package/src/node/features/git.ts +90 -0
  47. package/src/node/features/grep.ts +1 -1
  48. package/src/node/features/proc.ts +1 -0
  49. package/src/node/features/tts.ts +1 -1
  50. package/src/node/features/vm.ts +48 -0
  51. package/src/scaffolds/generated.ts +2 -2
  52. package/src/server.ts +40 -0
  53. package/src/servers/express.ts +2 -0
  54. package/src/servers/mcp.ts +1 -0
  55. package/src/servers/socket.ts +2 -0
  56. package/assistants/architect/CORE.md +0 -3
  57. package/assistants/architect/hooks.ts +0 -3
  58. package/assistants/architect/tools.ts +0 -10
  59. package/docs/apis/features/agi/skills-library.md +0 -234
  60. package/docs/reports/assistant-bugs.md +0 -38
  61. package/docs/reports/attach-pattern-usage.md +0 -18
  62. package/docs/reports/code-audit-results.md +0 -391
  63. package/docs/reports/console-hmr-design.md +0 -170
  64. package/docs/reports/helper-semantic-search.md +0 -72
  65. package/docs/reports/introspection-audit-tasks.md +0 -378
  66. package/docs/reports/luca-mcp-improvements.md +0 -128
  67. package/test-integration/skills-library.test.ts +0 -157
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
@@ -35,10 +35,12 @@ export abstract class Helper<T extends HelperState = HelperState, K extends Help
35
35
  static stateSchema: z.ZodType = HelperStateSchema
36
36
  static optionsSchema: z.ZodType = HelperOptionsSchema
37
37
  static eventsSchema: z.ZodType = HelperEventsSchema
38
+ static tools: Record<string, { schema: z.ZodType, handler?: Function }> = {}
38
39
 
39
40
  protected readonly _context: ContainerContext
40
41
  protected readonly _events = new Bus<E>()
41
42
  protected readonly _options: K
43
+ protected readonly _instanceTools: Record<string, { schema: z.ZodType, handler?: Function }> = {}
42
44
 
43
45
  readonly state: State<T>
44
46
 
@@ -125,7 +127,7 @@ export abstract class Helper<T extends HelperState = HelperState, K extends Help
125
127
  this._context = context;
126
128
  this.state = new State<T>({ initialState: this.initialState });
127
129
 
128
- this.hide('_context', '_state', '_options', '_events', 'uuid')
130
+ this.hide('_context', '_state', '_options', '_events', '_instanceTools', 'uuid')
129
131
 
130
132
  this.state.observe(() => {
131
133
  (this as any).emit('stateChange', this.state.current)
@@ -170,7 +172,7 @@ export abstract class Helper<T extends HelperState = HelperState, K extends Help
170
172
  return this
171
173
  }
172
174
 
173
- /**
175
+ /**
174
176
  * python / lodash style get method, which will get a value from the container using dot notation
175
177
  * and will return a default value if the value is not found.
176
178
  */
@@ -178,6 +180,58 @@ export abstract class Helper<T extends HelperState = HelperState, K extends Help
178
180
  return get(this, key, defaultValue)
179
181
  }
180
182
 
183
+ /**
184
+ * Register a tool on this instance at runtime. Instance tools take precedence
185
+ * over class-level static tools in toTools().
186
+ */
187
+ tool(name: string, options: { schema: z.ZodType, handler?: Function }): this {
188
+ this._instanceTools[name] = options
189
+ return this
190
+ }
191
+
192
+ /**
193
+ * Collect all tools from the inheritance chain and instance, returning
194
+ * { schemas, handlers } with matching keys. Walks the prototype chain
195
+ * so subclass tools override parent tools. Instance tools win over all.
196
+ *
197
+ * If a tool has no explicit handler but this instance has a method with
198
+ * the same name, a handler is auto-generated that delegates to that method.
199
+ */
200
+ toTools(): { schemas: Record<string, z.ZodType>, handlers: Record<string, Function> } {
201
+ // Walk the prototype chain collecting static tools (parent-first, child overwrites)
202
+ const merged: Record<string, { schema: z.ZodType, handler?: Function }> = {}
203
+ const chain: Function[] = []
204
+
205
+ let current = this.constructor as any
206
+ while (current && current !== Object) {
207
+ if (Object.hasOwn(current, 'tools') && current.tools) {
208
+ chain.unshift(current)
209
+ }
210
+ current = Object.getPrototypeOf(current)
211
+ }
212
+
213
+ for (const ctor of chain) {
214
+ Object.assign(merged, (ctor as any).tools)
215
+ }
216
+
217
+ // Instance tools win over static
218
+ Object.assign(merged, this._instanceTools)
219
+
220
+ const schemas: Record<string, z.ZodType> = {}
221
+ const handlers: Record<string, Function> = {}
222
+
223
+ for (const [name, entry] of Object.entries(merged)) {
224
+ schemas[name] = entry.schema
225
+ if (entry.handler) {
226
+ handlers[name] = (args: any) => entry.handler!(args, this)
227
+ } else if (typeof (this as any)[name] === 'function') {
228
+ handlers[name] = (args: any) => (this as any)[name](args)
229
+ }
230
+ }
231
+
232
+ return { schemas, handlers }
233
+ }
234
+
181
235
  /**
182
236
  * The options passed to the helper when it was created.
183
237
  */