feat: 打通 v0.1 runner job 正式路径
This commit is contained in:
+18
-3
@@ -67,13 +67,27 @@ async function dispatch(args: ParsedArgs): Promise<JsonValue> {
|
||||
}
|
||||
|
||||
async function renderRunnerJob(args: ParsedArgs): Promise<JsonRecord> {
|
||||
if (args.flags.get("dry-run") !== true) throw new AgentRunError("schema-invalid", "runner job only supports --dry-run in v0.1", { httpStatus: 2 });
|
||||
const runId = flag(args, "run-id", "");
|
||||
const commandId = flag(args, "command-id", "");
|
||||
const image = flag(args, "image", "");
|
||||
if (!runId) throw new AgentRunError("schema-invalid", "runner job requires --run-id", { httpStatus: 2 });
|
||||
if (!commandId) throw new AgentRunError("schema-invalid", "runner job requires --command-id", { httpStatus: 2 });
|
||||
if (!image) throw new AgentRunError("schema-invalid", "runner job requires --image", { httpStatus: 2 });
|
||||
const image = optionalFlag(args, "image");
|
||||
if (args.flags.get("dry-run") !== true) {
|
||||
const body: JsonRecord = { commandId };
|
||||
if (image) body.image = image;
|
||||
const namespace = optionalFlag(args, "namespace");
|
||||
const attemptId = optionalFlag(args, "attempt-id");
|
||||
const runnerId = optionalFlag(args, "runner-id");
|
||||
const sourceCommit = optionalFlag(args, "source-commit");
|
||||
const runnerManagerUrl = optionalFlag(args, "runner-manager-url");
|
||||
if (namespace) body.namespace = namespace;
|
||||
if (attemptId) body.attemptId = attemptId;
|
||||
if (runnerId) body.runnerId = runnerId;
|
||||
if (sourceCommit) body.sourceCommit = sourceCommit;
|
||||
if (runnerManagerUrl) body.managerUrl = runnerManagerUrl;
|
||||
return await client(args).post(`/api/v1/runs/${encodeURIComponent(runId)}/runner-jobs`, body) as JsonRecord;
|
||||
}
|
||||
if (!image) throw new AgentRunError("schema-invalid", "runner job --dry-run requires --image", { httpStatus: 2 });
|
||||
const run = await client(args).get(`/api/v1/runs/${encodeURIComponent(runId)}`) as RunRecord;
|
||||
const options = {
|
||||
run,
|
||||
@@ -175,6 +189,7 @@ function help(): JsonRecord {
|
||||
"commands create <runId> --type turn --json-file <payload.json>",
|
||||
"commands show <commandId> --run-id <runId>",
|
||||
"runner start --run-id <runId>",
|
||||
"runner job --run-id <runId> --command-id <commandId> [--image <image>] [--runner-manager-url <url>]",
|
||||
"runner job --dry-run --run-id <runId> --command-id <commandId> --image <image>",
|
||||
"secrets codex render --dry-run [--codex-home <dir>] [--namespace agentrun-v01] [--secret-name agentrun-v01-provider-codex]",
|
||||
"backends list",
|
||||
|
||||
Reference in New Issue
Block a user