@getdial/cli 0.25.2 → 0.26.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
|
@@ -99,13 +99,17 @@ number
|
|
|
99
99
|
.command("purchase")
|
|
100
100
|
.description("Purchase an additional phone number. POST /api/v1/numbers.")
|
|
101
101
|
.requiredOption("--inbound-instruction <text>", "system prompt for inbound calls to this number")
|
|
102
|
+
.requiredOption("--explicit-programmatic-consent <text>", "required attestation that the account holder consented to provisioning this number programmatically (stored on the number)")
|
|
102
103
|
.option("--inbound-voice-gender <male|female>", "voice gender for inbound calls (default: female; pass male to override)")
|
|
103
|
-
.option("--area-code <code>", "preferred US area code (only US numbers can be provisioned)")
|
|
104
|
+
.option("--area-code <code>", "preferred US area code (only US numbers can be provisioned; ignored with --include-imessage)")
|
|
105
|
+
.option("--include-imessage", "provision an iMessage number (pay-as-you-go only; provisioned asynchronously — poll `dial number list` until ready)")
|
|
104
106
|
.option("--json", "machine-readable output")
|
|
105
107
|
.action(async (opts) => process.exit(await runNumberPurchase({
|
|
106
108
|
inboundInstruction: opts.inboundInstruction,
|
|
109
|
+
explicitProgrammaticConsent: opts.explicitProgrammaticConsent,
|
|
107
110
|
inboundVoiceGender: opts.inboundVoiceGender,
|
|
108
111
|
areaCode: opts.areaCode,
|
|
112
|
+
includeImessage: !!opts.includeImessage,
|
|
109
113
|
json: !!opts.json,
|
|
110
114
|
})));
|
|
111
115
|
number
|
|
@@ -5,8 +5,10 @@ export async function runNumberPurchase(opts) {
|
|
|
5
5
|
try {
|
|
6
6
|
const n = await purchaseNumber({
|
|
7
7
|
inboundInstruction: opts.inboundInstruction,
|
|
8
|
+
explicitProgrammaticConsent: opts.explicitProgrammaticConsent,
|
|
8
9
|
inboundVoiceGender: opts.inboundVoiceGender,
|
|
9
10
|
areaCode: opts.areaCode,
|
|
11
|
+
includeImessage: opts.includeImessage,
|
|
10
12
|
});
|
|
11
13
|
if (opts.json) {
|
|
12
14
|
console.log(JSON.stringify({ ok: true, number: n }));
|
|
@@ -16,6 +18,11 @@ export async function runNumberPurchase(opts) {
|
|
|
16
18
|
console.log(` number: ${n.number}`);
|
|
17
19
|
console.log(` id: ${n.id}`);
|
|
18
20
|
console.log(` country: ${n.country}`);
|
|
21
|
+
// iMessage numbers provision asynchronously: the number is returned right
|
|
22
|
+
// away in setupStatus "provisioning". Tell the user to poll before using it.
|
|
23
|
+
if (opts.includeImessage) {
|
|
24
|
+
console.log(` status: ${n.setupStatus ?? "provisioning"} — run \`dial number list\` until it's "ready" before sending or calling from it.`);
|
|
25
|
+
}
|
|
19
26
|
}
|
|
20
27
|
return 0;
|
|
21
28
|
}
|
package/dist/lib/api.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { request } from "undici";
|
|
2
2
|
import { logger } from "./log.js";
|
|
3
|
+
import { VERSION } from "./version.js";
|
|
3
4
|
const DEFAULT_BASE = "https://api.getdial.ai";
|
|
5
|
+
// Identifies the CLI on every request, so server-side request logs attribute
|
|
6
|
+
// provisioning (and everything else) to the client + version that made the call.
|
|
7
|
+
const USER_AGENT = `@getdial/cli/${VERSION}`;
|
|
4
8
|
export function baseUrl() {
|
|
5
9
|
return process.env.DIAL_API_URL ?? DEFAULT_BASE;
|
|
6
10
|
}
|
|
@@ -15,7 +19,7 @@ export async function apiPatch(path, body, apiKey) {
|
|
|
15
19
|
}
|
|
16
20
|
async function apiRequest(method, path, body, apiKey, extraHeaders) {
|
|
17
21
|
const url = `${baseUrl()}${path}`;
|
|
18
|
-
const headers = { "content-type": "application/json", ...(extraHeaders ?? {}) };
|
|
22
|
+
const headers = { "content-type": "application/json", "user-agent": USER_AGENT, ...(extraHeaders ?? {}) };
|
|
19
23
|
if (apiKey)
|
|
20
24
|
headers.authorization = `Bearer ${apiKey}`;
|
|
21
25
|
try {
|
package/dist/lib/ops/numbers.js
CHANGED
|
@@ -10,10 +10,16 @@ export async function listNumbers() {
|
|
|
10
10
|
}
|
|
11
11
|
export async function purchaseNumber(opts) {
|
|
12
12
|
const auth = requireAuth();
|
|
13
|
-
const body = {
|
|
13
|
+
const body = {
|
|
14
|
+
inboundInstruction: opts.inboundInstruction,
|
|
15
|
+
explicitProgrammaticConsent: opts.explicitProgrammaticConsent,
|
|
16
|
+
};
|
|
14
17
|
if (opts.inboundVoiceGender)
|
|
15
18
|
body.inboundVoiceGender = opts.inboundVoiceGender;
|
|
16
|
-
|
|
19
|
+
// iMessage numbers ignore areaCode, so only send it for standard numbers.
|
|
20
|
+
if (opts.includeImessage)
|
|
21
|
+
body.capabilities = ["sms", "call", "imessage"];
|
|
22
|
+
else if (opts.areaCode)
|
|
17
23
|
body.areaCode = opts.areaCode;
|
|
18
24
|
const res = await apiPost("/api/v1/numbers", body, auth.apiKey);
|
|
19
25
|
if (!res.ok)
|
|
@@ -4,8 +4,10 @@ import { purchaseNumber } from "../../lib/ops/numbers.js";
|
|
|
4
4
|
import { phoneNumberSchema } from "../schemas.js";
|
|
5
5
|
const inputSchema = {
|
|
6
6
|
inboundInstruction: z.string().min(1).describe("System prompt for inbound calls to this number"),
|
|
7
|
+
explicitProgrammaticConsent: z.string().min(1).max(2000).describe("Required attestation (max 2000 chars) that the account holder consented to provisioning this number programmatically; stored on the number"),
|
|
7
8
|
inboundVoiceGender: z.enum(["male", "female"]).optional().describe("Voice gender for inbound calls to this number; the default is female"),
|
|
8
|
-
areaCode: z.string().optional().describe("Preferred US area code; omitted → any available US number. Only US numbers can be provisioned at this time"),
|
|
9
|
+
areaCode: z.string().optional().describe("Preferred US area code; omitted → any available US number. Only US numbers can be provisioned at this time. Ignored for iMessage numbers"),
|
|
10
|
+
includeImessage: z.boolean().optional().describe('Provision an iMessage number (pay-as-you-go only; provisioned asynchronously — poll List Numbers until setupStatus is "ready")'),
|
|
9
11
|
};
|
|
10
12
|
export const purchaseNumberTool = {
|
|
11
13
|
name: "purchase_number",
|
|
@@ -19,8 +21,10 @@ export const purchaseNumberTool = {
|
|
|
19
21
|
run: async (args) => jsonResult({
|
|
20
22
|
number: await purchaseNumber({
|
|
21
23
|
inboundInstruction: args.inboundInstruction,
|
|
24
|
+
explicitProgrammaticConsent: args.explicitProgrammaticConsent,
|
|
22
25
|
inboundVoiceGender: args.inboundVoiceGender,
|
|
23
26
|
areaCode: args.areaCode,
|
|
27
|
+
includeImessage: args.includeImessage,
|
|
24
28
|
}),
|
|
25
29
|
}),
|
|
26
30
|
};
|
package/package.json
CHANGED
package/skills.tar.gz
CHANGED
|
Binary file
|