feat: harden enterprise control plane
This commit is contained in:
@@ -17,6 +17,17 @@ function parseTimeoutMs(value) {
|
||||
return Number.isFinite(parsed) && parsed > 0 ? parsed : 45000;
|
||||
}
|
||||
|
||||
function normalizeControlPlatform(value) {
|
||||
const platform = String(value || "").trim().toLowerCase();
|
||||
if (!platform || platform === "macos") return "macos";
|
||||
throw new Error("UNSUPPORTED_CONTROL_PLATFORM");
|
||||
}
|
||||
|
||||
function normalizeComputerUseProvider(value) {
|
||||
const provider = String(value || "").trim();
|
||||
return provider === "openai-computer-use" ? provider : "openai-computer-use";
|
||||
}
|
||||
|
||||
function pickConfigValue(config, key, fallback) {
|
||||
if (config && config[key] !== undefined && config[key] !== null && `${config[key]}`.trim() !== "") {
|
||||
return config[key];
|
||||
@@ -85,6 +96,8 @@ export function buildBrowserControlTaskExecution(config, task) {
|
||||
}
|
||||
|
||||
const cwd = config.cwd || process.cwd();
|
||||
const controlPlatform = normalizeControlPlatform(task?.controlPlatform);
|
||||
const computerUseProvider = normalizeComputerUseProvider(task?.computerUseProvider);
|
||||
return {
|
||||
command: config.command,
|
||||
args: resolveCommandArgs(config.command, config.args || [], cwd),
|
||||
@@ -94,6 +107,8 @@ export function buildBrowserControlTaskExecution(config, task) {
|
||||
requestKind: "browser_control",
|
||||
requestId: String(task?.taskId || "").trim(),
|
||||
objective: String(task?.requestText || task?.executionPrompt || "").trim(),
|
||||
platform: controlPlatform,
|
||||
provider: computerUseProvider,
|
||||
context: {
|
||||
projectId: String(task?.projectId || "").trim() || undefined,
|
||||
threadId: String(task?.threadId || task?.targetThreadId || "").trim() || undefined,
|
||||
@@ -101,6 +116,8 @@ export function buildBrowserControlTaskExecution(config, task) {
|
||||
requestedAt: String(task?.requestedAt || "").trim() || undefined,
|
||||
confirmationScopeKey: String(task?.confirmationScopeKey || "").trim() || undefined,
|
||||
riskLevel: String(task?.riskLevel || "").trim() || undefined,
|
||||
controlPlatform,
|
||||
computerUseProvider,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user