@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/teams/index.d.cts
CHANGED
|
@@ -393,6 +393,63 @@ interface ExecuteResponse {
|
|
|
393
393
|
/** Initial status */
|
|
394
394
|
status: ExecutionStatus;
|
|
395
395
|
}
|
|
396
|
+
/**
|
|
397
|
+
* Language code an agent message is stored and rendered in (e.g. `en`,
|
|
398
|
+
* `pt-br`). Each agent sets its own language list; see
|
|
399
|
+
* `AgentMessageList.languages`. Was `'en' | 'es' | 'id'` before p13.
|
|
400
|
+
*/
|
|
401
|
+
type AgentMessageLang = string;
|
|
402
|
+
/**
|
|
403
|
+
* One saved agent message (e.g. `handoff.requested`), text per language.
|
|
404
|
+
*/
|
|
405
|
+
interface AgentMessage {
|
|
406
|
+
/** Lowercase dotted key, e.g. `chat.welcome` */
|
|
407
|
+
key: string;
|
|
408
|
+
/** Text per language code */
|
|
409
|
+
text: Partial<Record<AgentMessageLang, string>>;
|
|
410
|
+
/** `{word}` placeholder names found in any language */
|
|
411
|
+
placeholders: string[];
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Response of `client.agents.messages.list()`
|
|
415
|
+
*/
|
|
416
|
+
interface AgentMessageList {
|
|
417
|
+
/** The resolved agent (a team uuid resolves to its lead agent) */
|
|
418
|
+
agentUuid: string;
|
|
419
|
+
/** The agent's saved messages, sorted by key */
|
|
420
|
+
messages: AgentMessage[];
|
|
421
|
+
/** Every key the platform knows about, for pickers (saved or not) */
|
|
422
|
+
knownKeys: string[];
|
|
423
|
+
/**
|
|
424
|
+
* The agent's message languages, in display order. Missing from older
|
|
425
|
+
* servers; fall back to the languages seen in `messages[].text`.
|
|
426
|
+
*/
|
|
427
|
+
languages?: AgentMessageLang[];
|
|
428
|
+
/** The agent's default message language. Missing from older servers; treat as `en`. */
|
|
429
|
+
defaultLanguage?: AgentMessageLang;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Options for `client.agents.messages.render()`
|
|
433
|
+
*/
|
|
434
|
+
interface AgentMessageRenderOptions {
|
|
435
|
+
/**
|
|
436
|
+
* Requested language. Server falls back: exact, then base (`pt-br` to `pt`),
|
|
437
|
+
* then the agent's default language, then `en`, then the first non-empty text.
|
|
438
|
+
*/
|
|
439
|
+
lang?: AgentMessageLang;
|
|
440
|
+
/** Values for `{word}` placeholders; unknown placeholders are left as-is */
|
|
441
|
+
vars?: Record<string, string | number>;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Response of `client.agents.messages.render()`
|
|
445
|
+
*/
|
|
446
|
+
interface AgentMessageRenderResult {
|
|
447
|
+
key: string;
|
|
448
|
+
/** The language actually rendered (after fallback) */
|
|
449
|
+
lang: AgentMessageLang;
|
|
450
|
+
/** Filled text, or `null` when the agent has no message for this key */
|
|
451
|
+
text: string | null;
|
|
452
|
+
}
|
|
396
453
|
|
|
397
454
|
/**
|
|
398
455
|
* Skill types
|
|
@@ -1649,6 +1706,47 @@ interface StreamImagesResult {
|
|
|
1649
1706
|
executionId: string;
|
|
1650
1707
|
}
|
|
1651
1708
|
|
|
1709
|
+
/**
|
|
1710
|
+
* Agent Messages Resource API (p13)
|
|
1711
|
+
*
|
|
1712
|
+
* Read-only access to an agent's saved messages (welcome, handoff, fallback
|
|
1713
|
+
* copy, ...). Reached as `client.agents.messages`.
|
|
1714
|
+
* - list(): the agent's saved messages, every known key, the agent's languages
|
|
1715
|
+
* - render(): one message filled with vars, in a language (server falls back:
|
|
1716
|
+
* exact, base, agent default, en, first non-empty; `lang` says which was used)
|
|
1717
|
+
*/
|
|
1718
|
+
|
|
1719
|
+
declare class AgentMessagesAPI extends BaseResourceAPI {
|
|
1720
|
+
constructor(http: HttpClient);
|
|
1721
|
+
/**
|
|
1722
|
+
* List an agent's saved messages and the known keys
|
|
1723
|
+
*
|
|
1724
|
+
* @param agentUuid - Agent UUID (a team UUID resolves to its lead agent)
|
|
1725
|
+
*
|
|
1726
|
+
* @example
|
|
1727
|
+
* ```typescript
|
|
1728
|
+
* const { messages, knownKeys, languages, defaultLanguage } = await client.agents.messages.list('agent-uuid');
|
|
1729
|
+
* ```
|
|
1730
|
+
*/
|
|
1731
|
+
list(agentUuid: string): Promise<AgentMessageList>;
|
|
1732
|
+
/**
|
|
1733
|
+
* Render one message with placeholders filled
|
|
1734
|
+
*
|
|
1735
|
+
* Resolves with `text: null` when the agent has no message for the key.
|
|
1736
|
+
* Throws `ValidationError` before any request when the key is not a
|
|
1737
|
+
* lowercase dotted key (see `MESSAGE_KEY_PATTERN`).
|
|
1738
|
+
*
|
|
1739
|
+
* @example
|
|
1740
|
+
* ```typescript
|
|
1741
|
+
* const { text } = await client.agents.messages.render('agent-uuid', 'handoff.requested', {
|
|
1742
|
+
* lang: 'es',
|
|
1743
|
+
* vars: { agentName: 'Ana' },
|
|
1744
|
+
* });
|
|
1745
|
+
* ```
|
|
1746
|
+
*/
|
|
1747
|
+
render(agentUuid: string, key: string, options?: AgentMessageRenderOptions): Promise<AgentMessageRenderResult>;
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1652
1750
|
/**
|
|
1653
1751
|
* Agents Resource API
|
|
1654
1752
|
*
|
|
@@ -1664,6 +1762,8 @@ interface StreamImagesResult {
|
|
|
1664
1762
|
*/
|
|
1665
1763
|
declare class AgentsAPI extends BaseResourceAPI {
|
|
1666
1764
|
private readonly getStreamConfig;
|
|
1765
|
+
/** Saved agent messages (p13): `list()` and `render()` */
|
|
1766
|
+
readonly messages: AgentMessagesAPI;
|
|
1667
1767
|
constructor(http: HttpClient, getStreamConfig: () => StreamConfig);
|
|
1668
1768
|
/**
|
|
1669
1769
|
* List all agents in the organization
|
package/dist/teams/index.d.ts
CHANGED
|
@@ -393,6 +393,63 @@ interface ExecuteResponse {
|
|
|
393
393
|
/** Initial status */
|
|
394
394
|
status: ExecutionStatus;
|
|
395
395
|
}
|
|
396
|
+
/**
|
|
397
|
+
* Language code an agent message is stored and rendered in (e.g. `en`,
|
|
398
|
+
* `pt-br`). Each agent sets its own language list; see
|
|
399
|
+
* `AgentMessageList.languages`. Was `'en' | 'es' | 'id'` before p13.
|
|
400
|
+
*/
|
|
401
|
+
type AgentMessageLang = string;
|
|
402
|
+
/**
|
|
403
|
+
* One saved agent message (e.g. `handoff.requested`), text per language.
|
|
404
|
+
*/
|
|
405
|
+
interface AgentMessage {
|
|
406
|
+
/** Lowercase dotted key, e.g. `chat.welcome` */
|
|
407
|
+
key: string;
|
|
408
|
+
/** Text per language code */
|
|
409
|
+
text: Partial<Record<AgentMessageLang, string>>;
|
|
410
|
+
/** `{word}` placeholder names found in any language */
|
|
411
|
+
placeholders: string[];
|
|
412
|
+
}
|
|
413
|
+
/**
|
|
414
|
+
* Response of `client.agents.messages.list()`
|
|
415
|
+
*/
|
|
416
|
+
interface AgentMessageList {
|
|
417
|
+
/** The resolved agent (a team uuid resolves to its lead agent) */
|
|
418
|
+
agentUuid: string;
|
|
419
|
+
/** The agent's saved messages, sorted by key */
|
|
420
|
+
messages: AgentMessage[];
|
|
421
|
+
/** Every key the platform knows about, for pickers (saved or not) */
|
|
422
|
+
knownKeys: string[];
|
|
423
|
+
/**
|
|
424
|
+
* The agent's message languages, in display order. Missing from older
|
|
425
|
+
* servers; fall back to the languages seen in `messages[].text`.
|
|
426
|
+
*/
|
|
427
|
+
languages?: AgentMessageLang[];
|
|
428
|
+
/** The agent's default message language. Missing from older servers; treat as `en`. */
|
|
429
|
+
defaultLanguage?: AgentMessageLang;
|
|
430
|
+
}
|
|
431
|
+
/**
|
|
432
|
+
* Options for `client.agents.messages.render()`
|
|
433
|
+
*/
|
|
434
|
+
interface AgentMessageRenderOptions {
|
|
435
|
+
/**
|
|
436
|
+
* Requested language. Server falls back: exact, then base (`pt-br` to `pt`),
|
|
437
|
+
* then the agent's default language, then `en`, then the first non-empty text.
|
|
438
|
+
*/
|
|
439
|
+
lang?: AgentMessageLang;
|
|
440
|
+
/** Values for `{word}` placeholders; unknown placeholders are left as-is */
|
|
441
|
+
vars?: Record<string, string | number>;
|
|
442
|
+
}
|
|
443
|
+
/**
|
|
444
|
+
* Response of `client.agents.messages.render()`
|
|
445
|
+
*/
|
|
446
|
+
interface AgentMessageRenderResult {
|
|
447
|
+
key: string;
|
|
448
|
+
/** The language actually rendered (after fallback) */
|
|
449
|
+
lang: AgentMessageLang;
|
|
450
|
+
/** Filled text, or `null` when the agent has no message for this key */
|
|
451
|
+
text: string | null;
|
|
452
|
+
}
|
|
396
453
|
|
|
397
454
|
/**
|
|
398
455
|
* Skill types
|
|
@@ -1649,6 +1706,47 @@ interface StreamImagesResult {
|
|
|
1649
1706
|
executionId: string;
|
|
1650
1707
|
}
|
|
1651
1708
|
|
|
1709
|
+
/**
|
|
1710
|
+
* Agent Messages Resource API (p13)
|
|
1711
|
+
*
|
|
1712
|
+
* Read-only access to an agent's saved messages (welcome, handoff, fallback
|
|
1713
|
+
* copy, ...). Reached as `client.agents.messages`.
|
|
1714
|
+
* - list(): the agent's saved messages, every known key, the agent's languages
|
|
1715
|
+
* - render(): one message filled with vars, in a language (server falls back:
|
|
1716
|
+
* exact, base, agent default, en, first non-empty; `lang` says which was used)
|
|
1717
|
+
*/
|
|
1718
|
+
|
|
1719
|
+
declare class AgentMessagesAPI extends BaseResourceAPI {
|
|
1720
|
+
constructor(http: HttpClient);
|
|
1721
|
+
/**
|
|
1722
|
+
* List an agent's saved messages and the known keys
|
|
1723
|
+
*
|
|
1724
|
+
* @param agentUuid - Agent UUID (a team UUID resolves to its lead agent)
|
|
1725
|
+
*
|
|
1726
|
+
* @example
|
|
1727
|
+
* ```typescript
|
|
1728
|
+
* const { messages, knownKeys, languages, defaultLanguage } = await client.agents.messages.list('agent-uuid');
|
|
1729
|
+
* ```
|
|
1730
|
+
*/
|
|
1731
|
+
list(agentUuid: string): Promise<AgentMessageList>;
|
|
1732
|
+
/**
|
|
1733
|
+
* Render one message with placeholders filled
|
|
1734
|
+
*
|
|
1735
|
+
* Resolves with `text: null` when the agent has no message for the key.
|
|
1736
|
+
* Throws `ValidationError` before any request when the key is not a
|
|
1737
|
+
* lowercase dotted key (see `MESSAGE_KEY_PATTERN`).
|
|
1738
|
+
*
|
|
1739
|
+
* @example
|
|
1740
|
+
* ```typescript
|
|
1741
|
+
* const { text } = await client.agents.messages.render('agent-uuid', 'handoff.requested', {
|
|
1742
|
+
* lang: 'es',
|
|
1743
|
+
* vars: { agentName: 'Ana' },
|
|
1744
|
+
* });
|
|
1745
|
+
* ```
|
|
1746
|
+
*/
|
|
1747
|
+
render(agentUuid: string, key: string, options?: AgentMessageRenderOptions): Promise<AgentMessageRenderResult>;
|
|
1748
|
+
}
|
|
1749
|
+
|
|
1652
1750
|
/**
|
|
1653
1751
|
* Agents Resource API
|
|
1654
1752
|
*
|
|
@@ -1664,6 +1762,8 @@ interface StreamImagesResult {
|
|
|
1664
1762
|
*/
|
|
1665
1763
|
declare class AgentsAPI extends BaseResourceAPI {
|
|
1666
1764
|
private readonly getStreamConfig;
|
|
1765
|
+
/** Saved agent messages (p13): `list()` and `render()` */
|
|
1766
|
+
readonly messages: AgentMessagesAPI;
|
|
1667
1767
|
constructor(http: HttpClient, getStreamConfig: () => StreamConfig);
|
|
1668
1768
|
/**
|
|
1669
1769
|
* List all agents in the organization
|
package/dist/teams/index.js
CHANGED
|
@@ -1810,13 +1810,69 @@ function executionCancelPath(executionId) {
|
|
|
1810
1810
|
return `${EXECUTION_PATH}/${executionId}/cancel`;
|
|
1811
1811
|
}
|
|
1812
1812
|
|
|
1813
|
+
// src/utils/message-key.ts
|
|
1814
|
+
var MESSAGE_KEY_PATTERN = /^[a-z][a-z0-9_]*(\.[a-z0-9_]+)+$/;
|
|
1815
|
+
function isValidMessageKey(key) {
|
|
1816
|
+
return MESSAGE_KEY_PATTERN.test(key);
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
// src/resources/agent-messages.ts
|
|
1820
|
+
var AgentMessagesAPI = class extends BaseResourceAPI {
|
|
1821
|
+
constructor(http) {
|
|
1822
|
+
super(http, "/api/v1/agents");
|
|
1823
|
+
}
|
|
1824
|
+
/**
|
|
1825
|
+
* List an agent's saved messages and the known keys
|
|
1826
|
+
*
|
|
1827
|
+
* @param agentUuid - Agent UUID (a team UUID resolves to its lead agent)
|
|
1828
|
+
*
|
|
1829
|
+
* @example
|
|
1830
|
+
* ```typescript
|
|
1831
|
+
* const { messages, knownKeys, languages, defaultLanguage } = await client.agents.messages.list('agent-uuid');
|
|
1832
|
+
* ```
|
|
1833
|
+
*/
|
|
1834
|
+
async list(agentUuid) {
|
|
1835
|
+
return this.httpGet(`/${agentUuid}/messages`);
|
|
1836
|
+
}
|
|
1837
|
+
/**
|
|
1838
|
+
* Render one message with placeholders filled
|
|
1839
|
+
*
|
|
1840
|
+
* Resolves with `text: null` when the agent has no message for the key.
|
|
1841
|
+
* Throws `ValidationError` before any request when the key is not a
|
|
1842
|
+
* lowercase dotted key (see `MESSAGE_KEY_PATTERN`).
|
|
1843
|
+
*
|
|
1844
|
+
* @example
|
|
1845
|
+
* ```typescript
|
|
1846
|
+
* const { text } = await client.agents.messages.render('agent-uuid', 'handoff.requested', {
|
|
1847
|
+
* lang: 'es',
|
|
1848
|
+
* vars: { agentName: 'Ana' },
|
|
1849
|
+
* });
|
|
1850
|
+
* ```
|
|
1851
|
+
*/
|
|
1852
|
+
async render(agentUuid, key, options = {}) {
|
|
1853
|
+
if (!isValidMessageKey(key)) {
|
|
1854
|
+
throw new ValidationError(`Invalid message key "${key}"`, [
|
|
1855
|
+
{ field: "key", message: "Must be a lowercase dotted key, e.g. chat.welcome" }
|
|
1856
|
+
]);
|
|
1857
|
+
}
|
|
1858
|
+
return this.httpPost(`/${agentUuid}/messages/render`, {
|
|
1859
|
+
key,
|
|
1860
|
+
...options.lang ? { lang: options.lang } : {},
|
|
1861
|
+
...options.vars ? { vars: options.vars } : {}
|
|
1862
|
+
});
|
|
1863
|
+
}
|
|
1864
|
+
};
|
|
1865
|
+
|
|
1813
1866
|
// src/resources/agents.ts
|
|
1814
1867
|
var AgentsAPI = class extends BaseResourceAPI {
|
|
1815
1868
|
constructor(http, getStreamConfig) {
|
|
1816
1869
|
super(http, "/api/v1/agents");
|
|
1817
1870
|
this.getStreamConfig = getStreamConfig;
|
|
1871
|
+
this.messages = new AgentMessagesAPI(http);
|
|
1818
1872
|
}
|
|
1819
1873
|
getStreamConfig;
|
|
1874
|
+
/** Saved agent messages (p13): `list()` and `render()` */
|
|
1875
|
+
messages;
|
|
1820
1876
|
// ===== LIST Operations =====
|
|
1821
1877
|
/**
|
|
1822
1878
|
* List all agents in the organization
|