@h-rig/runtime 0.0.6-alpha.27 → 0.0.6-alpha.29

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 (39) hide show
  1. package/dist/bin/rig-agent-dispatch.js +552 -483
  2. package/dist/bin/rig-agent.js +418 -364
  3. package/dist/src/control-plane/agent-wrapper.js +557 -488
  4. package/dist/src/control-plane/harness-main.js +559 -1418
  5. package/dist/src/control-plane/hooks/completion-verification.js +451 -808
  6. package/dist/src/control-plane/hooks/inject-context.js +191 -137
  7. package/dist/src/control-plane/hooks/submodule-branch.js +596 -542
  8. package/dist/src/control-plane/hooks/task-runtime-start.js +596 -542
  9. package/dist/src/control-plane/materialize-task-config.js +64 -8
  10. package/dist/src/control-plane/native/git-ops.js +3 -0
  11. package/dist/src/control-plane/native/harness-cli.js +544 -496
  12. package/dist/src/control-plane/native/repo-ops.js +3 -0
  13. package/dist/src/control-plane/native/run-ops.js +3 -0
  14. package/dist/src/control-plane/native/task-ops.js +418 -370
  15. package/dist/src/control-plane/native/validator.js +161 -107
  16. package/dist/src/control-plane/native/verifier.js +217 -169
  17. package/dist/src/control-plane/pi-sessiond/launcher.js +12 -2
  18. package/dist/src/control-plane/plugin-host-context.js +54 -0
  19. package/dist/src/control-plane/runtime/image/fingerprint-sidecar.js +3 -0
  20. package/dist/src/control-plane/runtime/image/index.js +3 -0
  21. package/dist/src/control-plane/runtime/image-fingerprint-sidecar.js +3 -0
  22. package/dist/src/control-plane/runtime/image.js +3 -0
  23. package/dist/src/control-plane/runtime/index.js +487 -718
  24. package/dist/src/control-plane/runtime/isolation/index.js +511 -457
  25. package/dist/src/control-plane/runtime/isolation.js +511 -457
  26. package/dist/src/control-plane/runtime/plugin-mode.js +3 -27
  27. package/dist/src/control-plane/runtime/queue.js +428 -381
  28. package/dist/src/control-plane/runtime/snapshot/task-run.js +3 -0
  29. package/dist/src/control-plane/runtime/task-run-snapshot.js +3 -0
  30. package/dist/src/control-plane/skill-materializer.js +46 -0
  31. package/dist/src/control-plane/tasks/source-lifecycle.js +84 -30
  32. package/dist/src/index.js +0 -278
  33. package/native/darwin-arm64/rig-shell +0 -0
  34. package/native/darwin-arm64/rig-shell.build-manifest.json +1 -1
  35. package/native/darwin-arm64/rig-tools +0 -0
  36. package/native/darwin-arm64/rig-tools.build-manifest.json +1 -1
  37. package/package.json +8 -7
  38. package/dist/src/control-plane/runtime/plugins.js +0 -1131
  39. package/dist/src/plugins.js +0 -329
@@ -85,7 +85,12 @@ async function ensureRigPiSessionDaemon(input) {
85
85
  return handle;
86
86
  await sleep(100);
87
87
  }
88
- throw new Error(`Rig Pi session daemon did not become ready at ${readyFile}`);
88
+ throw new Error([
89
+ `Rig Pi session daemon did not become ready at ${readyFile}.`,
90
+ "Usual causes: the bundled Pi runtime is missing or broken. Run `rig doctor` to check Pi wiring,",
91
+ "set RIG_PI_BINARY to a working Pi build, or run without Pi via RIG_RUNTIME_ADAPTER=claude-code."
92
+ ].join(`
93
+ `));
89
94
  }
