@blinkdotnew/cli 0.3.3 → 0.3.5
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 +33 -15
- package/package.json +1 -1
- package/src/commands/ai.ts +6 -4
- package/src/commands/phone.ts +31 -12
package/dist/cli.js
CHANGED
|
@@ -478,12 +478,12 @@ Supported formats: mp3, wav, m4a, ogg
|
|
|
478
478
|
if (isJsonMode()) return printJson(result);
|
|
479
479
|
console.log(result?.text ?? result?.transcript ?? JSON.stringify(result));
|
|
480
480
|
});
|
|
481
|
-
ai.command("call <phone-number> <system-prompt>").description("Make an AI phone call to any number (US/International)").option("--voice <voice>", "Voice: openai:alloy | openai:nova | cartesia:sonic-english", "openai:alloy").option("--max-duration <seconds>", "Max call duration in seconds", "300").option("--no-wait", "Return call_id immediately without waiting for completion").option("--from <number>", "Phone number to call from (E.164 format, e.g. +14155551234). Uses primary number if omitted.").addHelpText("after", `
|
|
481
|
+
ai.command("call <phone-number> <system-prompt>").description("Make an AI phone call to any number (US/International)").option("--voice <voice>", "Voice: openai:alloy | openai:nova | cartesia:sonic-english", "openai:alloy").option("--first-message <text>", 'What the AI says first when call connects (default: "Hello?")').option("--max-duration <seconds>", "Max call duration in seconds", "300").option("--no-wait", "Return call_id immediately without waiting for completion").option("--from <number>", "Phone number to call from (E.164 format, e.g. +14155551234). Uses primary number if omitted.").addHelpText("after", `
|
|
482
482
|
Examples:
|
|
483
|
-
$ blink ai call "+14155551234" "You are collecting a
|
|
484
|
-
$ blink ai call "+14155551234" "Confirm John's appointment
|
|
485
|
-
$ blink ai call "+14155551234" "
|
|
486
|
-
$ blink ai call "+14155551234" "Your task" --json | jq '.call_id'
|
|
483
|
+
$ blink ai call "+14155551234" "You are collecting a $240 payment from John Smith. Be polite." --first-message "Hi John, this is an automated call from Acme."
|
|
484
|
+
$ blink ai call "+14155551234" "Confirm John's appointment at 3pm" --first-message "Hello, calling to confirm your appointment."
|
|
485
|
+
$ blink ai call "+14155551234" "Collect feedback on recent order" --voice openai:nova
|
|
486
|
+
$ blink ai call "+14155551234" "Your task" --no-wait --json | jq '.call_id'
|
|
487
487
|
|
|
488
488
|
Phone number must be in E.164 format: +1XXXXXXXXXX (US), +44XXXXXXXXXX (UK), etc.
|
|
489
489
|
|
|
@@ -507,6 +507,7 @@ Use --from to specify which of your workspace numbers to call from.
|
|
|
507
507
|
system_prompt: systemPrompt,
|
|
508
508
|
voice: opts.voice,
|
|
509
509
|
max_duration_seconds: parseInt(opts.maxDuration),
|
|
510
|
+
...opts.firstMessage ? { first_message: opts.firstMessage } : {},
|
|
510
511
|
...opts.from ? { from_number: opts.from } : {}
|
|
511
512
|
}
|
|
512
513
|
})
|
|
@@ -1605,7 +1606,7 @@ Commands:
|
|
|
1605
1606
|
|
|
1606
1607
|
Examples:
|
|
1607
1608
|
$ blink phone list
|
|
1608
|
-
$ blink phone buy --label "Sales" --
|
|
1609
|
+
$ blink phone buy --label "Sales" --area-code 415
|
|
1609
1610
|
$ blink phone buy --label "Support"
|
|
1610
1611
|
$ blink phone label wpn_abc123 "Support line"
|
|
1611
1612
|
$ blink phone release wpn_abc123
|
|
@@ -1636,23 +1637,39 @@ Examples:
|
|
|
1636
1637
|
if (isJsonMode()) return printJson(records);
|
|
1637
1638
|
printRecords(records);
|
|
1638
1639
|
});
|
|
1639
|
-
phone.command("buy").description("
|
|
1640
|
+
phone.command("buy").description("Search and buy a phone number (25 credits/month)").option("--label <label>", 'Label for this number, e.g. "Sales" or "Support"').option("--country <code>", "Country code (e.g. US, GB, AU, DE)", "US").option("--area-code <code>", "Preferred area code (e.g. 415, 914, 020)").addHelpText("after", `
|
|
1640
1641
|
Examples:
|
|
1641
|
-
$ blink phone buy
|
|
1642
|
-
$ blink phone buy --label "Sales" --area-code 415
|
|
1642
|
+
$ blink phone buy --label "Sales" --area-code 914
|
|
1643
1643
|
$ blink phone buy --label "UK Support" --country GB
|
|
1644
|
+
$ blink phone buy --label "Germany" --country DE
|
|
1644
1645
|
$ blink phone buy --json | jq '.phone_number'
|
|
1645
1646
|
|
|
1646
|
-
|
|
1647
|
+
Searches real available numbers from Twilio, picks the first result.
|
|
1648
|
+
25 credits charged immediately, then monthly on anniversary.
|
|
1649
|
+
Supported countries: US, CA, GB, AU, NZ, DE, FR, NL, SE, NO, DK, FI, IE, BE, AT, CH, ES, IT, PT, PL, CZ, RO, HU, GR, JP, SG, HK, BR, MX, CL, CO, ZA, IL, PR
|
|
1647
1650
|
`).action(async (opts) => {
|
|
1648
1651
|
requireToken();
|
|
1652
|
+
const searchParams = new URLSearchParams({ country: opts.country ?? "US" });
|
|
1653
|
+
if (opts.areaCode) searchParams.set("area_code", opts.areaCode);
|
|
1654
|
+
const searchResult = await withSpinner(
|
|
1655
|
+
`Searching for ${opts.country ?? "US"} numbers...`,
|
|
1656
|
+
() => resourcesRequest(`/api/v1/phone-numbers/available?${searchParams}`)
|
|
1657
|
+
);
|
|
1658
|
+
if (!searchResult.numbers?.length) {
|
|
1659
|
+
process.stderr.write(`
|
|
1660
|
+
No numbers available${opts.areaCode ? ` in area code ${opts.areaCode}` : ""}. Try a different area code.
|
|
1661
|
+
`);
|
|
1662
|
+
process.exit(1);
|
|
1663
|
+
}
|
|
1664
|
+
const picked = searchResult.numbers[0];
|
|
1649
1665
|
const result = await withSpinner(
|
|
1650
|
-
|
|
1666
|
+
`Provisioning ${picked.phone_number}...`,
|
|
1651
1667
|
() => resourcesRequest("/api/v1/phone-numbers", {
|
|
1652
1668
|
body: {
|
|
1669
|
+
phone_number: picked.phone_number,
|
|
1653
1670
|
label: opts.label || void 0,
|
|
1654
|
-
|
|
1655
|
-
|
|
1671
|
+
locality: picked.locality || void 0,
|
|
1672
|
+
country: picked.country
|
|
1656
1673
|
}
|
|
1657
1674
|
})
|
|
1658
1675
|
);
|
|
@@ -1660,9 +1677,10 @@ Examples:
|
|
|
1660
1677
|
console.log(`\u2713 Phone number provisioned`);
|
|
1661
1678
|
console.log(` Number ${formatPhone(result.phone_number)}`);
|
|
1662
1679
|
if (result.label) console.log(` Label ${result.label}`);
|
|
1663
|
-
|
|
1680
|
+
const loc = result.locality;
|
|
1681
|
+
console.log(` Location ${loc ? `${loc} \xB7 ` : ""}${result.country}`);
|
|
1664
1682
|
console.log(` ID ${result.id}`);
|
|
1665
|
-
console.log(` Billing
|
|
1683
|
+
console.log(` Billing 25 credits/month`);
|
|
1666
1684
|
console.log();
|
|
1667
1685
|
console.log(`Use it: blink ai call "+1..." "Your task" --from "${result.phone_number}"`);
|
|
1668
1686
|
});
|
package/package.json
CHANGED
package/src/commands/ai.ts
CHANGED
|
@@ -288,15 +288,16 @@ Supported formats: mp3, wav, m4a, ogg
|
|
|
288
288
|
ai.command('call <phone-number> <system-prompt>')
|
|
289
289
|
.description('Make an AI phone call to any number (US/International)')
|
|
290
290
|
.option('--voice <voice>', 'Voice: openai:alloy | openai:nova | cartesia:sonic-english', 'openai:alloy')
|
|
291
|
+
.option('--first-message <text>', 'What the AI says first when call connects (default: "Hello?")')
|
|
291
292
|
.option('--max-duration <seconds>', 'Max call duration in seconds', '300')
|
|
292
293
|
.option('--no-wait', 'Return call_id immediately without waiting for completion')
|
|
293
294
|
.option('--from <number>', 'Phone number to call from (E.164 format, e.g. +14155551234). Uses primary number if omitted.')
|
|
294
295
|
.addHelpText('after', `
|
|
295
296
|
Examples:
|
|
296
|
-
$ blink ai call "+14155551234" "You are collecting a
|
|
297
|
-
$ blink ai call "+14155551234" "Confirm John's appointment
|
|
298
|
-
$ blink ai call "+14155551234" "
|
|
299
|
-
$ blink ai call "+14155551234" "Your task" --json | jq '.call_id'
|
|
297
|
+
$ blink ai call "+14155551234" "You are collecting a $240 payment from John Smith. Be polite." --first-message "Hi John, this is an automated call from Acme."
|
|
298
|
+
$ blink ai call "+14155551234" "Confirm John's appointment at 3pm" --first-message "Hello, calling to confirm your appointment."
|
|
299
|
+
$ blink ai call "+14155551234" "Collect feedback on recent order" --voice openai:nova
|
|
300
|
+
$ blink ai call "+14155551234" "Your task" --no-wait --json | jq '.call_id'
|
|
300
301
|
|
|
301
302
|
Phone number must be in E.164 format: +1XXXXXXXXXX (US), +44XXXXXXXXXX (UK), etc.
|
|
302
303
|
|
|
@@ -320,6 +321,7 @@ Use --from to specify which of your workspace numbers to call from.
|
|
|
320
321
|
system_prompt: systemPrompt,
|
|
321
322
|
voice: opts.voice,
|
|
322
323
|
max_duration_seconds: parseInt(opts.maxDuration),
|
|
324
|
+
...(opts.firstMessage ? { first_message: opts.firstMessage } : {}),
|
|
323
325
|
...(opts.from ? { from_number: opts.from } : {}),
|
|
324
326
|
},
|
|
325
327
|
})
|
package/src/commands/phone.ts
CHANGED
|
@@ -56,7 +56,7 @@ Commands:
|
|
|
56
56
|
|
|
57
57
|
Examples:
|
|
58
58
|
$ blink phone list
|
|
59
|
-
$ blink phone buy --label "Sales" --
|
|
59
|
+
$ blink phone buy --label "Sales" --area-code 415
|
|
60
60
|
$ blink phone buy --label "Support"
|
|
61
61
|
$ blink phone label wpn_abc123 "Support line"
|
|
62
62
|
$ blink phone release wpn_abc123
|
|
@@ -95,27 +95,45 @@ Examples:
|
|
|
95
95
|
|
|
96
96
|
// blink phone buy
|
|
97
97
|
phone.command('buy')
|
|
98
|
-
.description('
|
|
98
|
+
.description('Search and buy a phone number (25 credits/month)')
|
|
99
99
|
.option('--label <label>', 'Label for this number, e.g. "Sales" or "Support"')
|
|
100
|
-
.option('--country <code>', 'Country code
|
|
101
|
-
.option('--area-code <code>', 'Preferred area code (
|
|
100
|
+
.option('--country <code>', 'Country code (e.g. US, GB, AU, DE)', 'US')
|
|
101
|
+
.option('--area-code <code>', 'Preferred area code (e.g. 415, 914, 020)')
|
|
102
102
|
.addHelpText('after', `
|
|
103
103
|
Examples:
|
|
104
|
-
$ blink phone buy
|
|
105
|
-
$ blink phone buy --label "Sales" --area-code 415
|
|
104
|
+
$ blink phone buy --label "Sales" --area-code 914
|
|
106
105
|
$ blink phone buy --label "UK Support" --country GB
|
|
106
|
+
$ blink phone buy --label "Germany" --country DE
|
|
107
107
|
$ blink phone buy --json | jq '.phone_number'
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
Searches real available numbers from Twilio, picks the first result.
|
|
110
|
+
25 credits charged immediately, then monthly on anniversary.
|
|
111
|
+
Supported countries: US, CA, GB, AU, NZ, DE, FR, NL, SE, NO, DK, FI, IE, BE, AT, CH, ES, IT, PT, PL, CZ, RO, HU, GR, JP, SG, HK, BR, MX, CL, CO, ZA, IL, PR
|
|
110
112
|
`)
|
|
111
113
|
.action(async (opts) => {
|
|
112
114
|
requireToken()
|
|
113
|
-
|
|
115
|
+
// Step 1: Search for available numbers
|
|
116
|
+
const searchParams = new URLSearchParams({ country: opts.country ?? 'US' })
|
|
117
|
+
if (opts.areaCode) searchParams.set('area_code', opts.areaCode)
|
|
118
|
+
const searchResult = await withSpinner(`Searching for ${opts.country ?? 'US'} numbers...`, () =>
|
|
119
|
+
resourcesRequest(`/api/v1/phone-numbers/available?${searchParams}`)
|
|
120
|
+
) as { numbers: Array<{ phone_number: string; locality?: string; region?: string; country: string }> }
|
|
121
|
+
|
|
122
|
+
if (!searchResult.numbers?.length) {
|
|
123
|
+
process.stderr.write(`\nNo numbers available${opts.areaCode ? ` in area code ${opts.areaCode}` : ''}. Try a different area code.\n`)
|
|
124
|
+
process.exit(1)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const picked = searchResult.numbers[0]
|
|
128
|
+
|
|
129
|
+
// Step 2: Provision the picked number
|
|
130
|
+
const result = await withSpinner(`Provisioning ${picked.phone_number}...`, () =>
|
|
114
131
|
resourcesRequest('/api/v1/phone-numbers', {
|
|
115
132
|
body: {
|
|
133
|
+
phone_number: picked.phone_number,
|
|
116
134
|
label: opts.label || undefined,
|
|
117
|
-
|
|
118
|
-
|
|
135
|
+
locality: picked.locality || undefined,
|
|
136
|
+
country: picked.country,
|
|
119
137
|
},
|
|
120
138
|
})
|
|
121
139
|
) as PhoneRecord
|
|
@@ -123,9 +141,10 @@ Examples:
|
|
|
123
141
|
console.log(`✓ Phone number provisioned`)
|
|
124
142
|
console.log(` Number ${formatPhone(result.phone_number)}`)
|
|
125
143
|
if (result.label) console.log(` Label ${result.label}`)
|
|
126
|
-
|
|
144
|
+
const loc = (result as any).locality
|
|
145
|
+
console.log(` Location ${loc ? `${loc} · ` : ''}${result.country}`)
|
|
127
146
|
console.log(` ID ${result.id}`)
|
|
128
|
-
console.log(` Billing
|
|
147
|
+
console.log(` Billing 25 credits/month`)
|
|
129
148
|
console.log()
|
|
130
149
|
console.log(`Use it: blink ai call "+1..." "Your task" --from "${result.phone_number}"`)
|
|
131
150
|
})
|