@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.
Files changed (126) hide show
  1. package/README.md +117 -0
  2. package/chat/index.d.ts +17 -0
  3. package/chat/index.js +20 -0
  4. package/chat/index.mjs +3 -0
  5. package/chat-client.mjs +1 -2
  6. package/client.d.ts +3 -0
  7. package/client.js +4 -0
  8. package/client.mjs +1 -2
  9. package/core/errors.mjs +1 -2
  10. package/core/http.mjs +1 -2
  11. package/core/pagination.mjs +1 -2
  12. package/core/sse.mjs +1 -2
  13. package/core/types.mjs +0 -1
  14. package/helpers/index.mjs +1 -2
  15. package/helpers/template-workflows.mjs +1 -2
  16. package/helpers/trigger-and-wait.mjs +1 -2
  17. package/helpers/voice-agent.mjs +1 -2
  18. package/index.d.ts +2 -2
  19. package/index.js +3 -3
  20. package/index.mjs +3 -4
  21. package/package.json +19 -1
  22. package/resources/adversarial-suites.mjs +1 -2
  23. package/resources/adversarial-tests.mjs +1 -2
  24. package/resources/api-key.mjs +1 -2
  25. package/resources/artifacts.mjs +1 -2
  26. package/resources/audit-remarks.mjs +1 -2
  27. package/resources/billing.mjs +1 -2
  28. package/resources/chat.mjs +1 -2
  29. package/resources/contacts.mjs +1 -2
  30. package/resources/custom-evals.mjs +1 -2
  31. package/resources/integrations.mjs +1 -2
  32. package/resources/issues.mjs +1 -2
  33. package/resources/knowledge-bases.mjs +1 -2
  34. package/resources/mcp.mjs +1 -2
  35. package/resources/messages.mjs +1 -2
  36. package/resources/nodes.mjs +1 -2
  37. package/resources/northstars.mjs +1 -2
  38. package/resources/phone-numbers.mjs +1 -2
  39. package/resources/runs.mjs +1 -2
  40. package/resources/sessions.mjs +1 -2
  41. package/resources/sip-trunks.mjs +1 -2
  42. package/resources/variables.mjs +1 -2
  43. package/resources/versions.mjs +1 -2
  44. package/resources/voice.d.ts +29 -0
  45. package/resources/voice.js +40 -0
  46. package/resources/voice.mjs +3 -0
  47. package/resources/workflow-folders.mjs +1 -2
  48. package/resources/workflows.mjs +1 -2
  49. package/types/adversarial-suites.types.d.ts +26 -0
  50. package/types/adversarial-suites.types.js +6 -0
  51. package/types/adversarial-suites.types.mjs +1 -0
  52. package/types/adversarial-tests.types.d.ts +21 -0
  53. package/types/adversarial-tests.types.js +6 -0
  54. package/types/adversarial-tests.types.mjs +1 -0
  55. package/types/artifacts.types.d.ts +4 -0
  56. package/types/artifacts.types.js +3 -0
  57. package/types/artifacts.types.mjs +1 -0
  58. package/types/audit-remarks.types.d.ts +19 -0
  59. package/types/audit-remarks.types.js +6 -0
  60. package/types/audit-remarks.types.mjs +1 -0
  61. package/types/chat.types.d.ts +146 -0
  62. package/types/chat.types.js +3 -0
  63. package/types/chat.types.mjs +1 -0
  64. package/types/common.types.d.ts +19 -0
  65. package/types/common.types.js +7 -0
  66. package/types/common.types.mjs +1 -0
  67. package/types/contacts.types.d.ts +6 -0
  68. package/types/contacts.types.js +6 -0
  69. package/types/contacts.types.mjs +1 -0
  70. package/types/custom-evals.types.d.ts +19 -0
  71. package/types/custom-evals.types.js +6 -0
  72. package/types/custom-evals.types.mjs +1 -0
  73. package/types/integrations.types.d.ts +45 -0
  74. package/types/integrations.types.js +6 -0
  75. package/types/integrations.types.mjs +1 -0
  76. package/types/issues.types.d.ts +11 -0
  77. package/types/issues.types.js +6 -0
  78. package/types/issues.types.mjs +1 -0
  79. package/types/knowledge-bases.types.d.ts +21 -0
  80. package/types/knowledge-bases.types.js +7 -0
  81. package/types/knowledge-bases.types.mjs +1 -0
  82. package/types/mcp.types.d.ts +10 -0
  83. package/types/mcp.types.js +6 -0
  84. package/types/mcp.types.mjs +1 -0
  85. package/types/messages.types.d.ts +9 -0
  86. package/types/messages.types.js +6 -0
  87. package/types/messages.types.mjs +1 -0
  88. package/types/nodes.types.d.ts +12 -0
  89. package/types/nodes.types.js +6 -0
  90. package/types/nodes.types.mjs +1 -0
  91. package/types/northstars.types.d.ts +18 -0
  92. package/types/northstars.types.js +6 -0
  93. package/types/northstars.types.mjs +1 -0
  94. package/types/phone-numbers.types.d.ts +24 -0
  95. package/types/phone-numbers.types.js +6 -0
  96. package/types/phone-numbers.types.mjs +1 -0
  97. package/types/runs.types.d.ts +16 -0
  98. package/types/runs.types.js +6 -0
  99. package/types/runs.types.mjs +1 -0
  100. package/types/sessions.types.d.ts +51 -0
  101. package/types/sessions.types.js +6 -0
  102. package/types/sessions.types.mjs +1 -0
  103. package/types/sip-trunks.types.d.ts +11 -0
  104. package/types/sip-trunks.types.js +6 -0
  105. package/types/sip-trunks.types.mjs +1 -0
  106. package/types/variables.types.d.ts +10 -0
  107. package/types/variables.types.js +6 -0
  108. package/types/variables.types.mjs +1 -0
  109. package/types/versions.types.d.ts +22 -0
  110. package/types/versions.types.js +6 -0
  111. package/types/versions.types.mjs +1 -0
  112. package/types/voice.types.d.ts +13 -0
  113. package/types/voice.types.js +3 -0
  114. package/types/voice.types.mjs +1 -0
  115. package/types/workflow-folders.types.d.ts +9 -0
  116. package/types/workflow-folders.types.js +6 -0
  117. package/types/workflow-folders.types.mjs +1 -0
  118. package/types/workflows.types.d.ts +24 -0
  119. package/types/workflows.types.js +7 -0
  120. package/types/workflows.types.mjs +1 -0
  121. package/voice/index.d.ts +22 -0
  122. package/voice/index.js +25 -0
  123. package/voice/index.mjs +3 -0
  124. package/voice-client.d.ts +87 -0
  125. package/voice-client.js +148 -0
  126. 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>`:
@@ -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
@@ -0,0 +1,3 @@
1
+ import * as _cjs from "./index.js";
2
+ const { HappyRobotChatClient } = _cjs;
3
+ export { HappyRobotChatClient };
package/chat-client.mjs CHANGED
@@ -1,4 +1,3 @@
1
- import _cjs from "./chat-client.js";
1
+ import * as _cjs from "./chat-client.js";
2
2
  const { HappyRobotChatClient } = _cjs;
3
3
  export { HappyRobotChatClient };
4
- export default _cjs;
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
@@ -1,4 +1,3 @@
1
- import _cjs from "./client.js";
1
+ import * as _cjs from "./client.js";
2
2
  const { HappyRobotClient } = _cjs;
3
3
  export { HappyRobotClient };
4
- export default _cjs;
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
@@ -1,4 +1,3 @@
1
- import _cjs from "./http.js";
1
+ import * as _cjs from "./http.js";
2
2
  const { HttpClient } = _cjs;
3
3
  export { HttpClient };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./pagination.js";
1
+ import * as _cjs from "./pagination.js";
2
2
  const { paginate } = _cjs;
3
3
  export { paginate };
4
- export default _cjs;
package/core/sse.mjs CHANGED
@@ -1,4 +1,3 @@
1
- import _cjs from "./sse.js";
1
+ import * as _cjs from "./sse.js";
2
2
  const { iterateSSE } = _cjs;
3
3
  export { iterateSSE };
4
- export default _cjs;
package/core/types.mjs CHANGED
@@ -1,2 +1 @@
1
- export { default } from "./types.js";
2
1
  export * from "./types.js";
package/helpers/index.mjs CHANGED
@@ -1,4 +1,3 @@
1
- import _cjs from "./index.js";
1
+ import * as _cjs from "./index.js";
2
2
  const { createVoiceAgent, triggerAndWait, createFromTemplate } = _cjs;
3
3
  export { createVoiceAgent, triggerAndWait, createFromTemplate };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./template-workflows.js";
1
+ import * as _cjs from "./template-workflows.js";
2
2
  const { createFromTemplate } = _cjs;
3
3
  export { createFromTemplate };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./trigger-and-wait.js";
1
+ import * as _cjs from "./trigger-and-wait.js";
2
2
  const { triggerAndWait } = _cjs;
3
3
  export { triggerAndWait };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./voice-agent.js";
1
+ import * as _cjs from "./voice-agent.js";
2
2
  const { createVoiceAgent } = _cjs;
3
3
  export { createVoiceAgent };
4
- export default _cjs;
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.HappyRobotChatClient = exports.HappyRobotClient = void 0;
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, HappyRobotChatClient, 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 } = _cjs;
3
- export { HappyRobotClient, HappyRobotChatClient, 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 };
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.5",
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",
@@ -1,4 +1,3 @@
1
- import _cjs from "./adversarial-suites.js";
1
+ import * as _cjs from "./adversarial-suites.js";
2
2
  const { AdversarialSuitesResource } = _cjs;
3
3
  export { AdversarialSuitesResource };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./adversarial-tests.js";
1
+ import * as _cjs from "./adversarial-tests.js";
2
2
  const { AdversarialTestsResource } = _cjs;
3
3
  export { AdversarialTestsResource };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./api-key.js";
1
+ import * as _cjs from "./api-key.js";
2
2
  const { ApiKeyResource } = _cjs;
3
3
  export { ApiKeyResource };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./artifacts.js";
1
+ import * as _cjs from "./artifacts.js";
2
2
  const { ArtifactsResource } = _cjs;
3
3
  export { ArtifactsResource };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./audit-remarks.js";
1
+ import * as _cjs from "./audit-remarks.js";
2
2
  const { AuditRemarksResource } = _cjs;
3
3
  export { AuditRemarksResource };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./billing.js";
1
+ import * as _cjs from "./billing.js";
2
2
  const { BillingResource } = _cjs;
3
3
  export { BillingResource };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./chat.js";
1
+ import * as _cjs from "./chat.js";
2
2
  const { ChatResource } = _cjs;
3
3
  export { ChatResource };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./contacts.js";
1
+ import * as _cjs from "./contacts.js";
2
2
  const { ContactsResource } = _cjs;
3
3
  export { ContactsResource };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./custom-evals.js";
1
+ import * as _cjs from "./custom-evals.js";
2
2
  const { CustomEvalsResource } = _cjs;
3
3
  export { CustomEvalsResource };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./integrations.js";
1
+ import * as _cjs from "./integrations.js";
2
2
  const { IntegrationsResource } = _cjs;
3
3
  export { IntegrationsResource };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./issues.js";
1
+ import * as _cjs from "./issues.js";
2
2
  const { IssuesResource } = _cjs;
3
3
  export { IssuesResource };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./knowledge-bases.js";
1
+ import * as _cjs from "./knowledge-bases.js";
2
2
  const { KnowledgeBasesResource } = _cjs;
3
3
  export { KnowledgeBasesResource };
4
- export default _cjs;
package/resources/mcp.mjs CHANGED
@@ -1,4 +1,3 @@
1
- import _cjs from "./mcp.js";
1
+ import * as _cjs from "./mcp.js";
2
2
  const { MCPResource } = _cjs;
3
3
  export { MCPResource };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./messages.js";
1
+ import * as _cjs from "./messages.js";
2
2
  const { MessagesResource } = _cjs;
3
3
  export { MessagesResource };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./nodes.js";
1
+ import * as _cjs from "./nodes.js";
2
2
  const { NodesResource } = _cjs;
3
3
  export { NodesResource };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./northstars.js";
1
+ import * as _cjs from "./northstars.js";
2
2
  const { NorthstarsResource } = _cjs;
3
3
  export { NorthstarsResource };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./phone-numbers.js";
1
+ import * as _cjs from "./phone-numbers.js";
2
2
  const { PhoneNumbersResource } = _cjs;
3
3
  export { PhoneNumbersResource };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./runs.js";
1
+ import * as _cjs from "./runs.js";
2
2
  const { RunsResource } = _cjs;
3
3
  export { RunsResource };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./sessions.js";
1
+ import * as _cjs from "./sessions.js";
2
2
  const { SessionsResource } = _cjs;
3
3
  export { SessionsResource };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./sip-trunks.js";
1
+ import * as _cjs from "./sip-trunks.js";
2
2
  const { SipTrunksResource } = _cjs;
3
3
  export { SipTrunksResource };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./variables.js";
1
+ import * as _cjs from "./variables.js";
2
2
  const { VariablesResource } = _cjs;
3
3
  export { VariablesResource };
4
- export default _cjs;
@@ -1,4 +1,3 @@
1
- import _cjs from "./versions.js";
1
+ import * as _cjs from "./versions.js";
2
2
  const { VersionsResource } = _cjs;
3
3
  export { VersionsResource };
4
- export default _cjs;
@@ -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
@@ -0,0 +1,3 @@
1
+ import * as _cjs from "./voice.js";
2
+ const { VoiceResource } = _cjs;
3
+ export { VoiceResource };
@@ -1,4 +1,3 @@
1
- import _cjs from "./workflow-folders.js";
1
+ import * as _cjs from "./workflow-folders.js";
2
2
  const { WorkflowFoldersResource } = _cjs;
3
3
  export { WorkflowFoldersResource };
4
- export default _cjs;