@soederpop/luca 0.1.2 → 0.1.3
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/CLAUDE.md +2 -0
- package/assistants/codingAssistant/hooks.ts +1 -5
- package/assistants/inkbot/CORE.md +69 -0
- package/assistants/inkbot/hooks.ts +14 -0
- package/assistants/inkbot/tools.ts +47 -0
- package/commands/inkbot.ts +353 -0
- package/dist/agi/container.server.d.ts +63 -0
- package/dist/agi/container.server.d.ts.map +1 -0
- package/dist/agi/endpoints/ask.d.ts +20 -0
- package/dist/agi/endpoints/ask.d.ts.map +1 -0
- package/dist/agi/endpoints/conversations/[id].d.ts +27 -0
- package/dist/agi/endpoints/conversations/[id].d.ts.map +1 -0
- package/dist/agi/endpoints/conversations.d.ts +18 -0
- package/dist/agi/endpoints/conversations.d.ts.map +1 -0
- package/dist/agi/endpoints/experts.d.ts +8 -0
- package/dist/agi/endpoints/experts.d.ts.map +1 -0
- package/dist/agi/feature.d.ts +9 -0
- package/dist/agi/feature.d.ts.map +1 -0
- package/dist/agi/features/assistant.d.ts +509 -0
- package/dist/agi/features/assistant.d.ts.map +1 -0
- package/dist/agi/features/assistants-manager.d.ts +236 -0
- package/dist/agi/features/assistants-manager.d.ts.map +1 -0
- package/dist/agi/features/autonomous-assistant.d.ts +281 -0
- package/dist/agi/features/autonomous-assistant.d.ts.map +1 -0
- package/dist/agi/features/browser-use.d.ts +479 -0
- package/dist/agi/features/browser-use.d.ts.map +1 -0
- package/dist/agi/features/claude-code.d.ts +824 -0
- package/dist/agi/features/claude-code.d.ts.map +1 -0
- package/dist/agi/features/conversation-history.d.ts +245 -0
- package/dist/agi/features/conversation-history.d.ts.map +1 -0
- package/dist/agi/features/conversation.d.ts +464 -0
- package/dist/agi/features/conversation.d.ts.map +1 -0
- package/dist/agi/features/docs-reader.d.ts +72 -0
- package/dist/agi/features/docs-reader.d.ts.map +1 -0
- package/dist/agi/features/file-tools.d.ts +110 -0
- package/dist/agi/features/file-tools.d.ts.map +1 -0
- package/dist/agi/features/luca-coder.d.ts +323 -0
- package/dist/agi/features/luca-coder.d.ts.map +1 -0
- package/dist/agi/features/openai-codex.d.ts +381 -0
- package/dist/agi/features/openai-codex.d.ts.map +1 -0
- package/dist/agi/features/openapi.d.ts +200 -0
- package/dist/agi/features/openapi.d.ts.map +1 -0
- package/dist/agi/features/skills-library.d.ts +167 -0
- package/dist/agi/features/skills-library.d.ts.map +1 -0
- package/dist/agi/index.d.ts +5 -0
- package/dist/agi/index.d.ts.map +1 -0
- package/dist/agi/lib/interceptor-chain.d.ts +44 -0
- package/dist/agi/lib/interceptor-chain.d.ts.map +1 -0
- package/dist/agi/lib/token-counter.d.ts +13 -0
- package/dist/agi/lib/token-counter.d.ts.map +1 -0
- package/dist/bootstrap/generated.d.ts +5 -0
- package/dist/bootstrap/generated.d.ts.map +1 -0
- package/dist/browser.d.ts +12 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/bus.d.ts +29 -0
- package/dist/bus.d.ts.map +1 -0
- package/dist/cli/build-info.d.ts +4 -0
- package/dist/cli/build-info.d.ts.map +1 -0
- package/dist/cli/cli.d.ts +3 -0
- package/dist/cli/cli.d.ts.map +1 -0
- package/dist/client.d.ts +60 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/clients/civitai/index.d.ts +472 -0
- package/dist/clients/civitai/index.d.ts.map +1 -0
- package/dist/clients/client-template.d.ts +30 -0
- package/dist/clients/client-template.d.ts.map +1 -0
- package/dist/clients/comfyui/index.d.ts +281 -0
- package/dist/clients/comfyui/index.d.ts.map +1 -0
- package/dist/clients/elevenlabs/index.d.ts +197 -0
- package/dist/clients/elevenlabs/index.d.ts.map +1 -0
- package/dist/clients/graph.d.ts +64 -0
- package/dist/clients/graph.d.ts.map +1 -0
- package/dist/clients/openai/index.d.ts +247 -0
- package/dist/clients/openai/index.d.ts.map +1 -0
- package/dist/clients/rest.d.ts +92 -0
- package/dist/clients/rest.d.ts.map +1 -0
- package/dist/clients/supabase/index.d.ts +176 -0
- package/dist/clients/supabase/index.d.ts.map +1 -0
- package/dist/clients/websocket.d.ts +127 -0
- package/dist/clients/websocket.d.ts.map +1 -0
- package/dist/command.d.ts +163 -0
- package/dist/command.d.ts.map +1 -0
- package/dist/commands/bootstrap.d.ts +20 -0
- package/dist/commands/bootstrap.d.ts.map +1 -0
- package/dist/commands/chat.d.ts +37 -0
- package/dist/commands/chat.d.ts.map +1 -0
- package/dist/commands/code.d.ts +28 -0
- package/dist/commands/code.d.ts.map +1 -0
- package/dist/commands/console.d.ts +22 -0
- package/dist/commands/console.d.ts.map +1 -0
- package/dist/commands/describe.d.ts +50 -0
- package/dist/commands/describe.d.ts.map +1 -0
- package/dist/commands/eval.d.ts +23 -0
- package/dist/commands/eval.d.ts.map +1 -0
- package/dist/commands/help.d.ts +25 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/index.d.ts +18 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/introspect.d.ts +24 -0
- package/dist/commands/introspect.d.ts.map +1 -0
- package/dist/commands/mcp.d.ts +35 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/prompt.d.ts +38 -0
- package/dist/commands/prompt.d.ts.map +1 -0
- package/dist/commands/run.d.ts +24 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/sandbox-mcp.d.ts +34 -0
- package/dist/commands/sandbox-mcp.d.ts.map +1 -0
- package/dist/commands/save-api-docs.d.ts +21 -0
- package/dist/commands/save-api-docs.d.ts.map +1 -0
- package/dist/commands/scaffold.d.ts +24 -0
- package/dist/commands/scaffold.d.ts.map +1 -0
- package/dist/commands/select.d.ts +22 -0
- package/dist/commands/select.d.ts.map +1 -0
- package/dist/commands/serve.d.ts +29 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/container-describer.d.ts +144 -0
- package/dist/container-describer.d.ts.map +1 -0
- package/dist/container.d.ts +451 -0
- package/dist/container.d.ts.map +1 -0
- package/dist/endpoint.d.ts +113 -0
- package/dist/endpoint.d.ts.map +1 -0
- package/dist/feature.d.ts +47 -0
- package/dist/feature.d.ts.map +1 -0
- package/dist/graft.d.ts +29 -0
- package/dist/graft.d.ts.map +1 -0
- package/dist/hash-object.d.ts +8 -0
- package/dist/hash-object.d.ts.map +1 -0
- package/dist/helper.d.ts +209 -0
- package/dist/helper.d.ts.map +1 -0
- package/dist/introspection/generated.node.d.ts +44623 -0
- package/dist/introspection/generated.node.d.ts.map +1 -0
- package/dist/introspection/generated.web.d.ts +1412 -0
- package/dist/introspection/generated.web.d.ts.map +1 -0
- package/dist/introspection/index.d.ts +156 -0
- package/dist/introspection/index.d.ts.map +1 -0
- package/dist/introspection/scan.d.ts +147 -0
- package/dist/introspection/scan.d.ts.map +1 -0
- package/dist/node/container.d.ts +256 -0
- package/dist/node/container.d.ts.map +1 -0
- package/dist/node/feature.d.ts +9 -0
- package/dist/node/feature.d.ts.map +1 -0
- package/dist/node/features/container-link.d.ts +213 -0
- package/dist/node/features/container-link.d.ts.map +1 -0
- package/dist/node/features/content-db.d.ts +354 -0
- package/dist/node/features/content-db.d.ts.map +1 -0
- package/dist/node/features/disk-cache.d.ts +236 -0
- package/dist/node/features/disk-cache.d.ts.map +1 -0
- package/dist/node/features/dns.d.ts +511 -0
- package/dist/node/features/dns.d.ts.map +1 -0
- package/dist/node/features/docker.d.ts +485 -0
- package/dist/node/features/docker.d.ts.map +1 -0
- package/dist/node/features/downloader.d.ts +73 -0
- package/dist/node/features/downloader.d.ts.map +1 -0
- package/dist/node/features/figlet-fonts.d.ts +4 -0
- package/dist/node/features/figlet-fonts.d.ts.map +1 -0
- package/dist/node/features/file-manager.d.ts +177 -0
- package/dist/node/features/file-manager.d.ts.map +1 -0
- package/dist/node/features/fs.d.ts +635 -0
- package/dist/node/features/fs.d.ts.map +1 -0
- package/dist/node/features/git.d.ts +329 -0
- package/dist/node/features/git.d.ts.map +1 -0
- package/dist/node/features/google-auth.d.ts +200 -0
- package/dist/node/features/google-auth.d.ts.map +1 -0
- package/dist/node/features/google-calendar.d.ts +194 -0
- package/dist/node/features/google-calendar.d.ts.map +1 -0
- package/dist/node/features/google-docs.d.ts +138 -0
- package/dist/node/features/google-docs.d.ts.map +1 -0
- package/dist/node/features/google-drive.d.ts +202 -0
- package/dist/node/features/google-drive.d.ts.map +1 -0
- package/dist/node/features/google-mail.d.ts +221 -0
- package/dist/node/features/google-mail.d.ts.map +1 -0
- package/dist/node/features/google-sheets.d.ts +157 -0
- package/dist/node/features/google-sheets.d.ts.map +1 -0
- package/dist/node/features/grep.d.ts +207 -0
- package/dist/node/features/grep.d.ts.map +1 -0
- package/dist/node/features/helpers.d.ts +236 -0
- package/dist/node/features/helpers.d.ts.map +1 -0
- package/dist/node/features/ink.d.ts +332 -0
- package/dist/node/features/ink.d.ts.map +1 -0
- package/dist/node/features/ipc-socket.d.ts +298 -0
- package/dist/node/features/ipc-socket.d.ts.map +1 -0
- package/dist/node/features/json-tree.d.ts +140 -0
- package/dist/node/features/json-tree.d.ts.map +1 -0
- package/dist/node/features/networking.d.ts +373 -0
- package/dist/node/features/networking.d.ts.map +1 -0
- package/dist/node/features/nlp.d.ts +125 -0
- package/dist/node/features/nlp.d.ts.map +1 -0
- package/dist/node/features/opener.d.ts +93 -0
- package/dist/node/features/opener.d.ts.map +1 -0
- package/dist/node/features/os.d.ts +168 -0
- package/dist/node/features/os.d.ts.map +1 -0
- package/dist/node/features/package-finder.d.ts +419 -0
- package/dist/node/features/package-finder.d.ts.map +1 -0
- package/dist/node/features/postgres.d.ts +173 -0
- package/dist/node/features/postgres.d.ts.map +1 -0
- package/dist/node/features/proc.d.ts +285 -0
- package/dist/node/features/proc.d.ts.map +1 -0
- package/dist/node/features/process-manager.d.ts +427 -0
- package/dist/node/features/process-manager.d.ts.map +1 -0
- package/dist/node/features/python.d.ts +477 -0
- package/dist/node/features/python.d.ts.map +1 -0
- package/dist/node/features/redis.d.ts +247 -0
- package/dist/node/features/redis.d.ts.map +1 -0
- package/dist/node/features/repl.d.ts +84 -0
- package/dist/node/features/repl.d.ts.map +1 -0
- package/dist/node/features/runpod.d.ts +527 -0
- package/dist/node/features/runpod.d.ts.map +1 -0
- package/dist/node/features/secure-shell.d.ts +145 -0
- package/dist/node/features/secure-shell.d.ts.map +1 -0
- package/dist/node/features/semantic-search.d.ts +207 -0
- package/dist/node/features/semantic-search.d.ts.map +1 -0
- package/dist/node/features/sqlite.d.ts +180 -0
- package/dist/node/features/sqlite.d.ts.map +1 -0
- package/dist/node/features/telegram.d.ts +173 -0
- package/dist/node/features/telegram.d.ts.map +1 -0
- package/dist/node/features/transpiler.d.ts +51 -0
- package/dist/node/features/transpiler.d.ts.map +1 -0
- package/dist/node/features/tts.d.ts +108 -0
- package/dist/node/features/tts.d.ts.map +1 -0
- package/dist/node/features/ui.d.ts +562 -0
- package/dist/node/features/ui.d.ts.map +1 -0
- package/dist/node/features/vault.d.ts +90 -0
- package/dist/node/features/vault.d.ts.map +1 -0
- package/dist/node/features/vm.d.ts +285 -0
- package/dist/node/features/vm.d.ts.map +1 -0
- package/dist/node/features/yaml-tree.d.ts +118 -0
- package/dist/node/features/yaml-tree.d.ts.map +1 -0
- package/dist/node/features/yaml.d.ts +127 -0
- package/dist/node/features/yaml.d.ts.map +1 -0
- package/dist/node.d.ts +67 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/python/generated.d.ts +2 -0
- package/dist/python/generated.d.ts.map +1 -0
- package/dist/react/index.d.ts +36 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/registry.d.ts +97 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/scaffolds/generated.d.ts +13 -0
- package/dist/scaffolds/generated.d.ts.map +1 -0
- package/dist/scaffolds/template.d.ts +11 -0
- package/dist/scaffolds/template.d.ts.map +1 -0
- package/dist/schemas/base.d.ts +254 -0
- package/dist/schemas/base.d.ts.map +1 -0
- package/dist/selector.d.ts +130 -0
- package/dist/selector.d.ts.map +1 -0
- package/dist/server.d.ts +89 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/servers/express.d.ts +104 -0
- package/dist/servers/express.d.ts.map +1 -0
- package/dist/servers/mcp.d.ts +201 -0
- package/dist/servers/mcp.d.ts.map +1 -0
- package/dist/servers/socket.d.ts +121 -0
- package/dist/servers/socket.d.ts.map +1 -0
- package/dist/state.d.ts +24 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/web/clients/socket.d.ts +37 -0
- package/dist/web/clients/socket.d.ts.map +1 -0
- package/dist/web/container.d.ts +55 -0
- package/dist/web/container.d.ts.map +1 -0
- package/dist/web/extension.d.ts +4 -0
- package/dist/web/extension.d.ts.map +1 -0
- package/dist/web/feature.d.ts +8 -0
- package/dist/web/feature.d.ts.map +1 -0
- package/dist/web/features/asset-loader.d.ts +35 -0
- package/dist/web/features/asset-loader.d.ts.map +1 -0
- package/dist/web/features/container-link.d.ts +167 -0
- package/dist/web/features/container-link.d.ts.map +1 -0
- package/dist/web/features/esbuild.d.ts +51 -0
- package/dist/web/features/esbuild.d.ts.map +1 -0
- package/dist/web/features/helpers.d.ts +140 -0
- package/dist/web/features/helpers.d.ts.map +1 -0
- package/dist/web/features/network.d.ts +69 -0
- package/dist/web/features/network.d.ts.map +1 -0
- package/dist/web/features/speech.d.ts +71 -0
- package/dist/web/features/speech.d.ts.map +1 -0
- package/dist/web/features/vault.d.ts +62 -0
- package/dist/web/features/vault.d.ts.map +1 -0
- package/dist/web/features/vm.d.ts +48 -0
- package/dist/web/features/vm.d.ts.map +1 -0
- package/dist/web/features/voice-recognition.d.ts +96 -0
- package/dist/web/features/voice-recognition.d.ts.map +1 -0
- package/dist/web/shims/isomorphic-vm.d.ts +22 -0
- package/dist/web/shims/isomorphic-vm.d.ts.map +1 -0
- package/docs/apis/features/agi/assistant.md +1 -0
- package/docs/apis/features/agi/assistants-manager.md +62 -2
- package/docs/apis/features/agi/auto-assistant.md +11 -109
- package/docs/apis/features/agi/claude-code.md +138 -0
- package/docs/apis/features/agi/conversation.md +60 -31
- package/docs/apis/features/agi/luca-coder.md +407 -0
- package/docs/apis/features/agi/openapi.md +2 -2
- package/docs/apis/features/agi/skills-library.md +12 -0
- package/docs/apis/features/node/python.md +81 -11
- package/docs/apis/features/node/transpiler.md +74 -0
- package/docs/apis/features/web/esbuild.md +0 -6
- package/docs/apis/servers/mcp.md +2 -2
- package/docs/examples/entity.md +124 -0
- package/package.json +73 -21
- package/src/agi/feature.ts +13 -0
- package/src/agi/features/assistant.ts +36 -25
- package/src/agi/features/assistants-manager.ts +70 -5
- package/src/agi/features/autonomous-assistant.ts +1 -5
- package/src/agi/features/browser-use.ts +2 -2
- package/src/agi/features/claude-code.ts +165 -1
- package/src/agi/features/conversation-history.ts +2 -6
- package/src/agi/features/conversation.ts +95 -3
- package/src/agi/features/docs-reader.ts +2 -1
- package/src/agi/features/file-tools.ts +2 -2
- package/src/agi/features/luca-coder.ts +1 -5
- package/src/agi/features/openai-codex.ts +1 -1
- package/src/agi/features/openapi.ts +3 -3
- package/src/agi/features/skills-library.ts +87 -6
- package/src/agi/lib/interceptor-chain.ts +10 -0
- package/src/agi/lib/token-counter.ts +1 -1
- package/src/bootstrap/generated.ts +126 -1
- package/src/bus.ts +27 -5
- package/src/cli/build-info.ts +2 -2
- package/src/client.ts +2 -2
- package/src/clients/elevenlabs/index.ts +5 -0
- package/src/commands/bootstrap.ts +2 -1
- package/src/commands/chat.ts +1 -0
- package/src/commands/code.ts +4 -2
- package/src/commands/prompt.ts +34 -34
- package/src/commands/sandbox-mcp.ts +69 -163
- package/src/commands/save-api-docs.ts +10 -8
- package/src/commands/select.ts +8 -3
- package/src/container-describer.ts +70 -84
- package/src/container.ts +93 -3
- package/src/endpoint.ts +1 -1
- package/src/entity.ts +173 -0
- package/src/feature.ts +3 -3
- package/src/helper.ts +8 -4
- package/src/introspection/generated.agi.ts +1246 -798
- package/src/introspection/generated.node.ts +892 -798
- package/src/introspection/generated.web.ts +95 -3
- package/src/introspection/scan.ts +1 -1
- package/src/node/container.ts +1 -1
- package/src/node/features/content-db.ts +3 -3
- package/src/node/features/file-manager.ts +10 -9
- package/src/node/features/git.ts +5 -5
- package/src/node/features/helpers.ts +1 -1
- package/src/node/features/json-tree.ts +1 -1
- package/src/node/features/os.ts +3 -3
- package/src/node/features/package-finder.ts +1 -1
- package/src/node/features/process-manager.ts +1 -1
- package/src/node/features/python.ts +3 -3
- package/src/node/features/redis.ts +1 -1
- package/src/node/features/repl.ts +2 -2
- package/src/node/features/transpiler.ts +2 -2
- package/src/node/features/ui.ts +1 -1
- package/src/node/features/vm.ts +3 -3
- package/src/node/features/yaml-tree.ts +1 -1
- package/src/node.ts +1 -0
- package/src/python/generated.ts +1 -1
- package/src/scaffolds/generated.ts +1 -1
- package/src/selector.ts +74 -4
- package/src/server.ts +2 -2
- package/src/servers/mcp.ts +6 -6
- package/src/web/features/helpers.ts +1 -1
- package/src/web/features/network.ts +1 -0
- package/test/conversation.test.ts +220 -0
- package/tsconfig.build.json +12 -0
- package/tsconfig.json +1 -1
- package/scripts/examples/telegram-ink-ui.ts +0 -302
- package/scripts/examples/using-openai-codex.ts +0 -23
- package/scripts/examples/vm-loading-esm-modules.ts +0 -16
package/CLAUDE.md
CHANGED
|
@@ -111,3 +111,5 @@ This means **JSDoc blocks on helpers (features, clients, servers) must be valid
|
|
|
111
111
|
## Git Strategy
|
|
112
112
|
|
|
113
113
|
- We generally roll all on main. Commit your changes after you're done, only your changes. Leave a good message, tell me why don't just tell me what. Don't gimme that coauthored by whoever bullshit. The streets know we're one.
|
|
114
|
+
|
|
115
|
+
- Always commit your work
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import type { Assistant } from "@/agi"
|
|
2
2
|
|
|
3
3
|
export function started() {
|
|
4
|
-
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export function created(assistant: Assistant) {
|
|
8
|
-
assistant.use(container.feature('skillsLibrary'))
|
|
4
|
+
assistant.use(container.feature('skillsLibrary'))
|
|
9
5
|
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
maxTokens: 4096
|
|
3
|
+
skills:
|
|
4
|
+
- luca-framework
|
|
5
|
+
---
|
|
6
|
+
# Inkbot — Canvas Renderer
|
|
7
|
+
|
|
8
|
+
You are an expert in the Luca framework running inside a split-pane terminal UI. The left pane is this chat. The right pane is a **canvas** that you control by writing TypeScript code.
|
|
9
|
+
|
|
10
|
+
## How the Canvas Works
|
|
11
|
+
|
|
12
|
+
You have a `draw` tool. When you call it, the code you provide runs as a **bun subprocess** and its stdout appears in the canvas panel. If the script exits with an error, you receive the stderr — fix the code and redraw.
|
|
13
|
+
|
|
14
|
+
A "redraw" is just calling `draw` again with updated code. The canvas always shows the output of the most recent run of the active scene.
|
|
15
|
+
|
|
16
|
+
### Scenes
|
|
17
|
+
|
|
18
|
+
The canvas supports multiple named **scenes**. Each scene is a separate script. You can:
|
|
19
|
+
|
|
20
|
+
- `draw` — create or update a scene and run it immediately (default scene id: `"default"`)
|
|
21
|
+
- `create_scene` — stage a scene without running it
|
|
22
|
+
- `run_scene` — run a specific scene
|
|
23
|
+
- `run_all` — run every scene in order
|
|
24
|
+
- `activate_scene` — switch which scene the canvas displays
|
|
25
|
+
- `get_canvas` — inspect the current output, errors, code, and status
|
|
26
|
+
|
|
27
|
+
### Writing Scene Code
|
|
28
|
+
|
|
29
|
+
Scene code runs **inside the container** via `vm.run()` with the full container context injected. You have `container`, every enabled feature, and all standard globals available — no imports needed. Use `console.log()` to produce visible output in the canvas.
|
|
30
|
+
|
|
31
|
+
Available in scene scope:
|
|
32
|
+
- `container` — the live AGI container instance
|
|
33
|
+
- All enabled features as top-level globals (e.g. `fs`, `proc`, `ui`, `grep`, etc.)
|
|
34
|
+
- `fetch`, `URL`, `URLSearchParams`, `Buffer`, `process`, `setTimeout`, etc.
|
|
35
|
+
|
|
36
|
+
Use your `luca_describe` tools to learn the APIs. Then write scene code that uses them directly:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
// Example: list available features
|
|
40
|
+
const available = container.features.available
|
|
41
|
+
console.log("Available features:")
|
|
42
|
+
available.forEach(f => console.log(` - ${f}`))
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
// Example: read and display a file
|
|
47
|
+
const content = fs.readFile('package.json')
|
|
48
|
+
const pkg = JSON.parse(content)
|
|
49
|
+
console.log(`${pkg.name} v${pkg.version}`)
|
|
50
|
+
console.log(`Dependencies: ${Object.keys(pkg.dependencies || {}).length}`)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Tips:
|
|
54
|
+
- **Simple output**: `console.log("Hello world")` — plain text renders in the canvas.
|
|
55
|
+
- **Formatted tables**: Build strings with padding, box-drawing characters, or ANSI escape codes.
|
|
56
|
+
- **Dynamic data**: Fetch APIs, read files, compute values — full container power.
|
|
57
|
+
- **Async**: Top-level `await` works. Fetch URLs, run queries, whatever you need.
|
|
58
|
+
|
|
59
|
+
### Error Recovery
|
|
60
|
+
|
|
61
|
+
If your code has a bug, you will receive the error output. Read the error carefully, fix the issue, and call `draw` again. Do not apologize excessively — just fix it and redraw. The user expects iteration.
|
|
62
|
+
|
|
63
|
+
## Your Personality
|
|
64
|
+
|
|
65
|
+
You are creative, concise, and action-oriented. When the user asks you to render something, do it immediately — show, don't tell. Keep chat responses brief; let the canvas speak. When explaining what you drew, be specific about what's visible.
|
|
66
|
+
|
|
67
|
+
## Your Tools
|
|
68
|
+
|
|
69
|
+
In addition to the canvas tools above, you have access to Luca framework inspection tools (`luca_describe`, etc.) through the skills library. Use them to look up features, APIs, and helpers when writing scene code.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AGIContainer, Assistant } from "@soederpop/luca/agi"
|
|
2
|
+
|
|
3
|
+
declare global {
|
|
4
|
+
var assistant: Assistant
|
|
5
|
+
var container: AGIContainer
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function started() {
|
|
9
|
+
assistant
|
|
10
|
+
// this will give it the ability to read documentation from the various feature
|
|
11
|
+
.use(container.describer)
|
|
12
|
+
// use the documentation from the various available skils
|
|
13
|
+
.use(container.feature('skillsLibrary'))
|
|
14
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import container from '@soederpop/luca/agi'
|
|
2
|
+
import { z } from 'zod'
|
|
3
|
+
|
|
4
|
+
export const schemas = {
|
|
5
|
+
README: z.object({}).describe('Call this tool first to learn how your canvas tools work.')
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export function README() {
|
|
9
|
+
return README_CONTENT
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const README_CONTENT = `
|
|
13
|
+
# Inkbot Canvas Tools
|
|
14
|
+
|
|
15
|
+
You have the following tools registered on you for controlling the canvas:
|
|
16
|
+
|
|
17
|
+
## draw
|
|
18
|
+
Write TypeScript code that runs as a bun subprocess. stdout appears in the canvas.
|
|
19
|
+
- \`code\`: string — the TypeScript to execute
|
|
20
|
+
- \`sceneId\`: string (optional) — defaults to "default"
|
|
21
|
+
|
|
22
|
+
## create_scene
|
|
23
|
+
Create a named scene without running it.
|
|
24
|
+
- \`id\`: string — unique scene name
|
|
25
|
+
- \`code\`: string — TypeScript code
|
|
26
|
+
|
|
27
|
+
## run_scene
|
|
28
|
+
Run an existing scene by id.
|
|
29
|
+
- \`id\`: string
|
|
30
|
+
|
|
31
|
+
## run_all
|
|
32
|
+
Run every scene in order. Returns array of results.
|
|
33
|
+
|
|
34
|
+
## activate_scene
|
|
35
|
+
Switch the canvas to display a different scene.
|
|
36
|
+
- \`id\`: string
|
|
37
|
+
|
|
38
|
+
## get_canvas
|
|
39
|
+
Returns the current canvas state: output, error, code, status, and scene list.
|
|
40
|
+
|
|
41
|
+
## Tips
|
|
42
|
+
- Use console.log() for output — that is what renders in the canvas.
|
|
43
|
+
- If your code errors, you get stderr back. Fix it and draw again.
|
|
44
|
+
- You can use ANSI escape codes for colors and formatting.
|
|
45
|
+
- Scenes persist — update them with draw using the same sceneId.
|
|
46
|
+
- You also have luca framework inspection tools (luca_describe, etc.) to look up APIs.
|
|
47
|
+
`
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
import { z } from 'zod'
|
|
2
|
+
import { commands, CommandOptionsSchema } from '@soederpop/luca'
|
|
3
|
+
import type { ContainerContext } from '@soederpop/luca'
|
|
4
|
+
import { AGIContainer } from '../src/agi/container.server.js'
|
|
5
|
+
import { tmpdir } from 'os'
|
|
6
|
+
|
|
7
|
+
export const argsSchema = CommandOptionsSchema.extend({
|
|
8
|
+
model: z.string().optional().describe('OpenAI model to use'),
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export async function inkbot(options: z.infer<typeof argsSchema>, context: ContainerContext) {
|
|
12
|
+
const container = new AGIContainer()
|
|
13
|
+
|
|
14
|
+
// ─── Load Ink ────────────────────────────────────────────────────────
|
|
15
|
+
const ink = container.feature('ink', { enable: true, patchConsole: true })
|
|
16
|
+
await ink.loadModules()
|
|
17
|
+
const React = ink.React
|
|
18
|
+
const h = React.createElement
|
|
19
|
+
const { Box, Text } = ink.components
|
|
20
|
+
const { useInput, useApp, useStdout } = ink.hooks
|
|
21
|
+
const { useState, useEffect } = React
|
|
22
|
+
|
|
23
|
+
// ─── Scene Runner ────────────────────────────────────────────────────
|
|
24
|
+
// Scenes are code strings run as bun subprocesses.
|
|
25
|
+
// The stage entity tracks which scenes exist and which is active.
|
|
26
|
+
// Scene entities track individual code, output, error, status.
|
|
27
|
+
|
|
28
|
+
const stage = container.entity('inkbot:stage')
|
|
29
|
+
stage.setState({ activeSceneId: null, sceneIds: [] as string[], tick: 0 })
|
|
30
|
+
|
|
31
|
+
const sceneMap: Record<string, ReturnType<typeof container.entity>> = {}
|
|
32
|
+
|
|
33
|
+
function bumpStage() {
|
|
34
|
+
stage.setState({ tick: ((stage.state.get('tick') as number) || 0) + 1 })
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function getOrCreateScene(id: string, code: string) {
|
|
38
|
+
if (sceneMap[id]) {
|
|
39
|
+
sceneMap[id].setState({ code })
|
|
40
|
+
return sceneMap[id]
|
|
41
|
+
}
|
|
42
|
+
const scene = container.entity(`inkbot:scene:${id}`)
|
|
43
|
+
scene.setState({ code, output: '', error: '', status: 'idle', exitCode: null })
|
|
44
|
+
sceneMap[id] = scene
|
|
45
|
+
const ids = [...((stage.state.get('sceneIds') || []) as string[])]
|
|
46
|
+
if (!ids.includes(id)) ids.push(id)
|
|
47
|
+
stage.setState({ sceneIds: ids })
|
|
48
|
+
if (!stage.state.get('activeSceneId')) stage.setState({ activeSceneId: id })
|
|
49
|
+
return scene
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const proc = container.feature('proc')
|
|
53
|
+
const fs = container.feature('fs')
|
|
54
|
+
const sceneTmpDir = `${tmpdir()}/inkbot-scenes`
|
|
55
|
+
fs.ensureFolder(sceneTmpDir)
|
|
56
|
+
|
|
57
|
+
async function runScene(id: string): Promise<{ output: string; error: string; exitCode: number }> {
|
|
58
|
+
const scene = sceneMap[id]
|
|
59
|
+
if (!scene) throw new Error(`Scene "${id}" not found`)
|
|
60
|
+
|
|
61
|
+
const code = scene.state.get('code') as string
|
|
62
|
+
scene.setState({ status: 'running', output: '', error: '' })
|
|
63
|
+
bumpStage()
|
|
64
|
+
|
|
65
|
+
// Write to tmpdir, shell out to `luca run` — gets full container context + process isolation
|
|
66
|
+
const file = `${sceneTmpDir}/${id.replace(/[^a-zA-Z0-9-]/g, '_')}_${Date.now()}.ts`
|
|
67
|
+
fs.writeFile(file, code)
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
const result = await proc.spawnAndCapture('luca', ['run', file], {
|
|
71
|
+
cwd: container.cwd,
|
|
72
|
+
onOutput(data: string) {
|
|
73
|
+
scene.setState({ output: ((scene.state.get('output') || '') as string) + data })
|
|
74
|
+
bumpStage()
|
|
75
|
+
},
|
|
76
|
+
onError(data: string) {
|
|
77
|
+
scene.setState({ error: ((scene.state.get('error') || '') as string) + data })
|
|
78
|
+
bumpStage()
|
|
79
|
+
},
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
const status = result.exitCode === 0 ? 'complete' : 'failed'
|
|
83
|
+
scene.setState({ status, exitCode: result.exitCode })
|
|
84
|
+
bumpStage()
|
|
85
|
+
try { fs.unlink(file) } catch {}
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
output: (scene.state.get('output') || '') as string,
|
|
89
|
+
error: (scene.state.get('error') || '') as string,
|
|
90
|
+
exitCode: result.exitCode ?? 1,
|
|
91
|
+
}
|
|
92
|
+
} catch (err: any) {
|
|
93
|
+
scene.setState({ status: 'failed', error: err.message, exitCode: 1 })
|
|
94
|
+
bumpStage()
|
|
95
|
+
try { fs.unlink(file) } catch {}
|
|
96
|
+
return { output: '', error: err.message, exitCode: 1 }
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// ─── Assistant ───────────────────────────────────────────────────────
|
|
101
|
+
const mgr = container.feature('assistantsManager')
|
|
102
|
+
await mgr.discover()
|
|
103
|
+
const assistant = mgr.create('inkbot', { model: options.model })
|
|
104
|
+
|
|
105
|
+
// Scene completion → inject result into conversation so the assistant sees it
|
|
106
|
+
stage.on('sceneComplete' as any, (id: string, output: string) => {
|
|
107
|
+
const msg = output.trim()
|
|
108
|
+
? `[Scene "${id}" completed]\n${output.trim()}`
|
|
109
|
+
: `[Scene "${id}" completed with no output]`
|
|
110
|
+
assistant.conversation?.pushMessage({ role: 'developer', content: msg })
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
stage.on('sceneFailed' as any, (id: string, error: string) => {
|
|
114
|
+
const msg = `[Scene "${id}" failed]\n${error.trim()}`
|
|
115
|
+
assistant.conversation?.pushMessage({ role: 'developer', content: msg })
|
|
116
|
+
// Auto-ask the assistant to fix it
|
|
117
|
+
assistant.ask(msg).catch(() => {})
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
// Canvas tools — registered directly so they close over stage/sceneMap
|
|
121
|
+
assistant.addTool(
|
|
122
|
+
'draw',
|
|
123
|
+
async (args: { code: string; sceneId?: string }) => {
|
|
124
|
+
const id = args.sceneId || 'default'
|
|
125
|
+
getOrCreateScene(id, args.code)
|
|
126
|
+
stage.setState({ activeSceneId: id })
|
|
127
|
+
bumpStage()
|
|
128
|
+
// Fire and forget — result feeds back via stage events
|
|
129
|
+
runScene(id).then(result => {
|
|
130
|
+
if (result.exitCode === 0) {
|
|
131
|
+
stage.emit('sceneComplete' as any, id, result.output)
|
|
132
|
+
} else {
|
|
133
|
+
stage.emit('sceneFailed' as any, id, result.error)
|
|
134
|
+
}
|
|
135
|
+
})
|
|
136
|
+
return { status: 'running', sceneId: id }
|
|
137
|
+
},
|
|
138
|
+
z.object({
|
|
139
|
+
code: z.string().describe('TypeScript code to execute. Use console.log() for visible output.'),
|
|
140
|
+
sceneId: z.string().optional().describe('Scene id (defaults to "default").'),
|
|
141
|
+
}).describe('Draw or redraw the canvas. Returns immediately — output streams to the canvas. If the scene fails, you will be notified automatically.'),
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
assistant.addTool(
|
|
145
|
+
'create_scene',
|
|
146
|
+
async (args: { id: string; code: string }) => {
|
|
147
|
+
getOrCreateScene(args.id, args.code)
|
|
148
|
+
return { created: args.id, allScenes: stage.state.get('sceneIds') }
|
|
149
|
+
},
|
|
150
|
+
z.object({
|
|
151
|
+
id: z.string().describe('Unique scene identifier'),
|
|
152
|
+
code: z.string().describe('TypeScript code for this scene'),
|
|
153
|
+
}).describe('Create a named scene without running it yet.'),
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
assistant.addTool(
|
|
157
|
+
'run_scene',
|
|
158
|
+
async (args: { id: string }) => runScene(args.id),
|
|
159
|
+
z.object({
|
|
160
|
+
id: z.string().describe('Scene id to run'),
|
|
161
|
+
}).describe('Run a specific scene by its id.'),
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
assistant.addTool(
|
|
165
|
+
'run_all',
|
|
166
|
+
async () => {
|
|
167
|
+
const ids = (stage.state.get('sceneIds') || []) as string[]
|
|
168
|
+
const results: any[] = []
|
|
169
|
+
for (const id of ids) results.push({ id, ...(await runScene(id)) })
|
|
170
|
+
return results
|
|
171
|
+
},
|
|
172
|
+
z.object({}).describe('Run every scene in order and return all results.'),
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
assistant.addTool(
|
|
176
|
+
'get_canvas',
|
|
177
|
+
async () => {
|
|
178
|
+
const activeId = stage.state.get('activeSceneId') as string | null
|
|
179
|
+
if (!activeId || !sceneMap[activeId]) return { status: 'empty', allScenes: [] }
|
|
180
|
+
const s = sceneMap[activeId]
|
|
181
|
+
return {
|
|
182
|
+
sceneId: activeId,
|
|
183
|
+
status: s.state.get('status'),
|
|
184
|
+
output: s.state.get('output'),
|
|
185
|
+
error: s.state.get('error'),
|
|
186
|
+
code: s.state.get('code'),
|
|
187
|
+
allScenes: stage.state.get('sceneIds'),
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
z.object({}).describe('Inspect the current canvas: active scene output, error, code, status.'),
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
assistant.addTool(
|
|
194
|
+
'activate_scene',
|
|
195
|
+
async (args: { id: string }) => {
|
|
196
|
+
if (!sceneMap[args.id]) return { error: `Scene "${args.id}" not found` }
|
|
197
|
+
stage.setState({ activeSceneId: args.id })
|
|
198
|
+
bumpStage()
|
|
199
|
+
return { activeSceneId: args.id }
|
|
200
|
+
},
|
|
201
|
+
z.object({
|
|
202
|
+
id: z.string().describe('Scene id to make active in the canvas'),
|
|
203
|
+
}).describe('Switch the canvas to display a different scene.'),
|
|
204
|
+
)
|
|
205
|
+
|
|
206
|
+
// ─── Ink App ─────────────────────────────────────────────────────────
|
|
207
|
+
|
|
208
|
+
type Msg = { role: 'user' | 'assistant' | 'system'; content: string }
|
|
209
|
+
|
|
210
|
+
function App() {
|
|
211
|
+
const [messages, setMessages] = useState<Msg[]>([])
|
|
212
|
+
const [input, setInput] = useState('')
|
|
213
|
+
const [streaming, setStreaming] = useState('')
|
|
214
|
+
const [thinking, setThinking] = useState(false)
|
|
215
|
+
const [activity, setActivity] = useState('')
|
|
216
|
+
const [canvas, setCanvas] = useState({ output: '', error: '', status: 'empty' })
|
|
217
|
+
const { exit } = useApp()
|
|
218
|
+
const { stdout } = useStdout()
|
|
219
|
+
const rows = stdout?.rows ?? 24
|
|
220
|
+
|
|
221
|
+
// --- assistant events ---
|
|
222
|
+
useEffect(() => {
|
|
223
|
+
const onPreview = (text: string) => setStreaming(text)
|
|
224
|
+
const onResponse = (text: string) => {
|
|
225
|
+
setStreaming('')
|
|
226
|
+
setThinking(false)
|
|
227
|
+
setActivity('')
|
|
228
|
+
setMessages(prev => [...prev, { role: 'assistant', content: text }])
|
|
229
|
+
}
|
|
230
|
+
const onToolCall = (name: string) => setActivity(`${name}`)
|
|
231
|
+
const onToolResult = () => setActivity('')
|
|
232
|
+
|
|
233
|
+
assistant.on('preview', onPreview)
|
|
234
|
+
assistant.on('response', onResponse)
|
|
235
|
+
assistant.on('toolCall', onToolCall)
|
|
236
|
+
assistant.on('toolResult', onToolResult)
|
|
237
|
+
return () => {
|
|
238
|
+
assistant.off('preview', onPreview)
|
|
239
|
+
assistant.off('response', onResponse)
|
|
240
|
+
assistant.off('toolCall', onToolCall)
|
|
241
|
+
assistant.off('toolResult', onToolResult)
|
|
242
|
+
}
|
|
243
|
+
}, [])
|
|
244
|
+
|
|
245
|
+
// --- stage entity ticks → canvas state ---
|
|
246
|
+
useEffect(() => {
|
|
247
|
+
const unsub = stage.state.observe((_changeType: any, key: any) => {
|
|
248
|
+
if (key !== 'tick') return
|
|
249
|
+
const activeId = stage.state.get('activeSceneId') as string | null
|
|
250
|
+
if (!activeId || !sceneMap[activeId]) {
|
|
251
|
+
setCanvas({ output: '', error: '', status: 'empty' })
|
|
252
|
+
return
|
|
253
|
+
}
|
|
254
|
+
const s = sceneMap[activeId]
|
|
255
|
+
setCanvas({
|
|
256
|
+
output: (s.state.get('output') || '') as string,
|
|
257
|
+
error: (s.state.get('error') || '') as string,
|
|
258
|
+
status: (s.state.get('status') || 'idle') as string,
|
|
259
|
+
})
|
|
260
|
+
})
|
|
261
|
+
return unsub
|
|
262
|
+
}, [])
|
|
263
|
+
|
|
264
|
+
// --- keyboard ---
|
|
265
|
+
useInput((ch, key) => {
|
|
266
|
+
if (key.escape) { exit(); return }
|
|
267
|
+
|
|
268
|
+
if (key.return) {
|
|
269
|
+
if (thinking) return
|
|
270
|
+
const msg = input.trim()
|
|
271
|
+
if (!msg) return
|
|
272
|
+
setInput('')
|
|
273
|
+
setMessages(prev => [...prev, { role: 'user', content: msg }])
|
|
274
|
+
setThinking(true)
|
|
275
|
+
assistant.ask(msg).catch((err: any) => {
|
|
276
|
+
setMessages(prev => [...prev, { role: 'system', content: `error: ${err.message}` }])
|
|
277
|
+
setThinking(false)
|
|
278
|
+
})
|
|
279
|
+
return
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
if (key.backspace || key.delete) {
|
|
283
|
+
setInput(prev => prev.slice(0, -1))
|
|
284
|
+
return
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
if (ch && !key.ctrl && !key.meta) {
|
|
288
|
+
setInput(prev => prev + ch)
|
|
289
|
+
}
|
|
290
|
+
})
|
|
291
|
+
|
|
292
|
+
// --- render ---
|
|
293
|
+
const visible = messages.slice(-30)
|
|
294
|
+
const sceneIds = (stage.state.get('sceneIds') || []) as string[]
|
|
295
|
+
const activeId = (stage.state.get('activeSceneId') || '') as string
|
|
296
|
+
|
|
297
|
+
const chatChildren: any[] = []
|
|
298
|
+
|
|
299
|
+
visible.forEach((m, i) => {
|
|
300
|
+
const color = m.role === 'user' ? 'green' : m.role === 'system' ? 'red' : 'white'
|
|
301
|
+
const prefix = m.role === 'user' ? '> ' : ' '
|
|
302
|
+
chatChildren.push(h(Text, { key: `msg-${i}`, wrap: 'wrap', color }, `${prefix}${m.content}`))
|
|
303
|
+
})
|
|
304
|
+
|
|
305
|
+
if (streaming) chatChildren.push(h(Text, { key: 'chat-stream', wrap: 'wrap', dimColor: true }, ` ${streaming}`))
|
|
306
|
+
if (thinking && !streaming) chatChildren.push(h(Text, { key: 'chat-think', color: 'yellow' }, ' thinking...'))
|
|
307
|
+
if (activity) chatChildren.push(h(Text, { key: 'chat-act', color: 'blue' }, ` [${activity}]`))
|
|
308
|
+
|
|
309
|
+
const canvasBody = canvas.output
|
|
310
|
+
? h(Text, { key: 'cvs-out', wrap: 'wrap' }, canvas.output)
|
|
311
|
+
: canvas.status === 'empty'
|
|
312
|
+
? h(Text, { key: 'cvs-empty', dimColor: true }, ' ask inkbot to draw something')
|
|
313
|
+
: null
|
|
314
|
+
|
|
315
|
+
// border + header + status = 4 rows overhead per panel
|
|
316
|
+
const panelHeight = rows - 2
|
|
317
|
+
|
|
318
|
+
return h(Box, { flexDirection: 'row', width: '100%', height: rows },
|
|
319
|
+
// ── Chat ──
|
|
320
|
+
h(Box, { key: 'chat', flexDirection: 'column', width: '50%', height: rows, borderStyle: 'round', borderColor: 'cyan', paddingX: 1 },
|
|
321
|
+
h(Text, { bold: true, color: 'cyan' }, ' inkbot '),
|
|
322
|
+
h(Box, { flexDirection: 'column', flexGrow: 1, overflow: 'hidden' }, ...chatChildren),
|
|
323
|
+
h(Box, { borderStyle: 'single', borderColor: 'gray', paddingX: 1 },
|
|
324
|
+
h(Text, { color: 'green' }, '> '),
|
|
325
|
+
h(Text, null, input),
|
|
326
|
+
h(Text, { dimColor: true }, '\u2588'),
|
|
327
|
+
),
|
|
328
|
+
),
|
|
329
|
+
// ── Canvas ──
|
|
330
|
+
h(Box, { key: 'canvas', flexDirection: 'column', width: '50%', height: rows, borderStyle: 'round', borderColor: 'magenta', paddingX: 1 },
|
|
331
|
+
h(Text, { bold: true, color: 'magenta' }, ' canvas '),
|
|
332
|
+
h(Box, { flexDirection: 'column', height: panelHeight - 4, overflow: 'hidden' },
|
|
333
|
+
canvasBody,
|
|
334
|
+
canvas.error ? h(Text, { key: 'cvs-err', color: 'red', wrap: 'wrap' }, canvas.error) : null,
|
|
335
|
+
),
|
|
336
|
+
h(Box, null,
|
|
337
|
+
h(Text, { dimColor: true }, ` ${canvas.status}`),
|
|
338
|
+
sceneIds.length > 1 ? h(Text, { dimColor: true }, ` scenes: ${sceneIds.join(', ')} active: ${activeId}`) : null,
|
|
339
|
+
),
|
|
340
|
+
),
|
|
341
|
+
)
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
// Mount and hold
|
|
345
|
+
await ink.render(h(App))
|
|
346
|
+
await ink.waitUntilExit()
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
export default {
|
|
350
|
+
description: 'Launch the Inkbot split-pane assistant with a live canvas.',
|
|
351
|
+
argsSchema,
|
|
352
|
+
handler: inkbot,
|
|
353
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { ContainerState } from '../container';
|
|
2
|
+
import { type NodeFeatures, NodeContainer } from '../node/container';
|
|
3
|
+
import '@/introspection/generated.agi.js';
|
|
4
|
+
import { OpenAIClient } from '../clients/openai';
|
|
5
|
+
import { ElevenLabsClient } from '../clients/elevenlabs';
|
|
6
|
+
import { ClaudeCode } from './features/claude-code';
|
|
7
|
+
import { OpenAICodex } from './features/openai-codex';
|
|
8
|
+
import { Conversation } from './features/conversation';
|
|
9
|
+
import { ConversationHistory } from './features/conversation-history';
|
|
10
|
+
import { Assistant } from './features/assistant';
|
|
11
|
+
import { AssistantsManager } from './features/assistants-manager';
|
|
12
|
+
import { DocsReader } from './features/docs-reader';
|
|
13
|
+
import { SkillsLibrary } from './features/skills-library';
|
|
14
|
+
import { BrowserUse } from './features/browser-use';
|
|
15
|
+
import { SemanticSearch } from '@soederpop/luca/node/features/semantic-search';
|
|
16
|
+
import { ContentDb } from '@soederpop/luca/node/features/content-db';
|
|
17
|
+
import { FileTools } from './features/file-tools';
|
|
18
|
+
import { LucaCoder } from './features/luca-coder';
|
|
19
|
+
import type { ConversationTool } from './features/conversation';
|
|
20
|
+
import type { ZodType } from 'zod';
|
|
21
|
+
export { ClaudeCode, OpenAICodex, Conversation, ConversationHistory, Assistant, AssistantsManager, DocsReader, SkillsLibrary, BrowserUse, FileTools, LucaCoder, SemanticSearch, ContentDb, NodeContainer, OpenAIClient, ElevenLabsClient, };
|
|
22
|
+
export type { ConversationTool, ZodType, ContainerState, NodeFeatures, };
|
|
23
|
+
export interface AGIFeatures extends NodeFeatures {
|
|
24
|
+
conversation: typeof Conversation;
|
|
25
|
+
claudeCode: typeof ClaudeCode;
|
|
26
|
+
openaiCodex: typeof OpenAICodex;
|
|
27
|
+
conversationHistory: typeof ConversationHistory;
|
|
28
|
+
assistant: typeof Assistant;
|
|
29
|
+
assistantsManager: typeof AssistantsManager;
|
|
30
|
+
docsReader: typeof DocsReader;
|
|
31
|
+
skillsLibrary: typeof SkillsLibrary;
|
|
32
|
+
browserUse: typeof BrowserUse;
|
|
33
|
+
fileTools: typeof FileTools;
|
|
34
|
+
lucaCoder: typeof LucaCoder;
|
|
35
|
+
}
|
|
36
|
+
export interface ConversationFactoryOptions {
|
|
37
|
+
tools?: {
|
|
38
|
+
handlers: Record<string, ConversationTool['handler']>;
|
|
39
|
+
schemas: Record<string, ZodType>;
|
|
40
|
+
};
|
|
41
|
+
systemPrompt?: string;
|
|
42
|
+
model?: string;
|
|
43
|
+
id?: string;
|
|
44
|
+
title?: string;
|
|
45
|
+
thread?: string;
|
|
46
|
+
tags?: string[];
|
|
47
|
+
metadata?: Record<string, any>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* AGI-specific container that extends NodeContainer with AI capabilities including
|
|
51
|
+
* OpenAI conversations, code generation, and self-modifying agent features.
|
|
52
|
+
*/
|
|
53
|
+
export declare class AGIContainer<Features extends AGIFeatures = AGIFeatures, K extends ContainerState = ContainerState> extends NodeContainer<Features, K> {
|
|
54
|
+
openai: OpenAIClient;
|
|
55
|
+
claudeCode?: ClaudeCode;
|
|
56
|
+
openaiCodex?: OpenAICodex;
|
|
57
|
+
conversationHistory?: ConversationHistory;
|
|
58
|
+
docs: ContentDb;
|
|
59
|
+
conversation(options?: ConversationFactoryOptions): Promise<InstanceType<Features["conversation"]>>;
|
|
60
|
+
}
|
|
61
|
+
declare const container: any;
|
|
62
|
+
export default container;
|
|
63
|
+
//# sourceMappingURL=container.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.server.d.ts","sourceRoot":"","sources":["../../src/agi/container.server.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { EndpointContext } from '../../endpoint.js';
|
|
3
|
+
export declare const path = "/ask";
|
|
4
|
+
export declare const description = "Ask the AGI container a question";
|
|
5
|
+
export declare const tags: string[];
|
|
6
|
+
export declare const postSchema: z.ZodObject<{
|
|
7
|
+
question: z.ZodString;
|
|
8
|
+
context: z.ZodOptional<z.ZodString>;
|
|
9
|
+
stream: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
10
|
+
}, z.core.$strip>;
|
|
11
|
+
export declare function post(parameters: z.infer<typeof postSchema>, ctx: EndpointContext): Promise<{
|
|
12
|
+
answer: any;
|
|
13
|
+
} | undefined>;
|
|
14
|
+
export declare const getSchema: z.ZodObject<{
|
|
15
|
+
question: z.ZodString;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
export declare function get(parameters: z.infer<typeof getSchema>, ctx: EndpointContext): Promise<{
|
|
18
|
+
answer: any;
|
|
19
|
+
}>;
|
|
20
|
+
//# sourceMappingURL=ask.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ask.d.ts","sourceRoot":"","sources":["../../../src/agi/endpoints/ask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAExD,eAAO,MAAM,IAAI,SAAS,CAAA;AAC1B,eAAO,MAAM,WAAW,qCAAqC,CAAA;AAC7D,eAAO,MAAM,IAAI,UAAU,CAAA;AAE3B,eAAO,MAAM,UAAU;;;;iBAIrB,CAAA;AAEF,wBAAsB,IAAI,CACxB,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,EACtC,GAAG,EAAE,eAAe;;eA+BrB;AAED,eAAO,MAAM,SAAS;;iBAEpB,CAAA;AAEF,wBAAsB,GAAG,CACvB,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,EACrC,GAAG,EAAE,eAAe;;GAKrB"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { EndpointContext } from '../../../endpoint.js';
|
|
3
|
+
export declare const path = "/api/conversations/:id";
|
|
4
|
+
export declare const description = "Get or delete a specific conversation";
|
|
5
|
+
export declare const tags: string[];
|
|
6
|
+
export declare const getSchema: z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
}, z.core.$strip>;
|
|
9
|
+
export declare function get(parameters: z.infer<typeof getSchema>, ctx: EndpointContext): Promise<{
|
|
10
|
+
error: string;
|
|
11
|
+
conversation?: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
conversation: any;
|
|
14
|
+
error?: undefined;
|
|
15
|
+
}>;
|
|
16
|
+
export declare const deleteSchema: z.ZodObject<{
|
|
17
|
+
id: z.ZodString;
|
|
18
|
+
}, z.core.$strip>;
|
|
19
|
+
export declare function del(parameters: z.infer<typeof deleteSchema>, ctx: EndpointContext): Promise<{
|
|
20
|
+
error: string;
|
|
21
|
+
deleted?: undefined;
|
|
22
|
+
} | {
|
|
23
|
+
deleted: boolean;
|
|
24
|
+
error?: undefined;
|
|
25
|
+
}>;
|
|
26
|
+
export { del as delete };
|
|
27
|
+
//# sourceMappingURL=%5Bid%5D.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"[id].d.ts","sourceRoot":"","sources":["../../../../src/agi/endpoints/conversations/[id].ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAE3D,eAAO,MAAM,IAAI,2BAA2B,CAAA;AAC5C,eAAO,MAAM,WAAW,0CAA0C,CAAA;AAClE,eAAO,MAAM,IAAI,UAAoB,CAAA;AAErC,eAAO,MAAM,SAAS;;iBAEpB,CAAA;AAEF,wBAAsB,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,EAAE,GAAG,EAAE,eAAe;;;;;;GAYpF;AAED,eAAO,MAAM,YAAY;;iBAEvB,CAAA;AAEF,wBAAsB,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,EAAE,GAAG,EAAE,eAAe;;;;;;GAYvF;AAGD,OAAO,EAAE,GAAG,IAAI,MAAM,EAAE,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { EndpointContext } from '../../endpoint.js';
|
|
3
|
+
export declare const path = "/api/conversations";
|
|
4
|
+
export declare const description = "List and search saved conversations";
|
|
5
|
+
export declare const tags: string[];
|
|
6
|
+
export declare const getSchema: z.ZodObject<{
|
|
7
|
+
tag: z.ZodOptional<z.ZodString>;
|
|
8
|
+
thread: z.ZodOptional<z.ZodString>;
|
|
9
|
+
model: z.ZodOptional<z.ZodString>;
|
|
10
|
+
query: z.ZodOptional<z.ZodString>;
|
|
11
|
+
expert: z.ZodOptional<z.ZodString>;
|
|
12
|
+
limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
13
|
+
offset: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
|
|
14
|
+
}, z.core.$strip>;
|
|
15
|
+
export declare function get(parameters: z.infer<typeof getSchema>, ctx: EndpointContext): Promise<{
|
|
16
|
+
conversations: any;
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=conversations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conversations.d.ts","sourceRoot":"","sources":["../../../src/agi/endpoints/conversations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAExD,eAAO,MAAM,IAAI,uBAAuB,CAAA;AACxC,eAAO,MAAM,WAAW,wCAAwC,CAAA;AAChE,eAAO,MAAM,IAAI,UAAoB,CAAA;AAErC,eAAO,MAAM,SAAS;;;;;;;;iBAQpB,CAAA;AAEF,wBAAsB,GAAG,CAAC,UAAU,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,SAAS,CAAC,EAAE,GAAG,EAAE,eAAe;;GAapF"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { EndpointContext } from '../../endpoint.js';
|
|
2
|
+
export declare const path = "/api/experts";
|
|
3
|
+
export declare const description = "List all available experts with their descriptions";
|
|
4
|
+
export declare const tags: string[];
|
|
5
|
+
export declare function get(_parameters: any, ctx: EndpointContext): Promise<{
|
|
6
|
+
experts: any[];
|
|
7
|
+
}>;
|
|
8
|
+
//# sourceMappingURL=experts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"experts.d.ts","sourceRoot":"","sources":["../../../src/agi/endpoints/experts.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AAExD,eAAO,MAAM,IAAI,iBAAiB,CAAA;AAClC,eAAO,MAAM,WAAW,uDAAuD,CAAA;AAC/E,eAAO,MAAM,IAAI,UAAc,CAAA;AAE/B,wBAAsB,GAAG,CAAC,WAAW,EAAE,GAAG,EAAE,GAAG,EAAE,eAAe;;GA6B/D"}
|