MCPcopy Create free account
hub / github.com/apache/maka / onPtyData

Method onPtyData

packages/runtime/src/shell-run-manager.ts:989–1009  ·  view source on GitHub ↗
(live: LivePtyShellRun, data: string)

Source from the content-addressed store, hash-verified

987 }
988
989 private onPtyData(live: LivePtyShellRun, data: string): void {
990 if (live.driverExit || live.finalizeOnce) return;
991 live.rawBuffer = `${live.rawBuffer}${data}`.slice(-PTY_RAW_REPLAY_CHARS);
992 live.collector.accept(data);
993 for (const chunk of splitPtyData(data)) {
994 const combined = `${live.pendingRawData}${chunk}`;
995 if (live.pendingRawData && encodedPtyDataBytes(combined) > PTY_RAW_PUBLISH_MAX_BYTES) {
996 this.publishPtyData(live);
997 }
998 live.rawSequence += 1;
999 live.pendingRawData += chunk;
1000 if (encodedPtyDataBytes(live.pendingRawData) >= PTY_RAW_PUBLISH_TARGET_BYTES) {
1001 this.publishPtyData(live);
1002 }
1003 }
1004 if (!live.pendingRawData) return;
1005 live.rawPublishTimer ??= setTimeout(() => {
1006 live.rawPublishTimer = undefined;
1007 this.publishPtyData(live);
1008 }, PTY_RAW_PUBLISH_INTERVAL_MS);
1009 }
1010
1011 private publishPtyData(live: LivePtyShellRun): void {
1012 if (live.rawPublishTimer) {

Callers 2

startPtyMethod · 0.95
publishPtyDataMethod · 0.80

Calls 5

publishPtyDataMethod · 0.95
splitPtyDataFunction · 0.85
encodedPtyDataBytesFunction · 0.85
setTimeoutFunction · 0.70
acceptMethod · 0.65

Tested by

no test coverage detected