@h-rig/cli 0.0.6-alpha.71 → 0.0.6-alpha.73

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/bin/rig.js CHANGED
@@ -7860,7 +7860,7 @@ async function promptForTaskSelection(question) {
7860
7860
  }
7861
7861
 
7862
7862
  // packages/cli/src/commands/_pi-frontend.ts
7863
- import { mkdtempSync, rmSync as rmSync5 } from "fs";
7863
+ import { mkdtempSync, rmSync as rmSync5, writeFileSync as writeFileSync6 } from "fs";
7864
7864
  import { tmpdir } from "os";
7865
7865
  import { join as join3 } from "path";
7866
7866
  import { main as runPiMain } from "@earendil-works/pi-coding-agent";
@@ -7894,6 +7894,29 @@ function buildOperatorPiEnv(input) {
7894
7894
  async function attachRunBundledPiFrontend(context, input) {
7895
7895
  const tempSessionDir = mkdtempSync(join3(tmpdir(), "rig-pi-frontend-sessions-"));
7896
7896
  const server = await ensureServerForCli(context.projectRoot);
7897
+ let sessionFileArg = [];
7898
+ try {
7899
+ const payload = await requestServerJson(context, `/api/runs/${encodeURIComponent(input.runId)}/session-file`);
7900
+ if (payload?.ok && typeof payload.content === "string" && payload.content.trim()) {
7901
+ const fileName = typeof payload.fileName === "string" && payload.fileName.trim() ? payload.fileName.replace(/[^A-Za-z0-9._-]/g, "_") : `rig-run-${input.runId}.jsonl`;
7902
+ const localSessionPath = join3(tempSessionDir, fileName);
7903
+ const content = payload.content.split(`
7904
+ `).map((line, index) => {
7905
+ if (index > 0 || !line.trim())
7906
+ return line;
7907
+ try {
7908
+ const header = JSON.parse(line);
7909
+ if (header.type === "session" && typeof header.cwd === "string") {
7910
+ return JSON.stringify({ ...header, cwd: process.cwd() });
7911
+ }
7912
+ } catch {}
7913
+ return line;
7914
+ }).join(`
7915
+ `);
7916
+ writeFileSync6(localSessionPath, content);
7917
+ sessionFileArg = ["--session", localSessionPath];
7918
+ }
7919
+ } catch {}
7897
7920
  const restoreEnv = setTemporaryEnv(buildOperatorPiEnv({
7898
7921
  runId: input.runId,
7899
7922
  serverUrl: server.baseUrl,
@@ -7910,7 +7933,8 @@ async function attachRunBundledPiFrontend(context, input) {
7910
7933
  "--no-extensions",
7911
7934
  "--no-skills",
7912
7935
  "--no-prompt-templates",
7913
- "--no-context-files"
7936
+ "--no-context-files",
7937
+ ...sessionFileArg
7914
7938
  ], {
7915
7939
  extensionFactories: [piRigExtensionFactory]
7916
7940
  });
@@ -7981,7 +8005,7 @@ async function attachRunOperatorView(context, input) {
7981
8005
  await withSpinner("Queueing steering message\u2026", () => sendRunPiPromptViaServer(context, input.runId, attachMessage, "steer").catch(() => steerRunViaServer(context, input.runId, attachMessage)), { outputMode: context.outputMode });
7982
8006
  steered = true;
7983
8007
  }
7984
- if (input.follow && !input.once && input.interactive !== false && context.outputMode === "text" && Boolean(process.stdin.isTTY && process.stdout.isTTY)) {
8008
+ if (!input.once && input.interactive !== false && context.outputMode === "text" && Boolean(process.stdin.isTTY && process.stdout.isTTY)) {
7985
8009
  return attachRunBundledPiFrontend(context, {
7986
8010
  runId: input.runId,
7987
8011
  steered
@@ -9843,7 +9867,7 @@ async function executeTask(context, args, options) {
9843
9867
 
9844
9868
  // packages/cli/src/commands/task-run-driver.ts
9845
9869
  init_runner();
9846
- import { copyFileSync as copyFileSync3, existsSync as existsSync15, mkdirSync as mkdirSync9, readFileSync as readFileSync11, statSync as statSync2, writeFileSync as writeFileSync6 } from "fs";
9870
+ import { copyFileSync as copyFileSync3, existsSync as existsSync15, mkdirSync as mkdirSync9, readFileSync as readFileSync11, statSync as statSync2, writeFileSync as writeFileSync7 } from "fs";
9847
9871
  import { resolve as resolve23 } from "path";
9848
9872
  import { spawn as spawn2, spawnSync as spawnSync4 } from "child_process";
9849
9873
  import { createInterface as createLineInterface } from "readline";
@@ -10826,7 +10850,7 @@ async function executeRigOwnedTaskRun(context, input) {
10826
10850
  classifiedAt: new Date().toISOString()
10827
10851
  };
10828
10852
  mkdirSync9(resolve23(context.projectRoot, ".rig", "runs", input.runId), { recursive: true });
10829
- writeFileSync6(resolve23(context.projectRoot, ".rig", "runs", input.runId, "planning-classification.json"), `${JSON.stringify(persistedPlanning, null, 2)}
10853
+ writeFileSync7(resolve23(context.projectRoot, ".rig", "runs", input.runId, "planning-classification.json"), `${JSON.stringify(persistedPlanning, null, 2)}
10830
10854
  `, "utf8");
10831
10855
  patchAuthorityRun(context.projectRoot, input.runId, { planning: persistedPlanning });
10832
10856
  prompt = `${prompt}
@@ -10974,7 +10998,7 @@ ${planningClassification.planningRequired ? `Before implementing, write a concis
10974
10998
  const readyFile = childEnv.RIG_DIRTY_BASELINE_READY_FILE;
10975
10999
  if (readyFile) {
10976
11000
  mkdirSync9(resolve23(readyFile, ".."), { recursive: true });
10977
- writeFileSync6(readyFile, `${JSON.stringify({ ...dirty, workspaceDir: latestRuntimeWorkspace, appliedAt: new Date().toISOString() }, null, 2)}
11001
+ writeFileSync7(readyFile, `${JSON.stringify({ ...dirty, workspaceDir: latestRuntimeWorkspace, appliedAt: new Date().toISOString() }, null, 2)}
10978
11002
  `, "utf8");
10979
11003
  }
10980
11004
  appendRunLog(context.projectRoot, input.runId, {
@@ -11884,7 +11908,7 @@ async function executeTest(context, args) {
11884
11908
 
11885
11909
  // packages/cli/src/commands/setup.ts
11886
11910
  init_runner();
11887
- import { existsSync as existsSync16, mkdirSync as mkdirSync10, readdirSync as readdirSync3, writeFileSync as writeFileSync7 } from "fs";
11911
+ import { existsSync as existsSync16, mkdirSync as mkdirSync10, readdirSync as readdirSync3, writeFileSync as writeFileSync8 } from "fs";
11888
11912
  import { resolve as resolve24 } from "path";
11889
11913
  import { createPluginHost } from "@rig/core";
11890
11914
  import {
@@ -11945,7 +11969,7 @@ function runSetupInit(projectRoot) {
11945
11969
  mkdirSync10(artifactsDir, { recursive: true });
11946
11970
  const failuresPath = resolve24(stateDir, "failed_approaches.md");
11947
11971
  if (!existsSync16(failuresPath)) {
11948
- writeFileSync7(failuresPath, `# Failed Approaches
11972
+ writeFileSync8(failuresPath, `# Failed Approaches
11949
11973
 
11950
11974
  `, "utf-8");
11951
11975
  }
@@ -569,7 +569,7 @@ function createOperatorSurface(options = {}) {
569
569
  }
570
570
 
571
571
  // packages/cli/src/commands/_pi-frontend.ts
572
- import { mkdtempSync, rmSync } from "fs";
572
+ import { mkdtempSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
573
573
  import { tmpdir } from "os";
574
574
  import { join } from "path";
575
575
  import { main as runPiMain } from "@earendil-works/pi-coding-agent";
@@ -603,6 +603,29 @@ function buildOperatorPiEnv(input) {
603
603
  async function attachRunBundledPiFrontend(context, input) {
604
604
  const tempSessionDir = mkdtempSync(join(tmpdir(), "rig-pi-frontend-sessions-"));
605
605
  const server = await ensureServerForCli(context.projectRoot);
606
+ let sessionFileArg = [];
607
+ try {
608
+ const payload = await requestServerJson(context, `/api/runs/${encodeURIComponent(input.runId)}/session-file`);
609
+ if (payload?.ok && typeof payload.content === "string" && payload.content.trim()) {
610
+ const fileName = typeof payload.fileName === "string" && payload.fileName.trim() ? payload.fileName.replace(/[^A-Za-z0-9._-]/g, "_") : `rig-run-${input.runId}.jsonl`;
611
+ const localSessionPath = join(tempSessionDir, fileName);
612
+ const content = payload.content.split(`
613
+ `).map((line, index) => {
614
+ if (index > 0 || !line.trim())
615
+ return line;
616
+ try {
617
+ const header = JSON.parse(line);
618
+ if (header.type === "session" && typeof header.cwd === "string") {
619
+ return JSON.stringify({ ...header, cwd: process.cwd() });
620
+ }
621
+ } catch {}
622
+ return line;
623
+ }).join(`
624
+ `);
625
+ writeFileSync2(localSessionPath, content);
626
+ sessionFileArg = ["--session", localSessionPath];
627
+ }
628
+ } catch {}
606
629
  const restoreEnv = setTemporaryEnv(buildOperatorPiEnv({
607
630
  runId: input.runId,
608
631
  serverUrl: server.baseUrl,
@@ -619,7 +642,8 @@ async function attachRunBundledPiFrontend(context, input) {
619
642
  "--no-extensions",
620
643
  "--no-skills",
621
644
  "--no-prompt-templates",
622
- "--no-context-files"
645
+ "--no-context-files",
646
+ ...sessionFileArg
623
647
  ], {
624
648
  extensionFactories: [piRigExtensionFactory]
625
649
  });
@@ -811,7 +835,7 @@ async function attachRunOperatorView(context, input) {
811
835
  await withSpinner("Queueing steering message\u2026", () => sendRunPiPromptViaServer(context, input.runId, attachMessage, "steer").catch(() => steerRunViaServer(context, input.runId, attachMessage)), { outputMode: context.outputMode });
812
836
  steered = true;
813
837
  }
814
- if (input.follow && !input.once && input.interactive !== false && context.outputMode === "text" && Boolean(process.stdin.isTTY && process.stdout.isTTY)) {
838
+ if (!input.once && input.interactive !== false && context.outputMode === "text" && Boolean(process.stdin.isTTY && process.stdout.isTTY)) {
815
839
  return attachRunBundledPiFrontend(context, {
816
840
  runId: input.runId,
817
841
  steered
@@ -1,6 +1,6 @@
1
1
  // @bun
2
2
  // packages/cli/src/commands/_pi-frontend.ts
3
- import { mkdtempSync, rmSync } from "fs";
3
+ import { mkdtempSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
4
4
  import { tmpdir } from "os";
5
5
  import { join } from "path";
6
6
  import { main as runPiMain } from "@earendil-works/pi-coding-agent";
@@ -366,6 +366,29 @@ function buildOperatorPiEnv(input) {
366
366
  async function attachRunBundledPiFrontend(context, input) {
367
367
  const tempSessionDir = mkdtempSync(join(tmpdir(), "rig-pi-frontend-sessions-"));
368
368
  const server = await ensureServerForCli(context.projectRoot);
369
+ let sessionFileArg = [];
370
+ try {
371
+ const payload = await requestServerJson(context, `/api/runs/${encodeURIComponent(input.runId)}/session-file`);
372
+ if (payload?.ok && typeof payload.content === "string" && payload.content.trim()) {
373
+ const fileName = typeof payload.fileName === "string" && payload.fileName.trim() ? payload.fileName.replace(/[^A-Za-z0-9._-]/g, "_") : `rig-run-${input.runId}.jsonl`;
374
+ const localSessionPath = join(tempSessionDir, fileName);
375
+ const content = payload.content.split(`
376
+ `).map((line, index) => {
377
+ if (index > 0 || !line.trim())
378
+ return line;
379
+ try {
380
+ const header = JSON.parse(line);
381
+ if (header.type === "session" && typeof header.cwd === "string") {
382
+ return JSON.stringify({ ...header, cwd: process.cwd() });
383
+ }
384
+ } catch {}
385
+ return line;
386
+ }).join(`
387
+ `);
388
+ writeFileSync2(localSessionPath, content);
389
+ sessionFileArg = ["--session", localSessionPath];
390
+ }
391
+ } catch {}
369
392
  const restoreEnv = setTemporaryEnv(buildOperatorPiEnv({
370
393
  runId: input.runId,
371
394
  serverUrl: server.baseUrl,
@@ -382,7 +405,8 @@ async function attachRunBundledPiFrontend(context, input) {
382
405
  "--no-extensions",
383
406
  "--no-skills",
384
407
  "--no-prompt-templates",
385
- "--no-context-files"
408
+ "--no-context-files",
409
+ ...sessionFileArg
386
410
  ], {
387
411
  extensionFactories: [piRigExtensionFactory]
388
412
  });
@@ -807,7 +807,7 @@ function createOperatorSurface(options = {}) {
807
807
  }
808
808
 
809
809
  // packages/cli/src/commands/_pi-frontend.ts
810
- import { mkdtempSync, rmSync } from "fs";
810
+ import { mkdtempSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
811
811
  import { tmpdir } from "os";
812
812
  import { join as join2 } from "path";
813
813
  import { main as runPiMain } from "@earendil-works/pi-coding-agent";
@@ -841,6 +841,29 @@ function buildOperatorPiEnv(input) {
841
841
  async function attachRunBundledPiFrontend(context, input) {
842
842
  const tempSessionDir = mkdtempSync(join2(tmpdir(), "rig-pi-frontend-sessions-"));
843
843
  const server = await ensureServerForCli(context.projectRoot);
844
+ let sessionFileArg = [];
845
+ try {
846
+ const payload = await requestServerJson(context, `/api/runs/${encodeURIComponent(input.runId)}/session-file`);
847
+ if (payload?.ok && typeof payload.content === "string" && payload.content.trim()) {
848
+ const fileName = typeof payload.fileName === "string" && payload.fileName.trim() ? payload.fileName.replace(/[^A-Za-z0-9._-]/g, "_") : `rig-run-${input.runId}.jsonl`;
849
+ const localSessionPath = join2(tempSessionDir, fileName);
850
+ const content = payload.content.split(`
851
+ `).map((line, index) => {
852
+ if (index > 0 || !line.trim())
853
+ return line;
854
+ try {
855
+ const header = JSON.parse(line);
856
+ if (header.type === "session" && typeof header.cwd === "string") {
857
+ return JSON.stringify({ ...header, cwd: process.cwd() });
858
+ }
859
+ } catch {}
860
+ return line;
861
+ }).join(`
862
+ `);
863
+ writeFileSync2(localSessionPath, content);
864
+ sessionFileArg = ["--session", localSessionPath];
865
+ }
866
+ } catch {}
844
867
  const restoreEnv = setTemporaryEnv(buildOperatorPiEnv({
845
868
  runId: input.runId,
846
869
  serverUrl: server.baseUrl,
@@ -857,7 +880,8 @@ async function attachRunBundledPiFrontend(context, input) {
857
880
  "--no-extensions",
858
881
  "--no-skills",
859
882
  "--no-prompt-templates",
860
- "--no-context-files"
883
+ "--no-context-files",
884
+ ...sessionFileArg
861
885
  ], {
862
886
  extensionFactories: [piRigExtensionFactory]
863
887
  });
@@ -1049,7 +1073,7 @@ async function attachRunOperatorView(context, input) {
1049
1073
  await withSpinner("Queueing steering message\u2026", () => sendRunPiPromptViaServer(context, input.runId, attachMessage, "steer").catch(() => steerRunViaServer(context, input.runId, attachMessage)), { outputMode: context.outputMode });
1050
1074
  steered = true;
1051
1075
  }
1052
- if (input.follow && !input.once && input.interactive !== false && context.outputMode === "text" && Boolean(process.stdin.isTTY && process.stdout.isTTY)) {
1076
+ if (!input.once && input.interactive !== false && context.outputMode === "text" && Boolean(process.stdin.isTTY && process.stdout.isTTY)) {
1053
1077
  return attachRunBundledPiFrontend(context, {
1054
1078
  runId: input.runId,
1055
1079
  steered
@@ -1170,7 +1170,7 @@ async function withSpinner(label, work, options = {}) {
1170
1170
  }
1171
1171
 
1172
1172
  // packages/cli/src/commands/_pi-frontend.ts
1173
- import { mkdtempSync, rmSync } from "fs";
1173
+ import { mkdtempSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
1174
1174
  import { tmpdir } from "os";
1175
1175
  import { join } from "path";
1176
1176
  import { main as runPiMain } from "@earendil-works/pi-coding-agent";
@@ -1204,6 +1204,29 @@ function buildOperatorPiEnv(input) {
1204
1204
  async function attachRunBundledPiFrontend(context, input) {
1205
1205
  const tempSessionDir = mkdtempSync(join(tmpdir(), "rig-pi-frontend-sessions-"));
1206
1206
  const server = await ensureServerForCli(context.projectRoot);
1207
+ let sessionFileArg = [];
1208
+ try {
1209
+ const payload = await requestServerJson(context, `/api/runs/${encodeURIComponent(input.runId)}/session-file`);
1210
+ if (payload?.ok && typeof payload.content === "string" && payload.content.trim()) {
1211
+ const fileName = typeof payload.fileName === "string" && payload.fileName.trim() ? payload.fileName.replace(/[^A-Za-z0-9._-]/g, "_") : `rig-run-${input.runId}.jsonl`;
1212
+ const localSessionPath = join(tempSessionDir, fileName);
1213
+ const content = payload.content.split(`
1214
+ `).map((line, index) => {
1215
+ if (index > 0 || !line.trim())
1216
+ return line;
1217
+ try {
1218
+ const header = JSON.parse(line);
1219
+ if (header.type === "session" && typeof header.cwd === "string") {
1220
+ return JSON.stringify({ ...header, cwd: process.cwd() });
1221
+ }
1222
+ } catch {}
1223
+ return line;
1224
+ }).join(`
1225
+ `);
1226
+ writeFileSync2(localSessionPath, content);
1227
+ sessionFileArg = ["--session", localSessionPath];
1228
+ }
1229
+ } catch {}
1207
1230
  const restoreEnv = setTemporaryEnv(buildOperatorPiEnv({
1208
1231
  runId: input.runId,
1209
1232
  serverUrl: server.baseUrl,
@@ -1220,7 +1243,8 @@ async function attachRunBundledPiFrontend(context, input) {
1220
1243
  "--no-extensions",
1221
1244
  "--no-skills",
1222
1245
  "--no-prompt-templates",
1223
- "--no-context-files"
1246
+ "--no-context-files",
1247
+ ...sessionFileArg
1224
1248
  ], {
1225
1249
  extensionFactories: [piRigExtensionFactory]
1226
1250
  });
@@ -1291,7 +1315,7 @@ async function attachRunOperatorView(context, input) {
1291
1315
  await withSpinner("Queueing steering message\u2026", () => sendRunPiPromptViaServer(context, input.runId, attachMessage, "steer").catch(() => steerRunViaServer(context, input.runId, attachMessage)), { outputMode: context.outputMode });
1292
1316
  steered = true;
1293
1317
  }
1294
- if (input.follow && !input.once && input.interactive !== false && context.outputMode === "text" && Boolean(process.stdin.isTTY && process.stdout.isTTY)) {
1318
+ if (!input.once && input.interactive !== false && context.outputMode === "text" && Boolean(process.stdin.isTTY && process.stdout.isTTY)) {
1295
1319
  return attachRunBundledPiFrontend(context, {
1296
1320
  runId: input.runId,
1297
1321
  steered
@@ -7667,7 +7667,7 @@ async function promptForTaskSelection(question) {
7667
7667
  }
7668
7668
 
7669
7669
  // packages/cli/src/commands/_pi-frontend.ts
7670
- import { mkdtempSync, rmSync as rmSync5 } from "fs";
7670
+ import { mkdtempSync, rmSync as rmSync5, writeFileSync as writeFileSync6 } from "fs";
7671
7671
  import { tmpdir } from "os";
7672
7672
  import { join as join3 } from "path";
7673
7673
  import { main as runPiMain } from "@earendil-works/pi-coding-agent";
@@ -7701,6 +7701,29 @@ function buildOperatorPiEnv(input) {
7701
7701
  async function attachRunBundledPiFrontend(context, input) {
7702
7702
  const tempSessionDir = mkdtempSync(join3(tmpdir(), "rig-pi-frontend-sessions-"));
7703
7703
  const server = await ensureServerForCli(context.projectRoot);
7704
+ let sessionFileArg = [];
7705
+ try {
7706
+ const payload = await requestServerJson(context, `/api/runs/${encodeURIComponent(input.runId)}/session-file`);
7707
+ if (payload?.ok && typeof payload.content === "string" && payload.content.trim()) {
7708
+ const fileName = typeof payload.fileName === "string" && payload.fileName.trim() ? payload.fileName.replace(/[^A-Za-z0-9._-]/g, "_") : `rig-run-${input.runId}.jsonl`;
7709
+ const localSessionPath = join3(tempSessionDir, fileName);
7710
+ const content = payload.content.split(`
7711
+ `).map((line, index) => {
7712
+ if (index > 0 || !line.trim())
7713
+ return line;
7714
+ try {
7715
+ const header = JSON.parse(line);
7716
+ if (header.type === "session" && typeof header.cwd === "string") {
7717
+ return JSON.stringify({ ...header, cwd: process.cwd() });
7718
+ }
7719
+ } catch {}
7720
+ return line;
7721
+ }).join(`
7722
+ `);
7723
+ writeFileSync6(localSessionPath, content);
7724
+ sessionFileArg = ["--session", localSessionPath];
7725
+ }
7726
+ } catch {}
7704
7727
  const restoreEnv = setTemporaryEnv(buildOperatorPiEnv({
7705
7728
  runId: input.runId,
7706
7729
  serverUrl: server.baseUrl,
@@ -7717,7 +7740,8 @@ async function attachRunBundledPiFrontend(context, input) {
7717
7740
  "--no-extensions",
7718
7741
  "--no-skills",
7719
7742
  "--no-prompt-templates",
7720
- "--no-context-files"
7743
+ "--no-context-files",
7744
+ ...sessionFileArg
7721
7745
  ], {
7722
7746
  extensionFactories: [piRigExtensionFactory]
7723
7747
  });
@@ -7788,7 +7812,7 @@ async function attachRunOperatorView(context, input) {
7788
7812
  await withSpinner("Queueing steering message\u2026", () => sendRunPiPromptViaServer(context, input.runId, attachMessage, "steer").catch(() => steerRunViaServer(context, input.runId, attachMessage)), { outputMode: context.outputMode });
7789
7813
  steered = true;
7790
7814
  }
7791
- if (input.follow && !input.once && input.interactive !== false && context.outputMode === "text" && Boolean(process.stdin.isTTY && process.stdout.isTTY)) {
7815
+ if (!input.once && input.interactive !== false && context.outputMode === "text" && Boolean(process.stdin.isTTY && process.stdout.isTTY)) {
7792
7816
  return attachRunBundledPiFrontend(context, {
7793
7817
  runId: input.runId,
7794
7818
  steered
@@ -9650,7 +9674,7 @@ async function executeTask(context, args, options) {
9650
9674
 
9651
9675
  // packages/cli/src/commands/task-run-driver.ts
9652
9676
  init_runner();
9653
- import { copyFileSync as copyFileSync3, existsSync as existsSync14, mkdirSync as mkdirSync8, readFileSync as readFileSync11, statSync as statSync2, writeFileSync as writeFileSync6 } from "fs";
9677
+ import { copyFileSync as copyFileSync3, existsSync as existsSync14, mkdirSync as mkdirSync8, readFileSync as readFileSync11, statSync as statSync2, writeFileSync as writeFileSync7 } from "fs";
9654
9678
  import { resolve as resolve22 } from "path";
9655
9679
  import { spawn as spawn2, spawnSync as spawnSync4 } from "child_process";
9656
9680
  import { createInterface as createLineInterface } from "readline";
@@ -10633,7 +10657,7 @@ async function executeRigOwnedTaskRun(context, input) {
10633
10657
  classifiedAt: new Date().toISOString()
10634
10658
  };
10635
10659
  mkdirSync8(resolve22(context.projectRoot, ".rig", "runs", input.runId), { recursive: true });
10636
- writeFileSync6(resolve22(context.projectRoot, ".rig", "runs", input.runId, "planning-classification.json"), `${JSON.stringify(persistedPlanning, null, 2)}
10660
+ writeFileSync7(resolve22(context.projectRoot, ".rig", "runs", input.runId, "planning-classification.json"), `${JSON.stringify(persistedPlanning, null, 2)}
10637
10661
  `, "utf8");
10638
10662
  patchAuthorityRun(context.projectRoot, input.runId, { planning: persistedPlanning });
10639
10663
  prompt = `${prompt}
@@ -10781,7 +10805,7 @@ ${planningClassification.planningRequired ? `Before implementing, write a concis
10781
10805
  const readyFile = childEnv.RIG_DIRTY_BASELINE_READY_FILE;
10782
10806
  if (readyFile) {
10783
10807
  mkdirSync8(resolve22(readyFile, ".."), { recursive: true });
10784
- writeFileSync6(readyFile, `${JSON.stringify({ ...dirty, workspaceDir: latestRuntimeWorkspace, appliedAt: new Date().toISOString() }, null, 2)}
10808
+ writeFileSync7(readyFile, `${JSON.stringify({ ...dirty, workspaceDir: latestRuntimeWorkspace, appliedAt: new Date().toISOString() }, null, 2)}
10785
10809
  `, "utf8");
10786
10810
  }
10787
10811
  appendRunLog(context.projectRoot, input.runId, {
@@ -11691,7 +11715,7 @@ async function executeTest(context, args) {
11691
11715
 
11692
11716
  // packages/cli/src/commands/setup.ts
11693
11717
  init_runner();
11694
- import { existsSync as existsSync15, mkdirSync as mkdirSync9, readdirSync as readdirSync3, writeFileSync as writeFileSync7 } from "fs";
11718
+ import { existsSync as existsSync15, mkdirSync as mkdirSync9, readdirSync as readdirSync3, writeFileSync as writeFileSync8 } from "fs";
11695
11719
  import { resolve as resolve23 } from "path";
11696
11720
  import { createPluginHost } from "@rig/core";
11697
11721
  import {
@@ -11752,7 +11776,7 @@ function runSetupInit(projectRoot) {
11752
11776
  mkdirSync9(artifactsDir, { recursive: true });
11753
11777
  const failuresPath = resolve23(stateDir, "failed_approaches.md");
11754
11778
  if (!existsSync15(failuresPath)) {
11755
- writeFileSync7(failuresPath, `# Failed Approaches
11779
+ writeFileSync8(failuresPath, `# Failed Approaches
11756
11780
 
11757
11781
  `, "utf-8");
11758
11782
  }
package/dist/src/index.js CHANGED
@@ -7856,7 +7856,7 @@ async function promptForTaskSelection(question) {
7856
7856
  }
7857
7857
 
7858
7858
  // packages/cli/src/commands/_pi-frontend.ts
7859
- import { mkdtempSync, rmSync as rmSync5 } from "fs";
7859
+ import { mkdtempSync, rmSync as rmSync5, writeFileSync as writeFileSync6 } from "fs";
7860
7860
  import { tmpdir } from "os";
7861
7861
  import { join as join3 } from "path";
7862
7862
  import { main as runPiMain } from "@earendil-works/pi-coding-agent";
@@ -7890,6 +7890,29 @@ function buildOperatorPiEnv(input) {
7890
7890
  async function attachRunBundledPiFrontend(context, input) {
7891
7891
  const tempSessionDir = mkdtempSync(join3(tmpdir(), "rig-pi-frontend-sessions-"));
7892
7892
  const server = await ensureServerForCli(context.projectRoot);
7893
+ let sessionFileArg = [];
7894
+ try {
7895
+ const payload = await requestServerJson(context, `/api/runs/${encodeURIComponent(input.runId)}/session-file`);
7896
+ if (payload?.ok && typeof payload.content === "string" && payload.content.trim()) {
7897
+ const fileName = typeof payload.fileName === "string" && payload.fileName.trim() ? payload.fileName.replace(/[^A-Za-z0-9._-]/g, "_") : `rig-run-${input.runId}.jsonl`;
7898
+ const localSessionPath = join3(tempSessionDir, fileName);
7899
+ const content = payload.content.split(`
7900
+ `).map((line, index) => {
7901
+ if (index > 0 || !line.trim())
7902
+ return line;
7903
+ try {
7904
+ const header = JSON.parse(line);
7905
+ if (header.type === "session" && typeof header.cwd === "string") {
7906
+ return JSON.stringify({ ...header, cwd: process.cwd() });
7907
+ }
7908
+ } catch {}
7909
+ return line;
7910
+ }).join(`
7911
+ `);
7912
+ writeFileSync6(localSessionPath, content);
7913
+ sessionFileArg = ["--session", localSessionPath];
7914
+ }
7915
+ } catch {}
7893
7916
  const restoreEnv = setTemporaryEnv(buildOperatorPiEnv({
7894
7917
  runId: input.runId,
7895
7918
  serverUrl: server.baseUrl,
@@ -7906,7 +7929,8 @@ async function attachRunBundledPiFrontend(context, input) {
7906
7929
  "--no-extensions",
7907
7930
  "--no-skills",
7908
7931
  "--no-prompt-templates",
7909
- "--no-context-files"
7932
+ "--no-context-files",
7933
+ ...sessionFileArg
7910
7934
  ], {
7911
7935
  extensionFactories: [piRigExtensionFactory]
7912
7936
  });
@@ -7977,7 +8001,7 @@ async function attachRunOperatorView(context, input) {
7977
8001
  await withSpinner("Queueing steering message\u2026", () => sendRunPiPromptViaServer(context, input.runId, attachMessage, "steer").catch(() => steerRunViaServer(context, input.runId, attachMessage)), { outputMode: context.outputMode });
7978
8002
  steered = true;
7979
8003
  }
7980
- if (input.follow && !input.once && input.interactive !== false && context.outputMode === "text" && Boolean(process.stdin.isTTY && process.stdout.isTTY)) {
8004
+ if (!input.once && input.interactive !== false && context.outputMode === "text" && Boolean(process.stdin.isTTY && process.stdout.isTTY)) {
7981
8005
  return attachRunBundledPiFrontend(context, {
7982
8006
  runId: input.runId,
7983
8007
  steered
@@ -9839,7 +9863,7 @@ async function executeTask(context, args, options) {
9839
9863
 
9840
9864
  // packages/cli/src/commands/task-run-driver.ts
9841
9865
  init_runner();
9842
- import { copyFileSync as copyFileSync3, existsSync as existsSync15, mkdirSync as mkdirSync9, readFileSync as readFileSync11, statSync as statSync2, writeFileSync as writeFileSync6 } from "fs";
9866
+ import { copyFileSync as copyFileSync3, existsSync as existsSync15, mkdirSync as mkdirSync9, readFileSync as readFileSync11, statSync as statSync2, writeFileSync as writeFileSync7 } from "fs";
9843
9867
  import { resolve as resolve23 } from "path";
9844
9868
  import { spawn as spawn2, spawnSync as spawnSync4 } from "child_process";
9845
9869
  import { createInterface as createLineInterface } from "readline";
@@ -10822,7 +10846,7 @@ async function executeRigOwnedTaskRun(context, input) {
10822
10846
  classifiedAt: new Date().toISOString()
10823
10847
  };
10824
10848
  mkdirSync9(resolve23(context.projectRoot, ".rig", "runs", input.runId), { recursive: true });
10825
- writeFileSync6(resolve23(context.projectRoot, ".rig", "runs", input.runId, "planning-classification.json"), `${JSON.stringify(persistedPlanning, null, 2)}
10849
+ writeFileSync7(resolve23(context.projectRoot, ".rig", "runs", input.runId, "planning-classification.json"), `${JSON.stringify(persistedPlanning, null, 2)}
10826
10850
  `, "utf8");
10827
10851
  patchAuthorityRun(context.projectRoot, input.runId, { planning: persistedPlanning });
10828
10852
  prompt = `${prompt}
@@ -10970,7 +10994,7 @@ ${planningClassification.planningRequired ? `Before implementing, write a concis
10970
10994
  const readyFile = childEnv.RIG_DIRTY_BASELINE_READY_FILE;
10971
10995
  if (readyFile) {
10972
10996
  mkdirSync9(resolve23(readyFile, ".."), { recursive: true });
10973
- writeFileSync6(readyFile, `${JSON.stringify({ ...dirty, workspaceDir: latestRuntimeWorkspace, appliedAt: new Date().toISOString() }, null, 2)}
10997
+ writeFileSync7(readyFile, `${JSON.stringify({ ...dirty, workspaceDir: latestRuntimeWorkspace, appliedAt: new Date().toISOString() }, null, 2)}
10974
10998
  `, "utf8");
10975
10999
  }
10976
11000
  appendRunLog(context.projectRoot, input.runId, {
@@ -11880,7 +11904,7 @@ async function executeTest(context, args) {
11880
11904
 
11881
11905
  // packages/cli/src/commands/setup.ts
11882
11906
  init_runner();
11883
- import { existsSync as existsSync16, mkdirSync as mkdirSync10, readdirSync as readdirSync3, writeFileSync as writeFileSync7 } from "fs";
11907
+ import { existsSync as existsSync16, mkdirSync as mkdirSync10, readdirSync as readdirSync3, writeFileSync as writeFileSync8 } from "fs";
11884
11908
  import { resolve as resolve24 } from "path";
11885
11909
  import { createPluginHost } from "@rig/core";
11886
11910
  import {
@@ -11941,7 +11965,7 @@ function runSetupInit(projectRoot) {
11941
11965
  mkdirSync10(artifactsDir, { recursive: true });
11942
11966
  const failuresPath = resolve24(stateDir, "failed_approaches.md");
11943
11967
  if (!existsSync16(failuresPath)) {
11944
- writeFileSync7(failuresPath, `# Failed Approaches
11968
+ writeFileSync8(failuresPath, `# Failed Approaches
11945
11969
 
11946
11970
  `, "utf-8");
11947
11971
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h-rig/cli",
3
- "version": "0.0.6-alpha.71",
3
+ "version": "0.0.6-alpha.73",
4
4
  "type": "module",
5
5
  "description": "Rig package",
6
6
  "license": "UNLICENSED",
@@ -24,13 +24,13 @@
24
24
  "dependencies": {
25
25
  "@clack/prompts": "^1.2.0",
26
26
  "@earendil-works/pi-coding-agent": "0.79.0",
27
- "@rig/client": "npm:@h-rig/client@0.0.6-alpha.71",
28
- "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.71",
29
- "@rig/core": "npm:@h-rig/core@0.0.6-alpha.71",
30
- "@rig/pi-rig": "npm:@h-rig/pi-rig@0.0.6-alpha.71",
31
- "@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.71",
32
- "@rig/server": "npm:@h-rig/server@0.0.6-alpha.71",
33
- "@rig/standard-plugin": "npm:@h-rig/standard-plugin@0.0.6-alpha.71",
27
+ "@rig/client": "npm:@h-rig/client@0.0.6-alpha.73",
28
+ "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.73",
29
+ "@rig/core": "npm:@h-rig/core@0.0.6-alpha.73",
30
+ "@rig/pi-rig": "npm:@h-rig/pi-rig@0.0.6-alpha.73",
31
+ "@rig/runtime": "npm:@h-rig/runtime@0.0.6-alpha.73",
32
+ "@rig/server": "npm:@h-rig/server@0.0.6-alpha.73",
33
+ "@rig/standard-plugin": "npm:@h-rig/standard-plugin@0.0.6-alpha.73",
34
34
  "effect": "4.0.0-beta.78",
35
35
  "picocolors": "^1.1.1"
36
36
  }