/** * PiAgentLoop —— 默认下行适配器(基于 pi-agent-core)。 * * 防腐层向下端口 {@link IAgentLoop} 的默认实现:**复用现有 {@link agentService} 核心**, * 零侵入已测的 StreamBridge/translateEvent 逻辑。把 env 无关的 {@link IAgentLoopRequest} * 转译成 `agentService.streamChat` 的 (prompt, auth, options) 调用。 * * prompt 组装顺序(各段缺省即跳过,`\n\n` 分隔): * `` 段(skillContents)→ messages 按角色拍扁 * A2UI Event 会保留用户可见文案,并追加 `` JSON 块;Skill 可据此 * 稳定匹配 event.name/payload/source/invocationId,而不必从按钮文案猜测意图。 * 这样:技能作为引导前置、多轮消息按角色重建,贴合 pi 的单字符串 prompt 入口。 * * `tools` 会由 createAgentSession 转译成真实 Pi AgentTool。MCP 工具在 core * 已按 resourceId 命名空间隔离,CARD 则以平台 Presentation Tool 暴露。 * * 换底层(opencode / google-adk):新写一个 IAgentLoop 实现替换本类,组合根与上行端口 * 全都不用动——这正是防腐层的价值。 */ import { AgentService } from './agentService.js'; import type { AgentStreamEvent } from '../../../core/types.js'; import type { IAgentLoop, IAgentLoopRequest } from '../../../core/ports.js'; /** * PiAgentLoop —— 默认下行适配器实例(按需 new)。内部自持一个 {@link AgentService} * (无共享状态:每次 streamChat 独立 in-memory session),不依赖模块级单例。 */ export declare class PiAgentLoop implements IAgentLoop { private readonly agentService; constructor(agentService?: AgentService); run(req: IAgentLoopRequest): AsyncIterable; } /** * 把 {@link IAgentLoopRequest} 组装成最终单字符串 prompt。 * * 段顺序:技能引导 → messages 按角色拍扁。各段为空则跳过,段间 `\n\n` 分隔。 * 导出便于单测断言组装语义。 */ export declare function composePrompt(req: IAgentLoopRequest): string;