index.ts 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /**
  2. * apiproxy contract-layer barrel. api/ has zero Node dependencies and is
  3. * importable from the browser; the TS interfaces are the authoritative contract, while HTTP,
  4. * WebSocket, and in-process SSE are merely physical channels (four-quadrant message model).
  5. */
  6. import type { SessionsApi } from './sessions.ts'
  7. import type { HostApi } from './host.ts'
  8. import type { WorkspaceApi } from './workspace.ts'
  9. import type { AgentPresetsApi } from './agent-presets.ts'
  10. import type { SkillsApi } from './skills.ts'
  11. import type { SubagentsApi } from './subagents.ts'
  12. import type { EventsApi } from './events.ts'
  13. import type { GoalsApi } from './goals.ts'
  14. import type { SettingsApi } from './settings.ts'
  15. import type { CredentialsApi } from './credentials.ts'
  16. import type { LlmApi } from './llm.ts'
  17. import type { DownloadsApi } from './downloads.ts'
  18. import type { ClientResponse, RpcReceipt } from './rpc.ts'
  19. /** Root interface of the unified API. New client-request domain = one new file pair + one field here + one map row. */
  20. export interface ApiProxy {
  21. sessions: SessionsApi
  22. subagents: SubagentsApi
  23. host: HostApi
  24. workspace: WorkspaceApi
  25. skills: SkillsApi
  26. agentPresets: AgentPresetsApi
  27. events: EventsApi
  28. goals: GoalsApi
  29. settings: SettingsApi
  30. credentials: CredentialsApi
  31. llm: LlmApi
  32. /** Host-only download surfaces (GET, no wire envelope); absent from IApiClient. */
  33. downloads: DownloadsApi
  34. /**
  35. * Response entry for server requests; not a domain method.
  36. * @param message - Client response carrying the server request's rpcId.
  37. * @returns Transport receipt for the response delivery.
  38. */
  39. respond(message: ClientResponse): Promise<RpcReceipt>
  40. }
  41. // ---- Domain interfaces and payload entities ----
  42. export type {
  43. HistoryEntry, ModelCatalogFailure, ModelCatalogModel, ModelProviderGroup, ModelReasoning,
  44. ModelReasoningEffort, ModelSelection, PromptContentPart, QueueAction, SessionModels,
  45. SessionListMetadata, SessionProjectionsBlock, SessionSearchItem, SessionsApi, SessionSummary,
  46. } from './sessions.ts'
  47. export type { DirectoryEntry, DirectoryListing, HostApi } from './host.ts'
  48. export type {
  49. SubagentAddress, SubagentCatalog, SubagentInterruptReceipt, SubagentListEntry,
  50. SubagentPromptReceipt, SubagentsApi,
  51. } from './subagents.ts'
  52. export type { JobView } from './jobs.ts'
  53. export type { WorkspaceApi, WorkspaceId, WorkspaceView } from './workspace.ts'
  54. export type { SkillsApi, SkillEntry } from './skills.ts'
  55. export type { AgentPresetsApi, AgentPresetEntry } from './agent-presets.ts'
  56. export type { EventsApi, MuxFrame, HostFrame, QueuedInboxItem, ToolCallView, ToolEventView, ToolResultView } from './events.ts'
  57. export type { GoalsApi, GoalId, GoalRef } from './goals.ts'
  58. export type { SettingsApi, SettingsNamespaceView, SettingsPathOpView, SettingsSecretView } from './settings.ts'
  59. export type { CredentialsApi, CredentialView } from './credentials.ts'
  60. export type { ConfigurableProviderView, DiscoveredModelView, LlmApi } from './llm.ts'
  61. export type { DownloadsApi } from './downloads.ts'
  62. export type { ApprovalResponsePayload } from './approvals.ts'
  63. export type { QuestionResponsePayload } from './questions.ts'
  64. // ---- Message layer: narrow forms (domain-signature view) ----
  65. export type { RpcRequest, RpcResponse } from './rpc.ts'
  66. // ---- Message layer: the four wire full forms + carrier receipt ----
  67. export type {
  68. ClientRequest,
  69. ClientResponse,
  70. RpcMessage,
  71. RpcReceipt,
  72. ServerRequest,
  73. ServerResponse,
  74. } from './rpc.ts'
  75. // ---- Errors and ids ----
  76. export { RpcId, transportError } from './rpc.ts'
  77. export type { RpcError, RpcErrorCode, RpcErrorDetailsMap, RpcResult } from './rpc.ts'
  78. export {
  79. clientRequestSchema,
  80. serverRequestSchema,
  81. serverResponseSchema,
  82. } from './rpc.schema.ts'
  83. // ---- Fixed session-search product bounds ----
  84. export {
  85. SESSION_SEARCH_RESULT_LIMIT,
  86. SESSION_SEARCH_SNIPPET_MAX_CODE_POINTS,
  87. } from './session-search.ts'
  88. // ---- Method registry and derived generics ----
  89. export type { RequestPayload, ResponseValue, RpcMethodMap } from './rpc-map.ts'