@cadraos/sdk 0.3.15 → 0.3.16-dev.1
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.
- package/dist/chat/index.cjs +200 -0
- package/dist/chat/index.cjs.map +1 -1
- package/dist/chat/index.d.cts +149 -1
- package/dist/chat/index.d.ts +149 -1
- package/dist/chat/index.js +198 -1
- package/dist/chat/index.js.map +1 -1
- package/dist/index.cjs +59 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +112 -1
- package/dist/index.d.ts +112 -1
- package/dist/index.js +57 -1
- package/dist/index.js.map +1 -1
- package/dist/kanban/index.cjs +56 -0
- package/dist/kanban/index.cjs.map +1 -1
- package/dist/kanban/index.d.cts +100 -0
- package/dist/kanban/index.d.ts +100 -0
- package/dist/kanban/index.js +56 -0
- package/dist/kanban/index.js.map +1 -1
- package/dist/teams/index.cjs +56 -0
- package/dist/teams/index.cjs.map +1 -1
- package/dist/teams/index.d.cts +100 -0
- package/dist/teams/index.d.ts +100 -0
- package/dist/teams/index.js +56 -0
- package/dist/teams/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -390,6 +390,63 @@ interface ExecuteResponse {
|
|
|
390
390
|
/** Initial status */
|
|
391
391
|
status: ExecutionStatus;
|
|
392
392
|
}
|
|
393
|
+
/**
|
|
394
|
+
* Language code an agent message is stored and rendered in (e.g. `en`,
|
|
395
|
+
* `pt-br`). Each agent sets its own language list; see
|
|
396
|
+
* `AgentMessageList.languages`. Was `'en' | 'es' | 'id'` before p13.
|
|
397
|
+
*/
|
|
398
|
+
type AgentMessageLang = string;
|
|
399
|
+
/**
|
|
400
|
+
* One saved agent message (e.g. `handoff.requested`), text per language.
|
|
401
|
+
*/
|
|
402
|
+
interface AgentMessage {
|
|
403
|
+
/** Lowercase dotted key, e.g. `chat.welcome` */
|
|
404
|
+
key: string;
|
|
405
|
+
/** Text per language code */
|
|
406
|
+
text: Partial<Record<AgentMessageLang, string>>;
|
|
407
|
+
/** `{word}` placeholder names found in any language */
|
|
408
|
+
placeholders: string[];
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Response of `client.agents.messages.list()`
|
|
412
|
+
*/
|
|
413
|
+
interface AgentMessageList {
|
|
414
|
+
/** The resolved agent (a team uuid resolves to its lead agent) */
|
|
415
|
+
agentUuid: string;
|
|
416
|
+
/** The agent's saved messages, sorted by key */
|
|
417
|
+
messages: AgentMessage[];
|
|
418
|
+
/** Every key the platform knows about, for pickers (saved or not) */
|
|
419
|
+
knownKeys: string[];
|
|
420
|
+
/**
|
|
421
|
+
* The agent's message languages, in display order. Missing from older
|
|
422
|
+
* servers; fall back to the languages seen in `messages[].text`.
|
|
423
|
+
*/
|
|
424
|
+
languages?: AgentMessageLang[];
|
|
425
|
+
/** The agent's default message language. Missing from older servers; treat as `en`. */
|
|
426
|
+
defaultLanguage?: AgentMessageLang;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Options for `client.agents.messages.render()`
|
|
430
|
+
*/
|
|
431
|
+
interface AgentMessageRenderOptions {
|
|
432
|
+
/**
|
|
433
|
+
* Requested language. Server falls back: exact, then base (`pt-br` to `pt`),
|
|
434
|
+
* then the agent's default language, then `en`, then the first non-empty text.
|
|
435
|
+
*/
|
|
436
|
+
lang?: AgentMessageLang;
|
|
437
|
+
/** Values for `{word}` placeholders; unknown placeholders are left as-is */
|
|
438
|
+
vars?: Record<string, string | number>;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Response of `client.agents.messages.render()`
|
|
442
|
+
*/
|
|
443
|
+
interface AgentMessageRenderResult {
|
|
444
|
+
key: string;
|
|
445
|
+
/** The language actually rendered (after fallback) */
|
|
446
|
+
lang: AgentMessageLang;
|
|
447
|
+
/** Filled text, or `null` when the agent has no message for this key */
|
|
448
|
+
text: string | null;
|
|
449
|
+
}
|
|
393
450
|
|
|
394
451
|
/**
|
|
395
452
|
* Skill types
|
|
@@ -1847,6 +1904,47 @@ interface StreamImagesResult {
|
|
|
1847
1904
|
*/
|
|
1848
1905
|
declare function collectImagesFromStream(stream: ExecutionStreamController, options?: CollectImagesOptions): Promise<StreamImagesResult>;
|
|
1849
1906
|
|
|
1907
|
+
/**
|
|
1908
|
+
* Agent Messages Resource API (p13)
|
|
1909
|
+
*
|
|
1910
|
+
* Read-only access to an agent's saved messages (welcome, handoff, fallback
|
|
1911
|
+
* copy, ...). Reached as `client.agents.messages`.
|
|
1912
|
+
* - list(): the agent's saved messages, every known key, the agent's languages
|
|
1913
|
+
* - render(): one message filled with vars, in a language (server falls back:
|
|
1914
|
+
* exact, base, agent default, en, first non-empty; `lang` says which was used)
|
|
1915
|
+
*/
|
|
1916
|
+
|
|
1917
|
+
declare class AgentMessagesAPI extends BaseResourceAPI {
|
|
1918
|
+
constructor(http: HttpClient);
|
|
1919
|
+
/**
|
|
1920
|
+
* List an agent's saved messages and the known keys
|
|
1921
|
+
*
|
|
1922
|
+
* @param agentUuid - Agent UUID (a team UUID resolves to its lead agent)
|
|
1923
|
+
*
|
|
1924
|
+
* @example
|
|
1925
|
+
* ```typescript
|
|
1926
|
+
* const { messages, knownKeys, languages, defaultLanguage } = await client.agents.messages.list('agent-uuid');
|
|
1927
|
+
* ```
|
|
1928
|
+
*/
|
|
1929
|
+
list(agentUuid: string): Promise<AgentMessageList>;
|
|
1930
|
+
/**
|
|
1931
|
+
* Render one message with placeholders filled
|
|
1932
|
+
*
|
|
1933
|
+
* Resolves with `text: null` when the agent has no message for the key.
|
|
1934
|
+
* Throws `ValidationError` before any request when the key is not a
|
|
1935
|
+
* lowercase dotted key (see `MESSAGE_KEY_PATTERN`).
|
|
1936
|
+
*
|
|
1937
|
+
* @example
|
|
1938
|
+
* ```typescript
|
|
1939
|
+
* const { text } = await client.agents.messages.render('agent-uuid', 'handoff.requested', {
|
|
1940
|
+
* lang: 'es',
|
|
1941
|
+
* vars: { agentName: 'Ana' },
|
|
1942
|
+
* });
|
|
1943
|
+
* ```
|
|
1944
|
+
*/
|
|
1945
|
+
render(agentUuid: string, key: string, options?: AgentMessageRenderOptions): Promise<AgentMessageRenderResult>;
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1850
1948
|
/**
|
|
1851
1949
|
* Agents Resource API
|
|
1852
1950
|
*
|
|
@@ -1862,6 +1960,8 @@ declare function collectImagesFromStream(stream: ExecutionStreamController, opti
|
|
|
1862
1960
|
*/
|
|
1863
1961
|
declare class AgentsAPI extends BaseResourceAPI {
|
|
1864
1962
|
private readonly getStreamConfig;
|
|
1963
|
+
/** Saved agent messages (p13): `list()` and `render()` */
|
|
1964
|
+
readonly messages: AgentMessagesAPI;
|
|
1865
1965
|
constructor(http: HttpClient, getStreamConfig: () => StreamConfig);
|
|
1866
1966
|
/**
|
|
1867
1967
|
* List all agents in the organization
|
|
@@ -3665,6 +3765,17 @@ declare class CadraClient {
|
|
|
3665
3765
|
private validateOptions;
|
|
3666
3766
|
}
|
|
3667
3767
|
|
|
3768
|
+
/**
|
|
3769
|
+
* Agent message keys (p13) — lowercase dotted, e.g. `chat.welcome`.
|
|
3770
|
+
*
|
|
3771
|
+
* Same rule cadra-web enforces on `/api/v1/agents/:id/messages/render`, so an
|
|
3772
|
+
* invalid key fails client-side before a request is made. Kept free of any
|
|
3773
|
+
* client import so the chat entry can use it without pulling in the client.
|
|
3774
|
+
*/
|
|
3775
|
+
declare const MESSAGE_KEY_PATTERN: RegExp;
|
|
3776
|
+
/** True when `key` is a valid lowercase dotted agent message key. */
|
|
3777
|
+
declare function isValidMessageKey(key: string): boolean;
|
|
3778
|
+
|
|
3668
3779
|
/**
|
|
3669
3780
|
* SDK Error Classes
|
|
3670
3781
|
*
|
|
@@ -3803,4 +3914,4 @@ declare class AiFunctionParameterError extends ValidationError {
|
|
|
3803
3914
|
constructor(functionKey: string, issues: AiFunctionParameterIssue[]);
|
|
3804
3915
|
}
|
|
3805
3916
|
|
|
3806
|
-
export { CadraClient as AISaaSClient, type CadraClientOptions as AISaaSClientOptions, CadraError as AISaaSError, AI_FUNCTION_DESCRIPTOR_TTL_MS, AI_FUNCTION_RUN_TIMEOUT_MS, type Agent, type AgentConfig, type AgentConfigUpdateInput, type AgentExecution, type AgentListOptions, type AgentStatus, type AgentType, type AgentUpdateInput, type AiFunctionBilledTo, AiFunctionChargedError, type AiFunctionDescriptor, AiFunctionDuplicateError, type AiFunctionImage, type AiFunctionOutput, type AiFunctionOutputKind, type AiFunctionParameter, AiFunctionParameterError, type AiFunctionParameterIssue, type AiFunctionParameterIssueCode, type AiFunctionParameterType, type AiFunctionRef, type AiFunctionRun, type AiFunctionRunOptions, type AiFunctionRunResult, type AiFunctionRunShorthandOptions, type AiFunctionRunStatus, type AiFunctionRuntimeParams, type AiFunctionUsage, type AiFunctionVariableValue, type AiFunctionVariables, AiFunctionsAPI, type Artifact, type ArtifactDownloadOptions, type ArtifactListOptions, type ArtifactType, type ArtifactUploadInput, type AttachmentUploadUrlInput, type AttachmentUploadUrlResponse, AuthenticationError, AuthorizationError, CadraClient, type CadraClientOptions, CadraError, type CollectImagesOptions, type CompleteEvent, ConflictError, type ConnectionChangeEvent, type DelegationCompletedEvent, type DelegationStartedEvent, type ErrorEvent, type ExecuteInput, type ExecuteOptions, type ExecuteResponse, type ExecuteToolDirectRequest, type ExecuteToolDirectResponse, type ExecutionLog, type ExecutionStatus, type ExecutionStreamController, type ExecutionStreamControllerOptions, type ExtractContext, type ImageData, type ImageEvent, type JSONSchema, type ListOptions, NetworkError, NotFoundError, type PaginatedResponse, type PaginationInfo, type PausedEvent, type PlanEvent, type ProgressEvent, RateLimitError, type RemoteAgent, type RemoteAgentCreateInput, type RemoteAgentExecuteResponse, type RemoteAgentExecutionTargetKind, type RemoteAgentListOptions, type RemoteAgentStatus, type RemoteAgentUpdateInput, type RemoteAgentVisibility, type RemoteRunner, type RemoteRunnerListOptions, type SendMessageInput, ServerError, type Session, type SessionArtifact, type SessionArtifactListOptions, type SessionArtifactType, type SessionArtifactVariantType, type SessionCreateInput, type SessionHistory, type SessionListOptions, type SessionMessage, type SignedUrlResponse, type Skill, type SkillDetails, type SkillExecuteInput, type SkillExecution, type SkillListOptions, type SkillTool, type SkillUpdateInput, type SkillVariable, type StartedEvent, type StreamController, type StreamEventMap, type StreamImagesResult, type TeamMemberRef, type TextDeltaEvent, TimeoutError, type TokenUsage, type Tool, type ToolCallEvent, type ToolConfigUpdateInput, type ToolExecution, type ToolListOptions, type ToolResultEvent, type ToolUpdateInput, type ToolValidationResult, ValidationError, checkAiFunctionParameters, collectImagesFromStream, deriveImagesFromToolCalls, extractImagesFromExecutionOutput, extractImagesFromResult };
|
|
3917
|
+
export { CadraClient as AISaaSClient, type CadraClientOptions as AISaaSClientOptions, CadraError as AISaaSError, AI_FUNCTION_DESCRIPTOR_TTL_MS, AI_FUNCTION_RUN_TIMEOUT_MS, type Agent, type AgentConfig, type AgentConfigUpdateInput, type AgentExecution, type AgentListOptions, type AgentMessage, type AgentMessageLang, type AgentMessageList, type AgentMessageRenderOptions, type AgentMessageRenderResult, AgentMessagesAPI, type AgentStatus, type AgentType, type AgentUpdateInput, type AiFunctionBilledTo, AiFunctionChargedError, type AiFunctionDescriptor, AiFunctionDuplicateError, type AiFunctionImage, type AiFunctionOutput, type AiFunctionOutputKind, type AiFunctionParameter, AiFunctionParameterError, type AiFunctionParameterIssue, type AiFunctionParameterIssueCode, type AiFunctionParameterType, type AiFunctionRef, type AiFunctionRun, type AiFunctionRunOptions, type AiFunctionRunResult, type AiFunctionRunShorthandOptions, type AiFunctionRunStatus, type AiFunctionRuntimeParams, type AiFunctionUsage, type AiFunctionVariableValue, type AiFunctionVariables, AiFunctionsAPI, type Artifact, type ArtifactDownloadOptions, type ArtifactListOptions, type ArtifactType, type ArtifactUploadInput, type AttachmentUploadUrlInput, type AttachmentUploadUrlResponse, AuthenticationError, AuthorizationError, CadraClient, type CadraClientOptions, CadraError, type CollectImagesOptions, type CompleteEvent, ConflictError, type ConnectionChangeEvent, type DelegationCompletedEvent, type DelegationStartedEvent, type ErrorEvent, type ExecuteInput, type ExecuteOptions, type ExecuteResponse, type ExecuteToolDirectRequest, type ExecuteToolDirectResponse, type ExecutionLog, type ExecutionStatus, type ExecutionStreamController, type ExecutionStreamControllerOptions, type ExtractContext, type ImageData, type ImageEvent, type JSONSchema, type ListOptions, MESSAGE_KEY_PATTERN, NetworkError, NotFoundError, type PaginatedResponse, type PaginationInfo, type PausedEvent, type PlanEvent, type ProgressEvent, RateLimitError, type RemoteAgent, type RemoteAgentCreateInput, type RemoteAgentExecuteResponse, type RemoteAgentExecutionTargetKind, type RemoteAgentListOptions, type RemoteAgentStatus, type RemoteAgentUpdateInput, type RemoteAgentVisibility, type RemoteRunner, type RemoteRunnerListOptions, type SendMessageInput, ServerError, type Session, type SessionArtifact, type SessionArtifactListOptions, type SessionArtifactType, type SessionArtifactVariantType, type SessionCreateInput, type SessionHistory, type SessionListOptions, type SessionMessage, type SignedUrlResponse, type Skill, type SkillDetails, type SkillExecuteInput, type SkillExecution, type SkillListOptions, type SkillTool, type SkillUpdateInput, type SkillVariable, type StartedEvent, type StreamController, type StreamEventMap, type StreamImagesResult, type TeamMemberRef, type TextDeltaEvent, TimeoutError, type TokenUsage, type Tool, type ToolCallEvent, type ToolConfigUpdateInput, type ToolExecution, type ToolListOptions, type ToolResultEvent, type ToolUpdateInput, type ToolValidationResult, ValidationError, checkAiFunctionParameters, collectImagesFromStream, deriveImagesFromToolCalls, extractImagesFromExecutionOutput, extractImagesFromResult, isValidMessageKey };
|
package/dist/index.d.ts
CHANGED
|
@@ -390,6 +390,63 @@ interface ExecuteResponse {
|
|
|
390
390
|
/** Initial status */
|
|
391
391
|
status: ExecutionStatus;
|
|
392
392
|
}
|
|
393
|
+
/**
|
|
394
|
+
* Language code an agent message is stored and rendered in (e.g. `en`,
|
|
395
|
+
* `pt-br`). Each agent sets its own language list; see
|
|
396
|
+
* `AgentMessageList.languages`. Was `'en' | 'es' | 'id'` before p13.
|
|
397
|
+
*/
|
|
398
|
+
type AgentMessageLang = string;
|
|
399
|
+
/**
|
|
400
|
+
* One saved agent message (e.g. `handoff.requested`), text per language.
|
|
401
|
+
*/
|
|
402
|
+
interface AgentMessage {
|
|
403
|
+
/** Lowercase dotted key, e.g. `chat.welcome` */
|
|
404
|
+
key: string;
|
|
405
|
+
/** Text per language code */
|
|
406
|
+
text: Partial<Record<AgentMessageLang, string>>;
|
|
407
|
+
/** `{word}` placeholder names found in any language */
|
|
408
|
+
placeholders: string[];
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Response of `client.agents.messages.list()`
|
|
412
|
+
*/
|
|
413
|
+
interface AgentMessageList {
|
|
414
|
+
/** The resolved agent (a team uuid resolves to its lead agent) */
|
|
415
|
+
agentUuid: string;
|
|
416
|
+
/** The agent's saved messages, sorted by key */
|
|
417
|
+
messages: AgentMessage[];
|
|
418
|
+
/** Every key the platform knows about, for pickers (saved or not) */
|
|
419
|
+
knownKeys: string[];
|
|
420
|
+
/**
|
|
421
|
+
* The agent's message languages, in display order. Missing from older
|
|
422
|
+
* servers; fall back to the languages seen in `messages[].text`.
|
|
423
|
+
*/
|
|
424
|
+
languages?: AgentMessageLang[];
|
|
425
|
+
/** The agent's default message language. Missing from older servers; treat as `en`. */
|
|
426
|
+
defaultLanguage?: AgentMessageLang;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Options for `client.agents.messages.render()`
|
|
430
|
+
*/
|
|
431
|
+
interface AgentMessageRenderOptions {
|
|
432
|
+
/**
|
|
433
|
+
* Requested language. Server falls back: exact, then base (`pt-br` to `pt`),
|
|
434
|
+
* then the agent's default language, then `en`, then the first non-empty text.
|
|
435
|
+
*/
|
|
436
|
+
lang?: AgentMessageLang;
|
|
437
|
+
/** Values for `{word}` placeholders; unknown placeholders are left as-is */
|
|
438
|
+
vars?: Record<string, string | number>;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Response of `client.agents.messages.render()`
|
|
442
|
+
*/
|
|
443
|
+
interface AgentMessageRenderResult {
|
|
444
|
+
key: string;
|
|
445
|
+
/** The language actually rendered (after fallback) */
|
|
446
|
+
lang: AgentMessageLang;
|
|
447
|
+
/** Filled text, or `null` when the agent has no message for this key */
|
|
448
|
+
text: string | null;
|
|
449
|
+
}
|
|
393
450
|
|
|
394
451
|
/**
|
|
395
452
|
* Skill types
|
|
@@ -1847,6 +1904,47 @@ interface StreamImagesResult {
|
|
|
1847
1904
|
*/
|
|
1848
1905
|
declare function collectImagesFromStream(stream: ExecutionStreamController, options?: CollectImagesOptions): Promise<StreamImagesResult>;
|
|
1849
1906
|
|
|
1907
|
+
/**
|
|
1908
|
+
* Agent Messages Resource API (p13)
|
|
1909
|
+
*
|
|
1910
|
+
* Read-only access to an agent's saved messages (welcome, handoff, fallback
|
|
1911
|
+
* copy, ...). Reached as `client.agents.messages`.
|
|
1912
|
+
* - list(): the agent's saved messages, every known key, the agent's languages
|
|
1913
|
+
* - render(): one message filled with vars, in a language (server falls back:
|
|
1914
|
+
* exact, base, agent default, en, first non-empty; `lang` says which was used)
|
|
1915
|
+
*/
|
|
1916
|
+
|
|
1917
|
+
declare class AgentMessagesAPI extends BaseResourceAPI {
|
|
1918
|
+
constructor(http: HttpClient);
|
|
1919
|
+
/**
|
|
1920
|
+
* List an agent's saved messages and the known keys
|
|
1921
|
+
*
|
|
1922
|
+
* @param agentUuid - Agent UUID (a team UUID resolves to its lead agent)
|
|
1923
|
+
*
|
|
1924
|
+
* @example
|
|
1925
|
+
* ```typescript
|
|
1926
|
+
* const { messages, knownKeys, languages, defaultLanguage } = await client.agents.messages.list('agent-uuid');
|
|
1927
|
+
* ```
|
|
1928
|
+
*/
|
|
1929
|
+
list(agentUuid: string): Promise<AgentMessageList>;
|
|
1930
|
+
/**
|
|
1931
|
+
* Render one message with placeholders filled
|
|
1932
|
+
*
|
|
1933
|
+
* Resolves with `text: null` when the agent has no message for the key.
|
|
1934
|
+
* Throws `ValidationError` before any request when the key is not a
|
|
1935
|
+
* lowercase dotted key (see `MESSAGE_KEY_PATTERN`).
|
|
1936
|
+
*
|
|
1937
|
+
* @example
|
|
1938
|
+
* ```typescript
|
|
1939
|
+
* const { text } = await client.agents.messages.render('agent-uuid', 'handoff.requested', {
|
|
1940
|
+
* lang: 'es',
|
|
1941
|
+
* vars: { agentName: 'Ana' },
|
|
1942
|
+
* });
|
|
1943
|
+
* ```
|
|
1944
|
+
*/
|
|
1945
|
+
render(agentUuid: string, key: string, options?: AgentMessageRenderOptions): Promise<AgentMessageRenderResult>;
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1850
1948
|
/**
|
|
1851
1949
|
* Agents Resource API
|
|
1852
1950
|
*
|
|
@@ -1862,6 +1960,8 @@ declare function collectImagesFromStream(stream: ExecutionStreamController, opti
|
|
|
1862
1960
|
*/
|
|
1863
1961
|
declare class AgentsAPI extends BaseResourceAPI {
|
|
1864
1962
|
private readonly getStreamConfig;
|
|
1963
|
+
/** Saved agent messages (p13): `list()` and `render()` */
|
|
1964
|
+
readonly messages: AgentMessagesAPI;
|
|
1865
1965
|
constructor(http: HttpClient, getStreamConfig: () => StreamConfig);
|
|
1866
1966
|
/**
|
|
1867
1967
|
* List all agents in the organization
|
|
@@ -3665,6 +3765,17 @@ declare class CadraClient {
|
|
|
3665
3765
|
private validateOptions;
|
|
3666
3766
|
}
|
|
3667
3767
|
|
|
3768
|
+
/**
|
|
3769
|
+
* Agent message keys (p13) — lowercase dotted, e.g. `chat.welcome`.
|
|
3770
|
+
*
|
|
3771
|
+
* Same rule cadra-web enforces on `/api/v1/agents/:id/messages/render`, so an
|
|
3772
|
+
* invalid key fails client-side before a request is made. Kept free of any
|
|
3773
|
+
* client import so the chat entry can use it without pulling in the client.
|
|
3774
|
+
*/
|
|
3775
|
+
declare const MESSAGE_KEY_PATTERN: RegExp;
|
|
3776
|
+
/** True when `key` is a valid lowercase dotted agent message key. */
|
|
3777
|
+
declare function isValidMessageKey(key: string): boolean;
|
|
3778
|
+
|
|
3668
3779
|
/**
|
|
3669
3780
|
* SDK Error Classes
|
|
3670
3781
|
*
|
|
@@ -3803,4 +3914,4 @@ declare class AiFunctionParameterError extends ValidationError {
|
|
|
3803
3914
|
constructor(functionKey: string, issues: AiFunctionParameterIssue[]);
|
|
3804
3915
|
}
|
|
3805
3916
|
|
|
3806
|
-
export { CadraClient as AISaaSClient, type CadraClientOptions as AISaaSClientOptions, CadraError as AISaaSError, AI_FUNCTION_DESCRIPTOR_TTL_MS, AI_FUNCTION_RUN_TIMEOUT_MS, type Agent, type AgentConfig, type AgentConfigUpdateInput, type AgentExecution, type AgentListOptions, type AgentStatus, type AgentType, type AgentUpdateInput, type AiFunctionBilledTo, AiFunctionChargedError, type AiFunctionDescriptor, AiFunctionDuplicateError, type AiFunctionImage, type AiFunctionOutput, type AiFunctionOutputKind, type AiFunctionParameter, AiFunctionParameterError, type AiFunctionParameterIssue, type AiFunctionParameterIssueCode, type AiFunctionParameterType, type AiFunctionRef, type AiFunctionRun, type AiFunctionRunOptions, type AiFunctionRunResult, type AiFunctionRunShorthandOptions, type AiFunctionRunStatus, type AiFunctionRuntimeParams, type AiFunctionUsage, type AiFunctionVariableValue, type AiFunctionVariables, AiFunctionsAPI, type Artifact, type ArtifactDownloadOptions, type ArtifactListOptions, type ArtifactType, type ArtifactUploadInput, type AttachmentUploadUrlInput, type AttachmentUploadUrlResponse, AuthenticationError, AuthorizationError, CadraClient, type CadraClientOptions, CadraError, type CollectImagesOptions, type CompleteEvent, ConflictError, type ConnectionChangeEvent, type DelegationCompletedEvent, type DelegationStartedEvent, type ErrorEvent, type ExecuteInput, type ExecuteOptions, type ExecuteResponse, type ExecuteToolDirectRequest, type ExecuteToolDirectResponse, type ExecutionLog, type ExecutionStatus, type ExecutionStreamController, type ExecutionStreamControllerOptions, type ExtractContext, type ImageData, type ImageEvent, type JSONSchema, type ListOptions, NetworkError, NotFoundError, type PaginatedResponse, type PaginationInfo, type PausedEvent, type PlanEvent, type ProgressEvent, RateLimitError, type RemoteAgent, type RemoteAgentCreateInput, type RemoteAgentExecuteResponse, type RemoteAgentExecutionTargetKind, type RemoteAgentListOptions, type RemoteAgentStatus, type RemoteAgentUpdateInput, type RemoteAgentVisibility, type RemoteRunner, type RemoteRunnerListOptions, type SendMessageInput, ServerError, type Session, type SessionArtifact, type SessionArtifactListOptions, type SessionArtifactType, type SessionArtifactVariantType, type SessionCreateInput, type SessionHistory, type SessionListOptions, type SessionMessage, type SignedUrlResponse, type Skill, type SkillDetails, type SkillExecuteInput, type SkillExecution, type SkillListOptions, type SkillTool, type SkillUpdateInput, type SkillVariable, type StartedEvent, type StreamController, type StreamEventMap, type StreamImagesResult, type TeamMemberRef, type TextDeltaEvent, TimeoutError, type TokenUsage, type Tool, type ToolCallEvent, type ToolConfigUpdateInput, type ToolExecution, type ToolListOptions, type ToolResultEvent, type ToolUpdateInput, type ToolValidationResult, ValidationError, checkAiFunctionParameters, collectImagesFromStream, deriveImagesFromToolCalls, extractImagesFromExecutionOutput, extractImagesFromResult };
|
|
3917
|
+
export { CadraClient as AISaaSClient, type CadraClientOptions as AISaaSClientOptions, CadraError as AISaaSError, AI_FUNCTION_DESCRIPTOR_TTL_MS, AI_FUNCTION_RUN_TIMEOUT_MS, type Agent, type AgentConfig, type AgentConfigUpdateInput, type AgentExecution, type AgentListOptions, type AgentMessage, type AgentMessageLang, type AgentMessageList, type AgentMessageRenderOptions, type AgentMessageRenderResult, AgentMessagesAPI, type AgentStatus, type AgentType, type AgentUpdateInput, type AiFunctionBilledTo, AiFunctionChargedError, type AiFunctionDescriptor, AiFunctionDuplicateError, type AiFunctionImage, type AiFunctionOutput, type AiFunctionOutputKind, type AiFunctionParameter, AiFunctionParameterError, type AiFunctionParameterIssue, type AiFunctionParameterIssueCode, type AiFunctionParameterType, type AiFunctionRef, type AiFunctionRun, type AiFunctionRunOptions, type AiFunctionRunResult, type AiFunctionRunShorthandOptions, type AiFunctionRunStatus, type AiFunctionRuntimeParams, type AiFunctionUsage, type AiFunctionVariableValue, type AiFunctionVariables, AiFunctionsAPI, type Artifact, type ArtifactDownloadOptions, type ArtifactListOptions, type ArtifactType, type ArtifactUploadInput, type AttachmentUploadUrlInput, type AttachmentUploadUrlResponse, AuthenticationError, AuthorizationError, CadraClient, type CadraClientOptions, CadraError, type CollectImagesOptions, type CompleteEvent, ConflictError, type ConnectionChangeEvent, type DelegationCompletedEvent, type DelegationStartedEvent, type ErrorEvent, type ExecuteInput, type ExecuteOptions, type ExecuteResponse, type ExecuteToolDirectRequest, type ExecuteToolDirectResponse, type ExecutionLog, type ExecutionStatus, type ExecutionStreamController, type ExecutionStreamControllerOptions, type ExtractContext, type ImageData, type ImageEvent, type JSONSchema, type ListOptions, MESSAGE_KEY_PATTERN, NetworkError, NotFoundError, type PaginatedResponse, type PaginationInfo, type PausedEvent, type PlanEvent, type ProgressEvent, RateLimitError, type RemoteAgent, type RemoteAgentCreateInput, type RemoteAgentExecuteResponse, type RemoteAgentExecutionTargetKind, type RemoteAgentListOptions, type RemoteAgentStatus, type RemoteAgentUpdateInput, type RemoteAgentVisibility, type RemoteRunner, type RemoteRunnerListOptions, type SendMessageInput, ServerError, type Session, type SessionArtifact, type SessionArtifactListOptions, type SessionArtifactType, type SessionArtifactVariantType, type SessionCreateInput, type SessionHistory, type SessionListOptions, type SessionMessage, type SignedUrlResponse, type Skill, type SkillDetails, type SkillExecuteInput, type SkillExecution, type SkillListOptions, type SkillTool, type SkillUpdateInput, type SkillVariable, type StartedEvent, type StreamController, type StreamEventMap, type StreamImagesResult, type TeamMemberRef, type TextDeltaEvent, TimeoutError, type TokenUsage, type Tool, type ToolCallEvent, type ToolConfigUpdateInput, type ToolExecution, type ToolListOptions, type ToolResultEvent, type ToolUpdateInput, type ToolValidationResult, ValidationError, checkAiFunctionParameters, collectImagesFromStream, deriveImagesFromToolCalls, extractImagesFromExecutionOutput, extractImagesFromResult, isValidMessageKey };
|
package/dist/index.js
CHANGED
|
@@ -1816,13 +1816,69 @@ function executionCancelPath(executionId) {
|
|
|
1816
1816
|
return `${EXECUTION_PATH}/${executionId}/cancel`;
|
|
1817
1817
|
}
|
|
1818
1818
|
|
|
1819
|
+
// src/utils/message-key.ts
|
|
1820
|
+
var MESSAGE_KEY_PATTERN = /^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+$/;
|
|
1821
|
+
function isValidMessageKey(key) {
|
|
1822
|
+
return MESSAGE_KEY_PATTERN.test(key);
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
// src/resources/agent-messages.ts
|
|
1826
|
+
var AgentMessagesAPI = class extends BaseResourceAPI {
|
|
1827
|
+
constructor(http) {
|
|
1828
|
+
super(http, "/api/v1/agents");
|
|
1829
|
+
}
|
|
1830
|
+
/**
|
|
1831
|
+
* List an agent's saved messages and the known keys
|
|
1832
|
+
*
|
|
1833
|
+
* @param agentUuid - Agent UUID (a team UUID resolves to its lead agent)
|
|
1834
|
+
*
|
|
1835
|
+
* @example
|
|
1836
|
+
* ```typescript
|
|
1837
|
+
* const { messages, knownKeys, languages, defaultLanguage } = await client.agents.messages.list('agent-uuid');
|
|
1838
|
+
* ```
|
|
1839
|
+
*/
|
|
1840
|
+
async list(agentUuid) {
|
|
1841
|
+
return this.httpGet(`/${agentUuid}/messages`);
|
|
1842
|
+
}
|
|
1843
|
+
/**
|
|
1844
|
+
* Render one message with placeholders filled
|
|
1845
|
+
*
|
|
1846
|
+
* Resolves with `text: null` when the agent has no message for the key.
|
|
1847
|
+
* Throws `ValidationError` before any request when the key is not a
|
|
1848
|
+
* lowercase dotted key (see `MESSAGE_KEY_PATTERN`).
|
|
1849
|
+
*
|
|
1850
|
+
* @example
|
|
1851
|
+
* ```typescript
|
|
1852
|
+
* const { text } = await client.agents.messages.render('agent-uuid', 'handoff.requested', {
|
|
1853
|
+
* lang: 'es',
|
|
1854
|
+
* vars: { agentName: 'Ana' },
|
|
1855
|
+
* });
|
|
1856
|
+
* ```
|
|
1857
|
+
*/
|
|
1858
|
+
async render(agentUuid, key, options = {}) {
|
|
1859
|
+
if (!isValidMessageKey(key)) {
|
|
1860
|
+
throw new ValidationError(`Invalid message key "${key}"`, [
|
|
1861
|
+
{ field: "key", message: "Must be a lowercase dotted key, e.g. chat.welcome" }
|
|
1862
|
+
]);
|
|
1863
|
+
}
|
|
1864
|
+
return this.httpPost(`/${agentUuid}/messages/render`, {
|
|
1865
|
+
key,
|
|
1866
|
+
...options.lang ? { lang: options.lang } : {},
|
|
1867
|
+
...options.vars ? { vars: options.vars } : {}
|
|
1868
|
+
});
|
|
1869
|
+
}
|
|
1870
|
+
};
|
|
1871
|
+
|
|
1819
1872
|
// src/resources/agents.ts
|
|
1820
1873
|
var AgentsAPI = class extends BaseResourceAPI {
|
|
1821
1874
|
constructor(http, getStreamConfig) {
|
|
1822
1875
|
super(http, "/api/v1/agents");
|
|
1823
1876
|
this.getStreamConfig = getStreamConfig;
|
|
1877
|
+
this.messages = new AgentMessagesAPI(http);
|
|
1824
1878
|
}
|
|
1825
1879
|
getStreamConfig;
|
|
1880
|
+
/** Saved agent messages (p13): `list()` and `render()` */
|
|
1881
|
+
messages;
|
|
1826
1882
|
// ===== LIST Operations =====
|
|
1827
1883
|
/**
|
|
1828
1884
|
* List all agents in the organization
|
|
@@ -3728,6 +3784,6 @@ var CadraClient = class {
|
|
|
3728
3784
|
}
|
|
3729
3785
|
};
|
|
3730
3786
|
|
|
3731
|
-
export { CadraClient as AISaaSClient, CadraError as AISaaSError, AI_FUNCTION_DESCRIPTOR_TTL_MS, AI_FUNCTION_RUN_TIMEOUT_MS, AiFunctionChargedError, AiFunctionDuplicateError, AiFunctionParameterError, AiFunctionsAPI, AuthenticationError, AuthorizationError, CadraClient, CadraError, ConflictError, NetworkError, NotFoundError, RateLimitError, ServerError, TimeoutError, ValidationError, checkAiFunctionParameters, collectImagesFromStream, deriveImagesFromToolCalls, extractImagesFromExecutionOutput, extractImagesFromResult };
|
|
3787
|
+
export { CadraClient as AISaaSClient, CadraError as AISaaSError, AI_FUNCTION_DESCRIPTOR_TTL_MS, AI_FUNCTION_RUN_TIMEOUT_MS, AgentMessagesAPI, AiFunctionChargedError, AiFunctionDuplicateError, AiFunctionParameterError, AiFunctionsAPI, AuthenticationError, AuthorizationError, CadraClient, CadraError, ConflictError, MESSAGE_KEY_PATTERN, NetworkError, NotFoundError, RateLimitError, ServerError, TimeoutError, ValidationError, checkAiFunctionParameters, collectImagesFromStream, deriveImagesFromToolCalls, extractImagesFromExecutionOutput, extractImagesFromResult, isValidMessageKey };
|
|
3732
3788
|
//# sourceMappingURL=index.js.map
|
|
3733
3789
|
//# sourceMappingURL=index.js.map
|