vibe-coding-master 0.4.40 → 0.4.41
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.
|
@@ -124,6 +124,7 @@ export function createTranslationService(deps) {
|
|
|
124
124
|
for (const event of state.events) {
|
|
125
125
|
if (event.type === "entry") {
|
|
126
126
|
state.entries = upsertEntry(state.entries, event.entry);
|
|
127
|
+
state.seenTranscriptIds.add(event.entry.id);
|
|
127
128
|
}
|
|
128
129
|
else if (event.type === "status") {
|
|
129
130
|
state.status = event.status;
|
|
@@ -159,10 +160,20 @@ export function createTranslationService(deps) {
|
|
|
159
160
|
const state = getState(roleSession.id);
|
|
160
161
|
state.taskSlug = roleSession.taskSlug;
|
|
161
162
|
state.role = roleSession.role;
|
|
162
|
-
|
|
163
|
+
const transcriptSessionKey = getTranscriptSessionKey(roleSession);
|
|
164
|
+
if (!transcriptSessionKey) {
|
|
163
165
|
return;
|
|
164
166
|
}
|
|
167
|
+
if (state.unsubscribeTranscript) {
|
|
168
|
+
if (state.transcriptSessionKey === transcriptSessionKey) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
state.unsubscribeTranscript();
|
|
172
|
+
state.unsubscribeTranscript = undefined;
|
|
173
|
+
state.transcriptSessionKey = undefined;
|
|
174
|
+
}
|
|
165
175
|
const replaySince = getTranscriptReplaySince(roleSession);
|
|
176
|
+
state.transcriptSessionKey = transcriptSessionKey;
|
|
166
177
|
state.unsubscribeTranscript = deps.transcripts.subscribeToRoleSession(roleSession, (event) => {
|
|
167
178
|
void handleTranscriptEvent(roleSession.id, event).catch((error) => {
|
|
168
179
|
publishError(roleSession.id, normalizeTranslationError(error, "Process Claude transcript event for translation failed."));
|
|
@@ -537,6 +548,7 @@ export function createTranslationService(deps) {
|
|
|
537
548
|
state.unsubscribeTranscript();
|
|
538
549
|
state.unsubscribeTranscript = undefined;
|
|
539
550
|
}
|
|
551
|
+
state.transcriptSessionKey = undefined;
|
|
540
552
|
if (state.outputBatch?.timer) {
|
|
541
553
|
clearTimeout(state.outputBatch.timer);
|
|
542
554
|
}
|
|
@@ -1028,13 +1040,26 @@ function delay(ms) {
|
|
|
1028
1040
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
1029
1041
|
}
|
|
1030
1042
|
function getTranscriptReplaySince(roleSession) {
|
|
1031
|
-
const rawTimestamp = roleSession.
|
|
1043
|
+
const rawTimestamp = roleSession.lastTurnStartedAt
|
|
1044
|
+
?? roleSession.lastHookEventAt
|
|
1045
|
+
?? roleSession.updatedAt
|
|
1046
|
+
?? roleSession.startedAt;
|
|
1032
1047
|
const timestampMs = Date.parse(rawTimestamp);
|
|
1033
1048
|
if (!Number.isFinite(timestampMs)) {
|
|
1034
1049
|
return undefined;
|
|
1035
1050
|
}
|
|
1036
1051
|
return new Date(Math.max(0, timestampMs - TRANSCRIPT_REPLAY_GRACE_MS)).toISOString();
|
|
1037
1052
|
}
|
|
1053
|
+
function getTranscriptSessionKey(roleSession) {
|
|
1054
|
+
if (!roleSession.claudeSessionId && !roleSession.transcriptPath) {
|
|
1055
|
+
return undefined;
|
|
1056
|
+
}
|
|
1057
|
+
return [
|
|
1058
|
+
roleSession.cwd,
|
|
1059
|
+
roleSession.claudeSessionId,
|
|
1060
|
+
roleSession.transcriptPath
|
|
1061
|
+
].join("\n");
|
|
1062
|
+
}
|
|
1038
1063
|
function formatStructuredTranscriptEvent(event) {
|
|
1039
1064
|
if (event.kind === "question") {
|
|
1040
1065
|
return event.question.questions.map((question, index) => {
|