@amigo-ai/platform-sdk 0.17.2 → 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 +2 -0
- package/dist/index.cjs +47 -2
- package/dist/index.cjs.map +2 -2
- package/dist/index.mjs +47 -2
- package/dist/index.mjs.map +2 -2
- package/dist/resources/conversations.js +34 -0
- package/dist/resources/conversations.js.map +1 -1
- package/dist/resources/workspaces.js +7 -1
- package/dist/resources/workspaces.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/dist/types/resources/workspaces.d.ts +14 -1
- package/dist/types/resources/workspaces.d.ts.map +1 -1
- package/package.json +1 -1
package/api.md
CHANGED
|
@@ -67,6 +67,7 @@ All workspace-scoped resources also expose `withOptions(options)`.
|
|
|
67
67
|
### `workspaces`
|
|
68
68
|
|
|
69
69
|
- `create`
|
|
70
|
+
- `createSelfService`
|
|
70
71
|
- `list`
|
|
71
72
|
- `listAutoPaging`
|
|
72
73
|
- `get`
|
|
@@ -238,6 +239,7 @@ All workspace-scoped resources also expose `withOptions(options)`.
|
|
|
238
239
|
- `get`
|
|
239
240
|
- `close`
|
|
240
241
|
- `createTurn`
|
|
242
|
+
- `createTurnStream`
|
|
241
243
|
- `textStreamUrl`
|
|
242
244
|
|
|
243
245
|
### `phoneNumbers`
|
package/dist/index.cjs
CHANGED
|
@@ -881,7 +881,7 @@ function resolveScopedPlatformClient(client) {
|
|
|
881
881
|
|
|
882
882
|
// src/resources/workspaces.ts
|
|
883
883
|
var WorkspacesResource = class extends WorkspaceScopedResource {
|
|
884
|
-
/** Create a new workspace */
|
|
884
|
+
/** Create a new workspace (unauthenticated — no owner membership created) */
|
|
885
885
|
async create(body) {
|
|
886
886
|
return extractData(
|
|
887
887
|
await this.client.POST("/v1/workspaces", {
|
|
@@ -889,6 +889,14 @@ var WorkspacesResource = class extends WorkspaceScopedResource {
|
|
|
889
889
|
})
|
|
890
890
|
);
|
|
891
891
|
}
|
|
892
|
+
/** Create a workspace for the authenticated user and attach owner access */
|
|
893
|
+
async createSelfService(body) {
|
|
894
|
+
return extractData(
|
|
895
|
+
await this.client.POST("/v1/workspaces/self-service", {
|
|
896
|
+
body
|
|
897
|
+
})
|
|
898
|
+
);
|
|
899
|
+
}
|
|
892
900
|
/** List workspaces accessible to the current API key */
|
|
893
901
|
async list(params) {
|
|
894
902
|
return extractData(
|
|
@@ -1976,10 +1984,47 @@ var ConversationsResource = class extends WorkspaceScopedResource {
|
|
|
1976
1984
|
params: {
|
|
1977
1985
|
path: { workspace_id: this.workspaceId, conversation_id: conversationId }
|
|
1978
1986
|
},
|
|
1979
|
-
body: request
|
|
1987
|
+
body: request,
|
|
1988
|
+
headers: { Accept: "application/json" }
|
|
1980
1989
|
})
|
|
1981
1990
|
);
|
|
1982
1991
|
}
|
|
1992
|
+
/**
|
|
1993
|
+
* Send a message and receive the agent's response as an SSE stream.
|
|
1994
|
+
*
|
|
1995
|
+
* Returns a `ReadableStream` of SSE bytes. Use `EventSourceParserStream`
|
|
1996
|
+
* (from `eventsource-parser/stream`) to parse into typed `TurnStreamEvent`.
|
|
1997
|
+
*
|
|
1998
|
+
* @example
|
|
1999
|
+
* ```ts
|
|
2000
|
+
* const stream = await client.conversations.createTurnStream(convId, { message: "Hello" });
|
|
2001
|
+
* const events = stream
|
|
2002
|
+
* .pipeThrough(new TextDecoderStream())
|
|
2003
|
+
* .pipeThrough(new EventSourceParserStream());
|
|
2004
|
+
* for await (const event of events) {
|
|
2005
|
+
* const parsed = JSON.parse(event.data) as TurnStreamEvent;
|
|
2006
|
+
* if (parsed.event === "token") console.log(parsed.text);
|
|
2007
|
+
* }
|
|
2008
|
+
* ```
|
|
2009
|
+
*/
|
|
2010
|
+
async createTurnStream(conversationId, request, options) {
|
|
2011
|
+
const result = await this.client.POST(
|
|
2012
|
+
"/v1/{workspace_id}/conversations/{conversation_id}/turns",
|
|
2013
|
+
{
|
|
2014
|
+
params: {
|
|
2015
|
+
path: { workspace_id: this.workspaceId, conversation_id: conversationId }
|
|
2016
|
+
},
|
|
2017
|
+
body: request,
|
|
2018
|
+
headers: { Accept: "text/event-stream" },
|
|
2019
|
+
parseAs: "stream",
|
|
2020
|
+
signal: options?.signal
|
|
2021
|
+
}
|
|
2022
|
+
);
|
|
2023
|
+
if (result.error !== void 0) {
|
|
2024
|
+
throw new Error(`API error: ${JSON.stringify(result.error)}`);
|
|
2025
|
+
}
|
|
2026
|
+
return result.data;
|
|
2027
|
+
}
|
|
1983
2028
|
/** Build the real-time text WebSocket URL for browser or custom clients. */
|
|
1984
2029
|
textStreamUrl(params) {
|
|
1985
2030
|
const url = buildTextStreamUrl({
|