@getdial/cli 0.18.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 CHANGED
@@ -144,6 +144,7 @@ const call = program
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
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 {
@@ -9,7 +9,7 @@ export async function placeCall(opts) {
9
9
  fromNumberId,
10
10
  outboundInstruction: opts.outboundInstruction,
11
11
  ...(opts.language && { language: opts.language }),
12
- }, auth.apiKey);
12
+ }, auth.apiKey, opts.idempotencyKey ? { "idempotency-key": opts.idempotencyKey } : undefined);
13
13
  if (!res.ok)
14
14
  throw new DialError("call_failed", res.error, res.status);
15
15
  return res.data.call;
@@ -6,6 +6,7 @@ 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
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 = {
@@ -23,6 +24,7 @@ export const placeCallTool = {
23
24
  to: args.to,
24
25
  outboundInstruction: args.outboundInstruction,
25
26
  language: args.language,
27
+ idempotencyKey: args.idempotencyKey,
26
28
  fromNumberId: args.fromNumberId,
27
29
  });
28
30
  return jsonResult({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getdial/cli",
3
- "version": "0.18.0",
3
+ "version": "0.19.0",
4
4
  "description": "Dial CLI — install, sign up, and run the local listen service.",
5
5
  "license": "MIT",
6
6
  "repository": {
package/skills.tar.gz CHANGED
Binary file