2026-01-14 05:39:59 +00:00
|
|
|
import type { AgentSession } from "@mariozechner/pi-coding-agent";
|
2026-01-17 05:33:27 +00:00
|
|
|
import type { ReasoningLevel, VerboseLevel } from "../auto-reply/thinking.js";
|
2026-02-15 00:40:02 +08:00
|
|
|
import type { OpenClawConfig } from "../config/types.openclaw.js";
|
2026-02-12 16:48:11 -08:00
|
|
|
import type { HookRunner } from "../plugins/hooks.js";
|
2026-01-14 05:39:59 +00:00
|
|
|
import type { BlockReplyChunking } from "./pi-embedded-block-chunker.js";
|
2026-02-19 00:06:19 +00:00
|
|
|
import type { BlockReplyPayload } from "./pi-embedded-payloads.js";
|
2026-01-14 05:39:59 +00:00
|
|
|
|
2026-01-17 10:17:57 +00:00
|
|
|
export type ToolResultFormat = "markdown" | "plain";
|
|
|
|
|
|
2026-01-14 05:39:59 +00:00
|
|
|
export type SubscribeEmbeddedPiSessionParams = {
|
|
|
|
|
session: AgentSession;
|
|
|
|
|
runId: string;
|
2026-02-12 16:48:11 -08:00
|
|
|
hookRunner?: HookRunner;
|
2026-01-17 05:33:27 +00:00
|
|
|
verboseLevel?: VerboseLevel;
|
2026-01-14 05:39:59 +00:00
|
|
|
reasoningMode?: ReasoningLevel;
|
2026-01-17 10:17:57 +00:00
|
|
|
toolResultFormat?: ToolResultFormat;
|
2026-01-14 05:39:59 +00:00
|
|
|
shouldEmitToolResult?: () => boolean;
|
2026-01-17 05:33:27 +00:00
|
|
|
shouldEmitToolOutput?: () => boolean;
|
2026-01-14 14:31:43 +00:00
|
|
|
onToolResult?: (payload: { text?: string; mediaUrls?: string[] }) => void | Promise<void>;
|
|
|
|
|
onReasoningStream?: (payload: { text?: string; mediaUrls?: string[] }) => void | Promise<void>;
|
2026-02-16 21:24:34 +08:00
|
|
|
/** Called when a thinking/reasoning block ends (</think> tag processed). */
|
|
|
|
|
onReasoningEnd?: () => void | Promise<void>;
|
2026-02-19 00:06:19 +00:00
|
|
|
onBlockReply?: (payload: BlockReplyPayload) => void | Promise<void>;
|
2026-01-14 05:39:59 +00:00
|
|
|
/** Flush pending block replies (e.g., before tool execution to preserve message boundaries). */
|
|
|
|
|
onBlockReplyFlush?: () => void | Promise<void>;
|
|
|
|
|
blockReplyBreak?: "text_end" | "message_end";
|
|
|
|
|
blockReplyChunking?: BlockReplyChunking;
|
2026-01-14 14:31:43 +00:00
|
|
|
onPartialReply?: (payload: { text?: string; mediaUrls?: string[] }) => void | Promise<void>;
|
2026-01-14 05:39:59 +00:00
|
|
|
onAssistantMessageStart?: () => void | Promise<void>;
|
2026-01-16 09:18:53 +00:00
|
|
|
onAgentEvent?: (evt: { stream: string; data: Record<string, unknown> }) => void | Promise<void>;
|
2026-01-14 05:39:59 +00:00
|
|
|
enforceFinalTag?: boolean;
|
2026-02-15 00:40:02 +08:00
|
|
|
config?: OpenClawConfig;
|
|
|
|
|
sessionKey?: string;
|
2026-01-14 05:39:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export type { BlockReplyChunking } from "./pi-embedded-block-chunker.js";
|