90
95
  function privateMetadataForDaemon(input) {
91
96
  return { public: input.publicMetadata, daemonConnection: input.connection };
@@ -133,7 +138,12 @@ function resolveRigPiSessionDaemonBinPath(env) {
133
138
  const moduleCandidate = fileURLToPath(new URL("./bin.ts", import.meta.url));
134
139
  if (existsSync(moduleCandidate))
135
140
  return moduleCandidate;
136
- throw new Error("Unable to locate rig-pi-sessiond entrypoint. Set RIG_PI_SESSIOND_BIN or RIG_CONTROL_PLANE_SOURCE_ROOT to the Rig source checkout.");
141
+ throw new Error([
142
+ "Unable to locate rig-pi-sessiond entrypoint.",
143
+ "Set RIG_PI_SESSIOND_BIN or RIG_CONTROL_PLANE_SOURCE_ROOT to the Rig source checkout,",
144
+ "or run without the Pi daemon via RIG_RUNTIME_ADAPTER=claude-code."
145
+ ].join(`
146
+ `));
137
147
  }
138
148
  function readDaemonReadyFile(path) {
139
149
  if (!existsSync(path))
@@ -283,6 +283,49 @@ function safeReadJson(path) {
283
283
  }
284
284
  }
285
285
 
286
+ // packages/runtime/src/control-plane/skill-materializer.ts
287
+ import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync2, readdirSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
288
+ import { resolve as resolve2 } from "path";
289
+ import { loadSkill } from "@rig/skill-loader";
290
+ var MARKER_FILENAME = ".rig-plugin";
291
+ function skillDirName(id) {
292
+ return id.replace(/[^a-zA-Z0-9._-]+/g, "-");
293
+ }
294
+ async function materializeSkills(projectRoot, entries) {
295
+ const skillsRoot = resolve2(projectRoot, ".pi", "skills");
296
+ if (existsSync3(skillsRoot)) {
297
+ for (const name of readdirSync(skillsRoot)) {
298
+ const dir = resolve2(skillsRoot, name);
299
+ if (existsSync3(resolve2(dir, MARKER_FILENAME))) {
300
+ rmSync(dir, { recursive: true, force: true });
301
+ }
302
+ }
303
+ }
304
+ const written = [];
305
+ for (const { pluginName, skill } of entries) {
306
+ const sourcePath = resolve2(projectRoot, skill.path);
307
+ if (!existsSync3(sourcePath)) {
308
+ console.warn(`[plugin-host] skill "${skill.id}" from plugin "${pluginName}" not materialized: ${sourcePath} does not exist`);
309
+ continue;
310
+ }
311
+ let body;
312
+ try {
313
+ await loadSkill(sourcePath);
314
+ body = readFileSync2(sourcePath, "utf-8");
315
+ } catch (err) {
316
+ console.warn(`[plugin-host] skill "${skill.id}" from plugin "${pluginName}" not materialized: ${err instanceof Error ? err.message : err}`);
317
+ continue;
318
+ }
319
+ const dir = resolve2(skillsRoot, skillDirName(skill.id));
320
+ mkdirSync2(dir, { recursive: true });
321
+ writeFileSync2(resolve2(dir, "SKILL.md"), body, "utf-8");
322
+ writeFileSync2(resolve2(dir, MARKER_FILENAME), `${JSON.stringify({ plugin: pluginName, skillId: skill.id }, null, 2)}
323
+ `, "utf-8");
324
+ written.push({ id: skill.id, pluginName, directory: dir });
325
+ }
326
+ return written;
327
+ }
328
+
286
329
  // packages/runtime/src/control-plane/plugin-host-context.ts
287
330
  async function buildPluginHostContext(projectRoot) {
288
331
  let config;
@@ -319,6 +362,17 @@ async function buildPluginHostContext(projectRoot) {
319
362
  } catch (err) {
320
363
  console.warn(`[plugin-host] hook materialization failed: ${err instanceof Error ? err.message : err}`);
321
364
  }
365
+ try {
366
+ const skillEntries = config.plugins.flatMap((plugin) => (plugin.contributes?.skills ?? []).map((skill) => ({
367
+ pluginName: plugin.name,
368
+ skill
369
+ })));
370
+ if (skillEntries.length > 0) {
371
+ await materializeSkills(projectRoot, skillEntries);
372
+ }
373
+ } catch (err) {
374
+ console.warn(`[plugin-host] skill materialization failed: ${err instanceof Error ? err.message : err}`);
375
+ }
322
376
  return {
323
377
  config,
324
378
  pluginHost,
@@ -333,6 +333,9 @@ import { loadConfig } from "@rig/core/load-config";
333
333
  // packages/runtime/src/control-plane/repos/registry.ts
334
334
  var MANAGED_REPOS = new Map;
335
335
 
336
+ // packages/runtime/src/control-plane/skill-materializer.ts
337
+ import { loadSkill } from "@rig/skill-loader";
338
+
336
339
  // packages/runtime/src/control-plane/tasks/source-aware-task-config-source.ts
337
340
  var STATUS_LABELS = new Set(["ready", "blocked", "in-progress", "under-review", "failed", "cancelled"]);
338
341
 
@@ -454,6 +454,9 @@ import { loadConfig } from "@rig/core/load-config";
454
454
  // packages/runtime/src/control-plane/repos/registry.ts
455
455
  var MANAGED_REPOS = new Map;
456
456
 
457
+ // packages/runtime/src/control-plane/skill-materializer.ts
458
+ import { loadSkill } from "@rig/skill-loader";
459
+
457
460
  // packages/runtime/src/control-plane/tasks/source-aware-task-config-source.ts
458
461
  var STATUS_LABELS = new Set(["ready", "blocked", "in-progress", "under-review", "failed", "cancelled"]);
459
462
 
@@ -332,6 +332,9 @@ import { loadConfig } from "@rig/core/load-config";
332
332
  // packages/runtime/src/control-plane/repos/registry.ts
333
333
  var MANAGED_REPOS = new Map;
334
334
 
335
+ // packages/runtime/src/control-plane/skill-materializer.ts
336
+ import { loadSkill } from "@rig/skill-loader";
337
+
335
338
  // packages/runtime/src/control-plane/tasks/source-aware-task-config-source.ts
336
339
  var STATUS_LABELS = new Set(["ready", "blocked", "in-progress", "under-review", "failed", "cancelled"]);
337
340
 
@@ -454,6 +454,9 @@ import { loadConfig } from "@rig/core/load-config";
454
454
  // packages/runtime/src/control-plane/repos/registry.ts
455
455
  var MANAGED_REPOS = new Map;
456
456
 
457
+ // packages/runtime/src/control-plane/skill-materializer.ts
458
+ import { loadSkill } from "@rig/skill-loader";
459
+
457
460
  // packages/runtime/src/control-plane/tasks/source-aware-task-config-source.ts
458
461
  var STATUS_LABELS = new Set(["ready", "blocked", "in-progress", "under-review", "failed", "cancelled"]);
459
462