@getdial/cli 0.44.0 → 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();
|
|
@@ -8,7 +8,7 @@ export const listGroupsTool = {
|
|
|
8
8
|
title: "List Groups",
|
|
9
9
|
description: "List the group conversations your lines are in. A group is a conversation that isn't a phone " +
|
|
10
10
|
"number, so it has an id of its own: pass it as groupId to send_message, or to list_messages to " +
|
|
11
|
-
"read that conversation. Groups exist on WhatsApp lines. " +
|
|
11
|
+
"read that conversation. Groups exist on WhatsApp lines and iMessage numbers. " +
|
|
12
12
|
"A group's name can be null — it is read live from the line holding the conversation, so a line " +
|
|
13
13
|
"that can't answer in time yields a null name rather than hiding the group. " +
|
|
14
14
|
"There is no join event: list again to see a group your line was just added to.",
|
|
@@ -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
|
},
|
|
@@ -12,7 +12,7 @@ const inputSchema = {
|
|
|
12
12
|
.string()
|
|
13
13
|
.min(1)
|
|
14
14
|
.optional()
|
|
15
|
-
.describe("A group conversation to send into (see list_groups), instead of a to number. The sending line comes from the group, so no from-number is needed. Provide exactly one of to or groupId"),
|
|
15
|
+
.describe("A group conversation to send into (see list_groups), instead of a to number. The sending line comes from the group, so no from-number is needed, and neither is channel — the group already knows which one it is on, and naming a different one is refused. Provide exactly one of to or groupId"),
|
|
16
16
|
channel: z
|
|
17
17
|
.enum(["imessage", "whatsapp"])
|
|
18
18
|
.optional()
|
|
@@ -48,7 +48,8 @@ export const sendMessageTool = {
|
|
|
48
48
|
"optionally with media attachments (MMS). On an iMessage number, a single audio attachment is " +
|
|
49
49
|
"delivered as a voice message unless forceAudioFile is true. " +
|
|
50
50
|
"Address it with exactly one of to or groupId. A WhatsApp number sends text and a single " +
|
|
51
|
-
"attachment (a caption is allowed only with an image or video)
|
|
51
|
+
"attachment (a caption is allowed only with an image or video); a WhatsApp group is text-only, " +
|
|
52
|
+
"while an iMessage group takes media like any other iMessage conversation.",
|
|
52
53
|
inputSchema,
|
|
53
54
|
outputSchema: { message: messageSchema },
|
|
54
55
|
annotations: { openWorldHint: true },
|
package/package.json
CHANGED
package/skills.tar.gz
CHANGED
|
Binary file
|