feat: add session subagent cli control

This commit is contained in:
Codex
2026-06-03 11:27:55 +08:00
parent a40fdf6ab1
commit b761ef6713
12 changed files with 833 additions and 34 deletions
+11 -1
View File
@@ -1,5 +1,5 @@
import { createHash, randomUUID } from "node:crypto";
import type { BackendProfile, CreateCommandInput, CreateQueueTaskInput, CreateRunInput, ExecutionPolicy, JsonRecord, JsonValue, QueueTaskState, ResourceBundleRef, SecretRef, SessionRef } from "./types.js";
import type { BackendProfile, CreateCommandInput, CreateQueueTaskInput, CreateRunInput, ExecutionPolicy, JsonRecord, JsonValue, QueueTaskState, ResourceBundleRef, SecretRef, SessionListState, SessionRef } from "./types.js";
import { AgentRunError } from "./errors.js";
import { backendProfileSpec, backendProfiles, isBackendProfile } from "./backend-profiles.js";
@@ -328,3 +328,13 @@ export function validateQueueTaskState(value: string): QueueTaskState {
if (value === "pending" || value === "running" || value === "completed" || value === "failed" || value === "blocked" || value === "cancelled") return value;
throw new AgentRunError("schema-invalid", `queue task state ${value} is not supported`, { httpStatus: 400 });
}
export function validateSessionListState(value: string): SessionListState {
if (value === "default" || value === "running" || value === "unread" || value === "terminal" || value === "idle" || value === "all") return value;
throw new AgentRunError("schema-invalid", `session state ${value} is not supported`, { httpStatus: 400 });
}
export function validateBackendProfile(value: string): BackendProfile {
if (isBackendProfile(value)) return value;
throw new AgentRunError("schema-invalid", `backendProfile ${value} is not supported in v0.1`, { httpStatus: 400, details: { allowedBackends: [...backendProfiles] } });
}