@happyrobot-ai/sdk 0.1.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.
Files changed (103) hide show
  1. package/client.d.ts +85 -0
  2. package/client.js +115 -0
  3. package/client.mjs +3 -0
  4. package/core/errors.d.ts +48 -0
  5. package/core/errors.js +82 -0
  6. package/core/errors.mjs +3 -0
  7. package/core/http.d.ts +26 -0
  8. package/core/http.js +189 -0
  9. package/core/http.mjs +3 -0
  10. package/core/pagination.d.ts +22 -0
  11. package/core/pagination.js +43 -0
  12. package/core/pagination.mjs +3 -0
  13. package/core/sse.d.ts +20 -0
  14. package/core/sse.js +104 -0
  15. package/core/sse.mjs +3 -0
  16. package/core/types.d.ts +50 -0
  17. package/core/types.js +6 -0
  18. package/core/types.mjs +3 -0
  19. package/helpers/index.d.ts +14 -0
  20. package/helpers/index.js +18 -0
  21. package/helpers/index.mjs +3 -0
  22. package/helpers/template-workflows.d.ts +49 -0
  23. package/helpers/template-workflows.js +46 -0
  24. package/helpers/template-workflows.mjs +3 -0
  25. package/helpers/trigger-and-wait.d.ts +37 -0
  26. package/helpers/trigger-and-wait.js +62 -0
  27. package/helpers/trigger-and-wait.mjs +3 -0
  28. package/helpers/voice-agent.d.ts +47 -0
  29. package/helpers/voice-agent.js +47 -0
  30. package/helpers/voice-agent.mjs +3 -0
  31. package/index.d.ts +75 -0
  32. package/index.js +90 -0
  33. package/index.mjs +3 -0
  34. package/package.json +42 -0
  35. package/resources/adversarial-suites.d.ts +42 -0
  36. package/resources/adversarial-suites.js +96 -0
  37. package/resources/adversarial-suites.mjs +3 -0
  38. package/resources/adversarial-tests.d.ts +36 -0
  39. package/resources/adversarial-tests.js +78 -0
  40. package/resources/adversarial-tests.mjs +3 -0
  41. package/resources/api-key.d.ts +23 -0
  42. package/resources/api-key.js +24 -0
  43. package/resources/api-key.mjs +3 -0
  44. package/resources/audit-remarks.d.ts +22 -0
  45. package/resources/audit-remarks.js +44 -0
  46. package/resources/audit-remarks.mjs +3 -0
  47. package/resources/billing.d.ts +25 -0
  48. package/resources/billing.js +34 -0
  49. package/resources/billing.mjs +3 -0
  50. package/resources/contacts.d.ts +40 -0
  51. package/resources/contacts.js +61 -0
  52. package/resources/contacts.mjs +3 -0
  53. package/resources/custom-evals.d.ts +28 -0
  54. package/resources/custom-evals.js +62 -0
  55. package/resources/custom-evals.mjs +3 -0
  56. package/resources/integrations.d.ts +95 -0
  57. package/resources/integrations.js +220 -0
  58. package/resources/integrations.mjs +3 -0
  59. package/resources/issues.d.ts +14 -0
  60. package/resources/issues.js +25 -0
  61. package/resources/issues.mjs +3 -0
  62. package/resources/knowledge-bases.d.ts +35 -0
  63. package/resources/knowledge-bases.js +68 -0
  64. package/resources/knowledge-bases.mjs +3 -0
  65. package/resources/mcp.d.ts +20 -0
  66. package/resources/mcp.js +42 -0
  67. package/resources/mcp.mjs +3 -0
  68. package/resources/messages.d.ts +17 -0
  69. package/resources/messages.js +37 -0
  70. package/resources/messages.mjs +3 -0
  71. package/resources/nodes.d.ts +50 -0
  72. package/resources/nodes.js +86 -0
  73. package/resources/nodes.mjs +3 -0
  74. package/resources/northstars.d.ts +29 -0
  75. package/resources/northstars.js +69 -0
  76. package/resources/northstars.mjs +3 -0
  77. package/resources/phone-numbers.d.ts +47 -0
  78. package/resources/phone-numbers.js +121 -0
  79. package/resources/phone-numbers.mjs +3 -0
  80. package/resources/runs.d.ts +31 -0
  81. package/resources/runs.js +71 -0
  82. package/resources/runs.mjs +3 -0
  83. package/resources/sessions.d.ts +36 -0
  84. package/resources/sessions.js +62 -0
  85. package/resources/sessions.mjs +3 -0
  86. package/resources/sip-trunks.d.ts +32 -0
  87. package/resources/sip-trunks.js +78 -0
  88. package/resources/sip-trunks.mjs +3 -0
  89. package/resources/usage.d.ts +27 -0
  90. package/resources/usage.js +70 -0
  91. package/resources/usage.mjs +3 -0
  92. package/resources/variables.d.ts +23 -0
  93. package/resources/variables.js +54 -0
  94. package/resources/variables.mjs +3 -0
  95. package/resources/versions.d.ts +38 -0
  96. package/resources/versions.js +90 -0
  97. package/resources/versions.mjs +3 -0
  98. package/resources/workflow-folders.d.ts +26 -0
  99. package/resources/workflow-folders.js +62 -0
  100. package/resources/workflow-folders.mjs +3 -0
  101. package/resources/workflows.d.ts +55 -0
  102. package/resources/workflows.js +134 -0
  103. package/resources/workflows.mjs +3 -0
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ /**
3
+ * MCP resource — client.mcp.*
4
+ *
5
+ * Maps to:
6
+ * GET /mcp
7
+ * POST /mcp
8
+ * POST /mcp/:mcpId/refresh
9
+ */
10
+ Object.defineProperty(exports, "__esModule", { value: true });
11
+ exports.MCPResource = void 0;
12
+ class MCPResource {
13
+ http;
14
+ constructor(http) {
15
+ this.http = http;
16
+ }
17
+ /** List MCP servers (paginated). */
18
+ async list(query) {
19
+ return this.http.request({
20
+ method: "GET",
21
+ path: "/mcp",
22
+ query: query,
23
+ });
24
+ }
25
+ /** Register a new MCP server. */
26
+ async create(body) {
27
+ return this.http.request({
28
+ method: "POST",
29
+ path: "/mcp",
30
+ body,
31
+ });
32
+ }
33
+ /** Refresh (re-discover tools for) an MCP server. */
34
+ async refresh(mcpId) {
35
+ return this.http.request({
36
+ method: "POST",
37
+ path: `/mcp/${encodeURIComponent(mcpId)}/refresh`,
38
+ });
39
+ }
40
+ }
41
+ exports.MCPResource = MCPResource;
42
+ //# sourceMappingURL=mcp.js.map
@@ -0,0 +1,3 @@
1
+ // ESM wrapper — re-exports CJS module
2
+ export { default } from "./mcp.js";
3
+ export * from "./mcp.js";
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Messages resource — client.messages.*
3
+ *
4
+ * Maps to:
5
+ * GET /messages/:message_id/flags
6
+ * POST /messages/:message_id/flags
7
+ */
8
+ import type { HttpClient } from "../core/http";
9
+ import type { ListMessageFlagsQuery, PaginatedMessageFlagsResponse, CreateMessageFlagBody, MessageFlagItem } from "../types/messages.types";
10
+ export declare class MessagesResource {
11
+ private readonly http;
12
+ constructor(http: HttpClient);
13
+ /** List quality flags for a message. */
14
+ listFlags(messageId: string, query?: ListMessageFlagsQuery): Promise<PaginatedMessageFlagsResponse>;
15
+ /** Create a quality flag on a message. */
16
+ createFlag(messageId: string, body: CreateMessageFlagBody): Promise<MessageFlagItem>;
17
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ /**
3
+ * Messages resource — client.messages.*
4
+ *
5
+ * Maps to:
6
+ * GET /messages/:message_id/flags
7
+ * POST /messages/:message_id/flags
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.MessagesResource = void 0;
11
+ class MessagesResource {
12
+ http;
13
+ constructor(http) {
14
+ this.http = http;
15
+ }
16
+ /** List quality flags for a message. */
17
+ async listFlags(messageId, query) {
18
+ return this.http.request({
19
+ method: "GET",
20
+ path: `/messages/${enc(messageId)}/flags`,
21
+ query: query,
22
+ });
23
+ }
24
+ /** Create a quality flag on a message. */
25
+ async createFlag(messageId, body) {
26
+ return this.http.request({
27
+ method: "POST",
28
+ path: `/messages/${enc(messageId)}/flags`,
29
+ body,
30
+ });
31
+ }
32
+ }
33
+ exports.MessagesResource = MessagesResource;
34
+ function enc(s) {
35
+ return encodeURIComponent(s);
36
+ }
37
+ //# sourceMappingURL=messages.js.map
@@ -0,0 +1,3 @@
1
+ // ESM wrapper — re-exports CJS module
2
+ export { default } from "./messages.js";
3
+ export * from "./messages.js";
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Node resource — client.nodes.*
3
+ *
4
+ * Maps to:
5
+ * GET /versions/:version_id/nodes
6
+ * POST /versions/:version_id/nodes
7
+ * GET /versions/:version_id/nodes/:node_id
8
+ * PUT /versions/:version_id/nodes/:node_id
9
+ * DELETE /versions/:version_id/nodes/:node_id
10
+ * GET /versions/:version_id/nodes/:node_id/config-schema
11
+ * GET /versions/:version_id/nodes/:node_id/available-vars
12
+ * POST /versions/:version_id/nodes/:node_id/test
13
+ */
14
+ import type { HttpClient } from "../core/http";
15
+ import type { ListNodesResponse, AddNodesBody, AddNodesResponse, UpdateNodeBody, GetSingleNodeResponse } from "../types/versions.types";
16
+ import type { AvailableVarsResponse, ConfigSchemaResponse } from "../types/nodes.types";
17
+ export interface TestNodeBody {
18
+ environment?: "production" | "staging" | "development";
19
+ }
20
+ export interface TestNodeOutput {
21
+ id: string;
22
+ node_id: string;
23
+ type: string | null;
24
+ data: unknown;
25
+ error: string | null;
26
+ timestamp: string;
27
+ }
28
+ export interface TestNodeResponse {
29
+ data: TestNodeOutput;
30
+ }
31
+ export declare class NodesResource {
32
+ private readonly http;
33
+ constructor(http: HttpClient);
34
+ /** List all nodes in a version. */
35
+ list(versionId: string): Promise<ListNodesResponse>;
36
+ /** Add nodes to a version (batch, 1-50). */
37
+ addBatch(versionId: string, body: AddNodesBody): Promise<AddNodesResponse>;
38
+ /** Get a single node by ID. */
39
+ get(versionId: string, nodeId: string): Promise<GetSingleNodeResponse>;
40
+ /** Update a node. */
41
+ update(versionId: string, nodeId: string, body: UpdateNodeBody): Promise<unknown>;
42
+ /** Delete a node. */
43
+ delete(versionId: string, nodeId: string): Promise<void>;
44
+ /** Get the configuration schema for a node (field types, requirements, options). */
45
+ getConfigSchema(versionId: string, nodeId: string): Promise<ConfigSchemaResponse>;
46
+ /** Get available upstream variables for a node. */
47
+ getAvailableVars(versionId: string, nodeId: string): Promise<AvailableVarsResponse>;
48
+ /** Test a single node. The version must not be published. */
49
+ test(versionId: string, nodeId: string, body?: TestNodeBody): Promise<TestNodeResponse>;
50
+ }
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+ /**
3
+ * Node resource — client.nodes.*
4
+ *
5
+ * Maps to:
6
+ * GET /versions/:version_id/nodes
7
+ * POST /versions/:version_id/nodes
8
+ * GET /versions/:version_id/nodes/:node_id
9
+ * PUT /versions/:version_id/nodes/:node_id
10
+ * DELETE /versions/:version_id/nodes/:node_id
11
+ * GET /versions/:version_id/nodes/:node_id/config-schema
12
+ * GET /versions/:version_id/nodes/:node_id/available-vars
13
+ * POST /versions/:version_id/nodes/:node_id/test
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.NodesResource = void 0;
17
+ class NodesResource {
18
+ http;
19
+ constructor(http) {
20
+ this.http = http;
21
+ }
22
+ /** List all nodes in a version. */
23
+ async list(versionId) {
24
+ return this.http.request({
25
+ method: "GET",
26
+ path: `/versions/${enc(versionId)}/nodes`,
27
+ });
28
+ }
29
+ /** Add nodes to a version (batch, 1-50). */
30
+ async addBatch(versionId, body) {
31
+ return this.http.request({
32
+ method: "POST",
33
+ path: `/versions/${enc(versionId)}/nodes`,
34
+ body,
35
+ });
36
+ }
37
+ /** Get a single node by ID. */
38
+ async get(versionId, nodeId) {
39
+ return this.http.request({
40
+ method: "GET",
41
+ path: `/versions/${enc(versionId)}/nodes/${enc(nodeId)}`,
42
+ });
43
+ }
44
+ /** Update a node. */
45
+ async update(versionId, nodeId, body) {
46
+ return this.http.request({
47
+ method: "PUT",
48
+ path: `/versions/${enc(versionId)}/nodes/${enc(nodeId)}`,
49
+ body,
50
+ });
51
+ }
52
+ /** Delete a node. */
53
+ async delete(versionId, nodeId) {
54
+ return this.http.request({
55
+ method: "DELETE",
56
+ path: `/versions/${enc(versionId)}/nodes/${enc(nodeId)}`,
57
+ });
58
+ }
59
+ /** Get the configuration schema for a node (field types, requirements, options). */
60
+ async getConfigSchema(versionId, nodeId) {
61
+ return this.http.request({
62
+ method: "GET",
63
+ path: `/versions/${enc(versionId)}/nodes/${enc(nodeId)}/config-schema`,
64
+ });
65
+ }
66
+ /** Get available upstream variables for a node. */
67
+ async getAvailableVars(versionId, nodeId) {
68
+ return this.http.request({
69
+ method: "GET",
70
+ path: `/versions/${enc(versionId)}/nodes/${enc(nodeId)}/available-vars`,
71
+ });
72
+ }
73
+ /** Test a single node. The version must not be published. */
74
+ async test(versionId, nodeId, body) {
75
+ return this.http.request({
76
+ method: "POST",
77
+ path: `/versions/${enc(versionId)}/nodes/${enc(nodeId)}/test`,
78
+ body: body ?? {},
79
+ });
80
+ }
81
+ }
82
+ exports.NodesResource = NodesResource;
83
+ function enc(s) {
84
+ return encodeURIComponent(s);
85
+ }
86
+ //# sourceMappingURL=nodes.js.map
@@ -0,0 +1,3 @@
1
+ // ESM wrapper — re-exports CJS module
2
+ export { default } from "./nodes.js";
3
+ export * from "./nodes.js";
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Northstar resource — client.northstars.*
3
+ *
4
+ * Maps to:
5
+ * GET /northstars/:northstar_id
6
+ * PATCH /northstars/:northstar_id
7
+ * DELETE /northstars/:northstar_id
8
+ * GET /northstars/:northstar_id/history
9
+ * POST /northstars/:northstar_id/feedback
10
+ * DELETE /northstars/:northstar_id/feedback
11
+ */
12
+ import type { HttpClient } from "../core/http";
13
+ import type { GetNorthstarResponse, PatchNorthstarBody, PatchNorthstarResponse, GetNorthstarHistoryResponse, SubmitNorthstarFeedbackBody, SubmitNorthstarFeedbackResponse } from "../types/northstars.types";
14
+ export declare class NorthstarsResource {
15
+ private readonly http;
16
+ constructor(http: HttpClient);
17
+ /** Get a northstar by ID. */
18
+ get(northstarId: string): Promise<GetNorthstarResponse>;
19
+ /** Update a northstar. */
20
+ update(northstarId: string, body: PatchNorthstarBody): Promise<PatchNorthstarResponse>;
21
+ /** Delete a northstar. */
22
+ delete(northstarId: string): Promise<void>;
23
+ /** Get the full regeneration history chain for a northstar. */
24
+ getHistory(northstarId: string): Promise<GetNorthstarHistoryResponse>;
25
+ /** Submit a correctness rating for a northstar. */
26
+ submitFeedback(northstarId: string, body: SubmitNorthstarFeedbackBody): Promise<SubmitNorthstarFeedbackResponse>;
27
+ /** Delete your feedback on a northstar. */
28
+ deleteFeedback(northstarId: string): Promise<void>;
29
+ }
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ /**
3
+ * Northstar resource — client.northstars.*
4
+ *
5
+ * Maps to:
6
+ * GET /northstars/:northstar_id
7
+ * PATCH /northstars/:northstar_id
8
+ * DELETE /northstars/:northstar_id
9
+ * GET /northstars/:northstar_id/history
10
+ * POST /northstars/:northstar_id/feedback
11
+ * DELETE /northstars/:northstar_id/feedback
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.NorthstarsResource = void 0;
15
+ class NorthstarsResource {
16
+ http;
17
+ constructor(http) {
18
+ this.http = http;
19
+ }
20
+ /** Get a northstar by ID. */
21
+ async get(northstarId) {
22
+ return this.http.request({
23
+ method: "GET",
24
+ path: `/northstars/${enc(northstarId)}`,
25
+ });
26
+ }
27
+ /** Update a northstar. */
28
+ async update(northstarId, body) {
29
+ return this.http.request({
30
+ method: "PATCH",
31
+ path: `/northstars/${enc(northstarId)}`,
32
+ body,
33
+ });
34
+ }
35
+ /** Delete a northstar. */
36
+ async delete(northstarId) {
37
+ return this.http.request({
38
+ method: "DELETE",
39
+ path: `/northstars/${enc(northstarId)}`,
40
+ });
41
+ }
42
+ /** Get the full regeneration history chain for a northstar. */
43
+ async getHistory(northstarId) {
44
+ return this.http.request({
45
+ method: "GET",
46
+ path: `/northstars/${enc(northstarId)}/history`,
47
+ });
48
+ }
49
+ /** Submit a correctness rating for a northstar. */
50
+ async submitFeedback(northstarId, body) {
51
+ return this.http.request({
52
+ method: "POST",
53
+ path: `/northstars/${enc(northstarId)}/feedback`,
54
+ body,
55
+ });
56
+ }
57
+ /** Delete your feedback on a northstar. */
58
+ async deleteFeedback(northstarId) {
59
+ return this.http.request({
60
+ method: "DELETE",
61
+ path: `/northstars/${enc(northstarId)}/feedback`,
62
+ });
63
+ }
64
+ }
65
+ exports.NorthstarsResource = NorthstarsResource;
66
+ function enc(s) {
67
+ return encodeURIComponent(s);
68
+ }
69
+ //# sourceMappingURL=northstars.js.map
@@ -0,0 +1,3 @@
1
+ // ESM wrapper — re-exports CJS module
2
+ export { default } from "./northstars.js";
3
+ export * from "./northstars.js";
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Phone numbers resource — client.phoneNumbers.*
3
+ *
4
+ * Maps to:
5
+ * GET /phone-numbers
6
+ * POST /phone-numbers
7
+ * PUT /phone-numbers/:id
8
+ * GET /phone-numbers/:phone_number_id/usage
9
+ * GET /phone-numbers/:phone_number_id/tollfree-verification
10
+ * POST /phone-numbers/:phone_number_id/tollfree-verification
11
+ * POST /phone-numbers/:phone_number_id/sip-trunk
12
+ * POST /phone-numbers/:phone_number_id/free-up-number
13
+ * POST /phone-numbers/:phone_number_id/remove-from-workflow
14
+ * POST /phone-numbers/:phone_number_id/delete-number
15
+ * POST /phone-numbers/validate-toll-free-numbers
16
+ * DELETE /phone-numbers/tollfree-verification/:verification_sid
17
+ */
18
+ import type { HttpClient } from "../core/http";
19
+ import type { ListPhoneNumbersQuery, ListPhoneNumbersResponse, BuyPhoneNumberBody, BuyPhoneNumberResponse, UpdatePhoneNumberBody, UpdatePhoneNumberResponse, PhoneNumberUsageResponse, TollFreeVerificationResponse, CreateTollFreeVerificationBody, CreateTollFreeVerificationResponse, DeleteTollFreeVerificationResponse, CreateSipTrunkForPhoneResponse, FreeUpNumberResponse, DeleteNumberResponse, RemoveFromUseCaseBody, RemoveFromUseCaseResponse, ValidateTollFreeNumbersBody, ValidateTollFreeNumbersResponse } from "../types/phone-numbers.types";
20
+ export declare class PhoneNumbersResource {
21
+ private readonly http;
22
+ constructor(http: HttpClient);
23
+ /** List all phone numbers. */
24
+ list(query?: ListPhoneNumbersQuery): Promise<ListPhoneNumbersResponse>;
25
+ /** Buy a new phone number. */
26
+ buy(body: BuyPhoneNumberBody): Promise<BuyPhoneNumberResponse>;
27
+ /** Update a phone number (name, caller_id). */
28
+ update(phoneNumberId: string, body: UpdatePhoneNumberBody): Promise<UpdatePhoneNumberResponse>;
29
+ /** Get usage info for a phone number. */
30
+ getUsage(phoneNumberId: string): Promise<PhoneNumberUsageResponse>;
31
+ /** Get toll-free verification status. */
32
+ getTollFreeVerification(phoneNumberId: string): Promise<TollFreeVerificationResponse>;
33
+ /** Create toll-free verification. */
34
+ createTollFreeVerification(phoneNumberId: string, body: CreateTollFreeVerificationBody): Promise<CreateTollFreeVerificationResponse>;
35
+ /** Delete a toll-free verification. */
36
+ deleteTollFreeVerification(verificationSid: string): Promise<DeleteTollFreeVerificationResponse>;
37
+ /** Create a SIP trunk for a phone number. */
38
+ createSipTrunk(phoneNumberId: string): Promise<CreateSipTrunkForPhoneResponse>;
39
+ /** Free up a phone number (release from workflows). */
40
+ freeUp(phoneNumberId: string): Promise<FreeUpNumberResponse>;
41
+ /** Delete a phone number permanently. */
42
+ delete(phoneNumberId: string): Promise<DeleteNumberResponse>;
43
+ /** Remove a phone number from a specific workflow. */
44
+ removeFromWorkflow(phoneNumberId: string, body: RemoveFromUseCaseBody): Promise<RemoveFromUseCaseResponse>;
45
+ /** Validate toll-free numbers for conflicts. */
46
+ validateTollFreeNumbers(body: ValidateTollFreeNumbersBody): Promise<ValidateTollFreeNumbersResponse>;
47
+ }
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ /**
3
+ * Phone numbers resource — client.phoneNumbers.*
4
+ *
5
+ * Maps to:
6
+ * GET /phone-numbers
7
+ * POST /phone-numbers
8
+ * PUT /phone-numbers/:id
9
+ * GET /phone-numbers/:phone_number_id/usage
10
+ * GET /phone-numbers/:phone_number_id/tollfree-verification
11
+ * POST /phone-numbers/:phone_number_id/tollfree-verification
12
+ * POST /phone-numbers/:phone_number_id/sip-trunk
13
+ * POST /phone-numbers/:phone_number_id/free-up-number
14
+ * POST /phone-numbers/:phone_number_id/remove-from-workflow
15
+ * POST /phone-numbers/:phone_number_id/delete-number
16
+ * POST /phone-numbers/validate-toll-free-numbers
17
+ * DELETE /phone-numbers/tollfree-verification/:verification_sid
18
+ */
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.PhoneNumbersResource = void 0;
21
+ class PhoneNumbersResource {
22
+ http;
23
+ constructor(http) {
24
+ this.http = http;
25
+ }
26
+ /** List all phone numbers. */
27
+ async list(query) {
28
+ return this.http.request({
29
+ method: "GET",
30
+ path: "/phone-numbers",
31
+ query: query,
32
+ });
33
+ }
34
+ /** Buy a new phone number. */
35
+ async buy(body) {
36
+ return this.http.request({
37
+ method: "POST",
38
+ path: "/phone-numbers",
39
+ body,
40
+ });
41
+ }
42
+ /** Update a phone number (name, caller_id). */
43
+ async update(phoneNumberId, body) {
44
+ return this.http.request({
45
+ method: "PUT",
46
+ path: `/phone-numbers/${enc(phoneNumberId)}`,
47
+ body,
48
+ });
49
+ }
50
+ /** Get usage info for a phone number. */
51
+ async getUsage(phoneNumberId) {
52
+ return this.http.request({
53
+ method: "GET",
54
+ path: `/phone-numbers/${enc(phoneNumberId)}/usage`,
55
+ });
56
+ }
57
+ /** Get toll-free verification status. */
58
+ async getTollFreeVerification(phoneNumberId) {
59
+ return this.http.request({
60
+ method: "GET",
61
+ path: `/phone-numbers/${enc(phoneNumberId)}/tollfree-verification`,
62
+ });
63
+ }
64
+ /** Create toll-free verification. */
65
+ async createTollFreeVerification(phoneNumberId, body) {
66
+ return this.http.request({
67
+ method: "POST",
68
+ path: `/phone-numbers/${enc(phoneNumberId)}/tollfree-verification`,
69
+ body,
70
+ });
71
+ }
72
+ /** Delete a toll-free verification. */
73
+ async deleteTollFreeVerification(verificationSid) {
74
+ return this.http.request({
75
+ method: "DELETE",
76
+ path: `/phone-numbers/tollfree-verification/${enc(verificationSid)}`,
77
+ });
78
+ }
79
+ /** Create a SIP trunk for a phone number. */
80
+ async createSipTrunk(phoneNumberId) {
81
+ return this.http.request({
82
+ method: "POST",
83
+ path: `/phone-numbers/${enc(phoneNumberId)}/sip-trunk`,
84
+ });
85
+ }
86
+ /** Free up a phone number (release from workflows). */
87
+ async freeUp(phoneNumberId) {
88
+ return this.http.request({
89
+ method: "POST",
90
+ path: `/phone-numbers/${enc(phoneNumberId)}/free-up-number`,
91
+ });
92
+ }
93
+ /** Delete a phone number permanently. */
94
+ async delete(phoneNumberId) {
95
+ return this.http.request({
96
+ method: "POST",
97
+ path: `/phone-numbers/${enc(phoneNumberId)}/delete-number`,
98
+ });
99
+ }
100
+ /** Remove a phone number from a specific workflow. */
101
+ async removeFromWorkflow(phoneNumberId, body) {
102
+ return this.http.request({
103
+ method: "POST",
104
+ path: `/phone-numbers/${enc(phoneNumberId)}/remove-from-workflow`,
105
+ body,
106
+ });
107
+ }
108
+ /** Validate toll-free numbers for conflicts. */
109
+ async validateTollFreeNumbers(body) {
110
+ return this.http.request({
111
+ method: "POST",
112
+ path: "/phone-numbers/validate-toll-free-numbers",
113
+ body,
114
+ });
115
+ }
116
+ }
117
+ exports.PhoneNumbersResource = PhoneNumbersResource;
118
+ function enc(s) {
119
+ return encodeURIComponent(s);
120
+ }
121
+ //# sourceMappingURL=phone-numbers.js.map
@@ -0,0 +1,3 @@
1
+ // ESM wrapper — re-exports CJS module
2
+ export { default } from "./phone-numbers.js";
3
+ export * from "./phone-numbers.js";
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Run resource — client.runs.*
3
+ *
4
+ * Maps to:
5
+ * GET /runs
6
+ * GET /runs/:run_id
7
+ * GET /runs/:run_id/sessions
8
+ * GET /runs/:run_id/recordings
9
+ * GET /runs/:run_id/flags
10
+ * POST /runs/:run_id/cancel
11
+ * POST /runs/:run_id/mark
12
+ */
13
+ import type { HttpClient } from "../core/http";
14
+ import type { RunDetail, MarkRunBody, MarkRunResponse, ListFlagsQuery, PaginatedFlagsResponse } from "../types/runs.types";
15
+ import type { PaginatedSessionsResponse, ListSessionsQuery } from "../types/sessions.types";
16
+ export declare class RunsResource {
17
+ private readonly http;
18
+ constructor(http: HttpClient);
19
+ /** Get a run by ID. */
20
+ get(runId: string): Promise<RunDetail>;
21
+ /** Get sessions for a run. */
22
+ getSessions(runId: string, query?: ListSessionsQuery): Promise<PaginatedSessionsResponse>;
23
+ /** Get recordings for a run. */
24
+ getRecordings(runId: string): Promise<unknown>;
25
+ /** Get quality flags for a run. */
26
+ getFlags(runId: string, query?: ListFlagsQuery): Promise<PaginatedFlagsResponse>;
27
+ /** Cancel a run. */
28
+ cancel(runId: string): Promise<void>;
29
+ /** Mark a run with an annotation (correct, incorrect, critical). */
30
+ mark(runId: string, body: MarkRunBody): Promise<MarkRunResponse>;
31
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ /**
3
+ * Run resource — client.runs.*
4
+ *
5
+ * Maps to:
6
+ * GET /runs
7
+ * GET /runs/:run_id
8
+ * GET /runs/:run_id/sessions
9
+ * GET /runs/:run_id/recordings
10
+ * GET /runs/:run_id/flags
11
+ * POST /runs/:run_id/cancel
12
+ * POST /runs/:run_id/mark
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.RunsResource = void 0;
16
+ class RunsResource {
17
+ http;
18
+ constructor(http) {
19
+ this.http = http;
20
+ }
21
+ /** Get a run by ID. */
22
+ async get(runId) {
23
+ return this.http.request({
24
+ method: "GET",
25
+ path: `/runs/${enc(runId)}`,
26
+ });
27
+ }
28
+ /** Get sessions for a run. */
29
+ async getSessions(runId, query) {
30
+ return this.http.request({
31
+ method: "GET",
32
+ path: `/runs/${enc(runId)}/sessions`,
33
+ query: query,
34
+ });
35
+ }
36
+ /** Get recordings for a run. */
37
+ async getRecordings(runId) {
38
+ return this.http.request({
39
+ method: "GET",
40
+ path: `/runs/${enc(runId)}/recordings`,
41
+ });
42
+ }
43
+ /** Get quality flags for a run. */
44
+ async getFlags(runId, query) {
45
+ return this.http.request({
46
+ method: "GET",
47
+ path: `/runs/${enc(runId)}/flags`,
48
+ query: query,
49
+ });
50
+ }
51
+ /** Cancel a run. */
52
+ async cancel(runId) {
53
+ return this.http.request({
54
+ method: "POST",
55
+ path: `/runs/${enc(runId)}/cancel`,
56
+ });
57
+ }
58
+ /** Mark a run with an annotation (correct, incorrect, critical). */
59
+ async mark(runId, body) {
60
+ return this.http.request({
61
+ method: "POST",
62
+ path: `/runs/${enc(runId)}/mark`,
63
+ body,
64
+ });
65
+ }
66
+ }
67
+ exports.RunsResource = RunsResource;
68
+ function enc(s) {
69
+ return encodeURIComponent(s);
70
+ }
71
+ //# sourceMappingURL=runs.js.map
@@ -0,0 +1,3 @@
1
+ // ESM wrapper — re-exports CJS module
2
+ export { default } from "./runs.js";
3
+ export * from "./runs.js";
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Session resource — client.sessions.*
3
+ *
4
+ * Maps to:
5
+ * GET /sessions/:session_id
6
+ * GET /sessions/:session_id/messages
7
+ * GET /sessions/:session_id/stream
8
+ */
9
+ import type { HttpClient } from "../core/http";
10
+ import type { SSEEvent } from "../core/sse";
11
+ import type { SessionItem, ListMessagesQuery, PaginatedMessagesResponse, StreamQuery, SessionStreamEvent } from "../types/sessions.types";
12
+ export declare class SessionsResource {
13
+ private readonly http;
14
+ constructor(http: HttpClient);
15
+ /** Get a session by ID. */
16
+ get(sessionId: string): Promise<SessionItem>;
17
+ /** Get messages for a session. */
18
+ getMessages(sessionId: string, query?: ListMessagesQuery): Promise<PaginatedMessagesResponse>;
19
+ /**
20
+ * Open an SSE stream for a session's messages.
21
+ *
22
+ * Returns an async iterable of typed SSE events (`connected`, `message`,
23
+ * `backfill_complete`, `session_ended`, `error`).
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * for await (const event of client.sessions.stream(sessionId, { backfillLimit: 50 })) {
28
+ * if (event.event === "message") {
29
+ * console.log(event.data.role, event.data.content);
30
+ * }
31
+ * if (event.event === "session_ended") break;
32
+ * }
33
+ * ```
34
+ */
35
+ stream(sessionId: string, query?: StreamQuery): Promise<AsyncGenerator<SSEEvent<SessionStreamEvent["data"]>, void, undefined>>;
36
+ }