@shuind/dsh-codex-harness 0.2.10 → 0.2.11
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/index.js +9 -2
- package/lib/types/index.js +10 -2
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -1540,9 +1540,16 @@ function installCodexSettings(ctx, systemPrompt, persona, harnessSourcePrompt, w
|
|
|
1540
1540
|
});
|
|
1541
1541
|
return { current: () => withDefaults(source()) };
|
|
1542
1542
|
}
|
|
1543
|
+
/** Read the event snapshot across the pre- and post-0.1.2 DSH session APIs. */
|
|
1544
|
+
function sessionEvents(session) {
|
|
1545
|
+
const compatible = session;
|
|
1546
|
+
if (typeof compatible.snapshotEvents === "function") return compatible.snapshotEvents();
|
|
1547
|
+
return compatible.events ?? [];
|
|
1548
|
+
}
|
|
1543
1549
|
function hasOpenTurn(session) {
|
|
1544
|
-
const
|
|
1545
|
-
const
|
|
1550
|
+
const events = sessionEvents(session);
|
|
1551
|
+
const start = events.findLast((event) => event.type === "turn/start");
|
|
1552
|
+
const end = events.findLast((event) => event.type === "turn/end");
|
|
1546
1553
|
return start !== void 0 && (end === void 0 || start.seq > end.seq);
|
|
1547
1554
|
}
|
|
1548
1555
|
/**
|
package/lib/types/index.js
CHANGED
|
@@ -170,9 +170,17 @@ function installCodexSettings(ctx, systemPrompt, persona, harnessSourcePrompt, w
|
|
|
170
170
|
}
|
|
171
171
|
return { current: () => withDefaults(source()) };
|
|
172
172
|
}
|
|
173
|
+
/** Read the event snapshot across the pre- and post-0.1.2 DSH session APIs. */
|
|
174
|
+
function sessionEvents(session) {
|
|
175
|
+
const compatible = session;
|
|
176
|
+
if (typeof compatible.snapshotEvents === 'function')
|
|
177
|
+
return compatible.snapshotEvents();
|
|
178
|
+
return compatible.events ?? [];
|
|
179
|
+
}
|
|
173
180
|
function hasOpenTurn(session) {
|
|
174
|
-
const
|
|
175
|
-
const
|
|
181
|
+
const events = sessionEvents(session);
|
|
182
|
+
const start = events.findLast(event => event.type === 'turn/start');
|
|
183
|
+
const end = events.findLast(event => event.type === 'turn/end');
|
|
176
184
|
return start !== undefined && (end === undefined || start.seq > end.seq);
|
|
177
185
|
}
|
|
178
186
|
/**
|