Files
t3code/packages/effect-acp/src/terminal.ts
9c64f12ea0 Add ACP support with Cursor provider (#1355)
Co-authored-by: codex <[email protected]>
Co-authored-by: Julius Marminge <[email protected]>
Co-authored-by: Cursor Agent <[email protected]>
Co-authored-by: cursor[bot] <206951365+cursor[bot]@users.noreply.github.com>
2026-04-17 16:21:31 -07:00

46 lines
1.8 KiB
TypeScript

import * as Effect from "effect/Effect";
import type * as AcpSchema from "./_generated/schema.gen.ts";
import type * as AcpError from "./errors.ts";
export interface AcpTerminal {
readonly sessionId: string;
readonly terminalId: string;
/** Reads buffered output from the terminal.
* Spec: https://agentclientprotocol.com/protocol/schema#terminal/output
*/
readonly output: Effect.Effect<AcpSchema.TerminalOutputResponse, AcpError.AcpError>;
/** Waits for terminal exit and returns the exit result.
* Spec: https://agentclientprotocol.com/protocol/schema#terminal/wait_for_exit
*/
readonly waitForExit: Effect.Effect<AcpSchema.WaitForTerminalExitResponse, AcpError.AcpError>;
/** Terminates the terminal process.
* Spec: https://agentclientprotocol.com/protocol/schema#terminal/kill
*/
readonly kill: Effect.Effect<AcpSchema.KillTerminalResponse, AcpError.AcpError>;
/** Releases the terminal handle from the ACP session.
* Spec: https://agentclientprotocol.com/protocol/schema#terminal/release
*/
readonly release: Effect.Effect<AcpSchema.ReleaseTerminalResponse, AcpError.AcpError>;
}
export interface MakeTerminalOptions {
readonly sessionId: string;
readonly terminalId: string;
readonly output: Effect.Effect<AcpSchema.TerminalOutputResponse, AcpError.AcpError>;
readonly waitForExit: Effect.Effect<AcpSchema.WaitForTerminalExitResponse, AcpError.AcpError>;
readonly kill: Effect.Effect<AcpSchema.KillTerminalResponse, AcpError.AcpError>;
readonly release: Effect.Effect<AcpSchema.ReleaseTerminalResponse, AcpError.AcpError>;
}
export function makeTerminal(options: MakeTerminalOptions): AcpTerminal {
return {
sessionId: options.sessionId,
terminalId: options.terminalId,
output: options.output,
waitForExit: options.waitForExit,
kill: options.kill,
release: options.release,
};
}