@getdial/cli 0.17.0 → 0.19.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.
- package/dist/cli.js +3 -1
- package/dist/commands/call/send.js +1 -0
- package/dist/lib/api.js +4 -4
- package/dist/lib/ops/calls.js +6 -1
- package/dist/mcp/tools/place-call.js +4 -2
- package/package.json +1 -1
- package/skills.tar.gz +0 -0
package/dist/cli.js
CHANGED
|
@@ -143,7 +143,8 @@ const call = program
|
|
|
143
143
|
.description("Place an outbound voice call. POST /api/v1/calls.")
|
|
144
144
|
.option("--to <e164>", "destination phone number, E.164 (e.g. +14155551234)")
|
|
145
145
|
.option("--outbound-instruction <text>", "system prompt for the agent that will speak")
|
|
146
|
-
.option("--language <bcp47>", "BCP-47 language tag for the call
|
|
146
|
+
.option("--language <bcp47>", "BCP-47 language tag for the call (default: auto-detect from the destination number's country, alongside en-US)")
|
|
147
|
+
.option("--idempotency-key <key>", "unique key (e.g. a UUID) making the placement idempotent: re-running with the same key returns the already-placed call instead of dialing again")
|
|
147
148
|
.option("--from-number-id <id>", "phoneNumberId to call from (defaults to onboard's number)")
|
|
148
149
|
.option("--json", "machine-readable output")
|
|
149
150
|
.action(async (opts) => {
|
|
@@ -155,6 +156,7 @@ const call = program
|
|
|
155
156
|
to: opts.to,
|
|
156
157
|
outboundInstruction: opts.outboundInstruction,
|
|
157
158
|
language: opts.language,
|
|
159
|
+
idempotencyKey: opts.idempotencyKey,
|
|
158
160
|
fromNumberId: opts.fromNumberId,
|
|
159
161
|
json: !!opts.json,
|
|
160
162
|
}));
|
|
@@ -7,6 +7,7 @@ export async function runCallSend(opts) {
|
|
|
7
7
|
to: opts.to,
|
|
8
8
|
outboundInstruction: opts.outboundInstruction,
|
|
9
9
|
language: opts.language,
|
|
10
|
+
idempotencyKey: opts.idempotencyKey,
|
|
10
11
|
fromNumberId: opts.fromNumberId,
|
|
11
12
|
});
|
|
12
13
|
const waitCmd = `dial wait-for call.ended -f callId=${c.id} --json`;
|
package/dist/lib/api.js
CHANGED
|
@@ -4,8 +4,8 @@ const DEFAULT_BASE = "https://dial.up.railway.app";
|
|
|
4
4
|
export function baseUrl() {
|
|
5
5
|
return process.env.DIAL_API_URL ?? DEFAULT_BASE;
|
|
6
6
|
}
|
|
7
|
-
export async function apiPost(path, body, apiKey) {
|
|
8
|
-
return apiRequest("POST", path, body, apiKey);
|
|
7
|
+
export async function apiPost(path, body, apiKey, extraHeaders) {
|
|
8
|
+
return apiRequest("POST", path, body, apiKey, extraHeaders);
|
|
9
9
|
}
|
|
10
10
|
export async function apiGet(path, apiKey) {
|
|
11
11
|
return apiRequest("GET", path, undefined, apiKey);
|
|
@@ -13,9 +13,9 @@ export async function apiGet(path, apiKey) {
|
|
|
13
13
|
export async function apiPatch(path, body, apiKey) {
|
|
14
14
|
return apiRequest("PATCH", path, body, apiKey);
|
|
15
15
|
}
|
|
16
|
-
async function apiRequest(method, path, body, apiKey) {
|
|
16
|
+
async function apiRequest(method, path, body, apiKey, extraHeaders) {
|
|
17
17
|
const url = `${baseUrl()}${path}`;
|
|
18
|
-
const headers = { "content-type": "application/json" };
|
|
18
|
+
const headers = { "content-type": "application/json", ...(extraHeaders ?? {}) };
|
|
19
19
|
if (apiKey)
|
|
20
20
|
headers.authorization = `Bearer ${apiKey}`;
|
|
21
21
|
try {
|
package/dist/lib/ops/calls.js
CHANGED
|
@@ -4,7 +4,12 @@ import { DialError } from "./errors.js";
|
|
|
4
4
|
export async function placeCall(opts) {
|
|
5
5
|
const auth = requireAuth();
|
|
6
6
|
const fromNumberId = requireFromNumberId(auth, opts.fromNumberId);
|
|
7
|
-
const res = await apiPost("/api/v1/calls", {
|
|
7
|
+
const res = await apiPost("/api/v1/calls", {
|
|
8
|
+
to: opts.to,
|
|
9
|
+
fromNumberId,
|
|
10
|
+
outboundInstruction: opts.outboundInstruction,
|
|
11
|
+
...(opts.language && { language: opts.language }),
|
|
12
|
+
}, auth.apiKey, opts.idempotencyKey ? { "idempotency-key": opts.idempotencyKey } : undefined);
|
|
8
13
|
if (!res.ok)
|
|
9
14
|
throw new DialError("call_failed", res.error, res.status);
|
|
10
15
|
return res.data.call;
|
|
@@ -5,7 +5,8 @@ import { callSchema } from "../schemas.js";
|
|
|
5
5
|
const inputSchema = {
|
|
6
6
|
to: z.string().min(7).describe("Destination phone number, E.164 (e.g. +14155550123)"),
|
|
7
7
|
outboundInstruction: z.string().min(1).describe("System prompt for the AI voice agent on this call"),
|
|
8
|
-
language: z.string().
|
|
8
|
+
language: z.string().optional().describe("BCP-47 language tag for the call. Omit to auto-detect from the destination number's country (alongside en-US)."),
|
|
9
|
+
idempotencyKey: z.string().optional().describe("Unique key (e.g. a UUID) making the placement idempotent: retrying with the same key returns the already-placed call instead of dialing again"),
|
|
9
10
|
fromNumberId: z.string().optional().describe("Number id to call from; defaults to your primary number"),
|
|
10
11
|
};
|
|
11
12
|
export const placeCallTool = {
|
|
@@ -22,7 +23,8 @@ export const placeCallTool = {
|
|
|
22
23
|
const call = await placeCall({
|
|
23
24
|
to: args.to,
|
|
24
25
|
outboundInstruction: args.outboundInstruction,
|
|
25
|
-
language: args.language
|
|
26
|
+
language: args.language,
|
|
27
|
+
idempotencyKey: args.idempotencyKey,
|
|
26
28
|
fromNumberId: args.fromNumberId,
|
|
27
29
|
});
|
|
28
30
|
return jsonResult({
|
package/package.json
CHANGED
package/skills.tar.gz
CHANGED
|
Binary file
|