@h-rig/runtime 0.0.6-alpha.3 → 0.0.6-alpha.30

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 (59) hide show
  1. package/dist/bin/rig-agent-dispatch.js +1165 -785
  2. package/dist/bin/rig-agent.js +458 -389
  3. package/dist/src/control-plane/agent-wrapper.js +1191 -504
  4. package/dist/src/control-plane/authority-files.js +12 -6
  5. package/dist/src/control-plane/harness-main.js +2186 -1786
  6. package/dist/src/control-plane/hooks/completion-verification.js +2084 -1019
  7. package/dist/src/control-plane/hooks/inject-context.js +193 -139
  8. package/dist/src/control-plane/hooks/submodule-branch.js +603 -545
  9. package/dist/src/control-plane/hooks/task-runtime-start.js +603 -545
  10. package/dist/src/control-plane/materialize-task-config.js +64 -8
  11. package/dist/src/control-plane/native/git-ops.js +90 -64
  12. package/dist/src/control-plane/native/harness-cli.js +1989 -682
  13. package/dist/src/control-plane/native/pr-automation.js +1657 -54
  14. package/dist/src/control-plane/native/pr-review-gate.js +1455 -0
  15. package/dist/src/control-plane/native/repo-ops.js +3 -0
  16. package/dist/src/control-plane/native/run-ops.js +39 -13
  17. package/dist/src/control-plane/native/task-ops.js +1819 -527
  18. package/dist/src/control-plane/native/validator.js +163 -109
  19. package/dist/src/control-plane/native/verifier.js +1616 -323
  20. package/dist/src/control-plane/native/workspace-ops.js +12 -6
  21. package/dist/src/control-plane/pi-sessiond/bin.js +793 -0
  22. package/dist/src/control-plane/pi-sessiond/client.js +41 -0
  23. package/dist/src/control-plane/pi-sessiond/event-hub.js +59 -0
  24. package/dist/src/control-plane/pi-sessiond/extension-ui-context.js +198 -0
  25. package/dist/src/control-plane/pi-sessiond/launcher.js +173 -0
  26. package/dist/src/control-plane/pi-sessiond/server.js +802 -0
  27. package/dist/src/control-plane/pi-sessiond/session-service.js +540 -0
  28. package/dist/src/control-plane/pi-sessiond/types.js +1 -0
  29. package/dist/src/control-plane/plugin-host-context.js +54 -0
  30. package/dist/src/control-plane/runtime/image/fingerprint-sidecar.js +3 -0
  31. package/dist/src/control-plane/runtime/image/index.js +3 -0
  32. package/dist/src/control-plane/runtime/image-fingerprint-sidecar.js +3 -0
  33. package/dist/src/control-plane/runtime/image.js +3 -0
  34. package/dist/src/control-plane/runtime/index.js +517 -722
  35. package/dist/src/control-plane/runtime/isolation/home.js +28 -6
  36. package/dist/src/control-plane/runtime/isolation/index.js +541 -461
  37. package/dist/src/control-plane/runtime/isolation/runner.js +28 -6
  38. package/dist/src/control-plane/runtime/isolation/shared.js +9 -6
  39. package/dist/src/control-plane/runtime/isolation.js +541 -461
  40. package/dist/src/control-plane/runtime/plugin-mode.js +3 -27
  41. package/dist/src/control-plane/runtime/queue.js +458 -385
  42. package/dist/src/control-plane/runtime/snapshot/task-run.js +3 -0
  43. package/dist/src/control-plane/runtime/task-run-snapshot.js +3 -0
  44. package/dist/src/control-plane/skill-materializer.js +46 -0
  45. package/dist/src/control-plane/tasks/source-aware-task-config-source.js +14 -2
  46. package/dist/src/control-plane/tasks/source-lifecycle.js +86 -32
  47. package/dist/src/index.js +27 -298
  48. package/dist/src/layout.js +12 -7
  49. package/dist/src/local-server.js +20 -14
  50. package/native/darwin-arm64/rig-git +0 -0
  51. package/native/darwin-arm64/rig-git.build-manifest.json +1 -1
  52. package/native/darwin-arm64/rig-shell +0 -0
  53. package/native/darwin-arm64/rig-shell.build-manifest.json +1 -1
  54. package/native/darwin-arm64/rig-tools +0 -0
  55. package/native/darwin-arm64/rig-tools.build-manifest.json +1 -1
  56. package/native/darwin-arm64/runtime-native.dylib +0 -0
  57. package/package.json +8 -6
  58. package/dist/src/control-plane/runtime/plugins.js +0 -1131
  59. package/dist/src/plugins.js +0 -329
