/** * TypeScript SDK types for Amp CLI * * These types are compatible with the Amp CLI --stream-json output. */ import { z } from 'zod'; /** Text content block containing plain text */ export interface TextContent { type: 'text'; text: string; } /** Tool use content block representing a tool call request */ export interface ToolUseContent { type: 'tool_use'; id: string; name: string; input: Record; } /** Tool result content block containing the result of a tool execution */ export interface ToolResultContent { type: 'tool_result'; tool_use_id: string; content: string; is_error: boolean; } /** Token usage information for API calls */ export interface Usage { input_tokens: number; cache_creation_input_tokens?: number; cache_read_input_tokens?: number; output_tokens: number; service_tier?: string; } /** Base interface for all message types */ interface BaseMessage { type: 'system' | 'assistant' | 'user' | 'result'; session_id: string; } /** MCP server connection status */ export type MCPConnectionStatus = 'awaiting-approval' | 'authenticating' | 'connecting' | 'reconnecting' | 'connected' | 'denied' | 'failed' | 'blocked-by-registry'; /** System initialization message containing session info and available tools */ export interface SystemMessage extends BaseMessage { type: 'system'; subtype: 'init'; cwd: string; tools: string[]; mcp_servers: { name: string; status: MCPConnectionStatus; }[]; } /** AI assistant response message with text and tool usage */ export interface AssistantMessage extends BaseMessage { type: 'assistant'; message: { id: string; type: 'message'; role: 'assistant'; model: string; content: Array; stop_reason: 'end_turn' | 'tool_use' | 'max_tokens' | null; stop_sequence: string | null; usage?: Usage; }; parent_tool_use_id: string | null; } /** User input message containing text or tool results */ export interface UserMessage extends BaseMessage { type: 'user'; message: { role: 'user'; content: Array; }; parent_tool_use_id: string | null; } /** Base interface for result messages */ interface BaseResultMessage extends BaseMessage { type: 'result'; duration_ms: number; num_turns: number; usage?: Usage; permission_denials?: string[]; } /** Successful execution result message */ export interface ResultMessage extends BaseResultMessage { subtype: 'success'; is_error: false; result: string; } /** Error result message indicating execution failure */ export interface ErrorResultMessage extends BaseResultMessage { subtype: 'error_during_execution' | 'error_max_turns'; is_error: true; error: string; } /** Union of all possible stream messages */ export type StreamMessage = SystemMessage | AssistantMessage | UserMessage | ResultMessage | ErrorResultMessage; /** User input message schema */ export declare const UserInputMessage: z.ZodObject<{ type: z.ZodLiteral<"user">; message: z.ZodObject<{ role: z.ZodLiteral<"user">; content: z.ZodArray; text: z.ZodString; }, "strip", z.ZodTypeAny, { text: string; type: "text"; }, { text: string; type: "text"; }>, "many">; }, "strip", z.ZodTypeAny, { role: "user"; content: { text: string; type: "text"; }[]; }, { role: "user"; content: { text: string; type: "text"; }[]; }>; }, "strip", z.ZodTypeAny, { message: { role: "user"; content: { text: string; type: "text"; }[]; }; type: "user"; }, { message: { role: "user"; content: { text: string; type: "text"; }[]; }; type: "user"; }>; /** User input message for streaming conversations */ export type UserInputMessage = z.infer; /** Recursive type for permission match conditions */ export type PermissionMatchCondition = string | PermissionMatchCondition[] | { [key in string]: PermissionMatchCondition; } | boolean | number | null | undefined; /** Permission match condition for tool arguments schema */ export declare const PermissionMatchConditionSchema: z.ZodType; /** Individual permission schema */ export declare const Permission: z.ZodEffects>>; action: z.ZodEnum<["allow", "reject", "ask", "delegate"]>; context: z.ZodOptional>; to: z.ZodOptional; }, "strip", z.ZodTypeAny, { tool: string; action: "allow" | "reject" | "ask" | "delegate"; matches?: Record | undefined; context?: "thread" | "subagent" | undefined; to?: string | undefined; }, { tool: string; action: "allow" | "reject" | "ask" | "delegate"; matches?: Record | undefined; context?: "thread" | "subagent" | undefined; to?: string | undefined; }>, { tool: string; action: "allow" | "reject" | "ask" | "delegate"; matches?: Record | undefined; context?: "thread" | "subagent" | undefined; to?: string | undefined; }, { tool: string; action: "allow" | "reject" | "ask" | "delegate"; matches?: Record | undefined; context?: "thread" | "subagent" | undefined; to?: string | undefined; }>; /** Permission */ export type Permission = z.infer; /** Permissions list */ export type PermissionsList = Permission[]; /** MCP server configuration schema (stdio or HTTP) */ export declare const MCPServer: z.ZodUnion<[z.ZodObject<{ command: z.ZodString; args: z.ZodOptional>; env: z.ZodOptional>; disabled: z.ZodOptional; }, "strip", z.ZodTypeAny, { command: string; args?: string[] | undefined; env?: Record | undefined; disabled?: boolean | undefined; }, { command: string; args?: string[] | undefined; env?: Record | undefined; disabled?: boolean | undefined; }>, z.ZodObject<{ url: z.ZodString; headers: z.ZodOptional>; transport: z.ZodOptional; oauth: z.ZodOptional; authUrl: z.ZodString; tokenUrl: z.ZodString; scopes: z.ZodOptional>; redirectUrl: z.ZodOptional; }, "strip", z.ZodTypeAny, { clientId: string; authUrl: string; tokenUrl: string; clientSecret?: string | undefined; scopes?: string[] | undefined; redirectUrl?: string | undefined; }, { clientId: string; authUrl: string; tokenUrl: string; clientSecret?: string | undefined; scopes?: string[] | undefined; redirectUrl?: string | undefined; }>>; disabled: z.ZodOptional; }, "strip", z.ZodTypeAny, { url: string; disabled?: boolean | undefined; headers?: Record | undefined; transport?: string | undefined; oauth?: { clientId: string; authUrl: string; tokenUrl: string; clientSecret?: string | undefined; scopes?: string[] | undefined; redirectUrl?: string | undefined; } | undefined; }, { url: string; disabled?: boolean | undefined; headers?: Record | undefined; transport?: string | undefined; oauth?: { clientId: string; authUrl: string; tokenUrl: string; clientSecret?: string | undefined; scopes?: string[] | undefined; redirectUrl?: string | undefined; } | undefined; }>]>; /** MCP configuration schema */ export declare const MCPConfig: z.ZodRecord>; env: z.ZodOptional>; disabled: z.ZodOptional; }, "strip", z.ZodTypeAny, { command: string; args?: string[] | undefined; env?: Record | undefined; disabled?: boolean | undefined; }, { command: string; args?: string[] | undefined; env?: Record | undefined; disabled?: boolean | undefined; }>, z.ZodObject<{ url: z.ZodString; headers: z.ZodOptional>; transport: z.ZodOptional; oauth: z.ZodOptional; authUrl: z.ZodString; tokenUrl: z.ZodString; scopes: z.ZodOptional>; redirectUrl: z.ZodOptional; }, "strip", z.ZodTypeAny, { clientId: string; authUrl: string; tokenUrl: string; clientSecret?: string | undefined; scopes?: string[] | undefined; redirectUrl?: string | undefined; }, { clientId: string; authUrl: string; tokenUrl: string; clientSecret?: string | undefined; scopes?: string[] | undefined; redirectUrl?: string | undefined; }>>; disabled: z.ZodOptional; }, "strip", z.ZodTypeAny, { url: string; disabled?: boolean | undefined; headers?: Record | undefined; transport?: string | undefined; oauth?: { clientId: string; authUrl: string; tokenUrl: string; clientSecret?: string | undefined; scopes?: string[] | undefined; redirectUrl?: string | undefined; } | undefined; }, { url: string; disabled?: boolean | undefined; headers?: Record | undefined; transport?: string | undefined; oauth?: { clientId: string; authUrl: string; tokenUrl: string; clientSecret?: string | undefined; scopes?: string[] | undefined; redirectUrl?: string | undefined; } | undefined; }>]>>; /** MCP server configuration (stdio or HTTP) */ export type MCPServer = z.infer; /** MCP configuration object */ export type MCPConfig = z.infer; /** Options for creating a new thread schema */ export declare const ThreadsNewOptions: z.ZodObject<{ visibility: z.ZodOptional>; }, "strip", z.ZodTypeAny, { visibility?: "private" | "unlisted" | "public" | "workspace" | "group" | undefined; }, { visibility?: "private" | "unlisted" | "public" | "workspace" | "group" | undefined; }>; /** Options for creating a new thread */ export type ThreadsNewOptions = z.infer; /** Options for getting thread markdown schema */ export declare const ThreadsMarkdownOptions: z.ZodObject<{ threadId: z.ZodString; }, "strip", z.ZodTypeAny, { threadId: string; }, { threadId: string; }>; /** Options for getting thread markdown */ export type ThreadsMarkdownOptions = z.infer; /** Options for opening or closing a thread for contributions (multiplayer) schema */ export declare const ThreadsSetMultiplayerOptions: z.ZodEffects>; minutes: z.ZodOptional; hours: z.ZodOptional; days: z.ZodOptional; weeks: z.ZodOptional; }, "strip", z.ZodTypeAny, { threadId: string; enabled: boolean; minutes?: number | undefined; hours?: number | undefined; days?: number | undefined; weeks?: number | undefined; }, { threadId: string; minutes?: number | undefined; hours?: number | undefined; days?: number | undefined; weeks?: number | undefined; enabled?: boolean | undefined; }>, { threadId: string; enabled: boolean; minutes?: number | undefined; hours?: number | undefined; days?: number | undefined; weeks?: number | undefined; }, { threadId: string; minutes?: number | undefined; hours?: number | undefined; days?: number | undefined; weeks?: number | undefined; enabled?: boolean | undefined; }>; /** Options for opening or closing a thread for contributions (multiplayer) */ export type ThreadsSetMultiplayerOptions = z.input; /** Configuration options for Amp execution schema */ export declare const AmpOptionsSchema: z.ZodObject<{ cwd: z.ZodOptional; mode: z.ZodDefault>; effort: z.ZodOptional>; dangerouslyAllowAll: z.ZodOptional; archive: z.ZodOptional; noArchiveAfterExecute: z.ZodOptional; visibility: z.ZodOptional>>; settingsFile: z.ZodOptional; logLevel: z.ZodOptional>; logFile: z.ZodOptional; mcpConfig: z.ZodOptional>; env: z.ZodOptional>; disabled: z.ZodOptional; }, "strip", z.ZodTypeAny, { command: string; args?: string[] | undefined; env?: Record | undefined; disabled?: boolean | undefined; }, { command: string; args?: string[] | undefined; env?: Record | undefined; disabled?: boolean | undefined; }>, z.ZodObject<{ url: z.ZodString; headers: z.ZodOptional>; transport: z.ZodOptional; oauth: z.ZodOptional; authUrl: z.ZodString; tokenUrl: z.ZodString; scopes: z.ZodOptional>; redirectUrl: z.ZodOptional; }, "strip", z.ZodTypeAny, { clientId: string; authUrl: string; tokenUrl: string; clientSecret?: string | undefined; scopes?: string[] | undefined; redirectUrl?: string | undefined; }, { clientId: string; authUrl: string; tokenUrl: string; clientSecret?: string | undefined; scopes?: string[] | undefined; redirectUrl?: string | undefined; }>>; disabled: z.ZodOptional; }, "strip", z.ZodTypeAny, { url: string; disabled?: boolean | undefined; headers?: Record | undefined; transport?: string | undefined; oauth?: { clientId: string; authUrl: string; tokenUrl: string; clientSecret?: string | undefined; scopes?: string[] | undefined; redirectUrl?: string | undefined; } | undefined; }, { url: string; disabled?: boolean | undefined; headers?: Record | undefined; transport?: string | undefined; oauth?: { clientId: string; authUrl: string; tokenUrl: string; clientSecret?: string | undefined; scopes?: string[] | undefined; redirectUrl?: string | undefined; } | undefined; }>]>>]>>; env: z.ZodOptional>; continue: z.ZodOptional>; skills: z.ZodOptional; permissions: z.ZodOptional>>; action: z.ZodEnum<["allow", "reject", "ask", "delegate"]>; context: z.ZodOptional>; to: z.ZodOptional; }, "strip", z.ZodTypeAny, { tool: string; action: "allow" | "reject" | "ask" | "delegate"; matches?: Record | undefined; context?: "thread" | "subagent" | undefined; to?: string | undefined; }, { tool: string; action: "allow" | "reject" | "ask" | "delegate"; matches?: Record | undefined; context?: "thread" | "subagent" | undefined; to?: string | undefined; }>, { tool: string; action: "allow" | "reject" | "ask" | "delegate"; matches?: Record | undefined; context?: "thread" | "subagent" | undefined; to?: string | undefined; }, { tool: string; action: "allow" | "reject" | "ask" | "delegate"; matches?: Record | undefined; context?: "thread" | "subagent" | undefined; to?: string | undefined; }>, "many">>; labels: z.ZodOptional>; enabledTools: z.ZodOptional>; thinking: z.ZodOptional; executor: z.ZodOptional>; project: z.ZodOptional; }, "strict", z.ZodTypeAny, { mode: string; env?: Record | undefined; visibility?: "private" | "unlisted" | "public" | "workspace" | "group" | undefined; cwd?: string | undefined; effort?: "max" | "medium" | "none" | "minimal" | "low" | "high" | "xhigh" | undefined; dangerouslyAllowAll?: boolean | undefined; archive?: boolean | undefined; noArchiveAfterExecute?: boolean | undefined; settingsFile?: string | undefined; logLevel?: "debug" | "info" | "warn" | "error" | "audit" | undefined; logFile?: string | undefined; mcpConfig?: string | Record | undefined; disabled?: boolean | undefined; } | { url: string; disabled?: boolean | undefined; headers?: Record | undefined; transport?: string | undefined; oauth?: { clientId: string; authUrl: string; tokenUrl: string; clientSecret?: string | undefined; scopes?: string[] | undefined; redirectUrl?: string | undefined; } | undefined; }> | undefined; continue?: string | boolean | undefined; skills?: string | undefined; permissions?: { tool: string; action: "allow" | "reject" | "ask" | "delegate"; matches?: Record | undefined; context?: "thread" | "subagent" | undefined; to?: string | undefined; }[] | undefined; labels?: string[] | undefined; enabledTools?: string[] | undefined; thinking?: boolean | undefined; executor?: "local" | "orb" | undefined; project?: string | undefined; }, { env?: Record | undefined; visibility?: "private" | "unlisted" | "public" | "workspace" | "group" | undefined; cwd?: string | undefined; mode?: string | undefined; effort?: "max" | "medium" | "none" | "minimal" | "low" | "high" | "xhigh" | undefined; dangerouslyAllowAll?: boolean | undefined; archive?: boolean | undefined; noArchiveAfterExecute?: boolean | undefined; settingsFile?: string | undefined; logLevel?: "debug" | "info" | "warn" | "error" | "audit" | undefined; logFile?: string | undefined; mcpConfig?: string | Record | undefined; disabled?: boolean | undefined; } | { url: string; disabled?: boolean | undefined; headers?: Record | undefined; transport?: string | undefined; oauth?: { clientId: string; authUrl: string; tokenUrl: string; clientSecret?: string | undefined; scopes?: string[] | undefined; redirectUrl?: string | undefined; } | undefined; }> | undefined; continue?: string | boolean | undefined; skills?: string | undefined; permissions?: { tool: string; action: "allow" | "reject" | "ask" | "delegate"; matches?: Record | undefined; context?: "thread" | "subagent" | undefined; to?: string | undefined; }[] | undefined; labels?: string[] | undefined; enabledTools?: string[] | undefined; thinking?: boolean | undefined; executor?: "local" | "orb" | undefined; project?: string | undefined; }>; /** Configuration options for Amp execution */ export type AmpOptions = z.input; /** * Configuration options for Amp execution after schema defaults are applied. * * Internal SDK helpers use this to work with fully validated options. */ export type ResolvedAmpOptions = z.output; /** Input type for prompts - either a string or streaming user messages */ type PromptInput = string | AsyncIterable; /** Options for executing Amp commands */ export interface ExecuteOptions { prompt: PromptInput; options?: AmpOptions; signal?: AbortSignal; } export {}; //# sourceMappingURL=types.d.ts.map