mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-08 07:17:39 +00:00
feat(cli): add skill_lookup MCP for non-native agents (#1035)
* test: reproduce issue #752 * fix: expose skill lookup MCP tool (closes #752) * test: cover ACP skill lookup instructions * fix: inject ACP skill lookup instruction * test: narrow skill lookup auto-approval * fix: restrict skill lookup auto-approval * test: cover exact skill lookup tool names
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import { resolveToolAutoApprovalDecision } from './BasePermissionHandler'
|
||||
|
||||
describe('resolveToolAutoApprovalDecision skill_lookup', () => {
|
||||
it.each([
|
||||
'skill_lookup',
|
||||
'hapi_skill_lookup',
|
||||
'happy__skill_lookup',
|
||||
'mcp__hapi__skill_lookup'
|
||||
])('auto-approves the exact read-only HAPI tool name %s', (toolName) => {
|
||||
expect(resolveToolAutoApprovalDecision(
|
||||
'default',
|
||||
toolName,
|
||||
'call-1'
|
||||
)).toBe('approved')
|
||||
})
|
||||
|
||||
it('does not approve another tool solely from a skill-looking call id', () => {
|
||||
expect(resolveToolAutoApprovalDecision(
|
||||
'default',
|
||||
'dangerous_tool',
|
||||
'skill_lookup-forged-id'
|
||||
)).toBeNull()
|
||||
})
|
||||
|
||||
it('does not approve another tool whose name only contains skill_lookup', () => {
|
||||
expect(resolveToolAutoApprovalDecision(
|
||||
'default',
|
||||
'skill_lookup_write_file',
|
||||
'call-1'
|
||||
)).toBeNull()
|
||||
expect(resolveToolAutoApprovalDecision(
|
||||
'default',
|
||||
'dangerous_skill_lookup',
|
||||
'call-2'
|
||||
)).toBeNull()
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user