vibe-coding-master 0.3.24 → 0.3.25
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.
|
@@ -54,7 +54,21 @@ export function createNodeFileSystemAdapter() {
|
|
|
54
54
|
});
|
|
55
55
|
},
|
|
56
56
|
async readJson(targetPath) {
|
|
57
|
-
|
|
57
|
+
let attempt = 0;
|
|
58
|
+
for (;;) {
|
|
59
|
+
const content = await runFileOperation(() => fs.readFile(targetPath, "utf8"));
|
|
60
|
+
try {
|
|
61
|
+
return JSON.parse(content);
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
const delayMs = JSON_READ_RETRY_DELAYS_MS[attempt];
|
|
65
|
+
if (!(error instanceof SyntaxError) || delayMs === undefined) {
|
|
66
|
+
throw error;
|
|
67
|
+
}
|
|
68
|
+
attempt += 1;
|
|
69
|
+
await delay(delayMs);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
58
72
|
},
|
|
59
73
|
async writeJson(targetPath, value) {
|
|
60
74
|
await this.writeText(targetPath, `${JSON.stringify(value, null, 2)}\n`);
|
|
@@ -84,6 +98,7 @@ export function createNodeFileSystemAdapter() {
|
|
|
84
98
|
}
|
|
85
99
|
const DEFAULT_FILE_OPERATION_CONCURRENCY = 8;
|
|
86
100
|
const OPEN_FILE_RETRY_DELAYS_MS = [25, 50, 100, 200, 400, 800];
|
|
101
|
+
const JSON_READ_RETRY_DELAYS_MS = [25, 50, 100, 200];
|
|
87
102
|
function createFileOperationRunner(maxConcurrent = DEFAULT_FILE_OPERATION_CONCURRENCY) {
|
|
88
103
|
let active = 0;
|
|
89
104
|
const waiters = [];
|
|
@@ -2,7 +2,9 @@ import { VcmError } from "../errors.js";
|
|
|
2
2
|
export function registerCodexTranslationRoutes(app, deps) {
|
|
3
3
|
app.get("/api/translation/codex/state", async () => {
|
|
4
4
|
const project = await requireCurrentProject(deps.projectService);
|
|
5
|
-
return deps.codexTranslationService.getState(project.repoRoot
|
|
5
|
+
return deps.codexTranslationService.getState(project.repoRoot, {
|
|
6
|
+
visibility: "public"
|
|
7
|
+
});
|
|
6
8
|
});
|
|
7
9
|
app.get("/api/translation/codex/session", async () => {
|
|
8
10
|
const project = await requireCurrentProject(deps.projectService);
|
|
@@ -812,7 +812,7 @@ export function createCodexTranslationService(deps) {
|
|
|
812
812
|
await cleanupStartupFileIndex(repoRoot);
|
|
813
813
|
await cleanupStartupBootstrapIndex(repoRoot);
|
|
814
814
|
},
|
|
815
|
-
async getState(repoRoot) {
|
|
815
|
+
async getState(repoRoot, options = {}) {
|
|
816
816
|
await ensureLayout(repoRoot);
|
|
817
817
|
await cleanupCompletedRuntime(repoRoot);
|
|
818
818
|
const [queue, fileIndex, bootstrapIndex, memoryInitialized] = await Promise.all([
|
|
@@ -822,7 +822,7 @@ export function createCodexTranslationService(deps) {
|
|
|
822
822
|
isMemoryInitialized(repoRoot, deps.fs)
|
|
823
823
|
]);
|
|
824
824
|
const runtimeFileJobs = await loadRuntimeFileJobs(repoRoot, queue);
|
|
825
|
-
|
|
825
|
+
const state = {
|
|
826
826
|
queue,
|
|
827
827
|
fileIndex: visibleFileTranslationIndex({
|
|
828
828
|
...fileIndex,
|
|
@@ -831,6 +831,7 @@ export function createCodexTranslationService(deps) {
|
|
|
831
831
|
bootstrapIndex,
|
|
832
832
|
memoryInitialized
|
|
833
833
|
};
|
|
834
|
+
return options.visibility === "public" ? toPublicTranslationState(state) : state;
|
|
834
835
|
},
|
|
835
836
|
async browseSourceFiles(repoRoot, input = {}) {
|
|
836
837
|
const currentPath = normalizeBrowserPath(input.path ?? "");
|
|
@@ -1742,6 +1743,26 @@ function isPrunableCompletedQueueItem(item) {
|
|
|
1742
1743
|
item.type === "bootstrap" ||
|
|
1743
1744
|
item.type === "memory-update");
|
|
1744
1745
|
}
|
|
1746
|
+
function toPublicTranslationState(state) {
|
|
1747
|
+
const items = state.queue.items
|
|
1748
|
+
.filter((item) => item.type !== "conversation")
|
|
1749
|
+
.map(toPublicQueueItem);
|
|
1750
|
+
const activeItemId = state.queue.activeItemId && items.some((item) => item.id === state.queue.activeItemId)
|
|
1751
|
+
? state.queue.activeItemId
|
|
1752
|
+
: undefined;
|
|
1753
|
+
return {
|
|
1754
|
+
...state,
|
|
1755
|
+
queue: {
|
|
1756
|
+
...state.queue,
|
|
1757
|
+
activeItemId,
|
|
1758
|
+
items
|
|
1759
|
+
}
|
|
1760
|
+
};
|
|
1761
|
+
}
|
|
1762
|
+
function toPublicQueueItem(item) {
|
|
1763
|
+
const { translatedText: _translatedText, ...publicItem } = item;
|
|
1764
|
+
return publicItem;
|
|
1765
|
+
}
|
|
1745
1766
|
function isTranslationRuntimeDirectory(relativePath) {
|
|
1746
1767
|
const normalized = normalizeRepoRelative(relativePath);
|
|
1747
1768
|
return normalized.startsWith(`${TRANSLATIONS_RUNTIME_DIR}/`);
|