mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-25 05:07:05 +00:00
refactor: migrate socket types and payloads to shared protocol package
Move socket-related type definitions and schemas from cli and server packages into a shared @hapi/protocol package for centralized type management. This includes migrating Update types, socket event interfaces (ClientToServerEvents, ServerToClientEvents), and terminal payload schemas. Add strongly-typed socket handlers that reference the protocol package instead of duplicating definitions.
This commit is contained in:
@@ -8,17 +8,21 @@ import { backoff } from '@/utils/time'
|
||||
import { AsyncLock } from '@/utils/lock'
|
||||
import type { RawJSONLines } from '@/claude/types'
|
||||
import { configuration } from '@/configuration'
|
||||
import type { ClientToServerEvents, ServerToClientEvents, Update } from '@hapi/protocol'
|
||||
import {
|
||||
TerminalClosePayloadSchema,
|
||||
TerminalOpenPayloadSchema,
|
||||
TerminalResizePayloadSchema,
|
||||
TerminalWritePayloadSchema
|
||||
} from '@hapi/protocol'
|
||||
import type {
|
||||
AgentState,
|
||||
ClientToServerEvents,
|
||||
MessageContent,
|
||||
MessageMeta,
|
||||
Metadata,
|
||||
ServerToClientEvents,
|
||||
Session,
|
||||
SessionModelMode,
|
||||
SessionPermissionMode,
|
||||
Update,
|
||||
UserMessage
|
||||
} from './types'
|
||||
import { AgentStateSchema, CliMessagesResponseSchema, MetadataSchema, UserMessageSchema } from './types'
|
||||
@@ -26,12 +30,6 @@ import { RpcHandlerManager } from './rpc/RpcHandlerManager'
|
||||
import { registerCommonHandlers } from '../modules/common/registerCommonHandlers'
|
||||
import { cleanupUploadDir } from '../modules/common/handlers/uploads'
|
||||
import { TerminalManager } from '@/terminal/TerminalManager'
|
||||
import {
|
||||
TerminalClosePayloadSchema,
|
||||
TerminalOpenPayloadSchema,
|
||||
TerminalResizePayloadSchema,
|
||||
TerminalWritePayloadSchema
|
||||
} from '@/terminal/types'
|
||||
import { applyVersionedAck } from './versionedUpdate'
|
||||
|
||||
export class ApiSessionClient extends EventEmitter {
|
||||
|
||||
Reference in New Issue
Block a user