@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.
- package/dist/bin/rig-agent-dispatch.js +12 -0
- package/dist/bin/rig-agent.js +12 -14
- package/dist/src/control-plane/agent-wrapper.js +12 -0
- package/dist/src/control-plane/harness-main.js +1353 -1398
- package/dist/src/control-plane/hooks/completion-verification.js +510 -511
- package/dist/src/control-plane/hooks/inject-context.js +333 -333
- package/dist/src/control-plane/hooks/submodule-branch.js +1600 -1600
- package/dist/src/control-plane/hooks/task-runtime-start.js +1600 -1600
- package/dist/src/control-plane/native/git-ops.js +78 -151
- package/dist/src/control-plane/native/harness-cli.js +1353 -1398
- package/dist/src/control-plane/native/repo-ops.js +50 -50
- package/dist/src/control-plane/native/task-ops.js +1467 -1503
- package/dist/src/control-plane/native/verifier.js +34 -34
- package/dist/src/control-plane/pi-sessiond/bin.js +3 -2
- package/dist/src/control-plane/pi-sessiond/launcher.js +12 -0
- package/dist/src/control-plane/pi-sessiond/server.js +3 -2
- package/dist/src/control-plane/pi-sessiond/session-service.js +3 -2
- package/package.json +8 -8
|
@@ -771,44 +771,17 @@ function readBuildConfig() {
|
|
|
771
771
|
}
|
|
772
772
|
}
|
|
773
773
|
|
|
774
|
-
// packages/runtime/src/control-plane/runtime/tooling/shell.ts
|
|
775
|
-
import { tmpdir } from "os";
|
|
776
|
-
import { basename as basename3, dirname as dirname5, resolve as resolve7 } from "path";
|
|
777
|
-
var sharedNativeShellOutputDir = resolve7(tmpdir(), "rig-native");
|
|
778
|
-
var sharedNativeShellOutputPath = resolve7(sharedNativeShellOutputDir, `rig-shell-${process.platform}-${process.arch}${process.platform === "win32" ? ".exe" : ""}`);
|
|
779
|
-
// packages/runtime/src/control-plane/runtime/tooling/file-tools.ts
|
|
780
|
-
import { tmpdir as tmpdir2 } from "os";
|
|
781
|
-
import { basename as basename4, dirname as dirname6, resolve as resolve8 } from "path";
|
|
782
|
-
var sharedNativeToolsOutputDir = resolve8(tmpdir2(), "rig-native");
|
|
783
|
-
var sharedNativeToolsOutputPath = resolve8(sharedNativeToolsOutputDir, `rig-tools-${process.platform}-${process.arch}${process.platform === "win32" ? ".exe" : ""}`);
|
|
784
|
-
// packages/runtime/src/control-plane/plugin-host-context.ts
|
|
785
|
-
import { createPluginHost } from "@rig/core";
|
|
786
|
-
import { loadConfig } from "@rig/core/load-config";
|
|
787
|
-
|
|
788
|
-
// packages/runtime/src/control-plane/skill-materializer.ts
|
|
789
|
-
import { loadSkill } from "@rig/skill-loader";
|
|
790
|
-
|
|
791
|
-
// packages/runtime/src/control-plane/tasks/source-aware-task-config-source.ts
|
|
792
|
-
var STATUS_LABELS = new Set(["ready", "blocked", "in-progress", "under-review", "failed", "cancelled"]);
|
|
793
|
-
|
|
794
|
-
// packages/runtime/src/control-plane/native/task-state.ts
|
|
795
|
-
import { existsSync as existsSync12, readFileSync as readFileSync6, readdirSync as readdirSync2, statSync as statSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
796
|
-
import { basename as basename5, resolve as resolve14 } from "path";
|
|
797
|
-
// packages/runtime/src/control-plane/state-sync/read.ts
|
|
798
|
-
import { existsSync as existsSync11, readFileSync as readFileSync5 } from "fs";
|
|
799
|
-
import { resolve as resolve13 } from "path";
|
|
800
|
-
|
|
801
774
|
// packages/runtime/src/control-plane/native/git-native.ts
|
|
802
775
|
import { chmodSync as chmodSync2, copyFileSync as copyFileSync2, existsSync as existsSync7, mkdirSync as mkdirSync5, readFileSync as readFileSync3, renameSync, rmSync as rmSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
803
|
-
import { tmpdir
|
|
804
|
-
import { dirname as
|
|
776
|
+
import { tmpdir } from "os";
|
|
777
|
+
import { dirname as dirname5, isAbsolute, resolve as resolve7 } from "path";
|
|
805
778
|
import { createHash } from "crypto";
|
|
806
|
-
var sharedGitNativeOutputDir =
|
|
807
|
-
var sharedGitNativeOutputPath =
|
|
779
|
+
var sharedGitNativeOutputDir = resolve7(tmpdir(), "rig-native");
|
|
780
|
+
var sharedGitNativeOutputPath = resolve7(sharedGitNativeOutputDir, `rig-git-${process.platform}-${process.arch}${process.platform === "win32" ? ".exe" : ""}`);
|
|
808
781
|
var trackerCommandUsageProbe = "usage: rig-git fetch-ref <repo-path> <remote> <branch>";
|
|
809
782
|
function temporaryGitBinaryOutputPath(outputPath) {
|
|
810
783
|
const suffix = process.platform === "win32" ? ".exe" : "";
|
|
811
|
-
return
|
|
784
|
+
return resolve7(dirname5(outputPath), `.rig-git-${process.pid}-${Date.now()}-${Math.random().toString(36).slice(2)}${suffix}`);
|
|
812
785
|
}
|
|
813
786
|
function publishGitBinary(tempOutputPath, outputPath) {
|
|
814
787
|
try {
|
|
@@ -826,27 +799,27 @@ function runtimeRigGitFileName() {
|
|
|
826
799
|
return `rig-git${process.platform === "win32" ? ".exe" : ""}`;
|
|
827
800
|
}
|
|
828
801
|
function rigGitSourceCandidates() {
|
|
829
|
-
const execDir = process.execPath?.trim() ?
|
|
802
|
+
const execDir = process.execPath?.trim() ? dirname5(process.execPath.trim()) : "";
|
|
830
803
|
const cwd = process.cwd()?.trim() || "";
|
|
831
804
|
const projectRoot = process.env.PROJECT_RIG_ROOT?.trim() || "";
|
|
832
805
|
const hostProjectRoot = process.env.RIG_HOST_PROJECT_ROOT?.trim() || "";
|
|
833
|
-
const moduleRelativeSource =
|
|
806
|
+
const moduleRelativeSource = resolve7(import.meta.dir, "../../../native/rig-git.zig");
|
|
834
807
|
return [...new Set([
|
|
835
808
|
process.env.RIG_NATIVE_GIT_SOURCE?.trim() || "",
|
|
836
809
|
moduleRelativeSource,
|
|
837
|
-
projectRoot ?
|
|
838
|
-
hostProjectRoot ?
|
|
839
|
-
cwd ?
|
|
840
|
-
execDir ?
|
|
841
|
-
execDir ?
|
|
810
|
+
projectRoot ? resolve7(projectRoot, "packages/runtime/native/rig-git.zig") : "",
|
|
811
|
+
hostProjectRoot ? resolve7(hostProjectRoot, "packages/runtime/native/rig-git.zig") : "",
|
|
812
|
+
cwd ? resolve7(cwd, "packages/runtime/native/rig-git.zig") : "",
|
|
813
|
+
execDir ? resolve7(execDir, "..", "..", "packages/runtime/native/rig-git.zig") : "",
|
|
814
|
+
execDir ? resolve7(execDir, "..", "native", "rig-git.zig") : ""
|
|
842
815
|
].filter(Boolean))];
|
|
843
816
|
}
|
|
844
817
|
function nativePackageBinaryCandidates(fromDir, fileName) {
|
|
845
818
|
const candidates = [];
|
|
846
|
-
let cursor =
|
|
819
|
+
let cursor = resolve7(fromDir);
|
|
847
820
|
for (let index = 0;index < 8; index += 1) {
|
|
848
|
-
candidates.push(
|
|
849
|
-
const parent =
|
|
821
|
+
candidates.push(resolve7(cursor, "native", `${process.platform}-${process.arch}`, fileName), resolve7(cursor, "native", `${process.platform}-${process.arch}`, "bin", fileName), resolve7(cursor, "native", fileName), resolve7(cursor, "native", "bin", fileName));
|
|
822
|
+
const parent = dirname5(cursor);
|
|
850
823
|
if (parent === cursor)
|
|
851
824
|
break;
|
|
852
825
|
cursor = parent;
|
|
@@ -854,15 +827,15 @@ function nativePackageBinaryCandidates(fromDir, fileName) {
|
|
|
854
827
|
return candidates;
|
|
855
828
|
}
|
|
856
829
|
function rigGitBinaryCandidates() {
|
|
857
|
-
const execDir = process.execPath?.trim() ?
|
|
830
|
+
const execDir = process.execPath?.trim() ? dirname5(process.execPath.trim()) : "";
|
|
858
831
|
const fileName = runtimeRigGitFileName();
|
|
859
832
|
const explicit = process.env.RIG_NATIVE_GIT_BIN?.trim() || "";
|
|
860
833
|
return [...new Set([
|
|
861
834
|
explicit,
|
|
862
835
|
...nativePackageBinaryCandidates(import.meta.dir, fileName),
|
|
863
|
-
execDir ?
|
|
864
|
-
execDir ?
|
|
865
|
-
execDir ?
|
|
836
|
+
execDir ? resolve7(execDir, fileName) : "",
|
|
837
|
+
execDir ? resolve7(execDir, "..", fileName) : "",
|
|
838
|
+
execDir ? resolve7(execDir, "..", "bin", fileName) : "",
|
|
866
839
|
sharedGitNativeOutputPath
|
|
867
840
|
].filter(Boolean))];
|
|
868
841
|
}
|
|
@@ -938,7 +911,7 @@ function ensureRigGitBinaryPathSync(outputPath = preferredGitBinaryOutputPath())
|
|
|
938
911
|
if (!zigBinary) {
|
|
939
912
|
throw new Error("zig is required to build native Rig git tools.");
|
|
940
913
|
}
|
|
941
|
-
mkdirSync5(
|
|
914
|
+
mkdirSync5(dirname5(outputPath), { recursive: true });
|
|
942
915
|
const sourceDigest = sha256FileSync(sourcePath);
|
|
943
916
|
const buildKey = JSON.stringify({
|
|
944
917
|
version: 1,
|
|
@@ -963,7 +936,7 @@ function ensureRigGitBinaryPathSync(outputPath = preferredGitBinaryOutputPath())
|
|
|
963
936
|
"ReleaseFast",
|
|
964
937
|
`-femit-bin=${tempOutputPath}`
|
|
965
938
|
], {
|
|
966
|
-
cwd:
|
|
939
|
+
cwd: dirname5(sourcePath),
|
|
967
940
|
stdout: "pipe",
|
|
968
941
|
stderr: "pipe"
|
|
969
942
|
});
|
|
@@ -1063,9 +1036,9 @@ function nativeFetchRef(repoPath, remote, branch) {
|
|
|
1063
1036
|
return requireGitNativeString("fetch-ref", [repoPath, remote, branch]);
|
|
1064
1037
|
}
|
|
1065
1038
|
function nativeReadBlobAtRef(repoPath, ref, path) {
|
|
1066
|
-
const requestDir =
|
|
1039
|
+
const requestDir = resolve7(sharedGitNativeOutputDir, "reads", `${Date.now()}-${Math.random().toString(36).slice(2, 10)}`);
|
|
1067
1040
|
mkdirSync5(requestDir, { recursive: true });
|
|
1068
|
-
const outputPath =
|
|
1041
|
+
const outputPath = resolve7(requestDir, "blob.txt");
|
|
1069
1042
|
try {
|
|
1070
1043
|
requireGitNative("read-blob-at-ref", [repoPath, ref, path, outputPath]);
|
|
1071
1044
|
return readFileSync3(outputPath, "utf8");
|
|
@@ -1074,6 +1047,33 @@ function nativeReadBlobAtRef(repoPath, ref, path) {
|
|
|
1074
1047
|
}
|
|
1075
1048
|
}
|
|
1076
1049
|
|
|
1050
|
+
// packages/runtime/src/control-plane/runtime/tooling/shell.ts
|
|
1051
|
+
import { tmpdir as tmpdir2 } from "os";
|
|
1052
|
+
import { basename as basename3, dirname as dirname6, resolve as resolve8 } from "path";
|
|
1053
|
+
var sharedNativeShellOutputDir = resolve8(tmpdir2(), "rig-native");
|
|
1054
|
+
var sharedNativeShellOutputPath = resolve8(sharedNativeShellOutputDir, `rig-shell-${process.platform}-${process.arch}${process.platform === "win32" ? ".exe" : ""}`);
|
|
1055
|
+
// packages/runtime/src/control-plane/runtime/tooling/file-tools.ts
|
|
1056
|
+
import { tmpdir as tmpdir3 } from "os";
|
|
1057
|
+
import { basename as basename4, dirname as dirname7, resolve as resolve9 } from "path";
|
|
1058
|
+
var sharedNativeToolsOutputDir = resolve9(tmpdir3(), "rig-native");
|
|
1059
|
+
var sharedNativeToolsOutputPath = resolve9(sharedNativeToolsOutputDir, `rig-tools-${process.platform}-${process.arch}${process.platform === "win32" ? ".exe" : ""}`);
|
|
1060
|
+
// packages/runtime/src/control-plane/plugin-host-context.ts
|
|
1061
|
+
import { createPluginHost } from "@rig/core";
|
|
1062
|
+
import { loadConfig } from "@rig/core/load-config";
|
|
1063
|
+
|
|
1064
|
+
// packages/runtime/src/control-plane/skill-materializer.ts
|
|
1065
|
+
import { loadSkill } from "@rig/skill-loader";
|
|
1066
|
+
|
|
1067
|
+
// packages/runtime/src/control-plane/tasks/source-aware-task-config-source.ts
|
|
1068
|
+
var STATUS_LABELS = new Set(["ready", "blocked", "in-progress", "under-review", "failed", "cancelled"]);
|
|
1069
|
+
|
|
1070
|
+
// packages/runtime/src/control-plane/native/task-state.ts
|
|
1071
|
+
import { existsSync as existsSync12, readFileSync as readFileSync6, readdirSync as readdirSync2, statSync as statSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
1072
|
+
import { basename as basename5, resolve as resolve14 } from "path";
|
|
1073
|
+
// packages/runtime/src/control-plane/state-sync/read.ts
|
|
1074
|
+
import { existsSync as existsSync11, readFileSync as readFileSync5 } from "fs";
|
|
1075
|
+
import { resolve as resolve13 } from "path";
|
|
1076
|
+
|
|
1077
1077
|
// packages/runtime/src/control-plane/native/utils.ts
|
|
1078
1078
|
import { existsSync as existsSync9, readFileSync as readFileSync4 } from "fs";
|
|
1079
1079
|
import { resolve as resolve11 } from "path";
|