vibe-coding-master 0.3.6 → 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.
@@ -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 = 32;
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
- return deps.harnessService.getHarnessStatus(project.repoRoot);
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
- return deps.harnessService.getBootstrapStatus(project.repoRoot);
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
- return deps.messageService.getOrchestrationState(context);
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);
@@ -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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibe-coding-master",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "Local GUI session cockpit for Claude Code role sessions.",
5
5
  "type": "module",
6
6
  "files": [