Download src/stores/command-store.ts from SaylorTwift/openhands: direct link, hf CLI and curl.
- Browser
- Download file 672 Bytes
-
https://huggingface.co/SaylorTwift/openhands/resolve/main/src/stores/command-store.ts
- Command line
-
hf download hf://SaylorTwift/openhands/src/stores/command-store.ts
-
curl -L -o command-store.ts https://huggingface.co/SaylorTwift/openhands/resolve/main/src/stores/command-store.ts
672 Bytes
| import { create } from "zustand"; | |
| export type Command = { | |
| content: string; | |
| type: "input" | "output"; | |
| }; | |
| interface CommandState { | |
| commands: Command[]; | |
| appendInput: (content: string) => void; | |
| appendOutput: (content: string) => void; | |
| clearTerminal: () => void; | |
| } | |
| export const useCommandStore = create<CommandState>((set) => ({ | |
| commands: [], | |
| appendInput: (content: string) => | |
| set((state) => ({ | |
| commands: [...state.commands, { content, type: "input" }], | |
| })), | |
| appendOutput: (content: string) => | |
| set((state) => ({ | |
| commands: [...state.commands, { content, type: "output" }], | |
| })), | |
| clearTerminal: () => set({ commands: [] }), | |
| })); | |