@@ -33,6 +33,7 @@ test('full agent tool list flattens to QVAC-safe property schemas', async (t) =>
|
||||
const { bareAgentFlattenToolsForQvac, bareAgentToolDefinitions } = sandbox.__exports
|
||||
const flat = bareAgentFlattenToolsForQvac(bareAgentToolDefinitions())
|
||||
t.ok(flat.length > 20)
|
||||
t.ok(flat.some((x) => x.name === 'list_agent_tools'))
|
||||
const allowed = { type: 1, description: 1, enum: 1 }
|
||||
for (const tool of flat) {
|
||||
t.ok(tool.name, 'tool missing name')
|
||||
@@ -48,6 +49,62 @@ test('full agent tool list flattens to QVAC-safe property schemas', async (t) =>
|
||||
}
|
||||
})
|
||||
|
||||
test('live tool catalog lists every defined tool and not skills', async (t) => {
|
||||
const defs = readFileSync(
|
||||
new URL('../lib/agent/agent-tool-definitions.js', import.meta.url),
|
||||
'utf8'
|
||||
)
|
||||
const skills = readFileSync(
|
||||
new URL('../lib/agent/agent-skills.js', import.meta.url),
|
||||
'utf8'
|
||||
)
|
||||
const tui = readFileSync(
|
||||
new URL('../lib/agent/agent-tui.js', import.meta.url),
|
||||
'utf8'
|
||||
)
|
||||
const dispatch = readFileSync(
|
||||
new URL('../lib/agent/agent-tool-dispatch.js', import.meta.url),
|
||||
'utf8'
|
||||
)
|
||||
const sandbox = { console }
|
||||
vm.createContext(sandbox)
|
||||
vm.runInContext(
|
||||
defs +
|
||||
'\n;this.__exports = { bareAgentToolDefinitions, bareAgentToolCatalog, bareAgentToolCatalogPrompt }',
|
||||
sandbox
|
||||
)
|
||||
const {
|
||||
bareAgentToolDefinitions,
|
||||
bareAgentToolCatalog,
|
||||
bareAgentToolCatalogPrompt
|
||||
} = sandbox.__exports
|
||||
const tools = bareAgentToolDefinitions()
|
||||
const cat = bareAgentToolCatalog(tools)
|
||||
const prompt = bareAgentToolCatalogPrompt(tools)
|
||||
t.ok(cat.length >= 80)
|
||||
t.is(cat.length, tools.length)
|
||||
const names = cat.map((x) => x.name)
|
||||
t.ok(names.includes('read_file'))
|
||||
t.ok(names.includes('run_command'))
|
||||
t.ok(names.includes('write_file'))
|
||||
t.ok(names.includes('list_agent_tools'))
|
||||
t.ok(names.includes('discord_send_message'))
|
||||
t.ok(names.includes('task_complete'))
|
||||
t.absent(names.includes('ctx-api-change'))
|
||||
t.absent(names.includes('docs-contract-update'))
|
||||
t.absent(names.includes('ctx-baredoctor'))
|
||||
for (const n of names) {
|
||||
t.ok(prompt.includes(n), 'catalog prompt missing ' + n)
|
||||
t.ok(
|
||||
dispatch.includes("toolName === '" + n + "'") || n === 'remember',
|
||||
'dispatch missing ' + n
|
||||
)
|
||||
}
|
||||
t.ok(skills.includes('NOT callable tools'))
|
||||
t.ok(tui.includes('bareAgentToolCatalogPrompt()'))
|
||||
t.ok(tui.includes('bareAgentLooksLikeToolInventoryQuestion'))
|
||||
})
|
||||
|
||||
test('flatten OpenAI nested tools for QVAC', async (t) => {
|
||||
const { bareAgentFlattenToolsForQvac } = loadAgentQvacHelpers()
|
||||
const flat = bareAgentFlattenToolsForQvac([
|
||||
|
||||
Reference in New Issue
Block a user