@amigo-ai/platform-sdk 0.17.3 → 0.19.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/api.md +1 -0
- package/dist/index.cjs +38 -1
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +38 -1
- package/dist/index.mjs.map +2 -2
- package/dist/resources/conversations.js +34 -0
- package/dist/resources/conversations.js.map +1 -1
- package/dist/types/generated/api.d.ts +615 -31
- package/dist/types/generated/api.d.ts.map +1 -1
- package/dist/types/resources/billing.d.ts +4 -0
- package/dist/types/resources/billing.d.ts.map +1 -1
- package/dist/types/resources/conversations.d.ts +29 -0
- package/dist/types/resources/conversations.d.ts.map +1 -1
- package/dist/types/resources/functions.d.ts.map +1 -1
- package/dist/types/resources/integrations.d.ts +140 -10
- package/dist/types/resources/integrations.d.ts.map +1 -1
- package/dist/types/resources/metrics.d.ts.map +1 -1
- package/dist/types/resources/settings.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1891,10 +1891,47 @@ var ConversationsResource = class extends WorkspaceScopedResource {
|
|
|
1891
1891
|
params: {
|
|
1892
1892
|
path: { workspace_id: this.workspaceId, conversation_id: conversationId }
|
|
1893
1893
|
},
|
|
1894
|
-
body: request
|
|
1894
|
+
body: request,
|
|
1895
|
+
headers: { Accept: "application/json" }
|
|
1895
1896
|
})
|
|
1896
1897
|
);
|
|
1897
1898
|
}
|
|
1899
|
+
/**
|
|
1900
|
+
* Send a message and receive the agent's response as an SSE stream.
|
|
1901
|
+
*
|
|
1902
|
+
* Returns a `ReadableStream` of SSE bytes. Use `EventSourceParserStream`
|
|
1903
|
+
* (from `eventsource-parser/stream`) to parse into typed `TurnStreamEvent`.
|
|
1904
|
+
*
|
|
1905
|
+
* @example
|
|
1906
|
+
* ```ts
|
|
1907
|
+
* const stream = await client.conversations.createTurnStream(convId, { message: "Hello" });
|
|
1908
|
+
* const events = stream
|
|
1909
|
+
* .pipeThrough(new TextDecoderStream())
|
|
1910
|
+
* .pipeThrough(new EventSourceParserStream());
|
|
1911
|
+
* for await (const event of events) {
|
|
1912
|
+
* const parsed = JSON.parse(event.data) as TurnStreamEvent;
|
|
1913
|
+
* if (parsed.event === "token") console.log(parsed.text);
|
|
1914
|
+
* }
|
|
1915
|
+
* ```
|
|
1916
|
+
*/
|
|
1917
|
+
async createTurnStream(conversationId, request, options) {
|
|
1918
|
+
const result = await this.client.POST(
|
|
1919
|
+
"/v1/{workspace_id}/conversations/{conversation_id}/turns",
|
|
1920
|
+
{
|
|
1921
|
+
params: {
|
|
1922
|
+
path: { workspace_id: this.workspaceId, conversation_id: conversationId }
|
|
1923
|
+
},
|
|
1924
|
+
body: request,
|
|
1925
|
+
headers: { Accept: "text/event-stream" },
|
|
1926
|
+
parseAs: "stream",
|
|
1927
|
+
signal: options?.signal
|
|
1928
|
+
}
|
|
1929
|
+
);
|
|
1930
|
+
if (result.error !== void 0) {
|
|
1931
|
+
throw new Error(`API error: ${JSON.stringify(result.error)}`);
|
|
1932
|
+
}
|
|
1933
|
+
return result.data;
|
|
1934
|
+
}
|
|
1898
1935
|
/** Build the real-time text WebSocket URL for browser or custom clients. */
|
|
1899
1936
|
textStreamUrl(params) {
|
|
1900
1937
|
const url = buildTextStreamUrl({
|