vibe-coding-master 0.3.31 → 0.3.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -44,6 +44,7 @@ export function createNodePtyTerminalRuntime(deps) {
|
|
|
44
44
|
process: child,
|
|
45
45
|
listeners: new Set(),
|
|
46
46
|
logWriter,
|
|
47
|
+
replayBuffer: "",
|
|
47
48
|
disposed: false
|
|
48
49
|
};
|
|
49
50
|
entries.set(session.id, entry);
|
|
@@ -52,6 +53,7 @@ export function createNodePtyTerminalRuntime(deps) {
|
|
|
52
53
|
return;
|
|
53
54
|
}
|
|
54
55
|
entry.session.lastOutputAt = now();
|
|
56
|
+
entry.replayBuffer = appendTerminalReplay(entry.replayBuffer, data);
|
|
55
57
|
entry.logWriter.append(data);
|
|
56
58
|
emit(entry, {
|
|
57
59
|
sessionId: session.id,
|
|
@@ -138,7 +140,18 @@ export function createNodePtyTerminalRuntime(deps) {
|
|
|
138
140
|
subscribe(sessionId, listener, options = {}) {
|
|
139
141
|
const entry = getEntry(entries, sessionId);
|
|
140
142
|
entry.listeners.add(listener);
|
|
141
|
-
if (options.replay !== false && entry.
|
|
143
|
+
if (options.replay !== false && entry.replayBuffer) {
|
|
144
|
+
listener({
|
|
145
|
+
id: `evt_${Date.now()}_${Math.random().toString(16).slice(2)}`,
|
|
146
|
+
sessionId,
|
|
147
|
+
taskSlug: entry.session.taskSlug,
|
|
148
|
+
role: entry.session.role,
|
|
149
|
+
type: "output",
|
|
150
|
+
timestamp: now(),
|
|
151
|
+
data: entry.replayBuffer
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
else if (options.replay !== false && entry.input.logPath) {
|
|
142
155
|
void readTerminalReplayText(deps.fs, entry.input.logPath)
|
|
143
156
|
.then((data) => {
|
|
144
157
|
if (!data || !entry.listeners.has(listener)) {
|
|
@@ -228,6 +241,12 @@ export function tailTerminalReplay(data, limitBytes = TERMINAL_REPLAY_TAIL_LIMIT
|
|
|
228
241
|
const firstLineBreak = tail.indexOf("\n");
|
|
229
242
|
return firstLineBreak >= 0 ? tail.slice(firstLineBreak + 1) : tail;
|
|
230
243
|
}
|
|
244
|
+
export function appendTerminalReplay(current, data, limitBytes = TERMINAL_REPLAY_TAIL_LIMIT_BYTES) {
|
|
245
|
+
if (!data) {
|
|
246
|
+
return current;
|
|
247
|
+
}
|
|
248
|
+
return tailTerminalReplay(`${current}${data}`, limitBytes);
|
|
249
|
+
}
|
|
231
250
|
export function buildPtyEnvironment(baseEnv, inputEnv = {}) {
|
|
232
251
|
const env = {
|
|
233
252
|
...baseEnv,
|