feat: support normalizing coordinate spaces

This commit is contained in:
Zoe
2026-09-19 18:23:51 -05:00
parent c49f228847
commit 5389d4541c
9 changed files with 85 additions and 15 deletions
+7 -2
View File
@@ -1,9 +1,9 @@
import { test } from "node:test";
import assert from "node:assert/strict";
import { complete } from "../src/model.js";
import { desktopArguments, shellArguments } from "../src/tools.js";
import { desktopArguments, shellArguments, toolsForCoordinates } from "../src/tools.js";
const config = { llamaCppOrigin: "http://example.test", modelId: "test", databasePath: ":memory:" };
const config: import("../src/config.js").Config = { coordinateSpace: "pixels", llamaCppOrigin: "http://example.test", modelId: "test", databasePath: ":memory:" };
test("adapter accepts tool calls and rejects truncated responses", async (t) => {
let finish = "tool_calls";
@@ -19,6 +19,11 @@ test("adapter accepts tool calls and rejects truncated responses", async (t) =>
await assert.rejects(complete(config, [], []), /incomplete/);
});
test("tool descriptions advertise the configured coordinate convention", () => {
assert.match(toolsForCoordinates("normalized_1000")[0]?.function.description ?? "", /0\.\.1000/);
assert.match(toolsForCoordinates("pixels")[0]?.function.description ?? "", /not normalized/);
});
test("tool inputs reject invalid commands, bounds, and action names", () => {
assert.throws(() => shellArguments.parse({ command: "", timeoutSeconds: 1 }));
assert.throws(() => shellArguments.parse({ command: "true", timeoutSeconds: 999 }));