| 1 | import type { Service } from '@deepseek-ai/cordis' |
| 2 | import type { DshService } from '../protocol.generated.ts' |
| 3 | import type { OwnerRecord, ToolInvocation } from '../root.ts' |
| 4 | import type { RpcPeer } from '../rpc.ts' |
| 5 | import type { HostTier } from '../tier.ts' |
| 6 | import { sessionsAdapter, systemPromptAdapter } from './session-prompt.ts' |
| 7 | import { DSH_AGENT_ADAPTERS } from './agents.ts' |
| 8 | import { remoteAdapter } from './remote.ts' |
| 9 | import { workspaceAdapter } from './workspace.ts' |
| 10 | import { llmAdapter } from './llm.ts' |
| 11 | import { credentialsAdapter } from './network.ts' |
| 12 | import { settingsAdapter } from './settings.ts' |
| 13 | import { pluginManagerAdapter, deepseekAccountAdapter } from './catalog.ts' |
| 14 | import { terminalAdapter } from './terminal.ts' |
| 15 | import { attachmentsAdapter } from './attachments.ts' |
| 16 | import { DSH_HOST_SERVICE_ADAPTERS } from './host-services.ts' |
| 17 | import { DSH_WEBSERVER_ADAPTERS } from './webserver.ts' |
| 18 | export { BUILTIN_DSH_ADAPTERS } from './plugin-manager.ts' |
| 19 | |
| 20 | export interface AdapterHost { |
| 21 | readonly tier: HostTier |
| 22 | readonly rpc: RpcPeer |
| 23 | ownerOf(ctx: unknown): OwnerRecord | undefined |
| 24 | liveInvocation(ctx: unknown): ToolInvocation | undefined |
| 25 | brokerTicket(ctx: unknown, service: DshService): { invocation: ToolInvocation, ticket: string } |
| 26 | broker(ctx: unknown, service: DshService, method: string, input: unknown, signal?: AbortSignal): Promise<unknown> |
| 27 | registerPromptSection?(ctx: unknown, section: { id: string, text: string }): () => void |
| 28 | log(level: 'info' | 'warn' | 'error', message: string, owner?: OwnerRecord): void |
| 29 | } |
| 30 | |
| 31 | export interface DshAdapter { |
| 32 | readonly service: string |
| 33 | define(host: AdapterHost): new (ctx: any) => Service |
| 34 | } |
| 35 | |
| 36 | export const DSH_ADAPTERS: readonly DshAdapter[] = [ |
| 37 | sessionsAdapter, |
| 38 | systemPromptAdapter, |
| 39 | ...DSH_AGENT_ADAPTERS, |
| 40 | remoteAdapter, |
| 41 | workspaceAdapter, |
| 42 | llmAdapter, |
| 43 | credentialsAdapter, |
| 44 | settingsAdapter, |
| 45 | pluginManagerAdapter, |
| 46 | deepseekAccountAdapter, |
| 47 | terminalAdapter, |
| 48 | attachmentsAdapter, |
| 49 | ...DSH_HOST_SERVICE_ADAPTERS, |
| 50 | ...DSH_WEBSERVER_ADAPTERS, |
| 51 | ] |
| 52 |