@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.
- package/dist/chat/index.cjs +165 -2
- package/dist/chat/index.cjs.map +1 -1
- package/dist/chat/index.d.cts +136 -2
- package/dist/chat/index.d.ts +136 -2
- package/dist/chat/index.js +163 -3
- package/dist/chat/index.js.map +1 -1
- package/dist/index.cjs +65 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +112 -4
- package/dist/index.d.ts +112 -4
- package/dist/index.js +63 -3
- package/dist/index.js.map +1 -1
- package/dist/kanban/index.cjs +62 -2
- package/dist/kanban/index.cjs.map +1 -1
- package/dist/kanban/index.d.cts +91 -1
- package/dist/kanban/index.d.ts +91 -1
- package/dist/kanban/index.js +62 -2
- package/dist/kanban/index.js.map +1 -1
- package/dist/teams/index.cjs +62 -2
- package/dist/teams/index.cjs.map +1 -1
- package/dist/teams/index.d.cts +91 -1
- package/dist/teams/index.d.ts +91 -1
- package/dist/teams/index.js +62 -2
- package/dist/teams/index.js.map +1 -1
- package/package.json +1 -1
package/dist/kanban/index.d.cts
CHANGED
|
@@ -1179,6 +1179,51 @@ interface ExecuteResponse {
|
|
|
1179
1179
|
/** Initial status */
|
|
1180
1180
|
status: ExecutionStatus;
|
|
1181
1181
|
}
|
|
1182
|
+
/**
|
|
1183
|
+
* Languages an agent message can be stored and rendered in.
|
|
1184
|
+
*/
|
|
1185
|
+
type AgentMessageLang = 'en' | 'es' | 'id';
|
|
1186
|
+
/**
|
|
1187
|
+
* One saved agent message (e.g. `handoff.requested`), text per language.
|
|
1188
|
+
*/
|
|
1189
|
+
interface AgentMessage {
|
|
1190
|
+
/** Lowercase dotted key, e.g. `chat.welcome` */
|
|
1191
|
+
key: string;
|
|
1192
|
+
/** Text per language; `en` is the fallback language */
|
|
1193
|
+
text: Partial<Record<AgentMessageLang, string>>;
|
|
1194
|
+
/** `{word}` placeholder names found in any language */
|
|
1195
|
+
placeholders: string[];
|
|
1196
|
+
}
|
|
1197
|
+
/**
|
|
1198
|
+
* Response of `client.agents.messages.list()`
|
|
1199
|
+
*/
|
|
1200
|
+
interface AgentMessageList {
|
|
1201
|
+
/** The resolved agent (a team uuid resolves to its lead agent) */
|
|
1202
|
+
agentUuid: string;
|
|
1203
|
+
/** The agent's saved messages, sorted by key */
|
|
1204
|
+
messages: AgentMessage[];
|
|
1205
|
+
/** Every key the platform knows about, for pickers (saved or not) */
|
|
1206
|
+
knownKeys: string[];
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
* Options for `client.agents.messages.render()`
|
|
1210
|
+
*/
|
|
1211
|
+
interface AgentMessageRenderOptions {
|
|
1212
|
+
/** Requested language; falls back to `en` server-side */
|
|
1213
|
+
lang?: AgentMessageLang;
|
|
1214
|
+
/** Values for `{word}` placeholders; unknown placeholders are left as-is */
|
|
1215
|
+
vars?: Record<string, string | number>;
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Response of `client.agents.messages.render()`
|
|
1219
|
+
*/
|
|
1220
|
+
interface AgentMessageRenderResult {
|
|
1221
|
+
key: string;
|
|
1222
|
+
/** The language actually rendered */
|
|
1223
|
+
lang: AgentMessageLang;
|
|
1224
|
+
/** Filled text, or `null` when the agent has no message for this key */
|
|
1225
|
+
text: string | null;
|
|
1226
|
+
}
|
|
1182
1227
|
|
|
1183
1228
|
/**
|
|
1184
1229
|
* Image extraction utilities
|
|
@@ -2872,7 +2917,8 @@ interface RequestOptions {
|
|
|
2872
2917
|
/**
|
|
2873
2918
|
* Per-request timeout in milliseconds. Overrides the client-wide
|
|
2874
2919
|
* `config.timeout` for this call only (p93 AIF-010: a paid AI-function run
|
|
2875
|
-
*
|
|
2920
|
+
* waits for the server's route ceiling while every other call keeps the
|
|
2921
|
+
* 30 s default).
|
|
2876
2922
|
*/
|
|
2877
2923
|
timeoutMs?: number;
|
|
2878
2924
|
}
|
|
@@ -2884,6 +2930,8 @@ declare class HttpClient {
|
|
|
2884
2930
|
private tokenRefreshAttempts;
|
|
2885
2931
|
private readonly maxTokenRefreshAttempts;
|
|
2886
2932
|
constructor(config: HttpClientConfig);
|
|
2933
|
+
/** The client-wide request timeout (ms) this client was configured with. */
|
|
2934
|
+
get timeoutMs(): number;
|
|
2887
2935
|
/**
|
|
2888
2936
|
* Get authorization header value
|
|
2889
2937
|
*/
|
|
@@ -3764,6 +3812,46 @@ interface StreamImagesResult {
|
|
|
3764
3812
|
executionId: string;
|
|
3765
3813
|
}
|
|
3766
3814
|
|
|
3815
|
+
/**
|
|
3816
|
+
* Agent Messages Resource API (p13)
|
|
3817
|
+
*
|
|
3818
|
+
* Read-only access to an agent's saved messages (welcome, handoff, fallback
|
|
3819
|
+
* copy, ...). Reached as `client.agents.messages`.
|
|
3820
|
+
* - list(): the agent's saved messages + every known key
|
|
3821
|
+
* - render(): one message filled with vars, in a language (falls back to en)
|
|
3822
|
+
*/
|
|
3823
|
+
|
|
3824
|
+
declare class AgentMessagesAPI extends BaseResourceAPI {
|
|
3825
|
+
constructor(http: HttpClient);
|
|
3826
|
+
/**
|
|
3827
|
+
* List an agent's saved messages and the known keys
|
|
3828
|
+
*
|
|
3829
|
+
* @param agentUuid - Agent UUID (a team UUID resolves to its lead agent)
|
|
3830
|
+
*
|
|
3831
|
+
* @example
|
|
3832
|
+
* ```typescript
|
|
3833
|
+
* const { messages, knownKeys } = await client.agents.messages.list('agent-uuid');
|
|
3834
|
+
* ```
|
|
3835
|
+
*/
|
|
3836
|
+
list(agentUuid: string): Promise<AgentMessageList>;
|
|
3837
|
+
/**
|
|
3838
|
+
* Render one message with placeholders filled
|
|
3839
|
+
*
|
|
3840
|
+
* Resolves with `text: null` when the agent has no message for the key.
|
|
3841
|
+
* Throws `ValidationError` before any request when the key is not a
|
|
3842
|
+
* lowercase dotted key (see `MESSAGE_KEY_PATTERN`).
|
|
3843
|
+
*
|
|
3844
|
+
* @example
|
|
3845
|
+
* ```typescript
|
|
3846
|
+
* const { text } = await client.agents.messages.render('agent-uuid', 'handoff.requested', {
|
|
3847
|
+
* lang: 'es',
|
|
3848
|
+
* vars: { agentName: 'Ana' },
|
|
3849
|
+
* });
|
|
3850
|
+
* ```
|
|
3851
|
+
*/
|
|
3852
|
+
render(agentUuid: string, key: string, options?: AgentMessageRenderOptions): Promise<AgentMessageRenderResult>;
|
|
3853
|
+
}
|
|
3854
|
+
|
|
3767
3855
|
/**
|
|
3768
3856
|
* Agents Resource API
|
|
3769
3857
|
*
|
|
@@ -3779,6 +3867,8 @@ interface StreamImagesResult {
|
|
|
3779
3867
|
*/
|
|
3780
3868
|
declare class AgentsAPI extends BaseResourceAPI {
|
|
3781
3869
|
private readonly getStreamConfig;
|
|
3870
|
+
/** Saved agent messages (p13): `list()` and `render()` */
|
|
3871
|
+
readonly messages: AgentMessagesAPI;
|
|
3782
3872
|
constructor(http: HttpClient, getStreamConfig: () => StreamConfig);
|
|
3783
3873
|
/**
|
|
3784
3874
|
* List all agents in the organization
|
package/dist/kanban/index.d.ts
CHANGED
|
@@ -1179,6 +1179,51 @@ interface ExecuteResponse {
|
|
|
1179
1179
|
/** Initial status */
|
|
1180
1180
|
status: ExecutionStatus;
|
|
1181
1181
|
}
|
|
1182
|
+
/**
|
|
1183
|
+
* Languages an agent message can be stored and rendered in.
|
|
1184
|
+
*/
|
|
1185
|
+
type AgentMessageLang = 'en' | 'es' | 'id';
|
|
1186
|
+
/**
|
|
1187
|
+
* One saved agent message (e.g. `handoff.requested`), text per language.
|
|
1188
|
+
*/
|
|
1189
|
+
interface AgentMessage {
|
|
1190
|
+
/** Lowercase dotted key, e.g. `chat.welcome` */
|
|
1191
|
+
key: string;
|
|
1192
|
+
/** Text per language; `en` is the fallback language */
|
|
1193
|
+
text: Partial<Record<AgentMessageLang, string>>;
|
|
1194
|
+
/** `{word}` placeholder names found in any language */
|
|
1195
|
+
placeholders: string[];
|
|
1196
|
+
}
|
|
1197
|
+
/**
|
|
1198
|
+
* Response of `client.agents.messages.list()`
|
|
1199
|
+
*/
|
|
1200
|
+
interface AgentMessageList {
|
|
1201
|
+
/** The resolved agent (a team uuid resolves to its lead agent) */
|
|
1202
|
+
agentUuid: string;
|
|
1203
|
+
/** The agent's saved messages, sorted by key */
|
|
1204
|
+
messages: AgentMessage[];
|
|
1205
|
+
/** Every key the platform knows about, for pickers (saved or not) */
|
|
1206
|
+
knownKeys: string[];
|
|
1207
|
+
}
|
|
1208
|
+
/**
|
|
1209
|
+
* Options for `client.agents.messages.render()`
|
|
1210
|
+
*/
|
|
1211
|
+
interface AgentMessageRenderOptions {
|
|
1212
|
+
/** Requested language; falls back to `en` server-side */
|
|
1213
|
+
lang?: AgentMessageLang;
|
|
1214
|
+
/** Values for `{word}` placeholders; unknown placeholders are left as-is */
|
|
1215
|
+
vars?: Record<string, string | number>;
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Response of `client.agents.messages.render()`
|
|
1219
|
+
*/
|
|
1220
|
+
interface AgentMessageRenderResult {
|
|
1221
|
+
key: string;
|
|
1222
|
+
/** The language actually rendered */
|
|
1223
|
+
lang: AgentMessageLang;
|
|
1224
|
+
/** Filled text, or `null` when the agent has no message for this key */
|
|
1225
|
+
text: string | null;
|
|
1226
|
+
}
|
|
1182
1227
|
|
|
1183
1228
|
/**
|
|
1184
1229
|
* Image extraction utilities
|
|
@@ -2872,7 +2917,8 @@ interface RequestOptions {
|
|
|
2872
2917
|
/**
|
|
2873
2918
|
* Per-request timeout in milliseconds. Overrides the client-wide
|
|
2874
2919
|
* `config.timeout` for this call only (p93 AIF-010: a paid AI-function run
|
|
2875
|
-
*
|
|
2920
|
+
* waits for the server's route ceiling while every other call keeps the
|
|
2921
|
+
* 30 s default).
|
|
2876
2922
|
*/
|
|
2877
2923
|
timeoutMs?: number;
|
|
2878
2924
|
}
|
|
@@ -2884,6 +2930,8 @@ declare class HttpClient {
|
|
|
2884
2930
|
private tokenRefreshAttempts;
|
|
2885
2931
|
private readonly maxTokenRefreshAttempts;
|
|
2886
2932
|
constructor(config: HttpClientConfig);
|
|
2933
|
+
/** The client-wide request timeout (ms) this client was configured with. */
|
|
2934
|
+
get timeoutMs(): number;
|
|
2887
2935
|
/**
|
|
2888
2936
|
* Get authorization header value
|
|
2889
2937
|
*/
|
|
@@ -3764,6 +3812,46 @@ interface StreamImagesResult {
|
|
|
3764
3812
|
executionId: string;
|
|
3765
3813
|
}
|
|
3766
3814
|
|
|
3815
|
+
/**
|
|
3816
|
+
* Agent Messages Resource API (p13)
|
|
3817
|
+
*
|
|
3818
|
+
* Read-only access to an agent's saved messages (welcome, handoff, fallback
|
|
3819
|
+
* copy, ...). Reached as `client.agents.messages`.
|
|
3820
|
+
* - list(): the agent's saved messages + every known key
|
|
3821
|
+
* - render(): one message filled with vars, in a language (falls back to en)
|
|
3822
|
+
*/
|
|
3823
|
+
|
|
3824
|
+
declare class AgentMessagesAPI extends BaseResourceAPI {
|
|
3825
|
+
constructor(http: HttpClient);
|
|
3826
|
+
/**
|
|
3827
|
+
* List an agent's saved messages and the known keys
|
|
3828
|
+
*
|
|
3829
|
+
* @param agentUuid - Agent UUID (a team UUID resolves to its lead agent)
|
|
3830
|
+
*
|
|
3831
|
+
* @example
|
|
3832
|
+
* ```typescript
|
|
3833
|
+
* const { messages, knownKeys } = await client.agents.messages.list('agent-uuid');
|
|
3834
|
+
* ```
|
|
3835
|
+
*/
|
|
3836
|
+
list(agentUuid: string): Promise<AgentMessageList>;
|
|
3837
|
+
/**
|
|
3838
|
+
* Render one message with placeholders filled
|
|
3839
|
+
*
|
|
3840
|
+
* Resolves with `text: null` when the agent has no message for the key.
|
|
3841
|
+
* Throws `ValidationError` before any request when the key is not a
|
|
3842
|
+
* lowercase dotted key (see `MESSAGE_KEY_PATTERN`).
|
|
3843
|
+
*
|
|
3844
|
+
* @example
|
|
3845
|
+
* ```typescript
|
|
3846
|
+
* const { text } = await client.agents.messages.render('agent-uuid', 'handoff.requested', {
|
|
3847
|
+
* lang: 'es',
|
|
3848
|
+
* vars: { agentName: 'Ana' },
|
|
3849
|
+
* });
|
|
3850
|
+
* ```
|
|
3851
|
+
*/
|
|
3852
|
+
render(agentUuid: string, key: string, options?: AgentMessageRenderOptions): Promise<AgentMessageRenderResult>;
|
|
3853
|
+
}
|
|
3854
|
+
|
|
3767
3855
|
/**
|
|
3768
3856
|
* Agents Resource API
|
|
3769
3857
|
*
|
|
@@ -3779,6 +3867,8 @@ interface StreamImagesResult {
|
|
|
3779
3867
|
*/
|
|
3780
3868
|
declare class AgentsAPI extends BaseResourceAPI {
|
|
3781
3869
|
private readonly getStreamConfig;
|
|
3870
|
+
/** Saved agent messages (p13): `list()` and `render()` */
|
|
3871
|
+
readonly messages: AgentMessagesAPI;
|
|
3782
3872
|
constructor(http: HttpClient, getStreamConfig: () => StreamConfig);
|
|
3783
3873
|
/**
|
|
3784
3874
|
* List all agents in the organization
|
package/dist/kanban/index.js
CHANGED
|
@@ -3891,6 +3891,10 @@ var HttpClient = class {
|
|
|
3891
3891
|
constructor(config) {
|
|
3892
3892
|
this.config = config;
|
|
3893
3893
|
}
|
|
3894
|
+
/** The client-wide request timeout (ms) this client was configured with. */
|
|
3895
|
+
get timeoutMs() {
|
|
3896
|
+
return this.config.timeout;
|
|
3897
|
+
}
|
|
3894
3898
|
/**
|
|
3895
3899
|
* Get authorization header value
|
|
3896
3900
|
*/
|
|
@@ -5406,13 +5410,69 @@ function executionCancelPath(executionId) {
|
|
|
5406
5410
|
return `${EXECUTION_PATH}/${executionId}/cancel`;
|
|
5407
5411
|
}
|
|
5408
5412
|
|
|
5413
|
+
// src/utils/message-key.ts
|
|
5414
|
+
var MESSAGE_KEY_PATTERN = /^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+$/;
|
|
5415
|
+
function isValidMessageKey(key) {
|
|
5416
|
+
return MESSAGE_KEY_PATTERN.test(key);
|
|
5417
|
+
}
|
|
5418
|
+
|
|
5419
|
+
// src/resources/agent-messages.ts
|
|
5420
|
+
var AgentMessagesAPI = class extends BaseResourceAPI {
|
|
5421
|
+
constructor(http) {
|
|
5422
|
+
super(http, "/api/v1/agents");
|
|
5423
|
+
}
|
|
5424
|
+
/**
|
|
5425
|
+
* List an agent's saved messages and the known keys
|
|
5426
|
+
*
|
|
5427
|
+
* @param agentUuid - Agent UUID (a team UUID resolves to its lead agent)
|
|
5428
|
+
*
|
|
5429
|
+
* @example
|
|
5430
|
+
* ```typescript
|
|
5431
|
+
* const { messages, knownKeys } = await client.agents.messages.list('agent-uuid');
|
|
5432
|
+
* ```
|
|
5433
|
+
*/
|
|
5434
|
+
async list(agentUuid) {
|
|
5435
|
+
return this.httpGet(`/${agentUuid}/messages`);
|
|
5436
|
+
}
|
|
5437
|
+
/**
|
|
5438
|
+
* Render one message with placeholders filled
|
|
5439
|
+
*
|
|
5440
|
+
* Resolves with `text: null` when the agent has no message for the key.
|
|
5441
|
+
* Throws `ValidationError` before any request when the key is not a
|
|
5442
|
+
* lowercase dotted key (see `MESSAGE_KEY_PATTERN`).
|
|
5443
|
+
*
|
|
5444
|
+
* @example
|
|
5445
|
+
* ```typescript
|
|
5446
|
+
* const { text } = await client.agents.messages.render('agent-uuid', 'handoff.requested', {
|
|
5447
|
+
* lang: 'es',
|
|
5448
|
+
* vars: { agentName: 'Ana' },
|
|
5449
|
+
* });
|
|
5450
|
+
* ```
|
|
5451
|
+
*/
|
|
5452
|
+
async render(agentUuid, key, options = {}) {
|
|
5453
|
+
if (!isValidMessageKey(key)) {
|
|
5454
|
+
throw new ValidationError(`Invalid message key "${key}"`, [
|
|
5455
|
+
{ field: "key", message: "Must be a lowercase dotted key, e.g. chat.welcome" }
|
|
5456
|
+
]);
|
|
5457
|
+
}
|
|
5458
|
+
return this.httpPost(`/${agentUuid}/messages/render`, {
|
|
5459
|
+
key,
|
|
5460
|
+
...options.lang ? { lang: options.lang } : {},
|
|
5461
|
+
...options.vars ? { vars: options.vars } : {}
|
|
5462
|
+
});
|
|
5463
|
+
}
|
|
5464
|
+
};
|
|
5465
|
+
|
|
5409
5466
|
// src/resources/agents.ts
|
|
5410
5467
|
var AgentsAPI = class extends BaseResourceAPI {
|
|
5411
5468
|
constructor(http, getStreamConfig) {
|
|
5412
5469
|
super(http, "/api/v1/agents");
|
|
5413
5470
|
this.getStreamConfig = getStreamConfig;
|
|
5471
|
+
this.messages = new AgentMessagesAPI(http);
|
|
5414
5472
|
}
|
|
5415
5473
|
getStreamConfig;
|
|
5474
|
+
/** Saved agent messages (p13): `list()` and `render()` */
|
|
5475
|
+
messages;
|
|
5416
5476
|
// ===== LIST Operations =====
|
|
5417
5477
|
/**
|
|
5418
5478
|
* List all agents in the organization
|
|
@@ -7007,7 +7067,7 @@ var RemoteRunnersAPI = class extends BaseResourceAPI {
|
|
|
7007
7067
|
};
|
|
7008
7068
|
|
|
7009
7069
|
// src/resources/ai-functions.ts
|
|
7010
|
-
var AI_FUNCTION_RUN_TIMEOUT_MS =
|
|
7070
|
+
var AI_FUNCTION_RUN_TIMEOUT_MS = 31e4;
|
|
7011
7071
|
var AI_FUNCTION_DESCRIPTOR_TTL_MS = 6e4;
|
|
7012
7072
|
function checkAiFunctionParameters(parameters, variables) {
|
|
7013
7073
|
const issues = [];
|
|
@@ -7120,7 +7180,7 @@ var AiFunctionsAPI = class extends BaseResourceAPI {
|
|
|
7120
7180
|
try {
|
|
7121
7181
|
return await this.httpPost("/run", body, {
|
|
7122
7182
|
skipRetry: true,
|
|
7123
|
-
timeoutMs: AI_FUNCTION_RUN_TIMEOUT_MS
|
|
7183
|
+
timeoutMs: Math.max(AI_FUNCTION_RUN_TIMEOUT_MS, this.http.timeoutMs ?? 0)
|
|
7124
7184
|
});
|
|
7125
7185
|
} catch (error) {
|
|
7126
7186
|
throw this.mapRunError(error, functionKey);
|