@h-rig/cli-surface-plugin 0.0.6-alpha.157 → 0.0.6-alpha.158
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/src/app/drone-ui.d.ts +0 -11
- package/dist/src/app/drone-ui.js +0 -114
- package/dist/src/commands/_async-ui.d.ts +1 -1
- package/dist/src/commands/_cli-format.d.ts +0 -29
- package/dist/src/commands/_cli-format.js +59 -113
- package/dist/src/commands/_connection-state.d.ts +6 -33
- package/dist/src/commands/_connection-state.js +654 -138
- package/dist/src/commands/_doctor-checks.d.ts +2 -5
- package/dist/src/commands/_doctor-checks.js +10 -9
- package/dist/src/commands/_help-catalog.d.ts +2 -1
- package/dist/src/commands/_help-catalog.js +654 -7
- package/dist/src/commands/_inprocess-services.d.ts +5 -5
- package/dist/src/commands/_inprocess-services.js +1 -1
- package/dist/src/commands/_parsers.js +651 -12
- package/dist/src/commands/_paths.d.ts +0 -2
- package/dist/src/commands/_paths.js +2 -10
- package/dist/src/commands/_pi-install.d.ts +2 -12
- package/dist/src/commands/_pi-install.js +3 -36
- package/dist/src/commands/_policy.js +659 -20
- package/dist/src/commands/agent.d.ts +1 -1
- package/dist/src/commands/agent.js +675 -24
- package/dist/src/commands/config.d.ts +1 -1
- package/dist/src/commands/config.js +656 -21
- package/dist/src/commands/dist.d.ts +1 -1
- package/dist/src/commands/dist.js +828 -102
- package/dist/src/commands/doctor.d.ts +1 -1
- package/dist/src/commands/doctor.js +658 -12
- package/dist/src/commands/github.d.ts +1 -1
- package/dist/src/commands/github.js +658 -19
- package/dist/src/commands/inbox.d.ts +12 -8
- package/dist/src/commands/inbox.js +741 -22
- package/dist/src/commands/init.d.ts +17 -19
- package/dist/src/commands/init.js +836 -306
- package/dist/src/commands/inspect.d.ts +5 -6
- package/dist/src/commands/inspect.js +754 -42
- package/dist/src/commands/pi.d.ts +1 -1
- package/dist/src/commands/pi.js +655 -16
- package/dist/src/commands/plugin.d.ts +9 -9
- package/dist/src/commands/plugin.js +652 -13
- package/dist/src/commands/profile-and-review.d.ts +1 -1
- package/dist/src/commands/profile-and-review.js +655 -16
- package/dist/src/commands/queue.d.ts +1 -1
- package/dist/src/commands/queue.js +871 -12
- package/dist/src/commands/remote-client.d.ts +152 -0
- package/dist/src/commands/remote-client.js +475 -0
- package/dist/src/commands/remote.d.ts +1 -1
- package/dist/src/commands/remote.js +1100 -29
- package/dist/src/commands/repo-git-harness.d.ts +1 -1
- package/dist/src/commands/repo-git-harness.js +2321 -47
- package/dist/src/commands/run.d.ts +10 -6
- package/dist/src/commands/run.js +830 -50
- package/dist/src/commands/server.d.ts +1 -1
- package/dist/src/commands/server.js +649 -11
- package/dist/src/commands/setup.d.ts +2 -2
- package/dist/src/commands/setup.js +829 -18
- package/dist/src/commands/stats.d.ts +2 -4
- package/dist/src/commands/stats.js +1299 -20
- package/dist/src/commands/test.d.ts +1 -1
- package/dist/src/commands/test.js +648 -9
- package/dist/src/commands/triage.d.ts +2 -3
- package/dist/src/commands/triage.js +657 -11
- package/dist/src/commands/workspace.d.ts +1 -1
- package/dist/src/commands/workspace.js +1280 -15
- package/dist/src/control-plane/agent-binary-build.d.ts +9 -0
- package/dist/src/control-plane/agent-binary-build.js +88 -0
- package/dist/src/control-plane/embedded-native-assets.d.ts +7 -0
- package/dist/src/control-plane/embedded-native-assets.js +6 -0
- package/dist/src/control-plane/guard.d.ts +17 -0
- package/dist/src/control-plane/guard.js +684 -0
- package/dist/src/control-plane/harness-cli.d.ts +12 -0
- package/dist/src/control-plane/harness-cli.js +1623 -0
- package/dist/src/control-plane/native/git-ops.d.ts +67 -0
- package/dist/src/control-plane/native/git-ops.js +1381 -0
- package/dist/src/control-plane/native/github-auth-env.d.ts +1 -0
- package/dist/src/control-plane/native/github-auth-env.js +21 -0
- package/dist/src/control-plane/native/host-git.d.ts +4 -0
- package/dist/src/control-plane/native/host-git.js +51 -0
- package/dist/src/control-plane/priority-queue.d.ts +22 -0
- package/dist/src/control-plane/priority-queue.js +212 -0
- package/dist/src/control-plane/rigfig.d.ts +9 -0
- package/dist/src/control-plane/rigfig.js +70 -0
- package/dist/src/control-plane/scope.d.ts +3 -0
- package/dist/src/control-plane/scope.js +58 -0
- package/dist/src/control-plane/setup-status.d.ts +44 -0
- package/dist/src/control-plane/setup-status.js +164 -0
- package/dist/src/control-plane/task-data.d.ts +2 -0
- package/dist/src/control-plane/task-data.js +12 -0
- package/dist/src/control-plane/workspace-ops.d.ts +79 -0
- package/dist/src/control-plane/workspace-ops.js +639 -0
- package/dist/src/help-catalog-data.d.ts +7 -0
- package/dist/src/help-catalog-data.js +660 -0
- package/dist/src/kernel-dispatch.js +1 -3
- package/dist/src/plugin.js +10072 -30
- package/dist/src/runner.d.ts +7 -9
- package/dist/src/runner.js +750 -30
- package/package.json +12 -13
- package/dist/src/commands/_json-output.d.ts +0 -11
- package/dist/src/commands/_json-output.js +0 -54
- package/dist/src/commands/_pi-frontend.d.ts +0 -35
- package/dist/src/commands/_pi-frontend.js +0 -64
- package/dist/src/commands/_run-driver-helpers.d.ts +0 -26
- package/dist/src/commands/_run-driver-helpers.js +0 -132
- package/dist/src/commands/task-run-driver.d.ts +0 -93
- package/dist/src/commands/task-run-driver.js +0 -136
- package/dist/src/commands/task.d.ts +0 -46
- package/dist/src/commands/task.js +0 -555
- package/dist/src/provider-model.d.ts +0 -34
- package/dist/src/provider-model.js +0 -56
- package/dist/src/rig-config-package-deps.d.ts +0 -10
- package/dist/src/rig-config-package-deps.js +0 -272
- package/dist/src/version.d.ts +0 -8
- package/dist/src/version.js +0 -47
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type AgentBinaryBuildOptions = {
|
|
2
|
+
entrypoint: string;
|
|
3
|
+
outputPath: string;
|
|
4
|
+
cwd: string;
|
|
5
|
+
define?: Record<string, string>;
|
|
6
|
+
env?: Record<string, string | undefined>;
|
|
7
|
+
};
|
|
8
|
+
export declare function materializeSelfExecRole(outputPath: string, define?: Record<string, string>): void;
|
|
9
|
+
export declare function buildAgentBinary(entrypoint: string, outputPath: string, cwd: string, defines?: Record<string, string>): Promise<void>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// packages/cli-surface-plugin/src/control-plane/agent-binary-build.ts
|
|
3
|
+
import { chmodSync, copyFileSync, linkSync, mkdirSync, rmSync, writeFileSync } from "fs";
|
|
4
|
+
import { basename, dirname, resolve } from "path";
|
|
5
|
+
import { runtimeProvisioningEnv } from "@rig/core/runtime-provisioning-env";
|
|
6
|
+
|
|
7
|
+
// packages/cli-surface-plugin/src/control-plane/embedded-native-assets.ts
|
|
8
|
+
var embeddedNatives = null;
|
|
9
|
+
|
|
10
|
+
// packages/cli-surface-plugin/src/control-plane/agent-binary-build.ts
|
|
11
|
+
function materializeSelfExecRole(outputPath, define) {
|
|
12
|
+
const selfPath = process.execPath;
|
|
13
|
+
mkdirSync(dirname(outputPath), { recursive: true });
|
|
14
|
+
rmSync(outputPath, { force: true });
|
|
15
|
+
try {
|
|
16
|
+
linkSync(selfPath, outputPath);
|
|
17
|
+
} catch {
|
|
18
|
+
copyFileSync(selfPath, outputPath);
|
|
19
|
+
}
|
|
20
|
+
chmodSync(outputPath, 493);
|
|
21
|
+
const role = basename(outputPath).replace(/\.exe$/i, "");
|
|
22
|
+
writeFileSync(`${outputPath}.rig-runconfig.json`, `${JSON.stringify({ role, define: define ?? {} }, null, 2)}
|
|
23
|
+
`, { mode: 384 });
|
|
24
|
+
}
|
|
25
|
+
function hasEmbeddedNatives() {
|
|
26
|
+
return embeddedNatives !== null;
|
|
27
|
+
}
|
|
28
|
+
async function buildAgentBinary(entrypoint, outputPath, cwd, defines) {
|
|
29
|
+
if (hasEmbeddedNatives()) {
|
|
30
|
+
materializeSelfExecRole(outputPath, defines);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
await buildRuntimeBinary({
|
|
34
|
+
entrypoint,
|
|
35
|
+
outputPath,
|
|
36
|
+
cwd,
|
|
37
|
+
...defines ? { define: defines } : {},
|
|
38
|
+
env: runtimeProvisioningEnv()
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
async function buildRuntimeBinary(options) {
|
|
42
|
+
mkdirSync(dirname(options.outputPath), { recursive: true });
|
|
43
|
+
await withTemporaryEnv({
|
|
44
|
+
...options.env,
|
|
45
|
+
...options.define ? { RIG_BUILD_CONFIG_JSON: JSON.stringify(options.define) } : {}
|
|
46
|
+
}, async () => {
|
|
47
|
+
const result = await Bun.build({
|
|
48
|
+
entrypoints: [resolve(options.cwd, options.entrypoint)],
|
|
49
|
+
compile: { outfile: options.outputPath },
|
|
50
|
+
target: "bun",
|
|
51
|
+
format: "esm",
|
|
52
|
+
minify: true,
|
|
53
|
+
bytecode: true,
|
|
54
|
+
...options.define ? { define: { __RIG_BUILD_CONFIG__: JSON.stringify(options.define) } } : {}
|
|
55
|
+
});
|
|
56
|
+
if (!result.success) {
|
|
57
|
+
throw new Error(result.logs.map((log) => log.message).join(`
|
|
58
|
+
`) || `Failed to compile ${options.entrypoint}`);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
chmodSync(options.outputPath, 493);
|
|
62
|
+
}
|
|
63
|
+
async function withTemporaryEnv(env, callback) {
|
|
64
|
+
const previous = {};
|
|
65
|
+
for (const [key, value] of Object.entries(env)) {
|
|
66
|
+
previous[key] = process.env[key];
|
|
67
|
+
if (value === undefined) {
|
|
68
|
+
delete process.env[key];
|
|
69
|
+
} else {
|
|
70
|
+
process.env[key] = value;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
try {
|
|
74
|
+
return await callback();
|
|
75
|
+
} finally {
|
|
76
|
+
for (const [key, value] of Object.entries(previous)) {
|
|
77
|
+
if (value === undefined) {
|
|
78
|
+
delete process.env[key];
|
|
79
|
+
} else {
|
|
80
|
+
process.env[key] = value;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
export {
|
|
86
|
+
materializeSelfExecRole,
|
|
87
|
+
buildAgentBinary
|
|
88
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type CompletionConfig, type GuardContext, type GuardDecision, type IsolationConfig, type MatchedRule, type PolicyConfig, type PolicyMode, type PolicyRule, type RuntimeImageConfig, type RuntimeSnapshotConfig, type SandboxConfig } from "@rig/contracts";
|
|
2
|
+
export declare function resetPolicyCache(): void;
|
|
3
|
+
/**
|
|
4
|
+
* Seed the policy cache from raw JSON content (e.g. baked at compile time).
|
|
5
|
+
* When seeded, loadPolicy() returns the seeded config without disk I/O.
|
|
6
|
+
*/
|
|
7
|
+
export declare function seedPolicyFromContent(rawJson: string): void;
|
|
8
|
+
export declare function loadPolicy(projectRoot: string): PolicyConfig;
|
|
9
|
+
export declare function matchRule(rule: PolicyRule, input: string): boolean;
|
|
10
|
+
export declare function resolveAction(mode: PolicyMode, matched: MatchedRule[]): "allow" | "block" | "warn";
|
|
11
|
+
export declare function isHarnessPath(projectRoot: string, rawPath: string): boolean;
|
|
12
|
+
export declare function evaluate(context: GuardContext): GuardDecision;
|
|
13
|
+
export declare function loadSandboxConfig(projectRoot: string): SandboxConfig;
|
|
14
|
+
export declare function loadIsolationConfig(projectRoot: string): IsolationConfig;
|
|
15
|
+
export declare function loadCompletionConfig(projectRoot: string): CompletionConfig;
|
|
16
|
+
export declare function loadRuntimeImageConfig(projectRoot: string): RuntimeImageConfig;
|
|
17
|
+
export declare function loadRuntimeSnapshotConfig(projectRoot: string): RuntimeSnapshotConfig;
|