mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:50:43 +00:00
extensions/acpx: align probeAgent with current config surface
Keep the acpx runtime type shim compatible with upstream probeAgent support and de-duplicate the rebased config/service wiring against current main. Normalize probeAgent the same way agent registry keys are normalized so mixed-case config resolves consistently. Refs #68409
This commit is contained in:
1
extensions/acpx/src/acpx-runtime-compat.d.ts
vendored
1
extensions/acpx/src/acpx-runtime-compat.d.ts
vendored
@@ -30,6 +30,7 @@ declare module "acpx/runtime" {
|
||||
permissionMode?: unknown;
|
||||
nonInteractivePermissions?: unknown;
|
||||
timeoutMs?: number;
|
||||
probeAgent?: string;
|
||||
};
|
||||
|
||||
export class AcpxRuntime {
|
||||
|
||||
@@ -34,7 +34,6 @@ export type AcpxPluginConfig = {
|
||||
strictWindowsCmdWrapper?: boolean;
|
||||
timeoutSeconds?: number;
|
||||
queueOwnerTtlSeconds?: number;
|
||||
probeAgent?: string;
|
||||
mcpServers?: Record<string, McpServerConfig>;
|
||||
agents?: Record<string, { command: string }>;
|
||||
};
|
||||
@@ -50,7 +49,6 @@ export type ResolvedAcpxPluginConfig = {
|
||||
strictWindowsCmdWrapper: boolean;
|
||||
timeoutSeconds?: number;
|
||||
queueOwnerTtlSeconds: number;
|
||||
probeAgent?: string;
|
||||
legacyCompatibilityConfig: {
|
||||
strictWindowsCmdWrapper?: boolean;
|
||||
queueOwnerTtlSeconds?: number;
|
||||
@@ -109,7 +107,6 @@ export const AcpxPluginConfigSchema = z.strictObject({
|
||||
.number({ error: "queueOwnerTtlSeconds must be a number >= 0" })
|
||||
.min(0, { error: "queueOwnerTtlSeconds must be a number >= 0" })
|
||||
.optional(),
|
||||
probeAgent: nonEmptyTrimmedString("probeAgent must be a non-empty string").optional(),
|
||||
mcpServers: z.record(z.string(), McpServerConfigSchema).optional(),
|
||||
agents: z
|
||||
.record(
|
||||
|
||||
@@ -260,12 +260,16 @@ export function resolveAcpxPluginConfig(params: {
|
||||
]),
|
||||
);
|
||||
|
||||
const probeAgent = normalized.probeAgent?.trim();
|
||||
// Lowercase probeAgent so lookups match the registry keys built above, which
|
||||
// also go through normalizeLowercaseStringOrEmpty. Without this, a user who
|
||||
// writes `probeAgent: "OpenCode"` would silently miss the stored "opencode"
|
||||
// key.
|
||||
const probeAgent = normalizeLowercaseStringOrEmpty(normalized.probeAgent) || undefined;
|
||||
|
||||
return {
|
||||
cwd,
|
||||
stateDir,
|
||||
probeAgent: normalized.probeAgent,
|
||||
probeAgent,
|
||||
permissionMode: normalized.permissionMode ?? DEFAULT_PERMISSION_MODE,
|
||||
nonInteractivePermissions:
|
||||
normalized.nonInteractivePermissions ?? DEFAULT_NON_INTERACTIVE_POLICY,
|
||||
@@ -275,7 +279,6 @@ export function resolveAcpxPluginConfig(params: {
|
||||
normalized.strictWindowsCmdWrapper ?? DEFAULT_STRICT_WINDOWS_CMD_WRAPPER,
|
||||
timeoutSeconds: normalized.timeoutSeconds ?? DEFAULT_ACPX_TIMEOUT_SECONDS,
|
||||
queueOwnerTtlSeconds: normalized.queueOwnerTtlSeconds ?? DEFAULT_QUEUE_OWNER_TTL_SECONDS,
|
||||
probeAgent: probeAgent && probeAgent.length > 0 ? probeAgent : undefined,
|
||||
legacyCompatibilityConfig: {
|
||||
strictWindowsCmdWrapper: normalized.strictWindowsCmdWrapper,
|
||||
queueOwnerTtlSeconds: normalized.queueOwnerTtlSeconds,
|
||||
|
||||
@@ -53,7 +53,6 @@ function createDefaultRuntime(params: AcpxRuntimeFactoryParams): AcpxRuntimeLike
|
||||
mcpServers: toAcpMcpServers(params.pluginConfig.mcpServers),
|
||||
permissionMode: params.pluginConfig.permissionMode,
|
||||
nonInteractivePermissions: params.pluginConfig.nonInteractivePermissions,
|
||||
probeAgent: params.pluginConfig.probeAgent,
|
||||
timeoutMs:
|
||||
params.pluginConfig.timeoutSeconds != null
|
||||
? params.pluginConfig.timeoutSeconds * 1_000
|
||||
|
||||
Reference in New Issue
Block a user