@sjawhar/pi-legion 9.7.0 → 9.8.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.
Files changed (2) hide show
  1. package/dist/legion.js +39 -8
  2. package/package.json +1 -1
package/dist/legion.js CHANGED
@@ -15729,7 +15729,7 @@ function onEnvoyRoleRegained(listener) {
15729
15729
  // package.json
15730
15730
  var package_default = {
15731
15731
  name: "@sjawhar/pi-legion",
15732
- version: "9.7.0",
15732
+ version: "9.8.0",
15733
15733
  license: "Apache-2.0",
15734
15734
  type: "module",
15735
15735
  omp: {
@@ -16224,11 +16224,10 @@ function createLegionDaemonClient(baseUrl, fetchFn = fetch) {
16224
16224
  }
16225
16225
 
16226
16226
  // src/jj-attribution.ts
16227
- import { execFile as execFile2 } from "child_process";
16228
16227
  import { mkdir, rename, writeFile } from "fs/promises";
16229
16228
  import path4 from "path";
16230
- import { promisify as promisify2 } from "util";
16231
16229
  var UUID = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}";
16230
+ var JJ_CONFIG_PATH_TIMEOUT_MS = 1e4;
16232
16231
  var TOP_LEVEL_TRANSCRIPT = new RegExp(`^\\d{4}-\\d{2}-\\d{2}T[\\d-]+Z_(${UUID})\\.jsonl$`);
16233
16232
  var ATTRIBUTION_OVERLAY = /^omp-attribution-.*\.toml$/;
16234
16233
  function sessionIdFromTranscript(sessionFile) {
@@ -16237,9 +16236,41 @@ function sessionIdFromTranscript(sessionFile) {
16237
16236
  function withoutOverlays(chain) {
16238
16237
  return chain.split(":").filter((entry) => entry && !ATTRIBUTION_OVERLAY.test(path4.basename(entry))).join(":");
16239
16238
  }
16240
- async function userConfigChain() {
16239
+ async function userConfigChain(timeoutMs = JJ_CONFIG_PATH_TIMEOUT_MS, env = process.env) {
16241
16240
  try {
16242
- const { stdout } = await promisify2(execFile2)("jj", ["config", "path", "--user"]);
16241
+ const child = Bun.spawn(["jj", "config", "path", "--user"], {
16242
+ detached: true,
16243
+ env,
16244
+ stdin: "ignore",
16245
+ stdout: "pipe",
16246
+ stderr: "pipe"
16247
+ });
16248
+ const killGroup = () => {
16249
+ try {
16250
+ process.kill(-child.pid, "SIGKILL");
16251
+ } catch {}
16252
+ };
16253
+ const exited = child.exited.finally(killGroup);
16254
+ const completed = Promise.all([
16255
+ exited,
16256
+ new Response(child.stdout).text(),
16257
+ new Response(child.stderr).text()
16258
+ ]);
16259
+ const stdout = await new Promise((resolve) => {
16260
+ const timer = setTimeout(() => {
16261
+ killGroup();
16262
+ resolve(undefined);
16263
+ }, timeoutMs);
16264
+ completed.then(([code, output]) => {
16265
+ clearTimeout(timer);
16266
+ resolve(code === 0 ? output : undefined);
16267
+ }, () => {
16268
+ clearTimeout(timer);
16269
+ resolve(undefined);
16270
+ });
16271
+ });
16272
+ if (stdout === undefined)
16273
+ return;
16243
16274
  const paths = stdout.split(`
16244
16275
  `).filter(Boolean);
16245
16276
  return paths.length > 0 ? paths.join(":") : undefined;
@@ -16482,15 +16513,15 @@ function createControllerSession(deps) {
16482
16513
  }
16483
16514
 
16484
16515
  // src/handoff-commit.ts
16485
- import { execFile as execFile3 } from "child_process";
16486
- import { promisify as promisify3 } from "util";
16516
+ import { execFile as execFile2 } from "child_process";
16517
+ import { promisify as promisify2 } from "util";
16487
16518
  var FILE_BACKED = {
16488
16519
  planning: { word: "plan", role: "planner" },
16489
16520
  implementing: { word: "implement", role: "implementer" },
16490
16521
  testing: { word: "test", role: "tester" },
16491
16522
  reviewing: { word: "review", role: "reviewer" }
16492
16523
  };
16493
- var execFileAsync2 = promisify3(execFile3);
16524
+ var execFileAsync2 = promisify2(execFile2);
16494
16525
  var pathJj = async (args, cwd) => {
16495
16526
  try {
16496
16527
  const { stdout } = await execFileAsync2("jj", ["-R", cwd, ...args], {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sjawhar/pi-legion",
3
- "version": "9.7.0",
3
+ "version": "9.8.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "omp": {