MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / onTerminalAttach

Method onTerminalAttach

packages/server/src/ws/connection.ts:543–560  ·  view source on GitHub ↗
(msg: TerminalAttachMessage)

Source from the content-addressed store, hash-verified

541 }
542
543 private onTerminalAttach(msg: TerminalAttachMessage): void {
544 if (this.terminalHandler === undefined) {
545 this.send(buildAck(msg.id, ErrorCode.INTERNAL_ERROR, 'terminal handler not wired', {}));
546 return;
547 }
548 const { session_id, terminal_id, since_seq } = msg.payload;
549 this.terminalHandler
550 .attach(session_id, terminal_id, this, { sinceSeq: since_seq })
551 .then((result) => {
552 this.send(buildAck(msg.id, 0, 'success', {
553 attached: true,
554 replayed: result.replayed,
555 }));
556 })
557 .catch((err: unknown) => {
558 this.sendTerminalErrorAck(msg.id, err, 'terminal_attach failed');
559 });
560 }
561
562 private onTerminalDetach(msg: TerminalDetachMessage): void {
563 if (this.terminalHandler === undefined) {

Callers 1

onMessageMethod · 0.95

Calls 4

sendMethod · 0.95
sendTerminalErrorAckMethod · 0.95
buildAckFunction · 0.90
attachMethod · 0.65

Tested by

no test coverage detected