vibe-coding-master 0.6.3 → 0.6.5
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/api/translation-routes.js +11 -0
- package/dist/backend/gateway/gateway-service.js +15 -10
- package/dist/backend/services/translation-service.js +51 -11
- package/dist-frontend/assets/{index-UT2aoyEt.js → index-8pJ3dNxs.js} +22 -22
- package/dist-frontend/assets/{index-BM6nSKae.css → index-D6vwKigt.css} +1 -1
- package/dist-frontend/index.html +2 -2
- package/package.json +1 -1
|
@@ -52,6 +52,17 @@ export function registerTranslationRoutes(app, deps) {
|
|
|
52
52
|
text: request.body?.text ?? ""
|
|
53
53
|
});
|
|
54
54
|
});
|
|
55
|
+
app.post("/api/tasks/:taskSlug/sessions/:role/translation/latest-reply", async (request) => {
|
|
56
|
+
const project = await requireCurrentProject(deps.projectService);
|
|
57
|
+
const role = parseRole(request.params.role);
|
|
58
|
+
const task = await deps.taskService.loadTask(project.repoRoot, request.params.taskSlug);
|
|
59
|
+
return deps.translationService.translateLatestReply({
|
|
60
|
+
repoRoot: project.repoRoot,
|
|
61
|
+
taskRepoRoot: getTaskRuntimeRepoRoot(task),
|
|
62
|
+
taskSlug: request.params.taskSlug,
|
|
63
|
+
role
|
|
64
|
+
});
|
|
65
|
+
});
|
|
55
66
|
app.post("/api/tasks/:taskSlug/sessions/:role/translation/send", async (request) => {
|
|
56
67
|
const project = await requireCurrentProject(deps.projectService);
|
|
57
68
|
const role = parseRole(request.params.role);
|
|
@@ -3,7 +3,7 @@ import { VcmError } from "../errors.js";
|
|
|
3
3
|
import { submitTerminalInput } from "../runtime/terminal-submit.js";
|
|
4
4
|
import { getTaskRuntimeRepoRoot } from "../services/task-service.js";
|
|
5
5
|
import { resolveExistingClaudeTranscriptPath } from "../services/claude-transcript-service.js";
|
|
6
|
-
import { isFinalTurnTextEvent, readTranscriptTextEvents
|
|
6
|
+
import { isFinalTurnTextEvent, readTranscriptTextEvents } from "../services/claude-transcript-reply.js";
|
|
7
7
|
import { parseGatewayCommand } from "./gateway-command-parser.js";
|
|
8
8
|
import { createLarkRegistrationClient } from "./channels/lark-registration.js";
|
|
9
9
|
const QR_LOGIN_TTL_MS = 8 * 60 * 1000;
|
|
@@ -1128,14 +1128,12 @@ export function createGatewayService(deps) {
|
|
|
1128
1128
|
if (nextEvents.length === 0) {
|
|
1129
1129
|
return;
|
|
1130
1130
|
}
|
|
1131
|
-
const
|
|
1131
|
+
const latestReply = toGatewayPmReply(nextEvents[nextEvents.length - 1]);
|
|
1132
|
+
const text = latestReply.text.trim();
|
|
1132
1133
|
if (!text) {
|
|
1133
1134
|
return;
|
|
1134
1135
|
}
|
|
1135
|
-
|
|
1136
|
-
if (latestReply) {
|
|
1137
|
-
await saveLatestPmReply(input, latestReply);
|
|
1138
|
-
}
|
|
1136
|
+
await saveLatestPmReply(input, latestReply);
|
|
1139
1137
|
const account = toAccount(settings);
|
|
1140
1138
|
const boundUserId = settings.binding.boundUserId;
|
|
1141
1139
|
// A disarmed gateway never touches the channel: skip the outbound push.
|
|
@@ -1153,7 +1151,7 @@ export function createGatewayService(deps) {
|
|
|
1153
1151
|
repoRoot: input.repoRoot,
|
|
1154
1152
|
taskSlug: input.taskSlug,
|
|
1155
1153
|
sourceText: text,
|
|
1156
|
-
sourceEntryIds:
|
|
1154
|
+
sourceEntryIds: latestReply.transcriptEventId ? [latestReply.transcriptEventId] : undefined
|
|
1157
1155
|
});
|
|
1158
1156
|
await sendGatewayText(settings, boundUserId, output.translationFailed
|
|
1159
1157
|
? formatGatewayPmTranslationFailure(output.translationError)
|
|
@@ -1162,15 +1160,14 @@ export function createGatewayService(deps) {
|
|
|
1162
1160
|
else {
|
|
1163
1161
|
clearFailedTranslation(input.repoRoot, input.taskSlug);
|
|
1164
1162
|
}
|
|
1165
|
-
const lastEvent = nextEvents.at(-1);
|
|
1166
1163
|
const current = await deps.settings.loadSettings();
|
|
1167
1164
|
await deps.settings.saveSettings({
|
|
1168
1165
|
...current,
|
|
1169
1166
|
pushCursors: {
|
|
1170
1167
|
...current.pushCursors,
|
|
1171
1168
|
[cursorKey]: {
|
|
1172
|
-
lastTranscriptEventId:
|
|
1173
|
-
lastTranscriptTimestamp:
|
|
1169
|
+
lastTranscriptEventId: latestReply.transcriptEventId,
|
|
1170
|
+
lastTranscriptTimestamp: latestReply.transcriptTimestamp
|
|
1174
1171
|
}
|
|
1175
1172
|
},
|
|
1176
1173
|
lastMessageStatus: {
|
|
@@ -1429,6 +1426,14 @@ export function createGatewayService(deps) {
|
|
|
1429
1426
|
lastFailedTranslation = null;
|
|
1430
1427
|
}
|
|
1431
1428
|
}
|
|
1429
|
+
function toGatewayPmReply(event) {
|
|
1430
|
+
return {
|
|
1431
|
+
text: event.text,
|
|
1432
|
+
truncated: false,
|
|
1433
|
+
transcriptEventId: event.id,
|
|
1434
|
+
transcriptTimestamp: event.timestamp
|
|
1435
|
+
};
|
|
1436
|
+
}
|
|
1432
1437
|
async function saveLatestPmReply(input, reply) {
|
|
1433
1438
|
const settings = await deps.settings.loadSettings();
|
|
1434
1439
|
const key = latestPmReplyKey(input.repoRoot, input.taskSlug);
|
|
@@ -3,6 +3,7 @@ import { isVcmRoleName } from "../../shared/constants.js";
|
|
|
3
3
|
import { TRANSLATION_ENTRY_RETENTION_LIMIT } from "../../shared/types/translation.js";
|
|
4
4
|
import { VcmError } from "../errors.js";
|
|
5
5
|
import { submitTerminalInput } from "../runtime/terminal-submit.js";
|
|
6
|
+
import { readLatestRoleTurnReply } from "./claude-transcript-reply.js";
|
|
6
7
|
import { createTranslationQueueRegistry } from "./translation-queue.js";
|
|
7
8
|
const TRANSLATION_SOURCE_LANGUAGE = "auto";
|
|
8
9
|
const TRANSLATION_INPUT_MODE = "review-before-send";
|
|
@@ -906,6 +907,51 @@ export function createTranslationService(deps) {
|
|
|
906
907
|
}
|
|
907
908
|
return entry;
|
|
908
909
|
},
|
|
910
|
+
async translateLatestReply(input) {
|
|
911
|
+
const config = await loadConfig();
|
|
912
|
+
const roleSession = await deps.sessionService.getRoleSession(input.repoRoot, input.taskSlug, input.role);
|
|
913
|
+
if (!roleSession || roleSession.status !== "running") {
|
|
914
|
+
throw new VcmError({
|
|
915
|
+
code: "SESSION_NOT_RUNNING",
|
|
916
|
+
message: `${input.role} session is not running.`,
|
|
917
|
+
statusCode: 409
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
const reply = await readLatestRoleTurnReply(roleSession);
|
|
921
|
+
if (!reply?.text.trim()) {
|
|
922
|
+
throw new VcmError({
|
|
923
|
+
code: "TRANSLATION_REPLY_NOT_FOUND",
|
|
924
|
+
message: `No completed final reply was found for ${input.role}.`,
|
|
925
|
+
statusCode: 404,
|
|
926
|
+
hint: "Wait until the role finishes a Claude Code turn, then try again."
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
await prepareCache({
|
|
930
|
+
repoRoot: input.taskRepoRoot ?? input.repoRoot,
|
|
931
|
+
baseRepoRoot: input.repoRoot,
|
|
932
|
+
taskSlug: input.taskSlug,
|
|
933
|
+
role: input.role,
|
|
934
|
+
sessionId: roleSession.id
|
|
935
|
+
});
|
|
936
|
+
startTranscriptTail(roleSession);
|
|
937
|
+
const entry = startClaudeOutputTranslation(roleSession.id, reply.text, config, {
|
|
938
|
+
replaceExisting: false,
|
|
939
|
+
flushImmediately: true,
|
|
940
|
+
metadata: {
|
|
941
|
+
transcriptStopReason: "end_turn",
|
|
942
|
+
...(reply.transcriptTimestamp ? { transcriptTimestamp: reply.transcriptTimestamp } : {})
|
|
943
|
+
}
|
|
944
|
+
});
|
|
945
|
+
if (!entry) {
|
|
946
|
+
throw new VcmError({
|
|
947
|
+
code: "TRANSLATION_NOT_STARTED",
|
|
948
|
+
message: "Latest reply translation could not be queued.",
|
|
949
|
+
statusCode: 409,
|
|
950
|
+
hint: "Check that the role session is still running and try again."
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
return entry;
|
|
954
|
+
},
|
|
909
955
|
async sendTranslatedInput(input) {
|
|
910
956
|
await writeToCurrentRole(input.repoRoot, input.taskSlug, input.role, input.englishText);
|
|
911
957
|
},
|
|
@@ -1034,18 +1080,12 @@ export function createTranslationService(deps) {
|
|
|
1034
1080
|
if (reusable) {
|
|
1035
1081
|
return reusable.trim();
|
|
1036
1082
|
}
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
text: input.text,
|
|
1043
|
-
sourceKind: "prose",
|
|
1044
|
-
sourceLanguage: "en",
|
|
1045
|
-
targetLanguage: config.targetLanguage,
|
|
1046
|
-
config
|
|
1083
|
+
throw new VcmError({
|
|
1084
|
+
code: "GATEWAY_TRANSLATION_RESULT_MISSING",
|
|
1085
|
+
message: "Gateway output translation is not available in the current translation panel.",
|
|
1086
|
+
statusCode: 409,
|
|
1087
|
+
hint: "Wait for the translation panel to finish translating the PM final reply, then retry from Gateway."
|
|
1047
1088
|
});
|
|
1048
|
-
return translation.text.trim();
|
|
1049
1089
|
},
|
|
1050
1090
|
getDiagnostics() {
|
|
1051
1091
|
let transcriptWatchers = 0;
|