vibe-coding-master 0.6.4 → 0.6.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.
@@ -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, selectLatestTurnReply } from "../services/claude-transcript-reply.js";
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 text = nextEvents.map((event) => event.text).join("\n\n").trim();
1131
+ const latestReply = toGatewayPmReply(nextEvents[nextEvents.length - 1]);
1132
+ const text = latestReply.text.trim();
1132
1133
  if (!text) {
1133
1134
  return;
1134
1135
  }
1135
- const latestReply = selectLatestTurnReply(nextEvents, input.session);
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: nextEvents.map((event) => event.id)
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: lastEvent?.id ?? null,
1173
- lastTranscriptTimestamp: lastEvent?.timestamp ?? null
1169
+ lastTranscriptEventId: latestReply.transcriptEventId,
1170
+ lastTranscriptTimestamp: latestReply.transcriptTimestamp
1174
1171
  }
1175
1172
  },
1176
1173
  lastMessageStatus: {
@@ -1409,7 +1406,8 @@ export function createGatewayService(deps) {
1409
1406
  repoRoot: failed.repoRoot,
1410
1407
  taskSlug: failed.taskSlug,
1411
1408
  role: failed.role,
1412
- text: failed.sourceText
1409
+ text: failed.sourceText,
1410
+ allowCreate: true
1413
1411
  });
1414
1412
  lastFailedTranslation = null;
1415
1413
  return `重新翻译成功:\n\n${text}`;
@@ -1429,6 +1427,14 @@ export function createGatewayService(deps) {
1429
1427
  lastFailedTranslation = null;
1430
1428
  }
1431
1429
  }
1430
+ function toGatewayPmReply(event) {
1431
+ return {
1432
+ text: event.text,
1433
+ truncated: false,
1434
+ transcriptEventId: event.id,
1435
+ transcriptTimestamp: event.timestamp
1436
+ };
1437
+ }
1432
1438
  async function saveLatestPmReply(input, reply) {
1433
1439
  const settings = await deps.settings.loadSettings();
1434
1440
  const key = latestPmReplyKey(input.repoRoot, input.taskSlug);
@@ -1080,18 +1080,26 @@ export function createTranslationService(deps) {
1080
1080
  if (reusable) {
1081
1081
  return reusable.trim();
1082
1082
  }
1083
- const translation = await translateText({
1084
- repoRoot: input.repoRoot,
1085
- taskSlug: input.taskSlug,
1086
- role: input.role,
1087
- direction: "cc-output-to-user",
1088
- text: input.text,
1089
- sourceKind: "prose",
1090
- sourceLanguage: "en",
1091
- targetLanguage: config.targetLanguage,
1092
- config
1083
+ if (input.allowCreate) {
1084
+ const translation = await translateText({
1085
+ repoRoot: input.repoRoot,
1086
+ taskSlug: input.taskSlug,
1087
+ role: input.role,
1088
+ direction: "cc-output-to-user",
1089
+ text: input.text,
1090
+ sourceKind: "prose",
1091
+ sourceLanguage: "en",
1092
+ targetLanguage: config.targetLanguage,
1093
+ config
1094
+ });
1095
+ return translation.text.trim();
1096
+ }
1097
+ throw new VcmError({
1098
+ code: "GATEWAY_TRANSLATION_RESULT_MISSING",
1099
+ message: "Gateway output translation is not available in the current translation panel.",
1100
+ statusCode: 409,
1101
+ hint: "Wait for the translation panel to finish translating the PM final reply, then retry from Gateway."
1093
1102
  });
1094
- return translation.text.trim();
1095
1103
  },
1096
1104
  getDiagnostics() {
1097
1105
  let transcriptWatchers = 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vibe-coding-master",
3
- "version": "0.6.4",
3
+ "version": "0.6.6",
4
4
  "description": "Local GUI session cockpit for Claude Code role sessions.",
5
5
  "type": "module",
6
6
  "files": [