@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/dist/index.mjs
CHANGED
|
@@ -788,7 +788,7 @@ function resolveScopedPlatformClient(client) {
|
|
|
788
788
|
|
|
789
789
|
// src/resources/workspaces.ts
|
|
790
790
|
var WorkspacesResource = class extends WorkspaceScopedResource {
|
|
791
|
-
/** Create a new workspace */
|
|
791
|
+
/** Create a new workspace (unauthenticated — no owner membership created) */
|
|
792
792
|
async create(body) {
|
|
793
793
|
return extractData(
|
|
794
794
|
await this.client.POST("/v1/workspaces", {
|
|
@@ -796,6 +796,14 @@ var WorkspacesResource = class extends WorkspaceScopedResource {
|
|
|
796
796
|
})
|
|
797
797
|
);
|
|
798
798
|
}
|
|
799
|
+
/** Create a workspace for the authenticated user and attach owner access */
|
|
800
|
+
async createSelfService(body) {
|
|
801
|
+
return extractData(
|
|
802
|
+
await this.client.POST("/v1/workspaces/self-service", {
|
|
803
|
+
body
|
|
804
|
+
})
|
|
805
|
+
);
|
|
806
|
+
}
|
|
799
807
|
/** List workspaces accessible to the current API key */
|
|
800
808
|
async list(params) {
|
|
801
809
|
return extractData(
|
|
@@ -1883,10 +1891,47 @@ var ConversationsResource = class extends WorkspaceScopedResource {
|
|
|
1883
1891
|
params: {
|
|
1884
1892
|
path: { workspace_id: this.workspaceId, conversation_id: conversationId }
|
|
1885
1893
|
},
|
|
1886
|
-
body: request
|
|
1894
|
+
body: request,
|
|
1895
|
+
headers: { Accept: "application/json" }
|
|
1887
1896
|
})
|
|
1888
1897
|
);
|
|
1889
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
|
+
}
|
|
1890
1935
|
/** Build the real-time text WebSocket URL for browser or custom clients. */
|
|
1891
1936
|
textStreamUrl(params) {
|
|
1892
1937
|
const url = buildTextStreamUrl({
|