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 +57 -28
- package/dist/cli.js.map +3 -3
- package/dist/index.js +57 -28
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// sessionpipe-conformance 0.
|
|
1
|
+
// sessionpipe-conformance 0.12.0 · Apache-2.0 · https://sessionpipe.org
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { readFileSync as
|
|
4
|
+
import { readFileSync as readFileSync7 } from "node:fs";
|
|
5
5
|
|
|
6
6
|
// ../core/src/paths.ts
|
|
7
7
|
import os from "node:os";
|
|
@@ -596,13 +596,7 @@ var claudeCode = {
|
|
|
596
596
|
);
|
|
597
597
|
break;
|
|
598
598
|
case "Stop":
|
|
599
|
-
events.push(
|
|
600
|
-
ev("turn.ended", {
|
|
601
|
-
turn_id,
|
|
602
|
-
reason: "stop",
|
|
603
|
-
background: Array.isArray(s.background_tasks) ? s.background_tasks.length : void 0
|
|
604
|
-
})
|
|
605
|
-
);
|
|
599
|
+
events.push(ev("turn.ended", { turn_id, reason: "stop", background: backgroundCount(s.background_tasks) }));
|
|
606
600
|
break;
|
|
607
601
|
case "StopFailure":
|
|
608
602
|
events.push(
|
|
@@ -625,7 +619,8 @@ var claudeCode = {
|
|
|
625
619
|
events.push(
|
|
626
620
|
ev("subagent.ended", {
|
|
627
621
|
agent_id: String(s.agent_id ?? ""),
|
|
628
|
-
agent_type: typeof s.agent_type === "string" ? s.agent_type : void 0
|
|
622
|
+
agent_type: typeof s.agent_type === "string" ? s.agent_type : void 0,
|
|
623
|
+
background: backgroundCount(s.background_tasks, String(s.agent_id ?? ""))
|
|
629
624
|
})
|
|
630
625
|
);
|
|
631
626
|
break;
|
|
@@ -700,6 +695,15 @@ var claudeCode = {
|
|
|
700
695
|
return rows2;
|
|
701
696
|
}
|
|
702
697
|
};
|
|
698
|
+
var WAITER_RE = /(?:^|[\s"'`/\\])sessionpipe(?:\.\w+)?["']?\s+wait(?:\s|$)/;
|
|
699
|
+
function backgroundCount(tasks, ending) {
|
|
700
|
+
if (!Array.isArray(tasks)) return void 0;
|
|
701
|
+
return tasks.filter((t) => {
|
|
702
|
+
const task = t;
|
|
703
|
+
if (ending !== void 0 && task?.id === ending) return false;
|
|
704
|
+
return !(typeof task?.command === "string" && WAITER_RE.test(task.command));
|
|
705
|
+
}).length;
|
|
706
|
+
}
|
|
703
707
|
var LINE_REFRESH_S = 60;
|
|
704
708
|
function statusLine(file, want, cmd) {
|
|
705
709
|
const f = readJsonFile(file);
|
|
@@ -1128,7 +1132,7 @@ async function claudeAiTitle(bridge, token) {
|
|
|
1128
1132
|
}
|
|
1129
1133
|
|
|
1130
1134
|
// ../core/src/adapters/headless.ts
|
|
1131
|
-
import { accessSync, constants, statSync as statSync3 } from "node:fs";
|
|
1135
|
+
import { accessSync, constants, readFileSync as readFileSync3, statSync as statSync3 } from "node:fs";
|
|
1132
1136
|
import path4 from "node:path";
|
|
1133
1137
|
var JOB_TIMEOUT_MS = 30 * 6e4;
|
|
1134
1138
|
var OUT_CAP = 1024 * 1024;
|
|
@@ -1150,13 +1154,38 @@ function findBinary(o) {
|
|
|
1150
1154
|
for (const d of o.dirs) for (const n of o.names) if (isExe(path4.join(d, n))) return path4.join(d, n);
|
|
1151
1155
|
return null;
|
|
1152
1156
|
}
|
|
1157
|
+
function shimTarget(shim) {
|
|
1158
|
+
let text = "";
|
|
1159
|
+
try {
|
|
1160
|
+
text = readFileSync3(shim, "utf8");
|
|
1161
|
+
} catch {
|
|
1162
|
+
return null;
|
|
1163
|
+
}
|
|
1164
|
+
const m = /"%(?:~dp0|dp0%)\\([^"]+)"\s+%\*/.exec(text);
|
|
1165
|
+
if (!m) return null;
|
|
1166
|
+
const target = path4.resolve(path4.dirname(shim), m[1].split("\\").join(path4.sep));
|
|
1167
|
+
try {
|
|
1168
|
+
return statSync3(target).isFile() ? target : null;
|
|
1169
|
+
} catch {
|
|
1170
|
+
return null;
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
function spawnable(bin, args) {
|
|
1174
|
+
if (!/\.(cmd|bat)$/i.test(bin)) return { file: bin, args };
|
|
1175
|
+
const target = shimTarget(bin);
|
|
1176
|
+
return target ? { file: process.execPath, args: [target, ...args] } : null;
|
|
1177
|
+
}
|
|
1178
|
+
function probe(bin, args) {
|
|
1179
|
+
const s = spawnable(bin, args);
|
|
1180
|
+
return s ? { ...s, shell: false } : { file: [`"${bin}"`, ...args].join(" "), args: [], shell: true };
|
|
1181
|
+
}
|
|
1153
1182
|
|
|
1154
1183
|
// ../core/src/adapters/antigravity.ts
|
|
1155
1184
|
import {
|
|
1156
1185
|
existsSync as existsSync3,
|
|
1157
1186
|
mkdirSync as mkdirSync2,
|
|
1158
1187
|
readdirSync as readdirSync3,
|
|
1159
|
-
readFileSync as
|
|
1188
|
+
readFileSync as readFileSync4,
|
|
1160
1189
|
realpathSync,
|
|
1161
1190
|
statSync as statSync4,
|
|
1162
1191
|
unlinkSync as unlinkSync2,
|
|
@@ -1285,7 +1314,7 @@ var antigravity = {
|
|
|
1285
1314
|
readTranscript(file, fromLine) {
|
|
1286
1315
|
let text = "";
|
|
1287
1316
|
try {
|
|
1288
|
-
text =
|
|
1317
|
+
text = readFileSync4(file, "utf8");
|
|
1289
1318
|
} catch {
|
|
1290
1319
|
return { turns: [], line: fromLine };
|
|
1291
1320
|
}
|
|
@@ -1364,7 +1393,7 @@ function agProjects(dir) {
|
|
|
1364
1393
|
if (!ID_RE.test(id)) continue;
|
|
1365
1394
|
let j;
|
|
1366
1395
|
try {
|
|
1367
|
-
j = JSON.parse(
|
|
1396
|
+
j = JSON.parse(readFileSync4(path5.join(dir, n), "utf8"));
|
|
1368
1397
|
} catch {
|
|
1369
1398
|
continue;
|
|
1370
1399
|
}
|
|
@@ -1401,7 +1430,7 @@ function antigravityRemoteUrl(transcript, opts) {
|
|
|
1401
1430
|
for (const d of dirs) {
|
|
1402
1431
|
try {
|
|
1403
1432
|
const m = /installation_uuid:\s*"([0-9a-f-]{36})"/i.exec(
|
|
1404
|
-
|
|
1433
|
+
readFileSync4(path5.join(d, "antigravity_state.pbtxt"), "utf8")
|
|
1405
1434
|
);
|
|
1406
1435
|
if (!m) continue;
|
|
1407
1436
|
const base = `https://antigravity.google.com/r/${m[1]}-v2`;
|
|
@@ -1440,7 +1469,7 @@ function antigravityFacts(file, opts) {
|
|
|
1440
1469
|
}
|
|
1441
1470
|
|
|
1442
1471
|
// ../core/src/adapters/codex.ts
|
|
1443
|
-
import { existsSync as existsSync4, mkdirSync as mkdirSync3, readdirSync as readdirSync4, readFileSync as
|
|
1472
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync3, readdirSync as readdirSync4, readFileSync as readFileSync5, writeFileSync as writeFileSync4 } from "node:fs";
|
|
1444
1473
|
import path6 from "node:path";
|
|
1445
1474
|
|
|
1446
1475
|
// ../core/src/adapters/codex-config.ts
|
|
@@ -1597,7 +1626,7 @@ function installNotify(cmd, env) {
|
|
|
1597
1626
|
const file = configFile(env);
|
|
1598
1627
|
let text = "";
|
|
1599
1628
|
try {
|
|
1600
|
-
text =
|
|
1629
|
+
text = readFileSync5(file, "utf8");
|
|
1601
1630
|
} catch {
|
|
1602
1631
|
}
|
|
1603
1632
|
const argv = cmd([NAME3, "notify"]).argv;
|
|
@@ -1643,7 +1672,7 @@ function uninstallNotify(env) {
|
|
|
1643
1672
|
const file = configFile(env);
|
|
1644
1673
|
let text;
|
|
1645
1674
|
try {
|
|
1646
|
-
text =
|
|
1675
|
+
text = readFileSync5(file, "utf8");
|
|
1647
1676
|
} catch {
|
|
1648
1677
|
return { file, changed: false };
|
|
1649
1678
|
}
|
|
@@ -1715,7 +1744,7 @@ var codex = {
|
|
|
1715
1744
|
];
|
|
1716
1745
|
let text = "";
|
|
1717
1746
|
try {
|
|
1718
|
-
text =
|
|
1747
|
+
text = readFileSync5(configFile(env), "utf8");
|
|
1719
1748
|
} catch {
|
|
1720
1749
|
}
|
|
1721
1750
|
const n = readNotify(text);
|
|
@@ -1842,7 +1871,7 @@ var codex = {
|
|
|
1842
1871
|
readTranscript(file, fromLine) {
|
|
1843
1872
|
let text = "";
|
|
1844
1873
|
try {
|
|
1845
|
-
text =
|
|
1874
|
+
text = readFileSync5(file, "utf8");
|
|
1846
1875
|
} catch {
|
|
1847
1876
|
return { turns: [], line: fromLine };
|
|
1848
1877
|
}
|
|
@@ -2363,7 +2392,7 @@ function devinAccount(env = process.env) {
|
|
|
2363
2392
|
|
|
2364
2393
|
// ../core/src/adapters/gemini-cli.ts
|
|
2365
2394
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
2366
|
-
import { existsSync as existsSync7, readFileSync as
|
|
2395
|
+
import { existsSync as existsSync7, readFileSync as readFileSync6 } from "node:fs";
|
|
2367
2396
|
import path8 from "node:path";
|
|
2368
2397
|
var NAME5 = "gemini-cli";
|
|
2369
2398
|
var GEMINI_EVENTS = [
|
|
@@ -2385,14 +2414,14 @@ function geminiVersion(platform = process.platform, env = process.env) {
|
|
|
2385
2414
|
const win = platform === "win32";
|
|
2386
2415
|
const bin = win ? findBinary({ names: ["gemini.exe", "gemini.cmd"], dirs: [path8.dirname(process.execPath)], env }) : "gemini";
|
|
2387
2416
|
if (!bin) throw new Error("no gemini on PATH");
|
|
2388
|
-
const
|
|
2417
|
+
const c = probe(bin, ["--version"]);
|
|
2418
|
+
return execFileSync4(c.file, c.args, {
|
|
2389
2419
|
encoding: "utf8",
|
|
2390
2420
|
timeout: 4e3,
|
|
2391
2421
|
stdio: ["ignore", "pipe", "ignore"],
|
|
2392
|
-
env
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
return out.trim();
|
|
2422
|
+
env,
|
|
2423
|
+
shell: c.shell
|
|
2424
|
+
}).trim();
|
|
2396
2425
|
}
|
|
2397
2426
|
function geminiHooksActive(settingsFile) {
|
|
2398
2427
|
const tools = readJson(settingsFile).tools;
|
|
@@ -2517,7 +2546,7 @@ var geminiCli = {
|
|
|
2517
2546
|
readTranscript(file, fromLine) {
|
|
2518
2547
|
let text = "";
|
|
2519
2548
|
try {
|
|
2520
|
-
text =
|
|
2549
|
+
text = readFileSync6(file, "utf8");
|
|
2521
2550
|
} catch {
|
|
2522
2551
|
return { turns: [], line: fromLine };
|
|
2523
2552
|
}
|
|
@@ -2596,7 +2625,7 @@ function matches(expect, got, pathStr = "") {
|
|
|
2596
2625
|
async function runAdapterFixtures(files) {
|
|
2597
2626
|
const results = [];
|
|
2598
2627
|
for (const file of files) {
|
|
2599
|
-
const fx = JSON.parse(
|
|
2628
|
+
const fx = JSON.parse(readFileSync7(file, "utf8"));
|
|
2600
2629
|
const adapter = adapterByName(fx.harness);
|
|
2601
2630
|
if (!adapter) {
|
|
2602
2631
|
results.push({ file, ok: false, why: `no adapter ${fx.harness}` });
|