@h-rig/runtime 0.0.6-alpha.32 → 0.0.6-alpha.33

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.
@@ -245,16 +245,22 @@ function readBuildConfig() {
245
245
  }
246
246
  }
247
247
 
248
- // packages/runtime/src/control-plane/runtime/tooling/shell.ts
248
+ // packages/runtime/src/control-plane/native/git-native.ts
249
249
  import { tmpdir } from "os";
250
- import { basename, dirname as dirname2, resolve as resolve2 } from "path";
251
- var sharedNativeShellOutputDir = resolve2(tmpdir(), "rig-native");
252
- var sharedNativeShellOutputPath = resolve2(sharedNativeShellOutputDir, `rig-shell-${process.platform}-${process.arch}${process.platform === "win32" ? ".exe" : ""}`);
253
- // packages/runtime/src/control-plane/runtime/tooling/file-tools.ts
250
+ import { dirname as dirname2, isAbsolute, resolve as resolve2 } from "path";
251
+ var sharedGitNativeOutputDir = resolve2(tmpdir(), "rig-native");
252
+ var sharedGitNativeOutputPath = resolve2(sharedGitNativeOutputDir, `rig-git-${process.platform}-${process.arch}${process.platform === "win32" ? ".exe" : ""}`);
253
+
254
+ // packages/runtime/src/control-plane/runtime/tooling/shell.ts
254
255
  import { tmpdir as tmpdir2 } from "os";
255
- import { basename as basename2, dirname as dirname3, resolve as resolve3 } from "path";
256
- var sharedNativeToolsOutputDir = resolve3(tmpdir2(), "rig-native");
257
- var sharedNativeToolsOutputPath = resolve3(sharedNativeToolsOutputDir, `rig-tools-${process.platform}-${process.arch}${process.platform === "win32" ? ".exe" : ""}`);
256
+ import { basename, dirname as dirname3, resolve as resolve3 } from "path";
257
+ var sharedNativeShellOutputDir = resolve3(tmpdir2(), "rig-native");
258
+ var sharedNativeShellOutputPath = resolve3(sharedNativeShellOutputDir, `rig-shell-${process.platform}-${process.arch}${process.platform === "win32" ? ".exe" : ""}`);
259
+ // packages/runtime/src/control-plane/runtime/tooling/file-tools.ts
260
+ import { tmpdir as tmpdir3 } from "os";
261
+ import { basename as basename2, dirname as dirname4, resolve as resolve4 } from "path";
262
+ var sharedNativeToolsOutputDir = resolve4(tmpdir3(), "rig-native");
263
+ var sharedNativeToolsOutputPath = resolve4(sharedNativeToolsOutputDir, `rig-tools-${process.platform}-${process.arch}${process.platform === "win32" ? ".exe" : ""}`);
258
264
  // packages/runtime/src/control-plane/plugin-host-context.ts
259
265
  import { createPluginHost } from "@rig/core";
260
266
  import { loadConfig } from "@rig/core/load-config";
