vibe-coding-master 0.4.21 → 0.4.23
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.
- package/dist/backend/server.js +5 -1
- package/dist/backend/services/claude-transcript-service.js +1 -1
- package/dist/backend/services/translation-service.js +15 -2
- package/dist/backend/ws/terminal-ws.js +31 -2
- package/dist-frontend/assets/{index-_aOTGZCq.js → index-CykS6Wit.js} +39 -39
- package/dist-frontend/index.html +1 -1
- package/package.json +1 -1
package/dist/backend/server.js
CHANGED
|
@@ -49,8 +49,12 @@ import { toVcmError } from "./errors.js";
|
|
|
49
49
|
import { readVcmPackageVersion } from "./app-version.js";
|
|
50
50
|
export async function createServer(deps, options = {}) {
|
|
51
51
|
const app = Fastify({
|
|
52
|
-
logger: false
|
|
52
|
+
logger: false,
|
|
53
|
+
keepAliveTimeout: 10000,
|
|
54
|
+
requestTimeout: 30000
|
|
53
55
|
});
|
|
56
|
+
app.server.headersTimeout = 15000;
|
|
57
|
+
app.server.maxRequestsPerSocket = 100;
|
|
54
58
|
app.setErrorHandler((error, _request, reply) => {
|
|
55
59
|
const vcmError = toVcmError(error);
|
|
56
60
|
reply.status(vcmError.statusCode).send({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { closeSync, existsSync, openSync, readdirSync, readFileSync, readSync, statSync, watch as fsWatch } from "node:fs";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
|
-
const DEFAULT_TAIL_POLL_INTERVAL_MS =
|
|
4
|
+
const DEFAULT_TAIL_POLL_INTERVAL_MS = 1000;
|
|
5
5
|
/**
|
|
6
6
|
* Adapted from CodingForMoney/cc-pm's transcript tailer.
|
|
7
7
|
*
|
|
@@ -548,6 +548,8 @@ export function createTranslationService(deps) {
|
|
|
548
548
|
state.entries = [];
|
|
549
549
|
state.nextSeq = 1;
|
|
550
550
|
}
|
|
551
|
+
await state.persistChain?.catch(() => undefined);
|
|
552
|
+
sessionStates.delete(sessionId);
|
|
551
553
|
}
|
|
552
554
|
return {
|
|
553
555
|
async startSession(input) {
|
|
@@ -574,8 +576,16 @@ export function createTranslationService(deps) {
|
|
|
574
576
|
};
|
|
575
577
|
},
|
|
576
578
|
async pollSessionEvents(sessionId, after, limit = 200) {
|
|
577
|
-
const state = getState(sessionId);
|
|
578
579
|
const cursor = Number.isFinite(after) ? Math.max(1, Math.floor(after)) : 1;
|
|
580
|
+
const state = sessionStates.get(sessionId);
|
|
581
|
+
if (!state) {
|
|
582
|
+
return {
|
|
583
|
+
sessionId,
|
|
584
|
+
status: "ready",
|
|
585
|
+
nextCursor: cursor,
|
|
586
|
+
events: []
|
|
587
|
+
};
|
|
588
|
+
}
|
|
579
589
|
const maxEvents = Math.min(Math.max(1, Math.floor(limit)), 500);
|
|
580
590
|
await compactEventsBefore(state, cursor);
|
|
581
591
|
const events = state.events
|
|
@@ -799,7 +809,10 @@ export function createTranslationService(deps) {
|
|
|
799
809
|
};
|
|
800
810
|
},
|
|
801
811
|
async clearSession(sessionId) {
|
|
802
|
-
const state =
|
|
812
|
+
const state = sessionStates.get(sessionId);
|
|
813
|
+
if (!state) {
|
|
814
|
+
return;
|
|
815
|
+
}
|
|
803
816
|
state.entries = [];
|
|
804
817
|
state.failures.clear();
|
|
805
818
|
state.events = [];
|
|
@@ -15,6 +15,8 @@ export function registerTerminalWs(app, deps) {
|
|
|
15
15
|
}
|
|
16
16
|
function bindTerminalSocket(ws, sessionId, runtime) {
|
|
17
17
|
let unsubscribe = () => { };
|
|
18
|
+
let alive = true;
|
|
19
|
+
let closed = false;
|
|
18
20
|
try {
|
|
19
21
|
unsubscribe = runtime.subscribe(sessionId, (event) => {
|
|
20
22
|
if (event.type === "output") {
|
|
@@ -34,6 +36,25 @@ function bindTerminalSocket(ws, sessionId, runtime) {
|
|
|
34
36
|
ws.close();
|
|
35
37
|
return;
|
|
36
38
|
}
|
|
39
|
+
const heartbeat = setInterval(() => {
|
|
40
|
+
if (closed) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
if (ws.readyState !== ws.OPEN) {
|
|
44
|
+
cleanup();
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (!alive) {
|
|
48
|
+
cleanup();
|
|
49
|
+
ws.terminate();
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
alive = false;
|
|
53
|
+
ws.ping();
|
|
54
|
+
}, TERMINAL_WS_HEARTBEAT_MS);
|
|
55
|
+
ws.on("pong", () => {
|
|
56
|
+
alive = true;
|
|
57
|
+
});
|
|
37
58
|
ws.on("message", (raw) => {
|
|
38
59
|
try {
|
|
39
60
|
const message = JSON.parse(raw.toString());
|
|
@@ -51,9 +72,16 @@ function bindTerminalSocket(ws, sessionId, runtime) {
|
|
|
51
72
|
send(ws, { type: "error", message: vcmError.message });
|
|
52
73
|
}
|
|
53
74
|
});
|
|
54
|
-
ws.on("close",
|
|
75
|
+
ws.on("close", cleanup);
|
|
76
|
+
ws.on("error", cleanup);
|
|
77
|
+
function cleanup() {
|
|
78
|
+
if (closed) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
closed = true;
|
|
82
|
+
clearInterval(heartbeat);
|
|
55
83
|
unsubscribe();
|
|
56
|
-
}
|
|
84
|
+
}
|
|
57
85
|
}
|
|
58
86
|
export function isSafeTerminalResize(cols, rows) {
|
|
59
87
|
return (Number.isInteger(cols) &&
|
|
@@ -67,6 +95,7 @@ const MIN_TERMINAL_COLS = 20;
|
|
|
67
95
|
const MIN_TERMINAL_ROWS = 5;
|
|
68
96
|
const MAX_TERMINAL_COLS = 1000;
|
|
69
97
|
const MAX_TERMINAL_ROWS = 200;
|
|
98
|
+
const TERMINAL_WS_HEARTBEAT_MS = 30000;
|
|
70
99
|
function send(ws, message) {
|
|
71
100
|
if (ws.readyState === ws.OPEN) {
|
|
72
101
|
ws.send(JSON.stringify(message));
|