import type { DshStorageDomainRuntime } from './handlers/custom-memory.js'; import { BridgeModelSelection } from './handlers/model-control.js'; import { DshQqBridgeConfig } from './config.js'; import { OnebotMessageEvent, PlatformReplyTarget } from './onebot/types.js'; import type { MessageTargetId } from './onebot/types.js'; import { InteractionCtxLike } from './interactions.js'; /** DSH live agent 最小画面。 */ interface DshAgent { followup(message: { id: string; role: string; content: unknown; source: unknown; }): void; whenIdle(): Promise; } /** 结构性描述 DSH 服务;不硬依赖 DSH 内部类型。 */ interface DshCtx extends InteractionCtxLike { agentLoop?: { createAgent(ownerCtx: unknown, options: { sessionId: string; agentOptions?: Record; meta?: { cwd?: string; agentPreset?: string; }; setup?: (agentCtx: unknown) => void | Promise; }): Promise<{ agent: DshAgent; dispose(): Promise; }>; }; agentPresets?: { mount(agentCtx: unknown, preset?: string): Promise; }; sessionQuery?: { readSurface(sessionId: string): Promise<{ events: readonly unknown[]; }>; }; workspaceRegistry?: DshWorkspaceRegistry; llm?: DshLlmRuntime; commands?: DshCommandRuntime; storageDomain?: DshStorageDomainRuntime; on?(event: 'session/event', cb: (subject: DshSessionSubject, event: unknown) => void, options?: { prepend?: boolean; }): () => void; on?(event: 'approval/request', cb: (...args: never[]) => unknown, options?: { prepend?: boolean; }): () => void; on?(event: string, cb: (...args: never[]) => unknown, options?: { prepend?: boolean; }): () => void; } interface DshLlmRuntime { listProviders?(): Array<{ id: string; name?: string; }>; listModels?(provider: string): Promise>; resolveModelInfo?(provider: string, model: string, signal?: AbortSignal): Promise<{ provider?: string; id?: string; name?: string; reasoning?: { efforts: ReadonlyArray<{ id: string; name?: string; description?: string; }>; defaultEffort?: string; }; }>; resolveCallConfig?(config: BridgeModelSelection, signal?: AbortSignal): Promise; } interface DshCommandRuntime { execute(agent: unknown, line: string, images: readonly unknown[], signal: AbortSignal): Promise; } export interface DshWorkspace { id?: string; attachSession(sessionId: string): Promise; } export interface DshWorkspaceRegistry { create(path: string): Promise; } interface DshSessionSubject { id?: string; header?: { origin?: string; }; events?: readonly unknown[]; } interface BridgeChatClient { connect(): Promise; onMessage(cb: (evt: OnebotMessageEvent) => void): () => void; sendPrivate(userId: MessageTargetId, message: string, replyTarget?: PlatformReplyTarget): Promise; sendPrivateAndWait?(userId: MessageTargetId, message: string, timeoutMs: number, uid: string): Promise; sendGroup(groupId: MessageTargetId, message: string, replyTarget?: PlatformReplyTarget): Promise; disconnect(): Promise; } /** * Cordis 插件入口(Host 侧)。 * M3:每个 QQ 会话持有常驻 DSH live agent,实现多轮上下文。 * 依赖:agentLoop / agentPresets / sessionQuery。 */ export declare const name = "dsh-qq-bridge"; export declare const inject: string[]; export declare function apply(ctx: DshCtx, options: DshQqBridgeConfig): Promise<() => Promise>; declare const _default: { name: string; inject: string[]; apply: typeof apply; }; export default _default; /** 判断是否启用 agent 完成后的管理员主动提醒。 */ export declare function agentReplyNotificationsEnabled(cfg: DshQqBridgeConfig): boolean; export declare function attachSessionToWorkspace(registry: DshWorkspaceRegistry, sessionId: string, cwd: string): Promise; export declare function createAgentReplyNotifier(ctx: Pick, client: Pick, adminTarget: MessageTargetId): () => void; /** 监听 DSH 会话完成事件,向管理员 QQ 发送一条轻量提醒。 */ export declare function registerAgentReplyNotifier(ctx: Pick, client: Pick, adminTarget: MessageTargetId): () => void; export declare function findSessionTitle(events: readonly unknown[]): string; /** 构建官方机器人连接失败时的引导文案。 */ export declare function buildOfficialConnectGuidance(cfg: DshQqBridgeConfig, err: unknown): string; /** 构建连接失败时的引导文案,指向「给 Agent 的 NapCat 安装向导」。 */ export declare function buildConnectGuidance(cfg: DshQqBridgeConfig, err: unknown): string;