chore(gate): fix lint and protocol
This commit is contained in:
@@ -760,6 +760,10 @@ public struct SessionsPatchParams: Codable, Sendable {
|
|||||||
public let reasoninglevel: AnyCodable?
|
public let reasoninglevel: AnyCodable?
|
||||||
public let responseusage: AnyCodable?
|
public let responseusage: AnyCodable?
|
||||||
public let elevatedlevel: AnyCodable?
|
public let elevatedlevel: AnyCodable?
|
||||||
|
public let exechost: AnyCodable?
|
||||||
|
public let execsecurity: AnyCodable?
|
||||||
|
public let execask: AnyCodable?
|
||||||
|
public let execnode: AnyCodable?
|
||||||
public let model: AnyCodable?
|
public let model: AnyCodable?
|
||||||
public let spawnedby: AnyCodable?
|
public let spawnedby: AnyCodable?
|
||||||
public let sendpolicy: AnyCodable?
|
public let sendpolicy: AnyCodable?
|
||||||
@@ -773,6 +777,10 @@ public struct SessionsPatchParams: Codable, Sendable {
|
|||||||
reasoninglevel: AnyCodable?,
|
reasoninglevel: AnyCodable?,
|
||||||
responseusage: AnyCodable?,
|
responseusage: AnyCodable?,
|
||||||
elevatedlevel: AnyCodable?,
|
elevatedlevel: AnyCodable?,
|
||||||
|
exechost: AnyCodable?,
|
||||||
|
execsecurity: AnyCodable?,
|
||||||
|
execask: AnyCodable?,
|
||||||
|
execnode: AnyCodable?,
|
||||||
model: AnyCodable?,
|
model: AnyCodable?,
|
||||||
spawnedby: AnyCodable?,
|
spawnedby: AnyCodable?,
|
||||||
sendpolicy: AnyCodable?,
|
sendpolicy: AnyCodable?,
|
||||||
@@ -785,6 +793,10 @@ public struct SessionsPatchParams: Codable, Sendable {
|
|||||||
self.reasoninglevel = reasoninglevel
|
self.reasoninglevel = reasoninglevel
|
||||||
self.responseusage = responseusage
|
self.responseusage = responseusage
|
||||||
self.elevatedlevel = elevatedlevel
|
self.elevatedlevel = elevatedlevel
|
||||||
|
self.exechost = exechost
|
||||||
|
self.execsecurity = execsecurity
|
||||||
|
self.execask = execask
|
||||||
|
self.execnode = execnode
|
||||||
self.model = model
|
self.model = model
|
||||||
self.spawnedby = spawnedby
|
self.spawnedby = spawnedby
|
||||||
self.sendpolicy = sendpolicy
|
self.sendpolicy = sendpolicy
|
||||||
@@ -798,6 +810,10 @@ public struct SessionsPatchParams: Codable, Sendable {
|
|||||||
case reasoninglevel = "reasoningLevel"
|
case reasoninglevel = "reasoningLevel"
|
||||||
case responseusage = "responseUsage"
|
case responseusage = "responseUsage"
|
||||||
case elevatedlevel = "elevatedLevel"
|
case elevatedlevel = "elevatedLevel"
|
||||||
|
case exechost = "execHost"
|
||||||
|
case execsecurity = "execSecurity"
|
||||||
|
case execask = "execAsk"
|
||||||
|
case execnode = "execNode"
|
||||||
case model
|
case model
|
||||||
case spawnedby = "spawnedBy"
|
case spawnedby = "spawnedBy"
|
||||||
case sendpolicy = "sendPolicy"
|
case sendpolicy = "sendPolicy"
|
||||||
|
|||||||
@@ -2,10 +2,7 @@ import path from "node:path";
|
|||||||
|
|
||||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||||
|
|
||||||
import {
|
import { resolveBootstrapContextForRun, resolveBootstrapFilesForRun } from "./bootstrap-files.js";
|
||||||
resolveBootstrapContextForRun,
|
|
||||||
resolveBootstrapFilesForRun,
|
|
||||||
} from "./bootstrap-files.js";
|
|
||||||
import { makeTempWorkspace } from "../test-helpers/workspace.js";
|
import { makeTempWorkspace } from "../test-helpers/workspace.js";
|
||||||
import {
|
import {
|
||||||
clearInternalHooks,
|
clearInternalHooks,
|
||||||
|
|||||||
@@ -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 type { ModelAliasIndex } from "../../agents/model-selection.js";
|
||||||
import { resolveSandboxRuntimeStatus } from "../../agents/sandbox.js";
|
import { resolveSandboxRuntimeStatus } from "../../agents/sandbox.js";
|
||||||
import type { ClawdbotConfig } from "../../config/config.js";
|
import type { ClawdbotConfig } from "../../config/config.js";
|
||||||
@@ -50,9 +54,7 @@ function resolveExecDefaults(params: {
|
|||||||
(globalExec?.ask as ExecAsk | undefined) ??
|
(globalExec?.ask as ExecAsk | undefined) ??
|
||||||
"on-miss",
|
"on-miss",
|
||||||
node:
|
node:
|
||||||
(params.sessionEntry?.execNode as string | undefined) ??
|
(params.sessionEntry?.execNode as string | undefined) ?? agentExec?.node ?? globalExec?.node,
|
||||||
agentExec?.node ??
|
|
||||||
globalExec?.node,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,13 +20,15 @@ type ExecDirectiveParse = {
|
|||||||
|
|
||||||
function normalizeExecHost(value?: string): ExecHost | undefined {
|
function normalizeExecHost(value?: string): ExecHost | undefined {
|
||||||
const normalized = value?.trim().toLowerCase();
|
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;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeExecSecurity(value?: string): ExecSecurity | undefined {
|
function normalizeExecSecurity(value?: string): ExecSecurity | undefined {
|
||||||
const normalized = value?.trim().toLowerCase();
|
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;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -38,7 +40,10 @@ function normalizeExecAsk(value?: string): ExecAsk | undefined {
|
|||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
function parseExecDirectiveArgs(raw: string): Omit<ExecDirectiveParse, "cleaned" | "hasDirective"> & {
|
function parseExecDirectiveArgs(raw: string): Omit<
|
||||||
|
ExecDirectiveParse,
|
||||||
|
"cleaned" | "hasDirective"
|
||||||
|
> & {
|
||||||
consumed: number;
|
consumed: number;
|
||||||
} {
|
} {
|
||||||
let i = 0;
|
let i = 0;
|
||||||
@@ -76,8 +81,7 @@ function parseExecDirectiveArgs(raw: string): Omit<ExecDirectiveParse, "cleaned"
|
|||||||
const splitToken = (token: string): { key: string; value: string } | null => {
|
const splitToken = (token: string): { key: string; value: string } | null => {
|
||||||
const eq = token.indexOf("=");
|
const eq = token.indexOf("=");
|
||||||
const colon = token.indexOf(":");
|
const colon = token.indexOf(":");
|
||||||
const idx =
|
const idx = eq === -1 ? colon : colon === -1 ? eq : Math.min(eq, colon);
|
||||||
eq === -1 ? colon : colon === -1 ? eq : Math.min(eq, colon);
|
|
||||||
if (idx === -1) return null;
|
if (idx === -1) return null;
|
||||||
const key = token.slice(0, idx).trim().toLowerCase();
|
const key = token.slice(0, idx).trim().toLowerCase();
|
||||||
const value = token.slice(idx + 1).trim();
|
const value = token.slice(idx + 1).trim();
|
||||||
|
|||||||
@@ -66,9 +66,11 @@ function resolveExecOverrides(params: {
|
|||||||
directives: InlineDirectives;
|
directives: InlineDirectives;
|
||||||
sessionEntry?: SessionEntry;
|
sessionEntry?: SessionEntry;
|
||||||
}): ExecOverrides | undefined {
|
}): 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 =
|
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 ask = params.directives.execAsk ?? (params.sessionEntry?.execAsk as ExecOverrides["ask"]);
|
||||||
const node = params.directives.execNode ?? params.sessionEntry?.execNode;
|
const node = params.directives.execNode ?? params.sessionEntry?.execNode;
|
||||||
if (!host && !security && !ask && !node) return undefined;
|
if (!host && !security && !ask && !node) return undefined;
|
||||||
|
|||||||
@@ -340,8 +340,8 @@ describe("OpenAI-compatible HTTP API (e2e)", () => {
|
|||||||
expect(res.status).toBe(200);
|
expect(res.status).toBe(200);
|
||||||
|
|
||||||
const [opts] = agentCommand.mock.calls[0] ?? [];
|
const [opts] = agentCommand.mock.calls[0] ?? [];
|
||||||
const extraSystemPrompt = (opts as { extraSystemPrompt?: string } | undefined)
|
const extraSystemPrompt =
|
||||||
?.extraSystemPrompt ?? "";
|
(opts as { extraSystemPrompt?: string } | undefined)?.extraSystemPrompt ?? "";
|
||||||
expect(extraSystemPrompt).toBe("You are a helpful assistant.");
|
expect(extraSystemPrompt).toBe("You are a helpful assistant.");
|
||||||
} finally {
|
} finally {
|
||||||
await server.close({ reason: "test done" });
|
await server.close({ reason: "test done" });
|
||||||
|
|||||||
@@ -2,10 +2,7 @@ import type { ClawdbotConfig } from "../../../config/config.js";
|
|||||||
import { isSubagentSessionKey } from "../../../routing/session-key.js";
|
import { isSubagentSessionKey } from "../../../routing/session-key.js";
|
||||||
import { resolveHookConfig } from "../../config.js";
|
import { resolveHookConfig } from "../../config.js";
|
||||||
import { isAgentBootstrapEvent, type HookHandler } from "../../hooks.js";
|
import { isAgentBootstrapEvent, type HookHandler } from "../../hooks.js";
|
||||||
import {
|
import { applySoulEvilOverride, resolveSoulEvilConfigFromHook } from "../../soul-evil.js";
|
||||||
applySoulEvilOverride,
|
|
||||||
resolveSoulEvilConfigFromHook,
|
|
||||||
} from "../../soul-evil.js";
|
|
||||||
|
|
||||||
const HOOK_KEY = "soul-evil";
|
const HOOK_KEY = "soul-evil";
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user