@@ -469,7 +475,7 @@ function setScopeRules(rules) {
469
475
 
470
476
  // packages/runtime/src/control-plane/hook-materializer.ts
471
477
  import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
472
- import { dirname as dirname4, resolve as resolve4 } from "path";
478
+ import { dirname as dirname5, resolve as resolve5 } from "path";
473
479
  var MARKER_PLUGIN = "_rigPlugin";
474
480
  var MARKER_HOOK_ID = "_rigHookId";
475
481
  function matcherToString(matcher) {
@@ -483,7 +489,7 @@ function isPluginOwned(cmd) {
483
489
  return typeof cmd[MARKER_PLUGIN] === "string";
484
490
  }
485
491
  function materializeHooks(projectRoot, entries) {
486
- const settingsPath = resolve4(projectRoot, ".claude", "settings.json");
492
+ const settingsPath = resolve5(projectRoot, ".claude", "settings.json");
487
493
  const existing = existsSync3(settingsPath) ? safeReadJson(settingsPath) : {};
488
494
  const hooks = existing.hooks ?? {};
489
495
  for (const event of Object.keys(hooks)) {
@@ -526,7 +532,7 @@ function materializeHooks(projectRoot, entries) {
526
532
  } else {
527
533
  delete next.hooks;
528
534
  }
529
- mkdirSync2(dirname4(settingsPath), { recursive: true });
535
+ mkdirSync2(dirname5(settingsPath), { recursive: true });
530
536
  writeFileSync2(settingsPath, `${JSON.stringify(next, null, 2)}
531
537
  `, "utf-8");
532
538
  return settingsPath;
@@ -541,25 +547,25 @@ function safeReadJson(path) {
541
547
 
542
548
  // packages/runtime/src/control-plane/skill-materializer.ts
543
549
  import { existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync3, readdirSync, rmSync, writeFileSync as writeFileSync3 } from "fs";
544
- import { resolve as resolve5 } from "path";
550
+ import { resolve as resolve6 } from "path";
545
551
  import { loadSkill } from "@rig/skill-loader";
546
552
  var MARKER_FILENAME = ".rig-plugin";
547
553
  function skillDirName(id) {
548
554
  return id.replace(/[^a-zA-Z0-9._-]+/g, "-");
549
555
  }
550
556
  async function materializeSkills(projectRoot, entries) {
551
- const skillsRoot = resolve5(projectRoot, ".pi", "skills");
557
+ const skillsRoot = resolve6(projectRoot, ".pi", "skills");
552
558
  if (existsSync4(skillsRoot)) {
553
559
  for (const name of readdirSync(skillsRoot)) {
554
- const dir = resolve5(skillsRoot, name);
555
- if (existsSync4(resolve5(dir, MARKER_FILENAME))) {
560
+ const dir = resolve6(skillsRoot, name);
561
+ if (existsSync4(resolve6(dir, MARKER_FILENAME))) {
556
562
  rmSync(dir, { recursive: true, force: true });
557
563
  }
558
564
  }
559
565
  }
560
566
  const written = [];
561
567
  for (const { pluginName, skill } of entries) {
562
- const sourcePath = resolve5(projectRoot, skill.path);
568
+ const sourcePath = resolve6(projectRoot, skill.path);
563
569
  if (!existsSync4(sourcePath)) {
564
570
  console.warn(`[plugin-host] skill "${skill.id}" from plugin "${pluginName}" not materialized: ${sourcePath} does not exist`);
565
571
  continue;
@@ -572,10 +578,10 @@ async function materializeSkills(projectRoot, entries) {
572
578
  console.warn(`[plugin-host] skill "${skill.id}" from plugin "${pluginName}" not materialized: ${err instanceof Error ? err.message : err}`);
573
579
  continue;
574
580
  }
575
- const dir = resolve5(skillsRoot, skillDirName(skill.id));
581
+ const dir = resolve6(skillsRoot, skillDirName(skill.id));
576
582
  mkdirSync3(dir, { recursive: true });
577
- writeFileSync3(resolve5(dir, "SKILL.md"), body, "utf-8");
578
- writeFileSync3(resolve5(dir, MARKER_FILENAME), `${JSON.stringify({ plugin: pluginName, skillId: skill.id }, null, 2)}
583
+ writeFileSync3(resolve6(dir, "SKILL.md"), body, "utf-8");
584
+ writeFileSync3(resolve6(dir, MARKER_FILENAME), `${JSON.stringify({ plugin: pluginName, skillId: skill.id }, null, 2)}
579
585
  `, "utf-8");
580
586
  written.push({ id: skill.id, pluginName, directory: dir });
581
587
  }
@@ -643,11 +649,11 @@ async function buildPluginHostContext(projectRoot) {
643
649
  // packages/runtime/src/control-plane/tasks/source-aware-task-config-source.ts
644
650
  import { spawnSync } from "child_process";
645
651
  import { existsSync as existsSync6, readFileSync as readFileSync5, readdirSync as readdirSync2, statSync, writeFileSync as writeFileSync4 } from "fs";
646
- import { basename as basename3, join as join2, resolve as resolve7 } from "path";
652
+ import { basename as basename3, join as join2, resolve as resolve8 } from "path";
647
653
 
648
654
  // packages/runtime/src/control-plane/tasks/legacy-task-config-source.ts
649
655
  import { existsSync as existsSync5, readFileSync as readFileSync4 } from "fs";
650
- import { resolve as resolve6 } from "path";
656
+ import { resolve as resolve7 } from "path";
651
657
 
652
658
  // packages/runtime/src/control-plane/tasks/task-record-reader.ts
653
659
  async function findTaskById(reader, id) {
@@ -670,7 +676,7 @@ class LegacyTaskConfigReadError extends Error {
670
676
  }
671
677
  }
672
678
  function createLegacyTaskConfigRecordReader(projectRoot, options = {}) {
673
- const configPath = options.configPath ?? resolve6(projectRoot, ".rig", "task-config.json");
679
+ const configPath = options.configPath ?? resolve7(projectRoot, ".rig", "task-config.json");
674
680
  const reader = {
675
681
  async listTasks() {
676
682
  return readLegacyTaskRecords(projectRoot, configPath);
@@ -681,7 +687,7 @@ function createLegacyTaskConfigRecordReader(projectRoot, options = {}) {
681
687
  };
682
688
  return reader;
683
689
  }
684
- function readLegacyTaskRecords(projectRoot, configPath = resolve6(projectRoot, ".rig", "task-config.json")) {
690
+ function readLegacyTaskRecords(projectRoot, configPath = resolve7(projectRoot, ".rig", "task-config.json")) {
685
691
  if (!existsSync5(configPath)) {
686
692
  return [];
687
693
  }
@@ -774,7 +780,7 @@ function isPlainRecord(candidate) {
774
780
  var STATUS_LABELS = new Set(["ready", "blocked", "in-progress", "under-review", "failed", "cancelled"]);
775
781
  var FILE_TASK_PATTERN = /\.(task\.)?json$/;
776
782
  function createSourceAwareTaskConfigRecordReader(projectRoot, options = {}) {
777
- const configPath = options.configPath ?? resolve7(projectRoot, ".rig", "task-config.json");
783
+ const configPath = options.configPath ?? resolve8(projectRoot, ".rig", "task-config.json");
778
784
  const legacy = createLegacyTaskConfigRecordReader(projectRoot, { configPath });
779
785
  const spawnFn = options.spawn ?? spawnSync;
780
786
  const ghBinary = options.ghBinary ?? "gh";
@@ -857,7 +863,7 @@ function readMaterializedTaskMetadata(entry) {
857
863
  return metadata;
858
864
  }
859
865
  function readConfiguredFilesTaskSourcePath(projectRoot) {
860
- const jsonPath = resolve7(projectRoot, "rig.config.json");
866
+ const jsonPath = resolve8(projectRoot, "rig.config.json");
861
867
  if (existsSync6(jsonPath)) {
862
868
  try {
863
869
  const parsed = JSON.parse(readFileSync5(jsonPath, "utf8"));
@@ -869,7 +875,7 @@ function readConfiguredFilesTaskSourcePath(projectRoot) {
869
875
  return null;
870
876
  }
871
877
  }
872
- const tsPath = resolve7(projectRoot, "rig.config.ts");
878
+ const tsPath = resolve8(projectRoot, "rig.config.ts");
873
879
  if (!existsSync6(tsPath)) {
874
880
  return null;
875
881
  }
@@ -905,7 +911,7 @@ function stripLegacyTaskConfigMetadata2(raw) {
905
911
  return tasks;
906
912
  }
907
913
  function listFileBackedTasks(projectRoot, sourcePath) {
908
- const directory = resolve7(projectRoot, sourcePath);
914
+ const directory = resolve8(projectRoot, sourcePath);
909
915
  if (!existsSync6(directory)) {
910
916
  return [];
911
917
  }
@@ -921,7 +927,7 @@ function listFileBackedTasks(projectRoot, sourcePath) {
921
927
  return tasks;
922
928
  }
923
929
  function readFileBackedTask(projectRoot, sourcePath, taskId, rawEntry) {
924
- const file = findFileBackedTaskFile(resolve7(projectRoot, sourcePath), taskId);
930
+ const file = findFileBackedTaskFile(resolve8(projectRoot, sourcePath), taskId);
925
931
  if (!file) {
926
932
  return null;
927
933
  }
@@ -1123,12 +1129,6 @@ var CANONICAL_TASK_LIFECYCLE_STATUSES = new Set([
1123
1129
  "completed",
1124
1130
  "cancelled"
1125
1131
  ]);
1126
- // packages/runtime/src/control-plane/native/git-native.ts
1127
- import { tmpdir as tmpdir3 } from "os";
1128
- import { dirname as dirname5, isAbsolute, resolve as resolve8 } from "path";
1129
- var sharedGitNativeOutputDir = resolve8(tmpdir3(), "rig-native");
1130
- var sharedGitNativeOutputPath = resolve8(sharedGitNativeOutputDir, `rig-git-${process.platform}-${process.arch}${process.platform === "win32" ? ".exe" : ""}`);
1131
-
1132
1132
  // packages/runtime/src/control-plane/native/utils.ts
1133
1133
  import { existsSync as existsSync9, readFileSync as readFileSync6 } from "fs";
1134
1134
  import { resolve as resolve11 } from "path";
@@ -549,8 +549,9 @@ class RigPiSessionService {
549
549
  }
550
550
  publishHeartbeats() {
551
551
  for (const active of this.activeBySession.values()) {
552
- if (active.runtime.session.isStreaming || active.runtime.session.isCompacting || active.runtime.session.isBashRunning || active.runtime.session.pendingMessageCount > 0) {
553
- this.publishStatus(active);
552
+ const busy = active.runtime.session.isStreaming || active.runtime.session.isCompacting || active.runtime.session.isBashRunning || active.runtime.session.pendingMessageCount > 0;
553
+ this.publishStatus(active);
554
+ if (busy) {
554
555
  this.publishActivity(active, active.activity?.label ?? "active", "active", active.activity?.detail);
555
556
  }
556
557
  }
@@ -77,12 +77,24 @@ async function ensureRigPiSessionDaemon(input) {
77
77
  stderr: "inherit"
78
78
  });
79
79
  proc.unref();
80
+ let exitCode = null;
81
+ proc.exited.then((code) => {
82
+ exitCode = code;
83
+ });
80
84
  const deadline = Date.now() + (input.timeoutMs ?? 15000);
81
85
  while (Date.now() < deadline) {
82
86
  const ready = readDaemonReadyFile(readyFile);
83
87
  const handle = ready ? await tryReady(ready) : null;
84
88
  if (handle)
85
89
  return handle;
90
+ if (exitCode !== null) {
91
+ throw new Error([
92
+ `Rig Pi session daemon exited with code ${exitCode} before becoming ready (${binPath}).`,
93
+ "Check the daemon stderr above. Run `rig doctor` to check Pi wiring,",
94
+ "set RIG_PI_BINARY to a working Pi build, or run without Pi via RIG_RUNTIME_ADAPTER=claude-code."
95
+ ].join(`
96
+ `));
97
+ }
86
98
  await sleep(100);
87
99
  }
88
100
  throw new Error([
@@ -547,8 +547,9 @@ class RigPiSessionService {
547
547
  }
548
548
  publishHeartbeats() {
549
549
  for (const active of this.activeBySession.values()) {
550
- if (active.runtime.session.isStreaming || active.runtime.session.isCompacting || active.runtime.session.isBashRunning || active.runtime.session.pendingMessageCount > 0) {
551
- this.publishStatus(active);
550
+ const busy = active.runtime.session.isStreaming || active.runtime.session.isCompacting || active.runtime.session.isBashRunning || active.runtime.session.pendingMessageCount > 0;
551
+ this.publishStatus(active);
552
+ if (busy) {
552
553
  this.publishActivity(active, active.activity?.label ?? "active", "active", active.activity?.detail);
553
554
  }
554
555
  }
@@ -486,8 +486,9 @@ class RigPiSessionService {
486
486
  }
487
487
  publishHeartbeats() {
488
488
  for (const active of this.activeBySession.values()) {
489
- if (active.runtime.session.isStreaming || active.runtime.session.isCompacting || active.runtime.session.isBashRunning || active.runtime.session.pendingMessageCount > 0) {
490
- this.publishStatus(active);
489
+ const busy = active.runtime.session.isStreaming || active.runtime.session.isCompacting || active.runtime.session.isBashRunning || active.runtime.session.pendingMessageCount > 0;
490
+ this.publishStatus(active);
491
+ if (busy) {
491
492
  this.publishActivity(active, active.activity?.label ?? "active", "active", active.activity?.detail);
492
493
  }
493
494
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h-rig/runtime",
3
- "version": "0.0.6-alpha.32",
3
+ "version": "0.0.6-alpha.33",
4
4
  "type": "module",
5
5
  "description": "Rig package",
6
6
  "license": "UNLICENSED",
@@ -63,14 +63,14 @@
63
63
  "main": "./dist/src/index.js",
64
64
  "module": "./dist/src/index.js",
65
65
  "dependencies": {
66
- "@earendil-works/pi-coding-agent": "npm:@h-rig/pi-coding-agent@0.0.6-alpha.32",
66
+ "@earendil-works/pi-coding-agent": "npm:@h-rig/pi-coding-agent@0.0.6-alpha.33",
67
67
  "@libsql/client": "^0.17.2",
68
- "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.32",
69
- "@rig/core": "npm:@h-rig/core@0.0.6-alpha.32",
70
- "@rig/hook-kit": "npm:@h-rig/hook-kit@0.0.6-alpha.32",
71
- "@rig/shared": "npm:@h-rig/shared@0.0.6-alpha.32",
72
- "@rig/skill-loader": "npm:@h-rig/skill-loader@0.0.6-alpha.32",
73
- "@rig/validator-kit": "npm:@h-rig/validator-kit@0.0.6-alpha.32",
68
+ "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.33",
69
+ "@rig/core": "npm:@h-rig/core@0.0.6-alpha.33",
70
+ "@rig/hook-kit": "npm:@h-rig/hook-kit@0.0.6-alpha.33",
71
+ "@rig/shared": "npm:@h-rig/shared@0.0.6-alpha.33",
72
+ "@rig/skill-loader": "npm:@h-rig/skill-loader@0.0.6-alpha.33",
73
+ "@rig/validator-kit": "npm:@h-rig/validator-kit@0.0.6-alpha.33",
74
74
  "effect": "4.0.0-beta.78",
75
75
  "smol-toml": "^1.6.0"
76
76
  }