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 CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- // sessionpipe-conformance 0.6.1 · Apache-2.0 · https://sessionpipe.org
2
+ // sessionpipe-conformance 0.7.0 · Apache-2.0 · https://sessionpipe.org
3
3
 
4
4
  // src/cli.ts
5
5
  import { readdirSync as readdirSync5, statSync as statSync4 } from "node:fs";
@@ -175,6 +175,9 @@ function readClaude(lines, from) {
175
175
  }
176
176
  return pairTurns(msgs, endOf(lines));
177
177
  }
178
+ function codexInjected(text) {
179
+ return /^<[a-z_-]+>/i.test(text) || /^# AGENTS\.md instructions\b/i.test(text);
180
+ }
178
181
  function readCodex(lines, from) {
179
182
  const msgs = [];
180
183
  for (let i = from; i < lines.length; i++) {
@@ -186,7 +189,7 @@ function readCodex(lines, from) {
186
189
  const text = textParts(p.content, ["input_text", "output_text"]).trim();
187
190
  if (!text) continue;
188
191
  if (p.role === "user") {
189
- if (/^<[a-z_-]+>/i.test(text)) continue;
192
+ if (codexInjected(text)) continue;
190
193
  msgs.push({ role: "user", text, at, line: i });
191
194
  } else if (p.role === "assistant") msgs.push({ role: "assistant", text, at, line: i });
192
195
  }
@@ -1424,7 +1427,8 @@ function uninstallNotify(env) {
1424
1427
  }
1425
1428
  return { file, changed: false };
1426
1429
  }
1427
- function findRollout(threadId, env) {
1430
+ function findRollout(threadId, env = process.env) {
1431
+ if (!/^[A-Za-z0-9-]{8,128}$/.test(threadId)) return null;
1428
1432
  let best = null;
1429
1433
  const walk2 = (dir, depth) => {
1430
1434
  let names = [];
@@ -1435,7 +1439,7 @@ function findRollout(threadId, env) {
1435
1439
  }
1436
1440
  for (const n of names.sort().reverse()) {
1437
1441
  const p = path5.join(dir, n);
1438
- if (n.endsWith(".jsonl") && n.includes(threadId)) {
1442
+ if (n.endsWith(`-${threadId}.jsonl`)) {
1439
1443
  best = p;
1440
1444
  return;
1441
1445
  }
@@ -1640,7 +1644,7 @@ function codexFacts(file) {
1640
1644
  const p = j.payload;
1641
1645
  if (j.type !== "response_item" || !p || p.type !== "message" || p.role !== "user") continue;
1642
1646
  const text = (p.content ?? []).filter((b) => b && b.type === "input_text" && typeof b.text === "string").map((b) => b.text).join("\n").trim();
1643
- if (!text || /^<[a-z_-]+>/i.test(text)) continue;
1647
+ if (!text || codexInjected(text)) continue;
1644
1648
  const line = text.split("\n").find((l) => l.trim()) ?? "";
1645
1649
  out.title = line.length > 80 ? `${line.slice(0, 80).replace(/\s+\S*$/, "")}\u2026` : line;
1646
1650
  out.title_source = "first-ask";