fix(agent): raise tool rounds and ease calendar creates
CI / checks (push) Has been cancelled

Local models were burning the 8-round budget on simple event adds.
Raise the limit, resolve calendars by name/default, and inject the
household clock so relative dates work.
This commit is contained in:
ginnoir
2026-07-08 21:40:44 -05:00
parent ea371b8085
commit d3e79edb9e
7 changed files with 240 additions and 10 deletions
+30
View File
@@ -83,6 +83,36 @@ describe("runAgentChat", () => {
assert.equal(result.message.role, "assistant");
assert.ok(result.message.content.length > 0);
});
it("appends runtime clock context to the system prompt", async () => {
const original = process.env.HOUSEHOLD_TIMEZONE;
process.env.HOUSEHOLD_TIMEZONE = "America/Chicago";
let systemContent = "";
const result = await runAgentChat({
messages: [{ role: "user", content: "hello" }],
request: new Request("http://localhost:3000/api/agent/chat"),
systemPrompt: "You are a pirate.",
llm: {
async chatCompletion(request) {
const system = request.messages.find((message) => message.role === "system");
systemContent = typeof system?.content === "string" ? system.content : "";
return {
message: { role: "assistant", content: "Ahoy" },
finishReason: "stop",
};
},
},
});
assert.equal(result.message.content, "Ahoy");
assert.match(systemContent, /^You are a pirate\./);
assert.match(systemContent, /Current time:/);
assert.match(systemContent, /America\/Chicago/);
if (original === undefined) delete process.env.HOUSEHOLD_TIMEZONE;
else process.env.HOUSEHOLD_TIMEZONE = original;
});
});
it("passes a model override to the OpenAI-compatible client", async () => {