sessionpipe-conformance 0.6.1 → 0.7.0
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/dist/cli.js +9 -5
- package/dist/cli.js.map +2 -2
- package/dist/index.js +9 -5
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// sessionpipe-conformance 0.
|
|
1
|
+
// sessionpipe-conformance 0.7.0 · Apache-2.0 · https://sessionpipe.org
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import { readFileSync as readFileSync6 } from "node:fs";
|
|
@@ -170,6 +170,9 @@ function readClaude(lines, from) {
|
|
|
170
170
|
}
|
|
171
171
|
return pairTurns(msgs, endOf(lines));
|
|
172
172
|
}
|
|
173
|
+
function codexInjected(text) {
|
|
174
|
+
return /^<[a-z_-]+>/i.test(text) || /^# AGENTS\.md instructions\b/i.test(text);
|
|
175
|
+
}
|
|
173
176
|
function readCodex(lines, from) {
|
|
174
177
|
const msgs = [];
|
|
175
178
|
for (let i = from; i < lines.length; i++) {
|
|
@@ -181,7 +184,7 @@ function readCodex(lines, from) {
|
|
|
181
184
|
const text = textParts(p.content, ["input_text", "output_text"]).trim();
|
|
182
185
|
if (!text) continue;
|
|
183
186
|
if (p.role === "user") {
|
|
184
|
-
if (
|
|
187
|
+
if (codexInjected(text)) continue;
|
|
185
188
|
msgs.push({ role: "user", text, at, line: i });
|
|
186
189
|
} else if (p.role === "assistant") msgs.push({ role: "assistant", text, at, line: i });
|
|
187
190
|
}
|
|
@@ -1419,7 +1422,8 @@ function uninstallNotify(env) {
|
|
|
1419
1422
|
}
|
|
1420
1423
|
return { file, changed: false };
|
|
1421
1424
|
}
|
|
1422
|
-
function findRollout(threadId, env) {
|
|
1425
|
+
function findRollout(threadId, env = process.env) {
|
|
1426
|
+
if (!/^[A-Za-z0-9-]{8,128}$/.test(threadId)) return null;
|
|
1423
1427
|
let best = null;
|
|
1424
1428
|
const walk = (dir, depth) => {
|
|
1425
1429
|
let names = [];
|
|
@@ -1430,7 +1434,7 @@ function findRollout(threadId, env) {
|
|
|
1430
1434
|
}
|
|
1431
1435
|
for (const n of names.sort().reverse()) {
|
|
1432
1436
|
const p = path5.join(dir, n);
|
|
1433
|
-
if (n.endsWith(
|
|
1437
|
+
if (n.endsWith(`-${threadId}.jsonl`)) {
|
|
1434
1438
|
best = p;
|
|
1435
1439
|
return;
|
|
1436
1440
|
}
|
|
@@ -1635,7 +1639,7 @@ function codexFacts(file) {
|
|
|
1635
1639
|
const p = j.payload;
|
|
1636
1640
|
if (j.type !== "response_item" || !p || p.type !== "message" || p.role !== "user") continue;
|
|
1637
1641
|
const text = (p.content ?? []).filter((b) => b && b.type === "input_text" && typeof b.text === "string").map((b) => b.text).join("\n").trim();
|
|
1638
|
-
if (!text ||
|
|
1642
|
+
if (!text || codexInjected(text)) continue;
|
|
1639
1643
|
const line = text.split("\n").find((l) => l.trim()) ?? "";
|
|
1640
1644
|
out.title = line.length > 80 ? `${line.slice(0, 80).replace(/\s+\S*$/, "")}\u2026` : line;
|
|
1641
1645
|
out.title_source = "first-ask";
|