@getdial/cli 0.25.1 → 0.25.2

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.
@@ -14,7 +14,6 @@ export async function runMessageSend(opts) {
14
14
  console.log(` to: ${m.to}`);
15
15
  console.log(` body: ${m.body}`);
16
16
  console.log(` status: ${m.status}`);
17
- console.log(` sid: ${m.sid}`);
18
17
  }
19
18
  return 0;
20
19
  }
package/dist/lib/api.js CHANGED
@@ -33,7 +33,15 @@ async function apiRequest(method, path, body, apiKey, extraHeaders) {
33
33
  if (res.statusCode >= 200 && res.statusCode < 300) {
34
34
  return { ok: true, status: res.statusCode, data: parsed };
35
35
  }
36
- const errMsg = parsed?.error ?? text ?? `HTTP ${res.statusCode}`;
36
+ // The server's `error` field is usually a string, but validation failures
37
+ // return a structured object (Zod's flatten). Stringify those as JSON rather
38
+ // than letting them coerce to "[object Object]", so the real reason survives.
39
+ const rawError = parsed?.error;
40
+ const errMsg = typeof rawError === "string"
41
+ ? rawError
42
+ : rawError != null
43
+ ? JSON.stringify(rawError)
44
+ : text || `HTTP ${res.statusCode}`;
37
45
  return { ok: false, status: res.statusCode, error: errMsg };
38
46
  }
39
47
  catch (err) {
@@ -4,6 +4,9 @@ import { DialError } from "./errors.js";
4
4
  export async function sendMessage(opts) {
5
5
  const auth = requireAuth();
6
6
  const fromNumberId = requireFromNumberId(auth, opts.fromNumberId);
7
+ // No `channel`: the server determines it from the from-number (a standard number
8
+ // sends SMS; an iMessage number sends iMessage with RCS/SMS fallback) and its send
9
+ // schema is strict — sending a stale `channel` field is rejected as a 400.
7
10
  const res = await apiPost("/api/v1/messages", { to: opts.to, body: opts.body, fromNumberId }, auth.apiKey);
8
11
  if (!res.ok)
9
12
  throw new DialError("send_failed", res.error, res.status);
@@ -37,6 +37,7 @@ export const messageSchema = z
37
37
  channel: z.string().optional(),
38
38
  direction: z.string().optional(),
39
39
  status: statusSchema,
40
+ statusError: z.string().nullish().describe("Failure reason when status is undelivered/failed"),
40
41
  createdAt: z.string().optional(),
41
42
  })
42
43
  .passthrough();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getdial/cli",
3
- "version": "0.25.1",
3
+ "version": "0.25.2",
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