@happyrobot-ai/sdk 0.1.5 → 0.1.7
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/README.md +117 -0
- package/chat/index.d.ts +17 -0
- package/chat/index.js +20 -0
- package/chat/index.mjs +3 -0
- package/chat-client.mjs +1 -2
- package/client.d.ts +3 -0
- package/client.js +4 -0
- package/client.mjs +1 -2
- package/core/errors.mjs +1 -2
- package/core/http.mjs +1 -2
- package/core/pagination.mjs +1 -2
- package/core/sse.mjs +1 -2
- package/core/types.mjs +0 -1
- package/helpers/index.mjs +1 -2
- package/helpers/template-workflows.mjs +1 -2
- package/helpers/trigger-and-wait.mjs +1 -2
- package/helpers/voice-agent.mjs +1 -2
- package/index.d.ts +2 -2
- package/index.js +3 -3
- package/index.mjs +3 -4
- package/package.json +19 -1
- package/resources/adversarial-suites.mjs +1 -2
- package/resources/adversarial-tests.mjs +1 -2
- package/resources/api-key.mjs +1 -2
- package/resources/artifacts.mjs +1 -2
- package/resources/audit-remarks.mjs +1 -2
- package/resources/billing.mjs +1 -2
- package/resources/chat.mjs +1 -2
- package/resources/contacts.mjs +1 -2
- package/resources/custom-evals.mjs +1 -2
- package/resources/integrations.mjs +1 -2
- package/resources/issues.mjs +1 -2
- package/resources/knowledge-bases.mjs +1 -2
- package/resources/mcp.mjs +1 -2
- package/resources/messages.mjs +1 -2
- package/resources/nodes.mjs +1 -2
- package/resources/northstars.mjs +1 -2
- package/resources/phone-numbers.mjs +1 -2
- package/resources/runs.mjs +1 -2
- package/resources/sessions.mjs +1 -2
- package/resources/sip-trunks.mjs +1 -2
- package/resources/variables.mjs +1 -2
- package/resources/versions.mjs +1 -2
- package/resources/voice.d.ts +29 -0
- package/resources/voice.js +40 -0
- package/resources/voice.mjs +3 -0
- package/resources/workflow-folders.mjs +1 -2
- package/resources/workflows.mjs +1 -2
- package/types/adversarial-suites.types.d.ts +26 -0
- package/types/adversarial-suites.types.js +6 -0
- package/types/adversarial-suites.types.mjs +1 -0
- package/types/adversarial-tests.types.d.ts +21 -0
- package/types/adversarial-tests.types.js +6 -0
- package/types/adversarial-tests.types.mjs +1 -0
- package/types/artifacts.types.d.ts +4 -0
- package/types/artifacts.types.js +3 -0
- package/types/artifacts.types.mjs +1 -0
- package/types/audit-remarks.types.d.ts +19 -0
- package/types/audit-remarks.types.js +6 -0
- package/types/audit-remarks.types.mjs +1 -0
- package/types/chat.types.d.ts +146 -0
- package/types/chat.types.js +3 -0
- package/types/chat.types.mjs +1 -0
- package/types/common.types.d.ts +19 -0
- package/types/common.types.js +7 -0
- package/types/common.types.mjs +1 -0
- package/types/contacts.types.d.ts +6 -0
- package/types/contacts.types.js +6 -0
- package/types/contacts.types.mjs +1 -0
- package/types/custom-evals.types.d.ts +19 -0
- package/types/custom-evals.types.js +6 -0
- package/types/custom-evals.types.mjs +1 -0
- package/types/integrations.types.d.ts +45 -0
- package/types/integrations.types.js +6 -0
- package/types/integrations.types.mjs +1 -0
- package/types/issues.types.d.ts +11 -0
- package/types/issues.types.js +6 -0
- package/types/issues.types.mjs +1 -0
- package/types/knowledge-bases.types.d.ts +21 -0
- package/types/knowledge-bases.types.js +7 -0
- package/types/knowledge-bases.types.mjs +1 -0
- package/types/mcp.types.d.ts +10 -0
- package/types/mcp.types.js +6 -0
- package/types/mcp.types.mjs +1 -0
- package/types/messages.types.d.ts +9 -0
- package/types/messages.types.js +6 -0
- package/types/messages.types.mjs +1 -0
- package/types/nodes.types.d.ts +12 -0
- package/types/nodes.types.js +6 -0
- package/types/nodes.types.mjs +1 -0
- package/types/northstars.types.d.ts +18 -0
- package/types/northstars.types.js +6 -0
- package/types/northstars.types.mjs +1 -0
- package/types/phone-numbers.types.d.ts +24 -0
- package/types/phone-numbers.types.js +6 -0
- package/types/phone-numbers.types.mjs +1 -0
- package/types/runs.types.d.ts +16 -0
- package/types/runs.types.js +6 -0
- package/types/runs.types.mjs +1 -0
- package/types/sessions.types.d.ts +51 -0
- package/types/sessions.types.js +6 -0
- package/types/sessions.types.mjs +1 -0
- package/types/sip-trunks.types.d.ts +11 -0
- package/types/sip-trunks.types.js +6 -0
- package/types/sip-trunks.types.mjs +1 -0
- package/types/variables.types.d.ts +10 -0
- package/types/variables.types.js +6 -0
- package/types/variables.types.mjs +1 -0
- package/types/versions.types.d.ts +22 -0
- package/types/versions.types.js +6 -0
- package/types/versions.types.mjs +1 -0
- package/types/voice.types.d.ts +13 -0
- package/types/voice.types.js +3 -0
- package/types/voice.types.mjs +1 -0
- package/types/workflow-folders.types.d.ts +9 -0
- package/types/workflow-folders.types.js +6 -0
- package/types/workflow-folders.types.mjs +1 -0
- package/types/workflows.types.d.ts +24 -0
- package/types/workflows.types.js +7 -0
- package/types/workflows.types.mjs +1 -0
- package/voice/index.d.ts +22 -0
- package/voice/index.js +25 -0
- package/voice/index.mjs +3 -0
- package/voice-client.d.ts +87 -0
- package/voice-client.js +148 -0
- package/voice-client.mjs +3 -0
package/README.md
CHANGED
|
@@ -12,6 +12,18 @@ pnpm add @happyrobot-ai/sdk
|
|
|
12
12
|
yarn add @happyrobot-ai/sdk
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
+
**Optional:** If you plan to use `HappyRobotVoiceClient` (imported from `@happyrobot-ai/sdk/voice`) for browser-side voice calls, also install `livekit-client`:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install livekit-client
|
|
19
|
+
# or
|
|
20
|
+
pnpm add livekit-client
|
|
21
|
+
# or
|
|
22
|
+
yarn add livekit-client
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
This is only needed for voice — all other SDK features work without it.
|
|
26
|
+
|
|
15
27
|
## Quick Start
|
|
16
28
|
|
|
17
29
|
```ts
|
|
@@ -123,6 +135,7 @@ const { workflow } = await createFromTemplate(client, {
|
|
|
123
135
|
| `client.issues` | `IssuesResource` | Quality issue (flag) status management |
|
|
124
136
|
| `client.auditRemarks` | `AuditRemarksResource` | Audit remark feedback management |
|
|
125
137
|
| `client.chat` | `ChatResource` | Chat session management, messaging, and file uploads |
|
|
138
|
+
| `client.voice` | `VoiceResource` | Voice call token creation |
|
|
126
139
|
|
|
127
140
|
---
|
|
128
141
|
|
|
@@ -870,6 +883,110 @@ await connection.sendMessage({
|
|
|
870
883
|
|
|
871
884
|
---
|
|
872
885
|
|
|
886
|
+
## Voice (`client.voice` + `HappyRobotVoiceClient`)
|
|
887
|
+
|
|
888
|
+
Build browser-side voice calls with AI agents powered by your workflows. Uses the same two-tier auth model as chat:
|
|
889
|
+
|
|
890
|
+
1. **Your server** creates a scoped LiveKit token using the API key (keeps it secret)
|
|
891
|
+
2. **Your browser** uses `HappyRobotVoiceClient` with that token to connect via WebRTC
|
|
892
|
+
|
|
893
|
+
### Server-side: Create a voice token
|
|
894
|
+
|
|
895
|
+
```ts
|
|
896
|
+
// --- YOUR SERVER (e.g. Next.js API route, Express handler) ---
|
|
897
|
+
import { HappyRobotClient } from "@happyrobot-ai/sdk";
|
|
898
|
+
|
|
899
|
+
const client = new HappyRobotClient({ apiKey: process.env.HAPPYROBOT_API_KEY });
|
|
900
|
+
|
|
901
|
+
app.post("/api/voice-token", async (req, res) => {
|
|
902
|
+
const result = await client.voice.createToken({
|
|
903
|
+
workflow_id: "your-workflow-id",
|
|
904
|
+
data: { customer_name: "John" }, // optional — passed to the agent
|
|
905
|
+
});
|
|
906
|
+
res.json(result); // { url, token, room_name, run_id }
|
|
907
|
+
});
|
|
908
|
+
```
|
|
909
|
+
|
|
910
|
+
### Browser-side: `HappyRobotVoiceClient`
|
|
911
|
+
|
|
912
|
+
```ts
|
|
913
|
+
// --- YOUR BROWSER CODE (React, Vue, vanilla JS, etc.) ---
|
|
914
|
+
import { HappyRobotVoiceClient } from "@happyrobot-ai/sdk/voice";
|
|
915
|
+
|
|
916
|
+
// 1. Get a voice token from your server
|
|
917
|
+
const { url, token } = await fetch("/api/voice-token", { method: "POST" }).then(r => r.json());
|
|
918
|
+
|
|
919
|
+
// 2. Create the voice client and connect
|
|
920
|
+
const voice = new HappyRobotVoiceClient({ url, token });
|
|
921
|
+
const connection = await voice.connect({
|
|
922
|
+
onConnected: () => {
|
|
923
|
+
// Call started — microphone is automatically enabled
|
|
924
|
+
},
|
|
925
|
+
onAgentConnected: (participant) => {
|
|
926
|
+
// AI agent joined the room
|
|
927
|
+
console.log("Agent:", participant.identity);
|
|
928
|
+
},
|
|
929
|
+
onDisconnected: (reason) => {
|
|
930
|
+
// Call ended
|
|
931
|
+
},
|
|
932
|
+
onReconnecting: () => {
|
|
933
|
+
// Connection temporarily lost
|
|
934
|
+
},
|
|
935
|
+
onReconnected: () => {
|
|
936
|
+
// Successfully reconnected
|
|
937
|
+
},
|
|
938
|
+
onError: (error) => {
|
|
939
|
+
console.error("Voice error:", error);
|
|
940
|
+
},
|
|
941
|
+
});
|
|
942
|
+
|
|
943
|
+
// 3. Mute / unmute
|
|
944
|
+
await connection.mute();
|
|
945
|
+
console.log(connection.isMuted()); // true
|
|
946
|
+
await connection.unmute();
|
|
947
|
+
|
|
948
|
+
// 4. End the call
|
|
949
|
+
await connection.disconnect();
|
|
950
|
+
```
|
|
951
|
+
|
|
952
|
+
### `HappyRobotClient` (server-side)
|
|
953
|
+
|
|
954
|
+
| Method | Description |
|
|
955
|
+
|---|---|
|
|
956
|
+
| `client.voice.createToken({ workflow_id, data?, env? })` | Create a LiveKit token for voice calls |
|
|
957
|
+
|
|
958
|
+
### `HappyRobotVoiceClient` (browser-side)
|
|
959
|
+
|
|
960
|
+
| Method | Description |
|
|
961
|
+
|---|---|
|
|
962
|
+
| `new HappyRobotVoiceClient({ url, token })` | Create client with LiveKit credentials |
|
|
963
|
+
| `voice.connect(handlers?)` | Connect to room, enable microphone — returns `VoiceConnection` |
|
|
964
|
+
|
|
965
|
+
### `VoiceConnection`
|
|
966
|
+
|
|
967
|
+
| Method | Description |
|
|
968
|
+
|---|---|
|
|
969
|
+
| `connection.disconnect()` | End the call and disconnect from the room |
|
|
970
|
+
| `connection.mute()` | Mute the local microphone |
|
|
971
|
+
| `connection.unmute()` | Unmute the local microphone |
|
|
972
|
+
| `connection.isMuted()` | Check mute state |
|
|
973
|
+
| `connection.room` | Underlying LiveKit `Room` instance for advanced use cases |
|
|
974
|
+
|
|
975
|
+
### Room Events
|
|
976
|
+
|
|
977
|
+
| Handler | Description |
|
|
978
|
+
|---|---|
|
|
979
|
+
| `onConnected` | Connected to the LiveKit room |
|
|
980
|
+
| `onDisconnected` | Disconnected from the room |
|
|
981
|
+
| `onAgentConnected` | AI agent participant joined the room |
|
|
982
|
+
| `onTrackSubscribed` | Remote audio track subscribed (auto-plays) |
|
|
983
|
+
| `onTrackUnsubscribed` | Remote audio track unsubscribed |
|
|
984
|
+
| `onReconnecting` | Connection temporarily lost — attempting to reconnect |
|
|
985
|
+
| `onReconnected` | Successfully reconnected |
|
|
986
|
+
| `onError` | An error occurred |
|
|
987
|
+
|
|
988
|
+
---
|
|
989
|
+
|
|
873
990
|
## Pagination
|
|
874
991
|
|
|
875
992
|
List methods that are paginated return a `PaginatedResponse<T>`:
|
package/chat/index.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @happyrobot-ai/sdk/chat — Browser-side chat client.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* ```ts
|
|
6
|
+
* import { HappyRobotChatClient } from "@happyrobot-ai/sdk/chat";
|
|
7
|
+
*
|
|
8
|
+
* const chat = new HappyRobotChatClient({ token });
|
|
9
|
+
* const { session_id } = await chat.createSession();
|
|
10
|
+
* const connection = chat.connect(session_id, {
|
|
11
|
+
* onResponseChunk: (content) => console.log(content),
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export { HappyRobotChatClient } from "../chat-client";
|
|
16
|
+
export type { ChatConnectionHandlers, ChatConnection } from "../chat-client";
|
|
17
|
+
export type { ChatClientConfig, CreateChatSessionResponse, SendChatMessageBody, SendChatMessageResponse, ChatHistoryResponse, PresignedUploadQuery, PresignedUploadResponse, CompleteUploadBody, CompleteUploadResponse, ArtifactRef, ChatWsEvent, ChatWsConnectedEvent, ChatWsResponseStartEvent, ChatWsResponseChunkEvent, ChatWsResponseEndEvent, ChatWsSessionClosedEvent, ChatWsHeartbeatEvent, ChatWsTokenExpiredEvent, ChatWsMessageAckEvent, ChatWsMessageErrorEvent, } from "../types/chat.types";
|
package/chat/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @happyrobot-ai/sdk/chat — Browser-side chat client.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```ts
|
|
7
|
+
* import { HappyRobotChatClient } from "@happyrobot-ai/sdk/chat";
|
|
8
|
+
*
|
|
9
|
+
* const chat = new HappyRobotChatClient({ token });
|
|
10
|
+
* const { session_id } = await chat.createSession();
|
|
11
|
+
* const connection = chat.connect(session_id, {
|
|
12
|
+
* onResponseChunk: (content) => console.log(content),
|
|
13
|
+
* });
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.HappyRobotChatClient = void 0;
|
|
18
|
+
var chat_client_1 = require("../chat-client");
|
|
19
|
+
Object.defineProperty(exports, "HappyRobotChatClient", { enumerable: true, get: function () { return chat_client_1.HappyRobotChatClient; } });
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
package/chat/index.mjs
ADDED
package/chat-client.mjs
CHANGED
package/client.d.ts
CHANGED
|
@@ -34,6 +34,7 @@ import { IssuesResource } from "./resources/issues";
|
|
|
34
34
|
import { AuditRemarksResource } from "./resources/audit-remarks";
|
|
35
35
|
import { ChatResource } from "./resources/chat";
|
|
36
36
|
import { ArtifactsResource } from "./resources/artifacts";
|
|
37
|
+
import { VoiceResource } from "./resources/voice";
|
|
37
38
|
export declare class HappyRobotClient {
|
|
38
39
|
private readonly http;
|
|
39
40
|
/** Workflow CRUD, publishing, runs, and templates. */
|
|
@@ -84,5 +85,7 @@ export declare class HappyRobotClient {
|
|
|
84
85
|
readonly chat: ChatResource;
|
|
85
86
|
/** Artifact URL resolution. */
|
|
86
87
|
readonly artifacts: ArtifactsResource;
|
|
88
|
+
/** Voice call token creation. */
|
|
89
|
+
readonly voice: VoiceResource;
|
|
87
90
|
constructor(config: ClientConfig);
|
|
88
91
|
}
|
package/client.js
CHANGED
|
@@ -37,6 +37,7 @@ const issues_1 = require("./resources/issues");
|
|
|
37
37
|
const audit_remarks_1 = require("./resources/audit-remarks");
|
|
38
38
|
const chat_1 = require("./resources/chat");
|
|
39
39
|
const artifacts_1 = require("./resources/artifacts");
|
|
40
|
+
const voice_1 = require("./resources/voice");
|
|
40
41
|
class HappyRobotClient {
|
|
41
42
|
http;
|
|
42
43
|
/** Workflow CRUD, publishing, runs, and templates. */
|
|
@@ -87,6 +88,8 @@ class HappyRobotClient {
|
|
|
87
88
|
chat;
|
|
88
89
|
/** Artifact URL resolution. */
|
|
89
90
|
artifacts;
|
|
91
|
+
/** Voice call token creation. */
|
|
92
|
+
voice;
|
|
90
93
|
constructor(config) {
|
|
91
94
|
this.http = new http_1.HttpClient(config);
|
|
92
95
|
this.workflows = new workflows_1.WorkflowsResource(this.http);
|
|
@@ -113,6 +116,7 @@ class HappyRobotClient {
|
|
|
113
116
|
this.auditRemarks = new audit_remarks_1.AuditRemarksResource(this.http);
|
|
114
117
|
this.chat = new chat_1.ChatResource(this.http);
|
|
115
118
|
this.artifacts = new artifacts_1.ArtifactsResource(this.http);
|
|
119
|
+
this.voice = new voice_1.VoiceResource(this.http);
|
|
116
120
|
}
|
|
117
121
|
}
|
|
118
122
|
exports.HappyRobotClient = HappyRobotClient;
|
package/client.mjs
CHANGED
package/core/errors.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _cjs from "./errors.js";
|
|
1
|
+
import * as _cjs from "./errors.js";
|
|
2
2
|
const { NetworkError, TimeoutError, RateLimitError, ValidationError, NotFoundError, AuthenticationError, ApiError, HappyRobotError } = _cjs;
|
|
3
3
|
export { NetworkError, TimeoutError, RateLimitError, ValidationError, NotFoundError, AuthenticationError, ApiError, HappyRobotError };
|
|
4
|
-
export default _cjs;
|
package/core/http.mjs
CHANGED
package/core/pagination.mjs
CHANGED
package/core/sse.mjs
CHANGED
package/core/types.mjs
CHANGED
package/helpers/index.mjs
CHANGED
package/helpers/voice-agent.mjs
CHANGED
package/index.d.ts
CHANGED
|
@@ -22,8 +22,6 @@
|
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
24
|
export { HappyRobotClient } from "./client";
|
|
25
|
-
export { HappyRobotChatClient } from "./chat-client";
|
|
26
|
-
export type { ChatConnectionHandlers, ChatConnection } from "./chat-client";
|
|
27
25
|
export type { ClientConfig, RequestConfig, PaginatedResponse, PaginationMetadata, PaginationQuery } from "./core/types";
|
|
28
26
|
export { HappyRobotError, ApiError, AuthenticationError, NotFoundError, ValidationError, RateLimitError, TimeoutError, NetworkError, } from "./core/errors";
|
|
29
27
|
export type { ApiErrorBody } from "./core/errors";
|
|
@@ -55,6 +53,7 @@ export { IssuesResource } from "./resources/issues";
|
|
|
55
53
|
export { AuditRemarksResource } from "./resources/audit-remarks";
|
|
56
54
|
export { ChatResource } from "./resources/chat";
|
|
57
55
|
export { ArtifactsResource } from "./resources/artifacts";
|
|
56
|
+
export { VoiceResource } from "./resources/voice";
|
|
58
57
|
export type * from "./types/workflows.types";
|
|
59
58
|
export type * from "./types/versions.types";
|
|
60
59
|
export type * from "./types/nodes.types";
|
|
@@ -77,3 +76,4 @@ export type * from "./types/issues.types";
|
|
|
77
76
|
export type * from "./types/audit-remarks.types";
|
|
78
77
|
export type * from "./types/chat.types";
|
|
79
78
|
export type * from "./types/artifacts.types";
|
|
79
|
+
export type * from "./types/voice.types";
|
package/index.js
CHANGED
|
@@ -23,12 +23,10 @@
|
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.ArtifactsResource = exports.ChatResource = exports.AuditRemarksResource = exports.IssuesResource = exports.CustomEvalsResource = exports.NorthstarsResource = exports.AdversarialTestsResource = exports.AdversarialSuitesResource = exports.ApiKeyResource = exports.BillingResource = exports.MCPResource = exports.WorkflowFoldersResource = exports.KnowledgeBasesResource = exports.ContactsResource = exports.IntegrationsResource = exports.SipTrunksResource = exports.PhoneNumbersResource = exports.VariablesResource = exports.MessagesResource = exports.SessionsResource = exports.RunsResource = exports.NodesResource = exports.VersionsResource = exports.WorkflowsResource = exports.iterateSSE = exports.paginate = exports.NetworkError = exports.TimeoutError = exports.RateLimitError = exports.ValidationError = exports.NotFoundError = exports.AuthenticationError = exports.ApiError = exports.HappyRobotError = exports.
|
|
26
|
+
exports.VoiceResource = exports.ArtifactsResource = exports.ChatResource = exports.AuditRemarksResource = exports.IssuesResource = exports.CustomEvalsResource = exports.NorthstarsResource = exports.AdversarialTestsResource = exports.AdversarialSuitesResource = exports.ApiKeyResource = exports.BillingResource = exports.MCPResource = exports.WorkflowFoldersResource = exports.KnowledgeBasesResource = exports.ContactsResource = exports.IntegrationsResource = exports.SipTrunksResource = exports.PhoneNumbersResource = exports.VariablesResource = exports.MessagesResource = exports.SessionsResource = exports.RunsResource = exports.NodesResource = exports.VersionsResource = exports.WorkflowsResource = exports.iterateSSE = exports.paginate = exports.NetworkError = exports.TimeoutError = exports.RateLimitError = exports.ValidationError = exports.NotFoundError = exports.AuthenticationError = exports.ApiError = exports.HappyRobotError = exports.HappyRobotClient = void 0;
|
|
27
27
|
// ── Clients ──
|
|
28
28
|
var client_1 = require("./client");
|
|
29
29
|
Object.defineProperty(exports, "HappyRobotClient", { enumerable: true, get: function () { return client_1.HappyRobotClient; } });
|
|
30
|
-
var chat_client_1 = require("./chat-client");
|
|
31
|
-
Object.defineProperty(exports, "HappyRobotChatClient", { enumerable: true, get: function () { return chat_client_1.HappyRobotChatClient; } });
|
|
32
30
|
var errors_1 = require("./core/errors");
|
|
33
31
|
Object.defineProperty(exports, "HappyRobotError", { enumerable: true, get: function () { return errors_1.HappyRobotError; } });
|
|
34
32
|
Object.defineProperty(exports, "ApiError", { enumerable: true, get: function () { return errors_1.ApiError; } });
|
|
@@ -91,4 +89,6 @@ var chat_1 = require("./resources/chat");
|
|
|
91
89
|
Object.defineProperty(exports, "ChatResource", { enumerable: true, get: function () { return chat_1.ChatResource; } });
|
|
92
90
|
var artifacts_1 = require("./resources/artifacts");
|
|
93
91
|
Object.defineProperty(exports, "ArtifactsResource", { enumerable: true, get: function () { return artifacts_1.ArtifactsResource; } });
|
|
92
|
+
var voice_1 = require("./resources/voice");
|
|
93
|
+
Object.defineProperty(exports, "VoiceResource", { enumerable: true, get: function () { return voice_1.VoiceResource; } });
|
|
94
94
|
//# sourceMappingURL=index.js.map
|
package/index.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _cjs from "./index.js";
|
|
2
|
-
const { HappyRobotClient,
|
|
3
|
-
export { HappyRobotClient,
|
|
4
|
-
export default _cjs;
|
|
1
|
+
import * as _cjs from "./index.js";
|
|
2
|
+
const { HappyRobotClient, HappyRobotError, ApiError, AuthenticationError, NotFoundError, ValidationError, RateLimitError, TimeoutError, NetworkError, paginate, iterateSSE, WorkflowsResource, VersionsResource, NodesResource, RunsResource, SessionsResource, MessagesResource, VariablesResource, PhoneNumbersResource, SipTrunksResource, IntegrationsResource, ContactsResource, KnowledgeBasesResource, WorkflowFoldersResource, MCPResource, BillingResource, ApiKeyResource, AdversarialSuitesResource, AdversarialTestsResource, NorthstarsResource, CustomEvalsResource, IssuesResource, AuditRemarksResource, ChatResource, ArtifactsResource, VoiceResource } = _cjs;
|
|
3
|
+
export { HappyRobotClient, HappyRobotError, ApiError, AuthenticationError, NotFoundError, ValidationError, RateLimitError, TimeoutError, NetworkError, paginate, iterateSSE, WorkflowsResource, VersionsResource, NodesResource, RunsResource, SessionsResource, MessagesResource, VariablesResource, PhoneNumbersResource, SipTrunksResource, IntegrationsResource, ContactsResource, KnowledgeBasesResource, WorkflowFoldersResource, MCPResource, BillingResource, ApiKeyResource, AdversarialSuitesResource, AdversarialTestsResource, NorthstarsResource, CustomEvalsResource, IssuesResource, AuditRemarksResource, ChatResource, ArtifactsResource, VoiceResource };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyrobot-ai/sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "TypeScript SDK for the HappyRobot Public API",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"module": "./index.mjs",
|
|
@@ -11,12 +11,30 @@
|
|
|
11
11
|
"import": "./index.mjs",
|
|
12
12
|
"types": "./index.d.ts"
|
|
13
13
|
},
|
|
14
|
+
"./chat": {
|
|
15
|
+
"require": "./chat/index.js",
|
|
16
|
+
"import": "./chat/index.mjs",
|
|
17
|
+
"types": "./chat/index.d.ts"
|
|
18
|
+
},
|
|
19
|
+
"./voice": {
|
|
20
|
+
"require": "./voice/index.js",
|
|
21
|
+
"import": "./voice/index.mjs",
|
|
22
|
+
"types": "./voice/index.d.ts"
|
|
23
|
+
},
|
|
14
24
|
"./helpers": {
|
|
15
25
|
"require": "./helpers/index.js",
|
|
16
26
|
"import": "./helpers/index.mjs",
|
|
17
27
|
"types": "./helpers/index.d.ts"
|
|
18
28
|
}
|
|
19
29
|
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"livekit-client": "^2.13.0"
|
|
32
|
+
},
|
|
33
|
+
"peerDependenciesMeta": {
|
|
34
|
+
"livekit-client": {
|
|
35
|
+
"optional": true
|
|
36
|
+
}
|
|
37
|
+
},
|
|
20
38
|
"files": [
|
|
21
39
|
"**/*.js",
|
|
22
40
|
"**/*.mjs",
|
package/resources/api-key.mjs
CHANGED
package/resources/artifacts.mjs
CHANGED
package/resources/billing.mjs
CHANGED
package/resources/chat.mjs
CHANGED
package/resources/contacts.mjs
CHANGED
package/resources/issues.mjs
CHANGED
package/resources/mcp.mjs
CHANGED
package/resources/messages.mjs
CHANGED
package/resources/nodes.mjs
CHANGED
package/resources/northstars.mjs
CHANGED
package/resources/runs.mjs
CHANGED
package/resources/sessions.mjs
CHANGED
package/resources/sip-trunks.mjs
CHANGED
package/resources/variables.mjs
CHANGED
package/resources/versions.mjs
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Voice resource — client.voice.*
|
|
3
|
+
*
|
|
4
|
+
* Server-side only. Creates LiveKit tokens that are passed to the
|
|
5
|
+
* browser-side `HappyRobotVoiceClient`.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* const client = new HappyRobotClient({ apiKey: "sk_live_..." });
|
|
10
|
+
* const { url, token } = await client.voice.createToken({
|
|
11
|
+
* workflow_id: "my-workflow",
|
|
12
|
+
* data: { customer_name: "John" },
|
|
13
|
+
* });
|
|
14
|
+
* // Pass `url` and `token` to the browser → new HappyRobotVoiceClient({ url, token })
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
import type { HttpClient } from "../core/http";
|
|
18
|
+
import type { CreateVoiceTokenBody, CreateVoiceTokenResponse } from "../types/voice.types";
|
|
19
|
+
export declare class VoiceResource {
|
|
20
|
+
private readonly http;
|
|
21
|
+
constructor(http: HttpClient);
|
|
22
|
+
/**
|
|
23
|
+
* Create a LiveKit token for browser-side voice calls.
|
|
24
|
+
*
|
|
25
|
+
* Call this from your server, then pass the returned `url` and `token`
|
|
26
|
+
* to the browser where they can be used to initialize `HappyRobotVoiceClient`.
|
|
27
|
+
*/
|
|
28
|
+
createToken(body: CreateVoiceTokenBody): Promise<CreateVoiceTokenResponse>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Voice resource — client.voice.*
|
|
4
|
+
*
|
|
5
|
+
* Server-side only. Creates LiveKit tokens that are passed to the
|
|
6
|
+
* browser-side `HappyRobotVoiceClient`.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const client = new HappyRobotClient({ apiKey: "sk_live_..." });
|
|
11
|
+
* const { url, token } = await client.voice.createToken({
|
|
12
|
+
* workflow_id: "my-workflow",
|
|
13
|
+
* data: { customer_name: "John" },
|
|
14
|
+
* });
|
|
15
|
+
* // Pass `url` and `token` to the browser → new HappyRobotVoiceClient({ url, token })
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.VoiceResource = void 0;
|
|
20
|
+
class VoiceResource {
|
|
21
|
+
http;
|
|
22
|
+
constructor(http) {
|
|
23
|
+
this.http = http;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Create a LiveKit token for browser-side voice calls.
|
|
27
|
+
*
|
|
28
|
+
* Call this from your server, then pass the returned `url` and `token`
|
|
29
|
+
* to the browser where they can be used to initialize `HappyRobotVoiceClient`.
|
|
30
|
+
*/
|
|
31
|
+
async createToken(body) {
|
|
32
|
+
return this.http.request({
|
|
33
|
+
method: "POST",
|
|
34
|
+
path: "/voice/tokens",
|
|
35
|
+
body,
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.VoiceResource = VoiceResource;
|
|
40
|
+
//# sourceMappingURL=voice.js.map
|