@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.d.cts
CHANGED
|
@@ -1179,6 +1179,63 @@ interface ExecuteResponse {
|
|
|
1179
1179
|
/** Initial status */
|
|
1180
1180
|
status: ExecutionStatus;
|
|
1181
1181
|
}
|
|
1182
|
+
/**
|
|
1183
|
+
* Language code an agent message is stored and rendered in (e.g. `en`,
|
|
1184
|
+
* `pt-br`). Each agent sets its own language list; see
|
|
1185
|
+
* `AgentMessageList.languages`. Was `'en' | 'es' | 'id'` before p13.
|
|
1186
|
+
*/
|
|
1187
|
+
type AgentMessageLang = string;
|
|
1188
|
+
/**
|
|
1189
|
+
* One saved agent message (e.g. `handoff.requested`), text per language.
|
|
1190
|
+
*/
|
|
1191
|
+
interface AgentMessage {
|
|
1192
|
+
/** Lowercase dotted key, e.g. `chat.welcome` */
|
|
1193
|
+
key: string;
|
|
1194
|
+
/** Text per language code */
|
|
1195
|
+
text: Partial<Record<AgentMessageLang, string>>;
|
|
1196
|
+
/** `{word}` placeholder names found in any language */
|
|
1197
|
+
placeholders: string[];
|
|
1198
|
+
}
|
|
1199
|
+
/**
|
|
1200
|
+
* Response of `client.agents.messages.list()`
|
|
1201
|
+
*/
|
|
1202
|
+
interface AgentMessageList {
|
|
1203
|
+
/** The resolved agent (a team uuid resolves to its lead agent) */
|
|
1204
|
+
agentUuid: string;
|
|
1205
|
+
/** The agent's saved messages, sorted by key */
|
|
1206
|
+
messages: AgentMessage[];
|
|
1207
|
+
/** Every key the platform knows about, for pickers (saved or not) */
|
|
1208
|
+
knownKeys: string[];
|
|
1209
|
+
/**
|
|
1210
|
+
* The agent's message languages, in display order. Missing from older
|
|
1211
|
+
* servers; fall back to the languages seen in `messages[].text`.
|
|
1212
|
+
*/
|
|
1213
|
+
languages?: AgentMessageLang[];
|
|
1214
|
+
/** The agent's default message language. Missing from older servers; treat as `en`. */
|
|
1215
|
+
defaultLanguage?: AgentMessageLang;
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Options for `client.agents.messages.render()`
|
|
1219
|
+
*/
|
|
1220
|
+
interface AgentMessageRenderOptions {
|
|
1221
|
+
/**
|
|
1222
|
+
* Requested language. Server falls back: exact, then base (`pt-br` to `pt`),
|
|
1223
|
+
* then the agent's default language, then `en`, then the first non-empty text.
|
|
1224
|
+
*/
|
|
1225
|
+
lang?: AgentMessageLang;
|
|
1226
|
+
/** Values for `{word}` placeholders; unknown placeholders are left as-is */
|
|
1227
|
+
vars?: Record<string, string | number>;
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Response of `client.agents.messages.render()`
|
|
1231
|
+
*/
|
|
1232
|
+
interface AgentMessageRenderResult {
|
|
1233
|
+
key: string;
|
|
1234
|
+
/** The language actually rendered (after fallback) */
|
|
1235
|
+
lang: AgentMessageLang;
|
|
1236
|
+
/** Filled text, or `null` when the agent has no message for this key */
|
|
1237
|
+
text: string | null;
|
|
1238
|
+
}
|
|
1182
1239
|
|
|
1183
1240
|
/**
|
|
1184
1241
|
* Image extraction utilities
|
|
@@ -3767,6 +3824,47 @@ interface StreamImagesResult {
|
|
|
3767
3824
|
executionId: string;
|
|
3768
3825
|
}
|
|
3769
3826
|
|
|
3827
|
+
/**
|
|
3828
|
+
* Agent Messages Resource API (p13)
|
|
3829
|
+
*
|
|
3830
|
+
* Read-only access to an agent's saved messages (welcome, handoff, fallback
|
|
3831
|
+
* copy, ...). Reached as `client.agents.messages`.
|
|
3832
|
+
* - list(): the agent's saved messages, every known key, the agent's languages
|
|
3833
|
+
* - render(): one message filled with vars, in a language (server falls back:
|
|
3834
|
+
* exact, base, agent default, en, first non-empty; `lang` says which was used)
|
|
3835
|
+
*/
|
|
3836
|
+
|
|
3837
|
+
declare class AgentMessagesAPI extends BaseResourceAPI {
|
|
3838
|
+
constructor(http: HttpClient);
|
|
3839
|
+
/**
|
|
3840
|
+
* List an agent's saved messages and the known keys
|
|
3841
|
+
*
|
|
3842
|
+
* @param agentUuid - Agent UUID (a team UUID resolves to its lead agent)
|
|
3843
|
+
*
|
|
3844
|
+
* @example
|
|
3845
|
+
* ```typescript
|
|
3846
|
+
* const { messages, knownKeys, languages, defaultLanguage } = await client.agents.messages.list('agent-uuid');
|
|
3847
|
+
* ```
|
|
3848
|
+
*/
|
|
3849
|
+
list(agentUuid: string): Promise<AgentMessageList>;
|
|
3850
|
+
/**
|
|
3851
|
+
* Render one message with placeholders filled
|
|
3852
|
+
*
|
|
3853
|
+
* Resolves with `text: null` when the agent has no message for the key.
|
|
3854
|
+
* Throws `ValidationError` before any request when the key is not a
|
|
3855
|
+
* lowercase dotted key (see `MESSAGE_KEY_PATTERN`).
|
|
3856
|
+
*
|
|
3857
|
+
* @example
|
|
3858
|
+
* ```typescript
|
|
3859
|
+
* const { text } = await client.agents.messages.render('agent-uuid', 'handoff.requested', {
|
|
3860
|
+
* lang: 'es',
|
|
3861
|
+
* vars: { agentName: 'Ana' },
|
|
3862
|
+
* });
|
|
3863
|
+
* ```
|
|
3864
|
+
*/
|
|
3865
|
+
render(agentUuid: string, key: string, options?: AgentMessageRenderOptions): Promise<AgentMessageRenderResult>;
|
|
3866
|
+
}
|
|
3867
|
+
|
|
3770
3868
|
/**
|
|
3771
3869
|
* Agents Resource API
|
|
3772
3870
|
*
|
|
@@ -3782,6 +3880,8 @@ interface StreamImagesResult {
|
|
|
3782
3880
|
*/
|
|
3783
3881
|
declare class AgentsAPI extends BaseResourceAPI {
|
|
3784
3882
|
private readonly getStreamConfig;
|
|
3883
|
+
/** Saved agent messages (p13): `list()` and `render()` */
|
|
3884
|
+
readonly messages: AgentMessagesAPI;
|
|
3785
3885
|
constructor(http: HttpClient, getStreamConfig: () => StreamConfig);
|
|
3786
3886
|
/**
|
|
3787
3887
|
* List all agents in the organization
|
package/dist/kanban/index.d.ts
CHANGED
|
@@ -1179,6 +1179,63 @@ interface ExecuteResponse {
|
|
|
1179
1179
|
/** Initial status */
|
|
1180
1180
|
status: ExecutionStatus;
|
|
1181
1181
|
}
|
|
1182
|
+
/**
|
|
1183
|
+
* Language code an agent message is stored and rendered in (e.g. `en`,
|
|
1184
|
+
* `pt-br`). Each agent sets its own language list; see
|
|
1185
|
+
* `AgentMessageList.languages`. Was `'en' | 'es' | 'id'` before p13.
|
|
1186
|
+
*/
|
|
1187
|
+
type AgentMessageLang = string;
|
|
1188
|
+
/**
|
|
1189
|
+
* One saved agent message (e.g. `handoff.requested`), text per language.
|
|
1190
|
+
*/
|
|
1191
|
+
interface AgentMessage {
|
|
1192
|
+
/** Lowercase dotted key, e.g. `chat.welcome` */
|
|
1193
|
+
key: string;
|
|
1194
|
+
/** Text per language code */
|
|
1195
|
+
text: Partial<Record<AgentMessageLang, string>>;
|
|
1196
|
+
/** `{word}` placeholder names found in any language */
|
|
1197
|
+
placeholders: string[];
|
|
1198
|
+
}
|
|
1199
|
+
/**
|
|
1200
|
+
* Response of `client.agents.messages.list()`
|
|
1201
|
+
*/
|
|
1202
|
+
interface AgentMessageList {
|
|
1203
|
+
/** The resolved agent (a team uuid resolves to its lead agent) */
|
|
1204
|
+
agentUuid: string;
|
|
1205
|
+
/** The agent's saved messages, sorted by key */
|
|
1206
|
+
messages: AgentMessage[];
|
|
1207
|
+
/** Every key the platform knows about, for pickers (saved or not) */
|
|
1208
|
+
knownKeys: string[];
|
|
1209
|
+
/**
|
|
1210
|
+
* The agent's message languages, in display order. Missing from older
|
|
1211
|
+
* servers; fall back to the languages seen in `messages[].text`.
|
|
1212
|
+
*/
|
|
1213
|
+
languages?: AgentMessageLang[];
|
|
1214
|
+
/** The agent's default message language. Missing from older servers; treat as `en`. */
|
|
1215
|
+
defaultLanguage?: AgentMessageLang;
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Options for `client.agents.messages.render()`
|
|
1219
|
+
*/
|
|
1220
|
+
interface AgentMessageRenderOptions {
|
|
1221
|
+
/**
|
|
1222
|
+
* Requested language. Server falls back: exact, then base (`pt-br` to `pt`),
|
|
1223
|
+
* then the agent's default language, then `en`, then the first non-empty text.
|
|
1224
|
+
*/
|
|
1225
|
+
lang?: AgentMessageLang;
|
|
1226
|
+
/** Values for `{word}` placeholders; unknown placeholders are left as-is */
|
|
1227
|
+
vars?: Record<string, string | number>;
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Response of `client.agents.messages.render()`
|
|
1231
|
+
*/
|
|
1232
|
+
interface AgentMessageRenderResult {
|
|
1233
|
+
key: string;
|
|
1234
|
+
/** The language actually rendered (after fallback) */
|
|
1235
|
+
lang: AgentMessageLang;
|
|
1236
|
+
/** Filled text, or `null` when the agent has no message for this key */
|
|
1237
|
+
text: string | null;
|
|
1238
|
+
}
|
|
1182
1239
|
|
|
1183
1240
|
/**
|
|
1184
1241
|
* Image extraction utilities
|
|
@@ -3767,6 +3824,47 @@ interface StreamImagesResult {
|
|
|
3767
3824
|
executionId: string;
|
|
3768
3825
|
}
|
|
3769
3826
|
|
|
3827
|
+
/**
|
|
3828
|
+
* Agent Messages Resource API (p13)
|
|
3829
|
+
*
|
|
3830
|
+
* Read-only access to an agent's saved messages (welcome, handoff, fallback
|
|
3831
|
+
* copy, ...). Reached as `client.agents.messages`.
|
|
3832
|
+
* - list(): the agent's saved messages, every known key, the agent's languages
|
|
3833
|
+
* - render(): one message filled with vars, in a language (server falls back:
|
|
3834
|
+
* exact, base, agent default, en, first non-empty; `lang` says which was used)
|
|
3835
|
+
*/
|
|
3836
|
+
|
|
3837
|
+
declare class AgentMessagesAPI extends BaseResourceAPI {
|
|
3838
|
+
constructor(http: HttpClient);
|
|
3839
|
+
/**
|
|
3840
|
+
* List an agent's saved messages and the known keys
|
|
3841
|
+
*
|
|
3842
|
+
* @param agentUuid - Agent UUID (a team UUID resolves to its lead agent)
|
|
3843
|
+
*
|
|
3844
|
+
* @example
|
|
3845
|
+
* ```typescript
|
|
3846
|
+
* const { messages, knownKeys, languages, defaultLanguage } = await client.agents.messages.list('agent-uuid');
|
|
3847
|
+
* ```
|
|
3848
|
+
*/
|
|
3849
|
+
list(agentUuid: string): Promise<AgentMessageList>;
|
|
3850
|
+
/**
|
|
3851
|
+
* Render one message with placeholders filled
|
|
3852
|
+
*
|
|
3853
|
+
* Resolves with `text: null` when the agent has no message for the key.
|
|
3854
|
+
* Throws `ValidationError` before any request when the key is not a
|
|
3855
|
+
* lowercase dotted key (see `MESSAGE_KEY_PATTERN`).
|
|
3856
|
+
*
|
|
3857
|
+
* @example
|
|
3858
|
+
* ```typescript
|
|
3859
|
+
* const { text } = await client.agents.messages.render('agent-uuid', 'handoff.requested', {
|
|
3860
|
+
* lang: 'es',
|
|
3861
|
+
* vars: { agentName: 'Ana' },
|
|
3862
|
+
* });
|
|
3863
|
+
* ```
|
|
3864
|
+
*/
|
|
3865
|
+
render(agentUuid: string, key: string, options?: AgentMessageRenderOptions): Promise<AgentMessageRenderResult>;
|
|
3866
|
+
}
|
|
3867
|
+
|
|
3770
3868
|
/**
|
|
3771
3869
|
* Agents Resource API
|
|
3772
3870
|
*
|
|
@@ -3782,6 +3880,8 @@ interface StreamImagesResult {
|
|
|
3782
3880
|
*/
|
|
3783
3881
|
declare class AgentsAPI extends BaseResourceAPI {
|
|
3784
3882
|
private readonly getStreamConfig;
|
|
3883
|
+
/** Saved agent messages (p13): `list()` and `render()` */
|
|
3884
|
+
readonly messages: AgentMessagesAPI;
|
|
3785
3885
|
constructor(http: HttpClient, getStreamConfig: () => StreamConfig);
|
|
3786
3886
|
/**
|
|
3787
3887
|
* List all agents in the organization
|
package/dist/kanban/index.js
CHANGED
|
@@ -5410,13 +5410,69 @@ function executionCancelPath(executionId) {
|
|
|
5410
5410
|
return `${EXECUTION_PATH}/${executionId}/cancel`;
|
|
5411
5411
|
}
|
|
5412
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, languages, defaultLanguage } = 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
|
+
|
|
5413
5466
|
// src/resources/agents.ts
|
|
5414
5467
|
var AgentsAPI = class extends BaseResourceAPI {
|
|
5415
5468
|
constructor(http, getStreamConfig) {
|
|
5416
5469
|
super(http, "/api/v1/agents");
|
|
5417
5470
|
this.getStreamConfig = getStreamConfig;
|
|
5471
|
+
this.messages = new AgentMessagesAPI(http);
|
|
5418
5472
|
}
|
|
5419
5473
|
getStreamConfig;
|
|
5474
|
+
/** Saved agent messages (p13): `list()` and `render()` */
|
|
5475
|
+
messages;
|
|
5420
5476
|
// ===== LIST Operations =====
|
|
5421
5477
|
/**
|
|
5422
5478
|
* List all agents in the organization
|