@soederpop/luca 0.1.1 → 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 +3 -0
- 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/scripts/test-assistant-hooks.ts +13 -0
- 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 +90 -2
- 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 +1403 -929
- package/src/introspection/generated.node.ts +127 -33
- 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 +34 -9
- package/src/node/features/ui.ts +1 -1
- package/src/node/features/vm.ts +6 -5
- 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/assistant.test.ts +72 -0
- package/test/conversation.test.ts +220 -0
- package/test/vm-loadmodule.test.ts +213 -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
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Feature } from '../feature.js';
|
|
3
|
+
export declare const HelpersStateSchema: z.ZodObject<{
|
|
4
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
5
|
+
discovered: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
6
|
+
registered: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
7
|
+
}, z.core.$loose>;
|
|
8
|
+
export type HelpersState = z.infer<typeof HelpersStateSchema>;
|
|
9
|
+
export declare const HelpersOptionsSchema: z.ZodObject<{
|
|
10
|
+
name: z.ZodOptional<z.ZodString>;
|
|
11
|
+
_cacheKey: z.ZodOptional<z.ZodString>;
|
|
12
|
+
cached: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
enable: z.ZodOptional<z.ZodBoolean>;
|
|
14
|
+
rootDir: z.ZodOptional<z.ZodString>;
|
|
15
|
+
}, z.core.$strip>;
|
|
16
|
+
export type HelpersOptions = z.infer<typeof HelpersOptionsSchema>;
|
|
17
|
+
export declare const HelpersEventsSchema: z.ZodObject<{
|
|
18
|
+
stateChange: z.ZodTuple<[z.ZodAny], null>;
|
|
19
|
+
enabled: z.ZodTuple<[], null>;
|
|
20
|
+
discovered: z.ZodTuple<[z.ZodString, z.ZodArray<z.ZodString>], null>;
|
|
21
|
+
registered: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodAny], null>;
|
|
22
|
+
}, z.core.$strip>;
|
|
23
|
+
type RegistryType = 'features' | 'clients' | 'servers' | 'commands' | 'endpoints' | 'selectors';
|
|
24
|
+
/**
|
|
25
|
+
* The Helpers feature is a unified gateway for discovering and registering
|
|
26
|
+
* project-level helpers from conventional folder locations.
|
|
27
|
+
*
|
|
28
|
+
* It scans known folder names (features/, clients/, servers/, commands/, endpoints/, selectors/)
|
|
29
|
+
* and handles registration differently based on the helper type:
|
|
30
|
+
*
|
|
31
|
+
* - Class-based (features, clients, servers): Dynamic import, validate subclass, register
|
|
32
|
+
* - Config-based (commands, endpoints, selectors): Delegate to existing discovery mechanisms
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const helpers = container.feature('helpers', { enable: true })
|
|
37
|
+
*
|
|
38
|
+
* // Discover all helper types
|
|
39
|
+
* await helpers.discoverAll()
|
|
40
|
+
*
|
|
41
|
+
* // Discover a specific type
|
|
42
|
+
* await helpers.discover('features')
|
|
43
|
+
*
|
|
44
|
+
* // Unified view of all available helpers
|
|
45
|
+
* console.log(helpers.available)
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
export declare class Helpers extends Feature<HelpersState, HelpersOptions> {
|
|
49
|
+
static shortcut: "features.helpers";
|
|
50
|
+
static description: string;
|
|
51
|
+
static stateSchema: z.ZodObject<{
|
|
52
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
53
|
+
discovered: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodBoolean>>;
|
|
54
|
+
registered: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
55
|
+
}, z.core.$loose>;
|
|
56
|
+
static optionsSchema: z.ZodObject<{
|
|
57
|
+
name: z.ZodOptional<z.ZodString>;
|
|
58
|
+
_cacheKey: z.ZodOptional<z.ZodString>;
|
|
59
|
+
cached: z.ZodOptional<z.ZodBoolean>;
|
|
60
|
+
enable: z.ZodOptional<z.ZodBoolean>;
|
|
61
|
+
rootDir: z.ZodOptional<z.ZodString>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
static eventsSchema: z.ZodObject<{
|
|
64
|
+
stateChange: z.ZodTuple<[z.ZodAny], null>;
|
|
65
|
+
enabled: z.ZodTuple<[], null>;
|
|
66
|
+
discovered: z.ZodTuple<[z.ZodString, z.ZodArray<z.ZodString>], null>;
|
|
67
|
+
registered: z.ZodTuple<[z.ZodString, z.ZodString, z.ZodAny], null>;
|
|
68
|
+
}, z.core.$strip>;
|
|
69
|
+
/** In-flight or completed discovery promises, keyed by registry type */
|
|
70
|
+
private _discoveryPromises;
|
|
71
|
+
/** Cached results from completed discoveries */
|
|
72
|
+
private _discoveryResults;
|
|
73
|
+
/** In-flight or completed discoverAll promise */
|
|
74
|
+
private _discoverAllPromise;
|
|
75
|
+
/**
|
|
76
|
+
* Returns a mapping from registry type name to its registry singleton, base class, and conventional folder candidates.
|
|
77
|
+
*/
|
|
78
|
+
private get registryMap();
|
|
79
|
+
/** The root directory to scan for helper folders. */
|
|
80
|
+
get rootDir(): string;
|
|
81
|
+
/**
|
|
82
|
+
* Whether to use native `import()` for loading project helpers.
|
|
83
|
+
* True only if `@soederpop/luca` is actually resolvable in `node_modules`.
|
|
84
|
+
* Warns when `node_modules` exists but the package is missing.
|
|
85
|
+
*/
|
|
86
|
+
get useNativeImport(): boolean;
|
|
87
|
+
/** Prevent repeated warnings about missing @soederpop/luca */
|
|
88
|
+
private _warnedNativeImport;
|
|
89
|
+
/** Track whether we've seeded the VM with virtual modules */
|
|
90
|
+
private _vmSeeded;
|
|
91
|
+
/**
|
|
92
|
+
* Seeds the VM feature with virtual modules so that project-level files
|
|
93
|
+
* can `import` / `require('@soederpop/luca')`, `zod`, etc. without
|
|
94
|
+
* needing them in `node_modules`.
|
|
95
|
+
*
|
|
96
|
+
* Called automatically when `useNativeImport` is false.
|
|
97
|
+
* Can also be called externally (e.g. from the CLI) to pre-seed before discovery.
|
|
98
|
+
*/
|
|
99
|
+
seedVirtualModules(): void;
|
|
100
|
+
/**
|
|
101
|
+
* Returns a unified view of all available helpers across all registries.
|
|
102
|
+
* Each key is a registry type, each value is the list of helper names in that registry.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* container.helpers.available
|
|
107
|
+
* // { features: ['fs', 'git', ...], clients: ['rest', 'websocket'], ... }
|
|
108
|
+
* ```
|
|
109
|
+
*/
|
|
110
|
+
get available(): Record<string, string[]>;
|
|
111
|
+
/**
|
|
112
|
+
* Ensures the fileManager feature is started before using it for discovery.
|
|
113
|
+
*
|
|
114
|
+
* @returns The started fileManager instance
|
|
115
|
+
*/
|
|
116
|
+
private ensureFileManager;
|
|
117
|
+
/**
|
|
118
|
+
* Resolves which conventional folder path exists for a given registry type.
|
|
119
|
+
* Tries each candidate folder in order and returns the first one that exists.
|
|
120
|
+
*
|
|
121
|
+
* @param type - The registry type to resolve the folder for
|
|
122
|
+
* @returns Absolute path to the folder, or null if none exist
|
|
123
|
+
*/
|
|
124
|
+
private resolveFolderPath;
|
|
125
|
+
/**
|
|
126
|
+
* Discover and register project-level helpers of the given type.
|
|
127
|
+
*
|
|
128
|
+
* Idempotent: the first caller triggers the actual scan. Subsequent callers
|
|
129
|
+
* receive the cached results. If discovery is in-flight, callers await the
|
|
130
|
+
* same promise — no duplicate work.
|
|
131
|
+
*
|
|
132
|
+
* @param type - Which type of helpers to discover
|
|
133
|
+
* @param options - Optional overrides
|
|
134
|
+
* @param options.directory - Override the directory to scan
|
|
135
|
+
* @returns Names of helpers that were discovered and registered
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* ```typescript
|
|
139
|
+
* const names = await container.helpers.discover('features')
|
|
140
|
+
* console.log(names) // ['myCustomFeature']
|
|
141
|
+
* ```
|
|
142
|
+
*/
|
|
143
|
+
discover(type: RegistryType, options?: {
|
|
144
|
+
directory?: string;
|
|
145
|
+
}): Promise<string[]>;
|
|
146
|
+
/** Internal: performs the actual discovery work for a single type. */
|
|
147
|
+
private _doDiscover;
|
|
148
|
+
/**
|
|
149
|
+
* Discover all helper types from their conventional folder locations.
|
|
150
|
+
*
|
|
151
|
+
* Idempotent: safe to call from multiple places (luca.cli.ts, commands, etc.).
|
|
152
|
+
* The first caller triggers discovery; all others receive the same results.
|
|
153
|
+
*
|
|
154
|
+
* @returns Map of registry type to discovered helper names
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```typescript
|
|
158
|
+
* const results = await container.helpers.discoverAll()
|
|
159
|
+
* // { features: ['myFeature'], clients: [], servers: [], commands: ['deploy'], endpoints: [] }
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
discoverAll(): Promise<Record<string, string[]>>;
|
|
163
|
+
/** Internal: performs the actual discoverAll work. */
|
|
164
|
+
private _doDiscoverAll;
|
|
165
|
+
/**
|
|
166
|
+
* Look up a helper class by type and name.
|
|
167
|
+
*
|
|
168
|
+
* @param type - The registry type (features, clients, servers, commands, endpoints)
|
|
169
|
+
* @param name - The helper name within that registry
|
|
170
|
+
* @returns The helper constructor
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* const FsClass = container.helpers.lookup('features', 'fs')
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
lookup(type: RegistryType, name: string): any;
|
|
178
|
+
/**
|
|
179
|
+
* Get the introspection description for a specific helper.
|
|
180
|
+
*
|
|
181
|
+
* @param type - The registry type
|
|
182
|
+
* @param name - The helper name
|
|
183
|
+
* @returns Markdown description of the helper's interface
|
|
184
|
+
*/
|
|
185
|
+
describe(type: RegistryType, name: string): string;
|
|
186
|
+
/**
|
|
187
|
+
* Load a module either via native `import()` or the VM's virtual module system.
|
|
188
|
+
* Uses the same `useNativeImport` check as discovery to decide the loading strategy.
|
|
189
|
+
*
|
|
190
|
+
* @param absPath - Absolute path to the module file
|
|
191
|
+
* @param options - Optional settings
|
|
192
|
+
* @param options.cacheBust - When true, appends a timestamp query to bypass the native import cache (useful for hot reload)
|
|
193
|
+
* @returns The module's exports
|
|
194
|
+
*/
|
|
195
|
+
loadModuleExports(absPath: string, options?: {
|
|
196
|
+
cacheBust?: boolean;
|
|
197
|
+
}): Promise<Record<string, any>>;
|
|
198
|
+
/**
|
|
199
|
+
* Discovers class-based helpers (features, clients, servers) from a directory.
|
|
200
|
+
* Uses fileManager when available (fast in git repos), falls back to Glob.
|
|
201
|
+
*/
|
|
202
|
+
private discoverClassBased;
|
|
203
|
+
/**
|
|
204
|
+
* Discovers config-based helpers (commands, endpoints) by delegating
|
|
205
|
+
* to existing discovery mechanisms.
|
|
206
|
+
*/
|
|
207
|
+
private discoverConfigBased;
|
|
208
|
+
/**
|
|
209
|
+
* Discovers commands using the VM's virtual module system.
|
|
210
|
+
* Mirrors CommandsRegistry.discover() but uses vm.loadModule() instead of import().
|
|
211
|
+
*/
|
|
212
|
+
private discoverCommandsViaVM;
|
|
213
|
+
/**
|
|
214
|
+
* Discovers selectors using the VM's virtual module system.
|
|
215
|
+
* Mirrors discoverCommandsViaVM but uses selectors registry and Selector base class.
|
|
216
|
+
*/
|
|
217
|
+
private discoverSelectorsViaVM;
|
|
218
|
+
/**
|
|
219
|
+
* Discovers endpoints from a directory, registering them for discoverability.
|
|
220
|
+
* Actual mounting to an express server is handled separately by ExpressServer.useEndpoints().
|
|
221
|
+
*/
|
|
222
|
+
private discoverEndpoints;
|
|
223
|
+
/**
|
|
224
|
+
* Check if a class is a subclass of a given base class by walking the prototype chain.
|
|
225
|
+
* Uses identity comparison first, then falls back to name comparison to handle
|
|
226
|
+
* cross-module boundaries (e.g. compiled binary vs dynamically imported modules
|
|
227
|
+
* that resolve to separate module instances of the same class).
|
|
228
|
+
*/
|
|
229
|
+
private isSubclassOf;
|
|
230
|
+
/**
|
|
231
|
+
* Convert a kebab-case or snake_case filename to a camelCase registry name.
|
|
232
|
+
*/
|
|
233
|
+
private fileNameToRegistryName;
|
|
234
|
+
}
|
|
235
|
+
export default Helpers;
|
|
236
|
+
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/node/features/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAmBvC,eAAO,MAAM,kBAAkB;;;;iBAG7B,CAAA;AAEF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAA;AAE7D,eAAO,MAAM,oBAAoB;;;;;;iBAE/B,CAAA;AAEF,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA;AAEjE,eAAO,MAAM,mBAAmB;;;;;iBAU9B,CAAA;AAEF,KAAK,YAAY,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,WAAW,GAAG,WAAW,CAAA;AAI/F;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,qBAAa,OAAQ,SAAQ,OAAO,CAAC,Y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ACH,QAAQ,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM;IAKlD;;;;;;;;OAQG;IACG,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAYzG;;;OAGG;YACW,kBAAkB;IAyFhC;;;OAGG;YACW,mBAAmB;IAwBjC;;;OAGG;YACW,qBAAqB;IAsEnC;;;OAGG;YACW,sBAAsB;IA2CpC;;;OAGG;YACW,iBAAiB;IAuB/B;;;;;OAKG;IACH,OAAO,CAAC,YAAY;IAYpB;;OAEG;IACH,OAAO,CAAC,sBAAsB;CAK/B;AAED,eAAe,OAAO,CAAA"}
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Feature } from '../feature.js';
|
|
3
|
+
export declare const InkStateSchema: z.ZodObject<{
|
|
4
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
5
|
+
mounted: z.ZodBoolean;
|
|
6
|
+
}, z.core.$loose>;
|
|
7
|
+
type InkState = z.infer<typeof InkStateSchema>;
|
|
8
|
+
export declare const InkOptionsSchema: z.ZodObject<{
|
|
9
|
+
name: z.ZodOptional<z.ZodString>;
|
|
10
|
+
_cacheKey: z.ZodOptional<z.ZodString>;
|
|
11
|
+
cached: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
enable: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
+
maxFps: z.ZodOptional<z.ZodNumber>;
|
|
14
|
+
patchConsole: z.ZodOptional<z.ZodBoolean>;
|
|
15
|
+
incrementalRendering: z.ZodOptional<z.ZodBoolean>;
|
|
16
|
+
concurrent: z.ZodOptional<z.ZodBoolean>;
|
|
17
|
+
}, z.core.$strip>;
|
|
18
|
+
type InkOptions = z.infer<typeof InkOptionsSchema>;
|
|
19
|
+
export declare const InkEventsSchema: z.ZodObject<{
|
|
20
|
+
stateChange: z.ZodTuple<[z.ZodAny], null>;
|
|
21
|
+
enabled: z.ZodTuple<[], null>;
|
|
22
|
+
mounted: z.ZodTuple<[], null>;
|
|
23
|
+
unmounted: z.ZodTuple<[], null>;
|
|
24
|
+
}, z.core.$strip>;
|
|
25
|
+
/**
|
|
26
|
+
* Ink Feature — React-powered Terminal UI via Ink
|
|
27
|
+
*
|
|
28
|
+
* Exposes the Ink library (React for CLIs) through the container so any
|
|
29
|
+
* feature, script, or application can build rich terminal user interfaces
|
|
30
|
+
* using React components rendered directly in the terminal.
|
|
31
|
+
*
|
|
32
|
+
* This feature is intentionally a thin pass-through. It re-exports all of
|
|
33
|
+
* Ink's components, hooks, and the render function, plus a few convenience
|
|
34
|
+
* methods for mounting / unmounting apps. The actual UI composition is left
|
|
35
|
+
* entirely to the consumer — the feature just makes Ink available.
|
|
36
|
+
*
|
|
37
|
+
* **What you get:**
|
|
38
|
+
* - `ink.render(element)` — mount a React element to the terminal
|
|
39
|
+
* - `ink.components` — { Box, Text, Static, Transform, Newline, Spacer }
|
|
40
|
+
* - `ink.hooks` — { useInput, useApp, useStdin, useStdout, useStderr, useFocus, useFocusManager }
|
|
41
|
+
* - `ink.React` — the React module itself (createElement, useState, etc.)
|
|
42
|
+
* - `ink.unmount()` — tear down the currently mounted app
|
|
43
|
+
* - `ink.waitUntilExit()` — await the mounted app's exit
|
|
44
|
+
*
|
|
45
|
+
* **Quick start:**
|
|
46
|
+
* ```tsx
|
|
47
|
+
* const ink = container.feature('ink', { enable: true })
|
|
48
|
+
* const { Box, Text } = ink.components
|
|
49
|
+
* const { React } = ink
|
|
50
|
+
*
|
|
51
|
+
* ink.render(
|
|
52
|
+
* React.createElement(Box, { flexDirection: 'column' },
|
|
53
|
+
* React.createElement(Text, { color: 'green' }, 'hello from ink'),
|
|
54
|
+
* React.createElement(Text, { dimColor: true }, 'powered by luca'),
|
|
55
|
+
* )
|
|
56
|
+
* )
|
|
57
|
+
*
|
|
58
|
+
* await ink.waitUntilExit()
|
|
59
|
+
* ```
|
|
60
|
+
*
|
|
61
|
+
* Or if you're in a .tsx file:
|
|
62
|
+
* ```tsx
|
|
63
|
+
* import React from 'react'
|
|
64
|
+
* const ink = container.feature('ink', { enable: true })
|
|
65
|
+
* const { Box, Text } = ink.components
|
|
66
|
+
*
|
|
67
|
+
* ink.render(
|
|
68
|
+
* <Box flexDirection="column">
|
|
69
|
+
* <Text color="green">hello from ink</Text>
|
|
70
|
+
* <Text dimColor>powered by luca</Text>
|
|
71
|
+
* </Box>
|
|
72
|
+
* )
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @extends Feature
|
|
76
|
+
*/
|
|
77
|
+
export declare class Ink extends Feature<InkState, InkOptions> {
|
|
78
|
+
static shortcut: "features.ink";
|
|
79
|
+
static stateSchema: z.ZodObject<{
|
|
80
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
81
|
+
mounted: z.ZodBoolean;
|
|
82
|
+
}, z.core.$loose>;
|
|
83
|
+
static optionsSchema: z.ZodObject<{
|
|
84
|
+
name: z.ZodOptional<z.ZodString>;
|
|
85
|
+
_cacheKey: z.ZodOptional<z.ZodString>;
|
|
86
|
+
cached: z.ZodOptional<z.ZodBoolean>;
|
|
87
|
+
enable: z.ZodOptional<z.ZodBoolean>;
|
|
88
|
+
maxFps: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
patchConsole: z.ZodOptional<z.ZodBoolean>;
|
|
90
|
+
incrementalRendering: z.ZodOptional<z.ZodBoolean>;
|
|
91
|
+
concurrent: z.ZodOptional<z.ZodBoolean>;
|
|
92
|
+
}, z.core.$strip>;
|
|
93
|
+
static eventsSchema: z.ZodObject<{
|
|
94
|
+
stateChange: z.ZodTuple<[z.ZodAny], null>;
|
|
95
|
+
enabled: z.ZodTuple<[], null>;
|
|
96
|
+
mounted: z.ZodTuple<[], null>;
|
|
97
|
+
unmounted: z.ZodTuple<[], null>;
|
|
98
|
+
}, z.core.$strip>;
|
|
99
|
+
private _instance;
|
|
100
|
+
private _inkModule;
|
|
101
|
+
private _reactModule;
|
|
102
|
+
private _blocks;
|
|
103
|
+
get initialState(): InkState;
|
|
104
|
+
/**
|
|
105
|
+
* The raw ink module. Lazy-loaded on first access.
|
|
106
|
+
*/
|
|
107
|
+
private _getInk;
|
|
108
|
+
/**
|
|
109
|
+
* The raw react module. Lazy-loaded on first access.
|
|
110
|
+
*/
|
|
111
|
+
private _getReact;
|
|
112
|
+
/**
|
|
113
|
+
* The React module (createElement, useState, useEffect, etc.)
|
|
114
|
+
*
|
|
115
|
+
* Exposed so consumers don't need a separate react import.
|
|
116
|
+
* Lazy-loaded — first access triggers the import.
|
|
117
|
+
*/
|
|
118
|
+
get React(): typeof import('react');
|
|
119
|
+
/**
|
|
120
|
+
* Pre-load ink + react modules so the sync getters work.
|
|
121
|
+
* Called automatically by render(), but you can call it early.
|
|
122
|
+
*
|
|
123
|
+
* @returns This Ink feature instance for method chaining
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* const ink = container.feature('ink', { enable: true })
|
|
128
|
+
* await ink.loadModules()
|
|
129
|
+
* // Now sync getters like ink.React, ink.components, ink.hooks work
|
|
130
|
+
* const { Box, Text } = ink.components
|
|
131
|
+
* ```
|
|
132
|
+
*/
|
|
133
|
+
loadModules(): Promise<this>;
|
|
134
|
+
/**
|
|
135
|
+
* All Ink components as a single object for destructuring.
|
|
136
|
+
*
|
|
137
|
+
* ```ts
|
|
138
|
+
* const { Box, Text, Static, Spacer } = ink.components
|
|
139
|
+
* ```
|
|
140
|
+
*/
|
|
141
|
+
get components(): {
|
|
142
|
+
Box: typeof import('ink').Box;
|
|
143
|
+
Text: typeof import('ink').Text;
|
|
144
|
+
Static: typeof import('ink').Static;
|
|
145
|
+
Transform: typeof import('ink').Transform;
|
|
146
|
+
Newline: typeof import('ink').Newline;
|
|
147
|
+
Spacer: typeof import('ink').Spacer;
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* All Ink hooks as a single object for destructuring.
|
|
151
|
+
*
|
|
152
|
+
* ```ts
|
|
153
|
+
* const { useInput, useApp, useFocus } = ink.hooks
|
|
154
|
+
* ```
|
|
155
|
+
*/
|
|
156
|
+
get hooks(): {
|
|
157
|
+
useInput: typeof import('ink').useInput;
|
|
158
|
+
useApp: typeof import('ink').useApp;
|
|
159
|
+
useStdin: typeof import('ink').useStdin;
|
|
160
|
+
useStdout: typeof import('ink').useStdout;
|
|
161
|
+
useStderr: typeof import('ink').useStderr;
|
|
162
|
+
useFocus: typeof import('ink').useFocus;
|
|
163
|
+
useFocusManager: typeof import('ink').useFocusManager;
|
|
164
|
+
useCursor: typeof import('ink').useCursor;
|
|
165
|
+
};
|
|
166
|
+
/**
|
|
167
|
+
* The Ink measureElement utility.
|
|
168
|
+
*/
|
|
169
|
+
get measureElement(): typeof import('ink').measureElement;
|
|
170
|
+
/**
|
|
171
|
+
* Mount a React element to the terminal.
|
|
172
|
+
*
|
|
173
|
+
* Wraps `ink.render()` — automatically loads modules if needed,
|
|
174
|
+
* tracks the instance for unmount / waitUntilExit, and updates state.
|
|
175
|
+
*
|
|
176
|
+
* @param node - A React element (JSX or React.createElement)
|
|
177
|
+
* @param options - Ink render options (stdout, stdin, debug, etc.)
|
|
178
|
+
* @returns The Ink instance with rerender, unmount, waitUntilExit, clear
|
|
179
|
+
*/
|
|
180
|
+
render(node: any, options?: Record<string, any>): Promise<any>;
|
|
181
|
+
/**
|
|
182
|
+
* Re-render the currently mounted app with a new root element.
|
|
183
|
+
*
|
|
184
|
+
* @returns void
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```typescript
|
|
188
|
+
* const ink = container.feature('ink', { enable: true })
|
|
189
|
+
* const { React } = await ink.loadModules()
|
|
190
|
+
* const { Text } = ink.components
|
|
191
|
+
*
|
|
192
|
+
* await ink.render(React.createElement(Text, null, 'Hello'))
|
|
193
|
+
* ink.rerender(React.createElement(Text, null, 'Updated!'))
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
rerender(node: any): void;
|
|
197
|
+
/**
|
|
198
|
+
* Unmount the currently mounted Ink app.
|
|
199
|
+
*
|
|
200
|
+
* Tears down the React tree rendered in the terminal and resets state.
|
|
201
|
+
* Safe to call when no app is mounted (no-op).
|
|
202
|
+
*
|
|
203
|
+
* @returns void
|
|
204
|
+
*
|
|
205
|
+
* @example
|
|
206
|
+
* ```typescript
|
|
207
|
+
* const ink = container.feature('ink', { enable: true })
|
|
208
|
+
* await ink.render(myElement)
|
|
209
|
+
* // ... later
|
|
210
|
+
* ink.unmount()
|
|
211
|
+
* console.log(ink.isMounted) // false
|
|
212
|
+
* ```
|
|
213
|
+
*/
|
|
214
|
+
unmount(): void;
|
|
215
|
+
/**
|
|
216
|
+
* Returns a promise that resolves when the mounted app exits.
|
|
217
|
+
*
|
|
218
|
+
* Useful for keeping a script alive while the terminal UI is active.
|
|
219
|
+
*
|
|
220
|
+
* @returns Promise that resolves when the Ink app exits
|
|
221
|
+
* @throws {Error} When no app is currently mounted
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* ```typescript
|
|
225
|
+
* const ink = container.feature('ink', { enable: true })
|
|
226
|
+
* await ink.render(myElement)
|
|
227
|
+
* await ink.waitUntilExit()
|
|
228
|
+
* console.log('App exited')
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
waitUntilExit(): Promise<void>;
|
|
232
|
+
/**
|
|
233
|
+
* Clear the terminal output of the mounted app.
|
|
234
|
+
*
|
|
235
|
+
* Erases all Ink-rendered content from the terminal. Safe to call
|
|
236
|
+
* when no app is mounted (no-op).
|
|
237
|
+
*
|
|
238
|
+
* @returns void
|
|
239
|
+
*
|
|
240
|
+
* @example
|
|
241
|
+
* ```typescript
|
|
242
|
+
* const ink = container.feature('ink', { enable: true })
|
|
243
|
+
* await ink.render(myElement)
|
|
244
|
+
* // ... later, wipe the screen
|
|
245
|
+
* ink.clear()
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
clear(): void;
|
|
249
|
+
/**
|
|
250
|
+
* Whether an ink app is currently mounted.
|
|
251
|
+
*/
|
|
252
|
+
get isMounted(): boolean;
|
|
253
|
+
/**
|
|
254
|
+
* The raw ink render instance if you need low-level access.
|
|
255
|
+
*/
|
|
256
|
+
get instance(): any | null;
|
|
257
|
+
/**
|
|
258
|
+
* Register a named React function component as a renderable block.
|
|
259
|
+
*
|
|
260
|
+
* @param name - Unique block name
|
|
261
|
+
* @param component - A React function component
|
|
262
|
+
* @returns This Ink feature instance for method chaining
|
|
263
|
+
*
|
|
264
|
+
* @example
|
|
265
|
+
* ```typescript
|
|
266
|
+
* ink.registerBlock('Greeting', ({ name }) =>
|
|
267
|
+
* React.createElement(Text, { color: 'green' }, `Hello ${name}!`)
|
|
268
|
+
* )
|
|
269
|
+
* ```
|
|
270
|
+
*/
|
|
271
|
+
registerBlock(name: string, component: Function): this;
|
|
272
|
+
/**
|
|
273
|
+
* Render a registered block by name with optional props.
|
|
274
|
+
*
|
|
275
|
+
* Looks up the component, creates a React element, renders it via ink,
|
|
276
|
+
* then immediately unmounts so the static output stays on screen while
|
|
277
|
+
* freeing the React tree.
|
|
278
|
+
*
|
|
279
|
+
* @param name - The registered block name
|
|
280
|
+
* @param data - Props to pass to the component
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* ```typescript
|
|
284
|
+
* await ink.renderBlock('Greeting', { name: 'Jon' })
|
|
285
|
+
* ```
|
|
286
|
+
*/
|
|
287
|
+
renderBlock(name: string, data?: Record<string, any>): Promise<void>;
|
|
288
|
+
/**
|
|
289
|
+
* Render a registered block that needs to stay mounted for async work.
|
|
290
|
+
*
|
|
291
|
+
* The component receives a `done` prop — a callback it must invoke when
|
|
292
|
+
* it has finished rendering its final output. The React tree stays alive
|
|
293
|
+
* until `done()` is called or the timeout expires.
|
|
294
|
+
*
|
|
295
|
+
* @param name - The registered block name
|
|
296
|
+
* @param data - Props to pass to the component (a `done` prop is added automatically)
|
|
297
|
+
* @param options - `timeout` in ms before force-unmounting (default 30 000)
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```tsx
|
|
301
|
+
* // In a ## Blocks section:
|
|
302
|
+
* function AsyncChart({ url, done }) {
|
|
303
|
+
* const [rows, setRows] = React.useState(null)
|
|
304
|
+
* React.useEffect(() => {
|
|
305
|
+
* fetch(url).then(r => r.json()).then(data => {
|
|
306
|
+
* setRows(data)
|
|
307
|
+
* done()
|
|
308
|
+
* })
|
|
309
|
+
* }, [])
|
|
310
|
+
* if (!rows) return <Text dimColor>Loading...</Text>
|
|
311
|
+
* return <Box><Text>{JSON.stringify(rows)}</Text></Box>
|
|
312
|
+
* }
|
|
313
|
+
*
|
|
314
|
+
* // In a code block:
|
|
315
|
+
* await renderAsync('AsyncChart', { url: 'https://api.example.com/data' })
|
|
316
|
+
* ```
|
|
317
|
+
*/
|
|
318
|
+
renderBlockAsync(name: string, data?: Record<string, any>, options?: {
|
|
319
|
+
timeout?: number;
|
|
320
|
+
}): Promise<void>;
|
|
321
|
+
/**
|
|
322
|
+
* List all registered block names.
|
|
323
|
+
*/
|
|
324
|
+
get blocks(): string[];
|
|
325
|
+
}
|
|
326
|
+
export default Ink;
|
|
327
|
+
declare module '../../feature' {
|
|
328
|
+
interface AvailableFeatures {
|
|
329
|
+
ink: typeof Ink;
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
//# sourceMappingURL=ink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ink.d.ts","sourceRoot":"","sources":["../../../src/node/features/ink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAIvC,eAAO,MAAM,cAAc;;;iBAGzB,CAAA;AACF,KAAK,QAA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