vibe-coding-master 0.6.3 → 0.6.4

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.
@@ -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,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
  },