mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 19:18:26 +00:00
refactor(pi-embedded-runner): dedupe attempt params
This commit is contained in:
@@ -1,97 +1,24 @@
|
|||||||
import type { AgentMessage } from "@mariozechner/pi-agent-core";
|
import type { AgentMessage } from "@mariozechner/pi-agent-core";
|
||||||
import type { Api, AssistantMessage, ImageContent, Model } from "@mariozechner/pi-ai";
|
import type { Api, AssistantMessage, Model } from "@mariozechner/pi-ai";
|
||||||
import type { ReasoningLevel, ThinkLevel, VerboseLevel } from "../../../auto-reply/thinking.js";
|
import type { ThinkLevel } from "../../../auto-reply/thinking.js";
|
||||||
import type { AgentStreamParams } from "../../../commands/agent/types.js";
|
|
||||||
import type { OpenClawConfig } from "../../../config/config.js";
|
|
||||||
import type { SessionSystemPromptReport } from "../../../config/sessions/types.js";
|
import type { SessionSystemPromptReport } from "../../../config/sessions/types.js";
|
||||||
import type { InputProvenance } from "../../../sessions/input-provenance.js";
|
|
||||||
import type { ExecElevatedDefaults, ExecToolDefaults } from "../../bash-tools.js";
|
|
||||||
import type { MessagingToolSend } from "../../pi-embedded-messaging.js";
|
import type { MessagingToolSend } from "../../pi-embedded-messaging.js";
|
||||||
import type { BlockReplyChunking, ToolResultFormat } from "../../pi-embedded-subscribe.js";
|
|
||||||
import type { AuthStorage, ModelRegistry } from "../../pi-model-discovery.js";
|
import type { AuthStorage, ModelRegistry } from "../../pi-model-discovery.js";
|
||||||
import type { SkillSnapshot } from "../../skills.js";
|
|
||||||
import type { NormalizedUsage } from "../../usage.js";
|
import type { NormalizedUsage } from "../../usage.js";
|
||||||
import type { ClientToolDefinition } from "./params.js";
|
import type { RunEmbeddedPiAgentParams } from "./params.js";
|
||||||
|
|
||||||
export type EmbeddedRunAttemptParams = {
|
type EmbeddedRunAttemptBase = Omit<
|
||||||
sessionId: string;
|
RunEmbeddedPiAgentParams,
|
||||||
sessionKey?: string;
|
"provider" | "model" | "authProfileId" | "authProfileIdSource" | "thinkLevel" | "lane" | "enqueue"
|
||||||
agentId?: string;
|
>;
|
||||||
messageChannel?: string;
|
|
||||||
messageProvider?: string;
|
export type EmbeddedRunAttemptParams = EmbeddedRunAttemptBase & {
|
||||||
agentAccountId?: string;
|
|
||||||
messageTo?: string;
|
|
||||||
messageThreadId?: string | number;
|
|
||||||
/** Group id for channel-level tool policy resolution. */
|
|
||||||
groupId?: string | null;
|
|
||||||
/** Group channel label (e.g. #general) for channel-level tool policy resolution. */
|
|
||||||
groupChannel?: string | null;
|
|
||||||
/** Group space label (e.g. guild/team id) for channel-level tool policy resolution. */
|
|
||||||
groupSpace?: string | null;
|
|
||||||
/** Parent session key for subagent policy inheritance. */
|
|
||||||
spawnedBy?: string | null;
|
|
||||||
senderId?: string | null;
|
|
||||||
senderName?: string | null;
|
|
||||||
senderUsername?: string | null;
|
|
||||||
senderE164?: string | null;
|
|
||||||
/** Whether the sender is an owner (required for owner-only tools). */
|
|
||||||
senderIsOwner?: boolean;
|
|
||||||
currentChannelId?: string;
|
|
||||||
currentThreadTs?: string;
|
|
||||||
replyToMode?: "off" | "first" | "all";
|
|
||||||
hasRepliedRef?: { value: boolean };
|
|
||||||
sessionFile: string;
|
|
||||||
workspaceDir: string;
|
|
||||||
agentDir?: string;
|
|
||||||
config?: OpenClawConfig;
|
|
||||||
skillsSnapshot?: SkillSnapshot;
|
|
||||||
prompt: string;
|
|
||||||
images?: ImageContent[];
|
|
||||||
/** Optional client-provided tools (OpenResponses hosted tools). */
|
|
||||||
clientTools?: ClientToolDefinition[];
|
|
||||||
/** Disable built-in tools for this run (LLM-only mode). */
|
|
||||||
disableTools?: boolean;
|
|
||||||
provider: string;
|
provider: string;
|
||||||
modelId: string;
|
modelId: string;
|
||||||
model: Model<Api>;
|
model: Model<Api>;
|
||||||
authStorage: AuthStorage;
|
authStorage: AuthStorage;
|
||||||
modelRegistry: ModelRegistry;
|
modelRegistry: ModelRegistry;
|
||||||
thinkLevel: ThinkLevel;
|
thinkLevel: ThinkLevel;
|
||||||
verboseLevel?: VerboseLevel;
|
|
||||||
reasoningLevel?: ReasoningLevel;
|
|
||||||
toolResultFormat?: ToolResultFormat;
|
|
||||||
execOverrides?: Pick<ExecToolDefaults, "host" | "security" | "ask" | "node">;
|
|
||||||
bashElevated?: ExecElevatedDefaults;
|
|
||||||
timeoutMs: number;
|
|
||||||
runId: string;
|
|
||||||
abortSignal?: AbortSignal;
|
|
||||||
shouldEmitToolResult?: () => boolean;
|
|
||||||
shouldEmitToolOutput?: () => boolean;
|
|
||||||
onPartialReply?: (payload: { text?: string; mediaUrls?: string[] }) => void | Promise<void>;
|
|
||||||
onAssistantMessageStart?: () => void | Promise<void>;
|
|
||||||
onBlockReply?: (payload: {
|
|
||||||
text?: string;
|
|
||||||
mediaUrls?: string[];
|
|
||||||
audioAsVoice?: boolean;
|
|
||||||
replyToId?: string;
|
|
||||||
replyToTag?: boolean;
|
|
||||||
replyToCurrent?: boolean;
|
|
||||||
}) => void | Promise<void>;
|
|
||||||
onBlockReplyFlush?: () => void | Promise<void>;
|
|
||||||
blockReplyBreak?: "text_end" | "message_end";
|
|
||||||
blockReplyChunking?: BlockReplyChunking;
|
|
||||||
onReasoningStream?: (payload: { text?: string; mediaUrls?: string[] }) => void | Promise<void>;
|
|
||||||
onToolResult?: (payload: { text?: string; mediaUrls?: string[] }) => void | Promise<void>;
|
|
||||||
onAgentEvent?: (evt: { stream: string; data: Record<string, unknown> }) => void;
|
|
||||||
/** Require explicit message tool targets (no implicit last-route sends). */
|
|
||||||
requireExplicitMessageTarget?: boolean;
|
|
||||||
/** If true, omit the message tool from the tool list. */
|
|
||||||
disableMessageTool?: boolean;
|
|
||||||
extraSystemPrompt?: string;
|
|
||||||
inputProvenance?: InputProvenance;
|
|
||||||
streamParams?: AgentStreamParams;
|
|
||||||
ownerNumbers?: string[];
|
|
||||||
enforceFinalTag?: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type EmbeddedRunAttemptResult = {
|
export type EmbeddedRunAttemptResult = {
|
||||||
|
|||||||
Reference in New Issue
Block a user