vibe-coding-master 0.3.5 → 0.3.7
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/adapters/filesystem.js +2 -5
- package/dist/backend/api/diagnostics-routes.js +5 -0
- package/dist/backend/api/harness-routes.js +49 -3
- package/dist/backend/api/message-routes.js +18 -2
- package/dist/backend/errors.js +6 -0
- package/dist/backend/gateway/gateway-service.js +5 -0
- package/dist/backend/server.js +14 -3
- package/dist/backend/services/diagnostics-service.js +74 -0
- package/dist/backend/services/project-service.js +0 -3
- package/dist/backend/services/translation-service.js +15 -0
- package/dist/shared/types/diagnostics.js +1 -0
- package/dist-frontend/assets/{index-j8A25Nt8.js → index-CFp1kZpa.js} +5 -5
- package/dist-frontend/index.html +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import fs from "node:fs/promises";
|
|
2
2
|
import path from "node:path";
|
|
3
|
+
import { isOpenFileLimitError } from "../errors.js";
|
|
3
4
|
export function createNodeFileSystemAdapter() {
|
|
4
5
|
const runFileOperation = createFileOperationRunner();
|
|
5
6
|
return {
|
|
@@ -81,7 +82,7 @@ export function createNodeFileSystemAdapter() {
|
|
|
81
82
|
}
|
|
82
83
|
};
|
|
83
84
|
}
|
|
84
|
-
const DEFAULT_FILE_OPERATION_CONCURRENCY =
|
|
85
|
+
const DEFAULT_FILE_OPERATION_CONCURRENCY = 8;
|
|
85
86
|
const OPEN_FILE_RETRY_DELAYS_MS = [25, 50, 100, 200, 400, 800];
|
|
86
87
|
function createFileOperationRunner(maxConcurrent = DEFAULT_FILE_OPERATION_CONCURRENCY) {
|
|
87
88
|
let active = 0;
|
|
@@ -127,10 +128,6 @@ async function retryOpenFileLimit(operation) {
|
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
}
|
|
130
|
-
function isOpenFileLimitError(error) {
|
|
131
|
-
const code = getErrorCode(error);
|
|
132
|
-
return code === "EMFILE" || code === "ENFILE";
|
|
133
|
-
}
|
|
134
131
|
function isMissingPathError(error) {
|
|
135
132
|
const code = getErrorCode(error);
|
|
136
133
|
return code === "ENOENT" || code === "ENOTDIR";
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import { VcmError } from "../errors.js";
|
|
1
|
+
import { isOpenFileLimitError, VcmError } from "../errors.js";
|
|
2
2
|
export function registerHarnessRoutes(app, deps) {
|
|
3
3
|
app.get("/api/projects/harness", async () => {
|
|
4
4
|
const project = await requireCurrentProject(deps.projectService);
|
|
5
|
-
|
|
5
|
+
try {
|
|
6
|
+
return await deps.harnessService.getHarnessStatus(project.repoRoot);
|
|
7
|
+
}
|
|
8
|
+
catch (error) {
|
|
9
|
+
if (isOpenFileLimitError(error)) {
|
|
10
|
+
return degradedHarnessStatus(error);
|
|
11
|
+
}
|
|
12
|
+
throw error;
|
|
13
|
+
}
|
|
6
14
|
});
|
|
7
15
|
app.post("/api/projects/harness/apply", async () => {
|
|
8
16
|
const project = await requireCurrentProject(deps.projectService);
|
|
@@ -10,13 +18,51 @@ export function registerHarnessRoutes(app, deps) {
|
|
|
10
18
|
});
|
|
11
19
|
app.get("/api/projects/harness/bootstrap", async () => {
|
|
12
20
|
const project = await requireCurrentProject(deps.projectService);
|
|
13
|
-
|
|
21
|
+
try {
|
|
22
|
+
return await deps.harnessService.getBootstrapStatus(project.repoRoot);
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
if (isOpenFileLimitError(error)) {
|
|
26
|
+
return degradedBootstrapStatus(error);
|
|
27
|
+
}
|
|
28
|
+
throw error;
|
|
29
|
+
}
|
|
14
30
|
});
|
|
15
31
|
app.post("/api/projects/harness/bootstrap/start", async (request) => {
|
|
16
32
|
const project = await requireCurrentProject(deps.projectService);
|
|
17
33
|
return deps.harnessService.startHarnessBootstrap(project.repoRoot, request.body ?? {});
|
|
18
34
|
});
|
|
19
35
|
}
|
|
36
|
+
function degradedHarnessStatus(error) {
|
|
37
|
+
return {
|
|
38
|
+
version: 1,
|
|
39
|
+
initialized: false,
|
|
40
|
+
files: [],
|
|
41
|
+
needsApply: false,
|
|
42
|
+
plannedChanges: [],
|
|
43
|
+
warnings: [
|
|
44
|
+
`Harness status is temporarily unavailable because the backend hit the open-files limit: ${errorMessage(error)}`
|
|
45
|
+
]
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
function degradedBootstrapStatus(error) {
|
|
49
|
+
return {
|
|
50
|
+
status: "not_ready",
|
|
51
|
+
canStart: false,
|
|
52
|
+
checks: [{
|
|
53
|
+
key: "fixed-harness",
|
|
54
|
+
label: "Fixed harness",
|
|
55
|
+
status: "unknown",
|
|
56
|
+
detail: `Backend open-files limit reached: ${errorMessage(error)}`
|
|
57
|
+
}],
|
|
58
|
+
warnings: [
|
|
59
|
+
`Harness bootstrap status is temporarily unavailable because the backend hit the open-files limit: ${errorMessage(error)}`
|
|
60
|
+
]
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
function errorMessage(error) {
|
|
64
|
+
return error instanceof Error ? error.message : String(error);
|
|
65
|
+
}
|
|
20
66
|
async function requireCurrentProject(projectService) {
|
|
21
67
|
const project = await projectService.getCurrentProject();
|
|
22
68
|
if (!project) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { VcmError } from "../errors.js";
|
|
1
|
+
import { isOpenFileLimitError, VcmError } from "../errors.js";
|
|
2
2
|
import { getTaskRuntimeRepoRoot } from "../services/task-service.js";
|
|
3
3
|
export function registerMessageRoutes(app, deps) {
|
|
4
4
|
app.get("/api/tasks/:taskSlug/messages", async (request) => {
|
|
@@ -22,7 +22,20 @@ export function registerMessageRoutes(app, deps) {
|
|
|
22
22
|
});
|
|
23
23
|
app.get("/api/tasks/:taskSlug/orchestration", async (request) => {
|
|
24
24
|
const context = await getRouteContext(deps, request.params.taskSlug);
|
|
25
|
-
|
|
25
|
+
try {
|
|
26
|
+
return await deps.messageService.getOrchestrationState(context);
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
if (isOpenFileLimitError(error)) {
|
|
30
|
+
return {
|
|
31
|
+
taskSlug: request.params.taskSlug,
|
|
32
|
+
mode: "auto",
|
|
33
|
+
updatedAt: new Date().toISOString(),
|
|
34
|
+
warning: `Backend open-files limit reached while reading orchestration state: ${errorMessage(error)}`
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
26
39
|
});
|
|
27
40
|
app.put("/api/tasks/:taskSlug/orchestration", async (request) => {
|
|
28
41
|
const context = await getRouteContext(deps, request.params.taskSlug);
|
|
@@ -39,6 +52,9 @@ export function registerMessageRoutes(app, deps) {
|
|
|
39
52
|
});
|
|
40
53
|
});
|
|
41
54
|
}
|
|
55
|
+
function errorMessage(error) {
|
|
56
|
+
return error instanceof Error ? error.message : String(error);
|
|
57
|
+
}
|
|
42
58
|
async function getRouteContext(deps, taskSlug) {
|
|
43
59
|
const project = await requireCurrentProject(deps.projectService);
|
|
44
60
|
const config = await deps.projectService.loadConfig(project.repoRoot);
|
package/dist/backend/errors.js
CHANGED
|
@@ -27,3 +27,9 @@ export function toVcmError(error) {
|
|
|
27
27
|
statusCode: 500
|
|
28
28
|
});
|
|
29
29
|
}
|
|
30
|
+
export function isOpenFileLimitError(error) {
|
|
31
|
+
const code = typeof error === "object" && error !== null && "code" in error
|
|
32
|
+
? String(error.code)
|
|
33
|
+
: undefined;
|
|
34
|
+
return code === "EMFILE" || code === "ENFILE";
|
|
35
|
+
}
|
package/dist/backend/server.js
CHANGED
|
@@ -17,6 +17,7 @@ import { createNodeFileSystemAdapter } from "./adapters/filesystem.js";
|
|
|
17
17
|
import { createNodePtyTerminalRuntime } from "./runtime/node-pty-runtime.js";
|
|
18
18
|
import { createOpenAiCompatibleTranslationProvider } from "./adapters/translation-provider.js";
|
|
19
19
|
import { registerGatewayRoutes } from "./api/gateway-routes.js";
|
|
20
|
+
import { registerDiagnosticsRoutes } from "./api/diagnostics-routes.js";
|
|
20
21
|
import { createWeixinIlinkChannel } from "./gateway/channels/weixin-ilink-channel.js";
|
|
21
22
|
import { createGatewayAuditLog } from "./gateway/gateway-audit-log.js";
|
|
22
23
|
import { createGatewayService } from "./gateway/gateway-service.js";
|
|
@@ -30,6 +31,7 @@ import { createRoundService } from "./services/round-service.js";
|
|
|
30
31
|
import { createStatusService } from "./services/status-service.js";
|
|
31
32
|
import { createTaskService } from "./services/task-service.js";
|
|
32
33
|
import { createTranslationService } from "./services/translation-service.js";
|
|
34
|
+
import { createDiagnosticsService } from "./services/diagnostics-service.js";
|
|
33
35
|
import { registerAppSettingsRoutes } from "./api/app-settings-routes.js";
|
|
34
36
|
import { registerArtifactRoutes } from "./api/artifact-routes.js";
|
|
35
37
|
import { registerClaudeHookRoutes } from "./api/claude-hook-routes.js";
|
|
@@ -54,10 +56,12 @@ export async function createServer(deps, options = {}) {
|
|
|
54
56
|
error: {
|
|
55
57
|
code: vcmError.code,
|
|
56
58
|
message: vcmError.message,
|
|
57
|
-
hint: vcmError.hint
|
|
59
|
+
hint: vcmError.hint,
|
|
60
|
+
runtime: deps.diagnosticsService.getErrorRuntimeInfo()
|
|
58
61
|
}
|
|
59
62
|
});
|
|
60
63
|
});
|
|
64
|
+
registerDiagnosticsRoutes(app, { diagnosticsService: deps.diagnosticsService });
|
|
61
65
|
registerAppSettingsRoutes(app, { appSettings: deps.appSettings });
|
|
62
66
|
registerClaudeHookRoutes(app, { claudeHookService: deps.claudeHookService });
|
|
63
67
|
registerCodexHookRoutes(app, { codexHookService: deps.codexHookService });
|
|
@@ -148,7 +152,7 @@ export function createDefaultServerDeps(options = {}) {
|
|
|
148
152
|
const runtime = createNodePtyTerminalRuntime({ fs });
|
|
149
153
|
const registry = createSessionRegistry();
|
|
150
154
|
const artifactService = createArtifactService(fs);
|
|
151
|
-
const projectService = createProjectService({ fs, git,
|
|
155
|
+
const projectService = createProjectService({ fs, git, appSettings });
|
|
152
156
|
const harnessService = createHarnessService({
|
|
153
157
|
fs,
|
|
154
158
|
runtime,
|
|
@@ -248,6 +252,12 @@ export function createDefaultServerDeps(options = {}) {
|
|
|
248
252
|
sessionService,
|
|
249
253
|
roundService
|
|
250
254
|
});
|
|
255
|
+
const diagnosticsService = createDiagnosticsService({
|
|
256
|
+
appRoot: getAppRoot(),
|
|
257
|
+
runtime,
|
|
258
|
+
gatewayService,
|
|
259
|
+
translationService
|
|
260
|
+
});
|
|
251
261
|
return {
|
|
252
262
|
appSettings,
|
|
253
263
|
projectService,
|
|
@@ -264,7 +274,8 @@ export function createDefaultServerDeps(options = {}) {
|
|
|
264
274
|
statusService,
|
|
265
275
|
translationService,
|
|
266
276
|
gatewayService,
|
|
267
|
-
runtime
|
|
277
|
+
runtime,
|
|
278
|
+
diagnosticsService
|
|
268
279
|
};
|
|
269
280
|
}
|
|
270
281
|
export function getDefaultStaticDir() {
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import fs from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
export function createDiagnosticsService(deps) {
|
|
5
|
+
const version = readPackageVersion(deps.appRoot);
|
|
6
|
+
return {
|
|
7
|
+
async getRuntimeDiagnostics() {
|
|
8
|
+
const runtimeSessions = deps.runtime.listSessions();
|
|
9
|
+
return {
|
|
10
|
+
version,
|
|
11
|
+
pid: process.pid,
|
|
12
|
+
cwd: process.cwd(),
|
|
13
|
+
execPath: process.execPath,
|
|
14
|
+
nodeVersion: process.version,
|
|
15
|
+
platform: process.platform,
|
|
16
|
+
arch: process.arch,
|
|
17
|
+
uptimeSeconds: Math.round(process.uptime()),
|
|
18
|
+
fdCount: await readFdCount(),
|
|
19
|
+
openFilesLimit: await readOpenFilesLimit(),
|
|
20
|
+
runtimeSessions: {
|
|
21
|
+
total: runtimeSessions.length,
|
|
22
|
+
running: runtimeSessions.filter((session) => session.status === "running").length
|
|
23
|
+
},
|
|
24
|
+
gateway: deps.gatewayService.getDiagnostics(),
|
|
25
|
+
translation: deps.translationService.getDiagnostics()
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
getErrorRuntimeInfo() {
|
|
29
|
+
return {
|
|
30
|
+
version,
|
|
31
|
+
pid: process.pid,
|
|
32
|
+
cwd: process.cwd()
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function readPackageVersion(appRoot) {
|
|
38
|
+
const packageJsonPath = path.join(appRoot, "package.json");
|
|
39
|
+
try {
|
|
40
|
+
const raw = JSON.parse(readFileSync(packageJsonPath, "utf8"));
|
|
41
|
+
return typeof raw.version === "string" && raw.version.trim() ? raw.version : "unknown";
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
return process.env.npm_package_version || "unknown";
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async function readFdCount() {
|
|
48
|
+
try {
|
|
49
|
+
return (await fs.readdir("/proc/self/fd")).length;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async function readOpenFilesLimit() {
|
|
56
|
+
try {
|
|
57
|
+
const limits = await fs.readFile("/proc/self/limits", "utf8");
|
|
58
|
+
const line = limits.split("\n").find((candidate) => candidate.startsWith("Max open files"));
|
|
59
|
+
if (!line) {
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
const match = line.match(/^Max open files\s+(\S+)\s+(\S+)/);
|
|
63
|
+
if (!match) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
soft: match[1] ?? "unknown",
|
|
68
|
+
hard: match[2] ?? "unknown"
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -139,9 +139,6 @@ export function createProjectService(deps) {
|
|
|
139
139
|
warnings.push(`Unable to read Git ahead/behind status. ${getErrorHint(caught)}`);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
|
-
if (!(await deps.claude.isAvailable(config.claudeCommand))) {
|
|
143
|
-
warnings.push("Claude Code command is not available. You can still inspect artifacts, but sessions will not start.");
|
|
144
|
-
}
|
|
145
142
|
const pullDisabledReason = getPullDisabledReason({ isDirty, upstreamBranch });
|
|
146
143
|
return {
|
|
147
144
|
repoRoot,
|
|
@@ -799,6 +799,21 @@ export function createTranslationService(deps) {
|
|
|
799
799
|
userPrompt: prompt.userPrompt
|
|
800
800
|
});
|
|
801
801
|
return result.text.trim();
|
|
802
|
+
},
|
|
803
|
+
getDiagnostics() {
|
|
804
|
+
let transcriptWatchers = 0;
|
|
805
|
+
let listeners = 0;
|
|
806
|
+
for (const state of sessionStates.values()) {
|
|
807
|
+
if (state.unsubscribeTranscript) {
|
|
808
|
+
transcriptWatchers += 1;
|
|
809
|
+
}
|
|
810
|
+
listeners += state.listeners.size;
|
|
811
|
+
}
|
|
812
|
+
return {
|
|
813
|
+
sessions: sessionStates.size,
|
|
814
|
+
transcriptWatchers,
|
|
815
|
+
listeners
|
|
816
|
+
};
|
|
802
817
|
}
|
|
803
818
|
};
|
|
804
819
|
async function writeToCurrentRole(repoRoot, taskSlug, role, text) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|