@soederpop/luca 0.0.35 → 0.1.0
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/package.json +2 -3
- package/src/bootstrap/generated.ts +1 -1
- package/src/cli/build-info.ts +2 -2
- package/src/commands/console.ts +2 -2
- package/src/commands/prompt.ts +2 -2
- package/src/commands/run.ts +5 -45
- package/src/introspection/generated.agi.ts +635 -535
- package/src/introspection/generated.node.ts +1005 -905
- package/src/introspection/generated.web.ts +1 -1
- package/src/node/container.ts +7 -6
- package/src/node/features/transpiler.ts +111 -0
- package/src/node/features/vm.ts +1 -1
- package/src/python/generated.ts +1 -1
- package/src/scaffolds/generated.ts +1 -1
- package/test/integration.test.ts +5 -5
- package/src/node/features/esbuild.ts +0 -79
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soederpop/luca",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"website": "https://luca.soederpop.com",
|
|
5
5
|
"description": "lightweight universal conversational architecture AKA Le Ultimate Component Architecture AKA Last Universal Common Ancestor, part AI part Human",
|
|
6
6
|
"author": "jon soeder aka the people's champ <jon@soederpop.com>",
|
|
@@ -104,12 +104,11 @@
|
|
|
104
104
|
"chokidar": "^3.5.3",
|
|
105
105
|
"cli-markdown": "^3.5.0",
|
|
106
106
|
"compromise": "^14.14.5",
|
|
107
|
-
"contentbase": "^0.
|
|
107
|
+
"contentbase": "^0.2.0",
|
|
108
108
|
"cors": "^2.8.5",
|
|
109
109
|
"detect-port": "^1.5.1",
|
|
110
110
|
"dotenv": "^17.2.4",
|
|
111
111
|
"endent": "^2.1.0",
|
|
112
|
-
"esbuild-wasm": "0.17.18",
|
|
113
112
|
"excalidraw-to-svg": "^3.1.0",
|
|
114
113
|
"express": "^4.18.2",
|
|
115
114
|
"figlet": "^1.6.0",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Auto-generated bootstrap content
|
|
2
|
-
// Generated at: 2026-03-
|
|
2
|
+
// Generated at: 2026-03-28T05:59:18.171Z
|
|
3
3
|
// Source: docs/bootstrap/*.md, docs/bootstrap/templates/*, docs/examples/*.md, docs/tutorials/*.md
|
|
4
4
|
//
|
|
5
5
|
// Do not edit manually. Run: luca build-bootstrap
|
package/src/cli/build-info.ts
CHANGED
package/src/commands/console.ts
CHANGED
|
@@ -38,7 +38,7 @@ async function evalBeforeRepl(evalArg: string, container: any, featureContext: R
|
|
|
38
38
|
if (target.type === 'markdown') {
|
|
39
39
|
await container.docs.load()
|
|
40
40
|
const doc = await container.docs.parseMarkdownAtPath(target.value)
|
|
41
|
-
const
|
|
41
|
+
const transpiler = container.feature('transpiler')
|
|
42
42
|
const shared = vm.createContext({
|
|
43
43
|
console, fetch, URL, URLSearchParams,
|
|
44
44
|
setTimeout, clearTimeout, setInterval, clearInterval,
|
|
@@ -59,7 +59,7 @@ async function evalBeforeRepl(evalArg: string, container: any, featureContext: R
|
|
|
59
59
|
const needsTransform = lang === 'tsx' || lang === 'jsx'
|
|
60
60
|
let code = value
|
|
61
61
|
if (needsTransform) {
|
|
62
|
-
const { code: transformed } =
|
|
62
|
+
const { code: transformed } = transpiler.transformSync(value, { loader: lang as 'tsx' | 'jsx', format: 'cjs' })
|
|
63
63
|
code = transformed
|
|
64
64
|
}
|
|
65
65
|
|
package/src/commands/prompt.ts
CHANGED
|
@@ -722,8 +722,8 @@ async function executePromptFile(resolvedPath: string, container: any, inputs?:
|
|
|
722
722
|
capturedLines.length = 0
|
|
723
723
|
let code = value
|
|
724
724
|
if (lang === 'tsx' || lang === 'jsx') {
|
|
725
|
-
const
|
|
726
|
-
const { code: transformed } =
|
|
725
|
+
const transpiler = container.feature('transpiler')
|
|
726
|
+
const { code: transformed } = transpiler.transformSync(value, { loader: lang as 'tsx' | 'jsx', format: 'cjs' })
|
|
727
727
|
code = transformed
|
|
728
728
|
}
|
|
729
729
|
|
package/src/commands/run.ts
CHANGED
|
@@ -16,37 +16,6 @@ export const argsSchema = CommandOptionsSchema.extend({
|
|
|
16
16
|
dontInjectContext: z.boolean().default(false).describe('Skip auto-injecting container context into scripts (run with plain bun instead)'),
|
|
17
17
|
})
|
|
18
18
|
|
|
19
|
-
/**
|
|
20
|
-
* Convert esbuild ESM output imports/exports to CJS require/module.exports
|
|
21
|
-
* so the code can run in a vm context that provides `require`.
|
|
22
|
-
*/
|
|
23
|
-
function esmToCjs(code: string): string {
|
|
24
|
-
return code
|
|
25
|
-
// import { a, b } from 'x' → const { a, b } = require('x')
|
|
26
|
-
.replace(/^import\s+\{([^}]+)\}\s+from\s+(['"][^'"]+['"])\s*;?$/gm,
|
|
27
|
-
'const {$1} = require($2);')
|
|
28
|
-
// import x from 'y' → const x = require('y').default ?? require('y')
|
|
29
|
-
.replace(/^import\s+(\w+)\s+from\s+(['"][^'"]+['"])\s*;?$/gm,
|
|
30
|
-
'const $1 = require($2).default ?? require($2);')
|
|
31
|
-
// import * as x from 'y' → const x = require('y')
|
|
32
|
-
.replace(/^import\s+\*\s+as\s+(\w+)\s+from\s+(['"][^'"]+['"])\s*;?$/gm,
|
|
33
|
-
'const $1 = require($2);')
|
|
34
|
-
// import 'y' → require('y')
|
|
35
|
-
.replace(/^import\s+(['"][^'"]+['"])\s*;?$/gm,
|
|
36
|
-
'require($1);')
|
|
37
|
-
// export default → module.exports.default =
|
|
38
|
-
.replace(/^export\s+default\s+/gm, 'module.exports.default = ')
|
|
39
|
-
// export { ... } → strip (vars already in scope)
|
|
40
|
-
.replace(/^export\s+\{[^}]*\}\s*;?$/gm, '')
|
|
41
|
-
// export const/let/var → const/let/var
|
|
42
|
-
.replace(/^export\s+(const|let|var)\s+/gm, '$1 ')
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function hasTLA(code: string): boolean {
|
|
46
|
-
// Quick check: contains await outside of async function bodies
|
|
47
|
-
// This is a heuristic — wrapTopLevelAwait does the real work
|
|
48
|
-
return /\bawait\b/.test(code) && !/^\s*\(?\s*async\b/.test(code)
|
|
49
|
-
}
|
|
50
19
|
|
|
51
20
|
function resolveScript(ref: string, context: ContainerContext): string | null {
|
|
52
21
|
const container = context.container as any
|
|
@@ -108,7 +77,7 @@ async function runMarkdown(scriptPath: string, options: z.infer<typeof argsSchem
|
|
|
108
77
|
|
|
109
78
|
const doc = await container.docs.parseMarkdownAtPath(scriptPath)
|
|
110
79
|
|
|
111
|
-
const
|
|
80
|
+
const transpiler = container.feature('transpiler')
|
|
112
81
|
const ink = container.feature('ink', { enable: true })
|
|
113
82
|
await ink.loadModules()
|
|
114
83
|
|
|
@@ -128,7 +97,7 @@ async function runMarkdown(scriptPath: string, options: z.infer<typeof argsSchem
|
|
|
128
97
|
|
|
129
98
|
for (const source of blockSources) {
|
|
130
99
|
const keysBefore = new Set(Object.keys(shared))
|
|
131
|
-
const { code: transformed } =
|
|
100
|
+
const { code: transformed } = transpiler.transformSync(source, { loader: 'tsx', format: 'cjs' })
|
|
132
101
|
|
|
133
102
|
await vm.run(transformed, shared)
|
|
134
103
|
|
|
@@ -190,7 +159,7 @@ async function runMarkdown(scriptPath: string, options: z.infer<typeof argsSchem
|
|
|
190
159
|
let code = value
|
|
191
160
|
|
|
192
161
|
if (needsTransform) {
|
|
193
|
-
const { code: transformed } =
|
|
162
|
+
const { code: transformed } = transpiler.transformSync(value, {
|
|
194
163
|
loader: lang as 'tsx' | 'jsx',
|
|
195
164
|
format: 'cjs',
|
|
196
165
|
})
|
|
@@ -229,19 +198,10 @@ async function runScript(scriptPath: string, context: ContainerContext, options:
|
|
|
229
198
|
}
|
|
230
199
|
|
|
231
200
|
const vm = container.feature('vm')
|
|
232
|
-
const
|
|
201
|
+
const transpiler = container.feature('transpiler')
|
|
233
202
|
const raw = container.fs.readFile(scriptPath)
|
|
234
203
|
|
|
235
|
-
|
|
236
|
-
if (hasTLA(raw)) {
|
|
237
|
-
// TLA is incompatible with CJS format, so transform as ESM (preserves await)
|
|
238
|
-
// then convert import/export statements to require/module.exports for the vm
|
|
239
|
-
const { code: esm } = esbuild.transformSync(raw, { format: 'esm' })
|
|
240
|
-
code = esmToCjs(esm)
|
|
241
|
-
} else {
|
|
242
|
-
const { code: cjs } = esbuild.transformSync(raw, { format: 'cjs' })
|
|
243
|
-
code = cjs
|
|
244
|
-
}
|
|
204
|
+
const { code } = transpiler.transformSync(raw, { format: 'cjs' })
|
|
245
205
|
|
|
246
206
|
const ctx = {
|
|
247
207
|
require: vm.createRequireFor(scriptPath),
|