phonic 0.28.1 → 0.29.1
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 +12 -4
- package/dist/index.d.mts +91 -37
- package/dist/index.d.ts +91 -37
- package/dist/index.js +18 -9
- package/dist/index.mjs +18 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -193,7 +193,9 @@ const result = await phonic.agents.delete("chris", {
|
|
|
193
193
|
### List tools
|
|
194
194
|
|
|
195
195
|
```ts
|
|
196
|
-
const result = await phonic.tools.list(
|
|
196
|
+
const result = await phonic.tools.list({
|
|
197
|
+
project: "customer-support" // Optional. Defaults to "main".
|
|
198
|
+
});
|
|
197
199
|
```
|
|
198
200
|
|
|
199
201
|
### Get tool
|
|
@@ -201,7 +203,9 @@ const result = await phonic.tools.list();
|
|
|
201
203
|
Returns a tool by name or ID.
|
|
202
204
|
|
|
203
205
|
```ts
|
|
204
|
-
const result = await phonic.tools.get("next_invoice"
|
|
206
|
+
const result = await phonic.tools.get("next_invoice", {
|
|
207
|
+
project: "customer-support" // Optional. Defaults to "main".
|
|
208
|
+
});
|
|
205
209
|
```
|
|
206
210
|
|
|
207
211
|
### Create tool
|
|
@@ -210,6 +214,7 @@ const result = await phonic.tools.get("next_invoice");
|
|
|
210
214
|
|
|
211
215
|
```ts
|
|
212
216
|
const result = await phonic.tools.create({
|
|
217
|
+
project: "customer-support", // Optional. Defaults to "main".
|
|
213
218
|
name: "next_invoice",
|
|
214
219
|
description: "Returns the next invoice of the given user",
|
|
215
220
|
type: "custom_webhook",
|
|
@@ -250,6 +255,7 @@ WebSocket tools allow you to handle tool execution through the WebSocket connect
|
|
|
250
255
|
|
|
251
256
|
```ts
|
|
252
257
|
const result = await phonic.tools.create({
|
|
258
|
+
project: "customer-support", // Optional. Defaults to "main".
|
|
253
259
|
name: "get_product_recommendations",
|
|
254
260
|
description: "Gets personalized product recommendations",
|
|
255
261
|
type: "custom_websocket",
|
|
@@ -309,6 +315,7 @@ Updates a tool by ID or name. All fields are optional - only provided fields wil
|
|
|
309
315
|
|
|
310
316
|
```ts
|
|
311
317
|
const result = await phonic.tools.update("next_invoice", {
|
|
318
|
+
project: "customer-support", // Optional. Defaults to "main".
|
|
312
319
|
name: "next_invoice_updated",
|
|
313
320
|
description: "Updated description.",
|
|
314
321
|
type: "custom_webhook",
|
|
@@ -357,10 +364,11 @@ const result = await phonic.tools.update("get_product_recommendations", {
|
|
|
357
364
|
Deletes a tool by ID or name.
|
|
358
365
|
|
|
359
366
|
```ts
|
|
360
|
-
const result = await phonic.tools.delete("next_invoice"
|
|
367
|
+
const result = await phonic.tools.delete("next_invoice", {
|
|
368
|
+
project: "customer-support" // Optional. Defaults to "main".
|
|
369
|
+
});
|
|
361
370
|
```
|
|
362
371
|
|
|
363
|
-
|
|
364
372
|
## Voices
|
|
365
373
|
|
|
366
374
|
### List voices
|
package/dist/index.d.mts
CHANGED
|
@@ -36,7 +36,79 @@ type DataOrError<T> = Promise<{
|
|
|
36
36
|
};
|
|
37
37
|
}>;
|
|
38
38
|
type ISODate = `${string}-${string}-${string}`;
|
|
39
|
-
type ISODateTime
|
|
39
|
+
type ISODateTime = `${string}Z`;
|
|
40
|
+
type TaskStatus = "pending" | "completed" | "failed";
|
|
41
|
+
type TaskResult = {
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
status: TaskStatus;
|
|
45
|
+
commentary: string | null;
|
|
46
|
+
};
|
|
47
|
+
type TaskResults = {
|
|
48
|
+
results: Array<TaskResult>;
|
|
49
|
+
};
|
|
50
|
+
type ConversationItem = {
|
|
51
|
+
role: "user";
|
|
52
|
+
item_idx: number;
|
|
53
|
+
text: string;
|
|
54
|
+
duration_ms: number;
|
|
55
|
+
started_at: string;
|
|
56
|
+
} | {
|
|
57
|
+
role: "assistant";
|
|
58
|
+
item_idx: number;
|
|
59
|
+
text: string;
|
|
60
|
+
voice_id: string;
|
|
61
|
+
system_prompt: string;
|
|
62
|
+
audio_speed: number;
|
|
63
|
+
duration_ms: number;
|
|
64
|
+
started_at: string;
|
|
65
|
+
};
|
|
66
|
+
type Conversation = {
|
|
67
|
+
id: string;
|
|
68
|
+
external_id: string | null;
|
|
69
|
+
workspace: string;
|
|
70
|
+
agent: {
|
|
71
|
+
id: string;
|
|
72
|
+
name: string;
|
|
73
|
+
} | null;
|
|
74
|
+
model: string;
|
|
75
|
+
welcome_message: string | null;
|
|
76
|
+
input_format: "pcm_44100" | "mulaw_8000";
|
|
77
|
+
output_format: "pcm_44100" | "mulaw_8000";
|
|
78
|
+
live_transcript: string;
|
|
79
|
+
post_call_transcript: string | null;
|
|
80
|
+
audio_url: string | null;
|
|
81
|
+
duration_ms: number;
|
|
82
|
+
task_results: TaskResults;
|
|
83
|
+
started_at: ISODateTime;
|
|
84
|
+
ended_at: ISODateTime | null;
|
|
85
|
+
items: Array<ConversationItem>;
|
|
86
|
+
};
|
|
87
|
+
type ConversationEndedWebhookPayload = {
|
|
88
|
+
event_type: "conversation.ended";
|
|
89
|
+
created_at: ISODateTime;
|
|
90
|
+
data: {
|
|
91
|
+
conversation: Conversation;
|
|
92
|
+
call_info: {
|
|
93
|
+
from_phone_number: string;
|
|
94
|
+
to_phone_number: string;
|
|
95
|
+
} | null;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
type ConversationAnalysisWebhookPayload = {
|
|
99
|
+
event_type: "conversation.analysis";
|
|
100
|
+
created_at: ISODateTime;
|
|
101
|
+
data: {
|
|
102
|
+
conversation: {
|
|
103
|
+
latencies_ms: number[];
|
|
104
|
+
interruptions_count: number;
|
|
105
|
+
};
|
|
106
|
+
call_info: {
|
|
107
|
+
from_phone_number: string;
|
|
108
|
+
to_phone_number: string;
|
|
109
|
+
} | null;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
40
112
|
|
|
41
113
|
type PhonicSTSTool = "keypad_input" | "natural_conversation_ending" | (string & {});
|
|
42
114
|
interface PhonicSTSConfigBase {
|
|
@@ -291,36 +363,6 @@ declare class Agents {
|
|
|
291
363
|
delete(nameOrId: string, params?: DeleteAgentParams): DataOrError<DeleteAgentSuccessResponse>;
|
|
292
364
|
}
|
|
293
365
|
|
|
294
|
-
type ISODateTime = `${string}Z`;
|
|
295
|
-
type ConversationItem = {
|
|
296
|
-
role: "user";
|
|
297
|
-
item_idx: number;
|
|
298
|
-
text: string;
|
|
299
|
-
duration_ms: number;
|
|
300
|
-
started_at: string;
|
|
301
|
-
} | {
|
|
302
|
-
role: "assistant";
|
|
303
|
-
item_idx: number;
|
|
304
|
-
text: string;
|
|
305
|
-
voice_id: string;
|
|
306
|
-
system_prompt: string;
|
|
307
|
-
audio_speed: number;
|
|
308
|
-
duration_ms: number;
|
|
309
|
-
started_at: string;
|
|
310
|
-
};
|
|
311
|
-
type Conversation = {
|
|
312
|
-
id: string;
|
|
313
|
-
external_id: string | null;
|
|
314
|
-
model: string;
|
|
315
|
-
welcome_message: string | null;
|
|
316
|
-
input_format: "pcm_44100" | "mulaw_8000";
|
|
317
|
-
output_format: "pcm_44100" | "mulaw_8000";
|
|
318
|
-
text: string;
|
|
319
|
-
duration_ms: number;
|
|
320
|
-
started_at: ISODateTime;
|
|
321
|
-
ended_at: ISODateTime;
|
|
322
|
-
items: Array<ConversationItem>;
|
|
323
|
-
};
|
|
324
366
|
type ConversationSuccessResponse = {
|
|
325
367
|
conversation: Conversation;
|
|
326
368
|
};
|
|
@@ -358,8 +400,8 @@ declare class Conversations {
|
|
|
358
400
|
project?: string;
|
|
359
401
|
durationMin?: number;
|
|
360
402
|
durationMax?: number;
|
|
361
|
-
startedAtMin?: ISODate | ISODateTime
|
|
362
|
-
startedAtMax?: ISODate | ISODateTime
|
|
403
|
+
startedAtMin?: ISODate | ISODateTime;
|
|
404
|
+
startedAtMax?: ISODate | ISODateTime;
|
|
363
405
|
}): DataOrError<ConversationsSuccessResponse>;
|
|
364
406
|
get(id: string): DataOrError<ConversationSuccessResponse>;
|
|
365
407
|
getByExternalId({ project, externalId, }: {
|
|
@@ -479,13 +521,20 @@ interface WebSocketTool extends ToolBase {
|
|
|
479
521
|
tool_call_output_timeout_ms: number;
|
|
480
522
|
}
|
|
481
523
|
type Tool = WebhookTool | WebSocketTool;
|
|
524
|
+
type ListToolsParams = {
|
|
525
|
+
project?: string;
|
|
526
|
+
};
|
|
482
527
|
type ListToolsSuccessResponse = DataOrError<{
|
|
483
528
|
tools: Array<Tool>;
|
|
484
529
|
}>;
|
|
530
|
+
type GetToolParams = {
|
|
531
|
+
project?: string;
|
|
532
|
+
};
|
|
485
533
|
type GetToolSuccessResponse = DataOrError<{
|
|
486
534
|
tool: Tool;
|
|
487
535
|
}>;
|
|
488
536
|
interface CreateToolParamsBase {
|
|
537
|
+
project?: string;
|
|
489
538
|
name: string;
|
|
490
539
|
description: string;
|
|
491
540
|
executionMode: ExecutionMode;
|
|
@@ -508,6 +557,7 @@ type CreateToolSuccessResponse = {
|
|
|
508
557
|
name: string;
|
|
509
558
|
};
|
|
510
559
|
type UpdateToolParams = {
|
|
560
|
+
project?: string;
|
|
511
561
|
name?: string;
|
|
512
562
|
description?: string;
|
|
513
563
|
type?: "custom_webhook" | "custom_websocket";
|
|
@@ -522,6 +572,9 @@ type UpdateToolParams = {
|
|
|
522
572
|
type UpdateToolSuccessResponse = {
|
|
523
573
|
success: true;
|
|
524
574
|
};
|
|
575
|
+
type DeleteToolParams = {
|
|
576
|
+
project?: string;
|
|
577
|
+
};
|
|
525
578
|
type DeleteToolSuccessResponse = {
|
|
526
579
|
success: true;
|
|
527
580
|
};
|
|
@@ -529,12 +582,13 @@ type DeleteToolSuccessResponse = {
|
|
|
529
582
|
declare class Tools {
|
|
530
583
|
private readonly phonic;
|
|
531
584
|
constructor(phonic: Phonic);
|
|
585
|
+
private getQueryString;
|
|
532
586
|
private getParametersForBody;
|
|
533
|
-
list(): DataOrError<ListToolsSuccessResponse>;
|
|
534
|
-
get(nameOrId: string): DataOrError<GetToolSuccessResponse>;
|
|
587
|
+
list(params?: ListToolsParams): DataOrError<ListToolsSuccessResponse>;
|
|
588
|
+
get(nameOrId: string, params?: GetToolParams): DataOrError<GetToolSuccessResponse>;
|
|
535
589
|
create(params: CreateToolParams): DataOrError<CreateToolSuccessResponse>;
|
|
536
590
|
update(nameOrId: string, params: UpdateToolParams): DataOrError<UpdateToolSuccessResponse>;
|
|
537
|
-
delete(nameOrId: string): DataOrError<DeleteToolSuccessResponse>;
|
|
591
|
+
delete(nameOrId: string, params?: DeleteToolParams): DataOrError<DeleteToolSuccessResponse>;
|
|
538
592
|
}
|
|
539
593
|
|
|
540
594
|
type Voice = {
|
|
@@ -627,4 +681,4 @@ declare class Phonic {
|
|
|
627
681
|
}>;
|
|
628
682
|
}
|
|
629
683
|
|
|
630
|
-
export { Phonic, type PhonicConfigurationEndpointRequestPayload, type PhonicConfigurationEndpointResponsePayload, type PhonicSTSConfig, PhonicSTSWebSocket, type PhonicSTSWebSocketResponseMessage };
|
|
684
|
+
export { type ConversationAnalysisWebhookPayload, type ConversationEndedWebhookPayload, Phonic, type PhonicConfigurationEndpointRequestPayload, type PhonicConfigurationEndpointResponsePayload, type PhonicSTSConfig, PhonicSTSWebSocket, type PhonicSTSWebSocketResponseMessage };
|
package/dist/index.d.ts
CHANGED
|
@@ -36,7 +36,79 @@ type DataOrError<T> = Promise<{
|
|
|
36
36
|
};
|
|
37
37
|
}>;
|
|
38
38
|
type ISODate = `${string}-${string}-${string}`;
|
|
39
|
-
type ISODateTime
|
|
39
|
+
type ISODateTime = `${string}Z`;
|
|
40
|
+
type TaskStatus = "pending" | "completed" | "failed";
|
|
41
|
+
type TaskResult = {
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
status: TaskStatus;
|
|
45
|
+
commentary: string | null;
|
|
46
|
+
};
|
|
47
|
+
type TaskResults = {
|
|
48
|
+
results: Array<TaskResult>;
|
|
49
|
+
};
|
|
50
|
+
type ConversationItem = {
|
|
51
|
+
role: "user";
|
|
52
|
+
item_idx: number;
|
|
53
|
+
text: string;
|
|
54
|
+
duration_ms: number;
|
|
55
|
+
started_at: string;
|
|
56
|
+
} | {
|
|
57
|
+
role: "assistant";
|
|
58
|
+
item_idx: number;
|
|
59
|
+
text: string;
|
|
60
|
+
voice_id: string;
|
|
61
|
+
system_prompt: string;
|
|
62
|
+
audio_speed: number;
|
|
63
|
+
duration_ms: number;
|
|
64
|
+
started_at: string;
|
|
65
|
+
};
|
|
66
|
+
type Conversation = {
|
|
67
|
+
id: string;
|
|
68
|
+
external_id: string | null;
|
|
69
|
+
workspace: string;
|
|
70
|
+
agent: {
|
|
71
|
+
id: string;
|
|
72
|
+
name: string;
|
|
73
|
+
} | null;
|
|
74
|
+
model: string;
|
|
75
|
+
welcome_message: string | null;
|
|
76
|
+
input_format: "pcm_44100" | "mulaw_8000";
|
|
77
|
+
output_format: "pcm_44100" | "mulaw_8000";
|
|
78
|
+
live_transcript: string;
|
|
79
|
+
post_call_transcript: string | null;
|
|
80
|
+
audio_url: string | null;
|
|
81
|
+
duration_ms: number;
|
|
82
|
+
task_results: TaskResults;
|
|
83
|
+
started_at: ISODateTime;
|
|
84
|
+
ended_at: ISODateTime | null;
|
|
85
|
+
items: Array<ConversationItem>;
|
|
86
|
+
};
|
|
87
|
+
type ConversationEndedWebhookPayload = {
|
|
88
|
+
event_type: "conversation.ended";
|
|
89
|
+
created_at: ISODateTime;
|
|
90
|
+
data: {
|
|
91
|
+
conversation: Conversation;
|
|
92
|
+
call_info: {
|
|
93
|
+
from_phone_number: string;
|
|
94
|
+
to_phone_number: string;
|
|
95
|
+
} | null;
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
type ConversationAnalysisWebhookPayload = {
|
|
99
|
+
event_type: "conversation.analysis";
|
|
100
|
+
created_at: ISODateTime;
|
|
101
|
+
data: {
|
|
102
|
+
conversation: {
|
|
103
|
+
latencies_ms: number[];
|
|
104
|
+
interruptions_count: number;
|
|
105
|
+
};
|
|
106
|
+
call_info: {
|
|
107
|
+
from_phone_number: string;
|
|
108
|
+
to_phone_number: string;
|
|
109
|
+
} | null;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
40
112
|
|
|
41
113
|
type PhonicSTSTool = "keypad_input" | "natural_conversation_ending" | (string & {});
|
|
42
114
|
interface PhonicSTSConfigBase {
|
|
@@ -291,36 +363,6 @@ declare class Agents {
|
|
|
291
363
|
delete(nameOrId: string, params?: DeleteAgentParams): DataOrError<DeleteAgentSuccessResponse>;
|
|
292
364
|
}
|
|
293
365
|
|
|
294
|
-
type ISODateTime = `${string}Z`;
|
|
295
|
-
type ConversationItem = {
|
|
296
|
-
role: "user";
|
|
297
|
-
item_idx: number;
|
|
298
|
-
text: string;
|
|
299
|
-
duration_ms: number;
|
|
300
|
-
started_at: string;
|
|
301
|
-
} | {
|
|
302
|
-
role: "assistant";
|
|
303
|
-
item_idx: number;
|
|
304
|
-
text: string;
|
|
305
|
-
voice_id: string;
|
|
306
|
-
system_prompt: string;
|
|
307
|
-
audio_speed: number;
|
|
308
|
-
duration_ms: number;
|
|
309
|
-
started_at: string;
|
|
310
|
-
};
|
|
311
|
-
type Conversation = {
|
|
312
|
-
id: string;
|
|
313
|
-
external_id: string | null;
|
|
314
|
-
model: string;
|
|
315
|
-
welcome_message: string | null;
|
|
316
|
-
input_format: "pcm_44100" | "mulaw_8000";
|
|
317
|
-
output_format: "pcm_44100" | "mulaw_8000";
|
|
318
|
-
text: string;
|
|
319
|
-
duration_ms: number;
|
|
320
|
-
started_at: ISODateTime;
|
|
321
|
-
ended_at: ISODateTime;
|
|
322
|
-
items: Array<ConversationItem>;
|
|
323
|
-
};
|
|
324
366
|
type ConversationSuccessResponse = {
|
|
325
367
|
conversation: Conversation;
|
|
326
368
|
};
|
|
@@ -358,8 +400,8 @@ declare class Conversations {
|
|
|
358
400
|
project?: string;
|
|
359
401
|
durationMin?: number;
|
|
360
402
|
durationMax?: number;
|
|
361
|
-
startedAtMin?: ISODate | ISODateTime
|
|
362
|
-
startedAtMax?: ISODate | ISODateTime
|
|
403
|
+
startedAtMin?: ISODate | ISODateTime;
|
|
404
|
+
startedAtMax?: ISODate | ISODateTime;
|
|
363
405
|
}): DataOrError<ConversationsSuccessResponse>;
|
|
364
406
|
get(id: string): DataOrError<ConversationSuccessResponse>;
|
|
365
407
|
getByExternalId({ project, externalId, }: {
|
|
@@ -479,13 +521,20 @@ interface WebSocketTool extends ToolBase {
|
|
|
479
521
|
tool_call_output_timeout_ms: number;
|
|
480
522
|
}
|
|
481
523
|
type Tool = WebhookTool | WebSocketTool;
|
|
524
|
+
type ListToolsParams = {
|
|
525
|
+
project?: string;
|
|
526
|
+
};
|
|
482
527
|
type ListToolsSuccessResponse = DataOrError<{
|
|
483
528
|
tools: Array<Tool>;
|
|
484
529
|
}>;
|
|
530
|
+
type GetToolParams = {
|
|
531
|
+
project?: string;
|
|
532
|
+
};
|
|
485
533
|
type GetToolSuccessResponse = DataOrError<{
|
|
486
534
|
tool: Tool;
|
|
487
535
|
}>;
|
|
488
536
|
interface CreateToolParamsBase {
|
|
537
|
+
project?: string;
|
|
489
538
|
name: string;
|
|
490
539
|
description: string;
|
|
491
540
|
executionMode: ExecutionMode;
|
|
@@ -508,6 +557,7 @@ type CreateToolSuccessResponse = {
|
|
|
508
557
|
name: string;
|
|
509
558
|
};
|
|
510
559
|
type UpdateToolParams = {
|
|
560
|
+
project?: string;
|
|
511
561
|
name?: string;
|
|
512
562
|
description?: string;
|
|
513
563
|
type?: "custom_webhook" | "custom_websocket";
|
|
@@ -522,6 +572,9 @@ type UpdateToolParams = {
|
|
|
522
572
|
type UpdateToolSuccessResponse = {
|
|
523
573
|
success: true;
|
|
524
574
|
};
|
|
575
|
+
type DeleteToolParams = {
|
|
576
|
+
project?: string;
|
|
577
|
+
};
|
|
525
578
|
type DeleteToolSuccessResponse = {
|
|
526
579
|
success: true;
|
|
527
580
|
};
|
|
@@ -529,12 +582,13 @@ type DeleteToolSuccessResponse = {
|
|
|
529
582
|
declare class Tools {
|
|
530
583
|
private readonly phonic;
|
|
531
584
|
constructor(phonic: Phonic);
|
|
585
|
+
private getQueryString;
|
|
532
586
|
private getParametersForBody;
|
|
533
|
-
list(): DataOrError<ListToolsSuccessResponse>;
|
|
534
|
-
get(nameOrId: string): DataOrError<GetToolSuccessResponse>;
|
|
587
|
+
list(params?: ListToolsParams): DataOrError<ListToolsSuccessResponse>;
|
|
588
|
+
get(nameOrId: string, params?: GetToolParams): DataOrError<GetToolSuccessResponse>;
|
|
535
589
|
create(params: CreateToolParams): DataOrError<CreateToolSuccessResponse>;
|
|
536
590
|
update(nameOrId: string, params: UpdateToolParams): DataOrError<UpdateToolSuccessResponse>;
|
|
537
|
-
delete(nameOrId: string): DataOrError<DeleteToolSuccessResponse>;
|
|
591
|
+
delete(nameOrId: string, params?: DeleteToolParams): DataOrError<DeleteToolSuccessResponse>;
|
|
538
592
|
}
|
|
539
593
|
|
|
540
594
|
type Voice = {
|
|
@@ -627,4 +681,4 @@ declare class Phonic {
|
|
|
627
681
|
}>;
|
|
628
682
|
}
|
|
629
683
|
|
|
630
|
-
export { Phonic, type PhonicConfigurationEndpointRequestPayload, type PhonicConfigurationEndpointResponsePayload, type PhonicSTSConfig, PhonicSTSWebSocket, type PhonicSTSWebSocketResponseMessage };
|
|
684
|
+
export { type ConversationAnalysisWebhookPayload, type ConversationEndedWebhookPayload, Phonic, type PhonicConfigurationEndpointRequestPayload, type PhonicConfigurationEndpointResponsePayload, type PhonicSTSConfig, PhonicSTSWebSocket, type PhonicSTSWebSocketResponseMessage };
|
package/dist/index.js
CHANGED
|
@@ -35,7 +35,7 @@ __export(index_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(index_exports);
|
|
36
36
|
|
|
37
37
|
// package.json
|
|
38
|
-
var version = "0.
|
|
38
|
+
var version = "0.29.1";
|
|
39
39
|
|
|
40
40
|
// src/agents/index.ts
|
|
41
41
|
var Agents = class {
|
|
@@ -425,6 +425,13 @@ var Tools = class {
|
|
|
425
425
|
constructor(phonic) {
|
|
426
426
|
this.phonic = phonic;
|
|
427
427
|
}
|
|
428
|
+
getQueryString(params) {
|
|
429
|
+
const project = params?.project;
|
|
430
|
+
const queryString = new URLSearchParams({
|
|
431
|
+
...project !== void 0 && { project }
|
|
432
|
+
}).toString();
|
|
433
|
+
return queryString;
|
|
434
|
+
}
|
|
428
435
|
getParametersForBody(parameters) {
|
|
429
436
|
if (parameters === void 0) {
|
|
430
437
|
return void 0;
|
|
@@ -441,13 +448,15 @@ var Tools = class {
|
|
|
441
448
|
};
|
|
442
449
|
});
|
|
443
450
|
}
|
|
444
|
-
async list() {
|
|
445
|
-
const response = await this.phonic.get(
|
|
451
|
+
async list(params) {
|
|
452
|
+
const response = await this.phonic.get(
|
|
453
|
+
`/tools?${this.getQueryString(params)}`
|
|
454
|
+
);
|
|
446
455
|
return response;
|
|
447
456
|
}
|
|
448
|
-
async get(nameOrId) {
|
|
457
|
+
async get(nameOrId, params) {
|
|
449
458
|
const response = await this.phonic.get(
|
|
450
|
-
`/tools/${nameOrId}`
|
|
459
|
+
`/tools/${nameOrId}?${this.getQueryString(params)}`
|
|
451
460
|
);
|
|
452
461
|
return response;
|
|
453
462
|
}
|
|
@@ -469,14 +478,14 @@ var Tools = class {
|
|
|
469
478
|
body.tool_call_output_timeout_ms = params.toolCallOutputTimeoutMs;
|
|
470
479
|
}
|
|
471
480
|
const response = await this.phonic.post(
|
|
472
|
-
|
|
481
|
+
`/tools?${this.getQueryString(params)}`,
|
|
473
482
|
body
|
|
474
483
|
);
|
|
475
484
|
return response;
|
|
476
485
|
}
|
|
477
486
|
async update(nameOrId, params) {
|
|
478
487
|
const response = await this.phonic.patch(
|
|
479
|
-
`/tools/${nameOrId}`,
|
|
488
|
+
`/tools/${nameOrId}?${this.getQueryString(params)}`,
|
|
480
489
|
{
|
|
481
490
|
name: params.name,
|
|
482
491
|
description: params.description,
|
|
@@ -492,9 +501,9 @@ var Tools = class {
|
|
|
492
501
|
);
|
|
493
502
|
return response;
|
|
494
503
|
}
|
|
495
|
-
async delete(nameOrId) {
|
|
504
|
+
async delete(nameOrId, params) {
|
|
496
505
|
const response = await this.phonic.delete(
|
|
497
|
-
`/tools/${nameOrId}`
|
|
506
|
+
`/tools/${nameOrId}?${this.getQueryString(params)}`
|
|
498
507
|
);
|
|
499
508
|
return response;
|
|
500
509
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// package.json
|
|
2
|
-
var version = "0.
|
|
2
|
+
var version = "0.29.1";
|
|
3
3
|
|
|
4
4
|
// src/agents/index.ts
|
|
5
5
|
var Agents = class {
|
|
@@ -389,6 +389,13 @@ var Tools = class {
|
|
|
389
389
|
constructor(phonic) {
|
|
390
390
|
this.phonic = phonic;
|
|
391
391
|
}
|
|
392
|
+
getQueryString(params) {
|
|
393
|
+
const project = params?.project;
|
|
394
|
+
const queryString = new URLSearchParams({
|
|
395
|
+
...project !== void 0 && { project }
|
|
396
|
+
}).toString();
|
|
397
|
+
return queryString;
|
|
398
|
+
}
|
|
392
399
|
getParametersForBody(parameters) {
|
|
393
400
|
if (parameters === void 0) {
|
|
394
401
|
return void 0;
|
|
@@ -405,13 +412,15 @@ var Tools = class {
|
|
|
405
412
|
};
|
|
406
413
|
});
|
|
407
414
|
}
|
|
408
|
-
async list() {
|
|
409
|
-
const response = await this.phonic.get(
|
|
415
|
+
async list(params) {
|
|
416
|
+
const response = await this.phonic.get(
|
|
417
|
+
`/tools?${this.getQueryString(params)}`
|
|
418
|
+
);
|
|
410
419
|
return response;
|
|
411
420
|
}
|
|
412
|
-
async get(nameOrId) {
|
|
421
|
+
async get(nameOrId, params) {
|
|
413
422
|
const response = await this.phonic.get(
|
|
414
|
-
`/tools/${nameOrId}`
|
|
423
|
+
`/tools/${nameOrId}?${this.getQueryString(params)}`
|
|
415
424
|
);
|
|
416
425
|
return response;
|
|
417
426
|
}
|
|
@@ -433,14 +442,14 @@ var Tools = class {
|
|
|
433
442
|
body.tool_call_output_timeout_ms = params.toolCallOutputTimeoutMs;
|
|
434
443
|
}
|
|
435
444
|
const response = await this.phonic.post(
|
|
436
|
-
|
|
445
|
+
`/tools?${this.getQueryString(params)}`,
|
|
437
446
|
body
|
|
438
447
|
);
|
|
439
448
|
return response;
|
|
440
449
|
}
|
|
441
450
|
async update(nameOrId, params) {
|
|
442
451
|
const response = await this.phonic.patch(
|
|
443
|
-
`/tools/${nameOrId}`,
|
|
452
|
+
`/tools/${nameOrId}?${this.getQueryString(params)}`,
|
|
444
453
|
{
|
|
445
454
|
name: params.name,
|
|
446
455
|
description: params.description,
|
|
@@ -456,9 +465,9 @@ var Tools = class {
|
|
|
456
465
|
);
|
|
457
466
|
return response;
|
|
458
467
|
}
|
|
459
|
-
async delete(nameOrId) {
|
|
468
|
+
async delete(nameOrId, params) {
|
|
460
469
|
const response = await this.phonic.delete(
|
|
461
|
-
`/tools/${nameOrId}`
|
|
470
|
+
`/tools/${nameOrId}?${this.getQueryString(params)}`
|
|
462
471
|
);
|
|
463
472
|
return response;
|
|
464
473
|
}
|