@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.cjs
CHANGED
|
@@ -3898,6 +3898,10 @@ var HttpClient = class {
|
|
|
3898
3898
|
constructor(config) {
|
|
3899
3899
|
this.config = config;
|
|
3900
3900
|
}
|
|
3901
|
+
/** The client-wide request timeout (ms) this client was configured with. */
|
|
3902
|
+
get timeoutMs() {
|
|
3903
|
+
return this.config.timeout;
|
|
3904
|
+
}
|
|
3901
3905
|
/**
|
|
3902
3906
|
* Get authorization header value
|
|
3903
3907
|
*/
|
|
@@ -5413,13 +5417,69 @@ function executionCancelPath(executionId) {
|
|
|
5413
5417
|
return `${EXECUTION_PATH}/${executionId}/cancel`;
|
|
5414
5418
|
}
|
|
5415
5419
|
|
|
5420
|
+
// src/utils/message-key.ts
|
|
5421
|
+
var MESSAGE_KEY_PATTERN = /^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+$/;
|
|
5422
|
+
function isValidMessageKey(key) {
|
|
5423
|
+
return MESSAGE_KEY_PATTERN.test(key);
|
|
5424
|
+
}
|
|
5425
|
+
|
|
5426
|
+
// src/resources/agent-messages.ts
|
|
5427
|
+
var AgentMessagesAPI = class extends BaseResourceAPI {
|
|
5428
|
+
constructor(http) {
|
|
5429
|
+
super(http, "/api/v1/agents");
|
|
5430
|
+
}
|
|
5431
|
+
/**
|
|
5432
|
+
* List an agent's saved messages and the known keys
|
|
5433
|
+
*
|
|
5434
|
+
* @param agentUuid - Agent UUID (a team UUID resolves to its lead agent)
|
|
5435
|
+
*
|
|
5436
|
+
* @example
|
|
5437
|
+
* ```typescript
|
|
5438
|
+
* const { messages, knownKeys } = await client.agents.messages.list('agent-uuid');
|
|
5439
|
+
* ```
|
|
5440
|
+
*/
|
|
5441
|
+
async list(agentUuid) {
|
|
5442
|
+
return this.httpGet(`/${agentUuid}/messages`);
|
|
5443
|
+
}
|
|
5444
|
+
/**
|
|
5445
|
+
* Render one message with placeholders filled
|
|
5446
|
+
*
|
|
5447
|
+
* Resolves with `text: null` when the agent has no message for the key.
|
|
5448
|
+
* Throws `ValidationError` before any request when the key is not a
|
|
5449
|
+
* lowercase dotted key (see `MESSAGE_KEY_PATTERN`).
|
|
5450
|
+
*
|
|
5451
|
+
* @example
|
|
5452
|
+
* ```typescript
|
|
5453
|
+
* const { text } = await client.agents.messages.render('agent-uuid', 'handoff.requested', {
|
|
5454
|
+
* lang: 'es',
|
|
5455
|
+
* vars: { agentName: 'Ana' },
|
|
5456
|
+
* });
|
|
5457
|
+
* ```
|
|
5458
|
+
*/
|
|
5459
|
+
async render(agentUuid, key, options = {}) {
|
|
5460
|
+
if (!isValidMessageKey(key)) {
|
|
5461
|
+
throw new ValidationError(`Invalid message key "${key}"`, [
|
|
5462
|
+
{ field: "key", message: "Must be a lowercase dotted key, e.g. chat.welcome" }
|
|
5463
|
+
]);
|
|
5464
|
+
}
|
|
5465
|
+
return this.httpPost(`/${agentUuid}/messages/render`, {
|
|
5466
|
+
key,
|
|
5467
|
+
...options.lang ? { lang: options.lang } : {},
|
|
5468
|
+
...options.vars ? { vars: options.vars } : {}
|
|
5469
|
+
});
|
|
5470
|
+
}
|
|
5471
|
+
};
|
|
5472
|
+
|
|
5416
5473
|
// src/resources/agents.ts
|
|
5417
5474
|
var AgentsAPI = class extends BaseResourceAPI {
|
|
5418
5475
|
constructor(http, getStreamConfig) {
|
|
5419
5476
|
super(http, "/api/v1/agents");
|
|
5420
5477
|
this.getStreamConfig = getStreamConfig;
|
|
5478
|
+
this.messages = new AgentMessagesAPI(http);
|
|
5421
5479
|
}
|
|
5422
5480
|
getStreamConfig;
|
|
5481
|
+
/** Saved agent messages (p13): `list()` and `render()` */
|
|
5482
|
+
messages;
|
|
5423
5483
|
// ===== LIST Operations =====
|
|
5424
5484
|
/**
|
|
5425
5485
|
* List all agents in the organization
|
|
@@ -7014,7 +7074,7 @@ var RemoteRunnersAPI = class extends BaseResourceAPI {
|
|
|
7014
7074
|
};
|
|
7015
7075
|
|
|
7016
7076
|
// src/resources/ai-functions.ts
|
|
7017
|
-
var AI_FUNCTION_RUN_TIMEOUT_MS =
|
|
7077
|
+
var AI_FUNCTION_RUN_TIMEOUT_MS = 31e4;
|
|
7018
7078
|
var AI_FUNCTION_DESCRIPTOR_TTL_MS = 6e4;
|
|
7019
7079
|
function checkAiFunctionParameters(parameters, variables) {
|
|
7020
7080
|
const issues = [];
|
|
@@ -7127,7 +7187,7 @@ var AiFunctionsAPI = class extends BaseResourceAPI {
|
|
|
7127
7187
|
try {
|
|
7128
7188
|
return await this.httpPost("/run", body, {
|
|
7129
7189
|
skipRetry: true,
|
|
7130
|
-
timeoutMs: AI_FUNCTION_RUN_TIMEOUT_MS
|
|
7190
|
+
timeoutMs: Math.max(AI_FUNCTION_RUN_TIMEOUT_MS, this.http.timeoutMs ?? 0)
|
|
7131
7191
|
});
|
|
7132
7192
|
} catch (error) {
|
|
7133
7193
|
throw this.mapRunError(error, functionKey);
|