@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.
Files changed (86) hide show
  1. package/README.md +241 -36
  2. package/bun.lock +24 -5
  3. package/commands/build-python-bridge.ts +43 -0
  4. package/docs/apis/clients/rest.md +7 -7
  5. package/docs/apis/clients/websocket.md +23 -10
  6. package/docs/apis/features/agi/assistant.md +155 -8
  7. package/docs/apis/features/agi/assistants-manager.md +90 -22
  8. package/docs/apis/features/agi/auto-assistant.md +377 -0
  9. package/docs/apis/features/agi/browser-use.md +802 -0
  10. package/docs/apis/features/agi/claude-code.md +6 -1
  11. package/docs/apis/features/agi/conversation-history.md +7 -6
  12. package/docs/apis/features/agi/conversation.md +111 -38
  13. package/docs/apis/features/agi/docs-reader.md +35 -57
  14. package/docs/apis/features/agi/file-tools.md +163 -0
  15. package/docs/apis/features/agi/openapi.md +2 -2
  16. package/docs/apis/features/agi/skills-library.md +227 -0
  17. package/docs/apis/features/node/content-db.md +125 -4
  18. package/docs/apis/features/node/disk-cache.md +11 -11
  19. package/docs/apis/features/node/downloader.md +1 -1
  20. package/docs/apis/features/node/file-manager.md +15 -15
  21. package/docs/apis/features/node/fs.md +78 -21
  22. package/docs/apis/features/node/git.md +50 -10
  23. package/docs/apis/features/node/google-calendar.md +3 -0
  24. package/docs/apis/features/node/google-docs.md +10 -1
  25. package/docs/apis/features/node/google-drive.md +3 -0
  26. package/docs/apis/features/node/google-mail.md +214 -0
  27. package/docs/apis/features/node/google-sheets.md +3 -0
  28. package/docs/apis/features/node/ink.md +10 -10
  29. package/docs/apis/features/node/ipc-socket.md +83 -93
  30. package/docs/apis/features/node/networking.md +5 -5
  31. package/docs/apis/features/node/os.md +7 -7
  32. package/docs/apis/features/node/package-finder.md +14 -14
  33. package/docs/apis/features/node/proc.md +2 -1
  34. package/docs/apis/features/node/process-manager.md +70 -3
  35. package/docs/apis/features/node/python.md +265 -9
  36. package/docs/apis/features/node/redis.md +380 -0
  37. package/docs/apis/features/node/ui.md +13 -13
  38. package/docs/apis/servers/express.md +35 -7
  39. package/docs/apis/servers/mcp.md +3 -3
  40. package/docs/apis/servers/websocket.md +51 -8
  41. package/docs/bootstrap/CLAUDE.md +1 -1
  42. package/docs/bootstrap/SKILL.md +93 -7
  43. package/docs/examples/feature-as-tool-provider.md +143 -0
  44. package/docs/examples/python.md +42 -1
  45. package/docs/introspection.md +15 -5
  46. package/docs/tutorials/00-bootstrap.md +3 -3
  47. package/docs/tutorials/02-container.md +2 -2
  48. package/docs/tutorials/10-creating-features.md +5 -0
  49. package/docs/tutorials/13-introspection.md +12 -2
  50. package/docs/tutorials/19-python-sessions.md +401 -0
  51. package/package.json +8 -4
  52. package/src/agi/container.server.ts +8 -0
  53. package/src/agi/features/assistant.ts +18 -0
  54. package/src/agi/features/autonomous-assistant.ts +435 -0
  55. package/src/agi/features/conversation.ts +58 -6
  56. package/src/agi/features/file-tools.ts +286 -0
  57. package/src/agi/features/luca-coder.ts +643 -0
  58. package/src/bootstrap/generated.ts +705 -17
  59. package/src/cli/build-info.ts +2 -2
  60. package/src/cli/cli.ts +22 -13
  61. package/src/commands/bootstrap.ts +49 -6
  62. package/src/commands/code.ts +369 -0
  63. package/src/commands/describe.ts +7 -2
  64. package/src/commands/index.ts +1 -0
  65. package/src/commands/sandbox-mcp.ts +7 -7
  66. package/src/commands/save-api-docs.ts +1 -1
  67. package/src/container-describer.ts +4 -4
  68. package/src/container.ts +10 -19
  69. package/src/helper.ts +24 -33
  70. package/src/introspection/generated.agi.ts +3026 -590
  71. package/src/introspection/generated.node.ts +1625 -688
  72. package/src/introspection/generated.web.ts +15 -57
  73. package/src/node/container.ts +5 -0
  74. package/src/node/features/figlet-fonts.ts +597 -0
  75. package/src/node/features/fs.ts +3 -9
  76. package/src/node/features/helpers.ts +20 -0
  77. package/src/node/features/python.ts +429 -16
  78. package/src/node/features/redis.ts +446 -0
  79. package/src/node/features/ui.ts +4 -11
  80. package/src/python/bridge.py +220 -0
  81. package/src/python/generated.ts +227 -0
  82. package/src/scaffolds/generated.ts +1 -1
  83. package/test/python-session.test.ts +105 -0
  84. package/assistants/lucaExpert/CORE.md +0 -37
  85. package/assistants/lucaExpert/hooks.ts +0 -9
  86. package/assistants/lucaExpert/tools.ts +0 -177
