Last active
August 27, 2026 12:39
-
-
Save jlongster/8931cd754d740f36ee4108a9609313e4 to your computer and use it in GitHub Desktop.
OpenCode TUI shell completion jump demo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { defineScript, Effect, Llm } from "opencode-drive" | |
| export default defineScript({ | |
| config: { | |
| permission: { | |
| shell: "allow", | |
| external_directory: "allow", | |
| }, | |
| }, | |
| tuiConfig: { | |
| theme: "opencode", | |
| }, | |
| project: { | |
| git: true, | |
| files: { | |
| "README.md": "# Shell jump demo\n", | |
| }, | |
| }, | |
| run: ({ ui, llm }) => | |
| Effect.gen(function* () { | |
| yield* ui.resize({ cols: 100, rows: 28 }) | |
| yield* llm.queue( | |
| Llm.text("I will start the build in the background."), | |
| Llm.toolCall({ | |
| index: 0, | |
| id: "call_shell_jump_demo", | |
| name: "shell", | |
| input: { | |
| command: "printf 'background shell started\\n'; sleep 2; printf 'background shell complete\\n'", | |
| background: true, | |
| }, | |
| }), | |
| Llm.finish("tool-calls"), | |
| ) | |
| yield* llm.queue( | |
| Llm.text( | |
| Array.from({ length: 30 }, (_, index) => | |
| `Build preparation ${index + 1}: validating deterministic demo fixture.`, | |
| ).join("\n\n"), | |
| { delay: 8, chunkSize: 24 }, | |
| ), | |
| ) | |
| yield* llm.queue(Llm.text("The background build notification was received.")) | |
| yield* ui.submit("Start the demo build in the background and continue preparing it.") | |
| yield* ui.waitFor("Shell finished", { timeout: 20_000 }) | |
| yield* Effect.sleep(1_000) | |
| yield* ui.screenshot("shell-finished") | |
| const completion = yield* ui.getElement("shell-completion:call_shell_jump_demo") | |
| yield* ui.click(completion) | |
| yield* ui.waitFor("background shell started", { timeout: 10_000 }) | |
| yield* Effect.sleep(1_500) | |
| yield* ui.screenshot("shell-start") | |
| }), | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment