vibe-coding-master 0.3.5 → 0.3.6

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.
@@ -0,0 +1,5 @@
1
+ export function registerDiagnosticsRoutes(app, deps) {
2
+ app.get("/api/diagnostics/runtime", async () => {
3
+ return deps.diagnosticsService.getRuntimeDiagnostics();
4
+ });
5
+ }
@@ -826,6 +826,11 @@ export function createGatewayService(deps) {
826
826
  preview: output.text,
827
827
  error: output.translationError
828
828
  });
829
+ },
830
+ getDiagnostics() {
831
+ return {
832
+ polling: isRunning()
833
+ };
829
834
  }
830
835
  };
831
836
  function getLatestPmReply(settings) {
@@ -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, claude, appSettings });
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 {};