style: oxfmt core files
This commit is contained in:
@@ -72,8 +72,7 @@ function collectToolFailures(messages: AgentMessage[]): ToolFailure[] {
|
||||
isError?: unknown;
|
||||
};
|
||||
if (toolResult.isError !== true) continue;
|
||||
const toolCallId =
|
||||
typeof toolResult.toolCallId === "string" ? toolResult.toolCallId : "";
|
||||
const toolCallId = typeof toolResult.toolCallId === "string" ? toolResult.toolCallId : "";
|
||||
if (!toolCallId || seen.has(toolCallId)) continue;
|
||||
seen.add(toolCallId);
|
||||
|
||||
|
||||
@@ -15,7 +15,9 @@ function isPrimitive(value: unknown): value is string | number | boolean | bigin
|
||||
function normalizeForHash(value: unknown): unknown {
|
||||
if (value === undefined) return undefined;
|
||||
if (Array.isArray(value)) {
|
||||
const normalized = value.map(normalizeForHash).filter((item): item is unknown => item !== undefined);
|
||||
const normalized = value
|
||||
.map(normalizeForHash)
|
||||
.filter((item): item is unknown => item !== undefined);
|
||||
const primitives = normalized.filter(isPrimitive);
|
||||
if (primitives.length === normalized.length) {
|
||||
return [...primitives].sort((a, b) => String(a).localeCompare(String(b)));
|
||||
|
||||
@@ -256,8 +256,7 @@ export async function ensureSandboxContainer(params: {
|
||||
registryEntry = registry.entries.find((entry) => entry.containerName === containerName);
|
||||
currentHash = await readContainerConfigHash(containerName);
|
||||
if (!currentHash) {
|
||||
currentHash =
|
||||
registryEntry?.configHash ?? null;
|
||||
currentHash = registryEntry?.configHash ?? null;
|
||||
}
|
||||
hashMismatch = !currentHash || currentHash !== expectedHash;
|
||||
if (hashMismatch) {
|
||||
@@ -296,7 +295,7 @@ export async function ensureSandboxContainer(params: {
|
||||
createdAtMs: now,
|
||||
lastUsedAtMs: now,
|
||||
image: params.cfg.docker.image,
|
||||
configHash: hashMismatch && running ? currentHash ?? undefined : expectedHash,
|
||||
configHash: hashMismatch && running ? (currentHash ?? undefined) : expectedHash,
|
||||
});
|
||||
return containerName;
|
||||
}
|
||||
|
||||
@@ -6,12 +6,7 @@ import { sessionsCommand } from "../../commands/sessions.js";
|
||||
import { statusCommand } from "../../commands/status.js";
|
||||
import { setVerbose } from "../../globals.js";
|
||||
import { defaultRuntime } from "../../runtime.js";
|
||||
import {
|
||||
getFlagValue,
|
||||
getPositiveIntFlagValue,
|
||||
getVerboseFlag,
|
||||
hasFlag,
|
||||
} from "../argv.js";
|
||||
import { getFlagValue, getPositiveIntFlagValue, getVerboseFlag, hasFlag } from "../argv.js";
|
||||
import { registerBrowserCli } from "../browser-cli.js";
|
||||
import { registerConfigCli } from "../config-cli.js";
|
||||
import { registerMemoryCli, runMemoryStatus } from "../memory-cli.js";
|
||||
|
||||
@@ -139,10 +139,12 @@ export const AgentDefaultsSchema = z
|
||||
model: z
|
||||
.union([
|
||||
z.string(),
|
||||
z.object({
|
||||
z
|
||||
.object({
|
||||
primary: z.string().optional(),
|
||||
fallbacks: z.array(z.string()).optional(),
|
||||
}).strict(),
|
||||
})
|
||||
.strict(),
|
||||
])
|
||||
.optional(),
|
||||
})
|
||||
|
||||
@@ -67,10 +67,12 @@ export const SandboxDockerSchema = z
|
||||
z.union([
|
||||
z.string(),
|
||||
z.number(),
|
||||
z.object({
|
||||
z
|
||||
.object({
|
||||
soft: z.number().int().nonnegative().optional(),
|
||||
hard: z.number().int().nonnegative().optional(),
|
||||
}).strict(),
|
||||
})
|
||||
.strict(),
|
||||
]),
|
||||
)
|
||||
.optional(),
|
||||
@@ -351,10 +353,12 @@ export const AgentEntrySchema = z
|
||||
model: z
|
||||
.union([
|
||||
z.string(),
|
||||
z.object({
|
||||
z
|
||||
.object({
|
||||
primary: z.string().optional(),
|
||||
fallbacks: z.array(z.string()).optional(),
|
||||
}).strict(),
|
||||
})
|
||||
.strict(),
|
||||
])
|
||||
.optional(),
|
||||
})
|
||||
@@ -362,7 +366,7 @@ export const AgentEntrySchema = z
|
||||
.optional(),
|
||||
sandbox: AgentSandboxSchema,
|
||||
tools: AgentToolsSchema,
|
||||
})
|
||||
})
|
||||
.strict();
|
||||
|
||||
export const ToolsSchema = z
|
||||
|
||||
@@ -41,7 +41,7 @@ export const ModelDefinitionSchema = z
|
||||
maxTokens: z.number().positive(),
|
||||
headers: z.record(z.string(), z.string()).optional(),
|
||||
compat: ModelCompatSchema,
|
||||
})
|
||||
})
|
||||
.strict();
|
||||
|
||||
export const ModelProviderSchema = z
|
||||
@@ -52,7 +52,7 @@ export const ModelProviderSchema = z
|
||||
headers: z.record(z.string(), z.string()).optional(),
|
||||
authHeader: z.boolean().optional(),
|
||||
models: z.array(ModelDefinitionSchema),
|
||||
})
|
||||
})
|
||||
.strict();
|
||||
|
||||
export const ModelsConfigSchema = z
|
||||
@@ -151,7 +151,9 @@ export const CliBackendSchema = z
|
||||
sessionArg: z.string().optional(),
|
||||
sessionArgs: z.array(z.string()).optional(),
|
||||
resumeArgs: z.array(z.string()).optional(),
|
||||
sessionMode: z.union([z.literal("always"), z.literal("existing"), z.literal("none")]).optional(),
|
||||
sessionMode: z
|
||||
.union([z.literal("always"), z.literal("existing"), z.literal("none")])
|
||||
.optional(),
|
||||
sessionIdFields: z.array(z.string()).optional(),
|
||||
systemPromptArg: z.string().optional(),
|
||||
systemPromptMode: z.union([z.literal("append"), z.literal("replace")]).optional(),
|
||||
|
||||
@@ -118,7 +118,7 @@ export const TelegramAccountSchemaBase = z
|
||||
.optional(),
|
||||
reactionNotifications: z.enum(["off", "own", "all"]).optional(),
|
||||
reactionLevel: z.enum(["off", "ack", "minimal", "extensive"]).optional(),
|
||||
})
|
||||
})
|
||||
.strict();
|
||||
|
||||
export const TelegramAccountSchema = TelegramAccountSchemaBase.superRefine((value, ctx) => {
|
||||
@@ -234,7 +234,7 @@ export const DiscordAccountSchema = z
|
||||
replyToMode: ReplyToModeSchema.optional(),
|
||||
dm: DiscordDmSchema.optional(),
|
||||
guilds: z.record(z.string(), DiscordGuildSchema.optional()).optional(),
|
||||
})
|
||||
})
|
||||
.strict();
|
||||
|
||||
export const DiscordConfigSchema = DiscordAccountSchema.extend({
|
||||
@@ -332,7 +332,7 @@ export const SlackAccountSchema = z
|
||||
.optional(),
|
||||
dm: SlackDmSchema.optional(),
|
||||
channels: z.record(z.string(), SlackChannelSchema.optional()).optional(),
|
||||
})
|
||||
})
|
||||
.strict();
|
||||
|
||||
export const SlackConfigSchema = SlackAccountSchema.extend({
|
||||
@@ -396,7 +396,7 @@ export const SignalAccountSchemaBase = z
|
||||
mediaMaxMb: z.number().int().positive().optional(),
|
||||
reactionNotifications: z.enum(["off", "own", "all", "allowlist"]).optional(),
|
||||
reactionAllowlist: z.array(z.union([z.string(), z.number()])).optional(),
|
||||
})
|
||||
})
|
||||
.strict();
|
||||
|
||||
export const SignalAccountSchema = SignalAccountSchemaBase.superRefine((value, ctx) => {
|
||||
@@ -455,7 +455,7 @@ export const IMessageAccountSchemaBase = z
|
||||
.optional(),
|
||||
)
|
||||
.optional(),
|
||||
})
|
||||
})
|
||||
.strict();
|
||||
|
||||
export const IMessageAccountSchema = IMessageAccountSchemaBase.superRefine((value, ctx) => {
|
||||
|
||||
@@ -429,9 +429,7 @@ async function migrateLegacySessions(
|
||||
await saveSessionStore(detected.sessions.targetStorePath, normalized);
|
||||
changes.push(`Merged sessions store → ${detected.sessions.targetStorePath}`);
|
||||
if (canonicalizedTarget.legacyKeys.length > 0) {
|
||||
changes.push(
|
||||
`Canonicalized ${canonicalizedTarget.legacyKeys.length} legacy session key(s)`,
|
||||
);
|
||||
changes.push(`Canonicalized ${canonicalizedTarget.legacyKeys.length} legacy session key(s)`);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user