mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
feat(codex): support slash controls and skill discovery (#545)
* feat(codex): resolve slash controls before sending to Codex * feat(codex): discover commands and skills * fix(codex): handle slash commands before attachments * fix(codex): block remaining unsupported built-ins
This commit is contained in:
@@ -2,14 +2,19 @@ import { describe, expect, it } from 'vitest'
|
||||
import { findUnsupportedCodexBuiltinSlashCommand, getBuiltinSlashCommands } from './codexSlashCommands'
|
||||
|
||||
describe('getBuiltinSlashCommands', () => {
|
||||
it('does not expose codex built-ins in remote web mode', () => {
|
||||
expect(getBuiltinSlashCommands('codex')).toEqual([])
|
||||
it('exposes HAPI-supported codex built-ins in remote web mode', () => {
|
||||
expect(getBuiltinSlashCommands('codex').map((command) => command.name)).toEqual(expect.arrayContaining([
|
||||
'plan',
|
||||
'status',
|
||||
'execute',
|
||||
'effort',
|
||||
'permission',
|
||||
]))
|
||||
})
|
||||
})
|
||||
|
||||
describe('findUnsupportedCodexBuiltinSlashCommand', () => {
|
||||
it('detects unsupported codex built-ins', () => {
|
||||
expect(findUnsupportedCodexBuiltinSlashCommand('/status', [])).toBe('status')
|
||||
expect(findUnsupportedCodexBuiltinSlashCommand(' /diff ', [])).toBe('diff')
|
||||
})
|
||||
|
||||
|
||||
@@ -11,9 +11,18 @@ const BUILTIN_COMMANDS: Record<string, SlashCommand[]> = {
|
||||
{ name: 'stats', description: 'Show your Claude Code usage statistics and activity', source: 'builtin' },
|
||||
{ name: 'status', description: 'Show Claude Code status including version, model, account, and API connectivity', source: 'builtin' },
|
||||
],
|
||||
// Codex remote turns send slash-prefixed input as plain text to app-server.
|
||||
// Hide built-ins here until remote slash command execution is implemented end-to-end.
|
||||
codex: [],
|
||||
codex: [
|
||||
{ name: 'help', description: 'Show supported HAPI Codex slash commands', source: 'builtin' },
|
||||
{ name: 'plan', description: 'Enable plan mode; use /plan off to return to default', source: 'builtin' },
|
||||
{ name: 'default', description: 'Return Codex collaboration mode to default', source: 'builtin' },
|
||||
{ name: 'execute', description: 'Return Codex collaboration mode to default', source: 'builtin' },
|
||||
{ name: 'status', description: 'Show current Codex session config', source: 'builtin' },
|
||||
{ name: 'model', description: 'Show or set Codex model, e.g. /model gpt-5.5', source: 'builtin' },
|
||||
{ name: 'reasoning', description: 'Show or set reasoning effort', source: 'builtin' },
|
||||
{ name: 'effort', description: 'Alias for /reasoning', source: 'builtin' },
|
||||
{ name: 'permissions', description: 'Show or set permission mode', source: 'builtin' },
|
||||
{ name: 'permission', description: 'Alias for /permissions', source: 'builtin' },
|
||||
],
|
||||
gemini: [
|
||||
{ name: 'about', description: 'Show version info', source: 'builtin' },
|
||||
{ name: 'clear', description: 'Clear the screen and conversation history', source: 'builtin' },
|
||||
@@ -29,7 +38,6 @@ const UNSUPPORTED_CODEX_BUILTIN_COMMANDS = new Set([
|
||||
'compat',
|
||||
'undo',
|
||||
'diff',
|
||||
'status',
|
||||
])
|
||||
|
||||
export function getBuiltinSlashCommands(agentType: string): SlashCommand[] {
|
||||
|
||||
Reference in New Issue
Block a user