package/dist/src/index.js CHANGED
@@ -12,22 +12,27 @@ var RIG_STATE_DIRNAME = ".rig";
12
12
  var RIG_ARTIFACTS_DIRNAME = "artifacts";
13
13
  function resolveNearestRigProjectRoot(startDir) {
14
14
  let current = resolve(startDir);
15
- let fallbackCandidate = null;
15
+ let weakMarkerCandidate = null;
16
16
  let projectCandidate = null;
17
17
  for (;; ) {
18
18
  const hasDefinition = existsSync(resolve(current, RIG_DEFINITION_DIRNAME));
19
19
  const hasState = existsSync(resolve(current, RIG_STATE_DIRNAME));
20
+ const hasTaskConfig = existsSync(resolve(current, RIG_STATE_DIRNAME, "task-config.json"));
20
21
  const hasConfig = existsSync(resolve(current, "rig.config.ts")) || existsSync(resolve(current, "rig.config.json"));
22
+ const hasGit = existsSync(resolve(current, ".git"));
21
23
  const hasControlPlane = existsSync(resolve(current, "packages", "cli", "bin", "rig.ts")) || existsSync(resolve(current, "packages", "server"));
22
- if (hasDefinition || hasState || hasConfig) {
23
- fallbackCandidate = current;
24
- if (hasControlPlane) {
25
- projectCandidate = current;
26
- }
24
+ if ((hasDefinition || hasState || hasConfig) && weakMarkerCandidate === null) {
25
+ weakMarkerCandidate = current;
26
+ }
27
+ if ((hasControlPlane || hasConfig || hasTaskConfig) && projectCandidate === null) {
28
+ projectCandidate = current;
29
+ }
30
+ if (hasGit) {
31
+ return projectCandidate ?? current;
27
32
  }
28
33
  const parent = resolve(current, "..");
29
34
  if (parent === current) {
30
- return projectCandidate ?? fallbackCandidate ?? resolve(startDir);
35
+ return projectCandidate ?? weakMarkerCandidate ?? resolve(startDir);
31
36
  }
32
37
  current = parent;
33
38
  }
@@ -619,6 +624,18 @@ async function waitForServerHealthy(baseUrl, authToken, timeoutMs) {
619
624
  }
620
625
  return false;
621
626
  }
627
+ function resolveRigServerSpawnPlan(projectRoot, host, authToken, which = (command) => Bun.which(command)) {
628
+ const binary = process.env.RIG_SERVER_BIN?.trim() || which("rig-server")?.trim();
629
+ const args = ["start", "--host", host, "--port", "0", "--auth-token", authToken];
630
+ if (binary) {
631
+ return { command: binary, args, cwd: projectRoot };
632
+ }
633
+ return {
634
+ command: "bun",
635
+ args: ["run", "packages/server/src/server.ts", ...args],
636
+ cwd: resolve5(import.meta.dir, "../../..")
637
+ };
638
+ }
622
639
  async function waitForPublishedServer(projectRoot, authToken, timeoutMs) {
623
640
  const deadline = Date.now() + timeoutMs;
624
641
  while (Date.now() < deadline) {
@@ -644,23 +661,13 @@ async function ensureLocalRigServerConnection(projectRoot, options = {}) {
644
661
  const host = options.host ?? "127.0.0.1";
645
662
  const startupTimeoutMs = options.startupTimeoutMs ?? 15000;
646
663
  const authToken = Buffer.from(crypto.getRandomValues(new Uint8Array(24))).toString("hex");
647
- const workspaceRoot = resolve5(import.meta.dir, "../../..");
648
664
  const bootstrapLogPath = resolveRigServerLogPath(projectRoot);
649
665
  mkdirSync2(resolveRigServerPaths(projectRoot).logsDir, { recursive: true });
650
666
  const bootstrapLogFd = openSync(bootstrapLogPath, "w");
651
667
  clearPublishedRigServerState(projectRoot);
652
- const child = spawn("bun", [
653
- "run",
654
- "packages/server/src/server.ts",
655
- "start",
656
- "--host",
657
- host,
658
- "--port",
659
- "0",
660
- "--auth-token",
661
- authToken
662
- ], {
663
- cwd: workspaceRoot,
668
+ const spawnPlan = resolveRigServerSpawnPlan(projectRoot, host, authToken);
669
+ const child = spawn(spawnPlan.command, [...spawnPlan.args], {
670
+ cwd: spawnPlan.cwd,
664
671
  env: {
665
672
  ...process.env,
666
673
  PROJECT_RIG_ROOT: projectRoot
@@ -1062,280 +1069,6 @@ async function spawnProcess(command, args, options) {
1062
1069
  });
1063
1070
  return { exitCode, stdout, stderr, timedOut };
1064
1071
  }
1065
- // packages/runtime/src/plugins.ts
1066
- import { existsSync as existsSync6, readdirSync } from "fs";
1067
- import { basename as basename3, resolve as resolve7 } from "path";
1068
-
1069
- // packages/runtime/src/control-plane/runtime/plugin-mode.ts
1070
- var LEGACY_PLUGIN_SCAN_ENV = "RIG_LEGACY_PLUGIN_SCAN";
1071
- function isLegacyPluginScanEnabled(env = process.env) {
1072
- const value = env[LEGACY_PLUGIN_SCAN_ENV]?.trim().toLowerCase();
1073
- return value === "1" || value === "true" || value === "yes" || value === "on";
1074
- }
1075
-
1076
- // packages/runtime/src/plugins.ts
1077
- var runtimeHookPhases = ["beforeCommand", "afterCommand", "onEvent"];
1078
- var PLUGIN_SOURCE_PATTERN = /\.plugin\.(ts|js|mjs|cjs)$/;
1079
- function inferRuntimePluginName(fileName) {
1080
- return fileName.replace(PLUGIN_SOURCE_PATTERN, "");
1081
- }
1082
- function describeRuntimePluginFiles(filePaths) {
1083
- return filePaths.filter((filePath) => PLUGIN_SOURCE_PATTERN.test(filePath)).map((filePath) => {
1084
- const fileName = filePath.split(/[\\/]/).at(-1) ?? filePath;
1085
- const name = inferRuntimePluginName(fileName);
1086
- return { name, sourcePath: filePath, binaryName: name };
1087
- });
1088
- }
1089
-
1090
- class PluginManager {
1091
- eventBus;
1092
- context;
1093
- pluginDir;
1094
- pluginFiles;
1095
- pluginNames;
1096
- localBinDir;
1097
- imageBinDir;
1098
- pluginsRequireBinaries;
1099
- ensureImageBinDir;
1100
- plugins = null;
1101
- loadPromise = null;
1102
- constructor(options) {
1103
- this.eventBus = options.eventBus;
1104
- this.context = options.context;
1105
- this.pluginDir = options.pluginDir;
1106
- this.pluginFiles = options.pluginFiles;
1107
- this.pluginNames = options.pluginNames;
1108
- this.localBinDir = options.localBinDir;
1109
- this.imageBinDir = options.imageBinDir;
1110
- this.pluginsRequireBinaries = options.pluginsRequireBinaries;
1111
- this.ensureImageBinDir = options.ensureImageBinDir;
1112
- }
1113
- static async load(options) {
1114
- const pluginDir = options.pluginDir ?? resolve7(options.projectRoot, "rig", "plugins");
1115
- const localBinDir = options.localBinDir ?? resolve7(options.projectRoot, "rig", "plugins");
1116
- const imageBinDir = options.imageBinDir ?? (options.runtimeContext ? resolve7(options.runtimeContext.binDir, "plugins") : "");
1117
- const legacyPluginScan = options.legacyPluginScan ?? isLegacyPluginScanEnabled(options.env);
1118
- const pluginFiles = legacyPluginScan ? safeReadDir(pluginDir).filter((entry) => PLUGIN_SOURCE_PATTERN.test(entry)) : [];
1119
- const pluginNames = pluginFiles.map((file) => inferRuntimePluginName(basename3(file)));
1120
- const context = {
1121
- projectRoot: options.projectRoot,
1122
- runId: options.runId,
1123
- eventBus: options.eventBus
1124
- };
1125
- return new PluginManager({
1126
- eventBus: options.eventBus,
1127
- context,
1128
- pluginDir,
1129
- pluginFiles,
1130
- pluginNames,
1131
- localBinDir,
1132
- imageBinDir,
1133
- pluginsRequireBinaries: options.pluginsRequireBinaries ?? true,
1134
- ensureImageBinDir: options.ensureImageBinDir
1135
- });
1136
- }
1137
- list() {
1138
- if (this.plugins) {
1139
- return this.plugins.map((plugin) => ({
1140
- name: plugin.name,
1141
- validators: plugin.validators?.map((validator) => validator.id) ?? []
1142
- }));
1143
- }
1144
- return this.pluginNames.map((name) => ({ name, validators: [] }));
1145
- }
1146
- async beforeCommand(ctx) {
1147
- const plugins = await this.ensureLoaded();
1148
- for (const plugin of plugins) {
1149
- if (!plugin.beforeCommand)
1150
- continue;
1151
- await this.safeInvoke(plugin.name, "beforeCommand", () => plugin.beforeCommand?.(ctx, this.context));
1152
- }
1153
- }
1154
- async afterCommand(result) {
1155
- const plugins = await this.ensureLoaded();
1156
- for (const plugin of plugins) {
1157
- if (!plugin.afterCommand)
1158
- continue;
1159
- await this.safeInvoke(plugin.name, "afterCommand", () => plugin.afterCommand?.(result, this.context));
1160
- }
1161
- }
1162
- async onEvent(event) {
1163
- const plugins = this.plugins;
1164
- if (!plugins)
1165
- return;
1166
- for (const plugin of plugins) {
1167
- if (!plugin.onEvent)
1168
- continue;
1169
- await this.safeInvoke(plugin.name, "onEvent", () => plugin.onEvent?.(event, this.context));
1170
- }
1171
- }
1172
- async runValidators(taskId) {
1173
- const plugins = await this.ensureLoaded();
1174
- const results = [];
1175
- for (const plugin of plugins) {
1176
- for (const validator of plugin.validators ?? []) {
1177
- await this.eventBus.emit("validator.started", {
1178
- plugin: plugin.name,
1179
- validator: validator.id,
1180
- taskId
1181
- });
1182
- try {
1183
- const result = await validator.run({ taskId, projectRoot: this.context.projectRoot }, this.context);
1184
- results.push(result);
1185
- await this.eventBus.emit("validator.finished", {
1186
- plugin: plugin.name,
1187
- validator: validator.id,
1188
- taskId,
1189
- passed: result.passed,
1190
- summary: result.summary
1191
- });
1192
- } catch (error) {
1193
- const failed = {
1194
- id: validator.id,
1195
- passed: false,
1196
- summary: `${plugin.name}/${validator.id} failed unexpectedly`,
1197
- details: `${error}`
1198
- };
1199
- results.push(failed);
1200
- await this.eventBus.emit("validator.finished", {
1201
- plugin: plugin.name,
1202
- validator: validator.id,
1203
- taskId,
1204
- passed: false,
1205
- summary: failed.summary,
1206
- details: failed.details
1207
- });
1208
- }
1209
- }
1210
- }
1211
- return results;
1212
- }
1213
- async ensureLoaded() {
1214
- if (this.plugins)
1215
- return this.plugins;
1216
- if (this.loadPromise)
1217
- return this.loadPromise;
1218
- this.loadPromise = this.loadCompiledPlugins();
1219
- try {
1220
- this.plugins = await this.loadPromise;
1221
- return this.plugins;
1222
- } finally {
1223
- this.loadPromise = null;
1224
- }
1225
- }
1226
- resolveBinPath(binName) {
1227
- const candidates = [this.imageBinDir, this.localBinDir].filter(Boolean).map((dir) => resolve7(dir, binName));
1228
- return candidates.find((candidate) => existsSync6(candidate));
1229
- }
1230
- async loadCompiledPlugins() {
1231
- const plugins = [];
1232
- for (const file of this.pluginFiles) {
1233
- const binName = inferRuntimePluginName(basename3(file));
1234
- let binPath = this.resolveBinPath(binName);
1235
- if (!binPath && !this.imageBinDir && this.pluginsRequireBinaries && this.ensureImageBinDir) {
1236
- try {
1237
- this.imageBinDir = await this.ensureImageBinDir(this.context.projectRoot);
1238
- binPath = this.resolveBinPath(binName);
1239
- } catch {}
1240
- }
1241
- if (!binPath) {
1242
- const triedPaths = [this.imageBinDir, this.localBinDir].filter(Boolean).map((dir) => resolve7(dir, binName));
1243
- const missingError = `Compiled plugin binary not found for '${binName}'. Tried: ${triedPaths.join(", ")}`;
1244
- await this.eventBus.emit("plugin.error", {
1245
- file: resolve7(this.pluginDir, file),
1246
- phase: "load",
1247
- error: missingError
1248
- });
1249
- if (this.pluginsRequireBinaries) {
1250
- throw new Error(missingError);
1251
- }
1252
- plugins.push({ name: binName, validators: [] });
1253
- await this.eventBus.emit("plugin.loaded", {
1254
- plugin: binName,
1255
- file: resolve7(this.pluginDir, file),
1256
- source: "metadata-only"
1257
- });
1258
- continue;
1259
- }
1260
- const wrapper = createBinaryPluginWrapper(binName, binPath, this.context.projectRoot);
1261
- plugins.push(wrapper);
1262
- await this.eventBus.emit("plugin.loaded", {
1263
- plugin: wrapper.name,
1264
- file: binPath,
1265
- source: "compiled-binary"
1266
- });
1267
- }
1268
- return plugins;
1269
- }
1270
- async safeInvoke(pluginName, hook, call) {
1271
- try {
1272
- await call();
1273
- } catch (error) {
1274
- await this.eventBus.emit("plugin.error", {
1275
- plugin: pluginName,
1276
- phase: hook,
1277
- error: `${error}`
1278
- });
1279
- }
1280
- }
1281
- }
1282
- function createBinaryPluginWrapper(name, binPath, projectRoot) {
1283
- return {
1284
- name,
1285
- validators: [
1286
- {
1287
- id: `${name}:compiled`,
1288
- async run(ctx) {
1289
- const { exitCode, stdout, stderr } = await launchRuntimeBinary({
1290
- binaryPath: binPath,
1291
- args: ["--validate", ctx.taskId, ctx.projectRoot],
1292
- cwd: projectRoot
1293
- });
1294
- if (exitCode !== 0) {
1295
- return {
1296
- id: `${name}:compiled`,
1297
- passed: false,
1298
- summary: `Plugin binary ${name} exited with code ${exitCode}`,
1299
- details: stderr || stdout
1300
- };
1301
- }
1302
- try {
1303
- const results = JSON.parse(stdout.trim());
1304
- const failed = results.filter((result) => !result.passed);
1305
- if (failed.length > 0) {
1306
- return {
1307
- id: `${name}:compiled`,
1308
- passed: false,
1309
- summary: `${failed.length} of ${results.length} validator(s) failed`,
1310
- details: failed.map((result) => `${result.id}: ${result.summary}`).join(`
1311
- `)
1312
- };
1313
- }
1314
- return {
1315
- id: `${name}:compiled`,
1316
- passed: true,
1317
- summary: `All ${results.length} validator(s) passed`
1318
- };
1319
- } catch {
1320
- return {
1321
- id: `${name}:compiled`,
1322
- passed: false,
1323
- summary: `Failed to parse output from compiled plugin ${name}`,
1324
- details: stdout.slice(0, 500)
1325
- };
1326
- }
1327
- }
1328
- }
1329
- ]
1330
- };
1331
- }
1332
- function safeReadDir(path) {
1333
- try {
1334
- return readdirSync(path, { withFileTypes: true }).filter((entry) => entry.isFile()).map((entry) => entry.name).sort();
1335
- } catch {
1336
- return [];
1337
- }
1338
- }
1339
1072
  // packages/runtime/src/agent-mode.ts
1340
1073
  function looksLikeShellInvocation(args, mode = process.env.RIG_AGENT_MODE) {
1341
1074
  if (mode === "shell") {
@@ -1592,7 +1325,6 @@ var RIG_RUNTIME_PACKAGE = "@rig/runtime";
1592
1325
  export {
1593
1326
  writeRuntimeContext,
1594
1327
  secretDefinesFromEnv,
1595
- runtimeHookPhases,
1596
1328
  runtimeContextStringFields,
1597
1329
  runtimeContextArrayFields,
1598
1330
  runtimeBinaryAssetEntries,
@@ -1608,10 +1340,8 @@ export {
1608
1340
  loadDotEnvSecrets,
1609
1341
  launchRuntimeBinary,
1610
1342
  isRuntimeBinaryAssetEntry,
1611
- inferRuntimePluginName,
1612
1343
  findTaskById,
1613
1344
  ensureLocalRigServerConnection,
1614
- describeRuntimePluginFiles,
1615
1345
  createRuntimeExecutionSession,
1616
1346
  createRuntimeBinaryBuildManifest,
1617
1347
  createPluginTaskRecordReader,
@@ -1624,7 +1354,6 @@ export {
1624
1354
  RIG_RUNTIME_PACKAGE,
1625
1355
  RIG_DEFINITION_DIRNAME,
1626
1356
  RIG_ARTIFACTS_DIRNAME,
1627
- PluginManager,
1628
1357
  HttpRuntimeRunReporter,
1629
1358
  HttpRuntimeHostSession,
1630
1359
  GeneralCliEventBus,
@@ -7,22 +7,27 @@ var RIG_STATE_DIRNAME = ".rig";
7
7
  var RIG_ARTIFACTS_DIRNAME = "artifacts";
8
8
  function resolveNearestRigProjectRoot(startDir) {
9
9
  let current = resolve(startDir);
10
- let fallbackCandidate = null;
10
+ let weakMarkerCandidate = null;
11
11
  let projectCandidate = null;
12
12
  for (;; ) {
13
13
  const hasDefinition = existsSync(resolve(current, RIG_DEFINITION_DIRNAME));
14
14
  const hasState = existsSync(resolve(current, RIG_STATE_DIRNAME));
15
+ const hasTaskConfig = existsSync(resolve(current, RIG_STATE_DIRNAME, "task-config.json"));
15
16
  const hasConfig = existsSync(resolve(current, "rig.config.ts")) || existsSync(resolve(current, "rig.config.json"));
17
+ const hasGit = existsSync(resolve(current, ".git"));
16
18
  const hasControlPlane = existsSync(resolve(current, "packages", "cli", "bin", "rig.ts")) || existsSync(resolve(current, "packages", "server"));
17
- if (hasDefinition || hasState || hasConfig) {
18
- fallbackCandidate = current;
19
- if (hasControlPlane) {
20
- projectCandidate = current;
21
- }
19
+ if ((hasDefinition || hasState || hasConfig) && weakMarkerCandidate === null) {
20
+ weakMarkerCandidate = current;
21
+ }
22
+ if ((hasControlPlane || hasConfig || hasTaskConfig) && projectCandidate === null) {
23
+ projectCandidate = current;
24
+ }
25
+ if (hasGit) {
26
+ return projectCandidate ?? current;
22
27
  }
23
28
  const parent = resolve(current, "..");
24
29
  if (parent === current) {
25
- return projectCandidate ?? fallbackCandidate ?? resolve(startDir);
30
+ return projectCandidate ?? weakMarkerCandidate ?? resolve(startDir);
26
31
  }
27
32
  current = parent;
28
33
  }
@@ -134,6 +134,18 @@ async function waitForServerHealthy(baseUrl, authToken, timeoutMs) {
134
134
  }
135
135
  return false;
136
136
  }
137
+ function resolveRigServerSpawnPlan(projectRoot, host, authToken, which = (command) => Bun.which(command)) {
138
+ const binary = process.env.RIG_SERVER_BIN?.trim() || which("rig-server")?.trim();
139
+ const args = ["start", "--host", host, "--port", "0", "--auth-token", authToken];
140
+ if (binary) {
141
+ return { command: binary, args, cwd: projectRoot };
142
+ }
143
+ return {
144
+ command: "bun",
145
+ args: ["run", "packages/server/src/server.ts", ...args],
146
+ cwd: resolve2(import.meta.dir, "../../..")
147
+ };
148
+ }
137
149
  async function waitForPublishedServer(projectRoot, authToken, timeoutMs) {
138
150
  const deadline = Date.now() + timeoutMs;
139
151
  while (Date.now() < deadline) {
@@ -159,23 +171,13 @@ async function ensureLocalRigServerConnection(projectRoot, options = {}) {
159
171
  const host = options.host ?? "127.0.0.1";
160
172
  const startupTimeoutMs = options.startupTimeoutMs ?? 15000;
161
173
  const authToken = Buffer.from(crypto.getRandomValues(new Uint8Array(24))).toString("hex");
162
- const workspaceRoot = resolve2(import.meta.dir, "../../..");
163
174
  const bootstrapLogPath = resolveRigServerLogPath(projectRoot);
164
175
  mkdirSync(resolveRigServerPaths(projectRoot).logsDir, { recursive: true });
165
176
  const bootstrapLogFd = openSync(bootstrapLogPath, "w");
166
177
  clearPublishedRigServerState(projectRoot);
167
- const child = spawn("bun", [
168
- "run",
169
- "packages/server/src/server.ts",
170
- "start",
171
- "--host",
172
- host,
173
- "--port",
174
- "0",
175
- "--auth-token",
176
- authToken
177
- ], {
178
- cwd: workspaceRoot,
178
+ const spawnPlan = resolveRigServerSpawnPlan(projectRoot, host, authToken);
179
+ const child = spawn(spawnPlan.command, [...spawnPlan.args], {
180
+ cwd: spawnPlan.cwd,
179
181
  env: {
180
182
  ...process.env,
181
183
  PROJECT_RIG_ROOT: projectRoot
@@ -195,8 +197,12 @@ ${bootstrapLog}` : ` No bootstrap log was written.`;
195
197
  }
196
198
  return toLocalServerConnection(ready);
197
199
  }
200
+ var __testOnly = {
201
+ resolveRigServerSpawnPlan
202
+ };
198
203
  export {
199
204
  readPublishedRigServerStateSync,
200
205
  readPublishedRigServerState,
201
- ensureLocalRigServerConnection
206
+ ensureLocalRigServerConnection,
207
+ __testOnly
202
208
  };
Binary file
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "version": 1,
3
- "buildKey": "{\"version\":1,\"sourcePath\":\"/var/folders/zr/6js4xbjs3bgf46v76j145mlw0000gn/T/rig-native/rig-git-darwin-arm64\",\"sourceDigest\":\"5d1f9d17af5789a15328b4c4aff2b155962bd9d8e180812fa67a30c1685b2bf3\"}"
3
+ "buildKey": "{\"version\":1,\"sourcePath\":\"/var/folders/zr/6js4xbjs3bgf46v76j145mlw0000gn/T/rig-native/rig-git-darwin-arm64\",\"sourceDigest\":\"67ef79af508d46b1134d48b315c236cad8225f53ef1959d3e0bd09801c7884c4\"}"
4
4
  }
Binary file
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "version": 1,
3
- "buildKey": "{\"version\":1,\"sourcePath\":\"/var/folders/zr/6js4xbjs3bgf46v76j145mlw0000gn/T/rig-native/rig-shell-darwin-arm64\",\"sourceDigest\":\"082addd699beb1eb87d242208741012bba54becf7e2c3cd85904c68c200be3e3\"}"
3
+ "buildKey": "{\"version\":1,\"sourcePath\":\"/var/folders/zr/6js4xbjs3bgf46v76j145mlw0000gn/T/rig-native/rig-shell-darwin-arm64\",\"sourceDigest\":\"b7ec0fc575a3b2bea9bf2538207d59a5400c2cb3561080c24b87e0194954bd7a\"}"
4
4
  }
Binary file
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "version": 1,
3
- "buildKey": "{\"version\":1,\"sourcePath\":\"/var/folders/zr/6js4xbjs3bgf46v76j145mlw0000gn/T/rig-native/rig-tools-darwin-arm64\",\"sourceDigest\":\"a0950e37e897d520196d93e5487bade084e5f0cad45c57843b4e9f16a6421da8\"}"
3
+ "buildKey": "{\"version\":1,\"sourcePath\":\"/var/folders/zr/6js4xbjs3bgf46v76j145mlw0000gn/T/rig-native/rig-tools-darwin-arm64\",\"sourceDigest\":\"abfbb45225c08b4cc154e2cc5a70d0b8ba83d162a027c23a9c71ca22b350854d\"}"
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h-rig/runtime",
3
- "version": "0.0.6-alpha.3",
3
+ "version": "0.0.6-alpha.30",
4
4
  "type": "module",
5
5
  "description": "Rig package",
6
6
  "license": "UNLICENSED",
@@ -63,12 +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.30",
66
67
  "@libsql/client": "^0.17.2",
67
- "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.3",
68
- "@rig/core": "npm:@h-rig/core@0.0.6-alpha.3",
69
- "@rig/hook-kit": "npm:@h-rig/hook-kit@0.0.6-alpha.3",
70
- "@rig/shared": "npm:@h-rig/shared@0.0.6-alpha.3",
71
- "@rig/validator-kit": "npm:@h-rig/validator-kit@0.0.6-alpha.3",
68
+ "@rig/contracts": "npm:@h-rig/contracts@0.0.6-alpha.30",
69
+ "@rig/core": "npm:@h-rig/core@0.0.6-alpha.30",
70
+ "@rig/hook-kit": "npm:@h-rig/hook-kit@0.0.6-alpha.30",
71
+ "@rig/shared": "npm:@h-rig/shared@0.0.6-alpha.30",
72
+ "@rig/skill-loader": "npm:@h-rig/skill-loader@0.0.6-alpha.30",
73
+ "@rig/validator-kit": "npm:@h-rig/validator-kit@0.0.6-alpha.30",
72
74
  "effect": "4.0.0-beta.78",
73
75
  "smol-toml": "^1.6.0"
74
76
  }