@soederpop/luca 0.0.15 → 0.0.17
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 +1 -1
- package/src/bootstrap/generated.ts +1 -1
- package/src/commands/chat.ts +41 -1
- package/src/introspection/generated.agi.ts +465 -439
- package/src/introspection/generated.node.ts +481 -455
- package/src/introspection/generated.web.ts +1 -1
- package/src/node/features/repl.ts +19 -6
- package/src/scaffolds/generated.ts +1 -1
- package/src/servers/express.ts +23 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@soederpop/luca",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
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>",
|
package/src/commands/chat.ts
CHANGED
|
@@ -146,7 +146,7 @@ export default async function chat(options: z.infer<typeof argsSchema>, context:
|
|
|
146
146
|
const messageCount = assistant.messages?.length || 0
|
|
147
147
|
const isResuming = historyMode !== 'lifecycle' && messageCount > 1
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
let rl = readline.createInterface({
|
|
150
150
|
input: process.stdin,
|
|
151
151
|
output: process.stdout,
|
|
152
152
|
})
|
|
@@ -174,6 +174,46 @@ export default async function chat(options: z.infer<typeof argsSchema>, context:
|
|
|
174
174
|
if (!question) continue
|
|
175
175
|
if (question === '.exit') break
|
|
176
176
|
|
|
177
|
+
if (question === '/console') {
|
|
178
|
+
// Pause chat readline so the REPL can own stdin
|
|
179
|
+
rl.close()
|
|
180
|
+
|
|
181
|
+
// Build feature context like `luca console` does
|
|
182
|
+
const featureContext: Record<string, any> = {}
|
|
183
|
+
for (const fname of container.features.available) {
|
|
184
|
+
try { featureContext[fname] = container.feature(fname) } catch {}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const replPrompt = ui.colors.magenta('console') + ui.colors.dim(' > ')
|
|
188
|
+
const repl = container.feature('repl', { prompt: replPrompt })
|
|
189
|
+
|
|
190
|
+
console.log()
|
|
191
|
+
console.log(ui.colors.dim(' Dropping into console. The assistant is available as `assistant`.'))
|
|
192
|
+
console.log(ui.colors.dim(' Type .exit to return to chat.'))
|
|
193
|
+
console.log()
|
|
194
|
+
|
|
195
|
+
await repl.start({
|
|
196
|
+
context: {
|
|
197
|
+
...featureContext,
|
|
198
|
+
assistant,
|
|
199
|
+
console,
|
|
200
|
+
setTimeout, setInterval, clearTimeout, clearInterval,
|
|
201
|
+
fetch,
|
|
202
|
+
},
|
|
203
|
+
})
|
|
204
|
+
|
|
205
|
+
// Wait for the REPL to close
|
|
206
|
+
await new Promise<void>((resolve) => {
|
|
207
|
+
repl._rl!.on('close', resolve)
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
// Resume chat readline
|
|
211
|
+
console.log()
|
|
212
|
+
console.log(ui.colors.dim(` Back in chat with ${ui.colors.cyan(name)}.`))
|
|
213
|
+
rl = readline.createInterface({ input: process.stdin, output: process.stdout })
|
|
214
|
+
continue
|
|
215
|
+
}
|
|
216
|
+
|
|
177
217
|
await assistant.ask(question)
|
|
178
218
|
}
|
|
179
219
|
|