@h-rig/cli 0.0.6-alpha.78 → 0.0.6-alpha.79
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/build-rig-binaries.d.ts +2 -0
- package/dist/bin/rig.d.ts +2 -0
- package/dist/bin/rig.js +37 -13
- package/dist/src/app/board.d.ts +23 -0
- package/dist/src/app/board.js +11 -8
- package/dist/src/app/drone-ui.d.ts +37 -0
- package/dist/src/app/theme.d.ts +47 -0
- package/dist/src/commands/_async-ui.d.ts +13 -0
- package/dist/src/commands/_authority-runs.d.ts +22 -0
- package/dist/src/commands/_cli-format.d.ts +49 -0
- package/dist/src/commands/_connection-state.d.ts +44 -0
- package/dist/src/commands/_doctor-checks.d.ts +52 -0
- package/dist/src/commands/_help-catalog.d.ts +51 -0
- package/dist/src/commands/_help-catalog.js +1 -0
- package/dist/src/commands/_json-output.d.ts +11 -0
- package/dist/src/commands/_operator-surface.d.ts +34 -0
- package/dist/src/commands/_operator-view.d.ts +30 -0
- package/dist/src/commands/_parsers.d.ts +15 -0
- package/dist/src/commands/_paths.d.ts +11 -0
- package/dist/src/commands/_pi-frontend.d.ts +27 -0
- package/dist/src/commands/_pi-install.d.ts +42 -0
- package/dist/src/commands/_pi-install.js +1 -1
- package/dist/src/commands/_policy.d.ts +8 -0
- package/dist/src/commands/_preflight.d.ts +22 -0
- package/dist/src/commands/_probes.d.ts +1 -0
- package/dist/src/commands/_run-driver-helpers.d.ts +99 -0
- package/dist/src/commands/_run-replay.d.ts +24 -0
- package/dist/src/commands/_server-client.d.ts +186 -0
- package/dist/src/commands/_snapshot-upload.d.ts +39 -0
- package/dist/src/commands/_spinner.d.ts +25 -0
- package/dist/src/commands/_task-picker.d.ts +9 -0
- package/dist/src/commands/agent.d.ts +3 -0
- package/dist/src/commands/browser.d.ts +65 -0
- package/dist/src/commands/connect.d.ts +7 -0
- package/dist/src/commands/dist.d.ts +28 -0
- package/dist/src/commands/doctor.d.ts +3 -0
- package/dist/src/commands/github.d.ts +3 -0
- package/dist/src/commands/inbox.d.ts +30 -0
- package/dist/src/commands/init.d.ts +74 -0
- package/dist/src/commands/init.js +1 -1
- package/dist/src/commands/inspect.d.ts +3 -0
- package/dist/src/commands/inspector.d.ts +3 -0
- package/dist/src/commands/pi.d.ts +3 -0
- package/dist/src/commands/plugin.d.ts +16 -0
- package/dist/src/commands/profile-and-review.d.ts +4 -0
- package/dist/src/commands/queue.d.ts +3 -0
- package/dist/src/commands/remote.d.ts +3 -0
- package/dist/src/commands/repo-git-harness.d.ts +5 -0
- package/dist/src/commands/run.d.ts +3 -0
- package/dist/src/commands/server.d.ts +7 -0
- package/dist/src/commands/setup.d.ts +16 -0
- package/dist/src/commands/stats.d.ts +12 -0
- package/dist/src/commands/stats.js +1 -0
- package/dist/src/commands/task-report-bug.d.ts +19 -0
- package/dist/src/commands/task-run-driver.d.ts +132 -0
- package/dist/src/commands/task-run-driver.js +23 -2
- package/dist/src/commands/task.d.ts +14 -0
- package/dist/src/commands/task.js +1 -0
- package/dist/src/commands/test.d.ts +3 -0
- package/dist/src/commands/workspace.d.ts +3 -0
- package/dist/src/commands.d.ts +29 -0
- package/dist/src/commands.js +37 -13
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +37 -13
- package/dist/src/launcher.d.ts +61 -0
- package/dist/src/report-bug.d.ts +44 -0
- package/dist/src/runner.d.ts +47 -0
- package/dist/src/withMutedConsole.d.ts +2 -0
- package/package.json +10 -8
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { steerRunViaServer, stopRunViaServer } from "./_server-client";
|
|
2
|
+
import { createPiRunStreamRenderer, renderOperatorSnapshot } from "./_operator-surface";
|
|
3
|
+
import type { RunnerContext } from "../runner";
|
|
4
|
+
export { createPiRunStreamRenderer, renderOperatorSnapshot };
|
|
5
|
+
export declare function applyOperatorCommand(context: Pick<RunnerContext, "projectRoot">, input: {
|
|
6
|
+
readonly runId: string;
|
|
7
|
+
readonly line: string;
|
|
8
|
+
}, deps?: {
|
|
9
|
+
readonly steer?: typeof steerRunViaServer;
|
|
10
|
+
readonly stop?: typeof stopRunViaServer;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
action: "continue" | "detach" | "stopped" | "ignored";
|
|
13
|
+
message?: string;
|
|
14
|
+
}>;
|
|
15
|
+
export declare function attachRunOperatorView(context: Pick<RunnerContext, "projectRoot" | "outputMode">, input: {
|
|
16
|
+
readonly runId: string;
|
|
17
|
+
readonly message?: string | null;
|
|
18
|
+
readonly once?: boolean;
|
|
19
|
+
readonly follow?: boolean;
|
|
20
|
+
readonly pollMs?: number;
|
|
21
|
+
readonly interactive?: boolean;
|
|
22
|
+
}): Promise<{
|
|
23
|
+
run: Record<string, unknown>;
|
|
24
|
+
logs: Record<string, unknown>[];
|
|
25
|
+
timeline: Record<string, unknown>[];
|
|
26
|
+
timelineCursor: string | null;
|
|
27
|
+
steered: boolean;
|
|
28
|
+
rendered: string;
|
|
29
|
+
detached?: boolean;
|
|
30
|
+
}>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TaskSourceConfig } from "@rig/contracts";
|
|
2
|
+
import type { RigPluginWithRuntime } from "@rig/core";
|
|
3
|
+
export declare function parsePositiveInt(value: string | undefined, option: string, fallback: number): number;
|
|
4
|
+
export declare function parseOptionalPositiveInt(value: string | undefined, option: string): number | undefined;
|
|
5
|
+
export declare function parseRequiredPositiveInt(value: string | undefined, option: string): number;
|
|
6
|
+
export declare function parseAction(value: string | undefined): "validate" | "verify" | "pipeline";
|
|
7
|
+
export declare function parseIsolationMode(value: string | undefined, allowOff: true): "off" | "worktree";
|
|
8
|
+
export declare function parseIsolationMode(value: string | undefined, allowOff: false): "worktree";
|
|
9
|
+
export declare function parseInstallScope(value: string | undefined): "user" | "system";
|
|
10
|
+
export declare function resolveInstallDir(scope: "user" | "system", explicitPath: string | undefined): string;
|
|
11
|
+
export type CliRigConfig = {
|
|
12
|
+
plugins?: readonly RigPluginWithRuntime[];
|
|
13
|
+
taskSource?: TaskSourceConfig;
|
|
14
|
+
};
|
|
15
|
+
export declare function loadRigConfigOrNull(projectRoot: string): Promise<CliRigConfig | null>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare function resolveControlPlaneMonorepoRoot(projectRoot: string): string;
|
|
2
|
+
export declare function resolveControlPlaneTaskConfigPath(projectRoot: string): string;
|
|
3
|
+
export declare function resolveControlPlaneHostStateRoot(projectRoot: string): string;
|
|
4
|
+
export declare function resolveControlPlaneHostStateDir(projectRoot: string): string;
|
|
5
|
+
export declare function resolveControlPlaneHostLogsDir(projectRoot: string): string;
|
|
6
|
+
export declare function resolveControlPlaneHostBinDir(projectRoot: string): string;
|
|
7
|
+
export declare function resolveControlPlaneHostDistDir(projectRoot: string): string;
|
|
8
|
+
export declare function resolveControlPlaneMonorepoStateRoot(projectRoot: string): string;
|
|
9
|
+
export declare function resolveControlPlaneMonorepoRuntimeDir(projectRoot: string): string;
|
|
10
|
+
export declare function resolveControlPlaneArtifactsDir(projectRoot: string): string;
|
|
11
|
+
export declare function resolveControlPlaneDefinitionRoot(projectRoot: string): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { RunnerContext } from "../runner";
|
|
2
|
+
type AttachResult = {
|
|
3
|
+
run: Record<string, unknown>;
|
|
4
|
+
logs: Record<string, unknown>[];
|
|
5
|
+
timeline: Record<string, unknown>[];
|
|
6
|
+
timelineCursor: string | null;
|
|
7
|
+
steered: boolean;
|
|
8
|
+
rendered: string;
|
|
9
|
+
detached?: boolean;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Compose the operator-session environment for the attached Pi console.
|
|
13
|
+
* Exported for tests: this is the contract between `rig run attach` and the
|
|
14
|
+
* pi-rig extension's context discovery (see packages/pi-rig/src/client.ts).
|
|
15
|
+
*/
|
|
16
|
+
export declare function buildOperatorPiEnv(input: {
|
|
17
|
+
readonly runId: string;
|
|
18
|
+
readonly serverUrl: string;
|
|
19
|
+
readonly authToken?: string | null;
|
|
20
|
+
readonly serverProjectRoot?: string | null;
|
|
21
|
+
readonly sessionDir: string;
|
|
22
|
+
}): Record<string, string>;
|
|
23
|
+
export declare function attachRunBundledPiFrontend(context: Pick<RunnerContext, "projectRoot" | "outputMode">, input: {
|
|
24
|
+
readonly runId: string;
|
|
25
|
+
readonly steered?: boolean;
|
|
26
|
+
}): Promise<AttachResult>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
export type PiInstallCheck = {
|
|
2
|
+
readonly ok: boolean;
|
|
3
|
+
readonly label: string;
|
|
4
|
+
readonly detail?: string;
|
|
5
|
+
readonly hint?: string;
|
|
6
|
+
};
|
|
7
|
+
export type CommandRunner = (command: string[], options?: {
|
|
8
|
+
cwd?: string;
|
|
9
|
+
}) => Promise<{
|
|
10
|
+
exitCode: number;
|
|
11
|
+
stdout: string;
|
|
12
|
+
stderr: string;
|
|
13
|
+
}>;
|
|
14
|
+
export type PiRigInstallStatus = {
|
|
15
|
+
readonly pi: PiInstallCheck;
|
|
16
|
+
readonly piRig: PiInstallCheck;
|
|
17
|
+
readonly extensionPath: string;
|
|
18
|
+
};
|
|
19
|
+
export declare function resolvePiRigExtensionPath(homeDir: string): string;
|
|
20
|
+
export declare function resolvePiRigPackageSource(projectRoot: string, exists?: (path: string) => boolean): string;
|
|
21
|
+
export declare function checkPiRigInstall(input?: {
|
|
22
|
+
readonly homeDir?: string;
|
|
23
|
+
readonly commandRunner?: CommandRunner;
|
|
24
|
+
readonly exists?: (path: string) => boolean;
|
|
25
|
+
}): Promise<PiRigInstallStatus>;
|
|
26
|
+
export declare function ensurePiRigInstalled(input: {
|
|
27
|
+
readonly projectRoot: string;
|
|
28
|
+
readonly homeDir?: string;
|
|
29
|
+
readonly commandRunner?: CommandRunner;
|
|
30
|
+
}): Promise<PiRigInstallStatus & {
|
|
31
|
+
installedPath: string;
|
|
32
|
+
}>;
|
|
33
|
+
export declare function ensureRemotePiRigInstalled(input: {
|
|
34
|
+
readonly requestJson: (pathname: string, init?: RequestInit) => Promise<unknown>;
|
|
35
|
+
}): Promise<PiRigInstallStatus & {
|
|
36
|
+
readonly remote: true;
|
|
37
|
+
}>;
|
|
38
|
+
export declare function buildPiSetupChecks(input?: {
|
|
39
|
+
readonly homeDir?: string;
|
|
40
|
+
readonly commandRunner?: CommandRunner;
|
|
41
|
+
readonly exists?: (path: string) => boolean;
|
|
42
|
+
}): Promise<PiInstallCheck[]>;
|
|
@@ -56,7 +56,7 @@ async function ensurePiBinaryAvailable(input) {
|
|
|
56
56
|
}
|
|
57
57
|
return { ok: true, detail: (current.stdout || current.stderr).trim() || undefined };
|
|
58
58
|
}
|
|
59
|
-
const installCommand = process.env.RIG_PI_INSTALL_COMMAND?.trim() || "bunx @earendil-works/pi@latest install";
|
|
59
|
+
const installCommand = process.env.RIG_PI_INSTALL_COMMAND?.trim() || "bunx @earendil-works/pi-coding-agent@latest install";
|
|
60
60
|
const parts = splitInstallCommand(installCommand);
|
|
61
61
|
if (parts.length === 0) {
|
|
62
62
|
return { ok: false, error: (current.stderr || current.stdout).trim() || "pi --version failed" };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type RunnerContext } from "../runner";
|
|
2
|
+
import type { PolicyMode } from "@rig/runtime/control-plane/runtime/guard-types";
|
|
3
|
+
export declare function resolveEffectivePolicyMode(context: RunnerContext): PolicyMode;
|
|
4
|
+
export declare function appendControlledBashAudit(context: RunnerContext, mode: PolicyMode, command: string, args: string[], matchedRuleIds: string[], action?: "warn" | "blocked"): void;
|
|
5
|
+
export declare function enforceNativeCommandPolicy(context: RunnerContext, args: string[], options: {
|
|
6
|
+
commandPrefix: string;
|
|
7
|
+
writeAuditLog: boolean;
|
|
8
|
+
}): Promise<void>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type RunnerContext } from "../runner";
|
|
2
|
+
export type TaskRunPreflightStatus = "pass" | "warn" | "fail";
|
|
3
|
+
export type TaskRunPreflightCheck = {
|
|
4
|
+
readonly id: string;
|
|
5
|
+
readonly label: string;
|
|
6
|
+
readonly status: TaskRunPreflightStatus;
|
|
7
|
+
readonly detail?: string;
|
|
8
|
+
readonly remediation?: string;
|
|
9
|
+
};
|
|
10
|
+
export type TaskRunPreflightResult = {
|
|
11
|
+
readonly ok: boolean;
|
|
12
|
+
readonly checks: readonly TaskRunPreflightCheck[];
|
|
13
|
+
};
|
|
14
|
+
export type TaskRunPreflightOptions = {
|
|
15
|
+
readonly taskId?: string | null;
|
|
16
|
+
readonly runtimeAdapter?: "claude-code" | "codex" | "pi";
|
|
17
|
+
readonly requestJson?: (pathname: string, init?: RequestInit) => Promise<unknown>;
|
|
18
|
+
};
|
|
19
|
+
export declare function runFastTaskRunPreflight(context: RunnerContext, options?: TaskRunPreflightOptions): Promise<TaskRunPreflightResult>;
|
|
20
|
+
export declare function runProjectMainSyncPreflight(context: RunnerContext, options: {
|
|
21
|
+
disabled: boolean;
|
|
22
|
+
}): Promise<void>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runQuietBinaryProbe(binaryPath: string, args: string[], cwd: string): Promise<boolean>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { type AuthorityRunPatch, type AuthorityRunRecord } from "@rig/runtime/control-plane/authority-files";
|
|
2
|
+
import type { RunStatus } from "@rig/contracts";
|
|
3
|
+
export type SourceTaskContract = {
|
|
4
|
+
id: string;
|
|
5
|
+
title?: string | null;
|
|
6
|
+
description?: string | null;
|
|
7
|
+
body?: string | null;
|
|
8
|
+
acceptanceCriteria?: string | null;
|
|
9
|
+
acceptance_criteria?: string | null;
|
|
10
|
+
sourceIssueId?: string | null;
|
|
11
|
+
status?: string | null;
|
|
12
|
+
issueType?: string | null;
|
|
13
|
+
role?: string | null;
|
|
14
|
+
externalRef?: string | null;
|
|
15
|
+
scope?: readonly string[];
|
|
16
|
+
validation?: readonly string[];
|
|
17
|
+
validators?: readonly string[];
|
|
18
|
+
labels?: readonly string[];
|
|
19
|
+
};
|
|
20
|
+
export declare function patchAuthorityRun(projectRoot: string, runId: string, patch: AuthorityRunPatch): AuthorityRunRecord;
|
|
21
|
+
/**
|
|
22
|
+
* THE status mutation on the CLI driver side: transition-checked and
|
|
23
|
+
* journaled as a status-changed event (see @rig/contracts run-journal).
|
|
24
|
+
*/
|
|
25
|
+
export declare function setRunStatusOrFail(projectRoot: string, runId: string, to: RunStatus, options?: {
|
|
26
|
+
reason?: string | null;
|
|
27
|
+
errorText?: string | null;
|
|
28
|
+
}): AuthorityRunRecord;
|
|
29
|
+
export declare function touchAuthorityRun(projectRoot: string, runId: string): void;
|
|
30
|
+
export declare function appendRunTimeline(projectRoot: string, runId: string, value: Record<string, unknown>): void;
|
|
31
|
+
export declare function appendRunLog(projectRoot: string, runId: string, value: Record<string, unknown>): void;
|
|
32
|
+
type RunActionInput = {
|
|
33
|
+
id: string;
|
|
34
|
+
actionType: string;
|
|
35
|
+
title: string;
|
|
36
|
+
detail?: string | null;
|
|
37
|
+
state: "running" | "completed" | "failed";
|
|
38
|
+
startedAt: string;
|
|
39
|
+
completedAt?: string | null;
|
|
40
|
+
payload?: Record<string, unknown>;
|
|
41
|
+
};
|
|
42
|
+
export declare function appendRunAction(projectRoot: string, runId: string, value: RunActionInput): void;
|
|
43
|
+
export type RunActionHandle = {
|
|
44
|
+
startedAt: string;
|
|
45
|
+
complete: (detail?: string | null, payload?: Record<string, unknown>) => void;
|
|
46
|
+
fail: (detail: string, payload?: Record<string, unknown>) => void;
|
|
47
|
+
};
|
|
48
|
+
export declare function startRunAction(projectRoot: string, runId: string, input: {
|
|
49
|
+
actionId: string;
|
|
50
|
+
actionType: string;
|
|
51
|
+
title: string;
|
|
52
|
+
detail?: string | null;
|
|
53
|
+
payload?: Record<string, unknown>;
|
|
54
|
+
}): RunActionHandle;
|
|
55
|
+
export type RunEvent = {
|
|
56
|
+
type: "status";
|
|
57
|
+
runId: string;
|
|
58
|
+
status: string;
|
|
59
|
+
detail?: string | null;
|
|
60
|
+
sessionId?: string | null;
|
|
61
|
+
} | {
|
|
62
|
+
type: "timeline";
|
|
63
|
+
runId: string;
|
|
64
|
+
} | {
|
|
65
|
+
type: "log";
|
|
66
|
+
runId: string;
|
|
67
|
+
title?: string;
|
|
68
|
+
} | {
|
|
69
|
+
type: "completed";
|
|
70
|
+
runId: string;
|
|
71
|
+
} | {
|
|
72
|
+
type: "failed";
|
|
73
|
+
runId: string;
|
|
74
|
+
error: string;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Route emitServerRunEvent through the run.jsonl lifecycle log + doorbell in
|
|
78
|
+
* addition to stdout. Called once at the start of executeRigOwnedTaskRun.
|
|
79
|
+
*/
|
|
80
|
+
export declare function configureRunEventSink(projectRoot: string): void;
|
|
81
|
+
/**
|
|
82
|
+
* Print a parseable status line to stdout that the server's spawn-and-watch
|
|
83
|
+
* path reads to update its own state. Format: `__RIG_RUN_EVENT__<json>`.
|
|
84
|
+
*
|
|
85
|
+
* When `configureRunEventSink` has run, the same event is also appended to
|
|
86
|
+
* the run's `run.jsonl` lifecycle log and the server doorbell is rung.
|
|
87
|
+
*/
|
|
88
|
+
export declare function emitServerRunEvent(event: RunEvent): void;
|
|
89
|
+
export declare function buildRunPrompt(input: {
|
|
90
|
+
projectRoot: string;
|
|
91
|
+
taskId?: string;
|
|
92
|
+
fallbackTitle?: string | null;
|
|
93
|
+
fallbackDescription?: string | null;
|
|
94
|
+
fallbackAcceptanceCriteria?: string | null;
|
|
95
|
+
sourceTask?: SourceTaskContract | null;
|
|
96
|
+
initialPrompt?: string;
|
|
97
|
+
runtimeAdapter: "claude-code" | "codex" | "pi";
|
|
98
|
+
}): string;
|
|
99
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type AuthorityRunRecord } from "@rig/runtime/control-plane/authority-files";
|
|
2
|
+
export type RunReplayLine = {
|
|
3
|
+
at: string | null;
|
|
4
|
+
source: "run" | "session";
|
|
5
|
+
summary: string;
|
|
6
|
+
};
|
|
7
|
+
export type RunReplayResult = {
|
|
8
|
+
runId: string;
|
|
9
|
+
logPath: string;
|
|
10
|
+
sessionFile: string | null;
|
|
11
|
+
entryCount: number;
|
|
12
|
+
sessionEntryCount: number;
|
|
13
|
+
lines: string[];
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Locate the worker Pi session.jsonl for a run, without ever reading the file
|
|
17
|
+
* during the run lifecycle — replay-time only. Prefers the exact
|
|
18
|
+
* piSession.sessionFile recorded on the run record; falls back to scanning
|
|
19
|
+
* `<piSession.cwd>/.rig/session/` for `*_<sessionId>.jsonl`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveRunSessionFile(record: AuthorityRunRecord | null): string | null;
|
|
22
|
+
export declare function buildRunReplay(projectRoot: string, runId: string, options?: {
|
|
23
|
+
withSession?: boolean;
|
|
24
|
+
}): RunReplayResult;
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
type ServerPhaseListener = (label: string) => void;
|
|
2
|
+
/** Returns the previously registered listener so scopes can restore it. */
|
|
3
|
+
export declare function setServerPhaseListener(listener: ServerPhaseListener | null): ServerPhaseListener | null;
|
|
4
|
+
export declare function setGitHubBearerTokenForCurrentProcess(token: string | null, projectRoot?: string): void;
|
|
5
|
+
export declare function ensureServerForCli(projectRoot: string): Promise<{
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
authToken: string | null;
|
|
8
|
+
connectionKind: "local" | "remote";
|
|
9
|
+
serverProjectRoot: string | null;
|
|
10
|
+
}>;
|
|
11
|
+
export interface WorkspaceTaskFilters {
|
|
12
|
+
readonly assignee?: string;
|
|
13
|
+
readonly state?: string;
|
|
14
|
+
readonly status?: string;
|
|
15
|
+
readonly limit?: number;
|
|
16
|
+
}
|
|
17
|
+
export type WorkspaceTaskRecord = Record<string, unknown> & {
|
|
18
|
+
readonly id?: unknown;
|
|
19
|
+
readonly title?: unknown;
|
|
20
|
+
readonly status?: unknown;
|
|
21
|
+
};
|
|
22
|
+
export type SubmitTaskRunInput = {
|
|
23
|
+
runId: string;
|
|
24
|
+
taskId?: string;
|
|
25
|
+
title?: string;
|
|
26
|
+
runtimeAdapter: "claude-code" | "codex" | "pi";
|
|
27
|
+
model?: string;
|
|
28
|
+
runtimeMode: string;
|
|
29
|
+
interactionMode: string;
|
|
30
|
+
initialPrompt?: string;
|
|
31
|
+
baselineMode?: "head" | "dirty-snapshot";
|
|
32
|
+
prMode?: "auto" | "ask" | "off";
|
|
33
|
+
};
|
|
34
|
+
export declare function requestServerJson(context: {
|
|
35
|
+
projectRoot: string;
|
|
36
|
+
}, pathname: string, init?: RequestInit): Promise<unknown>;
|
|
37
|
+
export declare function listWorkspaceTasksViaServer(context: {
|
|
38
|
+
projectRoot: string;
|
|
39
|
+
}, filters?: WorkspaceTaskFilters): Promise<WorkspaceTaskRecord[]>;
|
|
40
|
+
export declare function getWorkspaceTaskViaServer(context: {
|
|
41
|
+
projectRoot: string;
|
|
42
|
+
}, taskId: string): Promise<WorkspaceTaskRecord | null>;
|
|
43
|
+
export declare function selectNextWorkspaceTaskViaServer(context: {
|
|
44
|
+
projectRoot: string;
|
|
45
|
+
}, filters?: WorkspaceTaskFilters): Promise<{
|
|
46
|
+
task: WorkspaceTaskRecord | null;
|
|
47
|
+
count: number;
|
|
48
|
+
}>;
|
|
49
|
+
/**
|
|
50
|
+
* Submit a run (task or ad-hoc) to the local rig server. Routes to
|
|
51
|
+
* /api/runs/task vs /api/runs/adhoc based on whether a taskId is provided.
|
|
52
|
+
*
|
|
53
|
+
* Caller is responsible for any pre-flight (e.g. project sync). This helper
|
|
54
|
+
* only performs the POST and surfaces server errors as CliError.
|
|
55
|
+
*/
|
|
56
|
+
export declare function getGitHubAuthStatusViaServer(context: {
|
|
57
|
+
projectRoot: string;
|
|
58
|
+
}): Promise<Record<string, unknown>>;
|
|
59
|
+
export declare function postGitHubTokenViaServer(context: {
|
|
60
|
+
projectRoot: string;
|
|
61
|
+
}, token: string, options?: {
|
|
62
|
+
readonly selectedRepo?: string;
|
|
63
|
+
readonly projectRoot?: string;
|
|
64
|
+
}): Promise<Record<string, unknown>>;
|
|
65
|
+
export declare function prepareRemoteCheckoutViaServer(context: {
|
|
66
|
+
projectRoot: string;
|
|
67
|
+
}, input: {
|
|
68
|
+
repoSlug: string;
|
|
69
|
+
checkout: Record<string, unknown>;
|
|
70
|
+
repoUrl?: string;
|
|
71
|
+
baseDir?: string;
|
|
72
|
+
}): Promise<Record<string, unknown>>;
|
|
73
|
+
export declare function registerProjectViaServer(context: {
|
|
74
|
+
projectRoot: string;
|
|
75
|
+
}, input: {
|
|
76
|
+
repoSlug: string;
|
|
77
|
+
checkout?: Record<string, unknown>;
|
|
78
|
+
}): Promise<Record<string, unknown>>;
|
|
79
|
+
export declare function switchServerProjectRootViaServer(context: {
|
|
80
|
+
projectRoot: string;
|
|
81
|
+
}, projectRoot: string, options?: {
|
|
82
|
+
timeoutMs?: number;
|
|
83
|
+
pollMs?: number;
|
|
84
|
+
}): Promise<Record<string, unknown>>;
|
|
85
|
+
export declare function listRunsViaServer(context: {
|
|
86
|
+
projectRoot: string;
|
|
87
|
+
}, options?: {
|
|
88
|
+
limit?: number;
|
|
89
|
+
}): Promise<Record<string, unknown>[]>;
|
|
90
|
+
export declare function getRunDetailsViaServer(context: {
|
|
91
|
+
projectRoot: string;
|
|
92
|
+
}, runId: string): Promise<Record<string, unknown>>;
|
|
93
|
+
export declare function getRunLogsViaServer(context: {
|
|
94
|
+
projectRoot: string;
|
|
95
|
+
}, runId: string, options?: {
|
|
96
|
+
limit?: number;
|
|
97
|
+
cursor?: string;
|
|
98
|
+
}): Promise<Record<string, unknown>>;
|
|
99
|
+
export declare function getRunTimelineViaServer(context: {
|
|
100
|
+
projectRoot: string;
|
|
101
|
+
}, runId: string, options?: {
|
|
102
|
+
limit?: number;
|
|
103
|
+
cursor?: string;
|
|
104
|
+
}): Promise<Record<string, unknown>>;
|
|
105
|
+
export declare function ensureTaskLabelsViaServer(context: {
|
|
106
|
+
projectRoot: string;
|
|
107
|
+
}): Promise<Record<string, unknown>>;
|
|
108
|
+
export declare function listGitHubProjectsViaServer(context: {
|
|
109
|
+
projectRoot: string;
|
|
110
|
+
}, owner: string): Promise<Record<string, unknown>>;
|
|
111
|
+
export declare function getGitHubProjectStatusFieldViaServer(context: {
|
|
112
|
+
projectRoot: string;
|
|
113
|
+
}, projectId: string): Promise<Record<string, unknown>>;
|
|
114
|
+
export declare function updateWorkspaceTaskViaServer(context: {
|
|
115
|
+
projectRoot: string;
|
|
116
|
+
}, input: {
|
|
117
|
+
id: string;
|
|
118
|
+
status?: string;
|
|
119
|
+
comment?: string;
|
|
120
|
+
title?: string;
|
|
121
|
+
body?: string;
|
|
122
|
+
issueNodeId?: string | null;
|
|
123
|
+
}): Promise<Record<string, unknown>>;
|
|
124
|
+
/**
|
|
125
|
+
* Resume (or restart) a run through the selected server — works against the
|
|
126
|
+
* auto-started local daemon AND a remote connection, unlike the old
|
|
127
|
+
* runtime-side path that could only spawn a local engine-checkout server.
|
|
128
|
+
* Without an explicit run id, targets the most recently updated resumable
|
|
129
|
+
* run known to the server.
|
|
130
|
+
*/
|
|
131
|
+
export declare function resumeRunViaServer(context: {
|
|
132
|
+
projectRoot: string;
|
|
133
|
+
}, runId: string | null, options: {
|
|
134
|
+
restart: boolean;
|
|
135
|
+
}): Promise<Record<string, unknown>>;
|
|
136
|
+
/** Short human label for the selected server — board/header decoration. */
|
|
137
|
+
export declare function resolveServerConnectionLabel(projectRoot: string): Promise<string>;
|
|
138
|
+
export declare function stopRunViaServer(context: {
|
|
139
|
+
projectRoot: string;
|
|
140
|
+
}, runId: string): Promise<Record<string, unknown>>;
|
|
141
|
+
export declare function steerRunViaServer(context: {
|
|
142
|
+
projectRoot: string;
|
|
143
|
+
}, runId: string, message: string): Promise<Record<string, unknown>>;
|
|
144
|
+
export declare function getRunPiSessionViaServer(context: {
|
|
145
|
+
projectRoot: string;
|
|
146
|
+
}, runId: string): Promise<Record<string, unknown>>;
|
|
147
|
+
export declare function getRunPiMessagesViaServer(context: {
|
|
148
|
+
projectRoot: string;
|
|
149
|
+
}, runId: string): Promise<Record<string, unknown>>;
|
|
150
|
+
export declare function getRunPiStatusViaServer(context: {
|
|
151
|
+
projectRoot: string;
|
|
152
|
+
}, runId: string): Promise<Record<string, unknown>>;
|
|
153
|
+
export declare function getRunPiCommandsViaServer(context: {
|
|
154
|
+
projectRoot: string;
|
|
155
|
+
}, runId: string): Promise<Record<string, unknown>>;
|
|
156
|
+
export declare function getRunPiCapabilitiesViaServer(context: {
|
|
157
|
+
projectRoot: string;
|
|
158
|
+
}, runId: string): Promise<Record<string, unknown>>;
|
|
159
|
+
export declare function sendRunPiPromptViaServer(context: {
|
|
160
|
+
projectRoot: string;
|
|
161
|
+
}, runId: string, text: string, streamingBehavior?: "steer" | "followUp"): Promise<Record<string, unknown>>;
|
|
162
|
+
export declare function sendRunPiShellViaServer(context: {
|
|
163
|
+
projectRoot: string;
|
|
164
|
+
}, runId: string, text: string): Promise<Record<string, unknown>>;
|
|
165
|
+
export declare function runRunPiCommandViaServer(context: {
|
|
166
|
+
projectRoot: string;
|
|
167
|
+
}, runId: string, text: string): Promise<Record<string, unknown>>;
|
|
168
|
+
export declare function respondRunPiExtensionUiViaServer(context: {
|
|
169
|
+
projectRoot: string;
|
|
170
|
+
}, runId: string, requestId: string, valueOrCancel: {
|
|
171
|
+
value?: unknown;
|
|
172
|
+
confirmed?: boolean;
|
|
173
|
+
cancelled?: boolean;
|
|
174
|
+
}): Promise<Record<string, unknown>>;
|
|
175
|
+
export declare function abortRunPiViaServer(context: {
|
|
176
|
+
projectRoot: string;
|
|
177
|
+
}, runId: string): Promise<Record<string, unknown>>;
|
|
178
|
+
export declare function buildRunPiEventsWebSocketUrl(context: {
|
|
179
|
+
projectRoot: string;
|
|
180
|
+
}, runId: string): Promise<string>;
|
|
181
|
+
export declare function submitTaskRunViaServer(context: {
|
|
182
|
+
projectRoot: string;
|
|
183
|
+
}, input: SubmitTaskRunInput): Promise<{
|
|
184
|
+
runId: string;
|
|
185
|
+
}>;
|
|
186
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export declare const UPLOADED_SNAPSHOT_PR_MARKER = "<!-- rig:uploaded-snapshot -->";
|
|
2
|
+
export declare const SNAPSHOT_ARCHIVE_VERSION = 1;
|
|
3
|
+
export declare const SNAPSHOT_ARCHIVE_CONTENT_TYPE = "application/vnd.rig.snapshot+json";
|
|
4
|
+
export type SnapshotUploadManifest = {
|
|
5
|
+
readonly root: string;
|
|
6
|
+
readonly files: readonly string[];
|
|
7
|
+
readonly excludedDirectories: readonly string[];
|
|
8
|
+
};
|
|
9
|
+
export type SnapshotUploadArchiveFile = {
|
|
10
|
+
readonly path: string;
|
|
11
|
+
readonly contentBase64: string;
|
|
12
|
+
};
|
|
13
|
+
export type SnapshotUploadArchive = {
|
|
14
|
+
readonly version: typeof SNAPSHOT_ARCHIVE_VERSION;
|
|
15
|
+
readonly root: string;
|
|
16
|
+
readonly files: readonly SnapshotUploadArchiveFile[];
|
|
17
|
+
readonly excludedDirectories: readonly string[];
|
|
18
|
+
readonly createdAt: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function buildSnapshotUploadManifest(projectRoot: string, options?: {
|
|
21
|
+
readonly excludedDirectories?: readonly string[];
|
|
22
|
+
}): Promise<SnapshotUploadManifest>;
|
|
23
|
+
export declare function createSnapshotUploadArchive(projectRoot: string, options?: {
|
|
24
|
+
readonly excludedDirectories?: readonly string[];
|
|
25
|
+
readonly now?: () => Date;
|
|
26
|
+
}): Promise<SnapshotUploadArchive>;
|
|
27
|
+
export declare function encodeSnapshotUploadArchive(archive: SnapshotUploadArchive): string;
|
|
28
|
+
export declare function writeSnapshotUploadArchive(projectRoot: string, outputPath: string, options?: {
|
|
29
|
+
readonly excludedDirectories?: readonly string[];
|
|
30
|
+
readonly now?: () => Date;
|
|
31
|
+
}): Promise<SnapshotUploadArchive>;
|
|
32
|
+
export declare function uploadSnapshotArchiveViaServer(context: {
|
|
33
|
+
readonly projectRoot: string;
|
|
34
|
+
}, input: {
|
|
35
|
+
readonly repoSlug: string;
|
|
36
|
+
readonly archive: SnapshotUploadArchive;
|
|
37
|
+
readonly baseDir?: string;
|
|
38
|
+
}): Promise<Record<string, unknown>>;
|
|
39
|
+
export declare function appendUploadedSnapshotPrNotice(body: string): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const SPINNER_FRAMES: readonly ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"];
|
|
2
|
+
export type TtySpinner = {
|
|
3
|
+
setLabel(label: string): void;
|
|
4
|
+
/** Erase the spinner line so other output can print cleanly. */
|
|
5
|
+
pause(): void;
|
|
6
|
+
/** Resume rendering after pause(). */
|
|
7
|
+
resume(): void;
|
|
8
|
+
/** Stop for good; optionally leave a final line. */
|
|
9
|
+
stop(finalLine?: string): void;
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* A line-rewriting spinner for async CLI waits. On non-TTY outputs it prints
|
|
13
|
+
* the label once (and label changes) so logs stay readable without ANSI.
|
|
14
|
+
*/
|
|
15
|
+
export declare function createTtySpinner(input: {
|
|
16
|
+
label: string;
|
|
17
|
+
output?: Pick<NodeJS.WriteStream, "write"> & {
|
|
18
|
+
readonly isTTY?: boolean;
|
|
19
|
+
};
|
|
20
|
+
intervalMs?: number;
|
|
21
|
+
/** Frame glyph cycle; defaults to SPINNER_FRAMES. */
|
|
22
|
+
frames?: readonly string[];
|
|
23
|
+
/** Optional glyph decorator (e.g. color), applied on TTY renders only. */
|
|
24
|
+
styleFrame?: (frame: string) => string;
|
|
25
|
+
}): TtySpinner;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { WorkspaceTaskRecord } from "./_server-client";
|
|
2
|
+
import { renderTaskPickerRows, type TaskPickerRenderer } from "./_operator-surface";
|
|
3
|
+
export { renderTaskPickerRows, type TaskPickerRenderer };
|
|
4
|
+
export type TaskPickerIO = {
|
|
5
|
+
readonly isTty?: boolean;
|
|
6
|
+
readonly prompt?: (question: string) => Promise<string>;
|
|
7
|
+
readonly renderer?: TaskPickerRenderer;
|
|
8
|
+
};
|
|
9
|
+
export declare function selectTaskWithTextPicker(tasks: readonly WorkspaceTaskRecord[], io?: TaskPickerIO): Promise<WorkspaceTaskRecord | null>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { type RunnerContext } from "../runner";
|
|
2
|
+
import type { CommandOutcome } from "@rig/runtime/control-plane/runtime/types";
|
|
3
|
+
export type BrowserHelpOptions = {
|
|
4
|
+
color?: boolean;
|
|
5
|
+
};
|
|
6
|
+
export declare function browserHelpText(options?: BrowserHelpOptions): string;
|
|
7
|
+
type BrowserDemoRuntimeOptions = {
|
|
8
|
+
port?: number;
|
|
9
|
+
profile?: string;
|
|
10
|
+
stateDir?: string;
|
|
11
|
+
targetUrl?: string;
|
|
12
|
+
};
|
|
13
|
+
type BrowserDemoRuntime = {
|
|
14
|
+
attachUrl: string;
|
|
15
|
+
browserDir: string;
|
|
16
|
+
env: Record<string, string>;
|
|
17
|
+
helperCommands: string[];
|
|
18
|
+
port: number;
|
|
19
|
+
profile: string;
|
|
20
|
+
stateDir: string;
|
|
21
|
+
targetUrl: string;
|
|
22
|
+
};
|
|
23
|
+
type BrowserDemoAgentCommand = {
|
|
24
|
+
accepted: string[];
|
|
25
|
+
primary: string;
|
|
26
|
+
};
|
|
27
|
+
type BrowserDemoAgentCommands = {
|
|
28
|
+
attach: BrowserDemoAgentCommand;
|
|
29
|
+
attachInfo: BrowserDemoAgentCommand;
|
|
30
|
+
check: BrowserDemoAgentCommand;
|
|
31
|
+
launch: BrowserDemoAgentCommand;
|
|
32
|
+
};
|
|
33
|
+
export declare function buildBrowserDemoRuntime(projectRoot: string, options?: BrowserDemoRuntimeOptions): BrowserDemoRuntime;
|
|
34
|
+
export declare function buildBrowserDemoAgentCommands(runtime: Pick<BrowserDemoRuntime, "attachUrl">): BrowserDemoAgentCommands;
|
|
35
|
+
export declare function normalizeBrowserDemoCommand(value: string): string;
|
|
36
|
+
export declare function browserDemoCommandMatches(value: string, command: BrowserDemoAgentCommand): boolean;
|
|
37
|
+
export declare function browserDemoCommandCompletions(line: string, command: BrowserDemoAgentCommand): [string[], string];
|
|
38
|
+
export declare function formatBrowserDemoCommandOutput(command: string, output: string): string;
|
|
39
|
+
export declare function executeBrowser(context: RunnerContext, args: string[]): Promise<CommandOutcome>;
|
|
40
|
+
export declare function executeBrowserDemo(context: RunnerContext, args: string[]): Promise<CommandOutcome>;
|
|
41
|
+
type BrowserDemoVersionInfo = {
|
|
42
|
+
Browser?: string;
|
|
43
|
+
webSocketDebuggerUrl?: string;
|
|
44
|
+
};
|
|
45
|
+
type BrowserDemoTarget = {
|
|
46
|
+
id?: string;
|
|
47
|
+
title?: string;
|
|
48
|
+
type?: string;
|
|
49
|
+
url?: string;
|
|
50
|
+
webSocketDebuggerUrl?: string;
|
|
51
|
+
};
|
|
52
|
+
type BrowserDemoCdpResult = {
|
|
53
|
+
afterDomState: unknown;
|
|
54
|
+
beforeDomState: unknown;
|
|
55
|
+
consoleEvents: unknown[];
|
|
56
|
+
layoutMetrics: unknown;
|
|
57
|
+
mutationEvaluation: unknown;
|
|
58
|
+
title: string | undefined;
|
|
59
|
+
};
|
|
60
|
+
export declare function formatBrowserDemoCheckOutput(runtime: BrowserDemoRuntime, version: BrowserDemoVersionInfo, pageTarget: BrowserDemoTarget, targets: BrowserDemoTarget[]): string;
|
|
61
|
+
export declare function formatBrowserDemoCdpResult(result: BrowserDemoCdpResult): string;
|
|
62
|
+
export declare function findBrowserDemoPageTarget(runtime: Pick<BrowserDemoRuntime, "targetUrl">, targets: BrowserDemoTarget[]): (BrowserDemoTarget & {
|
|
63
|
+
webSocketDebuggerUrl: string;
|
|
64
|
+
}) | null;
|
|
65
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type RunnerContext } from "../runner";
|
|
2
|
+
import type { CommandOutcome } from "@rig/runtime/control-plane/runtime/types";
|
|
3
|
+
export type ConnectionCommandOptions = {
|
|
4
|
+
group: "server";
|
|
5
|
+
interactiveUse?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare function executeConnectionCommand(context: RunnerContext, args: string[], options: ConnectionCommandOptions): Promise<CommandOutcome>;
|