@getdial/cli 0.44.1 → 0.45.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.
|
@@ -4,7 +4,22 @@ import { printDialError } from "../../lib/cli-error.js";
|
|
|
4
4
|
/** Channels in the order they are printed, with the label each one shows as. */
|
|
5
5
|
const CHANNEL_LABELS = {
|
|
6
6
|
imessage: "iMessage",
|
|
7
|
+
whatsapp: "WhatsApp",
|
|
7
8
|
};
|
|
9
|
+
/**
|
|
10
|
+
* How one channel's verdict reads.
|
|
11
|
+
*
|
|
12
|
+
* Three states, not two. `null` means Dial did not answer for that channel — today only because the
|
|
13
|
+
* account holds no WhatsApp number of its own — and printing it as `no` would say the number is
|
|
14
|
+
* unreachable, which is the one thing it does not mean. A `?? "no"` here is the whole bug.
|
|
15
|
+
*/
|
|
16
|
+
function verdictOf(supported) {
|
|
17
|
+
if (supported === true)
|
|
18
|
+
return "yes";
|
|
19
|
+
if (supported === false)
|
|
20
|
+
return "no";
|
|
21
|
+
return "unknown";
|
|
22
|
+
}
|
|
8
23
|
export async function runLookup(number, opts) {
|
|
9
24
|
try {
|
|
10
25
|
const result = await lookupNumber(number);
|
|
@@ -17,7 +32,7 @@ export async function runLookup(number, opts) {
|
|
|
17
32
|
// A channel added to the API after this CLI shipped still prints, under its
|
|
18
33
|
// raw key — reporting an unknown channel is better than hiding it.
|
|
19
34
|
const label = CHANNEL_LABELS[channel] ?? channel;
|
|
20
|
-
console.log(` ${label.padEnd(9)} ${supported
|
|
35
|
+
console.log(` ${label.padEnd(9)} ${verdictOf(supported)}`);
|
|
21
36
|
}
|
|
22
37
|
return 0;
|
|
23
38
|
}
|
package/dist/lib/ops/lookup.js
CHANGED
|
@@ -9,7 +9,9 @@ import { DialError } from "./errors.js";
|
|
|
9
9
|
*
|
|
10
10
|
* A lookup Dial could not complete comes back as an error (502), never as a
|
|
11
11
|
* negative verdict — so a `false` here always means the number genuinely is not
|
|
12
|
-
* reachable on that channel, and
|
|
12
|
+
* reachable on that channel, and a `null` always means Dial did not answer for
|
|
13
|
+
* that channel. Neither ever means "we could not find out", and callers can
|
|
14
|
+
* treat all three differently.
|
|
13
15
|
*/
|
|
14
16
|
export async function lookupNumber(number) {
|
|
15
17
|
const auth = maybeAuth();
|
|
@@ -17,13 +17,22 @@ export const lookupNumberTool = {
|
|
|
17
17
|
"are added over time. The answer is point-in-time, not a property of the number — someone who changes " +
|
|
18
18
|
"device or turns the service off stops being reachable — so treat `true` as a strong signal for picking " +
|
|
19
19
|
"a channel rather than a promise that the send will land. A lookup that fails is an error, never a " +
|
|
20
|
-
"`false`, so a `false` always means the number genuinely isn't reachable there."
|
|
20
|
+
"`false` and never a `null`, so a `false` always means the number genuinely isn't reachable there. " +
|
|
21
|
+
"`whatsapp` is `null` when this account has no WhatsApp number of its own: a WhatsApp check is made " +
|
|
22
|
+
"from a WhatsApp line, so it is answered only for accounts that have one. `null` says something about " +
|
|
23
|
+
"the account, never about the number — do not report it as unreachable.",
|
|
21
24
|
inputSchema,
|
|
22
25
|
outputSchema: {
|
|
23
26
|
number: z.string().describe("The number you asked about, normalized to E.164"),
|
|
24
27
|
supports: z
|
|
25
28
|
.object({
|
|
26
29
|
imessage: z.boolean().describe("Whether the number can currently receive iMessage"),
|
|
30
|
+
whatsapp: z
|
|
31
|
+
.boolean()
|
|
32
|
+
.nullable()
|
|
33
|
+
.describe("Whether the number can currently receive WhatsApp: true reachable, false not " +
|
|
34
|
+
"reachable, null this account has no WhatsApp number so the check was not made. " +
|
|
35
|
+
"null is never a failure and never means unreachable."),
|
|
27
36
|
})
|
|
28
37
|
.describe("One key per channel, true when the number can be reached there"),
|
|
29
38
|
},
|
package/package.json
CHANGED
package/skills.tar.gz
CHANGED
|
Binary file
|