@cadraos/sdk 0.3.14 → 0.3.16-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -830,6 +830,51 @@ interface ExecuteResponse {
830
830
  /** Initial status */
831
831
  status: ExecutionStatus;
832
832
  }
833
+ /**
834
+ * Languages an agent message can be stored and rendered in.
835
+ */
836
+ type AgentMessageLang = 'en' | 'es' | 'id';
837
+ /**
838
+ * One saved agent message (e.g. `handoff.requested`), text per language.
839
+ */
840
+ interface AgentMessage {
841
+ /** Lowercase dotted key, e.g. `chat.welcome` */
842
+ key: string;
843
+ /** Text per language; `en` is the fallback language */
844
+ text: Partial<Record<AgentMessageLang, string>>;
845
+ /** `{word}` placeholder names found in any language */
846
+ placeholders: string[];
847
+ }
848
+ /**
849
+ * Response of `client.agents.messages.list()`
850
+ */
851
+ interface AgentMessageList {
852
+ /** The resolved agent (a team uuid resolves to its lead agent) */
853
+ agentUuid: string;
854
+ /** The agent's saved messages, sorted by key */
855
+ messages: AgentMessage[];
856
+ /** Every key the platform knows about, for pickers (saved or not) */
857
+ knownKeys: string[];
858
+ }
859
+ /**
860
+ * Options for `client.agents.messages.render()`
861
+ */
862
+ interface AgentMessageRenderOptions {
863
+ /** Requested language; falls back to `en` server-side */
864
+ lang?: AgentMessageLang;
865
+ /** Values for `{word}` placeholders; unknown placeholders are left as-is */
866
+ vars?: Record<string, string | number>;
867
+ }
868
+ /**
869
+ * Response of `client.agents.messages.render()`
870
+ */
871
+ interface AgentMessageRenderResult {
872
+ key: string;
873
+ /** The language actually rendered */
874
+ lang: AgentMessageLang;
875
+ /** Filled text, or `null` when the agent has no message for this key */
876
+ text: string | null;
877
+ }
833
878
 
834
879
  /**
835
880
  * Streaming types
@@ -1876,7 +1921,8 @@ interface RequestOptions {
1876
1921
  /**
1877
1922
  * Per-request timeout in milliseconds. Overrides the client-wide
1878
1923
  * `config.timeout` for this call only (p93 AIF-010: a paid AI-function run
1879
- * may take up to 60 s while every other call keeps the 30 s default).
1924
+ * waits for the server's route ceiling while every other call keeps the
1925
+ * 30 s default).
1880
1926
  */
1881
1927
  timeoutMs?: number;
1882
1928
  }
