mirror of
https://github.com/openclaw/openclaw.git
synced 2026-02-19 18:39:20 -05:00
42 lines
946 B
TypeScript
42 lines
946 B
TypeScript
export type AgentKind = "claude" | "opencode" | "pi" | "codex";
|
|
|
|
export type AgentMeta = {
|
|
model?: string;
|
|
provider?: string;
|
|
stopReason?: string;
|
|
usage?: {
|
|
input?: number;
|
|
output?: number;
|
|
cacheRead?: number;
|
|
cacheWrite?: number;
|
|
total?: number;
|
|
};
|
|
extra?: Record<string, unknown>;
|
|
};
|
|
|
|
export type AgentParseResult = {
|
|
text?: string;
|
|
mediaUrls?: string[];
|
|
meta?: AgentMeta;
|
|
};
|
|
|
|
export type BuildArgsContext = {
|
|
argv: string[];
|
|
bodyIndex: number; // index of prompt/body argument in argv
|
|
isNewSession: boolean;
|
|
sessionId?: string;
|
|
sendSystemOnce: boolean;
|
|
systemSent: boolean;
|
|
identityPrefix?: string;
|
|
format?: "text" | "json";
|
|
sessionArgNew?: string[];
|
|
sessionArgResume?: string[];
|
|
};
|
|
|
|
export interface AgentSpec {
|
|
kind: AgentKind;
|
|
isInvocation: (argv: string[]) => boolean;
|
|
buildArgs: (ctx: BuildArgsContext) => string[];
|
|
parseOutput: (rawStdout: string) => AgentParseResult;
|
|
}
|