agent-relay-runner 0.12.1 → 0.12.3
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/package.json
CHANGED
package/src/runner.ts
CHANGED
|
@@ -1139,15 +1139,29 @@ export class AgentRunner {
|
|
|
1139
1139
|
// and drop the rest of the turn. A seen-set is idempotent under any reshuffle.
|
|
1140
1140
|
const seen = new Set<string>();
|
|
1141
1141
|
const turnIdAtStart = this.currentTurnId;
|
|
1142
|
+
// On the first poll the new prompt usually hasn't landed in the transcript yet,
|
|
1143
|
+
// so extractLatestTurnSteps still returns the PRIOR (completed) turn. Seed those
|
|
1144
|
+
// signatures as already-seen so we don't replay last turn's reasoning/tools as
|
|
1145
|
+
// this turn's activity. Once our prompt lands the window resets at the new user
|
|
1146
|
+
// boundary and genuinely-new steps emit normally. Only seed when the transcript
|
|
1147
|
+
// is complete (last entry is an end_turn assistant) — otherwise we're already
|
|
1148
|
+
// inside the new turn and those steps are legitimately ours.
|
|
1149
|
+
let seeded = false;
|
|
1142
1150
|
const poll = async (): Promise<void> => {
|
|
1143
1151
|
let jsonl: string;
|
|
1144
1152
|
try { jsonl = await readFile(transcriptPath, "utf8"); } catch { return; }
|
|
1145
1153
|
let steps: ReturnType<typeof extractLatestTurnSteps>;
|
|
1146
1154
|
try { steps = extractLatestTurnSteps(jsonl); } catch { return; }
|
|
1155
|
+
if (!seeded) {
|
|
1156
|
+
seeded = true;
|
|
1157
|
+
if (transcriptLooksComplete(jsonl)) {
|
|
1158
|
+
for (const s of steps) seen.add(JSON.stringify([s.type, s.label ?? "", s.text]));
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1147
1161
|
const turnId = this.currentTurnId ?? turnIdAtStart;
|
|
1148
1162
|
let emitted = 0;
|
|
1149
1163
|
for (const step of steps) {
|
|
1150
|
-
const sig =
|
|
1164
|
+
const sig = JSON.stringify([step.type, step.label ?? "", step.text]);
|
|
1151
1165
|
if (seen.has(sig)) continue;
|
|
1152
1166
|
seen.add(sig);
|
|
1153
1167
|
emitted += 1;
|