@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.
- package/dist/bin/rig-agent-dispatch.js +552 -483
- package/dist/bin/rig-agent.js +418 -364
- package/dist/src/control-plane/agent-wrapper.js +557 -488
- package/dist/src/control-plane/harness-main.js +559 -1418
- package/dist/src/control-plane/hooks/completion-verification.js +451 -808
- package/dist/src/control-plane/hooks/inject-context.js +191 -137
- package/dist/src/control-plane/hooks/submodule-branch.js +596 -542
- package/dist/src/control-plane/hooks/task-runtime-start.js +596 -542
- package/dist/src/control-plane/materialize-task-config.js +64 -8
- package/dist/src/control-plane/native/git-ops.js +3 -0
- package/dist/src/control-plane/native/harness-cli.js +544 -496
- package/dist/src/control-plane/native/repo-ops.js +3 -0
- package/dist/src/control-plane/native/run-ops.js +3 -0
- package/dist/src/control-plane/native/task-ops.js +418 -370
- package/dist/src/control-plane/native/validator.js +161 -107
- package/dist/src/control-plane/native/verifier.js +217 -169
- package/dist/src/control-plane/pi-sessiond/launcher.js +12 -2
- package/dist/src/control-plane/plugin-host-context.js +54 -0
- package/dist/src/control-plane/runtime/image/fingerprint-sidecar.js +3 -0
- package/dist/src/control-plane/runtime/image/index.js +3 -0
- package/dist/src/control-plane/runtime/image-fingerprint-sidecar.js +3 -0
- package/dist/src/control-plane/runtime/image.js +3 -0
- package/dist/src/control-plane/runtime/index.js +487 -718
- package/dist/src/control-plane/runtime/isolation/index.js +511 -457
- package/dist/src/control-plane/runtime/isolation.js +511 -457
- package/dist/src/control-plane/runtime/plugin-mode.js +3 -27
- package/dist/src/control-plane/runtime/queue.js +428 -381
- package/dist/src/control-plane/runtime/snapshot/task-run.js +3 -0
- package/dist/src/control-plane/runtime/task-run-snapshot.js +3 -0
- package/dist/src/control-plane/skill-materializer.js +46 -0
- package/dist/src/control-plane/tasks/source-lifecycle.js +84 -30
- package/dist/src/index.js +0 -278
- package/native/darwin-arm64/rig-shell +0 -0
- package/native/darwin-arm64/rig-shell.build-manifest.json +1 -1
- package/native/darwin-arm64/rig-tools +0 -0
- package/native/darwin-arm64/rig-tools.build-manifest.json +1 -1
- package/package.json +8 -7
- package/dist/src/control-plane/runtime/plugins.js +0 -1131
- package/dist/src/plugins.js +0 -329
|
@@ -300,6 +300,50 @@ function safeReadJson(path) {
|
|
|
300
300
|
var MARKER_PLUGIN = "_rigPlugin", MARKER_HOOK_ID = "_rigHookId";
|
|
301
301
|
var init_hook_materializer = () => {};
|
|
302
302
|
|
|
303
|
+
// packages/runtime/src/control-plane/skill-materializer.ts
|
|
304
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync2, readdirSync, rmSync, writeFileSync as writeFileSync2 } from "fs";
|
|
305
|
+
import { resolve as resolve2 } from "path";
|
|
306
|
+
import { loadSkill } from "@rig/skill-loader";
|
|
307
|
+
function skillDirName(id) {
|
|
308
|
+
return id.replace(/[^a-zA-Z0-9._-]+/g, "-");
|
|
309
|
+
}
|
|
310
|
+
async function materializeSkills(projectRoot, entries) {
|
|
311
|
+
const skillsRoot = resolve2(projectRoot, ".pi", "skills");
|
|
312
|
+
if (existsSync3(skillsRoot)) {
|
|
313
|
+
for (const name of readdirSync(skillsRoot)) {
|
|
314
|
+
const dir = resolve2(skillsRoot, name);
|
|
315
|
+
if (existsSync3(resolve2(dir, MARKER_FILENAME))) {
|
|
316
|
+
rmSync(dir, { recursive: true, force: true });
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
const written = [];
|
|
321
|
+
for (const { pluginName, skill } of entries) {
|
|
322
|
+
const sourcePath = resolve2(projectRoot, skill.path);
|
|
323
|
+
if (!existsSync3(sourcePath)) {
|
|
324
|
+
console.warn(`[plugin-host] skill "${skill.id}" from plugin "${pluginName}" not materialized: ${sourcePath} does not exist`);
|
|
325
|
+
continue;
|
|
326
|
+
}
|
|
327
|
+
let body;
|
|
328
|
+
try {
|
|
329
|
+
await loadSkill(sourcePath);
|
|
330
|
+
body = readFileSync2(sourcePath, "utf-8");
|
|
331
|
+
} catch (err) {
|
|
332
|
+
console.warn(`[plugin-host] skill "${skill.id}" from plugin "${pluginName}" not materialized: ${err instanceof Error ? err.message : err}`);
|
|
333
|
+
continue;
|
|
334
|
+
}
|
|
335
|
+
const dir = resolve2(skillsRoot, skillDirName(skill.id));
|
|
336
|
+
mkdirSync2(dir, { recursive: true });
|
|
337
|
+
writeFileSync2(resolve2(dir, "SKILL.md"), body, "utf-8");
|
|
338
|
+
writeFileSync2(resolve2(dir, MARKER_FILENAME), `${JSON.stringify({ plugin: pluginName, skillId: skill.id }, null, 2)}
|
|
339
|
+
`, "utf-8");
|
|
340
|
+
written.push({ id: skill.id, pluginName, directory: dir });
|
|
341
|
+
}
|
|
342
|
+
return written;
|
|
343
|
+
}
|
|
344
|
+
var MARKER_FILENAME = ".rig-plugin";
|
|
345
|
+
var init_skill_materializer = () => {};
|
|
346
|
+
|
|
303
347
|
// packages/runtime/src/control-plane/plugin-host-context.ts
|
|
304
348
|
var exports_plugin_host_context = {};
|
|
305
349
|
__export(exports_plugin_host_context, {
|
|
@@ -342,6 +386,17 @@ async function buildPluginHostContext(projectRoot) {
|
|
|
342
386
|
} catch (err) {
|
|
343
387
|
console.warn(`[plugin-host] hook materialization failed: ${err instanceof Error ? err.message : err}`);
|
|
344
388
|
}
|
|
389
|
+
try {
|
|
390
|
+
const skillEntries = config.plugins.flatMap((plugin) => (plugin.contributes?.skills ?? []).map((skill) => ({
|
|
391
|
+
pluginName: plugin.name,
|
|
392
|
+
skill
|
|
393
|
+
})));
|
|
394
|
+
if (skillEntries.length > 0) {
|
|
395
|
+
await materializeSkills(projectRoot, skillEntries);
|
|
396
|
+
}
|
|
397
|
+
} catch (err) {
|
|
398
|
+
console.warn(`[plugin-host] skill materialization failed: ${err instanceof Error ? err.message : err}`);
|
|
399
|
+
}
|
|
345
400
|
return {
|
|
346
401
|
config,
|
|
347
402
|
pluginHost,
|
|
@@ -357,13 +412,14 @@ var init_plugin_host_context = __esm(() => {
|
|
|
357
412
|
init_registry();
|
|
358
413
|
init_runtime_registration();
|
|
359
414
|
init_hook_materializer();
|
|
415
|
+
init_skill_materializer();
|
|
360
416
|
});
|
|
361
417
|
|
|
362
418
|
// packages/runtime/src/control-plane/materialize-task-config.ts
|
|
363
|
-
import { existsSync as
|
|
364
|
-
import { dirname as dirname2, resolve as
|
|
419
|
+
import { existsSync as existsSync4, mkdirSync as mkdirSync3, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
420
|
+
import { dirname as dirname2, resolve as resolve3 } from "path";
|
|
365
421
|
async function materializePluginHostTaskConfig(projectRoot) {
|
|
366
|
-
const hasConfig =
|
|
422
|
+
const hasConfig = existsSync4(resolve3(projectRoot, "rig.config.ts")) || existsSync4(resolve3(projectRoot, "rig.config.json"));
|
|
367
423
|
if (!hasConfig)
|
|
368
424
|
return null;
|
|
369
425
|
const { buildPluginHostContext: buildPluginHostContext2 } = await Promise.resolve().then(() => (init_plugin_host_context(), exports_plugin_host_context));
|
|
@@ -383,8 +439,8 @@ async function materializePluginHostTaskConfig(projectRoot) {
|
|
|
383
439
|
const tasks = await source.list();
|
|
384
440
|
if (tasks.length === 0)
|
|
385
441
|
return null;
|
|
386
|
-
const configPath =
|
|
387
|
-
const existing =
|
|
442
|
+
const configPath = resolve3(projectRoot, ".rig", "task-config.json");
|
|
443
|
+
const existing = existsSync4(configPath) ? safeJsonRead(configPath) : {};
|
|
388
444
|
const merged = { ...existing };
|
|
389
445
|
let syncedCount = 0;
|
|
390
446
|
for (const task of tasks) {
|
|
@@ -400,8 +456,8 @@ async function materializePluginHostTaskConfig(projectRoot) {
|
|
|
400
456
|
merged[id] = synthesizeEntry(t, ctx.config.taskSource);
|
|
401
457
|
syncedCount += 1;
|
|
402
458
|
}
|
|
403
|
-
|
|
404
|
-
|
|
459
|
+
mkdirSync3(dirname2(configPath), { recursive: true });
|
|
460
|
+
writeFileSync3(configPath, `${JSON.stringify(merged, null, 2)}
|
|
405
461
|
`, "utf-8");
|
|
406
462
|
return { configPath, syncedCount };
|
|
407
463
|
}
|
|
@@ -442,7 +498,7 @@ function materializedTaskSource(taskSource) {
|
|
|
442
498
|
}
|
|
443
499
|
function safeJsonRead(path) {
|
|
444
500
|
try {
|
|
445
|
-
const parsed = JSON.parse(
|
|
501
|
+
const parsed = JSON.parse(readFileSync3(path, "utf-8"));
|
|
446
502
|
return parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : {};
|
|
447
503
|
} catch {
|
|
448
504
|
return {};
|
|
@@ -311,6 +311,9 @@ function getScopeRules() {
|
|
|
311
311
|
return activeRules;
|
|
312
312
|
}
|
|
313
313
|
|
|
314
|
+
// packages/runtime/src/control-plane/skill-materializer.ts
|
|
315
|
+
import { loadSkill } from "@rig/skill-loader";
|
|
316
|
+
|
|
314
317
|
// packages/runtime/src/control-plane/tasks/source-aware-task-config-source.ts
|
|
315
318
|
var STATUS_LABELS = new Set(["ready", "blocked", "in-progress", "under-review", "failed", "cancelled"]);
|
|
316
319
|
|