mirror of
https://github.com/deepseek-ai/deepseek-harness
synced 2026-08-15 21:04:50 +00:00
# Conflicts: # apps/web/tests/snapshots/question-composer/answered.expected.md # packages/client/connection/tests/fake-api.ts # packages/client/runtime/README.i18n.yaml # packages/client/runtime/tests/fake-api.ts # packages/client/ui-workspace/README.i18n.yaml # packages/client/ui-workspace/README.md # packages/client/ui-workspace/README.zh.md # packages/client/ui-workspace/src/client/WorkspaceBrowser.tsx # packages/client/ui-workspace/tests/apply.spec.ts # packages/host/apiproxy/README.i18n.yaml # packages/host/apiproxy/README.md # packages/host/apiproxy/README.zh.md # packages/host/apiproxy/src/api-proxy.ts # packages/host/apiproxy/src/api/index.ts # packages/host/apiproxy/src/api/sessions.schema.ts # packages/host/apiproxy/src/fetch/client.ts # packages/host/apiproxy/src/fetch/handler.ts # packages/host/apiproxy/tests/fetch-carrier.spec.ts # packages/host/apiproxy/tests/rpc-schemas.spec.ts # packages/session-query/session-query/tests/search-helpers.spec.ts
46 lines
2.0 KiB
TypeScript
46 lines
2.0 KiB
TypeScript
/**
|
|
* RPC method registry and signature-derived generics. The map
|
|
* registers only client-request methods (respond is a client-response, so it is absent);
|
|
* map keys are the wire path segments (POST /api/session.list).
|
|
*/
|
|
|
|
import type { SessionsApi } from './sessions.ts'
|
|
import type { HostApi } from './host.ts'
|
|
import type { WorkspaceApi } from './workspace.ts'
|
|
import type { CommandsApi } from './commands.ts'
|
|
import type { SkillsApi } from './skills.ts'
|
|
import type { RpcResponse } from './rpc.ts'
|
|
|
|
/**
|
|
* Method name → method signature. Signatures are the single source of truth; payload/value
|
|
* types are always derived from here. A method may declare a trailing AbortSignal after the
|
|
* request (command.execute): the carrier passes its request signal, never a wire field.
|
|
*/
|
|
export interface RpcMethodMap {
|
|
'session.list': SessionsApi['list']
|
|
'session.search': SessionsApi['search']
|
|
'session.create': SessionsApi['create']
|
|
'session.history': SessionsApi['history']
|
|
'session.models': SessionsApi['models']
|
|
'session.selectModel': SessionsApi['selectModel']
|
|
'session.prompt': SessionsApi['prompt']
|
|
'session.cancel': SessionsApi['cancel']
|
|
'host.describe': HostApi['describe']
|
|
'host.pickDirectory': HostApi['pickDirectory']
|
|
'workspace.list': WorkspaceApi['list']
|
|
'workspace.create': WorkspaceApi['create']
|
|
'workspace.rename': WorkspaceApi['rename']
|
|
'workspace.delete': WorkspaceApi['delete']
|
|
'workspace.insertSessionBefore': WorkspaceApi['insertSessionBefore']
|
|
'command.list': CommandsApi['list']
|
|
'command.execute': CommandsApi['execute']
|
|
'skill.list': SkillsApi['list']
|
|
}
|
|
|
|
/** Business request payload of method K (reaches through the RpcRequest narrow form to payload). */
|
|
export type RequestPayload<K extends keyof RpcMethodMap> = Parameters<RpcMethodMap[K]>[0]['payload']
|
|
|
|
/** Business return value of method K (reaches through the RpcResponse narrow form to infer the ok value of result). */
|
|
export type ResponseValue<K extends keyof RpcMethodMap> =
|
|
Awaited<ReturnType<RpcMethodMap[K]>> extends RpcResponse<infer T> ? T : never
|