sessionpipe-conformance 0.11.0 → 0.12.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.11.0 · Apache-2.0 · https://sessionpipe.org
2
+ // sessionpipe-conformance 0.12.0 · Apache-2.0 · https://sessionpipe.org
3
3
 
4
4
  // src/cli.ts
5
5
  import { readdirSync as readdirSync5, realpathSync as realpathSync2, statSync as statSync5 } from "node:fs";
@@ -7,7 +7,7 @@ import path9 from "node:path";
7
7
  import { pathToFileURL } from "node:url";
8
8
 
9
9
  // src/index.ts
10
- import { readFileSync as readFileSync6 } from "node:fs";
10
+ import { readFileSync as readFileSync7 } from "node:fs";
11
11
 
12
12
  // ../core/src/paths.ts
13
13
  import os from "node:os";
@@ -602,13 +602,7 @@ var claudeCode = {
602
602
  );
603
603
  break;
604
604
  case "Stop":
605
- events.push(
606
- ev("turn.ended", {
607
- turn_id,
608
- reason: "stop",
609
- background: Array.isArray(s.background_tasks) ? s.background_tasks.length : void 0
610
- })
611
- );
605
+ events.push(ev("turn.ended", { turn_id, reason: "stop", background: backgroundCount(s.background_tasks) }));
612
606
  break;
613
607
  case "StopFailure":
