chore(gate): fix lint and protocol
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import { resolveAgentConfig, resolveAgentDir, resolveSessionAgentId } from "../../agents/agent-scope.js";
|
||||
import {
|
||||
resolveAgentConfig,
|
||||
resolveAgentDir,
|
||||
resolveSessionAgentId,
|
||||
} from "../../agents/agent-scope.js";
|
||||
import type { ModelAliasIndex } from "../../agents/model-selection.js";
|
||||
import { resolveSandboxRuntimeStatus } from "../../agents/sandbox.js";
|
||||
import type { ClawdbotConfig } from "../../config/config.js";
|
||||
@@ -50,9 +54,7 @@ function resolveExecDefaults(params: {
|
||||
(globalExec?.ask as ExecAsk | undefined) ??
|
||||
"on-miss",
|
||||
node:
|
||||
(params.sessionEntry?.execNode as string | undefined) ??
|
||||
agentExec?.node ??
|
||||
globalExec?.node,
|
||||
(params.sessionEntry?.execNode as string | undefined) ?? agentExec?.node ?? globalExec?.node,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -20,13 +20,15 @@ type ExecDirectiveParse = {
|
||||
|
||||
function normalizeExecHost(value?: string): ExecHost | undefined {
|
||||
const normalized = value?.trim().toLowerCase();
|
||||
if (normalized === "sandbox" || normalized === "gateway" || normalized === "node") return normalized;
|
||||
if (normalized === "sandbox" || normalized === "gateway" || normalized === "node")
|
||||
return normalized;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function normalizeExecSecurity(value?: string): ExecSecurity | undefined {
|
||||
const normalized = value?.trim().toLowerCase();
|
||||
if (normalized === "deny" || normalized === "allowlist" || normalized === "full") return normalized;
|
||||
if (normalized === "deny" || normalized === "allowlist" || normalized === "full")
|
||||
return normalized;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@@ -38,7 +40,10 @@ function normalizeExecAsk(value?: string): ExecAsk | undefined {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
function parseExecDirectiveArgs(raw: string): Omit<ExecDirectiveParse, "cleaned" | "hasDirective"> & {
|
||||
function parseExecDirectiveArgs(raw: string): Omit<
|
||||
ExecDirectiveParse,
|
||||
"cleaned" | "hasDirective"
|
||||
> & {
|
||||
consumed: number;
|
||||
} {
|
||||
let i = 0;
|
||||
@@ -76,8 +81,7 @@ function parseExecDirectiveArgs(raw: string): Omit<ExecDirectiveParse, "cleaned"
|
||||
const splitToken = (token: string): { key: string; value: string } | null => {
|
||||
const eq = token.indexOf("=");
|
||||
const colon = token.indexOf(":");
|
||||
const idx =
|
||||
eq === -1 ? colon : colon === -1 ? eq : Math.min(eq, colon);
|
||||
const idx = eq === -1 ? colon : colon === -1 ? eq : Math.min(eq, colon);
|
||||
if (idx === -1) return null;
|
||||
const key = token.slice(0, idx).trim().toLowerCase();
|
||||
const value = token.slice(idx + 1).trim();
|
||||
|
||||
@@ -66,9 +66,11 @@ function resolveExecOverrides(params: {
|
||||
directives: InlineDirectives;
|
||||
sessionEntry?: SessionEntry;
|
||||
}): ExecOverrides | undefined {
|
||||
const host = params.directives.execHost ?? (params.sessionEntry?.execHost as ExecOverrides["host"]);
|
||||
const host =
|
||||
params.directives.execHost ?? (params.sessionEntry?.execHost as ExecOverrides["host"]);
|
||||
const security =
|
||||
params.directives.execSecurity ?? (params.sessionEntry?.execSecurity as ExecOverrides["security"]);
|
||||
params.directives.execSecurity ??
|
||||
(params.sessionEntry?.execSecurity as ExecOverrides["security"]);
|
||||
const ask = params.directives.execAsk ?? (params.sessionEntry?.execAsk as ExecOverrides["ask"]);
|
||||
const node = params.directives.execNode ?? params.sessionEntry?.execNode;
|
||||
if (!host && !security && !ask && !node) return undefined;
|
||||
|
||||
Reference in New Issue
Block a user