opencode-vim
Advanced tools
+9
-0
@@ -16,2 +16,3 @@ { | ||
| "@opencode-ai/plugin": "1.14.44", | ||
| "@types/bun": "^1.3.14", | ||
| }, | ||
@@ -123,2 +124,6 @@ }, | ||
| "@types/bun": ["@types/bun@1.3.14", "", { "dependencies": { "bun-types": "1.3.14" } }, "sha512-h1hFqFVcvAvD9j9K7ZW7vd82aSA+rTdznZa+5bwvCwqSB1jmmfLcbIWhOLx1/+boy/xmjgCs/OMUL8hRJSmnPw=="], | ||
| "@types/node": ["@types/node@25.7.0", "", { "dependencies": { "undici-types": "~7.21.0" } }, "sha512-z+pdZyxE+RTQE9AcboAZCb4otwcrvgHD+GlBpPgn0emDVt0ohrTMhAwlr2Wd9nZ+nihhYFxO2pThz3C5qSu2Eg=="], | ||
| "@vimee/core": ["@vimee/core@0.3.0", "", {}, "sha512-aC44fw6HhmjrbJMafAk3oUZIDpFbgNebbDsWwMIFD0WwnOUZPETgzU3HYQetmwz0e38JY3I/g8CJXRQjspgJZw=="], | ||
@@ -144,2 +149,4 @@ | ||
| "bun-types": ["bun-types@1.3.14", "", { "dependencies": { "@types/node": "*" } }, "sha512-4N0ig0fEomHt5R0KCFWjovxow98rIoRwKolrYdCcknNwMekCXRnWEUvgu5soYV8QXtVsrUD8B95MBOZGPvr6KQ=="], | ||
| "caniuse-lite": ["caniuse-lite@1.0.30001791", "", {}, "sha512-yk0l/YSrOnFZk3UROpDLQD9+kC1l4meK/wed583AXrzoarMGJcbRi2Q4RaUYbKxYAsZ8sWmaSa/DsLmdBeI1vQ=="], | ||
@@ -279,2 +286,4 @@ | ||
| "undici-types": ["undici-types@7.21.0", "", {}, "sha512-w9IMgQrz4O0YN1LtB7K5P63vhlIOvC7opSmouCJ+ZywlPAlO9gIkJ+otk6LvGpAs2wg4econaCz3TvQ9xPoyuQ=="], | ||
| "update-browserslist-db": ["update-browserslist-db@1.2.3", "", { "dependencies": { "escalade": "^3.2.0", "picocolors": "^1.1.1" }, "peerDependencies": { "browserslist": ">= 4.21.0" }, "bin": { "update-browserslist-db": "cli.js" } }, "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w=="], | ||
@@ -281,0 +290,0 @@ |
+3
-2
| { | ||
| "name": "opencode-vim", | ||
| "version": "0.0.13", | ||
| "version": "0.0.14", | ||
| "exports": { | ||
@@ -17,4 +17,5 @@ "./tui": { | ||
| "devDependencies": { | ||
| "@opencode-ai/plugin": "1.14.44" | ||
| "@opencode-ai/plugin": "1.14.44", | ||
| "@types/bun": "^1.3.14" | ||
| } | ||
| } |
+22
-9
@@ -5,5 +5,4 @@ /** @jsxImportSource @opentui/solid */ | ||
| import { HostPrompt } from "./host" | ||
| import { sortModules } from "./modules" | ||
| import { createPromptRef } from "./ref" | ||
| import type { PromptRootProps } from "./types" | ||
| import { notifyPromptRef, sortModules } from "./modules" | ||
| import type { PromptContext, PromptRootProps } from "./types" | ||
@@ -13,13 +12,27 @@ export function PromptRoot(props: PromptRootProps) { | ||
| const api = props.api | ||
| const ctx = createPromptRef(modules, { | ||
| let current: ReturnType<PromptContext["prompt"]> | ||
| const ctx: PromptContext = { | ||
| api, | ||
| slot: props.slot, | ||
| kind: props.kind, | ||
| sessionID: props.sessionID, | ||
| workspaceID: props.workspaceID, | ||
| visible: props.visible, | ||
| disabled: props.disabled, | ||
| get sessionID() { | ||
| return props.sessionID | ||
| }, | ||
| get workspaceID() { | ||
| return props.workspaceID | ||
| }, | ||
| get visible() { | ||
| return props.visible | ||
| }, | ||
| get disabled() { | ||
| return props.disabled | ||
| }, | ||
| prompt: () => current, | ||
| setPromptRef(ref) { | ||
| current = ref | ||
| notifyPromptRef(modules, ref, ctx) | ||
| }, | ||
| submitHost: () => props.onSubmit?.(), | ||
| requestRender: () => api.renderer.requestRender(), | ||
| }) | ||
| } | ||
@@ -26,0 +39,0 @@ const cleanups = modules.flatMap((module) => { |
| import type { TuiPromptRef } from "@opencode-ai/plugin/tui" | ||
| import type { PromptContext, PromptModule } from "./types" | ||
| import { notifyPromptRef } from "./modules" | ||
| export function createPromptRef(modules: PromptModule[], ctx: Omit<PromptContext, "prompt" | "setPromptRef">) { | ||
| let current: TuiPromptRef | undefined | ||
| const context = { | ||
| ...ctx, | ||
| prompt: () => current, | ||
| setPromptRef(ref: TuiPromptRef | undefined) { | ||
| current = ref | ||
| notifyPromptRef(modules, ref, context) | ||
| }, | ||
| } satisfies PromptContext | ||
| return context | ||
| } |
1148904
0.05%2
100%32
-3.03%2778
-0.07%