614
608
  events.push(
@@ -631,7 +625,8 @@ var claudeCode = {
631
625
  events.push(
632
626
  ev("subagent.ended", {
633
627
  agent_id: String(s.agent_id ?? ""),
634
- agent_type: typeof s.agent_type === "string" ? s.agent_type : void 0
628
+ agent_type: typeof s.agent_type === "string" ? s.agent_type : void 0,
629
+ background: backgroundCount(s.background_tasks, String(s.agent_id ?? ""))
635
630
  })
636
631
  );
637
632
  break;
@@ -706,6 +701,15 @@ var claudeCode = {
706
701
  return rows2;
707
702
  }
708
703
  };
704
+ var WAITER_RE = /(?:^|[\s"'`/\\])sessionpipe(?:\.\w+)?["']?\s+wait(?:\s|$)/;
705
+ function backgroundCount(tasks, ending) {
706
+ if (!Array.isArray(tasks)) return void 0;
707
+ return tasks.filter((t) => {
708
+ const task = t;
709
+ if (ending !== void 0 && task?.id === ending) return false;
710
+ return !(typeof task?.command === "string" && WAITER_RE.test(task.command));
711
+ }).length;
712
+ }
709
713
  var LINE_REFRESH_S = 60;
710
714
  function statusLine(file, want, cmd) {
711
715
  const f = readJsonFile(file);
@@ -1134,7 +1138,7 @@ async function claudeAiTitle(bridge, token) {
1134
1138
  }
1135
1139
 
1136
1140
  // ../core/src/adapters/headless.ts
1137
- import { accessSync, constants, statSync as statSync3 } from "node:fs";
1141
+ import { accessSync, constants, readFileSync as readFileSync3, statSync as statSync3 } from "node:fs";
1138
1142
  import path4 from "node:path";
1139
1143
  var JOB_TIMEOUT_MS = 30 * 6e4;
1140
1144
  var OUT_CAP = 1024 * 1024;
@@ -1156,13 +1160,38 @@ function findBinary(o) {
1156
1160
  for (const d of o.dirs) for (const n of o.names) if (isExe(path4.join(d, n))) return path4.join(d, n);
1157
1161
  return null;
1158
1162
  }
1163
+ function shimTarget(shim) {
1164
+ let text = "";
1165
+ try {
1166
+ text = readFileSync3(shim, "utf8");
1167
+ } catch {
1168
+ return null;
1169
+ }
1170
+ const m = /"%(?:~dp0|dp0%)\\([^"]+)"\s+%\*/.exec(text);
1171
+ if (!m) return null;
1172
+ const target = path4.resolve(path4.dirname(shim), m[1].split("\\").join(path4.sep));
1173
+ try {
1174
+ return statSync3(target).isFile() ? target : null;
1175
+ } catch {
1176
+ return null;
1177
+ }
1178
+ }
1179
+ function spawnable(bin, args) {
1180
+ if (!/\.(cmd|bat)$/i.test(bin)) return { file: bin, args };
1181
+ const target = shimTarget(bin);
1182
+ return target ? { file: process.execPath, args: [target, ...args] } : null;
1183
+ }
1184
+ function probe(bin, args) {
1185
+ const s = spawnable(bin, args);
1186
+ return s ? { ...s, shell: false } : { file: [`"${bin}"`, ...args].join(" "), args: [], shell: true };
1187
+ }
1159
1188
 
1160
1189
  // ../core/src/adapters/antigravity.ts
1161
1190
  import {
1162
1191
  existsSync as existsSync3,
1163
1192
  mkdirSync as mkdirSync2,
1164
1193
  readdirSync as readdirSync3,
1165
- readFileSync as readFileSync3,
1194
+ readFileSync as readFileSync4,
1166
1195
  realpathSync,
1167
1196
  statSync as statSync4,
1168
1197
  unlinkSync as unlinkSync2,
@@ -1291,7 +1320,7 @@ var antigravity = {
1291
1320
  readTranscript(file, fromLine) {
1292
1321
  let text = "";
1293
1322
  try {
1294
- text = readFileSync3(file, "utf8");
1323
+ text = readFileSync4(file, "utf8");
1295
1324
  } catch {
1296
1325
  return { turns: [], line: fromLine };
1297
1326
  }
@@ -1370,7 +1399,7 @@ function agProjects(dir) {
1370
1399
  if (!ID_RE.test(id)) continue;
1371
1400
  let j;
1372
1401
  try {
1373
- j = JSON.parse(readFileSync3(path5.join(dir, n), "utf8"));
1402
+ j = JSON.parse(readFileSync4(path5.join(dir, n), "utf8"));
1374
1403
  } catch {
1375
1404
  continue;
1376
1405
  }
@@ -1407,7 +1436,7 @@ function antigravityRemoteUrl(transcript, opts) {
1407
1436
  for (const d of dirs) {
1408
1437
  try {
1409
1438
  const m = /installation_uuid:\s*"([0-9a-f-]{36})"/i.exec(
1410
- readFileSync3(path5.join(d, "antigravity_state.pbtxt"), "utf8")
1439
+ readFileSync4(path5.join(d, "antigravity_state.pbtxt"), "utf8")
1411
1440
  );
1412
1441
  if (!m) continue;
1413
1442
  const base = `https://antigravity.google.com/r/${m[1]}-v2`;
@@ -1446,7 +1475,7 @@ function antigravityFacts(file, opts) {
1446
1475
  }
1447
1476
 
1448
1477
  // ../core/src/adapters/codex.ts
1449
- import { existsSync as existsSync4, mkdirSync as mkdirSync3, readdirSync as readdirSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync4 } from "node:fs";
1478
+ import { existsSync as existsSync4, mkdirSync as mkdirSync3, readdirSync as readdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "node:fs";
1450
1479
  import path6 from "node:path";
1451
1480
 
1452
1481
  // ../core/src/adapters/codex-config.ts
@@ -1603,7 +1632,7 @@ function installNotify(cmd, env) {
1603
1632
  const file = configFile(env);
1604
1633
  let text = "";
1605
1634
  try {
1606
- text = readFileSync4(file, "utf8");
1635
+ text = readFileSync5(file, "utf8");
1607
1636
  } catch {
1608
1637
  }
1609
1638
  const argv = cmd([NAME3, "notify"]).argv;
@@ -1649,7 +1678,7 @@ function uninstallNotify(env) {
1649
1678
  const file = configFile(env);
1650
1679
  let text;
1651
1680
  try {
1652
- text = readFileSync4(file, "utf8");
1681
+ text = readFileSync5(file, "utf8");
1653
1682
  } catch {
1654
1683
  return { file, changed: false };
1655
1684
  }
@@ -1721,7 +1750,7 @@ var codex = {
1721
1750
  ];
1722
1751
  let text = "";
1723
1752
  try {
1724
- text = readFileSync4(configFile(env), "utf8");
1753
+ text = readFileSync5(configFile(env), "utf8");
1725
1754
  } catch {
1726
1755
  }
1727
1756
  const n = readNotify(text);
@@ -1848,7 +1877,7 @@ var codex = {
1848
1877
  readTranscript(file, fromLine) {
1849
1878
  let text = "";
1850
1879
  try {
1851
- text = readFileSync4(file, "utf8");
1880
+ text = readFileSync5(file, "utf8");
1852
1881
  } catch {
1853
1882
  return { turns: [], line: fromLine };
1854
1883
  }
@@ -2369,7 +2398,7 @@ function devinAccount(env = process.env) {
2369
2398
 
2370
2399
  // ../core/src/adapters/gemini-cli.ts
2371
2400
  import { execFileSync as execFileSync4 } from "node:child_process";
2372
- import { existsSync as existsSync7, readFileSync as readFileSync5 } from "node:fs";
2401
+ import { existsSync as existsSync7, readFileSync as readFileSync6 } from "node:fs";
2373
2402
  import path8 from "node:path";
2374
2403
  var NAME5 = "gemini-cli";
2375
2404
  var GEMINI_EVENTS = [
@@ -2391,14 +2420,14 @@ function geminiVersion(platform = process.platform, env = process.env) {
2391
2420
  const win = platform === "win32";
2392
2421
  const bin = win ? findBinary({ names: ["gemini.exe", "gemini.cmd"], dirs: [path8.dirname(process.execPath)], env }) : "gemini";
2393
2422
  if (!bin) throw new Error("no gemini on PATH");
2394
- const o = {
2423
+ const c = probe(bin, ["--version"]);
2424
+ return execFileSync4(c.file, c.args, {
2395
2425
  encoding: "utf8",
2396
2426
  timeout: 4e3,
2397
2427
  stdio: ["ignore", "pipe", "ignore"],
2398
- env
2399
- };
2400
- const out = /\.cmd$/i.test(bin) ? execFileSync4(`"${bin}" --version`, { ...o, shell: true }) : execFileSync4(bin, ["--version"], o);
2401
- return out.trim();
2428
+ env,
2429
+ shell: c.shell
2430
+ }).trim();
2402
2431
  }
2403
2432
  function geminiHooksActive(settingsFile) {
2404
2433
  const tools = readJson(settingsFile).tools;
@@ -2523,7 +2552,7 @@ var geminiCli = {
2523
2552
  readTranscript(file, fromLine) {
2524
2553
  let text = "";
2525
2554
  try {
2526
- text = readFileSync5(file, "utf8");
2555
+ text = readFileSync6(file, "utf8");
2527
2556
  } catch {
2528
2557
  return { turns: [], line: fromLine };
2529
2558
  }
@@ -2602,7 +2631,7 @@ function matches(expect, got, pathStr = "") {
2602
2631
  async function runAdapterFixtures(files) {
2603
2632
  const results = [];
2604
2633
  for (const file of files) {
2605
- const fx = JSON.parse(readFileSync6(file, "utf8"));
2634
+ const fx = JSON.parse(readFileSync7(file, "utf8"));
2606
2635
  const adapter = adapterByName(fx.harness);
2607
2636
  if (!adapter) {
2608
2637
  results.push({ file, ok: false, why: `no adapter ${fx.harness}` });