package/src/container.ts CHANGED
@@ -644,13 +644,13 @@ export class Container<Features extends AvailableFeatures = AvailableFeatures, C
644
644
  *
645
645
  * @example
646
646
  * ```ts
647
- * const info = container.inspect()
647
+ * const info = container.introspect()
648
648
  * console.log(info.methods) // all public methods with descriptions
649
649
  * console.log(info.getters) // all getters with return types
650
650
  * console.log(info.registries) // features, clients, servers, etc.
651
651
  * ```
652
652
  */
653
- inspect(): ContainerIntrospection {
653
+ introspect(): ContainerIntrospection {
654
654
  const className = this.constructor.name
655
655
  const buildTimeData = getContainerBuildTimeData(className) || {}
656
656
 
@@ -723,11 +723,11 @@ export class Container<Features extends AvailableFeatures = AvailableFeatures, C
723
723
  *
724
724
  * @example
725
725
  * ```ts
726
- * console.log(container.inspectAsText()) // full description
727
- * console.log(container.inspectAsText('methods')) // just methods
726
+ * console.log(container.introspectAsText()) // full description
727
+ * console.log(container.introspectAsText('methods')) // just methods
728
728
  * ```
729
729
  */
730
- inspectAsText(sectionOrDepth?: IntrospectionSection | number, startHeadingDepth?: number): string {
730
+ introspectAsText(sectionOrDepth?: IntrospectionSection | number, startHeadingDepth?: number): string {
731
731
  let section: IntrospectionSection | undefined
732
732
  let depth = 1
733
733
 
@@ -738,18 +738,13 @@ export class Container<Features extends AvailableFeatures = AvailableFeatures, C
738
738
  depth = sectionOrDepth
739
739
  }
740
740
 
741
- const data = this.inspect()
741
+ const data = this.introspect()
742
742
  return presentContainerIntrospectionAsMarkdown(data, depth, section)
743
743
  }
744
744
 
745
- /** Alias for inspectAsText. */
746
- introspectAsText(sectionOrDepth?: IntrospectionSection | number, startHeadingDepth?: number): string {
747
- return this.inspectAsText(sectionOrDepth, startHeadingDepth)
748
- }
749
-
750
- /** Alias for inspect, returns JSON introspection data. */
745
+ /** Returns JSON introspection data. */
751
746
  introspectAsJSON(): ContainerIntrospection {
752
- return this.inspect()
747
+ return this.introspect()
753
748
  }
754
749
 
755
750
  /**
@@ -758,7 +753,7 @@ export class Container<Features extends AvailableFeatures = AvailableFeatures, C
758
753
  *
759
754
  * @example
760
755
  * ```ts
761
- * console.log(container.inspectAsType())
756
+ * console.log(container.introspectAsType())
762
757
  * // interface NodeContainer {
763
758
  * // feature<T>(id: string, options?: object): T;
764
759
  * // readonly uuid: string;
@@ -766,12 +761,8 @@ export class Container<Features extends AvailableFeatures = AvailableFeatures, C
766
761
  * // }
767
762
  * ```
768
763
  */
769
- inspectAsType(): string {
770
- return this.introspectAsType()
771
- }
772
-
773
764
  introspectAsType(): string {
774
- const data = this.inspect()
765
+ const data = this.introspect()
775
766
  return presentContainerIntrospectionAsTypeScript(data)
776
767
  }
777
768
 
package/src/helper.ts CHANGED
@@ -50,22 +50,12 @@ export abstract class Helper<T extends HelperState = HelperState, K extends Help
50
50
  return {} as T
51
51
  }
52
52
 
53
- /** Alias for introspect */
54
- static inspect(section?: IntrospectionSection) : HelperIntrospection | undefined {
55
- return this.introspect(section)
56
- }
57
-
58
53
  static introspect(section?: IntrospectionSection) : HelperIntrospection | undefined {
59
54
  const data = introspect((this as any).shortcut || '')
60
55
  if (!data || !section) return data
61
56
  return filterIntrospection(data, section)
62
57
  }
63
58
 
64
- /** Alias for introspectAsText */
65
- static inspectAsText(sectionOrDepth?: IntrospectionSection | number, startHeadingDepth?: number) : string {
66
- return this.introspectAsText(sectionOrDepth, startHeadingDepth)
67
- }
68
-
69
59
  static introspectAsText(sectionOrDepth?: IntrospectionSection | number, startHeadingDepth?: number) : string {
70
60
  const { section, depth } = resolveIntrospectAsTextArgs(sectionOrDepth, startHeadingDepth)
71
61
  const introspection = this.introspect()
@@ -80,7 +70,7 @@ export abstract class Helper<T extends HelperState = HelperState, K extends Help
80
70
  *
81
71
  * @example
82
72
  * ```ts
83
- * console.log(container.feature('fs').inspectAsType())
73
+ * console.log(container.feature('fs').introspectAsType())
84
74
  * // interface FS {
85
75
  * // readonly cwd: string;
86
76
  * // readFile(path: string): Promise<string>;
@@ -88,10 +78,6 @@ export abstract class Helper<T extends HelperState = HelperState, K extends Help
88
78
  * // }
89
79
  * ```
90
80
  */
91
- static inspectAsType(section?: IntrospectionSection) : string {
92
- return this.introspectAsType(section)
93
- }
94
-
95
81
  static introspectAsType(section?: IntrospectionSection) : string {
96
82
  const introspection = this.introspect()
97
83
  if (!introspection) return ''
@@ -113,11 +99,6 @@ export abstract class Helper<T extends HelperState = HelperState, K extends Help
113
99
  return filterIntrospection(base, section)
114
100
  }
115
101
 
116
- /** Alias for introspect */
117
- inspect(section?: IntrospectionSection) : HelperIntrospection | undefined {
118
- return this.introspect(section)
119
- }
120
-
121
102
  /**
122
103
  * Returns the introspection data formatted as a markdown string.
123
104
  *
@@ -131,11 +112,6 @@ export abstract class Helper<T extends HelperState = HelperState, K extends Help
131
112
  return presentIntrospectionJSONAsMarkdown(introspection, depth, section)
132
113
  }
133
114
 
134
- /** Alias for introspectAsText */
135
- inspectAsText(sectionOrDepth?: IntrospectionSection | number, startHeadingDepth?: number) : string {
136
- return this.introspectAsText(sectionOrDepth, startHeadingDepth)
137
- }
138
-
139
115
  /**
140
116
  * Returns the introspection data formatted as a TypeScript interface declaration.
141
117
  * Useful for AI agents that reason better with structured type information,
@@ -147,11 +123,6 @@ export abstract class Helper<T extends HelperState = HelperState, K extends Help
147
123
  return presentIntrospectionAsTypeScript(introspection, section)
148
124
  }
149
125
 
150
- /** Alias for introspectAsType */
151
- inspectAsType(section?: IntrospectionSection) : string {
152
- return this.introspectAsType(section)
153
- }
154
-
155
126
  constructor(options: K, context: ContainerContext) {
156
127
  const optionSchema = (this.constructor as any).optionsSchema
157
128
  if (optionSchema && typeof optionSchema.safeParse === 'function') {
@@ -178,6 +149,20 @@ export abstract class Helper<T extends HelperState = HelperState, K extends Help
178
149
 
179
150
  this.container.emit('helperInitialized', this)
180
151
  }
152
+
153
+ /**
154
+ * Returns the names of the methods for this helper.
155
+ */
156
+ get $methods() : string[] {
157
+ return Object.keys((this.introspect() || {}).methods || [])
158
+ }
159
+
160
+ /**
161
+ * Returns the names of the getters for this helper.
162
+ */
163
+ get $getters() : string[] {
164
+ return Object.keys((this.introspect() || {}).getters || [])
165
+ }
181
166
 
182
167
  /**
183
168
  * The static shortcut identifier for this helper type, e.g. "features.assistant".
@@ -265,7 +250,7 @@ export abstract class Helper<T extends HelperState = HelperState, K extends Help
265
250
  * If a tool has no explicit handler but this instance has a method with
266
251
  * the same name, a handler is auto-generated that delegates to that method.
267
252
  */
268
- toTools(): { schemas: Record<string, z.ZodType>, handlers: Record<string, Function> } {
253
+ toTools(options?: { only?: string[], except?: string[] }): { schemas: Record<string, z.ZodType>, handlers: Record<string, Function> } {
269
254
  // Walk the prototype chain collecting static tools (parent-first, child overwrites)
270
255
  const merged: Record<string, { schema: z.ZodType, description?: string, handler?: Function }> = {}
271
256
  const chain: Function[] = []
@@ -285,10 +270,16 @@ export abstract class Helper<T extends HelperState = HelperState, K extends Help
285
270
  // Instance tools win over static
286
271
  Object.assign(merged, this._instanceTools)
287
272
 
273
+ // Filter tools by only/except before building schemas and handlers
274
+ let names = Object.keys(merged)
275
+ if (options?.only) names = names.filter(n => options.only!.includes(n))
276
+ if (options?.except) names = names.filter(n => !options.except!.includes(n))
277
+
288
278
  const schemas: Record<string, z.ZodType> = {}
289
279
  const handlers: Record<string, Function> = {}
290
280
 
291
- for (const [name, entry] of Object.entries(merged)) {
281
+ for (const name of names) {
282
+ const entry = merged[name]!
292
283
  // If the tool entry has a description but the schema doesn't, attach it
293
284
  // so addTool() picks it up from jsonSchema.description.
294
285
  schemas[name] = entry.description && !entry.schema.description
@@ -842,4 +833,4 @@ function normalizeTypeString(type: string): string {
842
833
  }
843
834
  )
844
835
  return type
845
- }
836
+ }