/** * IPC API Server — Unix socket server for CLI commands (send, send-file, cron). * Allows the CLI process to communicate with the running daemon. */ import { type LocalIpcEndpoint } from "../platform/ipc.js"; import type { GoalCommandResult, GoalFinishCommand } from "./goal.js"; import type { CollabTurnDecision } from "./collab-loop.js"; import { type ScheduleAgentCommand, type ScheduleAgentCommandResult } from "./schedule-command.js"; export interface ApiHandler { /** Send text message to a chat */ sendMessage(chatId: string, text: string, scheduleToken?: string, scope?: { scopeKey?: string; threadId?: string; replyToMsgId?: string; }): Promise; /** Send card message to a chat */ sendCard(chatId: string, header: string, content: string, scheduleToken?: string, scope?: { scopeKey?: string; threadId?: string; replyToMsgId?: string; }): Promise; /** Send file to a chat */ sendFile(chatId: string, filePath: string, scheduleToken?: string, scope?: { scopeKey?: string; threadId?: string; replyToMsgId?: string; }): Promise; /** Resolve chat platform_id from short ID or platform ID */ resolveChatPlatformId(chatIdOrShort: string): string | undefined; /** Get the default platform chat ID (from current session context) */ getDefaultPlatformChatId(sessionId?: string): string | undefined; /** 主 Agent 调度写操作;由 Pipeline 使用当前回合身份鉴权。token 证明请求来自当前回合。 */ executeScheduleCommand?(chatId: string, command: ScheduleAgentCommand, token?: string, scope?: { scopeKey?: string; threadId?: string; replyToMsgId?: string; }): Promise; /** 主 Agent Goal finish 操作;由 Pipeline 校验 Goal 令牌与活动回合。 */ executeGoalFinishCommand?(chatId: string, command: GoalFinishCommand, token?: string, scope?: { scopeKey?: string; threadId?: string; replyToMsgId?: string; }): Promise; /** 主 Agent Goal start 操作;由 Pipeline 校验活动回合。 */ executeGoalStartCommand?(chatId: string, objective: string, token?: string, scope?: { scopeKey?: string; threadId?: string; replyToMsgId?: string; }): Promise; /** 主 Agent Goal progress 操作:中间轮静默记录进展。 */ executeGoalProgressCommand?(chatId: string, content: string, status?: string, scope?: { scopeKey?: string; threadId?: string; replyToMsgId?: string; }): Promise; /** 重启唤醒:注入主会话任务(nbt restart --wake 完成后调用)。 */ executeWakeCommand?(chatId: string, prompt: string, scope?: { scopeKey?: string; threadId?: string; replyToMsgId?: string; }): Promise; /** 当前协作 Agent 回合提交一次 handoff/finish 动作。 */ executeCollabTurn?(chatId: string, decision: CollabTurnDecision, token?: string, scope?: { scopeKey?: string; threadId?: string; replyToMsgId?: string; }): Promise<{ output: string; }>; getTimezone?(): string; setTimezone?(raw: string): string; } export declare class ApiServer { private server; private endpoint; private handler; constructor(endpoint: LocalIpcEndpoint | string, handler: ApiHandler); start(): Promise; stop(): void; private handleRequest; }