feat(web): add interactive sidebar terminals

This commit is contained in:
Yichen Jiang committed 2026-09-09 16:40:58 +08:00
1 parent 6d99a8a53a
commit e15a9b1bec
132 files changed
+5985 -101

No files matched your search

+83
View File
@@ -183,6 +183,89 @@ Host service backing the generated `ctx.remote.directoryPicker` namespace. The s
Source: [`packages/api/workspace-controller/src/directory-picker.ts`](../../packages/api/workspace-controller/src/directory-picker.ts)
<a id="ctxterminalcontroller--terminalcontroller"></a>
### `ctx.terminalController` — `TerminalController`
Typed Remote control of transient Session-owned terminal processes.
```ts cordis-catalog
/**
* Read the Session working directory and terminal limits without resolving a shell.
* @param agent - Session owner supplied by the Gateway.
* @param signal - request cancellation.
* @returns the Session workspace directory and terminal limits.
*/
@Remote environment(agent: Agent, signal: AbortSignal): TerminalEnvironment
/**
* List running and exited terminals available for reattachment.
* @param agent - Session owner supplied by the Gateway.
* @returns terminals retained for this Host lifetime.
*/
@Remote list(agent: Agent): WebTerminalInfo[]
/**
* Allocate an interactive shell once for a caller-generated identity.
* @param agent - Session owner supplied by the Gateway.
* @param request - initial dimensions and idempotency identity.
* @param signal - allocation cancellation; committed terminals survive disconnection.
* @returns the existing or newly committed terminal.
*/
@Remote async create(agent: Agent, request: TerminalCreateRequest, signal: AbortSignal): Promise<WebTerminalInfo>
/**
* Attach to a terminal without binding its process lifetime to the transport.
* @param agent - Session owner supplied by the Gateway.
* @param id - terminal identity.
* @param attachmentId - new exclusive input attachment.
* @param signal - physical stream cancellation.
* @returns screen recovery followed by output and metadata changes.
*/
@Remote({ mode: 'stream' }) follow(agent: Agent, id: WebTerminalId, attachmentId: TerminalAttachmentId, signal: AbortSignal): AsyncIterable<TerminalFrame>
/**
* Deliver raw input, including Tab completion and control characters.
* @param agent - Session owner supplied by the Gateway.
* @param id - terminal identity.
* @param attachmentId - current writable attachment.
* @param data - input bytes represented as UTF-8 text.
* @returns after provider input acceptance.
*/
@Remote async write(agent: Agent, id: WebTerminalId, attachmentId: TerminalAttachmentId, data: string): Promise<void>
/**
* Update the dimensions of the PTY and recovery screen.
* @param agent - Session owner supplied by the Gateway.
* @param id - terminal identity.
* @param attachmentId - current writable attachment.
* @param cols - column count.
* @param rows - row count.
* @returns after the resize completes.
*/
@Remote async resize(agent: Agent, id: WebTerminalId, attachmentId: TerminalAttachmentId, cols: number, rows: number): Promise<void>
/**
* Rename a terminal without changing its shell.
* @param agent - Session owner supplied by the Gateway.
* @param id - terminal identity.
* @param title - nonempty display title, at most 120 characters.
*/
@Remote rename(agent: Agent, id: WebTerminalId, title: string): void
/**
* Close an identity to future creation and kill its process range; repeated closes succeed.
* @param agent - Session owner supplied by the Gateway.
* @param id - terminal identity.
* @returns after provider cleanup succeeds. A failure retains the terminal for retry.
*/
@Remote async close(agent: Agent, id: WebTerminalId): Promise<void>
```
Types: [Agent](core.md)
Source: [`packages/api/terminal-controller/src/index.ts`](../../packages/api/terminal-controller/src/index.ts)
<a id="ctxworkspacecontroller--workspacecontroller"></a>
### `ctx.workspaceController` — `WorkspaceController`