mirror of
https://github.com/deepseek-ai/deepseek-harness.git
synced 2026-09-14 04:01:35 +00:00
35 lines
1.5 KiB
TypeScript
35 lines
1.5 KiB
TypeScript
/**
|
|
* RPC method registry and signature-derived generics. Map keys are the wire
|
|
* path segments of API Proxy unary calls.
|
|
*/
|
|
|
|
import type { HostApi } from './host.ts'
|
|
import type { AgentPresetsApi } from './agent-presets.ts'
|
|
import type { SkillsApi } from './skills.ts'
|
|
import type { SettingsApi } from './settings.ts'
|
|
import type { LlmApi } from './llm.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; the carrier passes its request signal, never a wire field.
|
|
*/
|
|
export interface RpcMethodMap {
|
|
'host.describe': HostApi['describe']
|
|
'host.openPath': HostApi['openPath']
|
|
'skill.list': SkillsApi['list']
|
|
'agentPreset.openDocument': AgentPresetsApi['openDocument']
|
|
'settings.openDocument': SettingsApi['openDocument']
|
|
'llm.providers': LlmApi['providers']
|
|
'llm.models': LlmApi['models']
|
|
'llm.discoverModels': LlmApi['discoverModels']
|
|
}
|
|
|
|
/** 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
|