mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-06 01:11:37 +00:00
feat: add CLI-server protocol version mismatch detection
- Define PROTOCOL_VERSION constant in shared/src/version.ts - Server sets X-Hapi-Protocol-Version header on /cli/* responses - Server includes protocolVersion in /health endpoint - CLI extracts serverProtocolVersion from API responses - CLI shows version mismatch hints in both directions - Add tests for error utilities and version extraction close #104
This commit is contained in:
@@ -5,6 +5,7 @@ import axios from 'axios'
|
||||
import type { ZodType } from 'zod'
|
||||
import { logger } from '@/ui/logger'
|
||||
import { backoff } from '@/utils/time'
|
||||
import { apiValidationError } from '@/utils/errorUtils'
|
||||
import { AsyncLock } from '@/utils/lock'
|
||||
import type { RawJSONLines } from '@/claude/types'
|
||||
import { configuration } from '@/configuration'
|
||||
@@ -281,7 +282,7 @@ export class ApiSessionClient extends EventEmitter {
|
||||
|
||||
const parsed = CliMessagesResponseSchema.safeParse(response.data)
|
||||
if (!parsed.success) {
|
||||
throw new Error('Invalid /cli/sessions/:id/messages response')
|
||||
throw apiValidationError('Invalid /cli/sessions/:id/messages response', response)
|
||||
}
|
||||
|
||||
const messages = parsed.data.messages
|
||||
|
||||
Reference in New Issue
Block a user