@memorax/memorax-code 0.1.8 → 0.1.9
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/lib/memorax-code-backend/dist/clients/codex/rollout-turn.js +52 -2
- package/lib/memorax-code-backend/package.json +1 -1
- package/lib/memorax-code-claude-adapter/.claude-plugin/plugin.json +1 -1
- package/lib/memorax-code-claude-adapter/hooks/runtime-shell.json +1 -1
- package/lib/memorax-code-claude-adapter/package.json +1 -1
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/.claude-plugin/plugin.json +1 -1
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/hooks/runtime-shell.json +1 -1
- package/lib/memorax-code-claude-marketplace/plugins/memorax-code-claude-adapter/package.json +1 -1
- package/lib/memorax-code-codex-adapter/.codex-plugin/plugin.json +1 -1
- package/lib/memorax-code-codex-adapter/hooks/runtime-shell.json +1 -1
- package/lib/memorax-code-codex-adapter/package.json +1 -1
- package/lib/memorax-code-dsh-adapter/package.json +1 -1
- package/lib/memorax-code-opencode-adapter/package.json +1 -1
- package/package.json +1 -1
|
@@ -32,6 +32,8 @@ export function codexRolloutTurnFromJsonLines(transcript, input) {
|
|
|
32
32
|
if (!codexRolloutSessionMatches(scan, input.sessionId)) {
|
|
33
33
|
return { ok: false, reason: "transcript_session_mismatch" };
|
|
34
34
|
}
|
|
35
|
+
if (scan.turnMetadataMismatch)
|
|
36
|
+
return { ok: false, reason: "turn_metadata_mismatch" };
|
|
35
37
|
if (!scan.targetSeen)
|
|
36
38
|
return { ok: false, reason: "turn_not_found" };
|
|
37
39
|
if (!scan.userPrompt)
|
|
@@ -48,6 +50,8 @@ export function codexInterruptedRolloutTurnFromJsonLines(transcript, input) {
|
|
|
48
50
|
if (!codexRolloutSessionMatches(scan, input.sessionId)) {
|
|
49
51
|
return { ok: false, reason: "transcript_session_mismatch" };
|
|
50
52
|
}
|
|
53
|
+
if (scan.turnMetadataMismatch)
|
|
54
|
+
return { ok: false, reason: "turn_metadata_mismatch" };
|
|
51
55
|
if (!scan.targetSeen)
|
|
52
56
|
return { ok: false, reason: "turn_not_found" };
|
|
53
57
|
if (!scan.userPrompt)
|
|
@@ -74,9 +78,12 @@ function scanCodexRolloutTurn(transcript, targetTurnId) {
|
|
|
74
78
|
let targetBoundarySeen = false;
|
|
75
79
|
let activeTurnId;
|
|
76
80
|
let targetSeen = false;
|
|
81
|
+
let turnMetadataMismatch = false;
|
|
77
82
|
let userPrompt;
|
|
78
83
|
let assistantReply;
|
|
79
84
|
const visibleAssistantMessages = [];
|
|
85
|
+
let responseItemUserPrompt;
|
|
86
|
+
let responseItemAssistantReply;
|
|
80
87
|
let interrupted = false;
|
|
81
88
|
let interruptedAt;
|
|
82
89
|
let rolledBack = false;
|
|
@@ -145,6 +152,26 @@ function scanCodexRolloutTurn(transcript, targetTurnId) {
|
|
|
145
152
|
const activities = activityCandidatesFromResponseItem(payload);
|
|
146
153
|
if (activities.length > 0)
|
|
147
154
|
targetActivityGroups.push(activities);
|
|
155
|
+
if (stringValue(payload.type) === "message") {
|
|
156
|
+
const role = stringValue(payload.role);
|
|
157
|
+
const message = responseItemMessageText(payload.content, role);
|
|
158
|
+
const authoritativeMessage = role === "user"
|
|
159
|
+
|| (role === "assistant" && payload.phase === "final_answer");
|
|
160
|
+
if (authoritativeMessage && message) {
|
|
161
|
+
const responseTurnId = responseItemTurnId(payload);
|
|
162
|
+
if (responseTurnId && responseTurnId !== activeTurnId) {
|
|
163
|
+
turnMetadataMismatch = true;
|
|
164
|
+
continue;
|
|
165
|
+
}
|
|
166
|
+
if (role === "user") {
|
|
167
|
+
userMessageTurnIds.add(activeTurnId);
|
|
168
|
+
responseItemUserPrompt = message;
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
responseItemAssistantReply = message;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
148
175
|
}
|
|
149
176
|
continue;
|
|
150
177
|
}
|
|
@@ -231,8 +258,9 @@ function scanCodexRolloutTurn(transcript, targetTurnId) {
|
|
|
231
258
|
ambiguousSessionMetadata,
|
|
232
259
|
composite,
|
|
233
260
|
targetSeen,
|
|
234
|
-
|
|
235
|
-
|
|
261
|
+
turnMetadataMismatch,
|
|
262
|
+
userPrompt: responseItemUserPrompt ?? userPrompt,
|
|
263
|
+
assistantReply: responseItemAssistantReply ?? assistantReply,
|
|
236
264
|
visibleAssistantMessages,
|
|
237
265
|
interrupted,
|
|
238
266
|
interruptedAt,
|
|
@@ -245,6 +273,28 @@ function scanCodexRolloutTurn(transcript, targetTurnId) {
|
|
|
245
273
|
userMessageTurnIds,
|
|
246
274
|
};
|
|
247
275
|
}
|
|
276
|
+
function responseItemTurnId(payload) {
|
|
277
|
+
const metadata = isRecord(payload.internal_chat_message_metadata_passthrough)
|
|
278
|
+
? payload.internal_chat_message_metadata_passthrough
|
|
279
|
+
: undefined;
|
|
280
|
+
return metadata
|
|
281
|
+
? stringValue(metadata.turn_id) ?? stringValue(metadata.turnId)
|
|
282
|
+
: undefined;
|
|
283
|
+
}
|
|
284
|
+
function responseItemMessageText(value, role) {
|
|
285
|
+
if (!Array.isArray(value))
|
|
286
|
+
return undefined;
|
|
287
|
+
const expectedType = role === "user" ? "input_text" : role === "assistant" ? "output_text" : undefined;
|
|
288
|
+
if (!expectedType)
|
|
289
|
+
return undefined;
|
|
290
|
+
const parts = value.flatMap((item) => {
|
|
291
|
+
if (!isRecord(item) || stringValue(item.type) !== expectedType)
|
|
292
|
+
return [];
|
|
293
|
+
const text = nonBlankString(item.text);
|
|
294
|
+
return text ? [text] : [];
|
|
295
|
+
});
|
|
296
|
+
return parts.length > 0 ? parts.join("\n") : undefined;
|
|
297
|
+
}
|
|
248
298
|
function codexRolloutSessionMatches(scan, sessionId) {
|
|
249
299
|
return scan.authoritySessionId === sessionId && !scan.ambiguousSessionMetadata;
|
|
250
300
|
}
|