@happyrobot-ai/sdk 0.1.25 → 0.1.27

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 CHANGED
@@ -181,6 +181,9 @@ const { data } = await client.workflows.listVersions("my-workflow");
181
181
  // List runs
182
182
  const { data } = await client.workflows.listRuns("my-workflow");
183
183
 
184
+ // List sessions across all runs
185
+ const { data: sessions } = await client.workflows.listSessions("my-workflow");
186
+
184
187
  // Trigger a run
185
188
  const { run_id } = await client.workflows.triggerRun("my-workflow", { payload: { phone: "+1..." } });
186
189
  ```
@@ -200,6 +203,7 @@ const { run_id } = await client.workflows.triggerRun("my-workflow", { payload: {
200
203
  | `listTemplates(query?)` | GET | `/workflows/templates` | List workflow templates |
201
204
  | `listVersions(workflowId, query?)` | GET | `/workflows/:id/versions` | List versions for a workflow |
202
205
  | `listRuns(workflowId, query?)` | GET | `/workflows/:id/runs` | List runs for a workflow |
206
+ | `listSessions(workflowId, query?)` | GET | `/workflows/:id/sessions` | List sessions for a workflow |
203
207
  | `triggerRun(workflowId, body?)` | POST | `/workflows/:id/runs` | Trigger a new run |
204
208
 
205
209
  ---
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyrobot-ai/sdk",
3
- "version": "0.1.25",
3
+ "version": "0.1.27",
4
4
  "description": "TypeScript SDK for the HappyRobot Public API",
5
5
  "main": "./index.js",
6
6
  "module": "./index.mjs",
@@ -33,9 +33,9 @@ export declare class VoiceResource {
33
33
  * Call this from your server, then pass the returned `url` and `token`
34
34
  * to the browser where they can be used to initialize `HappyRobotVoiceClient`.
35
35
  *
36
- * Provide `workflow_id` to start a new call, or `session_id` to join an
37
- * in-progress call. Pair `session_id` with `should_takeover: true` to drop
38
- * the AI agent and take over the call.
36
+ * Provide `workflow_id` to start a new call, or `session_id` (with the
37
+ * required `should_takeover: true`) to take over an in-progress call, which
38
+ * drops the AI agent.
39
39
  */
40
40
  createToken(body: CreateVoiceTokenBody): Promise<CreateVoiceTokenResponse>;
41
41
  }
@@ -36,9 +36,9 @@ class VoiceResource {
36
36
  * Call this from your server, then pass the returned `url` and `token`
37
37
  * to the browser where they can be used to initialize `HappyRobotVoiceClient`.
38
38
  *
39
- * Provide `workflow_id` to start a new call, or `session_id` to join an
40
- * in-progress call. Pair `session_id` with `should_takeover: true` to drop
41
- * the AI agent and take over the call.
39
+ * Provide `workflow_id` to start a new call, or `session_id` (with the
40
+ * required `should_takeover: true`) to take over an in-progress call, which
41
+ * drops the AI agent.
42
42
  */
43
43
  async createToken(body) {
44
44
  return this.http.request({
@@ -15,10 +15,11 @@
15
15
  * GET /workflows/:workflow_id/versions
16
16
  * GET /workflows/:workflow_id/runs
17
17
  * POST /workflows/:workflow_id/runs
18
+ * GET /workflows/:workflow_id/sessions
18
19
  */
19
20
  import type { HttpClient } from "../core/http";
20
21
  import type { WorkflowRunsQuery, PaginatedWorkflowRunsResponse, TriggerRunBody, TriggerRunResponse, TriggerRunWithFileBody } from "../types/runs.types";
21
- import type { ListWorkflowsQuery, WorkflowListItem, PaginatedWorkflowsResponse, CreateWorkflowBody, CreateWorkflowResponse, WorkflowDetailResponse, UpdateWorkflowBody, UpdateWorkflowResponse, DuplicateWorkflowBody, DuplicateWorkflowResponse, ListTemplatesQuery, PaginatedTemplatesResponse, WorkflowPublishResponse, WorkflowUnpublishResponse, CancelRunsBody, CancelRunsResponse, ListWorkflowVersionsQuery, PaginatedWorkflowVersionsResponse } from "../types/workflows.types";
22
+ import type { ListWorkflowsQuery, WorkflowListItem, PaginatedWorkflowsResponse, CreateWorkflowBody, CreateWorkflowResponse, WorkflowDetailResponse, UpdateWorkflowBody, UpdateWorkflowResponse, DuplicateWorkflowBody, DuplicateWorkflowResponse, ListTemplatesQuery, PaginatedTemplatesResponse, WorkflowPublishResponse, WorkflowUnpublishResponse, CancelRunsBody, CancelRunsResponse, ListWorkflowVersionsQuery, PaginatedWorkflowVersionsResponse, ListWorkflowSessionsQuery, PaginatedWorkflowSessionsResponse } from "../types/workflows.types";
22
23
  export declare class WorkflowsResource {
23
24
  private readonly http;
24
25
  constructor(http: HttpClient);
@@ -50,6 +51,8 @@ export declare class WorkflowsResource {
50
51
  listVersions(workflowId: string, query?: ListWorkflowVersionsQuery): Promise<PaginatedWorkflowVersionsResponse>;
51
52
  /** List runs for a workflow. */
52
53
  listRuns(workflowId: string, query?: WorkflowRunsQuery): Promise<PaginatedWorkflowRunsResponse>;
54
+ /** List sessions for a workflow across all runs. */
55
+ listSessions(workflowId: string, query?: ListWorkflowSessionsQuery): Promise<PaginatedWorkflowSessionsResponse>;
53
56
  /** Trigger a run for a workflow (JSON payload or file upload). */
54
57
  triggerRun(workflowId: string, body?: TriggerRunBody | TriggerRunWithFileBody): Promise<TriggerRunResponse>;
55
58
  private triggerRunWithFile;
@@ -16,6 +16,7 @@
16
16
  * GET /workflows/:workflow_id/versions
17
17
  * GET /workflows/:workflow_id/runs
18
18
  * POST /workflows/:workflow_id/runs
19
+ * GET /workflows/:workflow_id/sessions
19
20
  */
20
21
  Object.defineProperty(exports, "__esModule", { value: true });
21
22
  exports.WorkflowsResource = void 0;
@@ -122,6 +123,14 @@ class WorkflowsResource {
122
123
  query: query,
123
124
  });
124
125
  }
126
+ /** List sessions for a workflow across all runs. */
127
+ async listSessions(workflowId, query) {
128
+ return this.http.request({
129
+ method: "GET",
130
+ path: `/workflows/${encodeURIComponent(workflowId)}/sessions`,
131
+ query: query,
132
+ });
133
+ }
125
134
  /** Trigger a run for a workflow (JSON payload or file upload). */
126
135
  async triggerRun(workflowId, body) {
127
136
  const path = `/workflows/${encodeURIComponent(workflowId)}/runs`;
@@ -24,17 +24,17 @@ export type CreateVoiceTokenBody = (CreateVoiceTokenBase & {
24
24
  should_takeover?: never;
25
25
  }) | (CreateVoiceTokenBase & {
26
26
  /**
27
- * ID of an in-progress session to join. Generates a token for the
27
+ * ID of an in-progress session to take over. Generates a token for the
28
28
  * session's existing LiveKit room.
29
29
  */
30
30
  session_id: string;
31
31
  workflow_id?: never;
32
32
  /**
33
- * When `true`, the joining participant takes over the call and the AI
34
- * agent drops. When `false` (default), the participant joins alongside
35
- * the agent without dropping it.
33
+ * Must be `true`. Explicit opt-in confirming the joining participant
34
+ * takes over the call and the AI agent drops. Joining a live call
35
+ * without taking over is not supported.
36
36
  */
37
- should_takeover?: boolean;
37
+ should_takeover: true;
38
38
  });
39
39
  /** POST /voice/tokens response. */
40
40
  export interface CreateVoiceTokenResponse {
@@ -3,6 +3,8 @@
3
3
  * Uses import type — erased at compile time.
4
4
  */
5
5
  import type { z } from "zod";
6
+ import type { ListSessionsQuerySchema } from "../../routes/sessions/schemas";
7
+ import type { PaginatedWorkflowSessionsResponseSchema, WorkflowSessionItemSchema } from "../../routes/workflows/:workflow_id/sessions/schemas";
6
8
  import type { ListWorkflowsQuerySchema, WorkflowListItemSchema, PaginatedWorkflowsResponseSchema, CreateWorkflowBodySchema, CreateWorkflowResponseSchema, WorkflowDetailResponseSchema, UpdateWorkflowBodySchema, UpdateWorkflowResponseSchema, DuplicateWorkflowBodySchema, DuplicateWorkflowResponseSchema, PaginatedTemplatesResponseSchema, ListTemplatesQuerySchema, WorkflowPublishResponseSchema, WorkflowPublishErrorResponseSchema, WorkflowUnpublishResponseSchema, CancelRunsBodySchema, CancelRunsResponseSchema, ListWorkflowVersionsQuerySchema, PaginatedWorkflowVersionsResponseSchema } from "../../routes/workflows/schemas";
7
9
  export type ListWorkflowsQuery = z.output<typeof ListWorkflowsQuerySchema>;
8
10
  export type WorkflowListItem = z.infer<typeof WorkflowListItemSchema>;
@@ -23,3 +25,6 @@ export type CancelRunsBody = z.input<typeof CancelRunsBodySchema>;
23
25
  export type CancelRunsResponse = z.infer<typeof CancelRunsResponseSchema>;
24
26
  export type ListWorkflowVersionsQuery = z.input<typeof ListWorkflowVersionsQuerySchema>;
25
27
  export type PaginatedWorkflowVersionsResponse = z.infer<typeof PaginatedWorkflowVersionsResponseSchema>;
28
+ export type ListWorkflowSessionsQuery = z.input<typeof ListSessionsQuerySchema>;
29
+ export type WorkflowSessionItem = z.infer<typeof WorkflowSessionItemSchema>;
30
+ export type PaginatedWorkflowSessionsResponse = z.infer<typeof PaginatedWorkflowSessionsResponseSchema>;