Files
cosmos-explorer/src/hooks/useTerminal.ts
T
jawelton74andCopilot d19c7e0cb7 Remove Phoenix & Notebooks — Phase 1: Decouple database shells to CloudShell (#2513)
* Add implementation plan for removing Phoenix and notebooks

Co-authored-by: Copilot <[email protected]>

* Phase 1: Decouple database shells from Phoenix to CloudShell-only

Migrate all shell terminals to the CloudShell path and remove the legacy Phoenix notebook-server terminal code so shells no longer depend on notebook provisioning.

- TerminalTab now always uses CloudShellTerminalComponentAdapter; removed the notebook-server adapter branch, getNotebookServerInfo, and the dead VCoreMongo firewall check
- Migrate Postgres and VCore Mongo quickstart tabs to CloudShellTerminalComponent (drop allocateContainer/useNotebook dependencies)
- Refactor useTerminal to send input via the CloudShell WebSocket instead of postRobot/iframe; register the socket from CloudShellTerminalComponent
- Simplify Explorer.openNotebookTerminal to always open a CloudShell terminal
- Delete NotebookTerminalComponent(+test/less/snapshot), NotebookTerminalComponentAdapter, and the src/Terminal/ entry point
- Remove the terminal.html webpack entry/HTML plugin and src/Terminal from tsconfig.strict.json

Co-authored-by: Copilot <[email protected]>

---------

Co-authored-by: Copilot <[email protected]>
2026-06-15 06:29:14 -07:00

21 lines
556 B
TypeScript

import create, { UseStore } from "zustand";
interface TerminalState {
socket: WebSocket | undefined;
setSocket: (socket: WebSocket | undefined) => void;
sendMessage: (message: string) => void;
}
export const useTerminal: UseStore<TerminalState> = create((set, get) => ({
socket: undefined,
setSocket: (socket: WebSocket | undefined) => {
set({ socket });
},
sendMessage: (message: string) => {
const socket = get().socket;
if (socket && socket.readyState === WebSocket.OPEN) {
socket.send(message + "\r");
}
},
}));