agy-cli 0.1.15: an array tool schema whose items live only on a sibling gets an items schema Gemini accepts (klarkxy #963)

Gemini refuses an array schema with no `items`. array-items.mjs infers
the items from the schema around it, or adds a permissive items schema 8
levels deep, without narrowing what the client allowed; tuple `items`
lists are left as they are, with a hint. Closes #962.

Reviewed head c7d3e7b8 (on c27ba5f7), landed onto main 738fd501 with the
version moved to 0.1.15 and package.json `files` keeping both
re2-pattern.mjs (#946) and array-items.mjs.
Run at the reviewed head: WSL2 bun test packages/agy-cli 9 of 9,
check.mjs ok; Windows 8 pass, 1 fail, the same smoke red as main (#973).
Broken by hand: without the ensureGeminiArrayItems call in normalizeTools
smoke.mjs reports 2 failures; PERMISSIVE_ARRAY_DEPTH = 1 and removing
`if (openArray) return null` each turn a test red.
Run at this commit (WSL2 Ubuntu 24.04, Bun 1.4.2, temp HOME): bun test
packages/agy-cli 10 of 10 pass; bun scripts/check.mjs agy-cli ok;
npm pack --dry-run lists 14 files, both new modules among them.
Not tried: macOS (mote refused ssh), a real agy.

Closes #963

Co-authored-by: klarkxy <klarkxy@users.noreply.github.com>
This commit is contained in:
yetone
2026-11-11 13:35:07 +08:00
co-authored by klarkxy
parent 738fd501d7
commit dbd082f6d1
7 changed files with 539 additions and 3 deletions
+3
View File
@@ -31,6 +31,7 @@ export const REPO_DIR = path.dirname(path.dirname(fileURLToPath(import.meta.url)
export const INDEX_FILE = process.env.AGY_BRIDGE_TEST_INDEX || path.join(REPO_DIR, "index.mjs")
export const USAGE_FILE = path.join(REPO_DIR, "usage.mjs")
export const PLATFORM_FILE = path.join(REPO_DIR, "platform.mjs")
export const ARRAY_ITEMS_FILE = path.join(REPO_DIR, "array-items.mjs")
export const LOGIN_FILE = path.join(REPO_DIR, "login.mjs")
export const RE2_PATTERN_FILE = path.join(REPO_DIR, "re2-pattern.mjs")
export const MESSAGES_URL = "agy://local/v1/messages"
@@ -487,6 +488,7 @@ export async function createBridgeKit(options = {}) {
const indexUrl = pathToFileURL(path.join(REPO_DIR, "index.mjs")).href
const usageUrl = pathToFileURL(USAGE_FILE).href
const platformUrl = pathToFileURL(PLATFORM_FILE).href
const arrayItemsUrl = pathToFileURL(ARRAY_ITEMS_FILE).href
const loginUrl = pathToFileURL(LOGIN_FILE).href
const re2Url = pathToFileURL(RE2_PATTERN_FILE).href
const linker = (specifier) => {
@@ -497,6 +499,7 @@ export async function createBridgeKit(options = {}) {
let module
if (key === "./usage.mjs") module = sourceModule(USAGE_FILE, "", usageUrl)
else if (key === "./platform.mjs") module = sourceModule(PLATFORM_FILE, "", platformUrl)
else if (key === "./array-items.mjs") module = sourceModule(ARRAY_ITEMS_FILE, "", arrayItemsUrl)
else if (key === "./login.mjs") module = sourceModule(LOGIN_FILE, "", loginUrl)
else if (key === "./re2-pattern.mjs") module = sourceModule(RE2_PATTERN_FILE, "", re2Url)
else if (key.startsWith("node:")) module = builtinModule(key, overrides[key])