@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/kanban/index.cjs
CHANGED
|
@@ -5417,13 +5417,69 @@ function executionCancelPath(executionId) {
|
|
|
5417
5417
|
return `${EXECUTION_PATH}/${executionId}/cancel`;
|
|
5418
5418
|
}
|
|
5419
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, languages, defaultLanguage } = 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
|
+
|
|
5420
5473
|
// src/resources/agents.ts
|
|
5421
5474
|
var AgentsAPI = class extends BaseResourceAPI {
|
|
5422
5475
|
constructor(http, getStreamConfig) {
|
|
5423
5476
|
super(http, "/api/v1/agents");
|
|
5424
5477
|
this.getStreamConfig = getStreamConfig;
|
|
5478
|
+
this.messages = new AgentMessagesAPI(http);
|
|
5425
5479
|
}
|
|
5426
5480
|
getStreamConfig;
|
|
5481
|
+
/** Saved agent messages (p13): `list()` and `render()` */
|
|
5482
|
+
messages;
|
|
5427
5483
|
// ===== LIST Operations =====
|
|
5428
5484
|
/**
|
|
5429
5485
|
* List all agents in the organization
|