@@ -1888,6 +1934,8 @@ declare class HttpClient {
1888
1934
  private tokenRefreshAttempts;
1889
1935
  private readonly maxTokenRefreshAttempts;
1890
1936
  constructor(config: HttpClientConfig);
1937
+ /** The client-wide request timeout (ms) this client was configured with. */
1938
+ get timeoutMs(): number;
1891
1939
  /**
1892
1940
  * Get authorization header value
1893
1941
  */
@@ -2768,6 +2816,46 @@ interface StreamImagesResult {
2768
2816
  executionId: string;
2769
2817
  }
2770
2818
 
2819
+ /**
2820
+ * Agent Messages Resource API (p13)
2821
+ *
2822
+ * Read-only access to an agent's saved messages (welcome, handoff, fallback
2823
+ * copy, ...). Reached as `client.agents.messages`.
2824
+ * - list(): the agent's saved messages + every known key
2825
+ * - render(): one message filled with vars, in a language (falls back to en)
2826
+ */
2827
+
2828
+ declare class AgentMessagesAPI extends BaseResourceAPI {
2829
+ constructor(http: HttpClient);
2830
+ /**
2831
+ * List an agent's saved messages and the known keys
2832
+ *
2833
+ * @param agentUuid - Agent UUID (a team UUID resolves to its lead agent)
2834
+ *
2835
+ * @example
2836
+ * ```typescript
2837
+ * const { messages, knownKeys } = await client.agents.messages.list('agent-uuid');
2838
+ * ```
2839
+ */
2840
+ list(agentUuid: string): Promise<AgentMessageList>;
2841
+ /**
2842
+ * Render one message with placeholders filled
2843
+ *
2844
+ * Resolves with `text: null` when the agent has no message for the key.
2845
+ * Throws `ValidationError` before any request when the key is not a
2846
+ * lowercase dotted key (see `MESSAGE_KEY_PATTERN`).
2847
+ *
2848
+ * @example
2849
+ * ```typescript
2850
+ * const { text } = await client.agents.messages.render('agent-uuid', 'handoff.requested', {
2851
+ * lang: 'es',
2852
+ * vars: { agentName: 'Ana' },
2853
+ * });
2854
+ * ```
2855
+ */
2856
+ render(agentUuid: string, key: string, options?: AgentMessageRenderOptions): Promise<AgentMessageRenderResult>;
2857
+ }
2858
+
2771
2859
  /**
2772
2860
  * Agents Resource API
2773
2861
  *
@@ -2783,6 +2871,8 @@ interface StreamImagesResult {
2783
2871
  */
2784
2872
  declare class AgentsAPI extends BaseResourceAPI {
2785
2873
  private readonly getStreamConfig;
2874
+ /** Saved agent messages (p13): `list()` and `render()` */
2875
+ readonly messages: AgentMessagesAPI;
2786
2876
  constructor(http: HttpClient, getStreamConfig: () => StreamConfig);
2787
2877
  /**
2788
2878
  * List all agents in the organization
@@ -5175,6 +5265,50 @@ interface ChatInputProps {
5175
5265
  */
5176
5266
  declare function ChatInput({ onSend, onStop, placeholder, disabled, isLoading, enableAttachments, attachments, onRemoveAttachment, dropZoneRef, isUploadingAttachments, className, onInputChange, onInputControlReady, }: ChatInputProps): react_jsx_runtime.JSX.Element;
5177
5267
 
5268
+ /** The slice of CadraClient the picker uses. */
5269
+ interface AgentMessagePickerClient {
5270
+ agents: {
5271
+ messages: {
5272
+ list(agentUuid: string): Promise<AgentMessageList>;
5273
+ };
5274
+ };
5275
+ }
5276
+ /** UI labels; override to translate. */
5277
+ interface AgentMessagePickerLabels {
5278
+ search: string;
5279
+ loading: string;
5280
+ loadError: string;
5281
+ empty: string;
5282
+ notSet: string;
5283
+ useCustom: (key: string) => string;
5284
+ invalidCustom: string;
5285
+ }
5286
+ interface AgentMessagePickerProps {
5287
+ client: AgentMessagePickerClient;
5288
+ agentUuid: string;
5289
+ /** Selected key */
5290
+ value?: string | null;
5291
+ onChange: (key: string) => void;
5292
+ /** Let the user type a new dotted key */
5293
+ allowCustom?: boolean;
5294
+ /** Preview language (falls back to en). Default: en */
5295
+ lang?: AgentMessageLang;
5296
+ labels?: Partial<AgentMessagePickerLabels>;
5297
+ className?: string;
5298
+ }
5299
+ declare function AgentMessagePicker({ client, agentUuid, value, onChange, allowCustom, lang, labels: labelOverrides, className, }: AgentMessagePickerProps): react_jsx_runtime.JSX.Element;
5300
+
5301
+ /**
5302
+ * Agent message keys (p13) — lowercase dotted, e.g. `chat.welcome`.
5303
+ *
5304
+ * Same rule cadra-web enforces on `/api/v1/agents/:id/messages/render`, so an
5305
+ * invalid key fails client-side before a request is made. Kept free of any
5306
+ * client import so the chat entry can use it without pulling in the client.
5307
+ */
5308
+ declare const MESSAGE_KEY_PATTERN: RegExp;
5309
+ /** True when `key` is a valid lowercase dotted agent message key. */
5310
+ declare function isValidMessageKey(key: string): boolean;
5311
+
5178
5312
  /**
5179
5313
  * Tool name patterns for internal/orchestration tools that should be hidden
5180
5314
  * in compact verbosity mode. These are matched after stripping common prefixes
@@ -5417,4 +5551,4 @@ declare function ClockIcon({ className, ...props }: IconProps): react_jsx_runtim
5417
5551
  */
5418
5552
  declare function compressImage(file: File, targetSizeKB?: number): Promise<File>;
5419
5553
 
5420
- export { AgentChat, type AgentChatProps, AlertCircleIcon, type Artifact$1 as Artifact, AskUserPrompt, type AskUserPromptProps, type AttachmentData, type AttachmentFile, BotIcon, type ChatAdapter, ChatConfigProvider, type ChatConfigProviderProps, ChatContainer, type ChatContainerProps, type ChatError, ChatInput, type ChatInputProps, ChatMessage, type ChatMessageProps, type ChatMessage$1 as ChatMessageType, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, CircleIcon, type ClarificationData, ClockIcon, CodeIcon, CopyIcon, type CurrentStep, DatabaseIcon, type DefaultAdapterConfig, type DelegationEvent, DelegationProgress, DelegationProgressList, type DelegationProgressListProps, type DelegationProgressProps, DownloadIcon, type Execution, type ExecutionResult, type ExecutionStreamEvent, ExternalLinkIcon, FileDropZone, type FileDropZoneProps, type FileDropZoneRef, FileIcon, FileTextIcon, HelpCircleIcon, type HistoryMessage, INTERNAL_TOOL_NAMES, type IconProps, type ImageData, ImageGallery, type ImageGalleryProps, ImageIcon, ImageLightbox, type ImageLightboxProps, type ImageStreamClient, type ImageStreamStatus, ImagesIcon, type ListSessionsInput, ListTodoIcon, LoadingSpinner, MarkdownContent, type MarkdownContentProps, Maximize2Icon, MessageCircleIcon, MessageList, type MessageListProps, Minimize2Icon, PaperclipIcon, SendIcon, type SendMessageInput$1 as SendMessageInput, type SendMessageOptions, type SessionHistory$1 as SessionHistory, type SessionList, type SessionListItem, SparklesIcon, type StartExecutionInput, StopCircleIcon, type ThemeMode, ThinkingBlock, ThinkingBlockList, type ThinkingBlockListProps, type ThinkingBlockProps, type ThinkingBlock$1 as ThinkingBlockType, type TodoItem, TodoList, type TodoListProps, type ToolCall, ToolCallEntry, type ToolCallEntryProps, type ToolCallVerbosity, type UploadUrlInput, type UploadUrlResult, type UseAgentChatOptions, type UseAgentChatResult, type UseExecutionStreamOptions, type UseExecutionStreamResult, type UseFileAttachmentsOptions, type UseFileAttachmentsResult, type UseImageStreamOptions, type UseImageStreamResult, UserIcon, XIcon, ZoomInIcon, ZoomOutIcon, compressImage, createDefaultAdapter, isInternalTool, useAgentChat, useChatConfig, useChatConfigOptional, useExecutionStream, useFileAttachments, useImageStream };
5554
+ export { AgentChat, type AgentChatProps, AgentMessagePicker, type AgentMessagePickerClient, type AgentMessagePickerLabels, type AgentMessagePickerProps, AlertCircleIcon, type Artifact$1 as Artifact, AskUserPrompt, type AskUserPromptProps, type AttachmentData, type AttachmentFile, BotIcon, type ChatAdapter, ChatConfigProvider, type ChatConfigProviderProps, ChatContainer, type ChatContainerProps, type ChatError, ChatInput, type ChatInputProps, ChatMessage, type ChatMessageProps, type ChatMessage$1 as ChatMessageType, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, CircleIcon, type ClarificationData, ClockIcon, CodeIcon, CopyIcon, type CurrentStep, DatabaseIcon, type DefaultAdapterConfig, type DelegationEvent, DelegationProgress, DelegationProgressList, type DelegationProgressListProps, type DelegationProgressProps, DownloadIcon, type Execution, type ExecutionResult, type ExecutionStreamEvent, ExternalLinkIcon, FileDropZone, type FileDropZoneProps, type FileDropZoneRef, FileIcon, FileTextIcon, HelpCircleIcon, type HistoryMessage, INTERNAL_TOOL_NAMES, type IconProps, type ImageData, ImageGallery, type ImageGalleryProps, ImageIcon, ImageLightbox, type ImageLightboxProps, type ImageStreamClient, type ImageStreamStatus, ImagesIcon, type ListSessionsInput, ListTodoIcon, LoadingSpinner, MESSAGE_KEY_PATTERN, MarkdownContent, type MarkdownContentProps, Maximize2Icon, MessageCircleIcon, MessageList, type MessageListProps, Minimize2Icon, PaperclipIcon, SendIcon, type SendMessageInput$1 as SendMessageInput, type SendMessageOptions, type SessionHistory$1 as SessionHistory, type SessionList, type SessionListItem, SparklesIcon, type StartExecutionInput, StopCircleIcon, type ThemeMode, ThinkingBlock, ThinkingBlockList, type ThinkingBlockListProps, type ThinkingBlockProps, type ThinkingBlock$1 as ThinkingBlockType, type TodoItem, TodoList, type TodoListProps, type ToolCall, ToolCallEntry, type ToolCallEntryProps, type ToolCallVerbosity, type UploadUrlInput, type UploadUrlResult, type UseAgentChatOptions, type UseAgentChatResult, type UseExecutionStreamOptions, type UseExecutionStreamResult, type UseFileAttachmentsOptions, type UseFileAttachmentsResult, type UseImageStreamOptions, type UseImageStreamResult, UserIcon, XIcon, ZoomInIcon, ZoomOutIcon, compressImage, createDefaultAdapter, isInternalTool, isValidMessageKey, useAgentChat, useChatConfig, useChatConfigOptional, useExecutionStream, useFileAttachments, useImageStream };
@@ -830,6 +830,51 @@ interface ExecuteResponse {
830
830
  /** Initial status */
831
831
  status: ExecutionStatus;
832
832
  }
833
+ /**
834
+ * Languages an agent message can be stored and rendered in.
835
+ */
836
+ type AgentMessageLang = 'en' | 'es' | 'id';
837
+ /**
838
+ * One saved agent message (e.g. `handoff.requested`), text per language.
839
+ */
840
+ interface AgentMessage {
841
+ /** Lowercase dotted key, e.g. `chat.welcome` */
842
+ key: string;
843
+ /** Text per language; `en` is the fallback language */
844
+ text: Partial<Record<AgentMessageLang, string>>;
845
+ /** `{word}` placeholder names found in any language */
846
+ placeholders: string[];
847
+ }
848
+ /**
849
+ * Response of `client.agents.messages.list()`
850
+ */
851
+ interface AgentMessageList {
852
+ /** The resolved agent (a team uuid resolves to its lead agent) */
853
+ agentUuid: string;
854
+ /** The agent's saved messages, sorted by key */
855
+ messages: AgentMessage[];
856
+ /** Every key the platform knows about, for pickers (saved or not) */
857
+ knownKeys: string[];
858
+ }
859
+ /**
860
+ * Options for `client.agents.messages.render()`
861
+ */
862
+ interface AgentMessageRenderOptions {
863
+ /** Requested language; falls back to `en` server-side */
864
+ lang?: AgentMessageLang;
865
+ /** Values for `{word}` placeholders; unknown placeholders are left as-is */
866
+ vars?: Record<string, string | number>;
867
+ }
868
+ /**
869
+ * Response of `client.agents.messages.render()`
870
+ */
871
+ interface AgentMessageRenderResult {
872
+ key: string;
873
+ /** The language actually rendered */
874
+ lang: AgentMessageLang;
875
+ /** Filled text, or `null` when the agent has no message for this key */
876
+ text: string | null;
877
+ }
833
878
 
834
879
  /**
835
880
  * Streaming types
@@ -1876,7 +1921,8 @@ interface RequestOptions {
1876
1921
  /**
1877
1922
  * Per-request timeout in milliseconds. Overrides the client-wide
1878
1923
  * `config.timeout` for this call only (p93 AIF-010: a paid AI-function run
1879
- * may take up to 60 s while every other call keeps the 30 s default).
1924
+ * waits for the server's route ceiling while every other call keeps the
1925
+ * 30 s default).
1880
1926
  */
1881
1927
  timeoutMs?: number;
1882
1928
  }
@@ -1888,6 +1934,8 @@ declare class HttpClient {
1888
1934
  private tokenRefreshAttempts;
1889
1935
  private readonly maxTokenRefreshAttempts;
1890
1936
  constructor(config: HttpClientConfig);
1937
+ /** The client-wide request timeout (ms) this client was configured with. */
1938
+ get timeoutMs(): number;
1891
1939
  /**
1892
1940
  * Get authorization header value
1893
1941
  */
@@ -2768,6 +2816,46 @@ interface StreamImagesResult {
2768
2816
  executionId: string;
2769
2817
  }
2770
2818
 
2819
+ /**
2820
+ * Agent Messages Resource API (p13)
2821
+ *
2822
+ * Read-only access to an agent's saved messages (welcome, handoff, fallback
2823
+ * copy, ...). Reached as `client.agents.messages`.
2824
+ * - list(): the agent's saved messages + every known key
2825
+ * - render(): one message filled with vars, in a language (falls back to en)
2826
+ */
2827
+
2828
+ declare class AgentMessagesAPI extends BaseResourceAPI {
2829
+ constructor(http: HttpClient);
2830
+ /**
2831
+ * List an agent's saved messages and the known keys
2832
+ *
2833
+ * @param agentUuid - Agent UUID (a team UUID resolves to its lead agent)
2834
+ *
2835
+ * @example
2836
+ * ```typescript
2837
+ * const { messages, knownKeys } = await client.agents.messages.list('agent-uuid');
2838
+ * ```
2839
+ */
2840
+ list(agentUuid: string): Promise<AgentMessageList>;
2841
+ /**
2842
+ * Render one message with placeholders filled
2843
+ *
2844
+ * Resolves with `text: null` when the agent has no message for the key.
2845
+ * Throws `ValidationError` before any request when the key is not a
2846
+ * lowercase dotted key (see `MESSAGE_KEY_PATTERN`).
2847
+ *
2848
+ * @example
2849
+ * ```typescript
2850
+ * const { text } = await client.agents.messages.render('agent-uuid', 'handoff.requested', {
2851
+ * lang: 'es',
2852
+ * vars: { agentName: 'Ana' },
2853
+ * });
2854
+ * ```
2855
+ */
2856
+ render(agentUuid: string, key: string, options?: AgentMessageRenderOptions): Promise<AgentMessageRenderResult>;
2857
+ }
2858
+
2771
2859
  /**
2772
2860
  * Agents Resource API
2773
2861
  *
@@ -2783,6 +2871,8 @@ interface StreamImagesResult {
2783
2871
  */
2784
2872
  declare class AgentsAPI extends BaseResourceAPI {
2785
2873
  private readonly getStreamConfig;
2874
+ /** Saved agent messages (p13): `list()` and `render()` */
2875
+ readonly messages: AgentMessagesAPI;
2786
2876
  constructor(http: HttpClient, getStreamConfig: () => StreamConfig);
2787
2877
  /**
2788
2878
  * List all agents in the organization
@@ -5175,6 +5265,50 @@ interface ChatInputProps {
5175
5265
  */
5176
5266
  declare function ChatInput({ onSend, onStop, placeholder, disabled, isLoading, enableAttachments, attachments, onRemoveAttachment, dropZoneRef, isUploadingAttachments, className, onInputChange, onInputControlReady, }: ChatInputProps): react_jsx_runtime.JSX.Element;
5177
5267
 
5268
+ /** The slice of CadraClient the picker uses. */
5269
+ interface AgentMessagePickerClient {
5270
+ agents: {
5271
+ messages: {
5272
+ list(agentUuid: string): Promise<AgentMessageList>;
5273
+ };
5274
+ };
5275
+ }
5276
+ /** UI labels; override to translate. */
5277
+ interface AgentMessagePickerLabels {
5278
+ search: string;
5279
+ loading: string;
5280
+ loadError: string;
5281
+ empty: string;
5282
+ notSet: string;
5283
+ useCustom: (key: string) => string;
5284
+ invalidCustom: string;
5285
+ }
5286
+ interface AgentMessagePickerProps {
5287
+ client: AgentMessagePickerClient;
5288
+ agentUuid: string;
5289
+ /** Selected key */
5290
+ value?: string | null;
5291
+ onChange: (key: string) => void;
5292
+ /** Let the user type a new dotted key */
5293
+ allowCustom?: boolean;
5294
+ /** Preview language (falls back to en). Default: en */
5295
+ lang?: AgentMessageLang;
5296
+ labels?: Partial<AgentMessagePickerLabels>;
5297
+ className?: string;
5298
+ }
5299
+ declare function AgentMessagePicker({ client, agentUuid, value, onChange, allowCustom, lang, labels: labelOverrides, className, }: AgentMessagePickerProps): react_jsx_runtime.JSX.Element;
5300
+
5301
+ /**
5302
+ * Agent message keys (p13) — lowercase dotted, e.g. `chat.welcome`.
5303
+ *
5304
+ * Same rule cadra-web enforces on `/api/v1/agents/:id/messages/render`, so an
5305
+ * invalid key fails client-side before a request is made. Kept free of any
5306
+ * client import so the chat entry can use it without pulling in the client.
5307
+ */
5308
+ declare const MESSAGE_KEY_PATTERN: RegExp;
5309
+ /** True when `key` is a valid lowercase dotted agent message key. */
5310
+ declare function isValidMessageKey(key: string): boolean;
5311
+
5178
5312
  /**
5179
5313
  * Tool name patterns for internal/orchestration tools that should be hidden
5180
5314
  * in compact verbosity mode. These are matched after stripping common prefixes
@@ -5417,4 +5551,4 @@ declare function ClockIcon({ className, ...props }: IconProps): react_jsx_runtim
5417
5551
  */
5418
5552
  declare function compressImage(file: File, targetSizeKB?: number): Promise<File>;
5419
5553
 
5420
- export { AgentChat, type AgentChatProps, AlertCircleIcon, type Artifact$1 as Artifact, AskUserPrompt, type AskUserPromptProps, type AttachmentData, type AttachmentFile, BotIcon, type ChatAdapter, ChatConfigProvider, type ChatConfigProviderProps, ChatContainer, type ChatContainerProps, type ChatError, ChatInput, type ChatInputProps, ChatMessage, type ChatMessageProps, type ChatMessage$1 as ChatMessageType, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, CircleIcon, type ClarificationData, ClockIcon, CodeIcon, CopyIcon, type CurrentStep, DatabaseIcon, type DefaultAdapterConfig, type DelegationEvent, DelegationProgress, DelegationProgressList, type DelegationProgressListProps, type DelegationProgressProps, DownloadIcon, type Execution, type ExecutionResult, type ExecutionStreamEvent, ExternalLinkIcon, FileDropZone, type FileDropZoneProps, type FileDropZoneRef, FileIcon, FileTextIcon, HelpCircleIcon, type HistoryMessage, INTERNAL_TOOL_NAMES, type IconProps, type ImageData, ImageGallery, type ImageGalleryProps, ImageIcon, ImageLightbox, type ImageLightboxProps, type ImageStreamClient, type ImageStreamStatus, ImagesIcon, type ListSessionsInput, ListTodoIcon, LoadingSpinner, MarkdownContent, type MarkdownContentProps, Maximize2Icon, MessageCircleIcon, MessageList, type MessageListProps, Minimize2Icon, PaperclipIcon, SendIcon, type SendMessageInput$1 as SendMessageInput, type SendMessageOptions, type SessionHistory$1 as SessionHistory, type SessionList, type SessionListItem, SparklesIcon, type StartExecutionInput, StopCircleIcon, type ThemeMode, ThinkingBlock, ThinkingBlockList, type ThinkingBlockListProps, type ThinkingBlockProps, type ThinkingBlock$1 as ThinkingBlockType, type TodoItem, TodoList, type TodoListProps, type ToolCall, ToolCallEntry, type ToolCallEntryProps, type ToolCallVerbosity, type UploadUrlInput, type UploadUrlResult, type UseAgentChatOptions, type UseAgentChatResult, type UseExecutionStreamOptions, type UseExecutionStreamResult, type UseFileAttachmentsOptions, type UseFileAttachmentsResult, type UseImageStreamOptions, type UseImageStreamResult, UserIcon, XIcon, ZoomInIcon, ZoomOutIcon, compressImage, createDefaultAdapter, isInternalTool, useAgentChat, useChatConfig, useChatConfigOptional, useExecutionStream, useFileAttachments, useImageStream };
5554
+ export { AgentChat, type AgentChatProps, AgentMessagePicker, type AgentMessagePickerClient, type AgentMessagePickerLabels, type AgentMessagePickerProps, AlertCircleIcon, type Artifact$1 as Artifact, AskUserPrompt, type AskUserPromptProps, type AttachmentData, type AttachmentFile, BotIcon, type ChatAdapter, ChatConfigProvider, type ChatConfigProviderProps, ChatContainer, type ChatContainerProps, type ChatError, ChatInput, type ChatInputProps, ChatMessage, type ChatMessageProps, type ChatMessage$1 as ChatMessageType, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, CircleIcon, type ClarificationData, ClockIcon, CodeIcon, CopyIcon, type CurrentStep, DatabaseIcon, type DefaultAdapterConfig, type DelegationEvent, DelegationProgress, DelegationProgressList, type DelegationProgressListProps, type DelegationProgressProps, DownloadIcon, type Execution, type ExecutionResult, type ExecutionStreamEvent, ExternalLinkIcon, FileDropZone, type FileDropZoneProps, type FileDropZoneRef, FileIcon, FileTextIcon, HelpCircleIcon, type HistoryMessage, INTERNAL_TOOL_NAMES, type IconProps, type ImageData, ImageGallery, type ImageGalleryProps, ImageIcon, ImageLightbox, type ImageLightboxProps, type ImageStreamClient, type ImageStreamStatus, ImagesIcon, type ListSessionsInput, ListTodoIcon, LoadingSpinner, MESSAGE_KEY_PATTERN, MarkdownContent, type MarkdownContentProps, Maximize2Icon, MessageCircleIcon, MessageList, type MessageListProps, Minimize2Icon, PaperclipIcon, SendIcon, type SendMessageInput$1 as SendMessageInput, type SendMessageOptions, type SessionHistory$1 as SessionHistory, type SessionList, type SessionListItem, SparklesIcon, type StartExecutionInput, StopCircleIcon, type ThemeMode, ThinkingBlock, ThinkingBlockList, type ThinkingBlockListProps, type ThinkingBlockProps, type ThinkingBlock$1 as ThinkingBlockType, type TodoItem, TodoList, type TodoListProps, type ToolCall, ToolCallEntry, type ToolCallEntryProps, type ToolCallVerbosity, type UploadUrlInput, type UploadUrlResult, type UseAgentChatOptions, type UseAgentChatResult, type UseExecutionStreamOptions, type UseExecutionStreamResult, type UseFileAttachmentsOptions, type UseFileAttachmentsResult, type UseImageStreamOptions, type UseImageStreamResult, UserIcon, XIcon, ZoomInIcon, ZoomOutIcon, compressImage, createDefaultAdapter, isInternalTool, isValidMessageKey, useAgentChat, useChatConfig, useChatConfigOptional, useExecutionStream, useFileAttachments, useImageStream };
@@ -294,6 +294,10 @@ var HttpClient = class {
294
294
  constructor(config) {
295
295
  this.config = config;
296
296
  }
297
+ /** The client-wide request timeout (ms) this client was configured with. */
298
+ get timeoutMs() {
299
+ return this.config.timeout;
300
+ }
297
301
  /**
298
302
  * Get authorization header value
299
303
  */
@@ -1819,13 +1823,69 @@ function executionCancelPath(executionId) {
1819
1823
  return `${EXECUTION_PATH}/${executionId}/cancel`;
1820
1824
  }
1821
1825
 
1826
+ // src/utils/message-key.ts
1827
+ var MESSAGE_KEY_PATTERN = /^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+$/;
1828
+ function isValidMessageKey(key) {
1829
+ return MESSAGE_KEY_PATTERN.test(key);
1830
+ }
1831
+
1832
+ // src/resources/agent-messages.ts
1833
+ var AgentMessagesAPI = class extends BaseResourceAPI {
1834
+ constructor(http) {
1835
+ super(http, "/api/v1/agents");
1836
+ }
1837
+ /**
1838
+ * List an agent's saved messages and the known keys
1839
+ *
1840
+ * @param agentUuid - Agent UUID (a team UUID resolves to its lead agent)
1841
+ *
1842
+ * @example
1843
+ * ```typescript
1844
+ * const { messages, knownKeys } = await client.agents.messages.list('agent-uuid');
1845
+ * ```
1846
+ */
1847
+ async list(agentUuid) {
1848
+ return this.httpGet(`/${agentUuid}/messages`);
1849
+ }
1850
+ /**
1851
+ * Render one message with placeholders filled
1852
+ *
1853
+ * Resolves with `text: null` when the agent has no message for the key.
1854
+ * Throws `ValidationError` before any request when the key is not a
1855
+ * lowercase dotted key (see `MESSAGE_KEY_PATTERN`).
1856
+ *
1857
+ * @example
1858
+ * ```typescript
1859
+ * const { text } = await client.agents.messages.render('agent-uuid', 'handoff.requested', {
1860
+ * lang: 'es',
1861
+ * vars: { agentName: 'Ana' },
1862
+ * });
1863
+ * ```
1864
+ */
1865
+ async render(agentUuid, key, options = {}) {
1866
+ if (!isValidMessageKey(key)) {
1867
+ throw new ValidationError(`Invalid message key "${key}"`, [
1868
+ { field: "key", message: "Must be a lowercase dotted key, e.g. chat.welcome" }
1869
+ ]);
1870
+ }
1871
+ return this.httpPost(`/${agentUuid}/messages/render`, {
1872
+ key,
1873
+ ...options.lang ? { lang: options.lang } : {},
1874
+ ...options.vars ? { vars: options.vars } : {}
1875
+ });
1876
+ }
1877
+ };
1878
+
1822
1879
  // src/resources/agents.ts
1823
1880
  var AgentsAPI = class extends BaseResourceAPI {
1824
1881
  constructor(http, getStreamConfig) {
1825
1882
  super(http, "/api/v1/agents");
1826
1883
  this.getStreamConfig = getStreamConfig;
1884
+ this.messages = new AgentMessagesAPI(http);
1827
1885
  }
1828
1886
  getStreamConfig;
1887
+ /** Saved agent messages (p13): `list()` and `render()` */
1888
+ messages;
1829
1889
  // ===== LIST Operations =====
1830
1890
  /**
1831
1891
  * List all agents in the organization
@@ -3420,7 +3480,7 @@ var RemoteRunnersAPI = class extends BaseResourceAPI {
3420
3480
  };
3421
3481
 
3422
3482
  // src/resources/ai-functions.ts
3423
- var AI_FUNCTION_RUN_TIMEOUT_MS = 6e4;
3483
+ var AI_FUNCTION_RUN_TIMEOUT_MS = 31e4;
3424
3484
  var AI_FUNCTION_DESCRIPTOR_TTL_MS = 6e4;
3425
3485
  function checkAiFunctionParameters(parameters, variables) {
3426
3486
  const issues = [];
@@ -3533,7 +3593,7 @@ var AiFunctionsAPI = class extends BaseResourceAPI {
3533
3593
  try {
3534
3594
  return await this.httpPost("/run", body, {
3535
3595
  skipRetry: true,
3536
- timeoutMs: AI_FUNCTION_RUN_TIMEOUT_MS
3596
+ timeoutMs: Math.max(AI_FUNCTION_RUN_TIMEOUT_MS, this.http.timeoutMs ?? 0)
3537
3597
  });
3538
3598
  } catch (error) {
3539
3599
  throw this.mapRunError(error, functionKey);
@@ -9599,6 +9659,106 @@ function useImageStream(options) {
9599
9659
  }, [client, providedExecutionId, agentUuid, inputKey, sessionId, shouldConnect]);
9600
9660
  return { images, status, error, executionId, output, cancel };
9601
9661
  }
9662
+ var DEFAULT_LABELS = {
9663
+ search: "Search messages",
9664
+ loading: "Loading messages",
9665
+ loadError: "Could not load messages",
9666
+ empty: "No matching messages",
9667
+ notSet: "not set",
9668
+ useCustom: (key) => `Use "${key}"`,
9669
+ invalidCustom: "Keys are lowercase and dotted, like chat.welcome"
9670
+ };
9671
+ function previewOf(message, lang) {
9672
+ return message.text[lang] ?? message.text.en ?? Object.values(message.text).find(Boolean) ?? null;
9673
+ }
9674
+ function AgentMessagePicker({
9675
+ client,
9676
+ agentUuid,
9677
+ value,
9678
+ onChange,
9679
+ allowCustom = false,
9680
+ lang = "en",
9681
+ labels: labelOverrides,
9682
+ className = ""
9683
+ }) {
9684
+ const labels = { ...DEFAULT_LABELS, ...labelOverrides };
9685
+ const [data, setData] = useState(null);
9686
+ const [error, setError] = useState(false);
9687
+ const [query, setQuery] = useState("");
9688
+ useEffect(() => {
9689
+ let cancelled = false;
9690
+ setData(null);
9691
+ setError(false);
9692
+ client.agents.messages.list(agentUuid).then((result) => {
9693
+ if (!cancelled) setData(result);
9694
+ }).catch(() => {
9695
+ if (!cancelled) setError(true);
9696
+ });
9697
+ return () => {
9698
+ cancelled = true;
9699
+ };
9700
+ }, [client, agentUuid]);
9701
+ const items = useMemo(() => {
9702
+ if (!data) return [];
9703
+ const saved = data.messages.map((m) => ({ key: m.key, preview: previewOf(m, lang) }));
9704
+ const savedKeys = new Set(saved.map((i) => i.key));
9705
+ const unsaved = data.knownKeys.filter((k) => !savedKeys.has(k)).sort().map((key) => ({ key, preview: null }));
9706
+ return [...saved, ...unsaved];
9707
+ }, [data, lang]);
9708
+ const needle = query.trim().toLowerCase();
9709
+ const visible = needle ? items.filter(
9710
+ (i) => i.key.includes(needle) || (i.preview?.toLowerCase().includes(needle) ?? false)
9711
+ ) : items;
9712
+ const custom = query.trim();
9713
+ const showCustom = allowCustom && custom.length > 0 && !items.some((i) => i.key === custom);
9714
+ const customValid = showCustom && isValidMessageKey(custom);
9715
+ return /* @__PURE__ */ jsxs("div", { className: `flex flex-col gap-2 text-sm ${className}`, children: [
9716
+ /* @__PURE__ */ jsx(
9717
+ "input",
9718
+ {
9719
+ type: "search",
9720
+ value: query,
9721
+ onChange: (e) => setQuery(e.target.value),
9722
+ placeholder: labels.search,
9723
+ "aria-label": labels.search,
9724
+ className: "w-full rounded-lg bg-gray-100 dark:bg-gray-800 px-3 py-2 text-gray-900 dark:text-gray-100 placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500"
9725
+ }
9726
+ ),
9727
+ error ? /* @__PURE__ */ jsx("p", { role: "alert", className: "px-1 text-red-500", children: labels.loadError }) : !data ? /* @__PURE__ */ jsxs("p", { className: "flex items-center gap-2 px-1 text-gray-500 dark:text-gray-400", children: [
9728
+ /* @__PURE__ */ jsx(LoadingSpinner, { className: "h-4 w-4" }),
9729
+ labels.loading
9730
+ ] }) : /* @__PURE__ */ jsxs("ul", { role: "listbox", "aria-label": labels.search, className: "flex max-h-72 flex-col gap-0.5 overflow-y-auto", children: [
9731
+ visible.map((item) => {
9732
+ const selected = item.key === value;
9733
+ return /* @__PURE__ */ jsx("li", { role: "option", "aria-selected": selected, children: /* @__PURE__ */ jsxs(
9734
+ "button",
9735
+ {
9736
+ type: "button",
9737
+ onClick: () => onChange(item.key),
9738
+ className: `flex w-full items-start gap-2 rounded-lg px-3 py-2 text-left transition-colors ${selected ? "bg-blue-50 dark:bg-blue-900/30" : "hover:bg-gray-100 dark:hover:bg-gray-800"}`,
9739
+ children: [
9740
+ /* @__PURE__ */ jsxs("span", { className: "flex min-w-0 flex-1 flex-col", children: [
9741
+ /* @__PURE__ */ jsx("span", { className: "font-mono text-xs text-gray-900 dark:text-gray-100", children: item.key }),
9742
+ item.preview !== null ? /* @__PURE__ */ jsx("span", { className: "truncate text-gray-500 dark:text-gray-400", children: item.preview }) : /* @__PURE__ */ jsx("span", { className: "italic text-gray-400 dark:text-gray-500", children: labels.notSet })
9743
+ ] }),
9744
+ selected && /* @__PURE__ */ jsx(CheckIcon, { className: "h-4 w-4 flex-shrink-0 text-blue-500" })
9745
+ ]
9746
+ }
9747
+ ) }, item.key);
9748
+ }),
9749
+ visible.length === 0 && !showCustom && /* @__PURE__ */ jsx("li", { className: "px-3 py-2 text-gray-500 dark:text-gray-400", children: labels.empty })
9750
+ ] }),
9751
+ data && showCustom && (customValid ? /* @__PURE__ */ jsx(
9752
+ "button",
9753
+ {
9754
+ type: "button",
9755
+ onClick: () => onChange(custom),
9756
+ className: "rounded-lg bg-gray-100 dark:bg-gray-800 px-3 py-2 text-left font-mono text-xs text-blue-600 dark:text-blue-400 hover:bg-gray-200 dark:hover:bg-gray-700",
9757
+ children: labels.useCustom(custom)
9758
+ }
9759
+ ) : /* @__PURE__ */ jsx("p", { className: "px-1 text-xs text-gray-500 dark:text-gray-400", children: labels.invalidCustom }))
9760
+ ] });
9761
+ }
9602
9762
  function cn13(...classes) {
9603
9763
  return classes.filter(Boolean).join(" ");
9604
9764
  }
@@ -9694,6 +9854,6 @@ function TodoList({
9694
9854
  );
9695
9855
  }
9696
9856
 
9697
- export { AgentChat, AlertCircleIcon, AskUserPrompt, BotIcon, ChatConfigProvider, ChatContainer, ChatInput, ChatMessage, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, CircleIcon, ClockIcon, CodeIcon, CopyIcon, DatabaseIcon, DelegationProgress, DelegationProgressList, DownloadIcon, ExternalLinkIcon, FileDropZone, FileIcon, FileTextIcon, HelpCircleIcon, INTERNAL_TOOL_NAMES, ImageGallery, ImageIcon, ImageLightbox, ImagesIcon, ListTodoIcon, LoadingSpinner, MarkdownContent, Maximize2Icon, MessageCircleIcon, MessageList, Minimize2Icon, PaperclipIcon, SendIcon, SparklesIcon, StopCircleIcon, ThinkingBlock, ThinkingBlockList, TodoList, ToolCallEntry, UserIcon, XIcon, ZoomInIcon, ZoomOutIcon, compressImage, createDefaultAdapter, isInternalTool, useAgentChat, useChatConfig, useChatConfigOptional, useExecutionStream, useFileAttachments, useImageStream };
9857
+ export { AgentChat, AgentMessagePicker, AlertCircleIcon, AskUserPrompt, BotIcon, ChatConfigProvider, ChatContainer, ChatInput, ChatMessage, CheckCircleIcon, CheckIcon, ChevronDownIcon, ChevronLeftIcon, ChevronRightIcon, CircleIcon, ClockIcon, CodeIcon, CopyIcon, DatabaseIcon, DelegationProgress, DelegationProgressList, DownloadIcon, ExternalLinkIcon, FileDropZone, FileIcon, FileTextIcon, HelpCircleIcon, INTERNAL_TOOL_NAMES, ImageGallery, ImageIcon, ImageLightbox, ImagesIcon, ListTodoIcon, LoadingSpinner, MESSAGE_KEY_PATTERN, MarkdownContent, Maximize2Icon, MessageCircleIcon, MessageList, Minimize2Icon, PaperclipIcon, SendIcon, SparklesIcon, StopCircleIcon, ThinkingBlock, ThinkingBlockList, TodoList, ToolCallEntry, UserIcon, XIcon, ZoomInIcon, ZoomOutIcon, compressImage, createDefaultAdapter, isInternalTool, isValidMessageKey, useAgentChat, useChatConfig, useChatConfigOptional, useExecutionStream, useFileAttachments, useImageStream };
9698
9858
  //# sourceMappingURL=index.js.map
9699
9859
  //# sourceMappingURL=index.js.map