mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-02 06:33:05 +00:00
test(server): a patch key is resolved against nested configured defaults
This commit is contained in:
@@ -58,6 +58,7 @@ import type {
|
||||
} from "./agent-sdk-types.js";
|
||||
import type { PaseoToolCatalog } from "./tools/types.js";
|
||||
import type { ProviderDefinition } from "./provider-registry.js";
|
||||
import { mergeProviderOptions } from "./provider-options.js";
|
||||
|
||||
const DESKTOP_OPEN_AGENT_TAB_LABEL = getOpenAgentTabLabel("desktop-client");
|
||||
const MOBILE_OPEN_AGENT_TAB_LABEL = getOpenAgentTabLabel("mobile-client");
|
||||
@@ -12785,6 +12786,38 @@ describe("agent options", () => {
|
||||
});
|
||||
});
|
||||
|
||||
test("a patch key is resolved against the configured defaults, merging nested objects", async () => {
|
||||
const workdir = mkdtempSync(join(tmpdir(), "agent-manager-options-"));
|
||||
const client = new OptionsClient();
|
||||
client.effectiveOptions = (own) =>
|
||||
mergeProviderOptions({ sandbox: { enabled: true, failIfUnavailable: true } }, own) ?? {};
|
||||
const manager = new AgentManager({
|
||||
clients: { codex: client },
|
||||
registry: new AgentStorage(join(workdir, "agents"), logger),
|
||||
logger,
|
||||
});
|
||||
const agent = await manager.createAgent({ provider: "codex", cwd: workdir }, undefined, {
|
||||
workspaceId: undefined,
|
||||
});
|
||||
|
||||
await manager.setAgentOptions(agent.id, {
|
||||
sandbox: { network: { allowedDomains: ["a.test"] } },
|
||||
});
|
||||
|
||||
expect(client.session?.applied).toEqual([
|
||||
{
|
||||
sandbox: {
|
||||
enabled: true,
|
||||
failIfUnavailable: true,
|
||||
network: { allowedDomains: ["a.test"] },
|
||||
},
|
||||
},
|
||||
]);
|
||||
expect(manager.getAgent(agent.id)?.config.providerOptions).toEqual({
|
||||
sandbox: { network: { allowedDomains: ["a.test"] } },
|
||||
});
|
||||
});
|
||||
|
||||
test("setAgentOptions sends a removal to the provider like any change, as the default it falls back to", async () => {
|
||||
const { manager, client, agentId } = await createOptionsAgent({ service_tier: "fast" });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user