diff --git a/bun.lock b/bun.lock index d39104dbc..5cca04492 100644 --- a/bun.lock +++ b/bun.lock @@ -154,8 +154,8 @@ "@openauthjs/openauth": "catalog:", "@opencode-ai/plugin": "workspace:*", "@opencode-ai/sdk": "workspace:*", - "@opentui/core": "0.1.26", - "@opentui/solid": "0.1.26", + "@opentui/core": "0.0.0-20251010-2eed09fd", + "@opentui/solid": "0.0.0-20251010-2eed09fd", "@parcel/watcher": "2.5.1", "@standard-schema/spec": "1.0.0", "@zip.js/zip.js": "2.7.62", @@ -836,21 +836,21 @@ "@opentelemetry/api": ["@opentelemetry/api@1.9.0", "", {}, "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg=="], - "@opentui/core": ["@opentui/core@0.1.26", "", { "dependencies": { "jimp": "1.6.0", "yoga-layout": "3.2.1" }, "optionalDependencies": { "@dimforge/rapier2d-simd-compat": "^0.17.3", "@opentui/core-darwin-arm64": "0.1.26", "@opentui/core-darwin-x64": "0.1.26", "@opentui/core-linux-arm64": "0.1.26", "@opentui/core-linux-x64": "0.1.26", "@opentui/core-win32-arm64": "0.1.26", "@opentui/core-win32-x64": "0.1.26", "bun-webgpu": "0.1.3", "planck": "^1.4.2", "three": "0.177.0" }, "peerDependencies": { "web-tree-sitter": ">=0.26.0" } }, "sha512-4XvUSWV1wa+81LqmYtKiKOSGoO0jon+DNPZskuEhayBHU76EcllbibxeH5QxlwHGC24ZTSZUiBLmFhcbAPKJRw=="], + "@opentui/core": ["@opentui/core@0.0.0-20251010-2eed09fd", "", { "dependencies": { "jimp": "1.6.0", "yoga-layout": "3.2.1" }, "optionalDependencies": { "@dimforge/rapier2d-simd-compat": "^0.17.3", "@opentui/core-darwin-arm64": "0.0.0-20251010-2eed09fd", "@opentui/core-darwin-x64": "0.0.0-20251010-2eed09fd", "@opentui/core-linux-arm64": "0.0.0-20251010-2eed09fd", "@opentui/core-linux-x64": "0.0.0-20251010-2eed09fd", "@opentui/core-win32-arm64": "0.0.0-20251010-2eed09fd", "@opentui/core-win32-x64": "0.0.0-20251010-2eed09fd", "bun-webgpu": "0.1.3", "planck": "^1.4.2", "three": "0.177.0" }, "peerDependencies": { "web-tree-sitter": ">=0.26.0" } }, "sha512-Pj5ZDN7/EORb+esBgxwr43g0a4caBlYfvSOeu3SHl8QwPRf7B5AaLyHzEtmhSOlPHBgRU4RlipyOqSw57OLz6w=="], - "@opentui/core-darwin-arm64": ["@opentui/core-darwin-arm64@0.1.26", "", { "os": "darwin", "cpu": "arm64" }, "sha512-YuRUKG2Yq2K146Ley+J3KH/TW8KlXzPgaC1RnSsLqwmE2f9fTZw5fuLJndgMyQ7ZBzfOJsu+pUWQ9Lgc4ZmBVw=="], + "@opentui/core-darwin-arm64": ["@opentui/core-darwin-arm64@0.0.0-20251010-2eed09fd", "", { "os": "darwin", "cpu": "arm64" }, "sha512-zZemVOZqJTErSUPYlMDpauXnncmyy3gjUM1Eg2Bs4doUz6UF4XWHjJXoNjue4RQOm+hVjTqL+ZdbJ3N35tqkeg=="], - "@opentui/core-darwin-x64": ["@opentui/core-darwin-x64@0.1.26", "", { "os": "darwin", "cpu": "x64" }, "sha512-6hd/SRYIwF7OjkhmBAu+r5/ykruXl+/aBbiPjXtS65b8QnrHK+DfhsSP5sYo7UNLb0KWPQ0ZClmRUvEsXLUotQ=="], + "@opentui/core-darwin-x64": ["@opentui/core-darwin-x64@0.0.0-20251010-2eed09fd", "", { "os": "darwin", "cpu": "x64" }, "sha512-WDSgh029m//DX7GZR53usQANw1aR+jQ2x9c6Muk44k8ll3FDdhC/hLaa5XsQfkrzXdJOXWG5wcLVH6bBxf9ghw=="], - "@opentui/core-linux-arm64": ["@opentui/core-linux-arm64@0.1.26", "", { "os": "linux", "cpu": "arm64" }, "sha512-Gl4j2VND1rxvxs6fp7l5XxK4xGBK9UOXoOA+JWez5cgCdDWpp8qBZYXg1z6dxgH8JX6va6KHlPe4RfwZ9ulYAA=="], + "@opentui/core-linux-arm64": ["@opentui/core-linux-arm64@0.0.0-20251010-2eed09fd", "", { "os": "linux", "cpu": "arm64" }, "sha512-q6gINg5C5vsZTzG0FsyU0l8HBDBzs6ylLgWLZAGrNzj+dwhPVBWZzbFTPpHhyePfhzCuppdOLtufh4lMSiMRIw=="], - "@opentui/core-linux-x64": ["@opentui/core-linux-x64@0.1.26", "", { "os": "linux", "cpu": "x64" }, "sha512-f+iV5FZM8Pn7LMx3o5avW711+mq7REBygTOaxuKj8tI7y3UA1WYUsQNh/vW9LPLx1hAcwhCbgktj4IRUoZ0lNw=="], + "@opentui/core-linux-x64": ["@opentui/core-linux-x64@0.0.0-20251010-2eed09fd", "", { "os": "linux", "cpu": "x64" }, "sha512-9yRwcee0YSEy5pqhtqhvwzv60YLYrJJ+AjdDYCWShN9ZhHBVnQsdvQjZlhrsam+nxhcOX6v/2ieYz0579AyxnQ=="], - "@opentui/core-win32-arm64": ["@opentui/core-win32-arm64@0.1.26", "", { "os": "win32", "cpu": "arm64" }, "sha512-WXV9A2Oriq+0zNKih4rOLcto0UPQw0l0cVJcgZYT85JpX5ZI2ubV6UvwnMvHzzcYzhel994iycRJqree+QC7zw=="], + "@opentui/core-win32-arm64": ["@opentui/core-win32-arm64@0.0.0-20251010-2eed09fd", "", { "os": "win32", "cpu": "arm64" }, "sha512-DtZV085HuhlRMPDCdtnMt6l/IUUJAooSOvqbpfQPDHVU9Qo7bZtlS+RSyCLyViyLtbJ+2QoQfBZ4AH1GhwuMeg=="], - "@opentui/core-win32-x64": ["@opentui/core-win32-x64@0.1.26", "", { "os": "win32", "cpu": "x64" }, "sha512-xFjiCMAh1MaoS2VyAvBpR9pTeyt8jRCA01wpEWhY+DWO5oyW0txdeLJxuvrMCfr6w14ath0oBOou1EFNTpl6+w=="], + "@opentui/core-win32-x64": ["@opentui/core-win32-x64@0.0.0-20251010-2eed09fd", "", { "os": "win32", "cpu": "x64" }, "sha512-x000JX5HIDk6dfPMSWBk01rUWnkeigyB0oqZaAa8pNMfyfNpnlRNyQAk6WwBEi/QRywBQS9pEewt/fPpwMD48g=="], - "@opentui/solid": ["@opentui/solid@0.1.26", "", { "dependencies": { "@babel/core": "7.28.0", "@babel/preset-typescript": "7.27.1", "@opentui/core": "0.1.26", "babel-plugin-module-resolver": "5.0.2", "babel-preset-solid": "1.9.9", "s-js": "^0.4.9" }, "peerDependencies": { "solid-js": "1.9.9" } }, "sha512-7vglBhD3QaLlnexiUHvM2eVZm0/6Yy1PRWnFjFHhXf3sigT5Xc7BoqvDogXtjaiBCCGgS2T0gi431kCtU44/GA=="], + "@opentui/solid": ["@opentui/solid@0.0.0-20251010-2eed09fd", "", { "dependencies": { "@babel/core": "7.28.0", "@babel/preset-typescript": "7.27.1", "@opentui/core": "0.0.0-20251010-2eed09fd", "babel-plugin-module-resolver": "5.0.2", "babel-preset-solid": "1.9.9", "s-js": "^0.4.9" }, "peerDependencies": { "solid-js": "1.9.9" } }, "sha512-P+rDSIvkNfhp1vRN7XwPFe8PS6BAYRQL11gH2eZ0mzt7tKHxYFbVyhmTtNwxxDs2jrVeyYedUI0sLtH8ONsDmg=="], "@oslojs/asn1": ["@oslojs/asn1@1.0.0", "", { "dependencies": { "@oslojs/binary": "1.0.0" } }, "sha512-zw/wn0sj0j0QKbIXfIlnEcTviaCzYOY3V5rAyjR6YtOByFtJiT574+8p9Wlach0lZH9fddD4yb9laEAIl4vXQA=="], diff --git a/packages/opencode/package.json b/packages/opencode/package.json index 77a29c52a..bdd8511a3 100644 --- a/packages/opencode/package.json +++ b/packages/opencode/package.json @@ -40,8 +40,8 @@ "@openauthjs/openauth": "catalog:", "@opencode-ai/plugin": "workspace:*", "@opencode-ai/sdk": "workspace:*", - "@opentui/core": "0.1.26", - "@opentui/solid": "0.1.26", + "@opentui/core": "0.0.0-20251010-2eed09fd", + "@opentui/solid": "0.0.0-20251010-2eed09fd", "@parcel/watcher": "2.5.1", "@standard-schema/spec": "1.0.0", "@zip.js/zip.js": "2.7.62", diff --git a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx index 2dbff930a..16460373a 100644 --- a/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx +++ b/packages/opencode/src/cli/cmd/tui/component/prompt/index.tsx @@ -12,6 +12,8 @@ import { useKeybind } from "@tui/context/keybind" import { usePromptHistory, type PromptInfo } from "./history" import { type AutocompleteRef, Autocomplete } from "./autocomplete" import { iife } from "@/util/iife" +import { useCommandDialog } from "../dialog-command" +import { useRenderer } from "@opentui/solid" export type PromptProps = { sessionID?: string @@ -41,6 +43,35 @@ export function Prompt(props: PromptProps) { const sync = useSync() const status = createMemo(() => (props.sessionID ? sync.session.status(props.sessionID) : "idle")) const history = usePromptHistory() + const command = useCommandDialog() + const renderer = useRenderer() + + command.register(() => { + return [ + { + title: "Open editor", + category: "Session", + keybind: "editor_open", + value: "prompt.editor", + onSelect: async () => { + renderer.suspend() + // asni code to clear + /* @ts-ignore */ + // renderer.writeOut("\x1b[2J\x1b[H") + renderer.currentRenderBuffer.clear() + const proc = Bun.spawn({ + cmd: ["nvim"], + stdin: "inherit", + stdout: "inherit", + stderr: "inherit", + }) + await proc.exited + renderer.resume() + renderer.requestRender() + }, + }, + ] + }) createEffect(() => { if (props.disabled) input.cursorColor = Theme.backgroundElement