test(skill): cover post-discovery disappearance
This commit is contained in:
@@ -211,7 +211,9 @@ describe('dsh-tool-skill', () => {
|
|||||||
content: 'User-only body.',
|
content: 'User-only body.',
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(await composePrefix(ctx, '/workspace')).toEqual([])
|
const agent = agentForCwd('/workspace')
|
||||||
|
expect(await composePrefixForAgent(ctx, agent)).toEqual([])
|
||||||
|
expect(await composePrefixForAgent(ctx, agent)).toEqual([])
|
||||||
})
|
})
|
||||||
|
|
||||||
it('omits catalog guidance when the calling agent restricts away the shipped skill tool', async () => {
|
it('omits catalog guidance when the calling agent restricts away the shipped skill tool', async () => {
|
||||||
@@ -412,10 +414,20 @@ describe('dsh-tool-skill', () => {
|
|||||||
rank: 1,
|
rank: 1,
|
||||||
locator: 'policy-race-skill',
|
locator: 'policy-race-skill',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'vanishing-skill',
|
||||||
|
description: 'Vanishing skill',
|
||||||
|
invocation: { modelInvocable: true, userInvocable: true },
|
||||||
|
provider: 'policy-probe',
|
||||||
|
source: 'test',
|
||||||
|
rank: 1,
|
||||||
|
locator: 'vanishing-skill',
|
||||||
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
async get(candidate) {
|
async get(candidate) {
|
||||||
getCalls.push(candidate.name)
|
getCalls.push(candidate.name)
|
||||||
|
if (candidate.name === 'vanishing-skill') return undefined
|
||||||
return {
|
return {
|
||||||
...candidate,
|
...candidate,
|
||||||
invocation: { modelInvocable: false, userInvocable: true },
|
invocation: { modelInvocable: false, userInvocable: true },
|
||||||
@@ -426,15 +438,20 @@ describe('dsh-tool-skill', () => {
|
|||||||
|
|
||||||
const denied = await ctx.tools.execute({ signal: testToolSignal, callId: CallId('c6'), name: 'skill', arguments: { name: 'denied-skill' } })
|
const denied = await ctx.tools.execute({ signal: testToolSignal, callId: CallId('c6'), name: 'skill', arguments: { name: 'denied-skill' } })
|
||||||
const raced = await ctx.tools.execute({ signal: testToolSignal, callId: CallId('c7'), name: 'skill', arguments: { name: 'policy-race-skill' } })
|
const raced = await ctx.tools.execute({ signal: testToolSignal, callId: CallId('c7'), name: 'skill', arguments: { name: 'policy-race-skill' } })
|
||||||
|
const vanished = await ctx.tools.execute({ signal: testToolSignal, callId: CallId('c8'), name: 'skill', arguments: { name: 'vanishing-skill' } })
|
||||||
|
|
||||||
expect(denied.isError).toBe(true)
|
expect(denied.isError).toBe(true)
|
||||||
expect(raced.isError).toBe(true)
|
expect(raced.isError).toBe(true)
|
||||||
expect(getCalls).toEqual(['policy-race-skill'])
|
expect(vanished.isError).toBe(true)
|
||||||
|
expect(getCalls).toEqual(['policy-race-skill', 'vanishing-skill'])
|
||||||
for (const result of [denied, raced]) {
|
for (const result of [denied, raced]) {
|
||||||
const block = result.content[0]
|
const block = result.content[0]
|
||||||
if (block?.type !== 'text') throw new Error('expected text tool result')
|
if (block?.type !== 'text') throw new Error('expected text tool result')
|
||||||
expect(block.text).toContain('is not available for model invocation')
|
expect(block.text).toContain('is not available for model invocation')
|
||||||
expect(block.text).not.toContain('Instructions must not be disclosed.')
|
expect(block.text).not.toContain('Instructions must not be disclosed.')
|
||||||
}
|
}
|
||||||
|
const vanishedBlock = vanished.content[0]
|
||||||
|
if (vanishedBlock?.type !== 'text') throw new Error('expected text tool result')
|
||||||
|
expect(vanishedBlock.text).toContain('skill "vanishing-skill" is unknown or no longer available')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user