/** * synap agent ask / chat * * Hold a REAL conversation with the workspace's deployed Intelligence-Service * agent (the orchestrator / co-founder). Unlike `synap agent run` — which hits * the IS /v1/chat/completions door directly and stores a research entity — this * drives the SAME channel+trigger path the browser uses, so the deployed agent * answers with full workspace context, tools, and governance. * * Verified path (Hub Protocol REST, all under `${podUrl}/api/hub`): * 1. resolve/create a WORKSPACE-scoped THREAD channel * POST /threads { userId, workspaceId, title, externalSource, externalId } * channelType defaults to "thread" + scope defaults to "workspace" — this is * NOT the pod-wide personal channel (`/channels/personal` is pod-scoped). * A stable externalId dedups, so repeated `agent ask` calls CONTINUE the * same conversation (multi-turn) unless `--new` forces a fresh thread. * 2. post the user turn + trigger the agent * POST /threads/:id/messages { role:"user", content, userId, autoRespond:true } * autoRespond enqueues an A2AI pg-boss job → IS /api/chat/stream (agentType * "meta" → OrchestratorAgent). The reply is ASYNC. * 3. poll for the assistant reply * GET /threads/:id/messages (asc by timestamp) * The a2ai worker persists the answer as a role="assistant" message. We poll * until a NEW assistant message (id not seen before the post) appears. */ export interface AgentAskOpts { message?: string; workspace?: string; thread?: string; agentType?: string; new?: boolean; timeout?: string; json?: boolean; podUrl?: string; apiKey?: string; } export interface AgentChatOpts { workspace?: string; thread?: string; agentType?: string; new?: boolean; timeout?: string; podUrl?: string; apiKey?: string; } export declare function agentAsk(opts: AgentAskOpts): Promise; export declare function agentChat(opts: AgentChatOpts): Promise;