luca 3.0.0 → 3.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/.github/workflows/release.yaml +1 -0
- package/CLAUDE.md +10 -2
- package/README.md +130 -112
- package/assistants/codingAssistant/CORE.md +6 -1
- package/assistants/codingAssistant/hooks.ts +1 -1
- package/assistants/inkbot/hooks.ts +1 -1
- package/assistants/inkbot/tools.ts +1 -1
- package/bun.lock +264 -321
- package/commands/audit-docs.ts +2 -2
- package/commands/build-bootstrap.ts +2 -3
- package/commands/build-python-bridge.ts +2 -3
- package/commands/build-scaffolds.ts +2 -3
- package/commands/bundle-consumer-project.ts +521 -0
- package/commands/generate-api-docs.ts +2 -2
- package/commands/inkbot.ts +2 -2
- package/commands/release.ts +2 -2
- package/commands/social.ts +137 -0
- package/commands/try-all-challenges.ts +3 -3
- package/commands/try-challenge.ts +3 -3
- package/datasets/lora/agentic-loop-session-candidates.jsonl +91 -0
- package/datasets/lora/agentic-loop-session-curation-summary.json +123 -0
- package/datasets/lora/luca-session-candidates.jsonl +29 -0
- package/datasets/lora/luca-session-curation-summary.json +121 -0
- package/datasets/lora/review-batch-1.jsonl +30 -0
- package/datasets/lora/review-manifest.json +41 -0
- package/datasets/lora/review-queue.jsonl +120 -0
- package/datasets/lora/review-schema.json +134 -0
- package/datasets/lora/review-template.jsonl +2 -0
- package/datasets/lora/review-ui.html +725 -0
- package/dist/agi/container.server.d.ts +2 -2
- package/dist/agi/features/assistant.d.ts +2 -2
- package/dist/agi/features/assistants-manager.d.ts +1 -1
- package/dist/agi/features/autonomous-assistant.d.ts +1 -1
- package/dist/agi/features/browser-use.d.ts +1 -1
- package/dist/agi/features/claude-code.d.ts +1 -1
- package/dist/agi/features/conversation-history.d.ts +2 -2
- package/dist/agi/features/conversation.d.ts +1 -1
- package/dist/agi/features/docs-reader.d.ts +1 -1
- package/dist/agi/features/file-tools.d.ts +1 -1
- package/dist/agi/features/luca-coder.d.ts +1 -1
- package/dist/agi/features/openai-codex.d.ts +1 -1
- package/dist/agi/features/skills-library.d.ts +1 -1
- package/dist/clients/civitai/index.d.ts +4 -4
- package/dist/clients/client-template.d.ts +4 -4
- package/dist/clients/comfyui/index.d.ts +2 -2
- package/dist/clients/elevenlabs/index.d.ts +2 -2
- package/dist/clients/openai/index.d.ts +2 -2
- package/dist/clients/supabase/index.d.ts +3 -3
- package/dist/command.d.ts +1 -1
- package/dist/node/container.d.ts +1 -1
- package/dist/node/features/helpers.d.ts +3 -3
- package/dist/node/features/semantic-search.d.ts +1 -1
- package/dist/node/features/vm.d.ts +3 -3
- package/dist/node.d.ts +1 -1
- package/dist/scaffolds/generated.d.ts +1 -1
- package/dist/selector.d.ts +1 -1
- package/features/cipher-social.ts +493 -0
- package/index.html +217 -190
- package/luca.console.ts +1 -1
- package/package.json +7 -2
- package/public/index.html +217 -190
- package/public/slides-ai-native.html +1 -1
- package/public/slides-intro.html +2 -2
- package/scripts/curate-claude-sessions.ts +561 -0
- package/scripts/examples/ask-luca-expert.ts +1 -1
- package/scripts/examples/assistant-questions.ts +1 -1
- package/scripts/examples/excalidraw-expert.ts +1 -1
- package/scripts/examples/file-manager.ts +1 -1
- package/scripts/examples/ideas.ts +1 -1
- package/scripts/examples/interactive-chat.ts +1 -1
- package/scripts/examples/opening-a-web-browser.ts +1 -1
- package/scripts/examples/telegram-bot.ts +1 -1
- package/scripts/examples/using-assistant-with-mcp.ts +1 -1
- package/scripts/examples/using-claude-code.ts +1 -1
- package/scripts/examples/using-contentdb.ts +2 -2
- package/scripts/examples/using-conversations.ts +1 -1
- package/scripts/examples/using-disk-cache.ts +1 -1
- package/scripts/examples/using-docker-shell.ts +1 -1
- package/scripts/examples/using-elevenlabs.ts +1 -1
- package/scripts/examples/using-google-calendar.ts +1 -1
- package/scripts/examples/using-google-docs.ts +1 -1
- package/scripts/examples/using-google-drive.ts +1 -1
- package/scripts/examples/using-google-sheets.ts +1 -1
- package/scripts/examples/using-nlp.ts +1 -1
- package/scripts/examples/using-ollama.ts +1 -1
- package/scripts/examples/using-postgres.ts +1 -1
- package/scripts/examples/using-runpod.ts +1 -1
- package/scripts/examples/using-tts.ts +1 -1
- package/scripts/scaffold.ts +5 -5
- package/scripts/scratch.ts +1 -1
- package/scripts/test-assistant-hooks.ts +1 -1
- package/scripts/test-docs-reader.ts +1 -1
- package/src/agi/container.server.ts +6 -2
- package/src/agi/features/agent-memory.ts +25 -25
- package/src/agi/features/assistant.ts +34 -5
- package/src/agi/features/assistants-manager.ts +122 -6
- package/src/agi/features/autonomous-assistant.ts +1 -1
- package/src/agi/features/browser-use.ts +20 -1
- package/src/agi/features/claude-code.ts +51 -5
- package/src/agi/features/coding-tools.ts +1 -1
- package/src/agi/features/conversation-history.ts +181 -4
- package/src/agi/features/conversation.ts +186 -15
- package/src/agi/features/docs-reader.ts +2 -2
- package/src/agi/features/file-tools.ts +49 -2
- package/src/agi/features/luca-coder.ts +7 -5
- package/src/agi/features/mcp-bridge.ts +532 -0
- package/src/agi/features/openai-codex.ts +2 -2
- package/src/agi/features/skills-library.ts +131 -52
- package/src/agi/lib/token-counter.ts +80 -0
- package/src/bootstrap/generated.ts +56 -57
- package/src/browser.ts +1 -1
- package/src/cli/build-info.ts +2 -2
- package/src/cli/cli.ts +2 -2
- package/src/clients/civitai/index.ts +5 -5
- package/src/clients/client-template.ts +4 -4
- package/src/clients/comfyui/index.ts +4 -4
- package/src/clients/elevenlabs/index.ts +4 -4
- package/src/clients/openai/index.ts +7 -7
- package/src/clients/supabase/index.ts +4 -4
- package/src/clients/voicebox/index.ts +4 -4
- package/src/command.ts +2 -1
- package/src/commands/chat.ts +1 -0
- package/src/commands/eval.ts +2 -56
- package/src/commands/introspect.ts +1 -1
- package/src/commands/prompt.ts +41 -9
- package/src/container-describer.ts +8 -1
- package/src/container.ts +13 -0
- package/src/entity.ts +2 -2
- package/src/helper.ts +1 -1
- package/src/introspection/generated.agi.ts +29596 -27654
- package/src/introspection/generated.node.ts +20284 -19247
- package/src/introspection/generated.web.ts +605 -584
- package/src/introspection/scan.ts +11 -6
- package/src/node/container.ts +9 -1
- package/src/node/features/content-db.ts +39 -2
- package/src/node/features/display-result.ts +57 -0
- package/src/node/features/helpers.ts +46 -7
- package/src/node/features/python.ts +25 -19
- package/src/node/features/repl.ts +1 -1
- package/src/node/features/secure-shell.ts +11 -17
- package/src/node/features/semantic-search.ts +2 -2
- package/src/node/features/socket-repl.ts +336 -0
- package/src/node/features/telnyx-assistant-connector.ts +1206 -0
- package/src/node/features/transpiler.ts +2 -3
- package/src/node/features/ui.ts +5 -0
- package/src/node/features/vm.ts +20 -3
- package/src/node.ts +3 -3
- package/src/python/generated.ts +0 -1
- package/src/scaffolds/generated.ts +82 -83
- package/src/selector.ts +1 -1
- package/src/servers/express.ts +1 -1
- package/src/web/features/helpers.ts +22 -0
- package/tsconfig.json +12 -12
- package/docs/CLI.md +0 -335
- package/docs/CNAME +0 -1
- package/docs/README.md +0 -60
- package/docs/TABLE-OF-CONTENTS.md +0 -183
- package/docs/apis/clients/elevenlabs.md +0 -308
- package/docs/apis/clients/graph.md +0 -107
- package/docs/apis/clients/openai.md +0 -429
- package/docs/apis/clients/rest.md +0 -161
- package/docs/apis/clients/websocket.md +0 -174
- package/docs/apis/features/agi/assistant.md +0 -625
- package/docs/apis/features/agi/assistants-manager.md +0 -282
- package/docs/apis/features/agi/auto-assistant.md +0 -279
- package/docs/apis/features/agi/browser-use.md +0 -802
- package/docs/apis/features/agi/claude-code.md +0 -884
- package/docs/apis/features/agi/conversation-history.md +0 -364
- package/docs/apis/features/agi/conversation.md +0 -548
- package/docs/apis/features/agi/docs-reader.md +0 -99
- package/docs/apis/features/agi/file-tools.md +0 -163
- package/docs/apis/features/agi/luca-coder.md +0 -407
- package/docs/apis/features/agi/openai-codex.md +0 -396
- package/docs/apis/features/agi/openapi.md +0 -138
- package/docs/apis/features/agi/semantic-search.md +0 -387
- package/docs/apis/features/agi/skills-library.md +0 -239
- package/docs/apis/features/node/container-link.md +0 -192
- package/docs/apis/features/node/content-db.md +0 -450
- package/docs/apis/features/node/disk-cache.md +0 -379
- package/docs/apis/features/node/dns.md +0 -652
- package/docs/apis/features/node/docker.md +0 -706
- package/docs/apis/features/node/downloader.md +0 -81
- package/docs/apis/features/node/esbuild.md +0 -60
- package/docs/apis/features/node/file-manager.md +0 -191
- package/docs/apis/features/node/fs.md +0 -1217
- package/docs/apis/features/node/git.md +0 -371
- package/docs/apis/features/node/google-auth.md +0 -193
- package/docs/apis/features/node/google-calendar.md +0 -202
- package/docs/apis/features/node/google-docs.md +0 -173
- package/docs/apis/features/node/google-drive.md +0 -246
- package/docs/apis/features/node/google-mail.md +0 -214
- package/docs/apis/features/node/google-sheets.md +0 -194
- package/docs/apis/features/node/grep.md +0 -292
- package/docs/apis/features/node/helpers.md +0 -164
- package/docs/apis/features/node/ink.md +0 -334
- package/docs/apis/features/node/ipc-socket.md +0 -249
- package/docs/apis/features/node/json-tree.md +0 -86
- package/docs/apis/features/node/networking.md +0 -316
- package/docs/apis/features/node/nlp.md +0 -133
- package/docs/apis/features/node/opener.md +0 -97
- package/docs/apis/features/node/os.md +0 -146
- package/docs/apis/features/node/package-finder.md +0 -392
- package/docs/apis/features/node/postgres.md +0 -234
- package/docs/apis/features/node/proc.md +0 -399
- package/docs/apis/features/node/process-manager.md +0 -305
- package/docs/apis/features/node/python.md +0 -604
- package/docs/apis/features/node/redis.md +0 -380
- package/docs/apis/features/node/repl.md +0 -88
- package/docs/apis/features/node/runpod.md +0 -674
- package/docs/apis/features/node/secure-shell.md +0 -176
- package/docs/apis/features/node/semantic-search.md +0 -408
- package/docs/apis/features/node/sqlite.md +0 -233
- package/docs/apis/features/node/telegram.md +0 -279
- package/docs/apis/features/node/transpiler.md +0 -74
- package/docs/apis/features/node/tts.md +0 -133
- package/docs/apis/features/node/ui.md +0 -701
- package/docs/apis/features/node/vault.md +0 -59
- package/docs/apis/features/node/vm.md +0 -75
- package/docs/apis/features/node/yaml-tree.md +0 -85
- package/docs/apis/features/node/yaml.md +0 -176
- package/docs/apis/features/web/asset-loader.md +0 -59
- package/docs/apis/features/web/container-link.md +0 -192
- package/docs/apis/features/web/esbuild.md +0 -54
- package/docs/apis/features/web/helpers.md +0 -164
- package/docs/apis/features/web/network.md +0 -44
- package/docs/apis/features/web/speech.md +0 -69
- package/docs/apis/features/web/vault.md +0 -59
- package/docs/apis/features/web/vm.md +0 -75
- package/docs/apis/features/web/voice.md +0 -84
- package/docs/apis/servers/express.md +0 -171
- package/docs/apis/servers/mcp.md +0 -238
- package/docs/apis/servers/websocket.md +0 -170
- package/docs/bootstrap/CLAUDE.md +0 -101
- package/docs/bootstrap/SKILL.md +0 -341
- package/docs/bootstrap/templates/about-command.ts +0 -41
- package/docs/bootstrap/templates/docs-models.ts +0 -22
- package/docs/bootstrap/templates/docs-readme.md +0 -43
- package/docs/bootstrap/templates/example-feature.ts +0 -53
- package/docs/bootstrap/templates/health-endpoint.ts +0 -15
- package/docs/bootstrap/templates/luca-cli.ts +0 -30
- package/docs/bootstrap/templates/runme.md +0 -54
- package/docs/challenges/caching-proxy.md +0 -16
- package/docs/challenges/content-db-round-trip.md +0 -14
- package/docs/challenges/custom-command.md +0 -9
- package/docs/challenges/file-watcher-pipeline.md +0 -11
- package/docs/challenges/grep-audit-report.md +0 -15
- package/docs/challenges/multi-feature-dashboard.md +0 -14
- package/docs/challenges/process-orchestrator.md +0 -17
- package/docs/challenges/rest-api-server-with-client.md +0 -12
- package/docs/challenges/script-runner-with-vm.md +0 -11
- package/docs/challenges/simple-rest-api.md +0 -15
- package/docs/challenges/websocket-serve-and-client.md +0 -11
- package/docs/challenges/yaml-config-system.md +0 -14
- package/docs/command-system-overhaul.md +0 -94
- package/docs/documentation-audit.md +0 -134
- package/docs/examples/assistant/CORE.md +0 -18
- package/docs/examples/assistant/hooks.ts +0 -3
- package/docs/examples/assistant/tools.ts +0 -10
- package/docs/examples/assistant-hooks-reference.ts +0 -171
- package/docs/examples/assistant-with-process-manager.md +0 -84
- package/docs/examples/content-db.md +0 -77
- package/docs/examples/disk-cache.md +0 -83
- package/docs/examples/docker.md +0 -101
- package/docs/examples/downloader.md +0 -70
- package/docs/examples/entity.md +0 -124
- package/docs/examples/esbuild.md +0 -80
- package/docs/examples/feature-as-tool-provider.md +0 -143
- package/docs/examples/file-manager.md +0 -82
- package/docs/examples/fs.md +0 -83
- package/docs/examples/git.md +0 -85
- package/docs/examples/google-auth.md +0 -88
- package/docs/examples/google-calendar.md +0 -94
- package/docs/examples/google-docs.md +0 -82
- package/docs/examples/google-drive.md +0 -96
- package/docs/examples/google-sheets.md +0 -95
- package/docs/examples/grep.md +0 -85
- package/docs/examples/ink-blocks.md +0 -75
- package/docs/examples/ink-renderer.md +0 -41
- package/docs/examples/ink.md +0 -103
- package/docs/examples/ipc-socket.md +0 -103
- package/docs/examples/json-tree.md +0 -91
- package/docs/examples/networking.md +0 -58
- package/docs/examples/nlp.md +0 -91
- package/docs/examples/opener.md +0 -78
- package/docs/examples/os.md +0 -72
- package/docs/examples/package-finder.md +0 -89
- package/docs/examples/postgres.md +0 -91
- package/docs/examples/proc.md +0 -81
- package/docs/examples/process-manager.md +0 -79
- package/docs/examples/python.md +0 -132
- package/docs/examples/repl.md +0 -93
- package/docs/examples/runpod.md +0 -119
- package/docs/examples/secure-shell.md +0 -92
- package/docs/examples/sqlite.md +0 -86
- package/docs/examples/structured-output-with-assistants.md +0 -144
- package/docs/examples/telegram.md +0 -77
- package/docs/examples/tts.md +0 -86
- package/docs/examples/ui.md +0 -80
- package/docs/examples/vault.md +0 -70
- package/docs/examples/vm.md +0 -86
- package/docs/examples/websocket-ask-and-reply-example.md +0 -128
- package/docs/examples/yaml-tree.md +0 -93
- package/docs/examples/yaml.md +0 -104
- package/docs/ideas/assistant-factory-pattern.md +0 -142
- package/docs/in-memory-fs.md +0 -4
- package/docs/introspection-audit.md +0 -49
- package/docs/introspection.md +0 -164
- package/docs/mcp/readme.md +0 -162
- package/docs/models.ts +0 -41
- package/docs/philosophy.md +0 -86
- package/docs/principles.md +0 -7
- package/docs/prompts/audit-codebase-for-failures-to-use-the-container.md +0 -34
- package/docs/prompts/check-for-undocumented-features.md +0 -27
- package/docs/prompts/mcp-test-easy-command.md +0 -27
- package/docs/scaffolds/client.md +0 -149
- package/docs/scaffolds/command.md +0 -120
- package/docs/scaffolds/endpoint.md +0 -171
- package/docs/scaffolds/feature.md +0 -158
- package/docs/scaffolds/selector.md +0 -91
- package/docs/scaffolds/server.md +0 -196
- package/docs/selectors.md +0 -115
- package/docs/sessions/custom-command/attempt-log-2.md +0 -195
- package/docs/sessions/file-watcher-pipeline/attempt-log-1.md +0 -728
- package/docs/sessions/file-watcher-pipeline/attempt-log-2.md +0 -555
- package/docs/sessions/grep-audit-report/attempt-log-1.md +0 -289
- package/docs/sessions/multi-feature-dashboard/attempt-log-2.md +0 -679
- package/docs/sessions/rest-api-server-with-client/attempt-log-1.md +0 -1
- package/docs/sessions/rest-api-server-with-client/attempt-log-3.md +0 -920
- package/docs/sessions/simple-rest-api/attempt-log-1.md +0 -593
- package/docs/sessions/websocket-serve-and-client/attempt-log-2.md +0 -995
- package/docs/tutorials/00-bootstrap.md +0 -166
- package/docs/tutorials/01-getting-started.md +0 -106
- package/docs/tutorials/02-container.md +0 -210
- package/docs/tutorials/03-scripts.md +0 -194
- package/docs/tutorials/04-features-overview.md +0 -196
- package/docs/tutorials/05-state-and-events.md +0 -171
- package/docs/tutorials/06-servers.md +0 -157
- package/docs/tutorials/07-endpoints.md +0 -198
- package/docs/tutorials/08-commands.md +0 -252
- package/docs/tutorials/09-clients.md +0 -162
- package/docs/tutorials/10-creating-features.md +0 -203
- package/docs/tutorials/11-contentbase.md +0 -191
- package/docs/tutorials/12-assistants.md +0 -215
- package/docs/tutorials/13-introspection.md +0 -157
- package/docs/tutorials/14-type-system.md +0 -174
- package/docs/tutorials/15-project-patterns.md +0 -222
- package/docs/tutorials/16-google-features.md +0 -534
- package/docs/tutorials/17-tui-blocks.md +0 -530
- package/docs/tutorials/18-semantic-search.md +0 -334
- package/docs/tutorials/19-python-sessions.md +0 -401
- package/docs/tutorials/20-browser-esm.md +0 -234
- package/index.ts +0 -1
- package/src/agi/endpoints/ask.ts +0 -60
- package/src/agi/endpoints/conversations/[id].ts +0 -45
- package/src/agi/endpoints/conversations.ts +0 -31
- package/src/agi/endpoints/experts.ts +0 -37
- package/test/assistant-hooks.test.ts +0 -306
- package/test/assistant.test.ts +0 -81
- package/test/bus.test.ts +0 -134
- package/test/clients-servers.test.ts +0 -217
- package/test/command.test.ts +0 -267
- package/test/container-link.test.ts +0 -274
- package/test/conversation.test.ts +0 -220
- package/test/features.test.ts +0 -160
- package/test/fork-and-research.test.ts +0 -450
- package/test/integration.test.ts +0 -787
- package/test/interceptor-chain.test.ts +0 -61
- package/test/node-container.test.ts +0 -121
- package/test/python-session.test.ts +0 -105
- package/test/rate-limit.test.ts +0 -272
- package/test/semantic-search.test.ts +0 -550
- package/test/state.test.ts +0 -121
- package/test/vm-context.test.ts +0 -146
- package/test/vm-loadmodule.test.ts +0 -213
- package/test/websocket-ask.test.ts +0 -101
- package/test-integration/assistant.test.ts +0 -138
- package/test-integration/assistants-manager.test.ts +0 -113
- package/test-integration/claude-code.test.ts +0 -98
- package/test-integration/conversation-history.test.ts +0 -205
- package/test-integration/conversation.test.ts +0 -137
- package/test-integration/elevenlabs.test.ts +0 -55
- package/test-integration/google-services.test.ts +0 -80
- package/test-integration/helpers.ts +0 -89
- package/test-integration/memory.test.ts +0 -204
- package/test-integration/openai-codex.test.ts +0 -93
- package/test-integration/runpod.test.ts +0 -58
- package/test-integration/server-endpoints.test.ts +0 -97
- package/test-integration/telegram.test.ts +0 -46
package/docs/examples/yaml.md
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "YAML"
|
|
3
|
-
tags: [yaml, parsing, serialization, config]
|
|
4
|
-
lastTested: null
|
|
5
|
-
lastTestPassed: null
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
# yaml
|
|
9
|
-
|
|
10
|
-
Parse YAML strings into JavaScript objects and serialize objects back to YAML. A thin wrapper around js-yaml.
|
|
11
|
-
|
|
12
|
-
## Overview
|
|
13
|
-
|
|
14
|
-
The `yaml` feature is on-demand. It provides two methods: `parse()` and `stringify()`. Use it any time you need to read or write YAML configuration files, convert between formats, or work with YAML data in memory.
|
|
15
|
-
|
|
16
|
-
## Parsing a YAML String
|
|
17
|
-
|
|
18
|
-
Start by enabling the feature and parsing some YAML.
|
|
19
|
-
|
|
20
|
-
```ts
|
|
21
|
-
const yml = container.feature('yaml')
|
|
22
|
-
const config = yml.parse(`
|
|
23
|
-
name: my-app
|
|
24
|
-
version: 2.1.0
|
|
25
|
-
database:
|
|
26
|
-
host: localhost
|
|
27
|
-
port: 5432
|
|
28
|
-
features:
|
|
29
|
-
- auth
|
|
30
|
-
- logging
|
|
31
|
-
- caching
|
|
32
|
-
`)
|
|
33
|
-
console.log('Parsed name:', config.name)
|
|
34
|
-
console.log('Parsed db host:', config.database.host)
|
|
35
|
-
console.log('Parsed features:', config.features)
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
The parser handles nested objects, arrays, numbers, and booleans automatically.
|
|
39
|
-
|
|
40
|
-
## Serializing an Object to YAML
|
|
41
|
-
|
|
42
|
-
Use `stringify()` to convert a JavaScript object into a YAML-formatted string.
|
|
43
|
-
|
|
44
|
-
```ts
|
|
45
|
-
const output = yml.stringify({
|
|
46
|
-
server: { host: '0.0.0.0', port: 3000 },
|
|
47
|
-
logging: { level: 'info', pretty: true },
|
|
48
|
-
cors: { origins: ['https://example.com', 'https://app.example.com'] }
|
|
49
|
-
})
|
|
50
|
-
console.log('YAML output:')
|
|
51
|
-
console.log(output)
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
The output is human-readable and suitable for writing to configuration files.
|
|
55
|
-
|
|
56
|
-
## Round-Trip Conversion
|
|
57
|
-
|
|
58
|
-
A common pattern is reading YAML, modifying data, and writing it back. Here we verify that a round-trip preserves data.
|
|
59
|
-
|
|
60
|
-
```ts
|
|
61
|
-
const original = `
|
|
62
|
-
environment: production
|
|
63
|
-
replicas: 3
|
|
64
|
-
resources:
|
|
65
|
-
cpu: 500m
|
|
66
|
-
memory: 256Mi
|
|
67
|
-
`
|
|
68
|
-
const parsed = yml.parse(original)
|
|
69
|
-
parsed.replicas = 5
|
|
70
|
-
parsed.resources.memory = '512Mi'
|
|
71
|
-
const updated = yml.stringify(parsed)
|
|
72
|
-
console.log('Updated YAML:')
|
|
73
|
-
console.log(updated)
|
|
74
|
-
const reparsed = yml.parse(updated)
|
|
75
|
-
console.log('Replicas after round-trip:', reparsed.replicas)
|
|
76
|
-
console.log('Memory after round-trip:', reparsed.resources.memory)
|
|
77
|
-
```
|
|
78
|
-
|
|
79
|
-
The data survives the parse-modify-stringify cycle intact.
|
|
80
|
-
|
|
81
|
-
## Working with Complex Structures
|
|
82
|
-
|
|
83
|
-
YAML handles deeply nested and mixed-type structures well.
|
|
84
|
-
|
|
85
|
-
```ts
|
|
86
|
-
const complex = yml.stringify({
|
|
87
|
-
users: [
|
|
88
|
-
{ name: 'Alice', roles: ['admin', 'editor'], active: true },
|
|
89
|
-
{ name: 'Bob', roles: ['viewer'], active: false },
|
|
90
|
-
],
|
|
91
|
-
settings: {
|
|
92
|
-
maxRetries: 3,
|
|
93
|
-
timeout: null,
|
|
94
|
-
nested: { deep: { value: 42 } }
|
|
95
|
-
}
|
|
96
|
-
})
|
|
97
|
-
console.log(complex)
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
Nulls, booleans, numbers, and nested arrays all serialize cleanly.
|
|
101
|
-
|
|
102
|
-
## Summary
|
|
103
|
-
|
|
104
|
-
This demo covered parsing YAML strings, serializing objects to YAML, round-trip conversion, and handling complex nested structures. The `yaml` feature gives you a clean two-method API for all YAML operations.
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: Assistant Factory Pattern — Eliminate Wrapper Duplication
|
|
3
|
-
status: idea
|
|
4
|
-
tags: [agi, assistant, refactor, lucaCoder, autonomousAssistant]
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Assistant Factory Pattern
|
|
8
|
-
|
|
9
|
-
## Problem
|
|
10
|
-
|
|
11
|
-
`LucaCoder` and `AutonomousAssistant` both duplicate the same pattern: create an inner `Assistant`, stack tool bundles, wire a permission interceptor, forward events. The permission system, approval flow, and event forwarding are copy-pasted between them. `LucaCoder` is just `AutonomousAssistant` + coding opinions (bash tool, skill loading, project instructions).
|
|
12
|
-
|
|
13
|
-
Both features **wrap** an assistant rather than **composing** one. This means every method on `Assistant` (ask, tools, messages, conversation) has to be proxied through the wrapper.
|
|
14
|
-
|
|
15
|
-
## Proposal
|
|
16
|
-
|
|
17
|
-
### 1. Extract the permission layer into a `use()`-able plugin
|
|
18
|
-
|
|
19
|
-
The permission system (allow/ask/deny per tool, pending approvals, approval history) is just a `beforeToolCall` interceptor. It doesn't need to be a feature — it's a plugin function.
|
|
20
|
-
|
|
21
|
-
```typescript
|
|
22
|
-
import type { Assistant } from './assistant'
|
|
23
|
-
|
|
24
|
-
interface PermissionConfig {
|
|
25
|
-
permissions?: Record<string, 'allow' | 'ask' | 'deny'>
|
|
26
|
-
defaultPermission?: 'allow' | 'ask' | 'deny'
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function withPermissions(config: PermissionConfig = {}) {
|
|
30
|
-
return (assistant: Assistant) => {
|
|
31
|
-
const perms = config.permissions || {}
|
|
32
|
-
const defaultPerm = config.defaultPermission || 'ask'
|
|
33
|
-
const pendingResolvers = new Map<string, (d: 'approve' | 'deny') => void>()
|
|
34
|
-
|
|
35
|
-
assistant.intercept('beforeToolCall', async (ctx, next) => {
|
|
36
|
-
const policy = perms[ctx.name] || defaultPerm
|
|
37
|
-
|
|
38
|
-
if (policy === 'deny') {
|
|
39
|
-
ctx.skip = true
|
|
40
|
-
ctx.result = JSON.stringify({ blocked: true, tool: ctx.name, reason: 'Permission denied.' })
|
|
41
|
-
assistant.emit('toolBlocked', ctx.name, 'deny policy')
|
|
42
|
-
return
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (policy === 'allow') {
|
|
46
|
-
await next()
|
|
47
|
-
return
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// 'ask' — emit event and block until resolved
|
|
51
|
-
const id = assistant.container.utils.uuid()
|
|
52
|
-
const decision = await new Promise<'approve' | 'deny'>((resolve) => {
|
|
53
|
-
pendingResolvers.set(id, resolve)
|
|
54
|
-
assistant.emit('permissionRequest', { id, toolName: ctx.name, args: ctx.args })
|
|
55
|
-
})
|
|
56
|
-
|
|
57
|
-
pendingResolvers.delete(id)
|
|
58
|
-
|
|
59
|
-
if (decision === 'approve') {
|
|
60
|
-
await next()
|
|
61
|
-
} else {
|
|
62
|
-
ctx.skip = true
|
|
63
|
-
ctx.result = JSON.stringify({ blocked: true, tool: ctx.name, reason: 'User denied.' })
|
|
64
|
-
}
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
// Expose approve/deny on the assistant instance
|
|
68
|
-
;(assistant as any).approve = (id: string) => pendingResolvers.get(id)?.('approve')
|
|
69
|
-
;(assistant as any).deny = (id: string) => pendingResolvers.get(id)?.('deny')
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### 2. LucaCoder becomes an assistant factory, not a wrapper
|
|
75
|
-
|
|
76
|
-
Instead of owning an inner assistant and proxying everything, `LucaCoder` creates and returns a configured `Assistant`:
|
|
77
|
-
|
|
78
|
-
```typescript
|
|
79
|
-
export class LucaCoder extends Feature {
|
|
80
|
-
createAssistant(overrides?: Partial<AssistantOptions>): Assistant {
|
|
81
|
-
const assistant = this.container.feature('assistant', {
|
|
82
|
-
systemPrompt: this.buildSystemPrompt(),
|
|
83
|
-
...overrides,
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
// This is the runtime equivalent of hooks.ts started()
|
|
87
|
-
assistant.use(this.container.feature('codingTools'))
|
|
88
|
-
|
|
89
|
-
const fileTools = this.container.feature('fileTools')
|
|
90
|
-
assistant.use(fileTools.toTools({ only: ['editFile', 'writeFile', 'deleteFile'] }))
|
|
91
|
-
fileTools.setupToolsConsumer(assistant)
|
|
92
|
-
|
|
93
|
-
assistant.use(this.container.feature('processManager'))
|
|
94
|
-
assistant.use(this.container.feature('skillsLibrary'))
|
|
95
|
-
|
|
96
|
-
// Permission layer as a plugin
|
|
97
|
-
if (this.options.permissions || this.options.defaultPermission) {
|
|
98
|
-
assistant.use(withPermissions({
|
|
99
|
-
permissions: this.options.permissions,
|
|
100
|
-
defaultPermission: this.options.defaultPermission,
|
|
101
|
-
}))
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return assistant
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
### 3. Usage
|
|
110
|
-
|
|
111
|
-
```typescript
|
|
112
|
-
// Runtime — no disk files, works in compiled binary
|
|
113
|
-
const coder = container.feature('lucaCoder')
|
|
114
|
-
const assistant = await coder.createAssistant()
|
|
115
|
-
await assistant.ask('refactor the auth module')
|
|
116
|
-
|
|
117
|
-
// With permission gating
|
|
118
|
-
const coder = container.feature('lucaCoder', {
|
|
119
|
-
permissions: { editFile: 'ask', writeFile: 'ask', deleteFile: 'ask' },
|
|
120
|
-
defaultPermission: 'allow',
|
|
121
|
-
})
|
|
122
|
-
const assistant = await coder.createAssistant()
|
|
123
|
-
assistant.on('permissionRequest', ({ id }) => assistant.approve(id))
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
### 4. AutonomousAssistant collapses
|
|
127
|
-
|
|
128
|
-
`AutonomousAssistant` becomes either:
|
|
129
|
-
- Deleted entirely (replaced by `withPermissions` plugin on any assistant)
|
|
130
|
-
- Or a thin factory like LucaCoder but with no coding opinions — just `createAssistant()` + permissions
|
|
131
|
-
|
|
132
|
-
## What This Achieves
|
|
133
|
-
|
|
134
|
-
- **No duplication** — permission logic lives in one place (the plugin)
|
|
135
|
-
- **No proxying** — you get back a real `Assistant`, not a wrapper that forwards `.ask()`, `.tools`, `.messages`, `.conversation`
|
|
136
|
-
- **Binary-compatible** — the factory pattern doesn't need disk files, so it works in the compiled `luca` binary
|
|
137
|
-
- **Composable** — `assistants/codingAssistant/hooks.ts` and `LucaCoder.createAssistant()` produce the exact same result through the same mechanism (`assistant.use()`)
|
|
138
|
-
- **The folder-based assistant becomes the reference implementation** of what the factory does programmatically
|
|
139
|
-
|
|
140
|
-
## Relationship to assistants/codingAssistant
|
|
141
|
-
|
|
142
|
-
The disk-based `assistants/codingAssistant/` (CORE.md + hooks.ts + tools.ts) is the "editable" version. `LucaCoder.createAssistant()` is the "compiled" version. Same tools, same prompt, same behavior — one loads from files, the other is baked in code.
|
package/docs/in-memory-fs.md
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# Introspection Audit
|
|
2
|
-
|
|
3
|
-
This audit is a periodic test, does the introspectAsText output actually help an LLM use that
|
|
4
|
-
particular feature.
|
|
5
|
-
|
|
6
|
-
## Files
|
|
7
|
-
|
|
8
|
-
- `src/node/features/*.ts` NodeContainer features
|
|
9
|
-
- `src/agi/features/*.ts` AGIContainer features
|
|
10
|
-
|
|
11
|
-
## Your Task
|
|
12
|
-
|
|
13
|
-
For each feature, you can run the following shell command:
|
|
14
|
-
|
|
15
|
-
```shell
|
|
16
|
-
luca describe feature-id
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
This command will accept diskCache, disk-cache. Generally you want to go with the shortcut that is defined on the feature class.
|
|
20
|
-
|
|
21
|
-
Your job is to take what you learn from that command, and build an idea of 3-4 example usecases of that feature.
|
|
22
|
-
|
|
23
|
-
Compile all of this into a document in docs/reports/introspection-audit-tasks.md.
|
|
24
|
-
|
|
25
|
-
I'd like the following format
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
# Introspection Audit Results
|
|
29
|
-
|
|
30
|
-
## Features
|
|
31
|
-
|
|
32
|
-
### [diskCache](src/node/features/disk-cache.ts)
|
|
33
|
-
|
|
34
|
-
The purpose of this feature is to provided a consistent disk backed key-value store for large blobs and json objects. It includes the ability to have an encrypted store that can only be read with a secret.
|
|
35
|
-
|
|
36
|
-
- securely set / get a key across processes
|
|
37
|
-
- query information about available keys
|
|
38
|
-
- check if a key is present, if not write to it
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Do that for every feature.
|
|
42
|
-
|
|
43
|
-
## Next Steps
|
|
44
|
-
|
|
45
|
-
Once we have this report written, I will review the use cases and descriptions to see how accurate they are and if I like them.
|
|
46
|
-
|
|
47
|
-
Then we will have you attempt to eval your code and see if it works. If it doesn't, sugggest how the documentation could be improved or how the API might be improved.
|
|
48
|
-
|
|
49
|
-
|
package/docs/introspection.md
DELETED
|
@@ -1,164 +0,0 @@
|
|
|
1
|
-
# Introspection
|
|
2
|
-
|
|
3
|
-
Luca's introspection system lets you discover everything about a container and its helpers at runtime. This document is a runnable demo — every code block works in the Luca REPL or as a script.
|
|
4
|
-
|
|
5
|
-
## Container Introspection
|
|
6
|
-
|
|
7
|
-
The container knows what it is, what registries it has, and what's available in each one.
|
|
8
|
-
|
|
9
|
-
```ts
|
|
10
|
-
const info = container.introspect()
|
|
11
|
-
console.log(info.className)
|
|
12
|
-
console.log(info.registries.map(r => `${r.name}: ${r.available.length} available`))
|
|
13
|
-
console.log('factories:', info.factoryNames)
|
|
14
|
-
console.log('enabled features:', info.enabledFeatures)
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
You can get the full introspection as markdown:
|
|
18
|
-
|
|
19
|
-
```ts
|
|
20
|
-
console.log(container.introspectAsText())
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
Or request a single section:
|
|
24
|
-
|
|
25
|
-
```ts
|
|
26
|
-
console.log(container.introspectAsText('methods'))
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
```ts
|
|
30
|
-
console.log(container.introspectAsText('getters'))
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
## Querying Registries
|
|
34
|
-
|
|
35
|
-
Every registry exposes what's available and can describe its members.
|
|
36
|
-
|
|
37
|
-
```ts
|
|
38
|
-
console.log('features:', container.features.available)
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
```ts
|
|
42
|
-
console.log('clients:', container.clients.available)
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
```ts
|
|
46
|
-
console.log('servers:', container.servers.available)
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Describe a single member — returns markdown documentation derived from the code:
|
|
50
|
-
|
|
51
|
-
```ts
|
|
52
|
-
console.log(container.features.describe('git'))
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
Describe everything in a registry at once:
|
|
56
|
-
|
|
57
|
-
```ts
|
|
58
|
-
const allFeatureDocs = container.features.describeAll()
|
|
59
|
-
console.log(`${allFeatureDocs.length} features documented`)
|
|
60
|
-
console.log(allFeatureDocs[0].slice(0, 200) + '...')
|
|
61
|
-
```
|
|
62
|
-
|
|
63
|
-
## Helper Introspection — Quick Discovery
|
|
64
|
-
|
|
65
|
-
Every helper instance exposes `$methods` and `$getters` for a quick look at what's available:
|
|
66
|
-
|
|
67
|
-
```ts
|
|
68
|
-
const git = container.feature('git')
|
|
69
|
-
console.log('methods:', git.$methods)
|
|
70
|
-
console.log('getters:', git.$getters)
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## Helper Introspection — Structured Data
|
|
74
|
-
|
|
75
|
-
Every helper instance (feature, client, server, etc.) can introspect itself. The result is a typed object you can traverse programmatically.
|
|
76
|
-
|
|
77
|
-
```ts
|
|
78
|
-
const git = container.feature('git')
|
|
79
|
-
const data = git.introspect()
|
|
80
|
-
console.log(data.id)
|
|
81
|
-
console.log(data.description.slice(0, 100) + '...')
|
|
82
|
-
console.log('methods:', Object.keys(data.methods))
|
|
83
|
-
console.log('getters:', Object.keys(data.getters))
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
### Filtering by Section
|
|
87
|
-
|
|
88
|
-
Pass a section name to get just that part:
|
|
89
|
-
|
|
90
|
-
```ts
|
|
91
|
-
const git = container.feature('git')
|
|
92
|
-
const methodsOnly = git.introspect('methods')
|
|
93
|
-
console.log(Object.keys(methodsOnly.methods))
|
|
94
|
-
console.log(Object.keys(methodsOnly.getters)) // empty — filtered out
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
Valid sections: `'methods'`, `'getters'`, `'events'`, `'state'`, `'options'`.
|
|
98
|
-
|
|
99
|
-
### Expanded Type Properties
|
|
100
|
-
|
|
101
|
-
When a method parameter uses a custom type, introspection resolves it to show the type's members:
|
|
102
|
-
|
|
103
|
-
```ts
|
|
104
|
-
const git = container.feature('git')
|
|
105
|
-
const lsFiles = git.introspect('methods').methods.lsFiles
|
|
106
|
-
console.log(lsFiles.parameters.options.type) // "LsFilesOptions"
|
|
107
|
-
console.log(lsFiles.parameters.options.properties)
|
|
108
|
-
// { cached: { type: 'boolean', description: 'Show cached/staged files' }, ... }
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
## Helper Introspection — As Text
|
|
112
|
-
|
|
113
|
-
Get the full markdown documentation for a helper:
|
|
114
|
-
|
|
115
|
-
```ts
|
|
116
|
-
const git = container.feature('git')
|
|
117
|
-
console.log(git.introspectAsText())
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
Or just one section:
|
|
121
|
-
|
|
122
|
-
```ts
|
|
123
|
-
const git = container.feature('git')
|
|
124
|
-
console.log(git.introspectAsText('methods'))
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
```ts
|
|
128
|
-
const git = container.feature('git')
|
|
129
|
-
console.log(git.introspectAsText('getters'))
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
The heading depth can be controlled — useful when embedding in larger documents:
|
|
133
|
-
|
|
134
|
-
```ts
|
|
135
|
-
const git = container.feature('git')
|
|
136
|
-
console.log(git.introspectAsText('methods', 3)) // headings start at ###
|
|
137
|
-
```
|
|
138
|
-
|
|
139
|
-
## Introspecting State and Options
|
|
140
|
-
|
|
141
|
-
Features that declare Zod schemas for state and options expose them through introspection:
|
|
142
|
-
|
|
143
|
-
```ts
|
|
144
|
-
const git = container.feature('git')
|
|
145
|
-
const stateInfo = git.introspect('state')
|
|
146
|
-
console.log(stateInfo.state)
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
```ts
|
|
150
|
-
const ui = container.feature('ui')
|
|
151
|
-
const stateInfo = ui.introspect('state')
|
|
152
|
-
console.log(stateInfo.state)
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
## Putting It Together
|
|
156
|
-
|
|
157
|
-
A quick way to survey everything the container offers:
|
|
158
|
-
|
|
159
|
-
```ts
|
|
160
|
-
for (const name of container.registryNames) {
|
|
161
|
-
const registry = container[name]
|
|
162
|
-
console.log(`\n${name}: ${registry.available.join(', ')}`)
|
|
163
|
-
}
|
|
164
|
-
```
|
package/docs/mcp/readme.md
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
# Luca Development Guide
|
|
2
|
-
|
|
3
|
-
You are working in a **luca project**. The luca container provides all capabilities your code needs. Do not install npm packages or import Node.js builtins directly.
|
|
4
|
-
|
|
5
|
-
## The Contract
|
|
6
|
-
|
|
7
|
-
Every capability goes through the container. If you need something that doesn't exist, build it as a feature, client, or server. If it wraps a third-party library, the helper IS the interface — consumer code never imports the library directly.
|
|
8
|
-
|
|
9
|
-
## Import Rule
|
|
10
|
-
|
|
11
|
-
All consumer code imports from `@soederpop/luca` only:
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
import { Feature, features, z, FeatureStateSchema, FeatureOptionsSchema } from '@soederpop/luca'
|
|
15
|
-
import { Client, clients, RestClient, ClientStateSchema } from '@soederpop/luca/client'
|
|
16
|
-
import { Server, servers, ServerStateSchema } from '@soederpop/luca'
|
|
17
|
-
import { commands, CommandOptionsSchema } from '@soederpop/luca'
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Never import from `fs`, `path`, `crypto`, or other Node builtins. Never import third-party packages in consumer code. If a container feature wraps the functionality, use it.
|
|
21
|
-
|
|
22
|
-
## Zod v4
|
|
23
|
-
|
|
24
|
-
This project uses **Zod v4** — import `z` from `@soederpop/luca`, never from `'zod'` directly. All option, state, and event schemas use Zod v4 syntax. Key patterns:
|
|
25
|
-
|
|
26
|
-
```ts
|
|
27
|
-
// Extending base schemas (options, state, events)
|
|
28
|
-
export const MyStateSchema = FeatureStateSchema.extend({
|
|
29
|
-
count: z.number().default(0).describe('Number of items'),
|
|
30
|
-
label: z.string().optional().describe('Display label'),
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
// Events use z.tuple() for listener arguments
|
|
34
|
-
export const MyEventsSchema = FeatureEventsSchema.extend({
|
|
35
|
-
itemAdded: z.tuple([z.string().describe('key'), z.number().describe('index')]),
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
// Type inference
|
|
39
|
-
export type MyState = z.infer<typeof MyStateSchema>
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Zod v4 differences from v3 that matter:
|
|
43
|
-
- `z.string().check(...)` replaces some v3 refinement patterns
|
|
44
|
-
- `.toJSONSchema()` is built-in on any schema — no external library needed
|
|
45
|
-
- Error customization uses `z.string({ error: "message" })` not `.refine()` for simple cases
|
|
46
|
-
- `z.interface()` exists for recursive/lazy object types
|
|
47
|
-
- Do NOT use `z.nativeEnum()` — use `z.enum()` instead
|
|
48
|
-
|
|
49
|
-
## Dependencies
|
|
50
|
-
|
|
51
|
-
If the project has `node_modules` and a package manager, helper implementations can import third-party libraries internally. If not (e.g. running via the `luca` binary's VM), all code must import only from `@soederpop/luca`.
|
|
52
|
-
|
|
53
|
-
## Discovering Capabilities
|
|
54
|
-
|
|
55
|
-
The container has registries for features, clients, servers, commands, and endpoints. **Do not guess** what is available — use your MCP tools to discover it:
|
|
56
|
-
|
|
57
|
-
1. **`find_capability`** — Overview of all features, clients, and servers with descriptions. Start here.
|
|
58
|
-
2. **`list_registry`** — List all names in a specific registry (features, clients, servers, commands, endpoints).
|
|
59
|
-
3. **`describe_helper`** — Full API docs for a specific helper (methods, options, state, events). Call this before writing code that uses a helper.
|
|
60
|
-
4. **`eval`** — Once you know what you need, prototype calls in the live sandbox before writing them into files.
|
|
61
|
-
|
|
62
|
-
## Mini Examples
|
|
63
|
-
|
|
64
|
-
### Feature with composition
|
|
65
|
-
|
|
66
|
-
Features access other features via `this.container.feature(...)`:
|
|
67
|
-
|
|
68
|
-
```ts
|
|
69
|
-
import { z } from 'zod'
|
|
70
|
-
import { FeatureStateSchema, FeatureOptionsSchema, FeatureEventsSchema } from '@soederpop/luca'
|
|
71
|
-
import { Feature, features } from '@soederpop/luca'
|
|
72
|
-
import type { ContainerContext } from '@soederpop/luca'
|
|
73
|
-
|
|
74
|
-
export const ConfigStateSchema = FeatureStateSchema.extend({
|
|
75
|
-
loaded: z.boolean().default(false).describe('Whether config has been loaded'),
|
|
76
|
-
})
|
|
77
|
-
|
|
78
|
-
export const ConfigOptionsSchema = FeatureOptionsSchema.extend({
|
|
79
|
-
filePath: z.string().default('config.json').describe('Path to config file'),
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
export const ConfigEventsSchema = FeatureEventsSchema.extend({
|
|
83
|
-
configLoaded: z.tuple([z.record(z.unknown()).describe('parsed config')]),
|
|
84
|
-
})
|
|
85
|
-
|
|
86
|
-
export class Config extends Feature<z.infer<typeof ConfigStateSchema>, z.infer<typeof ConfigOptionsSchema>> {
|
|
87
|
-
static override shortcut = 'features.config' as const
|
|
88
|
-
static override stateSchema = ConfigStateSchema
|
|
89
|
-
static override optionsSchema = ConfigOptionsSchema
|
|
90
|
-
static override eventsSchema = ConfigEventsSchema
|
|
91
|
-
static override description = 'Loads and manages project configuration'
|
|
92
|
-
|
|
93
|
-
/** Load and parse the config file */
|
|
94
|
-
async load() {
|
|
95
|
-
const fs = this.container.feature('fs')
|
|
96
|
-
const raw = await fs.readFile(this.options.filePath)
|
|
97
|
-
const data = JSON.parse(raw)
|
|
98
|
-
this.state.set('loaded', true)
|
|
99
|
-
this.emit('configLoaded', data)
|
|
100
|
-
return data
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
declare module '@soederpop/luca' {
|
|
105
|
-
interface AvailableFeatures { config: typeof Config }
|
|
106
|
-
}
|
|
107
|
-
export default features.register('config', Config)
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
### Client with composition
|
|
111
|
-
|
|
112
|
-
Clients access features and other clients via `this.container`:
|
|
113
|
-
|
|
114
|
-
```ts
|
|
115
|
-
import { z } from 'zod'
|
|
116
|
-
import { Client, clients, ClientStateSchema, ClientOptionsSchema, ClientEventsSchema } from '@soederpop/luca'
|
|
117
|
-
import type { ContainerContext } from '@soederpop/luca'
|
|
118
|
-
|
|
119
|
-
export const GithubOptionsSchema = ClientOptionsSchema.extend({
|
|
120
|
-
token: z.string().describe('GitHub personal access token'),
|
|
121
|
-
owner: z.string().describe('Repository owner'),
|
|
122
|
-
repo: z.string().describe('Repository name'),
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
export const GithubEventsSchema = ClientEventsSchema.extend({
|
|
126
|
-
issuesFetched: z.tuple([z.number().describe('count')]),
|
|
127
|
-
})
|
|
128
|
-
|
|
129
|
-
export class GithubClient extends Client<z.infer<typeof ClientStateSchema>, z.infer<typeof GithubOptionsSchema>> {
|
|
130
|
-
static override shortcut = 'clients.github' as const
|
|
131
|
-
static override optionsSchema = GithubOptionsSchema
|
|
132
|
-
static override eventsSchema = GithubEventsSchema
|
|
133
|
-
static override description = 'GitHub API client using container REST client'
|
|
134
|
-
|
|
135
|
-
/** Fetch open issues */
|
|
136
|
-
async issues() {
|
|
137
|
-
const rest = this.container.client('rest')
|
|
138
|
-
const res = await rest.get(`https://api.github.com/repos/${this.options.owner}/${this.options.repo}/issues`, {
|
|
139
|
-
headers: { Authorization: `token ${this.options.token}` },
|
|
140
|
-
})
|
|
141
|
-
this.emit('issuesFetched', res.data.length)
|
|
142
|
-
return res.data
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
declare module '@soederpop/luca' {
|
|
147
|
-
interface AvailableClients { github: typeof GithubClient }
|
|
148
|
-
}
|
|
149
|
-
export default clients.register('github', GithubClient)
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
## Workflow
|
|
153
|
-
|
|
154
|
-
1. **`find_capability`** — Search what already exists before writing anything
|
|
155
|
-
2. **`describe_helper`** — Read the full API docs for the helper you need
|
|
156
|
-
3. **`eval`** — Prototype and test container API calls in the sandbox
|
|
157
|
-
4. **`scaffold`** — Generate correct boilerplate when building something new
|
|
158
|
-
5. **Write the file** — Using the patterns from the scaffold
|
|
159
|
-
|
|
160
|
-
## Portability
|
|
161
|
-
|
|
162
|
-
Code that only imports from `@soederpop/luca` can be copied between any luca project. That's the goal. Features, clients, servers, and commands written this way are portable building blocks.
|
package/docs/models.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
defineModel,
|
|
3
|
-
section,
|
|
4
|
-
hasMany,
|
|
5
|
-
belongsTo,
|
|
6
|
-
AstQuery,
|
|
7
|
-
z,
|
|
8
|
-
} from "contentbase";
|
|
9
|
-
|
|
10
|
-
export const Tutorial = defineModel("Tutorial", {
|
|
11
|
-
description: 'Tutorials on how to compose things together to do neat things',
|
|
12
|
-
prefix: "tutorials",
|
|
13
|
-
meta: z.object({
|
|
14
|
-
tags: z.array(z.string()).default([]).describe("Arbitrary tags for categorizing the tutorial"),
|
|
15
|
-
}),
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
export const Report = defineModel("Report", {
|
|
19
|
-
description: 'Used for e.g. documentation audits, usability audits for agents, or anything else long form project related',
|
|
20
|
-
prefix: "reports",
|
|
21
|
-
meta: z.object({
|
|
22
|
-
tags: z.array(z.string()).default([]).describe("Arbitrary tags for categorizing the report"),
|
|
23
|
-
}),
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
export const Example = defineModel("Example", {
|
|
27
|
-
description: 'Examples of using various luca features',
|
|
28
|
-
prefix: "examples",
|
|
29
|
-
meta: z.object({
|
|
30
|
-
tags: z.array(z.string()).default([]).describe("Arbitrary tags for categorizing the example"),
|
|
31
|
-
}),
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
export const Challenge = defineModel('Challenge', {
|
|
35
|
-
description: 'challenges are used by our evaluation suite to measure the quality of the introspection content and tool, as well as the SKILL.md that gets generated to help coding assistants work with the luca framework',
|
|
36
|
-
prefix: 'challenges',
|
|
37
|
-
meta: z.object({
|
|
38
|
-
difficulty: z.enum(['easy','medium','hard']).default('easy'),
|
|
39
|
-
maxTime: z.number().default(5).describe('Number of seconds max time limit default to 5 minutes')
|
|
40
|
-
}),
|
|
41
|
-
})
|